Cleanup.
This commit is contained in:
parent
6528e872e5
commit
3d4df2eb76
@ -68,7 +68,7 @@ void Model::setLightPosition(const QString & lightName, const char * uniform)
|
||||
}
|
||||
|
||||
// Static function to access ModelManager for getting Models by name
|
||||
Model * Qtk::Model::getInstance(const char * name)
|
||||
Model * Model::getInstance(const char * name)
|
||||
{
|
||||
return mManager[name];
|
||||
}
|
||||
@ -272,13 +272,11 @@ ModelMesh::Textures Model::loadMaterialTextures(aiMaterial * mat,
|
||||
|
||||
void Model::sortModelMeshes()
|
||||
{
|
||||
auto cameraPos = Scene::getCamera().getTransform();
|
||||
auto cameraPos = Scene::getCamera().getTransform().getTranslation();
|
||||
auto cameraDistance = [&cameraPos](const ModelMesh & a, const ModelMesh & b) {
|
||||
// Sort by the first vertex position in the model
|
||||
return (cameraPos.getTranslation().distanceToPoint(
|
||||
a.mVertices[0].mPosition))
|
||||
< (cameraPos.getTranslation().distanceToPoint(
|
||||
b.mVertices[0].mPosition));
|
||||
return cameraPos.distanceToPoint(a.mVertices[0].mPosition)
|
||||
< cameraPos.distanceToPoint(b.mVertices[0].mPosition);
|
||||
};
|
||||
std::sort(mMeshes.begin(), mMeshes.end(), cameraDistance);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user