It’s not meant to be used directly, but rather the already existing implementations which work just like regular three.js materials but offer relative to eye rendering support.

  • SpeckleStandardMaterial
  • SpeckleBasicMaterial
  • SpeckleLineMaterial
  • SpecklePointMaterial
  • SpeckleTextMaterial

Accessors

baseUniforms

protected get baseUniforms(): { [uniform: string]: IUniform }

Gets the base three.js uniforms for this material. So for example SpeckleStandardMaterial has the base uniforms as ShaderLib.standard.uniforms.

Returns: An object containing the uniforms

fragmentProgram

protected get fragmentProgram(): string

Gets the fragment program source code.

Returns: string

pointSize

protected set pointSize(value: number)

Sets the point size for point materials.

Returns: number

stencilOutline

protected set stencilOutline(value: boolean)

Can enable the material to have stencil outlines.

Returns: void

uniformsDef

protected get uniformsDef(): Uniforms

Define the custom uniforms for the material.

Returns: _Uniforms_ which is an alias for Record<string, any>

vertexProgram

protected get vertexProgram(): string

Gets the vertex program source code.

Returns: string

Methods

fastCopy

fastCopy(from: Material, to: Material)

Copies properties from one from Material to to Material. The data copied over is restricted to no more and no less than what the viewer needs, so unlike three.js default material copying this aims to be as fast as possible.

Parameters

Returns: void

Typedefs

DisplayStyle

interface DisplayStyle {
  id: string;
  color: number;
  lineWeight: number;
  opacity?: number;
}

Speckle model for material properties on lines.

  • id: The id of the style object
  • color: The color of the line
  • lineWeigth: The thickness of the line in world units
  • optional opacity: The opacity of the line

FilterMaterial

interface FilterMaterial {
  filterType: FilterMaterialType;
  rampIndex?: number;
  rampIndexColor?: Color;
  rampTexture?: Texture;
}

Filter materials are pre-defined materials that you can directly apply with as little configuration as possible.

  • filterType: FilterMaterialType
  • optional rampIndex: The index of the color in the ramp texture. Applies only for FilterMaterialType.COLORED and FilterMaterialType.GRADIENT
  • optional rampIndexColor: The actual color from the ramp texture. Applies only for FilterMaterialType.COLORED and FilterMaterialType.GRADIENT
  • optional rampTexture: The ramp texture. Applies only for FilterMaterialType.COLORED and FilterMaterialType.GRADIENT

FilterMaterialType

enum FilterMaterialType {
  GHOST,
  GRADIENT,
  COLORED,
  HIDDEN,
}

The list of available filter materials.

MaterialOptions

interface MaterialOptions {
  stencilOutlines?: StencilOutlineType;
  pointSize?: number;
  depthWrite?: number;
}

Custom options for materials.

  • optional stencilOutlines: StencilOutlineType. Only applies to meshes
  • optional pointSize: The point size for point materials. Only applies to points
  • optional depthWrite: Whether the material should write to depth

RenderMaterial

interface RenderMaterial {
  id: string;
  color: number;
  opacity: number;
  roughness: number;
  metalness: number;
  vertexColors: boolean;
}

Speckle model for material properties of meshes.

  • id: The id if the render material
  • color: Color as a int32
  • opacity: Opacity
  • roughness: Roughness
  • metalness: Metalness
  • vertexColors: Whether the material reads vertex colors

StencilOutlineType

enum StencilOutlineType {
  NONE,
  OVERLAY,
  OUTLINE_ONLY,
}
  • NONE: No outlines
  • OVERLAY: Outline on top of object
  • OUTLINE_ONLY: Outline only, rest of the object is not visible