Closed GoogleCodeExporter closed 8 years ago
A similar issue occurs when trying to add or remove "skins" from the model, or
the geometries. The list of mesh "targets" is also not updated.
Option 1: Do not store target materials and meshes on the SkeletonControl
object, but generate them at runtime every frame. This is the easiest but also
most expensive option. On the plus side you only have to do this on
controlRender(), so this computation only occurs for models visible on the
screen.
Option 2: Add a new refresh flag that can be used to track changes to materials
and attach/detach of spatials. In SkeletonControl.controlUpdate() you check for
these flags and update the material/mesh target list accordingly.
Spatial.updateGeoemtricState() will simply set them to 0 when it goes through
the scene graph.
Original comment by ShadowIs...@gmail.com
on 24 Apr 2013 at 1:42
I tried both ways.
A new refresh flag was working but idk how it would have worked if materials
were changed on sub target nodes and so on.
I ended up doing it as option 1 suggested, and in practice it doesn't have a
noticeable impact on performance (I tired with 100 animated Otos). I guess it
could have a more noticeable impact if the sub graph is complex, but that's not
very likely to happen.
Also to avoid instantiating new arrays and lists on each frames, I changed the
way target meshes and materials were stored. I now use a safeArrayList for
target meshes and a HashSet for materials. This avoid instantiation and array
copies on each frames.
An a side note, now that target meshes and materials are gathered on each
frame, there is no need to serialize them so i removed them from the read/write
method.
@ShadowIsLord please review/comment this change
http://code.google.com/p/jmonkeyengine/source/detail?r=10577
Original comment by remy.bou...@gmail.com
on 27 Apr 2013 at 2:36
I made another change to do the update on render instead of on update as you
suggested.
https://code.google.com/p/jmonkeyengine/source/detail?r=10578
Original comment by remy.bou...@gmail.com
on 27 Apr 2013 at 2:44
Original issue reported on code.google.com by
remy.bou...@gmail.com
on 22 Apr 2013 at 9:29