mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 17:03:58 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into near-grab-via-parenting
This commit is contained in:
commit
76df582a6c
24 changed files with 488 additions and 362 deletions
103
examples/controllers/reticleHandRotationTest.js
Normal file
103
examples/controllers/reticleHandRotationTest.js
Normal file
|
@ -0,0 +1,103 @@
|
|||
//
|
||||
// reticleHandRotationTest.js
|
||||
// examples/controllers
|
||||
//
|
||||
// Created by Brad Hefta-Gaub on 2015/12/15
|
||||
// Copyright 2015 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
|
||||
//
|
||||
|
||||
Math.clamp=function(a,b,c) {
|
||||
return Math.max(b,Math.min(c,a));
|
||||
}
|
||||
|
||||
var whichHand = Controller.Standard.RightHand;
|
||||
var whichTrigger = Controller.Standard.RT;
|
||||
|
||||
function length(posA, posB) {
|
||||
var dx = posA.x - posB.x;
|
||||
var dy = posA.y - posB.y;
|
||||
var length = Math.sqrt((dx*dx) + (dy*dy))
|
||||
return length;
|
||||
}
|
||||
|
||||
var EXPECTED_CHANGE = 50;
|
||||
var lastPos = Controller.getReticlePosition();
|
||||
function moveReticleAbsolute(x, y) {
|
||||
var globalPos = Controller.getReticlePosition();
|
||||
var dX = x - globalPos.x;
|
||||
var dY = y - globalPos.y;
|
||||
|
||||
// some debugging to see if position is jumping around on us...
|
||||
var distanceSinceLastMove = length(lastPos, globalPos);
|
||||
if (distanceSinceLastMove > EXPECTED_CHANGE) {
|
||||
print("------------------ distanceSinceLastMove:" + distanceSinceLastMove + "----------------------------");
|
||||
}
|
||||
|
||||
if (Math.abs(dX) > EXPECTED_CHANGE) {
|
||||
print("surpressing unexpectedly large change dX:" + dX + "----------------------------");
|
||||
}
|
||||
if (Math.abs(dY) > EXPECTED_CHANGE) {
|
||||
print("surpressing unexpectedly large change dY:" + dY + "----------------------------");
|
||||
}
|
||||
|
||||
globalPos.x = x;
|
||||
globalPos.y = y;
|
||||
Controller.setReticlePosition(globalPos);
|
||||
lastPos = globalPos;
|
||||
}
|
||||
|
||||
|
||||
var MAPPING_NAME = "com.highfidelity.testing.reticleWithHandRotation";
|
||||
var mapping = Controller.newMapping(MAPPING_NAME);
|
||||
mapping.from(whichTrigger).peek().constrainToInteger().to(Controller.Actions.ReticleClick);
|
||||
mapping.from(whichHand).peek().to(function(pose) {
|
||||
|
||||
// NOTE: hack for now
|
||||
var screenSizeX = 1920;
|
||||
var screenSizeY = 1080;
|
||||
|
||||
var rotated = Vec3.multiplyQbyV(pose.rotation, Vec3.UNIT_NEG_Y); //
|
||||
var absolutePitch = rotated.y; // from 1 down to -1 up ... but note: if you rotate down "too far" it starts to go up again...
|
||||
var absoluteYaw = rotated.z; // from -1 left to 1 right
|
||||
//print("absolutePitch:" + absolutePitch);
|
||||
//print("absoluteYaw:" + absoluteYaw);
|
||||
//Vec3.print("rotated:", rotated);
|
||||
|
||||
var ROTATION_BOUND = 0.6;
|
||||
var clampYaw = Math.clamp(absoluteYaw, -ROTATION_BOUND, ROTATION_BOUND);
|
||||
var clampPitch = Math.clamp(absolutePitch, -ROTATION_BOUND, ROTATION_BOUND);
|
||||
//var clampYaw = absoluteYaw;
|
||||
//print("clampYaw:" + clampYaw);
|
||||
//print("clampPitch:" + clampPitch);
|
||||
|
||||
// if using entire span...
|
||||
//var xRatio = (absoluteYaw + 1) / 2;
|
||||
//var yRatio = (absolutePitch + 1) / 2;
|
||||
|
||||
// if using only from -0.5 to 0.5
|
||||
var xRatio = (clampYaw + ROTATION_BOUND) / (2 * ROTATION_BOUND);
|
||||
var yRatio = (clampPitch + ROTATION_BOUND) / (2 * ROTATION_BOUND);
|
||||
|
||||
//print("xRatio:" + xRatio);
|
||||
//print("yRatio:" + yRatio);
|
||||
|
||||
//print("ratio x:" + xRatio + " y:" + yRatio);
|
||||
|
||||
var x = screenSizeX * xRatio;
|
||||
var y = screenSizeY * yRatio;
|
||||
|
||||
//print("position x:" + x + " y:" + y);
|
||||
if (!(xRatio == 0.5 && yRatio == 0)) {
|
||||
moveReticleAbsolute(x, y);
|
||||
}
|
||||
});
|
||||
mapping.enable();
|
||||
|
||||
Script.scriptEnding.connect(function(){
|
||||
mapping.disable();
|
||||
});
|
||||
|
||||
|
|
@ -50,46 +50,46 @@ function CounterWidget(parentPanel, name, feedGetter, drawGetter, capSetter, cap
|
|||
};
|
||||
|
||||
var opaquesCounter = new CounterWidget(panel, "Opaques",
|
||||
function () { return Scene.getEngineNumFeedOpaqueItems(); },
|
||||
function () { return Scene.getEngineNumDrawnOpaqueItems(); },
|
||||
function(value) { Scene.setEngineMaxDrawnOpaqueItems(value); },
|
||||
function () { return Scene.getEngineMaxDrawnOpaqueItems(); }
|
||||
function () { return Render.getEngineNumFeedOpaqueItems(); },
|
||||
function () { return Render.getEngineNumDrawnOpaqueItems(); },
|
||||
function(value) { Render.setEngineMaxDrawnOpaqueItems(value); },
|
||||
function () { return Render.getEngineMaxDrawnOpaqueItems(); }
|
||||
);
|
||||
|
||||
var transparentsCounter = new CounterWidget(panel, "Transparents",
|
||||
function () { return Scene.getEngineNumFeedTransparentItems(); },
|
||||
function () { return Scene.getEngineNumDrawnTransparentItems(); },
|
||||
function(value) { Scene.setEngineMaxDrawnTransparentItems(value); },
|
||||
function () { return Scene.getEngineMaxDrawnTransparentItems(); }
|
||||
function () { return Render.getEngineNumFeedTransparentItems(); },
|
||||
function () { return Render.getEngineNumDrawnTransparentItems(); },
|
||||
function(value) { Render.setEngineMaxDrawnTransparentItems(value); },
|
||||
function () { return Render.getEngineMaxDrawnTransparentItems(); }
|
||||
);
|
||||
|
||||
var overlaysCounter = new CounterWidget(panel, "Overlays",
|
||||
function () { return Scene.getEngineNumFeedOverlay3DItems(); },
|
||||
function () { return Scene.getEngineNumDrawnOverlay3DItems(); },
|
||||
function(value) { Scene.setEngineMaxDrawnOverlay3DItems(value); },
|
||||
function () { return Scene.getEngineMaxDrawnOverlay3DItems(); }
|
||||
function () { return Render.getEngineNumFeedOverlay3DItems(); },
|
||||
function () { return Render.getEngineNumDrawnOverlay3DItems(); },
|
||||
function(value) { Render.setEngineMaxDrawnOverlay3DItems(value); },
|
||||
function () { return Render.getEngineMaxDrawnOverlay3DItems(); }
|
||||
);
|
||||
|
||||
var resizing = false;
|
||||
var previousMode = Settings.getValue(SETTINGS_KEY, -1);
|
||||
Menu.addActionGroup(MENU, ACTIONS, ACTIONS[previousMode + 1]);
|
||||
Scene.setEngineDeferredDebugMode(previousMode);
|
||||
Scene.setEngineDeferredDebugSize({ x: 0.0, y: -1.0, z: 1.0, w: 1.0 }); // Reset to default size
|
||||
Render.setEngineDeferredDebugMode(previousMode);
|
||||
Render.setEngineDeferredDebugSize({ x: 0.0, y: -1.0, z: 1.0, w: 1.0 }); // Reset to default size
|
||||
|
||||
function setEngineDeferredDebugSize(eventX) {
|
||||
var scaledX = (2.0 * (eventX / Window.innerWidth) - 1.0).clamp(-1.0, 1.0);
|
||||
Scene.setEngineDeferredDebugSize({ x: scaledX, y: -1.0, z: 1.0, w: 1.0 });
|
||||
Render.setEngineDeferredDebugSize({ x: scaledX, y: -1.0, z: 1.0, w: 1.0 });
|
||||
}
|
||||
function shouldStartResizing(eventX) {
|
||||
var x = Math.abs(eventX - Window.innerWidth * (1.0 + Scene.getEngineDeferredDebugSize().x) / 2.0);
|
||||
var mode = Scene.getEngineDeferredDebugMode();
|
||||
var x = Math.abs(eventX - Window.innerWidth * (1.0 + Render.getEngineDeferredDebugSize().x) / 2.0);
|
||||
var mode = Render.getEngineDeferredDebugMode();
|
||||
return mode !== -1 && x < 20;
|
||||
}
|
||||
|
||||
function menuItemEvent(menuItem) {
|
||||
var index = ACTIONS.indexOf(menuItem);
|
||||
if (index >= 0) {
|
||||
Scene.setEngineDeferredDebugMode(index - 1);
|
||||
Render.setEngineDeferredDebugMode(index - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,24 +98,24 @@ var showDisplayStatusFlag = 1;
|
|||
var showNetworkStatusFlag = 2;
|
||||
|
||||
panel.newCheckbox("Display status",
|
||||
function(value) { Scene.setEngineDisplayItemStatus(value ?
|
||||
Scene.doEngineDisplayItemStatus() | showDisplayStatusFlag :
|
||||
Scene.doEngineDisplayItemStatus() & ~showDisplayStatusFlag); },
|
||||
function() { return (Scene.doEngineDisplayItemStatus() & showDisplayStatusFlag) > 0; },
|
||||
function(value) { Render.setEngineDisplayItemStatus(value ?
|
||||
Render.doEngineDisplayItemStatus() | showDisplayStatusFlag :
|
||||
Render.doEngineDisplayItemStatus() & ~showDisplayStatusFlag); },
|
||||
function() { return (Render.doEngineDisplayItemStatus() & showDisplayStatusFlag) > 0; },
|
||||
function(value) { return (value & showDisplayStatusFlag) > 0; }
|
||||
);
|
||||
|
||||
panel.newCheckbox("Network/Physics status",
|
||||
function(value) { Scene.setEngineDisplayItemStatus(value ?
|
||||
Scene.doEngineDisplayItemStatus() | showNetworkStatusFlag :
|
||||
Scene.doEngineDisplayItemStatus() & ~showNetworkStatusFlag); },
|
||||
function() { return (Scene.doEngineDisplayItemStatus() & showNetworkStatusFlag) > 0; },
|
||||
function(value) { Render.setEngineDisplayItemStatus(value ?
|
||||
Render.doEngineDisplayItemStatus() | showNetworkStatusFlag :
|
||||
Render.doEngineDisplayItemStatus() & ~showNetworkStatusFlag); },
|
||||
function() { return (Render.doEngineDisplayItemStatus() & showNetworkStatusFlag) > 0; },
|
||||
function(value) { return (value & showNetworkStatusFlag) > 0; }
|
||||
);
|
||||
|
||||
panel.newSlider("Tone Mapping Exposure", -10, 10,
|
||||
function (value) { Scene.setEngineToneMappingExposure(value); },
|
||||
function() { return Scene.getEngineToneMappingExposure(); },
|
||||
function (value) { Render.setEngineToneMappingExposure(value); },
|
||||
function() { return Render.getEngineToneMappingExposure(); },
|
||||
function (value) { return (value); });
|
||||
|
||||
var tickTackPeriod = 500;
|
||||
|
@ -160,9 +160,9 @@ Menu.menuItemEvent.connect(menuItemEvent);
|
|||
function scriptEnding() {
|
||||
panel.destroy();
|
||||
Menu.removeActionGroup(MENU);
|
||||
Settings.setValue(SETTINGS_KEY, Scene.getEngineDeferredDebugMode());
|
||||
Scene.setEngineDeferredDebugMode(-1);
|
||||
Scene.setEngineDeferredDebugSize({ x: 0.0, y: -1.0, z: 1.0, w: 1.0 }); // Reset to default size
|
||||
Settings.setValue(SETTINGS_KEY, Render.getEngineDeferredDebugMode());
|
||||
Render.setEngineDeferredDebugMode(-1);
|
||||
Render.setEngineDeferredDebugSize({ x: 0.0, y: -1.0, z: 1.0, w: 1.0 }); // Reset to default size
|
||||
}
|
||||
Script.scriptEnding.connect(scriptEnding);
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@
|
|||
#include <RenderableWebEntityItem.h>
|
||||
#include <RenderDeferredTask.h>
|
||||
#include <ResourceCache.h>
|
||||
#include <RenderScriptingInterface.h>
|
||||
#include <SceneScriptingInterface.h>
|
||||
#include <RecordingScriptingInterface.h>
|
||||
#include <ScriptCache.h>
|
||||
|
@ -342,6 +343,7 @@ bool setupEssentials(int& argc, char** argv) {
|
|||
#endif
|
||||
DependencyManager::set<DiscoverabilityManager>();
|
||||
DependencyManager::set<SceneScriptingInterface>();
|
||||
DependencyManager::set<RenderScriptingInterface>();
|
||||
DependencyManager::set<OffscreenUi>();
|
||||
DependencyManager::set<AutoUpdater>();
|
||||
DependencyManager::set<PathUtils>();
|
||||
|
@ -3718,40 +3720,22 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
|
|||
// For now every frame pass the renderContext
|
||||
{
|
||||
PerformanceTimer perfTimer("EngineRun");
|
||||
render::RenderContext renderContext;
|
||||
|
||||
auto sceneInterface = DependencyManager::get<SceneScriptingInterface>();
|
||||
|
||||
renderContext._cullOpaque = sceneInterface->doEngineCullOpaque();
|
||||
renderContext._sortOpaque = sceneInterface->doEngineSortOpaque();
|
||||
renderContext._renderOpaque = sceneInterface->doEngineRenderOpaque();
|
||||
renderContext._cullTransparent = sceneInterface->doEngineCullTransparent();
|
||||
renderContext._sortTransparent = sceneInterface->doEngineSortTransparent();
|
||||
renderContext._renderTransparent = sceneInterface->doEngineRenderTransparent();
|
||||
|
||||
renderContext._maxDrawnOpaqueItems = sceneInterface->getEngineMaxDrawnOpaqueItems();
|
||||
renderContext._maxDrawnTransparentItems = sceneInterface->getEngineMaxDrawnTransparentItems();
|
||||
renderContext._maxDrawnOverlay3DItems = sceneInterface->getEngineMaxDrawnOverlay3DItems();
|
||||
|
||||
renderContext._deferredDebugMode = sceneInterface->getEngineDeferredDebugMode();
|
||||
renderContext._deferredDebugSize = sceneInterface->getEngineDeferredDebugSize();
|
||||
|
||||
renderContext._drawItemStatus = sceneInterface->doEngineDisplayItemStatus();
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::PhysicsShowOwned)) {
|
||||
renderContext._drawItemStatus |= render::showNetworkStatusFlag;
|
||||
}
|
||||
renderContext._drawHitEffect = sceneInterface->doEngineDisplayHitEffect();
|
||||
|
||||
renderContext._occlusionStatus = Menu::getInstance()->isOptionChecked(MenuOption::DebugAmbientOcclusion);
|
||||
renderContext._fxaaStatus = Menu::getInstance()->isOptionChecked(MenuOption::Antialiasing);
|
||||
|
||||
renderContext._toneMappingExposure = sceneInterface->getEngineToneMappingExposure();
|
||||
renderContext._toneMappingToneCurve = sceneInterface->getEngineToneMappingToneCurveValue();
|
||||
|
||||
renderArgs->_shouldRender = LODManager::shouldRender;
|
||||
|
||||
renderContext.args = renderArgs;
|
||||
renderArgs->_viewFrustum = getDisplayViewFrustum();
|
||||
|
||||
auto renderInterface = DependencyManager::get<RenderScriptingInterface>();
|
||||
auto renderItemsConfig = renderInterface->getItemsConfig();
|
||||
auto renderTone = renderInterface->getTone();
|
||||
int drawStatus = renderInterface->getDrawStatus();
|
||||
bool drawHitEffect = renderInterface->getDrawHitEffect();
|
||||
|
||||
bool occlusionStatus = Menu::getInstance()->isOptionChecked(MenuOption::DebugAmbientOcclusion);
|
||||
bool antialiasingStatus = Menu::getInstance()->isOptionChecked(MenuOption::Antialiasing);
|
||||
bool showOwnedStatus = Menu::getInstance()->isOptionChecked(MenuOption::PhysicsShowOwned);
|
||||
|
||||
render::RenderContext renderContext{renderArgs, renderItemsConfig, renderTone};
|
||||
renderContext.setOptions(drawStatus, drawHitEffect, occlusionStatus, antialiasingStatus, showOwnedStatus);
|
||||
_renderEngine->setRenderContext(renderContext);
|
||||
|
||||
// Before the deferred pass, let's try to use the render engine
|
||||
|
@ -3759,15 +3743,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
|
|||
_renderEngine->run();
|
||||
myAvatar->endRenderRun();
|
||||
|
||||
auto engineRC = _renderEngine->getRenderContext();
|
||||
sceneInterface->setEngineFeedOpaqueItems(engineRC->_numFeedOpaqueItems);
|
||||
sceneInterface->setEngineDrawnOpaqueItems(engineRC->_numDrawnOpaqueItems);
|
||||
|
||||
sceneInterface->setEngineFeedTransparentItems(engineRC->_numFeedTransparentItems);
|
||||
sceneInterface->setEngineDrawnTransparentItems(engineRC->_numDrawnTransparentItems);
|
||||
|
||||
sceneInterface->setEngineFeedOverlay3DItems(engineRC->_numFeedOverlay3DItems);
|
||||
sceneInterface->setEngineDrawnOverlay3DItems(engineRC->_numDrawnOverlay3DItems);
|
||||
auto engineContext = _renderEngine->getRenderContext();
|
||||
renderInterface->setItemCounts(engineContext->getItemsConfig());
|
||||
}
|
||||
|
||||
activeRenderingThread = nullptr;
|
||||
|
@ -4193,6 +4170,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
|||
LocationScriptingInterface::locationSetter);
|
||||
|
||||
scriptEngine->registerFunction("WebWindow", WebWindowClass::constructor, 1);
|
||||
scriptEngine->registerFunction("OverlayWebWindow", QmlWebWindowClass::constructor);
|
||||
|
||||
scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
|
||||
scriptEngine->registerGlobalObject("Stats", Stats::getInstance());
|
||||
|
@ -4221,6 +4199,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
|||
scriptEngine->registerFunction("HMD", "getHUDLookAtPosition3D", HMDScriptingInterface::getHUDLookAtPosition3D, 0);
|
||||
|
||||
scriptEngine->registerGlobalObject("Scene", DependencyManager::get<SceneScriptingInterface>().data());
|
||||
scriptEngine->registerGlobalObject("Render", DependencyManager::get<RenderScriptingInterface>().data());
|
||||
|
||||
scriptEngine->registerGlobalObject("ScriptDiscoveryService", this->getRunningScriptsWidget());
|
||||
}
|
||||
|
|
|
@ -223,10 +223,10 @@ void RenderableParticleEffectEntityItem::updateRenderItem() {
|
|||
particleUniforms.radius.middle = getParticleRadius();
|
||||
particleUniforms.radius.finish = getRadiusFinish();
|
||||
particleUniforms.radius.spread = getRadiusSpread();
|
||||
particleUniforms.color.start = toGlm(getColorStart(), getAlphaStart());
|
||||
particleUniforms.color.middle = toGlm(getXColor(), getAlpha());
|
||||
particleUniforms.color.finish = toGlm(getColorFinish(), getAlphaFinish());
|
||||
particleUniforms.color.spread = toGlm(getColorSpread(), getAlphaSpread());
|
||||
particleUniforms.color.start = glm::vec4(getColorStartRGB(), getAlphaStart());
|
||||
particleUniforms.color.middle = glm::vec4(getColorRGB(), getAlpha());
|
||||
particleUniforms.color.finish = glm::vec4(getColorFinishRGB(), getAlphaFinish());
|
||||
particleUniforms.color.spread = glm::vec4(getColorSpreadRGB(), getAlphaSpread());
|
||||
particleUniforms.lifespan = getLifespan();
|
||||
|
||||
// Build particle primitives
|
||||
|
|
|
@ -9,16 +9,15 @@
|
|||
//
|
||||
|
||||
<@include gpu/Inputs.slh@>
|
||||
|
||||
<@include gpu/Color.slh@>
|
||||
<@include gpu/Transform.slh@>
|
||||
|
||||
<$declareStandardTransform()$>
|
||||
|
||||
out vec4 _color;
|
||||
|
||||
void main(void) {
|
||||
// pass along the diffuse color
|
||||
_color = inColor;
|
||||
_color = colorToLinearRGBA(inColor);
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#include "EntityItem.h"
|
||||
|
||||
#include "ColorUtils.h"
|
||||
|
||||
class ParticleEffectEntityItem : public EntityItem {
|
||||
public:
|
||||
ALLOW_INSTANTIATION // This class can be instantiated
|
||||
|
@ -47,6 +49,7 @@ public:
|
|||
|
||||
const rgbColor& getColor() const { return _color; }
|
||||
xColor getXColor() const { xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; }
|
||||
glm::vec3 getColorRGB() const { return ColorUtils::toLinearVec3(toGlm(getXColor())); }
|
||||
|
||||
static const xColor DEFAULT_COLOR;
|
||||
void setColor(const rgbColor& value) { memcpy(_color, value, sizeof(_color)); }
|
||||
|
@ -59,14 +62,17 @@ public:
|
|||
bool _isColorStartInitialized = false;
|
||||
void setColorStart(const xColor& colorStart) { _colorStart = colorStart; _isColorStartInitialized = true; }
|
||||
xColor getColorStart() const { return _isColorStartInitialized ? _colorStart : getXColor(); }
|
||||
glm::vec3 getColorStartRGB() const { return _isColorStartInitialized ? ColorUtils::toLinearVec3(toGlm(_colorStart)) : getColorRGB(); }
|
||||
|
||||
bool _isColorFinishInitialized = false;
|
||||
void setColorFinish(const xColor& colorFinish) { _colorFinish = colorFinish; _isColorFinishInitialized = true; }
|
||||
xColor getColorFinish() const { return _isColorFinishInitialized ? _colorFinish : getXColor(); }
|
||||
glm::vec3 getColorFinishRGB() const { return _isColorStartInitialized ? ColorUtils::toLinearVec3(toGlm(_colorFinish)) : getColorRGB(); }
|
||||
|
||||
static const xColor DEFAULT_COLOR_SPREAD;
|
||||
void setColorSpread(const xColor& colorSpread) { _colorSpread = colorSpread; }
|
||||
xColor getColorSpread() const { return _colorSpread; }
|
||||
glm::vec3 getColorSpreadRGB() const { return ColorUtils::toLinearVec3(toGlm(_colorSpread)); }
|
||||
|
||||
static const float MAXIMUM_ALPHA;
|
||||
static const float MINIMUM_ALPHA;
|
||||
|
|
|
@ -35,6 +35,8 @@ void main(void) {
|
|||
#ifdef PROCEDURAL
|
||||
|
||||
vec3 color = getSkyboxColor();
|
||||
// Procedural Shaders are expected to be Gamma corrected so let's bring back the RGB in linear space for the rest of the pipeline
|
||||
color = pow(color, vec3(2.2));
|
||||
_fragColor = vec4(color, 0.0);
|
||||
|
||||
#else
|
||||
|
@ -42,7 +44,6 @@ void main(void) {
|
|||
vec3 coord = normalize(_normal);
|
||||
vec3 texel = texture(cubeMap, coord).rgb;
|
||||
vec3 color = texel * _skybox._color.rgb;
|
||||
// vec3 pixel = pow(color, vec3(1.0/2.2)); // manual Gamma correction
|
||||
_fragColor = vec4(color, 0.0);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -175,10 +175,10 @@ const gpu::PipelinePointer& AmbientOcclusion::getBlendPipeline() {
|
|||
}
|
||||
|
||||
void AmbientOcclusion::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||
auto framebufferCache = DependencyManager::get<FramebufferCache>();
|
||||
QSize framebufferSize = framebufferCache->getFrameBufferSize();
|
||||
|
|
|
@ -93,14 +93,14 @@ const gpu::PipelinePointer& Antialiasing::getBlendPipeline() {
|
|||
}
|
||||
|
||||
void Antialiasing::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
|
||||
if (renderContext->args->_renderMode == RenderArgs::MIRROR_RENDER_MODE) {
|
||||
if (renderContext->getArgs()->_renderMode == RenderArgs::MIRROR_RENDER_MODE) {
|
||||
return;
|
||||
}
|
||||
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||
batch.enableStereo(false);
|
||||
|
||||
|
|
|
@ -179,9 +179,9 @@ const gpu::PipelinePointer& DebugDeferredBuffer::getPipeline(Modes mode, std::st
|
|||
|
||||
|
||||
void DebugDeferredBuffer::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
const RenderArgs* args = renderContext->args;
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||
const auto geometryBuffer = DependencyManager::get<GeometryCache>();
|
||||
const auto framebufferCache = DependencyManager::get<FramebufferCache>();
|
||||
|
@ -211,4 +211,4 @@ void DebugDeferredBuffer::run(const SceneContextPointer& sceneContext, const Ren
|
|||
const glm::vec2 topRight(renderContext->_deferredDebugSize.z, renderContext->_deferredDebugSize.w);
|
||||
geometryBuffer->renderQuad(batch, bottomLeft, topRight, color);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,9 +61,9 @@ const gpu::PipelinePointer& HitEffect::getHitEffectPipeline() {
|
|||
}
|
||||
|
||||
void HitEffect::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
RenderArgs* args = renderContext->args;
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||
|
||||
glm::mat4 projMat;
|
||||
|
|
|
@ -37,23 +37,23 @@ using namespace render;
|
|||
|
||||
|
||||
void PrepareDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
DependencyManager::get<DeferredLightingEffect>()->prepare(renderContext->args);
|
||||
DependencyManager::get<DeferredLightingEffect>()->prepare(renderContext->getArgs());
|
||||
}
|
||||
|
||||
void RenderDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
DependencyManager::get<DeferredLightingEffect>()->render(renderContext->args);
|
||||
DependencyManager::get<DeferredLightingEffect>()->render(renderContext->getArgs());
|
||||
}
|
||||
|
||||
void ToneMappingDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
PerformanceTimer perfTimer("ToneMappingDeferred");
|
||||
_toneMappingEffect.render(renderContext->args);
|
||||
_toneMappingEffect.render(renderContext->getArgs());
|
||||
}
|
||||
|
||||
RenderDeferredTask::RenderDeferredTask() : Task() {
|
||||
// CPU only, create the list of renderedOpaques items
|
||||
_jobs.push_back(Job(new FetchItems::JobModel("FetchOpaque",
|
||||
FetchItems([](const RenderContextPointer& context, int count) {
|
||||
context->_numFeedOpaqueItems = count;
|
||||
context->getItemsConfig().opaque.numFeed = count;
|
||||
})
|
||||
)));
|
||||
_jobs.push_back(Job(new CullItemsOpaque::JobModel("CullOpaque", _jobs.back().getOutput())));
|
||||
|
@ -64,7 +64,7 @@ RenderDeferredTask::RenderDeferredTask() : Task() {
|
|||
_jobs.push_back(Job(new FetchItems::JobModel("FetchTransparent",
|
||||
FetchItems(ItemFilter::Builder::transparentShape().withoutLayered(),
|
||||
[](const RenderContextPointer& context, int count) {
|
||||
context->_numFeedTransparentItems = count;
|
||||
context->getItemsConfig().transparent.numFeed = count;
|
||||
})
|
||||
)));
|
||||
_jobs.push_back(Job(new CullItemsTransparent::JobModel("CullTransparent", _jobs.back().getOutput())));
|
||||
|
@ -104,12 +104,12 @@ RenderDeferredTask::RenderDeferredTask() : Task() {
|
|||
|
||||
// Lighting Buffer ready for tone mapping
|
||||
_jobs.push_back(Job(new ToneMappingDeferred::JobModel("ToneMapping")));
|
||||
_toneMappingJobIndex = _jobs.size() - 1;
|
||||
_toneMappingJobIndex = (int)_jobs.size() - 1;
|
||||
|
||||
// Debugging Deferred buffer job
|
||||
_jobs.push_back(Job(new DebugDeferredBuffer::JobModel("DebugDeferredBuffer")));
|
||||
_jobs.back().setEnabled(false);
|
||||
_drawDebugDeferredBufferIndex = _jobs.size() - 1;
|
||||
_drawDebugDeferredBufferIndex = (int)_jobs.size() - 1;
|
||||
|
||||
// Status icon rendering job
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ RenderDeferredTask::RenderDeferredTask() : Task() {
|
|||
auto statusIconMap = DependencyManager::get<TextureCache>()->getImageTexture(iconMapPath);
|
||||
_jobs.push_back(Job(new render::DrawStatus::JobModel("DrawStatus", renderedOpaques, DrawStatus(statusIconMap))));
|
||||
_jobs.back().setEnabled(false);
|
||||
_drawStatusJobIndex = _jobs.size() - 1;
|
||||
_drawStatusJobIndex = (int)_jobs.size() - 1;
|
||||
}
|
||||
|
||||
_jobs.push_back(Job(new DrawOverlay3D::JobModel("DrawOverlay3D")));
|
||||
|
@ -146,7 +146,7 @@ void RenderDeferredTask::run(const SceneContextPointer& sceneContext, const Rend
|
|||
|
||||
|
||||
// Is it possible that we render without a viewFrustum ?
|
||||
if (!(renderContext->args && renderContext->args->_viewFrustum)) {
|
||||
if (!(renderContext->getArgs() && renderContext->getArgs()->_viewFrustum)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -154,21 +154,21 @@ void RenderDeferredTask::run(const SceneContextPointer& sceneContext, const Rend
|
|||
setDrawDebugDeferredBuffer(renderContext->_deferredDebugMode);
|
||||
|
||||
// Make sure we turn the displayItemStatus on/off
|
||||
setDrawItemStatus(renderContext->_drawItemStatus);
|
||||
setDrawItemStatus(renderContext->getDrawStatus());
|
||||
|
||||
// Make sure we display hit effect on screen, as desired from a script
|
||||
setDrawHitEffect(renderContext->_drawHitEffect);
|
||||
setDrawHitEffect(renderContext->getDrawHitEffect());
|
||||
|
||||
|
||||
// TODO: turn on/off AO through menu item
|
||||
setOcclusionStatus(renderContext->_occlusionStatus);
|
||||
setOcclusionStatus(renderContext->getOcclusionStatus());
|
||||
|
||||
setAntialiasingStatus(renderContext->_fxaaStatus);
|
||||
setAntialiasingStatus(renderContext->getFxaaStatus());
|
||||
|
||||
setToneMappingExposure(renderContext->_toneMappingExposure);
|
||||
setToneMappingToneCurve(renderContext->_toneMappingToneCurve);
|
||||
setToneMappingExposure(renderContext->getTone().exposure);
|
||||
setToneMappingToneCurve(renderContext->getTone().toneCurve);
|
||||
|
||||
renderContext->args->_context->syncCache();
|
||||
renderContext->getArgs()->_context->syncCache();
|
||||
|
||||
for (auto job : _jobs) {
|
||||
job.run(sceneContext, renderContext);
|
||||
|
@ -177,16 +177,17 @@ void RenderDeferredTask::run(const SceneContextPointer& sceneContext, const Rend
|
|||
};
|
||||
|
||||
void DrawOpaqueDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDsBounds& inItems) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||
batch.setViewportTransform(args->_viewport);
|
||||
batch.setStateScissorRect(args->_viewport);
|
||||
args->_batch = &batch;
|
||||
|
||||
renderContext->_numDrawnOpaqueItems = (int)inItems.size();
|
||||
auto& opaque = renderContext->getItemsConfig().opaque;
|
||||
opaque.numDrawn = (int)inItems.size();
|
||||
|
||||
glm::mat4 projMat;
|
||||
Transform viewMat;
|
||||
|
@ -200,22 +201,23 @@ void DrawOpaqueDeferred::run(const SceneContextPointer& sceneContext, const Rend
|
|||
const float OPAQUE_ALPHA_THRESHOLD = 0.5f;
|
||||
args->_alphaThreshold = OPAQUE_ALPHA_THRESHOLD;
|
||||
}
|
||||
renderItems(sceneContext, renderContext, inItems, renderContext->_maxDrawnOpaqueItems);
|
||||
renderItems(sceneContext, renderContext, inItems, opaque.maxDrawn);
|
||||
args->_batch = nullptr;
|
||||
});
|
||||
}
|
||||
|
||||
void DrawTransparentDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDsBounds& inItems) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||
batch.setViewportTransform(args->_viewport);
|
||||
batch.setStateScissorRect(args->_viewport);
|
||||
args->_batch = &batch;
|
||||
|
||||
renderContext->_numDrawnTransparentItems = (int)inItems.size();
|
||||
auto& transparent = renderContext->getItemsConfig().transparent;
|
||||
transparent.numDrawn = (int)inItems.size();
|
||||
|
||||
glm::mat4 projMat;
|
||||
Transform viewMat;
|
||||
|
@ -228,7 +230,7 @@ void DrawTransparentDeferred::run(const SceneContextPointer& sceneContext, const
|
|||
const float TRANSPARENT_ALPHA_THRESHOLD = 0.0f;
|
||||
args->_alphaThreshold = TRANSPARENT_ALPHA_THRESHOLD;
|
||||
|
||||
renderItems(sceneContext, renderContext, inItems, renderContext->_maxDrawnTransparentItems);
|
||||
renderItems(sceneContext, renderContext, inItems, transparent.maxDrawn);
|
||||
args->_batch = nullptr;
|
||||
});
|
||||
}
|
||||
|
@ -251,8 +253,8 @@ const gpu::PipelinePointer& DrawOverlay3D::getOpaquePipeline() {
|
|||
}
|
||||
|
||||
void DrawOverlay3D::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
|
||||
// render backgrounds
|
||||
auto& scene = sceneContext->_scene;
|
||||
|
@ -267,11 +269,12 @@ void DrawOverlay3D::run(const SceneContextPointer& sceneContext, const RenderCon
|
|||
inItems.emplace_back(id);
|
||||
}
|
||||
}
|
||||
renderContext->_numFeedOverlay3DItems = (int)inItems.size();
|
||||
renderContext->_numDrawnOverlay3DItems = (int)inItems.size();
|
||||
auto& overlay3D = renderContext->getItemsConfig().overlay3D;
|
||||
overlay3D.numFeed = (int)inItems.size();
|
||||
overlay3D.numDrawn = (int)inItems.size();
|
||||
|
||||
if (!inItems.empty()) {
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
|
||||
// Clear the framebuffer without stereo
|
||||
// Needs to be distinct from the other batch because using the clear call
|
||||
|
@ -300,7 +303,7 @@ void DrawOverlay3D::run(const SceneContextPointer& sceneContext, const RenderCon
|
|||
|
||||
batch.setPipeline(getOpaquePipeline());
|
||||
batch.setResourceTexture(0, args->_whiteTexture);
|
||||
renderItems(sceneContext, renderContext, inItems, renderContext->_maxDrawnOverlay3DItems);
|
||||
renderItems(sceneContext, renderContext, inItems, renderContext->getItemsConfig().overlay3D.maxDrawn);
|
||||
});
|
||||
args->_batch = nullptr;
|
||||
args->_whiteTexture.reset();
|
||||
|
@ -329,11 +332,11 @@ const gpu::PipelinePointer& DrawStencilDeferred::getOpaquePipeline() {
|
|||
}
|
||||
|
||||
void DrawStencilDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
|
||||
// from the touched pixel generate the stencil buffer
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||
args->_batch = &batch;
|
||||
|
||||
|
@ -355,8 +358,8 @@ void DrawStencilDeferred::run(const SceneContextPointer& sceneContext, const Ren
|
|||
}
|
||||
|
||||
void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
|
||||
// render backgrounds
|
||||
auto& scene = sceneContext->_scene;
|
||||
|
@ -368,7 +371,7 @@ void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const
|
|||
for (auto id : items) {
|
||||
inItems.emplace_back(id);
|
||||
}
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||
args->_batch = &batch;
|
||||
|
||||
|
|
41
libraries/render-utils/src/RenderScriptingInterface.cpp
Normal file
41
libraries/render-utils/src/RenderScriptingInterface.cpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// RenderScriptingInterface.cpp
|
||||
// libraries/render-utils
|
||||
//
|
||||
// Created by Zach Pomerantz on 12/16/15.
|
||||
// Copyright 2015 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 "RenderScriptingInterface.h"
|
||||
|
||||
RenderScriptingInterface::RenderScriptingInterface() {};
|
||||
|
||||
void RenderScriptingInterface::setEngineToneMappingToneCurve(const QString& toneCurve) {
|
||||
if (toneCurve == QString("None")) {
|
||||
_tone.toneCurve = 0;
|
||||
} else if (toneCurve == QString("Gamma22")) {
|
||||
_tone.toneCurve = 1;
|
||||
} else if (toneCurve == QString("Reinhard")) {
|
||||
_tone.toneCurve = 2;
|
||||
} else if (toneCurve == QString("Filmic")) {
|
||||
_tone.toneCurve = 3;
|
||||
}
|
||||
}
|
||||
|
||||
QString RenderScriptingInterface::getEngineToneMappingToneCurve() const {
|
||||
switch (_tone.toneCurve) {
|
||||
case 0:
|
||||
return QString("None");
|
||||
case 1:
|
||||
return QString("Gamma22");
|
||||
case 2:
|
||||
return QString("Reinhard");
|
||||
case 3:
|
||||
return QString("Filmic");
|
||||
default:
|
||||
return QString("Filmic");
|
||||
};
|
||||
}
|
95
libraries/render-utils/src/RenderScriptingInterface.h
Normal file
95
libraries/render-utils/src/RenderScriptingInterface.h
Normal file
|
@ -0,0 +1,95 @@
|
|||
//
|
||||
// RenderScriptingInterface.h
|
||||
// libraries/render-utils
|
||||
//
|
||||
// Created by Zach Pomerantz on 12/16/15.
|
||||
// Copyright 2014 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
|
||||
//
|
||||
|
||||
#ifndef hifi_RenderScriptingInterface_h
|
||||
#define hifi_RenderScriptingInterface_h
|
||||
|
||||
#include <qscriptengine.h> // QObject
|
||||
#include <DependencyManager.h> // Dependency
|
||||
|
||||
#include "render/Engine.h"
|
||||
|
||||
class RenderScriptingInterface : public QObject, public Dependency {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY
|
||||
|
||||
public:
|
||||
Q_INVOKABLE void setEngineRenderOpaque(bool renderOpaque) { _items.opaque.render = renderOpaque; };
|
||||
Q_INVOKABLE bool doEngineRenderOpaque() const { return _items.opaque.render; }
|
||||
Q_INVOKABLE void setEngineRenderTransparent(bool renderTransparent) { _items.transparent.render = renderTransparent; };
|
||||
Q_INVOKABLE bool doEngineRenderTransparent() const { return _items.transparent.render; }
|
||||
|
||||
Q_INVOKABLE void setEngineCullOpaque(bool cullOpaque) { _items.opaque.cull = cullOpaque; };
|
||||
Q_INVOKABLE bool doEngineCullOpaque() const { return _items.opaque.cull; }
|
||||
Q_INVOKABLE void setEngineCullTransparent(bool cullTransparent) { _items.transparent.cull = cullTransparent; };
|
||||
Q_INVOKABLE bool doEngineCullTransparent() const { return _items.transparent.cull; }
|
||||
|
||||
Q_INVOKABLE void setEngineSortOpaque(bool sortOpaque) { _items.opaque.sort = sortOpaque; };
|
||||
Q_INVOKABLE bool doEngineSortOpaque() const { return _items.opaque.sort; }
|
||||
Q_INVOKABLE void setEngineSortTransparent(bool sortTransparent) { _items.transparent.sort = sortTransparent; };
|
||||
Q_INVOKABLE bool doEngineSortTransparent() const { return _items.transparent.sort; }
|
||||
|
||||
Q_INVOKABLE int getEngineNumDrawnOpaqueItems() { return _items.opaque.numDrawn; }
|
||||
Q_INVOKABLE int getEngineNumDrawnTransparentItems() { return _items.transparent.numDrawn; }
|
||||
Q_INVOKABLE int getEngineNumDrawnOverlay3DItems() { return _items.overlay3D.numDrawn; }
|
||||
|
||||
Q_INVOKABLE int getEngineNumFeedOpaqueItems() { return _items.opaque.numFeed; }
|
||||
Q_INVOKABLE int getEngineNumFeedTransparentItems() { return _items.transparent.numFeed; }
|
||||
Q_INVOKABLE int getEngineNumFeedOverlay3DItems() { return _items.overlay3D.numFeed; }
|
||||
|
||||
Q_INVOKABLE void setEngineMaxDrawnOpaqueItems(int count) { _items.opaque.maxDrawn = count; }
|
||||
Q_INVOKABLE int getEngineMaxDrawnOpaqueItems() { return _items.opaque.maxDrawn; }
|
||||
Q_INVOKABLE void setEngineMaxDrawnTransparentItems(int count) { _items.transparent.maxDrawn = count; }
|
||||
Q_INVOKABLE int getEngineMaxDrawnTransparentItems() { return _items.transparent.maxDrawn; }
|
||||
Q_INVOKABLE void setEngineMaxDrawnOverlay3DItems(int count) { _items.overlay3D.maxDrawn = count; }
|
||||
Q_INVOKABLE int getEngineMaxDrawnOverlay3DItems() { return _items.overlay3D.maxDrawn; }
|
||||
|
||||
Q_INVOKABLE void setEngineDeferredDebugMode(int mode) { _deferredDebugMode = mode; }
|
||||
Q_INVOKABLE int getEngineDeferredDebugMode() { return _deferredDebugMode; }
|
||||
Q_INVOKABLE void setEngineDeferredDebugSize(glm::vec4 size) { _deferredDebugSize = size; }
|
||||
Q_INVOKABLE glm::vec4 getEngineDeferredDebugSize() { return _deferredDebugSize; }
|
||||
|
||||
Q_INVOKABLE void setEngineDisplayItemStatus(int display) { _drawStatus = display; }
|
||||
Q_INVOKABLE int doEngineDisplayItemStatus() { return _drawStatus; }
|
||||
|
||||
Q_INVOKABLE void setEngineDisplayHitEffect(bool display) { _drawHitEffect = display; }
|
||||
Q_INVOKABLE bool doEngineDisplayHitEffect() { return _drawHitEffect; }
|
||||
|
||||
Q_INVOKABLE void setEngineToneMappingExposure(float exposure) { _tone.exposure = exposure; }
|
||||
Q_INVOKABLE float getEngineToneMappingExposure() const { return _tone.exposure; }
|
||||
|
||||
Q_INVOKABLE void setEngineToneMappingToneCurve(const QString& curve);
|
||||
Q_INVOKABLE QString getEngineToneMappingToneCurve() const;
|
||||
int getEngineToneMappingToneCurveValue() const { return _tone.toneCurve; }
|
||||
|
||||
inline int getDrawStatus() { return _drawStatus; }
|
||||
inline bool getDrawHitEffect() { return _drawHitEffect; }
|
||||
inline const render::RenderContext::ItemsConfig& getItemsConfig() { return _items; }
|
||||
inline const render::RenderContext::Tone& getTone() { return _tone; }
|
||||
void setItemCounts(const render::RenderContext::ItemsConfig& items) { _items.setCounts(items); };
|
||||
|
||||
protected:
|
||||
RenderScriptingInterface();
|
||||
~RenderScriptingInterface() {};
|
||||
|
||||
render::RenderContext::ItemsConfig _items;
|
||||
render::RenderContext::Tone _tone;
|
||||
|
||||
// Options
|
||||
int _drawStatus = 0;
|
||||
bool _drawHitEffect = false;
|
||||
|
||||
// Debugging
|
||||
int _deferredDebugMode = -1;
|
||||
glm::vec4 _deferredDebugSize { 0.0f, -1.0f, 1.0f, 1.0f };
|
||||
};
|
||||
|
||||
#endif // hifi_RenderScriptingInterface_h
|
|
@ -141,7 +141,5 @@ void ToneMappingEffect::render(RenderArgs* args) {
|
|||
batch.setUniformBuffer(3, _parametersBuffer);
|
||||
batch.setResourceTexture(0, lightingBuffer);
|
||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||
|
||||
args->_context->render(batch);
|
||||
});
|
||||
}
|
|
@ -40,6 +40,8 @@ void main(void) {
|
|||
|
||||
#ifdef PROCEDURAL_V1
|
||||
specular = getProceduralColor().rgb;
|
||||
// Procedural Shaders are expected to be Gamma corrected so let's bring back the RGB in linear space for the rest of the pipeline
|
||||
specular = pow(specular, vec3(2.2));
|
||||
emissiveAmount = 1.0;
|
||||
#else
|
||||
emissiveAmount = getProceduralColors(diffuse, specular, shininess);
|
||||
|
|
|
@ -97,9 +97,9 @@ const gpu::TexturePointer DrawStatus::getStatusIconMap() const {
|
|||
void DrawStatus::run(const SceneContextPointer& sceneContext,
|
||||
const RenderContextPointer& renderContext,
|
||||
const ItemIDsBounds& inItems) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
RenderArgs* args = renderContext->args;
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
auto& scene = sceneContext->_scene;
|
||||
const int NUM_STATUS_VEC4_PER_ITEM = 2;
|
||||
const int VEC4_LENGTH = 4;
|
||||
|
@ -179,7 +179,7 @@ void DrawStatus::run(const SceneContextPointer& sceneContext,
|
|||
|
||||
const unsigned int VEC3_ADRESS_OFFSET = 3;
|
||||
|
||||
if ((renderContext->_drawItemStatus & showDisplayStatusFlag) > 0) {
|
||||
if ((renderContext->getDrawStatus() & showDisplayStatusFlag) > 0) {
|
||||
for (int i = 0; i < nbItems; i++) {
|
||||
batch._glUniform3fv(_drawItemBoundPosLoc, 1, (const float*) (itemAABox + i));
|
||||
batch._glUniform3fv(_drawItemBoundDimLoc, 1, ((const float*) (itemAABox + i)) + VEC3_ADRESS_OFFSET);
|
||||
|
@ -192,7 +192,7 @@ void DrawStatus::run(const SceneContextPointer& sceneContext,
|
|||
|
||||
batch.setPipeline(getDrawItemStatusPipeline());
|
||||
|
||||
if ((renderContext->_drawItemStatus & showNetworkStatusFlag) > 0) {
|
||||
if ((renderContext->getDrawStatus() & showNetworkStatusFlag) > 0) {
|
||||
for (int i = 0; i < nbItems; i++) {
|
||||
batch._glUniform3fv(_drawItemStatusPosLoc, 1, (const float*) (itemAABox + i));
|
||||
batch._glUniform3fv(_drawItemStatusDimLoc, 1, ((const float*) (itemAABox + i)) + VEC3_ADRESS_OFFSET);
|
||||
|
|
|
@ -37,7 +37,7 @@ void DrawSceneTask::run(const SceneContextPointer& sceneContext, const RenderCon
|
|||
|
||||
|
||||
// Is it possible that we render without a viewFrustum ?
|
||||
if (!(renderContext->args && renderContext->args->_viewFrustum)) {
|
||||
if (!(renderContext->getArgs() && renderContext->getArgs()->_viewFrustum)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -54,11 +54,11 @@ Job::~Job() {
|
|||
|
||||
|
||||
void render::cullItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDsBounds& inItems, ItemIDsBounds& outItems) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
|
||||
RenderArgs* args = renderContext->args;
|
||||
auto renderDetails = renderContext->args->_details._item;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
auto renderDetails = renderContext->getArgs()->_details._item;
|
||||
|
||||
renderDetails->_considered += inItems.size();
|
||||
|
||||
|
@ -115,7 +115,7 @@ void CullItems::run(const SceneContextPointer& sceneContext, const RenderContext
|
|||
|
||||
outItems.clear();
|
||||
outItems.reserve(inItems.size());
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
args->_details.pointTo(RenderDetails::OTHER_ITEM);
|
||||
cullItems(sceneContext, renderContext, inItems, outItems);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ void CullItemsOpaque::run(const SceneContextPointer& sceneContext, const RenderC
|
|||
|
||||
outItems.clear();
|
||||
outItems.reserve(inItems.size());
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
args->_details.pointTo(RenderDetails::OPAQUE_ITEM);
|
||||
cullItems(sceneContext, renderContext, inItems, outItems);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ void CullItemsTransparent::run(const SceneContextPointer& sceneContext, const Re
|
|||
|
||||
outItems.clear();
|
||||
outItems.reserve(inItems.size());
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
args->_details.pointTo(RenderDetails::TRANSLUCENT_ITEM);
|
||||
cullItems(sceneContext, renderContext, inItems, outItems);
|
||||
}
|
||||
|
@ -163,11 +163,11 @@ struct BackToFrontSort {
|
|||
};
|
||||
|
||||
void render::depthSortItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, bool frontToBack, const ItemIDsBounds& inItems, ItemIDsBounds& outItems) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
|
||||
auto& scene = sceneContext->_scene;
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
|
||||
|
||||
// Allocate and simply copy
|
||||
|
@ -211,7 +211,7 @@ void DepthSortItems::run(const SceneContextPointer& sceneContext, const RenderCo
|
|||
|
||||
void render::renderItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDsBounds& inItems, int maxDrawnItems) {
|
||||
auto& scene = sceneContext->_scene;
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
// render
|
||||
if ((maxDrawnItems < 0) || (maxDrawnItems > (int) inItems.size())) {
|
||||
for (auto itemDetails : inItems) {
|
||||
|
@ -236,8 +236,8 @@ void render::renderItems(const SceneContextPointer& sceneContext, const RenderCo
|
|||
}
|
||||
|
||||
void DrawLight::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
|
||||
// render lights
|
||||
auto& scene = sceneContext->_scene;
|
||||
|
@ -253,7 +253,7 @@ void DrawLight::run(const SceneContextPointer& sceneContext, const RenderContext
|
|||
|
||||
ItemIDsBounds culledItems;
|
||||
culledItems.reserve(inItems.size());
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
args->_details.pointTo(RenderDetails::OTHER_ITEM);
|
||||
cullItems(sceneContext, renderContext, inItems, culledItems);
|
||||
|
||||
|
@ -265,8 +265,8 @@ void DrawLight::run(const SceneContextPointer& sceneContext, const RenderContext
|
|||
}
|
||||
|
||||
void DrawBackground::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->_viewFrustum);
|
||||
assert(renderContext->getArgs());
|
||||
assert(renderContext->getArgs()->_viewFrustum);
|
||||
|
||||
// render backgrounds
|
||||
auto& scene = sceneContext->_scene;
|
||||
|
@ -278,7 +278,7 @@ void DrawBackground::run(const SceneContextPointer& sceneContext, const RenderCo
|
|||
for (auto id : items) {
|
||||
inItems.emplace_back(id);
|
||||
}
|
||||
RenderArgs* args = renderContext->args;
|
||||
RenderArgs* args = renderContext->getArgs();
|
||||
doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||
args->_batch = &batch;
|
||||
batch.enableSkybox(true);
|
||||
|
|
|
@ -13,6 +13,16 @@
|
|||
#include "DrawTask.h"
|
||||
using namespace render;
|
||||
|
||||
void RenderContext::setOptions(int drawStatus, bool drawHitEffect, bool occlusion, bool fxaa, bool showOwned) {
|
||||
_drawStatus = drawStatus;
|
||||
_occlusionStatus = occlusion;
|
||||
_fxaaStatus = fxaa;
|
||||
_drawHitEffect = drawHitEffect;
|
||||
|
||||
if (showOwned) {
|
||||
_drawStatus |= render::showNetworkStatusFlag;
|
||||
}
|
||||
};
|
||||
|
||||
Engine::Engine() :
|
||||
_sceneContext(std::make_shared<SceneContext>()),
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
SceneContext() {}
|
||||
};
|
||||
typedef std::shared_ptr<SceneContext> SceneContextPointer;
|
||||
using SceneContextPointer = std::shared_ptr<SceneContext>;
|
||||
|
||||
// see examples/utilities/tools/renderEngineDebug.js
|
||||
const int showDisplayStatusFlag = 1;
|
||||
|
@ -32,43 +32,84 @@ const int showNetworkStatusFlag = 2;
|
|||
|
||||
class RenderContext {
|
||||
public:
|
||||
RenderArgs* args;
|
||||
class ItemsConfig {
|
||||
public:
|
||||
inline void setCounts(const ItemsConfig& items) {
|
||||
opaque.setCounts(items.opaque);
|
||||
transparent.setCounts(items.transparent);
|
||||
overlay3D.setCounts(items.overlay3D);
|
||||
};
|
||||
|
||||
bool _cullOpaque = true;
|
||||
bool _sortOpaque = true;
|
||||
bool _renderOpaque = true;
|
||||
bool _cullTransparent = true;
|
||||
bool _sortTransparent = true;
|
||||
bool _renderTransparent = true;
|
||||
class Counter {
|
||||
public:
|
||||
Counter() {};
|
||||
Counter(const Counter& counter) {
|
||||
numFeed = numDrawn = 0;
|
||||
maxDrawn = counter.maxDrawn;
|
||||
};
|
||||
|
||||
int _numFeedOpaqueItems = 0;
|
||||
int _numDrawnOpaqueItems = 0;
|
||||
int _maxDrawnOpaqueItems = -1;
|
||||
inline void setCounts(const Counter& counter) {
|
||||
numFeed = counter.numFeed;
|
||||
numDrawn = counter.numDrawn;
|
||||
};
|
||||
|
||||
int numFeed = 0;
|
||||
int numDrawn = 0;
|
||||
int maxDrawn = -1;
|
||||
};
|
||||
|
||||
class State : public Counter {
|
||||
public:
|
||||
bool render = true;
|
||||
bool cull = true;
|
||||
bool sort = true;
|
||||
|
||||
Counter counter{};
|
||||
};
|
||||
|
||||
// TODO: If member count increases, store counters in a map instead of multiple members
|
||||
State opaque{};
|
||||
State transparent{};
|
||||
Counter overlay3D{};
|
||||
};
|
||||
|
||||
class Tone {
|
||||
public:
|
||||
int toneCurve = 1; // Means just Gamma 2.2 correction
|
||||
float exposure = 0.0;
|
||||
};
|
||||
|
||||
int _numFeedTransparentItems = 0;
|
||||
int _numDrawnTransparentItems = 0;
|
||||
int _maxDrawnTransparentItems = -1;
|
||||
RenderContext(RenderArgs* args, ItemsConfig items, Tone tone) : _args{args}, _items{items}, _tone{tone} {};
|
||||
RenderContext() : RenderContext(nullptr, {}, {}) {};
|
||||
|
||||
int _numFeedOverlay3DItems = 0;
|
||||
int _numDrawnOverlay3DItems = 0;
|
||||
int _maxDrawnOverlay3DItems = -1;
|
||||
inline RenderArgs* getArgs() { return _args; }
|
||||
inline ItemsConfig& getItemsConfig() { return _items; }
|
||||
inline Tone& getTone() { return _tone; }
|
||||
inline int getDrawStatus() { return _drawStatus; }
|
||||
inline bool getDrawHitEffect() { return _drawHitEffect; }
|
||||
inline bool getOcclusionStatus() { return _occlusionStatus; }
|
||||
inline bool getFxaaStatus() { return _fxaaStatus; }
|
||||
void setOptions(int drawStatus, bool drawHitEffect, bool occlusion, bool fxaa, bool showOwned);
|
||||
|
||||
// Debugging
|
||||
int _deferredDebugMode = -1;
|
||||
glm::vec4 _deferredDebugSize { 0.0f, -1.0f, 1.0f, 1.0f };
|
||||
int _drawItemStatus = 0;
|
||||
bool _drawHitEffect = false;
|
||||
|
||||
protected:
|
||||
RenderArgs* _args;
|
||||
|
||||
// Options
|
||||
int _drawStatus = 0; // bitflag
|
||||
bool _drawHitEffect = false;
|
||||
bool _occlusionStatus = false;
|
||||
bool _fxaaStatus = false;
|
||||
|
||||
float _toneMappingExposure = 0.0;
|
||||
int _toneMappingToneCurve = 3;
|
||||
|
||||
RenderContext() {}
|
||||
ItemsConfig _items;
|
||||
Tone _tone;
|
||||
};
|
||||
typedef std::shared_ptr<RenderContext> RenderContextPointer;
|
||||
|
||||
// THe base class for a task that runs on the SceneContext
|
||||
// The base class for a task that runs on the SceneContext
|
||||
class Task {
|
||||
public:
|
||||
Task() {}
|
||||
|
@ -81,7 +122,7 @@ protected:
|
|||
typedef std::shared_ptr<Task> TaskPointer;
|
||||
typedef std::vector<TaskPointer> Tasks;
|
||||
|
||||
// The root of the takss, the Engine, should not be known from the Tasks,
|
||||
// The root of the tasks, the Engine, should not be known from the Tasks,
|
||||
// The SceneContext is what navigates from the engine down to the Tasks
|
||||
class Engine {
|
||||
public:
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
set(TARGET_NAME script-engine)
|
||||
setup_hifi_library(Gui Network Script WebSockets Widgets)
|
||||
link_hifi_libraries(shared networking ui octree gpu procedural model model-networking recording avatars fbx entities controllers animation audio physics)
|
||||
link_hifi_libraries(shared networking octree gpu procedural model model-networking recording avatars fbx entities controllers animation audio physics)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// SceneScriptingInterface.cpp
|
||||
// interface/src/scripting
|
||||
// libraries/script-engine
|
||||
//
|
||||
// Created by Sam Gateau on 2/24/15.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
|
@ -11,16 +11,27 @@
|
|||
|
||||
#include "SceneScriptingInterface.h"
|
||||
|
||||
#include <AddressManager.h>
|
||||
|
||||
|
||||
#include <procedural/ProceduralSkybox.h>
|
||||
|
||||
SceneScriptingInterface::SceneScriptingInterface() {
|
||||
// Let's make sure the sunSkyStage is using a proceduralSKybox
|
||||
// Let's make sure the sunSkyStage is using a proceduralSkybox
|
||||
_skyStage->setSkybox(model::SkyboxPointer(new ProceduralSkybox()));
|
||||
}
|
||||
|
||||
void SceneScriptingInterface::setShouldRenderAvatars(bool shouldRenderAvatars) {
|
||||
if (shouldRenderAvatars != _shouldRenderAvatars) {
|
||||
_shouldRenderAvatars = shouldRenderAvatars;
|
||||
emit shouldRenderAvatarsChanged(_shouldRenderAvatars);
|
||||
}
|
||||
}
|
||||
|
||||
void SceneScriptingInterface::setShouldRenderEntities(bool shouldRenderEntities) {
|
||||
if (shouldRenderEntities != _shouldRenderEntities) {
|
||||
_shouldRenderEntities = shouldRenderEntities;
|
||||
emit shouldRenderEntitiesChanged(_shouldRenderEntities);
|
||||
}
|
||||
}
|
||||
|
||||
void SceneScriptingInterface::setStageOrientation(const glm::quat& orientation) {
|
||||
_skyStage->setOriginOrientation(orientation);
|
||||
}
|
||||
|
@ -120,77 +131,3 @@ QString SceneScriptingInterface::getBackgroundMode() const {
|
|||
model::SunSkyStagePointer SceneScriptingInterface::getSkyStage() const {
|
||||
return _skyStage;
|
||||
}
|
||||
|
||||
void SceneScriptingInterface::setShouldRenderAvatars(bool shouldRenderAvatars) {
|
||||
if (shouldRenderAvatars != _shouldRenderAvatars) {
|
||||
_shouldRenderAvatars = shouldRenderAvatars;
|
||||
emit shouldRenderAvatarsChanged(_shouldRenderAvatars);
|
||||
}
|
||||
}
|
||||
|
||||
void SceneScriptingInterface::setShouldRenderEntities(bool shouldRenderEntities) {
|
||||
if (shouldRenderEntities != _shouldRenderEntities) {
|
||||
_shouldRenderEntities = shouldRenderEntities;
|
||||
emit shouldRenderEntitiesChanged(_shouldRenderEntities);
|
||||
}
|
||||
}
|
||||
|
||||
void SceneScriptingInterface::setEngineRenderOpaque(bool renderOpaque) {
|
||||
_engineRenderOpaque = renderOpaque;
|
||||
}
|
||||
|
||||
void SceneScriptingInterface::setEngineRenderTransparent(bool renderTransparent) {
|
||||
_engineRenderTransparent = renderTransparent;
|
||||
}
|
||||
|
||||
void SceneScriptingInterface::setEngineCullOpaque(bool cullOpaque) {
|
||||
_engineCullOpaque = cullOpaque;
|
||||
}
|
||||
|
||||
void SceneScriptingInterface::setEngineCullTransparent(bool cullTransparent) {
|
||||
_engineCullTransparent = cullTransparent;
|
||||
}
|
||||
|
||||
void SceneScriptingInterface::setEngineSortOpaque(bool sortOpaque) {
|
||||
_engineSortOpaque = sortOpaque;
|
||||
}
|
||||
|
||||
void SceneScriptingInterface::setEngineSortTransparent(bool sortTransparent) {
|
||||
_engineSortOpaque = sortTransparent;
|
||||
}
|
||||
|
||||
void SceneScriptingInterface::clearEngineCounters() {
|
||||
_numFeedOpaqueItems = 0;
|
||||
_numDrawnOpaqueItems = 0;
|
||||
_numFeedTransparentItems = 0;
|
||||
_numDrawnTransparentItems = 0;
|
||||
_numFeedOverlay3DItems = 0;
|
||||
_numDrawnOverlay3DItems = 0;
|
||||
}
|
||||
|
||||
|
||||
void SceneScriptingInterface::setEngineToneMappingToneCurve(const QString& toneCurve) {
|
||||
if (toneCurve == QString("None")) {
|
||||
_engineToneMappingToneCurve = 0;
|
||||
} else if (toneCurve == QString("Gamma22")) {
|
||||
_engineToneMappingToneCurve = 1;
|
||||
} else if (toneCurve == QString("Reinhard")) {
|
||||
_engineToneMappingToneCurve = 2;
|
||||
} else if (toneCurve == QString("Filmic")) {
|
||||
_engineToneMappingToneCurve = 3;
|
||||
}
|
||||
}
|
||||
QString SceneScriptingInterface::getEngineToneMappingToneCurve() const {
|
||||
switch (_engineToneMappingToneCurve) {
|
||||
case 0:
|
||||
return QString("None");
|
||||
case 1:
|
||||
return QString("Gamma22");
|
||||
case 2:
|
||||
return QString("Reinhard");
|
||||
case 3:
|
||||
return QString("Filmic");
|
||||
default:
|
||||
return QString("Filmic");
|
||||
};
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// SceneScriptingInterface.h
|
||||
// interface/src/scripting
|
||||
// libraries/script-engine
|
||||
//
|
||||
// Created by Sam Gateau on 2/24/15.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
|
@ -12,9 +12,8 @@
|
|||
#ifndef hifi_SceneScriptingInterface_h
|
||||
#define hifi_SceneScriptingInterface_h
|
||||
|
||||
#include <qscriptengine.h>
|
||||
|
||||
#include <DependencyManager.h>
|
||||
#include <qscriptengine.h> // QObject
|
||||
#include <DependencyManager.h> // Dependency
|
||||
|
||||
#include "model/Stage.h"
|
||||
|
||||
|
@ -22,10 +21,16 @@ class SceneScriptingInterface : public QObject, public Dependency {
|
|||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY
|
||||
|
||||
public:
|
||||
Q_PROPERTY(bool shouldRenderAvatars READ shouldRenderAvatars WRITE setShouldRenderAvatars)
|
||||
Q_PROPERTY(bool shouldRenderEntities READ shouldRenderEntities WRITE setShouldRenderEntities)
|
||||
|
||||
public:
|
||||
Q_INVOKABLE void setShouldRenderAvatars(bool shouldRenderAvatars);
|
||||
Q_INVOKABLE bool shouldRenderAvatars() const { return _shouldRenderAvatars; }
|
||||
|
||||
Q_INVOKABLE void setShouldRenderEntities(bool shouldRenderEntities);
|
||||
Q_INVOKABLE bool shouldRenderEntities() const { return _shouldRenderEntities; }
|
||||
|
||||
Q_INVOKABLE void setStageOrientation(const glm::quat& orientation);
|
||||
|
||||
Q_INVOKABLE void setStageLocation(float longitude, float latitude, float altitude);
|
||||
|
@ -43,7 +48,6 @@ public:
|
|||
Q_INVOKABLE void setStageSunModelEnable(bool isEnabled);
|
||||
Q_INVOKABLE bool isStageSunModelEnabled() const;
|
||||
|
||||
|
||||
Q_INVOKABLE void setKeyLightColor(const glm::vec3& color);
|
||||
Q_INVOKABLE glm::vec3 getKeyLightColor() const;
|
||||
Q_INVOKABLE void setKeyLightIntensity(float intensity);
|
||||
|
@ -61,108 +65,19 @@ public:
|
|||
Q_INVOKABLE QString getBackgroundMode() const;
|
||||
|
||||
model::SunSkyStagePointer getSkyStage() const;
|
||||
|
||||
Q_INVOKABLE void setShouldRenderAvatars(bool shouldRenderAvatars);
|
||||
Q_INVOKABLE bool shouldRenderAvatars() const { return _shouldRenderAvatars; }
|
||||
|
||||
Q_INVOKABLE void setShouldRenderEntities(bool shouldRenderEntities);
|
||||
Q_INVOKABLE bool shouldRenderEntities() const { return _shouldRenderEntities; }
|
||||
|
||||
|
||||
// Controlling the rendering engine
|
||||
Q_INVOKABLE void setEngineRenderOpaque(bool renderOpaque);
|
||||
Q_INVOKABLE bool doEngineRenderOpaque() const { return _engineRenderOpaque; }
|
||||
Q_INVOKABLE void setEngineRenderTransparent(bool renderTransparent);
|
||||
Q_INVOKABLE bool doEngineRenderTransparent() const { return _engineRenderTransparent; }
|
||||
|
||||
Q_INVOKABLE void setEngineCullOpaque(bool cullOpaque);
|
||||
Q_INVOKABLE bool doEngineCullOpaque() const { return _engineCullOpaque; }
|
||||
Q_INVOKABLE void setEngineCullTransparent(bool cullTransparent);
|
||||
Q_INVOKABLE bool doEngineCullTransparent() const { return _engineCullTransparent; }
|
||||
|
||||
Q_INVOKABLE void setEngineSortOpaque(bool sortOpaque);
|
||||
Q_INVOKABLE bool doEngineSortOpaque() const { return _engineSortOpaque; }
|
||||
Q_INVOKABLE void setEngineSortTransparent(bool sortTransparent);
|
||||
Q_INVOKABLE bool doEngineSortTransparent() const { return _engineSortTransparent; }
|
||||
|
||||
void clearEngineCounters();
|
||||
void setEngineDrawnOpaqueItems(int count) { _numDrawnOpaqueItems = count; }
|
||||
Q_INVOKABLE int getEngineNumDrawnOpaqueItems() { return _numDrawnOpaqueItems; }
|
||||
void setEngineDrawnTransparentItems(int count) { _numDrawnTransparentItems = count; }
|
||||
Q_INVOKABLE int getEngineNumDrawnTransparentItems() { return _numDrawnTransparentItems; }
|
||||
void setEngineDrawnOverlay3DItems(int count) { _numDrawnOverlay3DItems = count; }
|
||||
Q_INVOKABLE int getEngineNumDrawnOverlay3DItems() { return _numDrawnOverlay3DItems; }
|
||||
|
||||
void setEngineFeedOpaqueItems(int count) { _numFeedOpaqueItems = count; }
|
||||
Q_INVOKABLE int getEngineNumFeedOpaqueItems() { return _numFeedOpaqueItems; }
|
||||
void setEngineFeedTransparentItems(int count) { _numFeedTransparentItems = count; }
|
||||
Q_INVOKABLE int getEngineNumFeedTransparentItems() { return _numFeedTransparentItems; }
|
||||
void setEngineFeedOverlay3DItems(int count) { _numFeedOverlay3DItems = count; }
|
||||
Q_INVOKABLE int getEngineNumFeedOverlay3DItems() { return _numFeedOverlay3DItems; }
|
||||
|
||||
Q_INVOKABLE void setEngineMaxDrawnOpaqueItems(int count) { _maxDrawnOpaqueItems = count; }
|
||||
Q_INVOKABLE int getEngineMaxDrawnOpaqueItems() { return _maxDrawnOpaqueItems; }
|
||||
Q_INVOKABLE void setEngineMaxDrawnTransparentItems(int count) { _maxDrawnTransparentItems = count; }
|
||||
Q_INVOKABLE int getEngineMaxDrawnTransparentItems() { return _maxDrawnTransparentItems; }
|
||||
Q_INVOKABLE void setEngineMaxDrawnOverlay3DItems(int count) { _maxDrawnOverlay3DItems = count; }
|
||||
Q_INVOKABLE int getEngineMaxDrawnOverlay3DItems() { return _maxDrawnOverlay3DItems; }
|
||||
|
||||
Q_INVOKABLE void setEngineDeferredDebugMode(int mode) { _deferredDebugMode = mode; }
|
||||
Q_INVOKABLE int getEngineDeferredDebugMode() { return _deferredDebugMode; }
|
||||
Q_INVOKABLE void setEngineDeferredDebugSize(glm::vec4 size) { _deferredDebugSize = size; }
|
||||
Q_INVOKABLE glm::vec4 getEngineDeferredDebugSize() { return _deferredDebugSize; }
|
||||
|
||||
Q_INVOKABLE void setEngineDisplayItemStatus(int display) { _drawItemStatus = display; }
|
||||
Q_INVOKABLE int doEngineDisplayItemStatus() { return _drawItemStatus; }
|
||||
|
||||
Q_INVOKABLE void setEngineDisplayHitEffect(bool display) { _drawHitEffect = display; }
|
||||
Q_INVOKABLE bool doEngineDisplayHitEffect() { return _drawHitEffect; }
|
||||
|
||||
Q_INVOKABLE void setEngineToneMappingExposure(float exposure) { _engineToneMappingExposure = exposure; }
|
||||
Q_INVOKABLE float getEngineToneMappingExposure() const { return _engineToneMappingExposure; }
|
||||
|
||||
Q_INVOKABLE void setEngineToneMappingToneCurve(const QString& curve);
|
||||
Q_INVOKABLE QString getEngineToneMappingToneCurve() const;
|
||||
int getEngineToneMappingToneCurveValue() const { return _engineToneMappingToneCurve; }
|
||||
|
||||
signals:
|
||||
void shouldRenderAvatarsChanged(bool shouldRenderAvatars);
|
||||
void shouldRenderEntitiesChanged(bool shouldRenderEntities);
|
||||
|
||||
protected:
|
||||
SceneScriptingInterface();
|
||||
~SceneScriptingInterface() {};
|
||||
|
||||
model::SunSkyStagePointer _skyStage = std::make_shared<model::SunSkyStage>();
|
||||
|
||||
|
||||
bool _shouldRenderAvatars = true;
|
||||
bool _shouldRenderEntities = true;
|
||||
|
||||
bool _engineRenderOpaque = true;
|
||||
bool _engineRenderTransparent = true;
|
||||
bool _engineCullOpaque = true;
|
||||
bool _engineCullTransparent = true;
|
||||
bool _engineSortOpaque = true;
|
||||
bool _engineSortTransparent = true;
|
||||
|
||||
int _numFeedOpaqueItems = 0;
|
||||
int _numDrawnOpaqueItems = 0;
|
||||
int _numFeedTransparentItems = 0;
|
||||
int _numDrawnTransparentItems = 0;
|
||||
int _numFeedOverlay3DItems = 0;
|
||||
int _numDrawnOverlay3DItems = 0;
|
||||
|
||||
int _maxDrawnOpaqueItems = -1;
|
||||
int _maxDrawnTransparentItems = -1;
|
||||
int _maxDrawnOverlay3DItems = -1;
|
||||
|
||||
int _deferredDebugMode = -1;
|
||||
glm::vec4 _deferredDebugSize { 0.0f, -1.0f, 1.0f, 1.0f };
|
||||
int _drawItemStatus = 0;
|
||||
|
||||
bool _drawHitEffect = false;
|
||||
|
||||
float _engineToneMappingExposure = 0.0f;
|
||||
int _engineToneMappingToneCurve = 3;
|
||||
};
|
||||
|
||||
#endif // hifi_SceneScriptingInterface_h
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <udt/PacketHeaders.h>
|
||||
#include <UUID.h>
|
||||
|
||||
#include <QmlWebWindowClass.h>
|
||||
#include <controllers/ScriptingInterface.h>
|
||||
#include <AnimationObject.h>
|
||||
|
||||
|
@ -47,7 +46,6 @@
|
|||
#include "XMLHttpRequestClass.h"
|
||||
#include "WebSocketClass.h"
|
||||
|
||||
#include "SceneScriptingInterface.h"
|
||||
#include "RecordingScriptingInterface.h"
|
||||
|
||||
#include "MIDIEvent.h"
|
||||
|
@ -351,8 +349,6 @@ void ScriptEngine::init() {
|
|||
qScriptRegisterSequenceMetaType<QVector<glm::quat> >(this);
|
||||
qScriptRegisterSequenceMetaType<QVector<QString> >(this);
|
||||
|
||||
|
||||
registerFunction("OverlayWebWindow", QmlWebWindowClass::constructor);
|
||||
QScriptValue xmlHttpRequestConstructorValue = newFunction(XMLHttpRequestClass::constructor);
|
||||
globalObject().setProperty("XMLHttpRequest", xmlHttpRequestConstructorValue);
|
||||
|
||||
|
|
Loading…
Reference in a new issue