Skip to content

Commit

Permalink
Added the draco support for UWP and iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
atulafternow committed Nov 15, 2021
1 parent 23b2d40 commit b16e236
Show file tree
Hide file tree
Showing 23 changed files with 535 additions and 9 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added Plugins/.DS_Store
Binary file not shown.
Binary file added Plugins/draco/.DS_Store
Binary file not shown.
24 changes: 15 additions & 9 deletions Plugins/draco/GLTFUtilityDracoLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,48 +98,54 @@ public class AsyncMesh {
public Color[] colors;
}

#if !UNITY_EDITOR && (UNITY_WEBGL || UNITY_IOS)
const string DRACODEC_UNITY_LIB = "__Internal";
#elif UNITY_ANDROID || UNITY_STANDALONE || UNITY_WSA || UNITY_EDITOR || PLATFORM_LUMIN
const string DRACODEC_UNITY_LIB = "dracodec_unity";
#endif

// Release data associated with DracoMesh.
[DllImport("dracodec_unity")] private static extern void ReleaseDracoMesh(
[DllImport(DRACODEC_UNITY_LIB)] private static extern void ReleaseDracoMesh(
DracoMesh * * mesh);
// Release data associated with DracoAttribute.
[DllImport("dracodec_unity")] private static extern void
[DllImport(DRACODEC_UNITY_LIB)] private static extern void
ReleaseDracoAttribute(DracoAttribute * * attr);
// Release attribute data.
[DllImport("dracodec_unity")] private static extern void ReleaseDracoData(
[DllImport(DRACODEC_UNITY_LIB)] private static extern void ReleaseDracoData(
DracoData * * data);

// Decodes compressed Draco::Mesh in buffer to mesh. On input, mesh
// must be null. The returned mesh must released with ReleaseDracoMesh.
[DllImport("dracodec_unity")] private static extern int DecodeDracoMesh(
[DllImport(DRACODEC_UNITY_LIB)] private static extern int DecodeDracoMesh(
byte[] buffer, int length, DracoMesh * * mesh);

// Returns the DracoAttribute at index in mesh. On input, attribute must be
// null. The returned attr must be released with ReleaseDracoAttribute.
[DllImport("dracodec_unity")] private static extern bool GetAttribute(
[DllImport(DRACODEC_UNITY_LIB)] private static extern bool GetAttribute(
DracoMesh * mesh, int index, DracoAttribute * * attr);
// Returns the DracoAttribute of type at index in mesh. On input, attribute
// must be null. E.g. If the mesh has two texture coordinates then
// GetAttributeByType(mesh, AttributeType.TEX_COORD, 1, &attr); will return
// the second TEX_COORD attribute. The returned attr must be released with
// ReleaseDracoAttribute.
[DllImport("dracodec_unity")] private static extern bool GetAttributeByType(
[DllImport(DRACODEC_UNITY_LIB)] private static extern bool GetAttributeByType(
DracoMesh * mesh, AttributeType type, int index, DracoAttribute * * attr);
// Returns the DracoAttribute with unique_id in mesh. On input, attribute
// must be null.The returned attr must be released with
// ReleaseDracoAttribute.
[DllImport("dracodec_unity")] private static extern bool
[DllImport(DRACODEC_UNITY_LIB)] private static extern bool
GetAttributeByUniqueId(DracoMesh * mesh, int unique_id,
DracoAttribute * * attr);

// Returns an array of indices as well as the type of data in data_type. On
// input, indices must be null. The returned indices must be released with
// ReleaseDracoData.
[DllImport("dracodec_unity")] private static extern bool GetMeshIndices(
[DllImport(DRACODEC_UNITY_LIB)] private static extern bool GetMeshIndices(
DracoMesh * mesh, DracoData * * indices);
// Returns an array of attribute data as well as the type of data in
// data_type. On input, data must be null. The returned data must be
// released with ReleaseDracoData.
[DllImport("dracodec_unity")] private static extern bool GetAttributeData(
[DllImport(DRACODEC_UNITY_LIB)] private static extern bool GetAttributeData(
DracoMesh * mesh, DracoAttribute * attr, DracoData * * data);

// Decodes a Draco mesh, creates a Unity mesh from the decoded data and
Expand Down
Binary file added Plugins/draco/Plugin/.DS_Store
Binary file not shown.
Binary file added Plugins/draco/Plugin/WSA/.DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions Plugins/draco/Plugin/WSA/ARM.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Plugins/draco/Plugin/WSA/ARM/dracodec_unity.dll
Binary file not shown.
82 changes: 82 additions & 0 deletions Plugins/draco/Plugin/WSA/ARM/dracodec_unity.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Plugins/draco/Plugin/WSA/ARM64.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
82 changes: 82 additions & 0 deletions Plugins/draco/Plugin/WSA/ARM64/dracodec_unity.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Plugins/draco/Plugin/WSA/x64.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Plugins/draco/Plugin/WSA/x64/dracodec_unity.dll
Binary file not shown.
82 changes: 82 additions & 0 deletions Plugins/draco/Plugin/WSA/x64/dracodec_unity.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Plugins/draco/Plugin/WSA/x86.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Plugins/draco/Plugin/WSA/x86/dracodec_unity.dll
Binary file not shown.
Loading

0 comments on commit b16e236

Please sign in to comment.