Loading...
Searching...
No Matches
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"
31#include <stdint.h>
32
33PXR_NAMESPACE_OPEN_SCOPE
34
84public:
85 static const int CustomSlotsBegin = 8;
86 static const int DefaultNumSlots = 3; /* Constant, Vertex, Topology */
87 static const int Unassigned = -1;
88
90 // default slots:
91 _topology(2),
92 _instancePrimvar(Unassigned),
93 _constantPrimvar(0),
94 _vertexPrimvar(1),
95 _elementPrimvar(3),
96 _instanceIndex(4),
97 _faceVaryingPrimvar(5),
98 _topologyVisibility(6),
99 _varyingPrimvar(7) {
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
126private:
127 int16_t _topology;
128 int16_t _instancePrimvar;
129 int8_t _constantPrimvar;
130 int8_t _vertexPrimvar;
131 int8_t _elementPrimvar;
132 int8_t _instanceIndex;
133 int8_t _faceVaryingPrimvar;
134 int8_t _topologyVisibility;
135 int8_t _varyingPrimvar;
136};
137
138
139PXR_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.
A tiny set of integers, which provides an indirection mapping from the conceptual space of an HdRprim...
Definition: drawingCoord.h:83
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
Definition: diagnostic.h:283