Showing the changes to interface/src/Util.cpp (1 of 5 files). Show all
Unified · Split
| @@ -16,6 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | #include "world.h" |
| 17 | 17 | #include "Util.h" |
| 18 | 18 | |
| 19 | + | |
| 19 | 20 | // Return the azimuth angle in degrees between two points. |
| 20 | 21 | float azimuth_to(glm::vec3 head_pos, glm::vec3 source_pos) { |
| 21 | 22 | return atan2(head_pos.x - source_pos.x, head_pos.z - source_pos.z) * 180.0f / PIf; |
| @@ -202,3 +203,30 @@ void drawGroundPlaneGrid( float size, int resolution ) · 180 unmodified lines | ||
| 202 | 203 | } |
| 203 | 204 | |
| 204 | 205 | |
| 206 | +void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size ) { | |
| 207 | + glm::vec3 pRight = position + orientation.right * size; | |
| 208 | + glm::vec3 pUp = position + orientation.up * size; | |
| 209 | + glm::vec3 pFront = position + orientation.front * size; | |
| 210 | + | |
| 211 | + glColor3f( 1.0f, 0.0f, 0.0f ); | |
| 212 | + glBegin( GL_LINE_STRIP ); | |
| 213 | + glVertex3f( position.x, position.y, position.z ); | |
| 214 | + glVertex3f( pRight.x, pRight.y, pRight.z ); | |
| 215 | + glEnd(); | |
| 216 | + | |
| 217 | + glColor3f( 0.0f, 1.0f, 0.0f ); | |
| 218 | + glBegin( GL_LINE_STRIP ); | |
| 219 | + glVertex3f( position.x, position.y, position.z ); | |
| 220 | + glVertex3f( pUp.x, pUp.y, pUp.z ); | |
| 221 | + glEnd(); | |
| 222 | + | |
| 223 | + glColor3f( 0.0f, 0.0f, 1.0f ); | |
| 224 | + glBegin( GL_LINE_STRIP ); | |
| 225 | + glVertex3f( position.x, position.y, position.z ); | |
| 226 | + glVertex3f( pFront.x, pFront.y, pFront.z ); | |
| 227 | + glEnd(); | |
| 228 | +} | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |