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

Revision 13041, 3.2 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
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
14//
15// OpenFlight® loader for OpenSceneGraph
16//
17//  Copyright (C) 2005-2007  Brede Johansen
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)
45        META_dispose(_roadSegment)
46
47    protected:
48
49        virtual ~RoadSegment() {}
50        virtual void readRecord(RecordInputStream& in, Document& /*document*/)
51        {
52            _roadSegment = new osg::Group;
53            std::string id = in.readString(8);
54
55            _roadSegment->setName(id);
56
57            // Add to parent.
58            if (_parent.valid())
59                _parent->addChild(*_roadSegment);
60        }
61};
62
63REGISTER_FLTRECORD(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)
82        META_dispose(_roadConstruction)
83
84    protected:
85
86        virtual ~RoadConstruction() {}
87        virtual void readRecord(RecordInputStream& in, Document& /*document*/)
88        {
89            _roadConstruction = new osg::Group;
90
91            std::string id = in.readString(8);
92
93            _roadConstruction->setName(id);
94
95            // Add to parent.
96            if (_parent.valid())
97                _parent->addChild(*_roadConstruction);
98        }
99};
100
101REGISTER_FLTRECORD(RoadConstruction, ROAD_CONSTRUCTION_OP)
102
103
104
105/** RoadPath
106*/
107class RoadPath : public PrimaryRecord
108{
109    osg::ref_ptr<osg::Group> _roadPath;
110
111    public:
112
113        RoadPath() {}
114
115        META_Record(RoadPath)
116
117        META_setID(_roadPath)
118        META_setComment(_roadPath)
119        META_setMultitexture(_roadPath)
120        META_addChild(_roadPath)
121        META_dispose(_roadPath)
122
123    protected:
124
125        virtual ~RoadPath() {}
126        virtual void readRecord(RecordInputStream& /*in*/, Document& /*document*/)
127        {
128            _roadPath = new osg::Group;
129
130            // Add to parent.
131            if (_parent.valid())
132                _parent->addChild(*_roadPath);
133        }
134};
135
136REGISTER_FLTRECORD(RoadPath, ROAD_PATH_OP)
137
138
139
140} // end namespace
Note: See TracBrowser for help on using the browser.