Package org.xj3d.ui.awt.browser.ogl
Class SceneThumbnailRecorder
java.lang.Object
org.xj3d.ui.awt.browser.ogl.SceneThumbnailRecorder
- All Implemented Interfaces:
ScreenCaptureListener,FrameStateListener,VRMLNodeListener
public class SceneThumbnailRecorder
extends Object
implements ScreenCaptureListener, VRMLNodeListener, FrameStateListener
A function module that performs an image capture of an
X3D scene for the purpose of creating a thumbnail image for all viewpoints.
The image capture is managed as follows:
- On the completion of the world and content loading, all the Viewpoint nodes are searched for and bound if necessary.
- The image capture is initiated immediately if the Viewpoint is not found, or the DEF'ed Viewpoint is found and currently bound.
- Otherwise, the capture is initiated immediately upon notification that the Viewpoint has been bound.
- Version:
- $Revision: 1.8 $
- Author:
- Alan Hudson
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanFlag used in the end of frame listener, indicating that the new nodes may be added to the sceneprotected String[]Image encoding types that may have an alphaprotected ObjectThe rendering surfaceprotected booleanSynchronization flagprotected OGLConstructThe construct instance to record fromprotected OGLStandardBrowserCoreThe browser coreprotected org.j3d.util.ErrorReporterThe error reporting mechanismprotected longThe total file write timeprotected NumberFormatFormatter for creating the image sequence identifierprotected FrameStateManagerThe frame state managerprotected booleanFlag indicating that the selected encoding type may have an alphaprotected booleanShould the headlight be onprotected intThe height of the output imagesprotected intprotected intThe index of the viewpoint's isBound field.protected RecorderListenerListener for recorder status eventsprotected OGLNavigationInfoThe viewpointprotected FileThe output file for the captured imagesprotected booleanFlag indicating that the image capture should be post processedprotected longThe total frame rendering timeprotected VRMLWorldRootNodeTypeThe scene root, parent for the nav info and viewpoint nodesprotected intThe sequence capture numberprotected intRGB value for snap pixels that should be replacedprotected longThe last start of frame rendering timeprotected StringThe image encoding typeprotected VRMLViewpointNodeTypeThe viewpoint node, used when we have to wait for the named viewpoint to be boundprotected List<VRMLViewpointNodeType> The viewpoints left to processprotected intThe width of the output images -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidNotification that the rendering of the event model is complete and that rendering is about to begin.voidfieldChanged(int index) Notification that the field represented by the given index has changed.doubleReturn the file write time in millisecondsdoubleReturn the frame rendering time in millisecondsvoidscreenCaptured(Buffer buffer, int width, int height) Notification of a new screen capture.voidsetBackgroundColor(Color x3dBackgroundColor, Color imageBackgroundColor) Set the background color for the image.booleansetEncoding(String type) Set the image encoding typevoidsetFilePrefix(String prefix) Set the name prefix for imagesvoidsetOutputDirectory(File dir) Set the output directory for imagesvoidsetSize(int width, int height) Set the image sizevoidstart(RecorderListener listener) Initiate the capture
-
Field Details
-
construct
The construct instance to record from -
core
The browser core -
errorReporter
protected org.j3d.util.ErrorReporter errorReporterThe error reporting mechanism -
canvas
The rendering surface -
root
The scene root, parent for the nav info and viewpoint nodes -
addNodes
protected boolean addNodesFlag used in the end of frame listener, indicating that the new nodes may be added to the scene -
fsm
The frame state manager -
configComplete
protected boolean configCompleteSynchronization flag -
sequenceCaptureNumber
protected int sequenceCaptureNumberThe sequence capture number -
viewpoint
The viewpoint node, used when we have to wait for the named viewpoint to be bound -
isBound_index
protected int isBound_indexThe index of the viewpoint's isBound field. -
outputDir
The output file for the captured images -
listener
Listener for recorder status events -
headlight
protected boolean headlightShould the headlight be on -
width
protected int widthThe width of the output images -
height
protected int heightThe height of the output images -
type
The image encoding type -
hasAlpha
protected boolean hasAlphaFlag indicating that the selected encoding type may have an alpha -
alphaTypes
Image encoding types that may have an alpha -
fileTime
protected long fileTimeThe total file write time -
renderTime
protected long renderTimeThe total frame rendering time -
startFrameTime
protected long startFrameTimeThe last start of frame rendering time -
postProcess
protected boolean postProcessFlag indicating that the image capture should be post processed -
snapRGB
protected int snapRGBRGB value for snap pixels that should be replaced -
imageARGB
protected int imageARGB -
fmt
Formatter for creating the image sequence identifier -
viewpoints
The viewpoints left to process
-
-
Constructor Details
-
SceneThumbnailRecorder
Constructor- Parameters:
construct- The construct instance to record from
-
-
Method Details
-
screenCaptured
Description copied from interface:ScreenCaptureListenerNotification of a new screen capture. This will be in openGL pixel order.- Specified by:
screenCapturedin interfaceScreenCaptureListener- Parameters:
buffer- The screen capturewidth- The width in pixels of the captured screenheight- The height in pixels of the captured screen
-
fieldChanged
public void fieldChanged(int index) Description copied from interface:VRMLNodeListenerNotification that the field represented by the given index has changed.- Specified by:
fieldChangedin interfaceVRMLNodeListener- Parameters:
index- The index of the field that has changed
-
allEventsComplete
public void allEventsComplete()Description copied from interface:FrameStateListenerNotification that the rendering of the event model is complete and that rendering is about to begin. If the node needs to update itself for this frame, it should do so now before the render pass takes place.- Specified by:
allEventsCompletein interfaceFrameStateListener
-
getRenderTime
public double getRenderTime()Return the frame rendering time in milliseconds- Returns:
- the frame rendering time in milliseconds
-
getFileTime
public double getFileTime()Return the file write time in milliseconds- Returns:
- the file write time in milliseconds
-
setEncoding
Set the image encoding type- Parameters:
type- The image encoding type- Returns:
- true if the encoding type is valid, false otherwise.
-
setSize
public void setSize(int width, int height) Set the image size- Parameters:
width- The image widthheight- The image height
-
setBackgroundColor
Set the background color for the image.- Parameters:
x3dBackgroundColor- The background color of the X3D model to replace with the image background color. If null, the image background will not be changed from the capture.imageBackgroundColor- The color to set for the image background. If null, the image background will not be changed from the capture.
-
setOutputDirectory
Set the output directory for images- Parameters:
dir- The output directory for images
-
setFilePrefix
Set the name prefix for images- Parameters:
prefix- The prefix for file names
-
start
-