[Scummvm-cvs-logs] CVS: residual Makefile.common,1.12,1.13 README,1.18,1.19 TODO,1.41,1.42 debug.h,1.8,1.9 driver_gl.cpp,1.23,1.24 driver_gl.h,1.12,1.13 engine.cpp,1.56,1.57 keyframe.cpp,1.9,1.10 main.cpp,1.44,1.45 model.cpp,1.22,1.23 scene.cpp,1.34,1.35 scene.h,1.22,1.23 screen.cpp,1.19,1.20

Pawel Kolodziejski aquadran at users.sourceforge.net
Mon Jan 10 01:09:02 CET 2005


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

Modified Files:
	Makefile.common README TODO debug.h driver_gl.cpp driver_gl.h 
	engine.cpp keyframe.cpp main.cpp model.cpp scene.cpp scene.h 
	screen.cpp 
Log Message:
droped screenblocks, it's a bit too slow(on windows 7500 ati i can't even wrote to zbuffer), it doesn't detect many areas, if even would it will increase rects a lot and speed slow down much. ... and adopting half screen overlays kill solution completly


Index: Makefile.common
===================================================================
RCS file: /cvsroot/scummvm/residual/Makefile.common,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- Makefile.common	31 Dec 2004 02:54:56 -0000	1.12
+++ Makefile.common	10 Jan 2005 09:07:45 -0000	1.13
@@ -54,7 +54,6 @@
 	registry.o \
 	resource.o \
 	scene.o \
-	screen.o \
 	smush.o \
 	textobject.o \
 	textsplit.o \

Index: README
===================================================================
RCS file: /cvsroot/scummvm/residual/README,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- README	11 Sep 2004 14:09:42 -0000	1.18
+++ README	10 Jan 2005 09:07:45 -0000	1.19
@@ -38,9 +38,7 @@
        DataDir=.
        good_times=TRUE
 
-Residual understands two command-line options: '-zbuffer' which enables masking
-and '-screenblocks' which is a (currently broken) attempt to speed up masking
-on older cards.
+Residual understands two command-line options: '-zbuffer' which enables masking.
 
 It runs really slow when using -zbuffer!
 ----------------------------------------

Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/residual/TODO,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- TODO	30 Dec 2004 08:22:01 -0000	1.41
+++ TODO	10 Jan 2005 09:07:46 -0000	1.42
@@ -14,7 +14,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)
- * Fix the screenblocks zBuffer code
  * Abstract rendering code and implement software renderer (partianly done)
  * Fix drawEmergString() to work with Mesa
  * Make SMUSH work on Linux/PPC (whats wrong with it, exactly? - ender :)

Index: debug.h
===================================================================
RCS file: /cvsroot/scummvm/residual/debug.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- debug.h	1 Jan 2005 12:27:55 -0000	1.8
+++ debug.h	10 Jan 2005 09:07:46 -0000	1.9
@@ -21,7 +21,7 @@
 #define DEBUG_H
 
 // Hacky toggles for experimental / debug code (defined/set in main.cpp)
-extern bool ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL, SHOWFPS_GLOBAL;
+extern bool ZBUFFER_GLOBAL, SHOWFPS_GLOBAL;
 
 void warning(const char *fmt, ...);
 void error(const char *fmt, ...);

Index: driver_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- driver_gl.cpp	5 Jan 2005 22:13:56 -0000	1.23
+++ driver_gl.cpp	10 Jan 2005 09:07:46 -0000	1.24
@@ -16,7 +16,6 @@
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
 #include "debug.h"
-#include "screen.h"
 #include "colormap.h"
 #include "material.h"
 #include "driver_gl.h"
@@ -68,10 +67,7 @@
 	if (pos.x() == interest.x() && pos.y() == interest.y())
 		up_vec = Vector3d(0, 1, 0);
 
-	gluLookAt(pos.x(), pos.y(), pos.z(), 
-		interest.x(), interest.y(), interest.z(),
-		up_vec.x(), up_vec.y(), up_vec.z());
-
+	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() {
@@ -103,50 +99,56 @@
 	glEnable(GL_DEPTH_TEST);
 }
 
-void Driver::drawModel(const Model::Mesh *model) {
+void Driver::drawModelNodeDebug(const Model::Mesh *model) {
+	// debug
+	// this draw the model node in red
+
 	GLdouble modelView[500];
 	GLdouble projection[500];
 	GLint viewPort[500];
-	int i, j;
 
 	glGetDoublev(GL_MODELVIEW_MATRIX, modelView);
 	glGetDoublev(GL_PROJECTION_MATRIX, projection);
 	glGetIntegerv(GL_VIEWPORT, viewPort);
 
-	// Yaz: debug
-	// this draw the model node in red
-/*
 	glPushMatrix();
 	glLoadIdentity();
 
-	glGetDoublev(GL_MODELVIEW_MATRIX, modelView);
-	glGetDoublev(GL_PROJECTION_MATRIX, projection);
-	glGetIntegerv(GL_VIEWPORT, viewPort);
-
 	glDisable(GL_DEPTH_TEST);
 	glPointSize(3.f);
 	glColor4f(1.f, 0.f, 0.f, 1.f);
-	glDisable(GL_TEXTURE_2D );
+	glDisable(GL_TEXTURE_2D);
+
 	glBegin(GL_POINTS);
 	glVertex3f(model->_matrix._pos.x(), model->_matrix._pos.y(), model->_matrix._pos.z());
 	glEnd();
+
 	glEnable(GL_DEPTH_TEST);
 	glPopMatrix();
 	glEnable(GL_TEXTURE_2D);
-*/
-	// Yaz: debug
+}
+
+void Driver::drawModelPolygonPointsDebug(const Model::Mesh *model) {
+	// debug
 	// this draw the poly points
-/*
+
+	GLdouble modelView[500];
+	GLdouble projection[500];
+	GLint viewPort[500];
+	int i, j;
+
+	glGetDoublev(GL_MODELVIEW_MATRIX, modelView);
+	glGetDoublev(GL_PROJECTION_MATRIX, projection);
+	glGetIntegerv(GL_VIEWPORT, viewPort);
+
 	glPushMatrix();
 	glLoadIdentity();
+
+	glDisable(GL_DEPTH_TEST);
 	glPointSize(3.f);
 	glColor4f(0.f, 1.f, 0.f, 1.f);
 	glDisable(GL_TEXTURE_2D);
 
-	glGetDoublev(GL_MODELVIEW_MATRIX, modelView);
-	glGetDoublev(GL_PROJECTION_MATRIX, projection);
-	glGetIntegerv(GL_VIEWPORT, viewPort);
-
 	glBegin(GL_POINTS);
 
 	for (i = 0; i < model->_numFaces; i++) {
@@ -159,7 +161,7 @@
 
 			v.set(*(pVertices), *(pVertices + 1), *(pVertices + 2));
 
-			tempMatrix._rot.transform(&v);
+//			tempMatrix._rot.transform(&v);
 			v += tempMatrix._pos;
 
 			glVertex3f(v.x(), v.y(), v.z());
@@ -169,170 +171,7 @@
 	glEnd();
 	glEnable(GL_DEPTH_TEST);
 	glPopMatrix();
-	glEnable(GL_TEXTURE_2D );
-*/
-
-	// Ender: HACK HACK HACK
-	// Mannys head isn't computed correctly, so bail out to prevent memory corruption.
-	// at least until it IS computed, or the DirtyScreen code has bounds checking :)
-	//if (strstr(_name, "m_head_1"))
-	//	return;
-
-	// Yaz: debug
-	// this compute the dirty rect for the mesh
-	glPushMatrix();
-	glLoadIdentity();
-
-	GLdouble top = 1000;
-	GLdouble right = -1000;
-	GLdouble left = 1000;
-	GLdouble bottom = -1000;
-
-	for (i = 0; i < model->_numFaces; i++) {
-		Vector3d v;
-		Matrix4 tempMatrix = model->_matrix;
-		float* pVertices;
-		float bestDepth = 0;
-
-		for (j = 0; j < model->_faces[i]._numVertices; j++) {
-			GLdouble modelView[500];
-			GLdouble projection[500];
-			GLint viewPort[500];
-
-			glGetDoublev(GL_MODELVIEW_MATRIX, modelView);
-			glGetDoublev(GL_PROJECTION_MATRIX, projection);
-			glGetIntegerv(GL_VIEWPORT, viewPort);
-
-			pVertices = model->_vertices + 3 * model->_faces[i]._vertices[j];
-
-			v.set(*(pVertices), *(pVertices + 1), *(pVertices + 2));
-
-			tempMatrix._rot.transform(&v);
-			v += tempMatrix._pos;
-
-			GLdouble winX;
-			GLdouble winY;
-			GLdouble winZ;
-
-			gluProject(v.x(), v.y(), v.z(), modelView, projection, viewPort, &winX, &winY, &winZ);
-
-			if (winX > right)
-				right = winX;
-			if (winX < left)
-				left = winX;
-			if (winY < top)
-				top = winY;
-			if (winY > bottom)
-				bottom = winY;
-
-			if (winZ > bestDepth )
-				bestDepth = winZ;
-		}
-
-		if (SCREENBLOCKS_GLOBAL)
-			screenBlocksAddRectangle((int)top, (int)right, (int)left, (int)bottom, (int)bestDepth);
-	}
-
-/*
-	glDisable(GL_DEPTH_TEST);
-	glPointSize(3.f);
-	glColor4f(1.f, 1.f, 0.f, 1.f);
-	glDisable(GL_TEXTURE_2D);
-
-	glBegin(GL_LINES);
-
-	GLdouble objx;
-	GLdouble objy;
-	GLdouble objz;
-
-	// top
-	gluUnProject(left, top, 1.f, modelView, projection, viewPort, &objx, &objy, &objz);
-	glVertex3f(objx, objy, objz);
-	gluUnProject(right, top, 1.f, modelView, projection, viewPort, &objx, &objy, &objz);
-	glVertex3f(objx, objy, objz);
-
-	// bottom
-	gluUnProject(left, bottom, 1.f, modelView, projection, viewPort, &objx, &objy, &objz);
-	glVertex3f(objx, objy, objz);
-	gluUnProject(right, bottom, 1.f, modelView, projection, viewPort, &objx, &objy, &objz);
-	glVertex3f(objx, objy, objz);
-
-	// left
-	gluUnProject(left, top, 1.f, modelView, projection, viewPort, &objx, &objy, &objz);
-	glVertex3f(objx, objy, objz);
-	gluUnProject(left, bottom, 1.f, modelView, projection, viewPort, &objx, &objy, &objz);
-	glVertex3f(objx, objy, objz);
-
-	// right
-	gluUnProject(right, top, 1.f, modelView, projection, viewPort, &objx, &objy, &objz);
-	glVertex3f(objx, objy, objz);
-	gluUnProject(right, bottom, 1.f, modelView, projection, viewPort, &objx, &objy, &objz);
-	glVertex3f(objx, objy, objz);
-
-	glEnd(); 
-	glEnable(GL_DEPTH_TEST);
-	glEnable(GL_TEXTURE_2D); 
-*/
-
-	glPopMatrix();
-}
-
-void Driver::updateMesh(const Model::Mesh *mesh) {
-	GLdouble modelView[500];
-	GLdouble projection[500];
-	GLint viewPort[500];
-
-	glGetDoublev(GL_MODELVIEW_MATRIX, modelView);
-	glGetDoublev(GL_PROJECTION_MATRIX, projection);
-	glGetIntegerv(GL_VIEWPORT, viewPort);
-
-	GLdouble top = 1000;
-	GLdouble right = -1000;
-	GLdouble left = 1000;
-	GLdouble bottom = -1000;
-
-	for (int i = 0; i < mesh->_numFaces; i++) {
-		Vector3d v;
-		Matrix4 tempMatrix = mesh->_matrix;
-		float *pVertices;
-		int j;
-		float bestDepth = 0;
-
-		for (j = 0; j < mesh->_faces[i]._numVertices; j++) {
-			pVertices = mesh->_vertices + 3 * mesh->_faces[i]._vertices[j];
-
-			v.set(*(pVertices), *(pVertices + 1), *(pVertices + 2));
-
-			tempMatrix._rot.transform(&v);
-			v += tempMatrix._pos;
-
-			GLdouble winX;
-			GLdouble winY;
-			GLdouble winZ;
-
-			gluProject(v.x(), v.y(), v.z(), modelView, projection, viewPort, &winX, &winY, &winZ);
-
-			if(winX > right)
-				right = winX;
-			if(winX < left)
-				left = winX;
-			if(winY < top)
-				top = winY;
-			if(winY > bottom)
-				bottom = winY;
-
-			if(winZ > bestDepth)
-				bestDepth = winZ;
-		}
-
-//		if (SCREENBLOCKS_GLOBAL)
-//			screenBlocksAddRectangle(top, right, left, bottom, bestDepth);
-	}
-
-	glDisable(GL_DEPTH_TEST);
-	glPointSize(3.f);
-	glColor4f(1.f, 1.f, 0.f, 1.f);
-	glDisable(GL_TEXTURE_2D);
+	glEnable(GL_TEXTURE_2D);
 }
 
 void Driver::drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts) {
@@ -375,7 +214,7 @@
 		node->_sibling->draw();
 }
 
-void Driver::updateHierachyNode(const Model::HierNode *node) {
+void Driver::updateHierachyNode1(const Model::HierNode *node) {
 	glMatrixMode(GL_MODELVIEW);
 	glPushMatrix();
 
@@ -383,7 +222,9 @@
 	glRotatef(node->_animYaw / node->_totalWeight, 0, 0, 1);
 	glRotatef(node->_animPitch / node->_totalWeight, 1, 0, 0);
 	glRotatef(node->_animRoll / node->_totalWeight, 0, 1, 0);
+}
 
+void Driver::updateHierachyNode2(const Model::HierNode *node) {
 	if (node->_mesh != NULL) {
 		glPushMatrix();
 		glTranslatef(node->_pivot.x(), node->_pivot.y(), node->_pivot.z());
@@ -531,11 +372,9 @@
 		glDepthMask(GL_TRUE);
 		glEnable(GL_DEPTH_TEST);
 	} else if (bitmap->_format == 5) {	// ZBuffer image
-		// Only draw the manual zbuffer when we are not using screenblocks, and when enabled
-		if ((!ZBUFFER_GLOBAL) || SCREENBLOCKS_GLOBAL)
-			return;
-
-		g_driver->drawDepthBitmap(bitmap->_x, bitmap->_y, bitmap->_width, bitmap->_height, bitmap->_data[bitmap->_currImage - 1]);
+		// 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]);
 	}
 }
 
@@ -744,6 +583,6 @@
 	//glCallLists(strlen(strrchr(text, '/')) - 1, GL_UNSIGNED_BYTE, strrchr(text, '/') + 1);
 	glCallLists(strlen(text), GL_UNSIGNED_BYTE, (GLubyte *) text);
 
-	glMatrixMode( GL_PROJECTION );
+	glMatrixMode(GL_PROJECTION);
 	glPopMatrix();
 }

Index: driver_gl.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- driver_gl.h	1 Jan 2005 12:27:55 -0000	1.12
+++ driver_gl.h	10 Jan 2005 09:07:46 -0000	1.13
@@ -44,11 +44,11 @@
 
 	void drawHierachyNode(const Model::HierNode *node);
 	void drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts);
-	void drawModel(const Model::Mesh *model);
-
-	void updateMesh(const Model::Mesh *mesh);
-	void updateHierachyNode(const Model::HierNode *node);
+	void drawModelNodeDebug(const Model::Mesh *model);
+	void drawModelPolygonPointsDebug(const Model::Mesh *model);
 
+	void updateHierachyNode1(const Model::HierNode *node);
+	void updateHierachyNode2(const Model::HierNode *node);
 
 	void createMaterial(Material *material, const char *data, const CMap *cmap);
 	void selectMaterial(const Material *material);

Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- engine.cpp	5 Jan 2005 22:13:56 -0000	1.56
+++ engine.cpp	10 Jan 2005 09:07:46 -0000	1.57
@@ -22,7 +22,6 @@
 #include "colormap.h"
 #include "actor.h"
 #include "textobject.h"
-#include "screen.h"
 #include "smush.h"
 #include "driver_gl.h"
 
@@ -125,22 +124,20 @@
 				}
 			}
 		} else if (_mode == ENGINE_MODE_NORMAL) {
-			if (_currScene != NULL) {
-				// Update actor costumes
-				for (ActorListType::iterator i = _actors.begin(); i != _actors.end(); i++) {
-					Actor *a = *i;
-					if (_currScene != NULL && a->inSet(_currScene->name()) && a->visible())
-						a->update();
-				}
-			}
+			g_driver->clearScreen();
 
-			if (SCREENBLOCKS_GLOBAL)
-				screenBlocksReset();
+			g_driver->set3DMode();
 
-			g_driver->clearScreen();
+			if (_currScene != NULL) {
+				_currScene->setupCamera();
+			}
 
-			if (SCREENBLOCKS_GLOBAL)
-				screenBlocksBlitDirtyBlocks();
+			// Update actor costumes
+			for (ActorListType::iterator i = _actors.begin(); i != _actors.end(); i++) {
+				Actor *a = *i;
+				if (_currScene != NULL && a->inSet(_currScene->name()) && a->visible())
+					a->update();
+			}
 
 			if (_currScene != NULL) {
 				_currScene->drawBackground();
@@ -165,27 +162,23 @@
 			if (SHOWFPS_GLOBAL)
 				g_driver->drawEmergString(550, 25, fps, Color(255, 255, 255));
 
-			g_driver->set3DMode();
-
 			if (_currScene != NULL) {
 				_currScene->setupCamera();
-
-				// Draw actors
-				for (ActorListType::iterator i = _actors.begin(); i != _actors.end(); i++) {
-					Actor *a = *i;
-					if (_currScene != NULL && a->inSet(_currScene->name()) && a->visible())
-						a->draw();
-				}
-
-				if (SCREENBLOCKS_GLOBAL)
-					screenBlocksDrawDebug();
 			}
 
-			// Draw text
-			for (TextListType::iterator i = _textObjects.begin(); i != _textObjects.end(); i++) {
-				(*i)->draw();
+			g_driver->set3DMode();
+
+			// Draw actors
+			for (ActorListType::iterator i = _actors.begin(); i != _actors.end(); i++) {
+				Actor *a = *i;
+				if (_currScene != NULL && a->inSet(_currScene->name()) && a->visible())
+					a->draw();
 			}
+		}
 
+		// Draw text
+		for (TextListType::iterator i = _textObjects.begin(); i != _textObjects.end(); i++) {
+			(*i)->draw();
 		}
 
 		g_imuse->flushTracks();

Index: keyframe.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/keyframe.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- keyframe.cpp	1 Jan 2005 12:27:55 -0000	1.9
+++ keyframe.cpp	10 Jan 2005 09:07:46 -0000	1.10
@@ -158,8 +158,7 @@
 	delete[] _entries;
 }
 
-void KeyframeAnim::KeyframeNode::animate(Model::HierNode &node,
-	float frame, int priority) const {
+void KeyframeAnim::KeyframeNode::animate(Model::HierNode &node, float frame, int priority) const {
 	if (_numEntries == 0)
 		return;
 	if (priority < node._priority)

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/main.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- main.cpp	2 Jan 2005 17:14:01 -0000	1.44
+++ main.cpp	10 Jan 2005 09:07:46 -0000	1.45
@@ -35,7 +35,7 @@
 #include <SDL_video.h>
 
 // Hacky global toggles for experimental/debug code
-bool ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL, SHOWFPS_GLOBAL;
+bool ZBUFFER_GLOBAL, SHOWFPS_GLOBAL;
 
 #ifdef __MINGW32__
 int PASCAL WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/,  LPSTR /*lpCmdLine*/, int /*iShowCmd*/) {
@@ -98,17 +98,12 @@
 
 	// Parse command line
 	ZBUFFER_GLOBAL = parseBoolStr(g_registry->get("zbuffer"));
-	SCREENBLOCKS_GLOBAL = parseBoolStr(g_registry->get("screenblocks"));
 	SHOWFPS_GLOBAL = parseBoolStr(g_registry->get("fps"));
 	for (i = 1; i < argc; i++) {
 		if (strcmp(argv[i], "-zbuffer") == 0)
 			ZBUFFER_GLOBAL = true;
 		else if (strcmp(argv[i], "-nozbuffer") == 0)
 			ZBUFFER_GLOBAL = false;
-		else if (strcmp(argv[i], "-screenblocks") == 0)
-			SCREENBLOCKS_GLOBAL = true;
-		else if (strcmp(argv[i], "-noscreenblocks") == 0)
-			SCREENBLOCKS_GLOBAL = false;
 		else if (strcmp(argv[i], "-fps") == 0)
 			SHOWFPS_GLOBAL = true;
 		else if (strcmp(argv[i], "-nofps") == 0)
@@ -118,7 +113,6 @@
 			printf("--------------------\n");
 			printf("Recognised options:\n");
 			printf("\t-[no]zbuffer\t\tEnable/disable ZBuffers (Very slow on older cards)\n");
-			printf("\t-[no]screenblocks\t\tEnable/disable Screenblocks (Experimental zbuffer speedup on older cards - BROKEN!!\n");
 			printf("\t-[no]fps\t\tEnable/disable fps display in upper right corner\n");
 			exit(-1);
 		}

Index: model.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/model.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- model.cpp	1 Jan 2005 12:27:56 -0000	1.22
+++ model.cpp	10 Jan 2005 09:07:46 -0000	1.23
@@ -20,7 +20,6 @@
 #include "debug.h"
 #include "model.h"
 #include "resource.h"
-#include "screen.h"
 #include "material.h"
 #include "textsplit.h"
 #include "driver_gl.h"
@@ -126,7 +125,6 @@
 }
 
 void Model::Mesh::update() {
-	g_driver->updateMesh(this);
 }
 
 void Model::Face::loadBinary(const char *&data, ResPtr<Material> *materials) {
@@ -377,8 +375,7 @@
 		if (ts.eof())
 			error("Expected face data, got EOF\n");
 
-		if (std::sscanf(ts.currentLine(), " %d: %d %i %d %d %d %f %d%n",
-				&num, &material, &type, &geo, &light, &tex, &extralight, &verts, &readlen) < 8)
+		if (std::sscanf(ts.currentLine(), " %d: %d %i %d %d %d %f %d%n", &num, &material, &type, &geo, &light, &tex, &extralight, &verts, &readlen) < 8)
 			error("Expected face data, got `%s'\n", ts.currentLine());
 
 		_faces[num]._material = materials[material];
@@ -393,8 +390,7 @@
 		for (int j = 0; j < verts; j++) {
 			int readlen2;
 
-			if (std::sscanf(ts.currentLine() + readlen, " %d, %d%n",
-					_faces[num]._vertices + j, _faces[num]._texVertices + j, &readlen2) < 2)
+			if (std::sscanf(ts.currentLine() + readlen, " %d, %d%n", _faces[num]._vertices + j, _faces[num]._texVertices + j, &readlen2) < 2)
 				error("Could not read vertex indices in line `%s'\n",
 
 			ts.currentLine());
@@ -439,6 +435,8 @@
 }
 
 void Model::HierNode::update() {
+	g_driver->updateHierachyNode1(this);
+
 	_localMatrix._pos.set(_animPos.x() / _totalWeight, _animPos.y() / _totalWeight, _animPos.z() / _totalWeight);
 	_localMatrix._rot.buildFromPitchYawRoll(_animPitch / _totalWeight, _animYaw / _totalWeight, _animRoll / _totalWeight);
 
@@ -448,14 +446,15 @@
 
 	_pivotMatrix.translate(_pivot.x(), _pivot.y(), _pivot.z() );
 
-	g_driver->updateHierachyNode(this);
+	g_driver->updateHierachyNode2(this);
 }
 
 void Model::Mesh::draw() const {
 	for (int i = 0; i < _numFaces; i++)
 		_faces[i].draw(_vertices, _vertNormals, _textureVerts);
 
-	g_driver->drawModel(this);
+//	g_driver->drawModelNodeDebug(this);
+//	g_driver->drawModelPolygonPointsDebug(this);
 }
 
 void Model::Face::draw(float *vertices, float *vertNormals, float *textureVerts) const {

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- scene.cpp	9 Jan 2005 18:05:57 -0000	1.34
+++ scene.cpp	10 Jan 2005 09:07:46 -0000	1.35
@@ -23,7 +23,6 @@
 #include "bitmap.h"
 #include "colormap.h"
 #include "vector3d.h"
-#include "screen.h"
 #include "driver_gl.h"
 
 #include "imuse/imuse.h"
@@ -167,14 +166,6 @@
 
 void Scene::setSetup(int num) {
 	_currSetup = _setups + num;
-
-	if (!SCREENBLOCKS_GLOBAL)
-		return;
-
-	if (_currSetup->_bkgndZBm)
-		screenBlocksInit(_currSetup->_bkgndZBm->getZbufferData());
-	else
-		screenBlocksInitEmpty();
 }
 
 void Scene::drawBitmaps(ObjectState::Position stage) {

Index: scene.h
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- scene.h	5 Jan 2005 18:28:50 -0000	1.22
+++ scene.h	10 Jan 2005 09:07:46 -0000	1.23
@@ -108,8 +108,9 @@
 	Sector *_sectors;
 	Light *_lights;
 	Setup *_setups;
+public:
 	Setup *_currSetup;
-
+private:
 	typedef std::list<ObjectState*> StateList;
 	StateList _states;
 };

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/screen.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- screen.cpp	5 Jan 2005 22:13:56 -0000	1.19
+++ screen.cpp	10 Jan 2005 09:07:46 -0000	1.20
@@ -15,11 +15,14 @@
 //  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 "stdafx.h"
+#include "bits.h"
 #include "screen.h"
 
 #include <string.h>
 
 unsigned short int dataTemp[640 * 480];
+unsigned short int dataTemp2[640 * 480];
 
 screenBlockDataStruct screenBlockData[NUM_SCREEN_BLOCK_WIDTH][NUM_SCREEN_BLOCK_HEIGHT];
 
@@ -56,11 +59,22 @@
 
 void screenBlocksInit(char* zbuffer) {
 	memcpy(dataTemp, zbuffer, 640 * 480 * 2);
+	memcpy(dataTemp2, zbuffer, 640 * 480 * 2);
+	uint16 *zbufPtr = reinterpret_cast<uint16 *>(dataTemp);
+	for (int y = 0; y < 480 / 2; y++) {
+		uint16 *ptr1 = zbufPtr + y * 640;
+		uint16 *ptr2 = zbufPtr + (479 - y) * 640;
+		for (int x = 0; x < 640; x++, ptr1++, ptr2++) {
+			uint16 tmp = *ptr1;
+			*ptr1 = *ptr2;
+			*ptr2 = tmp;
+		}
+	}
 
 	for (int i = 0; i < NUM_SCREEN_BLOCK_WIDTH; i++) {
 		for(int j = 0; j < NUM_SCREEN_BLOCK_HEIGHT; j++) {
 			screenBlockData[i][j].isDirty = false;
-			screenBlockData[i][j].depth = getZbufferBlockDepth(zbuffer, i, j);
+			screenBlockData[i][j].depth = getZbufferBlockDepth((char *)dataTemp, i, j);
 		}
 	}
 }
@@ -181,10 +195,10 @@
 					i++;
 					width++;
 				}
-				for (int y = 0; y < 16; y++) {
-					glRasterPos2i(start * 16, j * 16 + y + 1);
-					glDrawPixels(16 * width, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, dataTemp + ((j * 16 + y) * 640) + (start * 16));
-				}
+				glRasterPos2i(start * 16, 479 - (j * 16));
+				glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
+				glDrawPixels(16 * width, 16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, dataTemp2 + (j * 16 * 640) + (start * 16));
+				glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
 			}
 		}
 	}





More information about the Scummvm-git-logs mailing list