Castle Game Engine: CastleSceneCore

# Unit CastleSceneCore
Description | Uses | Classes, Interfaces, Objects and Records | Functions and Procedures | Types | Constants | Variables
## Description 3D scenes (TCastleSceneCore). ## Uses SysUtils Classes CastleVectors CastleBoxes CastleTriangles X3DFields X3DNodes CastleClassUtils CastleUtils CastleShapes CastleTriangleOctree CastleProgress CastleOctree CastleShapeOctree CastleKeysMouse X3DTime CastleCameras X3DTriangles Contnrs CastleRenderingCamera Castle3D X3DShadowMaps FGL CastleGenericLists CastleRays ## Overview ### Classes, Interfaces, Objects and Records
Name | Description
--- | ---
record `TManifoldEdge` | Scene edge that is between exactly two triangles.
record `TBorderEdge` | Scene edge that has one neighbor, i.e.
Class `TX3DBindableStack` | Stack of bindable nodes (only the top, bound, node is used for rendering/navigation).
Class `TBackgroundStack` |
Class `TFogStack` |
Class `TNavigationInfoStack` |
Class `TViewpointStack` |
Class `TTransformInstancesList` | List of transform nodes (ITransformNode), used to extract TShapeTreeList for this node.
Class `TTimeDependentHandlerList` |
Class `TTrianglesShadowCastersList` | Triangles array for shadow casting object.
Class `TCastleSceneCore` | 3D scene processing (except rendering, for which see TCastleScene).
### Types
`TTriangle3SingleList = specialize TGenericStructList<TTriangle3Single>;`
`PManifoldEdge = ˆTManifoldEdge;`
`TManifoldEdgeList = specialize TGenericStructList<TManifoldEdge>;`
`PBorderEdge = ˆTBorderEdge;`
`TBorderEdgeList = specialize TGenericStructList<TBorderEdge>;`
`TSceneFreeResource = (...);`
`TSceneFreeResources = set of TSceneFreeResource;`
`TSceneNotification = procedure (Scene: TCastleSceneCore) of object;`
`TSceneGeometryChanged = procedure (Scene: TCastleSceneCore; const SomeLocalGeometryChanged: boolean; OnlyShapeChanged: TShape) of object;`
`PGeneratedTexture = ˆTGeneratedTexture;`
`TCompiledScriptHandler = procedure ( Value: TX3DField; const Time: TX3DTime) of object;`
`PCompiledScriptHandlerInfo = ˆTCompiledScriptHandlerInfo;`
`TCompiledScriptHandlerInfoList = specialize TGenericStructList<TCompiledScriptHandlerInfo>;`
`TSceneSpatialStructure = (...);`
`TSceneSpatialStructures = set of TSceneSpatialStructure;`
`TGeometryChange = (...);`
`TPlayAnimationLooping = (...);`
### Variables
`LogChanges: boolean = false;`
`OptimizeExtensiveTransformations: boolean = false;`
## Description ### Types
`TTriangle3SingleList = specialize TGenericStructList<TTriangle3Single>;`
`PManifoldEdge = ˆTManifoldEdge;`
`TManifoldEdgeList = specialize TGenericStructList<TManifoldEdge>;`
`PBorderEdge = ˆTBorderEdge;`
`TBorderEdgeList = specialize TGenericStructList<TBorderEdge>;`
`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.
`TSceneFreeResources = set of TSceneFreeResource;`
`TSceneNotification = procedure (Scene: TCastleSceneCore) of object;`
`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>;`
`TSceneSpatialStructure = (...);`
Possible spatial structure types that may be managed by TCastleSceneCore, see TCastleSceneCore.Spatial. ###### Values ssRendering: Create and keep current the TCastleSceneCore.OctreeRendering. This is a dynamic octree containing all visible shapes. ssDynamicCollisions: Create and keep current the TCastleSceneCore.OctreeDynamicCollisions. This is a dynamic octree containing all collidable items. ssVisibleTriangles: Create the TCastleSceneCore.OctreeVisibleTriangles. This is an octree containing all visible triangles, suitable only for scenes that stay static. ssCollidableTriangles: Create the TCastleSceneCore.OctreeCollidableTriangles. This is an octree containing all collidable triangles, suitable only for scenes that stay static.
`TSceneSpatialStructures = set of TSceneSpatialStructure;`
`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/X3D 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.
`TPlayAnimationLooping = (...);`
Looping mode to use with TCastleSceneCore.PlayAnimation. ###### Values paDefault: Use current TimeSensor.FdLoop value to determine whether animation should loop. Suitable when X3D model already has sensible "TimeSensor.loop" values. paForceLooping: Force TimeSensor.FdLoop to be `True`, to force looping. paForceNotLooping: Force TimeSensor.FdLoop to be `False`, to force not looping.
### 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.
`OptimizeExtensiveTransformations: boolean = false;`
Set this to optimize animating transformations for scenes where you have many transformations (many Transform nodes), and many of them are animated at the same time. Often particularly effective for skeletal animations of characters, 3D and 2D (e.g. from Spine).
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:11