Panda3D

Loading...
Searching...
No Matches
mayaShader.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 mayaShader.h
10 * @author drose
11 * @date 2000-02-01
12 */
13
14#ifndef MAYASHADER_H
15#define MAYASHADER_H
16
17#include "pandatoolbase.h"
18#include "mayaShaderColorDef.h"
19
20#include "luse.h"
21#include "lmatrix.h"
22#include "namable.h"
23
24
25/**
26 * Corresponds to a single "shader" in Maya. This extracts out all the
27 * parameters of a Maya shader that we might care about. There are many more
28 * parameters that we don't care about or don't know enough to extract.
29 */
30 class MayaShader : public Namable {
31 public:
32 MayaShader(MObject engine, bool legacy_shader);
33 ~MayaShader();
34
35 void output(std::ostream &out) const;
36 void write(std::ostream &out) const;
37
38 private:
39 bool find_textures_modern(MObject shader);
40 bool find_textures_legacy(MObject shader);
41
42 public:
43 void collect_maps();
44 bool _legacy_mode;
45
46 MayaShaderColorList _all_maps;
47
48 public: // relevant only to modern mode.
49
50 LColord _flat_color;
51
52 MayaShaderColorList _color_maps;
53 MayaShaderColorList _trans_maps;
54 MayaShaderColorList _normal_maps;
55 MayaShaderColorList _glow_maps;
56 MayaShaderColorList _gloss_maps;
57 MayaShaderColorList _height_maps;
58
59 void bind_uvsets(MayaFileToUVSetMap &map);
60
61 private:
62 void calculate_pairings();
63 bool try_pair(MayaShaderColorDef *map1,
64 MayaShaderColorDef *map2,
65 bool perfect);
66 std::string get_file_prefix(const std::string &fn);
67 bool _legacy_shader;
68 public: // relevant only to legacy mode.
69 MayaShaderColorList _color;
70 MayaShaderColorDef _transparency;
71 LColor get_rgba(size_t idx=0) const;
72 MayaShaderColorDef *get_color_def(size_t idx=0) const;
73};
74
75INLINE std::ostream &operator << (std::ostream &out, const MayaShader &shader) {
76 shader.output(out);
77 return out;
78}
79
80#endif
MayaShaderColorDef
This defines the various attributes that Maya may associate with the "color" channel for a particular...
Definition mayaShaderColorDef.h:34
MayaShader
Corresponds to a single "shader" in Maya.
Definition mayaShader.h:30
MayaShader::MayaShader
MayaShader(MObject engine, bool legacy_shader)
Reads the Maya "shading engine" to determine the relevant shader properties.
Definition mayaShader.cxx:43
MayaShader::collect_maps
void collect_maps()
Recalculates the all_maps list.
Definition mayaShader.cxx:158
MayaShader::get_rgba
LColor get_rgba(size_t idx=0) const
Returns the overall color of the shader as a single-precision rgba value, where the alpha component r...
Definition mayaShader.cxx:131
MayaShader::get_color_def
MayaShaderColorDef * get_color_def(size_t idx=0) const
This is part of the deprecated codepath.
Definition mayaShader.cxx:115
MayaShader::bind_uvsets
void bind_uvsets(MayaFileToUVSetMap &map)
Assigns the uvset_name of each MayaShaderColorDef using the given file-to- uvset map.
Definition mayaShader.cxx:255
map
STL class.
lmatrix.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
luse.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
mayaShaderColorDef.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
namable.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.