|
我在linux下对osg2.6.0的例子进行使用
int mainQOSGWidget(QApplication& a, osg::ArgumentParser& arguments)
{
osg::ref_ptr<ViewerQOSG> viewerWindow(new ViewerQOSG);
viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator);
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use of particle systems.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file_left_eye image_file_right_eye");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer.
// osgViewer::Viewer viewer(arguments);//delete by alex
// if user request help write it out to cout.
unsigned int testCase = 0;
while (arguments.read("-t", testCase)) {}
bool useOverlay = false;
osgSim::OverlayNode::OverlayTechnique technique = osgSim::OverlayNode::OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY;
while (arguments.read("--object")) { useOverlay = true; technique = osgSim::OverlayNode::OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY; }
while (arguments.read("--ortho") || arguments.read("--orthographic")) { useOverlay = true; technique = osgSim::OverlayNode::VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY; }
while (arguments.read("--persp") || arguments.read("--perspective")) { useOverlay = true; technique = osgSim::OverlayNode::VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY;
while (arguments.read("--moveradar")){moverdr_flag = TRUE;} }
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
arguments.getApplicationUsage()->write(std::cout);
return 1;
}
// any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized();
// report any errors if they have occurred when parsing the program arguments.
if (arguments.errors())
{
arguments.writeErrorMessages(std::cout);
return 1;
}
osg::Group *root = new osg::Group;
build_world(root, testCase, useOverlay, technique);
//viewerWindow->setSceneData(loadedModel.get());
viewerWindow->setSceneData(root);
viewerWindow->show();
setupManipulatorAndHandler(*viewerWindow.get(), arguments);
a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
return a.exec();
}
如果包含//
//#include <osgParticle/ExplosionEffect>
//#include <osgParticle/SmokeEffect>
//#include <osgParticle/FireEffect>
#include <osgParticle/ParticleSystemUpdater
前三个头文件的话,编译时候就报错
/usr/include/osgParticle/Emitter:66: 错误:expected unqualified-id before ‘double’
/usr/include/osgParticle/Emitter:66: 错误:expected `)' before ‘double’
/usr/include/osgParticle/ModularEmitter:89: 错误:expected unqualified-id before ‘double’
/usr/include/osgParticle/ModularEmitter:89: 错误:expected `)' before ‘double’
我查过
namespace osgParticle
{
/** An abstract base class for particle emitters.
Descendant classes must override the <CODE>emit()</CODE> method to generate new particles by
calling the <CODE>ParticleSystem::createParticle()</CODE> method on the particle system associated
to the emitter.
*/
class OSGPARTICLE_EXPORT Emitter: public ParticleProcessor {
public:
Emitter();
Emitter(const Emitter& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
virtual const char* libraryName() const { return "osgParticle"; }
virtual const char* className() const { return "Emitter"; }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Emitter*>(obj) != 0; }
virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } }
/// Get the particle template.
inline const Particle& getParticleTemplate() const;
/// Set the particle template (particle is copied).
inline void setParticleTemplate(const Particle& p);
/// Return whether the particle system's default template should be used.
inline bool getUseDefaultTemplate() const;
/** Set whether the default particle template should be used.
When this flag is true, the particle template is ignored, and the
particle system's default template is used instead.
*/
inline void setUseDefaultTemplate(bool v);
protected:
virtual ~Emitter() {}
Emitter& operator=(const Emitter&) { return *this; }
inline void process(double dt);
virtual void emit(double dt) = 0;//error 这行有错误
bool _usedeftemp;
Particle _ptemp;
};
osg的头文件也会报错?请教了 |
|