Open one of your favorite 3D scene editors, such as 3DS Max, Maya, Blender 3D, and so on. Most of them should default to four views: the top view, side view, front view, and a fourth perspective view. You may change the first three to display the scene from the top, left, right, front, back, or bottom side, which brings great convenience for editors to watch and alter 3D models.
Carry out the following steps in order to complete this recipe:
1. Include necessary headers:
#include <osg/Camera> #include <osgDB/ReadFile> #include <osgGA/TrackballManipulator> #include <osgViewer/CompositeViewer>
2. The
create2DView()
function will be used for creating top, left, and side views of the scene. Set up the view to look at a specific direction but keep it focused on the scene node, and also configure the perspective projection matrix according to the window size:osgViewer::View* create2DView( int x, int y, int width...