Draw laser effects with special blending instead of disabled DepthMask; Added special blending for transparency effects as well to let them kick more ass; Corrections while rendering outside part of endlevel sequence with disabled depth testing and dynamically changing Render_depth to make the mine exit visible again while not rendering the exit tunnel tru the planet terrain
This commit is contained in:
parent
d57eed80b5
commit
d020a3136e
|
@ -1,5 +1,9 @@
|
||||||
D2X-Rebirth Changelog
|
D2X-Rebirth Changelog
|
||||||
|
|
||||||
|
20110218
|
||||||
|
--------
|
||||||
|
arch/ogl/ogl.c, include/ogl_init.h, main/endlevel.c, main/object.c: Draw laser effects with special blending instead of disabled DepthMask; Added special blending for transparency effects as well to let them kick more ass; Corrections while rendering outside part of endlevel sequence with disabled depth testing and dynamically changing Render_depth to make the mine exit visible again while not rendering the exit tunnel tru the planet terrain
|
||||||
|
|
||||||
20110217
|
20110217
|
||||||
--------
|
--------
|
||||||
main/wall.c: When recording cloaking or unclocking wall to demo, make sure the very first frame is recorded, too so wall will correctly transform back when rewinding the demo
|
main/wall.c: When recording cloaking or unclocking wall to demo, make sure the very first frame is recorded, too so wall will correctly transform back when rewinding the demo
|
||||||
|
|
|
@ -811,6 +811,28 @@ int gr_disk(fix x,fix y,fix r)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* set/revert blending for laser rendering (intersecting polygons)
|
||||||
|
*/
|
||||||
|
void ogl_toggle_laser_blending(int enable)
|
||||||
|
{
|
||||||
|
static GLint prev_sfactor = -1, prev_dfactor = -1;
|
||||||
|
|
||||||
|
if ( !enable && (prev_sfactor == -1 || prev_dfactor == -1) )
|
||||||
|
return;
|
||||||
|
if ( enable )
|
||||||
|
{
|
||||||
|
glGetIntegerv( GL_BLEND_SRC, &prev_sfactor );
|
||||||
|
glGetIntegerv(GL_BLEND_DST, &prev_dfactor );
|
||||||
|
glBlendFunc(GL_ONE,GL_ONE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glBlendFunc(prev_sfactor,prev_dfactor);
|
||||||
|
prev_sfactor = prev_dfactor = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Draw flat-shaded Polygon (Lasers, Drone-arms, Driller-ears)
|
* Draw flat-shaded Polygon (Lasers, Drone-arms, Driller-ears)
|
||||||
*/
|
*/
|
||||||
|
@ -830,12 +852,10 @@ bool g3_draw_poly(int nv,g3s_point **pointlist)
|
||||||
color_g = PAL2Tg(c);
|
color_g = PAL2Tg(c);
|
||||||
color_b = PAL2Tb(c);
|
color_b = PAL2Tb(c);
|
||||||
|
|
||||||
if (Gr_scanline_darkening_level >= GR_FADE_LEVELS) {
|
if (Gr_scanline_darkening_level >= GR_FADE_LEVELS)
|
||||||
color_a = 1.0;
|
color_a = 1.0;
|
||||||
} else {
|
else
|
||||||
glDepthMask(GL_FALSE);
|
|
||||||
color_a = 1.0 - (float)Gr_scanline_darkening_level / ((float)GR_FADE_LEVELS - 1.0);
|
color_a = 1.0 - (float)Gr_scanline_darkening_level / ((float)GR_FADE_LEVELS - 1.0);
|
||||||
}
|
|
||||||
|
|
||||||
for (c=0; c<nv; c++){
|
for (c=0; c<nv; c++){
|
||||||
index3 = c * 3;
|
index3 = c * 3;
|
||||||
|
@ -854,7 +874,7 @@ bool g3_draw_poly(int nv,g3s_point **pointlist)
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, nv);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, nv);
|
||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
glDepthMask(GL_TRUE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1005,6 +1025,10 @@ bool g3_draw_bitmap(vms_vector *pos,fix width,fix height,grs_bitmap *bm, object
|
||||||
int i;
|
int i;
|
||||||
float color_a;
|
float color_a;
|
||||||
GLfloat vertex_array[12], color_array[16], texcoord_array[8];
|
GLfloat vertex_array[12], color_array[16], texcoord_array[8];
|
||||||
|
GLint prev_sfactor, prev_dfactor;
|
||||||
|
|
||||||
|
glGetIntegerv( GL_BLEND_SRC, &prev_sfactor );
|
||||||
|
glGetIntegerv(GL_BLEND_DST, &prev_dfactor );
|
||||||
|
|
||||||
r_bitmapc++;
|
r_bitmapc++;
|
||||||
v1.z=0;
|
v1.z=0;
|
||||||
|
@ -1027,7 +1051,10 @@ bool g3_draw_bitmap(vms_vector *pos,fix width,fix height,grs_bitmap *bm, object
|
||||||
obj->id==POW_CLOAK || // cloak
|
obj->id==POW_CLOAK || // cloak
|
||||||
obj->id==POW_INVULNERABILITY || // invulnerability
|
obj->id==POW_INVULNERABILITY || // invulnerability
|
||||||
obj->id==POW_HOARD_ORB)) // Hoard Orb
|
obj->id==POW_HOARD_ORB)) // Hoard Orb
|
||||||
color_a = 0.6; // ... with 0.6 alpha
|
{
|
||||||
|
color_a = 0.7; // ... with 0.7 alpha
|
||||||
|
glBlendFunc( GL_SRC_ALPHA, GL_ONE ); // and special blending to keep intensity as well as nice ... blending - yeah
|
||||||
|
}
|
||||||
else
|
else
|
||||||
color_a = 1.0;
|
color_a = 1.0;
|
||||||
|
|
||||||
|
@ -1082,6 +1109,7 @@ bool g3_draw_bitmap(vms_vector *pos,fix width,fix height,grs_bitmap *bm, object
|
||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glBlendFunc(prev_sfactor,prev_dfactor);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1159,6 +1187,14 @@ bool ogl_ubitblt(int w,int h,int dx,int dy, int sx, int sy, grs_bitmap * src, gr
|
||||||
return ogl_ubitblt_i(w,h,dx,dy,w,h,sx,sy,src,dest,0);
|
return ogl_ubitblt_i(w,h,dx,dy,w,h,sx,sy,src,dest,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ogl_toggle_depth_test(int enable)
|
||||||
|
{
|
||||||
|
if (enable)
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
else
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
GLubyte *pixels = NULL;
|
GLubyte *pixels = NULL;
|
||||||
|
|
||||||
void ogl_start_frame(void){
|
void ogl_start_frame(void){
|
||||||
|
@ -1184,9 +1220,9 @@ void ogl_start_frame(void){
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();//clear matrix
|
glLoadIdentity();//clear matrix
|
||||||
#ifdef OGLES
|
#ifdef OGLES
|
||||||
perspective(90.0,1.0,1.0,1000.0);
|
perspective(90.0,1.0,1.0,5000.0);
|
||||||
#else
|
#else
|
||||||
gluPerspective(90.0,1.0,1.0,1000.0);
|
gluPerspective(90.0,1.0,1.0,5000.0);
|
||||||
#endif
|
#endif
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();//clear matrix
|
glLoadIdentity();//clear matrix
|
||||||
|
|
|
@ -104,5 +104,7 @@ void ogl_ulinec(int left, int top, int right, int bot, int c);
|
||||||
bool g3_draw_tmap_2(int nv,g3s_point **pointlist,g3s_uvl *uvl_list,grs_bitmap *bmbot,grs_bitmap *bm, int orient);
|
bool g3_draw_tmap_2(int nv,g3s_point **pointlist,g3s_uvl *uvl_list,grs_bitmap *bmbot,grs_bitmap *bm, int orient);
|
||||||
|
|
||||||
void ogl_draw_vertex_reticle(int cross,int primary,int secondary,int color,int alpha,int size_offs);
|
void ogl_draw_vertex_reticle(int cross,int primary,int secondary,int color,int alpha,int size_offs);
|
||||||
|
void ogl_toggle_laser_blending(int enable);
|
||||||
|
void ogl_toggle_depth_test(int enable);
|
||||||
|
|
||||||
#endif /* _OGL_INIT_H_ */
|
#endif /* _OGL_INIT_H_ */
|
||||||
|
|
|
@ -63,6 +63,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
#include "movie.h"
|
#include "movie.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "titles.h"
|
#include "titles.h"
|
||||||
|
#ifdef OGL
|
||||||
|
#include "ogl_init.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct flythrough_data {
|
typedef struct flythrough_data {
|
||||||
object *obj;
|
object *obj;
|
||||||
|
@ -962,7 +965,7 @@ fix satellite_size = i2f(400);
|
||||||
|
|
||||||
void render_external_scene(fix eye_offset)
|
void render_external_scene(fix eye_offset)
|
||||||
{
|
{
|
||||||
|
int orig_Render_depth = Render_depth;
|
||||||
Viewer_eye = Viewer->pos;
|
Viewer_eye = Viewer->pos;
|
||||||
|
|
||||||
if (eye_offset)
|
if (eye_offset)
|
||||||
|
@ -1004,7 +1007,15 @@ void render_external_scene(fix eye_offset)
|
||||||
draw_polygon_model(&station_pos,&vmd_identity_matrix,NULL,station_modelnum,0,f1_0,NULL,NULL);
|
draw_polygon_model(&station_pos,&vmd_identity_matrix,NULL,station_modelnum,0,f1_0,NULL,NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef OGL
|
||||||
|
ogl_toggle_depth_test(0);
|
||||||
|
#endif
|
||||||
|
Render_depth = (200-(vm_vec_dist_quick(&mine_ground_exit_point, &Viewer_eye)/F1_0))/36;
|
||||||
render_terrain(&mine_ground_exit_point,exit_point_bmx,exit_point_bmy);
|
render_terrain(&mine_ground_exit_point,exit_point_bmx,exit_point_bmy);
|
||||||
|
Render_depth = orig_Render_depth;
|
||||||
|
#ifdef OGL
|
||||||
|
ogl_toggle_depth_test(1);
|
||||||
|
#endif
|
||||||
|
|
||||||
draw_exit_model();
|
draw_exit_model();
|
||||||
if (ext_expl_playing)
|
if (ext_expl_playing)
|
||||||
|
|
|
@ -51,10 +51,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
#include "powerup.h"
|
#include "powerup.h"
|
||||||
#include "fuelcen.h"
|
#include "fuelcen.h"
|
||||||
#include "endlevel.h"
|
#include "endlevel.h"
|
||||||
|
|
||||||
#include "sounds.h"
|
#include "sounds.h"
|
||||||
#include "collide.h"
|
#include "collide.h"
|
||||||
|
|
||||||
#include "lighting.h"
|
#include "lighting.h"
|
||||||
#include "newdemo.h"
|
#include "newdemo.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
@ -69,7 +67,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
#include "switch.h"
|
#include "switch.h"
|
||||||
#include "gameseq.h"
|
#include "gameseq.h"
|
||||||
#include "playsave.h"
|
#include "playsave.h"
|
||||||
|
#ifdef OGL
|
||||||
|
#include "ogl_init.h"
|
||||||
|
#endif
|
||||||
#ifdef EDITOR
|
#ifdef EDITOR
|
||||||
#include "editor/editor.h"
|
#include "editor/editor.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -505,22 +505,12 @@ void draw_polygon_object(object *obj)
|
||||||
if (obj->ctype.ai_info.behavior == AIB_SNIPE)
|
if (obj->ctype.ai_info.behavior == AIB_SNIPE)
|
||||||
light = 2*light + F1_0;
|
light = 2*light + F1_0;
|
||||||
}
|
}
|
||||||
#ifdef OGL
|
|
||||||
if (obj->type == OBJ_WEAPON && (Weapon_info[obj->id].model_num_inner > -1 ))
|
|
||||||
Gr_scanline_darkening_level = 1;
|
|
||||||
#endif
|
|
||||||
draw_polygon_model(&obj->pos,
|
|
||||||
&obj->orient,
|
|
||||||
(vms_angvec *)&obj->rtype.pobj_info.anim_angles,obj->rtype.pobj_info.model_num,
|
|
||||||
obj->rtype.pobj_info.subobj_flags,
|
|
||||||
light,
|
|
||||||
engine_glow_value,
|
|
||||||
alt_textures);
|
|
||||||
#ifdef OGL
|
|
||||||
Gr_scanline_darkening_level = GR_FADE_LEVELS;
|
|
||||||
#endif
|
|
||||||
if (obj->type == OBJ_WEAPON && (Weapon_info[obj->id].model_num_inner > -1 )) {
|
if (obj->type == OBJ_WEAPON && (Weapon_info[obj->id].model_num_inner > -1 )) {
|
||||||
fix dist_to_eye = vm_vec_dist_quick(&Viewer->pos, &obj->pos);
|
fix dist_to_eye = vm_vec_dist_quick(&Viewer->pos, &obj->pos);
|
||||||
|
#ifdef OGL
|
||||||
|
ogl_toggle_laser_blending(1);
|
||||||
|
#endif
|
||||||
if (dist_to_eye < Simple_model_threshhold_scale * F1_0*2)
|
if (dist_to_eye < Simple_model_threshhold_scale * F1_0*2)
|
||||||
draw_polygon_model(&obj->pos,
|
draw_polygon_model(&obj->pos,
|
||||||
&obj->orient,
|
&obj->orient,
|
||||||
|
@ -531,6 +521,18 @@ void draw_polygon_object(object *obj)
|
||||||
engine_glow_value,
|
engine_glow_value,
|
||||||
alt_textures);
|
alt_textures);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
draw_polygon_model(&obj->pos,
|
||||||
|
&obj->orient,
|
||||||
|
(vms_angvec *)&obj->rtype.pobj_info.anim_angles,obj->rtype.pobj_info.model_num,
|
||||||
|
obj->rtype.pobj_info.subobj_flags,
|
||||||
|
light,
|
||||||
|
engine_glow_value,
|
||||||
|
alt_textures);
|
||||||
|
#ifdef OGL
|
||||||
|
if (obj->type == OBJ_WEAPON && (Weapon_info[obj->id].model_num_inner > -1 ))
|
||||||
|
ogl_toggle_laser_blending(0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue