diff options
author | vimene <vincent.menegaux@gmail.com> | 2024-12-31 03:40:14 +0100 |
---|---|---|
committer | vimene <vincent.menegaux@gmail.com> | 2024-12-31 03:40:14 +0100 |
commit | cc6fb8c33637566a7b116d46440e6063f016deea (patch) | |
tree | 5cc83f84525507994add57df7dd974e6611d675a /src/fb/chfb.cpp | |
parent | 6b765a85cf81bf4b7162e4c9280dd4054581c611 (diff) | |
download | engine-cc6fb8c33637566a7b116d46440e6063f016deea.tar.gz |
various improvements
- added quaternions and rewrote all rotations to use them
- added transforms to put all object transforms in a single place
- added Wavefront .obj file parser
- removed frame buffer's abstract class
- improved vectors, matrices, triangles, vertices and vertices data by putting all code in header file
- added vector's operations
- changed from NULL to nullptr
- miscellaneous improvements
Diffstat (limited to 'src/fb/chfb.cpp')
-rw-r--r-- | src/fb/chfb.cpp | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/fb/chfb.cpp b/src/fb/chfb.cpp index 029d619..cfd7635 100644 --- a/src/fb/chfb.cpp +++ b/src/fb/chfb.cpp @@ -4,6 +4,7 @@ #include "o3d/vertex_data.h" using namespace engine::fb; +using engine::math::Vector3, engine::o3d::VertexData; CharacterFrameBuffer::CharacterFrameBuffer(unsigned int w, unsigned int h) { resize(w, h); @@ -16,29 +17,15 @@ void CharacterFrameBuffer::resize(unsigned int w, unsigned int h) { clear(); } -unsigned int CharacterFrameBuffer::width() const { - return w; -} - -unsigned int CharacterFrameBuffer::height() const { - return h; -} - -const char* CharacterFrameBuffer::chars() const { - return chars_vector.data(); -} - void CharacterFrameBuffer::clear() { std::fill(chars_vector.begin(), chars_vector.end(), ' '); } -void CharacterFrameBuffer::draw_point(int x, int y, engine::math::Vector3 loc, const engine::o3d::VertexData& vd) { +void CharacterFrameBuffer::draw_point(int x, int y, const Vector3& loc, const VertexData& vd, const engine::math::Vector3& normal) { + (void) x; + (void) y; (void) loc; (void) vd; - chars_vector[x + y * w] = face_char(0); -} - -char CharacterFrameBuffer::face_char(int face_ind) const { - int n = 1 + face_ind / 2; - return (n < 10 ? '0' : 'A' - 10) + n; + (void) normal; + chars_vector[x + y * w] = 'A'; } |