GithubHelp home page GithubHelp logo

kotlin-graphics / assimp Goto Github PK

View Code? Open in Web Editor NEW
92.0 19.0 28.0 71.55 MB

JVM Open Asset Import Library (Assimp)

License: Other

Kotlin 33.99% UnrealScript 0.03% GLSL 0.08% COBOL 65.73% ShaderLab 0.02% Rich Text Format 0.14% Java 0.02%
assimp kotlin java

assimp's Introduction

assimp

Build Status license Release Size Github All Releases Awesome Kotlin Badge

JVM porting of Assimp

This port is being written trying to stick as much as possible close to the C version in order to:

  • minimize maintenance to keep it in sync with the original
  • minimize differences for people used to dev/work with Assimp

Code

A small example how to load files:

  • for java users:
AiScene scene = new Importer().readFile("test/resources/models/OBJ/box.obj");
  • for kotlin users:
val scene = Importer().readFile("test/resources/models/OBJ/box.obj")

Port Status

Format priority list

If you have a format or a feature which is not yet supported, you can use the original assimp (or the lwjgl one) to load the mesh you have and save it in assimp binary format (.assbin). Once done, you can load it with this port.

In case you don't know how to do it, you may open an issue giving the mesh, specifying the options and I'll convert it for you into binary assimp.

Please note that using the binary assimp format is also the fastest way to import meshes into your application.

The development is essentially feature-driver, if you want to express your preference -> Format wish list

Contributions:

Do not hesitate to offer any help: pushes (java or kotlin, it doesn't matter), testing, website, wiki, etc

Comparison to a simple binding

Advantages:

  • runs entirely on jvm (Garbage Collector)
  • lighter import
  • written in Kotlin (less code to write, more features, more expressiveness)
  • cleaner, more intuitive interface (especially the Material part)
  • plain names, without prefixes
  • possibility to set the build-time flags and property (debug/config/log)
  • easier to debug
  • easier to modify/customize, e.g: textures get automatically loaded and offered via gli library, you just have to upload them to GL
  • matrices are column-major instead of row-major and offered via the glm library
  • easier to fix (found a couple of bugs on the original assimp, opened an issue, I didn't have to wait for the next releases fix)
  • reduced the maintenance at minimum by keeping the same structure as possible during the port
  • possible to get the same loading speed, using binary assimp format

Disadvantages:

  • code needs to be ported from cpp to java
  • code needs to be maintained
  • a little slower compared to cpp when loading big meshes if not using assbin

assimp's People

Contributors

afrankel7861 avatar elect86 avatar gynt avatar hugobros3 avatar hwvenancio avatar sunny1337 avatar sylvyrfysh avatar wasabi375 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

assimp's Issues

cloning project - missing classes

Hi,
after a long break im back.
Just tried to clone your changes and unfortunately im missing some classes so im unable to compile.

AiVector3D

Also i have mistakenly deleted the invite to slack could you invite me again so we can try and resolve the issues ive been having?

thanks.

Missing dependency on GLM

Hi there,

there also seems to be missing a dependency on GLM: AiMesh has e.g. the vertices attribute, which is an ArrayList of AiVector3D, which in turn is a typemap to Vec3, and that is coming from GLM, which is not declared as a dependency in build.gradle.

Textures only appear in OBJ models

So far my texture list in an AiScene remains empty for FBX and DAE (1.4.1) formats. OBJ does seem to read the texture file names correctly. I've verified that the models do contain textures that come in alright in the assimpviewer application. I've had my artist export the same model through a variety of applications and formats and the end result is the same. Are textured materials only supported through OBJ models in the Kotlin port currently? I've attached a zip of the model in various formats I've been using for testing. Thanks.
JoshTest.zip

kotlin.KotlinNullPointerException when importing step file

I'm creating a POC for visualizing STP files in a Java application.
I try to import the step file using the Importer().readFile() method and this gives a

Exception in thread "main" kotlin.KotlinNullPointerException
	at uno.kotlin.UtilKt.getUrl(util.kt:22)
	at uno.kotlin.UtilKt.getUri(util.kt:21)
	at assimp.Importer.readFile(Importer.kt:308)

This by only set this line of code:
AiScene scene = new Importer().readFile(fileName, 0);
fileName variable is the full path to the stp file.

read from memory relative paths

MD3 sometimes uses relative paths to resolve shaders. It's also possible that other formats reference textures with relative paths.
The MemoryIOSystem does not fully support them. It's not possible to use .. to reference the parent directory.
There are 3 options to solve this:

  1. A simple workaround by adjusting the name of a buffer when passing it to the ioSystem eg. "somePath/../../../scripts/object.shader" as the name for the buffer. This works for now but I don't think it's a permanent solution.
  2. modify the ioSystem so that it can handle paths with ".." in them.
  3. Move from using String to java.nio.file.Path to qualify the buffers in MemoryIOSystem. This way resolving paths would be trivial but it would require a full implementation of Path, FileSystem and FileSystemProvider. This is a lot of effort and I'm not sure it's worth it.

I think option 2 is the best on. It should work in all cases. Option 3 is overkill as the user should not interact with the ioSystem themself.

Building on latest Android Studio project with assimp version 4.0

Hello,
I have an Android OpenGL project and am trying to use assimp to load some 3D models in my project. In my build.gradle file, I included this:

implementation "com.github.kotlin-graphics:assimp:4.0"

However, my project fails to build. The first error I see is the following:

More than one file was found with OS independent path 'libglfw.so.sha1'

Any ideas on how to workaround this? When I tried excluding this in the gradle packagingOptions (which I don't think is a good idea, but I tried anyway), I got additional More than one file was found ... errors. All in all, these are the ones that caused the conflict:

libglfw.so.sha1
liblwjgl_opengl.so.sha1
libglfw_wayland.so.sha1
liblwjgl.so.sha1
liblwjgl_stb.so.sha1
logo-mini.png
libopenal.so.sha1
libjemalloc.so.sha1

Any ideas on how to work around this?

SNAPSHOT dependencies in release versions, and maybe unnecessary dependencies?

Hi there!

Some release versions, e.g. 4.0, have SNAPSHOT dependencies in the gradle-created POM, which kind of jeopardizes build stability:

    <dependency>
      <groupId>org.lwjgl</groupId>
      <artifactId>lwjgl-opengl</artifactId>
      <version>3.1.4-SNAPSHOT</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.lwjgl</groupId>
      <artifactId>lwjgl-stb</artifactId>
      <version>3.1.4-SNAPSHOT</version>
      <scope>compile</scope>
    </dependency>

I also don't see why assimp needs to depend on lwjgl-openal, lwjgl-opengl, lwjgl-jemalloc, lwjgl-glfw and lwjgl-glfw, as they are not used anywhere. There are also explicit dependencies on the Linux natives, e.g.

<dependency>
      <groupId>org.lwjgl</groupId>
      <artifactId>lwjgl-openal</artifactId>
      <version>3.1.4-SNAPSHOT</version>
      <classifier>natives-linux</classifier>
      <scope>runtime</scope>
 </dependency>

It'd be great if that could be fixed, I'm also more than happy to contribute a PR if that's wanted 👍

cheers!

Format wish list

I am opening this issue in order to have a priority list about which format we should work on next.

wish list

Please don't hesitate to join

A couple of tests failing on Travis and Gradle

Hi guys,

I have some problems: running tests from within Idea works flawless.

But running from travis, I get one error:

assimp.obj.obj > wall FAILED
    java.lang.OutOfMemoryError at obj.kt:15

running from Gradle via console:

assimp.obj.obj > wall FAILED
    java.lang.OutOfMemoryError at obj.kt:14

assimp.obj.obj > car FAILED
    org.opentest4j.AssertionFailedError at obj.kt:17

Can someone assist me and try to find out what is going on? (I think OutOfMemoryError might be related to java heap size)

Can anyone reproduce the errors locally from the IDE?

How do I setup this in a Java project in Netbeans?

Hi, I'm unfamiliar with kotlin.

So I download the project into my Linux Mint and then what?
I assume that this can be used to generate a Jar that I'll include in my project.
But how.
Alternatively, via a Maven project.

U

Hello.

Could not find org.lwjgl:lwjgl:3.1.7-SNAPSHOT

I'm trying to use this library, but gradle fails with an error that it can't find lwjgl:3.1.7-SNAPSHOT.
I import it using gradle and jitpack. I tried version "4.0", "4.0-beta.11", "4.0-beta.10" and "4.0-beta.09".

I've created a test project to reproduce the error: https://github.com/Wasabi375/assimpTest

I think the easiest way to fix this is to change the lwjgl version from snapshot to one of the stable releases.

Could not find com.github.kotlin-graphics:uno-sdk:v0.7.3.

hello,can you help me?
I use android studio to build examples and rely on this project,it occured this error --->Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.github.kotlin-graphics:uno-sdk:v0.7.3.

loading spider.fbx gives numMeshes = 0?

hi, good initiative to wrap assimp for kotlin!

I implemented 'com.github.kotlin-graphics:assimp:v4.0-beta15' (also tried it with beta14)
and did a val scene = Importer().readFile("spider.fbx") followed by println("scene has ${scene!!.numMeshes} meshes") yet, that returns 0... hence it also does not load any vertex data in further loading stages as I assume you loop with numMeshes to create each AiMesh. It does seem to count numLights and numCameras correctly. Also, loading an .obj, it all works fine in terms of getting the right vertex data for my buffers. (obviously spider.fbx is the one in your test data)

Any clue what's with that? Oh and a second question, any way to turn the built-in logger more (and less) verbose? e.g. repress material warnings when you don't supply a .mtl and stuff :)

Reports an error required minSdkVersion >= 26

Hi,

I was trying to work with assimp-all.jar on an android project supporting API 21 and above. When I added this jar and tried to build the project, I get an error saying required mindSdkVersion >= 26. Since it was not mentioned on the README page, I am trying to confirm the same here. Also, if true, are there any plans for backward compatibility?

Using on Android

Hi when loading the library on android i get the following error.

Caused by: java.lang.ClassNotFoundException: Didn't find class "java.nio.file.Paths"

When i do this call.

        Importer importer = new Importer();
        AiScene scene = importer.readFile(new URI(path), 1 | 8);

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.