Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.threed.jpct.util
Class Overlay

    java.lang.Object
      com.threed.jpct.util.Overlay

All Implemented Interfaces:
  java.io.Serializable

public class Overlay
extends java.lang.Object
implements java.io.Serializable

Overlay is a helper class to create opaque or transparent screen overlays from textures. An overlay is quite similar to scaled blit with the exception that an overlay has an actual depth and that it takes care of itself, i.e. once created, it will appear automatically until you dispose it. A scaled blit has to be applied by the application each frame.
Note: There seems to be some unresolved issue with threaded renderers....

See Also:
  Serialized Form

Constructor Summary
`Overlay(World world, FrameBuffer buffer, java.lang.String textureName)` Creates a new overlay that covers the whole screen.
`Overlay(World world, int upperLeftX, int upperLeftY, int lowerRightX, int lowerRightY, java.lang.String textureName)` Creates a new overlay of arbritary size.

Method Summary
`void` | `dispose()` Disposes the overlay and frees its resources.
`Object3D` | `getObject3D()` Returns the internal Object3D that is the actual Overlay.
`void` | `setColor(java.awt.Color color)` Sets a new additional color.
`void` | `setDepth(float depth)` Sets the depth of the overlay.
`void` | `setInitialMatrix(Matrix matrix)` Sets a new initial matrix that will be used instead of the identity matrix when calculating the Overlay's position.
`void` | `setNewCoordinates(int upperLeftX, int upperLeftY, int lowerRightX, int lowerRightY)` Sets new coordinates for the overlay.
`void` | `setRotation(float angle)` Rotates the Overlay around it's midpoint or it's pivot, if one is set.
`void` | `setRotationPivot(int x, int y)` Sets the pivot point for the rotation in screen coordinates.
`void` | `setSelectable(boolean mode)` Sets the object as selectable/unselectable.
`void` | `setSourceCoordinates(float upperLeftX, float upperLeftY, float lowerRightX, float lowerRightY)` Sets new source coordinates.
`void` | `setTexture(java.lang.String textureName)` Changes the texture of the overlay.
`void` | `setTexture(TextureInfo textureInfo)` Changes the texture of the overlay.
`void` | `setTransparency(int trans)` Set the transparency of the overlay.
`void` | `setTransparencyMode(int mode)` Sets the transparency mode similar to setTransparencyMode() in Object3D.
`void` | `setVisibility(boolean visible)` Sets the visibility similar to setVisibility() in Object3D.
`void` | `unlink()` Unlinks the overlay.
`void` | `update(FrameBuffer buffer)` Updates the overlay.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Overlay

    public Overlay(World world,
                   FrameBuffer buffer,
                   java.lang.String textureName)

  Creates a new overlay that covers the whole screen.

Parameters:
  `world` - the world
  `buffer` - the current frame buffer
  `textureName` - the name of the texture that should be used as an overlay. The TextureManager has to know this texture.

### Overlay

    public Overlay(World world,
                   int upperLeftX,
                   int upperLeftY,
                   int lowerRightX,
                   int lowerRightY,
                   java.lang.String textureName)

  Creates a new overlay of arbritary size.

Parameters:
  `world` - the world
  `upperLeftX` - the upper left corner's x-coordinate in screen coordinates
  `upperLeftY` - the upper left corner's y-coordinate in screen coordinates
  `lowerRightX` - the lower right corner's x-coordinate in screen coordinates
  `lowerRightY` - the lower right corner's y-coordinate in screen coordinates
  `textureName` - the name of the texture that should be used as an overlay. The TextureManager has to know this texture.

Method Detail

### setDepth

    public void setDepth(float depth)

  Sets the depth of the overlay. By default the overlay is bound to Config.nearPlane with a small offset. By setting this to a higher value, the overlay will overlap differently with other objects in the world while still filling the whole screen.
  Useful for using an (pseudo-)overlay as static backdrop.
  When using a large overlay, the accuracy may suffer. In this case, it might also help to increase the depth value.

  Parameters:
    `depth` - the new depth (should be positive)

### setSelectable

    public void setSelectable(boolean mode)

  Sets the object as selectable/unselectable. An object that is set to be unselectable won't be processed by the pickPolygon() method in Interact2D. Default for an Overlay is MOUSE_UNSELECTABLE.

  Parameters:
    `mode` - MOUSE_SELECTABLE/MOUSE_UNSELECTABLE
  See Also:
    `Object3D.MOUSE_SELECTABLE`, `Object3D.MOUSE_UNSELECTABLE`

### setTransparency

    public void setTransparency(int trans)

  Set the transparency of the overlay. The trans-value behaves as the value in Object3D's setTransparency()-method. By default, the overlay is opaque.

  Parameters:
    `trans` - the transparency value
  See Also:
    `Object3D.setTransparency(int)`

### setColor

    public void setColor(java.awt.Color color)

  Sets a new additional color. With this, it's possible to give the overlay another coloring. Default is white, i.e. the overlay shows the same colors like they are defined in the texture.

  Parameters:
    `color` - the new Color

### setTexture

    public void setTexture(java.lang.String textureName)

  Changes the texture of the overlay.

  Parameters:
    `textureName` - the new texture's name as the TextureManager knows it.

### setTexture

    public void setTexture(TextureInfo textureInfo)

  Changes the texture of the overlay.

  Parameters:
    `textureInfo` - the new TextureInfo.

### setVisibility

    public void setVisibility(boolean visible)

  Sets the visibility similar to setVisibility() in Object3D.

  Parameters:
    `visible` - should it be visible or not?
  See Also:
    `Object3D.setVisibility(boolean)`

### setTransparencyMode

    public void setTransparencyMode(int mode)

  Sets the transparency mode similar to setTransparencyMode() in Object3D.

  Parameters:
    `mode` - the mode
  See Also:
    `Object3D.setTransparencyMode(int)`, `Object3D.TRANSPARENCY_MODE_DEFAULT`, `Object3D.TRANSPARENCY_MODE_ADD`

### setNewCoordinates

    public void setNewCoordinates(int upperLeftX,
                                  int upperLeftY,
                                  int lowerRightX,
                                  int lowerRightY)

  Sets new coordinates for the overlay.

  Parameters:
    `upperLeftX` - the upper left corner's x-coordinate in screen coordinates
    `upperLeftY` - the upper left corner's y-coordinate in screen coordinates
    `lowerRightX` - the lower right corner's x-coordinate in screen coordinates
    `lowerRightY` - the lower right corner's y-coordinate in screen coordinates

### setSourceCoordinates

    public void setSourceCoordinates(float upperLeftX,
                                     float upperLeftY,
                                     float lowerRightX,
                                     float lowerRightY)

  Sets new source coordinates. Only the defined part of the source texture will be used as an overlay. Setting this will slow the overlay down a tiny little bit, but that shouldn't be noticable. To use this, the overlay has to be created with modifyUV set to true.

  Parameters:
    `upperLeftX` - the upper left corner's x-coordinate in texture coordinates
    `upperLeftY` - the upper left corner's y-coordinate in texture coordinates
    `lowerRightX` - the lower right corner's x-coordinate in texture coordinates
    `lowerRightY` - the lower right corner's y-coordinate in texture coordinates

### setRotation

    public void setRotation(float angle)

  Rotates the Overlay around it's midpoint or it's pivot, if one is set.

  Parameters:
    `angle` - the angle

### setInitialMatrix

    public void setInitialMatrix(Matrix matrix)

  Sets a new initial matrix that will be used instead of the identity matrix when calculating the Overlay's position. Most applications won't need this...

  Parameters:
    `matrix` - the new initial Matrix

### setRotationPivot

    public void setRotationPivot(int x,
                                 int y)

  Sets the pivot point for the rotation in screen coordinates.

  Parameters:
    `x` - the x position
    `y` - the y position

### getObject3D

    public Object3D getObject3D()

  Returns the internal Object3D that is the actual Overlay. Handle with care!

  Returns:
    the internal Object3D

### dispose

    public void dispose()

  Disposes the overlay and frees its resources. It can't be used after calling this method

### unlink

    public void unlink()

  Unlinks the overlay. It shouldn't be required to call this method from a normal application.

### update

    public void update(FrameBuffer buffer)

  Updates the overlay. It shouldn't be required to call this method from a normal application.

  Parameters:
    `buffer` -

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD