Beispiel #1
0
 public override void SetSubject(Chunk xiChunk)
 {
     if (mSubject == xiChunk) return;
       if (xiChunk == null || !CanViewChunk(xiChunk))
       {
     mMainForm.XMLTextBox.Text = "";
       }
       else
       {
     XmlSerializer xs = new XmlSerializer(xiChunk.GetType());
     StringWriter sw = new StringWriter();
     xs.Serialize(sw, xiChunk);
     mMainForm.XMLTextBox.Text = sw.ToString();
       }
       mSubject = xiChunk;
 }
Beispiel #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();
        }
Beispiel #3
0
        public override void SetSubject(Chunk xiChunk)
        {
            if (!(xiChunk is IEntityProvider)) xiChunk = null;
              mOptionsMenu.Visible = (xiChunk != null);
              if (mSubject == xiChunk) return;
              bool lResetViewMode = true;
              if (xiChunk != null && mSubject != null && xiChunk.GetType() == mSubject.GetType())
            lResetViewMode = false;
              mSubject = (IEntityProvider)xiChunk;

              const double MOVE_SCALE = 100;

              Cursor prevCursor = mMainForm.Viewer3DRenderingSurface.Cursor;
              mMainForm.Viewer3DRenderingSurface.Cursor = Cursors.WaitCursor;
              RebuildScene();
              if (mSubject != null)
              {
            mCamera.Position = new GLTK.Point(-3 * MOVE_SCALE, -3 * MOVE_SCALE, 3 * MOVE_SCALE);
            mCamera.LookAt(new GLTK.Point(3 * MOVE_SCALE, 3 * MOVE_SCALE, 0), new GLTK.Vector(0, 0, 1));

            //set defaults
            if (lResetViewMode)
            {
              if (mSubject is TMDChunk)
              {
            LightingMode = eLightingMode.None; //qq
            MovementMode = eMovementMode.InspectMode;
            DrawNormalsMode = eDrawNormalsMode.HideNormals;
            TextureMode = eTextureMode.NormalTextures;
            SelectedMetadata = eTexMetaDataEntries.Waypoint;
              }
              else
              {
            LightingMode = eLightingMode.None;
            MovementMode = eMovementMode.FlyMode;
            DrawNormalsMode = eDrawNormalsMode.HideNormals;
            TextureMode = eTextureMode.NormalTextures;
            SelectedMetadata = eTexMetaDataEntries.Waypoint;
              }
            }

            if (MovementMode == eMovementMode.InspectMode)
            {
              mLight.Transform = mCamera.Transform;
            }

            mMainForm.ChunkTreeView.CheckBoxes = (mSubject is Level);
              }
              else
              {
            if (mMainForm.ViewerTabControl.SelectedTab == null
              || !(mMainForm.ViewerTabControl.SelectedTab.Tag is ThreeDeeEditor))
            {
              mMainForm.ChunkTreeView.CheckBoxes = false;
            }
              }
              mMainForm.Viewer3DRenderingSurface.Cursor = prevCursor;

              InvalidateViewer();
        }