Logo   Home Table of Contents    News  Dev Blogs  Gallery  Timeline  Legend  Tags  Sponsors 
Join us on... 
Banner

Current: Month Day, Year

9.1.12 Code of opengl/light.py

opengl/light provides all methods to deal with openGL light settings. The file only contains 1 class:

Class Light

This class is used to create all light effects used by shaders in openGL

Variables

These variables are all preset by __init__.
namedescription
glob reference to global object.
shaderInit reference to global shader initialization object.
shaders List of all shaders.
phong references phong shader.
pbr references pbr shader.
toon references toon shader.
min_coords minimal values of the scene in units as a list.
max_coords maximal values of the scene in units as a list.
glclearcolor Color as QVector4D to clear openGL
ambientLight ambientLight as QVector4D
lightWeight lightWeight as QVector3D, x is luminance, y is focus
blinn Phong shading, boolean, true if mode blinn is used.
skybox Determines if skybox is used.
skyboxname Name of the skybox.
lights List of 3 dictionaries with lights, each one represented as position, volume (color), intensity and type (directional or point).

Methods:

nameparametersreturnsdescription
numlights Nonenumber of lights returns number of lights (3).
listTo3D vector
elems (list)
None set components of QVector3D from list.
listTo4D vector
elems (list)
None set components of QVector4D from list.
q3ToList v (QVector3D)list of 3 elements Converts QVector3D to list.
q4ToList v (QVector4D)list of 4 elements Converts QVector4D to list.
fromGlobal load_json (bool)None set all values from either reading the shader-init JSON file by first setting shaderInit or uses these variables directly without re-reading the file.
toGlobal NoneNone Replaces the variables of global file with new values.
setShader NoneNone bind phong, pbr and toon shader with the new settings.
useBlinn valueNone set blinn parameter of shader to value (True or False).
useSkyBox valueNone set skybox parameter to value (True or False).
getAmbientLuminance Noneluminance return ambientLight.w() (last parameter of luminance QVector4D)
setAmbientLuminance valueNone sets last parameter of ambientLight QVector4D to value.
setSpecularLuminance valueNone sets first parameter of lightWeight QVector3D to value.
setSpecularFocus valueNone sets second parameter of lightWeight QVector3D to value.
getClearColor Nonerounded list of 3 floats Returns current clear-color.
setClearColor valueNone sets clear-color QVector4D. Transparent value is set to 1.0
getAmbientColor Nonerounded list of 3 floats Returns current ambient color.
setAmbientColor valueNone sets first 3 values of ambientLight QVector4D.
setHPos lnum
height
None sets height of light lnum.
setLPos lnum
x
y
None sets x and y position of light lnum.
getLPos lnumposition as list returns the position of light lnum.
setType lnum
ltype
None sets type of light lnum.
getType lnumtype returns type of light lnum.
setLLuminance lnum
value
None set intensity of luminance of light lnum.
getLLuminance lnumluminance returns intensity of luminance of light lnum.
setLColor lnum
value
None sets RGB color from value for light lnum.
getLColor lnumRGB color as a list of 3 floats returns RGB color of light lnum.