7 #include "imstkCamera.h" 8 #include "imstkDirectionalLight.h" 9 #include "imstkKeyboardDeviceClient.h" 10 #include "imstkKeyboardSceneControl.h" 11 #include "imstkLogger.h" 12 #include "imstkMeshIO.h" 13 #include "imstkMouseDeviceClient.h" 14 #include "imstkMouseSceneControl.h" 16 #include "imstkRenderMaterial.h" 17 #include "imstkScene.h" 18 #include "imstkSceneManager.h" 19 #include "imstkSceneObject.h" 20 #include "imstkSimulationManager.h" 21 #include "imstkSimulationUtils.h" 22 #include "imstkSurfaceMesh.h" 23 #include "imstkVisualModel.h" 24 #include "imstkVTKViewer.h" 26 using namespace imstk;
40 auto surfaceMesh = MeshIO::read<SurfaceMesh>(iMSTK_DATA_ROOT
"/head/head_revised.obj");
43 material->setDisplayMode(RenderMaterial::DisplayMode::Surface);
45 material->addTexture(std::make_shared<Texture>(iMSTK_DATA_ROOT
"head/HeadTexture_BaseColor.png", Texture::Type::Diffuse));
46 material->addTexture(std::make_shared<Texture>(iMSTK_DATA_ROOT
"head/HeadTexture_Normal.png", Texture::Type::Normal));
47 material->addTexture(std::make_shared<Texture>(iMSTK_DATA_ROOT
"head/HeadTexture_AO.png", Texture::Type::AmbientOcclusion));
48 material->setRecomputeVertexNormals(
false);
51 surfMeshModel->setGeometry(surfaceMesh);
55 headObject->addVisualModel(surfMeshModel);
57 scene->addSceneObject(headObject);
60 scene->getActiveCamera()->setPosition(0.0, 0.25, 0.6);
61 scene->getActiveCamera()->setFocalPoint(0.0, 0.25, 0.0);
67 scene->addLight(
"directionalLight", dirLight);
80 sceneManager->pause();
87 std::shared_ptr<Entity> mouseAndKeyControls =
88 SimulationUtils::createDefaultSceneControl(driver);
89 scene->addSceneObject(mouseAndKeyControls);
93 scene->computeBoundingBox(l, u);
94 const double sceneSize = (u - l).norm();
96 auto rendConfig = std::make_shared<RendererConfig>();
97 rendConfig->m_ssaoConfig.m_enableSSAO =
true;
98 rendConfig->m_ssaoConfig.m_SSAOBlur =
true;
99 rendConfig->m_ssaoConfig.m_SSAORadius = 10.0 * sceneSize;
100 rendConfig->m_ssaoConfig.m_SSAOBias = 0.01 * sceneSize;
101 rendConfig->m_ssaoConfig.m_KernelSize = 128;
void setActiveScene(std::shared_ptr< Scene > scene) override
Set scene to be rendered.
void setColor(const Color &c)
Set the light color.
void addModule(std::shared_ptr< Module > module) override
Add a module to run.
void setIntensity(const double intensity)
Set the light intensity. This value is unbounded.
std::shared_ptr<T> obj = std::make_shared<T>(); equivalent, convenience class for STL shared allocati...
std::shared_ptr< Renderer > getActiveRenderer() const
Retrieve the renderer associated with the current scene.
void setRenderMaterial(std::shared_ptr< RenderMaterial > renderMaterial)
Set/Get render material.
void setActiveScene(std::string newSceneName)
Sets the currently updating scene.
Physically based rendering.
void setVtkLoggerMode(VTKLoggerMode loggerMode)
Set the logger mode.
static LoggerG3 & startLogger()
Starts logger with default sinks, use getInstance to create a logger with no sinks.