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"
26 set(ColorToHSV(color));
29 GETTERSETTER(
float, X, x)
30 GETTERSETTER(
float, Y, y)
31 GETTERSETTER(
float, Z, z)
38 bool operator==(const ::Vector3& other) {
44 bool operator!=(const ::Vector3& other) {
45 return !(*
this == other);
48 #ifndef RAYLIB_CPP_NO_MATH
53 return Vector3Add(*
this, vector3);
60 return Vector3Add(*
this, vector3);
63 Vector3& operator+=(const ::Vector3& vector3) {
64 set(Vector3Add(*
this, vector3));
73 return Vector3Subtract(*
this, vector3);
80 return Vector3Subtract(*
this, vector3);
83 Vector3& operator-=(const ::Vector3& vector3) {
84 set(Vector3Subtract(*
this, vector3));
93 return Vector3Negate(*
this);
100 return Vector3Negate(*
this);
107 return Vector3Multiply(*
this, vector3);
114 return Vector3Multiply(*
this, vector3);
121 set(Vector3Multiply(*
this, vector3));
130 return Vector3Scale(*
this, scaler);
137 return Vector3Scale(*
this, scaler);
144 set(Vector3Scale(*
this, scaler));
153 return Vector3Divide(*
this, vector3);
160 return Vector3Divide(*
this, vector3);
178 return ::Vector3{x / div, y / div, z / div};
203 return Vector3Length(*
this);
206 inline Vector3 Normalize()
const {
207 return Vector3Normalize(*
this);
210 inline float DotProduct(const ::Vector3& vector3) {
211 return Vector3DotProduct(*
this, vector3);
214 inline float Distance(const ::Vector3& vector3)
const {
215 return Vector3Distance(*
this, vector3);
218 inline Vector3 Lerp(const ::Vector3& vector3,
const float amount)
const {
219 return Vector3Lerp(*
this, vector3, amount);
222 inline Vector3 CrossProduct(const ::Vector3& vector3)
const {
223 return Vector3CrossProduct(*
this, vector3);
226 inline Vector3 Perpendicular()
const {
227 return Vector3Perpendicular(*
this);
230 inline void OrthoNormalize(::Vector3* vector3) {
231 Vector3OrthoNormalize(
this, vector3);
234 inline Vector3 Transform(const ::Matrix& matrix)
const {
235 return Vector3Transform(*
this, matrix);
238 inline Vector3 RotateByQuaternion(const ::Quaternion& quaternion) {
239 return Vector3RotateByQuaternion(*
this, quaternion);
242 inline Vector3 Reflect(const ::Vector3& normal)
const {
243 return Vector3Reflect(*
this, normal);
246 inline Vector3 Min(const ::Vector3& vector3) {
247 return Vector3Min(*
this, vector3);
250 inline Vector3 Max(const ::Vector3& vector3) {
251 return Vector3Max(*
this, vector3);
254 inline Vector3 Barycenter(const ::Vector3& a, const ::Vector3& b, const ::Vector3& c) {
255 return Vector3Barycenter(*
this, a, b, c);
258 static inline Vector3 Zero() {
259 return Vector3Zero();
262 static inline Vector3 One() {
267 inline void DrawLine3D(const ::Vector3& endPos, ::Color color)
const {
268 ::DrawLine3D(*
this, endPos, color);
271 inline void DrawPoint3D(::Color color)
const {
272 ::DrawPoint3D(*
this, color);
275 inline void DrawCircle3D(
277 const ::Vector3& rotationAxis,
280 ::DrawCircle3D(*
this, radius, rotationAxis, rotationAngle, color);
283 inline void DrawCube(
float width,
float height,
float length, ::Color color)
const {
284 ::DrawCube(*
this, width, height, length, color);
287 inline void DrawCube(const ::Vector3& size, ::Color color)
const {
288 ::DrawCubeV(*
this, size, color);
291 inline void DrawCubeWires(
float width,
float height,
float length, ::Color color)
const {
292 ::DrawCubeWires(*
this, width, height, length, color);
295 inline void DrawCubeWires(const ::Vector3& size, ::Color color)
const {
296 ::DrawCubeWiresV(*
this, size, color);
299 inline void DrawCubeTexture(
300 const ::Texture2D& texture,
304 ::Color color)
const {
305 ::DrawCubeTexture(texture, *
this, width, height, length, color);
308 inline void DrawSphere(
float radius, ::Color color)
const {
309 ::DrawSphere(*
this, radius, color);
312 inline void DrawSphere(
float radius,
int rings,
int slices, ::Color color)
const {
313 ::DrawSphereEx(*
this, radius, rings, slices, color);
316 inline void DrawSphereWires(
float radius,
int rings,
int slices, ::Color color)
const {
317 ::DrawSphereWires(*
this, radius, rings, slices, color);
320 inline void DrawCylinder(
float radiusTop,
float radiusBottom,
float height,
321 int slices, ::Color color)
const {
322 ::DrawCylinder(*
this, radiusTop, radiusBottom, height, slices, color);
325 inline void DrawCylinderWires(
float radiusTop,
float radiusBottom,
float height,
326 int slices, ::Color color)
const {
327 ::DrawCylinderWires(*
this, radiusTop, radiusBottom, height, slices, color);
330 inline void DrawPlane(const ::Vector2& size, ::Color color)
const {
331 ::DrawPlane(*
this, size, color);
337 inline bool CheckCollision(
float radius1, const ::Vector3& center2,
float radius2) {
338 return CheckCollisionSpheres(*
this, radius1, center2, radius2);
342 void set(const ::Vector3& vec) {
Vector3 operator/(const ::Vector3 &vector3) const
Divide vector by vector.
Vector3 operator*(const ::Vector3 &vector3) const
Multiply vector by vector.
Vector3 & operator/=(const ::Vector3 &vector3)
Divide vector by vector.
Vector3 & operator*=(const ::Vector3 &vector3)
Multiply vector by vector.
Vector3 operator/(const float div) const
Divide a vector by a value.
Vector3 operator+(const ::Vector3 &vector3)
Add two vectors.
Vector3 Negate()
Negate provided vector (invert direction)
Vector3 Add(const ::Vector3 &vector3)
Add two vectors.
bool CheckCollision(float radius1, const ::Vector3 ¢er2, float radius2)
Detect collision between two spheres.
Vector3 Scale(const float scaler) const
Multiply vector by scalar.
Vector3 operator-(const ::Vector3 &vector3)
Subtract two vectors.
float Length() const
Calculate vector length.
Vector3 Divide(const ::Vector3 &vector3) const
Divide vector by vector.
Vector3 operator-()
Negate provided vector (invert direction)
Vector3 Divide(const float div) const
Divide a vector by a value.
Vector3 & operator/=(const float div)
Divide a vector by a value.
Vector3 & operator*=(const float scaler)
Multiply vector by scalar.
Vector3 Multiply(const ::Vector3 &vector3) const
Multiply vector by vector.
Vector3 Subtract(const ::Vector3 &vector3)
Subtract two vectors.
Vector3 operator*(const float scaler) const
Multiply vector by scalar.
All raylib-cpp classes and functions appear in the raylib namespace.