Class TCastleSceneCore
Unit
Declaration
type TCastleSceneCore = class(TX3DEventsEngine)
Description
Loading and processing of a scene. Almost everything visible in your game will be an instance of TCastleScene, which is a descendant of this class that adds rendering capabilities.
This class provides a lot of functionality, like loading of the scene (Load method), animating it, performing collisions with the scene, and calculating things (like LocalBoundingBox).
The actual scene information (visible and collidable things) is inside X3D nodes graph contained within the RootNode. During the lifetime of the scene, this X3D graph can change (e.g. because of animations), and you can always change it by code too. E.g. you can freely change TTransformNode.Translation or add children by RootNode.AddChildren. The X3D nodes graph works like a DOM tree for rendering HTML documents: it's typically initialized from a file (3D model), but during the game execution it is dynamic, always changing.
This class takes care of performing the X3D events and routes mechanism (if ProcessEvents is True
). This is what allows X3D graph to be animated, or even be interactive (respond to user actions). For a simple way to play animations, use the PlayAnimation method.
This class maintains a Shapes tree is always synchronized with the X3D nodes tree in RootNode. The Shapes tree provides a little simple view at the scene, sometimes easier (or faster) to iterate over.
Many results are cached, so querying them multiple times is fast, if the scene does not change (in a significant way) between each query. So you can query information like LocalBoundingBox, BoundingBox, VerticesCount... as often as you want to.
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleTransform
- TX3DEventsEngine
- TCastleSceneCore
Overview
Nested Classes and Records
TVisibilitySensors = class(specialize TDictionary<TVisibilitySensorNode,TVisibilitySensorInstanceList>) |
Nested Types
TCompiledScriptHandler = procedure ( Value: TX3DField; const Time: TX3DTime) of object; |
|
TSceneValidity = (...); |
|
TVisibilitySensorInstanceList = specialize TObjectList<TVisibilitySensorInstance>; |
Fields
ScreenEffectNodes: TX3DNodeList; |
|
IsVisibleNow: boolean; |
|
GeneratedTextures: TGeneratedTextureList; |
|
nested const DefaultShadowMapsDefaultSize = 256; |
Methods
function CreateShape(const AGeometry: TAbstractGeometryNode; const AState: TX3DGraphTraverseState; const ParentInfo: PTraversingInfo): TShape; virtual; |
|
procedure UpdateHeadlightOnFromNavigationInfo; |
|
procedure ChangedTransform; override; |
|
procedure ChangeWorld(const Value: TCastleAbstractRootTransform); override; |
|
procedure DoPointingDeviceSensorsChange; virtual; |
|
procedure ExecuteCompiledScript(const HandlerName: string; ReceivedValue: TX3DField); override; |
|
function LocalHeightCollision(const APosition, GravityUp: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; out AboveHeight: Single; out AboveGround: PTriangle): boolean; override; |
|
function LocalMoveCollision( const OldPos, ProposedNewPos: TVector3; out NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override; |
|
function LocalMoveCollision( const OldPos, NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override; |
|
function LocalSegmentCollision(const Pos1, Pos2: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; const ALineOfSight: boolean): boolean; override; |
|
function LocalSphereCollision(const Pos: TVector3; const Radius: Single; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override; |
|
function LocalSphereCollision2D(const Pos: TVector2; const Radius: Single; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; const Details: TCollisionDetails): boolean; override; |
|
function LocalPointCollision2D(const Point: TVector2; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override; |
|
function LocalBoxCollision(const Box: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override; |
|
function LocalRayCollision(const RayOrigin, RayDirection: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): TRayCollision; override; |
|
procedure LocalRender(const Params: TRenderParams); override; |
|
procedure Loaded; override; |
|
procedure InternalMoveShapeAssociations( const OldNode, NewNode: TX3DNode; const ContainingShapes: TObject); override; |
|
constructor Create(AOwner: TComponent); override; |
|
function PropertySections(const PropertyName: String): TPropertySections; override; |
|
procedure Load(const ARootNode: TX3DRootNode; const AOwnsRootNode: boolean; const AOptions: TSceneLoadOptions = []); overload; |
|
procedure Load(const AURL: string; const AOptions: TSceneLoadOptions = []); overload; |
|
procedure Load(const AURL: string; const AllowStdIn: boolean; const AResetTime: boolean = true); overload; deprecated 'use Load with (AURL: string, AOptions: TSceneLoadOptions) parameters. AllowStdIn is not implemented anymore.'; |
|
procedure Save(const AURL: string); |
|
destructor Destroy; override; |
|
function ShapesActiveCount: Cardinal; |
|
function ShapesActiveVisibleCount: Cardinal; |
|
function VerticesCount: Cardinal; overload; |
|
function TrianglesCount: Cardinal; overload; |
|
function VerticesCount(const Ignored: Boolean): Cardinal; overload; deprecated 'use VerticesCount without Boolean argument, it is ignored now'; |
|
function TrianglesCount(const Ignored: Boolean): Cardinal; overload; deprecated 'use TrianglesCount without Boolean argument, it is ignored now'; |
|
function ViewpointsCount: Cardinal; |
|
function GetViewpointName(Idx: integer): string; |
|
procedure MoveToViewpoint(Idx: integer; Animated: boolean = true); |
|
procedure AddViewpointFromNavigation(const Navigation: TCastleNavigation; const AName: string); |
|
procedure BeforeNodesFree(const InternalChangedAll: boolean = false); override; |
|
procedure NodeFreeRemovingFromAllParents(Node: TX3DNode); |
|
procedure RemoveShape(Shape: TShape); |
|
procedure ChangedAll(const OnlyAdditions: Boolean = false); override; |
|
procedure DoGeometryChanged(const Change: TGeometryChange; LocalGeometryShape: TShape); virtual; |
|
procedure DoViewpointsChanged; |
|
procedure DoBoundViewpointVectorsChanged; |
|
procedure DoBoundNavigationInfoFieldsChanged; virtual; |
|
procedure ScheduleChangedAll(const OnlyAdditions: Boolean = false); |
|
procedure BeginChangesSchedule; |
|
procedure EndChangesSchedule; |
|
function Info( ATriangleVerticesCounts, ABoundingBox: boolean; AManifoldAndBorderEdges: boolean): string; deprecated 'do not use this, better to construct a summary string yourself'; |
|
function InfoTriangleVerticesCounts: string; deprecated 'better to construct a string yourself, use TrianglesCount, VerticesCount'; |
|
function InfoBoundingBox: string; deprecated 'better to construct a string yourself, use BoundingBox.ToString'; |
|
function InfoManifoldAndBorderEdges: string; deprecated 'better to construct a string yourself, use EdgesCount'; |
|
procedure EdgesCount(out ManifoldEdges, BorderEdges: Cardinal); |
|
function InternalOctreeRendering: TShapeOctree; |
|
function InternalOctreeDynamicCollisions: TShapeOctree; |
|
function InternalOctreeVisibleTriangles: TTriangleOctree; |
|
function InternalOctreeStaticCollisions: TTriangleOctree; |
|
function InternalOctreeCollisions: TBaseTrianglesOctree; |
|
function UseInternalOctreeCollisions: boolean; |
|
function GetViewpoint( out ProjectionType: TProjectionType; out CamPos, CamDir, CamUp, GravityUp: TVector3; const ViewpointDescription: string = ''): TAbstractViewpointNode; |
|
function GetPerspectiveViewpoint( out CamPos, CamDir, CamUp, GravityUp: TVector3; const ViewpointDescription: string = ''): TAbstractViewpointNode; |
|
procedure FreeResources(Resources: TSceneFreeResources); virtual; |
|
procedure UnregisterScene(Node: TX3DNode); deprecated 'use Node.UnregisterScene'; |
|
function Press(const Event: TInputPressRelease): boolean; override; |
|
function Release(const Event: TInputPressRelease): boolean; override; |
|
function PointingDevicePress(const Pick: TRayCollisionNode; const Distance: Single): Boolean; override; |
|
function PointingDeviceRelease(const Pick: TRayCollisionNode; const Distance: Single; const CancelAction: Boolean): Boolean; override; |
|
function PointingDeviceMove(const Pick: TRayCollisionNode; const Distance: Single): boolean; override; |
|
function PointingDeviceSensors: TPointingDeviceSensorList; |
|
procedure PointingDeviceClear; |
|
function LocalBoundingBox: TBox3D; override; |
|
procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override; |
|
procedure SetTime(const NewValue: TFloatTime); |
|
procedure IncreaseTime(const TimeIncrease: TFloatTime); |
|
procedure IncreaseTimeTick; deprecated 'it should not be necessary to call this, ever; using TX3DEvent.Send(...) or TX3DEvent.Send(..., NextEventTime) will automatically behave Ok.'; |
|
function Time: TFloatTime; override; |
|
function NextEventTime: TX3DTime; override; |
|
procedure ResetTime(const NewValue: TFloatTime); |
|
procedure ResetTimeAtLoad; |
|
function GetBackgroundStack: TX3DBindableStackBasic; override; |
|
function GetFogStack: TX3DBindableStackBasic; override; |
|
function GetNavigationInfoStack: TX3DBindableStackBasic; override; |
|
function GetViewpointStack: TX3DBindableStackBasic; override; |
|
procedure RegisterCompiledScript(const HandlerName: string; Handler: TCompiledScriptHandler); |
|
procedure InternalUpdateNavigation( const Navigation: TCastleNavigation; const WorldBox: TBox3D); |
|
procedure CameraTransition(const Camera: TCastleCamera; const APosition, ADirection, AUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)'; |
|
procedure CameraTransition(const Camera: TCastleCamera; const APosition, ADirection, AUp, GravityUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)'; |
|
procedure CameraTransition(const Navigation: TCastleNavigation; const APosition, ADirection, AUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)'; |
|
procedure CameraTransition(const Navigation: TCastleNavigation; const APosition, ADirection, AUp, GravityUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)'; |
|
function CustomHeadlight: TAbstractLightNode; |
|
procedure ViewChangedSuddenly; virtual; |
|
procedure PrepareResources(const Options: TPrepareResourcesOptions; const ProgressStep: boolean; const Params: TPrepareParams); override; |
|
function Caption: string; |
|
function Node(const NodeClass: TX3DNodeClass; const NodeName: string; const Options: TFindNodeOptions = []): TX3DNode; overload; |
|
function Node(const NodeName: string): TX3DNode; overload; |
|
function Field(const NodeName, FieldName: string): TX3DField; overload; |
|
function Event(const NodeName, EventName: string): TX3DEvent; overload; |
|
function HasAnimation(const AnimationName: string): boolean; |
|
function AnimationTimeSensor(const AnimationName: string): TTimeSensorNode; overload; |
|
function AnimationTimeSensor(const Index: Integer): TTimeSensorNode; overload; |
|
function Animations: TStringList; deprecated 'use AnimationsList (and do not free it''s result)'; |
|
function ForceAnimationPose(const AnimationName: string; const TimeInAnimation: TFloatTime; const Loop: boolean; const Forward: boolean = true): boolean; overload; |
|
function ForceAnimationPose(const AnimationName: string; const TimeInAnimation: TFloatTime; const Looping: TPlayAnimationLooping; const Forward: boolean = true): boolean; overload; deprecated 'use ForceAnimationPose overload with "Loop: boolean" parameter'; |
|
function PlayAnimation(const Parameters: TPlayAnimationParameters): boolean; overload; |
|
function PlayAnimation(const AnimationName: string; const Loop: boolean; const Forward: boolean = true): boolean; overload; |
|
function PlayAnimation(const AnimationName: string; const Looping: TPlayAnimationLooping; const Forward: boolean = true): boolean; overload; deprecated 'use another overloaded version of PlayAnimation, like simple PlayAnimation(AnimationName: string, Loop: boolean)'; |
|
procedure ForceInitialAnimationPose; |
|
function AnimationDuration(const AnimationName: string): TFloatTime; |
|
procedure StopAnimation(const DisableStopNotification: Boolean = false); |
|
procedure ResetAnimationState(const IgnoreAffectedBy: TTimeSensorNode = nil); |
|
procedure FontChanged; |
|
function Clone(const AOwner: TComponent): TCastleSceneCore; |
|
procedure InternalIncShapesHash; |
Properties
property VisibilitySensors: TVisibilitySensors read FVisibilitySensors; |
|
property Shapes: TShapeTree read FShapes; |
|
property OnGeometryChanged: TSceneGeometryChanged
read FOnGeometryChanged write FOnGeometryChanged; |
|
property OnViewpointsChanged: TNotifyEvent
read FOnViewpointsChanged write FOnViewpointsChanged; |
|
property OnBoundViewpointVectorsChanged: TNotifyEvent
read FOnBoundViewpointVectorsChanged write FOnBoundViewpointVectorsChanged; |
|
property OnBoundNavigationInfoFieldsChanged: TNotifyEvent
read FOnBoundNavigationInfoFieldsChanged write FOnBoundNavigationInfoFieldsChanged; |
|
property RootNode: TX3DRootNode read FRootNode write SetRootNode; |
|
property OwnsRootNode: boolean read FOwnsRootNode write FOwnsRootNode default true; |
|
property TriangleOctreeProgressTitle: string
read FTriangleOctreeProgressTitle
write FTriangleOctreeProgressTitle; |
|
property ShapeOctreeProgressTitle: string
read FShapeOctreeProgressTitle
write FShapeOctreeProgressTitle; |
|
property PointingDeviceOverItem: PTriangle
read FPointingDeviceOverItem write FPointingDeviceOverItem; |
|
property PointingDeviceOverPoint: TVector3
read FPointingDeviceOverPoint write FPointingDeviceOverPoint; |
|
property PointingDeviceActiveSensors: TX3DNodeList
read FPointingDeviceActiveSensors; |
|
property PointingDeviceActive: boolean
read FPointingDeviceActive default false; |
|
property OnPointingDeviceSensorsChange: TNotifyEvent
read FOnPointingDeviceSensorsChange
write FOnPointingDeviceSensorsChange; |
|
property TimeAtLoad: TFloatTime read FTimeAtLoad; |
|
property BackgroundStack: TBackgroundStack read FBackgroundStack; |
|
property FogStack: TFogStack read FFogStack; |
|
property NavigationInfoStack: TNavigationInfoStack read FNavigationInfoStack; |
|
property ViewpointStack: TViewpointStack read FViewpointStack; |
|
property CompiledScriptHandlers: TCompiledScriptHandlerInfoList
read FCompiledScriptHandlers; |
|
property HeadlightOn: boolean
read FHeadlightOn write SetHeadlightOn; |
|
property OnHeadlightOnChanged: TNotifyEvent
read FOnHeadlightOnChanged write FOnHeadlightOnChanged; |
|
property Static: boolean read FStatic write SetStatic default false; deprecated 'do not use this; optimization done by this is really negligible; leave ProcessEvents=false for static scenes'; |
|
property InternalGlobalLights: TLightInstancesList read FGlobalLights; |
|
property GlobalLights: TLightInstancesList read FGlobalLights; deprecated; |
|
property AnimationsList: TStrings read FAnimationsList; |
|
property AnimationPrefix: string
read FAnimationPrefix write FAnimationPrefix; deprecated 'this property did not prove to be of much use; report if you need it, otherwise it may be removed one day'; |
|
property CurrentAnimation: TTimeSensorNode read FCurrentAnimation; |
|
property FileName: string read FURL write SetURL; deprecated; |
|
property InternalShapesHash: TShapesHash read FShapesHash; |
|
property DefaultAnimationTransition: Single
read FDefaultAnimationTransition write FDefaultAnimationTransition default 0.0; |
|
property TimePlaying: boolean read FTimePlaying write FTimePlaying default true; |
|
property TimePlayingSpeed: Single read FTimePlayingSpeed write FTimePlayingSpeed default 1.0; |
|
property Spatial: TSceneSpatialStructures read FSpatial write SetSpatial default []; |
|
property ProcessEvents: boolean
read FProcessEvents write SetProcessEvents default false; |
|
property URL: string read FURL write SetURL; |
|
property ShadowMaps: boolean read FShadowMaps write SetShadowMaps default true; |
|
property ShadowMapsDefaultSize: Cardinal
read FShadowMapsDefaultSize write SetShadowMapsDefaultSize
default DefaultShadowMapsDefaultSize; |
|
property InitialViewpointIndex: Cardinal
read FInitialViewpointIndex write FInitialViewpointIndex default 0; |
|
property InitialViewpointName: string
read FInitialViewpointName write FInitialViewpointName; |
|
property AnimateOnlyWhenVisible: boolean
read FAnimateOnlyWhenVisible write FAnimateOnlyWhenVisible default false; |
|
property AnimateSkipTicks: Cardinal read FAnimateSkipTicks write SetAnimateSkipTicks
default 0; |
|
property PrimitiveGeometry: TPrimitiveGeometry
read FPrimitiveGeometry write SetPrimitiveGeometry default pgNone; deprecated 'use TCastleBox, TCastleSphere, TCastlePlane for these primitives'; |
|
property AutoAnimation: String
read FAutoAnimation write SetAutoAnimation; |
|
property AutoAnimationLoop: Boolean
read FAutoAnimationLoop write SetAutoAnimationLoop default true; |
|
property ExposeTransforms: TStrings read FExposeTransforms write SetExposeTransforms; |
|
property ExposeTransformsPrefix: String read FExposeTransformsPrefix write SetExposeTransformsPrefix; |
Description
Nested Types
TCompiledScriptHandler = procedure ( Value: TX3DField; const Time: TX3DTime) of object; |
|
TSceneValidity = (...); |
|
Values
|
TVisibilitySensorInstanceList = specialize TObjectList<TVisibilitySensorInstance>; |
|
Fields
ScreenEffectNodes: TX3DNodeList; |
|
List of TScreenEffectNode nodes, collected by ChangedAll. |
IsVisibleNow: boolean; |
|
Is the scene visible currently. Descendants may set this to |
GeneratedTextures: TGeneratedTextureList; |
|
nested const DefaultShadowMapsDefaultSize = 256; |
|
Methods
function CreateShape(const AGeometry: TAbstractGeometryNode; const AState: TX3DGraphTraverseState; const ParentInfo: PTraversingInfo): TShape; virtual; |
|
Create TShape (or descendant) instance suitable for this TCastleSceneCore descendant. In this class, this simply creates new TShape instance. If you make a descendant of TCastleSceneCore, you may need to store some per-shape information, and then it may be useful to have your own TShape descendant to carry this information. So you can override this to create your own descendant, and then you're sure that all leafs within Shapes tree are created using this. Example: TCastleScene uses this to create TGLShape. |
procedure UpdateHeadlightOnFromNavigationInfo; |
|
procedure ChangedTransform; override; |
|
procedure ChangeWorld(const Value: TCastleAbstractRootTransform); override; |
|
procedure DoPointingDeviceSensorsChange; virtual; |
|
Called after PointingDeviceSensors or PointingDeviceActiveSensors lists (possibly) changed. In this class, |
procedure ExecuteCompiledScript(const HandlerName: string; ReceivedValue: TX3DField); override; |
|
function LocalHeightCollision(const APosition, GravityUp: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; out AboveHeight: Single; out AboveGround: PTriangle): boolean; override; |
|
function LocalMoveCollision( const OldPos, ProposedNewPos: TVector3; out NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override; |
|
function LocalMoveCollision( const OldPos, NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override; |
|
function LocalSegmentCollision(const Pos1, Pos2: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; const ALineOfSight: boolean): boolean; override; |
|
function LocalSphereCollision(const Pos: TVector3; const Radius: Single; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override; |
|
function LocalSphereCollision2D(const Pos: TVector2; const Radius: Single; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; const Details: TCollisionDetails): boolean; override; |
|
function LocalPointCollision2D(const Point: TVector2; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override; |
|
function LocalBoxCollision(const Box: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override; |
|
function LocalRayCollision(const RayOrigin, RayDirection: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): TRayCollision; override; |
|
procedure LocalRender(const Params: TRenderParams); override; |
|
procedure Loaded; override; |
|
procedure InternalMoveShapeAssociations( const OldNode, NewNode: TX3DNode; const ContainingShapes: TObject); override; |
|
Called before changing one node into another, when old node may have beeen associated with a shape using TShapeTree.AssociateNode. |
constructor Create(AOwner: TComponent); override; |
|
function PropertySections(const PropertyName: String): TPropertySections; override; |
|
procedure Load(const ARootNode: TX3DRootNode; const AOwnsRootNode: boolean; const AOptions: TSceneLoadOptions = []); overload; |
|
Load the model given as a X3D nodes graph. This replaces RootNode with new value.
Note that you should never load the same TX3DRootNode instance into multiple TCastleScene instances.
// DON'T DO THIS!
Node := LoadNode(URL);
Scene1 := TCastleScene.Create(Application);
Scene1.Load(Node, false);
Scene2 := TCastleScene.Create(Application);
Scene2.Load(Node, false);
If you need to load the same model into multiple scenes, it is best to use the Clone method: SceneTemplate := TCastleScene.Create(Application); SceneTemplate.Load(URL); Scene1 := SceneTemplate.Clone(Application); Scene2 := SceneTemplate.Clone(Application);
Using the Clone makes a copy of the underlying X3D graph, so it is roughly like doing: Node := LoadNode(URL); Scene1 := TCastleScene.Create(Application); Scene1.Load(Node.DeepCopy as TX3DRootNode, false); Scene2 := TCastleScene.Create(Application); Scene2.Load(Node.DeepCopy as TX3DRootNode, false);
Note that sometimes you don't need to create multiple scenes to show the same model many times. You can simply insert the same TCastleScene instance multiple times to TCastleViewport.Items (TCastleRootTransform). See the manual: https://castle-engine.io/manual_scene.php#section_many_instances Parameters
|
procedure Load(const AURL: string; const AOptions: TSceneLoadOptions = []); overload; |
|
Load the 3D model from given URL. We load a number of 3D model formats (X3D, VRML, Collada, Wavefront OBJ...) and some 2D model formats (Spine JSON). See https://castle-engine.io/creating_data_model_formats.php for the complete list. URL is downloaded using the CastleDownload unit, so it supports files, http resources and more. See https://castle-engine.io/manual_network.php about supported URL schemes. If you all you care about is loading normal files, then just pass a normal filename (absolute or relative to the current directory) as the URL parameter. |
procedure Save(const AURL: string); |
|
Save the current 3D model (X3D nodes graph) to the given file (URL). The X3D encoding is automatically guessed from the URL extension. By default it is XML, and we suggest using the The file may also be automatically gzip compressed if extension indicates it. Use The URL property is also changed. |
destructor Destroy; override; |
|
function ShapesActiveCount: Cardinal; |
|
Number of active shapes in the Shapes tree. This is equivalent to Shapes.ShapesCount(true), except that this is faster (it's cached and reused in this instance, and automatically invalidated only when needed). |
function ShapesActiveVisibleCount: Cardinal; |
|
Number of active and visible (TShape.Visible) shapes in the Shapes tree. See also
|
function VerticesCount: Cardinal; overload; |
|
Calculate the number of triangls and vertexes of all shapa states. For detailed specification of what these functions do see appropriate TAbstractGeometryNode methods. Here, we just sum their results for all shapes. |
function TrianglesCount: Cardinal; overload; |
|
function ViewpointsCount: Cardinal; |
|
Helper functions for accessing viewpoints defined in the scene. |
function GetViewpointName(Idx: integer): string; |
|
procedure MoveToViewpoint(Idx: integer; Animated: boolean = true); |
|
procedure AddViewpointFromNavigation(const Navigation: TCastleNavigation; const AName: string); |
|
procedure BeforeNodesFree(const InternalChangedAll: boolean = false); override; |
|
Release all internal associations with your VRML/X3D nodes. In particular, this will release OpenGL resources connected to your nodes. You should always call this before you (may) free some nodes in RootNode. You have to call ChangedAll or Load at sometime after The InternalChangedAll parameter is for internal use. It is set to |
procedure NodeFreeRemovingFromAllParents(Node: TX3DNode); |
|
Call Node.FreeRemovingFromAllParents, making sure that changes to our VRML/X3D node graph are allowed. This makes sure we call BeforeNodesFree befor freeing, and ChangedAll afterwards. This avoids a common pitfall with relying on TShape or such existence between BeforeNodesFree and ChangedAll. BeforeNodesFree may free all our TShape instances, so if you want to free TX3DNode from our graph — you typically want to get this TX3DNode instance *before* calling BeforeNodesFree. Using this method to free the node ensures this. |
procedure RemoveShape(Shape: TShape); |
|
Remove the shape node from the scene. In case of VRML 1.0 / Inventor, when the Shape doesn't have a node, we remove the geometry node. |
procedure ChangedAll(const OnlyAdditions: Boolean = false); override; |
|
Notify scene that potentially everything changed in the VRML/X3D graph. This includes adding/removal of some nodes within RootNode graph and changing their fields' values. (Before freeing the nodes, remember to also call BeforeNodesFree earlier.) You usually never need to call this method explicitly. It's called by engine when necesssary. However, you need to call it yourself if you change the X3D graph directly through nodes'
Descendant implementors notes:
|
procedure DoGeometryChanged(const Change: TGeometryChange; LocalGeometryShape: TShape); virtual; |
|
Called when geometry changed. Does OnGeometryChanged, and does some other stuff necessary (mark some octrees for regenerating at next access). This is public only for overloading (and for internal TShape access). Do not call this yourself — TShape and TCastleSceneCore implementations know when and how to call this. |
procedure DoViewpointsChanged; |
|
Call OnViewpointsChanged, if assigned. |
procedure DoBoundViewpointVectorsChanged; |
|
Call OnBoundViewpointVectorsChanged, if assigned. |
procedure DoBoundNavigationInfoFieldsChanged; virtual; |
|
procedure ScheduleChangedAll(const OnlyAdditions: Boolean = false); |
|
Mechanism to schedule ChangedAll calls. Since these calls may be costly (traversing the hierarchy), and their results are often not immediately needed by TCastleSceneCore or TX3DNode hierarchy, it's sometimes not desirable to call them immediately when geometry changed / all changed. So you can use When you're within Begin/EndChangesSchedule, then |
procedure BeginChangesSchedule; |
|
procedure EndChangesSchedule; |
|
function Info( ATriangleVerticesCounts, ABoundingBox: boolean; AManifoldAndBorderEdges: boolean): string; deprecated 'do not use this, better to construct a summary string yourself'; |
|
Warning: this symbol is deprecated: do not use this, better to construct a summary string yourself Returns short information about the scene. This consists of a few lines, separated by newlines. Last line also ends with CastleUtils.NL. |
procedure EdgesCount(out ManifoldEdges, BorderEdges: Cardinal); |
|
Edges count in the scene, for information purposes. |
function InternalOctreeRendering: TShapeOctree; |
|
A spatial structure containing all visible shapes. Add ssRendering to Spatial property, otherwise it's You should not use this directly. Instead use TCastleViewport and then use Note that when VRML/X3D scene contains Collision nodes, this octree contains the visible (not necessarily collidable) objects. |
function InternalOctreeDynamicCollisions: TShapeOctree; |
|
A spatial structure containing all collidable shapes. Add ssDynamicCollisions to Spatial property, otherwise it's You should not usually use this directly. Instead use TCastleViewport and then use You can use InternalOctreeCollisions to get either InternalOctreeDynamicCollisions or InternalOctreeStaticCollisions, whichever is available. Note that when VRML/X3D scene contains Collision nodes, this octree contains the collidable (not necessarily rendered) objects. TODO: Temporarily, this is updated simply by rebuilding. |
function InternalOctreeVisibleTriangles: TTriangleOctree; |
|
A spatial structure containing all visible triangles, suitable only for scenes that stay static. Add ssVisibleTriangles to Spatial property, otherwise it's You should not usually use this directly. Instead use TCastleViewport and then use Note that when VRML/X3D scene contains X3D Collision nodes, this octree contains the visible (not necessarily collidable) objects. |
function InternalOctreeStaticCollisions: TTriangleOctree; |
|
A spatial structure containing all collidable triangles. Add ssStaticCollisions to Spatial property, otherwise it's You should not usually use this directly. Instead use TCastleViewport and then use It is automatically used by the XxxCollision methods in this class, if exists, unless OctreeDynamicCollisions exists. Note that you can use InternalOctreeCollisions to get either InternalOctreeDynamicCollisions or InternalOctreeStaticCollisions, whichever is available. |
function InternalOctreeCollisions: TBaseTrianglesOctree; |
|
Octree for collisions. This returns either InternalOctreeStaticCollisions or InternalOctreeDynamicCollisions, whichever is available (or You should not usually use this directly. Instead use TCastleViewport and then use |
function UseInternalOctreeCollisions: boolean; |
|
function GetViewpoint( out ProjectionType: TProjectionType; out CamPos, CamDir, CamUp, GravityUp: TVector3; const ViewpointDescription: string = ''): TAbstractViewpointNode; |
|
Viewpoint defined in the 3D file (or some default camera settings if no viewpoint is found).
If ViewpointDescription = '', they return the first found viewpoint node. Otherwise, they look for X3DViewpointNode with description field mathing given string. If camera properties were found in some node, it returns this node. Otherwise it returns nil. This way you can optionally extract some additional info from used viewpoint node, or do something special if default values were used. Often you will just ignore result of this function — after all, the most important feature of this function is that you don't have to care about details of dealing with camera node. Returned CamDir and CamUp and GravityUp are always normalized — reasons the same as for TAbstractViewpointNode.GetView. |
function GetPerspectiveViewpoint( out CamPos, CamDir, CamUp, GravityUp: TVector3; const ViewpointDescription: string = ''): TAbstractViewpointNode; |
|
procedure FreeResources(Resources: TSceneFreeResources); virtual; |
|
Frees some scene resources, to conserve memory. See TSceneFreeResources documentation. |
procedure UnregisterScene(Node: TX3DNode); deprecated 'use Node.UnregisterScene'; |
|
Warning: this symbol is deprecated: use Node.UnregisterScene Recursively unset node's TX3DNode.Scene. |
function Press(const Event: TInputPressRelease): boolean; override; |
|
Scene processes X3D key sensor nodes here, https://castle-engine.io/x3d_implementation_keydevicesensor.php . Remember to set ListenPressRelease to process the key sensor nodes. |
function Release(const Event: TInputPressRelease): boolean; override; |
|
function PointingDevicePress(const Pick: TRayCollisionNode; const Distance: Single): Boolean; override; |
|
function PointingDeviceRelease(const Pick: TRayCollisionNode; const Distance: Single; const CancelAction: Boolean): Boolean; override; |
|
function PointingDeviceMove(const Pick: TRayCollisionNode; const Distance: Single): boolean; override; |
|
Called when pointing device moves. This may generate the continuously-generated events like hitPoint_changed, also it updates PointingDeviceOverItem and PointingDeviceOverPoint, thus producing isOver and such events. To make pointing-device sensors work Ok, make sure you have non-nil OctreeCollisions (e.g. include ssDynamicCollisions in Spatial). |
function PointingDeviceSensors: TPointingDeviceSensorList; |
|
Pointing-device sensors over which the pointing device is. This is just a shortcut for PointingDeviceOverItemˆ.State.PointingDeviceSensors, returning |
procedure PointingDeviceClear; |
|
Clear any references to PTriangle passed previously in TRayCollisionNode argument to PointingDevicePress, PointingDeviceRelease, PointingDeviceMove. This is internally used in case some of past seen PTriangle may become invalid, so any memory about them should be cleared. This doesn't cause any X3D events (contrary to e.g. calling PointingDeviceMove with Pick.Triangle = This method clears any references to saved PTriangle and PointingDeviceActiveSensors. Note that this still calls DoPointingDeviceSensorsChange (making OnPointingDeviceSensorsChange event), if PointingDeviceActiveSensors / PointingDeviceSensors possibly changed. |
function LocalBoundingBox: TBox3D; override; |
|
procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override; |
|
procedure SetTime(const NewValue: TFloatTime); |
|
Change current scene time, setting Time. It is crucial that you call this continuously to have some VRML/X3D time-dependent features working, like TimeSensor and MovieTexture. See Time for details what is affected by this. This is automatically taken care of if you added this scene to TCastleWindow.Controls or TCastleControl.Controls. Then our Update takes care of doing the job, according to TimePlaying and TimePlayingSpeed. This causes time to be passed to appropriate time-dependent nodes, events will be called etc.
Following X3D specification, time should only grow. So NewValue should be > Time (or TimeIncrease > 0). Otherwise we ignore this call. For resetting the time (when you don't necessarily want to grow Time) see ResetTime. If a change of Time will produce some visible change in the VRML/X3D model (for example, MovieTexture will change, or TimeSensor change will be routed by interpolator to coordinates of some visible node) it will be reported by usual method, that is VisibleChangeHere. |
procedure IncreaseTime(const TimeIncrease: TFloatTime); |
|
function Time: TFloatTime; override; |
|
The time within this scene, in seconds. Increasing this "drives" the animations (by increasing time of time-dependent nodes like X3D TimeSensor, which in turn drive the rest of the animation). You can use SetTime or IncreaseTime to move time forward manually. But usually there's no need for it: our Update method takes care of it automatically, you only need to place the scene inside TCastleViewport.Items. You can start/stop time progress by TimePlaying and scale it by TimePlayingSpeed. These properties affect how the time is updated by the Update method (so if you use SetTime or IncreaseTime methods, you're working around these properties). Default time value is 0.0 (zero). However it will be reset at load to a current time (seconds since Unix epoch — that's what X3D standard says to use, although you can change it by KambiNavigationInfo.timeOriginAtLoad, see https://castle-engine.io/x3d_implementation_navigation_extensions.php#section_ext_time_origin_at_load ). You can perform this "time reset" yourself by ResetTimeAtLoad or ResetTime. |
function NextEventTime: TX3DTime; override; |
|
Time that should be used for next event. You usually don't need to call this directly, this is automatically used by TX3DEvent.Send when you don't specify explicit time. |
procedure ResetTime(const NewValue: TFloatTime); |
|
Set Time to arbitrary value. You should only use this when you loaded new VRML/X3D model. Unlike SetTime and IncreaseTime, this doesn't require that Time grows. It still does some time-dependent events work, although some time-dependent nodes may be just unconditionally reset by this to starting value (as they keep local time, and so require TimeIncrease notion, without it we can only reset them). |
procedure ResetTimeAtLoad; |
|
Set Time to suitable initial value after loading a world. This honours VRML/X3D specification about VRML/X3D time origin, and our extension [https://castle-engine.io/x3d_extensions.php#section_ext_time_origin_at_load]. |
function GetBackgroundStack: TX3DBindableStackBasic; override; |
|
function GetFogStack: TX3DBindableStackBasic; override; |
|
function GetNavigationInfoStack: TX3DBindableStackBasic; override; |
|
function GetViewpointStack: TX3DBindableStackBasic; override; |
|
procedure RegisterCompiledScript(const HandlerName: string; Handler: TCompiledScriptHandler); |
|
Register compiled script handler, for VRML/X3D Script node with "compiled:" protocol. See [https://castle-engine.io/x3d_extensions.php#section_ext_script_compiled]. |
procedure InternalUpdateNavigation( const Navigation: TCastleNavigation; const WorldBox: TBox3D); |
|
Update TCastleNavigation properties based on currently bound TNavigationInfoNode. Bound TNavigationInfoNode is taken from NavigationInfoStack.Top. If no such node is bound (NavigationInfoStack.Top is Note that, since some fields are only in some descendants (e.g. MoveSpeed is only at TCastleWalkNavigation) then some TNavigationInfoNode settings are just not transferred to all Navigation instances like TCastleExamineNavigation. WorldBox is the expected bounding box of the whole 3D scene. Usually, it should be TCastleViewport.Items.BoundingBox. In simple cases (if this scene is the only TCastleScene instance in your world, and it's not transformed) it may be equal to just BoundingBox of this scene. |
procedure CameraTransition(const Camera: TCastleCamera; const APosition, ADirection, AUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)'; |
|
Warning: this symbol is deprecated: use Camera.AnimateTo(APosition, ADirection, AUp) Make Camera go to the view given by (world coordinates) APosition, ADirection, AUp. Honours current NavigationInfo.transitionType and transitionTime. If transitionType indicates instanteneous transition, then jumps by simple Will generate NavigationInfo.transitionComplete when transition ends. |
procedure CameraTransition(const Camera: TCastleCamera; const APosition, ADirection, AUp, GravityUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)'; |
|
Warning: this symbol is deprecated: use Camera.AnimateTo(APosition, ADirection, AUp) |
procedure CameraTransition(const Navigation: TCastleNavigation; const APosition, ADirection, AUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)'; |
|
Warning: this symbol is deprecated: use Camera.AnimateTo(APosition, ADirection, AUp) |
procedure CameraTransition(const Navigation: TCastleNavigation; const APosition, ADirection, AUp, GravityUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)'; |
|
Warning: this symbol is deprecated: use Camera.AnimateTo(APosition, ADirection, AUp) |
function CustomHeadlight: TAbstractLightNode; |
|
Light node that should be used for headlight, or This never returns |
procedure ViewChangedSuddenly; virtual; |
|
Notify the scene that camera position/direction changed a lot. It may be called when you make a sudden change to the camera, like teleporting the player to a completely different scene part. This may be used as a hint by some optimizations. It tells that what will be visible in the next rendered frame will be probably very different from what was visible in the last frame. Current implementation notes: Currently, this is used by TCastleScene if you use RenderOptions.OcclusionQuery. Normally, occlusion query tries to reuse results from previous frame, using the assumption that usually camera changes slowly and objects appear progressively in the view. When you make a sudden camera jump/change, this assumption breaks, so it's better to resign from occlusion query for the very next frame. This method will do exactly that. |
procedure PrepareResources(const Options: TPrepareResourcesOptions; const ProgressStep: boolean; const Params: TPrepareParams); override; |
|
function Caption: string; |
|
Nice scene caption. Uses the "title" of WorldInfo node inside the VRML/X3D scene. If there is no WorldInfo node (or it has empty title) then result is based on loaded URL. |
function Node(const NodeClass: TX3DNodeClass; const NodeName: string; const Options: TFindNodeOptions = []): TX3DNode; overload; |
|
Find a named X3D node in the current node graph. By default it searches both active and inactive graph parts. Add fnOnlyActive to search only in active parts. It searches only within nodes of given type (NodeClass). Specifying NodeClass helps to make search unambiguous (as name clashes are possible, some authoring tools may write models with duplicate names for materials, meshes etc. and both glTF and X3D allow it). This allows to safely write code like: MyMaterial := Scene.Node(TNodePhysicalMaterial, 'MyMaterial') as TNodePhysicalMaterial;
TODO: An even better version, "MyMaterial := Scene.Node<TNodePhysicalMaterial>('MyMaterial')", may be available in the future, if FPC support for generic methods will improve. Define GENERIC_METHODS to try it out now, but heed the warnings in castleconf.inc . Exceptions raised
|
function Node(const NodeName: string): TX3DNode; overload; |
|
function Field(const NodeName, FieldName: string): TX3DField; overload; |
|
Find a named field within an X3D node in the current node graph. Like Node, this searches all nodes (in active or not) graph parts. Exceptions raised
|
function Event(const NodeName, EventName: string): TX3DEvent; overload; |
|
Find a named event within an X3D node in the current node graph. Like Node, this searches all nodes (in active or not) graph parts. Exceptions raised
|
function HasAnimation(const AnimationName: string): boolean; |
|
Does named animation with given name exist. See also
|
function AnimationTimeSensor(const AnimationName: string): TTimeSensorNode; overload; |
|
TimeSensor of this animation. |
function AnimationTimeSensor(const Index: Integer): TTimeSensorNode; overload; |
|
TimeSensor of this animation, by animation index (index on AnimationsList). |
function Animations: TStringList; deprecated 'use AnimationsList (and do not free it''s result)'; |
|
Warning: this symbol is deprecated: use AnimationsList (and do not free it's result) |
function ForceAnimationPose(const AnimationName: string; const TimeInAnimation: TFloatTime; const Loop: boolean; const Forward: boolean = true): boolean; overload; |
|
Forcefully, immediately, set pose from given animation, with given time in animation. This avoids the normal passage of time in X3D scenes, it ignores the ProcessEvents and AnimateOnlyWhenVisible properties, it ignores the current animation set by PlayAnimation, and forces the current time on TimeSensors by TTimeSensorNode.FakeTime. |
function ForceAnimationPose(const AnimationName: string; const TimeInAnimation: TFloatTime; const Looping: TPlayAnimationLooping; const Forward: boolean = true): boolean; overload; deprecated 'use ForceAnimationPose overload with "Loop: boolean" parameter'; |
|
Warning: this symbol is deprecated: use ForceAnimationPose overload with "Loop: boolean" parameter |
function PlayAnimation(const Parameters: TPlayAnimationParameters): boolean; overload; |
|
Play an animation specified by name. If the given animation name exists, then we return To get the list of available animations, see AnimationsList. This automatically turns on ProcessEvents, if it wasn't turned on already. Processing events is necessary for playing animations. This is the simplest way to play animations using Castle Game Engine. For a nice overview about using PlayAnimation, see the manual https://castle-engine.io/manual_scene.php , section "Play animation". Playing an already-playing animation is guaranteed to restart it from the beginning. You can specify whether the animation should loop, whether to play it forward or backward, whether to do animation blending and some other options using TPlayAnimationParameters. If you use an overloaded version with the TPlayAnimationParameters, note that you can (and usually should) free the TPlayAnimationParameters instance right after calling this method. We do not keep reference to the TPlayAnimationParameters instance, and we do not free it ourselves. More details about how this works:
|
function PlayAnimation(const AnimationName: string; const Loop: boolean; const Forward: boolean = true): boolean; overload; |
|
function PlayAnimation(const AnimationName: string; const Looping: TPlayAnimationLooping; const Forward: boolean = true): boolean; overload; deprecated 'use another overloaded version of PlayAnimation, like simple PlayAnimation(AnimationName: string, Loop: boolean)'; |
|
Warning: this symbol is deprecated: use another overloaded version of PlayAnimation, like simple PlayAnimation(AnimationName: string, Loop: boolean) |
procedure ForceInitialAnimationPose; |
|
Force the model to look like the initial animation frame now. Use this after calling PlayAnimation. Calling this is simply ignored if no PlayAnimation was called earlier, of if the model already looks following the animation requested by PlayAnimation. If you don't use this method, there may be a 1-frame delay between calling PlayAnimation and actually updating the rendered scene look. If during that time a rendering will happen, the user will see a scene in previous pose (not in the first pose of animation you requested by PlayAnimation). To avoid this, simply call this method right after PlayAnimation. This sets first animation frame, unless you used TPlayAnimationParameters.InitialTime <> 0. |
function AnimationDuration(const AnimationName: string): TFloatTime; |
|
Duration, in seconds, of the named animation (named animations are detected by AnimationsList method). For a looping animation, this is the duration of a single cycle. 0 if not found. |
procedure StopAnimation(const DisableStopNotification: Boolean = false); |
|
Stop the CurrentAnimation, started by last PlayAnimation call. Note that this leaves the model in a state in the middle of the last animation. You can use ResetAnimationState to reset the state afterwards. Calling ForceInitialAnimationPose also will do it. Note that it is not necessary to stop the previous animation before starting a new one (by PlayAnimation). PlayAnimation will automatically stop the previous animation. Moreover, PlayAnimation may do animation blending (cross-fade) between old and new animation (if you use TPlayAnimationParameters.TransitionDuration), which only works if you did not call When animation is stopped (by this or any other means), by default it's TPlayAnimationParameters.StopNotification is called. You can use DisableStopNotification to avoid it, which should be used only in exceptional situations. |
procedure ResetAnimationState(const IgnoreAffectedBy: TTimeSensorNode = nil); |
|
Reset all the fields affected by animations. See TimeSensor.detectAffectedFields documentation (https://castle-engine.io/x3d_implementation_time_extensions.php#section_detect_affected_fields) for details how these fields are detected, and when this is useful. By default this is enabled, for all TimeSensor nodes. If IgnoreAffectedBy <> nil, the fields affected by the given TimeSensor may not be reset. This is an optimization useful in case this TimeSensor will modify the scene very soon, so resetting its affected fields is a waste of time. Do not depend on 100% that the fields affected by given TimeSensor are left untouched (in the current implementation, this field is ignored). |
procedure FontChanged; |
|
Force recalculating the text shapes when font changed. For now, we don't detect font changes (when TFontStyleNode.OnFont returns something different) ourselves. This calls TTextNode.FontChanged and TAsciiTextNode_1.FontChanged on all appropriate nodes. |
function Clone(const AOwner: TComponent): TCastleSceneCore; |
|
Create a scene with the same contents (X3D scene graph) as this one. The created scene has exactly the same class as this one (we use ClassType.Create to call a virtual constructor). Note that this does not copy other scene attributes, like ProcessEvents or Spatial or rendering attributes in TCastleScene.RenderOptions. It only copies the scene graph (RootNode) and also sets target URL based on source URL (for logging purposes, e.g. TCastleProfilerTime use this URL to report loading and preparation times). |
procedure InternalIncShapesHash; |
|
Properties
property VisibilitySensors: TVisibilitySensors read FVisibilitySensors; |
|
property Shapes: TShapeTree read FShapes; |
|
Tree of shapes in the scene, acting as a simplfied mirror of the X3D node graph. Contents of this tree are read-only from outside. |
property OnGeometryChanged: TSceneGeometryChanged
read FOnGeometryChanged write FOnGeometryChanged; |
|
Notification when geometry changed. "Geometry changed" means that the positions of triangles changed. This is not send when merely things like material changed. It is not guaranteed that octrees are already recalculated when this is called. (They may be recalculated only on-demand, that is when you actually access them.) However, it is guaranteed that shape's transformation (like TShape.State.Transform) are already updated. |
property OnViewpointsChanged: TNotifyEvent
read FOnViewpointsChanged write FOnViewpointsChanged; |
|
Notification when the list of viewpoints in the scene possibly changed. Note that this doesn't necessarily mean that the current, bound viewpoint changed (although it could). If you only want to get notified when currently bound viewpoint changes, then what you seek is rather ViewpointStack.OnBoundChanged. |
property OnBoundViewpointVectorsChanged: TNotifyEvent
read FOnBoundViewpointVectorsChanged write FOnBoundViewpointVectorsChanged; |
|
Notification when the currently bound viewpoint's vectors (position/orientation and such) changed. More precisely, this is called whenever values generated by ViewpointStack.Top.GetView changed. It cannot be called when ViewpointStack.Top = |
property OnBoundNavigationInfoFieldsChanged: TNotifyEvent
read FOnBoundNavigationInfoFieldsChanged write FOnBoundNavigationInfoFieldsChanged; |
|
property RootNode: TX3DRootNode read FRootNode write SetRootNode; |
|
Actual VRML/X3D graph defining this scene. It is allowed to change contents of It is also allowed to change the value of |
property OwnsRootNode: boolean read FOwnsRootNode write FOwnsRootNode default true; |
|
If |
property PointingDeviceOverItem: PTriangle
read FPointingDeviceOverItem write FPointingDeviceOverItem; |
|
Current item over which the pointing device is. |
property PointingDeviceOverPoint: TVector3
read FPointingDeviceOverPoint write FPointingDeviceOverPoint; |
|
Current 3D point under the pointing device. Only meaningful when PointingDeviceOverItem <> nil, otherwise undefined. |
property PointingDeviceActiveSensors: TX3DNodeList
read FPointingDeviceActiveSensors; |
|
Currently active pointing-device sensors. Only TAbstractPointingDeviceSensorNode instances. Always empty when PointingDeviceActive = Note that sensor specified here doesn't have to be one of the sensors of PointingDeviceOverItem. When some sensor is activated, it grabs further events until it's deactivated (e.g. when you set PointingDeviceActive := false, which means that user released mouse button). This means that when user moves the mouse while given sensors are active, he can move mouse over other items, even the ones where the active sensors aren't listed — but the sensors remain active. |
property PointingDeviceActive: boolean
read FPointingDeviceActive default false; |
|
Is pointing device currently active (for example, mouse button is pressed down). |
property OnPointingDeviceSensorsChange: TNotifyEvent
read FOnPointingDeviceSensorsChange
write FOnPointingDeviceSensorsChange; |
|
Event called PointingDeviceSensors or PointingDeviceActiveSensors lists (possibly) changed. |
property TimeAtLoad: TFloatTime read FTimeAtLoad; |
|
Initial world time, set by the last ResetTimeAtLoad call. |
property BackgroundStack: TBackgroundStack read FBackgroundStack; |
|
Stack of background nodes. The node at the top is the current background. All nodes on this stack must descend from TAbstractBackgroundNode class. |
property FogStack: TFogStack read FFogStack; |
|
Stack of fog nodes. The node at the top is the current fog. All nodes on this stack must descend from TFogNode class. |
property NavigationInfoStack: TNavigationInfoStack read FNavigationInfoStack; |
|
Stack of NavigatinInfo nodes. The node at the top is the current NavigatinInfo. All nodes on this stack must descend from TNavigationInfoNode class. |
property ViewpointStack: TViewpointStack read FViewpointStack; |
|
Stack of viewpoint nodes. The node at the top is the current Viewpoint. All nodes on this stack must descend from TAbstractViewpointNode. Note that this includes also VRML 1.0/Inventor nodes. |
property CompiledScriptHandlers: TCompiledScriptHandlerInfoList
read FCompiledScriptHandlers; |
|
List of handlers for VRML/X3D Script node with "compiled:" protocol. This is read-only, change this only by RegisterCompiledScript. |
property HeadlightOn: boolean
read FHeadlightOn write SetHeadlightOn; |
|
Should we use headlight for this scene. Controls if containing TCastleViewport will use a headlight, if this is the main scene. When you load a new model, this is always updated based on this model's NavigationInfo.headlight. (If no NavigationInfo node, then default is to use the headlight.) When you bind a new NavigationInfo node, this is also updated to follow NavigationInfo.headlight. You can change the value of this property. If we have a NavigationInfo node, then NavigationInfo.headlight field will be always updated to correspond to this value. (It will be even updated using events mechanism if ProcessEvents, so scripts inside the VRML/X3D "know" when you turn on/off the headlight and may react to it, e.g. spawn a zombie monster when you turn on the flashlight.) |
property OnHeadlightOnChanged: TNotifyEvent
read FOnHeadlightOnChanged write FOnHeadlightOnChanged; |
|
property Static: boolean read FStatic write SetStatic default false; deprecated 'do not use this; optimization done by this is really negligible; leave ProcessEvents=false for static scenes'; |
|
Warning: this symbol is deprecated: do not use this; optimization done by this is really negligible; leave ProcessEvents=false for static scenes Static scene will not be automatically notified about the changes to the field values. This means that TX3DField.Send and TX3DField.Changed will not notify this scene. This makes a small optimization when you know you will not modify scene's VRML/X3D graph besides loading (or you're prepared to do it by manually calling Scene.InternalChangedField, but this should not be used anymore, it's really dirty). The behavior of events is undefined when scene is static. This means that you should always have ProcessEvents = Changing this is expensive when the scene content is already loaded, so it's best to adjust this before Load. |
property InternalGlobalLights: TLightInstancesList read FGlobalLights; |
|
Global lights of this scene. Read-only. Useful to shine these lights on other scenes, if TCastleScene.CastGlobalLights. |
property GlobalLights: TLightInstancesList read FGlobalLights; deprecated; |
|
Warning: this symbol is deprecated. |
property AnimationsList: TStrings read FAnimationsList; |
|
List the names of available animations in current scene. Animations are detected looking for TimeSensor nodes. See https://castle-engine.io/x3d_implementation_interpolation.php for an overview how nodes are used to create animations. Note that if you set AnimationPrefix property, we additionally filter TimeSensor nodes to show only the names starting with given prefix. In this case, not all TTimeSensorNode are reflected in this list. You can get the corresponding TTimeSensorNode by AnimationTimeSensor. Note that the same TTimeSensorNode may occur multiple times on this list, in case X3D IMPORT mechanism was used to rename the imported animation. The resulting TStringList instance is owned by this object, do not free it. Note that the list of animations may change if you rebuild the underlying X3D nodes graph, for example if you start to delete / add some TimeSensor nodes. |
property AnimationPrefix: string
read FAnimationPrefix write FAnimationPrefix; deprecated 'this property did not prove to be of much use; report if you need it, otherwise it may be removed one day'; |
|
Warning: this symbol is deprecated: this property did not prove to be of much use; report if you need it, otherwise it may be removed one day The prefix of an X3D TimeSensor node name to treat it as a "named animation". Named animation are used by methods AnimationsList, PlayAnimation, and AnimationDuration, HasAnimation. By default this is empty, which means we consider all TimeSensor nodes a "named animation". You can set this to something like 'Anim_' or 'Animation_' or whatever your 3D export software produces. Only the TimeSensor nodes with names starting with this prefix will be available on AnimationsList, and this prefix will be stripped from the names you use with methods like PlayAnimation. |
property CurrentAnimation: TTimeSensorNode read FCurrentAnimation; |
|
Currently played animation by PlayAnimation, or Note that, in a general case, you can have multiple active animations (multiple TimeSensor X3D nodes may be active) at the same time. Calling TTimeSensorNode.Start directly on multiple nodes is one way to make it happen. This property simply describes the animation controlled by the last PlayAnimation method. Note that the animation may be started by PlayAnimation with a 1-frame delay, but this property hides it from you, it is changed immediately by the PlayAnimation call. |
property FileName: string read FURL write SetURL; deprecated; |
|
Warning: this symbol is deprecated. Deprecated name for URL. |
property InternalShapesHash: TShapesHash read FShapesHash; |
|
property DefaultAnimationTransition: Single
read FDefaultAnimationTransition write FDefaultAnimationTransition default 0.0; |
|
When using PlayAnimation without TPlayAnimationParameters, this value is used as the duration (in seconds) of animation cross-fade (blending of animations). Zero (default value) disables the smooth transition, animations will change without any transition by default. This default transition is only used if some previous animation was playing. Otherwise, it would be applied even when starting the initial animation. |
property TimePlaying: boolean read FTimePlaying write FTimePlaying default true; |
|
When |
property TimePlayingSpeed: Single read FTimePlayingSpeed write FTimePlayingSpeed default 1.0; |
|
Controls the time speed (if TimePlaying is |
property Spatial: TSceneSpatialStructures read FSpatial write SetSpatial default []; |
|
Which spatial structures (octrees) should be created and used. Using "spatial structures" allows to achieve various things:
See TSceneSpatialStructure for more details about the possible values. For usual dynamic scenes rendered in real-time, you set this to By default, the value of this property is empty, which means that no octrees will be created. This has to be the default value, to:
|
property ProcessEvents: boolean
read FProcessEvents write SetProcessEvents default false; |
|
Should the event mechanism (a basic of animations and interactions) work. If In other words, this makes the scene fully animated and interacting with the user. If |
property URL: string read FURL write SetURL; |
|
Currently loaded scene Setting this property works just like using the Load method with a new The only difference between Pass |
property ShadowMaps: boolean read FShadowMaps write SetShadowMaps default true; |
|
At loading, process the scene to support shadow maps. This happens at the Load method call, and it makes "receiveShadows" field automatically handled. Note that this is not the only way to make shadow maps. VRML/X3D author can always make shadow maps by using lower-level nodes, see [https://castle-engine.io/x3d_extensions.php#section_ext_shadow_maps]. When using these lower-level nodes, this property does not matter This property (and related ones like ShadowMapsDefaultSize) is relevant only for handling shadows by the "receiveShadows" field. |
property ShadowMapsDefaultSize: Cardinal
read FShadowMapsDefaultSize write SetShadowMapsDefaultSize
default DefaultShadowMapsDefaultSize; |
|
Default shadow map texture size. Affects how shadow maps are handled for the "receiveShadows" field. This is taken into account at the scene Load time, and only if ShadowMaps is VRML/X3D author can always override this by placing a |
property InitialViewpointIndex: Cardinal
read FInitialViewpointIndex write FInitialViewpointIndex default 0; |
|
When loading new model, use this viewpoint index to initialize camera. VRML/X3D specification says to use the first (index = 0) viewpoint, you can change this property to bind 2nd, 3rd and so on viewpoints. This is applied only at loading (actually, at ChangedAll). If you later want to bind another viewpoint, just send set_bind := true to it. |
property InitialViewpointName: string
read FInitialViewpointName write FInitialViewpointName; |
|
When loading new model and looking for initial viewpoint, consider only viewpoints with this node name. Relevant only if non-empty. This may cooperate with InitialViewpointIndex: InitialViewpointIndex specifies the index of viewpoint node that satisfies also
|
property AnimateOnlyWhenVisible: boolean
read FAnimateOnlyWhenVisible write FAnimateOnlyWhenVisible default false; |
|
When |
property AnimateSkipTicks: Cardinal read FAnimateSkipTicks write SetAnimateSkipTicks
default 0; |
|
Non-zero values optimize the animation processing, by not updating the animation every frame. After updating the animation in one Update call, the next This is an effective optimization if the scene is usually not large on the screen.
|
property PrimitiveGeometry: TPrimitiveGeometry
read FPrimitiveGeometry write SetPrimitiveGeometry default pgNone; deprecated 'use TCastleBox, TCastleSphere, TCastlePlane for these primitives'; |
|
Warning: this symbol is deprecated: use TCastleBox, TCastleSphere, TCastlePlane for these primitives Easily turn the scene into a simple primitive, like sphere or box or plane. Changing this to something else than pgNone reloads the scene (calls Load with a new X3D graph). |
property AutoAnimation: String
read FAutoAnimation write SetAutoAnimation; |
|
If Note: Using AutoAnimation will under the hood call methods like PlayAnimation, StopAnimation and update CurrentAnimation. The reverse is not true: calling PlayAnimation doesn't change AutoAnimation. So you can think of AutoAnimation as "an initial animation, activated each time we load the model, even if later we can change it to something else using PlayAnimation". See also
|
property AutoAnimationLoop: Boolean
read FAutoAnimationLoop write SetAutoAnimationLoop default true; |
|
Does the animation indicated by AutoAnimation loops. |
property ExposeTransforms: TStrings read FExposeTransforms write SetExposeTransforms; |
|
Transformation nodes inside the model that are synchronized with automatically-created children TCastleTransform. This allows to expose transformation nodes from glTF, X3D and other model formats as TCastleTransform. These transformation nodes include animated bones from skeletons (armatures). Such "exposed transformation" results in a creation of TCastleTransform child, with the same name and synchronized transformation (translation, rotation, scale). This allows to expose e.g. "hand that may hold a weapon", or "slot of a vehicle where to attach a camera", as TCastleTransform. And this allows, in turn, to attach various things to (possibly animated) transformations, e.g. attach model of a weapon to a hand, or attach TCastleCamera to some bone. The attached things will be automatically animated when the scene skeleton animates. Setting this property merely copies the contents using TStrings.Assign, as is usual for published TStrings properties. In CGE editor, there's a nice GUI editor to pick the transfomation nodes, click on "..." at this property. Note: the owner of auto-created children is equal to this scene's Owner. This is most natural when you edit this in CGE editor, or load using TransformLoad. See the engine example in: examples/animations/expose_transformations_to_animate_children/ . See also
|
property ExposeTransformsPrefix: String read FExposeTransformsPrefix write SetExposeTransformsPrefix; |
|
Name prefix for all children created by ExposeTransforms. Useful to keep names unique in the scene. |
Generated by PasDoc 0.16.0.