NAP
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
TextureCube Class Reference

#include <texture.h>

Public Member Functions

 TextureCube (Core &core)
 
virtual ~TextureCube () override
 
bool init (const SurfaceDescriptor &descriptor, int mipCount, const glm::vec4 &clearColor, VkImageUsageFlags requiredFlags, utility::ErrorState &errorState)
 
const glm::vec2 getSize () const
 
int getWidth () const
 
int getHeight () const
 
virtual uint getLayerCount () const override
 
virtual uint getMipLevels () const override
 
virtual const ImageDatagetHandle () const override
 
virtual ImageDatagetHandle () override
 
bool init (const SurfaceDescriptor &descriptor, bool mipCount, const glm::vec4 &clearColor, VkImageUsageFlags requiredFlags, utility::ErrorState &errorState)=delete
 
- Public Member Functions inherited from Texture
 Texture (Core &core)
 
virtual ~Texture ()
 
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
 

Static Public Attributes

static constexpr const uint layerCount = 6
 

Protected Attributes

ImageData mImageData = { TextureCube::layerCount }
 Cube Texture vulkan image buffers. More...
 
uint32 mMipLevels = 1
 Total number of generated mip-maps. More...
 
- Protected Attributes inherited from Texture
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)
 
- Public Attributes inherited from Texture
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 inherited from Texture
virtual void clear (VkCommandBuffer commandBuffer)
 
void requestClear ()
 

Description

Cube texture base class. A cube texture is a six-layer image, where each layer represents one side

Cube image layers are addressed and oriented as follows:

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

Constructor & Destructor Documentation

◆ TextureCube()

TextureCube ( Core core)

◆ ~TextureCube()

virtual ~TextureCube ( )
overridevirtual

Member Function Documentation

◆ getHandle() [1/2]

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

Implements Texture.

◆ getHandle() [2/2]

virtual ImageData& getHandle ( )
overridevirtual

Note: This function should actually be protected but is required by nap::CubeRenderTarget in the naprenderadvanced module.

Returns
Vulkan GPU data handle, including image and view.

Implements Texture.

◆ getHeight()

int getHeight ( ) const
Returns
height of the texture in texels

◆ getLayerCount()

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

Implements Texture.

◆ getMipLevels()

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

Implements Texture.

◆ getSize()

const glm::vec2 getSize ( ) const
Returns
size of the texture in texels.

◆ getWidth()

int getWidth ( ) const
Returns
width of the texture in texels

◆ init() [1/2]

bool init ( const SurfaceDescriptor descriptor,
bool  mipCount,
const glm::vec4 &  clearColor,
VkImageUsageFlags  requiredFlags,
utility::ErrorState errorState 
)
delete

◆ init() [2/2]

bool init ( const SurfaceDescriptor descriptor,
int  mipCount,
const glm::vec4 &  clearColor,
VkImageUsageFlags  requiredFlags,
utility::ErrorState errorState 
)

Creates the texture on the GPU using the provided settings. The texture is cleared to 'ClearColor'. The Vulkan image usage flags are derived from texture usage.

Parameters
descriptortexture description.
mipCountnumber of mip-maps to generate when cubemap is created
clearColorthe color to clear the texture with.
requiredFlagsimage usage flags that are required, 0 = no additional usage flags.
errorStatecontains the error if the texture can't be initialized.
Returns
if the texture initialized successfully.

Member Data Documentation

◆ layerCount

constexpr const uint layerCount = 6
staticconstexpr

◆ mImageData

ImageData mImageData = { TextureCube::layerCount }
protected

Cube Texture vulkan image buffers.

◆ mMipLevels

uint32 mMipLevels = 1
protected

Total number of generated mip-maps.