MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / performFaceScaleTest

Function performFaceScaleTest

test/TextureManipulation.cpp:248–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248void performFaceScaleTest(const Vector2& scale)
249{
250 auto worldspawn = GlobalMapModule().findOrInsertWorldspawn();
251 auto brush = algorithm::createCubicBrush(worldspawn, Vector3(0, 256, 256), "textures/numbers/1");
252 Node_setSelected(brush, true);
253
254 auto faceUp = algorithm::findBrushFaceWithNormal(Node_getIBrush(brush), Vector3(0, 0, 1));
255
256 std::vector<Vector2> oldTexCoords;
257 for (const auto& vertex : faceUp->getWinding())
258 {
259 oldTexCoords.push_back(vertex.texcoord);
260 }
261
262 // The incoming scale values are absolute 1.05 == 105%, the command accepts relative values, 0.05 == 105%
263 auto zeroBasedScale = scale - Vector2(1, 1);
264 GlobalCommandSystem().executeCommand("TexScale", { cmd::Argument(zeroBasedScale) });
265
266 auto faceUvBounds = algorithm::getTextureSpaceBounds(*faceUp);
267
268 std::vector<Vector2> newTexCoords;
269 for (const auto& vertex : faceUp->getWinding())
270 {
271 newTexCoords.push_back(vertex.texcoord);
272 }
273
274 Vector2 pivot(faceUvBounds.origin.x(), faceUvBounds.origin.y());
275 assumeVerticesHaveBeenScaled(oldTexCoords, newTexCoords, scale, pivot);
276}
277
278void performPatchScaleTest(const Vector2& scale)
279{

Callers 1

TEST_FFunction · 0.85

Calls 11

createCubicBrushFunction · 0.85
Node_setSelectedFunction · 0.85
findBrushFaceWithNormalFunction · 0.85
Node_getIBrushFunction · 0.85
getTextureSpaceBoundsFunction · 0.85
xMethod · 0.80
yMethod · 0.80
ArgumentClass · 0.50
push_backMethod · 0.45
executeCommandMethod · 0.45

Tested by

no test coverage detected