33 namespace GU_SurfaceDeform
36 template <
typename T,
typename Container>
44 inline T get(
size_t i)
const noexcept
49 inline void set(
size_t i,
const T &
value) noexcept
54 inline size_t size() const noexcept
60 template <
typename T,
typename Container,
typename Policy>
76 inline void set(
size_t i,
const T &
value) noexcept {
80 inline size_t size() const noexcept {
113 for (
exint i = r.begin(),
end = r.end(); i <
end; ++i)
120 GA_Offset primoff = mininfo.prim.offset();
124 primoffsets[i] = primoff;
125 primuvs[i] =
UT_Vector3(mininfo.u1, mininfo.v1, 0.0f);
142 primptcounts.
begin(), primptcounts.
end(),
143 primptstarts.
begin() + 1);
146 GA_Size offsetcount = primptstarts[primptstarts.
size()-1];
157 for (
exint i = r.begin(),
end = r.end(); i <
end; ++i)
168 &surfacegdp, primoff, offsets, weights, primuv,
true);
170 for (
int j=0;
j<offsets.
size(); ++
j)
172 ptoffsets[primptstarts[i] +
j] = offsets[
j];
173 ptweights[primptstarts[i] +
j] = weights[
j];
196 const DEFRESTPOS &constrestpos,
197 const DEFANIMPOS &constanimpos,
213 for (
exint i = r.begin(),
end = r.end(); i <
end; ++i)
215 GA_Size ptstart = primptstarts[i];
216 GA_Size ptend = primptstarts[i + 1];
217 if (ptstart != ptend)
228 for (
int j = ptstart;
j < ptend; ++
j)
233 float w = ptweights[
j];
234 restpos += w * constrestpos[index];
235 animpos += w * constanimpos[index];
237 restnml += w * restnmlattrib.
get(ptoff);
238 animnml += w * animnmlattrib.
get(ptoff);
240 resttan += w * resttanattrib.
get(ptoff);
241 animtan += w * animtanattrib.
get(ptoff);
262 if constexpr(std::is_same_v<value_type, UT_Matrix4>)
264 newposdata.set(i, restspace * deformspace);
269 pos *= restspace * deformspace;
271 newposdata.set(i, pos);
277 if constexpr(std::is_same_v<value_type, UT_Matrix4>)
283 newposdata.set(i, points[i].
data());
299 template<
typename PA>
322 for (
exint i = r.begin(),
end = r.end(); i <
end; ++i)
324 ptIndices[i] = myRestSurface->pointIndex(ptoffsets[i]);
344 void init(
const GU_Detail &restSurfaceGdp);
351 template<
typename PA>
359 if (!myRayIntersect || !myRestSurface)
362 const exint numpts = positions.size();
373 for (
exint i = r.begin(),
end = r.end(); i <
end; ++i)
376 myRayIntersect->minimumPoint(positions[i], mininfo);
381 (
int)myRestSurface->primitiveIndex(primoff);
382 coarseU[i] = mininfo.u1;
383 coarseV[i] = mininfo.v1;
398 bool isValid()
const {
return myRestSurface !=
nullptr; }
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
void UTparallelFor(const Range &range, const Body &body, const int subscribe_ratio=2, const int min_grain_size=1, const bool force_use_task_scope=true)
GLdouble GLdouble GLint GLint const GLdouble * points
GLsizei const GLfloat * value
void setSizeNoInit(exint newsize)
UT_Vector3T< float > UT_Vector3
void UTparallelForLightItems(const Range &range, const Body &body, const bool force_use_task_scope=true)
int minimumPoint(const UT_Vector3 &p, GU_MinInfo &mininfo, const GEO_Primitive *prim=0) const
exint GA_Size
Defines the bit width for index and offset types in GA.
UT_Matrix4T< float > UT_Matrix4
#define GA_INVALID_OFFSET
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
GLuint GLsizei const GLuint const GLintptr * offsets
#define utZoneScopedN(name)
GEO_API void GEOgetInterpolationWeights(const GEO_Detail *detail, GA_Offset primoff, UT_Array< GA_Offset > &offsets, UT_Array< float > &weights, const UT_Vector3 &uvw, bool is_point_offsets=false)
SYS_FORCE_INLINE T get(GA_Offset off, int comp=0) const
void lookat(const UT_Vector3T< S > &from, const UT_Vector3T< S > &to, T roll=0)
SYS_FORCE_INLINE GA_Offset offset() const
UT_UniquePtr< GA_Attribute > GA_AttributeUPtr
SYS_FORCE_INLINE GA_Index pointIndex(GA_Offset offset) const
Given a point's data offset, return its index.
void translate(T dx, T dy, T dz=0)
GLubyte GLubyte GLubyte GLubyte w
SYS_FORCE_INLINE UT_StorageMathFloat_t< T > normalize() noexcept
SYS_FORCE_INLINE GA_Size getPrimitiveVertexCount(GA_Offset primoff) const
iterator end()
End iterator.