Update of /cvsroot/gcblue/gcb_wx/src/database
In directory sc8-pr-cvs1:/tmp/cvs-serv22071/src/database
Modified Files:
tcDatabaseObject.cpp
Log Message:
Added better 3D model class for animation support
Index: tcDatabaseObject.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabaseObject.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** tcDatabaseObject.cpp 7 Dec 2003 14:29:32 -0000 1.3
--- tcDatabaseObject.cpp 10 Jan 2004 21:55:31 -0000 1.4
***************
*** 32,35 ****
--- 32,36 ----
#include <fstream>
#include "CsvTranslator.h"
+ #include "tc3DModel.h"
namespace Database
***************
*** 98,149 ****
/***************************** tcDatabaseObject ***********************************/
! void tcDatabaseObject::Load3DModel() {
! if (strlen(mz3DModelFileName.mz) <= 1) {
! // assign functional model
! switch (mnClassID) {
! case DTYPE_GENERIC:
! {
! if ((mnModelType == MTYPE_FIXEDWING)||
! (mnModelType == MTYPE_FIXEDWINGX)||
! (mnModelType == MTYPE_AIR))
! {
! mz3DModelFileName = "fa1uk";
! //pPlatformObj->mnModelType = MTYPE_FIXEDWING;
! }
! else if (mnModelType == MTYPE_HELO) {
! mz3DModelFileName = "rah66";
! }
! else {
! mz3DModelFileName = "type45edit";
! //pPlatformObj->mnModelType = MTYPE_SURFACE;
! }
! }
! break;
! case DTYPE_MISSILE:
! mz3DModelFileName = "roland_sam";
! break;
! }
}
! if (strlen(mz3DModelFileName.mz) <= 1) {return;}
!
! #if 0 // bypass load here in favor of OSG load
! char zFilePath[128];
! mp3DObj = new tc3DObject;
! if (mp3DObj == NULL) {WTL("tcDatabaseObject::Load3DModel - Error 17");return;}
! strcpy(zFilePath,"3d\\"); // TODO: tie path to constant
! strcat(zFilePath,mz3DModelFileName.mz);
! strcat(zFilePath,".gc3");
! if (mp3DObj->Load(zFilePath) == false) {
! tcString s;
! s.Format("tcDatabaseObject::Load3DModel - Load of %s failed",zFilePath);
! WTL(s.GetBuffer());
}
! else {
! tcString s;
! s.Format("tcDatabaseObject::Load3DModel - Load of %s succeeded (max dim: %f)",
! zFilePath,mp3DObj->mfDimension);
! WTL(s.GetBuffer());
}
! #endif
}
--- 99,129 ----
/***************************** tcDatabaseObject ***********************************/
! tc3DModel* tcDatabaseObject::Get3DModel()
! {
! wxASSERT(model);
! if (model)
! {
! return model->Clone();
}
! else
! {
! return NULL;
}
! }
!
!
! void tcDatabaseObject::Load3DModel()
! {
! if ((strlen(mz3DModelFileName.mz) <= 1)
! ||(std::string(mz3DModelFileName.mz) == "NONE"))
! {
! // no valid model identified
! //std::cerr << "tcDatabaseObject::Load3DModel -- no model for class "
! // << mzClass.mz << "\n";
! return;
}
! model = new tc3DModel();
! wxASSERT(model);
! model->Load(mz3DModelFileName.mz);
}
***************
*** 208,211 ****
--- 188,192 ----
if (mzDescription[n]=='\n') mzDescription[n]=' ';
}
+ Load3DModel();
}
else
***************
*** 247,250 ****
--- 228,232 ----
mnClassID = DTYPE_OBJECT;
mnType = PTYPE_UNKNOWN;
+ model = NULL;
}
***************
*** 259,266 ****
--- 241,253 ----
mz3DModelFileName = obj.mz3DModelFileName;
strcpy(mzDescription, obj.mzDescription); // BAD, assumes obj has legal string
+ model = NULL; // model not copied
}
tcDatabaseObject::~tcDatabaseObject()
{
+ if (model)
+ {
+ delete model;
+ }
}
|