aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-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;