Options
All
  • Public
  • Public/Protected
  • All
Menu

Class NgxShaderWireframeMaterial

Wireframe material

See the ngx3js docs page for details. See the ngx material page for a live demo.

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

constructor

Properties

alphaTest

alphaTest: number

Sets the alpha value to be used when running an alpha test. The material will not be rendered if the opacity is lower than this value. Default is 0.

default

0

alphaToCoverage

alphaToCoverage: boolean

Enables alpha to coverage. Can only be used with MSAA-enabled contexts (meaning when the renderer was created with antialias parameter set to true). Default is false.

default

false

blendDst

Blending destination. Default is OneMinusSrcAlphaFactor. See the destination factors constants for all possible values. The material's blending must be set to CustomBlending for this to have any effect.

default

THREE.OneMinusSrcAlphaFactor

blendDstAlpha

blendDstAlpha: number

The transparency of the .blendDst. Uses .blendDst value if null. Default is null.

default

null

blendEquation

blendEquation: BlendingEquation

Blending equation to use when applying blending. Default is AddEquation. See the blending equation constants for all possible values. The material's blending must be set to CustomBlending for this to have any effect.

default

THREE.AddEquation

blendEquationAlpha

blendEquationAlpha: number

The transparency of the .blendEquation. Uses .blendEquation value if null. Default is null.

default

null

blendSrc

Blending source. Default is SrcAlphaFactor. See the source factors constants for all possible values. The material's blending must be set to CustomBlending for this to have any effect.

default

THREE.SrcAlphaFactor

blendSrcAlpha

blendSrcAlpha: number

The transparency of the .blendSrc. Uses .blendSrc value if null. Default is null.

default

null

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

THREE.NormalBlending

clipIntersection

clipIntersection: boolean

Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union. Default is false.

default

false

clipShadows

clipShadows: boolean

Defines whether to clip shadows according to the clipping planes specified on this material. Default is false.

default

false

clipping

clipping: boolean

Defines whether this material supports clipping; true to let the renderer pass the clippingPlanes uniform. Default is false.

default

false

clippingPlanes

clippingPlanes: any

User-defined clipping planes specified as THREE.Plane objects in world space. These planes apply to the objects this material is attached to. Points in space whose signed distance to the plane is negative are clipped (not rendered). This requires WebGLRenderer.localClippingEnabled to be true. See the WebGL / clipping /intersection example. Default is null.

default

null

color

color: any

Color of the material, by default set to white (0xffffff).

colorWrite

colorWrite: boolean

Whether to render the material's color. This can be used in conjunction with a mesh's renderOrder property to create invisible objects that occlude other objects. Default is true.

default

true

defaultAttributeValues

defaultAttributeValues: any
default

{ 'color': [ 1, 1, 1 ], 'uv': [ 0, 0 ], 'uv2': [ 0, 0 ] }

defines

defines: {}

Defines custom constants using #define directives within the GLSL code for both the vertex shader and the fragment shader; each key/value pair yields another directive:

default

{}

Type declaration

  • [key: string]: any

depthFunc

depthFunc: DepthModes

Which depth function to use. Default is LessEqualDepth. See the depth mode constants for all possible values.

default

THREE.LessEqualDepth

depthTest

depthTest: boolean

Whether to have depth test enabled when rendering this material. Default is true.

default

true

depthWrite

depthWrite: boolean

Whether rendering this material has any effect on the depth buffer. Default is true. When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.

default

true

dithering

dithering: boolean

Whether to apply dithering to the color to remove the appearance of banding. Default is false.

default

false

extensions

extensions: { derivatives: boolean; drawBuffers: boolean; fragDepth: boolean; shaderTextureLOD: boolean }

An object with the following properties:

default

{ derivatives: false, fragDepth: false, drawBuffers: false, shaderTextureLOD: false }

Type declaration

  • derivatives: boolean
  • drawBuffers: boolean
  • fragDepth: boolean
  • shaderTextureLOD: boolean

fog

fog: boolean

Whether the material is affected by fog. Default is false.

default

false

format

format: PixelFormat

When this property is set to THREE.RGBFormat, the material is considered to be opaque and alpha values are ignored. Default is THREE.RGBAFormat.

default

THREE.RGBAFormat

fragmentShader

fragmentShader: string

Fragment shader GLSL code. This is the actual code for the shader. In the example above, the vertexShader and fragmentShader code is extracted from the DOM; it could be passed as a string directly or loaded via AJAX instead.

glslVersion

glslVersion: GLSLVersion

Defines the GLSL version of custom shader code. Only relevant for WebGL 2 in order to define whether to specify GLSL 3.0 or not. Valid values are THREE.GLSL1 or THREE.GLSL3. Default is null.

default

null

id

id: number

Unique number for this material instance.

index0AttributeName

index0AttributeName: string
default

undefined

Readonly isMaterial

isMaterial: true

Used to check whether this or derived classes are materials. Default is true. You should not change this, as it used internally for optimisation.

isShaderMaterial

isShaderMaterial: boolean

lights

lights: boolean

Defines whether this material uses lighting; true to pass uniform data related to lighting to this shader. Default is false.

default

false

linewidth

linewidth: number

Controls wireframe thickness. Default is 1. Due to limitations of the OpenGL Core Profile with the WebGL renderer on most platforms linewidth will always be 1 regardless of the set value.

default

1

name

name: string

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

default

''

needsUpdate

needsUpdate: boolean

Specifies that the material needs to be recompiled.

default

false

opacity

opacity: number

Float in the range of 0.0 - 1.0 indicating how transparent the material is. A value of 0.0 indicates fully transparent, 1.0 is fully opaque. If the material's transparent property is not set to true, the material will remain fully opaque and this value will only affect its color. Default is 1.0.

default

1

polygonOffset

polygonOffset: boolean

Whether to use polygon offset. Default is false. This corresponds to the GL_POLYGON_OFFSET_FILL WebGL feature.

default

false

polygonOffsetFactor

polygonOffsetFactor: number

Sets the polygon offset factor. Default is 0.

default

0

polygonOffsetUnits

polygonOffsetUnits: number

Sets the polygon offset units. Default is 0.

default

0

precision

precision: "highp" | "mediump" | "lowp"

Override the renderer's default precision for this material. Can be "highp", "mediump" or "lowp". Default is null.

default

null

premultipliedAlpha

premultipliedAlpha: boolean

Whether to premultiply the alpha (transparency) value. See [Example:webgl_materials_physical_transmission WebGL / Materials / Physical / Transmission] for an example of the difference. Default is false.

default

false

shadowSide

shadowSide: Side

Defines which side of faces cast shadows. When set, can be THREE.FrontSide, THREE.BackSide, or THREE.DoubleSide. Default is null. If null, the side casting shadows is determined as follows:

default

null

side

side: Side

Defines which side of faces will be rendered - front, back or both. Default is THREE.FrontSide. Other options are THREE.BackSide and THREE.DoubleSide.

default

THREE.FrontSide

stencilFail

stencilFail: StencilOp

Which stencil operation to perform when the comparison function returns false. Default is KeepStencilOp. See the stencil operations constants for all possible values.

default

THREE.KeepStencilOp

stencilFunc

stencilFunc: StencilFunc

The stencil comparison function to use. Default is AlwaysStencilFunc. See stencil function constants for all possible values.

default

THREE.AlwaysStencilFunc

stencilFuncMask

stencilFuncMask: number

The bit mask to use when comparing against the stencil buffer. Default is 0xFF.

default

0xff

stencilRef

stencilRef: number

The value to use when performing stencil comparisons or stencil operations. Default is 0.

default

0

stencilWrite

stencilWrite: boolean

Whether stencil operations are performed against the stencil buffer. In order to perform writes or comparisons against the stencil buffer this value must be true. Default is false.

default

false

stencilWriteMask

stencilWriteMask: number

The bit mask to use when writing to the stencil buffer. Default is 0xFF.

default

0xff

stencilZFail

stencilZFail: StencilOp

Which stencil operation to perform when the comparison function returns true but the depth test fails. Default is KeepStencilOp. See the stencil operations constants for all possible values.

default

THREE.KeepStencilOp

stencilZPass

stencilZPass: StencilOp

Which stencil operation to perform when the comparison function returns true and the depth test passes. Default is KeepStencilOp. See the stencil operations constants for all possible values.

default

THREE.KeepStencilOp

toneMapped

toneMapped: boolean

Defines whether this material is tone mapped according to the renderer's toneMapping setting. Default is true.

default

true

transparent

transparent: boolean

Defines whether this material is transparent. This has an effect on rendering as transparent objects need special treatment and are rendered after non-transparent objects. g When set to true, the extent to which the material is transparent is controlled by setting its opacity property. Default is false.

default

false

type

type: string
default

'ShaderMaterial'

uniforms

uniforms: {}

An object of the form: { "uniform1": { value: 1.0 }, "uniform2": { value: 2 } } specifying the uniforms to be passed to the shader code; keys are uniform names, values are definitions of the form { value: 1.0 } where value is the value of the uniform. Names must match the name of the uniform, as defined in the GLSL code. Note that uniforms are refreshed on every frame, so updating the value of the uniform will immediately update the value available to the GLSL code.

default

{}

Type declaration

uniformsNeedUpdate

uniformsNeedUpdate: boolean

Can be used to force a uniform update while changing uniforms in Object3D.onBeforeRender(). Default is false.

default

false

userData

userData: any

An object that can be used to store custom data about the Material. It should not hold references to functions as these will not be cloned.

default

{}

uuid

uuid: string

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

version

version: number

This starts at 0 and counts how many times [property:Boolean needsUpdate] is set to true.

default

0

vertexColors

vertexColors: boolean

Defines whether vertex coloring is used. Default is false.

default

false

vertexShader

vertexShader: string

Vertex shader GLSL code. This is the actual code for the shader. In the example above, the vertexShader and fragmentShader code is extracted from the DOM; it could be passed as a string directly or loaded via AJAX instead.

visible

visible: boolean

Defines whether this material is visible. Default is true.

default

true

wireframe

wireframe: boolean

Render geometry as wireframe. Default is false (i.e. render as flat polygons).

default

false

wireframeLinewidth

wireframeLinewidth: number

Controls wireframe thickness. Default is 1. Due to limitations of the OpenGL Core Profile with the WebGL renderer on most platforms linewidth will always be 1 regardless of the set value.

default

1

Static alphaTest

alphaTest: number

Sets the alpha value to be used when running an alpha test. The material will not be rendered if the opacity is lower than this value. Default is 0.

default

0

Static alphaToCoverage

alphaToCoverage: boolean

Enables alpha to coverage. Can only be used with MSAA-enabled contexts (meaning when the renderer was created with antialias parameter set to true). Default is false.

default

false

Static blendDst

Blending destination. Default is OneMinusSrcAlphaFactor. See the destination factors constants for all possible values. The material's blending must be set to CustomBlending for this to have any effect.

default

THREE.OneMinusSrcAlphaFactor

Static blendDstAlpha

blendDstAlpha: number

The transparency of the .blendDst. Uses .blendDst value if null. Default is null.

default

null

Static blendEquation

blendEquation: BlendingEquation

Blending equation to use when applying blending. Default is AddEquation. See the blending equation constants for all possible values. The material's blending must be set to CustomBlending for this to have any effect.

default

THREE.AddEquation

Static blendEquationAlpha

blendEquationAlpha: number

The transparency of the .blendEquation. Uses .blendEquation value if null. Default is null.

default

null

Static blendSrc

Blending source. Default is SrcAlphaFactor. See the source factors constants for all possible values. The material's blending must be set to CustomBlending for this to have any effect.

default

THREE.SrcAlphaFactor

Static blendSrcAlpha

blendSrcAlpha: number

The transparency of the .blendSrc. Uses .blendSrc value if null. Default is null.

default

null

Static 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

THREE.NormalBlending

Static clipIntersection

clipIntersection: boolean

Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union. Default is false.

default

false

Static clipShadows

clipShadows: boolean

Defines whether to clip shadows according to the clipping planes specified on this material. Default is false.

default

false

Static clipping

clipping: boolean

Defines whether this material supports clipping; true to let the renderer pass the clippingPlanes uniform. Default is false.

default

false

Static clippingPlanes

clippingPlanes: any

User-defined clipping planes specified as THREE.Plane objects in world space. These planes apply to the objects this material is attached to. Points in space whose signed distance to the plane is negative are clipped (not rendered). This requires WebGLRenderer.localClippingEnabled to be true. See the WebGL / clipping /intersection example. Default is null.

default

null

Static color

color: any

Color of the material, by default set to white (0xffffff).

Static colorWrite

colorWrite: boolean

Whether to render the material's color. This can be used in conjunction with a mesh's renderOrder property to create invisible objects that occlude other objects. Default is true.

default

true

Static defaultAttributeValues

defaultAttributeValues: any
default

{ 'color': [ 1, 1, 1 ], 'uv': [ 0, 0 ], 'uv2': [ 0, 0 ] }

Static defines

defines: {}

Defines custom constants using #define directives within the GLSL code for both the vertex shader and the fragment shader; each key/value pair yields another directive:

default

{}

Type declaration

  • [key: string]: any

Static depthFunc

depthFunc: DepthModes

Which depth function to use. Default is LessEqualDepth. See the depth mode constants for all possible values.

default

THREE.LessEqualDepth

Static depthTest

depthTest: boolean

Whether to have depth test enabled when rendering this material. Default is true.

default

true

Static depthWrite

depthWrite: boolean

Whether rendering this material has any effect on the depth buffer. Default is true. When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.

default

true

Static dithering

dithering: boolean

Whether to apply dithering to the color to remove the appearance of banding. Default is false.

default

false

Static extensions

extensions: { derivatives: boolean; drawBuffers: boolean; fragDepth: boolean; shaderTextureLOD: boolean }

An object with the following properties:

default

{ derivatives: false, fragDepth: false, drawBuffers: false, shaderTextureLOD: false }

Type declaration

  • derivatives: boolean
  • drawBuffers: boolean
  • fragDepth: boolean
  • shaderTextureLOD: boolean

Static fog

fog: boolean

Whether the material is affected by fog. Default is false.

default

false

Static format

format: PixelFormat

When this property is set to THREE.RGBFormat, the material is considered to be opaque and alpha values are ignored. Default is THREE.RGBAFormat.

default

THREE.RGBAFormat

Static fragmentShader

fragmentShader: string

Fragment shader GLSL code. This is the actual code for the shader. In the example above, the vertexShader and fragmentShader code is extracted from the DOM; it could be passed as a string directly or loaded via AJAX instead.

Static glslVersion

glslVersion: GLSLVersion

Defines the GLSL version of custom shader code. Only relevant for WebGL 2 in order to define whether to specify GLSL 3.0 or not. Valid values are THREE.GLSL1 or THREE.GLSL3. Default is null.

default

null

Static id

id: number

Unique number for this material instance.

Static index0AttributeName

index0AttributeName: string
default

undefined

Static Readonly isMaterial

isMaterial: true

Used to check whether this or derived classes are materials. Default is true. You should not change this, as it used internally for optimisation.

Static isShaderMaterial

isShaderMaterial: boolean

Static lights

lights: boolean

Defines whether this material uses lighting; true to pass uniform data related to lighting to this shader. Default is false.

default

false

Static linewidth

linewidth: number

Controls wireframe thickness. Default is 1. Due to limitations of the OpenGL Core Profile with the WebGL renderer on most platforms linewidth will always be 1 regardless of the set value.

default

1

Static name

name: string

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

default

''

Static needsUpdate

needsUpdate: boolean

Specifies that the material needs to be recompiled.

default

false

Static opacity

opacity: number

Float in the range of 0.0 - 1.0 indicating how transparent the material is. A value of 0.0 indicates fully transparent, 1.0 is fully opaque. If the material's transparent property is not set to true, the material will remain fully opaque and this value will only affect its color. Default is 1.0.

default

1

Static polygonOffset

polygonOffset: boolean

Whether to use polygon offset. Default is false. This corresponds to the GL_POLYGON_OFFSET_FILL WebGL feature.

default

false

Static polygonOffsetFactor

polygonOffsetFactor: number

Sets the polygon offset factor. Default is 0.

default

0

Static polygonOffsetUnits

polygonOffsetUnits: number

Sets the polygon offset units. Default is 0.

default

0

Static precision

precision: "highp" | "mediump" | "lowp"

Override the renderer's default precision for this material. Can be "highp", "mediump" or "lowp". Default is null.

default

null

Static premultipliedAlpha

premultipliedAlpha: boolean

Whether to premultiply the alpha (transparency) value. See [Example:webgl_materials_physical_transmission WebGL / Materials / Physical / Transmission] for an example of the difference. Default is false.

default

false

Static shadowSide

shadowSide: Side

Defines which side of faces cast shadows. When set, can be THREE.FrontSide, THREE.BackSide, or THREE.DoubleSide. Default is null. If null, the side casting shadows is determined as follows:

default

null

Static side

side: Side

Defines which side of faces will be rendered - front, back or both. Default is THREE.FrontSide. Other options are THREE.BackSide and THREE.DoubleSide.

default

THREE.FrontSide

Static stencilFail

stencilFail: StencilOp

Which stencil operation to perform when the comparison function returns false. Default is KeepStencilOp. See the stencil operations constants for all possible values.

default

THREE.KeepStencilOp

Static stencilFunc

stencilFunc: StencilFunc

The stencil comparison function to use. Default is AlwaysStencilFunc. See stencil function constants for all possible values.

default

THREE.AlwaysStencilFunc

Static stencilFuncMask

stencilFuncMask: number

The bit mask to use when comparing against the stencil buffer. Default is 0xFF.

default

0xff

Static stencilRef

stencilRef: number

The value to use when performing stencil comparisons or stencil operations. Default is 0.

default

0

Static stencilWrite

stencilWrite: boolean

Whether stencil operations are performed against the stencil buffer. In order to perform writes or comparisons against the stencil buffer this value must be true. Default is false.

default

false

Static stencilWriteMask

stencilWriteMask: number

The bit mask to use when writing to the stencil buffer. Default is 0xFF.

default

0xff

Static stencilZFail

stencilZFail: StencilOp

Which stencil operation to perform when the comparison function returns true but the depth test fails. Default is KeepStencilOp. See the stencil operations constants for all possible values.

default

THREE.KeepStencilOp

Static stencilZPass

stencilZPass: StencilOp

Which stencil operation to perform when the comparison function returns true and the depth test passes. Default is KeepStencilOp. See the stencil operations constants for all possible values.

default

THREE.KeepStencilOp

Static toneMapped

toneMapped: boolean

Defines whether this material is tone mapped according to the renderer's toneMapping setting. Default is true.

default

true

Static transparent

transparent: boolean

Defines whether this material is transparent. This has an effect on rendering as transparent objects need special treatment and are rendered after non-transparent objects. g When set to true, the extent to which the material is transparent is controlled by setting its opacity property. Default is false.

default

false

Static type

type: string
default

'ShaderMaterial'

Static uniforms

uniforms: {}

An object of the form: { "uniform1": { value: 1.0 }, "uniform2": { value: 2 } } specifying the uniforms to be passed to the shader code; keys are uniform names, values are definitions of the form { value: 1.0 } where value is the value of the uniform. Names must match the name of the uniform, as defined in the GLSL code. Note that uniforms are refreshed on every frame, so updating the value of the uniform will immediately update the value available to the GLSL code.

default

{}

Type declaration

Static uniformsNeedUpdate

uniformsNeedUpdate: boolean

Can be used to force a uniform update while changing uniforms in Object3D.onBeforeRender(). Default is false.

default

false

Static userData

userData: any

An object that can be used to store custom data about the Material. It should not hold references to functions as these will not be cloned.

default

{}

Static uuid

uuid: string

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

Static version

version: number

This starts at 0 and counts how many times [property:Boolean needsUpdate] is set to true.

default

0

Static vertexColors

vertexColors: boolean

Defines whether vertex coloring is used. Default is false.

default

false

Static vertexShader

vertexShader: string

Vertex shader GLSL code. This is the actual code for the shader. In the example above, the vertexShader and fragmentShader code is extracted from the DOM; it could be passed as a string directly or loaded via AJAX instead.

Static visible

visible: boolean

Defines whether this material is visible. Default is true.

default

true

Static wireframe

wireframe: boolean

Render geometry as wireframe. Default is false (i.e. render as flat polygons).

default

false

Static wireframeLinewidth

wireframeLinewidth: number

Controls wireframe thickness. Default is 1. Due to limitations of the OpenGL Core Profile with the WebGL renderer on most platforms linewidth will always be 1 regardless of the set value.

default

1

Methods

addEventListener

clone

copy

customProgramCacheKey

  • customProgramCacheKey(): string
  • In case onBeforeCompile is used, this callback can be used to identify values of settings used in onBeforeCompile, so three.js can reuse a cached shader or recompile the shader for this material as needed. For example, if onBeforeCompile contains a conditional statement like:

    if ( black ) {
    shader.fragmentShader = shader.fragmentShader.replace('gl_FragColor = vec4(1)', 'gl_FragColor = vec4(0)')
    }
    // then customProgramCacheKey should be set like this:
    material.customProgramCacheKey = function() {
    return black ? '1' : '0';
    }

    Unlike properties, the callback is not supported by .clone(), .copy() and .toJSON().

    Returns string

dispatchEvent

  • dispatchEvent(event: Event): void

dispose

  • dispose(): void

hasEventListener

onBeforeCompile

removeEventListener

setValues

toJSON

  • toJSON(meta: any): any

Static addEventListener

Static clone

Static copy

Static customProgramCacheKey

  • customProgramCacheKey(): string
  • In case onBeforeCompile is used, this callback can be used to identify values of settings used in onBeforeCompile, so three.js can reuse a cached shader or recompile the shader for this material as needed. For example, if onBeforeCompile contains a conditional statement like:

    if ( black ) {
    shader.fragmentShader = shader.fragmentShader.replace('gl_FragColor = vec4(1)', 'gl_FragColor = vec4(0)')
    }
    // then customProgramCacheKey should be set like this:
    material.customProgramCacheKey = function() {
    return black ? '1' : '0';
    }

    Unlike properties, the callback is not supported by .clone(), .copy() and .toJSON().

    Returns string

Static dispatchEvent

  • dispatchEvent(event: Event): void

Static dispose

  • dispose(): void

Static hasEventListener

Static onBeforeCompile

Static removeEventListener

Static setValues

Static toJSON

  • toJSON(meta: any): any

Generated using TypeDoc