OpenSubdiv
Toggle main menu visibility
Loading...
Searching...
No Matches
fvarRefinement.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_FVAR_REFINEMENT_H
8
#define OPENSUBDIV3_VTR_FVAR_REFINEMENT_H
9
10
#include "../version.h"
11
12
#include "
../sdc/types.h
"
13
#include "
../sdc/crease.h
"
14
#include "
../vtr/types.h
"
15
#include "
../vtr/refinement.h
"
16
#include "
../vtr/fvarLevel.h
"
17
18
#include <vector>
19
#include <cassert>
20
#include <cstring>
21
22
23
namespace
OpenSubdiv
{
24
namespace
OPENSUBDIV_VERSION
{
25
26
namespace
Vtr
{
27
namespace
internal {
28
29
//
30
// FVarRefinement:
31
// A face-varying refinement contains data to support the refinement of a
32
// particular face-varying "channel". Just as Refinement maintains a mapping
33
// between the components of a parent Level and its child, the face-varying
34
// analog maintains a mapping between the face-varying values of a parent
35
// FVarLevel and its child.
36
//
37
// It turns out there is little data necessary here, so the class consists
38
// mainly of methods that populate the child FVarLevel. The mapping data in
39
// the refinement between Levels serves most purposes and all that is required
40
// in addition is a mapping from values in the child FVarLevel to the parent.
41
//
42
class
FVarRefinement {
43
public
:
44
FVarRefinement(Refinement
const
& refinement, FVarLevel& parent, FVarLevel& child);
45
~FVarRefinement();
46
47
int
getChildValueParentSource(
Index
vIndex,
int
sibling)
const
{
48
return
_childValueParentSource[_childFVar.getVertexValueOffset(vIndex, (
LocalIndex
)sibling)];
49
}
50
51
float
getFractionalWeight(
Index
pVert,
LocalIndex
pSibling,
52
Index
cVert,
LocalIndex
cSibling)
const
;
53
54
55
// Modifiers supporting application of the refinement:
56
void
applyRefinement();
57
58
void
estimateAndAllocateChildValues();
59
void
populateChildValues();
60
void
populateChildValuesFromFaceVertices();
61
void
populateChildValuesFromEdgeVertices();
62
int
populateChildValuesForEdgeVertex(
Index
cVert,
Index
pEdge);
63
void
populateChildValuesFromVertexVertices();
64
int
populateChildValuesForVertexVertex(
Index
cVert,
Index
pVert);
65
void
trimAndFinalizeChildValues();
66
67
void
propagateEdgeTags();
68
void
propagateValueTags();
69
void
propagateValueCreases();
70
void
reclassifySemisharpValues();
71
72
private
:
73
//
74
// Identify the Refinement, its Levels and assigned FVarLevels for more
75
// immediate access -- child FVarLevel is non-const as it is to be assigned:
76
//
77
Refinement
const
& _refinement;
78
79
Level
const
& _parentLevel;
80
FVarLevel
const
& _parentFVar;
81
82
Level
const
& _childLevel;
83
FVarLevel & _childFVar;
84
85
// When refinement is sparse, we need a mapping between siblings of a vertex
86
// value in the parent and child -- and for some child values, there will not
87
// be a parent value, in which case the source of the parent component will
88
// be stored. So we refer to the parent "source" rather than "sibling":
89
//
90
std::vector<LocalIndex> _childValueParentSource;
91
};
92
93
}
// end namespace internal
94
}
// end namespace Vtr
95
96
}
// end namespace OPENSUBDIV_VERSION
97
using namespace
OPENSUBDIV_VERSION
;
98
}
// end namespace OpenSubdiv
99
100
#endif
/* OPENSUBDIV3_VTR_FVAR_REFINEMENT_H */
refinement.h
fvarLevel.h
crease.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::Index
int Index
Definition
types.h:37
OpenSubdiv::OPENSUBDIV_VERSION::Vtr::LocalIndex
unsigned short LocalIndex
Definition
types.h:49
types.h
types.h
opensubdiv
vtr
fvarRefinement.h
Generated on
for OpenSubdiv by
1.18.0