public class RenderThread
extends android.os.HandlerThread
Drag events from the main thread will be forwarded to the RenderThread's message queue so that it may update the view state.
SphericalSceneRenderer draws the 360 video scene each frame using the latest latched video texture frame.
Modifier and Type | Field and Description |
---|---|
static float |
FOVY |
static int |
MSG_FRAME_AVAILABLE |
static int |
MSG_ON_SCROLL |
static int |
MSG_SET_POSITION |
static int |
MSG_SURFACE_AVAILABLE |
static int |
MSG_SURFACE_CHANGED |
static int |
MSG_SURFACE_DESTROYED |
static int |
MSG_VSYNC |
static float |
Z_FAR |
static float |
Z_NEAR |
Constructor and Description |
---|
RenderThread(RenderView renderView)
Constructs a new 360 video renderer.
|
Modifier and Type | Method and Description |
---|---|
android.view.Surface |
getVideoDecodeSurface()
Creates a new
Surface that will be used to render the 360 video. |
boolean |
isVrMode()
Checks whether the renderer is currently configured to render the video in Google VR mode.
|
void |
notifySurfaceAvailable(java.lang.Object surface,
int width,
int height)
Notifies the video render thread that the surface is available.
|
void |
notifySurfaceChanged(android.view.Surface surface,
int width,
int height)
Notifies the video render thread that the surface has changed.
|
void |
notifySurfaceDestroyed()
Notifies the video render thread that the surface has been destroyed.
|
void |
setOnFrameAvailableListener(android.graphics.SurfaceTexture.OnFrameAvailableListener onFrameAvailableListener) |
void |
setVrMode(boolean vrMode)
Sets whether the renderer should render the video in Google VR mode.
|
void |
start()
Starts the render thread to run asynchronously.
|
getLooper, getThreadId, onLooperPrepared, quit, quitSafely, run
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield
public static final int MSG_SURFACE_AVAILABLE
public static final int MSG_SURFACE_CHANGED
public static final int MSG_SURFACE_DESTROYED
public static final int MSG_FRAME_AVAILABLE
public static final int MSG_VSYNC
public static final int MSG_ON_SCROLL
public static final int MSG_SET_POSITION
public static final float FOVY
public static final float Z_NEAR
public static final float Z_FAR
public RenderThread(@NonNull RenderView renderView)
renderView
- reference the surface view that owns this render thread.java.lang.NullPointerException
- if the render view is null.public boolean isVrMode()
setVrMode(boolean)
public void setVrMode(boolean vrMode)
vrMode
- true if Google VR mode should be enabled, otherwise false.isVrMode()
public void notifySurfaceAvailable(java.lang.Object surface, int width, int height)
surface
- reference to a SurfaceView
or {TextureView
width
- the width of the surface.height
- the height of the surface.public void notifySurfaceChanged(android.view.Surface surface, int width, int height)
surface
- reference to a SurfaceView
or {TextureView
width
- the new width of the surface.height
- the new height of the surface.public void notifySurfaceDestroyed()
public void start()
start
in class java.lang.Thread
public android.view.Surface getVideoDecodeSurface()
Surface
that will be used to render the 360 video.java.lang.IllegalStateException
- exception if the surface cannot be created.public void setOnFrameAvailableListener(android.graphics.SurfaceTexture.OnFrameAvailableListener onFrameAvailableListener)