All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fvarRefinement.h
Go to the documentation of this file.
1 //
2 // Copyright 2014 DreamWorks Animation LLC.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef VTR_FVAR_REFINEMENT_H
25 #define VTR_FVAR_REFINEMENT_H
26 
27 #include "../version.h"
28 
29 #include "../sdc/type.h"
30 #include "../sdc/crease.h"
31 #include "../vtr/types.h"
32 #include "../vtr/refinement.h"
33 #include "../vtr/fvarLevel.h"
34 
35 #include <vector>
36 #include <cassert>
37 #include <cstring>
38 
39 
40 namespace OpenSubdiv {
41 namespace OPENSUBDIV_VERSION {
42 
43 //
44 // Forward declaration of friend classes:
45 //
46 namespace Far {
47  class TopologyRefiner;
48 }
49 
50 //
51 // FVarRefinement:
52 // A face-varying refinement contains data to support the refinement of a
53 // particular face-varying "channel". Just as Refinement maintains a mapping
54 // between the components of a parent Level and its child, the face-varying
55 // analog maintains a mapping between the face-varying values of a parent
56 // FVarLevel and its child.
57 //
58 // It turns out there is little data necessary here, so the class consists
59 // mainly of methods that populate the child FVarLevel. The mapping data in
60 // the refinement between Levels serves most purposes and all that is required
61 // in addition is a mapping from values in the child FVarLevel to the parent.
62 //
63 namespace Vtr {
64 
66 protected:
67  friend class Refinement;
68  friend class Far::TopologyRefiner;
69 
70 protected:
71  FVarRefinement(Refinement const& refinement, FVarLevel& parent, FVarLevel& child);
73 
74  int getChildValueParentSource(Index vIndex, int sibling) const {
76  }
77 
78  float getFractionalWeight(Index pVert, LocalIndex pSibling,
79  Index cVert, LocalIndex cSibling) const;
80 
81 
82  // Modifiers supporting application of the refinement:
83  void applyRefinement();
84 
86  void populateChildValues();
93 
94  void propagateEdgeTags();
95  void propagateValueTags();
96  void propagateValueCreases();
98 
99 protected:
100  //
101  // Identify the Refinement, its Levels and assigned FVarLevels for more
102  // immediate access -- child FVarLevel is non-const as it is to be assigned:
103  //
105 
108 
111 
112  // When refinement is sparse, we need a mapping between siblings of a vertex
113  // value in the parent and child -- and for some child values, there will not
114  // be a parent value, in which case the source of the parent component will
115  // be stored. So we refer to the parent "source" rather than "sibling":
116  //
117  std::vector<LocalIndex> _childValueParentSource;
118 };
119 
120 } // end namespace Vtr
121 
122 } // end namespace OPENSUBDIV_VERSION
123 using namespace OPENSUBDIV_VERSION;
124 } // end namespace OpenSubdiv
125 
126 #endif /* VTR_FVAR_REFINEMENT_H */
127 
FVarRefinement(Refinement const &refinement, FVarLevel &parent, FVarLevel &child)
Index getVertexValueOffset(Index v, Sibling i=0) const
Definition: fvarLevel.h:177
float getFractionalWeight(Index pVert, LocalIndex pSibling, Index cVert, LocalIndex cSibling) const
Stores topology data for a specified set of refinement options.
int populateChildValuesForVertexVertex(Index cVert, Index pVert)
int populateChildValuesForEdgeVertex(Index cVert, Index pEdge)
int getChildValueParentSource(Index vIndex, int sibling) const