mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:18:52 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into lobby
This commit is contained in:
commit
d5a3ea77ff
17 changed files with 206 additions and 22 deletions
47
examples/guidedTour.js
Normal file
47
examples/guidedTour.js
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
//
|
||||||
|
// TourGuide.js
|
||||||
|
//
|
||||||
|
// This script will follow another person, if their display name is "Tour Guide"
|
||||||
|
//
|
||||||
|
var leaderName = "Tour Guide";
|
||||||
|
|
||||||
|
var guide;
|
||||||
|
var isGuide = false;
|
||||||
|
var lastGuidePosition = { x:0, y:0, z:0 };
|
||||||
|
var MIN_CHANGE = 2.0;
|
||||||
|
var LANDING_DISTANCE = 2.0;
|
||||||
|
var LANDING_RANDOM = 0.2;
|
||||||
|
|
||||||
|
function update(deltaTime) {
|
||||||
|
|
||||||
|
if (Math.random() < deltaTime) {
|
||||||
|
guide = AvatarList.avatarWithDisplayName(leaderName);
|
||||||
|
if (guide && !isGuide) {
|
||||||
|
print("found a guide!");
|
||||||
|
isGuide = true;
|
||||||
|
} else if (!isGuide) {
|
||||||
|
print("Lost My Guide");
|
||||||
|
isguide = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guide) {
|
||||||
|
// Check whether guide has moved, update if so
|
||||||
|
if (Vec3.length(lastGuidePosition) == 0.0) {
|
||||||
|
lastGuidePosition = guide.position;
|
||||||
|
} else {
|
||||||
|
if (Vec3.length(Vec3.subtract(lastGuidePosition, guide.position)) > MIN_CHANGE) {
|
||||||
|
var meToGuide = Vec3.multiply(Vec3.normalize(Vec3.subtract(guide.position, MyAvatar.position)), LANDING_DISTANCE);
|
||||||
|
var newPosition = Vec3.subtract(guide.position, meToGuide);
|
||||||
|
newPosition = Vec3.sum(newPosition, { x: Math.random() * LANDING_RANDOM - LANDING_RANDOM / 2.0,
|
||||||
|
y: 0,
|
||||||
|
z: Math.random() * LANDING_RANDOM - LANDING_RANDOM / 2.0 });
|
||||||
|
MyAvatar.position = newPosition;
|
||||||
|
|
||||||
|
lastGuidePosition = guide.position;
|
||||||
|
MyAvatar.orientation = guide.orientation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Script.update.connect(update);
|
|
@ -142,7 +142,7 @@ function update(deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.keyPressEvent.connect(function(event) {
|
Controller.keyPressEvent.connect(function(event) {
|
||||||
if (event.text == "SPACE" && !movingWithHead) {
|
if (event.text == "SPACE" && !event.isAutoRepeat && !movingWithHead) {
|
||||||
keyDownTime = 0.0;
|
keyDownTime = 0.0;
|
||||||
movingWithHead = true;
|
movingWithHead = true;
|
||||||
headStartPosition = MyAvatar.getTrackedHeadPosition();
|
headStartPosition = MyAvatar.getTrackedHeadPosition();
|
||||||
|
@ -161,7 +161,7 @@ var TIME_FOR_TURN = 0.25;
|
||||||
var TURN_AROUND = 180.0;
|
var TURN_AROUND = 180.0;
|
||||||
|
|
||||||
Controller.keyReleaseEvent.connect(function(event) {
|
Controller.keyReleaseEvent.connect(function(event) {
|
||||||
if (event.text == "SPACE") {
|
if (event.text == "SPACE" && !event.isAutoRepeat) {
|
||||||
movingWithHead = false;
|
movingWithHead = false;
|
||||||
if (keyDownTime < TIME_FOR_TURN_AROUND) {
|
if (keyDownTime < TIME_FOR_TURN_AROUND) {
|
||||||
if (keyDownTime < TIME_FOR_TURN) {
|
if (keyDownTime < TIME_FOR_TURN) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ elseif (WIN32)
|
||||||
add_definitions(-D_USE_MATH_DEFINES) # apparently needed to get M_PI and other defines from cmath/math.h
|
add_definitions(-D_USE_MATH_DEFINES) # apparently needed to get M_PI and other defines from cmath/math.h
|
||||||
add_definitions(-DWINDOWS_LEAN_AND_MEAN) # needed to make sure windows doesn't go to crazy with its defines
|
add_definitions(-DWINDOWS_LEAN_AND_MEAN) # needed to make sure windows doesn't go to crazy with its defines
|
||||||
|
|
||||||
set(GL_HEADERS "#include <windowshacks.h>\n#include <GL/glew.h>\n#include <GL/glut.h>")
|
set(GL_HEADERS "#include <windowshacks.h>\n#include <GL/glew.h>\n#include <GL/glut.h>\n#include <GL/wglew.h>")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# set up the external glm library
|
# set up the external glm library
|
||||||
|
|
|
@ -179,8 +179,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
_trayIcon(new QSystemTrayIcon(_window)),
|
_trayIcon(new QSystemTrayIcon(_window)),
|
||||||
_lastNackTime(usecTimestampNow()),
|
_lastNackTime(usecTimestampNow()),
|
||||||
_lastSendDownstreamAudioStats(usecTimestampNow()),
|
_lastSendDownstreamAudioStats(usecTimestampNow()),
|
||||||
|
_renderTargetFramerate(0),
|
||||||
|
_isVSyncOn(true),
|
||||||
_renderResolutionScale(1.0f)
|
_renderResolutionScale(1.0f)
|
||||||
{
|
{
|
||||||
|
|
||||||
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
||||||
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
|
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
|
||||||
|
|
||||||
|
@ -520,8 +523,20 @@ void Application::initializeGL() {
|
||||||
qDebug("Error: %s\n", glewGetErrorString(err));
|
qDebug("Error: %s\n", glewGetErrorString(err));
|
||||||
}
|
}
|
||||||
qDebug("Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));
|
qDebug("Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));
|
||||||
|
|
||||||
|
if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||||
|
int swapInterval = wglGetSwapIntervalEXT();
|
||||||
|
qDebug("V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(Q_OS_LINUX)
|
||||||
|
// TODO: Write the correct code for Linux...
|
||||||
|
/* if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||||
|
int swapInterval = wglGetSwapIntervalEXT();
|
||||||
|
qDebug("V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
||||||
|
}*/
|
||||||
|
#endif
|
||||||
|
|
||||||
// Before we render anything, let's set up our viewFrustumOffsetCamera with a sufficiently large
|
// Before we render anything, let's set up our viewFrustumOffsetCamera with a sufficiently large
|
||||||
// field of view and near and far clip to make it interesting.
|
// field of view and near and far clip to make it interesting.
|
||||||
|
@ -1393,9 +1408,14 @@ void Application::idle() {
|
||||||
PerformanceWarning warn(showWarnings, "idle()");
|
PerformanceWarning warn(showWarnings, "idle()");
|
||||||
|
|
||||||
// Only run simulation code if more than IDLE_SIMULATE_MSECS have passed since last time we ran
|
// Only run simulation code if more than IDLE_SIMULATE_MSECS have passed since last time we ran
|
||||||
|
double targetFramePeriod = 0.0;
|
||||||
|
if (_renderTargetFramerate > 0) {
|
||||||
|
targetFramePeriod = 1000.0 / _renderTargetFramerate;
|
||||||
|
} else if (_renderTargetFramerate < 0) {
|
||||||
|
targetFramePeriod = IDLE_SIMULATE_MSECS;
|
||||||
|
}
|
||||||
double timeSinceLastUpdate = (double)_lastTimeUpdated.nsecsElapsed() / 1000000.0;
|
double timeSinceLastUpdate = (double)_lastTimeUpdated.nsecsElapsed() / 1000000.0;
|
||||||
if (timeSinceLastUpdate > IDLE_SIMULATE_MSECS) {
|
if (timeSinceLastUpdate > targetFramePeriod) {
|
||||||
_lastTimeUpdated.start();
|
_lastTimeUpdated.start();
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("update");
|
PerformanceTimer perfTimer("update");
|
||||||
|
@ -3085,7 +3105,6 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) {
|
||||||
// if not rendering the billboard, the region is in device independent coordinates; must convert to device
|
// if not rendering the billboard, the region is in device independent coordinates; must convert to device
|
||||||
QSize size = getTextureCache()->getFrameBufferSize();
|
QSize size = getTextureCache()->getFrameBufferSize();
|
||||||
float ratio = QApplication::desktop()->windowHandle()->devicePixelRatio();
|
float ratio = QApplication::desktop()->windowHandle()->devicePixelRatio();
|
||||||
ratio = size.height() / (float)_glWidget->getDeviceHeight();
|
|
||||||
int x = region.x() * ratio, y = region.y() * ratio, width = region.width() * ratio, height = region.height() * ratio;
|
int x = region.x() * ratio, y = region.y() * ratio, width = region.width() * ratio, height = region.height() * ratio;
|
||||||
glViewport(x, size.height() - y - height, width, height);
|
glViewport(x, size.height() - y - height, width, height);
|
||||||
glScissor(x, size.height() - y - height, width, height);
|
glScissor(x, size.height() - y - height, width, height);
|
||||||
|
@ -4143,6 +4162,53 @@ void Application::takeSnapshot() {
|
||||||
_snapshotShareDialog->show();
|
_snapshotShareDialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::setRenderTargetFramerate(unsigned int framerate, bool vsyncOn) {
|
||||||
|
if (vsyncOn != _isVSyncOn) {
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||||
|
wglSwapIntervalEXT(vsyncOn);
|
||||||
|
int swapInterval = wglGetSwapIntervalEXT();
|
||||||
|
_isVSyncOn = swapInterval;
|
||||||
|
qDebug("V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
||||||
|
} else {
|
||||||
|
qDebug("V-Sync is FORCED ON on this system\n");
|
||||||
|
}
|
||||||
|
#elif defined(Q_OS_LINUX)
|
||||||
|
// TODO: write the poper code for linux
|
||||||
|
/*
|
||||||
|
if (glQueryExtension.... ("GLX_EXT_swap_control")) {
|
||||||
|
glxSwapIntervalEXT(vsyncOn);
|
||||||
|
int swapInterval = xglGetSwapIntervalEXT();
|
||||||
|
_isVSyncOn = swapInterval;
|
||||||
|
qDebug("V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
||||||
|
} else {
|
||||||
|
qDebug("V-Sync is FORCED ON on this system\n");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
#else
|
||||||
|
qDebug("V-Sync is FORCED ON on this system\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
_renderTargetFramerate = framerate;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Application::isVSyncEditable() {
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#elif defined(Q_OS_LINUX)
|
||||||
|
// TODO: write the poper code for linux
|
||||||
|
/*
|
||||||
|
if (glQueryExtension.... ("GLX_EXT_swap_control")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Application::setRenderResolutionScale(float scale) {
|
void Application::setRenderResolutionScale(float scale) {
|
||||||
_renderResolutionScale = scale;
|
_renderResolutionScale = scale;
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,6 +361,11 @@ public slots:
|
||||||
|
|
||||||
void domainSettingsReceived(const QJsonObject& domainSettingsObject);
|
void domainSettingsReceived(const QJsonObject& domainSettingsObject);
|
||||||
|
|
||||||
|
void setRenderTargetFramerate(unsigned int framerate, bool vsyncOn = true);
|
||||||
|
bool isVSyncOn() { return _isVSyncOn; }
|
||||||
|
bool isVSyncEditable();
|
||||||
|
unsigned int getRenderTargetFramerate() const { return _renderTargetFramerate; }
|
||||||
|
|
||||||
void setRenderResolutionScale(float scale);
|
void setRenderResolutionScale(float scale);
|
||||||
|
|
||||||
void resetSensors();
|
void resetSensors();
|
||||||
|
@ -613,6 +618,8 @@ private:
|
||||||
quint64 _lastNackTime;
|
quint64 _lastNackTime;
|
||||||
quint64 _lastSendDownstreamAudioStats;
|
quint64 _lastSendDownstreamAudioStats;
|
||||||
|
|
||||||
|
int _renderTargetFramerate;
|
||||||
|
bool _isVSyncOn;
|
||||||
float _renderResolutionScale;
|
float _renderResolutionScale;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
const int MSECS_PER_FRAME_WHEN_THROTTLED = 66;
|
const int MSECS_PER_FRAME_WHEN_THROTTLED = 66;
|
||||||
|
|
||||||
GLCanvas::GLCanvas() : QGLWidget(QGLFormat(QGL::NoDepthBuffer)),
|
GLCanvas::GLCanvas() : QGLWidget(QGL::NoDepthBuffer | QGL::NoStencilBuffer),
|
||||||
_throttleRendering(false),
|
_throttleRendering(false),
|
||||||
_idleRenderInterval(MSECS_PER_FRAME_WHEN_THROTTLED)
|
_idleRenderInterval(MSECS_PER_FRAME_WHEN_THROTTLED)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,7 @@ Hair::Hair(int strands,
|
||||||
_acceleration(0.0f),
|
_acceleration(0.0f),
|
||||||
_angularVelocity(0.0f),
|
_angularVelocity(0.0f),
|
||||||
_angularAcceleration(0.0f),
|
_angularAcceleration(0.0f),
|
||||||
_gravity(0.0f),
|
_gravity(DEFAULT_GRAVITY),
|
||||||
_loudness(0.0f)
|
_loudness(0.0f)
|
||||||
{
|
{
|
||||||
_hairPosition = new glm::vec3[_strands * _links];
|
_hairPosition = new glm::vec3[_strands * _links];
|
||||||
|
@ -53,7 +53,7 @@ Hair::Hair(int strands,
|
||||||
for (int strand = 0; strand < _strands; strand++) {
|
for (int strand = 0; strand < _strands; strand++) {
|
||||||
float strandAngle = randFloat() * PI;
|
float strandAngle = randFloat() * PI;
|
||||||
float azimuth;
|
float azimuth;
|
||||||
float elevation = PI_OVER_TWO - (randFloat() * 0.10f * PI);
|
float elevation = - (randFloat() * PI);
|
||||||
azimuth = PI_OVER_TWO;
|
azimuth = PI_OVER_TWO;
|
||||||
if (randFloat() < 0.5f) {
|
if (randFloat() < 0.5f) {
|
||||||
azimuth *= -1.0f;
|
azimuth *= -1.0f;
|
||||||
|
@ -127,7 +127,7 @@ void Hair::simulate(float deltaTime) {
|
||||||
_hairPosition[vertexIndex] += randVector() * (QUIESCENT_LOUDNESS + loudnessFactor) * ((float)link / (float)_links);
|
_hairPosition[vertexIndex] += randVector() * (QUIESCENT_LOUDNESS + loudnessFactor) * ((float)link / (float)_links);
|
||||||
|
|
||||||
// Add gravity
|
// Add gravity
|
||||||
const float SCALE_GRAVITY = 0.13f;
|
const float SCALE_GRAVITY = 0.001f;
|
||||||
_hairPosition[vertexIndex] += _gravity * deltaTime * SCALE_GRAVITY;
|
_hairPosition[vertexIndex] += _gravity * deltaTime * SCALE_GRAVITY;
|
||||||
|
|
||||||
// Add linear acceleration
|
// Add linear acceleration
|
||||||
|
|
|
@ -25,9 +25,10 @@ const int HAIR_CONSTRAINTS = 2;
|
||||||
|
|
||||||
const int DEFAULT_HAIR_STRANDS = 20;
|
const int DEFAULT_HAIR_STRANDS = 20;
|
||||||
const int DEFAULT_HAIR_LINKS = 10;
|
const int DEFAULT_HAIR_LINKS = 10;
|
||||||
const float DEFAULT_HAIR_RADIUS = 0.15f;
|
const float DEFAULT_HAIR_RADIUS = 0.075f;
|
||||||
const float DEFAULT_HAIR_LINK_LENGTH = 0.06f;
|
const float DEFAULT_HAIR_LINK_LENGTH = 0.06f;
|
||||||
const float DEFAULT_HAIR_THICKNESS = 0.025f;
|
const float DEFAULT_HAIR_THICKNESS = 0.025f;
|
||||||
|
const glm::vec3 DEFAULT_GRAVITY(0.0f, -9.8f, 0.0f);
|
||||||
|
|
||||||
class Hair {
|
class Hair {
|
||||||
public:
|
public:
|
||||||
|
@ -41,7 +42,6 @@ public:
|
||||||
void setAcceleration(const glm::vec3& acceleration) { _acceleration = acceleration; }
|
void setAcceleration(const glm::vec3& acceleration) { _acceleration = acceleration; }
|
||||||
void setAngularVelocity(const glm::vec3& angularVelocity) { _angularVelocity = angularVelocity; }
|
void setAngularVelocity(const glm::vec3& angularVelocity) { _angularVelocity = angularVelocity; }
|
||||||
void setAngularAcceleration(const glm::vec3& angularAcceleration) { _angularAcceleration = angularAcceleration; }
|
void setAngularAcceleration(const glm::vec3& angularAcceleration) { _angularAcceleration = angularAcceleration; }
|
||||||
void setGravity(const glm::vec3& gravity) { _gravity = gravity; }
|
|
||||||
void setLoudness(const float loudness) { _loudness = loudness; }
|
void setLoudness(const float loudness) { _loudness = loudness; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -373,6 +373,24 @@ Menu::Menu() :
|
||||||
shadowGroup->addAction(addCheckableActionToQMenuAndActionHash(shadowMenu, MenuOption::SimpleShadows, 0, false));
|
shadowGroup->addAction(addCheckableActionToQMenuAndActionHash(shadowMenu, MenuOption::SimpleShadows, 0, false));
|
||||||
shadowGroup->addAction(addCheckableActionToQMenuAndActionHash(shadowMenu, MenuOption::CascadedShadows, 0, false));
|
shadowGroup->addAction(addCheckableActionToQMenuAndActionHash(shadowMenu, MenuOption::CascadedShadows, 0, false));
|
||||||
|
|
||||||
|
{
|
||||||
|
QMenu* framerateMenu = renderOptionsMenu->addMenu(MenuOption::RenderTargetFramerate);
|
||||||
|
QActionGroup* framerateGroup = new QActionGroup(framerateMenu);
|
||||||
|
|
||||||
|
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerateUnlimited, 0, true));
|
||||||
|
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate60, 0, false));
|
||||||
|
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate50, 0, false));
|
||||||
|
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate40, 0, false));
|
||||||
|
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate30, 0, false));
|
||||||
|
connect(framerateMenu, SIGNAL(triggered(QAction*)), this, SLOT(changeRenderTargetFramerate(QAction*)));
|
||||||
|
|
||||||
|
#if defined(Q_OS_MAC)
|
||||||
|
#else
|
||||||
|
QAction* vsyncAction = addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::RenderTargetFramerateVSyncOn, 0, true, this, SLOT(changeVSync()));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QMenu* resolutionMenu = renderOptionsMenu->addMenu(MenuOption::RenderResolution);
|
QMenu* resolutionMenu = renderOptionsMenu->addMenu(MenuOption::RenderResolution);
|
||||||
QActionGroup* resolutionGroup = new QActionGroup(resolutionMenu);
|
QActionGroup* resolutionGroup = new QActionGroup(resolutionMenu);
|
||||||
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionOne, 0, false));
|
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionOne, 0, false));
|
||||||
|
@ -1235,6 +1253,33 @@ void Menu::muteEnvironment() {
|
||||||
free(packet);
|
free(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Menu::changeVSync() {
|
||||||
|
Application::getInstance()->setRenderTargetFramerate(
|
||||||
|
Application::getInstance()->getRenderTargetFramerate(),
|
||||||
|
isOptionChecked(MenuOption::RenderTargetFramerateVSyncOn));
|
||||||
|
}
|
||||||
|
void Menu::changeRenderTargetFramerate(QAction* action) {
|
||||||
|
bool vsynOn = Application::getInstance()->isVSyncOn();
|
||||||
|
unsigned int framerate = Application::getInstance()->getRenderTargetFramerate();
|
||||||
|
|
||||||
|
QString text = action->text();
|
||||||
|
if (text == MenuOption::RenderTargetFramerateUnlimited) {
|
||||||
|
Application::getInstance()->setRenderTargetFramerate(0, vsynOn);
|
||||||
|
}
|
||||||
|
else if (text == MenuOption::RenderTargetFramerate60) {
|
||||||
|
Application::getInstance()->setRenderTargetFramerate(60, vsynOn);
|
||||||
|
}
|
||||||
|
else if (text == MenuOption::RenderTargetFramerate50) {
|
||||||
|
Application::getInstance()->setRenderTargetFramerate(50, vsynOn);
|
||||||
|
}
|
||||||
|
else if (text == MenuOption::RenderTargetFramerate40) {
|
||||||
|
Application::getInstance()->setRenderTargetFramerate(40, vsynOn);
|
||||||
|
}
|
||||||
|
else if (text == MenuOption::RenderTargetFramerate30) {
|
||||||
|
Application::getInstance()->setRenderTargetFramerate(30, vsynOn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Menu::changeRenderResolution(QAction* action) {
|
void Menu::changeRenderResolution(QAction* action) {
|
||||||
QString text = action->text();
|
QString text = action->text();
|
||||||
if (text == MenuOption::RenderResolutionOne) {
|
if (text == MenuOption::RenderResolutionOne) {
|
||||||
|
|
|
@ -229,6 +229,8 @@ private slots:
|
||||||
void displayAddressOfflineMessage();
|
void displayAddressOfflineMessage();
|
||||||
void displayAddressNotFoundMessage();
|
void displayAddressNotFoundMessage();
|
||||||
void muteEnvironment();
|
void muteEnvironment();
|
||||||
|
void changeRenderTargetFramerate(QAction* action);
|
||||||
|
void changeVSync();
|
||||||
void changeRenderResolution(QAction* action);
|
void changeRenderResolution(QAction* action);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -452,6 +454,14 @@ namespace MenuOption {
|
||||||
const QString RenderHeightfields = "Render Heightfields";
|
const QString RenderHeightfields = "Render Heightfields";
|
||||||
const QString RenderLookAtVectors = "Show Look-at Vectors";
|
const QString RenderLookAtVectors = "Show Look-at Vectors";
|
||||||
const QString RenderSkeletonCollisionShapes = "Show Skeleton Collision Shapes";
|
const QString RenderSkeletonCollisionShapes = "Show Skeleton Collision Shapes";
|
||||||
|
const QString RenderTargetFramerate = "Framerate";
|
||||||
|
const QString RenderTargetFramerateUnlimited = "Unlimited";
|
||||||
|
const QString RenderTargetFramerate60 = "60";
|
||||||
|
const QString RenderTargetFramerate50 = "50";
|
||||||
|
const QString RenderTargetFramerate40 = "40";
|
||||||
|
const QString RenderTargetFramerate30 = "30";
|
||||||
|
const QString RenderTargetFramerateVSyncOn = "V-Sync On";
|
||||||
|
|
||||||
const QString RenderResolution = "Scale Resolution";
|
const QString RenderResolution = "Scale Resolution";
|
||||||
const QString RenderResolutionOne = "1";
|
const QString RenderResolutionOne = "1";
|
||||||
const QString RenderResolutionTwoThird = "2/3";
|
const QString RenderResolutionTwoThird = "2/3";
|
||||||
|
|
|
@ -110,11 +110,9 @@ int SimulateVisitor::visit(MetavoxelInfo& info) {
|
||||||
void MetavoxelSystem::simulate(float deltaTime) {
|
void MetavoxelSystem::simulate(float deltaTime) {
|
||||||
// update the lod
|
// update the lod
|
||||||
{
|
{
|
||||||
// the LOD threshold is temporarily tied to the avatar LOD parameter
|
|
||||||
QWriteLocker locker(&_lodLock);
|
QWriteLocker locker(&_lodLock);
|
||||||
const float BASE_LOD_THRESHOLD = 0.01f;
|
const float DEFAULT_LOD_THRESHOLD = 0.01f;
|
||||||
_lod = MetavoxelLOD(Application::getInstance()->getCamera()->getPosition(),
|
_lod = MetavoxelLOD(Application::getInstance()->getCamera()->getPosition(), DEFAULT_LOD_THRESHOLD);
|
||||||
BASE_LOD_THRESHOLD * Menu::getInstance()->getAvatarLODDistanceMultiplier());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulateVisitor simulateVisitor(deltaTime, getLOD());
|
SimulateVisitor simulateVisitor(deltaTime, getLOD());
|
||||||
|
|
|
@ -191,7 +191,6 @@ void Avatar::simulate(float deltaTime) {
|
||||||
_hair.setAcceleration(getAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
_hair.setAcceleration(getAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||||
_hair.setAngularVelocity((getAngularVelocity() + getHead()->getAngularVelocity()) * getHead()->getFinalOrientationInWorldFrame());
|
_hair.setAngularVelocity((getAngularVelocity() + getHead()->getAngularVelocity()) * getHead()->getFinalOrientationInWorldFrame());
|
||||||
_hair.setAngularAcceleration(getAngularAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
_hair.setAngularAcceleration(getAngularAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||||
_hair.setGravity(Application::getInstance()->getEnvironment()->getGravity(getPosition()) * getHead()->getFinalOrientationInWorldFrame());
|
|
||||||
_hair.setLoudness((float) getHeadData()->getAudioLoudness());
|
_hair.setLoudness((float) getHeadData()->getAudioLoudness());
|
||||||
_hair.simulate(deltaTime);
|
_hair.simulate(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,7 +217,6 @@ void MyAvatar::simulate(float deltaTime) {
|
||||||
_hair.setAcceleration(getAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
_hair.setAcceleration(getAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||||
_hair.setAngularVelocity((getAngularVelocity() + getHead()->getAngularVelocity()) * getHead()->getFinalOrientationInWorldFrame());
|
_hair.setAngularVelocity((getAngularVelocity() + getHead()->getAngularVelocity()) * getHead()->getFinalOrientationInWorldFrame());
|
||||||
_hair.setAngularAcceleration(getAngularAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
_hair.setAngularAcceleration(getAngularAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||||
_hair.setGravity(Application::getInstance()->getEnvironment()->getGravity(getPosition()) * getHead()->getFinalOrientationInWorldFrame());
|
|
||||||
_hair.setLoudness((float)getHeadData()->getAudioLoudness());
|
_hair.setLoudness((float)getHeadData()->getAudioLoudness());
|
||||||
_hair.simulate(deltaTime);
|
_hair.simulate(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,14 @@ void Joystick::closeJoystick() {
|
||||||
|
|
||||||
#ifdef HAVE_SDL2
|
#ifdef HAVE_SDL2
|
||||||
void Joystick::handleAxisEvent(const SDL_ControllerAxisEvent& event) {
|
void Joystick::handleAxisEvent(const SDL_ControllerAxisEvent& event) {
|
||||||
|
if (_axes.size() <= event.axis) {
|
||||||
|
_axes.resize(event.axis + 1);
|
||||||
|
}
|
||||||
|
|
||||||
float oldValue = _axes[event.axis];
|
float oldValue = _axes[event.axis];
|
||||||
float newValue = event.value / MAX_AXIS;
|
float newValue = event.value / MAX_AXIS;
|
||||||
_axes[event.axis] = newValue;
|
_axes[event.axis] = newValue;
|
||||||
|
|
||||||
emit axisValueChanged(event.axis, newValue, oldValue);
|
emit axisValueChanged(event.axis, newValue, oldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
//#define DO_IT_NOW(call, offset) runLastCommand();
|
//#define DO_IT_NOW(call, offset) runLastCommand();
|
||||||
#define DO_IT_NOW(call, offset)
|
#define DO_IT_NOW(call, offset)
|
||||||
|
|
||||||
#define CHECK_GL_ERROR() ::gpu::backend::checkGLError()
|
//#define CHECK_GL_ERROR() ::gpu::backend::checkGLError()
|
||||||
|
#define CHECK_GL_ERROR()
|
||||||
|
|
||||||
using namespace gpu;
|
using namespace gpu;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,8 @@ KeyEvent::KeyEvent() :
|
||||||
isMeta(false),
|
isMeta(false),
|
||||||
isAlt(false),
|
isAlt(false),
|
||||||
isKeypad(false),
|
isKeypad(false),
|
||||||
isValid(false)
|
isValid(false),
|
||||||
|
isAutoRepeat(false)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@ KeyEvent::KeyEvent(const QKeyEvent& event) {
|
||||||
isAlt = event.modifiers().testFlag(Qt::AltModifier);
|
isAlt = event.modifiers().testFlag(Qt::AltModifier);
|
||||||
isKeypad = event.modifiers().testFlag(Qt::KeypadModifier);
|
isKeypad = event.modifiers().testFlag(Qt::KeypadModifier);
|
||||||
isValid = true;
|
isValid = true;
|
||||||
|
isAutoRepeat = event.isAutoRepeat();
|
||||||
|
|
||||||
// handle special text for special characters...
|
// handle special text for special characters...
|
||||||
if (key == Qt::Key_F1) {
|
if (key == Qt::Key_F1) {
|
||||||
|
@ -127,7 +129,8 @@ bool KeyEvent::operator==(const KeyEvent& other) const {
|
||||||
&& other.isControl == isControl
|
&& other.isControl == isControl
|
||||||
&& other.isMeta == isMeta
|
&& other.isMeta == isMeta
|
||||||
&& other.isAlt == isAlt
|
&& other.isAlt == isAlt
|
||||||
&& other.isKeypad == isKeypad;
|
&& other.isKeypad == isKeypad
|
||||||
|
&& other.isAutoRepeat == isAutoRepeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,6 +166,7 @@ QScriptValue keyEventToScriptValue(QScriptEngine* engine, const KeyEvent& event)
|
||||||
obj.setProperty("isControl", event.isControl);
|
obj.setProperty("isControl", event.isControl);
|
||||||
obj.setProperty("isAlt", event.isAlt);
|
obj.setProperty("isAlt", event.isAlt);
|
||||||
obj.setProperty("isKeypad", event.isKeypad);
|
obj.setProperty("isKeypad", event.isKeypad);
|
||||||
|
obj.setProperty("isAutoRepeat", event.isAutoRepeat);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,6 +177,7 @@ void keyEventFromScriptValue(const QScriptValue& object, KeyEvent& event) {
|
||||||
event.isControl = object.property("isControl").toVariant().toBool();
|
event.isControl = object.property("isControl").toVariant().toBool();
|
||||||
event.isAlt = object.property("isAlt").toVariant().toBool();
|
event.isAlt = object.property("isAlt").toVariant().toBool();
|
||||||
event.isKeypad = object.property("isKeypad").toVariant().toBool();
|
event.isKeypad = object.property("isKeypad").toVariant().toBool();
|
||||||
|
event.isAutoRepeat = object.property("isAutoRepeat").toVariant().toBool();
|
||||||
|
|
||||||
QScriptValue key = object.property("key");
|
QScriptValue key = object.property("key");
|
||||||
if (key.isValid()) {
|
if (key.isValid()) {
|
||||||
|
@ -286,7 +291,8 @@ void keyEventFromScriptValue(const QScriptValue& object, KeyEvent& event) {
|
||||||
<< " event.isControl=" << event.isControl
|
<< " event.isControl=" << event.isControl
|
||||||
<< " event.isMeta=" << event.isMeta
|
<< " event.isMeta=" << event.isMeta
|
||||||
<< " event.isAlt=" << event.isAlt
|
<< " event.isAlt=" << event.isAlt
|
||||||
<< " event.isKeypad=" << event.isKeypad;
|
<< " event.isKeypad=" << event.isKeypad
|
||||||
|
<< " event.isAutoRepeat=" << event.isAutoRepeat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
bool isAlt;
|
bool isAlt;
|
||||||
bool isKeypad;
|
bool isKeypad;
|
||||||
bool isValid;
|
bool isValid;
|
||||||
|
bool isAutoRepeat;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue