root/OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/Document.cpp @ 8563

Revision 8563, 2.9 kB (checked in by robert, 6 years ago)

From Joakim Simmonsson, fixed various spelling typos in comments

  • 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 "Document.h"
21
22using namespace flt;
23
24
25Document::Document() :
[5794]26    _replaceClampWithClampToEdge(false),
[5229]27    _preserveFace(false),
[5528]28    _preserveObject(false),
[5229]29    _defaultDOFAnimationState(false),
30    _useTextureAlphaForTransparancyBinning(true),
[5610]31    _useBillboardCenter(false),
[5229]32    _doUnitsConversion(true),
[7931]33    _readObjectRecordData(false),
[5229]34    _desiredUnits(METERS),
[5038]35    _done(false),
36    _level(0),
37    _subfaceLevel(0),
38    _unitScale(1.0),
[5236]39    _version(0),
40    _colorPoolParent(false),
41    _texturePoolParent(false),
42    _materialPoolParent(false),
[6091]43    _lightSourcePoolParent(false),
[5236]44    _lightPointAppearancePoolParent(false),
[6759]45    _lightPointAnimationPoolParent(false),
[5236]46    _shaderPoolParent(false)
[5038]47{
48}
49
50Document::~Document()
51{
52}
53
54void Document::pushLevel()
55{
56    _levelStack.push_back(_currentPrimaryRecord.get());
57    _level++;
58}
59
60void Document::popLevel()
61{
62    _levelStack.pop_back();
63
64    if (!_levelStack.empty())
[7756]65        _currentPrimaryRecord = _levelStack.back();
[5038]66
67    if (--_level<=0)
68        _done = true;
69}
70
71void Document::pushSubface()
72{
73    _subfaceLevel++;
74}
75
76void Document::popSubface()
77{
78    _subfaceLevel--;
79}
80
81void Document::pushExtension()
82{
83    if (!_currentPrimaryRecord.valid())
84    {
85        osg::notify(osg::WARN) << "No current primary in Document::pushExtension()." << std::endl;
86        return;
87    }
88
89    _extensionStack.push_back(_currentPrimaryRecord.get());
90}
91
92void Document::popExtension()
93{
94    _currentPrimaryRecord=_extensionStack.back().get();
95    if (!_currentPrimaryRecord.valid())
96    {
[8563]97        osg::notify(osg::WARN) << "Can't decide primary in Document::popExtension()." << std::endl;
[5038]98        return;
99    }
100
101    _extensionStack.pop_back();
102}
103
104osg::Node* Document::getInstanceDefinition(int no)
105{
106    InstanceDefinitionMap::iterator itr = _instanceDefinitionMap.find(no);
107    if (itr != _instanceDefinitionMap.end())
108        return (*itr).second.get();
109
110    return NULL;
111}
112
113double flt::unitsToMeters(CoordUnits unit)
114{
115    switch (unit)
116    {
117    case METERS:
118        return 1.0;
119    case KILOMETERS:
120        return 1000.0;
121    case FEET:
122        return 0.3048;
123    case INCHES:
124        return 0.02540;
125    case NAUTICAL_MILES:
126        return 1852.0;
127    }
128
129    return 1.0;
130}
Note: See TracBrowser for help on using the browser.