1 #ifndef RAYLIB_CPP_INCLUDE_VECTOR3_HPP_
2 #define RAYLIB_CPP_INCLUDE_VECTOR3_HPP_
4 #ifndef RAYLIB_CPP_NO_MATH
8 #include "./raylib.hpp"
9 #include "./raymath.hpp"
10 #include "./raylib-cpp-utils.hpp"
28 set(ColorToHSV(color));
31 GETTERSETTER(
float, X, x)
32 GETTERSETTER(
float, Y, y)
33 GETTERSETTER(
float, Z, z)
40 bool operator==(const ::Vector3& other) {
46 bool operator!=(const ::Vector3& other) {
47 return !(*
this == other);
50 #ifndef RAYLIB_CPP_NO_MATH
51 Vector3 Add(const ::Vector3& vector3) {
52 return Vector3Add(*
this, vector3);
55 Vector3 operator+(const ::Vector3& vector3) {
56 return Vector3Add(*
this, vector3);
59 Vector3 Subtract(const ::Vector3& vector3) {
60 return Vector3Subtract(*
this, vector3);
63 Vector3 operator-(const ::Vector3& vector3) {
64 return Vector3Subtract(*
this, vector3);
68 return Vector3Negate(*
this);
72 return Vector3Negate(*
this);
75 Vector3 Multiply(const ::Vector3& vector3)
const {
76 return Vector3Multiply(*
this, vector3);
79 Vector3 operator*(const ::Vector3& vector3)
const {
80 return Vector3Multiply(*
this, vector3);
83 Vector3 Scale(
const float scale)
const {
84 return Vector3Scale(*
this, scale);
87 Vector3 operator*(
const float scale)
const {
88 return Vector3Scale(*
this, scale);
91 Vector3 Divide(const ::Vector3& vector3)
const {
92 return Vector3Divide(*
this, vector3);
95 Vector3 operator/(const ::Vector3& vector3)
const {
96 return Vector3Divide(*
this, vector3);
99 Vector3 Divide(
const float div)
const {
100 return ::Vector3{x / div, y / div, z / div};
103 Vector3 operator/(
const float div)
const {
107 Vector3& operator+=(const ::Vector3& vector3) {
108 set(Vector3Add(*
this, vector3));
113 Vector3& operator-=(const ::Vector3& vector3) {
114 set(Vector3Subtract(*
this, vector3));
120 Vector3& operator*=(const ::Vector3& vector3) {
121 set(Vector3Multiply(*
this, vector3));
126 Vector3& operator*=(
const float scale) {
127 set(Vector3Scale(*
this, scale));
132 Vector3& operator/=(const ::Vector3& vector3) {
140 Vector3& operator/=(
const float div) {
148 float Length()
const {
149 return Vector3Length(*
this);
152 Vector3 Normalize()
const {
153 return Vector3Normalize(*
this);
156 float DotProduct(const ::Vector3& vector3) {
157 return Vector3DotProduct(*
this, vector3);
160 float Distance(const ::Vector3& vector3)
const {
161 return Vector3Distance(*
this, vector3);
164 Vector3 Lerp(const ::Vector3& vector3,
const float amount)
const {
165 return Vector3Lerp(*
this, vector3, amount);
168 Vector3 CrossProduct(const ::Vector3& vector3)
const {
169 return Vector3CrossProduct(*
this, vector3);
172 Vector3 Perpendicular()
const {
173 return Vector3Perpendicular(*
this);
176 void OrthoNormalize(::Vector3* vector3) {
177 Vector3OrthoNormalize(
this, vector3);
180 Vector3 Transform(const ::Matrix& matrix)
const {
181 return Vector3Transform(*
this, matrix);
184 Vector3 RotateByQuaternion(const ::Quaternion& quaternion) {
185 return Vector3RotateByQuaternion(*
this, quaternion);
188 Vector3 Reflect(const ::Vector3& normal)
const {
189 return Vector3Reflect(*
this, normal);
192 Vector3 Min(const ::Vector3& vector3) {
193 return Vector3Min(*
this, vector3);
196 Vector3 Max(const ::Vector3& vector3) {
197 return Vector3Max(*
this, vector3);
200 Vector3 Barycenter(const ::Vector3& a, const ::Vector3& b, const ::Vector3& c) {
201 return Vector3Barycenter(*
this, a, b, c);
204 static Vector3 Zero() {
205 return Vector3Zero();
208 static Vector3 One() {
213 inline Vector3& DrawLine3D(const ::Vector3& endPos, ::Color color) {
214 ::DrawLine3D(*
this, endPos, color);
218 inline Vector3& DrawPoint3D(::Color color) {
219 ::DrawPoint3D(*
this, color);
223 inline Vector3& DrawCircle3D(
225 const ::Vector3& rotationAxis,
228 ::DrawCircle3D(*
this, radius, rotationAxis, rotationAngle, color);
232 inline Vector3& DrawCube(
float width,
float height,
float length, ::Color color) {
233 ::DrawCube(*
this, width, height, length, color);
237 inline Vector3& DrawCube(const ::Vector3& size, ::Color color) {
238 ::DrawCubeV(*
this, size, color);
242 inline Vector3& DrawCubeWires(
float width,
float height,
float length, ::Color color) {
243 ::DrawCubeWires(*
this, width, height, length, color);
247 inline Vector3& DrawCubeWires(const ::Vector3& size, ::Color color) {
248 ::DrawCubeWiresV(*
this, size, color);
252 inline Vector3& DrawCubeTexture(
253 const ::Texture2D& texture,
258 ::DrawCubeTexture(texture, *
this, width, height, length, color);
262 inline Vector3& DrawSphere(
float radius, ::Color color) {
263 ::DrawSphere(*
this, radius, color);
267 inline Vector3& DrawSphere(
float radius,
int rings,
int slices, ::Color color) {
268 ::DrawSphereEx(*
this, radius, rings, slices, color);
272 inline Vector3& DrawSphereWires(
float radius,
int rings,
int slices, ::Color color) {
273 ::DrawSphereWires(*
this, radius, rings, slices, color);
277 inline Vector3& DrawCylinder(
float radiusTop,
float radiusBottom,
float height,
278 int slices, Color color) {
279 ::DrawCylinder(*
this, radiusTop, radiusBottom, height, slices, color);
283 inline Vector3& DrawCylinderWires(
float radiusTop,
float radiusBottom,
float height,
284 int slices, Color color) {
285 ::DrawCylinderWires(*
this, radiusTop, radiusBottom, height, slices, color);
289 inline Vector3& DrawPlane(const ::Vector2& size, ::Color color) {
290 ::DrawPlane(*
this, size, color);
297 inline bool CheckCollision(
float radius1, const ::Vector3& center2,
float radius2) {
298 return CheckCollisionSpheres(*
this, radius1, center2, radius2);
302 inline void set(const ::Vector3& vec) {
310 #endif // RAYLIB_CPP_INCLUDE_VECTOR3_HPP_