From 6596a1de806d1ec509f3a570a0944ab9aff5947c Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 21 May 2013 22:16:18 -0700 Subject: Revert "BulletSim: add code to experimentally use asset hull data." This reverts commit 2fd8819a043269f9308cb46c71893e6eb35a426e. Remove this code until I can figure out why the references that are clearly in prebuild.xml doesn't work for the 'using OpenSim.Region.Physics.Meshing' in BSShape.cs. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 -- OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | 55 ++---------------------- 2 files changed, 4 insertions(+), 54 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 5cff668..9a9e527 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -90,7 +90,6 @@ public static class BSParam public static bool ShouldUseBulletHACD { get; set; } public static bool ShouldUseSingleConvexHullForPrims { get; set; } public static bool ShouldUseGImpactShapeForPrims { get; set; } - public static bool ShouldUseAssetHulls { get; set; } public static float TerrainImplementation { get; set; } public static int TerrainMeshMagnification { get; private set; } @@ -373,8 +372,6 @@ public static class BSParam true ), new ParameterDefn("ShouldUseGImpactShapeForPrims", "If true, use a GImpact shape for prims with cuts and twists", false ), - new ParameterDefn("UseAssetHulls", "If true, use hull if specified in the mesh asset info", - false ), new ParameterDefn("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", 5 ), diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index b7f7e6c..0152233 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs @@ -31,7 +31,6 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.Meshing; using OpenSim.Region.Physics.ConvexDecompositionDotNet; using OMV = OpenMetaverse; @@ -574,56 +573,9 @@ public class BSShapeHull : BSShape PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) { BulletShape newShape = new BulletShape(); - newShape.shapeKey = newHullKey; + IntPtr hullPtr = IntPtr.Zero; - // Pass true for physicalness as this prevents the creation of bounding box which is not needed - IMesh meshData = physicsScene.mesher.CreateMesh(prim.PhysObjectName, pbs, size, lod, true /* isPhysical */, false /* shouldCache */); - - // If there is hull data in the mesh asset, build the hull from that - if (meshData != null && BSParam.ShouldUseAssetHulls) - { - Meshmerizer realMesher = physicsScene.mesher as Meshmerizer; - if (realMesher != null) - { - List> allHulls = realMesher.GetConvexHulls(size); - if (allHulls != null) - { - int hullCount = allHulls.Count; - int totalVertices = 1; // include one for the count of the hulls - // Using the structure described for HACD hulls, create the memory sturcture - // to pass the hull data to the creater. - foreach (List hullVerts in allHulls) - { - totalVertices += 4; // add four for the vertex count and centroid - totalVertices += hullVerts.Count * 3; // one vertex is three dimensions - } - float[] convHulls = new float[totalVertices]; - - convHulls[0] = (float)hullCount; - int jj = 1; - foreach (List hullVerts in allHulls) - { - convHulls[jj + 0] = hullVerts.Count; - convHulls[jj + 1] = 0f; // centroid x,y,z - convHulls[jj + 2] = 0f; - convHulls[jj + 3] = 0f; - jj += 4; - foreach (OMV.Vector3 oneVert in hullVerts) - { - convHulls[jj + 0] = oneVert.X; - convHulls[jj + 1] = oneVert.Y; - convHulls[jj + 2] = oneVert.Z; - jj += 3; - } - } - - // create the hull data structure in Bullet - newShape = physicsScene.PE.CreateHullShape(physicsScene.World, hullCount, convHulls); - } - } - } - // If no hull specified in the asset and we should use Bullet's HACD approximation... - if (!newShape.HasPhysicalShape && BSParam.ShouldUseBulletHACD) + if (BSParam.ShouldUseBulletHACD) { // Build the hull shape from an existing mesh shape. // The mesh should have already been created in Bullet. @@ -652,10 +604,11 @@ public class BSShapeHull : BSShape } physicsScene.DetailLog("{0},BSShapeHull.CreatePhysicalHull,shouldUseBulletHACD,exit,hasBody={1}", prim.LocalID, newShape.HasPhysicalShape); } - // If no hull specified, use our HACD hull approximation. if (!newShape.HasPhysicalShape) { // Build a new hull in the physical world using the C# HACD algorigthm. + // Pass true for physicalness as this prevents the creation of bounding box which is not needed + IMesh meshData = physicsScene.mesher.CreateMesh(prim.PhysObjectName, pbs, size, lod, true /* isPhysical */, false /* shouldCache */); if (meshData != null) { if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched) -- cgit v1.1