raylib-cpp
C++ object-oriented wrapper library for raylib.
Loading...
Searching...
No Matches
Mesh.hpp
1#ifndef RAYLIB_CPP_INCLUDE_MESH_HPP_
2#define RAYLIB_CPP_INCLUDE_MESH_HPP_
3
4#include <string>
5#include <string_view>
6#include <vector>
7
8#include "./raylib.hpp"
9#include "./raylib-cpp-utils.hpp"
10#include "./BoundingBox.hpp"
11#include "./MeshUnmanaged.hpp"
12#include "./Vector3.hpp"
13// #include "./Model.hpp"
14
15namespace raylib {
23class Mesh : public MeshUnmanaged {
24 public:
26
30 Mesh(const Mesh&) = delete;
31
35 Mesh& operator=(const Mesh&) = delete;
36
40 Mesh(Mesh&& other) {
41 set(other);
42
43 other.vertexCount = 0;
44 other.triangleCount = 0;
45 other.vertices = nullptr;
46 other.texcoords = nullptr;
47 other.texcoords2 = nullptr;
48 other.normals = nullptr;
49 other.tangents = nullptr;
50 other.colors = nullptr;
51 other.indices = nullptr;
52 other.animVertices = nullptr;
53 other.animNormals = nullptr;
54 other.boneIds = nullptr;
55 other.boneWeights = nullptr;
56 other.vaoId = 0;
57 other.vboId = nullptr;
58 }
59
60 Mesh& operator=(Mesh&& other) noexcept {
61 if (this == &other) {
62 return *this;
63 }
64
65 Unload();
66 set(other);
67
68 other.vertexCount = 0;
69 other.triangleCount = 0;
70 other.vertices = nullptr;
71 other.texcoords = nullptr;
72 other.texcoords2 = nullptr;
73 other.normals = nullptr;
74 other.tangents = nullptr;
75 other.colors = nullptr;
76 other.indices = nullptr;
77 other.animVertices = nullptr;
78 other.animNormals = nullptr;
79 other.boneIds = nullptr;
80 other.boneWeights = nullptr;
81 other.vaoId = 0;
82 other.vboId = nullptr;
83
84 return *this;
85 }
86
87 ~Mesh() {
88 Unload();
89 }
90};
91} // namespace raylib
92
93using RMesh = raylib::Mesh;
94
95#endif // RAYLIB_CPP_INCLUDE_MESH_HPP_
Vertex data defining a mesh.
Definition: Mesh.hpp:23
Mesh(const Mesh &)=delete
Explicitly forbid the copy constructor.
Mesh & operator=(const Mesh &)=delete
Explicitly forbid copy assignment.
Mesh(Mesh &&other)
Move constructor.
Definition: Mesh.hpp:40
Vertex data defining a mesh, not managed by C++ RAII.
MeshUnmanaged()
Default texture constructor.
void Unload()
Unload mesh from memory (RAM and/or VRAM)