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


C# IRenderer.Draw方法代码示例

本文整理汇总了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;
        }
开发者ID:monocraft,项目名称:Core2D,代码行数:34,代码来源:ProjectViewer.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: 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);
                }
            }
        }
开发者ID:3DInstruments,项目名称:Kaliber3D,代码行数:56,代码来源:XArc.cs

示例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);
                    }
                }
            }
        }
开发者ID:monocraft,项目名称:Test2d,代码行数:53,代码来源:XPath.cs

示例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);
            }
        }
开发者ID:3DInstruments,项目名称:Kaliber3D,代码行数:19,代码来源:XRectangle.cs

示例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);
                }
            }
        }
开发者ID:cody82,项目名称:spacewar-arena,代码行数:22,代码来源:Terrain.cs

示例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);
                }
            }
        }
开发者ID:monocraft,项目名称:Test2d,代码行数:44,代码来源:XLine.cs

示例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);
     }
 }
开发者ID:cody82,项目名称:spacewar-arena,代码行数:9,代码来源:Doom3Map.cs

示例9: Draw

 public void Draw(IRenderer r, Node n)
 {
     r.Draw(vb, PrimitiveType.TRIANGLES, 0, Triangles.Length * 3, ib);
 }
开发者ID:cody82,项目名称:spacewar-arena,代码行数:4,代码来源:Doom3Md5.cs

示例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);
        }
开发者ID:cody82,项目名称:spacewar-arena,代码行数:9,代码来源:windows.cs


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