Example #1
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;
            }
        }
            Memory(int numTransforms, Allocator allocator)
            {
                int transformSize = 0;

                unsafe
                {
                    transformSize = UnsafeUtility.SizeOf <AffineTransform>();
                }

                memory = ArrayMemory.Create();
                memory.Reserve <AffineTransform>(numTransforms);
                memory.Allocate(allocator);

                buffer = Create(ref memory, numTransforms);
            }
 internal void CopyFrom(ref TransformBuffer transformBuffer)
 {
     transforms.CopyFrom(transformBuffer.transforms);
 }