Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Courses
Scotty3D
Commits
9f1961d7
Commit
9f1961d7
authored
Mar 21, 2021
by
TheNumbat
Browse files
fix cone connectivity (again)
parent
28e4e088
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/geometry/util.cpp
View file @
9f1961d7
...
...
@@ -200,24 +200,32 @@ Data cone(float bradius, float tradius, float height, int sides, bool caps) {
size_t
vert
=
0
;
vertices
[
vert
++
]
=
Vec3
(
0.0
f
,
0.0
f
,
0.0
f
);
float
t
=
0.0
f
;
float
step
=
_2pi
/
n_sides
;
while
(
vert
<=
n_sides
)
{
float
rad
=
(
float
)
vert
/
n_sides
*
_2pi
;
vertices
[
vert
]
=
Vec3
(
std
::
cos
(
rad
)
*
bradius
,
0.0
f
,
std
::
sin
(
rad
)
*
bradius
);
vertices
[
vert
]
=
Vec3
(
std
::
cos
(
t
)
*
bradius
,
0.0
f
,
std
::
sin
(
t
)
*
bradius
);
vert
++
;
t
+=
step
;
}
vertices
[
vert
++
]
=
Vec3
(
0.0
f
,
height
,
0.0
f
);
t
=
0.0
f
;
while
(
vert
<=
n_sides
*
2
+
1
)
{
float
rad
=
(
float
)(
vert
-
n_sides
-
1
)
/
n_sides
*
_2pi
;
vertices
[
vert
]
=
Vec3
(
std
::
cos
(
rad
)
*
tradius
,
height
,
std
::
sin
(
rad
)
*
tradius
);
vertices
[
vert
]
=
Vec3
(
std
::
cos
(
t
)
*
tradius
,
height
,
std
::
sin
(
t
)
*
tradius
);
vert
++
;
t
+=
step
;
}
size_t
v
=
0
;
t
=
0.0
f
;
while
(
vert
<=
vertices
.
size
()
-
4
)
{
float
rad
=
(
float
)
v
/
n_sides
*
_2pi
;
vertices
[
vert
]
=
Vec3
(
std
::
cos
(
rad
)
*
tradius
,
height
,
std
::
sin
(
rad
)
*
tradius
);
vertices
[
vert
+
1
]
=
Vec3
(
std
::
cos
(
rad
)
*
bradius
,
0.0
f
,
std
::
sin
(
rad
)
*
bradius
);
vertices
[
vert
]
=
Vec3
(
std
::
cos
(
t
)
*
tradius
,
height
,
std
::
sin
(
t
)
*
tradius
);
vertices
[
vert
+
1
]
=
Vec3
(
std
::
cos
(
t
)
*
bradius
,
0.0
f
,
std
::
sin
(
t
)
*
bradius
);
vert
+=
2
;
v
++
;
t
+=
step
;
}
vertices
[
vert
]
=
vertices
[
n_sides
*
2
+
2
];
vertices
[
vert
+
1
]
=
vertices
[
n_sides
*
2
+
3
];
...
...
Write
Preview
Markdown
is supported
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