Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Marc Coll Carrillo 2014-10-03 18:15:28 +02:00
commit cc41327db3
4 changed files with 125 additions and 86 deletions

View File

@ -2546,8 +2546,9 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
float lean_height = tan(fabsf(m_current_lean)) * getKartWidth()*0.5f; float lean_height = tan(fabsf(m_current_lean)) * getKartWidth()*0.5f;
float heading = m_skidding->getVisualSkidRotation(); float heading = m_skidding->getVisualSkidRotation();
float xx = fabsf(m_speed)* getKartProperties()->getDownwardImpulseFactor()*0.0006f;
Vec3 center_shift = Vec3(0, m_skidding->getGraphicalJumpOffset() Vec3 center_shift = Vec3(0, m_skidding->getGraphicalJumpOffset()
+ lean_height +m_graphical_y_offset, 0); + lean_height +m_graphical_y_offset+xx, 0);
center_shift = getTrans().getBasis() * center_shift; center_shift = getTrans().getBasis() * center_shift;
Moveable::updateGraphics(dt, center_shift, Moveable::updateGraphics(dt, center_shift,

View File

@ -359,6 +359,11 @@ void GPInfoScreen::eventCallback(Widget *, const std::string &name,
const int num_ai = m_ai_kart_spinner->getValue(); const int num_ai = m_ai_kart_spinner->getValue();
race_manager->setNumKarts( race_manager->getNumLocalPlayers() + num_ai ); race_manager->setNumKarts( race_manager->getNumLocalPlayers() + num_ai );
UserConfigParams::m_num_karts = race_manager->getNumLocalPlayers() + num_ai; UserConfigParams::m_num_karts = race_manager->getNumLocalPlayers() + num_ai;
//Redraw scene because available buttons depend on current settings
getWidget<RibbonWidget>("buttons")->setSelection(0, PLAYER_ID_GAME_MASTER);
reshowCurrentScreen();
m_ai_kart_spinner->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
} }
else if(name=="back") else if(name=="back")
{ {

View File

@ -524,6 +524,8 @@ void QuadGraph::createMesh(bool show_invisible,
m_mesh_buffer->recalculateBoundingBox(); m_mesh_buffer->recalculateBoundingBox();
m_mesh->setBoundingBox(m_mesh_buffer->getBoundingBox()); m_mesh->setBoundingBox(m_mesh_buffer->getBoundingBox());
m_mesh_buffer->getMaterial().setTexture(0, irr_driver->getTexture("unlit.png"));
delete[] ind; delete[] ind;
delete[] new_v; delete[] new_v;
} // createMesh } // createMesh

View File

@ -17,12 +17,13 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "debug.hpp" #include "debug.hpp"
#include "config/user_config.hpp" #include "config/user_config.hpp"
#include "karts/controller/controller.hpp"
#include "karts/abstract_kart.hpp"
#include "graphics/irr_driver.hpp" #include "graphics/irr_driver.hpp"
#include "items/powerup_manager.hpp" #include "items/powerup_manager.hpp"
#include "items/attachment.hpp" #include "items/attachment.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/controller/controller.hpp"
#include "modes/world.hpp" #include "modes/world.hpp"
#include "physics/irr_debug_drawer.hpp" #include "physics/irr_debug_drawer.hpp"
#include "physics/physics.hpp" #include "physics/physics.hpp"
@ -30,8 +31,10 @@
#include "main_loop.hpp" #include "main_loop.hpp"
#include "replay/replay_recorder.hpp" #include "replay/replay_recorder.hpp"
#include "states_screens/dialogs/debug_slider.hpp" #include "states_screens/dialogs/debug_slider.hpp"
#include "utils/constants.hpp"
#include "utils/log.hpp" #include "utils/log.hpp"
#include "utils/profiler.hpp" #include "utils/profiler.hpp"
#include <IGUIEnvironment.h> #include <IGUIEnvironment.h>
#include <IGUIContextMenu.h> #include <IGUIContextMenu.h>
@ -40,8 +43,9 @@ using namespace gui;
namespace Debug { namespace Debug {
/** This is to let mouse input events go through when the debug menu is visible, otherwise /** This is to let mouse input events go through when the debug menu is
GUI events would be blocked while in a race... */ * visible, otherwise GUI events would be blocked while in a race...
*/
static bool g_debug_menu_visible = false; static bool g_debug_menu_visible = false;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -85,52 +89,52 @@ enum DebugMenuCommand
DEBUG_HIDE_KARTS, DEBUG_HIDE_KARTS,
DEBUG_THROTTLE_FPS, DEBUG_THROTTLE_FPS,
DEBUG_VISUAL_VALUES, DEBUG_VISUAL_VALUES,
}; DEBUG_PRINT_START_POS,
}; // DebugMenuCommand
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Add powerup selected from debug menu for all player karts // Add powerup selected from debug menu for all player karts
void addPowerup(PowerupManager::PowerupType powerup) void addPowerup(PowerupManager::PowerupType powerup)
{ {
World* world = World::getWorld(); World* world = World::getWorld();
if (world == NULL) return; if (!world) return;
for(unsigned int i = 0; i < race_manager->getNumLocalPlayers(); i++) for(unsigned int i = 0; i < race_manager->getNumLocalPlayers(); i++)
{ {
AbstractKart* kart = world->getLocalPlayerKart(i); AbstractKart* kart = world->getLocalPlayerKart(i);
kart->setPowerup(powerup, 10000); kart->setPowerup(powerup, 10000);
} }
} } // addPowerup
// ----------------------------------------------------------------------------
void addAttachment(Attachment::AttachmentType type) void addAttachment(Attachment::AttachmentType type)
{ {
World* world = World::getWorld(); World* world = World::getWorld();
if (world == NULL) return; if (world == NULL) return;
for(unsigned int i = 0; i < world->getNumKarts(); i++) for (unsigned int i = 0; i < world->getNumKarts(); i++)
{ {
AbstractKart *kart = world->getKart(i); AbstractKart *kart = world->getKart(i);
if (kart->getController()->isPlayerController()) { if (!kart->getController()->isPlayerController())
if (type == Attachment::ATTACH_ANVIL) continue;
{ if (type == Attachment::ATTACH_ANVIL)
kart->getAttachment() {
->set(type, stk_config->m_anvil_time); kart->getAttachment()
kart->adjustSpeed(stk_config->m_anvil_speed_factor); ->set(type, stk_config->m_anvil_time);
kart->updateWeight(); kart->adjustSpeed(stk_config->m_anvil_speed_factor);
} kart->updateWeight();
else if (type == Attachment::ATTACH_PARACHUTE)
{
kart->getAttachment()
->set(type, stk_config->m_parachute_time);
}
else if (type == Attachment::ATTACH_BOMB)
{
kart->getAttachment()
->set(type, stk_config->m_bomb_time);
}
} }
else if (type == Attachment::ATTACH_PARACHUTE)
{
kart->getAttachment()
->set(type, stk_config->m_parachute_time);
} }
else if (type == Attachment::ATTACH_BOMB)
{
kart->getAttachment()
->set(type, stk_config->m_bomb_time);
}
}
} } // addAttachment
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Debug menu handling // Debug menu handling
@ -143,19 +147,20 @@ bool onEvent(const SEvent &event)
if(event.EventType == EET_MOUSE_INPUT_EVENT) if(event.EventType == EET_MOUSE_INPUT_EVENT)
{ {
// Create the menu (only one menu at a time) // Create the menu (only one menu at a time)
if(event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN && !g_debug_menu_visible) if(event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN &&
!g_debug_menu_visible)
{ {
// root menu // root menu
gui::IGUIEnvironment* guienv = irr_driver->getGUI(); gui::IGUIEnvironment* guienv = irr_driver->getGUI();
IGUIContextMenu* mnu = guienv->addContextMenu( core::rect<s32> r(event.MouseInput.X, event.MouseInput.Y,
core::rect<s32>(event.MouseInput.X, event.MouseInput.Y, event.MouseInput.Y+100, event.MouseInput.Y+100),NULL); event.MouseInput.Y+100, event.MouseInput.Y+100);
IGUIContextMenu* mnu = guienv->addContextMenu(r, NULL);
int graphicsMenuIndex = mnu->addItem(L"Graphics >",-1,true,true); int graphicsMenuIndex = mnu->addItem(L"Graphics >",-1,true,true);
// graphics menu // graphics menu
IGUIContextMenu* sub = mnu->getSubMenu(graphicsMenuIndex); IGUIContextMenu* sub = mnu->getSubMenu(graphicsMenuIndex);
sub->addItem(L"Reload shaders", DEBUG_GRAPHICS_RELOAD_SHADERS ); sub->addItem(L"Reload shaders", DEBUG_GRAPHICS_RELOAD_SHADERS );
sub->addItem(L"Reset debug views", DEBUG_GRAPHICS_RESET );
sub->addItem(L"Wireframe", DEBUG_GRAPHICS_WIREFRAME ); sub->addItem(L"Wireframe", DEBUG_GRAPHICS_WIREFRAME );
sub->addItem(L"Mipmap viz", DEBUG_GRAPHICS_MIPMAP_VIZ ); sub->addItem(L"Mipmap viz", DEBUG_GRAPHICS_MIPMAP_VIZ );
sub->addItem(L"Normals viz", DEBUG_GRAPHICS_NORMALS_VIZ ); sub->addItem(L"Normals viz", DEBUG_GRAPHICS_NORMALS_VIZ );
@ -168,6 +173,7 @@ bool onEvent(const SEvent &event)
sub->addItem(L"Distort viz", DEBUG_GRAPHICS_DISTORT_VIZ ); sub->addItem(L"Distort viz", DEBUG_GRAPHICS_DISTORT_VIZ );
sub->addItem(L"Physics debug", DEBUG_GRAPHICS_BULLET_1); sub->addItem(L"Physics debug", DEBUG_GRAPHICS_BULLET_1);
sub->addItem(L"Physics debug (no kart)", DEBUG_GRAPHICS_BULLET_2); sub->addItem(L"Physics debug (no kart)", DEBUG_GRAPHICS_BULLET_2);
sub->addItem(L"Reset debug views", DEBUG_GRAPHICS_RESET );
mnu->addItem(L"Items >",-1,true,true); mnu->addItem(L"Items >",-1,true,true);
sub = mnu->getSubMenu(1); sub = mnu->getSubMenu(1);
@ -192,27 +198,30 @@ bool onEvent(const SEvent &event)
mnu->addItem(L"Profiler",DEBUG_PROFILER); mnu->addItem(L"Profiler",DEBUG_PROFILER);
if (UserConfigParams::m_profiler_enabled) if (UserConfigParams::m_profiler_enabled)
mnu->addItem(L"Toggle capture profiler report", DEBUG_PROFILER_GENERATE_REPORT); mnu->addItem(L"Toggle capture profiler report",
DEBUG_PROFILER_GENERATE_REPORT);
mnu->addItem(L"Do not limit FPS", DEBUG_THROTTLE_FPS); mnu->addItem(L"Do not limit FPS", DEBUG_THROTTLE_FPS);
mnu->addItem(L"FPS",DEBUG_FPS); mnu->addItem(L"FPS",DEBUG_FPS);
mnu->addItem(L"Save replay", DEBUG_SAVE_REPLAY); mnu->addItem(L"Save replay", DEBUG_SAVE_REPLAY);
mnu->addItem(L"Save history", DEBUG_SAVE_HISTORY); mnu->addItem(L"Save history", DEBUG_SAVE_HISTORY);
mnu->addItem(L"Toggle GUI", DEBUG_TOGGLE_GUI); mnu->addItem(L"Toggle GUI", DEBUG_TOGGLE_GUI);
mnu->addItem(L"Hide karts", DEBUG_HIDE_KARTS); mnu->addItem(L"Hide karts", DEBUG_HIDE_KARTS);
mnu->addItem(L"Print position", DEBUG_PRINT_START_POS);
g_debug_menu_visible = true; g_debug_menu_visible = true;
irr_driver->showPointer(); irr_driver->showPointer();
} }
// Let Irrlicht handle the event while the menu is visible - otherwise in a race the GUI events won't be generated // Let Irrlicht handle the event while the menu is visible.
// Otherwise in a race the GUI events won't be generated
if(g_debug_menu_visible) if(g_debug_menu_visible)
return false; return false;
} }
if (event.EventType == EET_GUI_EVENT) if (event.EventType == EET_GUI_EVENT)
{ {
if (event.GUIEvent.Caller != NULL && event.GUIEvent.Caller->getType() == EGUIET_CONTEXT_MENU ) if (event.GUIEvent.Caller != NULL &&
event.GUIEvent.Caller->getType() == EGUIET_CONTEXT_MENU )
{ {
IGUIContextMenu *menu = (IGUIContextMenu*)event.GUIEvent.Caller; IGUIContextMenu *menu = (IGUIContextMenu*)event.GUIEvent.Caller;
s32 cmdID = menu->getItemCommandId(menu->getSelectedItem()); s32 cmdID = menu->getItemCommandId(menu->getSelectedItem());
@ -224,6 +233,8 @@ bool onEvent(const SEvent &event)
if (event.GUIEvent.EventType == gui::EGET_MENU_ITEM_SELECTED) if (event.GUIEvent.EventType == gui::EGET_MENU_ITEM_SELECTED)
{ {
World *world = World::getWorld();
Physics *physics = world ? world->getPhysics() : NULL;
if(cmdID == DEBUG_GRAPHICS_RELOAD_SHADERS) if(cmdID == DEBUG_GRAPHICS_RELOAD_SHADERS)
{ {
Log::info("Debug", "Reloading shaders..."); Log::info("Debug", "Reloading shaders...");
@ -231,87 +242,87 @@ bool onEvent(const SEvent &event)
} }
else if (cmdID == DEBUG_GRAPHICS_RESET) else if (cmdID == DEBUG_GRAPHICS_RESET)
{ {
World* world = World::getWorld(); if (physics)
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); physics->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes(); irr_driver->resetDebugModes();
} }
else if (cmdID == DEBUG_GRAPHICS_WIREFRAME) else if (cmdID == DEBUG_GRAPHICS_WIREFRAME)
{ {
World* world = World::getWorld(); if (physics)
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); physics->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes(); irr_driver->resetDebugModes();
irr_driver->toggleWireframe(); irr_driver->toggleWireframe();
} }
else if (cmdID == DEBUG_GRAPHICS_MIPMAP_VIZ) else if (cmdID == DEBUG_GRAPHICS_MIPMAP_VIZ)
{ {
World* world = World::getWorld(); if (physics)
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); physics->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes(); irr_driver->resetDebugModes();
irr_driver->toggleMipVisualization(); irr_driver->toggleMipVisualization();
} }
else if (cmdID == DEBUG_GRAPHICS_NORMALS_VIZ) else if (cmdID == DEBUG_GRAPHICS_NORMALS_VIZ)
{ {
World* world = World::getWorld(); if (physics)
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); physics->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes(); irr_driver->resetDebugModes();
irr_driver->toggleNormals(); irr_driver->toggleNormals();
} }
else if (cmdID == DEBUG_GRAPHICS_SSAO_VIZ) else if (cmdID == DEBUG_GRAPHICS_SSAO_VIZ)
{ {
World* world = World::getWorld(); if (physics)
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); physics->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes(); irr_driver->resetDebugModes();
irr_driver->toggleSSAOViz(); irr_driver->toggleSSAOViz();
} }
else if (cmdID == DEBUG_GRAPHICS_RSM_VIZ) else if (cmdID == DEBUG_GRAPHICS_RSM_VIZ)
{ {
World* world = World::getWorld(); if (physics)
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); physics->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes(); irr_driver->resetDebugModes();
irr_driver->toggleRSM(); irr_driver->toggleRSM();
} }
else if (cmdID == DEBUG_GRAPHICS_RH_VIZ) else if (cmdID == DEBUG_GRAPHICS_RH_VIZ)
{ {
World* world = World::getWorld(); if (physics)
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); physics->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes(); irr_driver->resetDebugModes();
irr_driver->toggleRH(); irr_driver->toggleRH();
} }
else if (cmdID == DEBUG_GRAPHICS_GI_VIZ) else if (cmdID == DEBUG_GRAPHICS_GI_VIZ)
{ {
World* world = World::getWorld(); if (physics)
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); physics->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes(); irr_driver->resetDebugModes();
irr_driver->toggleGI(); irr_driver->toggleGI();
} }
else if (cmdID == DEBUG_GRAPHICS_SHADOW_VIZ) else if (cmdID == DEBUG_GRAPHICS_SHADOW_VIZ)
{ {
World* world = World::getWorld(); if (physics)
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); physics->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes(); irr_driver->resetDebugModes();
irr_driver->toggleShadowViz(); irr_driver->toggleShadowViz();
} }
else if (cmdID == DEBUG_GRAPHICS_LIGHT_VIZ) else if (cmdID == DEBUG_GRAPHICS_LIGHT_VIZ)
{ {
World* world = World::getWorld(); if (physics)
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); physics->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes(); irr_driver->resetDebugModes();
irr_driver->toggleLightViz(); irr_driver->toggleLightViz();
} }
else if (cmdID == DEBUG_GRAPHICS_DISTORT_VIZ) else if (cmdID == DEBUG_GRAPHICS_DISTORT_VIZ)
{ {
World* world = World::getWorld(); if (physics)
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); physics->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes(); irr_driver->resetDebugModes();
irr_driver->toggleDistortViz(); irr_driver->toggleDistortViz();
@ -320,17 +331,16 @@ bool onEvent(const SEvent &event)
{ {
irr_driver->resetDebugModes(); irr_driver->resetDebugModes();
World* world = World::getWorld(); if (!world) return false;
if (world == NULL) return false; physics->setDebugMode(IrrDebugDrawer::DM_KARTS_PHYSICS);
world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_KARTS_PHYSICS);
} }
else if (cmdID == DEBUG_GRAPHICS_BULLET_2) else if (cmdID == DEBUG_GRAPHICS_BULLET_2)
{ {
irr_driver->resetDebugModes(); irr_driver->resetDebugModes();
World* world = World::getWorld(); if (!world) return false;
if (world == NULL) return false; Physics *physics = world->getPhysics();
world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NO_KARTS_GRAPHICS); physics->setDebugMode(IrrDebugDrawer::DM_NO_KARTS_GRAPHICS);
} }
else if (cmdID == DEBUG_PROFILER) else if (cmdID == DEBUG_PROFILER)
{ {
@ -396,9 +406,10 @@ bool onEvent(const SEvent &event)
} }
else if (cmdID == DEBUG_POWERUP_NITRO) else if (cmdID == DEBUG_POWERUP_NITRO)
{ {
World* world = World::getWorld(); if (!world) return false;
if (world == NULL) return false; const unsigned int num_local_players =
for(unsigned int i = 0; i < race_manager->getNumLocalPlayers(); i++) race_manager->getNumLocalPlayers();
for(unsigned int i = 0; i < num_local_players; i++)
{ {
AbstractKart* kart = world->getLocalPlayerKart(i); AbstractKart* kart = world->getLocalPlayerKart(i);
kart->setEnergy(100.0f); kart->setEnergy(100.0f);
@ -418,52 +429,68 @@ bool onEvent(const SEvent &event)
} }
else if (cmdID == DEBUG_TOGGLE_GUI) else if (cmdID == DEBUG_TOGGLE_GUI)
{ {
World* world = World::getWorld(); if (!world) return false;
if (world == NULL) return false;
RaceGUIBase* gui = world->getRaceGUI(); RaceGUIBase* gui = world->getRaceGUI();
if (gui != NULL) gui->m_enabled = !gui->m_enabled; if (gui != NULL) gui->m_enabled = !gui->m_enabled;
} }
else if (cmdID == DEBUG_HIDE_KARTS) else if (cmdID == DEBUG_HIDE_KARTS)
{ {
World* world = World::getWorld(); if (!world) return false;
if (world == NULL) return false; for (int n = 0; n<world->getNumKarts(); n++)
const int count = World::getWorld()->getNumKarts();
for (int n = 0; n<count; n++)
{ {
AbstractKart* kart = world->getKart(n); AbstractKart* kart = world->getKart(n);
if (kart->getController()->isPlayerController()) if (kart->getController()->isPlayerController())
kart->getNode()->setVisible(false); kart->getNode()->setVisible(false);
} }
} }
else if (cmdID == DEBUG_PRINT_START_POS)
{
if(!world) return false;
for(unsigned int i=0; i<world->getNumKarts(); i++)
{
AbstractKart *kart = world->getKart(i);
Log::warn(kart->getIdent().c_str(),
"<start position=\"%d\" x=\"%f\" y=\"%f\" z=\"%f\" h=\"%f\"/>",
i, kart->getXYZ().getX(), kart->getXYZ().getY(),
kart->getXYZ().getZ(),kart->getHeading()*RAD_TO_DEGREE
);
}
}
else if (cmdID == DEBUG_VISUAL_VALUES) else if (cmdID == DEBUG_VISUAL_VALUES)
{ {
#if !defined(__APPLE__) #if !defined(__APPLE__)
DebugSliderDialog *dsd = new DebugSliderDialog(); DebugSliderDialog *dsd = new DebugSliderDialog();
dsd->setSliderHook( "red_slider", 0, 255, [](){ return int(irr_driver->getAmbientLight().r * 255.f); }, dsd->setSliderHook( "red_slider", 0, 255,
[](){ return int(irr_driver->getAmbientLight().r * 255.f); },
[](int v){ [](int v){
video::SColorf ambient = irr_driver->getAmbientLight(); video::SColorf ambient = irr_driver->getAmbientLight();
ambient.setColorComponentValue(0, v / 255.f); ambient.setColorComponentValue(0, v / 255.f);
irr_driver->setAmbientLight(ambient); } irr_driver->setAmbientLight(ambient); }
); );
dsd->setSliderHook("green_slider", 0, 255, [](){ return int(irr_driver->getAmbientLight().g * 255.f); }, dsd->setSliderHook("green_slider", 0, 255,
[](){ return int(irr_driver->getAmbientLight().g * 255.f); },
[](int v){ [](int v){
video::SColorf ambient = irr_driver->getAmbientLight(); video::SColorf ambient = irr_driver->getAmbientLight();
ambient.setColorComponentValue(1, v / 255.f); ambient.setColorComponentValue(1, v / 255.f);
irr_driver->setAmbientLight(ambient); } irr_driver->setAmbientLight(ambient); }
); );
dsd->setSliderHook("blue_slider", 0, 255, [](){ return int(irr_driver->getAmbientLight().b * 255.f); }, dsd->setSliderHook("blue_slider", 0, 255,
[](){ return int(irr_driver->getAmbientLight().b * 255.f); },
[](int v){ [](int v){
video::SColorf ambient = irr_driver->getAmbientLight(); video::SColorf ambient = irr_driver->getAmbientLight();
ambient.setColorComponentValue(2, v / 255.f); ambient.setColorComponentValue(2, v / 255.f);
irr_driver->setAmbientLight(ambient); } irr_driver->setAmbientLight(ambient); }
); );
dsd->setSliderHook("ssao_radius", 0, 100, [](){ return int(irr_driver->getSSAORadius() * 10.f); }, dsd->setSliderHook("ssao_radius", 0, 100,
[](){ return int(irr_driver->getSSAORadius() * 10.f); },
[](int v){irr_driver->setSSAORadius(v / 10.f); } [](int v){irr_driver->setSSAORadius(v / 10.f); }
); );
dsd->setSliderHook("ssao_k", 0, 100, [](){ return int(irr_driver->getSSAOK() * 10.f); }, dsd->setSliderHook("ssao_k", 0, 100,
[](){ return int(irr_driver->getSSAOK() * 10.f); },
[](int v){irr_driver->setSSAOK(v / 10.f); } [](int v){irr_driver->setSSAOK(v / 10.f); }
); );
dsd->setSliderHook("ssao_sigma", 0, 100, [](){ return int(irr_driver->getSSAOSigma() * 10.f); }, dsd->setSliderHook("ssao_sigma", 0, 100,
[](){ return int(irr_driver->getSSAOSigma() * 10.f); },
[](int v){irr_driver->setSSAOSigma(v / 10.f); } [](int v){irr_driver->setSSAOSigma(v / 10.f); }
); );
#endif #endif
@ -474,10 +501,14 @@ bool onEvent(const SEvent &event)
} }
} }
return true; // continue event handling return true; // continue event handling
} } // onEvent
// ----------------------------------------------------------------------------
/** Returns if the debug menu is visible.
*/
bool isOpen() bool isOpen()
{ {
return g_debug_menu_visible; return g_debug_menu_visible;
} } // isOpen
}
} // namespace Debug