Exemplo n.º 1
0
        public void LoadMSB(IMsb msb)
        {
            foreach (var m in msb.Models.GetEntries())
            {
                LoadedModels.Add(m.Name, m);
            }

            foreach (var p in msb.Parts.GetEntries())
            {
                var n = new MapEntity(this, p, MapEntity.MapEntityType.Part);
                Objects.Add(n);
                RootObject.AddChild(n);
            }

            foreach (var p in msb.Regions.GetEntries())
            {
                var n = new MapEntity(this, p, MapEntity.MapEntityType.Region);
                Objects.Add(n);
                RootObject.AddChild(n);
            }

            foreach (var p in msb.Events.GetEntries())
            {
                var n = new MapEntity(this, p, MapEntity.MapEntityType.Event);
                Objects.Add(n);
                RootObject.AddChild(n);
            }

            foreach (var m in Objects)
            {
                m.BuildReferenceMap();
            }
        }
Exemplo n.º 2
0
        public void LoadFlver(FLVER2 flver, MeshRenderableProxy proxy)
        {
            var meshesNode = new NamedEntity(this, null, "Meshes");

            Objects.Add(meshesNode);
            RootObject.AddChild(meshesNode);
            for (int i = 0; i < flver.Meshes.Count; i++)
            {
                var meshnode = new NamedEntity(this, flver.Meshes[i], $@"mesh_{i}");
                if (proxy.Submeshes.Count > 0)
                {
                    meshnode.RenderSceneMesh = proxy.Submeshes[i];
                    proxy.Submeshes[i].SetSelectable(meshnode);
                }
                Objects.Add(meshnode);
                meshesNode.AddChild(meshnode);
            }

            var materialsNode = new NamedEntity(this, null, "Materials");

            Objects.Add(materialsNode);
            RootObject.AddChild(materialsNode);
            for (int i = 0; i < flver.Materials.Count; i++)
            {
                var matnode = new Entity(this, flver.Materials[i]);
                Objects.Add(matnode);
                materialsNode.AddChild(matnode);
            }

            var layoutsNode = new NamedEntity(this, null, "Layouts");

            Objects.Add(layoutsNode);
            RootObject.AddChild(layoutsNode);
            for (int i = 0; i < flver.BufferLayouts.Count; i++)
            {
                var laynode = new NamedEntity(this, flver.BufferLayouts[i], $@"layout_{i}");
                Objects.Add(laynode);
                layoutsNode.AddChild(laynode);
            }

            var bonesNode = new NamedEntity(this, null, "Bones");

            Objects.Add(bonesNode);
            RootObject.AddChild(bonesNode);
            var boneEntList = new List <TransformableNamedEntity>();

            for (int i = 0; i < flver.Bones.Count; i++)
            {
                var bonenode = new TransformableNamedEntity(this, flver.Bones[i], flver.Bones[i].Name);
                bonenode.RenderSceneMesh = Universe.GetBoneDrawable(this, bonenode);
                Objects.Add(bonenode);
                boneEntList.Add(bonenode);
            }
            for (int i = 0; i < flver.Bones.Count; i++)
            {
                if (flver.Bones[i].ParentIndex == -1)
                {
                    bonesNode.AddChild(boneEntList[i]);
                }
                else
                {
                    boneEntList[flver.Bones[i].ParentIndex].AddChild(boneEntList[i]);
                }
            }

            // Add dummy polys attached to bones
            var dmysNode = new NamedEntity(this, null, "DummyPolys");

            Objects.Add(dmysNode);
            RootObject.AddChild(dmysNode);
            for (int i = 0; i < flver.Dummies.Count; i++)
            {
                var dmynode = new TransformableNamedEntity(this, flver.Dummies[i], $@"dmy_{i}");
                dmynode.RenderSceneMesh = Universe.GetDummyPolyDrawable(this, dmynode);
                Objects.Add(dmynode);
                dmysNode.AddChild(dmynode);
            }
        }
Exemplo n.º 3
0
 public void AddObject(Entity obj)
 {
     Objects.Add(obj);
     RootObject.AddChild(obj);
 }