Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Benjamin Wagner
Computer Graphik
Commits
53034976
Commit
53034976
authored
Nov 15, 2021
by
Neloress
Browse files
fix
parent
fb39b660
Changes
1
Hide whitespace changes
Inline
Side-by-side
main.cpp
View file @
53034976
...
...
@@ -24,7 +24,7 @@
using
namespace
std
;
int
minVerticies
=
1
;
//16;
int
minVerticies
=
512
;
//16;
int
maxIterations
=
numeric_limits
<
int
>::
max
();
float
minAngle
=
0.2
;
...
...
@@ -135,7 +135,7 @@ vector<float*> prepareColorsForNeighborCount()
}
vector
<
float
*>
colors
;
for
(
float
f
=
0
;
f
<=
1
;
f
+=
(
1.0
/
maxNeighors
))
for
(
float
f
=
0
;
f
<=
1
.0001
;
f
+=
(
1.0
/
maxNeighors
))
{
colors
.
push_back
(
new
float
[
4
]{
f
,
1.0
f
-
f
,
0
,
1
});
}
...
...
@@ -178,6 +178,7 @@ void renderScene() // this function is called when you need to redraw the scene
glMaterialfv
(
GL_FRONT
,
GL_AMBIENT
,
mat_ambient
);
glBegin
(
GL_TRIANGLES
);
int
pos
;
for
(
size_t
i
=
0
;
i
<
allTriangles
.
size
();
i
++
)
{
...
...
@@ -188,7 +189,13 @@ void renderScene() // this function is called when you need to redraw the scene
glMaterialfv
(
GL_FRONT
,
GL_DIFFUSE
,
mat_diffuse
);
break
;
case
1
:
// neighbor count
glMaterialfv
(
GL_FRONT
,
GL_DIFFUSE
,
neighborColors
[
allTriangles
.
at
(
i
).
neighborCountTriangles
]);
pos
=
(
allTriangles
.
at
(
i
).
neighborCountTriangles
-
3
);
if
(
pos
<
0
)
{
pos
=
0
;
}
glMaterialfv
(
GL_FRONT
,
GL_DIFFUSE
,
neighborColors
[
pos
]);
break
;
case
2
:
// colors for face normals
glMaterialfv
(
GL_FRONT
,
GL_DIFFUSE
,
calcNormalColor
(
allTriangles
.
at
(
i
).
flatShading
));
...
...
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