Esempio n. 1
0
        public void EndDraw()
        {
            if (preview.Curve.ArcLength > 2 * Radius)
            {
                // store undo/redo record for new primitive
                PolyTubeSO tubeSO = preview.BuildSO(scene.DefaultSOMaterial, 1.0f);
                scene.History.PushChange(
                    new AddSOChange()
                {
                    scene = scene, so = tubeSO, bKeepWorldPosition = false
                });
                scene.History.PushInteractionCheckpoint();
            }

            preview.Destroy();
            preview = null;

            SavedSettings.Save("DrawTubeTool_radius", radius);
        }
Esempio n. 2
0
        public PolyTubeSO BuildSO(SOMaterial material, float scale = 1.0f)
        {
            Vector3d vCenter = curve.GetBoundingBox().Center;
            DCurve3  shifted = new DCurve3(curve);

            for (int i = 0; i < shifted.VertexCount; ++i)
            {
                shifted[i] -= vCenter;
            }
            Frame3f shiftedFrame = new Frame3f((Vector3f)vCenter, Quaternionf.Identity);

            PolyTubeSO so = new PolyTubeSO()
            {
                Curve   = shifted,
                Polygon = polygon
            };

            so.Create(material);
            so.SetLocalFrame(shiftedFrame, CoordSpace.WorldCoords);

            return(so);
        }