Gorilla.Mesh
Unit Gorilla.Mesh.pasClasses
- TGorillaMeshInstance = class ( TCollectionItem )
- TGorillaMeshInstances = class ( TOwnedCollection )
- TGorillaMesh = class ( TGorillaTransform )
- TGorillaVertexGroup = class ( TGorillaMesh )
Mics. types
- type PMatrix3D = pointer to TMatrix3D;
- type TGorillaMeshClass = class of TGorillaMesh;
TGorillaMeshInstance
Ancestors
Members
Fields
- protected FName :
string
- protected FTransform :
TMatrix3D
- protected FPosition :
TPosition3D
- protected FQuaternion :
TQuaternion3D
- protected FRotationAngle :
TPosition3D
- protected FSavedRotationAngle :
TPoint3D
- protected FScale :
TPosition3D
- protected FRotationCenter :
TPosition3D
- protected FUpdating :
Integer
Methods
- public constructor Create ( Collection : TCollection ) ;
- public destructor Destroy ( ) ;
- protected function GetDisplayName ( ) : string ; override;
- protected procedure SetDisplayName ( const AValue : string ) ; override;
- protected procedure RotationChanged ( Sender : TObject ) ; virtual;
- protected procedure RotateXChanged ( Sender : TObject ) ; virtual;
- protected procedure RotateYChanged ( Sender : TObject ) ; virtual;
- protected procedure RotateZChanged ( Sender : TObject ) ; virtual;
- protected procedure AssignTo ( ADest : TPersistent ) ; override;
- public procedure ResetRotationAngle ( ) ; virtual;
- public procedure MatrixChanged ( Sender : TObject ) ; virtual;
- public procedure SetTransform ( const ATransform : TMatrix3D ) ;
Properties
TGorillaMeshInstances
Ancestors
Members
Fields
Methods
- protected function GetCachedInstancesPtr ( ) : PMatrix3D ;
- protected function GetCachedInstancesCount ( ) : Integer ;
- public procedure Changed ( ) ;
- public procedure UpdateInstanceCache ( ) ; overload;
- public procedure UpdateInstanceCache ( const ABaseTransform : TMatrix3D; const AInstances : TArray<System.Math.Vectors.TMatrix3D> ) ; overload;
- public function ToArray ( ) : TArray<System.Math.Vectors.TMatrix3D> ;
- public function GetInstance
(
AIndex :
Integer
)
: TMatrix3D
;
Gets a transformation matrix for a specific instance by its index.
- public procedure SetInstance
(
AIndex :
Integer; const
AValue :
TMatrix3D
)
;
Updates the transformation matrix of a specific instance by its index. This method will not add new instances. Please use AddInstance() instead.
- public function AddInstance
(
const
ATransform :
TMatrix3D; const
ACreateItem :
Boolean; AName :
string
=
)
: Integer
;
Add a new instance to the collection. For runtime usage, you can reduce memory by ignoring items (ACreateItem = false).
- public function DeleteInstance
(
AIndex :
Integer
)
: Boolean
;
Delete a specific instance by it's index. If only cached instances available the method will adjust the cache. In case there are collection items, it will try to remove the item and update the cache afterwards.
- public procedure ClearInstances
(
)
;
Clears all items and the cached instances.
Properties
TGorillaMesh
Default Gorilla3D mesh control.
Remarks
This component can be used as standalone and child component of TGorillaModel. Each mesh inside of a model will be an instance of TGorillaMesh.Ancestors
Members
Fields
- protected FModel :
TGorillaControl
- protected FData :
TMeshData
- protected FInstances :
TGorillaMeshInstances
- protected FWrapMode :
TMeshWrapMode
- protected FShowNormals :
Boolean
- protected FNormalsColor :
TAlphaColor
- protected FMaterialSource :
TMaterialSource
- protected FReferencedName :
string
- protected FVertexJoints :
TVertexJointsList
- protected FMeshes :
TGorillaMeshList
- protected FFlatShading :
Boolean
Methods
- public constructor Create ( AOwner : TComponent ) ;
- public destructor Destroy ( ) ;
- protected procedure SetHeight ( const Value : Single ) ; override;
- protected procedure SetWidth ( const Value : Single ) ; override;
- protected procedure SetDepth ( const Value : Single ) ; override;
- protected procedure SetWrapMode ( const AValue : TMeshWrapMode ) ; virtual;
- protected function GetIsStatic ( ) : Boolean ; virtual;
- protected procedure SetIsStatic ( const AValue : Boolean ) ; virtual;
- protected function GetCoordinates ( ) : TPoint3DDynArray ; virtual;
- protected procedure SetCoordinates ( const AValue : TPoint3DDynArray ) ; virtual;
- protected function GetVertices ( ) : TVertexDataMap ; virtual;
- protected procedure SetVertices ( const AValue : TVertexDataMap ) ; virtual;
- protected procedure SetFrustumCullingCheck ( const AValue : Boolean ) ; override;
- protected function GetNormalsColor ( ) : TAlphaColor ;
- protected procedure SetNormalsColor ( AValue : TAlphaColor ) ;
- protected procedure SetFlatShading ( AValue : Boolean ) ;
- protected function GetModel ( ) : TGorillaControl ; virtual;
- protected function GetMeshData ( ) : TMeshData ; virtual;
- protected function GetMaterialSource ( ) : TMaterialSource ; virtual;
- protected procedure SetMaterialSource ( AValue : TMaterialSource ) ; virtual;
- protected function GetInstance
(
AIndex :
Integer
)
: TMatrix3D
;
Gets a transformation matrix for a specific instance by its index.
- protected procedure SetInstance
(
AIndex :
Integer; const
AValue :
TMatrix3D
)
;
Updates the transformation matrix of a specific instance by its index. This method will not add new instances. Please use AddInstance() instead.
- protected procedure UpdateInstancesFromCollection
(
const
ABaseTransform :
TMatrix3D; const
AInstances :
TArray<System.Math.Vectors.TMatrix3D>
)
;
virtual;
Getting called by the mesh instances collection if instances changing. This component is
- protected procedure SetInstances ( const AValue : TGorillaMeshInstances ) ;
- protected procedure Loaded ( ) ; override;
- protected procedure Notification ( AComponent : TComponent; Operation : TOperation ) ; override;
- protected procedure DoDuplicate
(
ASource :
TComponent; ADuplicator :
TGorillaDuplicator
)
;
override;
Duplicates a TGorillaMesh/TGorillaModel and all of its submeshes. The method copies the complete memory structure and refreshes necessary lists and standalone components
- protected procedure Render ( ) ; override;
- protected procedure RenderChildren
(
)
;
override;
Initializing the rendering process... If a CurrentCache was assigned the MeshData (TMeshData) buffers are empty and rendering should use the applied cache within TGorillaContext.DoDrawPrimitivesBatch(). instead of the VertexBuffer/IndexBuffer of MeshData.
- protected procedure DoComputeTangentsAndBinormals ( ) ;
- protected procedure BuildTriangleMesh ( ) ;
- protected procedure DoOnRenderControls ( ASender : TObject; AContext : TContext3D ) ; virtual;
- protected procedure DoAddObject ( const AObject : TFmxObject ) ; override;
- protected procedure DoRemoveObject ( const AObject : TFmxObject ) ; override;
- protected procedure DoInsertObject ( Index : Integer; const AObject : TFmxObject ) ; override;
- protected procedure AddToParentMesh ( ) ; virtual;
- protected procedure RemoveFromParentMesh ( ) ; virtual;
- protected procedure DoOnVertexJointsListValueNotify ( ASender : TObject; const AItem : TVertexJoints; AAction : TCollectionNotification ) ;
- protected function DoInternalRayCastIntersect ( const ARayPos : TPoint3D; const ARayDir : TPoint3D; var AIntersection : TPoint3D; var ANormal : TPoint3D ) : Boolean ;
- protected function DoRayCastIntersect ( const ARayPos : TPoint3D; const ARayDir : TPoint3D; var AIntersection : TPoint3D ) : Boolean ; override;
- protected procedure DoApplyToMeshData ( ADef : TMeshDef; AData : TMeshData ) ; virtual;
- protected procedure DoLoadHierarchyFromDef ( ADef : TTransformDef ) ; override;
- public procedure GenerateVertexJoints
(
const
AController :
TControllerDef; const
ABindShapeMatrix :
TMatrix3D
)
;
virtual;
Generates a vertex joints list, if it do not exist yet.
- public function VertexJointsExist
(
)
: Boolean
;
virtual;
Checks if the vertex joints list already exists.
- public procedure ClearVertexJoints
(
)
;
virtual;
Clears and destroys an existing vertex joint list.
- public procedure LoadFromDefinition
(
const
ADef :
TCustomDef
)
;
override;
Loads mesh information with materials, textures and animations from a mesh definition.
- public function GetMeshMatrix ( ) : TMatrix3D ; virtual;
- public function GetBoundingBox
(
)
: TBoundingBox
;
override;
Returns the current bounding box depending on the vertices data of all contained sub meshes.
- public function GetUnwrappedBoundingBox
(
)
: TBoundingBox
;
virtual;
Returns the current bounding box without MeshMatrix computation. This will only compound vertex data to a bounding box information.
- public function RayCastIntersect
(
const
ARayPos :
TPoint3D; const
ARayDir :
TPoint3D; var
AIntersection :
TPoint3D; var
ANormal :
TPoint3D
)
: Boolean
;
virtual;
Perform a ray cast on this mesh.
- public procedure ApplyMaterialSource
(
ASource :
TMaterialSource
)
;
For easily changing materials for the complete mesh hierarchy call ApplyMaterialSource. This procedure will apply the submitted source to the mesh and all its child meshes.
- public function AddInstance
(
ATransform :
TMatrix3D
)
: Integer
;
Adds an instance by its transformation matrix to the internal instance list. The method returns the index at which it was added. Caution: This will not create an instance-item in the collection, it will only cache the instance. Use this for adding instances massivly.
- public function AddInstanceItem
(
AName :
string; ATransform :
TMatrix3D
)
: Integer
;
overload;
Adds an instance item to the instance-collection and sets the supplied transform matrix to it.
- public function AddInstanceItem
(
AName :
string
)
: TGorillaMeshInstance
;
overload;
Adds an instance item to the instance-collection and sets the supplied transform matrix to it.
- public function DeleteInstance
(
AIndex :
Integer
)
: Boolean
;
Deletes an instance at a certain position in the internal instance list. The method returns TRUE if deletion was successful, otherwise it returns FALSE.
- public procedure ClearInstances
(
)
;
Clears all instance items and cached items.
- public procedure SetTwoSide
(
const
AValue :
Boolean
)
;
virtual;
(Un)Sets all submeshes to two side rendering
- public procedure SetOpacityValue
(
const
AValue :
Single
)
;
virtual;
Set opacity value for this mesh/model and all its submeshes.
- public procedure SetVisibility
(
const
AValue :
Boolean
)
;
virtual;
Set visible value for this mesh/model and all its submeshes.
- public procedure SetHitTestValue
(
const
AValue :
Boolean
)
;
virtual;
Set hittest value for this mesh/model and all its submeshes.
- public procedure ComputeTangentsAndBinormals ( ) ;
- public procedure ComputeAllNormalsAndTangents ( ) ;
- public procedure SolveTangents ( AData : TMeshData ) ;
- public procedure SetEnvironmentMapping
(
ARenderPass :
TComponent; const
AReflections :
Single; const
ARefractions :
Single
)
;
To easily link an environment mapping render pass controller to all materials inside of this mesh (also sub-meshes).
- public procedure SetPBRProperties ( const AReflections : Single; const ARefractions : Single; const AAOBias : Single; const ARoughness : Single; const AMetalness : Single ) ;
- public procedure ApplyMaterialToAll ( AMaterial : TMaterialSource ) ;
Properties
- public Model : TGorillaControl
- public ReferencedName : string
Defines a reference name for identifying a mesh explicitly.
read FReferencedName
write FReferencedName - public MeshData : TMeshData
- public VertexJoints : TVertexJointsList
- public Meshes : TObjectList<Gorilla.Mesh.TGorillaMesh>
- public IsStatic : Boolean
Activates a buffer for static rendering with buffers inside of GPU.
read GetIsStatic
write SetIsStatic - public Instance[Index] : TMatrix3D
- public ShowNormals : Boolean
- public NormalsColor : TAlphaColor
Get or set normal color to be drawn if ShowNormals is active.
read GetNormalsColor
write SetNormalsColor - public FlatShading : Boolean
- published FrustumCullingCheck : Boolean
- published Instances : TGorillaMeshInstances
- published WrapMode : TMeshWrapMode
- published MaterialSource : TMaterialSource
Get or set the used material source for rendering this mesh instance.
read GetMaterialSource
write SetMaterialSource - published Coordinates : TArray<System.Math.Vectors.TPoint3D>
- published Vertices : TDictionary<System.Word,Gorilla.DefTypes.TVertexData>