本文整理汇总了C#中IRenderer.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderer.Draw方法的具体用法?C# IRenderer.Draw怎么用?C# IRenderer.Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRenderer
的用法示例。
在下文中一共展示了IRenderer.Draw方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToViewbox
/// <summary>
///
/// </summary>
/// <param name="container"></param>
/// <param name="renderer"></param>
/// <returns></returns>
private static Viewbox ToViewbox(Container container, IRenderer renderer)
{
var visual = new DrawingVisual();
using (var dc = visual.RenderOpen())
{
renderer.Draw(dc, container, container.Properties, null);
}
visual.Drawing.Freeze();
var host = new VisualHost()
{
Width = container.Width,
Height = container.Height
};
host.Visuals.Add(visual);
var vb = new Viewbox()
{
Stretch = Stretch.Uniform
};
vb.Child = host;
return vb;
}
示例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();
}
示例3: Draw
/// <summary>
///
/// </summary>
/// <param name="dc"></param>
/// <param name="renderer"></param>
/// <param name="dx"></param>
/// <param name="dy"></param>
/// <param name="db"></param>
/// <param name="r"></param>
public override void Draw(object dc, IRenderer renderer, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
{
var record = r ?? this.Data.Record;
if (State.Flags.HasFlag(ShapeStateFlags.Visible))
{
renderer.Draw(dc, this, dx, dy, db, record);
}
if (renderer.State.SelectedShape != null)
{
if (this == renderer.State.SelectedShape)
{
_point1.Draw(dc, renderer, dx, dy, db, record);
_point2.Draw(dc, renderer, dx, dy, db, record);
_point3.Draw(dc, renderer, dx, dy, db, record);
_point4.Draw(dc, renderer, dx, dy, db, record);
}
else if (_point1 == renderer.State.SelectedShape)
{
_point1.Draw(dc, renderer, dx, dy, db, record);
}
else if (_point2 == renderer.State.SelectedShape)
{
_point2.Draw(dc, renderer, dx, dy, db, record);
}
else if (_point3 == renderer.State.SelectedShape)
{
_point3.Draw(dc, renderer, dx, dy, db, record);
}
else if (_point4 == renderer.State.SelectedShape)
{
_point4.Draw(dc, renderer, dx, dy, db, record);
}
}
if (renderer.State.SelectedShapes != null)
{
if (renderer.State.SelectedShapes.Contains(this))
{
_point1.Draw(dc, renderer, dx, dy, db, record);
_point2.Draw(dc, renderer, dx, dy, db, record);
_point3.Draw(dc, renderer, dx, dy, db, record);
_point4.Draw(dc, renderer, dx, dy, db, record);
}
}
}
示例4: Draw
/// <summary>
///
/// </summary>
/// <param name="dc"></param>
/// <param name="renderer"></param>
/// <param name="dx"></param>
/// <param name="dy"></param>
/// <param name="db"></param>
/// <param name="r"></param>
public override void Draw(object dc, IRenderer renderer, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
{
var record = r ?? this.Record;
if (State.HasFlag(ShapeState.Visible))
{
renderer.Draw(dc, this, dx, dy, db, record);
}
if (renderer.State.SelectedShape != null)
{
if (this == renderer.State.SelectedShape)
{
var points = this.GetAllPoints();
foreach (var point in points)
{
point.Draw(dc, renderer, dx, dy, db, record);
}
}
else
{
var points = this.GetAllPoints();
foreach (var point in points)
{
if (point == renderer.State.SelectedShape)
{
point.Draw(dc, renderer, dx, dy, db, record);
}
}
}
}
if (renderer.State.SelectedShapes != null)
{
if (renderer.State.SelectedShapes.Contains(this))
{
var points = this.GetAllPoints();
foreach (var point in points)
{
point.Draw(dc, renderer, dx, dy, db, record);
}
}
}
}
示例5: Draw
/// <summary>
///
/// </summary>
/// <param name="dc"></param>
/// <param name="renderer"></param>
/// <param name="dx"></param>
/// <param name="dy"></param>
/// <param name="db"></param>
/// <param name="r"></param>
public override void Draw(object dc, IRenderer renderer, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
{
var record = r ?? this.Data.Record;
if (State.Flags.HasFlag(ShapeStateFlags.Visible))
{
renderer.Draw(dc, this, dx, dy, db, record);
base.Draw(dc, renderer, dx, dy, db, record);
}
}
示例6: Draw
public virtual void Draw(IRenderer r, Node n)
{
for (int y = 0; y < Patches.GetLength(0); ++y)
{
for (int x = 0; x < Patches.GetLength(0); ++x)
{
Lod[x, y] = CalcLod(Root.Instance.Scene.camera,x, y);
}
}
//r.UseShader(Root.Instance.ResourceManager.LoadShader("simple3d.shader"));
for (int y = 0; y < Patches.GetLength(0); ++y)
{
for (int x = 0; x < Patches.GetLength(0); ++x)
{
Patch p=Patches[x,y];
IndexBuffer i = Levels[Lod[x, y]].GetBuffer(MustFixTop(x, y), MustFixBottom(x, y), MustFixLeft(x, y), MustFixRight(x, y));
r.Draw(p.Vertices, PrimitiveType.TRIANGLESTRIP, 0, i.buffer.Length, i);
}
}
}
示例7: Draw
/// <summary>
///
/// </summary>
/// <param name="dc"></param>
/// <param name="renderer"></param>
/// <param name="dx"></param>
/// <param name="dy"></param>
/// <param name="db"></param>
/// <param name="r"></param>
public override void Draw(object dc, IRenderer renderer, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
{
var record = r ?? this.Record;
if (State.HasFlag(ShapeState.Visible))
{
renderer.Draw(dc, this, dx, dy, db, record);
}
if (renderer.State.SelectedShape != null)
{
if (this == renderer.State.SelectedShape)
{
_start.Draw(dc, renderer, dx, dy, db, record);
_end.Draw(dc, renderer, dx, dy, db, record);
}
else if (_start == renderer.State.SelectedShape)
{
_start.Draw(dc, renderer, dx, dy, db, record);
}
else if (_end == renderer.State.SelectedShape)
{
_end.Draw(dc, renderer, dx, dy, db, record);
}
}
if (renderer.State.SelectedShapes != null)
{
if (renderer.State.SelectedShapes.Contains(this))
{
_start.Draw(dc, renderer, dx, dy, db, record);
_end.Draw(dc, renderer, dx, dy, db, record);
}
}
}
示例8: 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);
}
}
示例9: Draw
public void Draw(IRenderer r, Node n)
{
r.Draw(vb, PrimitiveType.TRIANGLES, 0, Triangles.Length * 3, ib);
}
示例10: DrawInternal
public override void DrawInternal(IRenderer r, RectangleF rect)
{
base.DrawInternal(r, rect);
r.SetMode(RenderMode.Draw3DPointSprite);
r.UseShader(Shader);
r.Draw(PointBuffer, PrimitiveType.POINTS, 0, Count, null);
r.SetMode(RenderMode.Draw2D);
}