CesiumGS / cesium-omniverse

Bringing the 3D geospatial ecosystem to Omniverse
https://cesium.com/platform/cesium-for-omniverse/
Apache License 2.0
51 stars 7 forks source link

C API #3

Open lilleyse opened 1 year ago

lilleyse commented 1 year ago

We should consider providing an ABI stable C interface for CesiumOmniverse, inspired by the concept of Omniverse Native Interfaces (ONI) as described in the Carbonite SDK documentation.

The initial skeleton of this can be found in CesiumOmniverse.h. We would need to think of an elegant way to pass through USD objects such as UsdStageRefPtr and GfMatrix4d.

This also affects the Python API which is essentially just a wrapper of the C++ API. If we switched to a C API we could consider switching from pybind11 to cython.

lilleyse commented 1 year ago

Mostly fixed in https://github.com/CesiumGS/cesium-omniverse/pull/44. The functions exported from CesiumOmniverse.dll are now exported as C functions.

However CesiumOmniverse.h still includes some pxr headers, which means that you can't include CesiumOmniverse.h in a C project. pxr::UsdStageRefPtr in particular is a problem because it's a somewhat complicated typedef and not easy to forward declare.

lilleyse commented 5 months ago

The dependency on pxr headers was removed in #626. However we still have a lot of C++ runtime types in the interface, which is disallowed (see http://omniverse-docs.s3-website-us-east-1.amazonaws.com/carbonite/164.0-pre/docs/ABI.html#c-runtime-library-types).