1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025414: Visualization - Optimize ray-tracing performance

This patch increases ray-tracing performance up to 12% in regular mode, and up to 36% in FSAA mode.
This commit is contained in:
dbp
2014-10-23 18:18:24 +04:00
committed by bugmaster
parent 67e36f0c7a
commit 50d0e1cefd
5 changed files with 64 additions and 30 deletions

View File

@@ -128,6 +128,29 @@ OpenGl_RaytraceLight::OpenGl_RaytraceLight (const BVH_Vec4f& theDiffuse,
//
}
// =======================================================================
// function : Center
// purpose : Returns centroid position along the given axis
// =======================================================================
Standard_ShortReal OpenGl_TriangleSet::Center (
const Standard_Integer theIndex, const Standard_Integer theAxis) const
{
// Note: Experiments show that the use of the box centroid (instead
// of the triangle centroid) increases render performance up to 12%
const BVH_Vec4i& aTriangle = Elements[theIndex];
const Standard_ShortReal aVertex0 =
BVH::VecComp<Standard_ShortReal, 3>::Get (Vertices[aTriangle.x()], theAxis);
const Standard_ShortReal aVertex1 =
BVH::VecComp<Standard_ShortReal, 3>::Get (Vertices[aTriangle.y()], theAxis);
const Standard_ShortReal aVertex2 =
BVH::VecComp<Standard_ShortReal, 3>::Get (Vertices[aTriangle.z()], theAxis);
return (Min (Min (aVertex0, aVertex1), aVertex2) +
Max (Max (aVertex0, aVertex1), aVertex2)) * 0.5f;
}
// =======================================================================
// function : Box
// purpose : Returns AABB of primitive set