HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_PackedImpl Class Referenceabstract

#include <GU_PackedImpl.h>

+ Inheritance diagram for GU_PackedImpl:

Public Types

typedef fpreal(GU_PackedImpl::* FloatGetter )(const GU_PrimPacked *) const
 
typedef void(GU_PackedImpl::* FloatSetter )(const GU_PrimPacked *, fpreal)
 
typedef GA_Size(GU_PackedImpl::* IntGetter )(const GU_PrimPacked *) const
 
typedef void(GU_PackedImpl::* IntSetter )(GU_PrimPacked *, GA_Size)
 
typedef bool(GU_PackedImpl::* BoolGetter )(const GU_PrimPacked *) const
 
typedef void(GU_PackedImpl::* BoolSetter )(GU_PrimPacked *, bool)
 
typedef const char
*(GU_PackedImpl::* 
StringGetter )(const GU_PrimPacked *) const
 
typedef void(GU_PackedImpl::* StringSetter )(GU_PrimPacked *, const char *)
 
typedef std::string(GU_PackedImpl::* StdStringGetter )(const GU_PrimPacked *) const
 
typedef void(GU_PackedImpl::* StdStringSetter )(GU_PrimPacked *, const std::string &)
 
typedef UT_StringHolder(GU_PackedImpl::* StringHolderGetter )(const GU_PrimPacked *) const
 
typedef void(GU_PackedImpl::* StringHolderSetter )(GU_PrimPacked *, const UT_StringHolder &)
 
typedef fpreal(GU_PackedImpl::* FloatTupleGetter )(const GU_PrimPacked *, exint) const
 
typedef void(GU_PackedImpl::* FloatTupleSetter )(GU_PrimPacked *, exint, fpreal)
 
typedef GA_Size(GU_PackedImpl::* IntTupleGetter )(const GU_PrimPacked *, exint) const
 
typedef void(GU_PackedImpl::* IntTupleSetter )(GU_PrimPacked *, exint, GA_Size)
 
typedef bool(GU_PackedImpl::* BoolTupleGetter )(const GU_PrimPacked *, exint) const
 
typedef void(GU_PackedImpl::* BoolTupleSetter )(GU_PrimPacked *, exint, bool)
 
typedef const char
*(GU_PackedImpl::* 
StringTupleGetter )(const GU_PrimPacked *, exint) const
 
typedef void(GU_PackedImpl::* StringTupleSetter )(GU_PrimPacked *, exint, const char *)
 
typedef std::string(GU_PackedImpl::* StdStringTupleGetter )(const GU_PrimPacked *, exint) const
 
typedef void(GU_PackedImpl::* StdStringTupleSetter )(GU_PrimPacked *, exint, const std::string &)
 
typedef UT_StringHolder(GU_PackedImpl::* StringHolderTupleGetter )(const GU_PrimPacked *, exint) const
 
typedef void(GU_PackedImpl::* StringHolderTupleSetter )(GU_PrimPacked *, exint, const UT_StringHolder &)
 
typedef void(GU_PackedImpl::* F32VectorGetter )(const GU_PrimPacked *, fpreal32 *, exint) const
 
typedef void(GU_PackedImpl::* F32VectorSetter )(GU_PrimPacked *, const fpreal32 *, exint)
 
typedef void(GU_PackedImpl::* F64VectorGetter )(const GU_PrimPacked *, fpreal64 *, exint) const
 
typedef void(GU_PackedImpl::* F64VectorSetter )(GU_PrimPacked *, const fpreal64 *, exint)
 
typedef void(GU_PackedImpl::* I32VectorGetter )(const GU_PrimPacked *, int32 *, exint) const
 
typedef void(GU_PackedImpl::* I32VectorSetter )(GU_PrimPacked *, const int32 *, exint)
 
typedef void(GU_PackedImpl::* I64VectorGetter )(const GU_PrimPacked *, int64 *, exint) const
 
typedef void(GU_PackedImpl::* I64VectorSetter )(GU_PrimPacked *, const int64 *, exint)
 
typedef void(GU_PackedImpl::* BVectorGetter )(const GU_PrimPacked *, bool *, exint) const
 
typedef void(GU_PackedImpl::* BVectorSetter )(GU_PrimPacked *, const bool *, exint)
 
typedef void(GU_PackedImpl::* StringArrayGetter )(const GU_PrimPacked *, UT_StringArray &) const
 
typedef void(GU_PackedImpl::* StringArraySetter )(GU_PrimPacked *, const UT_StringArray &)
 

Public Member Functions

 GU_PackedImpl ()
 
 GU_PackedImpl (const GU_PackedImpl &src)
 
virtual ~GU_PackedImpl ()
 
virtual GU_PackedFactorygetFactory () const =0
 Get the factory associated with this procedural. More...
 
virtual GU_PackedImplcopy () const =0
 Create a copy of this resolver. More...
 
virtual bool isValid () const =0
 Test whether the deferred load primitive data is valid. More...
 
virtual void clearData ()=0
 
virtual bool load (GU_PrimPacked *prim, const UT_Options &options, const GA_LoadMap &map)=0
 Give a UT_Options of load data, create resolver data for the primitive. More...
 
virtual bool supportsJSONLoad () const
 
virtual bool loadFromJSON (GU_PrimPacked *prim, const UT_JSONValueMap &options, const GA_LoadMap &map)
 
virtual void update (GU_PrimPacked *prim, const UT_Options &options)=0
 
virtual bool saveSharedData (UT_JSONWriter &w, GA_SaveMap &map, GA_GeometryIndex *geometryIndex) const
 
virtual bool loadSharedData (int load_data_type, const GA_SharedLoadData *item)
 
virtual bool save (UT_Options &options, const GA_SaveMap &map) const =0
 Copy the resolver data into the UT_Options for saving. More...
 
virtual bool loadUnknownToken (const char *token, UT_JSONParser &p, const GA_LoadMap &map)
 
virtual bool getBounds (UT_BoundingBox &box) const =0
 Get the bounding box for the geometry (not including transforms) More...
 
virtual bool getRenderingBounds (UT_BoundingBox &box) const =0
 
virtual void getVelocityRange (UT_Vector3 &min, UT_Vector3 &max) const =0
 
virtual void getWidthRange (fpreal &wmin, fpreal &wmax) const =0
 
virtual void getPrimitiveName (const GU_PrimPacked *prim, UT_WorkBuffer &wbuf) const
 
virtual bool getLocalTransform (UT_Matrix4D &m) const
 
virtual bool unpackWithContext (GU_Detail &destgdp, GU_PackedContext &context, const GU_PrimPacked *prim) const
 
bool unpack (GU_Detail &destgdp, const GU_PrimPacked *prim) const
 
virtual bool unpack (GU_Detail &destgdp, const UT_Matrix4D *transform) const =0
 
virtual bool unpackWithStyler (GU_Detail &destgdp, STY_StylerGroup &prim_styler_group, const STY_Styler &parent_styler, const GU_PrimPacked *prim) const
 
virtual void forceLoad () const
 
virtual bool isLoaded () const
 
virtual bool unpackUsingPolygons (GU_Detail &destgdp, const GU_PrimPacked *prim) const
 
virtual GU_ConstDetailHandle getPackedDetail (GU_PackedContext *context=0) const
 
bool pointInstanceTransform () const
 
bool intrinsicPointInstanceTransform (const GU_PrimPacked *prim) const
 
void setPointInstanceTransform (GU_PrimPacked *prim, bool b)
 Set whether point instancing should be used. More...
 
void topologyDirty ()
 Indicate that topology and attributes are dirty. More...
 
GU_PrimPackedgetPrim ()
 
const GU_PrimPackedgetPrim () const
 
virtual int64 getMemoryUsage (bool inclusive) const =0
 Report memory usage (includes all shared memory) More...
 
virtual void countMemory (UT_MemoryCounter &counter, bool inclusive) const =0
 
virtual bool saveCachedBBox () const
 
int64 intrinsic3Tuple (const GU_PrimPacked *prim) const
 
int64 intrinsic6Tuple (const GU_PrimPacked *prim) const
 
int64 intrinsic9Tuple (const GU_PrimPacked *prim) const
 
int64 intrinsic16Tuple (const GU_PrimPacked *prim) const
 
std::string intrinsicPrimitiveName (const GU_PrimPacked *prim) const
 
const char * intrinsicFactoryName (const GU_PrimPacked *prim) const
 
const char * intrinsicFactoryLabel (const GU_PrimPacked *prim) const
 
void intrinsicPackedBox (const GU_PrimPacked *prim, fpreal64 *vals, exint sz) const
 
void intrinsicPackedRenderBox (const GU_PrimPacked *prim, fpreal64 *vals, exint sz) const
 
void intrinsicPivot (const GU_PrimPacked *prim, fpreal64 *vals, exint sz) const
 
void intrinsicSetPivot (GU_PrimPacked *prim, const fpreal64 *vals, exint sz)
 
void intrinsicPrimTransform (const GU_PrimPacked *prim, fpreal64 *vals, exint sz) const
 
void intrinsicSetPrimTransform (GU_PrimPacked *prim, const fpreal64 *v, exint sz)
 
void intrinsicPackedTransform (const GU_PrimPacked *prim, fpreal64 *v, exint sz) const
 
void intrinsicFullTransform (const GU_PrimPacked *prim, fpreal64 *v, exint sz) const
 
const char * intrinsicViewportLOD (const GU_PrimPacked *prim) const
 
void intrinsicSetViewportLOD (GU_PrimPacked *prim, const char *lod)
 

Static Public Member Functions

static bool computeVelocityRange (const GU_Detail *gdp, UT_Vector3 &vmin, UT_Vector3 &vmax)
 
static bool computeWidthRange (const GU_Detail *gdp, fpreal &wmin, fpreal &wmax)
 

Protected Member Functions

void copyPrimitiveGroups (GU_Detail &dest, bool force=false) const
 
bool unpackToDetail (GU_Detail &destgdp, GU_Detail *src, const UT_Matrix4D *transform) const
 
bool unpackToDetail (GU_Detail &destgdp, const GU_Detail *src, const UT_Matrix4D *transform) const
 
bool unpackToDetail (GU_Detail &destgdp, const GU_ConstDetailHandle &gdh, const UT_Matrix4D *transform) const
 Unpack the source detail handle. More...
 
virtual UT_Vector3 getBaryCenter () const
 Optional method to compute centroid (default uses bounding box) More...
 
virtual fpreal computeVolume (const UT_Vector3 &refpt) const
 Optional method to calculate volume (default uses bounding box) More...
 
virtual fpreal computeArea () const
 Optional method to calculate surface area (default uses bounding box) More...
 
virtual fpreal computePerimeter () const
 Optional method to calculate perimeter (default uses bounding box) More...
 

Static Protected Member Functions

template<typename T >
static bool import (const UT_JSONValueMap &options, const UT_StringRef &key, T &value)
 
template<typename T >
static bool import (const UT_Options &options, const UT_StringRef &key, T &value)
 

Friends

class GU_PrimPacked
 

Detailed Description

This class is used by the deferred load primitives to provide methods to handle the deferred geometry.

Load/save of shared primitive data If multiple instances of the packed primitive share data, it's possible to save this data just once (instead of per primitive).

There are two parts to saving shared data. Saving the actual data, but also saving a "key" used to resolve the shared data. The shared data itself is saved using saveSharedData(). In addition, the "key" associated with the shared data is saved per-primitive instance. During loading, the "key" is used to resolve the shared data.

When generating a key, the key must be unique within all shared data blocks for a single geometry. A simple way to do this would be to use the address of the shared data item. More complicated ways might include using a GUID, etc. For example, with a UT_SharedPtr<GU_Detail>, you might have generate a key using:

@code
UT_StringHolder makeKey(const UT_SharedPtr<GU_Detail> &detail) {
key.sprintf("sharedgeo:%p", detail.get());
return UT_StringHolder(key);
}

The saveSharedData() method writes a single JSON object to the save stream. During loading, the loader expects to load an array containing four items.

[
"string Primitive_Name",
"string Shared_Data_Type",
"string Shared_Data_Identifier",
shared_data
]

The Primitive_Name ensures that shared data resolution is tied to the specific primitive type. Kind of like a namespace.

The Shared_Data_Type is an identifier to allow primitives to store multiple types of shared data. For example, if you have a material definition and a geometry definition, these can be stored as separate shared blocks rather than creating separate shared blocks for each pair.

The Shared_Data_Identifier is a unique identifier used to specify a particular instance of a shared data block. This is the "key" that can be used to resolve the data at load time. See the makeKey() example above.

Example code might be something like

UT_StringHolder key = makeKey(mySharedObject);
if (save_map.hasSavedSharedData(key))
return true; // Another primitive has saved the shared data
map.setSavedSharedData(key);
json.jsonStringToken(getFactory()->name());
// Used for seeking (see section on loading)
geometryIndex->addEntry(key, json.getNumBytesWritten());
json.beginArray();
json.jsonString("Shared_Data_Type");
json.jsonString(key);
json.jsonBeginMap();
...
json.jsonEndMap();
// Provide a seek point used for loading
UT_WorkBuffer endkey(key);
endkey.append(GA_SAVEMAP_END_TOKEN);
geometryIndex->addEntry(endkey.buffer(), w.getNumBytesWritten());
ok = ok && w.jsonEndArray();

The save() method needs to store the key so the shared data can be resolved at load time. The identifier you use in the save method doesn't have to be the "Shared_Data_Type" string, but it does have to match the value in the load method. For example:

PrimClass::save(UT_Options &options, const GA_SaveMap &map) const {
options.setOptionS("shareddata", makeKey());
}

Shared data loading may be deferred until the shared data is actually required. This is done using a "handle" to the shared data (GA_SharedDataHandlePtr). During the load() method, you can ask for a handle to any shared data.

bool load(const UT_Options &options, const GA_LoadMap &loadmap) {
if (import(options, "shareddata", key)) {
mySharedHandle = loadmap.needSharedData(key,
getFactory()->name(), nullptr);
}

When loading primitives, the shared data is not actually available until later in the loading process. The primitive itself needs to hold a reference to the shared data handle so the shared data can be resolved at a later time.

Resolving the handle is done by asking the handle to resolve the shared data, and then extracting information from a sub-class of a GA_SharedLoadData object. If the shared data is never resolved, it's possible the GA_SharedLoadData may never read the data from the file (if the geometry format supports seeking, the loader may be able to use the offsets stored in the geometryIndex during writing). The code to resolve the data might look like:

if (mySharedHandle)
{
const GA_SharedLoadData *item;
const CustomSharedLoadData *data;
item = mySharedHandle->resolveSharedData(packed_context);
data = dynamic_cast<const CustomSharedLoadData *>(item);
if (!data)
return false; // This really shouldn't ever happen
copySharedData(data);
/// Clear the reference to the @c GA_SharedDataHandlePtr. When all
/// references to the shared handle are cleared, the handle will be
/// deleted.
mySharedHandle.clear();
}

The last piece to loading, is the actual loading of the shared data block. Since shared data blocks must be able to be loaded without a primitive object, the loading is handled by the GU_PackedFactory subclass (the loadSharedData()) method. This method should create the sub-class of the GA_SharedLoadData object that's used when resolving shared data. For example

class CustomFactory : public GU_PackedFactory
{
// The type matches the "Shared_Data_Type" described above
// The key matches the "Shared_Data_Identifier" described above
const char *type,
const char *key,
bool is_delayed_load) const
{
CustomSharedLoadData *data = new CustomSharedLoadData();
// This just load the data. For example the JSON Map saved in
// the example above (not the entire array of shared data).
if (!data->load(p))
{
delete data;
return nullptr; // Unable to load the shared data
}
return data;
}
};
Examples:
packedshareddata/GU_PackedSharedData.C, packedshareddata/GU_PackedSharedData.h, packedsphere/GU_PackedSphere.C, and packedsphere/GU_PackedSphere.h.

Definition at line 180 of file GU_PackedImpl.h.

Member Typedef Documentation

typedef bool(GU_PackedImpl::* GU_PackedImpl::BoolGetter)(const GU_PrimPacked *) const

Typedefs for intrinsic evaluation

Definition at line 189 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::BoolSetter)(GU_PrimPacked *, bool)

Typedefs for intrinsic evaluation

Definition at line 190 of file GU_PackedImpl.h.

typedef bool(GU_PackedImpl::* GU_PackedImpl::BoolTupleGetter)(const GU_PrimPacked *, exint) const

Typedefs for intrinsic evaluation

Definition at line 202 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::BoolTupleSetter)(GU_PrimPacked *, exint, bool)

Typedefs for intrinsic evaluation

Definition at line 203 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::BVectorGetter)(const GU_PrimPacked *, bool *, exint) const

Typedefs for intrinsic evaluation

Definition at line 219 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::BVectorSetter)(GU_PrimPacked *, const bool *, exint)

Typedefs for intrinsic evaluation

Definition at line 220 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::F32VectorGetter)(const GU_PrimPacked *, fpreal32 *, exint) const

Typedefs for intrinsic evaluation

Definition at line 211 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::F32VectorSetter)(GU_PrimPacked *, const fpreal32 *, exint)

Typedefs for intrinsic evaluation

Definition at line 212 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::F64VectorGetter)(const GU_PrimPacked *, fpreal64 *, exint) const

Typedefs for intrinsic evaluation

Definition at line 213 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::F64VectorSetter)(GU_PrimPacked *, const fpreal64 *, exint)

Typedefs for intrinsic evaluation

Definition at line 214 of file GU_PackedImpl.h.

typedef fpreal(GU_PackedImpl::* GU_PackedImpl::FloatGetter)(const GU_PrimPacked *) const

Typedefs for intrinsic evaluation

Definition at line 185 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::FloatSetter)(const GU_PrimPacked *, fpreal)

Typedefs for intrinsic evaluation

Definition at line 186 of file GU_PackedImpl.h.

typedef fpreal(GU_PackedImpl::* GU_PackedImpl::FloatTupleGetter)(const GU_PrimPacked *, exint) const

Typedefs for intrinsic evaluation

Definition at line 198 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::FloatTupleSetter)(GU_PrimPacked *, exint, fpreal)

Typedefs for intrinsic evaluation

Definition at line 199 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::I32VectorGetter)(const GU_PrimPacked *, int32 *, exint) const

Typedefs for intrinsic evaluation

Definition at line 215 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::I32VectorSetter)(GU_PrimPacked *, const int32 *, exint)

Typedefs for intrinsic evaluation

Definition at line 216 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::I64VectorGetter)(const GU_PrimPacked *, int64 *, exint) const

Typedefs for intrinsic evaluation

Definition at line 217 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::I64VectorSetter)(GU_PrimPacked *, const int64 *, exint)

Typedefs for intrinsic evaluation

Definition at line 218 of file GU_PackedImpl.h.

typedef GA_Size(GU_PackedImpl::* GU_PackedImpl::IntGetter)(const GU_PrimPacked *) const

Typedefs for intrinsic evaluation

Definition at line 187 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::IntSetter)(GU_PrimPacked *, GA_Size)

Typedefs for intrinsic evaluation

Definition at line 188 of file GU_PackedImpl.h.

typedef GA_Size(GU_PackedImpl::* GU_PackedImpl::IntTupleGetter)(const GU_PrimPacked *, exint) const

Typedefs for intrinsic evaluation

Definition at line 200 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::IntTupleSetter)(GU_PrimPacked *, exint, GA_Size)

Typedefs for intrinsic evaluation

Definition at line 201 of file GU_PackedImpl.h.

typedef std::string(GU_PackedImpl::* GU_PackedImpl::StdStringGetter)(const GU_PrimPacked *) const

Typedefs for intrinsic evaluation

Definition at line 193 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::StdStringSetter)(GU_PrimPacked *, const std::string &)

Typedefs for intrinsic evaluation

Definition at line 194 of file GU_PackedImpl.h.

typedef std::string(GU_PackedImpl::* GU_PackedImpl::StdStringTupleGetter)(const GU_PrimPacked *, exint) const

Typedefs for intrinsic evaluation

Definition at line 206 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::StdStringTupleSetter)(GU_PrimPacked *, exint, const std::string &)

Typedefs for intrinsic evaluation

Definition at line 207 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::StringArrayGetter)(const GU_PrimPacked *, UT_StringArray &) const

Typedefs for intrinsic evaluation

Definition at line 222 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::StringArraySetter)(GU_PrimPacked *, const UT_StringArray &)

Typedefs for intrinsic evaluation

Definition at line 223 of file GU_PackedImpl.h.

typedef const char*(GU_PackedImpl::* GU_PackedImpl::StringGetter)(const GU_PrimPacked *) const

Typedefs for intrinsic evaluation

Definition at line 191 of file GU_PackedImpl.h.

typedef UT_StringHolder(GU_PackedImpl::* GU_PackedImpl::StringHolderGetter)(const GU_PrimPacked *) const

Typedefs for intrinsic evaluation

Definition at line 195 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::StringHolderSetter)(GU_PrimPacked *, const UT_StringHolder &)

Typedefs for intrinsic evaluation

Definition at line 196 of file GU_PackedImpl.h.

typedef UT_StringHolder(GU_PackedImpl::* GU_PackedImpl::StringHolderTupleGetter)(const GU_PrimPacked *, exint) const

Typedefs for intrinsic evaluation

Definition at line 208 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::StringHolderTupleSetter)(GU_PrimPacked *, exint, const UT_StringHolder &)

Typedefs for intrinsic evaluation

Definition at line 209 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::StringSetter)(GU_PrimPacked *, const char *)

Typedefs for intrinsic evaluation

Definition at line 192 of file GU_PackedImpl.h.

typedef const char*(GU_PackedImpl::* GU_PackedImpl::StringTupleGetter)(const GU_PrimPacked *, exint) const

Typedefs for intrinsic evaluation

Definition at line 204 of file GU_PackedImpl.h.

typedef void(GU_PackedImpl::* GU_PackedImpl::StringTupleSetter)(GU_PrimPacked *, exint, const char *)

Typedefs for intrinsic evaluation

Definition at line 205 of file GU_PackedImpl.h.

Constructor & Destructor Documentation

GU_PackedImpl::GU_PackedImpl ( )
GU_PackedImpl::GU_PackedImpl ( const GU_PackedImpl src)
virtual GU_PackedImpl::~GU_PackedImpl ( )
virtual

Member Function Documentation

virtual void GU_PackedImpl::clearData ( )
pure virtual

The clearData() method is called when the primitives are stashed during the cook of a SOP. See GA_Primitive::stashed(). This gives the primitive to optionally clear some data during the stashing process.

Implemented in GusdGU_PackedUSD, GU_Agent, GU_PackedFragment, GABC_NAMESPACE::GABC_PackedImpl, GU_PackedGeometry, GU_PackedDisk, and GU_PackedDiskSequence.

virtual fpreal GU_PackedImpl::computeArea ( ) const
protectedvirtual

Optional method to calculate surface area (default uses bounding box)

virtual fpreal GU_PackedImpl::computePerimeter ( ) const
protectedvirtual

Optional method to calculate perimeter (default uses bounding box)

static bool GU_PackedImpl::computeVelocityRange ( const GU_Detail gdp,
UT_Vector3 vmin,
UT_Vector3 vmax 
)
static

Convenience method to compute the velocity bounds for a given geometry. The geometry may be a NULL pointer.

virtual fpreal GU_PackedImpl::computeVolume ( const UT_Vector3 refpt) const
protectedvirtual

Optional method to calculate volume (default uses bounding box)

static bool GU_PackedImpl::computeWidthRange ( const GU_Detail gdp,
fpreal wmin,
fpreal wmax 
)
static
virtual GU_PackedImpl* GU_PackedImpl::copy ( ) const
pure virtual
void GU_PackedImpl::copyPrimitiveGroups ( GU_Detail dest,
bool  force = false 
) const
protected

For all the groups that this primitive belongs to, create groups on the destination detail and place all primitives in the given range into the groups. If the group already exists on the destination detail, then nothing is done (unless force is set).

virtual void GU_PackedImpl::countMemory ( UT_MemoryCounter counter,
bool  inclusive 
) const
pure virtual

Count memory usage using a UT_MemoryCounter in order to count shared memory correctly. NOTE: There's nothing outside of sizeof(*this) to count in the base class, so it can be pure virtual.

Implemented in GusdGU_PackedUSD, GU_Agent, GU_PackedFragment, GU_PackedGeometry, GU_PackedDisk, GABC_NAMESPACE::GABC_PackedImpl, and GU_PackedDiskSequence.

virtual void GU_PackedImpl::forceLoad ( ) const
inlinevirtual

Forces a load of all shared data the primitive has access to this should leave no data on disk

Reimplemented in GU_PackedFragment, and GU_PackedGeometry.

Definition at line 371 of file GU_PackedImpl.h.

virtual UT_Vector3 GU_PackedImpl::getBaryCenter ( ) const
protectedvirtual

Optional method to compute centroid (default uses bounding box)

virtual bool GU_PackedImpl::getBounds ( UT_BoundingBox box) const
pure virtual

Get the bounding box for the geometry (not including transforms)

Implemented in GusdGU_PackedUSD, GU_PackedSequence, GU_Agent, GABC_NAMESPACE::GABC_PackedImpl, GU_PackedFragment, GU_PackedGeometry, and GU_PackedDisk.

virtual GU_PackedFactory* GU_PackedImpl::getFactory ( ) const
pure virtual

Get the factory associated with this procedural.

Implemented in GusdGU_PackedUSD, GU_Agent, GU_PackedFragment, GABC_NAMESPACE::GABC_PackedImpl, GU_PackedGeometry, GU_PackedDisk, and GU_PackedDiskSequence.

virtual bool GU_PackedImpl::getLocalTransform ( UT_Matrix4D m) const
virtual

Some procedurals have an "intrinsic" transform. These are combined with the local transform on the geometry primitive.

The default method returns false and leaves the transform unchanged.

Reimplemented in GusdGU_PackedUSD, and GABC_NAMESPACE::GABC_PackedImpl.

virtual int64 GU_PackedImpl::getMemoryUsage ( bool  inclusive) const
pure virtual

Report memory usage (includes all shared memory)

Implemented in GusdGU_PackedUSD, GU_Agent, GU_PackedFragment, GU_PackedGeometry, GU_PackedDisk, GABC_NAMESPACE::GABC_PackedImpl, and GU_PackedDiskSequence.

virtual GU_ConstDetailHandle GU_PackedImpl::getPackedDetail ( GU_PackedContext context = 0) const
virtual

Get a reference to a const GU_Detail for the packed geometry. Not all implementations need to provide this. If this isn't implemented, the method should return an empty detail handle. This is meant as a quick short-cut instead of having to call unpack() which performs a full merge.

Reimplemented in GU_PackedSequence, GU_Agent, GU_PackedFragment, GU_PackedGeometry, and GU_PackedDisk.

GU_PrimPacked* GU_PackedImpl::getPrim ( )
inline

Definition at line 411 of file GU_PackedImpl.h.

const GU_PrimPacked* GU_PackedImpl::getPrim ( ) const
inline

Definition at line 413 of file GU_PackedImpl.h.

virtual void GU_PackedImpl::getPrimitiveName ( const GU_PrimPacked prim,
UT_WorkBuffer wbuf 
) const
virtual

Return the primitive's "description". This should be a unique identifier for the primitive and defaults to: "%s.%d" % (getFactory()->name(), getPrim()->getNum())

Reimplemented in GABC_NAMESPACE::GABC_PackedImpl, and GU_PackedDisk.

virtual bool GU_PackedImpl::getRenderingBounds ( UT_BoundingBox box) const
pure virtual

Get the rendering bounding box for the geometry (not including transforms). For curve and point geometry, this needs to include any "width" attributes.

Implemented in GusdGU_PackedUSD, GU_PackedSequence, GU_Agent, GABC_NAMESPACE::GABC_PackedImpl, GU_PackedFragment, GU_PackedGeometry, and GU_PackedDisk.

virtual void GU_PackedImpl::getVelocityRange ( UT_Vector3 min,
UT_Vector3 max 
) const
pure virtual

When rendering with velocity blur, the renderer needs to know the bounds on velocity to accurately compute the bounding box.

Implemented in GusdGU_PackedUSD, GU_PackedSequence, GU_Agent, GABC_NAMESPACE::GABC_PackedImpl, GU_PackedFragment, GU_PackedGeometry, and GU_PackedDisk.

virtual void GU_PackedImpl::getWidthRange ( fpreal wmin,
fpreal wmax 
) const
pure virtual

When rendering points or curves, the renderer needs to know the bounds on the width attribute to accurately compute the bounding box.

Implemented in GusdGU_PackedUSD, GU_PackedSequence, GU_Agent, GABC_NAMESPACE::GABC_PackedImpl, GU_PackedFragment, GU_PackedGeometry, and GU_PackedDisk.

template<typename T >
static bool GU_PackedImpl::import ( const UT_JSONValueMap options,
const UT_StringRef key,
T value 
)
staticprotected

Import a value from a UT_JSONValueMap or a UT_Options. This handles both the compact and expanded options and is valid for the same types as UT_JSONValueMap::import()

These import() methods can be used in the load() and loadFromJSON() methods to simplify importing code. For example, you should be able to implement a generic loadFrom() method, templated on either UT_Options or UT_JSONValueMap. You can then just

virtual bool load(const UT_Options &options, const GA_LoadMap &map)
{ return loadFrom<UT_Options>(options, map); }
virtual bool loadFromJSONValueMap(const UT_JSONValueMap &options,
const GA_LoadMap &map)
{ return loadFrom<UT_Options>(options, map); }
template<typename T >
static bool GU_PackedImpl::import ( const UT_Options options,
const UT_StringRef key,
T value 
)
staticprotected

Import a value from a UT_JSONValueMap or a UT_Options. This handles both the compact and expanded options and is valid for the same types as UT_JSONValueMap::import()

These import() methods can be used in the load() and loadFromJSON() methods to simplify importing code. For example, you should be able to implement a generic loadFrom() method, templated on either UT_Options or UT_JSONValueMap. You can then just

virtual bool load(const UT_Options &options, const GA_LoadMap &map)
{ return loadFrom<UT_Options>(options, map); }
virtual bool loadFromJSONValueMap(const UT_JSONValueMap &options,
const GA_LoadMap &map)
{ return loadFrom<UT_Options>(options, map); }
int64 GU_PackedImpl::intrinsic16Tuple ( const GU_PrimPacked prim) const
inline

Intrinsic functions

Definition at line 321 of file GU_PackedImpl.h.

int64 GU_PackedImpl::intrinsic3Tuple ( const GU_PrimPacked prim) const
inline

Intrinsic functions

Definition at line 318 of file GU_PackedImpl.h.

int64 GU_PackedImpl::intrinsic6Tuple ( const GU_PrimPacked prim) const
inline

Intrinsic functions

Definition at line 319 of file GU_PackedImpl.h.

int64 GU_PackedImpl::intrinsic9Tuple ( const GU_PrimPacked prim) const
inline

Intrinsic functions

Definition at line 320 of file GU_PackedImpl.h.

const char* GU_PackedImpl::intrinsicFactoryLabel ( const GU_PrimPacked prim) const

Intrinsic functions

const char* GU_PackedImpl::intrinsicFactoryName ( const GU_PrimPacked prim) const

Intrinsic functions

void GU_PackedImpl::intrinsicFullTransform ( const GU_PrimPacked prim,
fpreal64 v,
exint  sz 
) const

Intrinsic functions

void GU_PackedImpl::intrinsicPackedBox ( const GU_PrimPacked prim,
fpreal64 vals,
exint  sz 
) const

Intrinsic functions

void GU_PackedImpl::intrinsicPackedRenderBox ( const GU_PrimPacked prim,
fpreal64 vals,
exint  sz 
) const

Intrinsic functions

void GU_PackedImpl::intrinsicPackedTransform ( const GU_PrimPacked prim,
fpreal64 v,
exint  sz 
) const

Intrinsic functions

void GU_PackedImpl::intrinsicPivot ( const GU_PrimPacked prim,
fpreal64 vals,
exint  sz 
) const

Intrinsic functions

bool GU_PackedImpl::intrinsicPointInstanceTransform ( const GU_PrimPacked prim) const
inline

Definition at line 401 of file GU_PackedImpl.h.

std::string GU_PackedImpl::intrinsicPrimitiveName ( const GU_PrimPacked prim) const

Intrinsic functions

void GU_PackedImpl::intrinsicPrimTransform ( const GU_PrimPacked prim,
fpreal64 vals,
exint  sz 
) const

Intrinsic functions

void GU_PackedImpl::intrinsicSetPivot ( GU_PrimPacked prim,
const fpreal64 vals,
exint  sz 
)

Intrinsic functions

void GU_PackedImpl::intrinsicSetPrimTransform ( GU_PrimPacked prim,
const fpreal64 v,
exint  sz 
)

Intrinsic functions

void GU_PackedImpl::intrinsicSetViewportLOD ( GU_PrimPacked prim,
const char *  lod 
)

Intrinsic functions

const char* GU_PackedImpl::intrinsicViewportLOD ( const GU_PrimPacked prim) const

Intrinsic functions

virtual bool GU_PackedImpl::isLoaded ( ) const
inlinevirtual

Checks if this packed implementation has loaded its shared data Default implementation returns true.

Reimplemented in GU_PackedFragment, GU_PackedGeometry, GU_PackedDisk, and GU_PackedDiskSequence.

Definition at line 375 of file GU_PackedImpl.h.

virtual bool GU_PackedImpl::isValid ( ) const
pure virtual
virtual bool GU_PackedImpl::load ( GU_PrimPacked prim,
const UT_Options options,
const GA_LoadMap map 
)
pure virtual

Give a UT_Options of load data, create resolver data for the primitive.

Implemented in GU_Agent, GU_PackedFragment, GABC_NAMESPACE::GABC_PackedImpl, GU_PackedGeometry, GU_PackedDisk, and GU_PackedDiskSequence.

virtual bool GU_PackedImpl::loadFromJSON ( GU_PrimPacked prim,
const UT_JSONValueMap options,
const GA_LoadMap map 
)
inlinevirtual

The JSONValueMap represents a UT_Options. The options may be saved in compact form, but also may be saved in expanded form. If in expanded form, the value for each key's value is a UT_JSONValueMap storing the value in the "value" key. It's highly suggested you just use the protected import() convenience method which deals with this for you.

Reimplemented in GU_Agent, GU_PackedFragment, GABC_NAMESPACE::GABC_PackedImpl, GU_PackedGeometry, GU_PackedDisk, and GU_PackedDiskSequence.

Definition at line 259 of file GU_PackedImpl.h.

virtual bool GU_PackedImpl::loadSharedData ( int  load_data_type,
const GA_SharedLoadData item 
)
virtual

This method is called to resolve the shared data on load. The load_data_type given is the integer passed when you called "GA_LoadMap::needSharedData()" – which was done in load().

Reimplemented in GU_Agent, GU_PackedFragment, and GU_PackedGeometry.

virtual bool GU_PackedImpl::loadUnknownToken ( const char *  token,
UT_JSONParser p,
const GA_LoadMap map 
)
virtual

Handle unknown token/value pairs when loading the primitive. By default, this adds a warning and skips the next object. Return false if there was a critical error.

Reimplemented in GABC_NAMESPACE::GABC_PackedImpl.

bool GU_PackedImpl::pointInstanceTransform ( ) const
inline

If pointInstanceTransform() returns false, getFullTransform4() method will only use the point position as a translate. If true, getFullTransform4() will perform the standard "houdini instancing" (i.e. use the "N", "v", "rot" and other attributes to compute an orientation and translation).

The default method returns false, so only "P" is used to apply translates.

Definition at line 399 of file GU_PackedImpl.h.

virtual bool GU_PackedImpl::save ( UT_Options options,
const GA_SaveMap map 
) const
pure virtual
virtual bool GU_PackedImpl::saveCachedBBox ( ) const
inlinevirtual

Determines if we should save the bounding box to the metadata, this makes sense for fully embedded primitives, but if the primitive can be swapped out without the owner knowing, it should be avoided.

Reimplemented in GU_PackedFragment, and GU_PackedGeometry.

Definition at line 435 of file GU_PackedImpl.h.

virtual bool GU_PackedImpl::saveSharedData ( UT_JSONWriter w,
GA_SaveMap map,
GA_GeometryIndex geometryIndex 
) const
virtual

Save shared data objects to the JSON stream. This is called directly from GA_Primitive::saveSharedLoadData(). Please see GU_PackedFactory for the interface to create the shared data loader.

Reimplemented in GU_Agent, GU_PackedFragment, and GU_PackedGeometry.

void GU_PackedImpl::setPointInstanceTransform ( GU_PrimPacked prim,
bool  b 
)

Set whether point instancing should be used.

virtual bool GU_PackedImpl::supportsJSONLoad ( ) const
inlinevirtual

Determines if we support loading from a JSONParser directly rather than just from a UT_Options. Loading from JSON is typically more efficient than loading from a UT_Options since the file loader doesn't have to convert the JSON map to a UT_Options.

Reimplemented in GU_Agent, GU_PackedFragment, GABC_NAMESPACE::GABC_PackedImpl, GU_PackedGeometry, GU_PackedDisk, and GU_PackedDiskSequence.

Definition at line 252 of file GU_PackedImpl.h.

void GU_PackedImpl::topologyDirty ( )

Indicate that topology and attributes are dirty.

bool GU_PackedImpl::unpack ( GU_Detail destgdp,
const GU_PrimPacked prim 
) const

Unpacks this into destgdp, transforming the new geometry by the transform of prim. If prim is nullptr, no transform will be applied.

virtual bool GU_PackedImpl::unpack ( GU_Detail destgdp,
const UT_Matrix4D transform 
) const
pure virtual

Unpacks this into destgdp, transforming the new geometry by the given transform. If transform is nullptr, no transform will be applied.

Implemented in GU_PackedSequence, GU_Agent, GABC_NAMESPACE::GABC_PackedImpl, GU_PackedFragment, GU_PackedGeometry, and GU_PackedDisk.

bool GU_PackedImpl::unpackToDetail ( GU_Detail destgdp,
GU_Detail src,
const UT_Matrix4D transform 
) const
protected

Unpack the source detail into the destination detail. The source detail may be modified (attributes may be promoted)

The src detail is not deleted by unpackToDetail.

bool GU_PackedImpl::unpackToDetail ( GU_Detail destgdp,
const GU_Detail src,
const UT_Matrix4D transform 
) const
protected

Unpack the source detail into the destination detail. The source detail is const and will not be modified. However, this may be more expensive than the non-const version.

bool GU_PackedImpl::unpackToDetail ( GU_Detail destgdp,
const GU_ConstDetailHandle gdh,
const UT_Matrix4D transform 
) const
inlineprotected

Unpack the source detail handle.

Definition at line 458 of file GU_PackedImpl.h.

virtual bool GU_PackedImpl::unpackUsingPolygons ( GU_Detail destgdp,
const GU_PrimPacked prim 
) const
virtual

Unpack the procedural into a GU_Detail using polygons instead of polygon soups. The default method just unpacks, then converts polygon soups to polygons.

Reimplemented in GABC_NAMESPACE::GABC_PackedImpl.

virtual bool GU_PackedImpl::unpackWithContext ( GU_Detail destgdp,
GU_PackedContext context,
const GU_PrimPacked prim 
) const
inlinevirtual

Unpack the procedural into a GU_Detail. By default, this calls getGTFull() and converts the GT geometry to a GU_Detail.

Reimplemented in GU_PackedGeometry.

Definition at line 345 of file GU_PackedImpl.h.

virtual bool GU_PackedImpl::unpackWithStyler ( GU_Detail destgdp,
STY_StylerGroup prim_styler_group,
const STY_Styler parent_styler,
const GU_PrimPacked prim 
) const
virtual

Unpack into a GU_Detail, and generate stylers for each primitive. By default calls unpack, prunes the supplied styler for each generated primitive, and adds the styles in the material_stylesheet attribute for each primitive.

Reimplemented in GU_Agent.

virtual void GU_PackedImpl::update ( GU_PrimPacked prim,
const UT_Options options 
)
pure virtual

Depending on the update, the procedural should call one of:

Implemented in GU_Agent, GABC_NAMESPACE::GABC_PackedImpl, GU_PackedFragment, GU_PackedGeometry, GU_PackedDisk, and GU_PackedDiskSequence.

Examples:
packedsphere/packedsphere.C.

Friends And Related Function Documentation

friend class GU_PrimPacked
friend

Definition at line 503 of file GU_PackedImpl.h.


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