SceneKit提供了一种方法public CarPool receive() throws
Exception {
CarPool carpool=new CarPool();
JAXBContext context = JAXBContext.newInstance(FocusAnything.class);
Unmarshaller um = context.createUnmarshaller();
GcsService gcsService = GcsServiceFactory.createGcsService();
GcsFilename filename = new GcsFilename("miceast1", "Carpool.xml");
GcsInputChannel readChannel = null;
BufferedReader reader = null;
try {
readChannel = gcsService.openReadChannel(filename, 0);
reader = new BufferedReader(Channels.newReader(readChannel, "UTF8"));
FocusAnything focus = (FocusAnything) um.unmarshal(reader);
carpool = focus.getCarpool();
} finally {
if (reader != null) { reader.close(); }
}
return carpool;
}
,用于将视图场景渲染到图像对象中。但每当我使用这种方法时,结果都会出现snapshot()
。我甚至试图从当前的图像上下文中获取图像;应用程序崩溃记录为"<uninitialized>"