|
This is used by TVRMLGLScene.Optimization to describe what kind of optimization should be done.
Values
-
roNone: No optimization. No OpenGL display lists are constructed. So calling PrepareRender and ChangedAll is very fast. On the other hand, rendering is significantly slower, as display lists often help a lot.
Use this if you plan to change the scene at runtime a lot (or when you're going to render TVRMLGLScene object very few times, say, only 1-2 frames, in some special situations) Then building display lists would be only a waste of time, since they would have to be rebuild very often.
-
roSceneAsAWhole: Treat the scene as a one big static object. One OpenGL display list is used, that renders the whole object. This is great optimization if the scene is static (otherwise rebuilding display lists too often would cost too much time) and you're sure that user will usually see the whole scene (or just a large part of it).
Note that this nullifies the purpose of TVRMLGLScene.RenderFrustum and TVRMLGLScene.RenderFrustumOctree methods. And the purpose of the TVRMLGLScene.Render method with a parameter <> Nil. That's because the scene will always be rendered fully to OpenGL.
Also, this is not good if some parts of the scene cannot be put on display list. This concerns things with TVRMLShapeState.EnableDisplayList = False, which currently means only MovieTexture nodes. TODO: we should fallback to roSeparateShapeStates automatically in such cases. For now, this will result in MovieTexture nodes being static (i.e. movie will not play).
If the scene is static but user usually only looks at some small part of it, then building octree for the scene and using roSeparateShapeStates and TVRMLGLScene.RenderFrustumOctree may be better.
-
roSeparateShapeStates: Build separate OpenGL display list for each TVRMLShapeState on list TVRMLScene.ShapeStates. Use this if
you will change from time to time only some small parts of the scene (since this will allow to rebuild, on changing, only some small display lists, as opposed to roSceneAsAWhole, that has to rebuild large display list even if the change is very local).
and/or you know that usually user will not see the whole scene, only a small part of it. See TestShapeStateVisibility parameter of TVRMLGLScene.Render and TVRMLGLScene.RenderFrustum and TVRMLGLScene.RenderFrustumOctree.
Another advantage of roSeparateShapeStates is when you use TVRMLGLAnimation. If part of your animation is actually still (i.e. the same ShapeState is used, the same nodes inside), and only the part changes — then the still ShapeStates will use and share only one display list (only one — throughout all the time when they are still!). This can be a huge memory saving, which is important because generating many display lists for TVRMLGLAnimation is generally very memory-hungry operation.
You can achieve even much better memory saving by using roSeparateShapeStatesNoTransformation.
This is achieved by TVRMLOpenGLRendererContextCache methods ShapeState_Xxx.
-
roSeparateShapeStatesNoTransform: This is like roSeparateShapeStates but it allows for much more display lists sharing because it stores untransformed ShapeState in a display list.
Where this is better over roSeparateShapeStates: If you use TVRMLGLAnimation when the same ShapeState occurs in each frame but is transformed differently. Or when you have a scene that uses the same ShapeState many times but with different transformation. Or when you do animation by VRML / X3D events that change properties of "Transform" node. Actually, "transformation" means here everything rendered by TVRMLOpenGLRenderer.RenderShapeStateBegin, which includes modelview transformation, texture transformation and all lights settings. In such cases, roSeparateShapeStatesNoTranform will use one display list, where roSeparateShapeStates would use a lot (or require needless recalculation for VRML events). What exactly "a lot" means depends on how much frames your animation has, how much ShapeState is duplicated etc. This can be a huge memory saving. Also preparing scene/animations (in PrepareRender) should be much faster.
This saved me 13 MB memory in "The Castle" (much less than I hoped, honestly, but still something...). This greatly boosts performance of VRML animations of Transform nodes.
Where this is worse over roSeparateShapeStates:
This is achieved by TVRMLOpenGLRendererContextCache methods ShapeStateNoTransform_Xxx.
|