HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_Blend.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GU_Blend.h (C++)
7  *
8  * COMMENTS: Functions for blending between details.
9  *
10  */
11 
12 
13  #ifndef __GU_BLEND_H__
14 #define __GU_BLEND_H__
15 
16 #include "GU_API.h"
17 #include <GA/GA_Names.h>
18 #include <GA/GA_Types.h>
19 #include <UT/UT_Array.h>
20 
21 class UT_StringRef;
22 class GU_Detail;
23 class GA_Attribute;
24 class GA_Group;
25 class GA_Range;
26 
27 enum class GU_VoxelBlend
28 {
29  None,
31  ByVoxelPos,
32  Advected
33 };
34 
35 enum class GU_MaskMode
36 {
37  None,
40 };
41 
42 namespace GU_Blend
43 {
45 {
50 };
51 
53 {
55  bool myHasIdAttribMapping = false;
56  bool myIdAttribDataIdIsSame = false;
57 };
58 
59 struct MaskData
60 {
63  int mySource;
64 };
65 
66 /// This cache can be used to accelerate successive blends. However,
67 /// it is all references to *external* data.
68 /// It also does *NOT* detect if the id attribute names change, so the
69 /// caller is expected to clear the cache in that case.
71 {
72 public:
82 };
83 }
84 
85 /// If deleteUnmatched is true, points that don't have a match to interpolate with are deleted.
86 /// If deleteUnmatched is false but unmatchedGroupName is given (non-NULL), then these points
87 /// are instead put into a point group of the specified name.
88 /// Note that points of volume and VDB primitives are neither deleted nor put into the group.
89 GU_API void GUblend(
90  GU_Detail *dest, const GU_Detail *source, fpreal weight,
91  const char *pattern = "*", const UT_StringRef &ptidattr = GA_Names::id, const UT_StringRef &primidattr = GA_Names::name,
92  bool doslerp = true, bool usevforpinterp = false, float timestep = (1/24.0),
93  GU_VoxelBlend dovoxel = GU_VoxelBlend::None, GU_Blend::CachedItems *cached_items = NULL, const char *velname = "vel",
94  float advdt = 1, bool deleteUnmatched = false, const char *unmatchedGroupName = NULL);
95 
96 /// If deleteUnmatched is non-zero, points that have fewer than that many interpolation sources
97 /// are deleted from the output (or put into the specified group if unmatchedGroupName is not
98 /// NULL).
99 /// NOTE: Advected volume interpolation is necessarily linear; in that case, volweight is needed to determine
100 /// which detail to blend with and by how much.
101 GU_API void GUblend(
102  GU_Detail *dest, const GU_Detail *gdps[], const float *weights, int size, const GA_Group *group,
103  const char *pattern = "*", const UT_StringRef &ptidattr = GA_Names::id, const UT_StringRef &primidattr = GA_Names::name,
104  bool doslerp = true, GU_VoxelBlend dovoxel = GU_VoxelBlend::None, GU_Blend::CachedItems *cached_items = NULL,
105  bool is_differencing = true, bool dosparse = false,
106  float timestep = (1/24.0), const char *velname = "vel", float advdt = 1, fpreal volweight = 0,
107  int deleteUnmatched = 0, const char *unmatchedGroupName = NULL,
108  const GU_Blend::MaskData * mask_data = NULL,
109  float total = 1);
110 
111 /// Blend the attribute values for the given range, with an optional mapping to
112 /// different offsets in the second detail.
113 /// If set, the weights and mapping arrays should be at least as long as attrib0's offset
114 /// map (attrib0.getIndexMap().offsetSize()).
115 /// @{
116 GU_API void GUblendRange(
117  GA_Attribute &attrib0,
118  const GA_Attribute &attrib1,
119  const GA_Range &range0,
120  float weight,
121  const UT_Array<GA_Offset> *mapping);
122 
123 GU_API void GUblendRange(
124  GA_Attribute &attrib0,
125  const GA_Attribute &attrib1,
126  const GA_Range &range0,
127  const UT_Array<float> &weights,
128  const UT_Array<GA_Offset> *mapping);
129 /// @}
130 
131 /// Calculate the blend weight for an in-between shape given the channel weight
132 /// and a list of all in-between weights
134  float channel_weight,
135  const UT_Array<float> &inbetween_weights,
136  int inbetween_idx);
137 #endif
UT_Array< GA_Offset > myArrayOfOffsets
Definition: GU_Blend.h:54
Definition of a geometry attribute.
Definition: GA_Attribute.h:198
UT_Array< PerAttribData > * myVertexArrayOfPerAttribData
Definition: GU_Blend.h:75
UT_Array< PerMappingData > * myPtArrayOfPerMappingData
Definition: GU_Blend.h:76
UT_Array< PerAttribData > * myPtArrayOfPerAttribData
Definition: GU_Blend.h:73
A range of elements in an index-map.
Definition: GA_Range.h:42
GA_API const UT_StringHolder name
UT_Array< UT_Array< int > > myArrayOfPageOffsets
Definition: GU_Blend.h:47
UT_Array< int64 > * myPrimListDataIds
Definition: GU_Blend.h:79
GU_API float GUgetInbetweenWeight(float channel_weight, const UT_Array< float > &inbetween_weights, int inbetween_idx)
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
UT_Array< UT_Array< std::pair< GA_PageNum, exint > > > myArrayOfPageStarts
Definition: GU_Blend.h:48
UT_Array< PerAttribData > * myPrimArrayOfPerAttribData
Definition: GU_Blend.h:74
GU_MaskMode myMode
Definition: GU_Blend.h:61
long long int64
Definition: SYS_Types.h:116
GU_MaskMode
Definition: GU_Blend.h:35
#define GU_API
Definition: GU_API.h:14
GLushort pattern
Definition: glad.h:2583
GA_API const UT_StringHolder id
GU_VoxelBlend
Definition: GU_Blend.h:27
UT_Array< int64 > * myPtTopoDataIds
Definition: GU_Blend.h:78
GU_API void GUblendRange(GA_Attribute &attrib0, const GA_Attribute &attrib1, const GA_Range &range0, float weight, const UT_Array< GA_Offset > *mapping)
GLsizeiptr size
Definition: glcorearb.h:664
int64 * myPtIdDataId
Definition: GU_Blend.h:80
UT_Array< int64 > myArrayOfDataId
Definition: GU_Blend.h:49
fpreal64 fpreal
Definition: SYS_Types.h:277
UT_StringRef myAttribName
Definition: GU_Blend.h:62
int64 * myPrimIdDataId
Definition: GU_Blend.h:81
UT_Array< UT_Array< float > > myArrayOfDeltas
Definition: GU_Blend.h:46
GU_API void GUblend(GU_Detail *dest, const GU_Detail *source, fpreal weight, const char *pattern="*", const UT_StringRef &ptidattr=GA_Names::id, const UT_StringRef &primidattr=GA_Names::name, bool doslerp=true, bool usevforpinterp=false, float timestep=(1/24.0), GU_VoxelBlend dovoxel=GU_VoxelBlend::None, GU_Blend::CachedItems *cached_items=NULL, const char *velname="vel", float advdt=1, bool deleteUnmatched=false, const char *unmatchedGroupName=NULL)
UT_Array< PerMappingData > * myPrimArrayOfPerMappingData
Definition: GU_Blend.h:77