| 1023 | } |
| 1024 | |
| 1025 | void Model::LoadMaterialResources(MeshMaterial& material, const wstring& directory, ID3D11Device* device, bool forceSRGB) |
| 1026 | { |
| 1027 | // Load the diffuse map |
| 1028 | wstring diffuseMapPath = directory + material.DiffuseMapName; |
| 1029 | if(material.DiffuseMapName.length() > 1 && FileExists(diffuseMapPath.c_str())) |
| 1030 | material.DiffuseMap = LoadTexture(device, diffuseMapPath.c_str(), forceSRGB); |
| 1031 | else |
| 1032 | { |
| 1033 | static ID3D11ShaderResourceViewPtr defaultDiffuse; |
| 1034 | if(defaultDiffuse == nullptr) |
| 1035 | defaultDiffuse = LoadTexture(device, L"..\\Content\\Textures\\Default.dds"); |
| 1036 | material.DiffuseMap = defaultDiffuse; |
| 1037 | } |
| 1038 | |
| 1039 | // Load the normal map |
| 1040 | wstring normalMapPath = directory + material.NormalMapName; |
| 1041 | |
| 1042 | if(material.NormalMapName.length() > 1 && FileExists(normalMapPath.c_str())) |
| 1043 | material.NormalMap = LoadTexture(device, normalMapPath.c_str()); |
| 1044 | else |
| 1045 | { |
| 1046 | static ID3D11ShaderResourceViewPtr defaultNormalMap; |
| 1047 | if(defaultNormalMap == nullptr) |
| 1048 | defaultNormalMap = LoadTexture(device, L"..\\Content\\Textures\\DefaultNormalMap.dds"); |
| 1049 | material.NormalMap = defaultNormalMap; |
| 1050 | } |
| 1051 | } |
| 1052 | |
| 1053 | } |
nothing calls this directly
no test coverage detected