mirror of
https://github.com/overte-org/overte.git
synced 2025-06-21 08:00:04 +02:00
merge with master
This commit is contained in:
commit
6d3e23a7fe
35 changed files with 322 additions and 147 deletions
|
@ -13,6 +13,7 @@ import "../../simplifiedConstants" as SimplifiedConstants
|
||||||
import "../../simplifiedControls" as SimplifiedControls
|
import "../../simplifiedControls" as SimplifiedControls
|
||||||
import stylesUit 1.0 as HifiStylesUit
|
import stylesUit 1.0 as HifiStylesUit
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
|
import PerformanceEnums 1.0
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
property string avatarNametagMode: Settings.getValue("simplifiedNametag/avatarNametagMode", "on")
|
property string avatarNametagMode: Settings.getValue("simplifiedNametag/avatarNametagMode", "on")
|
||||||
|
@ -113,16 +114,28 @@ Flickable {
|
||||||
SimplifiedControls.RadioButton {
|
SimplifiedControls.RadioButton {
|
||||||
id: performanceLow
|
id: performanceLow
|
||||||
text: "Eco"
|
text: "Eco"
|
||||||
|
checked: Performance.getRefreshRateProfile() === RefreshRate.ECO
|
||||||
|
onClicked: {
|
||||||
|
Performance.setRefreshRateProfile(RefreshRate.ECO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SimplifiedControls.RadioButton {
|
SimplifiedControls.RadioButton {
|
||||||
id: performanceMedium
|
id: performanceMedium
|
||||||
text: "Interactive"
|
text: "Interactive"
|
||||||
|
checked: Performance.getRefreshRateProfile() === RefreshRate.INTERACTIVE
|
||||||
|
onClicked: {
|
||||||
|
Performance.setRefreshRateProfile(RefreshRate.INTERACTIVE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SimplifiedControls.RadioButton {
|
SimplifiedControls.RadioButton {
|
||||||
id: performanceHigh
|
id: performanceHigh
|
||||||
text: "Realtime"
|
text: "Realtime"
|
||||||
|
checked: Performance.getRefreshRateProfile() === RefreshRate.REALTIME
|
||||||
|
onClicked: {
|
||||||
|
Performance.setRefreshRateProfile(RefreshRate.REALTIME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,8 +277,34 @@ Rectangle {
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Tablet.playSound(TabletEnums.ButtonClick);
|
Tablet.playSound(TabletEnums.ButtonClick);
|
||||||
// TODO: actually do this right and change the display plugin
|
var displayPluginCount = Window.getDisplayPluginCount();
|
||||||
HMD.active = !HMD.active;
|
if (HMD.active) {
|
||||||
|
// This next line seems backwards and shouldn't be necessary - the NOTIFY handler should
|
||||||
|
// result in `displayModeImage.source` changing automatically - but that's not working.
|
||||||
|
// This is working. So, I'm keeping it.
|
||||||
|
displayModeImage.source = "./images/vrMode.svg";
|
||||||
|
|
||||||
|
// Switch to desktop mode - selects first VR display plugin
|
||||||
|
for (var i = 0; i < displayPluginCount; i++) {
|
||||||
|
if (!Window.isDisplayPluginHmd(i)) {
|
||||||
|
Window.setActiveDisplayPlugin(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// This next line seems backwards and shouldn't be necessary - the NOTIFY handler should
|
||||||
|
// result in `displayModeImage.source` changing automatically - but that's not working.
|
||||||
|
// This is working. So, I'm keeping it.
|
||||||
|
displayModeImage.source = "./images/desktopMode.svg";
|
||||||
|
|
||||||
|
// Switch to VR mode - selects first HMD display plugin
|
||||||
|
for (var i = 0; i < displayPluginCount; i++) {
|
||||||
|
if (Window.isDisplayPluginHmd(i)) {
|
||||||
|
Window.setActiveDisplayPlugin(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,8 +194,7 @@
|
||||||
#include "scripting/TTSScriptingInterface.h"
|
#include "scripting/TTSScriptingInterface.h"
|
||||||
#include "scripting/KeyboardScriptingInterface.h"
|
#include "scripting/KeyboardScriptingInterface.h"
|
||||||
#include "scripting/PerformanceScriptingInterface.h"
|
#include "scripting/PerformanceScriptingInterface.h"
|
||||||
|
#include "scripting/RenderScriptingInterface.h"
|
||||||
|
|
||||||
|
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||||
#include "SpeechRecognizer.h"
|
#include "SpeechRecognizer.h"
|
||||||
|
@ -3331,7 +3330,7 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) {
|
||||||
surfaceContext->setContextProperty("LODManager", DependencyManager::get<LODManager>().data());
|
surfaceContext->setContextProperty("LODManager", DependencyManager::get<LODManager>().data());
|
||||||
surfaceContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
|
surfaceContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
|
||||||
surfaceContext->setContextProperty("Scene", DependencyManager::get<SceneScriptingInterface>().data());
|
surfaceContext->setContextProperty("Scene", DependencyManager::get<SceneScriptingInterface>().data());
|
||||||
surfaceContext->setContextProperty("Render", _graphicsEngine.getRenderEngine()->getConfiguration().get());
|
surfaceContext->setContextProperty("Render", RenderScriptingInterface::getInstance());
|
||||||
surfaceContext->setContextProperty("Workload", _gameWorkload._engine->getConfiguration().get());
|
surfaceContext->setContextProperty("Workload", _gameWorkload._engine->getConfiguration().get());
|
||||||
surfaceContext->setContextProperty("Reticle", getApplicationCompositor().getReticleInterface());
|
surfaceContext->setContextProperty("Reticle", getApplicationCompositor().getReticleInterface());
|
||||||
surfaceContext->setContextProperty("Snapshot", DependencyManager::get<Snapshot>().data());
|
surfaceContext->setContextProperty("Snapshot", DependencyManager::get<Snapshot>().data());
|
||||||
|
@ -3446,7 +3445,7 @@ void Application::setupQmlSurface(QQmlContext* surfaceContext, bool setAdditiona
|
||||||
surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data());
|
surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data());
|
||||||
surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCacheScriptingInterface>().data());
|
surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCacheScriptingInterface>().data());
|
||||||
surfaceContext->setContextProperty("AvatarBookmarks", DependencyManager::get<AvatarBookmarks>().data());
|
surfaceContext->setContextProperty("AvatarBookmarks", DependencyManager::get<AvatarBookmarks>().data());
|
||||||
surfaceContext->setContextProperty("Render", AbstractViewStateInterface::instance()->getRenderEngine()->getConfiguration().get());
|
surfaceContext->setContextProperty("Render", RenderScriptingInterface::getInstance());
|
||||||
surfaceContext->setContextProperty("Workload", qApp->getGameWorkload()._engine->getConfiguration().get());
|
surfaceContext->setContextProperty("Workload", qApp->getGameWorkload()._engine->getConfiguration().get());
|
||||||
surfaceContext->setContextProperty("Controller", DependencyManager::get<controller::ScriptingInterface>().data());
|
surfaceContext->setContextProperty("Controller", DependencyManager::get<controller::ScriptingInterface>().data());
|
||||||
surfaceContext->setContextProperty("Pointers", DependencyManager::get<PointerScriptingInterface>().data());
|
surfaceContext->setContextProperty("Pointers", DependencyManager::get<PointerScriptingInterface>().data());
|
||||||
|
@ -7396,7 +7395,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
|
||||||
scriptEngine->registerFunction("HMD", "getHUDLookAtPosition3D", HMDScriptingInterface::getHUDLookAtPosition3D, 0);
|
scriptEngine->registerFunction("HMD", "getHUDLookAtPosition3D", HMDScriptingInterface::getHUDLookAtPosition3D, 0);
|
||||||
|
|
||||||
scriptEngine->registerGlobalObject("Scene", DependencyManager::get<SceneScriptingInterface>().data());
|
scriptEngine->registerGlobalObject("Scene", DependencyManager::get<SceneScriptingInterface>().data());
|
||||||
scriptEngine->registerGlobalObject("Render", _graphicsEngine.getRenderEngine()->getConfiguration().get());
|
scriptEngine->registerGlobalObject("Render", RenderScriptingInterface::getInstance());
|
||||||
scriptEngine->registerGlobalObject("Workload", _gameWorkload._engine->getConfiguration().get());
|
scriptEngine->registerGlobalObject("Workload", _gameWorkload._engine->getConfiguration().get());
|
||||||
|
|
||||||
GraphicsScriptingInterface::registerMetaTypes(scriptEngine.data());
|
GraphicsScriptingInterface::registerMetaTypes(scriptEngine.data());
|
||||||
|
|
|
@ -290,7 +290,6 @@ public:
|
||||||
render::EnginePointer getRenderEngine() override { return _graphicsEngine.getRenderEngine(); }
|
render::EnginePointer getRenderEngine() override { return _graphicsEngine.getRenderEngine(); }
|
||||||
gpu::ContextPointer getGPUContext() const { return _graphicsEngine.getGPUContext(); }
|
gpu::ContextPointer getGPUContext() const { return _graphicsEngine.getGPUContext(); }
|
||||||
|
|
||||||
|
|
||||||
const GameWorkload& getGameWorkload() const { return _gameWorkload; }
|
const GameWorkload& getGameWorkload() const { return _gameWorkload; }
|
||||||
|
|
||||||
virtual void pushPostUpdateLambda(void* key, const std::function<void()>& func) override;
|
virtual void pushPostUpdateLambda(void* key, const std::function<void()>& func) override;
|
||||||
|
|
|
@ -524,7 +524,7 @@ Menu::Menu() {
|
||||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::ComputeBlendshapes, 0, true,
|
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::ComputeBlendshapes, 0, true,
|
||||||
DependencyManager::get<ModelBlender>().data(), SLOT(setComputeBlendshapes(bool)));
|
DependencyManager::get<ModelBlender>().data(), SLOT(setComputeBlendshapes(bool)));
|
||||||
|
|
||||||
action = addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::MeshShaders, 0, true);
|
action = addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::MeshShaders, 0, false);
|
||||||
connect(action, &QAction::triggered, [action] {
|
connect(action, &QAction::triggered, [action] {
|
||||||
MeshPartPayload::enableMeshShaders = action->isChecked();
|
MeshPartPayload::enableMeshShaders = action->isChecked();
|
||||||
});
|
});
|
||||||
|
|
|
@ -228,7 +228,7 @@ namespace MenuOption {
|
||||||
const QString NotificationSoundsTablet = "play_notification_sounds_tablet";
|
const QString NotificationSoundsTablet = "play_notification_sounds_tablet";
|
||||||
const QString ForceCoarsePicking = "Force Coarse Picking";
|
const QString ForceCoarsePicking = "Force Coarse Picking";
|
||||||
const QString ComputeBlendshapes = "Compute Blendshapes";
|
const QString ComputeBlendshapes = "Compute Blendshapes";
|
||||||
const QString MeshShaders = "Enable Shaders on Meshes";
|
const QString MeshShaders = "Enable Procedural Materials on Meshes";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // hifi_Menu_h
|
#endif // hifi_Menu_h
|
||||||
|
|
44
interface/src/scripting/RenderScriptingInterface.cpp
Normal file
44
interface/src/scripting/RenderScriptingInterface.cpp
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
//
|
||||||
|
// Created by Sam Gondelman on 5/16/19
|
||||||
|
// Copyright 2013-2019 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 "RenderScriptingInterface.h"
|
||||||
|
|
||||||
|
const QString DEFERRED = "deferred";
|
||||||
|
const QString FORWARD = "forward";
|
||||||
|
|
||||||
|
RenderScriptingInterface* RenderScriptingInterface::getInstance() {
|
||||||
|
static RenderScriptingInterface sharedInstance;
|
||||||
|
return &sharedInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderScriptingInterface::RenderScriptingInterface() {
|
||||||
|
setRenderMethod((render::Args::RenderMethod)_renderMethodSetting.get() == render::Args::RenderMethod::DEFERRED ? DEFERRED : FORWARD);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString RenderScriptingInterface::getRenderMethod() {
|
||||||
|
return (render::Args::RenderMethod)_renderMethodSetting.get() == render::Args::RenderMethod::DEFERRED ? DEFERRED : FORWARD;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderScriptingInterface::setRenderMethod(const QString& renderMethod) {
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "setRenderMethod", Q_ARG(const QString&, renderMethod));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto config = dynamic_cast<task::SwitchConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.DeferredForwardSwitch"));
|
||||||
|
if (config) {
|
||||||
|
if (renderMethod == DEFERRED) {
|
||||||
|
_renderMethodSetting.set(render::Args::RenderMethod::DEFERRED);
|
||||||
|
config->setBranch(render::Args::RenderMethod::DEFERRED);
|
||||||
|
emit config->dirtyEnabled();
|
||||||
|
} else if (renderMethod == FORWARD) {
|
||||||
|
_renderMethodSetting.set(render::Args::RenderMethod::FORWARD);
|
||||||
|
config->setBranch(render::Args::RenderMethod::FORWARD);
|
||||||
|
emit config->dirtyEnabled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
65
interface/src/scripting/RenderScriptingInterface.h
Normal file
65
interface/src/scripting/RenderScriptingInterface.h
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
//
|
||||||
|
// Created by Sam Gondelman on 5/16/19
|
||||||
|
// Copyright 2013-2019 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_RenderScriptingInterface_h
|
||||||
|
#define hifi_RenderScriptingInterface_h
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
|
#include "RenderForward.h"
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* The <code>Render</code> API allows you to configure the graphics engine
|
||||||
|
*
|
||||||
|
* @namespace Render
|
||||||
|
*
|
||||||
|
* @hifi-interface
|
||||||
|
* @hifi-client-entity
|
||||||
|
* @hifi-avatar
|
||||||
|
*/
|
||||||
|
class RenderScriptingInterface : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(QString renderMethod READ getRenderMethod WRITE setRenderMethod)
|
||||||
|
|
||||||
|
public:
|
||||||
|
RenderScriptingInterface();
|
||||||
|
|
||||||
|
static RenderScriptingInterface* getInstance();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
/**jsdoc
|
||||||
|
* Get a config for a job by name
|
||||||
|
* @function Render.getConfig
|
||||||
|
* @param {string} name - Can be:
|
||||||
|
* - <job_name>. Search for the first job named job_name traversing the the sub graph of task and jobs (from this task as root)
|
||||||
|
* - <parent_name>.[<sub_parent_names>.]<job_name>. Allows you to first look for the parent_name job (from this task as root) and then search from there for the
|
||||||
|
* optional sub_parent_names and finally from there looking for the job_name (assuming every job in the path is found)
|
||||||
|
* @returns {object} The sub job config.
|
||||||
|
*/
|
||||||
|
QObject* getConfig(const QString& name) { return qApp->getRenderEngine()->getConfiguration()->getConfig(name); }
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Gets the current render method
|
||||||
|
* @function Render.getRenderMethod
|
||||||
|
* @returns {string} <code>"deferred"</code> or <code>"forward"</code>
|
||||||
|
*/
|
||||||
|
QString getRenderMethod();
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Sets the current render method
|
||||||
|
* @function Render.setRenderMethod
|
||||||
|
* @param {string} renderMethod - <code>"deferred"</code> or <code>"forward"</code>
|
||||||
|
*/
|
||||||
|
void setRenderMethod(const QString& renderMethod);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Setting::Handle<int> _renderMethodSetting { "renderMethod", RENDER_FORWARD ? render::Args::RenderMethod::FORWARD : render::Args::RenderMethod::DEFERRED };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_RenderScriptingInterface_h
|
|
@ -109,7 +109,7 @@ void ShapeEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
||||||
void ShapeEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
void ShapeEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
auto mat = _materials.find("0");
|
auto mat = _materials.find("0");
|
||||||
if (mat != _materials.end() && mat->second.top().material && mat->second.top().material->isEnabled()) {
|
if (mat != _materials.end() && mat->second.top().material && mat->second.top().material->isProcedural() && mat->second.top().material->isEnabled()) {
|
||||||
auto procedural = std::static_pointer_cast<graphics::ProceduralMaterial>(mat->second.top().material);
|
auto procedural = std::static_pointer_cast<graphics::ProceduralMaterial>(mat->second.top().material);
|
||||||
if (procedural->isFading()) {
|
if (procedural->isFading()) {
|
||||||
procedural->setIsFading(Interpolate::calculateFadeRatio(procedural->getFadeStartTime()) < 1.0f);
|
procedural->setIsFading(Interpolate::calculateFadeRatio(procedural->getFadeStartTime()) < 1.0f);
|
||||||
|
|
|
@ -6,5 +6,6 @@ include_hifi_library_headers(fbx)
|
||||||
include_hifi_library_headers(gpu)
|
include_hifi_library_headers(gpu)
|
||||||
include_hifi_library_headers(image)
|
include_hifi_library_headers(image)
|
||||||
include_hifi_library_headers(ktx)
|
include_hifi_library_headers(ktx)
|
||||||
|
include_hifi_library_headers(material-networking)
|
||||||
include_hifi_library_headers(procedural)
|
include_hifi_library_headers(procedural)
|
||||||
link_hifi_libraries(shared shaders networking octree avatars graphics material-networking model-networking)
|
link_hifi_libraries(shared shaders networking octree avatars graphics model-networking)
|
||||||
|
|
|
@ -291,6 +291,7 @@ public:
|
||||||
class Model {
|
class Model {
|
||||||
public:
|
public:
|
||||||
using Pointer = std::shared_ptr<Model>;
|
using Pointer = std::shared_ptr<Model>;
|
||||||
|
using ConstPointer = std::shared_ptr<const Model>;
|
||||||
|
|
||||||
QString originalURL;
|
QString originalURL;
|
||||||
QString author;
|
QString author;
|
||||||
|
|
|
@ -46,6 +46,7 @@ public:
|
||||||
bool isHFMModelLoaded() const { return (bool)_hfmModel; }
|
bool isHFMModelLoaded() const { return (bool)_hfmModel; }
|
||||||
|
|
||||||
const HFMModel& getHFMModel() const { return *_hfmModel; }
|
const HFMModel& getHFMModel() const { return *_hfmModel; }
|
||||||
|
const HFMModel::ConstPointer& getConstHFMModelPointer() const { return _hfmModel; }
|
||||||
const MaterialMapping& getMaterialMapping() const { return _materialMapping; }
|
const MaterialMapping& getMaterialMapping() const { return _materialMapping; }
|
||||||
const GeometryMeshes& getMeshes() const { return *_meshes; }
|
const GeometryMeshes& getMeshes() const { return *_meshes; }
|
||||||
const std::shared_ptr<NetworkMaterial> getShapeMaterial(int shapeID) const;
|
const std::shared_ptr<NetworkMaterial> getShapeMaterial(int shapeID) const;
|
||||||
|
@ -59,7 +60,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Shared across all geometries, constant throughout lifetime
|
// Shared across all geometries, constant throughout lifetime
|
||||||
std::shared_ptr<const HFMModel> _hfmModel;
|
HFMModel::ConstPointer _hfmModel;
|
||||||
MaterialMapping _materialMapping;
|
MaterialMapping _materialMapping;
|
||||||
std::shared_ptr<const GeometryMeshes> _meshes;
|
std::shared_ptr<const GeometryMeshes> _meshes;
|
||||||
std::shared_ptr<const GeometryMeshParts> _meshParts;
|
std::shared_ptr<const GeometryMeshParts> _meshParts;
|
||||||
|
|
|
@ -8,9 +8,8 @@
|
||||||
|
|
||||||
#include "AndroidPlatform.h"
|
#include "AndroidPlatform.h"
|
||||||
#include "platformJsonKeys.h"
|
#include "platformJsonKeys.h"
|
||||||
|
|
||||||
#include <GPUIdent.h>
|
#include <GPUIdent.h>
|
||||||
#include <string>
|
|
||||||
using namespace platform;
|
using namespace platform;
|
||||||
|
|
||||||
void AndroidInstance::enumerateCpu() {
|
void AndroidInstance::enumerateCpu() {
|
||||||
|
@ -35,6 +34,11 @@ void AndroidInstance::enumerateGpu() {
|
||||||
|
|
||||||
void AndroidInstance::enumerateMemory() {
|
void AndroidInstance::enumerateMemory() {
|
||||||
json ram = {};
|
json ram = {};
|
||||||
|
ram["totalMemory"]="";
|
||||||
_memory.push_back(ram);
|
_memory.push_back(ram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AndroidInstance::enumerateComputer(){
|
||||||
|
//no implememntation at this time
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace platform {
|
||||||
void enumerateCpu() override;
|
void enumerateCpu() override;
|
||||||
void enumerateMemory() override;
|
void enumerateMemory() override;
|
||||||
void enumerateGpu() override;
|
void enumerateGpu() override;
|
||||||
|
void enumerateComputer () override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace platform
|
} // namespace platform
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "LinuxPlatform.h"
|
#include "LinuxPlatform.h"
|
||||||
#include "platformJsonKeys.h"
|
#include "platformJsonKeys.h"
|
||||||
#include <GPUIdent.h>
|
#include <GPUIdent.h>
|
||||||
#include <string>
|
|
||||||
|
|
||||||
using namespace platform;
|
using namespace platform;
|
||||||
void LinuxInstance::enumerateCpu() {
|
void LinuxInstance::enumerateCpu() {
|
||||||
|
@ -36,7 +35,12 @@ void LinuxInstance::enumerateGpu() {
|
||||||
|
|
||||||
void LinuxInstance::enumerateMemory() {
|
void LinuxInstance::enumerateMemory() {
|
||||||
json ram = {};
|
json ram = {};
|
||||||
|
ram["totalMemory"]="";
|
||||||
|
|
||||||
_memory.push_back(ram);
|
_memory.push_back(ram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LinuxInstance::enumerateComputer(){
|
||||||
|
//no implememntation at this time
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace platform {
|
||||||
void enumerateCpu() override;
|
void enumerateCpu() override;
|
||||||
void enumerateMemory() override;
|
void enumerateMemory() override;
|
||||||
void enumerateGpu() override;
|
void enumerateGpu() override;
|
||||||
|
void enumerateComputer () override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace platform
|
} // namespace platform
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "MACOSPlatform.h"
|
#include "MACOSPlatform.h"
|
||||||
#include "platformJsonKeys.h"
|
#include "platformJsonKeys.h"
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <GPUIdent.h>
|
#include <GPUIdent.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -15,6 +16,7 @@
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <cpuid.h>
|
#include <cpuid.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace platform;
|
using namespace platform;
|
||||||
|
@ -33,6 +35,7 @@ static void getCpuId( uint32_t* p, uint32_t ax )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MACOSInstance::enumerateCpu() {
|
void MACOSInstance::enumerateCpu() {
|
||||||
json cpu = {};
|
json cpu = {};
|
||||||
uint32_t cpuInfo[4]={0,0,0,0};
|
uint32_t cpuInfo[4]={0,0,0,0};
|
||||||
|
@ -72,6 +75,7 @@ void MACOSInstance::enumerateGpu() {
|
||||||
|
|
||||||
_gpu.push_back(gpu);
|
_gpu.push_back(gpu);
|
||||||
_display = ident->getOutput();
|
_display = ident->getOutput();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MACOSInstance::enumerateMemory() {
|
void MACOSInstance::enumerateMemory() {
|
||||||
|
@ -84,3 +88,20 @@ void MACOSInstance::enumerateMemory() {
|
||||||
#endif
|
#endif
|
||||||
_memory.push_back(ram);
|
_memory.push_back(ram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MACOSInstance::enumerateComputer(){
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
|
||||||
|
//get system name
|
||||||
|
size_t len=0;
|
||||||
|
sysctlbyname("hw.model",NULL, &len, NULL, 0);
|
||||||
|
char* model = (char *) malloc(sizeof(char)*len+1);
|
||||||
|
sysctlbyname("hw.model", model, &len, NULL,0);
|
||||||
|
|
||||||
|
_computer["computerModel"]=std::string(model);
|
||||||
|
|
||||||
|
free(model);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,9 @@ namespace platform {
|
||||||
void enumerateCpu() override;
|
void enumerateCpu() override;
|
||||||
void enumerateMemory() override;
|
void enumerateMemory() override;
|
||||||
void enumerateGpu() override;
|
void enumerateGpu() override;
|
||||||
|
void enumerateComputer () override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace platform
|
} // namespace platform
|
||||||
|
|
||||||
#endif //hifi_winplatform_h
|
#endif //hifi_macosplatform_h
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "WINPlatform.h"
|
#include "WINPlatform.h"
|
||||||
#include "platformJsonKeys.h"
|
#include "platformJsonKeys.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
@ -76,7 +77,12 @@ void WINInstance::enumerateMemory() {
|
||||||
statex.dwLength = sizeof(statex);
|
statex.dwLength = sizeof(statex);
|
||||||
GlobalMemoryStatusEx(&statex);
|
GlobalMemoryStatusEx(&statex);
|
||||||
int totalRam = statex.ullTotalPhys / 1024 / 1024;
|
int totalRam = statex.ullTotalPhys / 1024 / 1024;
|
||||||
ram[jsonKeys::totalMemory] = totalRam;
|
ram["totalMemory"] = totalRam;
|
||||||
#endif
|
#endif
|
||||||
_memory.push_back(ram);
|
_memory.push_back(ram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WINInstance::enumerateComputer(){
|
||||||
|
//no implememntation at this time
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace platform {
|
||||||
void enumerateCpu() override;
|
void enumerateCpu() override;
|
||||||
void enumerateMemory() override;
|
void enumerateMemory() override;
|
||||||
void enumerateGpu() override;
|
void enumerateGpu() override;
|
||||||
|
void enumerateComputer () override;
|
||||||
};
|
};
|
||||||
} // namespace platform
|
} // namespace platform
|
||||||
|
|
||||||
|
|
|
@ -77,3 +77,7 @@ int platform::getNumMemory() {
|
||||||
json platform::getMemory(int index) {
|
json platform::getMemory(int index) {
|
||||||
return _instance->getMemory(index);
|
return _instance->getMemory(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json platform::getComputer(){
|
||||||
|
return _instance->getComputer();
|
||||||
|
}
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
#ifndef hifi_Platform_h
|
#ifndef hifi_Platform_h
|
||||||
#define hifi_Platform_h
|
#define hifi_Platform_h
|
||||||
|
|
||||||
#include "platformInstance.h"
|
|
||||||
#include <vector>
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
namespace platform {
|
namespace platform {
|
||||||
|
@ -32,6 +31,8 @@ json getDisplay(int index);
|
||||||
int getNumMemory();
|
int getNumMemory();
|
||||||
json getMemory(int index);
|
json getMemory(int index);
|
||||||
|
|
||||||
|
json getComputer();
|
||||||
|
|
||||||
} // namespace platform
|
} // namespace platform
|
||||||
|
|
||||||
#endif // hifi_platform_h
|
#endif // hifi_platform_h
|
||||||
|
|
|
@ -7,24 +7,13 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platformInstance.h"
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
#include "WINPlatform.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
|
||||||
#include "MACOSPlatform.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace platform;
|
using namespace platform;
|
||||||
|
|
||||||
bool Instance::enumeratePlatform() {
|
bool Instance::enumeratePlatform() {
|
||||||
|
enumerateComputer();
|
||||||
enumerateCpu();
|
enumerateCpu();
|
||||||
enumerateGpu();
|
enumerateGpu();
|
||||||
enumerateMemory();
|
enumerateMemory();
|
||||||
|
@ -75,7 +64,6 @@ Instance::~Instance() {
|
||||||
_memory.clear();
|
_memory.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (_gpu.size() > 0) {
|
if (_gpu.size() > 0) {
|
||||||
_gpu.clear();
|
_gpu.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,13 @@ public:
|
||||||
int getNumDisplay() { return (int)_display.size(); }
|
int getNumDisplay() { return (int)_display.size(); }
|
||||||
json getDisplay(int index);
|
json getDisplay(int index);
|
||||||
|
|
||||||
|
|
||||||
|
json getComputer() {return _computer;}
|
||||||
|
|
||||||
void virtual enumerateCpu()=0;
|
void virtual enumerateCpu()=0;
|
||||||
void virtual enumerateMemory()=0;
|
void virtual enumerateMemory()=0;
|
||||||
void virtual enumerateGpu()=0;
|
void virtual enumerateGpu()=0;
|
||||||
|
void virtual enumerateComputer()=0;
|
||||||
|
|
||||||
virtual ~Instance();
|
virtual ~Instance();
|
||||||
|
|
||||||
|
@ -42,6 +46,7 @@ protected:
|
||||||
std::vector<json> _memory;
|
std::vector<json> _memory;
|
||||||
std::vector<json> _gpu;
|
std::vector<json> _gpu;
|
||||||
std::vector<json> _display;
|
std::vector<json> _display;
|
||||||
|
json _computer;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace platform
|
} // namespace platform
|
||||||
|
|
|
@ -26,9 +26,12 @@ namespace platform {
|
||||||
static const char* displayCoordsRight { "coordinatesright"};
|
static const char* displayCoordsRight { "coordinatesright"};
|
||||||
static const char* displayCoordsTop { "coordinatestop"};
|
static const char* displayCoordsTop { "coordinatestop"};
|
||||||
static const char* displayCoordsBottom { "coordinatesbottom"};
|
static const char* displayCoordsBottom { "coordinatesbottom"};
|
||||||
|
static const char* computerModel { "computerModel"};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace platform
|
} // namespace plaform::jsonKeys
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -91,7 +91,7 @@ void ProceduralData::parse(const QJsonObject& proceduralData) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Fragment shader URL (either fragmentShaderUrl or shaderUrl)
|
{ // Fragment shader URL (either fragmentShaderURL or shaderUrl)
|
||||||
auto rawShaderUrl = proceduralData[FRAGMENT_URL_KEY].toString();
|
auto rawShaderUrl = proceduralData[FRAGMENT_URL_KEY].toString();
|
||||||
fragmentShaderUrl = DependencyManager::get<ResourceManager>()->normalizeURL(rawShaderUrl);
|
fragmentShaderUrl = DependencyManager::get<ResourceManager>()->normalizeURL(rawShaderUrl);
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,6 @@ class ProceduralMaterial : public NetworkMaterial {
|
||||||
public:
|
public:
|
||||||
ProceduralMaterial() : NetworkMaterial() { initializeProcedural(); }
|
ProceduralMaterial() : NetworkMaterial() { initializeProcedural(); }
|
||||||
ProceduralMaterial(const NetworkMaterial& material) : NetworkMaterial(material) { initializeProcedural(); }
|
ProceduralMaterial(const NetworkMaterial& material) : NetworkMaterial(material) { initializeProcedural(); }
|
||||||
//ProceduralMaterial(const ProceduralMaterial& material) : NetworkMaterial(material), _procedural(material._procedural) {}
|
|
||||||
|
|
||||||
bool isProcedural() const override { return true; }
|
bool isProcedural() const override { return true; }
|
||||||
bool isEnabled() const override { return _procedural.isEnabled(); }
|
bool isEnabled() const override { return _procedural.isEnabled(); }
|
||||||
|
|
|
@ -76,7 +76,6 @@ void CauterizedModel::createRenderItemSet() {
|
||||||
// Run through all of the meshes, and place them into their segregated, but unsorted buckets
|
// Run through all of the meshes, and place them into their segregated, but unsorted buckets
|
||||||
int shapeID = 0;
|
int shapeID = 0;
|
||||||
uint32_t numMeshes = (uint32_t)meshes.size();
|
uint32_t numMeshes = (uint32_t)meshes.size();
|
||||||
const HFMModel& hfmModel = getHFMModel();
|
|
||||||
for (uint32_t i = 0; i < numMeshes; i++) {
|
for (uint32_t i = 0; i < numMeshes; i++) {
|
||||||
const auto& mesh = meshes.at(i);
|
const auto& mesh = meshes.at(i);
|
||||||
if (!mesh) {
|
if (!mesh) {
|
||||||
|
@ -86,8 +85,6 @@ void CauterizedModel::createRenderItemSet() {
|
||||||
// Create the render payloads
|
// Create the render payloads
|
||||||
int numParts = (int)mesh->getNumParts();
|
int numParts = (int)mesh->getNumParts();
|
||||||
for (int partIndex = 0; partIndex < numParts; partIndex++) {
|
for (int partIndex = 0; partIndex < numParts; partIndex++) {
|
||||||
initializeBlendshapes(hfmModel.meshes[i], i);
|
|
||||||
|
|
||||||
auto ptr = std::make_shared<CauterizedMeshPartPayload>(shared_from_this(), i, partIndex, shapeID, transform, offset, _created);
|
auto ptr = std::make_shared<CauterizedMeshPartPayload>(shared_from_this(), i, partIndex, shapeID, transform, offset, _created);
|
||||||
_modelMeshRenderItems << std::static_pointer_cast<ModelMeshPartPayload>(ptr);
|
_modelMeshRenderItems << std::static_pointer_cast<ModelMeshPartPayload>(ptr);
|
||||||
auto material = getGeometry()->getShapeMaterial(shapeID);
|
auto material = getGeometry()->getShapeMaterial(shapeID);
|
||||||
|
@ -96,7 +93,6 @@ void CauterizedModel::createRenderItemSet() {
|
||||||
shapeID++;
|
shapeID++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_blendshapeOffsetsInitialized = true;
|
|
||||||
} else {
|
} else {
|
||||||
Model::createRenderItemSet();
|
Model::createRenderItemSet();
|
||||||
}
|
}
|
||||||
|
@ -181,7 +177,7 @@ void CauterizedModel::updateClusterMatrices() {
|
||||||
|
|
||||||
// post the blender if we're not currently waiting for one to finish
|
// post the blender if we're not currently waiting for one to finish
|
||||||
auto modelBlender = DependencyManager::get<ModelBlender>();
|
auto modelBlender = DependencyManager::get<ModelBlender>();
|
||||||
if (_blendshapeOffsetsInitialized && modelBlender->shouldComputeBlendshapes() && hfmModel.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) {
|
if (modelBlender->shouldComputeBlendshapes() && hfmModel.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) {
|
||||||
_blendedBlendshapeCoefficients = _blendshapeCoefficients;
|
_blendedBlendshapeCoefficients = _blendshapeCoefficients;
|
||||||
modelBlender->noteRequiresBlend(getThisPointer());
|
modelBlender->noteRequiresBlend(getThisPointer());
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "RenderPipelines.h"
|
#include "RenderPipelines.h"
|
||||||
|
|
||||||
bool MeshPartPayload::enableMeshShaders = true;
|
bool MeshPartPayload::enableMeshShaders = false;
|
||||||
|
|
||||||
using namespace render;
|
using namespace render;
|
||||||
|
|
||||||
|
|
|
@ -315,10 +315,8 @@ bool Model::updateGeometry() {
|
||||||
state.clusterDualQuaternions.resize(mesh.clusters.size());
|
state.clusterDualQuaternions.resize(mesh.clusters.size());
|
||||||
state.clusterMatrices.resize(mesh.clusters.size());
|
state.clusterMatrices.resize(mesh.clusters.size());
|
||||||
_meshStates.push_back(state);
|
_meshStates.push_back(state);
|
||||||
initializeBlendshapes(mesh, i);
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
_blendshapeOffsetsInitialized = true;
|
|
||||||
needFullUpdate = true;
|
needFullUpdate = true;
|
||||||
emit rigReady();
|
emit rigReady();
|
||||||
}
|
}
|
||||||
|
@ -1023,9 +1021,6 @@ void Model::removeFromScene(const render::ScenePointer& scene, render::Transacti
|
||||||
_modelMeshRenderItemShapes.clear();
|
_modelMeshRenderItemShapes.clear();
|
||||||
_priorityMap.clear();
|
_priorityMap.clear();
|
||||||
|
|
||||||
_blendshapeOffsets.clear();
|
|
||||||
_blendshapeOffsetsInitialized = false;
|
|
||||||
|
|
||||||
_addedToScene = false;
|
_addedToScene = false;
|
||||||
|
|
||||||
_renderInfoVertexCount = 0;
|
_renderInfoVertexCount = 0;
|
||||||
|
@ -1416,7 +1411,7 @@ void Model::updateClusterMatrices() {
|
||||||
|
|
||||||
// post the blender if we're not currently waiting for one to finish
|
// post the blender if we're not currently waiting for one to finish
|
||||||
auto modelBlender = DependencyManager::get<ModelBlender>();
|
auto modelBlender = DependencyManager::get<ModelBlender>();
|
||||||
if (_blendshapeOffsetsInitialized && modelBlender->shouldComputeBlendshapes() && hfmModel.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) {
|
if (modelBlender->shouldComputeBlendshapes() && hfmModel.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) {
|
||||||
_blendedBlendshapeCoefficients = _blendshapeCoefficients;
|
_blendedBlendshapeCoefficients = _blendshapeCoefficients;
|
||||||
modelBlender->noteRequiresBlend(getThisPointer());
|
modelBlender->noteRequiresBlend(getThisPointer());
|
||||||
}
|
}
|
||||||
|
@ -1424,8 +1419,6 @@ void Model::updateClusterMatrices() {
|
||||||
|
|
||||||
void Model::deleteGeometry() {
|
void Model::deleteGeometry() {
|
||||||
_deleteGeometryCounter++;
|
_deleteGeometryCounter++;
|
||||||
_blendshapeOffsets.clear();
|
|
||||||
_blendshapeOffsetsInitialized = false;
|
|
||||||
_meshStates.clear();
|
_meshStates.clear();
|
||||||
_rig.destroyAnimGraph();
|
_rig.destroyAnimGraph();
|
||||||
_blendedBlendshapeCoefficients.clear();
|
_blendedBlendshapeCoefficients.clear();
|
||||||
|
@ -1485,7 +1478,6 @@ void Model::createRenderItemSet() {
|
||||||
// Run through all of the meshes, and place them into their segregated, but unsorted buckets
|
// Run through all of the meshes, and place them into their segregated, but unsorted buckets
|
||||||
int shapeID = 0;
|
int shapeID = 0;
|
||||||
uint32_t numMeshes = (uint32_t)meshes.size();
|
uint32_t numMeshes = (uint32_t)meshes.size();
|
||||||
auto& hfmModel = getHFMModel();
|
|
||||||
for (uint32_t i = 0; i < numMeshes; i++) {
|
for (uint32_t i = 0; i < numMeshes; i++) {
|
||||||
const auto& mesh = meshes.at(i);
|
const auto& mesh = meshes.at(i);
|
||||||
if (!mesh) {
|
if (!mesh) {
|
||||||
|
@ -1495,7 +1487,6 @@ void Model::createRenderItemSet() {
|
||||||
// Create the render payloads
|
// Create the render payloads
|
||||||
int numParts = (int)mesh->getNumParts();
|
int numParts = (int)mesh->getNumParts();
|
||||||
for (int partIndex = 0; partIndex < numParts; partIndex++) {
|
for (int partIndex = 0; partIndex < numParts; partIndex++) {
|
||||||
initializeBlendshapes(hfmModel.meshes[i], i);
|
|
||||||
_modelMeshRenderItems << std::make_shared<ModelMeshPartPayload>(shared_from_this(), i, partIndex, shapeID, transform, offset, _created);
|
_modelMeshRenderItems << std::make_shared<ModelMeshPartPayload>(shared_from_this(), i, partIndex, shapeID, transform, offset, _created);
|
||||||
auto material = getGeometry()->getShapeMaterial(shapeID);
|
auto material = getGeometry()->getShapeMaterial(shapeID);
|
||||||
_modelMeshMaterialNames.push_back(material ? material->getName() : "");
|
_modelMeshMaterialNames.push_back(material ? material->getName() : "");
|
||||||
|
@ -1503,7 +1494,6 @@ void Model::createRenderItemSet() {
|
||||||
shapeID++;
|
shapeID++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_blendshapeOffsetsInitialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Model::isRenderable() const {
|
bool Model::isRenderable() const {
|
||||||
|
@ -1723,56 +1713,54 @@ void packBlendshapeOffsetTo_Pos_F32_3xSN10_Nor_3xSN10_Tan_3xSN10(glm::uvec4& pac
|
||||||
class Blender : public QRunnable {
|
class Blender : public QRunnable {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointer& geometry, const QVector<float>& blendshapeCoefficients);
|
Blender(ModelPointer model, HFMModel::ConstPointer hfmModel, int blendNumber, const QVector<float>& blendshapeCoefficients);
|
||||||
|
|
||||||
virtual void run() override;
|
virtual void run() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ModelPointer _model;
|
ModelPointer _model;
|
||||||
|
HFMModel::ConstPointer _hfmModel;
|
||||||
int _blendNumber;
|
int _blendNumber;
|
||||||
Geometry::WeakPointer _geometry;
|
|
||||||
QVector<float> _blendshapeCoefficients;
|
QVector<float> _blendshapeCoefficients;
|
||||||
};
|
};
|
||||||
|
|
||||||
Blender::Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointer& geometry, const QVector<float>& blendshapeCoefficients) :
|
Blender::Blender(ModelPointer model, HFMModel::ConstPointer hfmModel, int blendNumber, const QVector<float>& blendshapeCoefficients) :
|
||||||
_model(model),
|
_model(model),
|
||||||
|
_hfmModel(hfmModel),
|
||||||
_blendNumber(blendNumber),
|
_blendNumber(blendNumber),
|
||||||
_geometry(geometry),
|
|
||||||
_blendshapeCoefficients(blendshapeCoefficients) {
|
_blendshapeCoefficients(blendshapeCoefficients) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Blender::run() {
|
void Blender::run() {
|
||||||
QVector<BlendshapeOffset> blendshapeOffsets;
|
|
||||||
QVector<int> blendedMeshSizes;
|
|
||||||
if (_model && _model->isLoaded()) {
|
|
||||||
DETAILED_PROFILE_RANGE_EX(simulation_animation, __FUNCTION__, 0xFFFF0000, 0, { { "url", _model->getURL().toString() } });
|
DETAILED_PROFILE_RANGE_EX(simulation_animation, __FUNCTION__, 0xFFFF0000, 0, { { "url", _model->getURL().toString() } });
|
||||||
|
int numBlendshapeOffsets = 0; // number of offsets required for all meshes.
|
||||||
|
int numMeshes = 0; // number of meshes in this model.
|
||||||
|
for (auto meshIter = _hfmModel->meshes.cbegin(); meshIter != _hfmModel->meshes.cend(); ++meshIter) {
|
||||||
|
numMeshes++;
|
||||||
|
int numVertsInMesh = meshIter->vertices.size();
|
||||||
|
numBlendshapeOffsets += numVertsInMesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
// all elements are default constructed to zero offsets.
|
||||||
|
QVector<BlendshapeOffset> packedBlendshapeOffsets(numBlendshapeOffsets);
|
||||||
|
QVector<BlendshapeOffsetUnpacked> unpackedBlendshapeOffsets(numBlendshapeOffsets);
|
||||||
|
|
||||||
|
// allocate the required size
|
||||||
|
QVector<int> blendedMeshSizes;
|
||||||
|
blendedMeshSizes.reserve(numMeshes);
|
||||||
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
const auto& meshes = _model->getHFMModel().meshes;
|
for (auto meshIter = _hfmModel->meshes.cbegin(); meshIter != _hfmModel->meshes.cend(); ++meshIter) {
|
||||||
int meshIndex = 0;
|
if (meshIter->blendshapes.isEmpty()) {
|
||||||
for(const HFMMesh& mesh : meshes) {
|
|
||||||
auto modelMeshBlendshapeOffsets = _model->_blendshapeOffsets.find(meshIndex++);
|
|
||||||
if (mesh.blendshapes.isEmpty() || modelMeshBlendshapeOffsets == _model->_blendshapeOffsets.end()) {
|
|
||||||
// Not blendshaped or not initialized
|
|
||||||
blendedMeshSizes.push_back(0);
|
blendedMeshSizes.push_back(0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
int numVertsInMesh = meshIter->vertices.size();
|
||||||
|
blendedMeshSizes.push_back(numVertsInMesh);
|
||||||
|
|
||||||
if (mesh.vertices.size() != modelMeshBlendshapeOffsets->second.size()) {
|
// for each blendshape in this mesh, accumulate the offsets into unpackedBlendshapeOffsets.
|
||||||
// Mesh sizes don't match. Something has gone wrong
|
|
||||||
blendedMeshSizes.push_back(0);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
blendshapeOffsets += modelMeshBlendshapeOffsets->second;
|
|
||||||
BlendshapeOffset* meshBlendshapeOffsets = blendshapeOffsets.data() + offset;
|
|
||||||
int numVertices = modelMeshBlendshapeOffsets->second.size();
|
|
||||||
blendedMeshSizes.push_back(numVertices);
|
|
||||||
offset += numVertices;
|
|
||||||
std::vector<BlendshapeOffsetUnpacked> unpackedBlendshapeOffsets(modelMeshBlendshapeOffsets->second.size());
|
|
||||||
|
|
||||||
const float NORMAL_COEFFICIENT_SCALE = 0.01f;
|
const float NORMAL_COEFFICIENT_SCALE = 0.01f;
|
||||||
for (int i = 0, n = qMin(_blendshapeCoefficients.size(), mesh.blendshapes.size()); i < n; i++) {
|
for (int i = 0, n = qMin(_blendshapeCoefficients.size(), meshIter->blendshapes.size()); i < n; i++) {
|
||||||
float vertexCoefficient = _blendshapeCoefficients.at(i);
|
float vertexCoefficient = _blendshapeCoefficients.at(i);
|
||||||
const float EPSILON = 0.0001f;
|
const float EPSILON = 0.0001f;
|
||||||
if (vertexCoefficient < EPSILON) {
|
if (vertexCoefficient < EPSILON) {
|
||||||
|
@ -1780,62 +1768,49 @@ void Blender::run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
float normalCoefficient = vertexCoefficient * NORMAL_COEFFICIENT_SCALE;
|
float normalCoefficient = vertexCoefficient * NORMAL_COEFFICIENT_SCALE;
|
||||||
const HFMBlendshape& blendshape = mesh.blendshapes.at(i);
|
const HFMBlendshape& blendshape = meshIter->blendshapes.at(i);
|
||||||
for (int j = 0; j < blendshape.indices.size(); ++j) {
|
for (int j = 0; j < blendshape.indices.size(); ++j) {
|
||||||
int index = blendshape.indices.at(j);
|
int index = blendshape.indices.at(j);
|
||||||
|
|
||||||
auto& currentBlendshapeOffset = unpackedBlendshapeOffsets[index];
|
auto& currentBlendshapeOffset = unpackedBlendshapeOffsets[offset + index];
|
||||||
currentBlendshapeOffset.positionOffset += blendshape.vertices.at(j) * vertexCoefficient;
|
currentBlendshapeOffset.positionOffset += blendshape.vertices.at(j) * vertexCoefficient;
|
||||||
|
|
||||||
currentBlendshapeOffset.normalOffset += blendshape.normals.at(j) * normalCoefficient;
|
currentBlendshapeOffset.normalOffset += blendshape.normals.at(j) * normalCoefficient;
|
||||||
if (j < blendshape.tangents.size()) {
|
if (j < blendshape.tangents.size()) {
|
||||||
currentBlendshapeOffset.tangentOffset += blendshape.tangents.at(j) * normalCoefficient;
|
currentBlendshapeOffset.tangentOffset += blendshape.tangents.at(j) * normalCoefficient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
offset += numVertsInMesh;
|
||||||
|
}
|
||||||
|
|
||||||
// Blendshape offsets are generrated, now let's pack it on its way to gpu
|
// convert unpackedBlendshapeOffsets into packedBlendshapeOffsets for the gpu.
|
||||||
// FIXME it feels like we could be more effectively using SIMD here
|
// FIXME it feels like we could be more effectively using SIMD here
|
||||||
{
|
{
|
||||||
auto unpacked = unpackedBlendshapeOffsets.data();
|
auto unpacked = unpackedBlendshapeOffsets.data();
|
||||||
auto packed = meshBlendshapeOffsets;
|
auto packed = packedBlendshapeOffsets.data();
|
||||||
for (int j = 0; j < (int)unpackedBlendshapeOffsets.size(); ++j) {
|
for (int i = 0; i < unpackedBlendshapeOffsets.size(); ++i) {
|
||||||
packBlendshapeOffsetTo_Pos_F32_3xSN10_Nor_3xSN10_Tan_3xSN10((*packed).packedPosNorTan, (*unpacked));
|
packBlendshapeOffsetTo_Pos_F32_3xSN10_Nor_3xSN10_Tan_3xSN10((*packed).packedPosNorTan, (*unpacked));
|
||||||
++unpacked;
|
++unpacked;
|
||||||
++packed;
|
++packed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
// post the result to the ModelBlender, which will dispatch to the model if still alive
|
// post the result to the ModelBlender, which will dispatch to the model if still alive
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<ModelBlender>().data(), "setBlendedVertices",
|
QMetaObject::invokeMethod(DependencyManager::get<ModelBlender>().data(), "setBlendedVertices",
|
||||||
Q_ARG(ModelPointer, _model), Q_ARG(int, _blendNumber), Q_ARG(QVector<BlendshapeOffset>, blendshapeOffsets), Q_ARG(QVector<int>, blendedMeshSizes));
|
Q_ARG(ModelPointer, _model), Q_ARG(int, _blendNumber),
|
||||||
|
Q_ARG(QVector<BlendshapeOffset>, packedBlendshapeOffsets),
|
||||||
|
Q_ARG(QVector<int>, blendedMeshSizes));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Model::maybeStartBlender() {
|
bool Model::maybeStartBlender() {
|
||||||
if (isLoaded()) {
|
if (isLoaded()) {
|
||||||
QThreadPool::globalInstance()->start(new Blender(getThisPointer(), ++_blendNumber, _renderGeometry, _blendshapeCoefficients));
|
QThreadPool::globalInstance()->start(new Blender(getThisPointer(), getGeometry()->getConstHFMModelPointer(),
|
||||||
|
++_blendNumber, _blendshapeCoefficients));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Model::initializeBlendshapes(const HFMMesh& mesh, int index) {
|
|
||||||
if (mesh.blendshapes.empty()) {
|
|
||||||
// mesh doesn't have blendshape, did we allocate one though ?
|
|
||||||
if (_blendshapeOffsets.find(index) != _blendshapeOffsets.end()) {
|
|
||||||
qWarning() << "Mesh does not have Blendshape yet the blendshapeOffsets are allocated ?";
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Mesh has blendshape, let s allocate the local buffer if not done yet
|
|
||||||
if (_blendshapeOffsets.find(index) == _blendshapeOffsets.end()) {
|
|
||||||
QVector<BlendshapeOffset> blendshapeOffset;
|
|
||||||
blendshapeOffset.fill(BlendshapeOffset(), mesh.vertices.size());
|
|
||||||
_blendshapeOffsets[index] = blendshapeOffset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ModelBlender::ModelBlender() :
|
ModelBlender::ModelBlender() :
|
||||||
_pendingBlenders(0) {
|
_pendingBlenders(0) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,8 +363,6 @@ public:
|
||||||
void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName);
|
void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName);
|
||||||
void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName);
|
void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName);
|
||||||
|
|
||||||
std::unordered_map<int, QVector<BlendshapeOffset>> _blendshapeOffsets;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void loadURLFinished(bool success);
|
void loadURLFinished(bool success);
|
||||||
|
|
||||||
|
@ -446,7 +444,6 @@ protected:
|
||||||
QVector<float> _blendshapeCoefficients;
|
QVector<float> _blendshapeCoefficients;
|
||||||
QVector<float> _blendedBlendshapeCoefficients;
|
QVector<float> _blendedBlendshapeCoefficients;
|
||||||
int _blendNumber { 0 };
|
int _blendNumber { 0 };
|
||||||
bool _blendshapeOffsetsInitialized { false };
|
|
||||||
|
|
||||||
mutable QMutex _mutex{ QMutex::Recursive };
|
mutable QMutex _mutex{ QMutex::Recursive };
|
||||||
|
|
||||||
|
@ -509,8 +506,6 @@ protected:
|
||||||
|
|
||||||
bool shouldInvalidatePayloadShapeKey(int meshIndex);
|
bool shouldInvalidatePayloadShapeKey(int meshIndex);
|
||||||
|
|
||||||
void initializeBlendshapes(const HFMMesh& mesh, int index);
|
|
||||||
|
|
||||||
uint64_t _created;
|
uint64_t _created;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
#include "RenderDeferredTask.h"
|
#include "RenderDeferredTask.h"
|
||||||
#include "RenderForwardTask.h"
|
#include "RenderForwardTask.h"
|
||||||
|
|
||||||
#include <RenderForward.h>
|
|
||||||
|
|
||||||
void RenderShadowsAndDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output, render::CullFunctor cullFunctor, uint8_t tagBits, uint8_t tagMask) {
|
void RenderShadowsAndDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output, render::CullFunctor cullFunctor, uint8_t tagBits, uint8_t tagMask) {
|
||||||
task.addJob<SetRenderMethod>("SetRenderMethodTask", render::Args::DEFERRED);
|
task.addJob<SetRenderMethod>("SetRenderMethodTask", render::Args::DEFERRED);
|
||||||
|
|
||||||
|
@ -34,9 +32,9 @@ void RenderShadowsAndDeferredTask::build(JobModel& task, const render::Varying&
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeferredForwardSwitchJob::build(JobModel& task, const render::Varying& input, render::Varying& output, render::CullFunctor cullFunctor, uint8_t tagBits, uint8_t tagMask) {
|
void DeferredForwardSwitchJob::build(JobModel& task, const render::Varying& input, render::Varying& output, render::CullFunctor cullFunctor, uint8_t tagBits, uint8_t tagMask) {
|
||||||
task.addBranch<RenderShadowsAndDeferredTask>("RenderShadowsAndDeferredTask", RENDER_FORWARD ? 1 : 0, input, cullFunctor, tagBits, tagMask);
|
task.addBranch<RenderShadowsAndDeferredTask>("RenderShadowsAndDeferredTask", 0, input, cullFunctor, tagBits, tagMask);
|
||||||
|
|
||||||
task.addBranch<RenderForwardTask>("RenderForwardTask", RENDER_FORWARD ? 0 : 1, input);
|
task.addBranch<RenderForwardTask>("RenderForwardTask", 1, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderViewTask::build(JobModel& task, const render::Varying& input, render::Varying& output, render::CullFunctor cullFunctor, uint8_t tagBits, uint8_t tagMask) {
|
void RenderViewTask::build(JobModel& task, const render::Varying& input, render::Varying& output, render::CullFunctor cullFunctor, uint8_t tagBits, uint8_t tagMask) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ void SoftAttachmentModel::updateClusterMatrices() {
|
||||||
|
|
||||||
// post the blender if we're not currently waiting for one to finish
|
// post the blender if we're not currently waiting for one to finish
|
||||||
auto modelBlender = DependencyManager::get<ModelBlender>();
|
auto modelBlender = DependencyManager::get<ModelBlender>();
|
||||||
if (_blendshapeOffsetsInitialized && modelBlender->shouldComputeBlendshapes() && hfmModel.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) {
|
if (modelBlender->shouldComputeBlendshapes() && hfmModel.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) {
|
||||||
_blendedBlendshapeCoefficients = _blendshapeCoefficients;
|
_blendedBlendshapeCoefficients = _blendshapeCoefficients;
|
||||||
modelBlender->noteRequiresBlend(getThisPointer());
|
modelBlender->noteRequiresBlend(getThisPointer());
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
|
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
#include <OpenGL/OpenGL.h>
|
#include <OpenGL/OpenGL.h>
|
||||||
|
#include <sstream>
|
||||||
|
#include <QString>
|
||||||
|
#include <qstringlist.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QtCore/QtGlobal>
|
#include <QtCore/QtGlobal>
|
||||||
|
@ -56,6 +60,27 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//get gpu name
|
||||||
|
FILE* stream = popen("system_profiler SPDisplaysDataType | grep Chipset", "r");
|
||||||
|
|
||||||
|
std::ostringstream hostStream;
|
||||||
|
while (!feof(stream) && !ferror(stream)) {
|
||||||
|
char buf[128];
|
||||||
|
int bytesRead = fread(buf, 1, 128, stream);
|
||||||
|
hostStream.write(buf, bytesRead);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString result = QString::fromStdString(hostStream.str());
|
||||||
|
QStringList parts = result.split('\n');
|
||||||
|
std::string name;
|
||||||
|
|
||||||
|
for (int i = 0; i < parts.size(); ++i) {
|
||||||
|
if (parts[i].toLower().contains("radeon") || parts[i].toLower().contains("nvidia")) {
|
||||||
|
_name=parts[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_dedicatedMemoryMB = bestVRAM;
|
_dedicatedMemoryMB = bestVRAM;
|
||||||
CGLDestroyRendererInfo(rendererInfo);
|
CGLDestroyRendererInfo(rendererInfo);
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,6 @@ public:
|
||||||
TaskConfig() = default;
|
TaskConfig() = default;
|
||||||
TaskConfig(bool enabled) : JobConfig(enabled) {}
|
TaskConfig(bool enabled) : JobConfig(enabled) {}
|
||||||
|
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* @function Render.getConfig
|
* @function Render.getConfig
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
|
@ -262,7 +261,7 @@ public:
|
||||||
|
|
||||||
class SwitchConfig : public JobConfig {
|
class SwitchConfig : public JobConfig {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool branch READ getBranch WRITE setBranch NOTIFY dirtyEnabled)
|
Q_PROPERTY(int branch READ getBranch WRITE setBranch NOTIFY dirtyEnabled)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
uint8_t getBranch() const { return _branch; }
|
uint8_t getBranch() const { return _branch; }
|
||||||
|
|
Loading…
Reference in a new issue