Represents a texture containing one or more images, stored on the CPU and/or GPU.
More...
#include <Texture.hpp>
|
std::vector< Image > | images |
| The images CPU data (optional).
|
|
std::unique_ptr< GPUTexture > | gpu |
| The GPU data (optional).
|
|
uint | width = 0 |
| The texture width.
|
|
uint | height = 0 |
| The texture height.
|
|
uint | depth = 1 |
| The texture depth.
|
|
uint | levels = 1 |
| The mipmap count.
|
|
TextureShape | shape = TextureShape::D2 |
| Texure type.
|
|
Layout | format = Layout::NONE |
| Layout used.
|
|
bool | drawable = false |
| Can the texture be rendered to.
|
|
|
std::string | _name |
| Resource name.
|
|
Represents a texture containing one or more images, stored on the CPU and/or GPU.
◆ Texture() [1/3]
Texture::Texture |
( |
const std::string & |
name | ) |
|
Constructor.
- Parameters
-
name | the texture identifier |
◆ Texture() [2/3]
Texture::Texture |
( |
const Texture & |
| ) |
|
|
delete |
Copy constructor (disabled).
◆ Texture() [3/3]
◆ allocateImages()
void Texture::allocateImages |
( |
uint |
channels, |
|
|
uint |
firstMip = 0 , |
|
|
uint |
mipCount = 0xFFFFFFFF |
|
) |
| |
Allocate the CPU images in the mip range defined as input. Images outside the given range will be left untouched if present, or created empty if not.
- Parameters
-
channels | the number of channels for each image |
firstMip | the first mip to allocate images for |
mipCount | the number of mip to allocate, up to the texture level count |
◆ clean()
Cleanup all data.
- Note
- The dimensions and shape of the texture are preserved.
◆ clearImages()
void Texture::clearImages |
( |
| ) |
|
◆ getMaxMipLevel()
uint Texture::getMaxMipLevel |
( |
| ) |
const |
Compute the maximum possible mipmap level based on the texture type and dimensions.
- Returns
- the maximum level
◆ name()
const std::string & Texture::name |
( |
| ) |
const |
Get the resource name.
- Returns
- the name.
◆ operator=() [1/2]
Copy assignment operator (disabled).
- Returns
- a reference to the object assigned to
◆ operator=() [2/2]
Move assignment operator .
- Returns
- a reference to the object assigned to
◆ resize() [1/2]
void Texture::resize |
( |
const glm::vec2 & |
resolution | ) |
|
Resize the GPU texture
- Parameters
-
resolution | the new texture size |
◆ resize() [2/2]
void Texture::resize |
( |
uint |
w, |
|
|
uint |
h |
|
) |
| |
Resize the GPU texture
- Parameters
-
w | the new texture width |
h | the new texture height |
◆ sampleCubemap()
glm::vec3 Texture::sampleCubemap |
( |
const glm::vec3 & |
dir | ) |
const |
Bilinearly sample a cubemap in a given direction.
- Parameters
-
dir | the direction to sample |
- Returns
- the sampled color.
◆ setupAsDrawable()
void Texture::setupAsDrawable |
( |
const Layout & |
layout, |
|
|
uint |
width, |
|
|
uint |
height, |
|
|
TextureShape |
shape = TextureShape::D2 , |
|
|
uint |
mips = 1 , |
|
|
uint |
depth = 1 |
|
) |
| |
Configure and allocate a texture to be used as a rendering attachment.
- Parameters
-
layout | the pixel format to use |
width | the texture width |
height | the texture height |
shape | the shape of the texture
|
mips | the number of mips |
depth | the number of layers for array and 3D textures |
◆ upload()
void Texture::upload |
( |
const Layout & |
layout, |
|
|
bool |
updateMipmaps |
|
) |
| |
Send to the GPU.
- Parameters
-
layout | the data layout and type to use for the texture |
updateMipmaps | generate the mipmaps automatically |
The documentation for this class was generated from the following files:
- src/engine/resources/Texture.hpp
- src/engine/resources/Texture.cpp