diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-11-25 03:19:41 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-11-25 03:19:41 +0000 |
| commit | 942fdb82bb026350f1a27856efbc231e89fcada6 (patch) | |
| tree | 3769a22f6e52831d2383f99f328e393404c97e37 /TextureLoader/interface/TextureLoader.h | |
| parent | clang-formatted NativeApp (diff) | |
| download | DiligentTools-942fdb82bb026350f1a27856efbc231e89fcada6.tar.gz DiligentTools-942fdb82bb026350f1a27856efbc231e89fcada6.zip | |
clang-formatted TextureLoader project
Diffstat (limited to 'TextureLoader/interface/TextureLoader.h')
| -rw-r--r-- | TextureLoader/interface/TextureLoader.h | 162 |
1 files changed, 82 insertions, 80 deletions
diff --git a/TextureLoader/interface/TextureLoader.h b/TextureLoader/interface/TextureLoader.h index 0c409e6..8b1723d 100644 --- a/TextureLoader/interface/TextureLoader.h +++ b/TextureLoader/interface/TextureLoader.h @@ -30,85 +30,87 @@ namespace Diligent { - /// Texture loading information - struct TextureLoadInfo - { - /// Texture name passed over to the texture creation method - const Char* Name = nullptr; +// clang-format off +/// Texture loading information +struct TextureLoadInfo +{ + /// Texture name passed over to the texture creation method + const Char* Name = nullptr; - /// Usage - USAGE Usage = USAGE_STATIC; - - /// Bind flags - BIND_FLAGS BindFlags = BIND_SHADER_RESOURCE; - - /// Number of mip levels - Uint32 MipLevels = 0; - - /// CPU access flags - CPU_ACCESS_FLAGS CPUAccessFlags = CPU_ACCESS_NONE; - - /// Flag indicating if this texture uses sRGB gamma encoding - Bool IsSRGB = False; - - /// Flag indicating that the procedure should generate lower mip levels - Bool GenerateMips = True; - - /// Texture format - TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN; - - explicit TextureLoadInfo(const Char* _Name, - USAGE _Usage = TextureLoadInfo{}.Usage, - BIND_FLAGS _BindFlags = TextureLoadInfo{}.BindFlags, - Uint32 _MipLevels = TextureLoadInfo{}.MipLevels, - CPU_ACCESS_FLAGS _CPUAccessFlags = TextureLoadInfo{}.CPUAccessFlags, - Bool _IsSRGB = TextureLoadInfo{}.IsSRGB, - Bool _GenerateMips = TextureLoadInfo{}.GenerateMips, - TEXTURE_FORMAT _Format = TextureLoadInfo{}.Format) : - Name (_Name), - Usage (_Usage), - BindFlags (_BindFlags), - MipLevels (_MipLevels), - CPUAccessFlags (_CPUAccessFlags), - IsSRGB (_IsSRGB), - GenerateMips (_GenerateMips), - Format (_Format) - {} - - TextureLoadInfo(){}; - }; - - /// Creates a texture from 2D image - - /// \param [in] pSrcImage - Pointer to the source image data - /// \param [in] TexLoadInfo - Texture loading information - /// \param [in] pDevice - Render device that will be used to create the texture - /// \param [out] ppTexture - Memory location where pointer to the created texture will be stored - void CreateTextureFromImage( Image* pSrcImage, - const TextureLoadInfo& TexLoadInfo, - IRenderDevice* pDevice, - ITexture** ppTexture ); - - /// Creates a texture from DDS data blob - - /// \param [in] pDDSData - Pointer to the DDS data blob - /// \param [in] TexLoadInfo - Texture loading information - /// \param [in] pDevice - Render device that will be used to create the texture - /// \param [out] ppTexture - Memory location where pointer to the created texture will be stored - void CreateTextureFromDDS( IDataBlob* pDDSData, - const TextureLoadInfo& TexLoadInfo, - IRenderDevice* pDevice, - ITexture** ppTexture ); - - - /// Creates a texture from KTX data blob - - /// \param [in] pKTXData - Pointer to the KTX data blob - /// \param [in] TexLoadInfo - Texture loading information - /// \param [in] pDevice - Render device that will be used to create the texture - /// \param [out] ppTexture - Memory location where pointer to the created texture will be stored - void CreateTextureFromKTX( IDataBlob* pKTXData, - const TextureLoadInfo& TexLoadInfo, - IRenderDevice* pDevice, - ITexture** ppTexture ); + /// Usage + USAGE Usage = USAGE_STATIC; + + /// Bind flags + BIND_FLAGS BindFlags = BIND_SHADER_RESOURCE; + + /// Number of mip levels + Uint32 MipLevels = 0; + + /// CPU access flags + CPU_ACCESS_FLAGS CPUAccessFlags = CPU_ACCESS_NONE; + + /// Flag indicating if this texture uses sRGB gamma encoding + Bool IsSRGB = False; + + /// Flag indicating that the procedure should generate lower mip levels + Bool GenerateMips = True; + + /// Texture format + TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN; + + explicit TextureLoadInfo(const Char* _Name, + USAGE _Usage = TextureLoadInfo{}.Usage, + BIND_FLAGS _BindFlags = TextureLoadInfo{}.BindFlags, + Uint32 _MipLevels = TextureLoadInfo{}.MipLevels, + CPU_ACCESS_FLAGS _CPUAccessFlags = TextureLoadInfo{}.CPUAccessFlags, + Bool _IsSRGB = TextureLoadInfo{}.IsSRGB, + Bool _GenerateMips = TextureLoadInfo{}.GenerateMips, + TEXTURE_FORMAT _Format = TextureLoadInfo{}.Format) : + Name {_Name}, + Usage {_Usage}, + BindFlags {_BindFlags}, + MipLevels {_MipLevels}, + CPUAccessFlags {_CPUAccessFlags}, + IsSRGB {_IsSRGB}, + GenerateMips {_GenerateMips}, + Format {_Format} + {} + + TextureLoadInfo(){}; }; +// clang-format on + +/// Creates a texture from 2D image + +/// \param [in] pSrcImage - Pointer to the source image data +/// \param [in] TexLoadInfo - Texture loading information +/// \param [in] pDevice - Render device that will be used to create the texture +/// \param [out] ppTexture - Memory location where pointer to the created texture will be stored +void CreateTextureFromImage(Image* pSrcImage, + const TextureLoadInfo& TexLoadInfo, + IRenderDevice* pDevice, + ITexture** ppTexture); + +/// Creates a texture from DDS data blob + +/// \param [in] pDDSData - Pointer to the DDS data blob +/// \param [in] TexLoadInfo - Texture loading information +/// \param [in] pDevice - Render device that will be used to create the texture +/// \param [out] ppTexture - Memory location where pointer to the created texture will be stored +void CreateTextureFromDDS(IDataBlob* pDDSData, + const TextureLoadInfo& TexLoadInfo, + IRenderDevice* pDevice, + ITexture** ppTexture); + + +/// Creates a texture from KTX data blob + +/// \param [in] pKTXData - Pointer to the KTX data blob +/// \param [in] TexLoadInfo - Texture loading information +/// \param [in] pDevice - Render device that will be used to create the texture +/// \param [out] ppTexture - Memory location where pointer to the created texture will be stored +void CreateTextureFromKTX(IDataBlob* pKTXData, + const TextureLoadInfo& TexLoadInfo, + IRenderDevice* pDevice, + ITexture** ppTexture); +}; // namespace Diligent |
