This commit is contained in:
proller committed 2022-07-07 05:44:41 +03:00
1 parent fe14cd2b06
commit cd6ad20d35
33 files changed
+183 -2466

No files matched your search

+2
View File
@@ -506,7 +506,9 @@ private:
RenderingEngine *m_rendering_engine;
MeshUpdateThread m_mesh_update_thread;
public:
ClientEnvironment m_env;
private:
ParticleManager m_particle_manager;
public:
std::unique_ptr<con::Connection> m_con;
+6
View File
@@ -60,6 +60,12 @@ void MeshBufListList::add(scene::IMeshBuffer *buf, v3s16 position, u8 layer)
list.emplace_back(l);
}
void MapDrawControl::fm_init() {
farmesh = g_settings->getS32("farmesh");
farmesh_step = g_settings->getS32("farmesh_step");
fov_want = fov = g_settings->getFloat("fov");
}
// ClientMap
ClientMap::ClientMap(
+2 -4
View File
@@ -817,11 +817,9 @@ protected:
void updateShadows();
// Misc
void showOverlayMessage(const char *msg, float dtime, int percent,
void showOverlayMessage(const std::string &msg, float dtime, int percent,
bool draw_clouds = true);
void showOverlayMessage(const std::string &msg, float dtime, int percent, bool draw_clouds = true);
static void settingChangedCallback(const std::string &setting_name, void *data);
void readSettings();
@@ -2205,7 +2203,7 @@ void Game::processKeyInput()
} else if (wasKeyDown(KeyType::TOGGLE_DEBUG)) {
toggleDebug();
} else if (wasKeyDown(KeyType::TOGGLE_PROFILER)) {
m_game_ui->toggleProfiler();
m_game_ui->toggleProfiler(runData.profiler_state);
} else if (wasKeyDown(KeyType::INCREASE_VIEWING_RANGE)) {
increaseViewRange();
client->sendDrawControl();
+2 -2
View File
@@ -299,7 +299,7 @@ void GameUI::toggleHud()
showTranslatedStatusText("HUD hidden");
}
void GameUI::toggleProfiler()
void GameUI::toggleProfiler(bool & profiler_state)
{
m_profiler_current_page = (m_profiler_current_page + 1) % (m_profiler_max_page + 1);
@@ -311,7 +311,7 @@ void GameUI::toggleProfiler()
m_profiler_current_page, m_profiler_max_page);
showStatusText(msg);
if (m_profiler_current_page == 1)
runData.profiler_state = g_profiler_enabled;
profiler_state = g_profiler_enabled;
g_profiler_enabled = true;
} else {
+1 -1
View File
@@ -95,7 +95,7 @@ public:
void toggleChat();
void toggleHud();
void toggleProfiler();
void toggleProfiler(bool&);
GUIFormSpecMenu *&updateFormspec(const std::string &formname)
{
+71 -517
View File
@@ -22,6 +22,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
#include "mapblock_mesh.h"
#include "client.h"
#include "client/clientmap.h"
#include "mapblock.h"
#include "map.h"
#include "profiler.h"
@@ -30,21 +31,9 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
#include "minimap.h"
#include "content_mapblock.h"
#include "util/directiontables.h"
<<<<<<< HEAD:src/mapblock_mesh.cpp
#include "clientmap.h"
#include "log_types.h"
#include <IMeshManipulator.h>
static void applyFacesShading(video::SColor &color, const float factor)
{
color.setRed(core::clamp(core::round32(color.getRed() * factor), 0, 255));
color.setGreen(core::clamp(core::round32(color.getGreen() * factor), 0, 255));
}
=======
#include "client/meshgen/collector.h"
#include "client/renderingengine.h"
#include <array>
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
int getFarmeshStep(MapDrawControl& draw_control, const v3POS & playerpos, const v3POS & blockpos) {
int range = radius_box(playerpos, blockpos);
@@ -62,57 +51,18 @@ int getFarmeshStep(MapDrawControl& draw_control, const v3POS & playerpos, const
MeshMakeData
*/
<<<<<<< HEAD:src/mapblock_mesh.cpp
MeshMakeData::MeshMakeData(IGameDef *gamedef, bool use_shaders,
bool use_tangent_vertices,
Map & map_, MapDrawControl& draw_control_):
#if defined(MESH_ZEROCOPY)
m_vmanip(map_),
#endif
m_blockpos(-1337,-1337,-1337),
m_crack_pos_relative(-1337, -1337, -1337),
m_smooth_lighting(false),
m_show_hud(false),
m_gamedef(gamedef),
m_use_shaders(use_shaders),
m_use_tangent_vertices(use_tangent_vertices)
,
step(1),
range(1),
no_draw(false),
timestamp(0),
block(nullptr),
map(map_),
draw_control(draw_control_),
debug(0),
filled(false)
{}
MeshMakeData::~MeshMakeData() {
//infostream<<"~MeshMakeData "<<m_blockpos<<std::endl;
}
=======
MeshMakeData::MeshMakeData(Client *client, bool use_shaders):
MeshMakeData::MeshMakeData(Client *client, bool use_shaders
//,Map & map_, MapDrawControl& draw_control_
):
m_client(client),
m_use_shaders(use_shaders)
//, map{map_}, draw_control{draw_control_}
/*#if defined(MESH_ZEROCOPY)
m_vmanip(map_),
#endif*/
{}
void MeshMakeData::fillBlockDataBegin(const v3s16 &blockpos)
{
m_blockpos = blockpos;
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
void MeshMakeData::fill(MapBlock *block_)
{
#if ! ENABLE_THREADS
block = block_;
#endif
m_blockpos = block_->getPos();
}
bool MeshMakeData::fill_data()
{
@@ -120,7 +70,7 @@ bool MeshMakeData::fill_data()
return filled;
if (!block)
block = map.getBlockNoCreateNoEx(m_blockpos);
block = m_client->m_env.getClientMap().getBlockNoCreateNoEx(m_blockpos);
if (!block)
return filled;
@@ -130,16 +80,20 @@ bool MeshMakeData::fill_data()
#if !defined(MESH_ZEROCOPY)
ScopeProfiler sp(g_profiler, "Client: Mesh data fill");
map.copy_27_blocks_to_vm(block, m_vmanip);
m_client->m_env.getClientMap().copy_27_blocks_to_vm(block, m_vmanip);
#if 0
v3POS blockpos_nodes = m_blockpos*MAP_BLOCKSIZE;
/*
Copy data
*/
// Allocate this block + neighbors
m_vmanip.clear();
VoxelArea voxel_area(blockpos_nodes - v3s16(1,1,1) * MAP_BLOCKSIZE,
blockpos_nodes + v3s16(1,1,1) * MAP_BLOCKSIZE*2-v3s16(1,1,1));
m_vmanip.addArea(voxel_area);
<<<<<<< HEAD:src/mapblock_mesh.cpp
{
//TimeTaker timer("copy central block data");
@@ -176,16 +130,17 @@ bool MeshMakeData::fill_data()
return filled;
}
void MeshMakeData::fillSingleNode(MapNode *node, v3POS blockpos) {
void MeshMakeData::fillBlockDataBegin(const v3s16 &blockpos)
{
m_blockpos = blockpos;
#if !defined(MESH_ZEROCOPY)
v3s16 blockpos_nodes = m_blockpos * MAP_BLOCKSIZE;
VoxelArea area(blockpos_nodes-v3s16(1,1,1)*MAP_BLOCKSIZE,
blockpos_nodes+v3s16(1,1,1)*MAP_BLOCKSIZE*2-v3s16(1,1,1));
s32 volume = area.getVolume();
s32 our_node_index = area.index(1,1,1);
=======
v3s16 blockpos_nodes = m_blockpos*MAP_BLOCKSIZE;
m_vmanip.clear();
VoxelArea voxel_area(blockpos_nodes - v3s16(1,1,1) * MAP_BLOCKSIZE,
blockpos_nodes + v3s16(1,1,1) * MAP_BLOCKSIZE*2-v3s16(1,1,1));
m_vmanip.addArea(voxel_area);
}
void MeshMakeData::fillBlockData(const v3s16 &block_offset, MapNode *data)
@@ -197,30 +152,11 @@ void MeshMakeData::fillBlockData(const v3s16 &block_offset, MapNode *data)
v3s16 blockpos_nodes = bp * MAP_BLOCKSIZE;
m_vmanip.copyFrom(data, data_area, v3s16(0,0,0), blockpos_nodes, data_size);
}
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
void MeshMakeData::fill(MapBlock *block)
{
fillBlockDataBegin(block->getPos());
<<<<<<< HEAD:src/mapblock_mesh.cpp
// Fill in data
MapNode *data = reinterpret_cast<MapNode*>( ::operator new(volume * sizeof(MapNode)));
for(s32 i = 0; i < volume; i++)
{
if(i == our_node_index)
{
data[i] = *node;
}
else
{
data[i] = MapNode(CONTENT_AIR, LIGHT_MAX, 0);
}
}
m_vmanip.copyFrom(data, area, area.MinEdge, area.MinEdge, area.getExtent());
delete data;
#endif
=======
fillBlockData(v3s16(0,0,0), block->getData());
// Get map for reading neighbor blocks
@@ -232,7 +168,6 @@ void MeshMakeData::fill(MapBlock *block)
if(b)
fillBlockData(dir, b->getData());
}
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
}
void MeshMakeData::setCrack(int crack_level, v3s16 crack_pos)
@@ -796,20 +731,12 @@ static void makeFastFace(const TileSpec &tile, u16 li0, u16 li1, u16 li2, u16 li
TODO: Add 3: Both faces drawn with backface culling, remove equivalent
*/
static u8 face_contents(content_t m1, content_t m2, bool *equivalent,
<<<<<<< HEAD:src/mapblock_mesh.cpp
const NodeDefManager *ndef, int step)
const NodeDefManager *ndef, int step)
{
*equivalent = false;
bool have_ignore = (m1 == CONTENT_IGNORE || m2 == CONTENT_IGNORE);
if(step <= 1 && have_ignore)
=======
const NodeDefManager *ndef)
{
*equivalent = false;
if (m1 == m2 || m1 == CONTENT_IGNORE || m2 == CONTENT_IGNORE)
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
bool have_ignore = m1 == CONTENT_IGNORE || m2 == CONTENT_IGNORE;
if(step <= 1)
if (m1 == m2 || have_ignore)
return 0;
const ContentFeatures &f1 = ndef->get(m1);
@@ -822,7 +749,6 @@ static u8 face_contents(content_t m1, content_t m2, bool *equivalent,
u8 c1 = f1.solidness;
u8 c2 = f2.solidness;
<<<<<<< HEAD:src/mapblock_mesh.cpp
if (step > 1) {
//no liquid/transparent borders
if (have_ignore && c1 == 1)
@@ -835,13 +761,7 @@ static u8 face_contents(content_t m1, content_t m2, bool *equivalent,
c2 = f2.solidness_far;
}
bool solidness_differs = (c1 != c2);
bool makes_face = contents_differ && solidness_differs;
if(makes_face == false)
=======
if (c1 == c2)
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
return 0;
if (c1 == 0)
@@ -958,33 +878,22 @@ static void getTileInfo(
v3s16 &p_corrected,
v3s16 &face_dir_corrected,
u16 *lights,
<<<<<<< HEAD:src/mapblock_mesh.cpp
TileSpec &tile,
u8 &light_source
,int step
u8 &waving,
TileSpec &tile
, int step
)
{
auto &vmanip = data->m_vmanip;
const NodeDefManager *ndef = data->m_gamedef->ndef();
const NodeDefManager *ndef = data->m_client->ndef();
v3s16 blockpos_nodes = data->m_blockpos * MAP_BLOCKSIZE;
//const MapNode &n0 = vmanip.getNodeRefUnsafe(blockpos_nodes + p);
MapNode n0;
for(int find = 0; find < step; ++find) {
n0 = vmanip.getNodeRefUnsafe(blockpos_nodes + p*step + find);
if (step <= 1 || (n0.getContent() != CONTENT_IGNORE && n0.getContent() != CONTENT_AIR))
break;
}
=======
u8 &waving,
TileSpec &tile
)
{
VoxelManipulator &vmanip = data->m_vmanip;
const NodeDefManager *ndef = data->m_client->ndef();
v3s16 blockpos_nodes = data->m_blockpos * MAP_BLOCKSIZE;
const MapNode &n0 = vmanip.getNodeRefUnsafe(blockpos_nodes + p);
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
// Don't even try to get n1 if n0 is already CONTENT_IGNORE
if (step <= 1 && n0.getContent() == CONTENT_IGNORE) {
@@ -1039,15 +948,10 @@ static void getTileInfo(
layer.material_flags |= MATERIAL_FLAG_BACKFACE_CULLING;
}
<<<<<<< HEAD:src/mapblock_mesh.cpp
if(data->m_smooth_lighting == false || step > 1)
{
if (!data->m_smooth_lighting || step > 1) {
if (step > 1 && (!n0.getContent() || !n1.getContent()))
lights[0] = lights[1] = lights[2] = lights[3] = decode_light(LIGHT_MAX-2);
else
=======
if (!data->m_smooth_lighting) {
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
lights[0] = lights[1] = lights[2] = lights[3] =
getFaceLight(n0, n1, face_dir, ndef);
} else {
@@ -1069,17 +973,10 @@ static void updateFastFaceRow(
MeshMakeData *data,
const v3s16 &&startpos,
v3s16 translate_dir,
<<<<<<< HEAD:src/mapblock_mesh.cpp
v3f translate_dir_f,
v3s16 face_dir,
v3f face_dir_f,
std::vector<FastFace> &dest,
int step)
=======
const v3f &&translate_dir_f,
const v3s16 &&face_dir,
std::vector<FastFace> &dest)
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
std::vector<FastFace> &dest,
int step)
{
static thread_local const bool waving_liquids =
g_settings->getBool("enable_shaders") &&
@@ -1102,21 +999,15 @@ static void updateFastFaceRow(
// Get info of first tile
getTileInfo(data, p, face_dir,
makes_face, p_corrected, face_dir_corrected,
<<<<<<< HEAD:src/mapblock_mesh.cpp
lights, tile, light_source, step);
auto prev_p_corrected = p_corrected;
u16 to = MAP_BLOCKSIZE/step;
for(u16 j=0; j<to; j++)
{
=======
lights, waving, tile);
lights, waving, tile, step);
// Unroll this variable which has a significant build cost
TileSpec next_tile;
for (u16 j = 0; j < MAP_BLOCKSIZE; j++) {
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
//for (u16 j = 0; j < MAP_BLOCKSIZE; j++) {
auto prev_p_corrected = p_corrected;
u16 to = MAP_BLOCKSIZE / step;
for (u16 j = 0; j < to; j++) {
// If tiling can be done, this is set to false in the next step
bool next_is_different = true;
@@ -1127,31 +1018,19 @@ static void updateFastFaceRow(
// If at last position, there is nothing to compare to and
// the face must be drawn anyway
<<<<<<< HEAD:src/mapblock_mesh.cpp
if(j != to - 1)
{
p_next = p + translate_dir;
=======
if (j != MAP_BLOCKSIZE - 1) {
//if (j != MAP_BLOCKSIZE - 1) {
if(j != to - 1) {
p += translate_dir;
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
getTileInfo(data, p, face_dir,
next_makes_face, next_p_corrected,
next_face_dir_corrected, next_lights,
<<<<<<< HEAD:src/mapblock_mesh.cpp
next_tile, next_light_source, step);
if(next_makes_face == makes_face
&& next_p_corrected == prev_p_corrected + translate_dir
=======
waving,
next_tile);
next_tile, step);
if (!force_not_tiling
&& next_makes_face == makes_face
&& next_p_corrected == p_corrected + translate_dir
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
&& next_p_corrected == prev_p_corrected + translate_dir
&& next_face_dir_corrected == face_dir_corrected
&& memcmp(next_lights, lights, sizeof(lights)) == 0
// Don't apply fast faces to waving water.
@@ -1169,16 +1048,11 @@ static void updateFastFaceRow(
// Floating point conversion of the position vector
v3f pf(p_corrected.X, p_corrected.Y, p_corrected.Z);
// Center point of face (kind of)
<<<<<<< HEAD:src/mapblock_mesh.cpp
v3f sp = pf - ((f32)continuous_tiles_count / 2.0 - 0.5) * translate_dir_f;
//? if(continuous_tiles_count > 1)
//? sp += translate_dir_f * (continuous_tiles_count - 1);
v3f scale(1,1,1);
=======
v3f sp = pf - ((f32)continuous_tiles_count * 0.5f - 0.5f)
* translate_dir_f;
//? if(continuous_tiles_count > 1)
//? sp += translate_dir_f * (continuous_tiles_count - 1);
v3f scale(1, 1, 1);
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
if (translate_dir.X != 0)
scale.X = continuous_tiles_count;
@@ -1188,17 +1062,10 @@ static void updateFastFaceRow(
scale.Z = continuous_tiles_count;
makeFastFace(tile, lights[0], lights[1], lights[2], lights[3],
<<<<<<< HEAD:src/mapblock_mesh.cpp
sp, face_dir_corrected, scale, light_source,
dest);
#if !defined(NDEBUG)
g_profiler->avg("Meshgen: faces drawn by tiling", continuous_tiles_count);
#endif
=======
pf, sp, face_dir_corrected, scale, dest);
#if !defined(NDEBUG)
g_profiler->avg("Meshgen: Tiles per face [#]", continuous_tiles_count);
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
#endif
}
continuous_tiles_count = 1;
@@ -1207,20 +1074,10 @@ static void updateFastFaceRow(
makes_face = next_makes_face;
p_corrected = next_p_corrected;
face_dir_corrected = next_face_dir_corrected;
<<<<<<< HEAD:src/mapblock_mesh.cpp
lights[0] = next_lights[0];
lights[1] = next_lights[1];
lights[2] = next_lights[2];
lights[3] = next_lights[3];
tile = next_tile;
light_source = next_light_source;
p = p_next;
prev_p_corrected = next_p_corrected;
=======
memcpy(lights, next_lights, sizeof(lights));
if (next_is_different)
tile = std::move(next_tile); // faster than copy
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
}
}
@@ -1231,78 +1088,38 @@ static void updateAllFastFaceRows(MeshMakeData *data,
/*
Go through every y,z and get top(y+) faces in rows of x+
*/
<<<<<<< HEAD:src/mapblock_mesh.cpp
for(s16 y = 0; y < to; y++) {
for(s16 z = 0; z < to; z++) {
updateFastFaceRow(data,
v3s16(0,y,z),
v3s16(1,0,0), //dir
v3f (1,0,0),
v3s16(0,1,0), //face dir
v3f (0,1,0),
dest, step);
}
}
=======
for (s16 y = 0; y < MAP_BLOCKSIZE; y++)
for (s16 z = 0; z < MAP_BLOCKSIZE; z++)
for (s16 y = 0; y < to; y++)
for (s16 z = 0; z < to; z++)
updateFastFaceRow(data,
v3s16(0, y, z),
v3s16(1, 0, 0), //dir
v3f (1, 0, 0),
v3s16(0, 1, 0), //face dir
dest);
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
dest, step);
/*
Go through every x,y and get right(x+) faces in rows of z+
*/
<<<<<<< HEAD:src/mapblock_mesh.cpp
for(s16 x = 0; x < to; x++) {
for(s16 y = 0; y < to; y++) {
updateFastFaceRow(data,
v3s16(x,y,0),
v3s16(0,0,1), //dir
v3f (0,0,1),
v3s16(1,0,0), //face dir
v3f (1,0,0),
dest, step);
}
}
=======
for (s16 x = 0; x < MAP_BLOCKSIZE; x++)
for (s16 y = 0; y < MAP_BLOCKSIZE; y++)
for (s16 x = 0; x < to; x++)
for (s16 y = 0; y < to; y++)
updateFastFaceRow(data,
v3s16(x, y, 0),
v3s16(0, 0, 1), //dir
v3f (0, 0, 1),
v3s16(1, 0, 0), //face dir
dest);
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
dest, step);
/*
Go through every y,z and get back(z+) faces in rows of x+
*/
<<<<<<< HEAD:src/mapblock_mesh.cpp
for(s16 z = 0; z < to; z++) {
for(s16 y = 0; y < to; y++) {
updateFastFaceRow(data,
v3s16(0,y,z),
v3s16(1,0,0), //dir
v3f (1,0,0),
v3s16(0,0,1), //face dir
v3f (0,0,1),
dest, step);
}
=======
for (s16 z = 0; z < MAP_BLOCKSIZE; z++)
for (s16 y = 0; y < MAP_BLOCKSIZE; y++)
for (s16 z = 0; z < to; z++)
for (s16 y = 0; y < to; y++)
updateFastFaceRow(data,
v3s16(0, y, z),
v3s16(1, 0, 0), //dir
v3f (1, 0, 0),
v3s16(0, 0, 1), //face dir
dest);
dest, step);
}
static void applyTileColor(PreMeshBuffer &pmb)
@@ -1316,7 +1133,6 @@ static void applyTileColor(PreMeshBuffer &pmb)
c->getRed() * tc.getRed() / 255,
c->getGreen() * tc.getGreen() / 255,
c->getBlue() * tc.getBlue() / 255);
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
}
}
@@ -1325,42 +1141,24 @@ static void applyTileColor(PreMeshBuffer &pmb)
*/
MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
<<<<<<< HEAD:src/mapblock_mesh.cpp
step(data->step),
no_draw(data->no_draw),
m_mesh(nullptr),
=======
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
m_minimap_mapblock(NULL),
m_tsrc(data->m_client->getTextureSource()),
m_shdrsrc(data->m_client->getShaderSource()),
m_animation_force_timer(0), // force initial animation
m_last_crack(-1),
<<<<<<< HEAD:src/mapblock_mesh.cpp
m_crack_materials(),
m_last_daynight_ratio((u32) -1),
m_daynight_diffs(),
m_usage_timer(0)
{
m_mesh = new scene::SMesh();
=======
m_last_daynight_ratio((u32) -1)
{
for (auto &m : m_mesh)
m = new scene::SMesh();
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
m_enable_shaders = data->m_use_shaders;
m_enable_vbo = g_settings->getBool("enable_vbo");
<<<<<<< HEAD:src/mapblock_mesh.cpp
if (!data->fill_data())
return;
if (step == 1 || !data->block->getMesh())
if (g_settings->getBool("enable_minimap")) {
=======
if (data->m_client->getMinimap()) {
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
m_minimap_mapblock = new MinimapMapblock;
m_minimap_mapblock->getMinimapNodes(
&data->m_vmanip, data->m_blockpos * MAP_BLOCKSIZE);
@@ -1420,71 +1218,24 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
- whatever
*/
<<<<<<< HEAD:src/mapblock_mesh.cpp
if(step <= 1)
mapblock_mesh_generate_special(data, collector);
=======
{
MapblockMeshGenerator(data, &collector,
data->m_client->getSceneManager()->getMeshManipulator()).generate();
}
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
/*
Convert MeshCollector to SMesh
*/
<<<<<<< HEAD:src/mapblock_mesh.cpp
for(u32 i = 0; i < collector.prebuffers.size(); i++)
{
PreMeshBuffer &p = collector.prebuffers[i];
if (step <= data->draw_control.farmesh || !data->draw_control.farmesh) {
// Generate animation data
// - Cracks
if(p.tile.material_flags & MATERIAL_FLAG_CRACK)
{
// Find the texture name plus ^[crack:N:
std::ostringstream os(std::ios::binary);
os<<m_tsrc->getTextureName(p.tile.texture_id)<<"^[crack";
if(p.tile.material_flags & MATERIAL_FLAG_CRACK_OVERLAY)
os<<"o"; // use ^[cracko
os<<":"<<(u32)p.tile.animation_frame_count<<":";
m_crack_materials.insert(std::make_pair(i, os.str()));
// Replace tile texture with the cracked one
p.tile.texture = m_tsrc->getTextureForMesh(
os.str()+"0",
&p.tile.texture_id);
}
}
// - Texture animation
if(p.tile.material_flags & MATERIAL_FLAG_ANIMATION_VERTICAL_FRAMES && !p.tile.frames.empty())
{
// Add to MapBlockMesh in order to animate these tiles
m_animation_tiles[i] = p.tile;
m_animation_frames[i] = 0;
if(g_settings->getBool("desynchronize_mapblock_texture_animation")){
// Get starting position from noise
m_animation_frame_offsets[i] = 100000 * (2.0 + noise3d(
data->m_blockpos.X, data->m_blockpos.Y,
data->m_blockpos.Z, 0));
} else {
// Play all synchronized
m_animation_frame_offsets[i] = 0;
}
// Replace tile texture with the first animation frame
FrameSpec animation_frame = p.tile.frames[0];
p.tile.texture = animation_frame.texture;
}
=======
for (int layer = 0; layer < MAX_TILE_LAYERS; layer++) {
for(u32 i = 0; i < collector.prebuffers[layer].size(); i++)
{
PreMeshBuffer &p = collector.prebuffers[layer][i];
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
applyTileColor(p);
if (step <= data->m_client->m_env.getClientMap().getControl().farmesh || !data->m_client->m_env.getClientMap().getControl().farmesh)
// Generate animation data
// - Cracks
if (p.layer.material_flags & MATERIAL_FLAG_CRACK) {
@@ -1505,7 +1256,7 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
&p.layer.texture_id);
}
// - Texture animation
if (p.layer.material_flags & MATERIAL_FLAG_ANIMATION) {
if (p.layer.material_flags & MATERIAL_FLAG_ANIMATION && !p.layer.frames->empty()) {
// Add to MapBlockMesh in order to animate these tiles
m_animation_tiles[std::pair<u8, u32>(layer, i)] = p.layer;
m_animation_frames[std::pair<u8, u32>(layer, i)] = 0;
@@ -1544,17 +1295,6 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
}
}
<<<<<<< HEAD:src/mapblock_mesh.cpp
// Create material
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_WIREFRAME, true);
material.setTexture(0, p.tile.texture);
=======
// Create material
video::SMaterial material;
material.setFlag(video::EMF_LIGHTING, false);
@@ -1562,7 +1302,6 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
material.setFlag(video::EMF_BILINEAR_FILTER, false);
material.setFlag(video::EMF_FOG_ENABLE, true);
material.setTexture(0, p.layer.texture);
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
if (m_enable_shaders) {
material.MaterialType = m_shdrsrc->getShaderInfo(
@@ -1585,45 +1324,25 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
buf->drop();
}
<<<<<<< HEAD:src/mapblock_mesh.cpp
/*
Do some stuff to the mesh
*/
m_camera_offset = camera_offset;
/* FMTODO move?
v3f t = v3f(0,0,0);
if (step>1) {
translateMesh(m_mesh, v3f(HBS, 0, HBS));
F(m_mesh, v3f(HBS, 0, HBS));
scaleMesh(m_mesh, v3f(step,step,step));
t = v3f( -HBS, -BS*step/2+1.4142135623731*BS, -HBS); //magic number is sqrt(2)
}
*/
/*
translateMesh(m_mesh,
intToFloat(data->m_blockpos * MAP_BLOCKSIZE - camera_offset, BS) + t);
*/
if (m_use_tangent_vertices) {
scene::IMeshManipulator* meshmanip =
m_gamedef->getSceneManager()->getMeshManipulator();
meshmanip->recalculateTangents(m_mesh, true, false, false);
}
if (m_mesh)
{
#if 0
// Usually 1-700 faces and 1-7 materials
infostream<<"Updated MapBlock mesh p="<<data->m_blockpos<<" has "<<fastfaces_new.size()<<" faces "
<<"and uses "<<m_mesh->getMeshBufferCount()
<<" materials "<<" step="<<step<<" range="<<data->range<< " mesh="<<m_mesh<<std::endl;
#endif
// Use VBO for mesh (this just would set this for ever buffer)
if (m_enable_vbo) {
m_mesh->setHardwareMappingHint(scene::EHM_STATIC);
=======
if (m_mesh[layer]) {
// Use VBO for mesh (this just would set this for ever buffer)
if (m_enable_vbo)
m_mesh[layer]->setHardwareMappingHint(scene::EHM_STATIC);
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
}
}
@@ -1638,19 +1357,6 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
MapBlockMesh::~MapBlockMesh()
{
<<<<<<< HEAD:src/mapblock_mesh.cpp
if (!m_mesh)
return;
//if (m_enable_vbo && m_mesh) {
for (u32 i = 0; i < m_mesh->getMeshBufferCount(); i++) {
scene::IMeshBuffer *buf = m_mesh->getMeshBuffer(i);
m_driver->removeHardwareBuffer(buf);
}
//}
m_mesh->drop();
m_mesh = NULL;
=======
for (scene::IMesh *m : m_mesh) {
if (m_enable_vbo) {
for (u32 i = 0; i < m->getMeshBufferCount(); i++) {
@@ -1660,7 +1366,6 @@ MapBlockMesh::~MapBlockMesh()
}
m->drop();
}
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
delete m_minimap_mapblock;
m_minimap_mapblock = nullptr;
}
@@ -1682,21 +1387,12 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack,
m_animation_force_timer *= step;
// Cracks
<<<<<<< HEAD:src/mapblock_mesh.cpp
if (step <= 1)
if(crack != m_last_crack)
{
for (UNORDERED_MAP<u32, std::string>::iterator i = m_crack_materials.begin();
i != m_crack_materials.end(); ++i) {
scene::IMeshBuffer *buf = m_mesh->getMeshBuffer(i->first);
std::string basename = i->second;
=======
if (step <= 1)
if (crack != m_last_crack) {
for (auto &crack_material : m_crack_materials) {
scene::IMeshBuffer *buf = m_mesh[crack_material.first.first]->
getMeshBuffer(crack_material.first.second);
std::string basename = crack_material.second;
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
// Create new texture name from original
std::ostringstream os;
@@ -1722,15 +1418,9 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack,
}
// Texture animation
<<<<<<< HEAD:src/mapblock_mesh.cpp
if (step <= 1)
for(auto i = m_animation_tiles.begin();
i != m_animation_tiles.end(); ++i) {
const TileSpec &tile = i->second;
=======
if (step <= 1)
for (auto &animation_tile : m_animation_tiles) {
const TileLayer &tile = animation_tile.second;
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
// Figure out current frame
int frameoffset = m_animation_frame_offsets[animation_tile.first];
int frame = (int)(time * 1000 / tile.animation_frame_length_ms
@@ -1757,17 +1447,6 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack,
// Day-night transition
if (!m_enable_shaders && (daynight_ratio != m_last_daynight_ratio)) {
// Force reload mesh to VBO
<<<<<<< HEAD:src/mapblock_mesh.cpp
if (m_enable_vbo) {
m_mesh->setDirty();
}
for(std::map<u32, std::map<u32, std::pair<u8, u8> > >::iterator
i = m_daynight_diffs.begin();
i != m_daynight_diffs.end(); ++i)
{
scene::IMeshBuffer *buf = m_mesh->getMeshBuffer(i->first);
buf->setDirty(irr::scene::EBT_VERTEX);
=======
if (m_enable_vbo)
for (scene::IMesh *m : m_mesh)
m->setDirty();
@@ -1777,7 +1456,7 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack,
for (auto &daynight_diff : m_daynight_diffs) {
scene::IMeshBuffer *buf = m_mesh[daynight_diff.first.first]->
getMeshBuffer(daynight_diff.first.second);
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
buf->setDirty(irr::scene::EBT_VERTEX);
video::S3DVertex *vertices = (video::S3DVertex *)buf->getVertices();
for (const auto &j : daynight_diff.second)
final_color_blend(&(vertices[j.first].Color), j.second,
@@ -1789,130 +1468,6 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack,
return true;
}
<<<<<<< HEAD:src/mapblock_mesh.cpp
bool MapBlockMesh::updateCameraOffset(v3s16 camera_offset)
{
if (camera_offset != m_camera_offset) {
translateMesh(m_mesh, intToFloat(m_camera_offset-camera_offset, BS));
if (m_enable_vbo) {
m_mesh->setDirty();
}
m_camera_offset = camera_offset;
return true;
}
return false;
}
/*
MeshCollector
*/
void MeshCollector::append(const TileSpec &tile,
const video::S3DVertex *vertices, u32 numVertices,
const u16 *indices, u32 numIndices)
{
if (numIndices > 65535) {
dstream<<"FIXME: MeshCollector::append() called with numIndices="<<numIndices<<" (limit 65535)"<<std::endl;
return;
}
PreMeshBuffer *p = NULL;
for (u32 i = 0; i < prebuffers.size(); i++) {
PreMeshBuffer &pp = prebuffers[i];
if (pp.tile != tile)
continue;
if (pp.indices.size() + numIndices > 65535)
continue;
p = &pp;
break;
}
if (p == NULL) {
PreMeshBuffer pp;
pp.tile = tile;
prebuffers.push_back(pp);
p = &prebuffers[prebuffers.size() - 1];
}
u32 vertex_count;
if (m_use_tangent_vertices) {
vertex_count = p->tangent_vertices.size();
for (u32 i = 0; i < numVertices; i++) {
video::S3DVertexTangents vert(vertices[i].Pos, vertices[i].Normal,
vertices[i].Color, vertices[i].TCoords);
p->tangent_vertices.push_back(vert);
}
} else {
vertex_count = p->vertices.size();
for (u32 i = 0; i < numVertices; i++) {
video::S3DVertex vert(vertices[i].Pos, vertices[i].Normal,
vertices[i].Color, vertices[i].TCoords);
p->vertices.push_back(vert);
}
}
for (u32 i = 0; i < numIndices; i++) {
u32 j = indices[i] + vertex_count;
p->indices.push_back(j);
}
}
/*
MeshCollector - for meshnodes and converted drawtypes.
*/
void MeshCollector::append(const TileSpec &tile,
const video::S3DVertex *vertices, u32 numVertices,
const u16 *indices, u32 numIndices,
v3f pos, video::SColor c)
{
if (numIndices > 65535) {
dstream<<"FIXME: MeshCollector::append() called with numIndices="<<numIndices<<" (limit 65535)"<<std::endl;
return;
}
PreMeshBuffer *p = NULL;
for (u32 i = 0; i < prebuffers.size(); i++) {
PreMeshBuffer &pp = prebuffers[i];
if(pp.tile != tile)
continue;
if(pp.indices.size() + numIndices > 65535)
continue;
p = &pp;
break;
}
if (p == NULL) {
PreMeshBuffer pp;
pp.tile = tile;
prebuffers.push_back(pp);
p = &prebuffers[prebuffers.size() - 1];
}
u32 vertex_count;
if (m_use_tangent_vertices) {
vertex_count = p->tangent_vertices.size();
for (u32 i = 0; i < numVertices; i++) {
video::S3DVertexTangents vert(vertices[i].Pos + pos,
vertices[i].Normal, c, vertices[i].TCoords);
p->tangent_vertices.push_back(vert);
}
} else {
vertex_count = p->vertices.size();
for (u32 i = 0; i < numVertices; i++) {
video::S3DVertex vert(vertices[i].Pos + pos,
vertices[i].Normal, c, vertices[i].TCoords);
p->vertices.push_back(vert);
}
}
for (u32 i = 0; i < numIndices; i++) {
u32 j = indices[i] + vertex_count;
p->indices.push_back(j);
}
=======
video::SColor encode_light(u16 light, u8 emissive_light)
{
// Get components
@@ -1939,5 +1494,4 @@ video::SColor encode_light(u16 light, u8 emissive_light)
// Average light:
float b = (day + night) / 2;
return video::SColor(r, b, b, b);
>>>>>>> 5.5.0:src/client/mapblock_mesh.cpp
}
+14 -13
View File
@@ -24,6 +24,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
#include "irrlichttypes_extrabloated.h"
#include "client/tile.h"
#include "map.h"
#include "voxel.h"
#include <array>
#include <map>
@@ -62,20 +63,20 @@ struct MeshMakeData
bool m_use_shaders;
// fm:
int step;
int range;
bool no_draw;
unsigned int timestamp;
MapBlock * block;
Map & map;
MapDrawControl& draw_control;
bool debug;
bool filled;
int step = 1;
int range = 1;
bool no_draw = false;
unsigned int timestamp = 0;
MapBlock * block = nullptr;
//Map & map;
//MapDrawControl& draw_control;
bool debug = false;
bool filled = false;
MeshMakeData(Client *client, bool use_shaders,
bool use_tangent_vertices,
Map & map_, MapDrawControl& draw_control_);
~MeshMakeData();
MeshMakeData(Client *client, bool use_shaders
//Map & map_ = {nullptr},
//MapDrawControl& draw_control_ = {}
);
/*
Copy block data manually (to allow optimizations by the caller)
+3 -2
View File
@@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "mesh_generator_thread.h"
#include "client/clientmap.h"
#include "settings.h"
#include "profiler.h"
#include "client.h"
@@ -201,7 +202,7 @@ CachedMapBlockData* MeshUpdateQueue::getCachedBlock(const v3s16 &p)
void MeshUpdateQueue::fillDataFromMapBlockCache(QueuedMeshUpdate *q)
{
MeshMakeData *data = new MeshMakeData(m_client, m_cache_enable_shaders);
auto * data = new MeshMakeData(m_client, m_cache_enable_shaders);
q->data = data;
data->fillBlockDataBegin(q->p);
@@ -296,7 +297,7 @@ void MeshUpdateThread::doUpdate()
sleep_ms(m_generation_interval);
ScopeProfiler sp(g_profiler, "Client: Mesh making (sum)");
MapBlockMesh *mesh_new = new MapBlockMesh(q->data, m_camera_offset);
auto mesh_new = std::make_shared<MapBlockMesh>(q->data, m_camera_offset);
MeshUpdateResult r;
r.p = q->p;
+13 -109
View File
@@ -22,22 +22,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client.h"
#include "clientmap.h"
#include "settings.h"
<<<<<<< HEAD:src/minimap.cpp
#include "nodedef.h"
#include "porting.h"
#include "util/numeric.h"
#include "util/string.h"
#include <math.h>
#include "profiler.h"
#include "log_types.h"
=======
#include "shader.h"
#include "mapblock.h"
#include "client/renderingengine.h"
#include "gettext.h"
>>>>>>> 5.5.0:src/client/minimap.cpp
#include "profiler.h"
#include "log_types.h"
////
//// MinimapUpdateThread
@@ -121,7 +113,6 @@ void MinimapUpdateThread::doUpdate()
}
}
<<<<<<< HEAD:src/minimap.cpp
auto now = porting::getTimeMs();
if (next_update < now) {
next_update = now + 333;
@@ -129,24 +120,16 @@ void MinimapUpdateThread::doUpdate()
return;
}
bool do_update;
{
MutexAutoLock lock(data->m_mutex);
do_update = data->map_invalidated && data->mode != MINIMAP_MODE_OFF;
}
if (do_update) {
getMap(data->pos, data->map_size, data->scan_height, data->is_radar);
=======
if (data->map_invalidated && (
data->mode.type == MINIMAP_TYPE_RADAR ||
data->mode.type == MINIMAP_TYPE_SURFACE)) {
getMap(data->pos, data->mode.map_size, data->mode.scan_height);
>>>>>>> 5.5.0:src/client/minimap.cpp
data->map_invalidated = false;
}
}
#if 0
void MinimapUpdateThread::getMap(v3s16 pos, s16 size, s16 height)
{
v3s16 pos_min(pos.X - size / 2, pos.Y - height / 2, pos.Z - size / 2);
@@ -154,28 +137,6 @@ void MinimapUpdateThread::getMap(v3s16 pos, s16 size, s16 height)
v3s16 blockpos_min = getNodeBlockPos(pos_min);
v3s16 blockpos_max = getNodeBlockPos(pos_max);
<<<<<<< HEAD:src/minimap.cpp
getNodeBlockPosWithOffset(
v3s16(pos.X, pos.Y - scan_height / 2, pos.Z),
blockpos_min, relpos);
getNodeBlockPosWithOffset(
v3s16(pos.X, pos.Y + scan_height / 2, pos.Z),
blockpos_max, relpos);
for (s16 i = blockpos_max.Y; i > blockpos_min.Y - 1; i--) {
auto it =
m_blocks_cache.find(v3s16(blockpos_max.X, i, blockpos_max.Z));
if (it != m_blocks_cache.end()) {
MinimapMapblock *mmblock = it->second;
MinimapPixel *pixel = &mmblock->data[relpos.Z * MAP_BLOCKSIZE + relpos.X];
if (pixel->id != CONTENT_AIR) {
*pixel_height = height + pixel->height;
return pixel;
}
}
height -= MAP_BLOCKSIZE;
=======
// clear the map
for (int z = 0; z < size; z++)
for (int x = 0; x < size; x++) {
@@ -183,7 +144,6 @@ void MinimapUpdateThread::getMap(v3s16 pos, s16 size, s16 height)
mmpixel.air_count = 0;
mmpixel.height = 0;
mmpixel.n = MapNode(CONTENT_AIR);
>>>>>>> 5.5.0:src/client/minimap.cpp
}
// draw the map
@@ -211,38 +171,6 @@ void MinimapUpdateThread::getMap(v3s16 pos, s16 size, s16 height)
const MinimapPixel &in_pixel =
block.data[inblock_pos.Z * MAP_BLOCKSIZE + inblock_pos.X];
<<<<<<< HEAD:src/minimap.cpp
for (s16 i = blockpos_max.Y; i > blockpos_min.Y - 1; i--) {
auto it =
m_blocks_cache.find(v3s16(blockpos_max.X, i, blockpos_max.Z));
if (it != m_blocks_cache.end()) {
MinimapMapblock *mmblock = it->second;
MinimapPixel *pixel = &mmblock->data[relpos.Z * MAP_BLOCKSIZE + relpos.X];
air_count += pixel->air_count;
}
}
return air_count;
}
#if 0
void MinimapUpdateThread::getMap(v3s16 pos, s16 size, s16 height, bool is_radar)
{
v3s16 p = v3s16(pos.X - size / 2, pos.Y, pos.Z - size / 2);
for (s16 x = 0; x < size; x++)
for (s16 z = 0; z < size; z++) {
u16 id = CONTENT_AIR;
MinimapPixel *mmpixel = &data->minimap_scan[x + z * size];
if (!is_radar) {
s16 pixel_height = 0;
MinimapPixel *cached_pixel =
getMinimapPixel(v3s16(p.X + x, p.Y, p.Z + z), height, &pixel_height);
if (cached_pixel) {
id = cached_pixel->id;
mmpixel->height = pixel_height;
=======
v3s16 inmap_pos = pos - pos_min;
MinimapPixel &out_pixel =
data->minimap_scan[inmap_pos.X + inmap_pos.Z * size];
@@ -251,7 +179,6 @@ void MinimapUpdateThread::getMap(v3s16 pos, s16 size, s16 height, bool is_radar)
if (in_pixel.n.param0 != CONTENT_AIR) {
out_pixel.n = in_pixel.n;
out_pixel.height = inmap_pos.Y + in_pixel.height;
>>>>>>> 5.5.0:src/client/minimap.cpp
}
}
}
@@ -279,9 +206,7 @@ Minimap::Minimap(Client *client)
m_surface_mode_scan_height =
g_settings->getBool("minimap_double_scan_height") ? 256 : 128;
<<<<<<< HEAD:src/minimap.cpp
setAngle(0);
=======
// Initialize minimap modes
addMode(MINIMAP_TYPE_OFF);
addMode(MINIMAP_TYPE_SURFACE, 256);
@@ -290,7 +215,6 @@ Minimap::Minimap(Client *client)
addMode(MINIMAP_TYPE_RADAR, 512);
addMode(MINIMAP_TYPE_RADAR, 256);
addMode(MINIMAP_TYPE_RADAR, 128);
>>>>>>> 5.5.0:src/client/minimap.cpp
// Initialize minimap data
data = new MinimapData;
@@ -377,36 +301,16 @@ void Minimap::toggleMinimapShape()
void Minimap::setMinimapShape(MinimapShape shape)
{
<<<<<<< HEAD:src/minimap.cpp
static const MinimapModeDef modedefs[MINIMAP_MODE_COUNT] = {
{false, 0, 0},
{false, m_surface_mode_scan_height, 256},
{false, m_surface_mode_scan_height, 128},
{false, m_surface_mode_scan_height, 64},
{true, 32, 128},
{true, 32, 64},
{true, 32, 32}
};
if (mode >= MINIMAP_MODE_COUNT)
return;
MutexAutoLock lock(data->m_mutex);
=======
MutexAutoLock lock(m_mutex);
>>>>>>> 5.5.0:src/client/minimap.cpp
if (shape == MINIMAP_SHAPE_SQUARE)
data->minimap_shape_round = false;
else if (shape == MINIMAP_SHAPE_ROUND)
data->minimap_shape_round = true;
<<<<<<< HEAD:src/minimap.cpp
m_minimap_update_thread->next_update = 0;
=======
g_settings->setBool("minimap_shape_round", data->minimap_shape_round);
>>>>>>> 5.5.0:src/client/minimap.cpp
m_minimap_update_thread->deferUpdate();
}
@@ -421,7 +325,7 @@ MinimapShape Minimap::getMinimapShape()
void Minimap::setModeIndex(size_t index)
{
MutexAutoLock lock(m_mutex);
MutexAutoLock lock(data->m_mutex);
if (index < m_modes.size()) {
data->mode = m_modes[index];
@@ -886,8 +790,8 @@ void MinimapMapblock::getMinimapNodes(VoxelManipulator *vmanip, const v3s16 &pos
///freeminer:
void MinimapUpdateThread::getMap(v3POS pos, s16 size, s16 scan_height, bool is_radar) {
void MinimapUpdateThread::getMap(v3s16 pos, s16 size, s16 scan_height) {
//void MinimapUpdateThread::getMap(v3POS pos, s16 size, s16 scan_height, bool is_radar) {
v3POS p(pos.X - size / 2, pos.Y, pos.Z - size / 2);
v3POS blockpos_player, relpos;
@@ -897,7 +801,7 @@ void MinimapUpdateThread::getMap(v3POS pos, s16 size, s16 scan_height, bool is_r
for (s16 z = 0; z < size; z++) {
auto mmpixel = &data->minimap_scan[x + z * size];
mmpixel->air_count = 0;
mmpixel->id = CONTENT_AIR;
mmpixel->n = CONTENT_AIR;
v3POS pos(p.X + x, p.Y, p.Z + z);
v3POS blockpos_max, blockpos_min;
@@ -941,12 +845,12 @@ void MinimapUpdateThread::getMap(v3POS pos, s16 size, s16 scan_height, bool is_r
auto & mmblock = it.second;
auto pixel = &mmblock->data[relpos.Z * MAP_BLOCKSIZE + relpos.X];
mmpixel->air_count += pixel->air_count;
if (pixel->id != CONTENT_AIR) {
if (pixel->n.param0 != CONTENT_AIR) {
pixel_height = height + pixel->height;
mmpixel->id = pixel->id;
mmpixel->n = pixel->n;
mmpixel->height = pixel_height;
if (!is_radar)
break;
/*if (!is_radar)
break;*/
}
height -= MAP_BLOCKSIZE;
}
-99
View File
@@ -394,36 +394,6 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
// Handle nodes
// See also CItemDefManager::createClientCached()
<<<<<<< HEAD:src/wieldmesh.cpp
else if (def.type == ITEM_NODE) {
if (f.mesh_ptr[0]) {
// e.g. mesh nodes and nodeboxes
changeToMesh(f.mesh_ptr[0]);
// mesh_ptr[0] is pre-scaled by BS * f->visual_scale
m_meshnode->setScale(
def.wield_scale * WIELD_SCALE_FACTOR
/ (BS * f.visual_scale));
} else if (f.drawtype == NDT_AIRLIKE) {
changeToMesh(NULL);
} else if (f.drawtype == NDT_PLANTLIKE) {
setExtruded(tsrc->getTextureName(f.tiles[0].texture_id), def.wield_scale, tsrc, f.tiles[0].animation_frame_count);
} else if (f.drawtype == NDT_NORMAL || f.drawtype == NDT_ALLFACES) {
setCube(f.tiles, def.wield_scale, tsrc);
} else {
Map map(gamedef);
MapDrawControl map_draw_control;
//// TODO: Change false in the following constructor args to
//// appropriate value when shader is added for wield items (if applicable)
MeshMakeData mesh_make_data(gamedef, false, false, map, map_draw_control);
MapNode mesh_make_node(id, 255, 0);
mesh_make_data.fillSingleNode(&mesh_make_node);
MapBlockMesh mapblock_mesh(&mesh_make_data, v3s16(0, 0, 0));
changeToMesh(mapblock_mesh.getMesh());
translateMesh(m_meshnode->getMesh(), v3f(-BS, -BS, -BS));
m_meshnode->setScale(
def.wield_scale * WIELD_SCALE_FACTOR
/ (BS * f.visual_scale));
=======
if (def.type == ITEM_NODE) {
bool cull_backface = f.needsBackfaceCulling();
@@ -451,7 +421,6 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
const TileLayer &l1 = f.tiles[0].layers[1];
m_colors.emplace_back(l1.has_color, l1.color);
break;
>>>>>>> 5.5.0:src/client/wieldmesh.cpp
}
case NDT_PLANTLIKE_ROOTED: {
setExtruded(tsrc->getTextureName(f.special_tiles[0].layers[0].texture_id),
@@ -613,73 +582,6 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
def.inventory_overlay);
result->needs_shading = false;
} else if (def.type == ITEM_NODE) {
<<<<<<< HEAD:src/wieldmesh.cpp
if (f.mesh_ptr[0]) {
mesh = cloneMesh(f.mesh_ptr[0]);
scaleMesh(mesh, v3f(0.12, 0.12, 0.12));
setMeshColor(mesh, video::SColor (255, 255, 255, 255));
} else if (f.drawtype == NDT_PLANTLIKE) {
mesh = getExtrudedMesh(tsrc,
tsrc->getTextureName(f.tiles[0].texture_id));
return mesh;
} else if (f.drawtype == NDT_NORMAL || f.drawtype == NDT_ALLFACES
|| f.drawtype == NDT_LIQUID || f.drawtype == NDT_FLOWINGLIQUID) {
mesh = cloneMesh(g_extrusion_mesh_cache->createCube());
scaleMesh(mesh, v3f(1.2, 1.2, 1.2));
} else {
//fm:
// /*
Map map(gamedef);
MapDrawControl map_draw_control;
MeshMakeData mesh_make_data(gamedef, false, false, map, map_draw_control);
v3POS bp = v3POS(32000, 32000, 32000-id);
auto block = map.createBlankBlockNoInsert(bp);
auto air_node = MapNode(CONTENT_AIR, LIGHT_MAX);
for(s16 z0=0; z0<=2; ++z0)
for(s16 y0=0; y0<=2; ++y0)
for(s16 x0=0; x0<=2; ++x0) {
v3s16 p(x0,y0,z0);
block->setNode(p, air_node);
}
u8 param1 = 0;
u8 param2 = 0;
if (f.param_type_2 == CPT2_WALLMOUNTED)
param2 = 1;
MapNode mesh_make_node(id, param1, param2);
mesh_make_data.fillSingleNode(&mesh_make_node, bp);
block->setNode(v3s16(1,1,1), mesh_make_node);
map.insertBlock(block);
MapBlockMesh mapblock_mesh(&mesh_make_data, bp*MAP_BLOCKSIZE);
// */
//==
/*MT
MeshMakeData mesh_make_data(gamedef, false);
MapNode mesh_make_node(id, 255, 0);
mesh_make_data.fillSingleNode(&mesh_make_node);
MapBlockMesh mapblock_mesh(&mesh_make_data, v3s16(0, 0, 0));
*/
mesh = cloneMesh(mapblock_mesh.getMesh());
translateMesh(mesh, v3f(-BS, -BS, -BS));
scaleMesh(mesh, v3f(0.12, 0.12, 0.12));
rotateMeshXZby(mesh, -45);
rotateMeshYZby(mesh, -30);
u32 mc = mesh->getMeshBufferCount();
for (u32 i = 0; i < mc; ++i) {
video::SMaterial &material1 =
mesh->getMeshBuffer(i)->getMaterial();
video::SMaterial &material2 =
mapblock_mesh.getMesh()->getMeshBuffer(i)->getMaterial();
material1.setTexture(0, material2.getTexture(0));
material1.setTexture(1, material2.getTexture(1));
material1.setTexture(2, material2.getTexture(2));
material1.setTexture(3, material2.getTexture(3));
material1.MaterialType = material2.MaterialType;
}
return mesh;
=======
switch (f.drawtype) {
case NDT_NORMAL:
case NDT_ALLFACES:
@@ -699,7 +601,6 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
if (f.drawtype == NDT_ALLFACES)
scaleMesh(mesh, v3f(f.visual_scale));
break;
>>>>>>> 5.5.0:src/client/wieldmesh.cpp
}
case NDT_PLANTLIKE: {
mesh = getExtrudedMesh(tsrc,
+1 -1
View File
@@ -22,6 +22,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
#include <sstream>
#include "clientiface.h"
#include "log.h"
#include "network/connection.h"
#include "network/serveropcodes.h"
#include "remoteplayer.h"
@@ -1133,7 +1134,6 @@ void ClientInterface::sendToAll(NetworkPacket *pkt)
auto clientslock = m_clients.lock_shared_rec();
for (auto &client_it : m_clients) {
const auto client = client_it.second;
if (client->net_proto_version != 0) {
m_con->Send(client->peer_id,
clientCommandFactoryTable[pkt->getCommand()].channel, pkt,
+1 -1
View File
@@ -16,7 +16,7 @@
#cmakedefine01 USE_ICONV
#cmakedefine01 USE_SCTP
#cmakedefine01 LOCK_PROFILE
#cmakedefine01 BUILD_CLIENT
#define PROJECT_NAME "@PROJECT_NAME@"
+2 -2
View File
@@ -34,7 +34,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
// freeminer part:
#include "network/connection.h" // ENET_IPV6
#ifndef SERVER // Only on client
#include "minimap.h"
#include "hud.h"
#endif
@@ -211,7 +211,7 @@ void fm_set_default_settings(Settings *settings) {
// TODO: refactor and resolve client/server dependencies
#ifndef SERVER // Only on client
settings->setDefault("minimap_default_mode", itos(MINIMAP_MODE_SURFACEx1));
settings->setDefault("minimap_default_mode", itos(MINIMAP_TYPE_SURFACE));
#endif
#if !MINETEST_PROTO
+2 -2
View File
@@ -489,7 +489,7 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
}
//if (event.KeyInput.Key == KEY_ESCAPE) {
if ( (kp == EscapeKey || kp == CancelKey) && ((int)event.KeyInput.Key == (int)event.KeyInput.Char) )
if ( (kp == EscapeKey || kp == CancelKey) && ((int)event.KeyInput.Key == (int)event.KeyInput.Char) ) {
closeConsoleAtOnce();
m_close_on_enter = false;
// inhibit open so the_game doesn't reopen immediately
@@ -519,7 +519,7 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
prompt.addToHistory(prompt.getLine());
std::wstring text = prompt.replace(L"");
m_client->typeChatMessage(wide_to_utf8(text));
m_client->typeChatMessage(text);
if (m_close_on_enter) {
closeConsoleAtOnce();
m_close_on_enter = false;
+7 -656
View File
@@ -3,13 +3,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
<<<<<<< HEAD:src/intlGUIEditBox.cpp
#include "intlGUIEditBox.h"
#ifdef _IRR_COMPILE_WITH_GUI_
=======
#include "guiEditBoxWithScrollbar.h"
>>>>>>> 5.5.0:src/gui/guiEditBoxWithScrollbar.cpp
#include "IGUISkin.h"
#include "IGUIEnvironment.h"
@@ -17,13 +11,7 @@
#include "IVideoDriver.h"
#include "rect.h"
#include "porting.h"
<<<<<<< HEAD:src/intlGUIEditBox.cpp
//#include "Keycodes.h"
#include "log.h"
//#include "util/string.h"
=======
#include "Keycodes.h"
>>>>>>> 5.5.0:src/gui/guiEditBoxWithScrollbar.cpp
/*
todo:
@@ -72,28 +60,7 @@ GUIEditBoxWithScrollBar::GUIEditBoxWithScrollBar(const wchar_t* text, bool borde
//! Sets whether to draw the background
void GUIEditBoxWithScrollBar::setDrawBackground(bool draw)
{
<<<<<<< HEAD:src/intlGUIEditBox.cpp
}
//! Sets if the text should use the overide color or the color in the gui skin.
void intlGUIEditBox::enableOverrideColor(bool enable)
{
OverrideColorEnabled = enable;
}
bool intlGUIEditBox::isOverrideColorEnabled() const
{
return OverrideColorEnabled;
}
//! Enables or disables word wrap
void intlGUIEditBox::setWordWrap(bool enable)
{
WordWrap = enable;
breakText();
=======
m_background = draw;
>>>>>>> 5.5.0:src/gui/guiEditBoxWithScrollbar.cpp
}
@@ -101,601 +68,8 @@ void GUIEditBoxWithScrollBar::updateAbsolutePosition()
{
core::rect<s32> old_absolute_rect(AbsoluteRect);
IGUIElement::updateAbsolutePosition();
<<<<<<< HEAD:src/intlGUIEditBox.cpp
if ( oldAbsoluteRect != AbsoluteRect )
{
breakText();
}
}
//! Checks if word wrap is enabled
bool intlGUIEditBox::isWordWrapEnabled() const
{
return WordWrap;
}
//! Enables or disables newlines.
void intlGUIEditBox::setMultiLine(bool enable)
{
MultiLine = enable;
}
//! Checks if multi line editing is enabled
bool intlGUIEditBox::isMultiLineEnabled() const
{
return MultiLine;
}
void intlGUIEditBox::setPasswordBox(bool passwordBox, wchar_t passwordChar)
{
PasswordBox = passwordBox;
if (PasswordBox)
{
PasswordChar = passwordChar;
setMultiLine(false);
setWordWrap(false);
BrokenText.clear();
}
}
bool intlGUIEditBox::isPasswordBox() const
{
return PasswordBox;
}
//! Sets text justification
void intlGUIEditBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical)
{
HAlign = horizontal;
VAlign = vertical;
}
//! called if an event happened.
bool intlGUIEditBox::OnEvent(const SEvent& event)
{
if (IsEnabled)
{
switch(event.EventType)
{
case EET_GUI_EVENT:
if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUS_LOST)
{
if (event.GUIEvent.Caller == this)
{
MouseMarking = false;
setTextMarkers(0,0);
}
}
break;
case EET_KEY_INPUT_EVENT:
{
#if (defined(linux) || defined(__FreeBSD__)) and IRRLICHT_VERSION_10000 < 10900
// ################################################################
// ValkaTR:
// This part is the difference from the original intlGUIEditBox
// It converts UTF-8 character into a UCS-2 (wchar_t)
wchar_t wc = L'_';
mbtowc( &wc, (char *) &event.KeyInput.Char, sizeof(event.KeyInput.Char) );
//printf( "char: %lc (%u) \r\n", wc, wc );
SEvent irrevent(event);
irrevent.KeyInput.Char = wc;
// ################################################################
if (processKey(irrevent))
return true;
#else
if (processKey(event))
return true;
#endif // defined(linux)
break;
}
case EET_MOUSE_INPUT_EVENT:
if (processMouse(event))
return true;
break;
default:
break;
}
}
return IGUIElement::OnEvent(event);
}
bool intlGUIEditBox::processKey(const SEvent& event)
{
if (!event.KeyInput.PressedDown)
return false;
bool textChanged = false;
s32 newMarkBegin = MarkBegin;
s32 newMarkEnd = MarkEnd;
// control shortcut handling
if (event.KeyInput.Control)
{
// german backlash '\' entered with control + '?'
if ( event.KeyInput.Char == '\\' )
{
inputChar(event.KeyInput.Char);
return true;
}
switch(event.KeyInput.Key)
{
case KEY_KEY_A:
// select all
newMarkBegin = 0;
newMarkEnd = Text.size();
break;
case KEY_KEY_C:
// copy to clipboard
if (!PasswordBox && Operator && MarkBegin != MarkEnd)
{
const s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
core::stringc s;
s = Text.subString(realmbgn, realmend - realmbgn).c_str();
Operator->copyToClipboard(s.c_str());
}
break;
case KEY_KEY_X:
// cut to the clipboard
if (!PasswordBox && Operator && MarkBegin != MarkEnd)
{
const s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
// copy
core::stringc sc;
sc = Text.subString(realmbgn, realmend - realmbgn).c_str();
Operator->copyToClipboard(sc.c_str());
if (IsEnabled)
{
// delete
core::stringw s;
s = Text.subString(0, realmbgn);
s.append( Text.subString(realmend, Text.size()-realmend) );
Text = s;
CursorPos = realmbgn;
newMarkBegin = 0;
newMarkEnd = 0;
textChanged = true;
}
}
break;
case KEY_KEY_V:
if ( !IsEnabled )
break;
// paste from the clipboard
if (Operator)
{
const s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
// add new character
const c8* p = Operator->getTextFromClipboard();
if (p)
{
if (MarkBegin == MarkEnd)
{
// insert text
core::stringw s = Text.subString(0, CursorPos);
s.append(p);
s.append( Text.subString(CursorPos, Text.size()-CursorPos) );
if (!Max || s.size()<=Max) // thx to Fish FH for fix
{
Text = s;
s = p;
CursorPos += s.size();
}
}
else
{
// replace text
core::stringw s = Text.subString(0, realmbgn);
s.append(p);
s.append( Text.subString(realmend, Text.size()-realmend) );
if (!Max || s.size()<=Max) // thx to Fish FH for fix
{
Text = s;
s = p;
CursorPos = realmbgn + s.size();
}
}
}
newMarkBegin = 0;
newMarkEnd = 0;
textChanged = true;
}
break;
case KEY_HOME:
// move/highlight to start of text
if (event.KeyInput.Shift)
{
newMarkEnd = CursorPos;
newMarkBegin = 0;
CursorPos = 0;
}
else
{
CursorPos = 0;
newMarkBegin = 0;
newMarkEnd = 0;
}
break;
case KEY_END:
// move/highlight to end of text
if (event.KeyInput.Shift)
{
newMarkBegin = CursorPos;
newMarkEnd = Text.size();
CursorPos = 0;
}
else
{
CursorPos = Text.size();
newMarkBegin = 0;
newMarkEnd = 0;
}
break;
default:
return false;
}
}
// default keyboard handling
else
switch(event.KeyInput.Key)
{
case KEY_END:
// Handle numpad input
if (event.KeyInput.Char != 0) {
inputChar(event.KeyInput.Char);
return true;
}
{
s32 p = Text.size();
if (WordWrap || MultiLine)
{
p = getLineFromPos(CursorPos);
p = BrokenTextPositions[p] + (s32)BrokenText[p].size();
if (p > 0 && (Text[p-1] == L'\r' || Text[p-1] == L'\n' ))
p-=1;
}
if (event.KeyInput.Shift)
{
if (MarkBegin == MarkEnd)
newMarkBegin = CursorPos;
newMarkEnd = p;
}
else
{
newMarkBegin = 0;
newMarkEnd = 0;
}
CursorPos = p;
BlinkStartTime = porting::getTimeMs();
}
break;
case KEY_HOME:
// Handle numpad input
if (event.KeyInput.Char != 0) {
inputChar(event.KeyInput.Char);
return true;
}
{
s32 p = 0;
if (WordWrap || MultiLine)
{
p = getLineFromPos(CursorPos);
p = BrokenTextPositions[p];
}
if (event.KeyInput.Shift)
{
if (MarkBegin == MarkEnd)
newMarkBegin = CursorPos;
newMarkEnd = p;
}
else
{
newMarkBegin = 0;
newMarkEnd = 0;
}
CursorPos = p;
BlinkStartTime = porting::getTimeMs();
}
break;
case KEY_RETURN:
if (MultiLine)
{
inputChar(L'\n');
return true;
}
else
{
sendGuiEvent( EGET_EDITBOX_ENTER );
}
break;
case KEY_LEFT:
// Handle numpad input
if (event.KeyInput.Char != 0) {
inputChar(event.KeyInput.Char);
return true;
}
if (event.KeyInput.Shift)
{
if (CursorPos > 0)
{
if (MarkBegin == MarkEnd)
newMarkBegin = CursorPos;
newMarkEnd = CursorPos-1;
}
}
else
{
newMarkBegin = 0;
newMarkEnd = 0;
}
if (CursorPos > 0) CursorPos--;
BlinkStartTime = porting::getTimeMs();
break;
case KEY_RIGHT:
// Handle numpad input
if (event.KeyInput.Char != 0) {
inputChar(event.KeyInput.Char);
return true;
}
if (event.KeyInput.Shift)
{
if (Text.size() > (u32)CursorPos)
{
if (MarkBegin == MarkEnd)
newMarkBegin = CursorPos;
newMarkEnd = CursorPos+1;
}
}
else
{
newMarkBegin = 0;
newMarkEnd = 0;
}
if (Text.size() > (u32)CursorPos) CursorPos++;
BlinkStartTime = porting::getTimeMs();
break;
case KEY_UP:
// Handle numpad input
if (event.KeyInput.Char != 0) {
inputChar(event.KeyInput.Char);
return true;
}
if (MultiLine || (WordWrap && BrokenText.size() > 1) )
{
s32 lineNo = getLineFromPos(CursorPos);
s32 mb = (MarkBegin == MarkEnd) ? CursorPos : (MarkBegin > MarkEnd ? MarkBegin : MarkEnd);
if (lineNo > 0)
{
s32 cp = CursorPos - BrokenTextPositions[lineNo];
if ((s32)BrokenText[lineNo-1].size() < cp)
CursorPos = BrokenTextPositions[lineNo-1] + (s32)BrokenText[lineNo-1].size()-1;
else
CursorPos = BrokenTextPositions[lineNo-1] + cp;
}
if (event.KeyInput.Shift)
{
newMarkBegin = mb;
newMarkEnd = CursorPos;
}
else
{
newMarkBegin = 0;
newMarkEnd = 0;
}
}
else
{
return false;
}
break;
case KEY_DOWN:
// Handle numpad input
if (event.KeyInput.Char != 0) {
inputChar(event.KeyInput.Char);
return true;
}
if (MultiLine || (WordWrap && BrokenText.size() > 1) )
{
s32 lineNo = getLineFromPos(CursorPos);
s32 mb = (MarkBegin == MarkEnd) ? CursorPos : (MarkBegin < MarkEnd ? MarkBegin : MarkEnd);
if (lineNo < (s32)BrokenText.size()-1)
{
s32 cp = CursorPos - BrokenTextPositions[lineNo];
if ((s32)BrokenText[lineNo+1].size() < cp)
CursorPos = BrokenTextPositions[lineNo+1] + BrokenText[lineNo+1].size()-1;
else
CursorPos = BrokenTextPositions[lineNo+1] + cp;
}
if (event.KeyInput.Shift)
{
newMarkBegin = mb;
newMarkEnd = CursorPos;
}
else
{
newMarkBegin = 0;
newMarkEnd = 0;
}
}
else
{
return false;
}
break;
case KEY_BACK:
if ( !this->IsEnabled )
break;
if (Text.size())
{
core::stringw s;
if (MarkBegin != MarkEnd)
{
// delete marked text
const s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
s = Text.subString(0, realmbgn);
s.append( Text.subString(realmend, Text.size()-realmend) );
Text = s;
CursorPos = realmbgn;
}
else
{
// delete text behind cursor
if (CursorPos>0)
s = Text.subString(0, CursorPos-1);
else
s = L"";
s.append( Text.subString(CursorPos, Text.size()-CursorPos) );
Text = s;
--CursorPos;
}
if (CursorPos < 0)
CursorPos = 0;
BlinkStartTime = porting::getTimeMs();
newMarkBegin = 0;
newMarkEnd = 0;
textChanged = true;
}
break;
case KEY_DELETE:
if ( !this->IsEnabled )
break;
// Handle numpad input
if (event.KeyInput.Char != 0 && event.KeyInput.Char != 127) {
inputChar(event.KeyInput.Char);
return true;
}
if (Text.size() != 0)
{
core::stringw s;
if (MarkBegin != MarkEnd)
{
// delete marked text
const s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
s = Text.subString(0, realmbgn);
s.append( Text.subString(realmend, Text.size()-realmend) );
Text = s;
CursorPos = realmbgn;
}
else
{
// delete text before cursor
s = Text.subString(0, CursorPos);
s.append( Text.subString(CursorPos+1, Text.size()-CursorPos-1) );
Text = s;
}
if (CursorPos > (s32)Text.size())
CursorPos = (s32)Text.size();
BlinkStartTime = porting::getTimeMs();
newMarkBegin = 0;
newMarkEnd = 0;
textChanged = true;
}
break;
case KEY_SHIFT:
if (event.KeyInput.Char != 0) {
inputChar(event.KeyInput.Char);
return true;
}
break;
case KEY_ESCAPE:
case KEY_TAB:
case KEY_F1:
case KEY_F2:
case KEY_F3:
case KEY_F4:
case KEY_F5:
case KEY_F6:
case KEY_F7:
case KEY_F8:
case KEY_F9:
case KEY_F10:
case KEY_F11:
case KEY_F12:
case KEY_F13:
case KEY_F14:
case KEY_F15:
case KEY_F16:
case KEY_F17:
case KEY_F18:
case KEY_F19:
case KEY_F20:
case KEY_F21:
case KEY_F22:
case KEY_F23:
case KEY_F24:
// ignore these keys
return false;
default:
inputChar(event.KeyInput.Char);
return true;
}
// Set new text markers
setTextMarkers( newMarkBegin, newMarkEnd );
// break the text if it has changed
if (textChanged)
{
=======
if (old_absolute_rect != AbsoluteRect) {
calculateFrameRect();
>>>>>>> 5.5.0:src/gui/guiEditBoxWithScrollbar.cpp
breakText();
calculateScrollPos();
}
@@ -720,6 +94,13 @@ void GUIEditBoxWithScrollBar::draw()
default_bg_color = m_writable ? skin->getColor(EGDC_WINDOW) : video::SColor(0);
bg_color = m_bg_color_used ? m_bg_color : default_bg_color;
//fmtodo?:
/*
bg_color = EGDC_GRAY_EDITABLE;
if (isEnabled())
bg_color = focus ? EGDC_FOCUSED_EDITABLE : EGDC_EDITABLE;
*/
if (!m_border && m_background) {
skin->draw2DRectangle(this, bg_color, AbsoluteRect, &AbsoluteClippingRect);
}
@@ -734,14 +115,7 @@ void GUIEditBoxWithScrollBar::draw()
// draw the border
<<<<<<< HEAD:src/intlGUIEditBox.cpp
if (Border)
{
skin->draw3DSunkenPane(this, skin->getColor(bgCol),
false, true, FrameRect, &AbsoluteClippingRect);
=======
if (m_border) {
>>>>>>> 5.5.0:src/gui/guiEditBoxWithScrollbar.cpp
if (m_writable) {
skin->draw3DSunkenPane(this, bg_color, false, m_background,
@@ -915,30 +289,7 @@ s32 GUIEditBoxWithScrollBar::getCursorPos(s32 x, s32 y)
s32 start_pos = 0;
x += 3;
<<<<<<< HEAD:src/intlGUIEditBox.cpp
//! Checks to see if automatic scrolling is enabled
//! \return true if automatic scrolling is enabled, false if not
bool intlGUIEditBox::isAutoScrollEnabled() const
{
return AutoScroll;
}
//! Gets the area of the text in the edit box
//! \return Returns the size in pixels of the text
core::dimension2du intlGUIEditBox::getTextDimension()
{
core::rect<s32> ret;
setTextRect(0);
ret = CurrentTextRect;
for (u32 i=1; i < BrokenText.size(); ++i)
{
=======
for (u32 i = 0; i < line_count; ++i) {
>>>>>>> 5.5.0:src/gui/guiEditBoxWithScrollbar.cpp
setTextRect(i);
if (i == 0 && y < m_current_text_rect.UpperLeftCorner.Y)
y = m_current_text_rect.UpperLeftCorner.Y;
+1 -14
View File
@@ -77,22 +77,13 @@ video::ITexture *MenuTextureSource::getTexture(const std::string &name, u32 *id)
if (id)
*id = 0;
<<<<<<< HEAD:src/guiEngine.cpp
#ifdef __ANDROID__
porting::irr_device_wait_egl();
video::IImage *image = m_driver->createImageFromFile(name.c_str());
if (image) {
image = Align2Npot2(image, m_driver);
video::ITexture* retval = m_driver->addTexture(name.c_str(), image);
image->drop();
=======
if (name.empty())
return NULL;
#if ENABLE_GLES
porting::irr_device_wait_egl();
video::ITexture *retval = m_driver->findTexture(name.c_str());
if (retval)
>>>>>>> 5.5.0:src/gui/guiEngine.cpp
return retval;
video::IImage *image = m_driver->createImageFromFile(name.c_str());
@@ -399,10 +390,6 @@ void GUIEngine::cloudPreProcess()
/******************************************************************************/
void GUIEngine::cloudPostProcess(u32 frametime_min, IrrlichtDevice *device)
{
<<<<<<< HEAD:src/guiEngine.cpp
static const float fps_max = g_settings->getFloat("pause_fps_max");
=======
>>>>>>> 5.5.0:src/gui/guiEngine.cpp
// Time of frame without fps limit
u32 busytime_u32;
File diff suppressed because it is too large. Load diff
+2 -29
View File
@@ -297,14 +297,9 @@ bool GUIKeyChangeMenu::resetMenu()
}
bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
{
<<<<<<< HEAD:src/guiKeyChangeMenu.cpp
if (GUIModalMenu::OnEvent(event))
return true;
if (event.EventType == EET_KEY_INPUT_EVENT && activeKey >= 0
=======
if (event.EventType == EET_KEY_INPUT_EVENT && active_key
>>>>>>> 5.5.0:src/gui/guiKeyChangeMenu.cpp
&& event.KeyInput.PressedDown) {
bool prefer_character = shift_down;
@@ -424,30 +419,8 @@ void GUIKeyChangeMenu::add_key(int id, const wchar_t *button_name, const std::st
void GUIKeyChangeMenu::init_keys()
{
<<<<<<< HEAD:src/guiKeyChangeMenu.cpp
this->add_key(GUI_ID_KEY_PL_LIST_BUTTON, wgettext("Player list"), "keymap_playerlist");
this->add_key(GUI_ID_KEY_FORWARD_BUTTON, wgettext("Forward"), "keymap_forward");
this->add_key(GUI_ID_KEY_BACKWARD_BUTTON, wgettext("Backward"), "keymap_backward");
this->add_key(GUI_ID_KEY_LEFT_BUTTON, wgettext("Left"), "keymap_left");
this->add_key(GUI_ID_KEY_RIGHT_BUTTON, wgettext("Right"), "keymap_right");
this->add_key(GUI_ID_KEY_USE_BUTTON, wgettext("Use"), "keymap_special1");
this->add_key(GUI_ID_KEY_JUMP_BUTTON, wgettext("Jump"), "keymap_jump");
this->add_key(GUI_ID_KEY_SNEAK_BUTTON, wgettext("Sneak"), "keymap_sneak");
this->add_key(GUI_ID_KEY_DROP_BUTTON, wgettext("Drop"), "keymap_drop");
this->add_key(GUI_ID_KEY_INVENTORY_BUTTON, wgettext("Inventory"), "keymap_inventory");
this->add_key(GUI_ID_KEY_CHAT_BUTTON, wgettext("Chat"), "keymap_chat");
this->add_key(GUI_ID_KEY_CMD_BUTTON, wgettext("Command"), "keymap_cmd");
this->add_key(GUI_ID_KEY_CONSOLE_BUTTON, wgettext("Console"), "keymap_console");
this->add_key(GUI_ID_KEY_FLY_BUTTON, wgettext("Toggle fly"), "keymap_freemove");
this->add_key(GUI_ID_KEY_FAST_BUTTON, wgettext("Toggle fast"), "keymap_fastmove");
this->add_key(GUI_ID_KEY_CINEMATIC_BUTTON, wgettext("Toggle Cinematic"), "keymap_cinematic");
this->add_key(GUI_ID_KEY_NOCLIP_BUTTON, wgettext("Toggle noclip"), "keymap_noclip");
this->add_key(GUI_ID_KEY_RANGE_BUTTON, wgettext("Range select"), "keymap_rangeselect");
this->add_key(GUI_ID_KEY_DUMP_BUTTON, wgettext("Print stacks"), "keymap_print_debug_stacks");
this->add_key(GUI_ID_KEY_ZOOM_BUTTON, wgettext("Zoom"), "keymap_zoom");
this->add_key(GUI_ID_KEY_PL_LIST_BUTTON, wgettext("Player list"), "keymap_playerlist");
=======
this->add_key(GUI_ID_KEY_FORWARD_BUTTON, wgettext("Forward"), "keymap_forward");
this->add_key(GUI_ID_KEY_BACKWARD_BUTTON, wgettext("Backward"), "keymap_backward");
this->add_key(GUI_ID_KEY_LEFT_BUTTON, wgettext("Left"), "keymap_left");
@@ -482,5 +455,5 @@ void GUIKeyChangeMenu::init_keys()
this->add_key(GUI_ID_KEY_HUD_BUTTON, wgettext("Toggle HUD"), "keymap_toggle_hud");
this->add_key(GUI_ID_KEY_CHATLOG_BUTTON, wgettext("Toggle chat log"), "keymap_toggle_chat");
this->add_key(GUI_ID_KEY_FOG_BUTTON, wgettext("Toggle fog"), "keymap_toggle_fog");
>>>>>>> 5.5.0:src/gui/guiKeyChangeMenu.cpp
}
+4 -79
View File
@@ -86,17 +86,10 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
*/
removeChildren();
const static double gui_scaling = g_settings->getFloat("hud_scaling"); // gui_scaling here or get from pixel ratio
//const static double gui_scaling = g_settings->getFloat("hud_scaling"); // gui_scaling here or get from pixel ratio
/*
Calculate new sizes and positions
*/
<<<<<<< HEAD:src/guiPasswordChange.cpp
core::rect<s32> rect(
screensize.X/2 - 580/2/gui_scaling,
screensize.Y/2 - 300/2/gui_scaling,
screensize.X/2 + 580/2/gui_scaling,
screensize.Y/2 + 300/2/gui_scaling
=======
#ifdef HAVE_TOUCHSCREENGUI
const float s = m_gui_scale * RenderingEngine::getDisplayDensity() / 2;
#else
@@ -107,52 +100,26 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
screensize.Y / 2 - 300 * s / 2,
screensize.X / 2 + 580 * s / 2,
screensize.Y / 2 + 300 * s / 2
>>>>>>> 5.5.0:src/gui/guiPasswordChange.cpp
);
recalculateAbsolutePosition(false);
<<<<<<< HEAD:src/guiPasswordChange.cpp
v2s32 size = rect.getSize();
v2s32 topleft_client(40/gui_scaling, 0);
=======
v2s32 size = DesiredRect.getSize();
v2s32 topleft_client(40 * s, 0);
>>>>>>> 5.5.0:src/gui/guiPasswordChange.cpp
const wchar_t *text;
/*
Add stuff
*/
<<<<<<< HEAD:src/guiPasswordChange.cpp
s32 ypos = 50/gui_scaling;
{
core::rect<s32> rect(0, 0, 150/gui_scaling, 20/gui_scaling);
rect += topleft_client + v2s32(25, ypos+6);
=======
s32 ypos = 50 * s;
{
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
>>>>>>> 5.5.0:src/gui/guiPasswordChange.cpp
text = wgettext("Old Password");
Environment->addStaticText(text, rect, false, true, this, -1);
delete[] text;
}
{
<<<<<<< HEAD:src/guiPasswordChange.cpp
core::rect<s32> rect(0, 0, 230/gui_scaling, 30/gui_scaling);
rect += topleft_client + v2s32(160, ypos);
gui::IGUIEditBox *e =
Environment->addEditBox(L"", rect, true, this, ID_oldPassword);
Environment->setFocus(e);
e->setPasswordBox(true);
}
ypos += 50/gui_scaling;
{
core::rect<s32> rect(0, 0, 150/gui_scaling, 20/gui_scaling);
rect += topleft_client + v2s32(25, ypos+6);
=======
core::rect<s32> rect(0, 0, 230 * s, 30 * s);
rect += topleft_client + v2s32(160 * s, ypos);
gui::IGUIEditBox *e = Environment->addEditBox(
@@ -164,24 +131,11 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
>>>>>>> 5.5.0:src/gui/guiPasswordChange.cpp
text = wgettext("New Password");
Environment->addStaticText(text, rect, false, true, this, -1);
delete[] text;
}
{
<<<<<<< HEAD:src/guiPasswordChange.cpp
core::rect<s32> rect(0, 0, 230/gui_scaling, 30/gui_scaling);
rect += topleft_client + v2s32(160, ypos);
gui::IGUIEditBox *e =
Environment->addEditBox(L"", rect, true, this, ID_newPassword1);
e->setPasswordBox(true);
}
ypos += 50/gui_scaling;
{
core::rect<s32> rect(0, 0, 150/gui_scaling, 20/gui_scaling);
rect += topleft_client + v2s32(25, ypos+6);
=======
core::rect<s32> rect(0, 0, 230 * s, 30 * s);
rect += topleft_client + v2s32(160 * s, ypos);
gui::IGUIEditBox *e = Environment->addEditBox(
@@ -192,25 +146,11 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
>>>>>>> 5.5.0:src/gui/guiPasswordChange.cpp
text = wgettext("Confirm Password");
Environment->addStaticText(text, rect, false, true, this, -1);
delete[] text;
}
{
<<<<<<< HEAD:src/guiPasswordChange.cpp
core::rect<s32> rect(0, 0, 230/gui_scaling, 30/gui_scaling);
rect += topleft_client + v2s32(160, ypos);
gui::IGUIEditBox *e =
Environment->addEditBox(L"", rect, true, this, ID_newPassword2);
e->setPasswordBox(true);
}
ypos += 50/gui_scaling;
{
core::rect<s32> rect(0, 0, 140/gui_scaling, 30/gui_scaling);
rect = rect + v2s32(size.X/2-140/2, ypos);
=======
core::rect<s32> rect(0, 0, 230 * s, 30 * s);
rect += topleft_client + v2s32(160 * s, ypos);
gui::IGUIEditBox *e = Environment->addEditBox(
@@ -222,7 +162,6 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
rect = rect + v2s32(size.X / 4 + 56 * s, ypos);
>>>>>>> 5.5.0:src/gui/guiPasswordChange.cpp
text = wgettext("Change");
GUIButton::addButton(Environment, rect, m_tsrc, this, ID_change, text);
delete[] text;
@@ -235,17 +174,10 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
delete[] text;
}
<<<<<<< HEAD:src/guiPasswordChange.cpp
ypos += 50/gui_scaling;
{
core::rect<s32> rect(0, 0, 300/gui_scaling, 20/gui_scaling);
rect += topleft_client + v2s32(35, ypos);
=======
ypos += 50 * s;
{
core::rect<s32> rect(0, 0, 300 * s, 20 * s);
rect += topleft_client + v2s32(35 * s, ypos);
>>>>>>> 5.5.0:src/gui/guiPasswordChange.cpp
text = wgettext("Passwords do not match!");
IGUIElement *e =
Environment->addStaticText(
@@ -287,15 +219,6 @@ void GUIPasswordChange::acceptInput()
bool GUIPasswordChange::processInput()
{
<<<<<<< HEAD:src/guiPasswordChange.cpp
if (GUIModalMenu::OnEvent(event))
return true;
if(event.EventType==EET_KEY_INPUT_EVENT)
{
if(event.KeyInput.Key==KEY_ESCAPE && event.KeyInput.PressedDown)
{
=======
if (m_newpass != m_newpass_confirm) {
gui::IGUIElement *e = getElementFromId(ID_message);
if (e != NULL)
@@ -308,12 +231,14 @@ bool GUIPasswordChange::processInput()
bool GUIPasswordChange::OnEvent(const SEvent &event)
{
if (GUIModalMenu::OnEvent(event))
return true;
if (event.EventType == EET_KEY_INPUT_EVENT) {
// clang-format off
if ((event.KeyInput.Key == KEY_ESCAPE ||
event.KeyInput.Key == KEY_CANCEL) &&
event.KeyInput.PressedDown) {
>>>>>>> 5.5.0:src/gui/guiPasswordChange.cpp
quitMenu();
return true;
}
+18
View File
@@ -353,9 +353,27 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event)
}
}
}
/* fm?
#ifdef __ANDROID__
if (porting::canKeyboard()) {
// display software keyboard when clicking edit boxes
if (event.EventType == EET_MOUSE_INPUT_EVENT
&& event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN) {
gui::IGUIElement *hovered =
Environment->getRootGUIElement()->getElementFromPoint(
core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y));
if (hovered && hovered->getType() == irr::gui::EGUIET_EDIT_BOX)
porting::displayKeyboard(true, porting::app_global, porting::jnienv);
}
}
#endif
*/
return false;
}
#ifdef __ANDROID__
bool GUIModalMenu::hasAndroidUIInput()
{
+1 -16
View File
@@ -60,22 +60,7 @@ public:
virtual void regenerateGui(v2u32 screensize) = 0;
virtual void drawMenu() = 0;
virtual bool preprocessEvent(const SEvent& event) {
#ifdef __ANDROID__
if (porting::canKeyboard()) {
// display software keyboard when clicking edit boxes
if (event.EventType == EET_MOUSE_INPUT_EVENT
&& event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN) {
gui::IGUIElement *hovered =
Environment->getRootGUIElement()->getElementFromPoint(
core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y));
if (hovered && hovered->getType() == irr::gui::EGUIET_EDIT_BOX)
porting::displayKeyboard(true, porting::app_global, porting::jnienv);
}
}
#endif
return false;
};
virtual bool preprocessEvent(const SEvent& event);
virtual bool OnEvent(const SEvent& event) {
if(event.EventType == EET_KEY_INPUT_EVENT && event.KeyInput.PressedDown) {
KeyPress kp(event.KeyInput);
+3 -1
View File
@@ -22,6 +22,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
#include "guiTextInputMenu.h"
#include "debug.h"
#include "gui/guiEditBoxWithScrollbar.h"
#include "serialization.h"
#include "settings.h"
#include <string>
@@ -111,7 +112,8 @@ void GUITextInputMenu::regenerateGui(v2u32 screensize)
core::rect<s32> rect(0, 0, 300, 30);
rect = rect + v2s32(size.X/2-300/2, size.Y/2-30/2-25);
gui::IGUIElement *e;
e = (gui::IGUIElement *) new gui::intlGUIEditBox(text.c_str(), true, Environment, this, 256, rect);
e = (gui::IGUIElement *) new GUIEditBoxWithScrollBar(text.c_str(), true, Environment, this, 256, rect);
// e->drop(); TODO: figure out what actually happens here.
Environment->setFocus(e);
+6 -10
View File
@@ -510,22 +510,17 @@ CGUITTGlyphPage* CGUITTFont::createGlyphPage(const u8& pixel_mode)
if (page_texture_size.Width > max_texture_size.Width || page_texture_size.Height > max_texture_size.Height)
page_texture_size = max_texture_size;
<<<<<<< HEAD:src/cguittfont/CGUITTFont.cpp
// Create the new page.
page = new CGUITTGlyphPage(Driver, name);
=======
if (page)
{
if (!page->createPageTexture(pixel_mode, page_texture_size)) {
// TODO: add error message?
delete page;
return 0;
}
>>>>>>> 5.5.0:src/irrlicht_changes/CGUITTFont.cpp
if (page)
{
if (!page->createPageTexture(pixel_mode, page_texture_size))
// TODO: add error message?
return 0;
// Determine the number of glyph slots on the page and add it to the list of pages.
page->available_slots = (page_texture_size.Width / size) * (page_texture_size.Height / size);
@@ -679,9 +674,10 @@ void CGUITTFont::draw(const EnrichedString &text, const core::rect<s32>& positio
++iter;
//++current_color;
}
/*
if (applied_colors.empty())
applied_colors.push_back(irr::video::SColor(255, 255, 255, 255));
*/
// Draw now.
update_glyph_pages();
core::map<u32, CGUITTGlyphPage*>::Iterator j = Render_Map.getIterator();
-69
View File
@@ -110,54 +110,11 @@ void StaticText::draw()
(RestrainTextInside ? &AbsoluteClippingRect : NULL));
} else
{
<<<<<<< HEAD
if (font != LastBreakFont)
breakText();
core::rect<s32> r = frameRect;
s32 height = font->getDimension(L"A").Height + font->getKerningHeight();
s32 totalHeight = height * BrokenText.size();
if (VAlign == EGUIA_CENTER)
{
r.UpperLeftCorner.Y = r.getCenter().Y - (totalHeight / 2);
}
else if (VAlign == EGUIA_LOWERRIGHT)
{
r.UpperLeftCorner.Y = r.LowerRightCorner.Y - totalHeight;
}
irr::video::SColor previous_color(255, 255, 255, 255);
for (u32 i=0; i<BrokenText.size(); ++i)
{
if (HAlign == EGUIA_LOWERRIGHT)
{
r.UpperLeftCorner.X = frameRect.LowerRightCorner.X -
font->getDimension(BrokenText[i].c_str()).Width;
}
std::vector<irr::video::SColor> colors;
//std::wstring str;
EnrichedString str = BrokenText[i];
str = colorizeText(BrokenText[i].c_str(), colors, previous_color);
if (!colors.empty())
previous_color = colors[colors.size() - 1];
irr::gui::CGUITTFont *tmp = static_cast<irr::gui::CGUITTFont*>(font);
tmp->draw(str, r,
previous_color, // FIXME
HAlign == EGUIA_CENTER, false, (RestrainTextInside ? &AbsoluteClippingRect : NULL));
r.LowerRightCorner.Y += height;
r.UpperLeftCorner.Y += height;
}
=======
// Draw non-colored text
font->draw(str.c_str(),
r, str.getDefaultColor(), // TODO: Implement colorization
HAlign == EGUIA_CENTER, VAlign == EGUIA_CENTER,
(RestrainTextInside ? &AbsoluteClippingRect : NULL));
>>>>>>> 5.5.0
}
@@ -240,12 +197,6 @@ video::SColor StaticText::getBackgroundColor() const
//! Checks if background drawing is enabled
bool StaticText::isDrawBackgroundEnabled() const
{
<<<<<<< HEAD
#if defined(_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX)
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
#endif
=======
>>>>>>> 5.5.0
return Background;
}
@@ -260,12 +211,6 @@ void StaticText::setDrawBorder(bool draw)
//! Checks if border drawing is enabled
bool StaticText::isDrawBorderEnabled() const
{
<<<<<<< HEAD
#if defined(_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX)
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
#endif
=======
>>>>>>> 5.5.0
return Border;
}
@@ -311,15 +256,7 @@ void StaticText::enableOverrideColor(bool enable)
bool StaticText::isOverrideColorEnabled() const
{
<<<<<<< HEAD
#if defined(_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX)
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
#endif
return OverrideColorEnabled;
=======
return true;
>>>>>>> 5.5.0
}
@@ -334,12 +271,6 @@ void StaticText::setWordWrap(bool enable)
bool StaticText::isWordWrapEnabled() const
{
<<<<<<< HEAD
#if defined(_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX)
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
#endif
=======
>>>>>>> 5.5.0
return WordWrap;
}
+1 -1
View File
@@ -24,7 +24,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
#include "log.h"
#include "mapblock.h"
#ifndef SERVER
#include "mapblock_mesh.h"
#include "client/mapblock_mesh.h"
#endif
#include "filesys.h"
#include "voxel.h"
+1 -1
View File
@@ -100,7 +100,7 @@ MapBlock::~MapBlock()
#ifndef SERVER
if (0)
{
delete mesh;
//delete mesh;
mesh = nullptr;
}
#endif
+2 -2
View File
@@ -536,7 +536,7 @@ public:
//fm:
void pushElementsToCircuit(Circuit* circuit);
#ifndef SERVER // Only on client
#if BUILD_CLIENT // Only on client
typedef std::shared_ptr<MapBlockMesh> mesh_type;
MapBlock::mesh_type getMesh(int step = 1);
@@ -573,7 +573,7 @@ public:
Public member variables
*/
#ifndef SERVER // Only on client
#if BUILD_CLIENT // Only on client
mesh_type mesh = nullptr , mesh_old = nullptr;
mesh_type mesh2 = nullptr, mesh4 = nullptr, mesh8 = nullptr, mesh16 = nullptr;
std::atomic_uint mesh_size {0};
+1 -9
View File
@@ -342,7 +342,7 @@ void Client::handleCommand_BlockData(NetworkPacket* pkt)
if (!overload && getNodeBlockPos(floatToInt(m_env.getLocalPlayer()->getPosition(), BS)).getDistanceFrom(p) <= 1)
addUpdateMeshTaskWithEdge(p);
sendGotBlocks(p);
sendGotBlocks({p});
}
void Client::handleCommand_Inventory(NetworkPacket* pkt)
@@ -633,17 +633,9 @@ void Client::handleCommand_MovePlayer(NetworkPacket* pkt)
event->player_force_move.pitch = pitch;
event->player_force_move.yaw = yaw;
m_client_event_queue.push(event);
<<<<<<< HEAD
// Ignore damage for a few seconds, so that the player doesn't
// get damage from falling on ground
m_ignore_damage_timer = 3.0;
}
void Client::handleCommand_PunchPlayer(NetworkPacket* pkt) { }
=======
}
>>>>>>> 5.5.0
void Client::handleCommand_DeathScreen(NetworkPacket* pkt)
{
+2 -2
View File
@@ -1229,9 +1229,8 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc
overlay_material = TILE_MATERIAL_LIQUID_TRANSPARENT;
u32 overlay_shader = shdsrc->getShader("nodes_shader", overlay_material, drawtype);
}
if (tsrc) {
if (tsrc)
// Tiles (fill in f->tiles[])
for (u16 j = 0; j < 6; j++) {
tiles[j].world_aligned = isWorldAligned(tdef[j].align_style,
@@ -1244,6 +1243,7 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc
color, overlay_material, overlay_shader,
tdef[j].backface_culling, tsettings);
}
}
MaterialType special_material = material_type;
if (drawtype == NDT_PLANTLIKE_ROOTED) {
+1
View File
@@ -27,6 +27,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
*/
#include "porting.h"
#include "settings.h"
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
#include <sys/types.h>
+1 -1
View File
@@ -72,7 +72,7 @@ int LuaLocalPlayer::l_get_name(lua_State *L)
{
LocalPlayer *player = getobject(L, 1);
lua_pushstring(L, player->getName());
lua_pushstring(L, player->getName().c_str());
return 1;
}
-3
View File
@@ -75,10 +75,7 @@ void MainMenuScripting::initializeModApi(lua_State *L, int top)
asyncEngine.registerStateInitializer(registerLuaClasses);
asyncEngine.registerStateInitializer(ModApiMainMenu::InitializeAsync);
asyncEngine.registerStateInitializer(ModApiUtil::InitializeAsync);
<<<<<<< HEAD
=======
asyncEngine.registerStateInitializer(ModApiHttp::InitializeAsync);
>>>>>>> 5.5.0
// Initialize async environment
//TODO possibly make number of async threads configurable
-1
View File
@@ -39,7 +39,6 @@ static SettingsHierarchy g_hierarchy;
std::string g_settings_path;
Json::Reader json_reader;
//Json::StyledWriter json_writer;
std::unordered_map<std::string, const FlagDesc *> Settings::s_flags;