@@ -120,7 +120,7 @@ void Graph::cleanupDebugMesh()
120120/* * Creates the actual mesh that is used by createDebugMesh() or makeMiniMap()
121121 */
122122void Graph::createMesh (bool show_invisible, bool enable_transparency,
123- const video::SColor *track_color)
123+ const video::SColor *track_color, bool invert_x_z )
124124{
125125#ifndef SERVER_ONLY
126126 // The debug track will not be lighted or culled.
@@ -172,6 +172,18 @@ void Graph::createMesh(bool show_invisible, bool enable_transparency,
172172 differentNodeColor (count, &this_color);
173173 // Transfer the 4 points of the current quad to the list of vertices
174174 m_all_nodes[count]->getVertices (new_v+4 *i, this_color);
175+ if (invert_x_z)
176+ {
177+ auto * vptr = new_v + 4 * i;
178+ vptr[0 ].Pos .X = -vptr[0 ].Pos .X ;
179+ vptr[0 ].Pos .Z = -vptr[0 ].Pos .Z ;
180+ vptr[1 ].Pos .X = -vptr[1 ].Pos .X ;
181+ vptr[1 ].Pos .Z = -vptr[1 ].Pos .Z ;
182+ vptr[2 ].Pos .X = -vptr[2 ].Pos .X ;
183+ vptr[2 ].Pos .Z = -vptr[2 ].Pos .Z ;
184+ vptr[3 ].Pos .X = -vptr[3 ].Pos .X ;
185+ vptr[3 ].Pos .Z = -vptr[3 ].Pos .Z ;
186+ }
175187
176188 // Set up the indices for the triangles
177189 // (note, afaik with opengl we could use quads directly, but the code
@@ -244,7 +256,7 @@ void Graph::createMesh(bool show_invisible, bool enable_transparency,
244256/* * Creates the actual mesh that is used by createDebugMesh() or makeMiniMap()
245257 */
246258void Graph::createMeshSP (bool show_invisible, bool enable_transparency,
247- const video::SColor *track_color)
259+ const video::SColor *track_color, bool invert_x_z )
248260{
249261#ifndef SERVER_ONLY
250262
@@ -294,6 +306,18 @@ void Graph::createMeshSP(bool show_invisible, bool enable_transparency,
294306 differentNodeColor (count, &this_color);
295307 // Transfer the 4 points of the current quad to the list of vertices
296308 m_all_nodes[count]->getSPMVertices (vertices.data () + (4 * i), this_color);
309+ if (invert_x_z)
310+ {
311+ auto * vptr = vertices.data () + (4 * i);
312+ vptr[0 ].m_position .X = -vptr[0 ].m_position .X ;
313+ vptr[0 ].m_position .Z = -vptr[0 ].m_position .Z ;
314+ vptr[1 ].m_position .X = -vptr[1 ].m_position .X ;
315+ vptr[1 ].m_position .Z = -vptr[1 ].m_position .Z ;
316+ vptr[2 ].m_position .X = -vptr[2 ].m_position .X ;
317+ vptr[2 ].m_position .Z = -vptr[2 ].m_position .Z ;
318+ vptr[3 ].m_position .X = -vptr[3 ].m_position .X ;
319+ vptr[3 ].m_position .Z = -vptr[3 ].m_position .Z ;
320+ }
297321
298322 // Set up the indices for the triangles
299323 indices[6 * i] = 4 * i + 2 ; // First triangle: vertex 0, 1, 2
@@ -366,7 +390,8 @@ void Graph::createMeshSP(bool show_invisible, bool enable_transparency,
366390 */
367391RenderTarget* Graph::makeMiniMap (const core::dimension2du &dimension,
368392 const std::string &name,
369- const video::SColor &fill_color)
393+ const video::SColor &fill_color,
394+ bool invert_x_z)
370395{
371396 // Skip minimap when profiling
372397 if (ProfileWorld::isNoGraphics ()) return NULL ;
@@ -384,14 +409,14 @@ RenderTarget* Graph::makeMiniMap(const core::dimension2du &dimension,
384409 if (CVS->isGLSL ())
385410 {
386411 createMeshSP (/* show_invisible part of the track*/ false ,
387- /* enable_transparency*/ false ,
388- /* track_color */ &fill_color );
412+ /* enable_transparency*/ false , /* track_color */ &fill_color ,
413+ invert_x_z );
389414 }
390415 else
391416 {
392417 createMesh (/* show_invisible part of the track*/ false ,
393- /* enable_transparency*/ false ,
394- /* track_color */ &fill_color );
418+ /* enable_transparency*/ false , /* track_color */ &fill_color ,
419+ invert_x_z );
395420 }
396421#endif
397422
0 commit comments