From 65eb1852a3a9cf8d71a11ab8fdb30edb42888a59 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 7 Nov 2007 20:29:30 +0000 Subject: add SendSunPos function to IClientAPI to let us pull all the sun calculation logic into a module --- OpenSim/Framework/IClientAPI.cs | 1 + OpenSim/Region/ClientStack/ClientView.API.cs | 16 ++++++++++++++-- OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 4 ++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index c18216e..11e6ae7 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -427,6 +427,7 @@ namespace OpenSim.Framework void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); bool AddMoney(int debit); + void SendSunPos(LLVector3 sunPos, LLVector3 sunVel); void SendViewerTime(int phase); void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 1ffcd5e..bbe07d2 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -766,8 +766,18 @@ namespace OpenSim.Region.ClientStack OutPacket(sound); } + public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel) + { + SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); + viewertime.TimeInfo.SunDirection = sunPos; + viewertime.TimeInfo.SunAngVelocity = sunVel; + viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch(); + OutPacket(viewertime); + } + public void SendViewerTime(int phase) { + Console.WriteLine("SunPhase: {0}", phase); SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); //viewertime.TimeInfo.SecPerDay = 86400; // viewertime.TimeInfo.SecPerYear = 31536000; @@ -778,7 +788,7 @@ namespace OpenSim.Region.ClientStack if ((sunPhase < 6) || (sunPhase > 36)) { viewertime.TimeInfo.SunDirection = new LLVector3(0f, 0.8f, -0.8f); - //Console.WriteLine("sending night"); + Console.WriteLine("sending night"); } else { @@ -787,7 +797,9 @@ namespace OpenSim.Region.ClientStack sunPhase = 12; } sunPhase = sunPhase - 12; + float yValue = 0.1f*(sunPhase); + Console.WriteLine("Computed SunPhase: {0}, yValue: {1}", sunPhase, yValue); if (yValue > 1.2f) { yValue = yValue - 1.2f; @@ -809,7 +821,7 @@ namespace OpenSim.Region.ClientStack yValue *= -1; } viewertime.TimeInfo.SunDirection = new LLVector3(0f, yValue, 0.3f); - //Console.WriteLine("sending sun update " + yValue); + Console.WriteLine("sending sun update " + yValue); } viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f); viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch(); diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 69584f4..1a7901e 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -400,6 +400,10 @@ namespace SimpleApp return false; } + public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel) + { + } + public void SendViewerTime(int phase) { } -- cgit v1.1