/************************************** Here are the constructors. ***************************************/ Camera::Camera(){ setEyeX(0.0); setEyeY(0.0); setEyeZ(0.0); setCenterX(0.0); setCenterY(0.0); setCenterZ(0.0); setUpX(0.0); setUpY(0.0); setUpZ(0.0); setFovy(0.0); setAspect(0.0); setZNear(0.0); setZFar(0.0); mouseDirection[0] = 0; mouseDirection[1] = 1; mouseDirection[2] = 0; glMatrixMode(GL_MODELVIEW); move[0] = false; move[1] = false; move[2] = false; move[3] = false; }
Postprocessing::Postprocessing(gloperate::ResourceManager & resourceManager, const reflectionzeug::Variant & pluginInfo) : PipelinePainter("Postprocessing", resourceManager, pluginInfo, m_pipeline) , m_animation(true) { // Setup painter auto targetFBO = addCapability(new gloperate::TargetFramebufferCapability()); auto viewport = addCapability(new gloperate::ViewportCapability()); auto time = addCapability(new gloperate::VirtualTimeCapability()); auto camera = addCapability(new gloperate::CameraCapability()); auto projection = addCapability(new gloperate::PerspectiveProjectionCapability(viewport)); auto renderTargets = addCapability(new gloperate::TypedRenderTargetCapability()); m_pipeline.targetFBO.setData(targetFBO); m_pipeline.viewport.setData(viewport); m_pipeline.time.setData(time); m_pipeline.camera.setData(camera); m_pipeline.projection.setData(projection); m_pipeline.renderTargets.setData(renderTargets); targetFBO->changed.connect([this]() { m_pipeline.targetFBO.invalidate(); }); viewport->changed.connect([this]() { m_pipeline.viewport.invalidate(); }); time->changed.connect([this]() { m_pipeline.time.invalidate(); }); projection->setZNear(0.1f); projection->setZFar(16.f); time->setLoopDuration(glm::pi<float>() * 2); // Register properties addProperty<bool>("Animation", this, &Postprocessing::animation, &Postprocessing::setAnimation); }
Camera::Camera(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX,double upY,double upZ, double fovy, double aspect, double zNear, double zFar){ setEyeX(eyeX); setEyeY(eyeY); setEyeZ(eyeZ); setCenterX(centerX); setCenterY(centerY); setCenterZ(centerZ); setUpX(upX); setUpY(upY); setUpZ(upZ); setFovy(fovy); setAspect(aspect); setZNear(zNear); setZFar(zFar); mouseDirection[0] = 0; mouseDirection[1] = 90; mouseDirection[2] = 0; glMatrixMode(GL_MODELVIEW); move[0] = false; move[1] = false; move[2] = false; move[3] = false; }
void Camera::setOptionalsToDefaults() { GeometricalTransformation::setOptionalsToDefaults(); ProjectionTransformation::setOptionalsToDefaults(); setScissor( vgm::Rectangle2i(0, 0, 1600, 1200) ); setAspect( (1) ); setZNear( (0.01f) ); setZFar( (3996.f) ); }
Camera::Camera(int ID, string ids, GLfloat* pos, GLfloat znear, GLfloat zfar) : Ref(ID,ids) { setPos(pos); setZNear(znear); setZFar(zfar); rotation[0] = 0; rotation[1] = 0; rotation[2] = 0; setExamineMode(); }
void Camera::setPerspective(double fovy,double aspect,double zNear,double zFar){ glLoadIdentity(); glEnable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glMatrixMode(GL_MODELVIEW); setFovy(fovy); setAspect(aspect); setZNear(zNear); setZFar(zFar); }
void Camera::Render(Renderer *renderer) { // Reset projection projection.setToIdentity(); // Set near plane to 3.0, far plane to 7.0, field of view 45 degrees //const qreal zNear = 3.0, zFar = 7.0, fov = 45.0; setZNear(3.0); setZFar(7.0); // Set perspective projection projection.perspective(angle, ratio, zNear, zFar); renderer->setProjection(projection); for (auto it=_children.begin();it!=_children.end();++it) { (*it)->RenderTree(renderer); } }