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 
20 class UT_StringRef;
21 class GU_Detail;
22 class GA_Attribute;
23 class GA_Group;
24 class GA_Range;
25 
26 enum class GU_VoxelBlend
27 {
28  None,
30  ByVoxelPos,
31  Advected
32 };
33 
34 enum class GU_MaskMode
35 {
36  None,
39 };
40 
41 namespace GU_Blend
42 {
44 {
49 };
50 
52 {
54  bool myHasIdAttribMapping = false;
55  bool myIdAttribDataIdIsSame = false;
56 };
57 
58 struct MaskData
59 {
62  int mySource;
63 };
64 
65 /// This cache can be used to accelerate successive blends. However,
66 /// it is all references to *external* data.
67 /// It also does *NOT* detect if the id attribute names change, so the
68 /// caller is expected to clear the cache in that case.
70 {
71 public:
81 };
82 }
83 
84 /// If deleteUnmatched is true, points that don't have a match to interpolate with are deleted.
85 /// If deleteUnmatched is false but unmatchedGroupName is given (non-NULL), then these points
86 /// are instead put into a point group of the specified name.
87 /// Note that points of volume and VDB primitives are neither deleted nor put into the group.
88 GU_API void GUblend(
89  GU_Detail *dest, const GU_Detail *source, fpreal weight,
90  const char *pattern = "*", const UT_StringRef &ptidattr = GA_Names::id, const UT_StringRef &primidattr = GA_Names::name,
91  bool doslerp = true, bool usevforpinterp = false, float timestep = (1/24.0),
92  GU_VoxelBlend dovoxel = GU_VoxelBlend::None, GU_Blend::CachedItems *cached_items = NULL, const char *velname = "vel",
93  float advdt = 1, bool deleteUnmatched = false, const char *unmatchedGroupName = NULL);
94 
95 /// If deleteUnmatched is non-zero, points that have fewer than that many interpolation sources
96 /// are deleted from the output (or put into the specified group if unmatchedGroupName is not
97 /// NULL).
98 /// NOTE: Advected volume interpolation is necessarily linear; in that case, volweight is needed to determine
99 /// which detail to blend with and by how much.
100 GU_API void GUblend(
101  GU_Detail *dest, const GU_Detail *gdps[], const float *weights, int size, const GA_Group *group,
102  const char *pattern = "*", const UT_StringRef &ptidattr = GA_Names::id, const UT_StringRef &primidattr = GA_Names::name,
103  bool doslerp = true, GU_VoxelBlend dovoxel = GU_VoxelBlend::None, GU_Blend::CachedItems *cached_items = NULL,
104  bool is_differencing = true, bool dosparse = false,
105  float timestep = (1/24.0), const char *velname = "vel", float advdt = 1, fpreal volweight = 0,
106  int deleteUnmatched = 0, const char *unmatchedGroupName = NULL,
107  const GU_Blend::MaskData * mask_data = NULL,
108  float total = 1);
109 
110 /// Blend the attribute values for the given range, with an optional mapping to
111 /// different offsets in the second detail.
112 GU_API void GUblendRange(
113  GA_Attribute &attrib0,
114  const GA_Attribute &attrib1,
115  const GA_Range &range0,
116  float weight,
118 
119 /// Calculate the blend weight for an in-between shape given the channel weight
120 /// and a list of all in-between weights
122  float channel_weight,
123  const UT_Array<float> &inbetween_weights,
124  int inbetween_idx);
125 #endif
UT_Array< GA_Offset > myArrayOfOffsets
Definition: GU_Blend.h:53
Definition of a geometry attribute.
Definition: GA_Attribute.h:197
UT_Array< PerAttribData > * myVertexArrayOfPerAttribData
Definition: GU_Blend.h:74
UT_Array< PerMappingData > * myPtArrayOfPerMappingData
Definition: GU_Blend.h:75
UT_Array< PerAttribData > * myPtArrayOfPerAttribData
Definition: GU_Blend.h:72
GLuint GLuint GLfloat weight
Definition: glew.h:13892
A range of elements in an index-map.
Definition: GA_Range.h:42
GLsizeiptr size
Definition: glcorearb.h:664
GA_API const UT_StringHolder name
UT_Array< UT_Array< int > > myArrayOfPageOffsets
Definition: GU_Blend.h:46
UT_Array< int64 > * myPrimListDataIds
Definition: GU_Blend.h:78
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:47
UT_Array< PerAttribData > * myPrimArrayOfPerAttribData
Definition: GU_Blend.h:73
GU_MaskMode myMode
Definition: GU_Blend.h:60
long long int64
Definition: SYS_Types.h:116
GU_MaskMode
Definition: GU_Blend.h:34
#define GU_API
Definition: GU_API.h:14
GLenum GLenum GLenum GLenum mapping
Definition: glew.h:14162
GA_API const UT_StringHolder id
GU_VoxelBlend
Definition: GU_Blend.h:26
UT_Array< int64 > * myPtTopoDataIds
Definition: GU_Blend.h:77
GU_API void GUblendRange(GA_Attribute &attrib0, const GA_Attribute &attrib1, const GA_Range &range0, float weight, const UT_Array< GA_Offset > *mapping)
GLubyte * pattern
Definition: glew.h:5741
int64 * myPtIdDataId
Definition: GU_Blend.h:79
UT_Array< int64 > myArrayOfDataId
Definition: GU_Blend.h:48
fpreal64 fpreal
Definition: SYS_Types.h:277
GLbyte * weights
Definition: glew.h:7581
UT_StringRef myAttribName
Definition: GU_Blend.h:61
GLboolean GLuint group
Definition: glew.h:2750
int64 * myPrimIdDataId
Definition: GU_Blend.h:80
UT_Array< UT_Array< float > > myArrayOfDeltas
Definition: GU_Blend.h:45
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:76