Nebula
Loading...
Searching...
No Matches
Physics::StreamActorPool Class Reference

#include <streamactorpool.h>

Inherits Resources::ResourceLoader.

Public Member Functions

 StreamActorPool ()
 constructor
 
virtual ~StreamActorPool ()
 destructor
 
void Setup () override
 setup resource loader, initiates the placeholder and error resources if valid
 
ActorId CreateActorInstance (ActorResourceId id, Math::transform const &trans, Physics::ActorType type, uint64_t userData, IndexT scene=0)
 
ActorId CreateActorInstance (PhysicsResourceId id, Math::transform const &trans, Physics::ActorType type, uint64_t userData, IndexT scene=0)
 
void DiscardActorInstance (ActorId id)
 destroys an actor, if the actor was created from a resource it also reduces use count of resource
 
AggregateId CreateAggregate (PhysicsResourceId id, Math::transform const &trans, Physics::ActorType type, uint64_t userData, IndexT scene=0)
 
void DiscardAggregateInstance (AggregateId id)
 
PhysicsResource::PhysicsResourceUnion GetResourceType (PhysicsResourceId id)
 
- Public Member Functions inherited from Resources::ResourceLoader
 ResourceLoader ()
 constructor
 
virtual ~ResourceLoader ()
 destructor
 
virtual void Discard ()
 discard resource loader
 
virtual void LoadFallbackResources ()
 load placeholder and error resources
 
Resources::ResourceId CreateResource (const Resources::ResourceName &res, const void *loadInfo, SizeT loadInfoSize, const Util::StringAtom &tag, std::function< void(const Resources::ResourceId)> success, std::function< void(const Resources::ResourceId)> failed, bool immediate, bool stream)
 create a container with a tag associated with it, if no tag is provided, the resource will be untagged
 
void DiscardResource (const Resources::ResourceId id)
 discard container
 
void DiscardByTag (const Util::StringAtom &tag)
 discard all resources associated with a tag
 
void CreateListener (const Resources::ResourceId res, std::function< void(const Resources::ResourceId)> success, std::function< void(const Resources::ResourceId)> failed)
 Create new listener on resource.
 
const Resources::ResourceNameGetName (const Resources::ResourceId id) const
 get resource name
 
const uint32_t GetUsage (const Resources::ResourceId id) const
 get resource usage from resource id
 
const Util::StringAtom GetTag (const Resources::ResourceId id) const
 get resource tag was first registered with
 
const Resource::State GetState (const Resources::ResourceId id) const
 get resource state
 
const Resources::ResourceId GetId (const Resources::ResourceName &name) const
 get resource id by name, use with care
 
const Util::Dictionary< Resources::ResourceName, Ids::Id32 > & GetResources () const
 get the dictionary of all resource-id pairs
 
const bool HasResource (const Resources::ResourceId id) const
 returns true if pool has resource
 
const int32_t & GetUniqueId () const
 get the global identifier for this pool
 
void ReloadResource (const Resources::ResourceName &res, std::function< void(const Resources::ResourceId)> success, std::function< void(const Resources::ResourceId)> failed)
 reload resource using resource name
 
void ReloadResource (const Resources::ResourceId &id, std::function< void(const Resources::ResourceId)> success, std::function< void(const Resources::ResourceId)> failed)
 reload resource using resource id
 
void SetMinLod (const Resources::ResourceId &id, const float lod, bool immediate)
 begin updating a resources lod
 
- Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
 
int GetRefCount () const
 get the current refcount
 
void AddRef ()
 increment refcount by one
 
void Release ()
 decrement refcount and destroy object if refcount is zero
 
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
 
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
 
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
 
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
 
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
 
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
 
const Util::StringGetClassName () const
 get the class name
 
Util::FourCC GetClassFourCC () const
 get the class FourCC code
 

Private Types

enum  { Info }
 

Private Member Functions

 __DeclareClass (StreamActorPool)
 
ResourceLoader::ResourceInitOutput InitializeResource (const ResourceLoadJob &job, const Ptr< IO::Stream > &stream) override
 perform actual load, override in subclass
 
void Unload (const Resources::ResourceId id) override
 unload resource
 

Private Attributes

Ids::IdAllocatorSafe< 0xFFFF, ActorInfoactorAllocator
 
Ids::IdAllocatorSafe< 0xFFFF, ConstraintInfoconstraintAllocator
 
Ids::IdAllocatorSafe< 0xFFFF, AggregateInfoaggregateAllocator
 
Ids::IdAllocatorSafe< 0xFFFF, PhysicsResource::PhysicsResourceUnion, Ids::Id32resourceAllocator
 

Additional Inherited Members

- Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)
 
- Protected Member Functions inherited from Resources::ResourceLoader
virtual void UpdateLoaderSyncState ()
 Update loader internal state.
 
virtual ResourceStreamOutput StreamResource (const ResourceLoadJob &job)
 Stream resource.
 
virtual Resource::State ReloadFromStream (const Resources::ResourceId id, const Ptr< IO::Stream > &stream)
 perform a reload
 
virtual uint LodMask (const _StreamData &stream, float lod, bool async) const
 Create load mask based on LOD. This will be used to determine if the resoure is fully loaded.
 
virtual void RequestLOD (const Ids::Id32 entry, float lod) const
 Set lod factor for resource.
 
virtual void Update (IndexT frameIndex)
 update the resource loader, this is done every frame
 
void SetupIdFromEntry (const Ids::Id32 entry, ResourceId &cacheEntry)
 Construct resource ID based on loader entry.
 
void RunCallbacks (Resource::State status, const Resources::ResourceId id)
 run callbacks
 
void EnqueueJob (const std::function< void()> &func)
 Issue async job.
 
Resources::ResourceId GetPlaceholder (const Resources::ResourceName &name)
 get placeholder based on resource name
 
- Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)
 
- Protected Attributes inherited from Resources::ResourceLoader
Util::FixedArray< _PlaceholderResourceplaceholders
 
Util::StringAtom placeholderResourceName
 these types need to be properly initiated in a subclass Setup function
 
Util::StringAtom failResourceName
 
Resources::ResourceId placeholderResourceId
 
Resources::ResourceId failResourceId
 
bool async
 
Ptr< ResourceLoaderThreadstreamerThread
 
std::function< void()> preJobFunc
 
std::function< void()> postJobFunc
 
Util::StringAtom streamerThreadName
 
Util::Array< IndexTpendingLoads
 
Util::Array< _PendingResourceUnloadpendingUnloads
 
Util::Array< _PendingStreamLodpendingStreamLods
 
Threading::SafeQueue< _PendingStreamLodpendingStreamQueue
 
Threading::SafeQueue< ResourceLoadOutputloadOutputs
 
Util::Array< ResourceLoadJobdependentJobs
 
Util::Dictionary< Resources::ResourceName, uint32_t > ids
 
Ids::IdPool resourceInstanceIndexPool
 
Util::FixedArray< Resources::ResourceNamenames
 
Util::FixedArray< uint32_t > usage
 
Util::FixedArray< Util::StringAtomtags
 
Util::FixedArray< Resource::Statestates
 
Util::FixedArray< LoadStateloadStates
 
Util::FixedArray< ResourceId > resources
 
Util::FixedArray< Util::Array< _Callbacks > > callbacks
 
Util::FixedArray< _PendingResourceLoadloads
 
Util::FixedArray< _LoadMetaDatametaData
 
Util::FixedArray< _StreamDatastreamDatas
 
uint32_t uniqueResourceId
 
int32_t uniqueId
 id in resource manager
 
Threading::CriticalSection asyncSection
 async section to sync callbacks and pending list with thread
 
Threading::ThreadId creatorThread
 
- Static Protected Attributes inherited from Resources::ResourceLoader
static const uint32_t ResourceIndexGrow = 512
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
Info 

Constructor & Destructor Documentation

◆ StreamActorPool()

Physics::StreamActorPool::StreamActorPool ( )

constructor

◆ ~StreamActorPool()

Physics::StreamActorPool::~StreamActorPool ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

Physics::StreamActorPool::__DeclareClass ( StreamActorPool )
private

◆ CreateActorInstance() [1/2]

ActorId Physics::StreamActorPool::CreateActorInstance ( ActorResourceId id,
Math::transform const & trans,
Physics::ActorType type,
uint64_t userData,
IndexT scene = 0 )

◆ CreateActorInstance() [2/2]

ActorId Physics::StreamActorPool::CreateActorInstance ( PhysicsResourceId id,
Math::transform const & trans,
Physics::ActorType type,
uint64_t userData,
IndexT scene = 0 )

◆ CreateAggregate()

AggregateId Physics::StreamActorPool::CreateAggregate ( PhysicsResourceId id,
Math::transform const & trans,
Physics::ActorType type,
uint64_t userData,
IndexT scene = 0 )

◆ DiscardActorInstance()

void Physics::StreamActorPool::DiscardActorInstance ( ActorId id)

destroys an actor, if the actor was created from a resource it also reduces use count of resource

◆ DiscardAggregateInstance()

void Physics::StreamActorPool::DiscardAggregateInstance ( AggregateId id)

◆ GetResourceType()

PhysicsResource::PhysicsResourceUnion Physics::StreamActorPool::GetResourceType ( PhysicsResourceId id)

◆ InitializeResource()

Resources::ResourceLoader::ResourceInitOutput Physics::StreamActorPool::InitializeResource ( const ResourceLoadJob & job,
const Ptr< IO::Stream > & stream )
overrideprivatevirtual

perform actual load, override in subclass

during the load-phase, we can safetly get the structs

Implements Resources::ResourceLoader.

◆ Setup()

void Physics::StreamActorPool::Setup ( )
overridevirtual

setup resource loader, initiates the placeholder and error resources if valid

Reimplemented from Resources::ResourceLoader.

◆ Unload()

void Physics::StreamActorPool::Unload ( const Resources::ResourceId id)
overrideprivatevirtual

unload resource

Implements Resources::ResourceLoader.

Member Data Documentation

◆ actorAllocator

Ids::IdAllocatorSafe<0xFFFF, ActorInfo> Physics::StreamActorPool::actorAllocator
private

◆ aggregateAllocator

Ids::IdAllocatorSafe<0xFFFF, AggregateInfo> Physics::StreamActorPool::aggregateAllocator
private

◆ constraintAllocator

Ids::IdAllocatorSafe<0xFFFF, ConstraintInfo> Physics::StreamActorPool::constraintAllocator
private

◆ resourceAllocator

Ids::IdAllocatorSafe<0xFFFF, PhysicsResource::PhysicsResourceUnion, Ids::Id32> Physics::StreamActorPool::resourceAllocator
private

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