Showing the changes to interface/src/Util.cpp (1 of 3 files). Show all
Unified · Split
| @@ -419,97 +419,6 @@ void renderCollisionOverlay(int width, int height, float magnitude) { · 418 unmodified lines | |||
| 419 | } | 419 | } |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | void renderMouseVoxelGrid(const float& mouseVoxelX, const float& mouseVoxelY, const float& mouseVoxelZ, const float& mouseVoxelS) { | ||
| 423 | glm::vec3 origin = glm::vec3(mouseVoxelX, mouseVoxelY, mouseVoxelZ); | ||
| 424 | |||
| 425 | glLineWidth(3.0); | ||
| 426 | |||
| 427 | const int HALF_GRID_DIMENSIONS = 4; | ||
| 428 | glBegin(GL_LINES); | ||
| 429 | |||
| 430 | glm::vec3 xColor(0.0, 0.6, 0.0); | ||
| 431 | glColor3fv(&xColor.x); | ||
| 432 | |||
| 433 | glVertex3f(origin.x + HALF_GRID_DIMENSIONS * mouseVoxelS, 0, origin.z); | ||
| 434 | glVertex3f(origin.x - HALF_GRID_DIMENSIONS * mouseVoxelS, 0, origin.z); | ||
| 435 | |||
| 436 | glm::vec3 zColor(0.0, 0.0, 0.6); | ||
| 437 | glColor3fv(&zColor.x); | ||
| 438 | |||
| 439 | glVertex3f(origin.x, 0, origin.z + HALF_GRID_DIMENSIONS * mouseVoxelS); | ||
| 440 | glVertex3f(origin.x, 0, origin.z - HALF_GRID_DIMENSIONS * mouseVoxelS); | ||
| 441 | |||
| 442 | glm::vec3 yColor(0.6, 0.0, 0.0); | ||
| 443 | glColor3fv(&yColor.x); | ||
| 444 | |||
| 445 | glVertex3f(origin.x, 0, origin.z); | ||
| 446 | glVertex3f(origin.x, origin.y, origin.z); | ||
| 447 | glEnd(); | ||
| 448 | } | ||
| 449 | |||
| 450 | void renderNudgeGrid(float voxelX, float voxelY, float voxelZ, float voxelS, float voxelPrecision) { | ||
| 451 | glm::vec3 origin = glm::vec3(voxelX, voxelY, voxelZ); | ||
| 452 | |||
| 453 | glLineWidth(1.0); | ||
| 454 | |||
| 455 | const int GRID_DIMENSIONS = 4; | ||
| 456 | const int GRID_SCALER = voxelS / voxelPrecision; | ||
| 457 | const int GRID_SEGMENTS = GRID_DIMENSIONS * GRID_SCALER; | ||
| 458 | glBegin(GL_LINES); | ||
| 459 | |||
| 460 | for (int xz = - (GRID_SEGMENTS / 2); xz <= GRID_SEGMENTS / 2 + GRID_SCALER; xz++) { | ||
| 461 | glm::vec3 xColor(0.0, 0.6, 0.0); | ||
| 462 | glColor3fv(&xColor.x); | ||
| 463 | |||
| 464 | glVertex3f(origin.x + GRID_DIMENSIONS * voxelS, 0, origin.z + xz * voxelPrecision); | ||
| 465 | glVertex3f(origin.x - (GRID_DIMENSIONS - 1) * voxelS, 0, origin.z + xz * voxelPrecision); | ||
| 466 | |||
| 467 | glm::vec3 zColor(0.0, 0.0, 0.6); | ||
| 468 | glColor3fv(&zColor.x); | ||
| 469 | |||
| 470 | glVertex3f(origin.x + xz * voxelPrecision, 0, origin.z + GRID_DIMENSIONS * voxelS); | ||
| 471 | glVertex3f(origin.x + xz * voxelPrecision, 0, origin.z - (GRID_DIMENSIONS - 1) * voxelS); | ||
| 472 | } | ||
| 473 | glEnd(); | ||
| 474 | |||
| 475 | glColor3f(1.0f,1.0f,1.0f); | ||
| 476 | |||
| 477 | glBegin(GL_POLYGON);//begin drawing of square | ||
| 478 | glVertex3f(voxelX, 0.0f, voxelZ);//first vertex | ||
| 479 | glVertex3f(voxelX + voxelS, 0.0f, voxelZ);//second vertex | ||
| 480 | glVertex3f(voxelX + voxelS, 0.0f, voxelZ + voxelS);//third vertex | ||
| 481 | glVertex3f(voxelX, 0.0f, voxelZ + voxelS);//fourth vertex | ||
| 482 | glEnd();//end drawing of polygon | ||
| 483 | } | ||
| 484 | |||
| 485 | void renderNudgeGuide(float voxelX, float voxelY, float voxelZ, float voxelS) { | ||
| 486 | glm::vec3 origin = glm::vec3(voxelX, voxelY, voxelZ); | ||
| 487 | |||
| 488 | glLineWidth(3.0); | ||
| 489 | |||
| 490 | glBegin(GL_LINES); | ||
| 491 | |||
| 492 | glm::vec3 guideColor(1.0, 1.0, 1.0); | ||
| 493 | glColor3fv(&guideColor.x); | ||
| 494 | |||
| 495 | glVertex3f(origin.x + voxelS, 0, origin.z); | ||
| 496 | glVertex3f(origin.x, 0, origin.z); | ||
| 497 | |||
| 498 | glVertex3f(origin.x, 0, origin.z); | ||
| 499 | glVertex3f(origin.x, 0, origin.z + voxelS); | ||
| 500 | |||
| 501 | glVertex3f(origin.x + voxelS, 0, origin.z); | ||
| 502 | glVertex3f(origin.x + voxelS, 0, origin.z + voxelS); | ||
| 503 | |||
| 504 | glVertex3f(origin.x, 0, origin.z + voxelS); | ||
| 505 | glVertex3f(origin.x + voxelS, 0, origin.z + voxelS); | ||
| 506 | |||
| 507 | glEnd(); | ||
| 508 | } | ||
| 509 | |||
| 510 | |||
| 511 | |||
| 512 | |||
| 513 | void renderSphereOutline(glm::vec3 position, float radius, int numSides, glm::vec3 cameraPosition) { | 422 | void renderSphereOutline(glm::vec3 position, float radius, int numSides, glm::vec3 cameraPosition) { |
| 514 | glm::vec3 vectorToPosition(glm::normalize(position - cameraPosition)); | 423 | glm::vec3 vectorToPosition(glm::normalize(position - cameraPosition)); |
| 515 | glm::vec3 right = glm::cross(vectorToPosition, glm::vec3(0.0f, 1.0f, 0.0f)); | 424 | glm::vec3 right = glm::cross(vectorToPosition, glm::vec3(0.0f, 1.0f, 0.0f)); |