示例#1
0
        public override Tex2D Process(Tex2D img)
        {
            if (Graph == null)
            {
                Graph = Map.UpdateGraph(64, 64);
            }

            if (White == null)
            {
                White = new Tex.Tex2D("Corona/Img/fx/vrgrid1.png", true);
            }
            FB1.Bind();

            //Graph.Draw(false);
            Graph.DrawShapes(0.1f);

            FB1.Release();

            //return null;

            var b2 = FB1.BB.ToTex2D();

            Graph.Draw(true);

            Vivid.Draw.Render.Begin();
            Vivid.Draw.Render.Image(0, App.AppInfo.H, App.AppInfo.W, -App.AppInfo.H, b2, White);

            FX.Bind();

            Vivid.Draw.Render.End2D();

            FX.Release();

            return(base.Process(img));
        }
示例#2
0
        public void Add(Scene.SceneGraph2D graph)
        {
            AddMediaFromNode(graph.Root);

            VirtualEntry ge = new VirtualEntry
            {
                Path = "VirtualFile",
                Name = graph.Root.Name
            };

            MemoryStream ms = new MemoryStream(1024 * 1024);
            BinaryWriter w  = new BinaryWriter(ms);

            graph.WriteGraph(w);

            byte[] wd = new byte[ms.Position];
            ms.Seek(0, SeekOrigin.Begin);
            ms.Read(wd, 0, wd.Length);
            Console.WriteLine("GraphSize:" + wd.Length + " bytes.");
            ge.RawData = wd;
            ge.Size    = wd.Length;
            ms.Flush();
            w.Flush();
            ms.Dispose();
            ge.Loaded     = true;
            ge.Compressed = false;
            Enteries.Add(ge);
        }
示例#3
0
        public Scene.SceneGraph2D GetGraph(string name)
        {
            Console.WriteLine("Searching for graph:" + name);
            foreach (VirtualEntry e in Enteries)
            {
                Console.WriteLine("E:" + e.Name + " Start:" + e.Start + " Size:" + e.Size + " P:" + e.Path);
                if (e.Name == name)
                {
                    Console.WriteLine("Found Graph:" + name);
                    Scene.SceneGraph2D ng = new Scene.SceneGraph2D();
                    Load(e);
                    MemoryStream ms = new MemoryStream(e.RawData);
                    BinaryReader r  = new BinaryReader(ms);
                    // Console.WriteLine("Reading Graph.");
                    ng.ReadGraph(r);
                    // Console.WriteLine("Read.");
                    ms.Close();
                    r  = null;
                    ms = null;

                    LinkGraphImg(ng.Root);
                    return(ng);
                }
            }
            return(null);
        }
示例#4
0
        public override void Render()
        {
            Scene.SceneGraph2D g = VFX.VisualFX.Graph;

            int sw = Vivid.App.AppInfo.W;
            int sh = Vivid.App.AppInfo.H;

            float[] ox = new float[4];
            float[] oy = new float[4];

            ox[0] = (-W / 2); // * Graph.Z * Z;
            ox[1] = (W / 2);  // * Graph.Z * Z;
            ox[2] = (W / 2);  // * Graph.Z* Z ;
            ox[3] = (-W / 2); // *Graph.Z*Z;

            oy[0] = (-H / 2); // * Graph.Z*Z;
            oy[1] = (-H / 2); // *Graph.Z*Z;
            oy[2] = (H / 2);  // * Graph.Z * Z;
            oy[3] = (H / 2);  // * Graph.Z * Z;

            Vector2[] p = Maths.RotateOC(ox, oy, Rot, Z, 0, 0);

            p = Maths.Push(p, X - g.X, Y - g.Y);

            p = Maths.RotateOC(p, g.Rot, g.Z, 0, 0);

            p = Maths.Push(p, sw / 2, sh / 2);

            Draw.Render.SetBlend(Draw.BlendMode.SoftLight);

            Draw.Render.Col = new Vector4(1, 1, 1, Alpha);

            // Draw.Render.Image(p, Img,z);

            /*
             * p = Maths.Rotate(p, Rot, 1.0f);
             *
             * p = Maths.Push(p, X, Y);
             *
             * Draw.Render.SetBlend(Draw.BlendMode.SoftLight);
             *
             * Draw.Render.Col = new Vector4(1, 1, 1, Alpha);
             *
             * Draw.Render.Image(p, Img);
             */
            //Console.WriteLine("X:" + X + " Y:" + Y + " Z:" + Z);
            //   Console.WriteLine("W" + W + " H:" + H);
        }