vigns / slimdx

Automatically exported from code.google.com/p/slimdx
0 stars 0 forks source link

KeyframedAnimationSet corrupts Frame.TransformationMatrix #862

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using Direct3D9 in SlimDX January 2012. Using an AnimationSet from 
Frame.LoadHierarchyFromX works, but it doesn't work when I manually create a 
KeyframedAnimationSet.

I looked at the Frame.TransformationMatrix when I enable the track, and some 
values become Single.NaN.

Example code:

AnimationController ac = new AnimationController(1000, 1, 1, 100);
int animationCount = 10;
CallbackKey[] callbackKeys = new CallbackKey[0]; // cannot be null
KeyframedAnimationSet set = new KeyframedAnimationSet("SetName", 1, 
PlaybackType.Once, animationCount, callbackKeys);
for (int i = 0; i < animationCount; i++)
{
  int numKeys = 100;
  ScaleKey[] scaleKeys = new ScaleKey[numKeys];
  RotationKey[] rotationKeys = new RotationKey[numKeys];
  TranslationKey[] translationKeys = new TranslationKey[numKeys];
  for (int j = 0; j < numKeys; j++)
  {
    float time = j;

    ScaleKey scale = new ScaleKey();
    scale.Time = time;
    scale.Value = new Vector3(1);
    scaleKeys[j] = scale;

    RotationKey rotation = new RotationKey();
    rotation.Time = time;
    rotation.Value = new Quaternion(0, 0, 0, 1);
    rotationKeys[j] = rotation;

    TranslationKey translation = new TranslationKey();
    translation.Time = time;
    translation.Value = new Vector3(0);
    translationKeys[j] = translation;
  }
  set.RegisterAnimationKeys("FrameName" + i, scaleKeys, rotationKeys, translationKeys);
}

ac.RegisterAnimationSet(set);
ac.SetTrackAnimationSet(0, set);
ac.SetTrackWeight(0, 1f);
ac.SetTrackSpeed(0, 1f);
ac.SetTrackPosition(0, 0.0);
ac.EnableTrack(0);
ac.ResetTime();

Original issue reported on code.google.com by recal...@gmail.com on 5 Apr 2012 at 5:52

GoogleCodeExporter commented 9 years ago
I may have found the problem. KeyframedAnimationSet::RegisterAnimationKeys 
makes new arrays but doesn't copy the keys' values.

Original comment by recal...@gmail.com on 5 Apr 2012 at 7:43

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r2202.

Original comment by Mike.Popoloski on 5 May 2012 at 4:51