SimLocator::SimLocator() { debug(LOG_DEBUG, DEBUG_LOG, 0, "create SimLocator"); _camera = CameraPtr(new SimCamera(*this)); debug(LOG_DEBUG, DEBUG_LOG, 0, "camera: %s", _camera->name().toString().c_str()); _ccd = CcdPtr(new SimCcd(_camera->getCcdInfo(0), *this)); debug(LOG_DEBUG, DEBUG_LOG, 0, "ccd: %s", _ccd->name().toString().c_str()); _guiderport = GuiderPortPtr(new SimGuiderPort(*this)); debug(LOG_DEBUG, DEBUG_LOG, 0, "guiderport: %s", _guiderport->name().toString().c_str()); _filterwheel = FilterWheelPtr(new SimFilterWheel(*this)); debug(LOG_DEBUG, DEBUG_LOG, 0, "filterwheel: %s", _filterwheel->name().toString().c_str()); _cooler = CoolerPtr(new SimCooler(*this)); debug(LOG_DEBUG, DEBUG_LOG, 0, "cooler: %s", _cooler->name().toString().c_str()); _focuser = FocuserPtr(new SimFocuser(*this)); debug(LOG_DEBUG, DEBUG_LOG, 0, "focuser: %s", _focuser->name().toString().c_str()); _mount = astro::device::MountPtr(new SimMount(*this)); debug(LOG_DEBUG, DEBUG_LOG, 0, "mount: %s", _mount->name().toString().c_str()); debug(LOG_DEBUG, DEBUG_LOG, 0, "SimLocator created"); }
GraphicsView::GraphicsView(std::unique_ptr<GraphicsDriver> driver) : driver_(std::move(driver)) { initialized_ = false; renderer3D_ = std::move(std::unique_ptr<Renderer3D>(new Renderer3D(this))); renderer2D_ = std::move(std::unique_ptr<Renderer2D>(new Renderer2D(this))); textRenderer_ = std::move(std::unique_ptr<TextRenderer>(new TextRenderer(this))); mouseEvent_ = std::move(std::unique_ptr<MouseEvent>(new MouseEvent)); wheelEvent_ = std::move(std::unique_ptr<WheelEvent>(new WheelEvent)); keyEvent_ = std::move(std::unique_ptr<KeyEvent>(new KeyEvent)); graphicsItemMouseEvent_ = std::move(std::unique_ptr<GraphicsItemMouseEvent>(new GraphicsItemMouseEvent)); graphicsItemHoverEvent_ = std::move(std::unique_ptr<GraphicsItemHoverEvent>(new GraphicsItemHoverEvent)); graphicsItemSelectEvent_ = std::move(std::unique_ptr<GraphicsItemSelectEvent>(new GraphicsItemSelectEvent)); camera_ = CameraPtr(new StandardCamera); frameRate_ = 30; perspectiveFovy_ = 45; perspectiveZnear_ = 0.01; perspectiveZfar_ = 100; float perspectiveFovy_; // 縦の視野角を”度”単位 float perspectiveZnear_; // 一番近いZ位置 float perspectiveZfar_; // 一番遠いZ位置 backgroundColor_ = {{0.8, 0.8, 0.8, 1.0}}; }
void CameraNode::disconnect(bool bKill) { if (bKill) { m_pCamera = CameraPtr(); } RasterNode::disconnect(bKill); }
/** * \brief Construct a camera from a camera description * * \param name Name of the camera * \return Camera with that name */ CameraPtr QhyCameraLocator::getCamera0(const DeviceName& name) { QhyName qhyname(name); if (!qhyname.isCamera(name)) { std::string msg = stringprintf("%s is not a Camera name", name.toString().c_str()); debug(LOG_ERR, DEBUG_LOG, 0, "%s", msg.c_str()); throw std::runtime_error(msg); } // scan the devices and get std::vector<usb::DevicePtr> d = context.devices(); std::vector<usb::DevicePtr>::const_iterator i; for (i = d.begin(); i != d.end(); i++) { usb::DevicePtr dptr = *i; int busnumber = dptr->getBusNumber(); int deviceaddress = dptr->getDeviceAddress(); if ((busnumber == qhyname.busnumber()) && (deviceaddress == qhyname.deviceaddress())) { dptr->open(); return CameraPtr(new QhyCamera(dptr)); } } // failure to construct the camera std::string msg = stringprintf("cannot create camera from '%s'", name.toString().c_str()); throw std::runtime_error(msg); }
// // Prints out all features and their values and details of a given camera. // If no camera ID is provided, the first camera will be used. // Starts and stops the API // Opens and closes the camera // // Parameters: // [in] CameraID The ID of the camera to work // void ListFeatures::Print( std::string CameraID ) { VimbaSystem& sys = VimbaSystem::GetInstance(); // Get a reference to the VimbaSystem singleton std::cout << "Vimba Version V" << sys << "\n"; // Print out version of Vimba VmbErrorType err = sys.Startup(); // Initialize the Vimba API FeaturePtrVector features; // A vector of std::shared_ptr<AVT::VmbAPI::Feature> objects CameraPtr pCamera = CameraPtr(); // Our camera std::stringstream strError; if( VmbErrorSuccess == err ) { if( CameraID.empty() ) // If no ID was provided use the first camera { CameraPtrVector cameras; err = sys.GetCameras( cameras ); if( VmbErrorSuccess == err && !cameras.empty() ) { err = cameras[0]->Open( VmbAccessModeFull ); // Open the camera if( VmbErrorSuccess == err ) { pCamera = cameras[0]; err = pCamera->GetID( CameraID ); } } } else { err = sys.OpenCameraByID( CameraID.c_str(), VmbAccessModeFull, pCamera ); // Get and open the camera } if( NULL != pCamera ) { std::cout << "Printing all features of camera with ID: " << CameraID << "\n"; err = pCamera->GetFeatures( features ); // Fetch all features of our cam if( VmbErrorSuccess == err ) { // Query all static details as well as the value of all fetched features and print them out. std::for_each( features.begin(), features.end(), PrintFeatures ); } else { std::cout << "Could not get features. Error code: " << err << " (" << AVT::VmbAPI::Examples::ErrorCodeToMessage( err ) << ")" << "\n"; } pCamera->Close(); } else { std::cout << "Could not open camera or no camera available. Error code: " << err << " (" << AVT::VmbAPI::Examples::ErrorCodeToMessage( err ) << ")" << "\n"; } sys.Shutdown(); } else { std::cout << "Could not start system. Error code: " << err << " (" << AVT::VmbAPI::Examples::ErrorCodeToMessage( err ) << ")" << "\n"; } }
// // constructor // OrbitNavigator::OrbitNavigator() { // init local stuff m_lookAt = math::Vec3f( 0.0f, 0.0f, 0.0f ); m_azimuth = m_elevation = 0.0f; m_distance = 0.5f; m_camera = CameraPtr(new Camera()); update(); }
CameraPtr GameEngine::CreateCamera() { CameraPtr tmp = CameraPtr(new Camera()); _objects[tmp->GetGuid()] = tmp; if (!_mainCamera) { _mainCamera = tmp; } return tmp; }
CameraPtr DefaultCameraFactory::CreateCamera( const char *pCameraID, const char *pCameraName, const char *pCameraModel, const char *pCameraSerialNumber, const char *pInterfaceID, VmbInterfaceType eInterfaceType, const char * /*pInterfaceName*/, const char * /*pInterfaceSerialNumber*/, VmbAccessModeType /*interfacePermittedAccess*/ ) { return CameraPtr( new Camera( pCameraID, pCameraName, pCameraModel, pCameraSerialNumber, pInterfaceID, eInterfaceType )); }
void TrackerThread::deinit() { m_pCamera = CameraPtr(); AVG_TRACE(Logger::category::PROFILE, Logger::severity::INFO, "Total camera frames: " << m_NumFrames); AVG_TRACE(Logger::category::PROFILE, Logger::severity::INFO, "Camera frames discarded: " << m_NumCamFramesDiscarded); if (m_pBandpassFilter) { m_pBandpassFilter.reset(); } if (m_pImagingContext) { delete m_pImagingContext; } }
/** * \brief Get a camera by name * * This works by retrieving a list of cameras and the checking which number * has the right name. This index is then used to retreive the camera object * by number. * \param name name of the camera */ CameraPtr AsiCameraLocator::getCamera0(const DeviceName& name) { std::string sname = name; debug(LOG_DEBUG, DEBUG_LOG, 0, "locate camera %s", sname.c_str()); std::vector<std::string> cameras = getDevicelist(); std::vector<std::string>::const_iterator i; size_t index = 0; for (i = cameras.begin(); i != cameras.end(); i++, index++) { if (name == *i) { return CameraPtr(new AsiCamera(index)); } } std::string msg = stringprintf("camera %s not found", sname.c_str()); debug(LOG_ERR, DEBUG_LOG, 0, "%s", msg.c_str()); throw std::runtime_error(msg); }
CameraPtr POVRayParser::ParseCamera(const std::string& inputText) { glm::vec3 posVec, upVec, rightVec, lookAtVec; std::string token; std::istringstream tokens(inputText); while (std::getline(tokens, token, ' ')) { if (token.find("location") != std::string::npos) posVec = ParseVec3FromStream(tokens); else if (token.find("up") != std::string::npos) upVec = ParseVec3FromStream(tokens); else if (token.find("right") != std::string::npos) rightVec = ParseVec3FromStream(tokens); else if (token.find("look_at") != std::string::npos) lookAtVec = ParseVec3FromStream(tokens); } return CameraPtr(new Camera(posVec, upVec, rightVec, lookAtVec-posVec)); }
void GLWidget::initializeGL() { connect(context(), &QOpenGLContext::aboutToBeDestroyed, this, &GLWidget::cleanup); m_func = context()->versionFunctions<QOpenGLFunctions_4_3_Core>(); m_func->initializeOpenGLFunctions(); // CLManager::getSingletonPtr()->setSource("bpatch.cl"); m_mainCam = CameraPtr(new Camera(m_swidth, m_sheight)); m_comp = new Compositer(m_func, m_swidth, m_sheight); m_func->glClearColor(0, 0, 0, 1); m_phong = MaterialPtr(new Material(m_func)); m_phong->setShader("res/shaders/shader.vert", "res/shaders/shader.frag"); m_phong->shader()->setUniformValue("lightPos", QVector3D(0, 0, 70)); cube = new Model(m_func); cube->initWithName("res/models/toonface.obj"); cube->setMaterial(m_phong); cube->setCamera(m_mainCam); QVector3D cam_trans(0,1,0); m_mainCam->translate(cam_trans); SamplerPtr sampler(new Sampler(m_func)); sampler->create(); sampler->setMinFilter(GL_LINEAR); sampler->setMaxFilter(GL_LINEAR); sampler->setWrapMode(Sampler::S, GL_CLAMP_TO_EDGE); sampler->setWrapMode(Sampler::T, GL_CLAMP_TO_EDGE); QImage diffuseImg("res/textures/face.dds"); m_func->glActiveTexture(GL_TEXTURE0); TexturePtr diffuseMap(new Texture(m_func)); diffuseMap->create(); diffuseMap->bind(); diffuseMap->initializeWithImage(diffuseImg); m_phong->setTextureUnitConfiguration(0, diffuseMap, sampler, QByteArrayLiteral("textureSampler")); }
// Set up the scene void InitializeScene() { scene.objects.clear(); // Create a camera auto camera = CameraPtr(new Camera{ 60.0f, 1.0f, 0.1f, 100.0f}); camera->position.z = -15.0f; scene.camera = camera; // Add space background auto space = SpacePtr(new Space{}); scene.objects.push_back(space); // Add generator to scene auto generator = GeneratorPtr(new Generator{}); generator->position.y = 10.0f; scene.objects.push_back(generator); // Add player to the scene auto player = PlayerPtr(new Player{}); player->position.y = -6; scene.objects.push_back(player); }
/** * \brief Construct a camera from a camera description * * \param name Name of the camera * \return Camera with that name */ CameraPtr SxCameraLocator::getCamera0(const DeviceName& name) { std::string sname = name.unitname(); debug(LOG_DEBUG, DEBUG_LOG, 0, "analyzing '%s'", sname.c_str()); // parse the name string int busnumber = 0, deviceaddress = 0; sxparse(sname, busnumber, deviceaddress); debug(LOG_DEBUG, DEBUG_LOG, 0, "looking for busnumber=%d, deviceaddress=%d", busnumber, deviceaddress); // find the device with this bus number and address std::vector<DevicePtr> d = context.devices(); std::vector<DevicePtr>::const_iterator i; for (i = d.begin(); i != d.end(); i++) { DevicePtr dptr = (*i); if ((dptr->getBusNumber() == busnumber) && (dptr->getDeviceAddress() == deviceaddress)) { debug(LOG_DEBUG, DEBUG_LOG, 0, "found matching device"); dptr->open(); return CameraPtr(new SxCamera(dptr)); } } throw SxError("cannot create a camera from a name"); }
void GameState::init() { IState::init(); entity_form_manager_.setRenderTarget(renderTarget_); //TODO: Test EntityPtr unit = EntityFactory::Inst().createUnit(531); // entity_manager_.add(unit); // entity_form_manager_.createForms(unit); //Map test map_ = MapPtr(new Map()); if (scenario_.get()) map_->create(scenario_->map); else map_->setUpSample(); camera_ = CameraPtr(new Camera()); mapRenderer_.setRenderTarget(renderTarget_); mapRenderer_.setMap(map_); mapRenderer_.setCamera(camera_); /* EntityForm form; comp::GraphicPtr g = comp::Graphic::create(881); form.addComponent(comp::GRAPHIC, g); entity_form_manager_.add(form); */ //------------- /* game_server_ = new GameServer(); game_client_ = new GameClient(); game_client_->setGameRenderer(game_renderer_); // Creating local connection LocalTunnelToServer *tToServ = new LocalTunnelToServer(); LocalTunnelToClient *tToClient = new LocalTunnelToClient(); tToServ->setServer(tToClient); tToClient->setClient(tToServ); game_server_->addClient(tToClient); game_client_->setServer(tToServ); //Test game_client_->test(); */ }
CameraNode::~CameraNode() { m_pCamera = CameraPtr(); }
void SceneManager::initCamera(GLFWwindow *window, InputManager *inputManager) { this->camera = CameraPtr(new ThirdPersonCamera(mainCharacter, window, inputManager)); }
ViewWindow::ViewWindow(const int width, const int height) { camera_ = CameraPtr(); setSize(width, height); }
static CameraPtr createInstance(T&& ... args) { return CameraPtr(new Camera(std::forward<T>(args)...)); }
CameraPtr Camera::clone() const { return CameraPtr(new Camera(*this)); }