diff options
author | Melanie | 2010-11-27 01:08:12 +0000 |
---|---|---|
committer | Melanie | 2010-11-27 01:08:12 +0000 |
commit | e05f728b084d66de964b8d7fa0a9318b94526c4e (patch) | |
tree | 43feb59eae181a09e3a35c4f6a961e3cd8ad2352 /OpenSim/Region/ScriptEngine/Shared | |
parent | Convert the scope id in the im session id to a URL variable. Fixes offline (diff) | |
parent | llVecNorm nant test (diff) | |
download | opensim-SC-e05f728b084d66de964b8d7fa0a9318b94526c4e.zip opensim-SC-e05f728b084d66de964b8d7fa0a9318b94526c4e.tar.gz opensim-SC-e05f728b084d66de964b8d7fa0a9318b94526c4e.tar.bz2 opensim-SC-e05f728b084d66de964b8d7fa0a9318b94526c4e.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 24 |
2 files changed, 34 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 5288cd3..9548253 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -391,19 +391,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
391 | } | 391 | } |
392 | else if (m_stateSource == StateSource.RegionStart) | 392 | else if (m_stateSource == StateSource.RegionStart) |
393 | { | 393 | { |
394 | // m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); | 394 | //m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); |
395 | PostEvent(new EventParams("changed", | 395 | PostEvent(new EventParams("changed", |
396 | new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, | 396 | new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, new DetectParams[0])); |
397 | new DetectParams[0])); | ||
398 | } | 397 | } |
399 | else if (m_stateSource == StateSource.PrimCrossing) | 398 | else if (m_stateSource == StateSource.PrimCrossing || m_stateSource == StateSource.Teleporting) |
400 | { | 399 | { |
401 | // CHANGED_REGION | 400 | // CHANGED_REGION |
402 | PostEvent(new EventParams("changed", | 401 | PostEvent(new EventParams("changed", |
403 | new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, | 402 | new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, new DetectParams[0])); |
404 | new DetectParams[0])); | 403 | |
404 | // CHANGED_TELEPORT | ||
405 | if (m_stateSource == StateSource.Teleporting) | ||
406 | PostEvent(new EventParams("changed", | ||
407 | new Object[] { new LSL_Types.LSLInteger((int)Changed.TELEPORT) }, new DetectParams[0])); | ||
405 | } | 408 | } |
406 | } | 409 | } |
407 | else | 410 | else |
408 | { | 411 | { |
409 | Start(); | 412 | Start(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index dfc9aa3..1d55b95 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -47,6 +47,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
47 | { | 47 | { |
48 | 48 | ||
49 | private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; | 49 | private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; |
50 | private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; | ||
50 | private LSL_Api m_lslApi; | 51 | private LSL_Api m_lslApi; |
51 | 52 | ||
52 | [SetUp] | 53 | [SetUp] |
@@ -164,5 +165,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
164 | Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail"); | 165 | Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail"); |
165 | Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail"); | 166 | Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail"); |
166 | } | 167 | } |
168 | |||
169 | [Test] | ||
170 | // llVecNorm test. | ||
171 | public void TestllVecNorm() | ||
172 | { | ||
173 | // Check special case for normalizing zero vector. | ||
174 | CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); | ||
175 | // Check various vectors. | ||
176 | CheckllVecNorm(new LSL_Types.Vector3(10.0d, 25.0d, 0.0d), new LSL_Types.Vector3(0.371391d, 0.928477d, 0.0d)); | ||
177 | CheckllVecNorm(new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), new LSL_Types.Vector3(1.0d, 0.0d, 0.0d)); | ||
178 | CheckllVecNorm(new LSL_Types.Vector3(-90.0d, 55.0d, 2.0d), new LSL_Types.Vector3(-0.853128d, 0.521356d, 0.018958d)); | ||
179 | CheckllVecNorm(new LSL_Types.Vector3(255.0d, 255.0d, 255.0d), new LSL_Types.Vector3(0.577350d, 0.577350d, 0.577350d)); | ||
180 | } | ||
181 | |||
182 | public void CheckllVecNorm(LSL_Types.Vector3 vec, LSL_Types.Vector3 vecNormCheck) | ||
183 | { | ||
184 | // Call LSL function to normalize the vector. | ||
185 | LSL_Types.Vector3 vecNorm = m_lslApi.llVecNorm(vec); | ||
186 | // Check each vector component against expected result. | ||
187 | Assert.AreEqual(vecNorm.x, vecNormCheck.x, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on x component"); | ||
188 | Assert.AreEqual(vecNorm.y, vecNormCheck.y, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on y component"); | ||
189 | Assert.AreEqual(vecNorm.z, vecNormCheck.z, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on z component"); | ||
190 | } | ||
167 | } | 191 | } |
168 | } | 192 | } |