The grid shader used by foundry.canvas.containers.GridMesh.

Hierarchy (View Summary)

Properties

initialUniforms: object

The initial values of the shader uniforms.

ANTIALIASED_STEP_FUNCTION: string = ...

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

COLOR_UNIFORM: string = "uniform vec4 color;"

The grid color uniform.

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

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

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.
HEXAGONAL_FUNCTIONS: string = ...

Hexagonal functions conversion for between grid and cube space.

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).

NEAREST_VERTEX_FUNCTION: string = ...

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

RESOLUTION_UNIFORM: string = "uniform float resolution;"

The resolution (pixels per grid space units) uniform.

THICKNESS_UNIFORM: string = "uniform float thickness;"

The grid thickness uniform.

TYPE_UNIFORM: string = ...

The grid type uniform.

vertexShader: string = ...
_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