ModuleContext
public sealed class ModuleContextContext passed to modules during pipeline execution. Contours are detached copies of the
font-outline cache, so pre-geometry edits cannot corrupt later text. All array contents are
mutable in place; modules may modify vertex / normal / UV arrays inside
TextStudio.ThreeD.ModuleContext.GlyphMeshes, reassign whole entries via TextStudio.ThreeD.ModuleContext.ReplaceGlyphMesh(System.Int32%2cTextStudio.ThreeD.GlyphMeshData), or move glyph offsets
during TextStudio.ThreeD.Module3DBase.PostGeometry(TextStudio.ThreeD.ModuleContext). Changes are picked up by the mesh
assembler immediately after PostGeometry returns.
Methods
Section titled “Methods”
TryGetContour(int, out ContourState)
Section titled “TryGetContour(int, out ContourState)”public bool TryGetContour(int visibleGlyphIndex, out ContourState contour)Gets the detached contour state for one visible glyph.
Parameters
| Name | Type |
|---|---|
visibleGlyphIndex |
System.Int32 |
contour |
TextStudio.ThreeD.ContourState |
Returns
System.Boolean
SetContour(int, ContourState)
Section titled “SetContour(int, ContourState)”public bool SetContour(int visibleGlyphIndex, ContourState contour)Replaces the detached contour state for one visible glyph.
Parameters
| Name | Type |
|---|---|
visibleGlyphIndex |
System.Int32 |
contour |
TextStudio.ThreeD.ContourState |
Returns
System.Boolean
SetEntryOffset(int, Vector3)
Section titled “SetEntryOffset(int, Vector3)”public bool SetEntryOffset(int entryIndex, Vector3 offset)Changes the generated base position for one glyph-layer entry.
Parameters
| Name | Type |
|---|---|
entryIndex |
System.Int32 |
offset |
UnityEngine.Vector3 |
Returns
System.Boolean
GetWritableBuffer(int, int)
Section titled “GetWritableBuffer(int, int)”public TextStudio3DWritableBuffer<T> GetWritableBuffer<T>(int slot, int minimumCount = 0)Returns renderer-owned scratch storage for an element type and caller-defined slot. Capacity grows on demand, then the same buffer is reused without allocation on warmed calls. Contents are temporary and may be overwritten by the next module callback.
Parameters
| Name | Type |
|---|---|
slot |
System.Int32 |
minimumCount |
System.Int32 |
Returns
TextStudio.ThreeD.TextStudio3DWritableBuffer{{T}}
GetRenderedGlyphOffsets()
Section titled “GetRenderedGlyphOffsets()”public Vector3[] GetRenderedGlyphOffsets()Returns one generated position per rendered glyph, using the first geometry entry for each glyph. Whitespace and glyphs without generated geometry are omitted.
Returns
UnityEngine.Vector3[]
WriteRenderedGlyphOffsets(TextStudio3DWritableBuffer)
Section titled “WriteRenderedGlyphOffsets(TextStudio3DWritableBuffer)”public int WriteRenderedGlyphOffsets(TextStudio3DWritableBuffer<Vector3> destination)Writes one offset per rendered glyph into retained caller-selected scratch storage.
This is the allocation-free alternative to TextStudio.ThreeD.ModuleContext.GetRenderedGlyphOffsets.
Parameters
| Name | Type |
|---|---|
destination |
TextStudio.ThreeD.TextStudio3DWritableBuffer{UnityEngine.Vector3} |
Returns
System.Int32
GetRenderedGlyphCenter()
Section titled “GetRenderedGlyphCenter()”public Vector3 GetRenderedGlyphCenter()Returns the average generated position using one entry per rendered glyph. This avoids weighting glyphs by their layer count and does not allocate.
Returns
UnityEngine.Vector3
ReplaceGlyphMesh(int, GlyphMeshData)
Section titled “ReplaceGlyphMesh(int, GlyphMeshData)”public void ReplaceGlyphMesh(int entryIndex, GlyphMeshData newData)Replace the geometry for a single glyph entry. The new data must preserve the nine built-in
ranges in MaterialRegion order and may append ranges registered through
TextStudio.ThreeD.ModuleContext.MaterialRegions, or pass null to drop region metadata. Out-of-range indices are ignored.
Parameters
| Name | Type |
|---|---|
entryIndex |
System.Int32 |
newData |
TextStudio.ThreeD.GlyphMeshData |
Constructors
Section titled “Constructors”
ModuleContext()
Section titled “ModuleContext()”public ModuleContext()Properties
Section titled “Properties”
public TextStudio3DText Host { get; }The renderer currently executing the module pipeline.
Returns
TextStudio.ThreeD.TextStudio3DText
FinalMesh
Section titled “FinalMesh”public Mesh FinalMesh { get; }The assembled mesh, available during post-assembly callbacks.
Returns
UnityEngine.Mesh
public string Text { get; }The resolved plain/rich text used for this build.
Returns
System.String
GlyphCount
Section titled “GlyphCount”public int GlyphCount { get; }Number of visible glyph slots represented by TextStudio.ThreeD.ModuleContext.Contours.
Returns
System.Int32
Variables
Section titled “Variables”public VariableHolder Variables { get; }Optional typed variables assigned to the renderer.
Returns
TextStudio.ThreeD.VariableHolder
MaterialRegions
Section titled “MaterialRegions”public TextStudio3DMaterialRegionRegistry MaterialRegions { get; }Semantic material regions declared by active modules for this build. Custom providers can find their registered value, expand a glyph’s region table, and assign appended ranges.
Returns
TextStudio.ThreeD.TextStudio3DMaterialRegionRegistry
Entries
Section titled “Entries”public TextStudio3DEntryCollection Entries { get; }Allocation-free read-only views over the active glyph-layer entries.
Returns
TextStudio.ThreeD.TextStudio3DEntryCollection
Glyphs
Section titled “Glyphs”public TextStudio3DGlyphCollection Glyphs { get; }Allocation-free read-only views indexed by visible glyph identity.
Returns
TextStudio.ThreeD.TextStudio3DGlyphCollection