![]() |
Divide Framework 0.1
A free and open-source 3D Framework under heavy development
|
An API-independent representation of a texture. More...
#include <Texture.h>
Public Member Functions | |
Texture (PlatformContext &context, const ResourceDescriptor< Texture > &descriptor) | |
virtual | ~Texture () override |
void | createWithData (const ImageTools::ImageData &imageData, const PixelAlignment &pixelUnpackAlignment) |
API-dependent loading function that uploads ptr data to the GPU using the specified parameters. | |
void | createWithData (const Byte *data, size_t dataSize, const vec2< U16 > &dimensions, const PixelAlignment &pixelUnpackAlignment) |
void | createWithData (const Byte *data, size_t dataSize, const vec3< U16 > &dimensions, const PixelAlignment &pixelUnpackAlignment) |
void | replaceData (const Byte *data, size_t dataSize, const vec3< U16 > &offset, const vec3< U16 > &range, const PixelAlignment &pixelUnpackAlignment) |
void | setSampleCount (U8 newSampleCount) |
Change the number of MSAA samples for this current texture. | |
ImageView | getView () const noexcept |
ImageView | getView (TextureType targetType) const noexcept |
ImageView | getView (SubRange mipRange) const noexcept |
ImageView | getView (SubRange mipRange, SubRange layerRange) const noexcept |
ImageView | getView (TextureType targetType, SubRange mipRange) const noexcept |
ImageView | getView (TextureType targetType, SubRange mipRange, SubRange layerRange) const noexcept |
virtual ImageReadbackData | readData (U8 mipLevel, const PixelAlignment &pixelPackAlignment) const =0 |
PROPERTY_R (TextureDescriptor, descriptor) | |
PROPERTY_R (U16, mipCount, 1u) | |
Get the number of mips. | |
PROPERTY_R (U16, width, 0u) | |
Texture width as returned by STB/DDS loader. | |
PROPERTY_R (U16, height, 0u) | |
Texture height as returned by STB/DDS loader. | |
PROPERTY_R (U16, depth, 1u) | |
Depth for TEXTURE_3D, layer count for TEXTURE_1/2D/CUBE_ARRAY. For cube arrays, numSlices = depth * 6u. | |
PROPERTY_R (bool, hasTranslucency, false) | |
If the texture has an alpha channel and at least one pixel is translucent, return true. | |
PROPERTY_R (bool, hasTransparency, false) | |
If the texture has an alpha channel and at least on pixel is fully transparent and no pixels are partially transparent, return true. | |
PROPERTY_R (bool, loadedFromFile, false) | |
U8 | numChannels () const noexcept |
bool | load (PlatformContext &context) override |
Loading and unloading interface. | |
bool | postLoad () override |
![]() | |
CachedResource (const ResourceDescriptorBase &descriptor, std::string_view typeName) | |
virtual bool | load (PlatformContext &context) |
Loading and unloading interface. | |
virtual bool | postLoad () |
virtual bool | unload () |
void | setState (ResourceState currentState) final |
![]() | |
Resource (std::string_view resourceName, std::string_view typeName) | |
ResourceState | getState () const noexcept |
PROPERTY_R (Str< 32 >, typeName) | |
PROPERTY_R (Str< 256 >, resourceName) | |
![]() | |
GUIDWrapper () noexcept | |
GUIDWrapper (const GUIDWrapper &old) noexcept | |
GUIDWrapper (GUIDWrapper &&old) noexcept | |
virtual | ~GUIDWrapper ()=default |
FORCE_INLINE I64 | getGUID () const noexcept |
GUIDWrapper & | operator= (const GUIDWrapper &old)=delete |
GUIDWrapper & | operator= (GUIDWrapper &&other)=delete |
![]() | |
virtual | ~GraphicsResource () |
GFXDevice & | context () const noexcept |
U64 | nameHash () const noexcept |
![]() | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
NonCopyable (NonCopyable &&)=default | |
NonCopyable & | operator= (NonCopyable &&)=default |
![]() | |
NonMovable (NonMovable &&)=delete | |
NonMovable & | operator= (NonMovable &&)=delete |
NonMovable (const NonMovable &)=default | |
NonMovable & | operator= (const NonMovable &)=default |
Static Public Member Functions | |
static void | OnStartup (GFXDevice &gfx) |
static void | OnShutdown () noexcept |
static bool | UseTextureDDSCache () noexcept |
static Handle< Texture > | DefaultTexture2D () noexcept |
static Handle< Texture > | DefaultTexture2DArray () noexcept |
static const SamplerDescriptor | DefaultSampler () noexcept |
static U8 | GetBytesPerPixel (GFXDataFormat format, GFXImageFormat baseFormat, GFXImagePacking packing) noexcept |
![]() | |
static I64 | generateGUID () noexcept |
Protected Member Functions | |
bool | loadFile (const ResourcePath &path, std::string_view name, ImageTools::ImageData &fileData) |
Use STB to load a file into a Texture Object. | |
bool | checkTransparency (const ResourcePath &path, std::string_view name, ImageTools::ImageData &fileData) |
bool | loadInternal () |
Load texture data using the specified file name. | |
void | validateDescriptor () |
virtual void | loadDataInternal (const ImageTools::ImageData &imageData, const vec3< U16 > &offset, const PixelAlignment &pixelUnpackAlignment)=0 |
virtual void | loadDataInternal (const Byte *data, size_t size, U8 targetMip, const vec3< U16 > &offset, const vec3< U16 > &dimensions, const PixelAlignment &pixelUnpackAlignment)=0 |
virtual void | prepareTextureData (U16 width, U16 height, U16 depth, bool emptyAllocation) |
virtual void | submitTextureData () |
![]() | |
PROPERTY_RW (ResourcePath, assetLocation) | |
PROPERTY_RW (Str< 256 >, assetName) | |
PROPERTY_R (size_t, descriptorHash) | |
virtual void | setState (ResourceState currentState) |
![]() | |
GraphicsResource (GFXDevice &context, Type type, I64 GUID, U64 nameHash) | |
![]() | |
NonCopyable ()=default | |
~NonCopyable ()=default | |
![]() | |
NonMovable ()=default | |
~NonMovable ()=default | |
Static Protected Attributes | |
static bool | s_useDDSCache = true |
static SamplerDescriptor | s_defaultSampler |
static Handle< Texture > | s_defaultTexture2D = INVALID_HANDLE<Texture> |
static Handle< Texture > | s_defaultTexture2DArray = INVALID_HANDLE<Texture> |
static Str< 64 > | s_missingTextureFileName |
Friends | |
class | ResourceCache |
struct | ResourceLoader |
template<typename T > | |
class | ImplResourceLoader |
class | Attorney::TextureKernel |
Additional Inherited Members | |
![]() | |
enum class | Type : U8 { RENDER_TARGET , SHADER_BUFFER , BUFFER , SHADER , SHADER_PROGRAM , TEXTURE , COUNT } |
![]() | |
Mutex | _callbackLock {} |
![]() | |
std::atomic< ResourceState > | _resourceState |
![]() | |
const I64 | _guid |
![]() | |
GFXDevice & | _context |
|
explicit |
Definition at line 128 of file Texture.cpp.
|
overridevirtual |
Definition at line 194 of file Texture.cpp.
|
protected |
Definition at line 422 of file Texture.cpp.
void Texture::createWithData | ( | const Byte * | data, |
size_t | dataSize, | ||
const vec2< U16 > & | dimensions, | ||
const PixelAlignment & | pixelUnpackAlignment | ||
) |
Definition at line 334 of file Texture.cpp.
void Texture::createWithData | ( | const Byte * | data, |
size_t | dataSize, | ||
const vec3< U16 > & | dimensions, | ||
const PixelAlignment & | pixelUnpackAlignment | ||
) |
Definition at line 344 of file Texture.cpp.
void Texture::createWithData | ( | const ImageTools::ImageData & | imageData, |
const PixelAlignment & | pixelUnpackAlignment | ||
) |
API-dependent loading function that uploads ptr data to the GPU using the specified parameters.
Definition at line 394 of file Texture.cpp.
|
staticnoexcept |
Definition at line 100 of file Texture.cpp.
Definition at line 90 of file Texture.cpp.
Definition at line 95 of file Texture.cpp.
|
staticnoexcept |
Definition at line 105 of file Texture.cpp.
|
noexcept |
Definition at line 597 of file Texture.cpp.
Definition at line 620 of file Texture.cpp.
Definition at line 627 of file Texture.cpp.
|
noexcept |
Definition at line 613 of file Texture.cpp.
|
noexcept |
Definition at line 634 of file Texture.cpp.
|
noexcept |
Definition at line 641 of file Texture.cpp.
|
overridevirtual |
Loading and unloading interface.
Reimplemented from Divide::CachedResource.
Definition at line 198 of file Texture.cpp.
|
protectedpure virtual |
Implemented in Divide::noTexture, Divide::glTexture, and Divide::vkTexture.
|
protectedpure virtual |
Implemented in Divide::noTexture, Divide::glTexture, and Divide::vkTexture.
|
protected |
Use STB to load a file into a Texture Object.
Definition at line 296 of file Texture.cpp.
|
protected |
Load texture data using the specified file name.
Definition at line 218 of file Texture.cpp.
|
noexcept |
Definition at line 282 of file Texture.cpp.
|
staticnoexcept |
Definition at line 78 of file Texture.cpp.
|
static |
Definition at line 41 of file Texture.cpp.
|
overridevirtual |
Reimplemented from Divide::CachedResource.
Definition at line 212 of file Texture.cpp.
|
protectedvirtual |
Reimplemented in Divide::glTexture, and Divide::vkTexture.
Definition at line 324 of file Texture.cpp.
Divide::Texture::PROPERTY_R | ( | bool | , |
hasTranslucency | , | ||
false | |||
) |
If the texture has an alpha channel and at least one pixel is translucent, return true.
Divide::Texture::PROPERTY_R | ( | bool | , |
hasTransparency | , | ||
false | |||
) |
If the texture has an alpha channel and at least on pixel is fully transparent and no pixels are partially transparent, return true.
Divide::Texture::PROPERTY_R | ( | bool | , |
loadedFromFile | , | ||
false | |||
) |
Divide::Texture::PROPERTY_R | ( | TextureDescriptor | , |
descriptor | |||
) |
Divide::Texture::PROPERTY_R | ( | U16 | , |
depth | , | ||
1u | |||
) |
Depth for TEXTURE_3D, layer count for TEXTURE_1/2D/CUBE_ARRAY. For cube arrays, numSlices = depth * 6u.
Divide::Texture::PROPERTY_R | ( | U16 | , |
mipCount | , | ||
1u | |||
) |
Get the number of mips.
|
pure virtual |
Implemented in Divide::noTexture, Divide::vkTexture, and Divide::glTexture.
void Texture::replaceData | ( | const Byte * | data, |
size_t | dataSize, | ||
const vec3< U16 > & | offset, | ||
const vec3< U16 > & | range, | ||
const PixelAlignment & | pixelUnpackAlignment | ||
) |
Definition at line 371 of file Texture.cpp.
void Texture::setSampleCount | ( | U8 | newSampleCount | ) |
Change the number of MSAA samples for this current texture.
Definition at line 531 of file Texture.cpp.
|
protectedvirtual |
Reimplemented in Divide::glTexture.
Definition at line 339 of file Texture.cpp.
|
staticnoexcept |
Definition at line 85 of file Texture.cpp.
|
protected |
Definition at line 541 of file Texture.cpp.
|
friend |
|
friend |
|
friend |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |