Class Model
This class represents a 3D scene model.
Namespace: Evergine.Framework.Graphics
Assembly: Evergine.Framework.dll
Syntax
public class Model : ILoadable, IDependencyObject
Constructors
Model()
Initializes a new instance of the Model class.
Declaration
public Model()
Model(string, Mesh)
Initializes a new instance of the Model class. Creates a simple model based on a single mesh.
Declaration
public Model(string name, Mesh mesh)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Mesh name. |
| Mesh | mesh | Mesh instance. |
Fields
BoundingBox
The bounding box.
Declaration
public BoundingBox? BoundingBox
Field Value
| Type | Description |
|---|---|
| BoundingBox? |
BufferData
Gets the list of buffer data contents.
Declaration
public BufferContent[] BufferData
Field Value
| Type | Description |
|---|---|
| BufferContent[] |
Buffers
Gets the mesh buffers.
Declaration
public Buffer[] Buffers
Field Value
| Type | Description |
|---|---|
| Buffer[] |
Materials
Material list.
Declaration
public List<(string, Guid)> Materials
Field Value
| Type | Description |
|---|---|
| List<(string, Guid)> |
Source
The model's source.
Declaration
public ModelSource Source
Field Value
| Type | Description |
|---|---|
| ModelSource |
Properties
AllNodes
Gets or sets the collection of all nodes.
Declaration
public NodeContent[] AllNodes { get; set; }
Property Value
| Type | Description |
|---|---|
| NodeContent[] |
Animations
Gets or sets the list of animations.
Declaration
public Dictionary<string, AnimationClip> Animations { get; set; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, AnimationClip> |
Dependencies
Gets the list of dependencies.
Declaration
public Lazy<List<IDependencyLink>> Dependencies { get; }
Property Value
| Type | Description |
|---|---|
| Lazy<List<IDependencyLink>> |
Id
Gets or sets the asset ID.
Declaration
public Guid Id { get; set; }
Property Value
| Type | Description |
|---|---|
| Guid | The asset path. |
LOD
Gets or sets the level of detail (LOD).
Declaration
public LODContent[] LOD { get; set; }
Property Value
| Type | Description |
|---|---|
| LODContent[] |
MeshContainers
Gets or sets the mesh containers.
Declaration
public MeshContainer[] MeshContainers { get; set; }
Property Value
| Type | Description |
|---|---|
| MeshContainer[] |
ReaderVersion
Gets the reader version.
Declaration
public Version ReaderVersion { get; }
Property Value
| Type | Description |
|---|---|
| Version | The reader version. |
RootNodes
Gets or sets the root nodes.
Declaration
public int[] RootNodes { get; set; }
Property Value
| Type | Description |
|---|---|
| int[] |
Skins
Gets or sets the skins of the model.
Declaration
public SkinContent[] Skins { get; set; }
Property Value
| Type | Description |
|---|---|
| SkinContent[] |
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
FindMeshContainerByName(string)
Finds a mesh by name.
Declaration
public MeshContainer FindMeshContainerByName(string meshName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | meshName | The name of the mesh. |
Returns
| Type | Description |
|---|---|
| MeshContainer | The mesh with the specified name. |
InstantiateModelHierarchy(AssetsService)
Instantiates model hierarchy.
Declaration
public Entity InstantiateModelHierarchy(AssetsService assetsService)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetsService | assetsService | Assets service. |
Returns
| Type | Description |
|---|---|
| Entity | The entity hierarchy. |
InstantiateModelHierarchy(string, AssetsService)
Instantiates model hierarchy.
Declaration
public Entity InstantiateModelHierarchy(string entityName, AssetsService assetsService)
Parameters
| Type | Name | Description |
|---|---|---|
| string | entityName | The entity name. |
| AssetsService | assetsService | The assets service. |
Returns
| Type | Description |
|---|---|
| Entity | The entity hierarchy. |
Invalidate(ILoadable)
Invalidates this instance and raises the Invalidated event with the new ILoadable instance.
Declaration
public void Invalidate(ILoadable newInstance)
Parameters
| Type | Name | Description |
|---|---|---|
| ILoadable | newInstance | The new ILoadable instance. |
RefreshBoundingBox()
Computes bounding box.
Declaration
public void RefreshBoundingBox()
ReleaseCPUBuffer()
Retains the CPU buffer in memory.
Declaration
public void ReleaseCPUBuffer()
ReleaseUnusedMemory()
Releases unused memory.
Declaration
public void ReleaseUnusedMemory()
RetainCPUBuffer()
Retains the CPU buffer in memory.
Declaration
public void RetainCPUBuffer()
Events
Invalidated
Occurs when this instance is invalidated and all references must be reloaded.
Declaration
public event EventHandler<ILoadable> Invalidated
Event Type
| Type | Description |
|---|---|
| EventHandler<ILoadable> |