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
414 glEnd();414 glEnd();
415}415}
416 416
417void renderNudgeGrid(const float& mouseVoxelX, const float& mouseVoxelY, const float& mouseVoxelZ, const float& mouseVoxelS) {417void renderNudgeGrid(const float& voxelX, const float& voxelY, const float& voxelZ, const float& voxelS) {
418 glm::vec3 origin = glm::vec3(mouseVoxelX, mouseVoxelY, mouseVoxelZ);418 glm::vec3 origin = glm::vec3(voxelX, voxelY, voxelZ);
419 419
420 glLineWidth(1.0);420 glLineWidth(1.0);
421 421
422 const int GRID_DIMENSIONS = 4;422 const int GRID_DIMENSIONS = 4;
423 glBegin(GL_LINES);423 glBegin(GL_LINES);
424 424
425 for (int i = 0; i <= GRID_DIMENSIONS; i++) {425 for (int xz = - (GRID_DIMENSIONS / 2); xz <= GRID_DIMENSIONS / 2 + 1; xz++) {
426 for (int j = -GRID_DIMENSIONS / 2; j <= GRID_DIMENSIONS / 2; j++) {426 glm::vec3 xColor(0.0, 0.6, 0.0);
427 glm::vec3 xColor(0.0, 0.6, 0.0);427 glColor3fv(&xColor.x);
428 glColor3fv(&xColor.x);
429 428
430 glVertex3f(origin.x + GRID_DIMENSIONS * mouseVoxelS, i * mouseVoxelS, origin.z + j * mouseVoxelS);429 glVertex3f(origin.x + GRID_DIMENSIONS * voxelS, 0, origin.z + xz * voxelS);
431 glVertex3f(origin.x - GRID_DIMENSIONS * mouseVoxelS, i * mouseVoxelS, origin.z + j * mouseVoxelS);430 glVertex3f(origin.x - (GRID_DIMENSIONS - 1) * voxelS, 0, origin.z + xz * voxelS);
432 431
433 glm::vec3 zColor(0.0, 0.0, 0.6);432 glm::vec3 zColor(0.0, 0.0, 0.6);
434 glColor3fv(&zColor.x);433 glColor3fv(&zColor.x);
435 434
436 glVertex3f(origin.x + j * mouseVoxelS, i * mouseVoxelS, origin.z + GRID_DIMENSIONS * mouseVoxelS);435 glVertex3f(origin.x + xz * voxelS, 0, origin.z + GRID_DIMENSIONS * voxelS);
437 glVertex3f(origin.x + j * mouseVoxelS, i * mouseVoxelS, origin.z - GRID_DIMENSIONS * mouseVoxelS);436 glVertex3f(origin.x + xz * voxelS, 0, origin.z - (GRID_DIMENSIONS - 1) * voxelS);
438 }
439 }437 }
440 glEnd();438 glEnd();
441}439}