Beispiel #1
0
        protected virtual void Draw3D(bool forSelection)
        {
            gl.MatrixMode(gl.MODELVIEW);
            gl.LoadIdentity();

            // Move out Z axis so we can see everything (needed only for Perspective view)
            gl.Translatef(0, 0, zModel);

            if (projectionMode == projectionType.Perspective && // we see it only in perspective mode
                shadowMode != shadowType.None &&
                forSelection != true)
            {
                DrawShadow();
            }

            gl.Rotatef(MU.radToDeg(rotAngle), rotAxis.x, rotAxis.y, rotAxis.z);         // multiply into matrix

            // this command swaps the Y and Z axis
            gl.Rotatef(-90.0f, 1.0f, 0.0f, 0.0f);

            CenterTheModel();

            if (showOrigin)
            {
                DrawOrigin(10);
            }

            // give to the model a fixed size: 100 units
            gl.Scalef(scaleTo100, scaleTo100, scaleTo100);

            foreach (LeaderLabel l in labels)
            {
                l.UpdatePos();
            }

            if (forSelection)
            {
                gl.Disable(gl.LIGHTING);
                gl.PolygonMode(gl.FRONT_AND_BACK, gl.FILL);
                DrawSelectableEntities();
            }

            else
            {
                DrawEntities();
            }
        }
Beispiel #2
0
        protected virtual void Draw2D()
        {
            gl.MatrixMode(gl.MODELVIEW);

            gl.LoadIdentity();

            // An optimum compromise that allows all primitives to be specified
            // at integer positions, while still ensuring predictable rasterization,
            // is to translate x and y by 0.375
            gl.Translatef(0.375f, 0.375f, 0.0f);

            gl.Disable(gl.LIGHTING);
            gl.LineWidth(1.0f);

            if (action == actionType.ZoomWindow)
            {
                DrawZoomWindowBox();
            }

            if (action == actionType.SelectByBox)
            {
                DrawSelectionBox();
            }


            //     DrawBoundingRect();


            gl.Enable(gl.LIGHTING);

            if (showUCSIcon)
            {
                gl.PushMatrix();

                // axis icon position
                gl.Translatef(50.0f, 50.0f, zUcsIcon);

                // axis icon rotation
                gl.Rotatef(MU.radToDeg(rotAngle), rotAxis.x, rotAxis.y, rotAxis.z);             // multiply into matrix

                // swaps axis Y with Z
                gl.Rotatef(-90.0f, 1.0f, 0.0f, 0.0f);

                DrawUcsIcon();

                gl.PopMatrix();


                gl.Disable(gl.LIGHTING);

                gl.PushMatrix();

                gl.Color3ub(63, 63, 63);

                if (hasFocus)
                {
                    xUcsLabel.Draw(zLabels);
                    yUcsLabel.Draw(zLabels);
                    zUcsLabel.Draw(zLabels);
                }
            }

            if (showLabels)
            {
                gl.Disable(gl.LIGHTING);

                originLabel.Draw(0, 20);

                gl.Color3ub(255, 255, 255);

                foreach (Label l in labels)
                {
                    l.Draw(zLabels);
                }
            }

            if (showLegend)
            {
                DrawLegend();
            }

            if (showProgress)
            {
                DrawProgressBar();
            }

            gl.Color3ub(180, 180, 180);

            if (stencilBits == 0)
            {
                DrawText(Width - 366, Height - 50, "Stencil buffer not available. Transparent shadow will not be rendered.");
            }

            gl.PopMatrix();
        }
Beispiel #3
0
 public float AngleOnXY()
 {
     return(MU.radToDeg((float)Math.Atan2(y, x)));
 }
Beispiel #4
0
        public float AngleFromXY()
        {
            double d = Math.Sqrt(x * x + y * y);

            return(MU.radToDeg((float)Math.Atan2(z, d)));
        }
 protected void AxisAndAngleOnStatusBar()
 {
     ((MainForm)this.Parent).StatusText("Axis: (" + rotAxis.x.ToString("f2") + ", " + rotAxis.y.ToString("f2") + ", " + rotAxis.z.ToString("f2") + ") Angle: " + MU.radToDeg(rotAngle).ToString("f2") + " deg");
 }