mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 04:41:15 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into 19561
This commit is contained in:
commit
df6df759a3
3 changed files with 31 additions and 42 deletions
|
@ -2711,7 +2711,7 @@ void Application::displayOverlay() {
|
||||||
|
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::HeadMouse)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::HeadMouse)) {
|
||||||
_myAvatar->renderHeadMouse();
|
_myAvatar->renderHeadMouse(_glWidget->width(), _glWidget->height());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display stats and log text onscreen
|
// Display stats and log text onscreen
|
||||||
|
|
|
@ -82,11 +82,8 @@ MyAvatar::~MyAvatar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::reset() {
|
void MyAvatar::reset() {
|
||||||
// TODO? resurrect headMouse stuff?
|
|
||||||
//_headMouseX = _glWidget->width() / 2;
|
|
||||||
//_headMouseY = _glWidget->height() / 2;
|
|
||||||
_skeletonModel.reset();
|
_skeletonModel.reset();
|
||||||
getHead()->reset();
|
getHead()->reset();
|
||||||
getHand()->reset();
|
getHand()->reset();
|
||||||
_oculusYawOffset = 0.0f;
|
_oculusYawOffset = 0.0f;
|
||||||
|
|
||||||
|
@ -103,23 +100,7 @@ void MyAvatar::update(float deltaTime) {
|
||||||
// Faceshift drive is enabled, set the avatar drive based on the head position
|
// Faceshift drive is enabled, set the avatar drive based on the head position
|
||||||
moveWithLean();
|
moveWithLean();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update head mouse from faceshift if active
|
|
||||||
Faceshift* faceshift = Application::getInstance()->getFaceshift();
|
|
||||||
if (faceshift->isActive()) {
|
|
||||||
// TODO? resurrect headMouse stuff?
|
|
||||||
//glm::vec3 headVelocity = faceshift->getHeadAngularVelocity();
|
|
||||||
//// sets how quickly head angular rotation moves the head mouse
|
|
||||||
//const float HEADMOUSE_FACESHIFT_YAW_SCALE = 40.0f;
|
|
||||||
//const float HEADMOUSE_FACESHIFT_PITCH_SCALE = 30.0f;
|
|
||||||
//_headMouseX -= headVelocity.y * HEADMOUSE_FACESHIFT_YAW_SCALE;
|
|
||||||
//_headMouseY -= headVelocity.x * HEADMOUSE_FACESHIFT_PITCH_SCALE;
|
|
||||||
//
|
|
||||||
//// Constrain head-driven mouse to edges of screen
|
|
||||||
//_headMouseX = glm::clamp(_headMouseX, 0, _glWidget->width());
|
|
||||||
//_headMouseY = glm::clamp(_headMouseY, 0, _glWidget->height());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get audio loudness data from audio input device
|
// Get audio loudness data from audio input device
|
||||||
Audio* audio = Application::getInstance()->getAudio();
|
Audio* audio = Application::getInstance()->getAudio();
|
||||||
head->setAudioLoudness(audio->getLastInputLoudness());
|
head->setAudioLoudness(audio->getLastInputLoudness());
|
||||||
|
@ -422,32 +403,41 @@ void MyAvatar::render(const glm::vec3& cameraPosition, RenderMode renderMode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::renderHeadMouse() const {
|
void MyAvatar::renderHeadMouse(int screenWidth, int screenHeight) const {
|
||||||
// TODO? resurrect headMouse stuff?
|
|
||||||
/*
|
Faceshift* faceshift = Application::getInstance()->getFaceshift();
|
||||||
|
|
||||||
// Display small target box at center or head mouse target that can also be used to measure LOD
|
// Display small target box at center or head mouse target that can also be used to measure LOD
|
||||||
|
float headPitch = getHead()->getFinalPitch();
|
||||||
|
float headYaw = getHead()->getFinalYaw();
|
||||||
|
//
|
||||||
|
// It should be noted that the following constant is a function
|
||||||
|
// how far the viewer's head is away from both the screen and the size of the screen,
|
||||||
|
// which are both things we cannot know without adding a calibration phase.
|
||||||
|
//
|
||||||
|
const float PIXELS_PER_VERTICAL_DEGREE = 20.0f;
|
||||||
|
float aspectRatio = (float) screenWidth / (float) screenHeight;
|
||||||
|
int headMouseX = screenWidth / 2.f - headYaw * aspectRatio * PIXELS_PER_VERTICAL_DEGREE;
|
||||||
|
int headMouseY = screenHeight / 2.f - headPitch * PIXELS_PER_VERTICAL_DEGREE;
|
||||||
|
|
||||||
glColor3f(1.0f, 1.0f, 1.0f);
|
glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
glDisable(GL_LINE_SMOOTH);
|
glDisable(GL_LINE_SMOOTH);
|
||||||
const int PIXEL_BOX = 16;
|
const int PIXEL_BOX = 16;
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glVertex2f(_headMouseX - PIXEL_BOX/2, _headMouseY);
|
glVertex2f(headMouseX - PIXEL_BOX/2, headMouseY);
|
||||||
glVertex2f(_headMouseX + PIXEL_BOX/2, _headMouseY);
|
glVertex2f(headMouseX + PIXEL_BOX/2, headMouseY);
|
||||||
glVertex2f(_headMouseX, _headMouseY - PIXEL_BOX/2);
|
glVertex2f(headMouseX, headMouseY - PIXEL_BOX/2);
|
||||||
glVertex2f(_headMouseX, _headMouseY + PIXEL_BOX/2);
|
glVertex2f(headMouseX, headMouseY + PIXEL_BOX/2);
|
||||||
glEnd();
|
glEnd();
|
||||||
glEnable(GL_LINE_SMOOTH);
|
glEnable(GL_LINE_SMOOTH);
|
||||||
glColor3f(1.0f, 0.0f, 0.0f);
|
|
||||||
glPointSize(3.0f);
|
|
||||||
glDisable(GL_POINT_SMOOTH);
|
|
||||||
glBegin(GL_POINTS);
|
|
||||||
glVertex2f(_headMouseX - 1, _headMouseY + 1);
|
|
||||||
glEnd();
|
|
||||||
// If Faceshift is active, show eye pitch and yaw as separate pointer
|
// If Faceshift is active, show eye pitch and yaw as separate pointer
|
||||||
if (_faceshift.isActive()) {
|
if (faceshift->isActive()) {
|
||||||
const float EYE_TARGET_PIXELS_PER_DEGREE = 40.0;
|
|
||||||
int eyeTargetX = (_glWidget->width() / 2) - _faceshift.getEstimatedEyeYaw() * EYE_TARGET_PIXELS_PER_DEGREE;
|
|
||||||
int eyeTargetY = (_glWidget->height() / 2) - _faceshift.getEstimatedEyePitch() * EYE_TARGET_PIXELS_PER_DEGREE;
|
|
||||||
|
|
||||||
|
float avgEyePitch = faceshift->getEstimatedEyePitch();
|
||||||
|
float avgEyeYaw = faceshift->getEstimatedEyeYaw();
|
||||||
|
int eyeTargetX = (screenWidth / 2) - avgEyeYaw * aspectRatio * PIXELS_PER_VERTICAL_DEGREE;
|
||||||
|
int eyeTargetY = (screenHeight / 2) - avgEyePitch * PIXELS_PER_VERTICAL_DEGREE;
|
||||||
|
|
||||||
glColor3f(0.0f, 1.0f, 1.0f);
|
glColor3f(0.0f, 1.0f, 1.0f);
|
||||||
glDisable(GL_LINE_SMOOTH);
|
glDisable(GL_LINE_SMOOTH);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
|
@ -458,7 +448,6 @@ void MyAvatar::renderHeadMouse() const {
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::setLocalGravity(glm::vec3 gravity) {
|
void MyAvatar::setLocalGravity(glm::vec3 gravity) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
void renderBody(RenderMode renderMode, float glowLevel = 0.0f);
|
void renderBody(RenderMode renderMode, float glowLevel = 0.0f);
|
||||||
bool shouldRenderHead(const glm::vec3& cameraPosition, RenderMode renderMode) const;
|
bool shouldRenderHead(const glm::vec3& cameraPosition, RenderMode renderMode) const;
|
||||||
void renderDebugBodyPoints();
|
void renderDebugBodyPoints();
|
||||||
void renderHeadMouse() const;
|
void renderHeadMouse(int screenWidth, int screenHeight) const;
|
||||||
|
|
||||||
// setters
|
// setters
|
||||||
void setMousePressed(bool mousePressed) { _mousePressed = mousePressed; }
|
void setMousePressed(bool mousePressed) { _mousePressed = mousePressed; }
|
||||||
|
@ -123,7 +123,7 @@ private:
|
||||||
glm::vec3 _gravity;
|
glm::vec3 _gravity;
|
||||||
glm::vec3 _environmentGravity;
|
glm::vec3 _environmentGravity;
|
||||||
float _distanceToNearestAvatar; // How close is the nearest avatar?
|
float _distanceToNearestAvatar; // How close is the nearest avatar?
|
||||||
|
|
||||||
// motion stuff
|
// motion stuff
|
||||||
glm::vec3 _lastCollisionPosition;
|
glm::vec3 _lastCollisionPosition;
|
||||||
bool _speedBrakes;
|
bool _speedBrakes;
|
||||||
|
|
Loading…
Reference in a new issue