diff --git a/Examples/Audio/CMakeLists.txt b/Examples/Audio/CMakeLists.txt index 9e7c05145adc3b29eb2b22b07371d05dfccf0f99..41c564223229ad09076a9ae2f02120c8cc193884 100644 --- a/Examples/Audio/CMakeLists.txt +++ b/Examples/Audio/CMakeLists.txt @@ -33,9 +33,9 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- if(UNIX) target_link_libraries(${PROJECT_NAME} - SimulationManager) + Common) else() target_link_libraries(${PROJECT_NAME} - SimulationManager - ${SFML_LIBRARIES}) + Common + ${SFML_LIBRARIES}) endif() diff --git a/Examples/BoneShaving/CMakeLists.txt b/Examples/BoneShaving/CMakeLists.txt index 8232d23a11fde0eba1e557e95ffcdc203055d486..3c534111817f5db74f0ff9bc08b59c7c9d9434c3 100644 --- a/Examples/BoneShaving/CMakeLists.txt +++ b/Examples/BoneShaving/CMakeLists.txt @@ -35,13 +35,13 @@ if(iMSTK_USE_OpenHaptics) #----------------------------------------------------------------------------- if(UNIX) target_link_libraries(${PROJECT_NAME} - SimulationManager - ) + SimulationManager + ViewerVTK) else() target_link_libraries(${PROJECT_NAME} - SimulationManager - SFML::SFML - ) + SimulationManager + SFML::SFML + ViewerVTK) endif() endif() diff --git a/Examples/CameraController/CMakeLists.txt b/Examples/CameraController/CMakeLists.txt index caa2becb51d710c2b0697debc9e9a32a4e4b30f8..c40386107ee356a174bef5aa80551ac9a52f1ab8 100644 --- a/Examples/CameraController/CMakeLists.txt +++ b/Examples/CameraController/CMakeLists.txt @@ -32,5 +32,7 @@ if(iMSTK_USE_OpenHaptics) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- - target_link_libraries(${PROJECT_NAME} SimulationManager) + target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) endif() diff --git a/Examples/CollisionDetection/BoxVsBoxMeshTest/CMakeLists.txt b/Examples/CollisionDetection/BoxVsBoxMeshTest/CMakeLists.txt index 3fa68fc43fd1b8f9eb5f8e1f4a3d683a1869c6f0..0a97d43da2fc86552fde7fd0c64f56dacc28947d 100644 --- a/Examples/CollisionDetection/BoxVsBoxMeshTest/CMakeLists.txt +++ b/Examples/CollisionDetection/BoxVsBoxMeshTest/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/CollisionDetec #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/CollisionDetection/OctreeIntersection/CMakeLists.txt b/Examples/CollisionDetection/OctreeIntersection/CMakeLists.txt index 5abb4b0740a79f0cf3772d3c0b4d911c9c8801fd..896fcb6ae57a154162dcb53762a27bcf8beeb901 100644 --- a/Examples/CollisionDetection/OctreeIntersection/CMakeLists.txt +++ b/Examples/CollisionDetection/OctreeIntersection/CMakeLists.txt @@ -35,4 +35,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/CollisionDetec #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/CollisionDetection/TriangleVsSphereTest/CMakeLists.txt b/Examples/CollisionDetection/TriangleVsSphereTest/CMakeLists.txt index eea78cbae34777c924f168b56819fcae396b0453..f4d76c13376cb5fcb88c9b5a64139d536cb6fdc2 100644 --- a/Examples/CollisionDetection/TriangleVsSphereTest/CMakeLists.txt +++ b/Examples/CollisionDetection/TriangleVsSphereTest/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/CollisionDetec #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/CollisionDetection/TriangleVsTriangleTest/CMakeLists.txt b/Examples/CollisionDetection/TriangleVsTriangleTest/CMakeLists.txt index 7b62c9196201a93cf19c12097f8fbbaa26baf4a2..87b0245b9d44ce486d24f0dc98d456ded4075a7e 100644 --- a/Examples/CollisionDetection/TriangleVsTriangleTest/CMakeLists.txt +++ b/Examples/CollisionDetection/TriangleVsTriangleTest/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/CollisionDetec #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/CreateEnclosingMesh/CMakeLists.txt b/Examples/CreateEnclosingMesh/CMakeLists.txt index a3174ed8621dc50b0b6950b66eb53ddb964bad1d..dd10836c2af7c1ff98725303121ffe8f4c2dfad8 100644 --- a/Examples/CreateEnclosingMesh/CMakeLists.txt +++ b/Examples/CreateEnclosingMesh/CMakeLists.txt @@ -31,5 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} Common SimulationManager SceneEntities) - +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/DebugRendering/CMakeLists.txt b/Examples/DebugRendering/CMakeLists.txt index eb4ecf407207a52ddc5dec57590b0062d9eba0ec..921c1a84ee03a87fb54dfb8d4847461bd5d09bba 100644 --- a/Examples/DebugRendering/CMakeLists.txt +++ b/Examples/DebugRendering/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/DeformableBody/CMakeLists.txt b/Examples/DeformableBody/CMakeLists.txt index 104d32fcb54a1d3d184ebaa053904dbfffb9e8f7..84404efc1e68f29f4ebf6930b260e0197a0b990d 100644 --- a/Examples/DeformableBody/CMakeLists.txt +++ b/Examples/DeformableBody/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/FastMarch/CMakeLists.txt b/Examples/FastMarch/CMakeLists.txt index f84730ed20fddef5080b95d5f841b80d0b202966..7e08dcf621345ea8f933a00e7c2b2d38e2e1f940 100644 --- a/Examples/FastMarch/CMakeLists.txt +++ b/Examples/FastMarch/CMakeLists.txt @@ -31,4 +31,7 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) +target_link_libraries(${PROJECT_NAME} + SimulationManager + Filtering + ViewerVTK) \ No newline at end of file diff --git a/Examples/FemurCut/CMakeLists.txt b/Examples/FemurCut/CMakeLists.txt index e5fce2b0fbbd7d981d9f466c68cfd5b406d96201..c93f1e13506ce00e1f654d5663cc95baf273ef48 100644 --- a/Examples/FemurCut/CMakeLists.txt +++ b/Examples/FemurCut/CMakeLists.txt @@ -31,4 +31,7 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/Haptics) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) +target_link_libraries(${PROJECT_NAME} + SimulationManager + Filtering + ViewerVTK) \ No newline at end of file diff --git a/Examples/GeometryProcessing/CMakeLists.txt b/Examples/GeometryProcessing/CMakeLists.txt index 3baf12ddbefe20d04f5f0b25d372b217a70ab35b..3d8d1565861506e1e3156b99bfac26e8d917f7ce 100644 --- a/Examples/GeometryProcessing/CMakeLists.txt +++ b/Examples/GeometryProcessing/CMakeLists.txt @@ -31,4 +31,7 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) +target_link_libraries(${PROJECT_NAME} + SimulationManager + Filtering + ViewerVTK) \ No newline at end of file diff --git a/Examples/GeometryTransforms/CMakeLists.txt b/Examples/GeometryTransforms/CMakeLists.txt index fdd23f2a232c1c652b128173f7be4f5163f67648..9b75133c530e534c46e438028dfda604ea8f4203 100644 --- a/Examples/GeometryTransforms/CMakeLists.txt +++ b/Examples/GeometryTransforms/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/Levelset/CMakeLists.txt b/Examples/Levelset/CMakeLists.txt index a7946cdf0d877d81e2967511b4feb209c88e981b..fff2e124bd67100ebd91ba7be1762dedef35ddca 100644 --- a/Examples/Levelset/CMakeLists.txt +++ b/Examples/Levelset/CMakeLists.txt @@ -31,4 +31,7 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) +target_link_libraries(${PROJECT_NAME} + SimulationManager + Filtering + ViewerVTK) \ No newline at end of file diff --git a/Examples/ObjectController/CMakeLists.txt b/Examples/ObjectController/CMakeLists.txt index f4d400d5f9692db43fdb45bc9152ffb0cae2b16a..5c151b392b671ed13c27f36b472d76fc8b9edd51 100644 --- a/Examples/ObjectController/CMakeLists.txt +++ b/Examples/ObjectController/CMakeLists.txt @@ -32,6 +32,8 @@ if(iMSTK_USE_OpenHaptics) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- - target_link_libraries(${PROJECT_NAME} SimulationManager) + target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) endif() diff --git a/Examples/ObjectControllerDummyClient/CMakeLists.txt b/Examples/ObjectControllerDummyClient/CMakeLists.txt index 1448cc63809246d6a6f9b60c23c92214e5436600..effb7083af06b538200ff92b9b7afe223e1fd9f2 100644 --- a/Examples/ObjectControllerDummyClient/CMakeLists.txt +++ b/Examples/ObjectControllerDummyClient/CMakeLists.txt @@ -31,5 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) - +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/OpenVRController/CMakeLists.txt b/Examples/OpenVRController/CMakeLists.txt index 5190298dac6aab05718309664d690b6d7b161c03..0413d392262aa877d4c0dd79465d3413e7e702f8 100644 --- a/Examples/OpenVRController/CMakeLists.txt +++ b/Examples/OpenVRController/CMakeLists.txt @@ -34,4 +34,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/OpenVR) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) \ No newline at end of file +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/PBD/PBDCloth/CMakeLists.txt b/Examples/PBD/PBDCloth/CMakeLists.txt index db0500ae60a96a5b9a40d1eea59f4d03a3ad1026..392c0d188d3c24609b4b7102e75ac6b00ac40ae9 100644 --- a/Examples/PBD/PBDCloth/CMakeLists.txt +++ b/Examples/PBD/PBDCloth/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/PBD/PBDClothCollision/CMakeLists.txt b/Examples/PBD/PBDClothCollision/CMakeLists.txt index b10b60e7e67400196f0a3f1bd0d812fb1645d751..3722c6543608b1a701fcd2b7a9e41c0de37f1e88 100644 --- a/Examples/PBD/PBDClothCollision/CMakeLists.txt +++ b/Examples/PBD/PBDClothCollision/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/PBD/PBDClothRemap/CMakeLists.txt b/Examples/PBD/PBDClothRemap/CMakeLists.txt index e86f1ce6919d9a266c8ad6835edeef2eec3160ac..687aa3e452e4fb4c5725a791f43f8a997790bd7a 100644 --- a/Examples/PBD/PBDClothRemap/CMakeLists.txt +++ b/Examples/PBD/PBDClothRemap/CMakeLists.txt @@ -31,4 +31,7 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) +target_link_libraries(${PROJECT_NAME} + SimulationManager + Filtering + ViewerVTK) \ No newline at end of file diff --git a/Examples/PBD/PBDCutting/CMakeLists.txt b/Examples/PBD/PBDCutting/CMakeLists.txt index 573401da589c9f93e3bd4f2b8481694c474c0d00..af15b4d79ef89a8a9afc04187cff4f8aba205e5b 100644 --- a/Examples/PBD/PBDCutting/CMakeLists.txt +++ b/Examples/PBD/PBDCutting/CMakeLists.txt @@ -32,6 +32,9 @@ if(iMSTK_USE_OpenHaptics) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- - target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) + target_link_libraries(${PROJECT_NAME} + SimulationManager + Filtering + ViewerVTK) endif() diff --git a/Examples/PBD/PBDFluids/CMakeLists.txt b/Examples/PBD/PBDFluids/CMakeLists.txt index 087de64e1cc26756096560e47f0a615090b96800..95beb013f61c1fe50f58ec879cf803abd3c39f2b 100644 --- a/Examples/PBD/PBDFluids/CMakeLists.txt +++ b/Examples/PBD/PBDFluids/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/PBD/PBDInjection/CMakeLists.txt b/Examples/PBD/PBDInjection/CMakeLists.txt index 3ef755be8a214f895fd5bc79c275d127fae362cf..04a4f1b65b4992018e41857263321313c0ac6e60 100644 --- a/Examples/PBD/PBDInjection/CMakeLists.txt +++ b/Examples/PBD/PBDInjection/CMakeLists.txt @@ -34,4 +34,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/PBD/PBDPicking/CMakeLists.txt b/Examples/PBD/PBDPicking/CMakeLists.txt index 26b5faa8ee59c773595d5a302c195dd1e4905de8..be8dcda54185fbb0a5726912137fe7fedb811327 100644 --- a/Examples/PBD/PBDPicking/CMakeLists.txt +++ b/Examples/PBD/PBDPicking/CMakeLists.txt @@ -32,6 +32,8 @@ if(iMSTK_USE_OpenHaptics) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- - target_link_libraries(${PROJECT_NAME} SimulationManager) + target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) endif() diff --git a/Examples/PBD/PBDStaticSuture/CMakeLists.txt b/Examples/PBD/PBDStaticSuture/CMakeLists.txt index c8ba865d36da86763bcbcd6b981b97b2d15447d0..c87b1b5332ce3a0f9a370c40a589ff476084d5e0 100644 --- a/Examples/PBD/PBDStaticSuture/CMakeLists.txt +++ b/Examples/PBD/PBDStaticSuture/CMakeLists.txt @@ -40,5 +40,7 @@ if (iMSTK_USE_OpenHaptics) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- - target_link_libraries(${PROJECT_NAME} SimulationManager) + target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) endif() diff --git a/Examples/PBD/PBDThinTissueContact/CMakeLists.txt b/Examples/PBD/PBDThinTissueContact/CMakeLists.txt index 2cacd2c32f54863a6849d11fc52908097771d9c7..4dd2cc1a2cb8bc5867ab8ef88a0143561b04a39c 100644 --- a/Examples/PBD/PBDThinTissueContact/CMakeLists.txt +++ b/Examples/PBD/PBDThinTissueContact/CMakeLists.txt @@ -32,4 +32,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/PBD/PBDTissueContact/CMakeLists.txt b/Examples/PBD/PBDTissueContact/CMakeLists.txt index 8113e3a7aacc788a1801a397a5cadb5cd18fb2fd..24053724b7daebb215ca57cc56bc36c3f9754014 100644 --- a/Examples/PBD/PBDTissueContact/CMakeLists.txt +++ b/Examples/PBD/PBDTissueContact/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/PBD/PBDTissueCut/CMakeLists.txt b/Examples/PBD/PBDTissueCut/CMakeLists.txt index 656dd671154cbba4c4352e995dae78e5654237d3..41af76edbbaa2b59cf8fa9fad4197ffc9b6fad25 100644 --- a/Examples/PBD/PBDTissueCut/CMakeLists.txt +++ b/Examples/PBD/PBDTissueCut/CMakeLists.txt @@ -34,5 +34,7 @@ if(iMSTK_USE_OpenHaptics) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- - target_link_libraries(${PROJECT_NAME} SimulationManager) + target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) endif() \ No newline at end of file diff --git a/Examples/PBD/PBDTissueSurfaceNeedleContact/CMakeLists.txt b/Examples/PBD/PBDTissueSurfaceNeedleContact/CMakeLists.txt index c1ce25b8723e34020e640eaff9407489094e4e11..95bd3e52f37a87cd649d20b06b0aafa50f06fb3a 100644 --- a/Examples/PBD/PBDTissueSurfaceNeedleContact/CMakeLists.txt +++ b/Examples/PBD/PBDTissueSurfaceNeedleContact/CMakeLists.txt @@ -38,4 +38,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/PBD/PBDTissueVolumeNeedleContact/CMakeLists.txt b/Examples/PBD/PBDTissueVolumeNeedleContact/CMakeLists.txt index c5e4368fda65d9cda91b92d4313accc567049cfd..6db6de39bfed5c422c928afb1eff64af5a8c744c 100644 --- a/Examples/PBD/PBDTissueVolumeNeedleContact/CMakeLists.txt +++ b/Examples/PBD/PBDTissueVolumeNeedleContact/CMakeLists.txt @@ -41,4 +41,7 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) +target_link_libraries(${PROJECT_NAME} + SimulationManager + Filtering + ViewerVTK) \ No newline at end of file diff --git a/Examples/PBD/PBDTriangleContact/CMakeLists.txt b/Examples/PBD/PBDTriangleContact/CMakeLists.txt index 2f5120c9be2e56aa4d48e88e45d3a20a7b33e5a0..05caba74cd0b11ddf0344ccebd23dcd40d069ab3 100644 --- a/Examples/PBD/PBDTriangleContact/CMakeLists.txt +++ b/Examples/PBD/PBDTriangleContact/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) \ No newline at end of file +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/RBD/RbdSDFCollision/CMakeLists.txt b/Examples/RBD/RbdSDFCollision/CMakeLists.txt index e84bc8d19b01bdcd275e9e484c357233ab8bda71..45d343eb41915858966894ff22e6cc16cf689805 100644 --- a/Examples/RBD/RbdSDFCollision/CMakeLists.txt +++ b/Examples/RBD/RbdSDFCollision/CMakeLists.txt @@ -31,4 +31,7 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/RBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) +target_link_libraries(${PROJECT_NAME} + SimulationManager + Filtering + ViewerVTK) \ No newline at end of file diff --git a/Examples/RBD/RbdSDFPivotNeedle/CMakeLists.txt b/Examples/RBD/RbdSDFPivotNeedle/CMakeLists.txt index 38630c77be291e5d33a1df91604065c1d643e9c2..74c3527aaca419eccbcc961b272f990344e6c8af 100644 --- a/Examples/RBD/RbdSDFPivotNeedle/CMakeLists.txt +++ b/Examples/RBD/RbdSDFPivotNeedle/CMakeLists.txt @@ -39,4 +39,7 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/RBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) +target_link_libraries(${PROJECT_NAME} + SimulationManager + Filtering + ViewerVTK) \ No newline at end of file diff --git a/Examples/RBD/RbdSurfaceMeshToSphereCD/CMakeLists.txt b/Examples/RBD/RbdSurfaceMeshToSphereCD/CMakeLists.txt index abf65a9b655c2bf4e1d476757ca0678c45496bf9..83d58c93acc38f01bbff9e49140a6093be178f1a 100644 --- a/Examples/RBD/RbdSurfaceMeshToSphereCD/CMakeLists.txt +++ b/Examples/RBD/RbdSurfaceMeshToSphereCD/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/RBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/RCM/CMakeLists.txt b/Examples/RCM/CMakeLists.txt index 2163379bb93477cf33011e9ec54f05484a1710b0..1eada41196323e62eb8fa73dcfba724f3ba2bf91 100644 --- a/Examples/RCM/CMakeLists.txt +++ b/Examples/RCM/CMakeLists.txt @@ -31,4 +31,5 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} Common SceneEntities) +target_link_libraries(${PROJECT_NAME} + MeshIO) \ No newline at end of file diff --git a/Examples/RenderingHead/CMakeLists.txt b/Examples/RenderingHead/CMakeLists.txt index a4ed72e6c78cf68ffba9bd5a39887ce2eb057fd9..26cc79ca5819a0647e67d934a9e765ee1bf86ea7 100644 --- a/Examples/RenderingHead/CMakeLists.txt +++ b/Examples/RenderingHead/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/RenderingVolume/CMakeLists.txt b/Examples/RenderingVolume/CMakeLists.txt index 58885798f42f8663c65e2d367fb289b82f41e105..b9225285a889ee975c81b93ca49fc4a11d8e7f13 100644 --- a/Examples/RenderingVolume/CMakeLists.txt +++ b/Examples/RenderingVolume/CMakeLists.txt @@ -31,4 +31,7 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) +target_link_libraries(${PROJECT_NAME} + SimulationManager + Filtering + ViewerVTK) \ No newline at end of file diff --git a/Examples/SDFHaptics/CMakeLists.txt b/Examples/SDFHaptics/CMakeLists.txt index f7f594401220bca7b417bbc64dbfb57b48dacb1f..e052882e51dcd3b89a80083eb07948264032d7fa 100644 --- a/Examples/SDFHaptics/CMakeLists.txt +++ b/Examples/SDFHaptics/CMakeLists.txt @@ -32,6 +32,9 @@ if(iMSTK_USE_OpenHaptics) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- - target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) + target_link_libraries(${PROJECT_NAME} + SimulationManager + Filtering + ViewerVTK) endif() diff --git a/Examples/SPH-FEM-PBD/CMakeLists.txt b/Examples/SPH-FEM-PBD/CMakeLists.txt index ba29ce91b42b06e1fba32118fab4cb9ba38ccefc..922a56a36f45b7b5bd4ed177189b1a6900480ecf 100644 --- a/Examples/SPH-FEM-PBD/CMakeLists.txt +++ b/Examples/SPH-FEM-PBD/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/SPH-Obj-SDF/CMakeLists.txt b/Examples/SPH-Obj-SDF/CMakeLists.txt index 87dc54563717955b269ee29f4c6cc2e5db61f7e7..cd3a275e83e30af0be30832d323ef9faf8e2cbc5 100644 --- a/Examples/SPH-Obj-SDF/CMakeLists.txt +++ b/Examples/SPH-Obj-SDF/CMakeLists.txt @@ -31,4 +31,7 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/SPH) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) +target_link_libraries(${PROJECT_NAME} + SimulationManager + Filtering + ViewerVTK) \ No newline at end of file diff --git a/Examples/SPHFluid/SPHFluid-BallDrop/CMakeLists.txt b/Examples/SPHFluid/SPHFluid-BallDrop/CMakeLists.txt index e7e4328037f68a1d0836bdc757dc03a18fec22ba..19ee25ac792b66988eaef93c76ad7eb9dec7810a 100644 --- a/Examples/SPHFluid/SPHFluid-BallDrop/CMakeLists.txt +++ b/Examples/SPHFluid/SPHFluid-BallDrop/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/SPH) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/SPHFluid/SPHFluid-BunnyShape/CMakeLists.txt b/Examples/SPHFluid/SPHFluid-BunnyShape/CMakeLists.txt index 01c20d23dba7a76043a0d67cc0bc98f16b45b4f8..d5b76f591601df9d08975ce17ec3b2672cbe87f7 100644 --- a/Examples/SPHFluid/SPHFluid-BunnyShape/CMakeLists.txt +++ b/Examples/SPHFluid/SPHFluid-BunnyShape/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/SPH) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/SPHFluid/SPHFluid-HighViscousity/CMakeLists.txt b/Examples/SPHFluid/SPHFluid-HighViscousity/CMakeLists.txt index 966b9f21baefddb72d96287538c875df04e94319..7cc90fc5b0885d3aa4944a8338ff308110e8ba3d 100644 --- a/Examples/SPHFluid/SPHFluid-HighViscousity/CMakeLists.txt +++ b/Examples/SPHFluid/SPHFluid-HighViscousity/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/SPH) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/TaskGraph/Configuration/CMakeLists.txt b/Examples/TaskGraph/Configuration/CMakeLists.txt index e52ad78a1e9f242fd7089b43e54df4f841c47aa6..3ac25ba37fc73e4b901a027ae8ef0440d45f6fa6 100644 --- a/Examples/TaskGraph/Configuration/CMakeLists.txt +++ b/Examples/TaskGraph/Configuration/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/TaskGraph) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/TaskGraph/TaskGraph/CMakeLists.txt b/Examples/TaskGraph/TaskGraph/CMakeLists.txt index 31d8fe23e2bc708ec44ba911a13342a476b2a642..38c40dd25bbfb6c3b0544f0e01a49fb52635c9f2 100644 --- a/Examples/TaskGraph/TaskGraph/CMakeLists.txt +++ b/Examples/TaskGraph/TaskGraph/CMakeLists.txt @@ -31,4 +31,5 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/TaskGraph) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + Common) \ No newline at end of file diff --git a/Examples/TaskGraph/Timing/CMakeLists.txt b/Examples/TaskGraph/Timing/CMakeLists.txt index 77eb164965fab9005ca69fc4460aaa603f118f94..6d9951ce53814f93991e23c96f6926ec5235610e 100644 --- a/Examples/TaskGraph/Timing/CMakeLists.txt +++ b/Examples/TaskGraph/Timing/CMakeLists.txt @@ -31,4 +31,6 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/TaskGraph) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager) +target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) \ No newline at end of file diff --git a/Examples/Vessel/CMakeLists.txt b/Examples/Vessel/CMakeLists.txt index 20f0c976deb06b7dec067492d1a9e25cef911220..7a4fcfc977a61e08d8273f97231c5d3afca94da1 100644 --- a/Examples/Vessel/CMakeLists.txt +++ b/Examples/Vessel/CMakeLists.txt @@ -31,4 +31,7 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) +target_link_libraries(${PROJECT_NAME} + SimulationManager + Filtering + ViewerVTK) \ No newline at end of file diff --git a/Examples/VirtualCoupling/CMakeLists.txt b/Examples/VirtualCoupling/CMakeLists.txt index fd4246616f41b24b4f30db7ceda46c3df634c7fc..2007e0829e7ddc953f282ffd0ee336c1316447b9 100644 --- a/Examples/VirtualCoupling/CMakeLists.txt +++ b/Examples/VirtualCoupling/CMakeLists.txt @@ -32,6 +32,8 @@ if(iMSTK_USE_OpenHaptics) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- - target_link_libraries(${PROJECT_NAME} SimulationManager) + target_link_libraries(${PROJECT_NAME} + SimulationManager + ViewerVTK) endif() diff --git a/Source/RenderingCore/CMakeLists.txt b/Source/RenderingCore/CMakeLists.txt index 9509c698d552b77ff0af8048b11ffd1b2d929ae0..a02e8af856703c0f6c8e9dbe21ff58f5ac28e246 100644 --- a/Source/RenderingCore/CMakeLists.txt +++ b/Source/RenderingCore/CMakeLists.txt @@ -8,6 +8,8 @@ imstk_add_library(RenderingCore imstkRenderer.h imstkTextureManager.h imstkTextureDelegate.h + CPP_FILES + imstkRenderer.cpp DEPENDS Scene) diff --git a/Source/RenderingCore/imstkRenderer.cpp b/Source/RenderingCore/imstkRenderer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8e48f69ca24593f5e4a4a1e419a1a1b8f9f5e9e9 --- /dev/null +++ b/Source/RenderingCore/imstkRenderer.cpp @@ -0,0 +1,22 @@ +/*========================================================================= + + Library: iMSTK + + Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, + & Imaging in Medicine, Rensselaer Polytechnic Institute. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0.txt + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +=========================================================================*/ + +#include "imstkRenderer.h" \ No newline at end of file diff --git a/Source/RenderingVTK/CMakeLists.txt b/Source/RenderingVTK/CMakeLists.txt index 60457bc766ceee31ed628a3c3aed92e02190ca88..f8872500e7ad2f5d87e59aa44ea44bc53c776dee 100644 --- a/Source/RenderingVTK/CMakeLists.txt +++ b/Source/RenderingVTK/CMakeLists.txt @@ -59,6 +59,6 @@ vtk_module_autoinit(TARGETS RenderingVTK MODULES ${VTK_LIBRARIES}) #----------------------------------------------------------------------------- # Testing #----------------------------------------------------------------------------- -# if( ${PROJECT_NAME}_BUILD_TESTING ) -# add_subdirectory(Testing) -# endif() +if( ${PROJECT_NAME}_BUILD_TESTING ) + add_subdirectory(Testing) +endif() \ No newline at end of file diff --git a/Source/RenderingVTK/Testing/CMakeLists.txt b/Source/RenderingVTK/Testing/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3e8ca88d69ee82639e61f6590dc9fd2f3902c31 --- /dev/null +++ b/Source/RenderingVTK/Testing/CMakeLists.txt @@ -0,0 +1,22 @@ +########################################################################### +# +# Copyright (c) Kitware, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +########################################################################### + +include(imstkAddTest) +imstk_add_test( RenderingVTK ) +# Note: Links to ViewerVTK but only tests RenderingVTK +target_link_libraries(RenderingVTKTests ViewerVTK) \ No newline at end of file diff --git a/Source/RenderingVTK/Testing/imstkRenderAnalyticalGeometryTest.cpp b/Source/RenderingVTK/Testing/imstkRenderAnalyticalGeometryTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..16c49bfda606c4e0065850620c880610cfe1f847 --- /dev/null +++ b/Source/RenderingVTK/Testing/imstkRenderAnalyticalGeometryTest.cpp @@ -0,0 +1,88 @@ +/*========================================================================= + + Library: iMSTK + + Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, + & Imaging in Medicine, Rensselaer Polytechnic Institute. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0.txt + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +=========================================================================*/ + +#include "imstkRenderTest.h" + +#include "imstkCapsule.h" +#include "imstkCylinder.h" +#include "imstkOrientedBox.h" +#include "imstkPlane.h" +#include "imstkSphere.h" + +class CapsuleRenderTest : public RenderTest +{ +void createGeometry() override +{ + geom = std::make_shared<Capsule>(); +} +}; +TEST_F(CapsuleRenderTest, createCapsule) +{ + runAllMaterials(); +} + +class CylinderRenderTest : public RenderTest +{ +void createGeometry() override +{ + geom = std::make_shared<Cylinder>(); +} +}; +TEST_F(CylinderRenderTest, createCylinder) +{ + runAllMaterials(); +} + +class OrientedBoxRenderTest : public RenderTest +{ +void createGeometry() override +{ + geom = std::make_shared<OrientedBox>(); +} +}; +TEST_F(OrientedBoxRenderTest, createOrientedBox) +{ + runAllMaterials(); +} + +class PlaneRenderTest : public RenderTest +{ +void createGeometry() override +{ + geom = std::make_shared<Plane>(); +} +}; +TEST_F(PlaneRenderTest, createPlane) +{ + runAllMaterials(); +} + +class SphereRenderTest : public RenderTest +{ +void createGeometry() override +{ + geom = std::make_shared<Sphere>(); +} +}; +TEST_F(SphereRenderTest, createSphere) +{ + runAllMaterials(); +} \ No newline at end of file diff --git a/Source/RenderingVTK/Testing/imstkRenderScreenshotTest.cpp b/Source/RenderingVTK/Testing/imstkRenderScreenshotTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..46e8b8340d208bbe80d6c0ffcdfd3c2d521345a4 --- /dev/null +++ b/Source/RenderingVTK/Testing/imstkRenderScreenshotTest.cpp @@ -0,0 +1,67 @@ +/*========================================================================= + + Library: iMSTK + + Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, + & Imaging in Medicine, Rensselaer Polytechnic Institute. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0.txt + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +=========================================================================*/ + +#include "imstkNew.h" +#include "imstkScene.h" +#include "imstkSceneObject.h" +#include "imstkSphere.h" +#include "imstkVTKScreenCaptureUtility.h" +#include "imstkVTKViewer.h" + +#include <gtest/gtest.h> +#include <vtksys/SystemTools.hxx> + +using namespace imstk; + +/// +/// \brief Test we are able to output a screenshot +/// +TEST(imstkRenderScreenshotTest, ScreenshotTest) +{ + // If the screenshot already exists, clear it + const std::string screenshotFileName = "Screenshot-" + std::to_string(0) + ".png"; + if (vtksys::SystemTools::FileExists(screenshotFileName)) + { + const bool fileWasRemoved = vtksys::SystemTools::RemoveFile(screenshotFileName); + EXPECT_TRUE(fileWasRemoved) << "Failed to remove existing screenshot file before screenshotTest"; + if (!fileWasRemoved) + { + return; + } + } + + imstkNew<Sphere> sphere(Vec3d(0.0, 0.0, 0.0), 1.0); + + imstkNew<SceneObject> sphereObj("TestObj"); + sphereObj->setVisualGeometry(sphere); + + imstkNew<Scene> scene("TestScene"); + scene->addSceneObject(sphereObj); + + imstkNew<VTKViewer> viewer; + viewer->setActiveScene(scene); + viewer->init(); + viewer->update(); + viewer->getScreenCaptureUtility()->saveScreenShot(); + viewer->uninit(); + + EXPECT_TRUE(vtksys::SystemTools::FileExists(screenshotFileName)); +} \ No newline at end of file diff --git a/Source/RenderingVTK/Testing/imstkRenderSurfaceMeshTest.cpp b/Source/RenderingVTK/Testing/imstkRenderSurfaceMeshTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0b04803de2928559b9b54842c60cecd7d8471ed8 --- /dev/null +++ b/Source/RenderingVTK/Testing/imstkRenderSurfaceMeshTest.cpp @@ -0,0 +1,282 @@ +/*========================================================================= + + Library: iMSTK + + Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, + & Imaging in Medicine, Rensselaer Polytechnic Institute. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0.txt + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +=========================================================================*/ + +#include "imstkRenderTest.h" + +#include "imstkEventObject.h" +#include "imstkLogger.h" +#include "imstkMeshIO.h" +#include "imstkSurfaceMesh.h" +#include "imstkVecDataArray.h" + +class MeshFileRenderTest : public RenderTest +{ +public: + + void createGeometry() override + { + geom = MeshIO::read(iMSTK_DATA_ROOT "/textured_organs/heart.obj"); + geom->scale(0.15, Geometry::TransformType::ConcatenateToTransform); + } +}; +TEST_F(MeshFileRenderTest, meshFile) +{ + runAllMaterials(); +} + +class MeshColorFunctionVerticesRenderTest : public RenderTest +{ +public: + + float val = 0.0; + void createGeometry() override + { + imstk::VecDataArray<double, 3> points; + auto scalars = std::make_shared<imstk::DataArray<float>>(); + + for (int i = 0; i < 6; ++i) + { + points.push_back({ 0, 0, static_cast<double>(i) }); + scalars->push_back(i); + points.push_back({ 1, 0, static_cast<double>(i) }); + scalars->push_back(i); + } + + auto mesh = std::make_shared<imstk::SurfaceMesh>(); + geom = mesh; + + imstk::VecDataArray<int, 3> tris; + for (int i = 0; i < 5; ++i) + { + int j = i * 2; + tris.push_back({ j + 2, j + 1, j }); + tris.push_back({ j + 3, j + 1, j + 2 }); + } + + mesh->initialize(std::make_shared<VecDataArray<double, 3>>(points), std::make_shared<VecDataArray<int, 3>>(tris)); + mesh->setVertexAttribute("scalars", scalars); + mesh->setVertexScalars("scalars"); + + std::shared_ptr<imstk::AbstractDataArray> abstracScalars = scalars; + + auto onPreUpdate = [this, scalars, abstracScalars](Event*) + { + if (val < 6.0) + { + val += 0.05; + } + else + { + val = 0.0; + } + (*scalars)[0] = val; + (*scalars)[1] = val; + (*scalars)[2] = val; + (*scalars)[3] = val; + abstracScalars->postModified(); + }; + + connect<Event>(viewer, VTKViewer::preUpdate, onPreUpdate); + onPreUpdate(nullptr); + applyColor(); + + scene->getActiveCamera()->setPosition(Vec3d(0, 12, 3)); + scene->getActiveCamera()->setFocalPoint(Vec3d(0, 0, 3.01)); + } +}; +TEST_F(MeshColorFunctionVerticesRenderTest, meshColorFunctionVertices) +{ + runFor(2); +} + +class MeshColorFunctionCellsRenderTest : public RenderTest +{ +public: + + float val = 0.0; + void createGeometry() override + { + imstk::VecDataArray<double, 3> points; + auto scalars = std::make_shared<imstk::DataArray<float>>(); + + for (int i = 0; i < 6; ++i) + { + points.push_back({ 0, 0, static_cast<double>(i) }); + points.push_back({ 1, 0, static_cast<double>(i) }); + } + + imstk::VecDataArray<int, 3> tris; + for (int i = 0; i < 5; ++i) + { + int j = i * 2; + tris.push_back({ j + 2, j + 1, j }); + scalars->push_back(i); + tris.push_back({ j + 3, j + 1, j + 2 }); + scalars->push_back(i); + } + + auto mesh = std::make_shared<imstk::SurfaceMesh>(); + mesh->initialize(std::make_shared<VecDataArray<double, 3>>(points), std::make_shared<VecDataArray<int, 3>>(tris)); + mesh->setCellAttribute("scalars", scalars); + mesh->setCellScalars("scalars"); + geom = mesh; + + auto onPreUpdate = [this, scalars](Event*) + { + if (val < 6.0) + { + val += 0.05; + } + else + { + val = 0.0; + } + (*scalars)[0] = val; + (*scalars)[1] = val; + (*scalars)[2] = val; + (*scalars)[3] = val; + scalars->postModified(); + }; + + connect<Event>(viewer, VTKViewer::preUpdate, onPreUpdate); + onPreUpdate(nullptr); + applyColor(); + + scene->getActiveCamera()->setPosition(Vec3d(0, 12, 3)); + scene->getActiveCamera()->setFocalPoint(Vec3d(0, 0, 3.01)); + } +}; +TEST_F(MeshColorFunctionCellsRenderTest, meshColorFunctionCells) +{ + runFor(2); +} + +class MeshColorFunctionDynamicVerticesRenderTest : public RenderTest +{ +public: + + double scale = 1.0; + void createGeometry() override + { + auto mesh = std::make_shared<imstk::SurfaceMesh>(); + auto points = std::make_shared<imstk::VecDataArray<double, 3>>(); + auto tris = std::make_shared<imstk::VecDataArray<int, 3>>(); + auto scalars = std::make_shared<imstk::DataArray<float>>(); + mesh->initialize(points, tris); + geom = mesh; + + auto updateMesh = [this, mesh](Event*) + { + scale += 0.01; + auto points = std::make_shared<imstk::VecDataArray<double, 3>>(); + auto tris = std::make_shared<imstk::VecDataArray<int, 3>>(); + auto scalars = std::make_shared<imstk::DataArray<float>>(); + mesh->clear(); + for (int i = 0; i < 6; ++i) + { + points->push_back({ 0, 0, static_cast<double>(i) }); + scalars->push_back(i); + points->push_back({ 1 * scale, 0, static_cast<double>(i) }); + scalars->push_back(i); + } + + for (int i = 0; i < 5; ++i) + { + int j = i * 2; + tris->push_back({ j + 2, j + 1, j }); + tris->push_back({ j + 3, j + 1, j + 2 }); + } + + mesh->initialize(points, tris); + mesh->setVertexAttribute("scalars", scalars); + mesh->setVertexScalars("scalars"); + mesh->computeVertexNormals(); + mesh->postModified(); + }; + + connect<Event>(viewer, VTKViewer::preUpdate, updateMesh); + updateMesh(nullptr); + applyColor(); + + scene->getActiveCamera()->setPosition(Vec3d(0, 12, 3)); + scene->getActiveCamera()->setFocalPoint(Vec3d(0, 0, 3.01)); + } +}; +TEST_F(MeshColorFunctionDynamicVerticesRenderTest, meshColorFunctionDynamicVertices) +{ + runFor(2); +} + +class MeshColorFunctionDynamicCellsRenderTest : public RenderTest +{ +public: + + double scale = 1.0; + void createGeometry() override + { + auto mesh = std::make_shared<imstk::SurfaceMesh>(); + auto points = std::make_shared<imstk::VecDataArray<double, 3>>(); + auto tris = std::make_shared<imstk::VecDataArray<int, 3>>(); + auto scalars = std::make_shared<imstk::DataArray<float>>(); + mesh->initialize(points, tris); + geom = mesh; + + auto updateMesh = [this, mesh](Event*) + { + scale += 0.01; + auto points = std::make_shared<imstk::VecDataArray<double, 3>>(); + auto tris = std::make_shared<imstk::VecDataArray<int, 3>>(); + auto scalars = std::make_shared<imstk::DataArray<float>>(); + mesh->clear(); + for (int i = 0; i < 6; ++i) + { + points->push_back({ 0, 0, static_cast<double>(i) }); + points->push_back({ 1 * scale, 0, static_cast<double>(i) }); + } + + for (int i = 0; i < 5; ++i) + { + int j = i * 2; + tris->push_back({ j + 2, j + 1, j }); + scalars->push_back(i); + tris->push_back({ j + 3, j + 1, j + 2 }); + scalars->push_back(i); + } + + mesh->initialize(points, tris); + mesh->setCellAttribute("scalars", scalars); + mesh->setCellScalars("scalars"); + mesh->computeVertexNormals(); + mesh->postModified(); + }; + + connect<Event>(viewer, viewer->preUpdate, updateMesh); + updateMesh(nullptr); + applyColor(); + + scene->getActiveCamera()->setPosition(Vec3d(0, 12, 3)); + scene->getActiveCamera()->setFocalPoint(Vec3d(0, 0, 3.01)); + } +}; +TEST_F(MeshColorFunctionDynamicCellsRenderTest, meshColorFunctionDynamicCells) +{ + runFor(2); +} diff --git a/Source/RenderingVTK/Testing/imstkRenderTest.cpp b/Source/RenderingVTK/Testing/imstkRenderTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..637a457f768a631e84c501b517a1424475e61dcc --- /dev/null +++ b/Source/RenderingVTK/Testing/imstkRenderTest.cpp @@ -0,0 +1,232 @@ +/*========================================================================= + + Library: iMSTK + + Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, + & Imaging in Medicine, Rensselaer Polytechnic Institute. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0.txt + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +=========================================================================*/ + +#include "imstkRenderTest.h" + +#include "imstkColorFunction.h" + +void +RenderTest::SetUp() +{ + scene = std::make_shared<Scene>("Render Test Scene"); + scene->getActiveCamera()->setPosition(Vec3d(0.0, 1.0, -3.0)); + + viewer = std::make_shared<VTKViewer>("Viewer"); + viewer->setActiveScene(scene); + + renderMaterial = std::make_shared<RenderMaterial>(); + + createGeometry(); + + ASSERT_TRUE(geom != nullptr) << "ERROR: No geometry"; + + visualModel = std::make_shared<VisualModel>(geom); + visualModel->setRenderMaterial(renderMaterial); + + sceneObj = std::make_shared<SceneObject>("SceneObject"); + sceneObj->addVisualModel(visualModel); + scene->addSceneObject(sceneObj); + + viewer->init(); +} + +void +RenderTest::runFor(const int seconds) +{ + StopWatch timer; + timer.start(); + const double ms = seconds * 1000.0; + while (timer.getTimeElapsed() < ms) + { + viewer->update(); + } + viewer->uninit(); +} + +void +RenderTest::runAllMaterials() +{ + complete = false; + displayMode = 0; + color = 0; + shadingModel = 0; + blendMode = 0; + updateMaterial(); + + viewer->init(); + StopWatch timer; + timer.start(); + const double updateMaterialTimeMs = 50.0; + const double angularVel = 0.005; + while (!complete) + { + const double dt = timer.getTimeElapsed(); + timer.start(); + elapsedTime += dt; + if (elapsedTime > updateMaterialTimeMs) + { + elapsedTime = 0.0; + updateMaterial(); + } + geom->rotate(Vec3d(0.0, 1.0, 0.0), dt * angularVel); + geom->postModified(); + + viewer->update(); + } + viewer->uninit(); +} + +void +RenderTest::applyColor() +{ + auto colorFunc = std::make_shared<ColorFunction>(); + colorFunc->setNumberOfColors(3); + colorFunc->setColor(0, imstk::Color::Green); + colorFunc->setColor(1, imstk::Color::Blue); + colorFunc->setColor(2, imstk::Color::Red); + colorFunc->setColorSpace(imstk::ColorFunction::ColorSpace::RGB); + colorFunc->setRange(0, 6); + + renderMaterial->setScalarVisibility(true); + renderMaterial->setColorLookupTable(colorFunc); +} + +void +RenderTest::updateMaterial() +{ + switch (displayMode) + { + case 0: + renderMaterial->setDisplayMode(RenderMaterial::DisplayMode::Surface); + dm = "Surface "; + break; + case 1: + renderMaterial->setDisplayMode(RenderMaterial::DisplayMode::Wireframe); + dm = "Wireframe "; + break; + case 2: + renderMaterial->setDisplayMode(RenderMaterial::DisplayMode::Points); + dm = "Points "; + break; + case 3: + renderMaterial->setDisplayMode(RenderMaterial::DisplayMode::WireframeSurface); + dm = "WireframeSurface "; + break; + case 4: + renderMaterial->setDisplayMode(RenderMaterial::DisplayMode::VolumeRendering); + dm = "VolumeRendering "; + break; + case 5: + renderMaterial->setDisplayMode(RenderMaterial::DisplayMode::Fluid); + dm = "Fluid "; + break; + case 6: + renderMaterial->setDisplayMode(RenderMaterial::DisplayMode::Image); + dm = "Image "; + break; + case 7: + renderMaterial->setDisplayMode(RenderMaterial::DisplayMode::SurfaceNormals); + dm = "SurfaceNormals "; + break; + } + + switch (color) + { + case 0: + renderMaterial->setColor(Color::Blue); + c = "Blue "; + break; + case 1: + renderMaterial->setColor(Color::Green); + c = "Green "; + break; + case 2: + renderMaterial->setColor(Color::Red); + c = "Red "; + break; + } + + switch (shadingModel) + { + case 0: + renderMaterial->setShadingModel(RenderMaterial::ShadingModel::None); + sm = "None "; + break; + case 1: + renderMaterial->setShadingModel(RenderMaterial::ShadingModel::Phong); + sm = "Phong "; + break; + case 2: + renderMaterial->setShadingModel(RenderMaterial::ShadingModel::Gouraud); + sm = "Gouraud "; + break; + case 3: + renderMaterial->setShadingModel(RenderMaterial::ShadingModel::Flat); + sm = "Flat "; + break; + case 4: + renderMaterial->setShadingModel(RenderMaterial::ShadingModel::PBR); + sm = "PBR "; + break; + } + + switch (blendMode) + { + case 0: + renderMaterial->setBlendMode(RenderMaterial::BlendMode::Alpha); + bm = "Alpha "; + break; + case 1: + renderMaterial->setBlendMode(RenderMaterial::BlendMode::Additive); + bm = "Additive "; + break; + case 2: + renderMaterial->setBlendMode(RenderMaterial::BlendMode::MaximumIntensity); + bm = "MaximumIntensity "; + break; + case 3: + renderMaterial->setBlendMode(RenderMaterial::BlendMode::MinimumIntensity); + bm = "MinimumIntensity "; + break; + } + + std::cout << "DisplayMode=" << dm << " Color=" << c << " Shading Model=" << sm << " Blend Mode=" << bm << "\n"; + blendMode++; + if (blendMode == 4) + { + blendMode = 0; + shadingModel++; + } + if (shadingModel == 5) + { + shadingModel = 0; + color++; + } + if (color == 1)// Only check one color + { + color = 0; + displayMode++; + } + if (displayMode == 8) + { + complete = true; + } +} diff --git a/Source/RenderingVTK/Testing/imstkRenderTest.h b/Source/RenderingVTK/Testing/imstkRenderTest.h new file mode 100644 index 0000000000000000000000000000000000000000..5b095862d45514b125fe6ae75fd61f126d035553 --- /dev/null +++ b/Source/RenderingVTK/Testing/imstkRenderTest.h @@ -0,0 +1,72 @@ +/*========================================================================= + + Library: iMSTK + + Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, + & Imaging in Medicine, Rensselaer Polytechnic Institute. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0.txt + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +=========================================================================*/ + +#pragma once + +#include "gtest/gtest.h" + +#include <memory> + +#include "imstkCamera.h" +#include "imstkDirectionalLight.h" +#include "imstkGeometry.h" +#include "imstkRenderMaterial.h" +#include "imstkScene.h" +#include "imstkSceneObject.h" +#include "imstkVisualModel.h" +#include "imstkVTKViewer.h" + +using namespace imstk; + +class RenderTest : public testing::Test +{ +public: + void runFor(const int seconds); + void runAllMaterials(); + +protected: + void SetUp() override; + + virtual void createGeometry() = 0; + + void updateMaterial(); + + void applyColor(); + + // Render Frame + std::shared_ptr<Scene> scene; + std::shared_ptr<VTKViewer> viewer; + std::shared_ptr<DirectionalLight> light; + + // Render Contents + std::shared_ptr<Geometry> geom; + std::shared_ptr<RenderMaterial> renderMaterial; + std::shared_ptr<VisualModel> visualModel; + std::shared_ptr<SceneObject> sceneObj; + + double elapsedTime = 0; + bool complete = false; + int displayMode; + int color; + int shadingModel; + int blendMode; + std::string dm, c, sm, bm; +}; \ No newline at end of file diff --git a/Source/RenderingVTK/Testing/imstkRenderTetrahedralMeshTest.cpp b/Source/RenderingVTK/Testing/imstkRenderTetrahedralMeshTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0de41d24be86383d822b50acec5e7d3f82434dc3 --- /dev/null +++ b/Source/RenderingVTK/Testing/imstkRenderTetrahedralMeshTest.cpp @@ -0,0 +1,52 @@ +/*========================================================================= + + Library: iMSTK + + Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, + & Imaging in Medicine, Rensselaer Polytechnic Institute. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0.txt + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +=========================================================================*/ + +#include "imstkRenderTest.h" + +#include "imstkTetrahedralMesh.h" +#include "imstkVecDataArray.h" + +class TetrahedralMeshRenderTest : public RenderTest +{ +void createGeometry() override +{ + geom = std::make_shared<TetrahedralMesh>(); + + auto verticesPtr = std::make_shared<VecDataArray<double, 3>>(4); + auto indicesPtr = std::make_shared<VecDataArray<int, 4>>(1); + + VecDataArray<double, 3>& vertices = *verticesPtr; + VecDataArray<int, 4>& indices = *indicesPtr; + + vertices[0] = Vec3d(-0.5, 0.0, -0.5); + vertices[1] = Vec3d(0.5, 0.0, -0.5); + vertices[2] = Vec3d(0.0, 0.0, 0.75); + vertices[3] = Vec3d(0.0, 0.5, 0.0); + + indices[0] = Vec4i(0, 1, 2, 3); + + std::dynamic_pointer_cast<TetrahedralMesh>(geom)->initialize(verticesPtr, indicesPtr); +} +}; +TEST_F(TetrahedralMeshRenderTest, createTetrahedralMesh) +{ + runAllMaterials(); +} \ No newline at end of file diff --git a/Source/SimulationManager/CMakeLists.txt b/Source/SimulationManager/CMakeLists.txt index 9143edee4dc6850ef2a18bd2614b32a23f3ae2f0..cf08b790011bc59a77546f481d16904a623e288f 100644 --- a/Source/SimulationManager/CMakeLists.txt +++ b/Source/SimulationManager/CMakeLists.txt @@ -7,11 +7,15 @@ file(GLOB SRC_FILES imstk*.cpp) set(H_FILES imstkConsoleModule.h + imstkKeyboardSceneControl.h + imstkMouseSceneControl.h imstkSceneManager.h imstkSimulationManager.h) set(SRC_FILES imstkConsoleModule.cpp + imstkKeyboardSceneControl.cpp + imstkMouseSceneControl.cpp imstkSceneManager.cpp imstkSimulationManager.cpp) diff --git a/Source/SimulationManager/Testing/CMakeLists.txt b/Source/SimulationManager/Testing/CMakeLists.txt index 8051948b289b9623a6c1839721f01d791a3fcfee..40f19122f0c5af907edda27909489c93556d8217 100644 --- a/Source/SimulationManager/Testing/CMakeLists.txt +++ b/Source/SimulationManager/Testing/CMakeLists.txt @@ -1,2 +1,4 @@ include(imstkAddTest) -imstk_add_test( SimulationManager ) \ No newline at end of file +imstk_add_test( SimulationManager ) +# Note: Links to ViewerVTK for rendering support in tests +target_link_libraries(SimulationManagerTests SimulationManager ViewerVTK) \ No newline at end of file diff --git a/Source/ViewerVTK/imstkKeyboardSceneControl.cpp b/Source/SimulationManager/imstkKeyboardSceneControl.cpp similarity index 81% rename from Source/ViewerVTK/imstkKeyboardSceneControl.cpp rename to Source/SimulationManager/imstkKeyboardSceneControl.cpp index fdf20dc0a8076841a7a05fd85f2a8252262594a5..4cf42b8c1447727df12988855e7d60dc0e698cf1 100644 --- a/Source/ViewerVTK/imstkKeyboardSceneControl.cpp +++ b/Source/SimulationManager/imstkKeyboardSceneControl.cpp @@ -23,12 +23,11 @@ #include "imstkCamera.h" #include "imstkLogger.h" #include "imstkModuleDriver.h" +#include "imstkRenderer.h" #include "imstkScene.h" #include "imstkSceneManager.h" +#include "imstkViewer.h" #include "imstkVisualModel.h" -#include "imstkVTKRenderer.h" -#include "imstkVTKTextStatusManager.h" -#include "imstkVTKViewer.h" namespace imstk { @@ -110,7 +109,7 @@ KeyboardSceneControl::OnKeyPress(const char key) subManager->setMode(SceneManager::Mode::Simulation); } } - if (auto viewer = std::dynamic_pointer_cast<VTKViewer>(module)) + if (auto viewer = std::dynamic_pointer_cast<Viewer>(module)) { if (simModeOn) { @@ -125,23 +124,15 @@ KeyboardSceneControl::OnKeyPress(const char key) simModeOn ? sceneManager->setMode(SceneManager::Mode::Debug) : sceneManager->setMode(SceneManager::Mode::Simulation); } - // Display framerate and performance graph - else if (key == 'p' || key == 'P') // switch framerate display + // Toggle through info levels + else if (key == 'p' || key == 'P') { - // The designated m_sceneManager framerate is displayed in all views for (auto module : driver->getModules()) { - std::shared_ptr<VTKViewer> viewer = std::dynamic_pointer_cast<VTKViewer>(module); + std::shared_ptr<Viewer> viewer = std::dynamic_pointer_cast<Viewer>(module); if (viewer != nullptr) { - m_showFps = !m_showFps; - std::shared_ptr<VTKTextStatusManager> textManager = viewer->getTextStatusManager(); - textManager->setStatusVisibility(VTKTextStatusManager::StatusType::FPS, m_showFps); - - std::shared_ptr<Scene> activeScene = sceneManager->getActiveScene(); - activeScene->setEnableTaskTiming(m_showFps); - std::shared_ptr<VTKRenderer> vtkRen = std::dynamic_pointer_cast<VTKRenderer>(viewer->getActiveRenderer()); - vtkRen->setTimeTableVisibility(m_showFps); + viewer->setInfoLevel((viewer->getInfoLevel() + 1) % viewer->getInfoLevelCount()); } } } diff --git a/Source/ViewerVTK/imstkKeyboardSceneControl.h b/Source/SimulationManager/imstkKeyboardSceneControl.h similarity index 98% rename from Source/ViewerVTK/imstkKeyboardSceneControl.h rename to Source/SimulationManager/imstkKeyboardSceneControl.h index 17f7dcbb913567b4eb1dc1178466efe20e36226b..5de210d6224656cd4d9f365c453275b61afe3d21 100644 --- a/Source/ViewerVTK/imstkKeyboardSceneControl.h +++ b/Source/SimulationManager/imstkKeyboardSceneControl.h @@ -65,6 +65,5 @@ public: protected: std::weak_ptr<ModuleDriver> m_driver; std::weak_ptr<SceneManager> m_sceneManager; - bool m_showFps = false; }; } \ No newline at end of file diff --git a/Source/ViewerVTK/imstkMouseSceneControl.cpp b/Source/SimulationManager/imstkMouseSceneControl.cpp similarity index 100% rename from Source/ViewerVTK/imstkMouseSceneControl.cpp rename to Source/SimulationManager/imstkMouseSceneControl.cpp diff --git a/Source/ViewerVTK/imstkMouseSceneControl.h b/Source/SimulationManager/imstkMouseSceneControl.h similarity index 100% rename from Source/ViewerVTK/imstkMouseSceneControl.h rename to Source/SimulationManager/imstkMouseSceneControl.h diff --git a/Source/ViewerCore/imstkViewer.cpp b/Source/ViewerCore/imstkViewer.cpp index ef985770c3a31eb1446fc147c50dc4396d723510..e256ddb61882367cd6f998f5ace278715e8bce6e 100644 --- a/Source/ViewerCore/imstkViewer.cpp +++ b/Source/ViewerCore/imstkViewer.cpp @@ -44,6 +44,14 @@ Viewer::getActiveRenderer() const return m_rendererMap.at(m_activeScene); } +void +Viewer::setInfoLevel(int level) +{ + CHECK(level < getInfoLevelCount()) + << "There are only " << getInfoLevelCount() << " levels and level " << level << " was requested"; + m_infoLevel = level; +} + void Viewer::updateModule() { diff --git a/Source/ViewerCore/imstkViewer.h b/Source/ViewerCore/imstkViewer.h index e9df0b50b48a3392848329c69cc8615ac501dccc..9fcdc9ecc6b13b021bd385e6f7c2bc63234f7b07 100644 --- a/Source/ViewerCore/imstkViewer.h +++ b/Source/ViewerCore/imstkViewer.h @@ -105,6 +105,22 @@ public: /// virtual void setWindowTitle(const std::string& title) = 0; + /// + /// \brief Set the info level, usually means display framerates and other + /// viewer related information + /// + virtual void setInfoLevel(int level); + + /// + /// \brief Get the current info level + /// + int getInfoLevel() const { return m_infoLevel; } + + /// + /// \brief Get the number of info levels for a viewer, varies on implementation + /// + virtual const int getInfoLevelCount() const { return 1; } + /// /// \brief access screen shot utility /// @@ -148,5 +164,6 @@ protected: std::shared_ptr<ScreenCaptureUtility> m_screenCapturer; ///> Screen shot utility std::shared_ptr<ViewerConfig> m_config; + int m_infoLevel = 0; ///> Info level }; } diff --git a/Source/ViewerVTK/CMakeLists.txt b/Source/ViewerVTK/CMakeLists.txt index 95b81a6a70b1537124b25723158fcf62737012e8..26c089621958a5eb7fb473a15ac9c59f6088e2f6 100644 --- a/Source/ViewerVTK/CMakeLists.txt +++ b/Source/ViewerVTK/CMakeLists.txt @@ -2,23 +2,20 @@ # Create target #----------------------------------------------------------------------------- -file(GLOB H_FILES imstk*.h VTKViewer/imstk*.h) -file(GLOB CPP_FILES imstk*.cpp VTKViewer/imstk*.cpp) +file(GLOB H_FILES imstk*.h) +file(GLOB CPP_FILES imstk*.cpp) list(APPEND ExclusionFiles "") # Don't build with X11 if on windows or (on linux and building headless) if(WIN32 OR (UNIX AND iMSTK_USE_VTK_OSMESA)) # We use our own vtkXRenderWindowInteractor as there is a bug in vtk9's list(APPEND ExclusionFiles - VTKViewer/imstkVtkXRenderWindowInteractor2.h - VTKViewer/imstkVtkXRenderWindowInteractor2.cpp) + imstkVtkXRenderWindowInteractor2.h + imstkVtkXRenderWindowInteractor2.cpp) endif() -set(SIMULATIONMANAGER_H_FILES ${SIMMANAGER_H_FILES} ${VTK_H_FILES}) -set(SIMULATIONMANAGER_CPP_FILES ${SIMMANAGER_CPP_FILES} ${VTK_CPP_FILES}) - include(imstkAddLibrary) -imstk_add_library(Viewer +imstk_add_library(ViewerVTK H_FILES ${H_FILES} CPP_FILES @@ -28,6 +25,7 @@ imstk_add_library(Viewer EXCLUDE_FILES ${ExclusionFiles} DEPENDS + ViewerCore RenderingVTK) #----------------------------------------------------------------------------- diff --git a/Source/ViewerVTK/VTKViewer/imstkAbstractVTKViewer.cpp b/Source/ViewerVTK/imstkAbstractVTKViewer.cpp similarity index 100% rename from Source/ViewerVTK/VTKViewer/imstkAbstractVTKViewer.cpp rename to Source/ViewerVTK/imstkAbstractVTKViewer.cpp diff --git a/Source/ViewerVTK/VTKViewer/imstkAbstractVTKViewer.h b/Source/ViewerVTK/imstkAbstractVTKViewer.h similarity index 100% rename from Source/ViewerVTK/VTKViewer/imstkAbstractVTKViewer.h rename to Source/ViewerVTK/imstkAbstractVTKViewer.h diff --git a/Source/ViewerVTK/VTKViewer/imstkVTKInteractorStyle.cpp b/Source/ViewerVTK/imstkVTKInteractorStyle.cpp similarity index 100% rename from Source/ViewerVTK/VTKViewer/imstkVTKInteractorStyle.cpp rename to Source/ViewerVTK/imstkVTKInteractorStyle.cpp diff --git a/Source/ViewerVTK/VTKViewer/imstkVTKInteractorStyle.h b/Source/ViewerVTK/imstkVTKInteractorStyle.h similarity index 100% rename from Source/ViewerVTK/VTKViewer/imstkVTKInteractorStyle.h rename to Source/ViewerVTK/imstkVTKInteractorStyle.h diff --git a/Source/ViewerVTK/VTKViewer/imstkVTKInteractorStyleVR.cpp b/Source/ViewerVTK/imstkVTKInteractorStyleVR.cpp similarity index 100% rename from Source/ViewerVTK/VTKViewer/imstkVTKInteractorStyleVR.cpp rename to Source/ViewerVTK/imstkVTKInteractorStyleVR.cpp diff --git a/Source/ViewerVTK/VTKViewer/imstkVTKInteractorStyleVR.h b/Source/ViewerVTK/imstkVTKInteractorStyleVR.h similarity index 100% rename from Source/ViewerVTK/VTKViewer/imstkVTKInteractorStyleVR.h rename to Source/ViewerVTK/imstkVTKInteractorStyleVR.h diff --git a/Source/ViewerVTK/VTKViewer/imstkVTKOpenVRViewer.cpp b/Source/ViewerVTK/imstkVTKOpenVRViewer.cpp similarity index 100% rename from Source/ViewerVTK/VTKViewer/imstkVTKOpenVRViewer.cpp rename to Source/ViewerVTK/imstkVTKOpenVRViewer.cpp diff --git a/Source/ViewerVTK/VTKViewer/imstkVTKOpenVRViewer.h b/Source/ViewerVTK/imstkVTKOpenVRViewer.h similarity index 100% rename from Source/ViewerVTK/VTKViewer/imstkVTKOpenVRViewer.h rename to Source/ViewerVTK/imstkVTKOpenVRViewer.h diff --git a/Source/ViewerVTK/VTKViewer/imstkVTKScreenCaptureUtility.cpp b/Source/ViewerVTK/imstkVTKScreenCaptureUtility.cpp similarity index 100% rename from Source/ViewerVTK/VTKViewer/imstkVTKScreenCaptureUtility.cpp rename to Source/ViewerVTK/imstkVTKScreenCaptureUtility.cpp diff --git a/Source/ViewerVTK/VTKViewer/imstkVTKScreenCaptureUtility.h b/Source/ViewerVTK/imstkVTKScreenCaptureUtility.h similarity index 100% rename from Source/ViewerVTK/VTKViewer/imstkVTKScreenCaptureUtility.h rename to Source/ViewerVTK/imstkVTKScreenCaptureUtility.h diff --git a/Source/ViewerVTK/VTKViewer/imstkVTKTextStatusManager.cpp b/Source/ViewerVTK/imstkVTKTextStatusManager.cpp similarity index 100% rename from Source/ViewerVTK/VTKViewer/imstkVTKTextStatusManager.cpp rename to Source/ViewerVTK/imstkVTKTextStatusManager.cpp diff --git a/Source/ViewerVTK/VTKViewer/imstkVTKTextStatusManager.h b/Source/ViewerVTK/imstkVTKTextStatusManager.h similarity index 100% rename from Source/ViewerVTK/VTKViewer/imstkVTKTextStatusManager.h rename to Source/ViewerVTK/imstkVTKTextStatusManager.h diff --git a/Source/ViewerVTK/VTKViewer/imstkVTKViewer.cpp b/Source/ViewerVTK/imstkVTKViewer.cpp similarity index 88% rename from Source/ViewerVTK/VTKViewer/imstkVTKViewer.cpp rename to Source/ViewerVTK/imstkVTKViewer.cpp index 41b7e7d5991d5d2d1dc26ce7751c7734dbb44ed7..f81f46c85ed7660cc6d7fee8b786677a2e532bc6 100644 --- a/Source/ViewerVTK/VTKViewer/imstkVTKViewer.cpp +++ b/Source/ViewerVTK/imstkVTKViewer.cpp @@ -152,6 +152,34 @@ VTKViewer::setDebugAxesLength(double x, double y, double z) } } +void +VTKViewer::setInfoLevel(int level) +{ + Viewer::setInfoLevel(level); + + // Level 0 show no info + if (level == 0) + { + getTextStatusManager()->setStatusVisibility(VTKTextStatusManager::StatusType::FPS, false); + getActiveScene()->setEnableTaskTiming(false); + std::dynamic_pointer_cast<VTKRenderer>(getActiveRenderer())->setTimeTableVisibility(false); + } + // Level 1, show fps only + else if (level == 1) + { + getTextStatusManager()->setStatusVisibility(VTKTextStatusManager::StatusType::FPS, true); + getActiveScene()->setEnableTaskTiming(false); + std::dynamic_pointer_cast<VTKRenderer>(getActiveRenderer())->setTimeTableVisibility(false); + } + // Level 2 show fps and timing graph + else if (level == 2) + { + getTextStatusManager()->setStatusVisibility(VTKTextStatusManager::StatusType::FPS, true); + getActiveScene()->setEnableTaskTiming(true); + std::dynamic_pointer_cast<VTKRenderer>(getActiveRenderer())->setTimeTableVisibility(true); + } +} + void VTKViewer::setRenderingMode(const Renderer::Mode mode) { diff --git a/Source/ViewerVTK/VTKViewer/imstkVTKViewer.h b/Source/ViewerVTK/imstkVTKViewer.h similarity index 91% rename from Source/ViewerVTK/VTKViewer/imstkVTKViewer.h rename to Source/ViewerVTK/imstkVTKViewer.h index 73892b40ff738efceef8aae56549cd3caccd3a45..48f4359109f03632df06fce31522fadad4828fcf 100644 --- a/Source/ViewerVTK/VTKViewer/imstkVTKViewer.h +++ b/Source/ViewerVTK/imstkVTKViewer.h @@ -59,6 +59,19 @@ public: /// void setDebugAxesLength(double x, double y, double z); + /// + /// \brief The VTKViewer has 3 levels + /// 0 - no info + /// 1 - framerate + /// 2 - timing graph + /// + void setInfoLevel(int level) override; + + /// + /// \brief Get the amount of info levels + /// + const int getInfoLevelCount() const override { return 3; } + /// /// \brief Access screen shot utility /// diff --git a/Source/ViewerVTK/VTKViewer/vtk_openvr_actions.json b/Source/ViewerVTK/vtk_openvr_actions.json similarity index 100% rename from Source/ViewerVTK/VTKViewer/vtk_openvr_actions.json rename to Source/ViewerVTK/vtk_openvr_actions.json diff --git a/Source/ViewerVTK/VTKViewer/vtk_openvr_binding_oculus_touch.json b/Source/ViewerVTK/vtk_openvr_binding_oculus_touch.json similarity index 100% rename from Source/ViewerVTK/VTKViewer/vtk_openvr_binding_oculus_touch.json rename to Source/ViewerVTK/vtk_openvr_binding_oculus_touch.json diff --git a/Source/Wrappers/CMakeLists.txt b/Source/Wrappers/CMakeLists.txt index eeb250a96d65d90199709c48d86217fe9384a779..4bcac1dfb28c2dc33913fac416fe737480108664 100644 --- a/Source/Wrappers/CMakeLists.txt +++ b/Source/Wrappers/CMakeLists.txt @@ -57,13 +57,15 @@ endif() # Link C Wrapper to the imstk libraries target_link_libraries(iMSTKCWrapper PRIVATE Common + Materials Geometry DataStructures Devices Filtering FilteringCore Materials - Rendering + RenderingCore + RenderingVTK Solvers DynamicalModels CollisionDetection @@ -71,6 +73,8 @@ target_link_libraries(iMSTKCWrapper PRIVATE SceneEntities Scene SimulationManager + ViewerCore + ViewerVTK Constraints Animation) target_compile_options(iMSTKCWrapper PRIVATE diff --git a/Source/Wrappers/SwigInterface/imstkCWrapper.i b/Source/Wrappers/SwigInterface/imstkCWrapper.i index 17edcea14aa18b862ef843ea7b0696d886bdf3b2..f3bc85a2353eea270b1d3150796585369678c538 100644 --- a/Source/Wrappers/SwigInterface/imstkCWrapper.i +++ b/Source/Wrappers/SwigInterface/imstkCWrapper.i @@ -321,8 +321,8 @@ namespace std /* * Rendering */ -%include "../../Rendering/Materials/imstkRenderMaterial.h"; -%include "../../Rendering/Materials/imstkTexture.h"; +%include "../../Materials/imstkRenderMaterial.h"; +%include "../../Materials/imstkTexture.h"; /* * SceneEntities @@ -390,13 +390,21 @@ namespace std %include "../../Scene/imstkPbdObjectCollision.h" %include "../../Scene/imstkSphObjectCollision.h" +/* + * ViewerCore & ViewerVTK + */ +%include "../../ViewerCore/imstkViewer.h"; + +/* + * ViewerVTK + */ +%include "../../ViewerVTK/imstkAbstractVTKViewer.h"; +%include "../../ViewerVTK/imstkVTKViewer.h"; +%include "../../ViewerVTK/imstkVTKTextStatusManager.h"; + /* * SimulationManager */ -%include "../../SimulationManager/imstkViewer.h"; -%include "../../SimulationManager/VTKRenderer/imstkAbstractVTKViewer.h"; -%include "../../SimulationManager/VTKRenderer/imstkVTKViewer.h"; -%include "../../SimulationManager/VTKRenderer/imstkVTKTextStatusManager.h"; %include "../../SimulationManager/imstkSceneManager.h" %include "../../SimulationManager/imstkSimulationManager.h" %include "../../SimulationManager/imstkMouseSceneControl.h"