Closed jonnenauha closed 11 years ago
https://github.com/Adminotech/tundra/commit/b3f72500e7f828f4e2f495bc5d1aaacab823bc04 Makes a bit of overhaul to my OgreWorld internals. Fixes things with multiple submeshes and should speed up DestroyInstance() a bit, less things to loop around.
Hopefully this will get cleanly merged to lasses work that is making all (most at least) our super shaders available for instancing, which is a super exiting feature for artists! My thing was kind of restricted demo phase in terms of shaders :)
Multi-submesh support looks solid now. Draw distance & draw shadows settings are not being used in instanced entities though.
https://github.com/realXtend/naali/pull/680/files#L13R966 Hmm, I did implement and even test it by selecting a bunch of ents in the instancing test scene, setting their draw distance to 10 and they dissapeared. Came back when a high enough distance was used, or set to 0. It should sync that in both creation and any time the attribute changes.
Sorry, when retesting, draw distance worked correctly. Shadow casting is only changeable per instance batch, so it is now locked on.
Thanks @cadaver for the quick work and great job on cloning the super shaders with instancing support! This is huge plus for maintainability of the super shader.
Implements Ogre instancing support for Tundra in
EC_Mesh
andOgreWorld
.Implemented now
useInstancing
attribute for EC_Mesh.OgreEntity()
may return null if instancing is used. Created newOgreInstancedEntity()
for these situations. I've checked all core c++ code that nothing blindly uses the OgreEntity() ptr.CreateInstance()
andDestroyInstances()
functions that must be used by eg.EC_Mesh
in pair to keep OgreWorld internal state in sync.IsDebugInstancingEnabled()
andSetDebugInstancingEnabled(enabled)
and a qt property (just like PhysicsWorld does).IsInstancingStatic(meshRef)
andSetInstancingStatic(meshRef, static)
. This can make the rendering dramatically faster in cases where the instances are not moved. This must be decided by a inworld script, it is too bug prone to automate in OgreWorld. If you know a) you have huge amount of instances b) you are not going to move them via EC_Mesh transform or EC_Placeacble, either for scripts or via clients, you should go ahead and set static to true.bin/scenes/Instancing/scene.txml
Needs work!?
I've sent this pull request in good time so people have time to review it before merging talk becomes relevant. Any feedback on the code in general and API in OgreWorld would be appreciated!