BlankMat 0.1.0
Free open-source 3D texture creation application
Loading...
Searching...
No Matches
Light Class Reference
Inheritance diagram for Light:
Collaboration diagram for Light:

Public Member Functions

virtual void Draw (Shader *shader, State *state, Material *defaultMat, const glm::mat4 &viewProj, bool drawMats=false)
 
void UpdateShader (Shader *shader)
 
bool IsCube ()
 
LightType GetType ()
 
glm::vec3 GetColor ()
 
glm::vec3 GetBaseColor ()
 
glm::vec3 GetOffset ()
 
glm::vec3 GetDir ()
 
glm::vec3 GetPos ()
 
float GetKD ()
 
float GetKA ()
 
float GetKS ()
 
bool GetGamma ()
 
float GetRange ()
 
float GetSpotInnerRadius ()
 
float GetSpotOuterRadius ()
 
virtual void SetColor (const glm::vec3 &color)
 
virtual void SetBaseColor (const glm::vec3 &color)
 
virtual void SetOffset (const glm::vec3 &offset)
 
virtual void SetPos (const glm::vec3 &pos)
 
virtual void SetDir (const glm::vec3 &dir)
 
virtual void SetKD (const float kd)
 
virtual void SetKA (const float ka)
 
virtual void SetKS (const float ks)
 
virtual void SetGamma (const bool gamma)
 
virtual void SetSpotInnerRadius (const float innerRadius)
 
virtual void SetSpotOuterRadius (const float outerRadius)
 
virtual void SetType (const LightType type)
 
void UpdateRotatingLight (bool isRotating)
 
void UpdateDiscoLight (bool isDisco)
 
void SetRange (const float lightRange)
 
virtual void LoadMaterials (MaterialContainer *materials, TextureContainer *textures)
 
 Light (const std::string &name="default", const std::string &scope="", LightType type=LightType::POINT, const glm::vec3 &pos=glm::vec3(1.0f), const glm::vec3 &dir=glm::vec3(-1.0f), const glm::vec3 &color=glm::vec3(1.0f), float kd=1.0f, float ka=0.1f, float ks=0.5f, bool gamma=true, float range=13.0f, float spotInner=25, float spotOuter=35)
 
 Light (Config *config)
 
- Public Member Functions inherited from ISelectable
virtual SelectableType GetSelectableType ()
 Returns the type of the selectable.
 
 ISelectable (SelectableType type=SelectableType::NONE)
 Sets the type of the selectable.
 
- Public Member Functions inherited from INameable
virtual void Rename (const std::string &newName, bool includeScope=true)
 Renames the object, setting the scope to be the scoped part of the name.
 
virtual void SetName (const std::string &name)
 Sets the name of the object. Note: Does not set the scope variable. If renaming based on raw input, use Rename() instead to set the scope.
 
virtual void SetScope (const std::string &scope)
 Sets the scope of the object.
 
std::string GetUnscopedName ()
 Returns the unscoped name of the object.
 
std::string GetScope ()
 Returns the scope of the object.
 
std::string GetScopedName ()
 Returns the scoped name of the object.
 
void InitName (const std::string &name, const std::string &scope="")
 Initializes the nameable object with the given name and scope.
 
 INameable ()
 Creates a default nameable object without name or scope.
 

Protected Member Functions

void CalcMatrices ()
 

Protected Attributes

glm::vec3 mColor = glm::vec3(1.0f)
 
glm::vec3 mBaseColor = glm::vec3(1.0f)
 
glm::vec3 mOffset = glm::vec3(0.0f)
 
glm::vec3 mDir = glm::vec3(5, -5, -5)
 
glm::vec3 mPos = glm::vec3(-5, 5, 5)
 
LightType mType = LightType::POINT
 
bool mIsCube = false
 
float mKD = 1.0f
 
float mKA = 0.1f
 
float mKS = 1.0f
 
bool mGamma = false
 
float mPointC
 
float mPointL
 
float mPointQ
 
float mLightRange
 
float mSpotInner = 25.0f
 
float mSpotOuter = 35.0f
 
glm::mat4 mLightSpace
 
float mNearPlane
 
float mFarPlane
 
float mLightSize
 
- Protected Attributes inherited from ISelectable
SelectableType mSelectableType = SelectableType::NONE
 Type of the selectable.
 
- Protected Attributes inherited from INameable
std::string mName = ""
 Name of the object.
 
std::string mScope = ""
 Scope of the object.
 

Constructor & Destructor Documentation

◆ Light() [1/2]

Light::Light ( const std::string &  name = "default",
const std::string &  scope = "",
LightType  type = LightType::POINT,
const glm::vec3 &  pos = glm::vec3(1.0f),
const glm::vec3 &  dir = glm::vec3(-1.0f),
const glm::vec3 &  color = glm::vec3(1.0f),
float  kd = 1.0f,
float  ka = 0.1f,
float  ks = 0.5f,
bool  gamma = true,
float  range = 13.0f,
float  spotInner = 25,
float  spotOuter = 35 
)
inline

◆ Light() [2/2]

Light::Light ( Config config)
inline

Member Function Documentation

◆ CalcMatrices()

void Light::CalcMatrices ( )
inlineprotected

◆ Draw()

virtual void Light::Draw ( Shader shader,
State state,
Material defaultMat,
const glm::mat4 &  viewProj,
bool  drawMats = false 
)
inlinevirtual

Reimplemented in PLightCube.

◆ GetBaseColor()

glm::vec3 Light::GetBaseColor ( )
inline

◆ GetColor()

glm::vec3 Light::GetColor ( )
inline

◆ GetDir()

glm::vec3 Light::GetDir ( )
inline

◆ GetGamma()

bool Light::GetGamma ( )
inline

◆ GetKA()

float Light::GetKA ( )
inline

◆ GetKD()

float Light::GetKD ( )
inline

◆ GetKS()

float Light::GetKS ( )
inline

◆ GetOffset()

glm::vec3 Light::GetOffset ( )
inline

◆ GetPos()

glm::vec3 Light::GetPos ( )
inline

◆ GetRange()

float Light::GetRange ( )
inline

◆ GetSpotInnerRadius()

float Light::GetSpotInnerRadius ( )
inline

◆ GetSpotOuterRadius()

float Light::GetSpotOuterRadius ( )
inline

◆ GetType()

LightType Light::GetType ( )
inline

◆ IsCube()

bool Light::IsCube ( )
inline

◆ LoadMaterials()

virtual void Light::LoadMaterials ( MaterialContainer materials,
TextureContainer textures 
)
inlinevirtual

Reimplemented in PLightCube.

◆ SetBaseColor()

virtual void Light::SetBaseColor ( const glm::vec3 &  color)
inlinevirtual

◆ SetColor()

virtual void Light::SetColor ( const glm::vec3 &  color)
inlinevirtual

Reimplemented in PLightCube.

◆ SetDir()

virtual void Light::SetDir ( const glm::vec3 &  dir)
inlinevirtual

Reimplemented in PLightCube.

◆ SetGamma()

virtual void Light::SetGamma ( const bool  gamma)
inlinevirtual

◆ SetKA()

virtual void Light::SetKA ( const float  ka)
inlinevirtual

◆ SetKD()

virtual void Light::SetKD ( const float  kd)
inlinevirtual

◆ SetKS()

virtual void Light::SetKS ( const float  ks)
inlinevirtual

◆ SetOffset()

virtual void Light::SetOffset ( const glm::vec3 &  offset)
inlinevirtual

◆ SetPos()

virtual void Light::SetPos ( const glm::vec3 &  pos)
inlinevirtual

Reimplemented in PLightCube.

◆ SetRange()

void Light::SetRange ( const float  lightRange)
inline

◆ SetSpotInnerRadius()

virtual void Light::SetSpotInnerRadius ( const float  innerRadius)
inlinevirtual

◆ SetSpotOuterRadius()

virtual void Light::SetSpotOuterRadius ( const float  outerRadius)
inlinevirtual

◆ SetType()

virtual void Light::SetType ( const LightType  type)
inlinevirtual

◆ UpdateDiscoLight()

void Light::UpdateDiscoLight ( bool  isDisco)
inline

◆ UpdateRotatingLight()

void Light::UpdateRotatingLight ( bool  isRotating)
inline

◆ UpdateShader()

void Light::UpdateShader ( Shader shader)
inline

Member Data Documentation

◆ mBaseColor

glm::vec3 Light::mBaseColor = glm::vec3(1.0f)
protected

◆ mColor

glm::vec3 Light::mColor = glm::vec3(1.0f)
protected

◆ mDir

glm::vec3 Light::mDir = glm::vec3(5, -5, -5)
protected

◆ mFarPlane

float Light::mFarPlane
protected

◆ mGamma

bool Light::mGamma = false
protected

◆ mIsCube

bool Light::mIsCube = false
protected

◆ mKA

float Light::mKA = 0.1f
protected

◆ mKD

float Light::mKD = 1.0f
protected

◆ mKS

float Light::mKS = 1.0f
protected

◆ mLightRange

float Light::mLightRange
protected

◆ mLightSize

float Light::mLightSize
protected

◆ mLightSpace

glm::mat4 Light::mLightSpace
protected

◆ mNearPlane

float Light::mNearPlane
protected

◆ mOffset

glm::vec3 Light::mOffset = glm::vec3(0.0f)
protected

◆ mPointC

float Light::mPointC
protected

◆ mPointL

float Light::mPointL
protected

◆ mPointQ

float Light::mPointQ
protected

◆ mPos

glm::vec3 Light::mPos = glm::vec3(-5, 5, 5)
protected

◆ mSpotInner

float Light::mSpotInner = 25.0f
protected

◆ mSpotOuter

float Light::mSpotOuter = 35.0f
protected

◆ mType

LightType Light::mType = LightType::POINT
protected