From bd3900a3ffff44112af5ac67b9078a01d9582b8b Mon Sep 17 00:00:00 2001 From: david Date: Tue, 5 Mar 2002 13:39:45 +0000 Subject: [PATCH] Start of an internal 3-D view. If the property "/cockpit" (temporary and soon to be renamed) is true, FlightGear will draw the 3-D model even in internal view. This makes sense right now only with the C310 model, since the others don't have any kind of interiors modeled and all surfaces in all models are one-sided. This isn't quite working yet -- the view code is very hard to disentangle, and currently, if the view is not forward, roll and pitch are applied incorrectly. It looks interesting (modulo a messy model) on the ground, in level flight, or looking straight ahead under any other flight conditions. --- src/Main/model.cxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Main/model.cxx b/src/Main/model.cxx index a0ffb9ea1..859a8faf0 100644 --- a/src/Main/model.cxx +++ b/src/Main/model.cxx @@ -150,7 +150,9 @@ FGAircraftModel::update (int dt) long elapsed_ms = (_current_timestamp - _last_timestamp) / 1000; _last_timestamp.stamp(); - if (globals->get_viewmgr()->get_current() == 0) { + int view_number = globals->get_viewmgr()->get_current(); + + if (view_number == 0 && !fgGetBool("cockpit")) { _selector->select(false); } else { for (unsigned int i = 0; i < _animations.size(); i++) @@ -171,7 +173,16 @@ FGAircraftModel::update (int dt) sgMat4 sgTUX; sgCopyMat4( sgTUX, sgROT ); - sgPostMultMat4( sgTUX, pilot_view->get_VIEW_ROT() ); + sgMat4 VIEW_ROT; + sgCopyMat4( VIEW_ROT, pilot_view->get_VIEW_ROT()); + if (view_number == 0) { + // FIXME: orientation is not applied + // correctly when view is not forward + sgMakeRotMat4( sgROT, -pilot_view->get_view_offset() + * SGD_RADIANS_TO_DEGREES, pilot_view->get_world_up() ); + sgPostMultMat4( VIEW_ROT, sgROT ); + } + sgPostMultMat4( sgTUX, VIEW_ROT ); sgPostMultMat4( sgTUX, sgTRANS ); sgCoord tuxpos;