vr.canvas

Create virtual reality canvas object

Syntax

c = vr.canvas(vrworld)
c = vr.canvas(vrworld, parent)
c = vr.canvas(vrworld, parent, position)
c = vr.canvas(world, 'propertyName', propertyValue,...)

Description

c = vr.canvas(vrworld) creates a MATLAB® figure containing a virtual reality canvas that shows the specified virtual reality world. It returns a virtual reality canvas object.

c = vr.canvas(vrworld, parent) creates a virtual reality canvas that shows the specified virtual world in the figure specified in parent. It returns a virtual reality canvas object.

c = vr.canvas(vrworld, parent, position) creates a virtual reality canvas object that shows the specified virtual world in the figure specified in parent at position, specified in pixels. It returns a virtual reality canvas object.

c = vr.canvas(world, 'propertyName', propertyValue,...) creates a virtual reality canvas that shows the specified world with specified properties. See Property Summary for a list of the properties and their values.

Method Summary

MethodDescription
vr.canvas/capture

Capture virtual reality canvas to RGB image

Property Summary

PropertyValuesDescription
Antialiasing

'off' | 'on'

Default: 'off'

Determines whether antialiasing is used when rendering the scene. Antialiasing smooths textures by interpolating values between texture points. This property causes a significant CPU load, but the resulting scene looks more natural. Read/write.

CameraBound

'off' | 'on'

Default: 'on'

Controls whether or not the camera moves with the current viewpoint. When the camera is bound, its position, direction, and up vector are relative to the viewpoint. For unbound camera, these values are absolute. Read/write.

CameraDirection

Vector of three doubles

Specifies the camera direction relative to the direction of the current viewpoint. Read/write.

CameraDirectionAbs

Vector of three doubles

Specifies the camera direction in world coordinates. Read only.

CameraPosition

Vector of three doubles

Specifies the camera position relative to the position of the current viewpoint. Read/write.

CameraPositionAbs

Vector of three doubles

Specifies the camera position in world coordinates. Read only.

CameraUpVector

Vector of three doubles

Specifies the camera up vector relative to the up vector of the current viewpoint. Read/write.

CameraUpVectorAbs

Vector of three doubles

Specifies the camera up vector in world coordinates. Read only.

DeleteFcn

String

Specifies the callback invoked when closing the vr.canvas object. Read/write.

Headlight

'off' | 'on'

Default: 'on'

Turns the headlight on or off. Read/write. Specifies whether headlight is enabled. The headlight is an additional white directional light that moves and rotates with the camera.

Lighting

'off' | 'on'

Default: 'on'

Specifies whether the lighting is taken into account when rendering. If it is off, all the objects are drawn as if uniformly lit. Read/write.

MaxTextureSize

'auto' | 32 <= x <= video card limit, where x is a power of 2 (video card limit is typically 1024 or 2048)

Sets the maximum pixel size of a texture used in rendering vr.canvas objects. The value must be a power of two and may be further adjusted to match specific hardware renderer limits. The smaller the size, the faster the texture can render. Increasing this value improves image quality but decreases performance. A value of 'auto' sets the maximum possible pixel size.

NavMode

'fly' | 'examine' | 'walk' |'none'

Default: 'fly'

Specifies the current navigation mode.

NavPanel
  • 'none'

    Panel is not visible.

  • 'minimized'

    Panel is minimized.

  • 'translucent'

    Panel floats half transparently above the scene.

  • 'opaque'

    Panel floats above the scene.

Default: 'none'

Controls the appearance of the control panel in the vr.canvas object.

NavSpeed

'veryslow' | 'slow' | 'normal' | 'fast' | 'veryfast'

Default: 'normal'

Specifies navigation speed. Read/write.

NavZones

'off' | 'on'

Default: 'off'

Toggles navigation zones on/off. Read/write.

Parent

Double

Specifies handle of parent of this virtual reality canvas. Read-only.

Position

Vector of four doubles

Specifies screen coordinates of this virtual reality canvas.

Textures

'off' | 'on'

Default: 'on'

Turns texture rendering on or off. Read/write.

Tooltips

'off' | 'on'

Default: 'on'

Displays tooltips for navigation panel

Transparency

'off' | 'on'

Default: 'on'

Specifies whether or not transparency information is taken into account when rendering. If it is off, all objects are drawn opaque. Read/write.

Triad
  • 'none'

    Triad is not visible.

  • 'topleft'

    Triad is shown in top-left corner

  • 'topright'

    Triad is shown in top-right corner

  • 'bottomleft'

    Triad is shown in bottom-left corner

  • 'bottomright'

    Triad is shown in bottom-right corner

  • 'center'

    Triad is shown in the center

Default: 'bottomleft'

Displays coordinate axes triad in the 3D World Editor virtual world display pane.

Units

'pixels' | 'normalized'

Specifies the units to interpret the Position property. The DefaultCanvasUnits preference controls the default for this property. Read/write

Viewpoint

String.

If active viewpoint does not have a name, value is empty.

Specifies the vr.canvas object's active viewpoint. This value is an empty string if the active viewpoint has no description. Read/write.

Wireframe

'off' | 'on'

Default: 'off'

Specifies whether objects are drawn as solids or wireframes. Read/write.

World

vrworld object

Specifies the world this vr.canvas object is displaying. Read only.

ZoomFactor

Double

Default: 1

Specifies the camera zoom factor. Read/write.

A zoom factor of 2 makes the scene look twice as big. A zoom factor of 0.1 makes it look 10 times smaller, and so forth.

Tips

You can include a vr.canvas object as a child object in a MATLAB uipanel object. Panels arrange graphical user interface components into groups. By visually grouping related controls, panels can make the user interface easier to understand. A panel can have a title and various borders.

For example, the following code places the vrlights virtual world in a panel.

pf = figure;
pp1 = uipanel('Parent',pf);
pp1.Title = 'Panel with Title';
w = vrworld('vrlights.wrl');
open(w);
c = vr.canvas(w,pp1);

See Also

Was this topic helpful?