Reference Source
public class | source

Mesh

Extends:

Component → Mesh

Implements:

An Entity that is a drawable element, with a Geometry and a Material, that can be connected into a scene graph using Nodes.

Usage

The example below is the same as the one given for Node, since the two classes work together. In this example, we'll create a scene graph in which a root Node represents a group and the Meshes are leaves.

Since Node implements Entity, we can designate the root Node as a model, causing it to be registered by its ID in Scene#models.

Since Mesh also implements Entity, we can designate the leaf Meshes as objects, causing them to be registered by their IDs in Scene#objects.

We can then find those Entity types in Scene#models and Scene#objects.

We can also update properties of our object-Meshes via calls to Scene#setObjectsHighlighted etc.

[Run this example]

import {Viewer, Mesh, Node, PhongMaterial, buildBoxGeometry, ReadableGeometry} from "xeokit-sdk.es.js";

const viewer = new Viewer({
    canvasId: "myCanvas"
});

viewer.scene.camera.eye = [-21.80, 4.01, 6.56];
viewer.scene.camera.look = [0, -5.75, 0];
viewer.scene.camera.up = [0.37, 0.91, -0.11];

const boxGeometry = new ReadableGeometry(viewer.scene, buildBoxGeometry({
     xSize: 1,
     ySize: 1,
     zSize: 1
}));

new Node(viewer.scene, {
     id: "table",
     isModel: true, // <---------- Node represents a model, so is registered by ID in viewer.scene.models
     rotation: [0, 50, 0],
     position: [0, 0, 0],
     scale: [1, 1, 1],

     children: [

         new Mesh(viewer.scene, { // Red table leg
             id: "redLeg",
             isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects
             position: [-4, -6, -4],
             scale: [1, 3, 1],
             rotation: [0, 0, 0],
             material: new PhongMaterial(viewer.scene, {
                 diffuse: [1, 0.3, 0.3]
             }),
             geometry: boxGeometry
         }),

         new Mesh(viewer.scene, { // Green table leg
             id: "greenLeg",
             isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects
             position: [4, -6, -4],
             scale: [1, 3, 1],
             rotation: [0, 0, 0],
             material: new PhongMaterial(viewer.scene, {
                 diffuse: [0.3, 1.0, 0.3]
             }),
             geometry: boxGeometry
         }),

         new Mesh(viewer.scene, {// Blue table leg
             id: "blueLeg",
             isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects
             position: [4, -6, 4],
             scale: [1, 3, 1],
             rotation: [0, 0, 0],
             material: new PhongMaterial(viewer.scene, {
                 diffuse: [0.3, 0.3, 1.0]
             }),
             geometry: boxGeometry
         }),

         new Mesh(viewer.scene, {  // Yellow table leg
             id: "yellowLeg",
             isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects
             position: [-4, -6, 4],
             scale: [1, 3, 1],
             rotation: [0, 0, 0],
             material: new PhongMaterial(viewer.scene, {
                  diffuse: [1.0, 1.0, 0.0]
             }),
             geometry: boxGeometry
         }),

         new Mesh(viewer.scene, { // Purple table top
             id: "tableTop",
             isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects
             position: [0, -3, 0],
             scale: [6, 0.5, 6],
             rotation: [0, 0, 0],
             material: new PhongMaterial(viewer.scene, {
                 diffuse: [1.0, 0.3, 1.0]
             }),
             geometry: boxGeometry
         })
     ]
 });

// Find Nodes and Meshes by their IDs

var table = viewer.scene.models["table"];                // Since table Node has isModel == true

var redLeg = viewer.scene.objects["redLeg"];             // Since the Meshes have isObject == true
var greenLeg = viewer.scene.objects["greenLeg"];
var blueLeg = viewer.scene.objects["blueLeg"];

// Highlight one of the table leg Meshes

viewer.scene.setObjectsHighlighted(["redLeg"], true);    // Since the Meshes have isObject == true

// Periodically update transforms on our Nodes and Meshes

viewer.scene.on("tick", function () {

      // Rotate legs
      redLeg.rotateY(0.5);
      greenLeg.rotateY(0.5);
      blueLeg.rotateY(0.5);

      // Rotate table
      table.rotateY(0.5);
      table.rotateX(0.3);
  });

Metadata

As mentioned, we can also associate MetaModels and MetaObjects with our Nodes and Meshes, within a MetaScene. See MetaScene for an example.

Constructor Summary

Public Constructor
public

constructor(owner: Component, cfg: *)

Member Summary

Public Members
public get

Gets the Mesh's World-space 3D axis-aligned bounding box.

Represented by a six-element Float64Array containing the min/max extents of the axis-aligned volume, ie. [xmin, ymin,zmin,xmax,ymax, zmax].

public get

Gets the Node's billboarding behaviour.

Options are:

  • "none" - (default) - No billboarding.
  • "spherical" - Mesh is billboarded to face the viewpoint, rotating both vertically and horizontally.
  • "cylindrical" - Mesh is billboarded to face the viewpoint, rotating only about its vertically axis. Use this mode for things like trees on a landscape.
public get

Gets if this Mesh casts shadows.

public set

Sets if this Mesh casts shadows.

public get

Gets if this Mesh is clippable.

public set

Sets if this Mesh is clippable.

public get

Gets if this Mesh included in boundary calculations.

public set

Sets if this Mesh included in boundary calculations.

public get

Gets the RGB colorize color for this Mesh.

public set

Sets the RGB colorize color for this Mesh.

public get

Gets if this Mesh is culled.

public set

Sets if this Mesh is culled.

public get

Defines the appearance of this Mesh when edges are enhanced.

public get

Gets if this Mesh is edge-enhanced.

public set

Sets if this Mesh is edge-enhanced.

public get

Defines the shape of this Mesh.

public get

Defines the appearance of this Mesh when highlighted.

public get

Gets if this Mesh is highlighted.

public set

Sets if this Mesh is highlighted.

public get

Returns true to indicate that Mesh implements Drawable.

public get

Returns true to indicate that Mesh implements Entity.

public get

Returns true to indicate that this Component is a Mesh.

public get

Returns true if this Mesh represents a model.

public get

Returns true if this Mesh represents an object.

public get

Property with final value true to indicate that xeokit should render this Mesh in sorted order, relative to other Meshes.

public get

Gets the Mesh's rendering order relative to other Meshes.

Default value is 0.

This can be set on multiple transparent Meshes, to make them render in a specific order for correct alpha blending.

public set

Sets the Mesh's rendering order relative to other Meshes.

Default value is 0.

This can be set on multiple transparent Meshes, to make them render in a specific order for correct alpha blending.

public get

Defines the appearance of this Mesh when rendering normally, ie.

public get

Gets the Mesh's local modeling transform matrix.

Default value is [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1].

public set

Sets the Mesh's local modeling transform matrix.

Default value is [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1].

public get

The approximate number of triangles in this Mesh.

public get

Gets the Mesh's 3D World-space offset.

Default value is [0,0,0].

public set

Sets the Mesh's 3D World-space offset.

The offset dynamically translates the Mesh in World-space.

Default value is [0, 0, 0].

Provide a null or undefined value to reset to the default value.

public get

Gets the opacity factor for this Mesh.

public set

Sets the opacity factor for this Mesh.

public get

Gets the 3D origin of the Mesh's Geometry's vertex positions.

public set

Sets the 3D origin of the Mesh's Geometry's vertex positions.

public abstract

ID of the corresponding object within the originating system, if any.

public get

The parent Node.

public get

Gets if this Mesh is pickable.

public set

Sets if this Mesh is pickable.

public get

Gets the Mesh's local translation.

Default value is [0,0,0].

public set

Sets the Mesh's local translation.

Default value is [0,0,0].

public get

Gets the Mesh's local rotation quaternion.

Default value is [0,0,0,1].

public set

Sets the Mesh's local rotation quaternion.

Default value is [0,0,0,1].

public get

Gets if this Mesh can have shadows cast upon it.

public set

Sets if this Mesh can have shadows cast upon it.

public
public get

Gets the Mesh's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.

Default value is [0,0,0].

public set

Sets the Mesh's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.

Default value is [0,0,0].

public get
this get was deprecated.

Gets the World-space origin for this Mesh.

public set
this set was deprecated.

Sets the World-space origin for this Mesh.

public get abstract

Gets if this Mesh can have Scalable Ambient Obscurance (SAO) applied to it.

public get

Gets the Mesh's local scale.

Default value is [1,1,1].

public set

Sets the Mesh's local scale.

Default value is [1,1,1].

public get

Gets if this Mesh is selected.

public set

Sets if this Mesh is selected.

public get

Defines the appearance of this Mesh when selected.

public get

Gets if the Node's position is stationary.

When true, will disable the effect of Camera translations for this Mesh, while still allowing it to rotate. This is useful for skyboxes.

public get

Gets if this Mesh is transparent.

public get

Gets if this Mesh is visible.

public set

Sets if this Mesh is visible.

public get

Gets the Mesh's World matrix.

public get

Gets the Mesh's World normal matrix.

public get

Defines the appearance of this Mesh when xrayed.

public get

Gets if this Mesh is xrayed.

public set

Sets if this Mesh is xrayed.

Method Summary

Public Methods
public

Destroys this Mesh.

public

rotate(axis: Number[], angle: Number): *

Rotates the Mesh about the given local axis by the given increment.

public

rotateOnWorldAxis(axis: Number[], angle: Number): *

Rotates the Mesh about the given World-space axis by the given increment.

public

rotateX(angle: Number): *

Rotates the Mesh about the local X-axis by the given increment.

public

rotateY(angle: Number): *

Rotates the Mesh about the local Y-axis by the given increment.

public

rotateZ(angle: Number): *

Rotates the Mesh about the local Z-axis by the given increment.

public

stateSortCompare(mesh1: Mesh, mesh2: Mesh): number

Comparison function used by the renderer to determine the order in which xeokit should render the Mesh, relative to to other Meshes.

public

translate(axis: Number[], distance: Number): *

Translates the Mesh along local space vector by the given increment.

public

translateX(distance: Number): *

Translates the Mesh along the local X-axis by the given increment.

public

translateY(distance: Number): *

Translates the Mesh along the local Y-axis by the given increment.

public

translateZ(distance: Number): *

Translates the Mesh along the local Z-axis by the given increment.

Inherited Summary

From class Component
public get

The Component that owns the lifecycle of this Component, if any.

public

True as soon as this Component has been destroyed

public

ID of this Component, unique within the Scene.

public

meta: *

Arbitrary, user-defined metadata on this component.

public

The parent Scene that contains this Component.

public

The viewer that contains this Scene.

public

clear()

Destroys all Components that are owned by this.

public

Destroys this component.

public

error(message: String)

Logs an error for this component to the JavaScript console.

public

fire(event: String, value: Object, forget: Boolean)

Fires an event on this component.

public

Returns true if there are any subscribers to the given event on this component.

public

isType(type: *): *: Boolean

Tests if this component is of the given type, or is a subclass of the given type.

public

log(message: String)

Logs a console debugging message for this component.

public

off(subId: String)

Cancels an event subscription that was previously made with Component#on or Component#once.

public

on(event: String, callback: Function, scope: Object): String

Subscribes to an event on this component.

public

once(event: String, callback: Function, scope: Object)

Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd.

public

scheduleTask(task: *)

Schedule a task to perform on the next browser interval

public

warn(message: String)

Logs a warning for this component to the JavaScript console.

Public Constructors

public constructor(owner: Component, cfg: *) source

Override:

Component#constructor

Params:

NameTypeAttributeDescription
owner Component

Owner component. When destroyed, the owner will destroy this component as well.

cfg *
  • optional

Configs

cfg.id String
  • optional

Optional ID, unique among all components in the parent scene, generated automatically when omitted.

cfg.originalSystemId String
  • optional

ID of the corresponding object within the originating system, if any.

cfg.isModel Boolean
  • optional

Specify true if this Mesh represents a model, in which case the Mesh will be registered by Mesh#id in Scene#models and may also have a corresponding MetaModel with matching MetaModel#id, registered by that ID in MetaScene#metaModels.

cfg.isObject Boolean
  • optional

Specify true if this Mesh represents an object, in which case the Mesh will be registered by Mesh#id in Scene#objects and may also have a corresponding MetaObject with matching MetaObject#id, registered by that ID in MetaScene#metaObjects.

cfg.parent Node
  • optional

The parent Node.

cfg.origin Number[]
  • optional

World-space origin for this Mesh. When this is given, then matrix, position and geometry are all assumed to be relative to this center.

cfg.rtcCenter Number[]
  • optional

Deprecated - renamed to origin.

cfg.position Number[]
  • optional
  • default: [0,0,0]

3D position of this Mesh, relative to origin.

cfg.scale Number[]
  • optional
  • default: [1,1,1]

Local scale.

cfg.rotation Number[]
  • optional
  • default: [0,0,0]

Local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.

cfg.matrix Number[]
  • optional
  • default: [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]

Local modelling transform matrix. Overrides the position, scale and rotation parameters.

cfg.offset Number[]
  • optional
  • default: [0,0,0]

World-space 3D translation offset. Translates the Mesh in World space, after modelling transforms.

cfg.occluder Boolean
  • optional
  • default: true

Indicates if the Mesh is able to occlude Markers.

cfg.visible Boolean
  • optional
  • default: true

Indicates if the Mesh is initially visible.

cfg.culled Boolean
  • optional
  • default: false

Indicates if the Mesh is initially culled from view.

cfg.pickable Boolean
  • optional
  • default: true

Indicates if the Mesh is initially pickable.

cfg.clippable Boolean
  • optional
  • default: true

Indicates if the Mesh is initially clippable.

cfg.collidable Boolean
  • optional
  • default: true

Indicates if the Mesh is initially included in boundary calculations.

cfg.castsShadow Boolean
  • optional
  • default: true

Indicates if the Mesh initially casts shadows.

cfg.receivesShadow Boolean
  • optional
  • default: true

Indicates if the Mesh initially receives shadows.

cfg.xrayed Boolean
  • optional
  • default: false

Indicates if the Mesh is initially xrayed.

cfg.highlighted Boolean
  • optional
  • default: false

Indicates if the Mesh is initially highlighted.

cfg.selected Boolean
  • optional
  • default: false

Indicates if the Mesh is initially selected.

cfg.edges Boolean
  • optional
  • default: false

Indicates if the Mesh's edges are initially emphasized.

cfg.background Boolean
  • optional
  • default: false

Indicates if the Mesh should act as background, e.g., it can be used for a skybox.

cfg.colorize Number[]
  • optional
  • default: [1.0,1.0,1.0]

Mesh's initial RGB colorize color, multiplies by the rendered fragment colors.

cfg.opacity Number
  • optional
  • default: 1.0

Mesh's initial opacity factor, multiplies by the rendered fragment alpha.

cfg.billboard String
  • optional
  • default: "none"

Mesh's billboarding behaviour. Options are "none" for no billboarding, "spherical" to always directly face Camera.eye, rotating both vertically and horizontally, or "cylindrical" to face the Camera#eye while rotating only about its vertically axis (use that mode for things like trees on a landscape).

cfg.geometry Geometry
  • optional

Geometry to define the shape of this Mesh. Inherits Scene#geometry by default.

cfg.material Material
  • optional

Material to define the normal rendered appearance for this Mesh. Inherits Scene#material by default.

cfg.xrayMaterial EmphasisMaterial
  • optional

EmphasisMaterial to define the xrayed appearance for this Mesh. Inherits Scene#xrayMaterial by default.

cfg.highlightMaterial EmphasisMaterial
  • optional

EmphasisMaterial to define the xrayed appearance for this Mesh. Inherits Scene#highlightMaterial by default.

cfg.selectedMaterial EmphasisMaterial
  • optional

EmphasisMaterial to define the selected appearance for this Mesh. Inherits Scene#selectedMaterial by default.

cfg.edgeMaterial EmphasisMaterial
  • optional

EdgeMaterial to define the appearance of enhanced edges for this Mesh. Inherits Scene#edgeMaterial by default.

cfg.renderOrder Number
  • optional
  • default: 0

Specifies the rendering order for this mESH. This is used to control the order in which mESHES are drawn when they have transparent objects, to give control over the order in which those objects are blended within the transparent render pass.

Public Members

public get aabb: Number[] source

Gets the Mesh's World-space 3D axis-aligned bounding box.

Represented by a six-element Float64Array containing the min/max extents of the axis-aligned volume, ie. [xmin, ymin,zmin,xmax,ymax, zmax].

public get billboard: String source

Gets the Node's billboarding behaviour.

Options are:

  • "none" - (default) - No billboarding.
  • "spherical" - Mesh is billboarded to face the viewpoint, rotating both vertically and horizontally.
  • "cylindrical" - Mesh is billboarded to face the viewpoint, rotating only about its vertically axis. Use this mode for things like trees on a landscape.

public get castsShadow: Boolean source

Gets if this Mesh casts shadows.

public set castsShadow: Boolean source

Sets if this Mesh casts shadows.

public get clippable: Boolean source

Gets if this Mesh is clippable.

Clipping is done by the SectionPlanes in Scene#sectionPlanes.

public set clippable: Boolean source

Sets if this Mesh is clippable.

Clipping is done by the SectionPlanes in Scene#sectionPlanes.

public get collidable: Boolean source

Gets if this Mesh included in boundary calculations.

public set collidable: Boolean source

Sets if this Mesh included in boundary calculations.

public get colorize: Number[] source

Gets the RGB colorize color for this Mesh.

Multiplies by rendered fragment colors.

Each element of the color is in range [0..1].

public set colorize: Number[] source

Sets the RGB colorize color for this Mesh.

Multiplies by rendered fragment colors.

Each element of the color is in range [0..1].

public get culled: Boolean source

Gets if this Mesh is culled.

Only rendered when Mesh#visible is true and Mesh#culled is false.

public set culled: Boolean source

Sets if this Mesh is culled.

Only rendered when Mesh#visible is true and Mesh#culled is false.

public get edgeMaterial: EdgeMaterial source

Defines the appearance of this Mesh when edges are enhanced.

Mesh is xrayed when Mesh#edges is true.

Set to Scene#edgeMaterial by default.

public get edges: Boolean source

Gets if this Mesh is edge-enhanced.

Edge appearance is configured by the EdgeMaterial referenced by Mesh#edgeMaterial.

public set edges: Boolean source

Sets if this Mesh is edge-enhanced.

Edge appearance is configured by the EdgeMaterial referenced by Mesh#edgeMaterial.

public get geometry: Geometry source

Defines the shape of this Mesh.

Set to Scene#geometry by default.

public get highlightMaterial: EmphasisMaterial source

Defines the appearance of this Mesh when highlighted.

Mesh is xrayed when Mesh#highlighted is true.

Set to Scene#highlightMaterial by default.

public get highlighted: Boolean source

Gets if this Mesh is highlighted.

Highlighted appearance is configured by the EmphasisMaterial referenced by Mesh#highlightMaterial.

When Mesh#isObject and Mesh#highlighted are both true the Mesh will be registered by Mesh#id in Scene#highlightedObjects.

public set highlighted: Boolean source

Sets if this Mesh is highlighted.

Highlighted appearance is configured by the EmphasisMaterial referenced by Mesh#highlightMaterial.

When Mesh#isObject and Mesh#highlighted are both true the Mesh will be registered by Mesh#id in Scene#highlightedObjects.

public get isDrawable: Boolean source

Returns true to indicate that Mesh implements Drawable.

public get isEntity: Boolean: boolean source

Returns true to indicate that Mesh implements Entity.

Return:

Boolean

public get isMesh: Boolean source

Returns true to indicate that this Component is a Mesh.

public get isModel: Boolean source

Returns true if this Mesh represents a model.

When this returns true, the Mesh will be registered by Mesh#id in Scene#models and may also have a corresponding MetaModel.

public get isObject: Boolean source

Returns true if this Mesh represents an object.

When this returns true, the Mesh will be registered by Mesh#id in Scene#objects and may also have a corresponding MetaObject.

public get isStateSortable: Boolean source

Property with final value true to indicate that xeokit should render this Mesh in sorted order, relative to other Meshes.

The sort order is determined by Mesh#stateSortCompare.

Sorting is essential for rendering performance, so that xeokit is able to avoid applying runs of the same state changes to the GPU, ie. can collapse them.

public get layer: Number source

Gets the Mesh's rendering order relative to other Meshes.

Default value is 0.

This can be set on multiple transparent Meshes, to make them render in a specific order for correct alpha blending.

public set layer: Number source

Sets the Mesh's rendering order relative to other Meshes.

Default value is 0.

This can be set on multiple transparent Meshes, to make them render in a specific order for correct alpha blending.

public get material: Material source

Defines the appearance of this Mesh when rendering normally, ie. when not xrayed, highlighted or selected.

Set to Scene#material by default.

public get matrix: Number[] source

Gets the Mesh's local modeling transform matrix.

Default value is [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1].

public set matrix: Number[] source

Sets the Mesh's local modeling transform matrix.

Default value is [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1].

public get numTriangles: Number source

The approximate number of triangles in this Mesh.

public get offset: Number[] source

Gets the Mesh's 3D World-space offset.

Default value is [0,0,0].

public set offset: Number[] source

Sets the Mesh's 3D World-space offset.

The offset dynamically translates the Mesh in World-space.

Default value is [0, 0, 0].

Provide a null or undefined value to reset to the default value.

public get opacity: Number source

Gets the opacity factor for this Mesh.

This is a factor in range [0..1] which multiplies by the rendered fragment alphas.

public set opacity: Number source

Sets the opacity factor for this Mesh.

This is a factor in range [0..1] which multiplies by the rendered fragment alphas.

public get origin: Float64Array source

Gets the 3D origin of the Mesh's Geometry's vertex positions.

When this is given, then Mesh#matrix, Mesh#position and Mesh#geometry are all assumed to be relative to this center position.

public set origin: Float64Array source

Sets the 3D origin of the Mesh's Geometry's vertex positions.

When this is given, then Mesh#matrix, Mesh#position and Mesh#geometry are all assumed to be relative to this center position.

public abstract originalSystemId: String source

ID of the corresponding object within the originating system, if any.

public get parent: Node source

The parent Node.

The parent Node may also be set by passing the Mesh to the parent's Node#addChild method.

public get pickable: Boolean source

Gets if this Mesh is pickable.

Picking is done via calls to Scene#pick.

public set pickable: Boolean source

Sets if this Mesh is pickable.

Picking is done via calls to Scene#pick.

public get position: Number[] source

Gets the Mesh's local translation.

Default value is [0,0,0].

public set position: Number[] source

Sets the Mesh's local translation.

Default value is [0,0,0].

public get quaternion: Number[] source

Gets the Mesh's local rotation quaternion.

Default value is [0,0,0,1].

public set quaternion: Number[] source

Sets the Mesh's local rotation quaternion.

Default value is [0,0,0,1].

public get receivesShadow: Boolean source

Gets if this Mesh can have shadows cast upon it.

public set receivesShadow: Boolean source

Sets if this Mesh can have shadows cast upon it.

public renderOrder: * source

public get rotation: Number[] source

Gets the Mesh's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.

Default value is [0,0,0].

public set rotation: Number[] source

Sets the Mesh's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.

Default value is [0,0,0].

public get rtcCenter: Float64Array source

this get was deprecated.

Gets the World-space origin for this Mesh.

Deprecated and replaced by Mesh#origin.

public set rtcCenter: Float64Array source

this set was deprecated.

Sets the World-space origin for this Mesh.

Deprecated and replaced by Mesh#origin.

public get abstract saoEnabled: Boolean source

Gets if this Mesh can have Scalable Ambient Obscurance (SAO) applied to it.

SAO is configured by SAO.

public get scale: Number[] source

Gets the Mesh's local scale.

Default value is [1,1,1].

public set scale: Number[] source

Sets the Mesh's local scale.

Default value is [1,1,1].

public get selected: Boolean source

Gets if this Mesh is selected.

Selected appearance is configured by the EmphasisMaterial referenced by Mesh#selectedMaterial.

When Mesh#isObject and Mesh#selected are both `true the Mesh will be registered by Mesh#id in Scene#selectedObjects.

public set selected: Boolean source

Sets if this Mesh is selected.

Selected appearance is configured by the EmphasisMaterial referenced by Mesh#selectedMaterial.

When Mesh#isObject and Mesh#selected are both `true the Mesh will be registered by Mesh#id in Scene#selectedObjects.

public get selectedMaterial: EmphasisMaterial source

Defines the appearance of this Mesh when selected.

Mesh is xrayed when Mesh#selected is true.

Set to Scene#selectedMaterial by default.

public get stationary: Boolean source

Gets if the Node's position is stationary.

When true, will disable the effect of Camera translations for this Mesh, while still allowing it to rotate. This is useful for skyboxes.

public get transparent: Boolean: * source

Gets if this Mesh is transparent.

Return:

Boolean

public get visible: Boolean source

Gets if this Mesh is visible.

Only rendered when Mesh#visible is true and Mesh#culled is false.

When Mesh#isObject and Mesh#visible are both true the Mesh will be registered by Mesh#id in Scene#visibleObjects.

public set visible: Boolean source

Sets if this Mesh is visible.

Only rendered when Mesh#visible is true and Mesh#culled is false.

When Mesh#isObject and Mesh#visible are both true the Mesh will be registered by Mesh#id in Scene#visibleObjects.

public get worldMatrix: Number[] source

Gets the Mesh's World matrix.

Properties:

NameTypeAttributeDescription
worldMatrix *

public get worldNormalMatrix: Number[] source

Gets the Mesh's World normal matrix.

public get xrayMaterial: EmphasisMaterial source

Defines the appearance of this Mesh when xrayed.

Mesh is xrayed when Mesh#xrayed is true.

Set to Scene#xrayMaterial by default.

public get xrayed: Boolean source

Gets if this Mesh is xrayed.

XRayed appearance is configured by the EmphasisMaterial referenced by Mesh#xrayMaterial.

When Mesh#isObject and Mesh#xrayed are both `true the Mesh will be registered by Mesh#id in Scene#xrayedObjects.

public set xrayed: Boolean source

Sets if this Mesh is xrayed.

XRayed appearance is configured by the EmphasisMaterial referenced by Mesh#xrayMaterial.

When Mesh#isObject and Mesh#xrayed are both `true the Mesh will be registered by Mesh#id in Scene#xrayedObjects.

Public Methods

public destroy() source

Destroys this Mesh.

Override:

Component#destroy

public rotate(axis: Number[], angle: Number): * source

Rotates the Mesh about the given local axis by the given increment.

Params:

NameTypeAttributeDescription
axis Number[]

Local axis about which to rotate.

angle Number

Angle increment in degrees.

Return:

*

public rotateOnWorldAxis(axis: Number[], angle: Number): * source

Rotates the Mesh about the given World-space axis by the given increment.

Params:

NameTypeAttributeDescription
axis Number[]

Local axis about which to rotate.

angle Number

Angle increment in degrees.

Return:

*

public rotateX(angle: Number): * source

Rotates the Mesh about the local X-axis by the given increment.

Params:

NameTypeAttributeDescription
angle Number

Angle increment in degrees.

Return:

*

public rotateY(angle: Number): * source

Rotates the Mesh about the local Y-axis by the given increment.

Params:

NameTypeAttributeDescription
angle Number

Angle increment in degrees.

Return:

*

public rotateZ(angle: Number): * source

Rotates the Mesh about the local Z-axis by the given increment.

Params:

NameTypeAttributeDescription
angle Number

Angle increment in degrees.

Return:

*

public stateSortCompare(mesh1: Mesh, mesh2: Mesh): number source

Comparison function used by the renderer to determine the order in which xeokit should render the Mesh, relative to to other Meshes.

xeokit requires this method because Mesh implements Drawable.

Sorting is essential for rendering performance, so that xeokit is able to avoid needlessly applying runs of the same rendering state changes to the GPU, ie. can collapse them.

Params:

NameTypeAttributeDescription
mesh1 Mesh
mesh2 Mesh

Return:

number

public translate(axis: Number[], distance: Number): * source

Translates the Mesh along local space vector by the given increment.

Params:

NameTypeAttributeDescription
axis Number[]

Normalized local space 3D vector along which to translate.

distance Number

Distance to translate along the vector.

Return:

*

public translateX(distance: Number): * source

Translates the Mesh along the local X-axis by the given increment.

Params:

NameTypeAttributeDescription
distance Number

Distance to translate along the X-axis.

Return:

*

public translateY(distance: Number): * source

Translates the Mesh along the local Y-axis by the given increment.

Params:

NameTypeAttributeDescription
distance Number

Distance to translate along the Y-axis.

Return:

*

public translateZ(distance: Number): * source

Translates the Mesh along the local Z-axis by the given increment.

Params:

NameTypeAttributeDescription
distance Number

Distance to translate along the Z-axis.

Return:

*