| 855 | // == Model ======================================================================================= |
| 856 | |
| 857 | void Model::CreateFromSDKMeshFile(ID3D11Device* device, LPCWSTR fileName, const wchar* normalMapSuffix, |
| 858 | bool generateTangentFrame, bool overrideNormalMaps, bool forceSRGB) |
| 859 | { |
| 860 | Assert_(FileExists(fileName)); |
| 861 | |
| 862 | // Use the SDKMesh class to load in the data |
| 863 | SDKMesh sdkMesh; |
| 864 | sdkMesh.Create(fileName); |
| 865 | |
| 866 | fileDirectory = GetDirectoryFromFilePath(fileName); |
| 867 | |
| 868 | // Make materials |
| 869 | uint32 numMaterials = sdkMesh.GetNumMaterials(); |
| 870 | for(uint32 i = 0; i < numMaterials; ++i) |
| 871 | { |
| 872 | MeshMaterial material; |
| 873 | SDKMESH_MATERIAL* mat = sdkMesh.GetMaterial(i); |
| 874 | material.DiffuseMapName = AnsiToWString(mat->DiffuseTexture); |
| 875 | material.NormalMapName = AnsiToWString(mat->NormalTexture); |
| 876 | |
| 877 | // Add the normal map prefix |
| 878 | if (normalMapSuffix && material.DiffuseMapName.length() > 0 |
| 879 | && (material.NormalMapName.length() == 0 || overrideNormalMaps)) |
| 880 | { |
| 881 | wstring base = GetFilePathWithoutExtension(material.DiffuseMapName.c_str()); |
| 882 | wstring extension = GetFileExtension(material.DiffuseMapName.c_str()); |
| 883 | material.NormalMapName = base + normalMapSuffix + L"." + extension; |
| 884 | } |
| 885 | |
| 886 | LoadMaterialResources(material, fileDirectory, device, forceSRGB); |
| 887 | |
| 888 | meshMaterials.push_back(material); |
| 889 | } |
| 890 | |
| 891 | uint32 numMeshes = sdkMesh.GetNumMeshes(); |
| 892 | meshes.resize(numMeshes); |
| 893 | for(uint32 meshIdx = 0; meshIdx < numMeshes; ++meshIdx) |
| 894 | meshes[meshIdx].InitFromSDKMesh(device, sdkMesh, meshIdx, generateTangentFrame); |
| 895 | } |
| 896 | |
| 897 | void Model::CreateWithAssimp(ID3D11Device* device, const wchar* fileName, bool forceSRGB) |
| 898 | { |
nothing calls this directly
no test coverage detected