Camera Setup
Creating a camera is fairly simple in RPR.
Simply create a camera, set its location and direction with rprCameraLookAt(). Please note that in this example we do not specify a camera type, so it defaults to perspective.
An RPR context can have several cameras. The camera attached to the scene with rprSceneSetCamera() will be used for the actual rendering.
// Create a camera
rpr_camera camera = nullptr;
{
CHECK(rprContextCreateCamera(context, &camera));
// Position the camera in world space:
// The camera position is (0,5,20)
// The camera is aimed at (0,0,0)
// The camera up vector is (0,1,0)
CHECK(rprCameraLookAt(camera, 0, 5, 20, 0,0, 0, 0, 1, 0));
// Optional: change the Focal Lenght. Increasing this value creates a "zoom" effect.
CHECK(rprCameraSetFocalLength(camera, 75.f));
// Set a camera for the scene
CHECK(rprSceneSetCamera(scene, camera));
}
Example of creating a camera can be seen in the Basic Scene demo.