| 246 | } |
| 247 | |
| 248 | void 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 | |
| 278 | void performPatchScaleTest(const Vector2& scale) |
| 279 | { |
no test coverage detected