public static extern InteropBool ResourceFactory_CreateDSState( IntPtr failReason, DeviceHandle deviceHandle, InteropBool enableDepthTesting, DepthComparisonFunction depthComparisonFunction, IntPtr outDepthStencilStateHandle );
public void ShouldCorrectlyAssignAllMembers() { const bool ENABLE_DEPTH_TEST = true; const DepthComparisonFunction DEPTH_COMPARISON_FUNCTION = DepthComparisonFunction.PassNonCoplanarElements; DepthStencilState testDSState = new DepthStencilState( ENABLE_DEPTH_TEST, DEPTH_COMPARISON_FUNCTION ); Assert.AreEqual(ENABLE_DEPTH_TEST, testDSState.DepthTestingEnabled); Assert.AreEqual(DEPTH_COMPARISON_FUNCTION, testDSState.DepthComparisonFunction); testDSState.Dispose(); }
private static unsafe DepthStencilStateResourceHandle CreateDepthStencilState(bool enableDepthTesting, DepthComparisonFunction depthComparisonFunction) { DepthStencilStateResourceHandle outResourceHandle; InteropUtils.CallNative(NativeMethods.ResourceFactory_CreateDSState, RenderingModule.Device, (InteropBool)enableDepthTesting, depthComparisonFunction, (IntPtr)(&outResourceHandle) ).ThrowOnFailure(); return(outResourceHandle); }
/// <summary> /// Creates a new Depth/Stencil state with standard default parameters and the option to override some depth testing parameters. /// </summary> /// <param name="enableDepthTesting">Whether or not depth testing is enabled.</param> /// <param name="depthComparisonFunction">The depth-testing function used to compare two potential fragments.</param> public DepthStencilState(bool enableDepthTesting, DepthComparisonFunction depthComparisonFunction) : base(CreateDepthStencilState(enableDepthTesting, depthComparisonFunction), ResourceUsage.Immutable, DEPTH_STENCIL_STATE_OBJECT_SIZE) { DepthTestingEnabled = enableDepthTesting; DepthComparisonFunction = depthComparisonFunction; }