00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __maxToEggConverter__H
00017 #define __maxToEggConverter__H
00018
00019 #pragma conform(forScope, off)
00020
00021
00022
00023 #define MTEC Logger::ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM4
00024
00025
00026
00027 #define null 0
00028 #define PHYSIQUE_CLASSID Class_ID(PHYSIQUE_CLASS_ID_A, PHYSIQUE_CLASS_ID_B)
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 class MaxToEggConverter {
00041 public:
00042 MaxToEggConverter();
00043 ~MaxToEggConverter();
00044
00045 bool convert(MaxEggOptions *options);
00046
00047 private:
00048 struct PandaMaterial {
00049 std::vector<PT(EggTexture)> _texture_list;
00050 LColor _color;
00051 std::vector<int> _map_channels;
00052 bool _any_diffuse;
00053 bool _any_opacity;
00054 bool _any_gloss;
00055 bool _any_normal;
00056 };
00057 typedef std::map<Mtl*,PandaMaterial> MaterialMap;
00058 MaxEggOptions *_options;
00059 int _current_frame;
00060 PT(EggData) _egg_data;
00061 string _program_name;
00062 MaxNodeTree _tree;
00063 int _cur_tref;
00064 EggTextureCollection _textures;
00065 MaterialMap _material_map;
00066
00067 void reset();
00068
00069 bool convert_char_model();
00070 bool convert_char_chan(double start_frame, double end_frame,
00071 double frame_inc, double output_frame_rate);
00072 bool convert_hierarchy(EggGroupNode *egg_root);
00073 bool process_model_node(MaxNodeDesc *node_desc);
00074
00075 void get_transform(INode *max_node, EggGroup *egg_group);
00076 LMatrix4d get_object_transform(INode *max_node);
00077 void get_joint_transform(INode *max_node, EggGroup *egg_group);
00078 void get_joint_transform(INode *max_node, INode *parent_node,
00079 EggGroup *egg_group);
00080
00081 bool make_nurbs_curve(NURBSCVCurve *curve, const string &name,
00082 TimeValue time, EggGroup *egg_group);
00083 void make_polyset(INode *max_node,
00084 Mesh *mesh,
00085 EggGroup *egg_group,
00086 Shader *default_shader = NULL);
00087
00088 Point3 get_max_vertex_normal(Mesh *mesh, int faceNo, int vertNo);
00089 VertColor get_max_vertex_color(Mesh *mesh, int FaceNo, int VertexNo);
00090 VertColor get_max_vertex_color(Mesh *mesh,int FaceNo,int VertexNo, int channel);
00091 UVVert get_max_vertex_texcoord(Mesh *mesh, int faceNo, int vertNo, int channel);
00092
00093 void get_vertex_weights(INode *max_node, EggVertexPool *vpool);
00094
00095 const PandaMaterial &get_panda_material(Mtl *mtl, MtlID id);
00096 void analyze_diffuse_maps(PandaMaterial &pandaMat, Texmap *m);
00097 void analyze_opacity_maps(PandaMaterial &pandaMat, Texmap *m);
00098 void analyze_gloss_maps(PandaMaterial &pandaMat, Texmap *m);
00099 void analyze_glow_maps(PandaMaterial &pandaMat, Texmap *m);
00100 void analyze_normal_maps(PandaMaterial &pandaMat, Texmap *m);
00101 void add_map_channel(PandaMaterial &pandaMat, int channel);
00102 void apply_texture_properties(EggTexture &tex, int channel);
00103 std::string generate_tex_name();
00104 std::string get_uv_name(int n);
00105 bool reparent_decals(EggGroupNode *egg_parent);
00106
00107 public:
00108
00109 Modifier* FindSkinModifier (INode* node, const Class_ID &type);
00110 };
00111
00112
00113 #endif