aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs29
-rw-r--r--bin/OpenSimDefaults.ini16
2 files changed, 23 insertions, 22 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;
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 275c207..4e1b7ca 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -1397,11 +1397,6 @@
1397 ; Maximum number of external urls that scripts can set up in this simulator (e.g. via llRequestURL()) 1397 ; Maximum number of external urls that scripts can set up in this simulator (e.g. via llRequestURL())
1398 max_external_urls_per_simulator = 100 1398 max_external_urls_per_simulator = 100
1399 1399
1400 ; Use version 1 of llCastRay as default if true. If set to false, the new
1401 ; version of llCastRay will be used. This gives better accuracy but
1402 ; uses more CPU and may may be slow on some servers
1403 UseLlCastRayV1 = true
1404
1405 ; Use size boxes instead of meshed prims, sculpts and mesh when calculating bounding boxes. 1400 ; Use size boxes instead of meshed prims, sculpts and mesh when calculating bounding boxes.
1406 ; Speeds up calculations but can make them inaccurate, in some cases very inaccurate. 1401 ; Speeds up calculations but can make them inaccurate, in some cases very inaccurate.
1407 UseSimpleBoxesInGetBoundingBox = false 1402 UseSimpleBoxesInGetBoundingBox = false
@@ -1494,6 +1489,14 @@
1494 ; Worst case is twisted tube, 0.5+sqrt(1.25) 1489 ; Worst case is twisted tube, 0.5+sqrt(1.25)
1495 PrimBoundingBoxSafetyCoefficientZ = 1.618034 1490 PrimBoundingBoxSafetyCoefficientZ = 1.618034
1496 1491
1492 ; Use new version 2 of llCastRay as default if true
1493 ; This gives better accuracy and speed on some servers, but may be slower on other servers
1494 UseLlCastRayV2 = false
1495
1496 ; Irregular bit flag to use after RC_DATA_FLAGS in calls to llCastRay to use version 2
1497 ; Bit flags RC_GET_NORMAL = 1, RC_GET_ROOT_KEY = 2 and RC_GET_LINK_NUM = 4 are already in regular use
1498 RC_USE_V2 = 512
1499
1497 ; Accepted calculation precision error in calculations in llCastRay 1500 ; Accepted calculation precision error in calculations in llCastRay
1498 FloatToleranceInLlCastRay = 0.000001 1501 FloatToleranceInLlCastRay = 0.000001
1499 1502
@@ -1518,9 +1521,6 @@
1518 ; Detect attachments in llCastRay if true 1521 ; Detect attachments in llCastRay if true
1519 DoAttachmentsInLlCastRay = false 1522 DoAttachmentsInLlCastRay = false
1520 1523
1521 ; Use legacy version 1 of llCastRay if true
1522 UseLlCastRayV1 = true
1523
1524[DataSnapshot] 1524[DataSnapshot]
1525 ; The following set of configs pertains to search. 1525 ; The following set of configs pertains to search.
1526 ; Set index_sims to true to enable search engines to index your searchable data 1526 ; Set index_sims to true to enable search engines to index your searchable data