Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
glow-samples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Julian Schakib
glow-samples
Commits
8b689a3c
Commit
8b689a3c
authored
5 years ago
by
Jonathan Kunstwald
Browse files
Options
Downloads
Patches
Plain Diff
Expand interactive sample
parent
59eeecb7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
extern/glow-extras
+1
-1
1 addition, 1 deletion
extern/glow-extras
samples/wip/viewer/main.cc
+34
-12
34 additions, 12 deletions
samples/wip/viewer/main.cc
with
35 additions
and
13 deletions
glow-extras
@
74c32ddb
Subproject commit
e6a26d9aba5d56f8bcff82eeb882befe5516ee4c
Subproject commit
74c32ddbaac927c5183e6efaebfc4685ae2fd940
This diff is collapsed.
Click to expand it.
samples/wip/viewer/main.cc
+
34
−
12
View file @
8b689a3c
#include
<iostream>
#include
<random>
#include
<imgui/imgui.h>
#include
<glow/common/str_utils.hh>
#include
<glow/data/TextureData.hh>
#include
<glow/objects/TextureCubeMap.hh>
...
...
@@ -166,17 +167,38 @@ int main()
glow
::
viewer
::
view
(
pos
);
// Interactive
{
// Creating renderables is expensive, cache them whenever possible, and capture by value!
auto
r
=
glow
::
viewer
::
make_renderable
(
pos
);
glow
::
viewer
::
interactive
([
r
](
auto
dt
)
{
auto
r1
=
glow
::
viewer
::
make_renderable
(
pos
);
glow
::
viewer
::
interactive
([
r1
](
auto
dt
)
{
static
auto
time
=
0.
f
;
time
+=
dt
;
r
->
transform
(
tg
::
translation
(
tg
::
vec3
(
tg
::
sin
(
tg
::
angle32
::
from_radians
(
time
*
.5
f
))
*
.5
f
,
0.
f
,
0.
f
)));
r1
->
transform
(
tg
::
translation
(
tg
::
vec3
(
tg
::
sin
(
tg
::
angle32
::
from_radians
(
time
*
.5
f
))
*
.5
f
,
0.
f
,
0.
f
)));
glow
::
viewer
::
view
(
r
);
// Always a cleared view, resetting accumulation each frame
glow
::
viewer
::
view_cleared
(
r1
);
});
// Using imgui in an interactive view
auto
r2
=
glow
::
viewer
::
make_renderable
(
pos
);
glow
::
viewer
::
interactive
([
r2
](
auto
)
{
static
float
configurable
=
0.
f
;
ImGui
::
Begin
(
"Interactive viewer"
);
auto
const
input
=
ImGui
::
SliderFloat
(
"Height"
,
&
configurable
,
-
3.
f
,
3.
f
);
ImGui
::
End
();
r2
->
transform
(
tg
::
translation
(
tg
::
vec3
(
0.
f
,
configurable
,
0.
f
)));
{
auto
v
=
glow
::
viewer
::
view
(
r2
);
// Conditional clear
if
(
input
)
glow
::
viewer
::
clear_accumulation
();
}
});
}
}
// tg objects
...
...
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