Hi guys,
Quick problem that I'm hoping there's a simple answer to
I have succesfully imported a splendid house and pool in to JME, which is great news as I now have a tool I can start to work with. However, I notice that he house inside walls are also brick, despite me setting them differently in Sketchup.
Am I missing a step in Sketchup? Is this a JME limitation because quads can only have one texture? I am hoping there will be a nice switch somewhere… But I do a lot of hoping!
I think I might put my code in here as well. It won't (I don't think) help answer the question, but it might be a quick-start for someone else looking to import from Sketchup (two hours it took me!)…
private Node getSketchupNode() {
// So far to get this to work, I have had to update the .kmz file to .zip
// and extract the house.dae in it. Now place the textureX.jpg files in
// the textures sub-directory. Finally, update the .dae file, changing
// path to ./textureX.jpg for each file (ie no path details).
// That seems to do the job!
try {
File f = new File("C:\Temp\house.dae");
SimpleResourceLocator loc = new SimpleResourceLocator(new File("./textures").toURI());
ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, loc);
ExtraPluginManager.registerExtraPlugin("GOOGLEEARTH", new GoogleEarthPlugin());
InputStream gamemap = new FileInputStream(f);
ColladaImporter.load(gamemap, "model");
Node modelNode = ColladaImporter.getModel();
modelNode.setLightCombineMode(Spatial.LightCombineMode.Off);
return modelNode;
} catch (Exception ex) {
System.err.println(ex.toString());
return null;
} finally {
ColladaImporter.cleanUp();
}
}
Cheers
Richard