mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:44:01 +02:00
Merge pull request #599 from PhilipRosedale/master
3P transition turned off, field of view now in preferences
This commit is contained in:
commit
147f090d56
7 changed files with 42 additions and 14 deletions
|
@ -451,7 +451,7 @@ void Application::resizeGL(int width, int height) {
|
|||
}
|
||||
} else {
|
||||
camera.setAspectRatio(aspectRatio);
|
||||
camera.setFieldOfView(fov = 60);
|
||||
camera.setFieldOfView(fov = _horizontalFieldOfView);
|
||||
}
|
||||
|
||||
// Tell our viewFrustum about this change
|
||||
|
@ -1047,6 +1047,12 @@ void Application::editPreferences() {
|
|||
avatarURL->setMinimumWidth(400);
|
||||
form->addRow("Avatar URL:", avatarURL);
|
||||
|
||||
QSpinBox* horizontalFieldOfView = new QSpinBox();
|
||||
horizontalFieldOfView->setMaximum(180);
|
||||
horizontalFieldOfView->setMinimum(1);
|
||||
horizontalFieldOfView->setValue(_horizontalFieldOfView);
|
||||
form->addRow("Horizontal field of view (degrees):", horizontalFieldOfView);
|
||||
|
||||
QDoubleSpinBox* headCameraPitchYawScale = new QDoubleSpinBox();
|
||||
headCameraPitchYawScale->setValue(_headCameraPitchYawScale);
|
||||
form->addRow("Head Camera Pitch/Yaw Scale:", headCameraPitchYawScale);
|
||||
|
@ -1078,6 +1084,9 @@ void Application::editPreferences() {
|
|||
if (!shouldDynamicallySetJitterBuffer()) {
|
||||
_audio.setJitterBufferSamples(_audioJitterBufferSamples);
|
||||
}
|
||||
_horizontalFieldOfView = horizontalFieldOfView->value();
|
||||
resizeGL(_glWidget->width(), _glWidget->height());
|
||||
|
||||
}
|
||||
|
||||
void Application::pair() {
|
||||
|
@ -1625,7 +1634,7 @@ void Application::init() {
|
|||
|
||||
_myAvatar.init();
|
||||
_myAvatar.setPosition(START_LOCATION);
|
||||
_myCamera.setMode(CAMERA_MODE_THIRD_PERSON);
|
||||
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
|
||||
_myCamera.setModeShiftRate(1.0f);
|
||||
_myAvatar.setDisplayingLookatVectors(false);
|
||||
|
||||
|
@ -1683,7 +1692,7 @@ void Application::update(float deltaTime) {
|
|||
_myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
|
||||
|
||||
// If we are dragging on a voxel, add thrust according to the amount the mouse is dragging
|
||||
const float VOXEL_GRAB_THRUST = 5.0f;
|
||||
const float VOXEL_GRAB_THRUST = 0.0f;
|
||||
if (_mousePressed && (_mouseVoxel.s != 0)) {
|
||||
glm::vec2 mouseDrag(_mouseX - _mouseDragStartedX, _mouseY - _mouseDragStartedY);
|
||||
glm::quat orientation = _myAvatar.getOrientation();
|
||||
|
@ -1857,7 +1866,7 @@ void Application::update(float deltaTime) {
|
|||
_myCamera.setModeShiftRate(1.0f);
|
||||
}
|
||||
} else {
|
||||
const float THIRD_PERSON_SHIFT_VELOCITY = 2.0f;
|
||||
const float THIRD_PERSON_SHIFT_VELOCITY = 1000.0f;
|
||||
const float TIME_BEFORE_SHIFT_INTO_FIRST_PERSON = 0.75f;
|
||||
const float TIME_BEFORE_SHIFT_INTO_THIRD_PERSON = 0.1f;
|
||||
|
||||
|
@ -2933,6 +2942,8 @@ void Application::loadSettings(QSettings* settings) {
|
|||
|
||||
_headCameraPitchYawScale = loadSetting(settings, "headCameraPitchYawScale", 0.0f);
|
||||
_audioJitterBufferSamples = loadSetting(settings, "audioJitterBufferSamples", 0);
|
||||
_horizontalFieldOfView = loadSetting(settings, "horizontalFieldOfView", HORIZONTAL_FIELD_OF_VIEW_DEGREES);
|
||||
|
||||
settings->beginGroup("View Frustum Offset Camera");
|
||||
// in case settings is corrupt or missing loadSetting() will check for NaN
|
||||
_viewFrustumOffsetYaw = loadSetting(settings, "viewFrustumOffsetYaw" , 0.0f);
|
||||
|
@ -2954,6 +2965,7 @@ void Application::saveSettings(QSettings* settings) {
|
|||
|
||||
settings->setValue("headCameraPitchYawScale", _headCameraPitchYawScale);
|
||||
settings->setValue("audioJitterBufferSamples", _audioJitterBufferSamples);
|
||||
settings->setValue("horizontalFieldOfView", _horizontalFieldOfView);
|
||||
settings->beginGroup("View Frustum Offset Camera");
|
||||
settings->setValue("viewFrustumOffsetYaw", _viewFrustumOffsetYaw);
|
||||
settings->setValue("viewFrustumOffsetPitch", _viewFrustumOffsetPitch);
|
||||
|
|
|
@ -297,6 +297,8 @@ private:
|
|||
|
||||
int _audioJitterBufferSamples; // Number of extra samples to wait before starting audio playback
|
||||
|
||||
float _horizontalFieldOfView; // In Degrees, doesn't apply to HMD like Oculus
|
||||
|
||||
HandControl _handControl;
|
||||
|
||||
int _mouseX;
|
||||
|
|
|
@ -348,12 +348,12 @@ Audio::Audio(Oscilloscope* scope, int16_t initialJitterBufferSamples) :
|
|||
|
||||
inputParameters.channelCount = 2; // Stereo input
|
||||
inputParameters.sampleFormat = (paInt16 | paNonInterleaved);
|
||||
inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultLowInputLatency;
|
||||
inputParameters.suggestedLatency = Pa_GetDeviceInfo(inputParameters.device)->defaultLowInputLatency;
|
||||
inputParameters.hostApiSpecificStreamInfo = NULL;
|
||||
|
||||
outputParameters.channelCount = 2; // Stereo output
|
||||
outputParameters.sampleFormat = (paInt16 | paNonInterleaved);
|
||||
outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
|
||||
outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
|
||||
outputParameters.hostApiSpecificStreamInfo = NULL;
|
||||
|
||||
outputPortAudioError(Pa_OpenStream(&_stream,
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#define __interface__Audio__
|
||||
|
||||
#include <portaudio.h>
|
||||
|
||||
#include <AudioRingBuffer.h>
|
||||
#include <StdDev.h>
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "world.h"
|
||||
|
||||
const float INITIAL_AREA = 0.2f;
|
||||
const float BALL_RADIUS = 0.025f;
|
||||
const float BALL_RADIUS = 0.016f;
|
||||
const glm::vec3 INITIAL_COLOR(0.62f, 0.74f, 0.91f);
|
||||
|
||||
Balls::Balls(int numberOfBalls) {
|
||||
|
@ -83,8 +83,9 @@ void Balls::render() {
|
|||
}
|
||||
|
||||
const float CONSTANT_VELOCITY_DAMPING = 1.0f;
|
||||
const float NOISE_SCALE = 0.00;
|
||||
const float SPRING_FORCE = 1.0;
|
||||
const float NOISE_SCALE = 0.06;
|
||||
const float SPRING_FORCE = 30.0;
|
||||
const float ORIGIN_DISTANCE = 0.1;
|
||||
const float SPRING_DAMPING = 1.0;
|
||||
|
||||
void Balls::simulate(float deltaTime) {
|
||||
|
@ -100,10 +101,21 @@ void Balls::simulate(float deltaTime) {
|
|||
// Add noise
|
||||
_balls[i].velocity += randVector() * NOISE_SCALE;
|
||||
|
||||
// spring force to origin
|
||||
float separation = glm::distance(_balls[i].position,
|
||||
_origin);
|
||||
|
||||
_balls[i].velocity +=
|
||||
glm::normalize(_balls[i].position - _origin)
|
||||
* deltaTime
|
||||
*
|
||||
SPRING_FORCE *
|
||||
(ORIGIN_DISTANCE - separation);
|
||||
|
||||
// Approach target position
|
||||
for (unsigned int i = 0; i < _numberOfBalls; ++i) {
|
||||
_balls[i].position += randFloat() * deltaTime * (_balls[i].targetPosition - _balls[i].position);
|
||||
}
|
||||
// for (unsigned int i = 0; i < _numberOfBalls; ++i) {
|
||||
// _balls[i].position += randFloat() * deltaTime * (_balls[i].targetPosition - _balls[i].position);
|
||||
// }
|
||||
|
||||
// Spring Force
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ const float CAMERA_MIRROR_MODE_UP_SHIFT = 0.0f;
|
|||
const float CAMERA_MIRROR_MODE_DISTANCE = 0.3f;
|
||||
const float CAMERA_MIRROR_MODE_TIGHTNESS = 100.0f;
|
||||
|
||||
|
||||
Camera::Camera() {
|
||||
|
||||
_needsToInitialize = true;
|
||||
|
@ -35,7 +36,7 @@ Camera::Camera() {
|
|||
_linearModeShift = 0.0f;
|
||||
_mode = CAMERA_MODE_THIRD_PERSON;
|
||||
_tightness = 10.0f; // default
|
||||
_fieldOfView = 60.0f; // default
|
||||
_fieldOfView = HORIZONTAL_FIELD_OF_VIEW_DEGREES;
|
||||
_nearClip = 0.08f; // default
|
||||
_farClip = 50.0f * TREE_SCALE; // default
|
||||
_upShift = 0.0f;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
||||
const float HORIZONTAL_FIELD_OF_VIEW_DEGREES = 90.0f;
|
||||
|
||||
enum CameraMode
|
||||
{
|
||||
CAMERA_MODE_NULL = -1,
|
||||
|
|
Loading…
Reference in a new issue