From ec637e2b8c089efc16bbb9faae0a1e3cf939db41 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 31 Mar 2010 04:20:20 +0100 Subject: Committing the LightShare code, which was developed by TomMeta of Meta7. This allows scripts to set WindLight parameters for clients connecting to a region. Currently, this is only supported by the Meta7 viewer. --- OpenSim/Framework/IClientAPI.cs | 2 +- OpenSim/Framework/RegionInfo.cs | 305 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 305 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 4f6f709..4577758 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1150,7 +1150,7 @@ namespace OpenSim.Framework void SendInstantMessage(GridInstantMessage im); - void SendGenericMessage(string method, List message); + void SendGenericMessage(string method, List message); void SendLayerData(float[] map); void SendLayerData(int px, int py, float[] map); diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 5d63da7..5eacd73 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -36,8 +36,295 @@ using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework.Console; + namespace OpenSim.Framework -{ +{ + public class RegionLightShareData : ICloneable + { + public UUID regionID = UUID.Zero; + public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f); + public float waterFogDensityExponent = 4.0f; + public float underwaterFogModifier = 0.25f; + public Vector3 reflectionWaveletScale = new Vector3(2.0f,2.0f,2.0f); + public float fresnelScale = 0.40f; + public float fresnelOffset = 0.50f; + public float refractScaleAbove = 0.03f; + public float refractScaleBelow = 0.20f; + public float blurMultiplier = 0.040f; + public Vector2 bigWaveDirection = new Vector2(1.05f,-0.42f); + public Vector2 littleWaveDirection = new Vector2(1.11f,-1.16f); + public UUID normalMapTexture = new UUID("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); + public Vector4 horizon = new Vector4(0.25f, 0.25f, 0.32f, 0.32f); + public float hazeHorizon = 0.19f; + public Vector4 blueDensity = new Vector4(0.12f, 0.22f, 0.38f, 0.38f); + public float hazeDensity = 0.70f; + public float densityMultiplier = 0.18f; + public float distanceMultiplier = 0.8f; + public UInt16 maxAltitude = 1605; + public Vector4 sunMoonColor = new Vector4(0.24f, 0.26f, 0.30f, 0.30f); + public float sunMoonPosition = 0.317f; + public Vector4 ambient = new Vector4(0.35f,0.35f,0.35f,0.35f); + public float eastAngle = 0.0f; + public float sunGlowFocus = 0.10f; + public float sunGlowSize = 1.75f; + public float sceneGamma = 1.0f; + public float starBrightness = 0.0f; + public Vector4 cloudColor = new Vector4(0.41f, 0.41f, 0.41f, 0.41f); + public Vector3 cloudXYDensity = new Vector3(1.00f, 0.53f, 1.00f); + public float cloudCoverage = 0.27f; + public float cloudScale = 0.42f; + public Vector3 cloudDetailXYDensity = new Vector3(1.00f, 0.53f, 0.12f); + public float cloudScrollX = 0.20f; + public bool cloudScrollXLock = false; + public float cloudScrollY = 0.01f; + public bool cloudScrollYLock = false; + public bool drawClassicClouds = true; + + public delegate void SaveDelegate(RegionLightShareData wl); + public event SaveDelegate OnSave; + public void Save() + { + if (OnSave != null) + OnSave(this); + } + public object Clone() + { + return this.MemberwiseClone(); // call clone method + } + + } + + [Serializable] + public class SimpleRegionInfo + { + // private static readonly log4net.ILog m_log + // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + + /// + /// The port by which http communication occurs with the region (most noticeably, CAPS communication) + /// + public uint HttpPort + { + get { return m_httpPort; } + set { m_httpPort = value; } + } + protected uint m_httpPort; + + /// + /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) + /// + public string ServerURI + { + get { return m_serverURI; } + set { m_serverURI = value; } + } + protected string m_serverURI; + + public string RegionName + { + get { return m_regionName; } + set { m_regionName = value; } + } + protected string m_regionName = String.Empty; + + protected bool Allow_Alternate_Ports; + public bool m_allow_alternate_ports; + protected string m_externalHostName; + + protected IPEndPoint m_internalEndPoint; + protected uint? m_regionLocX; + protected uint? m_regionLocY; + protected uint m_remotingPort; + public UUID RegionID = UUID.Zero; + public string RemotingAddress; + public UUID ScopeID = UUID.Zero; + + public SimpleRegionInfo() + { + } + + public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) + { + m_regionLocX = regionLocX; + m_regionLocY = regionLocY; + + m_internalEndPoint = internalEndPoint; + m_externalHostName = externalUri; + } + + public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) + { + m_regionLocX = regionLocX; + m_regionLocY = regionLocY; + + m_externalHostName = externalUri; + + m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); + } + + public SimpleRegionInfo(RegionInfo ConvertFrom) + { + m_regionName = ConvertFrom.RegionName; + m_regionLocX = ConvertFrom.RegionLocX; + m_regionLocY = ConvertFrom.RegionLocY; + m_internalEndPoint = ConvertFrom.InternalEndPoint; + m_externalHostName = ConvertFrom.ExternalHostName; + m_remotingPort = ConvertFrom.RemotingPort; + m_httpPort = ConvertFrom.HttpPort; + m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; + RemotingAddress = ConvertFrom.RemotingAddress; + RegionID = UUID.Zero; + ServerURI = ConvertFrom.ServerURI; + } + + public uint RemotingPort + { + get { return m_remotingPort; } + set { m_remotingPort = value; } + } + + /// + /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. + /// + /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method? + /// + public IPEndPoint ExternalEndPoint + { + get + { + // Old one defaults to IPv6 + //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); + + IPAddress ia = null; + // If it is already an IP, don't resolve it - just return directly + if (IPAddress.TryParse(m_externalHostName, out ia)) + return new IPEndPoint(ia, m_internalEndPoint.Port); + + // Reset for next check + ia = null; + try + { + foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) + { + if (ia == null) + ia = Adr; + + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; + } + } + } + catch (SocketException e) + { + throw new Exception( + "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + + e + "' attached to this exception", e); + } + + return new IPEndPoint(ia, m_internalEndPoint.Port); + } + + set { m_externalHostName = value.ToString(); } + } + + public string ExternalHostName + { + get { return m_externalHostName; } + set { m_externalHostName = value; } + } + + public IPEndPoint InternalEndPoint + { + get { return m_internalEndPoint; } + set { m_internalEndPoint = value; } + } + + public uint RegionLocX + { + get { return m_regionLocX.Value; } + set { m_regionLocX = value; } + } + + public uint RegionLocY + { + get { return m_regionLocY.Value; } + set { m_regionLocY = value; } + } + + public ulong RegionHandle + { + get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } + } + + public int getInternalEndPointPort() + { + return m_internalEndPoint.Port; + } + + public Dictionary ToKeyValuePairs() + { + Dictionary kvp = new Dictionary(); + kvp["uuid"] = RegionID.ToString(); + kvp["locX"] = RegionLocX.ToString(); + kvp["locY"] = RegionLocY.ToString(); + kvp["external_ip_address"] = ExternalEndPoint.Address.ToString(); + kvp["external_port"] = ExternalEndPoint.Port.ToString(); + kvp["external_host_name"] = ExternalHostName; + kvp["http_port"] = HttpPort.ToString(); + kvp["internal_ip_address"] = InternalEndPoint.Address.ToString(); + kvp["internal_port"] = InternalEndPoint.Port.ToString(); + kvp["alternate_ports"] = m_allow_alternate_ports.ToString(); + kvp["server_uri"] = ServerURI; + + return kvp; + } + + public SimpleRegionInfo(Dictionary kvp) + { + if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null)) + { + int port = 0; + Int32.TryParse((string)kvp["external_port"], out port); + IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port); + ExternalEndPoint = ep; + } + else + ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); + + if (kvp["external_host_name"] != null) + ExternalHostName = (string)kvp["external_host_name"]; + + if (kvp["http_port"] != null) + { + UInt32 port = 0; + UInt32.TryParse((string)kvp["http_port"], out port); + HttpPort = port; + } + + if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null)) + { + int port = 0; + Int32.TryParse((string)kvp["internal_port"], out port); + IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port); + InternalEndPoint = ep; + } + else + InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); + + if (kvp["alternate_ports"] != null) + { + bool alts = false; + Boolean.TryParse((string)kvp["alternate_ports"], out alts); + m_allow_alternate_ports = alts; + } + + if (kvp["server_uri"] != null) + ServerURI = (string)kvp["server_uri"]; + } + } + public class RegionInfo { // private static readonly log4net.ILog m_log @@ -69,6 +356,7 @@ namespace OpenSim.Framework private bool m_clampPrimSize = false; private int m_objectCapacity = 0; private string m_regionType = String.Empty; + private RegionLightShareData m_windlight = new RegionLightShareData(); protected uint m_httpPort; protected string m_serverURI; protected string m_regionName = String.Empty; @@ -207,6 +495,21 @@ namespace OpenSim.Framework set { m_regionSettings = value; } } + public RegionLightShareData WindlightSettings + { + get + { + if (m_windlight == null) + { + m_windlight = new RegionLightShareData(); + } + + return m_windlight; + } + + set { m_windlight = value; } + } + public int NonphysPrimMax { get { return m_nonphysPrimMax; } -- cgit v1.1 From 08ba34da0325e3ed2a839cff62f2020742e887e7 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 31 Mar 2010 21:30:44 -0700 Subject: First attempt at fixing mantis #4641. It's better but there are now some issues with permissions. (looks like my commit is going to touch CM files, I'm going to let it do it - eof only) --- OpenSim/Framework/Communications/Osp/OspResolver.cs | 5 ++++- OpenSim/Framework/RegionInfo.cs | 12 ++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/Osp/OspResolver.cs b/OpenSim/Framework/Communications/Osp/OspResolver.cs index 2e55f53..24ea64d 100644 --- a/OpenSim/Framework/Communications/Osp/OspResolver.cs +++ b/OpenSim/Framework/Communications/Osp/OspResolver.cs @@ -139,6 +139,9 @@ namespace OpenSim.Framework.Communications.Osp /// protected static UUID ResolveOspaName(string name, IUserAccountService userService) { + if (userService == null) + return UUID.Zero; + int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR); if (nameSeparatorIndex < 0) @@ -149,7 +152,7 @@ namespace OpenSim.Framework.Communications.Osp string firstName = name.Remove(nameSeparatorIndex).TrimEnd(); string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart(); - + UserAccount account = userService.GetUserAccount(UUID.Zero, firstName, lastName); if (account != null) return account.PrincipalID; diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 5eacd73..ad98816 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -38,7 +38,7 @@ using OpenSim.Framework.Console; namespace OpenSim.Framework -{ +{ public class RegionLightShareData : ICloneable { public UUID regionID = UUID.Zero; @@ -86,11 +86,11 @@ namespace OpenSim.Framework { if (OnSave != null) OnSave(this); - } - public object Clone() - { - return this.MemberwiseClone(); // call clone method - } + } + public object Clone() + { + return this.MemberwiseClone(); // call clone method + } } -- cgit v1.1