HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GU_AgentLayer Class Reference

#include <GU_AgentLayer.h>

+ Inheritance diagram for GU_AgentLayer:

Classes

struct  LayerData
 Used to store the result of parsing a layer from a JSON file. More...
 
class  ShapeBinding
 
struct  ShapeBindingData
 Used to store the result of parsing a shape binding from a JSON file. More...
 

Public Types

typedef UT_StringHolder NameType
 
typedef GU_AgentShapeLib::ShapePtr ShapePtr
 
typedef UT_Array< ShapeBindingShapeArray
 
typedef ShapeArray::const_iterator const_iterator
 

Public Member Functions

 ~GU_AgentLayer ()
 
bool construct (const UT_StringArray &shape_names, const UT_IntArray &transforms, const UT_Array< GU_AgentShapeDeformerConstPtr > &deformers, const UT_FprealArray *bounds_scales=0)
 
bool construct (const UT_StringArray &shape_names, const UT_IntArray &transforms, const UT_Array< bool > &deforming, const UT_FprealArray *bounds_scales=0)
 
bool copyShapeBindings (const GU_AgentLayer &source)
 Add the shape bindings from another layer. More...
 
int64 getMemoryUsage (bool inclusive) const
 
const NameTypeuniqueName () const
 
bool isFile () const
 Return whether the layer was loaded from disk. More...
 
void clearIsFile ()
 Clear the flag marking that the layer references a file on disk. More...
 
const GU_AgentRigrig () const
 Return the rig associated with the layer. More...
 
GU_ConstDetailHandle detail () const
 Return the underlying geometry. More...
 
const GU_AgentShapeLibshapeLib () const
 Return the shape library for the layer. More...
 
exint numBoundShapes (exint xform_idx) const
 Return the number of shapes bound to a specific transform. More...
 
bool save (UT_JSONWriter &w) const
 
bool load (UT_JSONParser &p)
 Load the layer from a JSON file. More...
 
void clear ()
 Clear the layer. More...
 
const ShapeBindingshape (exint i) const
 Get binding information for the given shape. More...
 
const ShapeBindingboundShape (exint transform, exint i) const
 
const UT_IntArraygetStatic () const
 
const UT_IntArraygetDeforming () const
 
GU_ConstDetailHandle shapeGeometry (const ShapeBinding &shape_binding) const
 Get the geometry for the given shape binding. More...
 
GU_ConstDetailHandle shapeGeometry (exint i) const
 Get the geometry for the given shape index. More...
 
const GU_LinearSkinDeformerSourceshapeDeformerSource (const ShapeBinding &shape) const
 
const GU_LinearSkinDeformerSourceshapeDeformerSource (exint i) const
 
void updateShapes ()
 Update the shape bindings when the shape library gets modified. More...
 
void enlargeBounds (UT_BoundingBox &box, const UT_Matrix4FArray &xforms) const
 
bool expandVelocityRange (UT_Vector3 &vmin, UT_Vector3 &vmax) const
 Expand the given velocity range using the v attributes in the shapes. More...
 
bool unpackToDetail (GU_Detail &dest, const GU_PrimPacked &prim, const GU_Agent &agent, const GU_AgentRig &rig, const UT_Matrix4FArray &xforms, STY_StylerGroup *prim_styler_group, const STY_Styler *parent_styler) const
 
const NameTypename () const
 
void setName (const NameType &name)
 
exint entries () const
 
exint staticEntries () const
 
exint deformingEntries () const
 
bool unpackShapeToDetail (GU_Detail &dest, const ShapeBinding &binding, const GU_Agent &agent, const GU_AgentRig &rig, const UT_Matrix4FArray &xforms) const
 
bool unpackShapeToDetail (GU_Detail &dest, exint shape_i, const GU_Agent &agent, const GU_AgentRig &rig, const UT_Matrix4FArray &xforms) const
 
const_iterator begin () const
 
const_iterator end () const
 
- Public Member Functions inherited from UT_IntrusiveRefCounter< GU_AgentLayer >
SYS_FORCE_INLINE UT_IntrusiveRefCounter ()
 Default constructor: Sets counter to 0. More...
 
SYS_FORCE_INLINE UT_IntrusiveRefCounter (const UT_IntrusiveRefCounter &)
 Copy constructor: Sets counter to 0. More...
 
UT_IntrusiveRefCounteroperator= (const UT_IntrusiveRefCounter &)
 Assignment operator: Does not modify counter. More...
 
SYS_FORCE_INLINE uint32 use_count () const
 Return current counter. More...
 

Static Public Member Functions

static GU_AgentLayerPtr addLayer (const char *unique_name, const GU_AgentRigConstPtr &rig, const GU_AgentShapeLibConstPtr &shapelib)
 
static GU_AgentLayerPtr addLayerFromFile (const char *filename, const GU_AgentRigConstPtr &rig, const GU_AgentShapeLibConstPtr &shapelib, UT_StringArray &errors)
 
static GU_AgentLayerPtr addLayerCopy (const GU_AgentLayer &src, const GU_AgentRigConstPtr &rig, const GU_AgentShapeLibConstPtr &shapelib, bool copy_external_ref)
 
static void registerDeformer (const GU_AgentShapeDeformerConstPtr &deformer)
 Register a new shape deformer. More...
 
static
GU_AgentShapeDeformerConstPtr 
findDeformer (const UT_StringRef &name)
 Return the deformer with the given name, or nullptr. More...
 
static void installDeformers ()
 
static bool load (UT_JSONParser &p, LayerData &data)
 
bool load (const LayerData &data, UT_StringArray &errors)
 

Additional Inherited Members

- Protected Member Functions inherited from UT_IntrusiveRefCounter< GU_AgentLayer >
SYS_FORCE_INLINE ~UT_IntrusiveRefCounter ()
 Destructor: Only derived classes can destruct this. More...
 

Detailed Description

A packed agent

The agent is composed of multiple named layers. Each layer consists of zero or more shapes.

All agents must have a default layer. This is the layer used when a specific layer isn't found. Example layers might be:

  • "default": The default layer
  • "low": Low resolution representation
  • "medium": Medium resolution
  • "high": High resolution
  • "collision": Used for collision detection

The packed agent conforms to the GU_PackedImpl API, but also provides access to the layers/shapes.

Definition at line 42 of file GU_AgentLayer.h.

Member Typedef Documentation

Definition at line 45 of file GU_AgentLayer.h.

Definition at line 143 of file GU_AgentLayer.h.

Constructor & Destructor Documentation

GU_AgentLayer::~GU_AgentLayer ( )

Member Function Documentation

static GU_AgentLayerPtr GU_AgentLayer::addLayer ( const char *  unique_name,
const GU_AgentRigConstPtr rig,
const GU_AgentShapeLibConstPtr shapelib 
)
static
static GU_AgentLayerPtr GU_AgentLayer::addLayerCopy ( const GU_AgentLayer src,
const GU_AgentRigConstPtr rig,
const GU_AgentShapeLibConstPtr shapelib,
bool  copy_external_ref 
)
static

Create a clone of a layer, referencing the specified rig and shape library. 'copy_external_ref' should be disabled if the new layer will have its bindings changed.

static GU_AgentLayerPtr GU_AgentLayer::addLayerFromFile ( const char *  filename,
const GU_AgentRigConstPtr rig,
const GU_AgentShapeLibConstPtr shapelib,
UT_StringArray errors 
)
static
const_iterator GU_AgentLayer::begin ( void  ) const
inline

Iterators

Definition at line 327 of file GU_AgentLayer.h.

const ShapeBinding& GU_AgentLayer::boundShape ( exint  transform,
exint  i 
) const
inline

Get binding information for the ith shape bound to the given transform.

See Also
numBoundShapes

Definition at line 255 of file GU_AgentLayer.h.

void GU_AgentLayer::clear ( )

Clear the layer.

void GU_AgentLayer::clearIsFile ( )

Clear the flag marking that the layer references a file on disk.

bool GU_AgentLayer::construct ( const UT_StringArray shape_names,
const UT_IntArray transforms,
const UT_Array< GU_AgentShapeDeformerConstPtr > &  deformers,
const UT_FprealArray bounds_scales = 0 
)

Add shape bindings to a layer.

  • shape_names: The shape name for each shape binding.
  • transforms: The transform index for each shape binding.
  • deformers: A GU_AgentShapeDeformer for each shape binding, or nullptr for static shapes.
  • bounds_scales: Optional scale for the bounding boxes.
bool GU_AgentLayer::construct ( const UT_StringArray shape_names,
const UT_IntArray transforms,
const UT_Array< bool > &  deforming,
const UT_FprealArray bounds_scales = 0 
)

Add shape bindings to a layer.

  • shape_names: The shape name for each shape binding.
  • transforms: The transform index for each shape binding.
  • deforming: Whether each shape is static or deforming.
  • bounds_scales: Optional scale for the bounding boxes.
bool GU_AgentLayer::copyShapeBindings ( const GU_AgentLayer source)

Add the shape bindings from another layer.

exint GU_AgentLayer::deformingEntries ( ) const
inline

Shape count

Definition at line 227 of file GU_AgentLayer.h.

GU_ConstDetailHandle GU_AgentLayer::detail ( ) const
inline

Return the underlying geometry.

Definition at line 216 of file GU_AgentLayer.h.

const_iterator GU_AgentLayer::end ( void  ) const
inline

Iterators

Definition at line 328 of file GU_AgentLayer.h.

void GU_AgentLayer::enlargeBounds ( UT_BoundingBox box,
const UT_Matrix4FArray xforms 
) const

Enlarge bounding box based on the shapes inside along with the transform array.

exint GU_AgentLayer::entries ( void  ) const
inline

Shape count

Definition at line 223 of file GU_AgentLayer.h.

bool GU_AgentLayer::expandVelocityRange ( UT_Vector3 vmin,
UT_Vector3 vmax 
) const

Expand the given velocity range using the v attributes in the shapes.

static GU_AgentShapeDeformerConstPtr GU_AgentLayer::findDeformer ( const UT_StringRef name)
static

Return the deformer with the given name, or nullptr.

const UT_IntArray& GU_AgentLayer::getDeforming ( ) const
inline

Return the indices of the deforming shapes in the layer.

See Also
shape

Definition at line 264 of file GU_AgentLayer.h.

int64 GU_AgentLayer::getMemoryUsage ( bool  inclusive) const
const UT_IntArray& GU_AgentLayer::getStatic ( ) const
inline

Return the indices of the static shapes in the layer.

See Also
shape

Definition at line 260 of file GU_AgentLayer.h.

static void GU_AgentLayer::installDeformers ( )
static

Called by GU_Agent during startup to register default deformers and load any custom deformers.

bool GU_AgentLayer::isFile ( ) const
inline

Return whether the layer was loaded from disk.

Definition at line 208 of file GU_AgentLayer.h.

bool GU_AgentLayer::load ( UT_JSONParser p)

Load the layer from a JSON file.

static bool GU_AgentLayer::load ( UT_JSONParser p,
LayerData data 
)
static

Parse the JSON file into an intermediate format, which can be used to load the layer at a later time.

bool GU_AgentLayer::load ( const LayerData data,
UT_StringArray errors 
)

Parse the JSON file into an intermediate format, which can be used to load the layer at a later time.

const NameType& GU_AgentLayer::name ( void  ) const
inline

Name accessor

Definition at line 203 of file GU_AgentLayer.h.

exint GU_AgentLayer::numBoundShapes ( exint  xform_idx) const
inline

Return the number of shapes bound to a specific transform.

Definition at line 232 of file GU_AgentLayer.h.

static void GU_AgentLayer::registerDeformer ( const GU_AgentShapeDeformerConstPtr deformer)
static

Register a new shape deformer.

const GU_AgentRig& GU_AgentLayer::rig ( ) const
inline

Return the rig associated with the layer.

Definition at line 213 of file GU_AgentLayer.h.

bool GU_AgentLayer::save ( UT_JSONWriter w) const
void GU_AgentLayer::setName ( const NameType name)
inline

Name accessor

Definition at line 204 of file GU_AgentLayer.h.

const ShapeBinding& GU_AgentLayer::shape ( exint  i) const
inline

Get binding information for the given shape.

Definition at line 251 of file GU_AgentLayer.h.

const GU_LinearSkinDeformerSource* GU_AgentLayer::shapeDeformerSource ( const ShapeBinding shape) const

Get deformer source for given shape binding if present. Only valid for deforming shapes.

const GU_LinearSkinDeformerSource* GU_AgentLayer::shapeDeformerSource ( exint  i) const
inline

Get deformer source for given shape index if present. Only valid for deforming shapes.

Definition at line 279 of file GU_AgentLayer.h.

GU_ConstDetailHandle GU_AgentLayer::shapeGeometry ( const ShapeBinding shape_binding) const

Get the geometry for the given shape binding.

GU_ConstDetailHandle GU_AgentLayer::shapeGeometry ( exint  i) const
inline

Get the geometry for the given shape index.

Definition at line 269 of file GU_AgentLayer.h.

const GU_AgentShapeLib& GU_AgentLayer::shapeLib ( ) const
inline

Return the shape library for the layer.

Definition at line 219 of file GU_AgentLayer.h.

exint GU_AgentLayer::staticEntries ( ) const
inline

Shape count

Definition at line 225 of file GU_AgentLayer.h.

const NameType& GU_AgentLayer::uniqueName ( ) const
inline

Return a unique name for the layer (since there may e.g. be many different layer definitions named 'collision'). This is the filename if the layer was loaded from disk.

Definition at line 199 of file GU_AgentLayer.h.

bool GU_AgentLayer::unpackShapeToDetail ( GU_Detail dest,
const ShapeBinding binding,
const GU_Agent agent,
const GU_AgentRig rig,
const UT_Matrix4FArray xforms 
) const

Unpack a specific shape into a detail. NOTE: This does not transform the geometry by the agent's xform.

bool GU_AgentLayer::unpackShapeToDetail ( GU_Detail dest,
exint  shape_i,
const GU_Agent agent,
const GU_AgentRig rig,
const UT_Matrix4FArray xforms 
) const
inline

Unpack a specific shape into a detail. NOTE: This does not transform the geometry by the agent's xform.

Definition at line 312 of file GU_AgentLayer.h.

bool GU_AgentLayer::unpackToDetail ( GU_Detail dest,
const GU_PrimPacked prim,
const GU_Agent agent,
const GU_AgentRig rig,
const UT_Matrix4FArray xforms,
STY_StylerGroup prim_styler_group,
const STY_Styler parent_styler 
) const

Unpack geometry into a detail NOTE: This transforms the unpacked geometry by the agent's xform.

void GU_AgentLayer::updateShapes ( )

Update the shape bindings when the shape library gets modified.


The documentation for this class was generated from the following file: