GlistEngine
Loading...
Searching...
No Matches
gLight.h
Go to the documentation of this file.
1/*
2 * gLight.h
3 *
4 * Created on: Aug 28, 2020
5 * Author: noyan
6 */
7
8#ifndef ENGINE_GRAPHICS_GLIGHT_H_
9#define ENGINE_GRAPHICS_GLIGHT_H_
10
11#include "gNode.h"
12
22class gLight : public gNode {
23public:
24 static const int LIGHTTYPE_AMBIENT = 0;
25 static const int LIGHTTYPE_DIRECTIONAL = 1;
26 static const int LIGHTTYPE_POINT = 2;
27 static const int LIGHTTYPE_SPOT = 3;
28
29 gLight(int lightType = LIGHTTYPE_POINT);
30 virtual ~gLight();
31
36 void enable();
37
42 void disable();
43
47 bool isEnabled() const;
48
53 bool isChanged() const;
54
56
62 void setType(int lightType);
63
69 int getType() const;
70
84 void rotate(float radians, float ax, float ay, float az);
85
94 void rotateDeg(float degrees, float ax, float ay, float az);
95
104 const glm::vec3& getDirection() const;
105
115 void setAmbientColor(int r, int g, int b, int a = 255);
116
123
129 void setAmbientColor(const gColor& color);
130
140
146 float getAmbientColorRed() const;
147
153 float getAmbientColorGreen() const;
154
160 float getAmbientColorBlue() const;
161
167 float getAmbientColorAlpha() const;
168
178 void setDiffuseColor(int r, int g, int b, int a = 255);
179
186
192 void setDiffuseColor(const gColor& color);
193
204
210 float getDiffuseColorRed() const;
211
217 float getDiffuseColorGreen() const;
218
224 float getDiffuseColorBlue() const;
225
231 float getDiffuseColorAlpha() const;
232
242 void setSpecularColor(int r, int g, int b, int a = 255);
243
250
256 void setSpecularColor(const gColor& color);
257
268
274 float getSpecularColorRed() const;
275
282
288 float getSpecularColorBlue() const;
289
296
317 void setAttenuation(float constant, float linear, float quadratic);
318
325 void setAttenuation(glm::vec3 attenuation);
326
334 const glm::vec3& getAttenuation() const;
335
340
344 float getAttenuationLinear() const;
345
350
362 void setSpotCutOff(glm::vec2 spotCutOff);
363
371 const glm::vec2& getSpotCutOff() const;
372
376 void setSpotCutOffAngle(float cutOffAngle);
377
381 float getSpotCutOffAngle() const;
382
387
391 void setSpotCutOffSpread(float cutOffSpreadAngle);
392
396 float getSpotCutOffSpread() const;
397
398 void setOrientation(const glm::quat& o);
399 void setOrientation(const glm::vec3& angles);
400
401 void rotateAround(float radians, const glm::vec3& axis, const glm::vec3& point);
402 void rotateAroundDeg(float degrees, const glm::vec3& axis, const glm::vec3& point);
403
404protected:
405
407
408private:
409 friend class gRenderer;
410
411 int type;
412 gColor ambientcolor, diffusecolor, specularcolor;
413 bool isenabled;
414 bool ischanged;
415 glm::vec3 attenuation;
416 glm::vec2 spotcutoff;
417 glm::vec3 directioneuler;
418};
419
420#endif /* ENGINE_GRAPHICS_GLIGHT_H_ */
Definition gColor.h:17
Definition gLight.h:22
float getSpecularColorRed() const
void setOrientation(const glm::vec3 &angles)
void rotateAroundDeg(float degrees, const glm::vec3 &axis, const glm::vec3 &point)
void setType(int lightType)
gLight(int lightType=LIGHTTYPE_POINT)
void setDiffuseColor(gColor *color)
float getAmbientColorGreen() const
const glm::vec2 & getSpotCutOff() const
virtual ~gLight()
void rotateAround(float radians, const glm::vec3 &axis, const glm::vec3 &point)
bool isEnabled() const
float getSpecularColorAlpha() const
const glm::vec3 & getDirection() const
void setSpecularColor(gColor *color)
float getAttenuationLinear() const
void setSpotCutOff(glm::vec2 spotCutOff)
void setChanged(bool isChanged)
void setAmbientColor(gColor *color)
void setAttenuation(float constant, float linear, float quadratic)
float getSpotCutOffSpread() const
void setAttenuation(glm::vec3 attenuation)
gColor * getAmbientColor()
void setAmbientColor(int r, int g, int b, int a=255)
void processTransformationMatrix() override
gColor * getSpecularColor()
void enable()
float getSpotOuterCutOffAngle() const
static const int LIGHTTYPE_AMBIENT
Definition gLight.h:24
int getType() const
static const int LIGHTTYPE_POINT
Definition gLight.h:26
static const int LIGHTTYPE_DIRECTIONAL
Definition gLight.h:25
float getAmbientColorRed() const
float getAmbientColorAlpha() const
void rotateDeg(float degrees, float ax, float ay, float az)
void setSpecularColor(const gColor &color)
float getDiffuseColorRed() const
void setSpotCutOffAngle(float cutOffAngle)
bool isChanged() const
void setDiffuseColor(const gColor &color)
float getDiffuseColorAlpha() const
void disable()
static const int LIGHTTYPE_SPOT
Definition gLight.h:27
float getSpecularColorGreen() const
float getAttenuationConstant() const
float getSpotCutOffAngle() const
float getDiffuseColorGreen() const
gColor * getDiffuseColor()
void setSpotCutOffSpread(float cutOffSpreadAngle)
const glm::vec3 & getAttenuation() const
void setDiffuseColor(int r, int g, int b, int a=255)
void setAmbientColor(const gColor &color)
float getAmbientColorBlue() const
float getSpecularColorBlue() const
void setOrientation(const glm::quat &o)
void setSpecularColor(int r, int g, int b, int a=255)
float getDiffuseColorBlue() const
float getAttenuationQuadratic() const
void rotate(float radians, float ax, float ay, float az)
Definition gNode.h:15
Definition gRenderer.h:123
float r
Definition gColor.h:22
float a
Definition gColor.h:22
float b
Definition gColor.h:22
float g
Definition gColor.h:22