From 7653d161643a1e8ed9640d445a5a13d9248d4939 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 27 Sep 2002 12:02:23 +0000 Subject: [PATCH] CL_TraceLine can now return what entity was hit (this isn't actually used, and accounts for most of the changed files) r_shadows returns, currently only supported on alias models (they are the only ones with a DrawFakeShadow function) added Matrix4x4_Transform3x3 git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2453 d7cf8633-e32d-0410-b094-e92efae38249 --- cgamevm.c | 2 +- chase.c | 2 +- cl_collision.c | 8 ++++- cl_collision.h | 2 +- cl_main.c | 2 +- cl_particles.c | 2 +- gl_models.c | 96 +++++++++++++++++++++++++++++++++++++++++++------- gl_rmain.c | 29 +++++++++++++-- matrixlib.c | 17 +++++++++ matrixlib.h | 6 +++- model_alias.c | 6 ++-- model_brush.c | 2 +- model_shared.h | 4 +-- model_sprite.c | 2 +- r_crosshairs.c | 2 +- r_explosion.c | 2 +- r_light.c | 10 +++--- render.h | 9 ++--- 18 files changed, 162 insertions(+), 41 deletions(-) diff --git a/cgamevm.c b/cgamevm.c index d921b752..dfa6c9ec 100644 --- a/cgamevm.c +++ b/cgamevm.c @@ -196,7 +196,7 @@ float CGVM_TracePhysics(const float *start, const float *end, const float *world middle[2] = (worldmins[2] + worldmaxs[2]) * 0.5f; VectorAdd(start, middle, start2); VectorAdd(end, middle, end2); - frac = CL_TraceLine((float *)start2, (float *)end2, impactpos, impactnormal, 0, true); + frac = CL_TraceLine((float *)start2, (float *)end2, impactpos, impactnormal, 0, true, NULL); VectorSubtract(impactpos, middle, impactpos); *impactentnum = -1; return frac; diff --git a/chase.c b/chase.c index fa0f0a03..be915bcf 100644 --- a/chase.c +++ b/chase.c @@ -54,7 +54,7 @@ void Chase_Update (void) chase_dest[1] = r_refdef.vieworg[1] + forward[1] * dist; chase_dest[2] = r_refdef.vieworg[2] + forward[2] * dist + chase_up.value; - CL_TraceLine (r_refdef.vieworg, chase_dest, stop, normal, 0, true); + CL_TraceLine (r_refdef.vieworg, chase_dest, stop, normal, 0, true, NULL); chase_dest[0] = stop[0] + forward[0] * 8 + normal[0] * 4; chase_dest[1] = stop[1] + forward[1] * 8 + normal[1] * 4; chase_dest[2] = stop[2] + forward[2] * 8 + normal[2] * 4; diff --git a/cl_collision.c b/cl_collision.c index 1bc60f72..0af6d38b 100644 --- a/cl_collision.c +++ b/cl_collision.c @@ -30,11 +30,13 @@ physentity_t; int cl_traceline_endcontents; -float CL_TraceLine (const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int contents, int hitbmodels) +float CL_TraceLine (const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int contents, int hitbmodels, entity_render_t **hitent) { double maxfrac; trace_t trace; + if (hitent) + *hitent = NULL; Mod_CheckLoaded(cl.worldmodel); Collision_ClipTrace(&trace, NULL, cl.worldmodel, vec3_origin, vec3_origin, vec3_origin, vec3_origin, start, vec3_origin, vec3_origin, end); @@ -44,6 +46,8 @@ float CL_TraceLine (const vec3_t start, const vec3_t end, vec3_t impact, vec3_t VectorCopy (trace.plane.normal, normal); cl_traceline_endcontents = trace.endcontents; maxfrac = trace.fraction; + if (hitent && trace.fraction < 1) + *hitent = &cl_entities[0].render; if (hitbmodels && cl_num_brushmodel_entities) { @@ -76,6 +80,8 @@ float CL_TraceLine (const vec3_t start, const vec3_t end, vec3_t impact, vec3_t if (normal) VectorCopy(trace.plane.normal, normal); cl_traceline_endcontents = trace.endcontents; + if (hitent) + *hitent = ent; } } } diff --git a/cl_collision.h b/cl_collision.h index 15c1e06a..9e4cda56 100644 --- a/cl_collision.h +++ b/cl_collision.h @@ -6,6 +6,6 @@ // (leafs matching contents are considered empty, others are solid) extern int cl_traceline_endcontents; // set by TraceLine -float CL_TraceLine (const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int contents, int hitbmodels); +float CL_TraceLine (const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int contents, int hitbmodels, entity_render_t **hitent); #endif diff --git a/cl_main.c b/cl_main.c index f0259e37..bf38fce5 100644 --- a/cl_main.c +++ b/cl_main.c @@ -644,7 +644,7 @@ static void CL_RelinkNetworkEntities() v2[0] = v[0] * 18 + neworg[0]; v2[1] = v[1] * 18 + neworg[1]; v2[2] = v[2] * 18 + neworg[2] + 16; - CL_TraceLine(neworg, v2, v, NULL, 0, true); + CL_TraceLine(neworg, v2, v, NULL, 0, true, NULL); CL_AllocDlight (NULL, v, ent->persistent.muzzleflash, 1, 1, 1, 0, 0); ent->persistent.muzzleflash -= cl.frametime * 1000; diff --git a/cl_particles.c b/cl_particles.c index 1107913b..304eb937 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -858,7 +858,7 @@ void CL_MoveParticles (void) VectorCopy(p->org, org); if (p->bounce) { - if (CL_TraceLine(p->oldorg, p->org, v, normal, 0, true) < 1) + if (CL_TraceLine(p->oldorg, p->org, v, normal, 0, true, NULL) < 1) { VectorCopy(v, p->org); if (p->bounce < 0) diff --git a/gl_models.c b/gl_models.c index ca149f51..5667f1e9 100644 --- a/gl_models.c +++ b/gl_models.c @@ -1,5 +1,6 @@ #include "quakedef.h" +#include "cl_collision.h" cvar_t r_quickmodels = {0, "r_quickmodels", "1"}; @@ -72,7 +73,7 @@ void R_AliasTransformVerts(int vertcount) } */ -void R_AliasLerpVerts(int vertcount, +void R_AliasLerpVerts(int vertcount, float *vertices, float *normals, float lerp1, const trivertx_t *verts1, const vec3_t fscale1, const vec3_t translate1, float lerp2, const trivertx_t *verts2, const vec3_t fscale2, const vec3_t translate2, float lerp3, const trivertx_t *verts3, const vec3_t fscale3, const vec3_t translate3, @@ -82,8 +83,8 @@ void R_AliasLerpVerts(int vertcount, vec3_t scale1, scale2, scale3, scale4, translate; const float *n1, *n2, *n3, *n4; float *av, *avn; - av = aliasvert; - avn = aliasvertnorm; + av = vertices; + avn = normals; VectorScale(fscale1, lerp1, scale1); if (lerp2) { @@ -212,7 +213,7 @@ skinframe_t *R_FetchSkinFrame(const entity_render_t *ent) return &model->skinframes[model->skinscenes[s].firstframe]; } -void R_SetupMDLMD2Frames(const entity_render_t *ent, float colorr, float colorg, float colorb) +void R_LerpMDLMD2Vertices(const entity_render_t *ent, float *vertices, float *normals) { const md2frame_t *frame1, *frame2, *frame3, *frame4; const trivertx_t *frame1verts, *frame2verts, *frame3verts, *frame4verts; @@ -226,15 +227,11 @@ void R_SetupMDLMD2Frames(const entity_render_t *ent, float colorr, float colorg, frame2verts = &model->mdlmd2data_pose[ent->frameblend[1].frame * model->numverts]; frame3verts = &model->mdlmd2data_pose[ent->frameblend[2].frame * model->numverts]; frame4verts = &model->mdlmd2data_pose[ent->frameblend[3].frame * model->numverts]; - R_AliasLerpVerts(model->numverts, + R_AliasLerpVerts(model->numverts, vertices, normals, ent->frameblend[0].lerp, frame1verts, frame1->scale, frame1->translate, ent->frameblend[1].lerp, frame2verts, frame2->scale, frame2->translate, ent->frameblend[2].lerp, frame3verts, frame3->scale, frame3->translate, ent->frameblend[3].lerp, frame4verts, frame4->scale, frame4->translate); - - R_LightModel(ent, model->numverts, colorr, colorg, colorb, false); - - //R_AliasTransformVerts(model->numverts); } void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2) @@ -311,7 +308,8 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2) varray_texcoord[0][i] = model->mdlmd2data_texcoords[i] * 8.0f; aliasvert = varray_vertex; aliasvertcolor = varray_color; - R_SetupMDLMD2Frames(ent, colorscale, colorscale, colorscale); + R_LerpMDLMD2Vertices(ent, aliasvert, aliasvertnorm); + R_LightModel(ent, model->numverts, colorscale, colorscale, colorscale, false); aliasvert = aliasvertbuf; aliasvertcolor = aliasvertcolorbuf; R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices); @@ -335,14 +333,16 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2) memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2])); aliasvert = varray_vertex; aliasvertcolor = varray_color; - R_SetupMDLMD2Frames(ent, colorscale, colorscale, colorscale); + R_LerpMDLMD2Vertices(ent, aliasvert, aliasvertnorm); + R_LightModel(ent, model->numverts, colorscale, colorscale, colorscale, false); aliasvert = aliasvertbuf; aliasvertcolor = aliasvertcolorbuf; R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices); return; } - R_SetupMDLMD2Frames(ent, 1 - fog, 1 - fog, 1 - fog); + R_LerpMDLMD2Vertices(ent, aliasvert, aliasvertnorm); + R_LightModel(ent, model->numverts, colorscale * (1 - fog), colorscale * (1 - fog), colorscale * (1 - fog), false); if (colormapped) { @@ -471,6 +471,77 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2) } } +void R_DrawQ1Q2AliasModelFakeShadow (entity_render_t *ent) +{ + int i; + rmeshstate_t m; + model_t *model; + float *v, lightdirection[3], surfnormal[3], planenormal[3], planedist, floororigin[3], v2[3], offset[3], dist1, dist2, frac; + + VectorCopy(ent->origin, v2); + v2[2] -= 65536.0f; + if (CL_TraceLine(ent->origin, v2, floororigin, surfnormal, 0, false, NULL) == 1) + return; + + R_Mesh_Matrix(&ent->matrix); + + model = ent->model; + R_Mesh_ResizeCheck(model->numverts); + + memset(&m, 0, sizeof(m)); + m.blendfunc1 = GL_SRC_ALPHA; + m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA; + R_Mesh_State(&m); + + c_alias_polys += model->numtris; + R_LerpMDLMD2Vertices(ent, varray_vertex, aliasvertnorm); + R_FillColors(varray_color, model->numverts, 0, 0, 0, 0.5); + + // put a light direction in the entity's coordinate space + lightdirection[0] = 0.3; + lightdirection[1] = 0.1; + lightdirection[2] = -1; + Matrix4x4_Transform3x3(&ent->inversematrix, lightdirection, offset); + VectorNormalizeFast(offset); + VectorScale(offset, 65536.0f, offset); + + // put the plane's normal in the entity's coordinate space + Matrix4x4_Transform3x3(&ent->inversematrix, surfnormal, planenormal); + VectorNormalizeFast(planenormal); + + // put the plane's distance in the entity's coordinate space + VectorSubtract(floororigin, ent->origin, floororigin); + planedist = DotProduct(floororigin, surfnormal) + 1; + + //Con_Printf("sn: %f %f %f pn: %f %f %f pd: %f\n", surfnormal[0], surfnormal[1], surfnormal[2], planenormal[0], planenormal[1], planenormal[2], planedist); + { + //int count1 = 0, count2 = 0, count3 = 0; + for (i = 0, v = varray_vertex;i < model->numverts;i++, v += 4) + { + v2[0] = v[0] + offset[0]; + v2[1] = v[1] + offset[1]; + v2[2] = v[2] + offset[2]; + dist1 = DotProduct(v, planenormal) - planedist; + dist2 = DotProduct(v2, planenormal) - planedist; + //if (dist1 > 0) + // count1++; + //if (dist2 > 0) + // count2++; + //if (dist1 > 0 != dist2 > 0) + // count3++; + if (dist1 > 0 && dist2 < 0) + //if (i & 1) + { + // clipped + frac = dist1 / (dist1 - dist2); + VectorMA(v, frac, offset, v); + } + } + //Con_Printf("counts %d %d %d\n", count1, count2, count3); + } + R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices); +} + int ZymoticLerpBones(int count, const zymbonematrix *bonebase, const frameblend_t *blend, const zymbone_t *bone) { int i; @@ -877,4 +948,3 @@ void R_DrawQ1Q2AliasModel(entity_render_t *ent) else R_DrawQ1Q2AliasModelCallback(ent, 0); } - diff --git a/gl_rmain.c b/gl_rmain.c index e17054dd..b989580b 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -51,6 +51,7 @@ unsigned short d_lightstylevalue[256]; cvar_t r_drawentities = {0, "r_drawentities","1"}; cvar_t r_drawviewmodel = {0, "r_drawviewmodel","1"}; +cvar_t r_shadows = {CVAR_SAVE, "r_shadows", "1"}; cvar_t r_speeds = {0, "r_speeds","0"}; cvar_t r_fullbright = {0, "r_fullbright","0"}; cvar_t r_wateralpha = {CVAR_SAVE, "r_wateralpha","1"}; @@ -218,6 +219,7 @@ void GL_Main_Init(void) Cmd_AddCommand ("timerefresh", R_TimeRefresh_f); Cvar_RegisterVariable (&r_drawentities); Cvar_RegisterVariable (&r_drawviewmodel); + Cvar_RegisterVariable (&r_shadows); Cvar_RegisterVariable (&r_speeds); Cvar_RegisterVariable (&r_fullbrights); Cvar_RegisterVariable (&r_wateralpha); @@ -459,9 +461,6 @@ static void R_MarkEntities (void) VectorAdd(ent->angles, r_refdef.viewangles, ent->angles); } - if (R_CullBox(ent->mins, ent->maxs)) - continue; - ent->visframe = r_framecount; VectorCopy(ent->angles, v); if (!ent->model || ent->model->type != mod_brush) @@ -470,6 +469,8 @@ static void R_MarkEntities (void) Matrix4x4_Invert_Simple(&ent->inversematrix, &ent->matrix); R_LerpAnimation(ent); R_UpdateEntLights(ent); + if (R_CullBox(ent->mins, ent->maxs)) + continue; R_FarClip_Box(ent->mins, ent->maxs); } } @@ -544,6 +545,22 @@ void R_DrawModels (void) } } +void R_DrawModelFakeShadows (void) +{ + int i; + entity_render_t *ent; + + if (!r_drawentities.integer) + return; + + for (i = 0;i < r_refdef.numentities;i++) + { + ent = r_refdef.entities[i]; + if (ent->model && ent->model->DrawFakeShadow) + ent->model->DrawFakeShadow(ent); + } +} + static void R_SetFrustum (void) { int i; @@ -679,6 +696,12 @@ void R_RenderView (void) if (!intimerefresh && !r_speeds.integer) S_ExtraUpdate (); + if (r_shadows.integer) + { + R_DrawModelFakeShadows(); + R_TimeReport("fakeshadows"); + } + R_DrawModels(); R_TimeReport("models"); diff --git a/matrixlib.c b/matrixlib.c index af5ec5ee..8b7f22bb 100644 --- a/matrixlib.c +++ b/matrixlib.c @@ -364,6 +364,13 @@ void Matrix4x4_Transform4 (const matrix4x4_t *in, const float v[4], float out[4] out[3] = v[0] * in->m[3][0] + v[1] * in->m[3][1] + v[2] * in->m[3][2] + v[3] * in->m[3][3]; } +void Matrix4x4_Transform3x3 (const matrix4x4_t *in, const float v[3], float out[3]) +{ + out[0] = v[0] * in->m[0][0] + v[1] * in->m[0][1] + v[2] * in->m[0][2]; + out[1] = v[0] * in->m[1][0] + v[1] * in->m[1][1] + v[2] * in->m[1][2]; + out[2] = v[0] * in->m[2][0] + v[1] * in->m[2][1] + v[2] * in->m[2][2]; +} + /* void Matrix4x4_SimpleUntransform (const matrix4x4_t *in, const float v[3], float out[3]) { @@ -707,6 +714,7 @@ void Matrix3x4_Transform (const matrix3x4_t *in, const float v[3], float out[3]) out[2] = v[0] * in->m[2][0] + v[1] * in->m[2][1] + v[2] * in->m[2][2] + in->m[2][3]; } +/* void Matrix3x4_SimpleUntransform (const matrix3x4_t *in, const float v[3], float out[3]) { float t[3]; @@ -717,6 +725,15 @@ void Matrix3x4_SimpleUntransform (const matrix3x4_t *in, const float v[3], float out[1] = t[0] * in->m[0][1] + t[1] * in->m[1][1] + t[2] * in->m[2][1]; out[2] = t[0] * in->m[0][2] + t[1] * in->m[1][2] + t[2] * in->m[2][2]; } +*/ + +void Matrix3x4_Transform3x3 (const matrix3x4_t *in, const float v[3], float out[3]) +{ + out[0] = v[0] * in->m[0][0] + v[1] * in->m[0][1] + v[2] * in->m[0][2] + in->m[0][3]; + out[1] = v[0] * in->m[1][0] + v[1] * in->m[1][1] + v[2] * in->m[1][2] + in->m[1][3]; + out[2] = v[0] * in->m[2][0] + v[1] * in->m[2][1] + v[2] * in->m[2][2] + in->m[2][3]; +} + // FIXME: optimize void Matrix3x4_ConcatTranslate (matrix3x4_t *out, float x, float y, float z) diff --git a/matrixlib.h b/matrixlib.h index 81364c68..d8d14752 100644 --- a/matrixlib.h +++ b/matrixlib.h @@ -73,6 +73,8 @@ void Matrix4x4_Transform4 (const matrix4x4_t *in, const float v[4], float out[4] // cases (rotation and translation *ONLY*), this attempts to undo the results // of Transform //void Matrix4x4_SimpleUntransform (const matrix4x4_t *in, const float v[3], float out[3]); +// transforms a direction vector through the rotation part of a matrix +void Matrix4x4_Transform3x3 (const matrix4x4_t *in, const float v[3], float out[3]); // ease of use functions // immediately applies a Translate to the matrix @@ -139,7 +141,9 @@ void Matrix3x4_Transform (const matrix3x4_t *in, const float v[3], float out[3]) // reverse transforms a 3D vector through a matrix3x4, at least for *simple* // cases (rotation and translation *ONLY*), this attempts to undo the results // of Transform -void Matrix3x4_SimpleUntransform (const matrix3x4_t *in, const float v[3], float out[3]); +//void Matrix3x4_SimpleUntransform (const matrix3x4_t *in, const float v[3], float out[3]); +// transforms a direction vector through the rotation part of a matrix +void Matrix3x4_Transform3x3 (const matrix3x4_t *in, const float v[3], float out[3]); // ease of use functions // immediately applies a Translate to the matrix diff --git a/model_alias.c b/model_alias.c index 8e4545de..5540ed20 100644 --- a/model_alias.c +++ b/model_alias.c @@ -527,7 +527,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) loadmodel->Draw = R_DrawQ1Q2AliasModel; loadmodel->DrawSky = NULL; - loadmodel->DrawShadow = NULL; + loadmodel->DrawFakeShadow = R_DrawQ1Q2AliasModelFakeShadow; loadmodel->mdlmd2data_triangleneighbors = Mem_Alloc(loadmodel->mempool, loadmodel->numtris * sizeof(int[3])); Mod_BuildTriangleNeighbors(loadmodel->mdlmd2data_triangleneighbors, loadmodel->mdlmd2data_indices, loadmodel->numtris); @@ -604,7 +604,7 @@ void Mod_LoadQ2AliasModel (model_t *mod, void *buffer) loadmodel->aliastype = ALIASTYPE_MDLMD2; loadmodel->Draw = R_DrawQ1Q2AliasModel; loadmodel->DrawSky = NULL; - loadmodel->DrawShadow = NULL; + loadmodel->DrawFakeShadow = NULL; if (LittleLong(pinmodel->num_tris < 1) || LittleLong(pinmodel->num_tris) > MD2MAX_TRIANGLES) Host_Error ("%s has invalid number of triangles: %i", loadmodel->name, LittleLong(pinmodel->num_tris)); @@ -993,5 +993,5 @@ void Mod_LoadZymoticModel(model_t *mod, void *buffer) loadmodel->Draw = R_DrawZymoticModel; loadmodel->DrawSky = NULL; - loadmodel->DrawShadow = NULL; + loadmodel->DrawFakeShadow = NULL; } diff --git a/model_brush.c b/model_brush.c index 9c0cf4e8..7382001b 100644 --- a/model_brush.c +++ b/model_brush.c @@ -2475,7 +2475,7 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) mod->numleafs = bm->visleafs; mod->Draw = R_DrawBrushModelNormal; - mod->DrawShadow = NULL; + mod->DrawFakeShadow = NULL; // LordHavoc: only register submodels if it is the world // (prevents bsp models from replacing world submodels) diff --git a/model_shared.h b/model_shared.h index 9d4c3047..011d53ff 100644 --- a/model_shared.h +++ b/model_shared.h @@ -198,8 +198,8 @@ typedef struct model_s void(*Draw)(struct entity_render_s *ent); // draw the model's sky polygons (only used by brush models) void(*DrawSky)(struct entity_render_s *ent); - // draw the model's shadows - void(*DrawShadow)(struct entity_render_s *ent); + // draw a fake shadow for the model + void(*DrawFakeShadow)(struct entity_render_s *ent); // memory pool for allocations mempool_t *mempool; diff --git a/model_sprite.c b/model_sprite.c index 3c01af14..1908afb4 100644 --- a/model_sprite.c +++ b/model_sprite.c @@ -244,7 +244,7 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer) loadmodel->Draw = R_DrawSpriteModel; loadmodel->DrawSky = NULL; - loadmodel->DrawShadow = NULL; + loadmodel->DrawFakeShadow = NULL; version = LittleLong(((dsprite_t *)buffer)->version); if (version == SPRITE_VERSION || SPRITE32_VERSION) diff --git a/r_crosshairs.c b/r_crosshairs.c index 438d8549..ccd49fee 100644 --- a/r_crosshairs.c +++ b/r_crosshairs.c @@ -128,7 +128,7 @@ void R_DrawWorldCrosshair(void) AngleVectors(cl.viewangles, v2, NULL, NULL); //VectorCopy(r_origin, v1); VectorMA(v1, 8192, v2, v2); - spritescale = CL_TraceLine(v1, v2, spriteorigin, NULL, 0, true) * (8192.0f / 40.0f) * crosshair_size.value; + spritescale = CL_TraceLine(v1, v2, spriteorigin, NULL, 0, true, NULL) * (8192.0f / 40.0f) * crosshair_size.value; // draw the sprite R_DrawCrosshairSprite(pic->tex, spriteorigin, spritescale, color[0], color[1], color[2], color[3]); diff --git a/r_explosion.c b/r_explosion.c index 0d5fdf46..50c3d66f 100644 --- a/r_explosion.c +++ b/r_explosion.c @@ -267,7 +267,7 @@ void R_MoveExplosion(explosion_t *e) VectorMA(e->vert[i], frametime, e->vertvel[i], end); if (r_explosionclip.integer) { - if (CL_TraceLine(e->vert[i], end, impact, normal, 0, true) < 1) + if (CL_TraceLine(e->vert[i], end, impact, normal, 0, true, NULL) < 1) { // clip velocity against the wall dot = DotProduct(e->vertvel[i], normal) * -1.125f; diff --git a/r_light.c b/r_light.c index 74334c50..d2ae578d 100644 --- a/r_light.c +++ b/r_light.c @@ -157,7 +157,7 @@ void R_DrawCoronas(void) { rd = r_dlight + i; dist = (DotProduct(rd->origin, vpn) - viewdist); - if (dist >= 24.0f && CL_TraceLine(rd->origin, r_origin, NULL, NULL, 0, true) == 1) + if (dist >= 24.0f && CL_TraceLine(rd->origin, r_origin, NULL, NULL, 0, true, NULL) == 1) { scale = r_colorscale * (1.0f / 131072.0f); if (gl_flashblend.integer) @@ -628,7 +628,7 @@ void R_CompleteLightPoint (vec3_t color, const vec3_t p, int dynamic, const mlea { VectorSubtract (p, sl->origin, v); f = ((1.0f / (DotProduct(v, v) * sl->falloff + sl->distbias)) - sl->subtract); - if (f > 0 && CL_TraceLine(p, sl->origin, NULL, NULL, 0, false) == 1) + if (f > 0 && CL_TraceLine(p, sl->origin, NULL, NULL, 0, false, NULL) == 1) { f *= d_lightstylevalue[sl->style] * (1.0f / 65536.0f); VectorMA(color, f, sl->light, color); @@ -646,7 +646,7 @@ void R_CompleteLightPoint (vec3_t color, const vec3_t p, int dynamic, const mlea rd = r_dlight + i; VectorSubtract (p, rd->origin, v); f = DotProduct(v, v); - if (f < rd->cullradius2 && CL_TraceLine(p, rd->origin, NULL, NULL, 0, false) == 1) + if (f < rd->cullradius2 && CL_TraceLine(p, rd->origin, NULL, NULL, 0, false, NULL) == 1) { f = (1.0f / (f + LIGHTOFFSET)) - rd->subtract; VectorMA(color, f, rd->light, color); @@ -759,7 +759,7 @@ void R_LightModel(const entity_render_t *ent, int numverts, float colorr, float VectorSubtract (v, rd->origin, v); if (DotProduct(v, v) < rd->cullradius2) { - if (CL_TraceLine(ent->origin, rd->origin, NULL, NULL, 0, false) != 1) + if (CL_TraceLine(ent->origin, rd->origin, NULL, NULL, 0, false, NULL) != 1) continue; VectorSubtract (ent->origin, rd->origin, v); f = ((1.0f / (DotProduct(v, v) + LIGHTOFFSET)) - rd->subtract); @@ -901,7 +901,7 @@ void R_UpdateEntLights(entity_render_t *ent) ent->numentlights = 0; if (cl.worldmodel) for (i = 0, sl = cl.worldmodel->lights;i < cl.worldmodel->numlights && ent->numentlights < MAXENTLIGHTS;i++, sl++) - if (CL_TraceLine(ent->origin, sl->origin, NULL, NULL, 0, false) == 1) + if (CL_TraceLine(ent->origin, sl->origin, NULL, NULL, 0, false, NULL) == 1) ent->entlights[ent->numentlights++] = i; } ent->entlightsframe = r_framecount; diff --git a/render.h b/render.h index 09dbcd44..21499f90 100644 --- a/render.h +++ b/render.h @@ -111,11 +111,12 @@ void R_NewMap (void); void R_DrawWorld(entity_render_t *ent); void R_DrawParticles(void); void R_DrawExplosions(void); -void R_DrawBrushModelSky (entity_render_t *ent); -void R_DrawBrushModelNormal (entity_render_t *ent); -void R_DrawZymoticModel (entity_render_t *ent); +void R_DrawBrushModelSky(entity_render_t *ent); +void R_DrawBrushModelNormal(entity_render_t *ent); +void R_DrawZymoticModel(entity_render_t *ent); void R_DrawQ1Q2AliasModel(entity_render_t *ent); -void R_DrawSpriteModel (entity_render_t *ent); +void R_DrawQ1Q2AliasModelFakeShadow(entity_render_t *ent); +void R_DrawSpriteModel(entity_render_t *ent); // LordHavoc: vertex transform #include "transform.h" -- 2.39.2