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

#include <equirectangularcubemap.h>

Public Member Functions

virtual ~EquiRectangularCubeMap () override
 
 EquiRectangularCubeMap (Core &core)
 
virtual bool init (nap::Texture2D &equiRectangularTexture, utility::ErrorState &errorState)
 
Texture2D & getSourceTexture ()
 
const Texture2D & getSourceTexture () const
 
virtual void onDestroy ()
 
- Public Member Functions inherited from RenderTextureCube
 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
 
- 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

bool mSampleShading = false
 Property: 'SampleShading' Reduces texture aliasing when cubemap is generated, at higher computational cost. More...
 
bool mGenerateLods
 Property: 'GenerateLODs' whether to create mip-maps when the cubemap is generated. More...
 
- Public Attributes inherited from RenderTextureCube
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...
 

Protected Attributes

RenderAdvancedService * mRenderAdvancedService = nullptr
 
- 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...
 

Additional Inherited Members

- Public Types inherited from RenderTextureCube
enum  EFormat {
  RGBA8, BGRA8, R8, RGBA16,
  R16, RGBA32, R32
}
 
- 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 ()
 

Description

Base class for all cube maps generated from equirectangular images. Creates a 6 face cube map from an equirectangular 2D texture

If GenerateLODs is enabled, GPU memory for mip-maps (LODs) are allocated and will be updated using blit operations after the cube face render passes.

This object must be pre-rendered at least once in a headless render pass in the first frame. The RenderAdvanced service queues a headless RenderService::RenderCommand for each nap::CubeMapFromFile in the scene after resource initialization, and will be handled when headless render commands are recorded. The code below only begins a headless recording operation only when headless commands are queued in the render service.

{
// Handles `nap::CubeMapFromFile` pre-render operations in the first frame
}
Inheritance diagram for EquiRectangularCubeMap:
[legend]
Collaboration diagram for EquiRectangularCubeMap:
[legend]

Constructor & Destructor Documentation

◆ ~EquiRectangularCubeMap()

virtual ~EquiRectangularCubeMap ( )
overridevirtual

◆ EquiRectangularCubeMap()

Parameters
corethe core instance

Member Function Documentation

◆ getSourceTexture() [1/2]

Texture2D& getSourceTexture ( )
Returns
the equirectangular source image

◆ getSourceTexture() [2/2]

const Texture2D& getSourceTexture ( ) const
Returns
the equirectangular source image

◆ init()

virtual bool init ( nap::Texture2D &  equiRectangularTexture,
utility::ErrorState &  errorState 
)
virtual

Uploads and renders the given equirectangular texture to cubemap.

Parameters
sourcethe equirectangular source image, must be initialized
errorStatecontains the error message when initialization failsRTTI_PROPERTY("SampleShading", &nap::CubeMapFromFile::mSampleShading, nap::rtti::EPropertyMetaData::Default, "Reduces texture aliasing at higher computational cost")

◆ onDestroy()

virtual void onDestroy ( )
virtual

Removes the cubemap

Reimplemented from Texture.

Member Data Documentation

◆ mGenerateLods

bool mGenerateLods

Property: 'GenerateLODs' whether to create mip-maps when the cubemap is generated.

◆ mRenderAdvancedService

RenderAdvancedService* mRenderAdvancedService = nullptr
protected

◆ mSampleShading

bool mSampleShading = false

Property: 'SampleShading' Reduces texture aliasing when cubemap is generated, at higher computational cost.

nap::RenderService::isHeadlessCommandQueued
bool isHeadlessCommandQueued() const
Definition: renderservice.h:645
nap::RenderService::beginHeadlessRecording
bool beginHeadlessRecording()
nap::RenderService::endHeadlessRecording
void endHeadlessRecording()
nap::Texture::mRenderService
RenderService & mRenderService
Reference to the render service.
Definition: texture.h:104