mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 20:34:07 +02:00
fixed conflicts
This commit is contained in:
commit
56838de22d
14 changed files with 148 additions and 71 deletions
|
@ -288,6 +288,7 @@ Rectangle {
|
|||
|
||||
Item {
|
||||
id: outputDeviceButtonContainer
|
||||
visible: false // An experiment. Will you notice?
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: inputDeviceButton.right
|
||||
anchors.leftMargin: 7
|
||||
|
@ -343,6 +344,7 @@ Rectangle {
|
|||
|
||||
Item {
|
||||
id: statusButtonContainer
|
||||
visible: false // An experiment. Will you notice?
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: outputDeviceButtonContainer.right
|
||||
anchors.leftMargin: 8
|
||||
|
|
|
@ -471,9 +471,9 @@ Menu::Menu() {
|
|||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::ComputeBlendshapes, 0, true,
|
||||
DependencyManager::get<ModelBlender>().data(), SLOT(setComputeBlendshapes(bool)));
|
||||
|
||||
action = addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::MeshShaders, 0, false);
|
||||
action = addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::MaterialProceduralShaders, 0, false);
|
||||
connect(action, &QAction::triggered, [action] {
|
||||
MeshPartPayload::enableMeshShaders = action->isChecked();
|
||||
MeshPartPayload::enableMaterialProceduralShaders = action->isChecked();
|
||||
});
|
||||
|
||||
{
|
||||
|
|
|
@ -228,7 +228,7 @@ namespace MenuOption {
|
|||
const QString ForceCoarsePicking = "Force Coarse Picking";
|
||||
const QString ComputeBlendshapes = "Compute Blendshapes";
|
||||
const QString HighlightTransitions = "Highlight Transitions";
|
||||
const QString MeshShaders = "Enable Procedural Materials on Meshes";
|
||||
const QString MaterialProceduralShaders = "Enable Procedural Materials";
|
||||
}
|
||||
|
||||
#endif // hifi_Menu_h
|
||||
|
|
|
@ -103,15 +103,15 @@ void setupPreferences() {
|
|||
preference->setItems(refreshRateProfiles);
|
||||
preferences->addPreference(preference);
|
||||
|
||||
auto getterMeshShaders = []() -> bool {
|
||||
auto getterMaterialProceduralShaders = []() -> bool {
|
||||
auto menu = Menu::getInstance();
|
||||
return menu->isOptionChecked(MenuOption::MeshShaders);
|
||||
return menu->isOptionChecked(MenuOption::MaterialProceduralShaders);
|
||||
};
|
||||
auto setterMeshShaders = [](bool value) {
|
||||
auto setterMaterialProceduralShaders = [](bool value) {
|
||||
auto menu = Menu::getInstance();
|
||||
menu->setIsOptionChecked(MenuOption::MeshShaders, value);
|
||||
menu->setIsOptionChecked(MenuOption::MaterialProceduralShaders, value);
|
||||
};
|
||||
preferences->addPreference(new CheckPreference(GRAPHICS_QUALITY, "Enable Procedural Materials on Meshes", getterMeshShaders, setterMeshShaders));
|
||||
preferences->addPreference(new CheckPreference(GRAPHICS_QUALITY, "Enable Procedural Materials", getterMaterialProceduralShaders, setterMaterialProceduralShaders));
|
||||
}
|
||||
{
|
||||
// Expose the Viewport Resolution Scale
|
||||
|
|
|
@ -14,7 +14,16 @@
|
|||
#include <QFileInfo>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QTime>
|
||||
|
||||
|
||||
void timeDelay() {
|
||||
static const int ONE_SECOND = 1;
|
||||
QTime delayTime = QTime::currentTime().addSecs(ONE_SECOND);
|
||||
while (QTime::currentTime() < delayTime) {
|
||||
qDebug() << "Delaying time";
|
||||
}
|
||||
}
|
||||
LauncherInstaller::LauncherInstaller() {
|
||||
_launcherInstallDir = PathUtils::getLauncherDirectory();
|
||||
_launcherApplicationsDir = PathUtils::getApplicationsDirectory();
|
||||
|
@ -56,8 +65,8 @@ void LauncherInstaller::install() {
|
|||
}
|
||||
|
||||
deleteShortcuts();
|
||||
createShortcuts();
|
||||
deleteApplicationRegistryKeys();
|
||||
createShortcuts();
|
||||
createApplicationRegistryKeys();
|
||||
} else {
|
||||
qDebug() << "Failed to install HQ Launcher";
|
||||
|
@ -67,26 +76,26 @@ void LauncherInstaller::install() {
|
|||
void LauncherInstaller::createShortcuts() {
|
||||
QString launcherPath = PathUtils::getLauncherFilePath();
|
||||
|
||||
QString uninstallLinkPath = _launcherInstallDir.absoluteFilePath("Uninstall HQ.lnk");
|
||||
QString uninstallLinkPath = _launcherInstallDir.absoluteFilePath("Uninstall HQ Launcher.lnk");
|
||||
|
||||
QDir desktopDir = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||
|
||||
QString appStartLinkPath = _launcherApplicationsDir.absoluteFilePath("HQ Launcher.lnk");
|
||||
QString uninstallAppStartLinkPath = _launcherApplicationsDir.absoluteFilePath("Uninstall HQ.lnk");
|
||||
QString uninstallAppStartLinkPath = _launcherApplicationsDir.absoluteFilePath("Uninstall HQ Launcher.lnk");
|
||||
QString desktopAppLinkPath = desktopDir.absoluteFilePath("HQ Launcher.lnk");
|
||||
|
||||
|
||||
createSymbolicLink((LPCSTR)launcherPath.toStdString().c_str(), (LPCSTR)uninstallLinkPath.toStdString().c_str(),
|
||||
(LPCSTR)("Click to Uninstall HQ"), (LPCSTR)("--uninstall"));
|
||||
(LPCSTR)("Click to Uninstall HQ Launcher"), (LPCSTR)("--uninstall"));
|
||||
|
||||
createSymbolicLink((LPCSTR)launcherPath.toStdString().c_str(), (LPCSTR)uninstallAppStartLinkPath.toStdString().c_str(),
|
||||
(LPCSTR)("Click to Uninstall HQ"), (LPCSTR)("--uninstall"));
|
||||
(LPCSTR)("Click to Uninstall HQ Launcher"), (LPCSTR)("--uninstall"));
|
||||
|
||||
createSymbolicLink((LPCSTR)launcherPath.toStdString().c_str(), (LPCSTR)desktopAppLinkPath.toStdString().c_str(),
|
||||
(LPCSTR)("Click to Setup and Launch HQ"));
|
||||
(LPCSTR)("Click to Setup and Launch HQ Launcher"));
|
||||
|
||||
createSymbolicLink((LPCSTR)launcherPath.toStdString().c_str(), (LPCSTR)appStartLinkPath.toStdString().c_str(),
|
||||
(LPCSTR)("Click to Setup and Launch HQ"));
|
||||
(LPCSTR)("Click to Setup and Launch HQ Launcher"));
|
||||
}
|
||||
|
||||
QString randomQtString() {
|
||||
|
@ -141,20 +150,42 @@ void LauncherInstaller::uninstall() {
|
|||
qDebug() << "Failed to complete uninstall launcher";
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
|
||||
bool deletedHQLauncherExe = deleteHQLauncherExecutable();
|
||||
if (deletedHQLauncherExe) {
|
||||
qDebug() << "Deleteing registry keys";
|
||||
deleteApplicationRegistryKeys();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool LauncherInstaller::deleteHQLauncherExecutable() {
|
||||
static const int MAX_DELETE_ATTEMPTS = 3;
|
||||
|
||||
int deleteAttempts = 0;
|
||||
bool fileRemoved = false;
|
||||
QString launcherPath = _launcherInstallDir.absoluteFilePath("HQ Launcher.exe");
|
||||
if (QFile::exists(launcherPath)) {
|
||||
bool removed = QFile::remove(launcherPath);
|
||||
qDebug() << "Successfully removed " << launcherPath << ": " << removed;
|
||||
while (deleteAttempts < MAX_DELETE_ATTEMPTS) {
|
||||
fileRemoved = QFile::remove(launcherPath);
|
||||
if (fileRemoved) {
|
||||
break;
|
||||
}
|
||||
|
||||
timeDelay();
|
||||
deleteAttempts++;
|
||||
}
|
||||
deleteApplicationRegistryKeys();
|
||||
|
||||
qDebug() << "Successfully removed " << launcherPath << ": " << fileRemoved;
|
||||
|
||||
return fileRemoved;
|
||||
}
|
||||
|
||||
void LauncherInstaller::deleteShortcuts() {
|
||||
QDir desktopDir = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||
QString applicationPath = _launcherApplicationsDir.absolutePath();
|
||||
|
||||
QString uninstallLinkPath = _launcherInstallDir.absoluteFilePath("Uninstall HQ.lnk");
|
||||
QString uninstallLinkPath = _launcherInstallDir.absoluteFilePath("Uninstall HQ Launcher.lnk");
|
||||
if (QFile::exists(uninstallLinkPath)) {
|
||||
QFile::remove(uninstallLinkPath);
|
||||
}
|
||||
|
@ -164,7 +195,7 @@ void LauncherInstaller::deleteShortcuts() {
|
|||
QFile::remove(appStartLinkPath);
|
||||
}
|
||||
|
||||
QString uninstallAppStartLinkPath = _launcherApplicationsDir.absoluteFilePath("Uninstall HQ.lnk");
|
||||
QString uninstallAppStartLinkPath = _launcherApplicationsDir.absoluteFilePath("Uninstall HQ Launcher.lnk");
|
||||
if (QFile::exists(uninstallAppStartLinkPath)) {
|
||||
QFile::remove(uninstallAppStartLinkPath);
|
||||
}
|
||||
|
@ -212,7 +243,7 @@ void LauncherInstaller::uninstallOldLauncher() {
|
|||
|
||||
void LauncherInstaller::createApplicationRegistryKeys() {
|
||||
const std::string REGISTRY_PATH = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\HQ";
|
||||
bool success = insertRegistryKey(REGISTRY_PATH, "DisplayName", "HQ");
|
||||
bool success = insertRegistryKey(REGISTRY_PATH, "DisplayName", "HQ Launcher");
|
||||
std::string installPath = _launcherInstallDir.absolutePath().replace("/", "\\").toStdString();
|
||||
success = insertRegistryKey(REGISTRY_PATH, "InstallLocation", installPath);
|
||||
std::string applicationExe = installPath + "\\HQ Launcher.exe";
|
||||
|
|
|
@ -15,6 +15,7 @@ private:
|
|||
void createApplicationRegistryKeys();
|
||||
void deleteShortcuts();
|
||||
void deleteApplicationRegistryKeys();
|
||||
bool deleteHQLauncherExecutable();
|
||||
|
||||
QDir _launcherInstallDir;
|
||||
QDir _launcherApplicationsDir;
|
||||
|
|
|
@ -28,7 +28,7 @@ QDir PathUtils::getLauncherDirectory() {
|
|||
}
|
||||
|
||||
QDir PathUtils::getApplicationsDirectory() {
|
||||
return QDir(QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)).absoluteFilePath("Launcher");
|
||||
return QDir(QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)).absoluteFilePath("HQ");
|
||||
}
|
||||
|
||||
// The client directory is where interface is installed to.
|
||||
|
|
|
@ -32,7 +32,7 @@ bool hasSuffix(const std::string& path, const std::string& suffix) {
|
|||
int main(int argc, char *argv[]) {
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setOrganizationName("High Fidelity");
|
||||
QCoreApplication::setApplicationName("Launcher");
|
||||
QCoreApplication::setApplicationName("HQ Launcher");
|
||||
|
||||
Q_INIT_RESOURCE(resources);
|
||||
cleanLogFile();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
//
|
||||
// MaterialCacheScriptingInterface.cpp
|
||||
// libraries/mmodel-networking/src/model-networking
|
||||
//
|
||||
// Created by Sam Gateau on 17 September 2019.
|
||||
// Copyright 2019 High Fidelity, Inc.
|
|
@ -1,6 +1,5 @@
|
|||
//
|
||||
// MaterialCacheScriptingInterface.h
|
||||
// libraries/material-networking/src/material-networking
|
||||
// ProceduralMaterialCacheScriptingInterface.h
|
||||
//
|
||||
// Created by Sam Gateau on 17 September 2019.
|
||||
// Copyright 2019 High Fidelity, Inc.
|
||||
|
@ -10,14 +9,14 @@
|
|||
//
|
||||
#pragma once
|
||||
|
||||
#ifndef hifi_MaterialCacheScriptingInterface_h
|
||||
#define hifi_MaterialCacheScriptingInterface_h
|
||||
#ifndef hifi_ProceduralMaterialCacheScriptingInterface_h
|
||||
#define hifi_ProceduralMaterialCacheScriptingInterface_h
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <ResourceCache.h>
|
||||
|
||||
#include "MaterialCache.h"
|
||||
#include "ProceduralMaterialCache.h"
|
||||
|
||||
class MaterialCacheScriptingInterface : public ScriptableResourceCache, public Dependency {
|
||||
Q_OBJECT
|
||||
|
@ -27,7 +26,7 @@ class MaterialCacheScriptingInterface : public ScriptableResourceCache, public D
|
|||
/**jsdoc
|
||||
* The <code>TextureCache</code> API manages texture cache resources.
|
||||
*
|
||||
* @namespace TextureCache
|
||||
* @namespace MaterialCache
|
||||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
|
@ -48,4 +47,4 @@ public:
|
|||
MaterialCacheScriptingInterface();
|
||||
};
|
||||
|
||||
#endif // hifi_MaterialCacheScriptingInterface_h
|
||||
#endif // hifi_ProceduralMaterialCacheScriptingInterface_h
|
|
@ -5,7 +5,7 @@
|
|||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#include "MaterialCache.h"
|
||||
#include "ProceduralMaterialCache.h"
|
||||
|
||||
#include "QJsonObject"
|
||||
#include "QJsonDocument"
|
||||
|
@ -13,6 +13,8 @@
|
|||
|
||||
#include "RegisteredMetaTypes.h"
|
||||
|
||||
#include "Procedural.h"
|
||||
|
||||
NetworkMaterialResource::NetworkMaterialResource(const QUrl& url) :
|
||||
Resource(url) {}
|
||||
|
||||
|
@ -112,20 +114,22 @@ NetworkMaterialResource::ParsedMaterials NetworkMaterialResource::parseJSONMater
|
|||
* A material used in a {@link Entities.MaterialResource|MaterialResource}.
|
||||
* @typedef {object} Entities.Material
|
||||
* @property {string} model="hifi_pbr" - Different material models support different properties and rendering modes.
|
||||
* Supported models are: <code>"hifi_pbr"</code>.
|
||||
* Supported models are: <code>"hifi_pbr"</code>, <code>"hifi_shader_simple"</code>.
|
||||
* @property {string} name="" - A name for the material. Supported by all material models.
|
||||
* @property {ColorFloat|RGBS|string} emissive - The emissive color, i.e., the color that the material emits. A
|
||||
* {@link ColorFloat} value is treated as sRGB and must have component values in the range <code>0.0</code> –
|
||||
* <code>1.0</code>. A {@link RGBS} value can be either RGB or sRGB.
|
||||
* Set to <code>"fallthrough"</code> to fall through to the material below. <code>"hifi_pbr"</code> model only.
|
||||
* @property {number|string} opacity=1.0 - The opacity, range <code>0.0</code> – <code>1.0</code>.
|
||||
* Set to <code>"fallthrough"</code> to fall through to the material below. <code>"hifi_pbr"</code> model only.
|
||||
* @property {number|string} opacity=1.0 - The opacity, range <code>0.0</code> – <code>1.0</code>.
|
||||
* Set to <code>"fallthrough"</code> to fall through to the material below. <code>"hifi_pbr"</code> and
|
||||
* <code>"hifi_shader_simple"</code> models only.
|
||||
* @property {boolean|string} unlit=false - <code>true</code> if the material is unaffected by lighting, <code>false</code> if
|
||||
* it is lit by the key light and local lights.
|
||||
* Set to <code>"fallthrough"</code> to fall through to the material below. <code>"hifi_pbr"</code> model only.
|
||||
* @property {ColorFloat|RGBS|string} albedo - The albedo color. A {@link ColorFloat} value is treated as sRGB and must have
|
||||
* component values in the range <code>0.0</code> – <code>1.0</code>. A {@link RGBS} value can be either RGB or sRGB.
|
||||
* Set to <code>"fallthrough"</code> to fall through to the material below. <code>"hifi_pbr"</code> model only.
|
||||
* @property {ColorFloat|RGBS|string} albedo - The albedo color. A {@link ColorFloat} value is treated as sRGB and must have
|
||||
* component values in the range <code>0.0</code> – <code>1.0</code>. A {@link RGBS} value can be either RGB or sRGB.
|
||||
* Set to <code>"fallthrough"</code> to fall through to the material below. <code>"hifi_pbr"</code> and
|
||||
* <code>"hifi_shader_simple"</code> models only.
|
||||
* @property {number|string} roughness - The roughness, range <code>0.0</code> – <code>1.0</code>.
|
||||
* Set to <code>"fallthrough"</code> to fall through to the material below. <code>"hifi_pbr"</code> model only.
|
||||
* @property {number|string} metallic - The metallicness, range <code>0.0</code> – <code>1.0</code>.
|
||||
|
@ -183,25 +187,25 @@ NetworkMaterialResource::ParsedMaterials NetworkMaterialResource::parseJSONMater
|
|||
* <p><em>Currently not used.</em></p>
|
||||
* @property {boolean} defaultFallthrough=false - <code>true</code> if all properties fall through to the material below
|
||||
* unless they are set, <code>false</code> if properties respect their individual fall-through settings.
|
||||
* <code>"hifi_pbr"</code> model only.
|
||||
* <code>"hifi_pbr"</code> and <code>"hifi_shader_simple"</code> models only.
|
||||
* @property {ProceduralData} procedural - The definition of a procedural shader material. <code>"hifi_shader_simple"</code> model only.
|
||||
*/
|
||||
// Note: See MaterialEntityItem.h for default values used in practice.
|
||||
std::pair<std::string, std::shared_ptr<NetworkMaterial>> NetworkMaterialResource::parseJSONMaterial(const QJsonObject& materialJSON, const QUrl& baseUrl) {
|
||||
std::string name = "";
|
||||
std::shared_ptr<NetworkMaterial> material = std::make_shared<NetworkMaterial>();
|
||||
std::shared_ptr<NetworkMaterial> networkMaterial;
|
||||
|
||||
const std::string HIFI_PBR = "hifi_pbr";
|
||||
std::string modelString = HIFI_PBR;
|
||||
std::string modelString = graphics::Material::HIFI_PBR;
|
||||
auto modelJSONIter = materialJSON.find("model");
|
||||
if (modelJSONIter != materialJSON.end() && modelJSONIter.value().isString()) {
|
||||
modelString = modelJSONIter.value().toString().toStdString();
|
||||
material->setModel(modelString);
|
||||
}
|
||||
|
||||
std::array<glm::mat4, graphics::Material::NUM_TEXCOORD_TRANSFORMS> texcoordTransforms;
|
||||
|
||||
if (modelString == HIFI_PBR) {
|
||||
const QString FALLTHROUGH("fallthrough");
|
||||
const QString FALLTHROUGH("fallthrough");
|
||||
if (modelString == graphics::Material::HIFI_PBR) {
|
||||
auto material = std::make_shared<NetworkMaterial>();
|
||||
for (auto& key : materialJSON.keys()) {
|
||||
if (key == "name") {
|
||||
auto nameJSON = materialJSON.value(key);
|
||||
|
@ -209,11 +213,6 @@ std::pair<std::string, std::shared_ptr<NetworkMaterial>> NetworkMaterialResource
|
|||
name = nameJSON.toString().toStdString();
|
||||
material->setName(name);
|
||||
}
|
||||
} else if (key == "model") {
|
||||
auto modelJSON = materialJSON.value(key);
|
||||
if (modelJSON.isString()) {
|
||||
material->setModel(modelJSON.toString().toStdString());
|
||||
}
|
||||
} else if (key == "emissive") {
|
||||
auto value = materialJSON.value(key);
|
||||
if (value.isString() && value.toString() == FALLTHROUGH) {
|
||||
|
@ -268,13 +267,15 @@ std::pair<std::string, std::shared_ptr<NetworkMaterial>> NetworkMaterialResource
|
|||
}
|
||||
} else if (key == "opacityMapMode") {
|
||||
auto value = materialJSON.value(key);
|
||||
auto valueString = (value.isString() ? value.toString() : "");
|
||||
if (valueString == FALLTHROUGH) {
|
||||
material->setPropertyDoesFallthrough(graphics::MaterialKey::FlagBit::OPACITY_MAP_MODE_BIT);
|
||||
} else {
|
||||
graphics::MaterialKey::OpacityMapMode mode;
|
||||
if (graphics::MaterialKey::getOpacityMapModeFromName(valueString.toStdString(), mode)) {
|
||||
material->setOpacityMapMode(mode);
|
||||
if (value.isString()) {
|
||||
auto valueString = value.toString();
|
||||
if (valueString == FALLTHROUGH) {
|
||||
material->setPropertyDoesFallthrough(graphics::MaterialKey::FlagBit::OPACITY_MAP_MODE_BIT);
|
||||
} else {
|
||||
graphics::MaterialKey::OpacityMapMode mode;
|
||||
if (graphics::MaterialKey::getOpacityMapModeFromName(valueString.toStdString(), mode)) {
|
||||
material->setOpacityMapMode(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (key == "opacityCutoff") {
|
||||
|
@ -455,17 +456,61 @@ std::pair<std::string, std::shared_ptr<NetworkMaterial>> NetworkMaterialResource
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do this after the texture maps are defined, so it overrides the default transforms
|
||||
for (int i = 0; i < graphics::Material::NUM_TEXCOORD_TRANSFORMS; i++) {
|
||||
mat4 newTransform = texcoordTransforms[i];
|
||||
if (newTransform != mat4() || newTransform != material->getTexCoordTransform(i)) {
|
||||
material->setTexCoordTransform(i, newTransform);
|
||||
// Do this after the texture maps are defined, so it overrides the default transforms
|
||||
for (int i = 0; i < graphics::Material::NUM_TEXCOORD_TRANSFORMS; i++) {
|
||||
mat4 newTransform = texcoordTransforms[i];
|
||||
if (newTransform != mat4() || newTransform != material->getTexCoordTransform(i)) {
|
||||
material->setTexCoordTransform(i, newTransform);
|
||||
}
|
||||
}
|
||||
networkMaterial = material;
|
||||
} else if (modelString == graphics::Material::HIFI_SHADER_SIMPLE) {
|
||||
auto material = std::make_shared<graphics::ProceduralMaterial>();
|
||||
for (auto& key : materialJSON.keys()) {
|
||||
if (key == "name") {
|
||||
auto nameJSON = materialJSON.value(key);
|
||||
if (nameJSON.isString()) {
|
||||
name = nameJSON.toString().toStdString();
|
||||
material->setName(name);
|
||||
}
|
||||
} else if (key == "opacity") {
|
||||
auto value = materialJSON.value(key);
|
||||
if (value.isString() && value.toString() == FALLTHROUGH) {
|
||||
material->setPropertyDoesFallthrough(graphics::MaterialKey::FlagBit::OPACITY_VAL_BIT);
|
||||
} else if (value.isDouble()) {
|
||||
material->setOpacity(value.toDouble());
|
||||
}
|
||||
} else if (key == "albedo") {
|
||||
auto value = materialJSON.value(key);
|
||||
if (value.isString() && value.toString() == FALLTHROUGH) {
|
||||
material->setPropertyDoesFallthrough(graphics::MaterialKey::FlagBit::ALBEDO_VAL_BIT);
|
||||
} else {
|
||||
glm::vec3 color;
|
||||
bool isSRGB;
|
||||
bool valid = parseJSONColor(value, color, isSRGB);
|
||||
if (valid) {
|
||||
material->setAlbedo(color, isSRGB);
|
||||
}
|
||||
}
|
||||
} else if (key == "defaultFallthrough") {
|
||||
auto value = materialJSON.value(key);
|
||||
if (value.isBool()) {
|
||||
material->setDefaultFallthrough(value.toBool());
|
||||
}
|
||||
} else if (key == "procedural") {
|
||||
auto value = materialJSON.value(key);
|
||||
material->setProceduralData(QJsonDocument::fromVariant(value.toVariant()).toJson());
|
||||
}
|
||||
}
|
||||
networkMaterial = material;
|
||||
}
|
||||
|
||||
return std::pair<std::string, std::shared_ptr<NetworkMaterial>>(name, material);
|
||||
if (networkMaterial) {
|
||||
networkMaterial->setModel(modelString);
|
||||
}
|
||||
|
||||
return std::pair<std::string, std::shared_ptr<NetworkMaterial>>(name, networkMaterial);
|
||||
}
|
||||
|
||||
NetworkMaterialResourcePointer MaterialCache::getMaterial(const QUrl& url) {
|
|
@ -14,7 +14,7 @@
|
|||
#include <graphics/Material.h>
|
||||
#include <hfm/HFM.h>
|
||||
|
||||
#include "TextureCache.h"
|
||||
#include <material-networking/TextureCache.h>
|
||||
|
||||
class NetworkMaterial : public graphics::Material {
|
||||
public:
|
|
@ -23,10 +23,10 @@
|
|||
|
||||
#include "RenderPipelines.h"
|
||||
|
||||
static const QString ENABLE_MESH_SHADERS_STRING { "HIFI_ENABLE_MESH_SHADERS" };
|
||||
static bool ENABLE_MESH_SHADERS = QProcessEnvironment::systemEnvironment().contains(ENABLE_MESH_SHADERS_STRING);
|
||||
static const QString ENABLE_MATERIAL_PROCEDURAL_SHADERS_STRING { "HIFI_ENABLE_MATERIAL_PROCEDURAL_SHADERS" };
|
||||
static bool ENABLE_MATERIAL_PROCEDURAL_SHADERS = QProcessEnvironment::systemEnvironment().contains(ENABLE_MATERIAL_PROCEDURAL_SHADERS_STRING);
|
||||
|
||||
bool MeshPartPayload::enableMeshShaders = false;
|
||||
bool MeshPartPayload::enableMaterialProceduralShaders = false;
|
||||
|
||||
using namespace render;
|
||||
|
||||
|
@ -471,7 +471,7 @@ void ModelMeshPartPayload::render(RenderArgs* args) {
|
|||
|
||||
if (!_drawMaterials.empty() && _drawMaterials.top().material && _drawMaterials.top().material->isProcedural() &&
|
||||
_drawMaterials.top().material->isReady()) {
|
||||
if (!(enableMeshShaders && ENABLE_MESH_SHADERS)) {
|
||||
if (!(enableMaterialProceduralShaders && ENABLE_MATERIAL_PROCEDURAL_SHADERS)) {
|
||||
return;
|
||||
}
|
||||
auto procedural = std::static_pointer_cast<graphics::ProceduralMaterial>(_drawMaterials.top().material);
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
void addMaterial(graphics::MaterialLayer material);
|
||||
void removeMaterial(graphics::MaterialPointer material);
|
||||
|
||||
static bool enableMeshShaders;
|
||||
static bool enableMaterialProceduralShaders;
|
||||
|
||||
protected:
|
||||
render::ItemKey _itemKey{ render::ItemKey::Builder::opaqueShape().build() };
|
||||
|
|
Loading…
Reference in a new issue