BITFALL/Assets/Plugins/Polaris - Low Poly Ecosystem/Polaris - Low Poly Terrain .../Runtime/Scripts/Physics/GTransformTreesToLocalSpace...

32 lines
809 B
C#
Raw Normal View History

2024-03-05 17:34:41 +08:00
#if GRIFFIN
2023-12-30 17:37:48 +08:00
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Unity.Jobs;
using Unity.Collections;
using Unity.Burst;
namespace Pinwheel.Griffin.Physic
{
#if GRIFFIN_BURST
[BurstCompile(CompileSynchronously = false)]
#endif
public struct GTransformTreesToLocalSpaceJob : IJobParallelFor
{
public NativeArray<GTreeInstance> instances;
public Vector3 terrainSize;
public void Execute(int index)
{
GTreeInstance tree = instances[index];
Vector3 pos = new Vector3(
tree.position.x * terrainSize.x,
tree.position.y * terrainSize.y,
tree.position.z * terrainSize.z);
tree.position = pos;
instances[index] = tree;
}
}
}
2024-03-05 17:34:41 +08:00
#endif