mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:16:51 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into cleanupVersions
This commit is contained in:
commit
3ded26b0e9
10 changed files with 76 additions and 36 deletions
|
@ -588,6 +588,7 @@ void EntityScriptServer::aboutToFinish() {
|
||||||
// cleanup the AudioInjectorManager (and any still running injectors)
|
// cleanup the AudioInjectorManager (and any still running injectors)
|
||||||
DependencyManager::destroy<AudioInjectorManager>();
|
DependencyManager::destroy<AudioInjectorManager>();
|
||||||
DependencyManager::destroy<ScriptEngines>();
|
DependencyManager::destroy<ScriptEngines>();
|
||||||
|
DependencyManager::destroy<EntityScriptServerServices>();
|
||||||
|
|
||||||
// cleanup codec & encoder
|
// cleanup codec & encoder
|
||||||
if (_codec && _encoder) {
|
if (_codec && _encoder) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// interface/src/ui/overlays
|
// interface/src/ui/overlays
|
||||||
//
|
//
|
||||||
// Created by Zander Otavka on 8/7/15.
|
// Created by Zander Otavka on 8/7/15.
|
||||||
|
// Modified by Daniela Fontes on 24/10/17.
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Transform.h>
|
#include <Transform.h>
|
||||||
|
#include "avatar/AvatarManager.h"
|
||||||
|
|
||||||
void Billboardable::setProperties(const QVariantMap& properties) {
|
void Billboardable::setProperties(const QVariantMap& properties) {
|
||||||
auto isFacingAvatar = properties["isFacingAvatar"];
|
auto isFacingAvatar = properties["isFacingAvatar"];
|
||||||
|
@ -32,10 +34,11 @@ bool Billboardable::pointTransformAtCamera(Transform& transform, glm::quat offse
|
||||||
if (isFacingAvatar()) {
|
if (isFacingAvatar()) {
|
||||||
glm::vec3 billboardPos = transform.getTranslation();
|
glm::vec3 billboardPos = transform.getTranslation();
|
||||||
glm::vec3 cameraPos = qApp->getCamera().getPosition();
|
glm::vec3 cameraPos = qApp->getCamera().getPosition();
|
||||||
glm::vec3 look = cameraPos - billboardPos;
|
// use the referencial from the avatar, y isn't always up
|
||||||
float elevation = -asinf(look.y / glm::length(look));
|
glm::vec3 avatarUP = DependencyManager::get<AvatarManager>()->getMyAvatar()->getOrientation()*Vectors::UP;
|
||||||
float azimuth = atan2f(look.x, look.z);
|
|
||||||
glm::quat rotation(glm::vec3(elevation, azimuth, 0));
|
glm::quat rotation(conjugate(toQuat(glm::lookAt(billboardPos, cameraPos, avatarUP))));
|
||||||
|
|
||||||
transform.setRotation(rotation);
|
transform.setRotation(rotation);
|
||||||
transform.postRotate(offsetRotation);
|
transform.postRotate(offsetRotation);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -112,6 +112,7 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
||||||
// Do we need to allocate the light in the stage ?
|
// Do we need to allocate the light in the stage ?
|
||||||
if (LightStage::isIndexInvalid(_sunIndex)) {
|
if (LightStage::isIndexInvalid(_sunIndex)) {
|
||||||
_sunIndex = _stage->addLight(_sunLight);
|
_sunIndex = _stage->addLight(_sunLight);
|
||||||
|
_shadowIndex = _stage->addShadow(_sunIndex);
|
||||||
} else {
|
} else {
|
||||||
_stage->updateLightArrayBuffer(_sunIndex);
|
_stage->updateLightArrayBuffer(_sunIndex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,7 @@ private:
|
||||||
ComponentMode _hazeMode{ COMPONENT_MODE_INHERIT };
|
ComponentMode _hazeMode{ COMPONENT_MODE_INHERIT };
|
||||||
|
|
||||||
indexed_container::Index _sunIndex{ LightStage::INVALID_INDEX };
|
indexed_container::Index _sunIndex{ LightStage::INVALID_INDEX };
|
||||||
|
indexed_container::Index _shadowIndex{ LightStage::INVALID_INDEX };
|
||||||
indexed_container::Index _ambientIndex{ LightStage::INVALID_INDEX };
|
indexed_container::Index _ambientIndex{ LightStage::INVALID_INDEX };
|
||||||
|
|
||||||
BackgroundStagePointer _backgroundStage;
|
BackgroundStagePointer _backgroundStage;
|
||||||
|
|
|
@ -435,7 +435,7 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I
|
||||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||||
assert(lightStage);
|
assert(lightStage);
|
||||||
assert(lightStage->getNumLights() > 0);
|
assert(lightStage->getNumLights() > 0);
|
||||||
auto lightAndShadow = lightStage->getLightAndShadow(0);
|
auto lightAndShadow = lightStage->getCurrentKeyLightAndShadow();
|
||||||
const auto& globalShadow = lightAndShadow.second;
|
const auto& globalShadow = lightAndShadow.second;
|
||||||
if (globalShadow) {
|
if (globalShadow) {
|
||||||
batch.setResourceTexture(Shadow, globalShadow->map);
|
batch.setResourceTexture(Shadow, globalShadow->map);
|
||||||
|
|
|
@ -498,7 +498,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
|
||||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||||
assert(lightStage);
|
assert(lightStage);
|
||||||
assert(lightStage->getNumLights() > 0);
|
assert(lightStage->getNumLights() > 0);
|
||||||
auto lightAndShadow = lightStage->getLightAndShadow(0);
|
auto lightAndShadow = lightStage->getCurrentKeyLightAndShadow();
|
||||||
const auto& globalShadow = lightAndShadow.second;
|
const auto& globalShadow = lightAndShadow.second;
|
||||||
|
|
||||||
// Bind the shadow buffer
|
// Bind the shadow buffer
|
||||||
|
@ -509,7 +509,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
|
||||||
auto& program = deferredLightingEffect->_directionalSkyboxLight;
|
auto& program = deferredLightingEffect->_directionalSkyboxLight;
|
||||||
LightLocationsPtr locations = deferredLightingEffect->_directionalSkyboxLightLocations;
|
LightLocationsPtr locations = deferredLightingEffect->_directionalSkyboxLightLocations;
|
||||||
|
|
||||||
auto keyLight = lightStage->getLight(0);
|
auto keyLight = lightAndShadow.first;
|
||||||
|
|
||||||
// Setup the global directional pass pipeline
|
// Setup the global directional pass pipeline
|
||||||
{
|
{
|
||||||
|
|
|
@ -142,6 +142,11 @@ LightStage::LightPointer LightStage::removeLight(Index index) {
|
||||||
LightPointer removed = _lights.freeElement(index);
|
LightPointer removed = _lights.freeElement(index);
|
||||||
|
|
||||||
if (removed) {
|
if (removed) {
|
||||||
|
auto shadowId = _descs[index].shadowId;
|
||||||
|
// Remove shadow if one exists for this light
|
||||||
|
if (shadowId != INVALID_INDEX) {
|
||||||
|
_shadows.freeElement(shadowId);
|
||||||
|
}
|
||||||
_lightMap.erase(removed);
|
_lightMap.erase(removed);
|
||||||
_descs[index] = Desc();
|
_descs[index] = Desc();
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,30 @@ public:
|
||||||
return LightAndShadow(getLight(lightId), getShadow(lightId));
|
return LightAndShadow(getLight(lightId), getShadow(lightId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LightPointer getCurrentKeyLight() const {
|
||||||
|
Index keyLightId{ 0 };
|
||||||
|
if (!_currentFrame._sunLights.empty()) {
|
||||||
|
keyLightId = _currentFrame._sunLights.front();
|
||||||
|
}
|
||||||
|
return _lights.get(keyLightId);
|
||||||
|
}
|
||||||
|
|
||||||
|
ShadowPointer getCurrentKeyShadow() const {
|
||||||
|
Index keyLightId{ 0 };
|
||||||
|
if (!_currentFrame._sunLights.empty()) {
|
||||||
|
keyLightId = _currentFrame._sunLights.front();
|
||||||
|
}
|
||||||
|
return getShadow(keyLightId);
|
||||||
|
}
|
||||||
|
|
||||||
|
LightAndShadow getCurrentKeyLightAndShadow() const {
|
||||||
|
Index keyLightId{ 0 };
|
||||||
|
if (!_currentFrame._sunLights.empty()) {
|
||||||
|
keyLightId = _currentFrame._sunLights.front();
|
||||||
|
}
|
||||||
|
return LightAndShadow(getLight(keyLightId), getShadow(keyLightId));
|
||||||
|
}
|
||||||
|
|
||||||
LightStage();
|
LightStage();
|
||||||
Lights _lights;
|
Lights _lights;
|
||||||
LightMap _lightMap;
|
LightMap _lightMap;
|
||||||
|
|
|
@ -33,10 +33,8 @@ void RenderShadowMap::run(const render::RenderContextPointer& renderContext,
|
||||||
|
|
||||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||||
assert(lightStage);
|
assert(lightStage);
|
||||||
LightStage::Index globalLightIndex { 0 };
|
|
||||||
|
|
||||||
const auto globalLight = lightStage->getLight(globalLightIndex);
|
const auto shadow = lightStage->getCurrentKeyShadow();
|
||||||
const auto shadow = lightStage->getShadow(globalLightIndex);
|
|
||||||
if (!shadow) return;
|
if (!shadow) return;
|
||||||
|
|
||||||
const auto& fbo = shadow->framebuffer;
|
const auto& fbo = shadow->framebuffer;
|
||||||
|
@ -128,20 +126,22 @@ void RenderShadowTask::configure(const Config& configuration) {
|
||||||
void RenderShadowSetup::run(const render::RenderContextPointer& renderContext, Output& output) {
|
void RenderShadowSetup::run(const render::RenderContextPointer& renderContext, Output& output) {
|
||||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||||
assert(lightStage);
|
assert(lightStage);
|
||||||
const auto globalShadow = lightStage->getShadow(0);
|
|
||||||
|
|
||||||
// Cache old render args
|
const auto globalShadow = lightStage->getCurrentKeyShadow();
|
||||||
RenderArgs* args = renderContext->args;
|
if (globalShadow) {
|
||||||
output = args->_renderMode;
|
// Cache old render args
|
||||||
|
RenderArgs* args = renderContext->args;
|
||||||
|
output = args->_renderMode;
|
||||||
|
|
||||||
auto nearClip = args->getViewFrustum().getNearClip();
|
auto nearClip = args->getViewFrustum().getNearClip();
|
||||||
float nearDepth = -args->_boomOffset.z;
|
float nearDepth = -args->_boomOffset.z;
|
||||||
const int SHADOW_FAR_DEPTH = 20;
|
const int SHADOW_FAR_DEPTH = 20;
|
||||||
globalShadow->setKeylightFrustum(args->getViewFrustum(), nearDepth, nearClip + SHADOW_FAR_DEPTH);
|
globalShadow->setKeylightFrustum(args->getViewFrustum(), nearDepth, nearClip + SHADOW_FAR_DEPTH);
|
||||||
|
|
||||||
// Set the keylight render args
|
// Set the keylight render args
|
||||||
args->pushViewFrustum(*(globalShadow->getFrustum()));
|
args->pushViewFrustum(*(globalShadow->getFrustum()));
|
||||||
args->_renderMode = RenderArgs::SHADOW_RENDER_MODE;
|
args->_renderMode = RenderArgs::SHADOW_RENDER_MODE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderShadowTeardown::run(const render::RenderContextPointer& renderContext, const Input& input) {
|
void RenderShadowTeardown::run(const render::RenderContextPointer& renderContext, const Input& input) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// examples
|
// examples
|
||||||
//
|
//
|
||||||
// Created by Brad hefta-Gaub on 10/1/14.
|
// Created by Brad hefta-Gaub on 10/1/14.
|
||||||
// Modified by Daniela Fontes @DanielaFifo and Tiago Andrade @TagoWill on 4/7/2017
|
// Modified by Daniela Fontes * @DanielaFifo and Tiago Andrade @TagoWill on 4/7/2017
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// This script implements a class useful for building tools for editing entities.
|
// This script implements a class useful for building tools for editing entities.
|
||||||
|
@ -203,6 +203,7 @@ SelectionManager = (function() {
|
||||||
print("ERROR: entitySelectionTool.update got exception: " + JSON.stringify(e));
|
print("ERROR: entitySelectionTool.update got exception: " + JSON.stringify(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
|
@ -1422,11 +1423,11 @@ SelectionDisplay = (function() {
|
||||||
Overlays.editOverlay(rollHandle, {
|
Overlays.editOverlay(rollHandle, {
|
||||||
scale: handleSize
|
scale: handleSize
|
||||||
});
|
});
|
||||||
var pos = Vec3.sum(grabberMoveUpPosition, {
|
var upDiff = Vec3.multiply((
|
||||||
x: 0,
|
Vec3.length(diff) * GRABBER_DISTANCE_TO_SIZE_RATIO * 3),
|
||||||
y: Vec3.length(diff) * GRABBER_DISTANCE_TO_SIZE_RATIO * 3,
|
Quat.getUp(MyAvatar.orientation)
|
||||||
z: 0
|
);
|
||||||
});
|
var pos = Vec3.sum(grabberMoveUpPosition, upDiff);
|
||||||
Overlays.editOverlay(grabberMoveUp, {
|
Overlays.editOverlay(grabberMoveUp, {
|
||||||
position: pos,
|
position: pos,
|
||||||
scale: handleSize / 1.25
|
scale: handleSize / 1.25
|
||||||
|
@ -2099,10 +2100,11 @@ SelectionDisplay = (function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
var grabberMoveUpOffset = 0.1;
|
var grabberMoveUpOffset = 0.1;
|
||||||
|
var upVec = Quat.getUp(MyAvatar.orientation);
|
||||||
grabberMoveUpPosition = {
|
grabberMoveUpPosition = {
|
||||||
x: position.x,
|
x: position.x + (grabberMoveUpOffset + worldTop) * upVec.x ,
|
||||||
y: position.y + worldTop + grabberMoveUpOffset,
|
y: position.y+ (grabberMoveUpOffset + worldTop) * upVec.y,
|
||||||
z: position.z
|
z: position.z + (grabberMoveUpOffset + worldTop) * upVec.z
|
||||||
};
|
};
|
||||||
Overlays.editOverlay(grabberMoveUp, {
|
Overlays.editOverlay(grabberMoveUp, {
|
||||||
visible: (!activeTool) || isActiveTool(grabberMoveUp)
|
visible: (!activeTool) || isActiveTool(grabberMoveUp)
|
||||||
|
@ -2416,9 +2418,6 @@ SelectionDisplay = (function() {
|
||||||
mode: "TRANSLATE_UP_DOWN",
|
mode: "TRANSLATE_UP_DOWN",
|
||||||
onBegin: function(event, pickRay, pickResult) {
|
onBegin: function(event, pickRay, pickResult) {
|
||||||
upDownPickNormal = Quat.getForward(lastCameraOrientation);
|
upDownPickNormal = Quat.getForward(lastCameraOrientation);
|
||||||
// Remove y component so the y-axis lies along the plane we're picking on - this will
|
|
||||||
// give movements that follow the mouse.
|
|
||||||
upDownPickNormal.y = 0;
|
|
||||||
lastXYPick = rayPlaneIntersection(pickRay, SelectionManager.worldPosition, upDownPickNormal);
|
lastXYPick = rayPlaneIntersection(pickRay, SelectionManager.worldPosition, upDownPickNormal);
|
||||||
|
|
||||||
SelectionManager.saveProperties();
|
SelectionManager.saveProperties();
|
||||||
|
@ -2455,11 +2454,17 @@ SelectionDisplay = (function() {
|
||||||
var newIntersection = rayPlaneIntersection(pickRay, SelectionManager.worldPosition, upDownPickNormal);
|
var newIntersection = rayPlaneIntersection(pickRay, SelectionManager.worldPosition, upDownPickNormal);
|
||||||
|
|
||||||
var vector = Vec3.subtract(newIntersection, lastXYPick);
|
var vector = Vec3.subtract(newIntersection, lastXYPick);
|
||||||
|
|
||||||
|
// project vector onto avatar up vector
|
||||||
|
// we want the avatar referential not the camera.
|
||||||
|
var avatarUpVector = Quat.getUp(MyAvatar.orientation);
|
||||||
|
var dotVectorUp = Vec3.dot(vector, avatarUpVector);
|
||||||
|
vector = Vec3.multiply(dotVectorUp, avatarUpVector);
|
||||||
|
|
||||||
|
|
||||||
vector = grid.snapToGrid(vector);
|
vector = grid.snapToGrid(vector);
|
||||||
|
|
||||||
// we only care about the Y axis
|
|
||||||
vector.x = 0;
|
|
||||||
vector.z = 0;
|
|
||||||
|
|
||||||
var wantDebug = false;
|
var wantDebug = false;
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
|
|
Loading…
Reference in a new issue