diff --git a/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/Mesh.h b/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/Mesh.h index fb2f7f7db..125b3e585 100644 --- a/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/Mesh.h +++ b/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/Mesh.h @@ -20,8 +20,8 @@ struct VERTEX { }; struct Texture { - string type; - string path; + std::string type; + std::string path; ID3D11ShaderResourceView *texture; void Release() { @@ -36,7 +36,7 @@ public: std::vector textures; ID3D11Device *dev; - Mesh(ID3D11Device *dev, const vector& vertices, const vector& indices, const vector& textures) : + Mesh(ID3D11Device *dev, const std::vector& vertices, const std::vector& indices, const std::vector& textures) : vertices(vertices), indices(indices), textures(textures), diff --git a/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/ModelLoader.cpp b/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/ModelLoader.cpp index 1ab5b61fb..806320144 100644 --- a/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/ModelLoader.cpp +++ b/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/ModelLoader.cpp @@ -42,13 +42,13 @@ void ModelLoader::Draw(ID3D11DeviceContext * devcon) { } } -string textype; +std::string textype; Mesh ModelLoader::processMesh(aiMesh * mesh, const aiScene * scene) { // Data to fill - vector vertices; - vector indices; - vector textures; + std::vector vertices; + std::vector indices; + std::vector textures; if (mesh->mMaterialIndex >= 0) { aiMaterial* mat = scene->mMaterials[mesh->mMaterialIndex]; @@ -84,15 +84,15 @@ Mesh ModelLoader::processMesh(aiMesh * mesh, const aiScene * scene) { if (mesh->mMaterialIndex >= 0) { aiMaterial* material = scene->mMaterials[mesh->mMaterialIndex]; - vector diffuseMaps = this->loadMaterialTextures(material, aiTextureType_DIFFUSE, "texture_diffuse", scene); + std::vector diffuseMaps = this->loadMaterialTextures(material, aiTextureType_DIFFUSE, "texture_diffuse", scene); textures.insert(textures.end(), diffuseMaps.begin(), diffuseMaps.end()); } return Mesh(dev, vertices, indices, textures); } -vector ModelLoader::loadMaterialTextures(aiMaterial * mat, aiTextureType type, string typeName, const aiScene * scene) { - vector textures; +std::vector ModelLoader::loadMaterialTextures(aiMaterial * mat, aiTextureType type, std::string typeName, const aiScene * scene) { + std::vector textures; for (UINT i = 0; i < mat->GetTextureCount(type); i++) { aiString str; mat->GetTexture(type, i, &str); @@ -112,9 +112,9 @@ vector ModelLoader::loadMaterialTextures(aiMaterial * mat, aiTextureTyp int textureindex = getTextureIndex(&str); texture.texture = getTextureFromModel(scene, textureindex); } else { - string filename = string(str.C_Str()); + std::string filename = std::string(str.C_Str()); filename = directory + '/' + filename; - wstring filenamews = wstring(filename.begin(), filename.end()); + std::wstring filenamews = std::wstring(filename.begin(), filename.end()); hr = CreateWICTextureFromFile(dev, devcon, filenamews.c_str(), nullptr, &texture.texture); if (FAILED(hr)) MessageBox(hwnd, "Texture couldn't be loaded", "Error!", MB_ICONERROR | MB_OK); @@ -148,10 +148,10 @@ void ModelLoader::processNode(aiNode * node, const aiScene * scene) { } } -string ModelLoader::determineTextureType(const aiScene * scene, aiMaterial * mat) { +std::string ModelLoader::determineTextureType(const aiScene * scene, aiMaterial * mat) { aiString textypeStr; mat->GetTexture(aiTextureType_DIFFUSE, 0, &textypeStr); - string textypeteststr = textypeStr.C_Str(); + std::string textypeteststr = textypeStr.C_Str(); if (textypeteststr == "*0" || textypeteststr == "*1" || textypeteststr == "*2" || textypeteststr == "*3" || textypeteststr == "*4" || textypeteststr == "*5") { if (scene->mTextures[0]->mHeight == 0) { return "embedded compressed texture"; @@ -159,7 +159,7 @@ string ModelLoader::determineTextureType(const aiScene * scene, aiMaterial * mat return "embedded non-compressed texture"; } } - if (textypeteststr.find('.') != string::npos) { + if (textypeteststr.find('.') != std::string::npos) { return "textures are on disk"; } @@ -167,7 +167,7 @@ string ModelLoader::determineTextureType(const aiScene * scene, aiMaterial * mat } int ModelLoader::getTextureIndex(aiString * str) { - string tistr; + std::string tistr; tistr = str->C_Str(); tistr = tistr.substr(1); return stoi(tistr); diff --git a/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/ModelLoader.h b/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/ModelLoader.h index 9b4a53c27..18ad03fa0 100644 --- a/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/ModelLoader.h +++ b/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/ModelLoader.h @@ -28,14 +28,14 @@ private: ID3D11Device *dev; ID3D11DeviceContext *devcon; std::vector meshes; - string directory; - vector textures_loaded; + std::string directory; + std::vector textures_loaded; HWND hwnd; void processNode(aiNode* node, const aiScene* scene); Mesh processMesh(aiMesh* mesh, const aiScene* scene); - vector loadMaterialTextures(aiMaterial* mat, aiTextureType type, string typeName, const aiScene* scene); - string determineTextureType(const aiScene* scene, aiMaterial* mat); + std::vector loadMaterialTextures(aiMaterial* mat, aiTextureType type, std::string typeName, const aiScene* scene); + std::string determineTextureType(const aiScene* scene, aiMaterial* mat); int getTextureIndex(aiString* str); ID3D11ShaderResourceView* getTextureFromModel(const aiScene* scene, int textureindex); };