]> git.mxchange.org Git - flightgear.git/commitdiff
Start of an internal 3-D view. If the property "/cockpit" (temporary
authordavid <david>
Tue, 5 Mar 2002 13:39:45 +0000 (13:39 +0000)
committerdavid <david>
Tue, 5 Mar 2002 13:39:45 +0000 (13:39 +0000)
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

index a0ffb9ea1ac9265d8a563f05ee1819ea8c201fca..859a8faf07139089713cec625ddbb8fcfb440db9 100644 (file)
@@ -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;