Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Thu Mar 28, 2024 11:30 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Sep 11, 2009 8:21 pm 
Offline

Joined: Mon Aug 25, 2008 1:08 pm
Posts: 67
st and vicente see this a time, but i dont add so many features, for be exact, i am a noob on the shaders, and the problems of the portable water is dfficult.... for start, the ode objects are not in the water, the water hide them... secondly, they are not reflexions, beacause it draw the land +x time...

there is the source code:

water.c

Code:
/*
    Raydium - CQFD Corp.
    http://raydium.org/
    Released under both BSD license and Lesser GPL library license.
    See "license.txt" file.
*/

void raydium_effect_water(char model[RAYDIUM_MAX_NAME_LEN],int height) {
float water_color[4]={0.5f, 0.6f, 0.6f, 1.0f};
    double plane_reflection[4] = {0.0, 0.0, 1.0, -height}; //it bug if is not here !/

    raydium_register_variable(&speed, RAYDIUM_REGISTER_FLOAT, "speed");
   
    tmp=1;
    while(tmp<=raydium_window_tx &&
           tmp<=raydium_window_ty &&
           tmp<=raydium_texture_size_max)
                {
                tmp*=2;
                }

    water_textures_size=tmp/2;
    raydium_texture_load_internal("","reflection",1,water_textures_size,water_textures_size,4,-1);
    raydium_texture_load_internal("","refraction",1,water_textures_size,water_textures_size,4,-1);
    raydium_shader_load("water","water.vert","water.frag");
    raydium_shader_var_i_name("water","reflection",0);
    raydium_shader_var_i_name("water","refraction",1);
    raydium_shader_var_i_name("water","normalMap",2);
    raydium_shader_var_i_name("water","dudvMap",3);               
    raydium_shader_var_4f_name("water","waterColor", water_color[0], water_color[1], water_color[2], water_color[3]);

    raydium_init_cli_option("model",model);
    raydium_shader_var_4f_name("water","lightPos",raydium_light_position[0][0],raydium_light_position[0][1],raydium_light_position[0][2],1.0f);

/* //NEED TO FIX THE REFLEXION BUG!!
/////////////////////////////////////////////
// create reflection
glViewport(0,0, water_textures_size, water_textures_size);
glScalef(1.0, 1.0, -1.0);
raydium_sky_box_render(raydium_camera_x,raydium_camera_y,raydium_camera_z);// glClear ok ...
raydium_camera_replace(); // cancels the glScalef ...
glTranslatef(0.0f, 0.0f, height*2.0f);
glScalef(1.0, 1.0, -1.0);
glPushMatrix();
{
float a,b,c;

a=raydium_light_position[0][0];
b=raydium_light_position[0][1];
c=raydium_light_position[0][2];
raydium_light_position[0][0]*=-1;
raydium_light_position[0][1]*=-1;
raydium_light_update_position_all();
glEnable(GL_CLIP_PLANE0);
glClipPlane(GL_CLIP_PLANE0, plane_reflection);
raydium_object_draw_name(model);
raydium_light_position[0][0]=a;
raydium_light_position[0][1]=b;
raydium_light_position[0][2]=c;
}


raydium_particle_draw_all();
glDisable(GL_CLIP_PLANE0);
glPopMatrix();
glBindTexture(GL_TEXTURE_2D,raydium_texture_find_by_name("reflection"));
glCopyTexSubImage2D(GL_TEXTURE_2D,0, 0,0, 0,0, water_textures_size, water_textures_size);
raydium_rendering_internal_restore_render_state();
*/

// create refraction
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glViewport(0,0, water_textures_size, water_textures_size);
raydium_camera_replace();
raydium_light_update_position_all();

{
float zero[]={0,0,0,0};
glEnable(GL_FOG);
glFogf(GL_FOG_START,0.1);
glFogf(GL_FOG_END,2);
glFogi(GL_FOG_MODE,GL_LINEAR);
glFogfv(GL_FOG_COLOR,zero);
raydium_fog_volumetric_enable();
}

raydium_object_draw_name(model);
glBindTexture(GL_TEXTURE_2D,raydium_texture_find_by_name("refraction"));
glCopyTexSubImage2D(GL_TEXTURE_2D,0, 0,0, 0,0, water_textures_size, water_textures_size);
raydium_fog_volumetric_disable();
raydium_fog_apply();
raydium_rendering_internal_restore_render_state();



// regular rendering
glViewport(0, 0, raydium_window_tx, raydium_window_ty);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
raydium_sky_box_render(raydium_camera_x,raydium_camera_y,raydium_camera_z);
raydium_camera_replace();
raydium_object_draw_name(model);
raydium_rendering_internal_restore_render_state();


// rendering water
// prepare texunits
raydium_rendering_prepare_texture_unit(GL_TEXTURE0_ARB,raydium_texture_find_by_name("reflection"));
raydium_rendering_prepare_texture_unit(GL_TEXTURE1_ARB,raydium_texture_find_by_name("refraction"));
raydium_rendering_prepare_texture_unit(GL_TEXTURE2_ARB,raydium_texture_find_by_name("water_nmap_0.tga"));
raydium_rendering_prepare_texture_unit(GL_TEXTURE3_ARB,raydium_texture_find_by_name("water_dudvmap_0.tga"));
// activate shader
raydium_shader_current_name("water");
// draw quad
{
// Create a static variable for the movement of the water
static float move = 0.0f;

// Use this variable for the normal map and make it slower
// than the refraction map's speed.  We want the refraction
// map to be jittery, but not the normal map's waviness.
float move2 = move * kNormalMapScale;

// Set the refraction map's UV coordinates to our global g_WaterUV
float refrUV = g_WaterUV;

// Set our normal map's UV scale and shrink it by kNormalMapScale
float normalUV = g_WaterUV * kNormalMapScale;

float low=-100;
float high=100;

// Move the water by our global speed
//printf("%f\n",raydium_frame_time);
move += (g_WaterFlow*raydium_frame_time);
       
glBegin(GL_QUADS);

// The back left vertice for the water
 glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, g_WaterUV);            // Reflection texture            
 glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, refrUV - move);         // Refraction texture
 glMultiTexCoord2fARB(GL_TEXTURE2_ARB, 0.0f, normalUV + move2);      // Normal map texture
 glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                  // DUDV map texture
 glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                  // Depth texture
 glVertex3f(low, low, height);

// The front left vertice for the water
 glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 0.0f);               // Reflection texture
 glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 0.0f - move);         // Refraction texture
 glMultiTexCoord2fARB(GL_TEXTURE2_ARB, 0.0f, 0.0f + move2);         // Normal map texture
 glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                  // DUDV map texture
 glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                  // Depth texture
 glVertex3f(low, high, height);

// The front right vertice for the water
 glMultiTexCoord2fARB(GL_TEXTURE0_ARB, g_WaterUV, 0.0f);            // Reflection texture
 glMultiTexCoord2fARB(GL_TEXTURE1_ARB, refrUV, 0.0f - move);         // Refraction texture
 glMultiTexCoord2fARB(GL_TEXTURE2_ARB, normalUV, 0.0f + move2);      // Normal map texture
 glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                  // DUDV map texture
 glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                  // Depth texture
 glVertex3f(high, high, height);

// The back right vertice for the water
 glMultiTexCoord2fARB(GL_TEXTURE0_ARB, g_WaterUV, g_WaterUV);      // Reflection texture
 glMultiTexCoord2fARB(GL_TEXTURE1_ARB, refrUV, refrUV - move);      // Refraction texture
 glMultiTexCoord2fARB(GL_TEXTURE2_ARB, normalUV, normalUV + move2);   // Normal map texture
 glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                  // DUDV map texture
 glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                  // Depth texture
 glVertex3f(high, low, height);

glEnd();
}

raydium_shader_current(-1);

raydium_rendering_prepare_texture_unit(GL_TEXTURE0_ARB,0);
raydium_rendering_prepare_texture_unit(GL_TEXTURE1_ARB,0);
raydium_rendering_prepare_texture_unit(GL_TEXTURE2_ARB,0);
raydium_rendering_prepare_texture_unit(GL_TEXTURE3_ARB,0);

if(raydium_key[GLUT_KEY_F12])
    {
    raydium_osd_draw_name("reflection",0,0,20,20);
    raydium_osd_draw_name("refraction",80,0,100,20);
    }
}



//Acid effect: same with green water :D
void raydium_effect_acid(char model[RAYDIUM_MAX_NAME_LEN],int height) {
float water_color[4]={0.0f, 1.0f, 0.0f, 1.0f}; //acid effect
  double plane_reflection[4] = {0.0, 0.0, 1.0, -height}; //it bug if is not here !/

    raydium_register_variable(&speed, RAYDIUM_REGISTER_FLOAT, "speed");
   
    tmp=1;
    while(tmp<=raydium_window_tx &&
           tmp<=raydium_window_ty &&
           tmp<=raydium_texture_size_max)
                {
                tmp*=2;
                }

    water_textures_size=tmp/2;
    raydium_texture_load_internal("","reflection",1,water_textures_size,water_textures_size,4,-1);
    raydium_texture_load_internal("","refraction",1,water_textures_size,water_textures_size,4,-1);
    raydium_shader_load("water","water.vert","water.frag");
    raydium_shader_var_i_name("water","reflection",0);
    raydium_shader_var_i_name("water","refraction",1);
    raydium_shader_var_i_name("water","normalMap",2);
    raydium_shader_var_i_name("water","dudvMap",3);               
    raydium_shader_var_4f_name("water","waterColor", water_color[0], water_color[1], water_color[2], water_color[3]);

    raydium_init_cli_option("model",model);
    raydium_shader_var_4f_name("water","lightPos",raydium_light_position[0][0],raydium_light_position[0][1],raydium_light_position[0][2],1.0f);

// create refraction
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glViewport(0,0, water_textures_size, water_textures_size);
raydium_camera_replace();
raydium_light_update_position_all();

{
float zero[]={0,0,0,0};
glEnable(GL_FOG);
glFogf(GL_FOG_START,0.1);
glFogf(GL_FOG_END,2);
glFogi(GL_FOG_MODE,GL_LINEAR);
glFogfv(GL_FOG_COLOR,zero);
raydium_fog_volumetric_enable();
}

raydium_object_draw_name(model);
glBindTexture(GL_TEXTURE_2D,raydium_texture_find_by_name("refraction"));
glCopyTexSubImage2D(GL_TEXTURE_2D,0, 0,0, 0,0, water_textures_size, water_textures_size);
raydium_fog_volumetric_disable();
raydium_fog_apply();
raydium_rendering_internal_restore_render_state();



// regular rendering
glViewport(0, 0, raydium_window_tx, raydium_window_ty);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
raydium_sky_box_render(raydium_camera_x,raydium_camera_y,raydium_camera_z);
raydium_camera_replace();
raydium_object_draw_name(model);
raydium_rendering_internal_restore_render_state();


// rendering water
// prepare texunits
raydium_rendering_prepare_texture_unit(GL_TEXTURE0_ARB,raydium_texture_find_by_name("reflection"));
raydium_rendering_prepare_texture_unit(GL_TEXTURE1_ARB,raydium_texture_find_by_name("refraction"));
raydium_rendering_prepare_texture_unit(GL_TEXTURE2_ARB,raydium_texture_find_by_name("water_nmap_0.tga"));
raydium_rendering_prepare_texture_unit(GL_TEXTURE3_ARB,raydium_texture_find_by_name("water_dudvmap_0.tga"));
// activate shader
raydium_shader_current_name("water");
// draw quad
{
// Create a static variable for the movement of the water
static float move = 0.0f;

// Use this variable for the normal map and make it slower
// than the refraction map's speed.  We want the refraction
// map to be jittery, but not the normal map's waviness.
float move2 = move * kNormalMapScale;

// Set the refraction map's UV coordinates to our global g_WaterUV
float refrUV = g_WaterUV;

// Set our normal map's UV scale and shrink it by kNormalMapScale
float normalUV = g_WaterUV * kNormalMapScale;

float low=-100;
float high=100;

// Move the water by our global speed
//printf("%f\n",raydium_frame_time);
move += (g_WaterFlow*raydium_frame_time);
       
glBegin(GL_QUADS);

// The back left vertice for the water
 glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, g_WaterUV);            // Reflection texture            
 glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, refrUV - move);         // Refraction texture
 glMultiTexCoord2fARB(GL_TEXTURE2_ARB, 0.0f, normalUV + move2);      // Normal map texture
 glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                  // DUDV map texture
 glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                  // Depth texture
 glVertex3f(low, low, height);

// The front left vertice for the water
 glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 0.0f);               // Reflection texture
 glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 0.0f - move);         // Refraction texture
 glMultiTexCoord2fARB(GL_TEXTURE2_ARB, 0.0f, 0.0f + move2);         // Normal map texture
 glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                  // DUDV map texture
 glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                  // Depth texture
 glVertex3f(low, high, height);

// The front right vertice for the water
 glMultiTexCoord2fARB(GL_TEXTURE0_ARB, g_WaterUV, 0.0f);            // Reflection texture
 glMultiTexCoord2fARB(GL_TEXTURE1_ARB, refrUV, 0.0f - move);         // Refraction texture
 glMultiTexCoord2fARB(GL_TEXTURE2_ARB, normalUV, 0.0f + move2);      // Normal map texture
 glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                  // DUDV map texture
 glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                  // Depth texture
 glVertex3f(high, high, height);

// The back right vertice for the water
 glMultiTexCoord2fARB(GL_TEXTURE0_ARB, g_WaterUV, g_WaterUV);      // Reflection texture
 glMultiTexCoord2fARB(GL_TEXTURE1_ARB, refrUV, refrUV - move);      // Refraction texture
 glMultiTexCoord2fARB(GL_TEXTURE2_ARB, normalUV, normalUV + move2);   // Normal map texture
 glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                  // DUDV map texture
 glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                  // Depth texture
 glVertex3f(high, low, height);

glEnd();
}

raydium_shader_current(-1);

raydium_rendering_prepare_texture_unit(GL_TEXTURE0_ARB,0);
raydium_rendering_prepare_texture_unit(GL_TEXTURE1_ARB,0);
raydium_rendering_prepare_texture_unit(GL_TEXTURE2_ARB,0);
raydium_rendering_prepare_texture_unit(GL_TEXTURE3_ARB,0);


}



//Oil: same with black and not really good alpha :D
void raydium_effect_oil(char model[RAYDIUM_MAX_NAME_LEN],int height) {
float water_color[4]={0.05f, 0.05f, 0.05f, 0.5f};  //oil
  double plane_reflection[4] = {0.0, 0.0, 1.0, -height}; //it bug if is not here !/

    raydium_register_variable(&speed, RAYDIUM_REGISTER_FLOAT, "speed");
   
    tmp=1;
    while(tmp<=raydium_window_tx &&
           tmp<=raydium_window_ty &&
           tmp<=raydium_texture_size_max)
                {
                tmp*=2;
                }

    water_textures_size=tmp/2;
    raydium_texture_load_internal("","reflection",1,water_textures_size,water_textures_size,4,-1);
    raydium_texture_load_internal("","refraction",1,water_textures_size,water_textures_size,4,-1);
    raydium_shader_load("water","water.vert","water.frag");
    raydium_shader_var_i_name("water","reflection",0);
    raydium_shader_var_i_name("water","refraction",1);
    raydium_shader_var_i_name("water","normalMap",2);
    raydium_shader_var_i_name("water","dudvMap",3);               
    raydium_shader_var_4f_name("water","waterColor", water_color[0], water_color[1], water_color[2], water_color[3]);

    raydium_init_cli_option("model",model);
    raydium_shader_var_4f_name("water","lightPos",raydium_light_position[0][0],raydium_light_position[0][1],raydium_light_position[0][2],1.0f);

// create refraction
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glViewport(0,0, water_textures_size, water_textures_size);
raydium_camera_replace();
raydium_light_update_position_all();

{
float zero[]={0,0,0,0};
glEnable(GL_FOG);
glFogf(GL_FOG_START,0.1);
glFogf(GL_FOG_END,2);
glFogi(GL_FOG_MODE,GL_LINEAR);
glFogfv(GL_FOG_COLOR,zero);
raydium_fog_volumetric_enable();
}

raydium_object_draw_name(model);
glBindTexture(GL_TEXTURE_2D,raydium_texture_find_by_name("refraction"));
glCopyTexSubImage2D(GL_TEXTURE_2D,0, 0,0, 0,0, water_textures_size, water_textures_size);
raydium_fog_volumetric_disable();
raydium_fog_apply();
raydium_rendering_internal_restore_render_state();



// regular rendering
glViewport(0, 0, raydium_window_tx, raydium_window_ty);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
raydium_sky_box_render(raydium_camera_x,raydium_camera_y,raydium_camera_z);
raydium_camera_replace();
raydium_object_draw_name(model);
raydium_rendering_internal_restore_render_state();


// rendering water
// prepare texunits
raydium_rendering_prepare_texture_unit(GL_TEXTURE0_ARB,raydium_texture_find_by_name("reflection"));
raydium_rendering_prepare_texture_unit(GL_TEXTURE1_ARB,raydium_texture_find_by_name("refraction"));
raydium_rendering_prepare_texture_unit(GL_TEXTURE2_ARB,raydium_texture_find_by_name("water_nmap_0.tga"));
raydium_rendering_prepare_texture_unit(GL_TEXTURE3_ARB,raydium_texture_find_by_name("water_dudvmap_0.tga"));
// activate shader
raydium_shader_current_name("water");
// draw quad
{
// Create a static variable for the movement of the water
static float move = 0.0f;

// Use this variable for the normal map and make it slower
// than the refraction map's speed.  We want the refraction
// map to be jittery, but not the normal map's waviness.
float move2 = move * kNormalMapScale;

// Set the refraction map's UV coordinates to our global g_WaterUV
float refrUV = g_WaterUV;

// Set our normal map's UV scale and shrink it by kNormalMapScale
float normalUV = g_WaterUV * kNormalMapScale;

float low=-100;
float high=100;

// Move the water by our global speed
//printf("%f\n",raydium_frame_time);
move += (g_WaterFlow*raydium_frame_time);
       
glBegin(GL_QUADS);

// The back left vertice for the water
 glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, g_WaterUV);            // Reflection texture            
 glMultiTexCoord2fARB(GL_TEXTURE2_ARB, 0.0f, normalUV + move2);      // Normal map texture
 glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                  // DUDV map texture
 glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                  // Depth texture
 glVertex3f(low, low, height);

// The front left vertice for the water
 glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 0.0f);               // Reflection texture
 glMultiTexCoord2fARB(GL_TEXTURE2_ARB, 0.0f, 0.0f + move2);         // Normal map texture
 glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                  // DUDV map texture
 glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                  // Depth texture
 glVertex3f(low, high, height);

// The front right vertice for the water
 glMultiTexCoord2fARB(GL_TEXTURE0_ARB, g_WaterUV, 0.0f);            // Reflection texture
 glMultiTexCoord2fARB(GL_TEXTURE2_ARB, normalUV, 0.0f + move2);      // Normal map texture
 glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                  // DUDV map texture
 glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                  // Depth texture
 glVertex3f(high, high, height);

// The back right vertice for the water
 glMultiTexCoord2fARB(GL_TEXTURE0_ARB, g_WaterUV, g_WaterUV);      // Reflection texture
 glMultiTexCoord2fARB(GL_TEXTURE1_ARB, refrUV, refrUV - move);      // Refraction texture
 glMultiTexCoord2fARB(GL_TEXTURE2_ARB, normalUV, normalUV + move2);   // Normal map texture
 glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                  // DUDV map texture
 glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                  // Depth texture
 glVertex3f(high, low, height);

glEnd();
}

raydium_shader_current(-1);

raydium_rendering_prepare_texture_unit(GL_TEXTURE0_ARB,0);
raydium_rendering_prepare_texture_unit(GL_TEXTURE1_ARB,0);
raydium_rendering_prepare_texture_unit(GL_TEXTURE2_ARB,0);
raydium_rendering_prepare_texture_unit(GL_TEXTURE3_ARB,0);
}


effects.h

Code:
/*
    Raydium - CQFD Corp.
    http://raydium.org/
    Released under both BSD license and Lesser GPL library license.
    See "license.txt" file.
*/
//water.h: water effect tests
#define RAYDIUM_MAX_LENS_FLARE 5
GLfloat speed = 0.1;
GLint sensibilite = 3;

GLint lacet = 0;
const float kNormalMapScale = 0.25f;

GLfloat light_color[] = {1.0, 0.9, 0.8, 1.0};
GLfloat  *back_color=light_color;
static GLfloat secs=0;
float speed,direct;
int tmp;

//water
GLint water_textures_size;
float water_color[4]={0.5f, 0.6f, 0.6f, 1.0f};
GLfloat water_height=0.0;
float g_WaterFlow = 0.12f;
float g_WaterUV = 35.0f;


//not for now, bug with acid :/
//acid
GLint acid_textures_size;
float acid_color[4]={0.0f, 1.0f, 0.0f, 1.0f}; //acid effect
GLfloat acid_height=0.0;
float g_acidFlow = 0.12f;
float g_acidUV = 35.0f;

//oil
float oil_color[4]={0.08f, 0.08f, 0.08f, 0.5f};  //oil
GLint oil_textures_size;
GLfloat oil_height=0.0;
float g_oilFlow = 0.12f;
float g_oilUV = 35.0f;


if anyone wants to add things on it ... :) (or remake the shader system for make crysis :mrgreen: , yes Xfennec, all is shader, now... :) )

_________________
Image


Top
 Profile  
 
PostPosted: Mon Sep 14, 2009 8:13 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
What do you mean by "portable" water effect ? You're thinking about a generic, re-usable effect ? Not an easy job, since a such feature should provide a big amount of settings to the user (textures, shader files, sizes, ...). It should also be coded on top of RayODE,

About the code you've posted, it's quite ... dirty, to be brutally honest: most of the code is duplicated, with pointer mis-usages and hard coded values, ... A lot of work to do, here.

And what do you mean by "yes Xfennec, all is shader, now... " ? Can't remember having said anything against that. Looking at it, that's why I've implemented shaders into the engine, in facts :)


Top
 Profile  
 
PostPosted: Wed Sep 16, 2009 4:00 pm 
Offline

Joined: Mon Aug 25, 2008 1:08 pm
Posts: 67
yes, it's a basic re-usable effect, but it is small call: ryadium_effect_water(file.tri,height) you can try it, it work, but thy are not support of physics, and no reflections

yes the code is ugly, like i said i'm a über noob on the shaders ;) it's based on your shader demo.


for the "yes... all is shaders, now" remember after your conference at the RMLL :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 26 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group