All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
meshShaderKey.h
1 //
2 // Copyright 2016 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 HDST_MESH_SHADER_KEY_H
25 #define HDST_MESH_SHADER_KEY_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/version.h"
29 #include "pxr/imaging/hd/enums.h"
30 #include "pxr/imaging/hdSt/geometricShader.h"
31 #include "pxr/base/tf/token.h"
32 
33 PXR_NAMESPACE_OPEN_SCOPE
34 
35 
36 struct HdSt_MeshShaderKey
37 {
38  enum NormalSource
39  {
40  NormalSourceScene,
41  NormalSourceSmooth,
42  NormalSourceLimit,
43  NormalSourceFlat,
44  NormalSourceGeometryShader
45  };
46 
47  HdSt_MeshShaderKey(HdSt_GeometricShader::PrimitiveType primType,
48  TfToken shadingTerminal,
49  bool useCustomDisplacement,
50  NormalSource normalsSource,
51  HdInterpolation normalsInterpolation,
52  bool doubleSided,
53  bool forceGeometryShader,
54  bool blendWireframeColor,
55  HdCullStyle cullStyle,
56  HdMeshGeomStyle geomStyle,
57  float lineWidth,
58  bool enableScalarOverride,
59  bool discardIfNotActiveSelected = false,
60  bool discardIfNotRolloverSelected = false);
61 
62  // Note: it looks like gcc 4.8 has a problem issuing
63  // a wrong warning as "array subscript is above array bounds"
64  // when the default destructor is automatically generated at callers.
65  // Having an empty destructor explicitly within this linkage apparently
66  // avoids the issue.
67  ~HdSt_MeshShaderKey();
68 
69  bool IsCullingPass() const { return false; }
70  HdCullStyle GetCullStyle() const { return cullStyle; }
71  HdPolygonMode GetPolygonMode() const { return polygonMode; }
72  float GetLineWidth() const { return lineWidth; }
73  HdSt_GeometricShader::PrimitiveType GetPrimitiveType() const {
74  return primType;
75  }
76 
77  HdSt_GeometricShader::PrimitiveType primType;
78  HdCullStyle cullStyle;
79  HdPolygonMode polygonMode;
80  float lineWidth;
81 
82  TfToken const &GetGlslfxFile() const { return glslfx; }
83  TfToken const *GetVS() const { return VS; }
84  TfToken const *GetTCS() const { return TCS; }
85  TfToken const *GetTES() const { return TES; }
86  TfToken const *GetGS() const { return GS; }
87  TfToken const *GetFS() const { return FS; }
88 
89  TfToken glslfx;
90  TfToken VS[7];
91  TfToken TCS[3];
92  TfToken TES[3];
93  TfToken GS[8];
94  TfToken FS[17];
95 };
96 
97 
98 PXR_NAMESPACE_CLOSE_SCOPE
99 
100 #endif // HDST_MESH_SHADER_KEY_H
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89