Save projected vertex
This commit is contained in:
parent
ade35f3940
commit
b35a7d9cbe
@ -124,13 +124,14 @@ internal void render_instance(window_t *wnd, const rasteriser_scene_t *scene,
|
|||||||
}
|
}
|
||||||
|
|
||||||
vec2i_t point = {0};
|
vec2i_t point = {0};
|
||||||
|
vertex_t *vp = NULL;
|
||||||
for (u64 i = 0; i < transformed->count; ++i) {
|
for (u64 i = 0; i < transformed->count; ++i) {
|
||||||
vertex = list_get(transformed, i);
|
vp = &(list_get(transformed, i));
|
||||||
vertex.position = mul_mat3x4f_by_vec4f(
|
vp->position = mul_mat3x4f_by_vec4f(
|
||||||
projection_matrix, (vec4f_t){vertex.position.x, vertex.position.y,
|
projection_matrix,
|
||||||
vertex.position.z, 1.0f});
|
(vec4f_t){vp->position.x, vp->position.y, vp->position.z, 1.0f});
|
||||||
point = (vec2i_t){(i32)(vertex.position.x / vertex.position.z),
|
point = (vec2i_t){(i32)(vp->position.x / vp->position.z),
|
||||||
(i32)(vertex.position.y / vertex.position.z)};
|
(i32)(vp->position.y / vp->position.z)};
|
||||||
list_append(vec2i_t, arena, projected, point);
|
list_append(vec2i_t, arena, projected, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user