TGorillaModel
Default model control for managing multi mesh 3D-models. The Gorilla3D model component differs in a lot of functionality from the FMX equivalent.
Remarks
It allows to load different 3D file formats like: DAE, OBJ, FBX, STL, X3D and more. It supports vertex-, skeleton- and skinanimation. The model component holds an AnimationManager component for managing different animations for the same model. There are different ways to instanciate a model from file or stream, f.e.: Loading a new model instance directly from file:LMyModel := TGorillaModel.LoadNewModelFromFile(LViewport, LMyAssetPackage, 'c:\models\mymodel.dae', GORILLA_ANIMATION_CACHING_DEFAULT); LMyModel.Parent := LViewport;Loading model information into an existing model instance from file:
GorillaModel1.LoadFromFile(LMyAssetPackage, 'c:\models\mymodel.dae', GORILLA_ANIMATION_CACHING_DEFAULT);Loading a further animation file into the model:
GorillaModel1.AddAnimationFromFile('c:\models\mymodel-run.dae', GORILLA_ANIMATION_CACHING_DEFAULT);
Ancestors
Members
Fields
- protected FWireframe :
Boolean
- protected FWireframeMat :
TMaterialSource
- protected FShowNormals :
Boolean
- protected FNormalsColor :
TAlphaColor
- protected FInterpolators :
TGorillaInterpolatorList
- protected FAnimationManager :
TGorillaAnimationManager
Methods
- public constructor Create ( AOwner : TComponent ) ;
- public destructor Destroy ( ) ;
- protected function GetNormalsColor ( ) : TAlphaColor ;
- protected procedure SetNormalsColor ( AValue : TAlphaColor ) ;
- protected function CreateAnimationInstance
(
const
ADef :
TAnimationDef
)
: TGorillaAnimation
;
Creates and returns a new animation instance from AnimationDefinition format. The routine will automatically instanciate interpolators and link vertices with animation data.
- protected procedure Render ( ) ; override;
- public procedure AddInterpolator
(
const
AName :
string; AInterpolator :
TPropertyKeyAnimation
)
;
Adds a property key animation interpolator to the model.
- public function FindInterpolator
(
const
AName :
string
)
: TPropertyKeyAnimation
;
Tries to find a specific property key animation interpolator by name.
- public function FindControlByDeepSearch
(
const
AName :
string
)
: TComponent
;
override;
Searches for an interpolator or a sub mesh inside of the model hierarchy by a submitted name.
- public procedure FindControlsByDeepSearch
(
const
AName :
string; const
AResult :
TReferencedControlList
)
;
override;
Searches for all interpolators or sub meshes inside of the model hierarchy by the submitted name.
- public procedure LoadFromFile
(
const
APackage :
TGorillaAssetsPackage; const
AFilename :
string; const
ACaching :
TAnimationCachingFlags
)
;
virtual;
Loads model data with sub meshes, materials, animations and so on from file to an existing instance.
- public procedure LoadFromStream
(
const
APackage :
TGorillaAssetsPackage; const
AStream :
TStream; const
APath :
string; const
ACaching :
TAnimationCachingFlags
)
;
virtual;
Loads model data with sub meshes, materials, animations and so on from a stream to an existing instance.
- public function LoadNewModelFromFile
(
const
AOwner :
TComponent; const
APackage :
TGorillaAssetsPackage; const
AFilename :
string; const
ACaching :
TAnimationCachingFlags
)
: TGorillaModel
;
class virtual;
Loads model data with sub meshes, materials, animations and so on from file and creates a new instance.
- public function LoadNewModelFromStream
(
const
AOwner :
TComponent; const
APackage :
TGorillaAssetsPackage; const
AStream :
TStream; const
APath :
string; const
ACaching :
TAnimationCachingFlags
)
: TGorillaModel
;
class virtual;
Loads model data with sub meshes, materials, animations and so on from a stream and creates a new instance.
- public function LoadNewModelFromDef
(
const
AOwner :
TComponent; const
ADef :
TModelDef; const
ACaching :
TAnimationCachingFlags
)
: TGorillaModel
;
class virtual;
Creates a new instance and applies an existing model definition with sub meshes, materials, animations and so on.
- public function AddAnimationFromFile
(
const
AFilename :
string; const
ACaching :
TAnimationCachingFlags
=
[]
)
: TGorillaAnimation
;
virtual;
Loads animation data from file to an existing model and returns the created animation instance.
- public function AddAnimationFromStream
(
const
AStream :
TStream; const
ACaching :
TAnimationCachingFlags
=
[]
)
: TGorillaAnimation
;
virtual;
Loads animation data from a stream to an existing model and returns the created animation instance.
- public procedure LoadFromDefinition
(
const
ADef :
TModelDef
)
;
virtual;
Applies a given ModelDefinition to a model instance.
Properties
- public Wireframe : Boolean
- public WireframeMaterial : TMaterialSource
Defines the material source used for rendering wireframe onto model in post processing.
read FWireframeMat
write FWireframeMat - public ShowNormals : Boolean
- public NormalsColor : TAlphaColor
Get or set normal color to be drawn if ShowNormals is active.
read GetNormalsColor
write SetNormalsColor - public Interpolators : TDictionary<System.string,Gorilla.Animation.TPropertyKeyAnimation>
Returns a list of internally used interpolators for animation purposes. Each interpolator defines a step of animation for a specific mesh inside of the model.
read FInterpolators - public AnimationManager : TGorillaAnimationManager
Integrated animation manager for holding animation instances and managing animation interactions like: playing, switching, stopping
read FAnimationManager