Class RenderPanel
raft.kilavuz.util.jpct.RenderPanel All Implemented Interfaces:
-
public class RenderPanel
swing panel to ease testing and prototyping.
RenderPanel allows user to freely move camera around or follow a given avatar.
it can display sectors in the Land as boxes.
these are the keys used:
- arrow keys: move camera forward, backward, rotate left and right
- a, z: rotate camera up and down
- s, x: move camera up and down
- control: strafe camera, use with left-right arrow keys
- w: toggle wireframe mode
- v: toggle visualize sectors
Field Summary |
|
|
|
landLand instance encapsulating current pathfinding information |
|
worldWorld instance this RenderPanel is used to render |
Method Summary |
|
|
|
|
|
followAvatar(Object3D avatar, float height, float distance, float angle)switchs between modes free camera and following avatar. |
|
|
|
|
|
placeCamera(float seconds)places camera according to current settings. |
|
|
|
render()renders (paints) world. |
|
|
|
|
|
showMessage(String message, int milliseconds)display given message on center of screen for a certain time |
Field Detail
world
protected final World world -
World instance this RenderPanel is used to render
land
protected final Land land -
Land instance encapsulating current pathfinding information
drawWireFrame
protected boolean drawWireFrame
-
if true world is rendered also in wireframe
Constructor Detail
RenderPanel
-
creates a RenderPanel
Parameters:
-
world - the world instance to render
-
land - land information used to visualize sectors, may be null
-
listener - listener to notify user clicked on a collidable object, may be null
-
cameraEllipsoid - used to move camera around
-
moveVelocity - speed of camera in world units to move camera around
Method Detail
setCameraEllipsoid
public void setCameraEllipsoid(SimpleVector cameraEllipsoid) -
sets camera ellipsoid. all three coordinates must be positive
setMoveVelocity
public void setMoveVelocity(float moveVelocity)
-
sets move velocity used to move camera. must be positive
Parameters:
-
moveVelocity - camera move velocity in world units
followAvatar
public void followAvatar(Object3D avatar, float height, float distance, float angle) -
switchs between modes free camera and following avatar.
in follow mode, a takeback position over avatar is calculated and camera
is tried to taken back from this point given distance amount with given angle.
then for smoothness camera position is interpolated to calculated position.
camera always looks at takeback point in follow mode
Parameters:
-
avatar - avatar to follow, if null switches to free camera mode
-
height - distance between avatar's transformed center and takeback point
-
distance - camera is tried to take back this much amount
-
angle - horizontal angle camera is taken back. a positive value
means camera looks down to takeback point, and vice versa
addListener
-
adds given listener to set of listeners.
does nothing if listener is already in set or listener is null
removeListener
-
remoevs given listener from set of listeners.
does nothing if listener is not in set
cameraPositionChanged
public void cameraPositionChanged()
-
call this method if you change position or direction or camera externally
getFrameBuffer
-
returns the current FrameBuffer.
each time this RenderPanel is resized a new FrameBuffer is created
render
public void render()
-
renders (paints) world. call this method each frame.
should not called outside of awt thread.
paintComponent
-
paints this component
Overrides:
-
placeCamera
public void placeCamera(float seconds)
-
places camera according to current settings.
call this method each frame before calling render
showMessage
public void showMessage(String message, int milliseconds) -
display given message on center of screen for a certain time
DocFlex/Doclet is both a multi-format Javadoc doclet and a free edition of DocFlex/Javadoc. If you need to customize your Javadoc without writing a full-blown doclet from scratch, DocFlex/Javadoc may be the only tool able to help you! Find out more at www.docflex.com