Preparing search index...

    Base class for mesh visual components that render with materials.

        const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
    const scene = model.project.scene;
    const assetManager = model.project.assetManager;

    const obj = scene.createSceneObject('MatMeshObj');
    const visual = obj.addComponent('RenderMeshVisual') as Editor.Components.RenderMeshVisual;

    const mainMat = visual.mainMaterial;
    console.log(`mainMaterial: ${Editor.isNull(mainMat) ? 'none' : mainMat.name}`);
    console.log(`Materials count: ${visual.getMaterialsCount()}`);

    const materials = assetManager.assets.filter(a => a.isOfType('Material')) as Editor.Assets.Material[];
    if (materials.length > 0) {
    visual.addMaterialAt(materials[0]);
    console.log(`Added material "${materials[0].name}", count now: ${visual.getMaterialsCount()}`);
    console.log(`Material[0]: "${visual.getMaterialAt(0).name}"`);
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    enabled: boolean

    Whether the component is active.

    horizontalAlignment: Horizontal

    Horizontal alignment of the mesh visual.

    id: Uuid

    The unique id of the entity.

    mainMaterial: Material

    Primary material used for rendering.

    materials: Material[]

    Array of all materials on this mesh visual.

    meshShadowMode: MeshShadowMode

    Shadow rendering mode for the mesh.

    meta: Meta

    Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.

    name: string

    Name of the component.

    renderOrder: number

    Determines the order in which this visual component is rendered relative to others.

    sceneObject: SceneObject

    Scene object this component is attached to.

    shadowColor: vec4

    Color of the mesh shadow.

    shadowDensity: number

    Opacity of the mesh shadow.

    stretchMode: StretchMode

    How the mesh stretches to fit its container.

    type: string

    The entity's type.

    verticalAlignment: Vertical

    Vertical alignment of the mesh visual.

    Methods

    • Insert a material at the specified index.

      Parameters

      Returns void

    • Remove all materials.

      Returns void

    • Retrieve the material at the specified index.

      Parameters

      • pos: number

      Returns Material

    • Get the total number of materials.

      Returns number

    • Find the index of a given material.

      Parameters

      Returns number

    • Returns true if the object is of the specified type.

      Parameters

      • type: string

      Returns boolean

    • Move a material from one index to another.

      Parameters

      • origin: number
      • destination: number

      Returns void

    • Remove the material at the specified index.

      Parameters

      • pos: number

      Returns void

    • Replace the material at the specified index.

      Parameters

      Returns void