Moved force-fog settings into track.
This commit is contained in:
parent
22092e6459
commit
8785ddf148
@ -196,7 +196,8 @@ void DrawCalls::handleSTKCommon(scene::ISceneNode *Node,
|
||||
}
|
||||
|
||||
// Transparent
|
||||
if (World::getWorld() && World::getWorld()->isFogEnabled())
|
||||
const World *world = World::getWorld();
|
||||
if (world && world->getTrack()->isFogEnabled())
|
||||
{
|
||||
const Track * const track = World::getWorld()->getTrack();
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "graphics/rtts.hpp"
|
||||
#include "graphics/shaders.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/tuple.hpp"
|
||||
#include <SColor.h>
|
||||
#include <S3DVertex.h>
|
||||
@ -260,7 +261,8 @@ void AbstractGeometryPasses::renderTransparent(const DrawCalls& draw_calls,
|
||||
if (CVS->isARBBaseInstanceUsable())
|
||||
glBindVertexArray(VAOManager::getInstance()->getVAO(video::EVT_STANDARD));
|
||||
|
||||
if (World::getWorld() && World::getWorld()->isFogEnabled())
|
||||
const World *world = World::getWorld();
|
||||
if (world && world->getTrack()->isFogEnabled())
|
||||
{
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
renderTransparenPass<Shaders::TransparentFogShader, video::EVT_STANDARD,
|
||||
|
@ -429,8 +429,8 @@ void ShaderBasedRenderer::renderScene(scene::ICameraSceneNode * const camnode,
|
||||
}
|
||||
|
||||
// Render ambient scattering
|
||||
if (CVS->isDefferedEnabled() && World::getWorld() != NULL &&
|
||||
World::getWorld()->isFogEnabled())
|
||||
const World *world = World::getWorld();
|
||||
if (CVS->isDefferedEnabled() && world && world->getTrack()->isFogEnabled())
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Ambient scatter", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_FOG));
|
||||
@ -446,8 +446,7 @@ void ShaderBasedRenderer::renderScene(scene::ICameraSceneNode * const camnode,
|
||||
}
|
||||
|
||||
// Render discrete lights scattering
|
||||
if (CVS->isDefferedEnabled() && World::getWorld() != NULL &&
|
||||
World::getWorld()->isFogEnabled())
|
||||
if (CVS->isDefferedEnabled() && world && world->getTrack()->isFogEnabled())
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- PointLight Scatter", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_FOG));
|
||||
|
@ -512,7 +512,8 @@ void STKMeshSceneNode::render()
|
||||
else
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (World::getWorld() && World::getWorld()->isFogEnabled())
|
||||
const World* world = World::getWorld();
|
||||
if (world && world->getTrack()->isFogEnabled())
|
||||
{
|
||||
Shaders::TransparentFogShader::getInstance()->use();
|
||||
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
||||
|
@ -133,7 +133,6 @@ World::World() : WorldStatus()
|
||||
m_schedule_tutorial = false;
|
||||
m_is_network_world = false;
|
||||
m_weather = NULL;
|
||||
m_force_disable_fog = false;
|
||||
|
||||
m_stop_music_when_dialog_open = true;
|
||||
|
||||
@ -1291,12 +1290,6 @@ void World::escapePressed()
|
||||
new RacePausedDialog(0.8f, 0.6f);
|
||||
} // escapePressed
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool World::isFogEnabled() const
|
||||
{
|
||||
return !m_force_disable_fog && (m_track != NULL && m_track->isFogEnabled());
|
||||
} // isFogEnabled
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Returns the start transform with the give index.
|
||||
* \param rescue_pos Index of the start position to be returned.
|
||||
|
@ -97,7 +97,6 @@ protected:
|
||||
RandomGenerator m_random;
|
||||
|
||||
Physics* m_physics;
|
||||
bool m_force_disable_fog;
|
||||
AbstractKart* m_fastest_kart;
|
||||
/** Number of eliminated karts. */
|
||||
int m_eliminated_karts;
|
||||
@ -324,8 +323,6 @@ public:
|
||||
/** Returns a pointer to the Scripting Engine. */
|
||||
Scripting::ScriptEngine *getScriptEngine()
|
||||
const { return m_script_engine; }
|
||||
//-------------------------------------------------------------------------
|
||||
bool isFogEnabled() const;
|
||||
// ------------------------------------------------------------------------
|
||||
void moveKartTo(AbstractKart* kart, const btTransform &t);
|
||||
// ------------------------------------------------------------------------
|
||||
@ -337,9 +334,6 @@ public:
|
||||
/** \return whether this world can generate/have highscores */
|
||||
bool useHighScores() const { return m_use_highscores; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Override track fog value to force disabled */
|
||||
void forceFogDisabled(bool v) { m_force_disable_fog = v; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Override if you want to know when a kart presses fire */
|
||||
virtual void onFirePressed(Controller* who) {}
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "tracks/arena_node_3d.hpp"
|
||||
#include "tracks/drive_node_2d.hpp"
|
||||
#include "tracks/drive_node_3d.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
const int Graph::UNKNOWN_SECTOR = -1;
|
||||
@ -245,7 +246,7 @@ RenderTarget* Graph::makeMiniMap(const core::dimension2du &dimension,
|
||||
|
||||
const video::SColor oldClearColor = irr_driver->getClearColor();
|
||||
irr_driver->setClearbackBufferColor(video::SColor(0, 255, 255, 255));
|
||||
World::getWorld()->forceFogDisabled(true);
|
||||
World::getWorld()->getTrack()->forceFogDisabled(true);
|
||||
#ifndef SERVER_ONLY
|
||||
m_render_target = irr_driver->createRenderTarget(dimension, name);
|
||||
#endif
|
||||
@ -330,7 +331,7 @@ RenderTarget* Graph::makeMiniMap(const core::dimension2du &dimension,
|
||||
irr_driver->removeCameraSceneNode(camera);
|
||||
|
||||
irr_driver->setClearbackBufferColor(oldClearColor);
|
||||
World::getWorld()->forceFogDisabled(false);
|
||||
World::getWorld()->getTrack()->forceFogDisabled(false);
|
||||
|
||||
irr_driver->getSceneManager()->clear();
|
||||
VAOManager::kill();
|
||||
|
@ -145,8 +145,9 @@ Track::Track(const std::string &filename)
|
||||
m_render_target = NULL;
|
||||
m_minimap_x_scale = 1.0f;
|
||||
m_minimap_y_scale = 1.0f;
|
||||
m_startup_run = false;
|
||||
m_default_number_of_laps= 3;
|
||||
m_force_disable_fog = false;
|
||||
m_startup_run = false;
|
||||
m_default_number_of_laps = 3;
|
||||
m_all_nodes.clear();
|
||||
m_static_physics_only_nodes.clear();
|
||||
m_all_cached_meshes.clear();
|
||||
|
@ -313,7 +313,12 @@ private:
|
||||
/** The name used in sorting the track. */
|
||||
core::stringw m_sort_name;
|
||||
|
||||
/** True if the track uses fog. */
|
||||
bool m_use_fog;
|
||||
|
||||
/** Can be set to force fog off (e.g. for rendering minimap). */
|
||||
bool m_force_disable_fog;
|
||||
|
||||
/** True if this track supports using smoothed normals. */
|
||||
bool m_smooth_normals;
|
||||
|
||||
@ -546,7 +551,16 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
ParticleKind* getSkyParticles () { return m_sky_particles; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool isFogEnabled() const { return m_use_fog; }
|
||||
/** Override track fog value to force disabled */
|
||||
void forceFogDisabled(bool v) { m_force_disable_fog = v; }
|
||||
//-------------------------------------------------------------------------
|
||||
/** Returns if fog is currently enabled. It can be disabled per track, or
|
||||
* temporary be disabled (e.g. for rendering mini map). */
|
||||
bool isFogEnabled() const
|
||||
{
|
||||
return !m_force_disable_fog && m_use_fog;
|
||||
} // isFogEnabled
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
float getFogStart() const { return m_fog_start; }
|
||||
// ------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user