Panda3D
lwoToEggConverter.h
1 // Filename: lwoToEggConverter.h
2 // Created by: drose (17Apr01)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef LWOTOEGGCONVERTER_H
16 #define LWOTOEGGCONVERTER_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "somethingToEggConverter.h"
21 #include "lwoHeader.h"
22 #include "pointerTo.h"
23 
24 #include "pvector.h"
25 #include "pmap.h"
26 
27 class CLwoLayer;
28 class CLwoClip;
29 class CLwoPoints;
30 class CLwoPolygons;
31 class CLwoSurface;
32 class LwoClip;
33 
34 ////////////////////////////////////////////////////////////////////
35 // Class : LwoToEggConverter
36 // Description : This class supervises the construction of an EggData
37 // structure from the data represented by the LwoHeader.
38 // Reading and writing the egg and lwo structures is
39 // left to the user.
40 ////////////////////////////////////////////////////////////////////
42 public:
45  virtual ~LwoToEggConverter();
46 
48 
49  virtual string get_name() const;
50  virtual string get_extension() const;
51 
52  virtual bool convert_file(const Filename &filename);
53  bool convert_lwo(const LwoHeader *lwo_header);
54  virtual bool supports_compressed() const;
55 
56  CLwoLayer *get_layer(int number) const;
57  CLwoClip *get_clip(int number) const;
58 
59  CLwoSurface *get_surface(const string &name) const;
60 
61  bool _make_materials;
62 
63 private:
64  void cleanup();
65 
66  void collect_lwo();
67  void make_egg();
68  void connect_egg();
69 
70  void slot_layer(int number);
71  void slot_clip(int number);
72  CLwoLayer *make_generic_layer();
73 
74  CPT(LwoHeader) _lwo_header;
75 
76  CLwoLayer *_generic_layer;
78  Layers _layers;
79 
80  typedef pvector<CLwoClip *> Clips;
81  Clips _clips;
82 
84  Points _points;
85 
87  Polygons _polygons;
88 
90  Surfaces _surfaces;
91 };
92 
93 #include "lwoToEggConverter.I"
94 
95 #endif
96 
97 
CLwoSurface * get_surface(const string &name) const
Returns a pointer to the surface definition with the given name, or NULL if there is no such surface...
virtual string get_name() const
Returns the English name of the file type this converter supports.
This class is a wrapper around LwoPolygons and stores additional information useful during the conver...
Definition: cLwoPolygons.h:39
The first chunk in a Lightwave Object file.
Definition: lwoHeader.h:26
A single image file, or a numbered sequence of images (e.g.
Definition: lwoClip.h:27
virtual string get_extension() const
Returns the common extension of the file type this converter supports.
This class is a wrapper around LwoClip and stores additional information useful during the conversion...
Definition: cLwoClip.h:32
This class is a wrapper around LwoSurface and stores additional information useful during the convers...
Definition: cLwoSurface.h:42
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
This class is a wrapper around LwoLayer and stores additional information useful during the conversio...
Definition: cLwoLayer.h:32
bool convert_lwo(const LwoHeader *lwo_header)
Fills up the egg_data structure according to the indicated lwo structure.
CLwoLayer * get_layer(int number) const
Returns a pointer to the layer with the given index number, or NULL if there is no such layer...
This class supervises the construction of an EggData structure from the data represented by the LwoHe...
virtual SomethingToEggConverter * make_copy()
Allocates and returns a new copy of the converter.
CLwoClip * get_clip(int number) const
Returns a pointer to the clip with the given index number, or NULL if there is no such clip...
This class is a wrapper around LwoPoints and stores additional information useful during the conversi...
Definition: cLwoPoints.h:36
virtual bool supports_compressed() const
Returns true if this file type can transparently load compressed files (with a .pz extension)...
This is a base class for a family of converter classes that manage a conversion from some file type t...
virtual bool convert_file(const Filename &filename)
Handles the reading of the input file and converting it to egg.