Skip to content

Grid

Visual debug helper that renders a ground-aligned reference grid.

Grid draws a square grid centered at the origin, aligned with the XZ-plane. It is typically used as a spatial reference when inspecting object placement, world scale, or camera movement. The grid consists of evenly spaced lines whose extent, color, and subdivision count can be customized.

cpp
my_scene->Add(vglx::Grid::Create({
  .color = 0x333333,
  .size = 4.0f,
  .divisions = 16
}));

INFO

Derives from Node and inherits all public properties and methods.

Construction

Constructors


Grid()

Constructs a grid node.

cpp
Grid::Grid(const Parameters& params);
ParameterDescription
paramsInitialization parameters for constructing the grid.

Factories preferred


Grid::Create() std::unique_ptr<Grid>

Creates an instance of Grid.

cpp
static std::unique_ptr<Grid> Grid::Create(const Parameters& params);
ParameterDescription
paramsInitialization parameters for constructing the grid.

Types

Grid::Parameters struct

Parameters for constructing a Grid object.

ParameterDescription
color ColorLine color used for rendering.
size floatHalf-width of the grid in world units.
divisions unsigned intNumber of grid subdivisions along each axis.

Released under the MIT License.