ZeroZero Game Engine  v0.0
A 3D game engine using Vulkan & Jolt
Public Member Functions | Static Public Member Functions | List of all members
Cubemap Class Reference

Detailed Description

A cubemap composed by six images stored in a single VkImage in GPU memory. Use loadFromFile(const string &filepath, const string &ext) to load the cubemap

Inheritance diagram for Cubemap:
Resource Object EnvironmentCubemap

Public Member Functions

auto getWidth () const
 
auto getHeight () const
 
auto getCubemapType () const
 
- Public Member Functions inherited from Resource
auto getId () const
 
const auto & getName () const
 
string toString () const override
 
virtual shared_ptr< Resource > duplicate () const
 
- Public Member Functions inherited from Object
void connect (const Signal::signal &name, const Signal::Handler &handler)
 
void connect (const Signal::signal &name, const function< void ()> &handler)
 
void emit (const Signal::signal &name, void *params=nullptr)
 

Static Public Member Functions

static shared_ptr< Cubemap > create (uint32_t width, uint32_t height, uint32_t imageSize, const vector< byte * > &data, const string &name="Cubemap")
 
static shared_ptr< Cubemap > load (const string &filepath, const string &fileext, ImageFormat imageFormat=ImageFormat::R8G8B8A8_SRGB)
 
static shared_ptr< Cubemap > load (const string &filepath, ImageFormat imageFormat=ImageFormat::R8G8B8A8_SRGB)
 
static shared_ptr< Cubemap > createBlankCubemap ()
 

Member Function Documentation

static shared_ptr<Cubemap> create ( uint32_t  width,
uint32_t  height,
uint32_t  imageSize,
const vector< byte * > &  data,
const string &  name = "Cubemap" 
)
static

Creates a Cubemap from 6 images stored in CPU memory. The images must have the same sizes

Parameters
width: width in pixels of the images
height: height in pixels of the images
imageSize: size of each image in bytes
data: 6 images datas in this order : right, left, top, bottom, front, back
name: resource name
static shared_ptr<Cubemap> createBlankCubemap ( )
nodiscardstatic

Creates a blank cubemap from a 1x1 JPG

auto getCubemapType ( ) const
nodiscardinline

Returns the cubemap type

auto getHeight ( ) const
nodiscardinline

Returns the height in pixels of each image

auto getWidth ( ) const
nodiscardinline

Returns the width in pixels of each image

static shared_ptr<Cubemap> load ( const string &  filepath,
const string &  fileext,
ImageFormat  imageFormat = ImageFormat::R8G8B8A8_SRGB 
)
static

Loads a cubemap from 6 RGBA images files. Images must be named {name}_back.{ext}, {name}_front.{ext}, {name}_top.{ext}, {name}_bottom.{ext}, {name}_left.{ext} and {name}_right.{ext} and must have the same sizes

Parameters
filepathpath and filename (without the extension) of the images
fileextfiles extension
imageFormatformat
static shared_ptr<Cubemap> load ( const string &  filepath,
ImageFormat  imageFormat = ImageFormat::R8G8B8A8_SRGB 
)
static

Loads the cubemap from a single RGBA image with the following format :
   top
left front right back
   bottom