Render_context Class Reference
[Rendering]
Description
A render context from which rendering of a scene is initiated.
Constructor
- Render_context( String name, Scene scene, Number timeout, String renderer)
- More...
Functions
- delete()
- Removes the render context.
- Binary get_last_render( String format, String pixel_type, String quality)
- Retrieves a render context option. More...
- Data get_option( String key)
- Retrieves a render context option. More...
- Array pick( Object point, Object size, Number max_levels)
- Casts a single ray into the scene at raster pixel coordinate point, with (0,0) in the bottom left corner. More...
- Binary render( String format, String pixel_type, String quality, Canvas_definition canvas_definition)
- Renders and returns an encoded image. More...
- String render_to_ascii( Number width, Number height, Canvas_definition canvas_definition)
- Renders and returns a string based on an ASCII art conversion of the rendered image. More...
- String render_to_base64( String format, String pixel_type, String quality, bool datauri, Canvas_definition canvas_definition)
- Renders and returns an encoded image as a base64 string. More...
- Canvas render_to_canvas( Number width, Number height, Canvas_definition canvas_definition)
- Renders and returns an Canvas containing the rendered image. More...
- Canvas render_to_canvases( Number width, Number height, Canvas_definition[] canvas_definitions)
- Renders and returns an array of Canvases containing the rendered images. More...
- render_to_disk( String filename, String format, String pixel_type, String quality, Canvas_definition canvas_definition)
- Renders and encodes an image which is then saved to disk. More...
- set_option( String key, Data value, String type)
- Sets a single render context option. More...
- set_options( Object options)
- Sets a one or more render context options. More...
Static Functions
- Array pick( Scene scene, String renderer, Object point, Object size, Number max_levels)
- Casts a single ray into the scene at raster pixel coordinate point, with (0,0) in the bottom left corner using an anonymous render context. More...
- Binary render( Scene scene, String renderer, String format, String pixel_type, String quality, Canvas_definition canvas_definition, Object options)
- Renders and returns an encoded image using an anonymous render context. More...
- String render_to_ascii( Scene scene, Number width, Number height, String renderer, Canvas_definition canvas_definition, Object options)
- Renders and returns a string based on an ASCII art conversion of the rendered image using an anonymous render context. More...
- String render_to_base64( Scene scene, String renderer, String format, String pixel_type, String quality, bool datauri, Canvas_definition canvas_definition, Object options)
- Renders and returns an encoded image as a base64 string using an anonymous render context. More...
- Canvas render_to_canvas( Scene scene, String renderer, Number width, Number height, Canvas_definition canvas_definition, Object options)
- Renders and returns an Canvas containing the rendered image using an anonymous render context. More...
- Canvas render_to_canvases( Scene scene, String renderer, Number width, Number height, Canvas_definition[] canvas_definitions, Object options)
- Renders and returns an array of Canvases containing the rendered images using an anonymous render context. More...
- render_to_disk( Scene scene, String filename, String renderer, String format, String pixel_type, String quality, Canvas_definition canvas_definition, Object options)
- Renders and encodes an image which is then saved to disk using an anonymous render context. More...
Properties
- bool exists
- Returns whether the render context exists or not.
- Number last_result
- The numeric result of the last render. More...
- String name
- The name of the render context. More...
- String renderer
- The renderer used by the render context. More...
- Scene scene
- The scene associated with the render context. More...
- Scope scope
- The scope in which the render context was created. More...
- Number timeout
- The timeout in seconds after which the render context will expire. More...
Constructor
- Render_context( String name, Scene scene, Number timeout, String renderer)
-
Parameters
- name
- the name of the render context
- scene
- scene from which to create the render context
- timeout
- timeout in seconds after which the render context will expire
- renderer
- name of the renderer to be used
Functions
- Render_context.delete()
-
Removes the render context.
- Binary Render_context.get_last_render( String format, String pixel_type, String quality)
-
Retrieves a render context option.
Parameters
- format
- the image format for the encoded data.
- pixel_type
- the pixel type of the encoded image.
- quality
- quality of the encoded image if the chosen format supports variable quality
Returns
the encoded image of the last render.
- Data Render_context.get_option( String key)
-
Retrieves a render context option.
Parameters
- key
- the name option to retrieve.
Returns
the value for the named render context option.
- Array Render_context.pick( Object point, Object size, Number max_levels)
-
Casts a single ray into the scene at raster pixel coordinate point, with (0,0) in the bottom left corner. Returns an array that contains information about any objects hit by the ray. Before a pick can be performed the render context must have performed a render at least once.
Parameters
- point
- The picked 2D point in screenspace represented by x and y properties.
- size
- The size of the area to pick in screenspace coordinates by x and y properties. If specified, then a rectangle centered around "point" will be picked rather than just a single point.
- max_levels
- Controls the number of rays that may be cast, per ray, during the picking operation. A level of 1 will only trace primary rays. Any other value will continue tracing rays through the scene until nothing was hit or the maximum depth is exhausted, with a value of 0 indicating unconstrained depth.
Returns
the pick results as an array of objects with picked_object_name, world_point and paths properties. The paths property contains the scene graph path starting at the picked object progressing to the root group of the scene.
- Array Render_context.pick( Scene scene, String renderer, Object point, Object size, Number max_levels) [static]
-
Casts a single ray into the scene at raster pixel coordinate point, with (0,0) in the bottom left corner using an anonymous render context. Returns an array that contains information about any objects hit by the ray.
Parameters
- scene
- the scene to render.
- renderer
- name of the renderer to be used
- point
- The picked 2D point in screenspace represented by x and y properties.
- size
- The size of the area to pick in screenspace coordinates by x and y properties. If specified, then a rectangle centered around "point" will be picked rather than just a single point.
- max_levels
- Controls the number of rays that may be cast, per ray, during the picking operation. A level of 1 will only trace primary rays. Any other value will continue tracing rays through the scene until nothing was hit or the maximum depth is exhausted, with a value of 0 indicating unconstrained depth.
Returns
the pick results as an array of objects with picked_object_name, world_point and paths properties. The paths property contains the scene graph path starting at the picked object progressing to the root group of the scene.
- Binary Render_context.render( String format, String pixel_type, String quality, Canvas_definition canvas_definition)
-
Renders and returns an encoded image.
Parameters
- format
- the image format for the encoded data.
- pixel_type
- the pixel type of the encoded image.
- quality
- quality of the encoded image if the chosen format supports variable quality.
- canvas_definition
- the definition of the canvas to be rendered. Must contain properties name, pixel_type and content. The content property is a Canvas_parameters object which contains a type and params property.
Returns
the encoded image of the render.
- Binary Render_context.render( Scene scene, String renderer, String format, String pixel_type, String quality, Canvas_definition canvas_definition, Object options) [static]
-
Renders and returns an encoded image using an anonymous render context.
Parameters
- scene
- the scene to render.
- renderer
- name of the renderer to be used
- format
- the image format for the encoded data.
- pixel_type
- the pixel type of the encoded image.
- quality
- quality of the encoded image if the chosen format supports variable quality.
- canvas_definition
- the definition of the canvas to be rendered. Must
- options
- render context options to be passed to the rendering. contain properties name, pixel_type and content. The content property is a Canvas_parameters object which contains a type and params property.
Returns
the encoded image of the render.
- String Render_context.render_to_ascii( Number width, Number height, Canvas_definition canvas_definition)
-
Renders and returns a string based on an ASCII art conversion of the rendered image.
Parameters
- width
- the width in characters of the output.
- height
- the height in characters of the output.
- canvas_definition
- the definition of the canvas to be rendered. Must contain properties name, pixel_type and content. The content property is a Canvas_parameters object which contains a type and params property.
Returns
the string of the ASCII art image of the render.
- String Render_context.render_to_ascii( Scene scene, Number width, Number height, String renderer, Canvas_definition canvas_definition, Object options) [static]
-
Renders and returns a string based on an ASCII art conversion of the rendered image using an anonymous render context.
Parameters
- scene
- the scene to render.
- width
- the width in characters of the output.
- height
- the height in characters of the output.
- renderer
- name of the renderer to be used
- canvas_definition
- the definition of the canvas to be rendered. Must contain properties name, pixel_type and content. The content property is a Canvas_parameters object which contains a type and params property.
- options
- render context options to be passed to the rendering.
Returns
the string of the ASCII art image of the render.
- String Render_context.render_to_base64( String format, String pixel_type, String quality, bool datauri, Canvas_definition canvas_definition)
-
Renders and returns an encoded image as a base64 string.
Parameters
- format
- the image format for the encoded data.
- pixel_type
- the pixel type of the encoded image.
- quality
- quality of the encoded image if the chosen format supports variable quality.
- datauri
- if true then the datauri format is used for the resulting image.
- canvas_definition
- the definition of the canvas to be rendered. Must contain properties name, pixel_type and content. The content property is a Canvas_parameters object which contains a type and params property.
Returns
the base64 encoded string of the image of the render.
- String Render_context.render_to_base64( Scene scene, String renderer, String format, String pixel_type, String quality, bool datauri, Canvas_definition canvas_definition, Object options) [static]
-
Renders and returns an encoded image as a base64 string using an anonymous render context.
Parameters
- scene
- the scene to render.
- renderer
- name of the renderer to be used
- format
- the image format for the encoded data.
- pixel_type
- the pixel type of the encoded image.
- quality
- quality of the encoded image if the chosen format supports variable quality.
- datauri
- if true then the datauri format is used for the resulting image.
- canvas_definition
- the definition of the canvas to be rendered. Must contain properties name, pixel_type and content. The content property is a Canvas_parameters object which contains a type and params property.
- options
- render context options to be passed to the rendering.
Returns
the base64 encoded string of the image of the render.
- Canvas Render_context.render_to_canvas( Number width, Number height, Canvas_definition canvas_definition)
-
Renders and returns an Canvas containing the rendered image.
Parameters
- width
- the width in pixels of the output canvas. If not provided uses the camera.
- height
- the height in pixels of the output canvas. If not provided uses the camera.
- canvas_definition
- the definition of the canvas to be rendered. Must contain properties name, pixel_type and content. The content property is a Canvas_parameters object which contains a type and params property.
Returns
a canvas containing the rendered image.
- Canvas Render_context.render_to_canvas( Scene scene, String renderer, Number width, Number height, Canvas_definition canvas_definition, Object options) [static]
-
Renders and returns an Canvas containing the rendered image using an anonymous render context.
Parameters
- scene
- the scene to render.
- renderer
- name of the renderer to be used
- width
- the width in pixels of the output canvas. If not provided uses the camera.
- height
- the height in pixels of the output canvas. If not provided uses the camera.
- canvas_definition
- the definition of the canvas to be rendered. Must contain properties name, pixel_type and content. The content property is a Canvas_parameters object which contains a type and params property.
- options
- render context options to be passed to the rendering.
Returns
a canvas containing the rendered image.
- Canvas Render_context.render_to_canvases( Number width, Number height, Canvas_definition[] canvas_definitions)
-
Renders and returns an array of Canvases containing the rendered images.
Parameters
- width
- the width in pixels of the output canvas. If not provided uses the camera.
- height
- the height in pixels of the output canvas. If not provided uses the camera.
- canvas_definitions
- an array of canvas definitions to be rendered. Each, must contain properties name, pixel_type and content. The content property is a Canvas_parameters object which contains a type and params property.
Returns
an array of canvases containing the rendered images.
- Canvas Render_context.render_to_canvases( Scene scene, String renderer, Number width, Number height, Canvas_definition[] canvas_definitions, Object options) [static]
-
Renders and returns an array of Canvases containing the rendered images using an anonymous render context.
Parameters
- scene
- the scene to render.
- renderer
- name of the renderer to be used
- width
- the width in pixels of the output canvas. If not provided uses the camera.
- height
- the height in pixels of the output canvas. If not provided uses the camera.
- canvas_definitions
- an array of canvas definitions to be rendered. Each, must contain properties name, pixel_type and content. The content property is a Canvas_parameters object which contains a type and params property.
- options
- render context options to be passed to the rendering.
Returns
an array of canvases containing the rendered images.
- Render_context.render_to_disk( String filename, String format, String pixel_type, String quality, Canvas_definition canvas_definition)
-
Renders and encodes an image which is then saved to disk.
Parameters
- filename
- the file name including path within content root to save the image to. The file must be within the content root directory. A relative path will automatically be resolved within the content root. An absolute path must terminate within the content root or else save will fail. A file URI (file://) may be used instead of a filename in which case the path will always be interpreted as relative to content root.
- format
- the image format for the encoded data.
- pixel_type
- the pixel type of the encoded image.
- quality
- quality of the encoded image if the chosen format supports variable quality.
- canvas_definition
- the definition of the canvas to be rendered. Must contain properties name, pixel_type and content. The content property is a Canvas_parameters object which contains a type and params property.
- Render_context.render_to_disk( Scene scene, String filename, String renderer, String format, String pixel_type, String quality, Canvas_definition canvas_definition, Object options) [static]
-
Renders and encodes an image which is then saved to disk using an anonymous render context.
Parameters
- scene
- the scene to render.
- filename
- the file name including path within content root to save the image to. The file must be within the content root directory. A relative path will automatically be resolved within the content root. An absolute path must terminate within the content root or else save will fail. A file URI (file://) may be used instead of a filename in which case the path will always be interpreted as relative to content root.
- renderer
- name of the renderer to be used
- format
- the image format for the encoded data.
- pixel_type
- the pixel type of the encoded image.
- quality
- quality of the encoded image if the chosen format supports variable quality.
- canvas_definition
- the definition of the canvas to be rendered. Must contain properties name, pixel_type and content. The content property is a Canvas_parameters object which contains a type and params property.
- options
- render context options to be passed to the rendering.
- Render_context.set_option( String key, Data value, String type)
-
Sets a single render context option.
Parameters
- key
- the name option to set.
- value
- the value to set the render context option to.
- type
- the type that the value needs to be. eg: "Sint32", "String", etc.
- Render_context.set_options( Object options)
-
Sets a one or more render context options.
Parameters
- options
- the map of options to set. The value must be another map that contains the type and the value. eg: {"type": "Sint32", "value": 32}
Properties
- bool Render_context.exists
-
Returns whether the render context exists or not.
- Number Render_context.last_result
-
The numeric result of the last render. Read only.
- String Render_context.name
-
The name of the render context. Read only.
- String Render_context.renderer
-
The renderer used by the render context. Read only.
- Scene Render_context.scene
-
The scene associated with the render context. Read only.
- Scope Render_context.scope
-
The scope in which the render context was created. Read only.
- Number Render_context.timeout
-
The timeout in seconds after which the render context will expire. Read only.