mirror of
https://github.com/overte-org/overte.git
synced 2025-06-28 12:29:57 +02:00
Merge branch 'master' of https://github.com/worklist/hifi into fix_key_press_event
This commit is contained in:
commit
8c112cbec3
4 changed files with 48 additions and 28 deletions
|
@ -933,7 +933,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) {
|
||||||
|
|
||||||
const bool MAKE_SOUND_ON_VOXEL_HOVER = false;
|
const bool MAKE_SOUND_ON_VOXEL_HOVER = false;
|
||||||
const bool MAKE_SOUND_ON_VOXEL_CLICK = true;
|
const bool MAKE_SOUND_ON_VOXEL_CLICK = true;
|
||||||
const float HOVER_VOXEL_FREQUENCY = 14080.f;
|
const float HOVER_VOXEL_FREQUENCY = 7040.f;
|
||||||
const float HOVER_VOXEL_DECAY = 0.999f;
|
const float HOVER_VOXEL_DECAY = 0.999f;
|
||||||
|
|
||||||
void Application::mousePressEvent(QMouseEvent* event) {
|
void Application::mousePressEvent(QMouseEvent* event) {
|
||||||
|
@ -2249,14 +2249,20 @@ void Application::update(float deltaTime) {
|
||||||
// If we have clicked on a voxel, update it's color
|
// If we have clicked on a voxel, update it's color
|
||||||
if (_isHoverVoxelSounding) {
|
if (_isHoverVoxelSounding) {
|
||||||
VoxelNode* hoveredNode = _voxels.getVoxelAt(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z, _hoverVoxel.s);
|
VoxelNode* hoveredNode = _voxels.getVoxelAt(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z, _hoverVoxel.s);
|
||||||
float bright = _audio.getCollisionSoundMagnitude();
|
if (hoveredNode) {
|
||||||
nodeColor clickColor = { 255 * bright + _hoverVoxelOriginalColor[0] * (1.f - bright),
|
float bright = _audio.getCollisionSoundMagnitude();
|
||||||
_hoverVoxelOriginalColor[1] * (1.f - bright),
|
nodeColor clickColor = { 255 * bright + _hoverVoxelOriginalColor[0] * (1.f - bright),
|
||||||
_hoverVoxelOriginalColor[2] * (1.f - bright), 1 };
|
_hoverVoxelOriginalColor[1] * (1.f - bright),
|
||||||
hoveredNode->setColor(clickColor);
|
_hoverVoxelOriginalColor[2] * (1.f - bright), 1 };
|
||||||
if (bright < 0.01f) {
|
hoveredNode->setColor(clickColor);
|
||||||
hoveredNode->setColor(_hoverVoxelOriginalColor);
|
if (bright < 0.01f) {
|
||||||
|
hoveredNode->setColor(_hoverVoxelOriginalColor);
|
||||||
|
_isHoverVoxelSounding = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Voxel is not found, clear all
|
||||||
_isHoverVoxelSounding = false;
|
_isHoverVoxelSounding = false;
|
||||||
|
_isHoverVoxel = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Check for a new hover voxel
|
// Check for a new hover voxel
|
||||||
|
@ -2938,7 +2944,7 @@ void Application::displaySide(Camera& whichCamera) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render the world box
|
// Render the world box
|
||||||
if (!_lookingInMirror->isChecked() && _renderStatsOn->isChecked()) { render_world_box(); }
|
if (!_lookingInMirror->isChecked() && _renderStatsOn->isChecked()) { renderWorldBox(); }
|
||||||
|
|
||||||
// brad's frustum for debugging
|
// brad's frustum for debugging
|
||||||
if (_frustumOn->isChecked()) renderViewFrustum(_viewFrustum);
|
if (_frustumOn->isChecked()) renderViewFrustum(_viewFrustum);
|
||||||
|
|
|
@ -223,39 +223,54 @@ void noiseTest(int w, int h) {
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void render_world_box() {
|
void renderWorldBox() {
|
||||||
// Show edge of world
|
// Show edge of world
|
||||||
|
float red[] = {1, 0, 0};
|
||||||
|
float green[] = {0, 1, 0};
|
||||||
|
float blue[] = {0, 0, 1};
|
||||||
|
float gray[] = {0.5, 0.5, 0.5};
|
||||||
|
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
|
||||||
glLineWidth(1.0);
|
glLineWidth(1.0);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glColor3f(1, 0, 0);
|
glColor3fv(red);
|
||||||
glVertex3f(0, 0, 0);
|
glVertex3f(0, 0, 0);
|
||||||
glVertex3f(WORLD_SIZE, 0, 0);
|
glVertex3f(TREE_SCALE, 0, 0);
|
||||||
glColor3f(0, 1, 0);
|
glColor3fv(green);
|
||||||
glVertex3f(0, 0, 0);
|
glVertex3f(0, 0, 0);
|
||||||
glVertex3f(0, WORLD_SIZE, 0);
|
glVertex3f(0, TREE_SCALE, 0);
|
||||||
glColor3f(0, 0, 1);
|
glColor3fv(blue);
|
||||||
glVertex3f(0, 0, 0);
|
glVertex3f(0, 0, 0);
|
||||||
glVertex3f(0, 0, WORLD_SIZE);
|
glVertex3f(0, 0, TREE_SCALE);
|
||||||
|
glColor3fv(gray);
|
||||||
|
glVertex3f(0, 0, TREE_SCALE);
|
||||||
|
glVertex3f(TREE_SCALE, 0, TREE_SCALE);
|
||||||
|
glVertex3f(TREE_SCALE, 0, TREE_SCALE);
|
||||||
|
glVertex3f(TREE_SCALE, 0, 0);
|
||||||
glEnd();
|
glEnd();
|
||||||
// Draw little marker dots along the axis
|
// Draw marker dots at very end
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(WORLD_SIZE, 0, 0);
|
glTranslatef(TREE_SCALE, 0, 0);
|
||||||
glColor3f(1, 0, 0);
|
glColor3fv(red);
|
||||||
glutSolidSphere(0.125, 10, 10);
|
glutSolidSphere(0.125, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(0, WORLD_SIZE, 0);
|
glTranslatef(0, TREE_SCALE, 0);
|
||||||
glColor3f(0, 1, 0);
|
glColor3fv(green);
|
||||||
glutSolidSphere(0.125, 10, 10);
|
glutSolidSphere(0.125, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(0, 0, WORLD_SIZE);
|
glTranslatef(0, 0, TREE_SCALE);
|
||||||
glColor3f(0, 0, 1);
|
glColor3fv(blue);
|
||||||
glutSolidSphere(0.125, 10, 10);
|
glutSolidSphere(0.125, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
glPushMatrix();
|
||||||
|
glColor3fv(gray);
|
||||||
|
glTranslatef(TREE_SCALE, 0, TREE_SCALE);
|
||||||
|
glutSolidSphere(0.125, 10, 10);
|
||||||
|
glPopMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double diffclock(timeval *clock1,timeval *clock2)
|
double diffclock(timeval *clock1,timeval *clock2)
|
||||||
|
|
|
@ -33,7 +33,7 @@ float angle_to(glm::vec3 head_pos, glm::vec3 source_pos, float render_yaw, float
|
||||||
float randFloat();
|
float randFloat();
|
||||||
const glm::vec3 randVector();
|
const glm::vec3 randVector();
|
||||||
|
|
||||||
void render_world_box();
|
void renderWorldBox();
|
||||||
int widthText(float scale, int mono, char const* string);
|
int widthText(float scale, int mono, char const* string);
|
||||||
float widthChar(float scale, int mono, char ch);
|
float widthChar(float scale, int mono, char ch);
|
||||||
void drawtext(int x, int y, float scale, float rotate, float thick, int mono,
|
void drawtext(int x, int y, float scale, float rotate, float thick, int mono,
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#define __interface__world__
|
#define __interface__world__
|
||||||
|
|
||||||
|
|
||||||
const float WORLD_SIZE = 10.0;
|
|
||||||
#define PIf 3.14159265f
|
#define PIf 3.14159265f
|
||||||
|
|
||||||
const float GRAVITY_EARTH = 9.80665f;
|
const float GRAVITY_EARTH = 9.80665f;
|
||||||
|
|
Loading…
Reference in a new issue