You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using LanLib.UpdateManager.Extensions;
|
|
using UnityEngine.Jobs;
|
|
|
|
namespace LanLib.UpdateManager.Jobs.Internal
|
|
{
|
|
public class UpdateTransformJobData<TData, TDataProvider> : UpdateJobData<TData, TDataProvider>
|
|
where TData : struct
|
|
where TDataProvider : IInitialTransformJobDataProvider<TData>
|
|
{
|
|
public TransformAccessArray Transforms => _transforms;
|
|
|
|
protected TransformAccessArray _transforms;
|
|
|
|
public override void EnsureCapacity(int newSize)
|
|
{
|
|
base.EnsureCapacity(newSize);
|
|
if (!_transforms.isCreated)
|
|
{
|
|
TransformAccessArray.Allocate(newSize, -1, out _transforms);
|
|
}
|
|
}
|
|
|
|
public override void Add(TDataProvider dataProvider, int index)
|
|
{
|
|
base.Add(dataProvider, index);
|
|
_transforms.Add(dataProvider.Transform);
|
|
}
|
|
|
|
public override void RemoveAtSwapBack(int index)
|
|
{
|
|
base.RemoveAtSwapBack(index);
|
|
_transforms.RemoveAtSwapBack(index);
|
|
}
|
|
|
|
public override void Dispose()
|
|
{
|
|
base.Dispose();
|
|
_transforms.DisposeIfCreated();
|
|
}
|
|
}
|
|
} |