aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common
diff options
context:
space:
mode:
authorMelanie Thielker2008-08-25 11:58:55 +0000
committerMelanie Thielker2008-08-25 11:58:55 +0000
commitcf7020d73c238312e0d640fdf5fe795862f030f3 (patch)
treee37cb3c998aa84660314507d60bbeef9c460101d /OpenSim/Region/ScriptEngine/Common
parent* Fix to OGP Region to Region teleports. Yay. (diff)
downloadopensim-SC-cf7020d73c238312e0d640fdf5fe795862f030f3.zip
opensim-SC-cf7020d73c238312e0d640fdf5fe795862f030f3.tar.gz
opensim-SC-cf7020d73c238312e0d640fdf5fe795862f030f3.tar.bz2
opensim-SC-cf7020d73c238312e0d640fdf5fe795862f030f3.tar.xz
Mantis #2044
Thank you, salahzar, for a patch that corrects the behavior of PRIM_TYPE in llGetPrimitiveParams() and improves LSL conformance in llGetNumberOfSides();
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs107
1 files changed, 95 insertions, 12 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 103ffff..786288b 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -3461,13 +3461,22 @@ namespace OpenSim.Region.ScriptEngine.Common
3461 3461
3462 } 3462 }
3463 // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces 3463 // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces
3464 private void hasCutHollowDimpleProfileCut(PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, 3464 private void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow,
3465 out bool hasDimple, out bool hasProfileCut) 3465 out bool hasDimple, out bool hasProfileCut)
3466 { 3466 {
3467 hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); 3467 if (primType == BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX
3468 ||
3469 primType == BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER
3470 ||
3471 primType == BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM)
3472
3473 hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0);
3474 else
3475 hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0);
3476
3468 hasHollow = shape.ProfileHollow > 0; 3477 hasHollow = shape.ProfileHollow > 0;
3469 hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms 3478 hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms
3470 hasProfileCut = (shape.PathBegin > 0) || (shape.PathEnd > 0); // is it the same thing? 3479 hasProfileCut = hasDimple; // is it the same thing?
3471 3480
3472 } 3481 }
3473 3482
@@ -3480,9 +3489,10 @@ namespace OpenSim.Region.ScriptEngine.Common
3480 bool hasDimple; 3489 bool hasDimple;
3481 bool hasProfileCut; 3490 bool hasProfileCut;
3482 3491
3483 hasCutHollowDimpleProfileCut(m_host.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); 3492 int primType = getScriptPrimType(m_host.Shape);
3493 hasCutHollowDimpleProfileCut(primType, m_host.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
3484 3494
3485 switch (getScriptPrimType(m_host.Shape)) 3495 switch (primType)
3486 { 3496 {
3487 case BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX: 3497 case BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX:
3488 ret = 6; 3498 ret = 6;
@@ -3501,9 +3511,9 @@ namespace OpenSim.Region.ScriptEngine.Common
3501 break; 3511 break;
3502 case BuiltIn_Commands_BaseClass.PRIM_TYPE_SPHERE: 3512 case BuiltIn_Commands_BaseClass.PRIM_TYPE_SPHERE:
3503 ret = 1; 3513 ret = 1;
3504 if (hasProfileCut) ret += 2; 3514 if (hasCut) ret += 2;
3505 if (hasDimple) ret += 2; 3515 if (hasDimple) ret += 2;
3506 if (hasHollow) ret += 1; // actually lsl adds 4!!!!!! is that a great mistake? 3516 if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1)
3507 break; 3517 break;
3508 case BuiltIn_Commands_BaseClass.PRIM_TYPE_TORUS: 3518 case BuiltIn_Commands_BaseClass.PRIM_TYPE_TORUS:
3509 ret = 1; 3519 ret = 1;
@@ -3531,7 +3541,6 @@ namespace OpenSim.Region.ScriptEngine.Common
3531 return ret; 3541 return ret;
3532 } 3542 }
3533 3543
3534
3535 /* The new / changed functions were tested with the following LSL script: 3544 /* The new / changed functions were tested with the following LSL script:
3536 3545
3537 default 3546 default
@@ -6267,15 +6276,89 @@ namespace OpenSim.Region.ScriptEngine.Common
6267 break; 6276 break;
6268 6277
6269 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE: 6278 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE:
6270 // TODO-------------- 6279
6271 res.Add(new LSL_Types.LSLInteger(0)); 6280 // implementing box
6281 PrimitiveBaseShape Shape=m_host.Shape;
6282 int primType=getScriptPrimType(m_host.Shape);
6283 res.Add(new LSL_Types.LSLInteger(primType));
6284 switch(primType)
6285 {
6286 case BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX:
6287 case BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER:
6288 case BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM:
6289
6290 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve));
6291 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
6292 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0));
6293 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0,Shape.PathTwist / 100.0,0));
6294 res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0-1), 1 - (Shape.PathScaleY / 100.0-1), 0));
6295 res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0));
6296 break;
6297
6298 case BuiltIn_Commands_BaseClass.PRIM_TYPE_SPHERE:
6299 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve));
6300 res.Add(new LSL_Types.Vector3(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
6301 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0));
6302 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
6303 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
6304
6305 break;
6306
6307
6308
6309 case BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT:
6310 res.Add(Shape.SculptTexture.ToString());
6311 res.Add(new LSL_Types.LSLInteger(Shape.SculptType));
6312
6313 break;
6314 case BuiltIn_Commands_BaseClass.PRIM_TYPE_RING:
6315 case BuiltIn_Commands_BaseClass.PRIM_TYPE_TUBE:
6316 case BuiltIn_Commands_BaseClass.PRIM_TYPE_TORUS:
6317 // holeshape
6318 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve));
6319
6320 // cut
6321 res.Add(new LSL_Types.Vector3(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
6322
6323 // hollow
6324 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0));
6325
6326 // twist
6327 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
6328
6329 // vector holesize
6330 res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
6331
6332 // vector topshear
6333 res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0));
6334
6335 // vector profilecut
6336 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin/ 50000.0, 1 - Shape.ProfileEnd / 50000.0,0));
6337
6338
6339 // vector tapera
6340 res.Add(new LSL_Types.Vector3(Shape.PathTaperX / 100.0,Shape.PathTaperY / 100.0,0));
6341
6342 // float revolutions,
6343 res.Add(new LSL_Types.LSLFloat(Shape.PathRevolutions/50.0)); // needs fixing :(
6344
6345 // float radiusoffset,
6346 res.Add(new LSL_Types.LSLFloat(Shape.PathRadiusOffset/100.0));
6347
6348 // float skew
6349 res.Add(new LSL_Types.LSLFloat(Shape.PathSkew/100.0));
6350 break;
6351
6352
6353
6354 }
6272 break; 6355 break;
6273 6356
6274 case (int)BuiltIn_Commands_BaseClass.PRIM_TEXTURE: 6357 case (int)BuiltIn_Commands_BaseClass.PRIM_TEXTURE:
6275 if (remain < 1) 6358 if (remain < 1)
6276 return res; 6359 return res;
6277 6360
6278 int face=Convert.ToInt32(rules.Data[idx++]); 6361 int face=Convert.ToInt32(""+rules.Data[idx++]);
6279 if (face == -1) 6362 if (face == -1)
6280 face = 0; 6363 face = 0;
6281 6364
@@ -6296,7 +6379,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6296 if (remain < 1) 6379 if (remain < 1)
6297 return res; 6380 return res;
6298 6381
6299 face=Convert.ToInt32(rules.Data[idx++]); 6382 face=Convert.ToInt32(""+rules.Data[idx++]);
6300 6383
6301 tex = m_host.Shape.Textures; 6384 tex = m_host.Shape.Textures;
6302 LLColor texcolor; 6385 LLColor texcolor;