Effekseer Native for JME (wip)

This is an implementation of Effekseer for jme.

It differs from this other one because it uses Effekseer’s Runtime and some trickery to render the particles into a framebuffer, while @destroflyer 's one is a rewrite in java.

The library uses the same logic of the editor via the native apis, this means it can support all the features out of the box, however, being it a native library, it is not as portable as the java implementation and is currently limited only to Windows and Linux 64 bit with OpenGL 3+.

You can find usage infos and gradle coordinates on the github repo.
In the following days I will clean the code a little bit and add some comments and a store page.

19 Likes

Very cool! Nice job :slightly_smiling_face:

1 Like

Nice job :slightly_smiling_face:

It seems a GLES backend should be possible too. Some LibGdx guy has done this by adding a flag I guess. :thinking:

More info:

Edit:

And using that flag to select appropriate EffekseerRenderer at native side:

Yes, it’s supported in Effekseer, but this is a limitation of the way i implemented it in jme.
The current code uses glBlitFramebuffer to copy the scene depth into the target framebuffer. I can look into a workaround if support for lower versions is needed…

GLES 3.0 (which is supported in JME) already supports glBlitFramebuffer.

https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glBlitFramebuffer.xhtml

Sure, but jme doesn’t use GLES on desktop, and the native library doesn’t have android builds yet

I mean OpenGL 3.0+ for desktop and OpenGL ES 3.0+ for mobile.

By the way in Effekseer 1.5 it is possible to control the effect with dynamic input parameters at runtime.

https://effekseer.github.io/Help_Tool/en/ToolReference/dynamicParameter.html

Would be nice to support that. :slightly_smiling_face:

You might find this useful for building Effekseer android natives.

Also you can get the the prebuilt ones here:https://github.com/SrJohnathan/ParticlesLIbgdx

Added

        effekt.setDriver(new EffekseerEmissionDriverGeneric()
            .dynamicInputsSupplier((handle,setter)->{
                // Set input 0 = 10
                setter.set(0,10);
            })
        );

(the input supplier is called every frame )

For now i am not interested to get it on android, but contributions are welcomed

Also, i changed some things and OpenGL 2 should work now.

2 Likes

Thanks

I added cloning/serialization logic and made some changes to the driver class (mostly to allow serialization). Now the usage looks like this

        effekt.setDriver(
            new EffekseerEmissionDriverGeneric()
                .shape(new EffekseerPointFollowingSpatialShape())
                .spawner(new EffekseerGenericSpawner().loop(true).delay(0.4f, 1f, 1f).maxInstances(1000))
                .dynamicInputSupplier(new EffekseerGenericDynamicInputSupplier().set(0,10f).set(1,11f))
        );

Note: now it is possible to serialize the Effekseer emitter into a j3o, however the library is still required at runtime and likewise the efkefc file and all the relative resources must be accessible by the asset manager.

1 Like

I got this

Could not resolve all files for configuration ':compileClasspath'.
> Could not find effekseer:effekseer-native:jme.1.1.1.
  Searched in the following locations:
      file:/C:/Users/Pesegato/.m2/repository/effekseer/effekseer-native/jme.1.1.1/effekseer-native-jme.1.1.1.pom
      file:/C:/Users/Pesegato/.m2/repository/effekseer/effekseer-native/jme.1.1.1/effekseer-native-jme.1.1.1.jar
      https://jcenter.bintray.com/effekseer/effekseer-native/jme.1.1.1/effekseer-native-jme.1.1.1.pom
      https://jcenter.bintray.com/effekseer/effekseer-native/jme.1.1.1/effekseer-native-jme.1.1.1.jar
      https://jitpack.io/effekseer/effekseer-native/jme.1.1.1/effekseer-native-jme.1.1.1.pom
      https://jitpack.io/effekseer/effekseer-native/jme.1.1.1/effekseer-native-jme.1.1.1.jar
  Required by:
      project : > com.github.riccardobl:jme-effekseerNative:-SNAPSHOT

I’m using gradle 4.2 and

compile 'com.github.riccardobl:jme-effekseerNative:-SNAPSHOT'

Oh, add this repo, i forgot to add it to the readme

    maven {
         url  "https://dl.bintray.com/riccardo/effekseer" 
    }
1 Like
GRAVE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.UnsatisfiedLinkError: C:\gd\psgt\ppppvsssss\EffekseerNativeForJava.dll: Can't find dependent libraries
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
	at java.lang.Runtime.load0(Runtime.java:809)
	at java.lang.System.load(System.java:1086)
	at com.jme3.system.NativeLibraryLoader.loadNativeLibrary(NativeLibraryLoader.java:685)
	at com.jme.effekseer.Effekseer.<clinit>(Effekseer.java:60)
	at com.jme.effekseer.EffekseerPostRenderer.<init>(EffekseerPostRenderer.java:19)
	at com.pesegato.p8s.appstates.Loading3AppState.initialize(Loading3AppState.java:187)
	at com.jme3.app.state.BaseAppState.initialize(BaseAppState.java:132)
	at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:317)
	at com.jme3.app.state.AppStateManager.update(AppStateManager.java:347)
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:255)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:153)
	at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:193)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:234)
	at java.lang.Thread.run(Thread.java:745)

The missing library is VCRUNTIME140_1.dll . It’s a problem with VCRUNTIME not being statically linked in the windows build. I am looking into it.

1 Like

It should be fixed now

1 Like

it isn’t. But gradle clean run don’t download new jars, how should I force it to?

gradle build --refresh-dependencies. Also remove the extracted dll from your project root

1 Like

Now is loaded but:

GRAVE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.NullPointerException
	at com.jme.effekseer.EffekseerEmitterControl.isChildOf(EffekseerEmitterControl.java:64)
	at com.jme.effekseer.EffekseerEmitterControl.isChildOf(EffekseerEmitterControl.java:64)
	at com.jme.effekseer.EffekseerEmitterControl.isChildOf(EffekseerEmitterControl.java:64)
	at com.jme.effekseer.EffekseerEmitterControl.isChildOf(EffekseerEmitterControl.java:59)
	at com.jme.effekseer.Effekseer.lambda$beginScene$0(Effekseer.java:224)
	at java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90)
	at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
	at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:449)
	at com.jme.effekseer.Effekseer.beginScene(Effekseer.java:224)
	at com.jme.effekseer.EffekseerPostRenderer.postFrame(EffekseerPostRenderer.java:71)
	at com.jme3.post.FilterPostProcessor.renderFilterChain(FilterPostProcessor.java:285)
	at com.jme3.post.FilterPostProcessor.postFrame(FilterPostProcessor.java:334)
	at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1114)
	at com.jme3.renderer.RenderManager.render(RenderManager.java:1166)
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:272)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:153)
	at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:193)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:234)
	at java.lang.Thread.run(Thread.java:745)

Fixed in ed6085f903433b45127a41a0ed689dbf7c686638. Can you try the new snapshot?