diff options
author | Charles Krinke | 2009-03-05 04:24:22 +0000 |
---|---|---|
committer | Charles Krinke | 2009-03-05 04:24:22 +0000 |
commit | 62eaddbe14e0bf5098808294502c14a7ed4063c3 (patch) | |
tree | 66f40f6c448d4f8fd1700160aee2c0cfe2e3ab79 /OpenSim/Region/CoreModules | |
parent | Fixes Mantis #3194. Thank you kindly, Godfrey for a patch that: (diff) | |
download | opensim-SC-62eaddbe14e0bf5098808294502c14a7ed4063c3.zip opensim-SC-62eaddbe14e0bf5098808294502c14a7ed4063c3.tar.gz opensim-SC-62eaddbe14e0bf5098808294502c14a7ed4063c3.tar.bz2 opensim-SC-62eaddbe14e0bf5098808294502c14a7ed4063c3.tar.xz |
Fixes Mantis #3255. Thank you kindly, MCortez, for a patch that:
Changes to IWindModule interface: Change from assuming a single array of
256 Vector2 values to a lookup function that takes region x, y, z and returns a Vector3
* Changed llWind() to use new lookup method of IWindModule
* Moved logic for determining the wind at a given point in the data array from
llWind() to the Wind Module itself.
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) |