public Mesh PrimitiveToMesh(Primitive primitive, Vector3 Scale, Quaternion rot) { bool wasSculpt = primitive.Sculpt != null; if (wasSculpt && WorldPathSystem.SculptCollisions) { Primitive.SculptData SD = primitive.Sculpt; UUID Id = SD.SculptTexture; SculptMesh SM; if (!SculptedMeshes.TryGetValue(Id, out SM)) { byte[] bytes = WorldObjects.GridMaster.TextureBytesForUUID(SD.SculptTexture); SM = ToSculptMesh(bytes, primitive.Sculpt, "" + primitive); if (MaintainSculptPool) { SculptedMeshes[Id] = SM; } // SM.DumpRaw(".", primitive.ID.ToString(), "sculptMesh" + primitive.LocalID); } if (SM != null) { SM = SM.Copy(); SM.Scale(Scale.X, Scale.Y, Scale.Z); SM.AddRot(QuaternionToQuat(rot)); return(ToMesh( #if COLLIDER_ODE PrimToBaseShape(primitive), #endif SM.coords, SM.faces, SM.viewerFaces, primitive.Type == PrimType.Sphere)); } } this.scaleSize = Scale.X + Scale.Y + Scale.Z; bool UseExtremeDetail = scaleSize > UseExtremeDetailSize; //LevelOfDetail detail; if (scaleSize < UseLowDetailSize) { detail = LevelOfDetail.Low; } else { detail = LevelOfDetail.Medium; } if (UseExtremeDetail) { if (primitive.Type == PrimType.Box) { detail = LevelOfDetail.Medium; } else { detail = LevelOfDetail.High; } } PrimMesh primMesh = ConstructionDataToPrimMesh(primitive.PrimData, detail, UseExtremeDetail ? 2 : 1); primMesh.Scale(Scale.X, Scale.Y, Scale.Z); primMesh.AddRot(QuaternionToQuat(rot)); Mesh m = PrimMeshToMesh(primMesh); #if COLLIDER_ODE m.PBS = PrimToBaseShape(primitive); #endif return(m); }