fixed color linearity, and tweaked for VR
[vrfileman] / src / backdrop.cc
index f9dbe22..b81a04a 100644 (file)
@@ -5,6 +5,7 @@
 #include "mesh.h"
 #include "meshgen.h"
 #include "backdrop.h"
 #include "mesh.h"
 #include "meshgen.h"
 #include "backdrop.h"
+#include "app.h"
 
 static unsigned int sdr_grid;
 static Texture *tex_grid;
 
 static unsigned int sdr_grid;
 static Texture *tex_grid;
@@ -12,11 +13,11 @@ static Texture *tex_grid;
 static Mesh *mesh_skydome;
 static unsigned int sdr_skydome;
 
 static Mesh *mesh_skydome;
 static unsigned int sdr_skydome;
 
-static const Vec3 grid_color = Vec3(1.0, 0.3, 1.0);
-static const Vec3 mid_color = Vec3(0.4, 0.1, 0.8);
-static const Vec3 horiz_color = Vec3(0.8, 0.1, 1.0);
-static const Vec3 zenith_color = Vec3(0.2, 0.2, 0.2);
-static const Vec3 fog_color = Vec3(0.12, 0.12, 0.12);
+static const Vec3 grid_color = Vec3(1.0, 0.07, 1.0);
+static const Vec3 mid_color = Vec3(0.133, 0.006, 0.612);
+static const Vec3 horiz_color = Vec3(0.612, 0.006, 1.0);
+static const Vec3 zenith_color = Vec3(0.029, 0.029, 0.029);
+static const Vec3 fog_color = Vec3(0.01, 0.01, 0.01);
 
 bool init_backdrop()
 {
 
 bool init_backdrop()
 {
@@ -38,11 +39,14 @@ bool init_backdrop()
                delete tex_grid;
                return false;
        }
                delete tex_grid;
                return false;
        }
+       tex_grid->set_anisotropy(glcaps.max_aniso);
 
        mesh_skydome = new Mesh;
        gen_sphere(mesh_skydome, 500.0, 32, 16, 1, 0.5);
        mesh_skydome->flip();
 
 
        mesh_skydome = new Mesh;
        gen_sphere(mesh_skydome, 500.0, 32, 16, 1, 0.5);
        mesh_skydome->flip();
 
+       glClearColor(fog_color.x, fog_color.y, fog_color.z, 1.0);
+
        return true;
 }
 
        return true;
 }
 
@@ -56,9 +60,21 @@ void cleanup_backdrop()
 void draw_backdrop()
 {
        // draw sky
 void draw_backdrop()
 {
        // draw sky
+       Mat4 view_mat_inf = view_matrix.upper3x3();
+       glPushMatrix();
+       glLoadMatrixf(view_mat_inf[0]);
+
+       glDisable(GL_DEPTH_TEST);
+       glDepthMask(0);
+
        bind_program(sdr_skydome);
        mesh_skydome->draw();
 
        bind_program(sdr_skydome);
        mesh_skydome->draw();
 
+       glEnable(GL_DEPTH_TEST);
+       glDepthMask(1);
+
+       glPopMatrix();
+
        // draw grid
        Mat4 xform;
        xform.scaling(500.0);
        // draw grid
        Mat4 xform;
        xform.scaling(500.0);