mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 17:00:13 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into metavoxels
This commit is contained in:
commit
b68c836b12
9 changed files with 80 additions and 20 deletions
42
examples/acScripts/ambiance.js
Normal file
42
examples/acScripts/ambiance.js
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
//
|
||||||
|
// ambiance.js
|
||||||
|
// examples
|
||||||
|
//
|
||||||
|
// Created by Clément Brisset on 11/18/14.
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
|
||||||
|
var soundURL = "https://s3.amazonaws.com/hifi-public/sounds/08_Funny_Bone.wav";
|
||||||
|
var position = { x: 700, y: 25, z: 725 };
|
||||||
|
var audioOptions = {
|
||||||
|
position: position,
|
||||||
|
volume: 0.4,
|
||||||
|
loop: true,
|
||||||
|
stereo: false
|
||||||
|
};
|
||||||
|
|
||||||
|
var sound = SoundCache.getSound(soundURL, audioOptions.isStereo);
|
||||||
|
var injector = null;
|
||||||
|
var count = 100;
|
||||||
|
|
||||||
|
Script.update.connect(function() {
|
||||||
|
if (count > 0) {
|
||||||
|
count--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sound.downloaded && injector === null) {
|
||||||
|
print("Sound downloaded.");
|
||||||
|
injector = Audio.playSound(sound, audioOptions);
|
||||||
|
print("Playing: " + injector);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Script.scriptEnding.connect(function() {
|
||||||
|
if (injector !== null) {
|
||||||
|
injector.stop();
|
||||||
|
}
|
||||||
|
});
|
|
@ -2929,6 +2929,13 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr
|
||||||
if (whichCamera.getMode() == CAMERA_MODE_MIRROR) {
|
if (whichCamera.getMode() == CAMERA_MODE_MIRROR) {
|
||||||
viewTransform.setScale(Transform::Vec3(-1.0f, 1.0f, 1.0f));
|
viewTransform.setScale(Transform::Vec3(-1.0f, 1.0f, 1.0f));
|
||||||
}
|
}
|
||||||
|
if (renderSide != RenderArgs::MONO) {
|
||||||
|
glm::mat4 invView = glm::inverse(_untranslatedViewMatrix);
|
||||||
|
|
||||||
|
viewTransform.evalFromRawMatrix(invView);
|
||||||
|
viewTransform.preTranslate(_viewMatrixTranslation);
|
||||||
|
}
|
||||||
|
|
||||||
setViewTransform(viewTransform);
|
setViewTransform(viewTransform);
|
||||||
|
|
||||||
glTranslatef(_viewMatrixTranslation.x, _viewMatrixTranslation.y, _viewMatrixTranslation.z);
|
glTranslatef(_viewMatrixTranslation.x, _viewMatrixTranslation.y, _viewMatrixTranslation.z);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
#include <glm/gtx/vector_angle.hpp>
|
#include <glm/gtx/vector_angle.hpp>
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
#include <glm/gtx/vector_query.hpp>
|
||||||
|
|
||||||
#include <GeometryUtil.h>
|
#include <GeometryUtil.h>
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
|
@ -664,8 +665,18 @@ void Avatar::renderDisplayName() {
|
||||||
|
|
||||||
// we need "always facing camera": we must remove the camera rotation from the stack
|
// we need "always facing camera": we must remove the camera rotation from the stack
|
||||||
glm::quat rotation = Application::getInstance()->getCamera()->getRotation();
|
glm::quat rotation = Application::getInstance()->getCamera()->getRotation();
|
||||||
glm::vec3 axis = glm::axis(rotation);
|
|
||||||
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
glm::vec3 frontAxis(1.f, 0.f, 0.f);
|
||||||
|
frontAxis = glm::rotate(rotation, frontAxis);
|
||||||
|
frontAxis = glm::normalize(glm::vec3(frontAxis.x, 0.f, frontAxis.z));
|
||||||
|
|
||||||
|
// TODO : test this secodn solution which should be better wfor occulus
|
||||||
|
//glm::vec3 camPosition = Application::getInstance()->getCamera()->getPosition();
|
||||||
|
//glm::vec3 frontAxis = camPosition - textPosition;
|
||||||
|
//frontAxis = glm::normalize(glm::vec3(frontAxis.z, 0.f, -frontAxis.x));
|
||||||
|
|
||||||
|
float angle = acos(frontAxis.x) * ((frontAxis.z < 0) ? 1.f : -1.f);
|
||||||
|
glRotatef(glm::degrees(angle), 0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
// We need to compute the scale factor such as the text remains with fixed size respect to window coordinates
|
// We need to compute the scale factor such as the text remains with fixed size respect to window coordinates
|
||||||
// We project a unit vector and check the difference in screen coordinates, to check which is the
|
// We project a unit vector and check the difference in screen coordinates, to check which is the
|
||||||
|
@ -695,7 +706,8 @@ void Avatar::renderDisplayName() {
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
double textWindowHeight = abs(result1[1] - result0[1]);
|
double textWindowHeight = abs(result1[1] - result0[1]);
|
||||||
float scaleFactor = Application::getInstance()->getRenderResolutionScale() *
|
float scaleFactor = Application::getInstance()->getRenderResolutionScale() * // Scale compensate for the resolution
|
||||||
|
QApplication::desktop()->windowHandle()->devicePixelRatio() * // And the device pixel ratio
|
||||||
((textWindowHeight > EPSILON) ? 1.0f / textWindowHeight : 1.0f);
|
((textWindowHeight > EPSILON) ? 1.0f / textWindowHeight : 1.0f);
|
||||||
glScalef(scaleFactor, scaleFactor, 1.0);
|
glScalef(scaleFactor, scaleFactor, 1.0);
|
||||||
|
|
||||||
|
|
|
@ -524,13 +524,15 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
|
||||||
glViewport(_eyeRenderViewport[eye].Pos.x, _eyeRenderViewport[eye].Pos.y,
|
glViewport(_eyeRenderViewport[eye].Pos.x, _eyeRenderViewport[eye].Pos.y,
|
||||||
_eyeRenderViewport[eye].Size.w, _eyeRenderViewport[eye].Size.h);
|
_eyeRenderViewport[eye].Size.w, _eyeRenderViewport[eye].Size.h);
|
||||||
|
|
||||||
// Apply the offset for the left or right eye on the projection matrix
|
|
||||||
glTranslatef(_eyeRenderDesc[eye].ViewAdjust.x, _eyeRenderDesc[eye].ViewAdjust.y, _eyeRenderDesc[eye].ViewAdjust.z);
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
|
// HACK: instead of passing the stereo eye offset directly in the matrix, pass it in the camera offset
|
||||||
|
//glTranslatef(_eyeRenderDesc[eye].ViewAdjust.x, _eyeRenderDesc[eye].ViewAdjust.y, _eyeRenderDesc[eye].ViewAdjust.z);
|
||||||
|
|
||||||
Application::getInstance()->displaySide(*_camera, false, renderSide);
|
_camera->setEyeOffsetPosition(glm::vec3(-_eyeRenderDesc[eye].ViewAdjust.x, -_eyeRenderDesc[eye].ViewAdjust.y, -_eyeRenderDesc[eye].ViewAdjust.z));
|
||||||
|
Application::getInstance()->displaySide(*_camera, false, RenderArgs::MONO);
|
||||||
|
|
||||||
applicationOverlay.displayOverlayTextureOculus(*_camera);
|
applicationOverlay.displayOverlayTextureOculus(*_camera);
|
||||||
_activeEyeIndex = -1;
|
_activeEyeIndex = -1;
|
||||||
|
|
|
@ -95,7 +95,7 @@ int TextRenderer::draw(int x, int y, const char* str, float alpha) {
|
||||||
maxHeight = glyph.bounds().height();
|
maxHeight = glyph.bounds().height();
|
||||||
}
|
}
|
||||||
//glBindTexture(GL_TEXTURE_2D, glyph.textureID());
|
//glBindTexture(GL_TEXTURE_2D, glyph.textureID());
|
||||||
|
|
||||||
int left = x + glyph.bounds().x();
|
int left = x + glyph.bounds().x();
|
||||||
int right = x + glyph.bounds().x() + glyph.bounds().width();
|
int right = x + glyph.bounds().x() + glyph.bounds().width();
|
||||||
int bottom = y + glyph.bounds().y();
|
int bottom = y + glyph.bounds().y();
|
||||||
|
|
|
@ -17,6 +17,7 @@ const int DEFAULT_WIDTH = 300;
|
||||||
|
|
||||||
ToolWindow::ToolWindow(QWidget* parent) :
|
ToolWindow::ToolWindow(QWidget* parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
|
_selfHidden(false),
|
||||||
_hasShown(false),
|
_hasShown(false),
|
||||||
_lastGeometry() {
|
_lastGeometry() {
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#define getpid _getpid
|
#define getpid _getpid
|
||||||
|
@ -21,6 +19,7 @@
|
||||||
#include <unistd.h> // for getpid() on linux
|
#include <unistd.h> // for getpid() on linux
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <qdatetime.h>
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
|
|
||||||
|
@ -38,6 +37,10 @@ LogHandler::LogHandler() :
|
||||||
QTimer* logFlushTimer = new QTimer(this);
|
QTimer* logFlushTimer = new QTimer(this);
|
||||||
connect(logFlushTimer, &QTimer::timeout, this, &LogHandler::flushRepeatedMessages);
|
connect(logFlushTimer, &QTimer::timeout, this, &LogHandler::flushRepeatedMessages);
|
||||||
logFlushTimer->start(VERBOSE_LOG_INTERVAL_SECONDS * 1000);
|
logFlushTimer->start(VERBOSE_LOG_INTERVAL_SECONDS * 1000);
|
||||||
|
|
||||||
|
// when the log handler is first setup we should print our timezone
|
||||||
|
QString timezoneString = "Time zone: " + QDateTime::currentDateTime().toString("t");
|
||||||
|
printf("%s\n", qPrintable(timezoneString));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* stringForLogType(LogMsgType msgType) {
|
const char* stringForLogType(LogMsgType msgType) {
|
||||||
|
@ -57,8 +60,8 @@ const char* stringForLogType(LogMsgType msgType) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// the following will produce 2000-10-02 13:55:36 -0700
|
// the following will produce 11/18 13:55:36
|
||||||
const char DATE_STRING_FORMAT[] = "%Y-%m-%d %H:%M:%S %z";
|
const QString DATE_STRING_FORMAT = "MM/dd hh:mm:ss";
|
||||||
|
|
||||||
void LogHandler::flushRepeatedMessages() {
|
void LogHandler::flushRepeatedMessages() {
|
||||||
QHash<QString, int>::iterator message = _repeatMessageCountHash.begin();
|
QHash<QString, int>::iterator message = _repeatMessageCountHash.begin();
|
||||||
|
@ -108,18 +111,11 @@ QString LogHandler::printMessage(LogMsgType type, const QMessageLogContext& cont
|
||||||
}
|
}
|
||||||
|
|
||||||
// log prefix is in the following format
|
// log prefix is in the following format
|
||||||
// [DEBUG] [TIMESTAMP] [PID:PARENT_PID] [TARGET] logged string
|
// [DEBUG] [TIMESTAMP] [PID] [TARGET] logged string
|
||||||
|
|
||||||
QString prefixString = QString("[%1]").arg(stringForLogType(type));
|
QString prefixString = QString("[%1]").arg(stringForLogType(type));
|
||||||
|
|
||||||
time_t rawTime;
|
prefixString.append(QString(" [%1]").arg(QDateTime::currentDateTime().toString(DATE_STRING_FORMAT)));
|
||||||
time(&rawTime);
|
|
||||||
struct tm* localTime = localtime(&rawTime);
|
|
||||||
|
|
||||||
char dateString[100];
|
|
||||||
strftime(dateString, sizeof(dateString), DATE_STRING_FORMAT, localTime);
|
|
||||||
|
|
||||||
prefixString.append(QString(" [%1]").arg(dateString));
|
|
||||||
|
|
||||||
if (_shouldOutputPID) {
|
if (_shouldOutputPID) {
|
||||||
prefixString.append(QString(" [%1").arg(getpid()));
|
prefixString.append(QString(" [%1").arg(getpid()));
|
||||||
|
|
Loading…
Reference in a new issue