Skip to content
Shapemetry

@huukhanhnguyen/model / lanes/textures/nodes

lanes/textures/nodes

evaluateTexture()

evaluateTexture(model, key, argsOverride?, operationCount?): Resolved<ImageBuffer>

Parameters

model

Model

key

string

argsOverride?

Record<string, string>

operationCount?

number

Returns

Resolved<ImageBuffer>


logTextureErrorOnce()

logTextureErrorOnce(model, context, key, error): void

DELIBERATELY fail-soft — the two remaining callers are both inside resolveProcessorTextures, and both were reviewed against the throw:

  • resolveProcessorTextures runs from the constructor's "change" listener, i.e. inside the AUTHORING loop. A throw there propagates out of whatever lane edit fired the notify, so a broken texture chain would make the document unfixable — you could not edit the chain that is failing without the edit itself throwing.
  • The failure is not a plausible wrong ANSWER, which is the thing this repo refuses: a material that loses its textureData renders visibly untextured. Nothing downstream mistakes it for a good value.

sampleTexture (displace's field) is the case that does NOT hold — un-displaced geometry IS indistinguishable from a correct result — and it throws instead; see the constructor.

Parameters

model

Model

context

string

key

string

error

unknown

Returns

void


patternValueOf()

patternValueOf(model, key, argsOverride?, operationCount?): ImageBuffer

Resolve + evaluate one textures[] chain by key. The PLAIN call (no argsOverride/operationCount) pulls a persistent, dirty-gated TextureNode (nodes/LaneNode.ts) — shared with sampleTexture (displace) and resolveProcessorTextures (materials), so all three consumers of one texture key recompute together exactly once per genuine change. argsOverride/operationCount (the builder panel's per-step-thumbnail / hi-res-export preview) bypass the cache entirely — still "fresh every call", since nothing in the graph re-pulls a specific override combination automatically. Throws on unknown key or a failing chain.

Parameters

model

Model

key

string

argsOverride?

Record<string, string>

operationCount?

number

Returns

ImageBuffer


refreshTextures()

refreshTextures(model): void

Re-resolve material textureData from the current chains and notify the render sync — the builder panel calls this after editing a chain so the 3D scene picks the new pixels up without a full reload. The notify("change", …) below IS both the invalidation AND the re-resolve (see the constructor's "change" listener, which runs invalidateLaneNodes() then resolveProcessorTextures() in that order) — no separate pre-notify resolve step needed here.

Parameters

model

Model

Returns

void


textureNodeOf()

textureNodeOf(model, key): ChainNode<Chain, ImageBuffer>

Parameters

model

Model

key

string

Returns

ChainNode<Chain, ImageBuffer>

Last updated: 📖 2 min readEdit on GitHub