Merge pull request #10752 from highfidelity/RC-44-HOTFIX

Build 44.1 Hotfix Fix for lights, crash on switching domains and import objects
This commit is contained in:
Chris Collins 2017-06-20 16:29:49 -07:00 committed by GitHub
commit d55ebe1785
22 changed files with 228 additions and 161 deletions

View file

@ -223,12 +223,21 @@ TransferJob::TransferJob(const GLTexture& parent, uint16_t sourceMip, uint16_t t
// Buffering can invoke disk IO, so it should be off of the main and render threads // Buffering can invoke disk IO, so it should be off of the main and render threads
_bufferingLambda = [=] { _bufferingLambda = [=] {
_mipData = _parent._gpuObject.accessStoredMipFace(sourceMip, face)->createView(_transferSize, _transferOffset); auto mipStorage = _parent._gpuObject.accessStoredMipFace(sourceMip, face);
if (mipStorage) {
_mipData = mipStorage->createView(_transferSize, _transferOffset);
} else {
qCWarning(gpugllogging) << "Buffering failed because mip could not be retrieved from texture " << _parent._source.c_str() ;
}
}; };
_transferLambda = [=] { _transferLambda = [=] {
_parent.copyMipFaceLinesFromTexture(targetMip, face, transferDimensions, lineOffset, internalFormat, format, type, _mipData->size(), _mipData->readData()); if (_mipData) {
_mipData.reset(); _parent.copyMipFaceLinesFromTexture(targetMip, face, transferDimensions, lineOffset, internalFormat, format, type, _mipData->size(), _mipData->readData());
_mipData.reset();
} else {
qCWarning(gpugllogging) << "Transfer failed because mip could not be retrieved from texture " << _parent._source.c_str();
}
}; };
} }

View file

@ -18,7 +18,7 @@
#include <QUrl> #include <QUrl>
#include <shared/Storage.h> #include <shared/Storage.h>
#include <shared/FileCache.h>
#include "Forward.h" #include "Forward.h"
#include "Resource.h" #include "Resource.h"
#include "Metric.h" #include "Metric.h"
@ -311,6 +311,7 @@ public:
class KtxStorage : public Storage { class KtxStorage : public Storage {
public: public:
KtxStorage(const std::string& filename); KtxStorage(const std::string& filename);
KtxStorage(const cache::FilePointer& file);
PixelsPointer getMipFace(uint16 level, uint8 face = 0) const override; PixelsPointer getMipFace(uint16 level, uint8 face = 0) const override;
Size getMipFaceSize(uint16 level, uint8 face = 0) const override; Size getMipFaceSize(uint16 level, uint8 face = 0) const override;
bool isMipAvailable(uint16 level, uint8 face = 0) const override; bool isMipAvailable(uint16 level, uint8 face = 0) const override;
@ -328,6 +329,7 @@ public:
mutable std::weak_ptr<storage::FileStorage> _cacheFile; mutable std::weak_ptr<storage::FileStorage> _cacheFile;
std::string _filename; std::string _filename;
cache::FilePointer _cacheEntry;
std::atomic<uint8_t> _minMipLevelAvailable; std::atomic<uint8_t> _minMipLevelAvailable;
size_t _offsetToMinMipKV; size_t _offsetToMinMipKV;
@ -499,6 +501,7 @@ public:
void setStorage(std::unique_ptr<Storage>& newStorage); void setStorage(std::unique_ptr<Storage>& newStorage);
void setKtxBacking(const std::string& filename); void setKtxBacking(const std::string& filename);
void setKtxBacking(const cache::FilePointer& cacheEntry);
// Usage is a a set of flags providing Semantic about the usage of the Texture. // Usage is a a set of flags providing Semantic about the usage of the Texture.
void setUsage(const Usage& usage) { _usage = usage; } void setUsage(const Usage& usage) { _usage = usage; }
@ -529,8 +532,9 @@ public:
// Serialize a texture into a KTX file // Serialize a texture into a KTX file
static ktx::KTXUniquePointer serialize(const Texture& texture); static ktx::KTXUniquePointer serialize(const Texture& texture);
static TexturePointer build(const ktx::KTXDescriptor& descriptor);
static TexturePointer unserialize(const std::string& ktxFile); static TexturePointer unserialize(const std::string& ktxFile);
static TexturePointer unserialize(const std::string& ktxFile, const ktx::KTXDescriptor& descriptor); static TexturePointer unserialize(const cache::FilePointer& cacheEntry);
static bool evalKTXFormat(const Element& mipFormat, const Element& texelFormat, ktx::Header& header); static bool evalKTXFormat(const Element& mipFormat, const Element& texelFormat, ktx::Header& header);
static bool evalTextureFormat(const ktx::Header& header, Element& mipFormat, Element& texelFormat); static bool evalTextureFormat(const ktx::Header& header, Element& mipFormat, Element& texelFormat);

View file

@ -154,6 +154,10 @@ struct IrradianceKTXPayload {
}; };
const std::string IrradianceKTXPayload::KEY{ "hifi.irradianceSH" }; const std::string IrradianceKTXPayload::KEY{ "hifi.irradianceSH" };
KtxStorage::KtxStorage(const cache::FilePointer& cacheEntry) : KtxStorage(cacheEntry->getFilepath()) {
_cacheEntry = cacheEntry;
}
KtxStorage::KtxStorage(const std::string& filename) : _filename(filename) { KtxStorage::KtxStorage(const std::string& filename) : _filename(filename) {
{ {
// We are doing a lot of work here just to get descriptor data // We are doing a lot of work here just to get descriptor data
@ -295,20 +299,35 @@ void KtxStorage::assignMipFaceData(uint16 level, uint8 face, const storage::Stor
throw std::runtime_error("Invalid call"); throw std::runtime_error("Invalid call");
} }
bool validKtx(const std::string& filename) {
ktx::StoragePointer storage { new storage::FileStorage(filename.c_str()) };
auto ktxPointer = ktx::KTX::create(storage);
if (!ktxPointer) {
return false;
}
return true;
}
void Texture::setKtxBacking(const std::string& filename) { void Texture::setKtxBacking(const std::string& filename) {
// Check the KTX file for validity before using it as backing storage // Check the KTX file for validity before using it as backing storage
{ if (!validKtx(filename)) {
ktx::StoragePointer storage { new storage::FileStorage(filename.c_str()) }; return;
auto ktxPointer = ktx::KTX::create(storage);
if (!ktxPointer) {
return;
}
} }
auto newBacking = std::unique_ptr<Storage>(new KtxStorage(filename)); auto newBacking = std::unique_ptr<Storage>(new KtxStorage(filename));
setStorage(newBacking); setStorage(newBacking);
} }
void Texture::setKtxBacking(const cache::FilePointer& cacheEntry) {
// Check the KTX file for validity before using it as backing storage
if (!validKtx(cacheEntry->getFilepath())) {
return;
}
auto newBacking = std::unique_ptr<Storage>(new KtxStorage(cacheEntry));
setStorage(newBacking);
}
ktx::KTXUniquePointer Texture::serialize(const Texture& texture) { ktx::KTXUniquePointer Texture::serialize(const Texture& texture) {
ktx::Header header; ktx::Header header;
@ -442,21 +461,10 @@ ktx::KTXUniquePointer Texture::serialize(const Texture& texture) {
return ktxBuffer; return ktxBuffer;
} }
TexturePointer Texture::unserialize(const std::string& ktxfile) { TexturePointer Texture::build(const ktx::KTXDescriptor& descriptor) {
std::unique_ptr<ktx::KTX> ktxPointer = ktx::KTX::create(std::make_shared<storage::FileStorage>(ktxfile.c_str()));
if (!ktxPointer) {
return nullptr;
}
ktx::KTXDescriptor descriptor { ktxPointer->toDescriptor() };
return unserialize(ktxfile, ktxPointer->toDescriptor());
}
TexturePointer Texture::unserialize(const std::string& ktxfile, const ktx::KTXDescriptor& descriptor) {
const auto& header = descriptor.header;
Format mipFormat = Format::COLOR_BGRA_32; Format mipFormat = Format::COLOR_BGRA_32;
Format texelFormat = Format::COLOR_SRGBA_32; Format texelFormat = Format::COLOR_SRGBA_32;
const auto& header = descriptor.header;
if (!Texture::evalTextureFormat(header, mipFormat, texelFormat)) { if (!Texture::evalTextureFormat(header, mipFormat, texelFormat)) {
return nullptr; return nullptr;
@ -485,20 +493,19 @@ TexturePointer Texture::unserialize(const std::string& ktxfile, const ktx::KTXDe
} }
auto texture = create(gpuktxKeyValue._usageType, auto texture = create(gpuktxKeyValue._usageType,
type, type,
texelFormat, texelFormat,
header.getPixelWidth(), header.getPixelWidth(),
header.getPixelHeight(), header.getPixelHeight(),
header.getPixelDepth(), header.getPixelDepth(),
1, // num Samples 1, // num Samples
header.getNumberOfSlices(), header.getNumberOfSlices(),
header.getNumberOfLevels(), header.getNumberOfLevels(),
gpuktxKeyValue._samplerDesc); gpuktxKeyValue._samplerDesc);
texture->setUsage(gpuktxKeyValue._usage); texture->setUsage(gpuktxKeyValue._usage);
// Assing the mips availables // Assing the mips availables
texture->setStoredMipFormat(mipFormat); texture->setStoredMipFormat(mipFormat);
texture->setKtxBacking(ktxfile);
IrradianceKTXPayload irradianceKtxKeyValue; IrradianceKTXPayload irradianceKtxKeyValue;
if (IrradianceKTXPayload::findInKeyValues(descriptor.keyValues, irradianceKtxKeyValue)) { if (IrradianceKTXPayload::findInKeyValues(descriptor.keyValues, irradianceKtxKeyValue)) {
@ -508,6 +515,36 @@ TexturePointer Texture::unserialize(const std::string& ktxfile, const ktx::KTXDe
return texture; return texture;
} }
TexturePointer Texture::unserialize(const cache::FilePointer& cacheEntry) {
std::unique_ptr<ktx::KTX> ktxPointer = ktx::KTX::create(std::make_shared<storage::FileStorage>(cacheEntry->getFilepath().c_str()));
if (!ktxPointer) {
return nullptr;
}
auto texture = build(ktxPointer->toDescriptor());
if (texture) {
texture->setKtxBacking(cacheEntry);
}
return texture;
}
TexturePointer Texture::unserialize(const std::string& ktxfile) {
std::unique_ptr<ktx::KTX> ktxPointer = ktx::KTX::create(std::make_shared<storage::FileStorage>(ktxfile.c_str()));
if (!ktxPointer) {
return nullptr;
}
auto texture = build(ktxPointer->toDescriptor());
if (texture) {
texture->setKtxBacking(ktxfile);
}
return texture;
}
bool Texture::evalKTXFormat(const Element& mipFormat, const Element& texelFormat, ktx::Header& header) { bool Texture::evalKTXFormat(const Element& mipFormat, const Element& texelFormat, ktx::Header& header) {
if (texelFormat == Format::COLOR_RGBA_32 && mipFormat == Format::COLOR_BGRA_32) { if (texelFormat == Format::COLOR_RGBA_32 && mipFormat == Format::COLOR_BGRA_32) {
header.setUncompressed(ktx::GLType::UNSIGNED_BYTE, 1, ktx::GLFormat::BGRA, ktx::GLInternalFormat::RGBA8, ktx::GLBaseInternalFormat::RGBA); header.setUncompressed(ktx::GLType::UNSIGNED_BYTE, 1, ktx::GLFormat::BGRA, ktx::GLInternalFormat::RGBA8, ktx::GLBaseInternalFormat::RGBA);

View file

@ -14,7 +14,7 @@
#include <QUrl> #include <QUrl>
#include <FileCache.h> #include <shared/FileCache.h>
namespace ktx { namespace ktx {
class KTX; class KTX;

View file

@ -612,9 +612,10 @@ void NetworkTexture::maybeHandleFinishedInitialLoad() {
if (!texture) { if (!texture) {
KTXFilePointer ktxFile = textureCache->_ktxCache.getFile(hash); KTXFilePointer ktxFile = textureCache->_ktxCache.getFile(hash);
if (ktxFile) { if (ktxFile) {
texture = gpu::Texture::unserialize(ktxFile->getFilepath()); texture = gpu::Texture::unserialize(ktxFile);
if (texture) { if (texture) {
texture = textureCache->cacheTextureByHash(hash, texture); texture = textureCache->cacheTextureByHash(hash, texture);
_file = ktxFile;
} }
} }
} }
@ -644,8 +645,8 @@ void NetworkTexture::maybeHandleFinishedInitialLoad() {
auto newKtxDescriptor = memKtx->toDescriptor(); auto newKtxDescriptor = memKtx->toDescriptor();
texture = gpu::Texture::unserialize(_file->getFilepath(), newKtxDescriptor); texture = gpu::Texture::build(newKtxDescriptor);
texture->setKtxBacking(file->getFilepath()); texture->setKtxBacking(file);
texture->setSource(filename); texture->setSource(filename);
auto& images = _originalKtxDescriptor->images; auto& images = _originalKtxDescriptor->images;
@ -796,7 +797,7 @@ void ImageReader::read() {
if (!texture) { if (!texture) {
KTXFilePointer ktxFile = textureCache->_ktxCache.getFile(hash); KTXFilePointer ktxFile = textureCache->_ktxCache.getFile(hash);
if (ktxFile) { if (ktxFile) {
texture = gpu::Texture::unserialize(ktxFile->getFilepath()); texture = gpu::Texture::unserialize(ktxFile);
if (texture) { if (texture) {
texture = textureCache->cacheTextureByHash(hash, texture); texture = textureCache->cacheTextureByHash(hash, texture);
} else { } else {
@ -848,7 +849,7 @@ void ImageReader::read() {
if (!networkTexture->_file) { if (!networkTexture->_file) {
qCWarning(modelnetworking) << _url << "file cache failed"; qCWarning(modelnetworking) << _url << "file cache failed";
} else { } else {
texture->setKtxBacking(networkTexture->_file->getFilepath()); texture->setKtxBacking(networkTexture->_file);
} }
} else { } else {
qCWarning(modelnetworking) << "Unable to serialize texture to KTX " << _url; qCWarning(modelnetworking) << "Unable to serialize texture to KTX " << _url;

View file

@ -548,6 +548,7 @@ glm::ivec3 LightClusters::updateClusters() {
LightClusteringPass::LightClusteringPass() { LightClusteringPass::LightClusteringPass() {
_lightClusters = std::make_shared<LightClusters>();
} }
@ -566,12 +567,7 @@ void LightClusteringPass::run(const render::RenderContextPointer& renderContext,
auto deferredTransform = inputs.get0(); auto deferredTransform = inputs.get0();
auto lightingModel = inputs.get1(); auto lightingModel = inputs.get1();
auto surfaceGeometryFramebuffer = inputs.get2(); auto surfaceGeometryFramebuffer = inputs.get2();
if (!_lightClusters) {
_lightClusters = std::make_shared<LightClusters>();
}
// first update the Grid with the new frustum // first update the Grid with the new frustum
if (!_freeze) { if (!_freeze) {
_lightClusters->updateFrustum(args->getViewFrustum()); _lightClusters->updateFrustum(args->getViewFrustum());

View file

@ -21,8 +21,8 @@
#include <QtCore/QSaveFile> #include <QtCore/QSaveFile>
#include <QtCore/QStorageInfo> #include <QtCore/QStorageInfo>
#include <PathUtils.h> #include "../PathUtils.h"
#include <NumericalConstants.h> #include "../NumericalConstants.h"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <sys/utime.h> #include <sys/utime.h>
@ -132,9 +132,16 @@ FilePointer FileCache::addFile(Metadata&& metadata, const std::string& filepath)
} }
FilePointer FileCache::writeFile(const char* data, File::Metadata&& metadata, bool overwrite) { FilePointer FileCache::writeFile(const char* data, File::Metadata&& metadata, bool overwrite) {
FilePointer file;
if (0 == metadata.length) {
qCWarning(file_cache) << "Cannot store empty files in the cache";
return file;
}
Lock lock(_mutex); Lock lock(_mutex);
FilePointer file;
if (!_initialized) { if (!_initialized) {
qCWarning(file_cache) << "File cache used before initialization"; qCWarning(file_cache) << "File cache used before initialization";
return file; return file;

View file

@ -143,7 +143,7 @@ public:
const Key& getKey() const { return _key; } const Key& getKey() const { return _key; }
const size_t& getLength() const { return _length; } const size_t& getLength() const { return _length; }
std::string getFilepath() const { return _filepath; } const std::string& getFilepath() const { return _filepath; }
virtual ~File(); virtual ~File();
/// overrides should call File::deleter to maintain caching behavior /// overrides should call File::deleter to maintain caching behavior

View file

@ -13,6 +13,7 @@ import "configSlider"
import "../lib/plotperf" import "../lib/plotperf"
Column { Column {
property var mainViewTask: Render.getConfig("RenderMainView")
spacing: 8 spacing: 8
Column { Column {
id: surfaceGeometry id: surfaceGeometry
@ -32,7 +33,7 @@ Column {
ConfigSlider { ConfigSlider {
label: qsTr(modelData.split(":")[0]) label: qsTr(modelData.split(":")[0])
integral: (modelData.split(":")[3] == 'true') integral: (modelData.split(":")[3] == 'true')
config: Render.getConfig("AmbientOcclusion") config: mainViewTask.getConfig("AmbientOcclusion")
property: modelData.split(":")[1] property: modelData.split(":")[1]
max: modelData.split(":")[2] max: modelData.split(":")[2]
min: 0.0 min: 0.0
@ -50,8 +51,8 @@ Column {
] ]
CheckBox { CheckBox {
text: qsTr(modelData.split(":")[0]) text: qsTr(modelData.split(":")[0])
checked: Render.getConfig("AmbientOcclusion")[modelData.split(":")[1]] checked: mainViewTask.getConfig("AmbientOcclusion")[modelData.split(":")[1]]
onCheckedChanged: { Render.getConfig("AmbientOcclusion")[modelData.split(":")[1]] = checked } onCheckedChanged: { mainViewTask.getConfig("AmbientOcclusion")[modelData.split(":")[1]] = checked }
} }
} }
} }
@ -62,8 +63,8 @@ Column {
] ]
CheckBox { CheckBox {
text: qsTr(modelData.split(":")[0]) text: qsTr(modelData.split(":")[0])
checked: Render.getConfig("DebugAmbientOcclusion")[modelData.split(":")[1]] checked: mainViewTask.getConfig("DebugAmbientOcclusion")[modelData.split(":")[1]]
onCheckedChanged: { Render.getConfig("DebugAmbientOcclusion")[modelData.split(":")[1]] = checked } onCheckedChanged: { mainViewTask.getConfig("DebugAmbientOcclusion")[modelData.split(":")[1]] = checked }
} }
} }
} }
@ -72,7 +73,7 @@ Column {
PlotPerf { PlotPerf {
title: "Timing" title: "Timing"
height: 50 height: 50
object: Render.getConfig("AmbientOcclusion") object: mainViewTask.getConfig("AmbientOcclusion")
valueUnit: "ms" valueUnit: "ms"
valueScale: 1 valueScale: 1
valueNumDigits: "3" valueNumDigits: "3"

View file

@ -14,8 +14,9 @@ import "configSlider"
Column { Column {
id: root id: root
spacing: 8 spacing: 8
property var sceneOctree: Render.getConfig("DrawSceneOctree"); property var mainViewTask: Render.getConfig("RenderMainView");
property var itemSelection: Render.getConfig("DrawItemSelection"); property var sceneOctree: mainViewTask.getConfig("DrawSceneOctree");
property var itemSelection: mainViewTask.getConfig("DrawItemSelection");
Component.onCompleted: { Component.onCompleted: {
sceneOctree.enabled = true; sceneOctree.enabled = true;
@ -30,8 +31,8 @@ Column {
Component.onDestruction: { Component.onDestruction: {
sceneOctree.enabled = false; sceneOctree.enabled = false;
itemSelection.enabled = false; itemSelection.enabled = false;
Render.getConfig("FetchSceneSelection").freezeFrustum = false; mainViewTask.getConfig("FetchSceneSelection").freezeFrustum = false;
Render.getConfig("CullSceneSelection").freezeFrustum = false; mainViewTask.getConfig("CullSceneSelection").freezeFrustum = false;
} }
GroupBox { GroupBox {
@ -45,8 +46,8 @@ Column {
text: "Freeze Culling Frustum" text: "Freeze Culling Frustum"
checked: false checked: false
onCheckedChanged: { onCheckedChanged: {
Render.getConfig("FetchSceneSelection").freezeFrustum = checked; mainViewTask.getConfig("FetchSceneSelection").freezeFrustum = checked;
Render.getConfig("CullSceneSelection").freezeFrustum = checked; mainViewTask.getConfig("CullSceneSelection").freezeFrustum = checked;
} }
} }
Label { Label {
@ -103,7 +104,7 @@ Column {
ConfigSlider { ConfigSlider {
label: qsTr(modelData.split(":")[0]) label: qsTr(modelData.split(":")[0])
integral: true integral: true
config: Render.getConfig(modelData.split(":")[1]) config: mainViewTask.getConfig(modelData.split(":")[1])
property: "maxDrawn" property: "maxDrawn"
max: config.numDrawn max: config.numDrawn
min: -1 min: -1

View file

@ -34,5 +34,5 @@ function setDebugCursor(x, y) {
nx = (x / Window.innerWidth); nx = (x / Window.innerWidth);
ny = 1.0 - ((y) / (Window.innerHeight - 32)); ny = 1.0 - ((y) / (Window.innerHeight - 32));
Render.getConfig("DebugAmbientOcclusion").debugCursorTexcoord = { x: nx, y: ny }; Render.getConfig("RenderMainView").getConfig("DebugAmbientOcclusion").debugCursorTexcoord = { x: nx, y: ny };
} }

View file

@ -33,5 +33,5 @@ function setDebugCursor(x, y) {
nx = (x / Window.innerWidth); nx = (x / Window.innerWidth);
ny = 1.0 - ((y) / (Window.innerHeight - 32)); ny = 1.0 - ((y) / (Window.innerHeight - 32));
Render.getConfig("DebugScattering").debugCursorTexcoord = { x: nx, y: ny }; Render.getConfig("RenderMainView").getConfig("DebugScattering").debugCursorTexcoord = { x: nx, y: ny };
} }

View file

@ -13,6 +13,7 @@ import "configSlider"
Column { Column {
spacing: 8 spacing: 8
property var mainViewTask: Render.getConfig("RenderMainView")
Row { Row {
spacing: 8 spacing: 8
@ -29,8 +30,8 @@ Column {
] ]
CheckBox { CheckBox {
text: modelData.split(":")[0] text: modelData.split(":")[0]
checked: Render.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] checked: mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]]
onCheckedChanged: { Render.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } onCheckedChanged: { mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked }
} }
} }
} }
@ -49,8 +50,8 @@ Column {
] ]
CheckBox { CheckBox {
text: modelData.split(":")[0] text: modelData.split(":")[0]
checked: Render.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] checked: mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]]
onCheckedChanged: { Render.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } onCheckedChanged: { mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked }
} }
} }
} }
@ -69,8 +70,8 @@ Column {
] ]
CheckBox { CheckBox {
text: modelData.split(":")[0] text: modelData.split(":")[0]
checked: Render.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] checked: mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]]
onCheckedChanged: { Render.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } onCheckedChanged: { mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked }
} }
} }
} }
@ -83,7 +84,7 @@ Column {
ConfigSlider { ConfigSlider {
label: qsTr(modelData.split(":")[0]) label: qsTr(modelData.split(":")[0])
integral: false integral: false
config: Render.getConfig(modelData.split(":")[1]) config: mainViewTask.getConfig(modelData.split(":")[1])
property: modelData.split(":")[2] property: modelData.split(":")[2]
max: modelData.split(":")[3] max: modelData.split(":")[3]
min: modelData.split(":")[4] min: modelData.split(":")[4]
@ -107,7 +108,7 @@ Column {
ListElement { text: "Filmic"; color: "White" } ListElement { text: "Filmic"; color: "White" }
} }
width: 200 width: 200
onCurrentIndexChanged: { Render.getConfig("ToneMapping")["curve"] = currentIndex } onCurrentIndexChanged: { mainViewTask.getConfig("ToneMapping")["curve"] = currentIndex }
} }
} }
} }
@ -120,7 +121,7 @@ Column {
anchors.left: root.left anchors.left: root.left
} }
property var config: Render.getConfig("DebugDeferredBuffer") property var config: mainViewTask.getConfig("DebugDeferredBuffer")
function setDebugMode(mode) { function setDebugMode(mode) {
framebuffer.config.enabled = (mode != 0); framebuffer.config.enabled = (mode != 0);
@ -168,40 +169,40 @@ Column {
CheckBox { CheckBox {
text: "Opaques" text: "Opaques"
checked: Render.getConfig("DrawOpaqueBounds")["enabled"] checked: mainViewTask.getConfig("DrawOpaqueBounds")["enabled"]
onCheckedChanged: { Render.getConfig("DrawOpaqueBounds")["enabled"] = checked } onCheckedChanged: { mainViewTask.getConfig("DrawOpaqueBounds")["enabled"] = checked }
} }
CheckBox { CheckBox {
text: "Transparents" text: "Transparents"
checked: Render.getConfig("DrawTransparentBounds")["enabled"] checked: mainViewTask.getConfig("DrawTransparentBounds")["enabled"]
onCheckedChanged: { Render.getConfig("DrawTransparentBounds")["enabled"] = checked } onCheckedChanged: { mainViewTask.getConfig("DrawTransparentBounds")["enabled"] = checked }
} }
CheckBox { CheckBox {
text: "Overlay Opaques" text: "Overlay Opaques"
checked: Render.getConfig("DrawOverlayOpaqueBounds")["enabled"] checked: mainViewTask.getConfig("DrawOverlayOpaqueBounds")["enabled"]
onCheckedChanged: { Render.getConfig("DrawOverlayOpaqueBounds")["enabled"] = checked } onCheckedChanged: { mainViewTask.getConfig("DrawOverlayOpaqueBounds")["enabled"] = checked }
} }
CheckBox { CheckBox {
text: "Overlay Transparents" text: "Overlay Transparents"
checked: Render.getConfig("DrawOverlayTransparentBounds")["enabled"] checked: mainViewTask.getConfig("DrawOverlayTransparentBounds")["enabled"]
onCheckedChanged: { Render.getConfig("DrawOverlayTransparentBounds")["enabled"] = checked } onCheckedChanged: { mainViewTask.getConfig("DrawOverlayTransparentBounds")["enabled"] = checked }
} }
} }
Column { Column {
CheckBox { CheckBox {
text: "Metas" text: "Metas"
checked: Render.getConfig("DrawMetaBounds")["enabled"] checked: mainViewTask.getConfig("DrawMetaBounds")["enabled"]
onCheckedChanged: { Render.getConfig("DrawMetaBounds")["enabled"] = checked } onCheckedChanged: { mainViewTask.getConfig("DrawMetaBounds")["enabled"] = checked }
} }
CheckBox { CheckBox {
text: "Lights" text: "Lights"
checked: Render.getConfig("DrawLightBounds")["enabled"] checked: mainViewTask.getConfig("DrawLightBounds")["enabled"]
onCheckedChanged: { Render.getConfig("DrawLightBounds")["enabled"] = checked; } onCheckedChanged: { mainViewTask.getConfig("DrawLightBounds")["enabled"] = checked; }
} }
CheckBox { CheckBox {
text: "Zones" text: "Zones"
checked: Render.getConfig("DrawZones")["enabled"] checked: mainViewTask.getConfig("DrawZones")["enabled"]
onCheckedChanged: { Render.getConfig("ZoneRenderer")["enabled"] = checked; Render.getConfig("DrawZones")["enabled"] = checked; } onCheckedChanged: { mainViewTask.getConfig("ZoneRenderer")["enabled"] = checked; mainViewTask.getConfig("DrawZones")["enabled"] = checked; }
} }
} }
} }

View file

@ -17,18 +17,19 @@ Column {
Column { Column {
id: lightClustering id: lightClustering
spacing: 10 spacing: 10
property var mainViewTask: Render.getConfig("RenderMainView");
Column{ Column{
PlotPerf { PlotPerf {
title: "Light CLustering Timing" title: "Light CLustering Timing"
height: 50 height: 50
object: Render.getConfig("LightClustering") object: mainViewTask.getConfig("LightClustering")
valueUnit: "ms" valueUnit: "ms"
valueScale: 1 valueScale: 1
valueNumDigits: "4" valueNumDigits: "4"
plots: [ plots: [
{ {
object: Render.getConfig("LightClustering"), object: mainViewTask.getConfig("LightClustering"),
prop: "cpuRunTime", prop: "cpuRunTime",
label: "time", label: "time",
scale: 1, scale: 1,
@ -40,19 +41,19 @@ Column {
PlotPerf { PlotPerf {
title: "Lights" title: "Lights"
height: 50 height: 50
object: Render.getConfig("LightClustering") object: mainViewTask.getConfig("LightClustering")
valueUnit: "" valueUnit: ""
valueScale: 1 valueScale: 1
valueNumDigits: "0" valueNumDigits: "0"
plots: [ plots: [
{ {
object: Render.getConfig("LightClustering"), object: mainViewTask.getConfig("LightClustering"),
prop: "numClusteredLights", prop: "numClusteredLights",
label: "visible", label: "visible",
color: "#D959FE" color: "#D959FE"
}, },
{ {
object: Render.getConfig("LightClustering"), object: mainViewTask.getConfig("LightClustering"),
prop: "numInputLights", prop: "numInputLights",
label: "input", label: "input",
color: "#FED959" color: "#FED959"
@ -63,25 +64,25 @@ Column {
PlotPerf { PlotPerf {
title: "Scene Lights" title: "Scene Lights"
height: 80 height: 80
object: Render.getConfig("LightClustering") object: mainViewTask.getConfig("LightClustering")
valueUnit: "" valueUnit: ""
valueScale: 1 valueScale: 1
valueNumDigits: "0" valueNumDigits: "0"
plots: [ plots: [
{ {
object: Render.getConfig("LightClustering"), object: mainViewTask.getConfig("LightClustering"),
prop: "numSceneLights", prop: "numSceneLights",
label: "current", label: "current",
color: "#00B4EF" color: "#00B4EF"
}, },
{ {
object: Render.getConfig("LightClustering"), object: mainViewTask.getConfig("LightClustering"),
prop: "numFreeSceneLights", prop: "numFreeSceneLights",
label: "free", label: "free",
color: "#1AC567" color: "#1AC567"
}, },
{ {
object: Render.getConfig("LightClustering"), object: mainViewTask.getConfig("LightClustering"),
prop: "numAllocatedSceneLights", prop: "numAllocatedSceneLights",
label: "allocated", label: "allocated",
color: "#9495FF" color: "#9495FF"
@ -92,7 +93,7 @@ Column {
ConfigSlider { ConfigSlider {
label: qsTr("Range Near [m]") label: qsTr("Range Near [m]")
integral: false integral: false
config: Render.getConfig("LightClustering") config: mainViewTask.getConfig("LightClustering")
property: "rangeNear" property: "rangeNear"
max: 20.0 max: 20.0
min: 0.1 min: 0.1
@ -100,7 +101,7 @@ Column {
ConfigSlider { ConfigSlider {
label: qsTr("Range Far [m]") label: qsTr("Range Far [m]")
integral: false integral: false
config: Render.getConfig("LightClustering") config: mainViewTask.getConfig("LightClustering")
property: "rangeFar" property: "rangeFar"
max: 500.0 max: 500.0
min: 100.0 min: 100.0
@ -108,7 +109,7 @@ Column {
ConfigSlider { ConfigSlider {
label: qsTr("Grid X") label: qsTr("Grid X")
integral: true integral: true
config: Render.getConfig("LightClustering") config: mainViewTask.getConfig("LightClustering")
property: "dimX" property: "dimX"
max: 32 max: 32
min: 1 min: 1
@ -116,7 +117,7 @@ Column {
ConfigSlider { ConfigSlider {
label: qsTr("Grid Y") label: qsTr("Grid Y")
integral: true integral: true
config: Render.getConfig("LightClustering") config: mainViewTask.getConfig("LightClustering")
property: "dimY" property: "dimY"
max: 32 max: 32
min: 1 min: 1
@ -124,33 +125,33 @@ Column {
ConfigSlider { ConfigSlider {
label: qsTr("Grid Z") label: qsTr("Grid Z")
integral: true integral: true
config: Render.getConfig("LightClustering") config: mainViewTask.getConfig("LightClustering")
property: "dimZ" property: "dimZ"
max: 31 max: 31
min: 1 min: 1
} }
CheckBox { CheckBox {
text: "Freeze" text: "Freeze"
checked: Render.getConfig("LightClustering")["freeze"] checked: mainViewTask.getConfig("LightClustering")["freeze"]
onCheckedChanged: { Render.getConfig("LightClustering")["freeze"] = checked } onCheckedChanged: { mainViewTask.getConfig("LightClustering")["freeze"] = checked }
} }
CheckBox { CheckBox {
text: "Draw Grid" text: "Draw Grid"
checked: Render.getConfig("DebugLightClusters")["doDrawGrid"] checked: mainViewTask.getConfig("DebugLightClusters")["doDrawGrid"]
onCheckedChanged: { Render.getConfig("DebugLightClusters")["doDrawGrid"] = checked } onCheckedChanged: { mainViewTask.getConfig("DebugLightClusters")["doDrawGrid"] = checked }
} }
CheckBox { CheckBox {
text: "Draw Cluster From Depth" text: "Draw Cluster From Depth"
checked: Render.getConfig("DebugLightClusters")["doDrawClusterFromDepth"] checked: mainViewTask.getConfig("DebugLightClusters")["doDrawClusterFromDepth"]
onCheckedChanged: { Render.getConfig("DebugLightClusters")["doDrawClusterFromDepth"] = checked } onCheckedChanged: { mainViewTask.getConfig("DebugLightClusters")["doDrawClusterFromDepth"] = checked }
} }
CheckBox { CheckBox {
text: "Draw Content" text: "Draw Content"
checked: Render.getConfig("DebugLightClusters")["doDrawContent"] checked: mainViewTask.getConfig("DebugLightClusters")["doDrawContent"]
onCheckedChanged: { Render.getConfig("DebugLightClusters")["doDrawContent"] = checked } onCheckedChanged: { mainViewTask.getConfig("DebugLightClusters")["doDrawContent"] = checked }
} }
Label { Label {
text: "Num Cluster Items = " + Render.getConfig("LightClustering")["numClusteredLightReferences"].toFixed(0) text: "Num Cluster Items = " + mainViewTask.getConfig("LightClustering")["numClusteredLightReferences"].toFixed(0)
} }
} }

View file

@ -21,7 +21,8 @@ Item {
spacing: 8 spacing: 8
anchors.fill:parent anchors.fill:parent
property var config: Render.getConfig("Stats") property var mainViewTask: Render.getConfig("RenderMainView");
property var config: mainViewTask.getConfig("Stats")
function evalEvenHeight() { function evalEvenHeight() {
// Why do we have to do that manually ? cannot seem to find a qml / anchor / layout mode that does that ? // Why do we have to do that manually ? cannot seem to find a qml / anchor / layout mode that does that ?
@ -182,9 +183,9 @@ Item {
] ]
} }
property var drawOpaqueConfig: Render.getConfig("DrawOpaqueDeferred") property var drawOpaqueConfig: mainViewTask.getConfig("DrawOpaqueDeferred")
property var drawTransparentConfig: Render.getConfig("DrawTransparentDeferred") property var drawTransparentConfig: mainViewTask.getConfig("DrawTransparentDeferred")
property var drawLightConfig: Render.getConfig("DrawLight") property var drawLightConfig: mainViewTask.getConfig("DrawLight")
PlotPerf { PlotPerf {
title: "Items" title: "Items"
@ -199,13 +200,13 @@ Item {
color: "#1AC567" color: "#1AC567"
}, },
{ {
object: Render.getConfig("DrawTransparentDeferred"), object: mainViewTask.getConfig("DrawTransparentDeferred"),
prop: "numDrawn", prop: "numDrawn",
label: "Translucents", label: "Translucents",
color: "#00B4EF" color: "#00B4EF"
}, },
{ {
object: Render.getConfig("DrawLight"), object: mainViewTask.getConfig("DrawLight"),
prop: "numDrawn", prop: "numDrawn",
label: "Lights", label: "Lights",
color: "#FED959" color: "#FED959"
@ -222,25 +223,25 @@ Item {
valueNumDigits: "2" valueNumDigits: "2"
plots: [ plots: [
{ {
object: Render.getConfig("DrawOpaqueDeferred"), object: mainViewTask.getConfig("DrawOpaqueDeferred"),
prop: "cpuRunTime", prop: "cpuRunTime",
label: "Opaques", label: "Opaques",
color: "#1AC567" color: "#1AC567"
}, },
{ {
object: Render.getConfig("DrawTransparentDeferred"), object: mainViewTask.getConfig("DrawTransparentDeferred"),
prop: "cpuRunTime", prop: "cpuRunTime",
label: "Translucents", label: "Translucents",
color: "#00B4EF" color: "#00B4EF"
}, },
{ {
object: Render.getConfig("RenderDeferred"), object: mainViewTask.getConfig("RenderDeferred"),
prop: "cpuRunTime", prop: "cpuRunTime",
label: "Lighting", label: "Lighting",
color: "#FED959" color: "#FED959"
}, },
{ {
object: Render.getConfig("RenderDeferredTask"), object: mainViewTask.getConfig("RenderDeferredTask"),
prop: "cpuRunTime", prop: "cpuRunTime",
label: "RenderFrame", label: "RenderFrame",
color: "#E2334D" color: "#E2334D"

View file

@ -21,7 +21,8 @@ Item {
spacing: 8 spacing: 8
anchors.fill:parent anchors.fill:parent
property var config: Render.getConfig("Stats") property var mainViewTask: Render.getConfig("RenderMainView");
property var config: mainViewTask.getConfig("Stats")
function evalEvenHeight() { function evalEvenHeight() {
// Why do we have to do that manually ? cannot seem to find a qml / anchor / layout mode that does that ? // Why do we have to do that manually ? cannot seem to find a qml / anchor / layout mode that does that ?
@ -38,31 +39,31 @@ Item {
valueNumDigits: "4" valueNumDigits: "4"
plots: [ plots: [
{ {
object: Render.getConfig("OpaqueRangeTimer"), object: mainViewTask.getConfig("OpaqueRangeTimer"),
prop: "gpuRunTime", prop: "gpuRunTime",
label: "Opaque", label: "Opaque",
color: "#FFFFFF" color: "#FFFFFF"
}, },
{ {
object: Render.getConfig("LinearDepth"), object: mainViewTask.getConfig("LinearDepth"),
prop: "gpuRunTime", prop: "gpuRunTime",
label: "LinearDepth", label: "LinearDepth",
color: "#00FF00" color: "#00FF00"
},{ },{
object: Render.getConfig("SurfaceGeometry"), object: mainViewTask.getConfig("SurfaceGeometry"),
prop: "gpuRunTime", prop: "gpuRunTime",
label: "SurfaceGeometry", label: "SurfaceGeometry",
color: "#00FFFF" color: "#00FFFF"
}, },
{ {
object: Render.getConfig("RenderDeferred"), object: mainViewTask.getConfig("RenderDeferred"),
prop: "gpuRunTime", prop: "gpuRunTime",
label: "DeferredLighting", label: "DeferredLighting",
color: "#FF00FF" color: "#FF00FF"
} }
, ,
{ {
object: Render.getConfig("ToneAndPostRangeTimer"), object: mainViewTask.getConfig("ToneAndPostRangeTimer"),
prop: "gpuRunTime", prop: "gpuRunTime",
label: "tone and post", label: "tone and post",
color: "#FF0000" color: "#FF0000"
@ -78,31 +79,31 @@ Item {
valueNumDigits: "3" valueNumDigits: "3"
plots: [ plots: [
{ {
object: Render.getConfig("OpaqueRangeTimer"), object: mainViewTask.getConfig("OpaqueRangeTimer"),
prop: "batchRunTime", prop: "batchRunTime",
label: "Opaque", label: "Opaque",
color: "#FFFFFF" color: "#FFFFFF"
}, },
{ {
object: Render.getConfig("LinearDepth"), object: mainViewTask.getConfig("LinearDepth"),
prop: "batchRunTime", prop: "batchRunTime",
label: "LinearDepth", label: "LinearDepth",
color: "#00FF00" color: "#00FF00"
},{ },{
object: Render.getConfig("SurfaceGeometry"), object: mainViewTask.getConfig("SurfaceGeometry"),
prop: "batchRunTime", prop: "batchRunTime",
label: "SurfaceGeometry", label: "SurfaceGeometry",
color: "#00FFFF" color: "#00FFFF"
}, },
{ {
object: Render.getConfig("RenderDeferred"), object: mainViewTask.getConfig("RenderDeferred"),
prop: "batchRunTime", prop: "batchRunTime",
label: "DeferredLighting", label: "DeferredLighting",
color: "#FF00FF" color: "#FF00FF"
} }
, ,
{ {
object: Render.getConfig("ToneAndPostRangeTimer"), object: mainViewTask.getConfig("ToneAndPostRangeTimer"),
prop: "batchRunTime", prop: "batchRunTime",
label: "tone and post", label: "tone and post",
color: "#FF0000" color: "#FF0000"

View file

@ -16,28 +16,29 @@ Column {
Column { Column {
id: scattering id: scattering
spacing: 10 spacing: 10
property var mainViewTask: Render.getConfig("RenderMainView");
Column{ Column{
CheckBox { CheckBox {
text: "Scattering" text: "Scattering"
checked: Render.getConfig("Scattering").enableScattering checked: mainViewTask.getConfig("Scattering").enableScattering
onCheckedChanged: { Render.getConfig("Scattering").enableScattering = checked } onCheckedChanged: { mainViewTask.getConfig("Scattering").enableScattering = checked }
} }
CheckBox { CheckBox {
text: "Show Scattering BRDF" text: "Show Scattering BRDF"
checked: Render.getConfig("Scattering").showScatteringBRDF checked: mainViewTask.getConfig("Scattering").showScatteringBRDF
onCheckedChanged: { Render.getConfig("Scattering").showScatteringBRDF = checked } onCheckedChanged: { mainViewTask.getConfig("Scattering").showScatteringBRDF = checked }
} }
CheckBox { CheckBox {
text: "Show Curvature" text: "Show Curvature"
checked: Render.getConfig("Scattering").showCurvature checked: mainViewTask.getConfig("Scattering").showCurvature
onCheckedChanged: { Render.getConfig("Scattering").showCurvature = checked } onCheckedChanged: { mainViewTask.getConfig("Scattering").showCurvature = checked }
} }
CheckBox { CheckBox {
text: "Show Diffused Normal" text: "Show Diffused Normal"
checked: Render.getConfig("Scattering").showDiffusedNormal checked: mainViewTask.getConfig("Scattering").showDiffusedNormal
onCheckedChanged: { Render.getConfig("Scattering").showDiffusedNormal = checked } onCheckedChanged: { mainViewTask.getConfig("Scattering").showDiffusedNormal = checked }
} }
Repeater { Repeater {
model: [ "Scattering Bent Red:Scattering:bentRed:2.0", model: [ "Scattering Bent Red:Scattering:bentRed:2.0",
@ -50,7 +51,7 @@ Column {
ConfigSlider { ConfigSlider {
label: qsTr(modelData.split(":")[0]) label: qsTr(modelData.split(":")[0])
integral: false integral: false
config: Render.getConfig(modelData.split(":")[1]) config: mainViewTask.getConfig(modelData.split(":")[1])
property: modelData.split(":")[2] property: modelData.split(":")[2]
max: modelData.split(":")[3] max: modelData.split(":")[3]
min: 0.0 min: 0.0
@ -58,23 +59,23 @@ Column {
} }
CheckBox { CheckBox {
text: "Scattering Profile" text: "Scattering Profile"
checked: Render.getConfig("DebugScattering").showProfile checked: mainViewTask.getConfig("DebugScattering").showProfile
onCheckedChanged: { Render.getConfig("DebugScattering").showProfile = checked } onCheckedChanged: { mainViewTask.getConfig("DebugScattering").showProfile = checked }
} }
CheckBox { CheckBox {
text: "Scattering Table" text: "Scattering Table"
checked: Render.getConfig("DebugScattering").showLUT checked: mainViewTask.getConfig("DebugScattering").showLUT
onCheckedChanged: { Render.getConfig("DebugScattering").showLUT = checked } onCheckedChanged: { mainViewTask.getConfig("DebugScattering").showLUT = checked }
} }
CheckBox { CheckBox {
text: "Cursor Pixel" text: "Cursor Pixel"
checked: Render.getConfig("DebugScattering").showCursorPixel checked: mainViewTask.getConfig("DebugScattering").showCursorPixel
onCheckedChanged: { Render.getConfig("DebugScattering").showCursorPixel = checked } onCheckedChanged: { mainViewTask.getConfig("DebugScattering").showCursorPixel = checked }
} }
CheckBox { CheckBox {
text: "Skin Specular Beckmann" text: "Skin Specular Beckmann"
checked: Render.getConfig("DebugScattering").showSpecularTable checked: mainViewTask.getConfig("DebugScattering").showSpecularTable
onCheckedChanged: { Render.getConfig("DebugScattering").showSpecularTable = checked } onCheckedChanged: { mainViewTask.getConfig("DebugScattering").showSpecularTable = checked }
} }
} }
} }

View file

@ -16,12 +16,13 @@ Column {
Column { Column {
id: surfaceGeometry id: surfaceGeometry
spacing: 10 spacing: 10
property var mainViewTask: Render.getConfig("RenderMainView");
Column{ Column{
ConfigSlider { ConfigSlider {
label: qsTr("Depth Threshold [cm]") label: qsTr("Depth Threshold [cm]")
integral: false integral: false
config: Render.getConfig("SurfaceGeometry") config: mainViewTask.getConfig("SurfaceGeometry")
property: "depthThreshold" property: "depthThreshold"
max: 5.0 max: 5.0
min: 0.0 min: 0.0
@ -34,7 +35,7 @@ Column {
ConfigSlider { ConfigSlider {
label: qsTr(modelData.split(":")[0]) label: qsTr(modelData.split(":")[0])
integral: (modelData.split(":")[3] == 'true') integral: (modelData.split(":")[3] == 'true')
config: Render.getConfig("SurfaceGeometry") config: mainViewTask.getConfig("SurfaceGeometry")
property: modelData.split(":")[1] property: modelData.split(":")[1]
max: modelData.split(":")[2] max: modelData.split(":")[2]
min: 0.0 min: 0.0
@ -42,8 +43,8 @@ Column {
} }
CheckBox { CheckBox {
text: "Half Resolution" text: "Half Resolution"
checked: Render.getConfig("SurfaceGeometry")["resolutionLevel"] checked: mainViewTask.getConfig("SurfaceGeometry")["resolutionLevel"]
onCheckedChanged: { Render.getConfig("SurfaceGeometry")["resolutionLevel"] = checked } onCheckedChanged: { mainViewTask.getConfig("SurfaceGeometry")["resolutionLevel"] = checked }
} }
Repeater { Repeater {
@ -53,7 +54,7 @@ Column {
ConfigSlider { ConfigSlider {
label: qsTr(modelData.split(":")[0]) label: qsTr(modelData.split(":")[0])
integral: false integral: false
config: Render.getConfig(modelData.split(":")[1]) config: mainViewTask.getConfig(modelData.split(":")[1])
property: modelData.split(":")[2] property: modelData.split(":")[2]
max: modelData.split(":")[3] max: modelData.split(":")[3]
min: 0.0 min: 0.0

View file

@ -22,7 +22,8 @@ Item {
spacing: 8 spacing: 8
anchors.fill:parent anchors.fill:parent
property var config: Render.getConfig("Stats") property var mainViewTask: Render.getConfig("RenderMainView");
property var config: mainViewTask.getConfig("Stats")
function evalEvenHeight() { function evalEvenHeight() {
// Why do we have to do that manually ? cannot seem to find a qml / anchor / layout mode that does that ? // Why do we have to do that manually ? cannot seem to find a qml / anchor / layout mode that does that ?

View file

@ -622,7 +622,7 @@ var toolBar = (function () {
})); }));
isActive = active; isActive = active;
activeButton.editProperties({isActive: isActive}); activeButton.editProperties({isActive: isActive});
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
if (!isActive) { if (!isActive) {
@ -1519,6 +1519,8 @@ function importSVO(importURL) {
// entities after they're imported so that they're all the correct distance in front of and with geometric mean // entities after they're imported so that they're all the correct distance in front of and with geometric mean
// centered on the avatar/camera direction. // centered on the avatar/camera direction.
var deltaPosition = Vec3.ZERO; var deltaPosition = Vec3.ZERO;
var entityPositions = [];
var entityParentIDs = [];
var properties = Entities.getEntityProperties(pastedEntityIDs[0], ["type"]); var properties = Entities.getEntityProperties(pastedEntityIDs[0], ["type"]);
var NO_ADJUST_ENTITY_TYPES = ["Zone", "Light", "ParticleEffect"]; var NO_ADJUST_ENTITY_TYPES = ["Zone", "Light", "ParticleEffect"];
@ -1534,10 +1536,9 @@ function importSVO(importURL) {
var targetPosition = getPositionToCreateEntity(); var targetPosition = getPositionToCreateEntity();
var deltaParallel = HALF_TREE_SCALE; // Distance to move entities parallel to targetDirection. var deltaParallel = HALF_TREE_SCALE; // Distance to move entities parallel to targetDirection.
var deltaPerpendicular = Vec3.ZERO; // Distance to move entities perpendicular to targetDirection. var deltaPerpendicular = Vec3.ZERO; // Distance to move entities perpendicular to targetDirection.
var entityPositions = [];
for (var i = 0, length = pastedEntityIDs.length; i < length; i++) { for (var i = 0, length = pastedEntityIDs.length; i < length; i++) {
var properties = Entities.getEntityProperties(pastedEntityIDs[i], ["position", "dimensions", var properties = Entities.getEntityProperties(pastedEntityIDs[i], ["position", "dimensions",
"registrationPoint", "rotation"]); "registrationPoint", "rotation", "parentID"]);
var adjustedPosition = adjustPositionPerBoundingBox(targetPosition, targetDirection, var adjustedPosition = adjustPositionPerBoundingBox(targetPosition, targetDirection,
properties.registrationPoint, properties.dimensions, properties.rotation); properties.registrationPoint, properties.dimensions, properties.rotation);
var delta = Vec3.subtract(adjustedPosition, properties.position); var delta = Vec3.subtract(adjustedPosition, properties.position);
@ -1546,6 +1547,7 @@ function importSVO(importURL) {
deltaPerpendicular = Vec3.sum(Vec3.subtract(delta, Vec3.multiply(distance, targetDirection)), deltaPerpendicular = Vec3.sum(Vec3.subtract(delta, Vec3.multiply(distance, targetDirection)),
deltaPerpendicular); deltaPerpendicular);
entityPositions[i] = properties.position; entityPositions[i] = properties.position;
entityParentIDs[i] = properties.parentID;
} }
deltaPerpendicular = Vec3.multiply(1 / pastedEntityIDs.length, deltaPerpendicular); deltaPerpendicular = Vec3.multiply(1 / pastedEntityIDs.length, deltaPerpendicular);
deltaPosition = Vec3.sum(Vec3.multiply(deltaParallel, targetDirection), deltaPerpendicular); deltaPosition = Vec3.sum(Vec3.multiply(deltaParallel, targetDirection), deltaPerpendicular);
@ -1562,9 +1564,11 @@ function importSVO(importURL) {
if (!Vec3.equal(deltaPosition, Vec3.ZERO)) { if (!Vec3.equal(deltaPosition, Vec3.ZERO)) {
for (var i = 0, length = pastedEntityIDs.length; i < length; i++) { for (var i = 0, length = pastedEntityIDs.length; i < length; i++) {
Entities.editEntity(pastedEntityIDs[i], { if (Uuid.isNull(entityParentIDs[i])) {
position: Vec3.sum(deltaPosition, entityPositions[i]) Entities.editEntity(pastedEntityIDs[i], {
}); position: Vec3.sum(deltaPosition, entityPositions[i])
});
}
} }
} }
} }