V8 Javascript API

Camera Class Reference

[Elements]

Description

Represents a camera

Constructor

 Camera( String name, bool create, number privacy_level)
More...

Functions

varying as( String type_name)
Upcasts an element to a specific element type. More...
the copy( String name, Number privacy_level)
Make a copy of this element in the database. More...
 create( String element_type, Number privacy_level)
Creates a scene element called name. More...
 delete()
Remove this element from the database.
bool  exists( String element_type)
Returns whether the element exists or not. More...
 localize( Number privacy_level)
Localizes this element. More...
varying property_get( String cache, String command, String element_name_arg, Function as_a)
Retrieves and caches a property of an element. More...
 property_set( String cache, String command, String element_name_arg, String value_arg_name, varying value, Function from_a)
Sets and caches a property of an element. More...
 set_material( String material, bool override)
Sets the material and, optionally, material override on this element. More...

Properties

Number  aperture
The aperture width of the camera.
Number  aspect
Camera resolution aspect ratio.
Attributes attributes
The attributes associated with this element.
RS.​Math.​Color backplate_background_color
Background color which replaces the environment for direct visibility. More...
Boolean  backplate_dof_enabled
Whether the backplate, if enabled is affected by depth of field.
Mdl_function_call backplate_function
MDL function to be called to evaluate the backplate.
Boolean  backplate_lens_effects_enabled
Whether the backplate, if enabled is affected by lens effects.
Boolean  backplate_tonemapping_enabled
Whether the backplate, if enabled is affected by tonemapping.
Number  clip_max
The far clipping distance.
Number  clip_min
The near clipping distance.
bool  disable
Set to true to disable the element and all elements below this in the scene graph. More...
bool  exists
Returns whether the camera exists or not. More...
Number  focal
The focal length of the camera.
Number  frame_time
The render frame time.
bool  hide
Alias for disable.
Array  irradiance_probes
Irradiance probes for measurement of irradiance at specific points in specific directions.
Mdl_material_instance[] material
The material to use for this element. More...
String  material_override
The override attribute for the material. More...
String  name
The name of the element. More...
bool  orthographic
Whether the camera is orthographic (true) or perspective.
Object  plane_shift
The plane shift of the camera. More...
Object  resolution
Camera resolution, the x property gives the width, y is the height.
Number  resolution_x
Camera resolution width.
Number  resolution_y
Camera resolution height.
Object  sub_window
The sub window within the camera resolution to render. More...
String  type_name
The type name of the element. More...

Constructor

Camera( String name, bool create, number privacy_level)

Parameters

name
The name of the camera
create
if true then create the camera, otherwise it is assumed it already exists
privacy_level
if create is true then the privacy level to create the camera at. Defaults to privacy level of the current scope.

Functions

varying Camera.as( String type_name)

Upcasts an element to a specific element type. If this element is not of the given type then undefined is returned. If type_name does not have a matching element implementation an error is thrown. Note that this is not strictly an upcast but will return a new instance of the specific class representing type_name.

Parameters

type_name
the element type name to convert to.

Returns

the specific Element implementation for this element.

the Camera.copy( String name, Number privacy_level)

Make a copy of this element in the database.

Parameters

name
The name of the new element to copy to.
privacy_level
The privacy level to which the element will be copied. Defaults to the privacy level of the current scope.

Returns

copied element

Camera.create( String element_type, Number privacy_level)

Creates a scene element called name. Throws on error.

Parameters

element_type
the type of element to create
privacy_level
The privacy level to create the element at. Defaults to the privacy level of the current scope.
Camera.delete()

Remove this element from the database.

bool Camera.exists( String element_type)

Returns whether the element exists or not.

Note:

element_type of 'Scene' is not supported. To test if a Scene exists use this.as('Scene') !== undefined

Parameters

element_type
if provided then the element must also be of this type.
Camera.localize( Number privacy_level)

Localizes this element.

Parameters

privacy_level
The privacy level to which the element will be localized. Defaults to the privacy level of the current scope.
varying Camera.property_get( String cache, String command, String element_name_arg, Function as_a)

Retrieves and caches a property of an element. The value of the property must be retrievable via a command that takes a single argument which is the name of the element to retrieve the property from. The name of this Element is used. If the returned property is another named scene Element then the element's constructor can be provided to return the element itself rather than it's name. On error this will return undefined.

Parameters

cache
name of the property to cache the result to
command
name of the RS command to get the property value
element_name_arg
name of the command argument to use for the element name
as_a
if the property being retrieved is an RS Element then the element constructor should be passed in here. The result of the command is assumed to be the element name and this is used to create an Element instance to return rather than the name of the element. Use undefined if the retrieved value is not an element.

Returns

the property value if it exists or undefined

Camera.property_set( String cache, String command, String element_name_arg, String value_arg_name, varying value, Function from_a)

Sets and caches a property of an element. The value of the property must be set via a command that takes two arguments, one being the name of the element to set and the other being the property's value. The names of these arguments are passed in. If the property is another named scene Element then the element's constructor can be provided and value can either be the element itself or it's name. Will throw on error.

Parameters

cache
name of the property to cache the result to
command
name of the RS command to set the property value
element_name_arg
name of the command argument to use for the element name
value_arg_name
name of the value argument to use for the value
value
the value to set
from_a
if the property being set is a RealityServer Element then the element constructor should be passed in here. value can then either be the name of the scene element or the Element itself. If value is a name then an Element is constructed and cache rather than the name itself. Use undefined if the value does not represent an Element .
Camera.set_material( String material, bool override)

Sets the material and, optionally, material override on this element.

Parameters

material
the material to set, see Element_scene_graph.material
override
if defined then sets override on the material, see Element_scene_graph.material_override

Properties

Number Camera.aperture

The aperture width of the camera.

Number Camera.aspect

Camera resolution aspect ratio.

Attributes Camera.attributes

The attributes associated with this element.

RS.​Math.​Color Camera.backplate_background_color

Background color which replaces the environment for direct visibility. Set all components to -1 to remove

Boolean Camera.backplate_dof_enabled

Whether the backplate, if enabled is affected by depth of field.

Mdl_function_call Camera.backplate_function

MDL function to be called to evaluate the backplate.

Boolean Camera.backplate_lens_effects_enabled

Whether the backplate, if enabled is affected by lens effects.

Boolean Camera.backplate_tonemapping_enabled

Whether the backplate, if enabled is affected by tonemapping.

Number Camera.clip_max

The far clipping distance.

Number Camera.clip_min

The near clipping distance.

bool Camera.disable

Set to true to disable the element and all elements below this in the scene graph. Set to false to show again or undefined to remove the disable attribute completely.

bool Camera.exists

Returns whether the camera exists or not. This test is type checked.

Number Camera.focal

The focal length of the camera.

Number Camera.frame_time

The render frame time.

bool Camera.hide

Alias for disable.

Array Camera.irradiance_probes

Irradiance probes for measurement of irradiance at specific points in specific directions.

Mdl_material_instance[] Camera.material

The material to use for this element. When setting can supply either a String giving the name of the material to use or a Mdl_material_instance . Arrays of these can also be used. Note that single values will always be converted to arrays when setting. Getting always returns an array of Mdl_material_instance .

String Camera.material_override

The override attribute for the material. Accepts the strings override or standard as valid values. Truthy non-string values will be interpreted as override, otherwise standard.

String Camera.name

The name of the element. Read only.

bool Camera.orthographic

Whether the camera is orthographic (true) or perspective.

Object Camera.plane_shift

The plane shift of the camera. The x property gives the horizontal plane shift in pixels, y is the vertical

Object Camera.resolution

Camera resolution, the x property gives the width, y is the height.

Number Camera.resolution_x

Camera resolution width.

Number Camera.resolution_y

Camera resolution height.

Object Camera.sub_window

The sub window within the camera resolution to render. The xl property is left edge, yl is lower edge, xh is right edge, yh is top edge.

String Camera.type_name

The type name of the element. If the element does not exists returns undefined. Read only.

Note:

For a Scene element this will return 'Attribute_container', not 'Scene'.