Skip to content

Commit

Permalink
Merge branch 'ign-rendering6' into lidar_near_clip
Browse files Browse the repository at this point in the history
  • Loading branch information
iche033 authored Oct 18, 2021
2 parents 067e155 + a28e315 commit 82a194d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ endif()

#--------------------------------------
# Find OGRE
list(APPEND ign_ogre_components "RTShaderSystem" "Terrain" "Overlay")
list(APPEND ign_ogre_components "RTShaderSystem" "Terrain" "Overlay" "Paging")

# Ogre versions greater than 1.9 are not officialy supported.
# Display a warning for the users on this setup unless they provide
Expand Down
14 changes: 12 additions & 2 deletions ogre2/src/Ogre2RenderTarget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -560,10 +560,20 @@ uint8_t Ogre2RenderTarget::TargetFSAA() const
{
// output warning but only do it once
static bool ogre2FSAAWarn = false;
if (ogre2FSAAWarn)
if (!ogre2FSAAWarn)
{
std::ostringstream os;
os << "[ ";
for (auto &&level : fsaaLevels)
{
os << level << " ";
}
os << "]";

ignwarn << "Anti-aliasing level of '" << this->antiAliasing << "' "
<< "is not supported. Setting to 0" << std::endl;
<< "is not supported; valid FSAA levels are: " << os.str()
<< ". Setting to 0" << std::endl;
targetFSAA = 0u;
ogre2FSAAWarn = true;
}
}
Expand Down
14 changes: 11 additions & 3 deletions ogre2/src/media/materials/scripts/selection_buffer.material
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
*
*/

vertex_program selection_buffer_vs glsl
{
// reuse depth camera vertex shader
source depth_camera_vs.glsl
default_params
{
param_named_auto worldViewProj worldviewproj_matrix
}
}

fragment_program selection_buffer_fs glsl
{
source selection_buffer_fs.glsl
Expand All @@ -34,9 +44,7 @@ material SelectionBuffer
pass
{
// Make this pass use the vertex shader defined above
vertex_program_ref DepthCameraVS
{
}
vertex_program_ref selection_buffer_vs { }

// Make this pass use the pixel shader defined above
fragment_program_ref selection_buffer_fs { }
Expand Down
17 changes: 9 additions & 8 deletions src/Utils_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,26 +137,27 @@ void UtilTest::ClickToScene(const std::string &_renderEngine)
// from the expected position. However, fixing the centerClick above caused
// the screenToPlane tests to fail so only modifying the pos here, and the
// cause of test failure need to be investigated.
if (_renderEngine == "ogre2")
centerClick = ignition::math::Vector2i(halfWidth-1, halfHeight-1);
centerClick = ignition::math::Vector2i(halfWidth-1, halfHeight-1);

// API without RayQueryResult and default max distance
result = screenToScene(centerClick, camera, rayQuery, rayResult);

EXPECT_NEAR(0.5, result.Z(), 3e-6);
// high tol is used for z due to depth buffer precision.
// Do not merge the tol changes forward to ign-rendering6.
EXPECT_NEAR(0.5, result.Z(), 1e-3);
EXPECT_NEAR(0.0, result.X(), 2e-6);
EXPECT_NEAR(0.0, result.Y(), 2e-6);
EXPECT_TRUE(rayResult);
EXPECT_NEAR(14.5 - camera->NearClipPlane(), rayResult.distance, 4e-6);
EXPECT_NEAR(14.5 - camera->NearClipPlane(), rayResult.distance, 1e-3);
EXPECT_EQ(box->Id(), rayResult.objectId);

result = screenToScene(centerClick, camera, rayQuery, rayResult, 20.0);

EXPECT_NEAR(0.5, result.Z(), 3e-6);
EXPECT_NEAR(0.5, result.Z(), 1e-3);
EXPECT_NEAR(0.0, result.X(), 2e-6);
EXPECT_NEAR(0.0, result.Y(), 2e-6);
EXPECT_TRUE(rayResult);
EXPECT_NEAR(14.5 - camera->NearClipPlane(), rayResult.distance, 4e-6);
EXPECT_NEAR(14.5 - camera->NearClipPlane(), rayResult.distance, 1e-3);
EXPECT_EQ(box->Id(), rayResult.objectId);

// Move camera closer to box
Expand All @@ -165,11 +166,11 @@ void UtilTest::ClickToScene(const std::string &_renderEngine)

result = screenToScene(centerClick, camera, rayQuery, rayResult);

EXPECT_NEAR(0.5, result.Z(), 3e-6);
EXPECT_NEAR(0.5, result.Z(), 1e-3);
EXPECT_NEAR(0.0, result.X(), 2e-6);
EXPECT_NEAR(0.0, result.Y(), 2e-6);
EXPECT_TRUE(rayResult);
EXPECT_NEAR(6.5 - camera->NearClipPlane(), rayResult.distance, 4e-6);
EXPECT_NEAR(6.5 - camera->NearClipPlane(), rayResult.distance, 1e-4);
EXPECT_EQ(box->Id(), rayResult.objectId);
}

Expand Down

0 comments on commit 82a194d

Please sign in to comment.