Commit 0afb2022 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla

REFAC: remove test prefix from folder, function and project names

Remove shader compilation code from audio example
remove PBDFluid benchmarking example
parent 4078d493
......@@ -32,7 +32,7 @@
using namespace imstk;
// Example modified from SFML/Examples
void testSound(const std::string& filename)
void playSound(const std::string& filename)
{
#ifdef iMSTK_AUDIO_ENABLED
// Load a sound buffer from a .wav file
......@@ -124,7 +124,7 @@ void main()
LOG(INFO) << "--Testing audio--\n";
// Test a sound
testSound(iMSTK_DATA_ROOT "/sound/canary.wav");
playSound(iMSTK_DATA_ROOT "/sound/canary.wav");
// Test music from an .ogg file
playMusic(iMSTK_DATA_ROOT "/sound/orchestral.ogg");
......
......@@ -16,12 +16,12 @@
#
###########################################################################
project(Example-AudioTest)
project(Example-Audio)
#-----------------------------------------------------------------------------
# Create executable
#-----------------------------------------------------------------------------
add_executable(${PROJECT_NAME} AudioTest.cpp)
add_executable(${PROJECT_NAME} Audio.cpp)
#-----------------------------------------------------------------------------
# Link libraries to executable
......@@ -43,50 +43,4 @@ list(APPEND FILE_LIST
imstk_add_data(${PROJECT_NAME} ${FILE_LIST})
#-----------------------------------------------------------------------------
# Shaders
#-----------------------------------------------------------------------------
function(compileShaders sourceShader binaryShader)
add_custom_command(
TARGET ${PROJECT_NAME}
COMMAND glslangvalidator -V ${PROJECT_BINARY_DIR}/Shaders/VulkanShaders/${sourceShader} -o ${PROJECT_BINARY_DIR}/Shaders/VulkanShaders/${binaryShader})
endfunction()
if( iMSTK_USE_Vulkan )
file(COPY ${CMAKE_SOURCE_DIR}/Source/Rendering/VulkanRenderer/VulkanShaders
DESTINATION ${PROJECT_BINARY_DIR}/Shaders)
# Mesh shaders
compileShaders(Mesh/mesh_vert.vert Mesh/mesh_vert.spv)
compileShaders(Mesh/mesh_tesc.tesc Mesh/mesh_tesc.spv)
compileShaders(Mesh/mesh_tese.tese Mesh/mesh_tese.spv)
compileShaders(Mesh/mesh_frag.frag Mesh/mesh_frag.spv)
compileShaders(Mesh/decal_vert.vert Mesh/decal_vert.spv)
compileShaders(Mesh/decal_frag.frag Mesh/decal_frag.spv)
compileShaders(Mesh/shadow_vert.vert Mesh/shadow_vert.spv)
compileShaders(Mesh/shadow_frag.frag Mesh/shadow_frag.spv)
compileShaders(Mesh/depth_frag.frag Mesh/depth_frag.spv)
# Post processing shaders
compileShaders(PostProcessing/HDR_tonemap_frag.frag PostProcessing/HDR_tonemap_frag.spv)
compileShaders(PostProcessing/postprocess_vert.vert PostProcessing/postprocess_vert.spv)
compileShaders(PostProcessing/postprocess_frag.frag PostProcessing/postprocess_frag.spv)
compileShaders(PostProcessing/sss_frag.frag PostProcessing/sss_frag.spv)
compileShaders(PostProcessing/composite_frag.frag PostProcessing/composite_frag.spv)
compileShaders(PostProcessing/bloom_threshold_frag.frag PostProcessing/bloom_threshold_frag.spv)
compileShaders(PostProcessing/blur_horizontal_frag.frag PostProcessing/blur_horizontal_frag.spv)
compileShaders(PostProcessing/blur_vertical_frag.frag PostProcessing/blur_vertical_frag.spv)
compileShaders(PostProcessing/bloom_threshold_frag.frag PostProcessing/bloom_threshold_frag.spv)
compileShaders(PostProcessing/ao_frag.frag PostProcessing/ao_frag.spv)
compileShaders(PostProcessing/bilateral_blur_horizontal_frag.frag PostProcessing/bilateral_blur_horizontal_frag.spv)
compileShaders(PostProcessing/bilateral_blur_vertical_frag.frag PostProcessing/bilateral_blur_vertical_frag.spv)
compileShaders(PostProcessing/depth_downscale_frag.frag PostProcessing/depth_downscale_frag.spv)
file(COPY ${PROJECT_BINARY_DIR}/Shaders/VulkanShaders
DESTINATION ${CMAKE_PROGRAM_PATH}/Shaders)
else( iMSTK_USE_Vulkan )
file(COPY ${CMAKE_SOURCE_DIR}/Source/Rendering/VTKRenderer/VTKShaders
DESTINATION ${PROJECT_BINARY_DIR}/Shaders)
file(COPY ${CMAKE_SOURCE_DIR}/Source/Rendering/VTKRenderer/VTKShaders
DESTINATION ${CMAKE_PROGRAM_PATH}/Shaders)
endif()
......@@ -50,11 +50,11 @@ const std::string phantomOmni1Name = "Phantom1";
using namespace imstk;
void testBoneDrilling()
void doBoneDrilling()
{
// SDK and Scene
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("BoneDrillingTest");
auto scene = sdk->createNewScene("BoneDrilling");
// Add virtual coupling object in the scene.
#ifdef iMSTK_USE_OPENHAPTICS
......@@ -123,6 +123,6 @@ void testBoneDrilling()
int main()
{
testBoneDrilling();
doBoneDrilling();
return 0;
}
......@@ -34,11 +34,11 @@ const std::string phantomOmni1Name = "Phantom1";
using namespace imstk;
void testCameraController()
void doCameraController()
{
// SDK and Scene
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("CameraControllerTest");
auto scene = sdk->createNewScene("CameraController");
#ifdef iMSTK_USE_OPENHAPTICS
......@@ -88,7 +88,7 @@ void testCameraController()
int main()
{
testCameraController();
doCameraController();
return 0;
}
......@@ -39,7 +39,7 @@ void testDeformableBody()
{
// a. SDK and Scene
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("DeformableBodyTest");
auto scene = sdk->createNewScene("DeformableBody");
scene->getCamera()->setPosition(0, 2.0, 15.0);
// b. Load a tetrahedral mesh
......
......@@ -25,7 +25,7 @@
using namespace imstk;
void testExtractSurfaceMesh()
void extractSurfaceMesh()
{
auto sdk = std::make_shared<SimulationManager>();
......@@ -70,7 +70,7 @@ void testExtractSurfaceMesh()
int main()
{
testExtractSurfaceMesh();
extractSurfaceMesh();
return 0;
}
......@@ -28,11 +28,11 @@
using namespace imstk;
void testGeometryTransforms()
void geometryTransforms()
{
// SDK and Scene
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("testGeometryTransforms");
auto scene = sdk->createNewScene("GeometryTransforms");
auto sceneObj = apiutils::createAndAddVisualSceneObject(scene, iMSTK_DATA_ROOT "/asianDragon/asianDragon.obj", "Dragon");
......@@ -96,6 +96,6 @@ void testGeometryTransforms()
int main()
{
testGeometryTransforms();
geometryTransforms();
return 0;
}
......@@ -16,12 +16,12 @@
#
###########################################################################
project(Example-GraphTest)
project(Example-Graph)
#-----------------------------------------------------------------------------
# Create executable
#-----------------------------------------------------------------------------
add_executable(${PROJECT_NAME} GraphTest.cpp)
add_executable(${PROJECT_NAME} Graph.cpp)
#-----------------------------------------------------------------------------
# Link libraries to executable
......@@ -40,52 +40,4 @@ endif()
list(APPEND FILE_LIST
asianDragon/,REGEX:.*)
imstk_add_data(${PROJECT_NAME} ${FILE_LIST})
#-----------------------------------------------------------------------------
# Shaders
#-----------------------------------------------------------------------------
function(compileShaders sourceShader binaryShader)
add_custom_command(
TARGET ${PROJECT_NAME}
COMMAND glslangvalidator -V ${PROJECT_BINARY_DIR}/Shaders/VulkanShaders/${sourceShader} -o ${PROJECT_BINARY_DIR}/Shaders/VulkanShaders/${binaryShader})
endfunction()
if( iMSTK_USE_Vulkan )
file(COPY ${CMAKE_SOURCE_DIR}/Source/Rendering/VulkanRenderer/VulkanShaders
DESTINATION ${PROJECT_BINARY_DIR}/Shaders)
# Mesh shaders
compileShaders(Mesh/mesh_vert.vert Mesh/mesh_vert.spv)
compileShaders(Mesh/mesh_tesc.tesc Mesh/mesh_tesc.spv)
compileShaders(Mesh/mesh_tese.tese Mesh/mesh_tese.spv)
compileShaders(Mesh/mesh_frag.frag Mesh/mesh_frag.spv)
compileShaders(Mesh/decal_vert.vert Mesh/decal_vert.spv)
compileShaders(Mesh/decal_frag.frag Mesh/decal_frag.spv)
compileShaders(Mesh/shadow_vert.vert Mesh/shadow_vert.spv)
compileShaders(Mesh/shadow_frag.frag Mesh/shadow_frag.spv)
compileShaders(Mesh/depth_frag.frag Mesh/depth_frag.spv)
# Post processing shaders
compileShaders(PostProcessing/HDR_tonemap_frag.frag PostProcessing/HDR_tonemap_frag.spv)
compileShaders(PostProcessing/postprocess_vert.vert PostProcessing/postprocess_vert.spv)
compileShaders(PostProcessing/postprocess_frag.frag PostProcessing/postprocess_frag.spv)
compileShaders(PostProcessing/sss_frag.frag PostProcessing/sss_frag.spv)
compileShaders(PostProcessing/composite_frag.frag PostProcessing/composite_frag.spv)
compileShaders(PostProcessing/bloom_threshold_frag.frag PostProcessing/bloom_threshold_frag.spv)
compileShaders(PostProcessing/blur_horizontal_frag.frag PostProcessing/blur_horizontal_frag.spv)
compileShaders(PostProcessing/blur_vertical_frag.frag PostProcessing/blur_vertical_frag.spv)
compileShaders(PostProcessing/bloom_threshold_frag.frag PostProcessing/bloom_threshold_frag.spv)
compileShaders(PostProcessing/ao_frag.frag PostProcessing/ao_frag.spv)
compileShaders(PostProcessing/bilateral_blur_horizontal_frag.frag PostProcessing/bilateral_blur_horizontal_frag.spv)
compileShaders(PostProcessing/bilateral_blur_vertical_frag.frag PostProcessing/bilateral_blur_vertical_frag.spv)
compileShaders(PostProcessing/depth_downscale_frag.frag PostProcessing/depth_downscale_frag.spv)
file(COPY ${PROJECT_BINARY_DIR}/Shaders/VulkanShaders
DESTINATION ${CMAKE_PROGRAM_PATH}/Shaders)
else( iMSTK_USE_Vulkan )
file(COPY ${CMAKE_SOURCE_DIR}/Source/Rendering/VTKRenderer/VTKShaders
DESTINATION ${PROJECT_BINARY_DIR}/Shaders)
file(COPY ${CMAKE_SOURCE_DIR}/Source/Rendering/VTKRenderer/VTKShaders
DESTINATION ${CMAKE_PROGRAM_PATH}/Shaders)
endif()
imstk_add_data(${PROJECT_NAME} ${FILE_LIST})
\ No newline at end of file
......@@ -25,7 +25,7 @@
using namespace imstk;
void testGraph()
void sampleGraph()
{
Graph g1(5);
g1.addEdge(0, 1);
......@@ -77,6 +77,6 @@ void testGraph()
int main()
{
testGraph();
sampleGraph();
return 0;
}
......@@ -29,12 +29,12 @@ const std::string phantomOmni1Name = "Phantom1";
using namespace imstk;
void testLapToolController()
void lapToolController()
{
#ifdef iMSTK_USE_OPENHAPTICS
// SDK and Scene
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("TestLapToolController");
auto scene = sdk->createNewScene("LapToolController");
// Device clients
auto client0 = std::make_shared<HDAPIDeviceClient>(phantomOmni1Name);
......@@ -80,7 +80,7 @@ void testLapToolController()
int main()
{
testLapToolController();
lapToolController();
return 0;
}
......@@ -25,11 +25,11 @@
using namespace imstk;
void testReadMesh()
void readMesh()
{
// SDK and Scene
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("testReadMesh");
auto scene = sdk->createNewScene("ReadMesh");
// Read surface mesh
/*auto objMesh = MeshIO::read(iMSTK_DATA_ROOT"/asianDragon/asianDragon.obj");
......@@ -65,6 +65,6 @@ void testReadMesh()
int main()
{
testReadMesh();
readMesh();
return 0;
}
......@@ -25,11 +25,11 @@
using namespace imstk;
void testMshAndVegaIO()
void MshAndVegaIO()
{
// SDK and Scene
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("testMshAndVegaIO");
auto scene = sdk->createNewScene("MshAndVegaIO");
// Load a volumetric mesh (from .msh file)
std::string ifile = iMSTK_DATA_ROOT "/liver/liver.msh";
......@@ -92,6 +92,6 @@ void testMshAndVegaIO()
int main()
{
testMshAndVegaIO();
MshAndVegaIO();
return 0;
}
......@@ -30,12 +30,12 @@ const std::string phantomOmni1Name = "Phantom1";
using namespace imstk;
void testObjectController()
void objectController()
{
#ifdef iMSTK_USE_OPENHAPTICS
// SDK and Scene
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("ObjectControllerTest");
auto scene = sdk->createNewScene("ObjectController");
// Device Client
auto client = std::make_shared<HDAPIDeviceClient>(phantomOmni1Name);
......@@ -79,6 +79,6 @@ void testObjectController()
int main()
{
testObjectController();
objectController();
return 0;
}
......@@ -26,10 +26,10 @@
using namespace imstk;
void testPbdCloth()
void pbdCloth()
{
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("PBDClothTest");
auto scene = sdk->createNewScene("PBDCloth");
// a. Construct a sample triangular mesh
......@@ -128,7 +128,7 @@ void testPbdCloth()
int main()
{
testPbdCloth();
pbdCloth();
return 0;
}
......@@ -28,10 +28,10 @@
using namespace imstk;
void testPbdCollision()
void pbdCollision()
{
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("PbdCollisionTest");
auto scene = sdk->createNewScene("PbdCollision");
scene->getCamera()->setPosition(0, 10.0, 10.0);
......@@ -353,6 +353,6 @@ void testPbdCollision()
int main()
{
testPbdCollision();
pbdCollision();
return 0;
}
......@@ -28,10 +28,10 @@
using namespace imstk;
void testPbdFluid()
void pbdFluid()
{
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("PBDFluidTest");
auto scene = sdk->createNewScene("PBDFluid");
scene->getCamera()->setPosition(0, 10.0, 15.0);
......@@ -249,6 +249,6 @@ void testPbdFluid()
int main()
{
testPbdFluid();
pbdFluid();
return 0;
}
###########################################################################
#
# 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.
#
###########################################################################
project(Example-PBDFluidsBenchmarking)
#-----------------------------------------------------------------------------
# Create executable
#-----------------------------------------------------------------------------
add_executable(${PROJECT_NAME} PBDFluidsBenchmarkingExample.cpp)
#-----------------------------------------------------------------------------
# Link libraries to executable
#-----------------------------------------------------------------------------
if(UNIX)
target_link_libraries(${PROJECT_NAME}
SimulationManager)
else()
target_link_libraries(${PROJECT_NAME}
SimulationManager
SFML)
endif()
#-----------------------------------------------------------------------------
# Shaders
#-----------------------------------------------------------------------------
function(compileShaders sourceShader binaryShader)
add_custom_command(
TARGET ${PROJECT_NAME}
COMMAND glslangvalidator -V ${PROJECT_BINARY_DIR}/Shaders/VulkanShaders/${sourceShader} -o ${PROJECT_BINARY_DIR}/Shaders/VulkanShaders/${binaryShader})
endfunction()
if( iMSTK_USE_Vulkan )
file(COPY ${CMAKE_SOURCE_DIR}/Source/Rendering/VulkanRenderer/VulkanShaders
DESTINATION ${PROJECT_BINARY_DIR}/Shaders)
# Mesh shaders
compileShaders(Mesh/mesh_vert.vert Mesh/mesh_vert.spv)
compileShaders(Mesh/mesh_tesc.tesc Mesh/mesh_tesc.spv)
compileShaders(Mesh/mesh_tese.tese Mesh/mesh_tese.spv)
compileShaders(Mesh/mesh_frag.frag Mesh/mesh_frag.spv)
compileShaders(Mesh/decal_vert.vert Mesh/decal_vert.spv)
compileShaders(Mesh/decal_frag.frag Mesh/decal_frag.spv)
compileShaders(Mesh/shadow_vert.vert Mesh/shadow_vert.spv)
compileShaders(Mesh/shadow_frag.frag Mesh/shadow_frag.spv)
compileShaders(Mesh/depth_frag.frag Mesh/depth_frag.spv)
# Post processing shaders
compileShaders(PostProcessing/HDR_tonemap_frag.frag PostProcessing/HDR_tonemap_frag.spv)
compileShaders(PostProcessing/postprocess_vert.vert PostProcessing/postprocess_vert.spv)
compileShaders(PostProcessing/postprocess_frag.frag PostProcessing/postprocess_frag.spv)
compileShaders(PostProcessing/sss_frag.frag PostProcessing/sss_frag.spv)
compileShaders(PostProcessing/composite_frag.frag PostProcessing/composite_frag.spv)
compileShaders(PostProcessing/bloom_threshold_frag.frag PostProcessing/bloom_threshold_frag.spv)
compileShaders(PostProcessing/blur_horizontal_frag.frag PostProcessing/blur_horizontal_frag.spv)
compileShaders(PostProcessing/blur_vertical_frag.frag PostProcessing/blur_vertical_frag.spv)
compileShaders(PostProcessing/bloom_threshold_frag.frag PostProcessing/bloom_threshold_frag.spv)
compileShaders(PostProcessing/ao_frag.frag PostProcessing/ao_frag.spv)
compileShaders(PostProcessing/bilateral_blur_horizontal_frag.frag PostProcessing/bilateral_blur_horizontal_frag.spv)
compileShaders(PostProcessing/bilateral_blur_vertical_frag.frag PostProcessing/bilateral_blur_vertical_frag.spv)
compileShaders(PostProcessing/depth_downscale_frag.frag PostProcessing/depth_downscale_frag.spv)
file(COPY ${PROJECT_BINARY_DIR}/Shaders/VulkanShaders
DESTINATION ${CMAKE_PROGRAM_PATH}/Shaders)
else( iMSTK_USE_Vulkan )
file(COPY ${CMAKE_SOURCE_DIR}/Source/Rendering/VTKRenderer/VTKShaders
DESTINATION ${PROJECT_BINARY_DIR}/Shaders)
file(COPY ${CMAKE_SOURCE_DIR}/Source/Rendering/VTKRenderer/VTKShaders
DESTINATION ${CMAKE_PROGRAM_PATH}/Shaders)
endif()
/*=========================================================================
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 "imstkSimulationManager.h"
#include "imstkMeshIO.h"
#include "imstkPbdObject.h"
#include "imstkPbdSolver.h"
#include "imstkOneToOneMap.h"
#include "imstkAPIUtilities.h"
using namespace imstk;
void testPbdFluidBenchmarking()
{
std::vector<int> nPointsList = { 5, 10, 20 };
std::vector<int> cubeSizeList = { 1, 1, 2 };
int nPointsPerSide = 10;
double cubeLength = 1;
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("PBDFluidBenchmarking");
scene->getCamera()->setPosition(0, 10.0, 25.0);
//Create PointSet
StdVectorOfVec3d vertList;
int nPoints = pow(nPointsPerSide, 3);
const double spacing = cubeLength / nPointsPerSide;
vertList.resize(nPoints);
for (int i = 0; i < nPointsPerSide; ++i)
{
for (int j = 0; j < nPointsPerSide; j++)
{
for (int k = 0; k < nPointsPerSide; k++)
{
vertList[i*nPointsPerSide*nPointsPerSide + j*nPointsPerSide + k] =
Vec3d((double)i * spacing, (double)j * spacing, (double)k * spacing);
}
}
}
auto cubeMesh = std::make_shared<PointSet>();
cubeMesh->initialize(vertList);
auto material = std::make_shared<RenderMaterial>();
material->setDiffuseColor(Color::Blue);
material->setSphereGlyphSize(.1);
cubeMesh->setRenderMaterial(material);
auto cube = std::make_shared<PbdObject>("Cube");
cube->setCollidingGeometry(cubeMesh);
cube->setVisualGeometry(cubeMesh);
cube->setPhysicsGeometry(cubeMesh);
auto pbdModel = std::make_shared<PbdModel>();
pbdModel->setModelGeometry(cubeMesh);
pbdModel->configure(/*Number of Constraints*/ 1,
/*Constraint configuration*/ "ConstantDensity 1.0 0.3",
/*Mass*/ 1.0,
/*Gravity*/ "0 -9.8 0",
/*TimeStep*/ 0.005,
/*FixedPoint*/ "",
/*NumberOfIterationInConstraintSolver*/ 2,
/*Proximity*/ 0.2,
/*Contact stiffness*/ 1.0);
cube->setDynamicalModel(pbdModel);
auto pbdSolver = std::make_shared<PbdSolver>();
pbdSolver->setPbdObject(cube);
scene->addNonlinearSolver(pbdSolver);
scene->addSceneObject(cube);
// plane
double width = 40.0;
double height = 40.0;
int nRows = 2;
int nCols = 2;
vertList.resize(nRows*nCols);
const double dy = width / (double)(nCols - 1);
const double dx = height / (double)(nRows - 1);
for (int i = 0; i < nRows; ++i)
{
for (int j = 0; j < nCols; j++)
{
const double y = (double)dy*j;
const double x = (double)dx*i;
vertList[i*nCols + j] = Vec3d(x - 20, -0.5, y - 20);
}
}
// c. Add connectivity data
std::vector<SurfaceMesh::TriangleArray> triangles;
for (std::size_t i = 0; i < nRows - 1; ++i)
{
for (std::size_t j = 0; j < nCols - 1; j++)
{
SurfaceMesh::TriangleArray tri[2];
tri[0] = { { i*nCols + j, i*nCols + j + 1, (i + 1)*nCols + j } };
tri[1] = { { (i + 1)*nCols + j + 1, (i + 1)*nCols + j, i*nCols + j + 1 } };
triangles.push_back(tri[0]);
triangles.push_back(tri[1]);
}
}
auto floorMeshColliding = std::make_shared<SurfaceMesh>();
floorMeshColliding->initialize(vertList, triangles);
auto floorMeshVisual = std::make_shared<SurfaceMesh>();
floorMeshVisual->initialize(vertList, triangles);
auto floorMeshPhysics = std::make_shared<SurfaceMesh>();
floorMeshPhysics->initialize(vertList, triangles);
auto floorMapP2V = std::make_shared<OneToOneMap>();
floorMapP2V->setMaster(floorMeshPhysics);
floorMapP2V->setSlave(floorMeshVisual);
floorMapP2V->compute();
auto floorMapP2C = std::make_shared<OneToOneMap>();
floorMapP2C->setMaster(floorMeshPhysics);
floorMapP2C->setSlave(floorMeshColliding);
floorMapP2C->compute();
auto floorMapC2V = std::make_shared<OneToOneMap>();
floorMapC2V->setMaster(floorMeshColliding);
floorMapC2V->setSlave(floorMeshVisual);
floorMapC2V->compute();
auto floor = std::make_shared<PbdObject>("Floor");
floor->setCollidingGeometry(floorMeshColliding);
floor->setVisualGeometry(floorMeshVisual);
floor->setPhysicsGeometry(floorMeshPhysics);
floor->setPhysicsToCollidingMap(floorMapP2C);
floor->setPhysicsToVisualMap(floorMapP2V);
floor->setCollidingToVisualMap(floorMapC2V);
auto pbdModel2 = std::make_shared<PbdModel>();
pbdModel2->setModelGeometry(floorMeshPhysics);
pbdModel2->configure(/*Number of Constraints*/ 0,
/*Mass*/ 0.0,
/*Proximity*/ 0.1,
/*Contact stiffness*/ 1.0);
floor->setDynamicalModel(pbdModel2);
auto pbdSolverfloor = std::make_shared<PbdSolver>();
pbdSolverfloor->setPbdObject(floor);
scene->addNonlinearSolver(pbdSolverfloor);
scene->addSceneObject(floor);
// Collisions
auto colGraph = scene->getCollisionGraph();
auto pair = std::make_shared<PbdInteractionPair>(PbdInteractionPair(cube, floor));
pair->setNumberOfInterations(2);
auto dynaModel1 = std::static_pointer_cast<PbdModel>(cube->getDynamicalModel());
colGraph->addInteractionPair(pair);
// print UPS
auto ups = std::make_shared<UPSCounter>();
apiutils::printUPS(sdk->getSceneManager(scene), ups);
// Light (white)
auto whiteLight = std::make_shared<DirectionalLight>("whiteLight");
whiteLight->setFocalPoint(Vec3d(5, -8, -5));
whiteLight->setIntensity(7);
scene->addLight(whiteLight);
scene->getCamera()->setPosition(0, 10.0, 10.0);
sdk->setActiveScene(scene);
sdk->startSimulation(SimulationStatus::PAUSED);
}
int main()
{
testPbdFluidBenchmarking();
return 0;
}
......@@ -28,10 +28,10 @@
using namespace imstk;
void testPbdVolume()
void pbdVolume()
{