Use debug slider to change ambient on the fly.
This commit is contained in:
parent
5dffc86d26
commit
c8a9515ad0
@ -1624,8 +1624,14 @@ void IrrDriver::onUnloadWorld()
|
||||
void IrrDriver::setAmbientLight(const video::SColor &light)
|
||||
{
|
||||
m_scene_manager->setAmbientLight(light);
|
||||
m_SH_dirty = true;
|
||||
} // setAmbientLight
|
||||
|
||||
video::SColorf IrrDriver::getAmbientLight() const
|
||||
{
|
||||
return m_scene_manager->getAmbientLight();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Displays the FPS on the screen.
|
||||
*/
|
||||
|
@ -213,8 +213,6 @@ private:
|
||||
Shaders *m_shaders;
|
||||
/** Wind. */
|
||||
Wind *m_wind;
|
||||
float m_exposure;
|
||||
float m_lwhite;
|
||||
/** RTTs. */
|
||||
RTT *m_rtts;
|
||||
std::vector<core::matrix4> sun_ortho_matrix;
|
||||
@ -291,25 +289,7 @@ public:
|
||||
return hasVSLayer;
|
||||
}
|
||||
|
||||
float getExposure() const
|
||||
{
|
||||
return m_exposure;
|
||||
}
|
||||
|
||||
void setExposure(float v)
|
||||
{
|
||||
m_exposure = v;
|
||||
}
|
||||
|
||||
float getLwhite() const
|
||||
{
|
||||
return m_lwhite;
|
||||
}
|
||||
|
||||
void setLwhite(float v)
|
||||
{
|
||||
m_lwhite = v;
|
||||
}
|
||||
video::SColorf getAmbientLight() const;
|
||||
|
||||
struct GlowData {
|
||||
scene::ISceneNode * node;
|
||||
|
@ -430,8 +430,6 @@ void Track::cleanup()
|
||||
//-----------------------------------------------------------------------------
|
||||
void Track::loadTrackInfo()
|
||||
{
|
||||
irr_driver->setLwhite(1.);
|
||||
irr_driver->setExposure(0.09f);
|
||||
// Default values
|
||||
m_use_fog = false;
|
||||
m_fog_max = 1.0f;
|
||||
|
@ -83,8 +83,9 @@ enum DebugMenuCommand
|
||||
DEBUG_TOGGLE_GUI,
|
||||
DEBUG_HIDE_KARTS,
|
||||
DEBUG_THROTTLE_FPS,
|
||||
DEBUG_TWEAK_SHADER_EXPOSURE,
|
||||
DEBUG_TWEAK_SHADER_LWHITE
|
||||
DEBUG_CHANGE_AMBIENT_RED,
|
||||
DEBUG_CHANGE_AMBIENT_GREEN,
|
||||
DEBUG_CHANGE_AMBIENT_BLUE,
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -188,10 +189,11 @@ bool onEvent(const SEvent &event)
|
||||
sub->addItem(L"Anvil", DEBUG_ATTACHMENT_ANVIL);
|
||||
sub->addItem(L"Parachute", DEBUG_ATTACHMENT_PARACHUTE);
|
||||
|
||||
//mnu->addItem(L"Adjust shaders >", -1, true, true);
|
||||
//sub = mnu->getSubMenu(3);
|
||||
//sub->addItem(L"Exposure", DEBUG_TWEAK_SHADER_EXPOSURE);
|
||||
//sub->addItem(L"LWhite", DEBUG_TWEAK_SHADER_LWHITE);
|
||||
mnu->addItem(L"Adjust Ambient >", -1, true, true);
|
||||
sub = mnu->getSubMenu(3);
|
||||
sub->addItem(L"Red ", DEBUG_CHANGE_AMBIENT_RED);
|
||||
sub->addItem(L"Green", DEBUG_CHANGE_AMBIENT_GREEN);
|
||||
sub->addItem(L"Blue", DEBUG_CHANGE_AMBIENT_BLUE);
|
||||
|
||||
mnu->addItem(L"Profiler",DEBUG_PROFILER);
|
||||
if (UserConfigParams::m_profiler_enabled)
|
||||
@ -438,13 +440,32 @@ bool onEvent(const SEvent &event)
|
||||
kart->getNode()->setVisible(false);
|
||||
}
|
||||
}
|
||||
else if (cmdID == DEBUG_TWEAK_SHADER_EXPOSURE)
|
||||
else if (cmdID == DEBUG_CHANGE_AMBIENT_RED)
|
||||
{
|
||||
new DebugSliderDialog("exposure", "Exposure", [](){ return irr_driver->getExposure() * 100.f; }, [](int v){irr_driver->setExposure(v / 100.f); });
|
||||
new DebugSliderDialog("Red", "Red", [](){ return irr_driver->getAmbientLight().r * 255.; },
|
||||
[](int v){
|
||||
video::SColor ambient = irr_driver->getAmbientLight().toSColor();
|
||||
ambient.setRed(v);
|
||||
irr_driver->setAmbientLight(ambient); }
|
||||
);
|
||||
}
|
||||
else if (cmdID == DEBUG_TWEAK_SHADER_LWHITE)
|
||||
else if (cmdID == DEBUG_CHANGE_AMBIENT_GREEN)
|
||||
{
|
||||
new DebugSliderDialog("lwhite", "LWhite", [](){ return irr_driver->getLwhite() * 10.f; }, [](int v){irr_driver->setLwhite(v / 10.f); });
|
||||
new DebugSliderDialog("Green", "Green", [](){ return irr_driver->getAmbientLight().g * 255.; },
|
||||
[](int v){
|
||||
video::SColor ambient = irr_driver->getAmbientLight().toSColor();
|
||||
ambient.setGreen(v);
|
||||
irr_driver->setAmbientLight(ambient); }
|
||||
);
|
||||
}
|
||||
else if (cmdID == DEBUG_CHANGE_AMBIENT_BLUE)
|
||||
{
|
||||
new DebugSliderDialog("Blue", "Blue", [](){ return irr_driver->getAmbientLight().b * 255.; },
|
||||
[](int v){
|
||||
video::SColor ambient = irr_driver->getAmbientLight().toSColor();
|
||||
ambient.setBlue(v);
|
||||
irr_driver->setAmbientLight(ambient); }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user