OpenSubdiv
Toggle main menu visibility
Loading...
Searching...
No Matches
bilinearScheme.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_SDC_BILINEAR_SCHEME_H
8
#define OPENSUBDIV3_SDC_BILINEAR_SCHEME_H
9
10
#include "../version.h"
11
12
#include "
../sdc/scheme.h
"
13
14
namespace
OpenSubdiv
{
15
namespace
OPENSUBDIV_VERSION
{
16
17
namespace
Sdc
{
18
19
//
20
// Specializations for Scheme<SCHEME_BILINEAR>:
21
//
22
23
//
24
// Bilinear traits:
25
//
26
template
<>
27
inline
Split
Scheme<SCHEME_BILINEAR>::GetTopologicalSplitType
() {
return
SPLIT_TO_QUADS
; }
28
29
template
<>
30
inline
int
Scheme<SCHEME_BILINEAR>::GetRegularFaceSize
() {
return
4; }
31
32
template
<>
33
inline
int
Scheme<SCHEME_BILINEAR>::GetRegularVertexValence
() {
return
4; }
34
35
template
<>
36
inline
int
Scheme<SCHEME_BILINEAR>::GetLocalNeighborhoodSize
() {
return
0; }
37
38
39
//
40
// Refinement masks:
41
//
42
template
<>
43
template
<
typename
EDGE,
typename
MASK>
44
void
45
Scheme<SCHEME_BILINEAR>::ComputeEdgeVertexMask
(EDGE
const
& edge, MASK& mask,
46
Crease::Rule
,
Crease::Rule
)
const
{
47
// This should be inline, otherwise trivially replicate it:
48
assignCreaseMaskForEdge
(edge, mask);
49
}
50
51
template
<>
52
template
<
typename
VERTEX,
typename
MASK>
53
void
54
Scheme<SCHEME_BILINEAR>::ComputeVertexVertexMask
(VERTEX
const
& vertex, MASK& mask,
55
Crease::Rule
,
Crease::Rule
)
const
{
56
// This should be inline, otherwise trivially replicate it:
57
assignCornerMaskForVertex
(vertex, mask);
58
}
59
60
61
//
62
// Limit masks for position -- the limit position of all vertices is the refined vertex.
63
//
64
template
<>
65
template
<
typename
VERTEX,
typename
MASK>
66
inline
void
67
Scheme<SCHEME_BILINEAR>::assignCornerLimitMask
(VERTEX
const
&
/* vertex */
, MASK& posMask)
const
{
68
69
posMask.SetNumVertexWeights(1);
70
posMask.SetNumEdgeWeights(0);
71
posMask.SetNumFaceWeights(0);
72
posMask.SetFaceWeightsForFaceCenters(
false
);
73
74
posMask.VertexWeight(0) = 1.0f;
75
}
76
77
template
<>
78
template
<
typename
VERTEX,
typename
MASK>
79
inline
void
80
Scheme<SCHEME_BILINEAR>::assignCreaseLimitMask
(VERTEX
const
& vertex, MASK& posMask,
81
int
const
/* creaseEnds */
[2])
const
{
82
83
assignCornerLimitMask
(vertex, posMask);
84
}
85
86
template
<>
87
template
<
typename
VERTEX,
typename
MASK>
88
inline
void
89
Scheme<SCHEME_BILINEAR>::assignSmoothLimitMask
(VERTEX
const
& vertex, MASK& posMask)
const
{
90
91
assignCornerLimitMask
(vertex, posMask);
92
}
93
94
//
95
// Limit masks for tangents -- these are ambiguous around all vertices. Provide
96
// the tangents based on the incident edges of the first face.
97
//
98
template
<>
99
template
<
typename
VERTEX,
typename
MASK>
100
inline
void
101
Scheme<SCHEME_BILINEAR>::assignCornerLimitTangentMasks
(VERTEX
const
&
/* vertex */
,
102
MASK& tan1Mask, MASK& tan2Mask)
const
{
103
104
tan1Mask.SetNumVertexWeights(1);
105
tan1Mask.SetNumEdgeWeights(2);
106
tan1Mask.SetNumFaceWeights(0);
107
tan1Mask.SetFaceWeightsForFaceCenters(
false
);
108
109
tan2Mask.SetNumVertexWeights(1);
110
tan2Mask.SetNumEdgeWeights(2);
111
tan2Mask.SetNumFaceWeights(0);
112
tan2Mask.SetFaceWeightsForFaceCenters(
false
);
113
114
tan1Mask.VertexWeight(0) = -1.0f;
115
tan1Mask.EdgeWeight(0) = 1.0f;
116
tan1Mask.EdgeWeight(1) = 0.0f;
117
118
tan2Mask.VertexWeight(0) = -1.0f;
119
tan2Mask.EdgeWeight(0) = 0.0f;
120
tan2Mask.EdgeWeight(1) = 1.0f;
121
}
122
123
template
<>
124
template
<
typename
VERTEX,
typename
MASK>
125
inline
void
126
Scheme<SCHEME_BILINEAR>::assignCreaseLimitTangentMasks
(VERTEX
const
& vertex,
127
MASK& tan1Mask, MASK& tan2Mask,
int
const
/* creaseEnds */
[2])
const
{
128
129
assignCornerLimitTangentMasks
(vertex, tan1Mask, tan2Mask);
130
}
131
132
template
<>
133
template
<
typename
VERTEX,
typename
MASK>
134
inline
void
135
Scheme<SCHEME_BILINEAR>::assignSmoothLimitTangentMasks
(VERTEX
const
& vertex,
136
MASK& tan1Mask, MASK& tan2Mask)
const
{
137
138
assignCornerLimitTangentMasks
(vertex, tan1Mask, tan2Mask);
139
}
140
141
}
// end namespace sdc
142
143
}
// end namespace OPENSUBDIV_VERSION
144
using namespace
OPENSUBDIV_VERSION
;
145
}
// end namespace OpenSubdiv
146
147
#endif
/* OPENSUBDIV3_SDC_BILINEAR_SCHEME_H */
scheme.h
OpenSubdiv
Definition
limits.h:15
OpenSubdiv::OPENSUBDIV_VERSION
Definition
limits.h:16
OpenSubdiv::OPENSUBDIV_VERSION::Sdc
Definition
bilinearScheme.h:17
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Split
Split
Enumerated type for all face splitting schemes.
Definition
types.h:30
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::SPLIT_TO_QUADS
@ SPLIT_TO_QUADS
Used by Catmark and Bilinear.
Definition
types.h:31
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Crease::Rule
Rule
Definition
crease.h:65
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::GetTopologicalSplitType
static Split GetTopologicalSplitType()
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::ComputeVertexVertexMask
void ComputeVertexVertexMask(VERTEX const &vertexNeighborhood, MASK &vertexVertexMask, Crease::Rule parentRule=Crease::RULE_UNKNOWN, Crease::Rule childRule=Crease::RULE_UNKNOWN) const
Vertex-vertex masks If known, a single Rule or pair of Rules can be specified (indicating a crease tr...
Definition
scheme.h:495
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::assignCreaseLimitTangentMasks
void assignCreaseLimitTangentMasks(VERTEX const &vertex, MASK &tan1, MASK &tan2, int const creaseEnds[2]) const
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::GetRegularFaceSize
static int GetRegularFaceSize()
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::assignCreaseMaskForEdge
void assignCreaseMaskForEdge(EDGE const &edge, MASK &mask) const
Definition
scheme.h:300
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::ComputeEdgeVertexMask
void ComputeEdgeVertexMask(EDGE const &edgeNeighborhood, MASK &edgeVertexMask, Crease::Rule parentRule=Crease::RULE_UNKNOWN, Crease::Rule childRule=Crease::RULE_UNKNOWN) const
Edge-vertex masks If known, the Rule for the edge and/or the derived vertex can be specified to accel...
Definition
scheme.h:375
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::assignSmoothLimitMask
void assignSmoothLimitMask(VERTEX const &vertex, MASK &pos) const
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::GetLocalNeighborhoodSize
static int GetLocalNeighborhoodSize()
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::assignCornerMaskForVertex
void assignCornerMaskForVertex(VERTEX const &edge, MASK &mask) const
Definition
scheme.h:314
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::assignCreaseLimitMask
void assignCreaseLimitMask(VERTEX const &vertex, MASK &pos, int const creaseEnds[2]) const
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::GetRegularVertexValence
static int GetRegularVertexValence()
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::assignSmoothLimitTangentMasks
void assignSmoothLimitTangentMasks(VERTEX const &vertex, MASK &tan1, MASK &tan2) const
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::assignCornerLimitMask
void assignCornerLimitMask(VERTEX const &vertex, MASK &pos) const
OpenSubdiv::OPENSUBDIV_VERSION::Sdc::Scheme::assignCornerLimitTangentMasks
void assignCornerLimitTangentMasks(VERTEX const &vertex, MASK &tan1, MASK &tan2) const
opensubdiv
sdc
bilinearScheme.h
Generated on
for OpenSubdiv by
1.18.0