Skip to main content

Cube Struct

Static cube mesh definition with per-face vertices. More...

Declaration

struct helios::engine::rendering::mesh::assets::Cube { ... }

Public Static Functions Index

static MeshDatameshData ()

Creates a lightweight MeshData view over the static cube buffers. More...

Public Static Attributes Index

static constexpr std::array< Vertex, 24 >vertices

Interleaved vertex data (position, normal, UV), grouped by face. More...

static constexpr std::array< unsigned int, 36 >indices = ...

Triangle index buffer (counter-clockwise winding). More...

static constexpr helios::engine::rendering::mesh::types::PrimitiveTypeprimitiveType = mesh::types::PrimitiveType::Triangles

Primitive topology used to interpret indices. More...

Description

Static cube mesh definition with per-face vertices.

The cube uses 24 vertices (4 per face) so each face can provide distinct normals and texture coordinates. Indices define 12 triangles (36 indices).

Definition at line 27 of file Cube.ixx.

Public Static Functions

meshData()

MeshData helios::engine::rendering::mesh::assets::Cube::meshData ()
inline static

Creates a lightweight MeshData view over the static cube buffers.

Returns

MeshData referencing vertices, indices, and primitiveType.

Definition at line 99 of file Cube.ixx.

99 static MeshData meshData() {
100 return MeshData{
101 std::span{vertices},
102 std::span{indices},
104 };
105
106 };

References indices, primitiveType and vertices.

Public Static Attributes

indices

constexpr std::array<unsigned int, 36> helios::engine::rendering::mesh::assets::Cube::indices
constexpr static

Triangle index buffer (counter-clockwise winding).

Initialiser
= { 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4, 8, 9, 10, 10, 11, 8, 12, 13, 14, 14, 15, 12, 16, 17, 18, 18, 19, 16, 20, 21, 22, 22, 23, 20 }

Definition at line 74 of file Cube.ixx.

74 static constexpr std::array<unsigned int, 36> indices = {
75 // n
76 0, 1, 2, 2, 3, 0,
77 // f
78 4, 5, 6, 6, 7, 4,
79 // l
80 8, 9, 10, 10, 11, 8,
81 // r
82 12, 13, 14, 14, 15, 12,
83 // b
84 16, 17, 18, 18, 19, 16,
85 // t
86 20, 21, 22, 22, 23, 20
87 };

Referenced by meshData.

primitiveType

constexpr helios::engine::rendering::mesh::types::PrimitiveType helios::engine::rendering::mesh::assets::Cube::primitiveType = mesh::types::PrimitiveType::Triangles
constexpr static

Primitive topology used to interpret indices.

Definition at line 92 of file Cube.ixx.

Referenced by meshData.

vertices

constexpr std::array<Vertex, 24> helios::engine::rendering::mesh::assets::Cube::vertices
constexpr static

Interleaved vertex data (position, normal, UV), grouped by face.

Definition at line 32 of file Cube.ixx.

32 static constexpr std::array<Vertex, 24> vertices{{
33 // n (z = 1.0)
34 {{-1.0f, -1.0f, 1.0f}, { 0.0f, 0.0f, 1.0f}, {0.0f, 0.0f}}, // Bottom-left
35 {{ 1.0f, -1.0f, 1.0f}, { 0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, // Bottom-right
36 {{ 1.0f, 1.0f, 1.0f}, { 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f}}, // Top-right
37 {{-1.0f, 1.0f, 1.0f}, { 0.0f, 0.0f, 1.0f}, {0.0f, 1.0f}}, // Top-left
38
39 // f (z = -1.0)
40 {{-1.0f, -1.0f, -1.0f}, { 0.0f, 0.0f, -1.0f}, {1.0f, 0.0f}}, // Bottom-left
41 {{ 1.0f, -1.0f, -1.0f}, { 0.0f, 0.0f, -1.0f}, {0.0f, 0.0f}}, // Bottom-right
42 {{ 1.0f, 1.0f, -1.0f}, { 0.0f, 0.0f, -1.0f}, {0.0f, 1.0f}}, // Top-right
43 {{-1.0f, 1.0f, -1.0f}, { 0.0f, 0.0f, -1.0f}, {1.0f, 1.0f}}, // Top-left
44
45 // l (x = -1.0)
46 {{-1.0f, -1.0f, -1.0f}, {-1.0f, 0.0f, 0.0f}, {0.0f, 0.0f}}, // Bottom-left
47 {{-1.0f, -1.0f, 1.0f}, {-1.0f, 0.0f, 0.0f}, {1.0f, 0.0f}}, // Bottom-right
48 {{-1.0f, 1.0f, 1.0f}, {-1.0f, 0.0f, 0.0f}, {1.0f, 1.0f}}, // Top-right
49 {{-1.0f, 1.0f, -1.0f}, {-1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, // Top-left
50
51 // r (x = 1.0)
52 {{ 1.0f, -1.0f, -1.0f}, { 1.0f, 0.0f, 0.0f}, {1.0f, 0.0f}}, // Bottom-left
53 {{ 1.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.0f}, {0.0f, 0.0f}}, // Bottom-right
54 {{ 1.0f, 1.0f, 1.0f}, { 1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, // Top-right
55 {{ 1.0f, 1.0f, -1.0f}, { 1.0f, 0.0f, 0.0f}, {1.0f, 1.0f}}, // Top-left
56
57 // b (y = -1.0)
58 {{-1.0f, -1.0f, -1.0f}, { 0.0f, -1.0f, 0.0f}, {0.0f, 1.0f}}, // Bottom-left
59 {{ 1.0f, -1.0f, -1.0f}, { 0.0f, -1.0f, 0.0f}, {1.0f, 1.0f}}, // Bottom-right
60 {{ 1.0f, -1.0f, 1.0f}, { 0.0f, -1.0f, 0.0f}, {1.0f, 0.0f}}, // Top-right
61 {{-1.0f, -1.0f, 1.0f}, { 0.0f, -1.0f, 0.0f}, {0.0f, 0.0f}}, // Top-left
62
63 // t (y = 1.0)
64 {{-1.0f, 1.0f, -1.0f}, { 0.0f, 1.0f, 0.0f}, {0.0f, 0.0f}}, // Bottom-left
65 {{ 1.0f, 1.0f, -1.0f}, { 0.0f, 1.0f, 0.0f}, {1.0f, 0.0f}}, // Bottom-right
66 {{ 1.0f, 1.0f, 1.0f}, { 0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, // Top-right
67 {{-1.0f, 1.0f, 1.0f}, { 0.0f, 1.0f, 0.0f}, {0.0f, 1.0f}} // Top-left
68 }};

Referenced by meshData.


The documentation for this struct was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.