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


C# IRenderer.SetUniform方法代码示例

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


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

示例1: Draw

        public void Draw(IRenderer r, Node n)
        {
            //r.SetMode(RenderMode.Draw3D);
            //r.SetMode(RenderMode.Draw3DPointSprite);
            r.UseShader(Root.Instance.ResourceManager.LoadShader("terrain.shader"));
            Material.NoLighting = false;
            r.SetMaterial(Material);
            Material.Apply(Root.Instance.ResourceManager.LoadShader("terrain.shader"), r);
            //r.BindTexture(Color,0);
            //r.BindTexture(Detail,1);

            if (scamap != null)
            {
                Shader s = Root.Instance.ResourceManager.LoadShader("terrain.supcom.shader");
                r.UseShader(s);

                r.SetUniform(s.GetUniformLocation("LowerAlbedo"), new int[] { 0 });
                r.BindTexture(Root.Instance.ResourceManager.LoadTexture(scamap.Layers[0].PathTexture).Id, 0);

                r.SetUniform(s.GetUniformLocation("Albedo0"), new int[] { 1 });
                r.BindTexture(Root.Instance.ResourceManager.LoadTexture(scamap.Layers[1].PathTexture).Id, 1);

                r.SetUniform(s.GetUniformLocation("Albedo1"), new int[] { 2 });
                r.BindTexture(Root.Instance.ResourceManager.LoadTexture(scamap.Layers[2].PathTexture).Id, 2);

                r.SetUniform(s.GetUniformLocation("Albedo2"), new int[] { 3 });
                r.BindTexture(Root.Instance.ResourceManager.LoadTexture(scamap.Layers[3].PathTexture).Id, 3);

                r.SetUniform(s.GetUniformLocation("Albedo3"), new int[] { 4 });
                r.BindTexture(Root.Instance.ResourceManager.LoadTexture(scamap.Layers[4].PathTexture).Id, 4);

                r.SetUniform(s.GetUniformLocation("UpperAlbedo"), new int[] { 5 });
                r.BindTexture(Root.Instance.ResourceManager.LoadTexture(scamap.Layers[5].PathTexture).Id, 5);

                r.SetUniform(s.GetUniformLocation("Mask"), new int[] { 6 });
                r.BindTexture(Material.diffusemap.Id, 6);
                r.SetUniform(s.GetUniformLocation("NormalMap"), new int[] { 7 });
                r.BindTexture(Material.DetailMap.Id, 7);

                r.SetUniform(s.GetUniformLocation("TerrainScale"), new float[] { 10.0f});
                r.SetUniform(s.GetUniformLocation("LowerAlbedoTile"), new float[] { scamap.Layers[0].ScaleTexture });
                r.SetUniform(s.GetUniformLocation("Albedo0Tile"), new float[] { scamap.Layers[1].ScaleTexture });
                r.SetUniform(s.GetUniformLocation("Albedo1Tile"), new float[] { scamap.Layers[2].ScaleTexture });
                r.SetUniform(s.GetUniformLocation("Albedo2Tile"), new float[] { scamap.Layers[3].ScaleTexture });
                r.SetUniform(s.GetUniformLocation("Albedo3Tile"), new float[] { scamap.Layers[4].ScaleTexture });
                r.SetUniform(s.GetUniformLocation("UpperAlbedoTile"), new float[] { scamap.Layers[5].ScaleTexture });
            }
            else
            {
                r.UseShader(Root.Instance.ResourceManager.LoadShader("terrain.shader"));
                r.SetMaterial(Material);
                Material.Apply(Root.Instance.ResourceManager.LoadShader("terrain.shader"), r);
            }
            /*for(int x=0;x<PatchCount;++x)
            {
                for(int y=0;y<PatchCount;++y)
                {
                    Patches[y][x].Visible=false;
                }
            }*/

            ArrayList list=new ArrayList();
            Tree.GetVisibleLeafs(Root.Instance.Scene.camera,list);
            int frame=Root.Instance.frame;
            foreach(QuadTree q in list)
            {
                Patches[q.Position.Y][q.Position.X].VisibleFrame=frame;
            }
            int x,y;
            //for(int x=0;x<PatchCount;++x)
            {
                //for(int y=0;y<PatchCount;++y)
                foreach(QuadTree q in list)
                {
                    x=q.Position.X;
                    y=q.Position.Y;
                    //if(Patches[y][x].Visible)
                        Patches[y][x].Level=CalcLevel(x,y,Root.Instance.Scene.camera);
                }
            }
            //for(int x=0;x<PatchCount;++x)
            {
                //for(int y=0;y<PatchCount;++y)
                {
                    //if(Patches[y][x].Visible)
                    foreach(QuadTree q in list)
                    {
                        x=q.Position.X;
                        y=q.Position.Y;
                        Patches[y][x].FixCracks();
                        Patches[y][x].Draw(r,n);
                    }
                }
            }
            /*for(int x=0;x<PatchCount;++x)
            {
                for(int y=0;y<PatchCount;++y)
                {
                    if(Patches[y][x].Visible)
                }
//.........这里部分代码省略.........
开发者ID:cody82,项目名称:spacewar-arena,代码行数:101,代码来源:Terrain.cs

示例2: Draw

        public void Draw(IRenderer r, Node n)
        {
            if (Age > LifeTime)
                return;

            r.SetMode(RenderMode.Draw3D);
            r.SetMaterial(Mat);
            r.BindTexture(Mat.diffusemap.Id);
            r.UseShader(Shader);
            r.SetUniform(Shader.GetUniformLocation("Alpha"), new float[] { CurrentAlpha });

            float s = CurrentSize / 2;
            Matrix4 m = BaseMatrix * Matrix4Extensions.FromScale(s, s, s);
            r.PushMatrix();
            r.MultMatrix(m);
            r.Draw(Vertices, PrimitiveType.QUADS, 0, 4, null);
            r.PopMatrix();
        }
开发者ID:cody82,项目名称:spacewar-arena,代码行数:18,代码来源:effects.cs

示例3: SetRenderParameters

        public override void SetRenderParameters(IRenderer r, IDrawable draw, Shader shade)
        {
            base.SetRenderParameters(r, draw, shade);

            int i;
            if ((i=shade.GetUniformLocation("Color"))>=0)
            {
                Color4f c=SpaceWar2006.GameObjects.Team.Colors[Team];
                r.SetUniform(i, new float[] { c.r, c.g, c.b, c.a });
            }
        }
开发者ID:cody82,项目名称:spacewar-arena,代码行数:11,代码来源:game.cs

示例4: SetRenderParameters

        public override void SetRenderParameters(IRenderer r, IDrawable draw, Shader shade)
        {
            base.SetRenderParameters(r, draw, shade);

            r.SetUniform(shade.GetUniformLocation("Alpha"), new float[] { 1.0f - age });
        }
开发者ID:cody82,项目名称:spacewar-arena,代码行数:6,代码来源:weapons.cs


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