mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 07:27:17 +02:00
Merge pull request #1482 from daleglass/qt5-fix-vector
Replace the deprecated QVector::fromStdVector and QVector::toStdVector().
This commit is contained in:
commit
d022b004f4
6 changed files with 24 additions and 17 deletions
|
@ -32,15 +32,16 @@ namespace baker {
|
||||||
|
|
||||||
void run(const BakeContextPointer& context, const Input& input, Output& output) {
|
void run(const BakeContextPointer& context, const Input& input, Output& output) {
|
||||||
const auto& hfmModelIn = input;
|
const auto& hfmModelIn = input;
|
||||||
output.edit0() = hfmModelIn->meshes.toStdVector();
|
output.edit0() = std::vector<hfm::Mesh>(hfmModelIn->meshes.begin(), hfmModelIn->meshes.end());
|
||||||
output.edit1() = hfmModelIn->originalURL;
|
output.edit1() = hfmModelIn->originalURL;
|
||||||
output.edit2() = hfmModelIn->meshIndicesToModelNames;
|
output.edit2() = hfmModelIn->meshIndicesToModelNames;
|
||||||
auto& blendshapesPerMesh = output.edit3();
|
auto& blendshapesPerMesh = output.edit3();
|
||||||
blendshapesPerMesh.reserve(hfmModelIn->meshes.size());
|
blendshapesPerMesh.reserve(hfmModelIn->meshes.size());
|
||||||
for (int i = 0; i < hfmModelIn->meshes.size(); i++) {
|
for (int i = 0; i < hfmModelIn->meshes.size(); i++) {
|
||||||
blendshapesPerMesh.push_back(hfmModelIn->meshes[i].blendshapes.toStdVector());
|
auto &blendshapes = hfmModelIn->meshes[i].blendshapes;
|
||||||
|
blendshapesPerMesh.push_back(std::vector<hfm::Blendshape>(blendshapes.begin(), blendshapes.end()));
|
||||||
}
|
}
|
||||||
output.edit4() = hfmModelIn->joints.toStdVector();
|
output.edit4() = std::vector<hfm::Joint>(hfmModelIn->joints.begin(), hfmModelIn->joints.end());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,8 +67,8 @@ namespace baker {
|
||||||
const auto& normals = safeGet(normalsPerBlendshape, j);
|
const auto& normals = safeGet(normalsPerBlendshape, j);
|
||||||
const auto& tangents = safeGet(tangentsPerBlendshape, j);
|
const auto& tangents = safeGet(tangentsPerBlendshape, j);
|
||||||
auto& blendshape = blendshapesOut[j];
|
auto& blendshape = blendshapesOut[j];
|
||||||
blendshape.normals = QVector<glm::vec3>::fromStdVector(normals);
|
blendshape.normals = QVector<glm::vec3>(normals.begin(), normals.end());
|
||||||
blendshape.tangents = QVector<glm::vec3>::fromStdVector(tangents);
|
blendshape.tangents = QVector<glm::vec3>(tangents.begin(), tangents.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,9 +92,13 @@ namespace baker {
|
||||||
for (int i = 0; i < numMeshes; i++) {
|
for (int i = 0; i < numMeshes; i++) {
|
||||||
auto& meshOut = meshesOut[i];
|
auto& meshOut = meshesOut[i];
|
||||||
meshOut._mesh = safeGet(graphicsMeshesIn, i);
|
meshOut._mesh = safeGet(graphicsMeshesIn, i);
|
||||||
meshOut.normals = QVector<glm::vec3>::fromStdVector(safeGet(normalsPerMeshIn, i));
|
auto stdNormals = safeGet(normalsPerMeshIn, i);
|
||||||
meshOut.tangents = QVector<glm::vec3>::fromStdVector(safeGet(tangentsPerMeshIn, i));
|
auto stdTangents = safeGet(tangentsPerMeshIn, i);
|
||||||
meshOut.blendshapes = QVector<hfm::Blendshape>::fromStdVector(safeGet(blendshapesPerMeshIn, i));
|
auto stdBlendshapes = safeGet(blendshapesPerMeshIn, i);
|
||||||
|
|
||||||
|
meshOut.normals = QVector<glm::vec3>(stdNormals.begin(), stdNormals.end());
|
||||||
|
meshOut.tangents = QVector<glm::vec3>(stdTangents.begin(), stdTangents.end());
|
||||||
|
meshOut.blendshapes = QVector<hfm::Blendshape>(stdBlendshapes.begin(), stdBlendshapes.end());
|
||||||
}
|
}
|
||||||
output = meshesOut;
|
output = meshesOut;
|
||||||
}
|
}
|
||||||
|
@ -107,8 +112,10 @@ namespace baker {
|
||||||
|
|
||||||
void run(const BakeContextPointer& context, const Input& input, Output& output) {
|
void run(const BakeContextPointer& context, const Input& input, Output& output) {
|
||||||
auto hfmModelOut = input.get0();
|
auto hfmModelOut = input.get0();
|
||||||
hfmModelOut->meshes = QVector<hfm::Mesh>::fromStdVector(input.get1());
|
auto stdMeshes = input.get1();
|
||||||
hfmModelOut->joints = QVector<hfm::Joint>::fromStdVector(input.get2());
|
auto stdJoints = input.get2();
|
||||||
|
hfmModelOut->meshes = QVector<hfm::Mesh>(stdMeshes.begin(), stdMeshes.end());
|
||||||
|
hfmModelOut->joints = QVector<hfm::Joint>(stdJoints.begin(), stdJoints.end());
|
||||||
hfmModelOut->jointRotationOffsets = input.get3();
|
hfmModelOut->jointRotationOffsets = input.get3();
|
||||||
hfmModelOut->jointIndices = input.get4();
|
hfmModelOut->jointIndices = input.get4();
|
||||||
hfmModelOut->flowData = input.get5();
|
hfmModelOut->flowData = input.get5();
|
||||||
|
@ -204,7 +211,7 @@ namespace baker {
|
||||||
hfm::Model::Pointer Baker::getHFMModel() const {
|
hfm::Model::Pointer Baker::getHFMModel() const {
|
||||||
return _engine->getOutput().get<BakerEngineBuilder::Output>().get0();
|
return _engine->getOutput().get<BakerEngineBuilder::Output>().get0();
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialMapping Baker::getMaterialMapping() const {
|
MaterialMapping Baker::getMaterialMapping() const {
|
||||||
return _engine->getOutput().get<BakerEngineBuilder::Output>().get1();
|
return _engine->getOutput().get<BakerEngineBuilder::Output>().get1();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ void CalculateBlendshapeNormalsTask::run(const baker::BakeContextPointer& contex
|
||||||
const auto& normalsIn = blendshape.normals;
|
const auto& normalsIn = blendshape.normals;
|
||||||
// Check if normals are already defined. Otherwise, calculate them from existing blendshape vertices.
|
// Check if normals are already defined. Otherwise, calculate them from existing blendshape vertices.
|
||||||
if (!normalsIn.empty()) {
|
if (!normalsIn.empty()) {
|
||||||
normalsPerBlendshapeOut.push_back(normalsIn.toStdVector());
|
normalsPerBlendshapeOut.push_back(std::vector<glm::vec3>(normalsIn.begin(), normalsIn.end()));
|
||||||
} else {
|
} else {
|
||||||
// Create lookup to get index in blendshape from vertex index in mesh
|
// Create lookup to get index in blendshape from vertex index in mesh
|
||||||
std::vector<int> reverseIndices;
|
std::vector<int> reverseIndices;
|
||||||
|
|
|
@ -20,7 +20,7 @@ void CalculateBlendshapeTangentsTask::run(const baker::BakeContextPointer& conte
|
||||||
const auto& blendshapesPerMesh = input.get1();
|
const auto& blendshapesPerMesh = input.get1();
|
||||||
const auto& meshes = input.get2();
|
const auto& meshes = input.get2();
|
||||||
auto& tangentsPerBlendshapePerMeshOut = output;
|
auto& tangentsPerBlendshapePerMeshOut = output;
|
||||||
|
|
||||||
tangentsPerBlendshapePerMeshOut.reserve(normalsPerBlendshapePerMesh.size());
|
tangentsPerBlendshapePerMeshOut.reserve(normalsPerBlendshapePerMesh.size());
|
||||||
for (size_t i = 0; i < blendshapesPerMesh.size(); i++) {
|
for (size_t i = 0; i < blendshapesPerMesh.size(); i++) {
|
||||||
const auto& normalsPerBlendshape = baker::safeGet(normalsPerBlendshapePerMesh, i);
|
const auto& normalsPerBlendshape = baker::safeGet(normalsPerBlendshapePerMesh, i);
|
||||||
|
@ -38,7 +38,7 @@ void CalculateBlendshapeTangentsTask::run(const baker::BakeContextPointer& conte
|
||||||
|
|
||||||
// Check if we already have tangents
|
// Check if we already have tangents
|
||||||
if (!tangentsIn.empty()) {
|
if (!tangentsIn.empty()) {
|
||||||
tangentsOut = tangentsIn.toStdVector();
|
tangentsOut = std::vector<glm::vec3>(tangentsIn.begin(), tangentsIn.end());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ void CalculateMeshNormalsTask::run(const baker::BakeContextPointer& context, con
|
||||||
auto& normalsOut = normalsPerMeshOut[normalsPerMeshOut.size()-1];
|
auto& normalsOut = normalsPerMeshOut[normalsPerMeshOut.size()-1];
|
||||||
// Only calculate normals if this mesh doesn't already have them
|
// Only calculate normals if this mesh doesn't already have them
|
||||||
if (!mesh.normals.empty()) {
|
if (!mesh.normals.empty()) {
|
||||||
normalsOut = mesh.normals.toStdVector();
|
normalsOut = std::vector<glm::vec3>(mesh.normals.begin(), mesh.normals.end());
|
||||||
} else {
|
} else {
|
||||||
normalsOut.resize(mesh.vertices.size());
|
normalsOut.resize(mesh.vertices.size());
|
||||||
baker::calculateNormals(mesh,
|
baker::calculateNormals(mesh,
|
||||||
|
|
|
@ -29,7 +29,7 @@ void CalculateMeshTangentsTask::run(const baker::BakeContextPointer& context, co
|
||||||
// Check if we already have tangents and therefore do not need to do any calculation
|
// Check if we already have tangents and therefore do not need to do any calculation
|
||||||
// Otherwise confirm if we have the normals and texcoords needed
|
// Otherwise confirm if we have the normals and texcoords needed
|
||||||
if (!tangentsIn.empty()) {
|
if (!tangentsIn.empty()) {
|
||||||
tangentsOut = tangentsIn.toStdVector();
|
tangentsOut = std::vector<glm::vec3>(tangentsIn.begin(), tangentsIn.end());
|
||||||
} else if (!normals.empty() && mesh.vertices.size() == mesh.texCoords.size()) {
|
} else if (!normals.empty() && mesh.vertices.size() == mesh.texCoords.size()) {
|
||||||
tangentsOut.resize(normals.size());
|
tangentsOut.resize(normals.size());
|
||||||
baker::calculateTangents(mesh,
|
baker::calculateTangents(mesh,
|
||||||
|
|
|
@ -811,7 +811,7 @@ void GLTFSerializer::getSkinInverseBindMatrices(std::vector<std::vector<float>>&
|
||||||
GLTFAccessor& indicesAccessor = _file.accessors[skin.inverseBindMatrices];
|
GLTFAccessor& indicesAccessor = _file.accessors[skin.inverseBindMatrices];
|
||||||
QVector<float> matrices;
|
QVector<float> matrices;
|
||||||
addArrayFromAccessor(indicesAccessor, matrices);
|
addArrayFromAccessor(indicesAccessor, matrices);
|
||||||
inverseBindMatrixValues.push_back(matrices.toStdVector());
|
inverseBindMatrixValues.push_back(std::vector<float>(matrices.begin(), matrices.end()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue