Merge branch 'master' of https://github.com/highfidelity/hifi into domaincheckin

This commit is contained in:
Roxanne Skelly 2019-06-04 11:20:52 -07:00
commit 6a66e1558b
28 changed files with 471 additions and 381 deletions

View file

@ -6,8 +6,8 @@ if (WIN32)
include(ExternalProject)
ExternalProject_Add(
${EXTERNAL_NAME}
URL https://public.highfidelity.com/dependencies/qtaudio_wasapi10.zip
URL_MD5 4f40e49715a420fb67b45b9cee19052c
URL https://public.highfidelity.com/dependencies/qtaudio_wasapi11.zip
URL_MD5 d0eb8489455e7f79d59155535a2c8861
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""

View file

@ -53,5 +53,7 @@
</array>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSMicrophoneUsageDescription</key>
<string></string>
</dict>
</plist>

View file

@ -1,4 +1,7 @@
# Updated June 6th, 2019, to force new vckpg hash
#
# Common Ambient Variables:
#
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
@ -9,7 +12,6 @@
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
#
#
include(vcpkg_common_functions)

View file

@ -254,9 +254,9 @@ endif()
url = 'NOT DEFINED'
if platform.system() == 'Windows':
url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-windows2.tar.gz'
url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-windows3.tar.gz'
elif platform.system() == 'Darwin':
url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-macos2.tar.gz'
url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-macos3.tar.gz'
elif platform.system() == 'Linux':
if platform.linux_distribution()[1][:3] == '16.':
url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-16.04.tar.gz'

View file

@ -12,6 +12,7 @@ import QtQuick 2.10
import "../simplifiedConstants" as SimplifiedConstants
import "./components" as AvatarAppComponents
import stylesUit 1.0 as HifiStylesUit
import TabletScriptingInterface 1.0
import "qrc:////qml//hifi//models" as HifiModels // Absolute path so the same code works everywhere.
Rectangle {
@ -99,6 +100,33 @@ Rectangle {
}
}
Image {
id: homeButton
source: "images/homeIcon.svg"
opacity: homeButtonMouseArea.containsMouse ? 1.0 : 0.7
anchors.top: parent.top
anchors.topMargin: 15
anchors.right: parent.right
anchors.rightMargin: 24
width: 14
height: 13
MouseArea {
id: homeButtonMouseArea
anchors.fill: parent
hoverEnabled: true
onEntered: {
Tablet.playSound(TabletEnums.ButtonHover);
}
onClicked: {
Tablet.playSound(TabletEnums.ButtonClick);
// Can't use `Window.location` in QML, so just use what setting `Window.location` actually calls under the hood:
// AddressManager.handleLookupString().
AddressManager.handleLookupString(LocationBookmarks.getHomeLocationAddress());
}
}
}
AvatarAppComponents.DisplayNameHeader {
id: displayNameHeader
previewUrl: root.avatarPreviewUrl

View file

@ -0,0 +1,4 @@
<svg width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0.546497 6.46222C0.68683 6.52762 0.841945 6.5522 0.994929 6.53328C1.08986 6.5539 1.18806 6.55265 1.28246 6.52963C1.37687 6.50661 1.46514 6.46239 1.54094 6.40015L3.30854 5.1924L7.13987 2.44404L12.4889 6.38113C12.5827 6.46758 12.6942 6.53129 12.8152 6.56759C12.9361 6.60388 13.0634 6.61183 13.1878 6.59084C13.3121 6.56985 13.4303 6.52046 13.5336 6.44631C13.6369 6.37216 13.7226 6.27514 13.7846 6.1624C13.8688 6.06517 13.9308 5.94985 13.9662 5.82485C14.0015 5.69986 14.0093 5.56833 13.9889 5.43987C13.9685 5.3114 13.9205 5.18923 13.8483 5.08225C13.7761 4.97528 13.6816 4.88619 13.5717 4.8215L7.13987 0L2.21652 3.5662L0.485918 4.75494C-0.0415861 5.04974 -0.143383 5.51573 0.199032 6.1624C0.285979 6.29313 0.406165 6.39683 0.546497 6.46222Z" fill="white"/>
<path d="M6.99182 4.97367L10.3142 7.35113L11.9059 8.53987V13H2.15174V8.38771L3.7435 7.27505L6.99182 4.97367Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 990 B

View file

@ -101,7 +101,7 @@ Flickable {
HifiStylesUit.GraphikRegular {
id: performanceTitle
text: "Performance"
text: "Graphics Preset"
Layout.maximumWidth: parent.width
height: paintedHeight
size: 22
@ -115,28 +115,28 @@ Flickable {
SimplifiedControls.RadioButton {
id: performanceLow
text: "Eco"
checked: Performance.getRefreshRateProfile() === RefreshRate.ECO
text: "Low"
checked: Performance.getPerformancePreset() === PerformanceEnums.LOW
onClicked: {
Performance.setRefreshRateProfile(RefreshRate.ECO);
Performance.setPerformancePreset(PerformanceEnums.LOW);
}
}
SimplifiedControls.RadioButton {
id: performanceMedium
text: "Interactive"
checked: Performance.getRefreshRateProfile() === RefreshRate.INTERACTIVE
text: "Medium"
checked: Performance.getPerformancePreset() === PerformanceEnums.MID
onClicked: {
Performance.setRefreshRateProfile(RefreshRate.INTERACTIVE);
Performance.setPerformancePreset(PerformanceEnums.MID);
}
}
SimplifiedControls.RadioButton {
id: performanceHigh
text: "Realtime"
checked: Performance.getRefreshRateProfile() === RefreshRate.REALTIME
text: "High"
checked: Performance.getPerformancePreset() === PerformanceEnums.HIGH
onClicked: {
Performance.setRefreshRateProfile(RefreshRate.REALTIME);
Performance.setPerformancePreset(PerformanceEnums.HIGH);
}
}
}

View file

@ -1311,8 +1311,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
accountManager->setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL());
// use our MyAvatar position and quat for address manager path
addressManager->setPositionGetter([this]{ return getMyAvatar()->getWorldFeetPosition(); });
addressManager->setOrientationGetter([this]{ return getMyAvatar()->getWorldOrientation(); });
addressManager->setPositionGetter([this] {
auto avatarManager = DependencyManager::get<AvatarManager>();
auto myAvatar = avatarManager ? avatarManager->getMyAvatar() : nullptr;
return myAvatar ? myAvatar->getWorldFeetPosition() : Vectors::ZERO;
});
addressManager->setOrientationGetter([this] {
auto avatarManager = DependencyManager::get<AvatarManager>();
auto myAvatar = avatarManager ? avatarManager->getMyAvatar() : nullptr;
return myAvatar ? myAvatar->getWorldOrientation() : glm::quat();
});
connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle);
connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress);
@ -4155,8 +4163,14 @@ bool Application::eventFilter(QObject* object, QEvent* event) {
}
if (event->type() == QEvent::WindowStateChange) {
if (getWindow()->windowState() == Qt::WindowMinimized) {
if (getWindow()->windowState() & Qt::WindowMinimized) {
getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::MINIMIZED);
} else {
auto* windowStateChangeEvent = static_cast<QWindowStateChangeEvent*>(event);
if (windowStateChangeEvent->oldState() & Qt::WindowMinimized) {
getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::FOCUS_ACTIVE);
getRefreshRateManager().resetInactiveTimer();
}
}
}

View file

@ -325,8 +325,8 @@ MyAvatar::MyAvatar(QThread* thread) :
MyAvatar::~MyAvatar() {
_lookAtTargetAvatar.reset();
delete _myScriptEngine;
_myScriptEngine = nullptr;
delete _scriptEngine;
_scriptEngine = nullptr;
}
QString MyAvatar::getDominantHand() const {
@ -1598,7 +1598,8 @@ void MyAvatar::handleChangedAvatarEntityData() {
blobFailed = true; // blob doesn't exist
return;
}
if (!EntityItemProperties::blobToProperties(*_myScriptEngine, itr.value(), properties)) {
std::lock_guard<std::mutex> guard(_scriptEngineLock);
if (!EntityItemProperties::blobToProperties(*_scriptEngine, itr.value(), properties)) {
blobFailed = true; // blob is corrupt
}
});
@ -1630,7 +1631,8 @@ void MyAvatar::handleChangedAvatarEntityData() {
skip = true;
return;
}
if (!EntityItemProperties::blobToProperties(*_myScriptEngine, itr.value(), properties)) {
std::lock_guard<std::mutex> guard(_scriptEngineLock);
if (!EntityItemProperties::blobToProperties(*_scriptEngine, itr.value(), properties)) {
skip = true;
}
});
@ -1737,7 +1739,10 @@ bool MyAvatar::updateStaleAvatarEntityBlobs() const {
if (found) {
++numFound;
QByteArray blob;
EntityItemProperties::propertiesToBlob(*_myScriptEngine, getID(), properties, blob);
{
std::lock_guard<std::mutex> guard(_scriptEngineLock);
EntityItemProperties::propertiesToBlob(*_scriptEngine, getID(), properties, blob);
}
_avatarEntitiesLock.withWriteLock([&] {
_cachedAvatarEntityBlobs[id] = blob;
});
@ -1883,8 +1888,8 @@ void MyAvatar::avatarEntityDataToJson(QJsonObject& root) const {
}
void MyAvatar::loadData() {
if (!_myScriptEngine) {
_myScriptEngine = new QScriptEngine();
if (!_scriptEngine) {
_scriptEngine = new QScriptEngine();
}
getHead()->setBasePitch(_headPitchSetting.get());
@ -2476,14 +2481,18 @@ QVariantList MyAvatar::getAvatarEntitiesVariant() {
if (!entity) {
continue;
}
QVariantMap avatarEntityData;
EncodeBitstreamParams params;
auto desiredProperties = entity->getEntityProperties(params);
desiredProperties += PROP_LOCAL_POSITION;
desiredProperties += PROP_LOCAL_ROTATION;
EntityItemProperties entityProperties = entity->getProperties(desiredProperties);
QScriptValue scriptProperties = EntityItemPropertiesToScriptValue(_myScriptEngine, entityProperties);
QVariantMap avatarEntityData;
avatarEntityData["id"] = entityID;
EntityItemProperties entityProperties = entity->getProperties(desiredProperties);
QScriptValue scriptProperties;
{
std::lock_guard<std::mutex> guard(_scriptEngineLock);
scriptProperties = EntityItemPropertiesToScriptValue(_scriptEngine, entityProperties);
}
avatarEntityData["properties"] = scriptProperties.toVariant();
avatarEntitiesData.append(QVariant(avatarEntityData));
}

View file

@ -2741,7 +2741,8 @@ private:
mutable std::set<QUuid> _staleCachedAvatarEntityBlobs;
//
// keep a ScriptEngine around so we don't have to instantiate on the fly (these are very slow to create/delete)
QScriptEngine* _myScriptEngine { nullptr };
mutable std::mutex _scriptEngineLock;
QScriptEngine* _scriptEngine { nullptr };
bool _needToSaveAvatarEntitySettings { false };
};

View file

@ -15,7 +15,7 @@ std::once_flag PerformanceScriptingInterface::registry_flag;
PerformanceScriptingInterface::PerformanceScriptingInterface() {
std::call_once(registry_flag, [] {
qmlRegisterType<PerformanceScriptingInterface>("PerformanceEnums", 1, 0, "RefreshRate");
qmlRegisterType<PerformanceScriptingInterface>("PerformanceEnums", 1, 0, "PerformanceEnums");
});
}

View file

@ -291,6 +291,7 @@ AudioClient::AudioClient() :
_inputToNetworkResampler(NULL),
_networkToOutputResampler(NULL),
_localToOutputResampler(NULL),
_loopbackResampler(NULL),
_audioLimiter(AudioConstants::SAMPLE_RATE, OUTPUT_CHANNEL_COUNT),
_outgoingAvatarAudioSequenceNumber(0),
_audioOutputIODevice(_localInjectorsStream, _receivedAudioStream, this),
@ -656,11 +657,11 @@ bool adjustedFormatForAudioDevice(const QAudioDeviceInfo& audioDevice,
return false; // a supported format could not be found
}
bool sampleChannelConversion(const int16_t* sourceSamples, int16_t* destinationSamples, unsigned int numSourceSamples,
bool sampleChannelConversion(const int16_t* sourceSamples, int16_t* destinationSamples, int numSourceSamples,
const int sourceChannelCount, const int destinationChannelCount) {
if (sourceChannelCount == 2 && destinationChannelCount == 1) {
// loop through the stereo input audio samples and average every two samples
for (uint i = 0; i < numSourceSamples; i += 2) {
for (int i = 0; i < numSourceSamples; i += 2) {
destinationSamples[i / 2] = (sourceSamples[i] / 2) + (sourceSamples[i + 1] / 2);
}
@ -668,7 +669,7 @@ bool sampleChannelConversion(const int16_t* sourceSamples, int16_t* destinationS
} else if (sourceChannelCount == 1 && destinationChannelCount == 2) {
// loop through the mono input audio and repeat each sample twice
for (uint i = 0; i < numSourceSamples; ++i) {
for (int i = 0; i < numSourceSamples; ++i) {
destinationSamples[i * 2] = destinationSamples[(i * 2) + 1] = sourceSamples[i];
}
@ -678,10 +679,13 @@ bool sampleChannelConversion(const int16_t* sourceSamples, int16_t* destinationS
return false;
}
void possibleResampling(AudioSRC* resampler,
const int16_t* sourceSamples, int16_t* destinationSamples,
unsigned int numSourceSamples, unsigned int numDestinationSamples,
const int sourceChannelCount, const int destinationChannelCount) {
int possibleResampling(AudioSRC* resampler,
const int16_t* sourceSamples, int16_t* destinationSamples,
int numSourceSamples, int maxDestinationSamples,
const int sourceChannelCount, const int destinationChannelCount) {
int numSourceFrames = numSourceSamples / sourceChannelCount;
int numDestinationFrames = 0;
if (numSourceSamples > 0) {
if (!resampler) {
@ -690,33 +694,30 @@ void possibleResampling(AudioSRC* resampler,
// no conversion, we can copy the samples directly across
memcpy(destinationSamples, sourceSamples, numSourceSamples * AudioConstants::SAMPLE_SIZE);
}
numDestinationFrames = numSourceFrames;
} else {
if (sourceChannelCount != destinationChannelCount) {
int numChannelCoversionSamples = (numSourceSamples * destinationChannelCount) / sourceChannelCount;
int16_t* channelConversionSamples = new int16_t[numChannelCoversionSamples];
int16_t* channelConversionSamples = new int16_t[numSourceFrames * destinationChannelCount];
sampleChannelConversion(sourceSamples, channelConversionSamples, numSourceSamples,
sourceChannelCount, destinationChannelCount);
resampler->render(channelConversionSamples, destinationSamples, numChannelCoversionSamples);
numDestinationFrames = resampler->render(channelConversionSamples, destinationSamples, numSourceFrames);
delete[] channelConversionSamples;
} else {
unsigned int numAdjustedSourceSamples = numSourceSamples;
unsigned int numAdjustedDestinationSamples = numDestinationSamples;
if (sourceChannelCount == 2 && destinationChannelCount == 2) {
numAdjustedSourceSamples /= 2;
numAdjustedDestinationSamples /= 2;
}
resampler->render(sourceSamples, destinationSamples, numAdjustedSourceSamples);
numDestinationFrames = resampler->render(sourceSamples, destinationSamples, numSourceFrames);
}
}
}
int numDestinationSamples = numDestinationFrames * destinationChannelCount;
if (numDestinationSamples > maxDestinationSamples) {
qCWarning(audioclient) << "Resampler overflow! numDestinationSamples =" << numDestinationSamples
<< "but maxDestinationSamples =" << maxDestinationSamples;
}
return numDestinationSamples;
}
void AudioClient::start() {
@ -1085,13 +1086,6 @@ void AudioClient::handleLocalEchoAndReverb(QByteArray& inputByteArray) {
return;
}
// NOTE: we assume the inputFormat and the outputFormat are the same, since on any modern
// multimedia OS they should be. If there is a device that this is not true for, we can
// add back support to do resampling.
if (_inputFormat.sampleRate() != _outputFormat.sampleRate()) {
return;
}
// if this person wants local loopback add that to the locally injected audio
// if there is reverb apply it to local audio and substract the origin samples
@ -1108,21 +1102,30 @@ void AudioClient::handleLocalEchoAndReverb(QByteArray& inputByteArray) {
}
}
// if required, create loopback resampler
if (_inputFormat.sampleRate() != _outputFormat.sampleRate() && !_loopbackResampler) {
qCDebug(audioclient) << "Resampling from" << _inputFormat.sampleRate() << "to" << _outputFormat.sampleRate() << "for audio loopback.";
_loopbackResampler = new AudioSRC(_inputFormat.sampleRate(), _outputFormat.sampleRate(), OUTPUT_CHANNEL_COUNT);
}
static QByteArray loopBackByteArray;
int numInputSamples = inputByteArray.size() / AudioConstants::SAMPLE_SIZE;
int numLoopbackSamples = (numInputSamples * OUTPUT_CHANNEL_COUNT) / _inputFormat.channelCount();
int numInputFrames = numInputSamples / _inputFormat.channelCount();
int maxLoopbackFrames = _loopbackResampler ? _loopbackResampler->getMaxOutput(numInputFrames) : numInputFrames;
int maxLoopbackSamples = maxLoopbackFrames * OUTPUT_CHANNEL_COUNT;
loopBackByteArray.resize(numLoopbackSamples * AudioConstants::SAMPLE_SIZE);
loopBackByteArray.resize(maxLoopbackSamples * AudioConstants::SAMPLE_SIZE);
int16_t* inputSamples = reinterpret_cast<int16_t*>(inputByteArray.data());
int16_t* loopbackSamples = reinterpret_cast<int16_t*>(loopBackByteArray.data());
// upmix mono to stereo
if (!sampleChannelConversion(inputSamples, loopbackSamples, numInputSamples, _inputFormat.channelCount(), OUTPUT_CHANNEL_COUNT)) {
// no conversion, just copy the samples
memcpy(loopbackSamples, inputSamples, numInputSamples * AudioConstants::SAMPLE_SIZE);
}
int numLoopbackSamples = possibleResampling(_loopbackResampler,
inputSamples, loopbackSamples,
numInputSamples, maxLoopbackSamples,
_inputFormat.channelCount(), OUTPUT_CHANNEL_COUNT);
loopBackByteArray.resize(numLoopbackSamples * AudioConstants::SAMPLE_SIZE);
// apply stereo reverb at the source, to the loopback audio
if (!_shouldEchoLocally && hasReverb) {
@ -1665,12 +1668,17 @@ bool AudioClient::switchInputToAudioDevice(const QAudioDeviceInfo inputDeviceInf
_dummyAudioInput = NULL;
}
// cleanup any resamplers
if (_inputToNetworkResampler) {
// if we were using an input to network resampler, delete it here
delete _inputToNetworkResampler;
_inputToNetworkResampler = NULL;
}
if (_loopbackResampler) {
delete _loopbackResampler;
_loopbackResampler = NULL;
}
if (_audioGate) {
delete _audioGate;
_audioGate = nullptr;
@ -1892,15 +1900,22 @@ bool AudioClient::switchOutputToAudioDevice(const QAudioDeviceInfo outputDeviceI
_outputDeviceInfo = QAudioDeviceInfo();
}
// cleanup any resamplers
if (_networkToOutputResampler) {
// if we were using an input to network resampler, delete it here
delete _networkToOutputResampler;
_networkToOutputResampler = NULL;
}
if (_localToOutputResampler) {
delete _localToOutputResampler;
_localToOutputResampler = NULL;
}
if (_loopbackResampler) {
delete _loopbackResampler;
_loopbackResampler = NULL;
}
if (isShutdownRequest) {
qCDebug(audioclient) << "The audio output device has shut down.";
return true;

View file

@ -390,6 +390,7 @@ private:
AudioSRC* _inputToNetworkResampler;
AudioSRC* _networkToOutputResampler;
AudioSRC* _localToOutputResampler;
AudioSRC* _loopbackResampler;
// for network audio (used by network audio thread)
int16_t _networkScratchBuffer[AudioConstants::NETWORK_FRAME_SAMPLES_AMBISONIC];

View file

@ -34,15 +34,26 @@ int AudioSRC::multirateFilter1_AVX2(const float* input0, float* output0, int inp
const float* c0 = &_polyphaseFilter[_numTaps * _phase];
__m256 acc0 = _mm256_setzero_ps();
__m256 acc1 = _mm256_setzero_ps();
for (int j = 0; j < _numTaps; j += 8) {
int j = 0;
for (; j < _numTaps - 15; j += 16) { // unrolled x 2
//float coef = c0[j];
__m256 coef0 = _mm256_loadu_ps(&c0[j]);
__m256 coef0 = _mm256_loadu_ps(&c0[j + 0]);
__m256 coef1 = _mm256_loadu_ps(&c0[j + 8]);
//acc += input[i + j] * coef;
acc0 = _mm256_fmadd_ps(_mm256_loadu_ps(&input0[i + j + 0]), coef0, acc0);
acc1 = _mm256_fmadd_ps(_mm256_loadu_ps(&input0[i + j + 8]), coef1, acc1);
}
if (j < _numTaps) {
__m256 coef0 = _mm256_loadu_ps(&c0[j]);
acc0 = _mm256_fmadd_ps(_mm256_loadu_ps(&input0[i + j]), coef0, acc0);
}
acc0 = _mm256_add_ps(acc0, acc1);
// horizontal sum
acc0 = _mm256_hadd_ps(acc0, acc0);
@ -73,19 +84,36 @@ int AudioSRC::multirateFilter1_AVX2(const float* input0, float* output0, int inp
const float* c1 = &_polyphaseFilter[_numTaps * (phase + 1)];
__m256 acc0 = _mm256_setzero_ps();
__m256 acc1 = _mm256_setzero_ps();
__m256 frac = _mm256_broadcast_ss(&ftmp);
for (int j = 0; j < _numTaps; j += 8) {
int j = 0;
for (; j < _numTaps - 15; j += 16) { // unrolled x 2
//float coef = c0[j] + frac * (c1[j] - c0[j]);
__m256 coef0 = _mm256_loadu_ps(&c0[j + 0]);
__m256 coef1 = _mm256_loadu_ps(&c1[j + 0]);
__m256 coef2 = _mm256_loadu_ps(&c0[j + 8]);
__m256 coef3 = _mm256_loadu_ps(&c1[j + 8]);
coef1 = _mm256_sub_ps(coef1, coef0);
coef3 = _mm256_sub_ps(coef3, coef2);
coef0 = _mm256_fmadd_ps(coef1, frac, coef0);
coef2 = _mm256_fmadd_ps(coef3, frac, coef2);
//acc += input[i + j] * coef;
acc0 = _mm256_fmadd_ps(_mm256_loadu_ps(&input0[i + j + 0]), coef0, acc0);
acc1 = _mm256_fmadd_ps(_mm256_loadu_ps(&input0[i + j + 8]), coef2, acc1);
}
if (j < _numTaps) {
__m256 coef0 = _mm256_loadu_ps(&c0[j]);
__m256 coef1 = _mm256_loadu_ps(&c1[j]);
coef1 = _mm256_sub_ps(coef1, coef0);
coef0 = _mm256_fmadd_ps(coef1, frac, coef0);
//acc += input[i + j] * coef;
acc0 = _mm256_fmadd_ps(_mm256_loadu_ps(&input0[i + j]), coef0, acc0);
}
acc0 = _mm256_add_ps(acc0, acc1);
// horizontal sum
acc0 = _mm256_hadd_ps(acc0, acc0);

View file

@ -163,7 +163,7 @@ void ImageEntityRenderer::doRender(RenderArgs* args) {
transform = _renderTransform;
});
if (!_visible || !texture || !texture->isLoaded()) {
if (!_visible || !texture || !texture->isLoaded() || color.a == 0.0f) {
return;
}
@ -214,4 +214,4 @@ void ImageEntityRenderer::doRender(RenderArgs* args) {
);
batch->setResourceTexture(0, nullptr);
}
}

View file

@ -270,6 +270,10 @@ void ShapeEntityRenderer::doRender(RenderArgs* args) {
}
});
if (outColor.a == 0.0f) {
return;
}
if (proceduralRender) {
if (render::ShapeKey(args->_globalShapeKey).isWireframe() || primitiveMode == PrimitiveMode::LINES) {
geometryCache->renderWireShape(batch, geometryShape, outColor);

View file

@ -104,41 +104,199 @@ bool EntityItemProperties::constructFromBuffer(const unsigned char* data, int da
return true;
}
QHash<QString, ShapeType> stringToShapeTypeLookup;
void addShapeType(ShapeType type) {
stringToShapeTypeLookup[ShapeInfo::getNameForShapeType(type)] = type;
inline void addShapeType(QHash<QString, ShapeType>& lookup, ShapeType type) { lookup[ShapeInfo::getNameForShapeType(type)] = type; }
QHash<QString, ShapeType> stringToShapeTypeLookup = [] {
QHash<QString, ShapeType> toReturn;
addShapeType(toReturn, SHAPE_TYPE_NONE);
addShapeType(toReturn, SHAPE_TYPE_BOX);
addShapeType(toReturn, SHAPE_TYPE_SPHERE);
addShapeType(toReturn, SHAPE_TYPE_CAPSULE_X);
addShapeType(toReturn, SHAPE_TYPE_CAPSULE_Y);
addShapeType(toReturn, SHAPE_TYPE_CAPSULE_Z);
addShapeType(toReturn, SHAPE_TYPE_CYLINDER_X);
addShapeType(toReturn, SHAPE_TYPE_CYLINDER_Y);
addShapeType(toReturn, SHAPE_TYPE_CYLINDER_Z);
addShapeType(toReturn, SHAPE_TYPE_HULL);
addShapeType(toReturn, SHAPE_TYPE_PLANE);
addShapeType(toReturn, SHAPE_TYPE_COMPOUND);
addShapeType(toReturn, SHAPE_TYPE_SIMPLE_HULL);
addShapeType(toReturn, SHAPE_TYPE_SIMPLE_COMPOUND);
addShapeType(toReturn, SHAPE_TYPE_STATIC_MESH);
addShapeType(toReturn, SHAPE_TYPE_ELLIPSOID);
addShapeType(toReturn, SHAPE_TYPE_CIRCLE);
return toReturn;
}();
QString EntityItemProperties::getShapeTypeAsString() const { return ShapeInfo::getNameForShapeType(_shapeType); }
void EntityItemProperties::setShapeTypeFromString(const QString& shapeName) {
auto shapeTypeItr = stringToShapeTypeLookup.find(shapeName.toLower());
if (shapeTypeItr != stringToShapeTypeLookup.end()) {
_shapeType = shapeTypeItr.value();
_shapeTypeChanged = true;
}
}
void buildStringToShapeTypeLookup() {
addShapeType(SHAPE_TYPE_NONE);
addShapeType(SHAPE_TYPE_BOX);
addShapeType(SHAPE_TYPE_SPHERE);
addShapeType(SHAPE_TYPE_CAPSULE_X);
addShapeType(SHAPE_TYPE_CAPSULE_Y);
addShapeType(SHAPE_TYPE_CAPSULE_Z);
addShapeType(SHAPE_TYPE_CYLINDER_X);
addShapeType(SHAPE_TYPE_CYLINDER_Y);
addShapeType(SHAPE_TYPE_CYLINDER_Z);
addShapeType(SHAPE_TYPE_HULL);
addShapeType(SHAPE_TYPE_PLANE);
addShapeType(SHAPE_TYPE_COMPOUND);
addShapeType(SHAPE_TYPE_SIMPLE_HULL);
addShapeType(SHAPE_TYPE_SIMPLE_COMPOUND);
addShapeType(SHAPE_TYPE_STATIC_MESH);
addShapeType(SHAPE_TYPE_ELLIPSOID);
addShapeType(SHAPE_TYPE_CIRCLE);
inline void addMaterialMappingMode(QHash<QString, MaterialMappingMode>& lookup, MaterialMappingMode mode) { lookup[MaterialMappingModeHelpers::getNameForMaterialMappingMode(mode)] = mode; }
const QHash<QString, MaterialMappingMode> stringToMaterialMappingModeLookup = [] {
QHash<QString, MaterialMappingMode> toReturn;
addMaterialMappingMode(toReturn, UV);
addMaterialMappingMode(toReturn, PROJECTED);
return toReturn;
}();
QString EntityItemProperties::getMaterialMappingModeAsString() const { return MaterialMappingModeHelpers::getNameForMaterialMappingMode(_materialMappingMode); }
void EntityItemProperties::setMaterialMappingModeFromString(const QString& materialMappingMode) {
auto materialMappingModeItr = stringToMaterialMappingModeLookup.find(materialMappingMode.toLower());
if (materialMappingModeItr != stringToMaterialMappingModeLookup.end()) {
_materialMappingMode = materialMappingModeItr.value();
_materialMappingModeChanged = true;
}
}
QHash<QString, MaterialMappingMode> stringToMaterialMappingModeLookup;
void addMaterialMappingMode(MaterialMappingMode mode) {
stringToMaterialMappingModeLookup[MaterialMappingModeHelpers::getNameForMaterialMappingMode(mode)] = mode;
inline void addBillboardMode(QHash<QString, BillboardMode>& lookup, BillboardMode mode) { lookup[BillboardModeHelpers::getNameForBillboardMode(mode)] = mode; }
const QHash<QString, BillboardMode> stringToBillboardModeLookup = [] {
QHash<QString, BillboardMode> toReturn;
addBillboardMode(toReturn, BillboardMode::NONE);
addBillboardMode(toReturn, BillboardMode::YAW);
addBillboardMode(toReturn, BillboardMode::FULL);
return toReturn;
}();
QString EntityItemProperties::getBillboardModeAsString() const { return BillboardModeHelpers::getNameForBillboardMode(_billboardMode); }
void EntityItemProperties::setBillboardModeFromString(const QString& billboardMode) {
auto billboardModeItr = stringToBillboardModeLookup.find(billboardMode.toLower());
if (billboardModeItr != stringToBillboardModeLookup.end()) {
_billboardMode = billboardModeItr.value();
_billboardModeChanged = true;
}
}
void buildStringToMaterialMappingModeLookup() {
addMaterialMappingMode(UV);
addMaterialMappingMode(PROJECTED);
inline void addRenderLayer(QHash<QString, RenderLayer>& lookup, RenderLayer mode) { lookup[RenderLayerHelpers::getNameForRenderLayer(mode)] = mode; }
const QHash<QString, RenderLayer> stringToRenderLayerLookup = [] {
QHash<QString, RenderLayer> toReturn;
addRenderLayer(toReturn, RenderLayer::WORLD);
addRenderLayer(toReturn, RenderLayer::FRONT);
addRenderLayer(toReturn, RenderLayer::HUD);
return toReturn;
}();
QString EntityItemProperties::getRenderLayerAsString() const { return RenderLayerHelpers::getNameForRenderLayer(_renderLayer); }
void EntityItemProperties::setRenderLayerFromString(const QString& renderLayer) {
auto renderLayerItr = stringToRenderLayerLookup.find(renderLayer.toLower());
if (renderLayerItr != stringToRenderLayerLookup.end()) {
_renderLayer = renderLayerItr.value();
_renderLayerChanged = true;
}
}
inline void addPrimitiveMode(QHash<QString, PrimitiveMode>& lookup, PrimitiveMode mode) { lookup[PrimitiveModeHelpers::getNameForPrimitiveMode(mode)] = mode; }
const QHash<QString, PrimitiveMode> stringToPrimitiveModeLookup = [] {
QHash<QString, PrimitiveMode> toReturn;
addPrimitiveMode(toReturn, PrimitiveMode::SOLID);
addPrimitiveMode(toReturn, PrimitiveMode::LINES);
return toReturn;
}();
QString EntityItemProperties::getPrimitiveModeAsString() const { return PrimitiveModeHelpers::getNameForPrimitiveMode(_primitiveMode); }
void EntityItemProperties::setPrimitiveModeFromString(const QString& primitiveMode) {
auto primitiveModeItr = stringToPrimitiveModeLookup.find(primitiveMode.toLower());
if (primitiveModeItr != stringToPrimitiveModeLookup.end()) {
_primitiveMode = primitiveModeItr.value();
_primitiveModeChanged = true;
}
}
inline void addWebInputMode(QHash<QString, WebInputMode>& lookup, WebInputMode mode) { lookup[WebInputModeHelpers::getNameForWebInputMode(mode)] = mode; }
const QHash<QString, WebInputMode> stringToWebInputModeLookup = [] {
QHash<QString, WebInputMode> toReturn;
addWebInputMode(toReturn, WebInputMode::TOUCH);
addWebInputMode(toReturn, WebInputMode::MOUSE);
return toReturn;
}();
QString EntityItemProperties::getInputModeAsString() const { return WebInputModeHelpers::getNameForWebInputMode(_inputMode); }
void EntityItemProperties::setInputModeFromString(const QString& webInputMode) {
auto webInputModeItr = stringToWebInputModeLookup.find(webInputMode.toLower());
if (webInputModeItr != stringToWebInputModeLookup.end()) {
_inputMode = webInputModeItr.value();
_inputModeChanged = true;
}
}
inline void addGizmoType(QHash<QString, GizmoType>& lookup, GizmoType mode) { lookup[GizmoTypeHelpers::getNameForGizmoType(mode)] = mode; }
const QHash<QString, GizmoType> stringToGizmoTypeLookup = [] {
QHash<QString, GizmoType> toReturn;
addGizmoType(toReturn, GizmoType::RING);
return toReturn;
}();
QString EntityItemProperties::getGizmoTypeAsString() const { return GizmoTypeHelpers::getNameForGizmoType(_gizmoType); }
void EntityItemProperties::setGizmoTypeFromString(const QString& gizmoType) {
auto gizmoTypeItr = stringToGizmoTypeLookup.find(gizmoType.toLower());
if (gizmoTypeItr != stringToGizmoTypeLookup.end()) {
_gizmoType = gizmoTypeItr.value();
_gizmoTypeChanged = true;
}
}
inline void addComponentMode(QHash<QString, ComponentMode>& lookup, ComponentMode mode) { lookup[ComponentModeHelpers::getNameForComponentMode(mode)] = mode; }
const QHash<QString, ComponentMode> stringToComponentMode = [] {
QHash<QString, ComponentMode> toReturn;
addComponentMode(toReturn, ComponentMode::COMPONENT_MODE_INHERIT);
addComponentMode(toReturn, ComponentMode::COMPONENT_MODE_DISABLED);
addComponentMode(toReturn, ComponentMode::COMPONENT_MODE_ENABLED);
return toReturn;
}();
QString EntityItemProperties::getComponentModeAsString(uint32_t mode) { return ComponentModeHelpers::getNameForComponentMode((ComponentMode)mode); }
QString EntityItemProperties::getSkyboxModeAsString() const { return getComponentModeAsString(_skyboxMode); }
QString EntityItemProperties::getKeyLightModeAsString() const { return getComponentModeAsString(_keyLightMode); }
QString EntityItemProperties::getAmbientLightModeAsString() const { return getComponentModeAsString(_ambientLightMode); }
QString EntityItemProperties::getHazeModeAsString() const { return getComponentModeAsString(_hazeMode); }
QString EntityItemProperties::getBloomModeAsString() const { return getComponentModeAsString(_bloomMode); }
void EntityItemProperties::setSkyboxModeFromString(const QString& mode) {
auto modeItr = stringToComponentMode.find(mode.toLower());
if (modeItr != stringToComponentMode.end()) {
_skyboxMode = modeItr.value();
_skyboxModeChanged = true;
}
}
void EntityItemProperties::setKeyLightModeFromString(const QString& mode) {
auto modeItr = stringToComponentMode.find(mode.toLower());
if (modeItr != stringToComponentMode.end()) {
_keyLightMode = modeItr.value();
_keyLightModeChanged = true;
}
}
void EntityItemProperties::setAmbientLightModeFromString(const QString& mode) {
auto modeItr = stringToComponentMode.find(mode.toLower());
if (modeItr != stringToComponentMode.end()) {
_ambientLightMode = modeItr.value();
_ambientLightModeChanged = true;
}
}
void EntityItemProperties::setHazeModeFromString(const QString& mode) {
auto modeItr = stringToComponentMode.find(mode.toLower());
if (modeItr != stringToComponentMode.end()) {
_hazeMode = modeItr.value();
_hazeModeChanged = true;
}
}
void EntityItemProperties::setBloomModeFromString(const QString& mode) {
auto modeItr = stringToComponentMode.find(mode.toLower());
if (modeItr != stringToComponentMode.end()) {
_bloomMode = modeItr.value();
_bloomModeChanged = true;
}
}
inline void addAvatarPriorityMode(QHash<QString, AvatarPriorityMode>& lookup, AvatarPriorityMode mode) { lookup[AvatarPriorityModeHelpers::getNameForAvatarPriorityMode(mode)] = mode; }
const QHash<QString, AvatarPriorityMode> stringToAvatarPriority = [] {
QHash<QString, AvatarPriorityMode> toReturn;
addAvatarPriorityMode(toReturn, AvatarPriorityMode::AVATAR_PRIORITY_INHERIT);
addAvatarPriorityMode(toReturn, AvatarPriorityMode::AVATAR_PRIORITY_CROWD);
addAvatarPriorityMode(toReturn, AvatarPriorityMode::AVATAR_PRIORITY_HERO);
return toReturn;
}();
QString EntityItemProperties::getAvatarPriorityAsString() const { return AvatarPriorityModeHelpers::getNameForAvatarPriorityMode((AvatarPriorityMode)_avatarPriority); }
void EntityItemProperties::setAvatarPriorityFromString(const QString& mode) {
auto modeItr = stringToAvatarPriority.find(mode.toLower());
if (modeItr != stringToAvatarPriority.end()) {
_avatarPriority = modeItr.value();
_avatarPriorityChanged = true;
}
}
QString getCollisionGroupAsString(uint16_t group) {
@ -194,134 +352,6 @@ void EntityItemProperties::setCollisionMaskFromString(const QString& maskString)
_collisionMaskChanged = true;
}
QString EntityItemProperties::getShapeTypeAsString() const {
return ShapeInfo::getNameForShapeType(_shapeType);
}
void EntityItemProperties::setShapeTypeFromString(const QString& shapeName) {
if (stringToShapeTypeLookup.empty()) {
buildStringToShapeTypeLookup();
}
auto shapeTypeItr = stringToShapeTypeLookup.find(shapeName.toLower());
if (shapeTypeItr != stringToShapeTypeLookup.end()) {
_shapeType = shapeTypeItr.value();
_shapeTypeChanged = true;
}
}
QString EntityItemProperties::getComponentModeAsString(uint32_t mode) {
// return "inherit" if mode is not valid
if (mode < COMPONENT_MODE_ITEM_COUNT) {
return COMPONENT_MODES[mode].second;
} else {
return COMPONENT_MODES[COMPONENT_MODE_INHERIT].second;
}
}
QString EntityItemProperties::getHazeModeAsString() const {
return getComponentModeAsString(_hazeMode);
}
QString EntityItemProperties::getBloomModeAsString() const {
return getComponentModeAsString(_bloomMode);
}
namespace {
const QStringList AVATAR_PRIORITIES_AS_STRING
{ "inherit", "crowd", "hero" };
}
QString EntityItemProperties::getAvatarPriorityAsString() const {
return AVATAR_PRIORITIES_AS_STRING.value(_avatarPriority);
}
std::array<ComponentPair, COMPONENT_MODE_ITEM_COUNT>::const_iterator EntityItemProperties::findComponent(const QString& mode) {
return std::find_if(COMPONENT_MODES.begin(), COMPONENT_MODES.end(), [&](const ComponentPair& pair) {
return (pair.second == mode);
});
}
void EntityItemProperties::setHazeModeFromString(const QString& hazeMode) {
auto result = findComponent(hazeMode);
if (result != COMPONENT_MODES.end()) {
_hazeMode = result->first;
_hazeModeChanged = true;
}
}
void EntityItemProperties::setBloomModeFromString(const QString& bloomMode) {
auto result = findComponent(bloomMode);
if (result != COMPONENT_MODES.end()) {
_bloomMode = result->first;
_bloomModeChanged = true;
}
}
void EntityItemProperties::setAvatarPriorityFromString(QString const& avatarPriority) {
auto result = AVATAR_PRIORITIES_AS_STRING.indexOf(avatarPriority);
if (result != -1) {
_avatarPriority = result;
_avatarPriorityChanged = true;
}
}
QString EntityItemProperties::getKeyLightModeAsString() const {
return getComponentModeAsString(_keyLightMode);
}
void EntityItemProperties::setKeyLightModeFromString(const QString& keyLightMode) {
auto result = findComponent(keyLightMode);
if (result != COMPONENT_MODES.end()) {
_keyLightMode = result->first;
_keyLightModeChanged = true;
}
}
QString EntityItemProperties::getAmbientLightModeAsString() const {
return getComponentModeAsString(_ambientLightMode);
}
void EntityItemProperties::setAmbientLightModeFromString(const QString& ambientLightMode) {
auto result = findComponent(ambientLightMode);
if (result != COMPONENT_MODES.end()) {
_ambientLightMode = result->first;
_ambientLightModeChanged = true;
}
}
QString EntityItemProperties::getSkyboxModeAsString() const {
return getComponentModeAsString(_skyboxMode);
}
void EntityItemProperties::setSkyboxModeFromString(const QString& skyboxMode) {
auto result = findComponent(skyboxMode);
if (result != COMPONENT_MODES.end()) {
_skyboxMode = result->first;
_skyboxModeChanged = true;
}
}
QString EntityItemProperties::getMaterialMappingModeAsString() const {
return MaterialMappingModeHelpers::getNameForMaterialMappingMode(_materialMappingMode);
}
void EntityItemProperties::setMaterialMappingModeFromString(const QString& materialMappingMode) {
if (stringToMaterialMappingModeLookup.empty()) {
buildStringToMaterialMappingModeLookup();
}
auto materialMappingModeItr = stringToMaterialMappingModeLookup.find(materialMappingMode.toLower());
if (materialMappingModeItr != stringToMaterialMappingModeLookup.end()) {
_materialMappingMode = materialMappingModeItr.value();
_materialMappingModeChanged = true;
}
}
QString EntityItemProperties::getEntityHostTypeAsString() const {
switch (_entityHostType) {
case entity::HostType::DOMAIN:
@ -345,137 +375,6 @@ void EntityItemProperties::setEntityHostTypeFromString(const QString& entityHost
}
}
QHash<QString, BillboardMode> stringToBillboardModeLookup;
void addBillboardMode(BillboardMode mode) {
stringToBillboardModeLookup[BillboardModeHelpers::getNameForBillboardMode(mode)] = mode;
}
void buildStringToBillboardModeLookup() {
addBillboardMode(BillboardMode::NONE);
addBillboardMode(BillboardMode::YAW);
addBillboardMode(BillboardMode::FULL);
}
QString EntityItemProperties::getBillboardModeAsString() const {
return BillboardModeHelpers::getNameForBillboardMode(_billboardMode);
}
void EntityItemProperties::setBillboardModeFromString(const QString& billboardMode) {
if (stringToBillboardModeLookup.empty()) {
buildStringToBillboardModeLookup();
}
auto billboardModeItr = stringToBillboardModeLookup.find(billboardMode.toLower());
if (billboardModeItr != stringToBillboardModeLookup.end()) {
_billboardMode = billboardModeItr.value();
_billboardModeChanged = true;
}
}
QHash<QString, RenderLayer> stringToRenderLayerLookup;
void addRenderLayer(RenderLayer mode) {
stringToRenderLayerLookup[RenderLayerHelpers::getNameForRenderLayer(mode)] = mode;
}
void buildStringToRenderLayerLookup() {
addRenderLayer(RenderLayer::WORLD);
addRenderLayer(RenderLayer::FRONT);
addRenderLayer(RenderLayer::HUD);
}
QString EntityItemProperties::getRenderLayerAsString() const {
return RenderLayerHelpers::getNameForRenderLayer(_renderLayer);
}
void EntityItemProperties::setRenderLayerFromString(const QString& renderLayer) {
if (stringToRenderLayerLookup.empty()) {
buildStringToRenderLayerLookup();
}
auto renderLayerItr = stringToRenderLayerLookup.find(renderLayer.toLower());
if (renderLayerItr != stringToRenderLayerLookup.end()) {
_renderLayer = renderLayerItr.value();
_renderLayerChanged = true;
}
}
QHash<QString, PrimitiveMode> stringToPrimitiveModeLookup;
void addPrimitiveMode(PrimitiveMode mode) {
stringToPrimitiveModeLookup[PrimitiveModeHelpers::getNameForPrimitiveMode(mode)] = mode;
}
void buildStringToPrimitiveModeLookup() {
addPrimitiveMode(PrimitiveMode::SOLID);
addPrimitiveMode(PrimitiveMode::LINES);
}
QString EntityItemProperties::getPrimitiveModeAsString() const {
return PrimitiveModeHelpers::getNameForPrimitiveMode(_primitiveMode);
}
void EntityItemProperties::setPrimitiveModeFromString(const QString& primitiveMode) {
if (stringToPrimitiveModeLookup.empty()) {
buildStringToPrimitiveModeLookup();
}
auto primitiveModeItr = stringToPrimitiveModeLookup.find(primitiveMode.toLower());
if (primitiveModeItr != stringToPrimitiveModeLookup.end()) {
_primitiveMode = primitiveModeItr.value();
_primitiveModeChanged = true;
}
}
QHash<QString, WebInputMode> stringToWebInputModeLookup;
void addWebInputMode(WebInputMode mode) {
stringToWebInputModeLookup[WebInputModeHelpers::getNameForWebInputMode(mode)] = mode;
}
void buildStringToWebInputModeLookup() {
addWebInputMode(WebInputMode::TOUCH);
addWebInputMode(WebInputMode::MOUSE);
}
QString EntityItemProperties::getInputModeAsString() const {
return WebInputModeHelpers::getNameForWebInputMode(_inputMode);
}
void EntityItemProperties::setInputModeFromString(const QString& webInputMode) {
if (stringToWebInputModeLookup.empty()) {
buildStringToWebInputModeLookup();
}
auto webInputModeItr = stringToWebInputModeLookup.find(webInputMode.toLower());
if (webInputModeItr != stringToWebInputModeLookup.end()) {
_inputMode = webInputModeItr.value();
_inputModeChanged = true;
}
}
QHash<QString, GizmoType> stringToGizmoTypeLookup;
void addGizmoType(GizmoType mode) {
stringToGizmoTypeLookup[GizmoTypeHelpers::getNameForGizmoType(mode)] = mode;
}
void buildStringToGizmoTypeLookup() {
addGizmoType(GizmoType::RING);
}
QString EntityItemProperties::getGizmoTypeAsString() const {
return GizmoTypeHelpers::getNameForGizmoType(_gizmoType);
}
void EntityItemProperties::setGizmoTypeFromString(const QString& gizmoType) {
if (stringToGizmoTypeLookup.empty()) {
buildStringToGizmoTypeLookup();
}
auto gizmoTypeItr = stringToGizmoTypeLookup.find(gizmoType.toLower());
if (gizmoTypeItr != stringToGizmoTypeLookup.end()) {
_gizmoType = gizmoTypeItr.value();
_gizmoTypeChanged = true;
}
}
EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
EntityPropertyFlags changedProperties;

View file

@ -67,13 +67,6 @@
const quint64 UNKNOWN_CREATED_TIME = 0;
using ComponentPair = std::pair<const ComponentMode, const QString>;
const std::array<ComponentPair, COMPONENT_MODE_ITEM_COUNT> COMPONENT_MODES = { {
ComponentPair { COMPONENT_MODE_INHERIT, { "inherit" } },
ComponentPair { COMPONENT_MODE_DISABLED, { "disabled" } },
ComponentPair { COMPONENT_MODE_ENABLED, { "enabled" } }
} };
using vec3Color = glm::vec3;
using u8vec3Color = glm::u8vec3;
@ -400,8 +393,6 @@ public:
static QString getComponentModeAsString(uint32_t mode);
std::array<ComponentPair, COMPONENT_MODE_ITEM_COUNT>::const_iterator findComponent(const QString& mode);
public:
float getMaxDimension() const { return glm::compMax(_dimensions); }

View file

@ -869,6 +869,8 @@ void LimitedNodeList::removeSilentNodes() {
QSet<SharedNodePointer> killedNodes;
auto startedAt = usecTimestampNow();
eachNodeHashIterator([&](NodeHash::iterator& it){
SharedNodePointer node = it->second;
node->getMutex().lock();
@ -889,7 +891,15 @@ void LimitedNodeList::removeSilentNodes() {
});
foreach(const SharedNodePointer& killedNode, killedNodes) {
qCDebug(networking_ice) << "Removing silent node" << killedNode;
auto now = usecTimestampNow();
qCDebug(networking_ice) << "Removing silent node" << *killedNode << "\n"
<< " Now: " << now << "\n"
<< " Started at: " << startedAt << " (" << (now - startedAt) << "us ago)\n"
<< " Last Heard Microstamp: " << killedNode->getLastHeardMicrostamp() << " (" << (now - killedNode->getLastHeardMicrostamp()) << "us ago)\n"
<< " Forced Never Silent: " << killedNode->isForcedNeverSilent() << "\n"
<< " Inbound PPS: " << killedNode->getInboundPPS() << "\n"
<< " Inbound Kbps: " << killedNode->getInboundKbps() << "\n"
<< " Ping: " << killedNode->getPingMs();
handleNodeKill(killedNode);
}
}

View file

@ -222,7 +222,7 @@ void evalFragShadingGloss(out vec3 diffuse, out vec3 specular,
}
vec3 evalSpecularWithOpacity(vec3 specular, float opacity) {
return specular / opacity;
return specular / mix(1.0, opacity, float(opacity > 0.0));
}
<@if not GETFRESNEL0@>

View file

@ -76,8 +76,10 @@ QScriptValue ArrayBufferClass::newInstance(qint32 size) {
engine()->evaluate("throw \"ArgumentError: absurd length\"");
return QScriptValue();
}
// We've patched qt to fix https://highfidelity.atlassian.net/browse/BUGZ-46 on mac and windows only.
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
engine()->reportAdditionalMemoryCost(size);
#endif
QScriptEngine* eng = engine();
QVariant variant = QVariant::fromValue(QByteArray(size, 0));
QScriptValue data = eng->newVariant(variant);

View file

@ -1346,7 +1346,10 @@ void ScriptEngine::callAnimationStateHandler(QScriptValue callback, AnimVariantM
void ScriptEngine::updateMemoryCost(const qint64& deltaSize) {
if (deltaSize > 0) {
// We've patched qt to fix https://highfidelity.atlassian.net/browse/BUGZ-46 on mac and windows only.
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
reportAdditionalMemoryCost(deltaSize);
#endif
}
}

View file

@ -0,0 +1,37 @@
//
// Created by Sam Gondelman on 5/31/19
// Copyright 2019 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "ComponentMode.h"
const char* componentModeNames[] = {
"inherit",
"disabled",
"enabled"
};
QString ComponentModeHelpers::getNameForComponentMode(ComponentMode mode) {
if (((int)mode <= 0) || ((int)mode >= (int)COMPONENT_MODE_ITEM_COUNT)) {
mode = (ComponentMode)0;
}
return componentModeNames[(int)mode];
}
const char* avatarPriorityModeNames[] = {
"inherit",
"crowd",
"hero"
};
QString AvatarPriorityModeHelpers::getNameForAvatarPriorityMode(AvatarPriorityMode mode) {
if (((int)mode <= 0) || ((int)mode >= (int)AVATAR_PRIORITY_ITEM_COUNT)) {
mode = (AvatarPriorityMode)0;
}
return avatarPriorityModeNames[(int)mode];
}

View file

@ -12,6 +12,8 @@
#ifndef hifi_ComponentMode_h
#define hifi_ComponentMode_h
#include <QString>
enum ComponentMode {
COMPONENT_MODE_INHERIT,
COMPONENT_MODE_DISABLED,
@ -20,5 +22,23 @@ enum ComponentMode {
COMPONENT_MODE_ITEM_COUNT
};
enum AvatarPriorityMode {
AVATAR_PRIORITY_INHERIT,
AVATAR_PRIORITY_CROWD,
AVATAR_PRIORITY_HERO,
AVATAR_PRIORITY_ITEM_COUNT
};
class ComponentModeHelpers {
public:
static QString getNameForComponentMode(ComponentMode mode);
};
class AvatarPriorityModeHelpers {
public:
static QString getNameForAvatarPriorityMode(AvatarPriorityMode mode);
};
#endif // hifi_ComponentMode_h

View file

@ -98,7 +98,7 @@ function onAvatarAppClosed() {
var AVATAR_APP_QML_PATH = Script.resourcesPath() + "qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml";
var AVATAR_APP_WINDOW_TITLE = "Your Avatars";
var AVATAR_APP_WINDOW_TITLE = "Your Profile";
var AVATAR_APP_PRESENTATION_MODE = Desktop.PresentationMode.NATIVE;
var AVATAR_APP_WIDTH_PX = 480;
var AVATAR_APP_HEIGHT_PX = 615;

View file

@ -1,7 +1,8 @@
# General
This document describes the process to build Qt 5.12.3.
Note that there are two patches. The first (to qfloat16.h) is needed to compile QT 5.12.3 on Visual Studio 2017 due to a bug in Visual Studio (*bitset* will not compile. Note that there is a change in CMakeLists.txt to support this.
Note that there are three patches. The first (to qfloat16.h) is needed to compile QT 5.12.3 on Visual Studio 2017 due to a bug in Visual Studio (*bitset* will not compile. Note that there is a change in CMakeLists.txt to support this.
The second patch is to OpenSL ES audio.
The third is a patch to QScriptEngine to prevent crashes in QScriptEnginePrivate::reportAdditionalMemoryCost, during garbage collection. See https://bugreports.qt.io/browse/QTBUG-76176
## Requirements
### Windows
1. Visual Studio 2017
@ -125,11 +126,12 @@ Also, make sure the directory that you are using to build qt is not deeply neste
* Copy the **patches** folder to qt5
* Copy the **qt5vars.bat** file to qt5
* Apply the two patches to Qt
* Apply the patches to Qt
`cd qt5`
`git apply --ignore-space-change --ignore-whitespace patches/qfloat16.patch`
`git apply --ignore-space-change --ignore-whitespace patches/aec.patch`
`git apply --ignore-space-change --ignore-whitespace patches/qtscript-crash-fix.patch`
`cd ..`
#### Configuring
`mkdir qt5-install`
@ -151,8 +153,8 @@ The *.prl* files have an absolute path that needs to be removed (see http://www.
`find . -name \*.prl -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;`
1. Copy *qt.conf* to *qt5-install\bin*
#### Uploading
Create a tar file called qt5-install-5.12.3-windows.tar.gz from the qt5-install folder
Upload qt5-install-5.12.3-windows.tar.gz to our Amazon S3 hifi-public bucket, under the dependencies/vckpg directory
Create a tar file called qt5-install-5.12.3-windows.tar.gz from the qt5-install folder.
Upload qt5-install-5.12.3-windows.tar.gz to our Amazon S3 hifi-public bucket, under the dependencies/vckpg directory.
Update hifi_vcpkg.py to use this new URL. Additionally, you should make a small change to any file in the hifi/cmake/ports directory to force the re-download of the qt-install.tar.gz during the build process for hifi.
#### Preparing Symbols
Run `python3 prepare-windows-symbols-for-backtrace.py qt5-install` to scan the qt5-install directory for any dlls and pdbs. After running this command the backtrace directory will be created. Zip this directory up, but make sure that all dlls and pdbs are in the root of the zip file, not under a sub-directory. This file can then be uploaded to backtrace here: https://highfidelity.sp.backtrace.io/p/Interface/settings/symbol/upload
@ -161,9 +163,10 @@ Run `python3 prepare-windows-symbols-for-backtrace.py qt5-install` to scan the q
`git clone --recursive git://code.qt.io/qt/qt5.git -b 5.12.3 --single-branch`
* Copy the **patches** folder to qt5
* Apply one patch to Qt
* Apply patches to Qt
`cd qt5`
`git apply --ignore-space-change --ignore-whitespace patches/aec.patch`
`git apply --ignore-space-change --ignore-whitespace patches/qtscript-crash-fix.patch`
`cd ..`
#### Configuring
`mkdir qt5-install`
@ -215,9 +218,10 @@ Run `python3 prepare-windows-symbols-for-backtrace.py qt5-install` to scan the q
git clone --recursive git://code.qt.io/qt/qt5.git -b 5.12.3 --single-branch
* Copy the **patches** folder to qt5
* Apply one patch to Qt
* Apply the patches to Qt
`cd qt5`
`git apply --ignore-space-change --ignore-whitespace patches/aec.patch`
`git apply --ignore-space-change --ignore-whitespace patches/qtscript-crash-fix.patch`
`cd ..`
#### Configuring
`mkdir qt5-install`

View file

@ -0,0 +1,16 @@
diff --git a/qtscript/src/script/api/qscriptengine.cpp b/qtscript/src/script/api/qscriptengine.cpp
index c5f437b..942833e 100644
--- a/qtscript/src/script/api/qscriptengine.cpp
+++ b/qtscript/src/script/api/qscriptengine.cpp
@@ -1332,8 +1332,10 @@ void QScriptEnginePrivate::collectGarbage()
void QScriptEnginePrivate::reportAdditionalMemoryCost(int size)
{
- if (size > 0)
+ if (size > 0) {
+ QScript::APIShim shim(this);
globalData->heap.reportExtraMemoryCost(size);
+ }
}
QScript::TimeoutCheckerProxy *QScriptEnginePrivate::timeoutChecker() const

View file

@ -4,7 +4,7 @@
# usage
# python prepare-windows-symbols-for-backrace.py QT_INSTALL_DIR
#
# QT_BUILD_DIR should be the directory where qt is installed after running `jom install` or `nmake install`
# QT_INSTALL_DIR should be the directory where qt is installed after running `jom install` or `nmake install`
# see hifi/tools/qt-builder/README.md for more info
#