From 4a36d64f15f898854bb8a76be86ac9a8c536b291 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 10 Jul 2019 17:18:26 +0200 Subject: added wrappers around math functions --- src/render/PointLights.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/render/PointLights.cpp') diff --git a/src/render/PointLights.cpp b/src/render/PointLights.cpp index 9e98a327..b5d4ece1 100644 --- a/src/render/PointLights.cpp +++ b/src/render/PointLights.cpp @@ -33,7 +33,7 @@ CPointLights::AddLight(uint8 type, CVector coors, CVector dir, float radius, flo return; dist = coors - TheCamera.GetPosition(); - if(fabs(dist.x) < MAX_DIST && fabs(dist.y) < MAX_DIST){ + if(Abs(dist.x) < MAX_DIST && Abs(dist.y) < MAX_DIST){ distance = dist.Magnitude(); if(distance < MAX_DIST){ aLights[NumLights].type = type; @@ -73,9 +73,9 @@ CPointLights::GenerateLightsAffectingObject(CVector *objCoors) // same weird distance calculation. simplified here dist = aLights[i].coors - *objCoors; radius = aLights[i].radius; - if(fabs(dist.x) < radius && - fabs(dist.y) < radius && - fabs(dist.z) < radius){ + if(Abs(dist.x) < radius && + Abs(dist.y) < radius && + Abs(dist.z) < radius){ distance = dist.Magnitude(); if(distance < radius){ @@ -217,7 +217,7 @@ CPointLights::RenderFogEffect(void) // more intensity the closer to light source intensity *= 1.0f - sq(dot/FOG_AREA_LENGTH); // more intensity the closer to line - intensity *= 1.0f - sq(sqrt(linedistsq) / FOG_AREA_WIDTH); + intensity *= 1.0f - sq(Sqrt(linedistsq) / FOG_AREA_WIDTH); if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){ float rotation = (CTimer::GetTimeInMilliseconds()&0x1FFF) * 2*3.14f / 0x1FFF; @@ -251,11 +251,11 @@ CPointLights::RenderFogEffect(void) float dx = xi - aLights[i].coors.x; float dy = yi - aLights[i].coors.y; - float lightdist = sqrt(sq(dx) + sq(dy)); + float lightdist = Sqrt(sq(dx) + sq(dy)); if(lightdist < FOG_AREA_RADIUS){ dx = xi - TheCamera.GetPosition().x; dy = yi - TheCamera.GetPosition().y; - float camdist = sqrt(sq(dx) + sq(dy)); + float camdist = Sqrt(sq(dx) + sq(dy)); if(camdist < MAX_DIST){ float intensity; // distance fade -- cgit v1.2.3 From 90e093cd47fb2af10617b1d404fc65ca813782ec Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 10 Jul 2019 17:34:11 +0200 Subject: and of course the last commit didnt fix everything --- src/render/PointLights.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/render/PointLights.cpp') diff --git a/src/render/PointLights.cpp b/src/render/PointLights.cpp index b5d4ece1..a015ec54 100644 --- a/src/render/PointLights.cpp +++ b/src/render/PointLights.cpp @@ -213,7 +213,7 @@ CPointLights::RenderFogEffect(void) if(dot > 0.0f && dot < FOG_AREA_LENGTH && linedistsq < sq(FOG_AREA_WIDTH)){ float intensity = 158.0f * fogginess; // more intensity the smaller the angle - intensity *= dot/sqrt(distsq); + intensity *= dot/Sqrt(distsq); // more intensity the closer to light source intensity *= 1.0f - sq(dot/FOG_AREA_LENGTH); // more intensity the closer to line -- cgit v1.2.3