/// <summary> /// Creates a new <see cref="RasterizerState"/>, used to control various behaviors of the device's rasterizer. /// </summary> /// <param name="cullMode">Controls which primitive faces are culled.</param> /// <param name="fillMode">The kind of triangle filling to use.</param> /// <param name="isDepthClipEnabled">Whether or not primitives are clipped by depth.</param> /// <param name="isScissorTestEnabled">Whether or not primitives are clipped by the scissor test.</param> /// <returns>A new <see cref="RasterizerState"/>.</returns> public RasterizerState CreateRasterizerState( FaceCullingMode cullMode, TriangleFillMode fillMode, bool isDepthClipEnabled, bool isScissorTestEnabled) { return(CreateRasterizerStateCore(cullMode, fillMode, isDepthClipEnabled, isScissorTestEnabled)); }
public override RasterizerState CreateRasterizerState( FaceCullingMode cullMode, TriangleFillMode fillMode, bool isDepthClipEnabled, bool isScissorTestEnabled) { return(new D3DRasterizerState(_device, cullMode, fillMode, isDepthClipEnabled, isScissorTestEnabled)); }
protected override RasterizerState CreateRasterizerStateCore( FaceCullingMode cullMode, TriangleFillMode fillMode, bool isDepthClipEnabled, bool isScissorTestEnabled) { return(new OpenGLRasterizerState(cullMode, fillMode, isDepthClipEnabled, isScissorTestEnabled)); }
public OpenGLESRasterizerState( FaceCullingMode cullMode, TriangleFillMode fillMode, bool depthClipEnabled, bool scissorTestEnabled) { CullMode = cullMode; FillMode = fillMode; IsDepthClipEnabled = depthClipEnabled; IsScissorTestEnabled = scissorTestEnabled; }
public RasterizerStateCacheKey( FaceCullingMode cullMode, TriangleFillMode fillMode, bool isDepthClipEnabled, bool isScissorTestEnabled) { CullMode = cullMode; FillMode = fillMode; IsDepthClipEnabled = isDepthClipEnabled; IsScissorTestEnabled = isScissorTestEnabled; }
internal static CullFaceMode ConvertCullMode(FaceCullingMode cullMode) { switch (cullMode) { case FaceCullingMode.Back: return(CullFaceMode.Back); case FaceCullingMode.Front: return(CullFaceMode.Front); default: // FaceCullingMode.None should not be converted. // It translates to GL.Disable(EnableCap.CullFace). throw Illegal.Value <FaceCullingMode>(); } }
public VkRasterizerState(FaceCullingMode cullMode, TriangleFillMode fillMode, bool isDepthClipEnabled, bool isScissorTestEnabled) { CullMode = cullMode; FillMode = fillMode; IsDepthClipEnabled = isDepthClipEnabled; IsScissorTestEnabled = isScissorTestEnabled; VkPipelineRasterizationStateCreateInfo rasterizerStateCI = VkPipelineRasterizationStateCreateInfo.New(); rasterizerStateCI.cullMode = VkFormats.VeldridToVkCullMode(cullMode); rasterizerStateCI.polygonMode = VkFormats.VeldridToVkFillMode(fillMode); rasterizerStateCI.depthClampEnable = !isDepthClipEnabled; // TODO: Same as OpenGL (?) rasterizerStateCI.frontFace = VkFrontFace.Clockwise; RasterizerStateCreateInfo = rasterizerStateCI; }
internal static VkCullModeFlags VeldridToVkCullMode(FaceCullingMode cullMode) { switch (cullMode) { case FaceCullingMode.Back: return(VkCullModeFlags.Back); case FaceCullingMode.Front: return(VkCullModeFlags.Front); case FaceCullingMode.None: return(VkCullModeFlags.None); default: throw Illegal.Value <FaceCullingMode>(); } }
internal static CullMode ConvertCullMode(FaceCullingMode cullMode) { switch (cullMode) { case FaceCullingMode.Back: return(CullMode.Back); case FaceCullingMode.Front: return(CullMode.Front); case FaceCullingMode.None: return(CullMode.None); default: throw Illegal.Value <FaceCullingMode>(); } }
public Renderable() { hasAlbedoTexture = 0; albedoTexture = null; hasNormalMap = 0; normalMap = null; hasHeightMap = 0; heightMap = null; heightScaleFactor = 1; hasAlphaMap = 0; alphaMap = null; hasEnvironmentMap = 0; environmentMap = null; reflectivity = 0; faceCullingMode = FaceCullingMode.BACK_SIDE; instances = 0; unlit = 0; projectionMode = ProjectionMode.Planar; }
private static void Update(FaceCullingMode mode) { switch (mode) { case FaceCullingMode.FRONT_SIDE: GL.Enable(EnableCap.CullFace); GL.CullFace(CullFaceMode.Front); break; case FaceCullingMode.BACK_SIDE: GL.Enable(EnableCap.CullFace); GL.CullFace(CullFaceMode.Back); break; default: GL.Disable(EnableCap.CullFace); break; } ; }
public D3DRasterizerState( Device device, FaceCullingMode cullMode, TriangleFillMode fillMode, bool depthClipEnabled, bool scissorTestEnabled) { _device = device; CullMode = cullMode; FillMode = fillMode; IsDepthClipEnabled = depthClipEnabled; IsScissorTestEnabled = scissorTestEnabled; var desc = new RasterizerStateDescription() { IsDepthClipEnabled = IsDepthClipEnabled, IsScissorEnabled = IsScissorTestEnabled, CullMode = D3DFormats.ConvertCullMode(cullMode), FillMode = D3DFormats.ConvertFillMode(fillMode) }; _deviceState = new SharpDX.Direct3D11.RasterizerState(device, desc); }
/// <summary> /// Creates a new <see cref="RasterizerState"/>, used to control various behaviors of the device's rasterizer. /// </summary> /// <param name="cullMode">Controls which primitive faces are culled.</param> /// <param name="fillMode">The kind of triangle filling to use.</param> /// <param name="isDepthClipEnabled">Whether or not primitives are clipped by depth.</param> /// <param name="isScissorTestEnabled">Whether or not primitives are clipped by the scissor test.</param> /// <returns>A new <see cref="RasterizerState"/>.</returns> protected abstract RasterizerState CreateRasterizerStateCore( FaceCullingMode cullMode, TriangleFillMode fillMode, bool isDepthClipEnabled, bool isScissorTestEnabled);
/// <summary> /// Initializes a new instance of the <see cref="FaceCullingModeState"/> structure. /// </summary> /// <param name="faceCullingMode">The face culling mode.</param> public FaceCullingModeState(FaceCullingMode faceCullingMode) { Mode = faceCullingMode; }