当前位置: 首页>>代码示例>>C#>>正文


C# ShaderProgram.SetUniformValue方法代码示例

本文整理汇总了C#中ShaderProgram.SetUniformValue方法的典型用法代码示例。如果您正苦于以下问题:C# ShaderProgram.SetUniformValue方法的具体用法?C# ShaderProgram.SetUniformValue怎么用?C# ShaderProgram.SetUniformValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ShaderProgram的用法示例。


在下文中一共展示了ShaderProgram.SetUniformValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DepthOfFealdFilter

        /// コンストラクタ
        public DepthOfFealdFilter()
        {
            texRenderer = new TextureRenderer();

            // DOF
            shaderDOF = new ShaderProgram( "/Application/shaders/DOF.cgx" );
            shaderDOF.SetAttributeBinding( 0, "a_Position" );
            shaderDOF.SetAttributeBinding( 1, "a_TexCoord" );

            shaderDOF.SetUniformValue( shaderDOF.FindUniform( "FocusDepth" ), 0.0f );
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:12,代码来源:DepthOfFealdFilter.cs

示例2: SetShaderProgramOptions

        public override void SetShaderProgramOptions(RenderNode renderer)
        {
            Matrix4 WVP = RootNode.GetCurrentScene().ProjectionMatrix * RootNode.GetCurrentScene().Camera.ViewMatrix * renderer.WorldMatrix;

            try{
            depth.SetUniformValue(0, ref WVP);
            }catch(ObjectDisposedException)
            {
                depth = new ShaderProgram(VFS.GetFileBytes("vfs1:/shaders/Depth.cgx"));
                depth.SetAttributeBinding(0, "a_Position");
                depth.SetUniformBinding(0, "WorldViewProj");
                depth.SetUniformValue(0, ref WVP);
                RootNode.graphicsContext.SetShaderProgram(depth);
            }

            RootNode.graphicsContext.SetFrameBuffer(RenderPassBuf);
        }
开发者ID:himanshugoel2797,项目名称:Aperture3D-PSM,代码行数:17,代码来源:Depth.cs

示例3: startup

        protected void startup()
        {
            // Set up the graphics system
            graphics = new GraphicsContext();
            graphics.SetViewport(0, 0, graphics.Screen.Width, graphics.Screen.Height);
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Enable(EnableMode.Blend);
            graphics.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.SrcAlpha, BlendFuncFactor.OneMinusSrcAlpha);

            program = new ShaderProgram("/Application/shaders/Simple.cgx");

            program.SetUniformBinding(0, "WorldViewProj");
            program.SetAttributeBinding(0, "a_Position");
            program.SetAttributeBinding(1, "a_TexCoord");
            program.SetAttributeBinding(2, "a_Color");

            Matrix4 unitScreenMatrix = new Matrix4(
                 2.0f / graphics.Screen.Width, 0.0f, 0.0f, 0.0f,
                 0.0f, -2.0f / graphics.Screen.Height,  0.0f, 0.0f,
                 0.0f, 0.0f, 1.0f, 0.0f,
                 -1.0f, 1.0f, 0.0f, 1.0f
            );

            program.SetUniformValue(0, ref unitScreenMatrix);

            videoBuffer = new byte[VIDEO_WIDTH * VIDEO_HEIGHT * 4];

            texture = new Texture2D(512, 512, false, PixelFormat.Rgba);
            texture.SetFilter(VIDEO_FILTER ? TextureFilterMode.Linear : TextureFilterMode.Nearest);

            float tx = (float) VIDEO_WIDTH / (float) texture.Width;
            float ty = (float) VIDEO_HEIGHT / (float) texture.Height;

            screenTexcoords = new float[] {
                0.0f, 0.0f, // 0 top left.
                0.0f, ty, // 1 bottom left.
                tx, 0.0f, // 2 top right.
                tx, ty, // 3 bottom right.
            };

            defaultTexcoords = new float[] {
                0.0f, 0.0f, // 0 top left.
                0.0f, 1.0f, // 1 bottom left.
                1.0f, 0.0f, // 2 top right.
                1.0f, 1.0f, // 3 bottom right.
            };

            colors = new float[] {
                1.0f,   1.0f,   1.0f,   1.0f,   // 0 top left.
                1.0f,   1.0f,   1.0f,   1.0f,   // 1 bottom left.
                1.0f,   1.0f,   1.0f,   1.0f,   // 2 top right.
                1.0f,   1.0f,   1.0f,   1.0f,   // 3 bottom right.
            };

            vertexCount = vertices.Length / 3;

            vertexBuffer = new VertexBuffer(vertexCount,
                                            VertexFormat.Float3,
                                            VertexFormat.Float2,
                                            VertexFormat.Float4);

            //vertexBuffer.SetVertices(0, vertices);
            //vertexBuffer.SetVertices(1, texcoords);
            //vertexBuffer.SetVertices(2, colors);

            /////

            int fontSize = 14;

            normalFont = new Font(FontAlias.System, fontSize, FontStyle.Regular);

            /////

            emu = new EmulatorApplication(this);
            emu.initialize();

            statistics = new Statistics();
        }
开发者ID:rosc77,项目名称:vita64,代码行数:78,代码来源:VitaUI.cs


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