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


C# ShaderProgram.SetUniformBinding方法代码示例

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


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

示例1: init

        public static void init()
        {
            if (shaderUniversal == null){
                shaderUniversal = new ShaderProgram("/Application/shaders/Universal.cgx");

                shaderUniversal.SetAttributeBinding(0, "a_Position");
                shaderUniversal.SetAttributeBinding(1, "a_VertexColor");
                shaderUniversal.SetAttributeBinding(2, "a_TexCoord");

                shaderUniversal.SetUniformBinding(0, "u_SceneMatrix");
                shaderUniversal.SetUniformBinding(1, "u_ScreenMatrix");
                shaderUniversal.SetUniformBinding(2, "u_Alpha");

                texture = new Texture2D("/Application/assets/texturepack/rymdkapsel-hd.png", false);
                texture.SetFilter(TextureFilterMode.Disabled);
                texture.SetWrap(TextureWrapMode.ClampToEdge);
                texture.SetMaxAnisotropy(0);
            }

            if (shaderColored == null){
                shaderColored = new ShaderProgram("/Application/shaders/Colored.cgx");

                shaderColored.SetAttributeBinding(0, "a_Position");
                shaderColored.SetAttributeBinding(1, "a_VertexColor");

                shaderColored.SetUniformBinding(0, "u_SceneMatrix");
                shaderColored.SetUniformBinding(1, "u_ScreenMatrix");
                shaderColored.SetUniformBinding(2, "u_Alpha");
            }
        }
开发者ID:JimmyDeemo,项目名称:openfl-psm,代码行数:30,代码来源:RendererUniversal.cs

示例2: init

 public static void init()
 {
     if (program == null){
         program = new ShaderProgram("/Application/shaders/Textured.cgx");
         program.SetUniformBinding(0, "u_SceneMatrix");
         program.SetUniformBinding(1, "u_ScreenMatrix");
         program.SetUniformBinding(2, "u_Alpha");
         program.SetAttributeBinding(0, "a_Position");
         program.SetAttributeBinding(1, "a_TexCoord");
     }
 }
开发者ID:JimmyDeemo,项目名称:openfl-psm,代码行数:11,代码来源:RendererTextured.cs

示例3: Initialize

 public static void Initialize()
 {
     // Set up the graphics system
     graphics = new GraphicsContext ();
     shader = new ShaderProgram("/Application/shaders/Simple.cgx");
     shader.SetUniformBinding(0, "u_viewMatrix");
     shader.SetUniformBinding(1, "u_projMatrix");
     shader.SetUniformBinding(2, "u_worldMatrix");
     SetUpCamera();
     SetUpVertices();
     graphics.SetVertexBuffer(0, vBuffer);
 }
开发者ID:neoemonk,项目名称:psm,代码行数:12,代码来源:AppMain.cs

示例4: Simple

        public Simple(Vector4 col)
        {
            if(simpleShader == null)
            {
                simpleShader = new ShaderProgram(VFS.GetFileBytes("vfs1:/shaders/Simple.cgx"));
                simpleShader.SetAttributeBinding(0, "a_Position");
                simpleShader.SetAttributeBinding(1, "a_TexCoord");
                simpleShader.SetUniformBinding(0, "WorldViewProj");
                simpleShader.SetUniformBinding(1, "MaterialColor");
            }

            Color = col;
        }
开发者ID:himanshugoel2797,项目名称:Aperture3D-PSM,代码行数:13,代码来源:Simple.cs

示例5: Initialize

		public static void Initialize ()
		{
			// Set up the graphics system
			graphics = new GraphicsContext ();
#if BUILD_FOR_PSV
			program = new ShaderProgram("/Application/shaders/Texture.cgx");
#else
			program = new ShaderProgram("/Application/shaders/Texture_sim.cgx");
#endif
			program.SetUniformBinding(0, "WorldViewProj");
			program.SetAttributeBinding(0, "a_Position");
			program.SetAttributeBinding(1, "a_TexCoord");
			vertices = new VertexBuffer(4, VertexFormat.Float3, VertexFormat.Float2);

			float[] positions = {
				-1.0f, 1.0f, 0.0f,
				-1.0f, -1.0f, 0.0f,
				1.0f, 1.0f, 0.0f,
				1.0f, -1.0f, 0.0f,
			};
			float[] texcoords = {
				0.0f, 0.0f,
				0.0f, 1.0f,
				1.0f, 0.0f,
				1.0f, 1.0f,
			};
			vertices.SetVertices(0, positions);
			vertices.SetVertices(1, texcoords);
			texture = new Texture2D(256, 224, false, PixelFormat.Rgb565);
			
			SampleDraw.Init(graphics);
			
		}
开发者ID:Theswweet,项目名称:PSV-FC,代码行数:33,代码来源:AppMain.cs

示例6: Sprite

        public Sprite(GraphicsContext graphics, Texture2D texture)
        {
            if(shaderProgram == null)
            {
                shaderProgram = new ShaderProgram("/Application/shaders/Sprite.cgx");
                shaderProgram.SetUniformBinding(0, "u_WorldMatrix");
            }

            if (texture == null)
            {
                throw new Exception("ERROR: texture is null.");
            }

            this.graphics = graphics;
            this.texture = texture;
            this.width = texture.Width;
            this.height = texture.Height;

            indices = new ushort[indexSize];
            indices[0] = 0;
            indices[1] = 1;
            indices[2] = 2;
            indices[3] = 3;

            vertexBuffer = new VertexBuffer(4, indexSize, VertexFormat.Float3,
                                            VertexFormat.Float2, VertexFormat.Float4);
        }
开发者ID:andierocca,项目名称:destructive-santa,代码行数:27,代码来源:Sprite.cs

示例7: PatternGrid

        public PatternGrid(GraphicsContext graphics, Texture2D texture, Vector2 position, Vector2 size)
        {
            if(shaderProgram == null)
            {
                //shaderProgram=CreateSimpleSpriteShader();
                shaderProgram = new ShaderProgram("/Application/shaders/Sprite.cgx");
                shaderProgram.SetUniformBinding(0, "u_WorldMatrix");
            }

            //if (texture == null)
            //{
            //	throw new Exception("ERROR: texture is null.");
            //}

            this.graphics = graphics;
            //this.texture = texture;
            this.texture = new Texture2D("/Application/resources/textures512.png", false);
            this.width = size.X;
            this.height = size.Y;
            this.origin = position;

            //@e                                                Vertex coordinate,               Texture coordinate,     Vertex color
            //vertexBuffer = new VertexBuffer(4, indexSize, VertexFormat.Float3, VertexFormat.Float2, VertexFormat.Float4);
            vertexBuffer = new VertexBuffer(NUMVERTICES, VertexFormat.Float3, VertexFormat.Float2, VertexFormat.Float4);
        }
开发者ID:james7780,项目名称:PXDrumVita,代码行数:25,代码来源:PatternGrid.cs

示例8: Ubershader

        public Ubershader()
        {
            if(ubershader == null)
            {
                ubershader = new ShaderProgram(VFS.GetFileBytes("vfs1:/shaders/Ubershader.cgx"));
                ubershader.SetAttributeBinding(0, "a_Position");
                ubershader.SetAttributeBinding(1, "a_TexCoord");
                ubershader.SetAttributeBinding(2, "a_Normal");
                ubershader.SetAttributeBinding(3, "a_Tangent");

                ubershader.SetUniformBinding(0, "WorldViewProj");
                ubershader.SetUniformBinding(1, "World");
                ubershader.SetUniformBinding(2, "LightDir");
                ubershader.SetUniformBinding(3, "ViewDir");
                ubershader.SetUniformBinding(4, "heightScale");
            }
        }
开发者ID:himanshugoel2797,项目名称:Aperture3D-PSM,代码行数:17,代码来源:Ubershader.cs

示例9: CreateLineShader

        //@e Initialization of shader program
        //@j シェーダープログラムの初期化。
        public static ShaderProgram CreateLineShader()
        {
            Byte[] dataBuffer=Utility.ReadEmbeddedFile("TutoLib.shaders.Line.cgx");
            ShaderProgram shaderProgram = new ShaderProgram(dataBuffer);
            shaderProgram.SetUniformBinding(0, "u_WorldMatrix");

            return shaderProgram;
        }
开发者ID:Transwarmer,项目名称:Transwarmer,代码行数:10,代码来源:LineB.cs

示例10: Add

 public static void Add(string name, string[] uniformBindings, string[] attributeBindings)
 {
     ShaderProgram sp=new ShaderProgram("/Application/shaders/"+name+".cgx");
     for (int i = 0; i < uniformBindings.Length; i++)
         sp.SetUniformBinding(i, uniformBindings[i]);
     for (int i = 0; i < attributeBindings.Length; i++)
         sp.SetAttributeBinding(i, uniformBindings[i]);
     _shaders[name]=sp;
 }
开发者ID:TastyWithPasta,项目名称:pastalib_psm,代码行数:9,代码来源:Shaders.cs

示例11: 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

示例12: Depth

        public Depth()
        {
            if(depth == null)
            {
                depth = new ShaderProgram(VFS.GetFileBytes("vfs1:/shaders/Depth.cgx"));
                depth.SetAttributeBinding(0, "a_Position");
                depth.SetUniformBinding(0, "WorldViewProj");
            }

            RenderPassTarget = new Texture2D((int)RootNode.graphicsContext.GetDisplay().Width,
                                             (int)RootNode.graphicsContext.GetDisplay().Height
                                             , false, PixelFormat.Rgba, PixelBufferOption.Renderable);
            RenderPassBuf = new FrameBuffer();
            RenderPassBuf.SetColorTarget(RenderPassTarget,0);

            DepthBuffer temp = new DepthBuffer(RenderPassTarget.Width, RenderPassTarget.Height, PixelFormat.Depth24Stencil8);
            RenderPassBuf.SetDepthTarget(temp);
        }
开发者ID:himanshugoel2797,项目名称:Aperture3D-PSM,代码行数:18,代码来源:Depth.cs

示例13: Sprite

        public Sprite(GraphicsContext graphics, Texture2D texture)
        {
            if(shaderProgram == null)
            {
                //shaderProgram=CreateSimpleSpriteShader();
                shaderProgram = new ShaderProgram("/Application/shaders/Sprite.cgx");
                shaderProgram.SetUniformBinding(0, "u_WorldMatrix");
            }

            if (texture == null)
            {
                throw new Exception("ERROR: texture is null.");
            }

            this.graphics = graphics;
            this.texture = texture;
            this.width = texture.Width;
            this.height = texture.Height;

            vertices[0]=0.0f;	// x0
            vertices[1]=0.0f;	// y0
            vertices[2]=0.0f;	// z0

            vertices[3]=0.0f;	// x1
            vertices[4]=1.0f;	// y1
            vertices[5]=0.0f;	// z1

            vertices[6]=1.0f;	// x2
            vertices[7]=0.0f;	// y2
            vertices[8]=0.0f;	// z2

            vertices[9]=1.0f;	// x3
            vertices[10]=1.0f;	// y3
            vertices[11]=0.0f;	// z3

            indices = new ushort[indexSize];
            indices[0] = 0;
            indices[1] = 1;
            indices[2] = 2;
            indices[3] = 3;

            //@e                                                Vertex coordinate,               Texture coordinate,     Vertex color
            vertexBuffer = new VertexBuffer(4, indexSize, VertexFormat.Float3, VertexFormat.Float2, VertexFormat.Float4);
        }
开发者ID:james7780,项目名称:PXDrumVita,代码行数:44,代码来源:Sprite.cs

示例14: DrawHelpers

        uint m_view_matrix_tag; // check for ViewMatrix update

        #endregion Fields

        #region Constructors

        /// <summary>
        /// </summary>
        /// <param name="gl">The core graphics context.</param>
        /// <param name="max_vertices">The maximum number of vertices you will be able to
        /// write in one frame with this DrawHelpers object.</param>
        public DrawHelpers( GraphicsContextAlpha gl, uint max_vertices )
        {
            GL = gl;

            {
                m_shader_program = Common.CreateShaderProgram("default.cgx");

                m_shader_program.SetUniformBinding( 0, "MVP" ) ;
                m_shader_program.SetAttributeBinding( 0, "p" ) ;
                m_shader_program.SetAttributeBinding( 1, "vin_color" ) ;
            }

            m_current_color = Colors.Magenta;
            m_shader_depth = 0;
            m_view_matrix_tag = unchecked((uint)-1);
            m_model_matrix_tag = unchecked((uint)-1);
            m_projection_matrix_tag = unchecked((uint)-1);

            m_imm = new ImmediateMode<Vertex>( gl, max_vertices, null, 0, 0, VertexFormat.Float4, VertexFormat.Float4 );
        }
开发者ID:artron33,项目名称:PsmFramework,代码行数:31,代码来源:DrawHelpers.cs

示例15: CreatePackedSpriteShader

    //@e Initialization of shader program
    //@j シェーダープログラムの初期化。
    private static ShaderProgram CreatePackedSpriteShader()
    {
        string resourceName = "TutoLib.shaders.PackedSprite.cgx";

        Byte[] dataBuffer = Utility.ReadEmbeddedFile(resourceName);

        ShaderProgram shaderProgram = new ShaderProgram(dataBuffer);

        shaderProgram.SetAttributeBinding(0,"a_Position");
        shaderProgram.SetAttributeBinding(1,"a_Color");
        shaderProgram.SetUniformBinding(0,"u_WVP");

        return shaderProgram;
    }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:16,代码来源:PackedIndexedSprite.cs


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