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
|
// 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];
|
return mManager[name];
|
||||||
}
|
}
|
||||||
@ -272,13 +272,11 @@ ModelMesh::Textures Model::loadMaterialTextures(aiMaterial * mat,
|
|||||||
|
|
||||||
void Model::sortModelMeshes()
|
void Model::sortModelMeshes()
|
||||||
{
|
{
|
||||||
auto cameraPos = Scene::getCamera().getTransform();
|
auto cameraPos = Scene::getCamera().getTransform().getTranslation();
|
||||||
auto cameraDistance = [&cameraPos](const ModelMesh & a, const ModelMesh & b) {
|
auto cameraDistance = [&cameraPos](const ModelMesh & a, const ModelMesh & b) {
|
||||||
// Sort by the first vertex position in the model
|
// Sort by the first vertex position in the model
|
||||||
return (cameraPos.getTranslation().distanceToPoint(
|
return cameraPos.distanceToPoint(a.mVertices[0].mPosition)
|
||||||
a.mVertices[0].mPosition))
|
< cameraPos.distanceToPoint(b.mVertices[0].mPosition);
|
||||||
< (cameraPos.getTranslation().distanceToPoint(
|
|
||||||
b.mVertices[0].mPosition));
|
|
||||||
};
|
};
|
||||||
std::sort(mMeshes.begin(), mMeshes.end(), cameraDistance);
|
std::sort(mMeshes.begin(), mMeshes.end(), cameraDistance);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user