Ejemplo n.º 1
0
        public bool loadFrom(BinStore s)
        {
            bool ok = true;

            s.prepare();
            ok &= s.read(out name);
            ok &= s.read(out src_name);
            ok &= s.read(out LodFar);
            ok &= s.read(out LodFarFade);
            ok &= s.read(out LodNear);
            ok &= s.read(out LodNearFade);
            uint tflag;

            ok &= s.read(out tflag);
            node._TrickFlags = (TrickFlags)tflag;
            ok &= s.read(out ObjFlags);
            ok &= s.read(out GfxFlags);
            ok &= s.read(out GroupFlags);
            ok &= s.read(out Sway);
            ok &= s.read(out Sway_Rotate);
            ok &= s.read(out AlphaRef);
            ok &= s.read(out FogDist);
            ok &= s.read(out node.SortBias);
            ok &= s.read(out node.ScrollST0);
            ok &= s.read(out node.ScrollST1);
            ok &= s.read(out ShadowDist);
            ok &= s.read(out NightGlow);
            ok &= s.read(out node.TintColor0);
            ok &= s.read(out node.TintColor1);
            ok &= s.read(out ObjTexBias);
            ok &= s.prepare_nested(); // will update the file size left
            if (s.end_encountered())
            {
                return(ok);
            }
            string _name;

            while (s.nesting_name(out _name))
            {
                s.nest_in();
                if ("StAnim" == _name)
                {
                    TextureAnim_Dat entry = new TextureAnim_Dat();
                    ok &= entry.loadFrom(s);
                    StAnim.Add(entry);
                }
                else
                {
                    Debug.Assert(false, "unknown field referenced.");
                }

                s.nest_out();
            }

            Debug.Assert(s.end_encountered());
            return(ok);
        }
Ejemplo n.º 2
0
        private bool loadFrom(BinStore s)
        {
            bool ok = true;

            s.prepare();
            ok &= s.read(out Version);
            ok &= s.read(out Scenefile);
            ok &= s.prepare_nested(); // will update the file size left
            Debug.Assert(ok);
            if (s.end_encountered())
            {
                return(ok);
            }
            string _name;

            while (s.nesting_name(out _name))
            {
                s.nest_in();
                if ("Def" == _name || "RootMod" == _name)
                {
                    var entry = new SceneGraphNode_Data();
                    ok &= entry.loadFrom(s);
                    Def.Add(entry);
                }
                else if ("Ref" == _name)
                {
                    var entry = new SceneRootNode_Data();
                    ok &= entry.loadFrom(s);
                    Ref.Add(entry);
                }
                else
                {
                    Debug.Assert(false, "unknown field referenced.");
                }

                s.nest_out();
            }

            return(ok);
        }
Ejemplo n.º 3
0
        public bool loadFrom(BinStore s)
        {
            s.prepare();
            bool ok = s.prepare_nested(); // will update the file size left

            if (s.end_encountered())
            {
                return(ok);
            }
            string _name;

            while (s.nesting_name(out _name))
            {
                s.nest_in();
                if ("Trick" == _name)
                {
                    GeometryModifiers entry = new GeometryModifiers();
                    geometry_mods.Add(entry);
                    ok &= entry.loadFrom(s);
                }
                else if ("Texture" == _name)
                {
                    var entry = new TextureModifiers();
                    texture_mods.Add(entry);
                    ok &= entry.loadFrom(s);
                }
                else
                {
                    Debug.Assert(false, "unknown field referenced.");
                }

                s.nest_out();
            }
            Debug.LogFormat("Loaded {0} GeomMods and {1} TexMods", geometry_mods.Count, texture_mods.Count);
            Debug.Assert(ok);
            return(ok);
        }
Ejemplo n.º 4
0
        public bool loadFrom(BinStore s)
        {
            bool ok = true;

            s.prepare();
            ok &= s.read(out name);
            ok &= s.read(out type);
            ok &= s.read(out flags);
            ok &= s.read(out p_Obj);
            ok &= s.prepare_nested(); // will update the file size left
            Debug.Assert(ok);
            if (s.end_encountered())
            {
                return(ok);
            }
            string _name;

            while (s.nesting_name(out _name))
            {
                s.nest_in();
                if ("Group" == _name)
                {
                    ok &= loadSub(s, p_Grp);
                }
                else if ("Property" == _name)
                {
                    ok &= loadSub(s, p_Property);
                }
                else if ("TintColor" == _name)
                {
                    ok &= loadSub(s, p_TintColor);
                }
                else if ("Ambient" == _name)
                {
                    ok &= loadSub(s, p_Ambient);
                }
                else if ("Omni" == _name)
                {
                    ok &= loadSub(s, p_Omni);
                }
                else if ("Sound" == _name)
                {
                    ok &= loadSub(s, p_Sound);
                }
                else if ("ReplaceTex" == _name)
                {
                    ok &= loadSub(s, p_ReplaceTex);
                }
                else if ("Beacon" == _name)
                {
                    ok &= loadSub(s, p_Beacon);
                }
                else if ("Fog" == _name)
                {
                    ok &= loadSub(s, p_Fog);
                }
                else if ("Lod" == _name)
                {
                    ok &= loadSub(s, p_Lod);
                }
                else
                {
                    Debug.Assert(false, "unknown field referenced.");
                }

                s.nest_out();
            }

            return(ok);
        }