diff --git a/osvr/RenderKit/DistortionParameters.cpp b/osvr/RenderKit/DistortionParameters.cpp index e03e3af..6b44c43 100644 --- a/osvr/RenderKit/DistortionParameters.cpp +++ b/osvr/RenderKit/DistortionParameters.cpp @@ -35,6 +35,7 @@ namespace osvr { OSVR_RENDERMANAGER_EXPORT DistortionParameters::DistortionParameters( OSVRDisplayConfiguration& osvrParams, size_t eye) : DistortionParameters() { + m_desiredTriangles = osvrParams.getDesiredDistortionTriangleCount(); if (osvrParams.getDistortionType() == OSVRDisplayConfiguration::RGB_SYMMETRIC_POLYNOMIALS) { m_type = rgb_symmetric_polynomials; diff --git a/osvr/RenderKit/RenderManagerBase.cpp b/osvr/RenderKit/RenderManagerBase.cpp index 8f09b0d..34b6fc6 100644 --- a/osvr/RenderKit/RenderManagerBase.cpp +++ b/osvr/RenderKit/RenderManagerBase.cpp @@ -2311,7 +2311,6 @@ namespace renderkit { // @todo Remove once we get a general polynomial from Core. for (size_t i = 0; i < p.m_displayConfiguration->getEyes().size(); i++) { DistortionParameters distortion(*p.m_displayConfiguration, i); - distortion.m_desiredTriangles = 200 * 64; p.m_distortionParameters.push_back(distortion); } diff --git a/osvr/RenderKit/osvr_display_configuration.cpp b/osvr/RenderKit/osvr_display_configuration.cpp index a5990a2..c674c26 100644 --- a/osvr/RenderKit/osvr_display_configuration.cpp +++ b/osvr/RenderKit/osvr_display_configuration.cpp @@ -532,6 +532,11 @@ void OSVRDisplayConfiguration::parse(const std::string& display_description) { { auto const& distortion = hmd["distortion"]; + /// Find out how many desired triangles, if this is specified. + /// If not specified, set to a default. + m_distortionDesiredTriangleCount = + distortion.get("desired_triangle_count", 200 * 64).asInt(); + /// We will detect distortion type based on either the explicitly /// specified string or the presence of essential object members. m_distortionTypeString = distortion["type"].asString(); @@ -790,6 +795,11 @@ OSVRDisplayConfiguration::getDistortionPolynomalBlue() const { return m_distortionPolynomialBlue; } +int OSVR_RENDERMANAGER_EXPORT +OSVRDisplayConfiguration::getDesiredDistortionTriangleCount() const { + return m_distortionDesiredTriangleCount; +} + std::vector const& OSVRDisplayConfiguration::getEyes() const { return m_eyes; diff --git a/osvr/RenderKit/osvr_display_configuration.h b/osvr/RenderKit/osvr_display_configuration.h index d49b6d2..01ca3bd 100644 --- a/osvr/RenderKit/osvr_display_configuration.h +++ b/osvr/RenderKit/osvr_display_configuration.h @@ -133,6 +133,9 @@ class OSVRDisplayConfiguration { std::vector const& getDistortionPolynomalBlue() const; ///@} + /// Returns the desired number of triangles in the constructed distortion mesh. + int OSVR_RENDERMANAGER_EXPORT getDesiredDistortionTriangleCount() const; + /// Structure holding the information for one eye. class EyeInfo { public: @@ -192,6 +195,7 @@ class OSVRDisplayConfiguration { std::vector m_distortionPolynomialRed; std::vector m_distortionPolynomialGreen; std::vector m_distortionPolynomialBlue; + int m_distortionDesiredTriangleCount; // Rendering double m_rightRoll = 0.;