root/OpenSceneGraph/trunk/src/osgPlugins/lwo/old_Lwo2Layer.h @ 13041

Revision 13041, 2.9 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/*
2 * Lightwave Object version 2 loader for Open Scene Graph
3 * Version 2 introduced in Lightwave v6.0
4 *
5 * Copyright (C) 2002 Pavel Moloshtan <pasha@moloshtan.com>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20 *
21 * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for
22 * real-time rendering of large 3D photo-realistic models.
23 * The OSG homepage is http://www.openscenegraph.org/
24 */
25
26#ifndef LWO2LAYER_H
27#define LWO2LAYER_H
28
29#include <osg/Referenced>
30#include <osg/Vec2>
31#include <osg/Vec3>
32#include <osg/Notify>
33#include <osg/Geode>
34#include <osg/StateSet>
35
36#include <osgUtil/SmoothingVisitor>
37
38#include <vector>
39#include <map>
40#include <string>
41
42using namespace osg;
43using namespace std;
44
45struct PointData
46{
47  PointData():
48    point_index(0),
49    coord(Vec3(0.0f, 0.0f, 0.0f)),
50       texcoord(Vec2(-1.0f, -1.0f)) {}
51
52  short point_index;
53  Vec3 coord;
54  Vec2 texcoord;
55
56  inline bool operator == (const PointData& p) const
57  {
58    return coord == p.coord && texcoord == p.texcoord;
59  }
60
61};
62
63struct Lwo2Surface
64{
65    Lwo2Surface():
66        image_index(-1),
67        state_set(0) {}
68
69    short image_index;
70    string name;
71    Vec3 color;
72    StateSet* state_set;
73};
74
75typedef vector< PointData > PointsList;
76typedef vector< PointsList > PolygonsList;
77typedef PolygonsList::iterator IteratorPolygonsList;
78
79typedef map< int, int > DrawableToTagMapping;
80typedef pair< int, int > PairDrawableToTag;
81
82typedef vector< PointData >::iterator IteratorPoint;
83typedef vector< Vec2 >::iterator IteratorVec2;
84typedef vector< short >::iterator IteratorShort;
85
86class Lwo2Layer
87{
88 public:
89  friend class Lwo2;
90  Lwo2Layer();
91  ~Lwo2Layer();
92  void notify(NotifySeverity);
93  void GenerateGeode( Geode&, short, DrawableToTagMapping& );
94
95 private:
96  bool _find_triangle_fans(PolygonsList&, PolygonsList&);
97  bool _find_triangle_fan(PolygonsList&, PolygonsList&);
98  bool _find_triangle_strips(PolygonsList&, PolygonsList&);
99  bool _find_triangle_strip(PolygonsList&, PolygonsList&);
100  int _find_triangle_begins_with(PolygonsList&, PointData&, PointData&);
101
102  short _number;
103  short _flags;
104  short _parent;
105  Vec3 _pivot;
106  string _name;
107  vector< PointData > _points;
108  PolygonsList _polygons;
109  vector< short > _polygons_tag;
110};
111
112#endif
Note: See TracBrowser for help on using the browser.