de.rico.engine.geometry.collision.picking
Class OGLMeshPicker

java.lang.Object
  extended by de.rico.engine.geometry.collision.picking.OGLMeshPicker
All Implemented Interfaces:
MeshPickerIface

public class OGLMeshPicker
extends java.lang.Object
implements MeshPickerIface

This class can be used for picking meshes in the scene. It implements the singleton design pattern.

Author:
Frank Bruns

Method Summary
static OGLMeshPicker getInstance()
          Returns the singleton instance of the OGLMeshPicker
 AbstractMesh getMesh(java.util.List<AbstractMesh> meshes, int screenX, int screenY)
          Returns the mesh that was clicked on, if it is set to be pickable.
 AbstractMesh getMeshAtBack(java.util.List<AbstractMesh> meshes, int screenX, int screenY)
          Returns the mesh that lies at back to the viewer at most.
 AbstractMesh getMeshInFront(java.util.List<AbstractMesh> meshes, int screenX, int screenY)
          Returns the mesh that lies in front to the viewer at most.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static OGLMeshPicker getInstance()
Returns the singleton instance of the OGLMeshPicker

Returns:
singleton instance of the OGLMeshPicker

getMesh

public AbstractMesh getMesh(java.util.List<AbstractMesh> meshes,
                            int screenX,
                            int screenY)
Description copied from interface: MeshPickerIface
Returns the mesh that was clicked on, if it is set to be pickable. If no mesh was picked, the method returns null.

Specified by:
getMesh in interface MeshPickerIface
Parameters:
meshes - meshes to take into consideration for picking
screenX - x-position on screen
screenY - y-position on screen
Returns:
picked mesh

getMeshInFront

public AbstractMesh getMeshInFront(java.util.List<AbstractMesh> meshes,
                                   int screenX,
                                   int screenY)
Returns the mesh that lies in front to the viewer at most. If no mesh was picked, the method returns null.
This method returns the same result as the getMesh() method that implements the MeshPicker interface method.

Parameters:
meshes - meshes to take into consideration for picking
screenX - x-position on screen
screenY - y-position on screen
Returns:
mesh in front

getMeshAtBack

public AbstractMesh getMeshAtBack(java.util.List<AbstractMesh> meshes,
                                  int screenX,
                                  int screenY)
Returns the mesh that lies at back to the viewer at most. If no mesh was picked, the method returns null.

Parameters:
meshes - meshes to take into consideration for picking
screenX - x-position on screen
screenY - y-position on screen
Returns:
mesh at back