Skip to main content

WireframeCube.ixx File

Simple wireframe cube mesh asset with positions, normals, UVs, and line indices. More...

Included Headers

#include <array> #include <span> #include <helios.engine.rendering.mesh.types.PrimitiveType> #include <helios.engine.rendering.mesh.types.MeshData> #include <helios.math> #include <helios.engine.rendering.common.types.Vertex>

Namespaces Index

namespacehelios
namespaceengine
namespacerendering
namespacemesh
namespaceassets

Classes Index

structWireframeCube

Static wireframe cube mesh definition. More...

Description

Simple wireframe cube mesh asset with positions, normals, UVs, and line indices.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7#include <array>
8#include <span>
9
10export module helios.engine.rendering.mesh.assets:WireframeCube;
11
12import helios.engine.rendering.common.types.Vertex;
13import helios.engine.rendering.mesh.types.MeshData;
14import helios.engine.rendering.mesh.types.PrimitiveType;
15import helios.math;
16
19
21
28 struct WireframeCube {
29
36 static constexpr std::array<Vertex, 8> vertices{{
37 {{-0.5f, -0.5f, -0.5f}, {0.0f, 0.0f, 1.0f}, {0.0f, 0.0f}}, // 0
38 {{ 0.5f, -0.5f, -0.5f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, // 1
39 {{ 0.5f, 0.5f, -0.5f}, {0.0f, 0.0f, 1.0f}, {1.0f, 1.0f}}, // 2
40 {{-0.5f, 0.5f, -0.5f}, {0.0f, 0.0f, 1.0f}, {0.0f, 1.0f}}, // 3
41
42 {{-0.5f, -0.5f, 0.5f}, {0.0f, 0.0f, 1.0f}, {0.0f, 0.0f}}, // 4
43 {{ 0.5f, -0.5f, 0.5f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, // 5
44 {{ 0.5f, 0.5f, 0.5f}, {0.0f, 0.0f, 1.0f}, {1.0f, 1.0f}}, // 6
45 {{-0.5f, 0.5f, 0.5f}, {0.0f, 0.0f, 1.0f}, {0.0f, 1.0f}} // 7
46 }};
47
53 static constexpr std::array<unsigned int, 24> indices = {
54 // back face
55 0, 1,
56 1, 2,
57 2, 3,
58 3, 0,
59
60 // front face
61 4, 5,
62 5, 6,
63 6, 7,
64 7, 4,
65
66 // connecting edges
67 0, 4,
68 1, 5,
69 2, 6,
70 3, 7
71 };
72
76 static constexpr PrimitiveType primitiveType = PrimitiveType::Lines;
77
82 static MeshData meshData() {
83 return MeshData{
84 std::span{vertices},
85 std::span{indices},
87 };
88 }
89
94 static helios::math::aabbf boundsData() {
95 return helios::math::aabbf{
96 -0.5f, -0.5f, -0.5f,
97 0.5f, 0.5f, 0.5f
98 };
99 }
100
101 };
102
103}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.