X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=cl_particles.c;h=bf3c1d1637ec29b5830a612e749dd0a41fc0254e;hp=0fe0be4d09c7263c61ed59857b0899ac13b61601;hb=46964b3848eb7471d2f0e2284ae389b4b53337c1;hpb=f7750d34bc095248efb2aec0cefb2e3db367ab3b diff --git a/cl_particles.c b/cl_particles.c index 0fe0be4d..bf3c1d16 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -2180,7 +2180,7 @@ static void R_InitParticleTexture (void) // we invert it again during the blendfunc to make it work... #ifndef DUMPPARTICLEFONT - decalskinframe = R_SkinFrame_LoadExternal("particles/particlefont.tga", TEXF_ALPHA | TEXF_FORCELINEAR | TEXF_RGBMULTIPLYBYALPHA, false); + decalskinframe = R_SkinFrame_LoadExternal("particles/particlefont.tga", TEXF_ALPHA | TEXF_FORCELINEAR | TEXF_RGBMULTIPLYBYALPHA, false, false); if (decalskinframe) { particlefonttexture = decalskinframe->base; @@ -2427,12 +2427,7 @@ static void R_InitParticleTexture (void) Con_Printf("particles/particlefont.txt: texnum %i outside valid range (0 to %i)\n", i, MAX_PARTICLETEXTURES); continue; } - sf = R_SkinFrame_LoadExternal(texturename, TEXF_ALPHA | TEXF_FORCELINEAR | TEXF_RGBMULTIPLYBYALPHA, true); // note: this loads as sRGB if sRGB is active! - if(!sf) - { - // R_SkinFrame_LoadExternal already complained - continue; - } + sf = R_SkinFrame_LoadExternal(texturename, TEXF_ALPHA | TEXF_FORCELINEAR | TEXF_RGBMULTIPLYBYALPHA, true, true); // note: this loads as sRGB if sRGB is active! particletexture[i].texture = sf->base; particletexture[i].s1 = s1; particletexture[i].t1 = t1; @@ -2500,7 +2495,7 @@ static void R_DrawDecal_TransparentCallback(const entity_render_t *ent, const rt vec_t right[3], up[3], size, ca; float alphascale = (1.0f / 65536.0f) * cl_particles_alpha.value; - RSurf_ActiveWorldEntity(); + RSurf_ActiveModelEntity(r_refdef.scene.worldentity, false, false, false); r_refdef.stats[r_stat_drawndecals] += numsurfaces; // R_Mesh_ResetTextureState(); @@ -2617,7 +2612,7 @@ void R_DrawDecals (void) if (!drawdecals) continue; - if (DotProduct(r_refdef.view.origin, decal->normal) > DotProduct(decal->org, decal->normal) && VectorDistance2(decal->org, r_refdef.view.origin) < drawdist2 * (decal->size * decal->size)) + if (!r_refdef.view.useperspective || (DotProduct(r_refdef.view.origin, decal->normal) > DotProduct(decal->org, decal->normal) && VectorDistance2(decal->org, r_refdef.view.origin) < drawdist2 * (decal->size * decal->size))) R_MeshQueue_AddTransparent(TRANSPARENTSORT_DISTANCE, decal->org, R_DrawDecal_TransparentCallback, NULL, i, NULL); continue; killdecal: @@ -2659,7 +2654,7 @@ static void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const float minparticledist_start, minparticledist_end; qboolean dofade; - RSurf_ActiveWorldEntity(); + RSurf_ActiveModelEntity(r_refdef.scene.worldentity, false, false, false); Vector4Set(colormultiplier, r_refdef.view.colorscale * (1.0 / 256.0f), r_refdef.view.colorscale * (1.0 / 256.0f), r_refdef.view.colorscale * (1.0 / 256.0f), cl_particles_alpha.value * (1.0 / 256.0f)); @@ -2723,10 +2718,14 @@ static void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const // note: lighting is not cheap! if (particletype[p->typeindex].lighting) { + float a[3], c[3], dir[3]; vecorg[0] = p->org[0]; vecorg[1] = p->org[1]; vecorg[2] = p->org[2]; - R_LightPoint(c4f, vecorg, LP_LIGHTMAP | LP_RTWORLD | LP_DYNLIGHT); + R_CompleteLightPoint(a, c, dir, vecorg, LP_LIGHTMAP | LP_RTWORLD | LP_DYNLIGHT, r_refdef.scene.lightmapintensity, r_refdef.scene.ambientintensity); + c4f[0] = p->color[0] * colormultiplier[0] * (a[0] + 0.25f * c[0]); + c4f[1] = p->color[1] * colormultiplier[1] * (a[1] + 0.25f * c[1]); + c4f[2] = p->color[2] * colormultiplier[2] * (a[2] + 0.25f * c[2]); } // mix in the fog color if (r_refdef.fogenabled) @@ -2863,6 +2862,13 @@ static void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const t2f[6] = v[1];t2f[7] = tex->t1; break; } + if (r_showparticleedges.integer) + { + R_DebugLine(v3f, v3f + 3); + R_DebugLine(v3f + 3, v3f + 6); + R_DebugLine(v3f + 6, v3f + 9); + R_DebugLine(v3f + 9, v3f); + } } // now render batches of particles based on blendmode and texture @@ -3133,7 +3139,7 @@ void R_DrawParticles (void) continue; } // anything else just has to be in front of the viewer and visible at this distance - if (DotProduct(p->org, r_refdef.view.forward) >= minparticledist_start && VectorDistance2(p->org, r_refdef.view.origin) < drawdist2 * (p->size * p->size)) + if (!r_refdef.view.useperspective || (DotProduct(p->org, r_refdef.view.forward) >= minparticledist_start && VectorDistance2(p->org, r_refdef.view.origin) < drawdist2 * (p->size * p->size))) R_MeshQueue_AddTransparent(TRANSPARENTSORT_DISTANCE, p->sortorigin, R_DrawParticle_TransparentCallback, NULL, i, NULL); break; }