25 #ifndef RAYLIB_CPP_INCLUDE_MESH_HPP_
26 #define RAYLIB_CPP_INCLUDE_MESH_HPP_
31 #include "./raylib.hpp"
32 #include "./raylib-cpp-utils.hpp"
33 #include "./BoundingBox.hpp"
34 #include "./Model.hpp"
43 Mesh(
int VertexCount = 0,
int TriangleCount = 0) {
44 vertexCount = VertexCount;
45 triangleCount = TriangleCount;
51 static std::vector<Mesh>
Load(
const std::string fileName) {
53 ::Mesh* meshes = LoadMeshes(fileName.c_str(), &count);
54 return std::vector<Mesh>(meshes, meshes + count);
61 return ::GenMeshPoly(sides, radius);
66 static Mesh Plane(
float width,
float length,
int resX,
int resZ) {
67 return ::GenMeshPlane(width, length, resX, resZ);
73 static Mesh Cube(
float width,
float height,
float length) {
74 return ::GenMeshCube(width, height, length);
79 static Mesh Sphere(
float radius,
int rings,
int slices) {
80 return ::GenMeshSphere(radius, rings, slices);
87 return ::GenMeshHemiSphere(radius, rings, slices);
94 return ::GenMeshCylinder(radius, height, slices);
100 static Mesh Torus(
float radius,
float size,
int radSeg,
int sides) {
101 return ::GenMeshTorus(radius, size, radSeg, sides);
107 static Mesh Knot(
float radius,
float size,
int radSeg,
int sides) {
108 return ::GenMeshKnot(radius, size, radSeg, sides);
115 return ::GenMeshHeightmap(heightmap, size);
122 return ::GenMeshCubicmap(cubicmap, cubeSize);
125 GETTERSETTER(
int, VertexCount, vertexCount)
126 GETTERSETTER(
int, TriangleCount, triangleCount)
127 GETTERSETTER(
float*, Vertices, vertices)
128 GETTERSETTER(
float *, TexCoords, texcoords)
129 GETTERSETTER(
float *, TexCoords2, texcoords2)
130 GETTERSETTER(
float *, Normals, normals)
132 GETTERSETTER(
unsigned char *, Colors, colors)
133 GETTERSETTER(
unsigned short *, Indices, indices)
134 GETTERSETTER(
float *, AnimVertices, animVertices)
135 GETTERSETTER(
float *, AnimNormals, animNormals)
136 GETTERSETTER(
int *, BoneIds, boneIds)
137 GETTERSETTER(
float *, BoneWeights, boneWeights)
138 GETTERSETTER(
unsigned int, VaoId, vaoId)
139 GETTERSETTER(
unsigned int *, VboId, vboId)
158 inline bool Export(
const std::string& fileName) {
160 return ExportMesh(*
this, fileName.c_str());
168 return ::MeshBoundingBox(*
this);
179 ::MeshTangents(
this);
187 ::MeshBinormals(
this);
195 ::MeshNormalsSmooth(
this);
203 return ::LoadModelFromMesh(*
this);
210 return ::LoadModelFromMesh(*
this);
215 vertexCount = mesh.vertexCount;
216 triangleCount = mesh.triangleCount;
217 vertices = mesh.vertices;
218 texcoords = mesh.texcoords;
219 texcoords2 = mesh.texcoords2;
220 normals = mesh.normals;
221 tangents = mesh.tangents;
222 colors = mesh.colors;
223 indices = mesh.indices;
224 animVertices = mesh.animVertices;
225 animNormals = mesh.animNormals;
226 boneIds = mesh.boneIds;
227 boneWeights = mesh.boneWeights;
234 #endif // RAYLIB_CPP_INCLUDE_MESH_HPP_