Skip to main content

Cube.ixx File

Basic cube shape for rendering. More...

Included Headers

Namespaces Index

namespacehelios
namespacerendering

Graphics rendering infrastructure. More...

namespaceasset

Rendering asset management. More...

namespaceshape

Geometric shape definitions. More...

namespacebasic

Basic primitive shapes. More...

Classes Index

structCube

Basic Cube Shape. More...

Description

Basic cube shape for rendering.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file Cube.ixx
3 * @brief Basic cube shape for rendering.
4 */
5module;
6
7
8#include <vector>
9
10export module helios.rendering.asset.shape.basic.Cube;
11
12import helios.rendering.asset.shape.Shape;
13
14import helios.rendering.Vertex;
15import helios.rendering.mesh.PrimitiveType;
16
17using namespace helios::rendering;
18
20
21 /**
22 * @brief Basic Cube Shape.
23 */
24 struct Cube : public Shape {
25
26 Cube():
27 Shape(
28 std::vector<Vertex>{
29 // n (z = 1.0)
30 {{-1.0f, -1.0f, 1.0f}, { 0.0f, 0.0f, 1.0f}, {0.0f, 0.0f}}, // Bottom-left
31 {{ 1.0f, -1.0f, 1.0f}, { 0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, // Bottom-right
32 {{ 1.0f, 1.0f, 1.0f}, { 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f}}, // Top-right
33 {{-1.0f, 1.0f, 1.0f}, { 0.0f, 0.0f, 1.0f}, {0.0f, 1.0f}}, // Top-left
34
35 // f (z = -1.0)
36 {{-1.0f, -1.0f, -1.0f}, { 0.0f, 0.0f, -1.0f}, {1.0f, 0.0f}}, // Bottom-left
37 {{ 1.0f, -1.0f, -1.0f}, { 0.0f, 0.0f, -1.0f}, {0.0f, 0.0f}}, // Bottom-right
38 {{ 1.0f, 1.0f, -1.0f}, { 0.0f, 0.0f, -1.0f}, {0.0f, 1.0f}}, // Top-right
39 {{-1.0f, 1.0f, -1.0f}, { 0.0f, 0.0f, -1.0f}, {1.0f, 1.0f}}, // Top-left
40
41 // l (x = -1.0)
42 {{-1.0f, -1.0f, -1.0f}, {-1.0f, 0.0f, 0.0f}, {0.0f, 0.0f}}, // Bottom-left
43 {{-1.0f, -1.0f, 1.0f}, {-1.0f, 0.0f, 0.0f}, {1.0f, 0.0f}}, // Bottom-right
44 {{-1.0f, 1.0f, 1.0f}, {-1.0f, 0.0f, 0.0f}, {1.0f, 1.0f}}, // Top-right
45 {{-1.0f, 1.0f, -1.0f}, {-1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, // Top-left
46
47 // r (x = 1.0)
48 {{ 1.0f, -1.0f, -1.0f}, { 1.0f, 0.0f, 0.0f}, {1.0f, 0.0f}}, // Bottom-left
49 {{ 1.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.0f}, {0.0f, 0.0f}}, // Bottom-right
50 {{ 1.0f, 1.0f, 1.0f}, { 1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, // Top-right
51 {{ 1.0f, 1.0f, -1.0f}, { 1.0f, 0.0f, 0.0f}, {1.0f, 1.0f}}, // Top-left
52
53 // b (y = -1.0)
54 {{-1.0f, -1.0f, -1.0f}, { 0.0f, -1.0f, 0.0f}, {0.0f, 1.0f}}, // Bottom-left
55 {{ 1.0f, -1.0f, -1.0f}, { 0.0f, -1.0f, 0.0f}, {1.0f, 1.0f}}, // Bottom-right
56 {{ 1.0f, -1.0f, 1.0f}, { 0.0f, -1.0f, 0.0f}, {1.0f, 0.0f}}, // Top-right
57 {{-1.0f, -1.0f, 1.0f}, { 0.0f, -1.0f, 0.0f}, {0.0f, 0.0f}}, // Top-left
58
59 // t (y = 1.0)
60 {{-1.0f, 1.0f, -1.0f}, { 0.0f, 1.0f, 0.0f}, {0.0f, 0.0f}}, // Bottom-left
61 {{ 1.0f, 1.0f, -1.0f}, { 0.0f, 1.0f, 0.0f}, {1.0f, 0.0f}}, // Bottom-right
62 {{ 1.0f, 1.0f, 1.0f}, { 0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, // Top-right
63 {{-1.0f, 1.0f, 1.0f}, { 0.0f, 1.0f, 0.0f}, {0.0f, 1.0f}} // Top-left
64 },
65 std::vector<unsigned int>{
66 // n
67 0, 1, 2, 2, 3, 0,
68 // f
69 4, 5, 6, 6, 7, 4,
70 // l
71 8, 9, 10, 10, 11, 8,
72 // r
73 12, 13, 14, 14, 15, 12,
74 // b
75 16, 17, 18, 18, 19, 16,
76 // t
77 20, 21, 22, 22, 23, 20
78 }
79 ) {}
80
81 [[nodiscard]] helios::rendering::mesh::PrimitiveType primitiveType() const noexcept override {
83 }
84 };
85
86}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.