diff --git a/Examples/AVMNidus/main.cpp b/Examples/AVMNidus/main.cpp index 0e56984773508e84ed3510169e318e0bbf599c91..c57b69ebfde4ddbdeb7e2aab9b33631036491f19 100644 --- a/Examples/AVMNidus/main.cpp +++ b/Examples/AVMNidus/main.cpp @@ -76,7 +76,7 @@ int main(int ac, char **av) sdk->addSceneActor(femObject, femSimulator); sdkSimulator->registerObjectSimulator(femSimulator); - + //------------------------------------------------------- // Create scene actor 2: plane + dummy simulator //------------------------------------------------------- @@ -153,7 +153,7 @@ int main(int ac, char **av) // Run the SDK //------------------------------------------------------- sdk->run(); - + //cleanup sdk->releaseScene(scene); diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index ff8e3d44f87b12c751ff3fd2e7990a0497d84025..69d1c319fc9d812f8a4ee69cb7b5e388471c4b3d 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -23,7 +23,7 @@ function(MIDAS_DOWNLOAD MIDAS_URL FILE_SHA1 LOCAL_FILE) endif() endfunction() -add_subdirectory(vegaFem) +add_subdirectory(FEMSimulator) add_subdirectory(LaparoscopicCamera) add_subdirectory(AVMNidus) add_subdirectory(Shaders) diff --git a/Examples/vegaFem/CMakeLists.txt b/Examples/FEMSimulator/CMakeLists.txt similarity index 99% rename from Examples/vegaFem/CMakeLists.txt rename to Examples/FEMSimulator/CMakeLists.txt index ca228fa57979020c9eefbf4ebba985f1f4f16028..0aaafbfb5a8f5a2c3ce03244e403f8a5f844f4a6 100644 --- a/Examples/vegaFem/CMakeLists.txt +++ b/Examples/FEMSimulator/CMakeLists.txt @@ -1,4 +1,4 @@ -set(APP vegaFemExample) +set(APP FEMSimulator) add_executable(${APP} main.cpp) target_link_libraries(${APP} diff --git a/Examples/vegaFem/main.cpp b/Examples/FEMSimulator/main.cpp similarity index 100% rename from Examples/vegaFem/main.cpp rename to Examples/FEMSimulator/main.cpp diff --git a/Examples/LaparoscopicCamera/CMakeLists.txt b/Examples/LaparoscopicCamera/CMakeLists.txt index 1cd11d9b06947667f68a2d604493fe77d23ce844..aa22dc0bbd20a27a1c58dea3a3233edb5b501294 100644 --- a/Examples/LaparoscopicCamera/CMakeLists.txt +++ b/Examples/LaparoscopicCamera/CMakeLists.txt @@ -1,4 +1,4 @@ -set(APP LapCameraNavigationApp) +set(APP LaparoscopicCamera) add_executable(${APP} main.cpp) target_link_libraries(${APP} diff --git a/Examples/renderCube/main.cpp b/Examples/renderCube/main.cpp deleted file mode 100644 index 1252ed3429161a40374be520a3c4731aa61d0c4a..0000000000000000000000000000000000000000 --- a/Examples/renderCube/main.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// This file is part of the SimMedTK project. -// Copyright (c) Center for Modeling, Simulation, and 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 -// -// 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. -// -//--------------------------------------------------------------------------- -// -// Authors: -// -// Contact: -//--------------------------------------------------------------------------- - -#include "../common/wasdCameraController.h" -#include "../common/KeyPressSDKShutdown.h" -#include "../common/pzrMouseCameraController.h" - -#include <memory> - -#include "IO/initIO.h" -#include "RenderDelegates/initRenderDelegates.h" -#include "VTKRendering/initVTKRendering.h" -#include "Rendering/TextureManager.h" -#include "Geometry/MeshModel.h" -#include "Core/Factory.h" -#include "Core/ViewerBase.h" - -int main() -{ - initRenderDelegates(); - initVTKRendering(); - initIODelegates(); - const bool useVTKRenderer = true; // VTK is the default viewer. - - auto scene = std::make_shared<Scene>(); - - // Create a viewer - std::shared_ptr<ViewerBase> viewer - = Factory<ViewerBase>::createSubclassForGroup("ViewerBase",RenderDelegate::VTK); - if(!useVTKRenderer) - { - viewer.reset(); - viewer - = Factory<ViewerBase>::createSubclassForGroup("ViewerBase",RenderDelegate::Other); - } - - auto cubeModel = std::make_shared<MeshModel>(); - // cubeModel->load("models/cube.obj"); - cubeModel->load("models/blade.3ds"); - - auto renderDetail = std::make_shared<RenderDetail>(SIMMEDTK_RENDER_FACES | SIMMEDTK_RENDER_TEXTURE); - renderDetail->setTextureFilename("textures/cube.png"); - renderDetail->addTexture("decalTexture", "textures/cube.png", "none", "none"); - cubeModel->setRenderDetail(renderDetail); - - if(!useVTKRenderer) - { - TextureManager::addTexture("textures/cube.jpg", "cubetex"); - std::static_pointer_cast<SurfaceMesh>(cubeModel->getMesh())->assignTexture("cubetex"); - } - - auto cube = std::make_shared<StaticSceneObject>(); - - // If you want to use the GL renderer you need to specify the appropiate render delegates - // This can be automated in the future, for now VTK is the default renderer and the delegates - // need to be reset. - cube->setModel(cubeModel); - if(!useVTKRenderer) - { - auto renderDelegate = Factory<RenderDelegate>::createConcreteClassForGroup( - "StaticSceneObjectRenderDelegate",RenderDelegate::Other); - cube->setRenderDelegate(renderDelegate); - - renderDelegate = Factory<RenderDelegate>::createConcreteClassForGroup( - "MeshRenderDelegate",RenderDelegate::Other); - cubeModel->getMesh()->setRenderDelegate(renderDelegate); - } - - // Add the cube to the scene to be rendered - scene->addSceneObject(cube); - - // Register the scene with the viewer, and setup render target - viewer->registerScene(scene, SMRENDERTARGET_SCREEN, ""); - - // Setup the window title in the window manager - viewer->setWindowTitle("SimMedTK RENDER TEST"); - - // Set some viewer properties - viewer->setScreenResolution(800, 640); - - // Setup Scene lighting - if(!useVTKRenderer) - { - auto light = Light::getDefaultLighting(); - assert(light); - scene->addLight(light); - - // Camera setup - auto sceneCamera = Camera::getDefaultCamera(); - assert(sceneCamera); - sceneCamera->setPos(3, 3, 5); - sceneCamera->setFocus(0, 0, -1); - sceneCamera->genProjMat(); - sceneCamera->genViewMat(); - scene->addCamera(sceneCamera); - - // Create the camera controller - auto camCtl = std::make_shared<mstk::Examples::Common::wasdCameraController>(); - auto keyShutdown = std::make_shared<mstk::Examples::Common::KeyPressSDKShutdown>(); - auto pzrCamCtl = std::make_shared<mstk::Examples::Common::pzrMouseCameraController>(); - camCtl->setCamera(sceneCamera); - pzrCamCtl->setCamera(sceneCamera); - - // Link up the event system between this the camera controller and the viewer - viewer->attachEvent(core::EventType::Keyboard, camCtl); - viewer->attachEvent(core::EventType::Keyboard, keyShutdown); - viewer->attachEvent(core::EventType::MouseMove, pzrCamCtl); - viewer->attachEvent(core::EventType::MouseButton, pzrCamCtl); - } - - viewer->exec(); - - return 0; -}