OpenSubdiv
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
14namespace OpenSubdiv {
15namespace OPENSUBDIV_VERSION {
16
17namespace Sdc {
18
19//
20// Specializations for Scheme<SCHEME_BILINEAR>:
21//
22
23//
24// Bilinear traits:
25//
26template <>
28
29template <>
31
32template <>
34
35template <>
37
38
39//
40// Refinement masks:
41//
42template <>
43template <typename EDGE, typename MASK>
44void
47 // This should be inline, otherwise trivially replicate it:
48 assignCreaseMaskForEdge(edge, mask);
49}
50
51template <>
52template <typename VERTEX, typename MASK>
53void
54Scheme<SCHEME_BILINEAR>::ComputeVertexVertexMask(VERTEX const& vertex, MASK& mask,
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//
64template <>
65template <typename VERTEX, typename MASK>
66inline void
67Scheme<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
77template <>
78template <typename VERTEX, typename MASK>
79inline void
80Scheme<SCHEME_BILINEAR>::assignCreaseLimitMask(VERTEX const& vertex, MASK& posMask,
81 int const /* creaseEnds */[2]) const {
82
83 assignCornerLimitMask(vertex, posMask);
84}
85
86template <>
87template <typename VERTEX, typename MASK>
88inline void
89Scheme<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//
98template <>
99template <typename VERTEX, typename MASK>
100inline void
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
123template <>
124template <typename VERTEX, typename MASK>
125inline void
127 MASK& tan1Mask, MASK& tan2Mask, int const /* creaseEnds */[2]) const {
128
129 assignCornerLimitTangentMasks(vertex, tan1Mask, tan2Mask);
130}
131
132template <>
133template <typename VERTEX, typename MASK>
134inline void
136 MASK& tan1Mask, MASK& tan2Mask) const {
137
138 assignCornerLimitTangentMasks(vertex, tan1Mask, tan2Mask);
139}
140
141} // end namespace sdc
142
143} // end namespace OPENSUBDIV_VERSION
144using namespace OPENSUBDIV_VERSION;
145} // end namespace OpenSubdiv
146
147#endif /* OPENSUBDIV3_SDC_BILINEAR_SCHEME_H */
Split
Enumerated type for all face splitting schemes.
Definition types.h:30
@ SPLIT_TO_QUADS
Used by Catmark and Bilinear.
Definition types.h:31
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
void assignCreaseLimitTangentMasks(VERTEX const &vertex, MASK &tan1, MASK &tan2, int const creaseEnds[2]) const
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
void assignSmoothLimitMask(VERTEX const &vertex, MASK &pos) const
void assignCreaseLimitMask(VERTEX const &vertex, MASK &pos, int const creaseEnds[2]) const
void assignSmoothLimitTangentMasks(VERTEX const &vertex, MASK &tan1, MASK &tan2) const
void assignCornerLimitMask(VERTEX const &vertex, MASK &pos) const
void assignCornerLimitTangentMasks(VERTEX const &vertex, MASK &tan1, MASK &tan2) const