the following code
private static Spatial loadMD2(final String p_file,
final String p_texture,
final DisplaySystem p_display
)
throws IOException {
final Md2ToJme l_conv = new Md2ToJme();
final Spatial l_spatial = Utils.asJME(l_conv, p_file, Utils.getImage(p_texture), p_display, CullState.CS_FRONT);
l_spatial.setLocalRotation(new Quaternion().fromAngleAxis(FastMath.HALF_PI, Vector3f.UNIT_Y));
return l_spatial;
}
private static Spatial asJME(final FormatConverter p_conv,
final String p_file,
final Image p_image,
final DisplaySystem p_display, final int p_cullstate) throws IOException {
assert p_image!=null;
FileInputStream l_stream = null;
final ByteArrayOutputStream l_baos = new ByteArrayOutputStream();
try {
l_stream = new FileInputStream(Utils.getFile(p_file));
p_conv.convert(l_stream, l_baos);
} finally {
if (l_stream != null) {
l_stream.close();
}
}
final Node l_node = (Node) new BinaryImporter().load(l_baos.toByteArray());
final TextureState ts = p_display.getRenderer().createTextureState();
ts.setEnabled(true);
ts.setTexture(
TextureManager.loadTexture(
p_image,
Texture.MM_LINEAR_LINEAR,
Texture.FM_LINEAR,
true));
l_node.setRenderState(ts);
l_node.updateRenderState();
final CullState cs = p_display.getRenderer().createCullState();
cs.setCullMode(p_cullstate);
l_node.setRenderState(cs);
return l_node;
}
worked fine until i upgraded to jme 1.0. do i have to change anything?
the md2 loading test works, loading other models work, just md2s inside my game are broken - the textures are not used, all models are grey