I do not get the MaterialFace.FrontAndBack to work.
See example: the front and back face of the quad should be red.
But only the front face is red!!!
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.scene.TriMesh;
import com.jme.math.Vector2f;
import com.jme.scene.Node;
import com.jme.scene.shape.Quad;
import com.jme.scene.state.MaterialState;
import com.jme.system.DisplaySystem;
import com.jme.scene.Geometry;
import com.jme.renderer.ColorRGBA;
public class TestMaterial extends SimpleGame
{
private TriMesh t;
private Quaternion rotQuat;
private float angle = 0;
private Vector3f axis;
public static void main(String[] args)
{
TestMaterial app = new TestMaterial();
// app.setConfigShowMode(ConfigShowMode.AlwaysShow);
app.start();
}
protected void simpleUpdate()
{
if (tpf < 1)
{
angle = angle + (tpf * 50);
if (angle > 360)
angle = 0;
}
rotQuat.fromAngleNormalAxis(angle * FastMath.DEG_TO_RAD, axis);
t.setLocalRotation(rotQuat);
}
protected void simpleInitGame()
{
rotQuat = new Quaternion();
axis = new Vector3f(1, 1, 0.5f).normalizeLocal();
MaterialState materialState = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();
materialState.setDiffuse(ColorRGBA.red);
materialState.setMaterialFace(MaterialState.MaterialFace.FrontAndBack);
t = new Quad("quad", 10, 10);
t.setModelBound(new BoundingBox());
t.updateModelBound();
t.setRenderState(materialState);
t.updateRenderState();
rootNode.attachChild(t);
}
}