ctreffs/SwiftAssimp
Swift wrapper around Open Asset Import Library (aka assimp) for macOS and Linux
๐ Getting Started
These instructions will get your copy of the project up and running on your local machine and provide a code example.
๐ Prerequisites
- Swift Package Manager (SPM)
- Open Asset Import Library (Assimp)
- SwiftEnv for Swift version management - (optional)
- Swiftlint for linting - (optional)
๐ป Installing
Swift Assimp is available for all platforms that support Swift 5.3 and higher and the Swift Package Manager (SPM).
Extend your Package.swift file with the following lines or use it to create a new project.
For package manifests using the Swift 5.3+ toolchain use:
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "YourPackageName",
dependencies: [
.package(name: "Assimp", url: "https://github.com/ctreffs/SwiftAssimp.git", from: "2.1.0")
],
targets: [
.target(
name: "YourTargetName",
dependencies: ["Assimp"])
]
)
Since it's a system library wrapper you need to install the assimp library (>=5.0.0) either via
brew install assimpor
apt-get install libassimp-devdepending on you platform.
๐ Code Example
import Assimp
let scene: AiScene = try AiScene(file: <path/to/model/file.obj>,
flags: [.removeRedundantMaterials, .genSmoothNormals]))
// get meshes
let meshes: [AiMesh] = scene.meshes
// get materials
let matrials: [AiMaterial] = scene.materials
// get the root node of the scene graph
let rootNode: [AiNode] = scene.rootNode
See the unit tests for more examples.
๐ Help needed
This project is in an early stage and needs a lot of love. If you are interested in contributing, please feel free to do so!
Things that need to be done are, among others:
๐ท๏ธ Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
๐ Licenses
This project is licensed under the 3-Clause BSD License - see the LICENSE file for details.
- assimp licensed under 3-clause BSD license
๐ Original code
Since Swift Assimp is merely a wrapper around assimp it obviously depends on it. Support them if you can!
Open Asset Import Library (assimp)
From assimp/assimp/Readme.md:
A library to import and export various 3d-model-formats including scene-post-processing to generate missing render data.
One-off donations via PayPal: <br>[[PayPal]](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JRJVPXC4QJM4)
โฎ๏ธ Alternatives
Package Metadata
Repository: ctreffs/SwiftAssimp
Homepage: https://www.assimp.org
Stars: 35
Forks: 8
Open issues: 10
Default branch: master
Primary language: swift
License: BSD-3-Clause
Topics: assimp, bsd-3-clause, library, spm, swift, swift-package-manager
README: README.md