Hey there,
As discussed here: http://www.jmonkeyengine.com/jmeforum/index.php?topic=11220.msg86557#msg86557
Since it is a bigger commit I will give you guys a few days longer than normal to check it out before I commit :wink:
so long,
dhdd
Good job! :-o
uhoh, and i will also commit the patch for the build.xml:
Index: build.xml
===================================================================
--- build.xml (revision 4436)
+++ build.xml (working copy)
@@ -121,7 +121,7 @@
<target name="dist-font" depends="compile, -enforce.jar.deps"
description="generate jme jar file (font)">
<jar destfile="${jars}/jme-font.jar" basedir="${class}" update="no"
- duplicate="fail" compress="true" includes="com/jmex/font2d/**/*.class, com/jmex/font3d/**/*.class" />
+ duplicate="fail" compress="true" includes="com/jmex/font2d/**/*.class, com/jmex/font3d/**/*.class, com/jmex/angelfont/**/*.class" />
</target>
<target name="dist-gamestates" depends="compile, -enforce.jar.deps"
description="generate jme jar file (gamestates)">
as you can see, the angelfont package is on the same level as font2d and font3d and will be distilled into jme-font.jar.
works for me, but BitmapText needs more JavaDoc and indention should be 4 spaces to be consistent with the other source.
also a default angelfont.fnt and png should probably go into the com.jmex.angelfont package, like the defaultfont.tga, so one doesn't have to use the jmetest.jar to use the font.
thanks for the input Core-Dump, all done now, I also added the jme copyright notice and wrote some more JavaDoc to the other classes.
Committing now
one more change:
Index: src/com/jmex/angelfont/BitmapText.java
===================================================================
--- src/com/jmex/angelfont/BitmapText.java (revision 4447)
+++ src/com/jmex/angelfont/BitmapText.java (working copy)
@@ -38,6 +38,8 @@
import com.jme.renderer.Renderer;
import com.jme.scene.TexCoords;
import com.jme.scene.TriMesh;
+import com.jme.scene.state.BlendState;
+import com.jme.scene.state.RenderState;
import com.jme.scene.state.TextureState;
import com.jme.scene.state.RenderState.StateType;
import com.jme.system.DisplaySystem;
@@ -93,6 +95,7 @@
this.font = font;
this.block = new StringBlock();
+ setRenderState(getDefaultBlendState());
setRenderState(DisplaySystem.getDisplaySystem().getRenderer().createTextureState());
((TextureState) getRenderState(StateType.Texture)).setEnabled(true);
((TextureState) getRenderState(StateType.Texture)).setTexture(font.getFontTexture());
@@ -106,6 +109,17 @@
updateGeometricState(0.0f, true);
}
+ private BlendState getDefaultBlendState() {
+ BlendState bs = DisplaySystem.getDisplaySystem().getRenderer().createBlendState();
+ bs.setBlendEnabled(true);
+ bs.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
+ bs.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
+ bs.setTestEnabled(true);
+ bs.setTestFunction(BlendState.TestFunction.GreaterThan);
+ bs.setEnabled(true);
+ return bs;
+ } // getDefaultBlendState
+
/**
* Updates the {@link BitmapText} and merges the multiple characters,
* represented by {@link FontQuad}s into one {@link TriMesh}
Like that the BitmapText has a default BlendState. i am also thinking it might be good to enable MipMapping (Trilinear) by default. Thats not in the patch but i can add id if wanted.