Giter Club home page Giter Club logo

swiftassimp's Introduction

Swift Assimp

macOS Linux license

This is a thin Swift wrapper around the popular and excellent Open Asset Import Library library.
It provides a swifty and typesafe API.

Open Asset Import Library (short name: Assimp) is a portable Open Source library to import various well-known 3D model formats in a uniform manner. The most recent version also knows how to export 3d files and is therefore suitable as a general-purpose 3D model converter. Loads 40+ 3D file formats into one unified and clean data structure.
~ www.assimp.org

๐Ÿš€ Getting Started

These instructions will get your copy of the project up and running on your local machine and provide a code example.

๐Ÿ“‹ Prerequisites

๐Ÿ’ป 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 assimp

or

apt-get install libassimp-dev

depending 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:

  • Wrap more assimp functions and types
  • Support for Cocoapods packaging
  • Support for Carthage packaging
  • Write some additional tests to improve coverage

๐Ÿท๏ธ Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

โœ๏ธ Authors

See also the list of contributors who participated in this project.

๐Ÿ” Licenses

This project is licensed under the 3-Clause BSD License - see the LICENSE file for details.

๐Ÿ™ 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)

A library to import and export various 3d-model-formats including scene-post-processing to generate missing render data.

One-off donations via PayPal:
PayPal

โ˜ฎ๏ธ Alternatives

swiftassimp's People

Contributors

ctreffs avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

swiftassimp's Issues

Compilation error since latest Assimp release : AIMesh.swift : cannot assign value of type 'aiMorphingMethod' to type 'UInt32'

Bug Description

I just tried to compile SwiftAssimp (latest version 2.2.0) on a 5.9-jammy Swift server using latest Assimp release (5.3.1) and the compilation crash as below :

/SwiftAssimp/Sources/Assimp/AiMesh.swift:35:16: error: cannot assign value of type 'aiMorphingMethod' to type 'UInt32' method = mesh.mMethod ^ ( ).rawValue error: fatalError

Information

  • Package version: release 2.2.0
  • Platform version: 5.9-jammy swift dockerhub image

Checklist

  • If possible, I've reproduced the issue using the main/master branch of this package.
  • I've searched for existing issues under the issues tab.
  • The bug is reproducible

Steps to Reproduce

Steps to reproduce the behavior:

  1. Start a new project using SwiftAssimp 2.2.0 with a local Assimp 5.3.1 lib installed
  2. Run swift build -c release --static-swift-stdlib -Xlinker -u -Xlinker _swift_backtrace_isThunkFunction

Cannot find TextureTypeToString in scope AiTextureType.swift

Bug Description

*A clear and concise description of what the bug is.
When i add this this package as package dependencies and try to build my application i got build failure error that reads as
String(cString: TextureTypeToString(aiTextureType(rawValue: rawValue)))
Cannot find TextureTypeToString in scope
it is in AiTextureType.swift file

Information

branch master
macOS 12.5 Monterey
swift version 5.6.1

Checklist

  • [ x] If possible, I've reproduced the issue using the main/master branch of this package.
  • [ x] I've searched for existing issues under the issues tab.
  • [ x] The bug is reproducible

Steps to Reproduce

Steps to reproduce the behavior:

Add this package as package dependencies and try to build your application

extension AiTextureType: CustomDebugStringConvertible {
public var debugDescription: String {
String(cString: TextureTypeToString(aiTextureType(rawValue: rawValue)))
}
}

Expected behavior

This should build without any problem

Actual behavior

i got build failure with above message

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci-linux.yml
  • actions/checkout v3.6.0
  • actions/cache v3.3.1
  • actions/cache v3.3.1
.github/workflows/ci-macos.yml
  • actions/checkout v3.6.0
  • actions/cache v3.3.1
  • actions/cache v3.3.1
  • actions/upload-artifact v3.1.2
  • actions/upload-artifact v3.1.2
  • macos 13
.github/workflows/markdown-link-check.yml
mint
Mintfile
  • realm/SwiftLint 0.52.4
  • nicklockwood/SwiftFormat 0.52.3

  • Check this box to trigger a request for Renovate to run again on this repository

Assimp Headers not found

Hey,

I cloned the project and tried to build it but it fails to find the header files. I installed assimp using brew, and it is even linked from /usr/local/include

There is this note about pkgConfig in the Package.swift but I am not sure what I need to do.

Can you help me out?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.