public bool Run()
        {
            PhysicsShapeReference physicsShapeRef;

            DumpParams(m_Shape);
            ObjectPart.PrimitiveShape ps = new ObjectPart.PrimitiveShape
            {
                DecodedParams = m_Shape
            };
            m_Log.Info("---- Transformed to physics shape manager accepted format ----");
            m_Log.InfoFormat("PhysicsShapeType: {0}", m_PhysicsShapeType);
            DumpParams(ps.DecodedParams);
            if (!m_PhysicsShapeManager.TryGetConvexShape(m_PhysicsShapeType, ps, out physicsShapeRef))
            {
                m_Log.Error("Could not generate physics hull shape");
                return(false);
            }

            PhysicsConvexShape convexShape = physicsShapeRef;

            int hullidx = 0;

            foreach (PhysicsConvexShape.ConvexHull hull in convexShape.Hulls)
            {
                m_Log.InfoFormat("Hull {0}: Generated vertices: {1}", hullidx, hull.Vertices.Count);
                m_Log.InfoFormat("Hull {0}: Generated triangles: {1}", hullidx, hull.Triangles.Count / 3);
                ++hullidx;
            }
            m_Log.InfoFormat("Generated hulls: {0}", hullidx);

            /* write a blender .raw */
            ((PhysicsConvexShape)physicsShapeRef).DumpToBlenderRaw(m_OutputFileName);
            return(true);
        }
        public bool Run()
        {
            PhysicsShapeReference physicsShapeRef;
            bool success = true;

            foreach (PrimitiveShapeType shapeType in new PrimitiveShapeType[] { PrimitiveShapeType.Box, PrimitiveShapeType.Cylinder, PrimitiveShapeType.Prism, PrimitiveShapeType.Ring, PrimitiveShapeType.Sphere, PrimitiveShapeType.Torus, PrimitiveShapeType.Tube })
            {
                foreach (PrimitiveProfileShape profileShape in new PrimitiveProfileShape[] { PrimitiveProfileShape.Circle, PrimitiveProfileShape.EquilateralTriangle, PrimitiveProfileShape.HalfCircle, PrimitiveProfileShape.IsometricTriangle, PrimitiveProfileShape.RightTriangle, PrimitiveProfileShape.Square })
                {
                    foreach (PrimitiveProfileHollowShape hollowShape in new PrimitiveProfileHollowShape[] { PrimitiveProfileHollowShape.Circle, PrimitiveProfileHollowShape.Same, PrimitiveProfileHollowShape.Square, PrimitiveProfileHollowShape.Triangle })
                    {
                        foreach (PrimitivePhysicsShapeType physicsShapeType in new PrimitivePhysicsShapeType[] { PrimitivePhysicsShapeType.Convex, PrimitivePhysicsShapeType.Prim })
                        {
                            foreach (PrimitiveExtrusion pathCurve in new PrimitiveExtrusion[] { PrimitiveExtrusion.Curve1, PrimitiveExtrusion.Curve2, PrimitiveExtrusion.Default, PrimitiveExtrusion.Straight })
                            {
                                for (double pathbegin = 0; pathbegin < 1; pathbegin += 0.1)
                                {
                                    for (double pathend = 0; pathend < 1; pathend += 0.1)
                                    {
                                        for (double profilebegin = 0; profilebegin < 1; profilebegin += 0.1)
                                        {
                                            for (double profileend = 0; profileend < 1; profileend += 0.1)
                                            {
                                                for (double revolutions = 1; revolutions < 4; revolutions += 0.5)
                                                {
                                                    for (double twistbegin = -1; twistbegin < 1; twistbegin += 0.1)
                                                    {
                                                        for (double twistend = -1; twistend < 1; twistend += 0.1)
                                                        {
                                                            /*
                                                             * public double RadiusOffset;
                                                             */
                                                            for (double hollow = 0; hollow < 0.90; hollow += 0.1)
                                                            {
                                                                for (double skew = -0.9; skew < 0.9; skew += 0.1)
                                                                {
                                                                    for (double topshearx = -1; topshearx < 1; topshearx += 0.1)
                                                                    {
                                                                        for (double topsheary = -1; topsheary < 1; topsheary += 0.1)
                                                                        {
                                                                            for (double taperx = -1; taperx < 1; taperx += 0.1)
                                                                            {
                                                                                for (double tapery = -1; tapery < 1; tapery += 0.1)
                                                                                {
                                                                                    for (double pathscalex = 0; pathscalex < 1; pathscalex += 0.1)
                                                                                    {
                                                                                        for (double pathscaley = 0; pathscaley < 1; pathscaley += 0.1)
                                                                                        {
                                                                                            var shape = new ObjectPart.PrimitiveShape.Decoded();
                                                                                            shape.ProfileShape  = profileShape;
                                                                                            shape.ShapeType     = shapeType;
                                                                                            shape.HoleShape     = hollowShape;
                                                                                            shape.ProfileHollow = hollow;
                                                                                            shape.PathCurve     = pathCurve;
                                                                                            shape.Revolutions   = revolutions;
                                                                                            shape.PathBegin     = pathbegin;
                                                                                            shape.PathEnd       = pathend;
                                                                                            shape.TwistBegin    = twistbegin;
                                                                                            shape.TwistEnd      = twistend;
                                                                                            shape.ProfileBegin  = profilebegin;
                                                                                            shape.ProfileEnd    = profileend;
                                                                                            shape.TopShear.X    = topshearx;
                                                                                            shape.TopShear.Y    = topsheary;
                                                                                            shape.Taper.X       = taperx;
                                                                                            shape.Taper.Y       = tapery;
                                                                                            shape.PathScale.X   = pathscalex;
                                                                                            shape.PathScale.Y   = pathscaley;
                                                                                            shape.Skew          = skew;

                                                                                            var ps = new ObjectPart.PrimitiveShape
                                                                                            {
                                                                                                DecodedParams = shape
                                                                                            };

                                                                                            m_Log.Info("---- Transformed to physics shape manager accepted format ----");
                                                                                            m_Log.InfoFormat("PhysicsShapeType: {0}/{1}", physicsShapeType, shapeType);
                                                                                            m_Log.Info($"Serialized data {physicsShapeType.ToString()}/{ps.Serialization.ToHexString()}");
                                                                                            try
                                                                                            {
                                                                                                if (!m_PhysicsShapeManager.TryGetConvexShape(physicsShapeType, ps, out physicsShapeRef))
                                                                                                {
                                                                                                    DumpParams(shape);
                                                                                                    m_Log.Error("Could not generate physics hull shape");
                                                                                                    success = false;
                                                                                                    continue;
                                                                                                }
                                                                                            }
                                                                                            catch (Exception e)
                                                                                            {
                                                                                                DumpParams(shape);
                                                                                                m_Log.Error("Could not generate physics hull shape", e);
                                                                                                continue;
                                                                                            }

                                                                                            PhysicsConvexShape convexShape = physicsShapeRef;

                                                                                            int hullidx = 0;
                                                                                            foreach (PhysicsConvexShape.ConvexHull hull in convexShape.Hulls)
                                                                                            {
                                                                                                m_Log.InfoFormat("Hull {0}: Generated vertices: {1}", hullidx, hull.Vertices.Count);
                                                                                                m_Log.InfoFormat("Hull {0}: Generated triangles: {1}", hullidx, hull.Triangles.Count / 3);
                                                                                                ++hullidx;
                                                                                            }
                                                                                            m_Log.InfoFormat("Generated hulls: {0}", hullidx);
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                /* write a blender .raw */
                                //                ((PhysicsConvexShape)physicsShapeRef).DumpToBlenderRaw(m_OutputFileName);
                            }
                        }
                    }
                }
            }

            return(success);
        }