2007-12-24 23:32:15 +08:00
|
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
|
|
|
|
*
|
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
|
*/
|
|
|
|
|
|
2006-03-09 05:38:37 +08:00
|
|
|
|
//
|
|
|
|
|
// OpenFlight<68> loader for OpenSceneGraph
|
|
|
|
|
//
|
2007-12-24 23:32:15 +08:00
|
|
|
|
// Copyright (C) 2005-2007 Brede Johansen
|
2006-03-09 05:38:37 +08:00
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include <osg/Notify>
|
|
|
|
|
#include <osg/Group>
|
|
|
|
|
#include "Registry.h"
|
|
|
|
|
#include "Document.h"
|
|
|
|
|
#include "RecordInputStream.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace flt {
|
|
|
|
|
|
|
|
|
|
/** RoadSegment
|
|
|
|
|
*/
|
|
|
|
|
class RoadSegment : public PrimaryRecord
|
|
|
|
|
{
|
|
|
|
|
osg::ref_ptr<osg::Group> _roadSegment;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
RoadSegment() {}
|
|
|
|
|
|
|
|
|
|
META_Record(RoadSegment)
|
|
|
|
|
|
|
|
|
|
META_setID(_roadSegment)
|
|
|
|
|
META_setComment(_roadSegment)
|
|
|
|
|
META_setMultitexture(_roadSegment)
|
|
|
|
|
META_addChild(_roadSegment)
|
2008-01-04 19:26:21 +08:00
|
|
|
|
META_dispose(_roadSegment)
|
2006-03-09 05:38:37 +08:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual ~RoadSegment() {}
|
2007-12-07 21:28:02 +08:00
|
|
|
|
virtual void readRecord(RecordInputStream& in, Document& /*document*/)
|
2006-03-09 05:38:37 +08:00
|
|
|
|
{
|
|
|
|
|
_roadSegment = new osg::Group;
|
2007-12-07 21:28:02 +08:00
|
|
|
|
std::string id = in.readString(8);
|
|
|
|
|
|
|
|
|
|
_roadSegment->setName(id);
|
2006-03-09 05:38:37 +08:00
|
|
|
|
|
|
|
|
|
// Add to parent.
|
|
|
|
|
if (_parent.valid())
|
|
|
|
|
_parent->addChild(*_roadSegment);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2009-05-28 21:29:20 +08:00
|
|
|
|
REGISTER_FLTRECORD(RoadSegment, ROAD_SEGMENT_OP)
|
2006-03-09 05:38:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** RoadConstruction
|
|
|
|
|
*/
|
|
|
|
|
class RoadConstruction : public PrimaryRecord
|
|
|
|
|
{
|
|
|
|
|
osg::ref_ptr<osg::Group> _roadConstruction;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
RoadConstruction() {}
|
|
|
|
|
|
|
|
|
|
META_Record(RoadConstruction)
|
|
|
|
|
|
|
|
|
|
META_setID(_roadConstruction)
|
|
|
|
|
META_setComment(_roadConstruction)
|
|
|
|
|
META_setMultitexture(_roadConstruction)
|
|
|
|
|
META_addChild(_roadConstruction)
|
2008-01-04 19:26:21 +08:00
|
|
|
|
META_dispose(_roadConstruction)
|
2006-03-09 05:38:37 +08:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual ~RoadConstruction() {}
|
2007-12-07 21:28:02 +08:00
|
|
|
|
virtual void readRecord(RecordInputStream& in, Document& /*document*/)
|
2006-03-09 05:38:37 +08:00
|
|
|
|
{
|
|
|
|
|
_roadConstruction = new osg::Group;
|
|
|
|
|
|
2007-12-07 21:28:02 +08:00
|
|
|
|
std::string id = in.readString(8);
|
|
|
|
|
|
|
|
|
|
_roadConstruction->setName(id);
|
|
|
|
|
|
2006-03-09 05:38:37 +08:00
|
|
|
|
// Add to parent.
|
|
|
|
|
if (_parent.valid())
|
|
|
|
|
_parent->addChild(*_roadConstruction);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2009-05-28 21:29:20 +08:00
|
|
|
|
REGISTER_FLTRECORD(RoadConstruction, ROAD_CONSTRUCTION_OP)
|
|
|
|
|
|
2006-03-09 05:38:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** RoadPath
|
|
|
|
|
*/
|
|
|
|
|
class RoadPath : public PrimaryRecord
|
|
|
|
|
{
|
|
|
|
|
osg::ref_ptr<osg::Group> _roadPath;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
RoadPath() {}
|
|
|
|
|
|
|
|
|
|
META_Record(RoadPath)
|
|
|
|
|
|
|
|
|
|
META_setID(_roadPath)
|
|
|
|
|
META_setComment(_roadPath)
|
|
|
|
|
META_setMultitexture(_roadPath)
|
|
|
|
|
META_addChild(_roadPath)
|
2008-01-04 19:26:21 +08:00
|
|
|
|
META_dispose(_roadPath)
|
2006-03-09 05:38:37 +08:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual ~RoadPath() {}
|
2006-07-04 19:24:36 +08:00
|
|
|
|
virtual void readRecord(RecordInputStream& /*in*/, Document& /*document*/)
|
2006-03-09 05:38:37 +08:00
|
|
|
|
{
|
|
|
|
|
_roadPath = new osg::Group;
|
|
|
|
|
|
|
|
|
|
// Add to parent.
|
|
|
|
|
if (_parent.valid())
|
|
|
|
|
_parent->addChild(*_roadPath);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2009-05-28 21:29:20 +08:00
|
|
|
|
REGISTER_FLTRECORD(RoadPath, ROAD_PATH_OP)
|
|
|
|
|
|
2006-03-09 05:38:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end namespace
|