added lightenv class, used to store the environment lighting parameters
This commit is contained in:
parent
0ad3a417d8
commit
d67706c18c
25
src/lighingenv.cpp
Normal file
25
src/lighingenv.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include "lighingenv.h"
|
||||||
|
#include "imgui/imgui.h"
|
||||||
|
#include "texture.h"
|
||||||
|
#include <glm/ext.hpp>
|
||||||
|
|
||||||
|
LighingEnv::LighingEnv()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LighingEnv::gui()
|
||||||
|
{
|
||||||
|
ImGui::Checkbox("Fog", &m_hasFog);
|
||||||
|
if(m_hasFog)
|
||||||
|
{
|
||||||
|
ImGui::SliderFloat("Fog density", &m_fogDensity, 0, 10000, "%.3f", 10.f);
|
||||||
|
ImGui::ColorEdit3("Fog color", glm::value_ptr(m_fogColor));
|
||||||
|
ImGui::Checkbox("Ground fog", &m_isGroundFog);
|
||||||
|
if(m_isGroundFog)
|
||||||
|
{
|
||||||
|
ImGui::SliderFloat("Ground fog floor", &m_fogFloor, -1000, 1000);
|
||||||
|
ImGui::SliderFloat("Ground fog ceiling", &m_fogCeiling, -1000, 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
src/lighingenv.h
Normal file
45
src/lighingenv.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#ifndef LIGHINGENV_H
|
||||||
|
#define LIGHINGENV_H
|
||||||
|
|
||||||
|
#include <glm/vec3.hpp>
|
||||||
|
|
||||||
|
class Texture;
|
||||||
|
|
||||||
|
class LighingEnv
|
||||||
|
{
|
||||||
|
Texture* m_radianceMap;
|
||||||
|
Texture* m_irradianceMap;
|
||||||
|
|
||||||
|
bool m_hasFog;
|
||||||
|
float m_fogDensity;
|
||||||
|
glm::vec3 m_fogColor;
|
||||||
|
|
||||||
|
bool m_isGroundFog;
|
||||||
|
float m_fogFloor;
|
||||||
|
float m_fogCeiling;
|
||||||
|
|
||||||
|
public:
|
||||||
|
LighingEnv();
|
||||||
|
|
||||||
|
// environment mapping methods
|
||||||
|
|
||||||
|
void setRadianceMap(Texture* tex); // used for the specular component
|
||||||
|
void setIrradianceMap(Texture* tex); // used for the diffuse component
|
||||||
|
|
||||||
|
// fog methods
|
||||||
|
|
||||||
|
void setNoFog() { m_hasFog = false; }
|
||||||
|
|
||||||
|
void setUniformFog(float fogDensity, glm::vec3 fogColor)
|
||||||
|
{ m_hasFog = true; m_fogDensity = fogDensity; m_fogColor = fogColor; }
|
||||||
|
|
||||||
|
void setGroundFog(float fogDensity, glm::vec3 fogColor, float fogFloor, float fogCeiling)
|
||||||
|
{ setUniformFog(fogDensity, fogColor); m_isGroundFog = true; m_fogFloor = fogFloor; m_fogCeiling = fogCeiling; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief this gui does not include the begin/end calls, only the fog editor
|
||||||
|
*/
|
||||||
|
void gui();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LIGHINGENV_H
|
Loading…
x
Reference in New Issue
Block a user