ModelComponent Class
Namespace: Stride.EngineAssembly: Stride.Engine.dll
[DataContract("ModelComponent")]
[Display("Model", null, Expand = ExpandRule.Once)]
[DefaultEntityComponentProcessor(typeof(ModelTransformProcessor))]
[DefaultEntityComponentRenderer(typeof(ModelRenderProcessor))]
[ComponentOrder(11000)]
[ComponentCategory("Model")]
public sealed class ModelComponent : ActivableEntityComponent, IIdentifiable, IModelInstance
Name | Description | |
---|---|---|
Constructors | ||
ModelComponent() | Initializes a new instance of the ModelComponent class. |
|
ModelComponent(Model) | Initializes a new instance of the ModelComponent class. |
|
Fields | ||
BoundingBox | Gets the bounding box in world space. |
|
BoundingSphere | Gets the bounding sphere in world space. |
|
Properties | ||
IsShadowCaster | Gets or sets a boolean indicating if this model component is casting shadows. |
|
Materials | Gets the materials; non-null ones will override materials from Materials (same slots should be used). |
|
MeshInfos | Gets the current per-entity state for each mesh in the associated model. |
|
Model | Gets or sets the model. |
|
RenderGroup | The render group for this component. |
|
Skeleton | ||
Methods | ||
GetMaterial(Int32) | Gets the material at the specified index. If the material is not overriden by this component, it will try to get it from Materials |
|
GetMaterialCount() | Gets the number of materials (computed from Materials) |
Constructors
ModelComponent()
Initializes a new instance of the ModelComponent class.
public ModelComponent()
ModelComponent(Model)
Initializes a new instance of the ModelComponent class.
public ModelComponent(Model model)
Parameters
Type | Name | Description |
---|---|---|
Model | model | The model. |
Fields
BoundingBox
Gets the bounding box in world space.
public BoundingBox BoundingBox
Field Value
Type | Description |
---|---|
BoundingBox | The bounding box. |
BoundingSphere
Gets the bounding sphere in world space.
public BoundingSphere BoundingSphere
Field Value
Type | Description |
---|---|
BoundingSphere | The bounding sphere. |
Properties
IsShadowCaster
Gets or sets a boolean indicating if this model component is casting shadows.
[DataMember(30)]
[Display("Cast shadows", null)]
public bool IsShadowCaster { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A boolean indicating if this model component is casting shadows. |
Materials
Gets the materials; non-null ones will override materials from Materials (same slots should be used).
[DataMember(40)]
public IndexingDictionary<Material> Materials { get; }
Property Value
Type | Description |
---|---|
IndexingDictionary<Material> | The materials overriding Materials ones. |
MeshInfos
Gets the current per-entity state for each mesh in the associated model.
public IReadOnlyList<ModelComponent.MeshInfo> MeshInfos { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<ModelComponent.MeshInfo> |
Model
Gets or sets the model.
[DataMember(10)]
public Model Model { get; set; }
Property Value
Type | Description |
---|---|
Model | The model. |
RenderGroup
The render group for this component.
[DataMember(20)]
[Display("Render group", null)]
public RenderGroup RenderGroup { get; set; }
Property Value
Type | Description |
---|---|
RenderGroup |
Skeleton
[DataMember]
public SkeletonUpdater Skeleton { get; }
Property Value
Type | Description |
---|---|
SkeletonUpdater |
Methods
GetMaterial(Int32)
Gets the material at the specified index. If the material is not overriden by this component, it will try to get it from Materials
public Material GetMaterial(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index of the material |
Returns
Type | Description |
---|---|
Material | The material at the specified index or null if not found |
GetMaterialCount()
Gets the number of materials (computed from Materials)
public int GetMaterialCount()
Returns
Type | Description |
---|---|
System.Int32 |