Repository

Material

A material will give color and some effect to the surface of the 3D object. Mobilizing.js 3D renderer is based on the one of Three.js https://threejs.org/docs/index.html#api/en/materials/Material and its variations

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

color: *

public
public
public
public

type: *

Private Members
private

Method Summary

Public Methods
public

erase this material (calling dispose and clearing texture map)

public
public
public
public
public
public
public

getOpacity(): float

public
public
public
public
public

Gets the current texture

public
public
public
public
public

setColor(color: Color)

public

Sets the depth test.

public

Sets the depth write.

public
public
public
public

setOpacity(op: float)

public
public

setProperty(name: String, value: Object)

public

setShading(shading: String)

public
public
public

setTexture(texture: Texture)

set this material texture

public
public

setUniform(name: String, value: Object)

public

setWireframe(wireframe: Boolean)

Public Constructors

public constructor(params: Object) source

Params:

NameTypeAttributeDescription
paramsObject

The parameters object

params.typeString | THREE.Material
  • optional
  • default: "basic"

the type of the matrial, one of "basic", "projectionmapping", "phong", "line", "sprite", or directly a Three.js Material.

params.colorColor
  • optional
  • default: Color.white.clone()
params.shadingString
  • optional
  • default: "flat"
params.customParamsObject
  • optional
  • default: {}

the parameters to use for custom type.

Example:

    //this is how to use a parameters object in order to instanciate a Mobilizing.js object
    var mobilizingObject = new Mobilizing.Class({paramName1: value, paramName2: value});

Public Members

public color: * source

public customParams: * source

public shading: * source

public texture: * source

public type: * source

Private Members

private _material: * source

Public Methods

public erase() source

erase this material (calling dispose and clearing texture map)

public getAlphaTest(): Number source

Return:

Number

public getColor(): Color source

Return:

Color

public getDoubleSided(): Boolean source

Return:

Boolean

public getEmissiveColor(): Color source

Return:

Color

public getLineWidth(): Number source

Return:

Number

public getNativeObject(): * source

Return:

*

the Three.js native object used in this class

public getOpacity(): float source

Return:

float

public getPointSize(): Number source

Return:

Number

public getProperty(name: String): Object source

Params:

NameTypeAttributeDescription
nameString

Return:

Object

value (depending on the property)

public getShininess(): Number source

Return:

Number

public getSpecularColor(): Color source

Return:

Color

public getTexture(): Texture source

Gets the current texture

Return:

Texture

public getTransparent(): Boolean source

Return:

Boolean

public getWireframe(): Boolean source

Return:

Boolean

public setAlphaTest(val: Number) source

Params:

NameTypeAttributeDescription
valNumber

between 0 and 1

public setBlending(name: String) source

Params:

NameTypeAttributeDescription
nameString

public setColor(color: Color) source

Params:

NameTypeAttributeDescription
colorColor

public setDepthTest(bool: boolean) source

Sets the depth test.

Params:

NameTypeAttributeDescription
boolboolean

The depthTest value

public setDepthWrite(bool: boolean) source

Sets the depth write.

Params:

NameTypeAttributeDescription
boolboolean

The depthWrite value

public setDoubleSided(sided: Boolean) source

Params:

NameTypeAttributeDescription
sidedBoolean

public setEmissiveColor(color: Color) source

Params:

NameTypeAttributeDescription
colorColor

public setLineWidth(val: Number) source

Params:

NameTypeAttributeDescription
valNumber

public setOpacity(op: float) source

Params:

NameTypeAttributeDescription
opfloat

between 0 and 1

public setPointSize(val: Number) source

Params:

NameTypeAttributeDescription
valNumber

public setProperty(name: String, value: Object) source

Params:

NameTypeAttributeDescription
nameString
valueObject

(depending on the property)

public setShading(shading: String) source

Params:

NameTypeAttributeDescription
shadingString

one of "smooth", "flat"

public setShininess(color: Number) source

Params:

NameTypeAttributeDescription
colorNumber

public setSpecularColor(color: Color) source

Params:

NameTypeAttributeDescription
colorColor

public setTexture(texture: Texture) source

set this material texture

Params:

NameTypeAttributeDescription
textureTexture

public setTransparent(trans: Boolean) source

Params:

NameTypeAttributeDescription
transBoolean

public setUniform(name: String, value: Object) source

Params:

NameTypeAttributeDescription
nameString

the name of the uniform to set

valueObject

the value of the uniform to set

public setWireframe(wireframe: Boolean) source

Params:

NameTypeAttributeDescription
wireframeBoolean