Merge branch 'master' of https://github.com/minetest/minetest
This commit is contained in:
commit
7250cf2c1c
@ -130,7 +130,7 @@ core.register_entity(":__builtin:falling_node", {
|
||||
-- Set collision box (certain nodeboxes only for now)
|
||||
local nb_types = {fixed=true, leveled=true, connected=true}
|
||||
if def.drawtype == "nodebox" and def.node_box and
|
||||
nb_types[def.node_box.type] then
|
||||
nb_types[def.node_box.type] and def.node_box.fixed then
|
||||
local box = table.copy(def.node_box.fixed)
|
||||
if type(box[1]) == "table" then
|
||||
box = #box == 1 and box[1] or nil -- We can only use a single box
|
||||
|
@ -529,8 +529,8 @@ texture_min_size (Minimum texture size) int 64
|
||||
# This algorithm smooths out the 3D viewport while keeping the image sharp,
|
||||
# but it doesn't affect the insides of textures
|
||||
# (which is especially noticeable with transparent textures).
|
||||
# This option is experimental and might cause visible spaces between blocks
|
||||
# when set above 0.
|
||||
# Visible spaces appear between nodes when shaders are disabled.
|
||||
# If set to 0, MSAA is disabled.
|
||||
# A restart is required after changing this option.
|
||||
fsaa (FSAA) enum 0 0,1,2,4,8,16
|
||||
|
||||
@ -759,7 +759,7 @@ mesh_generation_interval (Mapblock mesh generation delay) int 0 0 50
|
||||
# Size of the MapBlock cache of the mesh generator. Increasing this will
|
||||
# increase the cache hit %, reducing the data being copied from the main
|
||||
# thread, thus reducing jitter.
|
||||
meshgen_block_cache_size (Mapblock mesh generator's MapBlock cache size in MB) int 40 0 1000
|
||||
meshgen_block_cache_size (Mapblock mesh generator's MapBlock cache size in MB) int 20 0 1000
|
||||
|
||||
# Enables minimap.
|
||||
enable_minimap (Minimap) bool true
|
||||
@ -1049,7 +1049,7 @@ ipv6_server (IPv6 server) bool false
|
||||
# Maximum number of blocks that are simultaneously sent per client.
|
||||
# The maximum total count is calculated dynamically:
|
||||
# max_total = ceil((#clients + max_users) * per_client / 4)
|
||||
max_simultaneous_block_sends_per_client (Maximum simultaneous block sends per client) int 128
|
||||
max_simultaneous_block_sends_per_client (Maximum simultaneous block sends per client) int 40
|
||||
|
||||
# To reduce lag, block transfers are slowed down when a player is building something.
|
||||
# This determines how long they are slowed down after placing or removing a node.
|
||||
|
@ -16,7 +16,7 @@ varying vec3 vPosition;
|
||||
// precision must be considered).
|
||||
varying vec3 worldPosition;
|
||||
varying lowp vec4 varColor;
|
||||
varying mediump vec2 varTexCoord;
|
||||
centroid varying mediump vec2 varTexCoord;
|
||||
varying vec3 eyeVec;
|
||||
|
||||
const float fogStart = FOG_START;
|
||||
@ -46,7 +46,7 @@ vec4 applyToneMapping(vec4 color)
|
||||
const float gamma = 1.6;
|
||||
const float exposureBias = 5.5;
|
||||
color.rgb = uncharted2Tonemap(exposureBias * color.rgb);
|
||||
// Precalculated white_scale from
|
||||
// Precalculated white_scale from
|
||||
//vec3 whiteScale = 1.0 / uncharted2Tonemap(vec3(W));
|
||||
vec3 whiteScale = vec3(1.036015346);
|
||||
color.rgb *= whiteScale;
|
||||
@ -72,7 +72,7 @@ void main(void)
|
||||
color = base.rgb;
|
||||
|
||||
vec4 col = vec4(color.rgb * varColor.rgb, 1.0);
|
||||
|
||||
|
||||
#ifdef ENABLE_TONE_MAPPING
|
||||
col = applyToneMapping(col);
|
||||
#endif
|
||||
|
@ -16,7 +16,10 @@ varying vec3 vPosition;
|
||||
// precision must be considered).
|
||||
varying vec3 worldPosition;
|
||||
varying lowp vec4 varColor;
|
||||
varying mediump vec2 varTexCoord;
|
||||
// The centroid keyword ensures that after interpolation the texture coordinates
|
||||
// lie within the same bounds when MSAA is en- and disabled.
|
||||
// This fixes the stripes problem with nearest-neighbour textures and MSAA.
|
||||
centroid varying mediump vec2 varTexCoord;
|
||||
varying vec3 eyeVec;
|
||||
|
||||
// Color of the light emitted by the light sources.
|
||||
@ -142,7 +145,7 @@ void main(void)
|
||||
vec4 color;
|
||||
// The alpha gives the ratio of sunlight in the incoming light.
|
||||
float nightRatio = 1.0 - inVertexColor.a;
|
||||
color.rgb = inVertexColor.rgb * (inVertexColor.a * dayLight.rgb +
|
||||
color.rgb = inVertexColor.rgb * (inVertexColor.a * dayLight.rgb +
|
||||
nightRatio * artificialLight.rgb) * 2.0;
|
||||
color.a = 1.0;
|
||||
|
||||
|
@ -9,7 +9,7 @@ varying vec3 vNormal;
|
||||
varying vec3 vPosition;
|
||||
varying vec3 worldPosition;
|
||||
varying lowp vec4 varColor;
|
||||
varying mediump vec2 varTexCoord;
|
||||
centroid varying mediump vec2 varTexCoord;
|
||||
|
||||
varying vec3 eyeVec;
|
||||
varying float vIDiff;
|
||||
@ -43,7 +43,7 @@ vec4 applyToneMapping(vec4 color)
|
||||
const float gamma = 1.6;
|
||||
const float exposureBias = 5.5;
|
||||
color.rgb = uncharted2Tonemap(exposureBias * color.rgb);
|
||||
// Precalculated white_scale from
|
||||
// Precalculated white_scale from
|
||||
//vec3 whiteScale = 1.0 / uncharted2Tonemap(vec3(W));
|
||||
vec3 whiteScale = vec3(1.036015346);
|
||||
color.rgb *= whiteScale;
|
||||
|
@ -7,7 +7,7 @@ varying vec3 vNormal;
|
||||
varying vec3 vPosition;
|
||||
varying vec3 worldPosition;
|
||||
varying lowp vec4 varColor;
|
||||
varying mediump vec2 varTexCoord;
|
||||
centroid varying mediump vec2 varTexCoord;
|
||||
|
||||
varying vec3 eyeVec;
|
||||
varying float vIDiff;
|
||||
|
@ -1191,6 +1191,7 @@ Please do not try to access the reference until the camera is initialized, other
|
||||
|
||||
### LocalPlayer
|
||||
An interface to retrieve information about the player.
|
||||
This object will only be available after the client is initialized. Earlier accesses will yield a `nil` value.
|
||||
|
||||
Methods:
|
||||
|
||||
|
@ -1014,7 +1014,9 @@ The function of `param2` is determined by `paramtype2` in node definition.
|
||||
* `paramtype2 = "flowingliquid"`
|
||||
* Used by `drawtype = "flowingliquid"` and `liquidtype = "flowing"`
|
||||
* The liquid level and a flag of the liquid are stored in `param2`
|
||||
* Bits 0-2: Liquid level (0-7). The higher, the more liquid is in this node
|
||||
* Bits 0-2: Liquid level (0-7). The higher, the more liquid is in this node;
|
||||
see `minetest.get_node_level`, `minetest.set_node_level` and `minetest.add_node_level`
|
||||
to access/manipulate the content of this field
|
||||
* Bit 3: If set, liquid is flowing downwards (no graphical effect)
|
||||
* `paramtype2 = "wallmounted"`
|
||||
* Supported drawtypes: "torchlike", "signlike", "normal", "nodebox", "mesh"
|
||||
@ -1245,6 +1247,9 @@ A box of a regular node would look like:
|
||||
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
|
||||
To avoid collision issues, keep each value within the range of +/- 1.45.
|
||||
This also applies to leveled nodeboxes, where the final height shall not
|
||||
exceed this soft limit.
|
||||
|
||||
|
||||
|
||||
@ -3234,6 +3239,7 @@ Helper functions
|
||||
* returns true when the passed number represents NaN.
|
||||
* `minetest.get_us_time()`
|
||||
* returns time with microsecond precision. May not return wall time.
|
||||
* This value might overflow on certain 32-bit systems!
|
||||
* `table.copy(table)`: returns a table
|
||||
* returns a deep copy of `table`
|
||||
* `table.indexof(list, val)`: returns the smallest numerical index containing
|
||||
@ -6425,6 +6431,8 @@ object you are working with still exists.
|
||||
* `selected_mode` is the mode index to be selected after modes have been changed
|
||||
(0 is the first mode).
|
||||
* `set_sky(sky_parameters)`
|
||||
* The presence of the function `set_sun`, `set_moon` or `set_stars` indicates
|
||||
whether `set_sky` accepts this format. Check the legacy format otherwise.
|
||||
* `sky_parameters` is a table with the following optional fields:
|
||||
* `base_color`: ColorSpec, changes fog in "skybox" and "plain".
|
||||
* `type`: Available types:
|
||||
@ -6466,6 +6474,15 @@ object you are working with still exists.
|
||||
abides by, `"custom"` uses `sun_tint` and `moon_tint`, while
|
||||
`"default"` uses the classic Minetest sun and moon tinting.
|
||||
Will use tonemaps, if set to `"default"`. (default: `"default"`)
|
||||
* `set_sky(base_color, type, {texture names}, clouds)`
|
||||
* Deprecated. Use `set_sky(sky_parameters)`
|
||||
* `base_color`: ColorSpec, defaults to white
|
||||
* `type`: Available types:
|
||||
* `"regular"`: Uses 0 textures, `bgcolor` ignored
|
||||
* `"skybox"`: Uses 6 textures, `bgcolor` used
|
||||
* `"plain"`: Uses 0 textures, `bgcolor` used
|
||||
* `clouds`: Boolean for whether clouds appear in front of `"skybox"` or
|
||||
`"plain"` custom skyboxes (default: `true`)
|
||||
* `get_sky()`: returns base_color, type, table of textures, clouds.
|
||||
* `get_sky_color()`: returns a table with the `sky_color` parameters as in
|
||||
`set_sky`.
|
||||
@ -7346,6 +7363,7 @@ Used by `minetest.register_node`.
|
||||
leveled_max = 127,
|
||||
-- Maximum value for `leveled` (0-127), enforced in
|
||||
-- `minetest.set_node_level` and `minetest.add_node_level`.
|
||||
-- Values above 124 might causes collision detection issues.
|
||||
|
||||
liquid_range = 8, -- Number of flowing nodes around source (max. 8)
|
||||
|
||||
@ -7373,6 +7391,7 @@ Used by `minetest.register_node`.
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-2 / 16, -0.5, -2 / 16, 2 / 16, 3 / 16, 2 / 16},
|
||||
-- Node box format: see [Node boxes]
|
||||
},
|
||||
},
|
||||
-- Custom selection box definition. Multiple boxes can be defined.
|
||||
@ -7383,13 +7402,12 @@ Used by `minetest.register_node`.
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-2 / 16, -0.5, -2 / 16, 2 / 16, 3 / 16, 2 / 16},
|
||||
-- Node box format: see [Node boxes]
|
||||
},
|
||||
},
|
||||
-- Custom collision box definition. Multiple boxes can be defined.
|
||||
-- If "nodebox" drawtype is used and collision_box is nil, then node_box
|
||||
-- definition is used for the collision box.
|
||||
-- Both of the boxes above are defined as:
|
||||
-- {xmin, ymin, zmin, xmax, ymax, zmax} in nodes from node center.
|
||||
|
||||
-- Support maps made in and before January 2012
|
||||
legacy_facedir_simple = false,
|
||||
|
@ -18,7 +18,7 @@ minetest.register_node("testnodes:nodebox_fixed", {
|
||||
|
||||
-- 50% higher than a regular node
|
||||
minetest.register_node("testnodes:nodebox_overhigh", {
|
||||
description = S("Overhigh Nodebox Test Node"),
|
||||
description = S("+50% high Nodebox Test Node"),
|
||||
tiles = {"testnodes_nodebox.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
@ -30,15 +30,16 @@ minetest.register_node("testnodes:nodebox_overhigh", {
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
|
||||
-- 100% higher than a regular node
|
||||
-- 95% higher than a regular node
|
||||
minetest.register_node("testnodes:nodebox_overhigh2", {
|
||||
description = S("Double-height Nodebox Test Node"),
|
||||
description = S("+95% high Nodebox Test Node"),
|
||||
tiles = {"testnodes_nodebox.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5},
|
||||
-- Y max: more is possible, but glitchy
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 1.45, 0.5},
|
||||
},
|
||||
|
||||
groups = {dig_immediate=3},
|
||||
|
@ -31,6 +31,37 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include <algorithm>
|
||||
#include "client/renderingengine.h"
|
||||
|
||||
// struct MeshBufListList
|
||||
void MeshBufListList::clear()
|
||||
{
|
||||
for (auto &list : lists)
|
||||
list.clear();
|
||||
}
|
||||
|
||||
void MeshBufListList::add(scene::IMeshBuffer *buf, v3s16 position, u8 layer)
|
||||
{
|
||||
// Append to the correct layer
|
||||
std::vector<MeshBufList> &list = lists[layer];
|
||||
const video::SMaterial &m = buf->getMaterial();
|
||||
for (MeshBufList &l : list) {
|
||||
// comparing a full material is quite expensive so we don't do it if
|
||||
// not even first texture is equal
|
||||
if (l.m.TextureLayer[0].Texture != m.TextureLayer[0].Texture)
|
||||
continue;
|
||||
|
||||
if (l.m == m) {
|
||||
l.bufs.emplace_back(position, buf);
|
||||
return;
|
||||
}
|
||||
}
|
||||
MeshBufList l;
|
||||
l.m = m;
|
||||
l.bufs.emplace_back(position, buf);
|
||||
list.emplace_back(l);
|
||||
}
|
||||
|
||||
// ClientMap
|
||||
|
||||
ClientMap::ClientMap(
|
||||
Client *client,
|
||||
MapDrawControl &control,
|
||||
@ -182,9 +213,7 @@ void ClientMap::updateDrawList()
|
||||
if not seen on display
|
||||
*/
|
||||
|
||||
if (block->mesh) {
|
||||
block->mesh->updateCameraOffset(m_camera_offset);
|
||||
} else {
|
||||
if (!block->mesh) {
|
||||
// Ignore if mesh doesn't exist
|
||||
continue;
|
||||
}
|
||||
@ -229,50 +258,6 @@ void ClientMap::updateDrawList()
|
||||
g_profiler->avg("MapBlocks loaded [#]", blocks_loaded);
|
||||
}
|
||||
|
||||
struct MeshBufList
|
||||
{
|
||||
video::SMaterial m;
|
||||
std::vector<scene::IMeshBuffer*> bufs;
|
||||
};
|
||||
|
||||
struct MeshBufListList
|
||||
{
|
||||
/*!
|
||||
* Stores the mesh buffers of the world.
|
||||
* The array index is the material's layer.
|
||||
* The vector part groups vertices by material.
|
||||
*/
|
||||
std::vector<MeshBufList> lists[MAX_TILE_LAYERS];
|
||||
|
||||
void clear()
|
||||
{
|
||||
for (auto &list : lists)
|
||||
list.clear();
|
||||
}
|
||||
|
||||
void add(scene::IMeshBuffer *buf, u8 layer)
|
||||
{
|
||||
// Append to the correct layer
|
||||
std::vector<MeshBufList> &list = lists[layer];
|
||||
const video::SMaterial &m = buf->getMaterial();
|
||||
for (MeshBufList &l : list) {
|
||||
// comparing a full material is quite expensive so we don't do it if
|
||||
// not even first texture is equal
|
||||
if (l.m.TextureLayer[0].Texture != m.TextureLayer[0].Texture)
|
||||
continue;
|
||||
|
||||
if (l.m == m) {
|
||||
l.bufs.push_back(buf);
|
||||
return;
|
||||
}
|
||||
}
|
||||
MeshBufList l;
|
||||
l.m = m;
|
||||
l.bufs.push_back(buf);
|
||||
list.push_back(l);
|
||||
}
|
||||
};
|
||||
|
||||
void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
||||
{
|
||||
bool is_transparent_pass = pass == scene::ESNRP_TRANSPARENT;
|
||||
@ -317,6 +302,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
||||
MeshBufListList drawbufs;
|
||||
|
||||
for (auto &i : m_drawlist) {
|
||||
v3s16 block_pos = i.first;
|
||||
MapBlock *block = i.second;
|
||||
|
||||
// If the mesh of the block happened to get deleted, ignore it
|
||||
@ -382,7 +368,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
||||
material.setFlag(video::EMF_WIREFRAME,
|
||||
m_control.show_wireframe);
|
||||
|
||||
drawbufs.add(buf, layer);
|
||||
drawbufs.add(buf, block_pos, layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -391,6 +377,9 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
||||
|
||||
TimeTaker draw("Drawing mesh buffers");
|
||||
|
||||
core::matrix4 m; // Model matrix
|
||||
v3f offset = intToFloat(m_camera_offset, BS);
|
||||
|
||||
// Render all layers in order
|
||||
for (auto &lists : drawbufs.lists) {
|
||||
for (MeshBufList &list : lists) {
|
||||
@ -402,7 +391,13 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
||||
}
|
||||
driver->setMaterial(list.m);
|
||||
|
||||
for (scene::IMeshBuffer *buf : list.bufs) {
|
||||
for (auto &pair : list.bufs) {
|
||||
scene::IMeshBuffer *buf = pair.second;
|
||||
|
||||
v3f block_wpos = intToFloat(pair.first * MAP_BLOCKSIZE, BS);
|
||||
m.setTranslation(block_wpos - offset);
|
||||
|
||||
driver->setTransform(video::ETS_WORLD, m);
|
||||
driver->drawMeshBuffer(buf);
|
||||
vertex_count += buf->getVertexCount();
|
||||
}
|
||||
@ -607,5 +602,3 @@ void ClientMap::PrintInfo(std::ostream &out)
|
||||
{
|
||||
out<<"ClientMap: ";
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,6 +35,25 @@ struct MapDrawControl
|
||||
bool show_wireframe = false;
|
||||
};
|
||||
|
||||
struct MeshBufList
|
||||
{
|
||||
video::SMaterial m;
|
||||
std::vector<std::pair<v3s16,scene::IMeshBuffer*>> bufs;
|
||||
};
|
||||
|
||||
struct MeshBufListList
|
||||
{
|
||||
/*!
|
||||
* Stores the mesh buffers of the world.
|
||||
* The array index is the material's layer.
|
||||
* The vector part groups vertices by material.
|
||||
*/
|
||||
std::vector<MeshBufList> lists[MAX_TILE_LAYERS];
|
||||
|
||||
void clear();
|
||||
void add(scene::IMeshBuffer *buf, v3s16 position, u8 layer);
|
||||
};
|
||||
|
||||
class Client;
|
||||
class ITextureSource;
|
||||
|
||||
|
@ -2412,6 +2412,9 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
|
||||
|
||||
input->clearWasKeyPressed();
|
||||
input->clearWasKeyReleased();
|
||||
// Ensure DIG & PLACE are marked as handled
|
||||
wasKeyDown(KeyType::DIG);
|
||||
wasKeyDown(KeyType::PLACE);
|
||||
|
||||
input->joystick.clearWasKeyDown(KeyType::DIG);
|
||||
input->joystick.clearWasKeyDown(KeyType::PLACE);
|
||||
|
@ -1243,13 +1243,6 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
|
||||
buf->drop();
|
||||
}
|
||||
|
||||
/*
|
||||
Do some stuff to the mesh
|
||||
*/
|
||||
m_camera_offset = camera_offset;
|
||||
translateMesh(m_mesh[layer],
|
||||
intToFloat(data->m_blockpos * MAP_BLOCKSIZE - camera_offset, BS));
|
||||
|
||||
if (m_mesh[layer]) {
|
||||
#if 0
|
||||
// Usually 1-700 faces and 1-7 materials
|
||||
@ -1376,19 +1369,6 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack,
|
||||
return true;
|
||||
}
|
||||
|
||||
void MapBlockMesh::updateCameraOffset(v3s16 camera_offset)
|
||||
{
|
||||
if (camera_offset != m_camera_offset) {
|
||||
for (scene::IMesh *layer : m_mesh) {
|
||||
translateMesh(layer,
|
||||
intToFloat(m_camera_offset - camera_offset, BS));
|
||||
if (m_enable_vbo)
|
||||
layer->setDirty();
|
||||
}
|
||||
m_camera_offset = camera_offset;
|
||||
}
|
||||
}
|
||||
|
||||
video::SColor encode_light(u16 light, u8 emissive_light)
|
||||
{
|
||||
// Get components
|
||||
|
@ -162,9 +162,6 @@ private:
|
||||
// of sunlit vertices
|
||||
// Keys are pairs of (mesh index, buffer index in the mesh)
|
||||
std::map<std::pair<u8, u32>, std::map<u32, video::SColor > > m_daynight_diffs;
|
||||
|
||||
// Camera offset info -> do we have to translate the mesh?
|
||||
v3s16 m_camera_offset;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -42,7 +42,7 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("mute_sound", "false");
|
||||
settings->setDefault("enable_mesh_cache", "false");
|
||||
settings->setDefault("mesh_generation_interval", "0");
|
||||
settings->setDefault("meshgen_block_cache_size", "40");
|
||||
settings->setDefault("meshgen_block_cache_size", "20");
|
||||
settings->setDefault("enable_vbo", "true");
|
||||
settings->setDefault("free_move", "false");
|
||||
settings->setDefault("pitch_move", "false");
|
||||
@ -407,7 +407,7 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("port", "30000");
|
||||
settings->setDefault("strict_protocol_version_checking", "false");
|
||||
settings->setDefault("player_transfer_distance", "0");
|
||||
settings->setDefault("max_simultaneous_block_sends_per_client", "128");
|
||||
settings->setDefault("max_simultaneous_block_sends_per_client", "40");
|
||||
settings->setDefault("time_send_interval", "5");
|
||||
|
||||
settings->setDefault("default_game", "mineclone2");
|
||||
|
Loading…
x
Reference in New Issue
Block a user