mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-16 22:30:42 +02:00
Add encode/decode speed config to BuildDracoMeshTask
This commit is contained in:
parent
efc9f993f5
commit
5b504c4759
3 changed files with 12 additions and 12 deletions
|
@ -227,9 +227,6 @@ void ModelBaker::handleModelNetworkReply() {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Remove after testing
|
||||
#include <model-baker/BuildDracoMeshTask.h>
|
||||
|
||||
void ModelBaker::bakeSourceCopy() {
|
||||
QFile modelFile(_originalModelFilePath);
|
||||
if (!modelFile.open(QIODevice::ReadOnly)) {
|
||||
|
@ -258,13 +255,6 @@ void ModelBaker::bakeSourceCopy() {
|
|||
config->getJobConfig("BuildDracoMesh")->setEnabled(true);
|
||||
// Do not permit potentially lossy modification of joint data meant for runtime
|
||||
((PrepareJointsConfig*)config->getJobConfig("PrepareJoints"))->passthrough = true;
|
||||
|
||||
// TODO: Remove after testing
|
||||
{
|
||||
auto* dracoConfig = ((BuildDracoMeshConfig*)config->getJobConfig("BuildDracoMesh"));
|
||||
dracoConfig->encodeSpeed = 10;
|
||||
dracoConfig->decodeSpeed = -1;
|
||||
}
|
||||
|
||||
// Begin hfm baking
|
||||
baker.run();
|
||||
|
|
|
@ -193,7 +193,8 @@ std::unique_ptr<draco::Mesh> createDracoMesh(const hfm::Mesh& mesh, const std::v
|
|||
}
|
||||
|
||||
void BuildDracoMeshTask::configure(const Config& config) {
|
||||
// Nothing to configure yet
|
||||
_encodeSpeed = config.encodeSpeed;
|
||||
_decodeSpeed = config.decodeSpeed;
|
||||
}
|
||||
|
||||
void BuildDracoMeshTask::run(const baker::BakeContextPointer& context, const Input& input, Output& output) {
|
||||
|
@ -222,7 +223,7 @@ void BuildDracoMeshTask::run(const baker::BakeContextPointer& context, const Inp
|
|||
encoder.SetAttributeQuantization(draco::GeometryAttribute::POSITION, 14);
|
||||
encoder.SetAttributeQuantization(draco::GeometryAttribute::TEX_COORD, 12);
|
||||
encoder.SetAttributeQuantization(draco::GeometryAttribute::NORMAL, 10);
|
||||
encoder.SetSpeedOptions(0, 5);
|
||||
encoder.SetSpeedOptions(_encodeSpeed, _decodeSpeed);
|
||||
|
||||
draco::EncoderBuffer buffer;
|
||||
encoder.EncodeMeshToBuffer(*dracoMesh, &buffer);
|
||||
|
|
|
@ -21,8 +21,13 @@
|
|||
// BuildDracoMeshTask is disabled by default
|
||||
class BuildDracoMeshConfig : public baker::JobConfig {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int encodeSpeed MEMBER encodeSpeed)
|
||||
Q_PROPERTY(int decodeSpeed MEMBER decodeSpeed)
|
||||
public:
|
||||
BuildDracoMeshConfig() : baker::JobConfig(false) {}
|
||||
|
||||
int encodeSpeed { 0 };
|
||||
int decodeSpeed { 5 };
|
||||
};
|
||||
|
||||
class BuildDracoMeshTask {
|
||||
|
@ -34,6 +39,10 @@ public:
|
|||
|
||||
void configure(const Config& config);
|
||||
void run(const baker::BakeContextPointer& context, const Input& input, Output& output);
|
||||
|
||||
protected:
|
||||
int _encodeSpeed { 0 };
|
||||
int _decodeSpeed { 5 };
|
||||
};
|
||||
|
||||
#endif // hifi_BuildDracoMeshTask_h
|
||||
|
|
Loading…
Reference in a new issue