NodeDataTexture
Defined in: packages/sigma/src/rendering/node-data-texture.ts:35
Manages a GPU texture storing node data, two RGBA32F texels per node.
Texel 0 - geometry, read by every node-data consumer:
- R: x position (graph coordinates)
- G: y position (graph coordinates)
- B: size
- A: shapeId (integer ID for shape registry lookup)
Texel 1 - rotation flags (0 = viewport/screen-upright, 1 = graph) and color:
- R: nodeRotation (shape orientation follows the camera)
- G: labelRotation (label orbits/turns with the camera)
- B: color RGB packed as r65536 + g256 + b (< 2^24, exact in float32)
- A: color alpha in [0, 1]
Node index N maps to a base texel N * 2; consumers fetch texel 0 there and
texel 1 at N * 2 + 1 (see GLSL_READ_NODE_DATA / GLSL_READ_NODE_FLAGS /
GLSL_READ_NODE_COLOR).
Extends
Constructors
Constructor
new NodeDataTexture(
gl,initialCapacity?):NodeDataTexture
Defined in: packages/sigma/src/rendering/node-data-texture.ts:36
Parameters
gl
WebGL2RenderingContext
initialCapacity?
number
Returns
NodeDataTexture
Overrides
Methods
allocate()
allocate(
key):number
Defined in: packages/sigma/src/rendering/data-texture.ts:152
Allocates a texture index for an item. Returns existing index if item already allocated.
Parameters
key
string | number
Returns
number
Inherited from
bind()
bind(
textureUnit):void
Defined in: packages/sigma/src/rendering/data-texture.ts:271
Binds the texture to a texture unit.
Parameters
textureUnit
number
Returns
void
Inherited from
clear()
clear():
void
Defined in: packages/sigma/src/rendering/data-texture.ts:339
Clears all item allocations (but keeps the texture).
Returns
void
Inherited from
free()
free(
key):void
Defined in: packages/sigma/src/rendering/data-texture.ts:179
Frees an item’s texture index for reuse.
Parameters
key
string | number
Returns
void
Inherited from
getCapacity()
getCapacity():
number
Defined in: packages/sigma/src/rendering/data-texture.ts:287
Gets the current capacity (max items).
Returns
number
Inherited from
getCount()
getCount():
number
Defined in: packages/sigma/src/rendering/data-texture.ts:316
Gets the number of allocated items.
Returns
number
Inherited from
getHighWaterMark()
getHighWaterMark():
number
Defined in: packages/sigma/src/rendering/data-texture.ts:325
Highest index ever allocated + 1. Unlike getCount, this spans freed
holes, so it bounds every live item’s row (what a per-row gl_VertexID
pass must cover).
Returns
number
Inherited from
getIndex()
getIndex(
key):number
Defined in: packages/sigma/src/rendering/data-texture.ts:199
Gets the texture index for an item. Returns -1 if item not found.
Parameters
key
string | number
Returns
number
Inherited from
getTexelsPerItem()
getTexelsPerItem():
number
Defined in: packages/sigma/src/rendering/data-texture.ts:309
Gets the number of texels per item.
Returns
number
Inherited from
getTexture()
getTexture():
WebGLTexture|null
Defined in: packages/sigma/src/rendering/data-texture.ts:280
Gets the WebGL texture object.
Returns
WebGLTexture | null
Inherited from
getTextureHeight()
getTextureHeight():
number
Defined in: packages/sigma/src/rendering/data-texture.ts:302
Gets the texture height (needed to cover the full texture when rendering into it).
Returns
number
Inherited from
getTextureWidth()
getTextureWidth():
number
Defined in: packages/sigma/src/rendering/data-texture.ts:294
Gets the texture width (needed for 2D coordinate calculation in shaders).
Returns
number
Inherited from
has()
has(
key):boolean
Defined in: packages/sigma/src/rendering/data-texture.ts:206
Checks if an item has been allocated.
Parameters
key
string | number
Returns
boolean
Inherited from
isDirty()
isDirty():
boolean
Defined in: packages/sigma/src/rendering/data-texture.ts:332
Checks if there are pending changes to upload.
Returns
boolean
Inherited from
kill()
kill():
void
Defined in: packages/sigma/src/rendering/data-texture.ts:360
Destroys the texture and clears all data.
Returns
void
Inherited from
restore()
restore():
void
Defined in: packages/sigma/src/rendering/data-texture.ts:350
Recreates the GPU texture after a context loss, re-uploading the CPU-side data.
Returns
void
Inherited from
updateNode()
updateNode(
nodeKey,x,y,size,shapeId,nodeRotation,labelRotation,color):void
Defined in: packages/sigma/src/rendering/node-data-texture.ts:44
Updates all data for a node. nodeRotation and labelRotation are the
per-node rotation-alignment flags (0 = viewport, 1 = graph).
Parameters
nodeKey
string
x
number
y
number
size
number
shapeId
number
nodeRotation
number
labelRotation
number
color
string
Returns
void
upload()
upload():
void
Defined in: packages/sigma/src/rendering/data-texture.ts:223
Uploads dirty data to the GPU texture. With 2D layout and multiple texels per item, uploads affected rows.
Returns
void