Merge branch 'master' of github.com:highfidelity/hifi into brown

This commit is contained in:
Sam Gateau 2019-02-08 12:04:59 -08:00
commit f9e827afa5
2 changed files with 26 additions and 40 deletions

View file

@ -13,6 +13,17 @@
#include "ModelMath.h"
bool needTangents(const hfm::Mesh& mesh, const QHash<QString, hfm::Material>& materials) {
// Check if we actually need to calculate the tangents
for (const auto& meshPart : mesh.parts) {
auto materialIt = materials.find(meshPart.materialID);
if (materialIt != materials.end() && (*materialIt).needTangentSpace()) {
return true;
}
}
return false;
}
void CalculateMeshTangentsTask::run(const baker::BakeContextPointer& context, const Input& input, Output& output) {
const auto& normalsPerMesh = input.get0();
const std::vector<hfm::Mesh>& meshes = input.get1();
@ -28,29 +39,10 @@ void CalculateMeshTangentsTask::run(const baker::BakeContextPointer& context, co
auto& tangentsOut = tangentsPerMeshOut[tangentsPerMeshOut.size()-1];
// Check if we already have tangents and therefore do not need to do any calculation
// Otherwise confirm if we have the normals needed, and need to calculate the tangents
if (!tangentsIn.empty()) {
tangentsOut = tangentsIn.toStdVector();
continue;
}
// Check if we have normals, and if not then tangents can't be calculated
if (normals.empty()) {
continue;
}
// Check if we actually need to calculate the tangents
bool needTangents = false;
for (const auto& meshPart : mesh.parts) {
auto materialIt = materials.find(meshPart.materialID);
if (materialIt != materials.end() && (*materialIt).needTangentSpace()) {
needTangents = true;
break;
}
}
if (needTangents) {
continue;
}
} else if (!normals.empty() && needTangents(mesh, materials)) {
tangentsOut.resize(normals.size());
baker::calculateTangents(mesh,
[&mesh, &normals, &tangentsOut](int firstIndex, int secondIndex, glm::vec3* outVertices, glm::vec2* outTexCoords, glm::vec3& outNormal) {
@ -63,3 +55,4 @@ void CalculateMeshTangentsTask::run(const baker::BakeContextPointer& context, co
});
}
}
}

View file

@ -157,13 +157,6 @@ if (WIN32)
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/AppDataHighFidelity" "AppDataHighFidelity"
)
endif ()
# add a custom command to copy the SSL DLLs
add_custom_command(
TARGET ${TARGET_NAME}
POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory "$ENV{VCPKG_ROOT}/installed/x64-windows/bin" "$<TARGET_FILE_DIR:${TARGET_NAME}>"
)
elseif (APPLE)
add_custom_command(
TARGET ${TARGET_NAME}