Skip to main content

Module material_section

Module material_section 

Source
Expand description

Versioned .10d material and submesh sidecar.

MAT4 stores the MAT3 material contract plus an explicit foliage-wind flag; readers remain compatible with MAT1, MAT2 and MAT3. Texture payloads remain in HMC/asset dependencies. Materials and submesh ranges are cold-path data encoded with caller buffers and bounded counts.

Structs§

MaterialRecord
Stable, renderer-independent material record. Colours are linear; each texture field is a SHA-256 HMC/resource digest, or all-zero when that slot is unbound.
SubmeshRange
A contiguous triangle-index interval bound to one stable material identity.
TextureSampler
Per-map sampler state. Defaults follow glTF: repeat, linear magnification and trilinear minification.
TextureTransform
glTF-compatible UV transform. tex_coord selects the source vertex set; current runtime supports set zero and rejects other sets until their vertex streams are present end-to-end.

Enums§

MaterialSectionError
OpacityMode
How alpha affects coverage and blending.
ShadingModel
Material shading model. Stylized shading uses the same material and resource contract.
TextureAddressMode
glTF-compatible texture address mode.
TextureFilterMode
Magnification filter. glTF permits nearest or linear.
TextureMinFilter
Minification filter including its mip selection policy.

Constants§

MATERIAL_RECORD_SIZE
MATERIAL_SECTION_HEADER_SIZE
MATERIAL_SECTION_VERSION
MATERIAL_V1_RECORD_SIZE
MAX_EMISSIVE_FACTOR
MAX_MATERIALS
MAX_SUBMESH_RANGES
PREVIOUS_MATERIAL_RECORD_SIZE
SUBMESH_RANGE_SIZE
TEXTURE_SAMPLER_RECORD_SIZE

Functions§

decode_material_section_into
Decode MAT1 through MAT4 into caller-owned arrays. Both outputs must fit the encoded counts.
encode_material_section
Write the current canonical MAT4 section into a caller-owned output buffer.
encoded_len
Exact encoded size. None means an invalid count or arithmetic overflow.
material_section_counts
Inspect validated MAT1–MAT4 layout/counts without allocating output records.
validate_material_bindings
Validate material/range arrays with the exact rules used by MAT4 encoding.