From 74b95163c7ef22ade437fb70ad41c1cfaad63091 Mon Sep 17 00:00:00 2001 From: Amy Retzerau Date: Fri, 3 Apr 2026 12:39:03 +0200 Subject: [PATCH] refactor: removed cpp code --- fastmath.hpp | 411 ----------------------------------------------- main.cpp | 156 ------------------ model.hpp | 16 -- polygon.hpp | 134 --------------- renderer.hpp | 136 ---------------- rendertarget.hpp | 45 ------ testModel.hpp | 2 - 7 files changed, 900 deletions(-) delete mode 100644 fastmath.hpp delete mode 100644 main.cpp delete mode 100644 model.hpp delete mode 100644 polygon.hpp delete mode 100644 renderer.hpp delete mode 100644 rendertarget.hpp delete mode 100644 testModel.hpp diff --git a/fastmath.hpp b/fastmath.hpp deleted file mode 100644 index 1bec42c..0000000 --- a/fastmath.hpp +++ /dev/null @@ -1,411 +0,0 @@ -#ifndef FASTMATH_H -#define FASTMATH_H - -#include -#include -#include -#include -#include -#define SHIFT_AMOUNT 16 -#define HALF_SHIFT (SHIFT_AMOUNT / 2) - -#define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) -#define TO_FLOAT(x) \ - (((float)(x >> SHIFT_AMOUNT)) + \ - ((double)(x & SHIFT_MASK) / (1 << SHIFT_AMOUNT))) -#define TO_INT(x) ((int32_t)(x * (1 << SHIFT_AMOUNT))) -#define MUL_F(a, b) (((a) >> HALF_SHIFT) * ((b) >> HALF_SHIFT)) -#define DIV_F(a, b) ((((a) << HALF_SHIFT) / (b)) << HALF_SHIFT) - -struct decimal { - - int32_t i; - constexpr decimal() = default; - // constexpr decimal() : i(0) {} - constexpr decimal(float i) : i(TO_INT(i)) {} - constexpr decimal(double i) : i(TO_INT(i)) {} - constexpr decimal(int32_t i) : i(i) {} - - inline friend std::ostream &operator<<(std::ostream &os, const decimal &d) { - return (os << TO_FLOAT(d.i)); - } - - inline friend decimal operator+(const decimal &d1, const decimal &d2) { - return {d1.i + d2.i}; - } - inline decimal &operator+=(const decimal &d) { return (*this) = {i + d.i}; } - - inline friend decimal operator-(const decimal &d1, const decimal &d2) { - return {d1.i - d2.i}; - } - inline friend decimal operator-(const decimal &d) { return {-d.i}; } - - inline friend decimal operator*(const decimal &d1, const decimal &d2) { - return {MUL_F(d1.i, d2.i)}; - } - - inline decimal &operator*=(const decimal &d) { - return (*this) = {MUL_F(i, d.i)}; - } - - inline friend decimal operator/(const decimal &d1, const decimal &d2) { - return {DIV_F(d1.i, d2.i)}; - } - - inline friend bool operator<(const decimal &d1, const decimal &d2) { - return d1.i < d2.i; - } - - inline friend bool operator>(const decimal &d1, const decimal &d2) { - return d1.i > d2.i; - } - inline friend bool operator<=(const decimal &d1, const decimal &d2) { - return d1.i <= d2.i; - } - inline friend bool operator>=(const decimal &d1, const decimal &d2) { - return d1.i >= d2.i; - } - - inline friend bool operator==(const decimal &d1, const decimal &d2) { - return d1.i == d2.i; - } - inline friend bool operator!=(const decimal &d1, const decimal &d2) { - return d1.i != d2.i; - } - - inline decimal sqrt() { return {((int32_t)sqrtf(i)) << HALF_SHIFT}; } - - inline float to_float() { return TO_FLOAT(i); } - inline bool isSmall() { return (abs(i) < (1 << (HALF_SHIFT - 1))); } -}; - -template struct vec { - - decimal v[n]; - - constexpr vec() noexcept = default; - - template - constexpr vec(Args... args) noexcept : v{static_cast(args)...} { - static_assert(sizeof...(Args) == n, "Wrong number of elements for vec"); - } - - friend Dev operator+(const vec &v1, const vec &v2) { - Dev newV = {}; - - for (int i = 0; i < n; i++) { - newV.v[i] = v1.v[i] + v2.v[i]; - } - return newV; - } - friend Dev operator+=(const vec &v1, const vec &v2) { - Dev newV = {}; - - for (int i = 0; i < n; i++) { - newV.v[i] = v1.v[i] + v2.v[i]; - } - return newV; - } - - friend Dev operator-(const vec &v1, const vec &v2) { - Dev newV = {}; - - for (int i = 0; i < n; i++) { - newV.v[i] = v1.v[i] - v2.v[i]; - } - return newV; - } - - friend std::ostream &operator<<(std::ostream &os, const vec &v) { - os << "(" << v.v[0]; - for (int i = 1; i < n; i++) { - os << ", " << v.v[i]; - } - return (os << ")" << std::endl); - } - - Dev operator-() { - Dev newV = {}; - for (int i = 0; i < n; i++) { - newV.v[i] = -v[i]; - } - return newV; - } - - friend Dev operator*(const vec &v, const decimal &d) { - int32_t f = d.i >> HALF_SHIFT; - - Dev newV = {}; - for (int i = 0; i < n; i++) { - newV.v[i] = (v.v[i].i >> HALF_SHIFT) * f; - } - return newV; - } - static Dev max(const vec &v1, const vec &v2) { - Dev newV = {}; - for (int i = 0; i < n; i++) { - newV.v[i] = std::max(v1.v[i], v2.v[i]); - } - return newV; - } - static Dev min(const vec &v1, const vec &v2) { - Dev newV = {}; - for (int i = 0; i < n; i++) { - newV.v[i] = std::min(v1.v[i], v2.v[i]); - } - return newV; - } - - friend Dev operator*(const decimal &d, const vec &v) { - return v * d; - } - - friend decimal operator*(const vec &v1, const vec &v2) { - decimal res = decimal(0.0f); - for (int i = 0; i < n; i++) { - res += v1.v[i] * v2.v[i]; - } - return res; - } - - friend bool operator==(const vec &v1, const vec &v2) { - bool res = true; - for (int i = 0; i < n; i++) { - res &= v1.v[i] == v2.v[i]; - } - return res; - } - bool isSmall() { - for (int i = 0; i < n; i++) { - if (!v[i].isSmall()) - return false; - } - return true; - } - decimal &operator[](const int &i) { return v[i]; } - - decimal len_sq() { return *this * *this; } - - decimal len() { return this->len_sq().sqrt(); } - - Dev normalize() { - decimal f = decimal(1.0) / this->len(); - return (*this * f); - } - - constexpr static Dev zero() { - Dev newV = {}; - for (int i = 0; i < n; i++) { - newV[i] = decimal(0); - } - return newV; - } -}; -struct vec2 : public vec<2, vec2> { - - vec2(float x, float y) : vec<2, vec2>(decimal(x), decimal(y)) {} - - vec2(double x, double y) : vec<2, vec2>(decimal(x), decimal(y)) {} - - vec2(int32_t x, int32_t y) : vec<2, vec2>(decimal(x), decimal(y)) {} - - vec2(decimal x, decimal y) : vec<2, vec2>(x, y) {} - - decimal &x() { return v[0]; } - decimal &y() { return v[1]; } -}; -struct vec3 : public vec<3, vec3> { - - constexpr vec3() : vec<3, vec3>() {} - - constexpr vec3(float x, float y, float z) - : vec<3, vec3>(decimal(x), decimal(y), decimal(z)) {} - - constexpr vec3(double x, double y, double z) - : vec<3, vec3>(decimal(x), decimal(y), decimal(z)) {} - - constexpr vec3(int32_t x, int32_t y, int32_t z) - : vec<3, vec3>(decimal(x), decimal(y), decimal(z)) {} - - constexpr vec3(decimal x, decimal y, decimal z) : vec<3, vec3>(x, y, z) {} - - inline decimal &x() { return v[0]; } - inline decimal &y() { return v[1]; } - inline decimal &z() { return v[2]; } - - inline vec3 cross(vec3 &v) { - return vec3((y() * v.z()) - (z() * v.y()), - (z() * v.x()) - (x() * v.z()), - (x() * v.y()) - (y() * v.x())); - } -}; -struct vec4 : public vec<4, vec4> { - - constexpr vec4() : vec<4, vec4>() {} - - vec4(float x, float y, float z, float w) - : vec<4, vec4>(decimal(x), decimal(y), decimal(z), decimal(w)) {} - - vec4(double x, double y, double z, double w) - : vec<4, vec4>(decimal(x), decimal(y), decimal(z), decimal(w)) {} - - vec4(int32_t x, int32_t y, int32_t z, int32_t w) - : vec<4, vec4>(decimal(x), decimal(y), decimal(z), decimal(w)) {} - - vec4(vec3 v, decimal w) : vec<4, vec4>(v.x(), v.y(), v.z(), w) {} - - decimal &x() { return v[0]; } - decimal &y() { return v[1]; } - decimal &z() { return v[2]; } - decimal &w() { return v[3]; } -}; - -template struct mat { - decimal m[n * n]; - - static const int size = n; - friend Dev operator+(const mat &m1, const mat &m2) { - Dev newM = {}; - - for (int i = 0; i < n * n; i++) { - newM.v[i] = m1.m[i] + m2.m[i]; - } - return newM; - } - friend Dev operator+=(const mat &m1, const mat &m2) { - Dev newM = {}; - - for (int i = 0; i < n * n; i++) { - newM.m[i] = m1.m[i] + m2.m[i]; - } - return newM; - } - - friend Dev operator-(const mat &m1, const mat &m2) { - Dev newM = {}; - - for (int i = 0; i < n * n; i++) { - newM.m[i] = m1.m[i] - m2.m[i]; - } - return newM; - } - - friend std::ostream &operator<<(std::ostream &os, const mat &m) { - for (int i = 0; i < n; i++) { - os << "|" << m.m[i * n]; - for (int j = 1; j < n; j++) { - os << ", " << m.m[i * n + j]; - } - os << "|" << "\n"; - } - return (os << std::endl); - } - - template - friend Dev1 operator*(const mat &mat, const vec &v) { - Dev1 newV = vec::zero(); - for (int i = 0; i < n; i++) { - for (int j = 0; j < n; j++) { - newV[i] += mat.m[i * n + j] * v.v[j]; - } - } - return newV; - } - - decimal &operator[](const int &i) { return m[i]; } - - friend Dev operator*(const mat &m1, const mat &m2) { - Dev newM = mat::zero(); - for (int i = 0; i < n; i++) { - for (int j = 0; j < n; j++) { - for (int k = 0; k < n; k++) { - newM[i * n + j] += m1.m[i * n + k] * m2.m[k * n + j]; - } - } - } - return newM; - } - - constexpr static Dev identity() { - Dev newM = {}; - for (int i = 0; i < n; i++) { - for (int j = 0; j < n; j++) { - if (i == j) - newM.m[i * n + i] = decimal(1.0f); - else - newM.m[i * n + j] = decimal(0.0f); - } - } - return newM; - } - constexpr static Dev zero() { - Dev newM = {}; - for (int i = 0; i < n * n; i++) { - newM[i] = decimal(0); - } - return newM; - } - - inline void set(int x, int y, decimal v) { m[y * n + x] = v; } - inline decimal get(int x, int y) { return m[y * n + x]; } - - friend bool operator==(const mat &m1, const mat &m2) { - bool res = true; - for (int i = 0; i < n * n; i++) { - res &= m1.m[i] == m2.m[i]; - } - return res; - } - bool isSmall() { - for (int i = 0; i < n; i++) { - if (!m[i].isSmall()) - return false; - } - return true; - } - - template Dev1 cutTo() const { - static_assert(Dev1::size < n, "Can only convert to smaller matrix"); - Dev1 newM = mat::zero(); - for (int i = 0; i < Dev1::size; i++) { - for (int j = 0; j < Dev1::size; j++) { - newM.m[Dev1::size * i + j] = m[n * i + j]; - } - } - return newM; - } -}; - -template struct matN : public mat> {}; - -struct mat3 : public mat<3, mat3> {}; - -struct mat4 : public mat<4, mat4> { - static mat4 translation(const vec3 &v) { - mat4 newM = mat4::identity(); - for (int i = 0; i < 3; i++) { - newM[4 * i + 3] = v.v[i]; - } - return newM; - } - static mat4 rotateOnX(float a) { - mat4 newM = mat4::identity(); - newM.m[1 * 4 + 1] = cos(a), newM.m[2 * 4 + 2] = cos(a); - newM.m[1 * 4 + 2] = -sin(a), newM.m[2 * 4 + 1] = sin(a); - return newM; - } - static mat4 rotateOnY(float a) { - mat4 newM = mat4::identity(); - newM.m[0 * 4 + 0] = cos(a), newM.m[2 * 4 + 2] = cos(a); - newM.m[0 * 4 + 2] = sin(a), newM.m[2 * 4 + 0] = -sin(a); - return newM; - } - static mat4 rotateOnZ(float a) { - mat4 newM = mat4::identity(); - newM.m[0 * 4 + 0] = cos(a), newM.m[1 * 4 + 1] = cos(a); - newM.m[1 * 4 + 0] = sin(a), newM.m[0 * 4 + 1] = -sin(a); - return newM; - } -}; - -#endif diff --git a/main.cpp b/main.cpp deleted file mode 100644 index bf83600..0000000 --- a/main.cpp +++ /dev/null @@ -1,156 +0,0 @@ -#include "fastmath.hpp" -#include "polygon.hpp" -#include "renderer.hpp" -#include "rendertarget.hpp" -#include "testModel.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define HIGHT 64 -#define WIDTH 64 - -#define FAA_FAC 2 -#define RHIGHT ((int)(HIGHT * FAA_FAC)) -#define RWIDTH ((int)(WIDTH * FAA_FAC)) - -char *drawToString(unsigned short *img) { - char *textImg = (char *)malloc(200000 * sizeof(char)); - // strcat(textImg,"\e[1;1H\e[2J"); --clear - for (int y = 0; y < HIGHT; y++) { - for (int x = 0; x < WIDTH; x++) { - // printf("%d,%d\n",x,y); - char buff[20]; - unsigned short val = 0; - int my = y * FAA_FAC; - int mx = x * FAA_FAC; - val += img[my * RWIDTH + mx]; - val += img[my * RWIDTH + mx + 1]; - val += img[(my + 1) * RWIDTH + mx]; - val += img[(my + 1) * RWIDTH + mx + 1]; - sprintf(buff, "\033[38;5;%dm██\033[0m", 232 + val / 4); - strcat(textImg, buff); - } - strcat(textImg, "\n"); - } - return textImg; -} - -void drawImage(unsigned short *img) { - decimal heightPerPix = decimal(1.0) / decimal((float)(HIGHT * FAA_FAC)); - decimal widthPerPix = decimal(1.0) / decimal((float)(WIDTH * FAA_FAC)); - - polygon poly = polygon(vec3(0.9, 0.9, 0.0) * decimal(128.0), - vec3(0.5, 0.1, 0.0) * decimal(128.0), - vec3(0.1, 0.9, 0.0) * decimal(128.0)); - - // printf("\n hpp: %f, wpp: %f - // \n",TO_FLOAT(heightPerPix),TO_FLOAT(widthPerPix)); calcViewPos(t); - for (decimal y = 0; y < decimal((float)(RHIGHT)); y += decimal(1.0)) { - for (decimal x = 0; x < decimal((float)(RWIDTH)); x += decimal(1.0)) { - - vec3 p = vec3(x, y, 0.0); - - if (poly.contains(p)) { - - img[(y.i >> SHIFT_AMOUNT) * RWIDTH + (x.i >> SHIFT_AMOUNT)] = - (unsigned short)23; // (((-normal[1]+(1 << - // SHIFT_AMOUNT))*14)>>SHIFT_AMOUNT); - } - } - } - printf("done writing %d \n", *(img + sizeof(unsigned short) * 32 * 32)); -} - -int main(int argc, char *argv[]) { - Rendertarget target(128, 128); - Renderer renderer; - renderer.target = ⌖ - - polygon poly = - polygon(vec3(0.9, 0.9, 1.0), vec3(0.5, 0.1, 1.0), vec3(0.1, 0.9, 1.0)); - - std::chrono::steady_clock::time_point begin = - std::chrono::steady_clock::now(); - renderer.render(&testModel, mat4::translation(vec3(0.0f, -1.0f, 5.0f)) * - mat4::rotateOnY(-1.5707963267948966f)); - std::chrono::steady_clock::time_point end = - std::chrono::steady_clock::now(); - - std::cout << "Time difference = " - << std::chrono::duration_cast(end - - begin) - .count() - << "[ms]" << std::endl; - - uint8_t *pixel = new uint8_t[64 * 64 * 3]; - /*for (int i = 0; i < 64 * 64 * 3; i++) { - pixel[i] = target.pixels[i].i >> SHIFT_AMOUNT; - }*/ - std::function addTo = [&target](int start, - uint32_t *arr) { - for (int c = 0; c < 3; c++) { - arr[c] += target.pixels[start + c]; - } - }; - - QApplication a(argc, argv); - QWidget widget; - widget.setAutoFillBackground(true); - widget.setGeometry(0, 0, 500, 500); - QLabel display(&widget); - QImage img((unsigned char *)pixel, 64, 64, QImage::Format_RGB888); - - // display.setPixmap(QPixmap::fromImage(img).scaled(widget.size())); - - float rot = 0.f; - std::function renderLoop = [&addTo, &target, &pixel, &renderer, - &display, &widget, &img, &rot]() { - std::chrono::steady_clock::time_point begin = - std::chrono::steady_clock::now(); - renderer.render(&testModel, mat4::translation(vec3(0.0f, -1.0f, 5.0f)) * - mat4::rotateOnY(rot)); - std::chrono::steady_clock::time_point end = - std::chrono::steady_clock::now(); - - std::cout << "Time difference = " - << std::chrono::duration_cast( - end - begin) - .count() - << "[ms]" << std::endl; - - for (int x = 0; x < 64; x++) { - for (int y = 0; y < 64; y++) { - uint32_t result[3] = {}; - addTo((target.width * y * 2 + x * 2) * 3, result); - addTo((target.width * (y * 2 + 1) + x * 2) * 3, result); - addTo((target.width * y * 2 + (x * 2 + 1)) * 3, result); - addTo((target.width * (y * 2 + 1) + (x * 2 + 1)) * 3, result); - for (int c = 0; c < 3; c++) { - pixel[(WIDTH * (WIDTH - y - 1) + WIDTH - x - 1) * 3 + c] = - result[c] >> 2; - } - } - } - // QImage img((unsigned char *)pixel, 64, 64, QImage::Format_RGB888); - display.setPixmap(QPixmap::fromImage(img).scaled(widget.size() * 1)); - rot += 0.1f; - }; - renderLoop(); - widget.show(); - QTimer timer; - timer.setInterval(20); - timer.start(); - QObject::connect(&timer, &QTimer::timeout, &widget, renderLoop); - return a.exec(); -} diff --git a/model.hpp b/model.hpp deleted file mode 100644 index 9508f0d..0000000 --- a/model.hpp +++ /dev/null @@ -1,16 +0,0 @@ - -#ifndef MODEL_H -#define MODEL_H - -#include "fastmath.hpp" -#include -#include -struct model { - std::vector verts; - // At 0 vertecie index, at 1 normal index - std::vector> faces; - std::vector normals; - std::vector colors; -}; - -#endif diff --git a/polygon.hpp b/polygon.hpp deleted file mode 100644 index c246133..0000000 --- a/polygon.hpp +++ /dev/null @@ -1,134 +0,0 @@ -#ifndef POLYGON_H -#define POLYGON_H - -#include "fastmath.hpp" -#include -struct polygon { - - vec3 points[3]; - decimal delta[9]; - bool small = false; - decimal baryFactor; - - decimal bounding[4]; // min x, max x, min y, max y - vec3 normals[3]; - vec3 colors[3]; - vec3 barycentrics; - vec3 boundingBarycentrics; - - polygon(const vec3 &v1, const vec3 &v2, const vec3 &v3) - : points{v1, v2, v3}, delta{} {} - polygon() : points{}, delta{} {} - - void calcDelta() { - - for (int i = 0; i < 3; i++) { - int n = (i + 1) % 3; - - delta[i * 3] = points[i].y() - points[n].y(); - delta[i * 3 + 1] = points[n].x() - points[i].x(); - delta[i * 3 + 2] = - points[i].x() * points[n].y() - points[i].y() * points[n].x(); - if (delta[i * 3].i == 0 && delta[i * 3 + 1].i == 0) - small = true; - } - bounding[0] = points[0].x(); - bounding[1] = points[0].x(); - bounding[2] = points[0].y(); - bounding[3] = points[0].y(); - for (int i = 1; i < 3; i++) { - if (bounding[0] > points[i].x()) - bounding[0] = points[i].x(); - if (bounding[1] < points[i].x()) - bounding[1] = points[i].x(); - if (bounding[2] > points[i].y()) - bounding[2] = points[i].y(); - if (bounding[3] < points[i].y()) - bounding[3] = points[i].y(); - } - - baryFactor = - (points[1].x() - points[0].x()) * (points[2].y() - points[1].y()) - - (points[1].y() - points[0].y()) * (points[2].x() - points[1].x()); - - if (baryFactor.isSmall()) { - small = true; - } else - baryFactor = decimal(1.0) / baryFactor; - // std::cout << baryFactor << std::endl; - /*if ((bounding[1].i - bounding[0].i < 1 << HALF_SHIFT) && - (bounding[3].i - bounding[2].i < 1 << HALF_SHIFT)) - small = true;*/ - } - - vec3 avgNormal() { - vec3 result; - for (int i = 0; i < 3; i++) { - result += normals[i]; - } - return result * decimal(0.3333); - } - - const bool depContains(const vec3 &p) { - // if (skip) - // return false; - for (int i = 0; i < 3; i++) { - if (small) - return true; - vec3 d = p; - if ((d.x() * delta[i * 3] + d.y() * delta[i * 3 + 1] + - delta[i * 3 + 2]) > decimal(0.2)) - return false; - } - return true; - } - const bool contains(const vec3 &p) { - if (small) - return true; - else - return (barycentrics[0] >= decimal(-0.01)) && - (barycentrics[1] >= decimal(-0.01)) && - (barycentrics[2] >= decimal(-0.01)); - } - friend std::ostream &operator<<(std::ostream &os, const polygon &p) { - for (int i = 0; i < 3; i++) { - os << p.points[i]; - } - return os; - } - - vec3 calcNormal() { - return normals[0] * boundingBarycentrics[0] + - normals[1] * boundingBarycentrics[1] + - normals[2] * boundingBarycentrics[2]; - } - - vec3 calcColor() { - return colors[0] * boundingBarycentrics[0] + - colors[1] * boundingBarycentrics[1] + - colors[2] * boundingBarycentrics[2]; - } - - decimal calcDepth() { - return points[0].z() * boundingBarycentrics[0] + - points[1].z() * boundingBarycentrics[1] + - points[2].z() * boundingBarycentrics[2]; - } - - void calcBarycentric(vec3 s) { - // if (small) - // return vec3(decimal(0.333), decimal(0.333), decimal(0.333)); - - barycentrics[0] = (points[1].x() - s.x()) * (points[2].y() - s.y()) - - (points[2].x() - s.x()) * (points[1].y() - s.y()); - barycentrics[1] = (points[2].x() - s.x()) * (points[0].y() - s.y()) - - (points[0].x() - s.x()) * (points[2].y() - s.y()); - barycentrics = barycentrics * baryFactor; - barycentrics[2] = decimal(1.0) - barycentrics[1] - barycentrics[0]; - // return result; - boundingBarycentrics = vec3::max( - vec3::min(barycentrics, vec3(1.0, 1.0, 1.0)), vec3(0.0, 0.0, 0.0)); - } -}; - -#endif diff --git a/renderer.hpp b/renderer.hpp deleted file mode 100644 index b43003e..0000000 --- a/renderer.hpp +++ /dev/null @@ -1,136 +0,0 @@ - -#ifndef RENDERER_H -#define RENDERER_H - -#include "fastmath.hpp" -#include "model.hpp" -#include "polygon.hpp" -#include "rendertarget.hpp" -#include -#include -#include - -#define SCREEN_SPACE_SIZE 8.0 - -class Renderer { - - public: - Rendertarget *target; - - bool clearTarget = true; - vec3 sunDir = vec3(1.0, -1.0, 1.0).normalize(); - - void toScreenSpace(vec3 *np, mat4 matrix) { - vec4 tp = (matrix * vec4(*np, decimal(1.0f))); - tp.x() = tp.x() / tp.z() * decimal(2.0) * decimal(SCREEN_SPACE_SIZE) + - decimal(SCREEN_SPACE_SIZE); - tp.y() = tp.y() / tp.z() * decimal(2.0) * decimal(SCREEN_SPACE_SIZE) + - decimal(SCREEN_SPACE_SIZE); - *np = vec3(tp.x(), tp.y(), tp.z()); - } - - void render(const model *model, const mat4 matrix) { - decimal widthScale = - decimal(SCREEN_SPACE_SIZE * 2) / decimal((float)target->width); - decimal heightScale = - decimal(SCREEN_SPACE_SIZE * 2) / decimal((float)target->height); - - decimal invWidthScale = - decimal((float)(target->width / SCREEN_SPACE_SIZE / 2)); - decimal invHeightScale = - decimal((float)(target->height / SCREEN_SPACE_SIZE / 2)); - - // TODO clear target with memset - if (clearTarget) { - // memset((wchar_t *)target->pixels, 0, - // target->height * target->width * sizeof(target[0])); - target->clearDepth(); - target->clearTarget(); - } - - vec3 verts[model->verts.size()] = {}; - - std::copy(model->verts.begin(), model->verts.end(), verts); - - for (int i = 0; i < model->verts.size(); i++) { - toScreenSpace(verts + i, matrix); - } - - vec3 normals[model->normals.size()] = {}; - mat3 normalMatrix = matrix.cutTo(); - for (int i = 0; i < model->normals.size(); i++) { - normals[i] = normalMatrix * model->normals[i]; - } - - polygon testP; - - for (int f = 0; f < model->faces.size(); f += 3) { - testP.small = false; - for (int p = 0; p < 3; p++) { - testP.points[p] = verts[std::get<0>(model->faces[f + p])]; - testP.colors[p] = - model->colors[std::get<0>(model->faces[f + p])]; - testP.normals[p] = normals[std::get<1>(model->faces[f + p])]; - } - if ((testP.avgNormal() * vec3(0.0, 0.0, 1.0)) > decimal(0.)) - continue; - - testP.calcDelta(); - - int startX = std::max( - (testP.bounding[0] * invWidthScale).i >> SHIFT_AMOUNT, 0); - int endX = std::min((testP.bounding[1] * invWidthScale).i >> - SHIFT_AMOUNT, - (uint32_t)target->width - 1); - int startY = std::max( - (testP.bounding[2] * invHeightScale).i >> SHIFT_AMOUNT, 0); - int endY = std::min((testP.bounding[3] * invHeightScale).i >> - SHIFT_AMOUNT, - target->height - 1); - - vec3 pos = vec3(testP.bounding[0], testP.bounding[2], 0.0); - for (int x = startX; x < endX; x++) { - for (int y = startY; y < endY; y++) { - - if (testP.depContains(pos)) { - - testP.calcBarycentric(pos); - decimal depth = testP.calcDepth(); - if (depth < target->getDepth(x, y)) { - // std::cout << factors << std::endl; - vec3 normal = testP.calcNormal(); - vec3 color = testP.calcColor(); - decimal lightFac = - std::max(normal * (-sunDir), decimal(0.0)) + - decimal(0.5); - ; - target->setDepth(x, y, depth); - target->set(x, y, - (color * decimal(120.0)) * lightFac); - - // target->set(x, y, - // vec3(lightFac * decimal(200.0), 0, 0)); - // target->set(x, y, - // (normal + vec3(1.0, 1.0, 1.0)) * - // decimal(120.0)); - // target->set( - // x, y, - // (testP.avgNormal() + vec3(1.0, 1.0, 1.0)) * - // decimal(120.0)); - // target->set(x, y, - // testP.barycentrics * decimal(200.0)); - // if (!factors.isSmall()) - // target->set(x, y, vec3(0., 255.0, 0.)); - } - // target->set(x, y, vec3(0.0, 255.0, 0.0)); - } - pos.y() += heightScale; - } - pos.y() = decimal(testP.bounding[2]); - pos.x() += widthScale; - } - } - } -}; - -#endif diff --git a/rendertarget.hpp b/rendertarget.hpp deleted file mode 100644 index a7981c4..0000000 --- a/rendertarget.hpp +++ /dev/null @@ -1,45 +0,0 @@ - -#ifndef RENDERTARGET_H -#define RENDERTARGET_H - -#include "fastmath.hpp" -class Rendertarget { - - public: - const int width; - const int height; - - Rendertarget(int width, int height) : width(width), height(height) { - pixels = new uint8_t[width * height * 3]; - depth = new decimal[width * height]; - for (int i = 0; i < width * height * 3; i++) { - pixels[i] = 0; - } - } - - void set(int x, int y, vec3 val) { - int start = (width * y + x) * 3; - for (int i = 0; i < 3; i++) { - pixels[start + i] = (uint8_t)(val[i].i >> SHIFT_AMOUNT); - } - } - - decimal getDepth(int x, int y) { return depth[width * y + x]; } - void setDepth(int x, int y, decimal val) { depth[width * y + x] = val; } - - void clearDepth() { - for (int i = 0; i < width * height; i++) { - depth[i].i = std::numeric_limits::max(); - } - } - void clearTarget() { - for (int i = 0; i < width * height * 3; i++) { - pixels[i] = 0; - } - } - - uint8_t *pixels; - decimal *depth; -}; - -#endif diff --git a/testModel.hpp b/testModel.hpp deleted file mode 100644 index 7713b19..0000000 --- a/testModel.hpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "model.hpp" - const model testModel({vec3(-0.698513,-0.742437,4.000000),vec3(-0.044645,1.325787,4.000000),vec3(-0.656388,-0.742437,3.761094),vec3(-0.041953,1.325787,3.984730),vec3(-0.535092,-0.742437,3.551004),vec3(-0.034200,1.325787,3.971303),vec3(-0.349257,-0.742437,3.395070),vec3(-0.022323,1.325787,3.961336),vec3(-0.043996,-0.742437,3.312099),vec3(-0.018354,1.325787,3.956033),vec3(0.043996,-0.742437,3.312099),vec3(0.018354,1.325787,3.956033),vec3(0.349257,-0.742437,3.395070),vec3(0.022323,1.325787,3.961336),vec3(0.535092,-0.742437,3.551004),vec3(0.034200,1.325787,3.971303),vec3(0.656388,-0.742437,3.761094),vec3(0.041953,1.325787,3.984730),vec3(0.698513,-0.742437,4.000000),vec3(0.044645,1.325787,4.000000),vec3(0.656388,-0.742437,4.238905),vec3(0.041953,1.325787,4.015269),vec3(0.535092,-0.742437,4.448996),vec3(0.034200,1.325787,4.028697),vec3(0.349257,-0.742437,4.604930),vec3(0.022323,1.325787,4.038664),vec3(0.121296,-0.742437,4.687901),vec3(0.007753,1.325787,4.043967),vec3(-0.121296,-0.742437,4.687901),vec3(-0.007753,1.325787,4.043967),vec3(-0.349257,-0.742437,4.604930),vec3(-0.022323,1.325787,4.038664),vec3(-0.535092,-0.742437,4.448996),vec3(-0.034200,1.325787,4.028697),vec3(-0.656388,-0.742437,4.238905),vec3(-0.041953,1.325787,4.015269),vec3(-0.544639,0.740545,4.000000),vec3(-0.511793,0.740545,3.813723),vec3(-0.409479,0.628906,3.628956),vec3(-0.290178,0.727410,3.529226),vec3(-0.100778,0.727410,3.460290),vec3(0.100778,0.727410,3.460290),vec3(0.290178,0.727410,3.529226),vec3(0.409479,0.628906,3.628956),vec3(0.511793,0.740545,3.813723),vec3(0.544639,0.740545,4.000000),vec3(0.511793,0.740545,4.186277),vec3(0.417218,0.740545,4.350087),vec3(0.272319,0.740545,4.471671),vec3(0.094576,0.740545,4.536365),vec3(-0.094576,0.740545,4.536365),vec3(-0.272319,0.740545,4.471671),vec3(-0.417218,0.740545,4.350087),vec3(-0.511793,0.740545,4.186277),vec3(-0.694426,-0.025119,3.747249),vec3(-0.527394,0.131239,3.502473),vec3(-0.367433,-0.011984,3.367874),vec3(-0.127608,-0.011984,3.280585),vec3(0.127608,-0.011984,3.280585),vec3(0.367433,-0.011984,3.367874),vec3(0.527394,0.131239,3.502473),vec3(0.694426,-0.025119,3.747249),vec3(0.738993,-0.025119,4.000000),vec3(0.694426,-0.025119,4.252750),vec3(0.566102,-0.025119,4.475016),vec3(0.369497,-0.025119,4.639987),vec3(0.128325,-0.025119,4.727766),vec3(-0.128325,-0.025119,4.727766),vec3(-0.369497,-0.025119,4.639987),vec3(-0.566102,-0.025119,4.475016),vec3(-0.694426,-0.025119,4.252750),vec3(-0.738993,-0.025119,4.000000),vec3(-0.410385,-1.654204,4.000000),vec3(-0.385635,-1.654204,3.859640),vec3(-0.314373,-1.654204,3.736210),vec3(-0.205192,-1.654204,3.644597),vec3(-0.071263,-1.654204,3.595850),vec3(0.071263,-1.654204,3.595850),vec3(0.205192,-1.654204,3.644597),vec3(0.314373,-1.654204,3.736210),vec3(0.385635,-1.654204,3.859640),vec3(0.410385,-1.654204,4.000000),vec3(0.385635,-1.654204,4.140360),vec3(0.314373,-1.654204,4.263790),vec3(0.205192,-1.654204,4.355403),vec3(0.071263,-1.654204,4.404150),vec3(-0.071263,-1.654204,4.404150),vec3(-0.205192,-1.654204,4.355403),vec3(-0.314373,-1.654204,4.263790),vec3(-0.385635,-1.654204,4.140360),vec3(-0.237705,1.175272,4.000000),vec3(-0.223370,1.175272,3.918700),vec3(-0.182093,1.175272,3.847206),vec3(-0.118853,1.175272,3.794141),vec3(-0.041277,1.175272,3.765906),vec3(0.041277,1.175272,3.765906),vec3(0.118853,1.175272,3.794141),vec3(0.182093,1.175272,3.847206),vec3(0.223370,1.175272,3.918700),vec3(0.237705,1.175272,4.000000),vec3(0.223370,1.175272,4.081300),vec3(0.182093,1.175272,4.152794),vec3(0.118853,1.175272,4.205859),vec3(0.041277,1.175272,4.234094),vec3(-0.041277,1.175272,4.234094),vec3(-0.118853,1.175272,4.205859),vec3(-0.182093,1.175272,4.152794),vec3(-0.223370,1.175272,4.081300),vec3(-0.046326,1.339588,4.000000),vec3(0.023163,1.339588,4.040120),vec3(0.023163,1.339588,3.959880),vec3(-0.000000,1.637896,4.000000),vec3(0.272319,0.740545,3.528329),vec3(0.417218,0.641971,3.649913),vec3(0.061970,0.740545,3.463635),vec3(-0.061970,0.740545,3.463635),vec3(-0.272319,0.740545,3.528329),vec3(-0.417218,0.641971,3.649913),vec3(-0.566102,0.118174,3.524984),vec3(0.566102,0.118174,3.524984),vec3(-0.369497,-0.025119,3.360013),vec3(-0.046546,-0.025119,3.272234),vec3(0.046546,-0.025119,3.272234),vec3(0.369497,-0.025119,3.360013),vec3(-0.237002,0.617707,3.374269),vec3(-0.257333,0.152925,3.271079),vec3(-0.082310,0.617707,3.317966),vec3(-0.089371,0.152925,3.233547),vec3(0.082310,0.617707,3.317966),vec3(0.089371,0.152925,3.233547),vec3(0.237002,0.617707,3.374269),vec3(0.257333,0.152925,3.271079),vec3(0.334441,0.519176,3.455724),vec3(-0.334441,0.519176,3.455724),vec3(-0.369362,0.235177,3.328954),vec3(0.369362,0.235177,3.328954),vec3(-0.096339,0.701041,3.383524),vec3(0.096339,0.701041,3.383524),vec3(-0.489408,0.156222,3.460765),vec3(-0.391442,0.602531,3.544760),vec3(-0.118417,0.027654,3.269279),vec3(0.118417,0.027654,3.269279),vec3(0.489408,0.156222,3.460765),vec3(0.391442,0.602531,3.544760),vec3(-0.277396,0.701041,3.449423),vec3(0.340969,0.027654,3.344608),vec3(0.277396,0.701041,3.449423),vec3(-0.340969,0.027654,3.344608),vec3(-0.040432,-0.742437,3.312099),vec3(0.040432,-0.742437,3.312099),vec3(0.002584,1.325787,3.956033),vec3(-0.002584,1.325787,3.956033),vec3(-0.031525,0.740545,3.463635),vec3(0.031525,0.740545,3.463635),vec3(-0.042775,-0.025119,3.272234),vec3(0.042775,-0.025119,3.272234),vec3(-0.023754,-1.654204,3.595850),vec3(0.023754,-1.654204,3.595850),vec3(-0.013759,1.175272,3.765906),vec3(0.013759,1.175272,3.765906),vec3(-0.033593,0.727410,3.460290),vec3(0.033593,0.727410,3.460290),vec3(-0.042536,-0.011984,3.280585),vec3(0.042536,-0.011984,3.280585),vec3(-0.027437,0.617707,3.317966),vec3(0.027437,0.617707,3.317966),vec3(-0.029790,0.152925,3.233547),vec3(0.029790,0.152925,3.233547),vec3(0.032113,0.701041,3.383524),vec3(-0.032113,0.701041,3.383524),vec3(-0.039472,0.027654,3.269279),vec3(0.039472,0.027654,3.269279)},{{90,90},{1,1},{3,3},{91,91},{3,3},{5,5},{92,92},{5,5},{7,7},{93,93},{7,7},{9,9},{159,153},{150,149},{11,11},{95,95},{11,11},{13,13},{96,96},{13,13},{15,15},{97,97},{15,15},{17,17},{98,98},{17,17},{19,19},{99,99},{19,19},{21,21},{100,100},{21,21},{23,23},{101,101},{23,23},{25,25},{102,102},{25,25},{27,27},{103,103},{27,27},{29,29},{104,104},{29,29},{31,31},{105,105},{31,31},{33,33},{106,106},{33,33},{35,35},{107,107},{35,35},{1,1},{2,2},{4,4},{74,74},{70,70},{53,53},{36,36},{69,69},{52,52},{53,53},{68,68},{51,51},{52,52},{67,67},{50,50},{51,51},{66,66},{49,49},{50,50},{65,65},{48,48},{49,49},{64,64},{47,47},{48,48},{63,63},{46,46},{47,47},{62,62},{45,45},{46,46},{61,61},{44,44},{45,45},{119,119},{113,113},{44,44},{144,144},{136,136},{126,126},{143,143},{142,142},{135,135},{170,159},{140,140},{127,127},{168,158},{137,137},{128,128},{138,138},{139,139},{133,133},{54,54},{37,37},{117,117},{71,71},{36,36},{37,37},{0,0},{71,71},{54,54},{2,2},{54,54},{118,118},{4,4},{118,118},{120,120},{6,6},{120,120},{121,121},{149,148},{155,151},{122,122},{10,10},{122,122},{123,123},{12,12},{123,123},{119,119},{14,14},{119,119},{61,61},{16,16},{61,61},{62,62},{18,18},{62,62},{63,63},{20,20},{63,63},{64,64},{22,22},{64,64},{65,65},{24,24},{65,65},{66,66},{26,26},{66,66},{67,67},{28,28},{67,67},{68,68},{30,30},{68,68},{69,69},{32,32},{69,69},{70,70},{34,34},{70,70},{71,71},{72,72},{73,73},{74,74},{12,12},{14,14},{79,79},{22,22},{24,24},{84,84},{32,32},{34,34},{89,89},{149,148},{10,10},{77,77},{18,18},{20,20},{82,82},{28,28},{30,30},{87,87},{4,4},{6,6},{75,75},{14,14},{16,16},{80,80},{0,0},{2,2},{73,73},{24,24},{26,26},{85,85},{34,34},{0,0},{72,72},{10,10},{12,12},{78,78},{20,20},{22,22},{83,83},{30,30},{32,32},{88,88},{6,6},{8,8},{76,76},{16,16},{18,18},{81,81},{26,26},{28,28},{86,86},{53,53},{107,107},{90,90},{52,52},{106,106},{107,107},{51,51},{105,105},{106,106},{50,50},{104,104},{105,105},{49,49},{103,103},{104,104},{48,48},{102,102},{103,103},{47,47},{101,101},{102,102},{46,46},{100,100},{101,101},{45,45},{99,99},{100,100},{44,44},{98,98},{99,99},{113,113},{97,97},{98,98},{112,112},{96,96},{97,97},{114,114},{95,95},{96,96},{153,150},{159,153},{95,95},{116,116},{93,93},{94,94},{117,117},{92,92},{93,93},{37,37},{91,91},{92,92},{36,36},{90,90},{91,91},{108,108},{5,5},{3,3},{108,108},{7,7},{5,5},{110,110},{7,7},{108,108},{110,110},{11,11},{150,149},{110,110},{13,13},{11,11},{110,110},{15,15},{13,13},{110,110},{17,17},{15,15},{110,110},{19,19},{17,17},{109,109},{19,19},{110,110},{109,109},{23,23},{21,21},{109,109},{25,25},{23,23},{109,109},{27,27},{25,25},{109,109},{29,29},{27,27},{109,109},{31,31},{29,29},{108,108},{31,31},{109,109},{108,108},{35,35},{33,33},{108,108},{1,1},{35,35},{108,108},{3,3},{1,1},{110,110},{9,9},{7,7},{109,109},{21,21},{19,19},{108,108},{33,33},{31,31},{110,110},{108,108},{111,111},{109,109},{110,110},{111,111},{108,108},{109,109},{111,111},{43,43},{42,42},{112,112},{42,42},{41,41},{114,114},{160,154},{40,40},{115,115},{40,40},{39,39},{116,116},{39,39},{38,38},{117,117},{38,38},{55,55},{118,118},{60,60},{43,43},{113,113},{55,55},{56,56},{120,120},{56,56},{57,57},{121,121},{163,155},{58,58},{122,122},{58,58},{59,59},{123,123},{59,59},{60,60},{119,119},{131,131},{130,130},{132,132},{129,129},{128,128},{130,130},{167,157},{165,156},{128,128},{125,125},{124,124},{126,126},{134,134},{133,133},{124,124},{145,145},{141,141},{129,129},{146,146},{143,143},{132,132},{147,147},{138,138},{134,134},{139,139},{144,144},{124,124},{142,142},{145,145},{131,131},{137,137},{146,146},{130,130},{140,140},{147,147},{125,125},{57,57},{56,56},{147,147},{41,41},{42,42},{146,146},{60,60},{59,59},{145,145},{38,38},{39,39},{144,144},{56,56},{55,55},{138,138},{42,42},{43,43},{143,143},{59,59},{58,58},{141,141},{55,55},{38,38},{139,139},{161,154},{41,41},{137,137},{162,155},{57,57},{140,140},{43,43},{60,60},{142,142},{39,39},{40,40},{136,136},{58,58},{163,155},{171,159},{163,155},{162,155},{170,159},{40,40},{160,154},{169,158},{160,154},{161,154},{168,158},{127,127},{126,126},{164,156},{166,157},{164,156},{165,156},{57,57},{162,155},{154,151},{162,155},{163,155},{155,151},{41,41},{161,154},{153,150},{161,154},{160,154},{152,150},{115,115},{94,94},{158,153},{152,150},{158,153},{159,153},{8,8},{148,148},{156,152},{148,148},{149,148},{157,152},{8,8},{121,121},{154,151},{148,148},{154,151},{155,151},{136,136},{169,158},{164,156},{169,158},{168,158},{165,156},{141,141},{171,159},{167,157},{171,159},{170,159},{166,157},{94,94},{9,9},{151,149},{158,153},{151,149},{150,149}},{vec3(-0.9841,-0.1778,-0.0000),vec3(-0.9146,0.4043,-0.0000),vec3(-0.9236,-0.1767,-0.3401),vec3(-0.7754,0.5378,-0.3310),vec3(-0.7542,-0.1751,-0.6329),vec3(-0.4942,0.7357,-0.4632),vec3(-0.4654,-0.1742,-0.8678),vec3(-0.3167,0.8272,-0.4642),vec3(-0.1336,-0.1746,-0.9755),vec3(-0.1870,0.8394,-0.5103),vec3(0.1336,-0.1746,-0.9755),vec3(0.2385,0.5586,-0.7944),vec3(0.4654,-0.1742,-0.8678),vec3(0.6118,0.3738,-0.6972),vec3(0.7542,-0.1751,-0.6329),vec3(0.6743,0.5378,-0.5060),vec3(0.9236,-0.1767,-0.3401),vec3(0.6483,0.7357,-0.1964),vec3(0.9841,-0.1778,-0.0000),vec3(0.6026,0.7980,-0.0000),vec3(0.9247,-0.1778,0.3366),vec3(0.6483,0.7357,0.1964),vec3(0.7538,-0.1778,0.6325),vec3(0.6743,0.5378,0.5060),vec3(0.4920,-0.1778,0.8522),vec3(0.4573,0.4043,0.7921),vec3(0.1709,-0.1778,0.9691),vec3(0.1010,0.5378,0.8370),vec3(-0.1709,-0.1778,0.9691),vec3(-0.1541,0.7357,0.6596),vec3(-0.4920,-0.1778,0.8522),vec3(-0.3013,0.7980,0.5219),vec3(-0.7538,-0.1778,0.6325),vec3(-0.4942,0.7357,0.4632),vec3(-0.9247,-0.1778,0.3366),vec3(-0.7754,0.5378,0.3310),vec3(-0.9117,0.4109,-0.0000),vec3(-0.8297,0.4306,-0.3552),vec3(-0.7474,0.4493,-0.4893),vec3(-0.6162,0.6713,-0.4119),vec3(-0.1462,0.8137,-0.5626),vec3(0.1462,0.8137,-0.5626),vec3(0.6162,0.6713,-0.4119),vec3(0.7474,0.4493,-0.4893),vec3(0.8297,0.4306,-0.3552),vec3(0.9117,0.4109,-0.0000),vec3(0.8567,0.4109,0.3118),vec3(0.6984,0.4109,0.5860),vec3(0.4558,0.4109,0.7895),vec3(0.1583,0.4109,0.8978),vec3(-0.1583,0.4109,0.8978),vec3(-0.4558,0.4109,0.7895),vec3(-0.6984,0.4109,0.5860),vec3(-0.8567,0.4109,0.3118),vec3(-0.9366,0.0787,-0.3415),vec3(-0.6540,0.2483,-0.7146),vec3(-0.4809,-0.0267,-0.8764),vec3(-0.2295,-0.2559,-0.9391),vec3(0.2295,-0.2559,-0.9391),vec3(0.4809,-0.0267,-0.8764),vec3(0.6540,0.2483,-0.7146),vec3(0.9366,0.0787,-0.3415),vec3(0.9955,0.0944,-0.0000),vec3(0.9355,0.0944,0.3405),vec3(0.7626,0.0944,0.6399),vec3(0.4978,0.0944,0.8622),vec3(0.1729,0.0944,0.9804),vec3(-0.1729,0.0944,0.9804),vec3(-0.4978,0.0944,0.8622),vec3(-0.7626,0.0944,0.6399),vec3(-0.9355,0.0944,0.3405),vec3(-0.9955,0.0944,-0.0000),vec3(-0.6306,-0.7761,-0.0000),vec3(-0.5925,-0.7761,-0.2157),vec3(-0.4830,-0.7761,-0.4053),vec3(-0.2994,-0.7758,-0.5554),vec3(-0.0968,-0.7729,-0.6272),vec3(0.0968,-0.7729,-0.6272),vec3(0.2994,-0.7758,-0.5554),vec3(0.4830,-0.7761,-0.4053),vec3(0.5925,-0.7761,-0.2157),vec3(0.6306,-0.7761,-0.0000),vec3(0.5925,-0.7761,0.2157),vec3(0.4830,-0.7761,0.4053),vec3(0.3153,-0.7761,0.5461),vec3(0.1095,-0.7761,0.6210),vec3(-0.1095,-0.7761,0.6210),vec3(-0.3153,-0.7761,0.5461),vec3(-0.4830,-0.7761,0.4053),vec3(-0.5925,-0.7761,0.2157),vec3(-0.7312,0.6821,-0.0000),vec3(-0.6724,0.6766,-0.3003),vec3(-0.5787,0.6552,-0.4856),vec3(-0.4113,0.6744,-0.6132),vec3(-0.1263,0.6795,-0.7227),vec3(0.1263,0.6795,-0.7227),vec3(0.4113,0.6744,-0.6132),vec3(0.5787,0.6552,-0.4856),vec3(0.6724,0.6766,-0.3003),vec3(0.7312,0.6821,-0.0000),vec3(0.6871,0.6821,0.2501),vec3(0.5601,0.6821,0.4700),vec3(0.3656,0.6821,0.6333),vec3(0.1270,0.6821,0.7201),vec3(-0.1270,0.6821,0.7201),vec3(-0.3656,0.6821,0.6333),vec3(-0.5601,0.6821,0.4700),vec3(-0.6871,0.6821,0.2501),vec3(-0.9437,0.3307,-0.0000),vec3(0.4719,0.3307,0.8173),vec3(0.4828,0.3664,-0.7954),vec3(-0.0000,1.0000,-0.0000),vec3(0.4360,0.5903,-0.6794),vec3(0.7412,0.4302,-0.5153),vec3(0.0801,0.4383,-0.8953),vec3(-0.0801,0.4383,-0.8953),vec3(-0.4360,0.5903,-0.6794),vec3(-0.7412,0.4302,-0.5153),vec3(-0.7512,0.1841,-0.6339),vec3(0.7512,0.1841,-0.6339),vec3(-0.4477,-0.0668,-0.8917),vec3(-0.0796,0.2265,-0.9707),vec3(0.0796,0.2265,-0.9707),vec3(0.4477,-0.0668,-0.8917),vec3(-0.4495,0.3543,-0.8200),vec3(-0.4139,-0.0417,-0.9094),vec3(-0.1336,0.3969,-0.9081),vec3(-0.1290,-0.0457,-0.9906),vec3(0.1336,0.3969,-0.9081),vec3(0.1290,-0.0457,-0.9906),vec3(0.4495,0.3543,-0.8200),vec3(0.4139,-0.0417,-0.9094),vec3(0.6817,0.2733,-0.6787),vec3(-0.6817,0.2733,-0.6787),vec3(-0.6489,0.1453,-0.7469),vec3(0.6489,0.1453,-0.7469),vec3(-0.1165,0.7887,-0.6037),vec3(0.1165,0.7887,-0.6037),vec3(-0.7684,0.1019,-0.6318),vec3(-0.8034,0.3755,-0.4622),vec3(-0.1458,-0.2754,-0.9502),vec3(0.1458,-0.2754,-0.9502),vec3(0.7684,0.1019,-0.6318),vec3(0.8034,0.3755,-0.4622),vec3(-0.5026,0.6609,-0.5574),vec3(0.4862,-0.1914,-0.8526),vec3(0.5026,0.6609,-0.5574),vec3(-0.4862,-0.1914,-0.8526),vec3(-0.0000,-0.1777,-0.9841),vec3(-0.0000,0.5535,-0.8329),vec3(-0.0000,0.4155,-0.9096),vec3(-0.0000,0.2527,-0.9676),vec3(-0.0000,-0.8053,-0.5928),vec3(-0.0000,0.6848,-0.7287),vec3(-0.0000,0.6777,-0.7353),vec3(-0.0000,0.1437,-0.9896),vec3(-0.0000,0.4106,-0.9118),vec3(-0.0000,-0.0491,-0.9988),vec3(-0.0000,0.8153,-0.5790),vec3(-0.0000,-0.2743,-0.9616)},{vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.8556,0.8746,1.0000),vec3(0.8556,0.8746,1.0000),vec3(0.8556,0.8746,1.0000),vec3(0.8556,0.8746,1.0000),vec3(0.8556,0.8746,1.0000),vec3(0.8556,0.8746,1.0000),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.8556,0.8746,1.0000),vec3(0.8556,0.8746,1.0000),vec3(0.8556,0.8746,1.0000),vec3(0.8556,0.8746,1.0000),vec3(0.8556,0.8746,1.0000),vec3(0.8556,0.8746,1.0000),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.9696,1.0000,0.0000),vec3(0.9695,0.9999,0.0005),vec3(0.9696,1.0000,0.0000),vec3(0.9696,1.0000,0.0000),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.0000,0.4470,0.0334),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.7050,0.7349,0.2011),vec3(0.7050,0.7349,0.2011),vec3(0.7050,0.7349,0.2011),vec3(0.7050,0.7349,0.2011),vec3(0.7050,0.7349,0.2011),vec3(0.7050,0.7349,0.2011),vec3(0.7050,0.7349,0.2011),vec3(0.7050,0.7349,0.2011),vec3(0.7050,0.7349,0.2011),vec3(0.7050,0.7349,0.2011),vec3(0.7050,0.7349,0.2011),vec3(0.7050,0.7349,0.2011),vec3(0.8556,0.8746,1.0000),vec3(0.8556,0.8746,1.0000),vec3(0.8556,0.8746,1.0000),vec3(0.8556,0.8746,1.0000),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900),vec3(0.1450,0.1371,0.1900)}); \ No newline at end of file