summaryrefslogtreecommitdiffstats
path: root/TextureLoader
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-05-03 04:45:01 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-05-03 04:45:01 +0000
commitbc11fc970f7d7b0cbec70ef74732cbd49f23ccd1 (patch)
treebc689fa80bf655c304551c4698a02c15cdb66974 /TextureLoader
parentUpdate GLTF loader; fixed warning in KTX loader (diff)
downloadDiligentTools-bc11fc970f7d7b0cbec70ef74732cbd49f23ccd1.tar.gz
DiligentTools-bc11fc970f7d7b0cbec70ef74732cbd49f23ccd1.zip
Fixed default ctor of TextureLoadInfo struct
Diffstat (limited to 'TextureLoader')
-rw-r--r--TextureLoader/interface/TextureLoader.h30
-rw-r--r--TextureLoader/src/TextureLoader.cpp20
2 files changed, 25 insertions, 25 deletions
diff --git a/TextureLoader/interface/TextureLoader.h b/TextureLoader/interface/TextureLoader.h
index 499e741..8522d17 100644
--- a/TextureLoader/interface/TextureLoader.h
+++ b/TextureLoader/interface/TextureLoader.h
@@ -34,37 +34,37 @@ namespace Diligent
struct TextureLoadInfo
{
/// Texture name passed over to the texture creation method
- const Char *Name;
+ const Char* Name = nullptr;
/// Usage
- USAGE Usage;
+ USAGE Usage = USAGE_STATIC;
/// Bind flags
- BIND_FLAGS BindFlags;
+ BIND_FLAGS BindFlags = BIND_SHADER_RESOURCE;
/// Number of mip levels
- Uint32 MipLevels;
+ Uint32 MipLevels = 0;
/// CPU access flags
- CPU_ACCESS_FLAGS CPUAccessFlags;
+ CPU_ACCESS_FLAGS CPUAccessFlags = CPU_ACCESS_NONE;
/// Flag indicating if this texture uses sRGB gamma encoding
- Bool IsSRGB;
+ Bool IsSRGB = False;
/// Flag indicating that the procedure should generate lower mip levels
- Bool GenerateMips;
+ Bool GenerateMips = True;
/// Texture format
- TEXTURE_FORMAT Format;
+ TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
explicit TextureLoadInfo(const Char* _Name,
- USAGE _Usage = USAGE_STATIC,
- BIND_FLAGS _BindFlags = BIND_SHADER_RESOURCE,
- Uint32 _MipLevels = 0,
- CPU_ACCESS_FLAGS _CPUAccessFlags = CPU_ACCESS_NONE,
- Bool _IsSRGB = False,
- Bool _GenerateMips = True,
- TEXTURE_FORMAT _Format = TEX_FORMAT_UNKNOWN) :
+ 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),
diff --git a/TextureLoader/src/TextureLoader.cpp b/TextureLoader/src/TextureLoader.cpp
index 50ba00a..f2dd427 100644
--- a/TextureLoader/src/TextureLoader.cpp
+++ b/TextureLoader/src/TextureLoader.cpp
@@ -103,22 +103,22 @@ void RGBToRGBA(const void* pRGBData,
}
void CreateTextureFromImage( Image* pSrcImage,
- const TextureLoadInfo& TexLoadInfo,
- IRenderDevice* pDevice,
- ITexture** ppTexture )
+ const TextureLoadInfo& TexLoadInfo,
+ IRenderDevice* pDevice,
+ ITexture** ppTexture )
{
const auto& ImgDesc = pSrcImage->GetDesc();
TextureDesc TexDesc;
- TexDesc.Name = TexLoadInfo.Name;
- TexDesc.Type = RESOURCE_DIM_TEX_2D;
- TexDesc.Width = ImgDesc.Width;
- TexDesc.Height = ImgDesc.Height;
+ TexDesc.Name = TexLoadInfo.Name;
+ TexDesc.Type = RESOURCE_DIM_TEX_2D;
+ TexDesc.Width = ImgDesc.Width;
+ TexDesc.Height = ImgDesc.Height;
TexDesc.MipLevels = ComputeMipLevelsCount( TexDesc.Width, TexDesc.Height );
if( TexLoadInfo.MipLevels > 0 )
TexDesc.MipLevels = std::min(TexDesc.MipLevels, TexLoadInfo.MipLevels);
- TexDesc.Usage = TexLoadInfo.Usage;
- TexDesc.BindFlags = TexLoadInfo.BindFlags;
- TexDesc.Format = TexLoadInfo.Format;
+ TexDesc.Usage = TexLoadInfo.Usage;
+ TexDesc.BindFlags = TexLoadInfo.BindFlags;
+ TexDesc.Format = TexLoadInfo.Format;
TexDesc.CPUAccessFlags = TexLoadInfo.CPUAccessFlags;
auto ChannelDepth = ImgDesc.BitsPerPixel / ImgDesc.NumComponents;