[Gcblue-commits] gcb_wx/src/graphics ObjectUpdater.cpp,1.20,1.21 SmokeTrailEmitter.cpp,1.2,1.3 tc3DM
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-07-26 00:37:31
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13788/src/graphics Modified Files: ObjectUpdater.cpp SmokeTrailEmitter.cpp tc3DModel.cpp tcCreditView.cpp tcGameView.cpp tcHookInfo.cpp tcMessageCenter.cpp tcMessageChannel.cpp tcMessageInterface.cpp tcNetworkView.cpp Log Message: Added mission goal status to "Mission" channel (hit F7), added sub periscope and mast ops to multiplayer, changed torpedo behavior to resume s-search if track lost early, made afterburner smoke thin a little more uniformly Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcNetworkView.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcNetworkView.cpp 29 Apr 2005 18:52:53 -0000 1.9 --- tcNetworkView.cpp 26 Jul 2005 00:37:04 -0000 1.10 *************** *** 233,236 **** --- 233,237 ---- tcMultiplayerInterface::Get()->MakeServer(); tcSimState::Get()->SetMultiplayerServer(); + tcUserInfo::Get()->SetScore(10.0e6); // set high score for high server "rank" } else Index: tcMessageCenter.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMessageCenter.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcMessageCenter.cpp 6 May 2005 23:57:50 -0000 1.7 --- tcMessageCenter.cpp 26 Jul 2005 00:37:04 -0000 1.8 *************** *** 65,68 **** --- 65,75 ---- } + void tcMessageCenter::ClearChannel(const std::string& channelName) + { + tcMessageChannel* channel = GetOrCreateChannel(channelName); + + channel->Clear(); + } + /** * Writes a message to the text console Index: tcCreditView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcCreditView.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcCreditView.cpp 2 Jul 2005 16:51:11 -0000 1.15 --- tcCreditView.cpp 26 Jul 2005 00:37:04 -0000 1.16 *************** *** 221,225 **** const float height = float(mnHeight); ! float fY = 0.25f*(float)nDeltaTime; float fX = 0.5f*(float)mnWidth; --- 221,225 ---- const float height = float(mnHeight); ! float fY = 0.35f*(float)nDeltaTime; float fX = 0.5f*(float)mnWidth; Index: tcMessageChannel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMessageChannel.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcMessageChannel.cpp 4 Mar 2005 00:46:17 -0000 1.3 --- tcMessageChannel.cpp 26 Jul 2005 00:37:04 -0000 1.4 *************** *** 41,44 **** --- 41,51 ---- } + /** + * Clears all messages from channel + */ + void tcMessageChannel::Clear() + { + messages.clear(); + } /** *************** *** 101,112 **** std::deque<std::string>::reverse_iterator iter; float x = textRect.left + 10.0; ! float y = textRect.top; ! wxSize size; ! graphics->MeasureText(font, fontSize, "Tg", size); ! float lineSpacing = float(size.GetHeight()) + 2.0; for (iter = messages.rbegin(); iter != messages.rend(); ++iter) { y -= lineSpacing; if (y >= textRect.bottom + 10) --- 108,123 ---- std::deque<std::string>::reverse_iterator iter; float x = textRect.left + 10.0; ! float y = textRect.top - 5.0f; ! //wxSize size; ! //graphics->MeasureText(font, fontSize, "Tg", size); ! //float lineSpacing = float(size.GetHeight()) + 2.0; for (iter = messages.rbegin(); iter != messages.rend(); ++iter) { + wxSize size; + graphics->MeasureText(font, fontSize, iter->c_str(), size); + float lineSpacing = float(size.GetHeight()) + 2.0; + y -= lineSpacing; if (y >= textRect.bottom + 10) *************** *** 124,128 **** * */ ! std::string tcMessageChannel::GetName() { return channelName; --- 135,139 ---- * */ ! const std::string& tcMessageChannel::GetName() const { return channelName; Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tc3DModel.cpp 20 Jul 2005 16:24:54 -0000 1.29 --- tc3DModel.cpp 26 Jul 2005 00:37:04 -0000 1.30 *************** *** 853,858 **** void tc3DModel::UpdateEffects() { - wxASSERT(gameObj || sensorTrack); - bool disableSmoke = ((smokeMode == tcParticleEffect::OFF) || (gameObj && gameObj->parent) || (distanceFromCamera > 2000)); --- 853,856 ---- Index: tcMessageInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMessageInterface.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcMessageInterface.cpp 6 May 2005 23:57:50 -0000 1.4 --- tcMessageInterface.cpp 26 Jul 2005 00:37:04 -0000 1.5 *************** *** 45,48 **** --- 45,58 ---- } + /** + * Clears contents of indicated message channel + */ + void tcMessageInterface::ClearChannel(const std::string& channelName) + { + wxASSERT(messageCenter); + + messageCenter->ClearChannel(channelName); + } + void tcMessageInterface::ConsoleMessage(const std::string& msg) { Index: tcHookInfo.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcHookInfo.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcHookInfo.cpp 14 Jul 2005 23:42:22 -0000 1.13 --- tcHookInfo.cpp 26 Jul 2005 00:37:04 -0000 1.14 *************** *** 72,76 **** color.set(0.4f, 1.0f, 0.4f, 1.0f); ! if (pSMTrack->mnDatabaseID == -1) { DrawTextR(zBuff, ftextx-2.0f, ftexty, defaultFont.get(), --- 72,76 ---- color.set(0.4f, 1.0f, 0.4f, 1.0f); ! if (!pSMTrack->IsIdentified()) { DrawTextR(zBuff, ftextx-2.0f, ftexty, defaultFont.get(), *************** *** 80,84 **** else // track is identified, look up class name { ! if (tcDatabaseObject* databaseObj = database->GetObject(pSMTrack->mnDatabaseID)) { s = databaseObj->mzClass.mz; --- 80,84 ---- else // track is identified, look up class name { ! if (tcDatabaseObject* databaseObj = database->GetObject(pSMTrack->GetDatabaseId())) { s = databaseObj->mzClass.mz; *************** *** 183,187 **** ** is detected, and detailed identification is not ** available */ ! if ((nEmitters > 0) && (pSMTrack->mnDatabaseID == -1)) { unsigned nCandidates = pSMTrack->ambiguityList.size(); --- 183,187 ---- ** is detected, and detailed identification is not ** available */ ! if ((nEmitters > 0) && (!pSMTrack->IsIdentified())) { unsigned nCandidates = pSMTrack->ambiguityList.size(); *************** *** 510,513 **** --- 510,516 ---- } + /** + * TODO: This code duplicates similar code in tcObjectControl. Needs to be merged. + */ void tcHookInfo::GetObjectInfo(std::string& s, tcDatabaseObject *apDBObject, tcGameObject *apGameObject) { *************** *** 524,619 **** } ! switch (apDBObject->mnClassID) ! { ! case DTYPE_GENERIC: ! strcpy(zClass,"GEN"); ! break; ! case DTYPE_MISSILE: ! strcpy(zClass,"MIS"); ! break; ! case DTYPE_LAUNCHER: ! strcpy(zClass,"LAU"); ! break; ! case DTYPE_AIR: ! strcpy(zClass,"AIR"); ! break; ! default: ! strcpy(zClass,"ERR"); ! break; ! } ! switch (apGameObject->mnModelType) ! { ! case MTYPE_SURFACE: ! strcpy(zModel,"SUR"); ! break; ! case MTYPE_CARRIER: ! strcpy(zModel,"CV"); ! break; ! case MTYPE_MISSILE: ! strcpy(zModel,"MIS"); ! break; ! case MTYPE_OBJECT: ! strcpy(zModel,"OBJ"); ! break; ! case MTYPE_AIR: ! strcpy(zModel,"AIR"); ! break; ! case MTYPE_FIXEDWING: ! strcpy(zModel,"FWAIR"); ! break; ! case MTYPE_FIXEDWINGX: ! strcpy(zModel,"FXAIR"); ! break; ! default: ! strcpy(zModel,"ERR"); ! break; ! } ! switch (apDBObject->mnType) ! { // classification type ! case PTYPE_UNKNOWN: ! strcpy(zType,"UNK"); ! break; ! case PTYPE_SURFACE: ! strcpy(zType,"USURF"); ! break; ! case PTYPE_SMALLSURFACE: ! strcpy(zType,"SSURF"); ! break; ! case PTYPE_LARGESURFACE: ! strcpy(zType,"LSURF"); ! break; ! case PTYPE_AIR: ! strcpy(zType,"UAIR"); ! break; ! case PTYPE_FIXEDWING: ! strcpy(zType,"FWAIR"); ! break; ! case PTYPE_MISSILE: ! strcpy(zType,"MIS"); ! break; ! case PTYPE_HELO: ! strcpy(zType,"HELO"); ! break; ! case PTYPE_SUBSURFACE: ! strcpy(zType,"USUB"); ! break; ! case PTYPE_SUBMARINE: ! strcpy(zType,"SUB"); ! break; ! case PTYPE_TORPEDO: ! strcpy(zType,"TORP"); ! break; ! case PTYPE_FIXED: ! strcpy(zType,"LAND"); ! break; ! default: ! strcpy(zType,"ERR"); ! break; ! } ! char zBuff[128]; ! sprintf(zBuff,"%s %s %s",zClass,zModel,zType); ! s = zBuff; } --- 527,653 ---- } ! switch (apDBObject->mnClassID) ! { ! case DTYPE_GENERIC: ! strcpy(zClass,"GEN"); ! break; ! case DTYPE_MISSILE: ! strcpy(zClass,"MIS"); ! break; ! case DTYPE_LAUNCHER: ! strcpy(zClass,"LAU"); ! break; ! case DTYPE_AIR: ! strcpy(zClass,"AIR"); ! break; ! case DTYPE_BALLISTIC: ! strcpy(zClass,"BAL"); ! break; ! case DTYPE_TORPEDO: ! strcpy(zClass, "TOR"); ! break; ! case DTYPE_SUBMARINE: ! strcpy(zClass, "SUB"); ! break; ! default: ! strcpy(zClass,"UNK"); ! break; ! } ! switch (apGameObject->mnModelType) ! { ! case MTYPE_SURFACE: ! strcpy(zModel,"SUR"); ! break; ! case MTYPE_CARRIER: ! strcpy(zModel,"CV"); ! break; ! case MTYPE_MISSILE: ! strcpy(zModel,"MIS"); ! break; ! case MTYPE_OBJECT: ! strcpy(zModel,"OBJ"); ! break; ! case MTYPE_AIR: ! strcpy(zModel,"AIR"); ! break; ! case MTYPE_FIXEDWING: ! strcpy(zModel,"FWAIR"); ! break; ! case MTYPE_FIXEDWINGX: ! strcpy(zModel,"FXAIR"); ! break; ! case MTYPE_HELO: ! strcpy(zModel,"HELO"); ! break; ! case MTYPE_BALLISTIC: ! strcpy(zModel,"BAL"); ! break; ! case MTYPE_AIRFIELD: ! strcpy(zModel,"FIELD"); ! break; ! case MTYPE_SUBMARINE: ! strcpy(zModel,"SUB"); ! break; ! case MTYPE_TORPEDO: ! strcpy(zModel, "TOR"); ! break; ! case MTYPE_FIXED: ! strcpy(zModel, "GND"); ! break; ! default: ! strcpy(zModel,"UNK"); ! break; ! } ! switch (apDBObject->mnType) // classification type ! { ! case PTYPE_UNKNOWN: ! strcpy(zType,"UNK"); ! break; ! case PTYPE_SURFACE: ! strcpy(zType,"USURF"); ! break; ! case PTYPE_SMALLSURFACE: ! strcpy(zType,"SSURF"); ! break; ! case PTYPE_LARGESURFACE: ! strcpy(zType,"LSURF"); ! break; ! case PTYPE_AIR: ! strcpy(zType,"UAIR"); ! break; ! case PTYPE_FIXEDWING: ! strcpy(zType,"FWAIR"); ! break; ! case PTYPE_MISSILE: ! strcpy(zType,"MIS"); ! break; ! case PTYPE_HELO: ! strcpy(zType,"HELO"); ! break; ! case PTYPE_SUBSURFACE: ! strcpy(zType,"USUB"); ! break; ! case PTYPE_SUBMARINE: ! strcpy(zType,"SUB"); ! break; ! case PTYPE_TORPEDO: ! strcpy(zType,"TORP"); ! break; ! case PTYPE_FIXED: ! strcpy(zType,"LAND"); ! break; ! case PTYPE_BALLISTIC: ! strcpy(zType,"BAL"); ! break; ! default: ! strcpy(zType,"ERR"); ! break; ! } ! ! char zBuff[128]; ! sprintf(zBuff,"%s %s %s",zClass,zModel,zType); ! s = zBuff; } Index: tcGameView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcGameView.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcGameView.cpp 28 Jun 2005 02:51:34 -0000 1.13 --- tcGameView.cpp 26 Jul 2005 00:37:04 -0000 1.14 *************** *** 630,634 **** mpMapView->maMapObj[rnIndex].isStaleTrack = false; mpMapView->maMapObj[rnIndex].isDestroyed = false; ! mpMapView->maMapObj[rnIndex].useAltered = (po->IsClientMode() && !po->IsControlled()); --- 630,634 ---- mpMapView->maMapObj[rnIndex].isStaleTrack = false; mpMapView->maMapObj[rnIndex].isDestroyed = false; ! mpMapView->maMapObj[rnIndex].useAltered = (!po->IsControlled()); Index: ObjectUpdater.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/ObjectUpdater.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ObjectUpdater.cpp 17 Jul 2005 12:58:04 -0000 1.20 --- ObjectUpdater.cpp 26 Jul 2005 00:37:04 -0000 1.21 *************** *** 69,72 **** --- 69,73 ---- tcGameObject* gameObject = model->GetGameObj(); + wxASSERT(gameObject); *************** *** 105,108 **** --- 106,151 ---- /** + * This version updates animations for models attached to sensor tracks + */ + void ObjectUpdater::UpdateTrackAnimations() + { + size_t nAnimations = model->animationInfo.size(); + if (nAnimations == 0) return; + + tcSensorMapTrack* track = model->GetSensorTrack(); + wxASSERT(track); + + // do not update animations if camera is beyond animation LOD distance + //if (distanceFromCamera > 10000.0f) return; + + for(size_t n=0;n<nAnimations;n++) + { + tcAnimationInfo& info = model->animationInfo[n]; + + if (info.bound) + { + osg::MatrixTransform *xform = info.transform; + //osg::Matrix matrix = xform->getMatrix(); + double dt = viewer->GetGameTimeStep(); + double theta = info.omega * dt; // change in angle + + // scale rotation rate by platform speed for propeller animation type + if (info.animationType == 0) + { + /* for subs and surface ships change rate with speed (omega is radians per second per knot) + ** aircraft including helos use a fixed rate (omega is radians per second) + */ + if (track->mfSpeed_kts < 50.0f) + { + theta *= track->mfSpeed_kts ; + } + } + + xform->preMult(osg::Matrix::rotate(theta , info.axis)); + } + } + } + + /** * Omits child (captive object) updates */ *************** *** 122,126 **** // first case assumes track identification is never wrong (currently true) ! if (track->mnDatabaseID != -1) genericMode = tc3DModel::USE_TRUE_MODEL; else if (track->IsSurface()) genericMode = tc3DModel::USE_SURFACE_GENERIC; else if (track->IsAir()) genericMode = tc3DModel::USE_AIR_GENERIC; --- 165,169 ---- // first case assumes track identification is never wrong (currently true) ! if (track->GetDatabaseId() != -1) genericMode = tc3DModel::USE_TRUE_MODEL; else if (track->IsSurface()) genericMode = tc3DModel::USE_SURFACE_GENERIC; else if (track->IsAir()) genericMode = tc3DModel::USE_AIR_GENERIC; *************** *** 244,248 **** { UpdateTrack(node); ! UpdateAnimations(); // must call any nested node callbacks and continue subgraph traversal. --- 287,291 ---- { UpdateTrack(node); ! UpdateTrackAnimations(); // must call any nested node callbacks and continue subgraph traversal. Index: SmokeTrailEmitter.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/SmokeTrailEmitter.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SmokeTrailEmitter.cpp 2 Nov 2004 04:23:56 -0000 1.2 --- SmokeTrailEmitter.cpp 26 Jul 2005 00:37:04 -0000 1.3 *************** *** 28,31 **** --- 28,32 ---- #include <graphics/SmokeTrailEmitter.h> #include <osgParticle/Emitter> + #include "common/randfn.h" #ifdef _DEBUG *************** *** 35,45 **** //#pragma warning (disable: 4273) // inconsistent dll linkage ! void osgParticle::SmokeTrailEmitter::InitializeCloseupTemplate() { Particle standardTemplate; standardTemplate.setLifeTime(2); ! standardTemplate.setSizeRange(osgParticle::rangef(0.5f, 1.0f)); ! standardTemplate.setAlphaRange(osgParticle::rangef(0.2f, 0.5f)); standardTemplate.setColorRange(osgParticle::rangev4( osg::Vec4(0.5f, 0.5f, 0.5f, 0.5f), --- 36,46 ---- //#pragma warning (disable: 4273) // inconsistent dll linkage ! void osgParticle::SmokeTrailEmitter::InitializeStandardTemplate() { Particle standardTemplate; standardTemplate.setLifeTime(2); ! standardTemplate.setSizeRange(osgParticle::rangef(0.6f, 1.0f)); ! standardTemplate.setAlphaRange(osgParticle::rangef(0.4f, 0.1f)); standardTemplate.setColorRange(osgParticle::rangev4( osg::Vec4(0.5f, 0.5f, 0.5f, 0.5f), *************** *** 48,60 **** standardTemplate.setMass(0.05f); setParticleTemplate(standardTemplate); - - closeUpTemplate.setLifeTime(0.2); - closeUpTemplate.setSizeRange(osgParticle::rangef(0.4f, 0.5f)); - closeUpTemplate.setAlphaRange(osgParticle::rangef(0.3f, 0.1f)); - closeUpTemplate.setColorRange(osgParticle::rangev4( - osg::Vec4(0.5f, 0.5f, 0.5f, 1.0f), - osg::Vec4(0.7, 0.7f, 0.7f, 0.5f))); - //closeUpTemplate.setRadius(0.1f); - closeUpTemplate.setMass(0.05f); } --- 49,52 ---- *************** *** 63,67 **** placer_(new tcParticlePlacer) { ! InitializeCloseupTemplate(); } --- 55,59 ---- placer_(new tcParticlePlacer) { ! InitializeStandardTemplate(); } *************** *** 70,94 **** placer_(static_cast<tcParticlePlacer*>(copyop(copy.placer_.get()))) { ! InitializeCloseupTemplate(); } void osgParticle::SmokeTrailEmitter::emit(double dt) { ! int n = 30; ! for (int i=0; i<n; ++i) { ! if (i==0) ! { ! if (Particle* P = getParticleSystem()->createParticle(&getParticleTemplate())) ! { ! placer_->placeAlongPath(P, 1.2f); ! } ! } ! else if (Particle* P = ! getParticleSystem()->createParticle(&closeUpTemplate)) { ! float fractionalDistance = 0.2f + float(i) / float(n); placer_->placeAlongPath(P, fractionalDistance); } } } --- 62,86 ---- placer_(static_cast<tcParticlePlacer*>(copyop(copy.placer_.get()))) { ! InitializeStandardTemplate(); } void osgParticle::SmokeTrailEmitter::emit(double dt) { ! int nEmit = (dt > 0) ? 30 : 0; ! float inv_nEmit = (nEmit > 0) ? 1.0 / float(nEmit) : 1.0f; ! ! for (int i=0; i<nEmit; ++i) { ! if (Particle* P = ! getParticleSystem()->createParticle(&getParticleTemplate())) { ! float fractionalDistance = 0.2f + float(i) * inv_nEmit; placer_->placeAlongPath(P, fractionalDistance); + + float rand_val = randf(1.0f); + P->setLifeTime(0.5f + 1.5 * rand_val); + P->setRadius(0.5 + 0.25*rand_val); } + } } |