Light.h#
↰ Parent directory (model
)
Represents a Light in the scene (Model).
Includes#
PVRCore/math/MathUtils.h
Included By#
Namespaces#
Classes#
Source Code#
#pragma once
#include "PVRCore/math/MathUtils.h"
namespace pvr {
namespace assets {
class Light
{
public:
enum LightType
{
Point = 0,
Directional,
Spot,
NumLightTypes
};
struct InternalData
{
//------------- What is the targetindex?
int32_t spotTargetNodeIdx; // Should this be a point to the actual node?
glm::vec3 color;
LightType type;
float constantAttenuation;
float linearAttenuation;
float quadraticAttenuation;
float falloffAngle;
float falloffExponent;
InternalData()
: spotTargetNodeIdx(-1), type(Light::Point), constantAttenuation(1.0f), linearAttenuation(0.0f), quadraticAttenuation(0.0f), falloffAngle(glm::pi<float>()),
falloffExponent(0.0f)
{
color[0] = color[1] = color[2] = 1.0f;
}
};
public:
int32_t getTargetIdx() const;
const glm::vec3& getColor() const;
LightType getType() const;
float getConstantAttenuation() const;
float getLinearAttenuation() const;
float getQuadraticAttenuation() const;
float getFalloffAngle() const;
float getFalloffExponent() const;
void setTargetNodeIdx(int32_t idx);
void setColor(float r, float g, float b);
void setType(LightType t);
void setConstantAttenuation(float c);
void setLinearAttenuation(float l);
void setQuadraticAttenuation(float q);
void setFalloffAngle(float fa);
void setFalloffExponent(float fe);
InternalData& getInternalData(); // If you know what you're doing
private:
InternalData _data;
};
} // namespace assets
} // namespace pvr