summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-07-10 17:18:26 +0200
committeraap <aap@papnet.eu>2019-07-10 17:18:26 +0200
commit4a36d64f15f898854bb8a76be86ac9a8c536b291 (patch)
tree2ff1344fb2f1e9859ba15cd56c461d40683359f9 /src/render
parentMerge pull request #128 from erorcun/erorcun (diff)
downloadre3-4a36d64f15f898854bb8a76be86ac9a8c536b291.tar
re3-4a36d64f15f898854bb8a76be86ac9a8c536b291.tar.gz
re3-4a36d64f15f898854bb8a76be86ac9a8c536b291.tar.bz2
re3-4a36d64f15f898854bb8a76be86ac9a8c536b291.tar.lz
re3-4a36d64f15f898854bb8a76be86ac9a8c536b291.tar.xz
re3-4a36d64f15f898854bb8a76be86ac9a8c536b291.tar.zst
re3-4a36d64f15f898854bb8a76be86ac9a8c536b291.zip
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Clouds.cpp14
-rw-r--r--src/render/Coronas.cpp4
-rw-r--r--src/render/Hud.cpp2
-rw-r--r--src/render/Particle.cpp8
-rw-r--r--src/render/PointLights.cpp14
-rw-r--r--src/render/Sprite.cpp20
-rw-r--r--src/render/Timecycle.cpp4
7 files changed, 33 insertions, 33 deletions
diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp
index d582bff8..2ead715b 100644
--- a/src/render/Clouds.cpp
+++ b/src/render/Clouds.cpp
@@ -53,7 +53,7 @@ CClouds::Shutdown(void)
void
CClouds::Update(void)
{
- float s = sin(TheCamera.Orientation - 0.85f);
+ float s = Sin(TheCamera.Orientation - 0.85f);
CloudRotation += CWeather::Wind*s*0.0025f;
IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep() + 0.3f) * 60.0f;
}
@@ -81,7 +81,7 @@ CClouds::Render(void)
float coverage = CWeather::CloudCoverage <= CWeather::Foggyness ? CWeather::Foggyness : CWeather::CloudCoverage;
// Moon
- int moonfadeout = abs(minute - 180); // fully visible at 3AM
+ int moonfadeout = Abs(minute - 180); // fully visible at 3AM
if(moonfadeout < 180){ // fade in/out 3 hours
int brightness = (1.0f - coverage) * (180 - moonfadeout);
RwV3d pos = { 0.0f, -100.0f, 15.0f };
@@ -169,8 +169,8 @@ CClouds::Render(void)
}
// Fluffy clouds
- float rot_sin = sin(CloudRotation);
- float rot_cos = cos(CloudRotation);
+ float rot_sin = Sin(CloudRotation);
+ float rot_cos = Cos(CloudRotation);
int fluffyalpha = 160 * (1.0f - CWeather::Foggyness);
if(fluffyalpha != 0){
static float CoorsOffsetX[37] = {
@@ -210,7 +210,7 @@ CClouds::Render(void)
worldpos.z = pos.z;
if(CSprite::CalcScreenCoors(worldpos, &screenpos, &szx, &szy, false)){
- float sundist = sqrt(sq(screenpos.x-CCoronas::SunScreenX) + sq(screenpos.y-CCoronas::SunScreenY));
+ float sundist = Sqrt(sq(screenpos.x-CCoronas::SunScreenX) + sq(screenpos.y-CCoronas::SunScreenY));
int tr = CTimeCycle::GetFluffyCloudsTopRed();
int tg = CTimeCycle::GetFluffyCloudsTopGreen();
int tb = CTimeCycle::GetFluffyCloudsTopBlue();
@@ -302,7 +302,7 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue,
int16 botred, int16 botgreen, int16 botblue, int16 alpha)
{
RwMatrix *mat = RwFrameGetLTM(RwCameraGetFrame(TheCamera.m_pRwCamera));
- float c = sqrt(mat->right.x * mat->right.x + mat->right.y * mat->right.y);
+ float c = Sqrt(mat->right.x * mat->right.x + mat->right.y * mat->right.y);
if(c > 1.0f)
c = 1.0f;
ms_cameraRoll = acos(c);
@@ -424,7 +424,7 @@ CClouds::RenderHorizon(void)
SCREEN_HEIGHT/300.0f * max(TheCamera.GetPosition().z, 0.0f);
float b = TheCamera.GetUp().z < 0.0f ?
SCREEN_HEIGHT :
- SCREEN_HEIGHT * fabs(TheCamera.GetRight().z);
+ SCREEN_HEIGHT * Abs(TheCamera.GetRight().z);
float z2 = z1 + (a + b)*TheCamera.LODDistMultiplier;
z2 = min(z2, SCREEN_HEIGHT);
CSprite2d::DrawRect(CRect(0, z1, SCREEN_WIDTH, z2),
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp
index 61fa1a5a..5ac9b149 100644
--- a/src/render/Coronas.cpp
+++ b/src/render/Coronas.cpp
@@ -286,8 +286,8 @@ CCoronas::Render(void)
// if distance too big, break streak
if(aCoronas[i].hasValue[1]){
- if(fabs(aCoronas[i].prevX[0] - aCoronas[i].prevX[1]) > 50.0f ||
- fabs(aCoronas[i].prevY[0] - aCoronas[i].prevY[1]) > 50.0f)
+ if(Abs(aCoronas[i].prevX[0] - aCoronas[i].prevX[1]) > 50.0f ||
+ Abs(aCoronas[i].prevY[0] - aCoronas[i].prevY[1]) > 50.0f)
aCoronas[i].hasValue[0] = false;
}
}
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index b3264dc7..81f27153 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -173,7 +173,7 @@ void CHud::Draw()
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
- float fStep = sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127);
+ float fStep = Sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127);
float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f);
CRect rect;
#ifndef ASPECT_RATIO_SCALE
diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp
index 416e5af0..63545dff 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -299,8 +299,8 @@ void CParticle::Initialise()
{
float angle = DEGTORAD(float(i) * float(360.0f / SIN_COS_TABLE_SIZE));
- m_SinTable[i] = sin(angle);
- m_CosTable[i] = cos(angle);
+ m_SinTable[i] = Sin(angle);
+ m_CosTable[i] = Cos(angle);
}
int32 slot = CTxdStore::FindTxdSlot("particle");
@@ -1599,7 +1599,7 @@ void CParticle::Render()
fTrailLength = fDist;
- //Float fRot = atan2( vecDist.x / fDist, sqrtf(1.0f - vecDist.x / fDist * (vecDist.x / fDist)) );
+ //Float fRot = Atan2( vecDist.x / fDist, Sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)) );
float fRot = asinf(vecDist.x / fDist);
fRotation = fRot;
@@ -1651,7 +1651,7 @@ void CParticle::Render()
fTrailLength = fDist;
- //Float fRot = atan2(vecDist.x / fDist, sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)));
+ //Float fRot = Atan2(vecDist.x / fDist, Sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)));
float fRot = asinf(vecDist.x / fDist);
fRotation = fRot;
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
diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp
index d917117a..24577f41 100644
--- a/src/render/Sprite.cpp
+++ b/src/render/Sprite.cpp
@@ -135,8 +135,8 @@ CSprite::RenderOneXLUSprite(float x, float y, float z, float w, float h, uint8 r
void
CSprite::RenderOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, float h, uint8 r, uint8 g, uint8 b, int16 intens, float recipz, float rotation, uint8 a)
{
- float c = cos(DEGTORAD(rotation));
- float s = sin(DEGTORAD(rotation));
+ float c = Cos(DEGTORAD(rotation));
+ float s = Sin(DEGTORAD(rotation));
float xs[4];
float ys[4];
@@ -261,8 +261,8 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(float x, float y, float z,
{
m_bFlushSpriteBufferSwitchZTest = 0;
// TODO: replace with lookup
- float c = cos(DEGTORAD(rotation));
- float s = sin(DEGTORAD(rotation));
+ float c = Cos(DEGTORAD(rotation));
+ float s = Sin(DEGTORAD(rotation));
float xs[4];
float ys[4];
@@ -313,8 +313,8 @@ void
CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, float h, uint8 r, uint8 g, uint8 b, int16 intens, float recipz, float rotation, uint8 a)
{
m_bFlushSpriteBufferSwitchZTest = 0;
- float c = cos(DEGTORAD(rotation));
- float s = sin(DEGTORAD(rotation));
+ float c = Cos(DEGTORAD(rotation));
+ float s = Sin(DEGTORAD(rotation));
float xs[4];
float ys[4];
@@ -365,8 +365,8 @@ void
CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours(float x, float y, float z, float w, float h, uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2, float cx, float cy, float recipz, float rotation, uint8 a)
{
m_bFlushSpriteBufferSwitchZTest = 0;
- float c = cos(DEGTORAD(rotation));
- float s = sin(DEGTORAD(rotation));
+ float c = Cos(DEGTORAD(rotation));
+ float s = Sin(DEGTORAD(rotation));
float xs[4];
float ys[4];
@@ -572,8 +572,8 @@ CSprite::RenderBufferedOneXLUSprite2D_Rotate_Dimension(float x, float y, float w
{
m_bFlushSpriteBufferSwitchZTest = 1;
CRGBA col(intens * colour.red >> 8, intens * colour.green >> 8, intens * colour.blue >> 8, alpha);
- float c = cos(DEGTORAD(rotation));
- float s = sin(DEGTORAD(rotation));
+ float c = Cos(DEGTORAD(rotation));
+ float s = Sin(DEGTORAD(rotation));
Set6Vertices2D(&SpriteBufferVerts[6 * nSpriteBufferIndex],
x + c*w - s*h,
diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp
index af154716..7ab3e91e 100644
--- a/src/render/Timecycle.cpp
+++ b/src/render/Timecycle.cpp
@@ -299,9 +299,9 @@ CTimeCycle::Update(void)
float sunAngle = 2*PI*(CClock::GetMinutes() + CClock::GetHours()*60)/(24*60);
CVector &sunPos = GetSunPosition();
- sunPos.x = sinf(sunAngle);
+ sunPos.x = Sin(sunAngle);
sunPos.y = 1.0f;
- sunPos.z = 0.2f - cosf(sunAngle);
+ sunPos.z = 0.2f - Cos(sunAngle);
sunPos.Normalise();
CShadows::CalcPedShadowValues(sunPos,