Table of Contents

Class ModelComponent

Namespace
Stride.Engine
Assembly
Stride.Engine.dll

Add a Model to an Entity, that will be used during rendering.

[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
Inheritance
ModelComponent
Implements
Inherited Members

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

model Model

The model.

Fields

BoundingBox

Gets the bounding box in world space.

public BoundingBox BoundingBox

Field Value

BoundingBox

The bounding box.

BoundingSphere

Gets the bounding sphere in world space.

public BoundingSphere BoundingSphere

Field Value

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

bool

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

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

IReadOnlyList<ModelComponent.MeshInfo>

Model

Gets or sets the model.

[DataMember(10)]
public Model Model { get; set; }

Property Value

Model

The model.

RenderGroup

The render group for this component.

[DataMember(20)]
[Display("Render group", null)]
public RenderGroup RenderGroup { get; set; }

Property Value

RenderGroup

Skeleton

[DataMember]
public SkeletonUpdater Skeleton { get; }

Property Value

SkeletonUpdater

Methods

GetMaterial(int)

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

index int

The index of the material

Returns

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

int