} else {
aip.setOrientation(roll, pitch, hdg);
}
- aip.update( globals->get_scenery()->get_center() );
+ aip.update();
}
}
void FGAIEntity::Transform() {
_aip.setPosition(_pos.lon(), _pos.lat(), _pos.elev() * SG_METER_TO_FEET);
_aip.setOrientation(_roll, _pitch, _hdg);
- _aip.update( globals->get_scenery()->get_center() );
+ _aip.update();
}
}
}
- view_location->set_tile_center( globals->get_scenery()->get_next_center() );
-
#ifdef ENABLE_AUDIO_SUPPORT
// Right now we make a simplifying assumption that the primary
// aircraft is the source of all sounds and that all sounds are
get_aircraft_model()->get3DModel()->getSGLocation();
// set positional offset for sources
- sgVec3 source_pos_offset;
- sgSubVec3( source_pos_offset,
- view_location->get_view_pos(), acmodel_loc->get_view_pos() );
+ sgdVec3 dsource_pos_offset;
+ sgdSubVec3( dsource_pos_offset,
+ view_location->get_absolute_view_pos(),
+ acmodel_loc->get_absolute_view_pos() );
// cout << "pos all = " << source_pos_offset[0] << " " << source_pos_offset[1] << " " << source_pos_offset[2] << endl;
+ sgVec3 source_pos_offset;
+ sgSetVec3(source_pos_offset, dsource_pos_offset);
globals->get_soundmgr()->set_source_pos_all( source_pos_offset );
// set the velocity
// calculate our current position in cartesian space
Point3D cntr = globals->get_scenery()->get_next_center();
globals->get_scenery()->set_center(cntr);
- current__view->set_scenery_center(cntr);
+ // Force update of center dependent values ...
+ current__view->set_dirty();
if ( refresh_camera_settings ) {
// update view port
return _relative_view_pos;
}
-float *
-FGViewer::getZeroElevViewPos ()
-{
- if (_dirty)
- recalc();
- return _zero_elev_view_pos;
-}
-
void
FGViewer::updateFromModelLocation (SGLocation * location)
{
- Point3D center = globals->get_scenery()->get_next_center();
- sgCopyMat4(LOCAL, location->getTransformMatrix(center));
+ sgCopyMat4(LOCAL, location->getTransformMatrix());
}
void
FGViewer::updateAtModelLocation (SGLocation * location)
{
- Point3D center = globals->get_scenery()->get_next_center();
- sgCopyMat4(ATLOCAL, location->getTransformMatrix(center));
+ sgCopyMat4(ATLOCAL, location->getTransformMatrix());
}
void
dampEyeData(roll_deg, pitch_deg, heading_deg);
location->setPosition( lon_deg, lat_deg, alt_ft );
location->setOrientation( roll_deg, pitch_deg, heading_deg );
- Point3D center = globals->get_scenery()->get_next_center();
- sgCopyMat4(LOCAL, location->getTransformMatrix(center));
-}
-
-void
-FGViewer::set_scenery_center(const Point3D& center)
-{
- _location->set_tile_center(center);
- _location->getTransformMatrix(center);
- if (_type == FG_LOOKAT) {
- _target_location->set_tile_center(center);
- _target_location->getTransformMatrix(center);
- }
- set_dirty();
+ sgCopyMat4(LOCAL, location->getTransformMatrix());
}
// recalc() is done every time one of the setters is called (making the
Point3D center = globals->get_scenery()->get_next_center();
sgdVec3 dVec3;
sgdSetVec3(dVec3, center[0], center[1], center[2]);
- sgdSubVec3(dVec3,
- _target_location->get_absolute_view_pos(center),
- dVec3 );
+ sgdSubVec3(dVec3, _target_location->get_absolute_view_pos(), dVec3 );
sgSetVec3(at_pos, dVec3[0], dVec3[1], dVec3[2]);
// Update location data for eye...
_roll_deg, _pitch_deg, _heading_deg );
}
// save the eye positon...
- sgCopyVec3(eye_pos, _location->get_view_pos());
+ sgCopyVec3(eye_pos, _location->get_view_pos(center));
// copy data from location class to local items...
copyLocationData();
void
FGViewer::copyLocationData()
{
+ Point3D center = globals->get_scenery()->get_center();
// Get our friendly vectors from the eye location...
- sgdCopyVec3(_absolute_view_pos,
- _location->get_absolute_view_pos(globals->get_scenery()->get_next_center()));
- sgCopyVec3(_zero_elev_view_pos, _location->get_zero_elev());
- sgCopyVec3(_relative_view_pos, _location->get_view_pos());
+ sgdCopyVec3(_absolute_view_pos, _location->get_absolute_view_pos());
+ sgCopyVec3(_relative_view_pos, _location->get_view_pos(center));
sgCopyMat4(UP, _location->getCachedUpMatrix());
sgCopyVec3(_world_up, _location->get_world_up());
// these are the vectors that the sun and moon code like to get...
}
// copy coordinates to outputs for viewer...
- sgCopyVec3(_zero_elev, _zero_elev_view_pos);
+ sgCopyVec3(_zero_elev, _relative_view_pos);
+ sgAddScaledVec3(_zero_elev, _world_up, -_alt_ft*SG_FEET_TO_METER);
sgCopyVec3(_view_pos, _relative_view_pos);
}
virtual float *get_world_up() {if ( _dirty ) { recalc(); } return _world_up; }
// Get the relative (to scenery center) view position in fgfs coordinates.
virtual float * getRelativeViewPos ();
- // Get the absolute zero-elevation view position in fgfs coordinates.
- virtual float * getZeroElevViewPos ();
// Get surface east vector
virtual float *get_surface_east() { if ( _dirty ) { recalc(); } return _surface_east; }
// Get surface south vector
_ground_level_nearplane_m = near_m;
}
- void set_scenery_center(const Point3D& center);
-
//////////////////////////////////////////////////////////////////////
// Part 5: misc setters and getters
//////////////////////////////////////////////////////////////////////
mutable sgdVec3 _absolute_view_pos;
mutable sgVec3 _relative_view_pos;
- mutable sgVec3 _zero_elev_view_pos;
double _lon_deg;
double _lat_deg;
_aircraft->setOrientation(fgGetDouble("/orientation/roll-deg"),
fgGetDouble("/orientation/pitch-deg"),
fgGetDouble("/orientation/heading-deg"));
- _aircraft->update( globals->get_scenery()->get_center() );
-
+ _aircraft->update();
}
void
if (instance->heading_deg_node != 0)
model->setHeadingDeg(instance->heading_deg_node->getDoubleValue());
- instance->model->update( globals->get_scenery()->get_center() );
+ instance->model->update();
}
}
*
******************************************************************/
+#include <simgear/compiler.h>
+
#ifdef HAVE_STDINT_H
# include <stdint.h>
-#elif defined( _MSC_VER ) || defined(__MINGW32__) || defined(sun)
-typedef signed short int16_t;
-typedef signed int int32_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-#else
-# error "Port me! Platforms that don't have <stdint.h> need to define int8_t, et. al."
#endif
#include <plib/sg.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/scene/model/placement.hxx>
+#include <simgear/scene/model/placementtrans.hxx>
#include <Scenery/scenery.hxx>
} else if (get_direction() == SG_IO_OUT) {
sgMat4 posTrans;
- sgCopyMat4(posTrans, globals->get_aircraft_model()->get3DModel()->get_POS());
+ globals->get_aircraft_model()->get3DModel()->getTransform()->getTransform(posTrans);
Point3D center = globals->get_scenery()->get_center();
sgdVec3 PlayerPosition;
sgdSetVec3(PlayerPosition, posTrans[3][0] + center[0],
#ifndef _NET_CTRLS_HXX
#define _NET_CTRLS_HXX
+#include <simgear/compiler.h>
// NOTE: this file defines an external interface structure. Due to
// variability between platforms and architectures, we only used fixed
#ifdef HAVE_STDINT_H
# include <stdint.h>
-#elif defined( _MSC_VER ) || defined(__MINGW32__) || defined(sun)
-typedef signed short int16_t;
-typedef signed int int32_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-#else
-# error "Port me! Platforms that don't have <stdint.h> need to define int8_t, et. al."
#endif
const uint32_t FG_NET_CTRLS_VERSION = 26;
#include <time.h> // time_t
+#include <simgear/compiler.h>
// NOTE: this file defines an external interface structure. Due to
// variability between platforms and architectures, we only used fixed
#ifdef HAVE_STDINT_H
# include <stdint.h>
-#elif defined( _MSC_VER ) || defined(__MINGW32__) || defined(sun)
-typedef signed short int16_t;
-typedef signed int int32_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-#else
-# error "Port me! Platforms that don't have <stdint.h> need to define int8_t, et. al."
#endif
const uint32_t FG_NET_FDM_VERSION = 22;
# error This library requires C++
#endif
+#include <simgear/compiler.h>
// NOTE: this file defines an external interface structure. Due to
// variability between platforms and architectures, we only used fixed
#ifdef HAVE_STDINT_H
# include <stdint.h>
-#elif defined( _MSC_VER ) || defined(__MINGW32__)
-typedef signed char int8_t;
-typedef signed short int16_t;
-typedef signed int int32_t;
-typedef signed __int64 int64_t;
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned __int64 uint64_t;
-#else
-# error "Port me! Platforms that don't have <stdint.h> need to define int8_t, et. al."
#endif
#ifndef _NET_GUI_HXX
#define _NET_GUI_HXX
+#include <simgear/compiler.h>
// NOTE: this file defines an external interface structure. Due to
// variability between platforms and architectures, we only used fixed
#ifdef HAVE_STDINT_H
# include <stdint.h>
-#elif defined( _MSC_VER ) || defined(__MINGW32__) || defined(sun)
-typedef signed short int16_t;
-typedef signed int int32_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-#else
-# error "Port me! Platforms that don't have <stdint.h> need to define int8_t, et. al."
#endif
const uint32_t FG_NET_GUI_VERSION = 7;
// traverse the potentially viewable tile list and update range
// selector and transform
- Point3D center = location->get_tile_center();
- if (center == Point3D(0.0))
- return;
float *up = location->get_world_up();
FGTileEntry *e;
tile_cache.reset_traversal();
+ const double *vp = location->get_absolute_view_pos();
+ Point3D viewpos(vp[0], vp[1], vp[2]);
while ( ! tile_cache.at_end() ) {
// cout << "processing a tile" << endl;
if ( (e = tile_cache.get_current()) ) {
- e->prep_ssg_node( center, up, vis);
+ e->prep_ssg_node( viewpos, up, vis);
} else {
SG_LOG(SG_INPUT, SG_ALERT, "warning ... empty tile in cache");
}