[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dpge-commits] CVS: dpge/ref_gl gl_light.c,1.1.1.1,1.2 gl_rmain.c,1.1.1.
From: |
Paul G. Allen <address@hidden> |
Subject: |
[Dpge-commits] CVS: dpge/ref_gl gl_light.c,1.1.1.1,1.2 gl_rmain.c,1.1.1.1,1.2 |
Date: |
Tue, 26 Feb 2002 06:20:40 -0500 |
Update of /cvsroot/dpge/dpge/ref_gl
In directory subversions:/tmp/cvs-serv27509/dpge/ref_gl
Modified Files:
gl_light.c gl_rmain.c
Log Message:
3.19-11 Changes
- New sorting for entities, particles, and dlights. All are sorted from back
to front as seen from the camera.
- New single pass renderer for entities and particles. This eliminated some
code, fixed some pransparency problems, and spead the engine up.
- Preliminary cos and sin table code for fast trig functions. This is nowherere
near done (if it ever will be
Index: gl_light.c
===================================================================
RCS file: /cvsroot/dpge/dpge/ref_gl/gl_light.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** gl_light.c 23 Feb 2002 01:34:19 -0000 1.1.1.1
--- gl_light.c 26 Feb 2002 11:20:38 -0000 1.2
***************
*** 73,76 ****
--- 73,78 ----
}
+
+
/*
=============
Index: gl_rmain.c
===================================================================
RCS file: /cvsroot/dpge/dpge/ref_gl/gl_rmain.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** gl_rmain.c 23 Feb 2002 01:34:22 -0000 1.1.1.1
--- gl_rmain.c 26 Feb 2002 11:20:38 -0000 1.2
***************
*** 423,427 ****
}
! // draw transparent entities
// we could sort these if it ever becomes a problem...
qglDepthMask (0); // no z writes
--- 423,427 ----
}
! /* draw transparent entities
// we could sort these if it ever becomes a problem...
qglDepthMask (0); // no z writes
***************
*** 462,466 ****
}
}
! qglDepthMask (1); // back to writing
}
--- 462,466 ----
}
}
! qglDepthMask (1); // back to writing*/
}
***************
*** 469,473 ****
** GL_DrawParticles
**
! */
void GL_DrawParticles( int num_particles, const particle_t particles[], const
unsigned colortable[768] )
--- 469,473 ----
** GL_DrawParticles
**
! *
void GL_DrawParticles( int num_particles, const particle_t particles[], const
unsigned colortable[768] )
***************
*** 578,581 ****
--- 578,652 ----
// qglEnable( GL_TEXTURE_2D );
GL_TexEnv( GL_REPLACE );
+ }*/
+
+
+ void R_RenderParticle( const particle_t* Particle )
+ {
+ int i;
+ vec3_t up, right;
+ float scale;
+ byte color[4];
+ vec3_t point;
+
+
+
+ qglDepthMask( GL_FALSE ); // no z buffering
+ qglEnable( GL_BLEND );
+ GL_TexEnv( GL_MODULATE );
+
+ VectorScale (vup, 1.5, up);
+ VectorScale (vright, 1.5, right);
+
+ {
+
+ if (Particle->Type->Image &&
+ Particle->Type->Image->texnum &&
+ Particle->Type->Type)
+ {
+ // qglDisable( GL_TEXTURE_2D );
+ GL_Bind (Particle->Type->Image->texnum);
+ qglBegin( GL_QUADS );
+
+ scale = Particle->Type->x;
+
+ qglColor4f( Particle->Type->red, Particle->Type->green,
Particle->Type->blue, Particle->alpha );
+
+
+ qglTexCoord2f (Particle->Type->Image->sl, Particle->Type->Image->tl);
+ qglVertex3fv( Particle->origin );
+
+ qglTexCoord2f (Particle->Type->Image->sh, Particle->Type->Image->tl);
+ qglVertex3f( Particle->origin[0] + -up[0]*scale,
+ Particle->origin[1] + -up[1]*scale,
+ Particle->origin[2] + -up[2]*scale
+ );
+
+ qglTexCoord2f (Particle->Type->Image->sh,
Particle->Type->Image->th);
+ point[0] = Particle->origin[0] + -right[0]*scale;
+ point[1] = Particle->origin[1] + -right[1]*scale;
+ point[2] = Particle->origin[2] + -right[2]*scale;
+
+ point[0] = point[0] + -up[0]*scale;
+ point[1] = point[1] + -up[1]*scale;
+ point[2] = point[2] + -up[2]*scale;
+
+ qglVertex3fv(point);
+
+ qglTexCoord2f (Particle->Type->Image->sl, Particle->Type->Image->th);
+ qglVertex3f( Particle->origin[0] + -right[0]*scale,
+ Particle->origin[1] + -right[1]*scale,
+ Particle->origin[2] + -right[2]*scale
+ );
+
+ qglEnd ();
+ }
+ }
+
+ // qglEnd ();
+ qglDisable( GL_BLEND );
+ qglColor4f( 1,1,1,1 );
+ qglDepthMask( 1 ); // back to normal Z buffering
+ // qglEnable( GL_TEXTURE_2D );
+ GL_TexEnv( GL_REPLACE );
}
***************
*** 584,592 ****
R_DrawParticles
===============
! */
void R_DrawParticles (void)
{
GL_DrawParticles( r_newrefdef.num_particles, r_newrefdef.particles,
d_8to24table );
return;
--- 655,665 ----
R_DrawParticles
===============
! *
!
void R_DrawParticles (void)
{
GL_DrawParticles( r_newrefdef.num_particles, r_newrefdef.particles,
d_8to24table );
+ // GL_DrawParticles2( r_newrefdef.NumObjects, r_newrefdef.Objects,
d_8to24table );
return;
***************
*** 1186,1190 ****
{
}
!
/*
--- 1259,1368 ----
{
}
!
!
! void R_RenderEntity (const entity_t* Entity)
! {
! if (!r_drawentities->value)
! return;
!
! // ri.Con_Printf( PRINT_ALL, "Ent model address: 0x%x\n", Entity->model );
!
!
! {
! currententity = Entity;
! if (Entity->flags & RF_TRANSLUCENT)
! {
! return; // solid
! }
! if ( currententity->flags & RF_BEAM )
! {
! R_DrawBeam( currententity );
! return;
! }
! else
! {
! currentmodel = currententity->model;
! if (!currentmodel)
! {
! R_DrawNullModel ();
! return;
! }
! switch (currentmodel->type)
! {
! case mod_alias:
! // ri.Con_Printf( PRINT_ALL, "R_DrawAliasModel\n" );
! R_DrawAliasModel (currententity);
! break;
! case mod_brush:
! // ri.Con_Printf( PRINT_ALL, "R_DrawBrushModel\n" );
! R_DrawBrushModel (currententity);
! break;
! case mod_sprite:
! // ri.Con_Printf( PRINT_ALL, "R_DrawSpriteModel\n" );
! R_DrawSpriteModel (currententity);
! break;
! default:
! ri.Sys_Error (ERR_DROP, "Bad modeltype");
! break;
! }// switch
! }// if Entity->flags
! }
! }
!
! void R_RenderDynamicLight (const dlight_t* l)
! {
! // int i;
! // dlight_t *l;
! // extern int r_dlightframecount;
!
! if (!gl_flashblend->value)
! return;
!
! ri.Con_Printf( PRINT_ALL, "Render Light\n" );
! // r_dlightframecount = r_framecount + 1; // because the count hasn't
! // advanced yet for this frame
! qglDepthMask (GL_FALSE);
! qglDisable (GL_TEXTURE_2D);
! qglShadeModel (GL_SMOOTH);
! qglEnable (GL_BLEND);
! qglBlendFunc (GL_ONE, GL_ONE);
!
! // l = r_newrefdef.dlights;
! // for (i=0 ; i<r_newrefdef.num_dlights ; i++, l++)
! R_RenderDlight (l);
!
! qglColor3f (1,1,1);
! qglDisable (GL_BLEND);
! qglEnable (GL_TEXTURE_2D);
! qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
! qglDepthMask (GL_TRUE);
! }
!
! void R_DrawObjects(uint NumObjects, const object_t Objects[])
! {
! int i;
! extern int r_dlightframecount;
!
! for ( i = 0; i < NumObjects; i++ )
! {
! if (Objects[i].Particle != NULL)
! {
! R_RenderParticle( Objects[i].Particle);
! continue;
! }
! if (Objects[i].Entity != NULL)
! {
! R_RenderEntity( Objects[i].Entity );
! continue;
! }
! if (Objects[i].DynamicLight != NULL)
! {
! R_RenderDynamicLight( Objects[i].DynamicLight);
! //R_RenderDlights( Objects[i].DynamicLight);
! }
! }
! //r_dlightframecount = r_framecount + 1; // because the count hasn't
! R_RenderDlights();
! }
/*
***************
*** 1242,1255 ****
R_DrawWorld ();
! R_DrawEntitiesOnList ();
// if (i) R_RenderDlights ();
R_RenderDlights ();
! R_DrawAlphaSurfaces ();
// if (i) R_DrawParticles ();
! R_DrawParticles ();
! // R_DrawAlphaSurfaces ();
// PGA 1/21/02: Draw fog volumes
--- 1420,1434 ----
R_DrawWorld ();
! // R_DrawEntitiesOnList ();
// if (i) R_RenderDlights ();
R_RenderDlights ();
! // R_DrawAlphaSurfaces ();
// if (i) R_DrawParticles ();
! // R_DrawParticles ();
! R_DrawObjects(r_newrefdef.NumObjects, r_newrefdef.Objects);
! R_DrawAlphaSurfaces ();
// PGA 1/21/02: Draw fog volumes
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dpge-commits] CVS: dpge/ref_gl gl_light.c,1.1.1.1,1.2 gl_rmain.c,1.1.1.1,1.2,
Paul G. Allen <address@hidden> <=
- Prev by Date:
[Dpge-commits] CVS: dpge 3.19-11_Changes.txt,NONE,1.1 dpge,1.1.1.1,1.2
- Next by Date:
[Dpge-commits] CVS: dpge/linux/debugi386/linux/test texture3di386,1.1.1.1,NONE
- Previous by thread:
[Dpge-commits] CVS: dpge 3.19-11_Changes.txt,NONE,1.1 dpge,1.1.1.1,1.2
- Next by thread:
[Dpge-commits] CVS: dpge/linux/debugi386/linux/test texture3di386,1.1.1.1,NONE
- Index(es):