diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Wind/WindModule.cs | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 0b2062b..b761c13 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs | |||
@@ -45,7 +45,10 @@ namespace OpenSim.Region.CoreModules | |||
45 | private Random rndnums = new Random(Environment.TickCount); | 45 | private Random rndnums = new Random(Environment.TickCount); |
46 | private Scene m_scene = null; | 46 | private Scene m_scene = null; |
47 | private bool ready = false; | 47 | private bool ready = false; |
48 | |||
49 | // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m | ||
48 | private Vector2[] windSpeeds = new Vector2[16 * 16]; | 50 | private Vector2[] windSpeeds = new Vector2[16 * 16]; |
51 | |||
49 | private Dictionary<UUID, ulong> m_rootAgents = new Dictionary<UUID, ulong>(); | 52 | private Dictionary<UUID, ulong> m_rootAgents = new Dictionary<UUID, ulong>(); |
50 | 53 | ||
51 | public void Initialise(Scene scene, IConfigSource config) | 54 | public void Initialise(Scene scene, IConfigSource config) |
@@ -89,9 +92,32 @@ namespace OpenSim.Region.CoreModules | |||
89 | get { return false; } | 92 | get { return false; } |
90 | } | 93 | } |
91 | 94 | ||
92 | public Vector2[] WindSpeeds | 95 | /// <summary> |
96 | /// Retrieve the wind speed at the given region coordinate. This | ||
97 | /// implimentation ignores Z. | ||
98 | /// </summary> | ||
99 | /// <param name="x">0...255</param> | ||
100 | /// <param name="y">0...255</param> | ||
101 | /// <returns></returns> | ||
102 | public Vector3 WindSpeed(int x, int y, int z) | ||
93 | { | 103 | { |
94 | get { return windSpeeds; } | 104 | Vector3 windVector = new Vector3(0.0f, 0.0f, 0.0f); |
105 | |||
106 | x /= 16; | ||
107 | y /= 16; | ||
108 | if (x < 0) x = 0; | ||
109 | if (x > 15) x = 15; | ||
110 | if (y < 0) y = 0; | ||
111 | if (y > 15) y = 15; | ||
112 | |||
113 | if (windSpeeds != null) | ||
114 | { | ||
115 | windVector.X = windSpeeds[y * 16 + x].X; | ||
116 | windVector.Y = windSpeeds[y * 16 + x].Y; | ||
117 | } | ||
118 | |||
119 | |||
120 | return windVector; | ||
95 | } | 121 | } |
96 | 122 | ||
97 | public void WindToClient(IClientAPI client) | 123 | public void WindToClient(IClientAPI client) |