[Scummvm-cvs-logs] SF.net SVN: scummvm:[33972] residual/trunk/engine/backend/platform/sdl
aquadran at users.sourceforge.net
aquadran at users.sourceforge.net
Sun Aug 17 20:54:44 CEST 2008
Revision: 33972
http://scummvm.svn.sourceforge.net/scummvm/?rev=33972&view=rev
Author: aquadran
Date: 2008-08-17 18:54:44 +0000 (Sun, 17 Aug 2008)
Log Message:
-----------
corrected omni light, and disabled directional and spot light for now
Modified Paths:
--------------
residual/trunk/engine/backend/platform/sdl/driver_gl.cpp
residual/trunk/engine/backend/platform/sdl/driver_tinygl.cpp
Modified: residual/trunk/engine/backend/platform/sdl/driver_gl.cpp
===================================================================
--- residual/trunk/engine/backend/platform/sdl/driver_gl.cpp 2008-08-17 18:53:35 UTC (rev 33971)
+++ residual/trunk/engine/backend/platform/sdl/driver_gl.cpp 2008-08-17 18:54:44 UTC (rev 33972)
@@ -330,7 +330,6 @@
void DriverGL::setupLight(Scene::Light *light, int lightId) {
glEnable(GL_LIGHTING);
- float ambientLight[] = { 0.0f, 0.0f, 0.0f, 1.0f };
float lightColor[] = { 0.0f, 0.0f, 0.0f, 1.0f };
float lightPos[] = { 0.0f, 0.0f, 0.0f, 1.0f };
float lightDir[] = { 0.0f, 0.0f, 0.0f, 0.0f };
@@ -338,26 +337,19 @@
lightPos[0] = light->_pos.x();
lightPos[1] = light->_pos.y();
lightPos[2] = light->_pos.z();
-// lightColor[0] = (float)light->_color.red() / 256.0f;
-// lightColor[1] = (float)light->_color.blue() / 256.0f;
-// lightColor[2] = (float)light->_color.green() / 256.0f;
+ float intensity = light->_intensity / 1.5f;
+ lightColor[0] = ((float)light->_color.red() / 15.0f) * light->_intensity;
+ lightColor[1] = ((float)light->_color.blue() / 15.0f) * light->_intensity;
+ lightColor[2] = ((float)light->_color.green() / 15.0f) * light->_intensity;
if (strcmp(light->_type.c_str(), "omni") == 0) {
- ambientLight[0] = (float)light->_color.red() / 256.0f;
- ambientLight[1] = (float)light->_color.blue() / 256.0f;
- ambientLight[2] = (float)light->_color.green() / 256.0f;
- lightColor[0] = light->_intensity / 2;
- lightColor[1] = light->_intensity / 2;
- lightColor[2] = light->_intensity / 2;
glDisable(GL_LIGHT0 + lightId);
glLightfv(GL_LIGHT0 + lightId, GL_POSITION, lightPos);
glLightfv(GL_LIGHT0 + lightId, GL_DIFFUSE, lightColor);
- glLightfv(GL_LIGHT0 + lightId, GL_AMBIENT, ambientLight);
- glLightfv(GL_LIGHT0 + lightId, GL_SPECULAR, lightColor);
glEnable(GL_LIGHT0 + lightId);
} else if (strcmp(light->_type.c_str(), "direct") == 0) {
glDisable(GL_LIGHT0 + lightId);
- ambientLight[0] = (float)light->_color.red() / 256.0f;
+/* ambientLight[0] = (float)light->_color.red() / 256.0f;
ambientLight[1] = (float)light->_color.blue() / 256.0f;
ambientLight[2] = (float)light->_color.green() / 256.0f;
lightColor[0] = light->_intensity;
@@ -374,10 +366,10 @@
glLightf(GL_LIGHT0 + lightId, GL_CONSTANT_ATTENUATION, 0.0f);
glLightf(GL_LIGHT0 + lightId, GL_LINEAR_ATTENUATION, 0.0f);
glLightf(GL_LIGHT0 + lightId, GL_QUADRATIC_ATTENUATION, 1.0f);
- glEnable(GL_LIGHT0 + lightId);
+ glEnable(GL_LIGHT0 + lightId);*/
} else if (strcmp(light->_type.c_str(), "spot") == 0) {
glDisable(GL_LIGHT0 + lightId);
- lightColor[0] = (float)light->_color.red() / 256.0f;
+/* lightColor[0] = (float)light->_color.red() / 256.0f;
lightColor[1] = (float)light->_color.blue() / 256.0f;
lightColor[2] = (float)light->_color.green() / 256.0f;
lightDir[0] = light->_dir.x();
@@ -393,7 +385,7 @@
glLightf(GL_LIGHT0 + lightId, GL_CONSTANT_ATTENUATION, 0.0f);
glLightf(GL_LIGHT0 + lightId, GL_LINEAR_ATTENUATION, 0.0f);
glLightf(GL_LIGHT0 + lightId, GL_QUADRATIC_ATTENUATION, 1.0f);
- glEnable(GL_LIGHT0 + lightId);
+ glEnable(GL_LIGHT0 + lightId);*/
} else {
error("Scene::setupLights() Unknown type of light: %s", light->_type.c_str());
}
Modified: residual/trunk/engine/backend/platform/sdl/driver_tinygl.cpp
===================================================================
--- residual/trunk/engine/backend/platform/sdl/driver_tinygl.cpp 2008-08-17 18:53:35 UTC (rev 33971)
+++ residual/trunk/engine/backend/platform/sdl/driver_tinygl.cpp 2008-08-17 18:54:44 UTC (rev 33972)
@@ -125,6 +125,9 @@
memset(_storedDisplay, 0, 640 * 480 * 2);
_currentShadowArray = NULL;
+
+ TGLfloat ambientSource[] = {0.0, 0.0, 0.0, 1.0};
+ tglLightModelfv(TGL_LIGHT_MODEL_AMBIENT, ambientSource);
}
DriverTinyGL::~DriverTinyGL() {
@@ -369,9 +372,8 @@
}
void DriverTinyGL::setupLight(Scene::Light *light, int lightId) {
- assert(lightId < TGL_MAX_LIGHTS);
+ assert(lightId < T_MAX_LIGHTS);
tglEnable(TGL_LIGHTING);
- float ambientLight[] = { 0.0f, 0.0f, 0.0f, 1.0f };
float lightColor[] = { 0.0f, 0.0f, 0.0f, 1.0f };
float lightPos[] = { 0.0f, 0.0f, 0.0f, 1.0f };
float lightDir[] = { 0.0f, 0.0f, 0.0f, 0.0f };
@@ -379,26 +381,19 @@
lightPos[0] = light->_pos.x();
lightPos[1] = light->_pos.y();
lightPos[2] = light->_pos.z();
-// lightColor[0] = (float)light->_color.red() / 256.0f;
-// lightColor[1] = (float)light->_color.blue() / 256.0f;
-// lightColor[2] = (float)light->_color.green() / 256.0f;
+ float intensity = light->_intensity / 1.5f;
+ lightColor[0] = ((float)light->_color.red() / 15.0f) * light->_intensity;
+ lightColor[1] = ((float)light->_color.blue() / 15.0f) * light->_intensity;
+ lightColor[2] = ((float)light->_color.green() / 15.0f) * light->_intensity;
if (strcmp(light->_type.c_str(), "omni") == 0) {
- ambientLight[0] = (float)light->_color.red() / 256.0f;
- ambientLight[1] = (float)light->_color.blue() / 256.0f;
- ambientLight[2] = (float)light->_color.green() / 256.0f;
- lightColor[0] = light->_intensity / 2;
- lightColor[1] = light->_intensity / 2;
- lightColor[2] = light->_intensity / 2;
tglDisable(TGL_LIGHT0 + lightId);
tglLightfv(TGL_LIGHT0 + lightId, TGL_POSITION, lightPos);
tglLightfv(TGL_LIGHT0 + lightId, TGL_DIFFUSE, lightColor);
- tglLightfv(TGL_LIGHT0 + lightId, TGL_AMBIENT, ambientLight);
- tglLightfv(TGL_LIGHT0 + lightId, TGL_SPECULAR, lightColor);
tglEnable(TGL_LIGHT0 + lightId);
} else if (strcmp(light->_type.c_str(), "direct") == 0) {
tglDisable(TGL_LIGHT0 + lightId);
- ambientLight[0] = (float)light->_color.red() / 256.0f;
+/* ambientLight[0] = (float)light->_color.red() / 256.0f;
ambientLight[1] = (float)light->_color.blue() / 256.0f;
ambientLight[2] = (float)light->_color.green() / 256.0f;
lightColor[0] = light->_intensity;
@@ -415,10 +410,10 @@
// tglLightf(TGL_LIGHT0 + lightId, TGL_CONSTANT_ATTENUATION, 0.0f);
// tglLightf(TGL_LIGHT0 + lightId, TGL_LINEAR_ATTENUATION, 0.0f);
// tglLightf(TGL_LIGHT0 + lightId, TGL_QUADRATIC_ATTENUATION, 1.0f);
- tglEnable(TGL_LIGHT0 + lightId);
+ tglEnable(TGL_LIGHT0 + lightId);*/
} else if (strcmp(light->_type.c_str(), "spot") == 0) {
tglDisable(TGL_LIGHT0 + lightId);
- lightColor[0] = (float)light->_color.red() / 256.0f;
+/* lightColor[0] = (float)light->_color.red() / 256.0f;
lightColor[1] = (float)light->_color.blue() / 256.0f;
lightColor[2] = (float)light->_color.green() / 256.0f;
lightDir[0] = light->_dir.x();
@@ -434,7 +429,7 @@
tglLightf(TGL_LIGHT0 + lightId, TGL_CONSTANT_ATTENUATION, 0.0f);
tglLightf(TGL_LIGHT0 + lightId, TGL_LINEAR_ATTENUATION, 0.0f);
tglLightf(TGL_LIGHT0 + lightId, TGL_QUADRATIC_ATTENUATION, 1.0f);
- tglEnable(TGL_LIGHT0 + lightId);
+ tglEnable(TGL_LIGHT0 + lightId);*/
} else {
error("Scene::setupLights() Unknown type of light: %s", light->_type.c_str());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list