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;
145 void setAngularVelocity(
const UT_Vector3 &avel);
146 void setName(
const char *
name);
170 template <
typename ARRAY_T>
174 bool isValid()
const {
return myAttrib.isValid(); }
184 template <
typename ARRAY_T>
191 bool isValid()
const {
return myAttrib.isValid(); }
220 bool hasPositionData()
const;
224 void getCurrentWorldTransform(
UT_Matrix4D &xform)
const;
232 bool unpackBoundShapes(
GU_Detail &gdp,
bool apply_joint_xform =
true)
const;
241 template <
typename T,
typename ARRAY_T>
243 getArrayAttribElement(
const BatchROHandleA<ARRAY_T> &
handle,
248 template <
typename T,
typename ARRAY_T>
250 setArrayAttribElement(BatchRWHandleA<ARRAY_T> &
handle,
254 template <
typename T>
255 static constexpr
bool isScalar()
261 template <
typename T>
262 static int getTupleSize()
264 if constexpr (isScalar<T>())
267 return
T::tuple_size;
270 template <typename ATTRIB_T, typename
T>
273 if constexpr (isScalar<T>())
276 std::
copy(src, src +
T::tuple_size, dest.
data());
279 template <typename
T, typename ATTRIB_T>
280 static
void setValue(const T &src, ATTRIB_T *dest)
282 if constexpr (isScalar<T>())
285 std::copy(src.data(), src.data() + T::tuple_size, dest);
295 BatchROHandleA<UT_Fpreal32Array> myPivot;
296 BatchROHandleA<UT_Fpreal32Array> myOrientation;
297 BatchROHandleA<UT_Fpreal32Array> myPosition;
300 template <
typename ARRAY_T>
305 myTupleSize(myAttrib.isValid() ? myAttrib->getTupleSize() : -1)
309 template <
typename ARRAY_T>
314 myTupleSize(myAttrib.isValid() ? myAttrib->getTupleSize() : -1)
318 template <
typename ARRAY_T>
324 myAttrib.set(myCacheOffset, myVals);
329 template <
typename ARRAY_T>
336 myAttrib.bind(gdp, owner, name, minsize);
337 myTupleSize = myAttrib.isValid() ? myAttrib->getTupleSize() : -1;
340 template <
typename T,
typename ARRAY_T>
364 if ((i + 1) * tuple_size > handle.
myVals.entries())
367 getValue(handle.
myVals.array() + i * tuple_size, elem);
372 template <
typename T,
typename ARRAY_T>
379 if (tuple_size != getTupleSize<T>())
393 handle.
myVals.setSize(n * tuple_size);
396 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)
static bool getArrayAttribElement(const BatchROHandleA< ARRAY_T > &handle, GA_Offset offset, exint i, T &elem)
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)
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.