Store ambientlight directly in irr_driver.
This commit is contained in:
parent
c8a9515ad0
commit
54c9f32033
@ -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;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -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,
|
||||
|
@ -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++)
|
||||
|
@ -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); }
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user