Panda3D
eggToSomethingConverter.h
1 // Filename: eggToSomethingConverter.h
2 // Created by: drose (26Sep12)
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 EGGTOSOMETHINGCONVERTER_H
16 #define EGGTOSOMETHINGCONVERTER_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "filename.h"
21 #include "pointerTo.h"
22 #include "distanceUnit.h"
23 #include "coordinateSystem.h"
24 
25 class EggData;
26 class EggGroupNode;
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : EggToSomethingConverter
30 // Description : This is a base class for a family of converter
31 // classes that manage a conversion from egg format to
32 // some other file type.
33 //
34 // Classes of this type can be used to implement egg2xxx
35 // converter programs, as well as LoaderFileTypeXXX
36 // run-time savers.
37 ////////////////////////////////////////////////////////////////////
39 public:
42  virtual ~EggToSomethingConverter();
43 
44  virtual EggToSomethingConverter *make_copy()=0;
45 
46  INLINE void clear_error();
47  INLINE bool had_error() const;
48 
49  void set_egg_data(EggData *egg_data);
50  INLINE void clear_egg_data();
51  INLINE EggData *get_egg_data();
52 
53  INLINE void set_output_units(DistanceUnit output_units);
54  INLINE DistanceUnit get_output_units() const;
55  INLINE void set_output_coordinate_system(CoordinateSystem output_coordinate_system) const;
56  INLINE CoordinateSystem get_output_coordinate_system() const;
57 
58  virtual string get_name() const=0;
59  virtual string get_extension() const=0;
60  virtual string get_additional_extensions() const;
61  virtual bool supports_compressed() const;
62 
63  virtual bool write_file(const Filename &filename)=0;
64 
65 protected:
66  PT(EggData) _egg_data;
67  DistanceUnit _output_units;
68  CoordinateSystem _output_coordinate_system;
69 
70  bool _error;
71 };
72 
73 #include "eggToSomethingConverter.I"
74 
75 #endif
76 
77 
bool had_error() const
Returns true if an error was detected during the conversion process, false otherwise.
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:51
This is the primary interface into all the egg data, and the root of the egg file structure...
Definition: eggData.h:41
This is a base class for a family of converter classes that manage a conversion from egg format to so...
void clear_error()
Resets the error flag to the no-error state.
void set_egg_data(EggData *egg_data)
Sets the egg data that will be filled in when convert_file() is called.
DistanceUnit get_output_units() const
Returns the value supplied to set_output_units().
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
virtual bool supports_compressed() const
Returns true if this file type can transparently save compressed files (with a .pz extension)...
void set_output_units(DistanceUnit output_units)
Specifies the units that the EggData has already been scaled to.
virtual string get_additional_extensions() const
Returns a space-separated list of extension, in addition to the one returned by get_extension(), that are recognized by this converter.
void clear_egg_data()
Sets the EggData to NULL and makes the converter invalid.
EggData * get_egg_data()
Returns the EggData structure.