[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dpge-commits] CVS: dpge/client cl_fx.c,1.1.1.1,1.2 cl_newfx.c,1.1.1.1,1
From: |
Paul G. Allen <address@hidden> |
Subject: |
[Dpge-commits] CVS: dpge/client cl_fx.c,1.1.1.1,1.2 cl_newfx.c,1.1.1.1,1.2 cl_tent.c,1.1.1.1,1.2 cl_view.c,1.1.1.1,1.2 ref.h,1.1.1.1,1.2 |
Date: |
Tue, 26 Feb 2002 06:20:40 -0500 |
Update of /cvsroot/dpge/dpge/client
In directory subversions:/tmp/cvs-serv27509/dpge/client
Modified Files:
cl_fx.c cl_newfx.c cl_tent.c cl_view.c ref.h
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: cl_fx.c
===================================================================
RCS file: /cvsroot/dpge/dpge/client/cl_fx.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** cl_fx.c 23 Feb 2002 01:29:20 -0000 1.1.1.1
--- cl_fx.c 26 Feb 2002 11:20:37 -0000 1.2
***************
*** 2838,2850 ****
angle = ( ltime * avelocities[ i ][ 0 ] );
sy = sin( angle );
! cy = cos( angle );
angle = ( ltime * avelocities[ i ][ 1 ] );
sp = sin( angle );
! cp = cos( angle );
angle = ( ltime * avelocities[ i ][ 2 ] );
sr = sin( angle );
! cr = cos( angle );
forward[ 0 ] = ( cp * cy );
--- 2838,2850 ----
angle = ( ltime * avelocities[ i ][ 0 ] );
sy = sin( angle );
! cy = qCos(_180_PI*angle);
angle = ( ltime * avelocities[ i ][ 1 ] );
sp = sin( angle );
! cp = qCos(_180_PI*angle);
angle = ( ltime * avelocities[ i ][ 2 ] );
sr = sin( angle );
! cr = qCos(_180_PI*angle);
forward[ 0 ] = ( cp * cy );
***************
*** 3000,3012 ****
angle = ( ltime * avelocities[ i ][ 0 ] );
sy = sin( angle );
! cy = cos( angle );
angle = ( ltime * avelocities[ i ][ 1 ] );
sp = sin( angle );
! cp = cos( angle );
angle = ( ltime * avelocities[ i ][ 2 ] );
sr = sin( angle );
! cr = cos( angle );
forward[ 0 ] = ( cp * cy );
--- 3000,3012 ----
angle = ( ltime * avelocities[ i ][ 0 ] );
sy = sin( angle );
! cy = cos(angle);
angle = ( ltime * avelocities[ i ][ 1 ] );
sp = sin( angle );
! cp = cos(angle);
angle = ( ltime * avelocities[ i ][ 2 ] );
sr = sin( angle );
! cr = cos(angle);
forward[ 0 ] = ( cp * cy );
Index: cl_newfx.c
===================================================================
RCS file: /cvsroot/dpge/dpge/client/cl_newfx.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** cl_newfx.c 23 Feb 2002 01:29:22 -0000 1.1.1.1
--- cl_newfx.c 26 Feb 2002 11:20:37 -0000 1.2
***************
*** 737,741 ****
// variance = 0.4 + ((float)rand()/(float)RAND_MAX) *0.2;
variance = 0.5;
! c = cos(rot)*variance;
s = sin(rot)*variance;
--- 737,741 ----
// variance = 0.4 + ((float)rand()/(float)RAND_MAX) *0.2;
variance = 0.5;
! c = qCos(_180_PI*rot)*variance;
s = sin(rot)*variance;
***************
*** 1107,1111 ****
p->color = particleColor;
dist = DotProduct(move, forward);
! VectorMA(move, 8 * cos(dist), up, p->org);
for (j=0 ; j<3 ; j++)
{
--- 1107,1111 ----
p->color = particleColor;
dist = DotProduct(move, forward);
! VectorMA(move, 8 * qCos(_180_PI*dist), up, p->org);
for (j=0 ; j<3 ; j++)
{
***************
*** 1837,1841 ****
for ( j = 0; j < 3; j++ )
{
! Particle->vel[ j ] = ( (rand() % 90) - 45 );//( (rand() % 384) -
192 );//( (rand() % 90) - 80 );
}
// Particle->vel[ 2 ] += frand()*1;
--- 1837,1841 ----
for ( j = 0; j < 3; j++ )
{
! Particle->vel[ j ] = ( (rand() % 100) - 50 );//( (rand() % 384) -
192 );//( (rand() % 90) - 80 );
}
// Particle->vel[ 2 ] += frand()*1;
***************
*** 1918,1923 ****
case PART_EXPSMOKE:
! Particle->accel[ 0 ] = 1+frand()*5;
! Particle->accel[ 1 ] = 1+frand()*5;
Particle->accel[ 2 ] = 1+frand()*5;
break;
--- 1918,1923 ----
case PART_EXPSMOKE:
! Particle->accel[ 0 ] = Particle->vel[ 0 ]/10;//-5+frand()*10;
! Particle->accel[ 1 ] = Particle->vel[ 1 ]/10;//-5+frand()*10;
Particle->accel[ 2 ] = 1+frand()*5;
break;
***************
*** 2222,2232 ****
float angle, dist;
! angle = PIx2 * (rand() & 1023) / 1023.0; //FIXMEDJA: Check for
1/0 first!
dist = ( rand() & 31 );
! Particle->org[ 0 ] = ( SpawnPoint[ 0 ] + cos( angle ) * dist );
! Particle->vel[ 0 ] = ( cos( angle ) * ( 70 + (rand() & 63) ) );
! Particle->accel[ 0 ] = ( -cos( angle ) * 100 );
Particle->org[ 1 ] = ( SpawnPoint[ 1 ] + sin( angle ) * dist );
--- 2222,2232 ----
float angle, dist;
! angle = PIx2 * (rand() & 1023) / 1023.0;
dist = ( rand() & 31 );
! Particle->org[ 0 ] = SpawnPoint[0] +
qCos(_180_PI*angle)*dist;//( SpawnPoint[ 0 ] + cos( angle ) * dist );
! Particle->vel[ 0 ] = ( qCos(_180_PI*angle) * ( 70 + (rand() &
63) ) );
! Particle->accel[ 0 ] = ( -qCos(_180_PI*angle) * 100 );
Particle->org[ 1 ] = ( SpawnPoint[ 1 ] + sin( angle ) * dist );
Index: cl_tent.c
===================================================================
RCS file: /cvsroot/dpge/dpge/client/cl_tent.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** cl_tent.c 23 Feb 2002 01:29:25 -0000 1.1.1.1
--- cl_tent.c 26 Feb 2002 11:20:37 -0000 1.2
***************
*** 999,1003 ****
{
S_StartSound (pos, 0, 0, cl_sfx_grenexp, 1, ATTN_NORM, 0);
! CL_ParticleSpray(PART_EXPSMOKE, pos, dir, RGBColor, 128);
}
break;
--- 999,1003 ----
{
S_StartSound (pos, 0, 0, cl_sfx_grenexp, 1, ATTN_NORM, 0);
! CL_ParticleSpray(PART_EXPSMOKE, pos, dir, RGBColor, 64);
}
break;
***************
*** 1088,1092 ****
{
S_StartSound (pos, 0, 0, cl_sfx_rockexp, 1, ATTN_NORM, 0);
! CL_ParticleSpray(PART_EXPSMOKE, pos, dir, RGBColor, 128);
}
break;
--- 1088,1092 ----
{
S_StartSound (pos, 0, 0, cl_sfx_rockexp, 1, ATTN_NORM, 0);
! CL_ParticleSpray(PART_EXPSMOKE, pos, dir, RGBColor, 64);
}
break;
***************
*** 1464,1468 ****
CL_ParticleSpray(PART_EXPLODE, pos, dir, RGBColor, 128);
! CL_ParticleSpray(PART_EXPSMOKE, pos, dir, RGBColor, 128);
}
// CL_Tracker_Explode (pos);
--- 1464,1468 ----
CL_ParticleSpray(PART_EXPLODE, pos, dir, RGBColor, 128);
! CL_ParticleSpray(PART_EXPSMOKE, pos, dir, RGBColor, 64);
}
// CL_Tracker_Explode (pos);
Index: cl_view.c
===================================================================
RCS file: /cvsroot/dpge/dpge/client/cl_view.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** cl_view.c 23 Feb 2002 01:29:25 -0000 1.1.1.1
--- cl_view.c 26 Feb 2002 11:20:37 -0000 1.2
***************
*** 44,60 ****
! int r_numdlights;
! dlight_t r_dlights[MAX_DLIGHTS];
! int r_numentities;
! entity_t r_entities[MAX_ENTITIES];
! int r_numparticles;
! particle_t r_particles[MAX_PARTICLES];
lightstyle_t r_lightstyles[MAX_LIGHTSTYLES];
! char cl_weaponmodels[MAX_CLIENTWEAPONMODELS][MAX_QPATH];
! int num_cl_weaponmodels;
/*
--- 44,64 ----
! int r_numdlights;
! dlight_t r_dlights[MAX_DLIGHTS];
! int r_numentities;
! entity_t r_entities[MAX_ENTITIES];
! int r_numparticles;
! particle_t r_particles[MAX_PARTICLES];
lightstyle_t r_lightstyles[MAX_LIGHTSTYLES];
! char cl_weaponmodels[MAX_CLIENTWEAPONMODELS][MAX_QPATH];
! int num_cl_weaponmodels;
!
! // PGA 2/25/02: New ounified object list
! uint NumObjects = 0;
! object_t Objects[MAX_DLIGHTS+MAX_ENTITIES+MAX_PARTICLES];
/*
***************
*** 575,581 ****
int ParticleCompare( const particle_t *a, const particle_t *b )
{
! float Diffa, Diffb;
!
! if (cl.refdef.vieworg[1] < a->origin[1])
{
Diffa = a->origin[1] - cl.refdef.vieworg[1];
--- 579,585 ----
int ParticleCompare( const particle_t *a, const particle_t *b )
{
! vec3_t Diffa, Diffb;
!
! /* if (cl.refdef.vieworg[1] < a->origin[1])
{
Diffa = a->origin[1] - cl.refdef.vieworg[1];
***************
*** 603,607 ****
return -1;
}
! return 0;
}
--- 607,655 ----
return -1;
}
! return 1;*/
! }
!
!
! // PGA 2/24/02: New object sorting function. This function z-sorts
! // entities, particles, and dlights.
! int ObjectCompare( const object_t *a, const object_t *b )
! {
! float Diffa, Diffb;
! int Result;
! vec_t Length;
!
! Result = VecCompareLargest( cl.refdef.vieworg, a->Location, b->Location,
Length );
! if (Result == 0)
! return 1;
!
! return Result;
!
! /* if (cl.refdef.vieworg[1] < a->Location[1])
! {
! Diffa = a->Location[1] - cl.refdef.vieworg[1];
! }
! else
! {
! Diffa = cl.refdef.vieworg[1] - a->Location[1];
! }
!
! if (cl.refdef.vieworg[1] < b->Location[1])
! {
! Diffb = b->Location[1] - cl.refdef.vieworg[1];
! }
! else
! {
! Diffb = cl.refdef.vieworg[1] - b->Location[1];
! }
!
! if (Diffa < Diffb)
! {
! return -1;
! }
! if (Diffa > Diffb)
! {
! return 1;
! }
! return 1;*/
}
***************
*** 689,696 ****
}
! cl.refdef.num_entities = r_numentities;
! cl.refdef.entities = r_entities;
! cl.refdef.num_particles = r_numparticles;
! cl.refdef.particles = r_particles;
cl.refdef.num_dlights = r_numdlights;
cl.refdef.dlights = r_dlights;
--- 737,744 ----
}
! // cl.refdef.num_entities = r_numentities;
! // cl.refdef.entities = r_entities;
! // cl.refdef.num_particles = r_numparticles;
! // cl.refdef.particles = r_particles;
cl.refdef.num_dlights = r_numdlights;
cl.refdef.dlights = r_dlights;
***************
*** 699,707 ****
cl.refdef.rdflags = cl.frame.playerstate.rdflags;
// sort entities for better cache locality
// PGA 2/08/02: Changed sort function to z-sort entities for
transparency.
! qsort( cl.refdef.entities, cl.refdef.num_entities, sizeof(
cl.refdef.entities[0] ), (int (*)( const void *, const void *))entitycmpfnc3 );
// PGA 2/20/02: Particles have to be z-sorted as well.
! qsort( cl.refdef.particles, cl.refdef.num_particles, sizeof(
cl.refdef.particles[0] ), (int (*)( const void *, const void *))ParticleCompare
);
}
--- 747,798 ----
cl.refdef.rdflags = cl.frame.playerstate.rdflags;
+ // PGA 2/14/02: New object code. This enables rendering all objects in
a single pass
+ // correctly sorted.
+ cl.refdef.Objects = Objects;
+
+ {
+ int i = 0, j = 0;
+
+ for (i = 0; i < r_numparticles; i++)
+ {
+ cl.refdef.Objects[j].Particle = &r_particles[i];
+ cl.refdef.Objects[j].Entity = NULL;
+ cl.refdef.Objects[j].DynamicLight = NULL;
+ cl.refdef.Objects[j].Location[0] = r_particles[i].origin[0];
+ cl.refdef.Objects[j].Location[1] = r_particles[i].origin[1];
+ cl.refdef.Objects[j].Location[2] = r_particles[i].origin[2];
+ j++;
+ }
+ for (i = 0; i < r_numentities; i++)
+ {
+ cl.refdef.Objects[j].Particle = NULL;
+ cl.refdef.Objects[j].Entity = &r_entities[i];
+ cl.refdef.Objects[j].DynamicLight = NULL;
+ cl.refdef.Objects[j].Location[0] = r_entities[i].origin[0];
+ cl.refdef.Objects[j].Location[1] = r_entities[i].origin[1];
+ cl.refdef.Objects[j].Location[2] = r_entities[i].origin[2];
+ j++;
+ }
+ /* for (i = 0; i < r_numdlights; i++)
+ {
+ cl.refdef.Objects[j].Particle = NULL;
+ cl.refdef.Objects[j].Entity = NULL;
+ cl.refdef.Objects[j].DynamicLight = &r_dlights[i];
+ cl.refdef.Objects[j].Location[0] = r_dlights[i].origin[0];
+ cl.refdef.Objects[j].Location[1] = r_dlights[i].origin[1];
+ cl.refdef.Objects[j].Location[2] = r_dlights[i].origin[2];
+ j++;
+ }*/
+ cl.refdef.NumObjects = j;
+ }
+
+ qsort( cl.refdef.Objects, cl.refdef.NumObjects, sizeof(
cl.refdef.Objects[0] ), (int (*)( const void *, const void *))ObjectCompare );
+
+
// sort entities for better cache locality
// PGA 2/08/02: Changed sort function to z-sort entities for
transparency.
! // qsort( cl.refdef.entities, cl.refdef.num_entities, sizeof(
cl.refdef.entities[0] ), (int (*)( const void *, const void *))entitycmpfnc3 );
// PGA 2/20/02: Particles have to be z-sorted as well.
! // qsort( cl.refdef.particles, cl.refdef.num_particles, sizeof(
cl.refdef.particles[0] ), (int (*)( const void *, const void *))ParticleCompare
);
}
Index: ref.h
===================================================================
RCS file: /cvsroot/dpge/dpge/client/ref.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** ref.h 23 Feb 2002 01:29:30 -0000 1.1.1.1
--- ref.h 26 Feb 2002 11:20:37 -0000 1.2
***************
*** 198,202 ****
qboolean FrameDir;// Direction frames increment. 1 = down.
} ptype_t;
!
// PGA End
--- 198,202 ----
qboolean FrameDir;// Direction frames increment. 1 = down.
} ptype_t;
!
// PGA End
***************
*** 217,220 ****
--- 217,230 ----
} lightstyle_t;
+ // PGA 2/24/02: New struct for single pass, z-sorted rendering
+
+ typedef struct object_s
+ {
+ vec3_t Location; // This objects world coordinates, used for
sorting
+ particle_t* Particle; // !NULL if a particle
+ dlight_t* DynamicLight; // !NULL if a dlight
+ entity_t* Entity; // !NULL if an entity
+ } object_t;
+
typedef struct
{
***************
*** 227,242 ****
int rdflags; // RDF_UNDERWATER, etc
! byte *areabits; // if not NULL, only areas with set
bits will be drawn
! lightstyle_t *lightstyles; // [MAX_LIGHTSTYLES]
int num_entities;
! entity_t *entities;
int num_dlights;
! dlight_t *dlights;
int num_particles;
! particle_t *particles;
// PGA 01/01/02: Stereo camera adjustment
--- 237,258 ----
int rdflags; // RDF_UNDERWATER, etc
! byte* areabits; // if not NULL, only areas with set
bits will be drawn
! lightstyle_t* lightstyles; // [MAX_LIGHTSTYLES]
int num_entities;
! entity_t* entities;
int num_dlights;
! dlight_t* dlights;
int num_particles;
! particle_t* particles;
!
! // PGA 2/24/02: z sorted object struct array
! uint NumObjects; // Total number of objects
! object_t* Objects; // Object list
!
!
// PGA 01/01/02: Stereo camera adjustment
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dpge-commits] CVS: dpge/client cl_fx.c,1.1.1.1,1.2 cl_newfx.c,1.1.1.1,1.2 cl_tent.c,1.1.1.1,1.2 cl_view.c,1.1.1.1,1.2 ref.h,1.1.1.1,1.2,
Paul G. Allen <address@hidden> <=
- Prev by Date:
[Dpge-commits] CVS: dpge/linux/debugi386/linux/test texture3di386,1.1.1.1,NONE
- Next by Date:
[Dpge-commits] CVS: dpge/game g_turret.c,1.1.1.1,1.2 q_shared.c,1.1.1.1,1.2 q_shared.h,1.1.1.1,1.2
- Previous by thread:
[Dpge-commits] CVS: dpge/linux/debugi386/linux/test texture3di386,1.1.1.1,NONE
- Next by thread:
[Dpge-commits] CVS: dpge/game g_turret.c,1.1.1.1,1.2 q_shared.c,1.1.1.1,1.2 q_shared.h,1.1.1.1,1.2
- Index(es):