de.rico.adventure.entity.hotspot
Class CubicalHotpot

java.lang.Object
  extended by de.rico.adventure.entity.AbstractEntity
      extended by de.rico.adventure.entity.hotspot.AbstractInteractiveHotspot
          extended by de.rico.adventure.entity.hotspot.CubicalHotpot

public class CubicalHotpot
extends AbstractInteractiveHotspot

This class can be used as a cubical interactive hotspot.

Author:
Frank Bruns

Constructor Summary
CubicalHotpot(Point3D pos, float width, float height, float length, boolean needsItem)
          Creates a new cubical hot spot with the specified dimensions at the specified position.
 
Method Summary
 void draw(javax.media.opengl.GL gl)
          Visualizes the interactive hotspot.
 float getHeight()
          Returns the height of the hotspot
 float getLength()
          Returns the length of the hotspot.
 Point3D getMouseOverHotspot(int screenX, int screenY)
          Returns the world coordinates of the mouse position over the hotspot.
 float getWidth()
          Returns the width of the hotspot.
 boolean isMouseOverHotspot(int screenX, int screenY)
          Determines whether the mouse is located over the interactive hotspot.
 boolean isWithinFrustum(ViewingFrustum frustum)
          Determines whether or not the hotspot volume is within the camera's viewing frustum.
 void setHeight(float height)
          Sets the height of the hotspot.
 void setLength(float length)
          Sets the length of the hotspot
 void setWidth(float width)
          Sets the width of the hotspot.
 
Methods inherited from class de.rico.adventure.entity.hotspot.AbstractInteractiveHotspot
destroy, getMesh, getPosition, isEnabled, needsItem, setEnabled, setNeedsItem, setPosition, toString
 
Methods inherited from class de.rico.adventure.entity.AbstractEntity
drawScreenName, getScreenName, getScriptId, setScreenName, setScriptId
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CubicalHotpot

public CubicalHotpot(Point3D pos,
                     float width,
                     float height,
                     float length,
                     boolean needsItem)
Creates a new cubical hot spot with the specified dimensions at the specified position. You can specify, if the hotspot needs an item to be usable.

Parameters:
pos - position of the hotspot
width - width of the hotspot
height - height of the hotspot
length - length of the hotspot
needsItem - needs item to use? --> true=yes, false=no
Method Detail

getHeight

public float getHeight()
Returns the height of the hotspot

Returns:
the height of the hotspot

setHeight

public void setHeight(float height)
Sets the height of the hotspot.

Parameters:
height - the height to set

getLength

public float getLength()
Returns the length of the hotspot.

Returns:
the length of the hotspot

setLength

public void setLength(float length)
Sets the length of the hotspot

Parameters:
length - the length to set

getWidth

public float getWidth()
Returns the width of the hotspot.

Returns:
the width of the hotspot

setWidth

public void setWidth(float width)
Sets the width of the hotspot.

Parameters:
width - the width to set

draw

public void draw(javax.media.opengl.GL gl)
Description copied from class: AbstractInteractiveHotspot
Visualizes the interactive hotspot.

Specified by:
draw in class AbstractInteractiveHotspot

isMouseOverHotspot

public boolean isMouseOverHotspot(int screenX,
                                  int screenY)
Description copied from class: AbstractInteractiveHotspot
Determines whether the mouse is located over the interactive hotspot.

Specified by:
isMouseOverHotspot in class AbstractInteractiveHotspot
Parameters:
screenX - screen x-coordinate
screenY - screen y-coordinate
Returns:
is mouse on hotspot? --> true=yes, false=no

getMouseOverHotspot

public Point3D getMouseOverHotspot(int screenX,
                                   int screenY)
Description copied from class: AbstractInteractiveHotspot
Returns the world coordinates of the mouse position over the hotspot.

Specified by:
getMouseOverHotspot in class AbstractInteractiveHotspot
Parameters:
screenX - screen x-coordinate
screenY - screen y-coordinate
Returns:
world position of the mouse over the hotspot

isWithinFrustum

public boolean isWithinFrustum(ViewingFrustum frustum)
Description copied from class: AbstractInteractiveHotspot
Determines whether or not the hotspot volume is within the camera's viewing frustum.

Specified by:
isWithinFrustum in class AbstractInteractiveHotspot
Parameters:
frustum - the camera's viewing frustum
Returns:
is in frustum? --> true=yes, false=no