Compare commits
288 Commits
5.14.0-rc1
...
5.9.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71d9f1771c | ||
|
|
96fbc52071 | ||
|
|
7556bf43a6 | ||
|
|
722c0044b1 | ||
|
|
b93cce11d8 | ||
|
|
6bdd5c6773 | ||
|
|
a8e7e261b9 | ||
|
|
73c29e7763 | ||
|
|
e27757fa3a | ||
|
|
4e3b8db2b9 | ||
|
|
336f8d4dc7 | ||
|
|
7737906d2e | ||
|
|
a6f1242a11 | ||
|
|
53c2fbb4c4 | ||
|
|
1d042a977d | ||
|
|
166782040e | ||
|
|
9e198fc22c | ||
|
|
ecf535ee83 | ||
|
|
f79a51c265 | ||
|
|
bd25a06f44 | ||
|
|
1caf26f18b | ||
|
|
5861192752 | ||
|
|
02db521c80 | ||
|
|
ba65eb953c | ||
|
|
dbf2d26a85 | ||
|
|
60694cbd30 | ||
|
|
baafec9e9f | ||
|
|
65d4335922 | ||
|
|
5094838837 | ||
|
|
93ac2ed894 | ||
|
|
c011fa0188 | ||
|
|
c2057eee4b | ||
|
|
d445638265 | ||
|
|
f61f6626b7 | ||
|
|
857ba25115 | ||
|
|
00774bc28b | ||
|
|
f572266f19 | ||
|
|
c3893064a3 | ||
|
|
4183443f02 | ||
|
|
5715434d5e | ||
|
|
ab2419db24 | ||
|
|
35a83c3514 | ||
|
|
de09cac1e9 | ||
|
|
b64f4bdb3a | ||
|
|
008310aad9 | ||
|
|
4d024d737c | ||
|
|
50edb30a18 | ||
|
|
00f6bd0f08 | ||
|
|
81e40a1172 | ||
|
|
fe4f89f3fa | ||
|
|
0d372250c1 | ||
|
|
367720020c | ||
|
|
0dab82085d | ||
|
|
cb211d63cd | ||
|
|
2e497cc471 | ||
|
|
587f6656a4 | ||
|
|
4377c03168 | ||
|
|
1e0520074c | ||
|
|
b9f6832347 | ||
|
|
f8bb0cd3d1 | ||
|
|
129aef758e | ||
|
|
94f55cf406 | ||
|
|
a20b758e19 | ||
|
|
128842becf | ||
|
|
d51331f51f | ||
|
|
4ef221a645 | ||
|
|
79010e972e | ||
|
|
0ca530e251 | ||
|
|
57b4d46dbc | ||
|
|
50df5e2f59 | ||
|
|
b6db2c7262 | ||
|
|
9441b69ad2 | ||
|
|
08e3d16a58 | ||
|
|
3f3049fdba | ||
|
|
41fb7a8a7e | ||
|
|
5b9828e094 | ||
|
|
96e35585b0 | ||
|
|
f035fe9336 | ||
|
|
44c2e33c78 | ||
|
|
2785dcbbbf | ||
|
|
9b03bd3243 | ||
|
|
8f30456ee3 | ||
|
|
38557ff635 | ||
|
|
7bc2cde4dd | ||
|
|
f065d3a06b | ||
|
|
21f7e3a987 | ||
|
|
9f688bc433 | ||
|
|
6e9d31d4fb | ||
|
|
e81c48526b | ||
|
|
b405985b80 | ||
|
|
8b010c5a9f | ||
|
|
1e7b5d6fdb | ||
|
|
a55982e7f0 | ||
|
|
1ac378063e | ||
|
|
d497c92684 | ||
|
|
677dc2c155 | ||
|
|
beea8deeb5 | ||
|
|
0d0f1a2fb2 | ||
|
|
439701ed7a | ||
|
|
d945d0129c | ||
|
|
cc91477308 | ||
|
|
ac139ec03d | ||
|
|
b4f0e834bf | ||
|
|
6e6cdc834f | ||
|
|
4b81ae1b35 | ||
|
|
d569dc45a8 | ||
|
|
23d49fda29 | ||
|
|
62ad2c3bc1 | ||
|
|
25373ad294 | ||
|
|
26d0c0fd8d | ||
|
|
3afffcd36b | ||
|
|
5440de1785 | ||
|
|
25a56f11c8 | ||
|
|
8271c6481f | ||
|
|
83e26f839d | ||
|
|
c3f7905d82 | ||
|
|
05b54a8d18 | ||
|
|
e5cfdd369e | ||
|
|
c61d8cfb85 | ||
|
|
27f4195471 | ||
|
|
b2596eda32 | ||
|
|
9379440fcb | ||
|
|
b7c502c8d1 | ||
|
|
3c16d2d9b4 | ||
|
|
6cbc03a418 | ||
|
|
15ecc0fa65 | ||
|
|
7f2f8cdad1 | ||
|
|
a64646cb7b | ||
|
|
05f531c538 | ||
|
|
7ca335446b | ||
|
|
99e96a6581 | ||
|
|
7200d8f90e | ||
|
|
7038837aca | ||
|
|
541dcc0e5a | ||
|
|
1060b5aabf | ||
|
|
6ea73c4982 | ||
|
|
cff847273a | ||
|
|
e669f8db9b | ||
|
|
461cc30842 | ||
|
|
13d7cb957c | ||
|
|
47a439a905 | ||
|
|
053fb96694 | ||
|
|
b72c1f7367 | ||
|
|
e90738575f | ||
|
|
35718eec9c | ||
|
|
8285a53152 | ||
|
|
116fe7815b | ||
|
|
4c2efd7da3 | ||
|
|
1a433e3185 | ||
|
|
fa98a00916 | ||
|
|
f4dd46ad60 | ||
|
|
41825ccfbb | ||
|
|
4d1a5f12c0 | ||
|
|
cc58d56c6d | ||
|
|
683ef07312 | ||
|
|
c77c78cef5 | ||
|
|
88517030a4 | ||
|
|
45471e8e63 | ||
|
|
4e620beb75 | ||
|
|
e7ab875b47 | ||
|
|
be74ed9ab6 | ||
|
|
52b2eacd37 | ||
|
|
6b4210a2ea | ||
|
|
740d0da5ee | ||
|
|
34883d356e | ||
|
|
aeafcce314 | ||
|
|
ae1d82c325 | ||
|
|
1c89a07226 | ||
|
|
43e262f13e | ||
|
|
e5f802ab5c | ||
|
|
847860fc5c | ||
|
|
77e936445f | ||
|
|
41beb74ef7 | ||
|
|
67be50b706 | ||
|
|
cd840b7c9d | ||
|
|
07903949ec | ||
|
|
d2156ddaad | ||
|
|
a84ff4b3ff | ||
|
|
c02f13d33f | ||
|
|
f6490859fd | ||
|
|
4b7816dbf4 | ||
|
|
86ffbc3ec5 | ||
|
|
67257f44a5 | ||
|
|
3086f5567a | ||
|
|
bb8acb095d | ||
|
|
24be3cbb5f | ||
|
|
9773191103 | ||
|
|
ddc703c3ec | ||
|
|
09ec204e4b | ||
|
|
8b6cafa0e0 | ||
|
|
1ee8be9d43 | ||
|
|
91bc190d21 | ||
|
|
4dc833b642 | ||
|
|
895e9f8d5c | ||
|
|
12906ff631 | ||
|
|
9c9bcff107 | ||
|
|
443ca5c63b | ||
|
|
1102b1fc4c | ||
|
|
0d089eab21 | ||
|
|
b44fada29e | ||
|
|
859ea160e6 | ||
|
|
1c49e2ffc0 | ||
|
|
140245c58d | ||
|
|
47adcced60 | ||
|
|
a2054deb12 | ||
|
|
30fdfd9ded | ||
|
|
a87a86eb92 | ||
|
|
49dfbcfbc8 | ||
|
|
c558a4f4f6 | ||
|
|
4f49a2248f | ||
|
|
4e57da42c1 | ||
|
|
4f6c9e206c | ||
|
|
699e1d4b77 | ||
|
|
fa2978b3b9 | ||
|
|
ffcdf741fc | ||
|
|
429d7f33d4 | ||
|
|
b6a229775e | ||
|
|
0a4580368a | ||
|
|
e5b191e1f1 | ||
|
|
a07acc067b | ||
|
|
01e763f879 | ||
|
|
a95e75261a | ||
|
|
dcaa7ac609 | ||
|
|
7d2ae10849 | ||
|
|
642cac3759 | ||
|
|
662af2edba | ||
|
|
6f97e15a8f | ||
|
|
ab2fa2ca9d | ||
|
|
4666c99b27 | ||
|
|
e38415c56d | ||
|
|
3f3fce4664 | ||
|
|
1407a7bc8a | ||
|
|
1d268f4b83 | ||
|
|
92aab79d27 | ||
|
|
0823bb1276 | ||
|
|
18e42efa01 | ||
|
|
0ea16328df | ||
|
|
b037efc5c6 | ||
|
|
839bb71389 | ||
|
|
2ef7df5cfe | ||
|
|
f5d2d79f75 | ||
|
|
8e5fa96ffc | ||
|
|
6dbbe07d50 | ||
|
|
3c23410753 | ||
|
|
8e35ab78b4 | ||
|
|
7f2911b7f0 | ||
|
|
d877e90301 | ||
|
|
93db4be726 | ||
|
|
1f419ad19f | ||
|
|
3c7f6508ad | ||
|
|
39449d4b63 | ||
|
|
28e05295fa | ||
|
|
60c18d3550 | ||
|
|
482ab186a2 | ||
|
|
4814195dc4 | ||
|
|
d215b7a10e | ||
|
|
0e52b78590 | ||
|
|
b3a9d607c4 | ||
|
|
c00081b62c | ||
|
|
5e4739b460 | ||
|
|
0d8f598df2 | ||
|
|
2ef04cc308 | ||
|
|
7a0884e2cd | ||
|
|
fa858530cc | ||
|
|
1c61fe5ed9 | ||
|
|
57409ef382 | ||
|
|
06ba826803 | ||
|
|
6e6ef9489f | ||
|
|
45bbe39d1f | ||
|
|
6c9fc13083 | ||
|
|
4c8a642388 | ||
|
|
6208c9d64f | ||
|
|
76325d0ba9 | ||
|
|
cf1802a6de | ||
|
|
538a7b12bd | ||
|
|
57e0f52aaa | ||
|
|
1ae0335b62 | ||
|
|
ca1bff6b66 | ||
|
|
10cc62d2ca | ||
|
|
dd451a8a00 | ||
|
|
444ec1e412 | ||
|
|
82739f4d7d | ||
|
|
19825d853e | ||
|
|
d8ece2e3e9 | ||
|
|
bf4deb0ce6 | ||
|
|
da4739a26c | ||
|
|
fc24bf0915 | ||
|
|
9329b99cba |
4
.github/workflows/macos.yml
vendored
@@ -29,8 +29,8 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# use macOS 13 since it's the last one that still runs on x86
|
||||
runs-on: macos-13
|
||||
# use lowest possible macOS running on x86_64 to support more users
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install deps
|
||||
|
||||
@@ -12,7 +12,7 @@ set(CLANG_MINIMUM_VERSION "7.0.1")
|
||||
# You should not need to edit these manually, use util/bump_version.sh
|
||||
set(VERSION_MAJOR 5)
|
||||
set(VERSION_MINOR 9)
|
||||
set(VERSION_PATCH 0)
|
||||
set(VERSION_PATCH 1)
|
||||
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
|
||||
|
||||
# Change to false for releases
|
||||
|
||||
@@ -8,7 +8,7 @@ android {
|
||||
compileSdk 34
|
||||
targetSdkVersion 34
|
||||
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
|
||||
versionCode project.versionCode
|
||||
versionCode versionMajor * 1000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
@@ -116,18 +116,6 @@ clean {
|
||||
delete new File("src/main/assets", "Minetest.zip")
|
||||
}
|
||||
|
||||
// Map for the version code that gives each ABI a value.
|
||||
import com.android.build.OutputFile
|
||||
|
||||
def abiCodes = ['armeabi-v7a': 0, 'arm64-v8a': 1]
|
||||
android.applicationVariants.all { variant ->
|
||||
variant.outputs.each {
|
||||
output ->
|
||||
def abiName = output.getFilter(OutputFile.ABI)
|
||||
output.versionCodeOverride = abiCodes.get(abiName, 0) + variant.versionCode
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':native')
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
|
||||
project.ext.set("versionMajor", 5) // Version Major
|
||||
project.ext.set("versionMinor", 9) // Version Minor
|
||||
project.ext.set("versionPatch", 0) // Version Patch
|
||||
project.ext.set("versionPatch", 1) // Version Patch
|
||||
// ^ keep in sync with cmake
|
||||
project.ext.set("versionCode", 48) // Android Version Code
|
||||
// NOTE: +2 after each release!
|
||||
// +1 for ARM and +1 for ARM64 APK's, because
|
||||
// each APK must have a larger `versionCode` than the previous
|
||||
|
||||
project.ext.set("versionBuild", 0) // Version Build
|
||||
// ^ fourth version number to allow releasing Android-only fixes and beta versions
|
||||
|
||||
buildscript {
|
||||
ext.ndk_version = '26.2.11394342'
|
||||
|
||||
@@ -69,7 +69,7 @@ local function build_chatcommands_formspec(name, sel, copy)
|
||||
description = cmds[2].description
|
||||
if copy then
|
||||
local msg = S("Command: @1 @2",
|
||||
core.colorize("#0FF", "/" .. cmds[1]), cmds[2].params)
|
||||
core.colorize("#0FF", (INIT == "client" and "." or "/") .. cmds[1]), cmds[2].params)
|
||||
if INIT == "client" then
|
||||
core.display_chat_message(msg)
|
||||
else
|
||||
|
||||
@@ -251,11 +251,16 @@ register_builtin_hud_element("minimap", {
|
||||
position = {x = 1, y = 0},
|
||||
alignment = {x = -1, y = 1},
|
||||
offset = {x = -10, y = 10},
|
||||
size = {x = 256, y = 256},
|
||||
size = {x = 0, y = -25},
|
||||
},
|
||||
show_elem = function(player, flags)
|
||||
local proto_ver = core.get_player_information(player:get_player_name()).protocol_version
|
||||
-- Don't add a minimap for clients which already have it hardcoded in C++.
|
||||
return flags.minimap and
|
||||
core.get_player_information(player:get_player_name()).protocol_version >= 44
|
||||
return flags.minimap and proto_ver >= 44
|
||||
end,
|
||||
update_def = function(player, elem_def)
|
||||
local proto_ver = core.get_player_information(player:get_player_name()).protocol_version
|
||||
-- Only use percentage when the client supports it.
|
||||
elem_def.size = proto_ver >= 45 and {x = 0, y = -25} or {x = 256, y = 256}
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -126,7 +126,7 @@ local function get_formspec(data)
|
||||
local retval =
|
||||
"size[11.5,7.5,true]" ..
|
||||
"label[0.5,0;" .. fgettext("World:") .. "]" ..
|
||||
"label[1.75,0;" .. data.worldspec.name .. "]"
|
||||
"label[1.75,0;" .. core.formspec_escape(data.worldspec.name) .. "]"
|
||||
|
||||
if mod.is_modpack or mod.type == "game" then
|
||||
local info = core.formspec_escape(
|
||||
|
||||
@@ -1014,7 +1014,7 @@ mapgen_limit (Map generation limit) int 31007 0 31007
|
||||
# Global map generation attributes.
|
||||
# In Mapgen v6 the 'decorations' flag controls all decorations except trees
|
||||
# and jungle grass, in all other mapgens this flag controls all decorations.
|
||||
mg_flags (Mapgen flags) flags caves,dungeons,light,decorations,biomes,ores caves,dungeons,light,decorations,biomes,ores,nocaves,nodungeons,nolight,nodecorations,nobiomes,noores
|
||||
mg_flags (Mapgen flags) flags caves,dungeons,light,decorations,biomes,ores caves,dungeons,light,decorations,biomes,ores
|
||||
|
||||
[*Biome API]
|
||||
|
||||
@@ -1033,7 +1033,7 @@ mg_biome_np_humidity_blend (Humidity blend noise) noise_params_2d 0, 1.5, (8, 8,
|
||||
[*Mapgen V5]
|
||||
|
||||
# Map generation attributes specific to Mapgen v5.
|
||||
mgv5_spflags (Mapgen V5 specific flags) flags caverns caverns,nocaverns
|
||||
mgv5_spflags (Mapgen V5 specific flags) flags caverns caverns
|
||||
|
||||
# Controls width of tunnels, a smaller value creates wider tunnels.
|
||||
# Value >= 10.0 completely disables generation of tunnels and avoids the
|
||||
@@ -1107,7 +1107,7 @@ mgv5_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2
|
||||
# When the 'snowbiomes' flag is enabled jungles are automatically enabled and
|
||||
# the 'jungles' flag is ignored.
|
||||
# The 'temples' flag disables generation of desert temples. Normal dungeons will appear instead.
|
||||
mgv6_spflags (Mapgen V6 specific flags) flags jungles,biomeblend,mudflow,snowbiomes,noflat,trees,temples jungles,biomeblend,mudflow,snowbiomes,flat,trees,temples,nojungles,nobiomeblend,nomudflow,nosnowbiomes,noflat,notrees,notemples
|
||||
mgv6_spflags (Mapgen V6 specific flags) flags jungles,biomeblend,mudflow,snowbiomes,noflat,trees,temples jungles,biomeblend,mudflow,snowbiomes,flat,trees,temples
|
||||
|
||||
# Deserts occur when np_biome exceeds this value.
|
||||
# When the 'snowbiomes' flag is enabled, this is ignored.
|
||||
@@ -1163,7 +1163,7 @@ mgv6_np_apple_trees (Apple trees noise) noise_params_2d 0, 1, (100, 100, 100), 3
|
||||
# 'ridges': Rivers.
|
||||
# 'floatlands': Floating land masses in the atmosphere.
|
||||
# 'caverns': Giant caves deep underground.
|
||||
mgv7_spflags (Mapgen V7 specific flags) flags mountains,ridges,nofloatlands,caverns mountains,ridges,floatlands,caverns,nomountains,noridges,nofloatlands,nocaverns
|
||||
mgv7_spflags (Mapgen V7 specific flags) flags mountains,ridges,nofloatlands,caverns mountains,ridges,floatlands,caverns
|
||||
|
||||
# Y of mountain density gradient zero level. Used to shift mountains vertically.
|
||||
mgv7_mount_zero_level (Mountain zero level) int 0 -31000 31000
|
||||
@@ -1297,7 +1297,7 @@ mgv7_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2
|
||||
[*Mapgen Carpathian]
|
||||
|
||||
# Map generation attributes specific to Mapgen Carpathian.
|
||||
mgcarpathian_spflags (Mapgen Carpathian specific flags) flags caverns,norivers caverns,rivers,nocaverns,norivers
|
||||
mgcarpathian_spflags (Mapgen Carpathian specific flags) flags caverns,norivers caverns,rivers
|
||||
|
||||
# Defines the base ground level.
|
||||
mgcarpathian_base_level (Base ground level) float 12.0
|
||||
@@ -1406,7 +1406,7 @@ mgcarpathian_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 50
|
||||
|
||||
# Map generation attributes specific to Mapgen Flat.
|
||||
# Occasional lakes and hills can be added to the flat world.
|
||||
mgflat_spflags (Mapgen Flat specific flags) flags nolakes,nohills,nocaverns lakes,hills,caverns,nolakes,nohills,nocaverns
|
||||
mgflat_spflags (Mapgen Flat specific flags) flags nolakes,nohills,nocaverns lakes,hills,caverns
|
||||
|
||||
# Y of flat ground.
|
||||
mgflat_ground_level (Ground level) int 8 -31000 31000
|
||||
@@ -1490,7 +1490,7 @@ mgflat_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0,
|
||||
# Map generation attributes specific to Mapgen Fractal.
|
||||
# 'terrain' enables the generation of non-fractal terrain:
|
||||
# ocean, islands and underground.
|
||||
mgfractal_spflags (Mapgen Fractal specific flags) flags terrain terrain,noterrain
|
||||
mgfractal_spflags (Mapgen Fractal specific flags) flags terrain terrain
|
||||
|
||||
# Controls width of tunnels, a smaller value creates wider tunnels.
|
||||
# Value >= 10.0 completely disables generation of tunnels and avoids the
|
||||
@@ -1624,7 +1624,7 @@ mgfractal_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500),
|
||||
# 'vary_river_depth': If enabled, low humidity and high heat causes rivers
|
||||
# to become shallower and occasionally dry.
|
||||
# 'altitude_dry': Reduces humidity with altitude.
|
||||
mgvalleys_spflags (Mapgen Valleys specific flags) flags altitude_chill,humid_rivers,vary_river_depth,altitude_dry altitude_chill,humid_rivers,vary_river_depth,altitude_dry,noaltitude_chill,nohumid_rivers,novary_river_depth,noaltitude_dry
|
||||
mgvalleys_spflags (Mapgen Valleys specific flags) flags altitude_chill,humid_rivers,vary_river_depth,altitude_dry altitude_chill,humid_rivers,vary_river_depth,altitude_dry
|
||||
|
||||
# The vertical distance over which heat drops by 20 if 'altitude_chill' is
|
||||
# enabled. Also, the vertical distance over which humidity drops by 10 if
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../irr/media/Shaders
|
||||
@@ -91,7 +91,7 @@ float directional_ambient(vec3 normal)
|
||||
|
||||
void main(void)
|
||||
{
|
||||
varTexCoord = (mTexture * inTexCoord0).st;
|
||||
varTexCoord = (mTexture * vec4(inTexCoord0.xy, 1.0, 1.0)).st;
|
||||
gl_Position = mWorldViewProj * inVertexPosition;
|
||||
|
||||
vPosition = gl_Position.xyz;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Minetest Lua Client Modding API Reference 5.9.0
|
||||
Minetest Lua Client Modding API Reference 5.9.1
|
||||
================================================
|
||||
* More information at <http://www.minetest.net/>
|
||||
* Developer Wiki: <http://dev.minetest.net/>
|
||||
|
||||
@@ -1802,6 +1802,11 @@ Displays a minimap on the HUD.
|
||||
|
||||
* `size`: Size of the minimap to display. Minimap should be a square to avoid
|
||||
distortion.
|
||||
* Negative values represent percentages of the screen. If either `x` or `y`
|
||||
is specified as a percentage, the resulting pixel size will be used for
|
||||
both `x` and `y`. Example: On a 1920x1080 screen, `{x = 0, y = -25}` will
|
||||
result in a 270x270 minimap.
|
||||
* Negative values are supported starting with protocol version 45.
|
||||
* `alignment`: The alignment of the minimap.
|
||||
* `offset`: offset in pixels from position.
|
||||
|
||||
@@ -6451,7 +6456,8 @@ Formspec
|
||||
* `playername`: name of player to show formspec
|
||||
* `formname`: name passed to `on_player_receive_fields` callbacks.
|
||||
It should follow the `"modname:<whatever>"` naming convention.
|
||||
`formname` must not be empty.
|
||||
* `formname` must not be empty, unless you want to reshow
|
||||
the inventory formspec without updating it for future opens.
|
||||
* `formspec`: formspec to display
|
||||
* `minetest.close_formspec(playername, formname)`
|
||||
* `playername`: name of player to close formspec
|
||||
@@ -9217,9 +9223,17 @@ Used by `minetest.register_node`, `minetest.register_craftitem`, and
|
||||
-- If specified as a table, the field to be used is selected according to
|
||||
-- the current `pointed_thing`.
|
||||
-- There are three possible TouchInteractionMode values:
|
||||
-- * "user" (meaning depends on client-side settings)
|
||||
-- * "long_dig_short_place" (long tap = dig, short tap = place)
|
||||
-- * "short_dig_long_place" (short tap = dig, long tap = place)
|
||||
-- * "user":
|
||||
-- * For `pointed_object`: Equivalent to "short_dig_long_place" if the
|
||||
-- client-side setting "touch_punch_gesture" is "short_tap" (the
|
||||
-- default value) and the item is able to punch (i.e. has no on_use
|
||||
-- callback defined).
|
||||
-- Equivalent to "long_dig_short_place" otherwise.
|
||||
-- * For `pointed_node` and `pointed_nothing`:
|
||||
-- Equivalent to "long_dig_short_place".
|
||||
-- * The behavior of "user" may change in the future.
|
||||
-- The default value is "user".
|
||||
|
||||
sound = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Minetest Lua Mainmenu API Reference 5.9.0
|
||||
Minetest Lua Mainmenu API Reference 5.9.1
|
||||
=========================================
|
||||
|
||||
Introduction
|
||||
|
||||
@@ -184,3 +184,23 @@ unittests.register("test_objects_in_area", function(_, pos)
|
||||
return core.objects_in_area(pos:offset(-1, -1, -1), pos:offset(1, 1, 1))
|
||||
end)
|
||||
end, {map=true})
|
||||
|
||||
-- Tests that bone rotation euler angles are preserved (see #14992)
|
||||
local function test_get_bone_rot(_, pos)
|
||||
local obj = core.add_entity(pos, "unittests:dummy")
|
||||
for _ = 1, 100 do
|
||||
local function assert_similar(euler_angles)
|
||||
local _, rot = obj:get_bone_position("bonename")
|
||||
assert(euler_angles:distance(rot) < 1e-3)
|
||||
local override = obj:get_bone_override("bonename")
|
||||
assert(euler_angles:distance(override.rotation.vec:apply(math.deg)) < 1e-3)
|
||||
end
|
||||
local deg = 1e3 * vector.new(math.random(), math.random(), math.random())
|
||||
obj:set_bone_position("bonename", vector.zero(), deg)
|
||||
assert_similar(deg)
|
||||
local rad = 3 * math.pi * vector.new(math.random(), math.random(), math.random())
|
||||
obj:set_bone_override("bonename", {rotation = {vec = rad}})
|
||||
assert_similar(rad:apply(math.deg))
|
||||
end
|
||||
end
|
||||
unittests.register("test_get_bone_rot", test_get_bone_rot, {map=true})
|
||||
|
||||
310
irr/.github/workflows/build.yml
vendored
@@ -1,310 +0,0 @@
|
||||
name: build
|
||||
|
||||
# build on c/cpp changes or workflow changes
|
||||
on:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
|
||||
linux-gl:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install g++ cmake libxi-dev libgl1-mesa-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake . -DUSE_SDL2=OFF
|
||||
make VERBOSE=1 -j2
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
ctest --output-on-failure
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
make DESTDIR=$PWD/_install install
|
||||
tar -c -I "gzip -9" -f irrlicht-linux.tar.gz -C ./_install/usr/local .
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: irrlicht-linux
|
||||
path: ./irrlicht-linux.tar.gz
|
||||
|
||||
linux-gles:
|
||||
# Xvfb test is broken on 20.04 for unknown reasons (not our bug)
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install g++ cmake libxi-dev libgles2-mesa-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake . -DBUILD_EXAMPLES=1 -DUSE_SDL2=OFF -DENABLE_OPENGL=OFF -DENABLE_GLES2=ON
|
||||
make -j2
|
||||
|
||||
- name: Test (headless)
|
||||
run: |
|
||||
cd bin/Linux
|
||||
./AutomatedTest null
|
||||
|
||||
- name: Test (Xvfb)
|
||||
run: |
|
||||
cd bin/Linux
|
||||
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest ogles2
|
||||
|
||||
linux-sdl:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake . -DBUILD_EXAMPLES=1 -DUSE_SDL2=ON -DCMAKE_BUILD_TYPE=Debug
|
||||
make -j2
|
||||
|
||||
- name: Test (headless)
|
||||
run: |
|
||||
cd bin/Linux
|
||||
./AutomatedTest null
|
||||
|
||||
linux-sdl-gl3:
|
||||
# Xvfb test is broken on 20.04 for unknown reasons (not our bug)
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake . -DBUILD_EXAMPLES=1 -DUSE_SDL2=ON -DENABLE_OPENGL=OFF -DENABLE_OPENGL3=ON
|
||||
make -j2
|
||||
|
||||
- name: Test (headless)
|
||||
run: |
|
||||
cd bin/Linux
|
||||
./AutomatedTest null
|
||||
|
||||
- name: Test (Xvfb)
|
||||
run: |
|
||||
cd bin/Linux
|
||||
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest opengl3
|
||||
|
||||
linux-sdl-gles2:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake . -DBUILD_EXAMPLES=1 -DUSE_SDL2=ON -DENABLE_OPENGL=OFF -DENABLE_GLES2=ON
|
||||
make -j2
|
||||
|
||||
- name: Test (headless)
|
||||
run: |
|
||||
cd bin/Linux
|
||||
./AutomatedTest null
|
||||
|
||||
- name: Test (Xvfb)
|
||||
run: |
|
||||
cd bin/Linux
|
||||
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest ogles2
|
||||
|
||||
mingw:
|
||||
name: "MinGW ${{matrix.config.variant}}${{matrix.config.extras}}"
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- {variant: win32, arch: i686}
|
||||
- {variant: win64, arch: x86_64}
|
||||
- {variant: win32, arch: i686, extras: "-sdl"}
|
||||
- {variant: win64, arch: x86_64, extras: "-sdl"}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install compiler
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install cmake -qyy
|
||||
./scripts/ci-get-mingw.sh
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./scripts/ci-build-mingw.sh package
|
||||
env:
|
||||
CC: ${{matrix.config.arch}}-w64-mingw32-clang
|
||||
CXX: ${{matrix.config.arch}}-w64-mingw32-clang++
|
||||
extras: ${{matrix.config.extras}}
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: irrlicht-${{matrix.config.variant}}${{matrix.config.extras}}
|
||||
path: ./irrlicht-${{matrix.config.variant}}${{matrix.config.extras}}.zip
|
||||
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install deps
|
||||
run: |
|
||||
brew update --auto-update
|
||||
brew install cmake libpng jpeg
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake . -DCMAKE_FIND_FRAMEWORK=LAST -DBUILD_EXAMPLES=1
|
||||
make -j3
|
||||
|
||||
- name: Test (headless)
|
||||
run: |
|
||||
./bin/OSX/AutomatedTest null
|
||||
|
||||
macos-sdl:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install deps
|
||||
run: |
|
||||
brew update --auto-update
|
||||
brew install cmake libpng jpeg sdl2
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake . -DCMAKE_FIND_FRAMEWORK=LAST -DBUILD_EXAMPLES=1 -DUSE_SDL2=1
|
||||
make -j3
|
||||
|
||||
msvc:
|
||||
name: VS 2019 ${{ matrix.config.arch }} ${{ matrix.sdl.label }}
|
||||
runs-on: windows-2019
|
||||
env:
|
||||
VCPKG_VERSION: 8eb57355a4ffb410a2e94c07b4dca2dffbee8e50
|
||||
# 2023.10.19
|
||||
vcpkg_packages: zlib libpng libjpeg-turbo
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
-
|
||||
arch: x86
|
||||
generator: "-G'Visual Studio 16 2019' -A Win32"
|
||||
vcpkg_triplet: x86-windows
|
||||
-
|
||||
arch: x64
|
||||
generator: "-G'Visual Studio 16 2019' -A x64"
|
||||
vcpkg_triplet: x64-windows
|
||||
sdl:
|
||||
-
|
||||
use: FALSE
|
||||
label: '(no SDL)'
|
||||
vcpkg_packages: opengl-registry
|
||||
-
|
||||
use: TRUE
|
||||
label: '(with SDL)'
|
||||
vcpkg_packages: sdl2
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Restore from cache and run vcpkg
|
||||
uses: lukka/run-vcpkg@v7
|
||||
with:
|
||||
vcpkgArguments: ${{env.vcpkg_packages}} ${{matrix.sdl.vcpkg_packages}}
|
||||
vcpkgDirectory: '${{ github.workspace }}\vcpkg'
|
||||
appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
|
||||
vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
|
||||
vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
|
||||
|
||||
- name: CMake
|
||||
run: |
|
||||
cmake ${{matrix.config.generator}} `
|
||||
-DUSE_SDL2=${{matrix.sdl.use}} `
|
||||
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
|
||||
-DCMAKE_BUILD_TYPE=Release .
|
||||
|
||||
- name: Build
|
||||
run: cmake --build . --config Release
|
||||
|
||||
- name: Create artifact folder
|
||||
run: |
|
||||
mkdir artifact/
|
||||
mkdir artifact/lib/
|
||||
|
||||
- name: Move dlls into artifact folder
|
||||
run: move bin\Win32-VisualStudio\Release\* artifact\lib\
|
||||
|
||||
- name: Move includes into artifact folder
|
||||
run: move include artifact/
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: msvc-${{ matrix.config.arch }}-${{matrix.sdl.use}}
|
||||
path: artifact/
|
||||
|
||||
android:
|
||||
name: Android ${{ matrix.arch }}
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
ndk_version: "r25c"
|
||||
ANDROID_NDK: ${{ github.workspace }}/android-ndk
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [armeabi-v7a, arm64-v8a, x86, x86_64]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo rm /var/lib/man-db/auto-update
|
||||
sudo apt-get update
|
||||
sudo apt-get install -qyy wget unzip zip gcc-multilib make cmake
|
||||
|
||||
- name: Cache NDK
|
||||
id: cache-ndk
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
key: android-ndk-${{ env.ndk_version }}-linux
|
||||
path: ${{ env.ANDROID_NDK }}
|
||||
|
||||
- name: Install NDK
|
||||
run: |
|
||||
wget --progress=bar:force "http://dl.google.com/android/repository/android-ndk-${ndk_version}-linux.zip"
|
||||
unzip -q "android-ndk-${ndk_version}-linux.zip"
|
||||
rm "android-ndk-${ndk_version}-linux.zip"
|
||||
mv "android-ndk-${ndk_version}" "${ANDROID_NDK}"
|
||||
if: ${{ steps.cache-ndk.outputs.cache-hit != 'true' }}
|
||||
|
||||
- name: Build
|
||||
run: ./scripts/ci-build-android.sh ${{ matrix.arch }}
|
||||
|
||||
#- name: Upload Artifact
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: irrlicht-android-${{ matrix.arch }}
|
||||
# path: ${{ runner.temp }}/pkg/${{ matrix.arch }}
|
||||
@@ -11,14 +11,5 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
|
||||
endif()
|
||||
|
||||
# FIXME: tests need to be moved to MT if we want to keep them
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
#enable_testing()
|
||||
add_subdirectory(src)
|
||||
#add_subdirectory(test)
|
||||
|
||||
#option(BUILD_EXAMPLES "Build example applications" FALSE)
|
||||
#if(BUILD_EXAMPLES)
|
||||
# add_subdirectory(examples)
|
||||
#endif()
|
||||
|
||||
@@ -1,154 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <irrlicht.h>
|
||||
#include "exampleHelper.h"
|
||||
|
||||
using namespace irr;
|
||||
|
||||
static IrrlichtDevice *device = nullptr;
|
||||
static int test_fail = 0;
|
||||
|
||||
void test_irr_array();
|
||||
void test_irr_string();
|
||||
|
||||
static video::E_DRIVER_TYPE chooseDriver(core::stringc arg_)
|
||||
{
|
||||
if (arg_ == "null")
|
||||
return video::EDT_NULL;
|
||||
if (arg_ == "ogles1")
|
||||
return video::EDT_OGLES1;
|
||||
if (arg_ == "ogles2")
|
||||
return video::EDT_OGLES2;
|
||||
if (arg_ == "opengl")
|
||||
return video::EDT_OPENGL;
|
||||
if (arg_ == "opengl3")
|
||||
return video::EDT_OPENGL3;
|
||||
std::cerr << "Unknown driver type: " << arg_.c_str() << ". Trying OpenGL." << std::endl;
|
||||
return video::EDT_OPENGL;
|
||||
}
|
||||
|
||||
static inline void check(bool ok, const char *msg)
|
||||
{
|
||||
if (!ok) {
|
||||
test_fail++;
|
||||
device->getLogger()->log((core::stringc("FAILED TEST: ") + msg).c_str(), ELL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
void run_unit_tests()
|
||||
{
|
||||
std::cout << "Running unit tests:" << std::endl;
|
||||
try {
|
||||
test_irr_array();
|
||||
test_irr_string();
|
||||
} catch (const std::exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
test_fail++;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
run_unit_tests();
|
||||
|
||||
SIrrlichtCreationParameters p;
|
||||
p.DriverType = chooseDriver(argc > 1 ? argv[1] : "");
|
||||
p.WindowSize = core::dimension2du(640, 480);
|
||||
p.Vsync = true;
|
||||
p.LoggingLevel = ELL_DEBUG;
|
||||
|
||||
device = createDeviceEx(p);
|
||||
if (!device)
|
||||
return 1;
|
||||
|
||||
{
|
||||
u32 total = 0;
|
||||
device->getOSOperator()->getSystemMemory(&total, nullptr);
|
||||
core::stringc message = core::stringc("Total RAM in MiB: ") + core::stringc(total >> 10);
|
||||
device->getLogger()->log(message.c_str(), ELL_INFORMATION);
|
||||
check(total > 130 * 1024, "RAM amount");
|
||||
}
|
||||
|
||||
device->setWindowCaption(L"Hello World!");
|
||||
device->setResizable(true);
|
||||
|
||||
video::IVideoDriver *driver = device->getVideoDriver();
|
||||
scene::ISceneManager *smgr = device->getSceneManager();
|
||||
gui::IGUIEnvironment *guienv = device->getGUIEnvironment();
|
||||
|
||||
guienv->addStaticText(L"sample text", core::rect<s32>(10, 10, 110, 22), false);
|
||||
|
||||
gui::IGUIButton *button = guienv->addButton(
|
||||
core::rect<s32>(10, 30, 110, 30 + 32), 0, -1, L"sample button",
|
||||
L"sample tooltip");
|
||||
|
||||
gui::IGUIEditBox *editbox = guienv->addEditBox(L"",
|
||||
core::rect<s32>(10, 70, 60, 70 + 16));
|
||||
|
||||
const io::path mediaPath = getExampleMediaPath();
|
||||
|
||||
auto mesh_file = device->getFileSystem()->createAndOpenFile(mediaPath + "coolguy_opt.x");
|
||||
check(mesh_file, "mesh file loading");
|
||||
scene::IAnimatedMesh *mesh = smgr->getMesh(mesh_file);
|
||||
check(mesh, "mesh loading");
|
||||
if (mesh_file)
|
||||
mesh_file->drop();
|
||||
if (mesh) {
|
||||
video::ITexture *tex = driver->getTexture(mediaPath + "cooltexture.png");
|
||||
check(tex, "texture loading");
|
||||
scene::IAnimatedMeshSceneNode *node = smgr->addAnimatedMeshSceneNode(mesh);
|
||||
if (node) {
|
||||
node->forEachMaterial([tex](video::SMaterial &mat) {
|
||||
mat.Lighting = false;
|
||||
mat.setTexture(0, tex);
|
||||
});
|
||||
node->setFrameLoop(0, 29);
|
||||
node->setAnimationSpeed(30);
|
||||
}
|
||||
}
|
||||
|
||||
smgr->addCameraSceneNode(0, core::vector3df(0, 4, 5), core::vector3df(0, 2, 0));
|
||||
|
||||
s32 n = 0;
|
||||
SEvent event;
|
||||
device->getTimer()->start();
|
||||
|
||||
while (device->run()) {
|
||||
if (device->getTimer()->getTime() >= 1000) {
|
||||
device->getTimer()->setTime(0);
|
||||
++n;
|
||||
if (n == 1) { // Tooltip display
|
||||
bzero(&event, sizeof(SEvent));
|
||||
event.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||
event.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
|
||||
event.MouseInput.X = button->getAbsolutePosition().getCenter().X;
|
||||
event.MouseInput.Y = button->getAbsolutePosition().getCenter().Y;
|
||||
device->postEventFromUser(event);
|
||||
} else if (n == 2) // Text input focus
|
||||
guienv->setFocus(editbox);
|
||||
else if (n == 3) { // Keypress for Text input
|
||||
bzero(&event, sizeof(SEvent));
|
||||
event.EventType = irr::EET_KEY_INPUT_EVENT;
|
||||
event.KeyInput.Char = L'a';
|
||||
event.KeyInput.Key = KEY_KEY_A;
|
||||
event.KeyInput.PressedDown = true;
|
||||
device->postEventFromUser(event);
|
||||
event.KeyInput.PressedDown = false;
|
||||
device->postEventFromUser(event);
|
||||
} else
|
||||
device->closeDevice();
|
||||
}
|
||||
|
||||
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH,
|
||||
video::SColor(255, 100, 100, 150));
|
||||
smgr->drawAll();
|
||||
guienv->drawAll();
|
||||
driver->endScene();
|
||||
}
|
||||
|
||||
check(core::stringw(L"a") == editbox->getText(), "EditBox text");
|
||||
|
||||
device->getLogger()->log("Done.", ELL_INFORMATION);
|
||||
device->drop();
|
||||
return test_fail > 0 ? 1 : 0;
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
#include <irrArray.h>
|
||||
#include "test_helper.h"
|
||||
|
||||
using namespace irr;
|
||||
using core::array;
|
||||
|
||||
static void test_basics()
|
||||
{
|
||||
array<int> v;
|
||||
v.push_back(1); // 1
|
||||
v.push_front(2); // 2, 1
|
||||
v.insert(4, 0); // 4, 2, 1
|
||||
v.insert(3, 1); // 4, 3, 2, 1
|
||||
v.insert(0, 4); // 4, 3, 2, 1, 0
|
||||
UASSERTEQ(v.size(), 5);
|
||||
UASSERTEQ(v[0], 4);
|
||||
UASSERTEQ(v[1], 3);
|
||||
UASSERTEQ(v[2], 2);
|
||||
UASSERTEQ(v[3], 1);
|
||||
UASSERTEQ(v[4], 0);
|
||||
array<int> w = v;
|
||||
UASSERTEQ(w.size(), 5);
|
||||
UASSERT(w == v);
|
||||
w.clear();
|
||||
UASSERTEQ(w.size(), 0);
|
||||
UASSERTEQ(w.allocated_size(), 0);
|
||||
UASSERT(w.empty());
|
||||
w = v;
|
||||
UASSERTEQ(w.size(), 5);
|
||||
w.set_used(3);
|
||||
UASSERTEQ(w.size(), 3);
|
||||
UASSERTEQ(w[0], 4);
|
||||
UASSERTEQ(w[1], 3);
|
||||
UASSERTEQ(w[2], 2);
|
||||
UASSERTEQ(w.getLast(), 2);
|
||||
w.set_used(20);
|
||||
UASSERTEQ(w.size(), 20);
|
||||
w = v;
|
||||
w.sort();
|
||||
UASSERTEQ(w.size(), 5);
|
||||
UASSERTEQ(w[0], 0);
|
||||
UASSERTEQ(w[1], 1);
|
||||
UASSERTEQ(w[2], 2);
|
||||
UASSERTEQ(w[3], 3);
|
||||
UASSERTEQ(w[4], 4);
|
||||
w.erase(0);
|
||||
UASSERTEQ(w.size(), 4);
|
||||
UASSERTEQ(w[0], 1);
|
||||
UASSERTEQ(w[1], 2);
|
||||
UASSERTEQ(w[2], 3);
|
||||
UASSERTEQ(w[3], 4);
|
||||
w.erase(1, 2);
|
||||
UASSERTEQ(w.size(), 2);
|
||||
UASSERTEQ(w[0], 1);
|
||||
UASSERTEQ(w[1], 4);
|
||||
w.swap(v);
|
||||
UASSERTEQ(w.size(), 5);
|
||||
UASSERTEQ(v.size(), 2);
|
||||
}
|
||||
|
||||
static void test_linear_searches()
|
||||
{
|
||||
// Populate the array with 0, 1, 2, ..., 100, 100, 99, 98, 97, ..., 0
|
||||
array<int> arr;
|
||||
for (int i = 0; i <= 100; i++)
|
||||
arr.push_back(i);
|
||||
for (int i = 100; i >= 0; i--)
|
||||
arr.push_back(i);
|
||||
s32 end = arr.size() - 1;
|
||||
for (int i = 0; i <= 100; i++) {
|
||||
s32 index = arr.linear_reverse_search(i);
|
||||
UASSERTEQ(index, end - i);
|
||||
}
|
||||
for (int i = 0; i <= 100; i++) {
|
||||
s32 index = arr.linear_search(i);
|
||||
UASSERTEQ(index, i);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_binary_searches()
|
||||
{
|
||||
const auto &values = {3, 5, 1, 2, 5, 10, 19, 9, 7, 1, 2, 5, 8, 15};
|
||||
array<int> arr;
|
||||
for (int value : values) {
|
||||
arr.push_back(value);
|
||||
}
|
||||
// Test the const form first, it uses a linear search without sorting
|
||||
const array<int> &carr = arr;
|
||||
UASSERTEQ(carr.binary_search(20), -1);
|
||||
UASSERTEQ(carr.binary_search(0), -1);
|
||||
UASSERTEQ(carr.binary_search(1), 2);
|
||||
|
||||
// Sorted: 1, 1, 2, 2, 3, 5, 5, 5, 7, 8, 9, 10, 15, 19
|
||||
UASSERTEQ(arr.binary_search(20), -1);
|
||||
UASSERTEQ(arr.binary_search(0), -1);
|
||||
|
||||
for (int value : values) {
|
||||
s32 i = arr.binary_search(value);
|
||||
UASSERTNE(i, -1);
|
||||
UASSERTEQ(arr[i], value);
|
||||
}
|
||||
|
||||
s32 first, last;
|
||||
first = arr.binary_search_multi(1, last);
|
||||
UASSERTEQ(first, 0);
|
||||
UASSERTEQ(last, 1);
|
||||
|
||||
first = arr.binary_search_multi(2, last);
|
||||
UASSERTEQ(first, 2);
|
||||
UASSERTEQ(last, 3);
|
||||
|
||||
first = arr.binary_search_multi(3, last);
|
||||
UASSERTEQ(first, 4);
|
||||
UASSERTEQ(last, 4);
|
||||
|
||||
first = arr.binary_search_multi(4, last);
|
||||
UASSERTEQ(first, -1);
|
||||
|
||||
first = arr.binary_search_multi(5, last);
|
||||
UASSERTEQ(first, 5);
|
||||
UASSERTEQ(last, 7);
|
||||
|
||||
first = arr.binary_search_multi(7, last);
|
||||
UASSERTEQ(first, 8);
|
||||
UASSERTEQ(last, 8);
|
||||
|
||||
first = arr.binary_search_multi(19, last);
|
||||
UASSERTEQ(first, 13);
|
||||
UASSERTEQ(last, 13);
|
||||
}
|
||||
|
||||
void test_irr_array()
|
||||
{
|
||||
test_basics();
|
||||
test_linear_searches();
|
||||
test_binary_searches();
|
||||
std::cout << " test_irr_array PASSED" << std::endl;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
|
||||
class TestFailedException : public std::exception
|
||||
{
|
||||
};
|
||||
|
||||
// Asserts the comparison specified by CMP is true, or fails the current unit test
|
||||
#define UASSERTCMP(CMP, actual, expected) \
|
||||
do { \
|
||||
const auto &a = (actual); \
|
||||
const auto &e = (expected); \
|
||||
if (!CMP(a, e)) { \
|
||||
std::cout \
|
||||
<< "Test assertion failed: " << #actual << " " << #CMP << " " \
|
||||
<< #expected << std::endl \
|
||||
<< " at " << __FILE__ << ":" << __LINE__ << std::endl \
|
||||
<< " actual: " << a << std::endl \
|
||||
<< " expected: " \
|
||||
<< e << std::endl; \
|
||||
throw TestFailedException(); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CMPEQ(a, e) (a == e)
|
||||
#define CMPTRUE(a, e) (a)
|
||||
#define CMPNE(a, e) (a != e)
|
||||
|
||||
#define UASSERTEQ(actual, expected) UASSERTCMP(CMPEQ, actual, expected)
|
||||
#define UASSERTNE(actual, nexpected) UASSERTCMP(CMPNE, actual, nexpected)
|
||||
#define UASSERT(actual) UASSERTCMP(CMPTRUE, actual, true)
|
||||
@@ -1,205 +0,0 @@
|
||||
#include <irrString.h>
|
||||
#include <cstring>
|
||||
#include <clocale>
|
||||
#include <vector>
|
||||
#include "test_helper.h"
|
||||
|
||||
using namespace irr;
|
||||
using namespace irr::core;
|
||||
|
||||
#define CMPSTR(a, b) (!strcmp(a, b))
|
||||
#define UASSERTSTR(actual, expected) UASSERTCMP(CMPSTR, actual.c_str(), expected)
|
||||
|
||||
static void test_basics()
|
||||
{
|
||||
// ctor
|
||||
stringc s;
|
||||
UASSERTEQ(s.c_str()[0], '\0');
|
||||
s = stringc(0.1234567);
|
||||
UASSERTSTR(s, "0.123457");
|
||||
s = stringc(0x1p+53);
|
||||
UASSERTSTR(s, "9007199254740992.000000");
|
||||
s = stringc(static_cast<int>(-102400));
|
||||
UASSERTSTR(s, "-102400");
|
||||
s = stringc(static_cast<unsigned int>(102400));
|
||||
UASSERTSTR(s, "102400");
|
||||
s = stringc(static_cast<long>(-1024000));
|
||||
UASSERTSTR(s, "-1024000");
|
||||
s = stringc(static_cast<unsigned long>(1024000));
|
||||
UASSERTSTR(s, "1024000");
|
||||
s = stringc("YESno", 3);
|
||||
UASSERTSTR(s, "YES");
|
||||
s = stringc(L"test", 4);
|
||||
UASSERTSTR(s, "test");
|
||||
s = stringc("Hello World!");
|
||||
UASSERTSTR(s, "Hello World!");
|
||||
// operator=
|
||||
s = stringw(L"abcdef");
|
||||
UASSERTSTR(s, "abcdef");
|
||||
s = L"abcdef";
|
||||
UASSERTSTR(s, "abcdef");
|
||||
s = static_cast<const char *>(nullptr);
|
||||
UASSERTSTR(s, "");
|
||||
// operator+
|
||||
s = s + stringc("foo");
|
||||
UASSERTSTR(s, "foo");
|
||||
s = s + L"bar";
|
||||
UASSERTSTR(s, "foobar");
|
||||
// the rest
|
||||
s = "f";
|
||||
UASSERTEQ(s[0], 'f');
|
||||
const auto &sref = s;
|
||||
UASSERTEQ(sref[0], 'f');
|
||||
UASSERT(sref == "f");
|
||||
UASSERT(sref == stringc("f"));
|
||||
s = "a";
|
||||
UASSERT(sref < stringc("aa"));
|
||||
UASSERT(sref < stringc("b"));
|
||||
UASSERT(stringc("Z") < sref);
|
||||
UASSERT(!(sref < stringc("a")));
|
||||
UASSERT(sref.lower_ignore_case("AA"));
|
||||
UASSERT(sref.lower_ignore_case("B"));
|
||||
UASSERT(!sref.lower_ignore_case("A"));
|
||||
s = "dog";
|
||||
UASSERT(sref != "cat");
|
||||
UASSERT(sref != stringc("cat"));
|
||||
}
|
||||
|
||||
static void test_methods()
|
||||
{
|
||||
stringc s;
|
||||
const auto &sref = s;
|
||||
s = "irrlicht";
|
||||
UASSERTEQ(sref.size(), 8);
|
||||
UASSERT(!sref.empty());
|
||||
s.clear();
|
||||
UASSERTEQ(sref.size(), 0);
|
||||
UASSERT(sref.empty());
|
||||
UASSERT(sref[0] == 0);
|
||||
s = "\tAz#`";
|
||||
s.make_lower();
|
||||
UASSERTSTR(s, "\taz#`");
|
||||
s.make_upper();
|
||||
UASSERTSTR(s, "\tAZ#`");
|
||||
UASSERT(sref.equals_ignore_case("\taz#`"));
|
||||
UASSERT(sref.equals_substring_ignore_case("Z#`", 2));
|
||||
s = "irrlicht";
|
||||
UASSERT(sref.equalsn(stringc("irr"), 3));
|
||||
UASSERT(sref.equalsn("irr", 3));
|
||||
s = "fo";
|
||||
s.append('o');
|
||||
UASSERTSTR(s, "foo");
|
||||
s.append("bar", 1);
|
||||
UASSERTSTR(s, "foob");
|
||||
s.append("ar", 999999);
|
||||
UASSERTSTR(s, "foobar");
|
||||
s = "nyan";
|
||||
s.append(stringc("cat"));
|
||||
UASSERTSTR(s, "nyancat");
|
||||
s.append(stringc("sam"), 1);
|
||||
UASSERTSTR(s, "nyancats");
|
||||
s = "fbar";
|
||||
s.insert(1, "ooXX", 2);
|
||||
UASSERTSTR(s, "foobar");
|
||||
UASSERTEQ(sref.findFirst('o'), 1);
|
||||
UASSERTEQ(sref.findFirst('X'), -1);
|
||||
UASSERTEQ(sref.findFirstChar("abff", 2), 3);
|
||||
UASSERTEQ(sref.findFirstCharNotInList("fobb", 2), 3);
|
||||
UASSERTEQ(sref.findLast('o'), 2);
|
||||
UASSERTEQ(sref.findLast('X'), -1);
|
||||
UASSERTEQ(sref.findLastChar("abrr", 2), 4);
|
||||
UASSERTEQ(sref.findLastCharNotInList("rabb", 2), 3);
|
||||
UASSERTEQ(sref.findNext('o', 2), 2);
|
||||
UASSERTEQ(sref.findLast('o', 1), 1);
|
||||
s = "ob-oob";
|
||||
UASSERTEQ(sref.find("ob", 1), 4);
|
||||
UASSERTEQ(sref.find("ob"), 0);
|
||||
UASSERTEQ(sref.find("?"), -1);
|
||||
s = "HOMEOWNER";
|
||||
stringc s2 = sref.subString(2, 4);
|
||||
UASSERTSTR(s2, "MEOW");
|
||||
s2 = sref.subString(2, 4, true);
|
||||
UASSERTSTR(s2, "meow");
|
||||
s = "land";
|
||||
s.replace('l', 's');
|
||||
UASSERTSTR(s, "sand");
|
||||
s = ">dog<";
|
||||
s.replace("dog", "cat");
|
||||
UASSERTSTR(s, ">cat<");
|
||||
s.replace("cat", "horse");
|
||||
UASSERTSTR(s, ">horse<");
|
||||
s.replace("horse", "gnu");
|
||||
UASSERTSTR(s, ">gnu<");
|
||||
s = " h e l p ";
|
||||
s.remove(' ');
|
||||
UASSERTSTR(s, "help");
|
||||
s.remove("el");
|
||||
UASSERTSTR(s, "hp");
|
||||
s = "irrlicht";
|
||||
s.removeChars("it");
|
||||
UASSERTSTR(s, "rrlch");
|
||||
s = "\r\nfoo bar ";
|
||||
s.trim();
|
||||
UASSERTSTR(s, "foo bar");
|
||||
s = "foxo";
|
||||
s.erase(2);
|
||||
UASSERTSTR(s, "foo");
|
||||
s = "a";
|
||||
s.append('\0');
|
||||
s.append('b');
|
||||
UASSERTEQ(s.size(), 3);
|
||||
s.validate();
|
||||
UASSERTEQ(s.size(), 1);
|
||||
UASSERTEQ(s.lastChar(), 'a');
|
||||
std::vector<stringc> res;
|
||||
s = "a,,b,c";
|
||||
s.split(res, ",aa", 1, true, false);
|
||||
UASSERTEQ(res.size(), 3);
|
||||
UASSERTSTR(res[0], "a");
|
||||
UASSERTSTR(res[2], "c");
|
||||
res.clear();
|
||||
s.split(res, ",", 1, false, true);
|
||||
UASSERTEQ(res.size(), 7);
|
||||
UASSERTSTR(res[0], "a");
|
||||
UASSERTSTR(res[2], "");
|
||||
for (int i = 0; i < 3; i++)
|
||||
UASSERTSTR(res[2 * i + 1], ",");
|
||||
}
|
||||
|
||||
static void test_conv()
|
||||
{
|
||||
// locale-independent
|
||||
|
||||
stringw out;
|
||||
utf8ToWString(out, "†††");
|
||||
UASSERTEQ(out.size(), 3);
|
||||
for (int i = 0; i < 3; i++)
|
||||
UASSERTEQ(static_cast<u16>(out[i]), 0x2020);
|
||||
|
||||
stringc out2;
|
||||
wStringToUTF8(out2, L"†††");
|
||||
UASSERTEQ(out2.size(), 9);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
UASSERTEQ(static_cast<u8>(out2[3 * i]), 0xe2);
|
||||
UASSERTEQ(static_cast<u8>(out2[3 * i + 1]), 0x80);
|
||||
UASSERTEQ(static_cast<u8>(out2[3 * i + 2]), 0xa0);
|
||||
}
|
||||
|
||||
// locale-dependent
|
||||
if (!setlocale(LC_CTYPE, "C.UTF-8"))
|
||||
setlocale(LC_CTYPE, "UTF-8"); // macOS
|
||||
|
||||
stringw out3;
|
||||
multibyteToWString(out3, "†††");
|
||||
UASSERTEQ(out3.size(), 3);
|
||||
for (int i = 0; i < 3; i++)
|
||||
UASSERTEQ(static_cast<u16>(out3[i]), 0x2020);
|
||||
}
|
||||
|
||||
void test_irr_string()
|
||||
{
|
||||
test_basics();
|
||||
test_methods();
|
||||
test_conv();
|
||||
std::cout << " test_irr_string PASSED" << std::endl;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
set(IRREXAMPLES
|
||||
# removed
|
||||
)
|
||||
if(UNIX)
|
||||
list(APPEND IRREXAMPLES AutomatedTest)
|
||||
endif()
|
||||
|
||||
foreach(exname IN ITEMS ${IRREXAMPLES})
|
||||
file(GLOB sources "${CMAKE_CURRENT_SOURCE_DIR}/${exname}/*.cpp")
|
||||
add_executable(${exname} ${sources})
|
||||
|
||||
target_include_directories(${exname} PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${exname}
|
||||
)
|
||||
target_link_libraries(${exname} IrrlichtMt)
|
||||
endforeach()
|
||||
@@ -170,16 +170,21 @@ class CMeshBuffer : public IMeshBuffer
|
||||
return;
|
||||
|
||||
const u32 vertexCount = getVertexCount();
|
||||
u32 i;
|
||||
|
||||
Vertices.reallocate(vertexCount + numVertices);
|
||||
for (i = 0; i < numVertices; ++i) {
|
||||
// Only reallocate if there are enough new vertices. Otherwise append()
|
||||
// will be slow when called in a loop.
|
||||
if (vertexCount + numVertices > Vertices.allocated_size() * 3 / 2)
|
||||
Vertices.reallocate(vertexCount + numVertices);
|
||||
|
||||
for (u32 i = 0; i < numVertices; ++i) {
|
||||
Vertices.push_back(static_cast<const T *>(vertices)[i]);
|
||||
BoundingBox.addInternalPoint(static_cast<const T *>(vertices)[i].Pos);
|
||||
}
|
||||
|
||||
Indices.reallocate(getIndexCount() + numIndices);
|
||||
for (i = 0; i < numIndices; ++i) {
|
||||
if (getIndexCount() + numIndices > Indices.allocated_size() * 3 / 2)
|
||||
Indices.reallocate(getIndexCount() + numIndices);
|
||||
|
||||
for (u32 i = 0; i < numIndices; ++i) {
|
||||
Indices.push_back(indices[i] + vertexCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 4.7 KiB |
@@ -1,123 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# NOTE: this code is mostly copied from minetest_android_deps
|
||||
# <https://github.com/minetest/minetest_android_deps>
|
||||
|
||||
png_ver=1.6.40
|
||||
jpeg_ver=3.0.1
|
||||
|
||||
download () {
|
||||
get_tar_archive libpng "https://download.sourceforge.net/libpng/libpng-${png_ver}.tar.gz"
|
||||
get_tar_archive libjpeg "https://download.sourceforge.net/libjpeg-turbo/libjpeg-turbo-${jpeg_ver}.tar.gz"
|
||||
}
|
||||
|
||||
build () {
|
||||
# Build libjpg and libpng first because Irrlicht needs them
|
||||
mkdir -p libpng
|
||||
pushd libpng
|
||||
$srcdir/libpng/configure --host=$CROSS_PREFIX
|
||||
make && make DESTDIR=$PWD install
|
||||
popd
|
||||
|
||||
mkdir -p libjpeg
|
||||
pushd libjpeg
|
||||
cmake $srcdir/libjpeg "${CMAKE_FLAGS[@]}" -DENABLE_SHARED=OFF
|
||||
make && make DESTDIR=$PWD install
|
||||
popd
|
||||
|
||||
local libpng=$PWD/libpng/usr/local/lib/libpng.a
|
||||
local libjpeg=$(echo $PWD/libjpeg/opt/libjpeg-turbo/lib*/libjpeg.a)
|
||||
cmake $srcdir/irrlicht "${CMAKE_FLAGS[@]}" \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DPNG_LIBRARY=$libpng \
|
||||
-DPNG_PNG_INCLUDE_DIR=$(dirname "$libpng")/../include \
|
||||
-DJPEG_LIBRARY=$libjpeg \
|
||||
-DJPEG_INCLUDE_DIR=$(dirname "$libjpeg")/../include
|
||||
make
|
||||
|
||||
cp -p lib/Android/libIrrlichtMt.a $libpng $libjpeg $pkgdir/
|
||||
cp -a $srcdir/irrlicht/include $pkgdir/include
|
||||
cp -a $srcdir/irrlicht/media/Shaders $pkgdir/Shaders
|
||||
}
|
||||
|
||||
get_tar_archive () {
|
||||
# $1: folder to extract to, $2: URL
|
||||
local filename="${2##*/}"
|
||||
[ -d "$1" ] && return 0
|
||||
wget -c "$2" -O "$filename"
|
||||
mkdir -p "$1"
|
||||
tar -xaf "$filename" -C "$1" --strip-components=1
|
||||
rm "$filename"
|
||||
}
|
||||
|
||||
_setup_toolchain () {
|
||||
local toolchain=$(echo "$ANDROID_NDK"/toolchains/llvm/prebuilt/*)
|
||||
if [ ! -d "$toolchain" ]; then
|
||||
echo "Android NDK path not specified or incorrect"; return 1
|
||||
fi
|
||||
export PATH="$toolchain/bin:$ANDROID_NDK:$PATH"
|
||||
|
||||
unset CFLAGS CPPFLAGS CXXFLAGS
|
||||
|
||||
TARGET_ABI="$1"
|
||||
API=21
|
||||
if [ "$TARGET_ABI" == armeabi-v7a ]; then
|
||||
CROSS_PREFIX=armv7a-linux-androideabi
|
||||
CFLAGS="-mthumb"
|
||||
CXXFLAGS="-mthumb"
|
||||
elif [ "$TARGET_ABI" == arm64-v8a ]; then
|
||||
CROSS_PREFIX=aarch64-linux-android
|
||||
elif [ "$TARGET_ABI" == x86 ]; then
|
||||
CROSS_PREFIX=i686-linux-android
|
||||
CFLAGS="-mssse3 -mfpmath=sse"
|
||||
CXXFLAGS="-mssse3 -mfpmath=sse"
|
||||
elif [ "$TARGET_ABI" == x86_64 ]; then
|
||||
CROSS_PREFIX=x86_64-linux-android
|
||||
else
|
||||
echo "Invalid ABI given"; return 1
|
||||
fi
|
||||
export CC=$CROSS_PREFIX$API-clang
|
||||
export CXX=$CROSS_PREFIX$API-clang++
|
||||
export AR=llvm-ar
|
||||
export RANLIB=llvm-ranlib
|
||||
export CFLAGS="-fPIC ${CFLAGS}"
|
||||
export CXXFLAGS="-fPIC ${CXXFLAGS}"
|
||||
|
||||
CMAKE_FLAGS=(
|
||||
"-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake"
|
||||
"-DANDROID_ABI=$TARGET_ABI" "-DANDROID_NATIVE_API_LEVEL=$API"
|
||||
"-DCMAKE_BUILD_TYPE=Release"
|
||||
)
|
||||
|
||||
# make sure pkg-config doesn't interfere
|
||||
export PKG_CONFIG=/bin/false
|
||||
|
||||
export MAKEFLAGS="-j$(nproc)"
|
||||
}
|
||||
|
||||
_run_build () {
|
||||
local abi=$1
|
||||
irrdir=$PWD
|
||||
|
||||
mkdir -p $RUNNER_TEMP/src
|
||||
cd $RUNNER_TEMP/src
|
||||
srcdir=$PWD
|
||||
[ -d irrlicht ] || ln -s $irrdir irrlicht
|
||||
download
|
||||
|
||||
builddir=$RUNNER_TEMP/build/irrlicht-$abi
|
||||
pkgdir=$RUNNER_TEMP/pkg/$abi/Irrlicht
|
||||
rm -rf "$pkgdir"
|
||||
mkdir -p "$builddir" "$pkgdir"
|
||||
|
||||
cd "$builddir"
|
||||
build
|
||||
}
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: ci-build-android.sh <ABI>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
_setup_toolchain $1
|
||||
_run_build $1
|
||||
@@ -1,70 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
topdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
[[ -z "$CC" || -z "$CXX" ]] && exit 255
|
||||
variant=win32
|
||||
[[ "$(basename "$CXX")" == "x86_64-"* ]] && variant=win64
|
||||
with_sdl=0
|
||||
[[ "$extras" == *"-sdl"* ]] && with_sdl=1
|
||||
#with_gl3=0
|
||||
#[[ "$extras" == *"-gl3"* ]] && with_gl3=1
|
||||
|
||||
libjpeg_version=3.0.1
|
||||
libpng_version=1.6.40
|
||||
sdl2_version=2.28.5
|
||||
zlib_version=1.3.1
|
||||
|
||||
download () {
|
||||
local url=$1
|
||||
local filename=${url##*/}
|
||||
local foldername=${filename%%[.-]*}
|
||||
|
||||
[ -d "./$foldername" ] && return 0
|
||||
[ -e "$filename" ] || wget "$url" -O "$filename"
|
||||
sha256sum -w -c <(grep -F "$filename" "$topdir/sha256sums.txt")
|
||||
unzip -o "$filename" -d "$foldername"
|
||||
}
|
||||
|
||||
libs=$PWD/libs
|
||||
mkdir -p libs
|
||||
pushd libs
|
||||
libhost="http://minetest.kitsunemimi.pw"
|
||||
download "$libhost/llvm/libjpeg-$libjpeg_version-$variant.zip"
|
||||
download "$libhost/llvm/libpng-$libpng_version-$variant.zip"
|
||||
[ $with_sdl -eq 1 ] && download "$libhost/llvm/sdl2-$sdl2_version-$variant.zip"
|
||||
download "$libhost/llvm/zlib-$zlib_version-$variant.zip"
|
||||
popd
|
||||
|
||||
tmp=(
|
||||
-DCMAKE_SYSTEM_NAME=Windows \
|
||||
-DPNG_LIBRARY=$libs/libpng/lib/libpng.dll.a \
|
||||
-DPNG_PNG_INCLUDE_DIR=$libs/libpng/include \
|
||||
-DJPEG_LIBRARY=$libs/libjpeg/lib/libjpeg.dll.a \
|
||||
-DJPEG_INCLUDE_DIR=$libs/libjpeg/include \
|
||||
-DZLIB_LIBRARY=$libs/zlib/lib/libz.dll.a \
|
||||
-DZLIB_INCLUDE_DIR=$libs/zlib/include
|
||||
)
|
||||
if [ $with_sdl -eq 1 ]; then
|
||||
tmp+=(
|
||||
-DUSE_SDL2=ON
|
||||
-DCMAKE_PREFIX_PATH=$libs/sdl2/lib/cmake
|
||||
)
|
||||
else
|
||||
tmp+=(-DUSE_SDL2=OFF)
|
||||
fi
|
||||
#[ $with_gl3 -eq 1 ] && tmp+=(-DENABLE_OPENGL=OFF -DENABLE_OPENGL3=ON)
|
||||
|
||||
cmake . "${tmp[@]}"
|
||||
make -j$(nproc)
|
||||
|
||||
if [ "$1" = "package" ]; then
|
||||
make DESTDIR=$PWD/_install install
|
||||
# strip library
|
||||
"${CXX%-*}-strip" --strip-unneeded _install/usr/local/lib/*.dll
|
||||
# bundle the DLLs that are specific to Irrlicht (kind of a hack)
|
||||
shopt -s nullglob
|
||||
cp -p $libs/*/bin/{libjpeg,libpng,SDL}*.dll _install/usr/local/lib/
|
||||
# create a ZIP
|
||||
(cd _install/usr/local; zip -9r "$OLDPWD/irrlicht-$variant$extras.zip" -- *)
|
||||
fi
|
||||
exit 0
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
topdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
name=llvm-mingw-20231128-ucrt-ubuntu-20.04-x86_64.tar.xz
|
||||
wget "https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/$name" -O "$name"
|
||||
sha256sum -w -c <(grep -F "$name" "$topdir/sha256sums.txt")
|
||||
sudo tar -xaf "$name" -C /usr --strip-components=1
|
||||
rm -f "$name"
|
||||
@@ -1,9 +0,0 @@
|
||||
0f21ff3be90311092fe32e0e30878ef3ae9d9437b8d9ac25ef279e0d84e9bb8e llvm-mingw-20231128-ucrt-ubuntu-20.04-x86_64.tar.xz
|
||||
53dfd31285f470fcf0dca88217c5cf9c557729af6d103afae5936e72ddc38d3c libjpeg-3.0.1-win32.zip
|
||||
3d44e0740914e6878300e30653aad39e974821b5d7f6c2567e246b4eb04a5324 libjpeg-3.0.1-win64.zip
|
||||
6baf4e819bfb3573760524b5dc9a04b5e479090d6d2046b86cf39a3107c0071f libpng-1.6.40-win32.zip
|
||||
c02e029f01fce44baea7f4aecfd2564bd8a03507c0c6af8b03339ae0452c8b7d libpng-1.6.40-win64.zip
|
||||
f9f890af960e92fd3f532f2e9ac00681c33bc67a722e000dfdaeb41b0064f1a0 sdl2-2.28.5-win32.zip
|
||||
8dde2c6963544b7d8a2e87c128ebbdf51ad0e70c7e2df986ff4e963ce9996d9b sdl2-2.28.5-win64.zip
|
||||
8af10515d57dbfee5d2106cd66cafa2adeb4270d4c6047ccbf7e8b5d2d50681c zlib-1.3.1-win32.zip
|
||||
ad43f5d23052590c65633530743e5d622cc76b33c109072e6fd7b487aff56bca zlib-1.3.1-win64.zip
|
||||
@@ -45,9 +45,12 @@
|
||||
#include <X11/Xcursor/Xcursor.h>
|
||||
#endif
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_X11_) || defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/joystick.h>
|
||||
|
||||
@@ -1125,8 +1125,11 @@ void COpenGL3DriverBase::setMaterial(const SMaterial &material)
|
||||
OverrideMaterial.apply(Material);
|
||||
|
||||
for (u32 i = 0; i < Feature.MaxTextureUnits; ++i) {
|
||||
CacheHandler->getTextureCache().set(i, material.getTexture(i));
|
||||
setTransform((E_TRANSFORMATION_STATE)(ETS_TEXTURE_0 + i), material.getTextureMatrix(i));
|
||||
auto *texture = material.getTexture(i);
|
||||
CacheHandler->getTextureCache().set(i, texture);
|
||||
if (texture) {
|
||||
setTransform((E_TRANSFORMATION_STATE)(ETS_TEXTURE_0 + i), material.getTextureMatrix(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
link_libraries(IrrlichtMt::IrrlichtMt)
|
||||
add_executable(image_loader_test image_loader_test.cpp)
|
||||
|
||||
function(test_image_loader format expected input)
|
||||
string(TOLOWER ${format} suffix)
|
||||
add_test(NAME ImageLoader${format}-${input} COMMAND image_loader_test ${expected} data/sample_${input}.${suffix} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endfunction()
|
||||
|
||||
test_image_loader(BMP 16color-16bpp 4bpp_v3)
|
||||
# test_image_loader(BMP 16color-16bpp 4bpp_v7)
|
||||
# test_image_loader(BMP 16color-16bpp 4bpp_v3_rle)
|
||||
# test_image_loader(BMP 16color-16bpp 4bpp_v7_rle)
|
||||
test_image_loader(BMP 30color-16bpp 8bpp_v3)
|
||||
# test_image_loader(BMP 30color-16bpp 8bpp_v7)
|
||||
test_image_loader(BMP 30color-16bpp 8bpp_v3_rle)
|
||||
# test_image_loader(BMP 30color-16bpp 8bpp_v7_rle)
|
||||
# test_image_loader(BMP 30color-16bpp 16bpp_v3)
|
||||
# test_image_loader(BMP 30color-16bpp 16bpp_v7)
|
||||
test_image_loader(BMP 30color-24bpp 24bpp_v3)
|
||||
test_image_loader(BMP 30color-24bpp 24bpp_v7)
|
||||
|
||||
test_image_loader(PNG 30color-24bpp 8bpp)
|
||||
test_image_loader(PNG 30color-24bpp 24bpp)
|
||||
|
||||
test_image_loader(TGA 30color-32bpp 8bpp_up)
|
||||
test_image_loader(TGA 30color-32bpp 8bpp_down)
|
||||
# test_image_loader(TGA 30color-16bpp 8bpp_rle_up)
|
||||
# test_image_loader(TGA 30color-16bpp 8bpp_rle_down)
|
||||
test_image_loader(TGA 30color-24bpp 24bpp_up)
|
||||
test_image_loader(TGA 30color-24bpp 24bpp_down)
|
||||
test_image_loader(TGA 30color-24bpp 24bpp_rle_up)
|
||||
test_image_loader(TGA 30color-24bpp 24bpp_rle_down)
|
||||
|
Before Width: | Height: | Size: 654 B |
|
Before Width: | Height: | Size: 738 B |
|
Before Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 899 B |
|
Before Width: | Height: | Size: 899 B |
|
Before Width: | Height: | Size: 954 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 298 B |
|
Before Width: | Height: | Size: 346 B |
|
Before Width: | Height: | Size: 474 B |
|
Before Width: | Height: | Size: 524 B |
|
Before Width: | Height: | Size: 558 B |
|
Before Width: | Height: | Size: 608 B |
@@ -1,162 +0,0 @@
|
||||
#include <cstdio>
|
||||
#include <initializer_list>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <irrlicht.h>
|
||||
|
||||
using namespace irr;
|
||||
|
||||
struct ImageDesc
|
||||
{
|
||||
const char *name;
|
||||
video::ECOLOR_FORMAT format;
|
||||
std::vector<u8> data;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
std::vector<u8> to_byte_array(std::initializer_list<T> in_data)
|
||||
{
|
||||
std::vector<u8> data;
|
||||
data.resize(sizeof(T) * in_data.size());
|
||||
memcpy(data.data(), in_data.begin(), data.size());
|
||||
return data;
|
||||
}
|
||||
|
||||
static const ImageDesc test_images[] = {
|
||||
{"16color-16bpp", video::ECF_A1R5G5B5, to_byte_array<u16>({
|
||||
0xb6df, 0xb6df, 0xb6df, 0xb6df, 0xc23f, 0xc23f, 0xd61f, 0xd61f, 0xea3f, 0xea3f, 0xfe5e, 0xfe5e, 0xfe7c, 0xfe7a, 0xfe7a, 0xfe97, 0xfeb5, 0xfeb5, 0xff16,
|
||||
0xb6df, 0xb6df, 0xff3f, 0xff3f, 0xc23f, 0xf2df, 0xf2df, 0xf2df, 0xea3f, 0xda7f, 0xda7f, 0xfe5e, 0xfe7a, 0xc23f, 0xbe7f, 0xbe7f, 0xfeb5, 0xfeb5, 0xfb76,
|
||||
0xb6df, 0xff9e, 0xc23f, 0xc23f, 0xc23f, 0xf2df, 0xd61f, 0xf2df, 0xea3f, 0xda7f, 0xfe5e, 0xda7f, 0xfe7a, 0xc23f, 0xfe97, 0xfeb5, 0xfeb5, 0xff16, 0xfb76,
|
||||
0xb6df, 0xff9e, 0xbe7f, 0xc23f, 0xd61f, 0xfe7c, 0xd61f, 0xf2df, 0xfe5e, 0xf2df, 0xfe7c, 0xda7f, 0xfe7a, 0xda7f, 0xbe7f, 0xfeb5, 0xff16, 0xff16, 0xfb76,
|
||||
0xb6df, 0xff9e, 0xc23f, 0xc23f, 0xd61f, 0xff3f, 0xd61f, 0xf2df, 0xfe5e, 0xda7f, 0xfe7c, 0xda7f, 0xfe7a, 0xc23f, 0xfeb5, 0xfeb5, 0xff16, 0xff16, 0xfb76,
|
||||
0xb6df, 0xbe7f, 0xff9e, 0xff3f, 0xd61f, 0xff3f, 0xf2df, 0xf2df, 0xfe5e, 0xf2df, 0xda7f, 0xfe97, 0xfe97, 0xda7f, 0xc23f, 0xda7f, 0xfb76, 0xfb76, 0xfb76,
|
||||
0xbe7f, 0xc23f, 0xc23f, 0xd61f, 0xd61f, 0xea3f, 0xea3f, 0xfe5e, 0xfe5e, 0xfe7c, 0xfe7c, 0xfe7a, 0xfe97, 0xfeb5, 0xfeb5, 0xfeb5, 0xfb76, 0xfb76, 0xfb76,
|
||||
0xbe7f, 0xc23f, 0xd61f, 0xd61f, 0xd61f, 0xea3f, 0xea3f, 0xfe5e, 0xfe5e, 0xfe7c, 0xfe97, 0xfe97, 0xfe97, 0xfeb5, 0xff16, 0xff16, 0xfb76, 0xfb76, 0xfb76,
|
||||
0xc23f, 0xff9e, 0xc23f, 0xd61f, 0xff3f, 0xea3f, 0xfe5e, 0xff3f, 0xfe7c, 0xfe7c, 0xf2df, 0xfe97, 0xfeb5, 0xfeb5, 0xda7f, 0xff16, 0xc23f, 0xc23f, 0xbe7f,
|
||||
0xc23f, 0xff9e, 0xff9e, 0xd61f, 0xff9e, 0xea3f, 0xff3f, 0xfe5e, 0xff3f, 0xfe7a, 0xf2df, 0xf2df, 0xfeb5, 0xf2df, 0xda7f, 0xfb76, 0xc23f, 0xfb76, 0xfb76,
|
||||
0xc23f, 0xff9e, 0xd61f, 0xff9e, 0xff9e, 0xfe5e, 0xff3f, 0xff3f, 0xff3f, 0xfe7a, 0xff3f, 0xfeb5, 0xf2df, 0xff16, 0xda7f, 0xfb76, 0xda7f, 0xda7f, 0xfb76,
|
||||
0xc23f, 0xff9e, 0xea3f, 0xea3f, 0xff9e, 0xfe5e, 0xff9e, 0xfe7c, 0xff3f, 0xfe97, 0xf2df, 0xfeb5, 0xfeb5, 0xff16, 0xf2df, 0xfb76, 0xda7f, 0xfb76, 0xfb76,
|
||||
0xd61f, 0xff9e, 0xd61f, 0xea3f, 0xff9e, 0xfe5e, 0xff9e, 0xfe7c, 0xff3f, 0xfe97, 0xff3f, 0xfeb5, 0xff16, 0xfb76, 0xda7f, 0xfb76, 0xda7f, 0xda7f, 0xc23f,
|
||||
0xd61f, 0xd61f, 0xea3f, 0xea3f, 0xea3f, 0xfe5e, 0xfe7c, 0xfe7a, 0xfe7a, 0xfe97, 0xfeb5, 0xff16, 0xff16, 0xfb76, 0xfb76, 0xfb76, 0xfb76, 0xfb76, 0xfb76,
|
||||
0xd61f, 0xd61f, 0xea3f, 0xfe5e, 0xfe5e, 0xfe7c, 0xfe7a, 0xfe7a, 0xfe97, 0xfeb5, 0xfeb5, 0xff16, 0xff16, 0xfb76, 0xfb76, 0xfb76, 0xfb76, 0xfb76, 0xfb76,
|
||||
})},
|
||||
|
||||
{"30color-16bpp", video::ECF_A1R5G5B5, to_byte_array<u16>({
|
||||
0xbabf, 0xbabf, 0xbabf, 0xbabf, 0xbe3f, 0xbdff, 0xc9ff, 0xda1f, 0xee3f, 0xee3f, 0xfa5f, 0xfe5e, 0xfe7c, 0xfe7b, 0xfe79, 0xfe97, 0xfeb5, 0xfed5, 0xff16,
|
||||
0xbabf, 0xbabf, 0xff1f, 0xff1f, 0xbdff, 0xfaff, 0xf2df, 0xeabf, 0xee3f, 0xe27f, 0xda7f, 0xfe5e, 0xfe7b, 0xc25f, 0xbe7f, 0xbe7f, 0xfeb5, 0xfed5, 0xff56,
|
||||
0xbabf, 0xff7e, 0xbe7f, 0xc25f, 0xbdff, 0xfaff, 0xda1f, 0xf2df, 0xee3f, 0xda7f, 0xfe5e, 0xce5f, 0xfe79, 0xce5f, 0xfe97, 0xfeb5, 0xfed5, 0xff16, 0xff56,
|
||||
0xbabf, 0xff7e, 0xbe7f, 0xbdff, 0xc9ff, 0xfaff, 0xda1f, 0xf2df, 0xfa5f, 0xeabf, 0xfe5e, 0xda7f, 0xfe79, 0xce5f, 0xc25f, 0xfeb5, 0xff16, 0xff16, 0xff76,
|
||||
0xbabf, 0xff7e, 0xc25f, 0xbdff, 0xc9ff, 0xff1f, 0xda1f, 0xf2df, 0xfa5f, 0xeabf, 0xfe7c, 0xda7f, 0xfe79, 0xce5f, 0xfeb5, 0xfed5, 0xff16, 0xff56, 0xff97,
|
||||
0xbabf, 0xbe7f, 0xff7e, 0xff5e, 0xda1f, 0xff1f, 0xfaff, 0xfaff, 0xfa5f, 0xf2df, 0xeabf, 0xfe79, 0xfe97, 0xda7f, 0xce5f, 0xce5f, 0xff56, 0xff76, 0xff97,
|
||||
0xbe7f, 0xc25f, 0xbdff, 0xc9ff, 0xda1f, 0xda1f, 0xee3f, 0xfa5f, 0xfa5f, 0xfe7c, 0xfe7b, 0xfe79, 0xfe97, 0xfeb5, 0xfed5, 0xfed5, 0xff76, 0xff76, 0xff97,
|
||||
0xbe7f, 0xbe3f, 0xc9ff, 0xc9ff, 0xda1f, 0xee3f, 0xee3f, 0xfa5f, 0xfe5e, 0xfe7c, 0xfe79, 0xfe97, 0xfe97, 0xfeb5, 0xff16, 0xff16, 0xff76, 0xff97, 0xff97,
|
||||
0xbe3f, 0xffbe, 0xc9ff, 0xda1f, 0xff5e, 0xee3f, 0xfa5f, 0xff1f, 0xfe7c, 0xfe7b, 0xf2df, 0xfe97, 0xfeb5, 0xfeb5, 0xda7f, 0xff76, 0xce5f, 0xbe3f, 0xc25f,
|
||||
0xbe3f, 0xffbe, 0xffbe, 0xda1f, 0xff7e, 0xfa5f, 0xff5e, 0xfe5e, 0xff1f, 0xfe79, 0xf2df, 0xf2df, 0xfeb5, 0xeabf, 0xda7f, 0xff76, 0xce5f, 0xff97, 0xff97,
|
||||
0xbdff, 0xffbe, 0xda1f, 0xff7e, 0xff7e, 0xfa5f, 0xff5e, 0xff1f, 0xff1f, 0xfe79, 0xfaff, 0xfeb5, 0xf2df, 0xff16, 0xe27f, 0xff97, 0xda7f, 0xce5f, 0xff97,
|
||||
0xbdff, 0xffbe, 0xda1f, 0xee3f, 0xffbe, 0xfa5f, 0xff7e, 0xfe7b, 0xff1f, 0xfe97, 0xfaff, 0xfeb5, 0xfed5, 0xff56, 0xeabf, 0xff97, 0xda7f, 0xff97, 0xff97,
|
||||
0xc9ff, 0xffbe, 0xda1f, 0xee3f, 0xff7e, 0xfa5f, 0xff7e, 0xfe7c, 0xff5e, 0xfe97, 0xfaff, 0xfed5, 0xff16, 0xff56, 0xeabf, 0xff97, 0xda7f, 0xda7f, 0xce5f,
|
||||
0xda1f, 0xda1f, 0xee3f, 0xee3f, 0xfa5f, 0xfe5e, 0xfe7c, 0xfe79, 0xfe79, 0xfe97, 0xfeb5, 0xfed5, 0xff16, 0xff56, 0xff97, 0xff97, 0xff97, 0xff97, 0xff97,
|
||||
0xda1f, 0xda1f, 0xee3f, 0xfa5f, 0xfe5e, 0xfe7c, 0xfe7b, 0xfe79, 0xfe97, 0xfeb5, 0xfed5, 0xff16, 0xff56, 0xff97, 0xff97, 0xff97, 0xff97, 0xff97, 0xff97,
|
||||
})},
|
||||
|
||||
{"30color-24bpp", video::ECF_R8G8B8, {
|
||||
0x71, 0xaf, 0xff, 0x71, 0xaf, 0xff, 0x71, 0xaf, 0xff, 0x71, 0xaf, 0xff, 0x7b, 0x8b, 0xff, 0x7a, 0x7f, 0xff, 0x90, 0x7f, 0xff, 0xb6, 0x85, 0xff, 0xd9, 0x8c, 0xff, 0xd9, 0x8c, 0xff, 0xf4, 0x92, 0xfe, 0xfe, 0x96, 0xf0, 0xfd, 0x99, 0xe3, 0xfd, 0x9b, 0xda, 0xfc, 0x9f, 0xca, 0xfc, 0xa4, 0xbc, 0xfb, 0xa9, 0xab, 0xfa, 0xb6, 0xad, 0xf9, 0xc6, 0xb1,
|
||||
0x71, 0xaf, 0xff, 0x71, 0xaf, 0xff, 0xff, 0xc6, 0xfc, 0xff, 0xc6, 0xfc, 0x7a, 0x7f, 0xff, 0xf7, 0xbe, 0xff, 0xe4, 0xb2, 0xfe, 0xd4, 0xa9, 0xff, 0xd9, 0x8c, 0xff, 0xc3, 0x98, 0xff, 0xb2, 0x9a, 0xff, 0xfe, 0x96, 0xf0, 0xfd, 0x9b, 0xda, 0x86, 0x93, 0xfe, 0x78, 0x9b, 0xff, 0x78, 0x9b, 0xff, 0xfb, 0xa9, 0xab, 0xfa, 0xb6, 0xad, 0xf8, 0xd2, 0xb3,
|
||||
0x71, 0xaf, 0xff, 0xfe, 0xdc, 0xf3, 0x78, 0x9b, 0xff, 0x86, 0x93, 0xfe, 0x7a, 0x7f, 0xff, 0xf7, 0xbe, 0xff, 0xb6, 0x85, 0xff, 0xe4, 0xb2, 0xfe, 0xd9, 0x8c, 0xff, 0xb2, 0x9a, 0xff, 0xfe, 0x96, 0xf0, 0x9a, 0x91, 0xff, 0xfc, 0x9f, 0xca, 0x9a, 0x91, 0xff, 0xfc, 0xa4, 0xbc, 0xfb, 0xa9, 0xab, 0xfa, 0xb6, 0xad, 0xf9, 0xc6, 0xb1, 0xf8, 0xd2, 0xb3,
|
||||
0x71, 0xaf, 0xff, 0xfe, 0xdc, 0xf3, 0x78, 0x9b, 0xff, 0x7a, 0x7f, 0xff, 0x90, 0x7f, 0xff, 0xf7, 0xbe, 0xff, 0xb6, 0x85, 0xff, 0xe4, 0xb2, 0xfe, 0xf4, 0x92, 0xfe, 0xd4, 0xa9, 0xff, 0xfe, 0x96, 0xf0, 0xb2, 0x9a, 0xff, 0xfc, 0x9f, 0xca, 0x9a, 0x91, 0xff, 0x86, 0x93, 0xfe, 0xfb, 0xa9, 0xab, 0xf9, 0xc6, 0xb1, 0xf9, 0xc6, 0xb1, 0xf8, 0xd8, 0xb5,
|
||||
0x71, 0xaf, 0xff, 0xfe, 0xdc, 0xf3, 0x86, 0x93, 0xfe, 0x7a, 0x7f, 0xff, 0x90, 0x7f, 0xff, 0xff, 0xc6, 0xfc, 0xb6, 0x85, 0xff, 0xe4, 0xb2, 0xfe, 0xf4, 0x92, 0xfe, 0xd4, 0xa9, 0xff, 0xfd, 0x99, 0xe3, 0xb2, 0x9a, 0xff, 0xfc, 0x9f, 0xca, 0x9a, 0x91, 0xff, 0xfb, 0xa9, 0xab, 0xfa, 0xb6, 0xad, 0xf9, 0xc6, 0xb1, 0xf8, 0xd2, 0xb3, 0xf8, 0xe4, 0xb9,
|
||||
0x71, 0xaf, 0xff, 0x78, 0x9b, 0xff, 0xfe, 0xdc, 0xf3, 0xff, 0xd0, 0xf7, 0xb6, 0x85, 0xff, 0xff, 0xc6, 0xfc, 0xf7, 0xbe, 0xff, 0xf7, 0xbe, 0xff, 0xf4, 0x92, 0xfe, 0xe4, 0xb2, 0xfe, 0xd4, 0xa9, 0xff, 0xfc, 0x9f, 0xca, 0xfc, 0xa4, 0xbc, 0xb2, 0x9a, 0xff, 0x9a, 0x91, 0xff, 0x9a, 0x91, 0xff, 0xf8, 0xd2, 0xb3, 0xf8, 0xd8, 0xb5, 0xf8, 0xe4, 0xb9,
|
||||
0x78, 0x9b, 0xff, 0x86, 0x93, 0xfe, 0x7a, 0x7f, 0xff, 0x90, 0x7f, 0xff, 0xb6, 0x85, 0xff, 0xb6, 0x85, 0xff, 0xd9, 0x8c, 0xff, 0xf4, 0x92, 0xfe, 0xf4, 0x92, 0xfe, 0xfd, 0x99, 0xe3, 0xfd, 0x9b, 0xda, 0xfc, 0x9f, 0xca, 0xfc, 0xa4, 0xbc, 0xfb, 0xa9, 0xab, 0xfa, 0xb6, 0xad, 0xfa, 0xb6, 0xad, 0xf8, 0xd8, 0xb5, 0xf8, 0xd8, 0xb5, 0xf8, 0xe4, 0xb9,
|
||||
0x78, 0x9b, 0xff, 0x7b, 0x8b, 0xff, 0x90, 0x7f, 0xff, 0x90, 0x7f, 0xff, 0xb6, 0x85, 0xff, 0xd9, 0x8c, 0xff, 0xd9, 0x8c, 0xff, 0xf4, 0x92, 0xfe, 0xfe, 0x96, 0xf0, 0xfd, 0x99, 0xe3, 0xfc, 0x9f, 0xca, 0xfc, 0xa4, 0xbc, 0xfc, 0xa4, 0xbc, 0xfb, 0xa9, 0xab, 0xf9, 0xc6, 0xb1, 0xf9, 0xc6, 0xb1, 0xf8, 0xd8, 0xb5, 0xf8, 0xe4, 0xb9, 0xf8, 0xe4, 0xb9,
|
||||
0x7b, 0x8b, 0xff, 0xff, 0xeb, 0xf2, 0x90, 0x7f, 0xff, 0xb6, 0x85, 0xff, 0xff, 0xd0, 0xf7, 0xd9, 0x8c, 0xff, 0xf4, 0x92, 0xfe, 0xff, 0xc6, 0xfc, 0xfd, 0x99, 0xe3, 0xfd, 0x9b, 0xda, 0xe4, 0xb2, 0xfe, 0xfc, 0xa4, 0xbc, 0xfb, 0xa9, 0xab, 0xfb, 0xa9, 0xab, 0xb2, 0x9a, 0xff, 0xf8, 0xd8, 0xb5, 0x9a, 0x91, 0xff, 0x7b, 0x8b, 0xff, 0x86, 0x93, 0xfe,
|
||||
0x7b, 0x8b, 0xff, 0xff, 0xeb, 0xf2, 0xff, 0xeb, 0xf2, 0xb6, 0x85, 0xff, 0xfe, 0xdc, 0xf3, 0xf4, 0x92, 0xfe, 0xff, 0xd0, 0xf7, 0xfe, 0x96, 0xf0, 0xff, 0xc6, 0xfc, 0xfc, 0x9f, 0xca, 0xe4, 0xb2, 0xfe, 0xe4, 0xb2, 0xfe, 0xfb, 0xa9, 0xab, 0xd4, 0xa9, 0xff, 0xb2, 0x9a, 0xff, 0xf8, 0xd8, 0xb5, 0x9a, 0x91, 0xff, 0xf8, 0xe4, 0xb9, 0xf8, 0xe4, 0xb9,
|
||||
0x7a, 0x7f, 0xff, 0xff, 0xeb, 0xf2, 0xb6, 0x85, 0xff, 0xfe, 0xdc, 0xf3, 0xfe, 0xdc, 0xf3, 0xf4, 0x92, 0xfe, 0xff, 0xd0, 0xf7, 0xff, 0xc6, 0xfc, 0xff, 0xc6, 0xfc, 0xfc, 0x9f, 0xca, 0xf7, 0xbe, 0xff, 0xfb, 0xa9, 0xab, 0xe4, 0xb2, 0xfe, 0xf9, 0xc6, 0xb1, 0xc3, 0x98, 0xff, 0xf8, 0xe4, 0xb9, 0xb2, 0x9a, 0xff, 0x9a, 0x91, 0xff, 0xf8, 0xe4, 0xb9,
|
||||
0x7a, 0x7f, 0xff, 0xff, 0xeb, 0xf2, 0xb6, 0x85, 0xff, 0xd9, 0x8c, 0xff, 0xff, 0xeb, 0xf2, 0xf4, 0x92, 0xfe, 0xfe, 0xdc, 0xf3, 0xfd, 0x9b, 0xda, 0xff, 0xc6, 0xfc, 0xfc, 0xa4, 0xbc, 0xf7, 0xbe, 0xff, 0xfb, 0xa9, 0xab, 0xfa, 0xb6, 0xad, 0xf8, 0xd2, 0xb3, 0xd4, 0xa9, 0xff, 0xf8, 0xe4, 0xb9, 0xb2, 0x9a, 0xff, 0xf8, 0xe4, 0xb9, 0xf8, 0xe4, 0xb9,
|
||||
0x90, 0x7f, 0xff, 0xff, 0xeb, 0xf2, 0xb6, 0x85, 0xff, 0xd9, 0x8c, 0xff, 0xfe, 0xdc, 0xf3, 0xf4, 0x92, 0xfe, 0xfe, 0xdc, 0xf3, 0xfd, 0x99, 0xe3, 0xff, 0xd0, 0xf7, 0xfc, 0xa4, 0xbc, 0xf7, 0xbe, 0xff, 0xfa, 0xb6, 0xad, 0xf9, 0xc6, 0xb1, 0xf8, 0xd2, 0xb3, 0xd4, 0xa9, 0xff, 0xf8, 0xe4, 0xb9, 0xb2, 0x9a, 0xff, 0xb2, 0x9a, 0xff, 0x9a, 0x91, 0xff,
|
||||
0xb6, 0x85, 0xff, 0xb6, 0x85, 0xff, 0xd9, 0x8c, 0xff, 0xd9, 0x8c, 0xff, 0xf4, 0x92, 0xfe, 0xfe, 0x96, 0xf0, 0xfd, 0x99, 0xe3, 0xfc, 0x9f, 0xca, 0xfc, 0x9f, 0xca, 0xfc, 0xa4, 0xbc, 0xfb, 0xa9, 0xab, 0xfa, 0xb6, 0xad, 0xf9, 0xc6, 0xb1, 0xf8, 0xd2, 0xb3, 0xf8, 0xe4, 0xb9, 0xf8, 0xe4, 0xb9, 0xf8, 0xe4, 0xb9, 0xf8, 0xe4, 0xb9, 0xf8, 0xe4, 0xb9,
|
||||
0xb6, 0x85, 0xff, 0xb6, 0x85, 0xff, 0xd9, 0x8c, 0xff, 0xf4, 0x92, 0xfe, 0xfe, 0x96, 0xf0, 0xfd, 0x99, 0xe3, 0xfd, 0x9b, 0xda, 0xfc, 0x9f, 0xca, 0xfc, 0xa4, 0xbc, 0xfb, 0xa9, 0xab, 0xfa, 0xb6, 0xad, 0xf9, 0xc6, 0xb1, 0xf8, 0xd2, 0xb3, 0xf8, 0xe4, 0xb9, 0xf8, 0xe4, 0xb9, 0xf8, 0xe4, 0xb9, 0xf8, 0xe4, 0xb9, 0xf8, 0xe4, 0xb9, 0xf8, 0xe4, 0xb9,
|
||||
}},
|
||||
|
||||
{"30color-32bpp", video::ECF_A8R8G8B8, to_byte_array<u32>({
|
||||
0xff71afff, 0xff71afff, 0xff71afff, 0xff71afff, 0xff7b8bff, 0xff7a7fff, 0xff907fff, 0xffb685ff, 0xffd98cff, 0xffd98cff, 0xfff492fe, 0xfffe96f0, 0xfffd99e3, 0xfffd9bda, 0xfffc9fca, 0xfffca4bc, 0xfffba9ab, 0xfffab6ad, 0xfff9c6b1,
|
||||
0xff71afff, 0xff71afff, 0xffffc6fc, 0xffffc6fc, 0xff7a7fff, 0xfff7beff, 0xffe4b2fe, 0xffd4a9ff, 0xffd98cff, 0xffc398ff, 0xffb29aff, 0xfffe96f0, 0xfffd9bda, 0xff8693fe, 0xff789bff, 0xff789bff, 0xfffba9ab, 0xfffab6ad, 0xfff8d2b3,
|
||||
0xff71afff, 0xfffedcf3, 0xff789bff, 0xff8693fe, 0xff7a7fff, 0xfff7beff, 0xffb685ff, 0xffe4b2fe, 0xffd98cff, 0xffb29aff, 0xfffe96f0, 0xff9a91ff, 0xfffc9fca, 0xff9a91ff, 0xfffca4bc, 0xfffba9ab, 0xfffab6ad, 0xfff9c6b1, 0xfff8d2b3,
|
||||
0xff71afff, 0xfffedcf3, 0xff789bff, 0xff7a7fff, 0xff907fff, 0xfff7beff, 0xffb685ff, 0xffe4b2fe, 0xfff492fe, 0xffd4a9ff, 0xfffe96f0, 0xffb29aff, 0xfffc9fca, 0xff9a91ff, 0xff8693fe, 0xfffba9ab, 0xfff9c6b1, 0xfff9c6b1, 0xfff8d8b5,
|
||||
0xff71afff, 0xfffedcf3, 0xff8693fe, 0xff7a7fff, 0xff907fff, 0xffffc6fc, 0xffb685ff, 0xffe4b2fe, 0xfff492fe, 0xffd4a9ff, 0xfffd99e3, 0xffb29aff, 0xfffc9fca, 0xff9a91ff, 0xfffba9ab, 0xfffab6ad, 0xfff9c6b1, 0xfff8d2b3, 0xfff8e4b9,
|
||||
0xff71afff, 0xff789bff, 0xfffedcf3, 0xffffd0f7, 0xffb685ff, 0xffffc6fc, 0xfff7beff, 0xfff7beff, 0xfff492fe, 0xffe4b2fe, 0xffd4a9ff, 0xfffc9fca, 0xfffca4bc, 0xffb29aff, 0xff9a91ff, 0xff9a91ff, 0xfff8d2b3, 0xfff8d8b5, 0xfff8e4b9,
|
||||
0xff789bff, 0xff8693fe, 0xff7a7fff, 0xff907fff, 0xffb685ff, 0xffb685ff, 0xffd98cff, 0xfff492fe, 0xfff492fe, 0xfffd99e3, 0xfffd9bda, 0xfffc9fca, 0xfffca4bc, 0xfffba9ab, 0xfffab6ad, 0xfffab6ad, 0xfff8d8b5, 0xfff8d8b5, 0xfff8e4b9,
|
||||
0xff789bff, 0xff7b8bff, 0xff907fff, 0xff907fff, 0xffb685ff, 0xffd98cff, 0xffd98cff, 0xfff492fe, 0xfffe96f0, 0xfffd99e3, 0xfffc9fca, 0xfffca4bc, 0xfffca4bc, 0xfffba9ab, 0xfff9c6b1, 0xfff9c6b1, 0xfff8d8b5, 0xfff8e4b9, 0xfff8e4b9,
|
||||
0xff7b8bff, 0xffffebf2, 0xff907fff, 0xffb685ff, 0xffffd0f7, 0xffd98cff, 0xfff492fe, 0xffffc6fc, 0xfffd99e3, 0xfffd9bda, 0xffe4b2fe, 0xfffca4bc, 0xfffba9ab, 0xfffba9ab, 0xffb29aff, 0xfff8d8b5, 0xff9a91ff, 0xff7b8bff, 0xff8693fe,
|
||||
0xff7b8bff, 0xffffebf2, 0xffffebf2, 0xffb685ff, 0xfffedcf3, 0xfff492fe, 0xffffd0f7, 0xfffe96f0, 0xffffc6fc, 0xfffc9fca, 0xffe4b2fe, 0xffe4b2fe, 0xfffba9ab, 0xffd4a9ff, 0xffb29aff, 0xfff8d8b5, 0xff9a91ff, 0xfff8e4b9, 0xfff8e4b9,
|
||||
0xff7a7fff, 0xffffebf2, 0xffb685ff, 0xfffedcf3, 0xfffedcf3, 0xfff492fe, 0xffffd0f7, 0xffffc6fc, 0xffffc6fc, 0xfffc9fca, 0xfff7beff, 0xfffba9ab, 0xffe4b2fe, 0xfff9c6b1, 0xffc398ff, 0xfff8e4b9, 0xffb29aff, 0xff9a91ff, 0xfff8e4b9,
|
||||
0xff7a7fff, 0xffffebf2, 0xffb685ff, 0xffd98cff, 0xffffebf2, 0xfff492fe, 0xfffedcf3, 0xfffd9bda, 0xffffc6fc, 0xfffca4bc, 0xfff7beff, 0xfffba9ab, 0xfffab6ad, 0xfff8d2b3, 0xffd4a9ff, 0xfff8e4b9, 0xffb29aff, 0xfff8e4b9, 0xfff8e4b9,
|
||||
0xff907fff, 0xffffebf2, 0xffb685ff, 0xffd98cff, 0xfffedcf3, 0xfff492fe, 0xfffedcf3, 0xfffd99e3, 0xffffd0f7, 0xfffca4bc, 0xfff7beff, 0xfffab6ad, 0xfff9c6b1, 0xfff8d2b3, 0xffd4a9ff, 0xfff8e4b9, 0xffb29aff, 0xffb29aff, 0xff9a91ff,
|
||||
0xffb685ff, 0xffb685ff, 0xffd98cff, 0xffd98cff, 0xfff492fe, 0xfffe96f0, 0xfffd99e3, 0xfffc9fca, 0xfffc9fca, 0xfffca4bc, 0xfffba9ab, 0xfffab6ad, 0xfff9c6b1, 0xfff8d2b3, 0xfff8e4b9, 0xfff8e4b9, 0xfff8e4b9, 0xfff8e4b9, 0xfff8e4b9,
|
||||
0xffb685ff, 0xffb685ff, 0xffd98cff, 0xfff492fe, 0xfffe96f0, 0xfffd99e3, 0xfffd9bda, 0xfffc9fca, 0xfffca4bc, 0xfffba9ab, 0xfffab6ad, 0xfff9c6b1, 0xfff8d2b3, 0xfff8e4b9, 0xfff8e4b9, 0xfff8e4b9, 0xfff8e4b9, 0xfff8e4b9, 0xfff8e4b9,
|
||||
})},
|
||||
|
||||
};
|
||||
|
||||
void printImageBytes(const video::IImage *img)
|
||||
{
|
||||
const auto *data = (u8 *)img->getData();
|
||||
const auto w = img->getPitch();
|
||||
const auto h = img->getDimension().Height;
|
||||
for (int y = 0; y < h; y++) {
|
||||
for (int k = 0; k < w; k++) {
|
||||
std::printf("0x%02x, ", *data++);
|
||||
}
|
||||
std::printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
try {
|
||||
if (argc != 3)
|
||||
throw std::runtime_error("Invalid arguments. Expected sample ID and image file name");
|
||||
|
||||
const ImageDesc *sample = nullptr;
|
||||
for (auto &&image : test_images) {
|
||||
if (strcmp(argv[1], image.name) == 0)
|
||||
sample = ℑ
|
||||
}
|
||||
if (!sample)
|
||||
throw std::runtime_error("Sample not found");
|
||||
|
||||
SIrrlichtCreationParameters p;
|
||||
p.DriverType = video::EDT_NULL;
|
||||
p.WindowSize = core::dimension2du(640, 480);
|
||||
p.LoggingLevel = ELL_DEBUG;
|
||||
|
||||
auto *device = createDeviceEx(p);
|
||||
if (!device)
|
||||
throw std::runtime_error("Failed to create device");
|
||||
|
||||
auto *driver = device->getVideoDriver();
|
||||
|
||||
auto *img = driver->createImageFromFile(argv[2]);
|
||||
if (!img)
|
||||
throw std::runtime_error("Failed to load image");
|
||||
|
||||
if (img->getDimension() != core::dimension2du{19, 15})
|
||||
throw std::runtime_error("Wrong image dimensions");
|
||||
|
||||
if (img->getColorFormat() != sample->format)
|
||||
throw std::runtime_error("Wrong image format");
|
||||
|
||||
if (img->getImageDataSizeInBytes() != sample->data.size())
|
||||
throw std::logic_error("Image data size not equal to sample size");
|
||||
|
||||
if (memcmp(img->getData(), sample->data.data(), sample->data.size()) != 0) {
|
||||
printImageBytes(img);
|
||||
throw std::runtime_error("Wrong image contents");
|
||||
}
|
||||
|
||||
img->drop();
|
||||
device->drop();
|
||||
|
||||
return 0;
|
||||
} catch (const std::exception &e) {
|
||||
std::printf("Test failed: %s\n", e.what());
|
||||
return 1;
|
||||
}
|
||||
@@ -149,6 +149,6 @@
|
||||
<update_contact>celeron55@gmail.com</update_contact>
|
||||
|
||||
<releases>
|
||||
<release date="2024-08-11" version="5.9.0"/>
|
||||
<release date="2024-09-08" version="5.9.1"/>
|
||||
</releases>
|
||||
</component>
|
||||
|
||||
@@ -96,6 +96,9 @@ struct BoneOverride
|
||||
{
|
||||
core::quaternion previous;
|
||||
core::quaternion next;
|
||||
// Redundantly store the euler angles serverside
|
||||
// so that we can return them in the appropriate getters
|
||||
v3f next_radians;
|
||||
bool absolute = false;
|
||||
f32 interp_timer = 0;
|
||||
} rotation;
|
||||
|
||||
@@ -133,8 +133,8 @@ class Clouds : public scene::ISceneNode
|
||||
{
|
||||
float height_bs = m_params.height * BS;
|
||||
float thickness_bs = m_params.thickness * BS;
|
||||
m_box = aabb3f(-BS * 1000000.0f, height_bs - BS * m_camera_offset.Y, -BS * 1000000.0f,
|
||||
BS * 1000000.0f, height_bs + thickness_bs - BS * m_camera_offset.Y, BS * 1000000.0f);
|
||||
m_box = aabb3f(-BS * 1000000.0f, height_bs, -BS * 1000000.0f,
|
||||
BS * 1000000.0f, height_bs + thickness_bs, BS * 1000000.0f);
|
||||
}
|
||||
|
||||
void updateMesh();
|
||||
|
||||
@@ -817,18 +817,6 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
||||
<<"\" not supported"<<std::endl;
|
||||
}
|
||||
|
||||
/* Set VBO hint */
|
||||
// - if shaders are disabled we modify the mesh often
|
||||
// - sprites are also modified often
|
||||
// - the wieldmesh sets its own hint
|
||||
// - bone transformations do not need to modify the vertex data
|
||||
if (m_enable_shaders && (m_meshnode || m_animated_meshnode)) {
|
||||
if (m_meshnode)
|
||||
m_meshnode->getMesh()->setHardwareMappingHint(scene::EHM_STATIC);
|
||||
if (m_animated_meshnode)
|
||||
m_animated_meshnode->getMesh()->setHardwareMappingHint(scene::EHM_STATIC);
|
||||
}
|
||||
|
||||
/* don't update while punch texture modifier is active */
|
||||
if (m_reset_textures_timer < 0)
|
||||
updateTextures(m_current_texture_modifier);
|
||||
@@ -1267,6 +1255,16 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
|
||||
}
|
||||
}
|
||||
|
||||
static void setMeshBufferTextureCoords(scene::IMeshBuffer *buf, const v2f *uv, u32 count)
|
||||
{
|
||||
assert(buf->getVertexType() == video::EVT_STANDARD);
|
||||
assert(buf->getVertexCount() == count);
|
||||
auto *vertices = static_cast<video::S3DVertex *>(buf->getVertices());
|
||||
for (u32 i = 0; i < count; i++)
|
||||
vertices[i].TCoords = uv[i];
|
||||
buf->setDirty(scene::EBT_VERTEX);
|
||||
}
|
||||
|
||||
void GenericCAO::updateTexturePos()
|
||||
{
|
||||
if(m_spritenode)
|
||||
@@ -1526,9 +1524,8 @@ void GenericCAO::updateAnimation()
|
||||
if (!m_animated_meshnode)
|
||||
return;
|
||||
|
||||
if (m_animated_meshnode->getStartFrame() != m_animation_range.X ||
|
||||
m_animated_meshnode->getEndFrame() != m_animation_range.Y)
|
||||
m_animated_meshnode->setFrameLoop(m_animation_range.X, m_animation_range.Y);
|
||||
// Note: This sets the current frame as well, (re)starting the animation.
|
||||
m_animated_meshnode->setFrameLoop(m_animation_range.X, m_animation_range.Y);
|
||||
if (m_animated_meshnode->getAnimationSpeed() != m_animation_speed)
|
||||
m_animated_meshnode->setAnimationSpeed(m_animation_speed);
|
||||
m_animated_meshnode->setTransitionTime(m_animation_blend);
|
||||
|
||||
@@ -1446,7 +1446,7 @@ void Game::copyServerClientCache()
|
||||
{
|
||||
// It would be possible to let the client directly read the media files
|
||||
// from where the server knows they are. But aside from being more complicated
|
||||
// it would also *not* fill the media cache and cause slower joining of
|
||||
// it would also *not* fill the media cache and cause slower joining of
|
||||
// remote servers.
|
||||
// (Imagine that you launch a game once locally and then connect to a server.)
|
||||
|
||||
@@ -3349,8 +3349,12 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud)
|
||||
infostream << "Pointing at " << pointed.dump() << std::endl;
|
||||
|
||||
if (g_touchscreengui) {
|
||||
auto mode = selected_def.touch_interaction.getMode(pointed.type);
|
||||
auto mode = selected_def.touch_interaction.getMode(selected_def, pointed.type);
|
||||
g_touchscreengui->applyContextControls(mode);
|
||||
// applyContextControls may change dig/place input.
|
||||
// Update again so that TOSERVER_INTERACT packets have the correct controls set.
|
||||
player->control.dig = isKeyDown(KeyType::DIG);
|
||||
player->control.place = isKeyDown(KeyType::PLACE);
|
||||
}
|
||||
|
||||
// Note that updating the selection mesh every frame is not particularly efficient,
|
||||
|
||||
@@ -139,7 +139,6 @@ Hud::Hud(Client *client, LocalPlayer *player,
|
||||
|
||||
m_rotation_mesh_buffer.getMaterial().Lighting = false;
|
||||
m_rotation_mesh_buffer.getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
m_rotation_mesh_buffer.setHardwareMappingHint(scene::EHM_STATIC);
|
||||
}
|
||||
|
||||
void Hud::readScalingSetting()
|
||||
@@ -544,14 +543,21 @@ void Hud::drawLuaElements(const v3s16 &camera_offset)
|
||||
}
|
||||
break; }
|
||||
case HUD_ELEM_MINIMAP: {
|
||||
if (e->size.X <= 0 || e->size.Y <= 0)
|
||||
break;
|
||||
if (!client->getMinimap())
|
||||
break;
|
||||
// Draw a minimap of size "size"
|
||||
v2s32 dstsize(e->size.X * m_scale_factor,
|
||||
e->size.Y * m_scale_factor);
|
||||
// (no percent size as minimap would likely be anamorphosed)
|
||||
|
||||
// Only one percentage is supported to avoid distortion.
|
||||
if (e->size.X < 0)
|
||||
dstsize.X = dstsize.Y = m_screensize.X * (e->size.X * -0.01);
|
||||
else if (e->size.Y < 0)
|
||||
dstsize.X = dstsize.Y = m_screensize.Y * (e->size.Y * -0.01);
|
||||
|
||||
if (dstsize.X <= 0 || dstsize.Y <= 0)
|
||||
return;
|
||||
|
||||
v2s32 offset((e->align.X - 1.0) * dstsize.X / 2,
|
||||
(e->align.Y - 1.0) * dstsize.Y / 2);
|
||||
core::rect<s32> rect(0, 0, dstsize.X, dstsize.Y);
|
||||
|
||||
@@ -360,7 +360,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
|
||||
collisionMoveResult result = collisionMoveSimple(env, m_client,
|
||||
pos_max_d, m_collisionbox, player_stepheight, dtime,
|
||||
&position, &m_speed, accel_f);
|
||||
&position, &m_speed, accel_f, m_cao);
|
||||
|
||||
bool could_sneak = control.sneak && !free_move && !in_liquid &&
|
||||
!is_climbing && physics_override.sneak;
|
||||
@@ -444,7 +444,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
v3f check_pos = position;
|
||||
check_pos.Y += y_diff * dtime * 22.0f + BS * 0.01f;
|
||||
if (y_diff < BS * 0.6f || (physics_override.sneak_glitch
|
||||
&& !collision_check_intersection(env, m_client, m_collisionbox, check_pos))) {
|
||||
&& !collision_check_intersection(env, m_client, m_collisionbox, check_pos, m_cao))) {
|
||||
// Smoothen the movement (based on 'position.Y = bmax.Y')
|
||||
position.Y = std::min(check_pos.Y, bmax.Y);
|
||||
m_speed.Y = 0.0f;
|
||||
@@ -990,7 +990,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
|
||||
collisionMoveResult result = collisionMoveSimple(env, m_client,
|
||||
pos_max_d, m_collisionbox, player_stepheight, dtime,
|
||||
&position, &m_speed, accel_f);
|
||||
&position, &m_speed, accel_f, m_cao);
|
||||
|
||||
// Position was slightly changed; update standing node pos
|
||||
if (touching_ground)
|
||||
@@ -1254,7 +1254,7 @@ void LocalPlayer::handleAutojump(f32 dtime, Environment *env,
|
||||
|
||||
// try at peak of jump, zero step height
|
||||
collisionMoveResult jump_result = collisionMoveSimple(env, m_client, pos_max_d,
|
||||
m_collisionbox, 0.0f, dtime, &jump_pos, &jump_speed, v3f(0.0f));
|
||||
m_collisionbox, 0.0f, dtime, &jump_pos, &jump_speed, v3f(0.0f), m_cao);
|
||||
|
||||
// see if we can get a little bit farther horizontally if we had
|
||||
// jumped
|
||||
|
||||
@@ -783,12 +783,15 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
|
||||
}
|
||||
|
||||
if (mesh) {
|
||||
// Use VBO for mesh (this just would set this for ever buffer)
|
||||
// Use VBO for mesh (this just would set this for every buffer)
|
||||
mesh->setHardwareMappingHint(scene::EHM_STATIC);
|
||||
}
|
||||
}
|
||||
|
||||
//std::cout<<"added "<<fastfaces.getSize()<<" faces."<<std::endl;
|
||||
// Transparent parts have changing indices
|
||||
for (auto &it : m_transparent_triangles)
|
||||
it.buffer->setHardwareMappingHint(scene::EHM_STREAM, scene::EBT_INDEX);
|
||||
|
||||
m_bsp_tree.buildTree(&m_transparent_triangles, data->side_length);
|
||||
|
||||
// Check if animation is required for this mesh
|
||||
|
||||
@@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
*/
|
||||
|
||||
#include "mesh.h"
|
||||
#include "S3DVertex.h"
|
||||
#include "debug.h"
|
||||
#include "log.h"
|
||||
#include <cmath>
|
||||
@@ -197,15 +198,6 @@ void setMeshColor(scene::IMesh *mesh, const video::SColor &color)
|
||||
setMeshBufferColor(mesh->getMeshBuffer(j), color);
|
||||
}
|
||||
|
||||
void setMeshBufferTextureCoords(scene::IMeshBuffer *buf, const v2f *uv, u32 count)
|
||||
{
|
||||
const u32 stride = getVertexPitchFromType(buf->getVertexType());
|
||||
assert(buf->getVertexCount() >= count);
|
||||
u8 *vertices = (u8 *) buf->getVertices();
|
||||
for (u32 i = 0; i < count; i++)
|
||||
((video::S3DVertex*) (vertices + i * stride))->TCoords = uv[i];
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
static void applyToMesh(scene::IMesh *mesh, const F &fn)
|
||||
{
|
||||
|
||||
@@ -59,13 +59,6 @@ void setMeshBufferColor(scene::IMeshBuffer *buf, const video::SColor &color);
|
||||
*/
|
||||
void setMeshColor(scene::IMesh *mesh, const video::SColor &color);
|
||||
|
||||
|
||||
/*
|
||||
Sets texture coords for vertices in the mesh buffer.
|
||||
`uv[]` must have `count` elements
|
||||
*/
|
||||
void setMeshBufferTextureCoords(scene::IMeshBuffer *buf, const v2f *uv, u32 count);
|
||||
|
||||
/*
|
||||
Set a constant color for an animated mesh
|
||||
*/
|
||||
|
||||
@@ -571,7 +571,6 @@ scene::SMeshBuffer *Minimap::getMinimapMeshBuffer()
|
||||
buf->Indices[4] = 3;
|
||||
buf->Indices[5] = 0;
|
||||
|
||||
buf->setHardwareMappingHint(scene::EHM_STATIC);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ class MainShaderConstantSetter : public IShaderConstantSetter
|
||||
m_world_view_proj.set(worldViewProj, services);
|
||||
|
||||
if (driver->getDriverType() == video::EDT_OGLES2 || driver->getDriverType() == video::EDT_OPENGL3) {
|
||||
core::matrix4 texture = driver->getTransform(video::ETS_TEXTURE_0);
|
||||
auto &texture = driver->getTransform(video::ETS_TEXTURE_0);
|
||||
m_world_view.set(worldView, services);
|
||||
m_texture.set(texture, services);
|
||||
}
|
||||
@@ -573,6 +573,7 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
|
||||
} else {
|
||||
shaders_header << "#version 100\n";
|
||||
}
|
||||
// cf. EVertexAttributes.h for the predefined ones
|
||||
vertex_header = R"(
|
||||
precision mediump float;
|
||||
|
||||
@@ -582,7 +583,7 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
|
||||
|
||||
attribute highp vec4 inVertexPosition;
|
||||
attribute lowp vec4 inVertexColor;
|
||||
attribute mediump vec4 inTexCoord0;
|
||||
attribute mediump vec2 inTexCoord0;
|
||||
attribute mediump vec3 inVertexNormal;
|
||||
attribute mediump vec4 inVertexTangent;
|
||||
attribute mediump vec4 inVertexBinormal;
|
||||
|
||||
@@ -29,6 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "filesys.h"
|
||||
#include "porting.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace sound {
|
||||
|
||||
void OpenALSoundManager::stepStreams(f32 dtime)
|
||||
@@ -347,6 +349,13 @@ void OpenALSoundManager::updateListener(const v3f &pos_, const v3f &vel_,
|
||||
|
||||
void OpenALSoundManager::setListenerGain(f32 gain)
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
/* macOS OpenAL implementation ignore setting AL_GAIN to zero
|
||||
* so we use smallest possible value
|
||||
*/
|
||||
if (gain == 0.0f)
|
||||
gain = std::numeric_limits<f32>::min();
|
||||
#endif
|
||||
alListenerf(AL_GAIN, gain);
|
||||
}
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ static void add_object_boxes(Environment *env,
|
||||
const v3f pos_f, const v3f speed_f, ActiveObject *self,
|
||||
std::vector<NearbyCollisionInfo> &cinfo)
|
||||
{
|
||||
auto process_object = [&] (ActiveObject *object) {
|
||||
auto process_object = [&cinfo] (ActiveObject *object) {
|
||||
if (object && object->collideWithObjects()) {
|
||||
aabb3f box;
|
||||
if (object->getCollisionBox(&box))
|
||||
@@ -292,7 +292,7 @@ static void add_object_boxes(Environment *env,
|
||||
c_env->getActiveObjects(pos_f, distance, clientobjects);
|
||||
|
||||
for (auto &clientobject : clientobjects) {
|
||||
// Do collide with everything but itself and the parent CAO
|
||||
// Do collide with everything but itself and children
|
||||
if (!self || (self != clientobject.obj &&
|
||||
self != clientobject.obj->getParent())) {
|
||||
process_object(clientobject.obj);
|
||||
@@ -301,12 +301,12 @@ static void add_object_boxes(Environment *env,
|
||||
|
||||
// add collision with local player
|
||||
LocalPlayer *lplayer = c_env->getLocalPlayer();
|
||||
if (lplayer->getParent() == nullptr) {
|
||||
auto *obj = (ClientActiveObject*) lplayer->getCAO();
|
||||
if (!self || (self != obj && self != obj->getParent())) {
|
||||
aabb3f lplayer_collisionbox = lplayer->getCollisionbox();
|
||||
v3f lplayer_pos = lplayer->getPosition();
|
||||
lplayer_collisionbox.MinEdge += lplayer_pos;
|
||||
lplayer_collisionbox.MaxEdge += lplayer_pos;
|
||||
auto *obj = (ActiveObject*) lplayer->getCAO();
|
||||
cinfo.emplace_back(obj, 0, lplayer_collisionbox);
|
||||
}
|
||||
}
|
||||
@@ -315,7 +315,7 @@ static void add_object_boxes(Environment *env,
|
||||
{
|
||||
ServerEnvironment *s_env = dynamic_cast<ServerEnvironment*>(env);
|
||||
if (s_env) {
|
||||
// search for objects which are not us, or we are not its parent.
|
||||
// search for objects which are not us and not our children.
|
||||
// we directly process the object in this callback to avoid useless
|
||||
// looping afterwards.
|
||||
auto include_obj_cb = [self, &process_object] (ServerActiveObject *obj) {
|
||||
@@ -623,8 +623,10 @@ bool collision_check_intersection(Environment *env, IGameDef *gamedef,
|
||||
Collision detection
|
||||
*/
|
||||
aabb3f checkbox = box_0;
|
||||
checkbox.MinEdge += pos_f;
|
||||
checkbox.MaxEdge += pos_f;
|
||||
// aabbox3d::intersectsWithBox(box) returns true when the faces are touching perfectly.
|
||||
// However, we do not want want a true-ish return value in that case. Add some tolerance.
|
||||
checkbox.MinEdge += pos_f + (0.1f * BS);
|
||||
checkbox.MaxEdge += pos_f - (0.1f * BS);
|
||||
|
||||
/*
|
||||
Go through every node and object box
|
||||
|
||||
@@ -65,7 +65,8 @@ struct collisionMoveResult
|
||||
std::vector<CollisionInfo> collisions;
|
||||
};
|
||||
|
||||
// Moves using a single iteration; speed should not exceed pos_max_d/dtime
|
||||
/// @brief Moves using a single iteration; speed should not exceed pos_max_d/dtime
|
||||
/// @param self (optional) ActiveObject to ignore in the collision detection.
|
||||
collisionMoveResult collisionMoveSimple(Environment *env,IGameDef *gamedef,
|
||||
f32 pos_max_d, const aabb3f &box_0,
|
||||
f32 stepheight, f32 dtime,
|
||||
@@ -73,7 +74,11 @@ collisionMoveResult collisionMoveSimple(Environment *env,IGameDef *gamedef,
|
||||
v3f accel_f, ActiveObject *self=NULL,
|
||||
bool collide_with_objects=true);
|
||||
|
||||
// check if box is in collision on actual position
|
||||
/// @brief A simpler version of "collisionMoveSimple" that only checks whether
|
||||
/// a collision occurs at the given position.
|
||||
/// @param self (optional) ActiveObject to ignore in the collision detection.
|
||||
/// @returns `true` when `box_0` truly intersects with a node or object.
|
||||
/// Touching faces are not counted as intersection.
|
||||
bool collision_check_intersection(Environment *env, IGameDef *gamedef,
|
||||
const aabb3f &box_0, const v3f &pos_f, ActiveObject *self = nullptr,
|
||||
bool collide_with_objects = true);
|
||||
|
||||
@@ -76,13 +76,6 @@ static bool detect_touch()
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
#elif defined(_WIN32)
|
||||
// 0x01 The device has an integrated touch digitizer
|
||||
// 0x80 The device is ready to receive digitizer input.
|
||||
if ((GetSystemMetrics(SM_DIGITIZER) & 0x81) == 0x81)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
#else
|
||||
// we don't know, return default
|
||||
|
||||
@@ -1046,7 +1046,6 @@ void CGUITTFont::createSharedPlane()
|
||||
buf->append(vertices, 4, indices, 6);
|
||||
|
||||
shared_plane_.addMeshBuffer( buf );
|
||||
shared_plane_.setHardwareMappingHint(EHM_STATIC);
|
||||
|
||||
shared_plane_ptr_ = &shared_plane_;
|
||||
buf->drop(); //the addMeshBuffer method will grab it, so we can drop this ptr.
|
||||
|
||||
@@ -45,7 +45,8 @@ TouchInteraction::TouchInteraction()
|
||||
pointed_object = TouchInteractionMode_USER;
|
||||
}
|
||||
|
||||
TouchInteractionMode TouchInteraction::getMode(PointedThingType pointed_type) const
|
||||
TouchInteractionMode TouchInteraction::getMode(const ItemDefinition &selected_def,
|
||||
PointedThingType pointed_type) const
|
||||
{
|
||||
TouchInteractionMode result;
|
||||
switch (pointed_type) {
|
||||
@@ -63,7 +64,9 @@ TouchInteractionMode TouchInteraction::getMode(PointedThingType pointed_type) co
|
||||
}
|
||||
|
||||
if (result == TouchInteractionMode_USER) {
|
||||
if (pointed_type == POINTEDTHING_OBJECT)
|
||||
if (pointed_type == POINTEDTHING_OBJECT && !selected_def.usable)
|
||||
// Only apply when we're actually able to punch the object, i.e. when
|
||||
// the selected item has no on_use callback defined.
|
||||
result = g_settings->get("touch_punch_gesture") == "long_tap" ?
|
||||
LONG_DIG_SHORT_PLACE : SHORT_DIG_LONG_PLACE;
|
||||
else
|
||||
|
||||
@@ -71,7 +71,8 @@ struct TouchInteraction
|
||||
TouchInteraction();
|
||||
// Returns the right mode for the pointed thing and resolves any occurrence
|
||||
// of TouchInteractionMode_USER into an actual mode.
|
||||
TouchInteractionMode getMode(PointedThingType pointed_type) const;
|
||||
TouchInteractionMode getMode(const ItemDefinition &selected_def,
|
||||
PointedThingType pointed_type) const;
|
||||
void serialize(std::ostream &os) const;
|
||||
void deSerialize(std::istream &is);
|
||||
};
|
||||
|
||||
@@ -531,7 +531,6 @@ static bool setup_log_params(const Settings &cmd_args)
|
||||
if (cmd_args.getFlag("trace")) {
|
||||
dstream << _("Enabling trace level debug output") << std::endl;
|
||||
g_logger.addOutput(&stderr_output, LL_TRACE);
|
||||
socket_enable_debug_output = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -739,18 +739,19 @@ void Channel::UpdateTimers(float dtime)
|
||||
if (packet_loss_counter > 1.0f) {
|
||||
packet_loss_counter -= 1.0f;
|
||||
|
||||
unsigned int packet_loss = 11; /* use a neutral value for initialization */
|
||||
unsigned int packets_successful = 0;
|
||||
//unsigned int packet_too_late = 0;
|
||||
unsigned int packet_loss;
|
||||
unsigned int packets_successful;
|
||||
unsigned int packet_too_late;
|
||||
|
||||
bool reasonable_amount_of_data_transmitted = false;
|
||||
|
||||
{
|
||||
MutexAutoLock internal(m_internal_mutex);
|
||||
packet_loss = current_packet_loss;
|
||||
//packet_too_late = current_packet_too_late;
|
||||
packet_too_late = current_packet_too_late;
|
||||
packets_successful = current_packet_successful;
|
||||
|
||||
// has half the window even been used?
|
||||
if (current_bytes_transfered > (unsigned int) (m_window_size*512/2)) {
|
||||
reasonable_amount_of_data_transmitted = true;
|
||||
}
|
||||
@@ -759,6 +760,11 @@ void Channel::UpdateTimers(float dtime)
|
||||
current_packet_successful = 0;
|
||||
}
|
||||
|
||||
// Packets too late means either packet duplication along the way
|
||||
// or we were too fast in resending it (which should be self-regulating).
|
||||
// Count this a signal of congestion, like packet loss.
|
||||
packet_loss = std::min(packet_loss + packet_too_late, packets_successful);
|
||||
|
||||
/* dynamic window size */
|
||||
float successful_to_lost_ratio = 0.0f;
|
||||
bool done = false;
|
||||
@@ -989,19 +995,27 @@ bool UDPPeer::isTimedOut(float timeout, std::string &reason)
|
||||
|
||||
void UDPPeer::reportRTT(float rtt)
|
||||
{
|
||||
if (rtt < 0.0) {
|
||||
if (rtt < 0)
|
||||
return;
|
||||
}
|
||||
RTTStatistics(rtt,"rudp",MAX_RELIABLE_WINDOW_SIZE*10);
|
||||
|
||||
// use this value to decide the resend timeout
|
||||
float timeout = getStat(AVG_RTT) * RESEND_TIMEOUT_FACTOR;
|
||||
const float rtt_stat = getStat(AVG_RTT);
|
||||
if (rtt_stat < 0)
|
||||
return;
|
||||
float timeout = rtt_stat * RESEND_TIMEOUT_FACTOR;
|
||||
if (timeout < RESEND_TIMEOUT_MIN)
|
||||
timeout = RESEND_TIMEOUT_MIN;
|
||||
if (timeout > RESEND_TIMEOUT_MAX)
|
||||
timeout = RESEND_TIMEOUT_MAX;
|
||||
|
||||
float timeout_old = getResendTimeout();
|
||||
setResendTimeout(timeout);
|
||||
|
||||
if (std::abs(timeout - timeout_old) >= 0.001f) {
|
||||
dout_con << m_connection->getDesc() << " set resend timeout " << timeout
|
||||
<< " (rtt=" << rtt_stat << ") for peer id: " << id << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
bool UDPPeer::Ping(float dtime,SharedBuffer<u8>& data)
|
||||
@@ -1121,7 +1135,7 @@ bool UDPPeer::processReliableSendCommand(
|
||||
u16 packets_available = toadd.size();
|
||||
/* we didn't get a single sequence number no need to fill queue */
|
||||
if (!have_initial_sequence_number) {
|
||||
LOG(derr_con << m_connection->getDesc() << "Ran out of sequence numbers!" << std::endl);
|
||||
dout_con << m_connection->getDesc() << " No sequence numbers available!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -329,15 +329,24 @@ struct ConnectionCommand
|
||||
static ConnectionCommandPtr create(ConnectionCommandType type);
|
||||
};
|
||||
|
||||
/* maximum window size to use, 0xFFFF is theoretical maximum. don't think about
|
||||
/*
|
||||
* Window sizes to use, in packets (not bytes!).
|
||||
* 0xFFFF is theoretical maximum. don't think about
|
||||
* touching it, the less you're away from it the more likely data corruption
|
||||
* will occur
|
||||
*
|
||||
* Note: window sizes directly translate to maximum possible throughput, e.g.
|
||||
* (2048 * 512 bytes) / 33ms = 15 MiB/s
|
||||
*/
|
||||
|
||||
// Due to backwards compatibility we have different window sizes for what we'll
|
||||
// accept from peers vs. what we use for sending.
|
||||
#define MAX_RELIABLE_WINDOW_SIZE 0x8000
|
||||
#define MAX_RELIABLE_WINDOW_SIZE_SEND 2048
|
||||
/* starting value for window size */
|
||||
#define START_RELIABLE_WINDOW_SIZE 0x400
|
||||
#define START_RELIABLE_WINDOW_SIZE 64
|
||||
/* minimum value for window size */
|
||||
#define MIN_RELIABLE_WINDOW_SIZE 0x40
|
||||
#define MIN_RELIABLE_WINDOW_SIZE 32
|
||||
|
||||
class Channel
|
||||
{
|
||||
@@ -405,7 +414,7 @@ class Channel
|
||||
|
||||
void setWindowSize(long size)
|
||||
{
|
||||
m_window_size = (u16)rangelim(size, MIN_RELIABLE_WINDOW_SIZE, MAX_RELIABLE_WINDOW_SIZE);
|
||||
m_window_size = (u16)rangelim(size, MIN_RELIABLE_WINDOW_SIZE, MAX_RELIABLE_WINDOW_SIZE_SEND);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -35,7 +35,6 @@ namespace con
|
||||
#define PROFILE(a)
|
||||
#undef DEBUG_CONNECTION_KBPS
|
||||
#else
|
||||
/* this mutex is used to achieve log message consistency */
|
||||
#define PROFILE(a) a
|
||||
//#define DEBUG_CONNECTION_KBPS
|
||||
#undef DEBUG_CONNECTION_KBPS
|
||||
@@ -211,7 +210,8 @@ void ConnectionSendThread::runTimeouts(float dtime, u32 peer_packet_quota)
|
||||
}
|
||||
|
||||
float resend_timeout = udpPeer->getResendTimeout();
|
||||
for (Channel &channel : udpPeer->channels) {
|
||||
for (int ch = 0; ch < CHANNEL_COUNT; ch++) {
|
||||
auto &channel = udpPeer->channels[ch];
|
||||
|
||||
// Remove timed out incomplete unreliable split packets
|
||||
channel.incoming_splits.removeUnreliableTimedOuts(dtime, peer_timeout);
|
||||
@@ -232,8 +232,8 @@ void ConnectionSendThread::runTimeouts(float dtime, u32 peer_packet_quota)
|
||||
if (!timed_outs.empty()) {
|
||||
dout_con << m_connection->getDesc() <<
|
||||
"Skipping re-send of " << timed_outs.size() <<
|
||||
" timed-out reliables to peer_id " << udpPeer->id
|
||||
<< " (half-open)." << std::endl;
|
||||
" timed-out reliables to peer_id=" << udpPeer->id
|
||||
<< " channel=" << ch << " (half-open)." << std::endl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -246,7 +246,14 @@ void ConnectionSendThread::runTimeouts(float dtime, u32 peer_packet_quota)
|
||||
for (const auto &k : timed_outs)
|
||||
resendReliable(channel, k.get(), resend_timeout);
|
||||
|
||||
auto ws_old = channel.getWindowSize();
|
||||
channel.UpdateTimers(dtime);
|
||||
auto ws_new = channel.getWindowSize();
|
||||
if (ws_old != ws_new) {
|
||||
dout_con << m_connection->getDesc() <<
|
||||
"Window size adjusted to " << ws_new << " for peer_id="
|
||||
<< udpPeer->id << " channel=" << ch << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
/* send ping if necessary */
|
||||
@@ -299,12 +306,12 @@ void ConnectionSendThread::rawSend(const BufferedPacket *p)
|
||||
assert(p);
|
||||
try {
|
||||
m_connection->m_udpSocket.Send(p->address, p->data, p->size());
|
||||
LOG(dout_con << m_connection->getDesc()
|
||||
<< " rawSend: " << p->size()
|
||||
<< " bytes sent" << std::endl);
|
||||
//LOG(dout_con << m_connection->getDesc()
|
||||
// << " rawSend: " << p->size()
|
||||
// << " bytes sent" << std::endl);
|
||||
} catch (SendFailedException &e) {
|
||||
LOG(derr_con << m_connection->getDesc()
|
||||
<< "Connection::rawSend(): SendFailedException: "
|
||||
<< "SendFailedException: " << e.what() << " to "
|
||||
<< p->address.serializeString() << std::endl);
|
||||
}
|
||||
}
|
||||
@@ -317,6 +324,7 @@ void ConnectionSendThread::sendAsPacketReliable(BufferedPacketPtr &p, Channel *c
|
||||
channel->outgoing_reliables_sent.insert(p,
|
||||
(channel->readOutgoingSequenceNumber() - MAX_RELIABLE_WINDOW_SIZE)
|
||||
% (MAX_RELIABLE_WINDOW_SIZE + 1));
|
||||
// wtf is this calculation?? ^
|
||||
}
|
||||
catch (AlreadyExistsException &e) {
|
||||
LOG(derr_con << m_connection->getDesc()
|
||||
@@ -675,9 +683,9 @@ void ConnectionSendThread::sendPackets(float dtime, u32 peer_packet_quota)
|
||||
PROFILE(ScopeProfiler
|
||||
peerprofiler(g_profiler, peerIdentifier.str(), SPT_AVG));
|
||||
|
||||
LOG(dout_con << m_connection->getDesc()
|
||||
<< " Handle per peer queues: peer_id=" << peerId
|
||||
<< " packet quota: " << peer->m_increment_packets_remaining << std::endl);
|
||||
//LOG(dout_con << m_connection->getDesc()
|
||||
// << " Handle per peer queues: peer_id=" << peerId
|
||||
// << " packet quota: " << peer->m_increment_packets_remaining << std::endl);
|
||||
|
||||
// first send queued reliable packets for all peers (if possible)
|
||||
for (unsigned int i = 0; i < CHANNEL_COUNT; i++) {
|
||||
@@ -1180,7 +1188,7 @@ SharedBuffer<u8> ConnectionReceiveThread::handlePacketType_Control(Channel *chan
|
||||
// an overflow is quite unlikely but as it'd result in major
|
||||
// rtt miscalculation we handle it here
|
||||
if (current_time > p->absolute_send_time) {
|
||||
float rtt = (current_time - p->absolute_send_time) / 1000.0;
|
||||
float rtt = (current_time - p->absolute_send_time) / 1000.0f;
|
||||
|
||||
// Let peer calculate stuff according to it
|
||||
// (avg_rtt and resend_timeout)
|
||||
@@ -1325,12 +1333,6 @@ SharedBuffer<u8> ConnectionReceiveThread::handlePacketType_Reliable(Channel *cha
|
||||
<< ", seqnum: " << seqnum << std::endl;)
|
||||
m_connection->sendAck(peer->id, channelnum, seqnum);
|
||||
|
||||
// we already have this packet so this one was on wire at least
|
||||
// the current timeout
|
||||
// we don't know how long this packet was on wire don't do silly guessing
|
||||
// dynamic_cast<UDPPeer*>(&peer)->
|
||||
// reportRTT(dynamic_cast<UDPPeer*>(&peer)->getResendTimeout());
|
||||
|
||||
throw ProcessedSilentlyException("Retransmitting ack for old packet");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,9 +224,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
Add TOCLIENT_MOVE_PLAYER_REL
|
||||
Move default minimap from client-side C++ to server-side builtin Lua
|
||||
[scheduled bump for 5.9.0]
|
||||
PROTOCOL VERSION 45:
|
||||
Minimap HUD element supports negative size values as percentages
|
||||
[bump for 5.9.1]
|
||||
*/
|
||||
|
||||
#define LATEST_PROTOCOL_VERSION 44
|
||||
#define LATEST_PROTOCOL_VERSION 45
|
||||
#define LATEST_PROTOCOL_VERSION_STRING TOSTRING(LATEST_PROTOCOL_VERSION)
|
||||
|
||||
// Server's supported network protocol range
|
||||
|
||||
@@ -50,9 +50,6 @@ typedef int socklen_t;
|
||||
#define SOCKET_ERR_STR(e) strerror(e)
|
||||
#endif
|
||||
|
||||
// Set to true to enable verbose debug output
|
||||
bool socket_enable_debug_output = false; // yuck
|
||||
|
||||
static bool g_sockets_initialized = false;
|
||||
|
||||
// Initialize sockets
|
||||
@@ -104,12 +101,6 @@ bool UDPSocket::init(bool ipv6, bool noExceptions)
|
||||
m_addr_family = ipv6 ? AF_INET6 : AF_INET;
|
||||
m_handle = socket(m_addr_family, SOCK_DGRAM, IPPROTO_UDP);
|
||||
|
||||
if (socket_enable_debug_output) {
|
||||
tracestream << "UDPSocket(" << (int)m_handle
|
||||
<< ")::UDPSocket(): ipv6 = " << (ipv6 ? "true" : "false")
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
if (m_handle < 0) {
|
||||
if (noExceptions) {
|
||||
return false;
|
||||
@@ -135,11 +126,6 @@ bool UDPSocket::init(bool ipv6, bool noExceptions)
|
||||
|
||||
UDPSocket::~UDPSocket()
|
||||
{
|
||||
if (socket_enable_debug_output) {
|
||||
tracestream << "UDPSocket( " << (int)m_handle << ")::~UDPSocket()"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
if (m_handle >= 0) {
|
||||
#ifdef _WIN32
|
||||
closesocket(m_handle);
|
||||
@@ -151,12 +137,6 @@ UDPSocket::~UDPSocket()
|
||||
|
||||
void UDPSocket::Bind(Address addr)
|
||||
{
|
||||
if (socket_enable_debug_output) {
|
||||
tracestream << "UDPSocket(" << (int)m_handle
|
||||
<< ")::Bind(): " << addr.serializeString() << ":"
|
||||
<< addr.getPort() << std::endl;
|
||||
}
|
||||
|
||||
if (addr.getFamily() != m_addr_family) {
|
||||
const char *errmsg =
|
||||
"Socket and bind address families do not match";
|
||||
@@ -202,30 +182,6 @@ void UDPSocket::Send(const Address &destination, const void *data, int size)
|
||||
if (INTERNET_SIMULATOR)
|
||||
dumping_packet = myrand() % INTERNET_SIMULATOR_PACKET_LOSS == 0;
|
||||
|
||||
if (socket_enable_debug_output) {
|
||||
// Print packet destination and size
|
||||
tracestream << (int)m_handle << " -> ";
|
||||
destination.print(tracestream);
|
||||
tracestream << ", size=" << size;
|
||||
|
||||
// Print packet contents
|
||||
tracestream << ", data=";
|
||||
for (int i = 0; i < size && i < 20; i++) {
|
||||
if (i % 2 == 0)
|
||||
tracestream << " ";
|
||||
unsigned int a = ((const unsigned char *)data)[i];
|
||||
tracestream << std::hex << std::setw(2) << std::setfill('0') << a;
|
||||
}
|
||||
|
||||
if (size > 20)
|
||||
tracestream << "...";
|
||||
|
||||
if (dumping_packet)
|
||||
tracestream << " (DUMPED BY INTERNET_SIMULATOR)";
|
||||
|
||||
tracestream << std::endl;
|
||||
}
|
||||
|
||||
if (dumping_packet) {
|
||||
// Lol let's forget it
|
||||
tracestream << "UDPSocket::Send(): INTERNET_SIMULATOR: dumping packet."
|
||||
@@ -302,26 +258,6 @@ int UDPSocket::Receive(Address &sender, void *data, int size)
|
||||
sender = Address(address_ip, address_port);
|
||||
}
|
||||
|
||||
if (socket_enable_debug_output) {
|
||||
// Print packet sender and size
|
||||
tracestream << (int)m_handle << " <- ";
|
||||
sender.print(tracestream);
|
||||
tracestream << ", size=" << received;
|
||||
|
||||
// Print packet contents
|
||||
tracestream << ", data=";
|
||||
for (int i = 0; i < received && i < 20; i++) {
|
||||
if (i % 2 == 0)
|
||||
tracestream << " ";
|
||||
unsigned int a = ((const unsigned char *)data)[i];
|
||||
tracestream << std::hex << std::setw(2) << std::setfill('0') << a;
|
||||
}
|
||||
if (received > 20)
|
||||
tracestream << "...";
|
||||
|
||||
tracestream << std::endl;
|
||||
}
|
||||
|
||||
return received;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "irrlichttypes.h"
|
||||
#include "networkexceptions.h"
|
||||
|
||||
extern bool socket_enable_debug_output;
|
||||
|
||||
void sockets_init();
|
||||
void sockets_cleanup();
|
||||
|
||||
|
||||
@@ -561,8 +561,10 @@ int ObjectRef::l_set_bone_position(lua_State *L)
|
||||
BoneOverride props;
|
||||
if (!lua_isnoneornil(L, 3))
|
||||
props.position.vector = check_v3f(L, 3);
|
||||
if (!lua_isnoneornil(L, 4))
|
||||
props.rotation.next = core::quaternion(check_v3f(L, 4) * core::DEGTORAD);
|
||||
if (!lua_isnoneornil(L, 4)) {
|
||||
props.rotation.next_radians = check_v3f(L, 4) * core::DEGTORAD;
|
||||
props.rotation.next = core::quaternion(props.rotation.next_radians);
|
||||
}
|
||||
props.position.absolute = true;
|
||||
props.rotation.absolute = true;
|
||||
sao->setBoneOverride(bone, props);
|
||||
@@ -584,9 +586,9 @@ int ObjectRef::l_get_bone_position(lua_State *L)
|
||||
std::string bone = readParam<std::string>(L, 2, "");
|
||||
BoneOverride props = sao->getBoneOverride(bone);
|
||||
push_v3f(L, props.position.vector);
|
||||
v3f euler_rot;
|
||||
props.rotation.next.toEuler(euler_rot);
|
||||
push_v3f(L, euler_rot * core::RADTODEG);
|
||||
// In order to give modders back the euler angles they passed in,
|
||||
// this **must not** compute equivalent euler angles from the quaternion
|
||||
push_v3f(L, props.rotation.next_radians * core::RADTODEG);
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -632,8 +634,10 @@ int ObjectRef::l_set_bone_override(lua_State *L)
|
||||
lua_getfield(L, 3, "rotation");
|
||||
if (!lua_isnil(L, -1)) {
|
||||
lua_getfield(L, -1, "vec");
|
||||
if (!lua_isnil(L, -1))
|
||||
props.rotation.next = core::quaternion(check_v3f(L, -1));
|
||||
if (!lua_isnil(L, -1)) {
|
||||
props.rotation.next_radians = check_v3f(L, -1);
|
||||
props.rotation.next = core::quaternion(props.rotation.next_radians);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
|
||||
read_prop_attrs(props.rotation);
|
||||
@@ -671,9 +675,9 @@ static void push_bone_override(lua_State *L, const BoneOverride &props)
|
||||
|
||||
push_prop("position", props.position, props.position.vector);
|
||||
|
||||
v3f euler_rot;
|
||||
props.rotation.next.toEuler(euler_rot);
|
||||
push_prop("rotation", props.rotation, euler_rot);
|
||||
// In order to give modders back the euler angles they passed in,
|
||||
// this **must not** compute equivalent euler angles from the quaternion
|
||||
push_prop("rotation", props.rotation, props.rotation.next_radians);
|
||||
|
||||
push_prop("scale", props.scale, props.scale.vector);
|
||||
|
||||
|
||||
@@ -426,18 +426,8 @@ int ModApiServer::l_show_formspec(lua_State *L)
|
||||
NO_MAP_LOCK_REQUIRED;
|
||||
const char *playername = luaL_checkstring(L, 1);
|
||||
const char *formname = luaL_checkstring(L, 2);
|
||||
if (*formname == '\0') {
|
||||
log_deprecated(L, "Deprecated call to `minetest.show_formspec`:"
|
||||
"`formname` must not be empty");
|
||||
}
|
||||
const char *formspec = luaL_checkstring(L, 3);
|
||||
|
||||
if(getServer(L)->showFormspec(playername,formspec,formname))
|
||||
{
|
||||
lua_pushboolean(L, true);
|
||||
}else{
|
||||
lua_pushboolean(L, false);
|
||||
}
|
||||
lua_pushboolean(L, getServer(L)->showFormspec(playername,formspec,formname));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -262,6 +262,8 @@ void decompressZstd(std::istream &is, std::ostream &os)
|
||||
is.read(input_buffer, bufsize);
|
||||
input.size = is.gcount();
|
||||
input.pos = 0;
|
||||
if (input.size == 0)
|
||||
throw SerializationError("decompressZstd: data ended too early");
|
||||
}
|
||||
|
||||
ret = ZSTD_decompressStream(stream.get(), &output, &input);
|
||||
|
||||
@@ -1071,6 +1071,8 @@ void Server::Receive(float timeout)
|
||||
// and a faster server-step is better than busy waiting.
|
||||
if (remaining_time_us() < 1000.0f)
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
peer_id = pkt.getPeerId();
|
||||
|
||||
@@ -55,10 +55,7 @@ const ItemGroupList &UnitSAO::getArmorGroups() const
|
||||
void UnitSAO::setAnimation(
|
||||
v2f frame_range, float frame_speed, float frame_blend, bool frame_loop)
|
||||
{
|
||||
if (std::tie(m_animation_range, m_animation_speed, m_animation_blend,
|
||||
m_animation_loop) ==
|
||||
std::tie(frame_range, frame_speed, frame_blend, frame_loop))
|
||||
return; // no change
|
||||
// Note: Always resend (even if parameters are unchanged) to restart animations.
|
||||
m_animation_range = frame_range;
|
||||
m_animation_speed = frame_speed;
|
||||
m_animation_blend = frame_blend;
|
||||
|
||||
@@ -46,7 +46,7 @@ struct SkyboxParams
|
||||
float body_orbit_tilt { INVALID_SKYBOX_TILT };
|
||||
s16 fog_distance { -1 };
|
||||
float fog_start { -1.0f };
|
||||
video::SColor fog_color; // override, only used if alpha > 0
|
||||
video::SColor fog_color { 0 }; // override, only used if alpha > 0
|
||||
};
|
||||
|
||||
struct SunParams
|
||||
|
||||
@@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "SColor.h"
|
||||
#include <matrix4.h>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
|
||||
#define rangelim(d, min, max) ((d) < (min) ? (min) : ((d) > (max) ? (max) : (d)))
|
||||
#define myfloor(x) ((x) < 0.0 ? (int)(x) - 1 : (int)(x))
|
||||
|
||||
@@ -16,20 +16,18 @@ prompt_for() {
|
||||
}
|
||||
|
||||
# Reads current versions
|
||||
# out: VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_IS_DEV CURRENT_VERSION ANDROID_VERSION_CODE
|
||||
# out: VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_IS_DEV CURRENT_VERSION
|
||||
read_versions() {
|
||||
VERSION_MAJOR=$(grep -oE '^set\(VERSION_MAJOR [0-9]+\)$' CMakeLists.txt | tr -dC 0-9)
|
||||
VERSION_MINOR=$(grep -oE '^set\(VERSION_MINOR [0-9]+\)$' CMakeLists.txt | tr -dC 0-9)
|
||||
VERSION_PATCH=$(grep -oE '^set\(VERSION_PATCH [0-9]+\)$' CMakeLists.txt | tr -dC 0-9)
|
||||
VERSION_IS_DEV=$(grep -oE '^set\(DEVELOPMENT_BUILD [A-Z]+\)$' CMakeLists.txt)
|
||||
ANDROID_VERSION_CODE=$(grep -oE '\("versionCode", [0-9]+\)' android/build.gradle | tr -dC 0-9)
|
||||
|
||||
# Make sure they all exist
|
||||
[ -n "$VERSION_MAJOR" ]
|
||||
[ -n "$VERSION_MINOR" ]
|
||||
[ -n "$VERSION_PATCH" ]
|
||||
[ -n "$VERSION_IS_DEV" ]
|
||||
[ -n "$ANDROID_VERSION_CODE" ]
|
||||
|
||||
if echo "$VERSION_IS_DEV" | grep -q ' TRUE'; then
|
||||
VERSION_IS_DEV=1
|
||||
@@ -39,7 +37,6 @@ read_versions() {
|
||||
CURRENT_VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
|
||||
|
||||
echo "Current Minetest version: $CURRENT_VERSION"
|
||||
echo "Current Android version code: $ANDROID_VERSION_CODE"
|
||||
}
|
||||
|
||||
# Retrieves protocol version from header
|
||||
@@ -49,18 +46,6 @@ read_proto_ver() {
|
||||
git show "$ref":src/network/networkprotocol.h | grep -oE 'LATEST_PROTOCOL_VERSION [0-9]+' | tr -dC 0-9
|
||||
}
|
||||
|
||||
## Prompts for new android version code
|
||||
# in: ANDROID_VERSION_CODE
|
||||
# out: NEW_ANDROID_VERSION_CODE
|
||||
bump_android_ver() {
|
||||
# +1 for ARM and +1 for ARM64 APKs
|
||||
NEW_ANDROID_VERSION_CODE=$(expr $ANDROID_VERSION_CODE + 2)
|
||||
NEW_ANDROID_VERSION_CODE=$(prompt_for "Set android version code" '[0-9]+' $NEW_ANDROID_VERSION_CODE)
|
||||
|
||||
echo
|
||||
echo "New android version code: $NEW_ANDROID_VERSION_CODE"
|
||||
}
|
||||
|
||||
## Prompts for new version
|
||||
# in: VERSION_{MAJOR,MINOR,PATCH} DO_PATCH_REL
|
||||
# out: NEXT_VERSION NEXT_VERSION_{MAJOR,MINOR,PATCH}
|
||||
@@ -108,14 +93,6 @@ set_dev_build() {
|
||||
git add -f CMakeLists.txt android/build.gradle
|
||||
}
|
||||
|
||||
## Writes new android version code
|
||||
# in: NEW_ANDROID_VERSION_CODE
|
||||
write_android_version() {
|
||||
sed -i -re "s/\"versionCode\", [0-9]+/\"versionCode\", $NEW_ANDROID_VERSION_CODE/" android/build.gradle
|
||||
|
||||
git add -f android/build.gradle
|
||||
}
|
||||
|
||||
## Writes new version to the right files
|
||||
# in: NEXT_VERSION NEXT_VERSION_{MAJOR,MINOR,PATCH}
|
||||
write_new_version() {
|
||||
@@ -198,8 +175,6 @@ if [ "$DO_PATCH_REL" -eq 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bump_android_ver
|
||||
write_android_version
|
||||
set_dev_build 0
|
||||
|
||||
perform_release "$CURRENT_VERSION"
|
||||
@@ -212,8 +187,6 @@ if [ "$DO_PATCH_REL" -eq 0 ]; then
|
||||
else
|
||||
# On a patch release the version moves from 5.7.0 -> 5.7.1 (new tag)
|
||||
|
||||
bump_android_ver
|
||||
write_android_version
|
||||
bump_version
|
||||
write_new_version
|
||||
|
||||
|
||||