History

Merge pull request #1304 from PhilipRosedale/master

Voxel drumming, search function to find leaf voxel containing a point

ZappoMan committed 12 years ago

Commit bc715082 parents eb316a4 2dfbaf613 files · +236 −192Browse files

Showing the changes to interface/src/Application.cpp (1 of 13 files). Show all

Unified · Split

interface/src/Application.cpp+21−9
@@ -125,6 +125,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 124 unmodified lines
125125 _mouseVoxelScale(1.0f / 1024.0f),
126126 _mouseVoxelScaleInitialized(false),
127127 _justEditedVoxel(false),
128+ _isHighlightVoxel(false),
128129 _nudgeStarted(false),
129130 _lookingAlongX(false),
130131 _lookingAwayFromOrigin(true),
@@ -1765,8 +1766,6 @@ void Application::init() { · 1634 unmodified lines
17651766 _voxelShader.init();
17661767 _pointShader.init();
17671768
1768− _handControl.setScreenDimensions(_glWidget->width(), _glWidget->height());
1769−
17701769 _headMouseX = _mouseX = _glWidget->width() / 2;
17711770 _headMouseY = _mouseY = _glWidget->height() / 2;
17721771 QCursor::setPos(_headMouseX, _headMouseY);
@@ -1991,6 +1990,20 @@ void Application::renderFollowIndicator() { · 218 unmodified lines
19911990 }
19921991 }
19931992
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+
19942007 void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::vec3 mouseRayDirection) {
19952008 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
19962009 PerformanceWarning warn(showWarnings, "Application::updateAvatars()");
@@ -2236,11 +2249,6 @@ void Application::updateHandAndTouch(float deltaTime) { · 239 unmodified lines
22362249 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
22372250 PerformanceWarning warn(showWarnings, "Application::updateHandAndTouch()");
22382251
2239− // walking triggers the handControl to stop
2240− if (_myAvatar.getMode() == AVATAR_MODE_WALKING) {
2241− _handControl.stop();
2242− }
2243−
22442252 // Update from Touch
22452253 if (_isTouchPressed) {
22462254 float TOUCH_YAW_SCALE = -0.25f;
@@ -3022,10 +3030,14 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 775 unmodified lines
30223030 }
30233031 }
30243032
3025−
30263033 // restore default, white specular
30273034 glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR);
30283035
3036+ // Render the highlighted voxel
3037+ if (_isHighlightVoxel) {
3038+ renderHighlightVoxel(_highlightVoxel);
3039+ }
3040+
30293041 // indicate what we'll be adding/removing in mouse mode, if anything
30303042 if (_mouseVoxel.s != 0 && whichCamera.getMode() != CAMERA_MODE_MIRROR) {
30313043 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
@@ -3049,7 +3061,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 17 unmodified lines
30493061 } else {
30503062 renderMouseVoxelGrid(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
30513063 }
3052−
3064+
30533065 if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelAddMode)) {
30543066 // use a contrasting color so that we can see what we're doing
30553067 glColor3ub(_mouseVoxel.red + 128, _mouseVoxel.green + 128, _mouseVoxel.blue + 128);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t