Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5115: Add integration test, assuming that the exported LWO has the s…
…ame number of vertices as the tesselation.
- Loading branch information
1 parent
3c68f76
commit 54d6632
Showing
8 changed files
with
122 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,3 +69,4 @@ Makefile.in | |
/tools/msvc/Tests/x64 | ||
/tools/msvc/x64 | ||
/tools/msvc/packages | ||
/install/*.testdurations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "RadiantTest.h" | ||
|
||
#include "imodel.h" | ||
#include "imodelcache.h" | ||
#include "imap.h" | ||
#include "algorithm/Scene.h" | ||
#include "scenelib.h" | ||
#include "os/path.h" | ||
|
||
namespace test | ||
{ | ||
|
||
using ModelExportTest = RadiantTest; | ||
|
||
TEST_F(ModelExportTest, ExportPatchMesh) | ||
{ | ||
// Load a map with a cylinder patch | ||
loadMap("modelexport_patch.map"); | ||
|
||
auto patchNode = algorithm::findFirstPatchWithMaterial(GlobalMapModule().findOrInsertWorldspawn(), | ||
"textures/darkmod/wood/boards/ship_hull_medium"); | ||
EXPECT_TRUE(patchNode); | ||
|
||
Node_setSelected(patchNode, true); | ||
|
||
// Choose a file in our temp data folder | ||
std::string modRelativePath = "models/temp/temp_patch.lwo"; | ||
|
||
fs::path outputFilename = _context.getTestResourcePath(); | ||
outputFilename /= modRelativePath; | ||
os::makeDirectory(outputFilename.parent_path().string()); | ||
|
||
auto exporter = GlobalModelFormatManager().getExporter("lwo"); | ||
|
||
cmd::ArgumentList argList; | ||
|
||
argList.push_back(outputFilename.string()); | ||
argList.push_back(std::string("lwo")); | ||
argList.push_back(true); // centerObjects | ||
argList.push_back(true); // skipCaulk | ||
argList.push_back(false); // replaceSelectionWithModel | ||
argList.push_back(false); // useEntityOrigin | ||
argList.push_back(false); // exportLightsAsObjects | ||
|
||
GlobalCommandSystem().executeCommand("ExportSelectedAsModel", argList); | ||
|
||
auto model = GlobalModelCache().getModel(modRelativePath); | ||
|
||
EXPECT_TRUE(model); | ||
|
||
// We expect exactly the same amount of vertices as in the patch mesh | ||
// This ensures that no vertices have been duplicated or faces separated | ||
auto patch = std::dynamic_pointer_cast<IPatchNode>(patchNode); | ||
EXPECT_EQ(model->getVertexCount(), patch->getPatch().getTesselatedPatchMesh().vertices.size()); | ||
|
||
// Clean up the file | ||
fs::remove(outputFilename); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Version 2 | ||
// entity 0 | ||
{ | ||
"classname" "worldspawn" | ||
// primitive 0 | ||
{ | ||
patchDef3 | ||
{ | ||
"textures/darkmod/wood/boards/ship_hull_medium" | ||
( 9 3 4 1 0 0 0 ) | ||
( | ||
( ( 74 0 -25 0 0 ) ( 74 0 7 0 -0.25 ) ( 74 0 39 0 -0.5 ) ) | ||
( ( 74 -16 -25 0.0625 0 ) ( 74 -16 7 0.0625 -0.25 ) ( 74 -16 39 0.0625 -0.5 ) ) | ||
( ( 90 -16 -25 0.125 0 ) ( 90 -16 7 0.125 -0.25 ) ( 90 -16 39 0.125 -0.5 ) ) | ||
( ( 106 -16 -25 0.1875 0 ) ( 106 -16 7 0.1875 -0.25 ) ( 106 -16 39 0.1875 -0.5 ) ) | ||
( ( 106 0 -25 0.25 0 ) ( 106 0 7 0.25 -0.25 ) ( 106 0 39 0.25 -0.5 ) ) | ||
( ( 106 16 -25 0.3125 0 ) ( 106 16 7 0.3125 -0.25 ) ( 106 16 39 0.3125 -0.5 ) ) | ||
( ( 90 16 -25 0.375 0 ) ( 90 16 7 0.375 -0.25 ) ( 90 16 39 0.375 -0.5 ) ) | ||
( ( 74 16 -25 0.4375 0 ) ( 74 16 7 0.4375 -0.25 ) ( 74 16 39 0.4375 -0.5 ) ) | ||
( ( 74 0 -25 0.5 0 ) ( 74 0 7 0.5 -0.25 ) ( 74 0 39 0.5 -0.5 ) ) | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters