protected void initScene() {
      DirectionalLight light = new DirectionalLight(0, 0, 1);

      getCurrentScene().addLight(light);
      getCurrentCamera().setPosition(0, 0, -16);

      mPlanes = new PlanesGalore();
      mMaterial = mPlanes.getMaterial();
      mMaterial.setColorInfluence(0);
      try {
        mMaterial.addTexture(new Texture("flickrPics", R.drawable.flickrpics));
      } catch (TextureException e) {
        e.printStackTrace();
      }

      mMaterialPlugin = mPlanes.getMaterialPlugin();

      mPlanes.setDoubleSided(true);
      mPlanes.setZ(4);
      addChild(mPlanes);

      Object3D empty = new Object3D();
      addChild(empty);

      CatmullRomCurve3D path = new CatmullRomCurve3D();
      path.addPoint(new Vector3(-4, 0, -20));
      path.addPoint(new Vector3(2, 1, -10));
      path.addPoint(new Vector3(-2, 0, 10));
      path.addPoint(new Vector3(0, -4, 20));
      path.addPoint(new Vector3(5, 10, 30));
      path.addPoint(new Vector3(-2, 5, 40));
      path.addPoint(new Vector3(3, -1, 60));
      path.addPoint(new Vector3(5, -1, 70));

      mCamAnim = new TranslateAnimation3D(path);
      mCamAnim.setDuration(20000);
      mCamAnim.setRepeatMode(RepeatMode.REVERSE_INFINITE);
      mCamAnim.setTransformable3D(getCurrentCamera());
      mCamAnim.setInterpolator(new AccelerateDecelerateInterpolator());
      registerAnimation(mCamAnim);
      mCamAnim.play();

      getCurrentCamera().setLookAt(new Vector3(0, 0, 30));
    }
  public void initScene() {
    SimpleMaterial material = new SimpleMaterial();
    material.setUseSingleColor(true);

    // -- "curve1" will be the original curve. Note that we create two curves for
    //    demonstration purposes only. You'd typically create one curve and then
    //    reparametrize it.
    CatmullRomCurve3D curve1 = new CatmullRomCurve3D();
    CatmullRomCurve3D curve2 = new CatmullRomCurve3D();

    for (int i = 0; i < 16; i++) {
      // -- generate a random point within certain limits
      Vector3 pos = new Vector3(-1 + (Math.random() * 2), -1.2f + (Math.random() * 2.4f), 0);
      curve1.addPoint(pos);
      curve2.addPoint(pos);

      // -- add a wireframe cube so we can see what the original
      //    points were
      Cube s = new Cube(.06f);
      s.setMaterial(material);
      s.setColor(CURVE1_COLOR);
      s.setPosition(pos);
      s.setDrawingMode(GLES20.GL_LINES);
      addChild(s);
    }

    // -- draw the first curve
    drawCurve(curve1, CURVE1_COLOR, new Vector3());

    BaseObject3D pathFollowObject = new Sphere(.04f, 16, 16);
    pathFollowObject.setColor(CURVE1_COLOR);
    pathFollowObject.setMaterial(material);
    addChild(pathFollowObject);

    // -- animate a sphere that follow the first curve.
    //    This shows the non constant speed of a non parametrized curve.
    TranslateAnimation3D anim = new TranslateAnimation3D(curve1);
    anim.setDuration(ANIMATION_DURATION);
    anim.setTransformable3D(pathFollowObject);
    anim.setRepeatMode(RepeatMode.REVERSE_INFINITE);
    registerAnimation(anim);
    anim.play();

    // -- reparametrize the curve for uniform distribution
    curve2.reparametrizeForUniformDistribution(curve2.getPoints().size() * 4);
    List<Vector3> points = curve2.getPoints();

    // -- put spheres on the curve where the new points are
    for (int i = 0; i < points.size(); i++) {
      Vector3 pos = points.get(i);
      Sphere s = new Sphere(.02f, 4, 4);
      s.setMaterial(material);
      s.setColor(CURVE2_COLOR);
      s.setPosition(pos);
      addChild(s);
    }

    // -- draw the second, reparametrized, curve
    drawCurve(curve2, CURVE2_COLOR, new Vector3());

    pathFollowObject = new Sphere(.04f, 16, 16);
    pathFollowObject.setColor(CURVE2_COLOR);
    pathFollowObject.setMaterial(material);
    addChild(pathFollowObject);

    // -- animate a sphere on the second curve.
    //    This shows a more or less constant speed of a parametrized curve.
    anim = new TranslateAnimation3D(curve2);
    anim.setDuration(ANIMATION_DURATION);
    anim.setTransformable3D(pathFollowObject);
    anim.setRepeatMode(RepeatMode.REVERSE_INFINITE);
    registerAnimation(anim);
    anim.play();
  }