Commit d922f1f2 authored by Nicholas Milef's avatar Nicholas Milef

ENH: added head rendering example

parent 6745bdbf
5658edf259cd65f4d78b836f0c45d3c264a87d1c857e142b76bebb8931e4395af329417e260bd00c445ed776d1381a6d595f108e1f143be635c9d79739f66c7b
\ No newline at end of file
578fe4ffdcfe7e03f0f176fbdea00c97e00de1132494b741e6db45ecc2ee7d3121dc7ec1775966ec57d083dfb78ac247e9efd7daf04b367c0f931fc7b30e58a7
\ No newline at end of file
2b3ac2596835a43166c2761932b2325f6bbd9fad2860df7caa4e7a409b037cae2a1c240b674db7440169713a7086c4699b89664209be4f804eebc524d5162bb2
\ No newline at end of file
ef2bfa4f8989457b16f3e5beb8d568a187a3c459c38f3f817745bb816e6d20c000a0eb9aca0953f3a79550b43fee85940b47caee27ef518ae41cf36538e1db22
\ No newline at end of file
b873c9a63b43ae89d7109091e13c125a86bf06c8f02f0b720040bea1f435a386971941f690583eb817ebd610361b55e03884b5de6a7663375e740b8cb9a04435
\ No newline at end of file
eab26eb96b03f966d805ce1f4f3a2a31d948284533240f2e818a8606da64af65fd096707f9842b77d49d9ed9f4c6150185c618ec3786979cc2d6a77f7671dbc4
\ No newline at end of file
cc676a2e3711e03730de25cf1915830aaff04f16481e00f3a0c360ce6ee4c28494358ff6b66779a36c4ea2962b5444ef91ba9d8fd7ade6a7c76b9d19d661068e
\ No newline at end of file
2d2c7a33bc6c0b409224eb69c66fef8d13d6cb6ca9c42427fe9221f778a511e21f58d0edf9c043cb0610c1a14d3f4e41132646a67d0c3c520badb12006d5d0d4
\ No newline at end of file
......@@ -44,6 +44,7 @@ list(APPEND FILE_LIST
biceps_zones/,REGEX:.*
cube/,REGEX:*
cylinder/,REGEX:.*
head/,REGEX:.*
human/,REGEX:.*
laptool/,REGEX:.*
liver/,REGEX:.*
......
......@@ -844,6 +844,48 @@ void testViewer()
sdk->startSimulation(true);
}
void testRendering()
{
// SDK and Scene
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("RenderingTest");
// Head mesh
auto head = MeshIO::read(iMSTK_DATA_ROOT "/head/head_revised.obj");
auto headMesh = std::dynamic_pointer_cast<SurfaceMesh>(head);
auto headObject = std::make_shared<VisualObject>("Head");
headObject->setVisualGeometry(headMesh);
scene->addSceneObject(headObject);
// Head material
auto headMaterial = std::make_shared<RenderMaterial>();
auto headDiffuseTexture = std::make_shared<Texture>(iMSTK_DATA_ROOT "/head/diffuse.jpg", Texture::DIFFUSE);
auto headNormalTexture = std::make_shared<Texture>(iMSTK_DATA_ROOT "/head/normal.png", Texture::NORMAL);
auto headRoughnessTexture = std::make_shared<Texture>(iMSTK_DATA_ROOT "/head/roughness.jpg", Texture::ROUGHNESS);
auto headSSSTexture = std::make_shared<Texture>(iMSTK_DATA_ROOT "/head/sss.jpg", Texture::SUBSURFACE_SCATTERING);
headMaterial->addTexture(headDiffuseTexture);
headMaterial->addTexture(headNormalTexture);
headMaterial->addTexture(headRoughnessTexture);
headMaterial->addTexture(headSSSTexture);
headMesh->setRenderMaterial(headMaterial);
// Position camera
auto cam = scene->getCamera();
cam->setPosition(0, 0.25, 2);
cam->setFocalPoint(0, 0.25, 0);
// Light
auto light = std::make_shared<DirectionalLight>("Light");
light->setIntensity(7);
light->setColor(Color(1.0, 0.95, 0.8));
scene->addLight(light);
// Run
sdk->setActiveScene(scene);
sdk->getViewer()->setBackgroundColors(Vec3d(0, 0, 0));
sdk->startSimulation(true);
}
void testCapsule()
{
// SDK and Scene
......@@ -3522,6 +3564,7 @@ int main()
------------------*/
//testMultiObjectWithTextures();
//testViewer();
testRendering();
//testScreenShotUtility();
//testCapsule();
......
......@@ -48,6 +48,7 @@ VTKInteractorStyle::VTKInteractorStyle()
VTKInteractorStyle::~VTKInteractorStyle()
{
m_fpsActor->Delete();
this->SetReferenceCount(0);
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment