00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef MAYASHADER_H
00016 #define MAYASHADER_H
00017
00018 #include "pandatoolbase.h"
00019 #include "mayaShaderColorDef.h"
00020
00021 #include "luse.h"
00022 #include "lmatrix.h"
00023 #include "namable.h"
00024
00025 class MObject;
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class MayaShader : public Namable {
00036 public:
00037 MayaShader(MObject engine, bool legacy_shader);
00038 ~MayaShader();
00039
00040 void output(ostream &out) const;
00041 void write(ostream &out) const;
00042
00043 private:
00044 bool find_textures_modern(MObject shader);
00045 bool find_textures_legacy(MObject shader);
00046
00047 public:
00048 void collect_maps();
00049 bool _legacy_mode;
00050
00051 MayaShaderColorList _all_maps;
00052
00053 public:
00054
00055 LColord _flat_color;
00056
00057 MayaShaderColorList _color_maps;
00058 MayaShaderColorList _trans_maps;
00059 MayaShaderColorList _normal_maps;
00060 MayaShaderColorList _glow_maps;
00061 MayaShaderColorList _gloss_maps;
00062 MayaShaderColorList _height_maps;
00063
00064 void bind_uvsets(MayaFileToUVSetMap &map);
00065
00066 private:
00067 void calculate_pairings();
00068 bool try_pair(MayaShaderColorDef *map1,
00069 MayaShaderColorDef *map2,
00070 bool perfect);
00071 string get_file_prefix(const string &fn);
00072 bool _legacy_shader;
00073 public:
00074 MayaShaderColorList _color;
00075 MayaShaderColorDef _transparency;
00076 LColor get_rgba(size_t idx=0) const;
00077 MayaShaderColorDef *get_color_def(size_t idx=0) const;
00078 };
00079
00080 INLINE ostream &operator << (ostream &out, const MayaShader &shader) {
00081 shader.output(out);
00082 return out;
00083 }
00084
00085 #endif
00086