Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Settings

Hierarchy

  • Settings

Index

Constructors

constructor

  • Parameters

    • gl: Gl
    • cache: SettingsCache
    • Default value apply: <T>(callback: () => T) => T = (callback) => callback()
        • <T>(callback: () => T): T
        • Type parameters

          • T

          Parameters

          • callback: () => T
              • (): T
              • Returns T

          Returns T

    Returns Settings

Properties

activeTexture

activeTexture: (Anonymous function) = Settings.cached<number>({read: cache => cache.activeTexture,write: (cache, value) => {cache.activeTexture = value;},equals: (v1, v2) => v1 === v2,apply: (gl, value) => {gl.handle.activeTexture(TEXTURE0 + value);},})

Readonly apply

apply: <T>(callback: () => T) => T

Type declaration

    • <T>(callback: () => T): T
    • Type parameters

      • T

      Parameters

      • callback: () => T
          • (): T
          • Returns T

      Returns T

arrayBuffer

arrayBuffer: (Anonymous function) = Settings.cached<ArrayBuffer | null>({read: cache => cache.arrayBuffer,write: (cache, value) => {cache.arrayBuffer = value;},equals: (v1, v2) => v1 === v2,apply: (gl, value) => {gl.handle.bindBuffer(ARRAY_BUFFER, value?.handle ?? null);},})

blend

blend: (Anonymous function) = Settings.cached<boolean>({read: cache => cache.blend,write: (cache, value) => {cache.blend = value;},equals: (v1, v2) => v1 === v2,apply: (gl, value) => {if (value) {gl.handle.enable(BLEND);} else {gl.handle.disable(BLEND);}},})

blendEquation

blendEquation: (Anonymous function) = (() => {const setting = Settings.cached<[BlendEquation, BlendEquation]>({read: cache => cache.blendEquation,write: (cached, value) => {cached.blendEquation = value;},equals: (v1, v2) => v1.every((x, i) => x === v2[i]),apply: (gl, [rgb, alpha]) => {gl.handle.blendEquationSeparate(rgb, alpha);},});return function (this: Settings, rgb: BlendEquation, alpha: BlendEquation = rgb) {return setting.call(this, [rgb, alpha]);};})()

blendFunction

blendFunction: (Anonymous function) = (() => {const setting = Settings.cached<[BlendFunction, BlendFunction, BlendFunction, BlendFunction]>({read: cache => cache.blendFunction,write: (cached, value) => {cached.blendFunction = value;},equals: (v1, v2) => v1.every((x, i) => x === v2[i]),apply: (gl, [srcRgb, dstRgb, srcAlpha, dstAlpha]) => {gl.handle.blendFuncSeparate(srcRgb, dstRgb, srcAlpha, dstAlpha);},});return function (this: Settings,srcRgb: BlendFunction,dstRgb: BlendFunction,srcAlpha: BlendFunction = srcRgb,dstAlpha: BlendFunction = dstRgb,) {return setting.call(this, [srcRgb, dstRgb, srcAlpha, dstAlpha]);};})()

Private Readonly cache

clearColor

clearColor: (Anonymous function) = (() => {const setting = Settings.cached<[number, number, number, number]>({read: cache => cache.clearColor,write: (cached, value) => {cached.clearColor = value;},equals: (v1, v2) => v1.every((x, i) => x === v2[i]),apply: (gl, [r, g, b, a]) => {gl.handle.clearColor(r, g, b, a);},});return function (this: Settings, r: number, g: number, b: number, a: number) {return setting.call(this, [r, g, b, a]);};})()

clearDepth

clearDepth: (Anonymous function) = Settings.cached<number>({read: cache => cache.clearDepth,write: (cache, value) => {cache.clearDepth = value;},equals: (v1, v2) => v1 === v2,apply: (gl, value) => {gl.handle.clearDepth(value);},})

depthFunction

depthFunction: (Anonymous function) = Settings.cached<DepthFunction>({read: cache => cache.depthFunction,write: (cache, value) => {cache.depthFunction = value;},equals: (v1, v2) => v1 === v2,apply: (gl, value) => {gl.handle.depthFunc(value);},})

depthTest

depthTest: (Anonymous function) = Settings.cached<boolean>({read: cache => cache.depthTest,write: (cache, value) => {cache.depthTest = value;},equals: (v1, v2) => v1 === v2,apply: (gl, value) => {if (value) {gl.handle.enable(DEPTH_TEST);} else {gl.handle.disable(DEPTH_TEST);}},})

elementsBuffer

elementsBuffer: (Anonymous function) = Settings.cached<ElementsBuffer | null>({read: cache => cache.elementsBuffer,write: (cache, value) => {cache.elementsBuffer = value;},equals: (v1, v2) => v1 === v2,apply: (gl, value) => {gl.handle.bindBuffer(ELEMENT_ARRAY_BUFFER, value?.handle ?? null);},})

frameBuffer

frameBuffer: (Anonymous function) = Settings.cached<FrameBuffer | null>({read: cache => cache.frameBuffer,write: (cache, value) => {cache.frameBuffer = value;},equals: (v1, v2) => v1 === v2,apply: (gl, value) => {gl.handle.bindFramebuffer(FRAMEBUFFER, value ? value.handle : null);},})

Readonly gl

gl: Gl

lineWidth

lineWidth: (Anonymous function) = Settings.cached<number>({read: cache => cache.lineWidth,write: (cache, value) => {cache.lineWidth = value;},equals: (v1, v2) => v1 === v2,apply: (gl, value) => {gl.handle.lineWidth(value);},})

program

program: (Anonymous function) = Settings.cached<Program | null>({read: cache => cache.program,write: (cache, value) => {cache.program = value;},equals: (v1, v2) => v1 === v2,apply: (gl, value) => {gl.handle.useProgram(value ? value.handle : null);},})

renderBuffer

renderBuffer: (Anonymous function) = Settings.cached<RenderBuffer | null>({read: cache => cache.renderBuffer,write: (cache, value) => {cache.renderBuffer = value;},equals: (v1, v2) => v1 === v2,apply: (gl, value) => {gl.handle.bindRenderbuffer(RENDERBUFFER, value ? value.handle : null);},})

scissorBox

scissorBox: (Anonymous function) = (() => {const setting = Settings.cached<[number, number, number, number]>({read: cache => cache.scissorBox,write: (cached, value) => {cached.scissorBox = value;},equals: (v1, v2) => v1.every((x, i) => x === v2[i]),apply: (gl, [x, y, width, heigth]) => {gl.handle.scissor(x, y, width, heigth);},});return function (this: Settings, x: number, y: number, width: number, height: number) {return setting.call(this, [x, y, width, height]);};})()

scissorTest

scissorTest: (Anonymous function) = Settings.cached<boolean>({read: cache => cache.scissorTest,write: (cache, value) => {cache.scissorTest = value;},equals: (v1, v2) => v1 === v2,apply: (gl, value) => {if (value) {gl.handle.enable(SCISSOR_TEST);} else {gl.handle.disable(SCISSOR_TEST);}},})

texture

texture: (Anonymous function) = (() => {const textures = new Array(16).fill(null).map((_, i) => {return Settings.cached<Texture | null>({read: cache => cache.textures.get(i) || null,write: (cache, texture) => {if (texture) {cache.textures.set(i, texture);} else {cache.textures.delete(i);}},equals: (v1, v2) => v1 === v2,apply: (gl, value) => {gl.settings().activeTexture(i).apply(() => {gl.handle.bindTexture(TEXTURE_2D, value?.handle || null);});}});});return function(this: Settings, i: number, texture: Texture | null) {return textures[i].call(this, texture);};})()

viewport

viewport: (Anonymous function) = (() => {const setting = Settings.cached<[number, number, number, number]>({read: cache => cache.viewport,write: (cached, value) => {cached.viewport = value;},equals: (v1, v2) => v1.every((x, i) => x === v2[i]),apply: (gl, [x, y, width, heigth]) => {gl.handle.viewport(x, y, width, heigth);},});return function (this: Settings, x: number, y: number, width: number, height: number) {return setting.call(this, [x, y, width, height]);};})()

Methods

enabledAttributes

  • enabledAttributes(locations: number[]): Settings

instancedAttributes

  • instancedAttributes(locations: number[]): Settings

renderTarget

textures

then

Static Private cached

  • cached<T>(__namedParameters: { apply: (gl: Gl, value: T) => void; equals: (v1: T, v2: T) => boolean; read: (cache: SettingsCache) => T; write: (cahe: SettingsCache, value: T) => void }): (Anonymous function)
  • Type parameters

    • T

    Parameters

    • __namedParameters: { apply: (gl: Gl, value: T) => void; equals: (v1: T, v2: T) => boolean; read: (cache: SettingsCache) => T; write: (cahe: SettingsCache, value: T) => void }
      • apply: (gl: Gl, value: T) => void
          • (gl: Gl, value: T): void
          • Parameters

            • gl: Gl
            • value: T

            Returns void

      • equals: (v1: T, v2: T) => boolean
          • (v1: T, v2: T): boolean
          • Parameters

            • v1: T
            • v2: T

            Returns boolean

      • read: (cache: SettingsCache) => T
      • write: (cahe: SettingsCache, value: T) => void

    Returns (Anonymous function)

Generated using TypeDoc