reworked lighting uniforms
[carveJwlIkooP6JGAAIwe30JlM.git] / terrain.h
index 81b311ac737d64c861d67a67fc6b841e3d8c0bc7..b5e7e5333b555efa6f851699242e6533a977578d 100644 (file)
--- a/terrain.h
+++ b/terrain.h
@@ -3,6 +3,7 @@
 static void render_terrain(m4x4f projection, v3f camera);
 static void render_sky(m4x3f camera);
 
+#if 0
 #ifndef TERRAIN_H
 #define TERRAIN_H
 
@@ -50,6 +51,12 @@ static void terrain_init(void)
    free(msky);
 }
 
+static void bind_terrain_textures(void)
+{
+   vg_tex2d_bind( &tex_terrain_noise, 0 );
+   vg_tex2d_bind( &tex_terrain_colours, 1 );
+}
+
 static void render_terrain(m4x4f projection, v3f camera)
 {
    shader_terrain_use();
@@ -65,6 +72,15 @@ static void render_terrain(m4x4f projection, v3f camera)
    shader_terrain_uMdl( identity_matrix );
    shader_terrain_uCamera( camera );
    shader_terrain_uPlane( (v4f){ 0.0f,1.0f,0.0f, wrender.height } );
+
+   glActiveTexture( GL_TEXTURE2 );
+   glBindTexture( GL_TEXTURE_2D, wrender.depthmap );
+   shader_terrain_uTexDepth( 2 );
+   shader_terrain_uDepthBounds( (v4f){ 
+         wrender.depthbounds[0][0],
+         wrender.depthbounds[0][2],
+         1.0f/ (wrender.depthbounds[1][0]-wrender.depthbounds[0][0]),
+         1.0f/ (wrender.depthbounds[1][2]-wrender.depthbounds[0][2])} );
 }
 
 static void render_lowerdome( m4x3f camera )
@@ -124,3 +140,4 @@ static void render_sky(m4x3f camera)
 }
 
 #endif
+#endif