"${CMAKE_CURRENT_SOURCE_DIR}/src/3d_renderer.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/src/constants.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/src/3d/obj.cc"
- "${CMAKE_CURRENT_SOURCE_DIR}/src/3d/v3.cc"
- "${CMAKE_CURRENT_SOURCE_DIR}/src/3d/v3_conv.cc"
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/3d/a3f.cc"
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/3d/a3f_conv.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/src/3d/qm.cc"
)
"${CMAKE_CURRENT_SOURCE_DIR}/src/basic_renderer.h"
"${CMAKE_CURRENT_SOURCE_DIR}/src/3d_renderer.h"
"${CMAKE_CURRENT_SOURCE_DIR}/src/3d/obj.h"
- "${CMAKE_CURRENT_SOURCE_DIR}/src/3d/v3.h"
- "${CMAKE_CURRENT_SOURCE_DIR}/src/3d/v3_conv.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/3d/a3f.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/3d/a3f_conv.h"
"${CMAKE_CURRENT_SOURCE_DIR}/src/3d/qm.h"
)
--- /dev/null
+#include "a3f.h"
+
+A3F operator+(const A3F &a, const A3F &b) {
+ return A3F{a[0] + b[0], a[1] + b[1], a[2] + b[2]};
+}
+
+A3F operator-(const A3F &a, const A3F &b) {
+ return A3F{a[0] - b[0], a[1] - b[1], a[2] - b[2]};
+}
+
+A3F operator*(const A3F &v, float s) {
+ return A3F{v[0] * s, v[1] * s, v[2] * s};
+}
+
+A3F operator/(const A3F &v, float s) {
+ return A3F{v[0] / s, v[1] / s, v[2] / s};
+}
+
+float A3F_F::dotp(const A3F &a, const A3F &b) {
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
+}
+
+A3F A3F_F::crossp(const A3F &a, const A3F &b) {
+ return A3F{a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2],
+ a[0] * b[1] - a[1] * b[0]};
+}
--- /dev/null
+#ifndef ROCK_PAPER_SCISSORS_3D_ARRAY3F_H_
+#define ROCK_PAPER_SCISSORS_3D_ARRAY3F_H_
+
+#include <array>
+
+using A3F = std::array<float, 3>;
+
+A3F operator+(const A3F &a, const A3F &b);
+A3F operator-(const A3F &a, const A3F &b);
+
+A3F operator*(const A3F &v, float s);
+A3F operator/(const A3F &v, float s);
+
+using A3C = std::array<unsigned char, 3>;
+using A4C = std::array<unsigned char, 4>;
+
+namespace A3F_F {
+extern float dotp(const A3F &a, const A3F &b);
+extern A3F crossp(const A3F &a, const A3F &b);
+} // namespace A3F_F
+
+#endif
--- /dev/null
+#include "a3f_conv.h"
+
+Vector3 A3FToRV3(const A3F &v) { return Vector3{v[0], v[1], v[2]}; }
+
+A3F RV3ToA3F(const Vector3 &v) { return A3F{v.x, v.y, v.z}; }
+
+Color A4CToC(const A4C &v) { return Color{v[0], v[1], v[2], v[3]}; }
+
+A4C CToA4C(const Color &c) { return A4C{c.r, c.g, c.b, c.a}; }
--- /dev/null
+#ifndef ROCK_PAPER_SCISSORS_3D_A3F_CONV_H_
+#define ROCK_PAPER_SCISSORS_3D_A3F_CONV_H_
+
+#include "a3f.h"
+
+// third party includes
+#include <raylib.h>
+
+extern Vector3 A3FToRV3(const A3F &v);
+extern A3F RV3ToA3F(const Vector3 &v);
+
+extern Color A4CToC(const A4C &v);
+extern A4C CToA4C(const Color &c);
+
+#endif
}
}
-const V3 &Object3D::get_pos() const { return pos; }
+const A3F &Object3D::get_pos() const { return pos; }
-void Object3D::set_pos(const V3 &pos) { this->pos = pos; }
+void Object3D::set_pos(const A3F &pos) { this->pos = pos; }
-void Object3D::set_pos(V3 &&pos) { this->pos = std::forward<V3>(pos); }
+void Object3D::set_pos(A3F &&pos) { this->pos = std::forward<A3F>(pos); }
void Object3D::set_pos_x(float x) { pos[0] = x; }
void Object3D::set_pos_z(float z) { pos[2] = z; }
-const VC4 &Object3D::get_color() const { return color; }
+const A4C &Object3D::get_color() const { return color; }
-void Object3D::set_color(const VC4 &color) { this->color = color; }
+void Object3D::set_color(const A4C &color) { this->color = color; }
-void Object3D::set_color(VC4 &&color) {
- this->color = std::forward<VC4>(color);
+void Object3D::set_color(A4C &&color) {
+ this->color = std::forward<A4C>(color);
}
void Object3D::set_color_r(unsigned char r) { color[0] = r; }
#include <optional>
// local includes
-#include "v3.h"
+#include "a3f.h"
// forward declarations
struct Model;
void set_model(Model *model);
- const V3 &get_pos() const;
- void set_pos(const V3 &pos);
- void set_pos(V3 &&pos);
+ const A3F &get_pos() const;
+ void set_pos(const A3F &pos);
+ void set_pos(A3F &&pos);
void set_pos_x(float x);
void set_pos_y(float y);
void set_pos_z(float z);
- const VC4 &get_color() const;
- void set_color(const VC4 &color);
- void set_color(VC4 &&color);
+ const A4C &get_color() const;
+ void set_color(const A4C &color);
+ void set_color(A4C &&color);
void set_color_r(unsigned char r);
void set_color_g(unsigned char g);
void set_color_b(unsigned char b);
void set_color_a(unsigned char a);
protected:
- V3 pos;
- VC4 color;
+ A3F pos;
+ A4C color;
std::optional<Model *> model;
};
// local includes
#include "../constants.h"
-#include "v3_conv.h"
+#include "a3f_conv.h"
QuestionMark::QuestionMark()
: Object3D()
}
Vector3 unit{1.0F, 1.0F, 1.0F};
- Vector3 vec3pos = V3ToRV3(pos);
+ Vector3 vec3pos = A3FToRV3(pos);
float angle = angle_timer / angle_timer_max * 2.0F - 1.0F;
angle = angle >= 0.0F ? (std::cos(PI_F * angle) * QM_MAX_ANGLE_OFFSET)
: (std::cos(PI_F * (-angle)) * QM_MAX_ANGLE_OFFSET);
: ((std::cos(PI_F * (-offset)) + 1.0F) / 2.0F * QM_MAX_Y_OFFSET);
vec3pos.y += offset;
DrawModelEx(*model.value(), vec3pos, {0.0F, 1.0F, 0.0F}, angle, unit,
- VC4ToC(color));
+ A4CToC(color));
}
void QuestionMark::randomize_timer_values() {
+++ /dev/null
-#include "v3.h"
-
-V3 operator+(const V3 &a, const V3 &b) {
- return V3{a[0] + b[0], a[1] + b[1], a[2] + b[2]};
-}
-
-V3 operator-(const V3 &a, const V3 &b) {
- return V3{a[0] - b[0], a[1] - b[1], a[2] - b[2]};
-}
-
-V3 operator*(const V3 &v, float s) { return V3{v[0] * s, v[1] * s, v[2] * s}; }
-
-V3 operator/(const V3 &v, float s) { return V3{v[0] / s, v[1] / s, v[2] / s}; }
-
-float V3F::dotp(const V3 &a, const V3 &b) {
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
-}
-
-V3 V3F::crossp(const V3 &a, const V3 &b) {
- return V3{a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2],
- a[0] * b[1] - a[1] * b[0]};
-}
+++ /dev/null
-#ifndef ROCK_PAPER_SCISSORS_3D_V3_H_
-#define ROCK_PAPER_SCISSORS_3D_V3_H_
-
-#include <array>
-
-using V3 = std::array<float, 3>;
-
-V3 operator+(const V3 &a, const V3 &b);
-V3 operator-(const V3 &a, const V3 &b);
-
-V3 operator*(const V3 &v, float s);
-V3 operator/(const V3 &v, float s);
-
-using VC3 = std::array<unsigned char, 3>;
-using VC4 = std::array<unsigned char, 4>;
-
-namespace V3F {
-extern float dotp(const V3 &a, const V3 &b);
-extern V3 crossp(const V3 &a, const V3 &b);
-} // namespace V3F
-
-#endif
+++ /dev/null
-#include "v3_conv.h"
-
-Vector3 V3ToRV3(const V3 &v) { return Vector3{v[0], v[1], v[2]}; }
-
-V3 RV3ToV3(const Vector3 &v) { return V3{v.x, v.y, v.z}; }
-
-Color VC4ToC(const VC4 &v) { return Color{v[0], v[1], v[2], v[3]}; }
-
-VC4 CToVC4(const Color &c) { return VC4{c.r, c.g, c.b, c.a}; }
+++ /dev/null
-#ifndef ROCK_PAPER_SCISSORS_3D_V3_CONF_H_
-#define ROCK_PAPER_SCISSORS_3D_V3_CONF_H_
-
-#include "v3.h"
-
-// third party includes
-#include <raylib.h>
-
-extern Vector3 V3ToRV3(const V3 &v);
-extern V3 RV3ToV3(const Vector3 &v);
-
-extern Color VC4ToC(const VC4 &v);
-extern VC4 CToVC4(const Color &c);
-
-#endif
../src/3d_renderer.cc \
../src/constants.cc \
../src/3d/obj.cc \
- ../src/3d/v3.cc \
- ../src/3d/v3_conv.cc \
+ ../src/3d/a3f.cc \
+ ../src/3d/a3f_conv.cc \
../src/3d/qm.cc
HEADERS = \
../src/game_renderer.h \
../src/3d_renderer.h \
../src/3d/obj.h \
- ../src/3d/v3.h \
- ../src/3d/v3_conv.h \
+ ../src/3d/a3f.h \
+ ../src/3d/a3f_conv.h \
../src/3d/qm.h
CXX = source ${HOME}/git/emsdk/emsdk_env.sh && em++