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

A shape belonging to agents, instanced with material assignments. More...

#include <GT_PrimAgentShape.h>

+ Inheritance diagram for GT_PrimAgentShape:

Classes

class  ShapeInstance
 

Public Member Functions

 GT_PrimAgentShape ()
 
 GT_PrimAgentShape (const GT_PrimAgentShape &shape)
 
 GT_PrimAgentShape (const GT_PrimitiveHandle &geometry, const GU_ConstDetailHandle &dh, const GT_ShapeLODGroupHandle &agent_group, int lod_level, GT_DataArray *mat_remap)
 
 ~GT_PrimAgentShape () override
 
const GT_PrimitiveHandlegeometry () const
 shape geometry. More...
 
GU_ConstDetailHandledetail () const
 
const GT_ShapeLODGroupHandleshapeGroup () const
 Access to the shared data between LOD levels of the same agent shape. More...
 
int lodLevel () const
 Which LOD level this shape represents: 0=primary, 1+ lower resolutions. More...
 
exint getNumMatGroups () const
 one set of transforms per material. More...
 
exint getMatGroupNumInstances (exint grp_idx) const
 
int getMatGroupMaterialID (exint grp_idx) const
 
const UT_IntArraygetMatGroupAgentPrimIDs (exint grp_idx) const
 
const UT_IntArraygetMatGroupAgentPointIDs (exint grp_idx) const
 
GT_DataArrayHandle getMatRemapAttrib () const
 
int getNumTransformsPerInstance () const
 
int getNumBlendWeightsPerInstance () const
 
int getNumPoints () const
 
bool hasBlendShapeNormalOffsets () const
 
void getMatGroupTransforms (exint grp_idx, UT_Matrix4FArray &xforms, bool packed_xform_only) const
 
void fetchMatGroupTransforms (int idx, UT_Matrix4F *buf, bool packed_xform_only) const
 Copy transforms into a fp32 mat buffer. Must be num_instances in size. More...
 
void fetchMatGroupRigTransforms (int idx, fpreal32 *buf) const
 
void fetchMatGroupBlendWeights (int idx, std::pair< int32, fpreal32 > *active_targets) const
 
void fetchMatGroupColors (int idx, uint8 *buf) const
 Copy colors into a 4 x uint8 buffer. More...
 
int getVisibleInstances (int grp_idx, UT_IntArray &inst_idx, int lod_base=0.0, fpreal lod_bias=1.0) const
 
void addShapeInstance (int xform_index, int material_id, GA_Index agent_prim_idx, GA_Index agent_pnt_idx, const GT_AgentShapeBindingID &binding)
 Add a instance. More...
 
const char * className () const override
 
int getPrimitiveType () const override
 
void enlargeBounds (UT_BoundingBox boxes[], int nsegments) const override
 
void enlargeRenderBounds (UT_BoundingBox boxes[], int nsegments) const override
 
int getMotionSegments () const override
 
int64 getMemoryUsage () const override
 
GT_PrimitiveHandle doSoftCopy () const override
 
GT_PrimitiveHandle doHarden () const override
 
bool refine (GT_Refine &refiner, const GT_RefineParms *parms=NULL) const override
 
bool getTopologyVersion (int64 &version) const override
 Returns the topology version for the primitive. More...
 
int getNumUnstyledGroups () const
 
ShapeInstancegetShapeInstancesForUnstyledGroup (int mat_group)
 
void resetStyledMatGroups ()
 
ShapeInstanceaddStyledMatGroup (int mat_id)
 
- Public Member Functions inherited from GT_Primitive
 GT_Primitive ()
 
 GT_Primitive (const GT_Primitive &src)
 
virtual ~GT_Primitive ()
 
virtual bool getUniqueID (int64 &id) const
 
virtual void getVelocityRange (UT_Vector3 &min, UT_Vector3 &max, const UT_StringRef &attribute_name=GA_Names::v) const
 
const GT_TransformHandlegetPrimitiveTransform () const
 
void setPrimitiveTransform (const GT_TransformHandle &x)
 Set the transform for a the primitive. More...
 
GT_PrimitiveHandle clone () const
 
virtual bool hasDataArray (const UT_StringRef &name, GT_Owner owner_scope[], int num_owners, GT_Storage *storage=NULL, GT_Size *tuple_size=NULL) const
 
virtual bool updateGeoPrim (const GU_ConstDetailHandle &dtl, const GT_RefineParms &parms)
 update any cached data for geometry and its attributes More...
 
void setStaticGeometry (bool static_geo)
 Return true if the primitive represents geometry at frame 'fr'. More...
 
bool isStaticGeometry () const
 
bool isFrameInfoAvailable () const
 
bool getDataIdHash (int64 &hash, int segment=0, bool cache_data_id=false) const
 
GT_DataArrayHandle findAttribute (const UT_StringRef &name, GT_Owner &owner, int segment) const
 
void dumpAttributeLists (const char *label, bool data_too) const
 print out all attribute lists More...
 
void dumpPrimitive () const
 
bool saveAttributeLists (UT_JSONWriter &w) const
 
virtual bool save (UT_JSONWriter &w) const
 
virtual const
GT_ViewportRefineOptions
viewportRefineOptions () const
 
GT_PrimitiveHandle harden () const
 
GT_PrimitiveHandle copyTransformed (const GT_TransformHandle &x, bool force=false) const
 
void refineCopyTransformFrom (const GT_Primitive &src)
 
GT_PrimitiveHandle attributeMerge (const GT_Primitive &src, const UT_StringMMPattern *vertex_pattern, const UT_StringMMPattern *point_pattern, const UT_StringMMPattern *uniform_pattern, const UT_StringMMPattern *detail_pattern) const
 
virtual GT_PrimitiveHandle doAttributeMerge (const GT_Primitive &src, const UT_StringMMPattern *vertex, const UT_StringMMPattern *point, const UT_StringMMPattern *uniform, const UT_StringMMPattern *detail) const
 The virtual implementation of attribute merging. More...
 
bool enlargeWidth (UT_BoundingBox boxes[], int nsegments, fpreal defwidth=-1) const
 
virtual const
GT_AttributeListHandle
getPointAttributes () const
 
virtual const
GT_AttributeListHandle
getVertexAttributes () const
 
virtual const
GT_AttributeListHandle
getUniformAttributes () const
 
virtual const
GT_AttributeListHandle
getDetailAttributes () const
 
const GT_AttributeListHandlegetAttributeList (GT_Owner owner) const
 
virtual const GT_DataArrayHandlegetVertexList () const
 
virtual GT_DataArrayHandle createPointNormals (int segment=0, const UT_StringRef &P=GA_Names::P, bool normalize=true, const fpreal32 *pntdata=NULL, GT_Storage store=GT_STORE_REAL32) const
 
virtual fpreal computePerimeter (int seg=0) const
 
virtual fpreal computeSurfaceArea (int seg=0) const
 
virtual fpreal computeVolume (const UT_Vector3 &ref_P, int seg=0) const
 
- Public Member Functions inherited from UT_IntrusiveRefCounter< GT_Primitive >
SYS_FORCE_INLINE UT_IntrusiveRefCounter () noexcept
 Default constructor: Sets counter to 0. More...
 
SYS_FORCE_INLINE UT_IntrusiveRefCounter (const UT_IntrusiveRefCounter &) noexcept
 Copy constructor: Sets counter to 0. More...
 
UT_IntrusiveRefCounteroperator= (const UT_IntrusiveRefCounter &) noexcept
 Assignment operator: Does not modify counter. More...
 
SYS_FORCE_INLINE uint32 use_count () const noexcept
 Return current counter. More...
 
SYS_FORCE_INLINE bool conditionalAddRef () noexcept
 

Additional Inherited Members

- Static Public Member Functions inherited from GT_Primitive
static int createPrimitiveTypeId ()
 
static GT_AttributeListHandle mergeAttributeLists (bool &changed, const GT_AttributeListHandle &src, const GT_AttributeListHandle &merge, const UT_StringMMPattern *pattern, const UT_StringMMPattern *alternate=NULL)
 
static bool computeVelocityRange (UT_Vector3 &vmin, UT_Vector3 &vmax, const GT_DataArrayHandle &v)
 
static GT_PrimitiveHandle refineDetail (const GU_ConstDetailHandle &detail, const GT_RefineParms *parms)
 
static GT_PrimitiveHandle refinePrimitive (const GT_PrimitiveHandle &primh, const GT_RefineParms *parms)
 
static voidoperator new (size_t size)
 
static voidoperator new (size_t size, void *p)
 
static void operator delete (void *p, size_t size)
 
- Protected Member Functions inherited from GT_Primitive
void enlargeP (UT_BoundingBox &box, const GT_AttributeListHandle &list, int segment) const
 
void enlargeP (UT_BoundingBox &B, const GT_DataArrayHandle &P) const
 Convenience method to enlarge a bounding box given a position attribute. More...
 
void enlargePw (UT_BoundingBox &B, const GT_DataArrayHandle &P) const
 
- Protected Member Functions inherited from UT_IntrusiveRefCounter< GT_Primitive >
SYS_FORCE_INLINE ~UT_IntrusiveRefCounter ()
 Destructor: Only derived classes can destruct this. More...
 

Detailed Description

A shape belonging to agents, instanced with material assignments.

Definition at line 32 of file GT_PrimAgentShape.h.

Constructor & Destructor Documentation

GT_PrimAgentShape::GT_PrimAgentShape ( )
GT_PrimAgentShape::GT_PrimAgentShape ( const GT_PrimAgentShape shape)
GT_PrimAgentShape::GT_PrimAgentShape ( const GT_PrimitiveHandle geometry,
const GU_ConstDetailHandle dh,
const GT_ShapeLODGroupHandle agent_group,
int  lod_level,
GT_DataArray mat_remap 
)
GT_PrimAgentShape::~GT_PrimAgentShape ( )
override

Member Function Documentation

void GT_PrimAgentShape::addShapeInstance ( int  xform_index,
int  material_id,
GA_Index  agent_prim_idx,
GA_Index  agent_pnt_idx,
const GT_AgentShapeBindingID binding 
)

Add a instance.

GT_PrimAgentShape::ShapeInstance * GT_PrimAgentShape::addStyledMatGroup ( int  mat_id)
inline

Definition at line 245 of file GT_PrimAgentShape.h.

const char* GT_PrimAgentShape::className ( ) const
inlineoverridevirtual

Implements GT_Primitive.

Definition at line 118 of file GT_PrimAgentShape.h.

GU_ConstDetailHandle & GT_PrimAgentShape::detail ( ) const
inline

Definition at line 254 of file GT_PrimAgentShape.h.

GT_PrimitiveHandle GT_PrimAgentShape::doHarden ( ) const
inlineoverridevirtual

Hardening the primitive will return a copy of the primitive, but without any dangling references. The default implementation returns a NULL ptr.

Reimplemented from GT_Primitive.

Definition at line 132 of file GT_PrimAgentShape.h.

GT_PrimitiveHandle GT_PrimAgentShape::doSoftCopy ( ) const
inlineoverridevirtual

Create a copy of the primitive, referencing all the source data This can return a NULL pointer, but it would be better to implement it properly.

Implements GT_Primitive.

Definition at line 130 of file GT_PrimAgentShape.h.

void GT_PrimAgentShape::enlargeBounds ( UT_BoundingBox  boxes[],
int  nsegments 
) const
inlineoverridevirtual

An array of bounding boxes is passed in. There is a bounding box for each segement. Each bounding box should be enlarged appropriately.

Implements GT_Primitive.

Definition at line 122 of file GT_PrimAgentShape.h.

void GT_PrimAgentShape::enlargeRenderBounds ( UT_BoundingBox  boxes[],
int  nsegments 
) const
inlineoverridevirtual

This is used when computing bounds for rendering (not just geometric bounds). This normally just calls enlargeBounds(), but for some primitives, their bounds can be influenced by attribute values (i.e. the "width" in point mesh primitives). This allows proper bounds to be passed to mantra. Users may want to call enlargeWidth()

Reimplemented from GT_Primitive.

Definition at line 125 of file GT_PrimAgentShape.h.

void GT_PrimAgentShape::fetchMatGroupBlendWeights ( int  idx,
std::pair< int32, fpreal32 > *  active_targets 
) const

Copy weights for the active target shapes into a buffer. Must be num_instances * getNumBlendWeightsPerInstance() in size.

void GT_PrimAgentShape::fetchMatGroupColors ( int  idx,
uint8 buf 
) const

Copy colors into a 4 x uint8 buffer.

void GT_PrimAgentShape::fetchMatGroupRigTransforms ( int  idx,
fpreal32 buf 
) const

Copy rig transforms into a fp32 4x3 matrix buffer. Must be num_instances * getNumTransformsPerInstance() in size.

void GT_PrimAgentShape::fetchMatGroupTransforms ( int  idx,
UT_Matrix4F buf,
bool  packed_xform_only 
) const

Copy transforms into a fp32 mat buffer. Must be num_instances in size.

const GT_PrimitiveHandle & GT_PrimAgentShape::geometry ( ) const
inline

shape geometry.

Definition at line 181 of file GT_PrimAgentShape.h.

const UT_IntArray & GT_PrimAgentShape::getMatGroupAgentPointIDs ( exint  grp_idx) const
inline

Definition at line 216 of file GT_PrimAgentShape.h.

const UT_IntArray & GT_PrimAgentShape::getMatGroupAgentPrimIDs ( exint  grp_idx) const
inline

Definition at line 208 of file GT_PrimAgentShape.h.

int GT_PrimAgentShape::getMatGroupMaterialID ( exint  grp_idx) const
inline

Definition at line 200 of file GT_PrimAgentShape.h.

exint GT_PrimAgentShape::getMatGroupNumInstances ( exint  grp_idx) const
inline

Definition at line 192 of file GT_PrimAgentShape.h.

void GT_PrimAgentShape::getMatGroupTransforms ( exint  grp_idx,
UT_Matrix4FArray xforms,
bool  packed_xform_only 
) const

Import computed transforms into 'xforms'. If packed_xform_only is true, only the agent transforms are returned. If false, the rig * agent transforms are returned.

GT_DataArrayHandle GT_PrimAgentShape::getMatRemapAttrib ( ) const
inline

Definition at line 61 of file GT_PrimAgentShape.h.

int64 GT_PrimAgentShape::getMemoryUsage ( ) const
overridevirtual

Return an approximate memory usage. Since data may be shared, this will always be an over-estimation.

Implements GT_Primitive.

int GT_PrimAgentShape::getMotionSegments ( ) const
inlineoverridevirtual

Return the number of motion segments defined on the geometry By default, this simply returns the number of segments on P.

Implements GT_Primitive.

Definition at line 128 of file GT_PrimAgentShape.h.

int GT_PrimAgentShape::getNumBlendWeightsPerInstance ( ) const
exint GT_PrimAgentShape::getNumMatGroups ( ) const
inline

one set of transforms per material.

Definition at line 185 of file GT_PrimAgentShape.h.

int GT_PrimAgentShape::getNumPoints ( ) const

Number of points in the shape. If there are blendshapes, each target shape in the BlendShapeOffsets buffer also has this number of points.

int GT_PrimAgentShape::getNumTransformsPerInstance ( ) const
int GT_PrimAgentShape::getNumUnstyledGroups ( ) const
inline

Definition at line 224 of file GT_PrimAgentShape.h.

int GT_PrimAgentShape::getPrimitiveType ( ) const
inlineoverridevirtual

Return the primitive type. By default this returns GT_PRIM_UNDEFINED,

Reimplemented from GT_Primitive.

Definition at line 120 of file GT_PrimAgentShape.h.

GT_PrimAgentShape::ShapeInstance & GT_PrimAgentShape::getShapeInstancesForUnstyledGroup ( int  mat_group)
inline

Definition at line 230 of file GT_PrimAgentShape.h.

bool GT_PrimAgentShape::getTopologyVersion ( int64 version) const
overridevirtual

Returns the topology version for the primitive.

Reimplemented from GT_Primitive.

int GT_PrimAgentShape::getVisibleInstances ( int  grp_idx,
UT_IntArray inst_idx,
int  lod_base = 0.0,
fpreal  lod_bias = 1.0 
) const

Return a list of visible instances in this material group, based on the visibility info computed by the GT_GEOPackedAgent. returns -1 if only some are visible, 0 if none are visible, and 1 if all are visible. The 'lod_bias' is a factor that will favour lower LOD levels if > 1, and higher LOD levels if < 1. A bias of zero will disable LOD.

bool GT_PrimAgentShape::hasBlendShapeNormalOffsets ( ) const

Returns whether there are any blendshapes with normal offsets (i.e. the BlendShapeNormalOffsets buffer should be used).

int GT_PrimAgentShape::lodLevel ( ) const
inline

Which LOD level this shape represents: 0=primary, 1+ lower resolutions.

Definition at line 258 of file GT_PrimAgentShape.h.

bool GT_PrimAgentShape::refine ( GT_Refine refiner,
const GT_RefineParms parms = NULL 
) const
overridevirtual

Refine the primitive.

  • refiner
    The refiner object is responsible for processing primitives, and also giving the primitive hints on how to refine itself. The method should returns true if new primitives were added to the refiner.

Reimplemented from GT_Primitive.

void GT_PrimAgentShape::resetStyledMatGroups ( )
inline

Definition at line 236 of file GT_PrimAgentShape.h.

const GT_ShapeLODGroupHandle & GT_PrimAgentShape::shapeGroup ( ) const
inline

Access to the shared data between LOD levels of the same agent shape.

Definition at line 262 of file GT_PrimAgentShape.h.


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