Complete reformatting of the code following the KDE Frameworks formatting style
This commit is contained in:
59
src/Light.h
59
src/Light.h
@@ -6,17 +6,18 @@
|
||||
|
||||
#define NUM_POINT_LIGHTS 16
|
||||
|
||||
class Light {
|
||||
|
||||
class Light
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void update() = 0;
|
||||
|
||||
void setActive(bool active) {
|
||||
void setActive(bool active)
|
||||
{
|
||||
isActive = active;
|
||||
update();
|
||||
}
|
||||
void setColor(glm::vec3 color) {
|
||||
void setColor(glm::vec3 color)
|
||||
{
|
||||
lightColor = color;
|
||||
diffuseColor = lightColor * glm::vec3(1.0f);
|
||||
ambientColor = diffuseColor * glm::vec3(0.002f);
|
||||
@@ -24,15 +25,18 @@ public:
|
||||
update();
|
||||
}
|
||||
|
||||
void setShaderProgram(ShaderProgram *shaderProgram) {
|
||||
void setShaderProgram(ShaderProgram *shaderProgram)
|
||||
{
|
||||
this->shaderProgram = shaderProgram;
|
||||
update();
|
||||
}
|
||||
|
||||
glm::vec3 getColor() { return lightColor; }
|
||||
glm::vec3 getColor()
|
||||
{
|
||||
return lightColor;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Light(ShaderProgram *shaderProgram) : shaderProgram(shaderProgram) {}
|
||||
|
||||
ShaderProgram *shaderProgram;
|
||||
@@ -45,54 +49,57 @@ protected:
|
||||
glm::vec3 diffuseColor;
|
||||
glm::vec3 ambientColor;
|
||||
glm::vec3 specularColor;
|
||||
|
||||
};
|
||||
|
||||
class PointLight : public Light {
|
||||
|
||||
class PointLight : public Light
|
||||
{
|
||||
public:
|
||||
|
||||
PointLight(ShaderProgram *shaderProgram);
|
||||
|
||||
void setPosition(glm::vec3 position) {
|
||||
void setPosition(glm::vec3 position)
|
||||
{
|
||||
this->position = position;
|
||||
update();
|
||||
}
|
||||
|
||||
void setParameters(float K_q) { this->K_q = K_q; }
|
||||
void setParameters(float K_q)
|
||||
{
|
||||
this->K_q = K_q;
|
||||
}
|
||||
|
||||
void setId(unsigned int id) { lightId = id; }
|
||||
|
||||
glm::vec3 getPosition() { return position; }
|
||||
void setId(unsigned int id)
|
||||
{
|
||||
lightId = id;
|
||||
}
|
||||
|
||||
glm::vec3 getPosition()
|
||||
{
|
||||
return position;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void update() override;
|
||||
std::string _getStructMemberName();
|
||||
unsigned int lightId;
|
||||
|
||||
glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
float K_q = 0.032f;
|
||||
|
||||
float K_q = 0.032f;
|
||||
};
|
||||
|
||||
class DirectionalLight : public Light {
|
||||
|
||||
class DirectionalLight : public Light
|
||||
{
|
||||
public:
|
||||
|
||||
DirectionalLight(ShaderProgram *shaderProgram);
|
||||
|
||||
void setDirection(glm::vec3 direction) {
|
||||
void setDirection(glm::vec3 direction)
|
||||
{
|
||||
this->direction = direction;
|
||||
update();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void update() override;
|
||||
|
||||
glm::vec3 direction;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user