[Scummvm-cvs-logs] CVS: residual costume.cpp,1.36,1.37 costume.h,1.20,1.21 driver_gl.cpp,1.60,1.61 driver_gl.h,1.30,1.31 driver_tinygl.cpp,1.32,1.33 driver_tinygl.h,1.17,1.18 driver.h,1.16,1.17
Erich Edgar Hoover
compholio at users.sourceforge.net
Wed Jan 4 18:41:01 CET 2006
- Previous message: [Scummvm-cvs-logs] CVS: residual/imuse imuse_tables.cpp,1.10,1.11
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm sound_he.cpp,NONE,2.1 actor.cpp,1.392,1.393 intern.h,2.542,2.543 module.mk,1.57,1.58 resource.cpp,1.350,1.351 resource_v7he.cpp,1.48,1.49 script_v100he.cpp,2.181,2.182 script_v72he.cpp,2.319,2.320 script_v7he.cpp,2.173,2.174 script_v80he.cpp,2.129,2.130 script_v90he.cpp,2.290,2.291 scumm.cpp,1.670,1.671 scumm.h,1.660,1.661 sound.cpp,1.492,1.493 sound.h,1.94,1.95 vars.cpp,1.156,1.157
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13984
Modified Files:
costume.cpp costume.h driver_gl.cpp driver_gl.h
driver_tinygl.cpp driver_tinygl.h driver.h
Log Message:
Fixed more invisible object and colormap issues, fix dillopede elevator music.
Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/costume.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- costume.cpp 4 Jan 2006 06:00:47 -0000 1.36
+++ costume.cpp 5 Jan 2006 02:40:26 -0000 1.37
@@ -124,7 +124,6 @@
protected:
std::string _filename;
ResPtr<Model> _obj;
- ResPtr<CMap> _previousCmap;
Model::HierNode *_hier;
Matrix4 _matrix;
};
@@ -216,7 +215,6 @@
} else {
_filename = filename;
}
- _previousCmap = NULL;
if (prevComponent != NULL) {
MainModelComponent *mmc = dynamic_cast<MainModelComponent *>(prevComponent);
@@ -231,13 +229,9 @@
// constructor before
if (_obj == NULL) {
CMap *cmap = this->cmap();
- // If we still don't have the necessary colormap
- // then try the one from the previous costume
- if (cmap == NULL && _previousCmap != NULL)
- cmap = _previousCmap;
-
- // Get the default colormap if we still haven't
- // found a valid colormap
+
+ // Get the default colormap if we haven't found
+ // a valid colormap
if (cmap == NULL) {
if (debugLevel == DEBUG_MODEL || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
warning("No colormap specified for %s, using %s\n", _filename.c_str(), DEFAULT_COLORMAP);
@@ -246,7 +240,12 @@
}
_obj = g_resourceloader->loadModel(_filename.c_str(), *cmap);
_hier = _obj->copyHierarchy();
- reset();
+ // Use parent availablity to decide whether to default the
+ // component to being visible
+ if (_parent == NULL || !_parent->visible())
+ setKey(1);
+ else
+ setKey(0);
}
// If we're the child of a mesh component, put our nodes in the
@@ -262,32 +261,13 @@
}
void ModelComponent::setKey(int val) {
- MainModelComponent *mmc;
- ModelComponent *moc;
- MeshComponent *mc;
-
- _hier->_hierVisible = (val != 0);
- // If we're making a model component visible then assume
- // that the parent mesh object should also become visible
- if (_parent == NULL || val == 0)
- return;
- mc = dynamic_cast<MeshComponent *>(_parent);
- if (mc == NULL)
- return;
- mc->node()->_meshVisible = true;
- // Do the same thing with the parent of the mesh object
- // but DO NOT handle the parent if it's a MMDL
- if (mc->parent() == NULL)
- return;
- moc = dynamic_cast<ModelComponent *>(mc->parent());
- mmc = dynamic_cast<MainModelComponent *>(mc->parent());
- if (moc == NULL || mmc != NULL)
- return;
- moc->_hier->_hierVisible = true;
+ _visible = (val != 0);
+ _hier->_hierVisible = _visible;
}
void ModelComponent::reset() {
- _hier->_hierVisible = false;
+ _visible = false;
+ _hier->_hierVisible = _visible;
}
// Reset the hierarchy nodes for any keyframe animations (which
@@ -318,11 +298,29 @@
delete[] _hier;
}
+void translateObject(Model::HierNode *node, bool reset) {
+ if (node->_parent != NULL)
+ translateObject(node->_parent, reset);
+
+ if(reset)
+ g_driver->translateViewpoint();
+ else
+ g_driver->translateViewpoint(node->_animPos / node->_totalWeight, node->_animPitch / node->_totalWeight, node->_animYaw / node->_totalWeight, node->_animRoll / node->_totalWeight);
+}
+
void ModelComponent::draw() {
- if (_parent == NULL)
- // Otherwise it was already drawn by
- // being included in the parent's hierarchy
- _hier->draw();
+ // If the object was drawn by being a component
+ // of it's parent then don't draw it
+ if (_parent != NULL && _parent->visible())
+ return;
+ // Need to translate object to be in accordance
+ // with the setup of the parent
+ if (_hier->_parent != NULL)
+ translateObject(_hier->_parent, false);
+ _hier->draw();
+ // Need to un-translate when done
+ if (_hier->_parent != NULL)
+ translateObject(_hier->_parent, true);
}
MainModelComponent::MainModelComponent(Costume::Component *parent, int parentID, const char *filename, Costume::Component *prevComponent, tag32 tag) :
@@ -341,7 +339,8 @@
void MainModelComponent::init() {
ModelComponent::init();
- _hier->_hierVisible = true;
+ _visible = true;
+ _hier->_hierVisible = _visible;
}
void MainModelComponent::update() {
@@ -353,7 +352,8 @@
}
void MainModelComponent::reset() {
- _hier->_hierVisible = true;
+ _visible = true;
+ _hier->_hierVisible = _visible;
}
MainModelComponent::~MainModelComponent() {
@@ -721,6 +721,8 @@
}
Costume::Component::Component(Component *parent, int parentID, tag32 tag) {
+ _visible = -1;
+ _previousCmap = NULL;
_cmap = NULL;
_cost = NULL;
_parent = NULL;
@@ -738,8 +740,16 @@
mc->resetColormap();
}
+bool Costume::Component::visible() {
+ if (_visible == -1 && _parent != NULL)
+ return _parent->visible();
+ return _visible;
+}
+
CMap *Costume::Component::cmap() {
- if (_cmap == NULL && _parent != NULL)
+ if (_cmap == NULL && _previousCmap != NULL)
+ return _previousCmap;
+ else if (_cmap == NULL && _parent != NULL)
return _parent->cmap();
else if (_cmap == NULL && _parent == NULL && _cost != NULL)
return _cost->_cmap;
Index: costume.h
===================================================================
RCS file: /cvsroot/scummvm/residual/costume.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- costume.h 4 Jan 2006 06:00:47 -0000 1.20
+++ costume.h 5 Jan 2006 02:40:26 -0000 1.21
@@ -63,6 +63,7 @@
tag32 tag() { return _tag; }
CMap *cmap();
void setColormap(CMap *c);
+ bool visible();
Component *parent() { return _parent; }
virtual void setMatrix(Matrix4) { };
virtual void init() { }
@@ -75,9 +76,9 @@
virtual ~Component() { }
protected:
- ResPtr<CMap> _cmap;
+ ResPtr<CMap> _cmap, _previousCmap;
tag32 _tag;
- int _parentID;
+ int _parentID, _visible;
Component *_parent, *_child, *_sibling;
Matrix4 _matrix;
Costume *_cost;
Index: driver_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- driver_gl.cpp 25 Dec 2005 05:57:08 -0000 1.60
+++ driver_gl.cpp 5 Jan 2006 02:40:26 -0000 1.61
@@ -146,16 +146,23 @@
glDisable( GL_ALPHA_TEST );
}
-void DriverGL::drawHierachyNode(const Model::HierNode *node) {
- if (node->_hierVisible) {
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+void DriverGL::translateViewpoint(Vector3d pos, float pitch, float yaw, float roll) {
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
- glTranslatef(node->_animPos.x() / node->_totalWeight, node->_animPos.y() / node->_totalWeight, node->_animPos.z() / node->_totalWeight);
- glRotatef(node->_animYaw / node->_totalWeight, 0, 0, 1);
- glRotatef(node->_animPitch / node->_totalWeight, 1, 0, 0);
- glRotatef(node->_animRoll / node->_totalWeight, 0, 1, 0);
+ glTranslatef(pos.x(), pos.y(), pos.z());
+ glRotatef(yaw, 0, 0, 1);
+ glRotatef(pitch, 1, 0, 0);
+ glRotatef(roll, 0, 1, 0);
+}
+
+void DriverGL::translateViewpoint() {
+ glPopMatrix();
+}
+void DriverGL::drawHierachyNode(const Model::HierNode *node) {
+ translateViewpoint(node->_animPos / node->_totalWeight, node->_animPitch / node->_totalWeight, node->_animYaw / node->_totalWeight, node->_animRoll / node->_totalWeight);
+ if (node->_hierVisible) {
if (node->_mesh != NULL && node->_meshVisible) {
glPushMatrix();
glTranslatef(node->_pivot.x(), node->_pivot.y(), node->_pivot.z());
@@ -168,8 +175,8 @@
node->_child->draw();
glMatrixMode(GL_MODELVIEW);
}
- glPopMatrix();
}
+ translateViewpoint();
if (node->_sibling != NULL)
node->_sibling->draw();
Index: driver_gl.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- driver_gl.h 25 Dec 2005 05:57:08 -0000 1.30
+++ driver_gl.h 5 Jan 2006 02:40:26 -0000 1.31
@@ -49,6 +49,9 @@
void set3DMode();
+ void translateViewpoint(Vector3d pos, float pitch, float yaw, float roll);
+ void translateViewpoint();
+
void drawHierachyNode(const Model::HierNode *node);
void drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts);
Index: driver_tinygl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_tinygl.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- driver_tinygl.cpp 28 Aug 2005 23:25:14 -0000 1.32
+++ driver_tinygl.cpp 5 Jan 2006 02:40:26 -0000 1.33
@@ -199,15 +199,22 @@
tglEnd();
}
-void DriverTinyGL::drawHierachyNode(const Model::HierNode *node) {
- if (node->_hierVisible) {
- tglPushMatrix();
+void DriverTinyGL::translateViewpoint(Vector3d pos, float pitch, float yaw, float roll) {
+ 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);
+ tglTranslatef(pos.x(), pos.y(), pos.z());
+ tglRotatef(yaw, 0, 0, 1);
+ tglRotatef(pitch, 1, 0, 0);
+ tglRotatef(roll, 0, 1, 0);
+}
+
+void DriverTinyGL::translateViewpoint() {
+ tglPopMatrix();
+}
+void DriverTinyGL::drawHierachyNode(const Model::HierNode *node) {
+ translateViewpoint(node->_animPos / node->_totalWeight, node->_animPitch / node->_totalWeight, node->_animYaw / node->_totalWeight, node->_animRoll / node->_totalWeight);
+ if (node->_hierVisible) {
if (node->_mesh != NULL && node->_meshVisible) {
tglPushMatrix();
tglTranslatef(node->_pivot.x(), node->_pivot.y(), node->_pivot.z());
@@ -220,8 +227,8 @@
node->_child->draw();
tglMatrixMode(TGL_MODELVIEW);
}
- tglPopMatrix();
}
+ translateViewpoint();
if (node->_sibling != NULL)
node->_sibling->draw();
Index: driver_tinygl.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_tinygl.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- driver_tinygl.h 28 Aug 2005 23:25:14 -0000 1.17
+++ driver_tinygl.h 5 Jan 2006 02:40:26 -0000 1.18
@@ -50,6 +50,9 @@
void set3DMode();
+ void translateViewpoint(Vector3d pos, float pitch, float yaw, float roll);
+ void translateViewpoint();
+
void drawHierachyNode(const Model::HierNode *node);
void drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts);
Index: driver.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- driver.h 28 Aug 2005 23:25:13 -0000 1.16
+++ driver.h 5 Jan 2006 02:40:26 -0000 1.17
@@ -65,6 +65,9 @@
virtual void set3DMode() = 0;
+ virtual void translateViewpoint(Vector3d pos, float pitch, float yaw, float roll) = 0;
+ virtual void translateViewpoint() = 0;
+
virtual void drawHierachyNode(const Model::HierNode *node) = 0;
virtual void drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts) = 0;
- Previous message: [Scummvm-cvs-logs] CVS: residual/imuse imuse_tables.cpp,1.10,1.11
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm sound_he.cpp,NONE,2.1 actor.cpp,1.392,1.393 intern.h,2.542,2.543 module.mk,1.57,1.58 resource.cpp,1.350,1.351 resource_v7he.cpp,1.48,1.49 script_v100he.cpp,2.181,2.182 script_v72he.cpp,2.319,2.320 script_v7he.cpp,2.173,2.174 script_v80he.cpp,2.129,2.130 script_v90he.cpp,2.290,2.291 scumm.cpp,1.670,1.671 scumm.h,1.660,1.661 sound.cpp,1.492,1.493 sound.h,1.94,1.95 vars.cpp,1.156,1.157
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list