aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-06-21 18:49:24 +0000
committertaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-06-21 18:49:24 +0000
commit1718b3245405169c3411380a4b12f77327d15fee (patch)
tree9f7fdffd5f7c6a2e759919411ee63e673790c7b6
parentbd5a10143bcbab9eaf69fc3c26d8c02dcec5e4ef (diff)
Remove envmap stuff because it doesn't work very well
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@99 84d2e878-0bd5-11dd-ad15-13eda11d74c5
-rw-r--r--data/models/lander2
-rw-r--r--src/render.c40
2 files changed, 3 insertions, 39 deletions
diff --git a/data/models/lander b/data/models/lander
index a95946c..5959966 100644
--- a/data/models/lander
+++ b/data/models/lander
@@ -347,7 +347,7 @@ colour 0.0 0.5 0.2
-0.10 0.35 0.05
HEMISPHERE
-colour 0.2 0.2 0.2
+colour 0.2 0.0 1.0
shiny 100.0
0.00 0.00 0.20
radius 0.25
diff --git a/src/render.c b/src/render.c
index d852312..e6c19d4 100644
--- a/src/render.c
+++ b/src/render.c
@@ -128,8 +128,8 @@ static void render_delete_shaders(RenderContext *r) {
r->hemisphere_n[3*i + 0] = xv; \
r->hemisphere_n[3*i + 1] = yv; \
r->hemisphere_n[3*i + 2] = zv; \
- r->hemisphere_t[2*i + 0] = tx; \
- r->hemisphere_t[2*i + 1] = ty; \
+ r->hemisphere_t[2*i + 0] = 0.5 + 0.5*sin(xv); \
+ r->hemisphere_t[2*i + 1] = 0.5 + 0.5*sin(yv); \
i++;
/* OpenGL initial setup */
@@ -252,32 +252,23 @@ RenderContext *render_setup(int width, int height, int disable_vbos, int disable
for ( js=0; js<HEMI_UP_BITS; js++ ) {
double theta, phi;
GLfloat xv, yv, zv;
- GLfloat tx, ty;
theta = (2*M_PI/(double)HEMI_ROUND_BITS) * (double)is;
phi = (M_PI_2/(double)HEMI_UP_BITS) * (double)js;
xv = cos(theta)*cos(phi);
yv = sin(theta)*cos(phi);
zv = sin(phi);
- tx = 0.5 + 0.5*cos(phi)*cos(theta);
- ty = 0.5 + 0.5*cos(phi)*sin(theta);
ADD_VERTEX
xv = cos(theta+step_round)*cos(phi);
yv = sin(theta+step_round)*cos(phi);
zv = sin(phi);
- tx = 0.5 + 0.5*cos(phi)*cos(theta+step_round);
- ty = 0.5 + 0.5*cos(phi)*sin(theta+step_round);
ADD_VERTEX
xv = cos(theta+step_round)*cos(phi+step_up);
yv = sin(theta+step_round)*cos(phi+step_up);
zv = sin(phi+step_up);
- tx = 0.5 + 0.5*cos(phi+step_round)*cos(theta+step_round);
- ty = 0.5 + 0.5*cos(phi+step_round)*sin(theta+step_round);
ADD_VERTEX
xv = cos(theta)*cos(phi+step_up);
yv = sin(theta)*cos(phi+step_up);
zv = sin(phi+step_up);
- tx = 0.5 + 0.5*cos(phi+step_up)*cos(theta);
- ty = 0.5 + 0.5*cos(phi+step_up)*sin(theta);
ADD_VERTEX
}
}
@@ -427,20 +418,10 @@ static int render_model_instance_draw(ModelInstance *instance, Uint32 t, RenderC
glNormalPointer(GL_FLOAT, 0, r->hemisphere_n);
glTexCoordPointer(2, GL_FLOAT, 0, r->hemisphere_t);
- if ( r->fbos ) {
- glBindTexture(GL_TEXTURE_2D, r->swirly_texture);
- glEnable(GL_TEXTURE_2D);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
- if ( r->shaders ) glUniform1i(glGetUniformLocation(r->lighting_program, "texture_enabled"), 1);
- if ( r->shaders ) glUniform1i(glGetUniformLocation(r->lighting_program, "texture_emits"), 1);
- }
-
glDrawArrays(GL_QUADS, 0, HEMI_NUM_VERTICES);
*nvert += HEMI_NUM_VERTICES;
if ( r->shaders ) glUniform1i(glGetUniformLocation(r->lighting_program, "texture_emits"), 0);
- glDisable(GL_TEXTURE_2D);
-
glDisable(GL_RESCALE_NORMAL);
glPopMatrix();
@@ -674,23 +655,6 @@ void render_draw(Game *game, Uint32 t) {
if ( r->fbos ) {
- /* First pass: Looking upwards */
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, r->fbo);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glViewport(0, 0, 256, 256);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(70.0, 1.0, 0.1, 80.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- gluLookAt(game->lander->x, game->lander->y, game->lander->z,
- game->lander->x, game->lander->y, game->lander->z+10.0,
- sqrtf(2.0)*sinf(game->lander->yaw), sqrtf(2.0)*cosf(game->lander->yaw), 0.0);
- render_setup_lighting(game);
- amb[0] = 0.1; amb[1] = 0.1; amb[2] = 0.1;
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, amb);
- render_draw_stuff(game, t);
-
/* Render some swirlyness */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, r->swirly_fbo);
glClear(GL_COLOR_BUFFER_BIT);