aboutsummaryrefslogtreecommitdiff
path: root/src/o3d
diff options
context:
space:
mode:
authorvimene <vincent.menegaux@gmail.com>2023-12-03 09:27:32 +0100
committervimene <vincent.menegaux@gmail.com>2023-12-03 09:27:32 +0100
commit48ec7df0fd27fab05c9918e83a3a7da1cc32d7a0 (patch)
tree259ec6e395e44b0af117adc9605203f8affb4b0f /src/o3d
parent5a8bc0a4936cdd461c43740437541f8c991ff117 (diff)
downloadengine-48ec7df0fd27fab05c9918e83a3a7da1cc32d7a0.tar.gz
renamed MathVector{2,3,4} to Vector{2,3,4} and Mat4 to Matrix4 in engine::math
Diffstat (limited to 'src/o3d')
-rw-r--r--src/o3d/camera.cpp4
-rw-r--r--src/o3d/camera.h6
-rw-r--r--src/o3d/mesh.cpp18
-rw-r--r--src/o3d/obj3d.cpp4
-rw-r--r--src/o3d/obj3d.h6
-rw-r--r--src/o3d/tri_vertex.cpp14
-rw-r--r--src/o3d/vertex.cpp6
-rw-r--r--src/o3d/vertex.h10
8 files changed, 34 insertions, 34 deletions
diff --git a/src/o3d/camera.cpp b/src/o3d/camera.cpp
index 9ad2ac7..cbb3cd2 100644
--- a/src/o3d/camera.cpp
+++ b/src/o3d/camera.cpp
@@ -1,7 +1,7 @@
#include "o3d/camera.h"
-#include "math/math_vector.h"
+#include "math/vector.h"
using namespace engine::o3d;
-Camera::Camera(engine::math::MathVector3 loc, float rot_x, float rot_y, float rot_z) : loc{loc}, rot_x{rot_x}, rot_y{rot_y}, rot_z{rot_z} {
+Camera::Camera(engine::math::Vector3 loc, float rot_x, float rot_y, float rot_z) : loc{loc}, rot_x{rot_x}, rot_y{rot_y}, rot_z{rot_z} {
}
diff --git a/src/o3d/camera.h b/src/o3d/camera.h
index 1039f86..5d72d29 100644
--- a/src/o3d/camera.h
+++ b/src/o3d/camera.h
@@ -1,7 +1,7 @@
#ifndef O3D_CAMERA_H
#define O3D_CAMERA_H
-#include "math/math_vector.h"
+#include "math/vector.h"
namespace engine::o3d {
@@ -10,10 +10,10 @@ class Scene;
class Camera {
public:
Scene* scene = nullptr;
- engine::math::MathVector3 loc;
+ engine::math::Vector3 loc;
float rot_x, rot_y, rot_z; // TODO: replace by quaternions
- Camera(engine::math::MathVector3 loc, float rot_x, float rot_y, float rot_z);
+ Camera(engine::math::Vector3 loc, float rot_x, float rot_y, float rot_z);
};
}
diff --git a/src/o3d/mesh.cpp b/src/o3d/mesh.cpp
index 7da77aa..47a1ea2 100644
--- a/src/o3d/mesh.cpp
+++ b/src/o3d/mesh.cpp
@@ -1,7 +1,7 @@
#include "o3d/mesh.h"
#include <vector>
#include <array>
-#include "math/math_vector.h"
+#include "math/vector.h"
#include "o3d/vertex.h"
using namespace engine::o3d;
@@ -9,14 +9,14 @@ using namespace engine::o3d;
Mesh Mesh::cube() {
return {
{
- { engine::math::MathVector3(-1.f, -1.f, -1.f), {} },
- { engine::math::MathVector3(+1.f, -1.f, -1.f), {} },
- { engine::math::MathVector3(-1.f, +1.f, -1.f), {} },
- { engine::math::MathVector3(+1.f, +1.f, -1.f), {} },
- { engine::math::MathVector3(-1.f, -1.f, +1.f), {} },
- { engine::math::MathVector3(+1.f, -1.f, +1.f), {} },
- { engine::math::MathVector3(-1.f, +1.f, +1.f), {} },
- { engine::math::MathVector3(+1.f, +1.f, +1.f), {} },
+ { engine::math::Vector3(-1.f, -1.f, -1.f), {} },
+ { engine::math::Vector3(+1.f, -1.f, -1.f), {} },
+ { engine::math::Vector3(-1.f, +1.f, -1.f), {} },
+ { engine::math::Vector3(+1.f, +1.f, -1.f), {} },
+ { engine::math::Vector3(-1.f, -1.f, +1.f), {} },
+ { engine::math::Vector3(+1.f, -1.f, +1.f), {} },
+ { engine::math::Vector3(-1.f, +1.f, +1.f), {} },
+ { engine::math::Vector3(+1.f, +1.f, +1.f), {} },
},
{
{ 0, 2, 3 }, { 0, 3, 1 }, // face 1
diff --git a/src/o3d/obj3d.cpp b/src/o3d/obj3d.cpp
index 047bf3e..71fdf7d 100644
--- a/src/o3d/obj3d.cpp
+++ b/src/o3d/obj3d.cpp
@@ -1,9 +1,9 @@
#include "o3d/obj3d.h"
-#include "math/math_vector.h"
+#include "math/vector.h"
#include "o3d/mesh.h"
using namespace engine::o3d;
-Object3D::Object3D(Mesh mesh, engine::math::MathVector3 loc, float scale, float rot_x, float rot_y, float rot_z)
+Object3D::Object3D(Mesh mesh, engine::math::Vector3 loc, float scale, float rot_x, float rot_y, float rot_z)
: mesh{mesh}, loc{loc}, scale{scale}, rot_x{rot_x}, rot_y{rot_y}, rot_z{rot_z} {
}
diff --git a/src/o3d/obj3d.h b/src/o3d/obj3d.h
index 3a931b1..250b6bc 100644
--- a/src/o3d/obj3d.h
+++ b/src/o3d/obj3d.h
@@ -1,7 +1,7 @@
#ifndef O3D_OBJ3D_H
#define O3D_OBJ3D_H
-#include "math/math_vector.h"
+#include "math/vector.h"
#include "o3d/mesh.h"
namespace engine::o3d {
@@ -12,11 +12,11 @@ class Object3D {
public:
Scene* scene = nullptr;
Mesh mesh;
- engine::math::MathVector3 loc;
+ engine::math::Vector3 loc;
float scale;
float rot_x, rot_y, rot_z;
- Object3D(Mesh mesh, engine::math::MathVector3 loc, float scale, float rot_x, float rot_y, float rot_z);
+ Object3D(Mesh mesh, engine::math::Vector3 loc, float scale, float rot_x, float rot_y, float rot_z);
};
}
diff --git a/src/o3d/tri_vertex.cpp b/src/o3d/tri_vertex.cpp
index 07185f6..bda219a 100644
--- a/src/o3d/tri_vertex.cpp
+++ b/src/o3d/tri_vertex.cpp
@@ -1,6 +1,6 @@
#include "o3d/tri_vertex.h"
#include <vector>
-#include "math/math_vector.h"
+#include "math/vector.h"
#include "o3d/vertex_data.h"
#include "o3d/vertex.h"
#include "o3d/tri_vertex.h"
@@ -48,7 +48,7 @@ static void _crop_x(std::vector<TriangleVertex3>& tris, TriangleVertex3 t, int n
q3 = &t.vertex1;
break;
}
- engine::math::MathVector3 dq2 = q1->point - q2->point;
+ engine::math::Vector3 dq2 = q1->point - q2->point;
float fac2 = (x - q2->point.x) / dq2.x;
Vertex3 r2{
{
@@ -58,7 +58,7 @@ static void _crop_x(std::vector<TriangleVertex3>& tris, TriangleVertex3 t, int n
},
VertexData::lerp(q2->data, q1->data, fac2)
};
- engine::math::MathVector3 dq3 = q1->point - q3->point;
+ engine::math::Vector3 dq3 = q1->point - q3->point;
float fac3 = (x - q3->point.x) / dq3.x;
Vertex3 r3{
{
@@ -133,7 +133,7 @@ static void _crop_y(std::vector<TriangleVertex3>& tris, TriangleVertex3 t, int n
q3 = &t.vertex1;
break;
}
- engine::math::MathVector3 dq2 = q1->point - q2->point;
+ engine::math::Vector3 dq2 = q1->point - q2->point;
float fac2 = (y - q2->point.y) / dq2.y;
Vertex3 r2{
{
@@ -143,7 +143,7 @@ static void _crop_y(std::vector<TriangleVertex3>& tris, TriangleVertex3 t, int n
},
VertexData::lerp(q2->data, q1->data, fac2)
};
- engine::math::MathVector3 dq3 = q1->point - q3->point;
+ engine::math::Vector3 dq3 = q1->point - q3->point;
float fac3 = (y - q3->point.y) / dq3.y;
Vertex3 r3{
{
@@ -247,7 +247,7 @@ static void _crop_z(std::vector<TriangleVertex4>& tris, TriangleVertex4 t, int n
q3 = &t.vertex1;
break;
}
- engine::math::MathVector4 dq2 = q1->point - q2->point;
+ engine::math::Vector4 dq2 = q1->point - q2->point;
float fac2 = (z - q2->point.z) / dq2.z;
Vertex4 r2{
{
@@ -258,7 +258,7 @@ static void _crop_z(std::vector<TriangleVertex4>& tris, TriangleVertex4 t, int n
},
VertexData::lerp(q2->data, q1->data, fac2)
};
- engine::math::MathVector4 dq3 = q1->point - q3->point;
+ engine::math::Vector4 dq3 = q1->point - q3->point;
float fac3 = (z - q3->point.z) / dq3.z;
Vertex4 r3{
{
diff --git a/src/o3d/vertex.cpp b/src/o3d/vertex.cpp
index 4da6aa4..641eef4 100644
--- a/src/o3d/vertex.cpp
+++ b/src/o3d/vertex.cpp
@@ -1,13 +1,13 @@
#include "o3d/vertex.h"
-#include "math/math_vector.h"
+#include "math/vector.h"
#include "o3d/vertex_data.h"
using namespace engine::o3d;
-Vertex3::Vertex3(engine::math::MathVector3 point, VertexData data) : point{point}, data{data} {
+Vertex3::Vertex3(engine::math::Vector3 point, VertexData data) : point{point}, data{data} {
}
-Vertex4::Vertex4(engine::math::MathVector4 point, VertexData data) : point{point}, data{data} {
+Vertex4::Vertex4(engine::math::Vector4 point, VertexData data) : point{point}, data{data} {
}
Vertex4::Vertex4(Vertex3 vertex) : point{vertex.point}, data{vertex.data} {
diff --git a/src/o3d/vertex.h b/src/o3d/vertex.h
index 66d073d..022fdf7 100644
--- a/src/o3d/vertex.h
+++ b/src/o3d/vertex.h
@@ -1,25 +1,25 @@
#ifndef O3D_VERTEX_H
#define O3D_VERTEX_H
-#include "math/math_vector.h"
+#include "math/vector.h"
#include "o3d/vertex_data.h"
namespace engine::o3d {
class Vertex3 {
public:
- engine::math::MathVector3 point;
+ engine::math::Vector3 point;
VertexData data;
- Vertex3(engine::math::MathVector3 point, VertexData data);
+ Vertex3(engine::math::Vector3 point, VertexData data);
};
class Vertex4 {
public:
- engine::math::MathVector4 point;
+ engine::math::Vector4 point;
VertexData data;
- Vertex4(engine::math::MathVector4 point, VertexData data);
+ Vertex4(engine::math::Vector4 point, VertexData data);
Vertex4(Vertex3 vertex);
Vertex3 div_by_w() const;
};