Exemplo n.º 1
0
        public Node3D ReadNode()
        {
            int    node_t = Help.IOHelp.ReadInt();
            Node3D nn     = null;

            if (node_t == 1)
            {
                Entity3D new_e = new Entity3D();
                new_e.Read();
                nn = new_e;
            }
            else if (node_t == 0)
            {
                Node3D new_n = new Node3D();
                new_n.Read();
                nn = new_n;
            }
            else
            {
                System.Environment.Exit(-3);
            }
            int sc = Help.IOHelp.ReadInt();

            for (int i = 0; i < sc; i++)
            {
                var rn = ReadNode();
                rn.Top = nn;
                nn.Sub.Add(rn);
            }
            return(nn);
        }
Exemplo n.º 2
0
        public static Node3D LoadNode(string path)
        {
            FileStream   fs = new FileStream(path, FileMode.Open, FileAccess.Read);
            BinaryReader r  = new BinaryReader(fs);

            Help.IOHelp.r = r;

            int et = IOHelp.ReadInt();

            switch (et)
            {
            case 1:
                var new_ent = new Entity3D();
                new_ent.Read();
                fs.Close();
                return(new_ent);

                break;

            case 2:
                var new_node = new Node3D();
                new_node.Read();
                fs.Close();
                return(new_node);

                break;
            }

            fs.Close();
            return(null);
        }