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 boolean
Flag 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 Object
The rendering surfaceprotected boolean
Synchronization flagprotected OGLConstruct
The construct instance to record fromprotected OGLStandardBrowserCore
The browser coreprotected org.j3d.util.ErrorReporter
The error reporting mechanismprotected long
The total file write timeprotected NumberFormat
Formatter for creating the image sequence identifierprotected FrameStateManager
The frame state managerprotected boolean
Flag indicating that the selected encoding type may have an alphaprotected boolean
Should the headlight be onprotected int
The height of the output imagesprotected int
protected int
The index of the viewpoint's isBound field.protected RecorderListener
Listener for recorder status eventsprotected OGLNavigationInfo
The viewpointprotected File
The output file for the captured imagesprotected boolean
Flag indicating that the image capture should be post processedprotected long
The total frame rendering timeprotected VRMLWorldRootNodeType
The scene root, parent for the nav info and viewpoint nodesprotected int
The sequence capture numberprotected int
RGB value for snap pixels that should be replacedprotected long
The last start of frame rendering timeprotected String
The image encoding typeprotected VRMLViewpointNodeType
The viewpoint node, used when we have to wait for the named viewpoint to be boundprotected List
<VRMLViewpointNodeType> The viewpoints left to processprotected int
The width of the output images -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Notification that the rendering of the event model is complete and that rendering is about to begin.void
fieldChanged
(int index) Notification that the field represented by the given index has changed.double
Return the file write time in millisecondsdouble
Return the frame rendering time in millisecondsvoid
screenCaptured
(Buffer buffer, int width, int height) Notification of a new screen capture.void
setBackgroundColor
(Color x3dBackgroundColor, Color imageBackgroundColor) Set the background color for the image.boolean
setEncoding
(String type) Set the image encoding typevoid
setFilePrefix
(String prefix) Set the name prefix for imagesvoid
setOutputDirectory
(File dir) Set the output directory for imagesvoid
setSize
(int width, int height) Set the image sizevoid
start
(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:ScreenCaptureListener
Notification of a new screen capture. This will be in openGL pixel order.- Specified by:
screenCaptured
in 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:VRMLNodeListener
Notification that the field represented by the given index has changed.- Specified by:
fieldChanged
in interfaceVRMLNodeListener
- Parameters:
index
- The index of the field that has changed
-
allEventsComplete
public void allEventsComplete()Description copied from interface:FrameStateListener
Notification 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:
allEventsComplete
in 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
-