• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# State.GpuStateStruct类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CSPspEmu.Core.Gpu.State.GpuStateStruct的典型用法代码示例。如果您正苦于以下问题:C# GpuStateStruct类的具体用法?C# GpuStateStruct怎么用?C# GpuStateStruct使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GpuStateStruct类属于CSPspEmu.Core.Gpu.State命名空间,在下文中一共展示了GpuStateStruct类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PrepareStateMatrix

		private static void PrepareStateMatrix(GpuStateStruct* GpuState)
		{
			// DRAW BEGIN COMMON
			{
				if (GpuState->VertexState.Type.Transform2D)
				//if (true)
				{
					GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity();
					GL.Ortho(0, 480, 272, 0, 0, -0xFFFF);

					GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity();
				}
				else
				{
					GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity();
					GL.MultMatrix(GpuState->VertexState.ProjectionMatrix.Values);

					GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity();
					GpuState->VertexState.ViewMatrix.SetLastColumn();
					GpuState->VertexState.WorldMatrix.SetLastColumn();
					GL.MultMatrix(GpuState->VertexState.ViewMatrix.Values);
					GL.MultMatrix(GpuState->VertexState.WorldMatrix.Values);

					if (float.IsNaN(GpuState->VertexState.WorldMatrix.Values[0]))
					{
						throw (new Exception("Invalid WorldMatrix"));
					}

					//GpuState->VertexState.ViewMatrix.Dump();
					//GpuState->VertexState.WorldMatrix.Dump();

					//Console.WriteLine("NO Transform2D");
				}
			}
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:35,代码来源:OpenglGpuImpl.StateMatrix.cs


示例2: Transfer

        public override void Transfer(GpuStateStruct* GpuState)
        {
            //return;
            var TextureTransferState = GpuState->TextureTransferState;

            if (
                (TextureTransferState.DestinationAddress.Address == GpuState->DrawBufferState.Address) &&
                (TextureTransferState.DestinationLineWidth == GpuState->DrawBufferState.Width) &&
                (TextureTransferState.BytesPerPixel == GpuState->DrawBufferState.BytesPerPixel)
            )
            {
                //Console.Error.WriteLine("Writting to DrawBuffer");
                TransferToFrameBuffer(GpuState);
            }
            else
            {
                Console.Error.WriteLine("NOT Writting to DrawBuffer");
                TransferGeneric(GpuState);
                /*
                base.Transfer(GpuStateStruct);
                PrepareWrite(GpuStateStruct);
                {

                }
                PrepareRead(GpuStateStruct);
                */
            }
            Console.Error.WriteLine("GpuImpl.Transfer Not Implemented!! : {0}", GpuState->TextureTransferState.ToStringDefault());
        }
开发者ID:e-COS,项目名称:cspspemu,代码行数:29,代码来源:OpenglGpuImpl.Transfer.cs


示例3: PrepareStateMatrix

        internal static void PrepareStateMatrix(GpuStateStruct* GpuState, ref Matrix4f WorldViewProjectionMatrix)
        {
            // DRAW BEGIN COMMON
            {
                if (GpuState->VertexState.Type.Transform2D)
                //if (true)
                {
                    WorldViewProjectionMatrix = Matrix4f.Ortho(0, 512, 272, 0, 0, -0xFFFF);
                    //WorldViewProjectionMatrix = Matrix4f.Ortho(0, 480, 272, 0, 0, -0xFFFF);
                }
                else
                {
                    if (float.IsNaN(GpuState->VertexState.WorldMatrix.Values[0]))
                    {
                        //Console.Error.WriteLine("Invalid WorldMatrix");
                        //Console.Error.WriteLine("Projection:");
                        //GpuState->VertexState.ProjectionMatrix.Dump();
                        //Console.Error.WriteLine("View:");
                        //GpuState->VertexState.ViewMatrix.Dump();
                        //Console.Error.WriteLine("World:");
                        //GpuState->VertexState.WorldMatrix.Dump();
                    }

                    GpuState->VertexState.ViewMatrix.SetLastColumn();
                    GpuState->VertexState.WorldMatrix.SetLastColumn();

                    WorldViewProjectionMatrix =
                        Matrix4f.Identity
                        .Multiply(GpuState->VertexState.WorldMatrix.Matrix4)
                        .Multiply(GpuState->VertexState.ViewMatrix.Matrix4)
                        .Multiply(GpuState->VertexState.ProjectionMatrix.Matrix4)
                    ;
                }
            }
        }
开发者ID:soywiz,项目名称:cspspemu,代码行数:35,代码来源:OpenglGpuImplMatrix.cs


示例4: PrepareStateDraw

		private void PrepareStateDraw(GpuStateStruct* GpuState)
		{
			GL.ColorMask(true, true, true, true);

#if ENABLE_TEXTURES
			PrepareState_Texture_Common(GpuState);
#endif
			PrepareState_Blend(GpuState);

			if (GpuState->VertexState.Type.Transform2D)
			{
				PrepareState_Colors_2D(GpuState);
				GL.Disable(EnableCap.StencilTest);
				GL.Disable(EnableCap.CullFace);
				GL.DepthRange((double)0, (double)1);
				GL.Disable(EnableCap.DepthTest);
				GL.Disable(EnableCap.Lighting);
			}
			else
			{
				PrepareState_Colors_3D(GpuState);
				PrepareState_CullFace(GpuState);
				PrepareState_Lighting(GpuState);
				PrepareState_Depth(GpuState);
				PrepareState_DepthTest(GpuState);
				PrepareState_Stencil(GpuState);
			}
			GL.ShadeModel((GpuState->ShadeModel == ShadingModelEnum.Flat) ? ShadingModel.Flat : ShadingModel.Smooth);
			PrepareState_AlphaTest(GpuState);
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:30,代码来源:OpenglGpuImpl.StateDraw.cs


示例5: PrepareStateCommon

        private void PrepareStateCommon(GpuStateStruct* GpuState)
        {
            var Viewport = GpuState->Viewport;
            //ViewportStruct(
            //  Position=Vector3f(X=2048,Y=2048,Z=0.9999847),
            //  Scale=Vector3f(X=480,Y=-272,Z=-32768),
            //  RegionTopLeft=PointS(X=0,Y=0),
            //  RegionBottomRight=PointS(X=479,Y=271)
            //)
            //ViewportStruct(
            //  RegionSize=PointS(X=384,Y=240),
            //  Position=Vector3f(X=2048,Y=2048,Z=0),
            //  Scale=Vector3f(X=480,Y=-272,Z=0),
            //  RegionTopLeft=PointS(X=0,Y=0),
            //  RegionBottomRight=PointS(X=383,Y=239)
            //)
            //Console.Error.WriteLine(Viewport.ToString());

            GL.Hint(HintTarget.PolygonSmoothHint, HintMode.Fastest);
            GL.Hint(HintTarget.LineSmoothHint, HintMode.Fastest);
            GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Fastest);
            GL.Hint(HintTarget.PointSmoothHint, HintMode.Fastest);

            int ScaledWidth = (int)(((double)480 / (double)Viewport.RegionSize.X) * (double)480);
            int ScaledHeight = (int)(((double)272 / (double)Viewport.RegionSize.Y) * (double)272);

            GL.Viewport(
                (int)Viewport.RegionTopLeft.X,
                (int)Viewport.RegionTopLeft.Y,
                ScaledWidth,
                ScaledHeight
            );
        }
开发者ID:e-COS,项目名称:cspspemu,代码行数:33,代码来源:OpenglGpuImpl.StateCommon.cs


示例6: PrepareState_Stencil

		private void PrepareState_Stencil(GpuStateStruct* GpuState)
		{
			if (!GlEnableDisable(GL.GL_STENCIL_TEST, GpuState->StencilState.Enabled))
			{
				return;
			}

			//Console.Error.WriteLine("aaaaaa!");

			//if (state.stencilFuncFunc == 2) { outputDepthAndStencil(); assert(0); }

#if false
											Console.Error.WriteLine(
			"{0}:{1}:{2} - {3}, {4}, {5}",
			StencilFunctionTranslate[(int)GpuState->StencilState.Function],
			GpuState->StencilState.FunctionRef,
			GpuState->StencilState.FunctionMask,
			StencilOperationTranslate[(int)GpuState->StencilState.OperationFail],
			StencilOperationTranslate[(int)GpuState->StencilState.OperationZFail],
			StencilOperationTranslate[(int)GpuState->StencilState.OperationZPass]
		);
#endif

			GL.glStencilFunc(
				StencilFunctionTranslate[(int)GpuState->StencilState.Function],
				GpuState->StencilState.FunctionRef,
				GpuState->StencilState.FunctionMask
			);

			GL.glStencilOp(
				StencilOperationTranslate[(int)GpuState->StencilState.OperationFail],
				StencilOperationTranslate[(int)GpuState->StencilState.OperationZFail],
				StencilOperationTranslate[(int)GpuState->StencilState.OperationZPass]
			);
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:35,代码来源:GpuImplOpenglEs.StateDraw.cs


示例7: TransferToFrameBuffer

		private void TransferToFrameBuffer(GpuStateStruct* GpuState)
		{
			var TextureTransferState = GpuState->TextureTransferState;

			var GlPixelFormat = GlPixelFormatList[(int)GpuState->DrawBufferState.Format];

			GL.PixelZoom(1, -1);
			GL.WindowPos2(TextureTransferState.DestinationX, 272 - TextureTransferState.DestinationY);
			//GL.PixelZoom(1, -1);
			//GL.PixelZoom(1, 1);
			GL.PixelStore(PixelStoreParameter.UnpackAlignment, TextureTransferState.BytesPerPixel);
			GL.PixelStore(PixelStoreParameter.UnpackRowLength, TextureTransferState.SourceLineWidth);
			GL.PixelStore(PixelStoreParameter.UnpackSkipPixels, TextureTransferState.SourceX);
			GL.PixelStore(PixelStoreParameter.UnpackSkipRows, TextureTransferState.SourceY);

			{
				GL.DrawPixels(
					TextureTransferState.Width,
					TextureTransferState.Height,
					PixelFormat.Rgba,
					GlPixelFormat.OpenglPixelType,
					new IntPtr(Memory.PspAddressToPointerSafe(
						TextureTransferState.SourceAddress,
						TextureTransferState.Width * TextureTransferState.Height * 4
					))
				);
			}

			GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);
			GL.PixelStore(PixelStoreParameter.UnpackRowLength, 0);
			GL.PixelStore(PixelStoreParameter.UnpackSkipPixels, 0);
			GL.PixelStore(PixelStoreParameter.UnpackSkipRows, 0);
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:33,代码来源:OpenglGpuImpl.Transfer.cs


示例8: PrepareStateDraw

		private void PrepareStateDraw(GpuStateStruct* GpuState)
		{
			GL.glColorMask(true, true, true, true);

#if ENABLE_TEXTURES
			PrepareState_Texture_Common(GpuState);
#endif
			PrepareState_Blend(GpuState);

			if (GpuState->VertexState.Type.Transform2D)
			{
				PrepareState_Colors_2D(GpuState);
				GL.glDisable(GL.GL_STENCIL_TEST);
				GL.glDisable(GL.GL_CULL_FACE);
				GL.glDepthRangef(0, 1);
				GL.glDisable(GL.GL_DEPTH_TEST);
				//GL.glDisable(GL.GL_LIGHTNING_TEST);
			}
			else
			{
				PrepareState_Colors_3D(GpuState);
				PrepareState_CullFace(GpuState);
				PrepareState_Lighting(GpuState);
				PrepareState_Depth(GpuState);
				PrepareState_DepthTest(GpuState);
				PrepareState_Stencil(GpuState);
			}
			//GL.ShadeModel((GpuState->ShadeModel == ShadingModelEnum.Flat) ? ShadingModel.Flat : ShadingModel.Smooth);
			PrepareState_AlphaTest(GpuState);
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:30,代码来源:GpuImplOpenglEs.StateDraw.cs


示例9: TransferGeneric

        private void TransferGeneric(GpuStateStruct* GpuState)
        {
            Console.WriteLine("TransferGeneric Not Implemented");
            var TextureTransferState = GpuState->TextureTransferState;

            var SourceX = TextureTransferState.SourceX;
            var SourceY = TextureTransferState.SourceY;
            var DestinationX = TextureTransferState.DestinationX;
            var DestinationY = TextureTransferState.DestinationY;
            var BytesPerPixel = TextureTransferState.BytesPerPixel;

            var SourceTotalBytes = TextureTransferState.SourceLineWidth * TextureTransferState.Height * BytesPerPixel;
            var DestinationTotalBytes = TextureTransferState.DestinationLineWidth * TextureTransferState.Height * BytesPerPixel;

            var SourcePointer = (byte*)Memory.PspAddressToPointerSafe(TextureTransferState.SourceAddress.Address, SourceTotalBytes);
            var DestinationPointer = (byte*)Memory.PspAddressToPointerSafe(TextureTransferState.DestinationAddress.Address, DestinationTotalBytes);

            for (uint y = 0; y < TextureTransferState.Height; y++)
            {
                var RowSourceOffset = (uint)(
                    (TextureTransferState.SourceLineWidth * (y + SourceY)) + SourceX
                );
                var RowDestinationOffset = (uint)(
                    (TextureTransferState.DestinationLineWidth * (y + DestinationY)) + DestinationX
                );
                PointerUtils.Memcpy(
                    DestinationPointer + RowDestinationOffset * BytesPerPixel,
                    SourcePointer + RowSourceOffset * BytesPerPixel,
                    TextureTransferState.Width * BytesPerPixel
                );
            }

            /*
            // Generic implementation.
            with (gpu.state.textureTransfer) {
                auto srcAddressHost = cast(ubyte*)gpu.memory.getPointer(srcAddress);
                auto dstAddressHost = cast(ubyte*)gpu.memory.getPointer(dstAddress);

                if (gpu.state.drawBuffer.isAnyAddressInBuffer([srcAddress, dstAddress])) {
                    gpu.performBufferOp(BufferOperation.STORE, BufferType.COLOR);
                }

                for (int n = 0; n < height; n++) {
                    int srcOffset = ((n + srcY) * srcLineWidth + srcX) * bpp;
                    int dstOffset = ((n + dstY) * dstLineWidth + dstX) * bpp;
                    (dstAddressHost + dstOffset)[0.. width * bpp] = (srcAddressHost + srcOffset)[0.. width * bpp];
                    //writefln("%08X <- %08X :: [%d]", dstOffset, srcOffset, width * bpp);
                }
                //std.file.write("buffer", dstAddressHost[0..512 * 272 * 4]);

                if (gpu.state.drawBuffer.isAnyAddressInBuffer([dstAddress])) {
                    //gpu.impl.test();
                    //gpu.impl.test("trxkick");
                    gpu.markBufferOp(BufferOperation.LOAD, BufferType.COLOR);
                }
                //gpu.impl.test();
            }
            */
        }
开发者ID:soywiz,项目名称:cspspemu,代码行数:59,代码来源:OpenglGpuImpl.Transfer.cs


示例10: PrepareState_Blend

        private void PrepareState_Blend(GpuStateStruct* GpuState)
        {
            var BlendingState = &GpuState->BlendingState;
            if (!GlEnableDisable(EnableCap.Blend, BlendingState->Enabled))
            {
                return;
            }

            //Console.WriteLine("Blend!");

            var OpenglFunctionSource = BlendFuncSrcTranslate[(int)BlendingState->FunctionSource];
            //var OpenglFunctionDestination = BlendFuncDstTranslate[(int)BlendingState->FunctionDestination];
            var OpenglFunctionDestination = (BlendingFactorDest)BlendFuncSrcTranslate[(int)BlendingState->FunctionDestination];

            Func<ColorfStruct, int> getBlendFix = (Color) =>
            {
                if (Color.IsColorf(0, 0, 0)) return GL_ZERO;
                if (Color.IsColorf(1, 1, 1)) return GL_ONE;
                return GL_CONSTANT_COLOR;
            };

            if (BlendingState->FunctionSource == GuBlendingFactorSource.GU_FIX)
            {
                OpenglFunctionSource = (BlendingFactorSrc)getBlendFix(BlendingState->FixColorSource);
            }

            if (BlendingState->FunctionDestination == GuBlendingFactorDestination.GU_FIX)
            {
                if (((int)OpenglFunctionSource == GL_CONSTANT_COLOR) && (BlendingState->FixColorSource + BlendingState->FixColorDestination).IsColorf(1, 1, 1))
                {
                    OpenglFunctionDestination = (BlendingFactorDest)GL_ONE_MINUS_CONSTANT_COLOR;
                }
                else
                {
                    OpenglFunctionDestination = (BlendingFactorDest)getBlendFix(BlendingState->FixColorDestination);
                }
            }
            //Console.WriteLine("{0}, {1}", OpenglFunctionSource, OpenglFunctionDestination);

            var OpenglBlendEquation = BlendEquationTranslate[(int)BlendingState->Equation];

            /*
            Console.WriteLine(
                "{0} : {1} -> {2}",
                OpenglBlendEquation, OpenglFunctionSource, OpenglFunctionDestination
            );
            */

            GL.BlendEquation(OpenglBlendEquation);
            GL.BlendFunc(OpenglFunctionSource, OpenglFunctionDestination);

            GL.BlendColor(
                BlendingState->FixColorDestination.Red,
                BlendingState->FixColorDestination.Green,
                BlendingState->FixColorDestination.Blue,
                BlendingState->FixColorDestination.Alpha
            );
        }
开发者ID:mrcmunir,项目名称:cspspemu,代码行数:58,代码来源:OpenglGpuImpl.State.cs


示例11: PrepareStateMatrix

		private void PrepareStateMatrix(GpuStateStruct* GpuState)
		{
			var VertexType = GpuState->VertexState.Type;
			var TextureState = &GpuState->TextureMappingState.TextureState;

			if (VertexType.Transform2D)
			{
				projectionMatrix.SetMatrix4(Matrix4Ortho);
				worldMatrix.SetMatrix4(Matrix4Identity);
				viewMatrix.SetMatrix4(Matrix4Identity);
				GL.glDepthRangef(0f, 1f);
			}
			else
			{
				projectionMatrix.SetMatrix4(GpuState->VertexState.ProjectionMatrix.Values);
				worldMatrix.SetMatrix4(GpuState->VertexState.WorldMatrix.Values);
				viewMatrix.SetMatrix4(GpuState->VertexState.ViewMatrix.Values);
			}

			/*
			// DRAW BEGIN COMMON
			{
				if (GpuState->VertexState.Type.Transform2D)
				//if (true)
				{
					GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity();
					GL.Ortho(0, 480, 272, 0, 0, -0xFFFF);

					GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity();
				}
				else
				{
					GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity();
					GL.MultMatrix(GpuState->VertexState.ProjectionMatrix.Values);

					GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity();
					GpuState->VertexState.ViewMatrix.SetLastColumn();
					GpuState->VertexState.WorldMatrix.SetLastColumn();
					GL.MultMatrix(GpuState->VertexState.ViewMatrix.Values);
					GL.MultMatrix(GpuState->VertexState.WorldMatrix.Values);

					if (float.IsNaN(GpuState->VertexState.WorldMatrix.Values[0]))
					{
						throw (new Exception("Invalid WorldMatrix"));
					}

					//GpuState->VertexState.ViewMatrix.Dump();
					//GpuState->VertexState.WorldMatrix.Dump();

					//Console.WriteLine("NO Transform2D");
				}
			}
			*/
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:54,代码来源:GpuImplOpenglEs.StateMatrix.cs


示例12: PrepareState_AlphaTest

        private void PrepareState_AlphaTest(GpuStateStruct* GpuState)
        {
            if (!GlEnableDisable(EnableCap.AlphaTest, GpuState->AlphaTestState.Enabled))
            {
                return;
            }

            GL.AlphaFunc(
                (AlphaFunction)TestTranslate[(int)GpuState->AlphaTestState.Function],
                GpuState->AlphaTestState.Value
            );
        }
开发者ID:mrcmunir,项目名称:cspspemu,代码行数:12,代码来源:OpenglGpuImpl.State.cs


示例13: PrepareStateClear

		static void PrepareStateClear(GpuStateStruct* GpuState)
		{
			bool ccolorMask = false, calphaMask = false;

			//return;

			GL.glDisable(GL.GL_BLEND);
			//GL.glDisable(GLEnableCap.Lighting);
			GL.glDisable(GL.GL_TEXTURE_2D);
			//GL.glDisable(EnableCap.AlphaTest);
			GL.glDisable(GL.GL_DEPTH_TEST);
			GL.glDisable(GL.GL_STENCIL_TEST);
			//GL.glDisable(EnableCap.Fog);
			//GL.glDisable(EnableCap.ColorLogicOp);
			GL.glDisable(GL.GL_CULL_FACE);
			GL.glDepthMask(false);

			if (GpuState->ClearFlags.HasFlag(ClearBufferSet.ColorBuffer))
			{
				ccolorMask = true;
			}

			if (GlEnableDisable(GL.GL_STENCIL_TEST, GpuState->ClearFlags.HasFlag(ClearBufferSet.StencilBuffer)))
			{
				calphaMask = true;
				// Sets to 0x00 the stencil.
				// @TODO @FIXME! : Color should be extracted from the color! (as alpha component)
				GL.glStencilFunc(GL.GL_ALWAYS, 0x00, 0xFF);
				GL.glStencilOp(GL.GL_REPLACE, GL.GL_REPLACE, GL.GL_REPLACE);
				//Console.Error.WriteLine("Stencil!");
				//GL.Enable(EnableCap.DepthTest);
			}

			//int i; glGetIntegerv(GL_STENCIL_BITS, &i); writefln("GL_STENCIL_BITS: %d", i);

			if (GpuState->ClearFlags.HasFlag(ClearBufferSet.DepthBuffer))
			{
				GL.glEnable(GL.GL_DEPTH_TEST);
				GL.glDepthFunc(GL.GL_ALWAYS);
				GL.glDepthMask(true);
				GL.glDepthRangef(0f, 0f);
				//GL.DepthRange((double)-1, (double)0);

				//glDepthRange(0.0, 1.0); // Original value
			}

			GL.glColorMask(ccolorMask, ccolorMask, ccolorMask, calphaMask);

			//glClearDepth(0.0); glClear(GL_COLOR_BUFFER_BIT);

			//if (state.clearFlags & ClearBufferMask.GU_COLOR_BUFFER_BIT) glClear(GL_DEPTH_BUFFER_BIT);
			//GL.Clear(ClearBufferMask.StencilBufferBit);
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:53,代码来源:GpuImplOpenglEs.StateClear.cs


示例14: PrepareState_AlphaTest

		private void PrepareState_AlphaTest(GpuStateStruct* GpuState)
		{
			//if (!GL.EnableDisable(EnableCap.AlphaTest, GpuState->AlphaTestState.Enabled))
			//{
			//	return;
			//}
			//
			//GL.glAlphaFunc(
			//	(AlphaFunction)DepthFunctionTranslate[(int)GpuState->AlphaTestState.Function],
			//	GpuState->AlphaTestState.Value
			//);
		}
开发者ID:soywiz,项目名称:cspspemu,代码行数:12,代码来源:OpenglGpuImpl.StateDraw.cs


示例15: PrepareStateClear

	    static void PrepareStateClear(GpuStateStruct* GpuState)
		{
			bool ccolorMask = false, calphaMask = false;

			//return;

			GL.Disable(EnableCap.Blend);
			GL.Disable(EnableCap.Lighting);
			GL.Disable(EnableCap.Texture2D);
			GL.Disable(EnableCap.AlphaTest);
			GL.Disable(EnableCap.DepthTest);
			GL.Disable(EnableCap.StencilTest);
			GL.Disable(EnableCap.Fog);
			GL.Disable(EnableCap.ColorLogicOp);
			GL.Disable(EnableCap.CullFace);
			GL.DepthMask(false);

			if (GpuState->ClearFlags.HasFlag(ClearBufferSet.ColorBuffer))
			{
				ccolorMask = true;
			}

			if (GlEnableDisable(EnableCap.StencilTest, GpuState->ClearFlags.HasFlag(ClearBufferSet.StencilBuffer)))
			{
				calphaMask = true;
				// Sets to 0x00 the stencil.
				// @TODO @FIXME! : Color should be extracted from the color! (as alpha component)
				GL.StencilFunc(StencilFunction.Always, 0x00, 0xFF);
				GL.StencilOp(StencilOp.Replace, StencilOp.Replace, StencilOp.Replace);
				//Console.Error.WriteLine("Stencil!");
				//GL.Enable(EnableCap.DepthTest);
			}

			//int i; glGetIntegerv(GL_STENCIL_BITS, &i); writefln("GL_STENCIL_BITS: %d", i);

			if (GpuState->ClearFlags.HasFlag(ClearBufferSet.DepthBuffer))
			{
				GL.Enable(EnableCap.DepthTest);
				GL.DepthFunc(DepthFunction.Always);
				GL.DepthMask(true);
				GL.DepthRange((double)0, (double)0);
				//GL.DepthRange((double)-1, (double)0);

				//glDepthRange(0.0, 1.0); // Original value
			}

			GL.ColorMask(ccolorMask, ccolorMask, ccolorMask, calphaMask);

			//glClearDepth(0.0); glClear(GL_COLOR_BUFFER_BIT);

			//if (state.clearFlags & ClearBufferMask.GU_COLOR_BUFFER_BIT) glClear(GL_DEPTH_BUFFER_BIT);
			//GL.Clear(ClearBufferMask.StencilBufferBit);
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:53,代码来源:OpenglGpuImpl.StateClear.cs


示例16: PrepareStateCommon

        public static void PrepareStateCommon(GpuStateStruct* GpuState, int ScaleViewport)
        {
            var Viewport = GpuState->Viewport;
            //ViewportStruct(
            //  Position=Vector3f(X=2048,Y=2048,Z=0.9999847),
            //  Scale=Vector3f(X=480,Y=-272,Z=-32768),
            //  RegionTopLeft=PointS(X=0,Y=0),
            //  RegionBottomRight=PointS(X=479,Y=271)
            //)
            //ViewportStruct(
            //  RegionSize=PointS(X=384,Y=240),
            //  Position=Vector3f(X=2048,Y=2048,Z=0),
            //  Scale=Vector3f(X=480,Y=-272,Z=0),
            //  RegionTopLeft=PointS(X=0,Y=0),
            //  RegionBottomRight=PointS(X=383,Y=239)
            //)
            //Console.Error.WriteLine(Viewport.ToString());

            //GL.Hint(HintTarget.PolygonSmoothHint, HintMode.Fastest);
            //GL.Hint(HintTarget.LineSmoothHint, HintMode.Fastest);
            //GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Fastest);
            //GL.Hint(HintTarget.PointSmoothHint, HintMode.Fastest);

            /*
                            int halfHeight = Math.abs(context.viewport_height);
                            int halfWidth = Math.abs(context.viewport_width);
                            int viewportX = context.viewport_cx - halfWidth - context.offset_x;
                            int viewportY = context.viewport_cy - halfHeight - context.offset_y;
                            int viewportWidth = 2 * halfWidth;
                            int viewportHeight = 2 * halfHeight;

                            // For OpenGL, translate the viewportY from the upper left corner
                            // to the lower left corner.
                            viewportY = Screen.height - viewportY - viewportHeight;

                            re.setViewport(viewportX, viewportY, viewportWidth, viewportHeight);
            */

            //int ScreenWidth = 480;
            //int ScreenHeight = 272;
            //
            //int ScaledWidth = (int)(((double)ScreenWidth / (double)Viewport.RegionSize.X) * (double)ScreenWidth);
            //int ScaledHeight = (int)(((double)ScreenHeight / (double)Viewport.RegionSize.Y) * (double)ScreenHeight);
            //
            //GL.glViewport(
            //	(int)Viewport.RegionTopLeft.X * ScaleViewport,
            //	(int)Viewport.RegionTopLeft.Y * ScaleViewport,
            //	ScaledWidth * ScaleViewport,
            //	ScaledHeight * ScaleViewport
            //);
        }
开发者ID:soywiz,项目名称:cspspemu,代码行数:51,代码来源:OpenglGpuImplCommon.cs


示例17: PrepareState_Clip

		private void PrepareState_Clip(GpuStateStruct* GpuState)
		{
			if (!GL.EnableDisable(GL.GL_SCISSOR_TEST, GpuState->ClipPlaneState.Enabled))
			{
				return;
			}
			var Scissor = &GpuState->ClipPlaneState.Scissor;
			GL.glScissor(
				Scissor->Left * ScaleViewport,
				Scissor->Top * ScaleViewport,
				(Scissor->Right - Scissor->Left) * ScaleViewport,
				(Scissor->Bottom - Scissor->Top) * ScaleViewport
			);
		}
开发者ID:soywiz,项目名称:cspspemu,代码行数:14,代码来源:OpenglGpuImpl.StateDraw.cs


示例18: PrepareState_AlphaTest

		private void PrepareState_AlphaTest(GpuStateStruct* GpuState)
		{
			/*
			if (GlEnableDisable(GL.GL_ALPHA_TEST, GpuState->AlphaTestState.Enabled))
			{
				return;
			}

			GL.AlphaFunc(
				(AlphaFunction)DepthFunctionTranslate[(int)GpuState->AlphaTestState.Function],
				GpuState->AlphaTestState.Value
			);
			*/
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:14,代码来源:GpuImplOpenglEs.StateDraw.cs


示例19: PrepareState

        private void PrepareState(GpuStateStruct* GpuState)
        {
            GL.ColorMask(true, true, true, true);

            PrepareState_Texture(GpuState);
            PrepareState_CullFace(GpuState);
            PrepareState_Colors(GpuState);
            PrepareState_Lighting(GpuState);
            PrepareState_Blend(GpuState);
            PrepareState_Depth(GpuState);
            PrepareState_DepthTest(GpuState);
            PrepareState_Stencil(GpuState);
            PrepareState_AlphaTest(GpuState);

            GL.ShadeModel((GpuState->ShadeModel == ShadingModelEnum.Flat) ? ShadingModel.Flat : ShadingModel.Smooth);
        }
开发者ID:mrcmunir,项目名称:cspspemu,代码行数:16,代码来源:OpenglGpuImpl.State.cs


示例20: StartPrimitive

        public void StartPrimitive(GpuStateStruct* GpuState, State.GuPrimitiveType PrimitiveType, uint VertexAddress, int VertexCount, ref State.VertexTypeStruct VertexType)
        {
            this.GpuState = GpuState;
            this.VertexType = VertexType;
            var ViewMatrix = GpuState->VertexState.ViewMatrix.Matrix4;
            var WorldMatrix = GpuState->VertexState.WorldMatrix.Matrix4;
            ModelMatrix = Matrix4.Mult(ViewMatrix, WorldMatrix);

            this.CurrentPrimitiveType = PrimitiveType;
            WavefrontObjWriter.StartComment("Start: " + this.CurrentPrimitiveType + " : VertexAddress: 0x" + String.Format("{0:X}", VertexAddress) + " : " + VertexCount + " : " + this.VertexType);
            PrimitiveIndices.Clear();

            //throw new NotImplementedException();
            /*
            Console.WriteLine("ViewMatrix (DEMO):");
            Console.WriteLine("{0}", Matrix4.Translation(new Vector3(0f, 0f, -3.5f)));
            Console.WriteLine("ViewMatrix:");
            Console.WriteLine("{0}", ViewMatrix);
            */
        }
开发者ID:e-COS,项目名称:cspspemu,代码行数:20,代码来源:PspWavefrontObjWriter.cs



注:本文中的CSPspEmu.Core.Gpu.State.GpuStateStruct类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Vfs.HleIoDrvFileArg类代码示例发布时间:2022-05-24
下一篇:
C# Cpu.CpuThreadState类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap