HDK
|
#include <OBJ_XformCache.h>
Public Types | |
enum | OBJ_XformType { WORLD_XFORM, LOCAL_XFORM } |
enum | OBJ_LookupStatus { HIT, MISS_VERSION, MISS_DATA } |
enum | { DEFAULT_CACHE_SIZE_KB = 150*1024 } |
enum | OBJ_MemoryState { MEMORY_CHECK_NEVER, MEMORY_CHECK_ALWAYS } |
typedef UT_ThreadSafeCache < UT_RecursiveSpinLock > | Policy |
Public Member Functions | |
OBJ_XformCache () | |
~OBJ_XformCache () override | |
const UT_DMatrix4 & | getXform (int id, fpreal time, OBJ_XformType type, OP_VERSION version, OBJ_LookupStatus &status) |
bool | setXform (int id, fpreal time, OBJ_XformType type, OP_VERSION version, const UT_DMatrix4 &xform) |
void | parseCommand (CMD_Args &args) |
void | setMemoryLimit (int64 max_memory) |
Sets the new memory limit for the cache size in bytes. More... | |
void | clear () |
Clears the cache and frees memory. More... | |
OBJ_MemoryState | getMemoryState () const |
Public Member Functions inherited from UT_Cache | |
UT_Cache () | |
virtual | ~UT_Cache () |
UT_Cache (const UT_Cache &)=delete | |
UT_Cache & | operator= (const UT_Cache &)=delete |
void | utClearCache () |
virtual bool | utHasMinSize () const |
virtual int64 | utGetMinSize () const |
virtual void | utSetMinSize (int64) |
virtual bool | utUpdateCacheInfo () |
Static Public Member Functions | |
static OBJ_XformCache * | getCache () |
Obtains the transform matrix cache used by all objects. More... | |
Static Public Member Functions inherited from UT_Cache | |
static const UT_ValArray < UT_Cache * > & | utGetCacheList () |
get the list of caches More... | |
static void | setCacheAddRemoveCB (void(*callback)(void *), void *data) |
callback to be called when a cache is added or deleted. More... | |
static int64 | utClearSpaceFromCaches (int64 amount) |
this method attempts to free up 'amount' bytes from all the caches. More... | |
Protected Member Functions | |
const char * | utGetCacheName () const override |
required - return the english name for this cache. More... | |
int64 | utGetCurrentSize () const override |
required - return the current cache size, in bytes More... | |
bool | utHasMaxSize () const override |
optional - override if the cache has a well defined maximum size More... | |
int64 | utGetMaxSize () const override |
void | utSetMaxSize (int64 size) override |
int64 | utReduceCacheSizeBy (int64 amount) override |
Friends | |
class | OBJ_XformCacheTag |
The OBJ_XformCache maintains a table of recently calculated transforms which describe world position and orientation of objects.
It can also watch memory usage to see what transform matrices should be removed from the table.
Definition at line 32 of file OBJ_XformCache.h.
Definition at line 116 of file OBJ_XformCache.h.
anonymous enum |
Enumerator | |
---|---|
DEFAULT_CACHE_SIZE_KB |
Definition at line 52 of file OBJ_XformCache.h.
Enumerator | |
---|---|
HIT | |
MISS_VERSION | |
MISS_DATA |
Definition at line 44 of file OBJ_XformCache.h.
Enumerator | |
---|---|
MEMORY_CHECK_NEVER | |
MEMORY_CHECK_ALWAYS |
Definition at line 118 of file OBJ_XformCache.h.
Enumerator | |
---|---|
WORLD_XFORM | |
LOCAL_XFORM |
Definition at line 37 of file OBJ_XformCache.h.
OBJ_XformCache::OBJ_XformCache | ( | ) |
|
override |
void OBJ_XformCache::clear | ( | ) |
Clears the cache and frees memory.
|
static |
Obtains the transform matrix cache used by all objects.
OBJ_MemoryState OBJ_XformCache::getMemoryState | ( | ) | const |
const UT_DMatrix4& OBJ_XformCache::getXform | ( | int | id, |
fpreal | time, | ||
OBJ_XformType | type, | ||
OP_VERSION | version, | ||
OBJ_LookupStatus & | status | ||
) |
querries the cache for the transform matrix INPUTS: id - the unique identification number of the operator time - the time at which the xform is applied to the object type - tranformation type version - version of parameters used to construct the xform OUTPUT: xform - on cache hit, the transform matrix, otherwise unchanged RETURNS: the status of the lookup (hit or miss)
Used as the interface to objcache, which is installed in MOT_Command.C
Sets the new memory limit for the cache size in bytes.
bool OBJ_XformCache::setXform | ( | int | id, |
fpreal | time, | ||
OBJ_XformType | type, | ||
OP_VERSION | version, | ||
const UT_DMatrix4 & | xform | ||
) |
sets the transform matrix in the cache INPUTS: id - the unique identification number of the operator time - the time at which the xform is applied to the object type - tranformation type version - version of parameters used to construct the xform RETURNS: true: if succeeded false: if failed
|
inlineoverrideprotectedvirtual |
required - return the english name for this cache.
Implements UT_Cache.
Definition at line 128 of file OBJ_XformCache.h.
|
inlineoverrideprotectedvirtual |
required - return the current cache size, in bytes
Implements UT_Cache.
Definition at line 130 of file OBJ_XformCache.h.
|
inlineoverrideprotectedvirtual |
Reimplemented from UT_Cache.
Definition at line 135 of file OBJ_XformCache.h.
|
inlineoverrideprotectedvirtual |
optional - override if the cache has a well defined maximum size
Reimplemented from UT_Cache.
Definition at line 133 of file OBJ_XformCache.h.
required - free contents of the cache by amount
bytes. Returns the amount of memory (in bytes) actually freed. This does not change the cache size
Implements UT_Cache.
Reimplemented from UT_Cache.
|
friend |
Definition at line 163 of file OBJ_XformCache.h.