diff options
author | Justin Clarke Casey | 2008-04-23 10:16:26 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-04-23 10:16:26 +0000 |
commit | 6efb16689aa2ca364f738342a1173c27fef54b86 (patch) | |
tree | 04471707fbe7b7532981a2bf3be265d0fc1b21ba | |
parent | * Updated filesystem refs for bamboo.build (diff) | |
download | opensim-SC-6efb16689aa2ca364f738342a1173c27fef54b86.zip opensim-SC-6efb16689aa2ca364f738342a1173c27fef54b86.tar.gz opensim-SC-6efb16689aa2ca364f738342a1173c27fef54b86.tar.bz2 opensim-SC-6efb16689aa2ca364f738342a1173c27fef54b86.tar.xz |
From: Kurt Taylor <krtaylor@us.ibm.com>
Attached is a patch for adding the llGetSunDirection functionality. It was implemented by adding a parameter to estate settings for storing the sun position. The sun position is calculated and stored via the sun module everytime the client's sun position is updated. It was tested with several different srcipts on Linux and Windows
-rw-r--r-- | OpenSim/Framework/EstateSettings.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/SunModule.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 14 |
3 files changed, 27 insertions, 2 deletions
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 98052fc..efb55fe 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs | |||
@@ -159,6 +159,18 @@ namespace OpenSim.Framework | |||
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | private LLVector3 m_sunPosition; | ||
163 | |||
164 | public LLVector3 sunPosition | ||
165 | { | ||
166 | get { return m_sunPosition; } | ||
167 | set | ||
168 | { | ||
169 | //Just set - does not need to be written to settings file | ||
170 | m_sunPosition = value; | ||
171 | } | ||
172 | } | ||
173 | |||
162 | private float m_terrainRaiseLimit; | 174 | private float m_terrainRaiseLimit; |
163 | 175 | ||
164 | public float terrainRaiseLimit | 176 | public float terrainRaiseLimit |
diff --git a/OpenSim/Region/Environment/Modules/SunModule.cs b/OpenSim/Region/Environment/Modules/SunModule.cs index 37519ed..e6801e8 100644 --- a/OpenSim/Region/Environment/Modules/SunModule.cs +++ b/OpenSim/Region/Environment/Modules/SunModule.cs | |||
@@ -108,6 +108,9 @@ namespace OpenSim.Region.Environment.Modules | |||
108 | { | 108 | { |
109 | avatar.ControllingClient.SendSunPos(SunPos(HourOfTheDay()), new LLVector3(0, 0.0f, 10.0f)); | 109 | avatar.ControllingClient.SendSunPos(SunPos(HourOfTheDay()), new LLVector3(0, 0.0f, 10.0f)); |
110 | } | 110 | } |
111 | // set estate settings for region access to sun position | ||
112 | m_scene.RegionInfo.EstateSettings.sunPosition = SunPos(HourOfTheDay()); | ||
113 | |||
111 | m_frame = 0; | 114 | m_frame = 0; |
112 | } | 115 | } |
113 | 116 | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 41c3956..f4a3bd3 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -2444,8 +2444,18 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2444 | public LSL_Types.Vector3 llGetSunDirection() | 2444 | public LSL_Types.Vector3 llGetSunDirection() |
2445 | { | 2445 | { |
2446 | m_host.AddScriptLPS(1); | 2446 | m_host.AddScriptLPS(1); |
2447 | NotImplemented("llGetSunDirection"); | 2447 | |
2448 | return new LSL_Types.Vector3(); | 2448 | LSL_Types.Vector3 SunDoubleVector3; |
2449 | LLVector3 SunFloatVector3; | ||
2450 | |||
2451 | // sunPosition estate setting is set in OpenSim.Region.Environment.Modules.SunModule | ||
2452 | // have to convert from LLVector3 (float) to LSL_Types.Vector3 (double) | ||
2453 | SunFloatVector3 = World.RegionInfo.EstateSettings.sunPosition; | ||
2454 | SunDoubleVector3.x = (double)SunFloatVector3.X; | ||
2455 | SunDoubleVector3.y = (double)SunFloatVector3.Y; | ||
2456 | SunDoubleVector3.z = (double)SunFloatVector3.Z; | ||
2457 | |||
2458 | return SunDoubleVector3; | ||
2449 | } | 2459 | } |
2450 | 2460 | ||
2451 | public LSL_Types.Vector3 llGetTextureOffset(int face) | 2461 | public LSL_Types.Vector3 llGetTextureOffset(int face) |