Ejemplo n.º 1
0
        public bool loadAndExecute()
        {
            if (mGraphMemoryStream == null)
            {
                return(false);
            }

            mGraphMemoryStream.Seek(0, SeekOrigin.Begin);
            int tWidth  = CoreGlobals.getEditorMain().mITerrainShared.getNumXVerts();
            int tHeight = CoreGlobals.getEditorMain().mITerrainShared.getNumXVerts();

            DAGCanvas dg = new DAGCanvas(512, 512);

            dg.loadCanvasFromMemoryStream(mGraphMemoryStream);
            DAGMask resMask = dg.execute(tWidth, tHeight);

            if (resMask == null)
            {
                MessageBox.Show("There was an error computing Mask");
                return(false);
            }

            mOutputMask = new ArrayBasedMask(mCapacity);


            for (int x = 0; x < tWidth; x++)
            {
                for (int y = 0; y < tHeight; y++)
                {
                    mOutputMask.SetMaskWeight(x * tWidth + y, resMask[x, y]);
                }
            }
            dg.newCanvas();
            dg = null;
            mGraphMemoryStream.Seek(0, SeekOrigin.Begin);
            return(true);
        }
Ejemplo n.º 2
0
 public DAGMask execute(int width, int height)
 {
     return(canvas.execute(width, height));
 }