Skip to main content

Shape.ixx File

Interface for simple geometric shapes used for testing and debugging. More...

Included Headers

#include <memory> #include <vector> #include <helios.rendering.mesh.PrimitiveType> #include <helios.rendering.Vertex>

Namespaces Index

namespacehelios
namespacerendering

Graphics rendering infrastructure. More...

namespaceasset

Rendering asset management. More...

namespaceshape

Geometric shape definitions. More...

Classes Index

structShape

Struct representing geometric primitives and indices for various shapes. provides immutable, shared access to vertices and indices of the represented geometric shape. More...

Description

Interface for simple geometric shapes used for testing and debugging.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file Shape.ixx
3 * @brief Interface for simple geometric shapes used for testing and debugging.
4 */
5module;
6
7#include <memory>
8#include <vector>
9
10export module helios.rendering.asset.shape.Shape;
11
12import helios.rendering.Vertex;
13import helios.rendering.mesh.PrimitiveType;
14
15using namespace helios::rendering;
16
17export namespace helios::rendering::asset::shape {
18
19 /**
20 * @brief Struct representing geometric primitives and indices for various shapes.
21 * provides immutable, shared access to vertices and indices of the
22 * represented geometric shape.
23 */
24 struct Shape {
25
26 virtual ~Shape() = default;
27
28 /**
29 * @brief Shared pointer to an immutable vector of vertices for this shape.
30 */
31 std::shared_ptr<const std::vector<Vertex>> vertices = {};
32
33 /**
34 * @brief Shared pointer to an immutable vector of indices for this shape.
35 */
36 std::shared_ptr<const std::vector<unsigned int>> indices = {};
37
38 /**
39 * @brief Creates a new shape from the given vertices and indices.
40 * The data is copied into immutable shared vectors.
41 *
42 * @param vertices A vector of vertices representing the shape's geometry
43 * @param indices A vector of unsigned integers representing the shape's indices.
44 */
45 Shape(std::vector<Vertex> vertices, std::vector<unsigned int> indices) :
46 vertices(std::make_shared<const std::vector<Vertex>>(std::move(vertices))),
47 indices(std::make_shared<const std::vector<unsigned int>>(std::move(indices)))
48 {}
49
50 /**
51 * @brief Returns the intended PrimitiveType for this Shape.
52 *
53 * This method returns the intended PrimitiveType for the Shape represented by this instance.
54 * This information can be used to properly set up the MeshConfig wrapping this Shape.
55 *
56 * @return The intended PrimitiveType of this Shape.
57 */
58 [[nodiscard]] virtual helios::rendering::mesh::PrimitiveType primitiveType() const noexcept = 0;
59 };
60
61}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.