Panda3D

Loading...
Searching...
No Matches
fltToEggConverter.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 fltToEggConverter.h
10 * @author drose
11 * @date 2001-04-17
12 */
13
14#ifndef FLTTOEGGCONVERTER_H
15#define FLTTOEGGCONVERTER_H
16
17#include "pandatoolbase.h"
18
19#include "fltToEggLevelState.h"
20#include "somethingToEggConverter.h"
21#include "fltHeader.h"
22#include "eggVertex.h"
23#include "eggVertexPool.h"
24#include "eggTexture.h"
25#include "pt_EggTexture.h"
26#include "pt_EggVertex.h"
27#include "pointerTo.h"
28#include "distanceUnit.h"
29
30 class FltRecord;
31 class FltLOD;
32 class FltGroup;
33 class FltObject;
34 class FltBeadID;
35 class FltBead;
36 class FltVertex;
37 class FltGeometry;
38 class FltFace;
39 class FltExternalReference;
40 class FltTexture;
41 class EggGroupNode;
42 class EggPrimitive;
43
44/**
45 * This class supervises the construction of an EggData structure from the
46 * data represented by the FltHeader. Reading and writing the egg and flt
47 * structures is left to the user.
48 */
49 class FltToEggConverter : public SomethingToEggConverter {
50 public:
51 FltToEggConverter();
52 FltToEggConverter(const FltToEggConverter &copy);
53 ~FltToEggConverter();
54
55 virtual SomethingToEggConverter *make_copy();
56
57 virtual std::string get_name() const;
58 virtual std::string get_extension() const;
59 virtual bool supports_compressed() const;
60
61 virtual bool convert_file(const Filename &filename);
62 virtual DistanceUnit get_input_units();
63 bool convert_flt(const FltHeader *flt_header);
64
65 // Set this true to store transforms in egg files as the fully composed
66 // matrix, or false (the default) to keep them decomposed into elemental
67 // operations.
68 bool _compose_transforms;
69
70 private:
71 void cleanup();
72
73 typedef pvector< PT_EggVertex > EggVertices;
74
75 void convert_record(const FltRecord *flt_record, FltToEggLevelState &state);
76 void dispatch_record(const FltRecord *flt_record, FltToEggLevelState &state);
77 void convert_lod(const FltLOD *flt_lod, FltToEggLevelState &state);
78 void convert_group(const FltGroup *flt_group, FltToEggLevelState &state);
79 void convert_object(const FltObject *flt_object, FltToEggLevelState &state);
80 void convert_bead_id(const FltBeadID *flt_bead, FltToEggLevelState &state);
81 void convert_bead(const FltBead *flt_bead, FltToEggLevelState &state);
82 void convert_face(const FltFace *flt_face, FltToEggLevelState &state);
83 void convert_ext_ref(const FltExternalReference *flt_ext, FltToEggLevelState &state);
84
85 void setup_geometry(const FltGeometry *flt_geom, FltToEggLevelState &state,
86 EggPrimitive *egg_prim, EggVertexPool *egg_vpool,
87 const EggVertices &vertices);
88
89 void convert_subfaces(const FltRecord *flt_record, FltToEggLevelState &state);
90
91 bool parse_comment(const FltBeadID *flt_bead, EggNode *egg_node);
92 bool parse_comment(const FltBead *flt_bead, EggNode *egg_node);
93 bool parse_comment(const FltTexture *flt_texture, EggNode *egg_node);
94 bool parse_comment(const std::string &comment, const std::string &name,
95 EggNode *egg_node);
96
97 PT_EggVertex make_egg_vertex(const FltVertex *flt_vertex);
98 PT_EggTexture make_egg_texture(const FltTexture *flt_texture);
99
100 CPT(FltHeader) _flt_header;
101 DistanceUnit _flt_units;
102
103 PT(EggVertexPool) _main_egg_vpool;
104
105 typedef pmap<const FltTexture *, PT(EggTexture) > Textures;
106 Textures _textures;
107};
108
109#include "fltToEggConverter.I"
110
111#endif
EggGroupNode
A base class for nodes in the hierarchy that are not leaf nodes.
Definition eggGroupNode.h:46
EggNode
A base class for things that may be directly added into the egg hierarchy.
Definition eggNode.h:36
EggPrimitive
A base class for any of a number of kinds of geometry primitives: polygons, point lights,...
Definition eggPrimitive.h:49
EggTexture
Defines a texture map that may be applied to geometry.
Definition eggTexture.h:30
EggVertexPool
A collection of vertices.
Definition eggVertexPool.h:41
Filename
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44
FltBeadID
A base class for any of a broad family of flt beads that include an ID.
Definition fltBeadID.h:24
FltBead
A base class for any of a broad family of flt records that represent particular beads in the hierarch...
Definition fltBead.h:29
FltExternalReference
An external reference to another flt file (possibly to a specific bead within the flt file).
Definition fltExternalReference.h:27
FltFace
A single face bead, e.g.
Definition fltFace.h:24
FltGeometry
This is a base class for both FltFace and FltMesh, which are two different kinds of geometric primiti...
Definition fltGeometry.h:33
FltGroup
The main grouping bead of the flt file.
Definition fltGroup.h:24
FltHeader
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition fltHeader.h:44
FltLOD
A Level-of-Detail record.
Definition fltLOD.h:24
FltObject
The main objecting bead of the flt file.
Definition fltObject.h:24
FltRecord
The base class for all kinds of records in a MultiGen OpenFlight file.
Definition fltRecord.h:36
FltTexture
Represents a single texture in the texture palette.
Definition fltTexture.h:27
FltToEggConverter::get_name
virtual std::string get_name() const
Returns the English name of the file type this converter supports.
Definition fltToEggConverter.cxx:81
FltToEggConverter::get_input_units
virtual DistanceUnit get_input_units()
This may be called after convert_file() has been called and returned true, indicating a successful co...
Definition fltToEggConverter.cxx:135
FltToEggConverter::make_copy
virtual SomethingToEggConverter * make_copy()
Allocates and returns a new copy of the converter.
Definition fltToEggConverter.cxx:72
FltToEggConverter::convert_file
virtual bool convert_file(const Filename &filename)
Handles the reading of the input file and converting it to egg.
Definition fltToEggConverter.cxx:111
FltToEggConverter::convert_flt
bool convert_flt(const FltHeader *flt_header)
Fills up the egg_data structure according to the indicated lwo structure.
Definition fltToEggConverter.cxx:143
FltToEggConverter::get_extension
virtual std::string get_extension() const
Returns the common extension of the file type this converter supports.
Definition fltToEggConverter.cxx:89
FltToEggConverter::supports_compressed
virtual bool supports_compressed() const
Returns true if this file type can transparently load compressed files (with a .pz extension),...
Definition fltToEggConverter.cxx:98
FltToEggLevelState
This keeps track of relevant things about the traversal as we walk through the flt hierarchy.
Definition fltToEggLevelState.h:30
FltVertex
Represents a single vertex in the vertex palette.
Definition fltVertex.h:32
pvector< PT_EggVertex >
distanceUnit.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
DistanceUnit
DistanceUnit
This enumerated type lists all the kinds of units we're likely to come across in model conversion pro...
Definition distanceUnit.h:23
eggTexture.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggVertexPool.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggVertex.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
fltHeader.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
fltToEggConverter.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
fltToEggLevelState.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pt_EggTexture.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pt_EggVertex.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
somethingToEggConverter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.