12 #ifndef __GA_ElementWrangler__
13 #define __GA_ElementWrangler__
45 { myCache = UTmakeUnique<GA_AttributeRefMap::Cache>(); }
51 myMap.copyValue(myOwner, dest, myOwner, src,
57 myMap.multiply(myOwner, dest, scale);
62 myMap.addValue(myOwner, dest, myOwner, src,
scale);
67 myMap.lerpValue(myOwner, dest, myOwner, src0, src1, bias);
72 return myMap.getDestDetail() == &dest &&
73 myMap.getSourceDetail() == &dest;
77 return myMap.getDestDetail() == &dest &&
78 myMap.getSourceDetail() == &
src;
81 {
return myMap.entries(); }
84 myMap.bumpAllDestDataIds();
111 GA_AttributeRefMap::Cache *
cache() {
return myCache.get(); }
138 delete myAlternateMap;
141 bool includesP()
const {
return myBaseIncludeP == INCLUDE_P; }
151 if (copy_p == myBaseIncludeP)
155 initAlternateHandle();
156 myAlternateMap->copyValue(
165 if (scale_p == myBaseIncludeP)
169 initAlternateHandle();
170 myAlternateMap->multiply(
177 if (add_p == myBaseIncludeP)
181 initAlternateHandle();
182 myAlternateMap->addValue(
191 if (lerp_p == myBaseIncludeP)
195 initAlternateHandle();
196 myAlternateMap->lerpValue(
202 void initAlternateHandle()
205 allocAlternateHandle();
207 void allocAlternateHandle();
212 IncludeP myBaseIncludeP;
270 : myDestGdp(&dest), mySrcGdp(&dest), myPrimitiveWrangler(nullptr),
271 myVertexWrangler(nullptr), myPointWrangler(nullptr),
272 myIncludeP(include_p) {}
275 : myDestGdp(&dest), mySrcGdp(&src), myPrimitiveWrangler(nullptr),
276 myVertexWrangler(nullptr), myPointWrangler(nullptr),
277 myIncludeP(include_p) {}
281 : myDestGdp(&dest), mySrcGdp(&dest), myPrimitiveWrangler(nullptr),
282 myVertexWrangler(nullptr), myPointWrangler(nullptr),
286 : myDestGdp(&dest), mySrcGdp(&src), myPrimitiveWrangler(nullptr),
287 myVertexWrangler(nullptr), myPointWrangler(nullptr),
292 if (myPrimitiveWrangler)
293 delete myPrimitiveWrangler;
294 if (myVertexWrangler)
295 delete myVertexWrangler;
297 delete myPointWrangler;
302 if (myPrimitiveWrangler)
304 delete myPrimitiveWrangler;
305 myPrimitiveWrangler =
nullptr;
307 if (myVertexWrangler)
309 delete myVertexWrangler;
310 myVertexWrangler =
nullptr;
314 delete myPointWrangler;
315 myPointWrangler =
nullptr;
333 return myDestGdp == &dest &&
339 return myDestGdp == &dest &&
345 if (!myPrimitiveWrangler)
347 if (myFilter.isValid())
355 return *myPrimitiveWrangler;
359 if (!myVertexWrangler)
361 if (myFilter.isValid())
369 return *myVertexWrangler;
373 if (!myPointWrangler)
375 if (myFilter.isValid())
382 return *myPointWrangler;
GA_DetailWrangler(GA_Detail &dest, const GA_Detail &src, const GA_AttributeFilter &filter)
void scaleAttributeValues(GA_Offset dest, fpreal scale)
GA_VertexWrangler & getVertex()
void addAttributeValues(GA_Offset dest, GA_Offset src, fpreal scale, IncludeP add_p)
Definition of a geometry attribute.
void copyAttributeValues(GA_Offset dest, GA_Offset src)
GA_PrimitiveWrangler(GA_Detail &dest, const GA_Detail &src, const GA_AttributeFilter &filter)
GA_DetailWrangler(GA_Detail &dest)
void addAttributeValues(GA_Offset dest, GA_Offset src, fpreal scale=1)
GA_ElementWranglerCache(GA_Detail &dest, const GA_AttributeFilter &filter)
bool isValid(GA_Detail &dest, const GA_Detail &src) const
~GA_ElementWrangler()
Protected destructor as we don't support polymorphic destruction.
bool isValid(GA_Detail &dest) const
A utility class to amortize overhead from GA_GBElement attribute handling methods.
GA_ElementWranglerCache(GA_Detail &dest, const GA_Detail &src, const GA_AttributeFilter &filter)
GA_VertexWrangler(GA_Detail &dest)
#define GA_INVALID_OFFSET
void reset(GA_Detail &dest)
A range of elements in an index-map.
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
GA_API const UT_StringHolder scale
GA_DetailWrangler(GA_Detail &dest, const GA_AttributeFilter &filter)
GA_DetailWrangler(GA_Detail &dest, const GA_Detail &src)
GA_AttributeRefMap::Cache * cache()
void lerpAttributeValues(GA_Offset dest, GA_Offset src0, GA_Offset src1, fpreal bias, IncludeP lerp_p)
void reset(GA_Detail &dest, const GA_Detail &src)
GA_ElementWranglerCache(GA_Detail &dest, GA_PointWrangler::IncludeP include_p)
A handle to simplify manipulation of multiple attributes.
bool isValid(const GA_Detail &dest, const GA_Detail &src) const
GA_VertexWrangler(GA_Detail &dest, const GA_Detail &src)
GA_PointWrangler & getPoint()
GA_PrimitiveWrangler(GA_Detail &dest, const GA_Detail &src)
GA_VertexWrangler(GA_Detail &dest, const GA_Detail &src, const GA_AttributeFilter &filter)
GA_ElementWranglerCache(GA_Detail &dest, const GA_Detail &src, GA_PointWrangler::IncludeP include_p)
GA_AttributeRefMap & getMap()
void scaleAttributeValues(GA_Offset dest, fpreal scale, IncludeP scale_p)
GA_PrimitiveWrangler(GA_Detail &dest)
void lerpAttributeValues(GA_Offset dest, GA_Offset src0, GA_Offset src1, fpreal bias)
~GA_ElementWranglerCache()
void bumpAllDestDataIds()
GA_VertexWrangler(GA_Detail &dest, const GA_AttributeFilter &filter)
Container class for all geometry.
void copyAttributeValues(GA_Offset dest, GA_Offset src, IncludeP copy_p)
GA_PrimitiveWrangler(GA_Detail &dest, const GA_AttributeFilter &filter)
GA_PrimitiveWrangler & getPrimitive()
int getNumAttributes() const
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
bool isValid(const GA_Detail &dest) const