Skip to main content

Triangle.ixx File

Simple triangle mesh asset with positions, normals, UVs, and indices. More...

Included Headers

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

Namespaces Index

namespacehelios
namespaceengine
namespacerendering
namespacemesh
namespaceassets

Classes Index

structTriangle

Static triangle mesh definition. More...

Description

Simple triangle mesh asset with positions, normals, UVs, and 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:Triangle;
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
20
24 struct Triangle {
25
29 static constexpr std::array<Vertex, 3> vertices{{
30 {{-.5f, -.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {0.0f, 0.0f}},
31 {{ .5f, -.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}},
32 {{ 0.0f, .5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {0.5f, 1.0f}}
33 }};
34
38 static constexpr std::array<unsigned int, 3> indices = {
39 0, 1, 2
40 };
41
45 static constexpr PrimitiveType primitiveType = PrimitiveType::Triangles;
46
51 static MeshData meshData() {
52 return MeshData{
53 std::span{vertices},
54 std::span{indices},
56 };
57 }
58
63 static helios::math::aabbf boundsData() {
64 return helios::math::aabbf{
65 -0.5f, -0.5f, 0.0f, 0.5f, 0.5f, 0.0f
66 };
67 }
68
69 };
70
71}
72

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.