Compare commits

..

No commits in common. "openxr-v2" and "master" have entirely different histories.

173 changed files with 1488 additions and 5374 deletions

View file

@ -1,6 +1,6 @@
# Copyright 2013-2019 High Fidelity, Inc. # Copyright 2013-2019 High Fidelity, Inc.
# Copyright 2020-2022 Vircadia contributors. # Copyright 2020-2022 Vircadia contributors.
# Copyright 2021-2024 Overte e.V. # Copyright 2021-2023 Overte e.V.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
name: Linux Server CI Build name: Linux Server CI Build
@ -65,16 +65,6 @@ jobs:
arch: aarch64 arch: aarch64
runner: linux_aarch64 runner: linux_aarch64
- os: ubuntu-24.04
image: docker.io/overte/overte-server-build:0.1.3-ubuntu-24.04-amd64
arch: amd64
runner: linux_amd64
- os: ubuntu-24.04
image: docker.io/overte/overte-server-build:0.1.3-ubuntu-24.04-aarch64
arch: aarch64
runner: linux_aarch64
- os: fedora-38 - os: fedora-38
image: docker.io/overte/overte-server-build:0.1.3-fedora-38-amd64 image: docker.io/overte/overte-server-build:0.1.3-fedora-38-amd64
arch: amd64 arch: amd64
@ -85,16 +75,15 @@ jobs:
arch: aarch64 arch: aarch64
runner: linux_aarch64 runner: linux_aarch64
# Packaging broken; See: https://github.com/overte-org/overte/issues/968 - os: fedora-39
#~ - os: fedora-39 image: docker.io/overte/overte-server-build:0.1.4-fedora-39-amd64
#~ image: docker.io/overte/overte-server-build:0.1.4-fedora-39-amd64 arch: amd64
#~ arch: amd64 runner: linux_amd64
#~ runner: linux_amd64
#~ - os: fedora-39 - os: fedora-39
#~ image: docker.io/overte/overte-server-build:0.1.4-fedora-39-aarch64 image: docker.io/overte/overte-server-build:0.1.4-fedora-39-aarch64
#~ arch: aarch64 arch: aarch64
#~ runner: linux_aarch64 runner: linux_aarch64
- os: rockylinux-9 - os: rockylinux-9
image: docker.io/overte/overte-server-build:0.1.3-rockylinux-9-amd64 image: docker.io/overte/overte-server-build:0.1.3-rockylinux-9-amd64

View file

@ -184,13 +184,8 @@ if(OVERTE_WARNINGS_WHITELIST)
endif() endif()
if(OVERTE_WARNINGS_AS_ERRORS) if(OVERTE_WARNINGS_AS_ERRORS)
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "" AND WIN32)) set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Werror")
set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} /WX") set(ENV{CFLAGS} "$ENV{CXXFLAGS} -Werror")
set(ENV{CFLAGS} "$ENV{CXXFLAGS} /WX")
else()
set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Werror")
set(ENV{CFLAGS} "$ENV{CXXFLAGS} -Werror")
endif()
endif() endif()
@ -257,6 +252,9 @@ else()
endif() endif()
set(SCREENSHARE 0) set(SCREENSHARE 0)
if (WIN32)
set(SCREENSHARE 1)
endif()
if (APPLE AND NOT CLIENT_ONLY) if (APPLE AND NOT CLIENT_ONLY)
# Don't include Screenshare in OSX client-only builds. # Don't include Screenshare in OSX client-only builds.
set(SCREENSHARE 1) set(SCREENSHARE 1)

View file

@ -109,7 +109,7 @@ public class PermissionChecker extends Activity {
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
try { try {
obj.put("firstRun",false); obj.put("firstRun",false);
obj.put(SETTINGS_FULL_PRIVATE_GROUP_NAME + "/Avatar/fullAvatarURL", avatarPaths[which]); obj.put("Avatar/fullAvatarURL", avatarPaths[which]);
File directory = new File(pathForJson); File directory = new File(pathForJson);
if(!directory.exists()) directory.mkdirs(); if(!directory.exists()) directory.mkdirs();

View file

@ -40,7 +40,7 @@
*/ */
class AgentScriptingInterface : public QObject { class AgentScriptingInterface : public QObject {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool isAvatar READ getIsAvatar WRITE setIsAvatar) Q_PROPERTY(bool isAvatar READ isAvatar WRITE setIsAvatar)
Q_PROPERTY(bool isPlayingAvatarSound READ isPlayingAvatarSound) Q_PROPERTY(bool isPlayingAvatarSound READ isPlayingAvatarSound)
Q_PROPERTY(bool isListeningToAudioStream READ isListeningToAudioStream WRITE setIsListeningToAudioStream) Q_PROPERTY(bool isListeningToAudioStream READ isListeningToAudioStream WRITE setIsListeningToAudioStream)
Q_PROPERTY(bool isNoiseGateEnabled READ isNoiseGateEnabled WRITE setIsNoiseGateEnabled) Q_PROPERTY(bool isNoiseGateEnabled READ isNoiseGateEnabled WRITE setIsNoiseGateEnabled)
@ -77,15 +77,15 @@ public slots:
/*@jsdoc /*@jsdoc
* Checks whether the script is emulating an avatar. * Checks whether the script is emulating an avatar.
* @function Agent.getIsAvatar * @function Agent.isAvatar
* @returns {boolean} <code>true</code> if the script is emulating an avatar, otherwise <code>false</code>. * @returns {boolean} <code>true</code> if the script is emulating an avatar, otherwise <code>false</code>.
* @example <caption>Check whether the agent is emulating an avatar.</caption> * @example <caption>Check whether the agent is emulating an avatar.</caption>
* (function () { * (function () {
* print("Agent is avatar: " + Agent.getIsAvatar()); * print("Agent is avatar: " + Agent.isAvatar());
* print("Agent is avatar: " + Agent.isAvatar); // Same result. * print("Agent is avatar: " + Agent.isAvatar); // Same result.
* }()); * }());
*/ */
bool getIsAvatar() const { return _agent->isAvatar(); } bool isAvatar() const { return _agent->isAvatar(); }
/*@jsdoc /*@jsdoc
* Plays a sound from the position and with the orientation of the emulated avatar's head. No sound is played unless * Plays a sound from the position and with the orientation of the emulated avatar's head. No sound is played unless

View file

@ -30,12 +30,8 @@
#include <NetworkingConstants.h> #include <NetworkingConstants.h>
ScriptableAvatar::ScriptableAvatar() { ScriptableAvatar::ScriptableAvatar(): _scriptEngine(newScriptEngine()) {
_clientTraitsHandler.reset(new ClientTraitsHandler(this)); _clientTraitsHandler.reset(new ClientTraitsHandler(this));
static std::once_flag once;
std::call_once(once, [] {
qRegisterMetaType<HFMModel::Pointer>("HFMModel::Pointer");
});
} }
QByteArray ScriptableAvatar::toByteArrayStateful(AvatarDataDetail dataDetail, bool dropFaceTracking) { QByteArray ScriptableAvatar::toByteArrayStateful(AvatarDataDetail dataDetail, bool dropFaceTracking) {
@ -56,7 +52,6 @@ void ScriptableAvatar::startAnimation(const QString& url, float fps, float prior
_animation = DependencyManager::get<AnimationCache>()->getAnimation(url); _animation = DependencyManager::get<AnimationCache>()->getAnimation(url);
_animationDetails = AnimationDetails("", QUrl(url), fps, 0, loop, hold, false, firstFrame, lastFrame, true, firstFrame, false); _animationDetails = AnimationDetails("", QUrl(url), fps, 0, loop, hold, false, firstFrame, lastFrame, true, firstFrame, false);
_maskedJoints = maskedJoints; _maskedJoints = maskedJoints;
_isAnimationRigValid = false;
} }
void ScriptableAvatar::stopAnimation() { void ScriptableAvatar::stopAnimation() {
@ -94,12 +89,11 @@ QStringList ScriptableAvatar::getJointNames() const {
} }
void ScriptableAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) { void ScriptableAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
_avatarAnimSkeleton.reset(); _bind.reset();
_geometryResource.reset(); _animSkeleton.reset();
AvatarData::setSkeletonModelURL(skeletonModelURL); AvatarData::setSkeletonModelURL(skeletonModelURL);
updateJointMappings(); updateJointMappings();
_isRigValid = false;
} }
int ScriptableAvatar::sendAvatarDataPacket(bool sendAll) { int ScriptableAvatar::sendAvatarDataPacket(bool sendAll) {
@ -143,87 +137,65 @@ static AnimPose composeAnimPose(const HFMJoint& joint, const glm::quat rotation,
} }
void ScriptableAvatar::update(float deltatime) { void ScriptableAvatar::update(float deltatime) {
if (!_geometryResource && !_skeletonModelFilenameURL.isEmpty()) { // AvatarData will parse the .fst, but not get the .fbx skeleton.
_geometryResource = DependencyManager::get<ModelCache>()->getGeometryResource(_skeletonModelFilenameURL);
}
// Run animation // Run animation
Q_ASSERT(QThread::currentThread() == thread()); if (_animation && _animation->isLoaded() && _animation->getFrames().size() > 0 && !_bind.isNull() && _bind->isLoaded()) {
if (_animation && _animation->isLoaded()) { if (!_animSkeleton) {
Q_ASSERT(thread() == _animation->thread()); _animSkeleton = std::make_shared<AnimSkeleton>(_bind->getHFMModel());
auto frames = _animation->getFramesReference(); }
if (frames.size() > 0 && _geometryResource && _geometryResource->isHFMModelLoaded()) { float currentFrame = _animationDetails.currentFrame + deltatime * _animationDetails.fps;
if (!_isRigValid) { if (_animationDetails.loop || currentFrame < _animationDetails.lastFrame) {
_rig.reset(_geometryResource->getHFMModel()); while (currentFrame >= _animationDetails.lastFrame) {
_isRigValid = true; currentFrame -= (_animationDetails.lastFrame - _animationDetails.firstFrame);
} }
if (!_isAnimationRigValid) { _animationDetails.currentFrame = currentFrame;
_animationRig.reset(_animation->getHFMModel());
_isAnimationRigValid = true; const QVector<HFMJoint>& modelJoints = _bind->getHFMModel().joints;
QStringList animationJointNames = _animation->getJointNames();
const int nJoints = modelJoints.size();
if (_jointData.size() != nJoints) {
_jointData.resize(nJoints);
} }
if (!_avatarAnimSkeleton) {
_avatarAnimSkeleton = std::make_shared<AnimSkeleton>(_geometryResource->getHFMModel()); const int frameCount = _animation->getFrames().size();
const HFMAnimationFrame& floorFrame = _animation->getFrames().at((int)glm::floor(currentFrame) % frameCount);
const HFMAnimationFrame& ceilFrame = _animation->getFrames().at((int)glm::ceil(currentFrame) % frameCount);
const float frameFraction = glm::fract(currentFrame);
std::vector<AnimPose> poses = _animSkeleton->getRelativeDefaultPoses();
const float UNIT_SCALE = 0.01f;
for (int i = 0; i < animationJointNames.size(); i++) {
const QString& name = animationJointNames[i];
// As long as we need the model preRotations anyway, let's get the jointIndex from the bind skeleton rather than
// trusting the .fst (which is sometimes not updated to match changes to .fbx).
int mapping = _bind->getHFMModel().getJointIndex(name);
if (mapping != -1 && !_maskedJoints.contains(name)) {
AnimPose floorPose = composeAnimPose(modelJoints[mapping], floorFrame.rotations[i], floorFrame.translations[i] * UNIT_SCALE);
AnimPose ceilPose = composeAnimPose(modelJoints[mapping], ceilFrame.rotations[i], floorFrame.translations[i] * UNIT_SCALE);
blend(1, &floorPose, &ceilPose, frameFraction, &poses[mapping]);
}
} }
float currentFrame = _animationDetails.currentFrame + deltatime * _animationDetails.fps;
if (_animationDetails.loop || currentFrame < _animationDetails.lastFrame) { std::vector<AnimPose> absPoses = poses;
while (currentFrame >= _animationDetails.lastFrame) { _animSkeleton->convertRelativePosesToAbsolute(absPoses);
currentFrame -= (_animationDetails.lastFrame - _animationDetails.firstFrame); for (int i = 0; i < nJoints; i++) {
JointData& data = _jointData[i];
AnimPose& absPose = absPoses[i];
if (data.rotation != absPose.rot()) {
data.rotation = absPose.rot();
data.rotationIsDefaultPose = false;
} }
_animationDetails.currentFrame = currentFrame; AnimPose& relPose = poses[i];
if (data.translation != relPose.trans()) {
const QVector<HFMJoint>& modelJoints = _geometryResource->getHFMModel().joints; data.translation = relPose.trans();
QStringList animationJointNames = _animation->getJointNames(); data.translationIsDefaultPose = false;
const int nJoints = modelJoints.size();
if (_jointData.size() != nJoints) {
_jointData.resize(nJoints);
} }
const int frameCount = frames.size();
const HFMAnimationFrame& floorFrame = frames.at((int)glm::floor(currentFrame) % frameCount);
const HFMAnimationFrame& ceilFrame = frames.at((int)glm::ceil(currentFrame) % frameCount);
const float frameFraction = glm::fract(currentFrame);
std::vector<AnimPose> poses = _avatarAnimSkeleton->getRelativeDefaultPoses();
// TODO: this needs more testing, it's possible that we need not only scale but also rotation and translation
// According to tests with unmatching avatar and animation armatures, sometimes bones are not rotated correctly.
// Matching armatures already work very well now.
const float UNIT_SCALE = _animationRig.GetScaleFactorGeometryToUnscaledRig() / _rig.GetScaleFactorGeometryToUnscaledRig();
for (int i = 0; i < animationJointNames.size(); i++) {
const QString& name = animationJointNames[i];
// As long as we need the model preRotations anyway, let's get the jointIndex from the bind skeleton rather than
// trusting the .fst (which is sometimes not updated to match changes to .fbx).
int mapping = _geometryResource->getHFMModel().getJointIndex(name);
if (mapping != -1 && !_maskedJoints.contains(name)) {
AnimPose floorPose = composeAnimPose(modelJoints[mapping], floorFrame.rotations[i],
floorFrame.translations[i] * UNIT_SCALE);
AnimPose ceilPose = composeAnimPose(modelJoints[mapping], ceilFrame.rotations[i],
ceilFrame.translations[i] * UNIT_SCALE);
blend(1, &floorPose, &ceilPose, frameFraction, &poses[mapping]);
}
}
std::vector<AnimPose> absPoses = poses;
Q_ASSERT(_avatarAnimSkeleton != nullptr);
_avatarAnimSkeleton->convertRelativePosesToAbsolute(absPoses);
for (int i = 0; i < nJoints; i++) {
JointData& data = _jointData[i];
AnimPose& absPose = absPoses[i];
if (data.rotation != absPose.rot()) {
data.rotation = absPose.rot();
data.rotationIsDefaultPose = false;
}
AnimPose& relPose = poses[i];
if (data.translation != relPose.trans()) {
data.translation = relPose.trans();
data.translationIsDefaultPose = false;
}
}
} else {
_animation.clear();
} }
} else {
_animation.clear();
} }
} }
@ -273,7 +245,6 @@ void ScriptableAvatar::setJointMappingsFromNetworkReply() {
networkReply->deleteLater(); networkReply->deleteLater();
return; return;
} }
// TODO: this works only with .fst files currently, not directly with FBX and GLB models
{ {
QWriteLocker writeLock(&_jointDataLock); QWriteLocker writeLock(&_jointDataLock);
QByteArray line; QByteArray line;
@ -282,7 +253,7 @@ void ScriptableAvatar::setJointMappingsFromNetworkReply() {
if (line.startsWith("filename")) { if (line.startsWith("filename")) {
int filenameIndex = line.indexOf('=') + 1; int filenameIndex = line.indexOf('=') + 1;
if (filenameIndex > 0) { if (filenameIndex > 0) {
_skeletonModelFilenameURL = _skeletonModelURL.resolved(QString(line.mid(filenameIndex).trimmed())); _skeletonFBXURL = _skeletonModelURL.resolved(QString(line.mid(filenameIndex).trimmed()));
} }
} }
if (!line.startsWith("jointIndex")) { if (!line.startsWith("jointIndex")) {
@ -344,9 +315,7 @@ AvatarEntityMap ScriptableAvatar::getAvatarEntityDataInternal(bool allProperties
EntityItemProperties properties = entity->getProperties(desiredProperties); EntityItemProperties properties = entity->getProperties(desiredProperties);
QByteArray blob; QByteArray blob;
_helperScriptEngine.run( [&] { EntityItemProperties::propertiesToBlob(*_scriptEngine, sessionID, properties, blob, allProperties);
EntityItemProperties::propertiesToBlob(*_helperScriptEngine.get(), sessionID, properties, blob, allProperties);
});
data[id] = blob; data[id] = blob;
} }
}); });
@ -370,12 +339,8 @@ void ScriptableAvatar::setAvatarEntityData(const AvatarEntityMap& avatarEntityDa
while (dataItr != avatarEntityData.end()) { while (dataItr != avatarEntityData.end()) {
EntityItemProperties properties; EntityItemProperties properties;
const QByteArray& blob = dataItr.value(); const QByteArray& blob = dataItr.value();
if (!blob.isNull()) { if (!blob.isNull() && EntityItemProperties::blobToProperties(*_scriptEngine, blob, properties)) {
_helperScriptEngine.run([&] { newProperties[dataItr.key()] = properties;
if (EntityItemProperties::blobToProperties(*_helperScriptEngine.get(), blob, properties)) {
newProperties[dataItr.key()] = properties;
}
});
} }
++dataItr; ++dataItr;
} }
@ -454,16 +419,9 @@ void ScriptableAvatar::updateAvatarEntity(const QUuid& entityID, const QByteArra
EntityItemPointer entity; EntityItemPointer entity;
EntityItemProperties properties; EntityItemProperties properties;
{ if (!EntityItemProperties::blobToProperties(*_scriptEngine, entityData, properties)) {
// TODO: checking how often this happens and what is the performance impact of having the script engine on separate thread // entityData is corrupt
// If it's happening often, a method to move HelperScriptEngine into the current thread would be a good idea return;
bool result = _helperScriptEngine.runWithResult<bool> ( [&]() {
return EntityItemProperties::blobToProperties(*_helperScriptEngine.get(), entityData, properties);
});
if (!result) {
// entityData is corrupt
return;
}
} }
std::map<QUuid, EntityItemPointer>::iterator itr = _entities.find(entityID); std::map<QUuid, EntityItemPointer>::iterator itr = _entities.find(entityID);

View file

@ -19,9 +19,6 @@
#include <AvatarData.h> #include <AvatarData.h>
#include <ScriptEngine.h> #include <ScriptEngine.h>
#include <EntityItem.h> #include <EntityItem.h>
#include "model-networking/ModelCache.h"
#include "Rig.h"
#include <HelperScriptEngine.h>
/*@jsdoc /*@jsdoc
* The <code>Avatar</code> API is used to manipulate scriptable avatars on the domain. This API is a subset of the * The <code>Avatar</code> API is used to manipulate scriptable avatars on the domain. This API is a subset of the
@ -220,16 +217,12 @@ private:
AnimationPointer _animation; AnimationPointer _animation;
AnimationDetails _animationDetails; AnimationDetails _animationDetails;
QStringList _maskedJoints; QStringList _maskedJoints;
GeometryResource::Pointer _geometryResource; AnimationPointer _bind; // a sleazy way to get the skeleton, given the various library/cmake dependencies
Rig _rig; std::shared_ptr<AnimSkeleton> _animSkeleton;
bool _isRigValid{false};
Rig _animationRig;
bool _isAnimationRigValid{false};
std::shared_ptr<AnimSkeleton> _avatarAnimSkeleton;
QHash<QString, int> _fstJointIndices; ///< 1-based, since zero is returned for missing keys QHash<QString, int> _fstJointIndices; ///< 1-based, since zero is returned for missing keys
QStringList _fstJointNames; ///< in order of depth-first traversal QStringList _fstJointNames; ///< in order of depth-first traversal
QUrl _skeletonModelFilenameURL; // This contains URL from filename field in fst file QUrl _skeletonFBXURL;
mutable HelperScriptEngine _helperScriptEngine; mutable ScriptEnginePointer _scriptEngine;
std::map<QUuid, EntityItemPointer> _entities; std::map<QUuid, EntityItemPointer> _entities;
/// Loads the joint indices, names from the FST file (if any) /// Loads the joint indices, names from the FST file (if any)

View file

@ -1,4 +1,4 @@
Source: hifi-client-deps Source: hifi-client-deps
Version: 0.1 Version: 0.1
Description: Collected dependencies for High Fidelity applications Description: Collected dependencies for High Fidelity applications
Build-Depends: hifi-deps, aristo (windows), glslang, liblo (windows), nlohmann-json, openvr ((linux&!arm)|windows), openxr-loader, quazip (!android), sdl2 (!android), spirv-cross (!android), spirv-tools (!android), sranipal (windows), vulkanmemoryallocator, discord-rpc (!android) Build-Depends: hifi-deps, aristo (windows), glslang, liblo (windows), nlohmann-json, openvr ((linux&!arm)|windows), quazip (!android), sdl2 (!android), spirv-cross (!android), spirv-tools (!android), sranipal (windows), vulkanmemoryallocator, discord-rpc (!android)

View file

@ -1,34 +0,0 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO open-source-parsers/jsoncpp
REF "${VERSION}"
SHA512 1d06e044759b1e1a4cc4960189dd7e001a0a4389d7239a6d59295af995a553518e4e0337b4b4b817e70da5d9731a4c98655af90791b6287870b5ff8d73ad8873
HEAD_REF master
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" JSONCPP_STATIC)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DJSONCPP_WITH_CMAKE_PACKAGE=ON
-DBUILD_STATIC_LIBS=${JSONCPP_STATIC}
-DJSONCPP_STATIC_WINDOWS_RUNTIME=${STATIC_CRT}
-DJSONCPP_WITH_PKGCONFIG_SUPPORT=ON
-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF
-DJSONCPP_WITH_TESTS=OFF
-DJSONCPP_WITH_EXAMPLE=OFF
-DBUILD_OBJECT_LIBS=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/jsoncpp)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View file

@ -1,18 +0,0 @@
{
"name": "jsoncpp",
"version": "1.9.5",
"port-version": 4,
"description": "JsonCpp is a C++ library that allows manipulating JSON values, including serialization and deserialization to and from strings. It can also preserve existing comment in unserialization/serialization steps, making it a convenient format to store user input files.",
"homepage": "https://github.com/open-source-parsers/jsoncpp",
"license": "MIT",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

8
cmake/ports/node/portfile.cmake Normal file → Executable file
View file

@ -1,4 +1,4 @@
# Copyright 2023-2024 Overte e.V. # Copyright 2023 Overte e.V.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
set(NODE_VERSION 18.14.2) set(NODE_VERSION 18.14.2)
@ -28,9 +28,9 @@ else ()
vcpkg_from_github( vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH OUT_SOURCE_PATH SOURCE_PATH
REPO nodejs/node REPO nodejs/node
REF v18.20.2 REF v18.16.1
SHA512 10d3637c26274677d137f76bbb648d0e7851c994634a16c89858c3a13094a0692ea2cb9a787c6463c3001abd71dab0d83123127bc305171d097c48d21d691678 SHA512 cd2d7871a1a2aca8d800e0a501bd2836cbce076de750dcfc0b2bbe602c8a23705154bfb12faa3ff78e25ec753f419220742228569c281fa458987fb24f6d4d09
HEAD_REF v18.20.2 HEAD_REF v18.16.1
) )
# node cannot configure out of source, which VCPKG expects. So we copy the source to the configure directory. # node cannot configure out of source, which VCPKG expects. So we copy the source to the configure directory.
file(COPY ${SOURCE_PATH}/ DESTINATION "${CURRENT_BUILDTREES_DIR}") file(COPY ${SOURCE_PATH}/ DESTINATION "${CURRENT_BUILDTREES_DIR}")

View file

@ -1,23 +0,0 @@
From d80c7dc3f4810fc49e4444590d39ef71e8a9b01c Mon Sep 17 00:00:00 2001
From: Adam Johnson <AdamJohnso@gmail.com>
Date: Sat, 19 Feb 2022 19:42:31 -0500
Subject: [PATCH] Fix bad import in jinja2
---
external/python/jinja2/utils.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/external/python/jinja2/utils.py b/external/python/jinja2/utils.py
index db9c5d06..f198e3ef 100644
--- a/external/python/jinja2/utils.py
+++ b/external/python/jinja2/utils.py
@@ -639,4 +639,8 @@ def __repr__(self):
# Imported here because that's where it was in the past
-from markupsafe import Markup, escape, soft_unicode
+from markupsafe import Markup, escape
+try:
+ from markupsafe import soft_unicode
+except ImportError:
+ from markupsafe import soft_str as soft_unicode

View file

@ -1,30 +0,0 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c75b145..386494c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -89,7 +89,7 @@ if(NOT VULKAN_INCOMPATIBLE)
endif()
find_package(Threads REQUIRED)
-find_package(JsonCpp)
+find_package(jsoncpp CONFIG REQUIRED)
### All options defined here
option(BUILD_LOADER "Build loader" ON)
diff --git a/src/loader/CMakeLists.txt b/src/loader/CMakeLists.txt
index 6a88cf4..0821a3d 100644
--- a/src/loader/CMakeLists.txt
+++ b/src/loader/CMakeLists.txt
@@ -68,7 +68,11 @@ add_library(openxr_loader ${LIBRARY_TYPE}
${openxr_loader_RESOURCE_FILE}
)
if(BUILD_WITH_SYSTEM_JSONCPP)
- target_link_libraries(openxr_loader PRIVATE JsonCpp::JsonCpp)
+ if(BUILD_SHARED_LIBS)
+ target_link_libraries(openxr_loader PRIVATE jsoncpp_lib)
+ else()
+ target_link_libraries(openxr_loader PRIVATE jsoncpp_static)
+ endif()
else()
target_sources(openxr_loader
PRIVATE

View file

@ -1,79 +0,0 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KhronosGroup/OpenXR-SDK
REF "release-${VERSION}"
SHA512 6efc7596e707f95366dbcdbac9bd7d0c20735a2175b4edf56a9e8a112cf0ab8b664069fe942313164a37119032ddbf5671bc88ab5f276005dd36e4a4dabba1c7
HEAD_REF master
PATCHES
fix-openxr-sdk-jsoncpp.patch
)
vcpkg_from_github(
OUT_SOURCE_PATH SDK_SOURCE_PATH
REPO KhronosGroup/OpenXR-SDK-Source
REF "release-${VERSION}"
SHA512 04bdb0f16078209b5edd175a3396f70e1ceb8cfa382c65b8fda388e565480e3844daf68e0d987e72ed8c21d3148af0b41a2170911ec1660565887e0e5ae6d2bf
HEAD_REF master
PATCHES
fix-openxr-sdk-jsoncpp.patch
fix-jinja2.patch
)
vcpkg_from_github(
OUT_SOURCE_PATH HPP_SOURCE_PATH
REPO KhronosGroup/OpenXR-hpp
REF 63db9919822f8af6f7bf7416ba6a015d4617202e
SHA512 9e768f485d1631f8e74f35f028a64e2d64e33d362c53ae1c54427a10786e3befdd24089927319aa1a4b4c3e010247bd6cb3394bcee460c467c637ab6bc7bec90
HEAD_REF master
PATCHES
python3_8_compatibility.patch
)
# Weird behavior inside the OpenXR loader. On Windows they force shared libraries to use static crt, and
# vice-versa. Might be better in future iterations to patch the CMakeLists.txt for OpenXR
if (VCPKG_TARGET_IS_UWP OR VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(DYNAMIC_LOADER OFF)
set(VCPKG_CRT_LINKAGE dynamic)
else()
set(DYNAMIC_LOADER ON)
set(VCPKG_CRT_LINKAGE static)
endif()
endif()
vcpkg_find_acquire_program(PYTHON3)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_API_LAYERS=OFF
-DBUILD_TESTS=OFF
-DBUILD_CONFORMANCE_TESTS=OFF
-DDYNAMIC_LOADER=${DYNAMIC_LOADER}
-DPYTHON_EXECUTABLE="${PYTHON3}"
-DBUILD_WITH_SYSTEM_JSONCPP=ON
)
vcpkg_cmake_install()
# Generate the OpenXR C++ bindings
set(ENV{OPENXR_REPO} "${SDK_SOURCE_PATH}")
vcpkg_execute_required_process(
COMMAND ${PYTHON3} "${HPP_SOURCE_PATH}/scripts/hpp_genxr.py" -quiet -registry "${SDK_SOURCE_PATH}/specification/registry/xr.xml" -o "${CURRENT_PACKAGES_DIR}/include/openxr"
WORKING_DIRECTORY "${HPP_SOURCE_PATH}"
LOGNAME "openxr-hpp"
)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_cmake_config_fixup(PACKAGE_NAME OpenXR CONFIG_PATH cmake)
else()
vcpkg_cmake_config_fixup(PACKAGE_NAME OpenXR CONFIG_PATH lib/cmake/openxr)
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View file

@ -1,13 +0,0 @@
diff --git a/scripts/hpp_genxr.py b/scripts/hpp_genxr.py
index ce419b0..23e1d3d 100644
--- a/scripts/hpp_genxr.py
+++ b/scripts/hpp_genxr.py
@@ -36,7 +36,7 @@ from xrconventions import OpenXRConventions
from data import EXCLUDED_EXTENSIONS
-def makeREstring(strings: Iterable[str], default: typing.Optional[str] = None) -> str:
+def makeREstring(strings, default: typing.Optional[str] = None) -> str:
"""Turn a list of strings into a regexp string matching exactly those strings."""
if strings or default is None:
return f"^({'|'.join(re.escape(s) for s in strings)})$"

View file

@ -1,27 +0,0 @@
{
"name": "openxr-loader",
"version": "1.0.31",
"description": "A royalty-free, open standard that provides high-performance access to Augmented Reality (AR) and Virtual Reality (VR)—collectively known as XR—platforms and devices",
"homepage": "https://github.com/KhronosGroup/OpenXR-SDK",
"license": "Apache-2.0",
"supports": "!uwp & !osx",
"dependencies": [
"jsoncpp",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"vulkan": {
"description": "Vulkan functionality for OpenXR",
"dependencies": [
"vulkan"
]
}
}
}

View file

@ -1,5 +1,5 @@
{ {
"version": 2.7, "version": 2.6,
"settings": [ "settings": [
{ {
"name": "metaverse", "name": "metaverse",
@ -402,7 +402,7 @@
}, },
{ {
"label": "Permissions <a data-toggle='tooltip' data-html='true' title='<p><strong>Domain-Wide User Permissions</strong></p><ul><li><strong>Connect</strong><br />Sets whether a user can connect to the domain.</li><li><strong>Avatar Entities</strong><br />Sets whether a user can use avatar entities on the domain.</li><li><strong>Lock / Unlock</strong><br />Sets whether a user change the &ldquo;locked&rdquo; property of an entity (either from on to off or off to on).</li><li><strong>Rez</strong><br />Sets whether a user can create new entities.</li><li><strong>Rez Temporary</strong><br />Sets whether a user can create new entities with a finite lifetime.</li><li><strong>Write Assets</strong><br />Sets whether a user can make changes to the domain&rsquo;s asset-server assets.</li><li><strong>Ignore Max Capacity</strong><br />Sets whether a user can connect even if the domain has reached or exceeded its maximum allowed agents.</li><li><strong>Replace Content</strong><br>Sets whether a user can replace entire content sets by wiping existing domain content.</li><li><strong>Get and Set Private User Data</strong><br>Sets whether a user can get and set the privateUserData entity property.</li></ul><p>Note that permissions assigned to a specific user will supersede any parameter-level permissions that might otherwise apply to that user. Additionally, if more than one parameter is applicable to a given user, the permissions given to that user will be the sum of all applicable parameters. For example, let&rsquo;s say only localhost users can connect and only logged in users can lock and unlock entities. If a user is both logged in and on localhost then they will be able to both connect and lock/unlock entities.</p>'>?</a>", "label": "Permissions <a data-toggle='tooltip' data-html='true' title='<p><strong>Domain-Wide User Permissions</strong></p><ul><li><strong>Connect</strong><br />Sets whether a user can connect to the domain.</li><li><strong>Avatar Entities</strong><br />Sets whether a user can use avatar entities on the domain.</li><li><strong>Lock / Unlock</strong><br />Sets whether a user change the &ldquo;locked&rdquo; property of an entity (either from on to off or off to on).</li><li><strong>Rez</strong><br />Sets whether a user can create new entities.</li><li><strong>Rez Temporary</strong><br />Sets whether a user can create new entities with a finite lifetime.</li><li><strong>Write Assets</strong><br />Sets whether a user can make changes to the domain&rsquo;s asset-server assets.</li><li><strong>Ignore Max Capacity</strong><br />Sets whether a user can connect even if the domain has reached or exceeded its maximum allowed agents.</li><li><strong>Replace Content</strong><br>Sets whether a user can replace entire content sets by wiping existing domain content.</li><li><strong>Get and Set Private User Data</strong><br>Sets whether a user can get and set the privateUserData entity property.</li></ul><p>Note that permissions assigned to a specific user will supersede any parameter-level permissions that might otherwise apply to that user. Additionally, if more than one parameter is applicable to a given user, the permissions given to that user will be the sum of all applicable parameters. For example, let&rsquo;s say only localhost users can connect and only logged in users can lock and unlock entities. If a user is both logged in and on localhost then they will be able to both connect and lock/unlock entities.</p>'>?</a>",
"span": 11 "span": 12
} }
], ],
"columns": [ "columns": [
@ -479,13 +479,6 @@
"type": "checkbox", "type": "checkbox",
"editable": true, "editable": true,
"default": false "default": false
},
{
"name": "id_can_view_asset_urls",
"label": "View Asset URLs",
"type": "checkbox",
"editable": true,
"default": false
} }
], ],
"non-deletable-row-key": "permissions_id", "non-deletable-row-key": "permissions_id",
@ -512,7 +505,6 @@
"id_can_rez_tmp": true, "id_can_rez_tmp": true,
"id_can_write_to_asset_server": true, "id_can_write_to_asset_server": true,
"id_can_get_and_set_private_user_data": true, "id_can_get_and_set_private_user_data": true,
"id_can_view_asset_urls": true,
"permissions_id": "localhost" "permissions_id": "localhost"
}, },
{ {
@ -641,13 +633,6 @@
"type": "checkbox", "type": "checkbox",
"editable": true, "editable": true,
"default": false "default": false
},
{
"name": "id_can_view_asset_urls",
"label": "View Asset URLs",
"type": "checkbox",
"editable": true,
"default": false
} }
] ]
}, },
@ -767,13 +752,6 @@
"type": "checkbox", "type": "checkbox",
"editable": true, "editable": true,
"default": false "default": false
},
{
"name": "id_can_view_asset_urls",
"label": "View Asset URLs",
"type": "checkbox",
"editable": true,
"default": false
} }
] ]
}, },
@ -866,13 +844,6 @@
"type": "checkbox", "type": "checkbox",
"editable": true, "editable": true,
"default": false "default": false
},
{
"name": "id_can_view_asset_urls",
"label": "View Asset URLs",
"type": "checkbox",
"editable": true,
"default": false
} }
] ]
}, },
@ -965,13 +936,6 @@
"type": "checkbox", "type": "checkbox",
"editable": true, "editable": true,
"default": false "default": false
},
{
"name": "id_can_view_asset_urls",
"label": "View Asset URLs",
"type": "checkbox",
"editable": true,
"default": false
} }
] ]
}, },
@ -1058,20 +1022,13 @@
"editable": true, "editable": true,
"default": false "default": false
}, },
{ {
"name": "id_can_get_and_set_private_user_data", "name": "id_can_get_and_set_private_user_data",
"label": "Get and Set Private User Data", "label": "Get and Set Private User Data",
"type": "checkbox", "type": "checkbox",
"editable": true, "editable": true,
"default": false "default": false
}, }
{
"name": "id_can_view_asset_urls",
"label": "View Asset URLs",
"type": "checkbox",
"editable": true,
"default": false
}
] ]
}, },
{ {
@ -1163,13 +1120,6 @@
"type": "checkbox", "type": "checkbox",
"editable": true, "editable": true,
"default": false "default": false
},
{
"name": "id_can_view_asset_urls",
"label": "View Asset URLs",
"type": "checkbox",
"editable": true,
"default": false
} }
] ]
}, },

View file

@ -353,7 +353,6 @@ void DomainGatekeeper::updateNodePermissions() {
userPerms.permissions |= NodePermissions::Permission::canReplaceDomainContent; userPerms.permissions |= NodePermissions::Permission::canReplaceDomainContent;
userPerms.permissions |= NodePermissions::Permission::canGetAndSetPrivateUserData; userPerms.permissions |= NodePermissions::Permission::canGetAndSetPrivateUserData;
userPerms.permissions |= NodePermissions::Permission::canRezAvatarEntities; userPerms.permissions |= NodePermissions::Permission::canRezAvatarEntities;
userPerms.permissions |= NodePermissions::Permission::canViewAssetURLs;
} else { } else {
// at this point we don't have a sending socket for packets from this node - assume it is the active socket // at this point we don't have a sending socket for packets from this node - assume it is the active socket
// or the public socket if we haven't activated a socket for the node yet // or the public socket if we haven't activated a socket for the node yet
@ -447,7 +446,6 @@ SharedNodePointer DomainGatekeeper::processAssignmentConnectRequest(const NodeCo
userPerms.permissions |= NodePermissions::Permission::canReplaceDomainContent; userPerms.permissions |= NodePermissions::Permission::canReplaceDomainContent;
userPerms.permissions |= NodePermissions::Permission::canGetAndSetPrivateUserData; userPerms.permissions |= NodePermissions::Permission::canGetAndSetPrivateUserData;
userPerms.permissions |= NodePermissions::Permission::canRezAvatarEntities; userPerms.permissions |= NodePermissions::Permission::canRezAvatarEntities;
userPerms.permissions |= NodePermissions::Permission::canViewAssetURLs;
newNode->setPermissions(userPerms); newNode->setPermissions(userPerms);
return newNode; return newNode;
} }

View file

@ -547,29 +547,6 @@ void DomainServerSettingsManager::setupConfigMap(const QString& userConfigFilena
// No migration needed to version 2.6. // No migration needed to version 2.6.
if (oldVersion < 2.7) {
// Default values for new canViewAssetURLs permission.
unpackPermissions();
std::list<std::unordered_map<NodePermissionsKey, NodePermissionsPointer>> permissionsSets{
_standardAgentPermissions.get(),
_agentPermissions.get(),
_ipPermissions.get(),
_macPermissions.get(),
_machineFingerprintPermissions.get(),
_groupPermissions.get(),
_groupForbiddens.get()
};
foreach (auto permissionsSet, permissionsSets) {
for (auto entry : permissionsSet) {
const auto& userKey = entry.first;
if (permissionsSet[userKey]->can(NodePermissions::Permission::canConnectToDomain)) {
permissionsSet[userKey]->set(NodePermissions::Permission::canViewAssetURLs);
}
}
}
packPermissions();
}
// write the current description version to our settings // write the current description version to our settings
*versionVariant = _descriptionVersion; *versionVariant = _descriptionVersion;

View file

@ -1,35 +0,0 @@
{
"name": "OpenXR Index to Actions",
"channels": [
{ "from": "Index.LeftHand", "to": "Standard.LeftHand" },
{ "from": "Index.RightHand", "to": "Standard.RightHand" },
{ "from": "Index.Head", "to" : "Standard.Head", "when" : [ "Application.InHMD"] },
{ "from": "Index.LeftPrimaryThumb", "to": "Actions.Down" },
{ "from": "Index.LeftPrimaryThumbTouch", "to": "Standard.LeftPrimaryThumbTouch" },
{ "from": "Index.LeftSecondaryThumb", "to": "Actions.ContextMenu" },
{ "from": "Index.LeftSecondaryThumbTouch", "to": "Standard.LeftSecondaryThumbTouch" },
{ "from": "Index.RightPrimaryThumb", "to": "Actions.Up" },
{ "from": "Index.RightPrimaryThumbTouch", "to": "Standard.RightPrimaryThumbTouch" },
{ "from": "Index.RightSecondaryThumb", "to": "Actions.Sprint" },
{ "from": "Index.RightSecondaryThumbTouch", "to": "Standard.RightSecondaryThumbTouch" },
{ "from": "Index.LY", "to": "Actions.TranslateZ", "filters": ["invert"] },
{ "from": "Index.LX", "to": "Actions.TranslateX" },
{ "from": "Index.RY", "to": "Standard.RY" },
{ "from": "Index.RX", "to": "Standard.RX" },
{ "from": "Index.LS", "to": "Standard.LS" },
{ "from": "Index.RS", "to": "Actions.CycleCamera" },
{ "from": "Index.LSTouch", "to": "Standard.LSTouch" },
{ "from": "Index.RSTouch", "to": "Standard.RSTouch" },
{ "from": "Index.RT", "to": "Standard.RT" },
{ "from": "Index.LT", "to": "Standard.LT" },
{ "from": "Index.RTClick", "to": "Standard.RTClick" },
{ "from": "Index.LTClick", "to": "Standard.LTClick" },
{ "from": "Index.LeftPrimaryIndexTouch", "to": "Standard.LeftPrimaryIndexTouch" },
{ "from": "Index.RightPrimaryIndexTouch", "to": "Standard.RightPrimaryIndexTouch" }
]
}

View file

@ -347,10 +347,6 @@ Flickable {
text: "Real-Time" text: "Real-Time"
refreshRatePreset: 2 // RefreshRateProfile::REALTIME refreshRatePreset: 2 // RefreshRateProfile::REALTIME
} }
ListElement {
text: "Custom"
refreshRatePreset: 3 // RefreshRateProfile::CUSTOM
}
} }
HifiControlsUit.ComboBox { HifiControlsUit.ComboBox {
@ -366,7 +362,13 @@ Flickable {
currentIndex: -1 currentIndex: -1
function refreshRefreshRateDropdownDisplay() { function refreshRefreshRateDropdownDisplay() {
refreshRateDropdown.currentIndex = Performance.getRefreshRateProfile(); if (Performance.getRefreshRateProfile() === 0) {
refreshRateDropdown.currentIndex = 0;
} else if (Performance.getRefreshRateProfile() === 1) {
refreshRateDropdown.currentIndex = 1;
} else {
refreshRateDropdown.currentIndex = 2;
}
} }
Component.onCompleted: { Component.onCompleted: {
@ -380,180 +382,6 @@ Flickable {
} }
} }
ColumnLayout {
width: parent.width
Layout.topMargin: 32
visible: refreshRateDropdown.currentIndex == 3
RowLayout {
Layout.margins: 8
HifiControlsUit.SpinBox {
id: refreshRateCustomFocusActive
decimals: 0
width: 160
height: 32
suffix: " FPS"
label: "Focus Active"
realFrom: 1
realTo: 1000
realStepSize: 15
realValue: 60
colorScheme: hifi.colorSchemes.dark
property var loaded: false
Component.onCompleted: {
realValue = Performance.getCustomRefreshRate(0)
loaded = true
}
onRealValueChanged: {
if (loaded) {
Performance.setCustomRefreshRate(0, realValue)
}
}
}
HifiControlsUit.SpinBox {
id: refreshRateCustomFocusInactive
decimals: 0
width: 160
height: 32
suffix: " FPS"
label: "Focus Inactive"
realFrom: 1
realTo: 1000
realStepSize: 15
realValue: 60
colorScheme: hifi.colorSchemes.dark
property var loaded: false
Component.onCompleted: {
realValue = Performance.getCustomRefreshRate(1)
loaded = true
}
onRealValueChanged: {
if (loaded) {
Performance.setCustomRefreshRate(1, realValue)
}
}
}
}
RowLayout {
Layout.margins: 8
HifiControlsUit.SpinBox {
id: refreshRateCustomUnfocus
decimals: 0
width: 160
height: 32
suffix: " FPS"
label: "Unfocus"
realFrom: 1
realTo: 1000
realStepSize: 15
realValue: 60
colorScheme: hifi.colorSchemes.dark
property var loaded: false
Component.onCompleted: {
realValue = Performance.getCustomRefreshRate(2)
loaded = true
}
onRealValueChanged: {
if (loaded) {
Performance.setCustomRefreshRate(2, realValue);
}
}
}
HifiControlsUit.SpinBox {
id: refreshRateCustomMinimized
decimals: 0
width: 160
height: 32
suffix: " FPS"
label: "Minimized"
realFrom: 1
realTo: 1000
realStepSize: 1
realValue: 60
colorScheme: hifi.colorSchemes.dark
property var loaded: false
Component.onCompleted: {
realValue = Performance.getCustomRefreshRate(3)
loaded = true
}
onRealValueChanged: {
if (loaded) {
Performance.setCustomRefreshRate(3, realValue)
}
}
}
}
RowLayout {
Layout.margins: 8
HifiControlsUit.SpinBox {
id: refreshRateCustomStartup
decimals: 0
width: 160
height: 32
suffix: " FPS"
label: "Startup"
realFrom: 1
realTo: 1000
realStepSize: 15
realValue: 60
colorScheme: hifi.colorSchemes.dark
property var loaded: false
Component.onCompleted: {
realValue = Performance.getCustomRefreshRate(4)
loaded = true
}
onRealValueChanged: {
if (loaded) {
Performance.setCustomRefreshRate(4, realValue)
}
}
}
HifiControlsUit.SpinBox {
id: refreshRateCustomShutdown
decimals: 0
width: 160
height: 32
suffix: " FPS"
label: "Shutdown"
realFrom: 1
realTo: 1000
realStepSize: 15
realValue: 60
colorScheme: hifi.colorSchemes.dark
property var loaded: false
Component.onCompleted: {
realValue = Performance.getCustomRefreshRate(5)
loaded = true
}
onRealValueChanged: {
if (loaded) {
Performance.setCustomRefreshRate(5, realValue)
}
}
}
}
}
Item { Item {
Layout.preferredWidth: parent.width Layout.preferredWidth: parent.width
Layout.preferredHeight: 35 Layout.preferredHeight: 35

View file

@ -1,152 +0,0 @@
//
// ScriptPermissions.cpp
// libraries/script-engine/src/ScriptPermissions.cpp
//
// Created by dr Karol Suprynowicz on 2024/03/24.
// Copyright 2024 Overte e.V.
//
// Based on EntityScriptQMLWhitelist.qml
// Created by Kalila L. on 2019.12.05 | realities.dev | somnilibertas@gmail.com
// Copyright 2019 Kalila L.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
// Security settings for the script engines
import Hifi 1.0 as Hifi
import QtQuick 2.8
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.12
import stylesUit 1.0 as HifiStylesUit
import controlsUit 1.0 as HiFiControls
import PerformanceEnums 1.0
import "../../../windows"
Rectangle {
id: parentBody;
function getWhitelistAsText() {
var whitelist = Settings.getValue("private/scriptPermissionGetAvatarURLSafeURLs");
var arrayWhitelist = whitelist.replace(",", "\n");
return arrayWhitelist;
}
function setWhitelistAsText(whitelistText) {
Settings.setValue("private/scriptPermissionGetAvatarURLSafeURLs", whitelistText.text);
notificationText.text = "Whitelist saved.";
}
function setAvatarProtection(enabled) {
Settings.setValue("private/scriptPermissionGetAvatarURLEnable", enabled);
console.info("Setting Protect Avatar URLs to:", enabled);
}
anchors.fill: parent
width: parent.width;
height: 120;
color: "#80010203";
HifiStylesUit.RalewayRegular {
id: titleText;
text: "Protect Avatar URLs"
// Text size
size: 24;
// Style
color: "white";
elide: Text.ElideRight;
// Anchors
anchors.top: parent.top;
anchors.left: parent.left;
anchors.leftMargin: 20;
anchors.right: parent.right;
anchors.rightMargin: 20;
height: 60;
CheckBox {
id: whitelistEnabled;
checked: Settings.getValue("private/scriptPermissionGetAvatarURLEnable", true);
anchors.right: parent.right;
anchors.top: parent.top;
anchors.topMargin: 10;
onToggled: {
setAvatarProtection(whitelistEnabled.checked)
}
Label {
text: "Enabled"
color: "white"
font.pixelSize: 18;
anchors.right: parent.left;
anchors.top: parent.top;
anchors.topMargin: 10;
}
}
}
Rectangle {
id: textAreaRectangle;
color: "black";
width: parent.width;
height: 250;
anchors.top: titleText.bottom;
ScrollView {
id: textAreaScrollView
anchors.fill: parent;
width: parent.width
height: parent.height
contentWidth: parent.width
contentHeight: parent.height
clip: false;
TextArea {
id: whitelistTextArea
text: getWhitelistAsText();
onTextChanged: notificationText.text = "";
width: parent.width;
height: parent.height;
font.family: "Ubuntu";
font.pointSize: 12;
color: "white";
}
}
Button {
id: saveChanges
anchors.topMargin: 5;
anchors.leftMargin: 20;
anchors.rightMargin: 20;
x: textAreaRectangle.x + textAreaRectangle.width - width - 15;
y: textAreaRectangle.y + textAreaRectangle.height - height;
contentItem: Text {
text: saveChanges.text
font.family: "Ubuntu";
font.pointSize: 12;
opacity: enabled ? 1.0 : 0.3
color: "black"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
text: "Save Changes"
onClicked: setWhitelistAsText(whitelistTextArea)
HifiStylesUit.RalewayRegular {
id: notificationText;
text: ""
// Text size
size: 16;
// Style
color: "white";
elide: Text.ElideLeft;
// Anchors
anchors.right: parent.left;
anchors.rightMargin: 10;
}
}
}
}

View file

@ -3,7 +3,6 @@
// //
// Created by Zach Fox on 2019-08-08 // Created by Zach Fox on 2019-08-08
// Copyright 2019 High Fidelity, Inc. // Copyright 2019 High Fidelity, Inc.
// Copyright 2024 Overte e.V.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -79,7 +78,7 @@ Item {
temporaryText: "Viewing!" temporaryText: "Viewing!"
onClicked: { onClicked: {
Qt.openUrlExternally("https://overte.org/"); Qt.openUrlExternally("https://www.highfidelity.com/knowledge");
} }
} }

View file

@ -3,7 +3,6 @@
// //
// Created by Zach Fox on 2019-08-20 // Created by Zach Fox on 2019-08-20
// Copyright 2019 High Fidelity, Inc. // Copyright 2019 High Fidelity, Inc.
// Copyright 2024 Overte e.V.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -77,7 +76,7 @@ Item {
temporaryText: "Opening browser..." temporaryText: "Opening browser..."
onClicked: { onClicked: {
Qt.openUrlExternally("https://overte.org/contact.html"); Qt.openUrlExternally("https://www.highfidelity.com/knowledge/kb-tickets/new");
} }
} }
} }

View file

@ -3,7 +3,6 @@
// //
// Created by Zach Fox on 2019-06-11 // Created by Zach Fox on 2019-06-11
// Copyright 2019 High Fidelity, Inc. // Copyright 2019 High Fidelity, Inc.
// Copyright 2024 Overte e.V.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -94,9 +93,9 @@ Flickable {
width: parent.width width: parent.width
height: 18 height: 18
labelTextOn: "Keep Old Menus (File, Edit, etc)" labelTextOn: "Keep Old Menus (File, Edit, etc)"
checked: Settings.getValue("simplifiedUI/keepMenus", true); checked: Settings.getValue("simplifiedUI/keepMenus", false);
onClicked: { onClicked: {
Settings.setValue("simplifiedUI/keepMenus", !Settings.getValue("simplifiedUI/keepMenus", true)); Settings.setValue("simplifiedUI/keepMenus", !Settings.getValue("simplifiedUI/keepMenus", false));
} }
} }

View file

@ -3,7 +3,6 @@
// //
// Created by Zach Fox on 2019-05-06 // Created by Zach Fox on 2019-05-06
// Copyright 2019 High Fidelity, Inc. // Copyright 2019 High Fidelity, Inc.
// Copyright 2024 Overte e.V.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -176,7 +175,7 @@ Flickable {
spacing: simplifiedUI.margins.settings.spacingBetweenRadiobuttons spacing: simplifiedUI.margins.settings.spacingBetweenRadiobuttons
SimplifiedControls.RadioButton { SimplifiedControls.RadioButton {
id: performanceLowPower id: performanceLow
text: "Low Power Quality" + (PlatformInfo.getTierProfiled() === PerformanceEnums.LOW_POWER ? " (Recommended)" : "") text: "Low Power Quality" + (PlatformInfo.getTierProfiled() === PerformanceEnums.LOW_POWER ? " (Recommended)" : "")
checked: Performance.getPerformancePreset() === PerformanceEnums.LOW_POWER checked: Performance.getPerformancePreset() === PerformanceEnums.LOW_POWER
onClicked: { onClicked: {

View file

@ -3,7 +3,6 @@
// //
// Created by Zach Fox on 2019-05-08 // Created by Zach Fox on 2019-05-08
// Copyright 2019 High Fidelity, Inc. // Copyright 2019 High Fidelity, Inc.
// Copyright 2024 Overte e.V.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -97,11 +96,12 @@ Original.Button {
} }
} }
contentItem: Text { contentItem: HifiStylesUit.FiraSansMedium {
id: buttonText id: buttonText
//topPadding: -2 // Necessary for proper alignment using Graphik Medium //topPadding: -2 // Necessary for proper alignment using Graphik Medium
wrapMode: Text.Wrap wrapMode: Text.Wrap
color: enabled ? simplifiedUI.colors.controls.button.text.enabled : simplifiedUI.colors.controls.button.text.disabled color: enabled ? simplifiedUI.colors.controls.button.text.enabled : simplifiedUI.colors.controls.button.text.disabled
size: simplifiedUI.sizes.controls.button.textSize
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: root.text text: root.text

View file

@ -27,7 +27,7 @@ Item {
width: parent.width width: parent.width
property string title: "Controls" property string title: "Controls"
property var openVRDevices: ["HTC Vive", "Valve Index", "Valve HMD", "Valve", "WindowsMR", "Oculus"] property var openVRDevices: ["HTC Vive", "Valve Index", "Valve HMD", "Valve", "WindowsMR"]
HifiConstants { id: hifi } HifiConstants { id: hifi }

View file

@ -3305,7 +3305,7 @@ void Application::initializeUi() {
// END PULL SAFEURLS FROM INTERFACE.JSON Settings // END PULL SAFEURLS FROM INTERFACE.JSON Settings
if (QUrl(NetworkingConstants::OVERTE_COMMUNITY_APPLICATIONS).isParentOf(url)) { if (AUTHORIZED_EXTERNAL_QML_SOURCE.isParentOf(url)) {
return true; return true;
} else { } else {
for (const auto& str : safeURLS) { for (const auto& str : safeURLS) {
@ -6942,40 +6942,51 @@ void Application::updateRenderArgs(float deltaTime) {
appRenderArgs._eyeToWorld = _myCamera.getTransform(); appRenderArgs._eyeToWorld = _myCamera.getTransform();
appRenderArgs._isStereo = false; appRenderArgs._isStereo = false;
if (getActiveDisplayPlugin()->isStereo()) { {
auto hmdInterface = DependencyManager::get<HMDScriptingInterface>(); auto hmdInterface = DependencyManager::get<HMDScriptingInterface>();
float ipdScale = hmdInterface->getIPDScale();
// scale IPD by sensorToWorldScale, to make the world seem larger or smaller accordingly. // scale IPD by sensorToWorldScale, to make the world seem larger or smaller accordingly.
float ipdScale = hmdInterface->getIPDScale() * sensorToWorldScale; ipdScale *= sensorToWorldScale;
auto baseProjection = appRenderArgs._renderArgs.getViewFrustum().getProjection(); auto baseProjection = appRenderArgs._renderArgs.getViewFrustum().getProjection();
// Stereo modes will typically have a larger projection matrix overall, if (getActiveDisplayPlugin()->isStereo()) {
// so we ask for the 'mono' projection matrix, which for stereo and HMD // Stereo modes will typically have a larger projection matrix overall,
// plugins will imply the combined projection for both eyes. // so we ask for the 'mono' projection matrix, which for stereo and HMD
// // plugins will imply the combined projection for both eyes.
// This is properly implemented for the Oculus plugins, but for OpenVR //
// and Stereo displays I'm not sure how to get / calculate it, so we're // This is properly implemented for the Oculus plugins, but for OpenVR
// just relying on the left FOV in each case and hoping that the // and Stereo displays I'm not sure how to get / calculate it, so we're
// overall culling margin of error doesn't cause popping in the // just relying on the left FOV in each case and hoping that the
// right eye. There are FIXMEs in the relevant plugins // overall culling margin of error doesn't cause popping in the
_myCamera.setProjection(getActiveDisplayPlugin()->getCullingProjection(baseProjection)); // right eye. There are FIXMEs in the relevant plugins
appRenderArgs._isStereo = true; _myCamera.setProjection(getActiveDisplayPlugin()->getCullingProjection(baseProjection));
appRenderArgs._isStereo = true;
auto& eyeOffsets = appRenderArgs._eyeOffsets; auto& eyeOffsets = appRenderArgs._eyeOffsets;
auto& eyeProjections = appRenderArgs._eyeProjections; auto& eyeProjections = appRenderArgs._eyeProjections;
// FIXME we probably don't need to set the projection matrix every frame, // FIXME we probably don't need to set the projection matrix every frame,
// only when the display plugin changes (or in non-HMD modes when the user // only when the display plugin changes (or in non-HMD modes when the user
// changes the FOV manually, which right now I don't think they can. // changes the FOV manually, which right now I don't think they can.
for_each_eye([&](Eye eye) { for_each_eye([&](Eye eye) {
eyeOffsets[eye] = getActiveDisplayPlugin()->getEyeToHeadTransform(eye); // For providing the stereo eye views, the HMD head pose has already been
// Apply IPD scaling // applied to the avatar, so we need to get the difference between the head
eyeOffsets[eye][3][0] *= ipdScale; // pose applied to the avatar and the per eye pose, and use THAT as
eyeProjections[eye] = getActiveDisplayPlugin()->getEyeProjection(eye, baseProjection); // the per-eye stereo matrix adjustment.
}); mat4 eyeToHead = getActiveDisplayPlugin()->getEyeToHeadTransform(eye);
// Grab the translation
vec3 eyeOffset = glm::vec3(eyeToHead[3]);
// Apply IPD scaling
mat4 eyeOffsetTransform = glm::translate(mat4(), eyeOffset * -1.0f * ipdScale);
eyeOffsets[eye] = eyeOffsetTransform;
eyeProjections[eye] = getActiveDisplayPlugin()->getEyeProjection(eye, baseProjection);
});
// Configure the type of display / stereo // Configure the type of display / stereo
appRenderArgs._renderArgs._displayMode = (isHMDMode() ? RenderArgs::STEREO_HMD : RenderArgs::STEREO_MONITOR); appRenderArgs._renderArgs._displayMode = (isHMDMode() ? RenderArgs::STEREO_HMD : RenderArgs::STEREO_MONITOR);
}
} }
appRenderArgs._renderArgs._stencilMaskMode = getActiveDisplayPlugin()->getStencilMaskMode(); appRenderArgs._renderArgs._stencilMaskMode = getActiveDisplayPlugin()->getStencilMaskMode();

View file

@ -41,15 +41,6 @@
#include <QtQuick/QQuickWindow> #include <QtQuick/QQuickWindow>
#include <memory> #include <memory>
#include "WarningsSuppression.h" #include "WarningsSuppression.h"
#include "ScriptPermissions.h"
QVariantMap AvatarBookmarks::getBookmarks() {
if (ScriptPermissions::isCurrentScriptAllowed(ScriptPermissions::Permission::SCRIPT_PERMISSION_GET_AVATAR_URL)) {
return _bookmarks;
} else {
return {};
}
}
void addAvatarEntities(const QVariantList& avatarEntities) { void addAvatarEntities(const QVariantList& avatarEntities) {
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
@ -132,12 +123,6 @@ AvatarBookmarks::AvatarBookmarks() {
} }
void AvatarBookmarks::addBookmark(const QString& bookmarkName) { void AvatarBookmarks::addBookmark(const QString& bookmarkName) {
if (ScriptPermissions::isCurrentScriptAllowed(ScriptPermissions::Permission::SCRIPT_PERMISSION_GET_AVATAR_URL)) {
addBookmarkInternal(bookmarkName);
}
}
void AvatarBookmarks::addBookmarkInternal(const QString& bookmarkName) {
if (QThread::currentThread() != thread()) { if (QThread::currentThread() != thread()) {
BLOCKING_INVOKE_METHOD(this, "addBookmark", Q_ARG(QString, bookmarkName)); BLOCKING_INVOKE_METHOD(this, "addBookmark", Q_ARG(QString, bookmarkName));
return; return;
@ -149,12 +134,6 @@ void AvatarBookmarks::addBookmarkInternal(const QString& bookmarkName) {
} }
void AvatarBookmarks::saveBookmark(const QString& bookmarkName) { void AvatarBookmarks::saveBookmark(const QString& bookmarkName) {
if (ScriptPermissions::isCurrentScriptAllowed(ScriptPermissions::Permission::SCRIPT_PERMISSION_GET_AVATAR_URL)) {
saveBookmarkInternal(bookmarkName);
}
}
void AvatarBookmarks::saveBookmarkInternal(const QString& bookmarkName) {
if (QThread::currentThread() != thread()) { if (QThread::currentThread() != thread()) {
BLOCKING_INVOKE_METHOD(this, "saveBookmark", Q_ARG(QString, bookmarkName)); BLOCKING_INVOKE_METHOD(this, "saveBookmark", Q_ARG(QString, bookmarkName));
return; return;
@ -166,12 +145,6 @@ void AvatarBookmarks::saveBookmarkInternal(const QString& bookmarkName) {
} }
void AvatarBookmarks::removeBookmark(const QString& bookmarkName) { void AvatarBookmarks::removeBookmark(const QString& bookmarkName) {
if (ScriptPermissions::isCurrentScriptAllowed(ScriptPermissions::Permission::SCRIPT_PERMISSION_GET_AVATAR_URL)) {
removeBookmarkInternal(bookmarkName);
}
}
void AvatarBookmarks::removeBookmarkInternal(const QString& bookmarkName) {
if (QThread::currentThread() != thread()) { if (QThread::currentThread() != thread()) {
BLOCKING_INVOKE_METHOD(this, "removeBookmark", Q_ARG(QString, bookmarkName)); BLOCKING_INVOKE_METHOD(this, "removeBookmark", Q_ARG(QString, bookmarkName));
return; return;
@ -227,12 +200,6 @@ void AvatarBookmarks::updateAvatarEntities(const QVariantList &avatarEntities) {
*/ */
void AvatarBookmarks::loadBookmark(const QString& bookmarkName) { void AvatarBookmarks::loadBookmark(const QString& bookmarkName) {
if (ScriptPermissions::isCurrentScriptAllowed(ScriptPermissions::Permission::SCRIPT_PERMISSION_GET_AVATAR_URL)) {
loadBookmarkInternal(bookmarkName);
}
}
void AvatarBookmarks::loadBookmarkInternal(const QString& bookmarkName) {
if (QThread::currentThread() != thread()) { if (QThread::currentThread() != thread()) {
BLOCKING_INVOKE_METHOD(this, "loadBookmark", Q_ARG(QString, bookmarkName)); BLOCKING_INVOKE_METHOD(this, "loadBookmark", Q_ARG(QString, bookmarkName));
return; return;
@ -301,15 +268,6 @@ void AvatarBookmarks::readFromFile() {
} }
QVariantMap AvatarBookmarks::getBookmark(const QString &bookmarkName) QVariantMap AvatarBookmarks::getBookmark(const QString &bookmarkName)
{
if (ScriptPermissions::isCurrentScriptAllowed(ScriptPermissions::Permission::SCRIPT_PERMISSION_GET_AVATAR_URL)) {
return getBookmarkInternal(bookmarkName);
} else {
return {};
}
}
QVariantMap AvatarBookmarks::getBookmarkInternal(const QString &bookmarkName)
{ {
if (QThread::currentThread() != thread()) { if (QThread::currentThread() != thread()) {
QVariantMap result; QVariantMap result;

View file

@ -100,7 +100,7 @@ public slots:
* print("- " + key + " " + bookmarks[key].avatarUrl); * print("- " + key + " " + bookmarks[key].avatarUrl);
* }; * };
*/ */
QVariantMap getBookmarks(); QVariantMap getBookmarks() { return _bookmarks; }
signals: signals:
/*@jsdoc /*@jsdoc
@ -147,11 +147,6 @@ protected slots:
void deleteBookmark() override; void deleteBookmark() override;
private: private:
QVariantMap getBookmarkInternal(const QString &bookmarkName);
void addBookmarkInternal(const QString& bookmarkName);
void saveBookmarkInternal(const QString& bookmarkName);
void loadBookmarkInternal(const QString& bookmarkName);
void removeBookmarkInternal(const QString& bookmarkName);
const QString AVATARBOOKMARKS_FILENAME = "avatarbookmarks.json"; const QString AVATARBOOKMARKS_FILENAME = "avatarbookmarks.json";
const QString ENTRY_AVATAR_URL = "avatarUrl"; const QString ENTRY_AVATAR_URL = "avatarUrl";
const QString ENTRY_AVATAR_ICON = "avatarIcon"; const QString ENTRY_AVATAR_ICON = "avatarIcon";

View file

@ -258,11 +258,10 @@ void CrashRecoveryHandler::handleCrash(CrashRecoveryHandler::Action action) {
// Display name and avatar // Display name and avatar
settings.beginGroup(AVATAR_GROUP); settings.beginGroup(AVATAR_GROUP);
displayName = settings.value(DISPLAY_NAME_KEY).toString(); displayName = settings.value(DISPLAY_NAME_KEY).toString();
fullAvatarURL = settings.value(FULL_AVATAR_URL_KEY).toUrl();
fullAvatarModelName = settings.value(FULL_AVATAR_MODEL_NAME_KEY).toString(); fullAvatarModelName = settings.value(FULL_AVATAR_MODEL_NAME_KEY).toString();
settings.endGroup(); settings.endGroup();
fullAvatarURL = settings.value(SETTINGS_FULL_PRIVATE_GROUP_NAME + "/" + AVATAR_GROUP + "/" + FULL_AVATAR_URL_KEY).toUrl();
// Tutorial complete // Tutorial complete
tutorialComplete = settings.value(TUTORIAL_COMPLETE_FLAG_KEY).toBool(); tutorialComplete = settings.value(TUTORIAL_COMPLETE_FLAG_KEY).toBool();
} }
@ -281,12 +280,12 @@ void CrashRecoveryHandler::handleCrash(CrashRecoveryHandler::Action action) {
// Display name and avatar // Display name and avatar
settings.beginGroup(AVATAR_GROUP); settings.beginGroup(AVATAR_GROUP);
settings.setValue(DISPLAY_NAME_KEY, displayName); settings.setValue(DISPLAY_NAME_KEY, displayName);
settings.setValue(FULL_AVATAR_URL_KEY, fullAvatarURL);
settings.setValue(FULL_AVATAR_MODEL_NAME_KEY, fullAvatarModelName); settings.setValue(FULL_AVATAR_MODEL_NAME_KEY, fullAvatarModelName);
settings.endGroup(); settings.endGroup();
settings.setValue(SETTINGS_FULL_PRIVATE_GROUP_NAME + "/" + AVATAR_GROUP + "/" + FULL_AVATAR_URL_KEY, fullAvatarURL);
// Tutorial complete // Tutorial complete
settings.setValue(TUTORIAL_COMPLETE_FLAG_KEY, tutorialComplete); settings.setValue(TUTORIAL_COMPLETE_FLAG_KEY, tutorialComplete);
} }
} }

View file

@ -64,7 +64,7 @@ void LODManager::setRenderTimes(float presentTime, float engineRunTime, float ba
} }
void LODManager::autoAdjustLOD(float realTimeDelta) { void LODManager::autoAdjustLOD(float realTimeDelta) {
std::lock_guard<std::mutex> lock{ _automaticLODLock }; std::lock_guard<std::mutex> { _automaticLODLock };
// The "render time" is the worse of: // The "render time" is the worse of:
// - engineRunTime: Time spent in the render thread in the engine producing the gpu::Frame N // - engineRunTime: Time spent in the render thread in the engine producing the gpu::Frame N
@ -300,7 +300,7 @@ void LODManager::resetLODAdjust() {
} }
void LODManager::setAutomaticLODAdjust(bool value) { void LODManager::setAutomaticLODAdjust(bool value) {
std::lock_guard<std::mutex> lock{ _automaticLODLock }; std::lock_guard<std::mutex> { _automaticLODLock };
_automaticLODAdjust = value; _automaticLODAdjust = value;
saveSettings(); saveSettings();
emit autoLODChanged(); emit autoLODChanged();

View file

@ -323,19 +323,6 @@ Menu::Menu() {
} }
}); });
// Settings > Script Security
action = addActionToQMenuAndActionHash(settingsMenu, MenuOption::ScriptSecurity);
connect(action, &QAction::triggered, [] {
auto tablet = DependencyManager::get<TabletScriptingInterface>()->getTablet("com.highfidelity.interface.tablet.system");
auto hmd = DependencyManager::get<HMDScriptingInterface>();
tablet->pushOntoStack("hifi/dialogs/security/ScriptSecurity.qml");
if (!hmd->getShouldShowTablet()) {
hmd->toggleShouldShowTablet();
}
});
// Settings > Developer Menu // Settings > Developer Menu
addCheckableActionToQMenuAndActionHash(settingsMenu, "Developer Menu", 0, false, this, SLOT(toggleDeveloperMenus())); addCheckableActionToQMenuAndActionHash(settingsMenu, "Developer Menu", 0, false, this, SLOT(toggleDeveloperMenus()));

View file

@ -190,7 +190,6 @@ namespace MenuOption {
const QString RunTimingTests = "Run Timing Tests"; const QString RunTimingTests = "Run Timing Tests";
const QString ScriptedMotorControl = "Enable Scripted Motor Control"; const QString ScriptedMotorControl = "Enable Scripted Motor Control";
const QString EntityScriptQMLWhitelist = "Entity Script / QML Whitelist"; const QString EntityScriptQMLWhitelist = "Entity Script / QML Whitelist";
const QString ScriptSecurity = "Script Security";
const QString ShowTrackedObjects = "Show Tracked Objects"; const QString ShowTrackedObjects = "Show Tracked Objects";
const QString SelfieCamera = "Selfie"; const QString SelfieCamera = "Selfie";
const QString SendWrongDSConnectVersion = "Send wrong DS connect version"; const QString SendWrongDSConnectVersion = "Send wrong DS connect version";

View file

@ -48,13 +48,12 @@ static const int VR_TARGET_RATE = 90;
* <tr><td><code>"Interactive"</code></td><td>Medium refresh rate, which is reduced when Interface doesn't have focus or is * <tr><td><code>"Interactive"</code></td><td>Medium refresh rate, which is reduced when Interface doesn't have focus or is
* minimized.</td></tr> * minimized.</td></tr>
* <tr><td><code>"Realtime"</code></td><td>High refresh rate, even when Interface doesn't have focus or is minimized. * <tr><td><code>"Realtime"</code></td><td>High refresh rate, even when Interface doesn't have focus or is minimized.
* <tr><td><code>"Custom"</code></td><td>Custom refresh rate for full control over the refresh rate in all states.
* </tbody> * </tbody>
* </table> * </table>
* @typedef {string} RefreshRateProfileName * @typedef {string} RefreshRateProfileName
*/ */
static const std::array<std::string, RefreshRateManager::RefreshRateProfile::PROFILE_NUM> REFRESH_RATE_PROFILE_TO_STRING = static const std::array<std::string, RefreshRateManager::RefreshRateProfile::PROFILE_NUM> REFRESH_RATE_PROFILE_TO_STRING =
{ { "Eco", "Interactive", "Realtime", "Custom" } }; { { "Eco", "Interactive", "Realtime" } };
/*@jsdoc /*@jsdoc
* <p>Interface states that affect the refresh rate.</p> * <p>Interface states that affect the refresh rate.</p>
@ -95,8 +94,7 @@ static const std::array<std::string, RefreshRateManager::UXMode::UX_NUM> UX_MODE
static const std::map<std::string, RefreshRateManager::RefreshRateProfile> REFRESH_RATE_PROFILE_FROM_STRING = static const std::map<std::string, RefreshRateManager::RefreshRateProfile> REFRESH_RATE_PROFILE_FROM_STRING =
{ { "Eco", RefreshRateManager::RefreshRateProfile::ECO }, { { "Eco", RefreshRateManager::RefreshRateProfile::ECO },
{ "Interactive", RefreshRateManager::RefreshRateProfile::INTERACTIVE }, { "Interactive", RefreshRateManager::RefreshRateProfile::INTERACTIVE },
{ "Realtime", RefreshRateManager::RefreshRateProfile::REALTIME }, { "Realtime", RefreshRateManager::RefreshRateProfile::REALTIME } };
{ "Custom", RefreshRateManager::RefreshRateProfile::CUSTOM } };
// Porfile regimes are: // Porfile regimes are:
@ -109,12 +107,10 @@ static const std::array<int, RefreshRateManager::RefreshRateRegime::REGIME_NUM>
{ { 30, 20, 10, 2, 30, 30 } }; { { 30, 20, 10, 2, 30, 30 } };
static const std::array<int, RefreshRateManager::RefreshRateRegime::REGIME_NUM> REALTIME_PROFILE = static const std::array<int, RefreshRateManager::RefreshRateRegime::REGIME_NUM> REALTIME_PROFILE =
{ { 60, 60, 60, 2, 30, 30 } }; { { 60, 60, 60, 2, 30, 30} };
static const std::array<int, RefreshRateManager::RefreshRateRegime::REGIME_NUM> CUSTOM_PROFILE = REALTIME_PROFILE; // derived from settings and modified by scripts below static const std::array<std::array<int, RefreshRateManager::RefreshRateRegime::REGIME_NUM>, RefreshRateManager::RefreshRateProfile::PROFILE_NUM> REFRESH_RATE_PROFILES =
{ { ECO_PROFILE, INTERACTIVE_PROFILE, REALTIME_PROFILE } };
static std::array<std::array<int, RefreshRateManager::RefreshRateRegime::REGIME_NUM>, RefreshRateManager::RefreshRateProfile::PROFILE_NUM> REFRESH_RATE_PROFILES =
{ { ECO_PROFILE, INTERACTIVE_PROFILE, REALTIME_PROFILE, CUSTOM_PROFILE } };
static const int INACTIVE_TIMER_LIMIT = 3000; static const int INACTIVE_TIMER_LIMIT = 3000;
@ -138,10 +134,6 @@ std::string RefreshRateManager::uxModeToString(RefreshRateManager::RefreshRateMa
RefreshRateManager::RefreshRateManager() { RefreshRateManager::RefreshRateManager() {
_refreshRateProfile = (RefreshRateManager::RefreshRateProfile) _refreshRateProfileSetting.get(); _refreshRateProfile = (RefreshRateManager::RefreshRateProfile) _refreshRateProfileSetting.get();
for (size_t i = 0; i < _customRefreshRateSettings.size(); i++) {
REFRESH_RATE_PROFILES[CUSTOM][i] = _customRefreshRateSettings[i].get();
}
_inactiveTimer->setInterval(INACTIVE_TIMER_LIMIT); _inactiveTimer->setInterval(INACTIVE_TIMER_LIMIT);
_inactiveTimer->setSingleShot(true); _inactiveTimer->setSingleShot(true);
QObject::connect(_inactiveTimer.get(), &QTimer::timeout, [&] { QObject::connect(_inactiveTimer.get(), &QTimer::timeout, [&] {
@ -176,25 +168,6 @@ void RefreshRateManager::setRefreshRateProfile(RefreshRateManager::RefreshRatePr
} }
} }
int RefreshRateManager::getCustomRefreshRate(RefreshRateRegime regime) {
if (isValidRefreshRateRegime(regime)) {
return REFRESH_RATE_PROFILES[RefreshRateProfile::CUSTOM][regime];
}
return 0;
}
void RefreshRateManager::setCustomRefreshRate(RefreshRateRegime regime, int value) {
value = std::max(value, 1);
if (isValidRefreshRateRegime(regime)) {
_refreshRateProfileSettingLock.withWriteLock([&] {
REFRESH_RATE_PROFILES[RefreshRateProfile::CUSTOM][regime] = value;
_customRefreshRateSettings[regime].set(value);
});
updateRefreshRateController();
}
}
RefreshRateManager::RefreshRateProfile RefreshRateManager::getRefreshRateProfile() const { RefreshRateManager::RefreshRateProfile RefreshRateManager::getRefreshRateProfile() const {
RefreshRateManager::RefreshRateProfile profile = RefreshRateManager::RefreshRateProfile::REALTIME; RefreshRateManager::RefreshRateProfile profile = RefreshRateManager::RefreshRateProfile::REALTIME;
@ -218,6 +191,7 @@ void RefreshRateManager::setRefreshRateRegime(RefreshRateManager::RefreshRateReg
_refreshRateRegime = refreshRateRegime; _refreshRateRegime = refreshRateRegime;
updateRefreshRateController(); updateRefreshRateController();
} }
} }
void RefreshRateManager::setUXMode(RefreshRateManager::UXMode uxMode) { void RefreshRateManager::setUXMode(RefreshRateManager::UXMode uxMode) {

View file

@ -32,11 +32,10 @@ public:
ECO = 0, ECO = 0,
INTERACTIVE, INTERACTIVE,
REALTIME, REALTIME,
CUSTOM,
PROFILE_NUM PROFILE_NUM
}; };
Q_ENUM(RefreshRateProfile) Q_ENUM(RefreshRateProfile)
static bool isValidRefreshRateProfile(RefreshRateProfile value) { return (value >= 0 && value < RefreshRateProfile::PROFILE_NUM); } static bool isValidRefreshRateProfile(RefreshRateProfile value) { return (value >= RefreshRateProfile::ECO && value <= RefreshRateProfile::REALTIME); }
/*@jsdoc /*@jsdoc
* <p>Interface states that affect the refresh rate.</p> * <p>Interface states that affect the refresh rate.</p>
@ -107,9 +106,6 @@ public:
// query the refresh rate target at the specified combination // query the refresh rate target at the specified combination
int queryRefreshRateTarget(RefreshRateProfile profile, RefreshRateRegime regime, UXMode uxMode) const; int queryRefreshRateTarget(RefreshRateProfile profile, RefreshRateRegime regime, UXMode uxMode) const;
int getCustomRefreshRate(RefreshRateRegime regime);
void setCustomRefreshRate(RefreshRateRegime regime, int value);
void resetInactiveTimer(); void resetInactiveTimer();
void toggleInactive(); void toggleInactive();
@ -125,15 +121,7 @@ private:
UXMode _uxMode { UXMode::DESKTOP }; UXMode _uxMode { UXMode::DESKTOP };
mutable ReadWriteLockable _refreshRateProfileSettingLock; mutable ReadWriteLockable _refreshRateProfileSettingLock;
Setting::Handle<int> _refreshRateProfileSetting{ "refreshRateProfile", RefreshRateProfile::INTERACTIVE }; Setting::Handle<int> _refreshRateProfileSetting { "refreshRateProfile", RefreshRateProfile::INTERACTIVE };
std::array<Setting::Handle<int>, REGIME_NUM> _customRefreshRateSettings { {
{ "customRefreshRateFocusActive", 60 },
{ "customRefreshRateFocusInactive", 60 },
{ "customRefreshRateUnfocus", 60 },
{ "customRefreshRateMinimized", 2 },
{ "customRefreshRateStartup", 30 },
{ "customRefreshRateShutdown", 30 }
} };
std::function<void(int)> _refreshRateOperator { nullptr }; std::function<void(int)> _refreshRateOperator { nullptr };

View file

@ -333,14 +333,6 @@ void AvatarDoctor::diagnoseTextures() {
addTextureToList(material.occlusionTexture); addTextureToList(material.occlusionTexture);
addTextureToList(material.scatteringTexture); addTextureToList(material.scatteringTexture);
addTextureToList(material.lightmapTexture); addTextureToList(material.lightmapTexture);
if (material.isMToonMaterial) {
addTextureToList(material.shadeTexture);
addTextureToList(material.shadingShiftTexture);
addTextureToList(material.matcapTexture);
addTextureToList(material.rimTexture);
addTextureToList(material.uvAnimationTexture);
}
} }
for (const auto& materialMapping : model->getMaterialMapping()) { for (const auto& materialMapping : model->getMaterialMapping()) {

View file

@ -136,14 +136,6 @@ AvatarProject* AvatarProject::createAvatarProject(const QString& projectsFolder,
addTextureToList(material.occlusionTexture); addTextureToList(material.occlusionTexture);
addTextureToList(material.scatteringTexture); addTextureToList(material.scatteringTexture);
addTextureToList(material.lightmapTexture); addTextureToList(material.lightmapTexture);
if (material.isMToonMaterial) {
addTextureToList(material.shadeTexture);
addTextureToList(material.shadingShiftTexture);
addTextureToList(material.matcapTexture);
addTextureToList(material.rimTexture);
addTextureToList(material.uvAnimationTexture);
}
} }
QDir textureDir(textureFolder.isEmpty() ? fbxInfo.absoluteDir() : textureFolder); QDir textureDir(textureFolder.isEmpty() ? fbxInfo.absoluteDir() : textureFolder);

View file

@ -73,7 +73,6 @@
#include "MovingEntitiesOperator.h" #include "MovingEntitiesOperator.h"
#include "SceneScriptingInterface.h" #include "SceneScriptingInterface.h"
#include "WarningsSuppression.h" #include "WarningsSuppression.h"
#include "ScriptPermissions.h"
using namespace std; using namespace std;
@ -227,7 +226,7 @@ MyAvatar::MyAvatar(QThread* thread) :
_yawSpeedSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "yawSpeed", _yawSpeed), _yawSpeedSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "yawSpeed", _yawSpeed),
_hmdYawSpeedSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "hmdYawSpeed", _hmdYawSpeed), _hmdYawSpeedSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "hmdYawSpeed", _hmdYawSpeed),
_pitchSpeedSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "pitchSpeed", _pitchSpeed), _pitchSpeedSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "pitchSpeed", _pitchSpeed),
_fullAvatarURLSetting(QStringList() << SETTINGS_FULL_PRIVATE_GROUP_NAME << AVATAR_SETTINGS_GROUP_NAME << "fullAvatarURL", _fullAvatarURLSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "fullAvatarURL",
AvatarData::defaultFullAvatarModelUrl()), AvatarData::defaultFullAvatarModelUrl()),
_fullAvatarModelNameSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "fullAvatarModelName", _fullAvatarModelName), _fullAvatarModelNameSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "fullAvatarModelName", _fullAvatarModelName),
_animGraphURLSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "animGraphURL", QUrl("")), _animGraphURLSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "animGraphURL", QUrl("")),
@ -1740,11 +1739,10 @@ void MyAvatar::handleChangedAvatarEntityData() {
blobFailed = true; // blob doesn't exist blobFailed = true; // blob doesn't exist
return; return;
} }
_helperScriptEngine.run( [&] { std::lock_guard<std::mutex> guard(_scriptEngineLock);
if (!EntityItemProperties::blobToProperties(*_helperScriptEngine.get(), itr.value(), properties)) { if (!EntityItemProperties::blobToProperties(*_scriptEngine, itr.value(), properties)) {
blobFailed = true; // blob is corrupt blobFailed = true; // blob is corrupt
} }
});
}); });
if (blobFailed) { if (blobFailed) {
// remove from _cachedAvatarEntityBlobUpdatesToSkip just in case: // remove from _cachedAvatarEntityBlobUpdatesToSkip just in case:
@ -1777,11 +1775,10 @@ void MyAvatar::handleChangedAvatarEntityData() {
skip = true; skip = true;
return; return;
} }
_helperScriptEngine.run( [&] { std::lock_guard<std::mutex> guard(_scriptEngineLock);
if (!EntityItemProperties::blobToProperties(*_helperScriptEngine.get(), itr.value(), properties)) { if (!EntityItemProperties::blobToProperties(*_scriptEngine, itr.value(), properties)) {
skip = true; skip = true;
} }
});
}); });
if (!skip && canRezAvatarEntites) { if (!skip && canRezAvatarEntites) {
sanitizeAvatarEntityProperties(properties); sanitizeAvatarEntityProperties(properties);
@ -1886,9 +1883,10 @@ bool MyAvatar::updateStaleAvatarEntityBlobs() const {
if (found) { if (found) {
++numFound; ++numFound;
QByteArray blob; QByteArray blob;
_helperScriptEngine.run( [&] { {
EntityItemProperties::propertiesToBlob(*_helperScriptEngine.get(), getID(), properties, blob); std::lock_guard<std::mutex> guard(_scriptEngineLock);
}); EntityItemProperties::propertiesToBlob(*_scriptEngine, getID(), properties, blob);
}
_avatarEntitiesLock.withWriteLock([&] { _avatarEntitiesLock.withWriteLock([&] {
_cachedAvatarEntityBlobs[id] = blob; _cachedAvatarEntityBlobs[id] = blob;
}); });
@ -1949,9 +1947,10 @@ AvatarEntityMap MyAvatar::getAvatarEntityData() const {
EntityItemProperties properties = entity->getProperties(desiredProperties); EntityItemProperties properties = entity->getProperties(desiredProperties);
QByteArray blob; QByteArray blob;
_helperScriptEngine.run( [&] { {
EntityItemProperties::propertiesToBlob(*_helperScriptEngine.get(), getID(), properties, blob, true); std::lock_guard<std::mutex> guard(_scriptEngineLock);
}); EntityItemProperties::propertiesToBlob(*_scriptEngine, getID(), properties, blob, true);
}
data[entityID] = blob; data[entityID] = blob;
} }
@ -2093,6 +2092,9 @@ void MyAvatar::avatarEntityDataToJson(QJsonObject& root) const {
} }
void MyAvatar::loadData() { void MyAvatar::loadData() {
if (!_scriptEngine) {
_scriptEngine = newScriptEngine();
}
getHead()->setBasePitch(_headPitchSetting.get()); getHead()->setBasePitch(_headPitchSetting.get());
_yawSpeed = _yawSpeedSetting.get(_yawSpeed); _yawSpeed = _yawSpeedSetting.get(_yawSpeed);
@ -2234,9 +2236,6 @@ AttachmentData MyAvatar::loadAttachmentData(const QUrl& modelURL, const QString&
return attachment; return attachment;
} }
bool MyAvatar::isMyAvatarURLProtected() const {
return !ScriptPermissions::isCurrentScriptAllowed(ScriptPermissions::Permission::SCRIPT_PERMISSION_GET_AVATAR_URL);
}
int MyAvatar::parseDataFromBuffer(const QByteArray& buffer) { int MyAvatar::parseDataFromBuffer(const QByteArray& buffer) {
qCDebug(interfaceapp) << "Error: ignoring update packet for MyAvatar" qCDebug(interfaceapp) << "Error: ignoring update packet for MyAvatar"
@ -2701,10 +2700,11 @@ QVariantList MyAvatar::getAvatarEntitiesVariant() {
QVariantMap avatarEntityData; QVariantMap avatarEntityData;
avatarEntityData["id"] = entityID; avatarEntityData["id"] = entityID;
EntityItemProperties entityProperties = entity->getProperties(desiredProperties); EntityItemProperties entityProperties = entity->getProperties(desiredProperties);
_helperScriptEngine.run( [&] { {
ScriptValue scriptProperties = EntityItemPropertiesToScriptValue(_helperScriptEngine.get(), entityProperties); std::lock_guard<std::mutex> guard(_scriptEngineLock);
ScriptValue scriptProperties = EntityItemPropertiesToScriptValue(_scriptEngine.get(), entityProperties);
avatarEntityData["properties"] = scriptProperties.toVariant(); avatarEntityData["properties"] = scriptProperties.toVariant();
}); }
avatarEntitiesData.append(QVariant(avatarEntityData)); avatarEntitiesData.append(QVariant(avatarEntityData));
} }
} }

View file

@ -28,7 +28,6 @@
#include <controllers/Pose.h> #include <controllers/Pose.h>
#include <controllers/Actions.h> #include <controllers/Actions.h>
#include <EntityItem.h> #include <EntityItem.h>
#include <HelperScriptEngine.h>
#include <ThreadSafeValueCache.h> #include <ThreadSafeValueCache.h>
#include <Rig.h> #include <Rig.h>
#include <SettingHandle.h> #include <SettingHandle.h>
@ -2684,7 +2683,6 @@ private:
void setEnableDrawAverageFacing(bool drawAverage) { _drawAverageFacingEnabled = drawAverage; } void setEnableDrawAverageFacing(bool drawAverage) { _drawAverageFacingEnabled = drawAverage; }
bool getEnableDrawAverageFacing() const { return _drawAverageFacingEnabled; } bool getEnableDrawAverageFacing() const { return _drawAverageFacingEnabled; }
virtual bool isMyAvatar() const override { return true; } virtual bool isMyAvatar() const override { return true; }
virtual bool isMyAvatarURLProtected() const override;
virtual int parseDataFromBuffer(const QByteArray& buffer) override; virtual int parseDataFromBuffer(const QByteArray& buffer) override;
virtual glm::vec3 getSkeletonPosition() const override; virtual glm::vec3 getSkeletonPosition() const override;
int _skeletonModelChangeCount { 0 }; int _skeletonModelChangeCount { 0 };
@ -3103,10 +3101,8 @@ private:
mutable std::set<EntityItemID> _staleCachedAvatarEntityBlobs; mutable std::set<EntityItemID> _staleCachedAvatarEntityBlobs;
// //
// keep a ScriptEngine around so we don't have to instantiate on the fly (these are very slow to create/delete) // keep a ScriptEngine around so we don't have to instantiate on the fly (these are very slow to create/delete)
// TODO: profile if it performs better when script engine is on avatar thread or on its own thread mutable std::mutex _scriptEngineLock;
// Own thread is safer from deadlocks ScriptEnginePointer _scriptEngine { nullptr };
mutable HelperScriptEngine _helperScriptEngine;
bool _needToSaveAvatarEntitySettings { false }; bool _needToSaveAvatarEntitySettings { false };
bool _reactionTriggers[NUM_AVATAR_TRIGGER_REACTIONS] { false, false }; bool _reactionTriggers[NUM_AVATAR_TRIGGER_REACTIONS] { false, false };

View file

@ -56,22 +56,12 @@ void PerformanceScriptingInterface::setRefreshRateProfile(RefreshRateProfile ref
emit settingsChanged(); emit settingsChanged();
} }
void PerformanceScriptingInterface::setCustomRefreshRate(RefreshRateManager::RefreshRateRegime refreshRateRegime, int value)
{
qApp->getRefreshRateManager().setCustomRefreshRate(refreshRateRegime, value);
emit settingsChanged();
}
int PerformanceScriptingInterface::getCustomRefreshRate(RefreshRateManager::RefreshRateRegime refreshRateRegime) const {
return qApp->getRefreshRateManager().getCustomRefreshRate(refreshRateRegime);
}
PerformanceScriptingInterface::RefreshRateProfile PerformanceScriptingInterface::getRefreshRateProfile() const { PerformanceScriptingInterface::RefreshRateProfile PerformanceScriptingInterface::getRefreshRateProfile() const {
return (PerformanceScriptingInterface::RefreshRateProfile)qApp->getRefreshRateManager().getRefreshRateProfile(); return (PerformanceScriptingInterface::RefreshRateProfile)qApp->getRefreshRateManager().getRefreshRateProfile();
} }
QStringList PerformanceScriptingInterface::getRefreshRateProfileNames() const { QStringList PerformanceScriptingInterface::getRefreshRateProfileNames() const {
static const QStringList refreshRateProfileNames = { "ECO", "INTERACTIVE", "REALTIME", "CUSTOM" }; static const QStringList refreshRateProfileNames = { "ECO", "INTERACTIVE", "REALTIME" };
return refreshRateProfileNames; return refreshRateProfileNames;
} }

View file

@ -127,22 +127,6 @@ public slots:
*/ */
void setRefreshRateProfile(RefreshRateProfile refreshRateProfile); void setRefreshRateProfile(RefreshRateProfile refreshRateProfile);
/*@jsdoc
* Sets a custom refresh rate.
* @function Performance.setCustomRefreshRate
* @param {RefreshRateRegime} refreshRateRegime - The refresh rate regime
* @param {int} value - The value for the regime
*/
void setCustomRefreshRate(RefreshRateManager::RefreshRateRegime refreshRateRegime, int value);
/*@jsdoc
* Gets the value for a specific RefreshRateRegime.
* @function Performance.getCustomRefreshRate
* @param {RefreshRateRegime} - The regime to get the value from
* @returns {int} - The value from the specified regime
*/
int getCustomRefreshRate(RefreshRateManager::RefreshRateRegime regime) const;
/*@jsdoc /*@jsdoc
* Gets the current refresh rate profile in use. * Gets the current refresh rate profile in use.
* @function Performance.getRefreshRateProfile * @function Performance.getRefreshRateProfile

View file

@ -21,9 +21,6 @@ SettingsScriptingInterface* SettingsScriptingInterface::getInstance() {
} }
QVariant SettingsScriptingInterface::getValue(const QString& setting) { QVariant SettingsScriptingInterface::getValue(const QString& setting) {
if (_restrictPrivateValues && setting.startsWith(SETTINGS_FULL_PRIVATE_GROUP_NAME + "/")) {
return {""};
}
QVariant value = Setting::Handle<QVariant>(setting).get(); QVariant value = Setting::Handle<QVariant>(setting).get();
if (!value.isValid()) { if (!value.isValid()) {
value = ""; value = "";
@ -32,9 +29,6 @@ QVariant SettingsScriptingInterface::getValue(const QString& setting) {
} }
QVariant SettingsScriptingInterface::getValue(const QString& setting, const QVariant& defaultValue) { QVariant SettingsScriptingInterface::getValue(const QString& setting, const QVariant& defaultValue) {
if (_restrictPrivateValues && setting.startsWith(SETTINGS_FULL_PRIVATE_GROUP_NAME + "/")) {
return {""};
}
QVariant value = Setting::Handle<QVariant>(setting, defaultValue).get(); QVariant value = Setting::Handle<QVariant>(setting, defaultValue).get();
if (!value.isValid()) { if (!value.isValid()) {
value = ""; value = "";
@ -46,7 +40,7 @@ void SettingsScriptingInterface::setValue(const QString& setting, const QVariant
if (getValue(setting) == value) { if (getValue(setting) == value) {
return; return;
} }
if (setting.startsWith("private/") || setting.startsWith(SETTINGS_FULL_PRIVATE_GROUP_NAME + "/")) { if (setting.startsWith("private/")) {
if (_restrictPrivateValues) { if (_restrictPrivateValues) {
qWarning() << "SettingsScriptingInterface::setValue -- restricted write: " << setting << value; qWarning() << "SettingsScriptingInterface::setValue -- restricted write: " << setting << value;
return; return;

View file

@ -100,8 +100,7 @@ void setupPreferences() {
QStringList refreshRateProfiles QStringList refreshRateProfiles
{ QString::fromStdString(RefreshRateManager::refreshRateProfileToString(RefreshRateManager::RefreshRateProfile::ECO)), { QString::fromStdString(RefreshRateManager::refreshRateProfileToString(RefreshRateManager::RefreshRateProfile::ECO)),
QString::fromStdString(RefreshRateManager::refreshRateProfileToString(RefreshRateManager::RefreshRateProfile::INTERACTIVE)), QString::fromStdString(RefreshRateManager::refreshRateProfileToString(RefreshRateManager::RefreshRateProfile::INTERACTIVE)),
QString::fromStdString(RefreshRateManager::refreshRateProfileToString(RefreshRateManager::RefreshRateProfile::REALTIME)), QString::fromStdString(RefreshRateManager::refreshRateProfileToString(RefreshRateManager::RefreshRateProfile::REALTIME)) };
QString::fromStdString(RefreshRateManager::refreshRateProfileToString(RefreshRateManager::RefreshRateProfile::CUSTOM)) };
preference->setItems(refreshRateProfiles); preference->setItems(refreshRateProfiles);
preferences->addPreference(preference); preferences->addPreference(preference);

View file

@ -281,7 +281,7 @@ if (APPLE)
set(CPACK_NSIS_DISPLAY_NAME ${_DISPLAY_NAME}) set(CPACK_NSIS_DISPLAY_NAME ${_DISPLAY_NAME})
set(DMG_SUBFOLDER_NAME "Overte") set(DMG_SUBFOLDER_NAME "Vircadia")
set(ESCAPED_DMG_SUBFOLDER_NAME "") set(ESCAPED_DMG_SUBFOLDER_NAME "")
set(DMG_SUBFOLDER_ICON "${CMAKE_SOURCE_DIR}/cmake/installer/install-folder.rsrc") set(DMG_SUBFOLDER_ICON "${CMAKE_SOURCE_DIR}/cmake/installer/install-folder.rsrc")

View file

@ -2106,14 +2106,6 @@ const QUrl& AvatarData::getSkeletonModelURL() const {
} }
} }
QString AvatarData::getSkeletonModelURLFromScript() const {
if (isMyAvatar() && !isMyAvatarURLProtected()) {
return _skeletonModelURL.toString();
}
return QString();
};
QByteArray AvatarData::packSkeletonData() const { QByteArray AvatarData::packSkeletonData() const {
// Send an avatar trait packet with the skeleton data before the mesh is loaded // Send an avatar trait packet with the skeleton data before the mesh is loaded
int avatarDataSize = 0; int avatarDataSize = 0;

View file

@ -610,8 +610,6 @@ public:
AvatarData(); AvatarData();
virtual ~AvatarData(); virtual ~AvatarData();
virtual bool isMyAvatarURLProtected() const { return false; } // This needs to be here because both MyAvatar and AvatarData inherit from MyAvatar
static const QUrl& defaultFullAvatarModelUrl(); static const QUrl& defaultFullAvatarModelUrl();
const QUuid getSessionUUID() const { return getID(); } const QUuid getSessionUUID() const { return getID(); }
@ -1357,7 +1355,7 @@ public:
*/ */
Q_INVOKABLE virtual void detachAll(const QString& modelURL, const QString& jointName = QString()); Q_INVOKABLE virtual void detachAll(const QString& modelURL, const QString& jointName = QString());
QString getSkeletonModelURLFromScript() const; QString getSkeletonModelURLFromScript() const { return _skeletonModelURL.toString(); }
void setSkeletonModelURLFromScript(const QString& skeletonModelString) { setSkeletonModelURL(QUrl(skeletonModelString)); } void setSkeletonModelURLFromScript(const QString& skeletonModelString) { setSkeletonModelURL(QUrl(skeletonModelString)); }
void setOwningAvatarMixer(const QWeakPointer<Node>& owningAvatarMixer) { _owningAvatarMixer = owningAvatarMixer; } void setOwningAvatarMixer(const QWeakPointer<Node>& owningAvatarMixer) { _owningAvatarMixer = owningAvatarMixer; }

View file

@ -13,7 +13,6 @@
#include "ScriptAvatarData.h" #include "ScriptAvatarData.h"
#include <NodeList.h>
#include <ScriptEngineCast.h> #include <ScriptEngineCast.h>
#include <ScriptManager.h> #include <ScriptManager.h>
@ -205,12 +204,7 @@ bool ScriptAvatarData::getLookAtSnappingEnabled() const {
// //
QString ScriptAvatarData::getSkeletonModelURLFromScript() const { QString ScriptAvatarData::getSkeletonModelURLFromScript() const {
if (AvatarSharedPointer sharedAvatarData = _avatarData.lock()) { if (AvatarSharedPointer sharedAvatarData = _avatarData.lock()) {
auto nodeList = DependencyManager::get<NodeList>(); return sharedAvatarData->getSkeletonModelURLFromScript();
if (sharedAvatarData->isMyAvatar() && !sharedAvatarData->isMyAvatarURLProtected() && nodeList->getThisNodeCanViewAssetURLs()) {
return sharedAvatarData->getSkeletonModelURLFromScript();
}
return QString();
} else { } else {
return QString(); return QString();
} }

View file

@ -36,7 +36,8 @@ MaterialBaker::MaterialBaker(const QString& materialData, bool isURL, const QStr
_isURL(isURL), _isURL(isURL),
_destinationPath(destinationPath), _destinationPath(destinationPath),
_bakedOutputDir(bakedOutputDir), _bakedOutputDir(bakedOutputDir),
_textureOutputDir(bakedOutputDir + "/materialTextures/" + QString::number(materialNum++)) _textureOutputDir(bakedOutputDir + "/materialTextures/" + QString::number(materialNum++)),
_scriptEngine(newScriptEngine())
{ {
} }
@ -213,20 +214,16 @@ void MaterialBaker::outputMaterial() {
if (_materialResource->parsedMaterials.networkMaterials.size() == 1) { if (_materialResource->parsedMaterials.networkMaterials.size() == 1) {
auto networkMaterial = _materialResource->parsedMaterials.networkMaterials.begin(); auto networkMaterial = _materialResource->parsedMaterials.networkMaterials.begin();
auto scriptableMaterial = scriptable::ScriptableMaterial(networkMaterial->second); auto scriptableMaterial = scriptable::ScriptableMaterial(networkMaterial->second);
_helperScriptEngine.run( [&] { QVariant materialVariant =
QVariant materialVariant = scriptable::scriptableMaterialToScriptValue(_scriptEngine.get(), scriptableMaterial).toVariant();
scriptable::scriptableMaterialToScriptValue(_helperScriptEngine.get(), scriptableMaterial).toVariant(); json.insert("materials", QJsonDocument::fromVariant(materialVariant).object());
json.insert("materials", QJsonDocument::fromVariant(materialVariant).object());
});
} else { } else {
QJsonArray materialArray; QJsonArray materialArray;
for (auto networkMaterial : _materialResource->parsedMaterials.networkMaterials) { for (auto networkMaterial : _materialResource->parsedMaterials.networkMaterials) {
auto scriptableMaterial = scriptable::ScriptableMaterial(networkMaterial.second); auto scriptableMaterial = scriptable::ScriptableMaterial(networkMaterial.second);
_helperScriptEngine.run( [&] { QVariant materialVariant =
QVariant materialVariant = scriptable::scriptableMaterialToScriptValue(_scriptEngine.get(), scriptableMaterial).toVariant();
scriptable::scriptableMaterialToScriptValue(_helperScriptEngine.get(), scriptableMaterial).toVariant(); materialArray.append(QJsonDocument::fromVariant(materialVariant).object());
materialArray.append(QJsonDocument::fromVariant(materialVariant).object());
});
} }
json.insert("materials", materialArray); json.insert("materials", materialArray);
} }
@ -272,32 +269,19 @@ void MaterialBaker::setMaterials(const QHash<QString, hfm::Material>& materials,
_materialResource = NetworkMaterialResourcePointer(new NetworkMaterialResource(), [](NetworkMaterialResource* ptr) { ptr->deleteLater(); }); _materialResource = NetworkMaterialResourcePointer(new NetworkMaterialResource(), [](NetworkMaterialResource* ptr) { ptr->deleteLater(); });
for (auto& material : materials) { for (auto& material : materials) {
_materialResource->parsedMaterials.names.push_back(material.name.toStdString()); _materialResource->parsedMaterials.names.push_back(material.name.toStdString());
if (!material.isMToonMaterial) { _materialResource->parsedMaterials.networkMaterials[material.name.toStdString()] = std::make_shared<NetworkMaterial>(material, baseURL);
_materialResource->parsedMaterials.networkMaterials[material.name.toStdString()] = std::make_shared<NetworkMaterial>(material, baseURL);
} else {
_materialResource->parsedMaterials.networkMaterials[material.name.toStdString()] = std::make_shared<NetworkMToonMaterial>(material, baseURL);
}
// Store any embedded texture content // Store any embedded texture content
addTexture(material.name, image::TextureUsage::NORMAL_TEXTURE, material.normalTexture); addTexture(material.name, image::TextureUsage::NORMAL_TEXTURE, material.normalTexture);
addTexture(material.name, image::TextureUsage::ALBEDO_TEXTURE, material.albedoTexture); addTexture(material.name, image::TextureUsage::ALBEDO_TEXTURE, material.albedoTexture);
addTexture(material.name, image::TextureUsage::GLOSS_TEXTURE, material.glossTexture);
addTexture(material.name, image::TextureUsage::ROUGHNESS_TEXTURE, material.roughnessTexture);
addTexture(material.name, image::TextureUsage::SPECULAR_TEXTURE, material.specularTexture);
addTexture(material.name, image::TextureUsage::METALLIC_TEXTURE, material.metallicTexture);
addTexture(material.name, image::TextureUsage::EMISSIVE_TEXTURE, material.emissiveTexture); addTexture(material.name, image::TextureUsage::EMISSIVE_TEXTURE, material.emissiveTexture);
addTexture(material.name, image::TextureUsage::OCCLUSION_TEXTURE, material.occlusionTexture);
if (!material.isMToonMaterial) { addTexture(material.name, image::TextureUsage::SCATTERING_TEXTURE, material.scatteringTexture);
addTexture(material.name, image::TextureUsage::GLOSS_TEXTURE, material.glossTexture); addTexture(material.name, image::TextureUsage::LIGHTMAP_TEXTURE, material.lightmapTexture);
addTexture(material.name, image::TextureUsage::ROUGHNESS_TEXTURE, material.roughnessTexture);
addTexture(material.name, image::TextureUsage::SPECULAR_TEXTURE, material.specularTexture);
addTexture(material.name, image::TextureUsage::METALLIC_TEXTURE, material.metallicTexture);
addTexture(material.name, image::TextureUsage::OCCLUSION_TEXTURE, material.occlusionTexture);
addTexture(material.name, image::TextureUsage::SCATTERING_TEXTURE, material.scatteringTexture);
addTexture(material.name, image::TextureUsage::LIGHTMAP_TEXTURE, material.lightmapTexture);
} else {
addTexture(material.name, image::TextureUsage::ALBEDO_TEXTURE, material.shadeTexture);
addTexture(material.name, image::TextureUsage::ROUGHNESS_TEXTURE, material.shadingShiftTexture);
addTexture(material.name, image::TextureUsage::EMISSIVE_TEXTURE, material.matcapTexture);
addTexture(material.name, image::TextureUsage::ALBEDO_TEXTURE, material.rimTexture);
addTexture(material.name, image::TextureUsage::ROUGHNESS_TEXTURE, material.uvAnimationTexture);
}
} }
} }

View file

@ -21,7 +21,6 @@
#include "TextureBaker.h" #include "TextureBaker.h"
#include "baking/TextureFileNamer.h" #include "baking/TextureFileNamer.h"
#include <HelperScriptEngine.h>
#include <procedural/ProceduralMaterialCache.h> #include <procedural/ProceduralMaterialCache.h>
#include <ScriptEngine.h> #include <ScriptEngine.h>
@ -73,7 +72,7 @@ private:
QString _textureOutputDir; QString _textureOutputDir;
QString _bakedMaterialData; QString _bakedMaterialData;
HelperScriptEngine _helperScriptEngine; ScriptEnginePointer _scriptEngine;
static std::function<QThread*()> _getNextOvenWorkerThreadOperator; static std::function<QThread*()> _getNextOvenWorkerThreadOperator;
TextureFileNamer _textureFileNamer; TextureFileNamer _textureFileNamer;

View file

@ -1195,9 +1195,9 @@ Mapping::Pointer UserInputMapper::parseMapping(const QString& json) {
QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8(), &error); QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8(), &error);
// check validity of the document // check validity of the document
if (doc.isNull()) { if (doc.isNull()) {
qCCritical(controllers) << "Invalid JSON...\n"; qCDebug(controllers) << "Invalid JSON...\n";
qCCritical(controllers) << error.errorString(); qCDebug(controllers) << error.errorString();
qCCritical(controllers) << "JSON was:\n" << json << Qt::endl; qCDebug(controllers) << "JSON was:\n" << json << Qt::endl;
return Mapping::Pointer(); return Mapping::Pointer();
} }

View file

@ -743,13 +743,6 @@ void OpenGLDisplayPlugin::present(const std::shared_ptr<RefreshRateController>&
} }
gpu::Backend::freeGPUMemSize.set(gpu::gl::getFreeDedicatedMemory()); gpu::Backend::freeGPUMemSize.set(gpu::gl::getFreeDedicatedMemory());
// Drop current frame after presenting it once.
// This is required for the OpenXR frame cycle, since we call xrEndFrame after presenting.
// xrEndFrame must not be called multiple times.
if (_presentOnlyOnce) {
_currentFrame.reset();
}
} else if (alwaysPresent()) { } else if (alwaysPresent()) {
refreshRateController->clockEndTime(); refreshRateController->clockEndTime();
internalPresent(); internalPresent();

View file

@ -201,6 +201,4 @@ protected:
QImage getScreenshot(float aspectRatio); QImage getScreenshot(float aspectRatio);
QImage getSecondaryCameraScreenshot(); QImage getSecondaryCameraScreenshot();
bool _presentOnlyOnce = false;
}; };

View file

@ -337,26 +337,21 @@ void MaterialEntityRenderer::doRender(RenderArgs* args) {
} }
// Draw! // Draw!
const uint32_t compactColor = 0xFFFFFFFF; DependencyManager::get<GeometryCache>()->renderSphere(batch);
_colorBuffer->setData(sizeof(compactColor), (const gpu::Byte*) &compactColor);
DependencyManager::get<GeometryCache>()->renderShape(batch, GeometryCache::Shape::Sphere, _colorBuffer);
} else { } else {
auto proceduralDrawMaterial = std::static_pointer_cast<graphics::ProceduralMaterial>(drawMaterial); auto proceduralDrawMaterial = std::static_pointer_cast<graphics::ProceduralMaterial>(drawMaterial);
glm::vec4 outColor = glm::vec4(drawMaterial->getAlbedo(), drawMaterial->getOpacity()); glm::vec4 outColor = glm::vec4(drawMaterial->getAlbedo(), drawMaterial->getOpacity());
outColor = proceduralDrawMaterial->getColor(outColor); outColor = proceduralDrawMaterial->getColor(outColor);
proceduralDrawMaterial->prepare(batch, transform.getTranslation(), transform.getScale(), proceduralDrawMaterial->prepare(batch, transform.getTranslation(), transform.getScale(),
transform.getRotation(), _created, ProceduralProgramKey(outColor.a < 1.0f)); transform.getRotation(), _created, ProceduralProgramKey(outColor.a < 1.0f));
const uint32_t compactColor = GeometryCache::toCompactColor(glm::vec4(outColor));
_colorBuffer->setData(sizeof(compactColor), (const gpu::Byte*) &compactColor);
if (render::ShapeKey(args->_globalShapeKey).isWireframe() || _primitiveMode == PrimitiveMode::LINES) { if (render::ShapeKey(args->_globalShapeKey).isWireframe() || _primitiveMode == PrimitiveMode::LINES) {
DependencyManager::get<GeometryCache>()->renderWireShape(batch, GeometryCache::Shape::Sphere, _colorBuffer); DependencyManager::get<GeometryCache>()->renderWireSphere(batch, outColor);
} else { } else {
DependencyManager::get<GeometryCache>()->renderShape(batch, GeometryCache::Shape::Sphere, _colorBuffer); DependencyManager::get<GeometryCache>()->renderSphere(batch, outColor);
} }
} }
args->_details._trianglesRendered += (int)DependencyManager::get<GeometryCache>()->getShapeTriangleCount(GeometryCache::Shape::Sphere); args->_details._trianglesRendered += (int)DependencyManager::get<GeometryCache>()->getSphereTriangleCount();
} }
void MaterialEntityRenderer::setCurrentMaterialName(const std::string& currentMaterialName) { void MaterialEntityRenderer::setCurrentMaterialName(const std::string& currentMaterialName) {

View file

@ -67,7 +67,6 @@ private:
std::shared_ptr<NetworkMaterial> _appliedMaterial; std::shared_ptr<NetworkMaterial> _appliedMaterial;
std::string _currentMaterialName; std::string _currentMaterialName;
gpu::BufferPointer _colorBuffer { std::make_shared<gpu::Buffer>() };
}; };
} } } }

View file

@ -21,48 +21,23 @@ using namespace render::entities;
static uint8_t CUSTOM_PIPELINE_NUMBER = 0; static uint8_t CUSTOM_PIPELINE_NUMBER = 0;
static gpu::Stream::FormatPointer _vertexFormat; static gpu::Stream::FormatPointer _vertexFormat;
// forward, transparent, shadow, wireframe static std::weak_ptr<gpu::Pipeline> _texturedPipeline;
static std::map<std::tuple<bool, bool, bool, bool>, gpu::PipelinePointer> _pipelines;
static ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, const ShapeKey& key, RenderArgs* args) { static ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, const ShapeKey& key, RenderArgs* args) {
if (_pipelines.empty()) { auto texturedPipeline = _texturedPipeline.lock();
using namespace shader::entities_renderer::program; if (!texturedPipeline) {
auto state = std::make_shared<gpu::State>();
state->setCullMode(gpu::State::CULL_BACK);
state->setDepthTest(true, false, gpu::LESS_EQUAL);
state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
PrepareStencil::testMask(*state);
// forward, translucent, shadow auto program = gpu::Shader::createProgram(shader::entities_renderer::program::textured_particle);
static const std::vector<std::tuple<bool, bool, bool, uint32_t>> keys = { _texturedPipeline = texturedPipeline = gpu::Pipeline::create(program, state);
std::make_tuple(false, false, false, textured_particle),
std::make_tuple(true, false, false, textured_particle_forward),
std::make_tuple(false, true, false, textured_particle_translucent),
std::make_tuple(true, true, false, textured_particle_translucent_forward),
std::make_tuple(false, false, true, textured_particle_shadow),
// no such thing as shadow and forward/translucent
};
for (auto& key : keys) {
for (int i = 0; i < 2; ++i) {
bool transparent = std::get<1>(key);
bool wireframe = i == 0;
auto state = std::make_shared<gpu::State>();
state->setCullMode(gpu::State::CULL_BACK);
if (wireframe) {
state->setFillMode(gpu::State::FILL_LINE);
}
state->setDepthTest(true, !transparent, gpu::LESS_EQUAL);
state->setBlendFunction(transparent, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
transparent ? PrepareStencil::testMask(*state) : PrepareStencil::testMaskDrawShape(*state);
auto program = gpu::Shader::createProgram(std::get<3>(key));
_pipelines[std::make_tuple(std::get<0>(key), transparent, std::get<2>(key), wireframe)] = gpu::Pipeline::create(program, state);
}
}
} }
return std::make_shared<render::ShapePipeline>(_pipelines[std::make_tuple(args->_renderMethod == Args::RenderMethod::FORWARD, key.isTranslucent(), return std::make_shared<render::ShapePipeline>(texturedPipeline, nullptr, nullptr, nullptr);
args->_renderMode == Args::RenderMode::SHADOW_RENDER_MODE, key.isWireframe())], nullptr, nullptr, nullptr);
} }
struct GpuParticle { struct GpuParticle {
@ -163,25 +138,26 @@ void ParticleEffectEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEn
_uniformBuffer.edit<ParticleUniforms>() = particleUniforms; _uniformBuffer.edit<ParticleUniforms>() = particleUniforms;
} }
bool ParticleEffectEntityRenderer::isTransparent() const { ItemKey ParticleEffectEntityRenderer::getKey() {
bool particleTransparent = _particleProperties.getColorStart().a < 1.0f || _particleProperties.getColorMiddle().a < 1.0f || // FIXME: implement isTransparent() for particles and an opaque pipeline
_particleProperties.getColorFinish().a < 1.0f || _particleProperties.getColorSpread().a > 0.0f || auto builder = ItemKey::Builder::transparentShape().withTagBits(getTagMask()).withLayer(getHifiRenderLayer());
_pulseProperties.getAlphaMode() != PulseMode::NONE || (_textureLoaded && _networkTexture && _networkTexture->getGPUTexture() &&
_networkTexture->getGPUTexture()->getUsage().isAlpha() && !_networkTexture->getGPUTexture()->getUsage().isAlphaMask()); if (!_visible) {
return particleTransparent || Parent::isTransparent(); builder.withInvisible();
}
if (_cullWithParent) {
builder.withSubMetaCulled();
}
return builder.build();
} }
ShapeKey ParticleEffectEntityRenderer::getShapeKey() { ShapeKey ParticleEffectEntityRenderer::getShapeKey() {
auto builder = ShapeKey::Builder().withCustom(CUSTOM_PIPELINE_NUMBER); auto builder = ShapeKey::Builder().withCustom(CUSTOM_PIPELINE_NUMBER).withTranslucent();
if (isTransparent()) {
builder.withTranslucent();
}
if (_primitiveMode == PrimitiveMode::LINES) { if (_primitiveMode == PrimitiveMode::LINES) {
builder.withWireframe(); builder.withWireframe();
} }
return builder.build(); return builder.build();
} }

View file

@ -28,7 +28,7 @@ protected:
virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override; virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;
virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override; virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override;
bool isTransparent() const override; virtual ItemKey getKey() override;
virtual ShapeKey getShapeKey() override; virtual ShapeKey getShapeKey() override;
virtual Item::Bound getBound(RenderArgs* args) override; virtual Item::Bound getBound(RenderArgs* args) override;
virtual void doRender(RenderArgs* args) override; virtual void doRender(RenderArgs* args) override;

View file

@ -1719,28 +1719,21 @@ using namespace render;
using namespace render::entities; using namespace render::entities;
static uint8_t CUSTOM_PIPELINE_NUMBER; static uint8_t CUSTOM_PIPELINE_NUMBER;
// forward, shadow, fade, wireframe static std::map<std::tuple<bool, bool, bool>, ShapePipelinePointer> _pipelines;
static std::map<std::tuple<bool, bool, bool, bool>, ShapePipelinePointer> _pipelines;
static gpu::Stream::FormatPointer _vertexFormat; static gpu::Stream::FormatPointer _vertexFormat;
ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, const ShapeKey& key, RenderArgs* args) { ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, const ShapeKey& key, RenderArgs* args) {
// FIXME: custom pipelines like this don't handle shadows or renderLayers correctly
if (_pipelines.empty()) { if (_pipelines.empty()) {
using namespace shader::entities_renderer::program; using namespace shader::entities_renderer::program;
// forward, shadow, fade static const std::vector<std::tuple<bool, bool, uint32_t>> keys = {
static const std::vector<std::tuple<bool, bool, bool, uint32_t>> keys = { std::make_tuple(false, false, polyvox), std::make_tuple(true, false, polyvox_forward)
std::make_tuple(false, false, false, polyvox),
std::make_tuple(true, false, false, polyvox_forward),
std::make_tuple(false, true, false, polyvox_shadow),
// no such thing as forward + shadow
#ifdef POLYVOX_ENTITY_USE_FADE_EFFECT #ifdef POLYVOX_ENTITY_USE_FADE_EFFECT
std::make_tuple(false, false, true, polyvox_fade), , std::make_tuple(false, true, polyvox_fade), std::make_tuple(true, true, polyvox_forward_fade)
std::make_tuple(false, true, true, polyvox_shadow_fade),
// no such thing as forward + fade/shadow
#else #else
std::make_tuple(false, false, true, polyvox), , std::make_tuple(false, true, polyvox), std::make_tuple(true, true, polyvox_forward)
std::make_tuple(false, true, true, polyvox_shadow),
// no such thing as forward + fade/shadow
#endif #endif
}; };
for (auto& key : keys) { for (auto& key : keys) {
@ -1756,19 +1749,19 @@ ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, const Sha
state->setFillMode(gpu::State::FILL_LINE); state->setFillMode(gpu::State::FILL_LINE);
} }
auto pipeline = gpu::Pipeline::create(gpu::Shader::createProgram(std::get<3>(key)), state); auto pipeline = gpu::Pipeline::create(gpu::Shader::createProgram(std::get<2>(key)), state);
if (!std::get<2>(key)) { if (std::get<1>(key)) {
_pipelines[std::make_tuple(std::get<0>(key), std::get<1>(key), std::get<2>(key), wireframe)] = std::make_shared<render::ShapePipeline>(pipeline, nullptr, nullptr, nullptr); _pipelines[std::make_tuple(std::get<0>(key), std::get<1>(key), wireframe)] = std::make_shared<render::ShapePipeline>(pipeline, nullptr, nullptr, nullptr);
} else { } else {
const auto& fadeEffect = DependencyManager::get<FadeEffect>(); const auto& fadeEffect = DependencyManager::get<FadeEffect>();
_pipelines[std::make_tuple(std::get<0>(key), std::get<1>(key), std::get<2>(key), wireframe)] = std::make_shared<render::ShapePipeline>(pipeline, nullptr, _pipelines[std::make_tuple(std::get<0>(key), std::get<1>(key), wireframe)] = std::make_shared<render::ShapePipeline>(pipeline, nullptr,
fadeEffect->getBatchSetter(), fadeEffect->getItemUniformSetter()); fadeEffect->getBatchSetter(), fadeEffect->getItemUniformSetter());
} }
} }
} }
} }
return _pipelines[std::make_tuple(args->_renderMethod == Args::RenderMethod::FORWARD, args->_renderMode == Args::RenderMode::SHADOW_RENDER_MODE, key.isFaded(), key.isWireframe())]; return _pipelines[std::make_tuple(args->_renderMethod == Args::RenderMethod::FORWARD, key.isFaded(), key.isWireframe())];
} }
PolyVoxEntityRenderer::PolyVoxEntityRenderer(const EntityItemPointer& entity) : Parent(entity) { PolyVoxEntityRenderer::PolyVoxEntityRenderer(const EntityItemPointer& entity) : Parent(entity) {
@ -1782,6 +1775,16 @@ PolyVoxEntityRenderer::PolyVoxEntityRenderer(const EntityItemPointer& entity) :
_params = std::make_shared<gpu::Buffer>(sizeof(glm::vec4), nullptr); _params = std::make_shared<gpu::Buffer>(sizeof(glm::vec4), nullptr);
} }
ItemKey PolyVoxEntityRenderer::getKey() {
auto builder = ItemKey::Builder::opaqueShape().withTagBits(getTagMask()).withLayer(getHifiRenderLayer());
if (_cullWithParent) {
builder.withSubMetaCulled();
}
return builder.build();
}
ShapeKey PolyVoxEntityRenderer::getShapeKey() { ShapeKey PolyVoxEntityRenderer::getShapeKey() {
auto builder = ShapeKey::Builder().withCustom(CUSTOM_PIPELINE_NUMBER); auto builder = ShapeKey::Builder().withCustom(CUSTOM_PIPELINE_NUMBER);
if (_primitiveMode == PrimitiveMode::LINES) { if (_primitiveMode == PrimitiveMode::LINES) {
@ -1863,7 +1866,13 @@ void PolyVoxEntityRenderer::doRender(RenderArgs* args) {
batch.setModelTransform(transform); batch.setModelTransform(transform);
batch.setInputFormat(_vertexFormat); batch.setInputFormat(_vertexFormat);
batch.setInputBuffer(gpu::Stream::POSITION, _mesh->getVertexBuffer()._buffer, 0, sizeof(PolyVox::PositionMaterialNormal)); batch.setInputBuffer(gpu::Stream::POSITION, _mesh->getVertexBuffer()._buffer, 0,
sizeof(PolyVox::PositionMaterialNormal));
// TODO -- should we be setting this?
// batch.setInputBuffer(gpu::Stream::NORMAL, mesh->getVertexBuffer()._buffer,
// 12,
// sizeof(PolyVox::PositionMaterialNormal));
batch.setIndexBuffer(gpu::UINT32, _mesh->getIndexBuffer()._buffer, 0); batch.setIndexBuffer(gpu::UINT32, _mesh->getIndexBuffer()._buffer, 0);
for (size_t i = 0; i < _xyzTextures.size(); ++i) { for (size_t i = 0; i < _xyzTextures.size(); ++i) {

View file

@ -203,6 +203,7 @@ public:
} }
protected: protected:
virtual ItemKey getKey() override;
virtual ShapeKey getShapeKey() override; virtual ShapeKey getShapeKey() override;
virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override; virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override;
virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override; virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;

View file

@ -131,12 +131,10 @@ void ShapeEntityRenderer::doRender(RenderArgs* args) {
procedural->prepare(batch, transform.getTranslation(), transform.getScale(), transform.getRotation(), _created, ProceduralProgramKey(outColor.a < 1.0f)); procedural->prepare(batch, transform.getTranslation(), transform.getScale(), transform.getRotation(), _created, ProceduralProgramKey(outColor.a < 1.0f));
}); });
const uint32_t compactColor = GeometryCache::toCompactColor(glm::vec4(outColor));
_colorBuffer->setData(sizeof(compactColor), (const gpu::Byte*) &compactColor);
if (wireframe) { if (wireframe) {
geometryCache->renderWireShape(batch, geometryShape, _colorBuffer); geometryCache->renderWireShape(batch, geometryShape, outColor);
} else { } else {
geometryCache->renderShape(batch, geometryShape, _colorBuffer); geometryCache->renderShape(batch, geometryShape, outColor);
} }
} else if (pipelineType == Pipeline::SIMPLE) { } else if (pipelineType == Pipeline::SIMPLE) {
// FIXME, support instanced multi-shape rendering using multidraw indirect // FIXME, support instanced multi-shape rendering using multidraw indirect
@ -151,12 +149,10 @@ void ShapeEntityRenderer::doRender(RenderArgs* args) {
geometryCache->renderSolidShapeInstance(args, batch, geometryShape, outColor, pipeline); geometryCache->renderSolidShapeInstance(args, batch, geometryShape, outColor, pipeline);
} }
} else { } else {
const uint32_t compactColor = GeometryCache::toCompactColor(glm::vec4(outColor));
_colorBuffer->setData(sizeof(compactColor), (const gpu::Byte*) &compactColor);
if (wireframe) { if (wireframe) {
geometryCache->renderWireShape(batch, geometryShape, _colorBuffer); geometryCache->renderWireShape(batch, geometryShape, outColor);
} else { } else {
geometryCache->renderShape(batch, geometryShape, _colorBuffer); geometryCache->renderShape(batch, geometryShape, outColor);
} }
} }
} else { } else {
@ -164,9 +160,7 @@ void ShapeEntityRenderer::doRender(RenderArgs* args) {
args->_details._materialSwitches++; args->_details._materialSwitches++;
} }
const uint32_t compactColor = GeometryCache::toCompactColor(glm::vec4(outColor)); geometryCache->renderShape(batch, geometryShape);
_colorBuffer->setData(sizeof(compactColor), (const gpu::Byte*) &compactColor);
geometryCache->renderShape(batch, geometryShape, _colorBuffer);
} }
const auto triCount = geometryCache->getShapeTriangleCount(geometryShape); const auto triCount = geometryCache->getShapeTriangleCount(geometryShape);

View file

@ -42,8 +42,6 @@ private:
std::shared_ptr<graphics::ProceduralMaterial> _material { std::make_shared<graphics::ProceduralMaterial>() }; std::shared_ptr<graphics::ProceduralMaterial> _material { std::make_shared<graphics::ProceduralMaterial>() };
glm::vec3 _color { NAN }; glm::vec3 _color { NAN };
float _alpha { NAN }; float _alpha { NAN };
gpu::BufferPointer _colorBuffer { std::make_shared<gpu::Buffer>() };
}; };
} } } }

View file

@ -1 +0,0 @@
DEFINES (translucent:f forward:f)/shadow:f

View file

@ -15,34 +15,8 @@ LAYOUT(binding=0) uniform sampler2D colorMap;
layout(location=0) in vec4 varColor; layout(location=0) in vec4 varColor;
layout(location=1) in vec2 varTexcoord; layout(location=1) in vec2 varTexcoord;
<@if HIFI_USE_FORWARD or HIFI_USE_SHADOW@> layout(location=0) out vec4 outFragColor;
layout(location=0) out vec4 _fragColor0;
<@else@>
<@include DeferredBufferWrite.slh@>
<@endif@>
void main(void) { void main(void) {
vec4 albedo = texture(colorMap, varTexcoord.xy) * varColor; outFragColor = texture(colorMap, varTexcoord.xy) * varColor;
<@if HIFI_USE_FORWARD or HIFI_USE_SHADOW@>
<@if not HIFI_USE_TRANSLUCENT@>
// to reduce texel flickering for floating point error we discard when alpha is "almost one"
if (albedo.a < 0.999999) {
discard;
}
<@endif@>
<@if HIFI_USE_FORWARD@>
_fragColor0 = albedo;
<@else@>
_fragColor0 = vec4(1.0);
<@endif@>
<@else@>
vec3 NORMAL = vec3(1.0, 0.0, 0.0);
<@if not HIFI_USE_TRANSLUCENT@>
packDeferredFragmentUnlit(NORMAL, albedo.a, albedo.rgb);
<@else@>
packDeferredFragmentTranslucent(NORMAL, albedo.a, albedo.rgb, DEFAULT_ROUGHNESS);
<@endif@>
<@endif@>
} }

View file

@ -22,12 +22,10 @@
const float AmbientLightPropertyGroup::DEFAULT_AMBIENT_LIGHT_INTENSITY = 0.5f; const float AmbientLightPropertyGroup::DEFAULT_AMBIENT_LIGHT_INTENSITY = 0.5f;
void AmbientLightPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, void AmbientLightPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, ScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const {
bool isMyOwnAvatarEntity) const {
auto nodeList = DependencyManager::get<NodeList>();
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_AMBIENT_LIGHT_INTENSITY, AmbientLight, ambientLight, AmbientIntensity, ambientIntensity); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_AMBIENT_LIGHT_INTENSITY, AmbientLight, ambientLight, AmbientIntensity, ambientIntensity);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_AMBIENT_LIGHT_URL, AmbientLight, ambientLight, AmbientURL, ambientURL); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_AMBIENT_LIGHT_URL, AmbientLight, ambientLight, AmbientURL, ambientURL);
} }
void AmbientLightPropertyGroup::copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) { void AmbientLightPropertyGroup::copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) {

View file

@ -43,8 +43,7 @@ public:
// EntityItemProperty related helpers // EntityItemProperty related helpers
virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, ScriptEngine* engine, bool skipDefaults,
EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const override;
bool isMyOwnAvatarEntity) const override;
virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override; virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override;
void merge(const AmbientLightPropertyGroup& other); void merge(const AmbientLightPropertyGroup& other);

View file

@ -68,10 +68,8 @@ bool operator!=(const AnimationPropertyGroup& a, const AnimationPropertyGroup& b
* maintained when the animation stops playing, <code>false</code> if they aren't. * maintained when the animation stops playing, <code>false</code> if they aren't.
*/ */
void AnimationPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, ScriptEngine* engine, void AnimationPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, ScriptEngine* engine,
bool skipDefaults, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, bool skipDefaults, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const {
bool isMyOwnAvatarEntity) const { COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ANIMATION_URL, Animation, animation, URL, url);
auto nodeList = DependencyManager::get<NodeList>();
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_ANIMATION_URL, Animation, animation, URL, url);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ANIMATION_ALLOW_TRANSLATION, Animation, animation, AllowTranslation, allowTranslation); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ANIMATION_ALLOW_TRANSLATION, Animation, animation, AllowTranslation, allowTranslation);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ANIMATION_FPS, Animation, animation, FPS, fps); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ANIMATION_FPS, Animation, animation, FPS, fps);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ANIMATION_FRAME_INDEX, Animation, animation, CurrentFrame, currentFrame); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ANIMATION_FRAME_INDEX, Animation, animation, CurrentFrame, currentFrame);

View file

@ -37,8 +37,7 @@ public:
// EntityItemProperty related helpers // EntityItemProperty related helpers
virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, ScriptEngine* engine, bool skipDefaults,
EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const override;
bool isMyOwnAvatarEntity) const override;
virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override; virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override;
void merge(const AnimationPropertyGroup& other); void merge(const AnimationPropertyGroup& other);

View file

@ -19,8 +19,7 @@
#include "EntityItemPropertiesMacros.h" #include "EntityItemPropertiesMacros.h"
void BloomPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, ScriptEngine* engine, void BloomPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, ScriptEngine* engine,
bool skipDefaults, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, bool skipDefaults, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const {
bool isMyOwnAvatarEntity) const {
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_BLOOM_INTENSITY, Bloom, bloom, BloomIntensity, bloomIntensity); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_BLOOM_INTENSITY, Bloom, bloom, BloomIntensity, bloomIntensity);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_BLOOM_THRESHOLD, Bloom, bloom, BloomThreshold, bloomThreshold); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_BLOOM_THRESHOLD, Bloom, bloom, BloomThreshold, bloomThreshold);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_BLOOM_SIZE, Bloom, bloom, BloomSize, bloomSize); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_BLOOM_SIZE, Bloom, bloom, BloomSize, bloomSize);

View file

@ -44,8 +44,7 @@ public:
// EntityItemProperty related helpers // EntityItemProperty related helpers
virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, ScriptEngine* engine, bool skipDefaults,
EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const override;
bool isMyOwnAvatarEntity) const override;
virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override; virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override;
void merge(const BloomPropertyGroup& other); void merge(const BloomPropertyGroup& other);

View file

@ -33,7 +33,6 @@
#include <Extents.h> #include <Extents.h>
#include <VariantMapToScriptValue.h> #include <VariantMapToScriptValue.h>
#include <ScriptValue.h> #include <ScriptValue.h>
#include <PhysicsHelpers.h>
#include "EntitiesLogging.h" #include "EntitiesLogging.h"
#include "EntityItem.h" #include "EntityItem.h"
@ -1567,8 +1566,6 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
return properties; return properties;
} }
auto nodeList = DependencyManager::get<NodeList>();
bool isMyOwnAvatarEntity = _entityHostType == entity::HostType::AVATAR && (_owningAvatarID == AVATAR_SELF_ID || _owningAvatarID == Physics::getSessionUUID());
if (_idSet && (!pseudoPropertyFlagsActive || pseudoPropertyFlags.test(EntityPseudoPropertyFlag::ID))) { if (_idSet && (!pseudoPropertyFlagsActive || pseudoPropertyFlags.test(EntityPseudoPropertyFlag::ID))) {
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_ALWAYS(id, _id.toString()); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_ALWAYS(id, _id.toString());
} }
@ -1618,7 +1615,7 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IGNORE_PICK_INTERSECTION, ignorePickIntersection); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IGNORE_PICK_INTERSECTION, ignorePickIntersection);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_RENDER_WITH_ZONES, renderWithZones); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_RENDER_WITH_ZONES, renderWithZones);
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_BILLBOARD_MODE, billboardMode, getBillboardModeAsString()); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_BILLBOARD_MODE, billboardMode, getBillboardModeAsString());
_grab.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _grab.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
// Physics // Physics
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DENSITY, density); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DENSITY, density);
@ -1637,7 +1634,7 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
COPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_COLLISION_MASK, collisionMask, collidesWith, getCollisionMaskAsString()); COPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_COLLISION_MASK, collisionMask, collidesWith, getCollisionMaskAsString());
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DYNAMIC, dynamic); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DYNAMIC, dynamic);
COPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_DYNAMIC, dynamic, collisionsWillMove, getDynamic()); // legacy support COPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_DYNAMIC, dynamic, collisionsWillMove, getDynamic()); // legacy support
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_COLLISION_SOUND_URL, collisionSoundURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLLISION_SOUND_URL, collisionSoundURL);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ACTION_DATA, actionData); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ACTION_DATA, actionData);
// Cloning // Cloning
@ -1663,10 +1660,10 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
// Particles only // Particles only
if (_type == EntityTypes::ParticleEffect) { if (_type == EntityTypes::ParticleEffect) {
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, getShapeTypeAsString()); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, getShapeTypeAsString());
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_COMPOUND_SHAPE_URL, compoundShapeURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COMPOUND_SHAPE_URL, compoundShapeURL);
COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha);
_pulse.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _pulse.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MAX_PARTICLES, maxParticles); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MAX_PARTICLES, maxParticles);
@ -1713,11 +1710,11 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
// Models only // Models only
if (_type == EntityTypes::Model) { if (_type == EntityTypes::Model) {
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, getShapeTypeAsString()); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, getShapeTypeAsString());
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_COMPOUND_SHAPE_URL, compoundShapeURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COMPOUND_SHAPE_URL, compoundShapeURL);
COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures);
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_MODEL_URL, modelURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MODEL_URL, modelURL);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MODEL_SCALE, modelScale); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MODEL_SCALE, modelScale);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS_SET, jointRotationsSet); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS_SET, jointRotationsSet);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS, jointRotations); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS, jointRotations);
@ -1727,7 +1724,7 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_GROUP_CULLED, groupCulled); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_GROUP_CULLED, groupCulled);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_BLENDSHAPE_COEFFICIENTS, blendshapeCoefficients); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_BLENDSHAPE_COEFFICIENTS, blendshapeCoefficients);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_USE_ORIGINAL_PIVOT, useOriginalPivot); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_USE_ORIGINAL_PIVOT, useOriginalPivot);
_animation.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _animation.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
} }
// FIXME: Shouldn't provide a shapeType property for Box and Sphere entities. // FIXME: Shouldn't provide a shapeType property for Box and Sphere entities.
@ -1741,7 +1738,7 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
if (_type == EntityTypes::Box || _type == EntityTypes::Sphere || _type == EntityTypes::Shape) { if (_type == EntityTypes::Box || _type == EntityTypes::Sphere || _type == EntityTypes::Shape) {
COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha);
_pulse.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _pulse.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SHAPE, shape); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SHAPE, shape);
} }
@ -1757,7 +1754,7 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
// Text only // Text only
if (_type == EntityTypes::Text) { if (_type == EntityTypes::Text) {
_pulse.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _pulse.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXT, text); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXT, text);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_HEIGHT, lineHeight); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_HEIGHT, lineHeight);
@ -1780,17 +1777,17 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
// Zones only // Zones only
if (_type == EntityTypes::Zone) { if (_type == EntityTypes::Zone) {
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, getShapeTypeAsString()); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, getShapeTypeAsString());
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_COMPOUND_SHAPE_URL, compoundShapeURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COMPOUND_SHAPE_URL, compoundShapeURL);
_keyLight.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _keyLight.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
_ambientLight.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _ambientLight.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
_skybox.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _skybox.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
_haze.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _haze.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
_bloom.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _bloom.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_FLYING_ALLOWED, flyingAllowed); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_FLYING_ALLOWED, flyingAllowed);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_GHOSTING_ALLOWED, ghostingAllowed); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_GHOSTING_ALLOWED, ghostingAllowed);
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_FILTER_URL, filterURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_FILTER_URL, filterURL);
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_KEY_LIGHT_MODE, keyLightMode, getKeyLightModeAsString()); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_KEY_LIGHT_MODE, keyLightMode, getKeyLightModeAsString());
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_AMBIENT_LIGHT_MODE, ambientLightMode, getAmbientLightModeAsString()); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_AMBIENT_LIGHT_MODE, ambientLightMode, getAmbientLightModeAsString());
@ -1805,11 +1802,11 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
if (_type == EntityTypes::Web) { if (_type == EntityTypes::Web) {
COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha);
_pulse.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _pulse.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_SOURCE_URL, sourceUrl); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SOURCE_URL, sourceUrl);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DPI, dpi); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DPI, dpi);
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_SCRIPT_URL, scriptURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SCRIPT_URL, scriptURL);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MAX_FPS, maxFPS); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MAX_FPS, maxFPS);
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_INPUT_MODE, inputMode, getInputModeAsString()); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_INPUT_MODE, inputMode, getInputModeAsString());
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, showKeyboardFocusHighlight); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, showKeyboardFocusHighlight);
@ -1822,9 +1819,9 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VOXEL_VOLUME_SIZE, voxelVolumeSize); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VOXEL_VOLUME_SIZE, voxelVolumeSize);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VOXEL_DATA, voxelData); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VOXEL_DATA, voxelData);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VOXEL_SURFACE_STYLE, voxelSurfaceStyle); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VOXEL_SURFACE_STYLE, voxelSurfaceStyle);
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_X_TEXTURE_URL, xTextureURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_X_TEXTURE_URL, xTextureURL);
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_Y_TEXTURE_URL, yTextureURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_Y_TEXTURE_URL, yTextureURL);
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_Z_TEXTURE_URL, zTextureURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_Z_TEXTURE_URL, zTextureURL);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_X_N_NEIGHBOR_ID, xNNeighborID); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_X_N_NEIGHBOR_ID, xNNeighborID);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_Y_N_NEIGHBOR_ID, yNNeighborID); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_Y_N_NEIGHBOR_ID, yNNeighborID);
@ -1858,14 +1855,14 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
// Materials // Materials
if (_type == EntityTypes::Material) { if (_type == EntityTypes::Material) {
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_MATERIAL_URL, materialURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MATERIAL_URL, materialURL);
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_MATERIAL_MAPPING_MODE, materialMappingMode, getMaterialMappingModeAsString()); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_MATERIAL_MAPPING_MODE, materialMappingMode, getMaterialMappingModeAsString());
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MATERIAL_PRIORITY, priority); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MATERIAL_PRIORITY, priority);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_MATERIAL_NAME, parentMaterialName); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_MATERIAL_NAME, parentMaterialName);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MATERIAL_MAPPING_POS, materialMappingPos); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MATERIAL_MAPPING_POS, materialMappingPos);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MATERIAL_MAPPING_SCALE, materialMappingScale); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MATERIAL_MAPPING_SCALE, materialMappingScale);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MATERIAL_MAPPING_ROT, materialMappingRot); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MATERIAL_MAPPING_ROT, materialMappingRot);
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_MATERIAL_DATA, materialData); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MATERIAL_DATA, materialData);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MATERIAL_REPEAT, materialRepeat); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MATERIAL_REPEAT, materialRepeat);
} }
@ -1873,16 +1870,15 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
if (_type == EntityTypes::Image) { if (_type == EntityTypes::Image) {
COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha);
_pulse.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _pulse.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_IMAGE_URL, imageURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IMAGE_URL, imageURL);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_EMISSIVE, emissive); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_EMISSIVE, emissive);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_KEEP_ASPECT_RATIO, keepAspectRatio); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_KEEP_ASPECT_RATIO, keepAspectRatio);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SUB_IMAGE, subImage); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SUB_IMAGE, subImage);
// Handle conversions to old 'textures' property from "imageURL" // Handle conversions to old 'textures' property from "imageURL"
if ((isMyOwnAvatarEntity || nodeList->getThisNodeCanViewAssetURLs()) && if (((!returnNothingOnEmptyPropertyFlags && _desiredProperties.isEmpty()) || _desiredProperties.getHasProperty(PROP_IMAGE_URL)) &&
((!returnNothingOnEmptyPropertyFlags && _desiredProperties.isEmpty()) || _desiredProperties.getHasProperty(PROP_IMAGE_URL)) &&
(!skipDefaults || defaultEntityProperties._imageURL != _imageURL)) { (!skipDefaults || defaultEntityProperties._imageURL != _imageURL)) {
ScriptValue textures = engine->newObject(); ScriptValue textures = engine->newObject();
textures.setProperty("tex.picture", _imageURL); textures.setProperty("tex.picture", _imageURL);
@ -1894,7 +1890,7 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
if (_type == EntityTypes::Grid) { if (_type == EntityTypes::Grid) {
COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color); COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA, alpha);
_pulse.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _pulse.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_GRID_FOLLOW_CAMERA, followCamera); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_GRID_FOLLOW_CAMERA, followCamera);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MAJOR_GRID_EVERY, majorGridEvery); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MAJOR_GRID_EVERY, majorGridEvery);
@ -1904,7 +1900,7 @@ ScriptValue EntityItemProperties::copyToScriptValue(ScriptEngine* engine, bool s
// Gizmo only // Gizmo only
if (_type == EntityTypes::Gizmo) { if (_type == EntityTypes::Gizmo) {
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_GIZMO_TYPE, gizmoType, getGizmoTypeAsString()); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_GIZMO_TYPE, gizmoType, getGizmoTypeAsString());
_ring.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity); _ring.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags);
} }
/*@jsdoc /*@jsdoc
@ -2553,7 +2549,7 @@ bool EntityItemProperties::entityPropertyFlagsFromScriptValue(const ScriptValue&
if (object.isString()) { if (object.isString()) {
EntityPropertyInfo propertyInfo; EntityPropertyInfo propertyInfo;
if (getPropertyInfo(object.toString(), propertyInfo)) { if (getPropertyInfo(object.toString(), propertyInfo)) {
flags << propertyInfo.propertyEnums; flags << propertyInfo.propertyEnum;
} }
} }
else if (object.isArray()) { else if (object.isArray()) {
@ -2562,7 +2558,7 @@ bool EntityItemProperties::entityPropertyFlagsFromScriptValue(const ScriptValue&
QString propertyName = object.property(i).toString(); QString propertyName = object.property(i).toString();
EntityPropertyInfo propertyInfo; EntityPropertyInfo propertyInfo;
if (getPropertyInfo(propertyName, propertyInfo)) { if (getPropertyInfo(propertyName, propertyInfo)) {
flags << propertyInfo.propertyEnums; flags << propertyInfo.propertyEnum;
} }
} }
} }
@ -2798,7 +2794,7 @@ bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPr
{ // Keylight { // Keylight
ADD_GROUP_PROPERTY_TO_MAP(PROP_KEYLIGHT_COLOR, KeyLight, keyLight, Color, color); ADD_GROUP_PROPERTY_TO_MAP(PROP_KEYLIGHT_COLOR, KeyLight, keyLight, Color, color);
ADD_GROUP_PROPERTY_TO_MAP(PROP_KEYLIGHT_INTENSITY, KeyLight, keyLight, Intensity, intensity); ADD_GROUP_PROPERTY_TO_MAP(PROP_KEYLIGHT_INTENSITY, KeyLight, keyLight, Intensity, intensity);
ADD_GROUP_PROPERTY_TO_MAP(PROP_KEYLIGHT_DIRECTION, KeyLight, keyLight, Direction, direction); ADD_GROUP_PROPERTY_TO_MAP(PROP_KEYLIGHT_DIRECTION, KeyLight, keylight, Direction, direction);
ADD_GROUP_PROPERTY_TO_MAP(PROP_KEYLIGHT_CAST_SHADOW, KeyLight, keyLight, CastShadows, castShadows); ADD_GROUP_PROPERTY_TO_MAP(PROP_KEYLIGHT_CAST_SHADOW, KeyLight, keyLight, CastShadows, castShadows);
ADD_GROUP_PROPERTY_TO_MAP_WITH_RANGE(PROP_KEYLIGHT_SHADOW_BIAS, KeyLight, keyLight, ShadowBias, shadowBias, 0.0f, 1.0f); ADD_GROUP_PROPERTY_TO_MAP_WITH_RANGE(PROP_KEYLIGHT_SHADOW_BIAS, KeyLight, keyLight, ShadowBias, shadowBias, 0.0f, 1.0f);
ADD_GROUP_PROPERTY_TO_MAP_WITH_RANGE(PROP_KEYLIGHT_SHADOW_MAX_DISTANCE, KeyLight, keyLight, ShadowMaxDistance, shadowMaxDistance, 1.0f, 250.0f); ADD_GROUP_PROPERTY_TO_MAP_WITH_RANGE(PROP_KEYLIGHT_SHADOW_MAX_DISTANCE, KeyLight, keyLight, ShadowMaxDistance, shadowMaxDistance, 1.0f, 250.0f);
@ -2947,14 +2943,14 @@ bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPr
*/ */
ScriptValue EntityPropertyInfoToScriptValue(ScriptEngine* engine, const EntityPropertyInfo& propertyInfo) { ScriptValue EntityPropertyInfoToScriptValue(ScriptEngine* engine, const EntityPropertyInfo& propertyInfo) {
ScriptValue obj = engine->newObject(); ScriptValue obj = engine->newObject();
obj.setProperty("propertyEnum", propertyInfo.propertyEnums.firstFlag()); obj.setProperty("propertyEnum", propertyInfo.propertyEnum);
obj.setProperty("minimum", propertyInfo.minimum.toString()); obj.setProperty("minimum", propertyInfo.minimum.toString());
obj.setProperty("maximum", propertyInfo.maximum.toString()); obj.setProperty("maximum", propertyInfo.maximum.toString());
return obj; return obj;
} }
bool EntityPropertyInfoFromScriptValue(const ScriptValue& object, EntityPropertyInfo& propertyInfo) { bool EntityPropertyInfoFromScriptValue(const ScriptValue& object, EntityPropertyInfo& propertyInfo) {
propertyInfo.propertyEnums = (EntityPropertyList)object.property("propertyEnum").toVariant().toUInt(); propertyInfo.propertyEnum = (EntityPropertyList)object.property("propertyEnum").toVariant().toUInt();
propertyInfo.minimum = object.property("minimum").toVariant(); propertyInfo.minimum = object.property("minimum").toVariant();
propertyInfo.maximum = object.property("maximum").toVariant(); propertyInfo.maximum = object.property("maximum").toVariant();
return true; return true;

View file

@ -80,11 +80,11 @@ using u8vec3Color = glm::u8vec3;
struct EntityPropertyInfo { struct EntityPropertyInfo {
EntityPropertyInfo(EntityPropertyList propEnum) : EntityPropertyInfo(EntityPropertyList propEnum) :
propertyEnums(propEnum) {} propertyEnum(propEnum) {}
EntityPropertyInfo(EntityPropertyList propEnum, QVariant min, QVariant max) : EntityPropertyInfo(EntityPropertyList propEnum, QVariant min, QVariant max) :
propertyEnums(propEnum), minimum(min), maximum(max) {} propertyEnum(propEnum), minimum(min), maximum(max) {}
EntityPropertyInfo() = default; EntityPropertyInfo() = default;
EntityPropertyFlags propertyEnums; EntityPropertyList propertyEnum;
QVariant minimum; QVariant minimum;
QVariant maximum; QVariant maximum;
}; };

View file

@ -218,37 +218,6 @@ inline ScriptValue convertScriptValue(ScriptEngine* e, const AACube& v) { return
properties.setProperty(#P, V); \ properties.setProperty(#P, V); \
} }
#define COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(p, P) \
if (((!returnNothingOnEmptyPropertyFlags && _desiredProperties.isEmpty()) || _desiredProperties.getHasProperty(p)) && \
(!skipDefaults || defaultEntityProperties._##P != _##P)) { \
if (isMyOwnAvatarEntity || nodeList->getThisNodeCanViewAssetURLs()) { \
ScriptValue V = convertScriptValue(engine, _##P); \
properties.setProperty(#P, V); \
} else { \
const QString emptyURL = ""; \
ScriptValue V = convertScriptValue(engine, emptyURL); \
properties.setProperty(#P, V); \
} \
}
#define COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(X, G, g, P, p) \
if (((!returnNothingOnEmptyPropertyFlags && desiredProperties.isEmpty()) || desiredProperties.getHasProperty(X)) && \
(!skipDefaults || defaultEntityProperties.get##G().get##P() != get##P())) { \
if (isMyOwnAvatarEntity || nodeList->getThisNodeCanViewAssetURLs()) { \
ScriptValue groupProperties = properties.property(#g); \
if (!groupProperties.isValid()) { \
groupProperties = engine->newObject(); \
} \
ScriptValue V = convertScriptValue(engine, get##P()); \
groupProperties.setProperty(#p, V); \
properties.setProperty(#g, groupProperties); \
} else { \
const QString emptyURL = ""; \
ScriptValue V = convertScriptValue(engine, emptyURL); \
properties.setProperty(#P, V); \
} \
}
typedef QVector<glm::vec3> qVectorVec3; typedef QVector<glm::vec3> qVectorVec3;
typedef QVector<glm::quat> qVectorQuat; typedef QVector<glm::quat> qVectorQuat;
typedef QVector<bool> qVectorBool; typedef QVector<bool> qVectorBool;
@ -490,16 +459,14 @@ inline QRect QRect_convertFromScriptValue(const ScriptValue& v, bool& isValid) {
{ \ { \
EntityPropertyInfo propertyInfo = EntityPropertyInfo(P); \ EntityPropertyInfo propertyInfo = EntityPropertyInfo(P); \
_propertyInfos[#g "." #n] = propertyInfo; \ _propertyInfos[#g "." #n] = propertyInfo; \
_propertyInfos[#g].propertyEnums << P; \ _enumsToPropertyStrings[P] = #g "." #n; \
_enumsToPropertyStrings[P] = #g "." #n; \
} }
#define ADD_GROUP_PROPERTY_TO_MAP_WITH_RANGE(P, G, g, N, n, M, X) \ #define ADD_GROUP_PROPERTY_TO_MAP_WITH_RANGE(P, G, g, N, n, M, X) \
{ \ { \
EntityPropertyInfo propertyInfo = EntityPropertyInfo(P, M, X); \ EntityPropertyInfo propertyInfo = EntityPropertyInfo(P, M, X); \
_propertyInfos[#g "." #n] = propertyInfo; \ _propertyInfos[#g "." #n] = propertyInfo; \
_propertyInfos[#g].propertyEnums << P; \ _enumsToPropertyStrings[P] = #g "." #n; \
_enumsToPropertyStrings[P] = #g "." #n; \
} }
#define DEFINE_CORE(N, n, T, V) \ #define DEFINE_CORE(N, n, T, V) \

View file

@ -97,7 +97,6 @@ EntityScriptingInterface::EntityScriptingInterface(bool bidOnSimulationOwnership
connect(nodeList.data(), &NodeList::canWriteAssetsChanged, this, &EntityScriptingInterface::canWriteAssetsChanged); connect(nodeList.data(), &NodeList::canWriteAssetsChanged, this, &EntityScriptingInterface::canWriteAssetsChanged);
connect(nodeList.data(), &NodeList::canGetAndSetPrivateUserDataChanged, this, &EntityScriptingInterface::canGetAndSetPrivateUserDataChanged); connect(nodeList.data(), &NodeList::canGetAndSetPrivateUserDataChanged, this, &EntityScriptingInterface::canGetAndSetPrivateUserDataChanged);
connect(nodeList.data(), &NodeList::canRezAvatarEntitiesChanged, this, &EntityScriptingInterface::canRezAvatarEntitiesChanged); connect(nodeList.data(), &NodeList::canRezAvatarEntitiesChanged, this, &EntityScriptingInterface::canRezAvatarEntitiesChanged);
connect(nodeList.data(), &NodeList::canViewAssetURLsChanged, this, &EntityScriptingInterface::canViewAssetURLsChanged);
auto& packetReceiver = nodeList->getPacketReceiver(); auto& packetReceiver = nodeList->getPacketReceiver();
packetReceiver.registerListener(PacketType::EntityScriptCallMethod, packetReceiver.registerListener(PacketType::EntityScriptCallMethod,
@ -292,11 +291,6 @@ bool EntityScriptingInterface::canRezAvatarEntities() {
return nodeList->getThisNodeCanRezAvatarEntities(); return nodeList->getThisNodeCanRezAvatarEntities();
} }
bool EntityScriptingInterface::canViewAssetURLs() {
auto nodeList = DependencyManager::get<NodeList>();
return nodeList->getThisNodeCanViewAssetURLs();
}
void EntityScriptingInterface::setEntityTree(EntityTreePointer elementTree) { void EntityScriptingInterface::setEntityTree(EntityTreePointer elementTree) {
if (_entityTree) { if (_entityTree) {
disconnect(_entityTree.get(), &EntityTree::addingEntityPointer, this, &EntityScriptingInterface::onAddingEntity); disconnect(_entityTree.get(), &EntityTree::addingEntityPointer, this, &EntityScriptingInterface::onAddingEntity);

View file

@ -288,14 +288,6 @@ public slots:
*/ */
Q_INVOKABLE bool canRezAvatarEntities(); Q_INVOKABLE bool canRezAvatarEntities();
/*@jsdoc
* Checks whether or not the script can view asset URLs
* @function Entities.canViewAssetURLs
* @returns {boolean} <code>true</code> if the domain server will allow the script to view asset URLs,
* otherwise <code>false</code>.
*/
Q_INVOKABLE bool canViewAssetURLs();
/*@jsdoc /*@jsdoc
* <p>How an entity is hosted and sent to others for display.</p> * <p>How an entity is hosted and sent to others for display.</p>
* <table> * <table>
@ -2257,14 +2249,6 @@ signals:
*/ */
void canRezAvatarEntitiesChanged(bool canRezAvatarEntities); void canRezAvatarEntitiesChanged(bool canRezAvatarEntities);
/*@jsdoc
* Triggered when your ability to view asset URLs is changed.
* @function Entities.canViewAssetURLsChanged
* @param {boolean} canViewAssetURLs - <code>true</code> if the script can view asset URLs,
* <code>false</code> if it can't.
* @returns {Signal}
*/
void canViewAssetURLsChanged(bool canViewAssetURLs);
/*@jsdoc /*@jsdoc
* Triggered when a mouse button is clicked while the mouse cursor is on an entity, or a controller trigger is fully * Triggered when a mouse button is clicked while the mouse cursor is on an entity, or a controller trigger is fully

View file

@ -2553,10 +2553,11 @@ bool EntityTree::writeToMap(QVariantMap& entityDescription, OctreeElementPointer
} }
entityDescription["DataVersion"] = _persistDataVersion; entityDescription["DataVersion"] = _persistDataVersion;
entityDescription["Id"] = _persistID; entityDescription["Id"] = _persistID;
_helperScriptEngine.run( [&] { const std::lock_guard<std::mutex> scriptLock(scriptEngineMutex);
RecurseOctreeToMapOperator theOperator(entityDescription, element, _helperScriptEngine.get(), skipDefaultValues, RecurseOctreeToMapOperator theOperator(entityDescription, element, scriptEngine.get(), skipDefaultValues,
skipThoseWithBadParents, _myAvatar); skipThoseWithBadParents, _myAvatar);
withReadLock([&] { recurseTreeWithOperator(&theOperator); }); withReadLock([&] {
recurseTreeWithOperator(&theOperator);
}); });
return true; return true;
} }
@ -2727,10 +2728,11 @@ bool EntityTree::readFromMap(QVariantMap& map, const bool isImport) {
} }
EntityItemProperties properties; EntityItemProperties properties;
_helperScriptEngine.run( [&] { {
ScriptValue entityScriptValue = variantMapToScriptValue(entityMap, *_helperScriptEngine.get()); const std::lock_guard<std::mutex> scriptLock(scriptEngineMutex);
ScriptValue entityScriptValue = variantMapToScriptValue(entityMap, *scriptEngine);
EntityItemPropertiesFromScriptValueIgnoreReadOnly(entityScriptValue, properties); EntityItemPropertiesFromScriptValueIgnoreReadOnly(entityScriptValue, properties);
}); }
EntityItemID entityItemID; EntityItemID entityItemID;
if (entityMap.contains("id")) { if (entityMap.contains("id")) {
@ -2879,12 +2881,13 @@ bool EntityTree::readFromMap(QVariantMap& map, const bool isImport) {
} }
bool EntityTree::writeToJSON(QString& jsonString, const OctreeElementPointer& element) { bool EntityTree::writeToJSON(QString& jsonString, const OctreeElementPointer& element) {
_helperScriptEngine.run( [&] { const std::lock_guard<std::mutex> scriptLock(scriptEngineMutex);
RecurseOctreeToJSONOperator theOperator(element, _helperScriptEngine.get(), jsonString); RecurseOctreeToJSONOperator theOperator(element, scriptEngine.get(), jsonString);
withReadLock([&] { recurseTreeWithOperator(&theOperator); }); withReadLock([&] {
recurseTreeWithOperator(&theOperator);
jsonString = theOperator.getJson();
}); });
jsonString = theOperator.getJson();
return true; return true;
} }

View file

@ -15,7 +15,6 @@
#include <QSet> #include <QSet>
#include <QVector> #include <QVector>
#include <HelperScriptEngine.h>
#include <Octree.h> #include <Octree.h>
#include <SpatialParentFinder.h> #include <SpatialParentFinder.h>
@ -388,7 +387,8 @@ private:
MovingEntitiesOperator& moveOperator, bool force, bool tellServer); MovingEntitiesOperator& moveOperator, bool force, bool tellServer);
// Script engine for writing entity tree data to and from JSON // Script engine for writing entity tree data to and from JSON
HelperScriptEngine _helperScriptEngine; std::mutex scriptEngineMutex;
ScriptEnginePointer scriptEngine{ newScriptEngine() };
}; };
void convertGrabUserDataToProperties(EntityItemProperties& properties); void convertGrabUserDataToProperties(EntityItemProperties& properties);

View file

@ -20,9 +20,7 @@
void GrabPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, void GrabPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, ScriptEngine* engine, bool skipDefaults,
EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const {
bool isMyOwnAvatarEntity) const {
auto nodeList = DependencyManager::get<NodeList>();
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_GRAB_GRABBABLE, Grab, grab, Grabbable, grabbable); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_GRAB_GRABBABLE, Grab, grab, Grabbable, grabbable);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_GRAB_KINEMATIC, Grab, grab, GrabKinematic, grabKinematic); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_GRAB_KINEMATIC, Grab, grab, GrabKinematic, grabKinematic);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_GRAB_FOLLOWS_CONTROLLER, Grab, grab, GrabFollowsController, grabFollowsController); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_GRAB_FOLLOWS_CONTROLLER, Grab, grab, GrabFollowsController, grabFollowsController);
@ -38,7 +36,7 @@ void GrabPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProp
EquippableRightPosition, equippableRightPosition); EquippableRightPosition, equippableRightPosition);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_GRAB_RIGHT_EQUIPPABLE_ROTATION_OFFSET, Grab, grab, COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_GRAB_RIGHT_EQUIPPABLE_ROTATION_OFFSET, Grab, grab,
EquippableRightRotation, equippableRightRotation); EquippableRightRotation, equippableRightRotation);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_GRAB_EQUIPPABLE_INDICATOR_URL, Grab, grab, COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_GRAB_EQUIPPABLE_INDICATOR_URL, Grab, grab,
EquippableIndicatorURL, equippableIndicatorURL); EquippableIndicatorURL, equippableIndicatorURL);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_GRAB_EQUIPPABLE_INDICATOR_SCALE, Grab, grab, COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_GRAB_EQUIPPABLE_INDICATOR_SCALE, Grab, grab,
EquippableIndicatorScale, equippableIndicatorScale); EquippableIndicatorScale, equippableIndicatorScale);

View file

@ -75,8 +75,7 @@ public:
// EntityItemProperty related helpers // EntityItemProperty related helpers
virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, ScriptEngine* engine, bool skipDefaults,
EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const override;
bool isMyOwnAvatarEntity) const override;
virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override; virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override;
void merge(const GrabPropertyGroup& other); void merge(const GrabPropertyGroup& other);

View file

@ -19,8 +19,7 @@
#include "EntityItemPropertiesMacros.h" #include "EntityItemPropertiesMacros.h"
void HazePropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, ScriptEngine* engine, void HazePropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, ScriptEngine* engine,
bool skipDefaults, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, bool skipDefaults, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const {
bool isMyOwnAvatarEntity) const {
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_HAZE_RANGE, Haze, haze, HazeRange, hazeRange); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_HAZE_RANGE, Haze, haze, HazeRange, hazeRange);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_HAZE_COLOR, Haze, haze, HazeColor, hazeColor, u8vec3Color); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_HAZE_COLOR, Haze, haze, HazeColor, hazeColor, u8vec3Color);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_HAZE_GLARE_COLOR, Haze, haze, HazeGlareColor, hazeGlareColor, u8vec3Color); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_HAZE_GLARE_COLOR, Haze, haze, HazeGlareColor, hazeGlareColor, u8vec3Color);

View file

@ -80,8 +80,7 @@ public:
// EntityItemProperty related helpers // EntityItemProperty related helpers
virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, ScriptEngine* engine, bool skipDefaults,
EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const override;
bool isMyOwnAvatarEntity) const override;
virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override; virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override;
void merge(const HazePropertyGroup& other); void merge(const HazePropertyGroup& other);

View file

@ -28,8 +28,7 @@ const float KeyLightPropertyGroup::DEFAULT_KEYLIGHT_SHADOW_BIAS { 0.5f };
const float KeyLightPropertyGroup::DEFAULT_KEYLIGHT_SHADOW_MAX_DISTANCE { 40.0f }; const float KeyLightPropertyGroup::DEFAULT_KEYLIGHT_SHADOW_MAX_DISTANCE { 40.0f };
void KeyLightPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, void KeyLightPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, ScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const {
bool isMyOwnAvatarEntity) const {
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_KEYLIGHT_COLOR, KeyLight, keyLight, Color, color, u8vec3Color); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_KEYLIGHT_COLOR, KeyLight, keyLight, Color, color, u8vec3Color);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_KEYLIGHT_INTENSITY, KeyLight, keyLight, Intensity, intensity); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_KEYLIGHT_INTENSITY, KeyLight, keyLight, Intensity, intensity);

View file

@ -50,8 +50,7 @@ public:
// EntityItemProperty related helpers // EntityItemProperty related helpers
virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, ScriptEngine* engine, bool skipDefaults,
EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const override;
bool isMyOwnAvatarEntity) const override;
virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override; virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override;
void merge(const KeyLightPropertyGroup& other); void merge(const KeyLightPropertyGroup& other);

View file

@ -34,8 +34,7 @@ public:
virtual ~PropertyGroup() = default; virtual ~PropertyGroup() = default;
// EntityItemProperty related helpers // EntityItemProperty related helpers
virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, ScriptEngine* engine, bool skipDefaults, virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, ScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const = 0;
EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, bool isMyOwnAvatarEntity) const = 0;
virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) = 0; virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) = 0;
virtual void debugDump() const { } virtual void debugDump() const { }
virtual void listChangedProperties(QList<QString>& out) { } virtual void listChangedProperties(QList<QString>& out) { }

View file

@ -60,9 +60,8 @@ void PulsePropertyGroup::setAlphaModeFromString(const QString& pulseMode) {
} }
void PulsePropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, void PulsePropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, ScriptEngine* engine, bool skipDefaults,
EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const {
bool isMyOwnAvatarEntity) const {
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_PULSE_MIN, Pulse, pulse, Min, min); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_PULSE_MIN, Pulse, pulse, Min, min);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_PULSE_MAX, Pulse, pulse, Max, max); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_PULSE_MAX, Pulse, pulse, Max, max);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_PULSE_PERIOD, Pulse, pulse, Period, period); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_PULSE_PERIOD, Pulse, pulse, Period, period);

View file

@ -44,8 +44,7 @@ public:
// EntityItemProperty related helpers // EntityItemProperty related helpers
virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, ScriptEngine* engine, bool skipDefaults,
EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const override;
bool isMyOwnAvatarEntity) const override;
virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override; virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override;
void merge(const PulsePropertyGroup& other); void merge(const PulsePropertyGroup& other);

View file

@ -23,9 +23,8 @@ const float RingGizmoPropertyGroup::MIN_RADIUS = 0.0f;
const float RingGizmoPropertyGroup::MAX_RADIUS = 0.5f; const float RingGizmoPropertyGroup::MAX_RADIUS = 0.5f;
void RingGizmoPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, void RingGizmoPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, ScriptEngine* engine, bool skipDefaults,
EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const {
bool isMyOwnAvatarEntity) const {
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_START_ANGLE, Ring, ring, StartAngle, startAngle); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_START_ANGLE, Ring, ring, StartAngle, startAngle);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_END_ANGLE, Ring, ring, EndAngle, endAngle); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_END_ANGLE, Ring, ring, EndAngle, endAngle);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_INNER_RADIUS, Ring, ring, InnerRadius, innerRadius); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_INNER_RADIUS, Ring, ring, InnerRadius, innerRadius);

View file

@ -60,8 +60,7 @@ public:
// EntityItemProperty related helpers // EntityItemProperty related helpers
virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, ScriptEngine* engine, bool skipDefaults,
EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const override;
bool isMyOwnAvatarEntity) const override;
virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override; virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override;
void merge(const RingGizmoPropertyGroup& other); void merge(const RingGizmoPropertyGroup& other);

View file

@ -20,11 +20,9 @@
const glm::u8vec3 SkyboxPropertyGroup::DEFAULT_COLOR = { 0, 0, 0 }; const glm::u8vec3 SkyboxPropertyGroup::DEFAULT_COLOR = { 0, 0, 0 };
void SkyboxPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, ScriptEngine* engine, void SkyboxPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, ScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const {
bool skipDefaults, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, bool isMyOwnAvatarEntity) const {
auto nodeList = DependencyManager::get<NodeList>();
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_SKYBOX_COLOR, Skybox, skybox, Color, color, u8vec3Color); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_SKYBOX_COLOR, Skybox, skybox, Color, color, u8vec3Color);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(PROP_SKYBOX_URL, Skybox, skybox, URL, url); COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_SKYBOX_URL, Skybox, skybox, URL, url);
} }
void SkyboxPropertyGroup::copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) { void SkyboxPropertyGroup::copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) {

View file

@ -43,8 +43,7 @@ public:
// EntityItemProperty related helpers // EntityItemProperty related helpers
virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
ScriptEngine* engine, bool skipDefaults, ScriptEngine* engine, bool skipDefaults,
EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags, EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags) const override;
bool isMyOwnAvatarEntity) const override;
virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override; virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override;
void merge(const SkyboxPropertyGroup& other); void merge(const SkyboxPropertyGroup& other);

View file

@ -100,6 +100,8 @@ GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
(&::gpu::gl::GLBackend::do_glUniformMatrix3fv), (&::gpu::gl::GLBackend::do_glUniformMatrix3fv),
(&::gpu::gl::GLBackend::do_glUniformMatrix4fv), (&::gpu::gl::GLBackend::do_glUniformMatrix4fv),
(&::gpu::gl::GLBackend::do_glColor4f),
(&::gpu::gl::GLBackend::do_pushProfileRange), (&::gpu::gl::GLBackend::do_pushProfileRange),
(&::gpu::gl::GLBackend::do_popProfileRange), (&::gpu::gl::GLBackend::do_popProfileRange),
}; };
@ -836,6 +838,22 @@ void GLBackend::do_glUniformMatrix4fv(const Batch& batch, size_t paramOffset) {
(void)CHECK_GL_ERROR(); (void)CHECK_GL_ERROR();
} }
void GLBackend::do_glColor4f(const Batch& batch, size_t paramOffset) {
glm::vec4 newColor(
batch._params[paramOffset + 3]._float,
batch._params[paramOffset + 2]._float,
batch._params[paramOffset + 1]._float,
batch._params[paramOffset + 0]._float);
if (_input._colorAttribute != newColor) {
_input._colorAttribute = newColor;
glVertexAttrib4fv(gpu::Stream::COLOR, &_input._colorAttribute.r);
_input._hasColorAttribute = true;
}
(void)CHECK_GL_ERROR();
}
void GLBackend::releaseBuffer(GLuint id, Size size) const { void GLBackend::releaseBuffer(GLuint id, Size size) const {
Lock lock(_trashMutex); Lock lock(_trashMutex);
_currentFrameTrash.buffersTrash.push_back({ id, size }); _currentFrameTrash.buffersTrash.push_back({ id, size });

View file

@ -241,6 +241,8 @@ public:
virtual void do_glUniformMatrix3fv(const Batch& batch, size_t paramOffset) final; virtual void do_glUniformMatrix3fv(const Batch& batch, size_t paramOffset) final;
virtual void do_glUniformMatrix4fv(const Batch& batch, size_t paramOffset) final; virtual void do_glUniformMatrix4fv(const Batch& batch, size_t paramOffset) final;
virtual void do_glColor4f(const Batch& batch, size_t paramOffset) final;
// The State setters called by the GLState::Commands when a new state is assigned // The State setters called by the GLState::Commands when a new state is assigned
virtual void do_setStateFillMode(int32 mode) final; virtual void do_setStateFillMode(int32 mode) final;
virtual void do_setStateCullMode(int32 mode) final; virtual void do_setStateCullMode(int32 mode) final;
@ -348,6 +350,8 @@ protected:
struct InputStageState { struct InputStageState {
bool _invalidFormat { true }; bool _invalidFormat { true };
bool _lastUpdateStereoState { false }; bool _lastUpdateStereoState { false };
bool _hasColorAttribute { false };
bool _hadColorAttribute { false };
FormatReference _format { GPU_REFERENCE_INIT_VALUE }; FormatReference _format { GPU_REFERENCE_INIT_VALUE };
std::string _formatKey; std::string _formatKey;
@ -364,6 +368,8 @@ protected:
std::array<Offset, MAX_NUM_INPUT_BUFFERS> _bufferStrides; std::array<Offset, MAX_NUM_INPUT_BUFFERS> _bufferStrides;
std::array<GLuint, MAX_NUM_INPUT_BUFFERS> _bufferVBOs; std::array<GLuint, MAX_NUM_INPUT_BUFFERS> _bufferVBOs;
glm::vec4 _colorAttribute { 1.0f };
BufferReference _indexBuffer; BufferReference _indexBuffer;
Offset _indexBufferOffset { 0 }; Offset _indexBufferOffset { 0 };
Type _indexBufferType { UINT32 }; Type _indexBufferType { UINT32 };

View file

@ -103,6 +103,9 @@ void GLBackend::resetInputStage() {
reset(_input._format); reset(_input._format);
_input._formatKey.clear(); _input._formatKey.clear();
_input._invalidFormat = false; _input._invalidFormat = false;
_input._hasColorAttribute = false;
_input._hadColorAttribute = false;
_input._colorAttribute = vec4(1.0f);
_input._attributeActivation.reset(); _input._attributeActivation.reset();
for (uint32_t i = 0; i < _input._buffers.size(); i++) { for (uint32_t i = 0; i < _input._buffers.size(); i++) {
@ -160,6 +163,8 @@ void GLBackend::updateInput() {
#endif #endif
_input._lastUpdateStereoState = isStereoNow; _input._lastUpdateStereoState = isStereoNow;
bool hasColorAttribute = _input._hasColorAttribute;
if (_input._invalidFormat) { if (_input._invalidFormat) {
InputStageState::ActivationCache newActivation; InputStageState::ActivationCache newActivation;
@ -189,6 +194,8 @@ void GLBackend::updateInput() {
GLenum perLocationSize = attrib._element.getLocationSize(); GLenum perLocationSize = attrib._element.getLocationSize();
hasColorAttribute |= slot == Stream::COLOR;
for (GLuint locNum = 0; locNum < locationCount; ++locNum) { for (GLuint locNum = 0; locNum < locationCount; ++locNum) {
GLuint attriNum = (GLuint)(slot + locNum); GLuint attriNum = (GLuint)(slot + locNum);
newActivation.set(attriNum); newActivation.set(attriNum);
@ -219,6 +226,12 @@ void GLBackend::updateInput() {
glVertexBindingDivisor(bufferChannelNum, frequency); glVertexBindingDivisor(bufferChannelNum, frequency);
#endif #endif
} }
if (!hasColorAttribute && _input._hadColorAttribute) {
// The previous input stage had a color attribute but this one doesn't, so reset the color to pure white.
_input._colorAttribute = glm::vec4(1.0f);
glVertexAttrib4fv(Stream::COLOR, &_input._colorAttribute.r);
}
} }
// Manage Activation what was and what is expected now // Manage Activation what was and what is expected now
@ -240,6 +253,9 @@ void GLBackend::updateInput() {
_stats._ISNumFormatChanges++; _stats._ISNumFormatChanges++;
} }
_input._hadColorAttribute = hasColorAttribute;
_input._hasColorAttribute = false;
if (_input._invalidBuffers.any()) { if (_input._invalidBuffers.any()) {
auto vbo = _input._bufferVBOs.data(); auto vbo = _input._bufferVBOs.data();
auto offset = _input._bufferOffsets.data(); auto offset = _input._bufferOffsets.data();

View file

@ -33,6 +33,8 @@ void GL41Backend::updateInput() {
#endif #endif
_input._lastUpdateStereoState = isStereoNow; _input._lastUpdateStereoState = isStereoNow;
bool hasColorAttribute = _input._hasColorAttribute;
if (_input._invalidFormat || _input._invalidBuffers.any()) { if (_input._invalidFormat || _input._invalidBuffers.any()) {
auto format = acquire(_input._format); auto format = acquire(_input._format);
@ -108,6 +110,8 @@ void GL41Backend::updateInput() {
uintptr_t pointer = (uintptr_t)(attrib._offset + offsets[bufferNum]); uintptr_t pointer = (uintptr_t)(attrib._offset + offsets[bufferNum]);
GLboolean isNormalized = attrib._element.isNormalized(); GLboolean isNormalized = attrib._element.isNormalized();
hasColorAttribute |= slot == Stream::COLOR;
for (size_t locNum = 0; locNum < locationCount; ++locNum) { for (size_t locNum = 0; locNum < locationCount; ++locNum) {
if (attrib._element.isInteger()) { if (attrib._element.isInteger()) {
glVertexAttribIPointer(slot + (GLuint)locNum, count, type, stride, glVertexAttribIPointer(slot + (GLuint)locNum, count, type, stride,
@ -127,8 +131,17 @@ void GL41Backend::updateInput() {
} }
} }
} }
if (!hasColorAttribute && _input._hadColorAttribute) {
// The previous input stage had a color attribute but this one doesn't, so reset the color to pure white.
_input._colorAttribute = glm::vec4(1.0f);
glVertexAttrib4fv(Stream::COLOR, &_input._colorAttribute.r);
}
} }
// everything format related should be in sync now // everything format related should be in sync now
_input._invalidFormat = false; _input._invalidFormat = false;
} }
_input._hadColorAttribute = hasColorAttribute;
_input._hasColorAttribute = false;
} }

View file

@ -35,6 +35,8 @@ void GL45Backend::updateInput() {
#endif #endif
_input._lastUpdateStereoState = isStereoNow; _input._lastUpdateStereoState = isStereoNow;
bool hasColorAttribute = _input._hasColorAttribute;
if (_input._invalidFormat) { if (_input._invalidFormat) {
InputStageState::ActivationCache newActivation; InputStageState::ActivationCache newActivation;
@ -64,6 +66,8 @@ void GL45Backend::updateInput() {
GLenum perLocationSize = attrib._element.getLocationSize(); GLenum perLocationSize = attrib._element.getLocationSize();
hasColorAttribute |= slot == Stream::COLOR;
for (GLuint locNum = 0; locNum < locationCount; ++locNum) { for (GLuint locNum = 0; locNum < locationCount; ++locNum) {
GLuint attriNum = (GLuint)(slot + locNum); GLuint attriNum = (GLuint)(slot + locNum);
newActivation.set(attriNum); newActivation.set(attriNum);
@ -94,6 +98,12 @@ void GL45Backend::updateInput() {
glVertexBindingDivisor(bufferChannelNum, frequency); glVertexBindingDivisor(bufferChannelNum, frequency);
#endif #endif
} }
if (!hasColorAttribute && _input._hadColorAttribute) {
// The previous input stage had a color attribute but this one doesn't, so reset the color to pure white.
_input._colorAttribute = glm::vec4(1.0f);
glVertexAttrib4fv(Stream::COLOR, &_input._colorAttribute.r);
}
} }
// Manage Activation what was and what is expected now // Manage Activation what was and what is expected now
@ -115,6 +125,9 @@ void GL45Backend::updateInput() {
_stats._ISNumFormatChanges++; _stats._ISNumFormatChanges++;
} }
_input._hadColorAttribute = hasColorAttribute;
_input._hasColorAttribute = false;
if (_input._invalidBuffers.any()) { if (_input._invalidBuffers.any()) {
auto vbo = _input._bufferVBOs.data(); auto vbo = _input._bufferVBOs.data();
auto offset = _input._bufferOffsets.data(); auto offset = _input._bufferOffsets.data();

View file

@ -687,6 +687,15 @@ void Batch::_glUniformMatrix4fv(int32 location, int count, uint8 transpose, cons
_params.emplace_back(location); _params.emplace_back(location);
} }
void Batch::_glColor4f(float red, float green, float blue, float alpha) {
ADD_COMMAND(glColor4f);
_params.emplace_back(alpha);
_params.emplace_back(blue);
_params.emplace_back(green);
_params.emplace_back(red);
}
void Batch::finishFrame(BufferUpdates& updates) { void Batch::finishFrame(BufferUpdates& updates) {
PROFILE_RANGE(render_gpu, __FUNCTION__); PROFILE_RANGE(render_gpu, __FUNCTION__);

View file

@ -287,6 +287,8 @@ public:
_glUniformMatrix3fv(location, 1, false, glm::value_ptr(v)); _glUniformMatrix3fv(location, 1, false, glm::value_ptr(v));
} }
void _glColor4f(float red, float green, float blue, float alpha);
// Maybe useful but shoudln't be public. Please convince me otherwise // Maybe useful but shoudln't be public. Please convince me otherwise
// Well porting to gles i need it... // Well porting to gles i need it...
void runLambda(std::function<void()> f); void runLambda(std::function<void()> f);
@ -361,6 +363,8 @@ public:
COMMAND_glUniformMatrix3fv, COMMAND_glUniformMatrix3fv,
COMMAND_glUniformMatrix4fv, COMMAND_glUniformMatrix4fv,
COMMAND_glColor4f,
COMMAND_pushProfileRange, COMMAND_pushProfileRange,
COMMAND_popProfileRange, COMMAND_popProfileRange,
@ -402,7 +406,7 @@ public:
public: public:
typedef T Data; typedef T Data;
Data _data; Data _data;
Cache(const Data& data) : _data(data) {} Cache<T>(const Data& data) : _data(data) {}
static size_t _max; static size_t _max;
class Vector { class Vector {

View file

@ -387,8 +387,8 @@ public:
U t; U t;
return std::make_shared<gpu::Buffer>(sizeof(U), (const gpu::Byte*) &t, sizeof(U)); return std::make_shared<gpu::Buffer>(sizeof(U), (const gpu::Byte*) &t, sizeof(U));
} }
~StructBuffer() {}; ~StructBuffer<T>() {};
StructBuffer() : gpu::BufferView(makeBuffer<T>()) {} StructBuffer<T>() : gpu::BufferView(makeBuffer<T>()) {}
T& edit() { T& edit() {

View file

@ -238,14 +238,10 @@ const Backend::TransformCamera& Backend::TransformCamera::recomputeDerived(const
Backend::TransformCamera Backend::TransformCamera::getEyeCamera(int eye, const StereoState& _stereo, const Transform& xformView, Vec2 normalizedJitter) const { Backend::TransformCamera Backend::TransformCamera::getEyeCamera(int eye, const StereoState& _stereo, const Transform& xformView, Vec2 normalizedJitter) const {
TransformCamera result = *this; TransformCamera result = *this;
Transform offsetTransform = xformView; Transform offsetTransform = xformView;
glm::vec3 eyePosition = extractTranslation(_stereo._eyeViews[eye]); if (!_stereo._skybox) {
glm::quat eyeOrientation = glmExtractRotation(_stereo._eyeViews[eye]); offsetTransform.postTranslate(-Vec3(_stereo._eyeViews[eye][3]));
if (!_stereo._skybox)
{
offsetTransform.postRotate(eyeOrientation).postTranslate(eyePosition);
} else { } else {
// FIXME: If "skybox" the ipd is set to 0 for now, let s try to propose a better solution for this in the future // FIXME: If "skybox" the ipd is set to 0 for now, let s try to propose a better solution for this in the future
offsetTransform.postRotate(eyeOrientation);
} }
result._projection = _stereo._eyeProjections[eye]; result._projection = _stereo._eyeProjections[eye];
normalizedJitter.x *= 2.0f; normalizedJitter.x *= 2.0f;

View file

@ -201,6 +201,8 @@ constexpr const char* COMMAND_NAMES[] = {
"glUniformMatrix3fv", "glUniformMatrix3fv",
"glUniformMatrix4fv", "glUniformMatrix4fv",
"glColor4f",
"pushProfileRange", "pushProfileRange",
"popProfileRange", "popProfileRange",
}; };

View file

@ -19,8 +19,6 @@ Mesh::Mesh() :
_vertexBuffer(gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)), _vertexBuffer(gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)),
_indexBuffer(gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::INDEX)), _indexBuffer(gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::INDEX)),
_partBuffer(gpu::Element(gpu::VEC4, gpu::UINT32, gpu::PART)) { _partBuffer(gpu::Element(gpu::VEC4, gpu::UINT32, gpu::PART)) {
const uint32_t compactColor = 0xFFFFFFFF;
_colorBuffer->setData(sizeof(compactColor), (const gpu::Byte*) &compactColor);
} }
Mesh::Mesh(const Mesh& mesh) : Mesh::Mesh(const Mesh& mesh) :
@ -28,8 +26,7 @@ Mesh::Mesh(const Mesh& mesh) :
_vertexBuffer(mesh._vertexBuffer), _vertexBuffer(mesh._vertexBuffer),
_attributeBuffers(mesh._attributeBuffers), _attributeBuffers(mesh._attributeBuffers),
_indexBuffer(mesh._indexBuffer), _indexBuffer(mesh._indexBuffer),
_partBuffer(mesh._partBuffer), _partBuffer(mesh._partBuffer) {
_colorBuffer(mesh._colorBuffer) {
} }
Mesh::~Mesh() { Mesh::~Mesh() {
@ -42,13 +39,6 @@ void Mesh::setVertexFormatAndStream(const gpu::Stream::FormatPointer& vf, const
auto attrib = _vertexFormat->getAttribute(gpu::Stream::POSITION); auto attrib = _vertexFormat->getAttribute(gpu::Stream::POSITION);
_vertexBuffer = BufferView(vbs->getBuffers()[attrib._channel], vbs->getOffsets()[attrib._channel], vbs->getBuffers()[attrib._channel]->getSize(), _vertexBuffer = BufferView(vbs->getBuffers()[attrib._channel], vbs->getOffsets()[attrib._channel], vbs->getBuffers()[attrib._channel]->getSize(),
(gpu::uint16) vbs->getStrides()[attrib._channel], attrib._element); (gpu::uint16) vbs->getStrides()[attrib._channel], attrib._element);
// We require meshes to have a color attribute. If they don't, we default to white.
if (!_vertexFormat->hasAttribute(gpu::Stream::COLOR)) {
int channelNum = _vertexStream.getNumBuffers();
_vertexFormat->setAttribute(gpu::Stream::COLOR, channelNum, gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA), 0, gpu::Stream::PER_INSTANCE);
_vertexStream.addBuffer(_colorBuffer, 0, _vertexFormat->getChannels().at(channelNum)._stride);
}
} }
void Mesh::setVertexBuffer(const BufferView& buffer) { void Mesh::setVertexBuffer(const BufferView& buffer) {
@ -108,12 +98,6 @@ void Mesh::evalVertexStream() {
_vertexStream.addBuffer(view._buffer, view._offset, stride); _vertexStream.addBuffer(view._buffer, view._offset, stride);
channelNum++; channelNum++;
} }
// We require meshes to have a color attribute. If they don't, we default to white.
if (!_vertexFormat->hasAttribute(gpu::Stream::COLOR)) {
_vertexFormat->setAttribute(gpu::Stream::COLOR, channelNum, gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA), 0, gpu::Stream::PER_INSTANCE);
_vertexStream.addBuffer(_colorBuffer, 0, _vertexFormat->getChannels().at(channelNum)._stride);
}
} }
void Mesh::setIndexBuffer(const BufferView& buffer) { void Mesh::setIndexBuffer(const BufferView& buffer) {

Some files were not shown because too many files have changed in this diff Show more