Пример #1
0
 private void stop() {
   LOG.info("stop");
   playing = false;
   time = 0;
   app.setCameraEnabled(true);
   app.getGuiNode().setCullHint(Spatial.CullHint.Inherit);
   app.getNifty().gotoScreen(oldScreen);
   this.sceneNode.setCullHint(Spatial.CullHint.Inherit);
   if (recording) {
     recording = false;
     app.getStateManager().detach(app.getStateManager().getState(VideoRecorderAppState.class));
   }
 }
Пример #2
0
 public void play() {
   if (points.size() < 3) {
     LOG.warning("can only play when there are at least 3 points");
     return;
   }
   LOG.info("play");
   app.setCameraEnabled(false);
   playing = true;
   time = 0;
   stepLength = -1;
   currentStep = -1;
   app.getGuiNode().setCullHint(Spatial.CullHint.Always);
   oldScreen = app.getNifty().getCurrentScreen().getScreenId();
   app.getNifty().gotoScreen("Dummy");
 }
Пример #3
0
 public void record() {
   this.sceneNode.setCullHint(Spatial.CullHint.Always);
   recording = true;
   app.getStateManager().attach(new VideoRecorderAppState(1f));
   LOG.info("recording");
   play();
 }
Пример #4
0
  public void update(float tpf) {
    if (!playing) {
      return;
    }
    if (currentStep + 2 >= points.size()) {
      stop();
      return;
    }

    if (time > stepLength) {
      currentStep++;
      computeLength();
      time = 0;
    }

    Point p = interpolate(time / stepLength);
    app.getCamera().setLocation(p.position);
    app.getCamera().setRotation(p.rotation);
    time += tpf * p.speed * TerrainHeighmapCreator.TERRAIN_SCALE;
  }
Пример #5
0
  public Recording(TerrainHeighmapCreator app, Camera cam, Node sceneNode) {
    this.app = app;
    this.cam = cam;
    this.sceneNode = new Node("record");
    sceneNode.attachChild(this.sceneNode);
    this.points = new ArrayList<>();

    sphereMesh = new Sphere(8, 8, 0.25f * TerrainHeighmapCreator.TERRAIN_SCALE);
    sphereMat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
    sphereMat.setColor("Color", ColorRGBA.Blue);
    arrowMat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
    arrowMat.getAdditionalRenderState().setWireframe(true);
    arrowMat.setColor("Color", ColorRGBA.Red);

    app.getNifty().addXml("org/shaman/terrain/vegetation/DummyScreen.xml");
    app.getInputManager()
        .addMapping("RecordingAdd", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
    app.getInputManager()
        .addMapping("RecordingSpeed-", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
    app.getInputManager()
        .addMapping("RecordingSpeed+", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
    app.getInputManager().addListener(this, "RecordingAdd", "RecordingSpeed-", "RecordingSpeed+");
  }