[Scummvm-cvs-logs] CVS: residual engine.cpp,1.10,1.11 model.cpp,1.5,1.6 screen.cpp,1.4,1.5
Vincent Hamm
yazoo at users.sourceforge.net
Sat Aug 30 12:59:07 CEST 2003
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1:/tmp/cvs-serv3599
Modified Files:
engine.cpp model.cpp screen.cpp
Log Message:
slight update.
The actor are temporarly draw 2 times until I figure out the problem with the update projection
Debut display is left activated
Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- engine.cpp 30 Aug 2003 19:04:07 -0000 1.10
+++ engine.cpp 30 Aug 2003 19:58:38 -0000 1.11
@@ -87,6 +87,18 @@
screenBlocksReset();
+ // Draw the screen
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ Bitmap::prepareGL();
+ if (currScene_ != NULL)
+ currScene_->drawBackground();
+
+ glEnable(GL_DEPTH_TEST);
+ if (currScene_ != NULL)
+ currScene_->setupCamera();
+
+ glMatrixMode(GL_MODELVIEW);
// Update actor costumes
for (actor_list_type::iterator i = actors_.begin();
i != actors_.end(); i++) {
@@ -96,10 +108,17 @@
a->update();
}
- // Draw the screen
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ // Draw actors
+ glEnable(GL_TEXTURE_2D);
+ for (actor_list_type::iterator i = actors_.begin();
+ i != actors_.end(); i++) {
+ Actor *a = *i;
+ if (a->inSet(currScene_->name()) && a->visible())
+ a->draw();
+ }
+ glDisable(GL_TEXTURE_2D);
- screenBlocksDrawDebug();
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
screenBlocksBlitDirtyBlocks();
@@ -121,8 +140,10 @@
}
glDisable(GL_TEXTURE_2D);
+ screenBlocksDrawDebug();
- // Draw text
+
+ // Draw text
for (text_list_type::iterator i = textObjects_.begin();
i != textObjects_.end(); i++) {
(*i)->draw();
Index: model.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/model.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- model.cpp 30 Aug 2003 19:04:07 -0000 1.5
+++ model.cpp 30 Aug 2003 19:58:38 -0000 1.6
@@ -128,73 +128,6 @@
delete[] faces_;
}
-void Model::Mesh::update() {
- glPushMatrix();
- glLoadIdentity();
-
- 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 < numFaces_; i++)
- {
- Vector3d v;
- Matrix4 tempMatrix = matrix_;
- float* pVertices;
- int j;
- float bestDepth = 0;
-
- for( j =0; j< faces_[i].numVertices_; j++ )
- {
- pVertices = vertices_ + 3 * 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;
-
- }
-
- 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_DEPTH_TEST);
- glEnable(GL_TEXTURE_2D );
- glPopMatrix();
-}
-
void Model::Face::loadBinary(const char *&data, ResPtr<Material> *materials) {
type_ = get_LE_uint32(data + 4);
geo_ = get_LE_uint32(data + 8);
@@ -540,7 +473,6 @@
if( mesh_ != NULL )
{
mesh_->matrix_ = pivotMatrix;
- mesh_->update();
}
if( child_ != NULL )
@@ -548,8 +480,6 @@
child_->setMatrix( matrix_ );
child_->update();
}
-
-
}
@@ -612,7 +542,60 @@
// Yaz: debug
// this compute the dirty rect for the mesh*/
+ glPushMatrix();
+ glLoadIdentity();
+
+ 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 < numFaces_; i++)
+ {
+ Vector3d v;
+ Matrix4 tempMatrix = matrix_;
+ float* pVertices;
+ int j;
+ float bestDepth = 0;
+ for( j =0; j< faces_[i].numVertices_; j++ )
+ {
+ pVertices = vertices_ + 3 * 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;
+
+ }
+
+ screenBlocksAddRectangle( top, right, left, bottom, bestDepth );
/*
if( faces_[i].numVertices_ == 3 ) // triangle
{
@@ -645,7 +628,12 @@
{
printf("Bad primitive !\n");
} */
-// }
+ }
+
+ glDisable(GL_DEPTH_TEST);
+ glPointSize( 3.f );
+ glColor4f( 1.f, 1.f, 0.f, 1.f );
+ glDisable(GL_TEXTURE_2D );
/* glBegin(GL_LINES);
@@ -678,7 +666,9 @@
glVertex3f( objx, objy, objz );
glEnd();*/
-
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_TEXTURE_2D );
+ glPopMatrix();
}
void Model::Face::draw(float *vertices, float *vertNormals,
Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/screen.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- screen.cpp 30 Aug 2003 19:15:05 -0000 1.4
+++ screen.cpp 30 Aug 2003 19:58:38 -0000 1.5
@@ -241,6 +241,7 @@
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glDepthMask(GL_TRUE);
+
for(i=0;i<40;i++)
{
for(j=0;j<30;j++)
@@ -251,15 +252,13 @@
int width = 1;
int temp = i+1;
screenBlockData[i][j].isDirty = false;
- while(temp <40 && screenBlockData[temp][j].isDirty)
+ while((temp <40) && screenBlockData[temp][j].isDirty)
{
screenBlockData[temp][j].isDirty = false;
width++;
+ temp++;
}
- /* This loop here is to prevent using PixelZoom that may be unoptimized for the 1.0 / -1.0 case
- in some drivers...
- */
for (int y = 0; y < 16; y++)
{
glRasterPos2i(j*16, i*16 + y);
More information about the Scummvm-git-logs
mailing list