Panda3D
 All Classes Functions Variables Enumerations
mayaShaders.h
1 // Filename: mayaShaders.h
2 // Created by: drose (11Feb00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef MAYASHADERS_H
16 #define MAYASHADERS_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "pmap.h"
21 #include "pvector.h"
22 #include "mayaShaderColorDef.h"
23 
24 class MayaShader;
25 class MObject;
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : MayaShaders
29 // Description : Collects the set of MayaShaders that have been
30 // encountered so far.
31 ////////////////////////////////////////////////////////////////////
32 class MayaShaders {
33 public:
34  MayaShaders();
35  ~MayaShaders();
36  MayaShader *find_shader_for_node(MObject node, bool legacy_shader);
37  MayaShader *find_shader_for_shading_engine(MObject engine, bool legacy_shader);
38 
39  int get_num_shaders() const;
40  MayaShader *get_shader(int n) const;
41 
42  MayaFileToUVSetMap _file_to_uvset;
43  pvector<string> _uvset_names;
44  void clear();
45  void bind_uvsets(MObject mesh);
46  string find_uv_link(const string &match);
47 
48 private:
50  Shaders _shaders;
52  ShadersInOrder _shaders_in_order;
53 };
54 
55 #endif
56 
MayaShader * get_shader(int n) const
Returns the nth MayaShader that has been discovered so far.
void bind_uvsets(MObject mesh)
Causes all shaders in the set to use the given mesh as a file-to-uvset map.
int get_num_shaders() const
Returns the number of unique MayaShaders that have been discovered so far.
Collects the set of MayaShaders that have been encountered so far.
Definition: mayaShaders.h:32
MayaShader * find_shader_for_node(MObject node, bool legacy_shader)
Extracts the shader assigned to the indicated node.
Definition: mayaShaders.cxx:56
string find_uv_link(const string &match)
Returns the current mapping from file to uvset for the given file texture name.
Corresponds to a single &quot;shader&quot; in Maya.
Definition: mayaShader.h:35
MayaShader * find_shader_for_shading_engine(MObject engine, bool legacy_shader)
Returns the MayaShader object associated with the indicated &quot;shading engine&quot;.
void clear()
Frees all of the previously-defined MayaShader objects associated with this set.