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
bf884e37
Commit
bf884e37
authored
9 years ago
by
RealBadAngel
Committed by
paramat
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use tangent space meshes only when shaders are enabled
parent
0e75eb43
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mapblock_mesh.cpp
+11
-8
11 additions, 8 deletions
src/mapblock_mesh.cpp
src/mapblock_mesh.h
+3
-3
3 additions, 3 deletions
src/mapblock_mesh.h
with
14 additions
and
11 deletions
src/mapblock_mesh.cpp
+
11
−
8
View file @
bf884e37
...
...
@@ -1167,7 +1167,7 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
for
(
u32
j
=
0
;
j
<
p
.
vertices
.
size
();
j
++
)
{
video
::
S3DVertex
Tangents
*
vertex
=
&
p
.
vertices
[
j
];
video
::
S3DVertex
*
vertex
=
&
p
.
vertices
[
j
];
// Note applyFacesShading second parameter is precalculated sqrt
// value for speed improvement
// Skip it for lightsources and top faces.
...
...
@@ -1221,11 +1221,12 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
}
// Create meshbuffer
scene
::
SMeshBuffer
Tangents
*
buf
=
new
scene
::
SMeshBuffer
Tangents
();
scene
::
SMeshBuffer
*
buf
=
new
scene
::
SMeshBuffer
();
// Set material
buf
->
Material
=
material
;
// Add to mesh
m_mesh
->
addMeshBuffer
(
buf
);
scene
::
SMesh
*
mesh
=
(
scene
::
SMesh
*
)
m_mesh
;
mesh
->
addMeshBuffer
(
buf
);
// Mesh grabbed it
buf
->
drop
();
buf
->
append
(
&
p
.
vertices
[
0
],
p
.
vertices
.
size
(),
...
...
@@ -1241,7 +1242,9 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
if
(
m_enable_shaders
)
{
scene
::
IMeshManipulator
*
meshmanip
=
m_gamedef
->
getSceneManager
()
->
getMeshManipulator
();
meshmanip
->
recalculateTangents
(
m_mesh
,
true
,
false
,
false
);
scene
::
IMesh
*
tangentMesh
=
meshmanip
->
createMeshWithTangents
(
m_mesh
);
m_mesh
->
drop
();
m_mesh
=
tangentMesh
;
}
if
(
m_mesh
)
...
...
@@ -1361,7 +1364,7 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack, u32 daynight_rat
i
!=
m_daynight_diffs
.
end
();
++
i
)
{
scene
::
IMeshBuffer
*
buf
=
m_mesh
->
getMeshBuffer
(
i
->
first
);
video
::
S3DVertex
Tangents
*
vertices
=
(
video
::
S3DVertex
Tangents
*
)
buf
->
getVertices
();
video
::
S3DVertex
*
vertices
=
(
video
::
S3DVertex
*
)
buf
->
getVertices
();
for
(
std
::
map
<
u32
,
std
::
pair
<
u8
,
u8
>
>::
iterator
j
=
i
->
second
.
begin
();
j
!=
i
->
second
.
end
();
++
j
)
...
...
@@ -1392,7 +1395,7 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack, u32 daynight_rat
i
!=
m_highlighted_materials
.
end
();
++
i
)
{
scene
::
IMeshBuffer
*
buf
=
m_mesh
->
getMeshBuffer
(
*
i
);
video
::
S3DVertex
Tangents
*
vertices
=
(
video
::
S3DVertex
Tangents
*
)
buf
->
getVertices
();
video
::
S3DVertex
*
vertices
=
(
video
::
S3DVertex
*
)
buf
->
getVertices
();
for
(
u32
j
=
0
;
j
<
buf
->
getVertexCount
()
;
j
++
)
vertices
[
j
].
Color
=
hc
;
}
...
...
@@ -1448,7 +1451,7 @@ void MeshCollector::append(const TileSpec &tile,
}
for
(
u32
i
=
0
;
i
<
numVertices
;
i
++
)
{
video
::
S3DVertex
Tangents
vert
(
vertices
[
i
].
Pos
,
vertices
[
i
].
Normal
,
video
::
S3DVertex
vert
(
vertices
[
i
].
Pos
,
vertices
[
i
].
Normal
,
vertices
[
i
].
Color
,
vertices
[
i
].
TCoords
);
p
->
vertices
.
push_back
(
vert
);
}
...
...
@@ -1494,7 +1497,7 @@ void MeshCollector::append(const TileSpec &tile,
}
for
(
u32
i
=
0
;
i
<
numVertices
;
i
++
)
{
video
::
S3DVertex
Tangents
vert
(
vertices
[
i
].
Pos
+
pos
,
vertices
[
i
].
Normal
,
video
::
S3DVertex
vert
(
vertices
[
i
].
Pos
+
pos
,
vertices
[
i
].
Normal
,
c
,
vertices
[
i
].
TCoords
);
p
->
vertices
.
push_back
(
vert
);
}
...
...
This diff is collapsed.
Click to expand it.
src/mapblock_mesh.h
+
3
−
3
View file @
bf884e37
...
...
@@ -104,7 +104,7 @@ class MapBlockMesh
// Returns true if anything has been changed.
bool
animate
(
bool
faraway
,
float
time
,
int
crack
,
u32
daynight_ratio
);
scene
::
S
Mesh
*
getMesh
()
scene
::
I
Mesh
*
getMesh
()
{
return
m_mesh
;
}
...
...
@@ -130,7 +130,7 @@ class MapBlockMesh
void
updateCameraOffset
(
v3s16
camera_offset
);
private
:
scene
::
S
Mesh
*
m_mesh
;
scene
::
I
Mesh
*
m_mesh
;
MinimapMapblock
*
m_minimap_mapblock
;
IGameDef
*
m_gamedef
;
ITextureSource
*
m_tsrc
;
...
...
@@ -177,7 +177,7 @@ struct PreMeshBuffer
{
TileSpec
tile
;
std
::
vector
<
u16
>
indices
;
std
::
vector
<
video
::
S3DVertex
Tangents
>
vertices
;
std
::
vector
<
video
::
S3DVertex
>
vertices
;
};
struct
MeshCollector
...
...
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