1 #ifndef RAYLIB_CPP_INCLUDE_MESH_HPP_
2 #define RAYLIB_CPP_INCLUDE_MESH_HPP_
7 #include "./raylib.hpp"
8 #include "./raylib-cpp-utils.hpp"
9 #include "./BoundingBox.hpp"
10 #include "./Model.hpp"
18 Mesh(const ::Mesh& mesh) {
22 Mesh(
int VertexCount,
int TriangleCount) {
23 vertexCount = VertexCount;
24 triangleCount = TriangleCount;
39 static ::Mesh
Poly(
int sides,
float radius) {
40 return ::GenMeshPoly(sides, radius);
46 static ::Mesh
Plane(
float width,
float length,
int resX,
int resZ) {
47 return ::GenMeshPlane(width, length, resX, resZ);
53 static ::Mesh
Cube(
float width,
float height,
float length) {
54 return ::GenMeshCube(width, height, length);
60 static ::Mesh
Sphere(
float radius,
int rings,
int slices) {
61 return ::GenMeshSphere(radius, rings, slices);
67 static ::Mesh
HemiSphere(
float radius,
int rings,
int slices) {
68 return ::GenMeshHemiSphere(radius, rings, slices);
74 static ::Mesh
Cylinder(
float radius,
float height,
int slices) {
75 return ::GenMeshCylinder(radius, height, slices);
81 static ::Mesh
Torus(
float radius,
float size,
int radSeg,
int sides) {
82 return ::GenMeshTorus(radius, size, radSeg, sides);
88 static ::Mesh
Knot(
float radius,
float size,
int radSeg,
int sides) {
89 return ::GenMeshKnot(radius, size, radSeg, sides);
96 return ::GenMeshHeightmap(heightmap, size);
103 return ::GenMeshCubicmap(cubicmap, cubeSize);
106 GETTERSETTER(
int, VertexCount, vertexCount)
107 GETTERSETTER(
int, TriangleCount, triangleCount)
108 GETTERSETTER(
float*, Vertices, vertices)
109 GETTERSETTER(
float *, TexCoords, texcoords)
110 GETTERSETTER(
float *, TexCoords2, texcoords2)
111 GETTERSETTER(
float *, Normals, normals)
113 GETTERSETTER(
unsigned char *, Colors, colors)
114 GETTERSETTER(
unsigned short *, Indices, indices)
115 GETTERSETTER(
float *, AnimVertices, animVertices)
116 GETTERSETTER(
float *, AnimNormals, animNormals)
117 GETTERSETTER(
int *, BoneIds, boneIds)
118 GETTERSETTER(
float *, BoneWeights, boneWeights)
119 GETTERSETTER(
unsigned int, VaoId, vaoId)
120 GETTERSETTER(
unsigned int *, VboId, vboId)
122 Mesh& operator=(const ::
Mesh& mesh) {
134 inline void Upload(
bool dynamic =
false) {
135 ::UploadMesh(
this, dynamic);
141 inline void UpdateBuffer(
int index,
void *data,
int dataSize,
int offset = 0) {
142 ::UpdateMeshBuffer(*
this, index, data, dataSize, offset);
145 inline void Draw(const ::Material& material, const ::Matrix& transform) {
146 ::DrawMesh(*
this, material, transform);
149 inline void DrawInstanced(const ::Material& material, ::Matrix* transforms,
int instances) {
150 ::DrawMeshInstanced(*
this, material, transforms, instances);
156 inline bool Export(
const std::string& fileName) {
158 return ExportMesh(*
this, fileName.c_str());
175 return ::MeshBoundingBox(*
this);
189 ::MeshTangents(
this);
197 ::MeshBinormals(
this);
205 return ::LoadModelFromMesh(*
this);
212 return ::LoadModelFromMesh(*
this);
216 inline void set(const ::Mesh& mesh) {
217 vertexCount = mesh.vertexCount;
218 triangleCount = mesh.triangleCount;
219 vertices = mesh.vertices;
220 texcoords = mesh.texcoords;
221 texcoords2 = mesh.texcoords2;
222 normals = mesh.normals;
223 tangents = mesh.tangents;
224 colors = mesh.colors;
225 indices = mesh.indices;
226 animVertices = mesh.animVertices;
227 animNormals = mesh.animNormals;
228 boneIds = mesh.boneIds;
229 boneWeights = mesh.boneWeights;
236 #endif // RAYLIB_CPP_INCLUDE_MESH_HPP_