Basic Draco C# bindings.
Basic usage:
Draco.Mesh mesh = Draco.Decompress(compressedData, compressedDataSize);
for(UInt32 aitribI = 0; attribI < mesh.numAttributes; attribI++)
{
Attribute attrib = mesh.GetAttribute(attribI);
Draco.Data data = Draco.GetData(mesh, attrib);
if(data.dataType == DataType.DT_FLOAT32)
{
var verts = (float*)data.data;
for(UInt32 vertI = 0; vertI < mesh.numVertices; vertI++)
{
for(UInt compI = 0; compI < attrib.numComponents; compI++)
{
// ...
}
}
}
Draco.Release(data);
}
Draco.Release(mesh);
Native libraries are built from our fork of the draco library.
Download the repo
git clone https://github.com/EvergineTeam/draco.git
cd draco
You need:
- Python3
- CMake
- Visual Studio C++
Just run the build.py
script
python build.py
You need:
- Python3
- CMake
- Emscripten SDK
- Ninja
Run the build.py script, and provide the path to the Emscripten SDK:
python build.py --emscripten_sdk C:/APPS/emsdk
NOTE: Unlike in other platforms, in Wasm, we need to use a static library. Emscripten doesn't have good support for shared libraries and performance is much worse.
You need:
- Python3
- CMake
- Android NDK
- Ninja
Run the build.py script, and provide the path to the Android NDK:
python build.py --android_ndk C:/APPS/android-ndk-r26d
If you can compile all platforms with a single cmd:
python build.py --emscripten_sdk C:/APPS/emsdk --android_ndk C:/APPS/android-ndk-r26d
You will find all the compiled libraries in the "build/OUT" folder.
Copy the contents of "build/OUT" to this repo inside "Evergine.Bindings.Draco".
Run the Generate-Nugets.ps1
script.
There is also a github Action for publishing the nuget to .
Just add the nuget dependency to your project.
NOTE: for Wasm, you will also need to add the dependency to the .Web
project! This is because the static library needs to be linked to the executable (not to a dll).