Panda3D
eggToSomethingConverter.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file eggToSomethingConverter.h
10  * @author drose
11  * @date 2012-09-26
12  */
13 
14 #ifndef EGGTOSOMETHINGCONVERTER_H
15 #define EGGTOSOMETHINGCONVERTER_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "filename.h"
20 #include "pointerTo.h"
21 #include "distanceUnit.h"
22 #include "coordinateSystem.h"
23 
24 class EggData;
25 class EggGroupNode;
26 
27 /**
28  * This is a base class for a family of converter classes that manage a
29  * conversion from egg format to some other file type.
30  *
31  * Classes of this type can be used to implement egg2xxx converter programs,
32  * as well as LoaderFileTypeXXX run-time savers.
33  */
35 public:
38  virtual ~EggToSomethingConverter();
39 
40  virtual EggToSomethingConverter *make_copy()=0;
41 
42  INLINE void clear_error();
43  INLINE bool had_error() const;
44 
45  void set_egg_data(EggData *egg_data);
46  INLINE void clear_egg_data();
47  INLINE EggData *get_egg_data();
48 
49  INLINE void set_output_units(DistanceUnit output_units);
50  INLINE DistanceUnit get_output_units() const;
51  INLINE void set_output_coordinate_system(CoordinateSystem output_coordinate_system) const;
52  INLINE CoordinateSystem get_output_coordinate_system() const;
53 
54  virtual std::string get_name() const=0;
55  virtual std::string get_extension() const=0;
56  virtual std::string get_additional_extensions() const;
57  virtual bool supports_compressed() const;
58 
59  virtual bool write_file(const Filename &filename)=0;
60 
61 protected:
62  PT(EggData) _egg_data;
63  DistanceUnit _output_units;
64  CoordinateSystem _output_coordinate_system;
65 
66  bool _error;
67 };
68 
70 
71 #endif
bool had_error() const
Returns true if an error was detected during the conversion process, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:46
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the primary interface into all the egg data, and the root of the egg file structure.
Definition: eggData.h:37
This is a base class for a family of converter classes that manage a conversion from egg format to so...
DistanceUnit
This enumerated type lists all the kinds of units we're likely to come across in model conversion pro...
Definition: distanceUnit.h:23
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:39
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void clear_egg_data()
Sets the EggData to NULL and makes the converter invalid.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual std::string get_additional_extensions() const
Returns a space-separated list of extension, in addition to the one returned by get_extension(),...
EggData * get_egg_data()
Returns the EggData structure.