Castle Game Engine: CastleShapes: Class TShapeTreeLOD

# Class TShapeTreeLOD
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleShapes ## Declaration `type TShapeTreeLOD = class(TShapeTreeGroup)` ## Description Node of the TShapeTree representing the LOD (level of detail) alternative. It chooses one child from it's children list as active. Represents the VRML >= 2.0 LOD node (not possible for VRML 1.0 LOD node, as it may affect also other nodes after LOD). To choose which child is active we need to know the LOD node, with it's transformation in VRML graph. This information is in LODNode and LODInvertedTransform properties. Also, we need to know the current camera position. This is passed as CameraPosition to CalculateLevel. Note that this class doesn't call CalculateLevel by itself, never. You have to call CalculateLevel, and use it to set Level property, from parent scene to make this LOD work. (Reasoning behind this decision: parent scene has CameraPosition and such, and parent scene knows whether to initiate level_changes event sending.) ## Hierarchy TObject TShapeTree TShapeTreeGroup TShapeTreeLOD ## Overview ### Methods
| `function LODInvertedTransform: PMatrix4Single;`
| `function CalculateLevel(const CameraPosition: TVector3Single): Cardinal;`
| `procedure Traverse(Func: TShapeTraverseFunc; const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false); override;`
| `function ShapesCount(const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false): Cardinal; override;`
### Properties
| `property LODNode: TAbstractLODNode read FLODNode write FLODNode;`
| `property Level: Cardinal read FLevel write FLevel default 0;`
| `property WasLevel_ChangedSend: boolean read FWasLevel_ChangedSend write FWasLevel_ChangedSend default false;`
## Description ### Methods
| `function LODInvertedTransform: PMatrix4Single;`
| `function CalculateLevel(const CameraPosition: TVector3Single): Cardinal;`
Calculate Level. This only calculates level, doesn't assign Level property or send level_changed event.
| `procedure Traverse(Func: TShapeTraverseFunc; const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false); override;`
| `function ShapesCount(const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false): Cardinal; override;`
### Properties
| `property LODNode: TAbstractLODNode read FLODNode write FLODNode;`
| `property Level: Cardinal read FLevel write FLevel default 0;`
Current level, that is index of the active child of this LOD node. This is always < Children.Count, unless there are no children. In this case it's 0. Should be calculated by CalculateLevel. By default we simply use the first (highest-detail) LOD as active. So if you never assign this (e.g. because TCastleSceneCore.CameraViewKnown = `False`, that is user position is never known) we'll always use the highest-detail children.
| `property WasLevel_ChangedSend: boolean read FWasLevel_ChangedSend write FWasLevel_ChangedSend default false;`
Generated by PasDoc 0.13.0 on 2013-08-17 21:27:14