JavaScript Client API

com.mi.rs.RenderCommand Class Reference

Description

Renders an image. The RenderCommand works together with an ImageRenderTarget object to render the scene and display the rendered image. Each render command will render a single frame. To implement a client side render loop, simply add new RenderCommands to the service, either continously or when something has changed, like the camera transform. Note that render commands are very expensive so it is vital to use the process commands callbacks mechanism to make sure that no redundant render commands are added to the service.

Any number of render commands can be added at a single time, so if multiple ImageRenderTarget instances needs to be updated it is perfectly ok to add multiple render commands without waiting for previous commands to complete. Note however that render commands, like all other commands, will be serialized by the service.

Constructor

 RenderCommand( com.​mi.​rs.​ImageRenderTarget renderTarget, String sceneName, String renderer, String renderContext, Uint32 renderContextTimeout, String format, String quality, String canvasContent, String canvasPixelType, String pixelType)
Creates an RenderCommand object. More...

Member Functions

String toString()
Returns a string describing this Object. More...

Variables

Boolean  isCancelled
[read-only] Set to true if this render command is cancelled.
String  name
[read-only] The name of the RenderCommand.
Object  params
[read-only] The object containing RenderCommand arguments as param/value pairs.
ImageRenderTarget renderTarget
The render target.

Constructor

com.​mi.​rs.​RenderCommand( com.​mi.​rs.​ImageRenderTarget renderTarget, String sceneName, String renderer, String renderContext, Uint32 renderContextTimeout, String format, String quality, String canvasContent, String canvasPixelType, String pixelType)

Creates an RenderCommand object. The RenderCommand will use the "render" command to render the scene.

Parameters

renderTarget
The target that will display the rendered image.
sceneName
The name of the scene to render.
renderer
The name of the renderer to use. Defaults to null in which case the renderer specified in the scene options will be used.
renderContext
The name of the render context to use. Defaults to null.
renderContextTimeout
The timeout in seconds for the specified render context. Defaults to 0.
format
The image format to use. Defaults to "jpg".
quality
The quality of the image if applicable. Defaults to "90"
canvasContent
The content to render into the canvas. Defaults to "result".
canvasPixelType
The canvas pixel type. Defaults to "Rgba".
pixelType
The pixel type of the returned image. Defaults to "Rgba".

Member Functions

String com.​mi.​rs.​RenderCommand.prototype.toString()

Returns a string describing this Object.

Returns

A String describing this Object.

Variables

Boolean com.​mi.​rs.​RenderCommand.prototype.isCancelled

[read-only] Set to true if this render command is cancelled.

String com.​mi.​rs.​RenderCommand.prototype.name

[read-only] The name of the RenderCommand.

Object com.​mi.​rs.​RenderCommand.prototype.params

[read-only] The object containing RenderCommand arguments as param/value pairs.

ImageRenderTarget com.​mi.​rs.​RenderCommand.prototype.renderTarget

The render target.