Пример #1
0
        public override List <string> GetDifferences(Chunk xiChunk)
        {
            CameraPosChunk lOther = xiChunk as CameraPosChunk;

            if (mDirection != lOther.mDirection || mDistance != lOther.mDistance || mElevation != lOther.mElevation)
            {
                List <string> lRet = base.GetDifferences(xiChunk);
                lRet.Add(string.Format("Changed camera pos ({0},{1},{2}) to ({3},{4},{5})",
                                       lOther.mDirection, lOther.mDistance, lOther.mElevation,
                                       mDirection, mDistance, mElevation));
                return(lRet);
            }

            return(base.GetDifferences(xiChunk));
        }
Пример #2
0
        public override void SetSubject(Chunk xiChunk)
        {
            if (mSubject == xiChunk || xiChunk == null) return;

              if (!(xiChunk is CameraPosChunk))
              {
            throw new InvalidOperationException(string.Format("Tried to view chunk of type {0} in CameraViewer", xiChunk.GetType()));
              }

              mMainForm.CameraRenderingSurface.Visible = true;
              mSubject = (CameraPosChunk)xiChunk;
              SetDirection(mSubject.Direction);
              mMainForm.TextDistance.Text = mSubject.Distance.ToString();
              mMainForm.TextElevation.Text = mSubject.Elevation.ToString();

              InitialiseThreeDeeView();
        }
Пример #3
0
        public void Deserialise(Stream inStr, BinaryReader bin)
        {
            //header
            HeaderString1 = StreamUtils.ReadASCIINullTermString(inStr);
            HeaderString2 = StreamUtils.ReadASCIINullTermString(inStr);
            HeaderShort1  = bin.ReadInt16();
            HeaderShort2  = bin.ReadInt16();
            HeaderByte    = bin.ReadByte();
            int lSheetCount = bin.ReadInt16();

            Flats = new FlatChunk[lSheetCount];
            for (int i = 0; i < lSheetCount; i++)
            {
                Flats[i] = new FlatChunk(bin);
            }

            //key waypoints
            KeyWaypoints = new KeyWaypointsChunk(bin);

            //now the first set of images. I don't really know
            //what these do. They might be referred to by TexMetaData[7]
            short steeringImgCount = bin.ReadInt16();

            SteeringImageChunk[] steeringImages = new SteeringImageChunk[steeringImgCount];
            for (int i = 0; i < steeringImgCount; i++)
            {
                steeringImages[i] = new SteeringImageChunk(i, inStr);
            }
            this.SteeringImages = new GroupingChunk("SteeringImages", steeringImages);

            //now some camera positions:
            short cameraPositionCount = bin.ReadInt16();

            CameraPosChunk[] cameraPositions = new CameraPosChunk[cameraPositionCount];
            for (int i = 0; i < cameraPositionCount; i++)
            {
                cameraPositions[i] = new CameraPosChunk(i, bin);
            }
            this.CameraPositions = new GroupingChunk("CameraPositions", cameraPositions);

            //now the bump map prototypes. These are referred to by TexMetaData[6]
            short bumpImgCount = bin.ReadInt16();

            BumpImageChunk[] bumpImages = new BumpImageChunk[bumpImgCount];
            for (int i = 0; i < bumpImgCount; i++)
            {
                bumpImages[i] = new BumpImageChunk(i, inStr);
            }
            this.BumpImages = new GroupingChunk("BumpImages", bumpImages);

            //now trailing zeroes:
            int lNextByte;

            while (-1 != (lNextByte = inStr.ReadByte()))
            {
                if (lNextByte != 0)
                {
                    throw new DeserialisationException(string.Format("Expecting SHET to be followed by a block of zeroes. Found {0}", lNextByte), inStr.Position);
                }
                TrailingZeroByteCount++;
            }
        }
Пример #4
0
        public void Deserialise(Stream inStr, BinaryReader bin)
        {
            //header
              HeaderString1 = StreamUtils.ReadASCIINullTermString(inStr);
              HeaderString2 = StreamUtils.ReadASCIINullTermString(inStr);
              HeaderShort1 = bin.ReadInt16();
              HeaderShort2 = bin.ReadInt16();
              HeaderByte = bin.ReadByte();
              int lSheetCount = bin.ReadInt16();

              Flats = new FlatChunk[lSheetCount];
              for (int i = 0; i < lSheetCount; i++)
              {
            Flats[i] = new FlatChunk(bin);
              }

              //key waypoints
              KeyWaypoints = new KeyWaypointsChunk(bin);

              //now the first set of images. I don't really know
              //what these do. They might be referred to by TexMetaData[7]
              short steeringImgCount = bin.ReadInt16();
              SteeringImageChunk[] steeringImages = new SteeringImageChunk[steeringImgCount];
              for (int i = 0; i < steeringImgCount; i++)
              {
            steeringImages[i] = new SteeringImageChunk(i, inStr);
              }
              this.SteeringImages = new GroupingChunk("SteeringImages", steeringImages);

              //now some camera positions:
              short cameraPositionCount = bin.ReadInt16();
              CameraPosChunk[] cameraPositions = new CameraPosChunk[cameraPositionCount];
              for (int i = 0; i < cameraPositionCount; i++)
              {
            cameraPositions[i] = new CameraPosChunk(i, bin);
              }
              this.CameraPositions = new GroupingChunk("CameraPositions", cameraPositions);

              //now the bump map prototypes. These are referred to by TexMetaData[6]
              short bumpImgCount = bin.ReadInt16();
              BumpImageChunk[] bumpImages = new BumpImageChunk[bumpImgCount];
              for (int i = 0; i < bumpImgCount; i++)
              {
            bumpImages[i] = new BumpImageChunk(i, inStr);
              }
              this.BumpImages = new GroupingChunk("BumpImages", bumpImages);

              //now trailing zeroes:
              int lNextByte;
              while (-1 != (lNextByte = inStr.ReadByte()))
              {
            if (lNextByte != 0) throw new DeserialisationException(string.Format("Expecting SHET to be followed by a block of zeroes. Found {0}", lNextByte), inStr.Position);
            TrailingZeroByteCount++;
              }
        }