protected override void OnResourceLoad() { CreatePrimaryRenderTarget(); CreateDepthBuffer(); var dssd = new DepthStencilStateDescription { IsDepthEnabled = true, IsStencilEnabled = false, DepthWriteMask = DepthWriteMask.All, DepthComparison = Comparison.Less }; var solidParentOp = new BlendStateDescription(); solidParentOp.SetBlendEnable(0, false); solidParentOp.SetWriteMask(0, ColorWriteMaskFlags.All); var transParentOp = new BlendStateDescription { AlphaBlendOperation = BlendOperation.Add, BlendOperation = BlendOperation.Add, DestinationAlphaBlend = BlendOption.Zero, DestinationBlend = BlendOption.One, IsAlphaToCoverageEnabled = false, SourceAlphaBlend = BlendOption.Zero, SourceBlend = BlendOption.One, }; transParentOp.SetBlendEnable(0, true); transParentOp.SetWriteMask(0, ColorWriteMaskFlags.All); transBlendState = BlendState.FromDescription(Context10.Device, transParentOp); solidBlendState = BlendState.FromDescription(Context10.Device, solidParentOp); depthStencilState = DepthStencilState.FromDescription(Context10.Device, dssd); jupiterMesh = new SimpleModel(Context10.Device, "SimpleModel10.fx", "jupiter.SMD", "jupiter.jpg"); view = Matrix.LookAtLH(new Vector3(0, 160, 0), new Vector3(0, -128.0f, 0), -Vector3.UnitZ); jupiterMesh.Effect.GetVariableByName("view").AsMatrix().SetMatrix(view); proj = Matrix.PerspectiveFovLH(45.0f, WindowWidth / (float)WindowHeight, 1.0f, 1000.0f); jupiterMesh.Effect.GetVariableByName("proj").AsMatrix().SetMatrix(proj); }
protected override void OnResourceLoad() { CreatePrimaryRenderTarget(); CreateDepthBuffer(); var dssd = new DepthStencilStateDescription { IsDepthEnabled = true, IsStencilEnabled = false, DepthWriteMask = DepthWriteMask.All, DepthComparison = Comparison.Less }; var solidParentOp = new BlendStateDescription(); solidParentOp.SetBlendEnable( 0, false ); solidParentOp.SetWriteMask( 0, ColorWriteMaskFlags.All ); var transParentOp = new BlendStateDescription { AlphaBlendOperation = BlendOperation.Add, BlendOperation = BlendOperation.Add, DestinationAlphaBlend = BlendOption.Zero, DestinationBlend = BlendOption.One, IsAlphaToCoverageEnabled = false, SourceAlphaBlend = BlendOption.Zero, SourceBlend = BlendOption.One, }; transParentOp.SetBlendEnable( 0, true ); transParentOp.SetWriteMask( 0, ColorWriteMaskFlags.All ); transBlendState = BlendState.FromDescription( Context10.Device, transParentOp ); solidBlendState = BlendState.FromDescription( Context10.Device, solidParentOp ); depthStencilState = DepthStencilState.FromDescription( Context10.Device, dssd ); jupiterMesh = new SimpleModel( Context10.Device, "SimpleModel10.fx", "jupiter.SMD", "jupiter.jpg" ); view = Matrix.LookAtLH( new Vector3( 0, 160, 0 ), new Vector3( 0, -128.0f, 0 ), -Vector3.UnitZ ); jupiterMesh.Effect.GetVariableByName( "view" ).AsMatrix().SetMatrix( view ); proj = Matrix.PerspectiveFovLH( 45.0f, WindowWidth / (float)WindowHeight, 1.0f, 1000.0f ); jupiterMesh.Effect.GetVariableByName( "proj" ).AsMatrix().SetMatrix( proj ); }