1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "interlaced.h"
#include "client/client.h"
#include "client/shader.h"
#include "client/tile.h"
RenderingCoreInterlaced::RenderingCoreInterlaced(
IrrlichtDevice *_device, Client *_client, Hud *_hud)
: RenderingCoreStereo(_device, _client, _hud)
{
initMaterial();
}
void RenderingCoreInterlaced::initMaterial()
{
IShaderSource *s = client->getShaderSource();
mat.UseMipMaps = false;
mat.ZBuffer = false;
mat.ZWriteEnable = false;
u32 shader = s->getShader("3d_interlaced_merge", TILE_MATERIAL_BASIC, 0);
mat.MaterialType = s->getShaderInfo(shader).material;
for (int k = 0; k < 3; ++k) {
mat.TextureLayer[k].AnisotropicFilter = false;
mat.TextureLayer[k].BilinearFilter = false;
mat.TextureLayer[k].TrilinearFilter = false;
mat.TextureLayer[k].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
mat.TextureLayer[k].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
}
}
void RenderingCoreInterlaced::initTextures()
{
v2u32 image_size{screensize.X, screensize.Y / 2};
left = driver->addRenderTargetTexture(
image_size, "3d_render_left", video::ECF_A8R8G8B8);
right = driver->addRenderTargetTexture(
image_size, "3d_render_right", video::ECF_A8R8G8B8);
mask = driver->addTexture(screensize, "3d_render_mask", video::ECF_A8R8G8B8);
initMask();
mat.TextureLayer[0].Texture = left;
mat.TextureLayer[1].Texture = right;
mat.TextureLayer[2].Texture = mask;
}
void RenderingCoreInterlaced::clearTextures()
{
driver->removeTexture(left);
driver->removeTexture(right);
driver->removeTexture(mask);
}
void RenderingCoreInterlaced::initMask()
{
u8 *data = reinterpret_cast<u8 *>(mask->lock());
for (u32 j = 0; j < screensize.Y; j++) {
u8 val = j % 2 ? 0xff : 0x00;
memset(data, val, 4 * screensize.X);
data += 4 * screensize.X;
}
mask->unlock();
}
void RenderingCoreInterlaced::drawAll()
{
renderBothImages();
merge();
drawHUD();
}
void RenderingCoreInterlaced::merge()
{
static const video::S3DVertex vertices[4] = {
video::S3DVertex(1.0, -1.0, 0.0, 0.0, 0.0, -1.0,
video::SColor(255, 0, 255, 255), 1.0, 0.0),
video::S3DVertex(-1.0, -1.0, 0.0, 0.0, 0.0, -1.0,
video::SColor(255, 255, 0, 255), 0.0, 0.0), in multiplayer
#disable_anticheat = false
# If true, actions are recorded for rollback
#enable_rollback_recording = false
# Profiler data print interval. #0 = disable.
#profiler_print_interval = 0
#enable_mapgen_debug_info = false
# from how far client knows about objects
#active_object_send_range_blocks = 3
# how large area of blocks are subject to the active block stuff (active = objects are loaded and ABMs run)
#active_block_range = 2
# how many blocks are flying in the wire simultaneously per client
#max_simultaneous_block_sends_per_client = 2
# how many blocks are flying in the wire simultaneously per server
#max_simultaneous_block_sends_server_total = 8
# From how far blocks are sent to clients (value * 16 nodes)
#max_block_send_distance = 10
# From how far blocks are generated for clients (value * 16 nodes)
#max_block_generate_distance = 6
# Interval of sending time of day to clients
#time_send_interval = 5
# Length of day/night cycle. 72=20min, 360=4min, 1=24hour, 0=day/night/whatever stays unchanged
#time_speed = 96
#server_unload_unused_data_timeout = 29
# Interval of saving important changes in the world
#server_map_save_interval = 5.3
# 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.
#full_block_send_enable_min_time_from_building = 2.0
# Length of a server tick and the interval at which objects are generally updated over network
#dedicated_server_step = 0.1
# Can be set to true to disable shutting down on invalid world data
#ignore_world_load_errors = false
# Congestion control parameters
# time in seconds, rate in ~500B packets
#congestion_control_aim_rtt = 0.2
#congestion_control_max_rate = 400
#congestion_control_min_rate = 10
# Specifies URL from which client fetches media instead of using UDP
# $filename should be accessible from $remote_media$filename via cURL
# (obviously, remote_media should end with a slash)
# Files that are not present would be fetched the usual way
#remote_media =
# Physics stuff
#movement_acceleration_default = 3
#movement_acceleration_air = 2
#movement_acceleration_fast = 10
#movement_speed_walk = 4
#movement_speed_crouch = 1.35
#movement_speed_fast = 20
#movement_speed_climb = 2
#movement_speed_jump = 6.5
#movement_speed_descend = 6
#movement_liquid_fluidity = 1
#movement_liquid_fluidity_smooth = 0.5
#movement_liquid_sink = 10
#movement_gravity = 9.81
# Mapgen stuff
#mg_name = v6
#water_level = 1
#chunksize = 5
#mg_flags = 19
#mgv6_freq_desert = 0.45
#mgv6_freq_beach = 0.15
#mgv6_np_terrain_base = -4, 20, (250.0, 250, 250), 82341, 5, 0.6
#mgv6_np_terrain_higher = 20, 16, (500, 500, 500), 85039, 5, 0.6
#mgv6_np_steepness = 0.85, 0.5, (125, 125, 125), -932, 5, 0.7
#mgv6_np_height_select = 0.5, 1, (250, 250, 250), 4213, 5, 0.69
#mgv6_np_trees = 0, 1, (125, 125, 125), 2, 4, 0.66
#mgv6_np_mud = 4, 2, (200, 200, 200), 91013, 3, 0.55
#mgv6_np_beach = 0, 1, (250, 250, 250), 59420, 3, 0.50
#mgv6_np_biome = 0, 1, (250, 250, 250), 9130, 3, 0.50
#mgv6_np_cave = 6, 6, (250, 250, 250), 34329, 3, 0.50
#mgv7_np_terrain = 10, 12, (350, 350, 350), 82341, 5, 0.6
#mgv7_np_bgroup = 0.5, 0.3125, (350, 350, 350), 5923, 2, 0.6
#mgv7_np_heat = 25, 50, (500, 500, 500), 35293, 1, 0
#mgv7_np_humidity = 50, 31.25, (750, 750, 750), 12094, 2, 0.6
|