Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers |
Unit CastleSceneCore
Description
3D scenes (TCastleSceneCore).
Uses
Overview
Classes, Interfaces, Objects and Records
Types
Variables
Description
Types
TSceneFreeResource = (...); |
These are various features that may be freed by TCastleSceneCore.FreeResources.
Warning: This is for experienced usage of TCastleSceneCore. Everything is explained in detail below, but still — if you have some doubts, or you just don't observe any memory shortage in your program, it's probably best to not use TCastleSceneCore.FreeResources.
For frTextureDataInNodes, frBackgroundImageInNodes and TrianglesList, if you will free them unnecessarily (i.e. you will use it after you freed it), it will be automatically recreated on next use. So everything will work correctly, but you will experience unnecessary slowdown if we will need to recreate exactly the same resource over and over again.
For frTextureDataInNodes and frBackgroundImageInNodes note that freeing these resources too eagerly may make texture cache (see TextureImages) less effective. In normal circumstances, if you will use the same cache instance throughout the program, loaded images are reused. If you free frTextureDataInNodes too early, you may remove them from the cache too early, and lose a chance to reuse them. So you may cause unnecessary slowdown of preparing models, e.g. inside PrepareResources.
Values
-
frTextureDataInNodes: Unloads the texture images/videos allocated in texture nodes.
It's useful if you know that you already prepared everything that needed the texture images, and you will not need texture images later. For TCastleScene this means that you use Optimization method other than roNone, and you already did PrepareResources (so textures are already loaded to OpenGL), and your code will not access TextureImage / TextureVideo anymore. This is commonly True for various games.
Then you can call this to free some resources.
Note that if you made an accident and you will use some TextureImage or TextureVideo after FreeResources, then you will get no crash, but texture image will be simply reloaded. So you may experience slowdown if you inappropriately use this feature.
-
frBackgroundImageInNodes: Unloads the background images allocated in VRML/X3D Background nodes. The same comments as for frTextureDataInNodes apply.
-
frTrianglesListShadowCasters: Free triangle list created by TrianglesListShadowCasters call. This list is also implicitly created by ManifoldEdges or BorderEdges.
-
frManifoldAndBorderEdges: Free edges lists in ManifoldEdges and BorderEdges.
Frees memory, but next call to ManifoldEdges and BorderEdges will need to calculate them again (or you will need to call TCastleSceneCore.ShareManifoldAndBorderEdges again). Note that using this scene as shadow caster for shadow volumes algorithm requires ManifoldEdges and BorderEdges.
|
TSceneGeometryChanged = procedure (Scene: TCastleSceneCore; const SomeLocalGeometryChanged: boolean; OnlyShapeChanged: TShape) of object; |
Callback for TCastleSceneCore.OnGeometryChanged.
SomeLocalGeometryChanged means that octree, triangles, bounding volumes local to some shape changed (not just e.g. shape transformation).
OnlyShapeChanged is meaningful when SomeLocalGeometryChanged = True . If nil, it indicates that only the given shape geometry changed. If not nil, assume that every shape's geometry potentially changed.
|
PGeneratedTexture = ˆTGeneratedTexture; |
|
TCompiledScriptHandler = procedure ( Value: TX3DField; const Time: TX3DTime) of object; |
|
PCompiledScriptHandlerInfo = ˆTCompiledScriptHandlerInfo; |
|
TCompiledScriptHandlerInfoList = specialize TGenericStructList<TCompiledScriptHandlerInfo>; |
|
TGeometryChange = (...); |
Values
-
gcAll: Everything changed. All octrees must be rebuild, old State pointers may be invalid.
Every ChangedAll call does this. ChangedAll must take into account that everything could change. Note that ChangedAll traverses the VRML graph again, recalculating State values... so the old States are not correct anymore. You have to rebuild the octree or your pointers will be bad.
When DoGeometryChanged with gcAll is called, we know that ChangedAll called this, and every TShape will be (or already is) destroyed and created new.
-
gcCollidableTransformChanged: Transformation of some shape changed.
-
gcVisibleTransformChanged:
-
gcLocalGeometryChanged: Local geometry change happened (actual octree free is already done by TShape.LocalGeometryChanged, octree create will be done at next demand). We should update stuff at higher (TCastleSceneCore) level accordingly.
gcLocalGeometryChangedCoord means that coordinates changed. Compared to gcLocalGeometryChanged, this means that model edges structure remains the same (this is helpful e.g. to avoid recalculating Manifold/BorderEdges in parent scene).
In this case, DoGeometryChanged parameter LocalGeometryShape is non-nil and indicated the (only) shape that changed.
-
gcLocalGeometryChangedCoord:
-
gcActiveShapesChanged: What is considered "active" shapes changed. Like after Switch.whichChoice change.
|
Variables
LogChanges: boolean = false; |
Log changes to fields. This debugs what and why happens through TCastleSceneCore.ChangedField method and friends, which is central to VRML/X3D dynamic changes and events engine.
Meaningful only if you initialized log (see CastleLog unit) by InitializeLog first.
|
Generated by PasDoc 0.12.1 on 2013-02-04 20:26:51
|