Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
iMSTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ben Boeckel
iMSTK
Commits
27ea8fd4
Commit
27ea8fd4
authored
4 years ago
by
Sreekanth Arikatla
Browse files
Options
Downloads
Patches
Plain Diff
REFAC: Change lighting in the rendering example
parent
6ca77ae9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Examples/Rendering/RenderingExample.cpp
+12
-12
12 additions, 12 deletions
Examples/Rendering/RenderingExample.cpp
with
12 additions
and
12 deletions
Examples/Rendering/RenderingExample.cpp
+
12
−
12
View file @
27ea8fd4
...
...
@@ -93,41 +93,39 @@ main()
// Position camera
auto
cam
=
scene
->
getCamera
();
cam
->
setPosition
(
0
,
0.25
,
1
);
cam
->
setPosition
(
0
,
0.25
,
0.6
);
cam
->
setFocalPoint
(
0
,
0.25
,
0
);
// Lights
auto
directionalLight
=
std
::
make_shared
<
DirectionalLight
>
(
"DirectionalLight"
);
directionalLight
->
setIntensity
(
1
);
directionalLight
->
setIntensity
(
4
);
directionalLight
->
setColor
(
Color
(
1.0
,
0.95
,
0.8
));
directionalLight
->
setCastsShadow
(
true
);
directionalLight
->
setShadowRange
(
1.5
);
scene
->
addLight
(
directionalLight
);
/*
auto pointLight = std::make_shared<PointLight>("PointLight");
pointLight->setIntensity(0.1);
pointLight->setPosition(0.1, 0.2, 0.5);
scene->addLight(pointLight);
*/
auto
pointLight
=
std
::
make_shared
<
PointLight
>
(
"PointLight"
);
pointLight
->
setIntensity
(
0.1
);
pointLight
->
setPosition
(
0.1
,
0.2
,
0.5
);
scene
->
addLight
(
pointLight
);
#ifdef iMSTK_USE_Vulkan
// Sphere
auto
sphereObj
=
apiutils
::
createVisualAnalyticalSceneObject
(
Geometry
::
Type
::
Sphere
,
scene
,
"VisualSphere"
,
0.025
);
auto
sphereMaterial
=
std
::
make_shared
<
RenderMaterial
>
();
auto
sphereMesh
=
sphereObj
->
getVisualGeometry
();
sphereMesh
->
translate
(
0.1
,
0.2
,
0.5
);
sphereMaterial
->
setEmissivity
(
1
);
sphereMaterial
->
setEmissivity
(
2
);
sphereMaterial
->
setCastsShadows
(
false
);
sphereObj
->
getVisualModel
(
0
)
->
setRenderMaterial
(
sphereMaterial
);
#endif
// Plane
auto
planeObj
=
apiutils
::
createVisualAnalyticalSceneObject
(
Geometry
::
Type
::
Plane
,
scene
,
"VisualPlane"
,
10
);
auto
planeMaterial
=
std
::
make_shared
<
RenderMaterial
>
();
planeMaterial
->
setColor
(
Color
::
Dark
Gray
);
planeMaterial
->
setColor
(
Color
::
Light
Gray
);
planeObj
->
getVisualModel
(
0
)
->
setRenderMaterial
(
planeMaterial
);
// Run
simManager
->
setActiveScene
(
scene
);
//simManager->getViewer()->setBackgroundColors(Vec3d(0, 0, 0));
#ifdef iMSTK_USE_Vulkan
auto
viewer
=
std
::
dynamic_pointer_cast
<
VulkanViewer
>
(
simManager
->
getViewer
());
viewer
->
setResolution
(
1000
,
800
);
...
...
@@ -135,6 +133,8 @@ main()
//viewer->enableFullscreen();
#endif
// Run
simManager
->
setActiveScene
(
scene
);
simManager
->
start
(
SimulationStatus
::
Paused
);
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment