Khaotic Engine Reborn
Loading...
Searching...
No Matches
TextureContainer Struct Reference

Public Member Functions

std::vector< ID3D11ShaderResourceView * > & Get (TextureType type) const
 
std::vector< std::wstring > GetPaths (TextureType type) const
 
ID3D11ShaderResourceView * GetTexture (TextureType type, int index) const
 
std::wstring GetTexturePath (TextureType type, int index) const
 
void ReleaseAll ()
 
void AssignTexture (TextureContainer &textContainer, ID3D11ShaderResourceView *texture, const std::wstring paths, int index)
 

Public Attributes

std::vector< ID3D11ShaderResourceView * > diffuse
 
std::vector< ID3D11ShaderResourceView * > normal
 
std::vector< ID3D11ShaderResourceView * > specular
 
std::vector< ID3D11ShaderResourceView * > alpha
 
std::vector< std::wstring > diffusePaths
 
std::vector< std::wstring > normalPaths
 
std::vector< std::wstring > specularPaths
 
std::vector< std::wstring > alphaPaths
 

Detailed Description

Definition at line 33 of file model_class.h.

Member Function Documentation

◆ AssignTexture()

void TextureContainer::AssignTexture ( TextureContainer & textContainer,
ID3D11ShaderResourceView * texture,
const std::wstring paths,
int index )
inline

Definition at line 105 of file model_class.h.

106 {
107 switch (index)
108 {
109 case 0:
110 textContainer.diffuse.push_back(texture);
111 textContainer.diffusePaths.push_back(paths);
112 break;
113 case 1:
114 textContainer.normal.push_back(texture);
115 textContainer.normalPaths.push_back(paths);
116 break;
117 case 2:
118 textContainer.specular.push_back(texture);
119 textContainer.specularPaths.push_back(paths);
120 break;
121 case 3:
122 textContainer.alpha.push_back(texture);
123 textContainer.alphaPaths.push_back(paths);
124 break;
125 default:
126 textContainer.diffuse.push_back(texture);
127 textContainer.diffusePaths.push_back(paths);
128 break;
129 }
130 }

◆ Get()

std::vector< ID3D11ShaderResourceView * > & TextureContainer::Get ( TextureType type) const
inline

Definition at line 50 of file model_class.h.

50 {
51 switch (type) {
52 case TextureType::Diffuse: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(diffuse);
53 case TextureType::Normal: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(normal);
54 case TextureType::Specular: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(specular);
55 case TextureType::Alpha: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(alpha);
56 default: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(diffuse);
57 }
58 }

◆ GetPaths()

std::vector< std::wstring > TextureContainer::GetPaths ( TextureType type) const
inline

Definition at line 61 of file model_class.h.

61 {
62 switch (type)
63 {
64 case TextureType::Diffuse: return std::vector<std::wstring>(diffusePaths);
65 case TextureType::Normal: return std::vector<std::wstring>(normalPaths);
66 case TextureType::Specular: return std::vector<std::wstring>(specularPaths);
67 case TextureType::Alpha: return std::vector<std::wstring>(alphaPaths);
68 default: return std::vector<std::wstring>(diffusePaths);
69 }
70 }

◆ GetTexture()

ID3D11ShaderResourceView * TextureContainer::GetTexture ( TextureType type,
int index ) const
inline

Definition at line 74 of file model_class.h.

74 {
75 auto& vec = Get(type);
76 if (index >= 0 && index < vec.size())
77 return vec[index];
78 return nullptr;
79 }

◆ GetTexturePath()

std::wstring TextureContainer::GetTexturePath ( TextureType type,
int index ) const
inline

Definition at line 82 of file model_class.h.

83 {
84 std::vector<std::wstring> path = GetPaths(type);
85 if (index >= 0 && index < path.size())
86 return path[index];
87 return L"";
88 }

◆ ReleaseAll()

void TextureContainer::ReleaseAll ( )
inline

Definition at line 92 of file model_class.h.

92 {
93 ReleaseVector(diffuse);
94 ReleaseVector(normal);
95 ReleaseVector(specular);
96 ReleaseVector(alpha);
97
98 ReleaseVector(diffusePaths);
99 ReleaseVector(normalPaths);
100 ReleaseVector(specularPaths);
101 ReleaseVector(alphaPaths);
102 }

Member Data Documentation

◆ alpha

std::vector<ID3D11ShaderResourceView*> TextureContainer::alpha

Definition at line 40 of file model_class.h.

◆ alphaPaths

std::vector<std::wstring> TextureContainer::alphaPaths

Definition at line 46 of file model_class.h.

◆ diffuse

std::vector<ID3D11ShaderResourceView*> TextureContainer::diffuse

Definition at line 37 of file model_class.h.

◆ diffusePaths

std::vector<std::wstring> TextureContainer::diffusePaths

Definition at line 43 of file model_class.h.

◆ normal

std::vector<ID3D11ShaderResourceView*> TextureContainer::normal

Definition at line 38 of file model_class.h.

◆ normalPaths

std::vector<std::wstring> TextureContainer::normalPaths

Definition at line 44 of file model_class.h.

◆ specular

std::vector<ID3D11ShaderResourceView*> TextureContainer::specular

Definition at line 39 of file model_class.h.

◆ specularPaths

std::vector<std::wstring> TextureContainer::specularPaths

Definition at line 45 of file model_class.h.


The documentation for this struct was generated from the following file: