ezEngine  Milestone 7
ezMeshBufferResource Class Reference
Inheritance diagram for ezMeshBufferResource:

Public Member Functions

EZ_FORCE_INLINE ezUInt32 GetPrimitiveCount () const
 
EZ_FORCE_INLINE ezGALBufferHandle GetVertexBuffer () const
 
EZ_FORCE_INLINE ezGALBufferHandle GetIndexBuffer () const
 
const ezVertexDeclarationInfoGetVertexDeclaration () const
 Returns the vertex declaration used by this mesh buffer.
 
- Public Member Functions inherited from ezResource< ezMeshBufferResource, ezMeshBufferResourceDescriptor >
void SetFallbackResource (const ezResourceHandle< ezMeshBufferResource > &hResource)
 Sets the fallback resource that can be used while this resource is not yet loaded. More...
 
- Public Member Functions inherited from ezResourceBase
const ezStringGetResourceID () const
 Returns the unique ID that identifies this resource. On a file resource this might be a path. Can also be a GUID or any other scheme that uniquely identifies the resource.
 
void SetResourceDescription (const char *szDescription)
 The resource description allows to store an additional string that might be more descriptive during debugging, than the unique ID.
 
const ezStringGetResourceDescription () const
 The resource description allows to store an additional string that might be more descriptive during debugging, than the unique ID.
 
ezResourceState GetLoadingState () const
 Returns the current state in which this resource is in.
 
ezUInt8 GetNumQualityLevelsDiscardable () const
 Returns the current maximum quality level that the resource could have. More...
 
ezUInt8 GetNumQualityLevelsLoadable () const
 Returns how many quality levels the resource may additionally load.
 
void SetPriority (ezResourcePriority priority)
 Sets the current priority of this resource. More...
 
ezResourcePriority GetPriority () const
 Returns the currently user-specified priority of this resource. More...
 
void SetDueDate (ezTime date=ezTime::Seconds(60.0 *60.0 *24.0 *365.0 *1000.0))
 Specifies the time (usually in the future) at which this resource is needed and should be fully loaded. More...
 
virtual ezTime GetLoadingDeadline (ezTime tNow) const
 Returns the deadline (tNow + x) at which this resource is required to be loaded. More...
 
const ezBitflags
< ezResourceFlags > & 
GetBaseResourceFlags () const
 Returns the basic flags for the resource type. Mostly used the resource manager.
 
const MemoryUsageGetMemoryUsage () const
 Returns the information about the current memory usage of the resource.
 
ezTime GetLastAcquireTime () const
 Returns the time at which the resource was (tried to be) acquired last. If a resource is acquired using ezResourceAcquireMode::PointerOnly, this does not update the last acquired time, since the resource is not acquired for full use.
 
ezInt32 GetReferenceCount () const
 Returns the reference count of this resource.
 
const ezTimestampGetLoadedFileModificationTime () const
 Returns the modification date of the file from which this resource was loaded. More...
 
- Public Member Functions inherited from ezReflectedClass
EZ_FORCE_INLINE bool IsInstanceOf (const ezRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
 
template<typename T >
EZ_FORCE_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.
 
virtual void Serialize (ezArchiveWriter &stream) const
 This function is called to serialize the instance. More...
 
virtual void Deserialize (ezArchiveReader &stream)
 This function is called to deserialize the instance. More...
 
virtual void OnDeserialized ()
 This function is called after all objects are deserialized and thus all references to other objects are valid. More...
 

Private Member Functions

 EZ_ADD_DYNAMIC_REFLECTION (ezMeshBufferResource)
 
virtual ezResourceLoadDesc UnloadData (Unload WhatToUnload) override
 Requests the resource to unload another quality level. If bFullUnload is true, the resource should unload all data, because it is going to be deleted afterwards.
 
virtual ezResourceLoadDesc UpdateContent (ezStreamReaderBase *Stream) override
 Called whenever more data for the resource is available. The resource must read the stream to update it's data.
 
virtual void UpdateMemoryUsage (MemoryUsage &out_NewMemoryUsage) override
 This function must be overridden by all resource types. More...
 
virtual ezResourceLoadDesc CreateResource (const ezMeshBufferResourceDescriptor &descriptor) override
 Override this function to implement resource creation. This is called by ezResourceManager::CreateResource. More...
 

Private Attributes

ezVertexDeclarationInfo m_VertexDeclaration
 
ezUInt32 m_uiPrimitiveCount
 
ezGALBufferHandle m_hVertexBuffer
 
ezGALBufferHandle m_hIndexBuffer
 

Additional Inherited Members

- Public Types inherited from ezResource< ezMeshBufferResource, ezMeshBufferResourceDescriptor >
typedef
ezMeshBufferResourceDescriptor 
DescriptorType
 
- Static Public Member Functions inherited from ezResource< ezMeshBufferResource, ezMeshBufferResourceDescriptor >
static void SetTypeFallbackResource (const ezResourceHandle< ezMeshBufferResource > &hResource)
 
static void SetTypeMissingResource (const ezResourceHandle< ezMeshBufferResource > &hResource)
 
static const ezResourceHandle
< ezMeshBufferResource > & 
GetTypeFallbackResource ()
 
static const ezResourceHandle
< ezMeshBufferResource > & 
GetTypeMissingResource ()
 
- Protected Types inherited from ezResourceBase
enum  DoUpdate { OnMainThread, OnAnyThread }
 
enum  Unload { AllQualityLevels, OneQualityLevel }
 
- Protected Member Functions inherited from ezResource< ezMeshBufferResource, ezMeshBufferResourceDescriptor >
 ezResource (DoUpdate ResourceUpdateThread, ezUInt8 uiQualityLevelsLoadable)
 

Member Function Documentation

ezResourceLoadDesc ezMeshBufferResource::CreateResource ( const ezMeshBufferResourceDescriptor descriptor)
overrideprivatevirtual

Override this function to implement resource creation. This is called by ezResourceManager::CreateResource.

'Creating' a resource is different from 'loading' a resource. Most resource types are never created. For example a mesh or a sound might not support being created and thus your implementation for such resources should be empty, except for an assert that always fires. However, some resources can be created (or even can only be created, but not loaded). For example textures might support to be created as render targets. In this case the descriptor needs to provide all the necessary information. Another example would be a procedurally generated mesh. The descriptor needs to provide all the parameters, such that 'CreateResource' can set up the resource. Note that created resources should always set its loading state to 'Loaded' and its current and max quality to 1, otherwise the resource manager might try to load even more into the resource afterwards. However, since this might be a valid use case for some resource types, it is not enforced by the resource manager.

Reimplemented from ezResource< ezMeshBufferResource, ezMeshBufferResourceDescriptor >.

void ezMeshBufferResource::UpdateMemoryUsage ( MemoryUsage out_NewMemoryUsage)
overrideprivatevirtual

This function must be overridden by all resource types.

It has to compute the memory used by this resource. It is called by the resource manager whenever the resource's data has been loaded or unloaded.

Implements ezResourceBase.


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