From 62eaddbe14e0bf5098808294502c14a7ed4063c3 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Thu, 5 Mar 2009 04:24:22 +0000 Subject: 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. --- .../Region/CoreModules/World/Wind/WindModule.cs | 30 ++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/World/Wind') 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 private Random rndnums = new Random(Environment.TickCount); private Scene m_scene = null; private bool ready = false; + + // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m private Vector2[] windSpeeds = new Vector2[16 * 16]; + private Dictionary m_rootAgents = new Dictionary(); public void Initialise(Scene scene, IConfigSource config) @@ -89,9 +92,32 @@ namespace OpenSim.Region.CoreModules get { return false; } } - public Vector2[] WindSpeeds + /// + /// Retrieve the wind speed at the given region coordinate. This + /// implimentation ignores Z. + /// + /// 0...255 + /// 0...255 + /// + public Vector3 WindSpeed(int x, int y, int z) { - get { return windSpeeds; } + Vector3 windVector = new Vector3(0.0f, 0.0f, 0.0f); + + x /= 16; + y /= 16; + if (x < 0) x = 0; + if (x > 15) x = 15; + if (y < 0) y = 0; + if (y > 15) y = 15; + + if (windSpeeds != null) + { + windVector.X = windSpeeds[y * 16 + x].X; + windVector.Y = windSpeeds[y * 16 + x].Y; + } + + + return windVector; } public void WindToClient(IClientAPI client) -- cgit v1.1