mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Improve rendering and fix tiling in mesh generation
This commit is contained in:
parent
05ab58cd14
commit
554f7f120c
5 changed files with 167 additions and 116 deletions
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "main.h" // For g_settings and g_texturesource
|
||||
#include "content_mapblock.h"
|
||||
#include "settings.h"
|
||||
#include "profiler.h"
|
||||
|
||||
void MeshMakeData::fill(u32 daynight_ratio, MapBlock *block)
|
||||
{
|
||||
|
@ -527,7 +528,7 @@ void updateFastFaceRow(
|
|||
next_tile);
|
||||
|
||||
if(next_makes_face == makes_face
|
||||
&& next_p_corrected == p_corrected
|
||||
&& next_p_corrected == p_corrected + translate_dir
|
||||
&& next_face_dir_corrected == face_dir_corrected
|
||||
&& next_lights[0] == lights[0]
|
||||
&& next_lights[1] == lights[1]
|
||||
|
@ -537,6 +538,29 @@ void updateFastFaceRow(
|
|||
{
|
||||
next_is_different = false;
|
||||
}
|
||||
else{
|
||||
/*if(makes_face){
|
||||
g_profiler->add("Meshgen: diff: next_makes_face != makes_face",
|
||||
next_makes_face != makes_face ? 1 : 0);
|
||||
g_profiler->add("Meshgen: diff: n_p_corr != p_corr + t_dir",
|
||||
(next_p_corrected != p_corrected + translate_dir) ? 1 : 0);
|
||||
g_profiler->add("Meshgen: diff: next_f_dir_corr != f_dir_corr",
|
||||
next_face_dir_corrected != face_dir_corrected ? 1 : 0);
|
||||
g_profiler->add("Meshgen: diff: next_lights[] != lights[]",
|
||||
(next_lights[0] != lights[0] ||
|
||||
next_lights[0] != lights[0] ||
|
||||
next_lights[0] != lights[0] ||
|
||||
next_lights[0] != lights[0]) ? 1 : 0);
|
||||
g_profiler->add("Meshgen: diff: !(next_tile == tile)",
|
||||
!(next_tile == tile) ? 1 : 0);
|
||||
}*/
|
||||
}
|
||||
/*g_profiler->add("Meshgen: Total faces checked", 1);
|
||||
if(makes_face)
|
||||
g_profiler->add("Meshgen: Total makes_face checked", 1);*/
|
||||
} else {
|
||||
/*if(makes_face)
|
||||
g_profiler->add("Meshgen: diff: last position", 1);*/
|
||||
}
|
||||
|
||||
continuous_tiles_count++;
|
||||
|
@ -568,6 +592,8 @@ void updateFastFaceRow(
|
|||
v3f pf(p_corrected.X, p_corrected.Y, p_corrected.Z);
|
||||
// Center point of face (kind of)
|
||||
v3f sp = pf - ((f32)continuous_tiles_count / 2. - 0.5) * translate_dir_f;
|
||||
if(continuous_tiles_count != 1)
|
||||
sp += translate_dir_f;
|
||||
v3f scale(1,1,1);
|
||||
|
||||
if(translate_dir.X != 0)
|
||||
|
@ -586,6 +612,11 @@ void updateFastFaceRow(
|
|||
makeFastFace(tile, lights[0], lights[1], lights[2], lights[3],
|
||||
sp, face_dir_corrected, scale,
|
||||
posRelative_f, dest);
|
||||
|
||||
g_profiler->avg("Meshgen: faces drawn by tiling", 0);
|
||||
for(int i=1; i<continuous_tiles_count; i++){
|
||||
g_profiler->avg("Meshgen: faces drawn by tiling", 1);
|
||||
}
|
||||
}
|
||||
|
||||
continuous_tiles_count = 0;
|
||||
|
@ -707,10 +738,13 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data)
|
|||
|
||||
video::SMaterial material;
|
||||
material.setFlag(video::EMF_LIGHTING, false);
|
||||
material.setFlag(video::EMF_BACK_FACE_CULLING, true);
|
||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
material.setFlag(video::EMF_FOG_ENABLE, true);
|
||||
//material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_OFF);
|
||||
//material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_SIMPLE);
|
||||
material.MaterialType
|
||||
= video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||
|
||||
for(u32 i=0; i<fastfaces_new.size(); i++)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue