NASA WorldWind:Collada模型未呈现

时间:2015-03-05 22:18:06

标签: java javafx-8 collada worldwind

一个collada模型,没有显示Spitfire飞机,这里是代码:

public class Main extends Application {

   private static final double HOME_LAT     = 44.72;
   private static final double HOME_LON     = -0.5;
   private static final double CAMERA_ALT   = 10_000.0;
   private static final double AIRCRAFT_ALT =  3_000.0;

   private final WorldWindowGLJPanel _ww    = new WorldWindowGLJPanel();
   private final ColladaRoot         _aircraft;
   private /* */ double              _scale = 1.0;

   public Main() throws IOException, XMLStreamException {
      _aircraft = ColladaRoot.createAndParse(
         getClass().getResource( "spit.dae" ));
      _aircraft.setAltitudeMode( WorldWind.ABSOLUTE );
      _aircraft.setModelScale( new Vec4( _scale ));
      _aircraft.setPosition(
         Position.fromDegrees( HOME_LAT, HOME_LON, AIRCRAFT_ALT ));
      _ww.setModel( new BasicModel());
      _ww.getView().setEyePosition(
         Position.fromDegrees( HOME_LAT, HOME_LON, CAMERA_ALT ));
      final RenderableLayer layer = new RenderableLayer();
      layer.addRenderable( new ColladaController( _aircraft ));
      _ww.getModel().getLayers().add( layer );
   }

   private void scaleIt() {
      _scale *= 2.0;
      _aircraft.setModelScale( new Vec4( _scale ));
      _ww.redraw();
      System.err.println( _scale );
   }

   @Override
   public void start( Stage primaryStage ) throws Exception {
      final SwingNode rootPane = new SwingNode();
      rootPane.setContent( _ww );
      final Button scaleIt = new Button( "Scale Aircraft" );
      final Scene scene = new Scene(
         new BorderPane( rootPane, scaleIt, null, null, null ));
      scaleIt.setMaxWidth( Double.MAX_VALUE );
      scaleIt.setOnAction( e -> scaleIt());
      primaryStage.setScene( scene );
      primaryStage.show();
   }

   public static void main( String[] args ) {
      launch( args );
   }
}

问题:如何强制WorldWind渲染3D Collada模型?

0 个答案:

没有答案