Skip to content

recp/AssetKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,947 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


C/C++ CI CMake Codacy Badge Coverage Status glTF Badge

Patreon: Become a patron Sponsors on Open Collective Backers on Open Collective


Brand-new modern 3D asset importer, exporter library. This library will include common 3D utils funcs. It is written with C99 but C++ wrappers or other language bindings can be written in the future.

This library will try to full support COLLADA specs and glTF specs, plus well-known other 3D formats e.g .obj, .stl, .ply...

πŸ“Œ There is also an optional renderer library called Graphics Kernel (Realtime Rendering) and rays (Path/Ray Tracer) which can render AssetKit contents. You can see how to load AssetKit to Graphics Kernel in AssetKit-GL repo. Both renderers and documentation with samples will be updated regularly...

πŸ“š Documentation (In Progress)

Almost all functions (inline versions) and parameters will be documented inside the corresponding headers.
Complete documentation: http://assetkit.readthedocs.io

Runtime metadata and extension notes:

πŸ’ͺ Supported Formats

  • Asset Exchange (todo) http://github.com/AssetExchange/spec
  • COLLADA 1.4 and COLLADA 1.4.1
  • COLLADA 1.5
  • glTF 2.0 (Embedded or Separated (.gltf), Binary (.glb), Extensions...)
  • Wavefront Obj (.obj + .mtl)
  • STL (ASCII, Binary)
  • PLY (ASCII, Binary)
  • 3MF (in progress)
  • FBX (License?, probably need to download FBX SDK externally)
  • USD and friends (License?)
  • Alembic (License?)
  • Draco
  • X3D
  • in progress for next...
  • Exporter

πŸš€ Features

  • Single interface for glTF 2.0 (with extensions), COLLADA 1.4/1.4.1/1.5, Wavefront Obj and others...
  • Very very small and very fast library
  • Javascript-like API to get URL or ID obj = ak_getObjectById(doc, objectId)...
  • Options to Generate Mesh Normals (Default: enabled)
  • Option to Triangulate Polygons (Default: enabled)
  • Option to change Coordinate System (Default: enabled)
  • Option to calculate Bounding Boxes (Default: enabled)
  • Unique and Flexible Coordinate System
    • Support multiple coordinate system
    • Can convert any coordinate system to another with adding transform or with changing transform, vertex data...
  • Unique and Flexible Memory Management System
    • Hierarchical unique memory management
      • When a node is freed then all sub memories will be freed
    • COLLADA's sid and ID values are mapped to memory nodes itself to reduce memory size and make it easy to manage things.
    • Allow attach ID, sid or user data to a memory node
  • Object-based Asset support; resolve asset element for any element
  • Bugfix some DAE files
  • Will be optimized to be fastest, smallest and most flexible, extendible Asset loader.
  • Uses mmap to load files, you can disable this if needed
  • Documentation
  • Cmake support
  • Tests

πŸ”¨ Build

AssetKit uses CMake on macOS, Linux and Windows. It can be built as a standalone project, embedded with add_subdirectory() or installed and used with find_package().

Standalone CMake build

$ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
$ cmake --build build
$ cmake --install build # [Optional]

On multi-config generators such as Visual Studio or Xcode:

$ cmake -S . -B build
$ cmake --build build --config Release
$ cmake --install build --config Release # [Optional]

Release builds use the platform compiler's optimized release mode. AssetKit also has AK_ENABLE_LTO=ON for link-time optimization when the compiler and generator support it; it is off by default for predictable cross-platform builds.

CMake options with defaults:
option(AK_SHARED "Shared build" ON)
option(AK_STATIC "Static build" OFF)
option(AK_USE_TEST "Enable Tests" OFF)
option(AK_BUILD_GLTF_DRACO_DECODER "Build optional glTF Draco decoder shim" ON)
option(AK_BUILD_GLTF_MESHOPT_DECODER "Build optional glTF meshoptimizer decoder shim" ON)
option(AK_FETCH_DEPS "Fetch optional decoder dependencies into AK_DEPS_ROOT when missing" ON)
option(AK_ENABLE_LTO "Enable link-time optimization for release builds" OFF)

Optional glTF compression decoders are side libraries. They are built next to the main C library by default, but not linked into libassetkit. CMake fetches missing decoder dependencies into deps/ by default, so a normal standalone build produces libassetkit, libassetkit_draco and libassetkit_meshoptimizer when network access is available:

$ cmake -S . -B build
$ cmake --build build

Use -DAK_FETCH_DEPS=OFF with AK_DRACO_ROOT / AK_MESHOPT_ROOT for offline or packaged builds. Use -DAK_BUILD_GLTF_DRACO_DECODER=OFF or -DAK_BUILD_GLTF_MESHOPT_DECODER=OFF to skip these side libraries.

Embedded in another CMake project

AssetKit can be used like a submodule:

cmake_minimum_required(VERSION 3.16)

project(my_app LANGUAGES C)

add_subdirectory(external/assetkit)

add_executable(my_app src/main.c)
target_link_libraries(my_app PRIVATE assetkit::assetkit)

When embedded, AssetKit does not force a default build type on the parent project. If you do not want CMake to fetch optional decoder dependencies while configuring your parent project, pass:

set(AK_FETCH_DEPS OFF CACHE BOOL "" FORCE)
set(AK_BUILD_GLTF_DRACO_DECODER OFF CACHE BOOL "" FORCE)
set(AK_BUILD_GLTF_MESHOPT_DECODER OFF CACHE BOOL "" FORCE)
add_subdirectory(external/assetkit)

Installed package

After cmake --install, consumers can use:

find_package(assetkit CONFIG REQUIRED)
target_link_libraries(my_app PRIVATE assetkit::assetkit)

Windows

Windows builds are supported through CMake. git must be available when GIT_SUBMODULE=ON or AK_FETCH_DEPS=ON.

$ cmake -S . -B build
$ cmake --build build --config Release

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! πŸ™ [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

Trademarks

glTF and COLLADA and their logos are trademarks of Khronos Group.