summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-04-08 20:18:19 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-04-08 20:18:19 +0200
commitcf36e09d391eb4d25d84c834579be1fd33c85a94 (patch)
tree85702d60d9f4c7c5399e4c031422f99bd5ec5239 /src/render
parentMerge branch 'master' into garages_dev (diff)
downloadre3-cf36e09d391eb4d25d84c834579be1fd33c85a94.tar
re3-cf36e09d391eb4d25d84c834579be1fd33c85a94.tar.gz
re3-cf36e09d391eb4d25d84c834579be1fd33c85a94.tar.bz2
re3-cf36e09d391eb4d25d84c834579be1fd33c85a94.tar.lz
re3-cf36e09d391eb4d25d84c834579be1fd33c85a94.tar.xz
re3-cf36e09d391eb4d25d84c834579be1fd33c85a94.tar.zst
re3-cf36e09d391eb4d25d84c834579be1fd33c85a94.zip
Diffstat (limited to '')
-rw-r--r--src/render/Weather.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp
index 0970b94b..34caf1bd 100644
--- a/src/render/Weather.cpp
+++ b/src/render/Weather.cpp
@@ -91,9 +91,17 @@ const float Windiness[] = {
#define STREAK_MIN_DISTANCE (8.0f)
#define STREAK_MAX_DISTANCE (16.0f)
+#define SPLASH_CHECK_RADIUS (7.0f)
+#define SPLASH_OFFSET_RADIUS (2.0f)
+
#define STREAK_LIFETIME (4.0f)
#define STREAK_INTEROLATION_TIME (0.3f)
+#define RAIN_COLOUR_R (200)
+#define RAIN_COLOUR_G (200)
+#define RAIN_COLOUR_B (256)
+#define RAIN_ALPHA (255)
+
void CWeather::Init(void)
{
NewWeatherType = WEATHER_SUNNY;
@@ -356,11 +364,14 @@ void CWeather::AddRain()
for (int i = 0; i < num_splash_attempts; i++) {
CColPoint point;
CEntity* entity;
- CVector np = fp + CVector(CGeneral::GetRandomNumberInRange(-7.0f, 7.0f), CGeneral::GetRandomNumberInRange(-7.0f, 7.0f), 0.0f);
+ CVector np = fp + CVector(CGeneral::GetRandomNumberInRange(-SPLASH_CHECK_RADIUS, SPLASH_CHECK_RADIUS), CGeneral::GetRandomNumberInRange(-SPLASH_CHECK_RADIUS, SPLASH_CHECK_RADIUS), 0.0f);
if (CWorld::ProcessVerticalLine(np + CVector(0.0f, 0.0f, 40.0f), -40.0f, point, entity, true, false, false, false, true, false, nil)) {
for (int j = 0; j < num_splashes; j++)
CParticle::AddParticle((CGeneral::GetRandomTrueFalse() ? PARTICLE_RAIN_SPLASH : PARTICLE_RAIN_SPLASHUP),
- CVector(np.x + CGeneral::GetRandomNumberInRange(-2.0f, 2.0f), np.y + CGeneral::GetRandomNumberInRange(-2.0f, 2.0f), point.point.z + 0.1f),
+ CVector(
+ np.x + CGeneral::GetRandomNumberInRange(-SPLASH_OFFSET_RADIUS, SPLASH_OFFSET_RADIUS),
+ np.y + CGeneral::GetRandomNumberInRange(-SPLASH_OFFSET_RADIUS, SPLASH_OFFSET_RADIUS),
+ point.point.z + 0.1f),
CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, colour);
}
}
@@ -387,7 +398,7 @@ void RenderOneRainStreak(CVector pos, CVector unused, int intensity, bool scale,
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored + 0], pos.x + 11.0f * TheCamera.GetUp().x, pos.y + 11.0f * TheCamera.GetUp().y, pos.z + 11.0f * TheCamera.GetUp().z);
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored + 1], 0, 0, 0, 0);
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored + 1], pos.x - 9.0f * TheCamera.GetRight().x, pos.y - 9.0f * TheCamera.GetRight().y, pos.z - 9.0f * TheCamera.GetUp().z);
- RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored + 2], 200 * intensity / 256, 200 * intensity / 256, intensity, 255);
+ RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored + 2], RAIN_COLOUR_R * intensity / 256, RAIN_COLOUR_G * intensity / 256, RAIN_COLOUR_B * intensity / 256, RAIN_ALPHA);
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored + 2], pos.x, pos.y, pos.z);
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored + 3], 0, 0, 0, 0);
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored + 3], pos.x + 9.0f * TheCamera.GetRight().x, pos.y + 9.0f * TheCamera.GetRight().y, pos.z + 9.0f * TheCamera.GetUp().z);
@@ -443,16 +454,12 @@ void CWeather::RenderRainStreaks(void)
Streaks[i].timer = 0;
else{
int intensity;
- if (secondsElapsed < STREAK_INTEROLATION_TIME) {
+ if (secondsElapsed < STREAK_INTEROLATION_TIME)
intensity = base_intensity * 0.5f * secondsElapsed / STREAK_INTEROLATION_TIME;
- }
- else if (secondsElapsed > (STREAK_LIFETIME - STREAK_INTEROLATION_TIME)) {
+ else if (secondsElapsed > (STREAK_LIFETIME - STREAK_INTEROLATION_TIME))
intensity = (STREAK_LIFETIME - secondsElapsed) * 0.5f * base_intensity / STREAK_INTEROLATION_TIME;
- }
- else {
+ else
intensity = base_intensity * 0.5f;
- }
- debug("intensity: %d\n", intensity);
CVector dir = Streaks[i].direction;
dir.Normalise();
CVector pos = Streaks[i].position + secondsElapsed * Streaks[i].direction;