Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Analyst WebApp
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Insights
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
fidentis
Analyst WebApp
Commits
2fec543b
There was an error fetching the commit references. Please try again later.
Commit
2fec543b
authored
3 years ago
by
Daniel Schramm
Browse files
Options
Downloads
Patches
Plain Diff
Variable render modes of drawable feature points
parent
47cfea01
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
GUI/src/main/java/cz/fidentis/analyst/scene/DrawableFeaturePoints.java
+73
-0
73 additions, 0 deletions
...java/cz/fidentis/analyst/scene/DrawableFeaturePoints.java
with
73 additions
and
0 deletions
GUI/src/main/java/cz/fidentis/analyst/scene/DrawableFeaturePoints.java
+
73
−
0
View file @
2fec543b
...
...
@@ -36,6 +36,11 @@ public class DrawableFeaturePoints extends Drawable {
*/
private
final
Map
<
Integer
,
Double
>
specialSizes
=
new
HashMap
<>();
/**
* feature points rendered differently than the default render mode
*/
private
final
Map
<
Integer
,
Integer
>
specialRenderModes
=
new
HashMap
<>();
/**
* Constructor.
*
...
...
@@ -145,6 +150,65 @@ public class DrawableFeaturePoints extends Drawable {
public
void
resetAllSizesToDefault
()
{
specialSizes
.
clear
();
}
/**
* Returns render mode of the feature point.
*
* @param index Index of the feature point
* @return The render mode or {@code null}
*/
public
Integer
getRenderMode
(
int
index
)
{
if
(
index
<
0
||
index
>=
featurePoints
.
size
())
{
return
null
;
}
if
(
specialRenderModes
.
containsKey
(
index
))
{
return
specialRenderModes
.
get
(
index
);
}
else
{
return
getRenderMode
();
}
}
/**
* Sets render mode of the feature point.
* The render mode must be {@link GL2#GL_FILL}, {@link GL2#GL_LINE}
* or {@link GL2#GL_POINT}.
*
* @param index Index of the feature point
* @param renderMode New render mode of the feature point
* @throws IllegalArgumentException if renderMode isn't {@code GL_FILL},
* {@code GL_LINE} or {@code GL_POINT}
*/
public
void
setRenderMode
(
int
index
,
int
renderMode
)
{
if
(
renderMode
!=
GL2
.
GL_FILL
&&
renderMode
!=
GL2
.
GL_LINE
&&
renderMode
!=
GL2
.
GL_POINT
)
{
throw
new
IllegalArgumentException
(
"renderMode"
);
}
if
(
index
<
0
||
index
>=
featurePoints
.
size
())
{
return
;
}
if
(
renderMode
==
getRenderMode
())
{
specialRenderModes
.
remove
(
index
);
}
else
{
specialRenderModes
.
put
(
index
,
renderMode
);
}
}
/**
* Removes (possible) special render mode of the feature point.
*
* @param index Index of the feature point
*/
public
void
resetRenderModeToDefault
(
int
index
)
{
setRenderMode
(
index
,
getRenderMode
());
}
/**
* Removes all individual render modes of feature points.
*/
public
void
resetAllRenderModesToDefault
()
{
specialRenderModes
.
clear
();
}
@Override
protected
void
renderObject
(
GL2
gl
)
{
...
...
@@ -158,12 +222,18 @@ public class DrawableFeaturePoints extends Drawable {
for
(
int
i
=
0
;
i
<
featurePoints
.
size
();
i
++)
{
FeaturePoint
fp
=
featurePoints
.
get
(
i
);
Color
specialColor
=
specialColors
.
get
(
i
);
if
(
specialColor
!=
null
)
{
float
[]
tmpRGB
=
{
specialColor
.
getRed
()
/
255
f
,
specialColor
.
getGreen
()
/
255
f
,
specialColor
.
getBlue
()
/
255
f
,
getTransparency
()};
gl
.
glMaterialfv
(
GL2
.
GL_FRONT_AND_BACK
,
GL2
.
GL_DIFFUSE
,
tmpRGB
,
0
);
}
Integer
specialRenderMode
=
specialRenderModes
.
get
(
i
);
if
(
specialRenderMode
!=
null
)
{
gl
.
glPolygonMode
(
GL2
.
GL_FRONT_AND_BACK
,
specialRenderMode
);
}
gl
.
glPushMatrix
();
gl
.
glTranslated
(
fp
.
getX
(),
fp
.
getY
(),
fp
.
getZ
());
GLUquadric
center
=
GLU_CONTEXT
.
gluNewQuadric
();
...
...
@@ -177,6 +247,9 @@ public class DrawableFeaturePoints extends Drawable {
if
(
specialColor
!=
null
)
{
gl
.
glMaterialfv
(
GL2
.
GL_FRONT_AND_BACK
,
GL2
.
GL_DIFFUSE
,
rgba
,
0
);
// set default color
}
if
(
specialRenderMode
!=
null
)
{
gl
.
glPolygonMode
(
GL2
.
GL_FRONT_AND_BACK
,
getRenderMode
());
// set default render mode
}
}
}
...
...
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