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

Function performPatchFlipTest

test/TextureManipulation.cpp:180–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180void performPatchFlipTest(int axis)
181{
182 auto worldspawn = GlobalMapModule().findOrInsertWorldspawn();
183 auto patchNode = algorithm::createPatchFromBounds(worldspawn, AABB(Vector3(4, 50, 60), Vector3(64, 128, 256)), "textures/numbers/1");
184
185 auto patch = Node_getIPatch(patchNode);
186 patch->scaleTextureNaturally();
187 patch->controlPointsChanged();
188
189 Node_setSelected(patchNode, true);
190
191 // Get the texture space bounds of this patch
192 auto patchBounds = algorithm::getTextureSpaceBounds(*patch);
193 auto bounds = patchBounds;
194 bounds.extents *= 1.2f;
195
196 std::vector<Vector2> oldTexCoords;
197 algorithm::foreachPatchVertex(*patch, [&](const PatchControl& ctrl) { oldTexCoords.push_back(ctrl.texcoord); });
198
199 auto cmd = axis == 0 ? "FlipTextureX" : "FlipTextureY";
200 GlobalCommandSystem().executeCommand(cmd);
201
202 // Every changed vertex should have been flipped about the bounds origin
203 algorithm::expectVerticesHaveBeenFlipped(axis, *patch, oldTexCoords, { patchBounds.origin.x(), patchBounds.origin.y() });
204}
205
206}
207

Callers 1

TEST_FFunction · 0.70

Calls 13

createPatchFromBoundsFunction · 0.85
Node_getIPatchFunction · 0.85
Node_setSelectedFunction · 0.85
getTextureSpaceBoundsFunction · 0.85
foreachPatchVertexFunction · 0.85
scaleTextureNaturallyMethod · 0.80
xMethod · 0.80
yMethod · 0.80
AABBClass · 0.50
controlPointsChangedMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected