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); }
MotionSynthesizer(BlobAssetReference <Binary> binary, AffineTransform worldRootTransform, float blendDuration, Allocator allocator) { m_binary = binary; arrayMemory = ArrayMemory.Create(); ReserveTraitTypes(ref arrayMemory); PoseGenerator.Reserve(ref arrayMemory, ref binary.Value); TrajectoryModel.Reserve(ref arrayMemory, ref binary.Value); arrayMemory.Allocate(allocator); // We basically copy statically available data into this instance // so that the burst compiler does not complain about accessing static data. traitTypes = ConstructTraitTypes(ref arrayMemory, ref binary.Value); poseGenerator = new PoseGenerator(ref arrayMemory, ref binary.Value, blendDuration); trajectory = new TrajectoryModel(ref arrayMemory, ref binary.Value); rootTransform = worldRootTransform; rootDeltaTransform = AffineTransform.identity; updateInProgress = false; _deltaTime = 0.0f; lastSamplingTime = TimeIndex.Invalid; samplingTime = SamplingTime.Invalid; delayedPushTime = TimeIndex.Invalid; frameCount = -1; lastProcessedFrameCount = -1; isValid = true; isDebugging = false; readDebugMemory = DebugMemory.Create(1024, allocator); writeDebugMemory = DebugMemory.Create(1024, allocator); }