MeshBasicMaterial

A material for drawing geometries in a simple shaded way. This material is not affected by lights.

Core Class

A material for drawing geometries in a simple shaded way. This material is not affected by lights.

Extends

  • SceneClipMaterial

Constructors

Constructor

new MeshBasicMaterial(p?): MeshBasicMaterial

Parameters

p?

MeshBasicMaterialParameters

Returns

MeshBasicMaterial

Overrides

SceneClipMaterial.constructor

Properties

isDynamicShape

isDynamicShape: boolean

Mark this shape of this material is largely affect by shader. Hint the engine that pick, culling is disabled

Deprecated

Inherited from

SceneClipMaterial.isDynamicShape


isVolumeRendering

isVolumeRendering: boolean

Mark this material uses volume like rendering technology. Hint the engine that some effect is disabled

Deprecated

Inherited from

SceneClipMaterial.isVolumeRendering


MAX_TEXTURES

readonly static MAX_TEXTURES: 6 = 6

max texture count, just in case some platform will take use of some channels by default, so set to 6 instead of 8

Inherited from

SceneClipMaterial.MAX_TEXTURES


name

name: string

Optional name of the object (doesn’t need to be unique). Default is an empty string.

Inherited from

SceneClipMaterial.name


id

id: number

Unique number for this material instance.

Inherited from

SceneClipMaterial.id


transparent

transparent: boolean

If use transparent effect, this value must be set to true to enable blending.

Default Value

false

Inherited from

SceneClipMaterial.transparent


visible

visible: boolean

Defines whether this material is visible.

Default Value

true

Inherited from

SceneClipMaterial.visible


programId

programId: number

The id of shader program which this material shader belongs to.

Inherited from

SceneClipMaterial.programId


side

side: Side

Set which side of the object will be seen on screen.

Inherited from

SceneClipMaterial.side


blending

blending: Blending

Which blending to use when displaying objects with this material. This must be set to CustomBlending to use custom blendSrc, blendDst or blendEquation. See the blending mode constants for all possible values. Default is NormalBlending.

Default Value

NormalBlending

Inherited from

SceneClipMaterial.blending


blendSrc

blendSrc: BlendingFactor

Blending source. Default is SrcAlphaFactor. See the source factors constants for all possible values.

Default Value

SrcAlphaFactor

Inherited from

SceneClipMaterial.blendSrc


blendDst

blendDst: BlendingFactor

Blending destination. Default is OneMinusSrcAlphaFactor. See the destination factors constants for all possible values.

Default Value

OneMinusSrcAlpha

Inherited from

SceneClipMaterial.blendDst


blendEquation

blendEquation: BlendingEquation

Blending equation to use when applying blending. Default is AddEquation. See the blending equation constants for all possible values.

Default Value

Add

Inherited from

SceneClipMaterial.blendEquation


blendSrcAlpha

blendSrcAlpha: Nullable<BlendingFactor>

The transparency of the blendSrc.

Inherited from

SceneClipMaterial.blendSrcAlpha


blendDstAlpha

blendDstAlpha: Nullable<BlendingFactor>

The transparency of the blendDst.

Inherited from

SceneClipMaterial.blendDstAlpha


blendEquationAlpha

blendEquationAlpha: Nullable<BlendingEquation>

The transparency of the blendEquation.

Inherited from

SceneClipMaterial.blendEquationAlpha


stencilWrite

stencilWrite: boolean

Whether rendering this material has any effect on the stencil buffer.

Default Value

false

Inherited from

SceneClipMaterial.stencilWrite


stencilWriteMask

stencilWriteMask: number

The bit mask to use when writing to the stencil buffer.

Default Value

0xFF

Inherited from

SceneClipMaterial.stencilWriteMask


stencilFuncMask

stencilFuncMask: number

The bit mask to use when comparing against the stencil buffer.

Default Value

0xFF

Inherited from

SceneClipMaterial.stencilFuncMask


stencilFunc

stencilFunc: StencilFunc

The stencil comparison function to use.

Default Value

AlwaysStencilFunc

Inherited from

SceneClipMaterial.stencilFunc


stencilRef

stencilRef: number

The value to use when performing stencil comparisons or stencil operations.

Default Value

0

Inherited from

SceneClipMaterial.stencilRef


stencilFail

stencilFail: StencilOp

Which stencil operation to perform when the comparison function returns false.

Default Value

KeepStencilOp

Inherited from

SceneClipMaterial.stencilFail


stencilZFail

stencilZFail: StencilOp

Which stencil operation to perform when the comparison function returns true but the depth test fails.

Default Value

KeepStencilOp

Inherited from

SceneClipMaterial.stencilZFail


stencilZPass

stencilZPass: StencilOp

Which stencil operation to perform when the comparison function returns true and the depth test passes.

Default Value

KeepStencilOp

Inherited from

SceneClipMaterial.stencilZPass


depthFunc

depthFunc: DepthModes

Which depth function to use.

Default Value

LessEqualDepth

Inherited from

SceneClipMaterial.depthFunc


depthTest

depthTest: boolean

Whether to have depth test enabled when rendering this material. If this is set to false, this object’s occluding relationship will depend on Object3D.renderOrder| renderOrder.

Default Value

true

Inherited from

SceneClipMaterial.depthTest


depthWrite

depthWrite: boolean

Whether rendering this material has any effect on the depth buffer.

Default Value

true

Inherited from

SceneClipMaterial.depthWrite


colorWrite

colorWrite: boolean

Whether to render the material’s color. This can be used in conjunction with a Object3D.renderOrder| renderOrder property to create invisible objects that occlude other objects.

Default Value

true

Inherited from

SceneClipMaterial.colorWrite


colorWriteMasks

colorWriteMasks: [boolean, boolean, boolean, boolean]

Inherited from

SceneClipMaterial.colorWriteMasks


polygonOffset

polygonOffset: boolean

Whether to use polygon offset.

Default Value

false

Inherited from

SceneClipMaterial.polygonOffset


polygonOffsetFactor

polygonOffsetFactor: number

Sets the polygon offset factor.

Default Value

0

Inherited from

SceneClipMaterial.polygonOffsetFactor


polygonOffsetUnits

polygonOffsetUnits: number

Sets the polygon offset units.

Default Value

0

Inherited from

SceneClipMaterial.polygonOffsetUnits


premultipliedAlpha

premultipliedAlpha: boolean

Whether to premultiply the alpha (transparency) value.

Default Value

false

Inherited from

SceneClipMaterial.premultipliedAlpha


onBeforeRender?

optional onBeforeRender?: (renderer) => void

An optionally overriding method for extents to get data from renderer before update uniforms.

Parameters

renderer

Renderer

instance of renderer for engine.

Returns

void

Inherited from

SceneClipMaterial.onBeforeRender


colorWriteMask

colorWriteMask: [boolean, boolean, boolean, boolean]

Inherited from

SceneClipMaterial.colorWriteMask


enableSceneClipping

enableSceneClipping: boolean

Inherited from

SceneClipMaterial.enableSceneClipping


isMeshBasicMaterial

isMeshBasicMaterial: boolean


color

readonly color: ColorShaderComponent

The basic color of object. User can set texture by this.

Tips

change the color by setValues() that is a better way.


alpha

readonly alpha: AlphaShaderComponent

The Transparency of object.

Tips

change the alpha by setValues() that is a better way.


uvTransform

uvTransform: Readonly<Pick<ReadonlyMarked, "_readonly_mark" | "cloneReadonly" | "clone" | "equals" | "getSerializeData" | "getNumberCount" | "toArray" | "elements" | "applyToBufferAttribute" | "determinant" | "transposeIntoArray" | "applyToArray" | "applyInverse" | "decompose">>

Change the uv data by this matrix.


enableVertexColor

enableVertexColor: boolean


userData

readonly userData: Record<keyof any, any>

Inherited from

SceneClipMaterial.userData


_uuid

_uuid: any

Inherited from

SceneClipMaterial._uuid


uuid

uuid: string

Inherited from

SceneClipMaterial.uuid


_listeners

_listeners: Map<Symbol, Listener<never>[]>

Inherited from

SceneClipMaterial._listeners

Accessors

businessTag

Get Signature

get businessTag(): string

Returns

string

Set Signature

set businessTag(v): void

Parameters
v

string

Returns

void

Inherited from

SceneClipMaterial.businessTag

Methods

getComponents()

getComponents(): readonly ShaderComponent[]

Returns

readonly ShaderComponent[]

Inherited from

SceneClipMaterial.getComponents


deleteComponent()

deleteComponent(index): void

Parameters

index

number

Returns

void

Inherited from

SceneClipMaterial.deleteComponent


addComponent()

addComponent(c, index?): void

Parameters

c

ShaderComponent

index?

number

Returns

void

Inherited from

SceneClipMaterial.addComponent


refreshInstanceInBuilding()

refreshInstanceInBuilding(enable): void

Parameters

enable

boolean

Returns

void

Inherited from

SceneClipMaterial.refreshInstanceInBuilding


setColorWriteMasks()

setColorWriteMasks(r, g, b, a): void

Parameters

r

boolean

g

boolean

b

boolean

a

boolean

Returns

void

Inherited from

SceneClipMaterial.setColorWriteMasks


notifyMaterialPropertyChanged()

notifyMaterialPropertyChanged(): void

When user change the material property manually, this method need to use to refresh data.

Returns

void

Inherited from

SceneClipMaterial.notifyMaterialPropertyChanged


getUUID()

getUUID(): string

UUID of this material instance. This gets automatically assigned, so this shouldn’t be edited.

Returns

string

Inherited from

SceneClipMaterial.getUUID


notifyRecompileShader()

notifyRecompileShader(): void

Reset the key of shader and force engine to compile shader again.

Returns

void

Inherited from

SceneClipMaterial.notifyRecompileShader


copyBase()

copyBase(other): void

Copy basic properties from other material.

Parameters

other

Material

the source of copied data

Returns

void

Inherited from

SceneClipMaterial.copyBase


destroyAllResourcesOwned()

destroyAllResourcesOwned(): void

Returns

void

Inherited from

SceneClipMaterial.destroyAllResourcesOwned


freeAllGpuResourceOwned()

freeAllGpuResourceOwned(): void

Returns

void

Inherited from

SceneClipMaterial.freeAllGpuResourceOwned


extendShaderShape()

extendShaderShape(builder, r): void

Parameters

builder

ShaderBuilder

r

ShaderComponentRegistry

Returns

void

Inherited from

SceneClipMaterial.extendShaderShape


computeShapeKey()

computeShapeKey(r): string

Parameters

r

ShaderComponentRegistry

Returns

string

Inherited from

SceneClipMaterial.computeShapeKey


updateShapeUniforms()

updateShapeUniforms(p, r): void

Parameters

p

WGLProgram

r

ShaderComponentRegistry

Returns

void

Inherited from

SceneClipMaterial.updateShapeUniforms


freeGPU()

freeGPU(): void

Make engine clear the current material’s data in Ubo.

Returns

void

Inherited from

SceneClipMaterial.freeGPU


className()

className(): string

The name of instance’s class.

Returns

string

Overrides

SceneClipMaterial.className


setValues()

setValues(values?): void

Change the corresponding attribute according to the values of given MeshBasicMaterialParameters| parameters.

Parameters

values?

MeshBasicMaterialParameters

a object of specified type contains parameters.

Returns

void

Overrides

SceneClipMaterial.setValues


copy()

copy(other): this

Copy the data to this instance from other instance.

Parameters

other

MeshBasicMaterial

the source of copied data

Returns

this

Overrides

SceneClipMaterial.copy


clone()

clone(): MeshBasicMaterial

Return a cloned instance of this class.

Returns

MeshBasicMaterial

Overrides

SceneClipMaterial.clone


serialize()

serialize(ctx): void

Store the attributes of this class into string as serializing format.

Parameters

ctx

Serializer

an instance used to store the data of scene objects.

Returns

void

Overrides

SceneClipMaterial.serialize


deserialize()

deserialize(ctx): void

Parse the data for this class from string according to serializing format.

Parameters

ctx

Deserializer

an instance give the method to take the data for attribute.

Returns

void

Overrides

SceneClipMaterial.deserialize


markBusinessTag()

markBusinessTag(v): this

Parameters

v

string

Returns

this

Inherited from

SceneClipMaterial.markBusinessTag


isDestroyed()

isDestroyed(): boolean

Returns

boolean

Inherited from

SceneClipMaterial.isDestroyed


destroy()

destroy(): void

Returns

void

Inherited from

SceneClipMaterial.destroy


validate()

validate(): void

Returns

void

Inherited from

SceneClipMaterial.validate


on()

on<T>(_type, _listener): void

Adds a listener to an event type.

Type Parameters

T

T

Parameters

_type

EventType<T>

_listener

Listener<T>

Returns

void

Inherited from

SceneClipMaterial.on


once()

once<T>(_type, _listener): void

Only active the listener one times and then off it| it.

Type Parameters

T

T

Parameters

_type

EventType<T>

_listener

Listener<T>

Returns

void

Inherited from

SceneClipMaterial.once


has()

has<T>(_type, _listener): boolean

Checks if listener is added to an event type.

Type Parameters

T

T

Parameters

_type

EventType<T>

_listener

Listener<T>

Returns

boolean

Inherited from

SceneClipMaterial.has


off()

off<T>(_type, _listener): void

Removes a listener from listening list.

Type Parameters

T

T

Parameters

_type

EventType<T>

_listener

Listener<T>

Returns

void

Inherited from

SceneClipMaterial.off


emit()

Call Signature

emit(type): void

Active the event and call the registered listener.

Parameters
type

EventType<never>

Returns

void

Inherited from

SceneClipMaterial.emit

Call Signature

emit<T>(type, payload): void

Type Parameters
T

T

Parameters
type

EventType<T>

payload

T

Returns

void

Inherited from

SceneClipMaterial.emit


clearAllListeners()

clearAllListeners(): void

Removes all listeners from listening list.

Returns

void

Inherited from

SceneClipMaterial.clearAllListeners