aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2008-08-23 16:15:17 +0000
committerMelanie Thielker2008-08-23 16:15:17 +0000
commitd2d9808742c0ffe47fb7aa6464faf1b2dfb216bf (patch)
tree26d20bc3072e560563a773351513d20a569e622e
parentmore work on new meshing routines... (diff)
downloadopensim-SC-d2d9808742c0ffe47fb7aa6464faf1b2dfb216bf.zip
opensim-SC-d2d9808742c0ffe47fb7aa6464faf1b2dfb216bf.tar.gz
opensim-SC-d2d9808742c0ffe47fb7aa6464faf1b2dfb216bf.tar.bz2
opensim-SC-d2d9808742c0ffe47fb7aa6464faf1b2dfb216bf.tar.xz
Thank you, salahzar, for a patch that adds llGetNumberOfSides and will
also enable LSLconformance on some texture functions as well. Applied the part of the patch in Shared/. The part for Common/ needs to be reworked to remove the reference into Shared/
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs107
2 files changed, 106 insertions, 3 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index 6946561..18ddd9e 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -631,7 +631,7 @@ namespace OpenSim.Framework.Communications.Capabilities
631 } 631 }
632 } 632 }
633 633
634 //Console.WriteLine("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type); 634 //System.Console.WriteLine("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type);
635 635
636 string assetName = llsdRequest.name; 636 string assetName = llsdRequest.name;
637 string assetDes = llsdRequest.description; 637 string assetDes = llsdRequest.description;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 2428bc4..c461d3d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3330,11 +3330,114 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3330 3330
3331 } 3331 }
3332 3332
3333 // this function to understand which shape it is (taken from meshmerizer)
3334 // quite useful can be used by meshmerizer to have a centralized point of understanding the shape
3335 // except that it refers to scripting constants
3336 private int getScriptPrimType(PrimitiveBaseShape primShape)
3337 {
3338
3339 if (primShape.SculptEntry && primShape.SculptType != (byte)0 && primShape.SculptData.Length > 0)
3340 return ScriptBaseClass.PRIM_TYPE_SCULPT;
3341 if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
3342 {
3343 if (primShape.PathCurve == (byte)Extrusion.Straight)
3344 return ScriptBaseClass.PRIM_TYPE_BOX;
3345 else if (primShape.PathCurve == (byte)Extrusion.Curve1)
3346 return ScriptBaseClass.PRIM_TYPE_TUBE;
3347 }
3348 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle)
3349 {
3350 if (primShape.PathCurve == (byte)Extrusion.Straight)
3351 return ScriptBaseClass.PRIM_TYPE_CYLINDER;
3352 // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits
3353 else if (primShape.PathCurve == (byte)Extrusion.Curve1)
3354 return ScriptBaseClass.PRIM_TYPE_TORUS;
3355 }
3356 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle)
3357 {
3358 if (primShape.PathCurve == (byte)Extrusion.Curve1 || primShape.PathCurve == (byte)Extrusion.Curve2)
3359 return ScriptBaseClass.PRIM_TYPE_SPHERE;
3360 }
3361 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle)
3362 {
3363 if (primShape.PathCurve == (byte)Extrusion.Straight)
3364 return ScriptBaseClass.PRIM_TYPE_PRISM;
3365 else if (primShape.PathCurve == (byte)Extrusion.Curve1)
3366 return ScriptBaseClass.PRIM_TYPE_RING;
3367 }
3368 return ScriptBaseClass.PRIM_TYPE_BOX;
3369
3370
3371 }
3372 // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces
3373 private void hasCutHollowDimpleProfileCut(PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow,
3374 out bool hasDimple, out bool hasProfileCut)
3375 {
3376 hasCut = (shape.PathBegin > 0) || (shape.PathEnd < 1);
3377 hasHollow = shape.ProfileHollow > 0;
3378 hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd < 1); // taken from llSetPrimitiveParms
3379 hasProfileCut = hasDimple; // is it the same thing?
3380
3381 }
3382
3333 public LSL_Types.LSLInteger llGetNumberOfSides() 3383 public LSL_Types.LSLInteger llGetNumberOfSides()
3334 { 3384 {
3335 m_host.AddScriptLPS(1); 3385 m_host.AddScriptLPS(1);
3336 NotImplemented("llGetNumberOfSides"); 3386 int ret = 0;
3337 return 0; 3387 bool hasCut;
3388 bool hasHollow;
3389 bool hasDimple;
3390 bool hasProfileCut;
3391
3392 hasCutHollowDimpleProfileCut(m_host.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
3393
3394 switch (getScriptPrimType(m_host.Shape))
3395 {
3396 case ScriptBaseClass.PRIM_TYPE_BOX:
3397 ret = 6;
3398 if (hasCut) ret += 2;
3399 if (hasHollow) ret += 1;
3400 break;
3401 case ScriptBaseClass.PRIM_TYPE_CYLINDER:
3402 ret = 3;
3403 if (hasCut) ret += 2;
3404 if (hasHollow) ret += 1;
3405 break;
3406 case ScriptBaseClass.PRIM_TYPE_PRISM:
3407 ret = 5;
3408 if (hasCut) ret += 2;
3409 if (hasHollow) ret += 1;
3410 break;
3411 case ScriptBaseClass.PRIM_TYPE_SPHERE:
3412 ret = 1;
3413 if (hasCut) ret += 2;
3414 if (hasDimple) ret += 2;
3415 if (hasHollow) ret += 1; // actually lsl adds 4!!!!!! is that a great mistake?
3416 break;
3417 case ScriptBaseClass.PRIM_TYPE_TORUS:
3418 ret = 1;
3419 if (hasCut) ret += 2;
3420 if (hasProfileCut) ret += 2;
3421 if (hasHollow) ret += 1;
3422 break;
3423 case ScriptBaseClass.PRIM_TYPE_TUBE:
3424 ret = 4;
3425 if (hasCut) ret += 2;
3426 if (hasProfileCut) ret += 2;
3427 if (hasHollow) ret += 1;
3428 break;
3429 case ScriptBaseClass.PRIM_TYPE_RING:
3430 ret = 3;
3431 if (hasCut) ret += 2;
3432 if (hasProfileCut) ret += 2;
3433 if (hasHollow) ret += 1;
3434 break;
3435 case ScriptBaseClass.PRIM_TYPE_SCULPT:
3436 ret = 1;
3437 break;
3438 }
3439
3440 return ret;
3338 } 3441 }
3339 3442
3340 3443