Interface IFaceColorResolver
Resolves a vertex color for an individual face of a generated shape mesh. Shape builders call Resolve(int, int, Vector3) once per face when emitting mesh data, allowing callers to drive per-face coloring (e.g. random vivid colors per box face, gradient sampled by world-up height, palette cycling).
Namespace: Scylla.Core.Util.Geom
Assembly: ScyllaCore.dll
Syntax
public interface IFaceColorResolver
Remarks
A "face" here is a builder-defined region of the mesh (typically one logical surface of the shape, regardless of how many triangles compose it). The face index space is shape-specific - a box has six faces, a cone has segments-many side faces plus one base, etc. Refer to the individual shape builder documentation for the face indexing convention.
Two dispatch conventions are valid within the shape family and resolvers should be
written to work with both: (1) per-region dispatch used by faceted shapes
(Box, Crate, Wall family, traversal shapes, lathed prop shapes), where the builder
calls Resolve(int, int, Vector3) once per logical face region and
shares the returned color across every vertex of that region; (2) per-vertex
dispatch used by primitive-tier smooth shapes (Sphere, IcoSphere, Dome, SkyDome,
Capsule), where the builder calls Resolve(int, int, Vector3) once per
vertex and writes the result directly to that vertex's color slot. Per-vertex
dispatch produces smooth gradients under spatial resolvers and per-vertex variation
under Cycle / Hash modes; per-region dispatch produces flat-shaded
faceted color. Each shape's XML doc names which convention it follows.
When null is passed to a shape builder in place of a resolver, the builder
skips per-face vertex color emission entirely - resulting in a mesh without a color
channel. Per-shape tint applied via ApplyTint(Renderer, Color) remains
functional in this case.
Methods
Resolve(int, int, Vector3)
Returns the color to assign to all vertices of the face identified by
faceIndex.
Declaration
Color32 Resolve(int faceIndex, int faceCount, Vector3 faceCenter)
Parameters
| Type | Name | Description |
|---|---|---|
| int | faceIndex | Zero-based face index within the shape's face inventory. The valid range is
|
| int | faceCount | Total number of faces the shape will emit, useful for resolvers that need to know the upper bound (e.g. gradient sampling by index ratio). |
| Vector3 | faceCenter | Local-space center of the face, useful for resolvers that derive color from spatial position (e.g. gradient sampled by Y, or 3D noise lookup). |
Returns
| Type | Description |
|---|---|
| Color32 | The color to assign to the face's vertices. |