6.7.31 • Published 2 years ago

@dfdao/renderer v6.7.31

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@dfdao/renderer

Table of contents

Classes

Interfaces

Type aliases

Variables

Functions

Classes

AttribArray

AttribArray: Class AttribArray

Helper class - essentially an implementation of ArrayList from Java, but using typed JS Arrays so that we can efficiently write our WebGL data without converting.


AttribManager

AttribManager: Class AttribManager

Responsible for queuing data about a webgl attribute and then writing to it. Does this by maintaining a persistent AttribArray and WebGLBuffer reference, and then calling bufferData on n vertices at a time. Allows us to upload whole arrays of objects at once, providing speed boost.


EngineUtils

EngineUtils: Class EngineUtils


GameGLManager

GameGLManager: Class GameGLManager


GenericRenderer

GenericRenderer: Class GenericRenderer<T, U>

Takes in a gl context, program sources (frag and vert shader), and data about attribs / uniforms and provides:

  • attrib managers
  • uniform setters
  • skeleton code for rendering in our engine via flush()

Type parameters

NameType
Textends EngineProgramDefinition
Uextends WebGLManagerWebGLManager

ProgramUtils

ProgramUtils: Class ProgramUtils


Renderer

Renderer: Class Renderer


ShaderMixins

ShaderMixins: Class ShaderMixins

these are 'includes' that you can add into shader template strings as in ${include}


SpriteRenderer

SpriteRenderer: Class SpriteRenderer


UIRenderer

UIRenderer: Class UIRenderer


WebGLManager

WebGLManager: Class WebGLManager

Interfaces

Attributes

Attributes: Interface Attributes


EngineProgramDefinition

EngineProgramDefinition: Interface EngineProgramDefinition

An object that describes all of the necessary data to create and manage this program within the renderer.


RendererGameContext

RendererGameContext: Interface RendererGameContext


Uniforms

Uniforms: Interface Uniforms

Type aliases

AttribData

Ƭ AttribData: Object

Index signature

key: string: AttribProps


AttribManagers

Ƭ AttribManagers: { [k in keyof T"attribs"]: AttribManager }

Type parameters

NameType
Textends EngineProgramDefinition

AttributeSetters

Ƭ AttributeSetters: { key in keyof U: Function }

Type parameters

NameType
Uextends Attributes

GLArray

Ƭ GLArray: Float32Array | Uint8Array


ProgramInfo

Ƭ ProgramInfo: Object

Type declaration

NameType
fragShaderstring
uniformsUniforms
vertexShaderstring

UniformData

Ƭ UniformData: Object

Index signature

key: string: UniformProps


UniformLocs

Ƭ UniformLocs: { [k in keyof T"uniforms"]: WebGLUniformLocation }

Type parameters

NameType
Textends EngineProgramDefinition

UniformSetter

Ƭ UniformSetter: Function

Type declaration

▸ (el): void

Parameters
NameType
elany
Returns

void


UniformSetters

Ƭ UniformSetters: { [k in keyof T"uniforms"]: UniformSetter }

Type parameters

NameType
Textends EngineProgramDefinition

Variables

engineConsts

engineConsts: Object

Type declaration

NameType
colorsObject
colors.artifactsObject
colors.artifacts.shineRGBVec
colors.artifacts.trimRGBVec
colors.barbsRGBVec
colors.barbsARGBAVec
colors.beltObject
colors.belt.defenseRGBVec
colors.belt.rangeRGBVec
colors.belt.silverRGBVec
colors.belt.speedRGBVec
colors.bonusObject
colors.bonus.defenseRGBVec
colors.bonus.energyCapRGBVec
colors.bonus.energyGroRGBVec
colors.bonus.rangeRGBVec
colors.bonus.spaceJunkRGBVec
colors.bonus.speedRGBVec
colors.goldRGBVec
colors.orangeRGBVec
colors.orangeARGBAVec
colors.purpleRGBVec
colors.purpleARGBAVec
colors.rangeObject
colors.range.dashRGBVec
colors.range.energyRGBVec
colors.redRGBVec
colors.redARGBAVec
colors.voyageObject
colors.voyage.enemyRGBVec
colors.voyage.enemyARGBAVec
colors.voyage.helpRGBVec
colors.voyage.helpARGBAVec
colors.voyage.mineRGBVec
colors.voyage.mineARGBAVec
colors.voyage.shipARGBAVec
colors.whiteRGBVec
colors.whiteARGBAVec
dashLengthnumber
fontStylestring
glyphsObject
glyphs.canvasDimnumber
glyphs.glyphHnumber
glyphs.glyphWnumber
glyphs.rowLnumber
glyphs.scalenumber
planetObject
planet.maxRadiusnumber

Functions

getUniformSetter

getUniformSetter(gl, loc, props): UniformSetter

Create a setter which writes the given uniform specified by props to loc. Note that this function does not call gl.useProgram().

Parameters

NameTypeDescription
glWebGL2RenderingContextThe WebGL rendering context this uniform is in.
locWebGLUniformLocationThe uniform location to write to.
propsUniformPropsUniformProps for this uniform.

Returns

UniformSetter


glsl

Const glsl(arr, ...args): string

Parameters

NameType
arrTemplateStringsArray
...argsany[]

Returns

string