Using 3D space guides
We will try to use built-in Cinder methods to visualize some basic information about the scene we are working on. It should make working with 3D space more comfortable.
Getting ready
We will need the MayaCamUI
navigation that we have implemented in the previous recipe.
How to do it...
We will draw some objects that will help to visualize and find the orientation of a 3D scene.
We will add another camera besides
MayaCamUI
. Let's start by adding member declarations to the main class:CameraPersp mSceneCam; int mCurrentCamera;
Then we will set the initial values inside the
setup
method:mCurrentCamera = 0; mSceneCam.setEyePoint(Vec3f(0.f, 5.f, 10.f)); mSceneCam.setViewDirection(Vec3f(0.f, 0.f, -1.f) ); mSceneCam.setPerspective(45.0f, getWindowAspectRatio(), 0.1, 20);
We have to update the aspect ratio of
mSceneCamera
inside theresize
method:mSceneCam.setAspectRatio(getWindowAspectRatio());
Now we will implement the
keyDown
method that will switch between two...