Foundation
Loading...
Searching...
No Matches
Classes | Functions
Texture.hpp File Reference
#include <Core/Container.hpp>
#include <Math/Math.hpp>
#include <RHICore/Resource.hpp>
#include "Serialization.hpp"
#include "TextureDDS.hpp"

Go to the source code of this file.

Classes

struct  FTextureHeader
 
struct  FSerializedTexture
 
struct  FTexture
 

Functions

void LoadDDS (FTexture &texture, StringView path)
 
void LoadRGBA8 (FTexture &texture, StringView path, bool gamma=true)
 
void LoadRGBA8 (FTexture &texture, Span< const unsigned char > data, bool gamma=true)
 
void LoadHDR (FTexture &texture, StringView path)
 
void SaveHDR (const float *data, int width, int height, StringView path)
 
void SavePNG (const unsigned char *data, int width, int height, StringView path)
 
template<>
void FSerialize (FWriter &w, FSerializedTexture const &obj)
 
template<>
void FDeserialize (FReader &r, FSerializedTexture &obj)
 
template<>
void FSerialize (FWriter &w, FTexture const &obj)
 
template<>
void FDeserialize (FReader &r, FTexture &obj)
 

Function Documentation

◆ FDeserialize() [1/2]

template<>
void FDeserialize ( FReader r,
FSerializedTexture obj 
)
inline

◆ FDeserialize() [2/2]

template<>
void FDeserialize ( FReader r,
FTexture obj 
)
inline

◆ FSerialize() [1/2]

template<>
void FSerialize ( FWriter w,
FSerializedTexture const obj 
)
inline

◆ FSerialize() [2/2]

template<>
void FSerialize ( FWriter w,
FTexture const obj 
)
inline

◆ LoadDDS()

void LoadDDS ( FTexture texture,
StringView  path 
)

Loads a DDS file into a texture

Note
This is an alias of FSerialize. FTexture is in fact in standard DDS format.

◆ LoadHDR()

void LoadHDR ( FTexture texture,
StringView  path 
)

Loads HDR image formats (.hdr) via stb_image into an R32G32B32A32Float texture. Used for environment maps.

◆ LoadRGBA8() [1/2]

void LoadRGBA8 ( FTexture texture,
Span< const unsigned char data,
bool  gamma = true 
)

Loads standard image formats (PNG, JPG, etc.) via stb_image into an uncompressed R8G8B8A8 texture from memory

Parameters
gammaWhether to load the image as sRGB (true) or linear (false) encoding.

◆ LoadRGBA8() [2/2]

void LoadRGBA8 ( FTexture texture,
StringView  path,
bool  gamma = true 
)

Loads standard image formats (PNG, JPG, etc.) via stb_image into an uncompressed R8G8B8A8 texture

Parameters
gammaWhether to load the image as sRGB (true) or linear (false) encoding.

◆ SaveHDR()

void SaveHDR ( const float data,
int  width,
int  height,
StringView  path 
)

Saves float RGBA pixel data as an HDR image. Output format is Radiance HDR (stb_image_write), RGB only (alpha discarded).

Parameters
dataPointer to float RGBA pixel data (4 floats per pixel).
widthImage width in pixels.
heightImage height in pixels.
pathOutput file path.

◆ SavePNG()

void SavePNG ( const unsigned char data,
int  width,
int  height,
StringView  path 
)

Saves RGBA8 data as a PNG (.png) file via stb_image_write.

Parameters
dataPointer to uint8 RGBA pixel data (4 bytes per pixel).
widthImage width in pixels.
heightImage height in pixels.
pathOutput file path.