Merge branch 'master' of github.com:highfidelity/hifi into SUI/fixLasers

This commit is contained in:
Zach Fox 2019-06-20 09:45:49 -07:00
commit d49205be74
80 changed files with 662 additions and 444 deletions

View file

@ -127,7 +127,8 @@ void DomainGatekeeper::processConnectRequestPacket(QSharedPointer<ReceivedMessag
<< "and machine fingerprint" << nodeConnection.machineFingerprint
<< "user" << username
<< "reason" << QString(nodeConnection.connectReason ? "SilentDomainDisconnect" : "Connect")
<< "previous connection uptime" << nodeConnection.previousConnectionUpTime/USECS_PER_MSEC << "msec";
<< "previous connection uptime" << nodeConnection.previousConnectionUpTime/USECS_PER_MSEC << "msec"
<< "sysinfo" << nodeConnection.SystemInfo;
// signal that we just connected a node so the DomainServer can get it a list
// and broadcast its presence right away

View file

@ -739,6 +739,10 @@ void DomainServer::setupNodeListAndAssignments() {
connect(nodeList.data(), &LimitedNodeList::nodeAdded, this, &DomainServer::nodeAdded);
connect(nodeList.data(), &LimitedNodeList::nodeKilled, this, &DomainServer::nodeKilled);
connect(nodeList.data(), &LimitedNodeList::localSockAddrChanged, this,
[this](const HifiSockAddr& localSockAddr) {
DependencyManager::get<LimitedNodeList>()->putLocalPortIntoSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, this, localSockAddr.getPort());
});
// register as the packet receiver for the types we want
PacketReceiver& packetReceiver = nodeList->getPacketReceiver();

View file

@ -36,6 +36,9 @@ NodeConnectionData NodeConnectionData::fromDataStream(QDataStream& dataStream, c
// now the machine fingerprint
dataStream >> newHeader.machineFingerprint;
// and the operating system type
dataStream >> newHeader.SystemInfo;
dataStream >> newHeader.connectReason;
dataStream >> newHeader.previousConnectionUpTime;

View file

@ -31,9 +31,9 @@ public:
QString placeName;
QString hardwareAddress;
QUuid machineFingerprint;
QString SystemInfo;
quint32 connectReason;
quint64 previousConnectionUpTime;
QByteArray protocolVersion;
};

View file

@ -0,0 +1,25 @@
module controls
Button 1.0 Button.qml
ButtonAwesome 1.0 ButtonAwesome.qml
CheckBox 1.0 CheckBox.qml
ComboBox 1.0 ComboBox.qml
FlickableWebViewCore 1.0 FlickableWebViewCore.qml
FontAwesome 1.0 FontAwesome.qml
Player 1.0 Player.qml
RadioButton 1.0 RadioButton.qml
Slider 1.0 Slider.qml
Spacer 1.0 Spacer.qml
SpinBox 1.0 SpinBox.qml
TabletWebButton 1.0 TabletWebButton.qml
TabletWebScreen 1.0 TabletWebScreen.qml
TabletWebView 1.0 TabletWebView.qml
Text 1.0 Text.qml
TextAndSlider 1.0 TextAndSlider.qml
TextAndSpinBox 1.0 TextAndSpinBox.qml
TextArea 1.0 TextArea.qml
TextEdit 1.0 TextEdit.qml
TextField 1.0 TextField.qml
TextHeader 1.0 TextHeader.qml
TextInput 1.0 TextInput.qml
TextInputAndButton 1.0 TextInputAndButton.qml
WebView 1.0 WebView.qml

View file

@ -0,0 +1,18 @@
module dialogs
AboutDialog 1.0 AboutDialog.qml
AdvancedPreferencesDialog 1.0 AdvancedPreferencesDialog.qml
AudioBuffers 1.0 AudioBuffers.qml
AvatarPreferencesDialog 1.0 AvatarPreferencesDialog.qml
GeneralPreferencesDialog 1.0 GeneralPreferencesDialog.qml
LodPreferencesDialog 1.0 LodPreferencesDialog.qml
ModelBrowserDialog 1.0 ModelBrowserDialog.qml
NetworkingPreferencesDialog 1.0 NetworkingPreferencesDialog.qml
RunningScripts 1.0 RunningScripts.qml
TabletAboutDialog 1.0 TabletAboutDialog.qml
TabletAssetServer 1.0 TabletAssetServer.qml
TabletDCDialog 1.0 TabletDCDialog.qml
TabletDebugWindow 1.0 TabletDebugWindow.qml
TabletEntityStatistics 1.0 TabletEntityStatistics.qml
TabletEntityStatisticsItem 1.0 TabletEntityStatisticsItem.qml
TabletLODTools 1.0 TabletLODTools.qml
TabletRunningScripts 1.0 TabletRunningScripts.qml

View file

@ -0,0 +1,4 @@
module toolbars
StateImage 1.0 StateImage.qml
Toolbar 1.0 Toolbar.qml
ToolbarButton 1.0 ToolbarButton.qml

View file

@ -267,7 +267,7 @@ class MyAvatar : public Avatar {
* @property {number} analogPlusWalkSpeed - The walk speed of your avatar for the "AnalogPlus" control scheme.
* <p><strong>Warning:</strong> Setting this value also sets the value of <code>analogPlusSprintSpeed</code> to twice
* the value.</p>
* @property {number} analogPlusSprintSpeed - The sprint speed of your avatar for the "AnalogPlus" control scheme.
* @property {number} analogPlusSprintSpeed - The sprint (run) speed of your avatar for the "AnalogPlus" control scheme.
* @property {MyAvatar.SitStandModelType} userRecenterModel - Controls avatar leaning and recentering behavior.
* @property {number} isInSittingState - <code>true</code> if your avatar is sitting (avatar leaning is disabled,
* recenntering is enabled), <code>false</code> if it is standing (avatar leaning is enabled, and avatar recenters if it
@ -2198,33 +2198,35 @@ signals:
void audioListenerModeChanged();
/**jsdoc
* Notifies when the analogPlusWalkSpeed value is changed.
* Triggered when the walk speed set for the "AnalogPlus" control scheme changes.
* @function MyAvatar.analogPlusWalkSpeedChanged
* @param {float} value - the new avatar walk speed
* @param {number} speed - The new walk speed set for the "AnalogPlus" control scheme.
* @returns {Signal}
*/
void analogPlusWalkSpeedChanged(float value);
/**jsdoc
* Notifies when the analogPlusSprintSpeed value is changed.
* Triggered when the sprint (run) speed set for the "AnalogPlus" control scheme changes.
* @function MyAvatar.analogPlusSprintSpeedChanged
* @param {float} value - the new avatar sprint speed
* @param {number} speed - The new sprint speed set for the "AnalogPlus" control scheme.
* @returns {Signal}
*/
void analogPlusSprintSpeedChanged(float value);
/**jsdoc
* Notifies when the sprintSpeed value is changed.
* Triggered when the sprint (run) speed set for the current control scheme (see
* {@link MyAvatar.getControlScheme|getControlScheme}) changes.
* @function MyAvatar.sprintSpeedChanged
* @param {float} value - the new avatar sprint speed
* @param {number} speed -The new sprint speed set for the current control scheme.
* @returns {Signal}
*/
void sprintSpeedChanged(float value);
/**jsdoc
* Notifies when the walkBackwardSpeed value is changed.
* Triggered when the walk backward speed set for the current control scheme (see
* {@link MyAvatar.getControlScheme|getControlScheme}) changes.
* @function MyAvatar.walkBackwardSpeedChanged
* @param {float} value - the new avatar walk backward speed
* @param {number} speed - The new walk backward speed set for the current control scheme.
* @returns {Signal}
*/
void walkBackwardSpeedChanged(float value);

View file

@ -192,7 +192,7 @@ QString PlatformInfoScriptingInterface::getDisplay(int index) {
}
QString PlatformInfoScriptingInterface::getMemory() {
auto desc = platform::getMemory(0);
auto desc = platform::getMemory();
return QString(desc.dump().c_str());
}
@ -201,6 +201,10 @@ QString PlatformInfoScriptingInterface::getComputer() {
return QString(desc.dump().c_str());
}
QString PlatformInfoScriptingInterface::getPlatform() {
auto desc = platform::getAll();
return QString(desc.dump().c_str());
}
PlatformInfoScriptingInterface::PlatformTier PlatformInfoScriptingInterface::getTierProfiled() {
return (PlatformInfoScriptingInterface::PlatformTier) platform::Profiler::profilePlatform();

View file

@ -51,6 +51,8 @@ public slots:
* Gets the operating system type.
* @function PlatformInfo.getOperatingSystemType
* @returns {string} <code>"WINDOWS"</code>, <code>"MACOS"</code>, or <code>"UNKNOWN"</code>.
* @deprecated This function is deprecated and will be removed.
* use getComputer()["OS"] instead
*/
QString getOperatingSystemType();
@ -61,6 +63,10 @@ public slots:
* @example <caption>Report the CPU being used.</caption>
* print("CPU: " + PlatformInfo.getCPUBrand());
* // Example: Intel(R) Core(TM) i7-7820HK CPU @ 2.90GHz
* @deprecated This function is deprecated and will be removed.
* use getNumCPUs() to know the number of CPUs in the hardware, at least one is expected
* use getCPU(0)["vendor"] to get the brand of the vendor
* use getCPU(0)["model"] to get the model name of the cpu
*/
QString getCPUBrand();
@ -68,6 +74,8 @@ public slots:
* Gets the number of logical CPU cores.
* @function PlatformInfo.getNumLogicalCores
* @returns {number} The number of logical CPU cores.
* @deprecated This function is deprecated and will be removed.
* use getCPU(0)["numCores"] instead
*/
unsigned int getNumLogicalCores();
@ -75,6 +83,8 @@ public slots:
* Returns the total system memory in megabytes.
* @function PlatformInfo.getTotalSystemMemoryMB
* @returns {number} The total system memory in megabytes.
* @deprecated This function is deprecated and will be removed.
* use getMemory()["memTotal"] instead
*/
int getTotalSystemMemoryMB();
@ -82,6 +92,10 @@ public slots:
* Gets the graphics card type.
* @function PlatformInfo.getGraphicsCardType
* @returns {string} The graphics card type.
* @deprecated This function is deprecated and will be removed.
* use getNumGPUs() to know the number of GPUs in the hardware, at least one is expected
* use getGPU(0)["vendor"] to get the brand of the vendor
* use getGPU(0)["model"] to get the model name of the gpu
*/
QString getGraphicsCardType();
@ -141,7 +155,7 @@ public slots:
/**jsdoc
* Get the description of the GPU at the index parameter
* expected fields are:
* - gpuVendor...
* - vendor, model...
* @param index The index of the GPU of the platform
* @function PlatformInfo.getGPU
* @returns {string} The GPU description json field
@ -183,6 +197,14 @@ public slots:
*/
QString getComputer();
/**jsdoc
* Get the complete description of the Platform as an aggregated Json
* The expected object description is:
* { "computer": {...}, "memory": {...}, "cpus": [{...}, ...], "gpus": [{...}, ...], "displays": [{...}, ...] }
* @function PlatformInfo.getPlatform
* @returns {string} The Platform description json field
*/
QString getPlatform();
/**jsdoc
* Get the Platform TIer profiled on startup of the Computer

View file

@ -109,6 +109,23 @@ bool Basic2DWindowOpenGLDisplayPlugin::internalActivate() {
return Parent::internalActivate();
}
gpu::PipelinePointer Basic2DWindowOpenGLDisplayPlugin::getCompositeScenePipeline() {
#if defined(Q_OS_ANDROID)
return _linearToSRGBPipeline;
#else
return _SRGBToLinearPipeline;
#endif
}
gpu::Element Basic2DWindowOpenGLDisplayPlugin::getCompositeFBColorSpace() {
#if defined(Q_OS_ANDROID)
return gpu::Element::COLOR_SRGBA_32;
#else
return gpu::Element::COLOR_RGBA_32;
#endif
}
void Basic2DWindowOpenGLDisplayPlugin::compositeExtra() {
#if defined(Q_OS_ANDROID)
auto& virtualPadManager = VirtualPad::Manager::instance();

View file

@ -37,6 +37,9 @@ public:
virtual void pluginUpdate() override {};
virtual gpu::PipelinePointer getCompositeScenePipeline() override;
virtual gpu::Element getCompositeFBColorSpace() override;
protected:
mutable bool _isThrottled = false;

View file

@ -48,12 +48,16 @@
#include "CompositorHelper.h"
#include "Logging.h"
#include "RefreshRateController.h"
using namespace shader::gpu::program;
extern QThread* RENDER_THREAD;
class PresentThread : public QThread, public Dependency {
using Mutex = std::mutex;
using Condition = std::condition_variable;
using Lock = std::unique_lock<Mutex>;
public:
PresentThread() {
@ -380,57 +384,45 @@ void OpenGLDisplayPlugin::customizeContext() {
}
}
if (!_presentPipeline) {
if (!_drawTexturePipeline) {
gpu::StatePointer blendState = gpu::StatePointer(new gpu::State());
blendState->setDepthTest(gpu::State::DepthTest(false));
blendState->setBlendFunction(true,
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD,
gpu::State::INV_SRC_ALPHA,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD,
gpu::State::ONE);
gpu::StatePointer scissorState = gpu::StatePointer(new gpu::State());
scissorState->setDepthTest(gpu::State::DepthTest(false));
scissorState->setScissorEnable(true);
{
#ifdef Q_OS_ANDROID
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::gpu::program::DrawTextureGammaLinearToSRGB);
#else
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::gpu::program::DrawTexture);
#endif
_simplePipeline = gpu::Pipeline::create(program, scissorState);
}
{
#ifdef Q_OS_ANDROID
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::gpu::program::DrawTextureGammaLinearToSRGB);
#else
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::gpu::program::DrawTextureGammaSRGBToLinear);
#endif
_presentPipeline = gpu::Pipeline::create(program, scissorState);
}
_drawTexturePipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTexture), scissorState);
{
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::gpu::program::DrawTexture);
_hudPipeline = gpu::Pipeline::create(program, blendState);
}
{
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::gpu::program::DrawTextureMirroredX);
_mirrorHUDPipeline = gpu::Pipeline::create(program, blendState);
}
_linearToSRGBPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTextureGammaLinearToSRGB), scissorState);
{
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::gpu::program::DrawTransformedTexture);
_cursorPipeline = gpu::Pipeline::create(program, blendState);
}
_SRGBToLinearPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTextureGammaSRGBToLinear), scissorState);
_hudPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTexture), blendState);
_mirrorHUDPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTextureMirroredX), blendState);
_cursorPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTransformedTexture), blendState);
}
updateCompositeFramebuffer();
}
void OpenGLDisplayPlugin::uncustomizeContext() {
_presentPipeline.reset();
_cursorPipeline.reset();
_drawTexturePipeline.reset();
_linearToSRGBPipeline.reset();
_SRGBToLinearPipeline.reset();
_hudPipeline.reset();
_mirrorHUDPipeline.reset();
_cursorPipeline.reset();
_compositeFramebuffer.reset();
withPresentThreadLock([&] {
_currentFrame.reset();
_lastFrame = nullptr;
@ -535,11 +527,9 @@ void OpenGLDisplayPlugin::renderFromTexture(gpu::Batch& batch, const gpu::Textur
batch.setStateScissorRect(scissor);
batch.setViewportTransform(viewport);
batch.setResourceTexture(0, texture);
#ifndef USE_GLES
batch.setPipeline(_presentPipeline);
#else
batch.setPipeline(_simplePipeline);
#endif
batch.setPipeline(_drawTexturePipeline);
batch.draw(gpu::TRIANGLE_STRIP, 4);
if (copyFbo) {
gpu::Vec4i copyFboRect(0, 0, copyFbo->getWidth(), copyFbo->getHeight());
@ -603,9 +593,10 @@ std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> OpenGL
hudEyeViewports[eye] = eyeViewport(eye);
});
return [=](gpu::Batch& batch, const gpu::TexturePointer& hudTexture, bool mirror) {
if (hudPipeline && hudTexture) {
auto pipeline = mirror ? hudMirrorPipeline : hudPipeline;
if (pipeline && hudTexture) {
batch.enableStereo(false);
batch.setPipeline(mirror ? hudMirrorPipeline : hudPipeline);
batch.setPipeline(pipeline);
batch.setResourceTexture(0, hudTexture);
if (hudStereo) {
for_each_eye([&](Eye eye) {
@ -644,6 +635,11 @@ void OpenGLDisplayPlugin::compositePointer() {
});
}
// Overridden by Basic2DWindowDisplayPlugin and OculusDisplayPlugin
gpu::PipelinePointer OpenGLDisplayPlugin::getCompositeScenePipeline() {
return _drawTexturePipeline;
}
void OpenGLDisplayPlugin::compositeScene() {
render([&](gpu::Batch& batch) {
batch.enableStereo(false);
@ -652,7 +648,7 @@ void OpenGLDisplayPlugin::compositeScene() {
batch.setStateScissorRect(ivec4(uvec2(), _compositeFramebuffer->getSize()));
batch.resetViewTransform();
batch.setProjectionTransform(mat4());
batch.setPipeline(_simplePipeline);
batch.setPipeline(getCompositeScenePipeline());
batch.setResourceTexture(0, _currentFrame->framebuffer->getRenderBuffer(0));
batch.draw(gpu::TRIANGLE_STRIP, 4);
});
@ -666,17 +662,6 @@ void OpenGLDisplayPlugin::compositeLayers() {
compositeScene();
}
#ifdef HIFI_ENABLE_NSIGHT_DEBUG
if (false) // do not draw the HUD if running nsight debug
#endif
{
PROFILE_RANGE_EX(render_detail, "handleHUDBatch", 0xff0077ff, (uint64_t)presentCount())
auto hudOperator = getHUDOperator();
withPresentThreadLock([&] {
_hudOperator = hudOperator;
});
}
{
PROFILE_RANGE_EX(render_detail, "compositeExtra", 0xff0077ff, (uint64_t)presentCount())
compositeExtra();
@ -924,11 +909,17 @@ void OpenGLDisplayPlugin::render(std::function<void(gpu::Batch& batch)> f) {
OpenGLDisplayPlugin::~OpenGLDisplayPlugin() {
}
// Added this to allow desktop composite framebuffer to be RGBA while mobile is SRGBA
// Overridden by Basic2DWindowDisplayPlugin
// FIXME: Eventually it would be ideal to have both framebuffers be of the same type
gpu::Element OpenGLDisplayPlugin::getCompositeFBColorSpace() {
return gpu::Element::COLOR_RGBA_32;
}
void OpenGLDisplayPlugin::updateCompositeFramebuffer() {
auto renderSize = glm::uvec2(getRecommendedRenderSize());
if (!_compositeFramebuffer || _compositeFramebuffer->getSize() != renderSize) {
_compositeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("OpenGLDisplayPlugin::composite", gpu::Element::COLOR_RGBA_32, renderSize.x, renderSize.y));
// _compositeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("OpenGLDisplayPlugin::composite", gpu::Element::COLOR_SRGBA_32, renderSize.x, renderSize.y));
_compositeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("OpenGLDisplayPlugin::composite", getCompositeFBColorSpace(), renderSize.x, renderSize.y));
}
}

View file

@ -86,6 +86,8 @@ public:
void copyTextureToQuickFramebuffer(NetworkTexturePointer source, QOpenGLFramebufferObject* target, GLsync* fenceSync) override;
virtual std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator() override;
protected:
friend class PresentThread;
@ -102,10 +104,12 @@ protected:
virtual QThread::Priority getPresentPriority() { return QThread::HighPriority; }
virtual void compositeLayers();
virtual void compositeScene();
virtual std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator();
virtual void compositePointer();
virtual void compositeExtra() {};
virtual gpu::PipelinePointer getCompositeScenePipeline();
virtual gpu::Element getCompositeFBColorSpace();
// These functions must only be called on the presentation thread
virtual void customizeContext();
virtual void uncustomizeContext();
@ -149,9 +153,11 @@ protected:
gpu::PipelinePointer _hudPipeline;
gpu::PipelinePointer _mirrorHUDPipeline;
gpu::ShaderPointer _mirrorHUDPS;
gpu::PipelinePointer _simplePipeline;
gpu::PipelinePointer _presentPipeline;
gpu::PipelinePointer _drawTexturePipeline;
gpu::PipelinePointer _linearToSRGBPipeline;
gpu::PipelinePointer _SRGBToLinearPipeline;
gpu::PipelinePointer _cursorPipeline;
gpu::TexturePointer _displayTexture{};
float _compositeHUDAlpha { 1.0f };

View file

@ -1,4 +1,4 @@
//
//
// Created by Bradley Austin Davis on 2016/02/15
// Copyright 2016 High Fidelity, Inc.
//
@ -402,25 +402,18 @@ void HmdDisplayPlugin::HUDRenderer::build() {
format->setAttribute(gpu::Stream::POSITION, gpu::Stream::POSITION, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0);
format->setAttribute(gpu::Stream::TEXCOORD, gpu::Stream::TEXCOORD, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::UV));
uniformsBuffer = std::make_shared<gpu::Buffer>(sizeof(Uniforms), nullptr);
updatePipeline();
auto program = gpu::Shader::createProgram(shader::render_utils::program::hmd_ui);
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
state->setDepthTest(gpu::State::DepthTest(true, true, gpu::LESS_EQUAL));
state->setBlendFunction(true,
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
pipeline = gpu::Pipeline::create(program, state);
}
void HmdDisplayPlugin::HUDRenderer::updatePipeline() {
if (!pipeline) {
auto program = gpu::Shader::createProgram(shader::render_utils::program::hmd_ui);
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
state->setDepthTest(gpu::State::DepthTest(true, true, gpu::LESS_EQUAL));
state->setBlendFunction(true,
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
pipeline = gpu::Pipeline::create(program, state);
}
}
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> HmdDisplayPlugin::HUDRenderer::render(HmdDisplayPlugin& plugin) {
updatePipeline();
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> HmdDisplayPlugin::HUDRenderer::render() {
auto hudPipeline = pipeline;
auto hudFormat = format;
auto hudVertices = vertices;
@ -479,7 +472,7 @@ void HmdDisplayPlugin::compositePointer() {
}
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> HmdDisplayPlugin::getHUDOperator() {
return _hudRenderer.render(*this);
return _hudRenderer.render();
}
HmdDisplayPlugin::~HmdDisplayPlugin() {

View file

@ -48,6 +48,7 @@ public:
void pluginUpdate() override {};
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator() override;
virtual StencilMaskMode getStencilMaskMode() const override { return StencilMaskMode::PAINT; }
signals:
@ -62,7 +63,6 @@ protected:
bool internalActivate() override;
void internalDeactivate() override;
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator() override;
void compositePointer() override;
void internalPresent() override;
void customizeContext() override;
@ -105,7 +105,7 @@ private:
gpu::BufferPointer vertices;
gpu::BufferPointer indices;
uint32_t indexCount { 0 };
gpu::PipelinePointer pipeline;
gpu::PipelinePointer pipeline { nullptr };
gpu::BufferPointer uniformsBuffer;
@ -123,7 +123,6 @@ private:
static const int VERTEX_STRIDE { sizeof(Vertex) };
void build();
void updatePipeline();
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> render(HmdDisplayPlugin& plugin);
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> render();
} _hudRenderer;
};

View file

@ -450,13 +450,16 @@ qint64 LimitedNodeList::sendPacket(std::unique_ptr<NLPacket> packet, const HifiS
auto size = sendUnreliablePacket(*packet, sockAddr, hmacAuth);
if (size < 0) {
auto now = usecTimestampNow();
eachNode([now](const SharedNodePointer & node) {
qCDebug(networking) << "Stats for " << node->getPublicSocket() << "\n"
<< " Last Heard Microstamp: " << node->getLastHeardMicrostamp() << " (" << (now - node->getLastHeardMicrostamp()) << "usec ago)\n"
<< " Outbound Kbps: " << node->getOutboundKbps() << "\n"
<< " Inbound Kbps: " << node->getInboundKbps() << "\n"
<< " Ping: " << node->getPingMs();
});
if (now - _sendErrorStatsTime > ERROR_STATS_PERIOD_US) {
_sendErrorStatsTime = now;
eachNode([now](const SharedNodePointer& node) {
qCDebug(networking) << "Stats for " << node->getPublicSocket() << "\n"
<< " Last Heard Microstamp: " << node->getLastHeardMicrostamp() << " (" << (now - node->getLastHeardMicrostamp()) << "usec ago)\n"
<< " Outbound Kbps: " << node->getOutboundKbps() << "\n"
<< " Inbound Kbps: " << node->getInboundKbps() << "\n"
<< " Ping: " << node->getPingMs();
});
}
}
return size;
}
@ -996,7 +999,7 @@ void LimitedNodeList::sendSTUNRequest() {
const int NUM_INITIAL_STUN_REQUESTS_BEFORE_FAIL = 10;
if (!_hasCompletedInitialSTUN) {
qCDebug(networking) << "Sending intial stun request to" << STUN_SERVER_HOSTNAME;
qCDebug(networking) << "Sending initial stun request to" << STUN_SERVER_HOSTNAME;
if (_numInitialSTUNRequests > NUM_INITIAL_STUN_REQUESTS_BEFORE_FAIL) {
// we're still trying to do our initial STUN we're over the fail threshold
@ -1185,7 +1188,7 @@ void LimitedNodeList::stopInitialSTUNUpdate(bool success) {
// We now setup a timer here to fire every so often to check that our IP address has not changed.
// Or, if we failed - if will check if we can eventually get a public socket
const int STUN_IP_ADDRESS_CHECK_INTERVAL_MSECS = 30 * 1000;
const int STUN_IP_ADDRESS_CHECK_INTERVAL_MSECS = 10 * 1000;
QTimer* stunOccasionalTimer = new QTimer { this };
connect(stunOccasionalTimer, &QTimer::timeout, this, &LimitedNodeList::sendSTUNRequest);
@ -1243,15 +1246,22 @@ void LimitedNodeList::errorTestingLocalSocket() {
}
void LimitedNodeList::setLocalSocket(const HifiSockAddr& sockAddr) {
if (sockAddr != _localSockAddr) {
if (sockAddr.getAddress() != _localSockAddr.getAddress()) {
if (_localSockAddr.isNull()) {
qCInfo(networking) << "Local socket is" << sockAddr;
_localSockAddr = sockAddr;
} else {
qCInfo(networking) << "Local socket has changed from" << _localSockAddr << "to" << sockAddr;
_localSockAddr = sockAddr;
if (_hasTCPCheckedLocalSocket) { // Force a port change for NAT:
reset();
_nodeSocket.rebind(0);
_localSockAddr.setPort(_nodeSocket.localPort());
qCInfo(networking) << "Local port changed to" << _localSockAddr.getPort();
}
}
_localSockAddr = sockAddr;
emit localSockAddrChanged(_localSockAddr);
}
}

View file

@ -497,6 +497,9 @@ private:
float _outboundKbps { 0.0f };
bool _dropOutgoingNodeTraffic { false };
quint64 _sendErrorStatsTime { (quint64)0 };
static const quint64 ERROR_STATS_PERIOD_US { 1 * USECS_PER_SECOND };
};
#endif // hifi_LimitedNodeList_h

View file

@ -418,6 +418,20 @@ void NodeList::sendDomainServerCheckIn() {
auto accountManager = DependencyManager::get<AccountManager>();
packetStream << FingerprintUtils::getMachineFingerprint();
QString systemInfo;
#if defined Q_OS_WIN
systemInfo = "OS:Windows";
#elif defined Q_OS_OSX
systemInfo = "OS:OSX";
#elif defined Q_OS_LINUX
systemInfo = "OS:Linux";
#elif defined Q_OS_ANDROID
systemInfo = "OS:Android";
#else
systemInfo = "OS:Unknown";
#endif
packetStream << systemInfo;
packetStream << _connectReason;
if (_nodeDisconnectTimestamp < _nodeConnectTimestamp) {

View file

@ -72,7 +72,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
return static_cast<PacketVersion>(DomainConnectionDeniedVersion::IncludesExtraInfo);
case PacketType::DomainConnectRequest:
return static_cast<PacketVersion>(DomainConnectRequestVersion::HasReason);
return static_cast<PacketVersion>(DomainConnectRequestVersion::HasSystemInfo);
case PacketType::DomainServerAddedNode:
return static_cast<PacketVersion>(DomainServerAddedNodeVersion::PermissionsGrid);

View file

@ -346,7 +346,8 @@ enum class DomainConnectRequestVersion : PacketVersion {
HasMachineFingerprint,
AlwaysHasMachineFingerprint,
HasTimestamp,
HasReason
HasReason,
HasSystemInfo
};
enum class DomainConnectionDeniedVersion : PacketVersion {

View file

@ -33,6 +33,7 @@ using namespace udt;
Socket::Socket(QObject* parent, bool shouldChangeSocketOptions) :
QObject(parent),
_udpSocket(parent),
_readyReadBackupTimer(new QTimer(this)),
_shouldChangeSocketOptions(shouldChangeSocketOptions)
{
@ -50,6 +51,7 @@ Socket::Socket(QObject* parent, bool shouldChangeSocketOptions) :
}
void Socket::bind(const QHostAddress& address, quint16 port) {
_udpSocket.bind(address, port);
if (_shouldChangeSocketOptions) {
@ -75,7 +77,7 @@ void Socket::rebind() {
}
void Socket::rebind(quint16 localPort) {
_udpSocket.close();
_udpSocket.abort();
bind(QHostAddress::AnyIPv4, localPort);
}

View file

@ -309,20 +309,28 @@ void PhysicalEntitySimulation::buildMotionStatesForEntitiesThatNeedThem() {
SetOfEntities::iterator entityItr = _entitiesToAddToPhysics.begin();
while (entityItr != _entitiesToAddToPhysics.end()) {
EntityItemPointer entity = (*entityItr);
assert(!entity->getPhysicsInfo());
if (entity->isDead()) {
prepareEntityForDelete(entity);
entityItr = _entitiesToAddToPhysics.erase(entityItr);
} else if (!entity->shouldBePhysical()) {
// this entity should no longer be on _entitiesToAddToPhysics
continue;
}
if (entity->getPhysicsInfo()) {
entityItr = _entitiesToAddToPhysics.erase(entityItr);
continue;
}
if (!entity->shouldBePhysical()) {
// this entity should no longer be on _entitiesToAddToPhysics
if (entity->isMovingRelativeToParent()) {
SetOfEntities::iterator itr = _simpleKinematicEntities.find(entity);
if (itr == _simpleKinematicEntities.end()) {
_simpleKinematicEntities.insert(entity);
}
}
} else if (entity->isReadyToComputeShape()) {
entityItr = _entitiesToAddToPhysics.erase(entityItr);
continue;
}
if (entity->isReadyToComputeShape()) {
ShapeRequest shapeRequest(entity);
ShapeRequests::iterator requestItr = _shapeRequests.find(shapeRequest);
if (requestItr == _shapeRequests.end()) {
@ -332,18 +340,7 @@ void PhysicalEntitySimulation::buildMotionStatesForEntitiesThatNeedThem() {
uint32_t requestCount = ObjectMotionState::getShapeManager()->getWorkRequestCount();
btCollisionShape* shape = const_cast<btCollisionShape*>(ObjectMotionState::getShapeManager()->getShape(shapeInfo));
if (shape) {
EntityMotionState* motionState = static_cast<EntityMotionState*>(entity->getPhysicsInfo());
if (!motionState) {
buildMotionState(shape, entity);
} else {
// Is it possible to fall in here?
// entity shouldn't be on _entitiesToAddToPhysics list if it already has a motionState.
// but just in case...
motionState->setShape(shape);
motionState->setRegion(_space->getRegion(entity->getSpaceIndex()));
_physicalObjects.insert(motionState);
_incomingChanges.insert(motionState);
}
buildMotionState(shape, entity);
} else if (requestCount != ObjectMotionState::getShapeManager()->getWorkRequestCount()) {
// shape doesn't exist but a new worker has been spawned to build it --> add to shapeRequests and wait
shapeRequest.shapeHash = shapeInfo.getHash();
@ -354,6 +351,7 @@ void PhysicalEntitySimulation::buildMotionStatesForEntitiesThatNeedThem() {
}
entityItr = _entitiesToAddToPhysics.erase(entityItr);
} else {
// skip for later
++entityItr;
}
}

View file

@ -181,7 +181,7 @@ void ThreadSafeDynamicsWorld::drawConnectedSpheres(btIDebugDraw* drawer, btScala
btVector3 xAxis = direction.cross(btVector3(0.0f, 1.0f, 0.0f));
xAxis = xAxis.length() < EPSILON ? btVector3(1.0f, 0.0f, 0.0f) : xAxis.normalize();
btVector3 zAxis = xAxis.cross(btVector3(0.0f, 1.0f, 0.0f));
zAxis = (direction.normalize().getY() < EPSILON) ? btVector3(0.0f, 1.0f, 0.0f) : zAxis.normalize();
zAxis = (direction.length2() < EPSILON || direction.normalize().getY() < EPSILON) ? btVector3(0.0f, 1.0f, 0.0f) : zAxis.normalize();
float fullCircle = 2.0f * PI;
for (float i = 0; i < fullCircle; i += stepRadians) {
float x1 = btSin(btScalar(i)) * radius1;

View file

@ -27,12 +27,13 @@ json getGPU(int index);
int getNumDisplays();
json getDisplay(int index);
int getNumMemories();
json getMemory(int index);
json getMemory();
json getComputer();
json getAll();
} // namespace platform
#endif // hifi_platform_h

View file

@ -9,6 +9,9 @@
#define hifi_platform_PlatformKeys_h
namespace platform { namespace keys{
// "UNKNOWN"
extern const char* UNKNOWN;
namespace cpu {
extern const char* vendor;
extern const char* vendor_Intel;
@ -36,8 +39,9 @@ namespace platform { namespace keys{
extern const char* coordsTop;
extern const char* coordsBottom;
}
namespace memory {
extern const char* memTotal;
}
namespace computer {
extern const char* OS;
extern const char* OS_WINDOWS;
@ -45,6 +49,8 @@ namespace platform { namespace keys{
extern const char* OS_LINUX;
extern const char* OS_ANDROID;
extern const char* OSVersion;
extern const char* vendor;
extern const char* vendor_Apple;
@ -52,6 +58,14 @@ namespace platform { namespace keys{
extern const char* profileTier;
}
} } // namespace plaform::keys
// Keys for categories used in json returned by getAll()
extern const char* CPUS;
extern const char* GPUS;
extern const char* DISPLAYS;
extern const char* MEMORY;
extern const char* COMPUTER;
} } // namespace plaform::keys
#endif

View file

@ -9,39 +9,45 @@
#include "AndroidPlatform.h"
#include "../PlatformKeys.h"
#include <GPUIdent.h>
#include <QSysInfo>
using namespace platform;
void AndroidInstance::enumerateCpu() {
void AndroidInstance::enumerateCpus() {
json cpu;
cpu[keys::cpu::vendor] = "";
cpu[keys::cpu::model] = "";
cpu[keys::cpu::clockSpeed] = "";
cpu[keys::cpu::numCores] = 0;
_cpu.push_back(cpu);
_cpus.push_back(cpu);
}
void AndroidInstance::enumerateGpu() {
void AndroidInstance::enumerateGpus() {
GPUIdent* ident = GPUIdent::getInstance();
json gpu = {};
gpu[keys::gpu::vendor] = ident->getName().toUtf8().constData();
gpu[keys::gpu::model] = ident->getName().toUtf8().constData();
gpu[keys::gpu::vendor] = findGPUVendorInDescription(gpu[keys::gpu::model].get<std::string>());
gpu[keys::gpu::videoMemory] = ident->getMemory();
gpu[keys::gpu::driver] = ident->getDriver().toUtf8().constData();
_gpu.push_back(gpu);
_display = ident->getOutput();
_gpus.push_back(gpu);
_displays = ident->getOutput();
}
void AndroidInstance::enumerateMemory() {
json ram = {};
ram[keys::memTotal]=0;
_memory.push_back(ram);
ram[keys::memory::memTotal]=0;
_memory = ram;
}
void AndroidInstance::enumerateComputer(){
_computer[keys::computer::OS] = keys::computer::OS_ANDROID;
_computer[keys::computer::vendor] = "";
_computer[keys::computer::model] = "";
auto sysInfo = QSysInfo();
_computer[keys::computer::OSVersion] = sysInfo.kernelVersion().toStdString();
}

View file

@ -15,10 +15,10 @@ namespace platform {
class AndroidInstance : public Instance {
public:
void enumerateCpu() override;
void enumerateCpus() override;
void enumerateGpus() override;
void enumerateMemory() override;
void enumerateGpu() override;
void enumerateComputer () override;
void enumerateComputer() override;
};
} // namespace platform

View file

@ -13,36 +13,37 @@
#include <string>
#include <CPUIdent.h>
#include <GPUIdent.h>
#include <QSysInfo>
using namespace platform;
void LinuxInstance::enumerateCpu() {
void LinuxInstance::enumerateCpus() {
json cpu = {};
cpu[keys::cpu::vendor] = CPUIdent::Vendor();
cpu[keys::cpu::model] = CPUIdent::Brand();
cpu[keys::cpu::numCores] = std::thread::hardware_concurrency();
_cpu.push_back(cpu);
_cpus.push_back(cpu);
}
void LinuxInstance::enumerateGpu() {
void LinuxInstance::enumerateGpus() {
GPUIdent* ident = GPUIdent::getInstance();
json gpu = {};
gpu[keys::gpu::vendor] = ident->getName().toUtf8().constData();
gpu[keys::gpu::model] = ident->getName().toUtf8().constData();
gpu[keys::gpu::vendor] = findGPUVendorInDescription(gpu[keys::gpu::model].get<std::string>());
gpu[keys::gpu::videoMemory] = ident->getMemory();
gpu[keys::gpu::driver] = ident->getDriver().toUtf8().constData();
_gpu.push_back(gpu);
_display = ident->getOutput();
_gpus.push_back(gpu);
_displays = ident->getOutput();
}
void LinuxInstance::enumerateMemory() {
json ram = {};
ram[keys::memTotal]=0;
ram[keys::memory::memTotal]=0;
_memory.push_back(ram);
_memory = ram;
}
void LinuxInstance::enumerateComputer(){
@ -50,5 +51,9 @@ void LinuxInstance::enumerateComputer(){
_computer[keys::computer::OS] = keys::computer::OS_LINUX;
_computer[keys::computer::vendor] = "";
_computer[keys::computer::model] = "";
auto sysInfo = QSysInfo();
_computer[keys::computer::OSVersion] = sysInfo.kernelVersion().toStdString();
}

View file

@ -15,10 +15,10 @@ namespace platform {
class LinuxInstance : public Instance {
public:
void enumerateCpu() override;
void enumerateCpus() override;
void enumerateGpus() override;
void enumerateMemory() override;
void enumerateGpu() override;
void enumerateComputer () override;
void enumerateComputer() override;
};
} // namespace platform

View file

@ -21,32 +21,33 @@
#include <CoreFoundation/CoreFoundation.h>
#include <ApplicationServices/ApplicationServices.h>
#include <QSysInfo>
#endif
using namespace platform;
void MACOSInstance::enumerateCpu() {
void MACOSInstance::enumerateCpus() {
json cpu = {};
cpu[keys::cpu::vendor] = CPUIdent::Vendor();
cpu[keys::cpu::model] = CPUIdent::Brand();
cpu[keys::cpu::numCores] = std::thread::hardware_concurrency();
_cpu.push_back(cpu);
_cpus.push_back(cpu);
}
void MACOSInstance::enumerateGpu() {
void MACOSInstance::enumerateGpus() {
#ifdef Q_OS_MAC
GPUIdent* ident = GPUIdent::getInstance();
json gpu = {};
gpu[keys::gpu::vendor] = ident->getName().toUtf8().constData();
gpu[keys::gpu::model] = ident->getName().toUtf8().constData();
gpu[keys::gpu::vendor] = findGPUVendorInDescription(gpu[keys::gpu::model].get<std::string>());
gpu[keys::gpu::videoMemory] = ident->getMemory();
gpu[keys::gpu::driver] = ident->getDriver().toUtf8().constData();
_gpu.push_back(gpu);
_gpus.push_back(gpu);
#endif
@ -101,7 +102,7 @@ void MACOSInstance::enumerateDisplays() {
display["modeWidth"] = displayModeWidth;
display["modeHeight"] = displayModeHeight;
_display.push_back(display);
_displays.push_back(display);
#endif
}
@ -111,9 +112,9 @@ void MACOSInstance::enumerateMemory() {
#ifdef Q_OS_MAC
long pages = sysconf(_SC_PHYS_PAGES);
long page_size = sysconf(_SC_PAGE_SIZE);
ram[keys::memTotal] = pages * page_size;
ram[keys::memory::memTotal] = pages * page_size;
#endif
_memory.push_back(ram);
_memory = ram;
}
void MACOSInstance::enumerateComputer(){
@ -133,5 +134,9 @@ void MACOSInstance::enumerateComputer(){
free(model);
#endif
auto sysInfo = QSysInfo();
_computer[keys::computer::OSVersion] = sysInfo.kernelVersion().toStdString();
}

View file

@ -15,11 +15,11 @@ namespace platform {
class MACOSInstance : public Instance {
public:
void enumerateCpu() override;
void enumerateMemory() override;
void enumerateGpu() override;
void enumerateCpus() override;
void enumerateGpus() override;
void enumerateDisplays() override;
void enumerateComputer () override;
void enumerateMemory() override;
void enumerateComputer() override;
};
} // namespace platform

View file

@ -11,6 +11,8 @@
#include "../PlatformKeys.h"
namespace platform { namespace keys {
const char* UNKNOWN = "UNKNOWN";
namespace cpu {
const char* vendor = "vendor";
const char* vendor_Intel = "Intel";
@ -38,8 +40,9 @@ namespace platform { namespace keys {
const char* coordsTop = "coordinatestop";
const char* coordsBottom = "coordinatesbottom";
}
const char* memTotal = "memTotal";
namespace memory {
const char* memTotal = "memTotal";
}
namespace computer {
const char* OS = "OS";
const char* OS_WINDOWS = "WINDOWS";
@ -47,6 +50,8 @@ namespace platform { namespace keys {
const char* OS_LINUX = "LINUX";
const char* OS_ANDROID = "ANDROID";
const char* OSVersion = "OSVersion";
const char* vendor = "vendor";
const char* vendor_Apple = "Apple";
@ -54,6 +59,12 @@ namespace platform { namespace keys {
const char* profileTier = "profileTier";
}
const char* CPUS = "cpus";
const char* GPUS = "gpus";
const char* DISPLAYS = "displays";
const char* MEMORY = "memory";
const char* COMPUTER = "computer";
}}
#include <qglobal.h>
@ -117,14 +128,14 @@ json platform::getDisplay(int index) {
return _instance->getDisplay(index);
}
int platform::getNumMemories() {
return _instance->getNumMemories();
json platform::getMemory() {
return _instance->getMemory();
}
json platform::getMemory(int index) {
return _instance->getMemory(index);
}
json platform::getComputer(){
json platform::getComputer() {
return _instance->getComputer();
}
json platform::getAll() {
return _instance->getAll();
}

View file

@ -16,10 +16,10 @@ using namespace platform;
bool Instance::enumeratePlatform() {
enumerateComputer();
enumerateCpu();
enumerateGpu();
enumerateDisplays();
enumerateMemory();
enumerateCpus();
enumerateGpus();
enumerateDisplays();
// And profile the platform and put the tier in "computer"
_computer[keys::computer::profileTier] = Profiler::TierNames[Profiler::profilePlatform()];
@ -28,55 +28,42 @@ bool Instance::enumeratePlatform() {
}
json Instance::getCPU(int index) {
assert(index <(int) _cpu.size());
if (index >= (int)_cpu.size())
assert(index <(int) _cpus.size());
if (index >= (int)_cpus.size())
return json();
return _cpu.at(index);
}
//These are ripe for template.. will work on that next
json Instance::getMemory(int index) {
assert(index <(int) _memory.size());
if(index >= (int)_memory.size())
return json();
return _memory.at(index);
return _cpus.at(index);
}
json Instance::getGPU(int index) {
assert(index <(int) _gpu.size());
assert(index <(int) _gpus.size());
if (index >=(int) _gpu.size())
if (index >=(int) _gpus.size())
return json();
return _gpu.at(index);
return _gpus.at(index);
}
json Instance::getDisplay(int index) {
assert(index <(int) _display.size());
assert(index <(int) _displays.size());
if (index >=(int) _display.size())
if (index >=(int) _displays.size())
return json();
return _display.at(index);
return _displays.at(index);
}
Instance::~Instance() {
if (_cpu.size() > 0) {
_cpu.clear();
if (_cpus.size() > 0) {
_cpus.clear();
}
if (_memory.size() > 0) {
_memory.clear();
if (_gpus.size() > 0) {
_gpus.clear();
}
if (_gpu.size() > 0) {
_gpu.clear();
}
if (_display.size() > 0) {
_display.clear();
if (_displays.size() > 0) {
_displays.clear();
}
}
@ -106,17 +93,53 @@ json Instance::listAllKeys() {
keys::display::coordsTop,
keys::display::coordsBottom,
keys::memTotal,
keys::memory::memTotal,
keys::computer::OS,
keys::computer::OS_WINDOWS,
keys::computer::OS_MACOS,
keys::computer::OS_LINUX,
keys::computer::OS_ANDROID,
keys::computer::OSVersion,
keys::computer::vendor,
keys::computer::vendor_Apple,
keys::computer::model,
keys::computer::profileTier
keys::computer::profileTier,
keys::CPUS,
keys::GPUS,
keys::DISPLAYS,
keys::MEMORY,
keys::COMPUTER,
}});
return allKeys;
}
const char* Instance::findGPUVendorInDescription(const std::string& description) {
// intel integrated graphics
if (description.find(keys::gpu::vendor_Intel) != std::string::npos) {
return keys::gpu::vendor_Intel;
}
// AMD gpu
else if (description.find(keys::gpu::vendor_AMD) != std::string::npos) {
return keys::gpu::vendor_AMD;
}
// NVIDIA gpu
else if (description.find(keys::gpu::vendor_NVIDIA) != std::string::npos) {
return keys::gpu::vendor_NVIDIA;
} else {
return keys::UNKNOWN;
}
}
json Instance::getAll() {
json all = {};
all[keys::COMPUTER] = _computer;
all[keys::MEMORY] = _memory;
all[keys::CPUS] = _cpus;
all[keys::GPUS] = _gpus;
all[keys::DISPLAYS] = _displays;
return all;
}

View file

@ -19,36 +19,39 @@ class Instance {
public:
bool virtual enumeratePlatform();
int getNumCPUs() { return (int)_cpu.size(); }
int getNumCPUs() { return (int)_cpus.size(); }
json getCPU(int index);
int getNumGPUs() { return (int)_gpu.size(); }
int getNumGPUs() { return (int)_gpus.size(); }
json getGPU(int index);
int getNumMemories() { return (int)_memory.size(); }
json getMemory(int index);
int getNumDisplays() { return (int)_display.size(); }
int getNumDisplays() { return (int)_displays.size(); }
json getDisplay(int index);
json getMemory() { return _memory; }
json getComputer() { return _computer; }
json getComputer() {return _computer;}
void virtual enumerateCpu()=0;
void virtual enumerateMemory()=0;
void virtual enumerateGpu()=0;
json getAll();
void virtual enumerateCpus()=0;
void virtual enumerateGpus()=0;
void virtual enumerateDisplays() {}
void virtual enumerateMemory() = 0;
void virtual enumerateComputer()=0;
virtual ~Instance();
static json listAllKeys();
// Helper function to filter the vendor name out of the description of a GPU
static const char* findGPUVendorInDescription(const std::string& description);
protected:
std::vector<json> _cpu;
std::vector<json> _memory;
std::vector<json> _gpu;
std::vector<json> _display;
std::vector<json> _cpus;
std::vector<json> _gpus;
std::vector<json> _displays;
json _memory;
json _computer;
};

View file

@ -16,32 +16,33 @@
#ifdef Q_OS_WIN
#include <Windows.h>
#include <QSysInfo>
#endif
using namespace platform;
void WINInstance::enumerateCpu() {
void WINInstance::enumerateCpus() {
json cpu = {};
cpu[keys::cpu::vendor] = CPUIdent::Vendor();
cpu[keys::cpu::model] = CPUIdent::Brand();
cpu[keys::cpu::numCores] = std::thread::hardware_concurrency();
_cpu.push_back(cpu);
_cpus.push_back(cpu);
}
void WINInstance::enumerateGpu() {
void WINInstance::enumerateGpus() {
GPUIdent* ident = GPUIdent::getInstance();
json gpu = {};
gpu[keys::gpu::vendor] = ident->getName().toUtf8().constData();
gpu[keys::gpu::model] = ident->getName().toUtf8().constData();
gpu[keys::gpu::vendor] = findGPUVendorInDescription(gpu[keys::gpu::model].get<std::string>());
gpu[keys::gpu::videoMemory] = ident->getMemory();
gpu[keys::gpu::driver] = ident->getDriver().toUtf8().constData();
_gpu.push_back(gpu);
_display = ident->getOutput();
_gpus.push_back(gpu);
_displays = ident->getOutput();
}
void WINInstance::enumerateMemory() {
@ -52,9 +53,9 @@ void WINInstance::enumerateMemory() {
statex.dwLength = sizeof(statex);
GlobalMemoryStatusEx(&statex);
int totalRam = statex.ullTotalPhys / 1024 / 1024;
ram[platform::keys::memTotal] = totalRam;
ram[platform::keys::memory::memTotal] = totalRam;
#endif
_memory.push_back(ram);
_memory = ram;
}
void WINInstance::enumerateComputer(){
@ -62,5 +63,8 @@ void WINInstance::enumerateComputer(){
_computer[keys::computer::vendor] = "";
_computer[keys::computer::model] = "";
auto sysInfo = QSysInfo();
_computer[keys::computer::OSVersion] = sysInfo.kernelVersion().toStdString();
}

View file

@ -15,9 +15,9 @@ namespace platform {
class WINInstance : public Instance {
public:
void enumerateCpu() override;
void enumerateCpus() override;
void enumerateGpus() override;
void enumerateMemory() override;
void enumerateGpu() override;
void enumerateComputer () override;
};
} // namespace platform

View file

@ -35,15 +35,6 @@ void DisplayPlugin::waitForPresent() {
}
}
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> DisplayPlugin::getHUDOperator() {
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> hudOperator;
{
QMutexLocker locker(&_presentMutex);
hudOperator = _hudOperator;
}
return hudOperator;
}
glm::mat4 HmdDisplay::getEyeToHeadTransform(Eye eye) const {
static const glm::mat4 xform;
return xform;

View file

@ -213,13 +213,12 @@ public:
void waitForPresent();
float getAveragePresentTime() { return _movingAveragePresent.average / (float)USECS_PER_MSEC; } // in msec
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator();
static const QString& MENU_PATH();
// for updating plugin-related commands. Mimics the input plugin.
virtual void pluginUpdate() = 0;
virtual std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator() { return nullptr; }
virtual StencilMaskMode getStencilMaskMode() const { return StencilMaskMode::NONE; }
using StencilMaskMeshOperator = std::function<void(gpu::Batch&)>;
virtual StencilMaskMeshOperator getStencilMaskMeshOperator() { return nullptr; }
@ -234,8 +233,6 @@ protected:
gpu::ContextPointer _gpuContext;
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> _hudOperator { std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)>() };
MovingAverage<float, 10> _movingAveragePresent;
float _renderResolutionScale { 1.0f };

View file

@ -122,22 +122,22 @@ void PickManager::update() {
// FIXME: give each type its own expiry
// Each type will update at least one pick, regardless of the expiry
{
PROFILE_RANGE(picks, "StylusPicks");
PROFILE_RANGE_EX(picks, "StylusPicks", 0xffff0000, (uint64_t)_totalPickCounts[PickQuery::Stylus]);
PerformanceTimer perfTimer("StylusPicks");
_updatedPickCounts[PickQuery::Stylus] = _stylusPickCacheOptimizer.update(cachedPicks[PickQuery::Stylus], _nextPickToUpdate[PickQuery::Stylus], expiry, false);
}
{
PROFILE_RANGE(picks, "RayPicks");
PROFILE_RANGE_EX(picks, "RayPicks", 0xffff0000, (uint64_t)_totalPickCounts[PickQuery::Ray]);
PerformanceTimer perfTimer("RayPicks");
_updatedPickCounts[PickQuery::Ray] = _rayPickCacheOptimizer.update(cachedPicks[PickQuery::Ray], _nextPickToUpdate[PickQuery::Ray], expiry, shouldPickHUD);
}
{
PROFILE_RANGE(picks, "ParabolaPick");
PerformanceTimer perfTimer("ParabolaPick");
PROFILE_RANGE_EX(picks, "ParabolaPicks", 0xffff0000, (uint64_t)_totalPickCounts[PickQuery::Parabola]);
PerformanceTimer perfTimer("ParabolaPicks");
_updatedPickCounts[PickQuery::Parabola] = _parabolaPickCacheOptimizer.update(cachedPicks[PickQuery::Parabola], _nextPickToUpdate[PickQuery::Parabola], expiry, shouldPickHUD);
}
{
PROFILE_RANGE(picks, "CollisoinPicks");
PROFILE_RANGE_EX(picks, "CollisionPicks", 0xffff0000, (uint64_t)_totalPickCounts[PickQuery::Collision]);
PerformanceTimer perfTimer("CollisionPicks");
_updatedPickCounts[PickQuery::Collision] = _collisionPickCacheOptimizer.update(cachedPicks[PickQuery::Collision], _nextPickToUpdate[PickQuery::Collision], expiry, false);
}

View file

@ -18,7 +18,13 @@
using namespace recording;
NetworkClipLoader::NetworkClipLoader(const QUrl& url) :
Resource(url),
_clip(std::make_shared<NetworkClip>(url)) {}
_clip(std::make_shared<NetworkClip>(url)) {
if (url.isEmpty()) {
_loaded = false;
_startedLoading = false;
_failedToLoad = true;
}
}
void NetworkClip::init(const QByteArray& clipData) {
_clipData = clipData;

View file

@ -37,7 +37,6 @@ void packDeferredFragment(vec3 normal, float alpha, vec3 albedo, float roughness
_fragColor0 = vec4(albedo, mix(packShadedMetallic(metallic), packScatteringMetallic(metallic), check));
_fragColor1 = vec4(packNormal(normal), clamp(roughness, 0.0, 1.0));
_fragColor2 = vec4(mix(emissive, vec3(scattering), check), occlusion);
_fragColor3 = vec4(isEmissiveEnabled() * emissive, 1.0);
}
@ -49,7 +48,6 @@ void packDeferredFragmentLightmap(vec3 normal, float alpha, vec3 albedo, float r
_fragColor0 = vec4(albedo, packLightmappedMetallic(metallic));
_fragColor1 = vec4(packNormal(normal), clamp(roughness, 0.0, 1.0));
_fragColor2 = vec4(isLightmapEnabled() * lightmap, 1.0);
_fragColor3 = vec4(isLightmapEnabled() * lightmap * albedo, 1.0);
}
@ -59,7 +57,7 @@ void packDeferredFragmentUnlit(vec3 normal, float alpha, vec3 color) {
}
_fragColor0 = vec4(color, packUnlit());
_fragColor1 = vec4(packNormal(normal), 1.0);
// _fragColor2 = vec4(vec3(0.0), 1.0);
_fragColor2 = vec4(vec3(0.0), 1.0);
_fragColor3 = vec4(color, 1.0);
}
@ -69,7 +67,8 @@ void packDeferredFragmentTranslucent(vec3 normal, float alpha, vec3 albedo, floa
}
_fragColor0 = vec4(albedo.rgb, alpha);
_fragColor1 = vec4(packNormal(normal), clamp(roughness, 0.0, 1.0));
_fragColor2 = vec4(vec3(0.0), 1.0);
_fragColor3 = vec4(0.0);
}
<@endif@>

View file

@ -41,33 +41,17 @@ namespace gr {
using namespace render;
struct LightLocations {
bool shadowTransform{ false };
void initialize(const gpu::ShaderPointer& program) {
shadowTransform = program->getReflection().validUniformBuffer(ru::Buffer::ShadowParams);
}
};
static void loadLightProgram(int programId, bool lightVolume, gpu::PipelinePointer& program, LightLocationsPtr& locations);
static void loadLightProgram(int programId, bool lightVolume, gpu::PipelinePointer& program);
void DeferredLightingEffect::init() {
_directionalAmbientSphereLightLocations = std::make_shared<LightLocations>();
_directionalSkyboxLightLocations = std::make_shared<LightLocations>();
loadLightProgram(shader::render_utils::program::directional_ambient_light, false, _directionalAmbientSphereLight);
loadLightProgram(shader::render_utils::program::directional_skybox_light, false, _directionalSkyboxLight);
_directionalAmbientSphereLightShadowLocations = std::make_shared<LightLocations>();
_directionalSkyboxLightShadowLocations = std::make_shared<LightLocations>();
loadLightProgram(shader::render_utils::program::directional_ambient_light_shadow, false, _directionalAmbientSphereLightShadow);
loadLightProgram(shader::render_utils::program::directional_skybox_light_shadow, false, _directionalSkyboxLightShadow);
_localLightLocations = std::make_shared<LightLocations>();
_localLightOutlineLocations = std::make_shared<LightLocations>();
loadLightProgram(shader::render_utils::program::directional_ambient_light, false, _directionalAmbientSphereLight, _directionalAmbientSphereLightLocations);
loadLightProgram(shader::render_utils::program::directional_skybox_light, false, _directionalSkyboxLight, _directionalSkyboxLightLocations);
loadLightProgram(shader::render_utils::program::directional_ambient_light_shadow, false, _directionalAmbientSphereLightShadow, _directionalAmbientSphereLightShadowLocations);
loadLightProgram(shader::render_utils::program::directional_skybox_light_shadow, false, _directionalSkyboxLightShadow, _directionalSkyboxLightShadowLocations);
loadLightProgram(shader::render_utils::program::local_lights_shading, true, _localLight, _localLightLocations);
loadLightProgram(shader::render_utils::program::local_lights_drawOutline, true, _localLightOutline, _localLightOutlineLocations);
loadLightProgram(shader::render_utils::program::local_lights_shading, true, _localLight);
loadLightProgram(shader::render_utils::program::local_lights_drawOutline, true, _localLightOutline);
}
// FIXME: figure out how to move lightFrame into a varying in GeometryCache and RenderPipelines
@ -123,15 +107,9 @@ void DeferredLightingEffect::unsetLocalLightsBatch(gpu::Batch& batch) {
batch.setUniformBuffer(ru::Buffer::LightClusterFrustumGrid, nullptr);
}
static gpu::ShaderPointer makeLightProgram(int programId, LightLocationsPtr& locations) {
static void loadLightProgram(int programId, bool lightVolume, gpu::PipelinePointer& pipeline) {
gpu::ShaderPointer program = gpu::Shader::createProgram(programId);
locations->initialize(program);
return program;
}
static void loadLightProgram(int programId, bool lightVolume, gpu::PipelinePointer& pipeline, LightLocationsPtr& locations) {
gpu::ShaderPointer program = makeLightProgram(programId, locations);
auto state = std::make_shared<gpu::State>();
state->setColorWriteMask(true, true, true, false);
@ -456,7 +434,6 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
// Setup the global directional pass pipeline
auto program = deferredLightingEffect->_directionalSkyboxLight;
LightLocationsPtr locations = deferredLightingEffect->_directionalSkyboxLightLocations;
{
if (keyLightCastShadows) {
@ -464,20 +441,16 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
// otherwise use the ambient sphere version
if (hasAmbientMap) {
program = deferredLightingEffect->_directionalSkyboxLightShadow;
locations = deferredLightingEffect->_directionalSkyboxLightShadowLocations;
} else {
program = deferredLightingEffect->_directionalAmbientSphereLightShadow;
locations = deferredLightingEffect->_directionalAmbientSphereLightShadowLocations;
}
} else {
// If the keylight has an ambient Map then use the Skybox version of the pass
// otherwise use the ambient sphere version
if (hasAmbientMap) {
program = deferredLightingEffect->_directionalSkyboxLight;
locations = deferredLightingEffect->_directionalSkyboxLightLocations;
} else {
program = deferredLightingEffect->_directionalAmbientSphereLight;
locations = deferredLightingEffect->_directionalAmbientSphereLightLocations;
}
}

View file

@ -37,10 +37,6 @@
#include "SubsurfaceScattering.h"
#include "AmbientOcclusionEffect.h"
struct LightLocations;
using LightLocationsPtr = std::shared_ptr<LightLocations>;
// THis is where we currently accumulate the local lights, let s change that sooner than later
class DeferredLightingEffect : public Dependency {
SINGLETON_DEPENDENCY
@ -72,15 +68,6 @@ private:
gpu::PipelinePointer _localLight;
gpu::PipelinePointer _localLightOutline;
LightLocationsPtr _directionalSkyboxLightLocations;
LightLocationsPtr _directionalAmbientSphereLightLocations;
LightLocationsPtr _directionalSkyboxLightShadowLocations;
LightLocationsPtr _directionalAmbientSphereLightShadowLocations;
LightLocationsPtr _localLightLocations;
LightLocationsPtr _localLightOutlineLocations;
friend class LightClusteringPass;
friend class RenderDeferredSetup;
friend class RenderDeferredLocals;

View file

@ -111,7 +111,7 @@ void CompositeHUD::run(const RenderContextPointer& renderContext, const gpu::Fra
assert(renderContext->args->_context);
// We do not want to render HUD elements in secondary camera
if (renderContext->args->_renderMode == RenderArgs::RenderMode::SECONDARY_CAMERA_RENDER_MODE) {
if (nsightActive() || renderContext->args->_renderMode == RenderArgs::RenderMode::SECONDARY_CAMERA_RENDER_MODE) {
return;
}

View file

@ -18,7 +18,7 @@ layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01;
void main(void) {
const float depth = 1.0;
const vec4 UNIT_QUAD[4] = vec4[4](
const mat4 UNIT_QUAD = mat4(
vec4(-1.0, -1.0, depth, 1.0),
vec4(1.0, -1.0, depth, 1.0),
vec4(-1.0, 1.0, depth, 1.0),
@ -26,7 +26,7 @@ void main(void) {
);
vec4 pos = UNIT_QUAD[gl_VertexID];
_texCoord01.xy = (pos.xy + 1.0) * 0.5;
_texCoord01 = vec4((pos.xy + 1.0) * 0.5, 0.0, 0.0);
gl_Position = pos;
}

View file

@ -124,20 +124,20 @@ namespace render {
DebugFlags _debugFlags { RENDER_DEBUG_NONE };
gpu::Batch* _batch = nullptr;
uint32_t _globalShapeKey{ 0 };
uint32_t _itemShapeKey{ 0 };
bool _enableTexturing{ true };
bool _enableBlendshape{ true };
bool _enableSkinning{ true };
uint32_t _globalShapeKey { 0 };
uint32_t _itemShapeKey { 0 };
bool _enableTexturing { true };
bool _enableBlendshape { true };
bool _enableSkinning { true };
bool _enableFade{ false };
bool _enableFade { false };
RenderDetails _details;
render::ScenePointer _scene;
int8_t _cameraMode { -1 };
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> _hudOperator;
gpu::TexturePointer _hudTexture;
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> _hudOperator { nullptr };
gpu::TexturePointer _hudTexture { nullptr };
bool _takingSnapshot { false };
StencilMaskMode _stencilMaskMode { StencilMaskMode::NONE };

View file

@ -93,7 +93,7 @@ void RecordingScriptingInterface::loadRecording(const QString& url, QScriptValue
// when clip load fails, call the callback with the URL and failure boolean
connect(clipLoader.data(), &recording::NetworkClipLoader::failed, callback.engine(), [this, weakClipLoader, url, callback](QNetworkReply::NetworkError error) mutable {
qCDebug(scriptengine) << "Failed to load recording from" << url;
qCDebug(scriptengine) << "Failed to load recording from\"" << url << '"';
if (callback.isFunction()) {
QScriptValueList args { false, url };

View file

@ -282,12 +282,13 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
if (!validAdapterList.empty()) {
for (auto outy = adapterToOutputs.begin(); outy != adapterToOutputs.end(); ++outy) {
AdapterEntry entry = *outy;
AdapterEntry entry = *outy;
for (auto test = entry.second.begin(); test != entry.second.end(); ++test) {
std::wstring wDeviceName(test->DeviceName);
std::string deviceName(wDeviceName.begin(), wDeviceName.end());
nlohmann::json output = {};
output["description"] = entry.first.first.Description;
output["deviceName"]= test->DeviceName;
output["model"] = deviceName;
output["coordinatesleft"] = test->DesktopCoordinates.left;
output["coordinatesright"] = test->DesktopCoordinates.right;
output["coordinatestop"] = test->DesktopCoordinates.top;

View file

@ -115,48 +115,39 @@ protected:
const Lambda _triggerHandler;
};
template <typename T>
class TypedPreference : public Preference {
public:
using Getter = std::function<T()>;
using Setter = std::function<void(const T&)>;
TypedPreference(const QString& category, const QString& name, Getter getter, Setter setter)
: Preference(category, name), _getter(getter), _setter(setter) { }
T getValue() const { return _value; }
void setValue(const T& value) { if (_value != value) { _value = value; emitValueChanged(); } }
void load() override { _value = _getter(); }
void save() const override {
T oldValue = _getter();
if (_value != oldValue) {
_setter(_value);
}
}
protected:
T _value;
const Getter _getter;
const Setter _setter;
};
class BoolPreference : public TypedPreference<bool> {
class BoolPreference : public Preference {
Q_OBJECT
Q_PROPERTY(bool value READ getValue WRITE setValue NOTIFY valueChanged)
public:
using Getter = std::function<bool()>;
using Setter = std::function<void(const bool&)>;
BoolPreference(const QString& category, const QString& name, Getter getter, Setter setter)
: TypedPreference(category, name, getter, setter) { }
: Preference(category, name), _getter(getter), _setter(setter) { }
bool getValue() const { return _value; }
void setValue(const bool& value) { if (_value != value) { _value = value; emitValueChanged(); } }
void load() override { _value = _getter(); }
void save() const override {
bool oldValue = _getter();
if (_value != oldValue) {
_setter(_value);
}
}
signals:
void valueChanged();
protected:
bool _value;
const Getter _getter;
const Setter _setter;
void emitValueChanged() override { emit valueChanged(); }
};
class FloatPreference : public TypedPreference<float> {
class FloatPreference : public Preference {
Q_OBJECT
Q_PROPERTY(float value READ getValue WRITE setValue NOTIFY valueChanged)
Q_PROPERTY(float min READ getMin CONSTANT)
@ -165,8 +156,21 @@ class FloatPreference : public TypedPreference<float> {
Q_PROPERTY(float decimals READ getDecimals CONSTANT)
public:
using Getter = std::function<float()>;
using Setter = std::function<void(const float&)>;
FloatPreference(const QString& category, const QString& name, Getter getter, Setter setter)
: TypedPreference(category, name, getter, setter) { }
: Preference(category, name), _getter(getter), _setter(setter) { }
float getValue() const { return _value; }
void setValue(const float& value) { if (_value != value) { _value = value; emitValueChanged(); } }
void load() override { _value = _getter(); }
void save() const override {
float oldValue = _getter();
if (_value != oldValue) {
_setter(_value);
}
}
float getMin() const { return _min; }
void setMin(float min) { _min = min; };
@ -186,14 +190,17 @@ signals:
protected:
void emitValueChanged() override { emit valueChanged(); }
float _value;
const Getter _getter;
const Setter _setter;
float _decimals { 0 };
float _min { 0 };
float _max { 1 };
float _step { 0.1f };
};
class IntPreference : public TypedPreference<int> {
class IntPreference : public Preference {
Q_OBJECT
Q_PROPERTY(float value READ getValue WRITE setValue NOTIFY valueChanged)
Q_PROPERTY(float min READ getMin CONSTANT)
@ -202,8 +209,21 @@ class IntPreference : public TypedPreference<int> {
Q_PROPERTY(int decimals READ getDecimals CONSTANT)
public:
using Getter = std::function<int()>;
using Setter = std::function<void(const int&)>;
IntPreference(const QString& category, const QString& name, Getter getter, Setter setter)
: TypedPreference(category, name, getter, setter) { }
: Preference(category, name), _getter(getter), _setter(setter) { }
int getValue() const { return _value; }
void setValue(const int& value) { if (_value != value) { _value = value; emitValueChanged(); } }
void load() override { _value = _getter(); }
void save() const override {
int oldValue = _getter();
if (_value != oldValue) {
_setter(_value);
}
}
float getMin() const { return _min; }
void setMin(float min) { _min = min; };
@ -221,6 +241,10 @@ signals:
void valueChanged();
protected:
int _value;
const Getter _getter;
const Setter _setter;
void emitValueChanged() override { emit valueChanged(); }
int _min { std::numeric_limits<int>::min() };
@ -229,19 +253,37 @@ protected:
int _decimals { 0 };
};
class StringPreference : public TypedPreference<QString> {
class StringPreference : public Preference {
Q_OBJECT
Q_PROPERTY(QString value READ getValue WRITE setValue NOTIFY valueChanged)
public:
using Getter = std::function<QString()>;
using Setter = std::function<void(const QString&)>;
StringPreference(const QString& category, const QString& name, Getter getter, Setter setter)
: TypedPreference(category, name, getter, setter) { }
: Preference(category, name), _getter(getter), _setter(setter) { }
QString getValue() const { return _value; }
void setValue(const QString& value) { if (_value != value) { _value = value; emitValueChanged(); } }
void load() override { _value = _getter(); }
void save() const override {
QString oldValue = _getter();
if (_value != oldValue) {
_setter(_value);
}
}
signals:
void valueChanged();
protected:
void emitValueChanged() override { emit valueChanged(); }
QString _value;
const Getter _getter;
const Setter _setter;
};
class SliderPreference : public FloatPreference {
@ -303,7 +345,7 @@ public:
ComboBoxPreference(const QString& category, const QString& name, Getter getter, Setter setter)
: EditPreference(category, name, getter, setter) { }
Type getType() override { return ComboBox; }
const QStringList& getItems() { return _items; }
void setItems(const QStringList& items) { _items = items; }
@ -342,6 +384,9 @@ class CheckPreference : public BoolPreference {
Q_OBJECT
Q_PROPERTY(bool indented READ getIndented CONSTANT)
public:
using Getter = std::function<bool()>;
using Setter = std::function<void(const bool&)>;
CheckPreference(const QString& category, const QString& name, Getter getter, Setter setter)
: BoolPreference(category, name, getter, setter) { }
Type getType() override { return Checkbox; }

View file

@ -17,6 +17,7 @@
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlContext>
#include <QQuickView>
#include <gl/GLHelpers.h>
#include <PathUtils.h>
@ -28,6 +29,7 @@ DockWidget::DockWidget(const QString& title, QWidget* parent) : QDockWidget(titl
auto offscreenUi = DependencyManager::get<OffscreenUi>();
auto qmlEngine = offscreenUi->getSurfaceContext()->engine();
_quickView = std::shared_ptr<QQuickView>(new QQuickView(qmlEngine, nullptr), quickViewDeleter);
_quickView->setFormat(getDefaultOpenGLSurfaceFormat());
QWidget* widget = QWidget::createWindowContainer(_quickView.get());
setWidget(widget);
QWidget* headerWidget = new QWidget();

View file

@ -124,6 +124,10 @@ void OculusDisplayPlugin::uncustomizeContext() {
Parent::uncustomizeContext();
}
gpu::PipelinePointer OculusDisplayPlugin::getCompositeScenePipeline() {
return _SRGBToLinearPipeline;
}
static const uint64_t FRAME_BUDGET = (11 * USECS_PER_MSEC);
static const uint64_t FRAME_OVER_BUDGET = (15 * USECS_PER_MSEC);
@ -163,7 +167,7 @@ void OculusDisplayPlugin::hmdPresent() {
batch.setStateScissorRect(ivec4(uvec2(), _outputFramebuffer->getSize()));
batch.resetViewTransform();
batch.setProjectionTransform(mat4());
batch.setPipeline(_presentPipeline);
batch.setPipeline(_drawTexturePipeline);
batch.setResourceTexture(0, _compositeFramebuffer->getRenderBuffer(0));
batch.draw(gpu::TRIANGLE_STRIP, 4);
});

View file

@ -34,6 +34,8 @@ protected:
void uncustomizeContext() override;
void cycleDebugOutput() override;
virtual gpu::PipelinePointer getCompositeScenePipeline() override;
private:
static const char* NAME;
ovrTextureSwapChain _textureSwapChain;

View file

@ -9,16 +9,17 @@
//
// Helps manage the list of avatars added to the nametag list
//
var EntityMaker = Script.require('./entityMaker.js?' + Date.now());
var entityProps = Script.require('./defaultLocalEntityProps.js?' + Date.now());
var textHelper = new (Script.require('./textHelper.js?' + Date.now()));
var EntityMaker = Script.require('./entityMaker.js');
var entityProps = Script.require('./defaultLocalEntityProps.js');
var textHelper = new (Script.require('./textHelper.js'));
var X = 0;
var Y = 1;
var Z = 2;
var HALF = 0.5;
var CLEAR_ENTITY_EDIT_PROPS = true;
var MILISECONDS_IN_SECOND = 1000;
var SECONDS_IN_MINUTE = 60;
var ALWAYS_ON_MAX_LIFETIME_IN_SECONDS = 20 * SECONDS_IN_MINUTE; // Delete after 20 minutes in case a nametag is hanging around in on mode
// *************************************
// START UTILTY
@ -58,8 +59,6 @@ var distanceScaler = DISTANCE_SCALER_ON;
var userScaler = 1.0;
var DEFAULT_LINE_HEIGHT = entityProps.lineHeight;
function calculateInitialProperties(uuid) {
var avatar = _this.avatars[uuid];
var adjustedScaler = null;
var distance = null;
var dimensions = null;
@ -97,19 +96,6 @@ function calculateInitialProperties(uuid) {
}
// Used in alwaysOn mode to show or hide if they reached the max radius
function showHide(uuid, type) {
var avatar = _this.avatars[uuid];
var nametag = avatar.nametag;
if (type === "show") {
nametag.show();
} else {
nametag.hide();
}
}
// Go through the selected avatar list and see if any of the avatars need a redraw
function checkAllSelectedForRedraw() {
for (var avatar in _this.selectedAvatars) {
@ -168,6 +154,18 @@ function getDistance(uuid, checkAvatar, shouldSave) {
}
// Quick check for distance from avatar
function quickDistanceCheckForNonSelectedAvatars(uuid) {
var source = MyAvatar.position;
var target = AvatarManager.getAvatar(uuid).position;
var avatarDistance = Vec3.distance(target, source);
return avatarDistance;
}
// Check to see if we need to toggle our interval check because we went to 0 avatars
// or if we got our first avatar in the select list
function shouldToggleInterval() {
@ -197,7 +195,9 @@ function toggleInterval() {
}
// handle turning the peristenet mode on
// Handle checking to see if we should add or delete nametags in persistent mode
var alwaysOnAvatarDistanceCheck = false;
var DISTANCE_CHECK_INTERVAL_MS = 1000;
function handleAlwaysOnMode(shouldTurnOnAlwaysOnMode) {
_this.reset();
if (shouldTurnOnAlwaysOnMode) {
@ -205,9 +205,23 @@ function handleAlwaysOnMode(shouldTurnOnAlwaysOnMode) {
.getAvatarIdentifiers()
.forEach(function (avatar) {
if (avatar) {
add(avatar);
var avatarDistance = quickDistanceCheckForNonSelectedAvatars(avatar);
if (avatarDistance < MAX_RADIUS_IGNORE_METERS) {
add(avatar);
}
}
});
maybeClearAlwaysOnAvatarDistanceCheck();
alwaysOnAvatarDistanceCheck = Script.setInterval(maybeAddOrRemoveIntervalCheck, DISTANCE_CHECK_INTERVAL_MS);
}
}
// Check to see if we need to clear the distance check in persistent mode
function maybeClearAlwaysOnAvatarDistanceCheck() {
if (alwaysOnAvatarDistanceCheck) {
Script.clearInterval(alwaysOnAvatarDistanceCheck);
alwaysOnAvatarDistanceCheck = false;
}
}
@ -313,12 +327,6 @@ function makeNameTag(uuid) {
var nameTagPosition = jointInObjectFrame.y + scaledDimenionsYHalf + ABOVE_HEAD_OFFSET;
var localPosition = [0, nameTagPosition, 0];
var visible = true;
if (avatarNametagMode === "alwaysOn") {
var currentDistance = getDistance(uuid, CHECK_AVATAR, false);
visible = currentDistance > MAX_RADIUS_IGNORE_METERS ? false : true;
}
nametag
.add("leftMargin", lineHeight * LEFT_MARGIN_SCALER)
.add("rightMargin", lineHeight * RIGHT_MARGIN_SCALER)
@ -328,7 +336,6 @@ function makeNameTag(uuid) {
.add("dimensions", scaledDimensions)
.add("parentID", parentID)
.add("localPosition", localPosition)
.add("visible", visible)
.create(CLEAR_ENTITY_EDIT_PROPS);
Script.setTimeout(function () {
@ -341,33 +348,45 @@ function makeNameTag(uuid) {
var MAX_RADIUS_IGNORE_METERS = 22;
var MAX_ON_MODE_DISTANCE = 35;
var CHECK_AVATAR = true;
var MIN_DISTANCE = 0.2;
var MIN_DISTANCE_FOR_REDRAW_METERS = 0.1;
function maybeRedraw(uuid) {
var avatar = _this.avatars[uuid];
getAvatarData(uuid);
getDistance(uuid);
var avatarDistance = getDistance(uuid, CHECK_AVATAR, false);
if (avatarNametagMode === "alwaysOn" && avatarDistance > MAX_RADIUS_IGNORE_METERS) {
showHide(uuid, "hide");
}
if (avatarNametagMode === "alwaysOn" && avatarDistance < MAX_RADIUS_IGNORE_METERS) {
showHide(uuid, "show");
}
var distanceDelta = Math.abs(avatar.currentDistance - avatar.previousDistance);
var name = getCorrectName(uuid);
if (avatar.previousName !== name) {
updateName(uuid, name);
} else {
} else if (distanceDelta > MIN_DISTANCE_FOR_REDRAW_METERS) {
redraw(uuid);
}
}
// Check to see if we need to add or remove this avatar during always on mode
function maybeAddOrRemoveIntervalCheck() {
AvatarManager
.getAvatarIdentifiers()
.forEach(function (avatar) {
if (avatar) {
var avatarDistance = quickDistanceCheckForNonSelectedAvatars(avatar);
if (avatar && avatarNametagMode === "alwaysOn" && !(avatar in _this.avatars) && avatarDistance < MAX_RADIUS_IGNORE_METERS) {
add(avatar);
return;
}
if (avatarDistance > MAX_RADIUS_IGNORE_METERS) {
maybeRemove(avatar);
}
}
});
}
// Handle redrawing if needed
var MIN_DISTANCE = 0.1;
function redraw(uuid) {
var avatar = _this.avatars[uuid];
@ -447,7 +466,7 @@ function add(uuid) {
_this.selectedAvatars[uuid] = true;
if (avatarNametagMode === "alwaysOn") {
entityProps.lifetime = -1;
entityProps.lifetime = ALWAYS_ON_MAX_LIFETIME_IN_SECONDS;
} else {
entityProps.lifetime = DEFAULT_LIFETIME;
}
@ -521,16 +540,20 @@ function removeNametag(uuid) {
// #region API
// Create the manager and hook up username signal
// Create the manager.
function create() {
if (avatarNametagMode === "alwaysOn") {
handleAvatarNametagMode("alwaysOn");
}
return _this;
}
// Destory the manager and disconnect from username signal
// Destroy the manager
function destroy() {
_this.reset();
return _this;
}
@ -601,7 +624,9 @@ function maybeRemove(uuid) {
// Check to see if we need to add this user to our list
function maybeAdd(uuid) {
if (uuid && avatarNametagMode === "alwaysOn" && !(uuid in _this.avatars)) {
var avatarDistance = quickDistanceCheckForNonSelectedAvatars(uuid);
if (uuid && avatarNametagMode === "alwaysOn" && !(uuid in _this.avatars) && avatarDistance < MAX_RADIUS_IGNORE_METERS) {
add(uuid);
}
}
@ -628,6 +653,7 @@ function reset() {
removeAllNametags();
_this.avatars = {};
shouldToggleInterval();
maybeClearAlwaysOnAvatarDistanceCheck();
return _this;
}

View file

@ -8,8 +8,8 @@
//
// Click on someone to get a nametag for them
//
var PickRayController = Script.require('./resources/modules/pickRayController.js?' + Date.now());
var NameTagListManager = Script.require('./resources/modules/nameTagListManager.js?' + Date.now());
var PickRayController = Script.require('./resources/modules/pickRayController.js');
var NameTagListManager = Script.require('./resources/modules/nameTagListManager.js');
var pickRayController = new PickRayController();
var nameTagListManager = new NameTagListManager();
@ -31,6 +31,7 @@ function selectAvatar(uuid, intersection) {
// Handles reset of list if you change domains
function onDomainChange() {
nameTagListManager.reset();
nameTagListManager.handleAvatarNametagMode(avatarNametagMode);
}

View file

@ -1,8 +1,8 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtWebChannel 1.0
import "../../controls"
import "../toolbars"
import controls 1.0
import hifi.toolbars 1.0
import QtGraphicalEffects 1.0
import controlsUit 1.0 as HifiControls
import stylesUit 1.0

View file

@ -1,8 +1,8 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtWebChannel 1.0
import "../../controls"
import "../toolbars"
import controls 1.0
import hifi.toolbars 1.0
import QtGraphicalEffects 1.0
import controlsUit 1.0 as HifiControls
import stylesUit 1.0
@ -72,7 +72,7 @@ TabBar {
NewEntityButton {
icon: "icons/create-icons/94-model-01.svg"
icon: "create-icons/94-model-01.svg"
text: "MODEL"
onClicked: {
editRoot.sendToScript({
@ -84,7 +84,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/21-cube-01.svg"
icon: "create-icons/21-cube-01.svg"
text: "SHAPE"
onClicked: {
editRoot.sendToScript({
@ -96,7 +96,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/24-light-01.svg"
icon: "create-icons/24-light-01.svg"
text: "LIGHT"
onClicked: {
editRoot.sendToScript({
@ -108,7 +108,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/20-text-01.svg"
icon: "create-icons/20-text-01.svg"
text: "TEXT"
onClicked: {
editRoot.sendToScript({
@ -120,7 +120,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/image.svg"
icon: "create-icons/image.svg"
text: "IMAGE"
onClicked: {
editRoot.sendToScript({
@ -132,7 +132,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/25-web-1-01.svg"
icon: "create-icons/25-web-1-01.svg"
text: "WEB"
onClicked: {
editRoot.sendToScript({
@ -144,7 +144,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/23-zone-01.svg"
icon: "create-icons/23-zone-01.svg"
text: "ZONE"
onClicked: {
editRoot.sendToScript({
@ -156,7 +156,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/90-particles-01.svg"
icon: "create-icons/90-particles-01.svg"
text: "PARTICLE"
onClicked: {
editRoot.sendToScript({
@ -168,7 +168,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/126-material-01.svg"
icon: "create-icons/126-material-01.svg"
text: "MATERIAL"
onClicked: {
editRoot.sendToScript({

View file

@ -37,7 +37,7 @@ StackView {
}
function pushSource(path) {
var item = Qt.createComponent(Qt.resolvedUrl("../../" + path));
var item = Qt.createComponent(Qt.resolvedUrl(path));
editRoot.push(item, itemProperties,
StackView.Immediate);
editRoot.currentItem.sendToScript.connect(editRoot.sendToScript);

View file

@ -1,8 +1,8 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtWebChannel 1.0
import "../../controls"
import "../toolbars"
import controls 1.0
import hifi.toolbars 1.0
import QtGraphicalEffects 1.0
import controlsUit 1.0 as HifiControls
import stylesUit 1.0
@ -78,7 +78,7 @@ TabBar {
NewEntityButton {
icon: "icons/create-icons/94-model-01.svg"
icon: "create-icons/94-model-01.svg"
text: "MODEL"
onClicked: {
editRoot.sendToScript({
@ -90,7 +90,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/21-cube-01.svg"
icon: "create-icons/21-cube-01.svg"
text: "SHAPE"
onClicked: {
editRoot.sendToScript({
@ -102,7 +102,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/24-light-01.svg"
icon: "create-icons/24-light-01.svg"
text: "LIGHT"
onClicked: {
editRoot.sendToScript({
@ -114,7 +114,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/20-text-01.svg"
icon: "create-icons/20-text-01.svg"
text: "TEXT"
onClicked: {
editRoot.sendToScript({
@ -126,7 +126,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/image.svg"
icon: "create-icons/image.svg"
text: "IMAGE"
onClicked: {
editRoot.sendToScript({
@ -138,7 +138,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/25-web-1-01.svg"
icon: "create-icons/25-web-1-01.svg"
text: "WEB"
onClicked: {
editRoot.sendToScript({
@ -150,7 +150,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/23-zone-01.svg"
icon: "create-icons/23-zone-01.svg"
text: "ZONE"
onClicked: {
editRoot.sendToScript({
@ -162,7 +162,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/90-particles-01.svg"
icon: "create-icons/90-particles-01.svg"
text: "PARTICLE"
onClicked: {
editRoot.sendToScript({
@ -174,7 +174,7 @@ TabBar {
}
NewEntityButton {
icon: "icons/create-icons/126-material-01.svg"
icon: "create-icons/126-material-01.svg"
text: "MATERIAL"
onClicked: {
editRoot.sendToScript({

View file

@ -6,7 +6,7 @@ Item {
id: newEntityButton
property var uuid;
property string text: "ENTITY"
property string icon: "icons/edit-icon.svg"
property string icon: Path.resources + "icons/edit-icon.svg"
property string activeText: newEntityButton.text
property string activeIcon: newEntityButton.icon
property bool isActive: false
@ -47,14 +47,6 @@ Item {
anchors.topMargin: 0
}
function urlHelper(src) {
if (src.match(/\bhttp/)) {
return src;
} else {
return "../../../" + src;
}
}
Rectangle {
id: buttonOutline
color: "#00000000"
@ -96,7 +88,7 @@ Item {
anchors.bottomMargin: 5
anchors.horizontalCenter: parent.horizontalCenter
fillMode: Image.Stretch
source: newEntityButton.urlHelper(newEntityButton.icon)
source: newEntityButton.icon
}
ColorOverlay {

View file

@ -15,7 +15,7 @@ import QtQuick.Dialogs 1.2 as OriginalDialogs
import stylesUit 1.0
import controlsUit 1.0
import "../dialogs"
import dialogs 1.0
Rectangle {
id: newMaterialDialog

View file

@ -14,7 +14,7 @@ import QtQuick.Dialogs 1.2 as OriginalDialogs
import stylesUit 1.0
import controlsUit 1.0
import "../dialogs"
import dialogs 1.0
Rectangle {
id: newModelDialog

View file

Before

Width:  |  Height:  |  Size: 717 B

After

Width:  |  Height:  |  Size: 717 B

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -45,7 +45,7 @@ var MAX_DEFAULT_ENTITY_LIST_HEIGHT = 942;
var DEFAULT_IMAGE = "https://hifi-content.s3.amazonaws.com/DomainContent/production/no-image.jpg";
var createToolsWindow = new CreateWindow(
Script.resourcesPath() + "qml/hifi/tablet/EditTools.qml",
Script.resolvePath("create/EditTools.qml"),
'Create Tools',
'com.highfidelity.create.createToolsWindow',
function () {
@ -812,7 +812,7 @@ var toolBar = (function () {
tablet.screenChanged.connect(function (type, url) {
var isGoingToHomescreenOnDesktop = (!shouldUseEditTabletApp() &&
(url === 'hifi/tablet/TabletHome.qml' || url === ''));
if (isActive && (type !== "QML" || url !== "hifi/tablet/Edit.qml") && !isGoingToHomescreenOnDesktop) {
if (isActive && (type !== "QML" || url !== Script.resolvePath("create/Edit.qml")) && !isGoingToHomescreenOnDesktop) {
that.setActive(false);
}
});
@ -841,10 +841,10 @@ var toolBar = (function () {
if (shouldUseEditTabletApp()) {
// tablet version of new-model dialog
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet.pushOntoStack("hifi/tablet/New" + entityType + "Dialog.qml");
tablet.pushOntoStack(Script.resolvePath("create/New" + entityType + "Dialog.qml"));
} else {
closeExistingDialogWindow();
var qmlPath = Script.resourcesPath() + "qml/hifi/tablet/New" + entityType + "Window.qml";
var qmlPath = Script.resolvePath("create/New" + entityType + "Window.qml");
var DIALOG_WINDOW_SIZE = { x: 500, y: 300 };
dialogWindow = Desktop.createWindow(qmlPath, {
title: "New " + entityType + " Entity",
@ -965,7 +965,7 @@ var toolBar = (function () {
Controller.disableMapping(CONTROLLER_MAPPING_NAME);
} else {
if (shouldUseEditTabletApp()) {
tablet.loadQMLSource("hifi/tablet/Edit.qml", true);
tablet.loadQMLSource(Script.resolvePath("create/Edit.qml"), true);
} else {
// make other apps inactive while in desktop mode
tablet.gotoHomeScreen();

View file

@ -37,7 +37,7 @@ EntityListTool = function(shouldUseEditTabletApp) {
var ENTITY_LIST_WIDTH = 495;
var MAX_DEFAULT_CREATE_TOOLS_HEIGHT = 778;
var entityListWindow = new CreateWindow(
Script.resolvePath("EditEntityList.qml"),
Script.resolvePath("../create/EditEntityList.qml"),
'Entity List',
'com.highfidelity.create.entityListWindow',
function () {

View file

@ -265,8 +265,8 @@ void TestRunnerDesktop::runInstaller() {
folderName += QString(" - ") + getPRNumberFromURL(_url->text());
}
script.write((QString("cp -rf \"$VOLUME/") + folderName + "/interface.app\" \"" + _workingFolder + "/High_Fidelity/\"\n").toStdString().c_str());
script.write((QString("cp -rf \"$VOLUME/") + folderName + "/Sandbox.app\" \"" + _workingFolder + "/High_Fidelity/\"\n").toStdString().c_str());
script.write((QString("cp -Rf \"$VOLUME/") + folderName + "/interface.app\" \"" + _workingFolder + "/High_Fidelity/\"\n").toStdString().c_str());
script.write((QString("cp -Rf \"$VOLUME/") + folderName + "/Sandbox.app\" \"" + _workingFolder + "/High_Fidelity/\"\n").toStdString().c_str());
script.write("hdiutil detach \"$VOLUME\"\n");
script.write("killall yes\n");