Options
All
  • Public
  • Public/Protected
  • All
Menu

Shader used specifically to render a mesh.

Hierarchy

  • Shader
    • MeshShader

Index

Constructors

constructor

  • new MeshShader(program: Program, uniforms?: Dict<any>): MeshShader
  • Parameters

    • program: Program

      The program the shader will use.

    • Optional uniforms: Dict<any>

      Custom uniforms to use to augment the built-in ones.

    Returns MeshShader

Properties

program

program: Program

Program that the shader uses.

uniformGroup

uniformGroup: UniformGroup<Dict<any>>

Accessors

name

  • get name(): string
  • The name of the mesh shader. Used for figuring out if geometry attributes is compatible with the shader. This needs to be set to something different than default value when custom attributes is used.

    Returns string

uniforms

  • get uniforms(): Dict<any>
  • Shader uniform values, shortcut for uniformGroup.uniforms.

    readonly

    Returns Dict<any>

Methods

checkUniformExists

  • checkUniformExists(name: string, group: UniformGroup<Dict<any>>): boolean
  • Parameters

    • name: string
    • group: UniformGroup<Dict<any>>

    Returns boolean

createShaderGeometry

  • createShaderGeometry(geometry: MeshGeometry3D, instanced: boolean): Geometry
  • Creates geometry with required attributes used by this shader. Override when using custom attributes.

    Parameters

    • geometry: MeshGeometry3D

      The geometry with mesh data.

    • instanced: boolean

      Value indicating if the geometry will be instanced.

    Returns Geometry

destroy

  • destroy(): void
  • Returns void

render

  • render(mesh: Mesh3D, renderer: Renderer, state?: State, drawMode?: DRAW_MODES): void
  • Renders the geometry of the specified mesh.

    Parameters

    • mesh: Mesh3D

      Mesh to render.

    • renderer: Renderer

      Renderer to use.

    • state: State = ...

      Rendering state to use.

    • drawMode: DRAW_MODES = DRAW_MODES.TRIANGLES

      Draw mode to use.

    Returns void

Static from

  • from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict<any>): Shader
  • A short hand function to create a shader based of a vertex and fragment shader.

    Parameters

    • Optional vertexSrc: string

      The source of the vertex shader.

    • Optional fragmentSrc: string

      The source of the fragment shader.

    • Optional uniforms: Dict<any>

      Custom uniforms to use to augment the built-in ones.

    Returns Shader

    A shiny new PixiJS shader!

Generated using TypeDoc