diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index 07d1533101..cc2973f61d 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -759,11 +759,11 @@ void Agent::processAgentAvatarAudio() { int16_t numAvailableSamples = AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL; const int16_t* nextSoundOutput = NULL; - if (_avatarSound) { + if (_avatarSound && _avatarSound->isReady()) { if (isPlayingRecording && !_shouldMuteRecordingAudio) { _shouldMuteRecordingAudio = true; } - + auto audioData = _avatarSound->getAudioData(); nextSoundOutput = reinterpret_cast(audioData->rawData() + _numAvatarSoundSentBytes); diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index e6d83e7890..c013cfacd3 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -206,7 +206,7 @@ endif() link_hifi_libraries( shared workload task octree ktx gpu gl procedural graphics graphics-scripting render pointers - recording hfm fbx networking model-networking entities avatars trackers + recording hfm fbx networking model-networking model-baker entities avatars trackers audio audio-client animation script-engine physics render-utils entities-renderer avatars-renderer ui qml auto-updater midi controllers plugins image trackers diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d9c3f1478c..4b0724a556 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5261,7 +5261,12 @@ void Application::resumeAfterLoginDialogActionTaken() { nodeList->getDomainHandler().resetting(); if (!accountManager->isLoggedIn()) { - addressManager->goToEntry(); + if (arguments().contains("--url")) { + auto reply = SandboxUtils::getStatus(); + connect(reply, &QNetworkReply::finished, this, [this, reply] { handleSandboxStatus(reply); }); + } else { + addressManager->goToEntry(); + } } else { QVariant testProperty = property(hifi::properties::TEST); if (testProperty.isValid()) { @@ -5274,7 +5279,8 @@ void Application::resumeAfterLoginDialogActionTaken() { connect(reply, &QNetworkReply::finished, this, [this, reply] { handleSandboxStatus(reply); }); } } else { - addressManager->loadSettings(); + auto reply = SandboxUtils::getStatus(); + connect(reply, &QNetworkReply::finished, this, [this, reply] { handleSandboxStatus(reply); }); } } diff --git a/libraries/model-baker/CMakeLists.txt b/libraries/model-baker/CMakeLists.txt new file mode 100644 index 0000000000..58d9d1e60e --- /dev/null +++ b/libraries/model-baker/CMakeLists.txt @@ -0,0 +1,8 @@ +set(TARGET_NAME model-baker) +setup_hifi_library() + +link_hifi_libraries(shared task) + +include_hifi_library_headers(gpu) +include_hifi_library_headers(graphics) +include_hifi_library_headers(hfm) diff --git a/libraries/model-baker/src/model-baker/Baker.cpp b/libraries/model-baker/src/model-baker/Baker.cpp new file mode 100644 index 0000000000..14ec62413e --- /dev/null +++ b/libraries/model-baker/src/model-baker/Baker.cpp @@ -0,0 +1,38 @@ +// +// Baker.cpp +// model-baker/src/model-baker +// +// Created by Sabrina Shanman on 2018/12/04. +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "Baker.h" + +namespace baker { + + class BakerEngineBuilder { + public: + using Unused = int; + + using Input = hfm::Model::Pointer; + using Output = hfm::Model::Pointer; + using JobModel = Task::ModelIO; + void build(JobModel& model, const Varying& in, Varying& out) { + out = in; + } + }; + + Baker::Baker(const hfm::Model::Pointer& hfmModel) : + _engine(std::make_shared(BakerEngineBuilder::JobModel::create("Baker"), std::make_shared())) { + _engine->feedInput(hfmModel); + } + + void Baker::run() { + _engine->run(); + hfmModel = _engine->getOutput().get(); + } + +}; diff --git a/libraries/model-baker/src/model-baker/Baker.h b/libraries/model-baker/src/model-baker/Baker.h new file mode 100644 index 0000000000..ba233243b3 --- /dev/null +++ b/libraries/model-baker/src/model-baker/Baker.h @@ -0,0 +1,36 @@ +// +// Baker.h +// model-baker/src/model-baker +// +// Created by Sabrina Shanman on 2018/12/04. +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_baker_Baker_h +#define hifi_baker_Baker_h + +#include + +#include "Engine.h" + +namespace baker { + + class Baker { + public: + Baker(const hfm::Model::Pointer& hfmModel); + + void run(); + + // Outputs, available after run() is called + hfm::Model::Pointer hfmModel; + + protected: + EnginePointer _engine; + }; + +}; + +#endif //hifi_baker_Baker_h diff --git a/libraries/model-baker/src/model-baker/Engine.h b/libraries/model-baker/src/model-baker/Engine.h new file mode 100644 index 0000000000..4f450e2b2b --- /dev/null +++ b/libraries/model-baker/src/model-baker/Engine.h @@ -0,0 +1,32 @@ +// +// Engine.h +// model-baker/src/model-baker +// +// Created by Sabrina Shanman on 2018/12/04. +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_baker_Engine_h +#define hifi_baker_Engine_h + +#include + +namespace baker { + + class BakeContext : public task::JobContext { + public: + // No context settings yet for model prep + }; + using BakeContextPointer = std::shared_ptr; + + Task_DeclareCategoryTimeProfilerClass(BakerTimeProfiler, trace_baker); + Task_DeclareTypeAliases(BakeContext, BakerTimeProfiler) + + using EnginePointer = std::shared_ptr; + +}; + +#endif // hifi_baker_Engine_h diff --git a/libraries/model-networking/CMakeLists.txt b/libraries/model-networking/CMakeLists.txt index 0fca6fa3d1..6a7182cc33 100644 --- a/libraries/model-networking/CMakeLists.txt +++ b/libraries/model-networking/CMakeLists.txt @@ -1,5 +1,6 @@ set(TARGET_NAME model-networking) setup_hifi_library() -link_hifi_libraries(shared shaders networking graphics fbx ktx image gl) +link_hifi_libraries(shared shaders networking graphics fbx ktx image gl model-baker) include_hifi_library_headers(gpu) include_hifi_library_headers(hfm) +include_hifi_library_headers(task) diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index dfee4750f5..05c4aa0e03 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -27,6 +27,7 @@ #include #include #include +#include Q_LOGGING_CATEGORY(trace_resource_parse_geometry, "trace.resource.parse.geometry") @@ -277,8 +278,12 @@ void GeometryDefinitionResource::downloadFinished(const QByteArray& data) { } void GeometryDefinitionResource::setGeometryDefinition(HFMModel::Pointer hfmModel) { - // Assume ownership of the HFMModel pointer - _hfmModel = hfmModel; + // Do processing on the model + baker::Baker modelBaker(hfmModel); + modelBaker.run(); + + // Assume ownership of the processed HFMModel + _hfmModel = modelBaker.hfmModel; // Copy materials QHash materialIDAtlas; diff --git a/libraries/shared/src/Profile.cpp b/libraries/shared/src/Profile.cpp index f3cbbf9262..778b39aca5 100644 --- a/libraries/shared/src/Profile.cpp +++ b/libraries/shared/src/Profile.cpp @@ -29,6 +29,7 @@ Q_LOGGING_CATEGORY(trace_simulation_physics, "trace.simulation.physics") Q_LOGGING_CATEGORY(trace_simulation_physics_detail, "trace.simulation.physics.detail") Q_LOGGING_CATEGORY(trace_startup, "trace.startup") Q_LOGGING_CATEGORY(trace_workload, "trace.workload") +Q_LOGGING_CATEGORY(trace_baker, "trace.baker") #if defined(NSIGHT_FOUND) #include "nvToolsExt.h" diff --git a/libraries/shared/src/Profile.h b/libraries/shared/src/Profile.h index e78ce210c9..01d86f8f2e 100644 --- a/libraries/shared/src/Profile.h +++ b/libraries/shared/src/Profile.h @@ -34,6 +34,7 @@ Q_DECLARE_LOGGING_CATEGORY(trace_simulation_physics) Q_DECLARE_LOGGING_CATEGORY(trace_simulation_physics_detail) Q_DECLARE_LOGGING_CATEGORY(trace_startup) Q_DECLARE_LOGGING_CATEGORY(trace_workload) +Q_DECLARE_LOGGING_CATEGORY(trace_baker) class Duration { public: diff --git a/plugins/openvr/CMakeLists.txt b/plugins/openvr/CMakeLists.txt index 8953ab7d27..8e43397c19 100644 --- a/plugins/openvr/CMakeLists.txt +++ b/plugins/openvr/CMakeLists.txt @@ -11,7 +11,7 @@ if (WIN32 AND (NOT USE_GLES)) setup_hifi_plugin(Gui Qml Multimedia) link_hifi_libraries(shared task gl qml networking controllers ui plugins display-plugins ui-plugins input-plugins script-engine - audio-client render-utils graphics shaders gpu render model-networking hfm fbx ktx image procedural ${PLATFORM_GL_BACKEND}) + audio-client render-utils graphics shaders gpu render model-networking model-baker hfm fbx ktx image procedural ${PLATFORM_GL_BACKEND}) include_hifi_library_headers(octree) target_openvr() diff --git a/tools/dissectors/1-hfudt.lua b/tools/dissectors/1-hfudt.lua index 3993b2d7a0..fe8a72682d 100644 --- a/tools/dissectors/1-hfudt.lua +++ b/tools/dissectors/1-hfudt.lua @@ -77,7 +77,7 @@ local packet_types = { [22] = "ICEServerPeerInformation", [23] = "ICEServerQuery", [24] = "OctreeStats", - [25] = "UNUSED_PACKET_TYPE_1", + [25] = "SetAvatarTraits", [26] = "AvatarIdentityRequest", [27] = "AssignmentClientStatus", [28] = "NoisyMute", @@ -229,7 +229,7 @@ function p_hfudt.dissector(buf, pinfo, tree) -- read the obfuscation level local obfuscation_bits = bit32.band(0x03, bit32.rshift(first_word, 27)) subtree:add(f_obfuscation_level, obfuscation_bits) - + -- read the sequence number subtree:add(f_sequence_number, bit32.band(first_word, SEQUENCE_NUMBER_MASK)) @@ -257,6 +257,11 @@ function p_hfudt.dissector(buf, pinfo, tree) subtree:add(f_message_part_number, buf(8, 4):le_uint()) end + if obfuscation_bits ~= 0 then + local newbuf = deobfuscate(message_bit, buf, obfuscation_bits) + buf = newbuf:tvb("Unobfuscated") + end + -- read the type local packet_type = buf(payload_offset, 1):le_uint() local ptype = subtree:add_le(f_type, buf(payload_offset, 1)) @@ -316,3 +321,30 @@ function p_hfudt.init() udp_dissector_table:add(port, p_hfudt) end end + +function deobfuscate(message_bit, buf, level) + local out = ByteArray.new() + out:set_size(buf:len()) + if (level == 1) then + key = ByteArray.new("6362726973736574") + elseif level == 2 then + key = ByteArray.new("7362697261726461") + elseif level == 3 then + key = ByteArray.new("72687566666d616e") + else + return + end + + local start = 4 + if message_bit == 1 then + local start = 12 + end + + local p = 0 + for i = start, buf:len() - 1 do + out:set_index(i, bit.bxor(buf(i, 1):le_uint(), key:get_index(7 - (p % 8))) ) + p = p + 1 + end + + return out +end