1
0
Fork 0

Fix FGViewer compilation when HLA is disabled.

Changed definition in config_cmake.in means #ifdef is no longer
a valid test; use #if instead.
This commit is contained in:
James Turner 2013-10-20 15:56:33 +01:00
parent 771586854b
commit e81df0df1f
4 changed files with 16 additions and 15 deletions

View file

@ -26,7 +26,7 @@
#include "Viewer.hxx"
#ifdef FG_HAVE_HLA
#if FG_HAVE_HLA
#include "HLAViewerFederate.hxx"
#include "HLAPerspectiveViewer.hxx"
#endif
@ -203,7 +203,7 @@ SlaveCamera::setMonitorProjectionReferences(double width, double height,
osg::Vec3
SlaveCamera::getLeftEyeOffset(const Viewer& viewer) const
{
#ifdef FG_HAVE_HLA
#if FG_HAVE_HLA
const HLAViewerFederate* viewerFederate = viewer.getViewerFederate();
if (!viewerFederate)
return osg::Vec3(0, 0, 0);
@ -219,7 +219,7 @@ SlaveCamera::getLeftEyeOffset(const Viewer& viewer) const
osg::Vec3
SlaveCamera::getRightEyeOffset(const Viewer& viewer) const
{
#ifdef FG_HAVE_HLA
#if FG_HAVE_HLA
const HLAViewerFederate* viewerFederate = viewer.getViewerFederate();
if (!viewerFederate)
return osg::Vec3(0, 0, 0);
@ -235,7 +235,7 @@ SlaveCamera::getRightEyeOffset(const Viewer& viewer) const
double
SlaveCamera::getZoomFactor(const Viewer& viewer) const
{
#ifdef FG_HAVE_HLA
#if FG_HAVE_HLA
const HLAViewerFederate* viewerFederate = viewer.getViewerFederate();
if (!viewerFederate)
return 1;

View file

@ -55,7 +55,7 @@ Viewer::~Viewer()
{
stopThreading();
#ifdef FG_HAVE_HLA
#if FG_HAVE_HLA
if (_viewerFederate.valid())
_viewerFederate->shutdown();
_viewerFederate = 0;
@ -476,7 +476,7 @@ Viewer::advance(double)
void
Viewer::updateTraversal()
{
#ifdef FG_HAVE_HLA
#if FG_HAVE_HLA
if (_viewerFederate.valid()) {
if (_timeIncrement == SGTimeStamp::fromSec(0)) {
if (!_viewerFederate->timeAdvanceAvailable()) {
@ -733,7 +733,7 @@ Viewer::createGraphicsContext(osg::GraphicsContext::Traits* traits)
return graphicsContext;
}
#ifdef FG_HAVE_HLA
#if FG_HAVE_HLA
const HLAViewerFederate*
Viewer::getViewerFederate() const
{

View file

@ -32,7 +32,7 @@
#include "Renderer.hxx"
#include "SlaveCamera.hxx"
#ifdef FG_HAVE_HLA
#if FG_HAVE_HLA
#include "HLAViewerFederate.hxx"
#endif
@ -105,7 +105,7 @@ public:
/// Helper to create an new graphics context from traits.
osg::GraphicsContext* createGraphicsContext(osg::GraphicsContext::Traits* traits);
#ifdef FG_HAVE_HLA
#if FG_HAVE_HLA
/// The federate if configured, can only be set once
const HLAViewerFederate* getViewerFederate() const;
HLAViewerFederate* getViewerFederate();
@ -147,7 +147,7 @@ private:
/// The current simulation time of the viewer
SGTimeStamp _simTime;
#ifdef FG_HAVE_HLA
#if FG_HAVE_HLA
/// The federate if configured
SGSharedPtr<HLAViewerFederate> _viewerFederate;
#endif

View file

@ -42,7 +42,7 @@
#include "Renderer.hxx"
#include "Viewer.hxx"
#ifdef FG_HAVE_HLA
#if FG_HAVE_HLA
#include "HLACameraManipulator.hxx"
#include "HLAViewerFederate.hxx"
#endif
@ -210,9 +210,7 @@ main(int argc, char** argv)
arguments.writeErrorMessages(std::cerr);
if (props->getNode("hla/federate/federation")) {
#if !defined FG_HAVE_HLA
SG_LOG(SG_GENERAL, SG_ALERT, "Unable to enter HLA/RTI viewer mode: HLA/RTI disabled at compile time.");
#else
#if FG_HAVE_HLA
const SGPropertyNode* federateNode = props->getNode("hla/federate");
SGSharedPtr<fgviewer::HLAViewerFederate> viewerFederate;
@ -237,6 +235,9 @@ main(int argc, char** argv)
viewer.setViewerFederate(viewerFederate.get());
viewer.setCameraManipulator(new fgviewer::HLACameraManipulator(viewerFederate->getViewer()));
}
#else
SG_LOG(SG_GENERAL, SG_ALERT, "Unable to enter HLA/RTI viewer mode: HLA/RTI disabled at compile time.");
#endif
}