Ejemplo n.º 1
0
    public static CopyMeshJob <T> Create(Simplifier.MappingLinkedNode *pHeadArray, int length)
    {
        CopyMeshJob <T> job = new CopyMeshJob <T>();

        job._pHeadArray = pHeadArray;
        job._array      = new NativeArray <T>(length, Allocator.TempJob);
        job._pArray     = job._array.GetUnsafePtr();

        return(job);
    }
Ejemplo n.º 2
0
    public void Execute(int index)
    {
        Simplifier.MappingLinkedNode *node = _pHeadArray[index].Next;
        int idx = node->Mapping;
        T   tmp = UnsafeUtility.ReadArrayElement <T>(_pArray, idx);

        node = node->Next;
        while (node != null)
        {
            int vidx = node->Mapping;
            T   tmp_ = UnsafeUtility.ReadArrayElement <T>(_pArray, vidx);
            UnsafeUtility.WriteArrayElement <T>(_pArray, vidx, tmp);
            tmp  = tmp_;
            node = node->Next;
        }
    }