History

Switching nudge to cut/paste implementation. Preliminary.

LionTurtle committed 13 years ago

Commit d9657891 parent 59943dc5 files · +58 −39Browse files

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

Unified · Split

interface/src/Util.cpp+11−13
@@ -414,28 +414,26 @@ void renderMouseVoxelGrid(const float& mouseVoxelX, const float& mouseVoxelY, co · 413 unmodified lines
414414 glEnd();
415415 }
416416
417−void renderNudgeGrid(const float& mouseVoxelX, const float& mouseVoxelY, const float& mouseVoxelZ, const float& mouseVoxelS) {
418− glm::vec3 origin = glm::vec3(mouseVoxelX, mouseVoxelY, mouseVoxelZ);
417+void renderNudgeGrid(const float& voxelX, const float& voxelY, const float& voxelZ, const float& voxelS) {
418+ glm::vec3 origin = glm::vec3(voxelX, voxelY, voxelZ);
419419
420420 glLineWidth(1.0);
421421
422422 const int GRID_DIMENSIONS = 4;
423423 glBegin(GL_LINES);
424424
425− for (int i = 0; i <= GRID_DIMENSIONS; i++) {
426− for (int j = -GRID_DIMENSIONS / 2; j <= GRID_DIMENSIONS / 2; j++) {
427− glm::vec3 xColor(0.0, 0.6, 0.0);
428− glColor3fv(&xColor.x);
425+ for (int xz = - (GRID_DIMENSIONS / 2); xz <= GRID_DIMENSIONS / 2 + 1; xz++) {
426+ glm::vec3 xColor(0.0, 0.6, 0.0);
427+ glColor3fv(&xColor.x);
429428
430− glVertex3f(origin.x + GRID_DIMENSIONS * mouseVoxelS, i * mouseVoxelS, origin.z + j * mouseVoxelS);
431− glVertex3f(origin.x - GRID_DIMENSIONS * mouseVoxelS, i * mouseVoxelS, origin.z + j * mouseVoxelS);
429+ glVertex3f(origin.x + GRID_DIMENSIONS * voxelS, 0, origin.z + xz * voxelS);
430+ glVertex3f(origin.x - (GRID_DIMENSIONS - 1) * voxelS, 0, origin.z + xz * voxelS);
432431
433− glm::vec3 zColor(0.0, 0.0, 0.6);
434− glColor3fv(&zColor.x);
432+ glm::vec3 zColor(0.0, 0.0, 0.6);
433+ glColor3fv(&zColor.x);
435434
436− glVertex3f(origin.x + j * mouseVoxelS, i * mouseVoxelS, origin.z + GRID_DIMENSIONS * mouseVoxelS);
437− glVertex3f(origin.x + j * mouseVoxelS, i * mouseVoxelS, origin.z - GRID_DIMENSIONS * mouseVoxelS);
438− }
435+ glVertex3f(origin.x + xz * voxelS, 0, origin.z + GRID_DIMENSIONS * voxelS);
436+ glVertex3f(origin.x + xz * voxelS, 0, origin.z - (GRID_DIMENSIONS - 1) * voxelS);
439437 }
440438 glEnd();
441439 }