HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_AgentClip.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GU_AgentClip.h (GU Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GU_AgentClip__
12 #define __GU_AgentClip__
13 
14 #include "GU_API.h"
15 
16 #include "GU_AgentRig.h"
17 
18 #include <UT/UT_Array.h>
19 #include <UT/UT_Assert.h>
20 #include <UT/UT_IntrusivePtr.h>
21 #include <UT/UT_Lock.h>
22 #include <UT/UT_Matrix3.h>
23 #include <UT/UT_Matrix4.h>
24 #include <UT/UT_Quaternion.h>
25 #include <UT/UT_SharedPtr.h>
26 #include <UT/UT_StringArray.h>
27 #include <UT/UT_StringHolder.h>
28 #include <UT/UT_StringMap.h>
29 #include <UT/UT_SymMatrix3.h>
30 #include <UT/UT_ValArray.h>
31 #include <UT/UT_Vector3.h>
32 #include <UT/UT_VectorTypes.h>
33 #include <SYS/SYS_Inline.h>
34 #include <SYS/SYS_Math.h>
35 #include <SYS/SYS_Types.h>
36 
37 class CL_Clip;
39 class UT_BitArray;
40 class UT_StringArray;
41 
42 /// A factored transform geared for animation blending.
43 template <typename T>
45 {
46 public:
48 
50  GU_AgentXformT() = default;
51 
53  : myStretch(scale)
54  , myRotate(0, 0, 0, 0)
55  , myTranslate(0, 0, 0)
56  {
57  }
58 
59  /// Convert from another floating point type.
60  template <typename S>
61  explicit GU_AgentXformT(const GU_AgentXformT<S> &other)
62  : myStretch(UT_SymMatrix3T<T>(other.stretch()))
63  , myRotate(UT_QuaternionT<T>(other.rotate()))
64  , myTranslate(UT_Vector3T<T>(other.translate()))
65  {
66  }
67 
68  const UT_SymMatrix3T<T>& stretch() const { return myStretch; }
69  const UT_QuaternionT<T>& rotate() const { return myRotate; }
70  const UT_Vector3T<T>& translate() const { return myTranslate; }
71 
72  void zero()
73  {
74  myStretch.zero();
75  myRotate.assign(0, 0, 0, 0);
76  myTranslate.assign(0, 0, 0);
77  }
78  void identity()
79  {
80  myStretch.identity();
81  myRotate.identity();
82  myTranslate.assign(0, 0, 0);
83  }
84 
85  /// Set the transform, in SRT/XYZ transform order.
86  /// The rotations are given in radians.
88  T tx, T ty, T tz,
89  T rx, T ry, T rz,
90  T sx, T sy, T sz)
91  {
93  myStretch.setScale(sx, sy, sz);
94  myRotate.updateFromEuler(UT_Vector3T<T>(rx, ry, rz), xord);
95  myTranslate.assign(tx, ty, tz);
96  }
97 
98  /// Set the transform, in SRT transform order.
99  /// The rotations are specified by a quaternion.
101  const UT_Vector3T<T> &t, const UT_QuaternionT<T> &r,
102  const UT_Vector3T<T> &s)
103  {
104  myStretch.setScale(s);
105  myRotate = r;
106  myTranslate = t;
107  }
108 
109  template <typename S>
111  S& tx, S& ty, S& tz,
112  S& rx, S& ry, S& rz,
113  S& sx, S& sy, S& sz) const
114  {
115  tx = myTranslate[0];
116  ty = myTranslate[1];
117  tz = myTranslate[2];
118 
120  UT_Vector3D r = myRotate.computeRotations(xord);
121  rx = r[0];
122  ry = r[1];
123  rz = r[2];
124 
125  sx = myStretch(0, 0);
126  sy = myStretch(1, 1);
127  sz = myStretch(2, 2);
128  }
129 
130  /// Set this to a linear interpolation of the two given transforms:
131  /// *this = a + t*(b - a)
132  void setLerp(const type& a, const type& b, T t)
133  {
134  myStretch.lerp(a.myStretch, b.myStretch, t);
135 
136  if (dot(a.myRotate, b.myRotate) >= 0)
137  myRotate.lerp(a.myRotate, b.myRotate, t);
138  else
139  myRotate.lerp(a.myRotate, -b.myRotate, t);
140  // NOTE: We don't normalize myRotate since this is already handled when
141  // we call UT_QuaternionT::getRotationMatrix().
142 
143  myTranslate = SYSlerp(a.myTranslate, b.myTranslate, t);
144  }
145 
146  /// Same as setLerp, but this assumes that a and b's rotation
147  /// matrices are lined up.
148  void setLerpAligned(const type& a, const type& b, T t)
149  {
150  myStretch.lerp(a.myStretch, b.myStretch, t);
151  myRotate.lerp(a.myRotate, b.myRotate, t);
152  myTranslate = SYSlerp(a.myTranslate, b.myTranslate, t);
153  }
154 
155  void addScaled(T s, const type& xform)
156  {
157  myStretch += xform.myStretch * s;
158  if (dot(myRotate, xform.myRotate) >= 0)
159  myRotate += xform.myRotate * s;
160  else
161  myRotate += xform.myRotate * -s;
162  myTranslate += xform.myTranslate * s;
163  }
164 
165  /// Perform an additive blend with the specified percentage.
166  void concat(T t, const type& xform)
167  {
168  myRotate.normalize();
169 
170  myTranslate += myRotate.rotate(xform.myTranslate * t);
171 
172  UT_QuaternionT<T> additive_r = xform.myRotate;
173  additive_r.normalize();
174  UT_QuaternionT<T> new_r = myRotate * additive_r;
175 
176  if (dot(myRotate, new_r) < 0)
177  new_r.negate();
178 
179  myRotate.lerp(myRotate, new_r, t);
180  }
181 
183  {
184  // Set m to the transform myStretch*myRotate*myTranslate
185  if (!myStretch.isIdentity())
186  {
187  UT_Matrix3T<T> sr;
188  myRotate.getRotationMatrix(sr);
189  sr.leftMult(myStretch);
190  m = sr;
191  }
192  else
193  myRotate.getTransformMatrix(m);
194 
195  m.setTranslates(myTranslate);
196  }
197 
199  {
201  UT_Vector3T<T> s, r, t;
203  UT_Matrix4T<T> mat = m;
204 
205 
206  bool success = mat.makeRigidMatrix(&stretch);
207  if (success)
208  {
209  mat.explode(xord, r, s, t);
210  stretch.scale(s);
211  setTransform(t.x(), t.y(), t.z(), r.x(), r.y(),
212  r.z(), s.x(), s.y(), s.z());
213  myStretch = stretch.averagedSymMatrix3();
214  }
215  else
216  {
217  m.explode(xord, r, s, t);
218  setTransform(t.x(), t.y(), t.z(), r.x(), r.y(),
219  r.z(), s.x(), s.y(), s.z());
220  }
221  }
222  // ensures that the dot product of ref and the rotation is non-negative
224  {
225  setMatrix4(m);
226  if (dot(ref, myRotate) <= 0)
227  {
228  myRotate = -myRotate;
229  }
230  }
231 
232 private:
233  UT_SymMatrix3T<T> myStretch;
234  UT_QuaternionT<T> myRotate;
235  UT_Vector3T<T> myTranslate;
236 };
240 
241 // Declare as POD for UT_Array optimizations.
243 
245 typedef UT_IntrusivePtr<GU_AgentClip> GU_AgentClipPtr;
247 typedef UT_Array<GU_AgentClipConstPtr> GU_AgentClipPtrArray;
248 
249 
250 /// An agent motion clip
251 ///
252 /// It is represented as array of samples, where each sample has
253 /// transformsPerSample() number of transforms. These transforms can be "local"
254 /// (corresponding to the transform hierarchy of rig()), or "world" where they
255 /// are multiplied all the way up to a root node in the rig.
256 class GU_API GU_AgentClip : public UT_IntrusiveRefCounter<GU_AgentClip>
257 {
258 public:
259 
269 
270  /// Create an empty clip
271  static GU_AgentClipPtr addClip(
272  const UT_StringHolder &name,
273  const GU_AgentRigConstPtr &rig);
274 
275  /// Create a clip by loading a clip file from disk.
276  static GU_AgentClipPtr addClipFromFile(
277  const UT_StringHolder &name,
278  const UT_StringHolder &filename,
279  const GU_AgentRigConstPtr& rig,
280  bool delay_load,
281  UT_StringArray& errors);
282 
283  /// Create a clone of a clip, referencing the specified rig.
284  /// 'copy_external_ref' should be disabled if the new clip will be
285  /// further modified.
286  static GU_AgentClipPtr addClipCopy(const GU_AgentClip &src,
287  const GU_AgentRigConstPtr &rig,
288  bool copy_external_ref);
289 
290  /// Compute the world transforms 'matrices' from the local 'xforms'
291  /// corresponding to the transforms in 'rig'.
292  static void computeWorldTransforms(
293  const GU_AgentRig& rig,
294  const XformArray& xforms,
295  Matrix4Array& matrices);
296 
297  /// Compute the local transforms 'matrices' from the local 'xforms'
298  /// corresponding to the transforms in 'rig'.
299  static void computeLocalTransforms(
300  const GU_AgentRig& rig,
301  const XformArray& xforms,
302  Matrix4Array& matrices);
303 
304  /// Given the local transforms 'xforms' corresponding to 'rig', convert
305  /// them to world transforms in-place.
306  /// The optional 'in_world_space' array can be used to specify if some
307  /// transforms in 'xforms' are already in world space.
308  static void computeWorldTransforms(
309  const GU_AgentRig& rig,
310  const UT_BitArray *in_world_space,
311  Matrix4Array& xforms);
312 
313  /// Given the world transforms 'xforms' corresponding to 'rig', convert
314  /// them to local transforms in-place.
315  /// The optional 'in_world_space' array can be used to specify if only some
316  /// transforms in 'xforms' are currently in world space.
317  static void computeLocalTransforms(
318  const GU_AgentRig& rig,
319  const UT_BitArray *in_world_space,
320  Matrix4Array& xforms);
321 
322  /// Replaces whitespace, special characters, etc with underscores.
323  SYS_NO_DISCARD_RESULT static UT_StringHolder forceValidName(
324  const UT_StringHolder &clipname);
325 
326 private:
327  GU_AgentClip(const UT_StringHolder &name,
328  const UT_StringHolder &filename,
329  const GU_AgentRigConstPtr &rig)
330  : myName(name)
331  , myFileName(filename)
332  , myIsFile(filename.isstring())
333  , myIsLoaded(!filename.isstring())
334  , myHasLoadErrors(false)
335  , myNumXformTracks(0)
336  , myRig(rig)
337  , myStart(0)
338  , mySampleRate(24.0)
339  {
340  }
341 
342 public:
343 
344  ~GU_AgentClip();
345 
346  int64 getMemoryUsage(bool inclusive) const;
347 
348  /// Set this clip to have the specified number of samples, filled with
349  /// identity transforms.
350  ///
351  /// @pre num_samples must be larger than 0.
352  void init(exint num_samples);
353 
354  /// Load from clip.
355  void load(const CL_Clip &clip);
356 
357  /// Copy from another agent clip, and inherit the external reference if
358  /// there is one. If the rigs are different, identity matrices will be used
359  /// for the additional joints.
360  void load(const GU_AgentClip &clip);
361 
362  /// Return the number of transform tracks of the clip that was loaded into
363  /// this clip.
364  // This is currently only used for consistency checks.
365  int numTransformTracks() const
366  { ensureLoaded(); return myNumXformTracks; }
367 
368  /// Save to clip
369  void save(CL_Clip &clip,
370  bool worldspace = false) const;
371 
372  /// Name of the clip.
373  /// @{
374  const UT_StringHolder& name() const
375  { return myName; }
377  { myName = name; }
378  /// @}
379 
380  /// Returns whether the clip references a file on disk.
381  bool isFile() const
382  { return myIsFile; }
383  /// Returns the name of the file referenced by the clip.
384  const UT_StringHolder& fileName() const
385  { UT_ASSERT(isFile()); return myFileName; }
386  /// Clears the external file reference. The clip's contents will also be
387  /// loaded from disk if necessary.
388  void clearIsFile();
389 
390  /// Returns whether the clip's contents have been loaded from disk.
391  bool isLoaded() const
392  { UT_ASSERT(isFile()); return myIsLoaded; }
393  /// Returns whether there were errors when loading the clip from disk.
394  bool hasLoadErrors() const
395  { return myHasLoadErrors; }
396  /// Explicitly loads the clip from disk.
397  bool loadFromFile(
398  UT_StringArray *errors = nullptr) const;
399 
400  const GU_AgentRig& rig() const
401  { return *myRig; }
402 
403  /// Number of transforms in each sample
405  {
406  ensureLoaded();
407  if (myLocalTransforms.entries() < 1)
408  return 0;
409  return myLocalTransforms(0).entries();
410  }
411 
412  /// Number of samples in this clip
414  {
415  ensureLoaded();
416  return myLocalTransforms.entries();
417  }
418 
419  /// Start time of this clip in seconds
420  /// @{
421  fpreal start() const
422  { ensureLoaded(); return myStart; }
424  { ensureLoaded(); myStart = t; }
425  /// @}
426 
427  /// Length of the clip, in seconds.
428  fpreal length() const
429  {
430  return sampleCount() / sampleRate();
431  }
432 
433  /// Sample rate of this clip
434  /// @{
436  { ensureLoaded(); return mySampleRate; }
437  void setSampleRate(fpreal sample_rate)
438  {
439  ensureLoaded();
440  mySampleRate = sample_rate;
441  }
442  /// @}
443 
444  /// Directly set the local transforms for this clip (as an alternative to
445  /// using GU_AgentClip::load()).
446  ///
447  /// @param samples An array of local transform samples
448  ///
449  /// @pre samples (and each sample within) must be at least length 1
450  /// @pre Each entry in samples must be the same length
451  /// @post sampleCount() == samples.entries()
452  /// @post transformsPerSample() == samples.last().entries()
453  void setLocalTransforms(
455 
456  /// Edit the transforms for a specific sample in the clip.
457  void setLocalTransforms(exint sample_i,
458  const XformArray &xforms);
459 
460  const XformArray& localTransforms(exint sample_i) const
461  {
462  ensureLoaded();
463  return myLocalTransforms(sample_i);
464  }
465  Matrix4ArrayConstPtr worldTransforms(exint sample_i) const
466  {
467  ensureLoaded();
468  return myWorldTransforms(sample_i);
469  }
470  const FloatArray& channelValues(exint sample_i) const
471  {
472  ensureLoaded();
473  return *myChannelValueSamples[sample_i];
474  }
475 
476  /// Samples a transform in the clip at a specific time.
477  void sampleTransform(exint i, fpreal seconds,
478  bool worldspace,
479  Matrix4 &xform_sample) const;
480 
481  /// Add an extra channel into the clip (as an alternative to
482  /// GU_AgentClip::load()).
483  /// If a channel with the same name already exists, its data is replaced
484  /// with the new samples.
485  ///
486  /// @param name Unique name of the channel.
487  /// @param samples Float array with length sampleCount().
488  void addChannel(const UT_StringHolder &name,
489  const FloatType *samples);
490 
491  /// Finds a channel by name. Returns -1 if the channel does not exist.
492  exint findChannel(const UT_StringRef &name) const;
493  /// Samples a channel in the clip at a specific time.
494  /// The channel indices from GU_AgentRig are valid indices for the clip's
495  /// channels.
496  /// For transforms, use GU_AgentClip::sampleTransform().
497  FloatType sampleChannel(exint channel_index,
498  fpreal seconds) const;
499  /// Returns the number of non-transform channels in the clip. This value
500  /// will be >= GU_AgentRig::channelCount().
501  exint channelCount() const;
502  /// Returns the name of the specified channel.
503  const UT_StringHolder &channelName(exint i) const;
504  /// Builds a list of all channel names in the clip (channels defined by
505  /// GU_AgentRig, plus any spare channels).
506  UT_StringArray channelNames() const;
507 
508  /// Add a scaled version of our local transforms using the given clip time.
509  /// If the time in seconds exceeds the length of our clip, then it is
510  /// wrapped around.
511  void addScaledLocalTransforms(
512  XformArray& dst,
513  fpreal scale,
514  fpreal seconds) const;
515  /// Variant of addScaledLocalTransforms that only affects a subset of the
516  /// joints.
517  ///
518  /// @param inv_total_weight Inverse of the total blend weight at each joint.
519  void addScaledLocalTransforms(
520  XformArray &dst,
521  const UT_BitArray &joints,
522  fpreal scale,
523  const UT_Array<fpreal> &inv_total_weights,
524  fpreal seconds) const;
525  /// Perform an additive blend with the specified percentage.
526  void concatLocalTransforms(
527  XformArray &dst,
528  const GU_AgentTransformGroup &xform_grp,
529  fpreal percent,
530  fpreal seconds) const;
531  void addScaledLocalTransform(
532  Xform& xform,
533  exint i,
534  fpreal scale,
535  fpreal seconds) const;
536 
537  /// Adds a scaled version of the channel values given a clip time. Only the
538  /// channels defined on GU_AgentRig are included.
539  void addScaledChannelValues(
540  FloatArray &dst,
541  const UT_BitArray &channels,
542  fpreal scale,
543  const UT_Array<fpreal> &inv_total_weights,
544  fpreal seconds) const;
545 
547  {
548  ensureLoaded();
549  return (seconds - myStart) * mySampleRate;
550  }
551  inline fpreal secondsFromSample(fpreal sample) const
552  {
553  ensureLoaded();
554  return myStart + (sample / mySampleRate);
555  }
557  {
558  return (exint)
559  SYSrint(sampleFromSeconds(seconds));
560  }
562  {
563  fpreal len = sampleCount();
564  fpreal s = SYSfmod(
565  sampleFromSeconds(seconds),
566  len);
567  if (s >= 0)
568  return s;
569  else
570  return s + len;
571  }
572 
573 private:
574  /// Called before any clip data is accessed to ensure that the clip has
575  /// been loaded from disk.
576  SYS_FORCE_INLINE void ensureLoaded() const
577  {
578  if (!myIsLoaded)
579  loadFromFile();
580  }
581 
582  /// Removes the clip from the agent clip file cache.
583  void removeFromFileCache();
584 
585  /// Given a sample time in seconds, find the two samples that we need to
586  /// interpolate between.
587  void getSamples(fpreal scale, fpreal seconds,
588  exint& sample_a, fpreal& weight_a,
589  exint& sample_b, fpreal& weight_b) const;
590 
591  /// Initialize myChannelValueSamples with the channels defined on
592  /// GU_AgentRig.
593  void initChannels(exint num_samples);
594 
595  /// Build myWorldTransforms from myLocalTransforms.
596  void computeWorldSpaceSamples();
597 
598  UT_StringHolder myName;
599  UT_StringHolder myFileName;
600  bool myIsFile;
601  /// Tracks whether the clip's contents have been loaded from disk.
602  bool myIsLoaded;
603  /// Records whether there were any errors when the clip was delay-loaded.
604  bool myHasLoadErrors;
605  int myNumXformTracks; // put here for the same ABI
606  GU_AgentRigConstPtr myRig;
607  fpreal myStart;
608  fpreal mySampleRate;
609 
610  /// The local transforms for the rig, at each sample.
611  UT_Array<XformArray> myLocalTransforms;
612  /// The world transforms for the rig, at each sample.
613  UT_Array<Matrix4ArrayPtr> myWorldTransforms;
614 
615  /// The (non-transform) channel values in the clip, at each sample.
616  /// Channels are ordered beginning with the channels defined on
617  /// GU_AgentRig.
618  UT_Array<FloatArrayPtr> myChannelValueSamples;
619  /// List of spare channels not defined on GU_AgentRig. These are stored at
620  /// the end of myChannelValueSamples[i].
621  UT_StringArray mySpareChannelNames;
622  /// Index into myChannelValueSamples[i] for each channel in
623  /// mySpareChannelNames.
624  UT_StringMap<int> mySpareChannelIndex;
625 
626  /// Lock for delayed loading of the clip data.
627  mutable UT_Lock myDelayLoadLock;
628 };
629 
630 inline exint
632 {
633  ensureLoaded();
634 
635  // First, see if this channel is defined on the rig.
636  exint i = myRig->findChannel(name);
637  if (i >= 0)
638  return i;
639 
640  // Otherwise, it would need to be a spare channel.
641  auto it = mySpareChannelIndex.find(name);
642  return it != mySpareChannelIndex.end() ? it->second : -1;
643 }
644 
645 inline const UT_StringHolder &
647 {
648  ensureLoaded();
649 
650  // Grab the channel name from the rig, unless it is a spare channel.
651  if (i < myRig->channelCount())
652  return myRig->channelName(i);
653  else
654  return mySpareChannelNames[i - myRig->channelCount()];
655 }
656 
657 inline exint
659 {
660  ensureLoaded();
661  return myRig->channelCount() + mySpareChannelNames.entries();
662 }
663 
664 inline UT_StringHolder
666 {
667  return clipname.forceValidVariableName(".-");
668 }
669 
670 #endif
GLdouble s
Definition: glew.h:1390
GU_AgentXformT< float > GU_AgentXformF
Definition: GU_AgentClip.h:237
fpreal sampleFromSeconds(fpreal seconds) const
Definition: GU_AgentClip.h:546
void leftMult(const UT_SymMatrix3T< S > &m)
Multiply given symmetric matrix on the left.
Definition: UT_Matrix3.h:340
GT_API const UT_StringHolder filename
GLenum src
Definition: glew.h:2410
UT_SymMatrix3T< T > averagedSymMatrix3() const
Convert this to a symmetric matrix, using averaged components.
Definition: UT_Matrix3.h:225
GLenum GLint ref
Definition: glew.h:1845
GU_AgentXformT(T scale)
Definition: GU_AgentClip.h:52
int numTransformTracks() const
Definition: GU_AgentClip.h:365
GLuint const GLchar * name
Definition: glew.h:1814
GU_AgentXformT< double > GU_AgentXformD
Definition: GU_AgentClip.h:238
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
Definition: thread.h:643
void scale(T sx, T sy, T sz)
Definition: UT_Matrix3.h:849
SYS_FORCE_INLINE GU_AgentXformT()=default
static SYS_NO_DISCARD_RESULT UT_StringHolder forceValidName(const UT_StringHolder &clipname)
Replaces whitespace, special characters, etc with underscores.
Definition: GU_AgentClip.h:665
GLenum GLenum GLenum GLenum GLenum scale
Definition: glew.h:13880
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:9477
bool makeRigidMatrix(UT_Matrix3T< T > *stretch=nullptr, bool reverse=true, const int max_iter=64, const T rel_tol=FLT_EPSILON)
exint findChannel(const UT_StringRef &name) const
Finds a channel by name. Returns -1 if the channel does not exist.
Definition: GU_AgentClip.h:631
int64 exint
Definition: SYS_Types.h:125
void setLerp(const type &a, const type &b, T t)
Definition: GU_AgentClip.h:132
GU_AgentXformT< T > type
Definition: GU_AgentClip.h:47
void getTransform(S &tx, S &ty, S &tz, S &rx, S &ry, S &rz, S &sx, S &sy, S &sz) const
Definition: GU_AgentClip.h:110
void setMatrix4(const UT_Matrix4T< T > &m)
Definition: GU_AgentClip.h:198
Generic symmetric 3x3 matrix.
Definition: UT_SymMatrix3.h:27
const GLdouble * m
Definition: glew.h:9124
fpreal wrappedSampleFromSeconds(fpreal seconds) const
Definition: GU_AgentClip.h:561
void setStart(fpreal t)
Definition: GU_AgentClip.h:423
void setTransform(T tx, T ty, T tz, T rx, T ry, T rz, T sx, T sy, T sz)
Definition: GU_AgentClip.h:87
const UT_Vector3T< T > & translate() const
Definition: GU_AgentClip.h:70
UT_Matrix2T< T > SYSlerp(const UT_Matrix2T< T > &v1, const UT_Matrix2T< T > &v2, S t)
Definition: UT_Matrix2.h:604
Matrix4ArrayConstPtr worldTransforms(exint sample_i) const
Definition: GU_AgentClip.h:465
3D Vector class.
A reference counter base class for use with UT_IntrusivePtr.
float fpreal32
Definition: SYS_Types.h:200
const GU_AgentRig & rig() const
Definition: GU_AgentClip.h:400
GU_AgentXformT(const GU_AgentXformT< S > &other)
Convert from another floating point type.
Definition: GU_AgentClip.h:61
fpreal start() const
Definition: GU_AgentClip.h:421
void setLerpAligned(const type &a, const type &b, T t)
Definition: GU_AgentClip.h:148
void setMatrix4(const UT_Matrix4T< T > &m, const UT_QuaternionT< T > &ref)
Definition: GU_AgentClip.h:223
UT_Matrix4T< FloatType > Matrix4
Definition: GU_AgentClip.h:265
UT_SharedPtr< FloatArray > FloatArrayPtr
Definition: GU_AgentClip.h:262
UT_Array< Matrix4 > Matrix4Array
Definition: GU_AgentClip.h:266
A rig for the agent primitive.
Definition: GU_AgentRig.h:34
GU_AgentXformT< fpreal > GU_AgentXformR
Definition: GU_AgentClip.h:239
const UT_SymMatrix3T< T > & stretch() const
Definition: GU_AgentClip.h:68
SYS_FORCE_INLINE T & y()
Definition: UT_Vector3.h:513
void getMatrix4(UT_Matrix4T< T > &m) const
Definition: GU_AgentClip.h:182
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
const FloatArray & channelValues(exint sample_i) const
Definition: GU_AgentClip.h:470
A factored transform geared for animation blending.
Definition: GU_AgentClip.h:44
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
Definition: CE_Vector.h:127
void concat(T t, const type &xform)
Perform an additive blend with the specified percentage.
Definition: GU_AgentClip.h:166
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
SYS_FORCE_INLINE T & z()
Definition: UT_Vector3.h:515
int explode(const UT_XformOrder &order, UT_Vector3F &r, UT_Vector3F &s, UT_Vector3F &t, UT_Vector3F *shears=0) const
Definition: UT_Matrix4.h:909
void setName(const UT_StringHolder &name)
Definition: GU_AgentClip.h:376
GLenum GLenum dst
Definition: glew.h:2410
#define SYS_DECLARE_IS_POD(T)
Declare a type as POD.
bool isFile() const
Returns whether the clip references a file on disk.
Definition: GU_AgentClip.h:381
Wrapper around hboost::intrusive_ptr.
long long int64
Definition: SYS_Types.h:116
#define SYS_NO_DISCARD_RESULT
Definition: SYS_Compiler.h:93
UT_Array< FloatType > FloatArray
Definition: GU_AgentClip.h:261
GU_AgentXformT< FloatType > Xform
Definition: GU_AgentClip.h:263
#define GU_API
Definition: GU_API.h:14
exint channelCount() const
Definition: GU_AgentClip.h:658
const XformArray & localTransforms(exint sample_i) const
Definition: GU_AgentClip.h:460
UT_SharedPtr< const Matrix4Array > Matrix4ArrayConstPtr
Definition: GU_AgentClip.h:268
SYS_NO_DISCARD_RESULT UT_StringRef forceValidVariableName(const char *safechars=nullptr) const
fpreal32 SYSrint(fpreal32 val)
Definition: SYS_Floor.h:163
void setTranslates(const UT_Vector3T< S > &translates)
Definition: UT_Matrix4.h:1335
const UT_StringHolder & channelName(exint i) const
Returns the name of the specified channel.
Definition: GU_AgentClip.h:646
void setTransform(const UT_Vector3T< T > &t, const UT_QuaternionT< T > &r, const UT_Vector3T< T > &s)
Definition: GU_AgentClip.h:100
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:460
void setSampleRate(fpreal sample_rate)
Definition: GU_AgentClip.h:437
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
UT_Array< Xform > XformArray
Definition: GU_AgentClip.h:264
const UT_StringHolder & name() const
Definition: GU_AgentClip.h:374
Quaternion class.
Definition: UT_Quaternion.h:51
fpreal32 FloatType
Definition: GU_AgentClip.h:260
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER T clip(const T &p, const Box< T > &box)
Definition: ImathBoxAlgo.h:89
fpreal64 fpreal
Definition: SYS_Types.h:277
fpreal length() const
Length of the clip, in seconds.
Definition: GU_AgentClip.h:428
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
SYS_FORCE_INLINE T & x()
Definition: UT_Vector3.h:511
exint nearestSampleFromSeconds(fpreal seconds) const
Definition: GU_AgentClip.h:556
UT_SharedPtr< Matrix4Array > Matrix4ArrayPtr
Definition: GU_AgentClip.h:267
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
const UT_StringHolder & fileName() const
Returns the name of the file referenced by the clip.
Definition: GU_AgentClip.h:384
#define const
Definition: zconf.h:214
void addScaled(T s, const type &xform)
Definition: GU_AgentClip.h:155
fpreal sampleRate() const
Definition: GU_AgentClip.h:435
bool hasLoadErrors() const
Returns whether there were errors when loading the clip from disk.
Definition: GU_AgentClip.h:394
GLfloat seconds
Definition: wglew.h:950
fpreal secondsFromSample(fpreal sample) const
Definition: GU_AgentClip.h:551
GLsizei samples
Definition: glew.h:2998
exint transformsPerSample() const
Number of transforms in each sample.
Definition: GU_AgentClip.h:404
GLdouble GLdouble t
Definition: glew.h:1398
bool isLoaded() const
Returns whether the clip's contents have been loaded from disk.
Definition: GU_AgentClip.h:391
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
exint sampleCount() const
Number of samples in this clip.
Definition: GU_AgentClip.h:413
const UT_QuaternionT< T > & rotate() const
Definition: GU_AgentClip.h:69
GLenum GLsizei len
Definition: glew.h:7752