feat: changed fov

This commit is contained in:
2025-11-29 10:08:13 +01:00
parent efbde487cc
commit 7ab3825598

View File

@@ -20,9 +20,9 @@ class Renderer {
bool clearTarget = true;
void toScreenSpace(vec3 *p) {
p->x() = p->x() / p->z() * decimal(SCREEN_SPACE_SIZE) +
p->x() = p->x() / p->z() * decimal(2.0) * decimal(SCREEN_SPACE_SIZE) +
decimal(SCREEN_SPACE_SIZE);
p->y() = p->y() / p->z() * decimal(SCREEN_SPACE_SIZE) +
p->y() = p->y() / p->z() * decimal(2.0) * decimal(SCREEN_SPACE_SIZE) +
decimal(SCREEN_SPACE_SIZE);
p->z() = p->z();
}
@@ -58,16 +58,24 @@ class Renderer {
for (int f = 0; f < model->faces.size(); f += 3) {
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] =
model->normals[std::get<1>(model->faces[f + p])];
}
testP.calcDelta();
int startX = (testP.bounding[0] * invWidthScale).i >> SHIFT_AMOUNT;
int endX = (testP.bounding[1] * invWidthScale).i >> SHIFT_AMOUNT;
int startY = (testP.bounding[2] * invHeightScale).i >> SHIFT_AMOUNT;
int endY = (testP.bounding[3] * invHeightScale).i >> SHIFT_AMOUNT;
int startX = std::max(
(testP.bounding[0] * invWidthScale).i >> SHIFT_AMOUNT, 0);
int endX =
std::min((testP.bounding[1] * invWidthScale).i >> SHIFT_AMOUNT,
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++) {