model.hxx \
modellib.hxx \
personality.hxx \
- placement.hxx
+ placement.hxx \
+ placementtrans.hxx
libsgmodel_a_SOURCES = \
animation.cxx \
model.cxx \
modellib.cxx \
personality.cxx \
- placement.cxx
+ placement.cxx \
+ placementtrans.cxx
INCLUDES = -I$(top_srcdir)
void set_cur_elev_m ( double elev ) { _cur_elev_m = elev; }
inline double get_cur_elev_m () { return _cur_elev_m; }
// Interface to current buckets for use with tilemgr...
- void set_tile_center ( Point3D tile_center ) { _tile_center = tile_center; }
+ void set_tile_center ( Point3D tile_center ) { set_dirty(); _tile_center = tile_center; }
inline Point3D get_tile_center () { return _tile_center; }
// Matrices...
virtual const sgVec4 *getTransformMatrix( const Point3D scenery_center ) {
- if ( _dirty ) {
+ if ( _dirty || scenery_center != _scenery_center ) {
+ _scenery_center = scenery_center;
recalc( scenery_center );
}
return TRANS;
}
virtual const sgVec4 *getCachedTransformMatrix() { return TRANS; }
virtual const sgVec4 *getUpMatrix( const Point3D scenery_center ) {
- if ( _dirty ) {
+ if ( _dirty || scenery_center != _scenery_center ) {
+ _scenery_center = scenery_center;
recalc( scenery_center );
}
return UP;
// elevation of ground under this location...
double _cur_elev_m;
Point3D _tile_center;
+ Point3D _scenery_center;
// surface vector heading south
sgVec3 _surface_south;
#include <string.h> // for strcmp()
-#include <vector>
-
#include <plib/sg.h>
#include <plib/ssg.h>
#include <plib/ul.h>
#include "location.hxx"
+#include "placementtrans.hxx"
#include "placement.hxx"
-SG_USING_STD(vector);
-
\f
////////////////////////////////////////////////////////////////////////
_pitch_deg(0),
_heading_deg(0),
_selector(new ssgSelector),
- _position(new ssgTransform),
+ _position(new ssgPlacementTransform),
_location(new SGLocation)
{
}
POS[i][j] += (tmp * trans[j]);
}
}
- _position->setTransform(POS);
+// _position->setTransform(POS);
+ _position->setTransform(_location->get_absolute_view_pos(scenery_center), POS);
+ sgdVec3 center;
+ sgdSetVec3(center,
+ scenery_center.x(), scenery_center.y(), scenery_center.z());
+ _position->setSceneryCenter(center);
}
bool
# error This library requires C++
#endif
-#include <vector>
-
-SG_USING_STD(vector);
-
#include <plib/sg.h>
#include <plib/ssg.h>
// Don't pull in the headers, since we don't need them here.
class SGLocation;
+class ssgPlacementTransform;
// Has anyone done anything *really* stupid, like making min and max macros?
// Allows multiplayer to get players position transform
virtual const sgVec4 *get_POS() { return POS; }
+ ssgPlacementTransform * getTransform(void)
+ { return _position; }
+
private:
// Geodetic position
double _heading_deg;
ssgSelector * _selector;
- ssgTransform * _position;
+// ssgTransform * _position;
+ ssgPlacementTransform * _position;
// Location
SGLocation * _location;