[Scummvm-cvs-logs] CVS: residual driver.h,NONE,1.1 driver_tinygl.cpp,NONE,1.1 driver_tinygl.h,NONE,1.1 Makefile.common,1.13,1.14 TODO,1.43,1.44 actor.cpp,1.41,1.42 bitmap.cpp,1.30,1.31 bitmap.h,1.13,1.14 driver_gl.cpp,1.26,1.27 driver_gl.h,1.14,1.15 engine.cpp,1.61,1.62 main.cpp,1.45,1.46 material.cpp,1.12,1.13 material.h,1.8,1.9 model.cpp,1.24,1.25 scene.cpp,1.36,1.37 scene.h,1.23,1.24 smush.cpp,1.58,1.59 textobject.cpp,1.15,1.16 textobject.h,1.6,1.7 walkplane.h,1.11,1.12

Pawel Kolodziejski aquadran at users.sourceforge.net
Wed Jan 12 10:08:14 CET 2005


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22571

Modified Files:
	Makefile.common TODO actor.cpp bitmap.cpp bitmap.h 
	driver_gl.cpp driver_gl.h engine.cpp main.cpp material.cpp 
	material.h model.cpp scene.cpp scene.h smush.cpp 
	textobject.cpp textobject.h walkplane.h 
Added Files:
	driver.h driver_tinygl.cpp driver_tinygl.h 
Log Message:
added TinyGL driver as Residual software renderer

--- NEW FILE: driver.h ---
// Residual - Virtual machine to run LucasArts' 3D adventure games
// Copyright (C) 2003-2005 The ScummVM-Residual Team (www.scummvm.org)
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA

#ifndef DRIVER_H
#define DRIVER_H

#include "bits.h"
#include "vector3d.h"
#include "color.h"
#include "model.h"
#include "colormap.h"
#include "bitmap.h"

class Driver {
public:
	Driver() { ; }
	Driver(int screenW, int screenH, int screenBPP) { ; }

	virtual void setupCamera(float fov, float nclip, float fclip, float roll) = NULL;
	virtual void positionCamera(Vector3d pos, Vector3d interest) = NULL;

	virtual void clearScreen() = NULL;
	virtual void flipBuffer() = NULL;

	virtual void startActorDraw(Vector3d pos, float yaw, float pitch, float roll) = NULL;
	virtual void finishActorDraw() = NULL;
	
	virtual void set3DMode() = NULL;

	virtual void drawHierachyNode(const Model::HierNode *node) = NULL;
	virtual void drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts) = NULL;

	virtual void createMaterial(Material *material, const char *data, const CMap *cmap) = NULL;
	virtual void selectMaterial(const Material *material) = NULL;
	virtual void destroyMaterial(Material *material) = NULL;

	virtual void createBitmap(Bitmap *bitmap) = NULL;
	virtual void drawBitmap(const Bitmap *bitmap) = NULL;
	virtual void destroyBitmap(Bitmap *bitmap) = NULL;

	virtual void drawDepthBitmap(int x, int y, int w, int h, char *data) = NULL;

	virtual void drawEmergString(int x, int y, const char *text, const Color &fgColor) = NULL;
	virtual void loadEmergFont() = NULL;

	virtual void prepareSmushFrame(int width, int height, byte *bitmap) = NULL;
	virtual void drawSmushFrame(int offsetX, int offsetY) = NULL;
};

extern Driver *g_driver;

#endif

--- NEW FILE: driver_tinygl.cpp ---
// Residual - Virtual machine to run LucasArts' 3D adventure games
// Copyright (C) 2003-2005 The ScummVM-Residual Team (www.scummvm.org)
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA

#include "debug.h"
#include "colormap.h"
#include "material.h"
#include "driver_tinygl.h"

#include "tinygl/gl.h"
#include "tinygl/zgl.h"


// func below is from Mesa glu sources
static void lookAt(TGLfloat eyex, TGLfloat eyey, TGLfloat eyez, TGLfloat centerx,
		TGLfloat centery, TGLfloat centerz, TGLfloat upx, TGLfloat upy, TGLfloat upz) {
	TGLfloat m[16];
	TGLfloat x[3], y[3], z[3];
	TGLfloat mag;

	z[0] = eyex - centerx;
	z[1] = eyey - centery;
	z[2] = eyez - centerz;
	mag = sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);
	if (mag) {
		z[0] /= mag;
		z[1] /= mag;
		z[2] /= mag;
	}

	y[0] = upx;
	y[1] = upy;
	y[2] = upz;

	x[0] = y[1] * z[2] - y[2] * z[1];
	x[1] = -y[0] * z[2] + y[2] * z[0];
	x[2] = y[0] * z[1] - y[1] * z[0];

	y[0] = z[1] * x[2] - z[2] * x[1];
	y[1] = -z[0] * x[2] + z[2] * x[0];
	y[2] = z[0] * x[1] - z[1] * x[0];

	mag = sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
	if (mag) {
		x[0] /= mag;
		x[1] /= mag;
		x[2] /= mag;
	}

	mag = sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
	if (mag) {
		y[0] /= mag;
		y[1] /= mag;
		y[2] /= mag;
	}

#define M(row,col)  m[col * 4 + row]
	M(0, 0) = x[0];
	M(0, 1) = x[1];
	M(0, 2) = x[2];
	M(0, 3) = 0.0;
	M(1, 0) = y[0];
	M(1, 1) = y[1];
	M(1, 2) = y[2];
	M(1, 3) = 0.0;
	M(2, 0) = z[0];
	M(2, 1) = z[1];
	M(2, 2) = z[2];
	M(2, 3) = 0.0;
	M(3, 0) = 0.0;
	M(3, 1) = 0.0;
	M(3, 2) = 0.0;
	M(3, 3) = 1.0;
#undef M
	tglMultMatrixf(m);

	tglTranslatef(-eyex, -eyey, -eyez);
}

DriverTinyGL::DriverTinyGL(int screenW, int screenH, int screenBPP) {
	_screen = SDL_SetVideoMode(screenW, screenH, screenBPP, SDL_HWSURFACE);
	if (_screen == NULL)
		error("Could not initialize video");

	SDL_WM_SetCaption("Residual: Modified TinyGL - Software Renderer", "Residual");

	byte *frameBuffer = (byte *)_screen->pixels;
	_zb = ZB_open(screenW, screenH, ZB_MODE_5R6G5B, 0, NULL, NULL, frameBuffer);
	tglInit(_zb);

	_zbufferSurface = SDL_CreateRGBSurfaceFrom(_zb->zbuf, screenW, screenH, 16, screenW * 2, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000);
	_fullScreenBitmapData = NULL;
	_fullScreenZBitmapData = NULL;
	_smushSurface = NULL;
}

DriverTinyGL::~DriverTinyGL() {
	SDL_FreeSurface(_zbufferSurface);
	tglClose();
	ZB_close(_zb);
}

void DriverTinyGL::setupCamera(float fov, float nclip, float fclip, float roll) {
	tglMatrixMode(TGL_PROJECTION);
	tglLoadIdentity();

	float right = nclip * std::tan(fov / 2 * (M_PI / 180));
	tglFrustum(-right, right, -right * 0.75, right * 0.75, nclip, fclip);

	tglMatrixMode(TGL_MODELVIEW);
	tglLoadIdentity();

	Vector3d up_vec(0, 0, 1);
	tglRotatef(roll, 0, 0, -1);
}

void DriverTinyGL::positionCamera(Vector3d pos, Vector3d interest) {
	Vector3d up_vec(0, 0, 1);

	if (pos.x() == interest.x() && pos.y() == interest.y())
		up_vec = Vector3d(0, 1, 0);

	lookAt(pos.x(), pos.y(), pos.z(), interest.x(), interest.y(), interest.z(), up_vec.x(), up_vec.y(), up_vec.z());
  }

void DriverTinyGL::clearScreen() {
	tglClear(TGL_COLOR_BUFFER_BIT | TGL_DEPTH_BUFFER_BIT);
}

void DriverTinyGL::flipBuffer() {
	SDL_Flip(_screen);
}

void DriverTinyGL::startActorDraw(Vector3d pos, float yaw, float pitch, float roll) {
	tglEnable(TGL_TEXTURE_2D);
	tglMatrixMode(TGL_MODELVIEW);
	tglPushMatrix();
	tglTranslatef(pos.x(), pos.y(), pos.z());
	tglRotatef(yaw, 0, 0, 1);
	tglRotatef(pitch, 1, 0, 0);
	tglRotatef(roll, 0, 1, 0);
}

void DriverTinyGL::finishActorDraw() {
	tglMatrixMode(TGL_MODELVIEW);
	tglPopMatrix();
	tglDisable(TGL_TEXTURE_2D);
}

void DriverTinyGL::set3DMode() {
	tglMatrixMode(TGL_MODELVIEW);
	tglEnable(TGL_DEPTH_TEST);
}

void DriverTinyGL::drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts) {
	tglNormal3fv((float *)face->_normal._coords);
	tglBegin(TGL_POLYGON);
	for (int i = 0; i < face->_numVertices; i++) {
		tglNormal3fv(vertNormals + 3 * face->_vertices[i]);

		if (face->_texVertices != NULL)
			tglTexCoord2fv(textureVerts + 2 * face->_texVertices[i]);

		tglVertex3fv(vertices + 3 * face->_vertices[i]);
	}
	tglEnd();
}

void DriverTinyGL::drawHierachyNode(const Model::HierNode *node) {
	if (node->_hierVisible) {
		tglPushMatrix();

		tglTranslatef(node->_animPos.x() / node->_totalWeight, node->_animPos.y() / node->_totalWeight, node->_animPos.z() / node->_totalWeight);
		tglRotatef(node->_animYaw / node->_totalWeight, 0, 0, 1);
		tglRotatef(node->_animPitch / node->_totalWeight, 1, 0, 0);
		tglRotatef(node->_animRoll / node->_totalWeight, 0, 1, 0);

		if (node->_mesh != NULL && node->_meshVisible) {
			tglPushMatrix();
			tglTranslatef(node->_pivot.x(), node->_pivot.y(), node->_pivot.z());
			node->_mesh->draw();
			tglMatrixMode(TGL_MODELVIEW);
			tglPopMatrix();
		}

		if (node->_child != NULL) {
			node->_child->draw();
			tglMatrixMode(TGL_MODELVIEW);
		}
		tglPopMatrix();
	}

	if (node->_sibling != NULL)
		node->_sibling->draw();
}

void DriverTinyGL::createBitmap(Bitmap *bitmap) {
	if (bitmap->_format == 1) {
	} else {
		for (int pic = 0; pic < bitmap->_numImages; pic++) {
			uint16 *zbufPtr = reinterpret_cast<uint16 *>(bitmap->_data[pic]);
			for (int i = 0; i < (bitmap->_width * bitmap->_height); i++) {
				uint16 val = READ_LE_UINT16(bitmap->_data[pic] + 2 * i);
				zbufPtr[i] = ((uint32) val) * 0x10000 / 100 / (0x10000 - val);
			}
		}
	}
}

void DriverTinyGL::drawBitmap(const Bitmap *bitmap) {
	SDL_Surface *tmpSurface = NULL;
	SDL_Rect srcRect, dstRect;

	srcRect.x = 0;
	srcRect.y = 0;
	srcRect.w = bitmap->width();
	srcRect.h = bitmap->height();
	dstRect.x = bitmap->x();
	dstRect.y = bitmap->y();
	dstRect.w = bitmap->width();
	dstRect.h = bitmap->height();

	if (bitmap->_format == 1) {
		char *tmp = bitmap->_data[bitmap->_currImage - 1];
		tmpSurface = SDL_CreateRGBSurfaceFrom(tmp, bitmap->width(), bitmap->height(),
			16, bitmap->width() * 2, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000);
		SDL_SetColorKey(tmpSurface, SDL_SRCCOLORKEY, 0xf81f);
		SDL_BlitSurface(tmpSurface, &srcRect, _screen, &dstRect);
		SDL_FreeSurface(tmpSurface);
	} else {
		char *tmp = bitmap->_data[bitmap->_currImage - 1];
		tmpSurface = SDL_CreateRGBSurfaceFrom(tmp, bitmap->width(), bitmap->height(),
			16, bitmap->width() * 2, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000);
		SDL_BlitSurface(tmpSurface, &srcRect, _zbufferSurface, &dstRect);
		SDL_FreeSurface(tmpSurface);
	}
}

void DriverTinyGL::destroyBitmap(Bitmap *bitmap) {
}

void DriverTinyGL::createMaterial(Material *material, const char *data, const CMap *cmap) {
	material->_textures = new TGLuint[material->_numImages];
	tglGenTextures(material->_numImages, (TGLuint *)material->_textures);
	char *texdata = new char[material->_width * material->_height * 4];
	for (int i = 0; i < material->_numImages; i++) {
		char *texdatapos = texdata;
		for (int y = 0; y < material->_height; y++) {
			for (int x = 0; x < material->_width; x++) {
				int col = *(uint8 *)(data);
				if (col == 0)
					memset(texdatapos, 0, 3); // transparent
				else {
					memcpy(texdatapos, cmap->_colors + 3 * (*(uint8 *)(data)), 3);
				}
				texdatapos += 3;
				data++;
			}
		}
		TGLuint *textures = (TGLuint *)material->_textures;
		tglBindTexture(TGL_TEXTURE_2D, textures[i]);
		tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_WRAP_S, TGL_REPEAT);
		tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_WRAP_T, TGL_REPEAT);
		tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MAG_FILTER, TGL_LINEAR);
		tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MIN_FILTER, TGL_LINEAR);
		tglTexEnvi(TGL_TEXTURE_ENV, TGL_TEXTURE_ENV_MODE, /*TGL_REPLACE*/ TGL_DECAL);
		tglTexImage2D(TGL_TEXTURE_2D, 0, 3, material->_width, material->_height, 0, TGL_RGB, TGL_UNSIGNED_BYTE, texdata);
		data += 24;
	}
	delete[] texdata;
}

void DriverTinyGL::selectMaterial(const Material *material) {
	TGLuint *textures = (TGLuint *)material->_textures;
	tglBindTexture(TGL_TEXTURE_2D, textures[material->_currImage]);
	tglPushMatrix();
	tglMatrixMode(TGL_TEXTURE);
	tglLoadIdentity();
	tglScalef(1.0f / material->_width, 1.0f / material->_height, 1);
	tglMatrixMode(TGL_MODELVIEW);
	tglPopMatrix();
}

void DriverTinyGL::destroyMaterial(Material *material) {
	tglDeleteTextures(material->_numImages, (TGLuint *)material->_textures);
	delete[] material->_textures;
}

void DriverTinyGL::drawDepthBitmap(int x, int y, int w, int h, char *data) {
}

void DriverTinyGL::prepareSmushFrame(int width, int height, byte *bitmap) {
	_smushWidth = width;
	_smushHeight = height;
	if (_smushSurface) {
		SDL_FreeSurface(_smushSurface);
		_smushSurface = NULL;
	}
	_smushSurface = SDL_CreateRGBSurfaceFrom(bitmap, _smushWidth, _smushHeight, 16, _smushWidth * 2, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000);
}

void DriverTinyGL::drawSmushFrame(int offsetX, int offsetY) {
	SDL_Rect srcRect, dstRect;
	srcRect.x = 0;
	srcRect.y = 0;
	srcRect.w = _smushWidth;
	srcRect.h = _smushHeight;
	dstRect.x = offsetX;
	dstRect.y = offsetY;
	dstRect.w = _smushWidth;
	dstRect.h = _smushHeight;

	SDL_BlitSurface(_smushSurface, &srcRect, _screen, &dstRect);
}

void DriverTinyGL::loadEmergFont() {
}

void DriverTinyGL::drawEmergString(int x, int y, const char *text, const Color &fgColor) {
}

--- NEW FILE: driver_tinygl.h ---
// Residual - Virtual machine to run LucasArts' 3D adventure games
// Copyright (C) 2003-2005 The ScummVM-Residual Team (www.scummvm.org)
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA

#ifndef DRIVER_TINYGL_H
#define DRIVER_TINYGL_H

#include "bits.h"
#include "vector3d.h"
#include "color.h"
#include "model.h"
#include "colormap.h"
#include "bitmap.h"
#include "driver.h"

#include "tinygl/gl.h"
#include "tinygl/zgl.h"

#include <SDL.h>

#define BITMAP_TEXTURE_SIZE 256

class DriverTinyGL : public Driver {
public:
	DriverTinyGL(int screenW, int screenH, int screenBPP);
	~DriverTinyGL();

	void setupCamera(float fov, float nclip, float fclip, float roll);
	void positionCamera(Vector3d pos, Vector3d interest);

	void clearScreen(); 
	void flipBuffer();

	void startActorDraw(Vector3d pos, float yaw, float pitch, float roll);
	void finishActorDraw();
	
	void set3DMode();

	void drawHierachyNode(const Model::HierNode *node);
	void drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts);

	void createMaterial(Material *material, const char *data, const CMap *cmap);
	void selectMaterial(const Material *material);
	void destroyMaterial(Material *material);

	void createBitmap(Bitmap *bitmap);
	void drawBitmap(const Bitmap *bitmap);
	void destroyBitmap(Bitmap *bitmap);

	void drawDepthBitmap(int x, int y, int w, int h, char *data);
	void drawBitmap();

	void drawEmergString(int x, int y, const char *text, const Color &fgColor);
	void loadEmergFont();

	void prepareSmushFrame(int width, int height, byte *bitmap);
	void drawSmushFrame(int offsetX, int offsetY);

private:
	ZBuffer *_zb;
	SDL_Surface *_screen;
	SDL_Surface *_smushSurface;
	SDL_Surface *_zbufferSurface;
	byte *_fullScreenBitmapData;
	byte *_fullScreenZBitmapData;
	int _smushWidth;
	int _smushHeight;
};

#endif

Index: Makefile.common
===================================================================
RCS file: /cvsroot/scummvm/residual/Makefile.common,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- Makefile.common	10 Jan 2005 09:07:45 -0000	1.13
+++ Makefile.common	12 Jan 2005 18:06:42 -0000	1.14
@@ -33,12 +33,36 @@
 	imuse/imuse_sndmgr.o \
 	imuse/imuse_tables.o \
 	imuse/imuse_track.o \
+	tinygl/api.o \
+	tinygl/arrays.o \
+	tinygl/clear.o \
+	tinygl/clip.o \
+	tinygl/error.o \
+	tinygl/get.o \
+	tinygl/image_util.o \
+	tinygl/init.o \
+	tinygl/light.o \
+	tinygl/list.o \
+	tinygl/matrix.o \
+	tinygl/memory.o \
+	tinygl/misc.o \
+	tinygl/msghandling.o \
+	tinygl/select.o \
+	tinygl/specbuf.o \
+	tinygl/texture.o \
+	tinygl/vertex.o \
+	tinygl/zbuffer.o \
+	tinygl/zdither.o \
+	tinygl/zline.o \
+	tinygl/zmath.o \
+	tinygl/ztriangle.o \
 	actor.o \
 	bitmap.o \
 	blocky16.o \
 	costume.o \
 	debug.o \
 	driver_gl.o \
+	driver_tinygl.o \
 	engine.o \
 	keyframe.o \
 	lab.o \
@@ -54,6 +78,7 @@
 	registry.o \
 	resource.o \
 	scene.o \
+	screen.o \
 	smush.o \
 	textobject.o \
 	textsplit.o \

Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/residual/TODO,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- TODO	12 Jan 2005 15:06:26 -0000	1.43
+++ TODO	12 Jan 2005 18:06:42 -0000	1.44
@@ -13,7 +13,6 @@
  * Finish Save/Load support for rest of Engine except Lua
  * Implement 2D primitives 
  * Proper vsscanf implementation in textsplit.cpp for platforms without it (MSVC, etc)
- * Abstract rendering code (partialy done)
  * Fix drawEmergString() to work with Mesa
  * Make SMUSH work on Linux/PPC (whats wrong with it, exactly? - ender :)
  * Finish panning in 3d position code

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/actor.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- actor.cpp	5 Jan 2005 18:54:29 -0000	1.41
+++ actor.cpp	12 Jan 2005 18:06:42 -0000	1.42
@@ -21,7 +21,7 @@
 #include "costume.h"
 #include "lipsynch.h"
 #include "localize.h"
-#include "driver_gl.h"
+#include "driver.h"
 
 #include "mixer/mixer.h"
 

Index: bitmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/bitmap.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- bitmap.cpp	3 Jan 2005 20:49:49 -0000	1.30
+++ bitmap.cpp	12 Jan 2005 18:06:42 -0000	1.31
@@ -20,7 +20,7 @@
 #include "debug.h"
 #include "bitmap.h"
 #include "smush.h"
-#include "driver_gl.h"
+#include "driver.h"
 
 #include <cstdlib>
 #include <cstring>
@@ -65,13 +65,13 @@
 		}
 
 #ifdef SYSTEM_BIG_ENDIAN
-		if (_format == 1)	
+		if (_format == 1)
 			for (int j = 0; j < _width * _height; ++j) {
 				((uint16 *)_data[i])[j] = SWAP_BYTES_16(((uint16 *)_data[i])[j]);
 			}
 #endif
-	}	
-	
+	}
+
 	g_driver->createBitmap(this);
 }
 

Index: bitmap.h
===================================================================
RCS file: /cvsroot/scummvm/residual/bitmap.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- bitmap.h	5 Jan 2005 22:13:56 -0000	1.13
+++ bitmap.h	12 Jan 2005 18:06:42 -0000	1.14
@@ -21,7 +21,7 @@
 #include "resource.h"
 
 #include <cstring>
-#include <SDL_opengl.h>
+#include "tinygl/gl.h"
 
 class Bitmap : public Resource {
 public:
@@ -52,7 +52,7 @@
 	int _width, _height, _x, _y;
 	int _format;
 	int _numTex;
-	GLuint *_texIds;
+	void *_texIds;
 	bool _hasTransparency;
 };
 

Index: driver_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- driver_gl.cpp	11 Jan 2005 19:46:47 -0000	1.26
+++ driver_gl.cpp	12 Jan 2005 18:06:42 -0000	1.27
@@ -18,13 +18,10 @@
 #include "debug.h"
 #include "colormap.h"
 #include "material.h"
-#include "driver_gl.h"
 #include "font.h"
+#include "driver_gl.h"
 
-Driver *g_driver;
-
-// Constructor. Should create the driver and open screens, etc.
-Driver::Driver(int screenW, int screenH, int screenBPP) {
+DriverGL::DriverGL(int screenW, int screenH, int screenBPP) {
 	char GLDriver[1024];
 
 	SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
@@ -45,8 +42,7 @@
 	_smushNumTex = 0;
 }
 
-void Driver::setupCamera(float fov, float nclip, float fclip, float roll) {
-	// Set perspective transformation
+void DriverGL::setupCamera(float fov, float nclip, float fclip, float roll) {
 	glMatrixMode(GL_PROJECTION);
 	glLoadIdentity();
 
@@ -60,7 +56,7 @@
 	glRotatef(roll, 0, 0, -1);
 }
 
-void Driver::positionCamera(Vector3d pos, Vector3d interest) {
+void DriverGL::positionCamera(Vector3d pos, Vector3d interest) {
 	Vector3d up_vec(0, 0, 1);
 
 	if (pos.x() == interest.x() && pos.y() == interest.y())
@@ -69,15 +65,15 @@
 	gluLookAt(pos.x(), pos.y(), pos.z(), interest.x(), interest.y(), interest.z(), up_vec.x(), up_vec.y(), up_vec.z());
 }
 
-void Driver::clearScreen() {
+void DriverGL::clearScreen() {
 	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 }
 
-void Driver::flipBuffer() {
+void DriverGL::flipBuffer() {
 	SDL_GL_SwapBuffers();
 }
 
-void Driver::startActorDraw(Vector3d pos, float yaw, float pitch, float roll) {
+void DriverGL::startActorDraw(Vector3d pos, float yaw, float pitch, float roll) {
 	glEnable(GL_TEXTURE_2D);
 	glMatrixMode(GL_MODELVIEW);
 	glPushMatrix();
@@ -87,18 +83,18 @@
 	glRotatef(roll, 0, 1, 0);
 }
 
-void Driver::finishActorDraw() {
+void DriverGL::finishActorDraw() {
 	glPopMatrix();
 	glDisable(GL_TEXTURE_2D);
 }
 
 
-void Driver::set3DMode() {
+void DriverGL::set3DMode() {
 	glMatrixMode(GL_MODELVIEW);
 	glEnable(GL_DEPTH_TEST);
 }
 
-void Driver::drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts) {
+void DriverGL::drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts) {
 	glNormal3fv(face->_normal._coords);
 	glBegin(GL_POLYGON);
 	for (int i = 0; i < face->_numVertices; i++) {
@@ -112,7 +108,7 @@
 	glEnd();
 }
 
-void Driver::drawHierachyNode(const Model::HierNode *node) {
+void DriverGL::drawHierachyNode(const Model::HierNode *node) {
 	if (node->_hierVisible) {
 		glMatrixMode(GL_MODELVIEW);
 		glPushMatrix();
@@ -141,13 +137,15 @@
 		node->_sibling->draw();
 }
 
-void Driver::createBitmap(Bitmap *bitmap) {
+void DriverGL::createBitmap(Bitmap *bitmap) {
+	GLuint *textures;
 	if (bitmap->_format == 1) {
 		bitmap->_hasTransparency = false;
 		bitmap->_numTex = ((bitmap->_width + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE) *
 			((bitmap->_height + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE);
 		bitmap->_texIds = new GLuint[bitmap->_numTex * bitmap->_numImages];
-		glGenTextures(bitmap->_numTex * bitmap->_numImages, bitmap->_texIds);
+		textures = (GLuint *)bitmap->_texIds;
+		glGenTextures(bitmap->_numTex * bitmap->_numImages, textures);
 
 		byte *texData = new byte[4 * bitmap->_width * bitmap->_height];
 
@@ -172,7 +170,8 @@
 			}
 
 			for (int i = 0; i < bitmap->_numTex; i++) {
-				glBindTexture(GL_TEXTURE_2D, bitmap->_texIds[bitmap->_numTex * pic + i]);
+				textures = (GLuint *)bitmap->_texIds;
+				glBindTexture(GL_TEXTURE_2D, textures[bitmap->_numTex * pic + i]);
 				glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 				glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 				glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
@@ -189,7 +188,8 @@
 				for (int x = 0; x < bitmap->_width; x += BITMAP_TEXTURE_SIZE) {
 					int width  = (x + BITMAP_TEXTURE_SIZE >= bitmap->_width)  ? (bitmap->_width  - x) : BITMAP_TEXTURE_SIZE;
 					int height = (y + BITMAP_TEXTURE_SIZE >= bitmap->_height) ? (bitmap->_height - y) : BITMAP_TEXTURE_SIZE;
-					glBindTexture(GL_TEXTURE_2D, bitmap->_texIds[cur_tex_idx]);
+					textures = (GLuint *)bitmap->_texIds;
+					glBindTexture(GL_TEXTURE_2D, textures[cur_tex_idx]);
 					glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE,
 						texData + (y * 4 * bitmap->_width) + (4 * x));
 					cur_tex_idx++;
@@ -223,7 +223,8 @@
 	}
 }
 
-void Driver::drawBitmap(const Bitmap *bitmap) {
+void DriverGL::drawBitmap(const Bitmap *bitmap) {
+	GLuint *textures;
 	glMatrixMode(GL_PROJECTION);
 	glLoadIdentity();
 	glOrtho(0, 640, 480, 0, 0, 1);
@@ -248,7 +249,8 @@
 		int cur_tex_idx = bitmap->_numTex * (bitmap->_currImage - 1);
 		for (int y = bitmap->_y; y < (bitmap->_y + bitmap->_height); y += BITMAP_TEXTURE_SIZE) {
 			for (int x = bitmap->_x; x < (bitmap->_x + bitmap->_width); x += BITMAP_TEXTURE_SIZE) {
-				glBindTexture(GL_TEXTURE_2D, bitmap->_texIds[cur_tex_idx]);
+				textures = (GLuint *)bitmap->_texIds;
+				glBindTexture(GL_TEXTURE_2D, textures[cur_tex_idx]);
 				glBegin(GL_QUADS);
 				glTexCoord2f(0.0, 0.0);
 				glVertex2i(x, y);
@@ -271,20 +273,24 @@
 	} else if (bitmap->_format == 5) {	// ZBuffer image
 		// Only draw the manual zbuffer when enabled
 		if (ZBUFFER_GLOBAL)
-			g_driver->drawDepthBitmap(bitmap->_x, bitmap->_y, bitmap->_width, bitmap->_height, bitmap->_data[bitmap->_currImage - 1]);
+			drawDepthBitmap(bitmap->_x, bitmap->_y, bitmap->_width, bitmap->_height, bitmap->_data[bitmap->_currImage - 1]);
 	}
+	glEnable(GL_LIGHTING);
 }
 
-void Driver::destroyBitmap(Bitmap *bitmap) {
-	if (bitmap->_texIds) {
-		glDeleteTextures(bitmap->_numTex * bitmap->_numImages, bitmap->_texIds);
+void DriverGL::destroyBitmap(Bitmap *bitmap) {
+	GLuint *textures;
+	textures = (GLuint *)bitmap->_texIds;
+	if (textures) {
+		glDeleteTextures(bitmap->_numTex * bitmap->_numImages, textures);
 		delete[] bitmap->_texIds;
 	}
 }
 
-void Driver::createMaterial(Material *material, const char *data, const CMap *cmap) {
+void DriverGL::createMaterial(Material *material, const char *data, const CMap *cmap) {
 	material->_textures = new GLuint[material->_numImages];
-	glGenTextures(material->_numImages, material->_textures);
+	GLuint *textures;
+	glGenTextures(material->_numImages, (GLuint *)material->_textures);
 	char *texdata = new char[material->_width * material->_height * 4];
 	for (int i = 0; i < material->_numImages; i++) {
 		char *texdatapos = texdata;
@@ -301,7 +307,8 @@
 				data++;
 			}
 		}
-		glBindTexture(GL_TEXTURE_2D, material->_textures[i]);
+		textures = (GLuint *)material->_textures;
+		glBindTexture(GL_TEXTURE_2D, textures[i]);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -313,19 +320,23 @@
 	delete[] texdata;
 }
 
-void Driver::selectMaterial(const Material *material) {
-	glBindTexture(GL_TEXTURE_2D, material->_textures[material->_currImage]);
+void DriverGL::selectMaterial(const Material *material) {
+	GLuint *textures;
+	textures = (GLuint *)material->_textures;
+	glBindTexture(GL_TEXTURE_2D, textures[material->_currImage]);
 	glMatrixMode(GL_TEXTURE);
 	glLoadIdentity();
 	glScalef(1.0f / material->_width, 1.0f / material->_height, 1);
 }
 
-void Driver::destroyMaterial(Material *material) {
-	glDeleteTextures(material->_numImages, material->_textures);
-	delete[] material->_textures;
+void DriverGL::destroyMaterial(Material *material) {
+	GLuint *textures;
+	textures = (GLuint *)material->_textures;
+	glDeleteTextures(material->_numImages, textures);
+	delete[] textures;
 }
 
-void Driver::drawDepthBitmap(int x, int y, int w, int h, char *data) {
+void DriverGL::drawDepthBitmap(int x, int y, int w, int h, char *data) {
 	//	if (num != 0) {
 	//		warning("Animation not handled yet in GL texture path !\n");
 	//	}
@@ -361,7 +372,7 @@
 	glDepthFunc(GL_LESS);
 }
 
-void Driver::prepareSmushFrame(int width, int height, byte *bitmap) {
+void DriverGL::prepareSmushFrame(int width, int height, byte *bitmap) {
 	// remove if already exist
 	if (_smushNumTex > 0) {
 		glDeleteTextures(_smushNumTex, _smushTexIds);
@@ -402,7 +413,7 @@
 	_smushHeight = height;
 }
 
-void Driver::drawSmushFrame(int offsetX, int offsetY) {
+void DriverGL::drawSmushFrame(int offsetX, int offsetY) {
 	// prepare view
 	glMatrixMode(GL_PROJECTION);
 	glLoadIdentity();
@@ -448,10 +459,10 @@
 	glDisable(GL_TEXTURE_2D);
 	glDepthMask(GL_TRUE);
 	glEnable(GL_DEPTH_TEST);
+	glEnable(GL_LIGHTING);
 }
 
-// Load emergency font
-void Driver::loadEmergFont() {
+void DriverGL::loadEmergFont() {
 	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
 
 	_emergFont = glGenLists(128);
@@ -462,8 +473,7 @@
 	}
 }
 
-// Draw text string using emergency font
-void Driver::drawEmergString(int x, int y, const char *text, const Color &fgColor) {
+void DriverGL::drawEmergString(int x, int y, const char *text, const Color &fgColor) {
 	glMatrixMode(GL_PROJECTION);
 	glPushMatrix();
 	glLoadIdentity();
@@ -472,6 +482,7 @@
 	glMatrixMode(GL_MODELVIEW);
 	glLoadIdentity();
 	glDisable(GL_DEPTH_TEST);
+	glDisable(GL_LIGHTING);
 
 	glColor3f(fgColor.red(), fgColor.green(), fgColor.blue());
 	glRasterPos2i(x, y);
@@ -480,6 +491,8 @@
 	//glCallLists(strlen(strrchr(text, '/')) - 1, GL_UNSIGNED_BYTE, strrchr(text, '/') + 1);
 	glCallLists(strlen(text), GL_UNSIGNED_BYTE, (GLubyte *) text);
 
+	glEnable(GL_LIGHTING);
+
 	glMatrixMode(GL_PROJECTION);
 	glPopMatrix();
 }

Index: driver_gl.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- driver_gl.h	11 Jan 2005 19:46:47 -0000	1.14
+++ driver_gl.h	12 Jan 2005 18:06:43 -0000	1.15
@@ -15,21 +15,25 @@
 //  License along with this library; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
+#ifndef DRIVER_GL_H
+#define DRIVER_GL_H
+
 #include "bits.h"
 #include "vector3d.h"
 #include "color.h"
 #include "model.h"
 #include "colormap.h"
 #include "bitmap.h"
+#include "driver.h"
 
 #include <SDL.h>
 #include <SDL_opengl.h>
 
 #define BITMAP_TEXTURE_SIZE 256
 
-class Driver {
+class DriverGL : public Driver {
 public:
-	Driver(int screenW, int screenH, int screenBPP);
+	DriverGL(int screenW, int screenH, int screenBPP);
 
 	void setupCamera(float fov, float nclip, float fclip, float roll);
 	void positionCamera(Vector3d pos, Vector3d interest);
@@ -43,7 +47,7 @@
 	void set3DMode();
 
 	void drawHierachyNode(const Model::HierNode *node);
- 	void drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts);
+	void drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts);
 
 	void createMaterial(Material *material, const char *data, const CMap *cmap);
 	void selectMaterial(const Material *material);
@@ -70,4 +74,4 @@
 	int _smushHeight;
 };
 
-extern Driver *g_driver;
+#endif

Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- engine.cpp	12 Jan 2005 13:48:28 -0000	1.61
+++ engine.cpp	12 Jan 2005 18:06:43 -0000	1.62
@@ -23,7 +23,7 @@
 #include "actor.h"
 #include "textobject.h"
 #include "smush.h"
-#include "driver_gl.h"
+#include "driver.h"
 
 #include "imuse/imuse.h"
 

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/main.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- main.cpp	10 Jan 2005 09:07:46 -0000	1.45
+++ main.cpp	12 Jan 2005 18:06:43 -0000	1.46
@@ -26,6 +26,7 @@
 #include "timer.h"
 #include "smush.h"
 #include "driver_gl.h"
+#include "driver_tinygl.h"
 
 #include "mixer/mixer.h"
 
@@ -35,7 +36,7 @@
 #include <SDL_video.h>
 
 // Hacky global toggles for experimental/debug code
-bool ZBUFFER_GLOBAL, SHOWFPS_GLOBAL;
+bool ZBUFFER_GLOBAL, SHOWFPS_GLOBAL, TINYGL_GLOBAL;
 
 #ifdef __MINGW32__
 int PASCAL WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/,  LPSTR /*lpCmdLine*/, int /*iShowCmd*/) {
@@ -45,6 +46,8 @@
 
 static bool g_lua_initialized = false;
 
+Driver *g_driver = NULL;
+
 static bool parseBoolStr(const char *val) {
 	if (val == NULL || val[0] == 0)
 		return false;
@@ -93,12 +96,16 @@
 	g_mixer->setVolume(255);
 	g_timer = new Timer();
 	g_smush = new Smush();
-	g_driver = new Driver(640, 480, 24);
+	if (TINYGL_GLOBAL)
+		g_driver = new DriverTinyGL(640, 480, 16);
+	else
+		g_driver = new DriverGL(640, 480, 24);
 	g_imuse = new Imuse(20);
 
 	// Parse command line
 	ZBUFFER_GLOBAL = parseBoolStr(g_registry->get("zbuffer"));
 	SHOWFPS_GLOBAL = parseBoolStr(g_registry->get("fps"));
+	TINYGL_GLOBAL = parseBoolStr(g_registry->get("soft"));
 	for (i = 1; i < argc; i++) {
 		if (strcmp(argv[i], "-zbuffer") == 0)
 			ZBUFFER_GLOBAL = true;
@@ -108,12 +115,17 @@
 			SHOWFPS_GLOBAL = true;
 		else if (strcmp(argv[i], "-nofps") == 0)
 			SHOWFPS_GLOBAL = false;
+		else if (strcmp(argv[i], "-soft") == 0)
+			TINYGL_GLOBAL = true;
+		else if (strcmp(argv[i], "-nosoft") == 0)
+			TINYGL_GLOBAL = false;
 		else {
 			printf("Residual CVS Version\n");
 			printf("--------------------\n");
 			printf("Recognised options:\n");
 			printf("\t-[no]zbuffer\t\tEnable/disable ZBuffers (Very slow on older cards)\n");
 			printf("\t-[no]fps\t\tEnable/disable fps display in upper right corner\n");
+			printf("\t-[no]soft\t\tEnable/disable software renderer\n");
 			exit(-1);
 		}
 	}

Index: material.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/material.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- material.cpp	1 Jan 2005 12:27:56 -0000	1.12
+++ material.cpp	12 Jan 2005 18:06:43 -0000	1.13
@@ -20,7 +20,7 @@
 #include "debug.h"
 #include "material.h"
 #include "colormap.h"
-#include "driver_gl.h"
+#include "driver.h"
 
 Material::Material(const char *filename, const char *data, int len, const CMap &cmap) :
 		Resource(filename) {

Index: material.h
===================================================================
RCS file: /cvsroot/scummvm/residual/material.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- material.h	1 Jan 2005 12:27:56 -0000	1.8
+++ material.h	12 Jan 2005 18:06:43 -0000	1.9
@@ -22,7 +22,7 @@
 
 #include <cstring>
 #include <SDL.h>
-#include <SDL_opengl.h>
+#include "tinygl/gl.h"
 
 class CMap;
 
@@ -45,7 +45,7 @@
 //private:
 	int _numImages, _currImage;
 	int _width, _height;
-	GLuint *_textures;
+	void *_textures;
 };
 
 #endif

Index: model.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/model.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- model.cpp	11 Jan 2005 19:46:47 -0000	1.24
+++ model.cpp	12 Jan 2005 18:06:43 -0000	1.25
@@ -22,7 +22,7 @@
 #include "resource.h"
 #include "material.h"
 #include "textsplit.h"
-#include "driver_gl.h"
+#include "driver.h"
 
 #include <cstring>
 #include <SDL.h>

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- scene.cpp	10 Jan 2005 09:53:02 -0000	1.36
+++ scene.cpp	12 Jan 2005 18:06:43 -0000	1.37
@@ -23,11 +23,12 @@
 #include "bitmap.h"
 #include "colormap.h"
 #include "vector3d.h"
-#include "driver_gl.h"
+#include "driver.h"
 
 #include "imuse/imuse.h"
 
 #include <SDL.h>
+#include "tinygl/gl.h"
 #include <cmath>
 
 Scene::Scene(const char *name, const char *buf, int len) :
@@ -164,6 +165,60 @@
 	g_driver->positionCamera(_pos, _interest);
 }
 
+void Scene::setupLights() {
+/*	glMatrixMode(GL_MODELVIEW);
+	if (!_enableLights) {
+		glDisable(GL_LIGHTING);
+		return;
+	}
+
+	glEnable(GL_LIGHTING);
+
+	for (int i = 0; i < _numLights; i++) {
+		assert(i < GL_MAX_LIGHTS);
+		Light *light = &_lights[i];
+		GLfloat ambientLight[] = { 0.0f, 0.0f, 0.0f, 1.0f };
+		GLfloat diffuseLight[] = { 0.0f, 0.0f, 0.0f, 0.0f };
+		GLfloat specularLight[] = { 0.0f, 0.0f, 0.0f, 1.0f };
+		GLfloat lightPos[4];
+		GLfloat lightDir[4];
+		lightPos[0] = light->_pos._coords[0];
+		lightPos[1] = light->_pos._coords[1];
+		lightPos[2] = light->_pos._coords[2];
+		lightPos[3] = 1.0f;
+		diffuseLight[0] = light->_color.red / 256.0f;
+		diffuseLight[1] = light->_color.blue / 256.0f;
+		diffuseLight[2] = light->_color.green / 256.0f;
+		diffuseLight[3] = 1.0f;
+
+		if (strcmp(light->_type.c_str(), "omni") == 0) {
+//			glLightfv(GL_LIGHT0 + i, GL_AMBIENT, ambientLight);
+			glLightfv(GL_LIGHT0 + i, GL_DIFFUSE, diffuseLight);
+			glLightfv(GL_LIGHT0 + i, GL_SPECULAR, specularLight);
+			glLightfv(GL_LIGHT0 + i, GL_POSITION, lightPos);
+			glEnable(GL_LIGHT0 + i);
+		} else if (strcmp(light->_type.c_str(), "direct") == 0) {
+			lightDir[0] = light->_dir._coords[0];
+			lightDir[1] = light->_dir._coords[1];
+			lightDir[2] = light->_dir._coords[2];
+			lightDir[3] = 1.0f;
+//			glLightfv(GL_LIGHT0 + i, GL_AMBIENT, ambientLight);
+			glLightfv(GL_LIGHT0 + i, GL_DIFFUSE, diffuseLight);
+			glLightfv(GL_LIGHT0 + i, GL_SPECULAR, specularLight);
+			glLightfv(GL_LIGHT0 + i, GL_POSITION, lightPos);
+			glLightfv(GL_LIGHT0 + i, GL_SPOT_DIRECTION, lightDir);
+			glEnable(GL_LIGHT0 + i);
+		} else {
+			error("Scene::setupLights() Unknown type of light: %s", light->_type);
+		}
+	}
+	glEnable(GL_COLOR_MATERIAL);
+
+	GLfloat materialLight[] = { 1.0f, 1.0f, 1.0f, 1.0f };
+	glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialLight);
+*/
+}
+
 void Scene::setSetup(int num) {
 	_currSetup = _setups + num;
 }

Index: scene.h
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- scene.h	10 Jan 2005 09:07:46 -0000	1.23
+++ scene.h	12 Jan 2005 18:06:43 -0000	1.24
@@ -26,7 +26,7 @@
 #include "objectstate.h"
 
 #include <SDL.h>
-#include <SDL_opengl.h>
+#include "tinygl/gl.h"
 #include <string>
 
 class CMap;
@@ -57,12 +57,18 @@
 		_currSetup->setupCamera();
 	}
 
+	void setupLights();
+
 	void setSoundPosition(const char *soundName, Vector3d pos);
 	void setSoundParameters(int minVolume, int maxVolume);
 	void getSoundParameters(int *minVolume, int *maxVolume);
 
 	const char *name() const { return _name.c_str(); }
 
+	void setLightEnableState(bool state) {
+		_enableLights = state;
+	}
+
 	void setSetup(int num);
 	int setup() const { return _currSetup - _setups; }
 
@@ -105,6 +111,7 @@
 	int _numCmaps;
 	ResPtr<CMap> *_cmaps;
 	int _numSetups, _numLights, _numSectors;
+	bool _enableLights;
 	Sector *_sectors;
 	Light *_lights;
 	Setup *_setups;

Index: smush.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/smush.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- smush.cpp	1 Jan 2005 12:27:56 -0000	1.58
+++ smush.cpp	12 Jan 2005 18:06:43 -0000	1.59
@@ -22,7 +22,7 @@
 #include "timer.h"
 #include "resource.h"
 #include "engine.h"
-#include "driver_gl.h"
+#include "driver.h"
 
 #include "mixer/mixer.h"
 

Index: textobject.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/textobject.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- textobject.cpp	2 Jan 2005 13:34:50 -0000	1.15
+++ textobject.cpp	12 Jan 2005 18:06:43 -0000	1.16
@@ -19,7 +19,7 @@
 #include "textobject.h"
 #include "engine.h"
 #include "localize.h"
-#include "driver_gl.h"
+#include "driver.h"
 
 TextObject::TextObject(const char *text, const int x, const int y, const Color& fgColor) :
 		_fgColor(fgColor), _x(x), _y(y) {

Index: textobject.h
===================================================================
RCS file: /cvsroot/scummvm/residual/textobject.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- textobject.h	1 Jan 2005 12:27:56 -0000	1.6
+++ textobject.h	12 Jan 2005 18:06:43 -0000	1.7
@@ -23,7 +23,8 @@
 
 #include <string>
 #include <SDL.h>
-#include <SDL_opengl.h>
+
+#include "tinygl/gl.h"
 
 class TextObject {
 public:

Index: walkplane.h
===================================================================
RCS file: /cvsroot/scummvm/residual/walkplane.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- walkplane.h	1 Jan 2005 12:27:56 -0000	1.11
+++ walkplane.h	12 Jan 2005 18:06:43 -0000	1.12
@@ -23,7 +23,8 @@
 
 #include <string>
 #include <SDL.h>
-#include <SDL_opengl.h>
+
+#include "tinygl/gl.h"
 
 class TextSplitter;
 





More information about the Scummvm-git-logs mailing list