Camera::Camera(){ oldHorizontalAngle = -1; oldVerticalAngle = -1; oldPosition = glm::vec3(-63.65432f); horizontalAngle = 3.14f; verticalAngle = 0.0f; speed = 5.0f; // 3 units / second mouseSpeed = 0.010f; m_target = glm::vec3(0.0f, 0.0f, 1.0f); m_up = glm::vec3(0.0f, 1.0f, 0.0f); m_right = glm::vec3(1.0f, 0.0f, 0.0f); this->fov = 70.f; this->aspect_ratio = static_cast<float>(Config::_WINDOWWIDTH / Config::_WINDOWHEIGHT); this->near_plane = 0.25f; this->far_plane = 4096.f; useMouse = false; m_id.gen(); Pipeline::setProjectionMatrix(glm::perspective(fov, aspect_ratio, near_plane, far_plane)); rebuildView(); cameraMode = CameraMode::CAMERA_FREE_LOOK; }
Camera::Camera(const char* name){ horizontalAngle = 3.14f; verticalAngle = 0.0f; speed = 5.0f; // 3 units / second mouseSpeed = 0.010f; m_target = glm::vec3(0.0f, 0.0f, 1.0f); m_up = glm::vec3(0.0f, 1.0f, 0.0f); float width = (float)Config::_WINDOWWIDTH; float height = (float)Config::_WINDOWHEIGHT; float ratio = (width /height); this->fov = 70.f; this->aspect_ratio = ratio; this->near_plane = 0.25f; this->far_plane = 4096.f; m_id.gen(name); Pipeline::setProjectionMatrix(glm::perspective(fov, this->aspect_ratio, near_plane, far_plane)); rebuildView(); cameraMode = CameraMode::CAMERA_FREE_LOOK; }
void Camera::Scroll(float v) //trollmade { scroll = v / 30; mPosition += D3DXVECTOR3(0, scroll, 0); rebuildView(); }