Store ambientlight directly in irr_driver.

This commit is contained in:
Vincent Lejeune 2014-08-09 01:30:36 +02:00
parent c8a9515ad0
commit 54c9f32033
4 changed files with 13 additions and 11 deletions

View File

@ -1621,15 +1621,17 @@ void IrrDriver::onUnloadWorld()
/** Sets the ambient light.
* \param light The colour of the light to set.
*/
void IrrDriver::setAmbientLight(const video::SColor &light)
void IrrDriver::setAmbientLight(const video::SColorf &light)
{
printf("redval %f\n", light.getRed());
m_scene_manager->setAmbientLight(light);
m_ambient = light;
m_SH_dirty = true;
} // setAmbientLight
video::SColorf IrrDriver::getAmbientLight() const
{
return m_scene_manager->getAmbientLight();
return m_ambient;
}
// ----------------------------------------------------------------------------

View File

@ -341,6 +341,7 @@ private:
std::vector<BloomData> m_forcedbloom;
std::vector<scene::ISceneNode *> m_background;
video::SColorf m_ambient;
STKRenderingPass m_phase;
@ -391,7 +392,7 @@ public:
const std::string& mask_path);
void displayFPS();
bool OnEvent(const irr::SEvent &event);
void setAmbientLight(const video::SColor &light);
void setAmbientLight(const video::SColorf &light);
std::string generateSmallerTextures(const std::string& dir);
std::string getSmallerTexture(const std::string& texture);
video::ITexture *getTexture(FileManager::AssetType type,

View File

@ -485,8 +485,7 @@ void IrrDriver::generateDiffuseCoefficients()
int sh_w = 16;
int sh_h = 16;
const video::SColorf& ambientf = irr_driver->getSceneManager()->getAmbientLight();
video::SColor ambient = ambientf.toSColor();
video::SColor ambient = m_ambient.toSColor();
unsigned char *sh_rgba[6];
for (unsigned i = 0; i < 6; i++)

View File

@ -444,8 +444,8 @@ bool onEvent(const SEvent &event)
{
new DebugSliderDialog("Red", "Red", [](){ return irr_driver->getAmbientLight().r * 255.; },
[](int v){
video::SColor ambient = irr_driver->getAmbientLight().toSColor();
ambient.setRed(v);
video::SColorf ambient = irr_driver->getAmbientLight();
ambient.setColorComponentValue(0, v / 255.);
irr_driver->setAmbientLight(ambient); }
);
}
@ -453,8 +453,8 @@ bool onEvent(const SEvent &event)
{
new DebugSliderDialog("Green", "Green", [](){ return irr_driver->getAmbientLight().g * 255.; },
[](int v){
video::SColor ambient = irr_driver->getAmbientLight().toSColor();
ambient.setGreen(v);
video::SColorf ambient = irr_driver->getAmbientLight();
ambient.setColorComponentValue(1, v / 255.);
irr_driver->setAmbientLight(ambient); }
);
}
@ -462,8 +462,8 @@ bool onEvent(const SEvent &event)
{
new DebugSliderDialog("Blue", "Blue", [](){ return irr_driver->getAmbientLight().b * 255.; },
[](int v){
video::SColor ambient = irr_driver->getAmbientLight().toSColor();
ambient.setBlue(v);
video::SColorf ambient = irr_driver->getAmbientLight();
ambient.setColorComponentValue(2, v / 255.);
irr_driver->setAmbientLight(ambient); }
);
}