History

Fix voxel erase bug in nudge code. Fix rendering of nudge guide.

LionTurtle committed 13 years ago

Commit cef48371 parent 30c8af23 files · +99 −20Browse files

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

Unified · Split

interface/src/Application.cpp+19−10
@@ -1160,8 +1160,16 @@ const glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail _mo · 1159 unmodified lines
11601160 (_mouseVoxel.z + _mouseVoxel.s / 2.f) * TREE_SCALE);
11611161 }
11621162
1163+const float NUDGE_PRECISION_LIMIT = 1 / pow(2.0, 12.0);
1164+
11631165 void Application::decreaseVoxelSize() {
1164− _mouseVoxelScale /= 2;
1166+ if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelNudgeMode)) {
1167+ if (_mouseVoxelScale >= NUDGE_PRECISION_LIMIT) {
1168+ _mouseVoxelScale /= 2;
1169+ }
1170+ } else {
1171+ _mouseVoxelScale /= 2;
1172+ }
11651173 }
11661174
11671175 void Application::increaseVoxelSize() {
@@ -2315,17 +2323,18 @@ void Application::displaySide(Camera& whichCamera) { · 1147 unmodified lines
23152323 } else {
23162324 glColor3ub(_mouseVoxel.red, _mouseVoxel.green, _mouseVoxel.blue);
23172325 }
2318− glTranslatef(_mouseVoxel.x + _mouseVoxel.s*0.5f,
2319− _mouseVoxel.y + _mouseVoxel.s*0.5f,
2320− _mouseVoxel.z + _mouseVoxel.s*0.5f);
2321− glLineWidth(4.0f);
2326+
23222327 if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelNudgeMode)) {
2323− if (_nudgeVoxel.s) {
2324− glutWireCube(_nudgeVoxel.s);
2325− } else {
2326− glutWireCube(_mouseVoxel.s);
2327− }
2328+ glTranslatef(_mouseVoxel.x + _nudgeVoxel.s*0.5f,
2329+ _mouseVoxel.y + _nudgeVoxel.s*0.5f,
2330+ _mouseVoxel.z + _nudgeVoxel.s*0.5f);
2331+ glLineWidth(4.0f);
2332+ glutWireCube(_nudgeVoxel.s);
23282333 } else {
2334+ glTranslatef(_mouseVoxel.x + _mouseVoxel.s*0.5f,
2335+ _mouseVoxel.y + _mouseVoxel.s*0.5f,
2336+ _mouseVoxel.z + _mouseVoxel.s*0.5f);
2337+ glLineWidth(4.0f);
23292338 glutWireCube(_mouseVoxel.s);
23302339 }
23312340 glLineWidth(1.0f);

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