diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/PrimitiveBaseShape.cs | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 29985d2..a830551 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -328,6 +328,70 @@ namespace OpenSim.Framework | |||
328 | return shape; | 328 | return shape; |
329 | } | 329 | } |
330 | 330 | ||
331 | public static PrimitiveBaseShape CreateMesh(int numberOfFaces, UUID meshAssetID) | ||
332 | { | ||
333 | PrimitiveBaseShape shape = new PrimitiveBaseShape(); | ||
334 | |||
335 | shape._pathScaleX = 100; | ||
336 | shape._pathScaleY = 100; | ||
337 | |||
338 | if(numberOfFaces <= 0) // oops ? | ||
339 | numberOfFaces = 1; | ||
340 | |||
341 | switch(numberOfFaces) | ||
342 | { | ||
343 | case 1: // torus | ||
344 | shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; | ||
345 | shape.PathCurve = (byte)Extrusion.Curve1; | ||
346 | break; | ||
347 | |||
348 | case 2: // torus with hollow (a sl viewer whould see 4 faces on a hollow sphere) | ||
349 | shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; | ||
350 | shape.PathCurve = (byte)Extrusion.Curve1; | ||
351 | shape.ProfileHollow = 1; | ||
352 | break; | ||
353 | |||
354 | case 3: // cylinder | ||
355 | shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; | ||
356 | shape.PathCurve = (byte)Extrusion.Straight; | ||
357 | break; | ||
358 | |||
359 | case 4: // cylinder with hollow | ||
360 | shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; | ||
361 | shape.PathCurve = (byte)Extrusion.Straight; | ||
362 | shape.ProfileHollow = 1; | ||
363 | break; | ||
364 | |||
365 | case 5: // prism | ||
366 | shape.ProfileCurve = (byte)ProfileShape.EquilateralTriangle | (byte)HollowShape.Triangle; | ||
367 | shape.PathCurve = (byte)Extrusion.Straight; | ||
368 | break; | ||
369 | |||
370 | case 6: // box | ||
371 | shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle; | ||
372 | shape.PathCurve = (byte)Extrusion.Straight; | ||
373 | break; | ||
374 | |||
375 | case 7: // box with hollow | ||
376 | shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle; | ||
377 | shape.PathCurve = (byte)Extrusion.Straight; | ||
378 | shape.ProfileHollow = 1; | ||
379 | break; | ||
380 | |||
381 | default: // 8 faces box with cut | ||
382 | shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle; | ||
383 | shape.PathCurve = (byte)Extrusion.Straight; | ||
384 | shape.ProfileBegin = 1; | ||
385 | break; | ||
386 | } | ||
387 | |||
388 | shape.SculptEntry = true; | ||
389 | shape.SculptType = (byte)OpenMetaverse.SculptType.Mesh; | ||
390 | shape.SculptTexture = meshAssetID; | ||
391 | |||
392 | return shape; | ||
393 | } | ||
394 | |||
331 | public void SetScale(float side) | 395 | public void SetScale(float side) |
332 | { | 396 | { |
333 | _scale = new Vector3(side, side, side); | 397 | _scale = new Vector3(side, side, side); |