WireframeSphere.ixx File
Simple wireframe sphere mesh asset with positions, normals, UVs, and line indices. More...
Included Headers
#include <array>
#include <span>
#include <cmath>
#include <numbers>
#include <cstddef>
#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
| namespace | helios |
| namespace | engine |
| namespace | rendering |
| namespace | mesh |
| namespace | assets |
Classes Index
| struct | WireframeSphere |
|
Static wireframe sphere mesh definition. More... | |
Description
Simple wireframe sphere mesh asset with positions, normals, UVs, and line indices.
File Listing
The file content with the documentation metadata removed is:
20using namespace helios::engine::rendering::common::types;
21using namespace helios::engine::rendering::mesh::types;
23export namespace helios::engine::rendering::mesh::assets {
31 struct WireframeSphere {
38 static constexpr std::size_t VertexCount =
41 static constexpr std::size_t HorizontalEdgeCount =
44 static constexpr std::size_t VerticalEdgeCount =
47 static constexpr std::size_t IndexCount =
48 2 * (HorizontalEdgeCount + VerticalEdgeCount);
54 const std::size_t slice
60 std::array<Vertex, VertexCount> result{};
62 constexpr float pi = std::numbers::pi_v<float>;
64 for (std::size_t stack = 0; stack <= Stacks; ++stack) {
69 const float ringRadius = std::sin(theta) * Radius;
75 const float x = std::cos(phi) * ringRadius;
76 const float z = std::sin(phi) * ringRadius;
90 return result;
94 std::array<unsigned int, IndexCount> result{};
95 std::size_t cursor = 0;
98 for (std::size_t stack = 1; stack < Stacks; ++stack) {
110 for (std::size_t stack = 0; stack < Stacks; ++stack) {
119 return result;
137 static constexpr PrimitiveType primitiveType = PrimitiveType::Lines;
144 return MeshData{
145 std::span{vertices},
146 std::span{indices},
147 primitiveType
155 static helios::math::aabbf boundsData() {
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.