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