Panda3D

maxToEggConverter.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 maxToEggConverter.h
10 * @author Corey Revilla and Ken Strickland
11 * @date 2003-06-22
12 * from mayaToEggConverter.cxx created by drose (10Nov99)
13 */
14
15 #ifndef __maxToEggConverter__H
16 #define __maxToEggConverter__H
17
18 #pragma conform(forScope, off)
19
20 /* Error-Reporting Includes
21 */
22 #define MTEC Logger::ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM4
23
24 /* Helpful Defintions and Casts
25 */
26 #define null 0
27 #define PHYSIQUE_CLASSID Class_ID(PHYSIQUE_CLASS_ID_A, PHYSIQUE_CLASS_ID_B)
28
29 /* External Helper Functions for UI
30 */
31 // *** Figure out why this is causing link errors DWORD WINAPI
32 // ProgressBarFunction(LPVOID arg);
33
34 /**
35 * This class supervises the construction of an EggData structure from a Max
36 * model
37 */
38 class MaxToEggConverter {
39 public:
40 MaxToEggConverter();
41 ~MaxToEggConverter();
42
43 bool convert(MaxEggOptions *options);
44
45 private:
46 struct PandaMaterial {
47 std::vector<PT(EggTexture)> _texture_list;
48 LColor _color;
49 std::vector<int> _map_channels;
50 bool _any_diffuse;
51 bool _any_opacity;
52 bool _any_gloss;
53 bool _any_normal;
54 };
55 typedef std::map<Mtl*,PandaMaterial> MaterialMap;
56 MaxEggOptions *_options;
57 int _current_frame;
58 PT(EggData) _egg_data;
59 std::string _program_name;
60 MaxNodeTree _tree;
61 int _cur_tref;
62 EggTextureCollection _textures;
63 MaterialMap _material_map;
64
65 void reset();
66
67 bool convert_char_model();
68 bool convert_char_chan(double start_frame, double end_frame,
69 double frame_inc, double output_frame_rate);
70 bool convert_hierarchy(EggGroupNode *egg_root);
71 bool process_model_node(MaxNodeDesc *node_desc);
72
73 void get_transform(INode *max_node, EggGroup *egg_group);
74 LMatrix4d get_object_transform(INode *max_node);
75 void get_joint_transform(INode *max_node, EggGroup *egg_group);
76 void get_joint_transform(INode *max_node, INode *parent_node,
77 EggGroup *egg_group);
78
79 bool make_nurbs_curve(INode *max_node, NURBSCVCurve *curve,
80 TimeValue time, EggGroup *egg_group);
81 void make_polyset(INode *max_node,
82 Mesh *mesh,
83 EggGroup *egg_group,
84 Shader *default_shader = nullptr);
85
86 Point3 get_max_vertex_normal(Mesh *mesh, int faceNo, int vertNo);
87 VertColor get_max_vertex_color(Mesh *mesh, int FaceNo, int VertexNo);
88 VertColor get_max_vertex_color(Mesh *mesh,int FaceNo,int VertexNo, int channel);
89 UVVert get_max_vertex_texcoord(Mesh *mesh, int faceNo, int vertNo, int channel);
90
91 void get_vertex_weights(INode *max_node, EggVertexPool *vpool);
92
93 const PandaMaterial &get_panda_material(Mtl *mtl, MtlID id);
94 void analyze_diffuse_maps(PandaMaterial &pandaMat, Texmap *m);
95 void analyze_opacity_maps(PandaMaterial &pandaMat, Texmap *m);
96 void analyze_gloss_maps(PandaMaterial &pandaMat, Texmap *m);
97 void analyze_glow_maps(PandaMaterial &pandaMat, Texmap *m);
98 void analyze_normal_maps(PandaMaterial &pandaMat, Texmap *m);
99 void add_map_channel(PandaMaterial &pandaMat, int channel);
100 void apply_texture_properties(EggTexture &tex, int channel);
101 std::string generate_tex_name();
102 std::string get_uv_name(int n);
103 bool reparent_decals(EggGroupNode *egg_parent);
104
105 public:
106
107 Modifier* FindSkinModifier (INode* node, const Class_ID &type);
108 };
109
110
111 #endif
EggData
This is the primary interface into all the egg data, and the root of the egg file structure.
Definition: eggData.h:37
EggGroupNode
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:46
EggGroup
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition: eggGroup.h:34
EggTextureCollection
This is a collection of textures by TRef name.
Definition: eggTextureCollection.h:30
EggTexture
Defines a texture map that may be applied to geometry.
Definition: eggTexture.h:30
EggVertexPool
A collection of vertices.
Definition: eggVertexPool.h:41
MaxNodeDesc
Describes a single instance of a node in the Max scene graph, relating it to the corresponding egg st...
Definition: maxNodeDesc.h:22
MaxNodeTree
Describes a complete tree of max nodes for conversion.
Definition: maxNodeTree.h:23
MaxToEggConverter
This class supervises the construction of an EggData structure from a Max model.
Definition: maxToEggConverter.h:38
MaxToEggConverter::convert
bool convert(MaxEggOptions *options)
Fills up the egg_data structure according to the global Max model data.
Definition: maxToEggConverter.cxx:65
Shader
Definition: shader.h:49
MaxEggOptions
Definition: maxOptionsDialog.h:51