root/OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/RoadRecords.cpp @ 7756

Revision 7756, 3.3 kB (checked in by robert, 6 years ago)

From Brede Johansen, support for contiuation records.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
RevLine 
[7748]1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under 
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
[5038]14//
15// OpenFlight® loader for OpenSceneGraph
16//
[7748]17//  Copyright (C) 2005-2007  Brede Johansen
[5038]18//
19
20#include <osg/Notify>
21#include <osg/Group>
22#include "Registry.h"
23#include "Document.h"
24#include "RecordInputStream.h"
25
26
27namespace flt {
28
29/** RoadSegment
30*/
31class RoadSegment : public PrimaryRecord
32{
33    osg::ref_ptr<osg::Group> _roadSegment;
34
35    public:
36
37        RoadSegment() {}
38
39        META_Record(RoadSegment)
40
41        META_setID(_roadSegment)
42        META_setComment(_roadSegment)
43        META_setMultitexture(_roadSegment)
44        META_addChild(_roadSegment)
[7756]45        META_dispose(_roadSegment)
[5038]46
47    protected:
48
49        virtual ~RoadSegment() {}
[7617]50        virtual void readRecord(RecordInputStream& in, Document& /*document*/)
[5038]51        {
52            _roadSegment = new osg::Group;
[7617]53            std::string id = in.readString(8);
[5038]54
[7617]55            _roadSegment->setName(id);
56
[5038]57            // Add to parent.
58            if (_parent.valid())
59                _parent->addChild(*_roadSegment);
60        }
61};
62
63RegisterRecordProxy<RoadSegment> g_RoadSegment(ROAD_SEGMENT_OP);
64
65
66/** RoadConstruction
67*/
68class RoadConstruction : public PrimaryRecord
69{
70    osg::ref_ptr<osg::Group> _roadConstruction;
71
72    public:
73
74        RoadConstruction() {}
75
76        META_Record(RoadConstruction)
77
78        META_setID(_roadConstruction)
79        META_setComment(_roadConstruction)
80        META_setMultitexture(_roadConstruction)
81        META_addChild(_roadConstruction)
[7756]82        META_dispose(_roadConstruction)
[5038]83
84    protected:
85
86        virtual ~RoadConstruction() {}
[7617]87        virtual void readRecord(RecordInputStream& in, Document& /*document*/)
[5038]88        {
89            _roadConstruction = new osg::Group;
90
[7617]91            std::string id = in.readString(8);
92
93            _roadConstruction->setName(id);
94
[5038]95            // Add to parent.
96            if (_parent.valid())
97                _parent->addChild(*_roadConstruction);
98        }
99};
100
101RegisterRecordProxy<RoadConstruction> g_RoadConstruction(ROAD_CONSTRUCTION_OP);
102
103
104/** RoadPath
105*/
106class RoadPath : public PrimaryRecord
107{
108    osg::ref_ptr<osg::Group> _roadPath;
109
110    public:
111
112        RoadPath() {}
113
114        META_Record(RoadPath)
115
116        META_setID(_roadPath)
117        META_setComment(_roadPath)
118        META_setMultitexture(_roadPath)
119        META_addChild(_roadPath)
[7756]120        META_dispose(_roadPath)
[5038]121
122    protected:
123
124        virtual ~RoadPath() {}
[5229]125        virtual void readRecord(RecordInputStream& /*in*/, Document& /*document*/)
[5038]126        {
127            _roadPath = new osg::Group;
128
129            // Add to parent.
130            if (_parent.valid())
131                _parent->addChild(*_roadPath);
132        }
133};
134
135RegisterRecordProxy<RoadPath> g_RoadPath(ROAD_PATH_OP);
136
137
138} // end namespace
Note: See TracBrowser for help on using the browser.