diff options
author | Teravus Ovares | 2008-09-26 17:25:22 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-09-26 17:25:22 +0000 |
commit | 16b6738cdadc70966a93b6d025ae469738955dcb (patch) | |
tree | 7a3c0075e9ee5fd04d972bc52be38aec4d51f648 /OpenSim/Region/Environment/Modules/World/Wind | |
parent | DNE code cleanups (diff) | |
download | opensim-SC_OLD-16b6738cdadc70966a93b6d025ae469738955dcb.zip opensim-SC_OLD-16b6738cdadc70966a93b6d025ae469738955dcb.tar.gz opensim-SC_OLD-16b6738cdadc70966a93b6d025ae469738955dcb.tar.bz2 opensim-SC_OLD-16b6738cdadc70966a93b6d025ae469738955dcb.tar.xz |
* Patch from JHurliman
* Updates to libomv r2243,
* Remove lots of unnecessary typecasts
* Improves SendWindData()
Thanks jhurliman.
* Will update OpenSim-libs in 10 minutes..
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Wind')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs | 44 |
1 files changed, 8 insertions, 36 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs b/OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs index fced389..5495c1d 100644 --- a/OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs | |||
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Environment.Modules | |||
45 | private Random rndnums = new Random(System.Environment.TickCount); | 45 | private Random rndnums = new Random(System.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 | private float[] windarr = new float[256*256]; | 48 | private Vector2[] windSpeeds = new Vector2[16 * 16]; |
49 | 49 | ||
50 | private Dictionary<UUID, ulong> m_rootAgents = new Dictionary<UUID, ulong>(); | 50 | private Dictionary<UUID, ulong> m_rootAgents = new Dictionary<UUID, ulong>(); |
51 | 51 | ||
@@ -54,7 +54,6 @@ namespace OpenSim.Region.Environment.Modules | |||
54 | 54 | ||
55 | public void Initialise(Scene scene, IConfigSource config) | 55 | public void Initialise(Scene scene, IConfigSource config) |
56 | { | 56 | { |
57 | |||
58 | m_log.Debug("[WIND] Initializing"); | 57 | m_log.Debug("[WIND] Initializing"); |
59 | 58 | ||
60 | m_scene = scene; | 59 | m_scene = scene; |
@@ -120,15 +119,13 @@ namespace OpenSim.Region.Environment.Modules | |||
120 | 119 | ||
121 | public void WindToClient(IClientAPI client) | 120 | public void WindToClient(IClientAPI client) |
122 | { | 121 | { |
123 | |||
124 | if (ready) | 122 | if (ready) |
125 | { | 123 | { |
126 | //if (!sunFixed) | 124 | //if (!sunFixed) |
127 | //GenWindPos(); // Generate shared values once | 125 | //GenWindPos(); // Generate shared values once |
128 | client.SendWindData(windarr); | 126 | client.SendWindData(windSpeeds); |
129 | m_log.Debug("[WIND] Initial update for new client"); | 127 | m_log.Debug("[WIND] Initial update for new client"); |
130 | } | 128 | } |
131 | |||
132 | } | 129 | } |
133 | 130 | ||
134 | public void WindUpdate() | 131 | public void WindUpdate() |
@@ -149,11 +146,7 @@ namespace OpenSim.Region.Environment.Modules | |||
149 | { | 146 | { |
150 | if (!avatar.IsChildAgent) | 147 | if (!avatar.IsChildAgent) |
151 | { | 148 | { |
152 | 149 | avatar.ControllingClient.SendWindData(windSpeeds); | |
153 | avatar.ControllingClient.SendWindData( | ||
154 | 0, | ||
155 | 0,0,1, | ||
156 | windarr); | ||
157 | } | 150 | } |
158 | } | 151 | } |
159 | 152 | ||
@@ -169,7 +162,7 @@ namespace OpenSim.Region.Environment.Modules | |||
169 | foreach (ScenePresence avatar in avatars) | 162 | foreach (ScenePresence avatar in avatars) |
170 | { | 163 | { |
171 | if (!avatar.IsChildAgent) | 164 | if (!avatar.IsChildAgent) |
172 | avatar.ControllingClient.SendWindData(windarr); | 165 | avatar.ControllingClient.SendWindData(windSpeeds); |
173 | } | 166 | } |
174 | 167 | ||
175 | // set estate settings for region access to sun position | 168 | // set estate settings for region access to sun position |
@@ -182,35 +175,14 @@ namespace OpenSim.Region.Environment.Modules | |||
182 | 175 | ||
183 | private void GenWindPos() | 176 | private void GenWindPos() |
184 | { | 177 | { |
185 | //windarr = new float[256*256]; | 178 | for (int y = 0; y < 16; y++) |
186 | |||
187 | Array.Clear(windarr, 0, 256 * 256); | ||
188 | //float i = 0f; | ||
189 | //float i2 = 2f; | ||
190 | |||
191 | for (int x = 0; x < 16; x++) | ||
192 | { | 179 | { |
193 | for (int y = 0; y < 16; y++) | 180 | for (int x = 0; x < 16; x++) |
194 | { | 181 | { |
195 | 182 | windSpeeds[y * 16 + x].X = (float)(rndnums.NextDouble() * 2d - 1d); | |
196 | windarr[x * 256 + y] = (float)(rndnums.NextDouble() * 2d - 1d); | 183 | windSpeeds[y * 16 + x].Y = (float)(rndnums.NextDouble() * 2d - 1d); |
197 | |||
198 | } | 184 | } |
199 | |||
200 | } | 185 | } |
201 | for (int x = 16; x < 32; x++) | ||
202 | { | ||
203 | for (int y = 0; y < 16; y++) | ||
204 | { | ||
205 | |||
206 | windarr[x * 256 + y] = (float)(rndnums.NextDouble() * 2d - 1d); | ||
207 | |||
208 | } | ||
209 | |||
210 | } | ||
211 | |||
212 | |||
213 | // m_log.Debug("[SUN] Velocity("+Velocity.X+","+Velocity.Y+","+Velocity.Z+")"); | ||
214 | } | 186 | } |
215 | 187 | ||
216 | private void ClientLoggedOut(UUID AgentId) | 188 | private void ClientLoggedOut(UUID AgentId) |