- Timestamp:
- 07/20/11 21:48:06 (13 years ago)
- Location:
- ps/trunk
- Files:
-
- 12 added
- 1 deleted
- 15 edited
-
binaries/data/mods/public/shaders/terrain_base.xml (modified) (2 diffs)
-
binaries/data/mods/public/shaders/terrain_blend.xml (modified) (2 diffs)
-
binaries/data/mods/public/shaders/terrain_common.fp (modified) (1 diff)
-
binaries/data/mods/public/shaders/terrain_common.vp (modified) (2 diffs)
-
binaries/data/mods/public/shaders/terrain_decal.xml (modified) (2 diffs)
-
binaries/data/mods/public/simulation/components/interfaces/Settlement.js (deleted)
-
binaries/data/mods/public/simulation/templates/special/territory_block.xml (added)
-
binaries/data/mods/public/simulation/templates/special/territory_pull.xml (added)
-
source/graphics/GameView.cpp (modified) (4 diffs)
-
source/graphics/GameView.h (modified) (2 diffs)
-
source/graphics/LOSTexture.cpp (modified) (1 diff)
-
source/graphics/TerritoryTexture.cpp (added)
-
source/graphics/TerritoryTexture.h (added)
-
source/gui/MiniMap.cpp (modified) (3 diffs)
-
source/renderer/Scene.h (modified) (2 diffs)
-
source/renderer/TerrainRenderer.cpp (modified) (2 diffs)
-
source/simulation2/Simulation2.cpp (modified) (1 diff)
-
source/simulation2/TypeList.h (modified) (3 diffs)
-
source/simulation2/components/CCmpTerritoryInfluence.cpp (added)
-
source/simulation2/components/CCmpTerritoryManager.cpp (added)
-
source/simulation2/components/ICmpObstruction.h (modified) (1 diff)
-
source/simulation2/components/ICmpSettlement.cpp (added)
-
source/simulation2/components/ICmpSettlement.h (added)
-
source/simulation2/components/ICmpTerritoryInfluence.cpp (added)
-
source/simulation2/components/ICmpTerritoryInfluence.h (added)
-
source/simulation2/components/ICmpTerritoryManager.cpp (added)
-
source/simulation2/components/ICmpTerritoryManager.h (added)
-
source/tools/atlas/GameInterface/ActorViewer.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/public/shaders/terrain_base.xml
r9814 r9889 6 6 <uniform name="losTransform" loc="1" type="vec2"/> 7 7 <uniform name="shadowTransform" loc="2" type="mat4"/> 8 <uniform name="territoryTransform" loc="6" type="vec2"/> 8 9 </vertex> 9 10 … … 12 13 <uniform name="shadowTex" loc="2" type="sampler2DShadow"/> 13 14 <uniform name="losTex" loc="3" type="sampler2D"/> 15 <uniform name="territoryTex" loc="4" type="sampler2D"/> 14 16 15 17 <uniform name="ambient" loc="0" type="vec3"/> -
ps/trunk/binaries/data/mods/public/shaders/terrain_blend.xml
r9814 r9889 8 8 <uniform name="losTransform" loc="1" type="vec2"/> 9 9 <uniform name="shadowTransform" loc="2" type="mat4"/> 10 <uniform name="territoryTransform" loc="6" type="vec2"/> 10 11 </vertex> 11 12 … … 15 16 <uniform name="shadowTex" loc="2" type="sampler2DShadow"/> 16 17 <uniform name="losTex" loc="3" type="sampler2D"/> 18 <uniform name="territoryTex" loc="4" type="sampler2D"/> 17 19 18 20 <uniform name="ambient" loc="0" type="vec3"/> -
ps/trunk/binaries/data/mods/public/shaders/terrain_common.fp
r9814 r9889 82 82 #endif 83 83 84 // Blend with the territory boundary texture 85 TEX tex, fragment.texcoord[4], texture[4], 2D; 86 LRP color.rgb, tex.a, tex, color; 87 84 88 // Multiply everything by the LOS texture 85 89 TEX tex.a, fragment.texcoord[3], texture[3], 2D; -
ps/trunk/binaries/data/mods/public/shaders/terrain_common.vp
r9123 r9889 3 3 PARAM losTransform = program.local[1]; 4 4 PARAM shadowTransform[4] = { program.local[2..5] }; 5 PARAM territoryTransform = program.local[6]; 5 6 6 7 TEMP lighting; … … 39 40 40 41 MAD result.texcoord[3], position.xzzz, losTransform.x, losTransform.y; 42 MAD result.texcoord[4], position.xzzz, territoryTransform.x, territoryTransform.y; 41 43 42 44 END -
ps/trunk/binaries/data/mods/public/shaders/terrain_decal.xml
r9814 r9889 8 8 <uniform name="losTransform" loc="1" type="vec2"/> 9 9 <uniform name="shadowTransform" loc="2" type="mat4"/> 10 <uniform name="territoryTransform" loc="6" type="vec2"/> 10 11 </vertex> 11 12 … … 14 15 <uniform name="shadowTex" loc="2" type="sampler2DShadow"/> 15 16 <uniform name="losTex" loc="3" type="sampler2D"/> 17 <uniform name="territoryTex" loc="4" type="sampler2D"/> 16 18 17 19 <uniform name="ambient" loc="0" type="vec3"/> -
ps/trunk/source/graphics/GameView.cpp
r9764 r9889 32 32 #include "graphics/Terrain.h" 33 33 #include "graphics/TerrainTextureManager.h" 34 #include "graphics/TerritoryTexture.h" 34 35 #include "graphics/Unit.h" 35 36 #include "graphics/UnitManager.h" … … 160 161 ObjectManager(MeshManager, SkeletonAnimManager, *game->GetSimulation2()), 161 162 LOSTexture(*game->GetSimulation2()), 163 TerritoryTexture(*game->GetSimulation2()), 162 164 ViewCamera(), 163 165 CullCamera(), … … 205 207 CObjectManager ObjectManager; 206 208 CLOSTexture LOSTexture; 209 CTerritoryTexture TerritoryTexture; 207 210 208 211 /** … … 382 385 } 383 386 387 CTerritoryTexture& CGameView::GetTerritoryTexture() 388 { 389 return m->TerritoryTexture; 390 } 391 384 392 385 393 void CGameViewImpl::ScriptingInit() -
ps/trunk/source/graphics/GameView.h
r9764 r9889 28 28 class CCamera; 29 29 class CCinemaManager; 30 class CLOSTexture;31 30 class CVector3D; 32 31 struct SViewPort; … … 52 51 virtual void EnumerateObjects(const CFrustum& frustum, SceneCollector* c); 53 52 virtual CLOSTexture& GetLOSTexture(); 53 virtual CTerritoryTexture& GetTerritoryTexture(); 54 54 //END: Implementation of Scene 55 55 -
ps/trunk/source/graphics/LOSTexture.cpp
r9673 r9889 24 24 #include "ps/Game.h" 25 25 #include "ps/Profile.h" 26 #include "ps/World.h"27 26 #include "renderer/Renderer.h" 28 27 #include "simulation2/Simulation2.h" -
ps/trunk/source/gui/MiniMap.cpp
r9673 r9889 28 28 #include "graphics/TerrainTextureEntry.h" 29 29 #include "graphics/TerrainTextureManager.h" 30 #include "graphics/TerritoryTexture.h" 30 31 #include "lib/ogl.h" 31 32 #include "lib/external_libraries/sdl.h" … … 40 41 #include "simulation2/Simulation2.h" 41 42 #include "simulation2/components/ICmpMinimap.h" 43 #include "simulation2/components/ICmpTerritoryManager.h" 42 44 43 45 bool g_GameRestarted = false; … … 311 313 DrawTexture(texCoordMax, angle, x, y, x2, y2, z); 312 314 313 /* // TODO: reimplement with new sim system 314 // Shade territories by player 315 CTerritoryManager* territoryMgr = g_Game->GetWorld()->GetTerritoryManager(); 316 std::vector<CTerritory*>& territories = territoryMgr->GetTerritories(); 317 318 PROFILE_START("minimap territory shade"); 319 320 glDisable(GL_TEXTURE_2D); 315 316 // Draw territory boundaries 317 CTerritoryTexture& territoryTexture = g_Game->GetView()->GetTerritoryTexture(); 318 territoryTexture.BindTexture(0); 321 319 glEnable(GL_BLEND); 322 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 323 for( size_t i=0; i<territories.size(); i++ ) 324 { 325 if( territories[i]->owner->GetPlayerID() == 0 ) 326 continue; 327 std::vector<CVector2D>& boundary = territories[i]->boundary; 328 SPlayerColour col = territories[i]->owner->GetColour(); 329 glColor4f(col.r, col.g, col.b, 0.25f); 330 glBegin(GL_POLYGON); 331 for( size_t j=0; j<boundary.size(); j++ ) 332 { 333 float fx = boundary[j].x / (m_Terrain->GetTilesPerSide() * CELL_SIZE); 334 float fy = boundary[j].y / (m_Terrain->GetTilesPerSide() * CELL_SIZE); 335 glVertex3f( x*(1-fx) + x2*fx, y*(1-fy) + y2*fy, z ); 336 } 337 glEnd(); 338 } 320 glMatrixMode(GL_TEXTURE); 321 glLoadMatrixf(territoryTexture.GetMinimapTextureMatrix()); 322 glMatrixMode(GL_MODELVIEW); 323 324 DrawTexture(1.0f, angle, x, y, x2, y2, z); 325 326 glMatrixMode(GL_TEXTURE); 327 glLoadIdentity(); 328 glMatrixMode(GL_MODELVIEW); 339 329 glDisable(GL_BLEND); 340 330 341 PROFILE_END("minimap territory shade");342 343 // Draw territory boundaries344 glEnable(GL_LINE_SMOOTH);345 glLineWidth(1.0f);346 glEnable(GL_BLEND);347 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);348 glColor4f(0.8f, 0.8f, 0.8f, 0.8f);349 for( size_t i=0; i<territories.size(); i++ )350 {351 std::vector<CVector2D>& boundary = territories[i]->boundary;352 glBegin(GL_LINE_LOOP);353 for( size_t j=0; j<boundary.size(); j++ )354 {355 float fx = boundary[j].x / (m_Terrain->GetTilesPerSide() * CELL_SIZE);356 float fy = boundary[j].y / (m_Terrain->GetTilesPerSide() * CELL_SIZE);357 glVertex3f( x*(1-fx) + x2*fx, y*(1-fy) + y2*fy, z );358 }359 glEnd();360 }361 glLineWidth(1.0f);362 glDisable(GL_LINE_SMOOTH);363 glDisable(GL_BLEND);364 */365 331 366 332 // Draw the LOS quad in black, using alpha values from the LOS texture -
ps/trunk/source/renderer/Scene.h
r9172 r9889 36 36 class CPatch; 37 37 class CLOSTexture; 38 class CTerritoryTexture; 38 39 struct SOverlayLine; 39 40 struct SOverlaySprite; … … 64 65 */ 65 66 virtual CLOSTexture& GetLOSTexture() = 0; 67 68 /** 69 * Return the territory texture to be used for rendering this scene. 70 */ 71 virtual CTerritoryTexture& GetTerritoryTexture() = 0; 66 72 }; 67 73 -
ps/trunk/source/renderer/TerrainRenderer.cpp
r9814 r9889 32 32 #include "graphics/Model.h" 33 33 #include "graphics/ShaderManager.h" 34 #include "graphics/TerritoryTexture.h" 34 35 35 36 #include "maths/MathUtil.h" … … 401 402 shader->BindTexture("losTex", los.GetTexture()); 402 403 shader->Uniform("losTransform", los.GetTextureMatrix()[0], los.GetTextureMatrix()[12], 0.f, 0.f); 404 405 CTerritoryTexture& territory = g_Renderer.GetScene().GetTerritoryTexture(); 406 shader->BindTexture("territoryTex", territory.GetTexture()); 407 shader->Uniform("territoryTransform", territory.GetTextureMatrix()[0], territory.GetTextureMatrix()[12], 0.f, 0.f); 403 408 404 409 shader->Uniform("ambient", lightEnv.m_TerrainAmbientColor); -
ps/trunk/source/simulation2/Simulation2.cpp
r9665 r9889 85 85 m_ComponentManager.AddComponent(SYSTEM_ENTITY, CID_SoundManager, noParam); 86 86 m_ComponentManager.AddComponent(SYSTEM_ENTITY, CID_Terrain, noParam); 87 m_ComponentManager.AddComponent(SYSTEM_ENTITY, CID_TerritoryManager, noParam); 87 88 m_ComponentManager.AddComponent(SYSTEM_ENTITY, CID_WaterManager, noParam); 88 89 -
ps/trunk/source/simulation2/TypeList.h
r9605 r9889 1 /* Copyright (C) 201 0Wildfire Games.1 /* Copyright (C) 2011 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * … … 120 120 COMPONENT(Selectable) 121 121 122 INTERFACE(Settlement) 123 COMPONENT(SettlementScripted) 124 122 125 INTERFACE(SoundManager) 123 126 COMPONENT(SoundManager) … … 125 128 INTERFACE(Terrain) 126 129 COMPONENT(Terrain) 130 131 INTERFACE(TerritoryInfluence) 132 COMPONENT(TerritoryInfluence) 133 134 INTERFACE(TerritoryManager) 135 COMPONENT(TerritoryManager) 127 136 128 137 INTERFACE(UnitMotion) -
ps/trunk/source/simulation2/components/ICmpObstruction.h
r9510 r9889 33 33 virtual ICmpObstructionManager::tag_t GetObstruction() = 0; 34 34 35 /** 36 * Gets the square corresponding to this obstruction shape. 37 * @return true and updates @p out on success; 38 * false on failure (e.g. object not in the world). 39 */ 35 40 virtual bool GetObstructionSquare(ICmpObstructionManager::ObstructionSquare& out) = 0; 36 41 -
ps/trunk/source/tools/atlas/GameInterface/ActorViewer.cpp
r9720 r9889 32 32 #include "graphics/TerrainTextureEntry.h" 33 33 #include "graphics/TerrainTextureManager.h" 34 #include "graphics/TerritoryTexture.h" 34 35 #include "graphics/UnitManager.h" 35 36 #include "maths/MathUtil.h" … … 61 62 Simulation2(&UnitManager, &Terrain), 62 63 ObjectManager(MeshManager, SkeletonAnimManager, Simulation2), 63 LOSTexture(Simulation2) 64 LOSTexture(Simulation2), 65 TerritoryTexture(Simulation2) 64 66 { 65 67 UnitManager.SetObjectManager(ObjectManager); … … 85 87 CSimulation2 Simulation2; 86 88 CLOSTexture LOSTexture; 89 CTerritoryTexture TerritoryTexture; 87 90 88 91 // Simplistic implementation of the Scene interface … … 104 107 } 105 108 109 virtual CTerritoryTexture& GetTerritoryTexture() 110 { 111 return TerritoryTexture; 112 } 106 113 }; 107 114
Note:
See TracChangeset
for help on using the changeset viewer.
