本文整理汇总了C#中IRenderer.SetMaterial方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderer.SetMaterial方法的具体用法?C# IRenderer.SetMaterial怎么用?C# IRenderer.SetMaterial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRenderer
的用法示例。
在下文中一共展示了IRenderer.SetMaterial方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(IRenderer r, Node n)
{
if (changed)
{
vertices.Update(data, buffersize);
changed = false;
}
//Root.Instance.UserInterface.Renderer.SetMaterial(material);
r.UseShader(shader);
r.SetMaterial(material);
r.Draw(vertices, PrimitiveType.TRIANGLES, 0, indices.buffer.Length, indices);
}
示例2: 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)
}
//.........这里部分代码省略.........
示例3: Draw
public void Draw(IRenderer r, Node n)
{
r.SetMode(RenderMode.Draw3D);
foreach (Surface s in Surfaces)
{
r.SetMaterial(s.Material);
r.Draw(s.Vbuffer, PrimitiveType.TRIANGLES, 0, s.Ibuffer.buffer.Length, s.Ibuffer);
}
}
示例4: Draw
public void Draw(IRenderer r, Node n)
{
CreateBuffers();
Material mq = Material.CreateSimpleMaterial(Root.Instance.ResourceManager.LoadTexture("revenant.tga"));
mq.twosided = true;
mq.wire = true;
r.SetMode(RenderMode.Draw3D);
r.SetMaterial(mq);
IEffect e = (IEffect)Root.Instance.ResourceManager.Load("shaders/simple.cgfx", typeof(IEffect));
float[] modelview = new float[16];
float[] projection = new float[16];
r.GetMatrix(modelview, projection);
Matrix4 m1 = Matrix4Extensions.FromFloats(modelview);
Matrix4 m2 = Matrix4Extensions.FromFloats(projection);
Matrix4 m3 = m2*m1;
e.SetParameter(e.GetParameter("mvp"), Matrix4Extensions.ToFloats(m3));
e.SetParameter(e.GetParameter("mv"), modelview);
e.SetParameter(e.GetParameter("Color"), new float[] {1,0,0,1 });
e.BeginPass(0);
foreach (Md5Mesh m in Meshes)
{
m.Draw(r,n);
}
e.EndPass(0);
}