Public uniforms table, same shape as MeshMaterial.uniforms.
PrivatetslPrivate Optional_Explicit depthTest / transparent overrides from the constructor config.
Every rebuildGraph() re-applies the factory tail's MODE-DERIVED blending
state, so an override honored only in the constructor would silently revert on
the first later rebuild. The GLSL twin never rebuilds, so its constructor-tail
overrides stick; persisting them here keeps the two contract-identical. An
explicit applyBlendingMode() clears both — a runtime mode switch takes full
ownership of the blending state, matching the GLSL twin.
Private Optional_PrivaterebuildRefresh the colormap TSL nodes so they bind the current
this.uniforms.uColormap*.value. TextureNode binds a specific Texture at
construction, so a swap needs a fresh node — hence this lives in
rebuildGraph(). Mirrors PointTSLMaterial.rebuildColormapNodes.
Privaterebuild(Re)create the base-colour texture node, mirroring rebuildColormapNodes.
A fresh node is required rather than a value write, and that is the whole
reason this method exists: texture() CAPTURES its THREE.Texture at
construction, so mutating uniforms.uBaseColorTex.value afterwards changes
nothing the graph reads. A swap that only wrote the uniform would leave the
mesh sampling the previous image — and on a dataset switch, an image belonging
to a node that no longer exists.
PrivaterebuildRe-run the TSL factory and attach the resulting vertexNode / colorNode +
blending state to ourselves. Every variant flag is read back out of defines,
the same source of truth the GLSL twin's preprocessor consumes.
Current opacity multiplier (the LOD cross-fade snapshots this as its fade base).
Private_Mirrors MeshMaterial._refreshNoGOGDefine.
Switch between the stored-normal and derivative-normal graph variants — the
twin of MeshMaterial.updateShading. Idempotent and guarded: a change rebuilds
the graph, which must not happen on a slice move that changed nothing.
Swap the base-colour texture. The TSL twin of
MeshMaterial.updateBaseColorTexture, and it rebuilds on a texture-identity
swap as well as an on/off flip — texture() captures the Texture at
factory-call time, so writing the uniform alone would leave the graph sampling
the old image.
Routed through the shared colour-source resolver rather than toggling its own
define, so dropping a texture from a node that also has a colormap LUT
re-enables USE_COLORMAP instead of leaving the mesh with no colour source.
Toggle the colormap branch. Rebuilds on an on/off flip OR a texture-identity
swap: TSL's texture() captures the Texture at factory-call time, so a swap
needs a fresh node too. (The GLSL twin gets away with a plain uniform write
because ShaderMaterial reads the IUniform by reference at render time.)
Returns a new material with copied values from this instance.
A clone of this instance.
Bind a colormap LUT texture (or null to disable colormap mode).
When texture is non-null, the USE_COLORMAP define is added
and the uniforms (uColormapTex, uScalarMin, uScalarScale)
are allocated with neutral defaults if they don't exist yet.
When texture is null, the define is removed and the uniform
values are cleared so a subsequent clone() doesn't resurrect
a stale colormap.
No-op when called on a material whose shader path doesn't
include USE_COLORMAP-guarded uniforms.
Update the scalar range [min, max] the colormap maps over.
Encoded as uScalarMin = min and uScalarScale = 1/max(1e-10, max-min)
for the shader. No-op when colormap mode is not active (uniforms
are absent until setColormapTexture has been called once).
Mesh surface material rendered via TSL / NodeMaterial.