29 using System.Collections.Generic;
34 using OpenSim.Region.Framework.Interfaces;
38 [Extension(Path =
"/OpenSim/WindModule", NodeName =
"WindModel", Id =
"SimpleRandomWind")]
41 private Vector2[] m_windSpeeds =
new Vector2[16 * 16];
42 private float m_strength = 1.0f;
43 private Random m_rndnums =
new Random(Environment.TickCount);
45 #region IPlugin Members
49 get {
return "1.0.0.0"; }
54 get {
return "SimpleRandomWind"; }
63 #region IDisposable Members
72 #region IWindModelPlugin Members
76 if (windConfig != null)
78 if (windConfig.Contains(
"strength"))
80 m_strength = windConfig.GetFloat(
"strength", 1.0F);
88 if (m_windSpeeds != null)
90 for (
int y = 0; y < 16; y++)
92 for (
int x = 0; x < 16; x++)
94 m_windSpeeds[y * 16 + x].X = (float)(m_rndnums.NextDouble() * 2d - 1d);
95 m_windSpeeds[y * 16 + x].Y = (float)(m_rndnums.NextDouble() * 2d - 1d);
96 m_windSpeeds[y * 16 + x].X *= m_strength;
97 m_windSpeeds[y * 16 + x].Y *= m_strength;
105 Vector3 windVector =
new Vector3(0.0f, 0.0f, 0.0f);
107 int x = (int)fX / 16;
108 int y = (int)fY / 16;
115 if (m_windSpeeds != null)
117 windVector.X = m_windSpeeds[y * 16 + x].X;
118 windVector.Y = m_windSpeeds[y * 16 + x].Y;
129 public string Description
133 return "Provides a simple wind model that creates random wind of a given strength in 16m x 16m patches.";
137 public System.Collections.Generic.Dictionary<string,
string>
WindParams()
139 Dictionary<string, string> Params =
new Dictionary<string, string>();
141 Params.Add(
"strength",
"wind strength");
163 throw new Exception(
String.Format(
"Unknown {0} parameter {1}",
this.Name, param));
Vector3 WindSpeed(float fX, float fY, float fZ)
Returns the wind vector at the given local region coordinates.
void Initialise()
Default-initialises the plugin
void WindUpdate(uint frame)
Update wind.
float WindParamGet(string param)
Get the specified parameter
void WindParamSet(string param, float value)
Set the specified parameter
System.Collections.Generic.Dictionary< string, string > WindParams()
Retrieve a list of parameter/description pairs.
Vector2[] WindLLClientArray()
Generate a 16 x 16 Vector2 array of wind speeds for LL* based viewers
void WindConfig(OpenSim.Region.Framework.Scenes.Scene scene, Nini.Config.IConfig windConfig)
Interactive OpenSim region server