You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(47) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(140) |
Feb
(98) |
Mar
(152) |
Apr
(104) |
May
(71) |
Jun
(94) |
Jul
(169) |
Aug
(83) |
Sep
(47) |
Oct
(134) |
Nov
(7) |
Dec
(20) |
2004 |
Jan
(41) |
Feb
(14) |
Mar
(42) |
Apr
(47) |
May
(68) |
Jun
(143) |
Jul
(65) |
Aug
(29) |
Sep
(40) |
Oct
(34) |
Nov
(33) |
Dec
(97) |
2005 |
Jan
(29) |
Feb
(30) |
Mar
(9) |
Apr
(37) |
May
(13) |
Jun
(31) |
Jul
(22) |
Aug
(23) |
Sep
|
Oct
(37) |
Nov
(34) |
Dec
(117) |
2006 |
Jan
(48) |
Feb
(6) |
Mar
(2) |
Apr
(71) |
May
(10) |
Jun
(16) |
Jul
(7) |
Aug
(1) |
Sep
(14) |
Oct
(17) |
Nov
(25) |
Dec
(26) |
2007 |
Jan
(8) |
Feb
(2) |
Mar
(7) |
Apr
(26) |
May
|
Jun
(12) |
Jul
(30) |
Aug
(14) |
Sep
(9) |
Oct
(4) |
Nov
(7) |
Dec
(6) |
2008 |
Jan
(10) |
Feb
(10) |
Mar
(6) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(18) |
Aug
(15) |
Sep
(16) |
Oct
(5) |
Nov
(3) |
Dec
(10) |
2009 |
Jan
(11) |
Feb
(2) |
Mar
|
Apr
(15) |
May
(31) |
Jun
(18) |
Jul
(11) |
Aug
(26) |
Sep
(52) |
Oct
(17) |
Nov
(4) |
Dec
|
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@ww...> - 2004-08-07 01:39:04
|
Author: mkrose Date: 2004-08-06 18:38:55 -0700 (Fri, 06 Aug 2004) New Revision: 1200 Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Source/Views/CameraAgent.cpp Log: Fixed camera panning limit calculation that keeps the camera above ground in external views. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1200 Modified: trunk/CSP/CSPSim/CHANGES.current =================================================================== --- trunk/CSP/CSPSim/CHANGES.current 2004-08-07 01:35:17 UTC (rev 1199) +++ trunk/CSP/CSPSim/CHANGES.current 2004-08-07 01:38:55 UTC (rev 1200) @@ -14,6 +14,9 @@ * Cleaned up formatting, copyright notices, and logging in some of the network code. + * Fixed camera panning limit calculation that keeps the camera above + ground in external views. + 2004-07-29: onsight * Removed a couple obsolete files from the Makefile, and added InputEvent. Modified: trunk/CSP/CSPSim/Source/Views/CameraAgent.cpp =================================================================== --- trunk/CSP/CSPSim/Source/Views/CameraAgent.cpp 2004-08-07 01:35:17 UTC (rev 1199) +++ trunk/CSP/CSPSim/Source/Views/CameraAgent.cpp 2004-08-07 01:38:55 UTC (rev 1200) @@ -1,20 +1,20 @@ -// Combat Simulator Project - FlightSim Demo +// Combat Simulator Project - FlightSim Demo // Copyright (C) 2004 The Combat Simulator Project // http://csp.sourceforge.net -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, +// +// This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** @@ -30,6 +30,7 @@ #include "VirtualScene.h" #include "Views/CameraCommand.h" + CameraAgent::CameraAgent(const ViewFactory& vf): m_ViewMode(0) { vf.attachAllView(this); @@ -50,6 +51,8 @@ TerrainObject::IntersectionHint camera_hint = 0; double const SAFETY = 3.0; float h = SAFETY + terrain->getGroundElevation(m_EyePoint.x(),m_EyePoint.y(),camera_hint); + // if the eyepoint is near the ground, check more carefully that the terrain isn't + // clipped by the near-clipping plane. if (m_EyePoint.z() < h) { double alpha_2 = simdata::toRadians(0.5*scene->getViewAngle()); double near_dist = scene->getNearPlane(); @@ -60,26 +63,49 @@ double tan_alpha_2 = tan(alpha_2); simdata::Vector3 right_unit = eye_look_unit^up_vec_unit; - double min_elev = 0.0; - // iterate on the pyramide edges + simdata::Vector3 min_edge; + double min_elev = 1.0; + // iterate over the corners of the rectangle defined by the intersection + // of the near clipping plane and the view frustum; find the lowest + // corner. for (double i = -1.0; i <= 1.0; i += 2.0) for (double j = -1.0;j <= 1.0; j += 2.0) { - simdata::Vector3 edge_vector = near_dist * (eye_look_unit + simdata::Vector3 edge_vector = near_dist * (eye_look_unit + tan_alpha_2 * ( i * up_vec_unit + j * aspect * right_unit)); simdata::Vector3 edge = m_EyePoint + edge_vector; double edge_elev = edge.z()-terrain->getGroundElevation(edge.x(),edge.y(),camera_hint); - if (min_elev > edge_elev) + if (min_elev > edge_elev) { min_elev = edge_elev; + min_edge = edge; + } } - double dh = abs(h - m_LookPoint.z() - min_elev); - double angle_x = std::max(simdata::toRadians(1.0),asin(dh/m_CameraKinematics.getDistance())); - // XXX: transform to Fresnet frame - if (abs(m_CameraKinematics.getPhi()) < simdata::PI_2) - m_CameraKinematics.setPhi(angle_x); - else - m_CameraKinematics.setPhi(simdata::PI-angle_x); - m_CameraKinematics.panUpDownStop(); - m_ViewList[m_ViewMode]->recalculate(m_EyePoint,m_LookPoint,m_UpVector,dt); + // if the lowest corner is near or below the terrain, the terrain may be + // clipped (revealing the void underneath); rotate the view up to prevent + // this from happening. + if (min_elev < 0.1) { + simdata::Vector3 rotvec = m_LookPoint - min_edge; + // project back onto the plane defined by L-E and Up + rotvec -= dot(rotvec, right_unit) * right_unit; + double R = rotvec.normalize(); + // distance to raise the lowest clip point (to 10cm above the terrain). + double dh = 0.1 - min_elev; + // angle from the lookpoint to the lowest clip point, relative to x-y plane. + double phi = asin(-rotvec.z()); + // angle to rotate the view in order to bring the lowest clip point up to + // the terrain height (+10cm). + double alpha = std::max(0.0, acos(rotvec.z() - dh/R) - simdata::PI_2 - phi); + if (alpha > 0.0) { + phi = m_CameraKinematics.getPhi(); + // first bring phi into the range -pi..pi + if (dot(rotvec ^ simdata::Vector3::ZAXIS, right_unit) > 0) { + m_CameraKinematics.setPhi(phi + alpha); + } else { + m_CameraKinematics.setPhi(phi - alpha); + } + m_CameraKinematics.panUpDownStop(); + m_ViewList[m_ViewMode]->recalculate(m_EyePoint,m_LookPoint,m_UpVector,dt); + } + } } } @@ -99,8 +125,9 @@ if (view != m_ViewList.end()) { m_CameraKinematics.update(dt); view->second->update(m_EyePoint,m_LookPoint,m_UpVector,dt); - if (!view->second->isInternal()) + if (!view->second->isInternal()) { validate(dt); + } view->second->cull(); } } |
From: <sv...@ww...> - 2004-08-07 01:35:25
|
Author: mkrose Date: 2004-08-06 18:35:17 -0700 (Fri, 06 Aug 2004) New Revision: 1199 Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Include/SimNet/NetworkMessage.h trunk/CSP/CSPSim/Include/SimNet/Networking.h trunk/CSP/CSPSim/Source/ClientNode.cpp trunk/CSP/CSPSim/Source/EchoServerNode.cpp trunk/CSP/CSPSim/Source/RedirectServerNode.cpp Log: Cleaned up formatting, copyright notices, and logging in some of the network code. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1199 Diff omitted (19341 bytes). |
From: <sv...@ww...> - 2004-08-07 01:31:49
|
Author: mkrose Date: 2004-08-06 18:31:39 -0700 (Fri, 06 Aug 2004) New Revision: 1198 Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/Demeter/Terrain.cpp Log: Fixed a pseudo-bug in demeter, which caused terrain height anomalies at the edges of flat and rough terrain blocks. Essentially, when a rough block left the fov and was culled, the triangle fans used to match that block to adjacent blocks at different detail levels would be removed, even though they were still within the field of view. The could cause the apparent terrain height to discontinuously change by tens of cm, even when the camera was close enough that the block was being rendered with maximum detail. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1198 Modified: trunk/CSP/CSPSim/CHANGES.current =================================================================== --- trunk/CSP/CSPSim/CHANGES.current 2004-08-01 13:21:08 UTC (rev 1197) +++ trunk/CSP/CSPSim/CHANGES.current 2004-08-07 01:31:39 UTC (rev 1198) @@ -1,6 +1,16 @@ Version 0.4.0 (in progress) =========================== +2004-08-06: onsight + * Fixed a pseudo-bug in demeter, which caused terrain height anomalies + at the edges of flat and rough terrain blocks. Essentially, when a + rough block left the fov and was culled, the triangle fans used to + match that block to adjacent blocks at different detail levels would + be removed, even though they were still within the field of view. + The could cause the apparent terrain height to discontinuously change + by tens of cm, even when the camera was close enough that the block + was being rendered with maximum detail. + 2004-07-29: onsight * Removed a couple obsolete files from the Makefile, and added InputEvent. Modified: trunk/CSP/Demeter/Terrain.cpp =================================================================== --- trunk/CSP/Demeter/Terrain.cpp 2004-08-01 13:21:08 UTC (rev 1197) +++ trunk/CSP/Demeter/Terrain.cpp 2004-08-07 01:31:39 UTC (rev 1198) @@ -222,15 +222,27 @@ { Box boundingBox; float width = m_Stride * pTerrain->GetVertexSpacing(); - boundingBox.m_Min.x = pTerrain->m_pVertices[m_HomeIndex].x; - boundingBox.m_Min.y = pTerrain->m_pVertices[m_HomeIndex].y; + + // Hack to fix terrain anomalies at block boundaries. If a block is culled, it + // may affect the triangle fans used to join adjacent (visible) blocks with differing + // tessellation levels. By overestimating the bounding box for the culling test, + // we ensure that blocks that are just outside of the field of view will be tesselated + // to the correct level, keeping the visible triangle fans intact. -MR 2004-08-05 + int oversize = width * 2.0; + boundingBox.m_Min.x = pTerrain->m_pVertices[m_HomeIndex].x - oversize; + boundingBox.m_Min.y = pTerrain->m_pVertices[m_HomeIndex].y - oversize; boundingBox.m_Min.z = m_MinElevation; - boundingBox.m_Max.x = boundingBox.m_Min.x + width; - boundingBox.m_Max.y = boundingBox.m_Min.y + width; + boundingBox.m_Max.x = boundingBox.m_Min.x + 2 * oversize + width; + boundingBox.m_Max.y = boundingBox.m_Min.y + 2 * oversize + width; boundingBox.m_Max.z = m_MaxElevation; if ((*pCountStrips < pTerrain->m_MaxNumberOfPrimitives) && pTerrain->CuboidInFrustum(boundingBox)) { + // restore the bounding box to the correct size for estimating tessellation level. + boundingBox.m_Min.x = pTerrain->m_pVertices[m_HomeIndex].x; + boundingBox.m_Min.y = pTerrain->m_pVertices[m_HomeIndex].y; + boundingBox.m_Max.x = boundingBox.m_Min.x + width; + boundingBox.m_Max.y = boundingBox.m_Min.y + width; if (m_Stride == 2) { int offset; @@ -3059,6 +3071,7 @@ } + m_fThreshold = 8.0; m_szBaseName = new char[strlen(szBaseName)+1]; sprintf(m_szBaseName,szBaseName); m_szExtensionElev = new char[strlen(szExtensionElev)+1]; @@ -3349,8 +3362,9 @@ m_TerrainWidth = pTerrain->GetWidth(); m_TerrainHeight = pTerrain->GetHeight(); } - if (pTerrain) + if (pTerrain) { pTerrain->SetDetailThreshold(m_fThreshold); + } AddTerrain(pTerrain,indexX,indexY); } |
From: <sv...@ww...> - 2004-08-01 13:21:15
|
Author: wolverine Date: 2004-08-01 06:21:08 -0700 (Sun, 01 Aug 2004) New Revision: 1197 Modified: trunk/CSP/CSPSim/Source/DynamicObject.cpp Log: formatting changes Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1197 Modified: trunk/CSP/CSPSim/Source/DynamicObject.cpp =================================================================== --- trunk/CSP/CSPSim/Source/DynamicObject.cpp 2004-08-01 03:31:42 UTC (rev 1196) +++ trunk/CSP/CSPSim/Source/DynamicObject.cpp 2004-08-01 13:21:08 UTC (rev 1197) @@ -388,76 +388,73 @@ } -NetworkMessage * DynamicObject::getUpdateMessage() -{ - CSP_LOG(APP, DEBUG, "DynamicObject::getUpdateMessage()"); - unsigned short messageType = 2; - unsigned short payloadLen = sizeof(int) + sizeof(double) + 3*sizeof(simdata::Vector3) + +NetworkMessage * DynamicObject::getUpdateMessage() { + CSP_LOG(APP, DEBUG, "DynamicObject::getUpdateMessage()"); + unsigned short messageType = 2; + unsigned short payloadLen = sizeof(int) + sizeof(double) + 3*sizeof(simdata::Vector3) + sizeof(simdata::Quat) /* + sizeof(simdata::Matrix3) + sizeof(double) */; - NetworkMessage * message = CSPSim::theSim->getNetworkMessenger()->allocMessageBuffer(messageType, payloadLen); + NetworkMessage * message = CSPSim::theSim->getNetworkMessenger()->allocMessageBuffer(messageType, payloadLen); - ObjectUpdateMessagePayload * ptrPayload = (ObjectUpdateMessagePayload*)message->getPayloadPtr(); - ptrPayload->id = m_ID; - ptrPayload->timeStamp = CSPSim::theSim->getElapsedTime(); - b_GlobalPosition->value().writeBinary((unsigned char *)&(ptrPayload->globalPosition),24); - b_LinearVelocity->value().writeBinary((unsigned char *)&(ptrPayload->linearVelocity),24); - b_AngularVelocity->value().writeBinary((unsigned char *)&(ptrPayload->angularVelocity),24); - b_Attitude->value().writeBinary((unsigned char *)&(ptrPayload->attitude),32); - -// simdata::MemoryWriter writer((simdata::uint8*)ptrPayload); -// writer << m_ID; -// writer << m_Type; -// writer << CSPSim::theSim->getElapsedTime(); -// b_GlobalPosition->value().serialize(writer); -// b_LinearVelocity->value().serialize(writer); -// b_AngularVelocity->value().serialize(writer); -// b_Attitude->value().serialize(writer); + ObjectUpdateMessagePayload * ptrPayload = (ObjectUpdateMessagePayload*)message->getPayloadPtr(); + ptrPayload->id = m_ID; + ptrPayload->timeStamp = CSPSim::theSim->getElapsedTime(); + b_GlobalPosition->value().writeBinary((unsigned char *)&(ptrPayload->globalPosition),24); + b_LinearVelocity->value().writeBinary((unsigned char *)&(ptrPayload->linearVelocity),24); + b_AngularVelocity->value().writeBinary((unsigned char *)&(ptrPayload->angularVelocity),24); + b_Attitude->value().writeBinary((unsigned char *)&(ptrPayload->attitude),32); + + // simdata::MemoryWriter writer((simdata::uint8*)ptrPayload); + // writer << m_ID; + // writer << m_Type; + // writer << CSPSim::theSim->getElapsedTime(); + // b_GlobalPosition->value().serialize(writer); + // b_LinearVelocity->value().serialize(writer); + // b_AngularVelocity->value().serialize(writer); + // b_Attitude->value().serialize(writer); - CSP_LOG(APP, DEBUG, "DynamicObject::getUpdateMessage() - returning message"); + CSP_LOG(APP, DEBUG, "DynamicObject::getUpdateMessage() - returning message"); - - return message; + return message; } -void DynamicObject::putUpdateMessage(NetworkMessage* message) -{ - // read message +void DynamicObject::putUpdateMessage(NetworkMessage* message) { + // read message - ObjectUpdateMessagePayload * ptrPayload = (ObjectUpdateMessagePayload*)message->getPayloadPtr(); - // verify we have the correct id in the packet for this object. - if (m_ID == ptrPayload->id) - { -// printf("Loading update message of object %d\n", m_ID); - } - else - { -// printf("Error loading update message, object id (%d) does not match\n", idValue); - } + ObjectUpdateMessagePayload * ptrPayload = (ObjectUpdateMessagePayload*)message->getPayloadPtr(); + // verify we have the correct id in the packet for this object. + if (m_ID == ptrPayload->id) + { + // printf("Loading update message of object %d\n", m_ID); + } + else + { + // printf("Error loading update message, object id (%d) does not match\n", idValue); + } - // we can disregard this message if the timestamp is older then the most - // recent update. + // we can disregard this message if the timestamp is older then the most + // recent update. - ptrPayload->timeStamp = CSPSim::theSim->getElapsedTime(); - // - //load the other values. - b_GlobalPosition->value().readBinary((unsigned char*)&(ptrPayload->globalPosition),24); - b_LinearVelocity->value().readBinary((unsigned char *)&(ptrPayload->linearVelocity),24); - b_AngularVelocity->value().readBinary((unsigned char *)&(ptrPayload->angularVelocity),24); - b_Attitude->value().readBinary((unsigned char *)&(ptrPayload->attitude),32); + ptrPayload->timeStamp = CSPSim::theSim->getElapsedTime(); + // + //load the other values. + b_GlobalPosition->value().readBinary((unsigned char*)&(ptrPayload->globalPosition),24); + b_LinearVelocity->value().readBinary((unsigned char *)&(ptrPayload->linearVelocity),24); + b_AngularVelocity->value().readBinary((unsigned char *)&(ptrPayload->angularVelocity),24); + b_Attitude->value().readBinary((unsigned char *)&(ptrPayload->attitude),32); -// unsigned int _id; -// unsigned _type; -// float _timestamp; -// -// simdata::MemoryReader reader((simdata::uint8*)ptrPayload); -// reader >> _id; -// reader >> _type; -// reader >> _timestamp; -// b_GlobalPosition->value().serialize(reader); -// b_LinearVelocity->value().serialize(reader); -// b_AngularVelocity->value().serialize(reader); -// b_Attitude->value().serialize(reader); + // unsigned int _id; + // unsigned _type; + // float _timestamp; + // + // simdata::MemoryReader reader((simdata::uint8*)ptrPayload); + // reader >> _id; + // reader >> _type; + // reader >> _timestamp; + // b_GlobalPosition->value().serialize(reader); + // b_LinearVelocity->value().serialize(reader); + // b_AngularVelocity->value().serialize(reader); + // b_Attitude->value().serialize(reader); } |
From: <sv...@ww...> - 2004-08-01 03:31:49
|
Author: wolverine Date: 2004-07-31 20:31:42 -0700 (Sat, 31 Jul 2004) New Revision: 1196 Modified: trunk/CSP/CSPSim/Source/ClientNode.cpp trunk/CSP/CSPSim/Source/SimNet/RedirectMessageHandler.cpp Log: formatting changes Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1196 Diff omitted (18657 bytes). |
From: <sv...@ww...> - 2004-08-01 03:09:32
|
Author: wolverine Date: 2004-07-31 20:09:26 -0700 (Sat, 31 Jul 2004) New Revision: 1195 Modified: trunk/CSP/CSPSim/Source/DynamicObject.cpp Log: formatting changes Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1195 Modified: trunk/CSP/CSPSim/Source/DynamicObject.cpp =================================================================== --- trunk/CSP/CSPSim/Source/DynamicObject.cpp 2004-08-01 03:08:52 UTC (rev 1194) +++ trunk/CSP/CSPSim/Source/DynamicObject.cpp 2004-08-01 03:09:26 UTC (rev 1195) @@ -1,17 +1,17 @@ // Combat Simulator Project - FlightSim Demo // Copyright (C) 2002 The Combat Simulator Project // http://csp.sourceforge.net -// +// // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -117,7 +117,7 @@ // and use the local elevation (not implemented) // FIXME FIXME FIXME XXX XXX float offset = 0.0; - z = offset; + z = offset; } b_GlobalPosition->value() = simdata::Vector3(x, y, z); } @@ -147,7 +147,7 @@ VirtualBattlefield const *battlefield = sim->getBattlefield(); assert(battlefield); simdata::Vector3 &pos = b_GlobalPosition->value(); - pos.z() = battlefield->getGroundElevation(pos.x(), pos.y(), m_GroundHint) + offset; + pos.z() = battlefield->getGroundElevation(pos.x(), pos.y(), m_GroundHint) + offset; } @@ -203,7 +203,7 @@ b_GroundZ->value() = battlefield->getGroundElevation( b_GlobalPosition->value().x(), b_GlobalPosition->value().y(), - b_GroundN->value(), + b_GroundN->value(), m_GroundHint ); double height = (b_GlobalPosition->value().z() - b_GroundZ->value()) * b_GroundN->value().z(); @@ -368,7 +368,7 @@ if (InputInterface::onMapEvent(event)) { return true; } -if (m_SystemsModel.valid() && m_SystemsModel->onMapEvent(event)) { + if (m_SystemsModel.valid() && m_SystemsModel->onMapEvent(event)) { return true; } return false; |
From: <sv...@ww...> - 2004-08-01 03:08:59
|
Author: wolverine Date: 2004-07-31 20:08:52 -0700 (Sat, 31 Jul 2004) New Revision: 1194 Modified: trunk/CSP/CSPSim/Include/SimNet/Networking.h Log: formatting changes Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1194 Modified: trunk/CSP/CSPSim/Include/SimNet/Networking.h =================================================================== --- trunk/CSP/CSPSim/Include/SimNet/Networking.h 2004-07-29 04:05:19 UTC (rev 1193) +++ trunk/CSP/CSPSim/Include/SimNet/Networking.h 2004-08-01 03:08:52 UTC (rev 1194) @@ -1,17 +1,17 @@ // Combat Simulator Project - FlightSim Demo // Copyright (C) 2002 The Combat Simulator Project // http://csp.sourceforge.net -// +// // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -59,23 +59,23 @@ #pragma pack(push, 1) //#endif - + // Define some structs that will only used for data transfers. // These differ from SimData structs in that they have no virtual // functions and hence have more predictable binary sizes. struct _Vector3Struct { - double x; - double y; - double z; + double x; + double y; + double z; }; struct _QuatStruct { - double x; - double y; - double z; - double w; + double x; + double y; + double z; + double w; }; @@ -135,7 +135,7 @@ { // private: // static NetworkMessage * g_messagePool; -// +// // public: // NetworkMessage * getMessageFromPool(int type, int payloadLen); // NetworkMessage * getMessageFromPool(); @@ -156,7 +156,7 @@ class DynamicObject; -//class RemoteObjectWrapper +//class RemoteObjectWrapper //{ // public: // RemoteObjectWrapper(simdata::Ref<DynamicObject> & object) { m_Object = object; } @@ -165,43 +165,57 @@ // private: // simdata::Ref<DynamicObject> m_Object; // NetworkNode * m_Host; -// // +// //}; class RemoteObjectKey { - protected: - int m_ipaddr; - short m_port; - int m_id; +protected: + int m_ipaddr; + short m_port; + int m_id; - public: - RemoteObjectKey() { m_ipaddr = 0; m_port = 0; m_id = 0; } - - RemoteObjectKey(const RemoteObjectKey & key) - { m_ipaddr = key.m_ipaddr; m_port = key.m_port; m_id = key.m_id; } - - RemoteObjectKey(int ipaddr, short port, int id) - { m_ipaddr = ipaddr; m_port = port; m_id = id; } +public: + RemoteObjectKey() { + m_ipaddr = 0; + m_port = 0; + m_id = 0; + } - const RemoteObjectKey & operator=(const RemoteObjectKey & key) - { - m_ipaddr = key.m_ipaddr; m_port = key.m_port; m_id = key.m_id; - return *this; - } + RemoteObjectKey(const RemoteObjectKey & key) { + m_ipaddr = key.m_ipaddr; + m_port = key.m_port; + m_id = key.m_id; + } + RemoteObjectKey(int ipaddr, short port, int id) { + m_ipaddr = ipaddr; + m_port = port; + m_id = id; + } - bool operator==(const RemoteObjectKey & key) - { return ( (m_ipaddr == key.m_ipaddr) && (m_port == key.m_port) && (m_id == key.m_id) ); } - - bool operator!=(const RemoteObjectKey & key) - { return ( (m_ipaddr != key.m_ipaddr) || (m_port != key.m_port) || (m_id == key.m_id) ); } +#ifndef SWIG + const RemoteObjectKey & operator=(const RemoteObjectKey & key) { + m_ipaddr = key.m_ipaddr; m_port = key.m_port; m_id = key.m_id; + return *this; + } +#endif // SWIG - friend bool operator<( const RemoteObjectKey & lhs, const RemoteObjectKey & rhs); + bool operator==(const RemoteObjectKey & key) { + return ( (m_ipaddr == key.m_ipaddr) && (m_port == key.m_port) && (m_id == key.m_id) ); + } + + bool operator!=(const RemoteObjectKey & key) { + return ( (m_ipaddr != key.m_ipaddr) || (m_port != key.m_port) || (m_id == key.m_id) ); + } - // bool operator>( RemoteObjectKey & key) -// { +#ifndef SWIG + friend bool operator<( const RemoteObjectKey & lhs, const RemoteObjectKey & rhs); +#endif // SWIG + +// bool operator>( RemoteObjectKey & key) +// { // if ( m_ipaddr != key.m_ipaddr ) // return ( m_ipaddr > key.m_ipaddr); // if ( m_port != key.m_port ) @@ -209,7 +223,7 @@ // return ( m_id > key.m_id ); // } // bool operator<=( RemoteObjectKey & key) -// { +// { // if ( m_ipaddr != key.m_ipaddr ) // return ( m_ipaddr <= key.m_ipaddr); // if ( m_port != key.m_port ) @@ -217,7 +231,7 @@ // return ( m_id <= key.m_id ); // } // bool operator>=( RemoteObjectKey & key) -// { +// { // if ( m_ipaddr != key.m_ipaddr ) // return ( m_ipaddr >= key.m_ipaddr); // if ( m_port != key.m_port ) @@ -227,26 +241,26 @@ }; +#ifndef SWIG bool operator<( const RemoteObjectKey & lhs, const RemoteObjectKey & rhs); +#endif // SWIG class RemoteObjectTable { - public: - simdata::Ref<DynamicObject> getRemoteObject(RemoteObjectKey key) - { - printf("RemoteObjectTable::getRemoteObject()\n"); - return m_table[key]; - } +public: + simdata::Ref<DynamicObject> getRemoteObject(RemoteObjectKey key) { + CSP_LOG(NETWORK, TRACE, "RemoteObjectTable::getRemoteObject()"); + return m_table[key]; + } - void putRemoteObject(RemoteObjectKey key, simdata::Ref<DynamicObject> object) - { - printf("RemoteObjectTable::putRemoteObject() - entering\n"); - m_table[key] = object; - printf("RemoteObjectTable::putRemoteObject() - exiting\n"); - } + void putRemoteObject(RemoteObjectKey key, simdata::Ref<DynamicObject> object) { + CSP_LOG(NETWORK, TRACE, "RemoteObjectTable::putRemoteObject() - entering"); + m_table[key] = object; + CSP_LOG(NETWORK, TRACE, "RemoteObjectTable::putRemoteObject() - exiting"); + } - private: - std::map< RemoteObjectKey, simdata::Ref<DynamicObject> > m_table; +private: + std::map< RemoteObjectKey, simdata::Ref<DynamicObject> > m_table; }; @@ -254,15 +268,13 @@ class CallHandler { - private: - NetworkMessage* m_NetworkMessage; - public: - CallHandler(NetworkMessage* network_message): - m_NetworkMessage(network_message) { } - void operator()(NetworkMessageHandler* network_message_handler) - { - network_message_handler->process(m_NetworkMessage); - } +private: + NetworkMessage* m_NetworkMessage; +public: + CallHandler(NetworkMessage* network_message): m_NetworkMessage(network_message) { } + void operator()(NetworkMessageHandler* network_message_handler) { + network_message_handler->process(m_NetworkMessage); + } }; |
From: <sv...@ww...> - 2004-07-29 04:05:26
|
Author: mkrose Date: 2004-07-28 21:05:19 -0700 (Wed, 28 Jul 2004) New Revision: 1193 Added: trunk/CSP/CSPSim/Data/Models/Runway/runway01.jpg Removed: trunk/CSP/CSPSim/Data/Models/Runway/RUNWAY.jpg Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Data/Models/Runway/runway01.osg trunk/CSP/CSPSim/Source/InputEvent.cpp trunk/CSP/CSPSim/Source/Makefile.in trunk/CSP/CSPSim/Source/ObjectModel.cpp trunk/CSP/CSPSim/Source/Theater/RandomBillboardModel.cpp trunk/CSP/CSPSim/Tools/Terrain/dem2dat/Makefile trunk/CSP/CSPSim/Tools/Terrain/tile/Makefile Log: Removed a couple obsolete files from the Makefile, and added InputEvent. Added missing std:: prefix in InputEvent.cpp. Fixed a compiler warning in RandomBillboardModel. Temporary hack to CSPSim/Tools/Terrain/*/Makefile to find SimData in relative path. These build files are in poor shape. Renamed Data/Models/Runway/RUNWAY.jpg to runway01.jpg. The OSG model loader was tripping on case sensitivity. Reordered the static constructor calls in ObjectModel.cpp. There's an ugly bug in the way that Enum<> and Enumeration bind as far as static construction goes. The Enumeration of an Enum<> must be created first, but this isn't guaranteed for static constructors (as in a class static Enumeration and the static ObjectInterface for importing Enum<> values from XML (which is a common case). This "fix" may break under Windows (you'll see an assert in Enum.h if so). Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1193 Modified: trunk/CSP/CSPSim/CHANGES.current =================================================================== --- trunk/CSP/CSPSim/CHANGES.current 2004-07-28 23:34:50 UTC (rev 1192) +++ trunk/CSP/CSPSim/CHANGES.current 2004-07-29 04:05:19 UTC (rev 1193) @@ -1,6 +1,32 @@ Version 0.4.0 (in progress) =========================== +2004-07-29: onsight + * Removed a couple obsolete files from the Makefile, and added InputEvent. + + * Added missing std:: prefix in InputEvent.cpp. + + * Fixed a compiler warning in RandomBillboardModel. + + * Temporary hack to CSPSim/Tools/Terrain/*/Makefile to find SimData in + relative path. These build files are in poor shape. + + * Renamed Data/Models/Runway/RUNWAY.jpg to runway01.jpg. The OSG model + loader was tripping on case sensitivity. + + * Reordered the static constructor calls in ObjectModel.cpp. There's an + ugly bug in the way that Enum<> and Enumeration bind as far as static + construction goes. The Enumeration of an Enum<> must be created first, + but this isn't guaranteed for static constructors (as in a class static + Enumeration and the static ObjectInterface for importing Enum<> values + from XML (which is a common case). This "fix" may break under Windows + (you'll see an assert in Enum.h if so). + + * Added Terrain link on my local client. Right now we die when the + terrain files aren't found without printing a helpful diagnostic + message. You can track down the cause in the logs (below level 5), + but this isn't a great way to handle a common failure mode. + 2004-07-29: delta * Added a filter_value member in ObjectModel's interface. Deleted: trunk/CSP/CSPSim/Data/Models/Runway/RUNWAY.jpg =================================================================== (Binary files differ) Copied: trunk/CSP/CSPSim/Data/Models/Runway/runway01.jpg (from rev 1192, trunk/CSP/CSPSim/Data/Models/Runway/RUNWAY.jpg) Modified: trunk/CSP/CSPSim/Data/Models/Runway/runway01.osg =================================================================== --- trunk/CSP/CSPSim/Data/Models/Runway/runway01.osg 2004-07-28 23:34:50 UTC (rev 1192) +++ trunk/CSP/CSPSim/Data/Models/Runway/runway01.osg 2004-07-29 04:05:19 UTC (rev 1193) @@ -88,7 +88,7 @@ GL_TEXTURE_2D ON Texture2D { DataVariance STATIC - file "RUNWAY.JPG" + file "runway01.jpg" wrap_s REPEAT wrap_t REPEAT wrap_r REPEAT Modified: trunk/CSP/CSPSim/Source/InputEvent.cpp =================================================================== --- trunk/CSP/CSPSim/Source/InputEvent.cpp 2004-07-28 23:34:50 UTC (rev 1192) +++ trunk/CSP/CSPSim/Source/InputEvent.cpp 2004-07-29 04:05:19 UTC (rev 1193) @@ -71,17 +71,17 @@ bool Replay::operator()(SDL_Event& event) { SDL_Event e; - bool result = SDL_PollEvent(&e) !=0; + bool result = SDL_PollEvent(&e) != 0; if (e.type != SDL_QUIT && (e.type != SDL_KEYDOWN || e.key.keysym.sym != SDLK_ESCAPE)) { float d2 = CSPSim::theSim->getElapsedTime(); if (d2 - m_EventTime > 2*m_Sampling) { m_if.read(reinterpret_cast<char*>(&event),sizeof(SDL_Event)); m_if.read(reinterpret_cast<char*>(&m_EventTime),sizeof(float)); } + } else { + event = e; } - else - event = e; - return true; + return result; } InputEvent::InputEvent() { @@ -99,7 +99,7 @@ break; } } - catch(const exception& e) { + catch(const std::exception& e) { std::cerr << "\nException caught in InputEvent::InputEvent(): " << e.what() << ".\n"; std::cerr << "Using play handle.\n" << std::endl; m_Handle.reset(new Play); Modified: trunk/CSP/CSPSim/Source/Makefile.in =================================================================== --- trunk/CSP/CSPSim/Source/Makefile.in 2004-07-28 23:34:50 UTC (rev 1192) +++ trunk/CSP/CSPSim/Source/Makefile.in 2004-07-29 04:05:19 UTC (rev 1193) @@ -39,7 +39,6 @@ AircraftPhysicsModel.cpp \ Animation.cpp \ Atmosphere.cpp \ - base.cpp \ BaseDynamics.cpp \ BaseScreen.cpp \ ChunkLodTerrain.cpp \ @@ -63,6 +62,7 @@ FlightModel.cpp \ GameScreen.cpp \ HID.cpp \ + InputEvent.cpp \ InputInterface.cpp \ KineticsChannels.cpp \ LandingGear.cpp \ @@ -108,7 +108,6 @@ Theater/RandomBillboardModel.cpp \ Theater/RandomForestModel.cpp \ Tools.cpp \ - trees.cpp \ Views/CameraAgent.cpp \ Views/CameraKinematics.cpp \ Views/View.cpp \ Modified: trunk/CSP/CSPSim/Source/ObjectModel.cpp =================================================================== --- trunk/CSP/CSPSim/Source/ObjectModel.cpp 2004-07-28 23:34:50 UTC (rev 1192) +++ trunk/CSP/CSPSim/Source/ObjectModel.cpp 2004-07-29 04:05:19 UTC (rev 1193) @@ -61,6 +61,9 @@ */ + +const simdata::Enumeration ObjectModel::EffectItems("None SpecularHighlights"); + SIMDATA_REGISTER_INTERFACE(ObjectModel) @@ -199,8 +202,6 @@ std::string g_ModelPath = ""; -const simdata::Enumeration ObjectModel::EffectItems("None SpecularHighlights"); - ObjectModel::ObjectModel(): simdata::Object() { m_Axis0 = simdata::Vector3::XAXIS; m_Axis1 = simdata::Vector3::ZAXIS; Modified: trunk/CSP/CSPSim/Source/Theater/RandomBillboardModel.cpp =================================================================== --- trunk/CSP/CSPSim/Source/Theater/RandomBillboardModel.cpp 2004-07-28 23:34:50 UTC (rev 1192) +++ trunk/CSP/CSPSim/Source/Theater/RandomBillboardModel.cpp 2004-07-29 04:05:19 UTC (rev 1193) @@ -96,8 +96,8 @@ END_SIMDATA_XML_INTERFACE RectangularCurve(float width = 20.0f, float height = 50.0f): - m_Width(width != 0.0f ? abs(width) : 20.0f), - m_Height(height != 0.0f ? abs(height) : 50.0f) { + m_Width(width != 0.0f ? fabs(width) : 20.0f), + m_Height(height != 0.0f ? fabs(height) : 50.0f) { if (width * height == 0.0f) { CSP_LOG(APP, WARNING, "Rectangle: [" << width << "," << height << "corrected to 20x50]"); } Modified: trunk/CSP/CSPSim/Tools/Terrain/dem2dat/Makefile =================================================================== --- trunk/CSP/CSPSim/Tools/Terrain/dem2dat/Makefile 2004-07-28 23:34:50 UTC (rev 1192) +++ trunk/CSP/CSPSim/Tools/Terrain/dem2dat/Makefile 2004-07-29 04:05:19 UTC (rev 1193) @@ -1,21 +1,22 @@ -PYTHONLIB = /usr/lib/python2.3/site-packages -PYTHONINC = /usr/include/python2.3 +CSP_PATH = ../../../.. +SIMDATA_INC = $(CSP_PATH)/SimData/Include +SIMDATA_LIB = $(CSP_PATH)/SimData/SimData CXX = g++ -CXXFLAGS = -O2 -g -W -Wall +CXXFLAGS = -O2 -g -W -Wall -I$(SIMDATA_INC) SWIG = swig all: dem2dat dem2dat: dem2dat.cpp dem2dat.h - $(CXX) $(CXXFLAGS) dem2dat.cpp -o dem2dat -I$(PYTHONINC) -L$(PYTHONLIB)/SimData -lSimData -lz + $(CXX) $(CXXFLAGS) dem2dat.cpp -o dem2dat -L$(SIMDATA_LIB) -lSimData -lz -lpthread python: dem2dat_wrap.o - $(CXX) -shared -lswigpy -ldl -o _dem2dat.so dem2dat_wrap.o -L$(PYTHONLIB)/SimData -lSimData -lz + $(CXX) -shared -lswigpy -ldl -o _dem2dat.so dem2dat_wrap.o -L$(SIMDATA_LIB) -lSimData -lz dem2dat_wrap.o: dem2dat_wrap.cxx - $(CXX) -c -fPIC $(CXXFLAGS) dem2dat_wrap.cxx -I$(PYTHONINC) + $(CXX) -c -fPIC $(CXXFLAGS) dem2dat_wrap.cxx dem2dat_wrap.cxx: dem2dat.i dem2dat.h - $(SWIG) -c -c++ -python -noexcept -I$(PYTHONINC) dem2dat.i + $(SWIG) -c -c++ -python -noexcept dem2dat.i Modified: trunk/CSP/CSPSim/Tools/Terrain/tile/Makefile =================================================================== --- trunk/CSP/CSPSim/Tools/Terrain/tile/Makefile 2004-07-28 23:34:50 UTC (rev 1192) +++ trunk/CSP/CSPSim/Tools/Terrain/tile/Makefile 2004-07-29 04:05:19 UTC (rev 1193) @@ -1,9 +1,10 @@ -PYTHONLIB = /usr/lib/python2.2/site-packages -PYTHONINC = /usr/include/python2.2 +CSP_PATH = ../../../.. +SIMDATA_INC = $(CSP_PATH)/SimData/Include +SIMDATA_LIB = $(CSP_PATH)/SimData/SimData all: csptile csptile: tile.cpp - g++ -W -Wall -O2 -g $^ -o $@ -I$(PYTHONINC) -L$(PYTHONLIB)/SimData -lSimData -lz + g++ -W -Wall -O2 -g $^ -o $@ -I$(SIMDATA_INC) -L$(SIMDATA_LIB) -lSimData -lz -lpthread |
From: <sv...@ww...> - 2004-07-28 23:37:40
|
Author: delta Date: 2004-07-28 16:34:50 -0700 (Wed, 28 Jul 2004) New Revision: 1192 Added: trunk/CSP/CSPSim/Data/Images/Smoke/ trunk/CSP/CSPSim/Data/Images/Smoke/white-smoke-hilite.rgb trunk/CSP/CSPSim/Data/Images/Smoke/white-smoke-hilite.rgb.COPYING Removed: trunk/CSP/CSPSim/Data/Images/white-smoke-hilite.rgb trunk/CSP/CSPSim/Data/Images/white-smoke-hilite.rgb.COPYING Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Data/Models/Mirage2000/COPYING trunk/CSP/CSPSim/Data/Models/Mirage2000/derive.jpg trunk/CSP/CSPSim/Data/Models/Mirage2000/fuse.jpg trunk/CSP/CSPSim/Data/Models/Mirage2000/fuseg.jpg trunk/CSP/CSPSim/Data/Models/Mirage2000/model.osg trunk/CSP/CSPSim/Data/XML/vehicles/aircraft/m2k/gear.xml trunk/CSP/CSPSim/Data/XML/vehicles/aircraft/m2k/model.xml trunk/CSP/CSPSim/Include/AircraftObject.h trunk/CSP/CSPSim/Include/Animation.h trunk/CSP/CSPSim/Include/DynamicObject.h trunk/CSP/CSPSim/Include/LandingGear.h trunk/CSP/CSPSim/Include/ObjectModel.h trunk/CSP/CSPSim/Source/AircraftObject.cpp trunk/CSP/CSPSim/Source/Animation.cpp trunk/CSP/CSPSim/Source/LandingGear.cpp trunk/CSP/CSPSim/Source/ObjectModel.cpp trunk/CSP/CSPSim/Source/VirtualScene.cpp Log: Mainly ObjectModel and Animations changes. Reenabled basic smoke effect (need to write a SmokeEmitter class). Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1192 Diff omitted (3955000 bytes). |
Author: delta Date: 2004-07-28 16:20:10 -0700 (Wed, 28 Jul 2004) New Revision: 1191 Added: trunk/CSP/CSPSim/Data/Images/Logo/ trunk/CSP/CSPSim/Data/Images/Logo/CSPLogo.jpg trunk/CSP/CSPSim/Data/Images/Logo/TLabMultitex.jpg trunk/CSP/CSPSim/Data/Images/Logo/console2.jpg trunk/CSP/CSPSim/Data/Images/Logo/crescent.jpg trunk/CSP/CSPSim/Data/Images/Logo/fx2.jpeg trunk/CSP/CSPSim/Data/Images/Logo/fx2.jpg trunk/CSP/CSPSim/Data/Images/Logo/ground-fog.jpg trunk/CSP/CSPSim/Data/Images/Logo/landing-2.jpg trunk/CSP/CSPSim/Data/Images/Logo/moonrise1.jpg trunk/CSP/CSPSim/Data/Images/Logo/sunlight2.jpg trunk/CSP/CSPSim/Data/Images/Logo/sunset4.jpg trunk/CSP/CSPSim/Data/Images/Logo/vista.jpg trunk/CSP/CSPSim/Data/Images/Trees/ trunk/CSP/CSPSim/Data/Images/Trees/tree0.rgba trunk/CSP/CSPSim/Data/Images/Trees/tree5.png trunk/CSP/CSPSim/Data/Images/Trees/tree6.png Removed: trunk/CSP/CSPSim/Data/Images/CSPLogo.jpg trunk/CSP/CSPSim/Data/Images/TLabMultitex.jpg trunk/CSP/CSPSim/Data/Images/console2.jpg trunk/CSP/CSPSim/Data/Images/crescent.jpg trunk/CSP/CSPSim/Data/Images/fx2.jpeg trunk/CSP/CSPSim/Data/Images/fx2.jpg trunk/CSP/CSPSim/Data/Images/ground-fog.jpg trunk/CSP/CSPSim/Data/Images/landing-2.jpg trunk/CSP/CSPSim/Data/Images/moonrise1.jpg trunk/CSP/CSPSim/Data/Images/sunlight2.jpg trunk/CSP/CSPSim/Data/Images/sunset4.jpg trunk/CSP/CSPSim/Data/Images/vista.jpg Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Data/XML/theater/balkan/airbase.xml trunk/CSP/CSPSim/Data/XML/theater/balkan/forest.xml trunk/CSP/CSPSim/Include/Theater/RandomBillboardModel.h trunk/CSP/CSPSim/Source/LogoScreen.cpp trunk/CSP/CSPSim/Source/Theater/RandomBillboardModel.cpp trunk/CSP/CSPSim/Source/Views/CameraAgent.cpp Log: Added an IsoContour class. Added Images/Trees and Images/Logo. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1191 Diff omitted (73304 bytes). |
From: <sv...@ww...> - 2004-07-27 22:02:07
|
Author: delta Date: 2004-07-27 15:01:55 -0700 (Tue, 27 Jul 2004) New Revision: 1190 Added: trunk/CSP/CSPSim/Data/Images/balkanMapElev.7-7.bmp trunk/CSP/CSPSim/Data/Models/Hangar/ trunk/CSP/CSPSim/Data/Models/Hangar/COPYING trunk/CSP/CSPSim/Data/Models/Hangar/hangar01.3ds trunk/CSP/CSPSim/Data/Models/Hangar/hangar01.jpg trunk/CSP/CSPSim/Data/Models/Runway/ trunk/CSP/CSPSim/Data/Models/Runway/RUNWAY.jpg trunk/CSP/CSPSim/Data/Models/Runway/runway01.osg trunk/CSP/CSPSim/Data/XML/theater/balkan/ trunk/CSP/CSPSim/Data/XML/theater/balkan/airbase.xml trunk/CSP/CSPSim/Data/XML/theater/balkan/forest.xml trunk/CSP/CSPSim/Data/XML/theater/balkan/objectives.xml trunk/CSP/CSPSim/Data/XML/theater/hangar.xml trunk/CSP/CSPSim/Data/XML/theater/hangar/ trunk/CSP/CSPSim/Data/XML/theater/hangar/model.xml trunk/CSP/CSPSim/Source/old/AeroDynamics.cpp trunk/CSP/CSPSim/Source/old/base.cpp trunk/CSP/CSPSim/Source/old/main.cpp trunk/CSP/CSPSim/Source/old/trees.cpp Removed: trunk/CSP/CSPSim/Source/AeroDynamics.cpp trunk/CSP/CSPSim/Source/base.cpp trunk/CSP/CSPSim/Source/main.cpp trunk/CSP/CSPSim/Source/trees.cpp Modified: trunk/CSP/CSPSim/Bin/TestObjects.py trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Data/XML/theater/balkan.xml trunk/CSP/CSPSim/Data/XML/theater/runway/model.xml trunk/CSP/CSPSim/Data/XML/vehicles/aircraft/m2k/systems.xml trunk/CSP/CSPSim/Include/Engine.h trunk/CSP/CSPSim/Include/Log.h trunk/CSP/CSPSim/Include/NumericalMethod.h trunk/CSP/CSPSim/Include/ScreenInfo.h trunk/CSP/CSPSim/Include/System.h trunk/CSP/CSPSim/Include/Systems/AircraftFlightSensors.h trunk/CSP/CSPSim/Include/Systems/AircraftSimpleFCS.h trunk/CSP/CSPSim/Include/Views/CameraAgent.h trunk/CSP/CSPSim/Include/Views/CameraCommand.h trunk/CSP/CSPSim/Include/Views/CameraKinematics.h trunk/CSP/CSPSim/Source/DemeterTerrain.cpp trunk/CSP/CSPSim/Source/DispatchCenter.cpp trunk/CSP/CSPSim/Source/LogoScreen.cpp trunk/CSP/CSPSim/Source/ScreenInfo.cpp trunk/CSP/CSPSim/Source/ScreenInfoManager.cpp trunk/CSP/CSPSim/Source/SmokeEffects.cpp trunk/CSP/CSPSim/Source/Systems/AircraftInputSystem.cpp trunk/CSP/CSPSim/Source/Systems/AircraftSimpleFCS.cpp trunk/CSP/CSPSim/Source/Views/CameraAgent.cpp trunk/CSP/CSPSim/Source/Views/CameraKinematics.cpp trunk/CSP/CSPSim/Source/Views/View.cpp trunk/CSP/CSPSim/Tools/HID/Maps/aircraft-core.map trunk/CSP/CSPSim/VisualStudio/CSPSimDLL/CSPSimDLL.vcproj Log: General clean up Prework for an airbase on balkan terrain. Added limits min & max to AircraftSimpleFCS. Please, carefully read CHANGES.current. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1190 Diff omitted (108263 bytes). |
From: <sv...@ww...> - 2004-07-26 10:13:55
|
Author: delta Date: 2004-07-26 03:13:48 -0700 (Mon, 26 Jul 2004) New Revision: 1189 Modified: trunk/CSP/SimData/CHANGES.current Log: Removed SIMDATA_EXPORT. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1189 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-07-26 10:11:29 UTC (rev 1188) +++ trunk/CSP/SimData/CHANGES.current 2004-07-26 10:13:48 UTC (rev 1189) @@ -1,5 +1,9 @@ Version 0.4.0 (in progress) =========================== + +2004-07-26: delta + * Removed some not needed SIMDATA_EXPORT for vs 7.1. + 2004-07-25: onsight * Add a fast typecast operator to TaggedRecord, which checks record ids and performs a static cast if the ids match. This is much |
From: <sv...@ww...> - 2004-07-26 10:11:35
|
Author: delta Date: 2004-07-26 03:11:29 -0700 (Mon, 26 Jul 2004) New Revision: 1188 Modified: trunk/CSP/SimData/Include/SimData/HashUtility.h trunk/CSP/SimData/Include/SimData/TaggedRecordRegistry.h Log: Removed some unneeded SIMDATA_EXPORT for vs 7.1. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1188 Modified: trunk/CSP/SimData/Include/SimData/HashUtility.h =================================================================== --- trunk/CSP/SimData/Include/SimData/HashUtility.h 2004-07-26 05:16:17 UTC (rev 1187) +++ trunk/CSP/SimData/Include/SimData/HashUtility.h 2004-07-26 10:11:29 UTC (rev 1188) @@ -244,7 +244,7 @@ /** String hash functor for hash_map. */ -struct SIMDATA_EXPORT hashstring { +struct hashstring { static HASH<const char*> h; size_t operator()(const std::string &s) const { return static_cast<size_t>(h(s.c_str())); Modified: trunk/CSP/SimData/Include/SimData/TaggedRecordRegistry.h =================================================================== --- trunk/CSP/SimData/Include/SimData/TaggedRecordRegistry.h 2004-07-26 05:16:17 UTC (rev 1187) +++ trunk/CSP/SimData/Include/SimData/TaggedRecordRegistry.h 2004-07-26 10:11:29 UTC (rev 1188) @@ -67,7 +67,7 @@ * * @author Mark Rose <mr...@st...> */ -class SIMDATA_EXPORT TaggedRecordRegistry: public Singleton<TaggedRecordRegistry> { +class TaggedRecordRegistry: public Singleton<TaggedRecordRegistry> { friend class Singleton<TaggedRecordRegistry>; @@ -159,7 +159,7 @@ /** Factory template for creating TaggedRecord subclasses. */ template <class RECORD> -class SIMDATA_EXPORT TaggedRecordFactory: public TaggedRecordFactoryBase { +class TaggedRecordFactory: public TaggedRecordFactoryBase { public: typedef RECORD RecordType; TaggedRecordFactory(): TaggedRecordFactoryBase() { |
From: <sv...@ww...> - 2004-07-26 05:16:23
|
Author: mkrose Date: 2004-07-25 22:16:17 -0700 (Sun, 25 Jul 2004) New Revision: 1187 Modified: trunk/CSP/SimNet/MessageQueue.h trunk/CSP/SimNet/NetBase.h trunk/CSP/SimNet/NetworkMessage.h trunk/CSP/SimNet/PacketSource.h Log: Add routing type and routing data to PacketHeader and NetworkMessage. The basic idea is that these fields are used by the receiver to help dispatch the message to an object or class that knows how to interpret it. Putting these fields in the header makes sense, since they will be used universally, and it allows the dispatch layer to be ignorant of the message internals. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1187 Modified: trunk/CSP/SimNet/MessageQueue.h =================================================================== --- trunk/CSP/SimNet/MessageQueue.h 2004-07-26 05:11:53 UTC (rev 1186) +++ trunk/CSP/SimNet/MessageQueue.h 2004-07-26 05:16:17 UTC (rev 1187) @@ -69,6 +69,8 @@ PeerId destination = message->getDestination(); header->destination = destination; header->message_id = message->getCustomId(); + header->routing_type = message->getRoutingType(); + header->routing_data = message->getRoutingData(); m_Writer.bind(payload, payload_length); // XXX need to catch overflows message->serialize(m_TagWriter); Modified: trunk/CSP/SimNet/NetBase.h =================================================================== --- trunk/CSP/SimNet/NetBase.h 2004-07-26 05:11:53 UTC (rev 1186) +++ trunk/CSP/SimNet/NetBase.h 2004-07-26 05:16:17 UTC (rev 1187) @@ -40,9 +40,9 @@ */ typedef simdata::uint16 MessageId; -/** A type representing network bandwidth, in bytes per second. +/** A unique object id. (24-bits; 16 million ids) */ -typedef simdata::uint32 Bandwidth; +typedef simdata::uint32 ObjectId; /** An id number assigned to reliable messages and used to confirm * receipt of such messages. Ids are generated sequentially, per @@ -59,17 +59,19 @@ * reliable udp. */ struct PacketHeader { - simdata::uint16 reliable:1; // if true, header is actually a PacketReceiptHeader - simdata::uint16 reserved:2; // reserved for future use - simdata::uint16 priority:2; // 0 = non-realtime, 1=realtime, lopri, 2=realtime, hipri, 3=reliable - simdata::uint16 statmode:1; // 0 = desired send rate, 1 = fractional allocation - simdata::uint16 connstat:10; // if statmode == 0, the desired send rate as a fraction of the - // nominal receiver bandwidth: C * BW / 100 - // if statmode == 1, the fraction of the sender's inbound bandwidth - // allocated to the receiving peer (0->BW) - simdata::uint16 source; // id of the sender - simdata::uint16 destination; // id of the intended receiver - simdata::uint16 message_id; // id of the message + simdata::uint16 reliable:1; // if true, header is actually a PacketReceiptHeader + simdata::uint16 reserved:2; // reserved for future use + simdata::uint16 priority:2; // 0 = non-realtime, 1=realtime, lopri, 2=realtime, hipri, 3=reliable + simdata::uint16 statmode:1; // 0 = desired send rate, 1 = fractional allocation + simdata::uint16 connstat:10; // if statmode == 0, the desired send rate as a fraction of the + // nominal receiver bandwidth: C * BW / 100 + // if statmode == 1, the fraction of the sender's inbound bandwidth + // allocated to the receiving peer (0->BW) + simdata::uint16 source; // id of the sender + simdata::uint16 destination; // id of the intended receiver + simdata::uint16 message_id; // id of the message + simdata::uint32 routing_type:8; // routing type (e.g. object update, server handshake, etc.) + simdata::uint32 routing_data:24; // routing data (e.g. ObjectId for object update routing) }; Modified: trunk/CSP/SimNet/NetworkMessage.h =================================================================== --- trunk/CSP/SimNet/NetworkMessage.h 2004-07-26 05:11:53 UTC (rev 1186) +++ trunk/CSP/SimNet/NetworkMessage.h 2004-07-26 05:16:17 UTC (rev 1187) @@ -43,6 +43,8 @@ */ class NetworkMessage: public simdata::TaggedRecord { PeerId m_destination; + simdata::uint8 m_routing_type; + simdata::uint32 m_routing_data; unsigned char m_priority; public: @@ -51,7 +53,7 @@ /** Default constructor. Initializes to a non-reliable, low-priority * message. */ - NetworkMessage(): m_destination(0), m_priority(0) { } + NetworkMessage(): m_destination(0), m_routing_type(0), m_routing_data(0), m_priority(0) { } /** Get the peer id of the destination host. */ @@ -63,6 +65,34 @@ */ void setDestination(PeerId destination) { m_destination = destination; } + /** Set the message routing data. Interpretation of this value + * depends on the message routing type. + */ + void setRoutingData(simdata::uint32 data) { + assert((data & 0xFF00000) == 0); + m_routing_data = data; + } + + /** Get the message routing data. Interpretation of this value + * depends on the message routing type. + */ + simdata::uint32 getRoutingData() const { return m_routing_data; } + + /** Set the message routing type. Routing types are used to determine + * how to handle incoming messages. For example, if the routing type + * corresponds to an object message, the routing data will contain the + * id of the object to receive the message. This allow the message to + * be dispatched to the appropriate object without requiring the + * routing layer to understand the details of particular message types. + */ + void setRoutingType(simdata::uint8 type) { + m_routing_type = type; + } + + /** Get the message routing type. See setRoutingType for details. + */ + simdata::uint8 getRoutingType() const { return m_routing_type; } + /** Set the message to be "reliable." Reliable messages require a confirmation * of receipt from the destination host. The message will be resent periodically * until confirmation in received (or the peer is dropped). Reliable messages @@ -78,10 +108,12 @@ /** Set the priority of this message. There are four priority levels, interpreted * roughly as follows: - * 0 : low priority, non-realtime - * 1 : low priority, realtime - * 2 : realtime - * 3 : high priority, reliable + * + * @li 0 : low priority, non-realtime + * @li 1 : low priority, realtime + * @li 2 : realtime + * @li 3 : high priority, reliable + * * Setting the priority to 3 automatically selects reliable transmission. */ void setPriority(unsigned int priority) { Modified: trunk/CSP/SimNet/PacketSource.h =================================================================== --- trunk/CSP/SimNet/PacketSource.h 2004-07-26 05:11:53 UTC (rev 1186) +++ trunk/CSP/SimNet/PacketSource.h 2004-07-26 05:16:17 UTC (rev 1187) @@ -55,8 +55,8 @@ /** Retrieve the next packet. * - * @param header a packet header; the implementation needs to set the destination, priority, and - * message_id fields. + * @param header a packet header; the implementation needs to set the destination, priority, + * message_id, routing_type, and routing_data fields. * @param payload a buffer to receive the raw message data (excluding the header). * @param payload_length when called, the amount of space allocated for payload (in bytes); * on return the implementation must return the actual number of bytes used. |
From: <sv...@ww...> - 2004-07-26 05:11:59
|
Author: mkrose Date: 2004-07-25 22:11:53 -0700 (Sun, 25 Jul 2004) New Revision: 1186 Modified: trunk/CSP/SimNet/Makefile Log: Fix Makefile deps to work with .bin output path (needed a little sed magic). Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1186 Modified: trunk/CSP/SimNet/Makefile =================================================================== --- trunk/CSP/SimNet/Makefile 2004-07-26 02:37:39 UTC (rev 1185) +++ trunk/CSP/SimNet/Makefile 2004-07-26 05:11:53 UTC (rev 1186) @@ -20,12 +20,12 @@ MKDEP = $(CXX) -M $(CXXFLAGS) SWDEP = $(SWIG) -M $(SWOPTS) DEPFILES = $(addprefix $(DEPDIR)/,$(addsuffix .d, $(SOURCES))) -DEPFILTER = +DEPFILTER = | sed -n 's/^\(.*:\)/.bin\/\1/;p' DEPS_MAGIC := $(shell mkdir $(DEPDIR) > /dev/null 2>&1 || :) BIN_MAGIC := $(shell mkdir $(BINDIR) > /dev/null 2>&1 || :) DOC_MAGIC := $(shell mkdir $(DOCDIR) > /dev/null 2>&1 || :) -.PHONY: clean-deps clean all default update_version +.PHONY: clean-deps clean clean-objects clean-dependencies clean-docs clean-dox clean-doc profile all default update_version default: all @@ -62,7 +62,7 @@ g++ -pg -o $@ $^ -L../SimData/SimData -lSimData -lpthread -ldl -lccgnu2 $(BINDIR)/%.o: %.cpp - $(CXX) -o $@ -c $(CXXFLAGS) $^ + $(CXX) -o $@ -c $(CXXFLAGS) $< %.cpp %.h: %.net ../SimData/Tools/TaggedRecordCompiler/trc.py $< |
From: <sv...@ww...> - 2004-07-26 02:37:46
|
Author: mkrose Date: 2004-07-25 19:37:39 -0700 (Sun, 25 Jul 2004) New Revision: 1185 Modified: trunk/CSP/SimNet/HandlerSet.h trunk/CSP/SimNet/Makefile trunk/CSP/SimNet/MessageHandler.h trunk/CSP/SimNet/MessageQueue.h trunk/CSP/SimNet/NetBase.h trunk/CSP/SimNet/NetRandom.h trunk/CSP/SimNet/NetworkInterface.cpp trunk/CSP/SimNet/NetworkInterface.h trunk/CSP/SimNet/NetworkMessage.h trunk/CSP/SimNet/NetworkNode.h trunk/CSP/SimNet/PacketDecoder.h trunk/CSP/SimNet/PacketHandler.h trunk/CSP/SimNet/PacketQueue.h trunk/CSP/SimNet/PacketSource.h trunk/CSP/SimNet/ReliablePacket.h trunk/CSP/SimNet/test.cpp Log: Added many doxygen comments to the simnet headers. Still need to tackle NetworkInterface and PeerInfo, as well as clean up many std::cout lines used for diagnostics. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1185 Diff omitted (35700 bytes). |
From: <sv...@ww...> - 2004-07-25 22:33:43
|
Author: mkrose Date: 2004-07-25 15:33:36 -0700 (Sun, 25 Jul 2004) New Revision: 1184 Modified: trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/Include/SimData/TaggedRecord.h trunk/CSP/SimData/Include/SimData/TaggedRecordRegistry.h Log: Fix ambiguous use of Ref for MSVC. Use FactoryList typedef in TaggedRecordRegistry. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1184 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-07-25 20:34:10 UTC (rev 1183) +++ trunk/CSP/SimData/CHANGES.current 2004-07-25 22:33:36 UTC (rev 1184) @@ -9,6 +9,9 @@ * Fix parsing of options by the tagged record compiler to allow namespace prefixes on base classes. + * Fix ambiguous use of Ref for MSVC. Use FactoryList typedef in + TaggedRecordRegistry. + 2004-07-21: onsight * Add missing include. Modified: trunk/CSP/SimData/Include/SimData/TaggedRecord.h =================================================================== --- trunk/CSP/SimData/Include/SimData/TaggedRecord.h 2004-07-25 20:34:10 UTC (rev 1183) +++ trunk/CSP/SimData/Include/SimData/TaggedRecord.h 2004-07-25 22:33:36 UTC (rev 1184) @@ -445,7 +445,7 @@ virtual void dump(std::ostream &, int indent=0) const=0; virtual int getCustomId() const=0; template <class TR> - static inline Ref<TR> FastCast(Ref const &record) { + static inline simdata::Ref<TR> FastCast(Ref const &record) { return (record->getId() == TR::_getId() ? static_cast<TR*>(record.get()) : 0); } protected: Modified: trunk/CSP/SimData/Include/SimData/TaggedRecordRegistry.h =================================================================== --- trunk/CSP/SimData/Include/SimData/TaggedRecordRegistry.h 2004-07-25 20:34:10 UTC (rev 1183) +++ trunk/CSP/SimData/Include/SimData/TaggedRecordRegistry.h 2004-07-25 22:33:36 UTC (rev 1184) @@ -116,8 +116,8 @@ /** Get a list of all interfaces in the registry. */ - std::vector<TaggedRecordFactoryBase *> getFactories() const { - std::vector<TaggedRecordFactoryBase *> list; + FactoryList getFactories() const { + FactoryList list; FactoryIdMap::const_iterator it = _id_map.begin(); for (; it != _id_map.end(); ++it) { list.push_back(it->second); |
From: <sv...@ww...> - 2004-07-25 20:34:16
|
Author: mkrose Date: 2004-07-25 13:34:10 -0700 (Sun, 25 Jul 2004) New Revision: 1183 Modified: trunk/CSP/SimNet/Sockets.h trunk/CSP/SimNet/StopWatch.h trunk/CSP/SimNet/TestMessage.net Log: Add doxygen comments to a few files. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1183 Modified: trunk/CSP/SimNet/Sockets.h =================================================================== --- trunk/CSP/SimNet/Sockets.h 2004-07-25 20:33:45 UTC (rev 1182) +++ trunk/CSP/SimNet/Sockets.h 2004-07-25 20:34:10 UTC (rev 1183) @@ -29,34 +29,50 @@ #define _WINSOCKAPI_ #include <cc++/network.h> - namespace simnet { + +/** Minimal wrapper for GNU CommonC++ UDPReceive. + * + * Exposes several protected methods. + */ class DatagramReceiveSocket: public ost::UDPReceive { public: DatagramReceiveSocket(const ost::InetHostAddress &host, ost::tpport_t port): ost::UDPReceive(host, port) { } + Error connect(const ost::InetHostAddress &host, ost::tpport_t port) { return ost::UDPReceive::connect(host, port); } + Error disconnect(void) { return ost::UDPReceive::disconnect(); } - bool isPendingReceive(timeout_t timeout) { + + inline bool isPendingReceive(timeout_t timeout) { return ost::UDPReceive::isPendingReceive(timeout); } + inline int peek(void *buf, size_t len) { return ost::UDPReceive::peek(buf, len); } }; + +/** Minimal wrapper for GNU CommonC++ UDPTransmit. + * + * Exposes several protected methods. + */ class DatagramTransmitSocket: public ost::UDPTransmit { public: DatagramTransmitSocket(): ost::UDPTransmit() { } - Error connect(const ost::InetHostAddress &host, ost::tpport_t port) { + + inline Error connect(const ost::InetHostAddress &host, ost::tpport_t port) { return ost::UDPTransmit::connect(host, port); } - Error disconnect(void) { return ost::UDPTransmit::disconnect(); } + + inline Error disconnect(void) { return ost::UDPTransmit::disconnect(); } }; + } // namespace simnet #endif // __SIMNET_SOCKETS_H__ Modified: trunk/CSP/SimNet/StopWatch.h =================================================================== --- trunk/CSP/SimNet/StopWatch.h 2004-07-25 20:33:45 UTC (rev 1182) +++ trunk/CSP/SimNet/StopWatch.h 2004-07-25 20:34:10 UTC (rev 1183) @@ -30,22 +30,84 @@ namespace simnet { + +/** Class for managing iterations of a timed loop. + * + * StopWatch is intended to be used to regulate the number of iterations + * of tight loops that are restricted to run for a limited amount of time. + * Rather than continuously polling the system clock (which can incur + * significant overhead), we keep a running estimate of how long each + * iteration requires in order to predict how many iterations can fit + * within the alotted time. If the loop takes longer than expected, the + * estimated time per iteration is increased. If the iterations complete + * early, we increase the estimated time per iteration and continue with + * additional iterations. Assuming that the iteration time is reasonably + * consistent, the estimated loop time and iteration counts quickly + * converge. + * + * Example usage: + * + * @code + * void loop(double timeout) { + * // static stopwatch timing data (not threadsafe as is) + * static simnet::StopWatch::Data swdata; + * StopWatch watch(timeout, swdata); + * watch.start(); + * do { + * // main loop action here (may exit early with break;) + * } while (!watch.checkExpired()); + * } + * @endcode + * + */ class StopWatch { public: + + /** Internal timing data. Declare separate, persistent Data instance for each + * loop that needs to be timed. Beware that using static Data instances isn't + * thread-safe. + */ struct Data { double scale; // default to 100 us per iteration inital guess, adjust as needed Data(float itertime=0.0001): scale(1.0/itertime) {} }; + + /** Construct a new stop watch. + * + * @param timeout The maximum time to spend in the timed loop (seconds). + * @param data The persistent Data instance used to store timing data for this loop. + */ StopWatch(double timeout, Data &data): m_data(data), m_tally(0), m_count(0), m_counts(0), m_timeout(timeout) { resetCount(timeout); SIMNET_LOG(TIMING, DEBUG, "STOPWATCH: " << m_counts << " iterations ~ " << (timeout * 1000.0) << " ms, scale=" << m_data.scale); m_DEBUG_extra = 0; } + + /** Start the stop watch. Call this right before starting the timed loop. + */ inline void start() { m_start_time = simdata::get_realtime(); } + + /** Force a check of the elapsed time, even if we still expect to be able to + * complete more iterations in the allotted time. + * + * Call this method after any unusual events occur within the timed loop that + * may take much longer than the average iteration. The iteration timing + * estimate will not be updated, and additional iterations will be scheduled + * if time remains. If time has expired, the next checkExpired() will return + * true and exit the loop. + */ void forceCheck() { resetCount(m_timeout - elapsed()); } + + /** Test if the timout has expired. + * + * Simply counts iterations, returning false until the expected number have + * completed. At that point it checks the elapsed time and updates the time + * per iteration estimate. If more time is left, additional iterations are + * scheduled and it returns false. Otherwise it returns true. + */ inline bool checkExpired() { if (--m_count > 0) return false; double dt = elapsed(); @@ -64,6 +126,11 @@ m_DEBUG_extra += m_count; return (m_count < 1); } + + /** Updates the iteration time estimate based on all iterations to this + * point. Call this before exiting the loop early (ie. by any means + * other than checkExpired()). + */ inline void calibrate() { resetCount(0.0); if (m_tally >= 10) { @@ -75,9 +142,20 @@ } } } + + /** Return the time elapsed since the watch was started. Gets the + * current system time in order to compute the elapsed time. + */ inline double elapsed() { return simdata::get_realtime() - m_start_time; } + + /** Get the system time at which the watch was started. + */ + inline double getStartTime() { + return m_start_time; + } + private: Data &m_data; int m_tally; Modified: trunk/CSP/SimNet/TestMessage.net =================================================================== --- trunk/CSP/SimNet/TestMessage.net 2004-07-25 20:33:45 UTC (rev 1182) +++ trunk/CSP/SimNet/TestMessage.net 2004-07-25 20:34:10 UTC (rev 1183) @@ -2,6 +2,8 @@ #include <SimNet/NetworkMessage.h> +// simple message used for testing the network layer. +// the fields have no particular meaning. Message TestMessage BASE=simnet::NetworkMessage { int32 number; std::string helo; |
From: <sv...@ww...> - 2004-07-25 20:33:51
|
Author: mkrose Date: 2004-07-25 13:33:45 -0700 (Sun, 25 Jul 2004) New Revision: 1182 Modified: trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/Tools/TaggedRecordCompiler/trc.py Log: Fix parsing of options by the tagged record compiler to allow namespace prefixes on base classes. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1182 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-07-25 19:43:57 UTC (rev 1181) +++ trunk/CSP/SimData/CHANGES.current 2004-07-25 20:33:45 UTC (rev 1182) @@ -6,6 +6,9 @@ faster (and just as safe) as using implicit dynamic_casts via Ref assignments. + * Fix parsing of options by the tagged record compiler to allow + namespace prefixes on base classes. + 2004-07-21: onsight * Add missing include. Modified: trunk/CSP/SimData/Tools/TaggedRecordCompiler/trc.py =================================================================== --- trunk/CSP/SimData/Tools/TaggedRecordCompiler/trc.py 2004-07-25 19:43:57 UTC (rev 1181) +++ trunk/CSP/SimData/Tools/TaggedRecordCompiler/trc.py 2004-07-25 20:33:45 UTC (rev 1182) @@ -61,7 +61,7 @@ class DataPackCompiler: - re_line = re.compile(r'^(\w*:?:?\w+)(\[\])?\s+(\w*)\s*((?:\s+\w+\s*=\s*\w+)*)\s*({|})?$') + re_line = re.compile(r'^(\w*:?:?\w+)(\[\])?\s+(\w*)\s*((?:\s+\w+\s*=\s*[a-zA-Z0-9_:]+)*)\s*({|})?$') re_opts = re.compile(r'\s*=\s*') re_ns = re.compile(r'namespace\s+([a-zA-Z_][a-zA-Z0-9]*)\s*;?') |
From: <sv...@ww...> - 2004-07-25 19:44:05
|
Author: mkrose Date: 2004-07-25 12:43:57 -0700 (Sun, 25 Jul 2004) New Revision: 1181 Added: trunk/CSP/SimNet/ trunk/CSP/SimNet/Doxyfile trunk/CSP/SimNet/HandlerSet.h trunk/CSP/SimNet/Makefile trunk/CSP/SimNet/MessageHandler.h trunk/CSP/SimNet/MessageQueue.h trunk/CSP/SimNet/NetBase.h trunk/CSP/SimNet/NetLog.h trunk/CSP/SimNet/NetRandom.cpp trunk/CSP/SimNet/NetRandom.h trunk/CSP/SimNet/NetworkInterface.cpp trunk/CSP/SimNet/NetworkInterface.h trunk/CSP/SimNet/NetworkMessage.h trunk/CSP/SimNet/NetworkNode.cpp trunk/CSP/SimNet/NetworkNode.h trunk/CSP/SimNet/PacketDecoder.h trunk/CSP/SimNet/PacketHandler.h trunk/CSP/SimNet/PacketQueue.h trunk/CSP/SimNet/PacketSource.h trunk/CSP/SimNet/PeerInfo.cpp trunk/CSP/SimNet/PeerInfo.h trunk/CSP/SimNet/README trunk/CSP/SimNet/RecordCodec.cpp trunk/CSP/SimNet/RecordCodec.h trunk/CSP/SimNet/ReliablePacket.h trunk/CSP/SimNet/Sockets.h trunk/CSP/SimNet/StopWatch.h trunk/CSP/SimNet/TestMessage.net trunk/CSP/SimNet/footer.html trunk/CSP/SimNet/test.cpp Log: Add a new udp networking layer, which supports bandwidth balancing and reliable messages. The message classes are generated from tagged record descriptors (see SimData for details). Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1181 Diff omitted (140995 bytes). |
From: <sv...@ww...> - 2004-07-25 18:50:50
|
Author: mkrose Date: 2004-07-25 11:50:43 -0700 (Sun, 25 Jul 2004) New Revision: 1180 Modified: trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/Include/SimData/TaggedRecord.h Log: Add a fast typecast operator to TaggedRecord, which checks record ids and performs a static cast if the ids match. This is much faster (and just as safe) as using implicit dynamic_casts via Ref assignments. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1180 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-07-25 03:01:25 UTC (rev 1179) +++ trunk/CSP/SimData/CHANGES.current 2004-07-25 18:50:43 UTC (rev 1180) @@ -1,5 +1,11 @@ Version 0.4.0 (in progress) =========================== +2004-07-25: onsight + * Add a fast typecast operator to TaggedRecord, which checks record + ids and performs a static cast if the ids match. This is much + faster (and just as safe) as using implicit dynamic_casts via + Ref assignments. + 2004-07-21: onsight * Add missing include. Modified: trunk/CSP/SimData/Include/SimData/TaggedRecord.h =================================================================== --- trunk/CSP/SimData/Include/SimData/TaggedRecord.h 2004-07-25 03:01:25 UTC (rev 1179) +++ trunk/CSP/SimData/Include/SimData/TaggedRecord.h 2004-07-25 18:50:43 UTC (rev 1180) @@ -444,6 +444,10 @@ virtual std::string getName() const=0; virtual void dump(std::ostream &, int indent=0) const=0; virtual int getCustomId() const=0; + template <class TR> + static inline Ref<TR> FastCast(Ref const &record) { + return (record->getId() == TR::_getId() ? static_cast<TR*>(record.get()) : 0); + } protected: virtual ~TaggedRecord() {} }; |
From: <sv...@ww...> - 2004-07-25 03:01:31
|
Author: wolverine Date: 2004-07-24 20:01:25 -0700 (Sat, 24 Jul 2004) New Revision: 1179 Modified: trunk/CSP/CSPSim/Source/Makefile.in Log: changes to Makefile for common c++ Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1179 Modified: trunk/CSP/CSPSim/Source/Makefile.in =================================================================== --- trunk/CSP/CSPSim/Source/Makefile.in 2004-07-25 01:12:50 UTC (rev 1178) +++ trunk/CSP/CSPSim/Source/Makefile.in 2004-07-25 03:01:25 UTC (rev 1179) @@ -22,7 +22,7 @@ BASEFL = $(GDEBUGF) $(GCFLAGS) $(INCLUDE) @SDL_FLAGS@ @SIGC_FLAGS@ @CCGNU2_FLAGS@ CFLAGS = $(filter-out -I/usr/local/include, $(BASEFL)) -SWCXXF = $(GDEBUGF) $(GCFLAGS) $(INCLUDE) @SIGC_FLAGS@ +SWCXXF = $(GDEBUGF) $(GCFLAGS) $(INCLUDE) @SIGC_FLAGS@ @CCGNU2_FLAGS@ LDOPTS = -Wl,-z,lazyload $(GLDOPTS) @LIBS@ SWOPTS = $(GSWOPTS) $(INCLUDE) EXTERN_LIBS = @LIBS@ |
From: <sv...@ww...> - 2004-07-25 01:12:58
|
Author: wolverine Date: 2004-07-24 18:12:50 -0700 (Sat, 24 Jul 2004) New Revision: 1178 Modified: trunk/CSP/CSPSim/Source/CSPSim.cpp trunk/CSP/CSPSim/Source/ClientNode.cpp trunk/CSP/CSPSim/Source/DispatchCenter.cpp trunk/CSP/CSPSim/Source/DynamicObject.cpp trunk/CSP/CSPSim/Source/EchoServerNode.cpp trunk/CSP/CSPSim/Source/Makefile.in trunk/CSP/CSPSim/Source/RedirectServerNode.cpp Log: networking changes Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1178 Diff omitted (27776 bytes). |
From: <sv...@ww...> - 2004-07-25 01:11:06
|
Author: wolverine Date: 2004-07-24 18:10:58 -0700 (Sat, 24 Jul 2004) New Revision: 1177 Modified: trunk/CSP/CSPSim/Source/SimNet/DispatchMessageHandler.cpp trunk/CSP/CSPSim/Source/SimNet/EchoMessageHandler.cpp trunk/CSP/CSPSim/Source/SimNet/MessageSocketDuplex.cpp trunk/CSP/CSPSim/Source/SimNet/NetworkMessage.cpp trunk/CSP/CSPSim/Source/SimNet/NetworkMessenger.cpp trunk/CSP/CSPSim/Source/SimNet/NetworkNode.cpp trunk/CSP/CSPSim/Source/SimNet/PrintMessageHandler.cpp trunk/CSP/CSPSim/Source/SimNet/RedirectMessageHandler.cpp Log: networking changes Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1177 Modified: trunk/CSP/CSPSim/Source/SimNet/DispatchMessageHandler.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/DispatchMessageHandler.cpp 2004-07-25 01:08:35 UTC (rev 1176) +++ trunk/CSP/CSPSim/Source/SimNet/DispatchMessageHandler.cpp 2004-07-25 01:10:58 UTC (rev 1177) @@ -23,6 +23,11 @@ */ #include <SimNet/Networking.h> +#include <SimNet/NetworkMessage.h> +#include <SimNet/NetworkNode.h> +#include <SimNet/NetworkMessageHandler.h> +#include <SimNet/DispatchMessageHandler.h> + #include "DynamicObject.h" #include "Config.h" Modified: trunk/CSP/CSPSim/Source/SimNet/EchoMessageHandler.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/EchoMessageHandler.cpp 2004-07-25 01:08:35 UTC (rev 1176) +++ trunk/CSP/CSPSim/Source/SimNet/EchoMessageHandler.cpp 2004-07-25 01:10:58 UTC (rev 1177) @@ -29,6 +29,11 @@ #include <SimNet/Networking.h> #include <SimData/LogStream.h> #include "Log.h" +#include <SimNet/NetworkNode.h> +#include <SimNet/NetworkMessage.h> +#include <SimNet/NetworkMessenger.h> +#include <SimNet/NetworkMessageHandler.h> +#include <SimNet/EchoMessageHandler.h> EchoMessageHandler::EchoMessageHandler() { m_messenger = NULL; Modified: trunk/CSP/CSPSim/Source/SimNet/MessageSocketDuplex.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/MessageSocketDuplex.cpp 2004-07-25 01:08:35 UTC (rev 1176) +++ trunk/CSP/CSPSim/Source/SimNet/MessageSocketDuplex.cpp 2004-07-25 01:10:58 UTC (rev 1177) @@ -22,6 +22,7 @@ * @author Scott Flicker (Wolverine) */ #include <SimNet/Networking.h> +#include <SimNet/NetworkNode.h> #include "Log.h" MessageSocketDuplex::MessageSocketDuplex() { Modified: trunk/CSP/CSPSim/Source/SimNet/NetworkMessage.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/NetworkMessage.cpp 2004-07-25 01:08:35 UTC (rev 1176) +++ trunk/CSP/CSPSim/Source/SimNet/NetworkMessage.cpp 2004-07-25 01:10:58 UTC (rev 1177) @@ -26,6 +26,8 @@ */ #include <SimNet/Networking.h> +#include <SimNet/NetworkMessage.h> +#include <SimNet/NetworkNode.h> unsigned short NetworkMessage::m_magicNumber = 0xACDC; unsigned short NetworkMessage::m_HeaderLen = 16; Modified: trunk/CSP/CSPSim/Source/SimNet/NetworkMessenger.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/NetworkMessenger.cpp 2004-07-25 01:08:35 UTC (rev 1176) +++ trunk/CSP/CSPSim/Source/SimNet/NetworkMessenger.cpp 2004-07-25 01:10:58 UTC (rev 1177) @@ -25,6 +25,9 @@ #include <SimNet/Networking.h> #include <SimData/LogStream.h> #include "Log.h" +#include <SimNet/NetworkMessage.h> +#include <SimNet/NetworkNode.h> +#include <SimNet/NetworkMessenger.h> NetworkMessenger::NetworkMessenger() { CSP_LOG(NETWORK, DEBUG, "NetworkMessenger.NetworkMessenger()"); Modified: trunk/CSP/CSPSim/Source/SimNet/NetworkNode.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/NetworkNode.cpp 2004-07-25 01:08:35 UTC (rev 1176) +++ trunk/CSP/CSPSim/Source/SimNet/NetworkNode.cpp 2004-07-25 01:10:58 UTC (rev 1177) @@ -25,6 +25,7 @@ */ #include <SimNet/Networking.h> +#include <SimNet/NetworkNode.h> NetworkNode::NetworkNode() { // m_node_id = 0; Modified: trunk/CSP/CSPSim/Source/SimNet/PrintMessageHandler.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/PrintMessageHandler.cpp 2004-07-25 01:08:35 UTC (rev 1176) +++ trunk/CSP/CSPSim/Source/SimNet/PrintMessageHandler.cpp 2004-07-25 01:10:58 UTC (rev 1177) @@ -29,6 +29,11 @@ #include <SimData/LogStream.h> #include "Log.h" #include <SimNet/Networking.h> +#include <SimNet/NetworkMessage.h> +#include <SimNet/NetworkNode.h> +#include <SimNet/NetworkMessageHandler.h> +#include <SimNet/PrintMessageHandler.h> + #include <stdio.h> PrintMessageHandler::PrintMessageHandler() { Modified: trunk/CSP/CSPSim/Source/SimNet/RedirectMessageHandler.cpp =================================================================== --- trunk/CSP/CSPSim/Source/SimNet/RedirectMessageHandler.cpp 2004-07-25 01:08:35 UTC (rev 1176) +++ trunk/CSP/CSPSim/Source/SimNet/RedirectMessageHandler.cpp 2004-07-25 01:10:58 UTC (rev 1177) @@ -1,18 +1,18 @@ // Combat Simulator Project - FlightSim Demo -// Copyright (C) 2004 The Combat Simulator Project +// Copyright (C) 2002 The Combat Simulator Project // http://csp.sourceforge.net -// +// // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,36 +23,48 @@ * @author Scott Flicker (Wolverine) * * Class for Handling Network Messages. - * Redirects messages to other clients. + * Redirects messages to other clients. */ #include <SimData/LogStream.h> #include "Log.h" #include <SimNet/Networking.h> +#include <SimNet/NetworkMessage.h> +#include <SimNet/NetworkNode.h> +#include <SimNet/NetworkMessenger.h> +#include <SimNet/NetworkMessageHandler.h> +#include <SimNet/RedirectMessageHandler.h> -RedirectMessageHandler::RedirectMessageHandler() { - m_messenger = NULL; + +RedirectMessageHandler::RedirectMessageHandler() +{ + m_messenger = NULL; } -RedirectMessageHandler::~RedirectMessageHandler() { +RedirectMessageHandler::~RedirectMessageHandler() +{ + } -void RedirectMessageHandler::process(NetworkMessage * message) { - CSP_LOG(NETWORK, DEBUG, "RedirectMessageHandler::process()\n"); +void RedirectMessageHandler::process(NetworkMessage * message) +{ + CSP_LOG(APP, DEBUG, "RedirectMessageHandler::process()\n"); - NetworkNode * originatorNode = message->getOriginatorNode(); - CSP_LOG(NETWORK, DEBUG, "RedirectMessageHandler::process() - Sending back to host: " << originatorNode->getHostname() << ", port: " << originatorNode->getPort()); - // must make a copy of the message since the buffer in the parameter will be returned - // to the pool after this function exists. - NetworkMessage * messageCopy = m_messenger->allocMessageBuffer(); - memcpy((void*)messageCopy, (void*)message, 512); + NetworkNode * originatorNode = message->getOriginatorNode(); + CSP_LOG(APP, DEBUG, "RedirectMessageHandler::process() - Sending back to host: " << + originatorNode->getHostname() << ", port: " << originatorNode->getPort()); - // MessageHeader * header = (MessageHeader*)messageCopy; - // ObjectUpdateMessagePayload * ptrPayload = (ObjectUpdateMessagePayload*)messageCopy->getPayloadPtr(); + // must make a copy of the message since the buffer in the parameter will be returned + // to the pool after this function exists. + NetworkMessage * messageCopy = m_messenger->allocMessageBuffer(); + memcpy( (void*)messageCopy, (void*)message, 512); + +// MessageHeader * header = (MessageHeader*)messageCopy; +// ObjectUpdateMessagePayload * ptrPayload = (ObjectUpdateMessagePayload*)messageCopy->getPayloadPtr(); - m_messenger->queueMessage(originatorNode, messageCopy); + m_messenger->queueMessage(originatorNode, messageCopy); } |
From: <sv...@ww...> - 2004-07-25 01:08:44
|
Author: wolverine Date: 2004-07-24 18:08:35 -0700 (Sat, 24 Jul 2004) New Revision: 1176 Added: trunk/CSP/CSPSim/Include/SimNet/DispatchMessageHandler.h trunk/CSP/CSPSim/Include/SimNet/EchoMessageHandler.h trunk/CSP/CSPSim/Include/SimNet/NetworkMessage.h trunk/CSP/CSPSim/Include/SimNet/NetworkMessageHandler.h trunk/CSP/CSPSim/Include/SimNet/NetworkMessenger.h trunk/CSP/CSPSim/Include/SimNet/NetworkNode.h trunk/CSP/CSPSim/Include/SimNet/PrintMessageHandler.h trunk/CSP/CSPSim/Include/SimNet/RedirectMessageHandler.h Modified: trunk/CSP/CSPSim/Include/SimNet/Networking.h Log: new files Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1176 Diff omitted (30055 bytes). |