Changeset 25241
- Timestamp:
- Apr 12, 2021, 2:39:07 PM (3 years ago)
- Location:
- ps/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/public/gui/session/minimap/MiniMap.xml
r25229 r25241 5 5 type="image" 6 6 > 7 <!-- MiniMap -->8 <object name="minimap" size="8 8 100%-8 100%-8" type="minimap" mask="true"/>9 7 10 8 <!-- Background image --> … … 34 32 hotkey="session.diplomacycolors" 35 33 /> 34 35 36 36 37 </object> -
ps/trunk/source/gui/ObjectTypes/CMiniMap.cpp
r25231 r25241 51 51 #include "simulation2/system/ParamNode.h" 52 52 53 53 54 #include <cmath> 55 54 56 55 57 extern bool g_GameRestarted; 58 59 60 56 61 57 62 // Set max drawn entities to UINT16_MAX for now, which is more than enough … … 59 64 const u16 MAX_ENTITIES_DRAWN = 65535; 60 65 61 staticunsigned int ScaleColor(unsigned int color, float x)66 unsigned int ScaleColor(unsigned int color, float x) 62 67 { 63 68 unsigned int r = unsigned(float(color & 0xff) * x); … … 66 71 return (0xff000000 | b | g<<8 | r<<16); 67 72 } 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 68 107 69 108 const CStr CMiniMap::EventNameWorldClick = "WorldClick"; … … 260 299 // This sets up and draws the rectangle on the minimap 261 300 // which represents the view of the camera in the world. 262 void CMiniMap::DrawViewRect( CMatrix3Dtransform) const301 void CMiniMap::DrawViewRect( transform) const 263 302 { 264 303 // Compute the camera frustum intersected with a fixed-height plane. … … 269 308 const float invTileMapSize = 1.0f / float(TERRAIN_TILE_SIZE * m_MapSize); 270 309 271 CVector3D hitPt[4]; 272 hitPt[0] = m_Camera->GetWorldCoordinates(0, g_Renderer.GetHeight(), h); 273 hitPt[1] = m_Camera->GetWorldCoordinates(g_Renderer.GetWidth(), g_Renderer.GetHeight(), h); 274 hitPt[2] = m_Camera->GetWorldCoordinates(g_Renderer.GetWidth(), 0, h); 275 hitPt[3] = m_Camera->GetWorldCoordinates(0, 0, h); 276 277 float ViewRect[4][2]; 278 for (int i = 0; i < 4; ++i) 279 { 280 // convert to minimap space 281 ViewRect[i][0] = (width * hitPt[i].X * invTileMapSize); 282 ViewRect[i][1] = (height * hitPt[i].Z * invTileMapSize); 283 } 284 285 float viewVerts[] = { 286 ViewRect[0][0], -ViewRect[0][1], 287 ViewRect[1][0], -ViewRect[1][1], 288 ViewRect[2][0], -ViewRect[2][1], 289 ViewRect[3][0], -ViewRect[3][1] 310 const std::array<CVector3D, 4> hitPoints = { 311 m_Camera->GetWorldCoordinates(0, g_Renderer.GetHeight(), h), 312 m_Camera->GetWorldCoordinates(g_Renderer.GetWidth(), g_Renderer.GetHeight(), h), 313 m_Camera->GetWorldCoordinates(g_Renderer.GetWidth(), 0, h), 314 m_Camera->GetWorldCoordinates(0, 0, h) 290 315 }; 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 291 332 292 333 // Enable Scissoring to restrict the rectangle to only the minimap. … … 307 348 shader->Uniform(str_color, 1.0f, 0.3f, 0.3f, 1.0f); 308 349 309 shader->VertexPointer(2, GL_FLOAT, 0, v iewVerts);350 shader->VertexPointer(2, GL_FLOAT, 0, v); 310 351 shader->AssertPointersBound(); 311 352 312 353 if (!g_Renderer.m_SkipSubmit) 313 glDrawArrays(GL_LINE _LOOP, 0, 4);354 glDrawArrays(GL_LINE); 314 355 315 356 tech->EndPass(); -
ps/trunk/source/gui/ObjectTypes/CMiniMap.h
r24141 r25241 105 105 void DrawTexture(CShaderProgramPtr shader, float coordMax, float angle, float x, float y, float x2, float y2, float z) const; 106 106 107 void DrawViewRect( CMatrix3Dtransform) const;107 void DrawViewRect( transform) const; 108 108 109 109 void GetMouseWorldCoordinates(float& x, float& z) const;
Note:
See TracChangeset
for help on using the changeset viewer.