Cogs.Core
ShapeType.h
1#pragma once
2
3#include "Base.h"
4
5#include "Foundation/Geometry/Glm.hpp"
6#include "Foundation/StringView.h"
7#include "Foundation/Reflection/Name.h"
8
9#include <glm/vec3.hpp>
10
11namespace Cogs
12{
13 namespace Core
14 {
18 enum struct ShapeType : uint32_t
19 {
21 None = 0,
22
24 Plane,
25
27 Sphere,
38
47
50
52 Cone,
53
55 Cube,
56
57 WireCube,
58
61
64
67 };
68
69
74 {
76 int refinement = 1;
77 glm::vec3 size = glm::vec3(1, 1, 1);
78 float arcStart = 0.0f; // Start angle of arc in radians. (0 = along x-axis)
79 float arcEnd = 0.0f;
80 };
81
82 constexpr size_t hash(const ShapeDefinition& definition, size_t hashValue = Cogs::hash()) {
83 hashValue = Cogs::hash(definition.type, hashValue);
84 hashValue = Cogs::hash(definition.refinement, hashValue);
85 hashValue = Cogs::hash(definition.size, hashValue);
86 hashValue = Cogs::hash(definition.arcStart, hashValue);
87 hashValue = Cogs::hash(definition.arcEnd, hashValue);
88
89 return hashValue;
90 }
91 }
92}
93
94template<> inline
95Cogs::StringView getName<Cogs::Core::ShapeType>()
96{
97 return "ShapeType";
98}
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
@ Cube
Clip the outside of a cube,.
ShapeType
Shape types generated by mesh generator.
Definition: ShapeType.h:19
@ CubeTex2D
Cube shape with unit square texture coordinates over each face.
@ CircularArc
Flat circular arc with inner (size.x) and outer (size.y) radius on the XY plane. Can be extended (arc...
@ Plane
Plane shape.
@ Cylinder
Generic cylinder shape.
@ SphereGeoTexCyl
Sphere shape with geodesic tessellation and cylindrical texture coordinates.
@ SphereGeoTexSph
Sphere shape with geodesic tessellation and spherical texture coordinates.
@ Sphere
Generic sphere shape.
@ Cone
Generic cone shape.
@ CoordSys
Simple coordinate system where X axis is red, Y axis is green and Z axis is blue.
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
constexpr size_t hash() noexcept
Simple getter function that returns the initial value for fnv1a hashing.
Definition: HashFunctions.h:62
Defines creation values for a unique shape.
Definition: ShapeType.h:74