Пример #1
0
  public void checkPicking(Renderer renderer, RenderCamera camera, int mx, int my) {
    if (camera == null) return;

    // Pick An Object
    renderer.beginPickingPass(camera);
    renderer.drawPassesPick();
    if (currentObject != null) {
      // Draw Object Manipulators
      GL11.glClearDepth(1.0);
      GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);

      DepthState.DEFAULT.set();
      BlendState.OPAQUE.set();
      RasterizerState.CULL_NONE.set();

      drawPick(camera, currentObject, renderer.pickProgram);
    }
    int id = renderer.getPickID(Mouse.getX(), Mouse.getY());

    selectedManipulator = manips.get(id);
    if (selectedManipulator != null) {
      // Begin Manipulator Operations
      System.out.println(
          "Selected Manip: " + selectedManipulator.type + " " + selectedManipulator.axis);
      return;
    }

    SceneObject o = scene.objects.get(id);
    if (o != null) {
      System.out.println("Picked An Object: " + o.getID().name);
      if (scenePanel != null) {
        scenePanel.select(o.getID().name);
        propWindow.tabToForefront("Object");
      }
      currentObject = rEnv.findObject(o);
    } else if (currentObject != null) {
      currentObject = null;
    }
  }