double heading_offset_deg, double pitch_offset_deg,
double roll_offset_deg, double fov_deg,
double target_x_offset_m, double target_y_offset_m,
- double target_z_offset_m, double near_m ):
+ double target_z_offset_m, double near_m, bool internal ):
_dirty(true),
_lon_deg(0),
_lat_deg(0),
_at_model = at_model;
_at_model_index = at_model_index;
+ _internal = internal;
+
if (damp_roll > 0.0)
_damp_roll = 1.0 / pow(10, fabs(damp_roll));
if (damp_pitch > 0.0)
_type = FG_LOOKAT;
}
+void
+FGViewer::setInternal ( bool internal )
+{
+ _internal = internal;
+}
+
void
FGViewer::setLongitude_deg (double lon_deg)
{
double heading_offset_deg, double pitch_offset_deg,
double roll_offset_deg, double fov_deg,
double target_x_offset_m, double target_y_offset_m,
- double target_z_offset_m, double near_m );
+ double target_z_offset_m, double near_m, bool internal );
// Destructor
virtual ~FGViewer( void );
virtual fgViewType getType() const { return _type; }
virtual void setType( int type );
+ virtual bool getInternal() const { return _internal; }
+ virtual void setInternal( bool internal );
+
// Reference geodetic position of view from position...
// These are the actual aircraft position (pilot in
// pilot view, model in model view).
fgViewType _type;
fgScalingType _scaling_type;
+ // internal view (e.g. cockpit) flag
+ bool _internal;
+
// view is looking from a model
bool _from_model;
int _from_model_index; // number of model (for multi model)
double heading_offset_deg, pitch_offset_deg, roll_offset_deg;
double target_x_offset_m, target_y_offset_m, target_z_offset_m;
double near_m;
+ bool internal;
for (int i = 0; i < fgGetInt("/sim/number-views"); i++) {
viewpath = "/sim/view";
nodepath += "/type";
strdata = fgGetString(nodepath.c_str());
+ // find out if this is an internal view (e.g. in cockpit, low near plane)
+ internal = false; // default
+ nodepath = viewpath;
+ nodepath += "/internal";
+ internal = fgGetBool(nodepath.c_str());
+
// FIXME:
// this is assumed to be an aircraft model...we will need to read
// model-from-type as well.
heading_offset_deg, pitch_offset_deg,
roll_offset_deg, fov_deg,
target_x_offset_m, target_y_offset_m,
- target_z_offset_m, near_m ));
+ target_z_offset_m, near_m, internal ));
else
add_view(new FGViewer ( FG_LOOKFROM, from_model, from_model_index,
false, 0, 0.0, 0.0, 0.0,
x_offset_m, y_offset_m, z_offset_m,
heading_offset_deg, pitch_offset_deg,
- roll_offset_deg, fov_deg, 0, 0, 0, near_m ));
+ roll_offset_deg, fov_deg, 0, 0, 0, near_m,
+ internal ));
}
copyToCurrent();
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
#include <Main/viewmgr.hxx>
+#include <Main/viewer.hxx>
#include <Scenery/scenery.hxx>
#include "model_panel.hxx"
FGAircraftModel::update (double dt)
{
int view_number = globals->get_viewmgr()->get_current();
+ int is_internal = globals->get_current_view()->getInternal();
- if (view_number == 0 && !fgGetBool("/sim/view/internal")) {
+ if (view_number == 0 && !is_internal) {
_aircraft->setVisible(false);
} else {
_aircraft->setVisible(true);
// OK, now adjust the clip planes and draw
// FIXME: view number shouldn't be
// hard-coded.
- int view_number = globals->get_viewmgr()->get_current();
- if (_aircraft->getVisible() && view_number == 0) {
+ bool is_internal = globals->get_current_view()->getInternal();
+ if (_aircraft->getVisible() && is_internal) {
glClearDepth(1);
glClear(GL_DEPTH_BUFFER_BIT);
ssgSetNearFar(_nearplane, _farplane);