aboutsummaryrefslogtreecommitdiff
path: root/src/fb/chfb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fb/chfb.cpp')
-rw-r--r--src/fb/chfb.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/fb/chfb.cpp b/src/fb/chfb.cpp
index 71259aa..8068d8f 100644
--- a/src/fb/chfb.cpp
+++ b/src/fb/chfb.cpp
@@ -4,9 +4,13 @@
#include "math/vector.h"
#include "math/quat.h"
#include "o3d/vertex_data.h"
+#include "o3d/camera.h"
using namespace engine::fb;
-using engine::math::Vector3, engine::math::Quaternion, engine::o3d::VertexData;
+using
+ engine::math::Vector3,
+ engine::o3d::VertexData,
+ engine::o3d::Camera;
CharacterFrameBuffer::CharacterFrameBuffer(unsigned int w, unsigned int h) {
resize(w, h);
@@ -25,12 +29,12 @@ void CharacterFrameBuffer::clear() {
// taken from https://stackoverflow.com/a/74186686
char brightness_chars[] = " `.-':_,^=;><+!rc*/z?sLTv)J7(|Fi{C}fI31tlu[neoZ5Yxjya]2ESwqkP6h9d4VpOGbUAKXHm8RD#$Bg0MNWQ%&@";
-extern Quaternion camera_quat;
+extern Camera* camera;
void CharacterFrameBuffer::draw_point(int x, int y, const Vector3& loc, const VertexData& vd, const Vector3& normal) {
(void) loc;
(void) vd;
- auto v = normal.rot(camera_quat.conjugate());
+ auto v = normal.rot(camera->transform.rot.conjugate());
float light = .1f + (v.z < 0.f ? 0.f : v.z) * .9f;
std::uint32_t c = (int) (light * static_cast<float>(sizeof(brightness_chars) - 1));
chars_vector[x + y * w] = brightness_chars[c];