Ejemplo n.º 1
0
 public Editor(Game game)
     : base(game)
 {
     Instance = this;
     KeyFrameControl = new KeyFrameControl(game);
     Models = new List<Model3D>();
     SelectedModel = new SimpleModel();
     ControlState = new ControlState();
 }
Ejemplo n.º 2
0
        public Model3D AddModel(Model3D model)
        {
            int modelId = Models.Count;
            for (int i = 0; i < Models.Count; ++i)
            {
                if (Models[i].MarkedForDeletion)
                {
                    modelId = i;
                    break;
                }
            }

            if (modelId == Models.Count)
                Models.Add(model);
            else
                Models[modelId] = model;

            KeyFrameControl.InsertKeyFrame(model, 0);

            return model;
        }
 public void SetTransformation(Model3D model, int keyFrameIndex, Transformation transformation)
 {
     KeyFrameForIndex[keyFrameIndex].TransformationForModel[model] = transformation;
 }
 public void InsertKeyFrameOnCurrentFrame(Model3D model)
 {
     InsertKeyFrame(model, CurrentFrameIndex);
 }
        public void InsertKeyFrame(Model3D model, int frameIndex)
        {
            if (!KeyFrameForIndex.ContainsKey(frameIndex))
            {
                KeyFrameForIndex[frameIndex] = new KeyFrame(frameIndex);
            }
            if (!KeyFrameForIndex[frameIndex].TransformationForModel.ContainsKey(model))
            {
                KeyFrameForIndex[frameIndex].TransformationForModel[model] = Transformation.Identity;
            }

            KeyFrameForIndex[frameIndex].TransformationForModel[model] = model.Transformation;

            if (!KeyFrameIndicesForModel.ContainsKey(model))
            {
                KeyFrameIndicesForModel[model] = new List<int>();
            }
            KeyFrameIndicesForModel[model].Add(frameIndex);
            KeyFrameIndicesForModel[model].Sort();

            // Make sure there are enough frames for interpolation step later
            while (frames.Count < frameIndex + 1)
            {
                frames.Add(new Frame(frames.Count));
            }
            CalculateFrames();
        }
 public bool HasTransformation(Model3D model, int frameIndex)
 {
     if (frameIndex > frames.Count - 1)
         return false;
     return frames[frameIndex].TransformationForModel.ContainsKey(model);
 }
 public Transformation GetTransformation(Model3D model, int frameIndex)
 {
     return frames[frameIndex].TransformationForModel[model];
 }
 void DeleteModel(Model3D model)
 {
     model.MarkForDeletion();
 }