update demo

main
Dominik Madarász 2023-08-11 22:01:44 +02:00
parent 1a1683aa29
commit fb2f7ee532
1 changed files with 0 additions and 15 deletions

View File

@ -3,21 +3,6 @@
#include "v4k.h" #include "v4k.h"
aabb mesh_bounds(mesh_t *m) {
aabb b = {{1e9,1e9,1e9},{-1e9,-1e9,-1e9}};
for( int i = 0; i < array_count(m->in_vertex3); ++i ) {
if( m->in_vertex3[i].x < b.min.x ) b.min.x = m->in_vertex3[i].x;
if( m->in_vertex3[i].x > b.max.x ) b.max.x = m->in_vertex3[i].x;
if( m->in_vertex3[i].y < b.min.y ) b.min.y = m->in_vertex3[i].y;
if( m->in_vertex3[i].y > b.max.y ) b.max.y = m->in_vertex3[i].y;
if( m->in_vertex3[i].z < b.min.z ) b.min.z = m->in_vertex3[i].z;
if( m->in_vertex3[i].z > b.max.z ) b.max.z = m->in_vertex3[i].z;
}
return b;
}
vec2 world2screen(vec3 p) { vec2 world2screen(vec3 p) {
vec4 clip_pos = transform444(camera_get_active()->proj, transform444(camera_get_active()->view, vec4(p.x,p.y,p.z,1.0))); vec4 clip_pos = transform444(camera_get_active()->proj, transform444(camera_get_active()->view, vec4(p.x,p.y,p.z,1.0)));
vec4 ndc_pos = scale4(clip_pos, 1.0 / (clip_pos.w + !clip_pos.w)); // [-1..1] vec4 ndc_pos = scale4(clip_pos, 1.0 / (clip_pos.w + !clip_pos.w)); // [-1..1]