XII Release 0.1.0
Loading...
Searching...
No Matches
xiiMaterialResource Class Referencefinal
Inheritance diagram for xiiMaterialResource:
[legend]

Public Types

enum class  DefaultMaterialType {
  Fullbright , FullbrightAlphaTest , Lit , LitAlphaTest ,
  Sky , MissingMaterial
}
 Use these enum values together with GetDefaultMaterialFileName() to get the default file names for these material types.
 
- Public Types inherited from xiiResource
enum class  DoUpdate { OnMainThread , OnAnyThread , OnGraphicsResourceThreads }
 

Public Member Functions

xiiHashedString GetPermutationValue (const xiiTempHashedString &sName)
 
xiiHashedString GetSurface () const
 
void SetParameter (const xiiHashedString &sName, const xiiVariant &value)
 
void SetParameter (xiiStringView sName, const xiiVariant &value)
 
xiiVariant GetParameter (const xiiTempHashedString &sName)
 
void SetTexture2DBinding (const xiiHashedString &sName, const xiiTexture2DResourceHandle &value)
 
void SetTexture2DBinding (xiiStringView sName, const xiiTexture2DResourceHandle &value)
 
xiiTexture2DResourceHandle GetTexture2DBinding (const xiiTempHashedString &sName)
 
void SetTextureCubeBinding (const xiiHashedString &sName, const xiiTextureCubeResourceHandle &value)
 
void SetTextureCubeBinding (xiiStringView sName, const xiiTextureCubeResourceHandle &value)
 
xiiTextureCubeResourceHandle GetTextureCubeBinding (const xiiTempHashedString &sName)
 
xiiRenderData::Category GetRenderDataCategory ()
 
void PreserveCurrentDescription ()
 Copies current description to the loading description so the material is not modified on reset.
 
virtual void ResetResource () override
 If the resource has modifications from the original state, it should reset itself to that state now (or force a reload on itself).
 
const xiiMaterialResourceDescriptorGetCurrentDescription () const
 
- Public Member Functions inherited from xiiResource
XII_ALWAYS_INLINE xiiStringView GetResourceID () 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.
 
XII_ALWAYS_INLINE xiiUInt64 GetResourceIDHash () const
 Returns the hash of the unique ID.
 
void SetResourceDescription (xiiStringView sDescription)
 The resource description allows to store an additional string that might be more descriptive during debugging, than the unique ID.
 
const xiiStringGetResourceDescription () const
 The resource description allows to store an additional string that might be more descriptive during debugging, than the unique ID.
 
const xiiStringGetResourceIdOrDescription () const
 The returns the resource description, if available, otherwise the resource ID.
 
XII_ALWAYS_INLINE xiiResourceState GetLoadingState () const
 Returns the current state in which this resource is in.
 
XII_ALWAYS_INLINE xiiUInt8 GetNumQualityLevelsDiscardable () const
 Returns the current maximum quality level that the resource could have.
 
XII_ALWAYS_INLINE xiiUInt8 GetNumQualityLevelsLoadable () const
 Returns how many quality levels the resource may additionally load.
 
float GetLoadingPriority (xiiTime now) const
 Returns the priority that is used by the resource manager to determine which resource to load next.
 
xiiResourcePriority GetPriority () const
 Returns the current resource priority.
 
void SetPriority (xiiResourcePriority priority)
 Changes the current resource priority.
 
XII_ALWAYS_INLINE const xiiBitflags< xiiResourceFlags > & GetBaseResourceFlags () const
 Returns the basic flags for the resource type. Mostly used the resource manager.
 
XII_ALWAYS_INLINE const MemoryUsageGetMemoryUsage () const
 Returns the information about the current memory usage of the resource.
 
XII_ALWAYS_INLINE xiiTime GetLastAcquireTime () const
 Returns the time at which the resource was (tried to be) acquired last. If a resource is acquired using xiiResourceAcquireMode::PointerOnly, this does not update the last acquired time, since the resource is not acquired for full use.
 
XII_ALWAYS_INLINE xiiInt32 GetReferenceCount () const
 Returns the reference count of this resource.
 
XII_ALWAYS_INLINE const xiiTimestampGetLoadedFileModificationTime () const
 Returns the modification date of the file from which this resource was loaded.
 
XII_ALWAYS_INLINE xiiUInt32 GetCurrentResourceChangeCounter () const
 Returns the current value of the resource change counter. Can be used to detect whether the resource has changed since using it last time.
 
XII_ALWAYS_INLINE void IncResourceChangeCounter ()
 Allows to manually increase the resource change counter to signal that dependent code might need to update.
 
void PrintHandleStackTraces ()
 Prints the stack-traces for all handles that currently reference this resource.
 
- Public Member Functions inherited from xiiReflectedClass
virtual const xiiRTTIGetDynamicRTTI () const
 
bool IsInstanceOf (const xiiRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
 
template<typename T>
XII_ALWAYS_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.
 

Static Public Member Functions

static const char * GetDefaultMaterialFileName (DefaultMaterialType materialType)
 Returns the default material file name for the given type (materials in Data/Base/Materials/BaseMaterials).
 
- Static Public Member Functions inherited from xiiNoBase
static const xiiRTTIGetStaticRTTI ()
 

Private Member Functions

virtual xiiResourceLoadDesc 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 xiiResourceLoadDesc UpdateContent (xiiStreamReader *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.
 

Friends

class xiiRenderContext
 

Additional Inherited Members

- Public Attributes inherited from xiiResource
xiiEvent< const xiiResourceEvent &, xiiMutexm_ResourceEvents
 
- Static Public Attributes inherited from xiiResource
static DoUpdate UpdateGraphicsResource = xiiResource::DoUpdate::OnAnyThread
 
- Protected Types inherited from xiiResource
enum class  Unload { AllQualityLevels , OneQualityLevel }
 
- Protected Member Functions inherited from xiiResource
 xiiResource (DoUpdate ResourceUpdateThread, xiiUInt8 uiQualityLevelsLoadable)
 Default constructor.
 
virtual ~xiiResource ()
 virtual destructor.
 
MemoryUsageModifyMemoryUsage ()
 Non-const version for resources that want to write this variable directly.
 
void SetIsReloadable (bool bIsReloadable)
 Call this to specify whether a resource is reloadable.
 
void SetHasLoadingFallback (bool bHasLoadingFallback)
 Used internally by the code injection macros.
 

Member Function Documentation

◆ ResetResource()

void xiiMaterialResource::ResetResource ( )
overridevirtual

If the resource has modifications from the original state, it should reset itself to that state now (or force a reload on itself).

Reimplemented from xiiResource.

◆ UnloadData()

xiiResourceLoadDesc xiiMaterialResource::UnloadData ( Unload WhatToUnload)
overrideprivatevirtual

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.

Implements xiiResource.

◆ UpdateContent()

xiiResourceLoadDesc xiiMaterialResource::UpdateContent ( xiiStreamReader * pStream)
overrideprivatevirtual

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

pStream may be nullptr in case the resource data could not be found.

Implements xiiResource.

◆ UpdateMemoryUsage()

void xiiMaterialResource::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 xiiResource.


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