public void initScene() {
    scene.lights().add(new Light());

    IParser parser =
        Parser.createParser(
            Parser.Type.MD2, getResources(), "min3d.sampleProject1:raw/ogro", false);
    parser.parse();

    ogre = parser.getParsedAnimationObject();
    ogre.scale().x = ogre.scale().y = ogre.scale().z = .07f;
    ogre.rotation().z = -90;
    ogre.rotation().x = -90;
    scene.addChild(ogre);
    ogre.setFps(70);
  }
Пример #2
0
 public void objectClear() {
   for (int i = 0; i < _scene.children().size(); i++) {
     Object3d o = _scene.children().get(i);
     if (o.animationEnabled()) ((AnimationObject3d) o).pause();
     o.isVisible(false);
   }
 }
Пример #3
0
  public void objectPointChanged(
      int found_markers, int[] ar_code_index, float[][] resultf, float[] cameraRHf) {

    synchronized (this) {
      this.found_markers = found_markers;
      for (int i = 0; i < MARKER_MAX; i++) {
        this.ar_code_index[i] = ar_code_index[i];
        System.arraycopy(resultf[i], 0, this.resultf[i], 0, 16);
      }
      System.arraycopy(cameraRHf, 0, this.cameraRHf, 0, 16);
    }

    objectClear();

    for (int i = 0; i < MARKER_MAX; i++) {

      if (ar_code_index[i] > (_scene.children().size() - 1)) continue;

      Log.i("min3D Render", "Draw Model number:" + ar_code_index[i]);
      Object3d o = _scene.children().get(ar_code_index[i]);
      if (!o.isVisible()) {
        if (o.animationEnabled()) ((AnimationObject3d) o).play();
        o.isVisible(true);
        o.matrix(resultf[i]);
      }
    }
  }
Пример #4
0
  protected void drawScene() {
    if (_scene.fogEnabled() == true) {
      _gl.glFogf(GL10.GL_FOG_MODE, _scene.fogType().glValue());
      _gl.glFogf(GL10.GL_FOG_START, _scene.fogNear());
      _gl.glFogf(GL10.GL_FOG_END, _scene.fogFar());
      _gl.glFogfv(GL10.GL_FOG_COLOR, _scene.fogColor().toFloatBuffer());
      _gl.glEnable(GL10.GL_FOG);
    } else {
      _gl.glDisable(GL10.GL_FOG);
    }

    for (int i = 0; i < _scene.children().size(); i++) {
      Object3d o = _scene.children().get(i);
      if (o.animationEnabled()) {
        ((AnimationObject3d) o).update();
      }
      drawObject(o);
    }
  }
 public void onClick(View $v) {
   if ($v == flipButton && checkBox.isChecked()) ogre.play("flip", true);
   else if ($v == flipButton && !checkBox.isChecked()) ogre.play("flip", false);
   else if ($v == saluteButton && checkBox.isChecked()) ogre.play("salute", true);
   else if ($v == saluteButton && !checkBox.isChecked()) ogre.play("salute", false);
 }