Skip to main content
Version: Next

Class: CustomObjectEffectMaterial

Defined in: packages/rendering/src/rendering/CustomObjectEffectMaterial.ts:65

Opt-in material for custom objects: an effect is compiled into the shader only while requested.

CustomObjectEffectMaterial.setReceivesShadow requests the CAD shadow; the shader recompiles whenever the viewer's shadow map appears or disappears, so give each viewer its own material if shadow state can differ.

Only the methods declared here are supported; inherited RawShaderMaterial internals may change.

Extends​

  • RawShaderMaterial

Constructors​

Constructor​

new CustomObjectEffectMaterial(color?, diffuseTexture?): CustomObjectEffectMaterial

Defined in: packages/rendering/src/rendering/CustomObjectEffectMaterial.ts:76

White and no texture when omitted. Effects are requested afterwards through their setters.

Parameters​

color?​

ColorRepresentation = '#ffffff'

Diffuse color.

diffuseTexture?​

Texture<unknown, TextureEventMap> | null

Diffuse texture.

Returns​

CustomObjectEffectMaterial

Overrides​

RawShaderMaterial.constructor

Accessors​

receivesShadow​

Get Signature​

get receivesShadow(): boolean

Defined in: packages/rendering/src/rendering/CustomObjectEffectMaterial.ts:104

Whether this material requested the CAD shadow.

Returns​

boolean


textureVariation​

Get Signature​

get textureVariation(): TextureVariationType

Defined in: packages/rendering/src/rendering/CustomObjectEffectMaterial.ts:177

The texture variation this material requested.

Returns​

TextureVariationType

Methods​

setColor()​

setColor(color): void

Defined in: packages/rendering/src/rendering/CustomObjectEffectMaterial.ts:220

Sets the diffuse color. With a texture, the color multiplies it: white leaves the texture unchanged and any other color tints it.

Parameters​

color​

ColorRepresentation

Returns​

void


setDiffuseTexture()​

setDiffuseTexture(texture): void

Defined in: packages/rendering/src/rendering/CustomObjectEffectMaterial.ts:147

Sets the diffuse texture. Pass null to clear it. A requested texture variation follows the new texture.

Parameters​

texture​

Texture<unknown, TextureEventMap> | null

Returns​

void


setMap()​

setMap(map): void

Defined in: packages/rendering/src/rendering/CustomObjectEffectMaterial.ts:163

Sets the diffuse texture.

Parameters​

map​

Texture<unknown, TextureEventMap> | null

Returns​

void

Deprecated​

Use CustomObjectEffectMaterial.setDiffuseTexture.


setReceivesShadow()​

setReceivesShadow(receivesShadow): void

Defined in: packages/rendering/src/rendering/CustomObjectEffectMaterial.ts:212

Requests or drops the CAD shadow for this material; the request is kept and drawn only while the viewer has shadows enabled (Cognite3DViewer.shadowsEnabled), taking effect on the next draw.

Parameters​

receivesShadow​

boolean

Returns​

void


setTextureVariation()​

setTextureVariation(type): void

Defined in: packages/rendering/src/rendering/CustomObjectEffectMaterial.ts:171

Chooses the technique that hides the repeat of the texture. It is drawn only while the material has a texture; the choice itself is kept, so it may be made before or after the texture is set.

Parameters​

type​

TextureVariationType

Returns​

void