-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cross-compatibility via wrapper module
- Loading branch information
Showing
7 changed files
with
192 additions
and
36 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#ignore mac fs files | ||
.DS_Store | ||
.vscode | ||
|
||
# ignore ue binaries | ||
Binaries/* | ||
|
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,101 @@ | ||
#include "VtkWrapper.h" | ||
|
||
#include "Modules/ModuleManager.h" | ||
|
||
PRAGMA_DEFAULT_VISIBILITY_START | ||
THIRD_PARTY_INCLUDES_START | ||
// DistanceBetweenTwoPoins example | ||
#include "vtkMath.h" | ||
|
||
// StructuredGridReader example | ||
#include "vtkNamedColors.h" | ||
#include "vtkNew.h" | ||
#include "vtkPolyDataMapper.h" | ||
#include "vtkStructuredGridGeometryFilter.h" | ||
#include "vtkXMLStructuredGridReader.h" | ||
#include "vtkStructuredGrid.h" | ||
THIRD_PARTY_INCLUDES_END | ||
PRAGMA_DEFAULT_VISIBILITY_END | ||
|
||
// NOTE | ||
// This is just am exemplary implementation, a "proof of concept" for cross-compatibility. | ||
// I expect that better ways exist to do the stuff below. | ||
|
||
// FvtkMath | ||
|
||
double FvtkMath::Distance2BetweenPoints(const double p1[3], const double p2[3]) | ||
{ | ||
return vtkMath::Distance2BetweenPoints(p1, p2); | ||
} | ||
|
||
// FvtkStructuredGrid | ||
|
||
FvtkStructuredGrid::FvtkStructuredGrid() | ||
{ | ||
mStructuredGrid = vtkStructuredGrid::New(); | ||
} | ||
|
||
FvtkStructuredGrid::FvtkStructuredGrid(vtkStructuredGrid* arg) | ||
{ | ||
mStructuredGrid = arg; | ||
} | ||
|
||
FvtkStructuredGrid::~FvtkStructuredGrid() | ||
{ | ||
mStructuredGrid->Delete(); | ||
} | ||
|
||
int FvtkStructuredGrid::GetDataDimension() | ||
{ | ||
return ((vtkStructuredGrid*)mStructuredGrid)->GetDataDimension(); | ||
} | ||
int FvtkStructuredGrid::GetNumberOfPoints() | ||
{ | ||
return ((vtkStructuredGrid*)mStructuredGrid)->GetNumberOfPoints(); | ||
} | ||
int FvtkStructuredGrid::GetNumberOfCells() | ||
{ | ||
return ((vtkStructuredGrid*)mStructuredGrid)->GetNumberOfCells(); | ||
} | ||
void FvtkStructuredGrid::GetDimensions(int dims[3]) | ||
{ | ||
((vtkStructuredGrid*)mStructuredGrid)->GetDimensions(dims); | ||
} | ||
void FvtkStructuredGrid::GetCellDims(int cellDims[3]) | ||
{ | ||
((vtkStructuredGrid*)mStructuredGrid)->GetCellDims(cellDims); | ||
} | ||
|
||
// FvtkXMLStructuredGridReader | ||
|
||
FvtkXMLStructuredGridReader::FvtkXMLStructuredGridReader() | ||
{ | ||
mXMLStructuredGridReader = vtkXMLStructuredGridReader::New(); | ||
} | ||
|
||
FvtkXMLStructuredGridReader::~FvtkXMLStructuredGridReader() | ||
{ | ||
mXMLStructuredGridReader->Delete(); | ||
} | ||
|
||
void FvtkXMLStructuredGridReader::SetFileName(const char* arg) | ||
{ | ||
((vtkXMLStructuredGridReader*)mXMLStructuredGridReader)->SetFileName(arg); | ||
} | ||
void FvtkXMLStructuredGridReader::Update() | ||
{ | ||
((vtkXMLStructuredGridReader*)mXMLStructuredGridReader)->Update(); | ||
} | ||
bool FvtkXMLStructuredGridReader::CheckAbort() | ||
{ | ||
return ((vtkXMLStructuredGridReader*)mXMLStructuredGridReader)->CheckAbort(); | ||
} | ||
|
||
FvtkStructuredGrid* FvtkXMLStructuredGridReader::GetOutput() | ||
{ | ||
auto out = ((vtkXMLStructuredGridReader*)mXMLStructuredGridReader)->GetOutput(); | ||
return new FvtkStructuredGrid(out); | ||
} | ||
|
||
IMPLEMENT_MODULE(FDefaultModuleImpl, VtkWrapper); | ||
//IMPLEMENT_MODULE(FVtkWrapperModule, VtkWrapper); |
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,48 @@ | ||
#pragma once | ||
|
||
#include "CoreTypes.h" | ||
|
||
// NOTE | ||
// This is just am exemplary implementation, a "proof of concept" for cross-compatibility. | ||
// I expect that better ways exist to do the stuff below. | ||
|
||
class vtkStructuredGrid; | ||
class vtkXMLStructuredGridReader; | ||
|
||
class VTKWRAPPER_API FvtkMath | ||
{ | ||
public: | ||
static double Distance2BetweenPoints(const double p1[3], const double p2[3]); | ||
}; | ||
|
||
class VTKWRAPPER_API FvtkStructuredGrid | ||
{ | ||
public: | ||
FvtkStructuredGrid(); | ||
FvtkStructuredGrid(vtkStructuredGrid* arg); | ||
~FvtkStructuredGrid(); | ||
|
||
int GetDataDimension(); | ||
int GetNumberOfPoints(); | ||
int GetNumberOfCells(); | ||
void GetDimensions(int dims[3]); | ||
void GetCellDims(int cellDims[3]); | ||
|
||
private: | ||
vtkStructuredGrid* mStructuredGrid; | ||
}; | ||
|
||
class VTKWRAPPER_API FvtkXMLStructuredGridReader | ||
{ | ||
public: | ||
FvtkXMLStructuredGridReader(); | ||
~FvtkXMLStructuredGridReader(); | ||
|
||
void SetFileName(const char* arg); | ||
void Update(); | ||
bool CheckAbort(); | ||
FvtkStructuredGrid* GetOutput(); | ||
|
||
private: | ||
vtkXMLStructuredGridReader* mXMLStructuredGridReader; | ||
}; |
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,28 @@ | ||
// Copyright Epic Games, Inc. All Rights Reserved. | ||
|
||
using UnrealBuildTool; | ||
|
||
public class VtkWrapper : ModuleRules | ||
{ | ||
public VtkWrapper(ReadOnlyTargetRules Target) : base(Target) | ||
{ | ||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; | ||
|
||
bUseRTTI = true; | ||
|
||
PublicDependencyModuleNames.AddRange( | ||
new string[] | ||
{ | ||
"Core", | ||
} | ||
); | ||
|
||
|
||
PrivateDependencyModuleNames.AddRange( | ||
new string[] | ||
{ | ||
"VtkLibrary", | ||
} | ||
); | ||
} | ||
} |
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