Merge branch 'next' of git://gitorious.org/fg/flightgear into next
This commit is contained in:
commit
7a68d42ae9
9 changed files with 142 additions and 94 deletions
|
@ -23,15 +23,6 @@
|
|||
|
||||
#include "predictor.hxx"
|
||||
|
||||
#ifdef SG_BULK
|
||||
#undef SG_BULK
|
||||
#endif
|
||||
#define SG_BULK SG_ALERT
|
||||
#ifdef SG_INFO
|
||||
#undef SG_INFO
|
||||
#endif
|
||||
#define SG_INFO SG_ALERT
|
||||
|
||||
using namespace FGXMLAutopilot;
|
||||
|
||||
Predictor::Predictor () :
|
||||
|
@ -40,9 +31,18 @@ Predictor::Predictor () :
|
|||
{
|
||||
}
|
||||
|
||||
bool Predictor::configure(const string& nodeName, SGPropertyNode* configNode)
|
||||
bool Predictor::configure(const string& nodeName, SGPropertyNode_ptr configNode)
|
||||
{
|
||||
SG_LOG( SG_AUTOPILOT, SG_BULK, "Predictor::configure(" << nodeName << ")" << endl );
|
||||
|
||||
if( AnalogComponent::configure( nodeName, configNode ) )
|
||||
return true;
|
||||
|
||||
if( nodeName == "config" ) {
|
||||
Component::configure( configNode );
|
||||
return true;
|
||||
}
|
||||
|
||||
if (nodeName == "seconds") {
|
||||
_seconds.push_back( new InputValue( configNode, 0 ) );
|
||||
return true;
|
||||
|
|
|
@ -53,7 +53,7 @@ private:
|
|||
InputValueList _filter_gain;
|
||||
|
||||
protected:
|
||||
bool configure(const std::string& nodeName, SGPropertyNode* configNode );
|
||||
bool configure(const std::string& nodeName, SGPropertyNode_ptr configNode );
|
||||
|
||||
public:
|
||||
Predictor();
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/props/props_io.hxx>
|
||||
|
||||
#include <osg/GLU>
|
||||
#include <osg/Matrixf>
|
||||
|
||||
#include <GUI/new_gui.hxx> // FGFontCache
|
||||
#include <Main/globals.hxx>
|
||||
|
@ -338,27 +338,31 @@ void fgUpdateHUD( osg::State* state ) {
|
|||
|
||||
void fgUpdateHUDVirtual(osg::State* state)
|
||||
{
|
||||
using namespace osg;
|
||||
FGViewer* view = globals->get_current_view();
|
||||
|
||||
// Standard fgfs projection, with essentially meaningless clip
|
||||
// planes (we'll map the whole HUD plane to z=-1)
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
gluPerspective(view->get_v_fov(), 1/view->get_aspect_ratio(), 0.1, 10);
|
||||
Matrixf proj
|
||||
= Matrixf::perspective(view->get_v_fov(), 1/view->get_aspect_ratio(),
|
||||
0.1, 10);
|
||||
glLoadMatrix(proj.ptr());
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
// Standard fgfs view direction computation
|
||||
float lookat[3];
|
||||
Vec3f lookat;
|
||||
lookat[0] = -sin(SG_DEGREES_TO_RADIANS * view->getHeadingOffset_deg());
|
||||
lookat[1] = tan(SG_DEGREES_TO_RADIANS * view->getPitchOffset_deg());
|
||||
lookat[2] = -cos(SG_DEGREES_TO_RADIANS * view->getHeadingOffset_deg());
|
||||
if (fabs(lookat[1]) > 9999)
|
||||
lookat[1] = 9999; // FPU sanity
|
||||
gluLookAt(0, 0, 0, lookat[0], lookat[1], lookat[2], 0, 1, 0);
|
||||
Matrixf mv = Matrixf::lookAt(Vec3f(0.0, 0.0, 0.0), lookat,
|
||||
Vec3f(0.0, 1.0, 0.0));
|
||||
glLoadMatrix(mv.ptr());
|
||||
|
||||
// Map the -1:1 square to a 55.0x41.25 degree wide patch at z=1.
|
||||
// This is the default fgfs field of view, which the HUD files are
|
||||
|
@ -391,10 +395,11 @@ void fgUpdateHUDVirtual(osg::State* state)
|
|||
void fgUpdateHUD( osg::State* state, GLfloat x_start, GLfloat y_start,
|
||||
GLfloat x_end, GLfloat y_end )
|
||||
{
|
||||
using namespace osg;
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
gluOrtho2D(x_start, x_end, y_start, y_end);
|
||||
Matrixf proj = Matrixf::ortho2D(x_start, x_end, y_start, y_end);
|
||||
glLoadMatrix(proj.ptr());
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
|
|
|
@ -32,8 +32,7 @@
|
|||
#include <ATCDCL/ATCutils.hxx>
|
||||
#include <Main/viewer.hxx>
|
||||
|
||||
#include <osg/GLU>
|
||||
|
||||
#include <simgear/math/project.hxx>
|
||||
|
||||
// int x, int y, int width, int height, float scale_data, bool working)
|
||||
|
||||
|
@ -134,8 +133,9 @@ void runway_instr::draw()
|
|||
//Calculate the 2D points via gluProject
|
||||
int result = GL_TRUE;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
result = gluProject(points3d[i][0], points3d[i][1], points3d[i][2], mm,
|
||||
pm, view, &points2d[i][0], &points2d[i][1], &points2d[i][2]);
|
||||
result = simgear::project(points3d[i][0], points3d[i][1], points3d[i][2],
|
||||
mm, pm, view,
|
||||
&points2d[i][0], &points2d[i][1], &points2d[i][2]);
|
||||
}
|
||||
//set the line width based on our distance from the runway
|
||||
setLineWidth();
|
||||
|
@ -239,7 +239,8 @@ bool runway_instr::drawLine(const sgdVec3& a1, const sgdVec3& a2, const sgdVec3&
|
|||
sgdVec3 newPt;
|
||||
sgdCopyVec3(newPt, a1);
|
||||
sgdAddVec3(newPt, vec);
|
||||
if (gluProject(newPt[0], newPt[1], newPt[2], mm, pm, view, &p2[0], &p2[1], &p2[2])
|
||||
if (simgear::project(newPt[0], newPt[1], newPt[2], mm, pm, view,
|
||||
&p2[0], &p2[1], &p2[2])
|
||||
&& (p2[2] > 0 && p2[2] < 1.0)) {
|
||||
boundPoint(p1, p2);
|
||||
glBegin(GL_LINES);
|
||||
|
@ -255,7 +256,8 @@ bool runway_instr::drawLine(const sgdVec3& a1, const sgdVec3& a2, const sgdVec3&
|
|||
sgdVec3 newPt;
|
||||
sgdCopyVec3(newPt, a2);
|
||||
sgdAddVec3(newPt, vec);
|
||||
if (gluProject(newPt[0], newPt[1], newPt[2], mm, pm, view, &p1[0], &p1[1], &p1[2])
|
||||
if (simgear::project(newPt[0], newPt[1], newPt[2], mm, pm, view,
|
||||
&p1[0], &p1[1], &p1[2])
|
||||
&& (p1[2] > 0 && p1[2] < 1.0)) {
|
||||
boundPoint(p2, p1);
|
||||
glBegin(GL_LINES);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <osg/CullFace>
|
||||
#include <osg/Depth>
|
||||
#include <osg/Material>
|
||||
#include <osg/Matrixf>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/PolygonOffset>
|
||||
|
||||
|
@ -273,6 +274,7 @@ FGPanel::update (double dt)
|
|||
void
|
||||
FGPanel::update (osg::State& state, GLfloat winx, GLfloat winw, GLfloat winy, GLfloat winh)
|
||||
{
|
||||
using namespace osg;
|
||||
// Calculate accelerations
|
||||
// and jiggle the panel accordingly
|
||||
// The factors and bounds are just
|
||||
|
@ -284,12 +286,13 @@ FGPanel::update (osg::State& state, GLfloat winx, GLfloat winw, GLfloat winy, GL
|
|||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
Matrixf proj;
|
||||
if ( _flipx->getBoolValue() ) {
|
||||
gluOrtho2D(winx + winw, winx, winy + winh, winy); /* up side down */
|
||||
proj = Matrixf::ortho2D(winx + winw, winx, winy + winh, winy); /* up side down */
|
||||
} else {
|
||||
gluOrtho2D(winx, winx + winw, winy, winy + winh); /* right side up */
|
||||
proj = Matrixf::ortho2D(winx, winx + winw, winy, winy + winh); /* right side up */
|
||||
}
|
||||
glLoadMatrix(proj.ptr());
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
|
|
|
@ -55,6 +55,9 @@ public:
|
|||
protected:
|
||||
void bind();
|
||||
void unbind();
|
||||
void update( double dt );
|
||||
|
||||
virtual void update( bool first, double dt ) = 0;
|
||||
|
||||
long getMetarMaxAgeMin() const { return _max_age_n == NULL ? 0 : _max_age_n->getLongValue(); }
|
||||
|
||||
|
@ -65,6 +68,7 @@ protected:
|
|||
SGPropertyNode_ptr _max_age_n;
|
||||
|
||||
bool _enabled;
|
||||
bool __enabled;
|
||||
TiedPropertyList _tiedProperties;
|
||||
MetarProperties _metarProperties;
|
||||
};
|
||||
|
@ -83,6 +87,7 @@ BasicRealWxController::BasicRealWxController( SGPropertyNode_ptr rootNode ) :
|
|||
_ground_elevation_n( fgGetNode( "/position/ground-elev-m", true )),
|
||||
_max_age_n( fgGetNode( "/environment/params/metar-max-age-min", false ) ),
|
||||
_enabled(true),
|
||||
__enabled(false),
|
||||
_metarProperties( fgGetNode( rootNode->getStringValue("metar", "/environment/metar"), true ) )
|
||||
{
|
||||
}
|
||||
|
@ -93,11 +98,13 @@ BasicRealWxController::~BasicRealWxController()
|
|||
|
||||
void BasicRealWxController::init()
|
||||
{
|
||||
__enabled = false;
|
||||
update(0); // fetch data ASAP
|
||||
}
|
||||
|
||||
void BasicRealWxController::reinit()
|
||||
{
|
||||
__enabled = false;
|
||||
}
|
||||
|
||||
void BasicRealWxController::bind()
|
||||
|
@ -111,13 +118,23 @@ void BasicRealWxController::unbind()
|
|||
_tiedProperties.Untie();
|
||||
}
|
||||
|
||||
void BasicRealWxController::update( double dt )
|
||||
{
|
||||
if( _enabled ) {
|
||||
update( !__enabled, dt );
|
||||
__enabled = true;
|
||||
} else {
|
||||
__enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------------- */
|
||||
|
||||
class NoaaMetarRealWxController : public BasicRealWxController {
|
||||
public:
|
||||
NoaaMetarRealWxController( SGPropertyNode_ptr rootNode );
|
||||
virtual ~NoaaMetarRealWxController();
|
||||
virtual void update (double delta_time_sec);
|
||||
virtual void update (bool first, double delta_time_sec);
|
||||
|
||||
class MetarLoadRequest {
|
||||
public:
|
||||
|
@ -146,12 +163,13 @@ private:
|
|||
#if defined(ENABLE_THREADS)
|
||||
class MetarLoadThread : public OpenThreads::Thread {
|
||||
public:
|
||||
MetarLoadThread( long maxAge );
|
||||
void requestMetar( const MetarLoadRequest & metarRequest );
|
||||
bool hasMetar() { return _responseQueue.size() > 0; }
|
||||
string getMetar() { return _responseQueue.pop(); }
|
||||
virtual void run();
|
||||
MetarLoadThread( long maxAge );
|
||||
void requestMetar( const MetarLoadRequest & metarRequest, bool background = true );
|
||||
bool hasMetar() { return _responseQueue.size() > 0; }
|
||||
string getMetar() { return _responseQueue.pop(); }
|
||||
virtual void run();
|
||||
private:
|
||||
void fetch( const MetarLoadRequest & );
|
||||
long _maxAge;
|
||||
SGBlockingQueue <MetarLoadRequest> _requestQueue;
|
||||
SGBlockingQueue <string> _responseQueue;
|
||||
|
@ -188,17 +206,8 @@ NoaaMetarRealWxController::~NoaaMetarRealWxController()
|
|||
#endif // ENABLE_THREADS
|
||||
}
|
||||
|
||||
void NoaaMetarRealWxController::update( double dt )
|
||||
void NoaaMetarRealWxController::update( bool first, double dt )
|
||||
{
|
||||
if( !_enabled )
|
||||
return;
|
||||
|
||||
if( _metarLoadThread->hasMetar() ) {
|
||||
string metar = _metarLoadThread->getMetar();
|
||||
SG_LOG( SG_ALL, SG_ALERT, "NoaaMetarRwalWxController::update() received METAR " << metar );
|
||||
_metarDataNode->setStringValue( metar );
|
||||
}
|
||||
|
||||
_metarTimeToLive -= dt;
|
||||
_positionTimeToLive -= dt;
|
||||
_minimumRequestInterval -= dt;
|
||||
|
@ -234,11 +243,21 @@ void NoaaMetarRealWxController::update( double dt )
|
|||
if( !valid ) {
|
||||
if( _minimumRequestInterval <= 0 && stationId.length() > 0 ) {
|
||||
MetarLoadRequest request( stationId );
|
||||
_metarLoadThread->requestMetar( request );
|
||||
// load the first metar in the foreground to make sure a metar is received
|
||||
// before the automatic runway selection code runs. All subsequent calls
|
||||
// run in the background
|
||||
_metarLoadThread->requestMetar( request, !first );
|
||||
_minimumRequestInterval = 10;
|
||||
}
|
||||
}
|
||||
|
||||
if( _metarLoadThread->hasMetar() ) {
|
||||
string metar = _metarLoadThread->getMetar();
|
||||
SG_LOG( SG_ALL, SG_ALERT, "NoaaMetarRwalWxController::update() received METAR " << metar );
|
||||
_metarDataNode->setStringValue( metar );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------------- */
|
||||
|
@ -249,16 +268,20 @@ NoaaMetarRealWxController::MetarLoadThread::MetarLoadThread( long maxAge ) :
|
|||
{
|
||||
}
|
||||
|
||||
void NoaaMetarRealWxController::MetarLoadThread::requestMetar( const MetarLoadRequest & metarRequest )
|
||||
void NoaaMetarRealWxController::MetarLoadThread::requestMetar( const MetarLoadRequest & metarRequest, bool background )
|
||||
{
|
||||
if( _requestQueue.size() > 10 ) {
|
||||
SG_LOG(SG_ALL,SG_ALERT,
|
||||
"NoaaMetarRealWxController::MetarLoadThread::requestMetar() more than 10 outstanding METAR requests, dropping "
|
||||
<< metarRequest._stationId );
|
||||
return;
|
||||
}
|
||||
if( background ) {
|
||||
if( _requestQueue.size() > 10 ) {
|
||||
SG_LOG(SG_ALL,SG_ALERT,
|
||||
"NoaaMetarRealWxController::MetarLoadThread::requestMetar() more than 10 outstanding METAR requests, dropping "
|
||||
<< metarRequest._stationId );
|
||||
return;
|
||||
}
|
||||
|
||||
_requestQueue.push( metarRequest );
|
||||
_requestQueue.push( metarRequest );
|
||||
} else {
|
||||
fetch( metarRequest );
|
||||
}
|
||||
}
|
||||
|
||||
void NoaaMetarRealWxController::MetarLoadThread::run()
|
||||
|
@ -269,34 +292,40 @@ void NoaaMetarRealWxController::MetarLoadThread::run()
|
|||
if( request._stationId.size() == 0 )
|
||||
break;
|
||||
|
||||
SGSharedPtr<FGMetar> result = NULL;
|
||||
|
||||
try {
|
||||
result = new FGMetar( request._stationId, request._proxyHost, request._proxyPort, request._proxyAuth );
|
||||
} catch (const sg_io_exception& e) {
|
||||
SG_LOG( SG_GENERAL, SG_WARN, "NoaaMetarRealWxController::fetchMetar(): can't get METAR for "
|
||||
<< request._stationId << ":" << e.getFormattedMessage().c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
string reply = result->getData();
|
||||
std::replace(reply.begin(), reply.end(), '\n', ' ');
|
||||
string metar = simgear::strutils::strip( reply );
|
||||
|
||||
if( metar.empty() ) {
|
||||
SG_LOG( SG_GENERAL, SG_WARN, "NoaaMetarRealWxController::fetchMetar(): dropping empty METAR for "
|
||||
<< request._stationId );
|
||||
}
|
||||
|
||||
if( _maxAge && result->getAge_min() > _maxAge ) {
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "NoaaMetarRealWxController::fetchMetar(): dropping outdated METAR "
|
||||
<< metar );
|
||||
return;
|
||||
}
|
||||
|
||||
_responseQueue.push( metar );
|
||||
fetch( request );
|
||||
}
|
||||
}
|
||||
|
||||
void NoaaMetarRealWxController::MetarLoadThread::fetch( const MetarLoadRequest & request )
|
||||
{
|
||||
SGSharedPtr<FGMetar> result = NULL;
|
||||
|
||||
try {
|
||||
result = new FGMetar( request._stationId, request._proxyHost, request._proxyPort, request._proxyAuth );
|
||||
} catch (const sg_io_exception& e) {
|
||||
SG_LOG( SG_GENERAL, SG_WARN, "NoaaMetarRealWxController::fetchMetar(): can't get METAR for "
|
||||
<< request._stationId << ":" << e.getFormattedMessage().c_str() );
|
||||
return;
|
||||
}
|
||||
|
||||
string reply = result->getData();
|
||||
std::replace(reply.begin(), reply.end(), '\n', ' ');
|
||||
string metar = simgear::strutils::strip( reply );
|
||||
|
||||
if( metar.empty() ) {
|
||||
SG_LOG( SG_GENERAL, SG_WARN, "NoaaMetarRealWxController::fetchMetar(): dropping empty METAR for "
|
||||
<< request._stationId );
|
||||
return;
|
||||
}
|
||||
|
||||
if( _maxAge && result->getAge_min() > _maxAge ) {
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "NoaaMetarRealWxController::fetchMetar(): dropping outdated METAR "
|
||||
<< metar );
|
||||
return;
|
||||
}
|
||||
|
||||
_responseQueue.push( metar );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -186,27 +186,31 @@ void HUD::draw(osg::State&)
|
|||
|
||||
void HUD::draw3D()
|
||||
{
|
||||
using namespace osg;
|
||||
FGViewer* view = globals->get_current_view();
|
||||
|
||||
// Standard fgfs projection, with essentially meaningless clip
|
||||
// planes (we'll map the whole HUD plane to z=-1)
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
gluPerspective(view->get_v_fov(), 1.0 / view->get_aspect_ratio(), 0.1, 10);
|
||||
Matrixf proj
|
||||
= Matrixf::perspective(view->get_v_fov(), 1/view->get_aspect_ratio(),
|
||||
0.1, 10);
|
||||
glLoadMatrix(proj.ptr());
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
// Standard fgfs view direction computation
|
||||
float lookat[3];
|
||||
Vec3f lookat;
|
||||
lookat[0] = -sin(SG_DEGREES_TO_RADIANS * view->getHeadingOffset_deg());
|
||||
lookat[1] = tan(SG_DEGREES_TO_RADIANS * view->getPitchOffset_deg());
|
||||
lookat[2] = -cos(SG_DEGREES_TO_RADIANS * view->getHeadingOffset_deg());
|
||||
if (fabs(lookat[1]) > 9999)
|
||||
lookat[1] = 9999; // FPU sanity
|
||||
gluLookAt(0, 0, 0, lookat[0], lookat[1], lookat[2], 0, 1, 0);
|
||||
Matrixf mv = Matrixf::lookAt(Vec3f(0.0, 0.0, 0.0), lookat,
|
||||
Vec3f(0.0, 1.0, 0.0));
|
||||
glLoadMatrix(mv.ptr());
|
||||
|
||||
// Map the -1:1 square to a 55.0x41.25 degree wide patch at z=1.
|
||||
// This is the default fgfs field of view, which the HUD files are
|
||||
|
@ -236,10 +240,11 @@ void HUD::draw3D()
|
|||
|
||||
void HUD::draw2D(GLfloat x_start, GLfloat y_start, GLfloat x_end, GLfloat y_end)
|
||||
{
|
||||
using namespace osg;
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
gluOrtho2D(x_start, x_end, y_start, y_end);
|
||||
Matrixf proj = Matrixf::ortho2D(x_start, x_end, y_start, y_end);
|
||||
glLoadMatrix(proj.ptr());
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/math/sg_geodesy.hxx>
|
||||
#include <osg/GLU>
|
||||
#include <simgear/math/project.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Scenery/scenery.hxx>
|
||||
|
@ -129,8 +129,9 @@ void HUD::Runway::draw()
|
|||
//Calculate the 2D points via gluProject
|
||||
int result = GL_TRUE;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
result = gluProject(_points3d[i][0], _points3d[i][1], _points3d[i][2], _mm,
|
||||
_pm, _view, &_points2d[i][0], &_points2d[i][1], &_points2d[i][2]);
|
||||
result = simgear::project(_points3d[i][0], _points3d[i][1], _points3d[i][2],
|
||||
_mm, _pm, _view,
|
||||
&_points2d[i][0], &_points2d[i][1], &_points2d[i][2]);
|
||||
}
|
||||
//set the line width based on our distance from the runway
|
||||
setLineWidth();
|
||||
|
@ -229,7 +230,8 @@ bool HUD::Runway::drawLine(const sgdVec3& a1, const sgdVec3& a2, const sgdVec3&
|
|||
sgdVec3 newPt;
|
||||
sgdCopyVec3(newPt, a1);
|
||||
sgdAddVec3(newPt, vec);
|
||||
if (gluProject(newPt[0], newPt[1], newPt[2], _mm, _pm, _view, &p2[0], &p2[1], &p2[2])
|
||||
if (simgear::project(newPt[0], newPt[1], newPt[2], _mm, _pm, _view,
|
||||
&p2[0], &p2[1], &p2[2])
|
||||
&& (p2[2] > 0 && p2[2] < 1.0)) {
|
||||
boundPoint(p1, p2);
|
||||
glBegin(GL_LINES);
|
||||
|
@ -245,7 +247,8 @@ bool HUD::Runway::drawLine(const sgdVec3& a1, const sgdVec3& a2, const sgdVec3&
|
|||
sgdVec3 newPt;
|
||||
sgdCopyVec3(newPt, a2);
|
||||
sgdAddVec3(newPt, vec);
|
||||
if (gluProject(newPt[0], newPt[1], newPt[2], _mm, _pm, _view, &p1[0], &p1[1], &p1[2])
|
||||
if (simgear::project(newPt[0], newPt[1], newPt[2], _mm, _pm, _view,
|
||||
&p1[0], &p1[1], &p1[2])
|
||||
&& (p1[2] > 0 && p1[2] < 1.0)) {
|
||||
boundPoint(p2, p1);
|
||||
glBegin(GL_LINES);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <osg/GLU>
|
||||
#include <osg/Matrixf>
|
||||
|
||||
#include <math.h>
|
||||
#include <zlib.h>
|
||||
|
@ -95,6 +95,7 @@ SGTexture::bind()
|
|||
void
|
||||
SGTexture::resize(unsigned int width, unsigned int height)
|
||||
{
|
||||
using namespace osg;
|
||||
GLfloat aspect;
|
||||
|
||||
// Make sure that we don't get a divide by zero exception
|
||||
|
@ -110,10 +111,10 @@ SGTexture::resize(unsigned int width, unsigned int height)
|
|||
// Go to the projection matrix, this gets modified by the perspective
|
||||
// calulations
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
// Do the perspective calculations
|
||||
gluPerspective(45.0, aspect, 1.0, 400.0);
|
||||
Matrixf proj = Matrixf::perspective(45.0, aspect, 1.0, 400.0);
|
||||
glLoadMatrix(proj.ptr());
|
||||
|
||||
// Return to the modelview matrix
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
|
Loading…
Add table
Reference in a new issue