JCPalmer Posted February 8, 2016 Share Posted February 8, 2016 AFAIK, before renders & after renders of every mesh always run, which is good. It looks impossible to know in a before render to know if a mesh is going to render as they run very early. After renders are another story. There might be a small lag, but timing wise this has to be do-able. question is how? Mesh._activate() will run set renderId. Can that be used, or does one need to override Mesh._activate() and do something more? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted February 8, 2016 Author Share Posted February 8, 2016 Well, I guess if lagging one frame is ok, I could have a lastRenderId property recorded in the before Render. If the beginning of the before render had: function beforeRender(){ var justRendered = this.lastRenderId !== this.reenderId; this.lastRenderId !== this.reenderId; .... } then there would be no need to have an after render. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted February 8, 2016 Author Share Posted February 8, 2016 wait, that is only scene level before render which always run. Meshes before render is called by Mesh.render(). Searched entire project source files, not seeing where this render() of a mesh is called, so cannot tell how many times (multiple cameras) or if always called. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted February 8, 2016 Author Share Posted February 8, 2016 in my beforeRender class, I put checking in against my TimelineControl system implemented with a scene level after render to see how many times it was called per frame.. Looks like callback is being called N_submeshes * N_cameras per Frame. It is probably not called at all when the meshs does not evaluate as active. If you do not have a scene level after render to control your time line, it is going to be very hard for you to use a mesh with multi-materials and or multiple cameras. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 8, 2016 Share Posted February 8, 2016 Not sure of your intent but I recently added mesh.onDraw Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted February 8, 2016 Author Share Posted February 8, 2016 3 minutes ago, Deltakosh said: Not sure of your intent but I recently added mesh.onDraw Neither am I. Have before render based morphing / skeleton animation. It was important that it ran, even when mesh was not seen. I also wondered if there a way to detect if a mesh just came into the frame for higher level stuff like initiating animations. Finding that Mesh level probably do not run when not seen, and worse run multiple times, so all the cpu to change vertices transform bones is done over an over. Thinking should switch to scene level before renders for always and once. Use mesh level for high level new in frame detection. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.