aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorMelanie Thielker2009-03-13 23:45:02 +0000
committerMelanie Thielker2009-03-13 23:45:02 +0000
commitddbf81fa07aac8098d9fa8d979969fffd5436f75 (patch)
treed65b3b280a53fe74253af2bfeee9bf3944dfa10b /OpenSim/Region/ClientStack
parent* Support loading empty folders in an iar (diff)
downloadopensim-SC_OLD-ddbf81fa07aac8098d9fa8d979969fffd5436f75.zip
opensim-SC_OLD-ddbf81fa07aac8098d9fa8d979969fffd5436f75.tar.gz
opensim-SC_OLD-ddbf81fa07aac8098d9fa8d979969fffd5436f75.tar.bz2
opensim-SC_OLD-ddbf81fa07aac8098d9fa8d979969fffd5436f75.tar.xz
Thank you, mcortez, for a patch that fixes a number of long standing
issues with the sun module. Fixes Mantis #3295
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs22
1 files changed, 21 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 95519bc..10e5c5a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -87,6 +87,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
87 87
88 private int m_inPacketsChecked; 88 private int m_inPacketsChecked;
89 89
90 // Used to adjust Sun Orbit values so Linden based viewers properly position sun
91 private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f;
92
93
90 /* protected variables */ 94 /* protected variables */
91 95
92 protected static Dictionary<PacketType, PacketMethod> PacketHandlers = 96 protected static Dictionary<PacketType, PacketMethod> PacketHandlers =
@@ -2403,10 +2407,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2403 2407
2404 public void SendSunPos(Vector3 Position, Vector3 Velocity, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear, float OrbitalPosition) 2408 public void SendSunPos(Vector3 Position, Vector3 Velocity, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear, float OrbitalPosition)
2405 { 2409 {
2410 // Viewers based on the Linden viwer code, do wacky things for oribital positions from Midnight to Sunrise
2411 // So adjust for that
2412 // Contributed by: Godfrey
2413
2414 if (OrbitalPosition > m_sunPainDaHalfOrbitalCutoff) // things get weird from midnight to sunrise
2415 {
2416 OrbitalPosition = (OrbitalPosition - m_sunPainDaHalfOrbitalCutoff) * 0.6666666667f + m_sunPainDaHalfOrbitalCutoff;
2417 }
2418
2419
2420
2406 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket)PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage); 2421 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket)PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage);
2407 viewertime.TimeInfo.SunDirection = Position; 2422 viewertime.TimeInfo.SunDirection = Position;
2408 viewertime.TimeInfo.SunAngVelocity = Velocity; 2423 viewertime.TimeInfo.SunAngVelocity = Velocity;
2409 viewertime.TimeInfo.UsecSinceStart = CurrentTime; 2424
2425 // Sun module used to add 6 hours to adjust for linden sun hour, adding here
2426 // to prevent existing code from breaking if it assumed that 6 hours were included.
2427 // 21600 == 6 hours * 60 minutes * 60 Seconds
2428 viewertime.TimeInfo.UsecSinceStart = CurrentTime + 21600;
2429
2410 viewertime.TimeInfo.SecPerDay = SecondsPerSunCycle; 2430 viewertime.TimeInfo.SecPerDay = SecondsPerSunCycle;
2411 viewertime.TimeInfo.SecPerYear = SecondsPerYear; 2431 viewertime.TimeInfo.SecPerYear = SecondsPerYear;
2412 viewertime.TimeInfo.SunPhase = OrbitalPosition; 2432 viewertime.TimeInfo.SunPhase = OrbitalPosition;