예제 #1
0
        internal void UpdateFaceText(float sizeCorrection)
        {
            var defaultFontSize  = 7.5f;
            var defaultFontColor = new Byte4Class((int)SideSelectionType.Top, 196, 196, 196);

            this.FaceText = new List <Triangle>();

            if (OSProvider.IsWindows)
            {
                // front
                defaultFontColor.A = (int)SideSelectionType.Front;
                var faceText = new OrientationGizmoFaceText();
                faceText.Triangles = Engines.FontTessellationEngine.ConvertStringToTriangles("F", FontStyle.Regular, defaultFontSize * sizeCorrection);
                faceText.RotateText(-90, 0, 0, RotationEventArgs.TypeAxis.X);
                faceText.UpdateBoundries();
                faceText.UpdateDefaultCenter();
                faceText.MoveModelWithTranslationZ(new Vector3Class(0, -(sizeCorrection * 5) - (sizeCorrection / 2) - 0.01f, -(faceText.TopPoint / 2)));
                var faceTextClone = (STLModel3D)faceText.Clone(false);
                faceText.Triangles[0].Clear();
                foreach (var triangle in faceTextClone.Triangles[0])
                {
                    triangle.Vectors[0].Color = triangle.Vectors[1].Color = triangle.Vectors[2].Color = defaultFontColor;
                    triangle.Flip();
                    faceText.Triangles[0].Add(triangle);
                }

                this.FaceText.AddRange(faceText.Triangles[0]);

                //left
                defaultFontColor   = new Byte4Class((int)SideSelectionType.Left, 196, 196, 196);
                faceText           = new OrientationGizmoFaceText();
                faceText.Triangles = Engines.FontTessellationEngine.ConvertStringToTriangles("L", FontStyle.Regular, defaultFontSize * sizeCorrection);
                faceText.RotateText(-90, 0, 0, RotationEventArgs.TypeAxis.X);
                faceText.RotateText(-90, 0, -90, RotationEventArgs.TypeAxis.Z);
                faceText.UpdateBoundries();
                faceText.UpdateDefaultCenter();
                faceText.MoveModelWithTranslationZ(new Vector3Class(-(sizeCorrection * 5) - (sizeCorrection / 2) - 0.01f, 0, -(faceText.TopPoint / 2)));
                faceTextClone = (STLModel3D)faceText.Clone(false);
                faceText.Triangles[0].Clear();
                foreach (var triangle in faceTextClone.Triangles[0])
                {
                    triangle.Vectors[0].Color = triangle.Vectors[1].Color = triangle.Vectors[2].Color = defaultFontColor;
                    triangle.Flip();
                    faceText.Triangles[0].Add(triangle);
                }

                this.FaceText.AddRange(faceText.Triangles[0]);

                //right
                defaultFontColor   = new Byte4Class((int)SideSelectionType.Right, 196, 196, 196);
                faceText           = new OrientationGizmoFaceText();
                faceText.Triangles = Engines.FontTessellationEngine.ConvertStringToTriangles("R", FontStyle.Regular, defaultFontSize * sizeCorrection);
                faceText.RotateText(-90, 0, 0, RotationEventArgs.TypeAxis.X);
                faceText.RotateText(-90, 0, 90, RotationEventArgs.TypeAxis.Z);
                faceText.UpdateBoundries();
                faceText.UpdateDefaultCenter();
                faceText.MoveModelWithTranslationZ(new Vector3Class((sizeCorrection * 5) + (sizeCorrection / 2) + 0.01f, 0, -(faceText.TopPoint / 2)));
                faceTextClone = (STLModel3D)faceText.Clone(false);
                faceText.Triangles[0].Clear();
                foreach (var triangle in faceTextClone.Triangles[0])
                {
                    triangle.Vectors[0].Color = triangle.Vectors[1].Color = triangle.Vectors[2].Color = defaultFontColor;
                    triangle.Flip();
                    faceText.Triangles[0].Add(triangle);
                }

                this.FaceText.AddRange(faceText.Triangles[0]);

                //back
                defaultFontColor   = new Byte4Class((int)SideSelectionType.Back, 196, 196, 196);
                defaultFontColor.A = (int)SideSelectionType.Back;
                faceText           = new OrientationGizmoFaceText();
                faceText.Triangles = Engines.FontTessellationEngine.ConvertStringToTriangles("B", FontStyle.Regular, defaultFontSize * sizeCorrection);
                faceText.RotateText(-90, 0, 0, RotationEventArgs.TypeAxis.X);
                faceText.RotateText(-90, 0, 180, RotationEventArgs.TypeAxis.Z);
                faceText.UpdateBoundries();
                faceText.UpdateDefaultCenter();
                faceText.MoveModelWithTranslationZ(new Vector3Class(0, (sizeCorrection * 5) + (sizeCorrection / 2) + 0.01f, -(faceText.TopPoint / 2)));
                faceTextClone = (STLModel3D)faceText.Clone(false);
                faceText.Triangles[0].Clear();
                foreach (var triangle in faceTextClone.Triangles[0])
                {
                    triangle.Vectors[0].Color = triangle.Vectors[1].Color = triangle.Vectors[2].Color = defaultFontColor;
                    triangle.Flip();
                    faceText.Triangles[0].Add(triangle);
                }

                this.FaceText.AddRange(faceText.Triangles[0]);

                //top
                defaultFontColor   = new Byte4Class((int)SideSelectionType.Top, 196, 196, 196);
                faceText           = new OrientationGizmoFaceText();
                faceText.Triangles = Engines.FontTessellationEngine.ConvertStringToTriangles("T", FontStyle.Regular, defaultFontSize * sizeCorrection);
                faceText.RotateText(180, 0, 0, RotationEventArgs.TypeAxis.X);
                //faceText.RotateText(0, 0, 180, RotationEventArgs.TypeAxis.Z);
                faceText.UpdateBoundries();
                faceText.UpdateDefaultCenter();
                faceText.MoveModelWithTranslationZ(new Vector3Class(0, 0, (sizeCorrection * 5) + (sizeCorrection / 2) + 0.01f));
                faceTextClone = (STLModel3D)faceText.Clone(false);
                faceText.Triangles[0].Clear();
                foreach (var triangle in faceTextClone.Triangles[0])
                {
                    triangle.Vectors[0].Color = triangle.Vectors[1].Color = triangle.Vectors[2].Color = defaultFontColor;
                    triangle.Flip();

                    faceText.Triangles[0].Add(triangle);
                }

                this.FaceText.AddRange(faceText.Triangles[0]);

                //bottom
                defaultFontColor   = new Byte4Class((int)SideSelectionType.Bottom, 196, 196, 196);
                faceText           = new OrientationGizmoFaceText();
                faceText.Triangles = Engines.FontTessellationEngine.ConvertStringToTriangles("B", FontStyle.Regular, defaultFontSize * sizeCorrection);
                faceText.RotateText(0, 0, 0, RotationEventArgs.TypeAxis.Z);
                faceText.UpdateBoundries();
                faceText.UpdateDefaultCenter();
                faceText.MoveModelWithTranslationZ(new Vector3Class(0, 0, -(sizeCorrection * 5) - (sizeCorrection / 2) - 0.01f));
                faceTextClone = (STLModel3D)faceText.Clone(false);
                faceText.Triangles[0].Clear();
                foreach (var triangle in faceTextClone.Triangles[0])
                {
                    triangle.Vectors[0].Color = triangle.Vectors[1].Color = triangle.Vectors[2].Color = defaultFontColor;
                    triangle.Flip();
                    faceText.Triangles[0].Add(triangle);
                }

                this.FaceText.AddRange(faceText.Triangles[0]);
            }
        }
예제 #2
0
파일: XYZAxis.cs 프로젝트: Sidd710/tempRepo
        internal static void CreateXYZAxis()
        {
            _xTriangles = new TriangleInfoList();
            _yTriangles = new TriangleInfoList();
            _zTriangles = new TriangleInfoList();

            var xAxis = new XYZAxisCone(60, 15f, 1.5f, 1.5f, 0f, 0f, 26, new Vector3(), Color.Red, 0, 0, null, false);

            xAxis.RotateByAxis(0, 90, 0, RotationEventArgs.TypeAxis.Y);
            _xTriangles[0].AddRange(xAxis.Triangles[0]);
            var yAxis = new XYZAxisCone(60, 15f, 1.5f, 1.5f, 0f, 0f, 26, new Vector3(), Color.Green, 0, 0, null, false);

            yAxis.RotateByAxis(-90, 0, 0, RotationEventArgs.TypeAxis.X);
            _yTriangles[0].AddRange(yAxis.Triangles[0]);
            var zAxis = new XYZAxisCone(60, 15f, 1.5f, 1.5f, 0f, 0f, 26, new Vector3(), Color.Blue, 0, 0, null, false);

            _zTriangles[0].AddRange(zAxis.Triangles[0]);

            if (DAL.OS.OSProvider.IsWindows)
            {
                //xLabel
                _xLabel = new OrientationGizmoFaceText();
                var xLabelOffset = new Vector3(60, -7.5f, 0);
                _xLabel.Triangles = Engines.FontTessellationEngine.ConvertStringToTriangles("X", FontStyle.Regular, 15f);
                var xLabelClone = (STLModel3D)_xLabel.Clone();
                foreach (var triangle in xLabelClone.Triangles[0])
                {
                    triangle.Flip();
                    _xLabel.Triangles[0].Add(triangle);
                }
                foreach (var triangle in _xLabel.Triangles[0])
                {
                    triangle.Vectors[0].Position += xLabelOffset;
                    triangle.Vectors[1].Position += xLabelOffset;
                    triangle.Vectors[2].Position += xLabelOffset;
                }

                //yLabel
                _yLabel           = new OrientationGizmoFaceText();
                _yLabel.Triangles = Engines.FontTessellationEngine.ConvertStringToTriangles("Y", FontStyle.Regular, 15f);
                _yLabel.RotateText(0, 0, 180, RotationEventArgs.TypeAxis.Z);
                _yLabel.UpdateBoundries();
                _yLabel.UpdateDefaultCenter(true);
                //_yLabel._rotationAngleX = 0;
                var yLabelClone = (STLModel3D)_yLabel.Clone();
                foreach (var triangle in yLabelClone.Triangles[0])
                {
                    triangle.Flip();
                    _yLabel.Triangles[0].Add(triangle);
                }

                //zLabel
                _zLabel           = new OrientationGizmoFaceText();
                _zLabel.Triangles = Engines.FontTessellationEngine.ConvertStringToTriangles("Z", FontStyle.Regular, 15f);
                _zLabel.RotateText(180, 0, 0, RotationEventArgs.TypeAxis.X);
                _zLabel.UpdateBoundries();
                _zLabel.UpdateDefaultCenter(true);
                _zLabel._rotationAngleX = 0;
                var zLabelClone = (STLModel3D)_zLabel.Clone();
                foreach (var triangle in zLabelClone.Triangles[0])
                {
                    triangle.Flip();
                    _zLabel.Triangles[0].Add(triangle);
                }
            }
        }