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

            tRet.MinX = MinX;
            tRet.MinY = MinY;
            tRet.MinZ = MinZ;
            tRet.MaxX = MaxX;
            tRet.MaxY = MaxY;
            tRet.MaxZ = MaxZ;
            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 BoundingBoxBlock Clone()
 {
     BoundingBoxBlock tRet = new BoundingBoxBlock();
     tRet.MinX = MinX;
     tRet.MinY = MinY;
     tRet.MinZ = MinZ;
     tRet.MaxX = MaxX;
     tRet.MaxY = MaxY;
     tRet.MaxZ = MaxZ;
     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;
            }
        }