Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Illuna-Minetest
illuna-minetest
Commits
9357294c
Commit
9357294c
authored
9 years ago
by
RealBadAngel
Committed by
Kahrl
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use single box for halo mesh
parent
c1044b9a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/hud.cpp
+18
-3
18 additions, 3 deletions
src/hud.cpp
src/hud.h
+1
-0
1 addition, 0 deletions
src/hud.h
src/mesh.cpp
+10
-22
10 additions, 22 deletions
src/mesh.cpp
src/mesh.h
+2
-1
2 additions, 1 deletion
src/mesh.h
with
31 additions
and
26 deletions
src/hud.cpp
+
18
−
3
View file @
9357294c
...
...
@@ -84,6 +84,8 @@ Hud::Hud(video::IVideoDriver *driver, scene::ISceneManager* smgr,
m_selection_mesh
=
NULL
;
m_selection_boxes
.
clear
();
m_halo_boxes
.
clear
();
m_selection_pos
=
v3f
(
0.0
,
0.0
,
0.0
);
std
::
string
mode
=
g_settings
->
get
(
"node_highlighting"
);
m_selection_material
.
Lighting
=
false
;
...
...
@@ -574,10 +576,23 @@ void Hud::updateSelectionMesh(const v3s16 &camera_offset)
0
,
0
,
1
,
1
};
m_selection_mesh
=
convertNodeboxesToMesh
(
m_selection_boxes
,
texture_uv
);
// Use single halo box instead of multiple overlapping boxes.
// Temporary solution - problem can be solved with multiple
// rendering targets, or some method to remove inner surfaces.
// Thats because of halo transparency.
aabb3f
halo_box
(
100.0
,
100.0
,
100.0
,
-
100.0
,
-
100.0
,
-
100.0
);
m_halo_boxes
.
clear
();
for
(
std
::
vector
<
aabb3f
>::
iterator
i
=
m_selection_boxes
.
begin
();
i
!=
m_selection_boxes
.
end
();
++
i
)
{
halo_box
.
addInternalBox
(
*
i
);
}
// scale final halo mesh
scaleMesh
(
m_selection_mesh
,
v3f
(
1.08
,
1.08
,
1.08
));
m_halo_boxes
.
push_back
(
halo_box
);
m_selection_mesh
=
convertNodeboxesToMesh
(
m_halo_boxes
,
texture_uv
,
0.5
);
}
void
Hud
::
resizeHotbar
()
{
...
...
This diff is collapsed.
Click to expand it.
src/hud.h
+
1
−
0
View file @
9357294c
...
...
@@ -162,6 +162,7 @@ class Hud {
video
::
SColor
hbar_colors
[
4
];
std
::
vector
<
aabb3f
>
m_selection_boxes
;
std
::
vector
<
aabb3f
>
m_halo_boxes
;
v3f
m_selection_pos
;
v3f
m_selection_pos_with_offset
;
...
...
This diff is collapsed.
Click to expand it.
src/mesh.cpp
+
10
−
22
View file @
9357294c
...
...
@@ -406,7 +406,7 @@ scene::IMesh* cloneMesh(scene::IMesh *src_mesh)
}
scene
::
IMesh
*
convertNodeboxesToMesh
(
const
std
::
vector
<
aabb3f
>
&
boxes
,
const
f32
*
uv_coords
)
const
f32
*
uv_coords
,
float
expand
)
{
scene
::
SMesh
*
dst_mesh
=
new
scene
::
SMesh
();
...
...
@@ -421,31 +421,19 @@ scene::IMesh* convertNodeboxesToMesh(const std::vector<aabb3f> &boxes,
video
::
SColor
c
(
255
,
255
,
255
,
255
);
for
(
std
::
vector
<
aabb3f
>::
const_iterator
for
(
std
::
vector
<
aabb3f
>::
const_iterator
i
=
boxes
.
begin
();
i
!=
boxes
.
end
();
++
i
)
{
aabb3f
box
=
*
i
;
f32
temp
;
if
(
box
.
MinEdge
.
X
>
box
.
MaxEdge
.
X
)
{
temp
=
box
.
MinEdge
.
X
;
box
.
MinEdge
.
X
=
box
.
MaxEdge
.
X
;
box
.
MaxEdge
.
X
=
temp
;
}
if
(
box
.
MinEdge
.
Y
>
box
.
MaxEdge
.
Y
)
{
temp
=
box
.
MinEdge
.
Y
;
box
.
MinEdge
.
Y
=
box
.
MaxEdge
.
Y
;
box
.
MaxEdge
.
Y
=
temp
;
}
if
(
box
.
MinEdge
.
Z
>
box
.
MaxEdge
.
Z
)
{
temp
=
box
.
MinEdge
.
Z
;
box
.
MinEdge
.
Z
=
box
.
MaxEdge
.
Z
;
box
.
MaxEdge
.
Z
=
temp
;
}
box
.
repair
();
box
.
MinEdge
.
X
-=
expand
;
box
.
MinEdge
.
Y
-=
expand
;
box
.
MinEdge
.
Z
-=
expand
;
box
.
MaxEdge
.
X
+=
expand
;
box
.
MaxEdge
.
Y
+=
expand
;
box
.
MaxEdge
.
Z
+=
expand
;
// Compute texture UV coords
f32
tx1
=
(
box
.
MinEdge
.
X
/
BS
)
+
0.5
;
...
...
This diff is collapsed.
Click to expand it.
src/mesh.h
+
2
−
1
View file @
9357294c
...
...
@@ -86,9 +86,10 @@ scene::IMesh* cloneMesh(scene::IMesh *src_mesh);
Convert nodeboxes to mesh.
boxes - set of nodeboxes to be converted into cuboids
uv_coords[24] - table of texture uv coords for each cuboid face
expand - factor by which cuboids will be resized
*/
scene
::
IMesh
*
convertNodeboxesToMesh
(
const
std
::
vector
<
aabb3f
>
&
boxes
,
const
f32
*
uv_coords
=
NULL
);
const
f32
*
uv_coords
=
NULL
,
float
expand
=
0
);
/*
Update bounding box for a mesh.
...
...
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