Пример #1
0
        /// <summary>
        /// overrides the <see cref="Surface.OnDraw(OpenGlDevice)"/> method.
        /// </summary>
        /// <param name="Device">the <see cref="OpenGlDevice"/> in which will be painted.</param>

        protected override void OnDraw(OpenGlDevice Device)
        {
            if (!plane)
            {
                base.OnDraw(Device); return;
            }
            object Handle = null;

            if ((Device.RenderKind == RenderKind.SnapBuffer) || (Entity.Compiling))
            {
                SurfaceSnappItem S = new SurfaceSnappItem();
                Handle    = Device.Selector.RegisterSnapItem(S);
                S.Surface = this;
            }
            IndexType[] Indices = null;
            xyzf[]      Points  = null;
            xyzf[]      Normals = null;
            xyf[]       Texture = null;
            //         if ((BoundedCurves != null) && (BoundedCurves.Count > 0))
            {
                Indices = new IndexType[] { 0, 1, 2, 0, 2, 3 };
                Points  = new xyzf[] { A, B, C, D };
                Normals = new xyzf[] { N00.toXYZF(), N00.toXYZF(), N00.toXYZF(), N00.toXYZF() };
                Texture = new xyf[] { new xyf(0, 0), new xyf(0, 0), new xyf(0, 0), new xyf(0, 0) };
            }
            //else
            //    GetTrianglesFull(ref Indices, ref Points, ref Normals, ref Texture);
            if (Device.PolygonMode == PolygonMode.Fill)
            {
                Primitives3d.drawTriangles(Device, Indices, Points, Normals, Texture, null);
            }
            else
            {
                Primitives3d.drawFouranglesLined(Device, Indices, Points, Normals, Texture);
            }

            Entity.CheckCompiling();
            if ((Device.RenderKind == RenderKind.SnapBuffer) || (Entity.Compiling))
            {
                Device.Selector.UnRegisterSnapItem(Handle);
            }
        }