jarp
Class View

java.lang.Object
  extended by jarp.View
All Implemented Interfaces:
java.util.EventListener, javax.media.opengl.GLEventListener

public class View
extends java.lang.Object
implements javax.media.opengl.GLEventListener

Top-level Java ARP avatar view class -- each instance of this class maintains its own GLCanvas for which it acts as the GLEventListener


Field Summary
static float[] BG_RGB_STD
           
static int CAM_NONE
           
static int CAM_PANNING
           
static int CAM_PANNING_H
           
static int CAM_PANNING_V
           
static int CAM_ROTATING
           
static int CAM_ZOOMING
           
 
Constructor Summary
View(AvatarEventHandler aehdlr, JAOptions jopts, JACanvasEmbedder embedder)
          Constructor -- creates the GLCanvas, but defers the rest of the work until the init() event.
 
Method Summary
 void display(javax.media.opengl.GLAutoDrawable gld)
          JOGL EventListener method: renders the current state of this avatar view's character onto its GLCanvas -- which is identical to the given drawable.
 void displayChanged(javax.media.opengl.GLAutoDrawable gld, boolean modeChanged, boolean deviceChanged)
          JOGL EventListener method: accepts notification of the given changes to the characteristics of the display supporting this avatar view's OpenGL canvas.
 void dispose(javax.media.opengl.GLAutoDrawable gld)
           
 AmbientManager getAmbientManager()
          Returns the ambient motion manager for this view's current character if there is one, and if there is a rest pose frame for the character, or null otherwise.
 void getCamClipPlanes(float[] clipnf)
           
 void getCamFacing(float[] facexyz)
           
 float getCamFOV()
           
 void getCamLocation(float[] locxyz)
           
 void getCamUp(float[] upxyz)
           
 int getHeight()
          Returns the height of this view's GL canvas.
 int getWidth()
          Returns the width of this view's GL canvas.
 void handleDoIdleAmbientChange()
          Responds to a change in the idle ambient scale option setting, starting or stopping idle ambient motion if appropriate.
 void init(javax.media.opengl.GLAutoDrawable gld)
          JOGL EventListener method: initialises the newly established GL drawing context for this avatar view.
 void onLeftMouseDown(int x, int y)
           
 void onMouseMove(int x, int y)
           
 void onMouseUp()
           
 void onRightMouseDown(int x, int y)
           
 void playAndGrabOneFrame(CASFrame FRAME, int F, byte[] pixels, boolean dolog)
          Generates and plays one frame, given the frame data, its index number, taking a copy of the resulting frame image, and returning that image.
 void playOneFrame(CASFrame FRAME, int F)
          Generates and plays one frame, often but not necessarily as part of an animation sequence, given the frame data and its index number.
 void playOneFrame(CASFrame FRAME, int F, float SPEED_UP, boolean T_DISPLAY)
          Generates and plays one frame, often but not necessarily as part of an animation sequence, given the frame data, its index number, the current speed-up factor (for use in performance statistics collection), with running performance data logging output controlled by the given flag.
 void playOneFrameWithStableAmbient(CASFrame FRAME, int F)
          Generates and plays one frame, given the frame data and index number, with no change in the ambient adjustment (if any).
 void playOneIdleFrame(CASFrame FRAME)
          Generates and plays the given frame, assumed to be part of an idle (non-animating) sequence, and hence not to have an ambient adjustment applied to it before processing.
 void requestSwitchAvatar(AvatarDefinitionAccess avdef)
          Requests that this view initiates a switch to the use of the avatar with the given given definition, by loading this view's character from the definition; the definition may be null, which is interpreted as a request to unload the current avatar.
 void resetAmbientClock()
          If the current avatar has an ambient manager, this method resets that manager's clock.
 void reshape(javax.media.opengl.GLAutoDrawable gld, int x, int y, int w, int h)
          JOGL EventListener method: accepts notification of the given changes to the location and/or dimensions of this avatar view's OpenGL canvas.
 void saveAvatarIfRequested()
          Checks whether the conditions for the saving of a newly loaded avatar definition or of its texture are satisifed, and if so performs the appropriate save operations.
 void setCamClipPlanes(float znear, float zfar)
           
 void setCamExternal(javax.swing.event.MouseInputListener extmil)
           
 void setCamFacing(float[] facingxyz)
           
 void setCamFacing(float x, float y, float z)
           
 void setCamFOV(float fov)
           
 void setCamInternal()
           
 void setCamLocation(float[] locxyz)
           
 void setCamLocation(float x, float y, float z)
           
 void setCamUp(float[] upxyz)
           
 void setCamUp(float x, float y, float z)
           
 void setPlayerStats(JAPlayerStats ps)
          Sets the player performance statistics gatherer for this avatar view.
 void setRenderMode(int mode)
           
 void startAnimation()
          Registers the start of a new animation, that is, the performance of a sequence of (frame generation and) frame display operations.
 void startAnimationForVideo(boolean log, int width, int height)
          Registers the start of a new animation, performed for video generation, with the given logging flag setting, and using the given width and height values for the video images.
 void stopAnimation()
          Registers the completion of an animation sequence.
 void stopAnimationForVideo()
          Registers the completion of an animation sequence for video generation.
 void terminateView()
          Performs final termination for this avatar view, assuming that an earlier call has been made to #terminateViewDisplay().
 ThreadCompletionChecker terminateViewDisplay()
          Terminates the display for this avatar view, and returns the completion checker for this view's display scheduler thread.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CAM_NONE

public static final int CAM_NONE
See Also:
Constant Field Values

CAM_ROTATING

public static final int CAM_ROTATING
See Also:
Constant Field Values

CAM_ZOOMING

public static final int CAM_ZOOMING
See Also:
Constant Field Values

CAM_PANNING

public static final int CAM_PANNING
See Also:
Constant Field Values

CAM_PANNING_V

public static final int CAM_PANNING_V
See Also:
Constant Field Values

CAM_PANNING_H

public static final int CAM_PANNING_H
See Also:
Constant Field Values

BG_RGB_STD

public static final float[] BG_RGB_STD
Constructor Detail

View

public View(AvatarEventHandler aehdlr,
            JAOptions jopts,
            JACanvasEmbedder embedder)
Constructor -- creates the GLCanvas, but defers the rest of the work until the init() event.

Method Detail

getWidth

public int getWidth()
Returns the width of this view's GL canvas.


getHeight

public int getHeight()
Returns the height of this view's GL canvas.


terminateViewDisplay

public ThreadCompletionChecker terminateViewDisplay()
Terminates the display for this avatar view, and returns the completion checker for this view's display scheduler thread.


terminateView

public void terminateView()
Performs final termination for this avatar view, assuming that an earlier call has been made to #terminateViewDisplay().


requestSwitchAvatar

public void requestSwitchAvatar(AvatarDefinitionAccess avdef)
Requests that this view initiates a switch to the use of the avatar with the given given definition, by loading this view's character from the definition; the definition may be null, which is interpreted as a request to unload the current avatar.


getAmbientManager

public AmbientManager getAmbientManager()
Returns the ambient motion manager for this view's current character if there is one, and if there is a rest pose frame for the character, or null otherwise.


handleDoIdleAmbientChange

public void handleDoIdleAmbientChange()
Responds to a change in the idle ambient scale option setting, starting or stopping idle ambient motion if appropriate.


init

public void init(javax.media.opengl.GLAutoDrawable gld)
JOGL EventListener method: initialises the newly established GL drawing context for this avatar view.

Specified by:
init in interface javax.media.opengl.GLEventListener

display

public void display(javax.media.opengl.GLAutoDrawable gld)
JOGL EventListener method: renders the current state of this avatar view's character onto its GLCanvas -- which is identical to the given drawable.

Specified by:
display in interface javax.media.opengl.GLEventListener

reshape

public void reshape(javax.media.opengl.GLAutoDrawable gld,
                    int x,
                    int y,
                    int w,
                    int h)
JOGL EventListener method: accepts notification of the given changes to the location and/or dimensions of this avatar view's OpenGL canvas.

Specified by:
reshape in interface javax.media.opengl.GLEventListener

displayChanged

public void displayChanged(javax.media.opengl.GLAutoDrawable gld,
                           boolean modeChanged,
                           boolean deviceChanged)
JOGL EventListener method: accepts notification of the given changes to the characteristics of the display supporting this avatar view's OpenGL canvas. JOGL2: NO LONGER IN EventListener.


dispose

public void dispose(javax.media.opengl.GLAutoDrawable gld)
Specified by:
dispose in interface javax.media.opengl.GLEventListener

setRenderMode

public void setRenderMode(int mode)

saveAvatarIfRequested

public void saveAvatarIfRequested()
Checks whether the conditions for the saving of a newly loaded avatar definition or of its texture are satisifed, and if so performs the appropriate save operations.


setPlayerStats

public void setPlayerStats(JAPlayerStats ps)
Sets the player performance statistics gatherer for this avatar view.


startAnimation

public void startAnimation()
Registers the start of a new animation, that is, the performance of a sequence of (frame generation and) frame display operations.


stopAnimation

public void stopAnimation()
Registers the completion of an animation sequence.


startAnimationForVideo

public void startAnimationForVideo(boolean log,
                                   int width,
                                   int height)
Registers the start of a new animation, performed for video generation, with the given logging flag setting, and using the given width and height values for the video images.


stopAnimationForVideo

public void stopAnimationForVideo()
Registers the completion of an animation sequence for video generation.


resetAmbientClock

public void resetAmbientClock()
If the current avatar has an ambient manager, this method resets that manager's clock.


playOneFrameWithStableAmbient

public void playOneFrameWithStableAmbient(CASFrame FRAME,
                                          int F)
                                   throws java.lang.InterruptedException,
                                          JAException
Generates and plays one frame, given the frame data and index number, with no change in the ambient adjustment (if any). This means that when a single frame is played using this method, the frame will have the same ambient adjustment as the immediately preceding idle frame.

Throws:
java.lang.InterruptedException
JAException

playOneFrame

public void playOneFrame(CASFrame FRAME,
                         int F)
                  throws java.lang.InterruptedException,
                         JAException
Generates and plays one frame, often but not necessarily as part of an animation sequence, given the frame data and its index number.

Throws:
java.lang.InterruptedException
JAException

playOneFrame

public void playOneFrame(CASFrame FRAME,
                         int F,
                         float SPEED_UP,
                         boolean T_DISPLAY)
                  throws java.lang.InterruptedException,
                         JAException
Generates and plays one frame, often but not necessarily as part of an animation sequence, given the frame data, its index number, the current speed-up factor (for use in performance statistics collection), with running performance data logging output controlled by the given flag.

Throws:
java.lang.InterruptedException
JAException

playOneIdleFrame

public void playOneIdleFrame(CASFrame FRAME)
                      throws java.lang.InterruptedException,
                             JAException
Generates and plays the given frame, assumed to be part of an idle (non-animating) sequence, and hence not to have an ambient adjustment applied to it before processing. But note that the lack of ambient adjustment here does not preclude the prior application of such an adjustment by the caller.

Throws:
java.lang.InterruptedException
JAException

playAndGrabOneFrame

public void playAndGrabOneFrame(CASFrame FRAME,
                                int F,
                                byte[] pixels,
                                boolean dolog)
                         throws java.lang.InterruptedException,
                                JAException
Generates and plays one frame, given the frame data, its index number, taking a copy of the resulting frame image, and returning that image. This method is intended to support video generation for this avatar view.

Throws:
java.lang.InterruptedException
JAException

setCamInternal

public void setCamInternal()

setCamExternal

public void setCamExternal(javax.swing.event.MouseInputListener extmil)

onLeftMouseDown

public void onLeftMouseDown(int x,
                            int y)

onRightMouseDown

public void onRightMouseDown(int x,
                             int y)

onMouseMove

public void onMouseMove(int x,
                        int y)

onMouseUp

public void onMouseUp()

setCamLocation

public void setCamLocation(float[] locxyz)

setCamLocation

public void setCamLocation(float x,
                           float y,
                           float z)

setCamFacing

public void setCamFacing(float[] facingxyz)

setCamFacing

public void setCamFacing(float x,
                         float y,
                         float z)

setCamUp

public void setCamUp(float[] upxyz)

setCamUp

public void setCamUp(float x,
                     float y,
                     float z)

setCamClipPlanes

public void setCamClipPlanes(float znear,
                             float zfar)

setCamFOV

public void setCamFOV(float fov)

getCamLocation

public void getCamLocation(float[] locxyz)

getCamFacing

public void getCamFacing(float[] facexyz)

getCamUp

public void getCamUp(float[] upxyz)

getCamClipPlanes

public void getCamClipPlanes(float[] clipnf)

getCamFOV

public float getCamFOV()