Class T3DList

Unit

Declaration

type T3DList = class(T3D)

Description

List of 3D objects (T3D instances), that can be treated like another, larger 3D object.

It inherits from T3D class, so this list is itself a 3D object, representing a sum of all it's children 3D objects. This allows you to group many 3D objects, and treat them as one T3D descendant.

Hierarchy

  • TComponent
  • T3D
  • T3DList

Overview

Methods

Protected procedure SetWorld(const Value: T3DWorld); override;
Protected function GetChild: T3D; virtual;
Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;
Protected function HeightCollision(const Position, GravityUp: TVector3Single; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc; out AboveHeight: Single; out AboveGround: P3DTriangle): boolean; override;
Protected function MoveCollision( const OldPos, ProposedNewPos: TVector3Single; out NewPos: TVector3Single; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc): boolean; override;
Protected function MoveCollision( const OldPos, NewPos: TVector3Single; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc): boolean; override;
Protected function SegmentCollision(const Pos1, Pos2: TVector3Single; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc; const ALineOfSight: boolean): boolean; override;
Protected function SphereCollision(const Pos: TVector3Single; const Radius: Single; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc): boolean; override;
Protected function SphereCollision2D(const Pos: TVector2Single; const Radius: Single; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc; const Details: TCollisionDetails = nil): boolean; override;
Protected function PointCollision2D(const Point: TVector2Single; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc): boolean; override;
Protected function BoxCollision(const Box: TBox3D; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc): boolean; override;
Protected function RayCollision(const RayOrigin, RayDirection: TVector3Single; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc): TRayCollision; override;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure Add(const Item: T3D);
Public procedure Insert(const Index: Integer; const Item: T3D);
Public procedure Remove(const Item: T3D);
Public function Count: Integer;
Public procedure Clear;
Public procedure Exchange(const Index1, Index2: Integer);
Public procedure SortBackToFront(const BlendingSort: TBlendingSort; const CameraPosition: TVector3Single);
Public procedure SortBackToFront2D;
Public function BoundingBox: TBox3D; override;
Public procedure Render(const Frustum: TFrustum; const Params: TRenderParams); override;
Public procedure RenderShadowVolume( ShadowVolumeRenderer: TBaseShadowVolumeRenderer; const ParentTransformIsIdentity: boolean; const ParentTransform: TMatrix4Single); override;
Public procedure PrepareResources( Options: TPrepareResourcesOptions; ProgressStep: boolean; BaseLights: TAbstractLightInstancesList); override;
Public function PrepareResourcesSteps: Cardinal; override;
Public function Press(const Event: TInputPressRelease): boolean; override;
Public function Release(const Event: TInputPressRelease): boolean; override;
Public procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;
Public procedure GLContextClose; override;
Public procedure UpdateGeneratedTextures( const RenderFunc: TRenderFromViewFunction; const ProjectionNear, ProjectionFar: Single; const OriginalViewport: TRectangle); override;
Public procedure VisibleChangeNotification(const Changes: TVisibleChanges); override;
Public procedure CameraChanged(ACamera: TCamera); override;
Public function Dragging: boolean; override;

Properties

Public property Items[I:Integer]: T3D read GetItem write SetItem;
Published property List: T3DListCore read FList;

Description

Methods

Protected procedure SetWorld(const Value: T3DWorld); override;
 
Protected function GetChild: T3D; virtual;

Additional child inside the list, always processed before all children on the Items list. By default this method returns Nil, indicating no additional child exists. The presence of this child can be calculated in overriden method using any condition, which is sometimes more comfortable than adding item to Items.

This item cannot be removed by methods like T3DList.Remove or by setting RemoveMe in it's T3D.Update implementation. Presence of this item is completely determined by GetChild implementation.

Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;
 
Protected function HeightCollision(const Position, GravityUp: TVector3Single; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc; out AboveHeight: Single; out AboveGround: P3DTriangle): boolean; override;
 
Protected function MoveCollision( const OldPos, ProposedNewPos: TVector3Single; out NewPos: TVector3Single; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc): boolean; override;
 
Protected function MoveCollision( const OldPos, NewPos: TVector3Single; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc): boolean; override;
 
Protected function SegmentCollision(const Pos1, Pos2: TVector3Single; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc; const ALineOfSight: boolean): boolean; override;
 
Protected function SphereCollision(const Pos: TVector3Single; const Radius: Single; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc): boolean; override;
 
Protected function SphereCollision2D(const Pos: TVector2Single; const Radius: Single; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc; const Details: TCollisionDetails = nil): boolean; override;
 
Protected function PointCollision2D(const Point: TVector2Single; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc): boolean; override;
 
Protected function BoxCollision(const Box: TBox3D; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc): boolean; override;
 
Protected function RayCollision(const RayOrigin, RayDirection: TVector3Single; const TrianglesToIgnoreFunc: T3DTriangleIgnoreFunc): TRayCollision; override;
 
Public constructor Create(AOwner: TComponent); override;
 
Public destructor Destroy; override;
 
Public procedure Add(const Item: T3D);

Operate on 3D objects contained in the list. You can also operate directly on List instance.

Public procedure Insert(const Index: Integer; const Item: T3D);
 
Public procedure Remove(const Item: T3D);
 
Public function Count: Integer;
 
Public procedure Clear;
 
Public procedure Exchange(const Index1, Index2: Integer);
 
Public procedure SortBackToFront(const BlendingSort: TBlendingSort; const CameraPosition: TVector3Single);

Sort objects back-to-front right now following one of the blending sorting algorithms. Only the immediate list items are reordered, looking at their bounding boxes.

Calling this method makes sense if you have a list of objects, and some of them are partially-transparent and may be visible at the same place on the screen. It may even make sense to call this method every frame (like in every TCastleWindowCustom.OnUpdate), if you move or otherwise change the objects (changing their bounding boxes), or if the CameraPosition may change (note that CameraPosition is only relevant if BlendingSort = bs3D).

Sorting partially-transparent objects avoids artifacts when rendering.

Note that this doesn't take care of sorting the shapes within the scenes. For this, you should set Scene.Attributes.BlendingSort to a value like bs3D, to keep it sorted. It is actually the default now.

See the TBlendingSort documentation for the exact specification of sorting algorithms. Using BlendingSort = bsNone does nothing.

Public procedure SortBackToFront2D;

Sort objects back-to-front right now following the 2D blending sorting algorithm. See SortBackToFront for documentation, this method is only a shortcut for SortBackToFront(bs2D, ZeroVector3Single).

Public function BoundingBox: TBox3D; override;
 
Public procedure Render(const Frustum: TFrustum; const Params: TRenderParams); override;
 
Public procedure RenderShadowVolume( ShadowVolumeRenderer: TBaseShadowVolumeRenderer; const ParentTransformIsIdentity: boolean; const ParentTransform: TMatrix4Single); override;
 
Public procedure PrepareResources( Options: TPrepareResourcesOptions; ProgressStep: boolean; BaseLights: TAbstractLightInstancesList); override;
 
Public function PrepareResourcesSteps: Cardinal; override;
 
Public function Press(const Event: TInputPressRelease): boolean; override;
 
Public function Release(const Event: TInputPressRelease): boolean; override;
 
Public procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;
 
Public procedure GLContextClose; override;
 
Public procedure UpdateGeneratedTextures( const RenderFunc: TRenderFromViewFunction; const ProjectionNear, ProjectionFar: Single; const OriginalViewport: TRectangle); override;
 
Public procedure VisibleChangeNotification(const Changes: TVisibleChanges); override;
 
Public procedure CameraChanged(ACamera: TCamera); override;
 
Public function Dragging: boolean; override;
 

Properties

Public property Items[I:Integer]: T3D read GetItem write SetItem;
 
Published property List: T3DListCore read FList;

3D objects inside. Freeing these items automatically removes them from this list.


Generated by PasDoc 0.14.0.