forked from atteneder/glTFast
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathAccessorData.cs
More file actions
60 lines (54 loc) · 1.34 KB
/
AccessorData.cs
File metadata and controls
60 lines (54 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors
// SPDX-License-Identifier: Apache-2.0
using System;
using System.Runtime.InteropServices;
using UnityEngine;
using Unity.Collections;
namespace GLTFast
{
[Flags]
enum AccessorUsage
{
Unknown = 0,
Ignore = 1 << 0,
Index = 1 << 1,
IndexFlipped = 1 << 2,
Position = 1 << 3,
Normal = 1 << 4,
Tangent = 1 << 5,
UV = 1 << 6,
Color = 1 << 7,
InverseBindMatrix = 1 << 8,
AnimationTimes = 1 << 9,
Translation = 1 << 10,
Rotation = 1 << 11,
Scale = 1 << 12,
Weight = 1 << 13,
RequiredForInstantiation = 1 << 14,
Pointer = 1 << 15,
}
abstract class AccessorDataBase
{
public abstract void Unpin();
public abstract void Dispose();
}
class AccessorData<T> : AccessorDataBase
{
public T[] data;
public GCHandle gcHandle;
public override void Unpin()
{
gcHandle.Free();
}
public override void Dispose() { }
}
class AccessorNativeData<T> : AccessorDataBase where T : struct
{
public NativeArray<T> data;
public override void Unpin() { }
public override void Dispose()
{
data.Dispose();
}
}
}