MCPcopy Create free account
hub / github.com/TheRealMJP/MSAAFilter / LoadMaterialResources

Method LoadMaterialResources

SampleFramework11/v1.01/Graphics/Model.cpp:1025–1051  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1023}
1024
1025void 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}

Callers

nothing calls this directly

Calls 2

FileExistsFunction · 0.85
LoadTextureFunction · 0.85

Tested by

no test coverage detected