I’ve created a PLY file from a system external to my jME3 game, and then used some glue code to read that PLY file into a Mesh
instance. I can also load that PLY file into other visualization tools, and so I know its a valid mesh/model.
I was hoping to load the Mesh
instance as a skeleton (no textures/materials, just vertices/edges/triangles) into a jME3 scene and used this code:
// Groovy, but should be easily readable to any Java dev
@Slf4j
class Visualizer extends SimpleApplication {
Mesh mesh
void visualizeMesh(Mesh mesh) {
this.mesh = mesh
start()
}
@Override
void simpleInitApp() {
log.info('Starting to visualize...')
Geometry geometry = new Geometry('mesh', mesh)
geometry.setLocalTranslation(0.0f, -5.0f, -2.0f)
rootNode.attachChild(geometry)
DirectionalLight sun = new DirectionalLight()
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f))
rootNode.addLight(sun)
log.info('Visualized!')
}
}
When I run it, I get the following exception:
Uncaught exception thrown in Thread[jME3 Main,5,main]
IllegalStateException: No material is set for Geometry: mesh
I guess it makes sense: I’m not actually applying a mesh! But it does have me curious, is there any way I can load just the mesh into a jME3 game or even some aspect of the SDK (perhaps a GUI tool or as part of the NetBeans-based IDE) and view the mesh as a textureless “skeleton”?