mirror of
https://github.com/overte-org/overte.git
synced 2025-04-09 07:12:45 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into project-freeloco
This commit is contained in:
commit
7092513b7d
15 changed files with 166 additions and 24 deletions
|
@ -71,6 +71,18 @@ PickFilter getPickFilter(unsigned int filter) {
|
|||
unsigned int PickScriptingInterface::createRayPick(const QVariant& properties) {
|
||||
QVariantMap propMap = properties.toMap();
|
||||
|
||||
|
||||
#if defined (Q_OS_ANDROID)
|
||||
QString jointName { "" };
|
||||
if (propMap["joint"].isValid()) {
|
||||
QString jointName = propMap["joint"].toString();
|
||||
const QString MOUSE_JOINT = "Mouse";
|
||||
if (jointName == MOUSE_JOINT) {
|
||||
return PointerEvent::INVALID_POINTER_ID;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool enabled = false;
|
||||
if (propMap["enabled"].isValid()) {
|
||||
enabled = propMap["enabled"].toBool();
|
||||
|
|
|
@ -150,6 +150,17 @@ unsigned int PointerScriptingInterface::createStylus(const QVariant& properties)
|
|||
unsigned int PointerScriptingInterface::createLaserPointer(const QVariant& properties) const {
|
||||
QVariantMap propertyMap = properties.toMap();
|
||||
|
||||
#if defined (Q_OS_ANDROID)
|
||||
QString jointName { "" };
|
||||
if (propertyMap["joint"].isValid()) {
|
||||
QString jointName = propertyMap["joint"].toString();
|
||||
const QString MOUSE_JOINT = "Mouse";
|
||||
if (jointName == MOUSE_JOINT) {
|
||||
return PointerEvent::INVALID_POINTER_ID;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool faceAvatar = false;
|
||||
if (propertyMap["faceAvatar"].isValid()) {
|
||||
faceAvatar = propertyMap["faceAvatar"].toBool();
|
||||
|
|
|
@ -79,7 +79,16 @@ void Overlays::cleanupAllOverlays() {
|
|||
cleanupOverlaysToDelete();
|
||||
}
|
||||
|
||||
void Overlays::init() {}
|
||||
void Overlays::init() {
|
||||
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>().data();
|
||||
auto pointerManager = DependencyManager::get<PointerManager>();
|
||||
connect(pointerManager.data(), &PointerManager::hoverBeginOverlay, entityScriptingInterface , &EntityScriptingInterface::hoverEnterEntity);
|
||||
connect(pointerManager.data(), &PointerManager::hoverContinueOverlay, entityScriptingInterface, &EntityScriptingInterface::hoverOverEntity);
|
||||
connect(pointerManager.data(), &PointerManager::hoverEndOverlay, entityScriptingInterface, &EntityScriptingInterface::hoverLeaveEntity);
|
||||
connect(pointerManager.data(), &PointerManager::triggerBeginOverlay, entityScriptingInterface, &EntityScriptingInterface::mousePressOnEntity);
|
||||
connect(pointerManager.data(), &PointerManager::triggerContinueOverlay, entityScriptingInterface, &EntityScriptingInterface::mouseMoveOnEntity);
|
||||
connect(pointerManager.data(), &PointerManager::triggerEndOverlay, entityScriptingInterface, &EntityScriptingInterface::mouseReleaseOnEntity);
|
||||
}
|
||||
|
||||
void Overlays::update(float deltatime) {
|
||||
cleanupOverlaysToDelete();
|
||||
|
@ -343,6 +352,17 @@ EntityItemProperties Overlays::convertOverlayToEntityProperties(QVariantMap& ove
|
|||
return "none";
|
||||
});
|
||||
|
||||
RENAME_PROP_CONVERT(textures, textures, [](const QVariant& v) {
|
||||
auto map = v.toMap();
|
||||
if (!map.isEmpty()) {
|
||||
auto json = QJsonDocument::fromVariant(map);
|
||||
if (!json.isNull()) {
|
||||
return QVariant(QString(json.toJson()));
|
||||
}
|
||||
}
|
||||
return v;
|
||||
});
|
||||
|
||||
if (type == "Shape" || type == "Box" || type == "Sphere" || type == "Gizmo") {
|
||||
RENAME_PROP(solid, isSolid);
|
||||
RENAME_PROP(isFilled, isSolid);
|
||||
|
|
|
@ -354,7 +354,8 @@ NetworkTexture::NetworkTexture(const NetworkTexture& other) :
|
|||
_originalHeight(other._originalHeight),
|
||||
_width(other._width),
|
||||
_height(other._height),
|
||||
_maxNumPixels(other._maxNumPixels)
|
||||
_maxNumPixels(other._maxNumPixels),
|
||||
_content(other._content)
|
||||
{
|
||||
if (_width == 0 || _height == 0 ||
|
||||
other._currentlyLoadingResourceType == ResourceType::META ||
|
||||
|
@ -368,17 +369,30 @@ static bool isLocalUrl(const QUrl& url) {
|
|||
return (scheme == HIFI_URL_SCHEME_FILE || scheme == URL_SCHEME_QRC || scheme == RESOURCE_SCHEME);
|
||||
}
|
||||
|
||||
void NetworkTexture::setExtra(void* extra, bool isNewExtra) {
|
||||
void NetworkTexture::setExtra(void* extra) {
|
||||
const TextureExtra* textureExtra = static_cast<const TextureExtra*>(extra);
|
||||
_type = textureExtra ? textureExtra->type : image::TextureUsage::DEFAULT_TEXTURE;
|
||||
_maxNumPixels = textureExtra ? textureExtra->maxNumPixels : ABSOLUTE_MAX_TEXTURE_NUM_PIXELS;
|
||||
_sourceChannel = textureExtra ? textureExtra->sourceChannel : image::ColorChannel::NONE;
|
||||
|
||||
if (isNewExtra && !_loaded) {
|
||||
bool needsNewTextureSource = false;
|
||||
auto type = textureExtra ? textureExtra->type : image::TextureUsage::DEFAULT_TEXTURE;
|
||||
auto sourceChannel = textureExtra ? textureExtra->sourceChannel : image::ColorChannel::NONE;
|
||||
if (type != _type || sourceChannel != _sourceChannel) {
|
||||
needsNewTextureSource = true;
|
||||
}
|
||||
_type = type;
|
||||
_sourceChannel = sourceChannel;
|
||||
|
||||
auto content = textureExtra ? textureExtra->content : QByteArray();
|
||||
if (_content.isEmpty() && !content.isEmpty()) {
|
||||
_content = content;
|
||||
needsNewTextureSource = true;
|
||||
}
|
||||
|
||||
if (needsNewTextureSource) {
|
||||
_startedLoading = false;
|
||||
}
|
||||
|
||||
if (!_textureSource || isNewExtra) {
|
||||
if (!_textureSource || needsNewTextureSource) {
|
||||
_textureSource = std::make_shared<gpu::TextureSource>(_url, (int)_type);
|
||||
}
|
||||
_lowestRequestedMipLevel = 0;
|
||||
|
@ -405,10 +419,9 @@ void NetworkTexture::setExtra(void* extra, bool isNewExtra) {
|
|||
}
|
||||
|
||||
// if we have content, load it after we have our self pointer
|
||||
auto content = textureExtra ? textureExtra->content : QByteArray();
|
||||
if (!content.isEmpty()) {
|
||||
if (!_content.isEmpty()) {
|
||||
_startedLoading = true;
|
||||
QMetaObject::invokeMethod(this, "downloadFinished", Qt::QueuedConnection, Q_ARG(const QByteArray&, content));
|
||||
QMetaObject::invokeMethod(this, "downloadFinished", Qt::QueuedConnection, Q_ARG(const QByteArray&, _content));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
|
||||
Q_INVOKABLE void setOriginalDescriptor(ktx::KTXDescriptor* descriptor) { _originalKtxDescriptor.reset(descriptor); }
|
||||
|
||||
void setExtra(void* extra, bool isNewExtra) override;
|
||||
void setExtra(void* extra) override;
|
||||
|
||||
signals:
|
||||
void networkTextureCreated(const QWeakPointer<NetworkTexture>& self);
|
||||
|
@ -136,12 +136,12 @@ private:
|
|||
// mip offsets to change.
|
||||
ktx::KTXDescriptorPointer _originalKtxDescriptor;
|
||||
|
||||
|
||||
int _originalWidth { 0 };
|
||||
int _originalHeight { 0 };
|
||||
int _width { 0 };
|
||||
int _height { 0 };
|
||||
int _maxNumPixels { ABSOLUTE_MAX_TEXTURE_NUM_PIXELS };
|
||||
QByteArray _content;
|
||||
|
||||
friend class TextureCache;
|
||||
};
|
||||
|
|
|
@ -309,7 +309,7 @@ public:
|
|||
|
||||
virtual void downloadFinished(const QByteArray& data) override;
|
||||
|
||||
void setExtra(void* extra, bool isNewExtra) override;
|
||||
void setExtra(void* extra) override;
|
||||
|
||||
protected:
|
||||
Q_INVOKABLE void setGeometryDefinition(HFMModel::Pointer hfmModel, QVariantHash mapping);
|
||||
|
@ -320,7 +320,7 @@ private:
|
|||
bool _combineParts;
|
||||
};
|
||||
|
||||
void GeometryDefinitionResource::setExtra(void* extra, bool isNewExtra) {
|
||||
void GeometryDefinitionResource::setExtra(void* extra) {
|
||||
const GeometryExtra* geometryExtra = static_cast<const GeometryExtra*>(extra);
|
||||
_mapping = geometryExtra ? geometryExtra->mapping : QVariantHash();
|
||||
_textureBaseUrl = geometryExtra ? resolveTextureBaseUrl(_url, geometryExtra->textureBaseUrl) : QUrl();
|
||||
|
|
|
@ -355,7 +355,7 @@ QSharedPointer<Resource> ResourceCache::getResource(const QUrl& url, const QUrl&
|
|||
} else if (resourcesWithExtraHash.size() > 0.0f) {
|
||||
// We haven't seen this extra info before, but we've already downloaded the resource. We need a new copy of this object (with any old hash).
|
||||
resource = createResourceCopy(resourcesWithExtraHash.begin().value().lock());
|
||||
resource->setExtra(extra, true);
|
||||
resource->setExtra(extra);
|
||||
resource->setExtraHash(extraHash);
|
||||
resource->setSelf(resource);
|
||||
resource->setCache(this);
|
||||
|
@ -375,7 +375,7 @@ QSharedPointer<Resource> ResourceCache::getResource(const QUrl& url, const QUrl&
|
|||
|
||||
if (!resource) {
|
||||
resource = createResource(url);
|
||||
resource->setExtra(extra, false);
|
||||
resource->setExtra(extra);
|
||||
resource->setExtraHash(extraHash);
|
||||
resource->setSelf(resource);
|
||||
resource->setCache(this);
|
||||
|
|
|
@ -417,7 +417,7 @@ public:
|
|||
unsigned int getDownloadAttempts() { return _attempts; }
|
||||
unsigned int getDownloadAttemptsRemaining() { return _attemptsRemaining; }
|
||||
|
||||
virtual void setExtra(void* extra, bool isNewExtra) {};
|
||||
virtual void setExtra(void* extra) {};
|
||||
void setExtraHash(size_t extraHash) { _extraHash = extraHash; }
|
||||
size_t getExtraHash() const { return _extraHash; }
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#include "PickManager.h"
|
||||
#include "PerfStat.h"
|
||||
#include "Profile.h"
|
||||
|
||||
PickManager::PickManager() {
|
||||
setShouldPickHUDOperator([]() { return false; });
|
||||
|
@ -119,10 +121,26 @@ void PickManager::update() {
|
|||
bool shouldPickHUD = _shouldPickHUDOperator();
|
||||
// FIXME: give each type its own expiry
|
||||
// Each type will update at least one pick, regardless of the expiry
|
||||
_updatedPickCounts[PickQuery::Stylus] = _stylusPickCacheOptimizer.update(cachedPicks[PickQuery::Stylus], _nextPickToUpdate[PickQuery::Stylus], expiry, false);
|
||||
_updatedPickCounts[PickQuery::Ray] = _rayPickCacheOptimizer.update(cachedPicks[PickQuery::Ray], _nextPickToUpdate[PickQuery::Ray], expiry, shouldPickHUD);
|
||||
_updatedPickCounts[PickQuery::Parabola] = _parabolaPickCacheOptimizer.update(cachedPicks[PickQuery::Parabola], _nextPickToUpdate[PickQuery::Parabola], expiry, shouldPickHUD);
|
||||
_updatedPickCounts[PickQuery::Collision] = _collisionPickCacheOptimizer.update(cachedPicks[PickQuery::Collision], _nextPickToUpdate[PickQuery::Collision], expiry, false);
|
||||
{
|
||||
PROFILE_RANGE(picks, "StylusPicks");
|
||||
PerformanceTimer perfTimer("StylusPicks");
|
||||
_updatedPickCounts[PickQuery::Stylus] = _stylusPickCacheOptimizer.update(cachedPicks[PickQuery::Stylus], _nextPickToUpdate[PickQuery::Stylus], expiry, false);
|
||||
}
|
||||
{
|
||||
PROFILE_RANGE(picks, "RayPicks");
|
||||
PerformanceTimer perfTimer("RayPicks");
|
||||
_updatedPickCounts[PickQuery::Ray] = _rayPickCacheOptimizer.update(cachedPicks[PickQuery::Ray], _nextPickToUpdate[PickQuery::Ray], expiry, shouldPickHUD);
|
||||
}
|
||||
{
|
||||
PROFILE_RANGE(picks, "ParabolaPick");
|
||||
PerformanceTimer perfTimer("ParabolaPick");
|
||||
_updatedPickCounts[PickQuery::Parabola] = _parabolaPickCacheOptimizer.update(cachedPicks[PickQuery::Parabola], _nextPickToUpdate[PickQuery::Parabola], expiry, shouldPickHUD);
|
||||
}
|
||||
{
|
||||
PROFILE_RANGE(picks, "CollisoinPicks");
|
||||
PerformanceTimer perfTimer("CollisionPicks");
|
||||
_updatedPickCounts[PickQuery::Collision] = _collisionPickCacheOptimizer.update(cachedPicks[PickQuery::Collision], _nextPickToUpdate[PickQuery::Collision], expiry, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool PickManager::isLeftHand(unsigned int uid) {
|
||||
|
|
|
@ -12,6 +12,7 @@ Q_LOGGING_CATEGORY(trace_app, "trace.app")
|
|||
Q_LOGGING_CATEGORY(trace_app_detail, "trace.app.detail")
|
||||
Q_LOGGING_CATEGORY(trace_metadata, "trace.metadata")
|
||||
Q_LOGGING_CATEGORY(trace_network, "trace.network")
|
||||
Q_LOGGING_CATEGORY(trace_picks, "trace.picks")
|
||||
Q_LOGGING_CATEGORY(trace_parse, "trace.parse")
|
||||
Q_LOGGING_CATEGORY(trace_render, "trace.render")
|
||||
Q_LOGGING_CATEGORY(trace_render_detail, "trace.render.detail")
|
||||
|
|
|
@ -18,6 +18,7 @@ Q_DECLARE_LOGGING_CATEGORY(trace_app)
|
|||
Q_DECLARE_LOGGING_CATEGORY(trace_app_detail)
|
||||
Q_DECLARE_LOGGING_CATEGORY(trace_metadata)
|
||||
Q_DECLARE_LOGGING_CATEGORY(trace_network)
|
||||
Q_DECLARE_LOGGING_CATEGORY(trace_picks)
|
||||
Q_DECLARE_LOGGING_CATEGORY(trace_render)
|
||||
Q_DECLARE_LOGGING_CATEGORY(trace_render_detail)
|
||||
Q_DECLARE_LOGGING_CATEGORY(trace_render_gpu)
|
||||
|
|
|
@ -1269,7 +1269,14 @@ QVariantMap parseTexturesToMap(QString newTextures, const QVariantMap& defaultTe
|
|||
QVariantMap newTexturesMap = newTexturesJson.toVariant().toMap();
|
||||
QVariantMap toReturn = defaultTextures;
|
||||
for (auto& texture : newTexturesMap.keys()) {
|
||||
toReturn[texture] = newTexturesMap[texture];
|
||||
auto newURL = newTexturesMap[texture];
|
||||
if (newURL.canConvert<QUrl>()) {
|
||||
toReturn[texture] = newURL.toUrl();
|
||||
} else if (newURL.canConvert<QString>()) {
|
||||
toReturn[texture] = QUrl(newURL.toString());
|
||||
} else {
|
||||
toReturn[texture] = newURL;
|
||||
}
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
|
|
|
@ -26,10 +26,10 @@ QScriptValue variantToScriptValue(QVariant& qValue, QScriptEngine& scriptEngine)
|
|||
case QVariant::Double:
|
||||
return qValue.toDouble();
|
||||
break;
|
||||
case QVariant::String: {
|
||||
case QVariant::String:
|
||||
case QVariant::Url:
|
||||
return scriptEngine.newVariant(qValue);
|
||||
break;
|
||||
}
|
||||
case QVariant::Map: {
|
||||
QVariantMap childMap = qValue.toMap();
|
||||
return variantMapToScriptValue(childMap, scriptEngine);
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
|
||||
// controllerScripts.js
|
||||
//
|
||||
// Created by David Rowe on 15 Mar 2017.
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
/* global Script, Menu */
|
||||
|
||||
var CONTOLLER_SCRIPTS = [
|
||||
"squeezeHands.js",
|
||||
"controllerDisplayManager.js",
|
||||
"toggleAdvancedMovementForHandControllers.js",
|
||||
"controllerDispatcher.js",
|
||||
"controllerModules/nearParentGrabOverlay.js",
|
||||
"controllerModules/stylusInput.js",
|
||||
"controllerModules/equipEntity.js",
|
||||
"controllerModules/nearTrigger.js",
|
||||
"controllerModules/webSurfaceLaserInput.js",
|
||||
"controllerModules/inVREditMode.js",
|
||||
"controllerModules/disableOtherModule.js",
|
||||
"controllerModules/farTrigger.js",
|
||||
"controllerModules/teleport.js",
|
||||
"controllerModules/hudOverlayPointer.js",
|
||||
"controllerModules/scaleEntity.js",
|
||||
"controllerModules/nearGrabHyperLinkEntity.js",
|
||||
"controllerModules/nearTabletHighlight.js",
|
||||
"controllerModules/nearGrabEntity.js",
|
||||
"controllerModules/farGrabEntity.js"
|
||||
];
|
||||
|
||||
var DEBUG_MENU_ITEM = "Debug defaultScripts.js";
|
||||
|
||||
function runDefaultsTogether() {
|
||||
for (var j in CONTOLLER_SCRIPTS) {
|
||||
if (CONTOLLER_SCRIPTS.hasOwnProperty(j)) {
|
||||
Script.include(CONTOLLER_SCRIPTS[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function runDefaultsSeparately() {
|
||||
for (var i in CONTOLLER_SCRIPTS) {
|
||||
if (CONTOLLER_SCRIPTS.hasOwnProperty(i)) {
|
||||
Script.load(CONTOLLER_SCRIPTS[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Menu.isOptionChecked(DEBUG_MENU_ITEM)) {
|
||||
runDefaultsSeparately();
|
||||
} else {
|
||||
runDefaultsTogether();
|
||||
}
|
|
@ -497,6 +497,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
distanceScaleEnd: true,
|
||||
hand: RIGHT_HAND
|
||||
});
|
||||
|
||||
this.mouseRayPick = Pointers.createPointer(PickType.Ray, {
|
||||
joint: "Mouse",
|
||||
filter: Picks.PICK_OVERLAYS | Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_NONCOLLIDABLE,
|
||||
|
|
Loading…
Reference in a new issue