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);
60 static ::Mesh
Poly(
int sides,
float radius) {
61 return ::GenMeshPoly(sides, radius);
67 static ::Mesh
Plane(
float width,
float length,
int resX,
int resZ) {
68 return ::GenMeshPlane(width, length, resX, resZ);
74 static ::Mesh
Cube(
float width,
float height,
float length) {
75 return ::GenMeshCube(width, height, length);
81 static ::Mesh
Sphere(
float radius,
int rings,
int slices) {
82 return ::GenMeshSphere(radius, rings, slices);
88 static ::Mesh
HemiSphere(
float radius,
int rings,
int slices) {
89 return ::GenMeshHemiSphere(radius, rings, slices);
95 static ::Mesh
Cylinder(
float radius,
float height,
int slices) {
96 return ::GenMeshCylinder(radius, height, slices);
102 static ::Mesh
Torus(
float radius,
float size,
int radSeg,
int sides) {
103 return ::GenMeshTorus(radius, size, radSeg, sides);
109 static ::Mesh
Knot(
float radius,
float size,
int radSeg,
int sides) {
110 return ::GenMeshKnot(radius, size, radSeg, sides);
117 return ::GenMeshHeightmap(heightmap, size);
124 return ::GenMeshCubicmap(cubicmap, cubeSize);
127 GETTERSETTER(
int, VertexCount, vertexCount)
128 GETTERSETTER(
int, TriangleCount, triangleCount)
129 GETTERSETTER(
float*, Vertices, vertices)
130 GETTERSETTER(
float *, TexCoords, texcoords)
131 GETTERSETTER(
float *, TexCoords2, texcoords2)
132 GETTERSETTER(
float *, Normals, normals)
134 GETTERSETTER(
unsigned char *, Colors, colors)
135 GETTERSETTER(
unsigned short *, Indices, indices)
136 GETTERSETTER(
float *, AnimVertices, animVertices)
137 GETTERSETTER(
float *, AnimNormals, animNormals)
138 GETTERSETTER(
int *, BoneIds, boneIds)
139 GETTERSETTER(
float *, BoneWeights, boneWeights)
140 GETTERSETTER(
unsigned int, VaoId, vaoId)
141 GETTERSETTER(
unsigned int *, VboId, vboId)
155 inline bool Export(
const std::string& fileName) {
157 return ExportMesh(*
this, fileName.c_str());
171 return ::MeshBoundingBox(*
this);
185 ::MeshTangents(
this);
193 ::MeshBinormals(
this);
201 ::MeshNormalsSmooth(
this);
209 return ::LoadModelFromMesh(*
this);
216 return ::LoadModelFromMesh(*
this);
220 inline void set(const ::Mesh& mesh) {
221 vertexCount = mesh.vertexCount;
222 triangleCount = mesh.triangleCount;
223 vertices = mesh.vertices;
224 texcoords = mesh.texcoords;
225 texcoords2 = mesh.texcoords2;
226 normals = mesh.normals;
227 tangents = mesh.tangents;
228 colors = mesh.colors;
229 indices = mesh.indices;
230 animVertices = mesh.animVertices;
231 animNormals = mesh.animNormals;
232 boneIds = mesh.boneIds;
233 boneWeights = mesh.boneWeights;
240 #endif // RAYLIB_CPP_INCLUDE_MESH_HPP_