mirror of
https://github.com/ioquake/jedi-academy.git
synced 2024-11-22 04:11:57 +00:00
'or' is a c++ operator so rename variables to avoid it
This commit is contained in:
parent
1cfc2bde7b
commit
acc51ddf20
14 changed files with 149 additions and 149 deletions
|
@ -1279,10 +1279,10 @@ public:
|
|||
// Compute Camera
|
||||
//----------------
|
||||
{
|
||||
mCameraPosition = backEnd.viewParms.or.origin;
|
||||
mCameraForward = backEnd.viewParms.or.axis[0];
|
||||
mCameraLeft = backEnd.viewParms.or.axis[1];
|
||||
mCameraDown = backEnd.viewParms.or.axis[2];
|
||||
mCameraPosition = backEnd.viewParms.ori.origin;
|
||||
mCameraForward = backEnd.viewParms.ori.axis[0];
|
||||
mCameraLeft = backEnd.viewParms.ori.axis[1];
|
||||
mCameraDown = backEnd.viewParms.ori.axis[2];
|
||||
|
||||
if (mRotationChangeNext!=-1)
|
||||
{
|
||||
|
|
|
@ -558,10 +558,10 @@ static 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);
|
||||
|
|
|
@ -3020,8 +3020,8 @@ static void RootMatrix(CGhoul2Info_v &ghoul2,int time,const vec3_t scale,mdxaBon
|
|||
extern cvar_t *r_shadowRange;
|
||||
static inline bool bInShadowRange(vec3_t location)
|
||||
{
|
||||
const float c = DotProduct( tr.viewParms.or.axis[0], tr.viewParms.or.origin );
|
||||
const float dist = DotProduct( tr.viewParms.or.axis[0], location ) - c;
|
||||
const float c = DotProduct( tr.viewParms.ori.axis[0], tr.viewParms.ori.origin );
|
||||
const float dist = DotProduct( tr.viewParms.ori.axis[0], location ) - c;
|
||||
|
||||
// return (dist < tr.distanceCull/1.5f);
|
||||
return (dist < r_shadowRange->value);
|
||||
|
|
|
@ -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] );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ void R_DlightBmodel( bmodel_t *bmodel, qboolean NoLight ) {
|
|||
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;
|
||||
if (!NoLight)
|
||||
|
|
|
@ -554,7 +554,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
|
||||
|
@ -1198,7 +1198,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;
|
||||
|
||||
|
@ -1444,7 +1444,7 @@ int R_CullLocalBox (const vec3_t bounds[2]);
|
|||
int R_CullPointAndRadius( const vec3_t pt, float radius );
|
||||
int R_CullLocalPointAndRadius( const vec3_t pt, 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 );
|
||||
|
||||
#ifdef VV_LIGHTING
|
||||
void R_SetupEntityLightingGrid( trRefEntity_t *ent );
|
||||
|
@ -1739,7 +1739,7 @@ LIGHTS
|
|||
|
||||
void R_DlightBmodel( bmodel_t *bmodel, qboolean NoLight );
|
||||
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 );
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -61,10 +61,10 @@ int R_CullLocalBox (const 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
|
||||
|
@ -156,9 +156,9 @@ R_LocalNormalToWorld
|
|||
=================
|
||||
*/
|
||||
void R_LocalNormalToWorld (const 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];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -168,9 +168,9 @@ R_LocalPointToWorld
|
|||
=================
|
||||
*/
|
||||
void R_LocalPointToWorld (const 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];
|
||||
|
@ -231,9 +231,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]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -313,47 +313,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 ) {
|
||||
|
@ -367,9 +367,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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -384,28 +384,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;
|
||||
|
@ -415,9 +415,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;
|
||||
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,7 @@ static void SetFarClip( void )
|
|||
v[2] = tr.viewParms.visBounds[1][2];
|
||||
}
|
||||
|
||||
distance = DistanceSquared(tr.viewParms.or.origin, v);
|
||||
distance = DistanceSquared(tr.viewParms.ori.origin, v);
|
||||
|
||||
if ( distance > farthestCornerDistance )
|
||||
{
|
||||
|
@ -573,29 +573,29 @@ 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 );
|
||||
|
||||
|
||||
// this is the far plane
|
||||
VectorScale( tr.viewParms.or.axis[0],-1.0f, tr.viewParms.frustum[4].normal );
|
||||
VectorScale( tr.viewParms.ori.axis[0],-1.0f, tr.viewParms.frustum[4].normal );
|
||||
|
||||
for (i=0 ; i<5 ; 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);
|
||||
if (i==4)
|
||||
{
|
||||
// far plane does not go through the view point, it goes alot farther..
|
||||
|
@ -720,15 +720,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;
|
||||
}
|
||||
|
@ -829,15 +829,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
|
||||
{
|
||||
|
@ -902,7 +902,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++ )
|
||||
{
|
||||
|
@ -938,7 +938,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 )
|
||||
|
@ -1011,14 +1011,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
|
||||
|
||||
|
@ -1459,8 +1459,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) {
|
||||
|
|
|
@ -23,8 +23,8 @@ float ProjectRadius( float r, vec3_t location )
|
|||
float width;
|
||||
float depth;
|
||||
|
||||
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;
|
||||
|
|
|
@ -381,10 +381,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 );
|
||||
|
||||
|
|
|
@ -1718,7 +1718,7 @@ static void ComputeColors( shaderStage_t *pStage, alphaGen_t forceAlphaGen, colo
|
|||
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;
|
||||
|
@ -1999,7 +1999,7 @@ static void ComputeColors( shaderStage_t *pStage, alphaGen_t forceAlphaGen, colo
|
|||
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;
|
||||
|
|
|
@ -376,11 +376,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 ) {
|
||||
|
@ -436,9 +436,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...
|
||||
|
@ -960,7 +960,7 @@ void RB_CalcFogTexCoords( float *st ) {
|
|||
fog = tr.world->fogs + tess.fogNum;
|
||||
|
||||
// all fogging distance is based on world Z units
|
||||
VectorSubtract( backEnd.ori.origin, backEnd.viewParms.or.origin, localVec );
|
||||
VectorSubtract( backEnd.ori.origin, backEnd.viewParms.ori.origin, localVec );
|
||||
#ifdef _XBOX
|
||||
fogDistanceVector[0] = backEnd.ori.modelMatrix[2];
|
||||
fogDistanceVector[1] = backEnd.ori.modelMatrix[6];
|
||||
|
@ -970,7 +970,7 @@ void RB_CalcFogTexCoords( float *st ) {
|
|||
fogDistanceVector[1] = -backEnd.ori.modelMatrix[6];
|
||||
fogDistanceVector[2] = -backEnd.ori.modelMatrix[10];
|
||||
#endif
|
||||
fogDistanceVector[3] = DotProduct( localVec, backEnd.viewParms.or.axis[0] );
|
||||
fogDistanceVector[3] = DotProduct( localVec, backEnd.viewParms.ori.axis[0] );
|
||||
|
||||
// scale the fog vectors based on the fog's thickness
|
||||
fogDistanceVector[0] *= fog->tcScale;
|
||||
|
|
|
@ -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 );
|
||||
|
@ -460,7 +460,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];
|
||||
|
||||
|
@ -700,7 +700,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;
|
||||
|
@ -820,7 +820,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 );
|
||||
|
||||
|
|
|
@ -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 @@ static 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 );
|
||||
|
||||
|
@ -1225,11 +1225,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 )
|
||||
{
|
||||
|
@ -1581,8 +1581,8 @@ static float LodErrorForVolume( vec3_t local, float radius ) {
|
|||
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;
|
||||
|
@ -2310,7 +2310,7 @@ void RB_SurfaceFlare( srfFlare_t *surf ) {
|
|||
float* snormal = surf->normal;
|
||||
#endif // _XBOX
|
||||
|
||||
VectorSubtract( origin, backEnd.viewParms.or.origin, dir );
|
||||
VectorSubtract( origin, backEnd.viewParms.ori.origin, dir );
|
||||
dist = VectorNormalize( dir );
|
||||
|
||||
d = -DotProduct( dir, snormal );
|
||||
|
@ -2334,8 +2334,8 @@ void RB_SurfaceFlare( srfFlare_t *surf ) {
|
|||
{
|
||||
radius = 5.0f;
|
||||
}
|
||||
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 );
|
||||
}
|
||||
|
|
|
@ -1454,18 +1454,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);
|
||||
// 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.or.axis[1], ssViewRight);
|
||||
// R_WorldToLocal(backEnd.viewParms.or.axis[2], ssViewUp);
|
||||
// R_WorldToLocal(backEnd.viewParms.ori.axis[1], ssViewRight);
|
||||
// R_WorldToLocal(backEnd.viewParms.ori.axis[2], ssViewUp);
|
||||
}
|
||||
ssLastEntityDrawn = backEnd.currentEntity;
|
||||
}
|
||||
|
|
|
@ -158,7 +158,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
|
||||
|
|
Loading…
Reference in a new issue