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 | 125 | _mouseVoxelScale(1.0f / 1024.0f), |
| 126 | 126 | _mouseVoxelScaleInitialized(false), |
| 127 | 127 | _justEditedVoxel(false), |
| 128 | + _isHighlightVoxel(false), | |
| 128 | 129 | _nudgeStarted(false), |
| 129 | 130 | _lookingAlongX(false), |
| 130 | 131 | _lookingAwayFromOrigin(true), |
| @@ -1765,8 +1766,6 @@ void Application::init() { · 1634 unmodified lines | ||
| 1765 | 1766 | _voxelShader.init(); |
| 1766 | 1767 | _pointShader.init(); |
| 1767 | 1768 | |
| 1768 | − _handControl.setScreenDimensions(_glWidget->width(), _glWidget->height()); | |
| 1769 | − | |
| 1770 | 1769 | _headMouseX = _mouseX = _glWidget->width() / 2; |
| 1771 | 1770 | _headMouseY = _mouseY = _glWidget->height() / 2; |
| 1772 | 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 | 2007 | void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::vec3 mouseRayDirection) { |
| 1995 | 2008 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1996 | 2009 | PerformanceWarning warn(showWarnings, "Application::updateAvatars()"); |
| @@ -2236,11 +2249,6 @@ void Application::updateHandAndTouch(float deltaTime) { · 239 unmodified lines | ||
| 2236 | 2249 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2237 | 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 | 2252 | // Update from Touch |
| 2245 | 2253 | if (_isTouchPressed) { |
| 2246 | 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 | 3033 | // restore default, white specular |
| 3027 | 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 | 3041 | // indicate what we'll be adding/removing in mouse mode, if anything |
| 3030 | 3042 | if (_mouseVoxel.s != 0 && whichCamera.getMode() != CAMERA_MODE_MIRROR) { |
| 3031 | 3043 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| @@ -3049,7 +3061,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 17 unmodified lines | ||
| 3049 | 3061 | } else { |
| 3050 | 3062 | renderMouseVoxelGrid(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s); |
| 3051 | 3063 | } |
| 3052 | − | |
| 3064 | + | |
| 3053 | 3065 | if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelAddMode)) { |
| 3054 | 3066 | // use a contrasting color so that we can see what we're doing |
| 3055 | 3067 | glColor3ub(_mouseVoxel.red + 128, _mouseVoxel.green + 128, _mouseVoxel.blue + 128); |