mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:03:35 +02:00
Merge pull request #1183 from ey6es/master
Tweaks to voxel editing from Philip's Basecamp request.
This commit is contained in:
commit
0ca8440f46
6 changed files with 30 additions and 7 deletions
|
@ -124,6 +124,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||||
_isHoverVoxel(false),
|
_isHoverVoxel(false),
|
||||||
_isHoverVoxelSounding(false),
|
_isHoverVoxelSounding(false),
|
||||||
_mouseVoxelScale(1.0f / 1024.0f),
|
_mouseVoxelScale(1.0f / 1024.0f),
|
||||||
|
_mouseVoxelScaleInitialized(false),
|
||||||
_justEditedVoxel(false),
|
_justEditedVoxel(false),
|
||||||
_nudgeStarted(false),
|
_nudgeStarted(false),
|
||||||
_lookingAlongX(false),
|
_lookingAlongX(false),
|
||||||
|
@ -1782,7 +1783,7 @@ void Application::shrinkMirrorView() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const float MAX_AVATAR_EDIT_VELOCITY = 1.0f;
|
const float MAX_AVATAR_EDIT_VELOCITY = 1.0f;
|
||||||
const float MAX_VOXEL_EDIT_DISTANCE = 20.0f;
|
const float MAX_VOXEL_EDIT_DISTANCE = 50.0f;
|
||||||
const float HEAD_SPHERE_RADIUS = 0.07;
|
const float HEAD_SPHERE_RADIUS = 0.07;
|
||||||
|
|
||||||
static QUuid DEFAULT_NODE_ID_REF;
|
static QUuid DEFAULT_NODE_ID_REF;
|
||||||
|
@ -1987,8 +1988,8 @@ void Application::updateMyAvatarLookAtPosition(glm::vec3& lookAtSpot, glm::vec3&
|
||||||
// deflect using Faceshift gaze data
|
// deflect using Faceshift gaze data
|
||||||
glm::vec3 origin = _myAvatar.getHead().calculateAverageEyePosition();
|
glm::vec3 origin = _myAvatar.getHead().calculateAverageEyePosition();
|
||||||
float pitchSign = (_myCamera.getMode() == CAMERA_MODE_MIRROR) ? -1.0f : 1.0f;
|
float pitchSign = (_myCamera.getMode() == CAMERA_MODE_MIRROR) ? -1.0f : 1.0f;
|
||||||
const float PITCH_SCALE = 0.5f;
|
const float PITCH_SCALE = 0.25f;
|
||||||
const float YAW_SCALE = 0.5f;
|
const float YAW_SCALE = 0.25f;
|
||||||
lookAtSpot = origin + _myCamera.getRotation() * glm::quat(glm::radians(glm::vec3(
|
lookAtSpot = origin + _myCamera.getRotation() * glm::quat(glm::radians(glm::vec3(
|
||||||
_faceshift.getEstimatedEyePitch() * pitchSign * PITCH_SCALE, _faceshift.getEstimatedEyeYaw() * YAW_SCALE, 0.0f))) *
|
_faceshift.getEstimatedEyePitch() * pitchSign * PITCH_SCALE, _faceshift.getEstimatedEyeYaw() * YAW_SCALE, 0.0f))) *
|
||||||
glm::inverse(_myCamera.getRotation()) * (lookAtSpot - origin);
|
glm::inverse(_myCamera.getRotation()) * (lookAtSpot - origin);
|
||||||
|
@ -2051,6 +2052,8 @@ void Application::updateMouseVoxels(float deltaTime, glm::vec3& mouseRayOrigin,
|
||||||
PerformanceWarning warn(showWarnings, "Application::updateMouseVoxels()");
|
PerformanceWarning warn(showWarnings, "Application::updateMouseVoxels()");
|
||||||
|
|
||||||
_mouseVoxel.s = 0.0f;
|
_mouseVoxel.s = 0.0f;
|
||||||
|
bool wasInitialized = _mouseVoxelScaleInitialized;
|
||||||
|
_mouseVoxelScaleInitialized = false;
|
||||||
if (Menu::getInstance()->isVoxelModeActionChecked() &&
|
if (Menu::getInstance()->isVoxelModeActionChecked() &&
|
||||||
(fabs(_myAvatar.getVelocity().x) +
|
(fabs(_myAvatar.getVelocity().x) +
|
||||||
fabs(_myAvatar.getVelocity().y) +
|
fabs(_myAvatar.getVelocity().y) +
|
||||||
|
@ -2058,6 +2061,12 @@ void Application::updateMouseVoxels(float deltaTime, glm::vec3& mouseRayOrigin,
|
||||||
|
|
||||||
if (_voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _mouseVoxel, distance, face)) {
|
if (_voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _mouseVoxel, distance, face)) {
|
||||||
if (distance < MAX_VOXEL_EDIT_DISTANCE) {
|
if (distance < MAX_VOXEL_EDIT_DISTANCE) {
|
||||||
|
// set the voxel scale to that of the first moused-over voxel
|
||||||
|
if (!wasInitialized) {
|
||||||
|
_mouseVoxelScale = _mouseVoxel.s;
|
||||||
|
}
|
||||||
|
_mouseVoxelScaleInitialized = true;
|
||||||
|
|
||||||
// find the nearest voxel with the desired scale
|
// find the nearest voxel with the desired scale
|
||||||
if (_mouseVoxelScale > _mouseVoxel.s) {
|
if (_mouseVoxelScale > _mouseVoxel.s) {
|
||||||
// choose the larger voxel that encompasses the one selected
|
// choose the larger voxel that encompasses the one selected
|
||||||
|
@ -2990,6 +2999,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE);
|
glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE);
|
||||||
|
const float CUBE_EXPANSION = 1.01f;
|
||||||
if (_nudgeStarted) {
|
if (_nudgeStarted) {
|
||||||
renderNudgeGuide(_nudgeGuidePosition.x, _nudgeGuidePosition.y, _nudgeGuidePosition.z, _nudgeVoxel.s);
|
renderNudgeGuide(_nudgeGuidePosition.x, _nudgeGuidePosition.y, _nudgeGuidePosition.z, _nudgeVoxel.s);
|
||||||
renderNudgeGrid(_nudgeVoxel.x, _nudgeVoxel.y, _nudgeVoxel.z, _nudgeVoxel.s, _mouseVoxel.s);
|
renderNudgeGrid(_nudgeVoxel.x, _nudgeVoxel.y, _nudgeVoxel.z, _nudgeVoxel.s, _mouseVoxel.s);
|
||||||
|
@ -2999,7 +3009,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
|
||||||
_nudgeVoxel.z + _nudgeVoxel.s * 0.5f);
|
_nudgeVoxel.z + _nudgeVoxel.s * 0.5f);
|
||||||
glColor3ub(255, 255, 255);
|
glColor3ub(255, 255, 255);
|
||||||
glLineWidth(4.0f);
|
glLineWidth(4.0f);
|
||||||
glutWireCube(_nudgeVoxel.s);
|
glutWireCube(_nudgeVoxel.s * CUBE_EXPANSION);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
} else {
|
} else {
|
||||||
renderMouseVoxelGrid(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
|
renderMouseVoxelGrid(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
|
||||||
|
@ -3018,13 +3028,13 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
|
||||||
_nudgeGuidePosition.y + _nudgeVoxel.s*0.5f,
|
_nudgeGuidePosition.y + _nudgeVoxel.s*0.5f,
|
||||||
_nudgeGuidePosition.z + _nudgeVoxel.s*0.5f);
|
_nudgeGuidePosition.z + _nudgeVoxel.s*0.5f);
|
||||||
glLineWidth(4.0f);
|
glLineWidth(4.0f);
|
||||||
glutWireCube(_nudgeVoxel.s);
|
glutWireCube(_nudgeVoxel.s * CUBE_EXPANSION);
|
||||||
} else {
|
} else {
|
||||||
glTranslatef(_mouseVoxel.x + _mouseVoxel.s*0.5f,
|
glTranslatef(_mouseVoxel.x + _mouseVoxel.s*0.5f,
|
||||||
_mouseVoxel.y + _mouseVoxel.s*0.5f,
|
_mouseVoxel.y + _mouseVoxel.s*0.5f,
|
||||||
_mouseVoxel.z + _mouseVoxel.s*0.5f);
|
_mouseVoxel.z + _mouseVoxel.s*0.5f);
|
||||||
glLineWidth(4.0f);
|
glLineWidth(4.0f);
|
||||||
glutWireCube(_mouseVoxel.s);
|
glutWireCube(_mouseVoxel.s * CUBE_EXPANSION);
|
||||||
}
|
}
|
||||||
glLineWidth(1.0f);
|
glLineWidth(1.0f);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
|
@ -378,6 +378,7 @@ private:
|
||||||
|
|
||||||
VoxelDetail _mouseVoxel; // details of the voxel to be edited
|
VoxelDetail _mouseVoxel; // details of the voxel to be edited
|
||||||
float _mouseVoxelScale; // the scale for adding/removing voxels
|
float _mouseVoxelScale; // the scale for adding/removing voxels
|
||||||
|
bool _mouseVoxelScaleInitialized;
|
||||||
glm::vec3 _lastMouseVoxelPos; // the position of the last mouse voxel edit
|
glm::vec3 _lastMouseVoxelPos; // the position of the last mouse voxel edit
|
||||||
bool _justEditedVoxel; // set when we've just added/deleted/colored a voxel
|
bool _justEditedVoxel; // set when we've just added/deleted/colored a voxel
|
||||||
|
|
||||||
|
|
|
@ -326,6 +326,7 @@ Menu::Menu() :
|
||||||
false,
|
false,
|
||||||
appInstance->getFaceshift(),
|
appInstance->getFaceshift(),
|
||||||
SLOT(setTCPEnabled(bool)));
|
SLOT(setTCPEnabled(bool)));
|
||||||
|
addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::ChatCircling, 0, true);
|
||||||
|
|
||||||
QMenu* webcamOptionsMenu = developerMenu->addMenu("Webcam Options");
|
QMenu* webcamOptionsMenu = developerMenu->addMenu("Webcam Options");
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,7 @@ namespace MenuOption {
|
||||||
const QString AutomaticallyAuditTree = "Automatically Audit Tree Stats";
|
const QString AutomaticallyAuditTree = "Automatically Audit Tree Stats";
|
||||||
const QString Bandwidth = "Bandwidth Display";
|
const QString Bandwidth = "Bandwidth Display";
|
||||||
const QString BandwidthDetails = "Bandwidth Details";
|
const QString BandwidthDetails = "Bandwidth Details";
|
||||||
|
const QString ChatCircling = "Chat Circling";
|
||||||
const QString Collisions = "Collisions";
|
const QString Collisions = "Collisions";
|
||||||
const QString CopyVoxels = "Copy";
|
const QString CopyVoxels = "Copy";
|
||||||
const QString CoverageMap = "Render Coverage Map";
|
const QString CoverageMap = "Render Coverage Map";
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "DataServerClient.h"
|
#include "DataServerClient.h"
|
||||||
|
#include "Menu.h"
|
||||||
#include "MyAvatar.h"
|
#include "MyAvatar.h"
|
||||||
#include "Physics.h"
|
#include "Physics.h"
|
||||||
#include "devices/OculusManager.h"
|
#include "devices/OculusManager.h"
|
||||||
|
@ -1059,6 +1060,11 @@ void MyAvatar::updateAvatarCollisions(float deltaTime) {
|
||||||
// detect collisions with other avatars and respond
|
// detect collisions with other avatars and respond
|
||||||
void MyAvatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime) {
|
void MyAvatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime) {
|
||||||
|
|
||||||
|
// for now, don't collide if we have a new skeleton
|
||||||
|
if (_skeletonModel.isActive()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 bodyPushForce = glm::vec3(0.0f, 0.0f, 0.0f);
|
glm::vec3 bodyPushForce = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
// loop through the body balls of each avatar to check for every possible collision
|
// loop through the body balls of each avatar to check for every possible collision
|
||||||
|
@ -1110,6 +1116,10 @@ bool operator<(const SortedAvatar& s1, const SortedAvatar& s2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::updateChatCircle(float deltaTime) {
|
void MyAvatar::updateChatCircle(float deltaTime) {
|
||||||
|
if (!Menu::getInstance()->isOptionChecked(MenuOption::ChatCircling)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// find all members and sort by distance
|
// find all members and sort by distance
|
||||||
QVector<SortedAvatar> sortedAvatars;
|
QVector<SortedAvatar> sortedAvatars;
|
||||||
NodeList* nodeList = NodeList::getInstance();
|
NodeList* nodeList = NodeList::getInstance();
|
||||||
|
|
|
@ -68,7 +68,7 @@ void Faceshift::update() {
|
||||||
(_eyeGazeLeftPitch + _eyeGazeRightPitch) / 2.0f, (_eyeGazeLeftYaw + _eyeGazeRightYaw) / 2.0f, 0.0f))));
|
(_eyeGazeLeftPitch + _eyeGazeRightPitch) / 2.0f, (_eyeGazeLeftYaw + _eyeGazeRightYaw) / 2.0f, 0.0f))));
|
||||||
|
|
||||||
// compute and subtract the long term average
|
// compute and subtract the long term average
|
||||||
const float LONG_TERM_AVERAGE_SMOOTHING = 0.9999f;
|
const float LONG_TERM_AVERAGE_SMOOTHING = 0.999f;
|
||||||
if (!_longTermAverageInitialized) {
|
if (!_longTermAverageInitialized) {
|
||||||
_longTermAverageEyePitch = eulers.x;
|
_longTermAverageEyePitch = eulers.x;
|
||||||
_longTermAverageEyeYaw = eulers.y;
|
_longTermAverageEyeYaw = eulers.y;
|
||||||
|
|
Loading…
Reference in a new issue