X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=r_sprites.c;h=9bf13fb912f61542abc3bebc5eb473f007d1a939;hp=a45a3e73b5ddaefe8a3535b906903033b143c155;hb=b2a1a3ffa49a3f315f9f59aa011c5888ad4bea4b;hpb=5aefe7c200a0278927239cdd4eb56391a66056f1 diff --git a/r_sprites.c b/r_sprites.c index a45a3e73..9bf13fb9 100644 --- a/r_sprites.c +++ b/r_sprites.c @@ -181,7 +181,7 @@ static void R_RotateSprite(const mspriteframe_t *frame, vec3_t origin, vec3_t le // Now that we've kicked center-hotspotted sprites, rotate using the appropriate matrix :) // determine the angle of a sprite, we could only do that once though and - // add a `qboolean initialized' to the mspriteframe_t struct... let's get the direction vector of it :) + // add a `qbool initialized' to the mspriteframe_t struct... let's get the direction vector of it :) angle = atan(dir[1] / dir[0]) * 180.0f/M_PI; @@ -208,7 +208,7 @@ static float spritetexcoord2f[4*2] = {0, 1, 0, 0, 1, 0, 1, 1}; static void R_Model_Sprite_Draw_TransparentCallback(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist) { int i; - dp_model_t *model = ent->model; + model_t *model = ent->model; vec3_t left, up, org, mforward, mleft, mup, middle; float scale, dx, dy, hud_vs_screen; int edge = 0; @@ -381,7 +381,7 @@ static void R_Model_Sprite_Draw_TransparentCallback(const entity_render_t *ent, break; } - // LordHavoc: interpolated sprite rendering + // LadyHavoc: interpolated sprite rendering for (i = 0;i < MAX_FRAMEBLENDS;i++) { if (ent->frameblend[i].lerp >= 0.01f) @@ -392,9 +392,15 @@ static void R_Model_Sprite_Draw_TransparentCallback(const entity_render_t *ent, frame = model->sprite.sprdata_frames + ent->frameblend[i].subframe; texture = R_GetCurrentTexture(model->data_textures + ent->frameblend[i].subframe); - // lit sprite by lightgrid if it is not fullbright, lit only ambient + // sprites are fullbright by default, but if this one is not fullbright we + // need to combine the lighting into ambient as sprite lighting is not + // directional if (!(texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT)) - VectorAdd(ent->modellight_ambient, ent->modellight_diffuse, rsurface.modellight_ambient); // sprites dont use lightdirection + { + VectorMAM(1.0f, texture->render_modellight_ambient, 0.25f, texture->render_modellight_diffuse, texture->render_modellight_ambient); + VectorClear(texture->render_modellight_diffuse); + VectorClear(texture->render_modellight_specular); + } // SPR_LABEL should not use depth test AT ALL if(model->sprite.sprnum_type == SPR_LABEL || model->sprite.sprnum_type == SPR_LABEL_SCALE) @@ -410,7 +416,11 @@ static void R_Model_Sprite_Draw_TransparentCallback(const entity_render_t *ent, R_CalcSprite_Vertex3f(vertex3f, org, left, up, frame->left, frame->right, frame->down, frame->up); - R_DrawCustomSurface_Texture(texture, &identitymatrix, texture->currentmaterialflags, 0, 4, 0, 2, false, false); + if (r_showspriteedges.integer) + for (i = 0; i < 4; i++) + R_DebugLine(vertex3f + i * 3, vertex3f + ((i + 1) % 4) * 3); + + R_DrawCustomSurface_Texture(texture, &identitymatrix, texture->currentmaterialflags, 0, 4, 0, 2, false, false, false); } }