Example #1
0
        /// <summary>
        /// overrides the <see cref="CustomEntity.OnDraw(OpenGlDevice)"/>method.
        /// </summary>
        /// <param name="Device"></param>
        protected override void OnDraw(OpenGlDevice Device)
        {
            Device.PushMatrix();
            Device.MulMatrix(_Transformation);
            if (Device.RenderKind != RenderKind.SnapBuffer)
            {
                Material SaveE = Device.Material;
                Device.Material = ShaftMaterial;

                Arc K = new Arc(new xy(0, 0), Radius);
                K.ClockWise = false;
                Device.drawCurve(K);
                Device.drawCylinder(Radius, Size - TopHeight);
                Device.PushMatrix();

                Device.MulMatrix(Matrix.Translation(0, 0, Size - TopHeight));
                Device.Material = TopMaterial;
                Device.drawConePointed(TopRadius, TopHeight);
                K           = new Arc(new xy(0, 0), TopRadius);
                K.ClockWise = false;
                Device.drawCurve(K);
                Device.PopMatrix();
                Device.Material = SaveE;
            }
            else
            {
                Device.PushTag(0);
                Device.drawLine(new xyz(0, 0, 0), new xyz(0, 0, Size));
                Device.PopTag();
                Device.PushTag(1);
                Device.drawPoint(new xyz(0, 0, 0), 0.3);
                Device.PopTag();
                Device.PushTag(2);
                Device.drawPoint(new xyz(0, 0, Size), 0.3);
                Device.PopTag();
            }
            Device.PopMatrix();
            base.OnDraw(Device);
        }