17 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3,
32 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3,
35 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3,
42 struct ConeCylinderBuilder {
43 Uint32 currentVertices()
const {
return Uint32(positions.size()); }
45 void addFace(
const Uint32 (&face)[3]);
46 Float3 previousPos(std::size_t offset)
const;
47 Float3 previousNormal(std::size_t offset)
const;
50 void addBottomDisk(Uint32 segments,
float radius,
float z);
52 void addTopDisk(Uint32 segments,
float radius,
float z);
53 void addCone(Uint32 segments,
float radius,
float zBottom,
float length);
54 void addCylinderFloors(Uint32 numFloors, Uint32 segments,
Float2 basePoint,
55 Float2 upDir, Uint32 startIdx);
56 void addHemisphereVertices(Uint32 count, Uint32 segments,
float zCenter,
57 Radf ringStart,
float ringIncrement,
60 std::vector<Float3> positions;
61 std::vector<Float3> normals;
62 std::vector<MeshData::IndexType> indices;
65 inline void ConeCylinderBuilder::add(
const Float3 &pos,
67 positions.push_back(pos);
68 normals.push_back(normal.normalized());
71 inline void ConeCylinderBuilder::addFace(
const Uint32 (&face)[3]) {
72 indices.push_back(face[0]);
73 indices.push_back(face[1]);
74 indices.push_back(face[2]);
77 inline Float3 ConeCylinderBuilder::previousPos(std::size_t offset)
const {
78 return positions[positions.size() - offset];
81 inline Float3 ConeCylinderBuilder::previousNormal(std::size_t offset)
const {
82 return normals[normals.size() - offset];
This class defines the layout of a mesh's vertices.
Definition MeshLayout.h:98
constexpr MeshLayout & addAttribute(VertexAttrib loc, Uint32 binding, SDL_GPUVertexElementFormat format, Uint32 offset)
Add a vertex attribute.
Definition MeshLayout.h:123
MeshLayout & addBinding(Uint32 slot, Uint32 pitch)
Add a binding (i.e. a vertex binding) for the mesh.
Definition MeshLayout.h:111
Rad< float > Radf
Definition math_types.h:125
Eigen::Vector3f Float3
Definition math_types.h:8
@ Position
Definition MeshLayout.h:81
@ Normal
Definition MeshLayout.h:82
Eigen::Matrix< float, 3, 1, Eigen::DontAlign > GpuVec3
Definition math_types.h:18
Eigen::Vector2f Float2
Definition math_types.h:7
GpuVec3 normal
Definition Internal.h:24
GpuVec3 pos
Definition Internal.h:23
GpuVec3 pos
Definition Internal.h:9
static auto layout()
Definition Internal.h:28
static auto layout()
Definition Internal.h:13
Definition MeshLayout.h:208