Skip to content

Commit

Permalink
#5231: Remove dependency on TextureBrowser from clipper algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed May 21, 2020
1 parent a051f66 commit 598b8c0
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions radiant/clipper/BrushByPlaneClipper.cpp
Expand Up @@ -2,7 +2,6 @@

#include "scenelib.h"
#include "brush/BrushNode.h"
#include "ui/texturebrowser/TextureBrowser.h"

namespace algorithm
{
Expand Down Expand Up @@ -128,10 +127,10 @@ void BrushByPlaneClipper::getMostUsedTexturing(const Brush& brush) const
_mostUsedProjection = TextureProjection();

// greebo: Get the most used shader of this brush
for (Brush::const_iterator i = brush.begin(); i != brush.end(); ++i)
for (auto& face : brush)
{
// Get the shadername
const std::string& shader = (*i)->getShader();
const std::string& shader = face->getShader();

// Insert counter, if necessary
if (shaderCount.find(shader) == shaderCount.end()) {
Expand All @@ -147,21 +146,9 @@ void BrushByPlaneClipper::getMostUsedTexturing(const Brush& brush) const
mostUsedShaderCount = shaderCount[shader];

// Copy the TexDef from the face into the local member
(*i)->GetTexdef(_mostUsedProjection);
face->GetTexdef(_mostUsedProjection);
}
}

// Fall back to the default shader, if nothing found
if (_mostUsedShader.empty() || mostUsedShaderCount == 1)
{
_mostUsedShader = GlobalTextureBrowser().getSelectedShader();

// Use the same texture matrix as the first face of the brush
if (!brush.empty())
{
(*brush.begin())->GetTexdef(_mostUsedProjection);
}
}
}

} // namespace algorithm

0 comments on commit 598b8c0

Please sign in to comment.