Vizard 8 » Reference » Viewpoints & Windows » Viewpoint & Window basics
8.0

Viewpoint & Window Basics

3D scenes are always viewed from a point in space and from a particular orientation. In Vizard, this point is called the "view" or "viewpoint". The viewpoint in Vizard is similar to what other programs would call the camera. When you navigate through a world using a mouse, you're simply moving the position and orientation of your viewpoint. While Vizard provides a default viewpoint, you can add multiple viewpoints.

 

Worlds are rendered in a window. A window can be linked to one viewpoint, or it can toggle back and forth between a number of different viewpoints. When you run a Vizard script, you automatically create the main window. This window, however, can have a number of different sub-windows. Windows have their own set of parameters which determine the world's rendering.

 

For more details, check out the section on viewpoints and the section on windows.

Grabbing and moving the main viewpoint

Use viz.MainView to grab the main view. Once you've got a handle on the main view (or created a new view) you can change it with any of the commands in the <viewpoint> method.  Check out the section on Views to get more specific information.

viz.add('court.ive')
#Grab the main view.
view = viz.MainView
#Use spinto to rotate it back and forth.
vizact.onkeydown( viz.KEY_LEFT, view.runAction, vizact.spinTo(euler=[-90,0,0], time=3) )
vizact.onkeydown( viz.KEY_RIGHT, view.runAction, vizact.spinTo(euler=[90,0,0], time=3) )

Grabbing and changing the main window

Use viz.MainWindow to grab the main window. Once you've got a handle on the main window (or created a sub-window) you can change it with any of the commands in the <window> class.  Check out the section on windows to get more specific information.

#Grab the main window.
window = viz.MainWindow
#Change its background color.
window.clearcolor( 1,0,0)

Adding an additional view with its own window

To create an additional window or view, use viz.addWindow and viz.addView, and then assign the view to the window with the <window>.setView command.

import viz
viz.go()

viz.addChild('court.ive')

#Add a new view.
subView = viz.addView()

#Add a new window.
subWindow = viz.addWindow()

#Set the size and position of the window.
subWindow.setSize([0.5,0.5])
subWindow.setPosition([0,1])

#Assign the new view to the new window.
subWindow.setView( subView )

#Add some rotation actions to the view.
vizact.onkeydown( viz.KEY_LEFT, subView.runAction, vizact.spinTo(euler=[-90,0,0], time=3) )
vizact.onkeydown( viz.KEY_RIGHT, subView.runAction, vizact.spinTo(euler=[90,0,0], time=3) )

See also

In this section:

Perspective rendering

Orthographic lenses

Viewpoint basics

Window basics

Viewpoints & windows command tables

Other sections:

Action Basics

Animation path basics

Application window basics

Example scripts:

Viewpoint camera control

Viewpoint animation

Viewpoint collision

Window views