31#include <simgear/compiler.h>
32#include <simgear/constants.h>
34#include <simgear/props/props.hxx>
35#include <simgear/props/tiedpropertylist.hxx>
36#include <simgear/structure/subsystem_mgr.hxx>
37#include <simgear/math/SGMath.hxx>
40#define FG_FOV_MAX 179.9
46class View :
public SGSubsystem
75 void update(
double dt)
override;
92 const std::string&
getName()
const {
return _name; }
177 const SGVec3d&
getViewPosition() {
if ( _dirty ) { recalc(); }
return _absolute_view_pos; }
200 View(
ViewType Type,
bool from_model,
int from_model_index,
201 bool at_model,
int at_model_index,
202 double damp_roll,
double damp_pitch,
double damp_heading,
203 double x_offset_m,
double y_offset_m,
double z_offset_m,
204 double heading_offset_deg,
double pitch_offset_deg,
205 double roll_offset_deg,
206 double fov_deg,
double aspect_ratio_multiplier,
207 double target_x_offset_m,
double target_y_offset_m,
208 double target_z_offset_m,
double near_m,
bool internal,
209 bool lookat_agl,
double lookat_agl_damping,
int view_index );
211 void set_clean() { _dirty =
false; }
213 void setHeadingOffset_deg_property (
double heading_offset_deg);
214 void setPitchOffset_deg_property(
double pitch_offset_deg);
215 void setRollOffset_deg_property(
double roll_offset_deg);
217 void setPosition (
const SGGeod& geod);
218 void setTargetPosition (
const SGGeod& geod);
220 double getAbsolutePosition_x()
const;
221 double getAbsolutePosition_y()
const;
222 double getAbsolutePosition_z()
const;
224 double getRawOrientation_w()
const;
225 double getRawOrientation_x()
const;
226 double getRawOrientation_y()
const;
227 double getRawOrientation_z()
const;
230 double getFrame_w()
const;
231 double getFrame_x()
const;
232 double getFrame_y()
const;
233 double getFrame_z()
const;
235 double getOrientation_w()
const;
236 double getOrientation_x()
const;
237 double getOrientation_y()
const;
238 double getOrientation_z()
const;
240 double getOrOffset_w()
const;
241 double getOrOffset_x()
const;
242 double getOrOffset_y()
const;
243 double getOrOffset_z()
const;
245 double getLon_deg()
const;
246 double getLat_deg()
const;
247 double getElev_ft()
const;
257 double getRoll_deg ()
const {
return _roll_deg; }
258 double getPitch_deg ()
const {
return _pitch_deg; }
259 void setRoll_deg (
double roll_deg);
260 void setPitch_deg (
double pitch_deg);
261 void setHeading_deg (
double heading_deg);
262 void setOrientation (
double roll_deg,
double pitch_deg,
double heading_deg);
263 double getTargetRoll_deg ()
const {
return _target_roll_deg; }
264 double getTargetPitch_deg ()
const {
return _target_pitch_deg; }
265 double getTargetHeading_deg ()
const {
return _target_heading_deg; }
266 void setTargetRoll_deg (
double roll_deg);
267 void setTargetPitch_deg (
double pitch_deg);
268 void setTargetHeading_deg (
double heading_deg);
269 void setTargetOrientation (
double roll_deg,
double pitch_deg,
double heading_deg);
283 double getGoalRollOffset_deg ()
const {
return _goal_roll_offset_deg; }
284 double getGoalPitchOffset_deg ()
const {
return _goal_pitch_offset_deg; }
285 double getGoalHeadingOffset_deg ()
const {
return _goal_heading_offset_deg; }
286 void setRollOffset_deg (
double roll_offset_deg);
287 void setPitchOffset_deg (
double pitch_offset_deg);
288 void setGoalRollOffset_deg (
double goal_roll_offset_deg);
289 void setGoalPitchOffset_deg (
double goal_pitch_offset_deg);
290 void setOrientationOffsets (
double roll_offset_deg,
291 double heading_offset_deg,
292 double pitch_offset_deg);
294 void set_aspect_ratio_multiplier(
double m ) {
295 _aspect_ratio_multiplier = m;
297 double get_aspect_ratio_multiplier()
const {
298 return _aspect_ratio_multiplier;
301 double getNear_m ()
const {
return _ground_level_nearplane_m; }
302 void setNear_m (
double near_m) {
303 _ground_level_nearplane_m = near_m;
306 void set_fov(
double fov_deg ) {
310 double get_fov_user()
const {
return _fov_user_deg; }
311 void set_fov_user(
double fov_deg ) { _fov_user_deg = fov_deg; }
317 SGPropertyNode_ptr _config;
318 std::string _name, _typeString;
323 simgear::TiedPropertyList _tiedProperties;
325 SGQuatd mViewOrientation;
326 SGQuatd mViewOffsetOr;
327 SGVec3d _absolute_view_pos;
335 double _target_roll_deg;
336 double _target_pitch_deg;
337 double _target_heading_deg;
339 double _configRollOffsetDeg,
340 _configHeadingOffsetDeg,
341 _configPitchOffsetDeg;
350 Damping(
double factor,
double min,
double max);
351 void setTarget(
double target);
352 void update(
double dt,
void*
id);
354 void updateTarget(
double& io);
355 void reset(
double target);
366 Damping _lookat_agl_damping;
367 double _lookat_agl_ground_altitude;
373 SGVec3d _configOffset_m;
375 SGVec3d _adjust_offset_m;
380 SGVec3d _target_offset_m;
381 SGVec3d _configTargetOffset_m;
384 double _roll_offset_deg;
385 double _pitch_offset_deg;
386 double _heading_offset_deg;
387 double _goal_roll_offset_deg;
388 double _goal_pitch_offset_deg;
389 double _goal_heading_offset_deg;
392 double _ground_level_nearplane_m;
408 int _from_model_index;
416 double _fov_user_deg;
420 double _configFOV_deg;
423 double _aspect_ratio_multiplier;
430 void recalcLookFrom();
433 void setDampTarget(
double h,
double p,
double r);
434 void getDampOutput(
double& roll,
double& pitch,
double& heading);
436 void updateDampOutput(
double dt);
439 inline void incHeadingOffset_deg(
double amt ) {
441 _heading_offset_deg += amt;
445 inline void incPitchOffset_deg(
double amt ) {
447 _pitch_offset_deg += amt;
451 inline void incRollOffset_deg(
double amt ) {
453 _roll_offset_deg += amt;
void setTargetYOffset_m(double y_offset_m)
void setHeadingOffset_deg(double heading_offset_deg)
void setTargetZOffset_m(double z_offset_m)
const SGGeod & getPosition() const
void setAdjustXOffset_m(double x_adjust_offset_m)
double getPitchOffset_deg() const
void setYOffset_m(double y_offset_m)
SGVec3d getOffset_m() const
void setAdjustZOffset_m(double z_adjust_offset_m)
double getAdjustZOffset_m() const
double getXOffset_m() const
const SGQuatd & getViewOrientation()
const std::string & getName() const
double getTargetYOffset_m() const
void setZOffset_m(double z_offset_m)
const SGQuatd & getViewOrientationOffset()
void update(double dt) override
void setAdjustYOffset_m(double y_adjust_offset_m)
void setPositionOffsets(double x_offset_m, double y_offset_m, double z_offset_m)
const SGGeod & getTargetPosition() const
static const char * staticSubsystemClassId()
double getYOffset_m() const
double getTargetXOffset_m() const
double getHeadingOffset_deg() const
void resetOffsetsAndFOV()
const SGVec3d & getViewPosition()
double getRollOffset_deg() const
void setGoalHeadingOffset_deg(double goal_heading_offset_deg)
double getHeading_deg() const
double getAdjustYOffset_m() const
double getAdjustXOffset_m() const
double getZOffset_m() const
void setTargetXOffset_m(double x_offset_m)
static View * createFromProperties(SGPropertyNode_ptr props, int view_index=-1)
double getTargetZOffset_m() const
void setInternal(bool internal)
double get_aspect_ratio() const
void setXOffset_m(double x_offset_m)
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...