12 #ifndef __SOP_ParmOverride_h__
13 #define __SOP_ParmOverride_h__
24 #include <type_traits>
100 myNumPoints = shaftdim;
101 myNumBarbPoints = barbdim;
102 myData.setSize(shaftdim * barbdim);
114 myNumPoints = shaftdim;
115 myNumBarbPoints = barbdim;
116 myData.bumpSize(shaftdim * barbdim);
119 template<
typename FIRSTOV>
126 shaftdim = first.getShaftDim();
127 barbdim = first.getBarbDim();
131 template<
typename FIRSTOV,
typename... OV>
139 exint current_shaft, current_barb, rest_shaft, rest_barb;
141 getMaxDim(current_shaft, current_barb, first);
142 getMaxDim(rest_shaft, rest_barb, overvalues...);
144 shaftdim =
SYSmax(current_shaft, rest_shaft);
145 barbdim =
SYSmax(current_barb, rest_barb);
157 return myData.size();
169 return myNumBarbPoints;
175 UT_ASSERT(i < myNumPoints * myNumBarbPoints);
185 return myData[myNumBarbPoints * point + barbpoint];
219 point, barbside, barbpoint, myNumPoints, myNumBarbPoints));
226 exint barbpoint)
const
229 point, barbside, barbpoint, myNumPoints, myNumBarbPoints);
241 point, barbside, barbpoint, shaftdim, barbdim));
253 point, barbside, barbpoint, shaftdim, barbdim);
256 template<
typename FN>
259 for (
int i=0; i<myNumPoints; ++i)
261 for (
int j=0;
j<myNumBarbPoints; ++
j)
263 int center = myNumBarbPoints / 2;
269 (*this)(i, barbside, barbpoint) = fn(i, barbside, barbpoint);
296 return myData[point];
298 else if (barbdim == 2)
300 return myData[barbdim * point +
int(barbside) - 1];
306 offset += barbside ==
BarbSide::LEFT ? -1 - barbpoint : barbpoint;
308 UT_ASSERT(offset >= 0 && offset < myData.size());
309 return myData[barbdim * point +
offset];
314 exint myNumPoints = 1;
315 exint myNumBarbPoints = 1;
356 return myOverrideType;
361 return myBaseParmValue;
466 bool hasChanged(
const CacheData *cache)
const;
471 return myBaseParmName;
486 cachedata.reset(getCacheData());
494 struct MyHashCompare {
495 static size_t hash(
const UdimCoord&
x ) {
496 int xhash = SYSwang_inthash(std::get<0>(x));
497 return SYSwang_inthash(xhash + std::get<1>(x));
500 static bool equal(
const UdimCoord& x,
const UdimCoord&
y ) {
504 typedef UT_ConcurrentHashMap<UdimCoord, UT_UniquePtr<TIL_TextureMap>, MyHashCompare> TexPathMap;
510 OverrideValue<float> &out,
536 OverrideValue<float> temp_out;
553 out.
swap(temp_out.getArray());
556 template<
typename LOOKUPFN>
558 OverrideValue<float> &out,
562 LOOKUPFN &&lookupfn);
566 float lookupTexturePrim(
const UT_Vector3 &uv);
573 CacheData *getCacheData()
const;
590 exint myBaseParmIndex;
592 exint myOverrideParmIndex;
593 exint myOptionsParmIndex;
594 exint myCurveAttribParmIndex;
595 exint myClumpAttribParmIndex;
596 exint mySkinAttribParmIndex;
597 exint myTextureParmIndex;
598 exint myTexPrimParmIndex;
599 exint myUVModeParmIndex;
602 exint myRampParmIndex;
603 exint myBarbRampToggleIndex;
604 exint myInRangeParmIndex;
605 exint myOutRangeParmIndex;
622 TexPathMap myUdimMaps;
624 bool myUseUdim =
false;
626 bool myDoFit =
false;
627 bool myDoRamp =
false;
630 bool myRemapRampMapToBarbs =
false;
648 if (!attrib || !tuple)
651 const auto &attribgdp = attrib->
getDetail();
658 offset = attribgdp.vertexPoint(vertoff);
662 if constexpr (std::is_integral_v<T> || std::is_floating_point_v<T>)
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
SYS_FORCE_INLINE const GA_Detail & getDetail() const
Definition of a geometry attribute.
UT_ValArray< T >::iterator begin()
SYS_FORCE_INLINE exint size() const
UT_StringHolder texturepath
SYS_FORCE_INLINE T & operator()(exint point, exint barbpoint)
void setEachElement(FN &&fn)
SYS_FORCE_INLINE T & operator()(exint point, BarbSide barbside, exint barbpoint, exint shaftdim, exint barbdim)
GA_API const UT_StringHolder uv
static void getMaxDim(exint &shaftdim, exint &barbdim, FIRSTOV first, OV...overvalues)
GLsizei const GLfloat * value
GU_Feather::BarbSide BarbSide
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
IMATH_HOSTDEVICE constexpr bool equal(T1 a, T2 b, T3 t) IMATH_NOEXCEPT
fpreal evalSkinPoint(const GA_Offset skinptoff)
std::tuple< Types...> UT_Tuple
const UT_StringHolder & getBaseName() const
void setBarbPromotionMode(BarbMode mode)
GA_DataId texmetacachecount
#define GA_INVALID_OFFSET
virtual bool get(const GA_Attribute *attrib, GA_Offset ai, int32 &data, int index=0) const =0
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
SYS_FORCE_INLINE const T & operator()(exint point, BarbSide barbside, exint barbpoint, exint shaftdim, exint barbdim) const
SOP_ParmOverride(const SOP_NodeVerb::CookParms &cookparms, const SOP_NodeParms &parms, const UT_StringHolder &baseparmname, const GU_Detail *gdp, const GU_Detail *clumpgdp, const GU_Detail *skingdp, const GU_Detail *texprimgdp, const GA_ROHandleV3 &uvattrib, const UT_ValArray< OverrideType > &overridetypes)
OverrideType overridetype
static void getMaxDim(exint &shaftdim, exint &barbdim, FIRSTOV first)
SYS_FORCE_INLINE exint getShaftDim() const
base_iterator< T, true > iterator
UT_ValArray< T >::iterator end()
bool updateOverrideCache(UT_UniquePtr< SOP_ParmOverride::CacheData > &cachedata) const
SYS_FORCE_INLINE T & operator()(exint point, BarbSide barbside, exint barbpoint)
const GA_Attribute * getRequiredAttrib() const
bool hasChanged(const CacheData *cache) const
void bumpDims(exint shaftdim, exint barbdim)
float postProcessVarying(float value) const
SYS_FORCE_INLINE T & operator()(exint i)
SYS_FORCE_INLINE exint getBarbDim() const
OverrideType overrideType() const
SYS_FORCE_INLINE GA_AttributeOwner getOwner() const
void setDims(exint shaftdim, exint barbdim)
fpreal evalSkin(const GA_Offset skinprimoff, const GA_OffsetArray &skinvertoffsets, const UT_FloatArray &skinvertweights, const UT_Vector3 &uv)
bool evaluatesToSingleValue(GA_AttributeOwner target) const
void eval(UT_FloatArray &out, const GA_AttributeOwner target, const GA_Offset skinprimoff, const GA_OffsetArray &skinvertoffsets, const UT_FloatArray &skinvertweights, const UT_Vector3 &uv, const GA_Offset curveprimoff, const GA_OffsetListRef &curvevertoffsets)
Generic Attribute Interface class to access an attribute as a tuple.
SYS_FORCE_INLINE const T & operator()(exint point, BarbSide barbside, exint barbpoint) const
void eval(OverrideValue< float > &out, EvalTemp &temp, const GA_AttributeOwner target, const GA_Offset skinprimoff, const GA_OffsetArray &skinvertoffsets, const UT_FloatArray &skinvertweights, const UT_Vector3 &uv, const GA_Offset curveprimoff, const GA_OffsetListRef &curvevertoffsets)
UT_ValArray< T > & getArray()
void swap(UT_Array< T > &other)
void eval(UT_FloatArray &out, const GA_AttributeOwner target, const GA_Offset skinprimoff, const GA_OffsetArray &skinvertoffsets, const UT_FloatArray &skinvertweights, const UT_Vector3 &uv, const GA_Offset curveprimoff, const GA_OffsetListRef &curvevertoffsets, const GA_Offset clumpprimoff, const UT_ValArray< GA_OffsetArray > &clumpvertoffsets, const UT_ValArray< UT_FloatArray > &clumpvertweights)
GU_GroomFastRamp remapramp
UT_FloatArray edgelengths