NAP
Public Types | Public Member Functions | Public Attributes | List of all members
RenderTextureCube Class Reference

#include <rendertexturecube.h>

Public Types

enum  EFormat {
  RGBA8, BGRA8, R8, RGBA16,
  R16, RGBA32, R32
}
 

Public Member Functions

 RenderTextureCube (Core &core)
 
virtual bool init (utility::ErrorState &errorState) override
 
virtual bool init (bool enableMips, utility::ErrorState &errorState)
 
- Public Member Functions inherited from TextureCube
 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 ImageData & getHandle () const override
 
virtual ImageData & getHandle () 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 SurfaceDescriptor & getDescriptor () const
 
RenderService & getRenderService ()
 
const RenderService & getRenderService () const
 
virtual void onDestroy () override
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
 Object (Object &)=delete
 
Object & operator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Object & operator= (Object &&)=delete
 

Public Attributes

int mWidth = 1024
 Property: 'Width' width of a cube face texture in texels. More...
 
int mHeight = 1024
 Property: 'Height' of a cube face texture in texels. More...
 
EColorSpace mColorSpace = EColorSpace::Linear
 Property: 'ColorSpace' texture color space. More...
 
EFormat mColorFormat = EFormat::RGBA8
 Property: 'ColorFormat' color texture format. More...
 
RGBAColorFloat mClearColor = { 0.0f, 0.0f, 0.0f, 0.0f }
 Property: 'ClearColor' color selection used for clearing the texture. More...
 
- 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 
- Static Public Attributes inherited from TextureCube
static constexpr const uint layerCount = 6
 
- Protected Member Functions inherited from Texture
virtual void clear (VkCommandBuffer commandBuffer)
 
void requestClear ()
 
- Protected Attributes inherited from TextureCube
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
RenderService & mRenderService
 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...
 

Description

Empty cube GPU texture that can be declared as a resource in JSON or created at runtime. You can use this texture to store the result of a render pass by a nap::CubeRenderTarget or any other type of render operation. The texture is cleared to 'ClearColor' before first use.

Internally, a cube texture creates a six-layer Vulkan image, each layer representing one side of a unit cube. Cube textures can be set to nap::SamplerCubeInstance for shader samplers of types samplerCube and samplerCubeShadow.

Cube image layers are addressed and oriented as follows:

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

Member Enumeration Documentation

◆ EFormat

enum EFormat
strong

All supported render texture cube formats.

Enumerator
RGBA8 

08 bit unsigned, 4 components

BGRA8 

08 bit unsigned, 4 components

R8 

08 bit unsigned, 1 component

RGBA16 

16 bit unsigned, 4 components

R16 

16 bit unsigned, 1 component

RGBA32 

32 bit float, 4 components

R32 

32 bit float, 1 component

Constructor & Destructor Documentation

◆ RenderTextureCube()

RenderTextureCube ( Core &  core)

Member Function Documentation

◆ init() [1/2]

virtual bool init ( bool  enableMips,
utility::ErrorState &  errorState 
)
virtual

Creates the texture on the GPU with or without mip-maps.

Parameters
enableMipsif mip-maps should be generated
errorStateContains error state if the function fails.
Returns
if the texture was created successfully

◆ init() [2/2]

virtual bool init ( utility::ErrorState &  errorState)
overridevirtual

Creates the texture on the GPU without mip-maps.

Parameters
errorStateContains error state if the function fails.
Returns
if the texture was created successfully

Reimplemented from Object.

Reimplemented in SunsetCubeMap, CubeMapFromFile, and TestCubeMap.

Member Data Documentation

◆ mClearColor

RGBAColorFloat mClearColor = { 0.0f, 0.0f, 0.0f, 0.0f }

Property: 'ClearColor' color selection used for clearing the texture.

◆ mColorFormat

EFormat mColorFormat = EFormat::RGBA8

Property: 'ColorFormat' color texture format.

◆ mColorSpace

Property: 'ColorSpace' texture color space.

◆ mHeight

int mHeight = 1024

Property: 'Height' of a cube face texture in texels.

◆ mWidth

int mWidth = 1024

Property: 'Width' width of a cube face texture in texels.