Voxel drumming, search function to find leaf voxel containing a point
Showing the changes to interface/src/Application.cpp (1 of 13 files). Show all
Unified · Split
| @@ -125,6 +125,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 124 unmodified lines | |||
| 125 | _mouseVoxelScale(1.0f / 1024.0f), | 125 | _mouseVoxelScale(1.0f / 1024.0f), |
| 126 | _mouseVoxelScaleInitialized(false), | 126 | _mouseVoxelScaleInitialized(false), |
| 127 | _justEditedVoxel(false), | 127 | _justEditedVoxel(false), |
| 128 | _isHighlightVoxel(false), | ||
| 128 | _nudgeStarted(false), | 129 | _nudgeStarted(false), |
| 129 | _lookingAlongX(false), | 130 | _lookingAlongX(false), |
| 130 | _lookingAwayFromOrigin(true), | 131 | _lookingAwayFromOrigin(true), |
| @@ -1765,8 +1766,6 @@ void Application::init() { · 1634 unmodified lines | |||
| 1765 | _voxelShader.init(); | 1766 | _voxelShader.init(); |
| 1766 | _pointShader.init(); | 1767 | _pointShader.init(); |
| 1767 | 1768 | ||
| 1768 | _handControl.setScreenDimensions(_glWidget->width(), _glWidget->height()); | ||
| 1769 | |||
| 1770 | _headMouseX = _mouseX = _glWidget->width() / 2; | 1769 | _headMouseX = _mouseX = _glWidget->width() / 2; |
| 1771 | _headMouseY = _mouseY = _glWidget->height() / 2; | 1770 | _headMouseY = _mouseY = _glWidget->height() / 2; |
| 1772 | QCursor::setPos(_headMouseX, _headMouseY); | 1771 | QCursor::setPos(_headMouseX, _headMouseY); |
| @@ -1991,6 +1990,20 @@ void Application::renderFollowIndicator() { · 218 unmodified lines | |||
| 1991 | } | 1990 | } |
| 1992 | } | 1991 | } |
| 1993 | 1992 | ||
| 1993 | void Application::renderHighlightVoxel(VoxelDetail voxel) { | ||
| 1994 | glDisable(GL_LIGHTING); | ||
| 1995 | glPushMatrix(); | ||
| 1996 | glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE); | ||
| 1997 | const float EDGE_EXPAND = 1.02f; | ||
| 1998 | glColor3ub(voxel.red + 128, voxel.green + 128, voxel.blue + 128); | ||
| 1999 | glTranslatef(voxel.x + voxel.s * 0.5f, | ||
| 2000 | voxel.y + voxel.s * 0.5f, | ||
| 2001 | voxel.z + voxel.s * 0.5f); | ||
| 2002 | glLineWidth(2.0f); | ||
| 2003 | glutWireCube(voxel.s * EDGE_EXPAND); | ||
| 2004 | glPopMatrix(); | ||
| 2005 | } | ||
| 2006 | |||
| 1994 | void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::vec3 mouseRayDirection) { | 2007 | void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::vec3 mouseRayDirection) { |
| 1995 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 2008 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1996 | PerformanceWarning warn(showWarnings, "Application::updateAvatars()"); | 2009 | PerformanceWarning warn(showWarnings, "Application::updateAvatars()"); |
| @@ -2236,11 +2249,6 @@ void Application::updateHandAndTouch(float deltaTime) { · 239 unmodified lines | |||
| 2236 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 2249 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2237 | PerformanceWarning warn(showWarnings, "Application::updateHandAndTouch()"); | 2250 | PerformanceWarning warn(showWarnings, "Application::updateHandAndTouch()"); |
| 2238 | 2251 | ||
| 2239 | // walking triggers the handControl to stop | ||
| 2240 | if (_myAvatar.getMode() == AVATAR_MODE_WALKING) { | ||
| 2241 | _handControl.stop(); | ||
| 2242 | } | ||
| 2243 | |||
| 2244 | // Update from Touch | 2252 | // Update from Touch |
| 2245 | if (_isTouchPressed) { | 2253 | if (_isTouchPressed) { |
| 2246 | float TOUCH_YAW_SCALE = -0.25f; | 2254 | float TOUCH_YAW_SCALE = -0.25f; |
| @@ -3022,10 +3030,14 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 775 unmodified lines | |||
| 3022 | } | 3030 | } |
| 3023 | } | 3031 | } |
| 3024 | 3032 | ||
| 3025 | |||
| 3026 | // restore default, white specular | 3033 | // restore default, white specular |
| 3027 | glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR); | 3034 | glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR); |
| 3028 | 3035 | ||
| 3036 | // Render the highlighted voxel | ||
| 3037 | if (_isHighlightVoxel) { | ||
| 3038 | renderHighlightVoxel(_highlightVoxel); | ||
| 3039 | } | ||
| 3040 | |||
| 3029 | // indicate what we'll be adding/removing in mouse mode, if anything | 3041 | // indicate what we'll be adding/removing in mouse mode, if anything |
| 3030 | if (_mouseVoxel.s != 0 && whichCamera.getMode() != CAMERA_MODE_MIRROR) { | 3042 | if (_mouseVoxel.s != 0 && whichCamera.getMode() != CAMERA_MODE_MIRROR) { |
| 3031 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 3043 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| @@ -3049,7 +3061,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 17 unmodified lines | |||
| 3049 | } else { | 3061 | } else { |
| 3050 | renderMouseVoxelGrid(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s); | 3062 | renderMouseVoxelGrid(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s); |
| 3051 | } | 3063 | } |
| 3052 | 3064 | ||
| 3053 | if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelAddMode)) { | 3065 | if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelAddMode)) { |
| 3054 | // use a contrasting color so that we can see what we're doing | 3066 | // use a contrasting color so that we can see what we're doing |
| 3055 | glColor3ub(_mouseVoxel.red + 128, _mouseVoxel.green + 128, _mouseVoxel.blue + 128); | 3067 | glColor3ub(_mouseVoxel.red + 128, _mouseVoxel.green + 128, _mouseVoxel.blue + 128); |