The grid shader used by GridMesh.

Hierarchy (view full)

Properties

initialUniforms: object

The initial values of the shader uniforms.

TYPE_UNIFORM: string = ...

The grid type uniform.

THICKNESS_UNIFORM: string = "uniform float thickness;"

The grid thickness uniform.

COLOR_UNIFORM: string = "uniform vec4 color;"

The grid color uniform.

RESOLUTION_UNIFORM: string = "uniform float resolution;"

The resolution (pixels per grid space units) uniform.

ANTIALIASED_STEP_FUNCTION: string = ...

The antialiased step function. The edge and x values is given in grid space units.

LINE_COVERAGE_FUNCTION: string = ...

The line converage function, which returns the alpha value at a point with the given distance (in grid space units) from an antialiased line (or point) with the given thickness (in grid space units).

HEXAGONAL_FUNCTIONS: string = ...

Hexagonal functions conversion for between grid and cube space.

NEAREST_VERTEX_FUNCTION: string = ...

Get the nearest vertex of a grid space to the given point.

EDGE_DISTANCE_FUNCTION: string = ...

This function returns the distance to the nearest edge of a grid space given a point.

EDGE_OFFSET_FUNCTION: string = ...

This function returns an vector (x, y, z), where

  • x is the x-offset along the nearest edge,
  • y is the y-offset (the distance) from the nearest edge, and
  • z is the length of the nearest edge.
DRAW_GRID_FUNCTION: string = ...

A function that draws the grid given a grid point, style, thickness, and color.

vertexShader: string = ...
defaultUniforms: {
    canvasDimensions: number[];
    meshDimensions: number[];
    sceneDimensions: number[];
    screenDimensions: number[];
    gridSize: number;
    type: number;
    thickness: number;
    resolution: number;
    color: number[];
    alpha: number;
    style: number;
} = ...

Type declaration

  • canvasDimensions: number[]
  • meshDimensions: number[]
  • sceneDimensions: number[]
  • screenDimensions: number[]
  • gridSize: number
  • type: number
  • thickness: number
  • resolution: number
  • color: number[]
  • alpha: number
  • style: number
_fragmentShader: string = ...

The fragment shader source. Subclasses can override it.

Accessors

  • get fragmentShader(): string
  • Returns string

Methods

  • Configure the shader.

    Parameters

    • options: object

    Returns void

  • Reset the shader uniforms back to their initial values.

    Returns void