示例#1
0
 /// <summary>Build both meshes</summary>
 public static void createMesh(this iPolylinePath path, iTriangleMesh result, eBuildFilledMesh filledMesh, float pixel, sStrokeInfo strokeInfo)
 {
     unsafe
     {
         sStrokeInfo *si = &strokeInfo;
         path.createMesh(result, filledMesh, pixel, ( IntPtr)si);
     }
 }
示例#2
0
文件: Meshes.cs 项目: zeta1999/Vrmac
        public bool tessellate(ref Options options, ref Rect clip, iPolylinePath poly, ref Guid hashFront)
        {
            eClipResult result = path.buildClippedPolylines(poly, clip, options.transform, options.precision, options.stroke.width);

            clipResultBack = result;

            if (result == eClipResult.ClippedOut)
            {
                return(clearBackBuffer());
            }

            Guid hash = poly.hash;

            if (hash == hashFront)
            {
                // Same polyline was used to generate the current front buffer.
                // Return false to skip buffers swap.
                return(false);
            }
            if (hash == hashBack)
            {
                return(true);
            }
            hashBack = hash;

            if (result == eClipResult.FillsEntireViewport)
            {
                var fillOptions = options.fill;
                if (!fillOptions.HasFlag(eBuildFilledMesh.FilledMesh))
                {
                    return(clearBackBuffer());
                }

                // When there're no visible edges of the path, no point in doing VAA, will be clipped out
                fillOptions &= ~eBuildFilledMesh.VAA;
                poly.createMesh(backBuffer, fillOptions, 0);
                return(true);
            }

            if (options.stroke.width <= 0)
            {
                poly.createMesh(backBuffer, options.fill, options.pixel);
            }
            else if (options.fill == eBuildFilledMesh.None)
            {
                poly.createMesh(backBuffer, options.stroke);
            }
            else if (options.separateStrokeMesh)
            {
                poly.createMesh(backBuffer, options.fill, options.pixel);
                poly.createMesh(extraStroke.backBuffer, options.stroke);
            }
            else
            {
                poly.createMesh(backBuffer, options.fill, options.pixel, options.stroke);
            }

            return(true);
        }
示例#3
0
 /// <summary>Build just the filled mesh</summary>
 public static void createMesh(this iPolylinePath path, iTriangleMesh result, eBuildFilledMesh filledMesh, float pixel)
 {
     Debug.Assert(filledMesh != eBuildFilledMesh.None);
     path.createMesh(result, filledMesh, pixel, IntPtr.Zero);
 }