HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_AgentShapeDeformer.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_AgentShapeDeformer.h (GU Library, C++)
7  *
8  */
9 
10 #ifndef __GU_AgentShapeDeformer__
11 #define __GU_AgentShapeDeformer__
12 
13 #include "GU_API.h"
14 #include "GU_AgentShapeLib.h"
15 
16 #include <UT/UT_IntrusivePtr.h>
17 #include <UT/UT_StringHolder.h>
18 
19 class GA_Range;
20 class GU_Agent;
21 class GU_Detail;
22 
27 
28 /// Defines a deformer for an agent shape.
30  : public UT_IntrusiveRefCounter<GU_AgentShapeDeformer>
31 {
32 public:
34 
35  virtual ~GU_AgentShapeDeformer() = default;
36 
37  /// Unique identifier for the deformer. This is used when serializing
38  /// layers to JSON.
39  const UT_StringHolder &name() const { return myName; }
40 
41  /// Deform the provided detail, which was unpacked from the given shape
42  /// binding (shape & transform index) and agent.
43  ///
44  /// The transform index can be used for deformers that need to know the
45  /// shape's transform in order to perform the deformation correctly (e.g.
46  /// for skinning). Deformers are not responsible for applying the transform
47  /// to the geometry - this is performed after the deformer is executed.
48  /// Note that the transform index may be -1 if the shape was not attached
49  /// to a joint.
50  virtual void deform(GU_Detail &gdp,
51  const GU_AgentShapeLib::Shape &src_shape,
52  exint xform_idx,
53  const GU_Agent &src_agent) const = 0;
54 
55  /// Compute an approximate bounding box for the deformed shape.
56  /// Similar to deform(), the shape binding's transform and bounds scale are
57  /// applied after calling this method.
58  ///
59  /// The default implementation just uses the bounding box of the source
60  /// shape (equivalent to how bounds would be computed for a static shape
61  /// binding).
62  virtual void computeBounds(UT_BoundingBox &box,
63  const GU_AgentShapeLib::Shape &src_shape,
64  exint xform_idx,
65  const GU_Agent &src_agent) const;
66 
67 private:
68  UT_StringHolder myName;
69 };
70 
71 #endif
const UT_StringHolder & name() const
int64 exint
Definition: SYS_Types.h:125
A reference counter base class for use with UT_IntrusivePtr.
A range of elements in an index-map.
Definition: GA_Range.h:42
Shape(GA_Offset offset)
Wrapper around hboost::intrusive_ptr.
#define GU_API
Definition: GU_API.h:14
GLuint const GLchar * name
Definition: glcorearb.h:786
Defines a deformer for an agent shape.