示例#1
0
  @Override
  public void addObjectsTo(GL1Renderer renderer, World world, GLFactory objectFactory) {
    GeoObj o = new GeoObj(-29.456251, -51.968653);
    //		o.setComp(GLFactory.getInstance().newSolarSystem(new Vec()));
    MeshComponent mesh1 = GLFactory.getInstance().newCube();
    //		mesh1.setScale(new Vec(3, 3, 3));
    o.setComp(mesh1);
    world.add(o);

    Color color = new Color("#ff00ff");
    MeshComponent mesh = GLFactory.getInstance().newCube(color);
    // mesh.setScale(new Vec(20, 20, 20));

    GeoObj cedro = new GeoObj(-29.477376, -51.983571);
    cedro.setComp(mesh);
    world.add(cedro);

    // Faleiro: -29.466055,-51.961384
    Color colorF = new Color("#ff00ff");
    MeshComponent meshF = GLFactory.getInstance().newCube(colorF);
    meshF.setScale(new Vec(20, 20, 20));

    GeoObj cemetery = new GeoObj(-29.460381, -51.967412);
    cemetery.setComp(meshF);
    world.add(cemetery);

    // São Cri: -29.454733,-51.966877
    Color colorS = new Color("#00ff00");
    MeshComponent meshS = GLFactory.getInstance().newCube(colorS);
    // meshS.setScale(new Vec(20, 20, 20));

    // Objetos sao visiveis ate 1 km
    GeoObj saocri = new GeoObj(-29.454733, -51.966877);
    saocri.setComp(meshS);
    world.add(saocri);
  }
示例#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);
  }