Esempio n. 1
0
        public Pipeline CreateAPipeline(ResourceLayout[] resourceLayouts,
                                        ShaderSetDescription shaderSetDescription,
                                        OutputDescription outputDescription,
                                        BlendStateDescription blendStateDescription,
                                        bool depthTest,
                                        FaceCullMode faceCullMode       = FaceCullMode.None,
                                        PolygonFillMode polygonFillMode = PolygonFillMode.Solid,
                                        FrontFace frontFaceWindingOrder = FrontFace.Clockwise)
        {
            var pipelineDescription = new GraphicsPipelineDescription()
            {
                BlendState        = blendStateDescription,
                DepthStencilState = new DepthStencilStateDescription(
                    depthTestEnabled: depthTest,
                    depthWriteEnabled: depthTest,
                    comparisonKind: ComparisonKind.LessEqual),
                RasterizerState = new RasterizerStateDescription(
                    cullMode: faceCullMode,
                    fillMode: polygonFillMode,
                    frontFace: frontFaceWindingOrder,
                    depthClipEnabled: depthTest,
                    scissorTestEnabled: false
                    ),
                PrimitiveTopology = PrimitiveTopology.TriangleList,
                ResourceLayouts   = resourceLayouts,
                ShaderSet         = shaderSetDescription,
                Outputs           = outputDescription
            };

            return(_components.Factory.CreateGraphicsPipeline(pipelineDescription));
        }
Esempio n. 2
0
        public override void SetPolyFillMode(PolygonFillMode aMode)
        {
            BufferChunk chunk = new BufferChunk(128);

            chunk += GDI32.EMR_SETPOLYFILLMODE;
            chunk += (int)aMode;

            SendCommand(chunk);
        }
Esempio n. 3
0
 internal static VkPolygonMode VdToVkPolygonMode(PolygonFillMode fillMode)
 {
     switch (fillMode)
     {
         case PolygonFillMode.Solid:
             return VkPolygonMode.Fill;
         case PolygonFillMode.Wireframe:
             return VkPolygonMode.Line;
         default:
             throw Illegal.Value<PolygonFillMode>();
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Constructs a new RasterizerStateDescription.
 /// </summary>
 /// <param name="cullMode">Controls which face will be culled.</param>
 /// <param name="fillMode">Controls how the rasterizer fills polygons.</param>
 /// <param name="frontFace">Controls the winding order used to determine the front face of primitives.</param>
 /// <param name="depthClipEnabled">Controls whether depth clipping is enabled.</param>
 /// <param name="scissorTestEnabled">Controls whether the scissor test is enabled.</param>
 public RasterizerStateDescription(
     FaceCullMode cullMode,
     PolygonFillMode fillMode,
     FrontFace frontFace,
     bool depthClipEnabled,
     bool scissorTestEnabled)
 {
     CullMode           = cullMode;
     FillMode           = fillMode;
     FrontFace          = frontFace;
     DepthClipEnabled   = depthClipEnabled;
     ScissorTestEnabled = scissorTestEnabled;
 }
Esempio n. 5
0
        internal static FillMode VdToD3D11FillMode(PolygonFillMode fillMode)
        {
            switch (fillMode)
            {
            case PolygonFillMode.Solid:
                return(FillMode.Solid);

            case PolygonFillMode.Wireframe:
                return(FillMode.Wireframe);

            default:
                throw Illegal.Value <PolygonFillMode>();
            }
        }
Esempio n. 6
0
        internal static MTLTriangleFillMode VdToMTLFillMode(PolygonFillMode fillMode)
        {
            switch (fillMode)
            {
            case PolygonFillMode.Solid:
                return(MTLTriangleFillMode.Fill);

            case PolygonFillMode.Wireframe:
                return(MTLTriangleFillMode.Lines);

            default:
                throw Illegal.Value <PolygonFillMode>();
            }
        }
Esempio n. 7
0
        private static int TranslateFillMode(PolygonFillMode fillMode)
        {
            int nativeFillMode = 0;

            switch (fillMode)
            {
            case PolygonFillMode.Alternate: nativeFillMode = 1; break;

            case PolygonFillMode.NonZeroWinding: nativeFillMode = 2; break;
            }
            if (nativeFillMode == 0)
            {
                throw new ArgumentException("Unrecognized PolygonFillMode", nameof(fillMode));
            }
            else
            {
                return(nativeFillMode);
            }
        }
Esempio n. 8
0
        public static Region CreateMultiplePolygon(IList <IList <Point> > polygons, PolygonFillMode fillMode)
        {
            var maxPointCount = (from shape in polygons select shape.Count).Sum();
            var points        = new Point[maxPointCount];
            var endpoints     = new List <int>(polygons.Count);

            int offset = 0;

            foreach (var shape in polygons)
            {
                shape.CopyTo(points, offset);
                offset += shape.Count;
                endpoints.Add(shape.Count);
            }

            var endpointArray = new int[endpoints.Count];

            endpoints.CopyTo(endpointArray, 0);
            return(new Region(NativeMethods.CreatePolyPolygonRgn(points, endpointArray, maxPointCount, TranslateFillMode(fillMode))));
        }
Esempio n. 9
0
        public static GDIRegion CreateFromPolygon(Point2I[] points, PolygonFillMode aMode, Guid uniqueID)
        {
            TOAPI.Types.POINT[] pts = new POINT[points.Length];
            for (int i = 0; i < pts.Length; i++)
            {
                pts[i].X = points[i].x;
                pts[i].Y = points[i].y;
            }

            IntPtr regionHandle = GDI32.CreatePolygonRgn(pts, pts.Length, (int)aMode);

            GDIRegion newRegion = new GDIRegion(regionHandle, true, uniqueID);

            return newRegion;
        }
Esempio n. 10
0
 public IPipelineBuilder With(PolygonFillMode polygonFillMode)
 {
     rasterizer.FillMode = polygonFillMode;
     return(this);
 }
Esempio n. 11
0
        public override void SetPolyFillMode(PolygonFillMode aMode)
        {
            BufferChunk chunk = new BufferChunk(128);
            chunk += GDI32.EMR_SETPOLYFILLMODE;
            chunk += (int)aMode;

            SendCommand(chunk);
        }
Esempio n. 12
0
 public virtual void SetPolyFillMode(PolygonFillMode fillMode)
 {
     GDI32.SetPolyFillMode(this, (int)fillMode);
 }
Esempio n. 13
0
 public virtual void SetPolyFillMode(PolygonFillMode fillMode)
 {
     DeviceContext.SetPolyFillMode(fillMode);
 }
Esempio n. 14
0
 public virtual void SetPolyFillMode(PolygonFillMode fillMode)
 {
 }
Esempio n. 15
0
 public static Region CreatePolygon(IList <Point> points, PolygonFillMode fillMode)
 {
     Point[] pointArray = new Point[points.Count];
     points.CopyTo(pointArray, 0);
     return(new Region(NativeMethods.CreatePolygonRgn(pointArray, points.Count, TranslateFillMode(fillMode))));
 }
Esempio n. 16
0
 public virtual void SetPolyFillMode(PolygonFillMode aMode)
 {
     if (null != SetPolyFillModeHandler)
         SetPolyFillModeHandler(aMode);
 }