X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=r_sprites.c;h=d01c99a47c0549984daa755d7f5d12c3a1ff79b0;hb=c38d0d2d6409d9b3174b6cf04f1bd09694cbfc81;hp=cf57c30ca34ffef8015858dfd25fcd703cf8c463;hpb=2048a824c4d5c5d4d031e519dd3a125db35415fd;p=xonotic%2Fdarkplaces.git diff --git a/r_sprites.c b/r_sprites.c index cf57c30c..d01c99a4 100644 --- a/r_sprites.c +++ b/r_sprites.c @@ -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); } } @@ -424,6 +434,6 @@ void R_Model_Sprite_Draw(entity_render_t *ent) return; Matrix4x4_OriginFromMatrix(&ent->matrix, org); - R_MeshQueue_AddTransparent((ent->flags & RENDER_WORLDOBJECT) ? TRANSPARENTSORT_SKY : (ent->flags & RENDER_NODEPTHTEST) ? TRANSPARENTSORT_HUD : rsurface.texture->transparentsort, org, R_Model_Sprite_Draw_TransparentCallback, ent, 0, rsurface.rtlight); + R_MeshQueue_AddTransparent((ent->flags & RENDER_WORLDOBJECT) ? TRANSPARENTSORT_SKY : (ent->flags & RENDER_NODEPTHTEST) ? TRANSPARENTSORT_HUD : TRANSPARENTSORT_DISTANCE, org, R_Model_Sprite_Draw_TransparentCallback, ent, 0, rsurface.rtlight); }