History

Tweaks to voxel editing: edit from farther away, expand cubes to make sure they show up over voxels, initialize voxel scale with moused-over scale.

Andrzej Kapolka committed 13 years ago

Commit 0c8799b1 parent 27ed5332 files · +15 −4Browse files

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

Unified · Split

interface/src/Application.cpp+14−4
@@ -124,6 +124,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 123 unmodified lines
124 _isHoverVoxel(false),124 _isHoverVoxel(false),
125 _isHoverVoxelSounding(false),125 _isHoverVoxelSounding(false),
126 _mouseVoxelScale(1.0f / 1024.0f),126 _mouseVoxelScale(1.0f / 1024.0f),
127 _mouseVoxelScaleInitialized(false),
127 _justEditedVoxel(false),128 _justEditedVoxel(false),
128 _nudgeStarted(false),129 _nudgeStarted(false),
129 _lookingAlongX(false),130 _lookingAlongX(false),
@@ -1782,7 +1783,7 @@ void Application::shrinkMirrorView() { · 1652 unmodified lines
1782}1783}
1783 1784
1784const float MAX_AVATAR_EDIT_VELOCITY = 1.0f;1785const float MAX_AVATAR_EDIT_VELOCITY = 1.0f;
1785const float MAX_VOXEL_EDIT_DISTANCE = 20.0f;1786const float MAX_VOXEL_EDIT_DISTANCE = 50.0f;
1786const float HEAD_SPHERE_RADIUS = 0.07;1787const float HEAD_SPHERE_RADIUS = 0.07;
1787 1788
1788static QUuid DEFAULT_NODE_ID_REF;1789static QUuid DEFAULT_NODE_ID_REF;
@@ -2051,6 +2052,8 @@ void Application::updateMouseVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 262 unmodified lines
2051 PerformanceWarning warn(showWarnings, "Application::updateMouseVoxels()");2052 PerformanceWarning warn(showWarnings, "Application::updateMouseVoxels()");
2052 2053
2053 _mouseVoxel.s = 0.0f;2054 _mouseVoxel.s = 0.0f;
2055 bool wasInitialized = _mouseVoxelScaleInitialized;
2056 _mouseVoxelScaleInitialized = false;
2054 if (Menu::getInstance()->isVoxelModeActionChecked() &&2057 if (Menu::getInstance()->isVoxelModeActionChecked() &&
2055 (fabs(_myAvatar.getVelocity().x) +2058 (fabs(_myAvatar.getVelocity().x) +
2056 fabs(_myAvatar.getVelocity().y) +2059 fabs(_myAvatar.getVelocity().y) +
@@ -2058,6 +2061,12 @@ void Application::updateMouseVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 1 unmodified line
2058 2061
2059 if (_voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _mouseVoxel, distance, face)) {2062 if (_voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _mouseVoxel, distance, face)) {
2060 if (distance < MAX_VOXEL_EDIT_DISTANCE) {2063 if (distance < MAX_VOXEL_EDIT_DISTANCE) {
2064 // set the voxel scale to that of the first moused-over voxel
2065 if (!wasInitialized) {
2066 _mouseVoxelScale = _mouseVoxel.s;
2067 }
2068 _mouseVoxelScaleInitialized = true;
2069
2061 // find the nearest voxel with the desired scale2070 // find the nearest voxel with the desired scale
2062 if (_mouseVoxelScale > _mouseVoxel.s) {2071 if (_mouseVoxelScale > _mouseVoxel.s) {
2063 // choose the larger voxel that encompasses the one selected2072 // choose the larger voxel that encompasses the one selected
@@ -2990,6 +2999,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 926 unmodified lines
2990 glDisable(GL_LIGHTING);2999 glDisable(GL_LIGHTING);
2991 glPushMatrix();3000 glPushMatrix();
2992 glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE);3001 glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE);
3002 const float CUBE_EXPANSION = 1.01f;
2993 if (_nudgeStarted) {3003 if (_nudgeStarted) {
2994 renderNudgeGuide(_nudgeGuidePosition.x, _nudgeGuidePosition.y, _nudgeGuidePosition.z, _nudgeVoxel.s);3004 renderNudgeGuide(_nudgeGuidePosition.x, _nudgeGuidePosition.y, _nudgeGuidePosition.z, _nudgeVoxel.s);
2995 renderNudgeGrid(_nudgeVoxel.x, _nudgeVoxel.y, _nudgeVoxel.z, _nudgeVoxel.s, _mouseVoxel.s);3005 renderNudgeGrid(_nudgeVoxel.x, _nudgeVoxel.y, _nudgeVoxel.z, _nudgeVoxel.s, _mouseVoxel.s);
@@ -2999,7 +3009,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 3 unmodified lines
2999 _nudgeVoxel.z + _nudgeVoxel.s * 0.5f);3009 _nudgeVoxel.z + _nudgeVoxel.s * 0.5f);
3000 glColor3ub(255, 255, 255);3010 glColor3ub(255, 255, 255);
3001 glLineWidth(4.0f);3011 glLineWidth(4.0f);
3002 glutWireCube(_nudgeVoxel.s);3012 glutWireCube(_nudgeVoxel.s * CUBE_EXPANSION);
3003 glPopMatrix();3013 glPopMatrix();
3004 } else {3014 } else {
3005 renderMouseVoxelGrid(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);3015 renderMouseVoxelGrid(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
@@ -3018,13 +3028,13 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 12 unmodified lines
3018 _nudgeGuidePosition.y + _nudgeVoxel.s*0.5f,3028 _nudgeGuidePosition.y + _nudgeVoxel.s*0.5f,
3019 _nudgeGuidePosition.z + _nudgeVoxel.s*0.5f);3029 _nudgeGuidePosition.z + _nudgeVoxel.s*0.5f);
3020 glLineWidth(4.0f);3030 glLineWidth(4.0f);
3021 glutWireCube(_nudgeVoxel.s);3031 glutWireCube(_nudgeVoxel.s * CUBE_EXPANSION);
3022 } else {3032 } else {
3023 glTranslatef(_mouseVoxel.x + _mouseVoxel.s*0.5f,3033 glTranslatef(_mouseVoxel.x + _mouseVoxel.s*0.5f,
3024 _mouseVoxel.y + _mouseVoxel.s*0.5f,3034 _mouseVoxel.y + _mouseVoxel.s*0.5f,
3025 _mouseVoxel.z + _mouseVoxel.s*0.5f);3035 _mouseVoxel.z + _mouseVoxel.s*0.5f);
3026 glLineWidth(4.0f);3036 glLineWidth(4.0f);
3027 glutWireCube(_mouseVoxel.s);3037 glutWireCube(_mouseVoxel.s * CUBE_EXPANSION);
3028 }3038 }
3029 glLineWidth(1.0f);3039 glLineWidth(1.0f);
3030 glPopMatrix();3040 glPopMatrix();

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