This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
drawingCoord.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HD_DRAWING_COORD_H
8#define PXR_IMAGING_HD_DRAWING_COORD_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hd/api.h"
12#include "pxr/imaging/hd/version.h"
14#include <stdint.h>
15
16PXR_NAMESPACE_OPEN_SCOPE
17
67public:
68 static const int CustomSlotsBegin = 8;
69 static const int DefaultNumSlots = 3; /* Constant, Vertex, Topology */
70 static const int Unassigned = -1;
71
73 // default slots:
74 _topology(2),
75 _instancePrimvar(Unassigned),
76 _constantPrimvar(0),
77 _vertexPrimvar(1),
78 _elementPrimvar(3),
79 _instanceIndex(4),
80 _faceVaryingPrimvar(5),
81 _topologyVisibility(6),
82 _varyingPrimvar(7) {
83 }
84
85 int GetConstantPrimvarIndex() const { return _constantPrimvar; }
86 void SetConstantPrimvarIndex(int slot) { _constantPrimvar = slot; }
87 int GetVertexPrimvarIndex() const { return _vertexPrimvar; }
88 void SetVertexPrimvarIndex(int slot) { _vertexPrimvar = slot; }
89 int GetTopologyIndex() const { return _topology; }
90 void SetTopologyIndex(int slot) { _topology = slot; }
91 int GetElementPrimvarIndex() const { return _elementPrimvar; }
92 void SetElementPrimvarIndex(int slot) { _elementPrimvar = slot; }
93 int GetInstanceIndexIndex() const { return _instanceIndex; }
94 void SetInstanceIndexIndex(int slot) { _instanceIndex = slot; }
95 int GetFaceVaryingPrimvarIndex() const { return _faceVaryingPrimvar; }
96 void SetFaceVaryingPrimvarIndex(int slot) { _faceVaryingPrimvar = slot; }
97 int GetTopologyVisibilityIndex() const { return _topologyVisibility; }
98 void SetTopologyVisibilityIndex(int slot) { _topologyVisibility = slot; }
99 int GetVaryingPrimvarIndex() const { return _varyingPrimvar; }
100 void SetVaryingPrimvarIndex(int slot) { _varyingPrimvar = slot; }
101
102 // instance primvars take up a range of slots.
103 void SetInstancePrimvarBaseIndex(int slot) { _instancePrimvar = slot; }
104 int GetInstancePrimvarIndex(int level) const {
105 TF_VERIFY(_instancePrimvar != Unassigned);
106 return _instancePrimvar + level;
107 }
108
109private:
110 int16_t _topology;
111 int16_t _instancePrimvar;
112 int8_t _constantPrimvar;
113 int8_t _vertexPrimvar;
114 int8_t _elementPrimvar;
115 int8_t _instanceIndex;
116 int8_t _faceVaryingPrimvar;
117 int8_t _topologyVisibility;
118 int8_t _varyingPrimvar;
119};
120
121
122PXR_NAMESPACE_CLOSE_SCOPE
123
124#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:66
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
Definition: diagnostic.h:266