OpenSubdiv
Toggle main menu visibility
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1
//
2
// Copyright 2014 DreamWorks Animation LLC.
3
//
4
// Licensed under the terms set forth in the LICENSE.txt file available at
5
// https://opensubdiv.org/license.
6
//
7
#ifndef OPENSUBDIV3_VTR_TYPES_H
8
#define OPENSUBDIV3_VTR_TYPES_H
9
10
#include "../version.h"
11
12
#include "
../vtr/array.h
"
13
14
#include <limits>
15
#include <vector>
16
17
namespace
OpenSubdiv
{
18
namespace
OPENSUBDIV_VERSION
{
19
20
namespace
Vtr
{
21
22
//
23
// A few types (and constants) for use within Vtr and potentially by its
24
// clients (appropriately exported and retyped)
25
//
26
27
//
28
// Integer type and constants to index the vectors of components. Note that we
29
// can't use specific width integer types like uint32_t, etc. as use of stdint
30
// is not portable.
31
//
32
// The convention throughout the OpenSubdiv code is to use "int" in most places,
33
// with "unsigned int" being limited to a few cases (why?). So we continue that
34
// trend here and use "int" for topological indices (with -1 indicating "invalid")
35
// despite the fact that we lose half the range compared to using "uint" (with ~0
36
// as invalid).
37
//
38
typedef
int
Index
;
39
40
inline
Index
constexpr
INDEX_INVALID
= -1;
41
42
inline
bool
IndexIsValid
(
Index
index) {
return
(index !=
INDEX_INVALID
); }
43
44
//
45
// Integer type and constants used to index one component within another. Ideally
46
// this is just 2 bits once refinement reduces faces to tris or quads -- and so
47
// could potentially be combined with an Index -- but we need something larger for
48
// the N-sided face.
49
//
50
typedef
unsigned
short
LocalIndex
;
51
52
// Declared as "int" since it's intended for more general use
53
inline
int
constexpr
VALENCE_LIMIT
= std::numeric_limits<LocalIndex>::max();
54
55
//
56
// Collections of integer types in variable or fixed sized arrays. Note that the use
57
// of "vector" in the name indicates a class that wraps an std::vector (typically a
58
// member variable) which is fully resizable and owns its own storage, whereas "array"
59
// wraps a vtr::Array which uses a fixed block of pre-allocated memory.
60
//
61
typedef
std::vector<Index>
IndexVector
;
62
63
typedef
Array<Index>
IndexArray
;
64
typedef
ConstArray<Index>
ConstIndexArray
;
65
66
typedef
Array<LocalIndex>
LocalIndexArray
;
67
typedef
ConstArray<LocalIndex>
ConstLocalIndexArray
;
68
69
70
}
// end namespace Vtr
71
72
}
// end namespace OPENSUBDIV_VERSION
73
using namespace
OPENSUBDIV_VERSION
;
74
}
// end namespace OpenSubdiv
75
76
#endif
/* OPENSUBDIV3_VTR_TYPES_H */
array.h
OpenSubdiv
Definition
limits.h:15
OpenSubdiv::OPENSUBDIV_VERSION
Definition
limits.h:16
OpenSubdiv::OPENSUBDIV_VERSION::Vtr
Definition
topologyRefiner.h:23
OpenSubdiv::OPENSUBDIV_VERSION::Vtr::ConstLocalIndexArray
ConstArray< LocalIndex > ConstLocalIndexArray
Definition
types.h:67
OpenSubdiv::OPENSUBDIV_VERSION::Vtr::LocalIndexArray
Array< LocalIndex > LocalIndexArray
Definition
types.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Vtr::INDEX_INVALID
Index constexpr INDEX_INVALID
Definition
types.h:40
OpenSubdiv::OPENSUBDIV_VERSION::Vtr::Index
int Index
Definition
types.h:38
OpenSubdiv::OPENSUBDIV_VERSION::Vtr::IndexVector
std::vector< Index > IndexVector
Definition
types.h:61
OpenSubdiv::OPENSUBDIV_VERSION::Vtr::ConstIndexArray
ConstArray< Index > ConstIndexArray
Definition
types.h:64
OpenSubdiv::OPENSUBDIV_VERSION::Vtr::LocalIndex
unsigned short LocalIndex
Definition
types.h:50
OpenSubdiv::OPENSUBDIV_VERSION::Vtr::IndexIsValid
bool IndexIsValid(Index index)
Definition
types.h:42
OpenSubdiv::OPENSUBDIV_VERSION::Vtr::IndexArray
Array< Index > IndexArray
Definition
types.h:63
OpenSubdiv::OPENSUBDIV_VERSION::Vtr::VALENCE_LIMIT
int constexpr VALENCE_LIMIT
Definition
types.h:53
OpenSubdiv::OPENSUBDIV_VERSION::Vtr::ConstArray
Definition
array.h:36
OpenSubdiv::OPENSUBDIV_VERSION::Vtr::Array
Definition
array.h:88
opensubdiv
vtr
types.h
Generated by
1.18.0