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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Yanjiang He
glow-samples
Commits
05891cef
Commit
05891cef
authored
5 years ago
by
Aaron Grabowy
Browse files
Options
Downloads
Patches
Plain Diff
Various improvements to existing examples
parent
075dc9c8
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
samples/basic/viewer/main.cc
+17
-13
17 additions, 13 deletions
samples/basic/viewer/main.cc
with
17 additions
and
13 deletions
samples/basic/viewer/main.cc
+
17
−
13
View file @
05891cef
...
...
@@ -107,7 +107,7 @@ void advanced_objects(pm::vertex_attribute<tg::pos3> const& pos)
auto
g
=
gv
::
grid
();
pm
::
vertex_attribute
<
tg
::
vec3
>
vnormals
=
pm
::
vertex_normals_by_area
(
pos
);
pm
::
vertex
_attribute
<
float
>
line_widths
=
pos
.
map
([](
tg
::
pos3
p
)
{
return
0.
01
f
*
tg
::
abs
(
p
.
x
);
});
pm
::
edge
_attribute
<
float
>
line_widths
=
m
.
edges
()
.
map
([
&
](
pm
::
edge_handle
e
)
{
return
0.
25
f
*
distance
(
pos
(
e
.
vertexA
()),
pos
(
e
.
vertexB
())
);
});
gv
::
view
(
gv
::
lines
(
pos
).
line_width_world
(
0.01
f
).
normals
(
vnormals
),
"oriented billboard lines"
);
gv
::
view
(
gv
::
lines
(
pos
).
line_width_px
(
10
),
"10px line width"
);
...
...
@@ -289,6 +289,12 @@ void typed_geometry_objects()
gv
::
view
(
gv
::
lines
(
tg
::
aabb3
({
-
0.3
f
,
0
,
-
0.4
f
},
{
0.2
f
,
0.5
f
,
0.1
f
})),
"lines(tg::aabb)"
);
// vector versions
{
std
::
vector
<
tg
::
pos3
>
pts
;
for
(
auto
i
=
0
;
i
<
500
;
++
i
)
pts
.
push_back
(
uniform
(
rng
,
tg
::
sphere3
::
unit
));
gv
::
view
(
pts
,
"point cloud"
);
}
{
std
::
vector
<
tg
::
segment3
>
segs
;
for
(
auto
i
=
0
;
i
<
20
;
++
i
)
...
...
@@ -301,12 +307,6 @@ void typed_geometry_objects()
tris
.
emplace_back
(
uniform
(
rng
,
tg
::
sphere3
::
unit
),
uniform
(
rng
,
tg
::
sphere3
::
unit
),
uniform
(
rng
,
tg
::
sphere3
::
unit
));
gv
::
view
(
tris
,
"tg::triangle soup"
);
}
{
std
::
vector
<
tg
::
pos3
>
pts
;
for
(
auto
i
=
0
;
i
<
500
;
++
i
)
pts
.
push_back
(
uniform
(
rng
,
tg
::
sphere3
::
unit
));
gv
::
view
(
pts
,
"point cloud"
);
}
{
std
::
vector
<
tg
::
box3
>
bbs
;
for
(
auto
i
=
0
;
i
<
4
;
++
i
)
...
...
@@ -323,8 +323,8 @@ void typed_geometry_objects()
bbs
.
push_back
(
tg
::
box3
(
c
,
{
e0
,
e1
,
e2
}));
}
gv
::
view
(
gv
::
lines
(
bbs
),
"tg::box frames"
);
gv
::
view
(
bbs
,
"tg::box soup"
);
gv
::
view
(
gv
::
lines
(
bbs
),
"tg::box frames"
);
}
}
...
...
@@ -508,8 +508,12 @@ void headless_screenshot(pm::vertex_attribute<tg::pos3> const& pos)
void
special_use_cases
(
pm
::
vertex_attribute
<
tg
::
pos3
>
const
&
pos
)
{
// TODO: decoupled camera
gv
::
view
(
pos
,
gv
::
maybe_empty
,
"allows empty renderable"
);
{
auto
g
=
gv
::
grid
();
std
::
vector
<
tg
::
triangle3
>
tris
;
gv
::
view
(
tris
,
gv
::
maybe_empty
,
"allows empty renderable"
);
gv
::
view
(
pos
,
gv
::
maybe_empty
,
"but does not necessarily have to be empty if specified"
);
}
gv
::
view
(
pos
,
gv
::
infinite_accumulation
,
"progressive rendering is not stopped early"
);
...
...
@@ -564,9 +568,9 @@ void special_use_cases(pm::vertex_attribute<tg::pos3> const& pos)
gv
::
view
(
pos
,
"built-in camera"
);
gv
::
view
(
pos
,
"built-in camera"
);
gv
::
view
(
pos
,
camA
,
"custom camera A"
);
gv
::
view
(
pos
,
camA
,
"custom camera A"
);
gv
::
view
(
pos
,
camB
,
"custom camera B"
);
gv
::
view
(
tg
::
aabb3
::
unit_centered
,
camA
,
"custom camera A"
);
gv
::
view
(
pos
,
camB
,
"custom camera B"
);
gv
::
view
(
gv
::
lines
(
pos
),
camB
,
"custom camera B"
);
}
// per default, the camera is reset for each new view (and fit to the scene)
...
...
@@ -574,7 +578,7 @@ void special_use_cases(pm::vertex_attribute<tg::pos3> const& pos)
// configuring gv::reuse_camera means that the current view will use the last camera
// these can be chained indefinitely
{
gv
::
view
(
pos
,
gv
::
preserve_camera
,
"next view use
s
the same camera"
);
gv
::
view
(
pos
,
gv
::
preserve_camera
,
"next view
will
use the same camera"
);
gv
::
view
(
pos
);
gv
::
view
(
pos
,
gv
::
reuse_camera
,
"re-used previous camera"
);
gv
::
view
(
pos
,
gv
::
reuse_camera
,
"re-used previous camera (again)"
);
...
...
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