internal TrajectoryModel(ref ArrayMemory memory, ref Binary binary)
        {
            //
            // Initialize attributes
            //

            this.binary = MemoryRef <Binary> .Create(ref binary);

            float sampleRate  = binary.SampleRate;
            float timeHorizon = binary.TimeHorizon;

            int trajectoryLength =
                DurationToFrames(timeHorizon * 2.0f, sampleRate);

            trajectory = memory.CreateSlice <AffineTransform>(trajectoryLength);
            for (int i = 0; i < trajectoryLength; ++i)
            {
                trajectory[i] = AffineTransform.identity;
            }

            var accumulatedIdentity =
                AccumulatedTransform.Create(
                    AffineTransform.identity, math.rcp(binary.SampleRate));

            deltaSpaceTrajectory = memory.CreateSlice <AccumulatedTransform>(trajectoryLength * 2);
            for (int i = 0; i < trajectoryLength * 2; ++i)
            {
                deltaSpaceTrajectory[i] = accumulatedIdentity;
            }

            Assert.IsTrue(trajectoryLength == TrajectoryLength);
        }
Example #2
0
        public PoseGenerator(ref ArrayMemory memory, ref Binary binary, float blendDuration)
        {
            triggerTransition = false;

            previousDeltaTime = 0.0f;

            this.blendDuration = blendDuration;

            m_binary = MemoryRef <Binary> .Create(ref binary);

            var numJoints = binary.numJoints;

            currentPushIndex = -1;
            approximateTransitionProgression = 0;

            previousPose = TransformBuffer.Create(ref memory, numJoints);
            currentPose  = TransformBuffer.Create(ref memory, numJoints);

            transitions = memory.CreateSlice <TransformTransition>(numJoints);

            for (int i = 0; i < numJoints; ++i)
            {
                currentPose.transforms[i] = binary.animationRig.bindPose[i].localTransform;

                transitions[i] = TransformTransition.Identity;
            }
        }
 public static TransformBuffer Create(ref ArrayMemory memory, int numTransforms)
 {
     return(new TransformBuffer()
     {
         transforms = memory.CreateSlice <AffineTransform>(numTransforms)
     });
 }