update to new shader system
[carveJwlIkooP6JGAAIwe30JlM.git] / render.h
1 #ifndef RENDER_H
2 #define RENDER_H
3 #define VG_3D
4 #include "vg/vg.h"
5
6 static struct pipeline
7 {
8 float fov;
9 }
10 gpipeline;
11
12 static void render_water_texture( m4x3f camera );
13 static void render_water_surface( m4x4f pv );
14 static void render_world( m4x4f pv );
15
16 /*
17 * http://www.terathon.com/lengyel/Lengyel-Oblique.pdf
18 */
19 static void plane_clip_projection( m4x4f mat, v4f plane )
20 {
21 v4f c =
22 {
23 (vg_signf(plane[0]) + mat[2][0]) / mat[0][0],
24 (vg_signf(plane[1]) + mat[2][1]) / mat[1][1],
25 -1.0f,
26 (1.0f + mat[2][2]) / mat[3][2]
27 };
28
29 v4_muls( plane, 2.0f / v4_dot(plane,c), c );
30
31 mat[0][2] = c[0];
32 mat[1][2] = c[1];
33 mat[2][2] = c[2] + 1.0f;
34 mat[3][2] = c[3];
35 }
36
37 #endif /* RENDER_H */