8 #ifndef __SIM_ObjectReader_h__
9 #define __SIM_ObjectReader_h__
53 virtual const GU_Detail *getSimGdp()
const = 0;
94 static bool isPackedObject(
const SIM_Object *obj);
110 bool isPivotValid()
const;
111 bool isPositionValid()
const;
112 bool isOrientationValid()
const;
113 bool isVelocityValid()
const;
114 bool isAngularVelocityValid()
const;
115 bool isNameValid()
const;
147 void setAngularVelocity(
const UT_Vector3 &avel);
148 void setName(
const char *
name);
172 template <
typename ARRAY_T>
176 bool isValid()
const {
return myAttrib.isValid(); }
188 template <
typename ARRAY_T>
195 bool isValid()
const {
return myAttrib.isValid(); }
224 bool hasPositionData()
const;
228 void getCurrentWorldTransform(
UT_Matrix4D &xform)
const;
236 bool unpackBoundShapes(
GU_Detail &gdp,
bool apply_joint_xform =
true)
const;
246 template <
typename T,
typename ARRAY_HANDLE_T>
248 getArrayAttribElement(
const ARRAY_HANDLE_T &handle,
253 template <
typename T,
typename ARRAY_T>
255 setArrayAttribElement(BatchRWHandleA<ARRAY_T> &handle,
259 template <
typename T>
260 static constexpr
bool isScalar()
266 template <
typename T>
267 static int getTupleSize()
269 if constexpr (isScalar<T>())
272 return
T::tuple_size;
275 template <typename ATTRIB_T, typename
T>
278 if constexpr (isScalar<T>())
281 std::
copy(src, src +
T::tuple_size, dest.
data());
284 template <typename
T, typename ATTRIB_T>
285 static
void setValue(const T &src, ATTRIB_T *dest)
287 if constexpr (isScalar<T>())
290 std::copy(src.data(), src.data() + T::tuple_size, dest);
300 BatchROHandleA<UT_Fpreal32Array> myPivot;
301 BatchROHandleA<UT_Fpreal32Array> myOrientation;
302 BatchROHandleA<UT_Fpreal32Array> myPosition;
305 template <
typename ARRAY_T>
310 myTupleSize(myAttrib.isValid() ? myAttrib->getTupleSize() : -1)
314 template <
typename ARRAY_T>
319 myTupleSize(myAttrib.isValid() ? myAttrib->getTupleSize() : -1)
323 template <
typename ARRAY_T>
329 myAttrib.set(myCacheOffset, myVals);
334 template <
typename ARRAY_T>
341 myAttrib.bind(gdp, owner, name, minsize);
342 myTupleSize = myAttrib.isValid() ? myAttrib->getTupleSize() : -1;
345 template <
typename T,
typename ARRAY_HANDLE_T>
352 if (!handle.isValid())
355 const int tuple_size = handle.myTupleSize;
356 if (handle.myTupleSize != getTupleSize<T>())
363 if (handle.myCacheOffset != offset)
367 handle.myAttrib.get(offset, handle.myVals);
368 handle.myCacheOffset =
offset;
371 if ((i + 1) * tuple_size > handle.myVals.entries())
374 getValue(handle.myVals.array() + i * tuple_size, elem);
379 template <
typename T,
typename ARRAY_T>
386 if (tuple_size != getTupleSize<T>())
400 handle.
myVals.setSize(n * tuple_size);
403 setValue(elem, handle.
myVals.array() + i * tuple_size);
Definition of a geometry attribute.
const GU_Agent * getAgent() const
virtual void getPositionTransform(UT_Matrix4D &xform, bool scale=true) const =0
virtual UT_Quaternion getOrientation() const =0
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
virtual UT_Vector3 getCentroid() const =0
exint getTransformId() const
const SIM_Object & getObject() const
Return the SIM_Object.
SYS_FORCE_INLINE GA_Offset getPointOffset() const
GA_Offset getPointOffset() const
GA_RWHandleT< ARRAY_T > myAttrib
__hostdev__ void setValue(uint32_t offset, bool v)
SYS_FORCE_INLINE bool GAisValid(GA_Size v)
GA_ROHandleT< ARRAY_T > myAttrib
#define GA_INVALID_OFFSET
BatchROHandleA(const GA_Attribute *attrib=nullptr)
__hostdev__ float getValue(uint32_t i) const
static void setArrayAttribElement(BatchRWHandleA< ARRAY_T > &handle, GA_Offset offset, exint i, exint n, const T &elem)
#define UT_ASSERT_MSG(ZZ,...)
GA_API const UT_StringHolder scale
const GU_PrimPacked * getPrimitive() const
virtual const GU_Detail * getSimGdp() const =0
Return the SIM_Object's geometry.
PXL_API const char * getName(const ColorSpace *space)
Return the name of the color space.
SIM_API void SIMcomputePositionTransform(const UT_Vector3 &pos, const UT_Vector3 &pivot, const UT_Quaternion &orient, UT_Matrix4D &xform)
SYS_FORCE_INLINE T get(GA_Offset off, int comp=0) const
GLuint const GLchar * name
virtual ~SIM_BaseObjectReader()
const SIM_Object & myObject
GA_API const UT_StringHolder orient
const GEO_Primitive * getPrimitive() const
Returns the primitive associated with the current point offset.
SYS_FORCE_INLINE GA_Offset getPointOffset() const
BatchRWHandleA(GA_Attribute *attrib=nullptr)
static bool getArrayAttribElement(const ARRAY_HANDLE_T &handle, GA_Offset offset, exint i, T &elem)
Vec3< typename MatType::value_type > getScale(const MatType &mat)
Return a Vec3 representing the lengths of the passed matrix's upper 3×3's rows.
GA_API const UT_StringHolder pivot
void bind(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1)
virtual GU_ConstDetailHandle getObjectGdp() const =0
Container class for all geometry.