void PerspectiveRangeCamera::setupLens() { PointerTo<Lens> lens = new PerspectiveLens(); lens->set_near_far(rangeLimits[0], rangeLimits[1]); lens->set_fov(fov[0]*180.0/M_PI, fov[1]*180.0/M_PI); setupCamera(lens); set_hpr(angles[0]*180.0/M_PI-90.0, angles[1]*180.0/M_PI, 0.0); }
void ImageSensor::setupCamera() { PointerTo<GraphicsOutput> window = Morsel::getWindow(0); colorBuffer = window->make_texture_buffer("ColorMap", resolution[0], resolution[1], &colorMap, true); PointerTo<Lens> lens = new PerspectiveLens(); lens->set_near_far(rangeLimits[0], rangeLimits[1]); lens->set_view_vector(1.0, 0.0, 0.0, 0.0, 0.0, 1.0); lens->set_film_size(filmSize[0], filmSize[1]); lens->set_focal_length(focalLength); cameraNode = new Camera("Camera"); cameraNode->set_camera_mask(cameraMask); cameraNode->set_scene(Morsel::getGSG()->get_scene()->get_scene_root()); camera = attach_new_node(cameraNode); cameraNode->set_lens(lens); PointerTo<DisplayRegion> drc = colorBuffer->make_display_region(); drc->set_sort(0); drc->set_camera(camera); }