git-svn-id: svn://db.shs.com.ru/libs@54 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2015-12-01 15:26:28 +00:00
parent 5ca76b651b
commit c8ceb3e328
13 changed files with 818 additions and 47 deletions

View File

@@ -52,7 +52,7 @@ const char qgl_uniform[] =
"uniform mat4 qgl_ModelViewProjectionMatrixInverseTranspose;\n";
const char qgl_structs[] =
"const int qgl_MaxLights = 16;\n"
"const int qgl_MaxLights = 8;\n"
"struct QGLLight {\n"
" vec4 color;\n"
" vec4 position;\n"
@@ -65,7 +65,7 @@ const char qgl_structs[] =
" float constantAttenuation;\n"
" float linearAttenuation;\n"
" float quadraticAttenuation;\n"
" sampler2D shadow;\n"
" sampler2DShadow shadow;\n"
" mat4 shadowMatrix;\n"
"};\n"
"struct QGLMap {\n"
@@ -216,7 +216,7 @@ void setUniformLight(QGLShaderProgram * prog, Light * light, QString ulightn, co
QMatrix4x4 m = mat * light->worldTransform();
QVector4D pos(0, 0, 0, 1.), dir(light->direction);
pos = m * pos;
dir = (m * dir).normalized();
dir = (mat * dir).normalized();
double ang_start = light->angle_start / 2., ang_end = light->angle_end / 2.;
if (light->light_type == Light::Omni)
ang_start = ang_end = 180.;