Class TVRMLShapeState

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TVRMLShapeState = class(TObject)

Description

This class represents a pair of objects: ShapeNode and State. It allows to perform some operations that need to know both things.

This class caches results of methods [Local]BoundingBox, VerticesCount and TrianglesCount. This means that things work fast, but this also means that you must manually call Changed when you changed some properties of ShapeNode or contents of State.

But note that you can't change ShapeNode or State to different objects — they are readonly properties.

Also note that if you're using TVRMLFlatScene class then you don't have to worry about calling Changed of items in TVRMLFlatScene.ShapeStates. All you have to do is to call appropriate Changed* methods of TVRMLFlatScene.

Hierarchy

Overview

Methods

Public function LocalBoundingBox: TBox3d;
Public function BoundingBox: TBox3d;
Public function VerticesCount(OverTriangulate: boolean): Cardinal;
Public function TrianglesCount(OverTriangulate: boolean): Cardinal;
Public function BoundingSphereCenter: TVector3Single;
Public function BoundingSphereRadiusSqr: Single;
Public function FrustumBoundingSphereCollisionPossible( const Frustum: TFrustum): TFrustumCollisionPossible;
Public function FrustumBoundingSphereCollisionPossibleSimple( const Frustum: TFrustum): boolean;
Public function AllMaterialsTransparent: boolean;
Public procedure Changed;
Public constructor Create(AShapeNode: TNodeGeneralShape; AState: TVRMLGraphTraverseState);
Public destructor Destroy; override;

Properties

Public property ShapeNode: TNodeGeneralShape read FShapeNode;
Public property State: TVRMLGraphTraverseState read FState;

Description

Methods

Public function LocalBoundingBox: TBox3d;

specyfikacja co robia [Local]BoundingBox, VerticesCount i TrianglesCount - patrz VRMLNodes.TNodeGeneralShape

Public function BoundingBox: TBox3d;
 
Public function VerticesCount(OverTriangulate: boolean): Cardinal;
 
Public function TrianglesCount(OverTriangulate: boolean): Cardinal;
 
Public function BoundingSphereCenter: TVector3Single;

This calculates bounding sphere basing on BoundingBox. In the future this may be changed to use BoundingSphere method of TNodeGeneralShape, when I will implement it. For now, BoundingSphere is always worse approximation of bounding volume than BoundingBox (i.e. BoundingSphere is always larger) but it may be useful in some cases when detecting collision versus bounding sphere is much faster than detecting them versus bounding box.

BoundingSphereRadiusSqr = 0 and BoundingSphereCenter is undefined if Box is empty.

Public function BoundingSphereRadiusSqr: Single;
 
Public function FrustumBoundingSphereCollisionPossible( const Frustum: TFrustum): TFrustumCollisionPossible;

This is exactly equivalent to getting BoundingSphereCenter and BoundingSphereRadiusSqr and then using VectorMath.FrustumSphereCollisionPossible.

But it may be a little faster since it avoids some small speed problems (like copying memory contents when you get values of BoundingSphereXxx properties and checking twice are BoundingSphereXxx calculated).

Public function FrustumBoundingSphereCollisionPossibleSimple( const Frustum: TFrustum): boolean;

This is exactly equivalent to getting BoundingSphereCenter and BoundingSphereRadiusSqr and then using VectorMath.FrustumSphereCollisionPossibleSimple.

But it may be a little faster since it avoids some small speed problems.

Public function AllMaterialsTransparent: boolean;
 
Public procedure Changed;
 
Public constructor Create(AShapeNode: TNodeGeneralShape; AState: TVRMLGraphTraverseState);
 
Public destructor Destroy; override;
 

Properties

Public property ShapeNode: TNodeGeneralShape read FShapeNode;

ShapeNode to wskaznik na obiekt w RootNode

Public property State: TVRMLGraphTraverseState read FState;

State is OWNED by this TVRMLShape class - I mean, we will do State.Free in destructor


Generated by PasDoc 0.10.0 on 2008-02-25 00:00:46