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
aaafb5ad
Commit
aaafb5ad
authored
14 years ago
by
Perttu Ahola
Browse files
Options
Downloads
Patches
Plain Diff
reversed meshbuffer cache
parent
3ad212c9
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
src/mapblock.cpp
+14
-48
14 additions, 48 deletions
src/mapblock.cpp
with
14 additions
and
48 deletions
src/mapblock.cpp
+
14
−
48
View file @
aaafb5ad
...
@@ -297,8 +297,6 @@ void MapBlock::updateMesh()
...
@@ -297,8 +297,6 @@ void MapBlock::updateMesh()
core
::
list
<
FastFace
*>
*
fastfaces_new
=
new
core
::
list
<
FastFace
*>
;
core
::
list
<
FastFace
*>
*
fastfaces_new
=
new
core
::
list
<
FastFace
*>
;
//TimeTaker timer1("updateMesh1", g_device);
/*
/*
We are including the faces of the trailing edges of the block.
We are including the faces of the trailing edges of the block.
This means that when something changes, the caller must
This means that when something changes, the caller must
...
@@ -342,26 +340,12 @@ void MapBlock::updateMesh()
...
@@ -342,26 +340,12 @@ void MapBlock::updateMesh()
}
}
}
}
//timer1.stop();
//TimeTaker timer2("updateMesh2", g_device);
scene
::
SMesh
*
mesh_new
=
NULL
;
scene
::
SMesh
*
mesh_new
=
NULL
;
//s32 appendtime = 0;
if
(
fastfaces_new
->
getSize
()
>
0
)
if
(
fastfaces_new
->
getSize
()
>
0
)
{
{
mesh_new
=
new
scene
::
SMesh
();
mesh_new
=
new
scene
::
SMesh
();
scene
::
IMeshBuffer
*
buf
=
NULL
;
scene
::
IMeshBuffer
*
buf
=
NULL
;
/*
Buffer for lesser calls to
mesh_new->getMeshBuffer(g_materials[f->material]),
which is slow.
key = material id, value = meshbuffer of that material
*/
core
::
map
<
u8
,
scene
::
IMeshBuffer
*>
bufs
;
core
::
list
<
FastFace
*>::
Iterator
i
=
fastfaces_new
->
begin
();
core
::
list
<
FastFace
*>::
Iterator
i
=
fastfaces_new
->
begin
();
...
@@ -375,43 +359,27 @@ void MapBlock::updateMesh()
...
@@ -375,43 +359,27 @@ void MapBlock::updateMesh()
if
(
f
->
material
!=
material_in_use
||
buf
==
NULL
)
if
(
f
->
material
!=
material_in_use
||
buf
==
NULL
)
{
{
// Try to get a meshbuffer associated with the material
// Try to get a meshbuffer associated with the material
core
::
map
<
u8
,
scene
::
IMeshBuffer
*>::
Node
*
buf
=
mesh_new
->
getMeshBuffer
(
g_materials
[
f
->
material
]);
n
=
bufs
.
find
(
f
->
material
);
// If not found, create one
if
(
buf
==
NULL
)
if
(
n
!=
NULL
)
{
{
buf
=
n
->
getValue
();
// This is a "Standard MeshBuffer",
}
// it's a typedeffed CMeshBuffer<video::S3DVertex>
else
buf
=
new
scene
::
SMeshBuffer
();
{
// Set material
buf
=
mesh_new
->
getMeshBuffer
(
g_materials
[
f
->
material
]);
((
scene
::
SMeshBuffer
*
)
buf
)
->
Material
=
g_materials
[
f
->
material
];
// If not found, create one
// Use VBO
if
(
buf
==
NULL
)
//buf->setHardwareMappingHint(scene::EHM_STATIC);
{
// Add to mesh
// This is a "Standard MeshBuffer",
mesh_new
->
addMeshBuffer
(
buf
);
// it's a typedeffed CMeshBuffer<video::S3DVertex>
// Mesh grabbed it
buf
=
new
scene
::
SMeshBuffer
();
buf
->
drop
();
bufs
[
f
->
material
]
=
buf
;
// Set material
((
scene
::
SMeshBuffer
*
)
buf
)
->
Material
=
g_materials
[
f
->
material
];
// Use VBO
//buf->setHardwareMappingHint(scene::EHM_STATIC);
// Add to mesh
mesh_new
->
addMeshBuffer
(
buf
);
// Mesh grabbed it
buf
->
drop
();
}
}
}
material_in_use
=
f
->
material
;
material_in_use
=
f
->
material
;
}
}
u16
indices
[]
=
{
0
,
1
,
2
,
2
,
3
,
0
};
u16
indices
[]
=
{
0
,
1
,
2
,
2
,
3
,
0
};
//TimeTaker timer("", g_device);
buf
->
append
(
f
->
vertices
,
4
,
indices
,
6
);
buf
->
append
(
f
->
vertices
,
4
,
indices
,
6
);
//appendtime += timer.stop(true);
}
}
// Use VBO for mesh (this just would set this for ever buffer)
// Use VBO for mesh (this just would set this for ever buffer)
...
@@ -422,8 +390,6 @@ void MapBlock::updateMesh()
...
@@ -422,8 +390,6 @@ void MapBlock::updateMesh()
<<" materials"<<std::endl;*/
<<" materials"<<std::endl;*/
}
}
//dstream<<"appendtime="<<appendtime<<std::endl;
// TODO: Get rid of the FastFace stage
// TODO: Get rid of the FastFace stage
core
::
list
<
FastFace
*>::
Iterator
i
;
core
::
list
<
FastFace
*>::
Iterator
i
;
i
=
fastfaces_new
->
begin
();
i
=
fastfaces_new
->
begin
();
...
...
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