Exemple #1
0
        internal Drawable(DrawableModel drawableModel)
        {
            if (drawableModel.ShaderGroup != null)
            {
                Materials = new List<Material>(drawableModel.ShaderGroup.Shaders.Count);
                foreach (var info in drawableModel.ShaderGroup.Shaders)
                {
                    Materials.Add(new Material(info));
                }
            }
            else
            {
                Materials = new List<Material>();
            }

            if (drawableModel.Skeleton != null)
            {
                Skeleton = new Skeleton(drawableModel.Skeleton);
            }

            Models = new List<Model>(drawableModel.ModelCollection.Length);
            foreach (var info in drawableModel.ModelCollection)
            {
                Models.Add(new Model(info));
            }

            AttachedTexture = drawableModel.ShaderGroup.TextureDictionary;
        }
Exemple #2
0
            public void Read(BinaryReader br)
            {
                br.BaseStream.Seek(0x90, SeekOrigin.Current);

                uint offset = ResourceUtil.ReadOffset(br);
                if (offset != 0)
                {
                    Drawable = new DrawableModel();

                    br.BaseStream.Seek(offset, SeekOrigin.Begin);
                    Drawable.Read(br);
                }
            }
Exemple #3
0
            public void Read(BinaryReader br)
            {
                br.BaseStream.Seek(0x90, SeekOrigin.Current);

                uint offset = ResourceUtil.ReadOffset(br);

                if (offset != 0)
                {
                    Drawable = new DrawableModel();

                    br.BaseStream.Seek(offset, SeekOrigin.Begin);
                    Drawable.Read(br);
                }
            }
Exemple #4
0
        public void Read(BinaryReader br)
        {
            br.BaseStream.Seek(0xB4, SeekOrigin.Begin);
            uint offset = ResourceUtil.ReadOffset(br);
            if (offset != 0)
            {
                Drawable = new DrawableModel();
                br.BaseStream.Seek(offset, SeekOrigin.Begin);
                Drawable.Read(br);
            }
            else
            {
                throw new Exception("No model in FragType");
            }

            br.BaseStream.Seek(0x1F3, SeekOrigin.Begin);
            int childCount = br.ReadByte();

            br.BaseStream.Seek(0xD4, SeekOrigin.Begin);
            uint childListOffset = ResourceUtil.ReadOffset(br);

            br.BaseStream.Seek(childListOffset, SeekOrigin.Begin);
            var childOffsets = new SimpleArray<uint>(br, childCount, ResourceUtil.ReadOffset);

            Children = new FragTypeChild[childCount];
            for(int i=0;i<childCount; i++)
            {
                br.BaseStream.Seek(childOffsets[i], SeekOrigin.Begin);
                Children[i] = new FragTypeChild(br);
            }

            foreach (var child in Children)
            {
                if (child.Drawable != null)
                {
                    child.Drawable.ShaderGroup = Drawable.ShaderGroup;
                }
            }
            
        }
Exemple #5
0
        public void Read(BinaryReader br)
        {
            br.BaseStream.Seek(0xB4, SeekOrigin.Begin);
            uint offset = ResourceUtil.ReadOffset(br);

            if (offset != 0)
            {
                Drawable = new DrawableModel();
                br.BaseStream.Seek(offset, SeekOrigin.Begin);
                Drawable.Read(br);
            }
            else
            {
                throw new Exception("No model in FragType");
            }

            br.BaseStream.Seek(0x1F3, SeekOrigin.Begin);
            int childCount = br.ReadByte();

            br.BaseStream.Seek(0xD4, SeekOrigin.Begin);
            uint childListOffset = ResourceUtil.ReadOffset(br);

            br.BaseStream.Seek(childListOffset, SeekOrigin.Begin);
            var childOffsets = new SimpleArray <uint>(br, childCount, ResourceUtil.ReadOffset);

            Children = new FragTypeChild[childCount];
            for (int i = 0; i < childCount; i++)
            {
                br.BaseStream.Seek(childOffsets[i], SeekOrigin.Begin);
                Children[i] = new FragTypeChild(br);
            }

            foreach (var child in Children)
            {
                if (child.Drawable != null)
                {
                    child.Drawable.ShaderGroup = Drawable.ShaderGroup;
                }
            }
        }
 internal static ModelNode GenerateModel(DrawableModel drawableModel, TextureFile[] textures)
 {
     return GenerateModel(new Drawable(drawableModel), textures);
 }