Ejemplo n.º 1
0
 void InitializeRasterization(MgPipelineRasterizationStateCreateInfo rasterizationState)
 {
     CullMode   = TranslateCullMode(rasterizationState.CullMode);
     Clamp      = rasterizationState.DepthBiasClamp;
     SlopeScale = rasterizationState.DepthBiasSlopeFactor;
     DepthBiasConstantFactor = rasterizationState.DepthBiasConstantFactor;
     Winding  = TranslateWinding(rasterizationState.FrontFace);
     FillMode = TranslateFillMode(rasterizationState.PolygonMode);
     RasterizationDiscardEnabled = rasterizationState.RasterizerDiscardEnable;
 }
Ejemplo n.º 2
0
        void PopulateCmdFallbacks(MgPipelineRasterizationStateCreateInfo rasterization)
        {
//			if (rasterization != null)
//			{
            // RASTERIZATION DEFAULTS
            DepthBiasConstantFactor = rasterization.DepthBiasConstantFactor;
            DepthBiasClamp          = rasterization.DepthBiasClamp;
            DepthBiasSlopeFactor    = rasterization.DepthBiasSlopeFactor;
            LineWidth = rasterization.LineWidth;
//			}
//			else
//			{
//				// https://www.opengl.org/sdk/docs/man/html/glPolygonOffset.xhtml
//				DepthBiasConstantFactor = 0;
//				DepthBiasSlopeFactor = 0;
//				// https://www.opengl.org/registry/specs/EXT/polygon_offset_clamp.txt
//				DepthBiasClamp = 0;
//				LineWidth = 1f;
//			}
        }
Ejemplo n.º 3
0
        void PopulatePipelineConstants(MgPipelineRasterizationStateCreateInfo rasterization)
        {
//			if (rasterization != null)
//			{
            GLGraphicsPipelineFlagBits flags = 0;

            flags |= ((rasterization.CullMode & MgCullModeFlagBits.FRONT_AND_BACK) > 0) ? GLGraphicsPipelineFlagBits.CullingEnabled : 0;
            flags |= ((rasterization.CullMode & MgCullModeFlagBits.FRONT_BIT) > 0) ? GLGraphicsPipelineFlagBits.CullFrontFaces : 0;
            flags |= ((rasterization.CullMode & MgCullModeFlagBits.BACK_BIT) > 0) ? GLGraphicsPipelineFlagBits.CullBackFaces : 0;
            flags |= (rasterization.FrontFace == MgFrontFace.COUNTER_CLOCKWISE) ? GLGraphicsPipelineFlagBits.UseCounterClockwiseWindings : 0;

            this.PolygonMode             = rasterization.PolygonMode;
            this.RasterizerDiscardEnable = rasterization.RasterizerDiscardEnable;

            flags |= (rasterization.DepthBiasEnable) ? GLGraphicsPipelineFlagBits.DepthBiasEnabled : 0;

            this.DepthClampEnable = rasterization.DepthClampEnable;

            Flags |= flags;
//			}
//			else
//			{
//				// https://www.opengl.org/sdk/docs/man/html/glPolygonOffset.xhtml
//				DepthBiasConstantFactor = 0;
//				DepthBiasSlopeFactor = 0;
//
//				QueueDrawItemBitFlags flags = 0;
//				flags |= QueueDrawItemBitFlags.CullingEnabled;
//				// DISABLED flags |= QueueDrawItemBitFlags.CullFrontFaces;
//				flags |= QueueDrawItemBitFlags.CullBackFaces;
//				flags |= QueueDrawItemBitFlags.UseCounterClockwiseWindings;
//
//				// https://www.opengl.org/sdk/docs/man/html/glPolygonMode.xhtml
//				PolygonMode = MgPolygonMode.FILL;
//
//				Flags |= flags;
//			}
        }