feat: added the ability to render whole model

This commit is contained in:
2025-11-13 13:47:59 +01:00
parent f8ffb9c0b3
commit e370c1d0c3
6 changed files with 123 additions and 22 deletions

View File

@@ -2,6 +2,7 @@
#include "polygon.hpp"
#include "renderer.hpp"
#include "rendertarget.hpp"
#include "testModel.hpp"
#include <QApplication>
#include <QImage>
#include <QLabel>
@@ -74,9 +75,9 @@ int main(int argc, char *argv[]) {
renderer.target = &target;
polygon poly =
polygon(vec3(0.9, 0.9, 0.0), vec3(0.5, 0.1, 0.0), vec3(0.1, 0.9, 0.0));
polygon(vec3(0.9, 0.9, 1.0), vec3(0.5, 0.1, 1.0), vec3(0.1, 0.9, 1.0));
renderer.render(&poly);
renderer.render(&testModel);
QApplication a(argc, argv);
uint8_t *pixel = new uint8_t[64 * 64 * 3];
@@ -98,9 +99,8 @@ int main(int argc, char *argv[]) {
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 * y + x) * 3 + c] = result[c] >> 2; /*
target.pixels[(target.width * y * 2 + x * 2) * 3 + c].i >>
SHIFT_AMOUNT;*/
pixel[(WIDTH * (WIDTH - y - 1) + WIDTH - x - 1) * 3 + c] =
result[c] >> 2;
}
}
}