Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    ModelComponent Class

    Namespace: Stride.Engine
    Assembly: Stride.Engine.dll

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

    System.Object → EntityComponent → ActivableEntityComponent → ModelComponent
    Derived from ModelComponent:

    [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)

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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

    Inherited Members

    ActivableEntityComponent.Enabled
    EntityComponent.Entity
    EntityComponent.Id
    EntityComponent.EnsureEntity

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation