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: <mk...@us...> - 2003-07-18 20:30:17
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Source In directory sc8-pr-cvs1:/tmp/cvs-serv18871/Source Added Files: FlightDynamics.cpp FlightModel.cpp Log Message: --- NEW FILE: FlightDynamics.cpp --- // 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. /** * @file FlightDynamics.cpp * **/ # if defined(_MSC_VER) && (_MSC_VER <= 1300) #define NOMINMAX #endif #include <algorithm> #include "FlightDynamics.h" #include "FlightModel.h" #include "CSPSim.h" #include "Log.h" #include <SimData/Math.h> #include <SimData/Quaternion.h> using simdata::RadiansToDegrees; using simdata::DegreesToRadians; FlightDynamics::FlightDynamics(): m_depsilon(0.0), m_ElevatorScale(0.0), m_ElevatorInput(0.0), m_Aileron(0.0), m_Elevator(0.0), m_Rudder(0.0), m_Airbrake(0.0), m_Alpha(0.0), m_Alpha0(0.0), m_AlphaDot(0.0), m_Beta(0.0), m_GForce(1.0), m_Airspeed(0.0) { } FlightDynamics::~FlightDynamics() { } void FlightDynamics::setFlightModel(FlightModel *flight_model) { assert(flight_model); m_FlightModel = flight_model; } void FlightDynamics::setControlSurfaces(double aileron, double elevator, double rudder, double airbrake) { m_Aileron = aileron; m_ElevatorInput = elevator; m_Elevator = elevator; m_Rudder = rudder; m_Airbrake = airbrake; m_FlightModel->setControlSurfaces(aileron, elevator, rudder, airbrake); } void FlightDynamics::setMassInverse(double massInverse) { m_MassInverse = massInverse; } void FlightDynamics::initializeSimulationStep(double dt) { BaseDynamics::initializeSimulationStep(dt); double u = 0.05 + dt; m_ElevatorScale = (1.0 - u) * m_ElevatorScale + u * controlInputValue(m_GForce); m_Elevator = m_ElevatorInput * m_ElevatorScale; } void FlightDynamics::computeForceAndMoment(double x) { updateAirflow(x); m_FlightModel->setAirstream(m_Alpha, m_AlphaDot, m_Beta, m_Airspeed, *m_qBar); m_FlightModel->setKinetics(*m_AngularVelocityBody, *m_Height); m_Force = m_FlightModel->calculateForce(); m_Moment = m_FlightModel->calculateMoment(); m_GForce = m_MassInverse * m_Force.z / 9.81; } void FlightDynamics::postSimulationStep(double dt) { updateAirflow(dt); m_Alpha0 = m_Alpha; if (m_Recorder.isEnabled()) { m_Recorder.record(CH_ALPHA, m_Alpha); m_Recorder.record(CH_BETA, m_Beta); m_Recorder.record(CH_GFORCE, m_GForce); m_Recorder.record(CH_AIRSPEED, m_Airspeed); } } double FlightDynamics::controlIVbasis(double p_t) const { double cIV = p_t * p_t * ( 3.0 - 2.0 * p_t); return cIV; } void FlightDynamics::initDataRecorder(DataRecorder *recorder) { m_Recorder.bind(recorder); m_Recorder.addChannel(CH_ALPHA, "alpha"); m_Recorder.addChannel(CH_BETA, "beta"); m_Recorder.addChannel(CH_GFORCE, "gforce"); m_Recorder.addChannel(CH_AIRSPEED, "airspeed"); } double FlightDynamics::controlInputValue(double p_gForce) const { // to reduce G, decrease deflection control surface /* FIXME move to FCS class if (p_gForce > m_GMax && m_ElevatorInput > 0.0) return 0.0; if (p_gForce < m_GMin && m_ElevatorInput < 0.0) return 0.0; if (m_Alpha > m_stallAOA && m_ElevatorInput > 0.0) return 0.0; if (p_gForce > m_GMax - m_depsilon && m_ElevatorInput > 0.0) { return controlIVbasis((m_GMax - p_gForce) / m_depsilon); } if ( p_gForce < m_GMin + m_depsilon && m_ElevatorInput < 0.0) { return controlIVbasis((p_gForce - m_GMin) / m_depsilon); }*/ return 1.0; } void FlightDynamics::updateAirflow(double h) { m_AirflowBody = *m_VelocityBody - *m_WindBody; m_Airspeed = m_AirflowBody.Length(); m_Alpha = -atan2(m_AirflowBody.z, m_AirflowBody.y); if (h > 0.0) { m_AlphaDot = ( m_Alpha - m_Alpha0 ) / h; } // else keep previous value // restrict m_alphaDot in vertical stalls if (m_AlphaDot > 1.0) m_AlphaDot = 1.0; if (m_AlphaDot < -1.0) m_AlphaDot = -1.0; // Calculate side angle // beta is 0 when v velocity (i.e. side velocity) is 0; note here v is m_AirflowBody.x m_Beta = atan2(m_AirflowBody.x, m_AirflowBody.y); } --- NEW FILE: FlightModel.cpp --- // 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. /** * @file FlightModel.cpp * **/ /* TODO change control surface deflection sense to match lit. convensions */ # if defined(_MSC_VER) && (_MSC_VER <= 1300) #define NOMINMAX #endif #include <algorithm> #include "CSPSim.h" #include "Log.h" #include "FlightModel.h" #include "FlightDynamics.h" #include <SimData/Math.h> #include <SimData/Quaternion.h> using simdata::RadiansToDegrees; using simdata::DegreesToRadians; SIMDATA_REGISTER_INTERFACE(FlightModel) FlightModel::FlightModel() { } FlightModel::~FlightModel() { } void FlightModel::pack(simdata::Packer& p) const { Object::pack(p); p.pack(m_WingSpan); p.pack(m_WingChord); p.pack(m_WingArea); p.pack(m_stallAOA); p.pack(m_CD0); p.pack(m_CD_a); p.pack(m_CD_de); p.pack(m_CD_db); p.pack(m_CL0); p.pack(m_CL_a); p.pack(m_CL_adot); p.pack(m_CL_q); p.pack(m_CL_de); p.pack(m_CM0); p.pack(m_CM_a); p.pack(m_CM_adot); p.pack(m_CM_q); p.pack(m_CM_de); p.pack(m_CY_beta); p.pack(m_CY_p); p.pack(m_CY_r); p.pack(m_CY_da); p.pack(m_CY_dr); p.pack(m_CI_beta); p.pack(m_CI_p); p.pack(m_CI_r); p.pack(m_CI_da); p.pack(m_CI_dr); p.pack(m_Cn_beta); p.pack(m_Cn_p); p.pack(m_Cn_r); p.pack(m_Cn_da); p.pack(m_Cn_dr); } void FlightModel::unpack(simdata::UnPacker& p) { Object::unpack(p); p.unpack(m_WingSpan); p.unpack(m_WingChord); p.unpack(m_WingArea); p.unpack(m_stallAOA); p.unpack(m_CD0); p.unpack(m_CD_a); p.unpack(m_CD_de); p.unpack(m_CD_db); p.unpack(m_CL0); p.unpack(m_CL_a); p.unpack(m_CL_adot); p.unpack(m_CL_q); p.unpack(m_CL_de); p.unpack(m_CM0); p.unpack(m_CM_a); p.unpack(m_CM_adot); p.unpack(m_CM_q); p.unpack(m_CM_de); p.unpack(m_CY_beta); p.unpack(m_CY_p); p.unpack(m_CY_r); p.unpack(m_CY_da); p.unpack(m_CY_dr); p.unpack(m_CI_beta); p.unpack(m_CI_p); p.unpack(m_CI_r); p.unpack(m_CI_da); p.unpack(m_CI_dr); p.unpack(m_Cn_beta); p.unpack(m_Cn_p); p.unpack(m_Cn_r); p.unpack(m_Cn_da); p.unpack(m_Cn_dr); } void FlightModel::convertXML() { // angle data are given in degree m_stallAOA = DegreesToRadians(m_stallAOA); } void FlightModel::postCreate() { Object::postCreate(); m_AspectRatio = m_WingSpan * m_WingSpan / m_WingArea; m_CD_i = 1.0 / (0.9 * G_PI * m_AspectRatio); m_HalfWingArea = 0.5 * m_WingArea; } FlightDynamics *FlightModel::newFlightDynamics() { FlightDynamics *fd = new FlightDynamics; fd->setFlightModel(this); return fd; } simdata::Vector3 FlightModel::calculateLiftVector() { m_CL = ((m_CL0) + (m_CL_a * m_Alpha) + (m_CL_q * m_AngularVelocityBody.x + m_CL_adot * m_AlphaDot ) * m_WingChord * m_Inv2V + (m_CL_de * m_Elevator) ); if (fabs(m_Alpha) > m_stallAOA) { double c = fabs(m_Alpha) - m_stallAOA; m_CL = std::max(0.0, m_CL - c * c * 3.0); } double CL = m_CL * m_GE; return simdata::Vector3(0.0, CL * sin(m_Alpha), CL * cos(m_Alpha)); } /* okay... you'll want to have tables for e and you'll also want to make CD0 into CDmin and have induced drag as (CL - CLmin,drag)^2/pi*e*AR. So you'll have e for each CL you define and a two constant values (for constant Mach number) for CDmin and CLmin,drag. You'd probably want to make AR variable too in case you decide to model swing wing aircraft. You could even model the effects of wintip missiles. :-) */ simdata::Vector3 FlightModel::calculateDragVector() { double CL = m_CL - 0.04; //m_CL_md; m_CD = m_CD0 + \ m_CD_de * fabs(m_Elevator) + \ m_CD_db * fabs(m_Airbrake) + \ m_CD_i * CL * CL; return simdata::Vector3(0.0, -m_CD * cos(m_Alpha), m_CD * sin(m_Alpha)); } simdata::Vector3 FlightModel::calculateSideVector() { m_CY = m_CY_beta * m_Beta + m_CY_dr * m_Rudder - m_CY_r * m_AngularVelocityBody.z; return simdata::Vector3(m_CY * cos(m_Beta), m_CY * sin(m_Beta), 0.0); } simdata::Vector3 FlightModel::calculateForce() { return (calculateLiftVector() + calculateDragVector() + calculateSideVector()) * m_qBarS; } simdata::Vector3 FlightModel::calculateMoment() { simdata::Vector3 moment; moment.x = calculatePitchMoment(); moment.y = calculateRollMoment(); moment.z = calculateYawMoment(); return moment; } double FlightModel::calculateRollMoment() const { return ( (m_CI_beta * m_Beta) + (m_CI_da * m_Aileron) + (m_CI_p * m_AngularVelocityBody.y - m_CI_r * m_AngularVelocityBody.z)* m_WingSpan * m_Inv2V + (m_CI_dr * m_Rudder) ) * m_qBarS * m_WingSpan; } double FlightModel::calculatePitchMoment() const { return ( (m_CM0) + (m_CM_a * m_Alpha) + (m_CM_q * m_AngularVelocityBody.x + m_CM_adot * m_AlphaDot) * m_WingChord * m_Inv2V + (m_CM_de * m_Elevator) ) * m_qBarS * m_WingChord; } double FlightModel::calculateYawMoment() const { return - ( (m_Cn_beta * m_Beta) + (m_Cn_p * m_AngularVelocityBody.y - m_Cn_r * m_AngularVelocityBody.z) * m_WingSpan * m_Inv2V + (m_Cn_da * m_Aileron + m_Cn_dr * m_Rudder) ) * m_qBarS * m_WingSpan; } void FlightModel::updateGroundEffect(double height) { // TODO paramaterize in xml. if (height < m_WingSpan) { double x = std::max(0.0, height / m_WingSpan) + 0.1; //m_GE = 0.49 + (1.0 - 0.5 * height) * height; m_GE = 0.9835 + 0.020 / x / x; } else { m_GE = 1.0; } } |
From: <mk...@us...> - 2003-07-18 20:30:16
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Include In directory sc8-pr-cvs1:/tmp/cvs-serv18871/Include Added Files: FlightDynamics.h FlightModel.h Log Message: --- NEW FILE: FlightDynamics.h --- // 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. /** * @file FlightDynamics.h * **/ #ifndef __FLIGHTDYNAMICS_H__ #define __FLIGHTDYNAMICS_H__ #include <SimData/InterfaceRegistry.h> #include "BaseDynamics.h" #include "DataRecorder.h" class FlightModel; /** * class FlightDynamics - aircraft primary flight model implementation. * */ class FlightDynamics: public BaseDynamics, public simdata::Referenced { friend class FlightModel; virtual ~FlightDynamics(); public: FlightDynamics(); void computeForceAndMoment(double x); void initializeSimulationStep(double dt); void postSimulationStep(double dt); double getAngleOfAttack() const { return m_Alpha; } double getSideSlip() const { return m_Beta; } double getGForce() const { return m_GForce; } double getSpeed() const { return m_Airspeed; } void setControlSurfaces(double aileron, double elevator, double rudder, double airbrake); void setMassInverse(double massInverse); virtual void initDataRecorder(DataRecorder *); protected: void setFlightModel(FlightModel *flight_model); simdata::Ref<FlightModel> m_FlightModel; void updateAirflow(double dt); double controlIVbasis(double p_t) const; double controlInputValue(double p_gForce) const; double m_depsilon; // G-force control feedback stall double m_ElevatorScale; // elevator correction double m_ElevatorInput; // desired elevator deflection // control surfaces double m_Aileron; double m_Elevator; double m_Rudder; double m_Airbrake; // derived quantities double m_Alpha; // current angle of attack double m_Alpha0; // discrete AOA double m_AlphaDot; // AOA rate double m_Beta; // side slip angle double m_GForce; // current g acceleration double m_MassInverse; double m_Airspeed; simdata::Vector3 m_AirflowBody; // air flow velocity in body coordinate private: RecorderInterface m_Recorder; enum { CH_ALPHA, CH_BETA, CH_GFORCE, CH_AIRSPEED }; }; #endif // __FLIGHTDYNAMICS_H__ --- NEW FILE: FlightModel.h --- // 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. /** * @file FlightModel.h * **/ #ifndef __FLIGHTMODEL_H__ #define __FLIGHTMODEL_H__ #include <SimData/InterfaceRegistry.h> class FlightDynamics; /** * class FlightModel * * An aircraft flight model based on stability derivatives. * FlightModel instances are shared by all aircraft of a * given type. Each aircraft has its own FlightDynamics * instance that stores state information and drives the * FlightModel. To pass parameters more efficiently, the * FlightDynamics instance sets a number of temporary state * variables within the FlightModel, then performs a number * of computations using these variables. Hence, the * FlightModel methods are not suitable for multithreaded * environments in which more than one aircraft is simulated * at a time. * */ class FlightModel: public simdata::Object { public: SIMDATA_OBJECT(FlightModel, 0, 0) BEGIN_SIMDATA_XML_INTERFACE(FlightModel) SIMDATA_XML("wing_span", FlightModel::m_WingSpan, true) SIMDATA_XML("wing_chord", FlightModel::m_WingChord, true) SIMDATA_XML("wing_area", FlightModel::m_WingArea, true) SIMDATA_XML("stall_aoa", FlightModel::m_stallAOA, true) SIMDATA_XML("cd0", FlightModel::m_CD0, true) SIMDATA_XML("cd_a", FlightModel::m_CD_a, true) SIMDATA_XML("cd_de", FlightModel::m_CD_de, true) SIMDATA_XML("cd_db", FlightModel::m_CD_db, true) SIMDATA_XML("cl0", FlightModel::m_CL0, true) SIMDATA_XML("cl_a", FlightModel::m_CL_a, true) SIMDATA_XML("cl_adot", FlightModel::m_CL_adot, true) SIMDATA_XML("cl_q", FlightModel::m_CL_q, true) SIMDATA_XML("cl_de", FlightModel::m_CL_de, true) SIMDATA_XML("cm0", FlightModel::m_CM0, true) SIMDATA_XML("cm_a", FlightModel::m_CM_a, true) SIMDATA_XML("cm_adot", FlightModel::m_CM_adot, true) SIMDATA_XML("cm_q", FlightModel::m_CM_q, true) SIMDATA_XML("cm_de", FlightModel::m_CM_de, true) SIMDATA_XML("cy_beta", FlightModel::m_CY_beta, true) SIMDATA_XML("cy_p", FlightModel::m_CY_p, true) SIMDATA_XML("cy_r", FlightModel::m_CY_r, true) SIMDATA_XML("cy_da", FlightModel::m_CY_da, true) SIMDATA_XML("cy_dr", FlightModel::m_CY_dr, true) SIMDATA_XML("ci_beta", FlightModel::m_CI_beta, true) SIMDATA_XML("ci_p", FlightModel::m_CI_p, true) SIMDATA_XML("ci_r", FlightModel::m_CI_r, true) SIMDATA_XML("ci_da", FlightModel::m_CI_da, true) SIMDATA_XML("ci_dr", FlightModel::m_CI_dr, true) SIMDATA_XML("cn_beta", FlightModel::m_Cn_beta, true) SIMDATA_XML("cn_p", FlightModel::m_Cn_p, true) SIMDATA_XML("cn_r", FlightModel::m_Cn_r, true) SIMDATA_XML("cn_da", FlightModel::m_Cn_da, true) SIMDATA_XML("cn_dr", FlightModel::m_Cn_dr, true) END_SIMDATA_XML_INTERFACE FlightModel(); virtual ~FlightModel(); inline void setAirstream(double alpha, double alphaDot, double beta, double airspeed, double qBar) { // prevent driving the model outside its range of validity m_Alpha = std::max(-0.8, std::min(0.8, alpha)); m_AlphaDot = alphaDot; m_Beta = beta; m_qBarS = m_HalfWingArea * qBar * airspeed * airspeed; m_Inv2V = 0.5 / std::max(0.5, airspeed); } inline void setControlSurfaces(double aileron, double elevator, double rudder, double airbrake) { m_Aileron = aileron; m_Elevator = elevator; m_Rudder = rudder; m_Airbrake = airbrake; } inline void setKinetics(simdata::Vector3 const &angular_velocity_body, double height) { m_AngularVelocityBody = angular_velocity_body; updateGroundEffect(height); } simdata::Vector3 calculateForce(); simdata::Vector3 calculateMoment(); FlightDynamics *newFlightDynamics(); protected: virtual void pack(simdata::Packer& p) const; virtual void unpack(simdata::UnPacker& p); virtual void convertXML(); virtual void postCreate(); double m_WingSpan; double m_WingChord; // chord length double m_WingArea; // surface area of wings double m_stallAOA; // stall AOA /** * internally: X = right, Y = nose, Z = up * externally: X = nose, Y = right, Z = down (for XML input) */ double m_CD0; // CDo is the reference drag at zero angle of attack double m_CD_a; // CDa is the drag curve slope double m_CD_de; // CDde is the drag due to elevator double m_CD_db; // CDdb is the drag due to the airbrake(s) double m_CL0; // CLo is the reference lift at zero angle of attack double m_CL_a; // CLa is the lift curve slope double m_CL_adot; double m_CL_q; double m_CL_de; // CLde is the lift due to elevator double m_CM0; // CMo is the pitch moment coefficient double m_CM_a; // CMa is the pitch moment coefficient due to angle of attack double m_CM_adot; double m_CM_q; // CMq is the pitch moment coefficient due to pitch rate double m_CM_de; // CMde is the pitch coefficient due to elevator double m_CY_beta; // CLb - the dihedral effect double m_CY_p; // Clp - roll damping double m_CY_r; // CLr - roll due to yaw rate double m_CY_da; // Clda - roll due to aileron double m_CY_dr; // CLdr - roll due to rudder double m_CI_beta; double m_CI_p; double m_CI_r; double m_CI_da; double m_CI_dr; double m_Cn_beta; // CNb is the weather cocking stability double m_Cn_p; // CNp is the rudder adverse yaw double m_Cn_r; // CNr is the yaw damping double m_Cn_da; // CNda is the yaw due to aileron double m_Cn_dr; // CNdr is the yaw due to rudder void updateAngles(double dt); simdata::Vector3 calculateLiftVector(); simdata::Vector3 calculateDragVector(); simdata::Vector3 calculateSideVector(); double calculateRollMoment() const; double calculatePitchMoment() const; double calculateYawMoment() const; // compute the ground effect coefficient for use in setAirstream() void updateGroundEffect(double height); // derived quantities double m_HalfWingArea; double m_AspectRatio; double m_CD_i; // CD_i is induced drag coefficient = 1 / (e * pi * lambda) // where lamdba = Span^2 / Area and e is Osswald coefficient // shared intermediate values double m_CL; double m_CD; double m_CY; // airstream parameters double m_Alpha; double m_AlphaDot; double m_Beta; double m_qBarS; double m_Inv2V; double m_GE; // control surfaces double m_Aileron; double m_Elevator; double m_Rudder; double m_Airbrake; // kinetics simdata::Vector3 m_AngularVelocityBody; }; #endif // __FLIGHTMODEL_H__ |
From: <mk...@us...> - 2003-07-18 19:47:21
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Include/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv10826/Include/SimData Modified Files: LUT.h ObjectInterface.h TypeAdapter.h Log Message: Index: LUT.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/LUT.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LUT.h 18 Jul 2003 19:33:27 -0000 1.4 --- LUT.h 18 Jul 2003 19:47:16 -0000 1.5 *************** *** 20,24 **** ! #if defined(_MSC_VER) && (_MSC_VER <= 1300) // old versions of msvc can't do partial template specialization #define __SIMDATA_NO_LUT__ --- 20,26 ---- ! #include <SimData/PTS.h> ! ! #ifdef __PTS_SIM__ // old versions of msvc can't do partial template specialization #define __SIMDATA_NO_LUT__ Index: ObjectInterface.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/ObjectInterface.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ObjectInterface.h 9 May 2003 03:51:06 -0000 1.19 --- ObjectInterface.h 18 Jul 2003 19:47:17 -0000 1.20 *************** *** 37,40 **** --- 37,49 ---- #include <SimData/Pack.h> + /* + * Simulated Partial Template Specialization + * + * Adapted from: metactrl.h + * by Krzysztof Czarnecki & Ulrich Eisenecker + */ + #include <SimData/PTS.h> + + NAMESPACE_SIMDATA *************** *** 47,71 **** - /* - * Simulated Partial Template Specialization - * - * Adapted from: metactrl.h - * by Krzysztof Czarnecki & Ulrich Eisenecker - */ - - /* The following functions come from chapter 10 of the indispensable book - * Generative Programming by Krzysztof Czarnecki & Ulrich Eisenecker - * (C) Copyright Krzysztof Czarnecki & Ulrich Eisenecker 1998-2000. - * Permission to copy, use, modify, sell and distribute this software is - * granted provided this copyright notice appears in all copies. In case of - * modification, the modified files should carry a notice stating that - * you changed the files. - * This software is provided "as is" without express or implied - * warranty, and with no claim as to its suitability for any purpose. - */ - - #if defined(_MSC_VER) && (_MSC_VER <= 1300) - #define __PTS_SIM__ - #endif /** --- 56,59 ---- Index: TypeAdapter.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/TypeAdapter.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** TypeAdapter.h 18 Jul 2003 10:14:48 -0000 1.15 --- TypeAdapter.h 18 Jul 2003 19:47:17 -0000 1.16 *************** *** 41,44 **** --- 41,45 ---- #include <SimData/Types.h> + #include <SimData/PTS.h> *************** *** 63,66 **** --- 64,68 ---- class Object; + #ifndef __PTS_SIM__ template <int N, typename X> class LUT; *************** *** 69,72 **** --- 71,75 ---- typedef LUT<2,float> Table2; typedef LUT<3,float> Table3; + #endif // __PTS_SIM__ SIMDATA_EXCEPTION(TypeMismatch) *************** *** 209,215 **** --- 212,220 ---- inline void set(Curve & x) const { setBase(x); } inline void set(Table & x) const { setBase(x); } + #ifndef __PTS_SIM__ inline void set(Table1 & x) const { setBase(x); } inline void set(Table2 & x) const { setBase(x); } inline void set(Table3 & x) const { setBase(x); } + #endif // __PTS_SIM__ inline void set(External & x) const { setBase(x); } inline void set(Key & x) const { setBase(x); } |
From: <mk...@us...> - 2003-07-18 19:43:29
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Include/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv10054 Added Files: PTS.h Log Message: --- NEW FILE: PTS.h --- /* * Simulated Partial Template Specialization * * Adapted from: metactrl.h * by Krzysztof Czarnecki & Ulrich Eisenecker */ /* The following functions come from chapter 10 of the indispensable book * Generative Programming by Krzysztof Czarnecki & Ulrich Eisenecker * (C) Copyright Krzysztof Czarnecki & Ulrich Eisenecker 1998-2000. * Permission to copy, use, modify, sell and distribute this software is * granted provided this copyright notice appears in all copies. In case of * modification, the modified files should carry a notice stating that * you changed the files. * This software is provided "as is" without express or implied * warranty, and with no claim as to its suitability for any purpose. */ #if defined(_MSC_VER) && (_MSC_VER <= 1300) #ifndef __PTS_SIM__ #define __PTS_SIM__ #endif #endif |
From: <mk...@us...> - 2003-07-18 19:33:48
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Source In directory sc8-pr-cvs1:/tmp/cvs-serv8473/Source Modified Files: LUT.cpp Log Message: no lut for old msvc Index: LUT.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/LUT.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LUT.cpp 18 Jul 2003 10:14:49 -0000 1.1 --- LUT.cpp 18 Jul 2003 19:33:45 -0000 1.2 *************** *** 22,25 **** --- 22,27 ---- #include <SimData/LUT.h> + #ifndef __SIMDATA_NO_LUT__ + NAMESPACE_SIMDATA *************** *** 742,745 **** --- 744,749 ---- NAMESPACE_END // simdata + + #endif // __SIMDATA_NO_LUT__ |
From: <mk...@us...> - 2003-07-18 19:33:30
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Include/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv8432 Modified Files: LUT.h LUT.i Log Message: no lut for old msvc Index: LUT.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/LUT.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LUT.h 18 Jul 2003 10:14:48 -0000 1.3 --- LUT.h 18 Jul 2003 19:33:27 -0000 1.4 *************** *** 20,23 **** --- 20,30 ---- + #if defined(_MSC_VER) && (_MSC_VER <= 1300) + // old versions of msvc can't do partial template specialization + #define __SIMDATA_NO_LUT__ + #define __SIMDATA_LUT_H__ + #endif + + #ifndef __SIMDATA_LUT_H__ #define __SIMDATA_LUT_H__ Index: LUT.i =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/LUT.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LUT.i 17 Jul 2003 10:12:40 -0000 1.1 --- LUT.i 18 Jul 2003 19:33:27 -0000 1.2 *************** *** 4,7 **** --- 4,9 ---- %} + #ifndef __NO_LUT__ + %include "std_vector.i" %include "SimData/ns-simdata.h" *************** *** 120,142 **** %template(Table2) LUT<2,float>; %template(Table3) LUT<3,float>; - %template(Table4) LUT<4,float>; - /* - %rename(__getitem__) LUT<1,float>::getValue(std::vector<float> const &) const; - %rename(__getitem__) Table1::getValue(std::vector<float> const &) const; - %rename(__getitem__) Table2::getValue(std::vector<float> const &) const; - %rename(__getitem__) Table3::getValue(std::vector<float> const &) const; - %rename(__getitem__) Table4::getValue(std::vector<float> const &) const; - %rename(__repr__) LUT<1,float>::asString() const; - %rename(__repr__) Table1::asString() const; - %rename(__repr__) Table2::asString() const; - %rename(__repr__) Table3::asString() const; - %rename(__repr__) Table4::asString() const; - */ - %exception; NAMESPACE_END // simdata --- 122,132 ---- %template(Table2) LUT<2,float>; %template(Table3) LUT<3,float>; %exception; NAMESPACE_END // simdata + + #endif // __NO_LUT__ |
From: <mk...@us...> - 2003-07-18 18:44:48
|
Update of /cvsroot/csp/APPLICATIONS/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv31838 Modified Files: Makefile Log Message: Index: Makefile =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Makefile,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Makefile 17 Jul 2003 10:12:39 -0000 1.14 --- Makefile 18 Jul 2003 18:44:45 -0000 1.15 *************** *** 7,11 **** export GLDOPTS = -shared -lswigpy -ldl export GSWOPTS = -c -c++ -python -noexcept ! export CXX = g++-3.2 export SWIG = swig --- 7,11 ---- export GLDOPTS = -shared -lswigpy -ldl export GSWOPTS = -c -c++ -python -noexcept ! export CXX = g++ export SWIG = swig |
From: <mk...@us...> - 2003-07-18 18:44:14
|
Update of /cvsroot/csp/APPLICATIONS/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv31593 Modified Files: CHANGES.current Log Message: see CHANGES.current Index: CHANGES.current =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/CHANGES.current,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** CHANGES.current 18 Jul 2003 10:14:48 -0000 1.44 --- CHANGES.current 18 Jul 2003 18:44:08 -0000 1.45 *************** *** 2,5 **** --- 2,14 ---- =========================== + 2003-07-18: onsight + Enabled method attribute for specifying the interpolation + method for LUT's. Valid methods are right now are LINEAR + or SPLINE (case insensitive). The default is linear. + + For example: + <Table1 name="foo" method="spline"> + <Breaks0> .... etc. + 2003-07-17: onsight Moved non-inlined LUT methods and ancillary classes out |
From: <mk...@us...> - 2003-07-18 18:44:14
|
Update of /cvsroot/csp/APPLICATIONS/SimData/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv31593/SimData Modified Files: Parse.py Log Message: see CHANGES.current Index: Parse.py =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/SimData/Parse.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Parse.py 18 Jul 2003 10:14:49 -0000 1.8 --- Parse.py 18 Jul 2003 18:44:08 -0000 1.9 *************** *** 608,619 **** handlers = { "Values" : FloatListHandler, ! # "Method" : EnumHandler, } members = handlers.keys() ! required_members = members def __init__(self, dim, id, base, name, attrs): SimpleHandler.__init__(self, id, base, name, attrs) self._required_members = _LUTHandler.required_members for i in range(dim): --- 608,620 ---- handlers = { "Values" : FloatListHandler, ! "Method" : StringHandler, } members = handlers.keys() ! required_members = ["Values"] def __init__(self, dim, id, base, name, attrs): SimpleHandler.__init__(self, id, base, name, attrs) + self._method = attrs.get("method", "linear") self._required_members = _LUTHandler.required_members for i in range(dim): *************** *** 657,663 **** values, attrs = tags["Values"] table.load(values, breaks) ! # method, attrs = tags["Method"] ! # table.method.parseXML(method) ! table.interpolate(spacing, table.LINEAR) interface.set(object, name, table) --- 658,667 ---- values, attrs = tags["Values"] table.load(values, breaks) ! try: ! method = getattr(table, self._method.upper()) ! except: ! msg = "LUTHander: unknown interpolation method '%s'" % self._method ! raise XMLSyntax, msg ! table.interpolate(spacing, method) interface.set(object, name, table) |
From: <mk...@us...> - 2003-07-18 10:14:51
|
Update of /cvsroot/csp/APPLICATIONS/SimData/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv15388/SimData Modified Files: Parse.py Log Message: see CHANGES.current Index: Parse.py =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/SimData/Parse.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Parse.py 17 Jul 2003 10:12:40 -0000 1.7 --- Parse.py 18 Jul 2003 10:14:49 -0000 1.8 *************** *** 580,584 **** xbreaks, attrs = tags["XBreaks"] if not attrs.has_key("spacing"): ! msg = "CurveHander <XBreaks> tag missing required attribute 'spacing'" raise XMLSyntax, msg xspacing = float(attrs["spacing"]) --- 580,584 ---- xbreaks, attrs = tags["XBreaks"] if not attrs.has_key("spacing"): ! msg = "TableHander <XBreaks> tag missing required attribute 'spacing'" raise XMLSyntax, msg xspacing = float(attrs["spacing"]) *************** *** 587,591 **** ybreaks, attrs = tags["YBreaks"] if not attrs.has_key("spacing"): ! msg = "CurveHander <YBreaks> tag missing required attribute 'spacing'" raise XMLSyntax, msg yspacing = float(attrs["spacing"]) --- 587,591 ---- ybreaks, attrs = tags["YBreaks"] if not attrs.has_key("spacing"): ! msg = "TableHander <YBreaks> tag missing required attribute 'spacing'" raise XMLSyntax, msg yspacing = float(attrs["spacing"]) *************** *** 598,601 **** --- 598,679 ---- table.interpolate() interface.set(object, name, table) + + + + ## + # Generic LUT handler, specialized below for Table1, Table2, and Table3 + # + class _LUTHandler(SimpleHandler): + + handlers = { + "Values" : FloatListHandler, + # "Method" : EnumHandler, + } + + members = handlers.keys() + required_members = members + + def __init__(self, dim, id, base, name, attrs): + SimpleHandler.__init__(self, id, base, name, attrs) + self._required_members = _LUTHandler.required_members + for i in range(dim): + self._required_members.append("Breaks%d" % i) + self._dim = dim + self._keys = {} + + def handleChild(self, name, attrs): + if name.startswith("Breaks"): + return FloatListHandler + return _LUTHandler.handlers[name] + + def validateChild(self, name, attrs): + if name.startswith("Breaks"): + n = int(name[6:]) + return n >= 0 and n < self._dim + return name in _LUTHandler.members + + def endChild(self): + child = self._handler.getElement() + attrs = self._handler._attrs + member = self._handler_tag + self._keys[member] = (child, attrs) + + def assign(self, interface, object, name): + missing = filter(lambda x, f=self._keys.has_key: not f(x), self._required_members) + assert len(missing)==0, "LUTHandler required tag(s) missing:\n %s" % str(missing) + table = getattr(SimData, "Table%d" % self._dim)() + tags = self._keys + breaks = [] + spacing = [] + for i in range(self._dim): + breakpoints, attrs = tags["Breaks%d" % i] + if not attrs.has_key("spacing"): + msg = "LUTHander <Breaks%d> tag missing required attribute 'spacing'" % i + raise XMLSyntax, msg + breaks.append(breakpoints) + dx = float(attrs["spacing"]) + n = 1 + int((max(breaks[i]) - min(breaks[i])) / dx) + spacing.append(n) + values, attrs = tags["Values"] + table.load(values, breaks) + # method, attrs = tags["Method"] + # table.method.parseXML(method) + table.interpolate(spacing, table.LINEAR) + interface.set(object, name, table) + + + class Table1Handler(_LUTHandler): + def __init__(self, id, base, name, attrs): + _LUTHandler.__init__(self, 1, id, base, name, attrs) + + + class Table2Handler(_LUTHandler): + def __init__(self, id, base, name, attrs): + _LUTHandler.__init__(self, 2, id, base, name, attrs) + + + class Table3Handler(_LUTHandler): + def __init__(self, id, base, name, attrs): + _LUTHandler.__init__(self, 3, id, base, name, attrs) |
From: <mk...@us...> - 2003-07-18 10:14:51
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Include/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv15388/Include/SimData Modified Files: LUT.h Pack.h TypeAdapter.h Log Message: see CHANGES.current Index: LUT.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/LUT.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LUT.h 17 Jul 2003 10:12:40 -0000 1.2 --- LUT.h 18 Jul 2003 10:14:48 -0000 1.3 *************** *** 29,45 **** * Interpolated lookup tables of arbitrary dimension. * ! * TODO ! * this code is still in the form of a .cpp file used ! * during testing/development ! * ! * need to integrate with simdata: ! * inherit from basetype ! * implement pack/unpack/asString, etc. ! * (see the original simdata::Curve and simdata::Table [...1049 lines suppressed...] - - /* - simdata::Table3 t3; - t0 = simdata::SimDate::getSystemTime(); - // XXX must set data before interpolating - t3.interpolate(simdata::Table3::Dim(100)(40)(20), simdata::Interpolation::SPLINE); - t1 = simdata::SimDate::getSystemTime(); - std::cout << (t1-t0) << " s\n"; - */ - } - - int main() try { - test(); - return 0; - } catch(...) { } - - #endif #endif // __SIMDATA_LUT_H__ --- 667,670 ---- Index: Pack.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/Pack.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Pack.h 17 Jul 2003 10:12:40 -0000 1.8 --- Pack.h 18 Jul 2003 10:14:48 -0000 1.9 *************** *** 297,300 **** --- 297,306 ---- def unpack_Curve(self): return self.unpack_basetype(Curve()) + def unpack_Table1(self): + return self.unpack_basetype(Table1()) + def unpack_Table2(self): + return self.unpack_basetype(Table2()) + def unpack_Table3(self): + return self.unpack_basetype(Table3()) def unpack_Path(self): return self.unpack_basetype(Path()) Index: TypeAdapter.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/TypeAdapter.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TypeAdapter.h 17 Jul 2003 10:12:40 -0000 1.14 --- TypeAdapter.h 18 Jul 2003 10:14:48 -0000 1.15 *************** *** 63,66 **** --- 63,72 ---- class Object; + template <int N, typename X> + class LUT; + + typedef LUT<1,float> Table1; + typedef LUT<2,float> Table2; + typedef LUT<3,float> Table3; SIMDATA_EXCEPTION(TypeMismatch) *************** *** 203,206 **** --- 209,215 ---- inline void set(Curve & x) const { setBase(x); } inline void set(Table & x) const { setBase(x); } + inline void set(Table1 & x) const { setBase(x); } + inline void set(Table2 & x) const { setBase(x); } + inline void set(Table3 & x) const { setBase(x); } inline void set(External & x) const { setBase(x); } inline void set(Key & x) const { setBase(x); } |
From: <mk...@us...> - 2003-07-18 10:14:51
|
Update of /cvsroot/csp/APPLICATIONS/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv15388 Modified Files: CHANGES.current setup.py Log Message: see CHANGES.current Index: CHANGES.current =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/CHANGES.current,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** CHANGES.current 18 Jul 2003 01:34:11 -0000 1.43 --- CHANGES.current 18 Jul 2003 10:14:48 -0000 1.44 *************** *** 2,5 **** --- 2,29 ---- =========================== + 2003-07-17: onsight + Moved non-inlined LUT methods and ancillary classes out + of the header and into LUT.cpp. Since these are template + classes the code now specifically instantiates three + versions: + + LUT<1,float> = Table1 + LUT<2,float> = Table2 + LUT<3,float> = Table3 + + Added packing and unpacking of LUT's. + + Added XML support for LUTS classes. The format is very + similar to <Curve> and <Table>, but the <XBreaks> and + <YBreaks> tags are now generalized to <BreaksN> where N + is a 0, 1, or 2. So <Table1> needs a <Breaks0> subfield, + while <Table2> needs both <Breaks0> and <Breaks1>. + Interpolation mode is not yes supported (it always uses + linear interpolation). + + Modified Makefile and setup.py to build and install LUT.cpp. + + ==========> VC USERS: add LUT.cpp to the project. + 2003-07-17: brandon Changed hash_map.h and HashUtility.h to support Index: setup.py =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/setup.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** setup.py 17 Jul 2003 10:12:39 -0000 1.22 --- setup.py 18 Jul 2003 10:14:48 -0000 1.23 *************** *** 239,242 **** --- 239,243 ---- "List", "LogStream", + "LUT", "Math", "Matrix3", |
From: <mk...@us...> - 2003-07-18 02:00:28
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Include In directory sc8-pr-cvs1:/tmp/cvs-serv6300/Include Modified Files: SimpleConfig.h Log Message: Index: SimpleConfig.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Include/SimpleConfig.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SimpleConfig.h 22 Mar 2003 02:25:18 -0000 1.7 --- SimpleConfig.h 18 Jul 2003 02:00:22 -0000 1.8 *************** *** 336,340 **** private: ! # if defined(_MSC_VER) && (_MSC_VER == 1300) typedef HASH_MAP<std::string, ConfigElement*, simdata::eqstring> ConfigDictionary; #else --- 336,340 ---- private: ! # if defined(_MSC_VER) && (_MSC_VER >= 1300) typedef HASH_MAP<std::string, ConfigElement*, simdata::eqstring> ConfigDictionary; #else |
From: <mk...@us...> - 2003-07-18 02:00:28
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim In directory sc8-pr-cvs1:/tmp/cvs-serv6300 Modified Files: CHANGES.current Log Message: Index: CHANGES.current =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/CHANGES.current,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** CHANGES.current 3 Jul 2003 08:28:27 -0000 1.43 --- CHANGES.current 18 Jul 2003 02:00:22 -0000 1.44 *************** *** 2,5 **** --- 2,73 ---- =========================== + 2003-07-17: onsight + Changed SimpleConfig.h to use windows-specific hash + code for msvc version >= 1300 (instead of == 1300). + + 2003-07-09: onsight + + Added DataRecorder and RecorderInterface classes for + saving runtime data to disk. DynamicObject has basic + support and hooks for using a data recorder, and + AircraftObject and FlightDynamics defines several + output channels. Gamescreen toggles the recorder on + and off for the active object using the + TOGGLE_RECORDING input hook, which is bound to the + 'r' key by default. A new screeninfo tag in the + upper right corner of the screen displays "RECORD" + when the recorder is on. + + The output from each recording goes to a sequentially + numbered file in the current directory: data-XXX.rec, + where XXX starts at 000 each time CSPSim is run. A + utility called rec under Tools/Recorder can convert + the data recording to either tab-delimited text or + jgraph (a text based graph description language for + generating postscript). The shell script 'graph' + in the same directory will run the output of rec + through jgraph and ps2pdf to generate a pdf file + containing plots of all the data in one shot (if + you have jgraph and ghostscript installed that is). + + 2003-07-07: onsight + + Various animation improvements. Using cull callback + now instead of update so that only visible models are + animated. Changed simulation-animation binding to use + a shared (ref counted) instance to transfer the + animation control variable. + + Static model transforms (offset, scale, orientation) + are now applied to the contact points and view point. + Thus these points should be specified in the original + model coordinates in the XML file. + + 2003-07-03: onsight + + Initial animation infrastructure. Added Animation.h + and Animation.cpp, plus changes to ObjectModel and + SceneModel. AircraftObject also has hooks into the + model animation to set control surface deflections. + + The m2k model.xml file has been modified to add control + surface animation parameters, and a new model is used + that implements transformation nodes around the major + control surfaces and speed brakes. + + Speedbrake support added to AircraftObject. This is + hooked into new input commands: + * OPEN_AIRBRAKE + * CLOSE_AIRBRAKE + * INC_AIRBRAKE + * DEC_AIRBRAKE + * AIRBRAKE (continuous axis) + + PrimaryAeroDynamics now receives speedbrake deflection + from AicraftObject and adds a new linear drag term to + the drag coefficient (Cd_db * db). + + ==========> VC users add Animation.cpp to the project. + 2003-07-02: onsight |
From: <bra...@us...> - 2003-07-18 01:34:14
|
Update of /cvsroot/csp/APPLICATIONS/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv31636 Modified Files: CHANGES.current Log Message: Updated notes Index: CHANGES.current =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/CHANGES.current,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** CHANGES.current 17 Jul 2003 10:12:39 -0000 1.42 --- CHANGES.current 18 Jul 2003 01:34:11 -0000 1.43 *************** *** 2,5 **** --- 2,12 ---- =========================== + 2003-07-17: brandon + Changed hash_map.h and HashUtility.h to support + MSVC 2003 by updating the version numbers >=1300 + Changed interpolate.cpp and removed the + InterpolatedData<T> from the find function param to prevent + MSVC 2003 from erroring on that. + 2003-07-16: onsight Tweaked TypeAdapter constructors to disambiguate the copy |
From: <bra...@us...> - 2003-07-18 01:33:56
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Include/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv31539 Modified Files: hash_map.h HashUtility.h Log Message: Updated the MSVC version constants to be >= 1300 so the code would compile on MSVC 2003 Index: hash_map.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/hash_map.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** hash_map.h 12 Apr 2003 08:56:38 -0000 1.5 --- hash_map.h 18 Jul 2003 01:33:53 -0000 1.6 *************** *** 49,53 **** #define HASH_MAP std::hash_map #define HASH std::hash ! #elif (_MSC_VER == 1300) #include <hash_map> #define HASH_MAP std::hash_map --- 49,53 ---- #define HASH_MAP std::hash_map #define HASH std::hash ! #elif (_MSC_VER >= 1300) #include <hash_map> #define HASH_MAP std::hash_map *************** *** 60,64 **** template <class key, class val, class hash, class eq> struct HASH_MAPS { ! #if defined(_MSC_VER) && (_MSC_VER == 1300) typedef HASH_MAP<key, val, eq> Type; #else --- 60,64 ---- template <class key, class val, class hash, class eq> struct HASH_MAPS { ! #if defined(_MSC_VER) && (_MSC_VER >= 1300) typedef HASH_MAP<key, val, eq> Type; #else Index: HashUtility.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/HashUtility.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** HashUtility.h 4 May 2003 10:57:48 -0000 1.11 --- HashUtility.h 18 Jul 2003 01:33:53 -0000 1.12 *************** *** 126,130 **** ! #if defined(_MSC_VER) && (_MSC_VER == 1300) struct eqint: public std::hash_compare<int const> { size_t operator ()(int const& i) const { --- 126,130 ---- ! #if defined(_MSC_VER) && (_MSC_VER >= 1300) struct eqint: public std::hash_compare<int const> { size_t operator ()(int const& i) const { *************** *** 150,154 **** ! #if defined(_MSC_VER) && (_MSC_VER == 1300) struct eqstr: public std::hash_compare<char const*> { --- 150,154 ---- ! #if defined(_MSC_VER) && (_MSC_VER >= 1300) struct eqstr: public std::hash_compare<char const*> { *************** *** 176,180 **** }; ! #if defined(_MSC_VER) && (_MSC_VER == 1300) struct hasht_eq: public std::hash_compare<hasht const> { size_t operator()( hasht const& i1 ) const { --- 176,180 ---- }; ! #if defined(_MSC_VER) && (_MSC_VER >= 1300) struct hasht_eq: public std::hash_compare<hasht const> { size_t operator()( hasht const& i1 ) const { *************** *** 204,208 **** }; ! #if defined(_MSC_VER) && (_MSC_VER == 1300) struct eqstring: public std::hash_compare<std::string const> { size_t operator()( std::string const& a ) const { --- 204,208 ---- }; ! #if defined(_MSC_VER) && (_MSC_VER >= 1300) struct eqstring: public std::hash_compare<std::string const> { size_t operator()( std::string const& a ) const { |
From: <bra...@us...> - 2003-07-18 01:33:08
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Source In directory sc8-pr-cvs1:/tmp/cvs-serv31318 Modified Files: Interpolate.cpp Log Message: Removed the InterpolatedData<T> from the first param of the find function to prevent MSVC 2003 from erroring on that line Index: Interpolate.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Interpolate.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Interpolate.cpp 23 Apr 2003 09:14:23 -0000 1.8 --- Interpolate.cpp 18 Jul 2003 01:33:05 -0000 1.9 *************** *** 95,99 **** template <typename T> ! int InterpolatedData<T>::find(InterpolatedData<T>::vector_t b, T v) const { int lo = 0; int hi = b.size()-1; --- 95,99 ---- template <typename T> ! int InterpolatedData<T>::find(vector_t b, T v) const { int lo = 0; int hi = b.size()-1; |
From: <mk...@us...> - 2003-07-17 10:12:43
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Source In directory sc8-pr-cvs1:/tmp/cvs-serv5974/Source Modified Files: DataArchive.cpp Makefile Added Files: Key.cpp Log Message: see CHANGES.current --- NEW FILE: Key.cpp --- /* SimDataCSP: Data Infrastructure for Simulations * Copyright (C) 2002 Mark Rose <tm...@st...> * * This file is part of SimDataCSP. * * 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. */ #include <SimData/Key.h> #include <SimData/Pack.h> NAMESPACE_SIMDATA const Key &Key::operator=(std::string const &id) { _key = newhash4_cstring(id.c_str()); return *this; } bool Key::operator==(std::string const &id) const { return *this == Key(id); } void Key::pack(Packer& p) const { p.pack(static_cast<int>(_key)); } void Key::unpack(UnPacker& p) { int k; p.unpack(k); _key = static_cast<u4>(k); } std::string Key::asString() const { char buff[32]; sprintf(buff, "Key<%08X>", _key); return buff; } NAMESPACE_END // namespace simdata Index: DataArchive.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/DataArchive.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DataArchive.cpp 2 May 2003 20:59:05 -0000 1.8 --- DataArchive.cpp 17 Jul 2003 10:12:40 -0000 1.9 *************** *** 331,335 **** std::string msg; if (path_str==0 || *path_str==0) { ! msg = "human-readable path unavailable"; } else { msg = path_str; --- 331,338 ---- std::string msg; if (path_str==0 || *path_str==0) { ! msg = getPathString(key); ! if (msg == "") { ! msg = "human-readable path unavailable"; ! } } else { msg = path_str; Index: Makefile =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Makefile,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Makefile 23 Apr 2003 09:14:23 -0000 1.10 --- Makefile 17 Jul 2003 10:12:40 -0000 1.11 *************** *** 22,25 **** --- 22,26 ---- InterfaceRegistry \ Interpolate \ + Key \ Link \ List \ |
From: <mk...@us...> - 2003-07-17 10:12:43
|
Update of /cvsroot/csp/APPLICATIONS/SimData/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv5974/SimData Modified Files: Parse.py Log Message: see CHANGES.current Index: Parse.py =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/SimData/Parse.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Parse.py 10 Jun 2003 23:31:31 -0000 1.6 --- Parse.py 17 Jul 2003 10:12:40 -0000 1.7 *************** *** 208,212 **** return 0 return name in ('List', 'Enum', 'Path', 'Int', 'Bool', 'Number', 'Float', ! 'String', 'Date', 'Vector', 'Matrix', 'External', 'Object', 'Quat', 'LLA', "UTM", "ECEF") --- 208,212 ---- return 0 return name in ('List', 'Enum', 'Path', 'Int', 'Bool', 'Number', 'Float', ! 'String', 'Date', 'Vector', 'Matrix', 'External', 'Key', 'Object', 'Quat', 'LLA', "UTM", "ECEF") *************** *** 239,242 **** --- 239,244 ---- f = external self._externals.extend(list) + elif self._type == "key": + f = SimData.Key else: msg = "Unknown LIST type (%s)" % self._type *************** *** 478,481 **** --- 480,492 ---- # ext.setSource(self._element) + + class KeyHandler(SimpleHandler): + + def __init__(self, id, base, name, attrs): + SimpleHandler.__init__(self, id, base, name, attrs) + + def end(self): + id = self._c.encode('ascii') + self._element = SimData.Key(id) |
From: <mk...@us...> - 2003-07-17 10:12:42
|
Update of /cvsroot/csp/APPLICATIONS/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv5974 Modified Files: CHANGES.current Makefile setup.py Log Message: see CHANGES.current Index: CHANGES.current =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/CHANGES.current,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** CHANGES.current 30 Jun 2003 22:36:25 -0000 1.41 --- CHANGES.current 17 Jul 2003 10:12:39 -0000 1.42 *************** *** 2,5 **** --- 2,20 ---- =========================== + 2003-07-16: onsight + Tweaked TypeAdapter constructors to disambiguate the copy + constructor. The build now works with g++-3.3. + + New lookup table classes in LUT.h. The code is not yet + complete and should not be used for anything other than + testing at this point. + + Added new Key data type, which is just a string converted + to and stored as a 32-bit hash value. + + ==========> VC USERS: add Key.cpp to the project. + + Added date comparison methods. + 2003-07-01: delta Added a SWIG_GLOBAL define on cSimData_wrap.cpp to enable log level. Index: Makefile =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Makefile,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Makefile 3 Jul 2003 18:10:11 -0000 1.13 --- Makefile 17 Jul 2003 10:12:39 -0000 1.14 *************** *** 7,11 **** export GLDOPTS = -shared -lswigpy -ldl export GSWOPTS = -c -c++ -python -noexcept ! export CXX = g++ export SWIG = swig --- 7,11 ---- export GLDOPTS = -shared -lswigpy -ldl export GSWOPTS = -c -c++ -python -noexcept ! export CXX = g++-3.2 export SWIG = swig Index: setup.py =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/setup.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** setup.py 13 May 2003 18:24:46 -0000 1.21 --- setup.py 17 Jul 2003 10:12:39 -0000 1.22 *************** *** 235,238 **** --- 235,239 ---- "InterfaceRegistry", "Interpolate", + "Key", "Link", "List", *************** *** 270,275 **** --- 271,278 ---- "InterfaceRegistry.h", "Interpolate.h", + "Key.h", "Link.h", "List.h", + "LUT.h", "Log.h", "LogStream.h", *************** *** 310,316 **** --- 313,321 ---- "InterfaceRegistry.i", "Interpolate.i", + "Key.i", "Link.i", "List.i", "Log.i", + "LUT.i", "Math.i", "Matrix3.i", |
From: <mk...@us...> - 2003-07-16 16:47:14
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Include/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv970 Added Files: LUT.h Log Message: --- NEW FILE: LUT.h --- /* SimDataCSP: Data Infrastructure for Simulations * Copyright (C) 2002 Mark Rose <tm...@st...> * * This file is part of SimDataCSP. * * 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. */ [...1119 lines suppressed...] x += t[2.1][30400]; } t1 = simdata::SimDate::getSystemTime(); std::cout << (t1-t0)*10.0 << " us; " << x << "\n"; /* simdata::Table3 t3; t0 = simdata::SimDate::getSystemTime(); // XXX must set data before interpolating t3.interpolate(simdata::Table3::Dim(100)(40)(20), simdata::Interpolation::SPLINE); t1 = simdata::SimDate::getSystemTime(); std::cout << (t1-t0) << " s\n"; */ } int main() try { test(); return 0; } catch(...) { } |
From: <mk...@us...> - 2003-07-15 18:53:43
|
Update of /cvsroot/csp/THIRDPARTYLIBS/demeter In directory sc8-pr-cvs1:/tmp/cvs-serv15968 Modified Files: CHANGES.current Makefile.in Terrain.cpp Log Message: see CHANGES.current Index: CHANGES.current =================================================================== RCS file: /cvsroot/csp/THIRDPARTYLIBS/demeter/CHANGES.current,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CHANGES.current 10 Jun 2003 22:48:37 -0000 1.7 --- CHANGES.current 15 Jul 2003 18:53:40 -0000 1.8 *************** *** 2,5 **** --- 2,9 ---- =========================== + 2003-07-15: onsight + Disabled GDAL support by default. + Moved LoadRawImage into an #ifdef _USE_GDAL_ block. + 2003-05-XX: onsight Minor optimizations in texture generation. Still needs Index: Makefile.in =================================================================== RCS file: /cvsroot/csp/THIRDPARTYLIBS/demeter/Makefile.in,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.in 14 Mar 2003 22:02:18 -0000 1.4 --- Makefile.in 15 Jul 2003 18:53:40 -0000 1.5 *************** *** 38,42 **** CXXFLAGS+=-Wall CXXFLAGS+=@sdl_FLAGS@ ! CXXFLAGS+=-D_USE_GDAL_ CXXFLAGS+=-w --- 38,42 ---- CXXFLAGS+=-Wall CXXFLAGS+=@sdl_FLAGS@ ! #CXXFLAGS+=-D_USE_GDAL_ CXXFLAGS+=-w Index: Terrain.cpp =================================================================== RCS file: /cvsroot/csp/THIRDPARTYLIBS/demeter/Terrain.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Terrain.cpp 10 Jun 2003 22:43:21 -0000 1.8 --- Terrain.cpp 15 Jul 2003 18:53:40 -0000 1.9 *************** *** 118,122 **** --- 118,124 ---- GLuint CreateTexture(const Uint8* pTexels,int width,int height,int rowLength,int border,int internalFormat,bool bClamp,bool bAlpha = false); void LoadImage(const char* szFilename,int& pWidth,int& pHeight,Uint8** pBuffer,bool bAlpha = false); + #ifdef _USE_GDAL_ void LoadRawImage(const char* szFilename,int& pWidth,int& pHeight,Uint8** pBuffer,bool bAlpha = false); + #endif // _USE_GDAL_ int RayPlaneIntersect(const Ray *ray,const Plane *plane,Vector* point,float *distance); int RayBoxIntersect(const Ray *ray,const Box *box,Vector *point,float *distance); *************** *** 2551,2554 **** --- 2553,2557 ---- + #ifdef _USE_GDAL_ void LoadRawImage(const char* szShortFilename,int& width,int &height,Uint8** ppBuffer,bool bAlpha) { *************** *** 2636,2639 **** --- 2639,2643 ---- } + #endif // _USE_GDAL_ |
From: <mk...@us...> - 2003-07-03 18:10:15
|
Update of /cvsroot/csp/APPLICATIONS/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv19591 Modified Files: Makefile Log Message: Index: Makefile =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Makefile,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Makefile 18 Apr 2003 11:51:28 -0000 1.12 --- Makefile 3 Jul 2003 18:10:11 -0000 1.13 *************** *** 7,11 **** export GLDOPTS = -shared -lswigpy -ldl export GSWOPTS = -c -c++ -python -noexcept ! export CXX = g++-3.2 export SWIG = swig --- 7,11 ---- export GLDOPTS = -shared -lswigpy -ldl export GSWOPTS = -c -c++ -python -noexcept ! export CXX = g++ export SWIG = swig |
From: <mk...@us...> - 2003-07-03 08:38:04
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim In directory sc8-pr-cvs1:/tmp/cvs-serv29674 Modified Files: CHANGES.current Log Message: Index: CHANGES.current =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/CHANGES.current,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** CHANGES.current 2 Jul 2003 21:49:47 -0000 1.42 --- CHANGES.current 3 Jul 2003 08:28:27 -0000 1.43 *************** *** 4,7 **** --- 4,13 ---- 2003-07-02: onsight + Reverted to Sky.cpp 1.15, disabled TEXDOME, and fixed + a bug that applied a texture to the sky dome even when + TEXDOME was not defined. + + 2003-07-02: onsight + Added an automatic build target to the main Makefile to generate default hid mappings for aircraft.hid and *************** *** 28,31 **** --- 34,47 ---- accomodate the new font, but this needs is just a bandaid and needs additional work. + + 2003-07-01: onsight + + Changed Makefile.in and Source/Makefile.in to link + to the ChunkLod library the same way the Demeter + link is done. The ChunkLod static library that is + used is now CSPChunkLod/lib/libosgChunkLod_csp.a. + + Added a README file that points to the wiki + VBuildingCSP page, as well as the forums. 2003-07-01: delta |
From: <mk...@us...> - 2003-07-03 08:25:41
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Source In directory sc8-pr-cvs1:/tmp/cvs-serv29438 Modified Files: Sky.cpp Log Message: Index: Sky.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Source/Sky.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Sky.cpp 30 Jun 2003 22:27:57 -0000 1.16 --- Sky.cpp 3 Jul 2003 08:25:37 -0000 1.17 *************** *** 83,87 **** * be computed over multiple frames. */ ! //#define TEXDOME --- 83,87 ---- * be computed over multiple frames. */ ! #define NO_TEXDOME *************** *** 188,192 **** // TODO reimplement this as an osg::Geometry using a vertex list PrimitiveSet ! // and GL_POINTS (osgSim::osgLightPoint?). the current routine is called infrequently (the stars are // rendered from a display list between updates), but requires a few ms to // update the stars one at a time --- 188,192 ---- // TODO reimplement this as an osg::Geometry using a vertex list PrimitiveSet ! // and GL_POINTS. the current routine is called infrequently (the stars are // rendered from a display list between updates), but requires a few ms to // update the stars one at a time *************** *** 1184,1189 **** ii = ci = 0; ! for( i = 0; i < m_nlev; ++i ) { ! for( j = 0; j < m_nseg; ++j ) { alpha = osg::DegreesToRadians(m_lev[i]); theta = osg::DegreesToRadians((float)(j*360.0/m_nseg)); --- 1184,1189 ---- ii = ci = 0; ! for( i = 0; i < m_nlev; i++ ) { ! for( j = 0; j < m_nseg; j++ ) { alpha = osg::DegreesToRadians(m_lev[i]); theta = osg::DegreesToRadians((float)(j*360.0/m_nseg)); *************** *** 1202,1209 **** colors[ci][3] = 1.0; ! tcoords[ci][0] = 0.5f + std::min(0.5f, (90.0f - m_lev[i]) / 180.0f) * cosf(theta); ! tcoords[ci][1] = 0.5f + std::min(0.5f, (90.0f - m_lev[i]) / 180.0f) * sinf(theta); ! ++ci; } } --- 1202,1209 ---- colors[ci][3] = 1.0; ! tcoords[ci][0] = (float)j/(float)(m_nseg-1); ! tcoords[ci][1] = (float)i/(float)(m_nlev-1); ! ci++; } } *************** *** 1211,1222 **** DrawElementsUShort* drawElements = new DrawElementsUShort(PrimitiveSet::TRIANGLE_STRIP); drawElements->reserve(m_nlev*(m_nseg+1)*2); ! for (i = 0; i < m_nlev-1; ++i) { ! for (j = 0; j <= m_nseg; ++j) { ! drawElements->push_back((i+1)*m_nseg+(j%m_nseg)); ! drawElements->push_back((i+0)*m_nseg+(j%m_nseg)); } } ! m_SkyDome->setSupportsDisplayList(false); ! m_SkyDome->setUseDisplayList(false); m_SkyDome->addPrimitiveSet(drawElements); m_SkyDome->setVertexArray( &coords ); --- 1211,1221 ---- DrawElementsUShort* drawElements = new DrawElementsUShort(PrimitiveSet::TRIANGLE_STRIP); drawElements->reserve(m_nlev*(m_nseg+1)*2); ! for (i = 0; i < m_nlev-1; i++) { ! for (j = 0; j <= m_nseg; j++) { ! drawElements->push_back((i+1)*m_nseg+j%m_nseg); ! drawElements->push_back((i+0)*m_nseg+j%m_nseg); } } ! m_SkyDome->addPrimitiveSet(drawElements); m_SkyDome->setVertexArray( &coords ); *************** *** 1228,1242 **** if (1) { Image *image = new Image(); image->allocateImage(64, 64, 1, GL_RGB, GL_UNSIGNED_BYTE); assert(image->data() != NULL); ! memset(image->data(), 255, 64*64*3); // setting the internal texture format is required, but // its not clear how to determine the correct value. the // following is just what the png loader does, setting // the format to the number of color bytes. ! image->setInternalTextureFormat(GL_RGB); Texture2D *tex = new Texture2D; - tex->setDataVariance(osg::Object::DYNAMIC); tex->setImage(image); tex->setWrap(Texture::WRAP_S, Texture::CLAMP); --- 1227,1242 ---- if (1) { + StateSet *dome_state = m_SkyDome->getOrCreateStateSet(); + #ifdef TEXDOME Image *image = new Image(); image->allocateImage(64, 64, 1, GL_RGB, GL_UNSIGNED_BYTE); assert(image->data() != NULL); ! memset(image->data(), 0, 64*64*3); // setting the internal texture format is required, but // its not clear how to determine the correct value. the // following is just what the png loader does, setting // the format to the number of color bytes. ! image->setInternalTextureFormat(3); Texture2D *tex = new Texture2D; tex->setImage(image); tex->setWrap(Texture::WRAP_S, Texture::CLAMP); *************** *** 1248,1257 **** tex->setUseHardwareMipMapGeneration(false); tex->setUnRefImageDataAfterApply(false); - tex->setInternalFormatMode(osg::Texture::USE_IMAGE_DATA_FORMAT); m_SkyDomeTextureImage = image; m_SkyDomeTexture = tex; - StateSet *dome_state = m_SkyDome->getOrCreateStateSet(); dome_state->setTextureAttributeAndModes(0, m_SkyDomeTexture.get(), StateAttribute::ON); dome_state->setTextureAttributeAndModes(0, new TexEnv); dome_state->setMode(GL_LIGHTING, StateAttribute::OFF); dome_state->setMode(GL_CULL_FACE, StateAttribute::OFF); --- 1248,1256 ---- tex->setUseHardwareMipMapGeneration(false); tex->setUnRefImageDataAfterApply(false); m_SkyDomeTextureImage = image; m_SkyDomeTexture = tex; dome_state->setTextureAttributeAndModes(0, m_SkyDomeTexture.get(), StateAttribute::ON); dome_state->setTextureAttributeAndModes(0, new TexEnv); + #endif dome_state->setMode(GL_LIGHTING, StateAttribute::OFF); dome_state->setMode(GL_CULL_FACE, StateAttribute::OFF); *************** *** 1313,1317 **** // TODO ! // take altitude into account for turbidity // relate night sky color to moon brighness (and altitude) // maybe modify SkyColor it consider moon position: --- 1312,1316 ---- // TODO ! // take altitide into account for turbidity // relate night sky color to moon brighness (and altitude) // maybe modify SkyColor it consider moon position: *************** *** 1362,1371 **** float dark = m_Moon.getApparentBrightness(); osg::Vec4 horizon_average; ! for (i = 0; i < m_nlev; ++i) { double elev = m_lev[i] * D2R; if (elev < 0.0) elev = 0.0; // sub horizon colors aren't correct double azimuth = -sun_A - 0.5 * G_PI; bool at_vertex = fabs(elev - sun_h) < min_a; // this is only a rough measure ! for (j = 0; j < m_nseg; ++j) { float intensity; // if the sun lines up very close to a vertex, the vertex will be --- 1361,1370 ---- float dark = m_Moon.getApparentBrightness(); osg::Vec4 horizon_average; ! for (i = 0; i < m_nlev; i++) { double elev = m_lev[i] * D2R; if (elev < 0.0) elev = 0.0; // sub horizon colors aren't correct double azimuth = -sun_A - 0.5 * G_PI; bool at_vertex = fabs(elev - sun_h) < min_a; // this is only a rough measure ! for (j = 0; j < m_nseg; j++) { float intensity; // if the sun lines up very close to a vertex, the vertex will be *************** *** 1387,1391 **** horizon_average += colors[ci]; } ! ++ci; m_AverageIntensity += intensity; } --- 1386,1390 ---- horizon_average += colors[ci]; } ! ci++; m_AverageIntensity += intensity; } *************** *** 1400,1403 **** --- 1399,1403 ---- void Sky::_updateShading(double sun_h, double sun_A) { Vec2Array& tex = *(dynamic_cast<Vec2Array*>(m_SkyDome->getTexCoordArray(0))); + Vec4Array& col = *(dynamic_cast<Vec4Array*>(m_SkyDome->getColorArray())); int i, j; *************** *** 1411,1422 **** unsigned char *shade = m_SkyDomeTextureImage->data(); assert(shade); ! static unsigned char k = 128; ! ++k; ! unsigned int n = 2; ! //memset(shade, k, 3); ! for (j = 0; j < 64; ++j) { int idx = (j * 64 + 32) * 3; double y = (j-32) / 30.0; ! for (i = 0; i < 32; ++i) { double x = i / 30.0; double elevation = (1.0 - sqrt(x*x+y*y)) * 0.5 * G_PI; --- 1411,1418 ---- unsigned char *shade = m_SkyDomeTextureImage->data(); assert(shade); ! for (j = 0; j < 64; j++) { int idx = (j * 64 + 32) * 3; double y = (j-32) / 30.0; ! for (i = 0; i < 32; i++) { double x = i / 30.0; double elevation = (1.0 - sqrt(x*x+y*y)) * 0.5 * G_PI; *************** *** 1428,1434 **** int i0 = idx + i*3 - 1; int i1 = idx - i*3 - 1; ! shade[++i0] = shade[++i1] = k;//static_cast<unsigned char>(c.getA() * 255.0); ! shade[++i0] = shade[++i1] = 0;//static_cast<unsigned char>(c.getB() * 255.0); ! shade[++i0] = shade[++i1] = 0;//static_cast<unsigned char>(c.getC() * 255.0); m_AverageIntensity += intensity; ++n_average; --- 1424,1430 ---- int i0 = idx + i*3 - 1; int i1 = idx - i*3 - 1; ! shade[++i0] = shade[++i1] = static_cast<unsigned char>(c.getA() * 255.0); ! shade[++i0] = shade[++i1] = static_cast<unsigned char>(c.getB() * 255.0); ! shade[++i0] = shade[++i1] = static_cast<unsigned char>(c.getC() * 255.0); m_AverageIntensity += intensity; ++n_average; *************** *** 1436,1448 **** } } - //for (int i = 0; i < 64*64*3; i++) shade[i] = static_cast<unsigned char>((i/3) %256); - - /*int n = 0; - for (i=0; i < 64*64*3;i += 3) - if (shade[i] == k && shade[i+1] == k && shade[i+2] == k) - ++n; - std::cout << "\n" << n << " values are equal to " << k << "\n\n";*/ } - { // separate evaluation for horizon colors --- 1432,1436 ---- *************** *** 1450,1454 **** double da = 2.0 * G_PI / n; double azimuth = -sun_A - 0.5 * G_PI; ! for (i = 0; i < n; ++i) { float intensity; Color c = m_SkyShader.SkyColor(0.0, azimuth, dark, intensity); --- 1438,1442 ---- double da = 2.0 * G_PI / n; double azimuth = -sun_A - 0.5 * G_PI; ! for (i = 0; i < n; i++) { float intensity; Color c = m_SkyShader.SkyColor(0.0, azimuth, dark, intensity); *************** *** 1457,1480 **** } } ! { // update texture coordinates int ci = 0; double da = 2.0 * G_PI / (m_nseg); ! for (i = 0; i < m_nlev; ++i) { double elev = m_lev[i] * D2R; if (elev < 0.0) elev = 0.0; // sub horizon colors aren't correct double azimuth = -sun_A - 0.5 * G_PI; float factor = (1.0 - 2.0 * elev / G_PI) * 30.0 / 32.0; ! for (j = 0; j < m_nseg; ++j) { float x = 0.5 * (1.0 + sin(azimuth) * factor) + 0.5 / 64.0; float y = 0.5 * (1.0 + cos(azimuth) * factor) + 0.5 / 64.0; tex[ci][0] = x; tex[ci][1] = y; ! ++ci; azimuth += da; } } } - simdata::SimTime u = simdata::SimDate::getSystemTime(); --- 1445,1467 ---- } } ! { // update texture coordinates int ci = 0; double da = 2.0 * G_PI / (m_nseg); ! for (i = 0; i < m_nlev; i++) { double elev = m_lev[i] * D2R; if (elev < 0.0) elev = 0.0; // sub horizon colors aren't correct double azimuth = -sun_A - 0.5 * G_PI; float factor = (1.0 - 2.0 * elev / G_PI) * 30.0 / 32.0; ! for (j = 0; j < m_nseg; j++) { float x = 0.5 * (1.0 + sin(azimuth) * factor) + 0.5 / 64.0; float y = 0.5 * (1.0 + cos(azimuth) * factor) + 0.5 / 64.0; tex[ci][0] = x; tex[ci][1] = y; ! ci++; azimuth += da; } } } simdata::SimTime u = simdata::SimDate::getSystemTime(); *************** *** 1486,1491 **** m_SkyDomeTextureImage->dirty(); m_SkyDomeTexture->dirtyTextureObject(); - m_SkyDomeTexture->dirtyTextureParameters(); m_SkyDomeTexture->setImage(m_SkyDomeTextureImage.get()); } #endif --- 1473,1478 ---- m_SkyDomeTextureImage->dirty(); m_SkyDomeTexture->dirtyTextureObject(); m_SkyDomeTexture->setImage(m_SkyDomeTextureImage.get()); + m_SkyDome->dirtyDisplayList(); } #endif *************** *** 1506,1510 **** _updateSun(); // do a full moon update every 300 seconds (orbital position and lighting) ! if (fabs(m_JD - m_LastMoonFullUpdate) > 0.0000578705) {// = 1.15741e-5 * 5.0 // 300.0) { m_LastMoonFullUpdate = m_JD; _updateMoon(false); --- 1493,1497 ---- _updateSun(); // do a full moon update every 300 seconds (orbital position and lighting) ! if (fabs(m_JD - m_LastMoonFullUpdate) > 1.15741e-5 * 5.0) { // 300.0) { m_LastMoonFullUpdate = m_JD; _updateMoon(false); *************** *** 1538,1542 **** osg::Vec4 color; color = (*m_HorizonColors)[(idx-avg)%n] * (1.0-da); ! for (int i = 1-avg; i <= avg; ++i) { color += (*m_HorizonColors)[(idx+i)%n]; } --- 1525,1529 ---- osg::Vec4 color; color = (*m_HorizonColors)[(idx-avg)%n] * (1.0-da); ! for (int i = 1-avg; i <= avg; i++) { color += (*m_HorizonColors)[(idx+i)%n]; } |