mirror of
https://github.com/overte-org/overte.git
synced 2025-08-15 07:14:58 +02:00
merge upstream/master into andrew/thermonuclear
This commit is contained in:
commit
d84f57fafa
20 changed files with 233 additions and 168 deletions
|
@ -205,7 +205,9 @@ SelectionDisplay = (function () {
|
|||
|
||||
var MINIMUM_DIMENSION = 0.001;
|
||||
|
||||
var GRABBER_DISTANCE_TO_SIZE_RATIO = 0.015;
|
||||
var GRABBER_DISTANCE_TO_SIZE_RATIO = 0.0075;
|
||||
|
||||
var showExtendedStretchHandles = false;
|
||||
|
||||
var spaceMode = SPACE_LOCAL;
|
||||
var mode = "UNKNOWN";
|
||||
|
@ -260,6 +262,7 @@ SelectionDisplay = (function () {
|
|||
var grabberColorFace = { red: 120, green: 120, blue: 120 };
|
||||
var grabberLineWidth = 0.5;
|
||||
var grabberSolid = true;
|
||||
var grabberMoveUpPosition = { x: 0, y: 0, z: 0 };
|
||||
|
||||
var grabberPropertiesCorner = {
|
||||
position: { x:0, y: 0, z: 0},
|
||||
|
@ -270,6 +273,8 @@ SelectionDisplay = (function () {
|
|||
visible: false,
|
||||
dashed: false,
|
||||
lineWidth: grabberLineWidth,
|
||||
drawInFront: true,
|
||||
borderSize: 1.4,
|
||||
};
|
||||
|
||||
var grabberPropertiesEdge = {
|
||||
|
@ -281,6 +286,8 @@ SelectionDisplay = (function () {
|
|||
visible: false,
|
||||
dashed: false,
|
||||
lineWidth: grabberLineWidth,
|
||||
drawInFront: true,
|
||||
borderSize: 1.4,
|
||||
};
|
||||
|
||||
var grabberPropertiesFace = {
|
||||
|
@ -292,6 +299,8 @@ SelectionDisplay = (function () {
|
|||
visible: false,
|
||||
dashed: false,
|
||||
lineWidth: grabberLineWidth,
|
||||
drawInFront: true,
|
||||
borderSize: 1.4,
|
||||
};
|
||||
|
||||
var highlightBox = Overlays.addOverlay("cube", {
|
||||
|
@ -325,7 +334,8 @@ SelectionDisplay = (function () {
|
|||
visible: false,
|
||||
size: 0.1,
|
||||
scale: 0.1,
|
||||
isFacingAvatar: true
|
||||
isFacingAvatar: true,
|
||||
drawInFront: true,
|
||||
});
|
||||
|
||||
// var normalLine = Overlays.addOverlay("line3d", {
|
||||
|
@ -532,7 +542,8 @@ SelectionDisplay = (function () {
|
|||
visible: false,
|
||||
size: 0.1,
|
||||
scale: 0.1,
|
||||
isFacingAvatar: false
|
||||
isFacingAvatar: false,
|
||||
drawInFront: true,
|
||||
});
|
||||
|
||||
|
||||
|
@ -544,7 +555,8 @@ SelectionDisplay = (function () {
|
|||
visible: false,
|
||||
size: 0.1,
|
||||
scale: 0.1,
|
||||
isFacingAvatar: false
|
||||
isFacingAvatar: false,
|
||||
drawInFront: true,
|
||||
});
|
||||
|
||||
|
||||
|
@ -556,7 +568,8 @@ SelectionDisplay = (function () {
|
|||
visible: false,
|
||||
size: 0.1,
|
||||
scale: 0.1,
|
||||
isFacingAvatar: false
|
||||
isFacingAvatar: false,
|
||||
drawInFront: true,
|
||||
});
|
||||
|
||||
var allOverlays = [
|
||||
|
@ -1056,21 +1069,23 @@ SelectionDisplay = (function () {
|
|||
EdgeFL = Vec3.sum(position, EdgeFL);
|
||||
|
||||
var stretchHandlesVisible = spaceMode == SPACE_LOCAL;
|
||||
var extendedStretchHandlesVisible = stretchHandlesVisible && showExtendedStretchHandles;
|
||||
Overlays.editOverlay(grabberLBN, { visible: stretchHandlesVisible, rotation: rotation, position: LBN });
|
||||
Overlays.editOverlay(grabberRBN, { visible: stretchHandlesVisible, rotation: rotation, position: RBN });
|
||||
Overlays.editOverlay(grabberLBF, { visible: stretchHandlesVisible, rotation: rotation, position: LBF });
|
||||
Overlays.editOverlay(grabberRBF, { visible: stretchHandlesVisible, rotation: rotation, position: RBF });
|
||||
Overlays.editOverlay(grabberLTN, { visible: stretchHandlesVisible, rotation: rotation, position: LTN });
|
||||
Overlays.editOverlay(grabberRTN, { visible: stretchHandlesVisible, rotation: rotation, position: RTN });
|
||||
Overlays.editOverlay(grabberLTF, { visible: stretchHandlesVisible, rotation: rotation, position: LTF });
|
||||
Overlays.editOverlay(grabberRTF, { visible: stretchHandlesVisible, rotation: rotation, position: RTF });
|
||||
|
||||
Overlays.editOverlay(grabberLTN, { visible: extendedStretchHandlesVisible, rotation: rotation, position: LTN });
|
||||
Overlays.editOverlay(grabberRTN, { visible: extendedStretchHandlesVisible, rotation: rotation, position: RTN });
|
||||
Overlays.editOverlay(grabberLTF, { visible: extendedStretchHandlesVisible, rotation: rotation, position: LTF });
|
||||
Overlays.editOverlay(grabberRTF, { visible: extendedStretchHandlesVisible, rotation: rotation, position: RTF });
|
||||
|
||||
Overlays.editOverlay(grabberTOP, { visible: stretchHandlesVisible, rotation: rotation, position: TOP });
|
||||
Overlays.editOverlay(grabberBOTTOM, { visible: stretchHandlesVisible, rotation: rotation, position: BOTTOM });
|
||||
Overlays.editOverlay(grabberLEFT, { visible: stretchHandlesVisible, rotation: rotation, position: LEFT });
|
||||
Overlays.editOverlay(grabberRIGHT, { visible: stretchHandlesVisible, rotation: rotation, position: RIGHT });
|
||||
Overlays.editOverlay(grabberNEAR, { visible: stretchHandlesVisible, rotation: rotation, position: NEAR });
|
||||
Overlays.editOverlay(grabberFAR, { visible: stretchHandlesVisible, rotation: rotation, position: FAR });
|
||||
Overlays.editOverlay(grabberLEFT, { visible: extendedStretchHandlesVisible, rotation: rotation, position: LEFT });
|
||||
Overlays.editOverlay(grabberRIGHT, { visible: extendedStretchHandlesVisible, rotation: rotation, position: RIGHT });
|
||||
Overlays.editOverlay(grabberNEAR, { visible: extendedStretchHandlesVisible, rotation: rotation, position: NEAR });
|
||||
Overlays.editOverlay(grabberFAR, { visible: extendedStretchHandlesVisible, rotation: rotation, position: FAR });
|
||||
|
||||
Overlays.editOverlay(selectionBox, {
|
||||
position: position,
|
||||
|
@ -1079,21 +1094,22 @@ SelectionDisplay = (function () {
|
|||
visible: !(mode == "ROTATE_YAW" || mode == "ROTATE_PITCH" || mode == "ROTATE_ROLL"),
|
||||
});
|
||||
|
||||
Overlays.editOverlay(grabberEdgeTR, { visible: stretchHandlesVisible, rotation: rotation, position: EdgeTR });
|
||||
Overlays.editOverlay(grabberEdgeTL, { visible: stretchHandlesVisible, rotation: rotation, position: EdgeTL });
|
||||
Overlays.editOverlay(grabberEdgeTF, { visible: stretchHandlesVisible, rotation: rotation, position: EdgeTF });
|
||||
Overlays.editOverlay(grabberEdgeTN, { visible: stretchHandlesVisible, rotation: rotation, position: EdgeTN });
|
||||
Overlays.editOverlay(grabberEdgeTR, { visible: extendedStretchHandlesVisible, rotation: rotation, position: EdgeTR });
|
||||
Overlays.editOverlay(grabberEdgeTL, { visible: extendedStretchHandlesVisible, rotation: rotation, position: EdgeTL });
|
||||
Overlays.editOverlay(grabberEdgeTF, { visible: extendedStretchHandlesVisible, rotation: rotation, position: EdgeTF });
|
||||
Overlays.editOverlay(grabberEdgeTN, { visible: extendedStretchHandlesVisible, rotation: rotation, position: EdgeTN });
|
||||
Overlays.editOverlay(grabberEdgeBR, { visible: stretchHandlesVisible, rotation: rotation, position: EdgeBR });
|
||||
Overlays.editOverlay(grabberEdgeBL, { visible: stretchHandlesVisible, rotation: rotation, position: EdgeBL });
|
||||
Overlays.editOverlay(grabberEdgeBF, { visible: stretchHandlesVisible, rotation: rotation, position: EdgeBF });
|
||||
Overlays.editOverlay(grabberEdgeBN, { visible: stretchHandlesVisible, rotation: rotation, position: EdgeBN });
|
||||
Overlays.editOverlay(grabberEdgeNR, { visible: stretchHandlesVisible, rotation: rotation, position: EdgeNR });
|
||||
Overlays.editOverlay(grabberEdgeNL, { visible: stretchHandlesVisible, rotation: rotation, position: EdgeNL });
|
||||
Overlays.editOverlay(grabberEdgeFR, { visible: stretchHandlesVisible, rotation: rotation, position: EdgeFR });
|
||||
Overlays.editOverlay(grabberEdgeFL, { visible: stretchHandlesVisible, rotation: rotation, position: EdgeFL });
|
||||
Overlays.editOverlay(grabberEdgeNR, { visible: extendedStretchHandlesVisible, rotation: rotation, position: EdgeNR });
|
||||
Overlays.editOverlay(grabberEdgeNL, { visible: extendedStretchHandlesVisible, rotation: rotation, position: EdgeNL });
|
||||
Overlays.editOverlay(grabberEdgeFR, { visible: extendedStretchHandlesVisible, rotation: rotation, position: EdgeFR });
|
||||
Overlays.editOverlay(grabberEdgeFL, { visible: extendedStretchHandlesVisible, rotation: rotation, position: EdgeFL });
|
||||
|
||||
var grabberMoveUpOffset = 0.1;
|
||||
Overlays.editOverlay(grabberMoveUp, { visible: activeTool == null || mode == "TRANSLATE_UP_DOWN", position: { x: position.x, y: position.y + worldTop + grabberMoveUpOffset, z: position.z } });
|
||||
grabberMoveUpPosition = { x: position.x, y: position.y + worldTop + grabberMoveUpOffset, z: position.z }
|
||||
Overlays.editOverlay(grabberMoveUp, { visible: activeTool == null || mode == "TRANSLATE_UP_DOWN" });
|
||||
};
|
||||
|
||||
that.setOverlaysVisible = function(isVisible) {
|
||||
|
@ -1505,10 +1521,10 @@ SelectionDisplay = (function () {
|
|||
addStretchTool(grabberEdgeTL, "STRETCH_EdgeTL", null, {x: -1, y: 1, z: 0});
|
||||
addStretchTool(grabberEdgeTF, "STRETCH_EdgeTF", null, {x: 0, y: 1, z: -1});
|
||||
addStretchTool(grabberEdgeTN, "STRETCH_EdgeTN", null, {x: 0, y: 1, z: 1});
|
||||
addStretchTool(grabberEdgeBR, "STRETCH_EdgeBR", null, {x: 1, y: -1, z: 0});
|
||||
addStretchTool(grabberEdgeBL, "STRETCH_EdgeBL", null, {x: -1, y: -1, z: 0});
|
||||
addStretchTool(grabberEdgeBF, "STRETCH_EdgeBF", null, {x: 0, y: -1, z: 1});
|
||||
addStretchTool(grabberEdgeBN, "STRETCH_EdgeBN", null, {x: 0, y: -1, z: -1});
|
||||
addStretchTool(grabberEdgeBR, "STRETCH_EdgeBR", null, {x: -1, y: 0, z: 0});
|
||||
addStretchTool(grabberEdgeBL, "STRETCH_EdgeBL", null, {x: 1, y: 0, z: 0});
|
||||
addStretchTool(grabberEdgeBF, "STRETCH_EdgeBF", null, {x: 0, y: 0, z: -1});
|
||||
addStretchTool(grabberEdgeBN, "STRETCH_EdgeBN", null, {x: 0, y: 0, z: 1});
|
||||
addStretchTool(grabberEdgeNR, "STRETCH_EdgeNR", null, {x: -1, y: 0, z: 1});
|
||||
addStretchTool(grabberEdgeNL, "STRETCH_EdgeNL", null, {x: 1, y: 0, z: 1});
|
||||
addStretchTool(grabberEdgeFR, "STRETCH_EdgeFR", null, {x: -1, y: 0, z: -1});
|
||||
|
@ -2287,7 +2303,7 @@ SelectionDisplay = (function () {
|
|||
size: grabberSize,
|
||||
});
|
||||
}
|
||||
var handleSize = Vec3.length(diff) * GRABBER_DISTANCE_TO_SIZE_RATIO * 5;
|
||||
var handleSize = Vec3.length(diff) * GRABBER_DISTANCE_TO_SIZE_RATIO * 10;
|
||||
Overlays.editOverlay(yawHandle, {
|
||||
scale: handleSize,
|
||||
});
|
||||
|
@ -2297,8 +2313,10 @@ SelectionDisplay = (function () {
|
|||
Overlays.editOverlay(rollHandle, {
|
||||
scale: handleSize,
|
||||
});
|
||||
var pos = Vec3.sum(grabberMoveUpPosition, { x: 0, y: Vec3.length(diff) * GRABBER_DISTANCE_TO_SIZE_RATIO * 3, z: 0 });
|
||||
Overlays.editOverlay(grabberMoveUp, {
|
||||
scale: handleSize,
|
||||
position: pos,
|
||||
scale: handleSize / 2,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
2
interface/external/gverb/readme.txt
vendored
2
interface/external/gverb/readme.txt
vendored
|
@ -12,4 +12,4 @@ Clément Brisset, October 22nd, 2014
|
|||
3. Place the directories “include” and “src” in interface/external/gverb
|
||||
(Normally next to this readme)
|
||||
|
||||
4. Clear your build directory, run cmake, build and you should be all set.
|
||||
4. Clear your build directory, run cmake, build and you should be all set.
|
||||
|
|
|
@ -2840,7 +2840,12 @@ void Application::updateShadowMap() {
|
|||
// render JS/scriptable overlays
|
||||
{
|
||||
PerformanceTimer perfTimer("3dOverlays");
|
||||
_overlays.render3D(RenderArgs::SHADOW_RENDER_MODE);
|
||||
_overlays.render3D(false, RenderArgs::SHADOW_RENDER_MODE);
|
||||
}
|
||||
|
||||
{
|
||||
PerformanceTimer perfTimer("3dOverlaysFront");
|
||||
_overlays.render3D(true, RenderArgs::SHADOW_RENDER_MODE);
|
||||
}
|
||||
|
||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
|
@ -3055,7 +3060,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr
|
|||
// render JS/scriptable overlays
|
||||
{
|
||||
PerformanceTimer perfTimer("3dOverlays");
|
||||
_overlays.render3D();
|
||||
_overlays.render3D(false);
|
||||
}
|
||||
|
||||
// render the ambient occlusion effect if enabled
|
||||
|
@ -3139,6 +3144,13 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr
|
|||
if (Menu::getInstance()->isOptionChecked(MenuOption::Wireframe)) {
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
}
|
||||
|
||||
// Render 3D overlays that should be drawn in front
|
||||
{
|
||||
PerformanceTimer perfTimer("3dOverlaysFront");
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
_overlays.render3D(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Application::updateUntranslatedViewMatrix(const glm::vec3& viewMatrixTranslation) {
|
||||
|
|
|
@ -989,7 +989,8 @@ void Audio::processReceivedSamples(const QByteArray& inputBuffer, QByteArray& ou
|
|||
QByteArray buffer = inputBuffer;
|
||||
|
||||
// Accumulate direct transmission of audio from sender to receiver
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingIncludeOriginal)) {
|
||||
bool includeOriginal = true; // Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingIncludeOriginal)
|
||||
if (includeOriginal) {
|
||||
emit preProcessOriginalInboundAudio(sampleTime, buffer, _desiredOutputFormat);
|
||||
addSpatialAudioToBuffer(sampleTime, buffer, numNetworkOutputSamples);
|
||||
}
|
||||
|
@ -1264,7 +1265,8 @@ void Audio::selectAudioSourceSine440() {
|
|||
}
|
||||
|
||||
void Audio::toggleAudioSpatialProcessing() {
|
||||
_processSpatialAudio = !_processSpatialAudio;
|
||||
// spatial audio disabled for now
|
||||
_processSpatialAudio = false; //!_processSpatialAudio;
|
||||
if (_processSpatialAudio) {
|
||||
_spatialAudioStart = 0;
|
||||
_spatialAudioFinish = 0;
|
||||
|
|
|
@ -66,10 +66,15 @@ AudioReflector::AudioReflector(QObject* parent) :
|
|||
}
|
||||
|
||||
bool AudioReflector::haveAttributesChanged() {
|
||||
bool withDiffusion = Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingWithDiffusions);
|
||||
bool dontDistanceAttenuate = Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingDontDistanceAttenuate);
|
||||
bool alternateDistanceAttenuate = Menu::getInstance()->isOptionChecked(
|
||||
MenuOption::AudioSpatialProcessingAlternateDistanceAttenuate);
|
||||
|
||||
// Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingWithDiffusions);
|
||||
bool withDiffusion = true;
|
||||
|
||||
// Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingDontDistanceAttenuate);
|
||||
bool dontDistanceAttenuate = false;
|
||||
|
||||
//Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingAlternateDistanceAttenuate);
|
||||
bool alternateDistanceAttenuate = false;
|
||||
|
||||
bool attributesChange = (_withDiffusion != withDiffusion
|
||||
|| _lastPreDelay != _preDelay
|
||||
|
@ -107,7 +112,8 @@ void AudioReflector::render() {
|
|||
calculateAllReflections();
|
||||
|
||||
// only render if we've been asked to do so
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingRenderPaths)) {
|
||||
bool renderPaths = false; // Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingRenderPaths)
|
||||
if (renderPaths) {
|
||||
drawRays();
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +122,8 @@ void AudioReflector::render() {
|
|||
// = 3ms per meter
|
||||
float AudioReflector::getDelayFromDistance(float distance) {
|
||||
float delay = (_soundMsPerMeter * distance);
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingPreDelay)) {
|
||||
bool includePreDelay = true; // Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingPreDelay)
|
||||
if (includePreDelay) {
|
||||
delay += _preDelay;
|
||||
}
|
||||
return delay;
|
||||
|
@ -126,12 +133,11 @@ float AudioReflector::getDelayFromDistance(float distance) {
|
|||
float AudioReflector::getDistanceAttenuationCoefficient(float distance) {
|
||||
|
||||
|
||||
bool doDistanceAttenuation = !Menu::getInstance()->isOptionChecked(
|
||||
MenuOption::AudioSpatialProcessingDontDistanceAttenuate);
|
||||
//!Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingDontDistanceAttenuate);
|
||||
bool doDistanceAttenuation = true;
|
||||
|
||||
bool originalFormula = !Menu::getInstance()->isOptionChecked(
|
||||
MenuOption::AudioSpatialProcessingAlternateDistanceAttenuate);
|
||||
|
||||
//!Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingAlternateDistanceAttenuate);
|
||||
bool originalFormula = true;
|
||||
|
||||
float distanceCoefficient = 1.0f;
|
||||
|
||||
|
@ -170,7 +176,8 @@ float AudioReflector::getDistanceAttenuationCoefficient(float distance) {
|
|||
}
|
||||
|
||||
glm::vec3 AudioReflector::getFaceNormal(BoxFace face) {
|
||||
bool wantSlightRandomness = Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingSlightlyRandomSurfaces);
|
||||
// Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingSlightlyRandomSurfaces);
|
||||
bool wantSlightRandomness = true;
|
||||
glm::vec3 faceNormal;
|
||||
const float MIN_RANDOM_LENGTH = 0.99f;
|
||||
const float MAX_RANDOM_LENGTH = 1.0f;
|
||||
|
@ -202,8 +209,8 @@ const int NUMBER_OF_CHANNELS = 2;
|
|||
void AudioReflector::injectAudiblePoint(AudioSource source, const AudiblePoint& audiblePoint,
|
||||
const QByteArray& samples, unsigned int sampleTime, int sampleRate) {
|
||||
|
||||
bool wantEarSeparation = Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingSeparateEars);
|
||||
bool wantStereo = Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingStereoSource);
|
||||
bool wantEarSeparation = true; // Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingSeparateEars);
|
||||
bool wantStereo = true; // Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingStereoSource);
|
||||
glm::vec3 rightEarPosition = wantEarSeparation ? _myAvatar->getHead()->getRightEarPosition() :
|
||||
_myAvatar->getHead()->getPosition();
|
||||
glm::vec3 leftEarPosition = wantEarSeparation ? _myAvatar->getHead()->getLeftEarPosition() :
|
||||
|
@ -316,7 +323,8 @@ void AudioReflector::preProcessOriginalInboundAudio(unsigned int sampleTime,
|
|||
}
|
||||
|
||||
void AudioReflector::processLocalAudio(unsigned int sampleTime, const QByteArray& samples, const QAudioFormat& format) {
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingProcessLocalAudio)) {
|
||||
bool processLocalAudio = true; // Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingProcessLocalAudio)
|
||||
if (processLocalAudio) {
|
||||
const int NUM_CHANNELS_INPUT = 1;
|
||||
const int NUM_CHANNELS_OUTPUT = 2;
|
||||
const int EXPECTED_SAMPLE_RATE = 24000;
|
||||
|
@ -458,7 +466,7 @@ void AudioReflector::identifyAudioSources() {
|
|||
void AudioReflector::calculateAllReflections() {
|
||||
// only recalculate when we've moved, or if the attributes have changed
|
||||
// TODO: what about case where new voxels are added in front of us???
|
||||
bool wantHeadOrientation = Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingHeadOriented);
|
||||
bool wantHeadOrientation = true; // Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingHeadOriented);
|
||||
glm::quat orientation = wantHeadOrientation ? _myAvatar->getHead()->getFinalOrientationInWorldFrame() : _myAvatar->getOrientation();
|
||||
glm::vec3 origin = _myAvatar->getHead()->getPosition();
|
||||
glm::vec3 listenerPosition = _myAvatar->getHead()->getPosition();
|
||||
|
@ -505,7 +513,8 @@ void AudioReflector::drawRays() {
|
|||
}
|
||||
}
|
||||
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingProcessLocalAudio)) {
|
||||
bool processLocalAudio = true; // Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingProcessLocalAudio)
|
||||
if (processLocalAudio) {
|
||||
// draw the paths for local audio
|
||||
foreach(AudioPath* const& path, _localAudioPaths) {
|
||||
// if this is an original reflection, draw it in RED
|
||||
|
@ -575,7 +584,8 @@ void AudioReflector::analyzePaths() {
|
|||
|
||||
float initialAttenuation = 1.0f;
|
||||
|
||||
float preDelay = Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingPreDelay) ? _preDelay : 0.0f;
|
||||
bool wantPreDelay = true; // Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingPreDelay)
|
||||
float preDelay = wantPreDelay ? _preDelay : 0.0f;
|
||||
|
||||
// NOTE: we're still calculating our initial paths based on the listeners position. But the analysis code has been
|
||||
// updated to support individual sound sources (which is how we support diffusion), we can use this new paradigm to
|
||||
|
@ -701,7 +711,7 @@ void AudioReflector::handlePathPoint(AudioPath* path, float distance, OctreeElem
|
|||
float reflectiveAttenuation = currentReflectiveAttenuation * material.reflectiveRatio;
|
||||
float totalDiffusionAttenuation = currentReflectiveAttenuation * material.diffusionRatio;
|
||||
|
||||
bool wantDiffusions = Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingWithDiffusions);
|
||||
bool wantDiffusions = true; // Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingWithDiffusions);
|
||||
int fanout = wantDiffusions ? _diffusionFanout : 0;
|
||||
|
||||
float partialDiffusionAttenuation = fanout < 1 ? 0.0f : totalDiffusionAttenuation / (float)fanout;
|
||||
|
|
|
@ -620,58 +620,6 @@ Menu::Menu() :
|
|||
audioScopeFramesGroup->addAction(fiftyFrames);
|
||||
}
|
||||
|
||||
QMenu* spatialAudioMenu = audioDebugMenu->addMenu("Spatial Audio");
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(spatialAudioMenu, MenuOption::AudioSpatialProcessing,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_M,
|
||||
false,
|
||||
appInstance->getAudio(),
|
||||
SLOT(toggleAudioSpatialProcessing()));
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(spatialAudioMenu, MenuOption::AudioSpatialProcessingIncludeOriginal,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_O,
|
||||
true);
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(spatialAudioMenu, MenuOption::AudioSpatialProcessingSeparateEars,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_E,
|
||||
true);
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(spatialAudioMenu, MenuOption::AudioSpatialProcessingPreDelay,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_D,
|
||||
true);
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(spatialAudioMenu, MenuOption::AudioSpatialProcessingStereoSource,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_S,
|
||||
true);
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(spatialAudioMenu, MenuOption::AudioSpatialProcessingHeadOriented,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_H,
|
||||
true);
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(spatialAudioMenu, MenuOption::AudioSpatialProcessingWithDiffusions,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_W,
|
||||
true);
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(spatialAudioMenu, MenuOption::AudioSpatialProcessingRenderPaths,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_R,
|
||||
true);
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(spatialAudioMenu, MenuOption::AudioSpatialProcessingSlightlyRandomSurfaces,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_X,
|
||||
true);
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(spatialAudioMenu, MenuOption::AudioSpatialProcessingProcessLocalAudio,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_A,
|
||||
true);
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(spatialAudioMenu, MenuOption::AudioSpatialProcessingDontDistanceAttenuate,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_Y,
|
||||
false);
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(spatialAudioMenu, MenuOption::AudioSpatialProcessingAlternateDistanceAttenuate,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_U,
|
||||
false);
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::AudioStats,
|
||||
Qt::CTRL | Qt::Key_A,
|
||||
false,
|
||||
|
|
|
@ -341,18 +341,6 @@ namespace MenuOption {
|
|||
const QString AudioScopeTwentyFrames = "Twenty";
|
||||
const QString AudioStats = "Audio Stats";
|
||||
const QString AudioStatsShowInjectedStreams = "Audio Stats Show Injected Streams";
|
||||
const QString AudioSpatialProcessingAlternateDistanceAttenuate = "Alternate distance attenuation";
|
||||
const QString AudioSpatialProcessing = "Audio Spatial Processing";
|
||||
const QString AudioSpatialProcessingDontDistanceAttenuate = "Don't calculate distance attenuation";
|
||||
const QString AudioSpatialProcessingHeadOriented = "Head Oriented";
|
||||
const QString AudioSpatialProcessingIncludeOriginal = "Includes Network Original";
|
||||
const QString AudioSpatialProcessingPreDelay = "Add Pre-Delay";
|
||||
const QString AudioSpatialProcessingProcessLocalAudio = "Process Local Audio";
|
||||
const QString AudioSpatialProcessingRenderPaths = "Render Paths";
|
||||
const QString AudioSpatialProcessingSeparateEars = "Separate Ears";
|
||||
const QString AudioSpatialProcessingSlightlyRandomSurfaces = "Slightly Random Surfaces";
|
||||
const QString AudioSpatialProcessingStereoSource = "Stereo Source";
|
||||
const QString AudioSpatialProcessingWithDiffusions = "With Diffusions";
|
||||
const QString AudioSourceInject = "Generated Audio";
|
||||
const QString AudioSourcePinkNoise = "Pink Noise";
|
||||
const QString AudioSourceSine440 = "Sine 440hz";
|
||||
|
|
|
@ -100,7 +100,8 @@ static TextRenderer* textRenderer(int mono) {
|
|||
static TextRenderer* monoRenderer = TextRenderer::getInstance(MONO_FONT_FAMILY);
|
||||
static TextRenderer* proportionalRenderer = TextRenderer::getInstance(SANS_FONT_FAMILY,
|
||||
-1, -1, false, TextRenderer::SHADOW_EFFECT);
|
||||
static TextRenderer* inconsolataRenderer = TextRenderer::getInstance(INCONSOLATA_FONT_FAMILY, -1, QFont::Bold, false);
|
||||
static TextRenderer* inconsolataRenderer = TextRenderer::getInstance(INCONSOLATA_FONT_FAMILY, -1, INCONSOLATA_FONT_WEIGHT,
|
||||
false);
|
||||
switch (mono) {
|
||||
case 1:
|
||||
return monoRenderer;
|
||||
|
|
|
@ -195,22 +195,14 @@ QScriptValue EntityTreeRenderer::loadEntityScript(EntityItem* entity) {
|
|||
return entityScriptObject; // newly constructed
|
||||
}
|
||||
|
||||
QScriptValue EntityTreeRenderer::getPreviouslyLoadedEntityScript(const EntityItemID& entityItemID) {
|
||||
EntityItem* entity = static_cast<EntityTree*>(_tree)->findEntityByEntityItemID(entityItemID);
|
||||
return getPreviouslyLoadedEntityScript(entity);
|
||||
}
|
||||
|
||||
|
||||
QScriptValue EntityTreeRenderer::getPreviouslyLoadedEntityScript(EntityItem* entity) {
|
||||
if (entity) {
|
||||
EntityItemID entityID = entity->getEntityItemID();
|
||||
if (_entityScripts.contains(entityID)) {
|
||||
EntityScriptDetails details = _entityScripts[entityID];
|
||||
return details.scriptObject; // previously loaded
|
||||
}
|
||||
QScriptValue EntityTreeRenderer::getPreviouslyLoadedEntityScript(const EntityItemID& entityID) {
|
||||
if (_entityScripts.contains(entityID)) {
|
||||
EntityScriptDetails details = _entityScripts[entityID];
|
||||
return details.scriptObject; // previously loaded
|
||||
}
|
||||
return QScriptValue(); // no script
|
||||
}
|
||||
|
||||
void EntityTreeRenderer::setTree(Octree* newTree) {
|
||||
OctreeRenderer::setTree(newTree);
|
||||
static_cast<EntityTree*>(_tree)->setFBXService(this);
|
||||
|
|
|
@ -131,7 +131,6 @@ private:
|
|||
QScriptValue loadEntityScript(EntityItem* entity);
|
||||
QScriptValue loadEntityScript(const EntityItemID& entityItemID);
|
||||
QScriptValue getPreviouslyLoadedEntityScript(const EntityItemID& entityItemID);
|
||||
QScriptValue getPreviouslyLoadedEntityScript(EntityItem* entity);
|
||||
QString loadScriptContents(const QString& scriptMaybeURLorText);
|
||||
QScriptValueList createMouseEventArgs(const EntityItemID& entityID, QMouseEvent* event, unsigned int deviceID);
|
||||
QScriptValueList createMouseEventArgs(const EntityItemID& entityID, const MouseEvent& mouseEvent);
|
||||
|
|
|
@ -50,7 +50,7 @@ BandwidthMeter::ChannelInfo BandwidthMeter::_CHANNELS[] = {
|
|||
};
|
||||
|
||||
BandwidthMeter::BandwidthMeter() :
|
||||
_textRenderer(TextRenderer::getInstance(INCONSOLATA_FONT_FAMILY, -1, QFont::Bold, false)),
|
||||
_textRenderer(TextRenderer::getInstance(INCONSOLATA_FONT_FAMILY, -1, INCONSOLATA_FONT_WEIGHT, false)),
|
||||
_scaleMaxIndex(INITIAL_SCALE_MAXIMUM_INDEX) {
|
||||
|
||||
_channels = static_cast<ChannelInfo*>( malloc(sizeof(_CHANNELS)) );
|
||||
|
|
|
@ -316,14 +316,14 @@ void Stats::display(
|
|||
horizontalOffset = _lastHorizontalOffset + _generalStatsWidth +1;
|
||||
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
|
||||
int pingAudio = 0, pingAvatar = 0, pingVoxel = 0, pingVoxelMax = 0;
|
||||
int pingAudio = -1, pingAvatar = -1, pingVoxel = -1, pingVoxelMax = -1;
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||
SharedNodePointer avatarMixerNode = nodeList->soloNodeOfType(NodeType::AvatarMixer);
|
||||
|
||||
pingAudio = audioMixerNode ? audioMixerNode->getPingMs() : 0;
|
||||
pingAvatar = avatarMixerNode ? avatarMixerNode->getPingMs() : 0;
|
||||
pingAudio = audioMixerNode ? audioMixerNode->getPingMs() : -1;
|
||||
pingAvatar = avatarMixerNode ? avatarMixerNode->getPingMs() : -1;
|
||||
|
||||
// Now handle voxel servers, since there could be more than one, we average their ping times
|
||||
unsigned long totalPingVoxel = 0;
|
||||
|
@ -354,12 +354,25 @@ void Stats::display(
|
|||
|
||||
|
||||
char audioPing[30];
|
||||
sprintf(audioPing, "Audio ping: %d", pingAudio);
|
||||
|
||||
if (pingAudio >= 0) {
|
||||
sprintf(audioPing, "Audio ping: %d", pingAudio);
|
||||
} else {
|
||||
sprintf(audioPing, "Audio ping: --");
|
||||
}
|
||||
|
||||
char avatarPing[30];
|
||||
sprintf(avatarPing, "Avatar ping: %d", pingAvatar);
|
||||
if (pingAvatar >= 0) {
|
||||
sprintf(avatarPing, "Avatar ping: %d", pingAvatar);
|
||||
} else {
|
||||
sprintf(avatarPing, "Avatar ping: --");
|
||||
}
|
||||
|
||||
char voxelAvgPing[30];
|
||||
sprintf(voxelAvgPing, "Voxel avg ping: %d", pingVoxel);
|
||||
if (pingVoxel >= 0) {
|
||||
sprintf(voxelAvgPing, "Voxel avg ping: %d", pingVoxel);
|
||||
} else {
|
||||
sprintf(voxelAvgPing, "Voxel avg ping: --");
|
||||
}
|
||||
|
||||
verticalOffset += STATS_PELS_PER_LINE;
|
||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, audioPing, color);
|
||||
|
@ -370,7 +383,11 @@ void Stats::display(
|
|||
|
||||
if (_expanded) {
|
||||
char voxelMaxPing[30];
|
||||
sprintf(voxelMaxPing, "Voxel max ping: %d", pingVoxelMax);
|
||||
if (pingVoxel >= 0) { // Average is only meaningful if pingVoxel is valid.
|
||||
sprintf(voxelMaxPing, "Voxel max ping: %d", pingVoxelMax);
|
||||
} else {
|
||||
sprintf(voxelMaxPing, "Voxel max ping: --");
|
||||
}
|
||||
|
||||
verticalOffset += STATS_PELS_PER_LINE;
|
||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, voxelMaxPing, color);
|
||||
|
@ -460,7 +477,8 @@ void Stats::display(
|
|||
VoxelSystem* voxels = Application::getInstance()->getVoxels();
|
||||
|
||||
lines = _expanded ? 14 : 3;
|
||||
if (_expanded && Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessing)) {
|
||||
bool wantSpatialProcessing = false; // Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessing)
|
||||
if (_expanded && wantSpatialProcessing) {
|
||||
lines += 10; // spatial audio processing adds 1 spacing line and 8 extra lines of info
|
||||
}
|
||||
|
||||
|
@ -652,7 +670,7 @@ void Stats::display(
|
|||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)voxelStats.str().c_str(), color);
|
||||
}
|
||||
|
||||
if (_expanded && Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessing)) {
|
||||
if (_expanded && wantSpatialProcessing) {
|
||||
verticalOffset += STATS_PELS_PER_LINE; // space one line...
|
||||
|
||||
const AudioReflector* audioReflector = Application::getInstance()->getAudioReflector();
|
||||
|
@ -660,23 +678,24 @@ void Stats::display(
|
|||
// add some reflection stats
|
||||
char reflectionsStatus[128];
|
||||
|
||||
bool includeOriginal = true; //Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingIncludeOriginal)
|
||||
bool separateEars = true; //Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingSeparateEars)
|
||||
bool stereoSource = true; //Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingStereoSource)
|
||||
bool randomSurfaces = true; //Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingSlightlyRandomSurfaces)
|
||||
|
||||
sprintf(reflectionsStatus, "Reflections: %d, Original: %s, Ears: %s, Source: %s, Normals: %s",
|
||||
audioReflector->getReflections(),
|
||||
(Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingIncludeOriginal)
|
||||
? "included" : "silent"),
|
||||
(Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingSeparateEars)
|
||||
? "two" : "one"),
|
||||
(Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingStereoSource)
|
||||
? "stereo" : "mono"),
|
||||
(Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingSlightlyRandomSurfaces)
|
||||
? "random" : "regular")
|
||||
(includeOriginal ? "included" : "silent"),
|
||||
(separateEars ? "two" : "one"),
|
||||
(stereoSource ? "stereo" : "mono"),
|
||||
(randomSurfaces ? "random" : "regular")
|
||||
);
|
||||
|
||||
verticalOffset += STATS_PELS_PER_LINE;
|
||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, reflectionsStatus, color);
|
||||
|
||||
float preDelay = Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingPreDelay) ?
|
||||
audioReflector->getPreDelay() : 0.0f;
|
||||
bool wantPreDelay = true; //Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingPreDelay)
|
||||
float preDelay = wantPreDelay ? audioReflector->getPreDelay() : 0.0f;
|
||||
|
||||
sprintf(reflectionsStatus, "Delay: pre: %6.3f, average %6.3f, max %6.3f, min %6.3f, speed: %6.3f",
|
||||
preDelay,
|
||||
|
@ -688,12 +707,12 @@ void Stats::display(
|
|||
verticalOffset += STATS_PELS_PER_LINE;
|
||||
|
||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, reflectionsStatus, color);
|
||||
|
||||
bool distanceAttenuationDisabled = Menu::getInstance()->isOptionChecked(
|
||||
MenuOption::AudioSpatialProcessingDontDistanceAttenuate);
|
||||
|
||||
bool alternateDistanceAttenuationEnabled = Menu::getInstance()->isOptionChecked(
|
||||
MenuOption::AudioSpatialProcessingAlternateDistanceAttenuate);
|
||||
//Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingDontDistanceAttenuate);
|
||||
bool distanceAttenuationDisabled = false;
|
||||
|
||||
// Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingAlternateDistanceAttenuate);
|
||||
bool alternateDistanceAttenuationEnabled = false;
|
||||
|
||||
sprintf(reflectionsStatus, "Attenuation: average %5.3f, max %5.3f, min %5.3f, %s: %5.3f",
|
||||
audioReflector->getAverageAttenuation(),
|
||||
|
@ -706,15 +725,14 @@ void Stats::display(
|
|||
verticalOffset += STATS_PELS_PER_LINE;
|
||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, reflectionsStatus, color);
|
||||
|
||||
sprintf(reflectionsStatus, "Local Audio: %s Attenuation: %5.3f",
|
||||
(Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingProcessLocalAudio)
|
||||
? "yes" : "no"),
|
||||
bool localAudio = true; // Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingProcessLocalAudio);
|
||||
sprintf(reflectionsStatus, "Local Audio: %s Attenuation: %5.3f", (localAudio ? "yes" : "no"),
|
||||
audioReflector->getLocalAudioAttenuationFactor());
|
||||
|
||||
verticalOffset += STATS_PELS_PER_LINE;
|
||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, reflectionsStatus, color);
|
||||
|
||||
bool diffusionEnabled = Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingWithDiffusions);
|
||||
bool diffusionEnabled = true; //Menu::getInstance()->isOptionChecked(MenuOption::AudioSpatialProcessingWithDiffusions);
|
||||
int fanout = diffusionEnabled ? audioReflector->getDiffusionFanout() : 0;
|
||||
int diffusionPaths = diffusionEnabled ? audioReflector->getDiffusionPathCount() : 0;
|
||||
sprintf(reflectionsStatus, "Diffusion: %s, Fanout: %d, Paths: %d",
|
||||
|
|
|
@ -35,7 +35,13 @@ const char SOLID_BLOCK_CHAR = 127;
|
|||
#define MONO_FONT_FAMILY "Courier"
|
||||
|
||||
// the Inconsolata font family
|
||||
#ifdef Q_OS_WIN
|
||||
#define INCONSOLATA_FONT_FAMILY "Fixedsys"
|
||||
#define INCONSOLATA_FONT_WEIGHT QFont::Normal
|
||||
#else
|
||||
#define INCONSOLATA_FONT_FAMILY "Inconsolata"
|
||||
#define INCONSOLATA_FONT_WEIGHT QFont::Bold
|
||||
#endif
|
||||
|
||||
class Glyph;
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@ Base3DOverlay::Base3DOverlay() :
|
|||
_rotation(),
|
||||
_isSolid(DEFAULT_IS_SOLID),
|
||||
_isDashedLine(DEFAULT_IS_DASHED_LINE),
|
||||
_ignoreRayIntersection(false)
|
||||
_ignoreRayIntersection(false),
|
||||
_drawInFront(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -48,6 +49,13 @@ Base3DOverlay::~Base3DOverlay() {
|
|||
void Base3DOverlay::setProperties(const QScriptValue& properties) {
|
||||
Overlay::setProperties(properties);
|
||||
|
||||
QScriptValue drawInFront = properties.property("drawInFront");
|
||||
|
||||
if (drawInFront.isValid()) {
|
||||
bool value = drawInFront.toVariant().toBool();
|
||||
setDrawInFront(value);
|
||||
}
|
||||
|
||||
QScriptValue position = properties.property("position");
|
||||
|
||||
// if "position" property was not there, check to see if they included aliases: start, point, p1
|
||||
|
@ -151,6 +159,9 @@ QScriptValue Base3DOverlay::getProperty(const QString& property) {
|
|||
if (property == "ignoreRayIntersection") {
|
||||
return _ignoreRayIntersection;
|
||||
}
|
||||
if (property == "drawInFront") {
|
||||
return _drawInFront;
|
||||
}
|
||||
|
||||
return Overlay::getProperty(property);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ public:
|
|||
bool getIsSolidLine() const { return !_isDashedLine; }
|
||||
const glm::quat& getRotation() const { return _rotation; }
|
||||
bool getIgnoreRayIntersection() const { return _ignoreRayIntersection; }
|
||||
bool getDrawInFront() const { return _drawInFront; }
|
||||
|
||||
// setters
|
||||
void setPosition(const glm::vec3& position) { _position = position; }
|
||||
|
@ -44,6 +45,7 @@ public:
|
|||
void setIsDashedLine(bool isDashedLine) { _isDashedLine = isDashedLine; }
|
||||
void setRotation(const glm::quat& value) { _rotation = value; }
|
||||
void setIgnoreRayIntersection(bool value) { _ignoreRayIntersection = value; }
|
||||
void setDrawInFront(bool value) { _drawInFront = value; }
|
||||
|
||||
virtual void setProperties(const QScriptValue& properties);
|
||||
virtual QScriptValue getProperty(const QString& property);
|
||||
|
@ -64,6 +66,7 @@ protected:
|
|||
bool _isSolid;
|
||||
bool _isDashedLine;
|
||||
bool _ignoreRayIntersection;
|
||||
bool _drawInFront;
|
||||
};
|
||||
|
||||
#endif // hifi_Base3DOverlay_h
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "Cube3DOverlay.h"
|
||||
#include "renderer/GlowEffect.h"
|
||||
|
||||
Cube3DOverlay::Cube3DOverlay() {
|
||||
Cube3DOverlay::Cube3DOverlay() : _borderSize(0) {
|
||||
}
|
||||
|
||||
Cube3DOverlay::Cube3DOverlay(const Cube3DOverlay* cube3DOverlay) :
|
||||
|
@ -63,8 +63,27 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
|||
glm::vec3 positionToCenter = center - position;
|
||||
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
||||
if (_isSolid) {
|
||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
||||
if (_borderSize > 0) {
|
||||
// Draw a cube at a larger size behind the main cube, creating
|
||||
// a border effect.
|
||||
// Disable writing to the depth mask so that the "border" cube will not
|
||||
// occlude the main cube. This means the border could be covered by
|
||||
// overlays that are further back and drawn later, but this is good
|
||||
// enough for the use-case.
|
||||
glDepthMask(GL_FALSE);
|
||||
glPushMatrix();
|
||||
glColor4f(1.0f, 1.0f, 1.0f, alpha);
|
||||
glScalef(dimensions.x * _borderSize, dimensions.y * _borderSize, dimensions.z * _borderSize);
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
||||
glPopMatrix();
|
||||
glDepthMask(GL_TRUE);
|
||||
}
|
||||
|
||||
glPushMatrix();
|
||||
glColor4f(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
|
||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
||||
glPopMatrix();
|
||||
} else {
|
||||
glLineWidth(_lineWidth);
|
||||
|
||||
|
@ -111,3 +130,22 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
|||
Cube3DOverlay* Cube3DOverlay::createClone() const {
|
||||
return new Cube3DOverlay(this);
|
||||
}
|
||||
|
||||
void Cube3DOverlay::setProperties(const QScriptValue& properties) {
|
||||
Volume3DOverlay::setProperties(properties);
|
||||
|
||||
QScriptValue borderSize = properties.property("borderSize");
|
||||
|
||||
if (borderSize.isValid()) {
|
||||
float value = borderSize.toVariant().toFloat();
|
||||
setBorderSize(value);
|
||||
}
|
||||
}
|
||||
|
||||
QScriptValue Cube3DOverlay::getProperty(const QString& property) {
|
||||
if (property == "borderSize") {
|
||||
return _borderSize;
|
||||
}
|
||||
|
||||
return Volume3DOverlay::getProperty(property);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,16 @@ public:
|
|||
virtual void render(RenderArgs* args);
|
||||
|
||||
virtual Cube3DOverlay* createClone() const;
|
||||
|
||||
float getBorderSize() const { return _borderSize; }
|
||||
|
||||
void setBorderSize(float value) { _borderSize = value; }
|
||||
|
||||
virtual void setProperties(const QScriptValue& properties);
|
||||
virtual QScriptValue getProperty(const QString& property);
|
||||
|
||||
private:
|
||||
float _borderSize;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ void Overlays::render2D() {
|
|||
}
|
||||
}
|
||||
|
||||
void Overlays::render3D(RenderArgs::RenderMode renderMode, RenderArgs::RenderSide renderSide) {
|
||||
void Overlays::render3D(bool drawFront, RenderArgs::RenderMode renderMode, RenderArgs::RenderSide renderSide) {
|
||||
QReadLocker lock(&_lock);
|
||||
if (_overlays3D.size() == 0) {
|
||||
return;
|
||||
|
@ -112,6 +112,10 @@ void Overlays::render3D(RenderArgs::RenderMode renderMode, RenderArgs::RenderSid
|
|||
|
||||
|
||||
foreach(Overlay* thisOverlay, _overlays3D) {
|
||||
Base3DOverlay* overlay3D = static_cast<Base3DOverlay*>(thisOverlay);
|
||||
if (overlay3D->getDrawInFront() != drawFront) {
|
||||
continue;
|
||||
}
|
||||
glPushMatrix();
|
||||
switch (thisOverlay->getAnchor()) {
|
||||
case Overlay::MY_AVATAR:
|
||||
|
@ -301,6 +305,7 @@ void OverlayPropertyResultFromScriptValue(const QScriptValue& value, OverlayProp
|
|||
|
||||
RayToOverlayIntersectionResult Overlays::findRayIntersection(const PickRay& ray) {
|
||||
float bestDistance = std::numeric_limits<float>::max();
|
||||
bool bestIsFront = false;
|
||||
RayToOverlayIntersectionResult result;
|
||||
QMapIterator<unsigned int, Overlay*> i(_overlays3D);
|
||||
i.toBack();
|
||||
|
@ -313,7 +318,9 @@ RayToOverlayIntersectionResult Overlays::findRayIntersection(const PickRay& ray)
|
|||
BoxFace thisFace;
|
||||
QString thisExtraInfo;
|
||||
if (thisOverlay->findRayIntersectionExtraInfo(ray.origin, ray.direction, thisDistance, thisFace, thisExtraInfo)) {
|
||||
if (thisDistance < bestDistance) {
|
||||
bool isDrawInFront = thisOverlay->getDrawInFront();
|
||||
if (thisDistance < bestDistance && (!bestIsFront || isDrawInFront)) {
|
||||
bestIsFront = isDrawInFront;
|
||||
bestDistance = thisDistance;
|
||||
result.intersects = true;
|
||||
result.distance = thisDistance;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <QString>
|
||||
#include <QScriptValue>
|
||||
#include <QSignalMapper>
|
||||
|
||||
#include "Overlay.h"
|
||||
|
||||
|
@ -51,7 +52,7 @@ public:
|
|||
~Overlays();
|
||||
void init(QGLWidget* parent);
|
||||
void update(float deltatime);
|
||||
void render3D(RenderArgs::RenderMode renderMode = RenderArgs::DEFAULT_RENDER_MODE,
|
||||
void render3D(bool drawFront, RenderArgs::RenderMode renderMode = RenderArgs::DEFAULT_RENDER_MODE,
|
||||
RenderArgs::RenderSide renderSide = RenderArgs::MONO);
|
||||
void render2D();
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket,
|
|||
_bytesReceivedMovingAverage(NULL),
|
||||
_linkedData(NULL),
|
||||
_isAlive(true),
|
||||
_pingMs(-1), // "Uninitialized"
|
||||
_clockSkewUsec(0),
|
||||
_mutex(),
|
||||
_clockSkewMovingPercentile(30, 0.8f) // moving 80th percentile of 30 samples
|
||||
|
|
Loading…
Reference in a new issue