ezEngine  Milestone 7
ezTextureResource Class Reference
Inheritance diagram for ezTextureResource:

Static Public Attributes

static bool s_bForceFullQualityAlways = false
 If enabled, textures are always loaded to full quality immediately. Mostly necessary for image comparison unit tests.
 

Private Member Functions

 EZ_ADD_DYNAMIC_REFLECTION (ezTextureResource)
 
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. More...
 
virtual void UpdateMemoryUsage (MemoryUsage &out_NewMemoryUsage) override
 This function must be overridden by all resource types. More...
 
virtual ezResourceLoadDesc CreateResource (const ezTextureResourceDescriptor &descriptor) override
 Override this function to implement resource creation. This is called by ezResourceManager::CreateResource. More...
 
const ezGALResourceViewHandleGetGALTextureView () const
 
const ezGALTextureHandleGetGALTexture () const
 
const ezGALSamplerStateHandleGetGALSamplerState () const
 

Private Attributes

ezUInt8 m_uiLoadedTextures
 
ezGALTextureHandle m_hGALTexture [2]
 
ezGALResourceViewHandle m_hGALTexView [2]
 
ezUInt32 m_uiMemoryGPU [2]
 
ezGALSamplerStateHandle m_hSamplerState
 

Friends

class ezRenderContext
 

Additional Inherited Members

- Public Types inherited from ezResource< ezTextureResource, ezTextureResourceDescriptor >
typedef ezTextureResourceDescriptor DescriptorType
 
- Public Member Functions inherited from ezResource< ezTextureResource, ezTextureResourceDescriptor >
void SetFallbackResource (const ezResourceHandle< ezTextureResource > &hResource)
 Sets the fallback resource that can be used while this resource is not yet loaded. More...
 
- Static Public Member Functions inherited from ezResource< ezTextureResource, ezTextureResourceDescriptor >
static void SetTypeFallbackResource (const ezResourceHandle< ezTextureResource > &hResource)
 
static void SetTypeMissingResource (const ezResourceHandle< ezTextureResource > &hResource)
 
static const ezResourceHandle
< ezTextureResource > & 
GetTypeFallbackResource ()
 
static const ezResourceHandle
< ezTextureResource > & 
GetTypeMissingResource ()
 
- Protected Types inherited from ezResourceBase
enum  DoUpdate { OnMainThread, OnAnyThread }
 
enum  Unload { AllQualityLevels, OneQualityLevel }
 
- Protected Member Functions inherited from ezResource< ezTextureResource, ezTextureResourceDescriptor >
 ezResource (DoUpdate ResourceUpdateThread, ezUInt8 uiQualityLevelsLoadable)
 

Member Function Documentation

ezResourceLoadDesc ezTextureResource::CreateResource ( const ezTextureResourceDescriptor 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.

Todo:
HACK

Reimplemented from ezResource< ezTextureResource, ezTextureResourceDescriptor >.

ezResourceLoadDesc ezTextureResource::UpdateContent ( ezStreamReaderBase Stream)
overrideprivatevirtual

Called whenever more data for the resource is available. The resource must read the stream to update it's data.

Todo:
Figure out the correct order of the arrays/faces/mips

Implements ezResourceBase.

void ezTextureResource::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: