From 423b2e8e0f58f860ee0802b817aa0c9351e56f34 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Tue, 3 Dec 2013 16:52:38 -0800 Subject: [PATCH] Highlight voxel being touched --- interface/src/Application.cpp | 13 ++++--------- interface/src/avatar/Hand.cpp | 13 +++++++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 07996dd7db..2f9657efe5 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1994,17 +1994,13 @@ void Application::renderHighlightVoxel(VoxelDetail voxel) { glDisable(GL_LIGHTING); glPushMatrix(); glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE); - //printf("Render: %.6f,%.6f,%.6f %.8f\n", voxel.x, voxel.y, voxel.z, - // voxel.s); - const float EDGE_EXPAND = 1.01f; - //glColor3ub(voxel.red + 128, voxel.green + 128, voxel.blue + 128); - glColor3ub(255, 0, 0); - + const float EDGE_EXPAND = 1.02f; + glColor3ub(voxel.red + 128, voxel.green + 128, voxel.blue + 128); glTranslatef(voxel.x + voxel.s * 0.5f, voxel.y + voxel.s * 0.5f, voxel.z + voxel.s * 0.5f); - glLineWidth(4.0f); - glutWireCube(_mouseVoxel.s * EDGE_EXPAND); + glLineWidth(2.0f); + glutWireCube(voxel.s * EDGE_EXPAND); glPopMatrix(); } @@ -3033,7 +3029,6 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { } } - // restore default, white specular glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR); diff --git a/interface/src/avatar/Hand.cpp b/interface/src/avatar/Hand.cpp index c95c3c901e..f703c505a4 100755 --- a/interface/src/avatar/Hand.cpp +++ b/interface/src/avatar/Hand.cpp @@ -100,11 +100,24 @@ void Hand::simulate(float deltaTime, bool isMine) { // Collision has just started palm.setIsCollidingWithVoxel(true); handleVoxelCollision(&palm, fingerTipPosition, fingerNode, deltaTime); + // Set highlight voxel + VoxelDetail voxel; + glm::vec3 pos = fingerNode->getCorner(); + voxel.x = pos.x; + voxel.y = pos.y; + voxel.z = pos.z; + voxel.s = fingerNode->getScale(); + voxel.red = fingerNode->getColor()[0]; + voxel.green = fingerNode->getColor()[1]; + voxel.blue = fingerNode->getColor()[2]; + Application::getInstance()->setHighlightVoxel(voxel); + Application::getInstance()->setIsHighlightVoxel(true); } } else { if (palm.getIsCollidingWithVoxel()) { // Collision has just ended palm.setIsCollidingWithVoxel(false); + Application::getInstance()->setIsHighlightVoxel(false); } } }