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: <de...@us...> - 2003-07-19 13:56:54
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Source In directory sc8-pr-cvs1:/tmp/cvs-serv1467 Modified Files: Interpolate.cpp Log Message: *** see CHANGES.current *** Index: Interpolate.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Interpolate.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Interpolate.cpp 18 Jul 2003 01:33:05 -0000 1.9 --- Interpolate.cpp 19 Jul 2003 13:56:50 -0000 1.10 *************** *** 190,195 **** int i = find(_breaks, v); double h = _breaks[i+1] - _breaks[i]; ! double f1 = 1.0 - (v - _breaks[i]) / h; ! double f2 = 1.0 - (_breaks[i+1] - v) / h; double d1 = _sd[i]; double d2 = _sd[i+1]; --- 190,195 ---- int i = find(_breaks, v); double h = _breaks[i+1] - _breaks[i]; ! double f1 = 1.0 - (v - _breaks[i]) / h;// 1.0 - t; ? ! double f2 = 1.0 - (_breaks[i+1] - v) / h; // t = (v - _breaks[i]) / h; ? double d1 = _sd[i]; double d2 = _sd[i+1]; *************** *** 197,201 **** double y2 = _data[i+1]; double s = h * h / 6.0; ! v = static_cast<value_t>(y1*f1 + y2*f2 + (f1*(f1*f1 - 1.0)*d1 + f2*(f2*f2 - 1.0)*d2) * s); return v; } --- 197,201 ---- double y2 = _data[i+1]; double s = h * h / 6.0; ! v = static_cast<value_t>(y1*f1 + y2*f2 + (f1*(f1*f1 - 1.0)*d1 + f2*(f2*f2 - 1.0)*d2) * s); return v; } |
From: <mk...@us...> - 2003-07-19 13:56:21
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim In directory sc8-pr-cvs1:/tmp/cvs-serv1418 Modified Files: CHANGES.current Log Message: Index: CHANGES.current =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/CHANGES.current,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** CHANGES.current 18 Jul 2003 02:00:22 -0000 1.44 --- CHANGES.current 19 Jul 2003 13:56:17 -0000 1.45 *************** *** 3,6 **** --- 3,43 ---- 2003-07-17: onsight + Added speedbrake and data recording bindings + to the default input mappings. + + Revised the m2k xml files to use the new FM + classes and define various animation. + + Added some comments to NumericalMethod and + VectorField. + + Inlined a few accessor methods in VirtualScene. + + Revisions to SceneObject to support animations. + + Revisions to DynamicObject to support animations + and data recording. + + Revised AircraftDynamics to use FlightDynamics + instead of PrimaryAeroDynamics. Added support in + AircraftObject for animations and data recording. + + Added speedbrake support to AircraftObject and + the FlightModel. + + Added Animation, which provides a framework for + 3D model animations. + + Added FlightDynamics, FlightModel, and DataRecorder. + The first two implement an alternate flight model + layout in which the static flight model data is + reused by all aircraft of a given type. The + DataRecorder class allows arbitrary data output + channels to be defined and saved efficiently to + disk. An external tool (not yet checked in) parses + the files to produce tab-delimited tables or + pdf charts (linux only for the latter). + + 2003-07-17: onsight Changed SimpleConfig.h to use windows-specific hash code for msvc version >= 1300 (instead of == 1300). |
Update of /cvsroot/csp/SISS/3dmodels/f102 In directory sc8-pr-cvs1:/tmp/cvs-serv14020 Added Files: 1fuselft.bmp 1fusergh.bmp 1wingslw.bmp lightningf3.3ds panel.bmp pilot.bmp wingsup.bmp Log Message: added per gulf knight --- NEW FILE: 1fuselft.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: 1fusergh.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: 1wingslw.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: lightningf3.3ds --- (This appears to be a binary file; contents omitted.) --- NEW FILE: panel.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: pilot.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: wingsup.bmp --- (This appears to be a binary file; contents omitted.) |
From: <bra...@us...> - 2003-07-18 22:56:43
|
Update of /cvsroot/csp/SISS/3dmodels/f102 In directory sc8-pr-cvs1:/tmp/cvs-serv13885/f102 Log Message: Directory /cvsroot/csp/SISS/3dmodels/f102 added to the repository |
From: <bra...@us...> - 2003-07-18 22:56:26
|
Update of /cvsroot/csp/SISS/3dmodels/saladin In directory sc8-pr-cvs1:/tmp/cvs-serv13727 Added Files: saladin.3ds saladint.bmp Log Message: added per gulf knight --- NEW FILE: saladin.3ds --- (This appears to be a binary file; contents omitted.) --- NEW FILE: saladint.bmp --- (This appears to be a binary file; contents omitted.) |
From: <bra...@us...> - 2003-07-18 22:55:41
|
Update of /cvsroot/csp/SISS/3dmodels/saladin In directory sc8-pr-cvs1:/tmp/cvs-serv13517/saladin Log Message: Directory /cvsroot/csp/SISS/3dmodels/saladin added to the repository |
From: <mk...@us...> - 2003-07-18 22:01:00
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Tools/HID/Maps In directory sc8-pr-cvs1:/tmp/cvs-serv3415 Modified Files: aircraft-core.map gamescreen-core.map Log Message: Index: aircraft-core.map =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Tools/HID/Maps/aircraft-core.map,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** aircraft-core.map 19 Jun 2003 18:08:20 -0000 1.3 --- aircraft-core.map 18 Jul 2003 22:00:58 -0000 1.4 *************** *** 27,28 **** --- 27,32 ---- map key:m press MARKERS_TOGGLE map key:g press GEAR_TOGGLE + map key:b press OPEN_AIRBRAKE/B|CLOSE_AIRBRAKE/B + map key:SHIFT-b press INC_AIRBRAKE + map key:CTRL-b press DEC_AIRBRAKE + Index: gamescreen-core.map =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Tools/HID/Maps/gamescreen-core.map,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gamescreen-core.map 27 Mar 2003 20:36:39 -0000 1.2 --- gamescreen-core.map 18 Jul 2003 22:00:58 -0000 1.3 *************** *** 9,12 **** --- 9,13 ---- mode base + map key:0 press CAMERA_VIEW_0 map key:1 press CAMERA_VIEW_1 map key:2 press CAMERA_VIEW_2 *************** *** 17,20 **** --- 18,22 ---- map key:7 press CAMERA_VIEW_7 map key:8 press CAMERA_VIEW_8 + map key:9 press CAMERA_VIEW_9 map key:KP4 press CAMERA_PAN_LEFT map key:KP4 release CAMERA_PAN_LEFT_STOP |
From: <mk...@us...> - 2003-07-18 21:56:41
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Data/XML/vehicles/aircraft/m2k In directory sc8-pr-cvs1:/tmp/cvs-serv2574/m2k Modified Files: model.xml Log Message: Index: model.xml =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Data/XML/vehicles/aircraft/m2k/model.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** model.xml 18 Jul 2003 21:55:29 -0000 1.11 --- model.xml 18 Jul 2003 21:56:38 -0000 1.12 *************** *** 3,8 **** <Object class="ObjectModel" static="1"> <!--External name="model_path">f35.3DS</External--> ! <!--External name="model_path">m2k2g.3ds</External--> ! <External name="model_path">s.osg</External> <Vector name="axis_0">1 0 0</Vector> <Vector name="axis_1">0 1 0</Vector> --- 3,8 ---- <Object class="ObjectModel" static="1"> <!--External name="model_path">f35.3DS</External--> ! <!--External name="model_path">s.osg</External--> ! <External name="model_path">m2k2g.3ds</External> <Vector name="axis_0">1 0 0</Vector> <Vector name="axis_1">0 1 0</Vector> |
From: <mk...@us...> - 2003-07-18 21:55:33
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Data/XML/vehicles/aircraft/m2k In directory sc8-pr-cvs1:/tmp/cvs-serv2396/m2k Modified Files: fm.xml model.xml gear.xml Log Message: Index: fm.xml =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Data/XML/vehicles/aircraft/m2k/fm.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** fm.xml 30 Jun 2003 22:20:30 -0000 1.6 --- fm.xml 18 Jul 2003 21:55:29 -0000 1.7 *************** *** 7,11 **** --> ! <Object class="PrimaryAeroDynamics"> <!-- Wing geometry --> --- 7,11 ---- --> ! <Object class="FlightModel"> <!-- Wing geometry --> *************** *** 14,33 **** <Float name="wing_area">41.0</Float> - <!-- Control surfaces min/max angles --> - <!-- these values come from a FS2k2 add-on --> - <Float name="de_max">+27.5</Float> - <Float name="de_min">-20.6</Float> - <Float name="da_max">+19.5</Float> - <Float name="da_min">-15</Float> - <Float name="dr_max">+23.5</Float> - <Float name="dr_min">-23.5</Float> - - <Float name="g_min">-3.2</Float> - <Float name="g_max">9.0</Float> - <!-- Drag Parameters --> <Float name="cd0">0.06</Float> <Float name="cd_a">0.07</Float> <Float name="cd_de">0.0</Float> <!--Float name="cd_df">0.07</Float--> <!--Float name="cd_ds">0.14</Float--> --- 14,22 ---- <Float name="wing_area">41.0</Float> <!-- Drag Parameters --> <Float name="cd0">0.06</Float> <Float name="cd_a">0.07</Float> <Float name="cd_de">0.0</Float> + <Float name="cd_db">0.08</Float> <!--Float name="cd_df">0.07</Float--> <!--Float name="cd_ds">0.14</Float--> *************** *** 74,86 **** <Float name="cn_da">-0.03</Float> <Float name="cn_dr">0.15</Float> - - <!-- g limiter (based on a F16 cat III)> - <Curve="limiter_g_aoa"> - <Breaks spacing='0.03'> - 0.27 0.31 0.35 0.44 3.14 - </Break> - <Values> - 1.0 8.0 7.4 1.0 1.0 - </Values--> </Object> --- 63,66 ---- Index: model.xml =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Data/XML/vehicles/aircraft/m2k/model.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** model.xml 26 Jun 2003 09:34:23 -0000 1.10 --- model.xml 18 Jul 2003 21:55:29 -0000 1.11 *************** *** 3,10 **** <Object class="ObjectModel" static="1"> <!--External name="model_path">f35.3DS</External--> ! <External name="model_path">m2k2g.3ds</External> <Vector name="axis_0">1 0 0</Vector> <Vector name="axis_1">0 1 0</Vector> <Float name="scale">1.0</Float> <Vector name="view_point">0.0 4.65 0.65</Vector> <List name="contacts"> --- 3,12 ---- <Object class="ObjectModel" static="1"> <!--External name="model_path">f35.3DS</External--> ! <!--External name="model_path">m2k2g.3ds</External--> ! <External name="model_path">s.osg</External> <Vector name="axis_0">1 0 0</Vector> <Vector name="axis_1">0 1 0</Vector> <Float name="scale">1.0</Float> + <Vector name="offset">0.0 -0.55 0.0</Vector> <Vector name="view_point">0.0 4.65 0.65</Vector> <List name="contacts"> *************** *** 23,29 **** <List name="landing_gear"> <!-- this needs to be fixed to reflect real positions ...--> ! <Vector>0.0 4.75 -2.0</Vector> ! <Vector>-1.7 -0.05 -2.0</Vector> ! <Vector>1.7 -0.05 -2.0</Vector> </List> </Object> --- 25,87 ---- <List name="landing_gear"> <!-- this needs to be fixed to reflect real positions ...--> ! <Vector>0.0 4.20 -2.0</Vector> ! <Vector>-1.75 -0.7 -2.0</Vector> ! <Vector>1.75 -0.7 -2.0</Vector> ! </List> ! <List name="animations"> ! <Object class="DrivenRotation"> ! <Key name="control_id">Aircraft.Rudder</Key> ! <Key name="model_id">Aircraft.Rudder</Key> ! <Int name="lod_limit">1</Int> ! <Vector name="axis">0 -0.34038 0.94029</Vector> ! </Object> ! <Object class="DrivenRotation"> ! <Key name="control_id">Aircraft.Elevator</Key> ! <Key name="model_id">Aircraft.LeftElevator</Key> ! <Int name="lod_limit">1</Int> ! <Vector name="axis">-1 0 0</Vector> ! </Object> ! <Object class="DrivenRotation"> ! <Key name="control_id">Aircraft.Elevator</Key> ! <Key name="model_id">Aircraft.RightElevator</Key> ! <Int name="lod_limit">1</Int> ! <Vector name="axis">-1 0 0</Vector> ! </Object> ! <Object class="DrivenRotation"> ! <Key name="control_id">Aircraft.Aileron</Key> ! <Key name="model_id">Aircraft.LeftAileron</Key> ! <Int name="lod_limit">1</Int> ! <Vector name="axis">1 0 0</Vector> ! </Object> ! <Object class="DrivenRotation"> ! <Key name="control_id">Aircraft.Aileron</Key> ! <Key name="model_id">Aircraft.RightAileron</Key> ! <Int name="lod_limit">1</Int> ! <Vector name="axis">-1 0 0</Vector> ! </Object> ! <Object class="DrivenRotation"> ! <Key name="control_id">Aircraft.Airbrake</Key> ! <Key name="model_id">Aircraft.LowerRightAirbrake</Key> ! <Int name="lod_limit">1</Int> ! <Vector name="axis">1 0 0</Vector> ! </Object> ! <Object class="DrivenRotation"> ! <Key name="control_id">Aircraft.Airbrake</Key> ! <Key name="model_id">Aircraft.LowerLeftAirbrake</Key> ! <Int name="lod_limit">1</Int> ! <Vector name="axis">1 0 0</Vector> ! </Object> ! <Object class="DrivenRotation"> ! <Key name="control_id">Aircraft.Airbrake</Key> ! <Key name="model_id">Aircraft.UpperRightAirbrake</Key> ! <Int name="lod_limit">1</Int> ! <Vector name="axis">-1 0 0</Vector> ! </Object> ! <Object class="DrivenRotation"> ! <Key name="control_id">Aircraft.Airbrake</Key> ! <Key name="model_id">Aircraft.UpperLeftAirbrake</Key> ! <Int name="lod_limit">1</Int> ! <Vector name="axis">-1 0 0</Vector> ! </Object> </List> </Object> Index: gear.xml =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Data/XML/vehicles/aircraft/m2k/gear.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gear.xml 26 Jun 2003 09:34:23 -0000 1.2 --- gear.xml 18 Jul 2003 21:55:29 -0000 1.3 *************** *** 11,15 **** <!-- all of these values are complete guesses for testing only! --> <Object class="LandingGear"> <!-- nosewheel --> ! <Vector name="max_position">0.0 4.75 -2.0</Vector> <Vector name="motion">0 0 1.0</Vector> <Real name="damage_limit">80000.0:10000.0</Real> --- 11,15 ---- <!-- all of these values are complete guesses for testing only! --> <Object class="LandingGear"> <!-- nosewheel --> ! <Vector name="max_position">0.0 4.20 -2.0</Vector> <Vector name="motion">0 0 1.0</Vector> <Real name="damage_limit">80000.0:10000.0</Real> |
From: <mk...@us...> - 2003-07-18 21:55:32
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Data/XML/vehicles/aircraft In directory sc8-pr-cvs1:/tmp/cvs-serv2396 Modified Files: m2k.xml Log Message: Index: m2k.xml =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Data/XML/vehicles/aircraft/m2k.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** m2k.xml 26 Jun 2003 09:32:44 -0000 1.6 --- m2k.xml 18 Jul 2003 21:55:28 -0000 1.7 *************** *** 18,21 **** --- 18,24 ---- <Float name="rudder_max">+23.5</Float> + <Float name="airbrake_max">60.0</Float> + <Float name="airbrake_rate">20.0</Float> + <!-- Mass/Inertial properties --> <!-- empty mass = 7600 kg --> *************** *** 30,34 **** <Object class="AircraftDynamics" name="aircraft_dynamics"> ! <Path name="primary_aero_dynamics">m2k.fm</Path> <Path name="gear_dynamics">m2k.gear</Path> --- 33,37 ---- <Object class="AircraftDynamics" name="aircraft_dynamics"> ! <Path name="flight_model">m2k.fm</Path> <Path name="gear_dynamics">m2k.gear</Path> *************** *** 44,48 **** <Vector name="thrust_direction">0.0 1.0 0.0</Vector> <Vector name="engine_offset">0.0 0.0 0.0</Vector> ! <Vector name="smoke_emitter_location">0.0 -5.5 0.0></Vector> </Object> </List> --- 47,51 ---- <Vector name="thrust_direction">0.0 1.0 0.0</Vector> <Vector name="engine_offset">0.0 0.0 0.0</Vector> ! <Vector name="smoke_emitter_location">0.0 -5.5 0.0</Vector> </Object> </List> |
From: <mk...@us...> - 2003-07-18 21:20:53
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Source In directory sc8-pr-cvs1:/tmp/cvs-serv29207/Source Modified Files: Atmosphere.cpp Log Message: Index: Atmosphere.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Source/Atmosphere.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Atmosphere.cpp 4 May 2003 11:30:36 -0000 1.6 --- Atmosphere.cpp 18 Jul 2003 21:20:50 -0000 1.7 *************** *** 24,27 **** --- 24,28 ---- #include "Atmosphere.h" + #include "Profile.h" #include <SimData/InterfaceRegistry.h> |
From: <mk...@us...> - 2003-07-18 21:18:20
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Source In directory sc8-pr-cvs1:/tmp/cvs-serv28794/Source Modified Files: Theater.cpp Log Message: Index: Theater.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Source/Theater.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Theater.cpp 26 Jun 2003 09:25:23 -0000 1.3 --- Theater.cpp 18 Jul 2003 21:18:16 -0000 1.4 *************** *** 57,60 **** --- 57,61 ---- CSP_LOG(TERRAIN, INFO, "Projecting feature groups."); m_FeatureGroupList->projectFeatureGroups(m_Terrain->getProjection()); + CSP_LOG(TERRAIN, INFO, "Projecting feature groups done."); } |
From: <mk...@us...> - 2003-07-18 21:16:45
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Include In directory sc8-pr-cvs1:/tmp/cvs-serv28431/Include Modified Files: NumericalMethod.h Log Message: Index: NumericalMethod.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Include/NumericalMethod.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NumericalMethod.h 30 Jun 2003 22:29:15 -0000 1.7 --- NumericalMethod.h 18 Jul 2003 21:16:41 -0000 1.8 *************** *** 32,50 **** class VectorField { protected: unsigned short const m_dimension; public: ! VectorField(unsigned short dimension ): ! m_dimension(dimension) { ! } unsigned short getDimension() const { return m_dimension; } virtual std::vector<double> const& _f(double t, std::vector<double>& y) = 0; }; class NumericalMethod { bool m_bdeleteVF; --- 32,74 ---- + class NumericalMethod; + + /** + * A simple class to represent a multidimensional vector + * field describing the kinetic parameters of a dynamical + * system. + */ class VectorField { + friend class NumericalMethod; protected: unsigned short const m_dimension; public: ! /** ! * Construct a new vector field of the specified dimension. ! */ ! VectorField(unsigned short dimension): ! m_dimension(dimension) ! { ! } ! ! /** ! * Return the dimension of the vector field. ! */ unsigned short getDimension() const { return m_dimension; } + + /** + * Return the first derivative of the vector field at + * the specified point. + */ virtual std::vector<double> const& _f(double t, std::vector<double>& y) = 0; }; + /** + * Abstract base class for numerical solvers of dynamical systems. + */ class NumericalMethod { bool m_bdeleteVF; |
From: <mk...@us...> - 2003-07-18 21:15:46
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Include In directory sc8-pr-cvs1:/tmp/cvs-serv28170/Include Modified Files: VirtualScene.h Log Message: Index: VirtualScene.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Include/VirtualScene.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** VirtualScene.h 30 Jun 2003 22:29:15 -0000 1.7 --- VirtualScene.h 18 Jul 2003 21:15:44 -0000 1.8 *************** *** 91,105 **** void setFogEnd(float value); ! float getViewDistance() const { return m_ViewDistance; } void setViewDistance(float value); ! simdata::Vector3 const &getOrigin() { return m_Origin; } void setTerrain(simdata::Ref<TerrainObject>); ! simdata::Ref<TerrainObject> getTerrain() const { return m_Terrain; } int getTerrainPolygonsRendered(); void setCameraNode(osg::Node *); ! float getViewAngle() const { return m_ViewAngle; } void setViewAngle(float); --- 91,105 ---- void setFogEnd(float value); ! inline float getViewDistance() const { return m_ViewDistance; } void setViewDistance(float value); ! inline simdata::Vector3 const &getOrigin() { return m_Origin; } void setTerrain(simdata::Ref<TerrainObject>); ! inline simdata::Ref<TerrainObject> getTerrain() const { return m_Terrain; } int getTerrainPolygonsRendered(); void setCameraNode(osg::Node *); ! inline float getViewAngle() const { return m_ViewAngle; } void setViewAngle(float); |
From: <mk...@us...> - 2003-07-18 21:09:09
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Source In directory sc8-pr-cvs1:/tmp/cvs-serv26818/Source Modified Files: DynamicObject.cpp Log Message: Index: DynamicObject.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Source/DynamicObject.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** DynamicObject.cpp 26 Jun 2003 09:25:23 -0000 1.14 --- DynamicObject.cpp 18 Jul 2003 21:09:06 -0000 1.15 *************** *** 84,87 **** --- 84,88 ---- m_SceneModel = new SceneModel(m_Model); assert(m_SceneModel.valid()); + bindAnimations(); } } *************** *** 264,267 **** --- 265,276 ---- m_SceneModel->enableSmoke(); } + } + + void DynamicObject::setDataRecorder(DataRecorder *recorder) { + m_DataRecorder = recorder; + initDataRecorder(); + } + + void DynamicObject::initDataRecorder() { } |
From: <mk...@us...> - 2003-07-18 21:09:09
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Include In directory sc8-pr-cvs1:/tmp/cvs-serv26818/Include Modified Files: DynamicObject.h Log Message: Index: DynamicObject.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Include/DynamicObject.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DynamicObject.h 26 Jun 2003 09:25:45 -0000 1.10 --- DynamicObject.h 18 Jul 2003 21:09:06 -0000 1.11 *************** *** 32,35 **** --- 32,36 ---- #include "SmokeEffects.h" #include "TerrainObject.h" + #include "DataRecorder.h" *************** *** 142,147 **** --- 143,153 ---- void enableSmoke(); + void setDataRecorder(DataRecorder *recorder); + protected: + virtual void initDataRecorder(); + simdata::Ref<DataRecorder> m_DataRecorder; + virtual void pack(simdata::Packer& p) const; virtual void unpack(simdata::UnPacker& p); *************** *** 149,152 **** --- 155,160 ---- virtual void doMovement(double dt); virtual void postMotion(double dt); + + virtual void bindAnimations() {} BaseController * m_Controller; |
From: <mk...@us...> - 2003-07-18 21:05:17
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Source In directory sc8-pr-cvs1:/tmp/cvs-serv26067/Source Modified Files: ObjectModel.cpp Log Message: Index: ObjectModel.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Source/ObjectModel.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ObjectModel.cpp 2 Jul 2003 20:01:58 -0000 1.16 --- ObjectModel.cpp 18 Jul 2003 21:05:14 -0000 1.17 *************** *** 28,31 **** --- 28,32 ---- #include "ObjectModel.h" + #include "Animation.h" #include "Log.h" #include "Config.h" *************** *** 41,44 **** --- 42,47 ---- #include <osg/Texture> #include <osg/Geode> + #include <osg/Depth> + #include <osgText/Text> #include <osg/PolygonOffset> #include <osg/CullFace> *************** *** 47,54 **** --- 50,121 ---- #include <SimData/osg.h> + /* + TODO + + o adjust contact markers and view point for model + transform + + o implement ModelProcessor + + */ SIMDATA_REGISTER_INTERFACE(ObjectModel) + /** + * Animation binding helper that can be attached to model + * nodes (using osg::Object user data). When the model + * prototype is cloned, these bindings help to connect the + * new animation transform nodes to the correct animation + * callback. + */ + class AnimationBinding: public osg::Referenced { + simdata::Ref<Animation const> m_Animation; + public: + AnimationBinding(Animation const* animation): m_Animation(animation) {} + inline AnimationCallback *bind(osg::Node *node) const { + return m_Animation->newCallback(node); + } + }; + + + /** + * A visitor for model prototypes to attach animation + * bindings to the appropriate nodes. Each prototype + * only needs to be processed once, immediately after + * loading the model. The bindings are used when the + * model is later cloned by SceneModel to attach + * animation callbacks. + */ + class ModelProcessor: public osg::NodeVisitor { + osg::ref_ptr<osg::Node> m_Root; + simdata::Link<Animation>::vector const *m_Animations; + public: + ModelProcessor(): NodeVisitor(TRAVERSE_ALL_CHILDREN), m_Animations(0) { } + void setAnimations(simdata::Link<Animation>::vector const *animations) { + m_Animations = animations; + } + virtual void apply(osg::Transform &node) { + if (!m_Animations) return; + std::string name = node.getName(); + std::cout << "MODEL TRANSFORM: " << name << "\n"; + if (name.substr(0,6) == "ANIM: ") { + simdata::Key id = name.substr(6); + simdata::Link<Animation>::vector::const_iterator i = m_Animations->begin(); + std::cout << "SEARCHING FOR " << name.substr(6) << " (" << id << ")\n"; + for (; i != m_Animations->end(); ++i) { + std::cout << "COMPARING TO " << (*i)->getModelID() << "\n"; + if ((*i)->getModelID() == id) { + node.setUserData(new AnimationBinding(i->get())); + std::cout << "FOUND\n"; + break; + } + } + } + } + }; + + + /** * Visit nodes, applying anisotropic filtering to textures. *************** *** 133,136 **** --- 200,204 ---- p.pack(m_CullFace); p.pack(m_LandingGear); + p.pack(m_Animations); } *************** *** 150,153 **** --- 218,222 ---- p.unpack(m_CullFace); p.unpack(m_LandingGear); + p.unpack(m_Animations); } *************** *** 202,212 **** void ObjectModel::loadModel() { - /* - if (g_ModelPath == "") { - g_ModelPath = getDataPath("ModelPath"); - } - - std::string source = simdata::ospath::filter(simdata::ospath::join(g_ModelPath, m_ModelPath.getSource())); - */ std::string source = m_ModelPath.getSource(); --- 271,274 ---- *************** *** 223,231 **** assert(pNode); ! m_Node = pNode; ! m_Node->setName(m_ModelPath.getSource()); if (m_PolygonOffset != 0.0) { ! osg::StateSet *ss = m_Node->getOrCreateStateSet(); osg::PolygonOffset *po = new osg::PolygonOffset; po->setFactor(-1.0); --- 285,293 ---- assert(pNode); ! m_Model = pNode; ! m_Model->setName(m_ModelPath.getSource()); if (m_PolygonOffset != 0.0) { ! osg::StateSet *ss = m_Model->getOrCreateStateSet(); osg::PolygonOffset *po = new osg::PolygonOffset; po->setFactor(-1.0); *************** *** 236,240 **** if (m_CullFace != 0) { // XXX should reuse a single static CullFace instance. ! osg::StateSet *ss = m_Node->getOrCreateStateSet(); osg::CullFace *cf = new osg::CullFace; cf->setMode(m_CullFace < 0 ? osg::CullFace::BACK : osg::CullFace::FRONT); --- 298,302 ---- if (m_CullFace != 0) { // XXX should reuse a single static CullFace instance. ! osg::StateSet *ss = m_Model->getOrCreateStateSet(); osg::CullFace *cf = new osg::CullFace; cf->setMode(m_CullFace < 0 ? osg::CullFace::BACK : osg::CullFace::FRONT); *************** *** 242,252 **** } ! // XXX should do this after scaling, no? ! osg::BoundingSphere s = m_Node->getBound(); ! m_BoundingSphereRadius = s.radius(); ! ! m_Transform = new osg::MatrixTransform; ! m_Transform->setName("MODEL TRANSFORM"); ! m_Transform->addChild(m_Node.get()); assert(m_Axis0.Length() > 0.0); --- 304,329 ---- } ! if (m_Smooth) { ! osgUtil::SmoothingVisitor sv; ! m_Model->accept(sv); ! } ! ! if (m_Filter) { ! // FIXME: level should come from global graphics settings ! TrilinearFilterVisitor tfv(16.0); ! m_Model->accept(tfv); ! } ! ! osgUtil::Optimizer opt; ! opt.optimize(m_Model.get()); ! ! // add animation hooks to user data field of animation ! // transform nodes ! ModelProcessor processor; ! std::cout << "ANIMATIONS AVAILABLE: " << m_Animations.size() << "\n"; ! processor.setAnimations(&m_Animations); ! std::cout << "PROCESSING MODEL\n"; ! m_Model->accept(processor); ! std::cout << "PROCESSING MODEL DONE\n"; assert(m_Axis0.Length() > 0.0); *************** *** 256,295 **** assert(m_Axis1.Length() > 0.0); m_Axis1.Normalize(); - // find third axis - simdata::Vector3 axis2 = simdata::Cross(m_Axis0, m_Axis1); - - simdata::Matrix3 o(m_Axis0.x, m_Axis0.y, m_Axis0.z, m_Axis1.x, m_Axis1.y, m_Axis1.z, axis2.x, axis2.y, axis2.z); - o = o.Inverse() * m_Scale; - simdata::Matrix3::M_t (&R)[3][3] = o.rowcol; - osg::Matrix model_orientation; - model_orientation.set( - R[0][0], R[1][0], R[2][0], 0.0, - R[0][1], R[1][1], R[2][1], 0.0, - R[0][2], R[1][2], R[2][2], 0.0, - m_Offset.x, m_Offset.y, m_Offset.z, 1.0 - ); - m_Transform->setMatrix(model_orientation); ! if (m_Scale != 1.0) { ! m_Transform->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON); } //osg::StateSet * stateSet = m_rpNode->getStateSet(); //stateSet->setGlobalDefaults(); //m_rpNode->setStateSet(stateSet); - if (m_Smooth) { - osgUtil::SmoothingVisitor sv; - m_Transform->accept(sv); - } - - if (m_Filter) { - // FIXME: level should come from global graphics settings - TrilinearFilterVisitor tfv(16.0); - m_Transform->accept(tfv); - } - m_DebugMarkers = new osg::Switch; ! m_Transform->addChild(m_DebugMarkers.get()); // create visible markers for each contact point --- 333,384 ---- assert(m_Axis1.Length() > 0.0); m_Axis1.Normalize(); ! // insert an adjustment matrix at the head of the model only ! // if necessary. ! if (m_Axis0 != simdata::Vector3::XAXIS || ! m_Axis1 != simdata::Vector3::YAXIS || ! m_Scale != 1.0 || ! m_Offset != simdata::Vector3::ZERO) { ! // find third axis and make the transform matrix ! simdata::Vector3 axis2 = simdata::Cross(m_Axis0, m_Axis1); ! simdata::Matrix3 o(m_Axis0.x, m_Axis0.y, m_Axis0.z, ! m_Axis1.x, m_Axis1.y, m_Axis1.z, ! axis2.x, axis2.y, axis2.z); ! o = o.Inverse() * m_Scale; ! simdata::Matrix3::M_t (&R)[3][3] = o.rowcol; ! osg::Matrix model_orientation; ! model_orientation.set( ! R[0][0], R[1][0], R[2][0], 0.0, ! R[0][1], R[1][1], R[2][1], 0.0, ! R[0][2], R[1][2], R[2][2], 0.0, ! m_Offset.x, m_Offset.y, m_Offset.z, 1.0 ! ); ! osg::MatrixTransform *adjust = new osg::MatrixTransform; ! if (m_Scale != 1.0) { ! adjust->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON); ! } ! adjust->setName("XML_ADJUSTMENT"); ! adjust->setDataVariance(osg::Object::STATIC); ! adjust->setMatrix(model_orientation); ! adjust->addChild(m_Model.get()); ! m_Model = adjust; ! simdata::Matrix3 sd_adjust = simdata::fromOSG(model_orientation).Inverse(); ! for (unsigned i = 0; i < m_Contacts.size(); i++) { ! m_Contacts[i] = sd_adjust * m_Contacts[i] + m_Offset; ! } ! m_ViewPoint = sd_adjust * m_ViewPoint + m_Offset; } + osg::BoundingSphere s = m_Model->getBound(); + m_BoundingSphereRadius = s.radius(); + //osg::StateSet * stateSet = m_rpNode->getStateSet(); //stateSet->setGlobalDefaults(); //m_rpNode->setStateSet(stateSet); m_DebugMarkers = new osg::Switch; ! // XXX should reuse a single static stateset? ! m_DebugMarkers->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF); ! m_DebugMarkers->getOrCreateStateSet()->setAttributeAndModes(new osg::CullFace, osg::StateAttribute::ON); // create visible markers for each contact point *************** *** 299,311 **** addGearSprites(); - // TODO: run an optimizer to flatten the model transform (if it differs from identity) - osgUtil::Optimizer opt; - opt.optimize(m_Transform.get()); - osg::ref_ptr<osg::State> state = new osg::State; osgUtil::DisplayListVisitor dlv(osgUtil::DisplayListVisitor::COMPILE_DISPLAY_LISTS); dlv.setState(state.get()); dlv.setNodeMaskOverride(0xffffffff); ! m_Transform->accept(dlv); } --- 388,397 ---- addGearSprites(); osg::ref_ptr<osg::State> state = new osg::State; osgUtil::DisplayListVisitor dlv(osgUtil::DisplayListVisitor::COMPILE_DISPLAY_LISTS); dlv.setState(state.get()); dlv.setNodeMaskOverride(0xffffffff); ! m_Model->accept(dlv); ! m_DebugMarkers->accept(dlv); } *************** *** 457,461 **** makeLeftGear(m_LandingGear[1]); makeRightGear(m_LandingGear[2]); ! m_Transform->addChild(m_GearSprites.get()); } } --- 543,547 ---- makeLeftGear(m_LandingGear[1]); makeRightGear(m_LandingGear[2]); ! m_DebugMarkers->addChild(m_GearSprites.get()); } } *************** *** 499,508 **** --- 585,672 ---- + + /** + * Copy class for cloning model prototypes for use + * in the scene graph. Each new SceneModel uses this + * class to create a copy of the associated ObjectModel + * prototype. + */ + class ModelCopy: public osg::CopyOp { + public: + typedef std::vector<osg::ref_ptr<AnimationCallback> > AnimationCallbackVector; + inline AnimationCallbackVector const &getAnimationCallbacks() const { + return m_AnimationCallbacks; + } + virtual osg::Node* operator() (const osg::Node* node) const { + osg::Referenced const *data = node->getUserData(); + // user data bound to nodes is used to modify the copy operations + if (data) { + AnimationBinding const *binding = dynamic_cast<AnimationBinding const *>(data); + // nodes with animation bindings need a callback + if (binding) { + osg::Node *new_node = dynamic_cast<osg::Node*>(node->clone(*this)); + m_AnimationCallbacks.push_back(binding->bind(new_node)); + std::cout << "ADDED CALLBACK\n"; + return new_node; + } + } + if (dynamic_cast<osg::Group const *>(node)) { + // clone groups + return dynamic_cast<osg::Node*>(node->clone(*this)); + } else { + // copy other leaf nodes by reference + return const_cast<osg::Node*>(node); + } + } + private: + mutable AnimationCallbackVector m_AnimationCallbacks; + }; + SceneModel::SceneModel(simdata::Ref<ObjectModel> const & model) { m_Model = model; assert(m_Model.valid()); CSP_LOG(APP, INFO, "create SceneModel for " << m_Model->getModelPath()); + + // get the prototype model scene graph osg::Node *model_node = m_Model->getModel().get(); assert(model_node); + + // create a working copy + ModelCopy model_copy; + model_node = model_copy(model_node); + + std::cout << "MODEL COPIED\n"; + + std::cout << "MODEL animation count = " << model_copy.getAnimationCallbacks().size() << "\n"; + + m_AnimationCallbacks.resize(model_copy.getAnimationCallbacks().size()); + + // store all the animation update callbacks + std::copy(model_copy.getAnimationCallbacks().begin(), + model_copy.getAnimationCallbacks().end(), + m_AnimationCallbacks.begin()); + + std::cout << "MODEL animation count = " << m_AnimationCallbacks.size() << "\n"; + + m_Label = new osgText::Text(); + m_Label->setFont("screeninfo.ttf"); + m_Label->setFontSize(16, 16); + m_Label->setColor(osg::Vec4(0.3f, 0.4f, 1.0f, 1.0f)); + m_Label->setCharacterSize(100.0, 1.0); + m_Label->setPosition(osg::Vec3(6, 0, 0)); + m_Label->setText("AIRCRAFT"); + osg::Geode *label = new osg::Geode; + osg::Depth *depth = new osg::Depth; + depth->setFunction(osg::Depth::ALWAYS); + depth->setRange(1.0, 1.0); + label->getOrCreateStateSet()->setAttributeAndModes(depth, osg::StateAttribute::OFF); + label->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF); + //setMatrix(osg::Matrix::ortho2D(0,ScreenWidth,0,ScreenHeight)); + osg::MatrixTransform *m_modelview_abs = new osg::MatrixTransform; + m_modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE); + m_modelview_abs->setMatrix(osg::Matrix::identity()); + m_modelview_abs->addChild(label); + + // XXX the switch node is probably not necessary in most cases and should be removed // to switch between various representations of the same object (depending on views for example) m_Switch = new osg::Switch; *************** *** 511,514 **** --- 675,680 ---- m_Transform = new osg::PositionAttitudeTransform; m_Transform->addChild(m_Switch.get()); + m_Transform->addChild(m_Model->getDebugMarkers().get()); + m_Transform->addChild(m_modelview_abs); m_Smoke = false; //show(); *************** *** 522,525 **** --- 688,695 ---- } + void SceneModel::setLabel(std::string const &label) { + m_Label->setText(label); + } + void SceneModel::updateSmoke(double dt, simdata::Vector3 const &global_position, simdata::Quaternion const &attitude) { m_SmokeTrails->update(dt, global_position, attitude); *************** *** 579,649 **** } } - // FIXME: from SimObject.... needs to be incorparated: - /* - void SimObject::initModel() - { - CSP_LOG(APP, DEBUG, "SimObject::initModel() - ID: " << m_iObjectID); - - assert(m_rpNode == NULL && m_rpSwitch == NULL && m_rpTransform == NULL); - assert(m_Model.valid()); - - std::cout << "INIT MODEL\n"; - - m_rpNode = m_Model->getModel(); - - //osg::StateSet * stateSet = m_rpNode->getStateSet(); - //stateSet->setGlobalDefaults(); - //m_rpNode->setStateSet(stateSet); - - // to switch between various representants of same object (depending on views for example) - m_rpSwitch = new osg::Switch; - m_rpSwitch->setName("MODEL SWITCH"); - m_rpSwitch->addChild(m_rpNode.get()); - - // master object to which all others ones are linked - m_rpTransform = new osg::MatrixTransform; - m_rpTransform->setName("MODEL TRANSFORM"); - - m_rpTransform->addChild( m_rpSwitch.get() ); - //m_rpSwitch->setAllChildrenOn(); - } ! if (m_rpTransform != NULL && m_rpSwitch != NULL) { ! m_rpTransform->removeChild( m_rpSwitch.get() ); } ! ! void SimObject::ShowRepresentant(unsigned short const p_usflag) ! { ! m_rpSwitch->setAllChildrenOff(); ! m_rpSwitch->setValue(p_usflag, true); } - osg::Matrix worldMat; - simdata::Matrix3::M_t (&R)[3][3] = m_Orientation.rowcol; - worldMat.set(R[0][0], R[1][0], R[2][0], 0.0, - R[0][1], R[1][1], R[2][1], 0.0, - R[0][2], R[1][2], R[2][2], 0.0, - m_LocalPosition.x, m_LocalPosition.y, m_LocalPosition.z, 1.0); - //m_rpTransform->setReferenceFrame(osg::Transform::RELATIVE_TO_PARENTS); - - m_rpTransform->setMatrix(worldMat); - - // FIXME: call specific versions of this from derived classes: - //scene->addNodeToScene(m_rpTransform.get()); - - setCullingActive(true); - - //CSP_LOG(APP, DEBUG, "NodeName: " << m_rpNode->getName() << - // ", BoundingPos: " << sphere.center() << ", BoundingRadius: " << - // sphere.radius() ); - - - void SimObject::setCullingActive(bool flag) - { - if (m_rpTransform.valid()) { - m_rpTransform->setCullingActive(flag); - } - } - - */ --- 749,763 ---- } } ! AnimationChannel *SceneModel::bindAnimationChannel(std::string const &control, AnimationChannel *channel) { ! simdata::Key id(control); ! int index, n = m_AnimationCallbacks.size(); ! for (index = 0; index < n; ++index) { ! if (m_AnimationCallbacks[index]->getControlID() == id) { ! m_AnimationCallbacks[index]->bindChannel(channel); ! } } ! return channel; } |
From: <mk...@us...> - 2003-07-18 21:05:17
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Include In directory sc8-pr-cvs1:/tmp/cvs-serv26067/Include Modified Files: ObjectModel.h Log Message: Index: ObjectModel.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Include/ObjectModel.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ObjectModel.h 26 Jun 2003 09:25:45 -0000 1.10 --- ObjectModel.h 18 Jul 2003 21:05:14 -0000 1.11 *************** *** 43,46 **** --- 43,54 ---- #include "SmokeEffects.h" + class Animation; + class AnimationCallback; + class AnimationChannel; + + namespace osgText { + class Text; + } + /** *************** *** 74,77 **** --- 82,86 ---- SIMDATA_XML("cull_face", ObjectModel::m_CullFace, false) SIMDATA_XML("landing_gear", ObjectModel::m_LandingGear, false) + SIMDATA_XML("animations", ObjectModel::m_Animations, false) END_SIMDATA_XML_INTERFACE *************** *** 79,84 **** virtual ~ObjectModel(); ! osg::ref_ptr<osg::Node> getModel() { return m_Transform.get(); } ! osg::ref_ptr<osg::Node> getRawModel() { return m_Node.get(); } std::string getModelPath() const { return m_ModelPath.getSource(); } --- 88,93 ---- virtual ~ObjectModel(); ! osg::ref_ptr<osg::Node> getModel() { return m_Model.get(); } ! osg::ref_ptr<osg::Node> getDebugMarkers() { return m_DebugMarkers.get(); } std::string getModelPath() const { return m_ModelPath.getSource(); } *************** *** 112,115 **** --- 121,125 ---- ContactList m_Contacts; std::vector<simdata::Vector3> m_LandingGear; + simdata::Link<Animation>::vector m_Animations; virtual void pack(simdata::Packer& p) const; *************** *** 131,136 **** private: osg::ref_ptr<osg::Group> m_GearSprites; - osg::ref_ptr<osg::Node> m_Node; osg::ref_ptr<osg::MatrixTransform> m_Transform; osg::ref_ptr<osg::Switch> m_DebugMarkers; osg::ref_ptr<osg::Group> m_ContactMarkers; --- 141,146 ---- private: osg::ref_ptr<osg::Group> m_GearSprites; osg::ref_ptr<osg::MatrixTransform> m_Transform; + osg::ref_ptr<osg::Node> m_Model; osg::ref_ptr<osg::Switch> m_DebugMarkers; osg::ref_ptr<osg::Group> m_ContactMarkers; *************** *** 150,157 **** --- 160,169 ---- osg::ref_ptr<osg::PositionAttitudeTransform> m_Transform; osg::ref_ptr<osg::Switch> m_Switch; + osg::ref_ptr<osgText::Text> m_Label; simdata::Ref<ObjectModel> m_Model; bool m_Smoke; osg::ref_ptr<fx::SmokeTrailSystem> m_SmokeTrails; std::vector<simdata::Vector3> m_SmokeEmitterLocation; + std::vector< osg::ref_ptr<AnimationCallback> > m_AnimationCallbacks; protected: virtual ~SceneModel(); *************** *** 177,180 **** --- 189,194 ---- } + AnimationChannel *bindAnimationChannel(std::string const &control, AnimationChannel *channel); + void setSmokeEmitterLocation(std::vector<simdata::Vector3> const &sel); bool addSmoke(); *************** *** 183,186 **** --- 197,201 ---- void enableSmoke(); void updateSmoke(double dt, simdata::Vector3 const & global_position, simdata::Quaternion const &attitude); + void setLabel(std::string const &); }; |
From: <mk...@us...> - 2003-07-18 21:01:00
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Source In directory sc8-pr-cvs1:/tmp/cvs-serv24973/Source Modified Files: AircraftObject.cpp Log Message: Index: AircraftObject.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Source/AircraftObject.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** AircraftObject.cpp 30 Jun 2003 22:27:58 -0000 1.24 --- AircraftObject.cpp 18 Jul 2003 21:00:57 -0000 1.25 *************** *** 27,30 **** --- 27,32 ---- #include "AircraftObject.h" #include "AircraftPhysicsModel.h" + #include "FlightModel.h" + #include "Animation.h" #include "Collision.h" #include "Profile.h" *************** *** 53,56 **** --- 55,59 ---- m_Rudder = 0.0; m_Throttle = 0.0; + m_Airbrake = 0.0; m_dThrottleInput = 0.0; *************** *** 71,74 **** --- 74,79 ---- m_RudderMin = -1.0; m_RudderMax = -1.0; + m_AirbrakeMax = 1.0; + m_AirbrakeRate = 1.0; m_AileronInput = 0.0; *************** *** 76,79 **** --- 81,85 ---- m_RudderInput = 0.0; m_ThrottleInput = 0.0; + m_AirbrakeInput = 0.0; m_decayAileron = 0; *************** *** 89,92 **** --- 95,99 ---- BIND_AXIS("ELEVATOR", setElevator); BIND_AXIS("RUDDER", setRudder); + BIND_AXIS("AIRBRAKE", setAirbrake); BIND_ACTION("INC_THROTTLE", IncThrottle); BIND_ACTION("STOP_INC_THROTTLE", noIncThrottle); *************** *** 101,104 **** --- 108,115 ---- BIND_ACTION("DEC_ELEVATOR", DecElevator); BIND_ACTION("STOP_DEC_ELEVATOR", noDecElevator); + BIND_ACTION("INC_AIRBRAKE", IncAirbrake); + BIND_ACTION("DEC_AIRBRAKE", DecAirbrake); + BIND_ACTION("OPEN_AIRBRAKE", OpenAirbrake); + BIND_ACTION("CLOSE_AIRBRAKE", CloseAirbrake); BIND_ACTION("SMOKE_ON", SmokeOn); BIND_ACTION("SMOKE_OFF", SmokeOff); *************** *** 130,133 **** --- 141,146 ---- p.pack(m_RudderMin); p.pack(m_RudderMax); + p.pack(m_AirbrakeMax); + p.pack(m_AirbrakeRate); p.pack(m_AircraftDynamics); } *************** *** 142,148 **** --- 155,174 ---- p.unpack(m_RudderMin); p.unpack(m_RudderMax); + p.unpack(m_AirbrakeMax); + p.unpack(m_AirbrakeRate); p.unpack(m_AircraftDynamics); } + void AircraftObject::convertXML() { + m_AileronMin = DegreesToRadians(m_AileronMin); + m_AileronMax = DegreesToRadians(m_AileronMax); + m_ElevatorMin = DegreesToRadians(m_ElevatorMin); + m_ElevatorMax = DegreesToRadians(m_ElevatorMax); + m_RudderMin = DegreesToRadians(m_RudderMin); + m_RudderMax = DegreesToRadians(m_RudderMax); + m_AirbrakeMax = DegreesToRadians(m_AirbrakeMax); + m_AirbrakeRate = DegreesToRadians(m_AirbrakeRate); + } + void AircraftObject::postCreate() { DynamicObject::postCreate(); *************** *** 153,159 **** m_AircraftPhysicsModel->setInertia(m_Mass, m_Inertia); ! m_PrimaryAeroDynamics = m_AircraftDynamics->getAeroDynamics(); ! m_PrimaryAeroDynamics->setMassInverse(1.0 / m_Mass); ! m_AircraftPhysicsModel->addDynamics(m_PrimaryAeroDynamics.get()); m_EngineDynamics = m_AircraftDynamics->getEngineDynamics(); --- 179,188 ---- m_AircraftPhysicsModel->setInertia(m_Mass, m_Inertia); ! //m_PrimaryAeroDynamics = m_AircraftDynamics->getAeroDynamics(); ! //m_PrimaryAeroDynamics->setMassInverse(1.0 / m_Mass); ! //m_AircraftPhysicsModel->addDynamics(m_PrimaryAeroDynamics.get()); ! m_FlightDynamics = m_AircraftDynamics->getFlightDynamics(); ! m_FlightDynamics->setMassInverse(1.0 / m_Mass); ! m_AircraftPhysicsModel->addDynamics(m_FlightDynamics.get()); m_EngineDynamics = m_AircraftDynamics->getEngineDynamics(); *************** *** 243,254 **** } void AircraftObject::doFCS(double dt) { CSP_LOG(OBJECT, DEBUG, "AircraftObject::doFCS ..."); // FIXME: very temporary fcs mappings ! m_Rudder = m_RudderInput * m_RudderMax * 0.017; ! m_Aileron = m_AileronInput * m_AileronMax * 0.017; ! m_Elevator = m_ElevatorInput * m_ElevatorMax * 0.017; m_Throttle = m_ThrottleInput; CSP_LOG(OBJECT, DEBUG, " ... AircraftObject::doFCS"); } --- 272,329 ---- } + + void AircraftObject::bindAnimations() { + if (!m_SceneModel) return; + m_AnimateRudder = m_SceneModel->bindAnimationChannel("Aircraft.Rudder", new AnimationValueChannel); + m_AnimateElevator = m_SceneModel->bindAnimationChannel("Aircraft.Elevator", new AnimationValueChannel); + m_AnimateAileron = m_SceneModel->bindAnimationChannel("Aircraft.Aileron", new AnimationValueChannel); + m_AnimateAirbrake = m_SceneModel->bindAnimationChannel("Aircraft.Airbrake", new AnimationValueChannel); + } + + void AircraftObject::initDataRecorder() { + DynamicObject::initDataRecorder(); + m_Recorder.bind(m_DataRecorder.get()); + m_Recorder.addChannel(CH_AILERON_DEFLECTION, "aileron deflection"); + m_Recorder.addChannel(CH_ELEVATOR_DEFLECTION, "elevator deflection"); + m_Recorder.addChannel(CH_RUDDER_DEFLECTION, "rudder deflection"); + m_FlightDynamics->initDataRecorder(m_DataRecorder.get()); + } + void AircraftObject::doFCS(double dt) { CSP_LOG(OBJECT, DEBUG, "AircraftObject::doFCS ..."); + // FIXME: proper min-max limits // FIXME: very temporary fcs mappings ! m_Rudder = m_RudderInput * m_RudderMax; ! m_Aileron = m_AileronInput * m_AileronMax; ! m_Elevator = m_ElevatorInput * m_ElevatorMax; m_Throttle = m_ThrottleInput; + + { + float dAirbrake = m_AirbrakeMax * m_AirbrakeInput - m_Airbrake; + float dMax = m_AirbrakeRate * dt; + if (dAirbrake > 0.0) { + dAirbrake = std::min(dMax, dAirbrake); + } else { + dAirbrake = std::max(-dMax, dAirbrake); + } + m_Airbrake += dAirbrake; + CLIP(m_Airbrake, 0.0, m_AirbrakeMax); + } + + // XXX very preliminary animation testing + if (m_SceneModel.valid()) { + m_AnimateRudder->value() = m_Rudder; + m_AnimateAileron->value() = m_Aileron; + m_AnimateElevator->value() = m_Elevator; + m_AnimateAirbrake->value() = m_Airbrake; + } + + if (m_Recorder.isEnabled()) { + m_Recorder.record(CH_AILERON_DEFLECTION, m_Aileron); + m_Recorder.record(CH_ELEVATOR_DEFLECTION, m_Elevator); + m_Recorder.record(CH_RUDDER_DEFLECTION, m_Rudder); + } + CSP_LOG(OBJECT, DEBUG, " ... AircraftObject::doFCS"); } *************** *** 269,272 **** --- 344,352 ---- } + void AircraftObject::setAirbrake(double x) + { + m_AirbrakeInput = x; + } + void AircraftObject::setElevator(double x) { *************** *** 336,339 **** --- 416,435 ---- } + void AircraftObject::OpenAirbrake() { + m_AirbrakeInput = 1.0; + } + + void AircraftObject::CloseAirbrake() { + m_AirbrakeInput = 0.0; + } + + void AircraftObject::DecAirbrake() { + m_AirbrakeInput = std::max(m_Airbrake - 0.1, 0.0); + } + + void AircraftObject::IncAirbrake() { + m_AirbrakeInput = std::min(m_Airbrake + 0.1, 1.0); + } + void AircraftObject::SmokeOn() { enableSmoke(); *************** *** 408,415 **** m_Heading = heading; - /*attitude = simdata::Quaternion::MakeQFromEulerAngles( m_Pitch, - m_Roll, - m_Heading);*/ - // use standard Euler convension (X axis is roll, Y is pitch, Z is yaw). attitude = simdata::Quaternion::MakeQFromEulerAngles(m_Roll, m_Pitch, -m_Heading); --- 504,507 ---- *************** *** 496,500 **** void AircraftObject::doComplexPhysics(double dt) { - m_PrimaryAeroDynamics->setControlSurfaces(m_Aileron, m_Elevator, m_Rudder); // FIXME: calibrate joystick positions for csp m_EngineDynamics->setThrottle(2.0 * m_Throttle); --- 588,591 ---- *************** *** 508,512 **** //damage modelling. ! m_PrimaryAeroDynamics->setControlSurfaces(m_Aileron, m_Elevator, m_Rudder); m_AircraftPhysicsModel->setGroundZ(m_GroundZ); m_AircraftPhysicsModel->setGroundN(m_GroundN); --- 599,604 ---- //damage modelling. ! //m_PrimaryAeroDynamics->setControlSurfaces(m_Aileron, m_Elevator, m_Rudder, m_Airbrake); ! m_FlightDynamics->setControlSurfaces(m_Aileron, m_Elevator, m_Rudder, m_Airbrake); m_AircraftPhysicsModel->setGroundZ(m_GroundZ); m_AircraftPhysicsModel->setGroundN(m_GroundN); *************** *** 550,567 **** void AircraftDynamics::pack(simdata::Packer& p) const { ! simdata::Object::pack(p); ! p.pack(m_PrimaryAeroDynamics); p.pack(m_EngineDynamics); ! p.pack(m_GearDynamics); } void AircraftDynamics::unpack(simdata::UnPacker& p) { ! simdata::Object::unpack(p); ! p.unpack(m_PrimaryAeroDynamics); p.unpack(m_EngineDynamics); ! p.unpack(m_GearDynamics); } --- 642,664 ---- void AircraftDynamics::pack(simdata::Packer& p) const { ! Object::pack(p); ! //p.pack(m_PrimaryAeroDynamics); ! p.pack(m_FlightModel); p.pack(m_EngineDynamics); ! p.pack(m_GearDynamics); } void AircraftDynamics::unpack(simdata::UnPacker& p) { ! Object::unpack(p); ! //p.unpack(m_PrimaryAeroDynamics); ! p.unpack(m_FlightModel); p.unpack(m_EngineDynamics); ! p.unpack(m_GearDynamics); } + void AircraftDynamics::postCreate() { + m_FlightDynamics = m_FlightModel->newFlightDynamics(); + } |
From: <mk...@us...> - 2003-07-18 21:01:00
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Include In directory sc8-pr-cvs1:/tmp/cvs-serv24973/Include Modified Files: AircraftObject.h Log Message: Index: AircraftObject.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Include/AircraftObject.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AircraftObject.h 26 Jun 2003 09:25:45 -0000 1.14 --- AircraftObject.h 18 Jul 2003 21:00:57 -0000 1.15 *************** *** 1,3 **** ! // Combat Simulator Project - FlightSim Demo // Copyright (C) 2002 The Combat Simulator Project // http://csp.sourceforge.net --- 1,3 ---- ! // Combat Simulator Project - CSPSim // Copyright (C) 2002 The Combat Simulator Project // http://csp.sourceforge.net *************** *** 31,51 **** #include "HID.h" #include "LandingGear.h" ! #include "PrimaryAeroDynamics.h" class AircraftDynamics: public simdata::Object { ! simdata::Link<PrimaryAeroDynamics> m_PrimaryAeroDynamics; simdata::Link<GearDynamics> m_GearDynamics; simdata::Link<EngineDynamics> m_EngineDynamics; public: ! SIMDATA_OBJECT(AircraftDynamics, 3, 0) BEGIN_SIMDATA_XML_INTERFACE(AircraftDynamics) ! SIMDATA_XML("primary_aero_dynamics", AircraftDynamics::m_PrimaryAeroDynamics, true) SIMDATA_XML("gear_dynamics", AircraftDynamics::m_GearDynamics, true) SIMDATA_XML("engine_dynamics", AircraftDynamics::m_EngineDynamics, true) END_SIMDATA_XML_INTERFACE simdata::Ref<PrimaryAeroDynamics> getAeroDynamics() const { return m_PrimaryAeroDynamics; } simdata::Ref<GearDynamics> getGearDynamics() const { return m_GearDynamics; --- 31,64 ---- #include "HID.h" #include "LandingGear.h" ! //#include "PrimaryAeroDynamics.h" ! #include "FlightDynamics.h" ! ! ! class FlightModel; ! class AnimationValueChannel; class AircraftDynamics: public simdata::Object { ! //simdata::Link<PrimaryAeroDynamics> m_PrimaryAeroDynamics; ! simdata::Ref<FlightDynamics> m_FlightDynamics; ! simdata::Link<FlightModel> m_FlightModel; simdata::Link<GearDynamics> m_GearDynamics; simdata::Link<EngineDynamics> m_EngineDynamics; public: ! SIMDATA_OBJECT(AircraftDynamics, 4, 0) BEGIN_SIMDATA_XML_INTERFACE(AircraftDynamics) ! //SIMDATA_XML("primary_aero_dynamics", AircraftDynamics::m_PrimaryAeroDynamics, true) ! SIMDATA_XML("flight_model", AircraftDynamics::m_FlightModel, true) SIMDATA_XML("gear_dynamics", AircraftDynamics::m_GearDynamics, true) SIMDATA_XML("engine_dynamics", AircraftDynamics::m_EngineDynamics, true) END_SIMDATA_XML_INTERFACE + /* simdata::Ref<PrimaryAeroDynamics> getAeroDynamics() const { return m_PrimaryAeroDynamics; } + */ + simdata::Ref<FlightDynamics> getFlightDynamics() const { + return m_FlightDynamics; + } simdata::Ref<GearDynamics> getGearDynamics() const { return m_GearDynamics; *************** *** 57,60 **** --- 70,74 ---- void pack(simdata::Packer& p) const; void unpack(simdata::UnPacker& p); + void postCreate(); }; *************** *** 76,79 **** --- 90,95 ---- SIMDATA_XML("rudder_min", AircraftObject::m_RudderMin, true) SIMDATA_XML("rudder_max", AircraftObject::m_RudderMax, true) + SIMDATA_XML("airbrake_max", AircraftObject::m_AirbrakeMax, true) + SIMDATA_XML("airbrake_rate", AircraftObject::m_AirbrakeRate, true) SIMDATA_XML("aircraft_dynamics", AircraftObject::m_AircraftDynamics, true) END_SIMDATA_XML_INTERFACE *************** *** 83,86 **** --- 99,103 ---- AXIS_INTERFACE(AircraftObject, setAileron); AXIS_INTERFACE(AircraftObject, setElevator); + AXIS_INTERFACE(AircraftObject, setAirbrake); ACTION_INTERFACE(AircraftObject, IncElevator); ACTION_INTERFACE(AircraftObject, noIncElevator); *************** *** 107,110 **** --- 124,131 ---- ACTION_INTERFACE(AircraftObject, GearToggle); ACTION_INTERFACE(AircraftObject, MarkersToggle); + ACTION_INTERFACE(AircraftObject, OpenAirbrake); + ACTION_INTERFACE(AircraftObject, CloseAirbrake); + ACTION_INTERFACE(AircraftObject, IncAirbrake); + ACTION_INTERFACE(AircraftObject, DecAirbrake); AircraftObject(); *************** *** 127,141 **** void setComplexPhysics(bool flag) { m_ComplexPhysics = flag; } ! double getAngleOfAttack() const { ! return m_PrimaryAeroDynamics->getAngleOfAttack(); } ! double getSideSlip() const { ! return m_PrimaryAeroDynamics->getSideSlip(); } ! virtual double getGForce() const { ! return m_PrimaryAeroDynamics->getGForce(); } ! virtual double getSpeed() const { ! return m_PrimaryAeroDynamics->getSpeed(); } --- 148,166 ---- void setComplexPhysics(bool flag) { m_ComplexPhysics = flag; } ! inline double getAngleOfAttack() const { ! //return m_PrimaryAeroDynamics->getAngleOfAttack(); ! return m_FlightDynamics->getAngleOfAttack(); } ! inline double getSideSlip() const { ! //return m_PrimaryAeroDynamics->getSideSlip(); ! return m_FlightDynamics->getSideSlip(); } ! inline double getGForce() const { ! //return m_PrimaryAeroDynamics->getGForce(); ! return m_FlightDynamics->getGForce(); } ! inline double getSpeed() const { ! //return m_PrimaryAeroDynamics->getSpeed(); ! return m_FlightDynamics->getSpeed(); } *************** *** 151,158 **** virtual void unpack(simdata::UnPacker& p); virtual void postCreate(); virtual void setGearStatus(bool on); bool isGearRetracted() const; ! // dynamic properties double m_Roll; --- 176,193 ---- virtual void unpack(simdata::UnPacker& p); virtual void postCreate(); + virtual void convertXML(); + + virtual void bindAnimations(); + simdata::Ref<AnimationValueChannel> m_AnimateRudder; + simdata::Ref<AnimationValueChannel> m_AnimateElevator; + simdata::Ref<AnimationValueChannel> m_AnimateAileron; + simdata::Ref<AnimationValueChannel> m_AnimateAirbrake; virtual void setGearStatus(bool on); bool isGearRetracted() const; ! ! // data recording ! virtual void initDataRecorder(); ! // dynamic properties double m_Roll; *************** *** 165,168 **** --- 200,204 ---- double m_RudderInput; double m_ThrottleInput; + double m_AirbrakeInput; // keyboard inputs *************** *** 184,187 **** --- 220,224 ---- double m_Rudder; double m_Throttle; + double m_Airbrake; // control surface limits *************** *** 192,195 **** --- 229,234 ---- double m_RudderMin; double m_RudderMax; + double m_AirbrakeMax; + double m_AirbrakeRate; simdata::Ref<AircraftPhysicsModel> m_AircraftPhysicsModel; *************** *** 197,201 **** // various torques simdata::Link<AircraftDynamics> m_AircraftDynamics; ! simdata::Ref<PrimaryAeroDynamics> m_PrimaryAeroDynamics; simdata::Ref<GearDynamics> m_GearDynamics; simdata::Ref<GroundCollisionDynamics> m_GroundCollisionDynamics; --- 236,241 ---- // various torques simdata::Link<AircraftDynamics> m_AircraftDynamics; ! //simdata::Ref<PrimaryAeroDynamics> m_PrimaryAeroDynamics; ! simdata::Ref<FlightDynamics> m_FlightDynamics; simdata::Ref<GearDynamics> m_GearDynamics; simdata::Ref<GroundCollisionDynamics> m_GroundCollisionDynamics; *************** *** 204,207 **** --- 244,256 ---- bool m_PhysicsInitialized; bool m_ComplexPhysics; + + private: + enum { + CH_AILERON_DEFLECTION, + CH_ELEVATOR_DEFLECTION, + CH_RUDDER_DEFLECTION, + }; + RecorderInterface m_Recorder; + }; |
From: <mk...@us...> - 2003-07-18 20:55:14
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Include In directory sc8-pr-cvs1:/tmp/cvs-serv23790/Include Added Files: Animation.h Log Message: --- NEW FILE: Animation.h --- // Combat Simulator Project - CSPSim // 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. /** * @file Animation.h * **/ #ifndef __ANIMATION_H__ #define __ANIMATION_H__ #include <vector> #include <osg/Node> #include <osg/MatrixTransform> #include <SimData/Object.h> #include <SimData/Vector3.h> #include <SimData/Matrix3.h> #include <SimData/InterfaceRegistry.h> #include <SimData/osg.h> #include <cstdlib> /** * Base class for connecting animation controls to * animation callbacks. */ class AnimationChannel: public simdata::Referenced {}; /** * A simple animation channel for sharing a single * floating point value. */ class AnimationValueChannel: public AnimationChannel { float m_Value; public: inline float &value() { return m_Value; } inline float const &value() const { return m_Value; } }; /** * Base class for animation callbacks. * * This class serves as an update callback for * a transformation node that animates part of * a model scene graph. Update requests will * modify the transform if only if necessary. * The callback maintains a dirty counter which * is used to determine if a particular node * transform is stale. To test this, a separate * counter is stored in the user data slot of * the transform and updated accordingly. For * continuous animation loops, the dirty counter * is not used and the transform is updated after * every callback. */ class AnimationCallback: public osg::NodeCallback { protected: int m_DirtyCount; simdata::Key m_ControlID; class UpdateCount: public osg::Referenced { int m_UpdateCount; public: UpdateCount(): m_UpdateCount(0) {} inline void updateCount(int n) { m_UpdateCount = n; } inline int getCount() const { return m_UpdateCount; } }; public: AnimationCallback(): m_DirtyCount(0) {} virtual ~AnimationCallback() {} inline void dirty() { m_DirtyCount++; } inline bool needsUpdate(osg::Node& node) { UpdateCount *count = dynamic_cast<UpdateCount*>(node.getUserData()); assert(count); if (count->getCount() < m_DirtyCount) { count->updateCount(m_DirtyCount); return true; } return false; } inline simdata::Key const &getControlID() const { return m_ControlID; } inline void setControlID(simdata::Key const &id) { m_ControlID = id; } inline void bind(osg::Node &node) { node.setCullCallback(this); node.setUserData(new UpdateCount); dirty(); } virtual void bindChannel(AnimationChannel *)=0; virtual void setDefault(float x) {} }; /** * class Animation - base class for animated 3d model * components. * * Animation instances are bound to ObjectModels to * provide data about particular model animations. * Animation instances, like ObjectModels, are shared * by multiple SceneModel instances. */ class Animation: public simdata::Object { protected: simdata::Key m_ModelID; simdata::Key m_ControlID; int m_LOD; float m_Default; osg::ref_ptr<AnimationCallback> m_Callback; virtual AnimationCallback *newCallback(osg::Node *node, AnimationCallback *callback) const { assert(node); assert(callback); callback->bind(*node); callback->setControlID(m_ControlID); return callback; } public: BEGIN_SIMDATA_XML_VIRTUAL_INTERFACE(Animation) SIMDATA_XML("model_id", Animation::m_ModelID, true) SIMDATA_XML("control_id", Animation::m_ControlID, true) SIMDATA_XML("lod_limit", Animation::m_LOD, false) SIMDATA_XML("default", Animation::m_Default, false) END_SIMDATA_XML_INTERFACE Animation(); virtual ~Animation(); virtual void pack(simdata::Packer& p) const; virtual void unpack(simdata::UnPacker& p); virtual AnimationCallback *newCallback(osg::Node *node) const =0; inline simdata::Key const &getControlID() const { return m_ControlID; } inline simdata::Key const &getModelID() const { return m_ModelID; } }; /** * A simple, driven rotation animation in which the rotation * angle does not vary between updates. */ class DrivenRotation: public Animation { class Callback: public AnimationCallback { simdata::Ref<DrivenRotation const> m_Parameters; simdata::Ref<AnimationValueChannel const> m_Channel; float m_Value; public: Callback(DrivenRotation const *param): m_Parameters(param), m_Value(0.0) { assert(param); } virtual void bindChannel(AnimationChannel *channel) { m_Channel = dynamic_cast<AnimationValueChannel *>(channel); } virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { if (m_Channel.valid()) { float value = m_Channel->value(); if (value != m_Value) { m_Value = value; dirty(); } } if (needsUpdate(*node)) { osg::MatrixTransform *t = dynamic_cast<osg::MatrixTransform*>(node); assert(t); if (t) { osg::Matrix m = osg::Matrix::rotate(m_Value, m_Parameters->getAxis()); m.setTrans(t->getMatrix().getTrans()); t->setMatrix(m); } } traverse(node, nv); } virtual void setDefault(float x) { m_Value = x; dirty(); } }; public: SIMDATA_OBJECT(DrivenRotation, 0, 0); EXTEND_SIMDATA_XML_INTERFACE(DrivenRotation, Animation) SIMDATA_XML("limit_0", DrivenRotation::m_Limit0, false) SIMDATA_XML("limit_1", DrivenRotation::m_Limit1, false) SIMDATA_XML("gain", DrivenRotation::m_Gain, false) SIMDATA_XML("offset", DrivenRotation::m_Offset, false) SIMDATA_XML("axis", DrivenRotation::m_Axis, false) END_SIMDATA_XML_INTERFACE DrivenRotation(); virtual ~DrivenRotation(); virtual void pack(simdata::Packer& p) const; virtual void unpack(simdata::UnPacker& p); virtual void postCreate(); virtual AnimationCallback *newCallback(osg::Node *node) const { AnimationCallback *callback = Animation::newCallback(node, new Callback(this)); //callback->update(m_Default); callback->setDefault(m_Default); return callback; } inline osg::Vec3 getAxis() const { return simdata::toOSG(m_Axis); } inline float getLimit0() const { return m_Limit0; } inline float getLimit1() const { return m_Limit1; } inline float getGain() const { return m_Gain; } inline float getOffset() const { return m_Offset; } protected: simdata::Vector3 m_Axis; float m_Limit0; float m_Limit1; float m_Gain; float m_Offset; }; #endif // __ANIMATION_H__ |
From: <mk...@us...> - 2003-07-18 20:55:14
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Source In directory sc8-pr-cvs1:/tmp/cvs-serv23790/Source Added Files: Animation.cpp Log Message: --- NEW FILE: Animation.cpp --- // Combat Simulator Project - CSPSim // 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. /** * @file Animation.cpp * **/ #include "Animation.h" #include "Log.h" #include "Config.h" SIMDATA_REGISTER_INTERFACE(DrivenRotation) Animation::Animation(): m_LOD(0), m_Default(0.0f) { } Animation::~Animation() { } void Animation::pack(simdata::Packer& p) const { Object::pack(p); p.pack(m_ModelID); p.pack(m_ControlID); p.pack(m_LOD); p.pack(m_Default); } void Animation::unpack(simdata::UnPacker& p) { Object::unpack(p); p.unpack(m_ModelID); p.unpack(m_ControlID); p.unpack(m_LOD); p.unpack(m_Default); } DrivenRotation::DrivenRotation(): m_Axis(0.0f, 0.0f, 0.0f), m_Limit0(-G_PI), m_Limit1(G_PI), m_Gain(1.0f), m_Offset(0.0f) { } DrivenRotation::~DrivenRotation() { } void DrivenRotation::pack(simdata::Packer& p) const { Animation::pack(p); p.pack(m_Limit0); p.pack(m_Limit1); p.pack(m_Gain); p.pack(m_Offset); p.pack(m_Axis); } void DrivenRotation::unpack(simdata::UnPacker& p) { Animation::unpack(p); p.unpack(m_Limit0); p.unpack(m_Limit1); p.unpack(m_Gain); p.unpack(m_Offset); p.unpack(m_Axis); } void DrivenRotation::postCreate() { } |
From: <mk...@us...> - 2003-07-18 20:44:07
|
Update of /cvsroot/csp/APPLICATIONS/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv21672 Modified Files: CHANGES.current Log Message: Index: CHANGES.current =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/CHANGES.current,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** CHANGES.current 18 Jul 2003 18:44:08 -0000 1.45 --- CHANGES.current 18 Jul 2003 20:44:04 -0000 1.46 *************** *** 3,6 **** --- 3,15 ---- 2003-07-18: onsight + Separated the __PTS_SIM__ definition into PTS.h. Partial + template specialization must be simulated on msvc.net + version prior to vc.net 2003. This is currently done for + the ObjectRegistry classes. If PTS_SIM is required, the + new LUT classes are disabled since I don't want to spend + the (considerable) time that would be required to make them + work with PTS_SIM. + + 2003-07-18: onsight Enabled method attribute for specifying the interpolation method for LUT's. Valid methods are right now are LINEAR |
From: <mk...@us...> - 2003-07-18 20:41:15
|
Update of /cvsroot/csp/APPLICATIONS/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv20986 Modified Files: setup.py Log Message: Index: setup.py =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/setup.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** setup.py 18 Jul 2003 10:14:48 -0000 1.23 --- setup.py 18 Jul 2003 20:41:08 -0000 1.24 *************** *** 287,290 **** --- 287,291 ---- "Pack.h", "Path.h", + "PTS.h", "Quaternion.h", "Random.h", |
From: <mk...@us...> - 2003-07-18 20:32:00
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Include In directory sc8-pr-cvs1:/tmp/cvs-serv19102/Include Added Files: DataRecorder.h Log Message: --- NEW FILE: DataRecorder.h --- // Combat Simulator Project - CSPSim // 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. /** * @file DataRecorder.h * **/ #ifndef __DATARECORDER_H__ #define __DATARECORDER_H__ #include <cstdio> /** * A very preliminary flight data recorder class aimed * primarily at flight model testing and validation rather * than anything approaching a full acmi recorder. */ class DataRecorder: public simdata::Referenced { struct DataEntry { unsigned int id; float value; DataEntry() {} DataEntry(unsigned int id_, float value_): id(id_), value(value_) {} }; std::vector<DataEntry> m_Cache; char m_Set[256]; struct Channel { std::string name; }; std::vector<Channel> m_Channels; int m_Limit, m_Count; bool m_Enabled; float m_ElapsedTime; FILE *m_File; enum {TIME=250, PAUSE=251, RESUME=252, END=255}; public: /** * Construct a new data recorder, opening the output file * for writing and allocating an internal cache. The reorder * will be enabled by default, use setEnabled() to disable it * if desired. * * @param filename The output filename for the data recording. * @param cache The number of values that can be recorded before * flushing the data to the output files. Each cached * value currently requires 8 bytes. */ DataRecorder(std::string const &filename, int cache=20000) { m_File = (FILE *) fopen(filename.c_str(), "wb"); // XXX improve the error handling if (m_File == 0) throw "unable to open flight data recorder output"; m_Cache.resize(cache); m_Channels.reserve(16); m_Count = 0; m_Limit = cache; m_ElapsedTime = 0.0; m_Enabled = true; } /** * Add a new output channel to the recorder. * * Up to 250 output channels can be created. The name parameter * will be stored in the output file, and is used by external tools * to identify the different data streams. Internally, the integer * value returned by this method is used to refer to the channel * during subsequent recording. Channel names are only used for * later analysis, so multiple channels can have the same name and * will be independent (although there is probably no good reason to * do this). * * @param name The name of the data channel to add. * @returns The id number of the new channel for use with record(). * Returns -1 if channel creation failed (e.g. too many * channels). */ int addChannel(std::string const &name) { int n = int(m_Channels.size()); if (n >= 250) return -1; Channel channel; channel.name = name; m_Channels.push_back(channel); return n; } /** * Mark the current data stream time. The recorder monitors only * elapsed time, not absolute time, so the argument here is a time * interval. The elapsed time is managed internally. This method * will insert a time marker into the data stream, and also reset * the channel recording flags. Each channel can only record one * value between time stamps, so it is important to call this method * regularly. * * @param dt The time interval since the last time stamp. */ void timeStamp(float dt) { m_ElapsedTime += dt; _record(TIME, m_ElapsedTime); memset(m_Set, 0, 256); } /** * Record the value of an output channel. Only one call to record() * can be made per channel after each time stamp. Multiple recordings * to the same channel between time stamps will be silently ignored. * * @param id The channel id returned by addChannel() * @param value The value to record. */ void record(int id, float value) { if (id >= 0 && id <= int(m_Channels.size())) { // only record one entry per channel per timestamp if (m_Set[id]==0) { _record(id, value); m_Set[id] = 1; } } } /** * Enable or disable the recorder. Calls to record() and timeStamp() * will be silently ignored when the recorder is disabled. * * @param on True for enabled, false for disabled. */ void setEnabled(bool on) { if (m_Enabled && !on) { _record(PAUSE, 0.0); m_Enabled = false; } else if (on && !m_Enabled) { m_Enabled = true; _record(RESUME, 0.0); } } /** * Test whether the recorder is open and enabled. */ inline bool isEnabled() const { return m_Enabled && !isClosed(); } /** * Test whether the recorder has been closed. Once closed, * no further output to the recorder is possible. */ inline bool isClosed() const { return m_File == 0; } /** * Close the recorder, flushing the cache to disk and finalizing * the output file. Once closed a DataRecorder instance cannot * be reopened and will not record any further data. */ void close() { if (m_File != 0) { m_Enabled = true; _record(END, 0.0); // end of data _flush(); size_t channel_start = ftell(m_File); int n = m_Channels.size(); fwrite(&n, sizeof(n), 1, m_File); for (size_t i = 0; i < m_Channels.size(); i++) { char channel_name[64]; memset(channel_name, 0, 64); strncpy(channel_name, m_Channels[i].name.c_str(), 63); fwrite(channel_name, 64, 1, m_File); } fwrite(&channel_start, sizeof(channel_start), 1, m_File); fclose(m_File); m_File = 0; } } protected: /** * Write an output channel entry to the cache. Does nothing if * the recorder is disabled or closed, and takes care to flush * the cache to disk when it is full. */ inline void _record(int id, float value) { if (m_Enabled && m_File != 0) { m_Cache[m_Count] = DataEntry(static_cast<unsigned int>(id), value); if (++m_Count >= m_Limit) { _flush(); } } } /** * Flush the internal cache to disk. */ inline void _flush() { fwrite(&(m_Cache[0]), sizeof(DataEntry), m_Count, m_File); m_Count = 0; } /** * Close the recorder output if it is open before destruction. */ virtual ~DataRecorder() { close(); } }; /** * RecorderInterface provides access a DataRecorder and maintains a * list of local output channels. When multiple classes access the * same DataRecorder, each one should use a separate RecorderInterface * to manage output channels. Simply bind the DataRecorder to the * RecorderInterface and add local channels. Unlike the raw * DataRecorder interface, fixed channel identifiers (0-249) can * be used since the RecorderInterface keeps an internal translation * table. Typically a class will define fixed channel identifiers * as protected enums, starting at zero. */ class RecorderInterface { protected: // FIXME should use a weakref here simdata::Ref<DataRecorder> m_Recorder; std::vector<int> m_Channels; public: /** * Bind to an existing DataRecorder. Channels must be added * (or readded) after this method is called. * * @param recorder The DataRecorder instance, or NULL to unbind. */ void bind(DataRecorder *recorder) { m_Recorder = recorder; m_Channels.clear(); } /** * Returns true if a recorder is bound and is enabled. */ inline bool isEnabled() const { return (m_Recorder.valid() && m_Recorder->isEnabled()); } /** * Add a new output channel. * * @param id A fixed identifier for use with the record() method. * Legal values are 0 to 249. * @param name The label the output channel. */ void addChannel(int id, std::string const &name) { if (!m_Recorder || id >= 250) return; if (id >= int(m_Channels.size())) { m_Channels.resize(id+1, -1); } m_Channels[id] = m_Recorder->addChannel(name); } /** * Record a data value to an output channel. * * @param id The channel id. * @param value The value to record. */ void record(int id, float value) { if (m_Recorder.valid() && id >= 0 && id < int(m_Channels.size())) { int channel = m_Channels[id]; m_Recorder->record(channel, value); } } /** * Mark the current data stream time. See DataRecorder::stampTime() * for details. * * @param dt The time interval since the last time stamp. */ void timeStamp(float dt) { if (m_Recorder.valid()) { m_Recorder->timeStamp(dt); } } }; #endif // __DATARECORDER_H__ |