I am having a whole host of problems with Text3D…
1.) I cannot set the color unless I use Font3DGradient
I have tried tons of different methods…
a.) Turning lightState off…
lightState.setEnabled(false);
font3D = new Font3D(new Font("Arial", Font.PLAIN, 2), 0.001f, false, true, false);
Text3D text3D = font3D.createText("something", 2, 0);
text3D.setRandomColors();
text3D.updateRenderState();
rootNode.attachChild(text3D);
b.) Setting a MaterialState...
font3D = new Font3D(new Font("Arial", Font.PLAIN, 2), 0.001f, false, true, false);
Text3D text3D = font3D.createText("something", 2, 0);
MaterialState ms = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();
ms.setDiffuse(ColorRGBA.red);
ms.setColorMaterial(MaterialState.CM_DIFFUSE);
ms.setEnabled(true);
text3D.setRenderState(ms);
text3D.updateRenderState();
rootNode.attachChild(text3D);
c.) Using setFontColor...
font3D = new Font3D(new Font("Arial", Font.PLAIN, 2), 0.001f, false, true, false);
Text3D text3D = font3D.createText("something", 2, 0);
text3D.setFontColor(ColorRGBA.red);
text3D.updateRenderState();
rootNode.attachChild(text3D);
d.) Even the example (Test3DText.java) in jmetest.text does not have color when I toggle the lights on!
2.) I am unable to affect a Text3D object in other ways -- I cannot set a ClipState to it, for example...
package clipstates;
import java.awt.Font;
import java.util.logging.Logger;
import com.jme.app.SimpleGame;
import com.jme.math.Vector3f;
import com.jme.scene.SharedMesh;
import com.jme.scene.shape.Box;
import com.jme.scene.state.ClipState;
import com.jmex.font3d.Font3D;
import com.jmex.font3d.Text3D;
public class ClipText3D extends SimpleGame {
private static final Logger logger = Logger.getLogger(ClipText3D.class
.getName());
public static void main(String[] args) {
ClipText3D app = new ClipText3D();
app.setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG);
app.start();
}
protected void simpleUpdate() {
}
private static Font3D font3D;
protected void simpleInitGame() {
display.setTitle("jME - FontPlay");
font3D = new Font3D(new Font("Arial", Font.PLAIN, 2), 0.001f, false, true, false);
Box b = new Box("b", new Vector3f(), 0.5f, 0.5f, 0.5f);
for (int i=-20; i<100; i++) {
Text3D text3D = font3D.createText("something", 2, 0);
System.out.println(text3D.getCullMode());
text3D.alignCenter();
text3D.updateRenderState();
text3D.setLocalTranslation(i, i, 0);
rootNode.attachChild(text3D);
SharedMesh m = new SharedMesh("b" + i, b);
m.setLocalTranslation(i,i,0);
rootNode.attachChild(m);
}
ClipState clipArea;
clipArea = display.getRenderer().createClipState();
clipArea.setEnableClipPlane(ClipState.CLIP_PLANE0, true);
clipArea.setClipPlaneEquation(0, -1f, 0, 0, 2);
rootNode.setRenderState(clipArea);
rootNode.updateRenderState();
}
}
This clips the boxes, but not the text3ds!
Has anyone else experienced these issues?