public class EmbeddedView
extends java.lang.Object
implements com.jme3.post.SceneProcessor
Frame
. Use of this class requires use of the AwtPanelsContext
in the associated jME Application
.
Each embedded view comes with the necessary jME components to be rendered in
a AWT Frame
(which may be embedded within an SWT
Composite
), although these components are largely hidden from
the client AppState
AwtPanel
used to render a scene within an AWT
Frame
ViewPort
that can be attached to the root of a scene graph.Camera
associated with the ViewPort.
To use an EmbeddedView
, you must do the following:
EmbeddedView
.Frame
and call
addToEmbeddedFrame(Frame)
.IEmbeddedViewClient
with the
EmbeddedView
by calling
registerViewClient(IEmbeddedViewClient)
.
Note: For each EmbeddedView
, there can be only one
embedded Frame
and one registered
IEmbeddedViewClient
at a time.
Constructor and Description |
---|
EmbeddedView(com.jme3.app.Application app,
int id)
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addToEmbeddedFrame(java.awt.Frame embeddedFrame)
Adds this view to an AWT
Frame to be rendered in an AWT- or
SWT-based program. |
void |
cleanup()
Cleans up resources used by this class as a
SceneProcessor . |
void |
dispose()
Disposes any resources associated with the
EmbeddedView . |
void |
exportImage(java.io.File file)
Exports the
EmbeddedView as an image file. |
com.jme3.renderer.Camera |
getCamera()
|
com.jme3.scene.Node |
getHUD()
Gets the GUI/HUD
Node currently associated with this
EmbeddedView . |
int |
getID()
Gets the unique ID associated with this
EmbeddedView . |
java.lang.Object |
getViewCamera()
Gets the interactive camera currently associated with this
EmbeddedView . |
void |
initialize(com.jme3.renderer.RenderManager rm,
com.jme3.renderer.ViewPort vp)
Initializes the view as a
SceneProcessor . |
boolean |
isInitialized()
Checks that the view has been initialized as a
SceneProcessor . |
void |
postFrame(com.jme3.texture.FrameBuffer out)
Takes the screenshot after the frame has been rendered.
|
void |
postQueue(com.jme3.renderer.queue.RenderQueue rq)
Does nothing.
|
void |
preFrame(float tpf)
Does nothing.
|
void |
registerViewClient(IEmbeddedViewClient newClient)
Registers or configures an
IEmbeddedViewClient for this
EmbeddedView . |
void |
removeFromEmbeddedFrame()
Removes this view from its current AWT
Frame . |
void |
reshape(com.jme3.renderer.ViewPort vp,
int w,
int h)
Updates the known dimensions of the associated
viewPort . |
void |
unregisterViewClient(IEmbeddedViewClient oldClient)
Unregisters an
IEmbeddedViewClient from this
EmbeddedView . |
public EmbeddedView(com.jme3.app.Application app, int id)
app
- The Application
responsible for rendering scene
graphs.id
- The unique ID of this view.public void registerViewClient(IEmbeddedViewClient newClient)
IEmbeddedViewClient
for this
EmbeddedView
. Each EmbeddedView
can be
registered with one client at a time.newClient
- The client that will be using this view.unregisterViewClient(IEmbeddedViewClient)
public void unregisterViewClient(IEmbeddedViewClient oldClient)
IEmbeddedViewClient
from this
EmbeddedView
.oldClient
- The client that will no longer be using this view.registerViewClient(IEmbeddedViewClient)
public void addToEmbeddedFrame(java.awt.Frame embeddedFrame)
Frame
to be rendered in an AWT- or
SWT-based program. Note: A single EmbeddedView
cannot
be added to multiple Frame
s at this time.embeddedFrame
- The AWT Frame
in which to render this jME-based
view. If null or if the embedded Frame
is already
configured, this operation does nothing. The
Frame
is expected to have a default
BorderLayout
public void removeFromEmbeddedFrame()
Frame
. After this
operation, the view can be added to a different Frame
. If a
Frame
is not already configured, this operation does
nothing.public void dispose()
EmbeddedView
.public int getID()
EmbeddedView
.public com.jme3.renderer.Camera getCamera()
Camera
associated with the scene graph's root
Node
and viewPort
. This is useful for initializing
custom cameras for a particular scene graph.public java.lang.Object getViewCamera()
EmbeddedView
. This is the component that is registered with
the InputManager
for the rendering Application
.public com.jme3.scene.Node getHUD()
Node
currently associated with this
EmbeddedView
.Node
.public void cleanup()
SceneProcessor
.cleanup
in interface com.jme3.post.SceneProcessor
public void initialize(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp)
SceneProcessor
.initialize
in interface com.jme3.post.SceneProcessor
public void reshape(com.jme3.renderer.ViewPort vp, int w, int h)
viewPort
.reshape
in interface com.jme3.post.SceneProcessor
public boolean isInitialized()
SceneProcessor
.isInitialized
in interface com.jme3.post.SceneProcessor
public void preFrame(float tpf)
preFrame
in interface com.jme3.post.SceneProcessor
public void postQueue(com.jme3.renderer.queue.RenderQueue rq)
postQueue
in interface com.jme3.post.SceneProcessor
public void postFrame(com.jme3.texture.FrameBuffer out)
postFrame
in interface com.jme3.post.SceneProcessor
public void exportImage(java.io.File file)
EmbeddedView
as an image file.file
- The location to write the file. Any pre-existing image file
will be overwritten. If null or cannot write to this file,
nothing will happen.