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

Revision 13041, 3.7 kB (checked in by robert, 3 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 LWO2_H
27#define LWO2_H 1
28
29#include <vector>
30#include <map>
31#include <string>
32
33#include <osg/Referenced>
34#include <osg/Vec2>
35#include <osg/Vec3>
36#include <osg/Geometry>
37#include <osg/Group>
38#include <osg/Notify>
39
40#include <osgDB/fstream>
41
42using namespace osg;
43using namespace std;
44
45class Lwo2Layer;
46struct Lwo2Surface;
47struct Lwo2PolygonMapping;
48
49typedef vector< string >::iterator IteratorString;
50typedef map< int, Lwo2Layer* >::iterator IteratorLayers;
51typedef map< string, Lwo2Surface* >::iterator IteratorSurfaces;
52typedef pair< const short, Lwo2PolygonMapping > PairVMAD;
53
54class Lwo2
55{
56 public:
57  Lwo2();
58  ~Lwo2();
59  bool ReadFile( const string& filename );
60  bool GenerateGroup( Group& );
61
62 private:
63  map< int, Lwo2Layer* > _layers;
64  map< string, Lwo2Surface* > _surfaces;
65  Lwo2Layer* _current_layer;
66  vector< string > _tags;
67  vector< string > _images;
68  osgDB::ifstream _fin;
69
70  unsigned char _read_char();
71  unsigned short _read_short();
72  unsigned int _read_uint();
73  float _read_float();
74  string& _read_string(string&);
75
76  bool _successfully_read;
77
78  void _print_tag(unsigned int, unsigned int);
79  void _print_type(unsigned int);
80
81  void _read_tag_strings(unsigned long);
82  void _read_layer(unsigned long);
83  void _read_points(unsigned long);
84  void _read_vertex_mapping(unsigned long);
85  void _read_polygons(unsigned long);
86  void _read_polygons_mapping(unsigned long);
87  void _read_polygon_tag_mapping(unsigned long);
88  void _read_image_definition(unsigned long);
89  void _read_surface(unsigned long);
90
91  // generate StateSets for each surface
92  void _generate_statesets_from_surfaces();
93};
94
95// makes 4-byte integer tag from four chars
96// used in IFF standard
97
98unsigned long make_id(const char* tag);
99
100const unsigned long tag_FORM = make_id("FORM");
101const unsigned long tag_LWO2 = make_id("LWO2");
102const unsigned long tag_LAYR = make_id("LAYR");
103const unsigned long tag_TAGS = make_id("TAGS");
104const unsigned long tag_PNTS = make_id("PNTS");
105const unsigned long tag_VMAP = make_id("VMAP");
106const unsigned long tag_VMAD = make_id("VMAD");
107const unsigned long tag_TXUV = make_id("TXUV");
108const unsigned long tag_POLS = make_id("POLS");
109const unsigned long tag_FACE = make_id("FACE");
110const unsigned long tag_PTAG = make_id("PTAG");
111const unsigned long tag_SURF = make_id("SURF");
112const unsigned long tag_CLIP = make_id("CLIP");
113const unsigned long tag_STIL = make_id("STIL");
114const unsigned long tag_BLOK = make_id("BLOK");
115const unsigned long tag_IMAP = make_id("IMAP");
116const unsigned long tag_TMAP = make_id("TMAP");
117const unsigned long tag_IMAG = make_id("IMAG");
118const unsigned long tag_COLR = make_id("COLR");
119
120#endif
Note: See TracBrowser for help on using the browser.