コード例 #1
0
 public static extern InteropBool ResourceFactory_CreateDSState(
     IntPtr failReason,
     DeviceHandle deviceHandle,
     InteropBool enableDepthTesting,
     DepthComparisonFunction depthComparisonFunction,
     IntPtr outDepthStencilStateHandle
     );
コード例 #2
0
        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();
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 /// <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;
 }