Class ModelBase
Base class for asset types that can contain a model resource.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public abstract class ModelBase : BinaryAsset
Constructors
ModelBase()
Properties
LoadedLODs
Gets the amount of loaded model LODs.
Declaration
[Unmanaged]
public int LoadedLODs { get; }
Property Value
|
System.Int32
|
LODsCount
Gets amount of the level of details in the model.
Declaration
[Unmanaged]
public int LODsCount { get; }
Property Value
|
System.Int32
|
MaterialSlots
The list of material slots.
Declaration
[Unmanaged]
public MaterialSlot[] MaterialSlots { get; }
Property Value
|
MaterialSlot[]
|
MaterialSlotsCount
Gets the amount of the material slots used by this model asset.
Declaration
[Unmanaged]
public int MaterialSlotsCount { get; }
Property Value
|
System.Int32
|
MinScreenSize
The minimum screen size to draw this model (the bottom limit). Used to cull small models. Set to 0 to disable this feature.
Declaration
[Unmanaged]
public float MinScreenSize { get; set; }
Property Value
|
System.Single
|
Methods
GetLOD(Int32)
Gets the mesh for a particular LOD index.
Declaration
[Unmanaged]
public ModelLODBase GetLOD(int lodIndex)
Parameters
|
System.Int32
lodIndex
|
Returns
|
ModelLODBase
|
GetMesh(Int32, Int32)
Gets the mesh for a particular LOD index.
Declaration
[Unmanaged]
public MeshBase GetMesh(int meshIndex, int lodIndex = 0)
Parameters
|
System.Int32
meshIndex
|
|
System.Int32
lodIndex
|
Returns
|
MeshBase
|
GetMeshes(out MeshBase[], Int32)
Gets the meshes for a particular LOD index.
Declaration
[Unmanaged]
public void GetMeshes(out MeshBase[] meshes, int lodIndex = 0)
Parameters
|
MeshBase[]
meshes
|
|
System.Int32
lodIndex
|
GetSlot(String)
Gets the material slot by the name.
Declaration
[Unmanaged]
public MaterialSlot GetSlot(string name)
Parameters
|
System.String
name
The slot name. |
Returns
|
MaterialSlot
The material slot with the given name or null if cannot find it (asset may be not loaded yet). |
Save(Boolean, String)
Saves this asset to the file. Supported only in Editor.
Declaration
[Unmanaged]
public bool Save(bool withMeshDataFromGpu = false, string path = null)
Parameters
|
System.Boolean
withMeshDataFromGpu
True if save also GPU mesh buffers, otherwise will keep data in storage unmodified. Valid only if saving the same asset to the same location, and it's loaded. |
|
System.String
path
The custom asset path to use for the saving. Use empty value to save this asset to its own storage location. Can be used to duplicate asset. Must be specified when saving virtual asset. |
Returns
|
System.Boolean
True when cannot save data, otherwise false. |
Remarks
If you use saving with the GPU mesh data then the call has to be provided from the thread other than the main game thread.
SetupMaterialSlots(Int32)
Resizes the material slots collection. Updates meshes that were using removed slots.
Declaration
[Unmanaged]
public virtual void SetupMaterialSlots(int slotsCount)
Parameters
|
System.Int32
slotsCount
|