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


C# IVertexSource.rewind方法代码示例

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


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

示例1: Save

 public static void Save(IVertexSource vertexSource, string pathAndFileName, bool oldStyle = true)
 {
     if (oldStyle)
     {
         using (StreamWriter outFile = new StreamWriter(pathAndFileName))
         {
             vertexSource.rewind(0);
             double x;
             double y;
             ShapePath.FlagsAndCommand flagsAndCommand = vertexSource.vertex(out x, out y);
             do
             {
                 outFile.WriteLine("{0}, {1}, {2}", x, y, flagsAndCommand.ToString());
                 flagsAndCommand = vertexSource.vertex(out x, out y);
             }
             while (flagsAndCommand != ShapePath.FlagsAndCommand.CommandStop);
         }
     }
     else
     {
         using (StreamWriter outFile = new StreamWriter(pathAndFileName))
         {
             foreach (VertexData vertexData in vertexSource.Vertices())
             {
                 outFile.WriteLine("{0}, {1}, {2}", vertexData.position.x, vertexData.position.y, vertexData.command.ToString());
             }
         }
     }
 }
开发者ID:jeske,项目名称:agg-sharp,代码行数:29,代码来源:VertexSourceIO.cs

示例2: TriangulateFaces

		public static Mesh TriangulateFaces(IVertexSource vertexSource)
		{
			vertexSource.rewind();
			CachedTesselator teselatedSource = new CachedTesselator();
            VertexSourceToTesselator.SendShapeToTesselator(teselatedSource, vertexSource);

			Mesh extrudedVertexSource = new Mesh();

			int numIndicies = teselatedSource.IndicesCache.Count;

			// build the top first so it will render first when we are translucent
			for (int i = 0; i < numIndicies; i += 3)
			{
				Vector2 v0 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 0].Index].Position;
				Vector2 v1 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 1].Index].Position;
				Vector2 v2 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 2].Index].Position;
				if (v0 == v1 || v1 == v2 || v2 == v0)
				{
					continue;
				}

				Vertex topVertex0 = extrudedVertexSource.CreateVertex(new Vector3(v0, 0));
				Vertex topVertex1 = extrudedVertexSource.CreateVertex(new Vector3(v1, 0));
				Vertex topVertex2 = extrudedVertexSource.CreateVertex(new Vector3(v2, 0));

				extrudedVertexSource.CreateFace(new Vertex[] { topVertex0, topVertex1, topVertex2 });
			}

			return extrudedVertexSource;
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:30,代码来源:VertexSourceToMesh.cs

示例3: Render

        public override void Render(IVertexSource vertexSource, int pathIndexToRender, RGBA_Bytes colorBytes)
        {
#if use_timers
            OpenGLRenderTimer.Start();
#endif
            PushOrthoProjection();

            vertexSource.rewind(pathIndexToRender);

            RGBA_Doubles color = colorBytes.GetAsRGBA_Doubles();

            Gl.glColor4d(color.m_r, color.m_g, color.m_b, color.m_a);

            Affine transform = GetTransform();
            if (!transform.is_identity())
            {
                vertexSource = new conv_transform(vertexSource, transform);
            }

            if (m_ForceTexturedEdgeAntiAliasing)
            {
                DrawAAShape(vertexSource);
            }
            else
            {
                SendShapeToTeselator(m_RenderNowTesselator, vertexSource);
            }

            PopOrthoProjection();
#if use_timers
            OpenGLRenderTimer.Stop();
#endif
        }
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:33,代码来源:RendererOpenGL.cs

示例4: concat_path

 public void concat_path(IVertexSource vs, int path_id)
 {
     double x, y;
     ShapePath.FlagsAndCommand PathAndFlags;
     vs.rewind(path_id);
     while (!ShapePath.is_stop(PathAndFlags = vs.vertex(out x, out y)))
     {
         vertices.AddVertex(x, y, PathAndFlags);
     }
 }
开发者ID:jeske,项目名称:agg-sharp,代码行数:10,代码来源:PathStorage.cs

示例5: OldEqualsNewStyle

        static public bool OldEqualsNewStyle(IVertexSource control, IVertexSource test, double maxError = .0001)
        {
            control.rewind(0);
            double controlX;
            double controlY;
            ShapePath.FlagsAndCommand controlFlagsAndCommand = control.vertex(out controlX, out controlY);

            int index = 0;
            foreach (VertexData vertexData in test.Vertices())
            {
                if (controlFlagsAndCommand != vertexData.command
                    || controlX < vertexData.position.x - maxError || controlX > vertexData.position.x + maxError
                    || controlY < vertexData.position.y - maxError || controlY > vertexData.position.y + maxError)
                {
                    return false;
                }
                controlFlagsAndCommand = control.vertex(out controlX, out controlY);
                index++;
            }

            if (controlFlagsAndCommand == ShapePath.FlagsAndCommand.CommandStop)
            {
                return true;
            }

            return false;
        }
开发者ID:jeske,项目名称:agg-sharp,代码行数:27,代码来源:PathStorage.cs

示例6: OldEqualsOldStyle

        static public bool OldEqualsOldStyle(IVertexSource control, IVertexSource test, double maxError = .0001)
        {
            control.rewind(0);
            double controlX;
            double controlY;
            ShapePath.FlagsAndCommand controlFlagsAndCommand = control.vertex(out controlX, out controlY);

            test.rewind(0);
            double testX;
            double testY;
            ShapePath.FlagsAndCommand otherFlagsAndCommand = test.vertex(out testX, out testY);

            int index = 1;
            if (controlFlagsAndCommand == otherFlagsAndCommand && controlX == testX && agg_basics.is_equal_eps(controlY, testY, .000000001))
            {
                while (controlFlagsAndCommand != ShapePath.FlagsAndCommand.CommandStop)
                {
                    controlFlagsAndCommand = control.vertex(out controlX, out controlY);
                    otherFlagsAndCommand = test.vertex(out testX, out testY);
                    if (controlFlagsAndCommand != otherFlagsAndCommand
                        || controlX < testX - maxError || controlX > testX + maxError
                        || controlY < testY - maxError || controlY > testY + maxError)
                    {
                        return false;
                    }
                    index++;
                }

                return true;
            }

            return false;
        }
开发者ID:jeske,项目名称:agg-sharp,代码行数:33,代码来源:PathStorage.cs

示例7: Render

        public override void Render(IVertexSource vertexSource, uint pathIndexToRender, RGBA_Bytes colorBytes)
        {
#if use_timers
            OpenGLRenderTimer.Start();
#endif
            PushOrthoProjection();

            vertexSource.rewind(pathIndexToRender);

            RGBA_Doubles color = colorBytes.GetAsRGBA_Doubles();

            Gl.glColor4d(color.m_r, color.m_g, color.m_b, color.m_a);

            m_Tesselator.BeginPolygon();

            uint PathAndFlags = 0;
            double x, y;
            bool haveBegunContour = false;
            while (!Path.is_stop(PathAndFlags = vertexSource.vertex(out x, out y)))
            {
                if (Path.is_close(PathAndFlags)
                    || (haveBegunContour && Path.is_move_to(PathAndFlags)))
                {
                    m_Tesselator.EndContour();
                    haveBegunContour = false;
                }

                if(!Path.is_close(PathAndFlags))
                {
                    if (!haveBegunContour)
                    {
                        m_Tesselator.BeginContour();
                        haveBegunContour = true;
                    }

                    m_Tesselator.AddVertex(x, y);
                }
            }

            if (haveBegunContour)
            {
                m_Tesselator.EndContour();
            }

#if use_timers
            OpenGLEndPolygonTimer.Start();
#endif
            m_Tesselator.EndPolygon();
#if use_timers
            OpenGLEndPolygonTimer.Stop();
#endif

            PopOrthoProjection();
#if use_timers
            OpenGLRenderTimer.Stop();
#endif
        }
开发者ID:pobingwanghai,项目名称:SharpMapV2,代码行数:57,代码来源:RendererOpenGL.cs

示例8: Extrude

        public static Mesh Extrude(IVertexSource vertexSource, double zHeight)
        {
            vertexSource.rewind();
            CachedTesselator teselatedSource = new CachedTesselator();
            Graphics2DOpenGL.SendShapeToTesselator(teselatedSource, vertexSource);

            Mesh extrudedVertexSource = new Mesh();

            int numIndicies = teselatedSource.IndicesCache.Count;

            // build the top first so it will render first when we are translucent
            for (int i = 0; i < numIndicies; i += 3)
            {
                Vector2 v0 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 0].Index].Position;
                Vector2 v1 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 1].Index].Position;
                Vector2 v2 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 2].Index].Position;
                if (v0 == v1 || v1 == v2 || v2 == v0)
                {
                    continue;
                }

                Vertex topVertex0 = extrudedVertexSource.CreateVertex(new Vector3(v0, zHeight));
                Vertex topVertex1 = extrudedVertexSource.CreateVertex(new Vector3(v1, zHeight));
                Vertex topVertex2 = extrudedVertexSource.CreateVertex(new Vector3(v2, zHeight));

                extrudedVertexSource.CreateFace(new Vertex[] { topVertex0, topVertex1, topVertex2 });
            }

            // then the outside edge
            for (int i = 0; i < numIndicies; i += 3)
            {
                Vector2 v0 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 0].Index].Position;
                Vector2 v1 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 1].Index].Position;
                Vector2 v2 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 2].Index].Position;
                if (v0 == v1 || v1 == v2 || v2 == v0)
                {
                    continue;
                }

                Vertex bottomVertex0 = extrudedVertexSource.CreateVertex(new Vector3(v0, 0));
                Vertex bottomVertex1 = extrudedVertexSource.CreateVertex(new Vector3(v1, 0));
                Vertex bottomVertex2 = extrudedVertexSource.CreateVertex(new Vector3(v2, 0));

                Vertex topVertex0 = extrudedVertexSource.CreateVertex(new Vector3(v0, zHeight));
                Vertex topVertex1 = extrudedVertexSource.CreateVertex(new Vector3(v1, zHeight));
                Vertex topVertex2 = extrudedVertexSource.CreateVertex(new Vector3(v2, zHeight));

                if (teselatedSource.IndicesCache[i + 0].IsEdge)
                {
                    extrudedVertexSource.CreateFace(new Vertex[] { bottomVertex0, bottomVertex1, topVertex1, topVertex0 });
                }

                if (teselatedSource.IndicesCache[i + 1].IsEdge)
                {
                    extrudedVertexSource.CreateFace(new Vertex[] { bottomVertex1, bottomVertex2, topVertex2, topVertex1 });
                }

                if (teselatedSource.IndicesCache[i + 2].IsEdge)
                {
                    extrudedVertexSource.CreateFace(new Vertex[] { bottomVertex2, bottomVertex0, topVertex0, topVertex2 });
                }
            }

            // then the bottom
            for (int i = 0; i < numIndicies; i += 3)
            {
                Vector2 v0 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 0].Index].Position;
                Vector2 v1 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 1].Index].Position;
                Vector2 v2 = teselatedSource.VerticesCache[teselatedSource.IndicesCache[i + 2].Index].Position;
                if (v0 == v1 || v1 == v2 || v2 == v0)
                {
                    continue;
                }

                Vertex bottomVertex0 = extrudedVertexSource.CreateVertex(new Vector3(v0, 0));
                Vertex bottomVertex1 = extrudedVertexSource.CreateVertex(new Vector3(v1, 0));
                Vertex bottomVertex2 = extrudedVertexSource.CreateVertex(new Vector3(v2, 0));

                extrudedVertexSource.CreateFace(new Vertex[] { bottomVertex2, bottomVertex1, bottomVertex0 });
            }

            return extrudedVertexSource;
        }
开发者ID:jeske,项目名称:agg-sharp,代码行数:83,代码来源:VertexSourceToMesh.cs

示例9: add_path

        public void add_path(IVertexSource vs, int path_id)
        {
            double x;
            double y;

            ShapePath.FlagsAndCommand cmd;
            vs.rewind(path_id);
            if(m_Rasterizer.sorted()) reset();
            while(!ShapePath.is_stop(cmd = vs.vertex(out x, out y)))
            {
                add_vertex(x, y, cmd);
            }
        }
开发者ID:jeske,项目名称:agg-sharp,代码行数:13,代码来源:agg_rasterizer_compound_aa.cs

示例10: Render

		public override void Render(IVertexSource vertexSource, int pathIndexToRender, IColorType colorIn)
		{
			PushOrthoProjection();

			GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
			GL.Enable(EnableCap.Blend);

			vertexSource.rewind(pathIndexToRender);

			RGBA_Bytes colorBytes = colorIn.GetAsRGBA_Bytes();
			GL.Color4(colorBytes.red, colorBytes.green, colorBytes.blue, colorBytes.alpha);

			Affine transform = GetTransform();
			if (!transform.is_identity())
			{
				vertexSource = new VertexSourceApplyTransform(vertexSource, transform);
			}

			if (DoEdgeAntiAliasing)
			{
				DrawAAShape(vertexSource);
			}
			else
			{
				renderNowTesselator.Clear();
				Graphics2DOpenGL.SendShapeToTesselator(renderNowTesselator, vertexSource);
			}

			PopOrthoProjection();
		}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:30,代码来源:RendererOpenGL.cs

示例11: bounding_rect_single

		//-----------------------------------------------------bounding_rect_single
		//template<class VertexSource, class CoordT>
		public static bool bounding_rect_single(IVertexSource vs, int path_id,
								  out double x1, out double y1, out double x2, out double y2)
		{
			double x = 0;
			double y = 0;
			bool first = true;

			x1 = 1;
			y1 = 1;
			x2 = 0;
			y2 = 0;

			vs.rewind(path_id);
			ShapePath.FlagsAndCommand PathAndFlags;
			while (!ShapePath.is_stop(PathAndFlags = vs.vertex(out x, out y)))
			{
				if (ShapePath.is_vertex(PathAndFlags))
				{
					if (first)
					{
						x1 = x;
						y1 = y;
						x2 = x;
						y2 = y;
						first = false;
					}
					else
					{
						if (x < x1) x1 = x;
						if (y < y1) y1 = y;
						if (x > x2) x2 = x;
						if (y > y2) y2 = y;
					}
				}
			}
			return x1 <= x2 && y1 <= y2;
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:39,代码来源:agg_bounding_rect.cs

示例12: add_path

		public void add_path(IVertexSource vs, int pathID)
		{
#if false
            if (m_outline.sorted())
            {
                reset();
            }

            foreach (VertexData vertexData in vs.Vertices())
            {
                if(!ShapePath.is_stop(vertexData.command))
                {
                    AddVertex(new VertexData(vertexData.command, new Vector2(vertexData.position.x, vertexData.position.y)));
                }
            }
#else
			double x = 0;
			double y = 0;

			ShapePath.FlagsAndCommand PathAndFlags;
			vs.rewind(pathID);
			if (m_outline.sorted())
			{
				reset();
			}

			while (!ShapePath.is_stop(PathAndFlags = vs.vertex(out x, out y)))
			{
				AddVertex(new VertexData(PathAndFlags, new Vector2(x, y)));
			}
#endif
		}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:32,代码来源:ScanlineRasterizer.cs

示例13: Render

		public override void Render(IVertexSource vertexSource, int pathIndexToRender, IColorType colorIn)
		{
			PreRender();

			if (DoEdgeAntiAliasing)
			{
				DrawAAShape(vertexSource, colorIn);
			}
			else
			{
				vertexSource.rewind(pathIndexToRender);

				Affine transform = GetTransform();
				if (!transform.is_identity())
				{
					vertexSource = new VertexSourceApplyTransform(vertexSource, transform);
				}

				RGBA_Bytes colorBytes = colorIn.GetAsRGBA_Bytes();
				GL.Color4(colorBytes.red, colorBytes.green, colorBytes.blue, colorBytes.alpha);

				renderNowTesselator.Clear();
                VertexSourceToTesselator.SendShapeToTesselator(renderNowTesselator, vertexSource);
			}

			PopOrthoProjection();
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:27,代码来源:RendererOpenGL.cs

示例14: DrawAAShape

		public void DrawAAShape(IVertexSource vertexSource, IColorType colorIn)
		{
			vertexSource.rewind(0);

			Affine transform = GetTransform();
			if (!transform.is_identity())
			{
				vertexSource = new VertexSourceApplyTransform(vertexSource, transform);
			}

			RGBA_Bytes colorBytes = colorIn.GetAsRGBA_Bytes();
			GL.Color4(colorBytes.red, colorBytes.green, colorBytes.blue, colorBytes.alpha);

			triangleEddgeInfo.Clear();
            VertexSourceToTesselator.SendShapeToTesselator(triangleEddgeInfo, vertexSource);

			// now render it
			triangleEddgeInfo.RenderLastToGL();
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:19,代码来源:RendererOpenGL.cs


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