mirror of
https://github.com/lubosz/overte.git
synced 2025-04-17 20:50:27 +02:00
Merge branch 'one' of github.com:samcake/hifi into one
This commit is contained in:
commit
1461f81a9e
17 changed files with 16 additions and 578 deletions
|
@ -87,7 +87,6 @@
|
|||
#include <FramebufferCache.h>
|
||||
#include <gpu/Batch.h>
|
||||
#include <gpu/Context.h>
|
||||
//#include <gpu/gl/GLBackend.h>
|
||||
#include <InfoView.h>
|
||||
#include <input-plugins/InputPlugin.h>
|
||||
#include <controllers/UserInputMapper.h>
|
||||
|
@ -2313,7 +2312,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
DependencyManager::get<Keyboard>()->createKeyboard();
|
||||
|
||||
_pendingIdleEvent = false;
|
||||
// _pendingRenderEvent = false;
|
||||
_graphicsEngine.startup();
|
||||
|
||||
qCDebug(interfaceapp) << "Metaverse session ID is" << uuidStringWithoutCurlyBraces(accountManager->getSessionID());
|
||||
|
@ -2578,11 +2576,6 @@ void Application::cleanupBeforeQuit() {
|
|||
|
||||
// Cleanup all overlays after the scripts, as scripts might add more
|
||||
_overlays.cleanupAllOverlays();
|
||||
// The cleanup process enqueues the transactions but does not process them. Calling this here will force the actual
|
||||
// removal of the items.
|
||||
// See https://highfidelity.fogbugz.com/f/cases/5328
|
||||
// _main3DScene->enqueueFrame(); // flush all the transactions
|
||||
// _main3DScene->processTransactionQueue(); // process and apply deletions
|
||||
|
||||
// first stop all timers directly or by invokeMethod
|
||||
// depending on what thread they run in
|
||||
|
@ -2598,8 +2591,6 @@ void Application::cleanupBeforeQuit() {
|
|||
|
||||
_window->saveGeometry();
|
||||
|
||||
// _gpuContext->shutdown();
|
||||
|
||||
// Destroy third party processes after scripts have finished using them.
|
||||
#ifdef HAVE_DDE
|
||||
DependencyManager::destroy<DdeFaceTracker>();
|
||||
|
@ -2655,9 +2646,7 @@ Application::~Application() {
|
|||
_shapeManager.collectGarbage();
|
||||
assert(_shapeManager.getNumShapes() == 0);
|
||||
|
||||
// shutdown render engine
|
||||
//_main3DScene = nullptr;
|
||||
//_renderEngine = nullptr;
|
||||
// shutdown graphics engine
|
||||
_graphicsEngine.shutdown();
|
||||
|
||||
_gameWorkload.shutdown();
|
||||
|
@ -2717,9 +2706,6 @@ Application::~Application() {
|
|||
|
||||
// Can't log to file passed this point, FileLogger about to be deleted
|
||||
qInstallMessageHandler(LogHandler::verboseMessageHandler);
|
||||
|
||||
|
||||
// _renderEventHandler->deleteLater();
|
||||
}
|
||||
|
||||
void Application::initializeGL() {
|
||||
|
@ -4681,19 +4667,6 @@ void Application::idle() {
|
|||
PROFILE_COUNTER_IF_CHANGED(app, "pendingProcessing", int, DependencyManager::get<StatTracker>()->getStat("PendingProcessing").toInt());
|
||||
auto renderConfig = _graphicsEngine.getRenderEngine()->getConfiguration();
|
||||
PROFILE_COUNTER_IF_CHANGED(render, "gpuTime", float, (float)_graphicsEngine.getGPUContext()->getFrameTimerGPUAverage());
|
||||
/* auto opaqueRangeTimer = renderConfig->getConfig("OpaqueRangeTimer");
|
||||
auto linearDepth = renderConfig->getConfig("LinearDepth");
|
||||
auto surfaceGeometry = renderConfig->getConfig("SurfaceGeometry");
|
||||
auto renderDeferred = renderConfig->getConfig("RenderDeferred");
|
||||
auto toneAndPostRangeTimer = renderConfig->getConfig("ToneAndPostRangeTimer");
|
||||
|
||||
PROFILE_COUNTER(render_detail, "gpuTimes", {
|
||||
{ "OpaqueRangeTimer", opaqueRangeTimer ? opaqueRangeTimer->property("gpuRunTime") : 0 },
|
||||
{ "LinearDepth", linearDepth ? linearDepth->property("gpuRunTime") : 0 },
|
||||
{ "SurfaceGeometry", surfaceGeometry ? surfaceGeometry->property("gpuRunTime") : 0 },
|
||||
{ "RenderDeferred", renderDeferred ? renderDeferred->property("gpuRunTime") : 0 },
|
||||
{ "ToneAndPostRangeTimer", toneAndPostRangeTimer ? toneAndPostRangeTimer->property("gpuRunTime") : 0 }
|
||||
});*/
|
||||
|
||||
PROFILE_RANGE(app, __FUNCTION__);
|
||||
|
||||
|
@ -5062,9 +5035,6 @@ QVector<EntityItemID> Application::pasteEntities(float x, float y, float z) {
|
|||
void Application::init() {
|
||||
// Make sure Login state is up to date
|
||||
DependencyManager::get<DialogsManager>()->toggleLoginDialog();
|
||||
// if (!DISABLE_DEFERRED) {
|
||||
// DependencyManager::get<DeferredLightingEffect>()->init();
|
||||
// }
|
||||
DependencyManager::get<AvatarManager>()->init();
|
||||
|
||||
_timerStart.start();
|
||||
|
@ -6129,13 +6099,6 @@ void Application::update(float deltaTime) {
|
|||
|
||||
updateRenderArgs(deltaTime);
|
||||
|
||||
// HACK
|
||||
// load the view frustum
|
||||
// FIXME: This preDisplayRender call is temporary until we create a separate render::scene for the mirror rendering.
|
||||
// Then we can move this logic into the Avatar::simulate call.
|
||||
// myAvatar->preDisplaySide(&_appRenderArgs._renderArgs);
|
||||
|
||||
|
||||
{
|
||||
PerformanceTimer perfTimer("AnimDebugDraw");
|
||||
AnimDebugDraw::getInstance().update();
|
||||
|
|
|
@ -153,8 +153,6 @@ public:
|
|||
void updateSecondaryCameraViewFrustum();
|
||||
|
||||
void updateCamera(RenderArgs& renderArgs, float deltaTime);
|
||||
// bool shouldPaint() const;
|
||||
// void paintGL();
|
||||
void resizeGL();
|
||||
|
||||
bool event(QEvent* event) override;
|
||||
|
@ -276,11 +274,6 @@ public:
|
|||
void setMaxOctreePacketsPerSecond(int maxOctreePPS);
|
||||
int getMaxOctreePacketsPerSecond() const;
|
||||
|
||||
/* render::ScenePointer getMain3DScene() override { return _main3DScene; }
|
||||
const render::ScenePointer& getMain3DScene() const { return _main3DScene; }
|
||||
render::EnginePointer getRenderEngine() override { return _renderEngine; }
|
||||
gpu::ContextPointer getGPUContext() const { return _gpuContext; }
|
||||
*/
|
||||
render::ScenePointer getMain3DScene() override { return _graphicsEngine.getRenderScene(); }
|
||||
const render::ScenePointer& getMain3DScene() const { return _graphicsEngine.getRenderScene(); }
|
||||
render::EnginePointer getRenderEngine() override { return _graphicsEngine.getRenderEngine(); }
|
||||
|
@ -541,8 +534,6 @@ private:
|
|||
|
||||
void initializeAcceptedFiles();
|
||||
|
||||
// void runRenderFrame(RenderArgs* renderArgs/*, Camera& whichCamera, bool selfAvatarOnly = false*/);
|
||||
|
||||
bool importJSONFromURL(const QString& urlString);
|
||||
bool importSVOFromURL(const QString& urlString);
|
||||
bool importFromZIP(const QString& filePath);
|
||||
|
@ -598,7 +589,6 @@ private:
|
|||
QTimer _minimizedWindowTimer;
|
||||
QElapsedTimer _timerStart;
|
||||
QElapsedTimer _lastTimeUpdated;
|
||||
// QElapsedTimer _lastTimeRendered;
|
||||
|
||||
int _minimumGPUTextureMemSizeStabilityCount { 30 };
|
||||
|
||||
|
@ -684,10 +674,6 @@ private:
|
|||
|
||||
quint64 _lastFaceTrackerUpdate;
|
||||
|
||||
// render::ScenePointer _main3DScene{ new render::Scene(glm::vec3(-0.5f * (float)TREE_SCALE), (float)TREE_SCALE) };
|
||||
// render::EnginePointer _renderEngine{ new render::RenderEngine() };
|
||||
// gpu::ContextPointer _gpuContext; // initialized during window creation
|
||||
|
||||
GameWorkload _gameWorkload;
|
||||
|
||||
GraphicsEngine _graphicsEngine;
|
||||
|
@ -769,12 +755,8 @@ private:
|
|||
|
||||
QUrl _avatarOverrideUrl;
|
||||
bool _saveAvatarOverrideUrl { false };
|
||||
// QObject* _renderEventHandler{ nullptr };
|
||||
|
||||
// friend class RenderEventHandler;
|
||||
|
||||
std::atomic<bool> _pendingIdleEvent { true };
|
||||
// std::atomic<bool> _pendingRenderEvent { true };
|
||||
|
||||
bool quitWhenFinished { false };
|
||||
|
||||
|
|
|
@ -127,12 +127,7 @@ static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SI
|
|||
|
||||
bool GraphicsEngine::shouldPaint() const {
|
||||
|
||||
// if (_aboutToQuit || _window->isMinimized()) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
|
||||
auto displayPlugin = qApp->getActiveDisplayPlugin();
|
||||
auto displayPlugin = qApp->getActiveDisplayPlugin();
|
||||
|
||||
#ifdef DEBUG_PAINT_DELAY
|
||||
static uint64_t paintDelaySamples{ 0 };
|
||||
|
@ -148,15 +143,14 @@ bool GraphicsEngine::shouldPaint() const {
|
|||
}
|
||||
#endif
|
||||
|
||||
// Throttle if requested
|
||||
//if (displayPlugin->isThrottled() && (_graphicsEngine._renderEventHandler->_lastTimeRendered.elapsed() < THROTTLED_SIM_FRAME_PERIOD_MS)) {
|
||||
if ( displayPlugin->isThrottled() &&
|
||||
(static_cast<RenderEventHandler*>(_renderEventHandler)->_lastTimeRendered.elapsed() < THROTTLED_SIM_FRAME_PERIOD_MS)) {
|
||||
return false;
|
||||
}
|
||||
// Throttle if requested
|
||||
//if (displayPlugin->isThrottled() && (_graphicsEngine._renderEventHandler->_lastTimeRendered.elapsed() < THROTTLED_SIM_FRAME_PERIOD_MS)) {
|
||||
if ( displayPlugin->isThrottled() &&
|
||||
(static_cast<RenderEventHandler*>(_renderEventHandler)->_lastTimeRendered.elapsed() < THROTTLED_SIM_FRAME_PERIOD_MS)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GraphicsEngine::checkPendingRenderEvent() {
|
||||
|
@ -170,17 +164,11 @@ void GraphicsEngine::render_performFrame() {
|
|||
// Some plugins process message events, allowing paintGL to be called reentrantly.
|
||||
|
||||
_renderFrameCount++;
|
||||
// SG: Moved into the RenderEventHandler
|
||||
//_lastTimeRendered.start();
|
||||
|
||||
auto lastPaintBegin = usecTimestampNow();
|
||||
PROFILE_RANGE_EX(render, __FUNCTION__, 0xff0000ff, (uint64_t)_renderFrameCount);
|
||||
PerformanceTimer perfTimer("paintGL");
|
||||
|
||||
/* if (nullptr == _displayPlugin) {
|
||||
return;
|
||||
}*/
|
||||
|
||||
DisplayPluginPointer displayPlugin;
|
||||
{
|
||||
PROFILE_RANGE(render, "/getActiveDisplayPlugin");
|
||||
|
@ -310,5 +298,4 @@ void GraphicsEngine::render_performFrame() {
|
|||
void GraphicsEngine::editRenderArgs(RenderArgsEditor editor) {
|
||||
QMutexLocker renderLocker(&_renderArgsMutex);
|
||||
editor(_appRenderArgs);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
#include <render/Engine.h>
|
||||
|
||||
#include "RenderThread.h"
|
||||
|
||||
#include <OctreeConstants.h>
|
||||
#include <shared/RateCounter.h>
|
||||
|
||||
|
@ -53,8 +51,6 @@ public:
|
|||
render::EnginePointer getRenderEngine() const { return _renderEngine; }
|
||||
gpu::ContextPointer getGPUContext() const { return _gpuContext; }
|
||||
|
||||
FrameQueuePointer getFrameQueue() const { return _frameQueue; }
|
||||
|
||||
// Same as the one in application
|
||||
bool shouldPaint() const;
|
||||
bool checkPendingRenderEvent();
|
||||
|
@ -83,8 +79,6 @@ protected:
|
|||
|
||||
gpu::ContextPointer _gpuContext; // initialized during window creation
|
||||
|
||||
FrameQueuePointer _frameQueue{ new FrameQueue() };
|
||||
|
||||
QObject* _renderEventHandler{ nullptr };
|
||||
friend class RenderEventHandler;
|
||||
|
||||
|
|
|
@ -19,13 +19,9 @@ RenderEventHandler::RenderEventHandler(CheckCall checkCall, RenderCall renderCal
|
|||
_checkCall(checkCall),
|
||||
_renderCall(renderCall)
|
||||
{
|
||||
// Deleting the object with automatically shutdown the thread
|
||||
// connect(qApp, &QCoreApplication::aboutToQuit, this, &QObject::deleteLater);
|
||||
|
||||
// Transfer to a new thread
|
||||
moveToNewNamedThread(this, "RenderThread", [this](QThread* renderThread) {
|
||||
hifi::qt::addBlockingForbiddenThread("Render", renderThread);
|
||||
//_renderContext->moveToThreadWithContext(renderThread);
|
||||
_lastTimeRendered.start();
|
||||
}, std::bind(&RenderEventHandler::initialize, this), QThread::HighestPriority);
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#include "RenderThread.h"
|
|
@ -1,108 +0,0 @@
|
|||
#ifndef PRODUCERCONSUMERPIPE_H
|
||||
#define PRODUCERCONSUMERPIPE_H
|
||||
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <memory>
|
||||
|
||||
// Producer is blocked if the consumer doesn't consume enough
|
||||
// Consumer reads same value if producer doesn't produce enough
|
||||
template <class T>
|
||||
class ProducerConsumerPipe {
|
||||
public:
|
||||
|
||||
ProducerConsumerPipe();
|
||||
ProducerConsumerPipe(const T& initValue);
|
||||
|
||||
const T& read();
|
||||
void read(T& value, const T& resetValue);
|
||||
void write(const T& value);
|
||||
bool isWritePossible();
|
||||
|
||||
private:
|
||||
|
||||
short _readIndex;
|
||||
short _writeIndex;
|
||||
std::array<T, 3> _values;
|
||||
std::array<std::atomic_flag, 3> _used;
|
||||
|
||||
void initialize();
|
||||
void updateReadIndex();
|
||||
};
|
||||
|
||||
template <class T>
|
||||
ProducerConsumerPipe<T>::ProducerConsumerPipe() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
ProducerConsumerPipe<T>::ProducerConsumerPipe(const T& initValue) {
|
||||
_values.fill(initValue);
|
||||
initialize();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void ProducerConsumerPipe<T>::initialize() {
|
||||
_readIndex = 0;
|
||||
_writeIndex = 2;
|
||||
_used[_readIndex].test_and_set(std::memory_order_acquire);
|
||||
_used[_writeIndex].test_and_set(std::memory_order_acquire);
|
||||
_used[1].clear();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void ProducerConsumerPipe<T>::updateReadIndex() {
|
||||
int nextReadIndex = (_readIndex + 1) % _values.size();
|
||||
|
||||
if (!_used[nextReadIndex].test_and_set(std::memory_order_acquire)) {
|
||||
int readIndex = _readIndex;
|
||||
_used[readIndex].clear(std::memory_order_release);
|
||||
_readIndex = nextReadIndex;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const T& ProducerConsumerPipe<T>::read() {
|
||||
updateReadIndex();
|
||||
return _values[_readIndex];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void ProducerConsumerPipe<T>::read(T& value, const T& resetValue) {
|
||||
updateReadIndex();
|
||||
value = _values[_readIndex];
|
||||
_values[_readIndex] = resetValue;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool ProducerConsumerPipe<T>::isWritePossible() {
|
||||
int nextWriteIndex = (_writeIndex + 1) % _values.size();
|
||||
return (_used[nextWriteIndex].test_and_set(std::memory_order_acquire));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void ProducerConsumerPipe<T>::write(const T& value) {
|
||||
int nextWriteIndex = (_writeIndex + 1) % _values.size();
|
||||
int writeIndex = _writeIndex;
|
||||
|
||||
_values[writeIndex] = value;
|
||||
|
||||
while (_used[nextWriteIndex].test_and_set(std::memory_order_acquire)) {
|
||||
// spin
|
||||
std::this_thread::yield();
|
||||
}
|
||||
_used[writeIndex].clear(std::memory_order_release);
|
||||
_writeIndex = nextWriteIndex;
|
||||
}
|
||||
|
||||
|
||||
#include <gpu/Frame.h>
|
||||
|
||||
using FrameQueue = ProducerConsumerPipe<gpu::FramePointer>;
|
||||
|
||||
using FrameQueuePointer = std::shared_ptr<FrameQueue>;
|
||||
|
||||
|
||||
#endif
|
|
@ -55,8 +55,6 @@ ApplicationOverlay::~ApplicationOverlay() {
|
|||
// Renders the overlays either to a texture or to the screen
|
||||
void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) {
|
||||
PROFILE_RANGE(render, __FUNCTION__);
|
||||
// PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
|
||||
|
||||
buildFramebufferObject();
|
||||
|
||||
if (!_overlayFramebuffer) {
|
||||
|
|
|
@ -165,11 +165,11 @@ static const uint32_t MIN_THROTTLE_CHECK_FRAMES = 60;
|
|||
bool Basic2DWindowOpenGLDisplayPlugin::isThrottled() const {
|
||||
static auto lastCheck = presentCount();
|
||||
// Don't access the menu API every single frame
|
||||
// if ((presentCount() - lastCheck) > MIN_THROTTLE_CHECK_FRAMES) {
|
||||
if ((presentCount() - lastCheck) > MIN_THROTTLE_CHECK_FRAMES) {
|
||||
static const QString ThrottleFPSIfNotFocus = "Throttle FPS If Not Focus"; // FIXME - this value duplicated in Menu.h
|
||||
_isThrottled = (!_container->isForeground() && _container->isOptionChecked(ThrottleFPSIfNotFocus));
|
||||
// lastCheck = presentCount();
|
||||
// }
|
||||
lastCheck = presentCount();
|
||||
}
|
||||
|
||||
return _isThrottled;
|
||||
}
|
||||
|
|
|
@ -172,16 +172,7 @@ public:
|
|||
// If there's no active plugin, just sleep
|
||||
if (currentPlugin == nullptr) {
|
||||
// Minimum sleep ends up being about 2 ms anyway
|
||||
QThread::msleep(16);
|
||||
continue;
|
||||
}
|
||||
|
||||
static uint _vsyncLoopIndex = 0;
|
||||
_vsyncLoopIndex++;
|
||||
|
||||
if (currentPlugin->isThrottled() && (_vsyncLoopIndex % 8)) {
|
||||
// Minimum sleep ends up being about 2 ms anyway
|
||||
QThread::msleep(16);
|
||||
QThread::msleep(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -163,24 +163,6 @@ Buffer::Size Buffer::getSize() const {
|
|||
|
||||
const Element BufferView::DEFAULT_ELEMENT = Element( gpu::SCALAR, gpu::UINT8, gpu::RAW );
|
||||
|
||||
BufferView::BufferView(const BufferView& view) :
|
||||
_buffer(view._buffer),
|
||||
_offset(view._offset),
|
||||
_size(view._size),
|
||||
_element(view._element),
|
||||
_stride(view._stride)
|
||||
{}
|
||||
|
||||
BufferView& BufferView::operator=(const BufferView& view) {
|
||||
_buffer = (view._buffer);
|
||||
_offset = (view._offset);
|
||||
_size = (view._size);
|
||||
_element = (view._element);
|
||||
_stride = (view._stride);
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
BufferView::BufferView() :
|
||||
BufferView(DEFAULT_ELEMENT) {}
|
||||
|
||||
|
|
|
@ -183,8 +183,8 @@ public:
|
|||
Element _element { DEFAULT_ELEMENT };
|
||||
uint16 _stride { 0 };
|
||||
|
||||
BufferView(const BufferView& view);
|
||||
BufferView& operator=(const BufferView& view);
|
||||
BufferView(const BufferView& view) = default;
|
||||
BufferView& operator=(const BufferView& view) = default;
|
||||
|
||||
BufferView();
|
||||
BufferView(const Element& element);
|
||||
|
|
|
@ -1,155 +0,0 @@
|
|||
//
|
||||
// Global lighting.js
|
||||
//
|
||||
// Sam Gateau, created on 6/7/2018.
|
||||
// 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
|
||||
//
|
||||
var createdOverlays = [];
|
||||
var overlayFrames = {};
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
for (var i = 0; i < createdOverlays.length; i++) {
|
||||
Overlays.deleteOverlay(createdOverlays[i]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var DIM = {x: 0.1, y: 0.13, z: 0.1};
|
||||
var avatarHeadJoint = MyAvatar.getJointIndex("Head");
|
||||
|
||||
function createOrb(i) {
|
||||
|
||||
var props = {
|
||||
dimensions: DIM,
|
||||
}
|
||||
|
||||
props["url"] = "https://github.com/highfidelity/hifi_tests/blob/master/assets/models/material_matrix_models/fbx/blender/hifi_metallicV_albedoV_ao.fbx?raw=true"
|
||||
props["position"] = getCamePos(i)
|
||||
// props["localPosition"] = { x: 0.4 * i, y: 0, z: 0}
|
||||
props["rotation"] = getCameOri()
|
||||
|
||||
if (createdOverlays.length > 0) {
|
||||
props["parentID"] = createdOverlays[0]
|
||||
|
||||
}
|
||||
|
||||
var oID = Overlays.addOverlay("model", props);
|
||||
|
||||
/* {
|
||||
position: getCamePos(),
|
||||
// position: MyAvatar.getJointPosition(avatarHeadJoint),
|
||||
// localPosition: {x: 0, y: 1, z: 0},
|
||||
// localRotation: {x: 0, y: 0, z: 0, w:1},
|
||||
url: "https://github.com/highfidelity/hifi_tests/blob/master/assets/models/material_matrix_models/fbx/blender/hifi_metallicV_albedoV_ao.fbx?raw=true",
|
||||
dimensions: DIM,
|
||||
// parentID: MyAvatar.SELF_ID,
|
||||
// parentJointIndex: avatarHeadJoint,
|
||||
})*/
|
||||
|
||||
overlayFrames[oID] = { position: getCamePos(), rotation: getCameOri() }
|
||||
|
||||
// Overlays.editOverlay(oID, overlayFrames[oID])
|
||||
|
||||
props = Overlays.getProperties(oID, ["position", "rotation"])
|
||||
print("createOrb" + oID + JSON.stringify(props))
|
||||
|
||||
return oID;
|
||||
}
|
||||
|
||||
|
||||
function createSnap(i) {
|
||||
|
||||
var props = {
|
||||
// dimensions: DIM,
|
||||
// url: "resource://spectatorCameraFrame",
|
||||
emissive: true,
|
||||
url: "https://hifi-public.s3.amazonaws.com/sam/2018-oct/code/PackagedApp/asset/CarrotHunt.png",
|
||||
dimensions: DIM,
|
||||
// parentID: MyAvatar.SELF_ID,
|
||||
// parentJointIndex: avatarHeadJoint,
|
||||
alpha: 1,
|
||||
// localRotation: { w: 1, x: 0, y: 0, z: 0 },
|
||||
// localPosition: { x: 0, y: 0.0, z: -1.0 },
|
||||
dimensions: DIM
|
||||
}
|
||||
|
||||
// props["url"] = "https://github.com/highfidelity/hifi_tests/blob/master/assets/models/material_matrix_models/fbx/blender/hifi_metallicV_albedoV_ao.fbx?raw=true"
|
||||
props["position"] = getCamePos(i)
|
||||
// props["localPosition"] = { x: 0.4 * i, y: 0, z: 0}
|
||||
props["rotation"] = getCameOri()
|
||||
|
||||
if (createdOverlays.length > 0) {
|
||||
props["parentID"] = createdOverlays[0]
|
||||
|
||||
}
|
||||
|
||||
var oID = Overlays.addOverlay("image3d", props);
|
||||
|
||||
/* {
|
||||
position: getCamePos(),
|
||||
// position: MyAvatar.getJointPosition(avatarHeadJoint),
|
||||
// localPosition: {x: 0, y: 1, z: 0},
|
||||
// localRotation: {x: 0, y: 0, z: 0, w:1},
|
||||
url: "https://github.com/highfidelity/hifi_tests/blob/master/assets/models/material_matrix_models/fbx/blender/hifi_metallicV_albedoV_ao.fbx?raw=true",
|
||||
dimensions: DIM,
|
||||
// parentID: MyAvatar.SELF_ID,
|
||||
// parentJointIndex: avatarHeadJoint,
|
||||
})*/
|
||||
|
||||
overlayFrames[oID] = { position: getCamePos(), rotation: getCameOri() }
|
||||
|
||||
// Overlays.editOverlay(oID, overlayFrames[oID])
|
||||
|
||||
props = Overlays.getProperties(oID, ["position", "rotation"])
|
||||
print("createOrb" + oID + JSON.stringify(props))
|
||||
|
||||
return oID;
|
||||
}
|
||||
|
||||
function createOrbs() {
|
||||
print("createOrbs")
|
||||
|
||||
createdOverlays.push(createOrb(0));
|
||||
createdOverlays.push(createOrb(1));
|
||||
createdOverlays.push(createSnap(2));
|
||||
|
||||
}
|
||||
|
||||
var camSpace = {}
|
||||
|
||||
function updateCamSpace() {
|
||||
camSpace["pos"] = Camera.Position;
|
||||
camSpace["ori"] = Camera.orientation;
|
||||
camSpace["X"] = Vec3.multiply(Quat.getRight(Camera.orientation), Camera.frustum.aspectRatio);
|
||||
camSpace["Y"] = Quat.getUp(Camera.orientation);
|
||||
camSpace["Z"] = Vec3.multiply(Quat.getForward(), -1);
|
||||
}
|
||||
|
||||
function getCamePos(i) {
|
||||
|
||||
return Vec3.sum(Camera.position, Vec3.multiplyQbyV(Camera.orientation, { x: -0.5 + 0.2 * i, y: -0.3, z: -1 }))
|
||||
// return Vec3.add(Camera.position, {x: i * 0.3, y:0, z:1}
|
||||
}
|
||||
function getCameOri() {
|
||||
return Camera.orientation
|
||||
}
|
||||
function updateFrames() {
|
||||
for (var i = 0; i < createdOverlays.length; i++) {
|
||||
overlayFrames[createdOverlays[i]] = { position: getCamePos(i), rotation: getCameOri() }
|
||||
}
|
||||
Overlays.editOverlays(overlayFrames)
|
||||
|
||||
}
|
||||
|
||||
|
||||
createOrbs()
|
||||
|
||||
var accumulated = 0;
|
||||
Script.update.connect(function(deltaTime) {
|
||||
accumulated += deltaTime;
|
||||
if (accumulated > 1)
|
||||
updateFrames()
|
||||
});
|
|
@ -1,71 +0,0 @@
|
|||
/*function openEngineTaskView() {
|
||||
// Set up the qml ui
|
||||
var qml = Script.resolvePath('engineInspector.qml');
|
||||
var window = new OverlayWindow({
|
||||
title: 'Render Engine',
|
||||
source: qml,
|
||||
width: 500,
|
||||
height: 100
|
||||
});
|
||||
window.setPosition(200, 50);
|
||||
window.closed.connect(function() { Script.stop(); });
|
||||
}
|
||||
openEngineTaskView();*/
|
||||
|
||||
(function() {
|
||||
var TABLET_BUTTON_NAME = "Inspector";
|
||||
var QMLAPP_URL = Script.resolvePath("./engineInspector.qml");
|
||||
var ICON_URL = Script.resolvePath("../../../system/assets/images/luci-i.svg");
|
||||
var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/luci-a.svg");
|
||||
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
var button = tablet.addButton({
|
||||
text: TABLET_BUTTON_NAME,
|
||||
icon: ICON_URL,
|
||||
activeIcon: ACTIVE_ICON_URL
|
||||
});
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
killWindow()
|
||||
button.clicked.disconnect(onClicked);
|
||||
tablet.removeButton(button);
|
||||
});
|
||||
|
||||
button.clicked.connect(onClicked);
|
||||
|
||||
var onScreen = false;
|
||||
var window;
|
||||
|
||||
function onClicked() {
|
||||
if (onScreen) {
|
||||
killWindow()
|
||||
} else {
|
||||
createWindow()
|
||||
}
|
||||
}
|
||||
|
||||
function createWindow() {
|
||||
var qml = Script.resolvePath(QMLAPP_URL);
|
||||
window = new OverlayWindow({
|
||||
title: 'Render Engine Inspector',
|
||||
source: qml,
|
||||
width: 250,
|
||||
height: 500
|
||||
});
|
||||
window.setPosition(200, 50);
|
||||
window.closed.connect(killWindow);
|
||||
onScreen = true
|
||||
button.editProperties({isActive: true});
|
||||
}
|
||||
|
||||
function killWindow() {
|
||||
if (window !== undefined) {
|
||||
window.closed.disconnect(killWindow);
|
||||
window.close()
|
||||
window = undefined
|
||||
}
|
||||
onScreen = false
|
||||
button.editProperties({isActive: false})
|
||||
}
|
||||
}());
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
//
|
||||
// EngineInspector.qml
|
||||
//
|
||||
// Created by Sam Gateau on 06/07/2018
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import stylesUit 1.0
|
||||
import controlsUit 1.0 as HifiControls
|
||||
|
||||
import "../lib/jet/qml" as Jet
|
||||
|
||||
Item {
|
||||
HifiConstants { id: hifi;}
|
||||
id: root;
|
||||
anchors.fill: parent
|
||||
|
||||
property var rootConfig: Render.getConfig("")
|
||||
|
||||
Jet.TaskListView {
|
||||
rootConfig: root.rootConfig
|
||||
anchors.fill: root
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
|
||||
|
||||
(function() {
|
||||
var TABLET_BUTTON_NAME = "Profiler";
|
||||
var QMLAPP_URL = Script.resolvePath("./engineProfiler.qml");
|
||||
var ICON_URL = Script.resolvePath("../../../system/assets/images/luci-i.svg");
|
||||
var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/luci-a.svg");
|
||||
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
var button = tablet.addButton({
|
||||
text: TABLET_BUTTON_NAME,
|
||||
icon: ICON_URL,
|
||||
activeIcon: ACTIVE_ICON_URL
|
||||
});
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
killWindow()
|
||||
button.clicked.disconnect(onClicked);
|
||||
tablet.removeButton(button);
|
||||
});
|
||||
|
||||
button.clicked.connect(onClicked);
|
||||
|
||||
var onScreen = false;
|
||||
var window;
|
||||
|
||||
function onClicked() {
|
||||
if (onScreen) {
|
||||
killWindow()
|
||||
} else {
|
||||
createWindow()
|
||||
}
|
||||
}
|
||||
|
||||
function createWindow() {
|
||||
var qml = Script.resolvePath(QMLAPP_URL);
|
||||
window = Desktop.createWindow(Script.resolvePath(QMLAPP_URL), {
|
||||
title: 'Render Engine Profiler',
|
||||
flags: Desktop.ALWAYS_ON_TOP,
|
||||
presentationMode: Desktop.PresentationMode.NATIVE,
|
||||
size: {x: 500, y: 100}
|
||||
});
|
||||
window.setPosition(200, 50);
|
||||
window.closed.connect(killWindow);
|
||||
onScreen = true
|
||||
button.editProperties({isActive: true});
|
||||
}
|
||||
|
||||
function killWindow() {
|
||||
if (window !== undefined) {
|
||||
window.closed.disconnect(killWindow);
|
||||
window.close()
|
||||
window = undefined
|
||||
}
|
||||
onScreen = false
|
||||
button.editProperties({isActive: false})
|
||||
}
|
||||
}());
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
//
|
||||
// EngineProfiler.qml
|
||||
//
|
||||
// Created by Sam Gateau on 06/07/2018
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import "qrc:///qml/styles-uit"
|
||||
import "qrc:///qml/controls-uit" as HifiControls
|
||||
|
||||
import "../lib/jet/qml" as Jet
|
||||
|
||||
Item {
|
||||
HifiConstants { id: hifi;}
|
||||
id: root;
|
||||
anchors.fill: parent
|
||||
|
||||
property var rootConfig: Render.getConfig("")
|
||||
|
||||
|
||||
Jet.TaskTimeFrameView {
|
||||
rootConfig: root.rootConfig
|
||||
anchors.fill: root
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue