All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
usdPreviewSurfaceShadingNodeOverride.h
Go to the documentation of this file.
1 //
2 // Copyright 2018 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXRUSDPREVIEWSURFACE_USD_PREVIEW_SURFACE_SHADING_NODE_OVERRIDE_H
25 #define PXRUSDPREVIEWSURFACE_USD_PREVIEW_SURFACE_SHADING_NODE_OVERRIDE_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxrUsdPreviewSurface/api.h"
31 
32 #include "pxr/base/tf/staticTokens.h"
33 
34 #include <maya/MObject.h>
35 #include <maya/MPxSurfaceShadingNodeOverride.h>
36 #include <maya/MString.h>
37 #include <maya/MViewport2Renderer.h>
38 
39 
40 PXR_NAMESPACE_OPEN_SCOPE
41 
42 
43 #define PXRUSDPREVIEWSURFACE_USD_PREVIEW_SURFACE_SHADING_NODE_OVERRIDE_TOKENS \
44  ((Float4ToFloatXFragmentName, "float4ToFloatX")) \
45  ((Float4ToFloatYFragmentName, "float4ToFloatY")) \
46  ((Float4ToFloatZFragmentName, "float4ToFloatZ")) \
47  ((Float4ToFloatWFragmentName, "float4ToFloatW")) \
48  ((LightingStructFragmentName, "lightingContributions")) \
49  ((LightingFragmentName, "usdPreviewSurfaceLighting")) \
50  ((CombinerFragmentName, "usdPreviewSurfaceCombiner")) \
51  ((SurfaceFragmentGraphName, "usdPreviewSurface"))
52 
54  PxrMayaUsdPreviewSurfaceShadingNodeTokens,
55  PXRUSDPREVIEWSURFACE_API,
56  PXRUSDPREVIEWSURFACE_USD_PREVIEW_SURFACE_SHADING_NODE_OVERRIDE_TOKENS);
57 
58 
59 class PxrMayaUsdPreviewSurfaceShadingNodeOverride :
60  public MHWRender::MPxSurfaceShadingNodeOverride
61 {
62  public:
63 
64  PXRUSDPREVIEWSURFACE_API
65  static MHWRender::MPxSurfaceShadingNodeOverride* creator(
66  const MObject& obj);
67 
68  PXRUSDPREVIEWSURFACE_API
69  PxrMayaUsdPreviewSurfaceShadingNodeOverride(const MObject& obj);
70  PXRUSDPREVIEWSURFACE_API
71  ~PxrMayaUsdPreviewSurfaceShadingNodeOverride() override;
72 
73  // MPxSurfaceShadingNodeOverride Overrides.
74 
75  PXRUSDPREVIEWSURFACE_API
76  MString primaryColorParameter() const override;
77 
78  PXRUSDPREVIEWSURFACE_API
79  MString transparencyParameter() const override;
80 
81  PXRUSDPREVIEWSURFACE_API
82  MString bumpAttribute() const override;
83 
84 
85  // MPxShadingNodeOverride Overrides.
86 
87  PXRUSDPREVIEWSURFACE_API
88  MHWRender::DrawAPI supportedDrawAPIs() const override;
89 
90  PXRUSDPREVIEWSURFACE_API
91  MString fragmentName() const override;
92 
93  PXRUSDPREVIEWSURFACE_API
94  void getCustomMappings(
95  MHWRender::MAttributeParameterMappingList& mappings) override;
96 };
97 
98 
99 PXR_NAMESPACE_CLOSE_SCOPE
100 
101 
102 #endif
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:118