mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 07:20:50 +00:00
[sw] Remove r_origin entirely
And clean up a lot of modelorg (a little trickier than it was for gl due to messy usage).
This commit is contained in:
parent
2606564955
commit
3bdec49587
16 changed files with 74 additions and 84 deletions
|
@ -140,7 +140,7 @@ extern int d_con_indirect; // if 0, Quake will draw console directly
|
|||
// draw console via D_DrawRect. Must be
|
||||
// defined by driver
|
||||
|
||||
extern vec3_t r_pright, r_pup, r_ppn;
|
||||
extern vec3_t r_pright, r_pup, r_ppn, r_porigin;
|
||||
|
||||
|
||||
void D_Aff8Patch (void *pcolormap);
|
||||
|
@ -151,7 +151,7 @@ void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts);
|
|||
void D_PolysetSetEdgeTable (void);
|
||||
void D_DrawParticle (particle_t *pparticle);
|
||||
void D_DrawPoly (void);
|
||||
void D_DrawSprite (void);
|
||||
void D_DrawSprite (const vec3_t relvieworg);
|
||||
void D_DrawSurfaces (void);
|
||||
void D_DrawZPoint (void);
|
||||
void D_Init (void);
|
||||
|
|
|
@ -85,10 +85,10 @@
|
|||
.extern C(lightleft)
|
||||
.extern C(blockdivshift)
|
||||
.extern C(lightleftstep)
|
||||
.extern C(r_origin)
|
||||
.extern C(r_ppn)
|
||||
.extern C(r_pup)
|
||||
.extern C(r_pright)
|
||||
.extern C(r_porigin)
|
||||
.extern C(ycenter)
|
||||
.extern C(xcenter)
|
||||
.extern C(d_vrectbottom_particle)
|
||||
|
|
|
@ -117,7 +117,6 @@ void R_RenderWorld (void);
|
|||
|
||||
extern plane_t screenedge[4];
|
||||
|
||||
extern vec3_t r_origin;
|
||||
extern vec3_t r_entorigin;
|
||||
|
||||
extern int r_visframecount;
|
||||
|
@ -144,11 +143,10 @@ void R_SetFrustum (void);
|
|||
|
||||
void R_SpriteBegin (void);
|
||||
void R_SpriteEnd (void);
|
||||
void R_DrawSprite (void);
|
||||
void R_DrawSprite (const vec3_t relvieworg);
|
||||
void R_RenderFace (msurface_t *fa, int clipflags);
|
||||
void R_RenderPoly (msurface_t *fa, int clipflags);
|
||||
void R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf);
|
||||
void R_TransformPlane (plane_t *p, float *normal, float *dist);
|
||||
void R_TransformFrustum (void);
|
||||
void R_SetSkyFrame (void);
|
||||
void R_DrawSurfaceBlock (void);
|
||||
|
@ -162,8 +160,8 @@ void R_DrawSolidClippedSubmodelPolygons (model_t *pmodel);
|
|||
void R_AddPolygonEdges (emitpoint_t *pverts, int numverts, int miplevel);
|
||||
surf_t *R_GetSurf (void);
|
||||
void R_AliasClipAndProjectFinalVert (finalvert_t *fv, auxvert_t *av);
|
||||
void R_AliasDrawModel (alight_t *plighting);
|
||||
void R_IQMDrawModel (alight_t *plighting);
|
||||
void R_AliasDrawModel (const vec3_t relvieworg, alight_t *plighting);
|
||||
void R_IQMDrawModel (const vec3_t relvieworg, alight_t *plighting);
|
||||
maliasskindesc_t *R_AliasGetSkindesc (animation_t *animation, int skinnum, aliashdr_t *hdr);
|
||||
maliasframedesc_t *R_AliasGetFramedesc (animation_t *animation, aliashdr_t *hdr);
|
||||
float R_AliasGetLerpedFrames (animation_t *animation, aliashdr_t *hdr);
|
||||
|
@ -239,7 +237,7 @@ extern auxvert_t *pauxverts;
|
|||
extern float ziscale;
|
||||
extern float aliastransform[3][4];
|
||||
|
||||
qboolean R_AliasCheckBBox (void);
|
||||
qboolean R_AliasCheckBBox (const vec3_t relvieworg);
|
||||
|
||||
// turbulence stuff =======================================
|
||||
|
||||
|
@ -330,7 +328,7 @@ void R_Alias_clip_bottom (finalvert_t *pfv0, finalvert_t *pfv1,
|
|||
finalvert_t *out);
|
||||
void R_Alias_clip_top (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out);
|
||||
|
||||
void R_AliasSetUpTransform (int trivial_accept);
|
||||
void R_AliasSetUpTransform (const vec3_t relvieworg, int trivial_accept);
|
||||
void R_AliasTransformVector (vec3_t in, vec3_t out);
|
||||
void R_AliasTransformFinalVert (finalvert_t *fv, trivertx_t *pverts,
|
||||
stvert_t *pstverts);
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
|
||||
psystem_t r_psystem; //FIXME singleton
|
||||
|
||||
vec3_t r_pright, r_pup, r_ppn;
|
||||
|
||||
/*
|
||||
R_MaxParticlesCheck
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ D_DrawSurfaces (void)
|
|||
// TODO: store once at start of frame
|
||||
currententity = s->entity; // FIXME: make this passed in
|
||||
// to R_RotateBmodel ()
|
||||
VectorSubtract (r_origin,
|
||||
VectorSubtract (r_refdef.viewposition,
|
||||
Transform_GetWorldPosition (currententity->transform),
|
||||
local_modelorg);
|
||||
TransformVector (local_modelorg, transformed_modelorg);
|
||||
|
@ -243,7 +243,7 @@ D_DrawSurfaces (void)
|
|||
// TODO: store once at start of frame
|
||||
currententity = s->entity; // FIXME: make this passed in
|
||||
// to R_RotateBmodel ()
|
||||
VectorSubtract (r_origin,
|
||||
VectorSubtract (r_refdef.viewposition,
|
||||
Transform_GetWorldPosition (currententity->transform),
|
||||
local_modelorg);
|
||||
TransformVector (local_modelorg, transformed_modelorg);
|
||||
|
|
|
@ -47,7 +47,7 @@ D_DrawParticle (particle_t *pparticle)
|
|||
int i, izi, pix, count, u, v;
|
||||
|
||||
// transform point
|
||||
VectorSubtract (pparticle->pos, r_origin, local);
|
||||
VectorSubtract (pparticle->pos, r_porigin, local);
|
||||
|
||||
transformed[0] = DotProduct (local, r_pright);
|
||||
transformed[1] = DotProduct (local, r_pup);
|
||||
|
|
|
@ -66,13 +66,13 @@ C(D_DrawParticle):
|
|||
// FIXME: better FP overlap in general here
|
||||
|
||||
// transform point
|
||||
// VectorSubtract (p->org, r_origin, local);
|
||||
flds C(r_origin)
|
||||
// VectorSubtract (p->org, r_porigin, local);
|
||||
flds C(r_porigin)
|
||||
fsubrs pt_pos(%edi)
|
||||
flds pt_pos+4(%edi)
|
||||
fsubs C(r_origin)+4
|
||||
fsubs C(r_porigin)+4
|
||||
flds pt_pos+8(%edi)
|
||||
fsubs C(r_origin)+8
|
||||
fsubs C(r_porigin)+8
|
||||
fxch %st(2) // local[0] | local[1] | local[2]
|
||||
|
||||
// transformed[2] = DotProduct(local, r_ppn);
|
||||
|
|
|
@ -323,7 +323,7 @@ D_SpriteScanRightEdge (void)
|
|||
}
|
||||
|
||||
static void
|
||||
D_SpriteCalculateGradients (void)
|
||||
D_SpriteCalculateGradients (const vec3_t relvieworg)
|
||||
{
|
||||
vec3_t p_normal, p_saxis, p_taxis, p_temp1;
|
||||
float distinv;
|
||||
|
@ -333,7 +333,7 @@ D_SpriteCalculateGradients (void)
|
|||
TransformVector (r_spritedesc.vup, p_taxis);
|
||||
VectorNegate (p_taxis, p_taxis);
|
||||
|
||||
distinv = 1.0 / (-DotProduct (modelorg, r_spritedesc.vpn));
|
||||
distinv = 1.0 / (-DotProduct (relvieworg, r_spritedesc.vpn));
|
||||
|
||||
d_sdivzstepu = p_saxis[0] * xscaleinv;
|
||||
d_tdivzstepu = p_taxis[0] * xscaleinv;
|
||||
|
@ -351,7 +351,7 @@ D_SpriteCalculateGradients (void)
|
|||
d_ziorigin = p_normal[2] * distinv - xcenter * d_zistepu -
|
||||
ycenter * d_zistepv;
|
||||
|
||||
TransformVector (modelorg, p_temp1);
|
||||
TransformVector (relvieworg, p_temp1);
|
||||
|
||||
sadjust = ((fixed16_t) (DotProduct (p_temp1, p_saxis) * 0x10000 + 0.5)) -
|
||||
(-(cachewidth >> 1) << 16);
|
||||
|
@ -364,7 +364,7 @@ D_SpriteCalculateGradients (void)
|
|||
}
|
||||
|
||||
void
|
||||
D_DrawSprite (void)
|
||||
D_DrawSprite (const vec3_t relvieworg)
|
||||
{
|
||||
int i, nump;
|
||||
float ymin, ymax;
|
||||
|
@ -409,7 +409,7 @@ D_DrawSprite (void)
|
|||
pverts = r_spritedesc.pverts;
|
||||
pverts[nump] = pverts[0];
|
||||
|
||||
D_SpriteCalculateGradients ();
|
||||
D_SpriteCalculateGradients (relvieworg);
|
||||
D_SpriteScanLeftEdge ();
|
||||
D_SpriteScanRightEdge ();
|
||||
D_SpriteDrawSpans (sprite_spans);
|
||||
|
|
|
@ -83,7 +83,7 @@ static aedge_t aedges[12] = {
|
|||
};
|
||||
|
||||
qboolean
|
||||
R_AliasCheckBBox (void)
|
||||
R_AliasCheckBBox (const vec3_t relvieworg)
|
||||
{
|
||||
int i, flags, frame, numv;
|
||||
aliashdr_t *pahdr;
|
||||
|
@ -102,7 +102,7 @@ R_AliasCheckBBox (void)
|
|||
pahdr = Cache_Get (&pmodel->cache);
|
||||
pmdl = (mdl_t *) ((byte *) pahdr + pahdr->model);
|
||||
|
||||
R_AliasSetUpTransform (0);
|
||||
R_AliasSetUpTransform (relvieworg, 0);
|
||||
|
||||
// construct the base bounding box for this frame
|
||||
frame = currententity->animation.frame;
|
||||
|
@ -351,7 +351,7 @@ R_AliasPreparePoints (void)
|
|||
}
|
||||
|
||||
void
|
||||
R_AliasSetUpTransform (int trivial_accept)
|
||||
R_AliasSetUpTransform (const vec3_t relvieworg, int trivial_accept)
|
||||
{
|
||||
int i;
|
||||
float rotationmatrix[3][4], t2matrix[3][4];
|
||||
|
@ -380,9 +380,9 @@ R_AliasSetUpTransform (int trivial_accept)
|
|||
t2matrix[i][2] = alias_up[i];
|
||||
}
|
||||
|
||||
t2matrix[0][3] = -modelorg[0];
|
||||
t2matrix[1][3] = -modelorg[1];
|
||||
t2matrix[2][3] = -modelorg[2];
|
||||
t2matrix[0][3] = -relvieworg[0];
|
||||
t2matrix[1][3] = -relvieworg[1];
|
||||
t2matrix[2][3] = -relvieworg[2];
|
||||
|
||||
// FIXME: can do more efficiently than full concatenation
|
||||
R_ConcatTransforms (t2matrix, tmatrix, rotationmatrix);
|
||||
|
@ -621,7 +621,7 @@ R_AliasSetupFrame (entity_t *ent)
|
|||
|
||||
|
||||
void
|
||||
R_AliasDrawModel (alight_t *plighting)
|
||||
R_AliasDrawModel (const vec3_t relvieworg, alight_t *plighting)
|
||||
{
|
||||
entity_t *ent = currententity;
|
||||
int size;
|
||||
|
@ -646,7 +646,7 @@ R_AliasDrawModel (alight_t *plighting)
|
|||
pauxverts = (auxvert_t *) &pfinalverts[pmdl->numverts + 1];
|
||||
|
||||
R_AliasSetupSkin (ent);
|
||||
R_AliasSetUpTransform (ent->visibility.trivial_accept);
|
||||
R_AliasSetUpTransform (relvieworg, ent->visibility.trivial_accept);
|
||||
R_AliasSetupLighting (plighting);
|
||||
R_AliasSetupFrame (ent);
|
||||
|
||||
|
|
|
@ -358,10 +358,11 @@ get_side (mnode_t *node)
|
|||
{
|
||||
// find which side of the node we are on
|
||||
plane_t *plane = node->plane;
|
||||
vec4f_t org = r_refdef.viewposition;
|
||||
|
||||
if (plane->type < 3)
|
||||
return (modelorg[plane->type] - plane->dist) < 0;
|
||||
return (DotProduct (modelorg, plane->normal) - plane->dist) < 0;
|
||||
return (org[plane->type] - plane->dist) < 0;
|
||||
return (DotProduct (org, plane->normal) - plane->dist) < 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -515,7 +516,6 @@ R_RenderWorld (void)
|
|||
pbtofpolys = btofpolys;
|
||||
|
||||
currententity = &r_worldentity;
|
||||
VectorCopy (r_origin, modelorg);
|
||||
brush = ¤tentity->renderer.model->brush;
|
||||
r_pcurrentvertbase = brush->vertexes;
|
||||
|
||||
|
|
|
@ -505,7 +505,6 @@ R_RenderFace (msurface_t *fa, int clipflags)
|
|||
surface_p->d_ziorigin = p_normal[2] * distinv -
|
||||
xcenter * surface_p->d_zistepu - ycenter * surface_p->d_zistepv;
|
||||
|
||||
//JDC VectorCopy (r_worldmodelorg, surface_p->modelorg);
|
||||
surface_p++;
|
||||
}
|
||||
|
||||
|
@ -605,7 +604,6 @@ R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf)
|
|||
surface_p->d_ziorigin = p_normal[2] * distinv -
|
||||
xcenter * surface_p->d_zistepu - ycenter * surface_p->d_zistepv;
|
||||
|
||||
//JDC VectorCopy (r_worldmodelorg, surface_p->modelorg);
|
||||
surface_p++;
|
||||
}
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ R_IQMSetupLighting (entity_t *ent, alight_t *plighting)
|
|||
}
|
||||
|
||||
static void
|
||||
R_IQMSetUpTransform (int trivial_accept)
|
||||
R_IQMSetUpTransform (const vec3_t relvieworg, int trivial_accept)
|
||||
{
|
||||
int i;
|
||||
float rotationmatrix[3][4];
|
||||
|
@ -263,9 +263,9 @@ R_IQMSetUpTransform (int trivial_accept)
|
|||
rotationmatrix[i][2] = up[i];
|
||||
}
|
||||
|
||||
rotationmatrix[0][3] = -modelorg[0];
|
||||
rotationmatrix[1][3] = -modelorg[1];
|
||||
rotationmatrix[2][3] = -modelorg[2];
|
||||
rotationmatrix[0][3] = -relvieworg[0];
|
||||
rotationmatrix[1][3] = -relvieworg[1];
|
||||
rotationmatrix[2][3] = -relvieworg[2];
|
||||
|
||||
// TODO: should be global, set when vright, etc., set
|
||||
VectorCopy (vright, viewmatrix[0]);
|
||||
|
@ -297,7 +297,7 @@ R_IQMSetUpTransform (int trivial_accept)
|
|||
}
|
||||
|
||||
void
|
||||
R_IQMDrawModel (alight_t *plighting)
|
||||
R_IQMDrawModel (const vec3_t relvieworg, alight_t *plighting)
|
||||
{
|
||||
entity_t *ent = currententity;
|
||||
model_t *model = ent->renderer.model;
|
||||
|
@ -320,7 +320,7 @@ R_IQMDrawModel (alight_t *plighting)
|
|||
(((intptr_t) &pfinalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
|
||||
pauxverts = (auxvert_t *) &pfinalverts[iqm->num_verts + 1];
|
||||
|
||||
R_IQMSetUpTransform (ent->visibility.trivial_accept);
|
||||
R_IQMSetUpTransform (relvieworg, ent->visibility.trivial_accept);
|
||||
|
||||
R_IQMSetupLighting (ent, plighting);
|
||||
r_affinetridesc.drawtype = (ent->visibility.trivial_accept == 3) &&
|
||||
|
|
|
@ -343,8 +343,9 @@ R_ViewChanged (void)
|
|||
static inline void
|
||||
draw_sprite_entity (entity_t *ent)
|
||||
{
|
||||
VectorSubtract (r_origin, r_entorigin, modelorg);
|
||||
R_DrawSprite ();
|
||||
vec3_t org;
|
||||
VectorSubtract (r_refdef.viewposition, r_entorigin, org);
|
||||
R_DrawSprite (org);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -389,22 +390,24 @@ setup_lighting (alight_t *lighting)
|
|||
static inline void
|
||||
draw_alias_entity (entity_t *ent)
|
||||
{
|
||||
VectorSubtract (r_origin, r_entorigin, modelorg);
|
||||
vec3_t org;
|
||||
VectorSubtract (r_refdef.viewposition, r_entorigin, org);
|
||||
|
||||
// see if the bounding box lets us trivially reject, also
|
||||
// sets trivial accept status
|
||||
currententity->visibility.trivial_accept = 0; //FIXME
|
||||
if (R_AliasCheckBBox ()) {
|
||||
if (R_AliasCheckBBox (org)) {
|
||||
alight_t lighting;
|
||||
setup_lighting (&lighting);
|
||||
R_AliasDrawModel (&lighting);
|
||||
R_AliasDrawModel (org, &lighting);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
draw_iqm_entity (entity_t *ent)
|
||||
{
|
||||
VectorSubtract (r_origin, r_entorigin, modelorg);
|
||||
vec3_t org;
|
||||
VectorSubtract (r_refdef.viewposition, r_entorigin, org);
|
||||
|
||||
// see if the bounding box lets us trivially reject, also
|
||||
// sets trivial accept status
|
||||
|
@ -412,7 +415,7 @@ draw_iqm_entity (entity_t *ent)
|
|||
|
||||
alight_t lighting;
|
||||
setup_lighting (&lighting);
|
||||
R_IQMDrawModel (&lighting);
|
||||
R_IQMDrawModel (org, &lighting);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -461,7 +464,6 @@ R_DrawViewModel (void)
|
|||
|
||||
VectorCopy (Transform_GetWorldPosition (currententity->transform),
|
||||
r_entorigin);
|
||||
VectorSubtract (r_origin, r_entorigin, modelorg);
|
||||
|
||||
VectorCopy (vup, viewlightvec);
|
||||
VectorNegate (viewlightvec, viewlightvec);
|
||||
|
@ -499,7 +501,9 @@ R_DrawViewModel (void)
|
|||
|
||||
r_viewlighting.plightvec = lightvec;
|
||||
|
||||
R_AliasDrawModel (&r_viewlighting);
|
||||
vec3_t org;
|
||||
VectorSubtract (r_refdef.viewposition, r_entorigin, org);
|
||||
R_AliasDrawModel (org, &r_viewlighting);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -558,11 +562,10 @@ R_BmodelCheckBBox (model_t *clmodel, float *minmaxs)
|
|||
}
|
||||
|
||||
static void
|
||||
R_DrawBEntitiesOnList (void)
|
||||
R_DrawBrushEntitiesOnList (void)
|
||||
{
|
||||
int j, clipflags;
|
||||
unsigned int k;
|
||||
vec3_t oldorigin;
|
||||
vec3_t origin;
|
||||
model_t *clmodel;
|
||||
float minmaxs[6];
|
||||
|
@ -570,7 +573,6 @@ R_DrawBEntitiesOnList (void)
|
|||
if (!r_drawentities->int_val)
|
||||
return;
|
||||
|
||||
VectorCopy (modelorg, oldorigin);
|
||||
insubmodel = true;
|
||||
|
||||
for (size_t i = 0; i < r_ent_queue->ent_queues[mod_brush].size; i++) {
|
||||
|
@ -592,7 +594,7 @@ R_DrawBEntitiesOnList (void)
|
|||
if (clipflags != BMODEL_FULLY_CLIPPED) {
|
||||
mod_brush_t *brush = &clmodel->brush;
|
||||
VectorCopy (origin, r_entorigin);
|
||||
VectorSubtract (r_origin, r_entorigin, modelorg);
|
||||
VectorSubtract (r_refdef.viewposition, r_entorigin, modelorg);
|
||||
|
||||
// FIXME: is this needed?
|
||||
VectorCopy (modelorg, r_worldmodelorg);
|
||||
|
@ -648,7 +650,6 @@ R_DrawBEntitiesOnList (void)
|
|||
VectorCopy (base_vup, vup);
|
||||
VectorCopy (base_vright, vright);
|
||||
VectorCopy (base_modelorg, modelorg);
|
||||
VectorCopy (oldorigin, modelorg);
|
||||
R_TransformFrustum ();
|
||||
}
|
||||
}
|
||||
|
@ -723,7 +724,7 @@ R_EdgeDrawing (void)
|
|||
db_time1 = rw_time2;
|
||||
}
|
||||
|
||||
R_DrawBEntitiesOnList ();
|
||||
R_DrawBrushEntitiesOnList ();
|
||||
|
||||
if (r_dspeeds->int_val) {
|
||||
db_time2 = Sys_DoubleTime ();
|
||||
|
|
|
@ -146,17 +146,6 @@ TransformVector (const vec3_t in, vec3_t out)
|
|||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
R_TransformPlane (plane_t *p, float *normal, float *dist)
|
||||
{
|
||||
float d;
|
||||
|
||||
d = DotProduct (r_origin, p->normal);
|
||||
*dist = p->dist - d;
|
||||
// TODO: when we have rotating entities, this will need to use the view matrix
|
||||
TransformVector (p->normal, normal);
|
||||
}
|
||||
|
||||
static void
|
||||
R_SetUpFrustumIndexes (void)
|
||||
{
|
||||
|
@ -195,15 +184,16 @@ R_SetupFrame (void)
|
|||
|
||||
// build the transformation matrix for the given view angles
|
||||
VectorCopy (r_refdef.viewposition, modelorg);
|
||||
VectorCopy (r_refdef.viewposition, r_origin);
|
||||
|
||||
VectorCopy (qvmulf (r_refdef.viewrotation, (vec4f_t) { 1, 0, 0, 0 }), vpn);
|
||||
VectorCopy (qvmulf (r_refdef.viewrotation, (vec4f_t) { 0, -1, 0, 0 }), vright);
|
||||
VectorCopy (qvmulf (r_refdef.viewrotation, (vec4f_t) { 0, 0, 1, 0 }), vup);
|
||||
vec4f_t position = r_refdef.viewposition;
|
||||
vec4f_t rotation = r_refdef.viewrotation;
|
||||
VectorCopy (qvmulf (rotation, (vec4f_t) { 1, 0, 0, 0 }), vpn);
|
||||
VectorCopy (qvmulf (rotation, (vec4f_t) { 0, -1, 0, 0 }), vright);
|
||||
VectorCopy (qvmulf (rotation, (vec4f_t) { 0, 0, 1, 0 }), vup);
|
||||
R_SetFrustum ();
|
||||
|
||||
// current viewleaf
|
||||
r_viewleaf = Mod_PointInLeaf (r_origin, r_worldentity.renderer.model);
|
||||
r_viewleaf = Mod_PointInLeaf (&position[0], r_worldentity.renderer.model);
|
||||
|
||||
r_dowarpold = r_dowarp;
|
||||
r_dowarp = r_waterwarp->int_val && (r_viewleaf->contents <=
|
||||
|
|
|
@ -49,12 +49,15 @@
|
|||
#include "compat.h"
|
||||
#include "r_internal.h"
|
||||
|
||||
vec3_t r_pright, r_pup, r_ppn, r_porigin;
|
||||
|
||||
void
|
||||
R_DrawParticles (void)
|
||||
{
|
||||
VectorScale (vright, xscaleshrink, r_pright);
|
||||
VectorScale (vup, yscaleshrink, r_pup);
|
||||
VectorCopy (vpn, r_ppn);
|
||||
VectorCopy (r_refdef.viewposition, r_porigin);
|
||||
|
||||
R_RunParticles (vr_data.frametime);
|
||||
|
||||
|
|
|
@ -52,16 +52,17 @@ spritedesc_t r_spritedesc;
|
|||
|
||||
|
||||
static void
|
||||
R_RotateSprite (float beamlength)
|
||||
R_RotateSprite (const vec3_t relvieworg, float beamlength, vec3_t org)
|
||||
{
|
||||
vec3_t vec;
|
||||
|
||||
VectorCopy (relvieworg, org);
|
||||
if (beamlength == 0.0)
|
||||
return;
|
||||
|
||||
VectorScale (r_spritedesc.vpn, -beamlength, vec);
|
||||
VectorAdd (r_entorigin, vec, r_entorigin);
|
||||
VectorSubtract (modelorg, vec, modelorg);
|
||||
VectorSubtract (relvieworg, vec, org);
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,7 +148,7 @@ R_ClipSpriteFace (int nump, clipplane_t *pclipplane)
|
|||
|
||||
|
||||
static void
|
||||
R_SetupAndDrawSprite (void)
|
||||
R_SetupAndDrawSprite (const vec3_t relvieworg)
|
||||
{
|
||||
int i, nump;
|
||||
float dot, scale, *pv;
|
||||
|
@ -155,7 +156,7 @@ R_SetupAndDrawSprite (void)
|
|||
vec3_t left, up, right, down, transformed, local;
|
||||
emitpoint_t outverts[MAXWORKINGVERTS + 1], *pout;
|
||||
|
||||
dot = DotProduct (r_spritedesc.vpn, modelorg);
|
||||
dot = DotProduct (r_spritedesc.vpn, relvieworg);
|
||||
|
||||
// backface cull
|
||||
if (dot >= 0)
|
||||
|
@ -210,7 +211,7 @@ R_SetupAndDrawSprite (void)
|
|||
r_spritedesc.nearzi = -999999;
|
||||
|
||||
for (i = 0; i < nump; i++) {
|
||||
VectorSubtract (pv, r_origin, local);
|
||||
VectorSubtract (pv, r_refdef.viewposition, local);
|
||||
TransformVector (local, transformed);
|
||||
|
||||
if (transformed[2] < NEAR_CLIP)
|
||||
|
@ -236,11 +237,11 @@ R_SetupAndDrawSprite (void)
|
|||
// draw it
|
||||
r_spritedesc.nump = nump;
|
||||
r_spritedesc.pverts = outverts;
|
||||
D_DrawSprite ();
|
||||
D_DrawSprite (relvieworg);
|
||||
}
|
||||
|
||||
void
|
||||
R_DrawSprite (void)
|
||||
R_DrawSprite (const vec3_t relvieworg)
|
||||
{
|
||||
msprite_t *sprite = currententity->renderer.model->cache.data;
|
||||
|
||||
|
@ -250,7 +251,7 @@ R_DrawSprite (void)
|
|||
sprite_width = r_spritedesc.pspriteframe->width;
|
||||
sprite_height = r_spritedesc.pspriteframe->height;
|
||||
|
||||
if (!R_BillboardFrame (currententity, sprite->type, modelorg,
|
||||
if (!R_BillboardFrame (currententity, sprite->type, relvieworg,
|
||||
r_spritedesc.vup,
|
||||
r_spritedesc.vright,
|
||||
r_spritedesc.vpn)) {
|
||||
|
@ -258,7 +259,8 @@ R_DrawSprite (void)
|
|||
return;
|
||||
}
|
||||
|
||||
R_RotateSprite (sprite->beamlength);
|
||||
vec3_t org;
|
||||
R_RotateSprite (relvieworg, sprite->beamlength, org);
|
||||
|
||||
R_SetupAndDrawSprite ();
|
||||
R_SetupAndDrawSprite (org);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue