Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zhengjiang Hu
glow-samples
Commits
bb14f1ad
Commit
bb14f1ad
authored
Apr 24, 2019
by
Philip Trettner
Browse files
tg objects in viewer
parent
4e327544
Changes
6
Hide whitespace changes
Inline
Side-by-side
glm
@
21a30e11
Compare
477e803f
...
21a30e11
Subproject commit
477e803f388de7ba1ddbf2b46abf0f332eb454b3
Subproject commit
21a30e11164c6ffc1ec12811cf7ce82c9f3b2d1f
glow
@
2b4182a2
Subproject commit
55f4b0eb10488e0bfcc5c35aba15d214898a33a1
Subproject commit
2b4182a2b654dcc8d601188f267058a7ba2e0cd9
glow-extras
@
06673fa9
Subproject commit
87f48ac179239a5ec9ff9e7d8b70752be87c2d1e
Subproject commit
06673fa92980b5a8b2ba04337ee70a818f7adf90
polymesh
@
707da368
Subproject commit
622e04156e2bd771d3131a35fb90008c83b807e3
Subproject commit
707da368c4f7eef2f31818d15a0220c41199bdd7
typed-geometry
@
190c2432
Subproject commit 1
2b7f4ae7ccf066874388d7223d43868bce7c71c
Subproject commit 1
90c2432940026159b2b1bf6ac4561f0d88e4b3d
samples/wip/viewer/main.cc
View file @
bb14f1ad
...
...
@@ -12,6 +12,8 @@
#include <glow-extras/glfw/GlfwContext.hh>
#include <glow-extras/viewer/view.hh>
#include <typed-geometry/tg.hh>
const
bool
sCustomSkybox
=
false
;
int
main
()
...
...
@@ -143,6 +145,57 @@ int main()
}
}
// tg objects
{
auto
v
=
glow
::
viewer
::
grid
();
tg
::
rng
rng
;
view
(
tg
::
segment3
(
tg
::
pos3
(
0
,
0
,
0
),
tg
::
pos3
(
1
,
0
,
0
)),
tg
::
color3
::
red
);
view
(
tg
::
triangle3
({
0
,
0
,
0
},
{
1
,
0
,
0
},
{
0
,
1
,
0
}),
tg
::
color3
::
blue
);
view
(
tg
::
aabb3
({
-
0.3
f
,
0
,
-
0.4
f
},
{
0.2
f
,
0.5
f
,
0.1
f
}),
tg
::
color3
::
green
);
view
(
lines
(
tg
::
aabb3
({
-
0.3
f
,
0
,
-
0.4
f
},
{
0.2
f
,
0.5
f
,
0.1
f
})));
// vector versions
{
std
::
vector
<
tg
::
segment3
>
segs
;
for
(
auto
i
=
0
;
i
<
20
;
++
i
)
segs
.
emplace_back
(
uniform
(
rng
,
tg
::
sphere3
::
unit
),
uniform
(
rng
,
tg
::
sphere3
::
unit
));
view
(
segs
);
}
{
std
::
vector
<
tg
::
triangle3
>
tris
;
for
(
auto
i
=
0
;
i
<
20
;
++
i
)
tris
.
emplace_back
(
uniform
(
rng
,
tg
::
sphere3
::
unit
),
uniform
(
rng
,
tg
::
sphere3
::
unit
),
uniform
(
rng
,
tg
::
sphere3
::
unit
));
view
(
tris
);
}
{
std
::
vector
<
tg
::
pos3
>
pts
;
for
(
auto
i
=
0
;
i
<
500
;
++
i
)
pts
.
push_back
(
uniform
(
rng
,
tg
::
sphere3
::
unit
));
view
(
pts
);
}
{
std
::
vector
<
tg
::
box3
>
bbs
;
for
(
auto
i
=
0
;
i
<
4
;
++
i
)
{
auto
e0
=
uniform_vec
(
rng
,
tg
::
sphere3
::
unit
);
auto
e1
=
cross
(
e0
,
uniform_vec
(
rng
,
tg
::
sphere3
::
unit
));
auto
e2
=
cross
(
e1
,
e0
);
auto
c
=
uniform
(
rng
,
tg
::
ball3
::
unit
);
e0
=
normalize
(
e0
)
*
uniform
(
rng
,
0.2
f
,
0.5
f
);
e1
=
normalize
(
e1
)
*
uniform
(
rng
,
0.2
f
,
0.5
f
);
e2
=
normalize
(
e2
)
*
uniform
(
rng
,
0.2
f
,
0.5
f
);
bbs
.
push_back
(
tg
::
box3
(
c
,
{
e0
,
e1
,
e2
}));
}
view
(
lines
(
bbs
));
view
(
bbs
);
}
}
// Animation
{
// TODO
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment