The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit c908bd58 authored by Jakob Weiss's avatar Jakob Weiss
Browse files

Being anal about warnings

(cherry picked from commit b4033e899e318707a732203584c6aee0d9c178c8)

# Conflicts:
#	modules/stereo/processors/stereocameragenerator.cpp
parent e835e6f7
#include "stereocameragenerator.h"
#include "core/datastructures/cameradata.h"
#include "core/datastructures/scopedtypeddata.h"
namespace campvis {
std::string StereoCameraGenerator::loggerCat_ = "CAMPVis.modules.stereo.StereoCameraGenerator";
StereoCameraGenerator::StereoCameraGenerator()
: AbstractProcessor()
, p_sourceCameraID("SourceCamera", "Source Camera", "camera", DataNameProperty::READ)
, p_baseline("Baseline", "Baseline [cm?]", 6.5f, 0.001f, 100.0f)
{
addProperty(p_sourceCameraID);
addProperty(p_baseline);
}
StereoCameraGenerator::~StereoCameraGenerator()
{
}
void StereoCameraGenerator::init()
{
AbstractProcessor::init();
}
void StereoCameraGenerator::deinit()
{
AbstractProcessor::deinit();
}
void StereoCameraGenerator::updateResult(DataContainer & dataContainer)
{
ScopedTypedData<CameraData> cam(dataContainer, p_sourceCameraID.getValue());
if (cam) {
float eyeSeparation = p_baseline.getValue();
auto camera = cam->getCamera();
auto frust = camera.getFrustum();
auto rightVec = camera.getStrafe();
rightVec *= 0.5f * eyeSeparation;
//-----------------------------------------------------------------------
float focusDistance = focusDistance = camera.getFocalLength();
float farDist = camera.getFarDist();
float nearDist = focusDistance - 0.2f*(farDist - focusDistance);
float ratio = camera.getRatio();
float radians = ratio * cgt::deg2rad(camera.getFovy()) / 2.0f; // half the horizontal field of view in radians
float widthAtNear = nearDist * tan(radians); // wd2
float widthAtFocus = focusDistance * tan(radians);
float tmp = (widthAtFocus - eyeSeparation * 0.5f) * (focusDistance - nearDist) / focusDistance;
float ndfl = nearDist / focusDistance;
float projectionPlaneShift = 0.5f * eyeSeparation * ndfl + cgt::length(rightVec);
//float projectionPlaneShift = (widthAtFocus - widthAtNear - tmp);
float left = frust.getLeft() - projectionPlaneShift;
float right = frust.getRight() - projectionPlaneShift;
float top = frust.getTop();
float bottom = frust.getBottom();
//LDEBUG("Focus Distance for camera.right at " << focusDistance << " left,right at " << left << "," << right << " with a shift of " << projectionPlaneShift);
cgt::Camera camRight(camera.getPosition() + rightVec,
camera.getFocus() + rightVec, camera.getUpVector(),
camera.getFovy(), camera.getRatio(), nearDist, farDist);
camRight.setFrustum(cgt::Frustum(left, right, bottom, top, nearDist, farDist));
camRight.setProjectionMode(cgt::Camera::FRUSTUM);
left = frust.getLeft() + projectionPlaneShift;
right = frust.getRight() + projectionPlaneShift;
//top = wd2;
//bottom = -wd2;
cgt::Camera camLeft(camera.getPosition() - rightVec,
camera.getFocus() - rightVec, camera.getUpVector(),
camera.getFovy(), camera.getRatio(), nearDist, farDist);
camLeft.setFrustum(cgt::Frustum(left, right, bottom, top, nearDist, farDist));
camRight.setProjectionMode(cgt::Camera::FRUSTUM);
dataContainer.addData(p_sourceCameraID.getValue() + ".left", new CameraData(camLeft));
dataContainer.addData(p_sourceCameraID.getValue() + ".right", new CameraData(camRight));
}
}
void StereoCameraGenerator::updateProperties(DataContainer & dataContainer)
{
}
};
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment