SurfaceMaterial class final
Format-neutral description of how a surface looks.
The single material abstraction every decoder produces. Metal-rough is the target because it is what glTF defines and what the shaders implement; formats that predate it (OBJ's Phong parameters) are approximated at decode time, with the approximation documented where it happens rather than hidden.
Constructors
-
SurfaceMaterial({String? name, LinearColor baseColor = LinearColor.white, double metallic = 0.0, double roughness = 0.5, TextureBinding? baseColorTexture, TextureBinding? metallicRoughnessTexture, TextureBinding? normalTexture, double normalScale = 1.0, TextureBinding? occlusionTexture, double occlusionStrength = 1.0, OcclusionAffects occlusionAffects = OcclusionAffects.both, TextureBinding? emissiveTexture, LinearColor emissive = LinearColor.black, double emissiveStrength = 1.0, SurfaceAlphaMode alphaMode = SurfaceAlphaMode.opaque, double alphaCutoff = 0.5, bool doubleSided = false, bool unlit = false, LightingModel? lightingModel, MaterialExtensions? extensions, Map<
String, Object?> ? extras, String? physicalMaterial, int? materialVersion}) - A material of the given fields, the rest at glTF's defaults: white, dielectric, half rough, opaque, single-sided, with no textures.
Properties
- alphaCutoff → double
-
A 0..1 fraction: in the mask mode, alpha below it is cut away.
final
- alphaMode → SurfaceAlphaMode
-
How alpha is treated: ignored, cut at alphaCutoff, or blended.
final
- baseColor → LinearColor
-
RGBA tint, linear with straight alpha, as every colour the engine
holds. A format that stores it otherwise (OBJ's
Kd, the.f3dmaterial table) converts at its reader and writer.final - baseColorTexture → TextureBinding?
-
Multiplies baseColor, sRGB with alpha; null for none.
final
- doubleSided → bool
-
Whether back faces are drawn too, lit with the normal turned round.
final
- emissive → LinearColor
-
Linear; alpha is not read.
final
- emissiveStrength → double
-
A unitless multiplier on emissive, as glTF's
KHR_materials_emissive_strength; it becomes nits where the render material is made.final - emissiveTexture → TextureBinding?
-
Multiplies emissive, sRGB; null for none.
final
- extensions → MaterialExtensions?
-
The layers beyond metal-rough — clear coat, specular, index of
refraction — or null for a surface that has none, which is every
surface a format without them decodes. See MaterialExtensions.
final
-
extras
→ Map<
String, Object?> ? -
glTF's own
extrason this material, carried opaquely — see ModelNode.extras for what that means and why.final - hashCode → int
-
The hash code for this object.
no setterinherited
- lightingModel → LightingModel?
-
Which of LightingModel.builtIn this surface asks the renderer to shade
with, or null when the document never said — every decoder built before
this field existed leaves it null, and a null reader falls back to
LightingModel.unlit or LightingModel.pbr by unlit the same way the
renderer's own default already did.
final
- materialVersion → int?
-
The version of the material program its lightingModel names that
this instance was written for (
material Hatch version 3, seeMaterialProgram.version); null when the document never said, which is read as version 1.final - metallic → double
-
A 0..1 fraction.
final
- metallicRoughnessTexture → TextureBinding?
-
Roughness in green and metallic in blue, multiplying roughness and
metallic; null for none.
final
- name → String?
-
The material's name in the file; null when it has none.
final
- normalScale → double
-
A unitless multiplier on the normal map's X and Y.
final
- normalTexture → TextureBinding?
-
Tangent-space normals, scaled by normalScale; null for none.
final
- occlusionAffects → OcclusionAffects
-
Which light the occlusion texture darkens: both halves by default, or
the direct or the indirect alone. glTF has no word for it, so a glTF
surface reads OcclusionAffects.both; a
.fmatkeeps it.final - occlusionStrength → double
-
A 0..1 fraction of the occlusion texture applied.
final
- occlusionTexture → TextureBinding?
-
Ambient occlusion in red, by occlusionStrength; null for none.
final
- physicalMaterial → String?
-
The id of the physical material this surface is made of —
f3d.glass, or a plugin's<pluginId>.<name>— in the engine'sMaterialCatalog(flutter3d_matter); null when the document never said.final - roughness → double
-
Perceptual roughness, a 0..1 fraction.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unlit → bool
-
Shade with albedo only, from glTF's
KHR_materials_unlitor an OBJ material with no specular response at all.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited