'or' is a c++ operator so rename variables to avoid it

This commit is contained in:
Jonathan Gray 2013-04-23 10:01:12 +10:00
parent 73b8d667f7
commit a06907e8f5
14 changed files with 188 additions and 188 deletions

View file

@ -482,10 +482,10 @@ void RB_BeginDrawingView (void) {
plane[2] = backEnd.viewParms.portalPlane.normal[2];
plane[3] = backEnd.viewParms.portalPlane.dist;
plane2[0] = DotProduct (backEnd.viewParms.or.axis[0], plane);
plane2[1] = DotProduct (backEnd.viewParms.or.axis[1], plane);
plane2[2] = DotProduct (backEnd.viewParms.or.axis[2], plane);
plane2[3] = DotProduct (plane, backEnd.viewParms.or.origin) - plane[3];
plane2[0] = DotProduct (backEnd.viewParms.ori.axis[0], plane);
plane2[1] = DotProduct (backEnd.viewParms.ori.axis[1], plane);
plane2[2] = DotProduct (backEnd.viewParms.ori.axis[2], plane);
plane2[3] = DotProduct (plane, backEnd.viewParms.ori.origin) - plane[3];
qglLoadMatrixf( s_flipMatrix );
qglClipPlane (GL_CLIP_PLANE0, plane2);
@ -591,11 +591,11 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
backEnd.refdef.floatTime = originalTime - backEnd.currentEntity->e.shaderTime;
// set up the transformation matrix
R_RotateForEntity( backEnd.currentEntity, &backEnd.viewParms, &backEnd.or );
R_RotateForEntity( backEnd.currentEntity, &backEnd.viewParms, &backEnd.ori );
// set up the dynamic lighting if needed
if ( backEnd.currentEntity->needDlights ) {
R_TransformDlights( backEnd.refdef.num_dlights, backEnd.refdef.dlights, &backEnd.or );
R_TransformDlights( backEnd.refdef.num_dlights, backEnd.refdef.dlights, &backEnd.ori );
}
if ( backEnd.currentEntity->e.renderfx & RF_DEPTHHACK ) {
@ -605,11 +605,11 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
} else {
backEnd.currentEntity = &tr.worldEntity;
backEnd.refdef.floatTime = originalTime;
backEnd.or = backEnd.viewParms.world;
R_TransformDlights( backEnd.refdef.num_dlights, backEnd.refdef.dlights, &backEnd.or );
backEnd.ori = backEnd.viewParms.world;
R_TransformDlights( backEnd.refdef.num_dlights, backEnd.refdef.dlights, &backEnd.ori );
}
qglLoadMatrixf( backEnd.or.modelMatrix );
qglLoadMatrixf( backEnd.ori.modelMatrix );
//
// change depthrange if needed

View file

@ -23,15 +23,15 @@ Used by both the front end (for DlightBmodel) and
the back end (before doing the lighting calculation)
===============
*/
void R_TransformDlights( int count, dlight_t *dl, orientationr_t *or) {
void R_TransformDlights( int count, dlight_t *dl, orientationr_t *ori) {
int i;
vec3_t temp;
for ( i = 0 ; i < count ; i++, dl++ ) {
VectorSubtract( dl->origin, or->origin, temp );
dl->transformed[0] = DotProduct( temp, or->axis[0] );
dl->transformed[1] = DotProduct( temp, or->axis[1] );
dl->transformed[2] = DotProduct( temp, or->axis[2] );
VectorSubtract( dl->origin, ori->origin, temp );
dl->transformed[0] = DotProduct( temp, ori->axis[0] );
dl->transformed[1] = DotProduct( temp, ori->axis[1] );
dl->transformed[2] = DotProduct( temp, ori->axis[2] );
}
}
@ -49,7 +49,7 @@ void R_DlightBmodel( bmodel_t *bmodel ) {
msurface_t *surf;
// transform all the lights
R_TransformDlights( tr.refdef.num_dlights, tr.refdef.dlights, &tr.or );
R_TransformDlights( tr.refdef.num_dlights, tr.refdef.dlights, &tr.ori );
mask = 0;
for ( i=0 ; i<tr.refdef.num_dlights ; i++ ) {

View file

@ -519,7 +519,7 @@ typedef struct {
} fog_t;
typedef struct {
orientationr_t or;
orientationr_t ori;
orientationr_t world;
vec3_t pvsOrigin; // may be different than or.origin for portals
qboolean isPortal; // true if this view is through a portal
@ -917,7 +917,7 @@ typedef struct {
int smpFrame;
trRefdef_t refdef;
viewParms_t viewParms;
orientationr_t or;
orientationr_t ori;
backEndCounters_t pc;
qboolean isHyperspace;
trRefEntity_t *currentEntity;
@ -985,7 +985,7 @@ typedef struct {
int identityLightByte; // identityLight * 255
int overbrightBits; // r_overbrightBits->integer, but set to 0 if no hw gamma
orientationr_t or; // for current entity
orientationr_t ori; // for current entity
trRefdef_t refdef;
@ -1215,7 +1215,7 @@ int R_CullLocalBox (vec3_t bounds[2]);
int R_CullPointAndRadius( vec3_t origin, float radius );
int R_CullLocalPointAndRadius( vec3_t origin, float radius );
void R_RotateForEntity( const trRefEntity_t *ent, const viewParms_t *viewParms, orientationr_t *or );
void R_RotateForEntity( const trRefEntity_t *ent, const viewParms_t *viewParms, orientationr_t *ori );
/*
** GL wrapper/helper functions
@ -1478,7 +1478,7 @@ LIGHTS
void R_DlightBmodel( bmodel_t *bmodel );
void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent );
void R_TransformDlights( int count, dlight_t *dl, orientationr_t *or );
void R_TransformDlights( int count, dlight_t *dl, orientationr_t *ori );
/*

View file

@ -55,10 +55,10 @@ int R_CullLocalBox (vec3_t bounds[2]) {
v[1] = bounds[(i>>1)&1][1];
v[2] = bounds[(i>>2)&1][2];
VectorCopy( tr.or.origin, transformed[i] );
VectorMA( transformed[i], v[0], tr.or.axis[0], transformed[i] );
VectorMA( transformed[i], v[1], tr.or.axis[1], transformed[i] );
VectorMA( transformed[i], v[2], tr.or.axis[2], transformed[i] );
VectorCopy( tr.ori.origin, transformed[i] );
VectorMA( transformed[i], v[0], tr.ori.axis[0], transformed[i] );
VectorMA( transformed[i], v[1], tr.ori.axis[1], transformed[i] );
VectorMA( transformed[i], v[2], tr.ori.axis[2], transformed[i] );
}
// check against frustum planes
@ -164,9 +164,9 @@ R_LocalNormalToWorld
=================
*/
void R_LocalNormalToWorld (vec3_t local, vec3_t world) {
world[0] = local[0] * tr.or.axis[0][0] + local[1] * tr.or.axis[1][0] + local[2] * tr.or.axis[2][0];
world[1] = local[0] * tr.or.axis[0][1] + local[1] * tr.or.axis[1][1] + local[2] * tr.or.axis[2][1];
world[2] = local[0] * tr.or.axis[0][2] + local[1] * tr.or.axis[1][2] + local[2] * tr.or.axis[2][2];
world[0] = local[0] * tr.ori.axis[0][0] + local[1] * tr.ori.axis[1][0] + local[2] * tr.ori.axis[2][0];
world[1] = local[0] * tr.ori.axis[0][1] + local[1] * tr.ori.axis[1][1] + local[2] * tr.ori.axis[2][1];
world[2] = local[0] * tr.ori.axis[0][2] + local[1] * tr.ori.axis[1][2] + local[2] * tr.ori.axis[2][2];
}
/*
@ -176,9 +176,9 @@ R_LocalPointToWorld
=================
*/
void R_LocalPointToWorld (vec3_t local, vec3_t world) {
world[0] = local[0] * tr.or.axis[0][0] + local[1] * tr.or.axis[1][0] + local[2] * tr.or.axis[2][0] + tr.or.origin[0];
world[1] = local[0] * tr.or.axis[0][1] + local[1] * tr.or.axis[1][1] + local[2] * tr.or.axis[2][1] + tr.or.origin[1];
world[2] = local[0] * tr.or.axis[0][2] + local[1] * tr.or.axis[1][2] + local[2] * tr.or.axis[2][2] + tr.or.origin[2];
world[0] = local[0] * tr.ori.axis[0][0] + local[1] * tr.ori.axis[1][0] + local[2] * tr.ori.axis[2][0] + tr.ori.origin[0];
world[1] = local[0] * tr.ori.axis[0][1] + local[1] * tr.ori.axis[1][1] + local[2] * tr.ori.axis[2][1] + tr.ori.origin[1];
world[2] = local[0] * tr.ori.axis[0][2] + local[1] * tr.ori.axis[1][2] + local[2] * tr.ori.axis[2][2] + tr.ori.origin[2];
}
float preTransEntMatrix[16];
@ -239,9 +239,9 @@ R_WorldToLocal
=================
*/
void R_WorldToLocal (vec3_t world, vec3_t local) {
local[0] = DotProduct(world, tr.or.axis[0]);
local[1] = DotProduct(world, tr.or.axis[1]);
local[2] = DotProduct(world, tr.or.axis[2]);
local[0] = DotProduct(world, tr.ori.axis[0]);
local[1] = DotProduct(world, tr.ori.axis[1]);
local[2] = DotProduct(world, tr.ori.axis[2]);
}
/*
@ -321,47 +321,47 @@ Called by both the front end and the back end
=================
*/
void R_RotateForEntity( const trRefEntity_t *ent, const viewParms_t *viewParms,
orientationr_t *or ) {
orientationr_t *ori ) {
// float glMatrix[16];
vec3_t delta;
float axisLength;
if ( ent->e.reType != RT_MODEL ) {
*or = viewParms->world;
*ori = viewParms->world;
return;
}
VectorCopy( ent->e.origin, or->origin );
VectorCopy( ent->e.origin, ori->origin );
VectorCopy( ent->e.axis[0], or->axis[0] );
VectorCopy( ent->e.axis[1], or->axis[1] );
VectorCopy( ent->e.axis[2], or->axis[2] );
VectorCopy( ent->e.axis[0], ori->axis[0] );
VectorCopy( ent->e.axis[1], ori->axis[1] );
VectorCopy( ent->e.axis[2], ori->axis[2] );
preTransEntMatrix[0] = or->axis[0][0];
preTransEntMatrix[4] = or->axis[1][0];
preTransEntMatrix[8] = or->axis[2][0];
preTransEntMatrix[12] = or->origin[0];
preTransEntMatrix[0] = ori->axis[0][0];
preTransEntMatrix[4] = ori->axis[1][0];
preTransEntMatrix[8] = ori->axis[2][0];
preTransEntMatrix[12] = ori->origin[0];
preTransEntMatrix[1] = or->axis[0][1];
preTransEntMatrix[5] = or->axis[1][1];
preTransEntMatrix[9] = or->axis[2][1];
preTransEntMatrix[13] = or->origin[1];
preTransEntMatrix[1] = ori->axis[0][1];
preTransEntMatrix[5] = ori->axis[1][1];
preTransEntMatrix[9] = ori->axis[2][1];
preTransEntMatrix[13] = ori->origin[1];
preTransEntMatrix[2] = or->axis[0][2];
preTransEntMatrix[6] = or->axis[1][2];
preTransEntMatrix[10] = or->axis[2][2];
preTransEntMatrix[14] = or->origin[2];
preTransEntMatrix[2] = ori->axis[0][2];
preTransEntMatrix[6] = ori->axis[1][2];
preTransEntMatrix[10] = ori->axis[2][2];
preTransEntMatrix[14] = ori->origin[2];
preTransEntMatrix[3] = 0;
preTransEntMatrix[7] = 0;
preTransEntMatrix[11] = 0;
preTransEntMatrix[15] = 1;
myGlMultMatrix( preTransEntMatrix, viewParms->world.modelMatrix, or->modelMatrix );
myGlMultMatrix( preTransEntMatrix, viewParms->world.modelMatrix, ori->modelMatrix );
// calculate the viewer origin in the model's space
// needed for fog, specular, and environment mapping
VectorSubtract( viewParms->or.origin, or->origin, delta );
VectorSubtract( viewParms->ori.origin, ori->origin, delta );
// compensate for scale in the axes if necessary
if ( ent->e.nonNormalizedAxes ) {
@ -375,9 +375,9 @@ void R_RotateForEntity( const trRefEntity_t *ent, const viewParms_t *viewParms,
axisLength = 1.0;
}
or->viewOrigin[0] = DotProduct( delta, or->axis[0] ) * axisLength;
or->viewOrigin[1] = DotProduct( delta, or->axis[1] ) * axisLength;
or->viewOrigin[2] = DotProduct( delta, or->axis[2] ) * axisLength;
ori->viewOrigin[0] = DotProduct( delta, ori->axis[0] ) * axisLength;
ori->viewOrigin[1] = DotProduct( delta, ori->axis[1] ) * axisLength;
ori->viewOrigin[2] = DotProduct( delta, ori->axis[2] ) * axisLength;
}
/*
@ -392,28 +392,28 @@ void R_RotateForViewer (void)
float viewerMatrix[16];
vec3_t origin;
memset (&tr.or, 0, sizeof(tr.or));
tr.or.axis[0][0] = 1;
tr.or.axis[1][1] = 1;
tr.or.axis[2][2] = 1;
VectorCopy (tr.viewParms.or.origin, tr.or.viewOrigin);
memset (&tr.ori, 0, sizeof(tr.ori));
tr.ori.axis[0][0] = 1;
tr.ori.axis[1][1] = 1;
tr.ori.axis[2][2] = 1;
VectorCopy (tr.viewParms.ori.origin, tr.ori.viewOrigin);
// transform by the camera placement
VectorCopy( tr.viewParms.or.origin, origin );
VectorCopy( tr.viewParms.ori.origin, origin );
viewerMatrix[0] = tr.viewParms.or.axis[0][0];
viewerMatrix[4] = tr.viewParms.or.axis[0][1];
viewerMatrix[8] = tr.viewParms.or.axis[0][2];
viewerMatrix[0] = tr.viewParms.ori.axis[0][0];
viewerMatrix[4] = tr.viewParms.ori.axis[0][1];
viewerMatrix[8] = tr.viewParms.ori.axis[0][2];
viewerMatrix[12] = -origin[0] * viewerMatrix[0] + -origin[1] * viewerMatrix[4] + -origin[2] * viewerMatrix[8];
viewerMatrix[1] = tr.viewParms.or.axis[1][0];
viewerMatrix[5] = tr.viewParms.or.axis[1][1];
viewerMatrix[9] = tr.viewParms.or.axis[1][2];
viewerMatrix[1] = tr.viewParms.ori.axis[1][0];
viewerMatrix[5] = tr.viewParms.ori.axis[1][1];
viewerMatrix[9] = tr.viewParms.ori.axis[1][2];
viewerMatrix[13] = -origin[0] * viewerMatrix[1] + -origin[1] * viewerMatrix[5] + -origin[2] * viewerMatrix[9];
viewerMatrix[2] = tr.viewParms.or.axis[2][0];
viewerMatrix[6] = tr.viewParms.or.axis[2][1];
viewerMatrix[10] = tr.viewParms.or.axis[2][2];
viewerMatrix[2] = tr.viewParms.ori.axis[2][0];
viewerMatrix[6] = tr.viewParms.ori.axis[2][1];
viewerMatrix[10] = tr.viewParms.ori.axis[2][2];
viewerMatrix[14] = -origin[0] * viewerMatrix[2] + -origin[1] * viewerMatrix[6] + -origin[2] * viewerMatrix[10];
viewerMatrix[3] = 0;
@ -423,9 +423,9 @@ void R_RotateForViewer (void)
// convert from our coordinate system (looking down X)
// to OpenGL's coordinate system (looking down -Z)
myGlMultMatrix( viewerMatrix, s_flipMatrix, tr.or.modelMatrix );
myGlMultMatrix( viewerMatrix, s_flipMatrix, tr.ori.modelMatrix );
tr.viewParms.world = tr.or;
tr.viewParms.world = tr.ori;
}
@ -481,7 +481,7 @@ static void SetFarClip( void )
v[2] = tr.viewParms.visBounds[1][2];
}
VectorSubtract( v, tr.viewParms.or.origin, vecTo );
VectorSubtract( v, tr.viewParms.ori.origin, vecTo );
distance = vecTo[0] * vecTo[0] + vecTo[1] * vecTo[1] + vecTo[2] * vecTo[2];
@ -560,25 +560,25 @@ void R_SetupFrustum (void) {
xs = sin( ang );
xc = cos( ang );
VectorScale( tr.viewParms.or.axis[0], xs, tr.viewParms.frustum[0].normal );
VectorMA( tr.viewParms.frustum[0].normal, xc, tr.viewParms.or.axis[1], tr.viewParms.frustum[0].normal );
VectorScale( tr.viewParms.ori.axis[0], xs, tr.viewParms.frustum[0].normal );
VectorMA( tr.viewParms.frustum[0].normal, xc, tr.viewParms.ori.axis[1], tr.viewParms.frustum[0].normal );
VectorScale( tr.viewParms.or.axis[0], xs, tr.viewParms.frustum[1].normal );
VectorMA( tr.viewParms.frustum[1].normal, -xc, tr.viewParms.or.axis[1], tr.viewParms.frustum[1].normal );
VectorScale( tr.viewParms.ori.axis[0], xs, tr.viewParms.frustum[1].normal );
VectorMA( tr.viewParms.frustum[1].normal, -xc, tr.viewParms.ori.axis[1], tr.viewParms.frustum[1].normal );
ang = tr.viewParms.fovY / 180 * M_PI * 0.5;
xs = sin( ang );
xc = cos( ang );
VectorScale( tr.viewParms.or.axis[0], xs, tr.viewParms.frustum[2].normal );
VectorMA( tr.viewParms.frustum[2].normal, xc, tr.viewParms.or.axis[2], tr.viewParms.frustum[2].normal );
VectorScale( tr.viewParms.ori.axis[0], xs, tr.viewParms.frustum[2].normal );
VectorMA( tr.viewParms.frustum[2].normal, xc, tr.viewParms.ori.axis[2], tr.viewParms.frustum[2].normal );
VectorScale( tr.viewParms.or.axis[0], xs, tr.viewParms.frustum[3].normal );
VectorMA( tr.viewParms.frustum[3].normal, -xc, tr.viewParms.or.axis[2], tr.viewParms.frustum[3].normal );
VectorScale( tr.viewParms.ori.axis[0], xs, tr.viewParms.frustum[3].normal );
VectorMA( tr.viewParms.frustum[3].normal, -xc, tr.viewParms.ori.axis[2], tr.viewParms.frustum[3].normal );
for (i=0 ; i<4 ; i++) {
tr.viewParms.frustum[i].type = PLANE_NON_AXIAL;
tr.viewParms.frustum[i].dist = DotProduct (tr.viewParms.or.origin, tr.viewParms.frustum[i].normal);
tr.viewParms.frustum[i].dist = DotProduct (tr.viewParms.ori.origin, tr.viewParms.frustum[i].normal);
SetPlaneSignbits( &tr.viewParms.frustum[i] );
}
}
@ -698,15 +698,15 @@ qboolean R_GetPortalOrientations( drawSurf_t *drawSurf, int entityNum,
tr.currentEntity = &tr.refdef.entities[entityNum];
// get the orientation of the entity
R_RotateForEntity( tr.currentEntity, &tr.viewParms, &tr.or );
R_RotateForEntity( tr.currentEntity, &tr.viewParms, &tr.ori );
// rotate the plane, but keep the non-rotated version for matching
// against the portalSurface entities
R_LocalNormalToWorld( originalPlane.normal, plane.normal );
plane.dist = originalPlane.dist + DotProduct( plane.normal, tr.or.origin );
plane.dist = originalPlane.dist + DotProduct( plane.normal, tr.ori.origin );
// translate the original plane
originalPlane.dist = originalPlane.dist + DotProduct( originalPlane.normal, tr.or.origin );
originalPlane.dist = originalPlane.dist + DotProduct( originalPlane.normal, tr.ori.origin );
} else {
plane = originalPlane;
}
@ -807,15 +807,15 @@ static qboolean IsMirror( const drawSurf_t *drawSurf, int entityNum )
tr.currentEntity = &tr.refdef.entities[entityNum];
// get the orientation of the entity
R_RotateForEntity( tr.currentEntity, &tr.viewParms, &tr.or );
R_RotateForEntity( tr.currentEntity, &tr.viewParms, &tr.ori );
// rotate the plane, but keep the non-rotated version for matching
// against the portalSurface entities
R_LocalNormalToWorld( originalPlane.normal, plane.normal );
plane.dist = originalPlane.dist + DotProduct( plane.normal, tr.or.origin );
plane.dist = originalPlane.dist + DotProduct( plane.normal, tr.ori.origin );
// translate the original plane
originalPlane.dist = originalPlane.dist + DotProduct( originalPlane.normal, tr.or.origin );
originalPlane.dist = originalPlane.dist + DotProduct( originalPlane.normal, tr.ori.origin );
}
else
{
@ -884,7 +884,7 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
int j;
unsigned int pointFlags = 0;
R_TransformModelToClip( tess.xyz[i], tr.or.modelMatrix, tr.viewParms.projectionMatrix, eye, clip );
R_TransformModelToClip( tess.xyz[i], tr.ori.modelMatrix, tr.viewParms.projectionMatrix, eye, clip );
for ( j = 0; j < 3; j++ )
{
@ -920,7 +920,7 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
float dot;
float len;
VectorSubtract( tess.xyz[tess.indexes[i]], tr.viewParms.or.origin, normal );
VectorSubtract( tess.xyz[tess.indexes[i]], tr.viewParms.ori.origin, normal );
len = VectorLengthSquared( normal ); // lose the sqrt
if ( len < shortest )
@ -993,14 +993,14 @@ qboolean R_MirrorViewBySurface (drawSurf_t *drawSurf, int entityNum) {
return qfalse; // bad portal, no portalentity
}
R_MirrorPoint (oldParms.or.origin, &surface, &camera, newParms.or.origin );
R_MirrorPoint (oldParms.ori.origin, &surface, &camera, newParms.ori.origin );
VectorSubtract( vec3_origin, camera.axis[0], newParms.portalPlane.normal );
newParms.portalPlane.dist = DotProduct( camera.origin, newParms.portalPlane.normal );
R_MirrorVector (oldParms.or.axis[0], &surface, &camera, newParms.or.axis[0]);
R_MirrorVector (oldParms.or.axis[1], &surface, &camera, newParms.or.axis[1]);
R_MirrorVector (oldParms.or.axis[2], &surface, &camera, newParms.or.axis[2]);
R_MirrorVector (oldParms.ori.axis[0], &surface, &camera, newParms.ori.axis[0]);
R_MirrorVector (oldParms.ori.axis[1], &surface, &camera, newParms.ori.axis[1]);
R_MirrorVector (oldParms.ori.axis[2], &surface, &camera, newParms.ori.axis[2]);
// OPTIMIZE: restrict the viewport on the mirrored view
@ -1432,8 +1432,8 @@ void R_AddEntitySurfaces (void) {
break;
case RT_MODEL:
// we must set up parts of tr.or for model culling
R_RotateForEntity( ent, &tr.viewParms, &tr.or );
// we must set up parts of tr.ori for model culling
R_RotateForEntity( ent, &tr.viewParms, &tr.ori );
tr.currentModel = R_GetModelByHandle( ent->e.hModel );
if (!tr.currentModel) {

View file

@ -18,8 +18,8 @@ float ProjectRadius( float r, vec3_t location )
vec3_t p;
float projected[4];
c = DotProduct( tr.viewParms.or.axis[0], tr.viewParms.or.origin );
dist = DotProduct( tr.viewParms.or.axis[0], location ) - c;
c = DotProduct( tr.viewParms.ori.axis[0], tr.viewParms.ori.origin );
dist = DotProduct( tr.viewParms.ori.axis[0], location ) - c;
if ( dist <= 0 )
return 0;

View file

@ -354,10 +354,10 @@ void RE_RenderScene( const refdef_t *fd ) {
parms.fovX = tr.refdef.fov_x;
parms.fovY = tr.refdef.fov_y;
VectorCopy( fd->vieworg, parms.or.origin );
VectorCopy( fd->viewaxis[0], parms.or.axis[0] );
VectorCopy( fd->viewaxis[1], parms.or.axis[1] );
VectorCopy( fd->viewaxis[2], parms.or.axis[2] );
VectorCopy( fd->vieworg, parms.ori.origin );
VectorCopy( fd->viewaxis[0], parms.ori.axis[0] );
VectorCopy( fd->viewaxis[1], parms.ori.axis[1] );
VectorCopy( fd->viewaxis[2], parms.ori.axis[2] );
VectorCopy( fd->vieworg, parms.pvsOrigin );

View file

@ -1073,7 +1073,7 @@ static void ComputeColors( shaderStage_t *pStage, int forceAlphaGen, int forceRG
float len;
vec3_t v;
VectorSubtract( tess.xyz[i], backEnd.viewParms.or.origin, v );
VectorSubtract( tess.xyz[i], backEnd.viewParms.ori.origin, v );
len = VectorLength( v );
len /= tess.shader->portalRange;

View file

@ -341,9 +341,9 @@ GlobalVectorToLocal
==================
*/
static void GlobalVectorToLocal( const vec3_t in, vec3_t out ) {
out[0] = DotProduct( in, backEnd.or.axis[0] );
out[1] = DotProduct( in, backEnd.or.axis[1] );
out[2] = DotProduct( in, backEnd.or.axis[2] );
out[0] = DotProduct( in, backEnd.ori.axis[0] );
out[1] = DotProduct( in, backEnd.ori.axis[1] );
out[2] = DotProduct( in, backEnd.ori.axis[2] );
}
/*
@ -375,11 +375,11 @@ static void AutospriteDeform( void ) {
tess.numIndexes = 0;
if ( backEnd.currentEntity != &tr.worldEntity ) {
GlobalVectorToLocal( backEnd.viewParms.or.axis[1], leftDir );
GlobalVectorToLocal( backEnd.viewParms.or.axis[2], upDir );
GlobalVectorToLocal( backEnd.viewParms.ori.axis[1], leftDir );
GlobalVectorToLocal( backEnd.viewParms.ori.axis[2], upDir );
} else {
VectorCopy( backEnd.viewParms.or.axis[1], leftDir );
VectorCopy( backEnd.viewParms.or.axis[2], upDir );
VectorCopy( backEnd.viewParms.ori.axis[1], leftDir );
VectorCopy( backEnd.viewParms.ori.axis[2], upDir );
}
for ( i = 0 ; i < oldVerts ; i+=4 ) {
@ -435,9 +435,9 @@ static void Autosprite2Deform( void ) {
}
if ( backEnd.currentEntity != &tr.worldEntity ) {
GlobalVectorToLocal( backEnd.viewParms.or.axis[0], forward );
GlobalVectorToLocal( backEnd.viewParms.ori.axis[0], forward );
} else {
VectorCopy( backEnd.viewParms.or.axis[0], forward );
VectorCopy( backEnd.viewParms.ori.axis[0], forward );
}
// this is a lot of work for two triangles...
@ -814,11 +814,11 @@ void RB_CalcFogTexCoords( float *st ) {
fog = tr.world->fogs + tess.fogNum;
// all fogging distance is based on world Z units
VectorSubtract( backEnd.or.origin, backEnd.viewParms.or.origin, localVec );
fogDistanceVector[0] = -backEnd.or.modelMatrix[2];
fogDistanceVector[1] = -backEnd.or.modelMatrix[6];
fogDistanceVector[2] = -backEnd.or.modelMatrix[10];
fogDistanceVector[3] = DotProduct( localVec, backEnd.viewParms.or.axis[0] );
VectorSubtract( backEnd.ori.origin, backEnd.viewParms.ori.origin, localVec );
fogDistanceVector[0] = -backEnd.ori.modelMatrix[2];
fogDistanceVector[1] = -backEnd.ori.modelMatrix[6];
fogDistanceVector[2] = -backEnd.ori.modelMatrix[10];
fogDistanceVector[3] = DotProduct( localVec, backEnd.viewParms.ori.axis[0] );
// scale the fog vectors based on the fog's thickness
fogDistanceVector[0] *= fog->tcScale;
@ -828,15 +828,15 @@ void RB_CalcFogTexCoords( float *st ) {
// rotate the gradient vector for this orientation
if ( fog->hasSurface ) {
fogDepthVector[0] = fog->surface[0] * backEnd.or.axis[0][0] +
fog->surface[1] * backEnd.or.axis[0][1] + fog->surface[2] * backEnd.or.axis[0][2];
fogDepthVector[1] = fog->surface[0] * backEnd.or.axis[1][0] +
fog->surface[1] * backEnd.or.axis[1][1] + fog->surface[2] * backEnd.or.axis[1][2];
fogDepthVector[2] = fog->surface[0] * backEnd.or.axis[2][0] +
fog->surface[1] * backEnd.or.axis[2][1] + fog->surface[2] * backEnd.or.axis[2][2];
fogDepthVector[3] = -fog->surface[3] + DotProduct( backEnd.or.origin, fog->surface );
fogDepthVector[0] = fog->surface[0] * backEnd.ori.axis[0][0] +
fog->surface[1] * backEnd.ori.axis[0][1] + fog->surface[2] * backEnd.ori.axis[0][2];
fogDepthVector[1] = fog->surface[0] * backEnd.ori.axis[1][0] +
fog->surface[1] * backEnd.ori.axis[1][1] + fog->surface[2] * backEnd.ori.axis[1][2];
fogDepthVector[2] = fog->surface[0] * backEnd.ori.axis[2][0] +
fog->surface[1] * backEnd.ori.axis[2][1] + fog->surface[2] * backEnd.ori.axis[2][2];
fogDepthVector[3] = -fog->surface[3] + DotProduct( backEnd.ori.origin, fog->surface );
eyeT = DotProduct( backEnd.or.viewOrigin, fogDepthVector ) + fogDepthVector[3];
eyeT = DotProduct( backEnd.ori.viewOrigin, fogDepthVector ) + fogDepthVector[3];
} else {
eyeT = 1; // non-surface fog always has eye inside
fogDepthVector[0] = fogDepthVector[1] = fogDepthVector[2] = 0.0;
@ -906,7 +906,7 @@ void RB_CalcEnvironmentTexCoords( float *st )
} else { //the normal way
for (i = 0 ; i < tess.numVertexes ; i++, v += 4, normal += 4, st += 2 )
{
VectorSubtract (backEnd.or.viewOrigin, v, viewer);
VectorSubtract (backEnd.ori.viewOrigin, v, viewer);
VectorNormalizeFast (viewer);
d = DotProduct (normal, viewer);
@ -1077,7 +1077,7 @@ void RB_CalcSpecularAlpha( unsigned char *alphas ) {
reflected[1] = normal[1]*d - lightDir[1];
reflected[2] = normal[2]*d - lightDir[2];
VectorSubtract (backEnd.or.viewOrigin, v, viewer);
VectorSubtract (backEnd.ori.viewOrigin, v, viewer);
ilength = Q_rsqrt( DotProduct( viewer, viewer ) );
l = DotProduct (reflected, viewer);
l *= ilength;

View file

@ -295,11 +295,11 @@ void RB_ProjectionShadowDeform( void ) {
xyz = ( float * ) tess.xyz;
ground[0] = backEnd.or.axis[0][2];
ground[1] = backEnd.or.axis[1][2];
ground[2] = backEnd.or.axis[2][2];
ground[0] = backEnd.ori.axis[0][2];
ground[1] = backEnd.ori.axis[1][2];
ground[2] = backEnd.ori.axis[2][2];
groundDist = backEnd.or.origin[2] - backEnd.currentEntity->e.shadowPlane;
groundDist = backEnd.ori.origin[2] - backEnd.currentEntity->e.shadowPlane;
VectorCopy( backEnd.currentEntity->lightDir, lightDir );
d = DotProduct( lightDir, ground );

View file

@ -254,7 +254,7 @@ void RB_ClipSkyPolygons( shaderCommands_t *input )
for (j = 0 ; j < 3 ; j++)
{
VectorSubtract( input->xyz[input->indexes[i+j]],
backEnd.viewParms.or.origin,
backEnd.viewParms.ori.origin,
p[j] );
}
ClipSkyPolygon( 3, p[0], 0 );
@ -452,7 +452,7 @@ static void FillCloudySkySide( const int mins[2], const int maxs[2], qboolean ad
{
for ( s = mins[0]+HALF_SKY_SUBDIVISIONS; s <= maxs[0]+HALF_SKY_SUBDIVISIONS; s++ )
{
VectorAdd( s_skyPoints[t][s], backEnd.viewParms.or.origin, tess.xyz[tess.numVertexes] );
VectorAdd( s_skyPoints[t][s], backEnd.viewParms.ori.origin, tess.xyz[tess.numVertexes] );
tess.texCoords[tess.numVertexes][0][0] = s_skyTexCoords[t][s][0];
tess.texCoords[tess.numVertexes][0][1] = s_skyTexCoords[t][s][1];
@ -695,7 +695,7 @@ void RB_DrawSun( void ) {
return;
}
qglLoadMatrixf( backEnd.viewParms.world.modelMatrix );
qglTranslatef (backEnd.viewParms.or.origin[0], backEnd.viewParms.or.origin[1], backEnd.viewParms.or.origin[2]);
qglTranslatef (backEnd.viewParms.ori.origin[0], backEnd.viewParms.ori.origin[1], backEnd.viewParms.ori.origin[2]);
dist = backEnd.viewParms.zFar / 1.75; // div sqrt(3)
size = dist * 0.4;
@ -806,7 +806,7 @@ void RB_StageIteratorSky( void ) {
qglPushMatrix ();
GL_State( 0 );
qglTranslatef (backEnd.viewParms.or.origin[0], backEnd.viewParms.or.origin[1], backEnd.viewParms.or.origin[2]);
qglTranslatef (backEnd.viewParms.ori.origin[0], backEnd.viewParms.ori.origin[1], backEnd.viewParms.ori.origin[2]);
DrawSkyBox( tess.shader );

View file

@ -95,7 +95,7 @@ void RB_AddQuadStampExt( vec3_t origin, vec3_t left, vec3_t up, byte *color, flo
// constant normal all the way around
VectorSubtract( vec3_origin, backEnd.viewParms.or.axis[0], normal );
VectorSubtract( vec3_origin, backEnd.viewParms.ori.axis[0], normal );
tess.normal[ndx][0] = tess.normal[ndx+1][0] = tess.normal[ndx+2][0] = tess.normal[ndx+3][0] = normal[0];
tess.normal[ndx][1] = tess.normal[ndx+1][1] = tess.normal[ndx+2][1] = tess.normal[ndx+3][1] = normal[1];
@ -147,8 +147,8 @@ static void RB_SurfaceSprite( void ) {
// calculate the xyz locations for the four corners
radius = backEnd.currentEntity->e.radius;
if ( backEnd.currentEntity->e.rotation == 0 ) {
VectorScale( backEnd.viewParms.or.axis[1], radius, left );
VectorScale( backEnd.viewParms.or.axis[2], radius, up );
VectorScale( backEnd.viewParms.ori.axis[1], radius, left );
VectorScale( backEnd.viewParms.ori.axis[2], radius, up );
} else {
float s, c;
float ang;
@ -157,11 +157,11 @@ static void RB_SurfaceSprite( void ) {
s = sin( ang );
c = cos( ang );
VectorScale( backEnd.viewParms.or.axis[1], c * radius, left );
VectorMA( left, -s * radius, backEnd.viewParms.or.axis[2], left );
VectorScale( backEnd.viewParms.ori.axis[1], c * radius, left );
VectorMA( left, -s * radius, backEnd.viewParms.ori.axis[2], left );
VectorScale( backEnd.viewParms.or.axis[2], c * radius, up );
VectorMA( up, s * radius, backEnd.viewParms.or.axis[1], up );
VectorScale( backEnd.viewParms.ori.axis[2], c * radius, up );
VectorMA( up, s * radius, backEnd.viewParms.ori.axis[1], up );
}
if ( backEnd.viewParms.isMirror ) {
VectorSubtract( vec3_origin, left, left );
@ -364,8 +364,8 @@ void RB_SurfaceLine( void )
VectorCopy( e->origin, start );
// compute side vector
VectorSubtract( start, backEnd.viewParms.or.origin, v1 );
VectorSubtract( end, backEnd.viewParms.or.origin, v2 );
VectorSubtract( start, backEnd.viewParms.ori.origin, v1 );
VectorSubtract( end, backEnd.viewParms.ori.origin, v2 );
CrossProduct( v1, v2, right );
VectorNormalize( right );
@ -404,7 +404,7 @@ static void RB_SurfaceCone( void )
VectorAdd( e->origin, e->oldorigin, midpoint );
VectorScale(midpoint, 0.5, midpoint); // Average start and end
VectorSubtract( midpoint, backEnd.viewParms.or.origin, midpoint );
VectorSubtract( midpoint, backEnd.viewParms.ori.origin, midpoint );
length = VectorNormalize( midpoint );
// this doesn't need to be perfect....just a rough compensation for zoom level is enough
@ -536,7 +536,7 @@ static void RB_SurfaceCylinder( void )
VectorAdd( e->origin, e->oldorigin, midpoint );
VectorScale(midpoint, 0.5, midpoint); // Average start and end
VectorSubtract( midpoint, backEnd.viewParms.or.origin, midpoint );
VectorSubtract( midpoint, backEnd.viewParms.ori.origin, midpoint );
length = VectorNormalize( midpoint );
// this doesn't need to be perfect....just a rough compensation for zoom level is enough
@ -835,8 +835,8 @@ static void RB_SurfaceElectricity()
VectorCopy( e->oldorigin, end );
// compute side vector
VectorSubtract( start, backEnd.viewParms.or.origin, v1 );
VectorSubtract( end, backEnd.viewParms.or.origin, v2 );
VectorSubtract( start, backEnd.viewParms.ori.origin, v1 );
VectorSubtract( end, backEnd.viewParms.ori.origin, v2 );
CrossProduct( v1, v2, right );
VectorNormalize( right );
@ -1116,11 +1116,11 @@ static void DoSprite( vec3_t origin, float radius, float rotation )
s = sin( ang );
c = cos( ang );
VectorScale( backEnd.viewParms.or.axis[1], c * radius, left );
VectorMA( left, -s * radius, backEnd.viewParms.or.axis[2], left );
VectorScale( backEnd.viewParms.ori.axis[1], c * radius, left );
VectorMA( left, -s * radius, backEnd.viewParms.ori.axis[2], left );
VectorScale( backEnd.viewParms.or.axis[2], c * radius, up );
VectorMA( up, s * radius, backEnd.viewParms.or.axis[1], up );
VectorScale( backEnd.viewParms.ori.axis[2], c * radius, up );
VectorMA( up, s * radius, backEnd.viewParms.ori.axis[1], up );
if ( backEnd.viewParms.isMirror )
{
@ -1374,15 +1374,15 @@ static float LodErrorForVolume( vec3_t local, float radius ) {
vec3_t world;
float d;
world[0] = local[0] * backEnd.or.axis[0][0] + local[1] * backEnd.or.axis[1][0] +
local[2] * backEnd.or.axis[2][0] + backEnd.or.origin[0];
world[1] = local[0] * backEnd.or.axis[0][1] + local[1] * backEnd.or.axis[1][1] +
local[2] * backEnd.or.axis[2][1] + backEnd.or.origin[1];
world[2] = local[0] * backEnd.or.axis[0][2] + local[1] * backEnd.or.axis[1][2] +
local[2] * backEnd.or.axis[2][2] + backEnd.or.origin[2];
world[0] = local[0] * backEnd.ori.axis[0][0] + local[1] * backEnd.ori.axis[1][0] +
local[2] * backEnd.ori.axis[2][0] + backEnd.ori.origin[0];
world[1] = local[0] * backEnd.ori.axis[0][1] + local[1] * backEnd.ori.axis[1][1] +
local[2] * backEnd.ori.axis[2][1] + backEnd.ori.origin[1];
world[2] = local[0] * backEnd.ori.axis[0][2] + local[1] * backEnd.ori.axis[1][2] +
local[2] * backEnd.ori.axis[2][2] + backEnd.ori.origin[2];
VectorSubtract( world, backEnd.viewParms.or.origin, world );
d = DotProduct( world, backEnd.viewParms.or.axis[0] );
VectorSubtract( world, backEnd.viewParms.ori.origin, world );
d = DotProduct( world, backEnd.viewParms.ori.axis[0] );
if ( d < 0 ) {
d = -d;
@ -1983,7 +1983,7 @@ qboolean RB_TestZFlare( vec3_t point, vec3_t color, vec3_t normal) {
// if the point is off the screen, don't bother adding it
// calculate screen coordinates and depth
R_TransformModelToClip( point, backEnd.or.modelMatrix,
R_TransformModelToClip( point, backEnd.ori.modelMatrix,
backEnd.viewParms.projectionMatrix, eye, clip );
// check to see if the point is completely off screen
@ -2038,15 +2038,15 @@ void RB_SurfaceFlare( srfFlare_t *surf ) {
// calculate the xyz locations for the four corners
radius = r_flareSize->value;
VectorScale( backEnd.viewParms.or.axis[1], radius, left );
VectorScale( backEnd.viewParms.or.axis[2], radius, up );
VectorScale( backEnd.viewParms.ori.axis[1], radius, left );
VectorScale( backEnd.viewParms.ori.axis[2], radius, up );
if ( backEnd.viewParms.isMirror ) {
VectorSubtract( vec3_origin, left, left );
}
VectorMA( surf->origin, 3, surf->normal, origin );
VectorSubtract( origin, backEnd.viewParms.or.origin, dir );
VectorSubtract( origin, backEnd.viewParms.ori.origin, dir );
VectorNormalize( dir );
d = -DotProduct( dir, surf->normal );

View file

@ -1429,18 +1429,18 @@ void RB_DrawSurfaceSprites( shaderStage_t *stage, shaderCommands_t *input)
{
if (backEnd.currentEntity == &tr.worldEntity)
{ // Drawing the world, so our job is dead-easy, in the viewparms
VectorCopy(backEnd.viewParms.or.origin, ssViewOrigin);
VectorCopy(backEnd.viewParms.or.axis[1], ssViewRight);
VectorCopy(backEnd.viewParms.or.axis[2], ssViewUp);
VectorCopy(backEnd.viewParms.ori.origin, ssViewOrigin);
VectorCopy(backEnd.viewParms.ori.axis[1], ssViewRight);
VectorCopy(backEnd.viewParms.ori.axis[2], ssViewUp);
}
else
{ // Drawing an entity, so we need to transform the viewparms to the model's coordinate system
// R_WorldPointToEntity (backEnd.viewParms.or.origin, ssViewOrigin);
R_WorldNormalToEntity (backEnd.viewParms.or.axis[1], ssViewRight);
R_WorldNormalToEntity (backEnd.viewParms.or.axis[2], ssViewUp);
VectorCopy(backEnd.or.viewOrigin, ssViewOrigin);
// R_WorldToLocal(backEnd.viewParms.or.axis[1], ssViewRight);
// R_WorldToLocal(backEnd.viewParms.or.axis[2], ssViewUp);
// R_WorldPointToEntity (backEnd.viewParms.ori.origin, ssViewOrigin);
R_WorldNormalToEntity (backEnd.viewParms.ori.axis[1], ssViewRight);
R_WorldNormalToEntity (backEnd.viewParms.ori.axis[2], ssViewUp);
VectorCopy(backEnd.ori.viewOrigin, ssViewOrigin);
// R_WorldToLocal(backEnd.viewParms.ori.axis[1], ssViewRight);
// R_WorldToLocal(backEnd.viewParms.ori.axis[2], ssViewUp);
}
ssLastEntityDrawn = backEnd.currentEntity;
}

View file

@ -125,7 +125,7 @@ static qboolean R_CullSurface( surfaceType_t *surface, shader_t *shader ) {
}
sface = ( srfSurfaceFace_t * ) surface;
d = DotProduct (tr.or.viewOrigin, sface->plane.normal);
d = DotProduct (tr.ori.viewOrigin, sface->plane.normal);
// don't cull exactly on the plane, because there are levels of rounding
// through the BSP, ICD, and hardware that may cause pixel gaps if an

View file

@ -489,8 +489,8 @@ void CMistyFog::Update(CWorldEffectsSystem *system, float elapseTime)
// translate
forwardWind = DotProduct(mWindTransform, backEnd.viewParms.or.axis[0]);
rightWind = DotProduct(mWindTransform, backEnd.viewParms.or.axis[1]);
forwardWind = DotProduct(mWindTransform, backEnd.viewParms.ori.axis[0]);
rightWind = DotProduct(mWindTransform, backEnd.viewParms.ori.axis[1]);
mTextureCoords[0][0] += rightWind / mSpeed;
mTextureCoords[1][0] += rightWind / mSpeed;
@ -640,8 +640,8 @@ void CMistyFog::CreateTextureCoords(void)
mSpeed = 800.0 + FloatRand() * 2000.0;
mSpeed /= 4.0;
forwardWind = DotProduct(mWindTransform, backEnd.viewParms.or.axis[0]);
rightWind = DotProduct(mWindTransform, backEnd.viewParms.or.axis[1]);
forwardWind = DotProduct(mWindTransform, backEnd.viewParms.ori.axis[0]);
rightWind = DotProduct(mWindTransform, backEnd.viewParms.ori.axis[1]);
if (forwardWind > 0.5)
{ // moving away, so make the size smaller
@ -1063,7 +1063,7 @@ void CWind::Update(CWorldEffectsSystem *system, float elapseTime)
return;
}
VectorSubtract(backEnd.viewParms.or.origin, mPoint, difference);
VectorSubtract(backEnd.viewParms.ori.origin, mPoint, difference);
if (VectorLength(difference) > 300.0)
{
return;
@ -1497,7 +1497,7 @@ void CSnowSystem::Update(float elapseTime)
CWorldEffectsSystem::Update(elapseTime);
}
VectorCopy(backEnd.viewParms.or.origin, origin);
VectorCopy(backEnd.viewParms.ori.origin, origin);
mNextWindGust -= elapseTime;
if (mNextWindGust < 0.0)
@ -1733,7 +1733,7 @@ void CSnowSystem::Render(void)
CWorldEffectsSystem::Render();
VectorAdd(backEnd.viewParms.or.origin, mMinSpread, origin);
VectorAdd(backEnd.viewParms.ori.origin, mMinSpread, origin);
qglColor4f(0.8f, 0.8f, 0.8f, mAlpha);
@ -2068,8 +2068,8 @@ void CRainSystem::Render(void)
return;
}
VectorScale(backEnd.viewParms.or.axis[0], 1, forward); // forward
VectorScale(backEnd.viewParms.or.axis[1], 0.2f, left); // left
VectorScale(backEnd.viewParms.ori.axis[0], 1, forward); // forward
VectorScale(backEnd.viewParms.ori.axis[1], 0.2f, left); // left
down[0] = 0 - mWindDirection[0] * mRainHeight * mWindAngle;
down[1] = 0 - mWindDirection[1] * mRainHeight * mWindAngle;
down[2] = -mRainHeight;
@ -2082,7 +2082,7 @@ void CRainSystem::Render(void)
qglMatrixMode(GL_MODELVIEW);
qglPushMatrix();
qglTranslatef (backEnd.viewParms.or.origin[0], backEnd.viewParms.or.origin[1], backEnd.viewParms.or.origin[2]);
qglTranslatef (backEnd.viewParms.ori.origin[0], backEnd.viewParms.ori.origin[1], backEnd.viewParms.ori.origin[2]);
item = mRainList;
qglBegin(GL_TRIANGLES );
@ -2194,7 +2194,7 @@ void RB_RenderWorldEffects(void)
// qglPushMatrix();
qglLoadMatrixf( backEnd.viewParms.world.modelMatrix );
originContents = ri.CM_PointContents(backEnd.viewParms.or.origin, 0);
originContents = ri.CM_PointContents(backEnd.viewParms.ori.origin, 0);
if (rainSystem)
{