Class ScyllaPaneledWall2Shape
Parametric wall with a grid of raised truncated-pyramid (frustum) panels on the front face. Each panel has a square base on the wall surface, a smaller square top extruded outward by PanelExtrusion, and 4 sloped trapezoidal sides connecting base to top. The back face is flat.
Inheritance
Inherited Members
Namespace: Scylla.Core.Util.Geom
Assembly: ScyllaCore.dll
Syntax
[AddComponentMenu("Scylla/Geometry/Paneled Wall 2")]
public sealed class ScyllaPaneledWall2Shape : ScyllaShapeBase3D
Remarks
The wall is centered at the origin. The total wall footprint is Length x Height x Thickness. Panels are laid out in a PanelRows x PanelCols grid; outer margins and inter-panel gaps are auto-computed symmetrically so that margin equals gap on each axis. If the requested PanelBaseSize does not fit within the grid cell, it is scaled down to the smaller of the two cell dimensions.
Each panel emits 5 quads: 1 flat top square and 4 trapezoidal sloped sides. The
trapezoidal sides are emitted via EmitTrapezoid rather than the standard
AddQuadWithColor(List<Vector3>, List<Vector3>, List<Vector2>, List<int>, List<Color32>, Vector3, Vector3, Vector3, Color32, bool) helper, because the base and
top edges have different widths and require explicit per-corner vertex positions
with an analytic outward normal.
For per-face coloring, ColoringMode selects between WallAndPanels (the default, 2 resolver indices: wall surface vs all panel surfaces) and WallSidesTops (3 indices: wall + sloped panel sides + flat panel tops). Per-face coloring requires a FaceColoringMode other than None and a valid ColorPaletteName.
The Build(Mesh, float, float, float, int, int, float, float, float, PaneledWall2ColoringMode, IFaceColorResolver) static method can be called directly to populate an arbitrary UnityEngine.Mesh without attaching a component.
Properties
ColoringMode
Selects the per-face color granularity applied when a IFaceColorResolver is active. Geometry is identical in all modes; only how many distinct resolver indices the wall emits changes. See PaneledWall2ColoringMode for the index-to-region mapping. Setting this triggers an immediate mesh rebuild via Rebuild().
Declaration
public PaneledWall2ColoringMode ColoringMode { get; set; }
Property Value
| Type | Description |
|---|---|
| PaneledWall2ColoringMode |
Height
Wall extent along the Y axis (the wall's full vertical height). Values below
0.0001 are clamped at build time. Setting this triggers an immediate mesh
rebuild via Rebuild().
Declaration
public float Height { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Length
Wall extent along the X axis (the wall's horizontal run). Values below
0.0001 are clamped at build time. Setting this triggers an immediate mesh
rebuild via Rebuild().
Declaration
public float Length { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
PanelBaseSize
Side length of each panel's square base on the wall surface. Values below
0.0001 are clamped; the value is additionally scaled down if it would not
fit within the grid cell size. Setting this triggers an immediate mesh rebuild via
Rebuild().
Declaration
public float PanelBaseSize { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
PanelCols
Number of panel columns in the X direction. Clamped to [1, 8] at build
time. Setting this triggers an immediate mesh rebuild via
Rebuild().
Declaration
public int PanelCols { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
PanelExtrusion
Outward +Z extrusion depth of the panels. Clamped to >= 0 at
build time. A value of 0 produces flat panels flush with the wall surface.
Setting this triggers an immediate mesh rebuild via
Rebuild().
Declaration
public float PanelExtrusion { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
PanelRows
Number of panel rows in the Y direction. Clamped to [1, 8] at build time.
Setting this triggers an immediate mesh rebuild via
Rebuild().
Declaration
public int PanelRows { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
PanelTopSize
Side length of each panel's extruded top square. Clamped to
[0, PanelBaseSize] at build time. A value of 0 produces sharp
pyramid panels instead of truncated ones. Setting this triggers an immediate mesh
rebuild via Rebuild().
Declaration
public float PanelTopSize { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Thickness
Wall body extent along the Z axis. Values below 0.0001 are clamped at build
time. Setting this triggers an immediate mesh rebuild via
Rebuild().
Declaration
public float Thickness { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
Build(Mesh, float, float, float, int, int, float, float, float, PaneledWall2ColoringMode, IFaceColorResolver)
Populates target with a parametric frustum-panel wall mesh.
Existing mesh data is cleared and overwritten. All parameters are clamped at build
time so the method always produces valid geometry.
Declaration
public static void Build(Mesh target, float length, float height, float thickness, int panelRows, int panelCols, float panelBaseSize, float panelTopSize, float panelExtrusion, PaneledWall2ColoringMode coloringMode = PaneledWall2ColoringMode.WallAndPanels, IFaceColorResolver resolver = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Mesh | target | Destination mesh to populate. Must not be |
| float | length | Wall extent along X (horizontal run). Values below |
| float | height | Wall extent along Y (full vertical height). Values below |
| float | thickness | Wall body extent along Z. Values below |
| int | panelRows | Number of panel rows in the Y direction. Clamped to |
| int | panelCols | Number of panel columns in the X direction. Clamped to |
| float | panelBaseSize | Side length of each panel's square base on the wall surface. Scaled down automatically when it does not fit within the computed grid-cell size so that outer margins and inter-panel gaps remain non-negative. |
| float | panelTopSize | Side length of each panel's extruded top square. Clamped to
|
| float | panelExtrusion | Outward |
| PaneledWall2ColoringMode | coloringMode | Selects how resolver indices are assigned. WallAndPanels
(the default) uses two indices total - |
| IFaceColorResolver | resolver | Optional per-face color resolver (see IFaceColorResolver). When
non-null, a per-vertex color channel is emitted with one solid color per logical
region. When |
Remarks
This method is the pure-static entry point used by the component's BuildMesh(Mesh) implementation. It can also be called directly to fill an arbitrary UnityEngine.Mesh without attaching a component.
The front face is divided into a (2*panelCols+1) x (2*panelRows+1) zone
grid. Even-indexed zones are gap/margin cells emitted as flat quads; odd-indexed
zones on both axes are panel cells emitted as truncated-pyramid frusta (1 top
quad + 4 trapezoidal side quads via EmitTrapezoid). Degenerate gap cells
with zero area are silently skipped.
The mesh uses per-region dispatch: Resolve(int, int, Vector3) is
called once per logical color group (2 or 3 calls total depending on
coloringMode). See PaneledWall2ColoringMode
for the index-to-region mapping.
The generated mesh uses UnityEngine.Rendering.IndexFormat.UInt16 unless the vertex count exceeds 65 000, in which case UnityEngine.Rendering.IndexFormat.UInt32 is used automatically.
BuildMesh(Mesh)
Subclass extension point: write vertex / triangle / normal / uv data into
target from the shape's serialized parameters. The base class
calls Clear(bool) before invoking this method and
UnityEngine.Mesh.RecalculateBounds() afterwards, so subclasses should not invoke
either themselves.
Declaration
protected override void BuildMesh(Mesh target)
Parameters
| Type | Name | Description |
|---|---|---|
| Mesh | target | The owned mesh to populate. Already cleared by the base class. |
Overrides
GetMeshName()
Returns the shape's mesh name as it should appear on the generated mesh asset. Defaults to the subclass type name; override to provide a friendlier label.
Declaration
protected override string GetMeshName()
Returns
| Type | Description |
|---|---|
| string | A short identifier for the generated mesh, used as UnityEngine.Object.name. |