aiProcess_JoinIdenticalVertices – Identifies and joins identical vertex data sets within all imported meshes, so that we don’t have duplicated data.aiProcess_Triangulate – Splits faces with more indices to faces with 3 indices – triangles.aiProcess_GenSmoothNormals – Generates smooth normals for the model, if the normals are not already present in the file.aiProcess_CalcTangentSpace – Calculates the tangents and bitangents for the imported meshes (we will make use of this in future tutorials).We also provide many flags for loading, I will list them here: The beginning of the function tries to import a 3D model using Assimp::Importer class. Let’s examine the loading method now step-by-step:īool AssimpModel::loadModelFromFile(const std::string& filePath, const std::string& defaultTextureName)Ĭonst aiScene* scene = importer.ReadFile(filePath, This is a very simplified solution for now, but it works for most simple models that we will load. If that is the case, we simply provide the name of a texture by ourselves. What is that and why is that? The reason is Assimp sometimes doesn’t extract material data from 3D models (usually from OBJ files) and it doesn’t retrieve name of a texture used. One parameter is simply path to a 3D model file and second is called defaultTextureName. Static std::string aiStringToStdString(const aiString& aiStringStruct) īecause this class is inherited from StaticMesh3D, most of the common properties are simply inherited and the only new function there is loadModelFromFile, which takes two parameters. Void loadMaterialTexture(const int materialIndex, const std::string& textureFileName) Before we do anything else, let’s have an overview of the class to make a big picture:ĪssimpModel(const std::string& filePath, const std::string& defaultTextureName,īool withPositions, bool withTextureCoordinates, bool withNormals) ĪssimpModel(const std::string& filePath, bool withPositions = true, bool withTextureCoordinates = true, bool withNormals = true) īool loadModelFromFile(const std::string& filePath, const std::string& defaultTextureName = "")
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |