|
GlistEngine
|
#include <gLight.h>


Public Member Functions | |
| gLight (int lightType=LIGHTTYPE_POINT) | |
| virtual | ~gLight () |
| void | enable () |
| void | disable () |
| bool | isEnabled () const |
| bool | isChanged () const |
| void | setChanged (bool isChanged) |
| void | setType (int lightType) |
| int | getType () const |
| void | rotate (float radians, float ax, float ay, float az) |
| void | rotateDeg (float degrees, float ax, float ay, float az) |
| const glm::vec3 & | getDirection () const |
| void | setAmbientColor (int r, int g, int b, int a=255) |
| void | setAmbientColor (gColor *color) |
| void | setAmbientColor (const gColor &color) |
| gColor * | getAmbientColor () |
| float | getAmbientColorRed () const |
| float | getAmbientColorGreen () const |
| float | getAmbientColorBlue () const |
| float | getAmbientColorAlpha () const |
| void | setDiffuseColor (int r, int g, int b, int a=255) |
| void | setDiffuseColor (gColor *color) |
| void | setDiffuseColor (const gColor &color) |
| gColor * | getDiffuseColor () |
| float | getDiffuseColorRed () const |
| float | getDiffuseColorGreen () const |
| float | getDiffuseColorBlue () const |
| float | getDiffuseColorAlpha () const |
| void | setSpecularColor (int r, int g, int b, int a=255) |
| void | setSpecularColor (gColor *color) |
| void | setSpecularColor (const gColor &color) |
| gColor * | getSpecularColor () |
| float | getSpecularColorRed () const |
| float | getSpecularColorGreen () const |
| float | getSpecularColorBlue () const |
| float | getSpecularColorAlpha () const |
| void | setAttenuation (float constant, float linear, float quadratic) |
| void | setAttenuation (glm::vec3 attenuation) |
| const glm::vec3 & | getAttenuation () const |
| float | getAttenuationConstant () const |
| float | getAttenuationLinear () const |
| float | getAttenuationQuadratic () const |
| void | setSpotCutOff (glm::vec2 spotCutOff) |
| const glm::vec2 & | getSpotCutOff () const |
| void | setSpotCutOffAngle (float cutOffAngle) |
| float | getSpotCutOffAngle () const |
| float | getSpotOuterCutOffAngle () const |
| void | setSpotCutOffSpread (float cutOffSpreadAngle) |
| float | getSpotCutOffSpread () const |
| void | setOrientation (const glm::quat &o) |
| void | setOrientation (const glm::vec3 &angles) |
| void | rotateAround (float radians, const glm::vec3 &axis, const glm::vec3 &point) |
| void | rotateAroundDeg (float degrees, const glm::vec3 &axis, const glm::vec3 &point) |
Public Member Functions inherited from gNode | |
| gNode () | |
| virtual | ~gNode () |
| void | move (float dx, float dy, float dz) |
| void | move (const glm::vec3 &dv) |
| void | rotate (const glm::quat &q) |
| void | rotate (float radians, float ax, float ay, float az) |
| void | rotateDeg (float degrees, float ax, float ay, float az) |
| void | rotateAround (float radians, const glm::vec3 &axis, const glm::vec3 &point) |
| void | rotateAroundDeg (float degrees, const glm::vec3 &axis, const glm::vec3 &point) |
| void | scale (float sx, float sy, float sz) |
| void | scale (float s) |
| void | setPosition (float px, float py, float pz) |
| void | setPosition (const glm::vec3 &pv) |
| void | setOrientation (const glm::quat &o) |
| void | setOrientation (const glm::vec3 &angles) |
| void | setScale (const glm::vec3 &s) |
| void | setScale (float sx, float sy, float sz) |
| void | setScale (float s) |
| void | truck (float distance) |
| void | boom (float distance) |
| void | dolly (float distance) |
| void | tilt (float radians) |
| void | tiltDeg (float degrees) |
| void | pan (float radians) |
| void | panDeg (float degrees) |
| void | roll (float radians) |
| void | rollDeg (float degrees) |
| float | getPosX () const |
| float | getPosY () const |
| float | getPosZ () const |
| const glm::vec3 & | getPosition () const |
| const glm::quat & | getOrientation () const |
| const glm::vec3 & | getScale () const |
| glm::vec3 | getScalarDirectionX () const |
| glm::vec3 | getScalarDirectionY () const |
| glm::vec3 | getScalarDirectionZ () const |
| void | setTransformationMatrix (const glm::mat4 &transformationMatrix) |
| const glm::mat4 & | getTransformationMatrix () const |
| int | getId () const |
| void | setParent (gNode *parent) |
| gNode * | getParent () const |
| void | removeParent () |
| void | addChild (gNode *child) |
| void | removeChild (gNode *child) |
| void | removeChild (int gObjectId) |
| void | setEnabled (bool isEnabled) |
| bool | isEnabled () const |
| void | pushMatrix () const |
| void | popMatrix () const |
Public Member Functions inherited from gRenderObject | |
| gRenderObject () | |
| int | getScreenWidth () |
| int | getScreenHeight () |
| void | pushMatrix () |
| void | popMatrix () |
Public Member Functions inherited from gObject | |
| gObject () | |
| void | logi (std::string message) |
| void | logd (std::string message) |
| void | logw (std::string message) |
| void | loge (std::string message) |
| void | logi (std::string tag, std::string message) |
| void | logd (std::string tag, std::string message) |
| void | logw (std::string tag, std::string message) |
| void | loge (std::string tag, std::string message) |
Static Public Attributes | |
| static const int | LIGHTTYPE_AMBIENT = 0 |
| static const int | LIGHTTYPE_DIRECTIONAL = 1 |
| static const int | LIGHTTYPE_POINT = 2 |
| static const int | LIGHTTYPE_SPOT = 3 |
Static Public Attributes inherited from gObject | |
| static const int | LOGLEVEL_SILENT |
| static const int | LOGLEVEL_DEBUG |
| static const int | LOGLEVEL_INFO |
| static const int | LOGLEVEL_WARNING |
| static const int | LOGLEVEL_ERROR |
Protected Member Functions | |
| void | processTransformationMatrix () override |
Friends | |
| class | gRenderer |
Additional Inherited Members | |
Static Public Member Functions inherited from gRenderObject | |
| static void | setScreenSize (int screenWidth, int screenHeight) |
| static void | setUnitScreenSize (int unitWidth, int unitHeight) |
| static void | setScreenScaling (int screenScaling) |
| static void | enableShadowMapping () |
| static void | disableShadowMapping () |
| static bool | isShadowMappingEnabled () |
| static gRenderer * | getRenderer () |
| static void | destroyRenderer () |
| static void | createRenderer () |
Static Public Member Functions inherited from gObject | |
| static std::string | gGetAppDir () |
| static std::string | gGetAssetsDir () |
| static void | gSetAssetsDir (std::string assetsDir) |
| static std::string | gGetFilesDir () |
| static std::string | gGetImagesDir () |
| static std::string | gGetFontsDir () |
| static std::string | gGetModelsDir () |
| static std::string | gGetTexturesDir () |
| static std::string | gGetShadersDir () |
| static std::string | gGetSoundsDir () |
| static std::string | gGetDatabasesDir () |
| static std::string | gGetVideosDir () |
| static void | setCurrentResolution (int scalingNo, int currentResolutionNo) |
Protected Attributes inherited from gNode | |
| gNode * | parent |
| std::deque< gNode * > | children |
| glm::mat4 | localtransformationmatrix |
| bool | isenabled |
| glm::vec3 | position |
| glm::quat | orientation |
| glm::vec3 | scalevec |
| glm::vec3 | prevposition |
| glm::quat | prevorientation |
| glm::vec3 | prevscalevec |
Static Protected Attributes inherited from gRenderObject | |
| static bool | isshadowmappingenabled |
Static Protected Attributes inherited from gObject | |
| static int | renderpassnum |
| static int | renderpassno |
| static int | releasescaling |
| static int | releaseresolution |
Glist Engine has four light types: Ambient, Directional, Point, and Spot. Ambient lights have a small amount of light. Directional lights are sun like light. Point lights are bulb like light. Spot lights emit light from a single point. If light type is not changed, light type will be point light because of default constructor.
| gLight::gLight | ( | int | lightType = LIGHTTYPE_POINT | ) |
|
virtual |
| void gLight::disable | ( | ) |
Removing the light to the scene. This function should be using before camera.end() function.
| void gLight::enable | ( | ) |
Adding the light to the scene. This function should be using after camera.begin() function.
| gColor * gLight::getAmbientColor | ( | ) |
Gives ambient color RGBA component. This function can be use two type. Using directly giving memory address. Other way, Typing like function.r, function.g, function.b, function.a giving value of color component.
| float gLight::getAmbientColorAlpha | ( | ) | const |
Gives alpha component value range is [0,1].
| float gLight::getAmbientColorBlue | ( | ) | const |
Gives blue component value range is [0,1].
| float gLight::getAmbientColorGreen | ( | ) | const |
Gives green component value range is [0,1].
| float gLight::getAmbientColorRed | ( | ) | const |
Gives red component value range is [0,1].
| const glm::vec3 & gLight::getAttenuation | ( | ) | const |
For example, can be using function.x, function.y, function.z. This typing showing light constant, linear, quadratic values. If this function using more than 1, copy constructor called.
| float gLight::getAttenuationConstant | ( | ) | const |
| float gLight::getAttenuationLinear | ( | ) | const |
| float gLight::getAttenuationQuadratic | ( | ) | const |
| gColor * gLight::getDiffuseColor | ( | ) |
Gives diffuse color RGBA value.
This function can be use two type. Using directly giving memory address. Other way, Typing like function.r, function.g, function.b, function.a giving value of color component.
| float gLight::getDiffuseColorAlpha | ( | ) | const |
Gives alpha component value range is [0,1].
| float gLight::getDiffuseColorBlue | ( | ) | const |
Gives blue component value the range is
| float gLight::getDiffuseColorGreen | ( | ) | const |
Gives green component value range is [0,1].
| float gLight::getDiffuseColorRed | ( | ) | const |
Gives red component value range is [0,1].
| const glm::vec3 & gLight::getDirection | ( | ) | const |
Gives light direction x, y, z coordinate. For example, can be using function.x, function.y, function.z. This typing showing light x, y, z direction. If this function using more than 1, copy constructor called.
| gColor * gLight::getSpecularColor | ( | ) |
Gives specular color RGBA value.
This function can be use two type. Using directly giving memory address. Other way, Typing like function.r, function.g, function.b, function.a giving value of color component.
| float gLight::getSpecularColorAlpha | ( | ) | const |
Gives alpha component value range is [0,1].
| float gLight::getSpecularColorBlue | ( | ) | const |
Gives blue component value range is [0,1].
| float gLight::getSpecularColorGreen | ( | ) | const |
Gives green component value range is [0,1].
| float gLight::getSpecularColorRed | ( | ) | const |
Gives red component value range is [0,1].
| const glm::vec2 & gLight::getSpotCutOff | ( | ) | const |
For example, can be using function.x and function.y. This typing showing light spot cutoff angle. If this function using more than 1, copy constructor called.
| float gLight::getSpotCutOffAngle | ( | ) | const |
| float gLight::getSpotCutOffSpread | ( | ) | const |
| float gLight::getSpotOuterCutOffAngle | ( | ) | const |
| int gLight::getType | ( | ) | const |
Gives using type of light id
| bool gLight::isChanged | ( | ) | const |
| bool gLight::isEnabled | ( | ) | const |
|
overrideprotectedvirtual |
Reimplemented from gNode.
| void gLight::rotate | ( | float | radians, |
| float | ax, | ||
| float | ay, | ||
| float | az | ||
| ) |
Rotates light objects around the given vector.
The vector (ax, ay, az) should be a unit vector (e.g., (1, 0, 0), (0, 1, 1), etc.) because the function multiplies this vector by the rotation amount in radians. For example, rotate(PI / 2, 0, 0, 1) rotates the object 90 degrees around the Z axis. All rotations are relative to the object's pivot point.
| radians | the amount of rotation in radians |
| ax | the x component of the rotation axis (unit vector) |
| ay | the y component of the rotation axis (unit vector) |
| az | the z component of the rotation axis (unit vector) |
| void gLight::rotateAround | ( | float | radians, |
| const glm::vec3 & | axis, | ||
| const glm::vec3 & | point | ||
| ) |
| void gLight::rotateAroundDeg | ( | float | degrees, |
| const glm::vec3 & | axis, | ||
| const glm::vec3 & | point | ||
| ) |
| void gLight::rotateDeg | ( | float | degrees, |
| float | ax, | ||
| float | ay, | ||
| float | az | ||
| ) |
Same as rotate(), but the angle is specified in degrees.
| degrees | the amount of rotation in degrees |
| ax | the x component of the rotation axis (unit vector) |
| ay | the y component of the rotation axis (unit vector) |
| az | the z component of the rotation axis (unit vector) |
| void gLight::setAmbientColor | ( | const gColor & | color | ) |
| void gLight::setAmbientColor | ( | gColor * | color | ) |
| void gLight::setAmbientColor | ( | int | r, |
| int | g, | ||
| int | b, | ||
| int | a = 255 |
||
| ) |
Ambient color changing with RGBA. The range of the value [0,255]
| r | ambient color red component. |
| g | ambient color green component. |
| b | ambient color blue component. |
| a | ambient color alpha component. |
| void gLight::setAttenuation | ( | float | constant, |
| float | linear, | ||
| float | quadratic | ||
| ) |
When blending between these three types of attenuation, set the proportions of each attenuation type against the other two types. To avoid confusion, a proportion of 3:6:1 gives the exact same, which can easily be translated to 30%, 60% and 10%.
| constant | The intensity, represented by the brigtness setting of the light entity, will be totally unaffected by distance, continuing until it hits a surface, theoretically capable of illuminating an infinite area. |
| linear | Light intensity (set by its brightness) will diminish (at a fixed rate) as it travels from its source. |
| quadratic | Mathematically, the attenuation of a 100% quadratic light is exponential (quadratic), expressed as "I = 1/d^2", meaning that the further the light travels from its source, the more it will be diminished. |
| void gLight::setAttenuation | ( | glm::vec3 | attenuation | ) |
Alternative version to blending between these three types of attenuation, using three dimensional of the vector type.
| attenuation | three dimensional floating point vector |
| void gLight::setChanged | ( | bool | isChanged | ) |
| void gLight::setDiffuseColor | ( | const gColor & | color | ) |
| void gLight::setDiffuseColor | ( | gColor * | color | ) |
| void gLight::setDiffuseColor | ( | int | r, |
| int | g, | ||
| int | b, | ||
| int | a = 255 |
||
| ) |
Diffuse color changing with RGBA. The range of the value [0,255].
| r | diffuse color red component. |
| g | diffuse color green component. |
| b | diffuse color blue component. |
| a | diffuse color alpha component. |
| void gLight::setOrientation | ( | const glm::quat & | o | ) |
| void gLight::setOrientation | ( | const glm::vec3 & | angles | ) |
| void gLight::setSpecularColor | ( | const gColor & | color | ) |
| void gLight::setSpecularColor | ( | gColor * | color | ) |
| void gLight::setSpecularColor | ( | int | r, |
| int | g, | ||
| int | b, | ||
| int | a = 255 |
||
| ) |
Specular color changing with RGBA. The range of the value [0,255]
| r | specular color red component. |
| g | specular color green component. |
| b | specular color blue component. |
| a | specular color alpha component. |
| void gLight::setSpotCutOff | ( | glm::vec2 | spotCutOff | ) |
Value that specifies the maximum spread angle of a light source. Only values in the range 0 90 and the special value 180 are accepted. If the angle between the direction of the light and the direction from the light to the vertex being lighted is greater than the spot cutoff angle, the light is completely masked. Otherwise, its intensity is controlled by the spot exponent and the attenuation factors. The initial spot cutoff is 180, resulting in uniform light distribution.
| spotCutOff | Two dimensional of the vector type |
| void gLight::setSpotCutOffAngle | ( | float | cutOffAngle | ) |
| cutOffAngle | changing minimum angle |
| void gLight::setSpotCutOffSpread | ( | float | cutOffSpreadAngle | ) |
| cutOffSpreadAngle | changing maximum angle |
| void gLight::setType | ( | int | lightType | ) |
Changing type of light using id
| lightType | light id no |
|
friend |
|
static |
|
static |
|
static |
|
static |