MCPcopy Create free account
hub / github.com/dfranx/SHADERed / LoadFromFile

Method LoadFromFile

src/SHADERed/Engine/Model.cpp:75–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73 }
74
75 bool Model::LoadFromFile(const std::string& path)
76 {
77 ed::Logger::Get().Log("Loading a 3D model from file \"" + path + "\"");
78
79 // read file via ASSIMP
80 Assimp::Importer importer;
81 const aiScene* scene = importer.ReadFile(path, aiProcess_Triangulate | aiProcess_FlipUVs);
82
83 // check for errors
84 if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) // if is Not Zero
85 {
86 ed::Logger::Get().Log("Assimp has detected an error \"" + std::string(importer.GetErrorString()) + "\"", true);
87 return false;
88 }
89
90 Directory = path.substr(0, path.find_last_of("/\\"));
91 m_processNode(scene->mRootNode, scene);
92
93 m_findBounds();
94
95 return true;
96 }
97 void Model::m_findBounds()
98 {
99 m_minBound = glm::vec3(std::numeric_limits<float>::infinity());

Callers 5

LoadModelMethod · 0.45
GizmoObjectMethod · 0.45
CreateAudioMethod · 0.45
LoadBufferFromModelMethod · 0.45
m_initMethod · 0.45

Calls 1

LogMethod · 0.80

Tested by

no test coverage detected