2#include "resources/Image.hpp"
3#include "graphics/GPUTypes.hpp"
34 void allocateImages(uint channels, uint firstMip = 0, uint mipCount = 0xFFFFFFFF);
60 void resize(
const glm::vec2& resolution);
66 void resize(uint w, uint h);
71 const std::string &
name()
const;
97 std::unique_ptr<GPUTexture>
gpu;
125 void Image(
const Texture & texture,
const ImVec2& size,
const ImVec2& uv0 = ImVec2(0,0),
const ImVec2& uv1 = ImVec2(1,1),
const ImVec4& tint_col = ImVec4(1,1,1,1),
const ImVec4& border_col = ImVec4(0,0,0,0));
137 bool ImageButton(
const char*
id,
const Texture & texture,
const ImVec2& size,
const ImVec2& uv0 = ImVec2(0,0),
const ImVec2& uv1 = ImVec2(1,1),
const ImVec4& bg_col = ImVec4(0,0,0,0),
const ImVec4& tint_col = ImVec4(1,1,1,1));
Store a texture data on the GPU.
Definition: GPUObjects.hpp:18
Represents an image composed of pixels with values in [0,1]. Provide image loading/saving utilities,...
Definition: Image.hpp:8
Represents a texture containing one or more images, stored on the CPU and/or GPU.
Definition: Texture.hpp:12
uint levels
The mipmap count.
Definition: Texture.hpp:102
TextureShape shape
Texure type.
Definition: Texture.hpp:104
glm::vec3 sampleCubemap(const glm::vec3 &dir) const
Definition: Texture.cpp:141
uint getMaxMipLevel() const
Definition: Texture.cpp:34
void clean()
Definition: Texture.cpp:85
uint depth
The texture depth.
Definition: Texture.hpp:101
Texture & operator=(const Texture &)=delete
Layout format
Layout used.
Definition: Texture.hpp:106
void upload(const Layout &layout, bool updateMipmaps)
Definition: Texture.cpp:12
uint width
The texture width.
Definition: Texture.hpp:99
Texture(const Texture &)=delete
void setupAsDrawable(const Layout &layout, uint width, uint height, TextureShape shape=TextureShape::D2, uint mips=1, uint depth=1)
Definition: Texture.cpp:100
std::string _name
Resource name.
Definition: Texture.hpp:111
void resize(const glm::vec2 &resolution)
Definition: Texture.cpp:132
std::vector< Image > images
The images CPU data (optional).
Definition: Texture.hpp:96
bool drawable
Can the texture be rendered to.
Definition: Texture.hpp:107
Texture & operator=(Texture &&)=default
void clearImages()
Definition: Texture.cpp:46
std::unique_ptr< GPUTexture > gpu
The GPU data (optional).
Definition: Texture.hpp:97
const std::string & name() const
Definition: Texture.cpp:193
void allocateImages(uint channels, uint firstMip=0, uint mipCount=0xFFFFFFFF)
Definition: Texture.cpp:50
uint height
The texture height.
Definition: Texture.hpp:100
TextureShape
The shape of a texture: dimensions, layers organisation.
Definition: GPUTypes.hpp:153
Layout
The layout of a texture: components count and type.
Definition: GPUTypes.hpp:225