Showing the changes to interface/src/Util.cpp (1 of 9 files). Show all
Unified · Split
| @@ -46,9 +46,9 @@ void render_vector(glm::vec3 * vec) · 45 unmodified lines | ||
| 46 | 46 | glVertex3f(vec->x, vec->y, vec->z); |
| 47 | 47 | // Draw marker dots for magnitude |
| 48 | 48 | glEnd(); |
| 49 | − float particle_attenuation_quadratic[] = { 0.0f, 0.0f, 2.0f }; // larger Z = smaller particles | |
| 49 | + float particleAttenuationQuadratic[] = { 0.0f, 0.0f, 2.0f }; // larger Z = smaller particles | |
| 50 | 50 | |
| 51 | − glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, particle_attenuation_quadratic ); | |
| 51 | + glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, particleAttenuationQuadratic ); | |
| 52 | 52 | |
| 53 | 53 | glEnable(GL_POINT_SMOOTH); |
| 54 | 54 | glPointSize(10.0); |
| @@ -173,3 +173,36 @@ glm::vec3 operator* (const glm::vec3& lhs, float rhs) · 118 unmodified lines | ||
| 173 | 173 | return result; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | + | |
| 177 | + | |
| 178 | +void drawGroundPlaneGrid( float size, int resolution ) | |
| 179 | +{ | |
| 180 | + | |
| 181 | + glColor3f( 0.4f, 0.5f, 0.3f ); | |
| 182 | + glLineWidth(2.0); | |
| 183 | + | |
| 184 | + float gridSize = 10.0; | |
| 185 | + int gridResolution = 10; | |
| 186 | + | |
| 187 | + for (int g=0; g<gridResolution; g++) | |
| 188 | + { | |
| 189 | + float fraction = (float)g / (float)( gridResolution - 1 ); | |
| 190 | + float inc = -gridSize * ONE_HALF + fraction * gridSize; | |
| 191 | + glBegin( GL_LINE_STRIP ); | |
| 192 | + glVertex3f( inc, 0.0f, -gridSize * ONE_HALF ); | |
| 193 | + glVertex3f( inc, 0.0f, gridSize * ONE_HALF ); | |
| 194 | + glEnd(); | |
| 195 | + } | |
| 196 | + | |
| 197 | + for (int g=0; g<gridResolution; g++) | |
| 198 | + { | |
| 199 | + float fraction = (float)g / (float)( gridResolution - 1 ); | |
| 200 | + float inc = -gridSize * ONE_HALF + fraction * gridSize; | |
| 201 | + glBegin( GL_LINE_STRIP ); | |
| 202 | + glVertex3f( -gridSize * ONE_HALF, 0.0f, inc ); | |
| 203 | + glVertex3f( gridSize * ONE_HALF, 0.0f, inc ); | |
| 204 | + glEnd(); | |
| 205 | + } | |
| 206 | +} | |
| 207 | + | |
| 208 | + | |