Home Reference Source
import GlRectInstancer from './ui/gldraw/glrectinstancer.js'
public class | source

GlRectInstancer

Extends:

Events → GlRectInstancer

draw many rectangles quickly using GPU instancing (e.g. patchfield: ops,ports,text)

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

ATTR_COLOR: string

public
public

ATTR_DECO: string

public

ATTR_POS: string

public

ATTR_SIZE: string

public

ATTR_TEXRECT: string

public

allowDragging: boolean

public get

bounds: *

public

doBulkUploads: boolean

public set
public get
Private Members
private

_DEFAULT_BIGNUM: number

private
private
private
private
private
private
private

_bounds: {"minX": *, "maxX": *, "minY": *, "maxY": *, "minZ": *, "maxZ": *}

private

_cgl: *

private

_counter: number

private
private
private

_geom: *

private

_interactive: boolean

private

_log: *

private

_mesh: *

private
private
private
private
private
private
private

_name: *

private
private

_needsRebuild: boolean

private
private
private

_newBounds: {"minX": *, "maxX": *, "minY": *, "maxY": *, "minZ": *, "maxZ": *}

private

_num: *

private

_reUploadAttribs: boolean

private

_rects: *[]

private

_shader: *

private

_textures: *[]

private
private
private
private
private
private
private
private
private
private

Method Summary

Public Methods
public

clear()

public

createRect(options: *): *

public
public

getDebug(): {"num": *, "len_attrBuffSizes": *, "len_attrBuffPos": *, "len_attrBuffCol": *, "len_attrBuffDeco": *}

public

getIndex(): *

public
public

isDragging(): *

public

mouseDown(e: *)

public

mouseMove(x: *, y: *, button: *, event: *)

public

mouseUp(e: *)

public
public

render(resX: *, resY: *, scrollX: *, scrollY: *, zoom: *)

public

setAllTexture(tex: *, sdf: *)

public

setBorder(idx: *, o: *)

public

setColor(idx: *, r: *, g: *, b: *, a: *)

public
public

setPosition(idx: *, x: *, y: *, z: *)

public

setSelected(idx: *, o: *)

public

setShape(idx: *, o: *)

public

setSize(idx: *, x: *, y: *)

public

setTexRect(idx: *, x: *, y: *, w: *, h: *)

Private Methods
private
private

_float32Diff(a: *, b: *): *

private

_resetAttrRange(attr: *)

private

_setAttrRange(attr: *, start: *, end: *)

private
private

Inherited Summary

From class Events
public

off: *

public

on: *

private
private
private

_log: *

private

_logEvents: boolean

private

_logName: string

public

addEventListener(which: *, cb: *, idPrefix: string): string

add event listener

public

emitEvent(which: string, param1: *, param2: *, param3: *, param4: *, param5: *, param6: *)

emit event

public

hasEventListener(id: *, cb: *): boolean

check event listener registration

public

hasListenerForEventName(eventName: *): boolean

check event listener by name

public

logEvents(enabled: boolean, logName: string)

enable/disable logging of events for the class

public

removeEventListener(id: *, cb: *)

rempve event listener registration

Public Constructors

public constructor() source

Override:

Events#constructor

Public Members

public ATTR_COLOR: string source

public ATTR_CONTENT_TEX: string source

public ATTR_DECO: string source

public ATTR_POS: string source

public ATTR_SIZE: string source

public ATTR_TEXRECT: string source

public allowDragging: boolean source

public get bounds: * source

public doBulkUploads: boolean source

public set interactive source

public get interactive: * source

Private Members

private _DEFAULT_BIGNUM: number source

private _attrBuffCol: * source

private _attrBuffDeco: * source

private _attrBuffPos: * source

private _attrBuffSizes: * source

private _attrBuffTexRect: * source

private _attrBuffTextures: * source

private _bounds: {"minX": *, "maxX": *, "minY": *, "maxY": *, "minZ": *, "maxZ": *} source

private _cgl: * source

private _counter: number source

private _debugRenderStyle: number source

private _draggingRect: * source

private _geom: * source

private _interactive: boolean source

private _log: * source

Override:

Events#_log

private _mesh: * source

private _meshAttrCol: * source

private _meshAttrDeco: * source

private _meshAttrPos: * source

private _meshAttrSize: * source

private _meshAttrTex: * source

private _meshAttrTexRect: * source

private _name: * source

private _needsBoundsRecalc: boolean source

private _needsRebuild: boolean source

private _needsRebuildReason: string source

private _needsTextureUpdate: boolean source

private _newBounds: {"minX": *, "maxX": *, "minY": *, "maxY": *, "minZ": *, "maxZ": *} source

private _num: * source

private _reUploadAttribs: boolean source

private _rects: *[] source

private _shader: * source

private _textures: *[] source

private _uniResX: * source

private _uniResY: * source

private _uniTexture: * source

private _uniTime: * source

private _uniZoom: * source

private _unimsdfUnit: * source

private _uniscrollX: * source

private _uniscrollY: * source

private _updateRangesMax: {} source

private _updateRangesMin: {} source

Public Methods

public clear() source

public createRect(options: *): * source

Params:

NameTypeAttributeDescription
options *

Return:

*

public dispose() source

public getDebug(): {"num": *, "len_attrBuffSizes": *, "len_attrBuffPos": *, "len_attrBuffCol": *, "len_attrBuffDeco": *} source

Return:

{"num": *, "len_attrBuffSizes": *, "len_attrBuffPos": *, "len_attrBuffCol": *, "len_attrBuffDeco": *}

public getIndex(): * source

Return:

*

public getNumRects(): * source

Return:

*

public isDragging(): * source

Return:

*

public mouseDown(e: *) source

Params:

NameTypeAttributeDescription
e *

public mouseMove(x: *, y: *, button: *, event: *) source

Params:

NameTypeAttributeDescription
x *
y *
button *
event *

public mouseUp(e: *) source

Params:

NameTypeAttributeDescription
e *

public rebuild() source

public render(resX: *, resY: *, scrollX: *, scrollY: *, zoom: *) source

Params:

NameTypeAttributeDescription
resX *
resY *
scrollX *
scrollY *
zoom *

public setAllTexture(tex: *, sdf: *) source

Params:

NameTypeAttributeDescription
tex *
sdf *

public setBorder(idx: *, o: *) source

Params:

NameTypeAttributeDescription
idx *
o *

public setColor(idx: *, r: *, g: *, b: *, a: *) source

Params:

NameTypeAttributeDescription
idx *
r *
g *
b *
a *

public setDebugRenderer(i: *) source

Params:

NameTypeAttributeDescription
i *

public setPosition(idx: *, x: *, y: *, z: *) source

Params:

NameTypeAttributeDescription
idx *
x *
y *
z *

public setSelected(idx: *, o: *) source

Params:

NameTypeAttributeDescription
idx *
o *

public setShape(idx: *, o: *) source

Params:

NameTypeAttributeDescription
idx *
o *

public setSize(idx: *, x: *, y: *) source

Params:

NameTypeAttributeDescription
idx *
x *
y *

public setTexRect(idx: *, x: *, y: *, w: *, h: *) source

Params:

NameTypeAttributeDescription
idx *
x *
y *
w *
h *

Private Methods

private _bindTextures() source

private _float32Diff(a: *, b: *): * source

Params:

NameTypeAttributeDescription
a *
b *

Return:

*

private _resetAttrRange(attr: *) source

Params:

NameTypeAttributeDescription
attr *

private _setAttrRange(attr: *, start: *, end: *) source

Params:

NameTypeAttributeDescription
attr *
start *
end *

private _setupAttribBuffers() source

private _setupTextures() source