cleaning up and adding radius and energy sliders
This commit is contained in:
parent
334245183e
commit
531b94a0ac
@ -2,37 +2,37 @@
|
|||||||
<stkgui>
|
<stkgui>
|
||||||
<div x="2%" y="10%" width="96%" height="80%" layout="vertical-row" >
|
<div x="2%" y="10%" width="96%" height="80%" layout="vertical-row" >
|
||||||
<div proportion="1" width="100%" layout="horizontal-row">
|
<div proportion="1" width="100%" layout="horizontal-row">
|
||||||
<label id="Red" raw_text="Red"/>
|
<label id="Red" raw_text="Red" width="200"/>
|
||||||
<spacer width="25"/>
|
<spacer width="25"/>
|
||||||
<gauge id="red_slider" min_value="0" max_value="100" proportion="1"/>
|
<gauge id="red_slider" min_value="0" max_value="100" proportion="1"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div proportion="1" width="100%" layout="horizontal-row">
|
<div proportion="1" width="100%" layout="horizontal-row">
|
||||||
<label id="Green" raw_text="Green"/>
|
<label id="Green" raw_text="Green" width="200"/>
|
||||||
<spacer width="25"/>
|
<spacer width="25"/>
|
||||||
<gauge id="green_slider" min_value="0" max_value="100" proportion="1"/>
|
<gauge id="green_slider" min_value="0" max_value="100" proportion="1"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div proportion="1" width="100%" layout="horizontal-row">
|
<div proportion="1" width="100%" layout="horizontal-row">
|
||||||
<label id="Blue" raw_text="Blue"/>
|
<label id="Blue" raw_text="Blue" width="200"/>
|
||||||
<spacer width="25"/>
|
<spacer width="25"/>
|
||||||
<gauge id="blue_slider" min_value="0" max_value="100" proportion="1"/>
|
<gauge id="blue_slider" min_value="0" max_value="100" proportion="1"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div proportion="1" width="100%" layout="horizontal-row">
|
<div proportion="1" width="100%" layout="horizontal-row">
|
||||||
<label id="SSAO radius" raw_text="SSAO Radius"/>
|
<label id="SSAO radius" raw_text="SSAO Radius" width="200"/>
|
||||||
<spacer width="50"/>
|
<spacer width="50"/>
|
||||||
<gauge id="ssao_radius" min_value="0" max_value="100" proportion="1" />
|
<gauge id="ssao_radius" min_value="0" max_value="100" proportion="1" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div proportion="1" width="100%" layout="horizontal-row">
|
<div proportion="1" width="100%" layout="horizontal-row">
|
||||||
<label id="SSAO k" raw_text="SSAO K"/>
|
<label id="SSAO k" raw_text="SSAO K" width="200"/>
|
||||||
<spacer width="25"/>
|
<spacer width="25"/>
|
||||||
<gauge id="ssao_k" min_value="0" max_value="100" proportion="1"/>
|
<gauge id="ssao_k" min_value="0" max_value="100" proportion="1"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div proportion="1" width="100%" layout="horizontal-row">
|
<div proportion="1" width="100%" layout="horizontal-row">
|
||||||
<label id="SSAO Sigma" raw_text="SSAO sigma"/>
|
<label id="SSAO Sigma" raw_text="SSAO sigma" width="200"/>
|
||||||
<spacer width="50"/>
|
<spacer width="50"/>
|
||||||
<gauge id="ssao_sigma" min_value="0" max_value="100" proportion="1"/>
|
<gauge id="ssao_sigma" min_value="0" max_value="100" proportion="1"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -64,6 +64,10 @@ public:
|
|||||||
float getEnergyMultiplier() const { return m_energy_multiplier; }
|
float getEnergyMultiplier() const { return m_energy_multiplier; }
|
||||||
void setEnergyMultiplier(float newval) { m_energy_multiplier = newval; }
|
void setEnergyMultiplier(float newval) { m_energy_multiplier = newval; }
|
||||||
|
|
||||||
|
// For the debug menu
|
||||||
|
void setEnergy(float energy) { m_energy = energy; }
|
||||||
|
void setRadius(float radius) { m_radius = radius; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static core::aabbox3df box;
|
static core::aabbox3df box;
|
||||||
|
|
||||||
|
@ -51,12 +51,9 @@ void DebugSliderDialog::setSliderHook(std::string id, unsigned min, unsigned max
|
|||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
DebugSliderDialog::~DebugSliderDialog()
|
void DebugSliderDialog::changeLabel(std::string id, std::string new_label)
|
||||||
{
|
{
|
||||||
//if (StateManager::get()->getGameState() == GUIEngine::GAME)
|
getWidget<LabelWidget>(id.c_str())->setText(stringw(new_label.c_str()), true);
|
||||||
//{
|
|
||||||
// World::getWorld()->scheduleUnpause();
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------------
|
||||||
@ -71,13 +68,14 @@ GUIEngine::EventPropagation DebugSliderDialog::processEvent(const std::string& e
|
|||||||
{
|
{
|
||||||
#if !defined(__APPLE__)
|
#if !defined(__APPLE__)
|
||||||
if (Setters.find(eventSource) == Setters.end())
|
if (Setters.find(eventSource) == Setters.end())
|
||||||
#endif
|
|
||||||
return GUIEngine::EVENT_LET;
|
return GUIEngine::EVENT_LET;
|
||||||
#if !defined(__APPLE__)
|
|
||||||
int value = getWidget<SpinnerWidget>(eventSource.c_str())->getValue();
|
int value = getWidget<SpinnerWidget>(eventSource.c_str())->getValue();
|
||||||
Log::info("DebugSlider", "Value for <%s> : %i", eventSource.c_str(), value);
|
Log::info("DebugSlider", "Value for <%s> : %i", eventSource.c_str(), value);
|
||||||
Setters[eventSource](value);
|
Setters[eventSource](value);
|
||||||
return GUIEngine::EVENT_BLOCK;
|
return GUIEngine::EVENT_BLOCK;
|
||||||
|
#else
|
||||||
|
return GUIEngine::EVENT_LET;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,10 +40,11 @@ private:
|
|||||||
public:
|
public:
|
||||||
DebugSliderDialog();
|
DebugSliderDialog();
|
||||||
|
|
||||||
~DebugSliderDialog();
|
~DebugSliderDialog() {};
|
||||||
#if !defined(__APPLE__)
|
#if !defined(__APPLE__)
|
||||||
void setSliderHook(std::string id, unsigned min, unsigned max, std::function<int()> G, std::function<void(int)> S);
|
void setSliderHook(std::string id, unsigned min, unsigned max, std::function<int()> G, std::function<void(int)> S);
|
||||||
#endif
|
#endif
|
||||||
|
void changeLabel(std::string id, std::string new_label);
|
||||||
|
|
||||||
virtual void onEnterPressedInternal() OVERRIDE;
|
virtual void onEnterPressedInternal() OVERRIDE;
|
||||||
virtual void onUpdate(float dt) OVERRIDE;
|
virtual void onUpdate(float dt) OVERRIDE;
|
||||||
|
@ -101,7 +101,7 @@ enum DebugMenuCommand
|
|||||||
DEBUG_THROTTLE_FPS,
|
DEBUG_THROTTLE_FPS,
|
||||||
DEBUG_VISUAL_VALUES,
|
DEBUG_VISUAL_VALUES,
|
||||||
DEBUG_PRINT_START_POS,
|
DEBUG_PRINT_START_POS,
|
||||||
DEBUG_LIGHT_SETTINGS,
|
DEBUG_ADJUST_LIGHTS,
|
||||||
}; // DebugMenuCommand
|
}; // DebugMenuCommand
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -157,8 +157,7 @@ float distance(core::vector3df one, core::vector3df two)
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
/** returns the light node with the lowest distance to the player kart (excluding
|
/** returns the light node with the lowest distance to the player kart (excluding
|
||||||
* nitro emitters)
|
* nitro emitters) */
|
||||||
*/
|
|
||||||
LightNode* findNearestLight()
|
LightNode* findNearestLight()
|
||||||
{
|
{
|
||||||
World* world = World::getWorld();
|
World* world = World::getWorld();
|
||||||
@ -276,11 +275,11 @@ bool onEvent(const SEvent &event)
|
|||||||
mnu->addItem(L"Toggle capture profiler report",
|
mnu->addItem(L"Toggle capture profiler report",
|
||||||
DEBUG_PROFILER_GENERATE_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"Show 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"Print position", DEBUG_PRINT_START_POS);
|
mnu->addItem(L"Print position", DEBUG_PRINT_START_POS);
|
||||||
mnu->addItem(L"Debug Light Setting", DEBUG_LIGHT_SETTINGS);
|
mnu->addItem(L"Adjust Lights", DEBUG_ADJUST_LIGHTS);
|
||||||
|
|
||||||
g_debug_menu_visible = true;
|
g_debug_menu_visible = true;
|
||||||
irr_driver->showPointer();
|
irr_driver->showPointer();
|
||||||
@ -599,9 +598,13 @@ bool onEvent(const SEvent &event)
|
|||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (cmdID == DEBUG_LIGHT_SETTINGS)
|
else if (cmdID == DEBUG_ADJUST_LIGHTS)
|
||||||
{
|
{
|
||||||
|
#if !defined(__APPLE__)
|
||||||
|
// Some sliders use multipliers because the spinner widget
|
||||||
|
// only supports integers
|
||||||
DebugSliderDialog *dsd = new DebugSliderDialog();
|
DebugSliderDialog *dsd = new DebugSliderDialog();
|
||||||
|
dsd->changeLabel("Red", "Red (x10)");
|
||||||
dsd->setSliderHook("red_slider", 0, 100,
|
dsd->setSliderHook("red_slider", 0, 100,
|
||||||
[]()
|
[]()
|
||||||
{
|
{
|
||||||
@ -614,6 +617,7 @@ bool onEvent(const SEvent &event)
|
|||||||
nearest->setColor(intensity / 100.0, color.Y, color.Z);
|
nearest->setColor(intensity / 100.0, color.Y, color.Z);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
dsd->changeLabel("Green", "Green (x10)");
|
||||||
dsd->setSliderHook("green_slider", 0, 100,
|
dsd->setSliderHook("green_slider", 0, 100,
|
||||||
[]()
|
[]()
|
||||||
{
|
{
|
||||||
@ -626,6 +630,7 @@ bool onEvent(const SEvent &event)
|
|||||||
nearest->setColor(color.X, intensity / 100.0, color.Z);
|
nearest->setColor(color.X, intensity / 100.0, color.Z);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
dsd->changeLabel("Blue", "Blue (x10)");
|
||||||
dsd->setSliderHook("blue_slider", 0, 100,
|
dsd->setSliderHook("blue_slider", 0, 100,
|
||||||
[]()
|
[]()
|
||||||
{
|
{
|
||||||
@ -638,6 +643,18 @@ bool onEvent(const SEvent &event)
|
|||||||
nearest->setColor(color.X, color.Y, intensity / 100.0);
|
nearest->setColor(color.X, color.Y, intensity / 100.0);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
dsd->changeLabel("SSAO radius", "energy (x10)");
|
||||||
|
dsd->setSliderHook("ssao_radius", 0, 100,
|
||||||
|
[]() { return findNearestLight()->getEnergy() * 10; },
|
||||||
|
[](int v){ findNearestLight()->setEnergy(v / 10.0); }
|
||||||
|
);
|
||||||
|
dsd->changeLabel("SSAO k", "radius");
|
||||||
|
dsd->setSliderHook("ssao_k", 0, 100,
|
||||||
|
[]() { return findNearestLight()->getRadius(); },
|
||||||
|
[](int v){ findNearestLight()->setRadius(v); }
|
||||||
|
);
|
||||||
|
dsd->changeLabel("SSAO Sigma", "[None]");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user