mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 22:40:12 +02:00
Fix remaining issues with merge
This commit is contained in:
parent
ddc4f5349e
commit
a93825c2f9
7 changed files with 14 additions and 10 deletions
|
@ -249,7 +249,7 @@ void ModelBaker::bakeSourceCopy() {
|
||||||
serializerMapping["combineParts"] = true; // set true so that OBJSerializer reads material info from material library
|
serializerMapping["combineParts"] = true; // set true so that OBJSerializer reads material info from material library
|
||||||
hfm::Model::Pointer loadedModel = serializer->read(modelData, serializerMapping, _modelURL);
|
hfm::Model::Pointer loadedModel = serializer->read(modelData, serializerMapping, _modelURL);
|
||||||
|
|
||||||
baker::Baker baker(loadedModel, serializerMapping);
|
baker::Baker baker(loadedModel, serializerMapping, hifi::URL());
|
||||||
auto config = baker.getConfiguration();
|
auto config = baker.getConfiguration();
|
||||||
// Enable compressed draco mesh generation
|
// Enable compressed draco mesh generation
|
||||||
config->getJobConfig("BuildDracoMesh")->setEnabled(true);
|
config->getJobConfig("BuildDracoMesh")->setEnabled(true);
|
||||||
|
|
|
@ -119,12 +119,13 @@ namespace baker {
|
||||||
|
|
||||||
class BakerEngineBuilder {
|
class BakerEngineBuilder {
|
||||||
public:
|
public:
|
||||||
using Input = VaryingSet2<hfm::Model::Pointer, hifi::VariantHash>;
|
using Input = VaryingSet3<hfm::Model::Pointer, hifi::VariantHash, hifi::URL>;
|
||||||
using Output = VaryingSet4<hfm::Model::Pointer, MaterialMapping, std::vector<hifi::ByteArray>, std::vector<std::vector<hifi::ByteArray>>>;
|
using Output = VaryingSet4<hfm::Model::Pointer, MaterialMapping, std::vector<hifi::ByteArray>, std::vector<std::vector<hifi::ByteArray>>>;
|
||||||
using JobModel = Task::ModelIO<BakerEngineBuilder, Input, Output>;
|
using JobModel = Task::ModelIO<BakerEngineBuilder, Input, Output>;
|
||||||
void build(JobModel& model, const Varying& input, Varying& output) {
|
void build(JobModel& model, const Varying& input, Varying& output) {
|
||||||
const auto& hfmModelIn = input.getN<Input>(0);
|
const auto& hfmModelIn = input.getN<Input>(0);
|
||||||
const auto& mapping = input.getN<Input>(1);
|
const auto& mapping = input.getN<Input>(1);
|
||||||
|
const auto& materialMappingBaseURL = input.getN<Input>(2);
|
||||||
|
|
||||||
// Split up the inputs from hfm::Model
|
// Split up the inputs from hfm::Model
|
||||||
const auto modelPartsIn = model.addJob<GetModelPartsTask>("GetModelParts", hfmModelIn);
|
const auto modelPartsIn = model.addJob<GetModelPartsTask>("GetModelParts", hfmModelIn);
|
||||||
|
@ -157,7 +158,8 @@ namespace baker {
|
||||||
const auto jointIndices = jointInfoOut.getN<PrepareJointsTask::Output>(2);
|
const auto jointIndices = jointInfoOut.getN<PrepareJointsTask::Output>(2);
|
||||||
|
|
||||||
// Parse material mapping
|
// Parse material mapping
|
||||||
const auto materialMapping = model.addJob<ParseMaterialMappingTask>("ParseMaterialMapping", mapping);
|
const auto parseMaterialMappingInputs = ParseMaterialMappingTask::Input(mapping, materialMappingBaseURL).asVarying();
|
||||||
|
const auto materialMapping = model.addJob<ParseMaterialMappingTask>("ParseMaterialMapping", parseMaterialMappingInputs);
|
||||||
|
|
||||||
// Build Draco meshes
|
// Build Draco meshes
|
||||||
// NOTE: This task is disabled by default and must be enabled through configuration
|
// NOTE: This task is disabled by default and must be enabled through configuration
|
||||||
|
@ -182,10 +184,11 @@ namespace baker {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Baker::Baker(const hfm::Model::Pointer& hfmModel, const hifi::VariantHash& mapping) :
|
Baker::Baker(const hfm::Model::Pointer& hfmModel, const hifi::VariantHash& mapping, const hifi::URL& materialMappingBaseURL) :
|
||||||
_engine(std::make_shared<Engine>(BakerEngineBuilder::JobModel::create("Baker"), std::make_shared<BakeContext>())) {
|
_engine(std::make_shared<Engine>(BakerEngineBuilder::JobModel::create("Baker"), std::make_shared<BakeContext>())) {
|
||||||
_engine->feedInput<BakerEngineBuilder::Input>(0, hfmModel);
|
_engine->feedInput<BakerEngineBuilder::Input>(0, hfmModel);
|
||||||
_engine->feedInput<BakerEngineBuilder::Input>(1, mapping);
|
_engine->feedInput<BakerEngineBuilder::Input>(1, mapping);
|
||||||
|
_engine->feedInput<BakerEngineBuilder::Input>(2, materialMappingBaseURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<TaskConfig> Baker::getConfiguration() {
|
std::shared_ptr<TaskConfig> Baker::getConfiguration() {
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
namespace baker {
|
namespace baker {
|
||||||
class Baker {
|
class Baker {
|
||||||
public:
|
public:
|
||||||
Baker(const hfm::Model::Pointer& hfmModel, const hifi::VariantHash& mapping);
|
Baker(const hfm::Model::Pointer& hfmModel, const hifi::VariantHash& mapping, const hifi::URL& materialMappingBaseURL);
|
||||||
|
|
||||||
std::shared_ptr<TaskConfig> getConfiguration();
|
std::shared_ptr<TaskConfig> getConfiguration();
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ namespace baker {
|
||||||
using TangentsPerBlendshape = std::vector<std::vector<glm::vec3>>;
|
using TangentsPerBlendshape = std::vector<std::vector<glm::vec3>>;
|
||||||
|
|
||||||
using MeshIndicesToModelNames = QHash<int, QString>;
|
using MeshIndicesToModelNames = QHash<int, QString>;
|
||||||
using GeometryMappingPair = std::pair<QUrl, QVariantHash>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_BakerTypes_h
|
#endif // hifi_BakerTypes_h
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#include "ModelBakerLogging.h"
|
#include "ModelBakerLogging.h"
|
||||||
|
|
||||||
void ParseMaterialMappingTask::run(const baker::BakeContextPointer& context, const Input& input, Output& output) {
|
void ParseMaterialMappingTask::run(const baker::BakeContextPointer& context, const Input& input, Output& output) {
|
||||||
const auto& url = input.first;
|
const auto& mapping = input.get0();
|
||||||
const auto& mapping = input.second;
|
const auto& url = input.get1();
|
||||||
MaterialMapping materialMapping;
|
MaterialMapping materialMapping;
|
||||||
|
|
||||||
auto mappingIter = mapping.find("materialMap");
|
auto mappingIter = mapping.find("materialMap");
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
#include <hfm/HFM.h>
|
#include <hfm/HFM.h>
|
||||||
|
|
||||||
|
#include <shared/HifiTypes.h>
|
||||||
|
|
||||||
#include "Engine.h"
|
#include "Engine.h"
|
||||||
#include "BakerTypes.h"
|
#include "BakerTypes.h"
|
||||||
|
|
||||||
|
@ -20,7 +22,7 @@
|
||||||
|
|
||||||
class ParseMaterialMappingTask {
|
class ParseMaterialMappingTask {
|
||||||
public:
|
public:
|
||||||
using Input = baker::GeometryMappingPair;
|
using Input = baker::VaryingSet2<hifi::VariantHash, hifi::URL>;
|
||||||
using Output = MaterialMapping;
|
using Output = MaterialMapping;
|
||||||
using JobModel = baker::Job::ModelIO<ParseMaterialMappingTask, Input, Output>;
|
using JobModel = baker::Job::ModelIO<ParseMaterialMappingTask, Input, Output>;
|
||||||
|
|
||||||
|
|
|
@ -340,7 +340,7 @@ void GeometryDefinitionResource::downloadFinished(const QByteArray& data) {
|
||||||
|
|
||||||
void GeometryDefinitionResource::setGeometryDefinition(HFMModel::Pointer hfmModel, const GeometryMappingPair& mapping) {
|
void GeometryDefinitionResource::setGeometryDefinition(HFMModel::Pointer hfmModel, const GeometryMappingPair& mapping) {
|
||||||
// Do processing on the model
|
// Do processing on the model
|
||||||
baker::Baker modelBaker(hfmModel, mapping.second);
|
baker::Baker modelBaker(hfmModel, mapping.second, mapping.first);
|
||||||
modelBaker.run();
|
modelBaker.run();
|
||||||
|
|
||||||
// Assume ownership of the processed HFMModel
|
// Assume ownership of the processed HFMModel
|
||||||
|
|
Loading…
Reference in a new issue