aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMagnuz Binder2015-05-04 10:51:04 +0200
committerMichael Cerquoni2015-05-04 12:44:58 -0400
commitc96ee68953eb31fc2ad6d1df9b7a4bb19c584e17 (patch)
treedb37109d4a9d73fc149825cee0b53200dbe71240 /OpenSim/Region/ScriptEngine
parentadd new config parameters for llCastRay to OpenSimDefaults.ini (diff)
downloadopensim-SC-c96ee68953eb31fc2ad6d1df9b7a4bb19c584e17.zip
opensim-SC-c96ee68953eb31fc2ad6d1df9b7a4bb19c584e17.tar.gz
opensim-SC-c96ee68953eb31fc2ad6d1df9b7a4bb19c584e17.tar.bz2
opensim-SC-c96ee68953eb31fc2ad6d1df9b7a4bb19c584e17.tar.xz
Patch llCastRay fully-simplified to V2.
Signed-off-by: Michael Cerquoni <nebadon2025@gmail.com>
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs29
1 files changed, 15 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index cf1bd2b..58b3930 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -221,6 +221,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
221 protected float m_primSafetyCoeffX = 2.414214f; 221 protected float m_primSafetyCoeffX = 2.414214f;
222 protected float m_primSafetyCoeffY = 2.414214f; 222 protected float m_primSafetyCoeffY = 2.414214f;
223 protected float m_primSafetyCoeffZ = 1.618034f; 223 protected float m_primSafetyCoeffZ = 1.618034f;
224 protected bool m_useCastRayV2 = false;
225 protected int RC_USE_V2 = 512;
224 protected float m_floatToleranceInCastRay = 0.000001f; 226 protected float m_floatToleranceInCastRay = 0.000001f;
225 protected float m_floatTolerance2InCastRay = 0.0001f; 227 protected float m_floatTolerance2InCastRay = 0.0001f;
226 protected int m_maxHitsInCastRay = 16; 228 protected int m_maxHitsInCastRay = 16;
@@ -229,7 +231,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
229 protected bool m_detectExitsInCastRay = false; 231 protected bool m_detectExitsInCastRay = false;
230 protected bool m_filterPartsInCastRay = false; 232 protected bool m_filterPartsInCastRay = false;
231 protected bool m_doAttachmentsInCastRay = false; 233 protected bool m_doAttachmentsInCastRay = false;
232 protected bool m_useCastRayV1 = true;
233 234
234 //An array of HTTP/1.1 headers that are not allowed to be used 235 //An array of HTTP/1.1 headers that are not allowed to be used
235 //as custom headers by llHTTPRequest. 236 //as custom headers by llHTTPRequest.
@@ -336,6 +337,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
336 m_primSafetyCoeffX = lslConfig.GetFloat("PrimBoundingBoxSafetyCoefficientX", m_primSafetyCoeffX); 337 m_primSafetyCoeffX = lslConfig.GetFloat("PrimBoundingBoxSafetyCoefficientX", m_primSafetyCoeffX);
337 m_primSafetyCoeffY = lslConfig.GetFloat("PrimBoundingBoxSafetyCoefficientY", m_primSafetyCoeffY); 338 m_primSafetyCoeffY = lslConfig.GetFloat("PrimBoundingBoxSafetyCoefficientY", m_primSafetyCoeffY);
338 m_primSafetyCoeffZ = lslConfig.GetFloat("PrimBoundingBoxSafetyCoefficientZ", m_primSafetyCoeffZ); 339 m_primSafetyCoeffZ = lslConfig.GetFloat("PrimBoundingBoxSafetyCoefficientZ", m_primSafetyCoeffZ);
340 m_useCastRayV2 = lslConfig.GetBoolean("UseLlCastRayV2", m_useCastRayV2);
341 RC_USE_V2 = lslConfig.GetInt("RC_USE_V2", RC_USE_V2);
339 m_floatToleranceInCastRay = lslConfig.GetFloat("FloatToleranceInLlCastRay", m_floatToleranceInCastRay); 342 m_floatToleranceInCastRay = lslConfig.GetFloat("FloatToleranceInLlCastRay", m_floatToleranceInCastRay);
340 m_floatTolerance2InCastRay = lslConfig.GetFloat("FloatTolerance2InLlCastRay", m_floatTolerance2InCastRay); 343 m_floatTolerance2InCastRay = lslConfig.GetFloat("FloatTolerance2InLlCastRay", m_floatTolerance2InCastRay);
341 m_maxHitsInCastRay = lslConfig.GetInt("MaxHitsInLlCastRay", m_maxHitsInCastRay); 344 m_maxHitsInCastRay = lslConfig.GetInt("MaxHitsInLlCastRay", m_maxHitsInCastRay);
@@ -344,7 +347,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
344 m_detectExitsInCastRay = lslConfig.GetBoolean("DetectExitHitsInLlCastRay", m_detectExitsInCastRay); 347 m_detectExitsInCastRay = lslConfig.GetBoolean("DetectExitHitsInLlCastRay", m_detectExitsInCastRay);
345 m_filterPartsInCastRay = lslConfig.GetBoolean("FilterPartsInLlCastRay", m_filterPartsInCastRay); 348 m_filterPartsInCastRay = lslConfig.GetBoolean("FilterPartsInLlCastRay", m_filterPartsInCastRay);
346 m_doAttachmentsInCastRay = lslConfig.GetBoolean("DoAttachmentsInLlCastRay", m_doAttachmentsInCastRay); 349 m_doAttachmentsInCastRay = lslConfig.GetBoolean("DoAttachmentsInLlCastRay", m_doAttachmentsInCastRay);
347 m_useCastRayV1 = lslConfig.GetBoolean("UseLlCastRayV1", m_useCastRayV1);
348 } 350 }
349 351
350 IConfig smtpConfig = seConfigSource.Configs["SMTP"]; 352 IConfig smtpConfig = seConfigSource.Configs["SMTP"];
@@ -13763,7 +13765,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13763 return contacts[0]; 13765 return contacts[0];
13764 } 13766 }
13765 13767
13766 public LSL_List llCastRayV1(LSL_Vector start, LSL_Vector end, LSL_List options) 13768 public LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options)
13767 { 13769 {
13768 LSL_List list = new LSL_List(); 13770 LSL_List list = new LSL_List();
13769 13771
@@ -13792,6 +13794,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13792 rejectTypes = options.GetLSLIntegerItem(i + 1); 13794 rejectTypes = options.GetLSLIntegerItem(i + 1);
13793 } 13795 }
13794 13796
13797 // Use llCastRay v2 if configured or requested
13798 if (m_useCastRayV2 || (dataFlags & RC_USE_V2) == RC_USE_V2)
13799 return llCastRayV2(start, end, options);
13800
13795 if (count > 16) 13801 if (count > 16)
13796 count = 16; 13802 count = 16;
13797 13803
@@ -13955,25 +13961,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13955 } 13961 }
13956 13962
13957 /// <summary> 13963 /// <summary>
13958 /// Full implementation of llCastRay similar to SL 2015-04-21. 13964 /// Implementation of llCastRay similar to SL 2015-04-21.
13959 /// http://wiki.secondlife.com/wiki/LlCastRay 13965 /// http://wiki.secondlife.com/wiki/LlCastRay
13960 /// Uses pure geometry, bounding shapes, meshing and no physics 13966 /// Uses pure geometry, bounding shapes, meshing and no physics
13961 /// for prims, sculpts, meshes, avatars and terrain. 13967 /// for prims, sculpts, meshes, avatars and terrain.
13962 /// Implements all flags, reject types and data flags. 13968 /// Implements all flags, reject types and data flags.
13963 /// Can handle both objects/groups and prims/parts, by config. 13969 /// Can handle both objects/groups and prims/parts, by config.
13964 /// May give poor results with multi-part meshes where "root"
13965 /// part doesn't dominate, owing to "guessed" bounding boxes.
13966 /// May sometimes be inaccurate owing to calculation precision 13970 /// May sometimes be inaccurate owing to calculation precision
13967 /// and a bug in libopenmetaverse PrimMesher. 13971 /// and a bug in libopenmetaverse PrimMesher.
13968 /// </summary> 13972 /// </summary>
13969 public LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options) 13973 public LSL_List llCastRayV2(LSL_Vector start, LSL_Vector end, LSL_List options)
13970 { 13974 {
13971 // Use llCastRay v1 if configured
13972 if (m_useCastRayV1)
13973 return llCastRayV1(start, end, options);
13974
13975 // Initialize 13975 // Initialize
13976 m_host.AddScriptLPS(1); 13976 // Keep AddScriptLPS commented while called from llCastRay
13977 // m_host.AddScriptLPS(1);
13977 List<RayHit> rayHits = new List<RayHit>(); 13978 List<RayHit> rayHits = new List<RayHit>();
13978 LSL_List result = new LSL_List(); 13979 LSL_List result = new LSL_List();
13979 float tol = m_floatToleranceInCastRay; 13980 float tol = m_floatToleranceInCastRay;
@@ -14009,10 +14010,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14009 Vector3 ray = end - start; 14010 Vector3 ray = end - start;
14010 float rayLength = ray.Length(); 14011 float rayLength = ray.Length();
14011 14012
14012 // Try to get a mesher and return failure if none or degenerate ray 14013 // Try to get a mesher and return failure if none, degenerate ray, or max 0 hits
14013 IRendering primMesher = null; 14014 IRendering primMesher = null;
14014 List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); 14015 List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory());
14015 if (renderers.Count < 1 || rayLength < tol) 14016 if (renderers.Count < 1 || rayLength < tol || m_maxHitsInCastRay < 1)
14016 { 14017 {
14017 result.Add(new LSL_Integer(ScriptBaseClass.RCERR_UNKNOWN)); 14018 result.Add(new LSL_Integer(ScriptBaseClass.RCERR_UNKNOWN));
14018 return result; 14019 return result;