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.
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.
But there are some minor things I’m no sure whether they are fully correct (1 started with JME today )
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:
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
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?