1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-04 02:45:35 +00:00

Make things less readable to appease authoritarian line length limit

This commit is contained in:
AnyOldName3 2023-04-30 02:05:35 +01:00
parent ab625804ab
commit 61712168c6

View file

@ -45,8 +45,8 @@ namespace MWRender
class InstancedComputeNearFarCullCallback : public osg::DrawableCullCallback class InstancedComputeNearFarCullCallback : public osg::DrawableCullCallback
{ {
public: public:
InstancedComputeNearFarCullCallback( InstancedComputeNearFarCullCallback(const std::vector<Groundcover::GroundcoverEntry>& instances,
const std::vector<Groundcover::GroundcoverEntry>& instances, const osg::Vec3& chunkPosition, const osg::BoundingBox& instanceBounds) const osg::Vec3& chunkPosition, const osg::BoundingBox& instanceBounds)
: mInstanceMatrices() : mInstanceMatrices()
, mInstanceBounds(instanceBounds) , mInstanceBounds(instanceBounds)
{ {
@ -107,11 +107,13 @@ namespace MWRender
{ {
osg::Matrix fullMatrix = instanceMatrix * matrix; osg::Matrix fullMatrix = instanceMatrix * matrix;
osg::Vec3 instanceLookVector(-fullMatrix(0, 2), -fullMatrix(1, 2), -fullMatrix(2, 2)); osg::Vec3 instanceLookVector(-fullMatrix(0, 2), -fullMatrix(1, 2), -fullMatrix(2, 2));
unsigned int instanceBbCornerFar unsigned int instanceBbCornerFar = (instanceLookVector.x() >= 0 ? 1 : 0)
= (instanceLookVector.x() >= 0 ? 1 : 0) | (instanceLookVector.y() >= 0 ? 2 : 0) | (instanceLookVector.z() >= 0 ? 4 : 0); | (instanceLookVector.y() >= 0 ? 2 : 0) | (instanceLookVector.z() >= 0 ? 4 : 0);
unsigned int instanceBbCornerNear = (~instanceBbCornerFar) & 7; unsigned int instanceBbCornerNear = (~instanceBbCornerFar) & 7;
value_type instanceDNear = distance(mInstanceBounds.corner(instanceBbCornerNear), fullMatrix); value_type instanceDNear
value_type instanceDFar = distance(mInstanceBounds.corner(instanceBbCornerFar), fullMatrix); = distance(mInstanceBounds.corner(instanceBbCornerNear), fullMatrix);
value_type instanceDFar
= distance(mInstanceBounds.corner(instanceBbCornerFar), fullMatrix);
if (instanceDNear > instanceDFar) if (instanceDNear > instanceDFar)
std::swap(instanceDNear, instanceDFar); std::swap(instanceDNear, instanceDFar);
@ -119,8 +121,8 @@ namespace MWRender
if (instanceDFar < 0 || instanceDNear > dNear) if (instanceDFar < 0 || instanceDNear > dNear)
continue; continue;
value_type newNear = cullVisitor.computeNearestPointInFrustum( value_type newNear
fullMatrix, planes, *drawable); = cullVisitor.computeNearestPointInFrustum(fullMatrix, planes, *drawable);
dNear = std::min(dNear, newNear); dNear = std::min(dNear, newNear);
} }
if (dNear < computedZNear) if (dNear < computedZNear)
@ -134,11 +136,13 @@ namespace MWRender
{ {
osg::Matrix fullMatrix = instanceMatrix * matrix; osg::Matrix fullMatrix = instanceMatrix * matrix;
osg::Vec3 instanceLookVector(-fullMatrix(0, 2), -fullMatrix(1, 2), -fullMatrix(2, 2)); osg::Vec3 instanceLookVector(-fullMatrix(0, 2), -fullMatrix(1, 2), -fullMatrix(2, 2));
unsigned int instanceBbCornerFar unsigned int instanceBbCornerFar = (instanceLookVector.x() >= 0 ? 1 : 0)
= (instanceLookVector.x() >= 0 ? 1 : 0) | (instanceLookVector.y() >= 0 ? 2 : 0) | (instanceLookVector.z() >= 0 ? 4 : 0); | (instanceLookVector.y() >= 0 ? 2 : 0) | (instanceLookVector.z() >= 0 ? 4 : 0);
unsigned int instanceBbCornerNear = (~instanceBbCornerFar) & 7; unsigned int instanceBbCornerNear = (~instanceBbCornerFar) & 7;
value_type instanceDNear = distance(mInstanceBounds.corner(instanceBbCornerNear), fullMatrix); value_type instanceDNear
value_type instanceDFar = distance(mInstanceBounds.corner(instanceBbCornerFar), fullMatrix); = distance(mInstanceBounds.corner(instanceBbCornerNear), fullMatrix);
value_type instanceDFar
= distance(mInstanceBounds.corner(instanceBbCornerFar), fullMatrix);
if (instanceDNear > instanceDFar) if (instanceDNear > instanceDFar)
std::swap(instanceDNear, instanceDFar); std::swap(instanceDNear, instanceDFar);