mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 19:36:07 +08:00
replace sun module
This commit is contained in:
@@ -1295,8 +1295,9 @@ namespace OpenSim.Framework
|
||||
/// <param name="SecondsPerSunCycle"></param>
|
||||
/// <param name="SecondsPerYear"></param>
|
||||
/// <param name="OrbitalPosition">The orbital position is given in radians, and must be "adjusted" for the linden client, see LLClientView</param>
|
||||
void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear,
|
||||
float OrbitalPosition);
|
||||
//void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear,
|
||||
// float OrbitalPosition);
|
||||
void SendSunPos(Vector3 sunPos, Vector3 sunVel, float sunAngle);
|
||||
|
||||
void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks);
|
||||
void SendViewerTime(int phase);
|
||||
|
||||
@@ -1058,7 +1058,14 @@ namespace OpenSim.Framework
|
||||
|
||||
public static int UnixTimeSinceEpoch()
|
||||
{
|
||||
return ToUnixTime(DateTime.UtcNow);
|
||||
TimeSpan t = DateTime.UtcNow - UnixEpoch;
|
||||
return (int)t.TotalSeconds;
|
||||
}
|
||||
|
||||
public static ulong UnixTimeSinceEpoch_uS()
|
||||
{
|
||||
TimeSpan t = DateTime.UtcNow - UnixEpoch;
|
||||
return (uint)(t.TotalMilliseconds * 1000);
|
||||
}
|
||||
|
||||
public static int ToUnixTime(DateTime stamp)
|
||||
|
||||
@@ -1229,5 +1229,61 @@ namespace OpenSim.Framework
|
||||
top["success"] = true;
|
||||
return top;
|
||||
}
|
||||
|
||||
public bool getPositions(float altitude, float dayfrac, out Vector3 sundir, out Vector3 moondir, out Vector3 sunvel,
|
||||
out Quaternion sunrot, out Quaternion moonrot)
|
||||
{
|
||||
sundir = Vector3.Zero;
|
||||
moondir = Vector3.Zero;
|
||||
sunvel = Vector3.Zero;
|
||||
sunrot = Quaternion.Identity;
|
||||
moonrot = Quaternion.Identity;
|
||||
|
||||
List<DayCycle.TrackEntry> track = null;
|
||||
if(altitude < Altitudes[0])
|
||||
track = Cycle.skyTrack0;
|
||||
else
|
||||
{
|
||||
int altindx = 2;
|
||||
for(;altindx > 0; --altindx)
|
||||
{
|
||||
if(Altitudes[altindx] < altitude)
|
||||
break;
|
||||
}
|
||||
|
||||
while(altindx >= 0)
|
||||
{
|
||||
switch(altindx)
|
||||
{
|
||||
case 2:
|
||||
track = Cycle.skyTrack3;
|
||||
break;
|
||||
case 1:
|
||||
track = Cycle.skyTrack2;
|
||||
break;
|
||||
case 0:
|
||||
track = Cycle.skyTrack1;
|
||||
break;
|
||||
}
|
||||
if(track != null)
|
||||
break;
|
||||
--altindx;
|
||||
}
|
||||
}
|
||||
|
||||
if(track == null || track.Count == 0)
|
||||
return false;
|
||||
|
||||
if(track.Count == 1)
|
||||
{
|
||||
if(!Cycle.skyframes.TryGetValue(track[0].frameName, out SkyData sky) || sky == null)
|
||||
return false;
|
||||
moonrot = sky.moon_rotation;
|
||||
moondir = Xrot(moonrot);
|
||||
sunrot = sky.sun_rotation;
|
||||
sundir = Xrot(sunrot);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user