JopsMonkey - particle system for jME

If I may add…


  1. JopsNode seems like miss-usage of scenegraph for simple purpose of maintaining several fields and its main task seems to be adjusting the rotation (in case particleNode is attached to the 'world' node). I think Controller subclass would fit this job better.


  2. ParticleGeneratorMesh loads Texture via JME's TextureManager. While acceptable for most applications, we use custom ResourceManager system that supplies textures for whole application, and this class might take Texture instance via constructor parameter, or at least add another field, instance of some ??TextureGet?? interface to be supplied.





    I'll try to implement both notes and if you decide to change the original code, I'll send them right away.

Hi guys,



I ported JopsMonkey to run with JME2.0 (see Screenshot attached).

It runs at amazing 1,3k FPS .



I’m really excited as this amazing stuff is going to appear pretty soon on a multitouch-table :slight_smile:



I was using Making the transition from jME 1.0 to jME 2.0 what helped me on almost every problem.



But there are some minor things I’m no sure whether they are fully correct (1 started with JME today  )


  1. The values from the switch case of the following function:

   protected int getBlendFactor( int glBlendFactorInteger )
   {
      switch ( glBlendFactorInteger )
      {
      case 1:
         return AlphaState.SB_ONE;

      case 0:
         return AlphaState.SB_ZERO;

      case 772:
         return AlphaState.SB_DST_ALPHA;



I could convert the only at the best guess, as not everything seems to be supported  :? :
Are these some magic numbers I can look up somewhere or is this very specific to JOPS (so I'll have to ask the author)  :?
The ones with the // comment behind are the ones where I could not find a "match that sounds like the abbreviation from 1.0"

   protected SourceFunction getSourceFunctionByFactor(final int pGLBlendFactor) {
      switch (pGLBlendFactor) {
         case 1:
            return BlendState.SourceFunction.One;
         case 0:
            return BlendState.SourceFunction.Zero;
         case 772:
            return BlendState.SourceFunction.DestinationAlpha;
         case 774:
            return BlendState.SourceFunction.DestinationColor;
         case 770:
            return BlendState.SourceFunction.SourceAlpha;
         case 768:
            return BlendState.SourceFunction.DestinationColor;
         case 773:
            return BlendState.SourceFunction.OneMinusDestinationAlpha;
         case 775:
            return BlendState.SourceFunction.OneMinusDestinationColor;
         case 771:
            return BlendState.SourceFunction.OneMinusSourceAlpha;
         case 776:
            return BlendState.SourceFunction.SourceAlphaSaturate;
         case 769:
            return BlendState.SourceFunction.OneMinusDestinationColor;

         default:
            throw (new RuntimeException("GL source blend mode not recognized : "
                  + pGLBlendFactor));
      }
   }   

   protected DestinationFunction getDestinationFunctionByFactor(final int pGLBlendFactor) {
      switch (pGLBlendFactor) {
         case 1:
            return BlendState.DestinationFunction.One;
         case 0:
            return BlendState.DestinationFunction.Zero;
         case 772:
            return BlendState.DestinationFunction.DestinationAlpha;
         case 774:
            return BlendState.DestinationFunction.SourceColor; // AlphaState.SB_DST_COLOR;
         case 770:
            return BlendState.DestinationFunction.SourceAlpha;
         case 768:
            return BlendState.DestinationFunction.SourceColor; // AlphaState.SB_DST_COLOR;
         case 773:
            return BlendState.DestinationFunction.OneMinusDestinationAlpha;
         case 775:
            return BlendState.DestinationFunction.OneMinusSourceColor; // AlphaState.SB_ONE_MINUS_DST_COLOR;
         case 771:
            return BlendState.DestinationFunction.OneMinusSourceAlpha;
         case 776:
            return BlendState.DestinationFunction.SourceAlpha; // AlphaState.SB_SRC_ALPHA_SATURATE;
         case 769:
            return BlendState.DestinationFunction.OneMinusSourceColor; // AlphaState.SB_ONE_MINUS_DST_COLOR;
         default:
            throw (new RuntimeException("GL source blend mode not recognized : " + pGLBlendFactor));
      }
   }



The second thing is with the textures where I converted from:

        Texture tex = TextureManager.loadTexture(              ResourceLocatorTool.locateResource(
              ResourceLocatorTool.TYPE_TEXTURE, generator.getRender().getTextureName()),
              Texture.FM_LINEAR,
              Texture.FM_LINEAR);
        tex.setWrap(Texture.WM_BCLAMP_S_BCLAMP_T);



to:

      final Texture tex = TextureManager.loadTexture(ResourceLocatorTool.locateResource(
            ResourceLocatorTool.TYPE_TEXTURE, mGenerator.getRender().getTextureName()),
            Texture.MinificationFilter.BilinearNearestMipMap,
            Texture.MagnificationFilter.Bilinear);
      tex.setWrap(Texture.WrapMode.BorderClamp);



Is that correct  :?

All in all I have to say that JME looks extremely promising :) Keep up the great work  :lol:

Best Regards,
Nicolas

Your conversion to textures looks fine, but the destination blend states functions that you couldn't find are actually source functions…

I don't know why that is or how to change it, but:

AlphaState.SB_SRC_ALPHA_SATURATE == BlendState.SourceFunction.SourceAlphaSaturate



(maybe the problem is in the original code...)

Does it work with JME 2? I only see a version that works with JME 1.

We have it working: http://www.youtube.com/watch?v=jy-aLplRVwU



Its quite easy to port.



If you have a public SVN, let me know and I'll upload it.

You could create a google code project for it, or if you want you could add it to the jme-demos project. (just msg me if you want to add it)

Core-Dump said:

You could create a google code project for it, or if you want you could add it to the jme-demos project. (just msg me if you want to add it)

Yeah good idea!
Core-Dump said:

You could create a google code project for it, or if you want you could add it to the jme-demos project. (just msg me if you want to add it)


Contacted you via ICQ.  :)

Nice work there. My getBlendModes function is an ugly hack, and could never be anything more in jME1 since some of the blend modes are not supported.



To support them all you need to look at the conversion from jME blend modes to LWJGL modes and just use the right ints. I think that is how I did it, but I don't really remember :slight_smile:



Glad you got nice performance out of it :slight_smile:

Hi,



I've been looking for the source of jopsMonkey for jME 2 but I didn't find it… Did anyone post it?



Also I've tryed to port it from jME1 to jME2 using the wiki article. I have it working except for the textures… It renders only the triangles. I think I have a begginer's mistake, but cannot find it.



Could anyone post/send me the code or help me finding the mistake?



Thank you all.

Sorry, finally I found it in the jme-demos repo



Thanks