#include "GU_PackedSphere.h"
#include "GT_GEOPackedSphere.C"
using namespace HDK_Sample;
namespace
{
{
public:
SphereFactory()
, theDefaultImpl(new GU_PackedSphere())
{
registerIntrinsic(theLodStr,
IntGetterCast(&GU_PackedSphere::intrinsicLod),
IntSetterCast(&GU_PackedSphere::setLOD));
}
~SphereFactory() override {}
{
return theDefaultImpl;
}
{
return new GU_PackedSphere();
}
};
static SphereFactory *theFactory = NULL;
class CacheEntry
{
public:
: myGdp()
{
myGdp.allocateAndSet(gdp);
};
~CacheEntry()
{
}
{
}
private:
};
#define MIN_LOD 1
#define MAX_LOD 32
static CacheEntry *theCache[MAX_LOD+1];
{
if (!theCache[lod])
theCache[
lod] =
new CacheEntry(lod);
return theCache[
lod]->detail();
}
}
GU_PackedSphere::GU_PackedSphere()
, myDetail()
, myLOD(2)
{
}
GU_PackedSphere::GU_PackedSphere(
const GU_PackedSphere &
src)
, myDetail()
, myLOD(0)
{
setLOD(nullptr, src.myLOD);
}
GU_PackedSphere::~GU_PackedSphere()
{
clearSphere();
}
void
{
if (theFactory)
return;
theFactory = new SphereFactory();
if (theFactory->isRegistered())
{
theTypeId = theFactory->typeDef().getId();
GT_GEOPackedSphere::registerPrimitive(theTypeId);
}
else
{
fprintf(stderr,
"Unable to register packed sphere from %s\n",
}
}
void
GU_PackedSphere::clearSphere()
{
}
GU_PackedSphere::getFactory() const
{
return theFactory;
}
{
return new GU_PackedSphere(*this);
}
void
GU_PackedSphere::clearData()
{
}
bool
GU_PackedSphere::isValid() const
{
return detail().isValid();
}
template <typename T>
void
GU_PackedSphere::updateFrom(
GU_PrimPacked *prim,
const T &options)
{
int ival;
if (import(options, theLodStr, ival))
setLOD(prim, ival);
}
bool
{
return true;
}
bool
{
return true;
}
bool
{
return getBoundsCached(box);
}
void
{
min = 0;
max = 0;
}
void
{
min = max = 0;
}
bool
{
if (!rlock.getGdp())
return false;
return unpackToDetail(destgdp, rlock.getGdp(),
transform);
}
{
{
GU_PackedSphere *me = const_cast<GU_PackedSphere *>(this);
if (dtl != me->detail())
{
me->setDetail(dtl);
}
}
return detail();
}
GU_PackedSphere::getMemoryUsage(bool inclusive) const
{
int64 mem = inclusive ?
sizeof(*this) : 0;
mem += detail().getMemoryUsage(false);
return mem;
}
void
{
{
size_t mem = inclusive ? sizeof(*this) : 0;
mem += detail().getMemoryUsage(false);
}
#if 0
{
gdh.getGdp()->countMemory(counter, true);
}
#endif
}
void
{
clearSphere();
myLOD = l;
clearBoxCache();
if (prim)
}
void
{
GU_PackedSphere::install(f);
}