raylib-cpp
C++ object-oriented wrapper library for raylib.
Mesh.hpp
1 #ifndef RAYLIB_CPP_MESH_HPP_
2 #define RAYLIB_CPP_MESH_HPP_
3 
4 #ifdef __cplusplus
5 extern "C"{
6 #endif
7 #include "raylib.h"
8 #ifdef __cplusplus
9 }
10 #endif
11 
12 #include "./raylib-cpp-utils.hpp"
13 
14 #include "./BoundingBox.hpp"
15 #include "./Model.hpp"
16 
17 namespace raylib {
18  class Mesh : public ::Mesh {
19  public:
20  Mesh(::Mesh mesh) {
21  set(mesh);
22  };
23 
24  Mesh(int VertexCount = 0, int TriangleCount = 0) {
25  vertexCount = VertexCount;
26  triangleCount = TriangleCount;
27  };
28 
29  inline void set(::Mesh mesh) {
30  vertexCount = mesh.vertexCount;
31  triangleCount = mesh.triangleCount;
32  vertices = mesh.vertices;
33  texcoords = mesh.texcoords;
34  texcoords2 = mesh.texcoords2;
35  normals = mesh.normals;
36  tangents = mesh.tangents;
37  colors = mesh.colors;
38  indices = mesh.indices;
39  animVertices = mesh.animVertices;
40  animNormals = mesh.animNormals;
41  boneIds = mesh.boneIds;
42  boneWeights = mesh.boneWeights;
43  vaoId = mesh.vaoId;
44  vboId = mesh.vboId;
45  }
46 
47  GETTERSETTER(int,VertexCount,vertexCount)
48  GETTERSETTER(int,TriangleCount,triangleCount)
49 
50  Mesh& operator=(const ::Mesh& mesh) {
51  set(mesh);
52  return *this;
53  }
54 
55  Mesh& operator=(const Mesh& mesh) {
56  set(mesh);
57  return *this;
58  }
59 
60  ~Mesh() {
61  Unload();
62  }
63 
64  inline Mesh& Export(const std::string& fileName) {
65  ExportMesh(*this, fileName.c_str());
66  return *this;
67  }
68 
69  inline void Unload() {
70  ::UnloadMesh(*this);
71  }
72 
74  return ::MeshBoundingBox(*this);
75  }
76  operator raylib::BoundingBox() {
77  return BoundingBox();
78  }
79 
80  inline Mesh& Tangents() {
81  ::MeshTangents(this);
82  return *this;
83  }
84 
85  inline Mesh& Binormals() {
86  ::MeshBinormals(this);
87  return *this;
88  }
89 
90  inline Mesh& NormalsSmooth() {
91  ::MeshNormalsSmooth(this);
92  return *this;
93  }
94 
96  return ::LoadModelFromMesh(*this);
97  }
98  operator raylib::Model() {
99  return LoadModelFrom();
100  }
101  };
102 }
103 
104 #endif
raylib
Provides all the classes associated with raylib-cpp.
Definition: AudioDevice.hpp:14
raylib::Mesh::set
void set(::Mesh mesh)
Definition: Mesh.hpp:29
raylib::Mesh::NormalsSmooth
Mesh & NormalsSmooth()
Definition: Mesh.hpp:90
raylib::Mesh::Tangents
Mesh & Tangents()
Definition: Mesh.hpp:80
raylib::Mesh::~Mesh
~Mesh()
Definition: Mesh.hpp:60
raylib::Mesh::LoadModelFrom
raylib::Model LoadModelFrom()
Definition: Mesh.hpp:95
raylib::Mesh::BoundingBox
raylib::BoundingBox BoundingBox()
Definition: Mesh.hpp:73
raylib::Mesh::Binormals
Mesh & Binormals()
Definition: Mesh.hpp:85
raylib::Mesh::Unload
void Unload()
Definition: Mesh.hpp:69
raylib::Mesh
Definition: Mesh.hpp:18
raylib::Mesh::operator=
Mesh & operator=(const Mesh &mesh)
Definition: Mesh.hpp:55
raylib::Mesh::Mesh
Mesh(int VertexCount=0, int TriangleCount=0)
Definition: Mesh.hpp:24
raylib::Model
Definition: Model.hpp:16
raylib::BoundingBox
Definition: BoundingBox.hpp:15
raylib::Mesh::Mesh
Mesh(::Mesh mesh)
Definition: Mesh.hpp:20
raylib::Mesh::Export
Mesh & Export(const std::string &fileName)
Definition: Mesh.hpp:64