drawingCoord.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 PXR_IMAGING_HD_DRAWING_COORD_H
25 #define PXR_IMAGING_HD_DRAWING_COORD_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/api.h"
29 #include "pxr/imaging/hd/version.h"
30 #include "pxr/base/tf/diagnostic.h"
31 #include <stdint.h>
32 
33 PXR_NAMESPACE_OPEN_SCOPE
34 
84 public:
85  static const int CustomSlotsBegin = 8;
86  static const int DefaultNumSlots = 3; /* Constant, Vertex, Topology */
87  static const int Unassigned = -1;
88 
89  HdDrawingCoord() :
90  // default slots:
91  _constantPrimvar(0),
92  _vertexPrimvar(1),
93  _topology(2),
94  _elementPrimvar(3),
95  _instanceIndex(4),
96  _faceVaryingPrimvar(5),
97  _topologyVisibility(6),
98  _varyingPrimvar(7),
99  _instancePrimvar(Unassigned) {
100  }
101 
102  int GetConstantPrimvarIndex() const { return _constantPrimvar; }
103  void SetConstantPrimvarIndex(int slot) { _constantPrimvar = slot; }
104  int GetVertexPrimvarIndex() const { return _vertexPrimvar; }
105  void SetVertexPrimvarIndex(int slot) { _vertexPrimvar = slot; }
106  int GetTopologyIndex() const { return _topology; }
107  void SetTopologyIndex(int slot) { _topology = slot; }
108  int GetElementPrimvarIndex() const { return _elementPrimvar; }
109  void SetElementPrimvarIndex(int slot) { _elementPrimvar = slot; }
110  int GetInstanceIndexIndex() const { return _instanceIndex; }
111  void SetInstanceIndexIndex(int slot) { _instanceIndex = slot; }
112  int GetFaceVaryingPrimvarIndex() const { return _faceVaryingPrimvar; }
113  void SetFaceVaryingPrimvarIndex(int slot) { _faceVaryingPrimvar = slot; }
114  int GetTopologyVisibilityIndex() const { return _topologyVisibility; }
115  void SetTopologyVisibilityIndex(int slot) { _topologyVisibility = slot; }
116  int GetVaryingPrimvarIndex() const { return _varyingPrimvar; }
117  void SetVaryingPrimvarIndex(int slot) { _varyingPrimvar = slot; }
118 
119  // instance primvars take up a range of slots.
120  void SetInstancePrimvarBaseIndex(int slot) { _instancePrimvar = slot; }
121  int GetInstancePrimvarIndex(int level) const {
122  TF_VERIFY(_instancePrimvar != Unassigned);
123  return _instancePrimvar + level;
124  }
125 
126 private:
127  int8_t _constantPrimvar;
128  int8_t _vertexPrimvar;
129  int8_t _topology;
130  int8_t _elementPrimvar;
131  int8_t _instanceIndex;
132  int8_t _faceVaryingPrimvar;
133  int8_t _topologyVisibility;
134  int8_t _varyingPrimvar;
135  int8_t _instancePrimvar;
136 };
137 
138 
139 PXR_NAMESPACE_CLOSE_SCOPE
140 
141 #endif // PXR_IMAGING_HD_DRAWING_COORD_H
Low-level utilities for informing users of various internal and external diagnostic conditions.
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
Definition: diagnostic.h:283
A tiny set of integers, which provides an indirection mapping from the conceptual space of an HdRprim...
Definition: drawingCoord.h:83