NAP
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Texture Class Referenceabstract

#include <texture.h>

Public Types

enum  EUsage { Static, DynamicRead, DynamicWrite }
 

Public Member Functions

 Texture (Core &core)
 
virtual ~Texture ()
 
virtual uint getLayerCount () const =0
 
virtual uint getMipLevels () const =0
 
virtual const ImageDatagetHandle () const =0
 
virtual VkImageLayout getTargetLayout () const
 
VkFormat getFormat () const
 
const SurfaceDescriptorgetDescriptor () const
 
RenderServicegetRenderService ()
 
const RenderServicegetRenderService () const
 
virtual void onDestroy () override
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual bool init (utility::ErrorState &errorState)
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

nap::Signal textureDestroyed
 Signal that is triggered before texture is destroyed. More...
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Protected Member Functions

virtual ImageDatagetHandle ()=0
 
virtual void clear (VkCommandBuffer commandBuffer)
 
void requestClear ()
 

Protected Attributes

RenderServicemRenderService
 Reference to the render service. More...
 
SurfaceDescriptor mDescriptor
 Texture description. More...
 
VkFormat mFormat = VK_FORMAT_UNDEFINED
 Vulkan texture format. More...
 
VkClearColorValue mClearColor = { 0.0f, 0.0f, 0.0f, 0.0f }
 Color used for clearing the texture. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 

Description

Texture base class

Inheritance diagram for Texture:
[legend]
Collaboration diagram for Texture:
[legend]

Member Enumeration Documentation

◆ EUsage

enum EUsage
strong

Flag that determines how the texture is used at runtime.

Enumerator
Static 

Texture does not change, uploaded to once.

DynamicRead 

Texture is frequently read from GPU to CPU.

DynamicWrite 

Texture is frequently updated from CPU to GPU.

Constructor & Destructor Documentation

◆ Texture()

Texture ( Core core)

◆ ~Texture()

virtual ~Texture ( )
virtual

Member Function Documentation

◆ clear()

virtual void clear ( VkCommandBuffer  commandBuffer)
protectedvirtual

Clears the texture to the specified clear colors.

◆ getDescriptor()

const SurfaceDescriptor& getDescriptor ( ) const
Returns
the texture description

◆ getFormat()

VkFormat getFormat ( ) const
Returns
Vulkan texture format

◆ getHandle() [1/2]

virtual const ImageData& getHandle ( ) const
pure virtual
Returns
Vulkan GPU data handle, including image and view.

Implemented in TextureCube, Texture2D, DepthRenderTexture2D, and RenderTexture2D.

◆ getHandle() [2/2]

virtual ImageData& getHandle ( )
protectedpure virtual
Returns
Vulkan GPU data handle, including image and view.

Implemented in TextureCube, and Texture2D.

◆ getLayerCount()

virtual uint getLayerCount ( ) const
pure virtual
Returns
the number of texture layers.

Implemented in TextureCube, and Texture2D.

◆ getMipLevels()

virtual uint getMipLevels ( ) const
pure virtual
Returns
the number of texture mip-map levels.

Implemented in TextureCube, and Texture2D.

◆ getRenderService() [1/2]

RenderService& getRenderService ( )
Returns
render service

◆ getRenderService() [2/2]

const RenderService& getRenderService ( ) const
Returns
render service

◆ getTargetLayout()

virtual VkImageLayout getTargetLayout ( ) const
virtual
Returns
Vulkan image layout that this texture is intended for.

◆ onDestroy()

virtual void onDestroy ( )
overridevirtual

Notify listeners when texture is destroyed

Reimplemented from Object.

Reimplemented in CubeMapFromFile.

◆ requestClear()

void requestClear ( )
protected

Queues a clear command in the render service.

Member Data Documentation

◆ mClearColor

VkClearColorValue mClearColor = { 0.0f, 0.0f, 0.0f, 0.0f }
protected

Color used for clearing the texture.

◆ mDescriptor

SurfaceDescriptor mDescriptor
protected

Texture description.

◆ mFormat

VkFormat mFormat = VK_FORMAT_UNDEFINED
protected

Vulkan texture format.

◆ mRenderService

RenderService& mRenderService
protected

Reference to the render service.

◆ textureDestroyed

nap::Signal textureDestroyed

Signal that is triggered before texture is destroyed.