Update svn properties.
parent
a1fe54baa0
commit
99cfcf405b
|
@ -1,12 +1,12 @@
|
||||||
<Addin id="WindModule.Default.WindModels" version="1.0">
|
<Addin id="WindModule.Default.WindModels" version="1.0">
|
||||||
<Runtime>
|
<Runtime>
|
||||||
<Import assembly="OpenSim.Region.CoreModules.dll"/>
|
<Import assembly="OpenSim.Region.CoreModules.dll"/>
|
||||||
</Runtime>
|
</Runtime>
|
||||||
<Dependencies>
|
<Dependencies>
|
||||||
<Addin id="OpenSim" version="0.5" />
|
<Addin id="OpenSim" version="0.5" />
|
||||||
</Dependencies>
|
</Dependencies>
|
||||||
<Extension path = "/OpenSim/WindModule">
|
<Extension path = "/OpenSim/WindModule">
|
||||||
<WindModel id="ConfigurableWind" type="OpenSim.Region.CoreModules.World.Wind.Plugins.ConfigurableWind" />
|
<WindModel id="ConfigurableWind" type="OpenSim.Region.CoreModules.World.Wind.Plugins.ConfigurableWind" />
|
||||||
<WindModel id="SimpleRandomWind" type="OpenSim.Region.CoreModules.World.Wind.Plugins.SimpleRandomWind" />
|
<WindModel id="SimpleRandomWind" type="OpenSim.Region.CoreModules.World.Wind.Plugins.SimpleRandomWind" />
|
||||||
</Extension>
|
</Extension>
|
||||||
</Addin>
|
</Addin>
|
||||||
|
|
|
@ -1,56 +1,56 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.World.Wind
|
namespace OpenSim.Region.CoreModules.World.Wind
|
||||||
{
|
{
|
||||||
public interface IWindModelPlugin : IPlugin
|
public interface IWindModelPlugin : IPlugin
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Brief description of this plugin's wind model
|
/// Brief description of this plugin's wind model
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string Description { get; }
|
string Description { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides access to the wind configuration, if any.
|
/// Provides access to the wind configuration, if any.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void WindConfig(Scene scene, IConfig windConfig);
|
void WindConfig(Scene scene, IConfig windConfig);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update wind.
|
/// Update wind.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void WindUpdate(uint frame);
|
void WindUpdate(uint frame);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the wind vector at the given local region coordinates.
|
/// Returns the wind vector at the given local region coordinates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Vector3 WindSpeed(float x, float y, float z);
|
Vector3 WindSpeed(float x, float y, float z);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a 16 x 16 Vector2 array of wind speeds for LL* based viewers
|
/// Generate a 16 x 16 Vector2 array of wind speeds for LL* based viewers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Must return a Vector2[256]</returns>
|
/// <returns>Must return a Vector2[256]</returns>
|
||||||
Vector2[] WindLLClientArray();
|
Vector2[] WindLLClientArray();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve a list of parameter/description pairs.
|
/// Retrieve a list of parameter/description pairs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Dictionary<string, string> WindParams();
|
Dictionary<string, string> WindParams();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the specified parameter
|
/// Set the specified parameter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void WindParamSet(string param, float value);
|
void WindParamSet(string param, float value);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the specified parameter
|
/// Get the specified parameter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
float WindParamGet(string param);
|
float WindParamGet(string param);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,211 +1,211 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
using OpenSim.Region.CoreModules.World.Wind;
|
using OpenSim.Region.CoreModules.World.Wind;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.World.Wind.Plugins
|
namespace OpenSim.Region.CoreModules.World.Wind.Plugins
|
||||||
{
|
{
|
||||||
class ConfigurableWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin
|
class ConfigurableWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private Vector2[] m_windSpeeds = new Vector2[16 * 16];
|
private Vector2[] m_windSpeeds = new Vector2[16 * 16];
|
||||||
private Random m_rndnums = new Random(Environment.TickCount);
|
private Random m_rndnums = new Random(Environment.TickCount);
|
||||||
|
|
||||||
private float m_avgStrength = 5.0f; // Average magnitude of the wind vector
|
private float m_avgStrength = 5.0f; // Average magnitude of the wind vector
|
||||||
private float m_avgDirection = 0.0f; // Average direction of the wind in degrees
|
private float m_avgDirection = 0.0f; // Average direction of the wind in degrees
|
||||||
private float m_varStrength = 5.0f; // Max Strength Variance
|
private float m_varStrength = 5.0f; // Max Strength Variance
|
||||||
private float m_varDirection = 30.0f;// Max Direction Variance
|
private float m_varDirection = 30.0f;// Max Direction Variance
|
||||||
private float m_rateChange = 1.0f; //
|
private float m_rateChange = 1.0f; //
|
||||||
|
|
||||||
private Vector2 m_curPredominateWind = new Vector2();
|
private Vector2 m_curPredominateWind = new Vector2();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region IPlugin Members
|
#region IPlugin Members
|
||||||
|
|
||||||
public string Version
|
public string Version
|
||||||
{
|
{
|
||||||
get { return "1.0.0.0"; }
|
get { return "1.0.0.0"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return "ConfigurableWind"; }
|
get { return "ConfigurableWind"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise()
|
public void Initialise()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IDisposable Members
|
#region IDisposable Members
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
m_windSpeeds = null;
|
m_windSpeeds = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IWindModelPlugin Members
|
#region IWindModelPlugin Members
|
||||||
|
|
||||||
public void WindConfig(OpenSim.Region.Framework.Scenes.Scene scene, Nini.Config.IConfig windConfig)
|
public void WindConfig(OpenSim.Region.Framework.Scenes.Scene scene, Nini.Config.IConfig windConfig)
|
||||||
{
|
{
|
||||||
if( windConfig != null )
|
if( windConfig != null )
|
||||||
{
|
{
|
||||||
// Uses strength value if avg_strength not specified
|
// Uses strength value if avg_strength not specified
|
||||||
m_avgStrength = windConfig.GetFloat("strength", 5.0F);
|
m_avgStrength = windConfig.GetFloat("strength", 5.0F);
|
||||||
m_avgStrength = windConfig.GetFloat("avg_strength", 5.0F);
|
m_avgStrength = windConfig.GetFloat("avg_strength", 5.0F);
|
||||||
|
|
||||||
m_avgDirection = windConfig.GetFloat("avg_direction", 0.0F);
|
m_avgDirection = windConfig.GetFloat("avg_direction", 0.0F);
|
||||||
m_varStrength = windConfig.GetFloat("var_strength", 5.0F);
|
m_varStrength = windConfig.GetFloat("var_strength", 5.0F);
|
||||||
m_varDirection = windConfig.GetFloat("var_direction", 30.0F);
|
m_varDirection = windConfig.GetFloat("var_direction", 30.0F);
|
||||||
m_rateChange = windConfig.GetFloat("rate_change", 1.0F);
|
m_rateChange = windConfig.GetFloat("rate_change", 1.0F);
|
||||||
|
|
||||||
LogSettings();
|
LogSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WindUpdate(uint frame)
|
public void WindUpdate(uint frame)
|
||||||
{
|
{
|
||||||
double avgAng = m_avgDirection * (Math.PI/180.0f);
|
double avgAng = m_avgDirection * (Math.PI/180.0f);
|
||||||
double varDir = m_varDirection * (Math.PI/180.0f);
|
double varDir = m_varDirection * (Math.PI/180.0f);
|
||||||
|
|
||||||
// Prevailing wind algorithm
|
// Prevailing wind algorithm
|
||||||
// Inspired by Kanker Greenacre
|
// Inspired by Kanker Greenacre
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// * This should probably be based on in-world time.
|
// * This should probably be based on in-world time.
|
||||||
// * should probably move all these local variables to class members and constants
|
// * should probably move all these local variables to class members and constants
|
||||||
double time = DateTime.Now.TimeOfDay.Seconds / 86400;
|
double time = DateTime.Now.TimeOfDay.Seconds / 86400;
|
||||||
|
|
||||||
double theta = time * (2 * Math.PI) * m_rateChange;
|
double theta = time * (2 * Math.PI) * m_rateChange;
|
||||||
|
|
||||||
double offset = Math.Sin(theta) * Math.Sin(theta*2) * Math.Sin(theta*9) * Math.Cos(theta*4);
|
double offset = Math.Sin(theta) * Math.Sin(theta*2) * Math.Sin(theta*9) * Math.Cos(theta*4);
|
||||||
|
|
||||||
double windDir = avgAng + (varDir * offset);
|
double windDir = avgAng + (varDir * offset);
|
||||||
|
|
||||||
offset = Math.Sin(theta) * Math.Sin(theta*4) + (Math.Sin(theta*13) / 3);
|
offset = Math.Sin(theta) * Math.Sin(theta*4) + (Math.Sin(theta*13) / 3);
|
||||||
double windSpeed = m_avgStrength + (m_varStrength * offset);
|
double windSpeed = m_avgStrength + (m_varStrength * offset);
|
||||||
|
|
||||||
if (windSpeed<0)
|
if (windSpeed<0)
|
||||||
windSpeed=0;
|
windSpeed=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_curPredominateWind.X = (float)Math.Cos(windDir);
|
m_curPredominateWind.X = (float)Math.Cos(windDir);
|
||||||
m_curPredominateWind.Y = (float)Math.Sin(windDir);
|
m_curPredominateWind.Y = (float)Math.Sin(windDir);
|
||||||
|
|
||||||
m_curPredominateWind.Normalize();
|
m_curPredominateWind.Normalize();
|
||||||
m_curPredominateWind.X *= (float)windSpeed;
|
m_curPredominateWind.X *= (float)windSpeed;
|
||||||
m_curPredominateWind.Y *= (float)windSpeed;
|
m_curPredominateWind.Y *= (float)windSpeed;
|
||||||
|
|
||||||
for (int y = 0; y < 16; y++)
|
for (int y = 0; y < 16; y++)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < 16; x++)
|
for (int x = 0; x < 16; x++)
|
||||||
{
|
{
|
||||||
m_windSpeeds[y * 16 + x] = m_curPredominateWind;
|
m_windSpeeds[y * 16 + x] = m_curPredominateWind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3 WindSpeed(float fX, float fY, float fZ)
|
public Vector3 WindSpeed(float fX, float fY, float fZ)
|
||||||
{
|
{
|
||||||
return new Vector3(m_curPredominateWind, 0.0f);
|
return new Vector3(m_curPredominateWind, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2[] WindLLClientArray()
|
public Vector2[] WindLLClientArray()
|
||||||
{
|
{
|
||||||
return m_windSpeeds;
|
return m_windSpeeds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Description
|
public string Description
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "Provides a predominate wind direction that can change within configured variances for direction and speed.";
|
return "Provides a predominate wind direction that can change within configured variances for direction and speed.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public System.Collections.Generic.Dictionary<string, string> WindParams()
|
public System.Collections.Generic.Dictionary<string, string> WindParams()
|
||||||
{
|
{
|
||||||
Dictionary<string, string> Params = new Dictionary<string, string>();
|
Dictionary<string, string> Params = new Dictionary<string, string>();
|
||||||
|
|
||||||
Params.Add("avgStrength", "average wind strength");
|
Params.Add("avgStrength", "average wind strength");
|
||||||
Params.Add("avgDirection", "average wind direction in degrees");
|
Params.Add("avgDirection", "average wind direction in degrees");
|
||||||
Params.Add("varStrength", "allowable variance in wind strength");
|
Params.Add("varStrength", "allowable variance in wind strength");
|
||||||
Params.Add("varDirection", "allowable variance in wind direction in +/- degrees");
|
Params.Add("varDirection", "allowable variance in wind direction in +/- degrees");
|
||||||
Params.Add("rateChange", "rate of change");
|
Params.Add("rateChange", "rate of change");
|
||||||
|
|
||||||
return Params;
|
return Params;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WindParamSet(string param, float value)
|
public void WindParamSet(string param, float value)
|
||||||
{
|
{
|
||||||
switch (param)
|
switch (param)
|
||||||
{
|
{
|
||||||
case "avgStrength":
|
case "avgStrength":
|
||||||
m_avgStrength = value;
|
m_avgStrength = value;
|
||||||
break;
|
break;
|
||||||
case "avgDirection":
|
case "avgDirection":
|
||||||
m_avgDirection = value;
|
m_avgDirection = value;
|
||||||
break;
|
break;
|
||||||
case "varStrength":
|
case "varStrength":
|
||||||
m_varStrength = value;
|
m_varStrength = value;
|
||||||
break;
|
break;
|
||||||
case "varDirection":
|
case "varDirection":
|
||||||
m_varDirection = value;
|
m_varDirection = value;
|
||||||
break;
|
break;
|
||||||
case "rateChange":
|
case "rateChange":
|
||||||
m_rateChange = value;
|
m_rateChange = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float WindParamGet(string param)
|
public float WindParamGet(string param)
|
||||||
{
|
{
|
||||||
switch (param)
|
switch (param)
|
||||||
{
|
{
|
||||||
case "avgStrength":
|
case "avgStrength":
|
||||||
return m_avgStrength;
|
return m_avgStrength;
|
||||||
case "avgDirection":
|
case "avgDirection":
|
||||||
return m_avgDirection;
|
return m_avgDirection;
|
||||||
case "varStrength":
|
case "varStrength":
|
||||||
return m_varStrength;
|
return m_varStrength;
|
||||||
case "varDirection":
|
case "varDirection":
|
||||||
return m_varDirection;
|
return m_varDirection;
|
||||||
case "rateChange":
|
case "rateChange":
|
||||||
return m_rateChange;
|
return m_rateChange;
|
||||||
default:
|
default:
|
||||||
throw new Exception(String.Format("Unknown {0} parameter {1}", this.Name, param));
|
throw new Exception(String.Format("Unknown {0} parameter {1}", this.Name, param));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
private void LogSettings()
|
private void LogSettings()
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[ConfigurableWind] Average Strength : {0}", m_avgStrength);
|
m_log.InfoFormat("[ConfigurableWind] Average Strength : {0}", m_avgStrength);
|
||||||
m_log.InfoFormat("[ConfigurableWind] Average Direction : {0}", m_avgDirection);
|
m_log.InfoFormat("[ConfigurableWind] Average Direction : {0}", m_avgDirection);
|
||||||
m_log.InfoFormat("[ConfigurableWind] Varience Strength : {0}", m_varStrength);
|
m_log.InfoFormat("[ConfigurableWind] Varience Strength : {0}", m_varStrength);
|
||||||
m_log.InfoFormat("[ConfigurableWind] Varience Direction : {0}", m_varDirection);
|
m_log.InfoFormat("[ConfigurableWind] Varience Direction : {0}", m_varDirection);
|
||||||
m_log.InfoFormat("[ConfigurableWind] Rate Change : {0}", m_rateChange);
|
m_log.InfoFormat("[ConfigurableWind] Rate Change : {0}", m_rateChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IWindModelPlugin Members
|
#region IWindModelPlugin Members
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,139 +1,139 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.World.Wind.Plugins
|
namespace OpenSim.Region.CoreModules.World.Wind.Plugins
|
||||||
{
|
{
|
||||||
class SimpleRandomWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin
|
class SimpleRandomWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin
|
||||||
{
|
{
|
||||||
private Vector2[] m_windSpeeds = new Vector2[16 * 16];
|
private Vector2[] m_windSpeeds = new Vector2[16 * 16];
|
||||||
private float m_strength = 1.0f;
|
private float m_strength = 1.0f;
|
||||||
private Random m_rndnums = new Random(Environment.TickCount);
|
private Random m_rndnums = new Random(Environment.TickCount);
|
||||||
|
|
||||||
|
|
||||||
#region IPlugin Members
|
#region IPlugin Members
|
||||||
|
|
||||||
public string Version
|
public string Version
|
||||||
{
|
{
|
||||||
get { return "1.0.0.0"; }
|
get { return "1.0.0.0"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return "SimpleRandomWind"; }
|
get { return "SimpleRandomWind"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise()
|
public void Initialise()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IDisposable Members
|
#region IDisposable Members
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
m_windSpeeds = null;
|
m_windSpeeds = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IWindModelPlugin Members
|
#region IWindModelPlugin Members
|
||||||
|
|
||||||
public void WindConfig(OpenSim.Region.Framework.Scenes.Scene scene, Nini.Config.IConfig windConfig)
|
public void WindConfig(OpenSim.Region.Framework.Scenes.Scene scene, Nini.Config.IConfig windConfig)
|
||||||
{
|
{
|
||||||
if( windConfig != null )
|
if( windConfig != null )
|
||||||
{
|
{
|
||||||
if( windConfig.Contains("strength") )
|
if( windConfig.Contains("strength") )
|
||||||
{
|
{
|
||||||
m_strength = windConfig.GetFloat("strength", 1.0F);
|
m_strength = windConfig.GetFloat("strength", 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WindUpdate(uint frame)
|
public void WindUpdate(uint frame)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < 16; y++)
|
for (int y = 0; y < 16; y++)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < 16; x++)
|
for (int x = 0; x < 16; x++)
|
||||||
{
|
{
|
||||||
m_windSpeeds[y * 16 + x].X = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1
|
m_windSpeeds[y * 16 + x].X = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1
|
||||||
m_windSpeeds[y * 16 + x].Y = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1
|
m_windSpeeds[y * 16 + x].Y = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1
|
||||||
m_windSpeeds[y * 16 + x].X *= m_strength;
|
m_windSpeeds[y * 16 + x].X *= m_strength;
|
||||||
m_windSpeeds[y * 16 + x].Y *= m_strength;
|
m_windSpeeds[y * 16 + x].Y *= m_strength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3 WindSpeed(float fX, float fY, float fZ)
|
public Vector3 WindSpeed(float fX, float fY, float fZ)
|
||||||
{
|
{
|
||||||
Vector3 windVector = new Vector3(0.0f, 0.0f, 0.0f);
|
Vector3 windVector = new Vector3(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
int x = (int)fX / 16;
|
int x = (int)fX / 16;
|
||||||
int y = (int)fY / 16;
|
int y = (int)fY / 16;
|
||||||
|
|
||||||
if (x < 0) x = 0;
|
if (x < 0) x = 0;
|
||||||
if (x > 15) x = 15;
|
if (x > 15) x = 15;
|
||||||
if (y < 0) y = 0;
|
if (y < 0) y = 0;
|
||||||
if (y > 15) y = 15;
|
if (y > 15) y = 15;
|
||||||
|
|
||||||
if (m_windSpeeds != null)
|
if (m_windSpeeds != null)
|
||||||
{
|
{
|
||||||
windVector.X = m_windSpeeds[y * 16 + x].X;
|
windVector.X = m_windSpeeds[y * 16 + x].X;
|
||||||
windVector.Y = m_windSpeeds[y * 16 + x].Y;
|
windVector.Y = m_windSpeeds[y * 16 + x].Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
return windVector;
|
return windVector;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2[] WindLLClientArray()
|
public Vector2[] WindLLClientArray()
|
||||||
{
|
{
|
||||||
return m_windSpeeds;
|
return m_windSpeeds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Description
|
public string Description
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "Provides a simple wind model that creates random wind of a given strength in 16m x 16m patches.";
|
return "Provides a simple wind model that creates random wind of a given strength in 16m x 16m patches.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public System.Collections.Generic.Dictionary<string, string> WindParams()
|
public System.Collections.Generic.Dictionary<string, string> WindParams()
|
||||||
{
|
{
|
||||||
Dictionary<string, string> Params = new Dictionary<string, string>();
|
Dictionary<string, string> Params = new Dictionary<string, string>();
|
||||||
|
|
||||||
Params.Add("strength", "wind strength");
|
Params.Add("strength", "wind strength");
|
||||||
|
|
||||||
return Params;
|
return Params;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WindParamSet(string param, float value)
|
public void WindParamSet(string param, float value)
|
||||||
{
|
{
|
||||||
switch (param)
|
switch (param)
|
||||||
{
|
{
|
||||||
case "strength":
|
case "strength":
|
||||||
m_strength = value;
|
m_strength = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float WindParamGet(string param)
|
public float WindParamGet(string param)
|
||||||
{
|
{
|
||||||
switch (param)
|
switch (param)
|
||||||
{
|
{
|
||||||
case "strength":
|
case "strength":
|
||||||
return m_strength;
|
return m_strength;
|
||||||
default:
|
default:
|
||||||
throw new Exception(String.Format("Unknown {0} parameter {1}", this.Name, param));
|
throw new Exception(String.Format("Unknown {0} parameter {1}", this.Name, param));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
{
|
{
|
||||||
public interface IObjectAccessor : ICollection<IObject>
|
public interface IObjectAccessor : ICollection<IObject>
|
||||||
{
|
{
|
||||||
IObject this[int index] { get; }
|
IObject this[int index] { get; }
|
||||||
IObject this[uint index] { get; }
|
IObject this[uint index] { get; }
|
||||||
IObject this[UUID index] { get; }
|
IObject this[UUID index] { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,132 +1,132 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using IEnumerable=System.Collections.IEnumerable;
|
using IEnumerable=System.Collections.IEnumerable;
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
{
|
{
|
||||||
|
|
||||||
internal class IObjEnum : IEnumerator<IObject>
|
internal class IObjEnum : IEnumerator<IObject>
|
||||||
{
|
{
|
||||||
private readonly Scene m_scene;
|
private readonly Scene m_scene;
|
||||||
private readonly IEnumerator<EntityBase> m_sogEnum;
|
private readonly IEnumerator<EntityBase> m_sogEnum;
|
||||||
|
|
||||||
public IObjEnum(Scene scene)
|
public IObjEnum(Scene scene)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator();
|
m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
m_sogEnum.Dispose();
|
m_sogEnum.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
{
|
{
|
||||||
return m_sogEnum.MoveNext();
|
return m_sogEnum.MoveNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
m_sogEnum.Reset();
|
m_sogEnum.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IObject Current
|
public IObject Current
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return new SOPObject(m_scene, m_sogEnum.Current.LocalId);
|
return new SOPObject(m_scene, m_sogEnum.Current.LocalId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object IEnumerator.Current
|
object IEnumerator.Current
|
||||||
{
|
{
|
||||||
get { return Current; }
|
get { return Current; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ObjectAccessor : IObjectAccessor
|
public class ObjectAccessor : IObjectAccessor
|
||||||
{
|
{
|
||||||
private readonly Scene m_scene;
|
private readonly Scene m_scene;
|
||||||
|
|
||||||
public ObjectAccessor(Scene scene)
|
public ObjectAccessor(Scene scene)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IObject this[int index]
|
public IObject this[int index]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId);
|
return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IObject this[uint index]
|
public IObject this[uint index]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return new SOPObject(m_scene, m_scene.Entities[index].LocalId);
|
return new SOPObject(m_scene, m_scene.Entities[index].LocalId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IObject this[UUID index]
|
public IObject this[UUID index]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return new SOPObject(m_scene, m_scene.Entities[index].LocalId);
|
return new SOPObject(m_scene, m_scene.Entities[index].LocalId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator<IObject> GetEnumerator()
|
public IEnumerator<IObject> GetEnumerator()
|
||||||
{
|
{
|
||||||
return new IObjEnum(m_scene);
|
return new IObjEnum(m_scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
{
|
{
|
||||||
return GetEnumerator();
|
return GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(IObject item)
|
public void Add(IObject item)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException("Collection is read-only. This is an API TODO FIX, creation of objects is presently impossible.");
|
throw new NotSupportedException("Collection is read-only. This is an API TODO FIX, creation of objects is presently impossible.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
throw new NotSupportedException("Collection is read-only. TODO FIX.");
|
throw new NotSupportedException("Collection is read-only. TODO FIX.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Contains(IObject item)
|
public bool Contains(IObject item)
|
||||||
{
|
{
|
||||||
return m_scene.Entities.ContainsKey(item.LocalID);
|
return m_scene.Entities.ContainsKey(item.LocalID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CopyTo(IObject[] array, int arrayIndex)
|
public void CopyTo(IObject[] array, int arrayIndex)
|
||||||
{
|
{
|
||||||
for (int i = arrayIndex; i < Count + arrayIndex; i++)
|
for (int i = arrayIndex; i < Count + arrayIndex; i++)
|
||||||
{
|
{
|
||||||
array[i] = this[i - arrayIndex];
|
array[i] = this[i - arrayIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Remove(IObject item)
|
public bool Remove(IObject item)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException("Collection is read-only. TODO FIX.");
|
throw new NotSupportedException("Collection is read-only. TODO FIX.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Count
|
public int Count
|
||||||
{
|
{
|
||||||
get { return m_scene.Entities.Count; }
|
get { return m_scene.Entities.Count; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsReadOnly
|
public bool IsReadOnly
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return true; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,37 @@
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
{
|
{
|
||||||
class SPAvatar : IAvatar
|
class SPAvatar : IAvatar
|
||||||
{
|
{
|
||||||
private readonly Scene m_rootScene;
|
private readonly Scene m_rootScene;
|
||||||
private readonly UUID m_ID;
|
private readonly UUID m_ID;
|
||||||
|
|
||||||
public SPAvatar(Scene scene, UUID ID)
|
public SPAvatar(Scene scene, UUID ID)
|
||||||
{
|
{
|
||||||
m_rootScene = scene;
|
m_rootScene = scene;
|
||||||
m_ID = ID;
|
m_ID = ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScenePresence GetSP()
|
private ScenePresence GetSP()
|
||||||
{
|
{
|
||||||
return m_rootScene.GetScenePresence(m_ID);
|
return m_rootScene.GetScenePresence(m_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return GetSP().Name; }
|
get { return GetSP().Name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID GlobalID
|
public UUID GlobalID
|
||||||
{
|
{
|
||||||
get { return m_ID; }
|
get { return m_ID; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3 Position
|
public Vector3 Position
|
||||||
{
|
{
|
||||||
get { return GetSP().AbsolutePosition; }
|
get { return GetSP().AbsolutePosition; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
using OpenSim.Region.OptionalModules.Scripting.Minimodule;
|
using OpenSim.Region.OptionalModules.Scripting.Minimodule;
|
||||||
|
|
||||||
namespace OpenSim
|
namespace OpenSim
|
||||||
{
|
{
|
||||||
class MiniModule : MRMBase
|
class MiniModule : MRMBase
|
||||||
{
|
{
|
||||||
public override void Start()
|
public override void Start()
|
||||||
{
|
{
|
||||||
Host.Console.Info("Hello World!");
|
Host.Console.Info("Hello World!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Stop()
|
public override void Stop()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue