Exemplo n.º 1
0
 @Override
 public void addWorldsToRenderer(
     GL1Renderer glRenderer, GLFactory objectFactory, GeoObj currentPosition) {
   mRenderer = glRenderer;
   if (!mWaitForValidGps) {
     addObjectsTo(glRenderer, mWorld, GLFactory.getInstance());
     mAddObjectsCalled = true;
   }
   glRenderer.addRenderElement(mWorld);
 }
Exemplo n.º 2
0
  @Override
  public void _b_addWorldsToRenderer(
      GL1Renderer renderer, GLFactory objectFactory, GeoObj currentPosition) {

    camera = new GLCamera(new Vec(0, 0, 1));
    world = new World(camera);

    MeshComponent arrow = GLFactory.getInstance().newArrow();
    arrow.setPosition(new Vec(0, 0, 4));

    MeshComponent circle = GLFactory.getInstance().newCircle(Color.redTransparent());
    circle.setScale(new Vec(4, 4, 4));
    // circle.myAnimation = new AnimationPulse(2, new Vec(0, 0, 0), new
    // Vec(4, 4, 4), 0.2f);

    final MeshComponent itemMesh = new Shape();
    itemMesh.addChild(arrow);
    itemMesh.addChild(circle);
    itemMesh.setPosition(Vec.getNewRandomPosInXYPlane(camera.getPosition(), 5, 10));

    Obj itemToCollect = new Obj();
    itemToCollect.setComp(
        new ProximitySensor(camera, 3f) {
          @Override
          public void onObjectIsCloseToCamera(
              GLCamera myCamera2, Obj obj, MeshComponent m, float currentDistance) {
            catchedNumber++;
            new CommandShowToast(myTargetActivity, "You got me " + catchedNumber + " times")
                .execute();
            itemMesh.setPosition(Vec.getNewRandomPosInXYPlane(camera.getPosition(), 5, 20));
          }
        });

    itemToCollect.setComp(itemMesh);
    world.add(itemToCollect);
    renderer.addRenderElement(world);
  }