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


C# ShaderProgram.SetAttributeBinding方法代码示例

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


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

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

示例2: TextureRenderer

        /// コンストラクタ
        public TextureRenderer()
        {
            shaderTexture = new ShaderProgram( "/Application/shaders/Texture.cgx" );
            shaderTexture.SetAttributeBinding( 0, "a_Position" );
            shaderTexture.SetAttributeBinding( 1, "a_TexCoord" );
            idWVP = shaderTexture.FindUniform( "WorldViewProj" );
            shaderCurrent = shaderTexture;

            vertices = new VertexBuffer( 4, VertexFormat.Float3, VertexFormat.Float2 );

            float[] positions = {
            0.0f, 0.0f, 0.0f,
            0.0f, -1.0f, 0.0f,
            1.0f, 0.0f, 0.0f,
            1.0f, -1.0f, 0.0f,
            };
            float[] texcoords = {
            0.0f, 1.0f,
            0.0f, 0.0f,
            1.0f, 1.0f,
            1.0f, 0.0f,
            };

            vertices.SetVertices( 0, positions );
            vertices.SetVertices( 1, texcoords );
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:27,代码来源:TextureRenderer.cs

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

示例4: GaussianYFilter

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

            // gaussian y
            shaderGaussianY = new ShaderProgram( "/Application/shaders/GaussianY.cgx" );
            shaderGaussianY.SetAttributeBinding( 0, "a_Position" );
            shaderGaussianY.SetAttributeBinding( 1, "a_TexCoord" );
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:10,代码来源:GaussianYFilter.cs

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

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

示例7: Init

        static bool Init()
        {
            graphics = new GraphicsContext();

            //Window size: Change if Tablet, default is Vita
            graphics.SetViewport(0, 0, graphics.Screen.Width, graphics.Screen.Height);

            //Background Color Set
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);

            program = new ShaderProgram("/Application/shaders/VertexColor.cgx");
            program.SetUniformBinding(0, "WorldViewProj");

            //Detect if processing shadow or not

            program.SetUniformBinding(1, "ShadowOn");
            program.SetUniformBinding(2, "LocalLightDirection");
            program.SetUniformBinding(3, "EyePosition");
            program.SetUniformBinding(4, "K_A");
            program.SetUniformBinding(5, "K_D");
            program.SetUniformBinding(6, "K_S");
            program.SetUniformBinding(7, "Shininess");
            program.SetUniformBinding(8, "Modelmatrix");
            program.SetUniformBinding(9, "ModelmatrixIT");
            program.SetUniformBinding(10, "viewMatrix");
            program.SetUniformBinding(11, "projMatrix");

            program.SetAttributeBinding(0, "a_Position");
            program.SetAttributeBinding(1, "a_Color");

            //Select Model
            //model = new Model("house");
            model = new Model("skull");

            //Set buffers to hold position data
            vbuffer = model.SetBuffer();

            //Find size of model to be used  in camera positioning
            model.computeModelDimensions();

            //Set Light Vector
            light = new Light(model.centerX-model.diagonal*1.5f, model.centerY+model.diagonal*1.5f, 0);
            Console.WriteLine (light.light.X + " " + light.light.Y + " " + light.light.Z);
            stopwatch = new Stopwatch();
            stopwatch.Start();

            //Required to render model without holes
            graphics.Enable (EnableMode.DepthTest);
            graphics.Enable(EnableMode.CullFace);
            graphics.SetCullFace(CullFaceMode.Front, CullFaceDirection.Cw);

            return true;
        }
开发者ID:kibblebits,项目名称:TriangleSample,代码行数:53,代码来源:TriangleSample.cs

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

示例9: SSAO

        public SSAO()
        {
            if(ssaoShader == null)
            {
                ssaoShader = new ShaderProgram(VFS.GetFileBytes("vfs1:/shaders/SSAO.cgx"));
                ssaoShader.SetAttributeBinding(0, "a_Position");
                ssaoShader.SetAttributeBinding(1, "a_TexCoord");
            }

            if(fsq == null)
            {
                fsq = new RenderNode(RenderableFactory.CreatePlane(1, 1), this);
            }
        }
开发者ID:himanshugoel2797,项目名称:Aperture3D-PSM,代码行数:14,代码来源:SSAO.cs

示例10: Init

 /// シェーダのセット
 public static void Init( string vshName, string fshName )
 {
     // vertex color shader
     debShader = new ShaderProgram( vshName, fshName );
     debShader.SetAttributeBinding( 0, "a_Position" );
     debUIdWVP = debShader.FindUniform( "WorldViewProj" );
 }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:8,代码来源:RenderGeometry.cs

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

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

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

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

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


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