Fix more trash

This commit is contained in:
Lwmte 2021-11-10 19:37:11 +03:00
parent bf405e77d4
commit d7c067b874
4 changed files with 16 additions and 18 deletions

View file

@ -62,10 +62,18 @@ namespace Environment
FlashProgress = 0.0f;
FlashColorBase = Vector3::Zero;
// Clear weather particles
// Clear weather
Weather = WeatherType::None;
WeatherStrength = 1.0f;
Particles.clear();
}
void EnvironmentController::SetWeather(WeatherType weather, float strength)
{
Weather = weather;
WeatherStrength = strength;
}
void EnvironmentController::Flash(int r, int g, int b, float speed)
{
FlashProgress = 1.0f;
@ -203,13 +211,10 @@ namespace Environment
if (Particles.size() > 0)
Particles.erase(std::remove_if(Particles.begin(), Particles.end(), [](const WeatherParticle& part) { return !part.Enabled; }), Particles.end());
// TEST!
Weather = WeatherType::Rain;
if (Weather == WeatherType::None)
return;
int spawnDensity = (Weather == WeatherType::Rain) ? RAIN_SPAWN_DENSITY : SNOW_SPAWN_DENSITY;
int spawnDensity = round((float)(Weather == WeatherType::Rain ? RAIN_SPAWN_DENSITY : SNOW_SPAWN_DENSITY) * WeatherStrength);
int maxCount = (Weather == WeatherType::Rain) ? WEATHER_PARTICLES_MAX_COUNT : WEATHER_PARTICLES_MAX_COUNT / SNOW_PARTICLES_COUNT_DIVIDER;
int newParticlesCount = 0;

View file

@ -9,11 +9,11 @@ namespace Environment
constexpr auto WEATHER_PARTICLES_MAX_COUNT = 1024;
constexpr auto SNOW_PARTICLES_COUNT_DIVIDER = 2;
constexpr auto SNOW_SPAWN_DENSITY = 32;
constexpr auto RAIN_SPAWN_DENSITY = 256;
constexpr auto SNOW_SPAWN_DENSITY = 16;
constexpr auto RAIN_SPAWN_DENSITY = 32;
constexpr auto MAX_SNOW_SIZE = 32;
constexpr auto MAX_RAIN_SIZE = 96;
constexpr auto MAX_RAIN_SIZE = 128;
constexpr auto WEATHER_PARTICLES_TRANSPARENCY = 0.8f;
constexpr auto WEATHER_PARTICLES_NEAR_DEATH_LIFE_VALUE = 16;
@ -57,14 +57,15 @@ namespace Environment
const std::vector<WeatherParticle>& GetParticles() const { return Particles; }
void SetWeather(WeatherType weather, float strength);
void Flash(int r, int g, int b, float speed);
void Update();
void Clear();
private:
// Weather
float WeatherStrength = 1.0f;
WeatherType Weather = WeatherType::Snow;
int WeatherStrength;
std::vector<WeatherParticle> Particles;
// Sky

View file

@ -76,14 +76,6 @@ enum RENDERER_SPRITE_TYPE
SPRITE_TYPE_BILLBOARD_LOOKAT
};
enum RENDERER_SPRITE_ROTATION
{
SPRITE_ROTATION_0_DEGREES,
SPRITE_ROTATION_90_DEGREES,
SPRITE_ROTATION_180_DEGREES,
SPRITE_ROTATION_270_DEGREES,
};
enum RENDERER_POLYGON_SHAPE
{
RENDERER_POLYGON_QUAD,

View file

@ -123,7 +123,7 @@ namespace TEN::Renderer
addSpriteBillboardConstrained(&m_sprites[Objects[ID_DEFAULT_SPRITES].meshIndex + SPR_LIGHTHING],
c,
Vector4(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f),
SPRITE_ROTATION_90_DEGREES,
(PI / 2),
1.0f,
{ arc->width * 8.0f,
Vector3::Distance(pos1, pos2) },