public SubsetBlock Clone()
        {
            SubsetBlock tRet = new SubsetBlock();

            tRet._SubsetName     = _SubsetName.Clone();
            tRet._MaterialName   = _MaterialName.Clone();
            tRet._PrimType       = _PrimType;
            tRet._StartIndex     = _StartIndex;
            tRet._PrimitiveCount = _PrimitiveCount;
            return(tRet);
        }
Exemple #2
0
        public void Load(BinaryReader Reader)
        {
            New();

            try
            {
                // 检查文件头
                Label tHeader = new Label(4);
                tHeader.Load(Reader);
                if (tHeader.Content != "FMM")
                    throw new FormatException("Header check failed.");
                if (Reader.ReadUInt32() != 100)
                    throw new FormatException("Version not support.");
                UInt32 tBlockCount = Reader.ReadUInt32();
                _Author.Load(Reader);
                _Description.Load(Reader);

                // 读取所有块
                Label tBlockHeader = new Label(8);
                for (UInt32 i = 0; i < tBlockCount; ++i)
                {
                    Block tBlock = null;
                    tBlockHeader.Load(Reader);
                    switch (tBlockHeader.Content)
                    {
                        case "VERTEX":
                            tBlock = new VertexBlock();
                            break;
                        case "INDEX":
                            tBlock = new IndexBlock();
                            break;
                        case "SUBSET":
                            tBlock = new SubsetBlock();
                            break;
                        case "MATERIAL":
                            tBlock = new MaterialBlock();
                            break;
                        case "BOUNDBOX":
                            tBlock = new BoundingBoxBlock();
                            break;
                        default:
                            tBlock = new UnknownBlock(tBlockHeader.Content);
                            break;
                    }

                    tBlock.Load(Reader);
                    _BlockList.Add(tBlock);
                }
            }
            catch
            {
                New();

                throw;
            }
        }
Exemple #3
0
 public SubsetBlock Clone()
 {
     SubsetBlock tRet = new SubsetBlock();
     tRet._SubsetName = _SubsetName.Clone();
     tRet._MaterialName = _MaterialName.Clone();
     tRet._PrimType = _PrimType;
     tRet._StartIndex = _StartIndex;
     tRet._PrimitiveCount = _PrimitiveCount;
     return tRet;
 }
        public void Load(BinaryReader Reader)
        {
            New();

            try
            {
                // 检查文件头
                Label tHeader = new Label(4);
                tHeader.Load(Reader);
                if (tHeader.Content != "FMM")
                {
                    throw new FormatException("Header check failed.");
                }
                if (Reader.ReadUInt32() != 100)
                {
                    throw new FormatException("Version not support.");
                }
                UInt32 tBlockCount = Reader.ReadUInt32();
                _Author.Load(Reader);
                _Description.Load(Reader);

                // 读取所有块
                Label tBlockHeader = new Label(8);
                for (UInt32 i = 0; i < tBlockCount; ++i)
                {
                    Block tBlock = null;
                    tBlockHeader.Load(Reader);
                    switch (tBlockHeader.Content)
                    {
                    case "VERTEX":
                        tBlock = new VertexBlock();
                        break;

                    case "INDEX":
                        tBlock = new IndexBlock();
                        break;

                    case "SUBSET":
                        tBlock = new SubsetBlock();
                        break;

                    case "MATERIAL":
                        tBlock = new MaterialBlock();
                        break;

                    case "BOUNDBOX":
                        tBlock = new BoundingBoxBlock();
                        break;

                    default:
                        tBlock = new UnknownBlock(tBlockHeader.Content);
                        break;
                    }

                    tBlock.Load(Reader);
                    _BlockList.Add(tBlock);
                }
            }
            catch
            {
                New();

                throw;
            }
        }