diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 5c27183668..7d33ddade0 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -25,16 +25,16 @@ Contributions are welcome! Here's how you can help:
the work, to avoid disappointment.
You may also benefit from discussing on our IRC development channel
- [#luanti-dev](http://www.luanti.org/irc/). Note that a proper IRC client
+ [#luanti-dev](https://docs.luanti.org/about/irc/). Note that a proper IRC client
is required to speak on this channel.
3. Start coding!
- Refer to the
[Lua API](https://github.com/luanti-org/luanti/blob/master/doc/lua_api.md),
- [Developer Wiki](https://dev.luanti.org/) and other
+ [Luanti Documentation](https://docs.luanti.org/) and other
[documentation](https://github.com/luanti-org/luanti/tree/master/doc).
- - Follow the [C/C++](https://dev.luanti.org/Code_style_guidelines) and
- [Lua](https://dev.luanti.org/Lua_code_style_guidelines) code style guidelines.
+ - Follow the [C/C++](https://docs.luanti.org/for-engine-devs/code-style-guidelines/) and
+ [Lua](https://docs.luanti.org/for-engine-devs/lua-code-style-guidelines/) code style guidelines.
- Check your code works as expected and document any changes to the Lua API.
- To avoid conflicting changes between contributions, do not do the following manually. They will be done before each release.
- Run `updatepo.sh` or update `luanti.po{,t}` even if your code adds new translatable strings.
@@ -64,8 +64,8 @@ Contributions are welcome! Here's how you can help:
picture of the project.
2. It works.
3. It follows the code style for
- [C/C++](https://dev.luanti.org/Code_style_guidelines) or
- [Lua](https://dev.luanti.org/Lua_code_style_guidelines).
+ [C/C++](https://docs.luanti.org/for-engine-devs/code-style-guidelines/) or
+ [Lua](https://docs.luanti.org/for-engine-devs/lua-code-style-guidelines/).
4. The code's interfaces are well designed, regardless of other aspects that
might need more work in the future.
5. It uses protocols and formats which include the required compatibility.
@@ -106,7 +106,7 @@ the project page with a list of current languages
Builtin (the component which contains things like server messages, chat command
descriptions, privilege descriptions) is translated separately; it needs to be
translated by editing a `.tr` text file. See
-[Translation](https://dev.luanti.org/Translation) for more information.
+[Translation](https://docs.luanti.org/for-creators/translation/) for more information.
## Donations
@@ -116,11 +116,11 @@ methods on [our website](http://www.luanti.org/development/#donate).
# Maintaining
* This is a concise version of the
- [Rules & Guidelines](https://dev.luanti.org/engine-dev-process/) on the developer wiki.*
+ [Rules & Guidelines](https://docs.luanti.org/for-engine-devs/) on the Luanti Documentation.*
These notes are for those who have push access Luanti (core developers / maintainers).
-- See the [project organisation](https://dev.luanti.org/Organisation) for the people involved.
+- See the [project organisation](https://docs.luanti.org/for-engine-devs/organization/) for the people involved.
## Concept approvals and roadmaps
@@ -169,4 +169,4 @@ Submit a :+1: (+1) or "Looks good" comment to show you believe the pull-request
## Releasing a new version
-*Refer to [dev.luanti.org/Releasing_Luanti](https://dev.luanti.org/Releasing_Luanti)*
+*Refer to [docs.luanti.org/for-engine-devs/releasing-luanti](https://docs.luanti.org/for-engine-devs/releasing-luanti/)*
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index e5c98a9013..b84c0442f2 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -14,6 +14,7 @@ on:
- 'cmake/Modules/**'
- 'po/**.po'
- 'util/ci/**'
+ - 'util/helper_mod/**'
- '.github/workflows/linux.yml'
pull_request:
paths:
@@ -27,6 +28,7 @@ on:
- 'cmake/Modules/**'
- 'po/**.po'
- 'util/ci/**'
+ - 'util/helper_mod/**'
- '.github/workflows/linux.yml'
env:
@@ -76,6 +78,8 @@ jobs:
env:
CC: gcc-14
CXX: g++-14
+ # just to check that they compile correctly
+ CMAKE_FLAGS: '-DBUILD_BENCHMARKS=1'
- name: Test
run: |
@@ -132,16 +136,16 @@ jobs:
run: |
./util/test_multiplayer.sh
- # Build with prometheus-cpp (server-only)
- clang_11_prometheus:
- name: "clang_11 (PROMETHEUS=1)"
- runs-on: ubuntu-22.04
+ # Build with prometheus-cpp (server-only), also runs on ARM64
+ clang_prometheus_arm:
+ name: "clang (with Prometheus, ARM64)"
+ runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Install deps
run: |
source ./util/ci/common.sh
- install_linux_deps clang-11
+ install_linux_deps --headless clang libluajit-5.1-dev
- name: Build prometheus-cpp
run: ./util/ci/build_prometheus_cpp.sh
@@ -150,8 +154,8 @@ jobs:
run: |
./util/ci/build.sh
env:
- CC: clang-11
- CXX: clang++-11
+ CC: clang
+ CXX: clang++
CMAKE_FLAGS: "-DENABLE_PROMETHEUS=1 -DBUILD_CLIENT=0 -DENABLE_CURSES=0"
- name: Test
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1bf2effd1d..53d0b8ab63 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,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 12)
+set(VERSION_MINOR 14)
set(VERSION_PATCH 0)
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
diff --git a/README.md b/README.md
index 6abd6d22c9..9e5e7e7c40 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ Table of Contents
Further documentation
----------------------
- Website: https://www.luanti.org/
-- Wiki: https://wiki.luanti.org/
+- Luanti Documentation: https://docs.luanti.org/
- Forum: https://forum.luanti.org/
- GitHub: https://github.com/luanti-org/luanti/
- [Developer documentation](doc/developing/)
diff --git a/android/app/src/main/res/values-gl/strings.xml b/android/app/src/main/res/values-gl/strings.xml
index 89ee1f2bb5..65457a9dd1 100644
--- a/android/app/src/main/res/values-gl/strings.xml
+++ b/android/app/src/main/res/values-gl/strings.xml
@@ -8,4 +8,5 @@
Menos de 1 minuto…
Feito
Non se atopou ningún navegador web
+ Luanti está en funcionamento
diff --git a/android/app/src/main/res/values-iw/strings.xml b/android/app/src/main/res/values-iw/strings.xml
new file mode 100644
index 0000000000..e1bc99e38c
--- /dev/null
+++ b/android/app/src/main/res/values-iw/strings.xml
@@ -0,0 +1,12 @@
+
+
+ לואנטי
+ טוען…
+ הודעה כללית
+ התראות מלואנטי
+ טוען לואנטי
+ לואנטי רץ
+ בוצע
+ לא נמצא דפדפן אינטרנט
+ פחות מדקה אחת…
+
diff --git a/android/app/src/main/res/values-sl/strings.xml b/android/app/src/main/res/values-sl/strings.xml
index 97661d348c..0a69aa6547 100644
--- a/android/app/src/main/res/values-sl/strings.xml
+++ b/android/app/src/main/res/values-sl/strings.xml
@@ -8,4 +8,5 @@
Obvestilo od Luantia
Končano!l
Nalaganje Luantia
+ Luanti deluje
diff --git a/android/app/src/main/res/values-uk/strings.xml b/android/app/src/main/res/values-uk/strings.xml
index 2969e0e53e..b7528cc228 100644
--- a/android/app/src/main/res/values-uk/strings.xml
+++ b/android/app/src/main/res/values-uk/strings.xml
@@ -8,4 +8,5 @@
Менше за 1 хвилину…
Готово
Сповіщення від Luanti
-
\ No newline at end of file
+ Luanti працює
+
diff --git a/android/app/src/main/res/values-zh-rCN/strings.xml b/android/app/src/main/res/values-zh-rCN/strings.xml
index 5441ec3227..2787b556df 100644
--- a/android/app/src/main/res/values-zh-rCN/strings.xml
+++ b/android/app/src/main/res/values-zh-rCN/strings.xml
@@ -8,4 +8,5 @@
不到1分钟…
完成
未找到网页浏览器
+ Luanti正在运行
diff --git a/android/build.gradle b/android/build.gradle
index 61637c2ec3..13217f9414 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
project.ext.set("versionMajor", 5) // Version Major
-project.ext.set("versionMinor", 12) // Version Minor
+project.ext.set("versionMinor", 14) // Version Minor
project.ext.set("versionPatch", 0) // Version Patch
// ^ keep in sync with cmake
diff --git a/builtin/common/settings/components.lua b/builtin/common/settings/components.lua
index 99fb0cd76c..38af1b0862 100644
--- a/builtin/common/settings/components.lua
+++ b/builtin/common/settings/components.lua
@@ -438,11 +438,28 @@ function make.key(setting)
if value == "" then
return height
end
+
+ local critical_keys = {
+ keymap_drop = true,
+ keymap_dig = true,
+ keymap_place = true,
+ }
+
for _, o in ipairs(core.full_settingtypes) do
- if o.type == "key" and o.name ~= setting.name and core.are_keycodes_equal(core.settings:get(o.name), value) then
- table.insert(fs, ("label[0,%f;%s]"):format(height + 0.3,
- core.colorize(mt_color_orange, fgettext([[Conflicts with "$1"]], fgettext(o.readable_name)))))
- height = height + 0.6
+ if o.type == "key" and o.name ~= setting.name and
+ core.are_keycodes_equal(core.settings:get(o.name), value) then
+
+ local is_current_close_world = setting.name == "keymap_close_world"
+ local is_other_close_world = o.name == "keymap_close_world"
+ local is_current_critical = critical_keys[setting.name]
+ local is_other_critical = critical_keys[o.name]
+
+ if (is_other_critical or is_current_critical) or
+ (not is_current_close_world and not is_other_close_world) then
+ table.insert(fs, ("label[0,%f;%s]"):format(height + 0.3,
+ core.colorize(mt_color_orange, fgettext([[Conflicts with "$1"]], fgettext(o.readable_name)))))
+ height = height + 0.6
+ end
end
end
return height
@@ -454,12 +471,12 @@ function make.key(setting)
get_formspec = function(self, avail_w)
self.resettable = core.settings:has(setting.name)
- local btn_bind_width = math.max(2.5, avail_w/2)
+ local btn_bind_width = math.max(2.5, avail_w / 2)
local value = core.settings:get(setting.name)
local fs = {
("label[0,0.4;%s]"):format(get_label(setting)),
("button_key[%f,0;%f,0.8;%s;%s]"):format(
- btn_bind_width, btn_bind_width-0.8,
+ btn_bind_width, btn_bind_width - 0.8,
btn_bind, core.formspec_escape(value)),
("image_button[%f,0;0.8,0.8;%s;%s;]"):format(avail_w - 0.8,
core.formspec_escape(defaulttexturedir .. "clear.png"),
diff --git a/builtin/common/settings/generate_from_settingtypes.lua b/builtin/common/settings/generate_from_settingtypes.lua
index 4c33a8fc1a..6237f02c06 100644
--- a/builtin/common/settings/generate_from_settingtypes.lua
+++ b/builtin/common/settings/generate_from_settingtypes.lua
@@ -16,7 +16,7 @@ local minetest_example_header = [[
# to the program, eg. "luanti.exe --config ../minetest.conf.example".
# Further documentation:
-# https://wiki.luanti.org/
+# https://docs.luanti.org/
]]
@@ -44,15 +44,18 @@ local function create_minetest_conf_example(settings)
insert(result, rep("#", entry.level))
insert(result, "# " .. entry.name .. "\n\n")
end
- else
+ else -- any `type` as listed in `settingtypes.txt`
local group_format = false
if entry.noise_params and entry.values then
if entry.type == "noise_params_2d" or entry.type == "noise_params_3d" then
group_format = true
end
end
- if entry.comment ~= "" then
- for _, comment_line in ipairs(entry.comment:split("\n", true)) do
+
+ local comment = entry.comment ~= "" and entry.comment
+ or entry.readable_name -- fallback to the short description
+ if comment ~= "" then
+ for _, comment_line in ipairs(comment:split("\n", true)) do
if comment_line == "" then
insert(result, "#\n")
else
@@ -102,23 +105,45 @@ end
local translation_file_header = [[
// This file is automatically generated
// It contains a bunch of fake gettext calls, to tell xgettext about the strings in config files
-// To update it, refer to the bottom of builtin/mainmenu/dlg_settings_advanced.lua
+// To update it, refer to the bottom of builtin/common/settings/init.lua
fake_function() {]]
+local function add_translation_string(result, str, seen)
+ if seen[str] then
+ return
+ end
+ seen[str] = true
+
+ -- Prevent gettext from interpreting e.g. "50% of volume" as C-formatted string
+ -- Documentation: https://www.gnu.org/software/gettext/manual/html_node/c_002dformat-Flag.html
+ local force_no_c_format = str:find("%", 1, true)
+ local prefix = force_no_c_format and "/* xgettext:no-c-format */ " or ""
+
+ local have_newlines = str:find("\n", 1, true)
+ if have_newlines then
+ -- Formatting as "%q" inserts literal newlines. But we want '\n'.
+ -- Hence, use "%s" and escape relevant characters manually.
+ str = str:gsub("\n", "\\n")
+ str = str:gsub("\"", "\\\"")
+ insert(result, sprintf("\t%sgettext(\"%s\");", prefix, str))
+ else
+ insert(result, sprintf("\t%sgettext(%q);", prefix, str))
+ end
+end
+
local function create_translation_file(settings)
+ local seen = {} -- to deduplicate entries
local result = { translation_file_header }
for _, entry in ipairs(settings) do
if entry.type == "category" then
- insert(result, sprintf("\tgettext(%q);", entry.name))
+ add_translation_string(result, entry.name, seen)
else
if entry.readable_name then
- insert(result, sprintf("\tgettext(%q);", entry.readable_name))
+ add_translation_string(result, entry.readable_name, seen)
end
if entry.comment ~= "" then
- local comment_escaped = entry.comment:gsub("\n", "\\n")
- comment_escaped = comment_escaped:gsub("\"", "\\\"")
- insert(result, "\tgettext(\"" .. comment_escaped .. "\");")
+ add_translation_string(result, entry.comment, seen)
end
end
end
diff --git a/builtin/common/strict.lua b/builtin/common/strict.lua
index 9bfa8d7a21..b3c4ccce46 100644
--- a/builtin/common/strict.lua
+++ b/builtin/common/strict.lua
@@ -19,12 +19,14 @@ function meta:__newindex(name, value)
return
end
local info = getinfo(2, "Sl")
- local desc = ("%s:%d"):format(info.short_src, info.currentline)
- local warn_key = ("%s\0%d\0%s"):format(info.source, info.currentline, name)
- if not warned[warn_key] and info.what ~= "main" and info.what ~= "C" then
- core.log("warning", ("Assignment to undeclared global %q inside a function at %s.")
- :format(name, desc))
- warned[warn_key] = true
+ if info ~= nil then
+ local desc = ("%s:%d"):format(info.short_src, info.currentline)
+ local warn_key = ("%s\0%d\0%s"):format(info.source, info.currentline, name)
+ if not warned[warn_key] and info.what ~= "main" and info.what ~= "C" then
+ core.log("warning", ("Assignment to undeclared global %q inside a function at %s.")
+ :format(name, desc))
+ warned[warn_key] = true
+ end
end
declared[name] = true
end
@@ -35,6 +37,9 @@ function meta:__index(name)
return
end
local info = getinfo(2, "Sl")
+ if info == nil then
+ return
+ end
local warn_key = ("%s\0%d\0%s"):format(info.source, info.currentline, name)
if not warned[warn_key] and info.what ~= "C" then
core.log("warning", ("Undeclared global variable %q accessed at %s:%s")
diff --git a/builtin/common/tests/vector_spec.lua b/builtin/common/tests/vector_spec.lua
index 9a0458be4a..b7120d18dd 100644
--- a/builtin/common/tests/vector_spec.lua
+++ b/builtin/common/tests/vector_spec.lua
@@ -432,7 +432,32 @@ describe("vector", function()
assert.True(almost_equal({x = 1, y = 0, z = 0},
vector.rotate({x = 1, y = 0, z = 0}, {x = math.pi / 123, y = 0, z = 0})))
end)
- it("is counterclockwise", function()
+ it("rotation order is Z-X-Y", function()
+ local r = vector.new(1, 2, 3)
+ for _, v in ipairs({
+ vector.new(1, 0, 0),
+ vector.new(0, 1, 0),
+ vector.new(0, 0, 1),
+ }) do
+ local expected = v:rotate(r)
+ local function try(order)
+ local rotated = v
+ for axis in order:gmatch(".") do
+ local r_axis = vector.zero()
+ r_axis[axis] = r[axis]
+ rotated = vector.rotate(rotated, r_axis)
+ end
+ return almost_equal(rotated, expected)
+ end
+ assert.False(try("xyz"))
+ assert.False(try("xzy"))
+ assert.False(try("yxz"))
+ assert.False(try("yzx"))
+ assert.True(try("zxy"))
+ assert.False(try("zyx"))
+ end
+ end)
+ it("is right handed", function()
local v_before1 = {x = 0, y = 1, z = -1}
local v_after1 = vector.rotate(v_before1, {x = math.pi / 4, y = 0, z = 0})
assert.True(almost_equal(vector.normalize(vector.cross(v_after1, v_before1)), {x = 1, y = 0, z = 0}))
diff --git a/builtin/fstk/ui.lua b/builtin/fstk/ui.lua
index 44d2ab3d89..31b104ed30 100644
--- a/builtin/fstk/ui.lua
+++ b/builtin/fstk/ui.lua
@@ -118,7 +118,7 @@ function ui.update()
if (active_toplevel_ui_elements > 1) then
core.log("warning", "more than one active ui "..
- "element, self most likely isn't intended")
+ "element, this most likely isn't intended")
end
if (active_toplevel_ui_elements == 0) then
diff --git a/builtin/game/features.lua b/builtin/game/features.lua
index 1b329c7a32..4837f29bdc 100644
--- a/builtin/game/features.lua
+++ b/builtin/game/features.lua
@@ -47,6 +47,7 @@ core.features = {
particle_blend_clip = true,
remove_item_match_meta = true,
httpfetch_additional_methods = true,
+ object_guids = true,
}
function core.has_feature(arg)
diff --git a/builtin/game/item.lua b/builtin/game/item.lua
index 4d68f11360..3e810c3f06 100644
--- a/builtin/game/item.lua
+++ b/builtin/game/item.lua
@@ -740,16 +740,16 @@ core.noneitemdef_default = { -- This is used for the hand and unknown items
--
local get_node_raw = core.get_node_raw
-core.get_node_raw = nil
+local get_name_from_content_id = core.get_name_from_content_id
function core.get_node(pos)
local content, param1, param2 = get_node_raw(pos.x, pos.y, pos.z)
- return {name = core.get_name_from_content_id(content), param1 = param1, param2 = param2}
+ return {name = get_name_from_content_id(content), param1 = param1, param2 = param2}
end
function core.get_node_or_nil(pos)
local content, param1, param2, pos_ok = get_node_raw(pos.x, pos.y, pos.z)
return pos_ok and
- {name = core.get_name_from_content_id(content), param1 = param1, param2 = param2}
+ {name = get_name_from_content_id(content), param1 = param1, param2 = param2}
or nil
end
diff --git a/builtin/game/misc_s.lua b/builtin/game/misc_s.lua
index 9433f74bbf..983bd70965 100644
--- a/builtin/game/misc_s.lua
+++ b/builtin/game/misc_s.lua
@@ -130,6 +130,7 @@ core.protocol_versions = {
["5.10.0"] = 46,
["5.11.0"] = 47,
["5.12.0"] = 48,
+ ["5.13.0"] = 49,
}
setmetatable(core.protocol_versions, {__newindex = function()
diff --git a/builtin/mainmenu/content/dlg_package.lua b/builtin/mainmenu/content/dlg_package.lua
index 500fb3f6c2..1103f42a75 100644
--- a/builtin/mainmenu/content/dlg_package.lua
+++ b/builtin/mainmenu/content/dlg_package.lua
@@ -3,18 +3,61 @@
-- SPDX-License-Identifier: LGPL-2.1-or-later
-local function get_info_formspec(size, padding, text)
- return table.concat({
- "formspec_version[6]",
- "size[", size.x, ",", size.y, "]",
- "padding[0,0]",
- "bgcolor[;true]",
+local function get_description_hypertext(package, info, loading_error)
+ -- Screenshots and description
+ local hypertext = "" .. core.hypertext_escape(package.short_description) .. "\n"
- "label[4,4.35;", text, "]",
- "container[", padding.x, ",", size.y - 0.8 - padding.y, "]",
- "button[0,0;2,0.8;back;", fgettext("Back"), "]",
- "container_end[]",
- })
+ local screenshots = info and info.screenshots or {{url = package.thumbnail}}
+
+ local winfo = core.get_window_info()
+ local fs_to_px = winfo.size.x / winfo.max_formspec_size.x
+ for i, ss in ipairs(screenshots) do
+ local path = get_screenshot(package, ss.url, 2)
+ hypertext = hypertext .. "
"
+ if i ~= #screenshots then
+ hypertext = hypertext .. "
"
+ end
+ end
+
+ if info then
+ hypertext = hypertext .. "\n" .. info.long_description.head
+
+ local first = true
+ local function add_link_button(label, name)
+ if info[name] then
+ if not first then
+ hypertext = hypertext .. " | "
+ end
+ hypertext = hypertext .. "" .. label .. ""
+ info.long_description.links["link_" .. name] = info[name]
+ first = false
+ end
+ end
+
+ add_link_button(hgettext("Donate"), "donate_url")
+ add_link_button(hgettext("Website"), "website")
+ add_link_button(hgettext("Source"), "repo")
+ add_link_button(hgettext("Issue Tracker"), "issue_tracker")
+ add_link_button(hgettext("Translate"), "translation_url")
+ add_link_button(hgettext("Forum Topic"), "forum_url")
+
+ hypertext = hypertext .. "\n\n" .. info.long_description.body
+
+ elseif loading_error then
+ hypertext = hypertext .. "\n\n" .. hgettext("Error loading package information")
+ else
+ hypertext = hypertext .. "\n\n" .. hgettext("Loading...")
+ end
+
+ -- Fix the path to blank.png. This is needed for bullet indentation,
+ -- and also used for screenshot spacing.
+ hypertext = hypertext:gsub("
\n"
- local winfo = core.get_window_info()
- local fs_to_px = winfo.size.x / winfo.max_formspec_size.x
- for i, ss in ipairs(info.screenshots) do
- local path = get_screenshot(package, ss.url, 2)
- hypertext = hypertext .. "
"
- if i ~= #info.screenshots then
- hypertext = hypertext .. "
"
- end
- end
- hypertext = hypertext .. "\n" .. info.long_description.head
-
- local first = true
- local function add_link_button(label, name)
- if info[name] then
- if not first then
- hypertext = hypertext .. " | "
- end
- hypertext = hypertext .. "" .. core.hypertext_escape(label) .. ""
- info.long_description.links["link_" .. name] = info[name]
- first = false
- end
- end
-
- add_link_button(fgettext("Donate"), "donate_url")
- add_link_button(fgettext("Website"), "website")
- add_link_button(fgettext("Source"), "repo")
- add_link_button(fgettext("Issue Tracker"), "issue_tracker")
- add_link_button(fgettext("Translate"), "translation_url")
- add_link_button(fgettext("Forum Topic"), "forum_url")
-
- hypertext = hypertext .. "\n\n" .. info.long_description.body
-
- -- Fix the path to blank.png. This is needed for bullet indentation.
- hypertext = hypertext:gsub("
[Logo]",
diff --git a/builtin/mainmenu/dlg_rebind_keys.lua b/builtin/mainmenu/dlg_rebind_keys.lua
index d1b442004d..ec4d1357fd 100644
--- a/builtin/mainmenu/dlg_rebind_keys.lua
+++ b/builtin/mainmenu/dlg_rebind_keys.lua
@@ -33,13 +33,13 @@ end
local function buttonhandler(this, fields)
if fields.reconfigure then
+ local parent = this.parent
+
close_dialog(this)
- local maintab = ui.find_by_name("maintab")
-
local dlg = create_settings_dlg("controls_keyboard_and_mouse")
- dlg:set_parent(maintab)
- maintab:hide()
+ dlg:set_parent(parent)
+ parent:hide()
dlg:show()
return true
@@ -74,7 +74,7 @@ local function create_rebind_keys_dlg()
return dlg
end
-function migrate_keybindings()
+function migrate_keybindings(parent)
-- Show migration dialog if the user upgraded from an earlier version
-- and this has not yet been shown before, *or* if keys settings had to be changed
if core.is_first_run then
@@ -95,14 +95,14 @@ function migrate_keybindings()
end
if not has_migration then
- return
+ return parent
end
- local maintab = ui.find_by_name("maintab")
-
local dlg = create_rebind_keys_dlg()
- dlg:set_parent(maintab)
- maintab:hide()
+ dlg:set_parent(parent)
+ parent:hide()
dlg:show()
ui.update()
+
+ return dlg
end
diff --git a/builtin/mainmenu/dlg_reinstall_mtg.lua b/builtin/mainmenu/dlg_reinstall_mtg.lua
index c167b2656e..6c512ea036 100644
--- a/builtin/mainmenu/dlg_reinstall_mtg.lua
+++ b/builtin/mainmenu/dlg_reinstall_mtg.lua
@@ -11,7 +11,7 @@
local SETTING_NAME = "no_mtg_notification"
-function check_reinstall_mtg()
+function check_reinstall_mtg(parent)
-- used to be in minetest.conf
if core.settings:get_bool(SETTING_NAME) then
cache_settings:set_bool(SETTING_NAME, true)
@@ -19,14 +19,14 @@ function check_reinstall_mtg()
end
if cache_settings:get_bool(SETTING_NAME) then
- return
+ return parent
end
local games = core.get_games()
for _, game in ipairs(games) do
if game.id == "minetest" then
cache_settings:set_bool(SETTING_NAME, true)
- return
+ return parent
end
end
@@ -40,16 +40,16 @@ function check_reinstall_mtg()
end
if not mtg_world_found then
cache_settings:set_bool(SETTING_NAME, true)
- return
+ return parent
end
- local maintab = ui.find_by_name("maintab")
-
local dlg = create_reinstall_mtg_dlg()
- dlg:set_parent(maintab)
- maintab:hide()
+ dlg:set_parent(parent)
+ parent:hide()
dlg:show()
ui.update()
+
+ return dlg
end
local function get_formspec(dialogdata)
@@ -74,22 +74,22 @@ end
local function buttonhandler(this, fields)
if fields.reinstall then
+ local parent = this.parent
+
-- Don't set "no_mtg_notification" here so that the dialog will be shown
-- again if downloading MTG fails for whatever reason.
this:delete()
- local maintab = ui.find_by_name("maintab")
-
local dlg = create_contentdb_dlg(nil, "minetest/minetest")
- dlg:set_parent(maintab)
- maintab:hide()
+ dlg:set_parent(parent)
+ parent:hide()
dlg:show()
return true
end
if fields.dismiss then
- cache_settings:set_bool("no_mtg_notification", true)
+ cache_settings:set_bool(SETTING_NAME, true)
this:delete()
return true
end
diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua
index 14185a4843..c1bbc0ae42 100644
--- a/builtin/mainmenu/init.lua
+++ b/builtin/mainmenu/init.lua
@@ -112,8 +112,12 @@ local function init_globals()
tv_main:show()
ui.update()
- check_reinstall_mtg()
- migrate_keybindings()
+ -- synchronous, chain parents to only show one at a time
+ local parent = tv_main
+ parent = migrate_keybindings(parent)
+ check_reinstall_mtg(parent)
+
+ -- asynchronous, will only be shown if we're still on "maintab"
check_new_version()
end
diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt
index 0a6dcd6d1c..e10f5225b5 100644
--- a/builtin/settingtypes.txt
+++ b/builtin/settingtypes.txt
@@ -182,23 +182,17 @@ invert_hotbar_mouse_wheel (Hotbar: Invert mouse wheel direction) bool false
[**Keybindings]
-# Key for moving the player forward.
keymap_forward (Move forward) key SYSTEM_SCANCODE_26
-# Key for moving the player backward.
# Will also disable autoforward, when active.
keymap_backward (Move backward) key SYSTEM_SCANCODE_22
-# Key for moving the player left.
keymap_left (Move left) key SYSTEM_SCANCODE_4
-# Key for moving the player right.
keymap_right (Move right) key SYSTEM_SCANCODE_7
-# Key for jumping.
keymap_jump (Jump) key SYSTEM_SCANCODE_44
-# Key for sneaking.
# Also used for climbing down and descending in water if aux1_descends is disabled.
keymap_sneak (Sneak) key SYSTEM_SCANCODE_225
@@ -210,13 +204,11 @@ keymap_dig (Dig/punch/use) key KEY_LBUTTON
# (Note: The actual meaning might vary on a per-game basis.)
keymap_place (Place/use) key KEY_RBUTTON
-# Key for opening the inventory.
keymap_inventory (Open inventory) key SYSTEM_SCANCODE_12
# Key for moving fast in fast mode.
keymap_aux1 (Aux1) key SYSTEM_SCANCODE_8
-# Key for opening the chat window.
keymap_chat (Open chat) key SYSTEM_SCANCODE_23
# Key for opening the chat window to type commands.
@@ -225,70 +217,48 @@ keymap_cmd (Command) key SYSTEM_SCANCODE_56
# Key for opening the chat window to type local commands.
keymap_cmd_local (Local command) key SYSTEM_SCANCODE_55
-# Key for toggling unlimited view range.
-keymap_rangeselect (Range select) key
+keymap_rangeselect (Toggle unlimited view range) key
-# Key for toggling flying.
keymap_freemove (Toggle fly) key SYSTEM_SCANCODE_14
-# Key for toggling pitch move mode.
keymap_pitchmove (Toggle pitchmove) key
-# Key for toggling fast mode.
keymap_fastmove (Toggle fast) key SYSTEM_SCANCODE_13
-# Key for toggling noclip mode.
keymap_noclip (Toggle noclip) key SYSTEM_SCANCODE_11
-# Key for selecting the next item in the hotbar.
keymap_hotbar_next (Hotbar: select next item) key SYSTEM_SCANCODE_17
-# Key for selecting the previous item in the hotbar.
keymap_hotbar_previous (Hotbar: select previous item) key SYSTEM_SCANCODE_5
-# Key for muting the game.
keymap_mute (Mute) key SYSTEM_SCANCODE_16
-# Key for increasing the volume.
keymap_increase_volume (Increase volume) key
-# Key for decreasing the volume.
keymap_decrease_volume (Decrease volume) key
-# Key for toggling autoforward.
keymap_autoforward (Toggle automatic forward) key
-# Key for toggling cinematic mode.
keymap_cinematic (Toggle cinematic mode) key
-# Key for toggling display of minimap.
keymap_minimap (Toggle minimap) key SYSTEM_SCANCODE_25
-# Key for taking screenshots.
keymap_screenshot (Screenshot) key SYSTEM_SCANCODE_69
-# Key for toggling fullscreen mode.
keymap_fullscreen (Toggle fullscreen) key SYSTEM_SCANCODE_68
-# Key for dropping the currently selected item.
keymap_drop (Drop item) key SYSTEM_SCANCODE_20
-# Key to use view zoom when possible.
keymap_zoom (Zoom) key SYSTEM_SCANCODE_29
-# Key for toggling the display of the HUD.
keymap_toggle_hud (Toggle HUD) key SYSTEM_SCANCODE_58
-# Key for toggling the display of chat.
keymap_toggle_chat (Toggle chat log) key SYSTEM_SCANCODE_59
-# Key for toggling the display of the large chat console.
-keymap_console (Large chat console) key SYSTEM_SCANCODE_67
+keymap_console (Toggle large chat console) key SYSTEM_SCANCODE_67
-# Key for toggling the display of fog.
keymap_toggle_fog (Toggle fog) key SYSTEM_SCANCODE_60
-# Key for toggling the display of debug info.
keymap_toggle_debug (Toggle debug info) key SYSTEM_SCANCODE_62
# Key for toggling the display of the profiler. Used for development.
@@ -297,109 +267,78 @@ keymap_toggle_profiler (Toggle profiler) key SYSTEM_SCANCODE_63
# Key for toggling the display of mapblock boundaries.
keymap_toggle_block_bounds (Toggle block bounds) key
-# Key for switching between first- and third-person camera.
keymap_camera_mode (Toggle camera mode) key SYSTEM_SCANCODE_6
-# Key for increasing the viewing range.
keymap_increase_viewing_range_min (Increase view range) key SYSTEM_SCANCODE_46
-# Key for decreasing the viewing range.
keymap_decrease_viewing_range_min (Decrease view range) key SYSTEM_SCANCODE_45
-# Key for selecting the first hotbar slot.
+# Modifier key bind for closing your world.
+# Requires ESC + the selected key to work.
+keymap_close_world (Return to Main Menu) key
+
keymap_slot1 (Hotbar slot 1) key SYSTEM_SCANCODE_30
-# Key for selecting the second hotbar slot.
keymap_slot2 (Hotbar slot 2) key SYSTEM_SCANCODE_31
-# Key for selecting the third hotbar slot.
keymap_slot3 (Hotbar slot 3) key SYSTEM_SCANCODE_32
-# Key for selecting the fourth hotbar slot.
keymap_slot4 (Hotbar slot 4) key SYSTEM_SCANCODE_33
-# Key for selecting the fifth hotbar slot.
keymap_slot5 (Hotbar slot 5) key SYSTEM_SCANCODE_34
-# Key for selecting the sixth hotbar slot.
keymap_slot6 (Hotbar slot 6) key SYSTEM_SCANCODE_35
-# Key for selecting the seventh hotbar slot.
keymap_slot7 (Hotbar slot 7) key SYSTEM_SCANCODE_36
-# Key for selecting the eighth hotbar slot.
keymap_slot8 (Hotbar slot 8) key SYSTEM_SCANCODE_37
-# Key for selecting the ninth hotbar slot.
keymap_slot9 (Hotbar slot 9) key SYSTEM_SCANCODE_38
-# Key for selecting the tenth hotbar slot.
keymap_slot10 (Hotbar slot 10) key SYSTEM_SCANCODE_39
-# Key for selecting the 11th hotbar slot.
keymap_slot11 (Hotbar slot 11) key
-# Key for selecting the 12th hotbar slot.
keymap_slot12 (Hotbar slot 12) key
-# Key for selecting the 13th hotbar slot.
keymap_slot13 (Hotbar slot 13) key
-# Key for selecting the 14th hotbar slot.
keymap_slot14 (Hotbar slot 14) key
-# Key for selecting the 15th hotbar slot.
keymap_slot15 (Hotbar slot 15) key
-# Key for selecting the 16th hotbar slot.
keymap_slot16 (Hotbar slot 16) key
-# Key for selecting the 17th hotbar slot.
keymap_slot17 (Hotbar slot 17) key
-# Key for selecting the 18th hotbar slot.
keymap_slot18 (Hotbar slot 18) key
-# Key for selecting the 19th hotbar slot.
keymap_slot19 (Hotbar slot 19) key
-# Key for selecting the 20th hotbar slot.
keymap_slot20 (Hotbar slot 20) key
-# Key for selecting the 21st hotbar slot.
keymap_slot21 (Hotbar slot 21) key
-# Key for selecting the 22nd hotbar slot.
keymap_slot22 (Hotbar slot 22) key
-# Key for selecting the 23rd hotbar slot.
keymap_slot23 (Hotbar slot 23) key
-# Key for selecting the 24th hotbar slot.
keymap_slot24 (Hotbar slot 24) key
-# Key for selecting the 25th hotbar slot.
keymap_slot25 (Hotbar slot 25) key
-# Key for selecting the 26th hotbar slot.
keymap_slot26 (Hotbar slot 26) key
-# Key for selecting the 27th hotbar slot.
keymap_slot27 (Hotbar slot 27) key
-# Key for selecting the 28th hotbar slot.
keymap_slot28 (Hotbar slot 28) key
-# Key for selecting the 29th hotbar slot.
keymap_slot29 (Hotbar slot 29) key
-# Key for selecting the 30th hotbar slot.
keymap_slot30 (Hotbar slot 30) key
-# Key for selecting the 31st hotbar slot.
keymap_slot31 (Hotbar slot 31) key
-# Key for selecting the 32nd hotbar slot.
keymap_slot32 (Hotbar slot 32) key
[*Touchscreen]
@@ -2104,11 +2043,11 @@ transparency_sorting_group_by_buffers (Transparency Sorting Group by Buffers) bo
cloud_radius (Cloud radius) int 12 8 62
# Delay between mesh updates on the client in ms. Increasing this will slow
-# down the rate of mesh updates, thus reducing jitter on slower clients.
-mesh_generation_interval (Mapblock mesh generation delay) int 0 0 50
+# down the rate of mesh updates, which can help reduce jitter.
+mesh_generation_interval (Mapblock mesh generation delay) int 0 0 25
# Number of threads to use for mesh generation.
-# Value of 0 (default) will let Luanti autodetect the number of available threads.
+# Value of 0 (default) will let Luanti automatically choose the number of threads.
mesh_generation_threads (Mapblock mesh generation threads) int 0 0 8
# All mesh buffers with less than this number of vertices will be merged
diff --git a/doc/README.md b/doc/README.md
new file mode 100644
index 0000000000..894e5d75df
--- /dev/null
+++ b/doc/README.md
@@ -0,0 +1,60 @@
+# Documentation
+
+This directory contains mostly reference documentation for the Luanti engine.
+For a less prescriptive and more guiding documentation, also look at:
+https://docs.luanti.org
+
+Note that the inner workings of the engine are not well documented. It's most
+often better to read the code.
+
+Markdown files are written in a way that they can also be read in plain text.
+When modifying, please keep it that way!
+
+Here is a list with descriptions of relevant files:
+
+## Server Modding
+
+- [lua_api.md](lua_api.md): Server Modding API reference. (Not only the Lua part,
+ but also file structure and everything else.)
+ If you want to make a mod or game, look here!
+ A rendered version is also available at .
+- [builtin_entities.md](builtin_entities.md): Doc for entities predefined by the
+ engine (in builtin), i.e. dropped items and falling nodes.
+
+## Client-Side Content
+
+- [texture_packs.md](texture_packs.md): Layout and description of Luanti's
+ texture packs structure and configuration.
+- [client_lua_api.md](client_lua_api.md): Client-Provided Client-Side Modding
+ (CPCSM) API reference.
+
+## Mainmenu scripting
+
+- [menu_lua_api.md](menu_lua_api.md): API reference for the mainmenu scripting
+ environment.
+- [fst_api.txt](fst_api.txt): Formspec Toolkit API, included in builtin for the
+ main menu.
+
+## Formats and Protocols
+
+- [world_format.md](world_format.md): Structure of Luanti world directories and
+ format of the files therein.
+ Note: If you want to write your own deserializer, it will be easier to read
+ the `serialize()` and `deSerialize()` functions of the various structures in
+ C++, e.g. `MapBlock::deSerialize()`.
+- [protocol.txt](protocol.txt): *Rough* outline of Luanti's network protocol.
+
+## Misc.
+
+- [compiling/](compiling/): Compilation instructions, and options.
+- [ides/](ides/): Instructions for configuring certain IDEs for engine development.
+- [developing/](developing/): Information about Luanti development.
+ Note: [developing/profiling.md](developing/profiling.md) can be useful for
+ modders and server owners!
+- [android.md](android.md): Android quirks.
+- [direction.md](direction.md): Information related to the future direction of
+ Luanti. Commonly referred to as the roadmap document.
+- [breakages.md](breakages.md): List of planned breakages for the next major
+ release, i.e. 6.0.0.
+- [docker_server.md](docker_server.md): Information about our Docker server
+ images in the ghcr.
diff --git a/doc/android.md b/doc/android.md
index 353a7d1c81..f51bce3ee9 100644
--- a/doc/android.md
+++ b/doc/android.md
@@ -42,7 +42,7 @@ configuration file can usually be found at:
* After 5.4.2:
* `/sdcard/Android/data/net.minetest.minetest/` or `/storage/emulated/0/Android/data/net.minetest.minetest/` if stored on the device
* `/storage/emulated/(varying folder name)/Android/data/net.minetest.minetest/` if stored on the SD card
-* [Learn more about Android directory](https://wiki.luanti.org/Accessing_Android_Data_Directory)
+* [Learn more about Android directory](https://docs.luanti.org/for-players/mobile/)
## Useful settings
diff --git a/doc/breakages.md b/doc/breakages.md
index 412cf2e418..6c9acbd950 100644
--- a/doc/breakages.md
+++ b/doc/breakages.md
@@ -25,3 +25,4 @@ This list is largely advisory and items may be reevaluated once the time comes.
* remove built-in knockback and related functions entirely
* remove `safe` parameter from `core.serialize`, always enforce `safe = true`.
possibly error when `loadstring` calls are encountered in `core.deserialize`.
+* introduce strict type checking for all instances of `v3s16` / `v3f` read from Lua
diff --git a/doc/client_lua_api.md b/doc/client_lua_api.md
index aedf0a4ff8..820e37b59f 100644
--- a/doc/client_lua_api.md
+++ b/doc/client_lua_api.md
@@ -1,12 +1,15 @@
-Luanti Lua Client Modding API Reference 5.12.0
+Luanti Lua Client Modding API Reference 5.14.0
==============================================
**WARNING**: if you're looking for the `minetest` namespace (e.g. `minetest.something`),
it's now called `core` due to the renaming of Luanti (formerly Minetest).
`minetest` will keep existing as an alias, so that old code won't break.
+Note that `core` has already existed since version 0.4.10, so you can use it
+safely without breaking backwards compatibility.
+
* More information at
-* Developer Wiki:
+* Additional documentation:
Introduction
------------
diff --git a/doc/developing/README.md b/doc/developing/README.md
index 419e41edd8..a2d19cd9a7 100644
--- a/doc/developing/README.md
+++ b/doc/developing/README.md
@@ -1,26 +1,27 @@
# Developer documentation
-## Wiki
+## Luanti Documentation
-Some important development docs are found in the wiki: https://dev.luanti.org/
+Some important development docs are found on the docs site: https://docs.luanti.org/
Notable pages:
-- [Releasing Luanti](https://dev.luanti.org/Releasing_Luanti)
-- [Engine translations](https://dev.luanti.org/Translation#Maintaining_engine_translations)
-- [Changelog](https://dev.luanti.org/Changelog)
-- [Organisation](https://dev.luanti.org/Organisation)
-- [Code style guidelines](https://dev.luanti.org/Code_style_guidelines)
+- [Releasing Luanti](https://docs.luanti.org/for-engine-devs/releasing-luanti/)
+- [Engine translations](https://docs.luanti.org/for-creators/translation/)
+- [Changelog](https://docs.luanti.org/about/changelog/)
+- [Organisation](https://docs.luanti.org/for-engine-devs/organization/)
+- [Code style guidelines](https://docs.luanti.org/for-engine-devs/code-style-guidelines/)
+ and [Lua code style guidelines](https://docs.luanti.org/for-engine-devs/lua-code-style-guidelines/)
## In this folder
-- [Developing minetestserver with Docker](docker.md)
-- [Android tips & tricks](android.md)
-- [OS/library compatibility policy](os-compatibility.md)
-- [Miscellaneous](misc.md)
+- [docker.md](docker.md): Developing minetestserver with Docker
+- [android.md](android.md): Android tips & tricks
+- [os-compatibility.md](os-compatibility.md): OS/library compatibility policy
+- [profiling.md](profiling.md): Profiling instructions
## IRC
Oftentimes knowledge hasn't been written down (yet) and your best bet is to ask someone experienced and/or the core developers.
-Feel free to join the [#minetest-dev IRC](https://wiki.luanti.org/IRC) and ask questions related to **engine development**.
+Feel free to join the [#luanti-dev IRC](https://docs.luanti.org/about/irc/) and ask questions related to **engine development**.
diff --git a/doc/developing/misc.md b/doc/developing/profiling.md
similarity index 99%
rename from doc/developing/misc.md
rename to doc/developing/profiling.md
index 5992946cb2..2c334183ba 100644
--- a/doc/developing/misc.md
+++ b/doc/developing/profiling.md
@@ -1,4 +1,4 @@
-# Miscellaneous
+# Profiling
## Profiling Luanti on Linux with perf
diff --git a/doc/direction.md b/doc/direction.md
index bd70003d1a..4119f7d8fc 100644
--- a/doc/direction.md
+++ b/doc/direction.md
@@ -37,7 +37,7 @@ Examples include
[general view distance](https://github.com/luanti-org/luanti/issues/7222).
This includes work on maintaining
-[our Irrlicht fork](https://github.com/minetest/irrlicht), and switching to
+[our Irrlicht fork](https://github.com/luanti-org/luanti/tree/master/irr), and switching to
alternative libraries to replace Irrlicht functionality as needed
### 2.2 Internal code refactoring
diff --git a/doc/fst_api.txt b/doc/fst_api.txt
index c12093d91c..9170ecf8eb 100644
--- a/doc/fst_api.txt
+++ b/doc/fst_api.txt
@@ -3,8 +3,10 @@ Formspec toolkit api 0.0.3
Formspec toolkit is a set of functions to create basic ui elements.
+You can find the files in builtin/fstk/.
-File: fst/ui.lua
+
+File: fstk/ui.lua
----------------
ui.lua adds base ui interface to add additional components to.
@@ -25,7 +27,7 @@ ui.find_by_name(name) --> returns component or nil
^ find a component within ui
^ name: name of component to look for
-File: fst/tabview.lua
+File: fstk/tabview.lua
---------------------
tabview_create(name, size, tabheaderpos) --> returns tabview component
@@ -92,7 +94,7 @@ methods:
* icon: path to icon
* on_click(tabview): callback function
-File: fst/dialog.lua
+File: fstk/dialog.lua
---------------------
Only one dialog can be shown at a time. If a dialog is closed it's parent is
gonna be activated and shown again.
@@ -129,7 +131,7 @@ members:
- parent
^ parent component to return to on exit
-File: fst/buttonbar.lua
+File: fstk/buttonbar.lua
-----------------------
buttonbar_create(name, pos, size, bgcolor, cbf_buttonhandler)
diff --git a/doc/lua_api.md b/doc/lua_api.md
index a814dd9966..b9f02f4f94 100644
--- a/doc/lua_api.md
+++ b/doc/lua_api.md
@@ -5,9 +5,12 @@ Luanti Lua Modding API Reference
it's now called `core` due to the renaming of Luanti (formerly Minetest).
`minetest` will keep existing as an alias, so that old code won't break.
+Note that `core` has already existed since version 0.4.10, so you can use it
+safely without breaking backwards compatibility.
+
* More information at
-* Developer Wiki:
-* (Unofficial) Minetest Modding Book by rubenwardy:
+* Additional documentation:
+* (Unofficial) Luanti Modding Book by rubenwardy:
* Modding tools:
Introduction
@@ -139,7 +142,7 @@ Mods
Mod load path
-------------
-Paths are relative to the directories listed in the [Paths] section above.
+Paths are relative to the directories listed in the [Paths](#paths) section above.
* `games//mods/`
* `mods/`
@@ -258,7 +261,7 @@ It is parsed by the main menu settings dialogue to list mod-specific
settings in the "Mods" category.
`core.settings` can be used to read custom or engine settings.
-See [`Settings`].
+See [Settings](#settings).
### `init.lua`
@@ -270,7 +273,7 @@ registered callbacks.
Media files (textures, sounds, whatever) that will be transferred to the
client and will be available for use by the mod and translation files for
-the clients (see [Translations]). Accepted characters for names are:
+the clients (see [Translations](#translations)). Accepted characters for names are:
a-zA-Z0-9_.-
@@ -281,6 +284,9 @@ Accepted formats are:
models: .x, .b3d, .obj, (since version 5.10:) .gltf, .glb
fonts: .ttf, .woff (both since version 5.11, see notes below)
+Currently the engine is unable to handle files over ~16MB in size. For best
+performance you should keep your media files as small as reasonably possible.
+
Other formats won't be sent to the client (e.g. you can store .blend files
in a folder for convenience, without the risk that such files are transferred)
@@ -303,15 +309,14 @@ The .x, .b3d and .gltf formats additionally support (a single) animation.
#### glTF
-The glTF model file format for now only serves as a
-more modern alternative to the other static model file formats;
-it unlocks no special rendering features.
-
Binary glTF (`.glb`) files are supported and recommended over `.gltf` files
due to their space savings.
Bone weights should be normalized, e.g. using ["normalize all" in Blender](https://docs.blender.org/manual/en/4.2/grease_pencil/modes/weight_paint/weights_menu.html#normalize-all).
+Note that nodes using matrix transforms must not be animated.
+This also extends to bone overrides, which must not be applied to them.
+
You can use the [Khronos glTF validator](https://github.com/KhronosGroup/glTF-Validator)
to check whether a model is a valid glTF file.
@@ -1287,8 +1292,8 @@ These sound-groups are played back by the engine if provided.
Registered definitions
======================
-Anything added using certain [Registration functions] gets added to one or more
-of the global [Registered definition tables].
+Anything added using certain [Registration functions](#registration-functions) gets added to one or more
+of the global [Registered definition tables](#registered-definition-tables)
Note that in some cases you will stumble upon things that are not contained
in these tables (e.g. when a mod has been removed). Always check for
@@ -1321,7 +1326,7 @@ The definition of a node is stored and can be accessed by using
core.registered_nodes[node.name]
```
-See [Registered definitions].
+See [Node definition](#node-definition)
Nodes are passed by value between Lua and the engine.
They are represented by a table:
@@ -1486,7 +1491,7 @@ The function of `param2` is determined by `paramtype2` in node definition.
* `param2` will not be used by the engine and can be used to store
an arbitrary value
-Nodes can also contain extra data. See [Node Metadata].
+Nodes can also contain extra data. See [Node Metadata](#node-metadata)
Node drawtypes
--------------
@@ -1578,7 +1583,7 @@ There are a bunch of different looking node types.
* `nodebox`
* Often used for stairs and slabs.
* Allows defining nodes consisting of an arbitrary number of boxes.
- * See [Node boxes] below for more information.
+ * See [Node boxes](#node-boxes) below for more information.
* `mesh`
* Uses models for nodes.
* Tiles should hold model materials textures.
@@ -1960,7 +1965,7 @@ Vector (ie. a position)
vector.new(x, y, z)
```
-See [Spatial Vectors] for details.
+See [Spatial Vectors](#spatial-vectors) for details.
`pointed_thing`
---------------
@@ -2168,10 +2173,10 @@ An apple:
{name="default:apple", count=1, wear=0, metadata=""}
```
-### `ItemStack`
+### `ItemStack` format
A native C++ format with many helper methods. Useful for converting
-between formats. See the [Class reference] section for details.
+between formats. See the [Class Reference](#class-reference) section for details.
@@ -2227,7 +2232,7 @@ Groups of entities
For entities, groups are, as of now, used only for calculating damage.
The rating is the percentage of damage caused by items with this damage group.
-See [Entity damage mechanism].
+See [Entity damage mechanism](#entity-damage-mechanism).
```lua
object:get_armor_groups() --> a group-rating table (e.g. {fleshy=100})
@@ -2348,7 +2353,7 @@ to games.
from destroyed nodes.
* `0` is something that is directly accessible at the start of gameplay
* There is no upper limit
- * See also: `leveldiff` in [Tool Capabilities]
+ * See also: `leveldiff` in [Tool Capabilities](#tool-capabilities)
* `slippery`: Players and items will slide on the node.
Slipperiness rises steadily with `slippery` value, starting at 1.
@@ -2509,7 +2514,7 @@ so a digging time of 0.01 is actually faster than a digging time of 0.
### Damage groups
-List of damage for groups of entities. See [Entity damage mechanism].
+List of damage for groups of entities. See [Entity damage mechanism](#entity-damage-mechanism).
### Punch attack uses (tools only)
@@ -2631,7 +2636,7 @@ Node Metadata
-------------
The instance of a node in the world normally only contains the three values
-mentioned in [Nodes]. However, it is possible to insert extra data into a node.
+mentioned in [Nodes](#nodes). However, it is possible to insert extra data into a node.
It is called "node metadata"; See `NodeMetaRef`.
Node metadata contains two things:
@@ -2643,7 +2648,7 @@ Some of the values in the key-value store are handled specially:
* `formspec`: Defines an inventory menu that is opened with the
'place/use' key. Only works if no `on_rightclick` was
- defined for the node. See also [Formspec].
+ defined for the node. See also [Formspec](#formspec).
* `infotext`: Text shown on the screen when the node is pointed at.
Line-breaks will be applied automatically.
If the infotext is very long, it will be truncated.
@@ -2691,16 +2696,17 @@ meta:from_table({
Item Metadata
-------------
-Item stacks can store metadata too. See [`ItemStackMetaRef`].
+Item stacks can store metadata too. See [`ItemStackMetaRef`](#itemstackmetaref)
+Note: They are not able to store the character `"\1"`, be very careful when storing binary data in them
Item metadata only contains a key-value store.
Some of the values in the key-value store are handled specially:
* `description`: Set the item stack's description.
- See also: `get_description` in [`ItemStack`]
+ See also: `get_description` in [`ItemStack`](#itemstack)
* `short_description`: Set the item stack's short description.
- See also: `get_short_description` in [`ItemStack`]
+ See also: `get_short_description` in [`ItemStack`](#itemstack)
* `inventory_image`: Override inventory_image
* `inventory_overlay`: Override inventory_overlay
* `wield_image`: Override wield_image
@@ -2791,7 +2797,7 @@ control characters. For values, escape sequences used by the engine are an excep
**WARNING**: Luanti allows you to add elements to every single formspec instance
using `player:set_formspec_prepend()`, which may be the reason backgrounds are
appearing when you don't expect them to, or why things are styled differently
-to normal. See [`no_prepend[]`] and [Styling Formspecs].
+to normal. See [`no_prepend[]`] and [Styling Formspecs](#styling-formspecs).
Examples
--------
@@ -2845,6 +2851,8 @@ Version History
* Formspec version 9 (5.12.0)
* Add allow_close[]
* label[]: Add "area label" variant
+* Formspec version 10 (5.13.0)
+ * model[]: Support floating-point frames
Elements
--------
@@ -2857,7 +2865,7 @@ Elements
* Clients older than this version can neither show newer elements nor display
elements with new arguments correctly.
* Available since feature `formspec_version_element`.
-* See also: [Version History]
+* See also: [Version History](#version-history).
### `size[,,]`
@@ -2976,7 +2984,7 @@ Elements
`starting item index`.
* **Note**: With the new coordinate system, the spacing between inventory
slots is one-fourth the size of an inventory slot by default. Also see
- [Styling Formspecs] for changing the size of slots and spacing.
+ [Styling Formspecs](#styling-formspecs) for changing the size of slots and spacing.
### `listring[;]`
@@ -3032,7 +3040,7 @@ Elements
### `animated_image[,;,;;;;;;]`
* Show an animated image. The image is drawn like a "vertical_frames" tile
- animation (See [Tile animation definition]), but uses a frame count/duration for simplicity
+ animation (See [Tile animation definition](#tile-animation-definition)), but uses a frame count/duration for simplicity
* `name`: Element name to send when an event occurs. The event value is the index of the current frame.
* `texture name`: The image to use.
* `frame count`: The number of frames animating the image.
@@ -3464,7 +3472,7 @@ Elements
* If a state is provided, the style will only take effect when the element is in that state.
* All provided states must be active for the style to apply.
* Note: this **must** be before the element is defined.
-* See [Styling Formspecs].
+* See [Styling Formspecs](#styling-formspecs).
### `style_type[,,...;;;...]`
@@ -3476,7 +3484,7 @@ Elements
* `state` is a list of states separated by the `+` character.
* If a state is provided, the style will only take effect when the element is in that state.
* All provided states must be active for the style to apply.
-* See [Styling Formspecs].
+* See [Styling Formspecs](#styling-formspecs).
### `set_focus[;]`
@@ -3928,6 +3936,32 @@ The following functions provide escape sequences:
* Removes all color escape sequences.
+Coordinate System
+=================
+
+Luanti uses a **left-handed** coordinate system: Y is "up", X is "right", Z is "forward".
+This is the convention used by Unity, DirectX and Irrlicht.
+It means that when you're pointing in +Z direction in-game ("forward"), +X is to your right; +Y is up.
+
+Consistently, rotation is [**left-handed**](https://en.wikipedia.org/w/index.php?title=Right-hand_rule) as well.
+Luanti uses [Tait-Bryan angles](https://en.wikipedia.org/wiki/Euler_angles#Tait%E2%80%93Bryan_angles) for rotations,
+often referred to simply as "euler angles" (even though they are not "proper" euler angles).
+The rotation order is extrinsic X-Y-Z:
+First rotation around the (unrotated) X-axis is applied,
+then rotation around the (unrotated) Y-axis follows,
+and finally rotation around the (unrotated) Z-axis is applied.
+(Note: As a product of rotation matrices, this will be written in reverse, so `Z*Y*X`.)
+
+Attachment and bone override rotations both use these conventions.
+
+There is an exception, however: Object rotation (`ObjectRef:set_rotation`, `ObjectRef:get_rotation`, `automatic_rotate`)
+**does not** use left-handed (extrinsic) X-Y-Z rotations.
+Instead, it uses **right-handed (extrinsic) Z-X-Y** rotations:
+First roll (Z) is applied, then pitch (X); yaw (Y) is applied last.
+
+See [Scratchapixel](https://www.scratchapixel.com/lessons/mathematics-physics-for-computer-graphics/geometry/coordinate-systems.html)
+or [Wikipedia](https://en.wikipedia.org/wiki/Cartesian_coordinate_system#Orientation_and_handedness)
+for a more detailed and pictorial explanation of these terms.
Spatial Vectors
@@ -4045,7 +4079,7 @@ vectors are written like this: `(x, y, z)`:
* At a multiple of 0.5, rounds away from zero.
* `vector.sign(v, tolerance)`:
* Returns a vector where `math.sign` was called for each component.
- * See [Helper functions] for details.
+ * See [Helper functions](#helper-functions) for details.
* `vector.abs(v)`:
* Returns a vector with absolute values for each component.
* `vector.apply(v, func, ...)`:
@@ -4127,6 +4161,7 @@ angles in radians.
* `vector.rotate(v, r)`:
* Applies the rotation `r` to `v` and returns the result.
+ * Uses (extrinsic) Z-X-Y rotation order and is right-handed, consistent with `ObjectRef:set_rotation`.
* `vector.rotate(vector.new(0, 0, 1), r)` and
`vector.rotate(vector.new(0, 1, 0), r)` return vectors pointing
forward and up relative to an entity's rotation `r`.
@@ -4445,7 +4480,7 @@ The file should be a text file, with the following format:
* All other empty lines or lines beginning with `#` are ignored.
* Other lines should be in the format `original=translated`. Both `original`
and `translated` can contain escape sequences beginning with `@` to insert
- arguments, literal `@`, `=` or newline (See [Escapes] below).
+ arguments, literal `@`, `=` or newline (See [Escapes](#escapes) below).
There must be no extraneous whitespace around the `=` or at the beginning or
the end of the line.
@@ -4581,11 +4616,13 @@ and offset the noise variation.
The final fractal value noise variation is created as follows:
+```
noise = offset + scale * (octave1 +
octave2 * persistence +
octave3 * persistence ^ 2 +
octave4 * persistence ^ 3 +
...)
+```
Noise Parameters
----------------
@@ -4699,11 +4736,13 @@ with restraint.
The absolute value of each octave's noise variation is used when combining the
octaves. The final value noise variation is created as follows:
+```
noise = offset + scale * (abs(octave1) +
abs(octave2) * persistence +
abs(octave3) * persistence ^ 2 +
abs(octave4) * persistence ^ 3 +
...)
+```
### Format example
@@ -4851,7 +4890,7 @@ The parameters `clust_num_ores`, `clust_size`, `noise_threshold` and
Ore attributes
--------------
-See section [Flag Specifier Format].
+See section [Flag Specifier Format](#flag-specifier-format).
Currently supported flags:
`puff_cliffs`, `puff_additive_composition`.
@@ -4946,7 +4985,7 @@ About probability values:
Schematic attributes
--------------------
-See section [Flag Specifier Format].
+See section [Flag Specifier Format](#flag-specifier-format).
Currently supported flags: `place_center_x`, `place_center_y`, `place_center_z`,
`force_placement`.
@@ -4998,7 +5037,8 @@ A VoxelManip object can be created any time using either:
If the optional position parameters are present for either of these routines,
the specified region will be pre-loaded into the VoxelManip object on creation.
Otherwise, the area of map you wish to manipulate must first be loaded into the
-VoxelManip object using `VoxelManip:read_from_map()`.
+VoxelManip object using `VoxelManip:read_from_map()`, or an empty one created
+with `VoxelManip:initialize()`.
Note that `VoxelManip:read_from_map()` returns two position vectors. The region
formed by these positions indicate the minimum and maximum (respectively)
@@ -5009,17 +5049,17 @@ be queried any time after loading map data with `VoxelManip:get_emerged_area()`.
Now that the VoxelManip object is populated with map data, your mod can fetch a
copy of this data using either of two methods. `VoxelManip:get_node_at()`,
which retrieves an individual node in a MapNode formatted table at the position
-requested is the simplest method to use, but also the slowest.
+requested. This is the simplest method to use, but also the slowest.
Nodes in a VoxelManip object may also be read in bulk to a flat array table
using:
* `VoxelManip:get_data()` for node content (in Content ID form, see section
- [Content IDs]),
-* `VoxelManip:get_light_data()` for node light levels, and
+ [Content IDs](#content-ids),
+* `VoxelManip:get_light_data()` for node param (usually light levels), and
* `VoxelManip:get_param2_data()` for the node type-dependent "param2" values.
-See section [Flat array format] for more details.
+See section [Flat array format](#flat-array-format) for more details.
It is very important to understand that the tables returned by any of the above
three functions represent a snapshot of the VoxelManip's internal state at the
@@ -5031,17 +5071,16 @@ internal state unless otherwise explicitly stated.
Once the bulk data has been edited to your liking, the internal VoxelManip
state can be set using:
-* `VoxelManip:set_data()` for node content (in Content ID form, see section
- [Content IDs]),
-* `VoxelManip:set_light_data()` for node light levels, and
-* `VoxelManip:set_param2_data()` for the node type-dependent `param2` values.
+* `VoxelManip:set_data()` or
+* `VoxelManip:set_light_data()` or
+* `VoxelManip:set_param2_data()`
The parameter to each of the above three functions can use any table at all in
the same flat array format as produced by `get_data()` etc. and is not required
to be a table retrieved from `get_data()`.
Once the internal VoxelManip state has been modified to your liking, the
-changes can be committed back to the map by calling `VoxelManip:write_to_map()`
+changes can be committed back to the map by calling `VoxelManip:write_to_map()`.
### Flat array format
@@ -5073,7 +5112,7 @@ and the array index for a position p contained completely in p1..p2 is:
Note that this is the same "flat 3D array" format as
`ValueNoiseMap:get3dMap_flat()`.
-VoxelArea objects (see section [`VoxelArea`]) can be used to simplify calculation
+VoxelArea objects (see section [`VoxelArea`](#voxelarea)) can be used to simplify calculation
of the index for a single point in a flat VoxelManip array.
### Content IDs
@@ -5173,15 +5212,22 @@ inside the VoxelManip.
Methods
-------
-* `read_from_map(p1, p2)`: Loads a chunk of map into the VoxelManip object
+* `read_from_map(p1, p2)`: Loads a part of the map into the VoxelManip object
containing the region formed by `p1` and `p2`.
- * returns actual emerged `pmin`, actual emerged `pmax`
+ * returns actual emerged `pmin`, actual emerged `pmax` (MapBlock-aligned)
* Note that calling this multiple times will *add* to the area loaded in the
VoxelManip, and not reset it.
+* `initialize(p1, p2, [node])`: Clears and resizes the VoxelManip object to
+ comprise the region formed by `p1` and `p2`.
+ * **No data** is read from the map, so you can use this to treat `VoxelManip`
+ objects as general containers of node data.
+ * `node`: if present the data will be filled with this node; if not it will
+ be uninitialized
+ * returns actual emerged `pmin`, actual emerged `pmax` (MapBlock-aligned)
+ * (introduced in 5.13.0)
* `write_to_map([light])`: Writes the data loaded from the `VoxelManip` back to
the map.
- * **important**: data must be set using `VoxelManip:set_data()` before
- calling this.
+ * **important**: you should call `set_data()` before this, or nothing will change.
* if `light` is true, then lighting is automatically recalculated.
The default value is true.
If `light` is false, no light calculations happen, and you should correct
@@ -5242,6 +5288,15 @@ Methods
where the engine will keep the map and the VM in sync automatically.
* Note: this doesn't do what you think it does and is subject to removal. Don't use it!
* `get_emerged_area()`: Returns actual emerged minimum and maximum positions.
+ * "Emerged" does not imply that this region was actually loaded from the map,
+ if `initialize()` has been used.
+* `close()`: Frees the data buffers associated with the VoxelManip object.
+ It will become empty.
+ * Since Lua's garbage collector is not aware of the potentially significant
+ memory behind a VoxelManip, frequent VoxelManip usage can cause the server to
+ run out of RAM. Therefore it's recommend to call this method once you're done
+ with the VoxelManip.
+ * (introduced in 5.13.0)
`VoxelArea`
-----------
@@ -5358,7 +5413,7 @@ Available generation notification types:
* `cave_end`
* `large_cave_begin`
* `large_cave_end`
-* `custom`: data originating from [Mapgen environment] (Lua API)
+* `custom`: data originating from [Mapgen environment](#mapgen-environment) (Lua API)
* This is a table.
* key = user-defined ID (string)
* value = arbitrary Lua value
@@ -5784,6 +5839,8 @@ Utilities
remove_item_match_meta = true,
-- The HTTP API supports the HEAD and PATCH methods (5.12.0)
httpfetch_additional_methods = true,
+ -- objects have get_guid method (5.13.0)
+ object_guids = true,
}
```
@@ -5866,8 +5923,8 @@ Utilities
},
-- Estimated maximum formspec size before Luanti will start shrinking the
- -- formspec to fit. For a fullscreen formspec, use this formspec size and
- -- `padding[0,0]`. `bgcolor[;true]` is also recommended.
+ -- formspec to fit. For a fullscreen formspec, use the size returned by
+ -- this table and `padding[0,0]`. `bgcolor[;true]` is also recommended.
max_formspec_size = {
x = 20,
y = 11.25
@@ -6011,7 +6068,7 @@ Call these functions only at load time!
* `core.register_lbm(lbm definition)`
* `core.register_alias(alias, original_name)`
* Also use this to set the 'mapgen aliases' needed in a game for the core
- mapgens. See [Mapgen aliases] section above.
+ mapgens. See [Mapgen aliases](#mapgen-aliases) section above.
* `core.register_alias_force(alias, original_name)`
* `core.register_ore(ore definition)`
* Returns an integer object handle uniquely identifying the registered
@@ -6073,7 +6130,7 @@ Call these functions only at load time!
* Unregisters a chatcommands registered with `register_chatcommand`.
* `core.register_privilege(name, definition)`
* `definition` can be a description or a definition table (see [Privilege
- definition]).
+ definition](#privilege-definition)).
* If it is a description, the priv will be granted to singleplayer and admin
by default.
* To allow players with `basic_privs` to grant, see the `basic_privs`
@@ -6116,7 +6173,7 @@ Call these functions only at load time!
* Called after generating a piece of world between `minp` and `maxp`.
* **Avoid using this** whenever possible. As with other callbacks this blocks
the main thread and introduces noticeable latency.
- Consider [Mapgen environment] for an alternative.
+ Consider [Mapgen environment](#mapgen-environment) for an alternative.
* `core.register_on_newplayer(function(ObjectRef))`
* Called when a new player enters the world for the first time
* `core.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage))`
@@ -6254,7 +6311,7 @@ Call these functions only at load time!
* `core.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv))`
* Called when `player` crafts something
* `itemstack` is the output
- * `old_craft_grid` contains the recipe (Note: the one in the inventory is
+ * `old_craft_grid` contains the recipe, is a list of `ItemStack`s (Note: the one in the inventory is
cleared).
* `craft_inv` is the inventory with the crafting grid
* Return either an `ItemStack`, to replace the output, or `nil`, to not
@@ -6336,7 +6393,7 @@ Setting-related
---------------
* `core.settings`: Settings object containing all of the settings from the
- main config file (`minetest.conf`). See [`Settings`].
+ main config file (`minetest.conf`). See [`Settings`](#settings).
* `core.setting_get_pos(name)`: Loads a setting from the main settings and
parses it as a position (in the format `(1,2,3)`). Returns a position or nil. **Deprecated: use `core.settings:get_pos()` instead**
@@ -6379,7 +6436,7 @@ Authentication
* `core.get_auth_handler()`: Return the currently active auth handler
* Must be called *after* load time, to ensure that any custom auth handler was
already registered.
- * See the [Authentication handler definition]
+ * See the [Authentication handler definition](#authentication-handler-definition)
* Use this to e.g. get the authentication data for a player:
`local auth_data = core.get_auth_handler().get_auth(playername)`
* `core.notify_authentication_modified(name)`
@@ -6455,6 +6512,11 @@ Environment access
* `core.get_node_or_nil(pos)`
* Same as `get_node` but returns `nil` for unloaded areas.
* Note that even loaded areas can contain "ignore" nodes.
+* `core.get_node_raw(x, y, z)`
+ * Same as `get_node` but a faster low-level API
+ * Returns `content_id`, `param1`, `param2`, and `pos_ok`
+ * The `content_id` can be mapped to a name using `core.get_name_from_content_id()`
+ * If `pos_ok` is false, the area is unloaded and `content_id == core.CONTENT_IGNORE`
* `core.get_node_light(pos[, timeofday])`
* Gets the light value at the given position. Note that the light value
"inside" the node at the given position is returned, so you usually want
@@ -6560,21 +6622,19 @@ Environment access
* `core.get_value_noise(noiseparams)`
* Return world-specific value noise.
* The actual seed used is the noiseparams seed plus the world seed.
+ * **Important**: Requires the mapgen environment to be initalized, do not use at load time.
* `core.get_value_noise(seeddiff, octaves, persistence, spread)`
* Deprecated: use `core.get_value_noise(noiseparams)` instead.
- * Return world-specific value noise
* `core.get_perlin(noiseparams)`
- * Deprecated: use `core.get_value_noise(noiseparams)` instead.
- * Return world-specific value noise (was not Perlin noise)
+ * Deprecated: renamed to `core.get_value_noise` in version 5.12.0.
* `core.get_perlin(seeddiff, octaves, persistence, spread)`
- * Deprecated: use `core.get_value_noise(noiseparams)` instead.
- * Return world-specific value noise (was not Perlin noise)
+ * Deprecated: renamed to `core.get_value_noise` in version 5.12.0.
* `core.get_voxel_manip([pos1, pos2])`
* Return voxel manipulator object.
* Loads the manipulator from the map if positions are passed.
* `core.set_gen_notify(flags, [deco_ids], [custom_ids])`
* Set the types of on-generate notifications that should be collected.
- * `flags`: flag field, see [`gennotify`] for available generation notification types.
+ * `flags`: flag field, see [`gennotify`](#gennotify) for available generation notification types.
* The following parameters are optional:
* `deco_ids` is a list of IDs of decorations which notification
is requested for.
@@ -6588,7 +6648,7 @@ Environment access
* Returns the decoration ID number for the provided decoration name string,
or `nil` on failure.
* `core.get_mapgen_object(objectname)`
- * Return requested mapgen object if available (see [Mapgen objects])
+ * Return requested mapgen object if available (see [Mapgen objects](#mapgen-objects))
* `core.get_heat(pos)`
* Returns the heat at the position, or `nil` on failure.
* `core.get_humidity(pos)`
@@ -6637,6 +6697,9 @@ Environment access
of the *active* mapgen setting `"mapgen_limit"`.
* `chunksize` is an optional number. If it is absent, its value is that
of the *active* mapgen setting `"chunksize"`.
+* `core.get_mapgen_chunksize()`
+ * Returns the currently active chunksize of the mapgen, as a vector.
+ The size is specified in blocks.
* `core.get_mapgen_setting(name)`
* Gets the *active* mapgen setting (or nil if none exists) in string
format with the following order of precedence:
@@ -6665,11 +6728,11 @@ Environment access
active config.
* `core.get_noiseparams(name)`
* Returns a table of the noiseparams for name.
-* `core.generate_ores(vm, pos1, pos2)`
+* `core.generate_ores(vm[, pos1, pos2])`
* Generate all registered ores within the VoxelManip `vm` and in the area
from `pos1` to `pos2`.
* `pos1` and `pos2` are optional and default to mapchunk minp and maxp.
-* `core.generate_decorations(vm, pos1, pos2)`
+* `core.generate_decorations(vm[, pos1, pos2])`
* Generate all registered decorations within the VoxelManip `vm` and in the
area from `pos1` to `pos2`.
* `pos1` and `pos2` are optional and default to mapchunk minp and maxp.
@@ -6816,6 +6879,7 @@ You can find mod channels communication scheme in `doc/mod_channels.png`.
* Server joins channel `channel_name`, and creates it if necessary. You
should listen for incoming messages with
`core.register_on_modchannel_message`
+ * This returns a [ModChannel](#modchannel) object.
Inventory
---------
@@ -6828,7 +6892,7 @@ Inventory
* `{type="detached", name="creative"}`
* `core.create_detached_inventory(name, callbacks, [player_name])`: returns
an `InvRef`.
- * `callbacks`: See [Detached inventory callbacks]
+ * `callbacks`: See [Detached inventory callbacks](#detached-inventory-callbacks)
* `player_name`: Make detached inventory available to one player
exclusively, by default they will be sent to every player (even if not
used).
@@ -6841,16 +6905,21 @@ Inventory
returns leftover ItemStack or nil to indicate no inventory change
* See `core.item_eat` and `core.register_on_item_eat`
-Formspec
+Formspec functions
--------
* `core.show_formspec(playername, formname, formspec)`
* `playername`: name of player to show formspec
* `formname`: name passed to `on_player_receive_fields` callbacks.
- It should follow the `"modname:"` naming convention.
- * `formname` must not be empty, unless you want to reshow
- the inventory formspec without updating it for future opens.
+ * It should follow the `"modname:"` naming convention.
+ * If empty: Shows a custom, temporary inventory formspec.
+ * An inventory formspec shown this way will also be updated if
+ `ObjectRef:set_inventory_formspec` is called.
+ * Use `ObjectRef:set_inventory_formspec` to change the player's
+ inventory formspec for future opens.
+ * Supported if server AND client are both of version >= 5.13.0.
* `formspec`: formspec to display
+ * See also: `core.register_on_player_receive_fields`
* `core.close_formspec(playername, formname)`
* `playername`: name of player to close formspec
* `formname`: has to exactly match the one given in `show_formspec`, or the
@@ -6905,7 +6974,7 @@ Item handling
does not refer to a node or entity.
* If the optional `above` parameter is true and the `pointed_thing` refers
to a node, then it will return the `above` position of the `pointed_thing`.
-* `core.dir_to_facedir(dir, is6d)`
+* `core.dir_to_facedir(dir[, is6d])`
* Convert a vector to a facedir value, used in `param2` for
`paramtype2="facedir"`.
* passing something non-`nil`/`false` for the optional second parameter
@@ -6937,7 +7006,7 @@ Item handling
given `param2` value.
* Returns `nil` if the given `paramtype2` does not contain color
information.
-* `core.get_node_drops(node, toolname[, tool, digger, pos])`
+* `core.get_node_drops(node[, toolname, tool, digger, pos])`
* Returns list of itemstrings that are dropped by `node` when dug with the
item `toolname` (not limited to tools). The default implementation doesn't
use `tool`, `digger`, and `pos`, but these are provided by `core.node_dig`
@@ -7188,7 +7257,7 @@ a Lua environment. Its primary purpose is to allow mods to operate on newly
generated parts of the map to e.g. generate custom structures.
Internally it is referred to as "emerge environment".
-Refer to [Async environment] for the usual disclaimer on what environment isolation entails.
+Refer to [Async environment](#async-environment) for the usual disclaimer on what environment isolation entails.
The map generator threads, which also contain the above mentioned Lua environment,
are initialized after all mods have been loaded by the server. After that the
@@ -7212,7 +7281,7 @@ does not have a global step or timer.
is not necessary and is disallowed.
* `blockseed`: 64-bit seed number used for this chunk
* `core.save_gen_notify(id, data)`
- * Saves data for retrieval using the gennotify mechanism (see [Mapgen objects]).
+ * Saves data for retrieval using the gennotify mechanism (see [Mapgen objects](#mapgen-objects)).
* Data is bound to the chunk that is currently being processed, so this function
only makes sense inside the `on_generated` callback.
* `id`: user-defined ID (a string)
@@ -7449,7 +7518,7 @@ Schematics
* Saves schematic in the Luanti Schematic format to filename.
* `core.place_schematic(pos, schematic, rotation, replacements, force_placement, flags)`
- * Place the schematic specified by schematic (see [Schematic specifier]) at
+ * Place the schematic specified by schematic (see [Schematic specifier](#schematic-specifier)) at
`pos`.
* `rotation` can equal `"0"`, `"90"`, `"180"`, `"270"`, or `"random"`.
* If the `rotation` parameter is omitted, the schematic is not rotated.
@@ -7484,7 +7553,7 @@ Schematics
* `core.serialize_schematic(schematic, format, options)`
* Return the serialized schematic specified by schematic
- (see [Schematic specifier])
+ (see [Schematic specifier](#schematic-specifier))
* in the `format` of either "mts" or "lua".
* "mts" - a string containing the binary MTS data used in the MTS file
format.
@@ -7499,8 +7568,8 @@ Schematics
instead of a tab character.
* `core.read_schematic(schematic, options)`
- * Returns a Lua table representing the schematic (see: [Schematic specifier])
- * `schematic` is the schematic to read (see: [Schematic specifier])
+ * Returns a Lua table representing the schematic (see: [Schematic specifier](#schematic-specifier))
+ * `schematic` is the schematic to read (see: [Schematic specifier](#schematic-specifier))
* `options` is a table containing the following optional parameters:
* `write_yslice_prob`: string value:
* `none`: no `write_yslice_prob` table is inserted,
@@ -7822,8 +7891,12 @@ Global tables
* Values in this table may be modified directly.
Note: changes to initial properties will only affect entities spawned afterwards,
as they are only read when spawning.
+* `core.objects_by_guid`
+ * Map of active object references, indexed by object GUID
* `core.object_refs`
- * Map of object references, indexed by active object id
+ * **Obsolete:** Use `core.objects_by_guid` instead.
+ GUIDs are strictly more useful than active object IDs.
+ * Map of active object references, indexed by active object id
* `core.luaentities`
* Map of Lua entities, indexed by active object id
* `core.registered_abms`
@@ -7852,7 +7925,7 @@ Global tables
### Registered callback tables
-All callbacks registered with [Global callback registration functions] are added
+All callbacks registered with [Global callback registration functions](#global-callback-registration-functions) are added
to corresponding `core.registered_*` tables.
For historical reasons, the use of an -s suffix in these names is inconsistent.
@@ -8069,13 +8142,13 @@ an itemstring, a table or `nil`.
* `get_description()`: returns the description shown in inventory list tooltips.
* The engine uses this when showing item descriptions in tooltips.
* Fields for finding the description, in order:
- * `description` in item metadata (See [Item Metadata].)
+ * `description` in item metadata (See [Item Metadata](#item-metadata).)
* `description` in item definition
* item name
* `get_short_description()`: returns the short description or nil.
* Unlike the description, this does not include new lines.
* Fields for finding the short description, in order:
- * `short_description` in item metadata (See [Item Metadata].)
+ * `short_description` in item metadata (See [Item Metadata](#item-metadata).)
* `short_description` in item definition
* first line of the description (From item meta or def, see `get_description()`.)
* Returns nil if none of the above are set
@@ -8151,8 +8224,8 @@ Can be obtained via `item:get_meta()`.
`MetaDataRef`
-------------
-Base class used by [`StorageRef`], [`NodeMetaRef`], [`ItemStackMetaRef`],
-and [`PlayerMetaRef`].
+Base class used by [`StorageRef`](#storageref), [`NodeMetaRef`](#nodemetaref), [`ItemStackMetaRef`](#itemstackmetaref),
+and [`PlayerMetaRef`](#playermetaref).
Note: If a metadata value is in the format `${k}`, an attempt to get the value
will return the value associated with key `k`. There is a low recursion limit.
@@ -8217,14 +8290,14 @@ metadata_table = {
-- inventory list "main" with 4 slots
main = {
-- list of all item slots
- [1] = "example:dirt",
- [2] = "example:stone 25",
- [3] = "", -- empty slot
- [4] = "example:pickaxe",
+ [1] = ItemStack("example:dirt"),
+ [2] = ItemStack("example:stone 25"),
+ [3] = ItemStack(""), -- empty slot
+ [4] = ItemStack("example:pickaxe"),
},
-- inventory list "hidden" with 1 slot
hidden = {
- [1] = "example:diamond",
+ [1] = ItemStack("example:diamond"),
},
},
}
@@ -8461,9 +8534,9 @@ child will follow movement and rotation of that bone.
* `interpolation`: The old and new overrides are interpolated over this timeframe (in seconds).
* `absolute`: If set to `false` (which is the default),
the override will be relative to the animated property:
- * Translation in the case of `position`;
- * Composition in the case of `rotation`;
- * Per-axis multiplication in the case of `scale`
+ * Translation in the case of `position`;
+ * Composition in the case of `rotation`;
+ * Per-axis multiplication in the case of `scale`
* `property = nil` is equivalent to no override on that property
* **Note:** Unlike `set_bone_position`, the rotation is in radians, not degrees.
* Compatibility note: Clients prior to 5.9.0 only support absolute position and rotation.
@@ -8521,6 +8594,14 @@ child will follow movement and rotation of that bone.
-- Default: false
}
```
+* `get_guid()`: returns a global unique identifier (a string)
+ * For players, this is a player name.
+ * For Lua entities, this is a uniquely generated string, guaranteed not to collide with player names.
+ * example: `@bGh3p2AbRE29Mb4biqX6OA`
+ * GUIDs only use printable ASCII characters.
+ * GUIDs persist between object reloads, and their format is guaranteed not to change.
+ Thus you can use the GUID to identify an object in a particular world online and offline.
+
#### Lua entity only (no-op for other objects)
@@ -8536,9 +8617,10 @@ child will follow movement and rotation of that bone.
* `acc` is a vector
* `get_acceleration()`: returns the acceleration, a vector
* `set_rotation(rot)`
- * Sets the rotation
* `rot` is a vector (radians). X is pitch (elevation), Y is yaw (heading)
and Z is roll (bank).
+ * Sets the **right-handed Z-X-Y** rotation:
+ First roll (Z) is applied, then pitch (X); yaw (Y) is applied last.
* Does not reset rotation incurred through `automatic_rotate`.
Remove & re-add your objects to force a certain rotation.
* `get_rotation()`: returns the rotation, a vector (radians)
@@ -8547,7 +8629,7 @@ child will follow movement and rotation of that bone.
* `set_texture_mod(mod)`
* Set a texture modifier to the base texture, for sprites and meshes.
* When calling `set_texture_mod` again, the previous one is discarded.
- * `mod` the texture modifier. See [Texture modifiers].
+ * `mod` the texture modifier. See [Texture modifiers](#texture-modifiers).
* `get_texture_mod()` returns current texture modifier
* `set_sprite(start_frame, num_frames, framelength, select_x_by_camera)`
* Specifies and starts a sprite animation
@@ -8604,7 +8686,7 @@ child will follow movement and rotation of that bone.
* values:
* `0`: player is drowning
* max: bubbles bar is not shown
- * See [Object properties] for more information
+ * See [Object properties](#object-properties) for more information
* Is limited to range 0 ... 65535 (2^16 - 1)
* `set_fov(fov, is_multiplier, transition_time)`: Sets player's FOV
* `fov`: Field of View (FOV) value.
@@ -8628,9 +8710,12 @@ child will follow movement and rotation of that bone.
* Returns `nil` if no attribute found.
* `get_meta()`: Returns metadata associated with the player (a PlayerMetaRef).
* `set_inventory_formspec(formspec)`
- * Redefine player's inventory form
- * Should usually be called in `on_joinplayer`
+ * Redefines the player's inventory formspec.
+ * Should usually be called at least once in the `on_joinplayer` callback.
* If `formspec` is `""`, the player's inventory is disabled.
+ * If the inventory formspec is currently open on the client, it is
+ updated immediately.
+ * See also: `core.register_on_player_receive_fields`
* `get_inventory_formspec()`: returns a formspec string
* `set_formspec_prepend(formspec)`:
* the formspec string will be added to every formspec shown to the user,
@@ -9085,78 +9170,6 @@ offering very strong randomness.
* `get_state()`: return generator state encoded in string
* `set_state(state_string)`: restore generator state from encoded string
-`ValueNoise`
--------------
-
-A value noise generator.
-It can be created via `ValueNoise()` or `core.get_value_noise()`.
-For legacy reasons, it can also be created via `PerlinNoise()` or `core.get_perlin()`,
-but the implemented noise is not Perlin noise.
-For `core.get_value_noise()`, the actual seed used is the noiseparams seed
-plus the world seed, to create world-specific noise.
-
-* `ValueNoise(noiseparams)
-* `ValueNoise(seed, octaves, persistence, spread)` (Deprecated)
-* `PerlinNoise(noiseparams)` (Deprecated)
-* `PerlinNoise(seed, octaves, persistence, spread)` (Deprecated)
-
-* `core.get_value_noise(noiseparams)`
-* `core.get_value_noise(seeddiff, octaves, persistence, spread)` (Deprecated)
-* `core.get_perlin(noiseparams)` (Deprecated)
-* `core.get_perlin(seeddiff, octaves, persistence, spread)` (Deprecated)
-
-### Methods
-
-* `get_2d(pos)`: returns 2D noise value at `pos={x=,y=}`
-* `get_3d(pos)`: returns 3D noise value at `pos={x=,y=,z=}`
-
-`ValueNoiseMap`
-----------------
-
-A fast, bulk noise generator.
-
-It can be created via `ValueNoiseMap(noiseparams, size)` or
-`core.get_value_noise_map(noiseparams, size)`.
-For legacy reasons, it can also be created via `PerlinNoiseMap(noiseparams, size)`
-or `core.get_perlin_map(noiseparams, size)`, but it is not Perlin noise.
-For `core.get_value_noise_map()`, the actual seed used is the noiseparams seed
-plus the world seed, to create world-specific noise.
-
-Format of `size` is `{x=dimx, y=dimy, z=dimz}`. The `z` component is omitted
-for 2D noise, and it must be larger than 1 for 3D noise (otherwise
-`nil` is returned).
-
-For each of the functions with an optional `buffer` parameter: If `buffer` is
-not nil, this table will be used to store the result instead of creating a new
-table.
-
-### Methods
-
-* `get_2d_map(pos)`: returns a `` times `` 2D array of 2D noise
- with values starting at `pos={x=,y=}`
-* `get_3d_map(pos)`: returns a `` times `` times ``
- 3D array of 3D noise with values starting at `pos={x=,y=,z=}`.
-* `get_2d_map_flat(pos, buffer)`: returns a flat `` element
- array of 2D noise with values starting at `pos={x=,y=}`
-* `get_3d_map_flat(pos, buffer)`: Same as `get2dMap_flat`, but 3D noise
-* `calc_2d_map(pos)`: Calculates the 2d noise map starting at `pos`. The result
- is stored internally.
-* `calc_3d_map(pos)`: Calculates the 3d noise map starting at `pos`. The result
- is stored internally.
-* `get_map_slice(slice_offset, slice_size, buffer)`: In the form of an array,
- returns a slice of the most recently computed noise results. The result slice
- begins at coordinates `slice_offset` and takes a chunk of `slice_size`.
- E.g., to grab a 2-slice high horizontal 2d plane of noise starting at buffer
- offset y = 20:
- `noisevals = noise:get_map_slice({y=20}, {y=2})`
- It is important to note that `slice_offset` offset coordinates begin at 1,
- and are relative to the starting position of the most recently calculated
- noise.
- To grab a single vertical column of noise starting at map coordinates
- x = 1023, y=1000, z = 1000:
- `noise:calc_3d_map({x=1000, y=1000, z=1000})`
- `noisevals = noise:get_map_slice({x=24, z=1}, {x=1, z=1})`
-
`PlayerMetaRef`
---------------
@@ -9208,14 +9221,17 @@ end
The map is loaded as the ray advances. If the map is modified after the
`Raycast` is created, the changes may or may not have an effect on the object.
-It can be created via `Raycast(pos1, pos2, objects, liquids)` or
-`core.raycast(pos1, pos2, objects, liquids)` where:
+It can be created via `Raycast(pos1, pos2, objects, liquids, pointabilities)`
+or `core.raycast(pos1, pos2, objects, liquids, pointabilities)` where:
* `pos1`: start of the ray
* `pos2`: end of the ray
-* `objects`: if false, only nodes will be returned. Default is true.
+* `objects`: if false, only nodes will be returned. Default is `true`.
* `liquids`: if false, liquid nodes (`liquidtype ~= "none"`) won't be
- returned. Default is false.
+ returned. Default is `false`.
+* `pointabilities`: Allows overriding the `pointable` property of
+ nodes and objects. Uses the same format as the `pointabilities` property
+ of item definitions. Default is `nil`.
### Limitations
@@ -9331,6 +9347,85 @@ to restrictions of JSON.
* All methods in MetaDataRef
+`ValueNoise`
+-------------
+
+A value noise generator.
+It can be created via `ValueNoise()` or `core.get_value_noise()`.
+For `core.get_value_noise()`, the actual seed used is the noiseparams seed
+plus the world seed, to create world-specific noise.
+
+**Important**: These require the mapgen environment to be initalized, do not use at load time.
+
+* `ValueNoise(noiseparams)`
+* `ValueNoise(seed, octaves, persistence, spread)` (deprecated)
+* `core.get_value_noise(noiseparams)`
+* `core.get_value_noise(seeddiff, octaves, persistence, spread)` (deprecated)
+
+These were previously called `PerlinNoise()` and `core.get_perlin()`, but the
+implemented noise was not Perlin noise. They were renamed in 5.12.0. The old
+names still exist as aliases.
+
+### Methods
+
+* `get_2d(pos)`: returns 2D noise value at `pos={x=,y=}`
+* `get_3d(pos)`: returns 3D noise value at `pos={x=,y=,z=}`
+
+`ValueNoiseMap`
+----------------
+
+A fast, bulk noise generator.
+
+It can be created via `ValueNoiseMap(noiseparams, size)` or
+`core.get_value_noise_map(noiseparams, size)`.
+For `core.get_value_noise_map()`, the actual seed used is the noiseparams seed
+plus the world seed, to create world-specific noise.
+
+These were previously called `PerlinNoiseMap()` and `core.get_perlin_map()`,
+but the implemented noise was not Perlin noise. They were renamed in 5.12.0.
+The old names still exist as aliases.
+
+Format of `size` is `{x=dimx, y=dimy, z=dimz}`. The `z` component is omitted
+for 2D noise, and it must be larger than 1 for 3D noise (otherwise
+`nil` is returned).
+
+For each of the functions with an optional `buffer` parameter: If `buffer` is
+not nil, this table will be used to store the result instead of creating a new
+table.
+
+**Important**: These require the mapgen environment to be initalized, do not use at load time.
+
+### Methods
+
+* `get_2d_map(pos)`: returns a `` times `` 2D array of 2D noise
+ with values starting at `pos={x=,y=}`
+* `get_3d_map(pos)`: returns a `` times `` times ``
+ 3D array of 3D noise with values starting at `pos={x=,y=,z=}`.
+* `get_2d_map_flat(pos, buffer)`: returns a flat `` element
+ array of 2D noise with values starting at `pos={x=,y=}`
+* `get_3d_map_flat(pos, buffer)`: Same as `get2dMap_flat`, but 3D noise
+* `calc_2d_map(pos)`: Calculates the 2d noise map starting at `pos`. The result
+ is stored internally.
+* `calc_3d_map(pos)`: Calculates the 3d noise map starting at `pos`. The result
+ is stored internally.
+* `get_map_slice(slice_offset, slice_size, buffer)`: In the form of an array,
+ returns a slice of the most recently computed noise results. The result slice
+ begins at coordinates `slice_offset` and takes a chunk of `slice_size`.
+ E.g., to grab a 2-slice high horizontal 2d plane of noise starting at buffer
+ offset `y = 20`:
+ ```lua
+ noisevals = noise:get_map_slice({y=20}, {y=2})
+ ```
+ It is important to note that `slice_offset` offset coordinates begin at 1,
+ and are relative to the starting position of the most recently calculated
+ noise.
+ To grab a single vertical column of noise starting at map coordinates
+ `x = 1023, y=1000, z = 1000`:
+ ```lua
+ noise:calc_3d_map({x=1000, y=1000, z=1000})
+ noisevals = noise:get_map_slice({x=24, z=1}, {x=1, z=1})
+ ```
+
@@ -9464,7 +9559,7 @@ Player properties need to be saved manually.
-- (see node sound definition for details).
automatic_rotate = 0,
- -- Set constant rotation in radians per second, positive or negative.
+ -- Set constant right-handed rotation in radians per second, positive or negative.
-- Object rotates along the local Y-axis, and works with set_rotation.
-- Set to 0 to disable constant rotation.
@@ -9794,6 +9889,7 @@ Used by `core.register_node`, `core.register_craftitem`, and
color = "#ffffffff",
-- Color the item is colorized with. The palette overrides this.
+ -- It is a colorspec.
stack_max = 99,
-- Maximum amount of items that can be in a single stack.
@@ -10812,6 +10908,9 @@ See [Ores] section above for essential information.
```lua
{
+ name = "",
+ -- If set, core.registered_ores[that_name] will return this definition.
+
ore_type = "",
-- Supported: "scatter", "sheet", "puff", "blob", "vein", "stratum"
@@ -11011,7 +11110,7 @@ performance and computing power the practical limit is much lower.
Decoration definition
---------------------
-See [Decoration types]. Used by `core.register_decoration`.
+See [Decoration types](#decoration-types). Used by `core.register_decoration`.
```lua
{
@@ -11301,7 +11400,7 @@ HUD Definition
--------------
Since most values have multiple different functions, please see the
-documentation in [HUD] section.
+documentation in [HUD](#hud) section.
Used by `ObjectRef:hud_add`. Returned by `ObjectRef:hud_get`.
@@ -11643,7 +11742,7 @@ section, along with the datatypes they accept.
All properties in this list of type "vec3 range", "float range" or "vec3" can
be animated with `*_tween` tables. For example, `jitter` can be tweened by
setting a `jitter_tween` table instead of (or in addition to) a `jitter`
-table/value.
+table/value. This also applies to the `attract` table.
In this section, a float range is a table defined as so: { min = A, max = B }
A and B are your supplemented values. For a vec3 range this means they are vectors.
@@ -11690,22 +11789,22 @@ Types used are defined in the previous section.
* string `kind`: selects the kind of shape towards which the particles will
be oriented. it must have one of the following values:
- * `"none"`: no attractor is set and the `attractor` table is ignored
+ * `"none"`: no attractor is set and the `attract` table is ignored
* `"point"`: the particles are attracted to a specific point in space.
use this also if you want a sphere-like effect, in combination with
the `radius` property.
* `"line"`: the particles are attracted to an (infinite) line passing
- through the points `origin` and `angle`. use this for e.g. beacon
+ through the point `origin`, with direction specified by `direction`. use this for e.g. beacon
effects, energy beam effects, etc.
* `"plane"`: the particles are attracted to an (infinite) plane on whose
surface `origin` designates a point in world coordinate space. use this
for e.g. particles entering or emerging from a portal.
* float range `strength`: the speed with which particles will move towards
- `attractor`. If negative, the particles will instead move away from that
+ the attractor shape. If negative, the particles will instead move away from that
point.
- * vec3 `origin`: the origin point of the shape towards which particles will
+ * vec3 `origin`: the origin point of the attractor shape towards which particles will
initially be oriented. functions as an offset if `origin_attached` is also
set.
diff --git a/doc/menu_lua_api.md b/doc/menu_lua_api.md
index c0dcc9068e..6b31637b4e 100644
--- a/doc/menu_lua_api.md
+++ b/doc/menu_lua_api.md
@@ -1,4 +1,4 @@
-Luanti Lua Mainmenu API Reference 5.12.0
+Luanti Lua Mainmenu API Reference 5.14.0
========================================
Introduction
@@ -23,8 +23,8 @@ Callbacks
* `core.button_handler(fields)`: called when a button is pressed.
* `fields` = `{name1 = value1, name2 = value2, ...}`
* `core.event_handler(event)`
- * `event`: `"MenuQuit"`, `"KeyEnter"`, `"ExitButton"`, `"EditBoxEnter"` or
- `"FullscreenChange"`
+ * `event`: `"MenuQuit"` (derived from `quit`) or `"FullscreenChange"`
+ The main menu may issue custom events, such as `"Refresh"` (server list).
* `core.on_before_close()`: called before the menu is closed, either to exit or
to join a game
diff --git a/doc/protocol.txt b/doc/protocol.txt
index b0d4a78f76..7aafb0de91 100644
--- a/doc/protocol.txt
+++ b/doc/protocol.txt
@@ -3,7 +3,8 @@ Updated 2011-06-18
A custom protocol over UDP.
Integers are big endian.
-Refer to connection.{h,cpp} for further reference.
+Refer to network/mtp/internal.h, network/networkprotocol.{h,cpp}, and
+server/clientiface.h for further reference.
Initialization:
- A dummy reliable packet with peer_id=PEER_ID_INEXISTENT=0 is sent to the server:
diff --git a/doc/world_format.md b/doc/world_format.md
index c519361d99..909613d0b4 100644
--- a/doc/world_format.md
+++ b/doc/world_format.md
@@ -401,7 +401,7 @@ See below for description.
Luanti will correct lighting in the day light bank when the block at
`(1, 0, 0)` is also loaded.
-Timestamp and node ID mappings were introduced in map format version 29.
+Timestamp and node ID mappings come here if map format version >= 29.
* `u32` timestamp
* Timestamp when last saved, as seconds from starting the game.
* `0xffffffff` = invalid/unknown timestamp, nothing should be done with the time
@@ -482,13 +482,7 @@ Timestamp and node ID mappings were introduced in map format version 29.
* `s32` timeout * 1000
* `s32` elapsed * 1000
-* Since map format version 25:
- * `u8` length of the data of a single timer (always 2+4+4=10)
- * `u16` `num_of_timers`
- * foreach `num_of_timers`:
- * `u16` timer position (`(z*16*16 + y*16 + x)`)
- * `s32` timeout * 1000
- * `s32` elapsed * 1000
+* Map format version >= 25: see below
`u8` static object version:
* Always 0
@@ -516,6 +510,14 @@ Before map format version 29:
* `u16` `name_len`
* `u8[name_len]` `name`
+Since map format version 25, node timers come here:
+ * `u8` length of the data of a single timer (always 2+4+4=10)
+ * `u16` `num_of_timers`
+ * foreach `num_of_timers`:
+ * `u16` timer position (`(z*16*16 + y*16 + x)`)
+ * `s32` timeout * 1000
+ * `s32` elapsed * 1000
+
End of File (EOF).
# Format of Nodes
@@ -594,9 +596,11 @@ Object types:
* `s32` yaw * 1000
Since protocol version 37:
-* `u8` `version2` (=1)
+* `u8` `version2` (=1 or 2)
* `s32` pitch * 1000
* `s32` roll * 1000
+* if version2 >= 2:
+ * `u8[16]` guid
# Itemstring Format
diff --git a/games/devtest/mods/benchmarks/init.lua b/games/devtest/mods/benchmarks/init.lua
index 8f6bb1ee4a..9397f427d0 100644
--- a/games/devtest/mods/benchmarks/init.lua
+++ b/games/devtest/mods/benchmarks/init.lua
@@ -106,7 +106,7 @@ core.register_chatcommand("bench_bulk_set_node", {
core.chat_send_player(name, "Warming up finished, now benchmarking ...")
local start_time = core.get_us_time()
- for i=1,#pos_list do
+ for i = 1, #pos_list do
core.set_node(pos_list[i], {name = "mapgen_stone"})
end
local middle_time = core.get_us_time()
@@ -116,6 +116,7 @@ core.register_chatcommand("bench_bulk_set_node", {
((middle_time - start_time)) / 1000,
((end_time - middle_time)) / 1000
)
+ print(msg)
return true, msg
end,
})
@@ -129,16 +130,13 @@ core.register_chatcommand("bench_bulk_get_node", {
return false, "No player."
end
local pos_list = get_positions_cube(player:get_pos())
+ local dummy = 0
local function bench()
local start_time = core.get_us_time()
- for i=1,#pos_list do
+ for i = 1, #pos_list do
local n = core.get_node(pos_list[i])
- -- Make sure the name lookup is never optimized away.
- -- Table allocation might still be omitted. But only accessing
- -- the name of a node is a common pattern anyways.
- if n.name == "benchmarks:nonexistent_node" then
- error("should never happen")
- end
+ -- Make sure the name lookup is not optimized away (can this even happen?)
+ dummy = dummy + #n.name
end
return core.get_us_time() - start_time
end
@@ -151,6 +149,115 @@ core.register_chatcommand("bench_bulk_get_node", {
local msg = string.format("Benchmark results: core.get_node loop 1: %.2f ms",
result_us / 1000)
+ print(msg)
+ return true, msg
+ end,
+})
+
+core.register_chatcommand("bench_bulk_get_node_raw", {
+ params = "",
+ description = "Benchmark: Bulk-get 99×99×99 nodes with raw API",
+ func = function(name, param)
+ local player = core.get_player_by_name(name)
+ if not player then
+ return false, "No player."
+ end
+ local pos_list = get_positions_cube(player:get_pos())
+ local dummy = 0
+ local function bench()
+ local start_time = core.get_us_time()
+ for i = 1, #pos_list do
+ local pos_i = pos_list[i]
+ local nid = core.get_node_raw(pos_i.x, pos_i.y, pos_i.z)
+ -- Make sure the result is not optimized away
+ dummy = dummy + nid
+ end
+ return core.get_us_time() - start_time
+ end
+
+ core.chat_send_player(name, "Benchmarking core.get_node_raw. Warming up ...")
+ bench()
+
+ core.chat_send_player(name, "Warming up finished, now benchmarking ...")
+ local result_us = bench()
+
+ local msg = string.format("Benchmark results: core.get_node_raw loop 1: %.2f ms",
+ result_us / 1000)
+ print(msg)
+ return true, msg
+ end,
+})
+
+core.register_chatcommand("bench_bulk_get_node_raw2", {
+ params = "",
+ description = "Benchmark: Bulk-get 99×99×99 nodes with raw API and lookup names",
+ func = function(name, param)
+ local player = core.get_player_by_name(name)
+ if not player then
+ return false, "No player."
+ end
+ local pos_list = get_positions_cube(player:get_pos())
+ local dummy = 0
+ local function bench()
+ local start_time = core.get_us_time()
+ for i = 1, #pos_list do
+ local pos_i = pos_list[i]
+ local nid = core.get_node_raw(pos_i.x, pos_i.y, pos_i.z)
+ local name = core.get_name_from_content_id(nid)
+ -- Make sure the name lookup is not optimized away
+ dummy = dummy + #name
+ end
+ return core.get_us_time() - start_time
+ end
+
+ core.chat_send_player(name, "Benchmarking core.get_node_raw+get_name_from_content_id. Warming up ...")
+ bench()
+
+ core.chat_send_player(name, "Warming up finished, now benchmarking ...")
+ local result_us = bench()
+
+ local msg = string.format("Benchmark results: core.get_node_raw+get_name_from_content_id loop 1: %.2f ms",
+ result_us / 1000)
+ print(msg)
+ return true, msg
+ end,
+})
+
+core.register_chatcommand("bench_bulk_get_node_vm", {
+ params = "",
+ description = "Benchmark: Bulk-get 99×99×99 nodes with voxel manipulator",
+ func = function(name, param)
+ local player = core.get_player_by_name(name)
+ if not player then
+ return false, "No player."
+ end
+ local pos = player:get_pos()
+ local dummy = 0
+ local function bench()
+ local start_time = core.get_us_time()
+ local vm = core.get_voxel_manip(pos:offset(1,1,1), pos:offset(100,100,100))
+ local data = vm:get_data()
+ local mid_time = core.get_us_time()
+ -- Note that the VManip will actually retrieve more than just the 100³ nodes
+ -- and also we don't need to iterate pos_list here, so it's not an entirely
+ -- fair comparison.
+ for i = 1, 99*99*99 do
+ local nid = data[i]
+ -- Make sure the table lookup is not optimized away
+ dummy = dummy + nid
+ end
+ return core.get_us_time() - start_time, mid_time - start_time
+ end
+
+ core.chat_send_player(name, "Benchmarking core.get_voxel_vmanip+get_data+loop . Warming up ...")
+ bench()
+
+ core.chat_send_player(name, "Warming up finished, now benchmarking ...")
+ local result_us, get_data_us = bench()
+
+ local msg = string.format("Benchmark results: core.get_voxel_vmanip+get_data+loop loop 1: %.2f ms of which get_data() %.2f ms",
+ result_us / 1000, get_data_us / 1000)
+ print(msg)
return true, msg
end,
})
@@ -174,7 +281,7 @@ core.register_chatcommand("bench_bulk_swap_node", {
core.chat_send_player(name, "Warming up finished, now benchmarking ...")
local start_time = core.get_us_time()
- for i=1,#pos_list do
+ for i = 1, #pos_list do
core.swap_node(pos_list[i], {name = "mapgen_stone"})
end
local middle_time = core.get_us_time()
@@ -184,6 +291,7 @@ core.register_chatcommand("bench_bulk_swap_node", {
((middle_time - start_time)) / 1000,
((end_time - middle_time)) / 1000
)
+ print(msg)
return true, msg
end,
})
diff --git a/games/devtest/mods/testentities/models/LICENSE.txt b/games/devtest/mods/testentities/models/LICENSE.txt
index 19ffffc5cc..6ec445db69 100644
--- a/games/devtest/mods/testentities/models/LICENSE.txt
+++ b/games/devtest/mods/testentities/models/LICENSE.txt
@@ -12,4 +12,10 @@ Jordach (CC BY-SA 3.0):
Zeg9 (CC BY-SA 3.0):
testentities_lava_flan.x
- testentities_lava_flan.png
\ No newline at end of file
+ testentities_lava_flan.png
+
+"Cool Guy":
+
+hecks (refer to irr/LICENSE):
+ testentities_cool_guy.x
+ testentities_cool_guy.png
diff --git a/games/devtest/mods/testentities/models/testentities_cool_guy.png b/games/devtest/mods/testentities/models/testentities_cool_guy.png
new file mode 100644
index 0000000000..84cc12e442
Binary files /dev/null and b/games/devtest/mods/testentities/models/testentities_cool_guy.png differ
diff --git a/games/devtest/mods/testentities/models/testentities_cool_guy.x b/games/devtest/mods/testentities/models/testentities_cool_guy.x
new file mode 100755
index 0000000000..e806d8315d
--- /dev/null
+++ b/games/devtest/mods/testentities/models/testentities_cool_guy.x
@@ -0,0 +1,2 @@
+xof 0303txt 0032
+AnimationSet{Animation{{Armature}AnimationKey{0;2;0;4;1,0,0,0;;,29;4;1,0,0,0;;;}AnimationKey{2;2;0;3;0,0,0;;,29;3;0,0,0;;;}}Animation{{Armature_knee_r}AnimationKey{0;16;0;4;0.864183,0.503177,0,0;;,1;4;0.829812,0.558043,0,0;;,3;4;0.708698,0.705512,0,0;;,5;4;0.589108,0.808054,0,0;;,7;4;0.593659,0.804717,0,0;;,9;4;0.748627,0.662991,0,0;;,11;4;0.910305,0.413938,0,0;;,13;4;0.975925,0.218107,0,0;;,15;4;0.981302,0.192476,0,0;;,17;4;0.975476,0.220108,0,0;;,19;4;0.963662,0.267124,0,0;;,21;4;0.945893,0.324478,0,0;;,23;4;0.923816,0.382838,0,0;;,25;4;0.901205,0.433394,0,0;;,27;4;0.883429,0.468566,0,0;;,29;4;0.876305,0.481757,0,0;;;}AnimationKey{2;2;0;3;0,0,1.10139;;,29;3;0,0,1.10139;;;}}Animation{{Armature_elbow_r}AnimationKey{0;16;0;4;0.756295,0.004619,-0.619265,0.210967;;,1;4;0.771977,0.005599,-0.60257,0.202311;;,3;4;0.825501,0.009164,-0.538259,0.169533;;,5;4;0.891859,0.014253,-0.436142,0.119019;;,7;4;0.949154,0.019821,-0.308768,0.058108;;,9;4;0.983251,0.024703,-0.18057,-0.001258;;,11;4;0.995416,0.028143,-0.07812,-0.047458;;,13;4;0.996672,0.02991,-0.020368,-0.073041;;,15;4;0.996672,0.02991,-0.020368,-0.073041;;,17;4;0.995416,0.028143,-0.07812,-0.047458;;,19;4;0.983251,0.024703,-0.18057,-0.001258;;,21;4;0.949154,0.019821,-0.308768,0.058108;;,23;4;0.891859,0.014253,-0.436142,0.119019;;,25;4;0.825501,0.009164,-0.538259,0.169533;;,27;4;0.771977,0.005599,-0.60257,0.202311;;,29;4;0.750682,0.004275,-0.625038,0.213976;;;}AnimationKey{2;2;0;3;0,0,0.754892;;,29;3;0,0,0.754892;;;}}Animation{{Armature_arm_r}AnimationKey{0;16;0;4;0.28219,0.629905,0.723388,-0.017285;;,1;4;0.277641,0.632543,0.722699,-0.022614;;,3;4;0.261375,0.641615,0.719924,-0.041507;;,5;4;0.238321,0.653533,0.715186,-0.067874;;,7;4;0.212026,0.665838,0.708676,-0.097381;;,9;4;0.186345,0.676585,0.701229,-0.125643;;,11;4;0.165298,0.684491,0.694351,-0.14841;;,13;4;0.152894,0.688778,0.68998,-0.161665;;,15;4;0.152894,0.688779,0.68998,-0.161665;;,17;4;0.165298,0.684491,0.694351,-0.14841;;,19;4;0.186345,0.676585,0.701229,-0.125643;;,21;4;0.212026,0.665838,0.708676,-0.097381;;,23;4;0.238321,0.653533,0.715186,-0.067874;;,25;4;0.261375,0.641615,0.719924,-0.041507;;,27;4;0.277641,0.632543,0.722699,-0.022614;;,29;4;0.283802,0.628959,0.723623,-0.015394;;;}AnimationKey{2;2;0;3;-0.545315,0,1;;,29;3;-0.545315,0,1;;;}}Animation{{Armature_knee_l}AnimationKey{0;16;0;4;0.981896,0.189423,0,0;;,1;4;0.9814,0.191974,0,0;;,3;4;0.979127,0.203251,0,0;;,5;4;0.974526,0.224276,0,0;;,7;4;0.96645,0.256853,0,0;;,9;4;0.953088,0.302692,0,0;;,11;4;0.931731,0.36315,0,0;;,13;4;0.898645,0.438676,0,0;;,15;4;0.848226,0.529634,0,0;;,17;4;0.773692,0.633562,0,0;;,19;4;0.689831,0.72397,0,0;;,21;4;0.629304,0.777159,0,0;;,23;4;0.648685,0.761057,0,0;;,25;4;0.812268,0.583284,0,0;;,27;4;0.948066,0.318074,0,0;;,29;4;0.982049,0.188624,0,0;;;}AnimationKey{2;2;0;3;0,0,1.10139;;,29;3;0,0,1.10139;;;}}Animation{{Armature_Bone_007}AnimationKey{0;16;0;4;0.993671,-0.112331,0,0;;,1;4;0.994784,-0.102002,0,0;;,3;4;0.997507,-0.070564,0,0;;,5;4;0.999237,-0.039056,0,0;;,7;4;0.999694,-0.024737,0,0;;,9;4;0.999079,-0.042907,0,0;;,11;4;0.99677,-0.080308,0,0;;,13;4;0.993798,-0.111199,0,0;;,15;4;0.993599,-0.112965,0,0;;,17;4;0.995813,-0.091409,0,0;;,19;4;0.998181,-0.060285,0,0;;,21;4;0.999479,-0.032286,0,0;;,23;4;0.999797,-0.020142,0,0;;,25;4;0.998983,-0.045097,0,0;;,27;4;0.995813,-0.091409,0,0;;,29;4;0.993221,-0.116243,0,0;;;}AnimationKey{2;2;0;3;0,0,1.221802;;,29;3;0,0,1.221802;;;}}Animation{{Armature_elbow_l}AnimationKey{0;16;0;4;0.995195,-0.034868,-0.015799,-0.090119;;,1;4;0.993465,-0.046368,-0.030155,-0.099838;;,3;4;0.983557,-0.0879,-0.082099,-0.134715;;,5;4;0.959324,-0.146904,-0.156177,-0.183648;;,7;4;0.917546,-0.212233,-0.238611,-0.236921;;,9;4;0.864109,-0.271657,-0.314022,-0.284443;;,11;4;0.813172,-0.315829,-0.370387,-0.319087;;,13;4;0.781004,-0.339668,-0.400938,-0.337501;;,15;4;0.781004,-0.339668,-0.400938,-0.337501;;,17;4;0.813172,-0.315829,-0.370387,-0.319087;;,19;4;0.864109,-0.271657,-0.314022,-0.284443;;,21;4;0.917546,-0.212233,-0.238611,-0.236921;;,23;4;0.959324,-0.146904,-0.156177,-0.183648;;,25;4;0.983557,-0.0879,-0.082099,-0.134715;;,27;4;0.993465,-0.046368,-0.030155,-0.099838;;,29;4;0.995701,-0.030812,-0.010739,-0.086685;;;}AnimationKey{2;2;0;3;0,0,0.754892;;,29;3;0,0,0.754892;;;}}Animation{{Armature_body}AnimationKey{0;16;0;4;-0,0,0.601298,0.799025;;,1;4;-0,0,0.608144,0.793827;;,3;4;-0,0,0.627465,0.778645;;,5;4;-0,0,0.643183,0.765712;;,7;4;-0,0,0.643755,0.765231;;,9;4;-0,0,0.631076,0.775721;;,11;4;-0,0,0.613775,0.789481;;,13;4;-0,0,0.6007,0.799474;;,15;4;-0,0,0.601488,0.798882;;,17;4;-0,0,0.619499,0.784997;;,19;4;-0,0,0.643196,0.765702;;,21;4;-0,0,0.660441,0.750878;;,23;4;-0,0,0.659666,0.751559;;,25;4;-0,0,0.638264,0.769817;;,27;4;-0,0,0.611752,0.791049;;,29;4;-0,0,0.598631,0.801025;;;}AnimationKey{2;2;0;3;0,2.580534,0;;,29;3;0,2.571201,0;;;}}Animation{{Armature_leg_l}AnimationKey{0;16;0;4;0.390287,0.920693,0,0;;,1;4;0.362565,0.931959,0,0;;,3;4;0.266163,0.963928,0,0;;,5;4;0.138294,0.990391,0,0;;,7;4;0.012725,0.999919,0,0;;,9;4;-0.090194,0.995924,0,0;;,11;4;-0.162502,0.986708,0,0;;,13;4;-0.201466,0.979496,0,0;;,15;4;-0.185641,0.982618,0,0;;,17;4;-0.013697,0.999906,0,0;;,19;4;0.24238,0.970181,0,0;;,21;4;0.417271,0.908782,0,0;;,23;4;0.439308,0.898336,0,0;;,25;4;0.424255,0.905543,0,0;;,27;4;0.407664,0.913132,0,0;;,29;4;0.400263,0.9164,0,0;;;}AnimationKey{2;2;0;3;0.246294,0,-0.171352;;,29;3;0.246294,0,-0.171351;;;}}Animation{{Armature_leg_r}AnimationKey{0;16;0;4;0.174933,-0.98458,0,0;;,1;4;0.082829,-0.996564,0,0;;,3;4;-0.21147,-0.977384,0,0;;,5;4;-0.442802,-0.89662,0,0;;,7;4;-0.47604,-0.879424,0,0;;,9;4;-0.47279,-0.881175,0,0;;,11;4;-0.459567,-0.888143,0,0;;,13;4;-0.427425,-0.904051,0,0;;,15;4;-0.361724,-0.932285,0,0;;,17;4;-0.251362,-0.967893,0,0;;,19;4;-0.114531,-0.99342,0,0;;,21;4;0.021053,-0.999778,0,0;;,23;4;0.12473,-0.992191,0,0;;,25;4;0.181473,-0.983396,0,0;;,27;4;0.204037,-0.978963,0,0;;,29;4;0.208187,-0.978089,0,0;;;}AnimationKey{2;2;0;3;-0.246294,0,-0.171352;;,29;3;-0.246294,0,-0.171351;;;}}Animation{{Armature_arm_l}AnimationKey{0;16;0;4;0.200754,-0.659656,-0.716264,-0.107316;;,1;4;0.192268,-0.660735,-0.716526,-0.114246;;,3;4;0.161871,-0.663925,-0.716753,-0.138802;;,5;4;0.118745,-0.666682,-0.715211,-0.17294;;,7;4;0.069733,-0.667364,-0.710872,-0.210767;;,9;4;0.022313,-0.665594,-0.704111,-0.246404;;,11;4;-0.016046,-0.662426,-0.696821,-0.274543;;,13;4;-0.038374,-0.659874,-0.691824,-0.290643;;,15;4;-0.038373,-0.659874,-0.691824,-0.290643;;,17;4;-0.016044,-0.662427,-0.696822,-0.274543;;,19;4;0.022312,-0.665594,-0.70411,-0.246404;;,21;4;0.069733,-0.667365,-0.710872,-0.210767;;,23;4;0.118745,-0.666682,-0.715211,-0.17294;;,25;4;0.161871,-0.663925,-0.716753,-0.138802;;,27;4;0.192268,-0.660735,-0.716526,-0.114246;;,29;4;0.203757,-0.659255,-0.716151,-0.104856;;;}AnimationKey{2;2;0;3;0.545315,0,1;;,29;3;0.545315,0,1;;;}}}Frame Root{FrameTransformMatrix{1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1;;}Frame Armature{FrameTransformMatrix{1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1;;}Frame Armature_body{FrameTransformMatrix{-1,0,0,0,0,0,1,0,0,1,0,0,0,2.571201,0,1;;}Frame Armature_arm_r{FrameTransformMatrix{-0.047733,0.997488,-0.05233,0,0.901521,0.020464,-0.432251,0,-0.430095,-0.067809,-0.900233,0,-0.545315,0,1,1;;}Frame Armature_elbow_r{FrameTransformMatrix{0.987983,0.151721,-0.029519,0,-0.153228,0.986478,-0.058162,0,0.020295,0.061987,0.997871,0,0,0,0.754892,1;;}}}Frame Armature_arm_l{FrameTransformMatrix{-0.047732,0.994072,-0.097683,0,0.901521,0.084983,0.424309,0,0.430095,-0.067809,-0.900233,0,0.545315,0,1,1;;}Frame Armature_elbow_l{FrameTransformMatrix{0.984741,0.173286,-0.016044,0,-0.171963,0.983073,0.063221,0,0.026727,-0.059497,0.99787,0,0,0,0.754892,1;;}}}Frame Armature_leg_l{FrameTransformMatrix{1,0,0,0,0,-0.998426,-0.056453,0,0,0.056453,-0.998405,0,0.246294,0,-0.171351,1;;}Frame Armature_knee_l{FrameTransformMatrix{1,0,0,0,0,0.993861,-0.110639,0,0,0.110639,0.993861,0,0,0,1.10139,1;;}}}Frame Armature_leg_r{FrameTransformMatrix{1,0,0,0,0,-0.998426,-0.056453,0,0,0.056453,-0.998405,0,-0.246294,0,-0.171351,1;;}Frame Armature_knee_r{FrameTransformMatrix{1,0,0,0,0,0.993861,-0.110639,0,0,0.110639,0.993861,0,0,0,1.10139,1;;}}}Frame Armature_Bone_007{FrameTransformMatrix{1,0,0,0,0,1,0,0,0,0,1,0,0,0,1.221802,1;;}}}Frame cool_dude{FrameTransformMatrix{-1,0,0,0,0,1,0,0,0,0,-1,0,0,0,0,1;;}Mesh{272;0;2.440814;0.219926;,0;3.688199;0.219926;,0.466212;3.688199;0.219926;,0.466212;2.440814;0.219926;,0.466212;2.440814;0.219926;,0.466212;3.688199;0.219926;,0.466212;3.688199;-0.219926;,0.466212;2.440814;-0.219926;,0;2.440814;0.219926;,0.466212;2.440814;0.219926;,0.466212;2.440814;-0.219926;,0;2.440814;-0.219926;,0.055633;1.27575;-0.190081;,0.055633;2.35741;-0.190081;,0.055633;2.35741;0.190081;,0.055633;1.27575;0.190081;,0.055633;1.27575;0.190081;,0.055633;2.35741;0.190081;,0.43017;2.35741;0.190081;,0.43017;1.27575;0.190081;,0.43017;1.27575;0.190081;,0.43017;2.35741;0.190081;,0.43017;2.35741;-0.190081;,0.43017;1.27575;-0.190081;,0.43017;1.27575;-0.190081;,0.43017;2.35741;-0.190081;,0.055633;2.35741;-0.190081;,0.055633;1.27575;-0.190081;,0.055633;1.27575;0.190081;,0.43017;1.27575;0.190081;,0.43017;1.27575;-0.190081;,0.055633;1.27575;-0.190081;,0.43017;2.35741;0.190081;,0.055633;2.35741;0.190081;,0.055633;2.35741;-0.190081;,0.43017;2.35741;-0.190081;,0.466212;3.688199;0.219926;,0;3.688199;0.219926;,0;3.688199;-0.219926;,0.466212;3.688199;-0.219926;,0.466212;2.440814;-0.219926;,0.466212;3.688199;-0.219926;,0;3.688199;-0.219926;,0;2.440814;-0.219926;,0.769341;2.834949;-0.041122;,0.440953;3.555781;-0.041122;,0.440953;3.555781;0.207294;,0.769341;2.834949;0.207294;,0.769341;2.834949;0.207294;,0.440953;3.555781;0.207294;,0.616273;3.635651;0.207294;,0.944661;2.914819;0.207294;,0.944661;2.914819;0.207294;,0.616273;3.635651;0.207294;,0.616273;3.635651;-0.041122;,0.944661;2.914819;-0.041122;,0.944661;2.914819;-0.041122;,0.616273;3.635651;-0.041122;,0.440953;3.555781;-0.041122;,0.769341;2.834949;-0.041122;,0.769341;2.834949;0.207294;,0.944661;2.914819;0.207294;,0.944661;2.914819;-0.041122;,0.769341;2.834949;-0.041122;,0.616273;3.635651;0.207294;,0.440953;3.555781;0.207294;,0.440953;3.555781;-0.041122;,0.616273;3.635651;-0.041122;,1.104504;2.080977;-0.086788;,0.776116;2.801809;-0.086788;,0.776116;2.801809;0.161627;,1.104504;2.080977;0.161627;,1.104504;2.080977;0.161627;,0.776116;2.801809;0.161627;,0.951436;2.881679;0.161627;,1.279824;2.160847;0.161627;,1.279824;2.160847;0.161627;,0.951436;2.881679;0.161627;,0.951436;2.881679;-0.086788;,1.279824;2.160847;-0.086788;,1.279824;2.160847;-0.086788;,0.951436;2.881679;-0.086788;,0.776116;2.801809;-0.086788;,1.104504;2.080977;-0.086788;,1.104504;2.080977;0.161627;,1.279824;2.160847;0.161627;,1.279824;2.160847;-0.086788;,1.104504;2.080977;-0.086788;,0.951436;2.881679;0.161627;,0.776116;2.801809;0.161627;,0.776116;2.801809;-0.086788;,0.951436;2.881679;-0.086788;,0.055633;0.093601;-0.190081;,0.055633;1.205294;-0.190081;,0.055633;1.205294;0.190081;,0.055633;0.093601;0.190081;,0.055633;0.093601;0.190081;,0.055633;1.205294;0.190081;,0.43017;1.205294;0.190081;,0.43017;0.093601;0.190081;,0.43017;0.093601;0.190081;,0.43017;1.205294;0.190081;,0.43017;1.205294;-0.190081;,0.43017;0.093601;-0.190081;,0.43017;0.093601;-0.190081;,0.43017;1.205294;-0.190081;,0.055633;1.205294;-0.190081;,0.055633;0.093601;-0.190081;,0.055633;0.093601;0.190081;,0.43017;0.093601;0.190081;,0.43017;0.093601;-0.190081;,0.055633;0.093601;-0.190081;,0.43017;1.205294;0.190081;,0.055633;1.205294;0.190081;,0.055633;1.205294;-0.190081;,0.43017;1.205294;-0.190081;,0;3.790919;0.428464;,0;4.579204;0.428464;,0.43344;4.560537;0.409797;,0.43344;3.809586;0.409797;,0.43344;3.809586;0.409797;,0.43344;4.560537;0.409797;,0.43344;4.560537;-0.284975;,0.43344;3.809586;-0.284975;,0;3.790919;0.428464;,0.43344;3.809586;0.409797;,0.43344;3.809586;-0.284975;,0;3.790919;-0.303642;,0.43344;4.560537;0.409797;,0;4.579204;0.428464;,0;4.579204;-0.303642;,0.43344;4.560537;-0.284975;,0.43344;3.809586;-0.284975;,0.43344;4.560537;-0.284975;,0;4.579204;-0.303642;,0;3.790919;-0.303642;,0;2.440814;0.219926;,-0.466212;2.440814;0.219926;,-0.466212;3.688199;0.219926;,0;3.688199;0.219926;,-0.466212;2.440814;0.219926;,-0.466212;2.440814;-0.219926;,-0.466212;3.688199;-0.219926;,-0.466212;3.688199;0.219926;,0;2.440814;0.219926;,0;2.440814;-0.219926;,-0.466212;2.440814;-0.219926;,-0.466212;2.440814;0.219926;,-0.055633;1.27575;-0.190081;,-0.055633;1.27575;0.190081;,-0.055633;2.35741;0.190081;,-0.055633;2.35741;-0.190081;,-0.055633;1.27575;0.190081;,-0.43017;1.27575;0.190081;,-0.43017;2.35741;0.190081;,-0.055633;2.35741;0.190081;,-0.43017;1.27575;0.190081;,-0.43017;1.27575;-0.190081;,-0.43017;2.35741;-0.190081;,-0.43017;2.35741;0.190081;,-0.43017;1.27575;-0.190081;,-0.055633;1.27575;-0.190081;,-0.055633;2.35741;-0.190081;,-0.43017;2.35741;-0.190081;,-0.055633;1.27575;0.190081;,-0.055633;1.27575;-0.190081;,-0.43017;1.27575;-0.190081;,-0.43017;1.27575;0.190081;,-0.43017;2.35741;0.190081;,-0.43017;2.35741;-0.190081;,-0.055633;2.35741;-0.190081;,-0.055633;2.35741;0.190081;,-0.466212;3.688199;0.219926;,-0.466212;3.688199;-0.219926;,0;3.688199;-0.219926;,0;3.688199;0.219926;,-0.466212;2.440814;-0.219926;,0;2.440814;-0.219926;,0;3.688199;-0.219926;,-0.466212;3.688199;-0.219926;,-0.769341;2.834949;-0.041122;,-0.769341;2.834949;0.207294;,-0.440953;3.555781;0.207294;,-0.440953;3.555781;-0.041122;,-0.769341;2.834949;0.207294;,-0.944661;2.914819;0.207294;,-0.616273;3.635651;0.207294;,-0.440953;3.555781;0.207294;,-0.944661;2.914819;0.207294;,-0.944661;2.914819;-0.041122;,-0.616273;3.635651;-0.041122;,-0.616273;3.635651;0.207294;,-0.944661;2.914819;-0.041122;,-0.769341;2.834949;-0.041122;,-0.440953;3.555781;-0.041122;,-0.616273;3.635651;-0.041122;,-0.769341;2.834949;0.207294;,-0.769341;2.834949;-0.041122;,-0.944661;2.914819;-0.041122;,-0.944661;2.914819;0.207294;,-0.616273;3.635651;0.207294;,-0.616273;3.635651;-0.041122;,-0.440953;3.555781;-0.041122;,-0.440953;3.555781;0.207294;,-1.104504;2.080977;-0.086788;,-1.104504;2.080977;0.161627;,-0.776116;2.801809;0.161627;,-0.776116;2.801809;-0.086788;,-1.104504;2.080977;0.161627;,-1.279824;2.160847;0.161627;,-0.951436;2.881679;0.161627;,-0.776116;2.801809;0.161627;,-1.279824;2.160847;0.161627;,-1.279824;2.160847;-0.086788;,-0.951436;2.881679;-0.086788;,-0.951436;2.881679;0.161627;,-1.279824;2.160847;-0.086788;,-1.104504;2.080977;-0.086788;,-0.776116;2.801809;-0.086788;,-0.951436;2.881679;-0.086788;,-1.104504;2.080977;0.161627;,-1.104504;2.080977;-0.086788;,-1.279824;2.160847;-0.086788;,-1.279824;2.160847;0.161627;,-0.951436;2.881679;0.161627;,-0.951436;2.881679;-0.086788;,-0.776116;2.801809;-0.086788;,-0.776116;2.801809;0.161627;,-0.055633;0.093601;-0.190081;,-0.055633;0.093601;0.190081;,-0.055633;1.205294;0.190081;,-0.055633;1.205294;-0.190081;,-0.055633;0.093601;0.190081;,-0.43017;0.093601;0.190081;,-0.43017;1.205294;0.190081;,-0.055633;1.205294;0.190081;,-0.43017;0.093601;0.190081;,-0.43017;0.093601;-0.190081;,-0.43017;1.205294;-0.190081;,-0.43017;1.205294;0.190081;,-0.43017;0.093601;-0.190081;,-0.055633;0.093601;-0.190081;,-0.055633;1.205294;-0.190081;,-0.43017;1.205294;-0.190081;,-0.055633;0.093601;0.190081;,-0.055633;0.093601;-0.190081;,-0.43017;0.093601;-0.190081;,-0.43017;0.093601;0.190081;,-0.43017;1.205294;0.190081;,-0.43017;1.205294;-0.190081;,-0.055633;1.205294;-0.190081;,-0.055633;1.205294;0.190081;,0;3.790919;0.428464;,-0.43344;3.809586;0.409797;,-0.43344;4.560537;0.409797;,0;4.579204;0.428464;,-0.43344;3.809586;0.409797;,-0.43344;3.809586;-0.284975;,-0.43344;4.560537;-0.284975;,-0.43344;4.560537;0.409797;,0;3.790919;0.428464;,0;3.790919;-0.303642;,-0.43344;3.809586;-0.284975;,-0.43344;3.809586;0.409797;,-0.43344;4.560537;0.409797;,-0.43344;4.560537;-0.284975;,0;4.579204;-0.303642;,0;4.579204;0.428464;,-0.43344;3.809586;-0.284975;,0;3.790919;-0.303642;,0;4.579204;-0.303642;,-0.43344;4.560537;-0.284975;;68;4;3,2,1,0;,4;7,6,5,4;,4;11,10,9,8;,4;15,14,13,12;,4;19,18,17,16;,4;23,22,21,20;,4;27,26,25,24;,4;31,30,29,28;,4;35,34,33,32;,4;39,38,37,36;,4;43,42,41,40;,4;47,46,45,44;,4;51,50,49,48;,4;55,54,53,52;,4;59,58,57,56;,4;63,62,61,60;,4;67,66,65,64;,4;71,70,69,68;,4;75,74,73,72;,4;79,78,77,76;,4;83,82,81,80;,4;87,86,85,84;,4;91,90,89,88;,4;95,94,93,92;,4;99,98,97,96;,4;103,102,101,100;,4;107,106,105,104;,4;111,110,109,108;,4;115,114,113,112;,4;119,118,117,116;,4;123,122,121,120;,4;127,126,125,124;,4;131,130,129,128;,4;135,134,133,132;,4;139,138,137,136;,4;143,142,141,140;,4;147,146,145,144;,4;151,150,149,148;,4;155,154,153,152;,4;159,158,157,156;,4;163,162,161,160;,4;167,166,165,164;,4;171,170,169,168;,4;175,174,173,172;,4;179,178,177,176;,4;183,182,181,180;,4;187,186,185,184;,4;191,190,189,188;,4;195,194,193,192;,4;199,198,197,196;,4;203,202,201,200;,4;207,206,205,204;,4;211,210,209,208;,4;215,214,213,212;,4;219,218,217,216;,4;223,222,221,220;,4;227,226,225,224;,4;231,230,229,228;,4;235,234,233,232;,4;239,238,237,236;,4;243,242,241,240;,4;247,246,245,244;,4;251,250,249,248;,4;255,254,253,252;,4;259,258,257,256;,4;263,262,261,260;,4;267,266,265,264;,4;271,270,269,268;;MeshNormals{272;0;-0.707083;0.707083;,0;0.707083;0.707083;,0.577349;0.577349;0.577349;,0.577349;-0.577349;0.577349;,0.577349;-0.577349;0.577349;,0.577349;0.577349;0.577349;,0.577349;0.577349;-0.577349;,0.577349;-0.577349;-0.577349;,0;-0.707083;0.707083;,0.577349;-0.577349;0.577349;,0.577349;-0.577349;-0.577349;,0;-0.707083;-0.707083;,-0.577349;-0.577349;-0.577349;,-0.577349;0.577349;-0.577349;,-0.577349;0.577349;0.577349;,-0.577349;-0.577349;0.577349;,-0.577349;-0.577349;0.577349;,-0.577349;0.577349;0.577349;,0.577349;0.577349;0.577349;,0.577349;-0.577349;0.577349;,0.577349;-0.577349;0.577349;,0.577349;0.577349;0.577349;,0.577349;0.577349;-0.577349;,0.577349;-0.577349;-0.577349;,0.577349;-0.577349;-0.577349;,0.577349;0.577349;-0.577349;,-0.577349;0.577349;-0.577349;,-0.577349;-0.577349;-0.577349;,-0.577349;-0.577349;0.577349;,0.577349;-0.577349;0.577349;,0.577349;-0.577349;-0.577349;,-0.577349;-0.577349;-0.577349;,0.577349;0.577349;0.577349;,-0.577349;0.577349;0.577349;,-0.577349;0.577349;-0.577349;,0.577349;0.577349;-0.577349;,0.577349;0.577349;0.577349;,0;0.707083;0.707083;,0;0.707083;-0.707083;,0.577349;0.577349;-0.577349;,0.577349;-0.577349;-0.577349;,0.577349;0.577349;-0.577349;,0;0.707083;-0.707083;,0;-0.707083;-0.707083;,-0.286019;-0.764733;-0.577349;,-0.764733;0.286019;-0.577349;,-0.764733;0.286019;0.577349;,-0.286019;-0.764733;0.577349;,-0.286019;-0.764733;0.577349;,-0.764733;0.286019;0.577349;,0.286019;0.764733;0.577349;,0.764733;-0.286019;0.577349;,0.764733;-0.286019;0.577349;,0.286019;0.764733;0.577349;,0.286019;0.764733;-0.577349;,0.764733;-0.286019;-0.577349;,0.764733;-0.286019;-0.577349;,0.286019;0.764733;-0.577349;,-0.764733;0.286019;-0.577349;,-0.286019;-0.764733;-0.577349;,-0.286019;-0.764733;0.577349;,0.764733;-0.286019;0.577349;,0.764733;-0.286019;-0.577349;,-0.286019;-0.764733;-0.577349;,0.286019;0.764733;0.577349;,-0.764733;0.286019;0.577349;,-0.764733;0.286019;-0.577349;,0.286019;0.764733;-0.577349;,-0.286019;-0.764733;-0.577349;,-0.764733;0.286019;-0.577349;,-0.764733;0.286019;0.577349;,-0.286019;-0.764733;0.577349;,-0.286019;-0.764733;0.577349;,-0.764733;0.286019;0.577349;,0.286019;0.764733;0.577349;,0.764733;-0.286019;0.577349;,0.764733;-0.286019;0.577349;,0.286019;0.764733;0.577349;,0.286019;0.764733;-0.577349;,0.764733;-0.286019;-0.577349;,0.764733;-0.286019;-0.577349;,0.286019;0.764733;-0.577349;,-0.764733;0.286019;-0.577349;,-0.286019;-0.764733;-0.577349;,-0.286019;-0.764733;0.577349;,0.764733;-0.286019;0.577349;,0.764733;-0.286019;-0.577349;,-0.286019;-0.764733;-0.577349;,0.286019;0.764733;0.577349;,-0.764733;0.286019;0.577349;,-0.764733;0.286019;-0.577349;,0.286019;0.764733;-0.577349;,-0.577349;-0.577349;-0.577349;,-0.577349;0.577349;-0.577349;,-0.577349;0.577349;0.577349;,-0.577349;-0.577349;0.577349;,-0.577349;-0.577349;0.577349;,-0.577349;0.577349;0.577349;,0.577349;0.577349;0.577349;,0.577349;-0.577349;0.577349;,0.577349;-0.577349;0.577349;,0.577349;0.577349;0.577349;,0.577349;0.577349;-0.577349;,0.577349;-0.577349;-0.577349;,0.577349;-0.577349;-0.577349;,0.577349;0.577349;-0.577349;,-0.577349;0.577349;-0.577349;,-0.577349;-0.577349;-0.577349;,-0.577349;-0.577349;0.577349;,0.577349;-0.577349;0.577349;,0.577349;-0.577349;-0.577349;,-0.577349;-0.577349;-0.577349;,0.577349;0.577349;0.577349;,-0.577349;0.577349;0.577349;,-0.577349;0.577349;-0.577349;,0.577349;0.577349;-0.577349;,0;-0.707083;0.707083;,0;0.707083;0.707083;,0.599902;0.565722;0.565722;,0.599902;-0.565722;0.565722;,0.599902;-0.565722;0.565722;,0.599902;0.565722;0.565722;,0.599902;0.565722;-0.565722;,0.599902;-0.565722;-0.565722;,0;-0.707083;0.707083;,0.599902;-0.565722;0.565722;,0.599902;-0.565722;-0.565722;,0;-0.707083;-0.707083;,0.599902;0.565722;0.565722;,0;0.707083;0.707083;,0;0.707083;-0.707083;,0.599902;0.565722;-0.565722;,0.599902;-0.565722;-0.565722;,0.599902;0.565722;-0.565722;,0;0.707083;-0.707083;,0;-0.707083;-0.707083;,0;-0.707083;0.707083;,-0.577349;-0.577349;0.577349;,-0.577349;0.577349;0.577349;,0;0.707083;0.707083;,-0.577349;-0.577349;0.577349;,-0.577349;-0.577349;-0.577349;,-0.577349;0.577349;-0.577349;,-0.577349;0.577349;0.577349;,0;-0.707083;0.707083;,0;-0.707083;-0.707083;,-0.577349;-0.577349;-0.577349;,-0.577349;-0.577349;0.577349;,0.577349;-0.577349;-0.577349;,0.577349;-0.577349;0.577349;,0.577349;0.577349;0.577349;,0.577349;0.577349;-0.577349;,0.577349;-0.577349;0.577349;,-0.577349;-0.577349;0.577349;,-0.577349;0.577349;0.577349;,0.577349;0.577349;0.577349;,-0.577349;-0.577349;0.577349;,-0.577349;-0.577349;-0.577349;,-0.577349;0.577349;-0.577349;,-0.577349;0.577349;0.577349;,-0.577349;-0.577349;-0.577349;,0.577349;-0.577349;-0.577349;,0.577349;0.577349;-0.577349;,-0.577349;0.577349;-0.577349;,0.577349;-0.577349;0.577349;,0.577349;-0.577349;-0.577349;,-0.577349;-0.577349;-0.577349;,-0.577349;-0.577349;0.577349;,-0.577349;0.577349;0.577349;,-0.577349;0.577349;-0.577349;,0.577349;0.577349;-0.577349;,0.577349;0.577349;0.577349;,-0.577349;0.577349;0.577349;,-0.577349;0.577349;-0.577349;,0;0.707083;-0.707083;,0;0.707083;0.707083;,-0.577349;-0.577349;-0.577349;,0;-0.707083;-0.707083;,0;0.707083;-0.707083;,-0.577349;0.577349;-0.577349;,0.286019;-0.764733;-0.577349;,0.286019;-0.764733;0.577349;,0.764733;0.286019;0.577349;,0.764733;0.286019;-0.577349;,0.286019;-0.764733;0.577349;,-0.764733;-0.286019;0.577349;,-0.286019;0.764733;0.577349;,0.764733;0.286019;0.577349;,-0.764733;-0.286019;0.577349;,-0.764733;-0.286019;-0.577349;,-0.286019;0.764733;-0.577349;,-0.286019;0.764733;0.577349;,-0.764733;-0.286019;-0.577349;,0.286019;-0.764733;-0.577349;,0.764733;0.286019;-0.577349;,-0.286019;0.764733;-0.577349;,0.286019;-0.764733;0.577349;,0.286019;-0.764733;-0.577349;,-0.764733;-0.286019;-0.577349;,-0.764733;-0.286019;0.577349;,-0.286019;0.764733;0.577349;,-0.286019;0.764733;-0.577349;,0.764733;0.286019;-0.577349;,0.764733;0.286019;0.577349;,0.286019;-0.764733;-0.577349;,0.286019;-0.764733;0.577349;,0.764733;0.286019;0.577349;,0.764733;0.286019;-0.577349;,0.286019;-0.764733;0.577349;,-0.764733;-0.286019;0.577349;,-0.286019;0.764733;0.577349;,0.764733;0.286019;0.577349;,-0.764733;-0.286019;0.577349;,-0.764733;-0.286019;-0.577349;,-0.286019;0.764733;-0.577349;,-0.286019;0.764733;0.577349;,-0.764733;-0.286019;-0.577349;,0.286019;-0.764733;-0.577349;,0.764733;0.286019;-0.577349;,-0.286019;0.764733;-0.577349;,0.286019;-0.764733;0.577349;,0.286019;-0.764733;-0.577349;,-0.764733;-0.286019;-0.577349;,-0.764733;-0.286019;0.577349;,-0.286019;0.764733;0.577349;,-0.286019;0.764733;-0.577349;,0.764733;0.286019;-0.577349;,0.764733;0.286019;0.577349;,0.577349;-0.577349;-0.577349;,0.577349;-0.577349;0.577349;,0.577349;0.577349;0.577349;,0.577349;0.577349;-0.577349;,0.577349;-0.577349;0.577349;,-0.577349;-0.577349;0.577349;,-0.577349;0.577349;0.577349;,0.577349;0.577349;0.577349;,-0.577349;-0.577349;0.577349;,-0.577349;-0.577349;-0.577349;,-0.577349;0.577349;-0.577349;,-0.577349;0.577349;0.577349;,-0.577349;-0.577349;-0.577349;,0.577349;-0.577349;-0.577349;,0.577349;0.577349;-0.577349;,-0.577349;0.577349;-0.577349;,0.577349;-0.577349;0.577349;,0.577349;-0.577349;-0.577349;,-0.577349;-0.577349;-0.577349;,-0.577349;-0.577349;0.577349;,-0.577349;0.577349;0.577349;,-0.577349;0.577349;-0.577349;,0.577349;0.577349;-0.577349;,0.577349;0.577349;0.577349;,0;-0.707083;0.707083;,-0.599902;-0.565722;0.565722;,-0.599872;0.565722;0.565722;,0;0.707083;0.707083;,-0.599902;-0.565722;0.565722;,-0.599902;-0.565722;-0.565722;,-0.599872;0.565722;-0.565722;,-0.599872;0.565722;0.565722;,0;-0.707083;0.707083;,0;-0.707083;-0.707083;,-0.599902;-0.565722;-0.565722;,-0.599902;-0.565722;0.565722;,-0.599872;0.565722;0.565722;,-0.599872;0.565722;-0.565722;,0;0.707083;-0.707083;,0;0.707083;0.707083;,-0.599902;-0.565722;-0.565722;,0;-0.707083;-0.707083;,0;0.707083;-0.707083;,-0.599872;0.565722;-0.565722;;68;4;3,2,1,0;,4;7,6,5,4;,4;11,10,9,8;,4;15,14,13,12;,4;19,18,17,16;,4;23,22,21,20;,4;27,26,25,24;,4;31,30,29,28;,4;35,34,33,32;,4;39,38,37,36;,4;43,42,41,40;,4;47,46,45,44;,4;51,50,49,48;,4;55,54,53,52;,4;59,58,57,56;,4;63,62,61,60;,4;67,66,65,64;,4;71,70,69,68;,4;75,74,73,72;,4;79,78,77,76;,4;83,82,81,80;,4;87,86,85,84;,4;91,90,89,88;,4;95,94,93,92;,4;99,98,97,96;,4;103,102,101,100;,4;107,106,105,104;,4;111,110,109,108;,4;115,114,113,112;,4;119,118,117,116;,4;123,122,121,120;,4;127,126,125,124;,4;131,130,129,128;,4;135,134,133,132;,4;139,138,137,136;,4;143,142,141,140;,4;147,146,145,144;,4;151,150,149,148;,4;155,154,153,152;,4;159,158,157,156;,4;163,162,161,160;,4;167,166,165,164;,4;171,170,169,168;,4;175,174,173,172;,4;179,178,177,176;,4;183,182,181,180;,4;187,186,185,184;,4;191,190,189,188;,4;195,194,193,192;,4;199,198,197,196;,4;203,202,201,200;,4;207,206,205,204;,4;211,210,209,208;,4;215,214,213,212;,4;219,218,217,216;,4;223,222,221,220;,4;227,226,225,224;,4;231,230,229,228;,4;235,234,233,232;,4;239,238,237,236;,4;243,242,241,240;,4;247,246,245,244;,4;251,250,249,248;,4;255,254,253,252;,4;259,258,257,256;,4;263,262,261,260;,4;267,266,265,264;,4;271,270,269,268;;}MeshTextureCoords{272;0.849264;0.899246;,0.849264;0.931916;,0.861547;0.931916;,0.861547;0.899246;,0.916988;0.931916;,0.916988;0.899246;,0.9054;0.899246;,0.9054;0.931916;,0.84857;0.844707;,0.84857;0.83254;,0.836981;0.83254;,0.836981;0.844707;,0.927004;0.903587;,0.927004;0.931916;,0.937019;0.931916;,0.937019;0.903587;,0.937019;0.903587;,0.937019;0.931916;,0.946887;0.931916;,0.946887;0.903587;,0.888533;0.856954;,0.888533;0.828625;,0.878517;0.828625;,0.878517;0.856954;,0.939292;0.870917;,0.939292;0.899246;,0.949159;0.899246;,0.949159;0.870917;,0.946887;0.91117;,0.956719;0.91117;,0.956719;0.901213;,0.946887;0.901213;,0.865118;0.813135;,0.855286;0.813135;,0.855286;0.823092;,0.865118;0.823092;,0.866874;0.847426;,0.866874;0.835259;,0.855286;0.835259;,0.855286;0.847426;,0.598002;0.973516;,0.598002;0.206739;,0.309722;0.206739;,0.309722;0.973516;,0.909393;0.822135;,0.909393;0.841014;,0.915938;0.841014;,0.915938;0.822135;,0.951962;0.931916;,0.951962;0.91117;,0.946887;0.91117;,0.946887;0.931916;,0.948762;0.841801;,0.948762;0.822921;,0.942217;0.822921;,0.942217;0.841801;,0.893608;0.838075;,0.893608;0.817329;,0.888533;0.817329;,0.888533;0.838075;,0.900724;0.909292;,0.90515;0.909292;,0.90515;0.902786;,0.900724;0.902786;,0.953585;0.871994;,0.949159;0.871994;,0.949159;0.8785;,0.953585;0.8785;,0.84857;0.837995;,0.84857;0.856874;,0.855114;0.856874;,0.855114;0.837995;,0.902881;0.83746;,0.902881;0.816714;,0.897805;0.816714;,0.897805;0.83746;,0.942217;0.841801;,0.942217;0.822921;,0.935673;0.822921;,0.935673;0.841801;,0.949159;0.8785;,0.949159;0.899246;,0.954235;0.899246;,0.954235;0.8785;,0.919226;0.822135;,0.923651;0.822135;,0.923651;0.815629;,0.919226;0.815629;,0.928077;0.815629;,0.923651;0.815629;,0.923651;0.822135;,0.928077;0.822135;,0.865301;0.847426;,0.865301;0.876542;,0.875317;0.876542;,0.875317;0.847426;,0.909393;0.841014;,0.909393;0.87013;,0.919261;0.87013;,0.919261;0.841014;,0.855286;0.847426;,0.855286;0.876542;,0.865301;0.876542;,0.865301;0.847426;,0.919261;0.841014;,0.919261;0.87013;,0.929128;0.87013;,0.929128;0.841014;,0.878517;0.828625;,0.888349;0.828625;,0.88835;0.818668;,0.878517;0.818668;,0.836981;0.83254;,0.846814;0.83254;,0.846814;0.822583;,0.836981;0.822583;,0.857749;0.887894;,0.836981;0.887894;,0.837473;0.899246;,0.857257;0.899246;,0.855286;0.876542;,0.855286;0.856874;,0.836981;0.856874;,0.836981;0.876542;,0.897805;0.887893;,0.897313;0.876622;,0.879009;0.876622;,0.878517;0.887893;,0.886604;0.909292;,0.886112;0.920645;,0.9054;0.920645;,0.904908;0.909292;,0.977665;0.442421;,0.977665;0.131438;,0.799225;0.123708;,0.799225;0.450151;,0.849264;0.899246;,0.836981;0.899246;,0.836981;0.931916;,0.849264;0.931916;,0.909393;0.866576;,0.897805;0.866576;,0.897805;0.899246;,0.909393;0.899246;,0.84857;0.844707;,0.836981;0.844707;,0.836981;0.856874;,0.84857;0.856874;,0.929276;0.899246;,0.939292;0.899246;,0.939292;0.870917;,0.929276;0.870917;,0.876741;0.819096;,0.866874;0.819096;,0.866874;0.847426;,0.876741;0.847426;,0.939144;0.841801;,0.929128;0.841801;,0.929128;0.87013;,0.939144;0.87013;,0.949011;0.841801;,0.939144;0.841801;,0.939144;0.87013;,0.949011;0.87013;,0.836981;0.812626;,0.836981;0.822583;,0.846814;0.822583;,0.846814;0.812626;,0.909393;0.812178;,0.909393;0.822135;,0.919226;0.822135;,0.919226;0.812178;,0.866874;0.823092;,0.855286;0.823092;,0.855286;0.835259;,0.866874;0.835259;,0.021442;0.973516;,0.309722;0.973516;,0.309722;0.206739;,0.021442;0.206739;,0.916039;0.841014;,0.922583;0.841014;,0.922583;0.822135;,0.916039;0.822135;,0.907956;0.816714;,0.902881;0.816714;,0.902881;0.83746;,0.907956;0.83746;,0.929128;0.822135;,0.922583;0.822135;,0.922583;0.841014;,0.929128;0.841014;,0.853645;0.817249;,0.84857;0.817249;,0.84857;0.837995;,0.853645;0.837995;,0.900724;0.909292;,0.900724;0.902786;,0.895944;0.902786;,0.895944;0.909292;,0.93896;0.816415;,0.93896;0.822921;,0.94374;0.822921;,0.94374;0.816415;,0.935673;0.822921;,0.929128;0.822921;,0.929128;0.841801;,0.935673;0.841801;,0.954087;0.849384;,0.949011;0.849384;,0.949011;0.87013;,0.954087;0.87013;,0.895077;0.838075;,0.888533;0.838075;,0.888533;0.856954;,0.895077;0.856954;,0.948762;0.841801;,0.953838;0.841801;,0.953838;0.821055;,0.948762;0.821055;,0.94374;0.816415;,0.94374;0.822921;,0.94852;0.822921;,0.94852;0.816415;,0.949011;0.842878;,0.949011;0.849384;,0.953791;0.849384;,0.953791;0.842878;,0.919409;0.87013;,0.909393;0.87013;,0.909393;0.899246;,0.919409;0.899246;,0.897805;0.866576;,0.907672;0.866576;,0.907672;0.83746;,0.897805;0.83746;,0.927004;0.9028;,0.916988;0.9028;,0.916988;0.931916;,0.927004;0.931916;,0.929276;0.87013;,0.919409;0.87013;,0.919409;0.899246;,0.929276;0.899246;,0.93896;0.822921;,0.93896;0.812965;,0.929128;0.812965;,0.929128;0.822921;,0.886112;0.899336;,0.886112;0.909292;,0.895944;0.909292;,0.895944;0.899336;,0.857749;0.887894;,0.857257;0.876542;,0.837473;0.876542;,0.836981;0.887894;,0.896821;0.856954;,0.878517;0.856954;,0.878517;0.876622;,0.896821;0.876622;,0.897805;0.887893;,0.878517;0.887893;,0.879009;0.899246;,0.897313;0.899246;,0.886604;0.931916;,0.904908;0.931916;,0.9054;0.920645;,0.886112;0.920645;,0.620785;0.44242;,0.799225;0.450151;,0.799225;0.123708;,0.620785;0.131438;;}XSkinMeshHeader{3;9;10;}SkinWeights{"Armature_arm_l";24;44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,67,66;1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;-0.047733,0.901521,0.430095,0,-0.097683,0.424309,-0.900233,0,-0.994073,-0.084983,0.06781,0,0.374873,-2.006904,2.980378,1;;}SkinWeights{"Armature_elbow_r";24;216,219,218,213,212,215,214,209,224,208,227,211,226,210,206,221,207,220,204,223,205,222,225,217;1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;0.102316,0.92166,-0.374266,0,-0.090709,-0.366028,-0.926173,0,-0.990608,0.128712,0.046152,0,0.402018,1.853661,2.350172,1;;}SkinWeights{"Armature_arm_r";24;186,187,184,185,182,183,180,194,195,203,202,192,193,201,200,199,190,198,191,197,188,196,189,181;1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;-0.047733,0.901521,-0.430095,0,-0.05233,-0.432251,-0.900234,0,-0.997489,-0.020464,0.067809,0,0.160852,2.035269,2.980378,1;;}SkinWeights{"Armature_knee_l";24;105,99,114,106,98,115,107,101,93,108,100,92,109,103,95,110,102,94,111,97,112,104,113,96;1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;1,0,0,0,0,0.054357,-0.998522,0,0,0.998501,0.054355,0,-0.246294,-0.008592,1.301673,1;;}SkinWeights{"Armature_Bone_007";40;132,133,134,135,124,125,126,252,253,254,255,121,122,264,265,123,267,268,269,270,116,256,258,259,260,261,262,263,271,266,120,119,117,128,129,127,130,118,131,257;1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;1,0,0,0,0,0,1,0,0,-1,0,0,0,0,-3.793003,1;;}SkinWeights{"Armature_elbow_l";24;88,80,72,91,83,75,90,82,74,70,85,77,71,84,76,68,87,79,69,86,78,89,81,73;1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;0.102316,0.92166,0.374266,0,-0.008222,0.377011,-0.926173,0,-0.994719,0.091686,0.046152,0,-0.014321,-1.896701,2.350171,1;;}SkinWeights{"Armature_knee_r";24;249,235,250,234,251,229,244,228,245,231,246,230,247,240,241,242,243,237,236,239,238,233,248,232;1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;1,0,0,0,0,0.054357,-0.998522,0,0,0.998501,0.054355,0,0.246294,-0.008592,1.301673,1;;}SkinWeights{"Armature_leg_l";38;0,3,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,40,43,136,145,177,144;0.055873,0.852304,0.852304,0.82998,0.055873,0.852304,0.82998,0.054606,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0.82998,0.054606,0.055873,0.054606,0.054606,0.055873;1,0,0,0,0,-0.056452,-0.998405,0,0,0.998385,-0.056452,0,-0.246294,0.135476,2.396023,1;;}SkinWeights{"Armature_leg_r";38;0,170,169,11,168,151,150,149,148,147,146,176,145,177,144,159,158,157,156,155,154,153,167,136,166,137,165,164,163,140,162,141,161,43,160,152,8,171;0.055873,1,1,0.054606,1,1,1,1,1,0.852304,0.82998,0.82998,0.054606,0.054606,0.055873,1,1,1,1,1,1,1,1,0.055873,1,0.852304,1,1,1,0.852304,1,0.82998,1,0.054606,1,1,0.055873,1;1,0,0,0,0,-0.056452,-0.998405,0,0,0.998385,-0.056452,0,0.246294,0.135476,2.396023,1;;}SkinWeights{"Armature_body";40;0,1,2,3,4,5,6,7,8,9,10,11,36,37,38,39,40,41,42,43,136,137,138,139,140,147,141,146,142,145,143,144,179,174,178,173,177,172,176,175;0.888255,1,1,0.147696,0.147696,1,1,0.17002,0.888255,0.147696,0.17002,0.890788,1,1,1,1,0.17002,1,1,0.890788,0.888255,0.147696,1,1,0.147696,0.147696,0.17002,0.17002,1,0.890788,1,0.888255,1,1,1,1,0.890788,1,0.17002,1;1,0,0,0,0,0,1,0,0,-1,0,0,0,0,-2.571201,1;;}}}}}
\ No newline at end of file
diff --git a/games/devtest/mods/testentities/visuals.lua b/games/devtest/mods/testentities/visuals.lua
index dfbf655ea7..26b538e7f6 100644
--- a/games/devtest/mods/testentities/visuals.lua
+++ b/games/devtest/mods/testentities/visuals.lua
@@ -102,6 +102,19 @@ core.register_entity("testentities:lava_flan", {
end,
})
+core.register_entity("testentities:cool_guy", {
+ initial_properties = {
+ visual = "mesh",
+ mesh = "testentities_cool_guy.x",
+ textures = {
+ "testentities_cool_guy.png"
+ },
+ },
+ on_activate = function(self)
+ self.object:set_animation({x = 0, y = 29}, 30, 0, true)
+ end,
+})
+
-- Advanced visual tests
-- An entity for testing animated and yaw-modulated sprites
diff --git a/games/devtest/mods/unittests/entity.lua b/games/devtest/mods/unittests/entity.lua
index fad7d52e9c..dfbe541152 100644
--- a/games/devtest/mods/unittests/entity.lua
+++ b/games/devtest/mods/unittests/entity.lua
@@ -255,3 +255,17 @@ local function test_item_drop(_, pos)
assert(itemstack_ret:equals(itemstack_src))
end
unittests.register("test_item_drop", test_item_drop, {map=true})
+
+local function test_entity_guid(_, pos)
+ local obj0 = core.add_entity(pos, "unittests:dummy")
+ local obj1 = core.add_entity(pos, "unittests:dummy")
+
+ assert(obj0 ~= obj1)
+ assert(obj0:get_guid() ~= obj1:get_guid())
+ assert(core.objects_by_guid[obj0:get_guid()] == obj0)
+ assert(core.objects_by_guid[obj1:get_guid()] == obj1)
+
+ obj0:remove()
+ obj1:remove()
+end
+unittests.register("test_entity_guid", test_entity_guid, {map=true})
diff --git a/games/devtest/mods/unittests/inside_mapgen_env.lua b/games/devtest/mods/unittests/inside_mapgen_env.lua
index f6f8513ce1..f92465cc57 100644
--- a/games/devtest/mods/unittests/inside_mapgen_env.lua
+++ b/games/devtest/mods/unittests/inside_mapgen_env.lua
@@ -29,6 +29,6 @@ if core.ipc_cas("unittests:mg_once", nil, true) then
end
core.register_on_generated(function(vm, pos1, pos2, blockseed)
- local n = tonumber(core.get_mapgen_setting("chunksize")) * 16 - 1
- assert(pos2:subtract(pos1) == vector.new(n, n, n))
+ local cs = core.get_mapgen_chunksize()
+ assert(pos2:subtract(pos1) == cs:multiply(core.MAP_BLOCKSIZE):subtract(1))
end)
diff --git a/games/devtest/mods/unittests/misc.lua b/games/devtest/mods/unittests/misc.lua
index 65dc3259e9..28cc2c1ebc 100644
--- a/games/devtest/mods/unittests/misc.lua
+++ b/games/devtest/mods/unittests/misc.lua
@@ -67,18 +67,6 @@ local function test_dynamic_media(cb, player)
end
unittests.register("test_dynamic_media", test_dynamic_media, {async=true, player=true})
-local function test_v3f_metatable(player)
- assert(vector.check(player:get_pos()))
-end
-unittests.register("test_v3f_metatable", test_v3f_metatable, {player=true})
-
-local function test_v3s16_metatable(player, pos)
- local node = core.get_node(pos)
- local found_pos = core.find_node_near(pos, 0, node.name, true)
- assert(vector.check(found_pos))
-end
-unittests.register("test_v3s16_metatable", test_v3s16_metatable, {map=true})
-
local function test_clear_meta(_, pos)
local ref = core.get_meta(pos)
diff --git a/games/devtest/mods/unittests/player.lua b/games/devtest/mods/unittests/player.lua
index f8945f3201..b047b6c563 100644
--- a/games/devtest/mods/unittests/player.lua
+++ b/games/devtest/mods/unittests/player.lua
@@ -204,3 +204,12 @@ local function run_player_hotbar_clamp_tests(player)
player:hud_set_hotbar_itemcount(old_bar_size)
end
unittests.register("test_player_hotbar_clamp", run_player_hotbar_clamp_tests, {player=true})
+
+--
+-- Player GUID
+--
+local function test_player_guid(player)
+ assert(player:get_guid() == player:get_player_name())
+ assert(core.objects_by_guid[player:get_guid()] == player)
+end
+unittests.register("test_player_guid", test_player_guid, {player=true})
diff --git a/irr/README.md b/irr/README.md
index 449903cfe0..eb7f14809f 100644
--- a/irr/README.md
+++ b/irr/README.md
@@ -1,9 +1,9 @@
IrrlichtMt version 1.9
======================
-IrrlichtMt is the 3D engine of [Minetest](https://github.com/minetest).
+IrrlichtMt is the 3D engine of [Luanti](https://github.com/luanti-org).
It is based on the [Irrlicht Engine](https://irrlicht.sourceforge.io/) but is now developed independently.
-It is intentionally not compatible to upstream and is planned to be eventually absorbed into Minetest.
+It is intentionally not compatible to upstream and is planned to be eventually absorbed into Luanti.
Build
-----
diff --git a/irr/include/CIndexBuffer.h b/irr/include/CIndexBuffer.h
index ba85d49e6b..85d127004d 100644
--- a/irr/include/CIndexBuffer.h
+++ b/irr/include/CIndexBuffer.h
@@ -14,8 +14,6 @@
#include "../src/os.h"
#endif
-namespace irr
-{
namespace scene
{
//! Template implementation of the IIndexBuffer interface
@@ -95,4 +93,3 @@ public:
typedef CIndexBuffer SIndexBuffer;
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/CMeshBuffer.h b/irr/include/CMeshBuffer.h
index b5ed6d2ef3..df8b45ed3d 100644
--- a/irr/include/CMeshBuffer.h
+++ b/irr/include/CMeshBuffer.h
@@ -9,8 +9,6 @@
#include "CVertexBuffer.h"
#include "CIndexBuffer.h"
-namespace irr
-{
namespace scene
{
//! Template implementation of the IMeshBuffer interface
@@ -87,7 +85,7 @@ public:
{
if (Vertices->getCount()) {
BoundingBox.reset(Vertices->getPosition(0));
- const irr::u32 vsize = Vertices->getCount();
+ const u32 vsize = Vertices->getCount();
for (u32 i = 1; i < vsize; ++i)
BoundingBox.addInternalPoint(Vertices->getPosition(i));
} else
@@ -146,4 +144,3 @@ typedef CMeshBuffer SMeshBufferLightMap;
//! Meshbuffer with vertices having tangents stored, e.g. for normal mapping
typedef CMeshBuffer SMeshBufferTangents;
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/CVertexBuffer.h b/irr/include/CVertexBuffer.h
index 1bface16c4..f515f6c312 100644
--- a/irr/include/CVertexBuffer.h
+++ b/irr/include/CVertexBuffer.h
@@ -14,8 +14,6 @@
#include "../src/os.h"
#endif
-namespace irr
-{
namespace scene
{
//! Template implementation of the IVertexBuffer interface
@@ -128,4 +126,3 @@ typedef CVertexBuffer SVertexBufferLightMap;
typedef CVertexBuffer SVertexBufferTangents;
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/ECullingTypes.h b/irr/include/ECullingTypes.h
index 95979bef4f..6dac99700e 100644
--- a/irr/include/ECullingTypes.h
+++ b/irr/include/ECullingTypes.h
@@ -6,8 +6,6 @@
#include "irrTypes.h"
-namespace irr
-{
namespace scene
{
@@ -32,4 +30,3 @@ const c8 *const AutomaticCullingNames[] = {
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/EDebugSceneTypes.h b/irr/include/EDebugSceneTypes.h
index 2994eca6c0..0df5f3d5ce 100644
--- a/irr/include/EDebugSceneTypes.h
+++ b/irr/include/EDebugSceneTypes.h
@@ -4,8 +4,6 @@
#pragma once
-namespace irr
-{
namespace scene
{
@@ -38,4 +36,3 @@ enum E_DEBUG_SCENE_TYPE
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/EDeviceTypes.h b/irr/include/EDeviceTypes.h
index 1eff4f6152..c9188a1f27 100644
--- a/irr/include/EDeviceTypes.h
+++ b/irr/include/EDeviceTypes.h
@@ -4,9 +4,6 @@
#pragma once
-namespace irr
-{
-
//! An enum for the different device types supported by the Irrlicht Engine.
enum E_DEVICE_TYPE
{
@@ -42,5 +39,3 @@ enum E_DEVICE_TYPE
May support hw-acceleration via OpenGL-ES */
EIDT_ANDROID,
};
-
-} // end namespace irr
diff --git a/irr/include/EDriverFeatures.h b/irr/include/EDriverFeatures.h
index c1fcd464d7..47176c6dfb 100644
--- a/irr/include/EDriverFeatures.h
+++ b/irr/include/EDriverFeatures.h
@@ -4,8 +4,6 @@
#pragma once
-namespace irr
-{
namespace video
{
@@ -140,4 +138,3 @@ enum E_VIDEO_DRIVER_FEATURE
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/EDriverTypes.h b/irr/include/EDriverTypes.h
index 20c684d4c0..79fdeaabd2 100644
--- a/irr/include/EDriverTypes.h
+++ b/irr/include/EDriverTypes.h
@@ -4,8 +4,6 @@
#pragma once
-namespace irr
-{
namespace video
{
@@ -36,4 +34,3 @@ enum E_DRIVER_TYPE
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/EFocusFlags.h b/irr/include/EFocusFlags.h
index 2c229472d5..7f68f0154a 100644
--- a/irr/include/EFocusFlags.h
+++ b/irr/include/EFocusFlags.h
@@ -3,8 +3,6 @@
#pragma once
-namespace irr
-{
namespace gui
{
@@ -31,4 +29,3 @@ enum EFOCUS_FLAG
};
} // namespace gui
-} // namespace irr
diff --git a/irr/include/EGUIAlignment.h b/irr/include/EGUIAlignment.h
index 80be1c189e..d7ef77430b 100644
--- a/irr/include/EGUIAlignment.h
+++ b/irr/include/EGUIAlignment.h
@@ -6,8 +6,6 @@
#include "irrTypes.h"
-namespace irr
-{
namespace gui
{
enum EGUI_ALIGNMENT
@@ -32,4 +30,3 @@ const c8 *const GUIAlignmentNames[] = {
};
} // namespace gui
-} // namespace irr
diff --git a/irr/include/EGUIElementTypes.h b/irr/include/EGUIElementTypes.h
index d5c5d94ce5..8353b79277 100644
--- a/irr/include/EGUIElementTypes.h
+++ b/irr/include/EGUIElementTypes.h
@@ -6,8 +6,6 @@
#include "irrTypes.h"
-namespace irr
-{
namespace gui
{
@@ -72,4 +70,3 @@ enum EGUI_ELEMENT_TYPE
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/EHardwareBufferFlags.h b/irr/include/EHardwareBufferFlags.h
index ae1b602e36..8e78dbcfaa 100644
--- a/irr/include/EHardwareBufferFlags.h
+++ b/irr/include/EHardwareBufferFlags.h
@@ -4,8 +4,6 @@
#pragma once
-namespace irr
-{
namespace scene
{
@@ -37,4 +35,3 @@ enum E_BUFFER_TYPE
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/EMaterialProps.h b/irr/include/EMaterialProps.h
index 7650843407..7fa94d581d 100644
--- a/irr/include/EMaterialProps.h
+++ b/irr/include/EMaterialProps.h
@@ -4,8 +4,6 @@
#pragma once
-namespace irr
-{
namespace video
{
@@ -67,4 +65,3 @@ enum E_MATERIAL_PROP
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/EMaterialTypes.h b/irr/include/EMaterialTypes.h
index cac8233feb..424fce1e4a 100644
--- a/irr/include/EMaterialTypes.h
+++ b/irr/include/EMaterialTypes.h
@@ -6,8 +6,6 @@
#include "irrTypes.h"
-namespace irr
-{
namespace video
{
@@ -71,4 +69,3 @@ constexpr u32 numBuiltInMaterials =
sizeof(sBuiltInMaterialTypeNames) / sizeof(char *) - 1;
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/EPrimitiveTypes.h b/irr/include/EPrimitiveTypes.h
index d4e5f73f4c..2e5feb6780 100644
--- a/irr/include/EPrimitiveTypes.h
+++ b/irr/include/EPrimitiveTypes.h
@@ -4,8 +4,6 @@
#pragma once
-namespace irr
-{
namespace scene
{
@@ -40,4 +38,3 @@ enum E_PRIMITIVE_TYPE
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/EReadFileType.h b/irr/include/EReadFileType.h
index 2241b70bf7..cb4f97bf35 100644
--- a/irr/include/EReadFileType.h
+++ b/irr/include/EReadFileType.h
@@ -6,8 +6,6 @@
#include "irrTypes.h"
-namespace irr
-{
namespace io
{
@@ -27,4 +25,3 @@ enum EREAD_FILE_TYPE
EFIT_UNKNOWN = MAKE_IRR_ID('u', 'n', 'k', 'n')
};
} // end namespace io
-} // end namespace irr
diff --git a/irr/include/ESceneNodeTypes.h b/irr/include/ESceneNodeTypes.h
index b8251d9659..8f9a6e7e08 100644
--- a/irr/include/ESceneNodeTypes.h
+++ b/irr/include/ESceneNodeTypes.h
@@ -6,8 +6,6 @@
#include "irrTypes.h"
-namespace irr
-{
namespace scene
{
@@ -46,4 +44,3 @@ enum ESCENE_NODE_TYPE
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/EVertexAttributes.h b/irr/include/EVertexAttributes.h
index 75d039fec9..2c6eac2cd2 100644
--- a/irr/include/EVertexAttributes.h
+++ b/irr/include/EVertexAttributes.h
@@ -1,7 +1,5 @@
#pragma once
-namespace irr
-{
namespace video
{
@@ -31,4 +29,3 @@ const char *const sBuiltInVertexAttributeNames[] = {
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/EVideoTypes.h b/irr/include/EVideoTypes.h
index fe90f06525..4071fe9b42 100644
--- a/irr/include/EVideoTypes.h
+++ b/irr/include/EVideoTypes.h
@@ -6,7 +6,7 @@
#include "SMaterial.h" // MATERIAL_MAX_TEXTURES
-namespace irr::video
+namespace video
{
//! enumeration for geometry transformation states
@@ -71,5 +71,5 @@ enum E_FOG_TYPE
EFT_FOG_EXP2
};
-} // irr::video
+} // end namespace video
diff --git a/irr/include/IAnimatedMesh.h b/irr/include/IAnimatedMesh.h
index 62568bf6b3..36bf97dd65 100644
--- a/irr/include/IAnimatedMesh.h
+++ b/irr/include/IAnimatedMesh.h
@@ -6,15 +6,13 @@
#include "IMesh.h"
-namespace irr
-{
namespace scene
{
//! Interface for an animated mesh.
/** There are already simple implementations of this interface available so
you don't have to implement this interface on your own if you need to:
-You might want to use irr::scene::SAnimatedMesh, irr::scene::SMesh,
-irr::scene::SMeshBuffer etc. */
+You might want to use scene::SMesh, scene::SMeshBuffer etc.
+*/
class IAnimatedMesh : public IMesh
{
public:
@@ -34,23 +32,8 @@ public:
scene node the mesh is instantiated in.*/
virtual void setAnimationSpeed(f32 fps) = 0;
- //! Returns the IMesh interface for a frame.
- /** \param frame: Frame number, >= 0, <= getMaxFrameNumber()
- Linear interpolation is used if this is between two frames.
- \return Returns the animated mesh for the given frame */
- virtual IMesh *getMesh(f32 frame) = 0;
-
- //! Returns the type of the animated mesh.
- /** In most cases it is not necessary to use this method.
- This is useful for making a safe downcast. For example,
- if getMeshType() returns EAMT_MD2 it's safe to cast the
- IAnimatedMesh to IAnimatedMeshMD2.
- \returns Type of the mesh. */
- E_ANIMATED_MESH_TYPE getMeshType() const override
- {
- return EAMT_UNKNOWN;
- }
+ //! Returns the type of the animated mesh. Useful for safe downcasts.
+ E_ANIMATED_MESH_TYPE getMeshType() const = 0;
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/IAnimatedMeshSceneNode.h b/irr/include/IAnimatedMeshSceneNode.h
index 8f9f6d661f..908516d308 100644
--- a/irr/include/IAnimatedMeshSceneNode.h
+++ b/irr/include/IAnimatedMeshSceneNode.h
@@ -8,39 +8,10 @@
#include "IBoneSceneNode.h"
#include "IAnimatedMesh.h"
-namespace irr
-{
namespace scene
{
-enum E_JOINT_UPDATE_ON_RENDER
-{
- //! do nothing
- EJUOR_NONE = 0,
-
- //! get joints positions from the mesh (for attached nodes, etc)
- EJUOR_READ,
-
- //! control joint positions in the mesh (eg. ragdolls, or set the animation from animateJoints() )
- EJUOR_CONTROL
-};
-
class IAnimatedMeshSceneNode;
-//! Callback interface for catching events of ended animations.
-/** Implement this interface and use
-IAnimatedMeshSceneNode::setAnimationEndCallback to be able to
-be notified if an animation playback has ended.
-**/
-class IAnimationEndCallBack : public virtual IReferenceCounted
-{
-public:
- //! Will be called when the animation playback has ended.
- /** See IAnimatedMeshSceneNode::setAnimationEndCallback for
- more information.
- \param node: Node of which the animation has ended. */
- virtual void OnAnimationEnd(IAnimatedMeshSceneNode *node) = 0;
-};
-
//! Scene node capable of displaying an animated mesh.
class IAnimatedMeshSceneNode : public ISceneNode
{
@@ -120,11 +91,10 @@ public:
/** When true the animations are played looped */
virtual bool getLoopMode() const = 0;
- //! Sets a callback interface which will be called if an animation playback has ended.
- /** Set this to 0 to disable the callback again.
- Please note that this will only be called when in non looped
- mode, see IAnimatedMeshSceneNode::setLoopMode(). */
- virtual void setAnimationEndCallback(IAnimationEndCallBack *callback = 0) = 0;
+ //! Will be called right after the joints have been animated,
+ //! but before the transforms have been propagated recursively to children.
+ virtual void setOnAnimateCallback(
+ const std::function &cb) = 0;
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
/** In this way it is possible to change the materials a mesh
@@ -139,20 +109,15 @@ public:
virtual void setMesh(IAnimatedMesh *mesh) = 0;
//! Returns the current mesh
- virtual IAnimatedMesh *getMesh(void) = 0;
-
- //! Set how the joints should be updated on render
- virtual void setJointMode(E_JOINT_UPDATE_ON_RENDER mode) = 0;
+ virtual IAnimatedMesh *getMesh() = 0;
//! Sets the transition time in seconds
- /** Note: This needs to enable joints, and setJointmode set to
- EJUOR_CONTROL. You must call animateJoints(), or the mesh will
- not animate. */
+ /** Note: You must call animateJoints(), or the mesh will not animate. */
virtual void setTransitionTime(f32 Time) = 0;
//! animates the joints in the mesh based on the current frame.
/** Also takes in to account transitions. */
- virtual void animateJoints(bool CalculateAbsolutePositions = true) = 0;
+ virtual void animateJoints() = 0;
//! render mesh ignoring its transformation.
/** Culling is unaffected. */
@@ -166,4 +131,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/IBillboardSceneNode.h b/irr/include/IBillboardSceneNode.h
index 3e7026ac39..3a59e17aab 100644
--- a/irr/include/IBillboardSceneNode.h
+++ b/irr/include/IBillboardSceneNode.h
@@ -6,8 +6,6 @@
#include "ISceneNode.h"
-namespace irr
-{
namespace scene
{
class ICameraSceneNode;
@@ -72,7 +70,7 @@ public:
So we don't know the real boundingboxes before that. Which would be too late for culling.
That is why the usual getBoundingBox will return a "safe" boundingbox which is guaranteed
to contain the billboard. While this function can return the real one. */
- virtual const core::aabbox3d &getTransformedBillboardBoundingBox(const irr::scene::ICameraSceneNode *camera) = 0;
+ virtual const core::aabbox3d &getTransformedBillboardBoundingBox(const scene::ICameraSceneNode *camera) = 0;
//! Get the amount of mesh buffers.
/** \return Amount of mesh buffers (IMeshBuffer) in this mesh. */
@@ -87,4 +85,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/IBoneSceneNode.h b/irr/include/IBoneSceneNode.h
index eef55f6e03..6ead34636b 100644
--- a/irr/include/IBoneSceneNode.h
+++ b/irr/include/IBoneSceneNode.h
@@ -6,91 +6,44 @@
#include "ISceneNode.h"
-namespace irr
-{
namespace scene
{
-//! Enumeration for different bone animation modes
-enum E_BONE_ANIMATION_MODE
-{
- //! The bone is usually animated, unless it's parent is not animated
- EBAM_AUTOMATIC = 0,
-
- //! The bone is animated by the skin, if it's parent is not animated then animation will resume from this bone onward
- EBAM_ANIMATED,
-
- //! The bone is not animated by the skin
- EBAM_UNANIMATED,
-
- //! Not an animation mode, just here to count the available modes
- EBAM_COUNT
-
-};
-
-enum E_BONE_SKINNING_SPACE
-{
- //! local skinning, standard
- EBSS_LOCAL = 0,
-
- //! global skinning
- EBSS_GLOBAL,
-
- EBSS_COUNT
-};
-
-//! Names for bone animation modes
-const c8 *const BoneAnimationModeNames[] = {
- "automatic",
- "animated",
- "unanimated",
- 0,
- };
-
//! Interface for bones used for skeletal animation.
/** Used with SkinnedMesh and IAnimatedMeshSceneNode. */
class IBoneSceneNode : public ISceneNode
{
public:
- IBoneSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id = -1) :
- ISceneNode(parent, mgr, id), positionHint(-1), scaleHint(-1), rotationHint(-1) {}
+ IBoneSceneNode(ISceneNode *parent, ISceneManager *mgr,
+ s32 id = -1, u32 boneIndex = 0,
+ const std::optional &boneName = std::nullopt)
+ :
+ ISceneNode(parent, mgr, id),
+ BoneIndex(boneIndex)
+ {
+ setName(boneName);
+ }
- //! Get the index of the bone
- virtual u32 getBoneIndex() const = 0;
+ //! Returns the index of the bone
+ u32 getBoneIndex() const
+ {
+ return BoneIndex;
+ }
- //! Sets the animation mode of the bone.
- /** \return True if successful. (Unused) */
- virtual bool setAnimationMode(E_BONE_ANIMATION_MODE mode) = 0;
+ //! returns the axis aligned bounding box of this node
+ const core::aabbox3d &getBoundingBox() const override
+ {
+ return Box;
+ }
- //! Gets the current animation mode of the bone
- virtual E_BONE_ANIMATION_MODE getAnimationMode() const = 0;
+ const u32 BoneIndex;
- //! Get the axis aligned bounding box of this node
- const core::aabbox3d &getBoundingBox() const override = 0;
-
- //! Returns the relative transformation of the scene node.
- // virtual core::matrix4 getRelativeTransformation() const = 0;
-
- //! The animation method.
- void OnAnimate(u32 timeMs) override = 0;
+ // Bogus box; bone scene nodes are not rendered anyways.
+ static constexpr core::aabbox3d Box = {{0, 0, 0}};
//! The render method.
/** Does nothing as bones are not visible. */
void render() override {}
-
- //! How the relative transformation of the bone is used
- virtual void setSkinningSpace(E_BONE_SKINNING_SPACE space) = 0;
-
- //! How the relative transformation of the bone is used
- virtual E_BONE_SKINNING_SPACE getSkinningSpace() const = 0;
-
- //! Updates the absolute position based on the relative and the parents position
- virtual void updateAbsolutePositionOfAllChildren() = 0;
-
- s32 positionHint;
- s32 scaleHint;
- s32 rotationHint;
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/ICameraSceneNode.h b/irr/include/ICameraSceneNode.h
index a7c72428dc..165c37fc47 100644
--- a/irr/include/ICameraSceneNode.h
+++ b/irr/include/ICameraSceneNode.h
@@ -7,8 +7,6 @@
#include "ISceneNode.h"
#include "IEventReceiver.h"
-namespace irr
-{
namespace scene
{
struct SViewFrustum;
@@ -181,4 +179,3 @@ protected:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/IContextManager.h b/irr/include/IContextManager.h
index 85177dc43a..56f15f7bdc 100644
--- a/irr/include/IContextManager.h
+++ b/irr/include/IContextManager.h
@@ -8,8 +8,6 @@
#include "SIrrCreationParameters.h"
#include
-namespace irr
-{
namespace video
{
// For system specific window contexts (used for OpenGL)
@@ -43,7 +41,7 @@ public:
/** This is mostly used internally by IVideoDriver::beginScene().
But if you want to switch threads which access your OpenGL driver you will have to
call this function as follows:
- Old thread gives up context with: activateContext(irr::video::SExposedVideoData());
+ Old thread gives up context with: activateContext(video::SExposedVideoData());
New thread takes over context with: activateContext(videoDriver->getExposedVideoData());
Note that only 1 thread at a time may access an OpenGL context. */
virtual bool activateContext(const SExposedVideoData &videoData, bool restorePrimaryOnZero = false) = 0;
@@ -56,4 +54,3 @@ public:
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/ICursorControl.h b/irr/include/ICursorControl.h
index 65b8efb7e4..dab6d65544 100644
--- a/irr/include/ICursorControl.h
+++ b/irr/include/ICursorControl.h
@@ -8,8 +8,6 @@
#include "position2d.h"
#include "rect.h"
-namespace irr
-{
namespace gui
{
@@ -192,4 +190,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IDummyTransformationSceneNode.h b/irr/include/IDummyTransformationSceneNode.h
index 88bc37c78e..efe0eee0a1 100644
--- a/irr/include/IDummyTransformationSceneNode.h
+++ b/irr/include/IDummyTransformationSceneNode.h
@@ -6,8 +6,6 @@
#include "ISceneNode.h"
-namespace irr
-{
namespace scene
{
@@ -33,4 +31,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/IEventReceiver.h b/irr/include/IEventReceiver.h
index 332b231581..dc37aa766a 100644
--- a/irr/include/IEventReceiver.h
+++ b/irr/include/IEventReceiver.h
@@ -8,8 +8,6 @@
#include "Keycodes.h"
#include "irrString.h"
-namespace irr
-{
//! Enumeration for all event types there are.
enum EEVENT_TYPE
{
@@ -297,7 +295,7 @@ enum EGUI_EVENT_TYPE
};
} // end namespace gui
-//! SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
+//! SEvents hold information about an event. See IEventReceiver for details on event handling.
struct SEvent
{
//! Any kind of GUI event.
@@ -444,7 +442,7 @@ struct SEvent
/** Unlike other events, joystick events represent the result of polling
* each connected joystick once per run() of the device. Joystick events will
* not be generated by default. If joystick support is available for the
- * active device, and @ref irr::IrrlichtDevice::activateJoysticks() has been
+ * active device, and @ref IrrlichtDevice::activateJoysticks() has been
* called, an event of this type will be generated once per joystick per
* @ref IrrlichtDevice::run() regardless of whether the state of the joystick
* has actually changed. */
@@ -553,7 +551,7 @@ struct SEvent
/** Many of the engine's classes inherit IEventReceiver so they are able to
process events. Events usually start at a postEventFromUser function and are
passed down through a chain of event receivers until OnEvent returns true. See
-irr::EEVENT_TYPE for a description of where each type of event starts, and the
+EEVENT_TYPE for a description of where each type of event starts, and the
path it takes through the system. */
class IEventReceiver
{
@@ -570,13 +568,13 @@ public:
virtual bool OnEvent(const SEvent &event) = 0;
};
-//! Information on a joystick, returned from @ref irr::IrrlichtDevice::activateJoysticks()
+//! Information on a joystick, returned from @ref IrrlichtDevice::activateJoysticks()
struct SJoystickInfo
{
//! The ID of the joystick
/** This is an internal Irrlicht index; it does not map directly
* to any particular hardware joystick. It corresponds to the
- * irr::SJoystickEvent Joystick ID. */
+ * SJoystickEvent Joystick ID. */
u8 Joystick;
//! The name that the joystick uses to identify itself.
@@ -605,5 +603,3 @@ struct SJoystickInfo
POV_HAT_UNKNOWN
} PovHat;
}; // struct SJoystickInfo
-
-} // end namespace irr
diff --git a/irr/include/IFileArchive.h b/irr/include/IFileArchive.h
index 5f505ae91f..f9e0a4c1f7 100644
--- a/irr/include/IFileArchive.h
+++ b/irr/include/IFileArchive.h
@@ -7,9 +7,6 @@
#include "IReadFile.h"
#include "IFileList.h"
-namespace irr
-{
-
namespace io
{
@@ -111,4 +108,3 @@ public:
};
} // end namespace io
-} // end namespace irr
diff --git a/irr/include/IFileList.h b/irr/include/IFileList.h
index f33b1628fa..bd35e17e08 100644
--- a/irr/include/IFileList.h
+++ b/irr/include/IFileList.h
@@ -7,8 +7,6 @@
#include "IReferenceCounted.h"
#include "path.h"
-namespace irr
-{
namespace io
{
@@ -85,5 +83,4 @@ public:
virtual void sort() = 0;
};
-} // end namespace irr
} // end namespace io
diff --git a/irr/include/IFileSystem.h b/irr/include/IFileSystem.h
index 30cace1998..344fd301b7 100644
--- a/irr/include/IFileSystem.h
+++ b/irr/include/IFileSystem.h
@@ -7,12 +7,6 @@
#include "IReferenceCounted.h"
#include "IFileArchive.h"
-namespace irr
-{
-namespace video
-{
-class IVideoDriver;
-} // end namespace video
namespace io
{
@@ -154,4 +148,3 @@ public:
};
} // end namespace io
-} // end namespace irr
diff --git a/irr/include/IGPUProgrammingServices.h b/irr/include/IGPUProgrammingServices.h
index ccd134209d..6940cb0f05 100644
--- a/irr/include/IGPUProgrammingServices.h
+++ b/irr/include/IGPUProgrammingServices.h
@@ -8,18 +8,9 @@
#include "EPrimitiveTypes.h"
#include "path.h"
-namespace irr
-{
-
-namespace io
-{
-class IReadFile;
-} // end namespace io
-
namespace video
{
-class IVideoDriver;
class IShaderConstantSetCallBack;
//! Interface making it possible to create and use programs running on the GPU.
@@ -141,4 +132,3 @@ public:
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/IGUIButton.h b/irr/include/IGUIButton.h
index fdee609d9f..edaca11836 100644
--- a/irr/include/IGUIButton.h
+++ b/irr/include/IGUIButton.h
@@ -7,9 +7,6 @@
#include "IGUIElement.h"
#include "SColor.h"
-namespace irr
-{
-
namespace video
{
class ITexture;
@@ -254,4 +251,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUICheckBox.h b/irr/include/IGUICheckBox.h
index 0e71510b8b..59042834b4 100644
--- a/irr/include/IGUICheckBox.h
+++ b/irr/include/IGUICheckBox.h
@@ -6,8 +6,6 @@
#include "IGUIElement.h"
-namespace irr
-{
namespace gui
{
@@ -44,4 +42,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUIComboBox.h b/irr/include/IGUIComboBox.h
index deeaad2b52..c2ff12afbd 100644
--- a/irr/include/IGUIComboBox.h
+++ b/irr/include/IGUIComboBox.h
@@ -6,8 +6,6 @@
#include "IGUIElement.h"
-namespace irr
-{
namespace gui
{
@@ -69,4 +67,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUIEditBox.h b/irr/include/IGUIEditBox.h
index c63a905db0..b480dfce15 100644
--- a/irr/include/IGUIEditBox.h
+++ b/irr/include/IGUIEditBox.h
@@ -7,8 +7,6 @@
#include "IGUIElement.h"
#include "SColor.h"
-namespace irr
-{
namespace gui
{
class IGUIFont;
@@ -141,11 +139,10 @@ public:
//! Set the blinktime for the cursor. 2x blinktime is one full cycle.
//** \param timeMs Blinktime in milliseconds. When set to 0 the cursor is constantly on without blinking */
- virtual void setCursorBlinkTime(irr::u32 timeMs) = 0;
+ virtual void setCursorBlinkTime(u32 timeMs) = 0;
//! Get the cursor blinktime
- virtual irr::u32 getCursorBlinkTime() const = 0;
+ virtual u32 getCursorBlinkTime() const = 0;
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUIElement.h b/irr/include/IGUIElement.h
index d90f88bf3c..a473458042 100644
--- a/irr/include/IGUIElement.h
+++ b/irr/include/IGUIElement.h
@@ -14,8 +14,6 @@
#include
#include
-namespace irr
-{
namespace gui
{
class IGUIEnvironment;
@@ -926,4 +924,3 @@ protected:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUIEnvironment.h b/irr/include/IGUIEnvironment.h
index 1e1d5467ae..d4e6b1b754 100644
--- a/irr/include/IGUIEnvironment.h
+++ b/irr/include/IGUIEnvironment.h
@@ -11,15 +11,11 @@
#include "IEventReceiver.h"
#include "path.h"
-namespace irr
-{
class IOSOperator;
class IEventReceiver;
namespace io
{
-class IReadFile;
-class IWriteFile;
class IFileSystem;
} // end namespace io
namespace video
@@ -46,7 +42,6 @@ class IGUITabControl;
class IGUITab;
class IGUIComboBox;
class IGUIButton;
-class IGUIWindow;
//! GUI Environment. Used as factory and manager of all other GUI elements.
/** \par This element can create the following events of type EGUI_EVENT_TYPE (which are passed on to focused sub-elements):
@@ -403,4 +398,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUIFileOpenDialog.h b/irr/include/IGUIFileOpenDialog.h
index 04a51ccb41..1a6f0b1a31 100644
--- a/irr/include/IGUIFileOpenDialog.h
+++ b/irr/include/IGUIFileOpenDialog.h
@@ -7,8 +7,6 @@
#include "IGUIElement.h"
#include "path.h"
-namespace irr
-{
namespace gui
{
@@ -41,4 +39,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUIFont.h b/irr/include/IGUIFont.h
index 5efce97967..a2aaeb39bc 100644
--- a/irr/include/IGUIFont.h
+++ b/irr/include/IGUIFont.h
@@ -9,8 +9,6 @@
#include "rect.h"
#include "irrString.h"
-namespace irr
-{
namespace gui
{
@@ -93,4 +91,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUIFontBitmap.h b/irr/include/IGUIFontBitmap.h
index f7bd70dc3a..b7e961c3d5 100644
--- a/irr/include/IGUIFontBitmap.h
+++ b/irr/include/IGUIFontBitmap.h
@@ -6,8 +6,6 @@
#include "IGUIFont.h"
-namespace irr
-{
namespace gui
{
class IGUISpriteBank;
@@ -27,4 +25,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUIImage.h b/irr/include/IGUIImage.h
index cc3c66eb9c..2cbb9ef335 100644
--- a/irr/include/IGUIImage.h
+++ b/irr/include/IGUIImage.h
@@ -7,8 +7,6 @@
#include "IGUIElement.h"
#include "SColor.h"
-namespace irr
-{
namespace video
{
class ITexture;
@@ -80,4 +78,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUIImageList.h b/irr/include/IGUIImageList.h
index a13ec57a43..2decc58220 100644
--- a/irr/include/IGUIImageList.h
+++ b/irr/include/IGUIImageList.h
@@ -7,8 +7,6 @@
#include "rect.h"
#include "irrTypes.h"
-namespace irr
-{
namespace gui
{
@@ -37,4 +35,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUIListBox.h b/irr/include/IGUIListBox.h
index 6271eb5603..bcb288f99e 100644
--- a/irr/include/IGUIListBox.h
+++ b/irr/include/IGUIListBox.h
@@ -7,8 +7,6 @@
#include "IGUIElement.h"
#include "SColor.h"
-namespace irr
-{
namespace gui
{
class IGUISpriteBank;
@@ -133,4 +131,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUIScrollBar.h b/irr/include/IGUIScrollBar.h
index c7eb4b1b8f..89a75f619a 100644
--- a/irr/include/IGUIScrollBar.h
+++ b/irr/include/IGUIScrollBar.h
@@ -6,8 +6,6 @@
#include "IGUIElement.h"
-namespace irr
-{
namespace gui
{
@@ -56,4 +54,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUISkin.h b/irr/include/IGUISkin.h
index 39d20f0e77..d4c98451db 100644
--- a/irr/include/IGUISkin.h
+++ b/irr/include/IGUISkin.h
@@ -9,8 +9,6 @@
#include "SColor.h"
#include "rect.h"
-namespace irr
-{
namespace gui
{
class IGUIFont;
@@ -537,4 +535,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUISpriteBank.h b/irr/include/IGUISpriteBank.h
index 70d8fd1b97..e46f1ee4d3 100644
--- a/irr/include/IGUISpriteBank.h
+++ b/irr/include/IGUISpriteBank.h
@@ -9,9 +9,6 @@
#include "SColor.h"
#include "rect.h"
-namespace irr
-{
-
namespace video
{
class ITexture;
@@ -135,4 +132,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUIStaticText.h b/irr/include/IGUIStaticText.h
index 02af9b573a..42ed83e34b 100644
--- a/irr/include/IGUIStaticText.h
+++ b/irr/include/IGUIStaticText.h
@@ -7,8 +7,6 @@
#include "IGUIElement.h"
#include "SColor.h"
-namespace irr
-{
namespace gui
{
class IGUIFont;
@@ -130,4 +128,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUITabControl.h b/irr/include/IGUITabControl.h
index 274d126959..be6ad5a6a3 100644
--- a/irr/include/IGUITabControl.h
+++ b/irr/include/IGUITabControl.h
@@ -7,8 +7,6 @@
#include "IGUIElement.h"
#include "SColor.h"
-namespace irr
-{
namespace gui
{
class IGUITab;
@@ -145,4 +143,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IGUIToolbar.h b/irr/include/IGUIToolbar.h
index 2011f09a13..eafd9d5a4c 100644
--- a/irr/include/IGUIToolbar.h
+++ b/irr/include/IGUIToolbar.h
@@ -6,8 +6,6 @@
#include "IGUIElement.h"
-namespace irr
-{
namespace video
{
class ITexture;
@@ -31,4 +29,3 @@ public:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/include/IImage.h b/irr/include/IImage.h
index ef8f6934b9..8352581751 100644
--- a/irr/include/IImage.h
+++ b/irr/include/IImage.h
@@ -10,8 +10,6 @@
#include "SColor.h"
#include
-namespace irr
-{
namespace video
{
@@ -208,14 +206,6 @@ public:
//! copies this surface into another
virtual void copyTo(IImage *target, const core::position2d &pos, const core::rect &sourceRect, const core::rect *clipRect = 0) = 0;
- //! copies this surface into another, using the alpha mask and cliprect and a color to add with
- /** \param combineAlpha - When true then combine alpha channels. When false replace target image alpha with source image alpha.
- */
- virtual void copyToWithAlpha(IImage *target, const core::position2d &pos,
- const core::rect &sourceRect, const SColor &color,
- const core::rect *clipRect = 0,
- bool combineAlpha = false) = 0;
-
//! copies this surface into another, scaling it to fit, applying a box filter
virtual void copyToScalingBoxFilter(IImage *target, s32 bias = 0, bool blend = false) = 0;
@@ -332,4 +322,3 @@ protected:
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/IImageLoader.h b/irr/include/IImageLoader.h
index 207b648d55..054adab15f 100644
--- a/irr/include/IImageLoader.h
+++ b/irr/include/IImageLoader.h
@@ -8,8 +8,6 @@
#include "IImage.h"
#include "path.h"
-namespace irr
-{
namespace io
{
class IReadFile;
@@ -44,4 +42,3 @@ public:
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/IImageWriter.h b/irr/include/IImageWriter.h
index 872b502900..e80f760297 100644
--- a/irr/include/IImageWriter.h
+++ b/irr/include/IImageWriter.h
@@ -7,8 +7,6 @@
#include "IReferenceCounted.h"
#include "path.h"
-namespace irr
-{
namespace io
{
class IWriteFile;
@@ -36,4 +34,3 @@ public:
};
} // namespace video
-} // namespace irr
diff --git a/irr/include/IIndexBuffer.h b/irr/include/IIndexBuffer.h
index 917fc10b4e..e5bca627fb 100644
--- a/irr/include/IIndexBuffer.h
+++ b/irr/include/IIndexBuffer.h
@@ -9,9 +9,6 @@
#include "EPrimitiveTypes.h"
#include "SVertexIndex.h"
-namespace irr
-{
-
namespace scene
{
@@ -78,4 +75,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/ILogger.h b/irr/include/ILogger.h
index 2642f3398d..b4f6710769 100644
--- a/irr/include/ILogger.h
+++ b/irr/include/ILogger.h
@@ -6,9 +6,6 @@
#include "IReferenceCounted.h"
-namespace irr
-{
-
//! Possible log levels.
//! When used has filter ELL_DEBUG means => log everything and ELL_NONE means => log (nearly) nothing.
//! When used to print logging information ELL_DEBUG will have lowest priority while ELL_NONE
@@ -71,5 +68,3 @@ public:
independent on what level filter is set, use ELL_NONE. */
virtual void log(const c8 *text, const c8 *hint, ELOG_LEVEL ll = ELL_INFORMATION) = 0;
};
-
-} // end namespace
diff --git a/irr/include/IMaterialRenderer.h b/irr/include/IMaterialRenderer.h
index ba9c4b74fb..bf79413acc 100644
--- a/irr/include/IMaterialRenderer.h
+++ b/irr/include/IMaterialRenderer.h
@@ -8,8 +8,6 @@
#include "SMaterial.h"
#include "S3DVertex.h"
-namespace irr
-{
namespace video
{
@@ -98,4 +96,3 @@ public:
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/IMaterialRendererServices.h b/irr/include/IMaterialRendererServices.h
index 8ed66061d8..6bc6b4af7c 100644
--- a/irr/include/IMaterialRendererServices.h
+++ b/irr/include/IMaterialRendererServices.h
@@ -6,8 +6,6 @@
#include "SMaterial.h"
-namespace irr
-{
namespace video
{
@@ -76,4 +74,3 @@ public:
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/IMemoryReadFile.h b/irr/include/IMemoryReadFile.h
index 982b09af32..f485b0e32d 100644
--- a/irr/include/IMemoryReadFile.h
+++ b/irr/include/IMemoryReadFile.h
@@ -6,8 +6,6 @@
#include "IReadFile.h"
-namespace irr
-{
namespace io
{
@@ -24,4 +22,3 @@ public:
virtual const void *getBuffer() const = 0;
};
} // end namespace io
-} // end namespace irr
diff --git a/irr/include/IMesh.h b/irr/include/IMesh.h
index 8ee180d5d3..6f904f80bc 100644
--- a/irr/include/IMesh.h
+++ b/irr/include/IMesh.h
@@ -8,8 +8,6 @@
#include "SMaterial.h"
#include "EHardwareBufferFlags.h"
-namespace irr
-{
namespace scene
{
//! Possible types of meshes.
@@ -20,38 +18,6 @@ enum E_ANIMATED_MESH_TYPE
//! Unknown animated mesh type.
EAMT_UNKNOWN = 0,
- //! Quake 2 MD2 model file
- EAMT_MD2,
-
- //! Quake 3 MD3 model file
- EAMT_MD3,
-
- //! Maya .obj static model
- EAMT_OBJ,
-
- //! Quake 3 .bsp static Map
- EAMT_BSP,
-
- //! 3D Studio .3ds file
- EAMT_3DS,
-
- //! My3D Mesh, the file format by Zhuck Dimitry
- EAMT_MY3D,
-
- //! Pulsar LMTools .lmts file. This Irrlicht loader was written by Jonas Petersen
- EAMT_LMTS,
-
- //! Cartography Shop .csm file. This loader was created by Saurav Mohapatra.
- EAMT_CSM,
-
- //! .oct file for Paul Nette's FSRad or from Murphy McCauley's Blender .oct exporter.
- /** The oct file format contains 3D geometry and lightmaps and
- can be loaded directly by Irrlicht */
- EAMT_OCT,
-
- //! Halflife MDL model file
- EAMT_MDL_HALFLIFE,
-
//! generic skinned mesh
EAMT_SKINNED,
@@ -119,9 +85,7 @@ public:
virtual void setDirty(E_BUFFER_TYPE buffer = EBT_VERTEX_AND_INDEX) = 0;
//! Returns the type of the meshes.
- /** This is useful for making a safe downcast. For example,
- if getMeshType() returns EAMT_MD2 it's safe to cast the
- IMesh to IAnimatedMeshMD2.
+ /** This is useful for making a safe downcast.
Note: It's no longer just about animated meshes, that name has just historical reasons.
\returns Type of the mesh */
virtual E_ANIMATED_MESH_TYPE getMeshType() const
@@ -131,4 +95,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/IMeshBuffer.h b/irr/include/IMeshBuffer.h
index afcf289431..65fd555258 100644
--- a/irr/include/IMeshBuffer.h
+++ b/irr/include/IMeshBuffer.h
@@ -13,8 +13,6 @@
#include "EPrimitiveTypes.h"
#include
-namespace irr
-{
namespace scene
{
//! Struct for holding a mesh with a single material.
@@ -241,4 +239,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/IMeshCache.h b/irr/include/IMeshCache.h
index 66052bfac7..6b8fd6fe09 100644
--- a/irr/include/IMeshCache.h
+++ b/irr/include/IMeshCache.h
@@ -7,15 +7,10 @@
#include "IReferenceCounted.h"
#include "path.h"
-namespace irr
-{
-
namespace scene
{
class IMesh;
class IAnimatedMesh;
-class IAnimatedMeshSceneNode;
-class IMeshLoader;
//! The mesh cache stores already loaded meshes and provides an interface to them.
/** You can access it using ISceneManager::getMeshCache(). All existing
@@ -128,4 +123,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/IMeshLoader.h b/irr/include/IMeshLoader.h
index d1f2675e98..2e5615607a 100644
--- a/irr/include/IMeshLoader.h
+++ b/irr/include/IMeshLoader.h
@@ -7,8 +7,6 @@
#include "IReferenceCounted.h"
#include "path.h"
-namespace irr
-{
namespace io
{
class IReadFile;
@@ -47,4 +45,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/IMeshManipulator.h b/irr/include/IMeshManipulator.h
index c9d989cae8..6d8f21af8a 100644
--- a/irr/include/IMeshManipulator.h
+++ b/irr/include/IMeshManipulator.h
@@ -11,8 +11,6 @@
#include "IMeshBuffer.h"
#include "SVertexManipulator.h"
-namespace irr
-{
namespace scene
{
@@ -66,26 +64,6 @@ public:
IReferenceCounted::drop() for more information. */
virtual SMesh *createMeshCopy(IMesh *mesh) const = 0;
- //! Get amount of polygons in mesh.
- /** \param mesh Input mesh
- \return Number of polygons in mesh. */
- virtual s32 getPolyCount(IMesh *mesh) const = 0;
-
- //! Get amount of polygons in mesh.
- /** \param mesh Input mesh
- \return Number of polygons in mesh. */
- virtual s32 getPolyCount(IAnimatedMesh *mesh) const = 0;
-
- //! Create a new AnimatedMesh and adds the mesh to it
- /** \param mesh Input mesh
- \param type The type of the animated mesh to create.
- \return Newly created animated mesh with mesh as its only
- content. When you don't need the animated mesh anymore, you
- should call IAnimatedMesh::drop(). See
- IReferenceCounted::drop() for more information. */
- virtual IAnimatedMesh *createAnimatedMesh(IMesh *mesh,
- scene::E_ANIMATED_MESH_TYPE type = scene::EAMT_UNKNOWN) const = 0;
-
//! Apply a manipulator on the Meshbuffer
/** \param func A functor defining the mesh manipulation.
\param buffer The Meshbuffer to apply the manipulator to.
@@ -166,4 +144,3 @@ protected:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/IMeshSceneNode.h b/irr/include/IMeshSceneNode.h
index 1fb0054054..247b27da68 100644
--- a/irr/include/IMeshSceneNode.h
+++ b/irr/include/IMeshSceneNode.h
@@ -6,8 +6,6 @@
#include "ISceneNode.h"
-namespace irr
-{
namespace scene
{
@@ -32,7 +30,7 @@ public:
//! Get the currently defined mesh for display.
/** \return Pointer to mesh which is displayed by this node. */
- virtual IMesh *getMesh(void) = 0;
+ virtual IMesh *getMesh() = 0;
//! Sets if the scene node should not copy the materials of the mesh but use them directly.
/** In this way it is possible to change the materials of a mesh
@@ -47,4 +45,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/IOSOperator.h b/irr/include/IOSOperator.h
index 6164af5c98..1316cba69f 100644
--- a/irr/include/IOSOperator.h
+++ b/irr/include/IOSOperator.h
@@ -7,9 +7,6 @@
#include "IReferenceCounted.h"
#include "irrString.h"
-namespace irr
-{
-
//! The OSOperator provides OS-specific methods and information.
class IOSOperator : public virtual IReferenceCounted
{
@@ -41,5 +38,3 @@ public:
\return True if successful, false if not */
virtual bool getSystemMemory(u32 *totalBytes, u32 *availableBytes) const = 0;
};
-
-} // end namespace
diff --git a/irr/include/IReadFile.h b/irr/include/IReadFile.h
index 4431bdb325..d4f0017ddd 100644
--- a/irr/include/IReadFile.h
+++ b/irr/include/IReadFile.h
@@ -8,8 +8,6 @@
#include "EReadFileType.h"
#include "path.h"
-namespace irr
-{
namespace io
{
@@ -54,4 +52,3 @@ public:
IReadFile *createLimitReadFile(const io::path &fileName, IReadFile *alreadyOpenedFile, long pos, long areaSize);
} // end namespace io
-} // end namespace irr
diff --git a/irr/include/IReferenceCounted.h b/irr/include/IReferenceCounted.h
index 80454f9ea0..584943bce6 100644
--- a/irr/include/IReferenceCounted.h
+++ b/irr/include/IReferenceCounted.h
@@ -7,9 +7,6 @@
#include "irrTypes.h"
#include
-namespace irr
-{
-
//! Base class of most objects of the Irrlicht Engine.
/** This class provides reference counting through the methods grab() and drop().
It also is able to store a debug string for every instance of an object.
@@ -142,5 +139,3 @@ private:
//! The reference counter. Mutable to do reference counting on const objects.
mutable s32 ReferenceCounter;
};
-
-} // end namespace irr
diff --git a/irr/include/IRenderTarget.h b/irr/include/IRenderTarget.h
index d4e5960a29..b39f3ac61c 100644
--- a/irr/include/IRenderTarget.h
+++ b/irr/include/IRenderTarget.h
@@ -8,8 +8,6 @@
#include "EDriverTypes.h"
#include "irrArray.h"
-namespace irr
-{
namespace video
{
class ITexture;
@@ -112,4 +110,3 @@ protected:
};
}
-}
diff --git a/irr/include/ISceneCollisionManager.h b/irr/include/ISceneCollisionManager.h
index 3307dc6bb6..d5b55ec25e 100644
--- a/irr/include/ISceneCollisionManager.h
+++ b/irr/include/ISceneCollisionManager.h
@@ -8,9 +8,6 @@
#include "position2d.h"
#include "line3d.h"
-namespace irr
-{
-
namespace scene
{
class ICameraSceneNode;
@@ -30,4 +27,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/ISceneManager.h b/irr/include/ISceneManager.h
index 847666450d..c4fff3c6af 100644
--- a/irr/include/ISceneManager.h
+++ b/irr/include/ISceneManager.h
@@ -11,30 +11,16 @@
#include "SColor.h"
#include "ESceneNodeTypes.h"
-namespace irr
-{
-struct SKeyMap;
struct SEvent;
namespace io
{
class IReadFile;
-class IWriteFile;
-class IFileSystem;
} // end namespace io
-namespace gui
-{
-class IGUIFont;
-class IGUIEnvironment;
-} // end namespace gui
-
namespace video
{
class IVideoDriver;
-class SMaterial;
-class IImage;
-class ITexture;
} // end namespace video
namespace scene
@@ -91,14 +77,12 @@ class ICameraSceneNode;
class IDummyTransformationSceneNode;
class IMesh;
class SkinnedMesh;
-class IMeshBuffer;
class IMeshCache;
class ISceneCollisionManager;
class IMeshLoader;
class IMeshManipulator;
class IMeshSceneNode;
class ISceneNode;
-class ISceneNodeFactory;
//! The Scene Manager manages scene nodes, mesh resources, cameras and all the other stuff.
/** All Scene nodes can be created only here.
@@ -433,4 +417,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/ISceneNode.h b/irr/include/ISceneNode.h
index f91fd64997..4dcc98e09a 100644
--- a/irr/include/ISceneNode.h
+++ b/irr/include/ISceneNode.h
@@ -18,8 +18,6 @@
#include
#include
-namespace irr
-{
namespace scene
{
class ISceneNode;
@@ -94,16 +92,12 @@ public:
\param timeMs Current time in milliseconds. */
virtual void OnAnimate(u32 timeMs)
{
- if (IsVisible) {
- // update absolute position
- updateAbsolutePosition();
+ if (!IsVisible && Children.empty())
+ return;
- // perform the post render process on all children
-
- ISceneNodeList::iterator it = Children.begin();
- for (; it != Children.end(); ++it)
- (*it)->OnAnimate(timeMs);
- }
+ updateAbsolutePosition();
+ for (auto *child : Children)
+ child->OnAnimate(timeMs);
}
//! Renders the node.
@@ -421,7 +415,7 @@ public:
}
//! Sets if debug data like bounding boxes should be drawn.
- /** A bitwise OR of the types from @ref irr::scene::E_DEBUG_SCENE_TYPE.
+ /** A bitwise OR of the types from @ref scene::E_DEBUG_SCENE_TYPE.
Please note that not all scene nodes support all debug data types.
\param state The debug data visibility state to be used. */
virtual void setDebugDataVisible(u16 state)
@@ -431,7 +425,7 @@ public:
//! Returns if debug data like bounding boxes are drawn.
/** \return A bitwise OR of the debug data values from
- @ref irr::scene::E_DEBUG_SCENE_TYPE that are currently visible. */
+ @ref scene::E_DEBUG_SCENE_TYPE that are currently visible. */
u16 isDebugDataVisible() const
{
return DebugDataVisible;
@@ -599,4 +593,3 @@ protected:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/IShaderConstantSetCallBack.h b/irr/include/IShaderConstantSetCallBack.h
index 2e37a34ae0..c6c7cef53a 100644
--- a/irr/include/IShaderConstantSetCallBack.h
+++ b/irr/include/IShaderConstantSetCallBack.h
@@ -6,8 +6,6 @@
#include "IReferenceCounted.h"
-namespace irr
-{
namespace video
{
class IMaterialRendererServices;
@@ -76,4 +74,3 @@ public:
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/ITexture.h b/irr/include/ITexture.h
index bdbb727274..21ea319c0a 100644
--- a/irr/include/ITexture.h
+++ b/irr/include/ITexture.h
@@ -10,8 +10,6 @@
#include "EDriverTypes.h"
#include "path.h"
-namespace irr
-{
namespace video
{
@@ -292,4 +290,3 @@ protected:
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/ITimer.h b/irr/include/ITimer.h
index 22c79f6036..acb9c88ab0 100644
--- a/irr/include/ITimer.h
+++ b/irr/include/ITimer.h
@@ -6,9 +6,6 @@
#include "IReferenceCounted.h"
-namespace irr
-{
-
//! Interface for getting and manipulating the virtual time
class ITimer : public virtual IReferenceCounted
{
@@ -61,5 +58,3 @@ public:
but you can call it manually if you don't use this method. */
virtual void tick() = 0;
};
-
-} // end namespace irr
diff --git a/irr/include/IVertexBuffer.h b/irr/include/IVertexBuffer.h
index e6f8c633c2..02eade137f 100644
--- a/irr/include/IVertexBuffer.h
+++ b/irr/include/IVertexBuffer.h
@@ -8,8 +8,6 @@
#include "EHardwareBufferFlags.h"
#include "S3DVertex.h"
-namespace irr
-{
namespace scene
{
@@ -71,4 +69,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/IVideoDriver.h b/irr/include/IVideoDriver.h
index f392eb636f..2d58940c32 100644
--- a/irr/include/IVideoDriver.h
+++ b/irr/include/IVideoDriver.h
@@ -21,8 +21,6 @@
#include "S3DVertex.h" // E_VERTEX_TYPE
#include "SVertexIndex.h" // E_INDEX_TYPE
-namespace irr
-{
namespace io
{
class IReadFile;
@@ -69,7 +67,7 @@ struct SFrameStats {
the Irrlicht Engine: All rendering and texture manipulation is done with
this interface. You are able to use the Irrlicht Engine by only
invoking methods of this interface if you like to, although the
-irr::scene::ISceneManager interface provides a lot of powerful classes
+scene::ISceneManager interface provides a lot of powerful classes
and methods to make the programmer's life easier.
*/
class IVideoDriver : public virtual IReferenceCounted
@@ -172,7 +170,7 @@ public:
\return Pointer to the texture, or 0 if the texture
could not be loaded. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
- virtual ITexture *getTexture(const io::path &filename) = 0;
+ [[deprecated]] virtual ITexture *getTexture(const io::path &filename) = 0;
//! Get access to a named texture.
/** Loads the texture from disk if it is not
@@ -184,7 +182,7 @@ public:
\return Pointer to the texture, or 0 if the texture
could not be loaded. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
- virtual ITexture *getTexture(io::IReadFile *file) = 0;
+ [[deprecated]] virtual ITexture *getTexture(io::IReadFile *file) = 0;
//! Returns amount of textures currently loaded
/** \return Amount of textures currently loaded */
@@ -245,7 +243,7 @@ public:
that the driver may choose to create the texture in another
color format.
\return Pointer to the newly created texture. */
- virtual ITexture *addTextureCubemap(const irr::u32 sideLen, const io::path &name, ECOLOR_FORMAT format = ECF_A8R8G8B8) = 0;
+ virtual ITexture *addTextureCubemap(const u32 sideLen, const io::path &name, ECOLOR_FORMAT format = ECF_A8R8G8B8) = 0;
//! Adds a new render target texture to the texture cache.
/** \param size Size of the texture, in pixels. Width and
@@ -279,7 +277,7 @@ public:
\return Pointer to the created texture or 0 if the texture
could not be created. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
- virtual ITexture *addRenderTargetTextureCubemap(const irr::u32 sideLen,
+ virtual ITexture *addRenderTargetTextureCubemap(const u32 sideLen,
const io::path &name = "rt", const ECOLOR_FORMAT format = ECF_UNKNOWN) = 0;
//! Removes a texture from the texture cache and deletes it.
@@ -1125,8 +1123,7 @@ public:
virtual bool queryTextureFormat(ECOLOR_FORMAT format) const = 0;
//! Used by some SceneNodes to check if a material should be rendered in the transparent render pass
- virtual bool needsTransparentRenderPass(const irr::video::SMaterial &material) const = 0;
+ virtual bool needsTransparentRenderPass(const video::SMaterial &material) const = 0;
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/IWriteFile.h b/irr/include/IWriteFile.h
index cc27e59035..f0a88de90a 100644
--- a/irr/include/IWriteFile.h
+++ b/irr/include/IWriteFile.h
@@ -7,8 +7,6 @@
#include "IReferenceCounted.h"
#include "path.h"
-namespace irr
-{
namespace io
{
@@ -44,4 +42,3 @@ public:
};
} // end namespace io
-} // end namespace irr
diff --git a/irr/include/IrrlichtDevice.h b/irr/include/IrrlichtDevice.h
index ed77f979ed..046ac99ab1 100644
--- a/irr/include/IrrlichtDevice.h
+++ b/irr/include/IrrlichtDevice.h
@@ -18,8 +18,6 @@
#include
#include
-namespace irr
-{
class ILogger;
class IEventReceiver;
@@ -42,7 +40,6 @@ namespace video
{
class IContextManager;
class IImage;
-class ITexture;
class IVideoDriver;
extern "C" bool isDriverSupported(E_DRIVER_TYPE driver);
} // end namespace video
@@ -78,7 +75,7 @@ public:
also simply use your own message loop using GetMessage,
DispatchMessage and whatever and simply don't use this method.
But note that Irrlicht will not be able to fetch user input
- then. See irr::SIrrlichtCreationParameters::WindowId for more
+ then. See SIrrlichtCreationParameters::WindowId for more
information and example code.
*/
virtual bool run() = 0;
@@ -210,7 +207,7 @@ public:
//! Sets a new user event receiver which will receive events from the engine.
/** Return true in IEventReceiver::OnEvent to prevent the event from continuing along
the chain of event receivers. The path that an event takes through the system depends
- on its type. See irr::EEVENT_TYPE for details.
+ on its type. See EEVENT_TYPE for details.
\param receiver New receiver to be used. */
virtual void setEventReceiver(IEventReceiver *receiver) = 0;
@@ -243,7 +240,7 @@ public:
It does set the drawing/clientDC size of the window, the window decorations are added to that.
You get the current window size with IVideoDriver::getScreenSize() (might be unified in future)
*/
- virtual void setWindowSize(const irr::core::dimension2d &size) = 0;
+ virtual void setWindowSize(const core::dimension2d &size) = 0;
//! Minimizes the window if possible.
virtual void minimizeWindow() = 0;
@@ -260,7 +257,7 @@ public:
//! Activate any joysticks, and generate events for them.
/** Irrlicht contains support for joysticks, but does not generate joystick events by default,
as this would consume joystick info that 3rd party libraries might rely on. Call this method to
- activate joystick support in Irrlicht and to receive irr::SJoystickEvent events.
+ activate joystick support in Irrlicht and to receive SJoystickEvent events.
\param joystickInfo On return, this will contain an array of each joystick that was found and activated.
\return true if joysticks are supported on this device, false if joysticks are not
supported or support is compiled out.
@@ -371,5 +368,3 @@ public:
return Keycode(KEY_UNKNOWN, (wchar_t)scancode);
}
};
-
-} // end namespace irr
diff --git a/irr/include/Keycodes.h b/irr/include/Keycodes.h
index a6a0a5daee..f69331f79c 100644
--- a/irr/include/Keycodes.h
+++ b/irr/include/Keycodes.h
@@ -5,9 +5,6 @@
#pragma once
#include
-namespace irr
-{
-
enum EKEY_CODE
{
KEY_UNKNOWN = 0x0,
@@ -208,5 +205,3 @@ public:
return code > 0 && code < KEY_KEY_CODES_COUNT;
}
};
-
-} // end namespace irr
diff --git a/irr/include/S3DVertex.h b/irr/include/S3DVertex.h
index 2039df0e56..0c269a635a 100644
--- a/irr/include/S3DVertex.h
+++ b/irr/include/S3DVertex.h
@@ -8,8 +8,6 @@
#include "vector2d.h"
#include "SColor.h"
-namespace irr
-{
namespace video
{
@@ -285,4 +283,3 @@ inline u32 getVertexPitchFromType(E_VERTEX_TYPE vertexType)
}
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/SAnimatedMesh.h b/irr/include/SAnimatedMesh.h
deleted file mode 100644
index dcc65410f7..0000000000
--- a/irr/include/SAnimatedMesh.h
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright (C) 2002-2012 Nikolaus Gebhardt
-// This file is part of the "Irrlicht Engine".
-// For conditions of distribution and use, see copyright notice in irrlicht.h
-
-#pragma once
-
-#include
-#include "IAnimatedMesh.h"
-#include "IMesh.h"
-#include "aabbox3d.h"
-
-namespace irr
-{
-namespace scene
-{
-
-//! Simple implementation of the IAnimatedMesh interface.
-struct SAnimatedMesh final : public IAnimatedMesh
-{
- //! constructor
- SAnimatedMesh(scene::IMesh *mesh = 0, scene::E_ANIMATED_MESH_TYPE type = scene::EAMT_UNKNOWN) :
- IAnimatedMesh(), FramesPerSecond(25.f), Type(type)
- {
- addMesh(mesh);
- recalculateBoundingBox();
- }
-
- //! destructor
- virtual ~SAnimatedMesh()
- {
- // drop meshes
- for (auto *mesh : Meshes)
- mesh->drop();
- }
-
- f32 getMaxFrameNumber() const override
- {
- return static_cast(Meshes.size() - 1);
- }
-
- //! Gets the default animation speed of the animated mesh.
- /** \return Amount of frames per second. If the amount is 0, it is a static, non animated mesh. */
- f32 getAnimationSpeed() const override
- {
- return FramesPerSecond;
- }
-
- //! Gets the frame count of the animated mesh.
- /** \param fps Frames per second to play the animation with. If the amount is 0, it is not animated.
- The actual speed is set in the scene node the mesh is instantiated in.*/
- void setAnimationSpeed(f32 fps) override
- {
- FramesPerSecond = fps;
- }
-
- //! Returns the IMesh interface for a frame.
- /** \param frame: Frame number as zero based index.
- \return The animated mesh based for the given frame */
- IMesh *getMesh(f32 frame) override
- {
- if (Meshes.empty())
- return nullptr;
-
- return Meshes[static_cast(frame)];
- }
-
- //! adds a Mesh
- void addMesh(IMesh *mesh)
- {
- if (mesh) {
- mesh->grab();
- Meshes.push_back(mesh);
- }
- }
-
- //! Returns an axis aligned bounding box of the mesh.
- /** \return A bounding box of this mesh is returned. */
- const core::aabbox3d &getBoundingBox() const override
- {
- return Box;
- }
-
- //! set user axis aligned bounding box
- void setBoundingBox(const core::aabbox3df &box) override
- {
- Box = box;
- }
-
- //! Recalculates the bounding box.
- void recalculateBoundingBox()
- {
- Box.reset(0, 0, 0);
-
- if (Meshes.empty())
- return;
-
- Box = Meshes[0]->getBoundingBox();
-
- for (u32 i = 1; i < Meshes.size(); ++i)
- Box.addInternalBox(Meshes[i]->getBoundingBox());
- }
-
- //! Returns the type of the animated mesh.
- E_ANIMATED_MESH_TYPE getMeshType() const override
- {
- return Type;
- }
-
- //! returns amount of mesh buffers.
- u32 getMeshBufferCount() const override
- {
- if (Meshes.empty())
- return 0;
-
- return Meshes[0]->getMeshBufferCount();
- }
-
- //! returns pointer to a mesh buffer
- IMeshBuffer *getMeshBuffer(u32 nr) const override
- {
- if (Meshes.empty())
- return 0;
-
- return Meshes[0]->getMeshBuffer(nr);
- }
-
- //! Returns pointer to a mesh buffer which fits a material
- /** \param material: material to search for
- \return Returns the pointer to the mesh buffer or
- NULL if there is no such mesh buffer. */
- IMeshBuffer *getMeshBuffer(const video::SMaterial &material) const override
- {
- if (Meshes.empty())
- return 0;
-
- return Meshes[0]->getMeshBuffer(material);
- }
-
- //! set the hardware mapping hint, for driver
- void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer = EBT_VERTEX_AND_INDEX) override
- {
- for (u32 i = 0; i < Meshes.size(); ++i)
- Meshes[i]->setHardwareMappingHint(newMappingHint, buffer);
- }
-
- //! flags the meshbuffer as changed, reloads hardware buffers
- void setDirty(E_BUFFER_TYPE buffer = EBT_VERTEX_AND_INDEX) override
- {
- for (u32 i = 0; i < Meshes.size(); ++i)
- Meshes[i]->setDirty(buffer);
- }
-
- //! All meshes defining the animated mesh
- std::vector Meshes;
-
- //! The bounding box of this mesh
- core::aabbox3d Box{{0.0f, 0.0f, 0.0f}};
-
- //! Default animation speed of this mesh.
- f32 FramesPerSecond;
-
- //! The type of the mesh.
- E_ANIMATED_MESH_TYPE Type;
-};
-
-} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/SColor.h b/irr/include/SColor.h
index 0845b31f7a..f45d7404bf 100644
--- a/irr/include/SColor.h
+++ b/irr/include/SColor.h
@@ -7,8 +7,6 @@
#include "irrTypes.h"
#include "irrMath.h"
-namespace irr
-{
namespace video
{
//! An enum for the color format of textures used by the Irrlicht Engine.
@@ -655,4 +653,3 @@ inline f32 SColorHSL::toRGB1(f32 rm1, f32 rm2, f32 rh) const
}
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/SExposedVideoData.h b/irr/include/SExposedVideoData.h
index 9befcb15bd..fdeaa50807 100644
--- a/irr/include/SExposedVideoData.h
+++ b/irr/include/SExposedVideoData.h
@@ -4,8 +4,6 @@
#pragma once
-namespace irr
-{
namespace video
{
@@ -79,4 +77,3 @@ struct SExposedVideoData
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/SIrrCreationParameters.h b/irr/include/SIrrCreationParameters.h
index 4eedde50fb..712717a31d 100644
--- a/irr/include/SIrrCreationParameters.h
+++ b/irr/include/SIrrCreationParameters.h
@@ -11,8 +11,6 @@
#include "position2d.h"
#include "path.h"
-namespace irr
-{
class IEventReceiver;
//! Structure for holding Irrlicht Device creation parameters.
@@ -224,10 +222,8 @@ struct SIrrlichtCreationParameters
//! Set the path where default-shaders to simulate the fixed-function pipeline can be found.
/** This is about the shaders which can be found in media/Shaders by default. It's only necessary
to set when using OGL-ES 2.0 */
- irr::io::path OGLES2ShaderPath;
+ io::path OGLES2ShaderPath;
//! Enable debug and error checks in video driver.
bool DriverDebug;
};
-
-} // end namespace irr
diff --git a/irr/include/SMaterial.h b/irr/include/SMaterial.h
index 0b032e2b2f..98b49a3d78 100644
--- a/irr/include/SMaterial.h
+++ b/irr/include/SMaterial.h
@@ -11,8 +11,6 @@
#include "EMaterialProps.h" // IWYU pragma: export
#include "SMaterialLayer.h"
-namespace irr
-{
namespace video
{
class ITexture;
@@ -178,7 +176,7 @@ inline bool textureBlendFunc_hasAlpha(const E_BLEND_FACTOR factor)
to coverage.
Some drivers don't support a per-material setting of the anti-aliasing
modes. In those cases, FSAA/multisampling is defined by the device mode
-chosen upon creation via irr::SIrrCreationParameters.
+chosen upon creation via SIrrCreationParameters.
*/
enum E_ANTI_ALIASING_MODE : u8
{
@@ -474,19 +472,18 @@ public:
extern const SMaterial IdentityMaterial;
} // end namespace video
-} // end namespace irr
template<>
-struct std::hash
+struct std::hash
{
/// @brief std::hash specialization for video::SMaterial
- std::size_t operator()(const irr::video::SMaterial &m) const noexcept
+ std::size_t operator()(const video::SMaterial &m) const noexcept
{
std::size_t ret = 0;
for (auto h : { // the three members most likely to differ
- std::hash{}(m.getTexture(0)),
+ std::hash{}(m.getTexture(0)),
std::hash{}(m.MaterialType),
- std::hash{}(m.ColorParam.color)
+ std::hash{}(m.ColorParam.color)
}) {
ret += h;
ret ^= (ret << 6) + (ret >> 2); // distribute bits
diff --git a/irr/include/SMaterialLayer.h b/irr/include/SMaterialLayer.h
index 4d43bd8207..f657d19b93 100644
--- a/irr/include/SMaterialLayer.h
+++ b/irr/include/SMaterialLayer.h
@@ -6,8 +6,6 @@
#include "matrix4.h"
-namespace irr
-{
namespace video
{
class ITexture;
@@ -235,4 +233,3 @@ private:
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/SMesh.h b/irr/include/SMesh.h
index 5e76fafc51..12f13f8b79 100644
--- a/irr/include/SMesh.h
+++ b/irr/include/SMesh.h
@@ -5,16 +5,14 @@
#pragma once
#include
-#include "IMesh.h"
+#include "IAnimatedMesh.h"
#include "IMeshBuffer.h"
#include "aabbox3d.h"
-namespace irr
-{
namespace scene
{
//! Simple implementation of the IMesh interface.
-struct SMesh final : public IMesh
+struct SMesh final : public IAnimatedMesh
{
//! constructor
SMesh() {}
@@ -134,7 +132,15 @@ struct SMesh final : public IMesh
//! The bounding box of this mesh
core::aabbox3d BoundingBox{{0, 0, 0}};
+
+ // Implement animated mesh interface as a static mesh.
+ // Slightly hacky: Eventually should be consolidated with SSkinnedMesh,
+ // with all the animation-related parts behind an optional.
+
+ virtual f32 getMaxFrameNumber() const override { return 0.0f; }
+ virtual f32 getAnimationSpeed() const override { return 0.0f; }
+ virtual void setAnimationSpeed(f32 fps) override {}
+ E_ANIMATED_MESH_TYPE getMeshType() const override { return EAMT_STATIC; }
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/SMeshBuffer.h b/irr/include/SMeshBuffer.h
deleted file mode 100644
index c92669724a..0000000000
--- a/irr/include/SMeshBuffer.h
+++ /dev/null
@@ -1,6 +0,0 @@
-// Copyright (C) 2002-2012 Nikolaus Gebhardt
-// This file is part of the "Irrlicht Engine".
-// For conditions of distribution and use, see copyright notice in irrlicht.h
-
-// replaced by template
-#include "CMeshBuffer.h" // IWYU pragma: export
diff --git a/irr/include/SOverrideMaterial.h b/irr/include/SOverrideMaterial.h
index 1ae324211f..87a74267c4 100644
--- a/irr/include/SOverrideMaterial.h
+++ b/irr/include/SOverrideMaterial.h
@@ -7,8 +7,6 @@
#include
#include "SMaterial.h"
-namespace irr
-{
namespace video
{
@@ -177,4 +175,3 @@ struct SOverrideMaterial
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/SSkinMeshBuffer.h b/irr/include/SSkinMeshBuffer.h
index 8b2e268826..6141227350 100644
--- a/irr/include/SSkinMeshBuffer.h
+++ b/irr/include/SSkinMeshBuffer.h
@@ -10,8 +10,6 @@
#include "S3DVertex.h"
#include
-namespace irr
-{
namespace scene
{
@@ -238,4 +236,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/SVertexIndex.h b/irr/include/SVertexIndex.h
index 73db1d23f9..e9eca16da7 100644
--- a/irr/include/SVertexIndex.h
+++ b/irr/include/SVertexIndex.h
@@ -4,8 +4,6 @@
#pragma once
-namespace irr
-{
namespace video
{
enum E_INDEX_TYPE
@@ -15,4 +13,3 @@ enum E_INDEX_TYPE
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/include/SVertexManipulator.h b/irr/include/SVertexManipulator.h
index 80111b8ed9..484645f56c 100644
--- a/irr/include/SVertexManipulator.h
+++ b/irr/include/SVertexManipulator.h
@@ -6,14 +6,9 @@
#include "vector3d.h"
-namespace irr
-{
namespace scene
{
-class IMesh;
-class IMeshBuffer;
-struct SMesh;
//! Interface for vertex manipulators.
/** You should derive your manipulator from this class if it shall be called for every vertex, getting as parameter just the vertex.
@@ -39,4 +34,3 @@ private:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/SViewFrustum.h b/irr/include/SViewFrustum.h
index c03707d4ff..0b2902ac65 100644
--- a/irr/include/SViewFrustum.h
+++ b/irr/include/SViewFrustum.h
@@ -11,8 +11,6 @@
#include "matrix4.h"
#include "EVideoTypes.h"
-namespace irr
-{
namespace scene
{
@@ -446,4 +444,3 @@ inline void SViewFrustum::recalculateBoundingSphere()
}
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/SkinnedMesh.h b/irr/include/SkinnedMesh.h
index a527db76e5..c09f18413c 100644
--- a/irr/include/SkinnedMesh.h
+++ b/irr/include/SkinnedMesh.h
@@ -6,16 +6,21 @@
#include "IAnimatedMesh.h"
#include "ISceneManager.h"
-#include "SMeshBuffer.h"
+#include "CMeshBuffer.h"
#include "SSkinMeshBuffer.h"
+#include "aabbox3d.h"
+#include "irrMath.h"
+#include "irrTypes.h"
+#include "matrix4.h"
#include "quaternion.h"
#include "vector3d.h"
+#include "Transform.h"
#include
#include
+#include
+#include
-namespace irr
-{
namespace scene
{
@@ -37,9 +42,8 @@ public:
//! constructor
SkinnedMesh(SourceFormat src_format) :
EndFrame(0.f), FramesPerSecond(25.f),
- LastAnimatedFrame(-1), SkinnedLastFrame(false),
HasAnimation(false), PreparedForSkinning(false),
- AnimateNormals(true), HardwareSkinning(false),
+ AnimateNormals(true),
SrcFormat(src_format)
{
SkinningBuffers = &LocalBuffers;
@@ -64,14 +68,12 @@ public:
The actual speed is set in the scene node the mesh is instantiated in.*/
void setAnimationSpeed(f32 fps) override;
- //! returns the animated mesh for the given frame
- IMesh *getMesh(f32) override;
+ //! Turns the given array of local matrices into an array of global matrices
+ //! by multiplying with respective parent matrices.
+ void calculateGlobalMatrices(std::vector &matrices) const;
- //! Animates joints based on frame input
- void animateMesh(f32 frame);
-
- //! Performs a software skin on this mesh based of joint positions
- void skinMesh();
+ //! Performs a software skin on this mesh based on the given joint matrices
+ void skinMesh(const std::vector &animated_transforms);
//! returns amount of mesh buffers.
u32 getMeshBufferCount() const override;
@@ -89,14 +91,15 @@ public:
void setTextureSlot(u32 meshbufNr, u32 textureSlot);
- //! returns an axis aligned bounding box
+ //! Returns bounding box of the mesh *in static pose*.
const core::aabbox3d &getBoundingBox() const override {
- return BoundingBox;
+ // TODO ideally we shouldn't be forced to implement this
+ return StaticPoseBox;
}
- //! set user axis aligned bounding box
+ //! Set bounding box of the mesh *in static pose*.
void setBoundingBox(const core::aabbox3df &box) override {
- BoundingBox = box;
+ StaticPoseBox = box;
}
//! set the hardware mapping hint, for driver
@@ -140,28 +143,15 @@ public:
return !HasAnimation;
}
- //! Allows to enable hardware skinning.
- /* This feature is not implemented in Irrlicht yet */
- bool setHardwareSkinning(bool on);
-
//! Refreshes vertex data cached in joints such as positions and normals
void refreshJointCache();
//! Moves the mesh into static position.
void resetAnimation();
- void updateBoundingBox();
-
- //! Recovers the joints from the mesh
- void recoverJointsFromMesh(std::vector &jointChildSceneNodes);
-
- //! Transfers the joint data to the mesh
- void transferJointsToMesh(const std::vector &jointChildSceneNodes);
-
//! Creates an array of joints from this mesh as children of node
- void addJoints(std::vector &jointChildSceneNodes,
- IAnimatedMeshSceneNode *node,
- ISceneManager *smgr);
+ std::vector addJoints(
+ IAnimatedMeshSceneNode *node, ISceneManager *smgr);
//! A vertex weight
struct SWeight
@@ -236,7 +226,7 @@ public:
static core::quaternion interpolateValue(core::quaternion from, core::quaternion to, f32 time) {
core::quaternion result;
- result.slerp(from, to, time, 0.001f);
+ result.slerp(from, to, time);
return result;
}
@@ -288,15 +278,14 @@ public:
});
}
- void updateTransform(f32 frame,
- core::vector3df &t, core::quaternion &r, core::vector3df &s) const
+ void updateTransform(f32 frame, core::Transform &transform) const
{
if (auto pos = position.get(frame))
- t = *pos;
+ transform.translation = *pos;
if (auto rot = rotation.get(frame))
- r = *rot;
+ transform.rotation = *rot;
if (auto scl = scale.get(frame))
- s = *scl;
+ transform.scale = *scl;
}
void cleanup() {
@@ -309,16 +298,34 @@ public:
//! Joints
struct SJoint
{
- SJoint() : GlobalSkinningSpace(false) {}
+ SJoint() {}
//! The name of this joint
std::optional Name;
- //! Local matrix of this joint
- core::matrix4 LocalMatrix;
+ //! Local transformation to be set by loaders. Mutated by animation.
+ using VariantTransform = std::variant;
+ VariantTransform transform{core::Transform{}};
+
+ VariantTransform animate(f32 frame) const {
+ if (keys.empty())
+ return transform;
+
+ if (std::holds_alternative(transform)) {
+ // .x lets animations override matrix transforms entirely,
+ // which is what we implement here.
+ // .gltf does not allow animation of nodes using matrix transforms.
+ // Note that a decomposition into a TRS transform need not exist!
+ core::Transform trs;
+ keys.updateTransform(frame, trs);
+ return {trs};
+ }
+
+ auto trs = std::get(transform);
+ keys.updateTransform(frame, trs);
+ return {trs};
+ }
- //! List of child joints
- std::vector Children;
//! List of attached meshes
std::vector AttachedMeshes;
@@ -329,42 +336,49 @@ public:
//! Skin weights
std::vector Weights;
+ //! Bounding box of all affected vertices, in local space
+ core::aabbox3df LocalBoundingBox{{0, 0, 0}};
+
//! Unnecessary for loaders, will be overwritten on finalize
core::matrix4 GlobalMatrix; // loaders may still choose to set this (temporarily) to calculate absolute vertex data.
- core::matrix4 GlobalAnimatedMatrix;
- core::matrix4 LocalAnimatedMatrix;
-
- //! These should be set by loaders.
- core::vector3df Animatedposition;
- core::vector3df Animatedscale;
- core::quaternion Animatedrotation;
// The .x and .gltf formats pre-calculate this
std::optional GlobalInversedMatrix;
- private:
- //! Internal members used by SkinnedMesh
- friend class SkinnedMesh;
- bool GlobalSkinningSpace;
+ void setParent(SJoint *parent) {
+ ParentJointID = parent ? parent->JointID : std::optional{};
+ }
+
+ u16 JointID; // TODO refactor away: pointers -> IDs (problem: .x loader abuses SJoint)
+ std::optional ParentJointID;
};
+ //! Animates joints based on frame input
+ std::vector animateMesh(f32 frame);
+
+ //! Calculates a bounding box given an animation in the form of global joint transforms.
+ core::aabbox3df calculateBoundingBox(
+ const std::vector &global_transforms);
+
+ void recalculateBaseBoundingBoxes();
+
const std::vector &getAllJoints() const {
return AllJoints;
}
protected:
- void checkForAnimation();
+ bool checkForAnimation() const;
+
+ void topoSortJoints();
+
+ void prepareForSkinning();
+
+ void calculateStaticBoundingBox();
+ void calculateJointBoundingBoxes();
+ void calculateBufferBoundingBoxes();
void normalizeWeights();
- void buildAllLocalAnimatedMatrices();
-
- void buildAllGlobalAnimatedMatrices(SJoint *Joint = 0, SJoint *ParentJoint = 0);
-
- void calculateGlobalMatrices(SJoint *Joint, SJoint *ParentJoint);
-
- void skinJoint(SJoint *Joint, SJoint *ParentJoint);
-
void calculateTangents(core::vector3df &normal,
core::vector3df &tangent, core::vector3df &binormal,
const core::vector3df &vt1, const core::vector3df &vt2, const core::vector3df &vt3,
@@ -376,25 +390,25 @@ protected:
//! Mapping from meshbuffer number to bindable texture slot
std::vector TextureSlots;
+ //! Joints, topologically sorted (parents come before their children).
std::vector AllJoints;
- std::vector RootJoints;
// bool can't be used here because std::vector
// doesn't allow taking a reference to individual elements.
std::vector> Vertices_Moved;
- core::aabbox3d BoundingBox{{0, 0, 0}};
+ //! Bounding box of just the static parts of the mesh
+ core::aabbox3df StaticPartsBox{{0, 0, 0}};
+
+ //! Bounding box of the mesh in static pose
+ core::aabbox3df StaticPoseBox{{0, 0, 0}};
f32 EndFrame;
f32 FramesPerSecond;
- f32 LastAnimatedFrame;
- bool SkinnedLastFrame;
-
bool HasAnimation;
bool PreparedForSkinning;
bool AnimateNormals;
- bool HardwareSkinning;
SourceFormat SrcFormat;
};
@@ -431,4 +445,3 @@ public:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/include/Transform.h b/irr/include/Transform.h
new file mode 100644
index 0000000000..d5feb9525c
--- /dev/null
+++ b/irr/include/Transform.h
@@ -0,0 +1,39 @@
+#pragma once
+
+#include "irrMath.h"
+#include
+#include
+#include
+
+namespace core
+{
+
+struct Transform {
+ vector3df translation;
+ quaternion rotation;
+ vector3df scale{1};
+
+ Transform interpolate(Transform to, f32 time) const
+ {
+ core::quaternion interpolated_rotation;
+ interpolated_rotation.slerp(rotation, to.rotation, time);
+ return {
+ to.translation.getInterpolated(translation, time),
+ interpolated_rotation,
+ to.scale.getInterpolated(scale, time),
+ };
+ }
+
+ matrix4 buildMatrix() const
+ {
+ matrix4 T;
+ T.setTranslation(translation);
+ matrix4 R;
+ rotation.getMatrix_transposed(R);
+ matrix4 S;
+ S.setScale(scale);
+ return T * R * S;
+ }
+};
+
+} // end namespace core
diff --git a/irr/include/aabbox3d.h b/irr/include/aabbox3d.h
index cc5aebcc50..2455cff75f 100644
--- a/irr/include/aabbox3d.h
+++ b/irr/include/aabbox3d.h
@@ -8,8 +8,6 @@
#include "plane3d.h"
#include "line3d.h"
-namespace irr
-{
namespace core
{
@@ -384,4 +382,3 @@ typedef aabbox3d aabbox3df;
typedef aabbox3d aabbox3di;
} // end namespace core
-} // end namespace irr
diff --git a/irr/include/coreutil.h b/irr/include/coreutil.h
index ca19c00caa..e92b644914 100644
--- a/irr/include/coreutil.h
+++ b/irr/include/coreutil.h
@@ -6,8 +6,6 @@
#include "path.h"
-namespace irr
-{
namespace core
{
@@ -189,4 +187,3 @@ inline bool isupper(s32 c)
}
} // end namespace core
-} // end namespace irr
diff --git a/irr/include/dimension2d.h b/irr/include/dimension2d.h
index ab6c81c30b..ed8feda860 100644
--- a/irr/include/dimension2d.h
+++ b/irr/include/dimension2d.h
@@ -5,10 +5,8 @@
#pragma once
#include "irrTypes.h"
-#include "irrMath.h" // for irr::core::equals()
+#include "irrMath.h" // for core::equals()
-namespace irr
-{
namespace core
{
template
@@ -213,4 +211,3 @@ typedef dimension2d dimension2du;
typedef dimension2d dimension2di;
} // end namespace core
-} // end namespace irr
diff --git a/irr/include/fast_atof.h b/irr/include/fast_atof.h
index 2b517d62d9..252d356df0 100644
--- a/irr/include/fast_atof.h
+++ b/irr/include/fast_atof.h
@@ -9,8 +9,6 @@
#include
#include
-namespace irr
-{
namespace core
{
@@ -342,4 +340,3 @@ inline float fast_atof(const char *floatAsString, const char **out = 0)
}
} // end namespace core
-} // end namespace irr
diff --git a/irr/include/irrArray.h b/irr/include/irrArray.h
index 2542d0542a..b4882cb8b1 100644
--- a/irr/include/irrArray.h
+++ b/irr/include/irrArray.h
@@ -11,8 +11,6 @@
#include "irrTypes.h"
#include "irrMath.h"
-namespace irr
-{
namespace core
{
@@ -24,7 +22,7 @@ class array
{
public:
static_assert(!std::is_same::value,
- "irr::core::array with T = bool not supported. Use std::vector instead.");
+ "core::array with T = bool not supported. Use std::vector instead.");
//! Default constructor for empty array.
array() :
@@ -407,4 +405,3 @@ private:
};
} // end namespace core
-} // end namespace irr
diff --git a/irr/include/irrMath.h b/irr/include/irrMath.h
index 4e74381a62..4523a01826 100644
--- a/irr/include/irrMath.h
+++ b/irr/include/irrMath.h
@@ -11,8 +11,6 @@
#include // For INT_MAX / UINT_MAX
#include
-namespace irr
-{
namespace core
{
@@ -199,8 +197,8 @@ union FloatIntUnion32
// Portable sign-extraction
bool sign() const { return (i >> 31) != 0; }
- irr::s32 i;
- irr::f32 f;
+ s32 i;
+ f32 f;
};
//! We compare the difference in ULP's (spacing between floating-point numbers, aka ULP=1 means there exists no float between).
@@ -460,7 +458,6 @@ inline f32 fract(f32 x)
}
} // end namespace core
-} // end namespace irr
-using irr::core::FR;
-using irr::core::IR;
+using core::FR;
+using core::IR;
diff --git a/irr/include/irrString.h b/irr/include/irrString.h
index 465664e87f..48c107f55f 100644
--- a/irr/include/irrString.h
+++ b/irr/include/irrString.h
@@ -18,8 +18,6 @@ extern std::wstring utf8_to_wide(std::string_view input);
extern std::string wide_to_utf8(std::wstring_view input);
/* */
-namespace irr
-{
namespace core
{
@@ -940,4 +938,3 @@ inline size_t wStringToUTF8(stringc &destination, const stringw &source)
}
} // end namespace core
-} // end namespace irr
diff --git a/irr/include/irrTypes.h b/irr/include/irrTypes.h
index 9018dd151d..af5aaec5fa 100644
--- a/irr/include/irrTypes.h
+++ b/irr/include/irrTypes.h
@@ -7,9 +7,6 @@
#include
#include
-namespace irr
-{
-
//! 8 bit unsigned variable.
typedef uint8_t u8;
@@ -46,8 +43,6 @@ typedef float f32;
/** This is a typedef for double, it ensures portability of the engine. */
typedef double f64;
-} // end namespace irr
-
//! Defines for snprintf_irr because snprintf method does not match the ISO C
//! standard on Windows platforms.
//! We want int snprintf_irr(char *str, size_t size, const char *format, ...);
@@ -57,15 +52,10 @@ typedef double f64;
#define snprintf_irr snprintf
#endif // _MSC_VER
-namespace irr
-{
-
//! Type name for character type used by the file system (legacy).
typedef char fschar_t;
#define _IRR_TEXT(X) X
-} // end namespace irr
-
// Invokes undefined behavior for unreachable code optimization
// Note: an assert(false) is included first to catch this in debug builds
#if defined(__cpp_lib_unreachable)
@@ -86,5 +76,5 @@ typedef char fschar_t;
/** some compilers can create those by directly writing the
code like 'code', but some generate warnings so we use this macro here */
#define MAKE_IRR_ID(c0, c1, c2, c3) \
- ((irr::u32)(irr::u8)(c0) | ((irr::u32)(irr::u8)(c1) << 8) | \
- ((irr::u32)(irr::u8)(c2) << 16) | ((irr::u32)(irr::u8)(c3) << 24))
+ ((u32)(u8)(c0) | ((u32)(u8)(c1) << 8) | \
+ ((u32)(u8)(c2) << 16) | ((u32)(u8)(c3) << 24))
diff --git a/irr/include/irr_ptr.h b/irr/include/irr_ptr.h
index 48717976b0..305e9f7987 100644
--- a/irr/include/irr_ptr.h
+++ b/irr/include/irr_ptr.h
@@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once
#include
#include
-namespace irr { class IReferenceCounted; }
+class IReferenceCounted;
/** Shared pointer for IrrLicht objects.
*
@@ -125,7 +125,7 @@ public:
*/
void reset(ReferenceCounted *object = nullptr) noexcept
{
- static_assert(std::is_base_of_v,
+ static_assert(std::is_base_of_v,
"Class is not an IReferenceCounted");
if (value)
value->drop();
@@ -137,7 +137,7 @@ public:
*/
void grab(ReferenceCounted *object) noexcept
{
- static_assert(std::is_base_of_v,
+ static_assert(std::is_base_of_v,
"Class is not an IReferenceCounted");
if (object)
object->grab();
diff --git a/irr/include/irrlicht.h b/irr/include/irrlicht.h
index b234027297..dd6be4bf12 100644
--- a/irr/include/irrlicht.h
+++ b/irr/include/irrlicht.h
@@ -36,8 +36,6 @@
#include "SIrrCreationParameters.h"
//! Everything in the Irrlicht Engine can be found in this namespace.
-namespace irr
-{
//! Creates an Irrlicht device. The Irrlicht device is the root object for using the engine.
/** If you need more parameters to be passed to the creation of the Irrlicht Engine device,
use the createDeviceEx() function.
@@ -70,7 +68,7 @@ extern "C" IrrlichtDevice *createDevice(
Use this function only if you wish to specify advanced parameters like a window
handle in which the device should be created.
\param parameters: Structure containing advanced parameters for the creation of the device.
-See irr::SIrrlichtCreationParameters for details.
+See SIrrlichtCreationParameters for details.
\return Returns pointer to the created IrrlichtDevice or null if the
device could not be created. */
extern "C" IrrlichtDevice *createDeviceEx(
@@ -103,7 +101,6 @@ namespace scene
namespace video
{
}
-}
/*! \file irrlicht.h
\brief Main header file of the irrlicht, needed to create a device.
diff --git a/irr/include/line2d.h b/irr/include/line2d.h
index fb58f0b7a3..437751f9a1 100644
--- a/irr/include/line2d.h
+++ b/irr/include/line2d.h
@@ -7,8 +7,6 @@
#include "irrTypes.h"
#include "vector2d.h"
-namespace irr
-{
namespace core
{
@@ -350,7 +348,7 @@ public:
// partial specialization to optimize lines (avoiding casts)
template <>
-inline vector2df line2d::getClosestPoint(const vector2df &point, bool checkOnlySegments) const
+inline vector2df line2d::getClosestPoint(const vector2df &point, bool checkOnlySegments) const
{
const vector2df c = point - start;
vector2df v = end - start;
@@ -377,4 +375,3 @@ typedef line2d line2df;
typedef line2d line2di;
} // end namespace core
-} // end namespace irr
diff --git a/irr/include/line3d.h b/irr/include/line3d.h
index ea198fba42..19338077fa 100644
--- a/irr/include/line3d.h
+++ b/irr/include/line3d.h
@@ -7,8 +7,6 @@
#include "irrTypes.h"
#include "vector3d.h"
-namespace irr
-{
namespace core
{
@@ -162,4 +160,3 @@ typedef line3d line3df;
typedef line3d line3di;
} // end namespace core
-} // end namespace irr
diff --git a/irr/include/matrix4.h b/irr/include/matrix4.h
index 7d9a11ca5f..4e862f5612 100644
--- a/irr/include/matrix4.h
+++ b/irr/include/matrix4.h
@@ -13,8 +13,6 @@
#include "rect.h"
#include
-namespace irr
-{
namespace core
{
@@ -169,8 +167,9 @@ public:
vector3d getTranslation() const;
//! Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
- //! NOTE: Rotation order is ZYX. This means that vectors are
- //! first rotated around the X, then the Y, and finally the Z axis.
+ //! NOTE: Rotation order is (extrinsic) X-Y-Z.
+ //! This means that vectors are first rotated around the X,
+ //! then the (unrotated) Y, and finally the (unrotated) Z axis.
//! NOTE: The rotation is done as per the right-hand rule.
//! See test_irr_matrix4.cpp if you're still unsure about the conventions used here.
inline CMatrix4 &setRotationRadians(const vector3d &rotation);
@@ -305,12 +304,14 @@ public:
CMatrix4 &buildProjectionMatrixOrthoRH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar, bool zClipFromZero = true);
//! Builds a left-handed look-at matrix.
+ //! NOTE: upVector must not be collinear to the postion-to-target vector
CMatrix4 &buildCameraLookAtMatrixLH(
const vector3df &position,
const vector3df &target,
const vector3df &upVector);
//! Builds a right-handed look-at matrix.
+ //! NOTE: upVector must not be collinear to the postion-to-target vector
CMatrix4 &buildCameraLookAtMatrixRH(
const vector3df &position,
const vector3df &target,
@@ -1901,4 +1902,3 @@ typedef CMatrix4 matrix4;
extern const matrix4 IdentityMatrix;
} // end namespace core
-} // end namespace irr
diff --git a/irr/include/mt_opengl.h b/irr/include/mt_opengl.h
index 9fd99c1918..bd53715304 100755
--- a/irr/include/mt_opengl.h
+++ b/irr/include/mt_opengl.h
@@ -782,7 +782,7 @@ private:
public:
// Call this once after creating the context.
- void LoadAllProcedures(irr::video::IContextManager *cmgr);
+ void LoadAllProcedures(video::IContextManager *cmgr);
/// Check if an extension is supported.
/// @param ext full extension name e.g. "GL_KHR_no_error"
inline bool IsExtensionPresent(const std::string &ext) const
diff --git a/irr/include/path.h b/irr/include/path.h
index 06476ef7b2..70f4f24cc8 100644
--- a/irr/include/path.h
+++ b/irr/include/path.h
@@ -6,8 +6,6 @@
#include "irrString.h"
-namespace irr
-{
namespace io
{
@@ -83,4 +81,3 @@ private:
};
} // io
-} // irr
diff --git a/irr/include/plane3d.h b/irr/include/plane3d.h
index 4003325b55..fc7018fc4e 100644
--- a/irr/include/plane3d.h
+++ b/irr/include/plane3d.h
@@ -7,8 +7,6 @@
#include "irrMath.h"
#include "vector3d.h"
-namespace irr
-{
namespace core
{
@@ -241,4 +239,3 @@ typedef plane3d plane3df;
typedef plane3d plane3di;
} // end namespace core
-} // end namespace irr
diff --git a/irr/include/position2d.h b/irr/include/position2d.h
index ff0d30f4f8..89a51998df 100644
--- a/irr/include/position2d.h
+++ b/irr/include/position2d.h
@@ -9,8 +9,6 @@
#include "vector2d.h"
-namespace irr
-{
namespace core
{
@@ -22,7 +20,6 @@ typedef vector2d position2df;
//! \deprecated position2d is now a synonym for vector2d, but vector2d should be used directly.
typedef vector2d position2di;
} // namespace core
-} // namespace irr
// ...and use a #define to catch the rest, for (e.g.) position2d
#define position2d vector2d
diff --git a/irr/include/quaternion.h b/irr/include/quaternion.h
index e23b1317d0..0328d8ff3e 100644
--- a/irr/include/quaternion.h
+++ b/irr/include/quaternion.h
@@ -19,8 +19,6 @@
// - For uses of getMatrix() you have to use quaternion::getMatrix_transposed instead.
// #define IRR_TEST_BROKEN_QUATERNION_USE
-namespace irr
-{
namespace core
{
@@ -180,7 +178,7 @@ public:
linear interpolation.
*/
quaternion &slerp(quaternion q1, quaternion q2,
- f32 time, f32 threshold = .05f);
+ f32 time, f32 threshold = .001f);
//! Set this quaternion to represent a rotation from angle and axis.
/** Axis must be unit length.
@@ -704,4 +702,3 @@ inline core::quaternion &quaternion::rotationFromTo(const vector3df &from, const
}
} // end namespace core
-} // end namespace irr
diff --git a/irr/include/rect.h b/irr/include/rect.h
index bced2d59e1..15bc5ae66e 100644
--- a/irr/include/rect.h
+++ b/irr/include/rect.h
@@ -8,8 +8,6 @@
#include "dimension2d.h"
#include "position2d.h"
-namespace irr
-{
namespace core
{
@@ -278,4 +276,3 @@ typedef rect rectf;
typedef rect recti;
} // end namespace core
-} // end namespace irr
diff --git a/irr/include/vector2d.h b/irr/include/vector2d.h
index 821885719a..ef1e12302e 100644
--- a/irr/include/vector2d.h
+++ b/irr/include/vector2d.h
@@ -11,8 +11,6 @@
#include
#include
-namespace irr
-{
namespace core
{
@@ -301,13 +299,13 @@ public:
if (Y > 0)
if (X > 0)
- return atan((irr::f64)Y / (irr::f64)X) * RADTODEG64;
+ return atan((f64)Y / (f64)X) * RADTODEG64;
else
- return 180.0 - atan((irr::f64)Y / -(irr::f64)X) * RADTODEG64;
+ return 180.0 - atan((f64)Y / -(f64)X) * RADTODEG64;
else if (X > 0)
- return 360.0 - atan(-(irr::f64)Y / (irr::f64)X) * RADTODEG64;
+ return 360.0 - atan(-(f64)Y / (f64)X) * RADTODEG64;
else
- return 180.0 + atan(-(irr::f64)Y / -(irr::f64)X) * RADTODEG64;
+ return 180.0 + atan(-(f64)Y / -(f64)X) * RADTODEG64;
}
//! Calculates the angle of this vector in degrees in the counter trigonometric sense.
@@ -499,15 +497,14 @@ bool dimension2d::operator==(const vector2d &other) const
}
} // end namespace core
-} // end namespace irr
namespace std
{
template
-struct hash>
+struct hash>
{
- size_t operator()(const irr::core::vector2d &vec) const
+ size_t operator()(const core::vector2d &vec) const
{
size_t h1 = hash()(vec.X);
size_t h2 = hash()(vec.Y);
diff --git a/irr/include/vector3d.h b/irr/include/vector3d.h
index c9c96fabf1..e8bec3876c 100644
--- a/irr/include/vector3d.h
+++ b/irr/include/vector3d.h
@@ -10,8 +10,6 @@
#include
#include
-namespace irr
-{
namespace core
{
@@ -528,15 +526,14 @@ vector3d operator*(const S scalar, const vector3d &vector)
}
} // end namespace core
-} // end namespace irr
namespace std
{
template
-struct hash>
+struct hash>
{
- size_t operator()(const irr::core::vector3d &vec) const
+ size_t operator()(const core::vector3d &vec) const
{
size_t h1 = hash()(vec.X);
size_t h2 = hash()(vec.Y);
diff --git a/irr/scripts/BindingGenerator.lua b/irr/scripts/BindingGenerator.lua
index 83c625b06e..0f85e90da8 100755
--- a/irr/scripts/BindingGenerator.lua
+++ b/irr/scripts/BindingGenerator.lua
@@ -391,7 +391,7 @@ f:write [[
public:
// Call this once after creating the context.
- void LoadAllProcedures(irr::video::IContextManager *cmgr);
+ void LoadAllProcedures(video::IContextManager *cmgr);
/// Check if an extension is supported.
/// @param ext full extension name e.g. "GL_KHR_no_error"
inline bool IsExtensionPresent(const std::string &ext) const
@@ -429,7 +429,7 @@ f:write[[
OpenGLProcedures GL;
-void OpenGLProcedures::LoadAllProcedures(irr::video::IContextManager *cmgr)
+void OpenGLProcedures::LoadAllProcedures(video::IContextManager *cmgr)
{
]];
diff --git a/irr/src/BuiltInFont.h b/irr/src/BuiltInFont.h
index 1df5b7da40..096642bebe 100644
--- a/irr/src/BuiltInFont.h
+++ b/irr/src/BuiltInFont.h
@@ -7,8 +7,6 @@
// header file generated by xxd
// for the source bitmap, see builtInFont.png
-namespace irr
-{
namespace gui
{
const u8 BuiltInFontData[] = {
@@ -132,4 +130,3 @@ const u8 BuiltInFontData[] = {
const u32 BuiltInFontDataSize = sizeof(BuiltInFontData);
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CAnimatedMeshSceneNode.cpp b/irr/src/CAnimatedMeshSceneNode.cpp
index 09d83038b7..7808f1fee7 100644
--- a/irr/src/CAnimatedMeshSceneNode.cpp
+++ b/irr/src/CAnimatedMeshSceneNode.cpp
@@ -3,9 +3,13 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CAnimatedMeshSceneNode.h"
+#include "CBoneSceneNode.h"
#include "IVideoDriver.h"
#include "ISceneManager.h"
#include "S3DVertex.h"
+#include "Transform.h"
+#include "irrTypes.h"
+#include "matrix4.h"
#include "os.h"
#include "SkinnedMesh.h"
#include "IDummyTransformationSceneNode.h"
@@ -17,9 +21,10 @@
#include "IFileSystem.h"
#include "quaternion.h"
#include
+#include
+#include
+#include
-namespace irr
-{
namespace scene
{
@@ -30,13 +35,13 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh *mesh,
const core::vector3df &rotation,
const core::vector3df &scale) :
IAnimatedMeshSceneNode(parent, mgr, id, position, rotation, scale),
- Mesh(0),
+ Mesh(nullptr),
StartFrame(0), EndFrame(0), FramesPerSecond(0.025f),
CurrentFrameNr(0.f), LastTimeMs(0),
TransitionTime(0), Transiting(0.f), TransitingBlend(0.f),
- JointMode(EJUOR_NONE), JointsUsed(false),
+ JointsUsed(false),
Looping(true), ReadOnlyMaterials(false), RenderFromIdentity(false),
- LoopCallBack(0), PassCount(0)
+ PassCount(0)
{
setMesh(mesh);
}
@@ -44,8 +49,6 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh *mesh,
//! destructor
CAnimatedMeshSceneNode::~CAnimatedMeshSceneNode()
{
- if (LoopCallBack)
- LoopCallBack->drop();
if (Mesh)
Mesh->drop();
}
@@ -87,8 +90,7 @@ void CAnimatedMeshSceneNode::buildFrameNr(u32 timeMs)
if (FramesPerSecond > 0.f) { // forwards...
if (CurrentFrameNr > EndFrame)
CurrentFrameNr = StartFrame + fmodf(CurrentFrameNr - StartFrame, EndFrame - StartFrame);
- } else // backwards...
- {
+ } else { // backwards...
if (CurrentFrameNr < StartFrame)
CurrentFrameNr = EndFrame - fmodf(EndFrame - CurrentFrameNr, EndFrame - StartFrame);
}
@@ -97,18 +99,9 @@ void CAnimatedMeshSceneNode::buildFrameNr(u32 timeMs)
CurrentFrameNr += timeMs * FramesPerSecond;
if (FramesPerSecond > 0.f) { // forwards...
- if (CurrentFrameNr > EndFrame) {
- CurrentFrameNr = EndFrame;
- if (LoopCallBack)
- LoopCallBack->OnAnimationEnd(this);
- }
- } else // backwards...
- {
- if (CurrentFrameNr < StartFrame) {
- CurrentFrameNr = StartFrame;
- if (LoopCallBack)
- LoopCallBack->OnAnimationEnd(this);
- }
+ CurrentFrameNr = std::min(CurrentFrameNr, EndFrame);
+ } else { // backwards...
+ CurrentFrameNr = std::max(CurrentFrameNr, StartFrame);
}
}
}
@@ -156,38 +149,18 @@ void CAnimatedMeshSceneNode::OnRegisterSceneNode()
IMesh *CAnimatedMeshSceneNode::getMeshForCurrentFrame()
{
if (Mesh->getMeshType() != EAMT_SKINNED) {
- return Mesh->getMesh(getFrameNr());
- } else {
- // As multiple scene nodes may be sharing the same skinned mesh, we have to
- // re-animate it every frame to ensure that this node gets the mesh that it needs.
-
- SkinnedMesh *skinnedMesh = static_cast(Mesh);
-
- if (JointMode == EJUOR_CONTROL) // write to mesh
- skinnedMesh->transferJointsToMesh(JointChildSceneNodes);
- else
- skinnedMesh->animateMesh(getFrameNr());
-
- // Update the skinned mesh for the current joint transforms.
- skinnedMesh->skinMesh();
-
- if (JointMode == EJUOR_READ) { // read from mesh
- skinnedMesh->recoverJointsFromMesh(JointChildSceneNodes);
-
- //---slow---
- for (u32 n = 0; n < JointChildSceneNodes.size(); ++n)
- if (JointChildSceneNodes[n]->getParent() == this) {
- JointChildSceneNodes[n]->updateAbsolutePositionOfAllChildren(); // temp, should be an option
- }
- }
-
- if (JointMode == EJUOR_CONTROL) {
- // For meshes other than EJUOR_CONTROL, this is done by calling animateMesh()
- skinnedMesh->updateBoundingBox();
- }
-
- return skinnedMesh;
+ return Mesh;
}
+
+ // As multiple scene nodes may be sharing the same skinned mesh, we have to
+ // re-animate it every frame to ensure that this node gets the mesh that it needs.
+
+ auto *skinnedMesh = static_cast(Mesh);
+
+ // Matrices have already been calculated in OnAnimate
+ skinnedMesh->skinMesh(PerJoint.GlobalMatrices);
+
+ return skinnedMesh;
}
//! OnAnimate() is called just before rendering the whole scene.
@@ -201,7 +174,28 @@ void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
buildFrameNr(timeMs - LastTimeMs);
LastTimeMs = timeMs;
+ // This needs to be done on animate, which is called recursively *before*
+ // anything is rendered so that the transformations of children are up to date
+ animateJoints();
+
+ // Copy old transforms *before* bone overrides have been applied.
+ // TODO if there are no bone overrides or no animation blending, this is unnecessary.
+ copyOldTransforms();
+
+ if (OnAnimateCallback)
+ OnAnimateCallback(timeMs / 1000.0f);
+
IAnimatedMeshSceneNode::OnAnimate(timeMs);
+
+ if (auto *skinnedMesh = dynamic_cast(Mesh)) {
+ for (u16 i = 0; i < PerJoint.SceneNodes.size(); ++i)
+ PerJoint.GlobalMatrices[i] = PerJoint.SceneNodes[i]->getRelativeTransformation();
+ assert(PerJoint.GlobalMatrices.size() == skinnedMesh->getJointCount());
+ skinnedMesh->calculateGlobalMatrices(PerJoint.GlobalMatrices);
+ Box = skinnedMesh->calculateBoundingBox(PerJoint.GlobalMatrices);
+ } else {
+ Box = Mesh->getBoundingBox();
+ }
}
//! renders the node.
@@ -218,15 +212,7 @@ void CAnimatedMeshSceneNode::render()
++PassCount;
scene::IMesh *m = getMeshForCurrentFrame();
-
- if (m) {
- Box = m->getBoundingBox();
- } else {
-#ifdef _DEBUG
- os::Printer::log("Animated Mesh returned no mesh to render.", ELL_WARNING);
-#endif
- return;
- }
+ assert(m);
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
@@ -294,11 +280,12 @@ void CAnimatedMeshSceneNode::render()
if (DebugDataVisible & scene::EDS_SKELETON) {
if (Mesh->getMeshType() == EAMT_SKINNED) {
// draw skeleton
-
- for (auto *joint : ((SkinnedMesh *)Mesh)->getAllJoints()) {
- for (const auto *childJoint : joint->Children) {
- driver->draw3DLine(joint->GlobalAnimatedMatrix.getTranslation(),
- childJoint->GlobalAnimatedMatrix.getTranslation(),
+ const auto &joints = (static_cast(Mesh))->getAllJoints();
+ for (u16 i = 0; i < PerJoint.GlobalMatrices.size(); ++i) {
+ const auto translation = PerJoint.GlobalMatrices[i].getTranslation();
+ if (auto pjid = joints[i]->ParentJointID) {
+ const auto parent_translation = PerJoint.GlobalMatrices[*pjid].getTranslation();
+ driver->draw3DLine(parent_translation, translation,
video::SColor(255, 51, 66, 255));
}
}
@@ -407,12 +394,12 @@ IBoneSceneNode *CAnimatedMeshSceneNode::getJointNode(const c8 *jointName)
return 0;
}
- if (JointChildSceneNodes.size() <= *number) {
+ if (PerJoint.SceneNodes.size() <= *number) {
os::Printer::log("Joint was found in mesh, but is not loaded into node", jointName, ELL_WARNING);
return 0;
}
- return JointChildSceneNodes[*number];
+ return PerJoint.SceneNodes[*number];
}
//! Returns a pointer to a child node, which has the same transformation as
@@ -426,12 +413,12 @@ IBoneSceneNode *CAnimatedMeshSceneNode::getJointNode(u32 jointID)
checkJoints();
- if (JointChildSceneNodes.size() <= jointID) {
+ if (PerJoint.SceneNodes.size() <= jointID) {
os::Printer::log("Joint not loaded into node", ELL_WARNING);
return 0;
}
- return JointChildSceneNodes[jointID];
+ return PerJoint.SceneNodes[jointID];
}
//! Gets joint count.
@@ -452,9 +439,9 @@ bool CAnimatedMeshSceneNode::removeChild(ISceneNode *child)
{
if (ISceneNode::removeChild(child)) {
if (JointsUsed) { // stop weird bugs caused while changing parents as the joints are being created
- for (u32 i = 0; i < JointChildSceneNodes.size(); ++i) {
- if (JointChildSceneNodes[i] == child) {
- JointChildSceneNodes[i] = 0; // remove link to child
+ for (u32 i = 0; i < PerJoint.SceneNodes.size(); ++i) {
+ if (PerJoint.SceneNodes[i] == child) {
+ PerJoint.SceneNodes[i] = 0; // remove link to child
break;
}
}
@@ -478,22 +465,6 @@ bool CAnimatedMeshSceneNode::getLoopMode() const
return Looping;
}
-//! Sets a callback interface which will be called if an animation
-//! playback has ended. Set this to 0 to disable the callback again.
-void CAnimatedMeshSceneNode::setAnimationEndCallback(IAnimationEndCallBack *callback)
-{
- if (callback == LoopCallBack)
- return;
-
- if (LoopCallBack)
- LoopCallBack->drop();
-
- LoopCallBack = callback;
-
- if (LoopCallBack)
- LoopCallBack->grab();
-}
-
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
void CAnimatedMeshSceneNode::setReadOnlyMaterials(bool readonly)
{
@@ -525,18 +496,15 @@ void CAnimatedMeshSceneNode::setMesh(IAnimatedMesh *mesh)
// get materials and bounding box
Box = Mesh->getBoundingBox();
- IMesh *m = Mesh->getMesh(0);
- if (m) {
- Materials.clear();
- Materials.reallocate(m->getMeshBufferCount());
+ Materials.clear();
+ Materials.reallocate(Mesh->getMeshBufferCount());
- for (u32 i = 0; i < m->getMeshBufferCount(); ++i) {
- IMeshBuffer *mb = m->getMeshBuffer(i);
- if (mb)
- Materials.push_back(mb->getMaterial());
- else
- Materials.push_back(video::SMaterial());
- }
+ for (u32 i = 0; i < Mesh->getMeshBufferCount(); ++i) {
+ IMeshBuffer *mb = Mesh->getMeshBuffer(i);
+ if (mb)
+ Materials.push_back(mb->getMaterial());
+ else
+ Materials.push_back(video::SMaterial());
}
// clean up joint nodes
@@ -556,14 +524,7 @@ void CAnimatedMeshSceneNode::updateAbsolutePosition()
IAnimatedMeshSceneNode::updateAbsolutePosition();
}
-//! Set the joint update mode (0-unused, 1-get joints only, 2-set joints only, 3-move and set)
-void CAnimatedMeshSceneNode::setJointMode(E_JOINT_UPDATE_ON_RENDER mode)
-{
- checkJoints();
- JointMode = mode;
-}
-
-//! Sets the transition time in seconds (note: This needs to enable joints, and setJointmode maybe set to 2)
+//! Sets the transition time in seconds (note: This needs to enable joints)
//! you must call animateJoints(), or the mesh will not animate
void CAnimatedMeshSceneNode::setTransitionTime(f32 time)
{
@@ -571,10 +532,6 @@ void CAnimatedMeshSceneNode::setTransitionTime(f32 time)
if (TransitionTime == ttime)
return;
TransitionTime = ttime;
- if (ttime != 0)
- setJointMode(EJUOR_CONTROL);
- else
- setJointMode(EJUOR_NONE);
}
//! render mesh ignoring its transformation. Used with ragdolls. (culling is unaffected)
@@ -583,120 +540,104 @@ void CAnimatedMeshSceneNode::setRenderFromIdentity(bool enable)
RenderFromIdentity = enable;
}
-//! updates the joint positions of this mesh
-void CAnimatedMeshSceneNode::animateJoints(bool CalculateAbsolutePositions)
+void CAnimatedMeshSceneNode::addJoints()
{
- if (Mesh && Mesh->getMeshType() == EAMT_SKINNED) {
- checkJoints();
- const f32 frame = getFrameNr(); // old?
+ const auto &joints = static_cast(Mesh)->getAllJoints();
+ PerJoint.setN(joints.size());
+ PerJoint.SceneNodes.clear();
+ PerJoint.SceneNodes.reserve(joints.size());
+ for (size_t i = 0; i < joints.size(); ++i) {
+ const auto *joint = joints[i];
+ ISceneNode *parent = this;
+ if (joint->ParentJointID)
+ parent = PerJoint.SceneNodes.at(*joint->ParentJointID); // exists because of topo. order
+ assert(parent);
+ const auto *matrix = std::get_if(&joint->transform);
+ PerJoint.SceneNodes.push_back(new CBoneSceneNode(
+ parent, SceneManager, 0, i, joint->Name,
+ matrix ? core::Transform{} : std::get(joint->transform),
+ matrix ? *matrix : std::optional{}));
+ }
+}
- SkinnedMesh *skinnedMesh = static_cast(Mesh);
-
- skinnedMesh->animateMesh(frame);
- skinnedMesh->recoverJointsFromMesh(JointChildSceneNodes);
-
- //-----------------------------------------
- // Transition
- //-----------------------------------------
-
- if (Transiting != 0.f) {
- // Init additional matrices
- if (PretransitingSave.size() < JointChildSceneNodes.size()) {
- for (u32 n = PretransitingSave.size(); n < JointChildSceneNodes.size(); ++n)
- PretransitingSave.push_back(core::matrix4());
- }
-
- for (u32 n = 0; n < JointChildSceneNodes.size(); ++n) {
- //------Position------
-
- JointChildSceneNodes[n]->setPosition(
- core::lerp(
- PretransitingSave[n].getTranslation(),
- JointChildSceneNodes[n]->getPosition(),
- TransitingBlend));
-
- //------Rotation------
-
- // Code is slow, needs to be fixed up
-
- const core::quaternion RotationStart(PretransitingSave[n].getRotationRadians());
- const core::quaternion RotationEnd(JointChildSceneNodes[n]->getRotation() * core::DEGTORAD);
-
- core::quaternion QRotation;
- QRotation.slerp(RotationStart, RotationEnd, TransitingBlend);
-
- core::vector3df tmpVector;
- QRotation.toEuler(tmpVector);
- tmpVector *= core::RADTODEG; // convert from radians back to degrees
- JointChildSceneNodes[n]->setRotation(tmpVector);
-
- //------Scale------
-
- // JointChildSceneNodes[n]->setScale(
- // core::lerp(
- // PretransitingSave[n].getScale(),
- // JointChildSceneNodes[n]->getScale(),
- // TransitingBlend));
- }
+void CAnimatedMeshSceneNode::updateJointSceneNodes(
+ const std::vector &transforms)
+{
+ for (size_t i = 0; i < transforms.size(); ++i) {
+ const auto &transform = transforms[i];
+ auto *node = static_cast(PerJoint.SceneNodes[i]);
+ if (const auto *trs = std::get_if(&transform)) {
+ node->setTransform(*trs);
+ // .x lets animations override matrix transforms entirely.
+ node->Matrix = std::nullopt;
+ } else {
+ node->Matrix = std::get(transform);
}
+ }
+}
- if (CalculateAbsolutePositions) {
- //---slow---
- for (u32 n = 0; n < JointChildSceneNodes.size(); ++n) {
- if (JointChildSceneNodes[n]->getParent() == this) {
- JointChildSceneNodes[n]->updateAbsolutePositionOfAllChildren(); // temp, should be an option
- }
+//! updates the joint positions of this mesh
+void CAnimatedMeshSceneNode::animateJoints()
+{
+ if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
+ return;
+
+ checkJoints();
+
+ SkinnedMesh *skinnedMesh = static_cast(Mesh);
+ if (!skinnedMesh->isStatic())
+ updateJointSceneNodes(skinnedMesh->animateMesh(getFrameNr()));
+
+ //-----------------------------------------
+ // Transition
+ //-----------------------------------------
+
+ if (Transiting != 0.f) {
+ for (u32 i = 0; i < PerJoint.SceneNodes.size(); ++i) {
+ if (PerJoint.PreTransSaves[i]) {
+ PerJoint.SceneNodes[i]->setTransform(PerJoint.PreTransSaves[i]->interpolate(
+ PerJoint.SceneNodes[i]->getTransform(), TransitingBlend));
}
}
}
}
-/*!
- */
void CAnimatedMeshSceneNode::checkJoints()
{
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
return;
if (!JointsUsed) {
- for (u32 i = 0; i < JointChildSceneNodes.size(); ++i)
- removeChild(JointChildSceneNodes[i]);
- JointChildSceneNodes.clear();
-
- // Create joints for SkinnedMesh
- ((SkinnedMesh *)Mesh)->addJoints(JointChildSceneNodes, this, SceneManager);
- ((SkinnedMesh *)Mesh)->recoverJointsFromMesh(JointChildSceneNodes);
+ for (u32 i = 0; i < PerJoint.SceneNodes.size(); ++i)
+ removeChild(PerJoint.SceneNodes[i]);
+ addJoints();
JointsUsed = true;
- JointMode = EJUOR_READ;
}
}
-/*!
- */
+void CAnimatedMeshSceneNode::copyOldTransforms()
+{
+ for (u32 i = 0; i < PerJoint.SceneNodes.size(); ++i) {
+ if (!PerJoint.SceneNodes[i]->Matrix) {
+ PerJoint.PreTransSaves[i] = PerJoint.SceneNodes[i]->getTransform();
+ } else {
+ PerJoint.PreTransSaves[i] = std::nullopt;
+ }
+ }
+}
+
void CAnimatedMeshSceneNode::beginTransition()
{
if (!JointsUsed)
return;
if (TransitionTime != 0) {
- // Check the array is big enough
- if (PretransitingSave.size() < JointChildSceneNodes.size()) {
- for (u32 n = PretransitingSave.size(); n < JointChildSceneNodes.size(); ++n)
- PretransitingSave.push_back(core::matrix4());
- }
-
- // Copy the position of joints
- for (u32 n = 0; n < JointChildSceneNodes.size(); ++n)
- PretransitingSave[n] = JointChildSceneNodes[n]->getRelativeTransformation();
-
Transiting = core::reciprocal((f32)TransitionTime);
}
TransitingBlend = 0.f;
}
-/*!
- */
ISceneNode *CAnimatedMeshSceneNode::clone(ISceneNode *newParent, ISceneManager *newManager)
{
if (!newParent)
@@ -722,23 +663,18 @@ ISceneNode *CAnimatedMeshSceneNode::clone(ISceneNode *newParent, ISceneManager *
newNode->EndFrame = EndFrame;
newNode->FramesPerSecond = FramesPerSecond;
newNode->CurrentFrameNr = CurrentFrameNr;
- newNode->JointMode = JointMode;
newNode->JointsUsed = JointsUsed;
newNode->TransitionTime = TransitionTime;
newNode->Transiting = Transiting;
newNode->TransitingBlend = TransitingBlend;
newNode->Looping = Looping;
newNode->ReadOnlyMaterials = ReadOnlyMaterials;
- newNode->LoopCallBack = LoopCallBack;
- if (newNode->LoopCallBack)
- newNode->LoopCallBack->grab();
newNode->PassCount = PassCount;
- newNode->JointChildSceneNodes = JointChildSceneNodes;
- newNode->PretransitingSave = PretransitingSave;
+ newNode->PerJoint.SceneNodes = PerJoint.SceneNodes;
+ newNode->PerJoint.PreTransSaves = PerJoint.PreTransSaves;
newNode->RenderFromIdentity = RenderFromIdentity;
return newNode;
}
} // end namespace scene
-} // end namespace irr
diff --git a/irr/src/CAnimatedMeshSceneNode.h b/irr/src/CAnimatedMeshSceneNode.h
index 5149f7618f..f7fa319602 100644
--- a/irr/src/CAnimatedMeshSceneNode.h
+++ b/irr/src/CAnimatedMeshSceneNode.h
@@ -4,16 +4,16 @@
#pragma once
+#include "CBoneSceneNode.h"
#include "IAnimatedMeshSceneNode.h"
#include "IAnimatedMesh.h"
+#include "SkinnedMesh.h"
+#include "Transform.h"
#include "matrix4.h"
-namespace irr
-{
namespace scene
{
-class IDummyTransformationSceneNode;
class CAnimatedMeshSceneNode : public IAnimatedMeshSceneNode
{
@@ -54,9 +54,11 @@ public:
//! returns the current loop mode
bool getLoopMode() const override;
- //! Sets a callback interface which will be called if an animation
- //! playback has ended. Set this to 0 to disable the callback again.
- void setAnimationEndCallback(IAnimationEndCallBack *callback = 0) override;
+ void setOnAnimateCallback(
+ const std::function &cb) override
+ {
+ OnAnimateCallback = cb;
+ }
//! sets the speed with which the animation is played
//! NOTE: setMesh will also change this value and set it to the default speed of the mesh
@@ -117,15 +119,16 @@ public:
//! updates the absolute position based on the relative and the parents position
void updateAbsolutePosition() override;
- //! Set the joint update mode (0-unused, 1-get joints only, 2-set joints only, 3-move and set)
- void setJointMode(E_JOINT_UPDATE_ON_RENDER mode) override;
-
- //! Sets the transition time in seconds (note: This needs to enable joints, and setJointmode maybe set to 2)
+ //! Sets the transition time in seconds (note: This needs to enable joints)
//! you must call animateJoints(), or the mesh will not animate
void setTransitionTime(f32 Time) override;
+ void updateJointSceneNodes(const std::vector &transforms);
+
//! updates the joint positions of this mesh
- void animateJoints(bool CalculateAbsolutePositions = true) override;
+ void animateJoints() override;
+
+ void addJoints();
//! render mesh ignoring its transformation. Used with ragdolls. (culling is unaffected)
void setRenderFromIdentity(bool On) override;
@@ -142,6 +145,7 @@ private:
void buildFrameNr(u32 timeMs);
void checkJoints();
+ void copyOldTransforms();
void beginTransition();
core::array Materials;
@@ -158,20 +162,30 @@ private:
f32 Transiting; // is mesh transiting (plus cache of TransitionTime)
f32 TransitingBlend; // 0-1, calculated on buildFrameNr
- // 0-unused, 1-get joints only, 2-set joints only, 3-move and set
- E_JOINT_UPDATE_ON_RENDER JointMode;
bool JointsUsed;
bool Looping;
bool ReadOnlyMaterials;
bool RenderFromIdentity;
- IAnimationEndCallBack *LoopCallBack;
s32 PassCount;
+ std::function OnAnimateCallback;
- std::vector JointChildSceneNodes;
- core::array PretransitingSave;
+ struct PerJointData {
+ std::vector SceneNodes;
+ std::vector GlobalMatrices;
+ std::vector> PreTransSaves;
+ void setN(u16 n) {
+ SceneNodes.clear();
+ SceneNodes.resize(n);
+ GlobalMatrices.clear();
+ GlobalMatrices.resize(n);
+ PreTransSaves.clear();
+ PreTransSaves.resize(n);
+ }
+ };
+
+ PerJointData PerJoint;
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/src/CB3DMeshFileLoader.cpp b/irr/src/CB3DMeshFileLoader.cpp
index 51342f4517..d55ba753d3 100644
--- a/irr/src/CB3DMeshFileLoader.cpp
+++ b/irr/src/CB3DMeshFileLoader.cpp
@@ -20,8 +20,6 @@
#define _B3D_READER_DEBUG
#endif
-namespace irr
-{
namespace scene
{
@@ -143,31 +141,25 @@ bool CB3DMeshFileLoader::readChunkNODE(SkinnedMesh::SJoint *inJoint)
os::Printer::log(logStr.c_str(), joint->Name.value_or("").c_str(), ELL_DEBUG);
#endif
- f32 position[3], scale[3], rotation[4];
+ core::Transform transform;
+ {
+ f32 t[3], s[3], r[4];
- readFloats(position, 3);
- readFloats(scale, 3);
- readFloats(rotation, 4);
+ readFloats(t, 3);
+ readFloats(s, 3);
+ readFloats(r, 4);
- joint->Animatedposition = core::vector3df(position[0], position[1], position[2]);
- joint->Animatedscale = core::vector3df(scale[0], scale[1], scale[2]);
- joint->Animatedrotation = core::quaternion(rotation[1], rotation[2], rotation[3], rotation[0]);
-
- // Build LocalMatrix:
-
- core::matrix4 positionMatrix;
- positionMatrix.setTranslation(joint->Animatedposition);
- core::matrix4 scaleMatrix;
- scaleMatrix.setScale(joint->Animatedscale);
- core::matrix4 rotationMatrix;
- joint->Animatedrotation.getMatrix_transposed(rotationMatrix);
-
- joint->LocalMatrix = positionMatrix * rotationMatrix * scaleMatrix;
+ joint->transform = transform = {
+ {t[0], t[1], t[2]},
+ {r[1], r[2], r[3], r[0]},
+ {s[0], s[1], s[2]},
+ };
+ }
if (inJoint)
- joint->GlobalMatrix = inJoint->GlobalMatrix * joint->LocalMatrix;
+ joint->GlobalMatrix = inJoint->GlobalMatrix * transform.buildMatrix();
else
- joint->GlobalMatrix = joint->LocalMatrix;
+ joint->GlobalMatrix = transform.buildMatrix();
while (B3dStack.getLast().startposition + B3dStack.getLast().length > B3DFile->getPos()) // this chunk repeats
{
@@ -856,4 +848,3 @@ void CB3DMeshFileLoader::readFloats(f32 *vec, u32 count)
}
} // end namespace scene
-} // end namespace irr
diff --git a/irr/src/CB3DMeshFileLoader.h b/irr/src/CB3DMeshFileLoader.h
index 55978d743d..59dc61c968 100644
--- a/irr/src/CB3DMeshFileLoader.h
+++ b/irr/src/CB3DMeshFileLoader.h
@@ -14,9 +14,6 @@
#include "SB3DStructs.h"
#include "IReadFile.h"
-namespace irr
-{
-
namespace scene
{
@@ -76,4 +73,3 @@ private:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/src/CBillboardSceneNode.cpp b/irr/src/CBillboardSceneNode.cpp
index 6769e8f04d..c45b65eb82 100644
--- a/irr/src/CBillboardSceneNode.cpp
+++ b/irr/src/CBillboardSceneNode.cpp
@@ -8,8 +8,6 @@
#include "ICameraSceneNode.h"
#include "os.h"
-namespace irr
-{
namespace scene
{
@@ -86,7 +84,7 @@ void CBillboardSceneNode::render()
}
}
-void CBillboardSceneNode::updateMesh(const irr::scene::ICameraSceneNode *camera)
+void CBillboardSceneNode::updateMesh(const scene::ICameraSceneNode *camera)
{
// billboard looks toward camera
core::vector3df pos = getAbsolutePosition();
@@ -139,7 +137,7 @@ const core::aabbox3d &CBillboardSceneNode::getBoundingBox() const
return BBoxSafe;
}
-const core::aabbox3d &CBillboardSceneNode::getTransformedBillboardBoundingBox(const irr::scene::ICameraSceneNode *camera)
+const core::aabbox3d &CBillboardSceneNode::getTransformedBillboardBoundingBox(const scene::ICameraSceneNode *camera)
{
updateMesh(camera);
return Buffer->BoundingBox;
@@ -264,4 +262,3 @@ ISceneNode *CBillboardSceneNode::clone(ISceneNode *newParent, ISceneManager *new
}
} // end namespace scene
-} // end namespace irr
diff --git a/irr/src/CBillboardSceneNode.h b/irr/src/CBillboardSceneNode.h
index 2b11cc8f4d..f9d625fa2a 100644
--- a/irr/src/CBillboardSceneNode.h
+++ b/irr/src/CBillboardSceneNode.h
@@ -5,10 +5,8 @@
#pragma once
#include "IBillboardSceneNode.h"
-#include "SMeshBuffer.h"
+#include "CMeshBuffer.h"
-namespace irr
-{
namespace scene
{
@@ -68,7 +66,7 @@ public:
video::SColor &bottomColor) const override;
//! Get the real boundingbox used by the billboard (which depends on the active camera)
- const core::aabbox3d &getTransformedBillboardBoundingBox(const irr::scene::ICameraSceneNode *camera) override;
+ const core::aabbox3d &getTransformedBillboardBoundingBox(const scene::ICameraSceneNode *camera) override;
//! Get the amount of mesh buffers.
u32 getMeshBufferCount() const override
@@ -91,7 +89,7 @@ public:
ISceneNode *clone(ISceneNode *newParent = 0, ISceneManager *newManager = 0) override;
protected:
- void updateMesh(const irr::scene::ICameraSceneNode *camera);
+ void updateMesh(const scene::ICameraSceneNode *camera);
private:
//! Size.Width is the bottom edge width
@@ -110,4 +108,3 @@ private:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/src/CBlit.h b/irr/src/CBlit.h
index 90450ec2f4..b792a638b6 100644
--- a/irr/src/CBlit.h
+++ b/irr/src/CBlit.h
@@ -6,9 +6,6 @@
#include "SoftwareDriver2_helper.h"
-namespace irr
-{
-
//! f18 - fixpoint 14.18 limit to 16k Textures
#define CBLIT_USE_FIXPOINT18
@@ -55,43 +52,6 @@ struct SBlitJob
f32 y_stretch;
};
-// Bitfields Cohen Sutherland
-enum eClipCode
-{
- CLIPCODE_EMPTY = 0,
- CLIPCODE_BOTTOM = 1,
- CLIPCODE_TOP = 2,
- CLIPCODE_LEFT = 4,
- CLIPCODE_RIGHT = 8
-};
-
-inline u32 GetClipCode(const AbsRectangle &r, const core::position2d &p)
-{
- u32 code = CLIPCODE_EMPTY;
-
- if (p.X < r.x0)
- code = CLIPCODE_LEFT;
- else if (p.X > r.x1)
- code = CLIPCODE_RIGHT;
-
- if (p.Y < r.y0)
- code |= CLIPCODE_TOP;
- else if (p.Y > r.y1)
- code |= CLIPCODE_BOTTOM;
-
- return code;
-}
-
-/*
- */
-inline void GetClip(AbsRectangle &clipping, video::IImage *t)
-{
- clipping.x0 = 0;
- clipping.y0 = 0;
- clipping.x1 = t->getDimension().Width - 1;
- clipping.y1 = t->getDimension().Height - 1;
-}
-
/*
return alpha in [0;256] Granularity from 32-Bit ARGB
add highbit alpha ( alpha > 127 ? + 1 )
@@ -101,15 +61,6 @@ static inline u32 extractAlpha(const u32 c)
return (c >> 24) + (c >> 31);
}
-/*
- return alpha in [0;255] Granularity and 32-Bit ARGB
- add highbit alpha ( alpha > 127 ? + 1 )
-*/
-static inline u32 packAlpha(const u32 c)
-{
- return (c > 127 ? c - 1 : c) << 24;
-}
-
/*!
Scale Color by (1/value)
value 0 - 256 ( alpha )
@@ -411,365 +362,11 @@ static void executeBlit_TextureCopy_32_to_24(const SBlitJob *job)
}
}
-/*!
- */
-static void executeBlit_TextureBlend_16_to_16(const SBlitJob *job)
-{
- const f18 wscale = f32_to_f18(job->x_stretch);
- const f18 hscale = f32_to_f18(job->y_stretch);
-
- f18 src_y = f18_zero;
- u16 *dst = (u16 *)job->dst;
-
- for (u32 dy = 0; dy < job->height; ++dy, src_y += hscale) {
- const u16 *src = (u16 *)((u8 *)(job->src) + job->srcPitch * f18_floor(src_y));
- f18 src_x = f18_zero;
- for (u32 dx = 0; dx < job->width; ++dx, src_x += wscale) {
- dst[dx] = PixelBlend16(dst[dx], src[f18_floor(src_x)]);
- }
- dst = (u16 *)((u8 *)(dst) + job->dstPitch);
- }
-}
-
-/*!
- */
-static void executeBlit_TextureBlend_32_to_32(const SBlitJob *job)
-{
- const f18 wscale = f32_to_f18(job->x_stretch);
- const f18 hscale = f32_to_f18(job->y_stretch);
-
- f18 src_y = f18_zero;
- u32 *dst = (u32 *)job->dst;
- for (u32 dy = 0; dy < job->height; ++dy, src_y += hscale) {
- const u32 *src = (u32 *)((u8 *)(job->src) + job->srcPitch * f18_floor(src_y));
-
- f18 src_x = f18_zero;
- for (u32 dx = 0; dx < job->width; ++dx, src_x += wscale) {
- dst[dx] = PixelBlend32(dst[dx], src[f18_floor(src_x)]);
- }
- dst = (u32 *)((u8 *)(dst) + job->dstPitch);
- }
-}
-
-/*!
- */
-static void executeBlit_TextureBlendColor_16_to_16(const SBlitJob *job)
-{
- const u16 blend = video::A8R8G8B8toA1R5G5B5(job->argb);
-
- const f18 wscale = f32_to_f18(job->x_stretch);
- const f18 hscale = f32_to_f18(job->y_stretch);
-
- f18 src_y = f18_zero;
- u16 *dst = (u16 *)job->dst;
- for (u32 dy = 0; dy < job->height; ++dy, src_y += hscale) {
- const u16 *src = (u16 *)((u8 *)(job->src) + job->srcPitch * f18_floor(src_y));
- f18 src_x = f18_zero;
- for (u32 dx = 0; dx < job->width; ++dx, src_x += wscale) {
- u16 c0 = src[f18_floor(src_x)];
- if (0 == (c0 & 0x8000))
- continue;
-
- dst[dx] = PixelMul16_2(c0, blend);
- }
- dst = (u16 *)((u8 *)(dst) + job->dstPitch);
- }
-}
-
-/*!
- */
-static void executeBlit_TextureBlendColor_32_to_32(const SBlitJob *job)
-{
- const f18 wscale = f32_to_f18(job->x_stretch);
- const f18 hscale = f32_to_f18(job->y_stretch);
-
- u32 *dst = (u32 *)job->dst;
- f18 src_y = f18_zero;
- for (u32 dy = 0; dy < job->height; ++dy, src_y += hscale) {
- const u32 *src = (u32 *)((u8 *)(job->src) + job->srcPitch * f18_floor(src_y));
-
- f18 src_x = f18_zero;
- for (u32 dx = 0; dx < job->width; ++dx, src_x += wscale) {
- dst[dx] = PixelBlend32(dst[dx], PixelMul32_2(src[f18_floor(src_x)], job->argb));
- }
- dst = (u32 *)((u8 *)(dst) + job->dstPitch);
- }
-}
-
-/*!
- */
-static void executeBlit_Color_16_to_16(const SBlitJob *job)
-{
- const u16 c = video::A8R8G8B8toA1R5G5B5(job->argb);
- u16 *dst = (u16 *)job->dst;
-
- for (u32 dy = 0; dy < job->height; ++dy) {
- memset16(dst, c, job->srcPitch);
- dst = (u16 *)((u8 *)(dst) + job->dstPitch);
- }
-}
-
-/*!
- */
-static void executeBlit_Color_32_to_32(const SBlitJob *job)
-{
- u32 *dst = (u32 *)job->dst;
-
- for (u32 dy = 0; dy < job->height; ++dy) {
- memset32(dst, job->argb, job->srcPitch);
- dst = (u32 *)((u8 *)(dst) + job->dstPitch);
- }
-}
-
-/*!
- */
-static void executeBlit_ColorAlpha_16_to_16(const SBlitJob *job)
-{
- u16 *dst = (u16 *)job->dst;
-
- const u16 alpha = extractAlpha(job->argb) >> 3;
- if (0 == alpha)
- return;
- const u32 src = video::A8R8G8B8toA1R5G5B5(job->argb);
-
- for (u32 dy = 0; dy != job->height; ++dy) {
- for (u32 dx = 0; dx != job->width; ++dx) {
- dst[dx] = PixelBlend16(dst[dx], src, alpha);
- }
- dst = (u16 *)((u8 *)(dst) + job->dstPitch);
- }
-}
-
-/*!
- */
-static void executeBlit_ColorAlpha_32_to_32(const SBlitJob *job)
-{
- const u32 alpha = extractAlpha(job->argb);
- if (0 == alpha)
- return;
-
- u32 *dst = (u32 *)job->dst;
- for (u32 dy = 0; dy < job->height; ++dy) {
- for (u32 dx = 0; dx < job->width; ++dx) {
- dst[dx] = PixelBlend32(dst[dx], job->argb, alpha);
- }
- dst = (u32 *)((u8 *)(dst) + job->dstPitch);
- }
-}
-
-/*!
- Pixel =>
- color = sourceAlpha > 0 ? source, else dest
- alpha = max(destAlpha, sourceAlpha)
-*/
-inline u16 PixelCombine16(const u16 c2, const u16 c1)
-{
- if (video::getAlpha(c1) > 0)
- return c1;
- else
- return c2;
-}
-
-/*!
- Combine alpha channels (increases alpha / reduces transparency)
-*/
-static void executeBlit_TextureCombineColor_16_to_16(const SBlitJob *job)
-{
- const u32 w = job->width * 2;
- const u32 h = job->height * 2;
- u16 *src = (u16 *)job->src;
- u16 *dst = (u16 *)job->dst;
-
- const u16 jobColor = video::A8R8G8B8toA1R5G5B5(job->argb);
-
- /*
- Stretch not supported.
- */
- for (u32 dy = 0; dy != h; dy++) {
- for (u32 dx = 0; dx != w; dx++) {
- const u16 src_x = src[dx];
- const u16 dst_x = dst[dx];
- dst[dx] = PixelCombine16(dst_x, PixelMul16_2(src_x, jobColor));
- }
- src = (u16 *)((u8 *)(src) + job->srcPitch);
- dst = (u16 *)((u8 *)(dst) + job->dstPitch);
- }
-}
-
-/*!
- Combine alpha channels (increases alpha / reduces transparency)
-*/
-static void executeBlit_TextureCombineColor_16_to_24(const SBlitJob *job)
-{
- const u32 w = job->width;
- const u32 h = job->height;
- const u16 *src = static_cast(job->src);
- u8 *dst = static_cast(job->dst);
-
- const u16 jobColor = video::A8R8G8B8toA1R5G5B5(job->argb);
-
- if (job->stretch) {
- const float wscale = job->x_stretch;
- const float hscale = job->y_stretch;
-
- for (u32 dy = 0; dy < h; ++dy) {
- const u32 src_y = (u32)(dy * hscale);
- src = (u16 *)((u8 *)(job->src) + job->srcPitch * src_y);
-
- for (u32 dx = 0; dx < w; ++dx) {
- const u32 src_x = (u32)(dx * wscale);
- u32 color = PixelMul16_2(video::A1R5G5B5toA8R8G8B8(src[src_x]), jobColor);
- u8 *writeTo = &dst[dx * 3];
- if (video::getAlpha(src[src_x]) > 0) { // only overlay if source has visible alpha (alpha == 1)
- *writeTo++ = (color >> 16) & 0xFF;
- *writeTo++ = (color >> 8) & 0xFF;
- *writeTo++ = color & 0xFF;
- }
- }
- dst += job->dstPitch;
- }
- } else {
- for (u32 dy = 0; dy != h; ++dy) {
- for (u32 dx = 0; dx != w; ++dx) {
- u32 color = PixelMul16_2(video::A1R5G5B5toA8R8G8B8(src[dx]), jobColor);
- u8 *writeTo = &dst[dx * 3];
- if (video::getAlpha(src[dx]) > 0) { // only overlay if source has visible alpha (alpha == 1)
- *writeTo++ = (color >> 16) & 0xFF;
- *writeTo++ = (color >> 8) & 0xFF;
- *writeTo++ = color & 0xFF;
- }
- }
-
- src = (u16 *)((u8 *)(src) + job->srcPitch);
- dst += job->dstPitch;
- }
- }
-}
-
-/*!
- Pixel =>
- color = dest * ( 1 - SourceAlpha ) + source * SourceAlpha,
- alpha = destAlpha * ( 1 - SourceAlpha ) + sourceAlpha
-
- where "1" means "full scale" (255)
-*/
-inline u32 PixelCombine32(const u32 c2, const u32 c1)
-{
- // alpha test
- u32 alpha = c1 & 0xFF000000;
-
- if (0 == alpha)
- return c2;
- if (0xFF000000 == alpha) {
- return c1;
- }
-
- alpha >>= 24;
-
- // add highbit alpha, if ( alpha > 127 ) alpha += 1;
- // stretches [0;255] to [0;256] to avoid division by 255. use division 256 == shr 8
- alpha += (alpha >> 7);
-
- u32 srcRB = c1 & 0x00FF00FF;
- u32 srcXG = c1 & 0x0000FF00;
-
- u32 dstRB = c2 & 0x00FF00FF;
- u32 dstXG = c2 & 0x0000FF00;
-
- u32 rb = srcRB - dstRB;
- u32 xg = srcXG - dstXG;
-
- rb *= alpha;
- xg *= alpha;
- rb >>= 8;
- xg >>= 8;
-
- rb += dstRB;
- xg += dstXG;
-
- rb &= 0x00FF00FF;
- xg &= 0x0000FF00;
-
- u32 sa = c1 >> 24;
- u32 da = c2 >> 24;
- u32 blendAlpha_fix8 = (sa * 256 + da * (256 - alpha)) >> 8;
- return blendAlpha_fix8 << 24 | rb | xg;
-}
-
-/*!
- Combine alpha channels (increases alpha / reduces transparency)
- Destination alpha is treated as full 255
-*/
-static void executeBlit_TextureCombineColor_32_to_24(const SBlitJob *job)
-{
- const u32 w = job->width;
- const u32 h = job->height;
- const u32 *src = static_cast(job->src);
- u8 *dst = static_cast(job->dst);
-
- if (job->stretch) {
- const float wscale = job->x_stretch;
- const float hscale = job->y_stretch;
-
- for (u32 dy = 0; dy < h; ++dy) {
- const u32 src_y = (u32)(dy * hscale);
- src = (u32 *)((u8 *)(job->src) + job->srcPitch * src_y);
-
- for (u32 dx = 0; dx < w; ++dx) {
- const u32 src_x = src[(u32)(dx * wscale)];
- u8 *writeTo = &dst[dx * 3];
- const u32 dst_x = 0xFF000000 | writeTo[0] << 16 | writeTo[1] << 8 | writeTo[2];
- const u32 combo = PixelCombine32(dst_x, PixelMul32_2(src_x, job->argb));
- *writeTo++ = (combo >> 16) & 0xFF;
- *writeTo++ = (combo >> 8) & 0xFF;
- *writeTo++ = combo & 0xFF;
- }
- dst += job->dstPitch;
- }
- } else {
- for (u32 dy = 0; dy != h; ++dy) {
- for (u32 dx = 0; dx != w; ++dx) {
- u8 *writeTo = &dst[dx * 3];
- const u32 dst_x = 0xFF000000 | writeTo[0] << 16 | writeTo[1] << 8 | writeTo[2];
- const u32 combo = PixelCombine32(dst_x, PixelMul32_2(src[dx], job->argb));
- *writeTo++ = (combo >> 16) & 0xFF;
- *writeTo++ = (combo >> 8) & 0xFF;
- *writeTo++ = combo & 0xFF;
- }
-
- src = (u32 *)((u8 *)(src) + job->srcPitch);
- dst += job->dstPitch;
- }
- }
-}
-
-/*!
- Combine alpha channels (increases alpha / reduces transparency)
-*/
-static void executeBlit_TextureCombineColor_32_to_32(const SBlitJob *job)
-{
- u32 *src = (u32 *)job->src;
- u32 *dst = (u32 *)job->dst;
-
- for (u32 dy = 0; dy != job->height; ++dy) {
- for (u32 dx = 0; dx != job->width; ++dx) {
- dst[dx] = PixelCombine32(dst[dx], PixelMul32_2(src[dx], job->argb));
- }
- src = (u32 *)((u8 *)(src) + job->srcPitch);
- dst = (u32 *)((u8 *)(dst) + job->dstPitch);
- }
-}
-
// Blitter Operation
enum eBlitter
{
BLITTER_INVALID = 0,
- BLITTER_COLOR,
- BLITTER_COLOR_ALPHA,
BLITTER_TEXTURE,
- BLITTER_TEXTURE_ALPHA_BLEND,
- BLITTER_TEXTURE_ALPHA_COLOR_BLEND,
- BLITTER_TEXTURE_COMBINE_ALPHA,
};
typedef void (*tExecuteBlit)(const SBlitJob *job);
@@ -792,22 +389,6 @@ static const blitterTable blitTable[] = {
{BLITTER_TEXTURE, video::ECF_A8R8G8B8, video::ECF_R8G8B8, executeBlit_TextureCopy_24_to_32},
{BLITTER_TEXTURE, video::ECF_R8G8B8, video::ECF_A1R5G5B5, executeBlit_TextureCopy_16_to_24},
{BLITTER_TEXTURE, video::ECF_R8G8B8, video::ECF_A8R8G8B8, executeBlit_TextureCopy_32_to_24},
- {BLITTER_TEXTURE_ALPHA_BLEND, video::ECF_A1R5G5B5, video::ECF_A1R5G5B5, executeBlit_TextureBlend_16_to_16},
- {BLITTER_TEXTURE_ALPHA_BLEND, video::ECF_A8R8G8B8, video::ECF_A8R8G8B8, executeBlit_TextureBlend_32_to_32},
- {BLITTER_TEXTURE_ALPHA_COLOR_BLEND, video::ECF_A1R5G5B5, video::ECF_A1R5G5B5, executeBlit_TextureBlendColor_16_to_16},
- {BLITTER_TEXTURE_ALPHA_COLOR_BLEND, video::ECF_A8R8G8B8, video::ECF_A8R8G8B8, executeBlit_TextureBlendColor_32_to_32},
- {BLITTER_COLOR, video::ECF_A1R5G5B5, -1, executeBlit_Color_16_to_16},
- {BLITTER_COLOR, video::ECF_A8R8G8B8, -1, executeBlit_Color_32_to_32},
- {BLITTER_COLOR_ALPHA, video::ECF_A1R5G5B5, -1, executeBlit_ColorAlpha_16_to_16},
- {BLITTER_COLOR_ALPHA, video::ECF_A8R8G8B8, -1, executeBlit_ColorAlpha_32_to_32},
- {BLITTER_TEXTURE_COMBINE_ALPHA, video::ECF_A8R8G8B8, video::ECF_A8R8G8B8, executeBlit_TextureCombineColor_32_to_32},
- {BLITTER_TEXTURE_COMBINE_ALPHA, video::ECF_A8R8G8B8, video::ECF_R8G8B8, executeBlit_TextureCopy_24_to_32},
- {BLITTER_TEXTURE_COMBINE_ALPHA, video::ECF_R8G8B8, video::ECF_A8R8G8B8, executeBlit_TextureCombineColor_32_to_24},
- {BLITTER_TEXTURE_COMBINE_ALPHA, video::ECF_R8G8B8, video::ECF_R8G8B8, executeBlit_TextureCopy_x_to_x},
- {BLITTER_TEXTURE_COMBINE_ALPHA, video::ECF_A1R5G5B5, video::ECF_R8G8B8, executeBlit_TextureCopy_24_to_16},
- {BLITTER_TEXTURE_COMBINE_ALPHA, video::ECF_A1R5G5B5, video::ECF_A1R5G5B5, executeBlit_TextureCombineColor_16_to_16},
- {BLITTER_TEXTURE_COMBINE_ALPHA, video::ECF_A1R5G5B5, video::ECF_R8G8B8, executeBlit_TextureCopy_24_to_16},
- {BLITTER_TEXTURE_COMBINE_ALPHA, video::ECF_R8G8B8, video::ECF_A1R5G5B5, executeBlit_TextureCombineColor_16_to_24},
{BLITTER_INVALID, -1, -1, 0},
};
@@ -938,5 +519,3 @@ static s32 Blit(eBlitter operation,
return 1;
}
-
-}
diff --git a/irr/src/CBoneSceneNode.cpp b/irr/src/CBoneSceneNode.cpp
deleted file mode 100644
index 7aa637094b..0000000000
--- a/irr/src/CBoneSceneNode.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (C) 2002-2012 Nikolaus Gebhardt
-// This file is part of the "Irrlicht Engine".
-// For conditions of distribution and use, see copyright notice in irrlicht.h
-
-#include "CBoneSceneNode.h"
-
-#include
-
-namespace irr
-{
-namespace scene
-{
-
-//! constructor
-CBoneSceneNode::CBoneSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id,
- u32 boneIndex, const std::optional &boneName) :
- IBoneSceneNode(parent, mgr, id),
- BoneIndex(boneIndex),
- AnimationMode(EBAM_AUTOMATIC), SkinningSpace(EBSS_LOCAL)
-{
- setName(boneName);
-}
-
-//! Returns the index of the bone
-u32 CBoneSceneNode::getBoneIndex() const
-{
- return BoneIndex;
-}
-
-//! Sets the animation mode of the bone. Returns true if successful.
-bool CBoneSceneNode::setAnimationMode(E_BONE_ANIMATION_MODE mode)
-{
- AnimationMode = mode;
- return true;
-}
-
-//! Gets the current animation mode of the bone
-E_BONE_ANIMATION_MODE CBoneSceneNode::getAnimationMode() const
-{
- return AnimationMode;
-}
-
-//! returns the axis aligned bounding box of this node
-const core::aabbox3d &CBoneSceneNode::getBoundingBox() const
-{
- return Box;
-}
-
-/*
-//! Returns the relative transformation of the scene node.
-core::matrix4 CBoneSceneNode::getRelativeTransformation() const
-{
- return core::matrix4(); // RelativeTransformation;
-}
-*/
-
-void CBoneSceneNode::OnAnimate(u32 timeMs)
-{
- if (IsVisible) {
- // update absolute position
- // updateAbsolutePosition();
-
- // perform the post render process on all children
- ISceneNodeList::iterator it = Children.begin();
- for (; it != Children.end(); ++it)
- (*it)->OnAnimate(timeMs);
- }
-}
-
-void CBoneSceneNode::helper_updateAbsolutePositionOfAllChildren(ISceneNode *Node)
-{
- Node->updateAbsolutePosition();
-
- ISceneNodeList::const_iterator it = Node->getChildren().begin();
- for (; it != Node->getChildren().end(); ++it) {
- helper_updateAbsolutePositionOfAllChildren((*it));
- }
-}
-
-void CBoneSceneNode::updateAbsolutePositionOfAllChildren()
-{
- helper_updateAbsolutePositionOfAllChildren(this);
-}
-
-} // namespace scene
-} // namespace irr
diff --git a/irr/src/CBoneSceneNode.h b/irr/src/CBoneSceneNode.h
index d900570db0..da2308b124 100644
--- a/irr/src/CBoneSceneNode.h
+++ b/irr/src/CBoneSceneNode.h
@@ -7,11 +7,11 @@
// Used with SkinnedMesh and IAnimatedMeshSceneNode, for boned meshes
#include "IBoneSceneNode.h"
+#include "Transform.h"
+#include "matrix4.h"
#include
-namespace irr
-{
namespace scene
{
@@ -21,50 +21,48 @@ public:
//! constructor
CBoneSceneNode(ISceneNode *parent, ISceneManager *mgr,
s32 id = -1, u32 boneIndex = 0,
- const std::optional &boneName = std::nullopt);
-
- //! Returns the index of the bone
- u32 getBoneIndex() const override;
-
- //! Sets the animation mode of the bone. Returns true if successful.
- bool setAnimationMode(E_BONE_ANIMATION_MODE mode) override;
-
- //! Gets the current animation mode of the bone
- E_BONE_ANIMATION_MODE getAnimationMode() const override;
-
- //! returns the axis aligned bounding box of this node
- const core::aabbox3d &getBoundingBox() const override;
-
- /*
- //! Returns the relative transformation of the scene node.
- //core::matrix4 getRelativeTransformation() const override;
- */
-
- void OnAnimate(u32 timeMs) override;
-
- void updateAbsolutePositionOfAllChildren() override;
-
- //! How the relative transformation of the bone is used
- void setSkinningSpace(E_BONE_SKINNING_SPACE space) override
+ const std::optional &boneName = std::nullopt,
+ const core::Transform &transform = {},
+ const std::optional &matrix = std::nullopt) :
+ IBoneSceneNode(parent, mgr, id, boneIndex, boneName),
+ Matrix(matrix)
{
- SkinningSpace = space;
+ setTransform(transform);
}
- E_BONE_SKINNING_SPACE getSkinningSpace() const override
+ void setTransform(const core::Transform &transform)
{
- return SkinningSpace;
+ setPosition(transform.translation);
+ {
+ core::vector3df euler;
+ auto rot = transform.rotation;
+ // Invert to be consistent with setRotationDegrees
+ rot.makeInverse();
+ rot.toEuler(euler);
+ setRotation(euler * core::RADTODEG);
+ }
+ setScale(transform.scale);
}
-private:
- void helper_updateAbsolutePositionOfAllChildren(ISceneNode *Node);
+ core::Transform getTransform() const
+ {
+ return {
+ getPosition(),
+ core::quaternion(getRotation() * core::DEGTORAD).makeInverse(),
+ getScale()
+ };
+ }
- u32 BoneIndex;
+ core::matrix4 getRelativeTransformation() const override
+ {
+ if (Matrix)
+ return *Matrix;
+ return IBoneSceneNode::getRelativeTransformation();
+ }
- core::aabbox3d Box{-1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f};
-
- E_BONE_ANIMATION_MODE AnimationMode;
- E_BONE_SKINNING_SPACE SkinningSpace;
+ //! Some file formats alternatively let bones specify a transformation matrix.
+ //! If this is set, it overrides the TRS properties.
+ std::optional Matrix;
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/src/CCameraSceneNode.cpp b/irr/src/CCameraSceneNode.cpp
index e1c3c96f67..ae19f1fe81 100644
--- a/irr/src/CCameraSceneNode.cpp
+++ b/irr/src/CCameraSceneNode.cpp
@@ -7,8 +7,6 @@
#include "IVideoDriver.h"
#include "os.h"
-namespace irr
-{
namespace scene
{
@@ -307,4 +305,3 @@ ISceneNode *CCameraSceneNode::clone(ISceneNode *newParent, ISceneManager *newMan
}
} // end namespace
-} // end namespace
diff --git a/irr/src/CCameraSceneNode.h b/irr/src/CCameraSceneNode.h
index 6687563003..08697cd2d7 100644
--- a/irr/src/CCameraSceneNode.h
+++ b/irr/src/CCameraSceneNode.h
@@ -7,8 +7,6 @@
#include "ICameraSceneNode.h"
#include "SViewFrustum.h"
-namespace irr
-{
namespace scene
{
@@ -162,4 +160,3 @@ protected:
};
} // end namespace
-} // end namespace
diff --git a/irr/src/CColorConverter.cpp b/irr/src/CColorConverter.cpp
index d1bd302c78..38a178f2d9 100644
--- a/irr/src/CColorConverter.cpp
+++ b/irr/src/CColorConverter.cpp
@@ -16,8 +16,6 @@
// convert_A1R5G5B5toR8G8B8 converts 0bARRRRRGGGGGBBBBB into [R][G][B].
// This also means many conversions may be broken on big endian.
-namespace irr
-{
namespace video
{
@@ -650,4 +648,3 @@ void CColorConverter::convert_viaFormat(const void *sP, ECOLOR_FORMAT sF, s32 sN
}
} // end namespace video
-} // end namespace irr
diff --git a/irr/src/CColorConverter.h b/irr/src/CColorConverter.h
index 8db7af0979..8042487685 100644
--- a/irr/src/CColorConverter.h
+++ b/irr/src/CColorConverter.h
@@ -7,8 +7,6 @@
#include "irrTypes.h"
#include "IImage.h"
-namespace irr
-{
namespace video
{
@@ -81,4 +79,3 @@ public:
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/src/CDummyTransformationSceneNode.cpp b/irr/src/CDummyTransformationSceneNode.cpp
index e354038dfe..5444f56594 100644
--- a/irr/src/CDummyTransformationSceneNode.cpp
+++ b/irr/src/CDummyTransformationSceneNode.cpp
@@ -5,8 +5,6 @@
#include "CDummyTransformationSceneNode.h"
#include "os.h"
-namespace irr
-{
namespace scene
{
@@ -95,4 +93,3 @@ void CDummyTransformationSceneNode::setPosition(const core::vector3df &newpos)
}
} // end namespace scene
-} // end namespace irr
diff --git a/irr/src/CDummyTransformationSceneNode.h b/irr/src/CDummyTransformationSceneNode.h
index a03ed07fa9..11c235ecb0 100644
--- a/irr/src/CDummyTransformationSceneNode.h
+++ b/irr/src/CDummyTransformationSceneNode.h
@@ -6,8 +6,6 @@
#include "IDummyTransformationSceneNode.h"
-namespace irr
-{
namespace scene
{
@@ -52,4 +50,3 @@ private:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/src/CEGLManager.cpp b/irr/src/CEGLManager.cpp
index b70a0c0917..5770ac3bb1 100644
--- a/irr/src/CEGLManager.cpp
+++ b/irr/src/CEGLManager.cpp
@@ -10,8 +10,6 @@
#include "irrArray.h"
#include "os.h"
-namespace irr
-{
namespace video
{
@@ -294,7 +292,7 @@ EGLConfig CEGLManager::chooseConfig(EConfigStyle confStyle)
return configResult;
}
-irr::s32 CEGLManager::rateConfig(EGLConfig config, EGLint eglOpenGLBIT, bool log)
+s32 CEGLManager::rateConfig(EGLConfig config, EGLint eglOpenGLBIT, bool log)
{
// some values must be there or we ignore the config
#ifdef EGL_VERSION_1_3
@@ -572,7 +570,6 @@ bool CEGLManager::testEGLError()
return true;
}
-}
}
#endif
diff --git a/irr/src/CEGLManager.h b/irr/src/CEGLManager.h
index 49371e469d..36fff19b75 100644
--- a/irr/src/CEGLManager.h
+++ b/irr/src/CEGLManager.h
@@ -12,8 +12,6 @@
#include "SExposedVideoData.h"
#include "IContextManager.h"
-namespace irr
-{
namespace video
{
// EGL manager.
@@ -80,13 +78,13 @@ protected:
//! Check how close this config is to the parameters we requested
//! returns 0 is perfect, larger values are worse and < 0 is unusable.
- irr::s32 rateConfig(EGLConfig config, EGLint eglOpenGLBIT, bool log = false);
+ s32 rateConfig(EGLConfig config, EGLint eglOpenGLBIT, bool log = false);
// Helper to sort EGLConfig's. (because we got no std::pair....)
struct SConfigRating
{
EGLConfig config;
- irr::s32 rating;
+ s32 rating;
bool operator<(const SConfigRating &other) const
{
return rating < other.rating;
@@ -110,5 +108,4 @@ private:
EGLint MinorVersion;
};
}
-}
#endif
diff --git a/irr/src/CEmptySceneNode.cpp b/irr/src/CEmptySceneNode.cpp
index 70a2ca21db..e1e7101d88 100644
--- a/irr/src/CEmptySceneNode.cpp
+++ b/irr/src/CEmptySceneNode.cpp
@@ -5,8 +5,6 @@
#include "CEmptySceneNode.h"
#include "ISceneManager.h"
-namespace irr
-{
namespace scene
{
@@ -58,4 +56,3 @@ ISceneNode *CEmptySceneNode::clone(ISceneNode *newParent, ISceneManager *newMana
}
} // end namespace scene
-} // end namespace irr
diff --git a/irr/src/CEmptySceneNode.h b/irr/src/CEmptySceneNode.h
index bf5c48e9bd..4a1557f9c7 100644
--- a/irr/src/CEmptySceneNode.h
+++ b/irr/src/CEmptySceneNode.h
@@ -6,8 +6,6 @@
#include "ISceneNode.h"
-namespace irr
-{
namespace scene
{
@@ -37,4 +35,3 @@ private:
};
} // end namespace scene
-} // end namespace irr
diff --git a/irr/src/CFPSCounter.cpp b/irr/src/CFPSCounter.cpp
index 0542fc5cbe..b04785b797 100644
--- a/irr/src/CFPSCounter.cpp
+++ b/irr/src/CFPSCounter.cpp
@@ -5,8 +5,6 @@
#include "CFPSCounter.h"
#include "irrMath.h"
-namespace irr
-{
namespace video
{
@@ -32,4 +30,3 @@ void CFPSCounter::registerFrame(u32 now)
}
} // end namespace video
-} // end namespace irr
diff --git a/irr/src/CFPSCounter.h b/irr/src/CFPSCounter.h
index 692aef6bd5..071c1c275f 100644
--- a/irr/src/CFPSCounter.h
+++ b/irr/src/CFPSCounter.h
@@ -6,8 +6,6 @@
#include "irrTypes.h"
-namespace irr
-{
namespace video
{
@@ -29,4 +27,3 @@ private:
};
} // end namespace video
-} // end namespace irr
diff --git a/irr/src/CFileList.cpp b/irr/src/CFileList.cpp
index 9294f3f46f..4087cfc2a0 100644
--- a/irr/src/CFileList.cpp
+++ b/irr/src/CFileList.cpp
@@ -8,8 +8,6 @@
#include "os.h"
-namespace irr
-{
namespace io
{
@@ -147,5 +145,4 @@ const io::path &CFileList::getPath() const
return Path;
}
-} // end namespace irr
} // end namespace io
diff --git a/irr/src/CFileList.h b/irr/src/CFileList.h
index 1af975b222..bb0e62cb17 100644
--- a/irr/src/CFileList.h
+++ b/irr/src/CFileList.h
@@ -8,8 +8,6 @@
#include "irrString.h"
#include "irrArray.h"
-namespace irr
-{
namespace io
{
@@ -124,5 +122,4 @@ protected:
core::array Files;
};
-} // end namespace irr
} // end namespace io
diff --git a/irr/src/CFileSystem.cpp b/irr/src/CFileSystem.cpp
index d8f04eb1dd..16d8e372f1 100644
--- a/irr/src/CFileSystem.cpp
+++ b/irr/src/CFileSystem.cpp
@@ -35,8 +35,6 @@
#include
#endif
-namespace irr
-{
namespace io
{
@@ -488,5 +486,4 @@ IFileSystem *createFileSystem()
return new CFileSystem();
}
-} // end namespace irr
} // end namespace io
diff --git a/irr/src/CFileSystem.h b/irr/src/CFileSystem.h
index d2a627e492..9a60f6d388 100644
--- a/irr/src/CFileSystem.h
+++ b/irr/src/CFileSystem.h
@@ -7,12 +7,9 @@
#include
#include "IFileSystem.h"
-namespace irr
-{
namespace io
{
-class CZipReader;
/*!
FileSystem which uses normal files and one zipfile
@@ -98,5 +95,4 @@ private:
std::vector ArchiveLoader;
};
-} // end namespace irr
} // end namespace io
diff --git a/irr/src/CGLTFMeshFileLoader.cpp b/irr/src/CGLTFMeshFileLoader.cpp
index 3f2096f40e..238be28d8e 100644
--- a/irr/src/CGLTFMeshFileLoader.cpp
+++ b/irr/src/CGLTFMeshFileLoader.cpp
@@ -30,8 +30,6 @@
#include
#include
-namespace irr {
-
/* Notes on the coordinate system.
*
* glTF uses a right-handed coordinate system where +Z is the
@@ -539,34 +537,25 @@ static core::matrix4 loadTransform(const tiniergltf::Node::Matrix &m, SkinnedMes
mat[i] = static_cast(m[i]);
mat = convertHandedness(mat);
- // Decompose the matrix into translation, scale, and rotation.
- joint->Animatedposition = mat.getTranslation();
-
- auto scale = mat.getScale();
- joint->Animatedscale = scale;
- joint->Animatedrotation = mat.getRotationRadians(scale);
- // Invert the rotation because it is applied using `getMatrix_transposed`,
- // which again inverts.
- joint->Animatedrotation.makeInverse();
-
+ // Note: "When a node is targeted for animation [...],
+ // only TRS properties MAY be present; matrix MUST NOT be present."
+ // Thus we MUST NOT do any decomposition, which in general need not exist.
+ joint->transform = mat;
return mat;
}
static core::matrix4 loadTransform(const tiniergltf::Node::TRS &trs, SkinnedMesh::SJoint *joint)
{
- const auto &trans = trs.translation;
- const auto &rot = trs.rotation;
- const auto &scale = trs.scale;
- core::matrix4 transMat;
- joint->Animatedposition = convertHandedness(core::vector3df(trans[0], trans[1], trans[2]));
- transMat.setTranslation(joint->Animatedposition);
- core::matrix4 rotMat;
- joint->Animatedrotation = convertHandedness(core::quaternion(rot[0], rot[1], rot[2], rot[3]));
- core::quaternion(joint->Animatedrotation).getMatrix_transposed(rotMat);
- joint->Animatedscale = core::vector3df(scale[0], scale[1], scale[2]);
- core::matrix4 scaleMat;
- scaleMat.setScale(joint->Animatedscale);
- return transMat * rotMat * scaleMat;
+ const auto &t = trs.translation;
+ const auto &r = trs.rotation;
+ const auto &s = trs.scale;
+ core::Transform transform{
+ convertHandedness(core::vector3df(t[0], t[1], t[2])),
+ convertHandedness(core::quaternion(r[0], r[1], r[2], r[3])),
+ core::vector3df(s[0], s[1], s[2]),
+ };
+ joint->transform = transform;
+ return transform.buildMatrix();
}
static core::matrix4 loadTransform(std::optional> transform,
@@ -584,8 +573,7 @@ void SelfType::MeshExtractor::loadNode(
const auto &node = m_gltf_model.nodes->at(nodeIdx);
auto *joint = m_irr_model->addJoint(parent);
const core::matrix4 transform = loadTransform(node.transform, joint);
- joint->LocalMatrix = transform;
- joint->GlobalMatrix = parent ? parent->GlobalMatrix * joint->LocalMatrix : joint->LocalMatrix;
+ joint->GlobalMatrix = parent ? parent->GlobalMatrix * transform : transform;
if (node.name.has_value()) {
joint->Name = node.name->c_str();
}
@@ -642,7 +630,6 @@ void SelfType::MeshExtractor::loadAnimation(const std::size_t animIdx)
{
const auto &anim = m_gltf_model.animations->at(animIdx);
for (const auto &channel : anim.channels) {
-
const auto &sampler = anim.samplers.at(channel.sampler);
bool interpolate = ([&]() {
@@ -663,6 +650,11 @@ void SelfType::MeshExtractor::loadAnimation(const std::size_t animIdx)
throw std::runtime_error("no animated node");
auto *joint = m_loaded_nodes.at(*channel.target.node);
+ if (std::holds_alternative(joint->transform)) {
+ warn("nodes using matrix transforms must not be animated");
+ continue;
+ }
+
switch (channel.target.path) {
case tiniergltf::AnimationChannelTarget::Path::TRANSLATION: {
const auto outputAccessor = Accessor::make(m_gltf_model, sampler.output);
@@ -926,5 +918,3 @@ tiniergltf::GlTF SelfType::parseGLTF(io::IReadFile* file)
}
} // namespace scene
-
-} // namespace irr
diff --git a/irr/src/CGLTFMeshFileLoader.h b/irr/src/CGLTFMeshFileLoader.h
index a4eac8baab..c15307b220 100644
--- a/irr/src/CGLTFMeshFileLoader.h
+++ b/irr/src/CGLTFMeshFileLoader.h
@@ -17,9 +17,6 @@
#include
#include
-namespace irr
-{
-
namespace scene
{
@@ -165,5 +162,3 @@ private:
} // namespace scene
-} // namespace irr
-
diff --git a/irr/src/CGLXManager.cpp b/irr/src/CGLXManager.cpp
index 89a5cac201..93ec816322 100644
--- a/irr/src/CGLXManager.cpp
+++ b/irr/src/CGLXManager.cpp
@@ -15,8 +15,6 @@
#include
#include
-namespace irr
-{
namespace video
{
@@ -391,7 +389,6 @@ bool CGLXManager::swapBuffers()
return true;
}
-}
}
#endif
diff --git a/irr/src/CGLXManager.h b/irr/src/CGLXManager.h
index f940d43161..f3e86e7ed1 100644
--- a/irr/src/CGLXManager.h
+++ b/irr/src/CGLXManager.h
@@ -16,8 +16,6 @@
// we can't include glx.h here, because gl.h has incompatible types with ogl es headers and it
// cause redefinition errors, thats why we use ugly trick with void* types and casts.
-namespace irr
-{
namespace video
{
// GLX manager.
@@ -71,6 +69,5 @@ private:
XID GlxWin; // GLXWindow
};
}
-}
#endif
diff --git a/irr/src/CGUIButton.cpp b/irr/src/CGUIButton.cpp
index ea685be948..c5dc18c08f 100644
--- a/irr/src/CGUIButton.cpp
+++ b/irr/src/CGUIButton.cpp
@@ -10,8 +10,6 @@
#include "IGUIFont.h"
#include "os.h"
-namespace irr
-{
namespace gui
{
@@ -411,7 +409,7 @@ video::SColor CGUIButton::getOverrideColor() const
return OverrideColor;
}
-irr::video::SColor CGUIButton::getActiveColor() const
+video::SColor CGUIButton::getActiveColor() const
{
if (OverrideColorEnabled)
return OverrideColor;
@@ -494,4 +492,3 @@ bool CGUIButton::isDrawingBorder() const
}
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CGUIButton.h b/irr/src/CGUIButton.h
index 8a14340251..840131a421 100644
--- a/irr/src/CGUIButton.h
+++ b/irr/src/CGUIButton.h
@@ -9,8 +9,6 @@
#include "ITexture.h"
#include "SColor.h"
-namespace irr
-{
namespace gui
{
@@ -234,4 +232,3 @@ private:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CGUICheckBox.cpp b/irr/src/CGUICheckBox.cpp
index 4d407e676a..0f23b2b56f 100644
--- a/irr/src/CGUICheckBox.cpp
+++ b/irr/src/CGUICheckBox.cpp
@@ -10,8 +10,6 @@
#include "IGUIFont.h"
#include "os.h"
-namespace irr
-{
namespace gui
{
@@ -191,4 +189,3 @@ bool CGUICheckBox::isDrawBorderEnabled() const
}
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CGUICheckBox.h b/irr/src/CGUICheckBox.h
index 2c2a98f049..f13cdfacde 100644
--- a/irr/src/CGUICheckBox.h
+++ b/irr/src/CGUICheckBox.h
@@ -6,8 +6,6 @@
#include "IGUICheckBox.h"
-namespace irr
-{
namespace gui
{
@@ -52,4 +50,3 @@ private:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CGUIComboBox.cpp b/irr/src/CGUIComboBox.cpp
index b55602b0cb..0262566dec 100644
--- a/irr/src/CGUIComboBox.cpp
+++ b/irr/src/CGUIComboBox.cpp
@@ -13,8 +13,6 @@
#include "CGUIListBox.h"
#include "os.h"
-namespace irr
-{
namespace gui
{
@@ -456,4 +454,3 @@ void CGUIComboBox::openCloseMenu()
}
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CGUIComboBox.h b/irr/src/CGUIComboBox.h
index 77f1eca1a0..361924471a 100644
--- a/irr/src/CGUIComboBox.h
+++ b/irr/src/CGUIComboBox.h
@@ -9,8 +9,6 @@
#include "irrString.h"
#include "irrArray.h"
-namespace irr
-{
namespace gui
{
class IGUIButton;
@@ -101,4 +99,3 @@ private:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CGUIEditBox.cpp b/irr/src/CGUIEditBox.cpp
index 6c29e89a9c..34ae5a9c8d 100644
--- a/irr/src/CGUIEditBox.cpp
+++ b/irr/src/CGUIEditBox.cpp
@@ -21,8 +21,6 @@
numerical
*/
-namespace irr
-{
namespace gui
{
@@ -314,7 +312,7 @@ bool CGUIEditBox::processKey(const SEvent &event)
// add the string
const c8 *p = Operator->getTextFromClipboard();
if (p) {
- irr::core::stringw widep;
+ core::stringw widep;
core::utf8ToWString(widep, p);
if (MarkBegin == MarkEnd) {
@@ -936,13 +934,13 @@ wchar_t CGUIEditBox::getCursorChar() const
}
//! Set the blinktime for the cursor. 2x blinktime is one full cycle.
-void CGUIEditBox::setCursorBlinkTime(irr::u32 timeMs)
+void CGUIEditBox::setCursorBlinkTime(u32 timeMs)
{
CursorBlinkTime = timeMs;
}
//! Get the cursor blinktime
-irr::u32 CGUIEditBox::getCursorBlinkTime() const
+u32 CGUIEditBox::getCursorBlinkTime() const
{
return CursorBlinkTime;
}
@@ -950,7 +948,7 @@ irr::u32 CGUIEditBox::getCursorBlinkTime() const
bool CGUIEditBox::processMouse(const SEvent &event)
{
switch (event.MouseInput.Event) {
- case irr::EMIE_LMOUSE_LEFT_UP:
+ case EMIE_LMOUSE_LEFT_UP:
if (Environment->hasFocus(this)) {
CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y);
if (MouseMarking) {
@@ -961,7 +959,7 @@ bool CGUIEditBox::processMouse(const SEvent &event)
return true;
}
break;
- case irr::EMIE_MOUSE_MOVED: {
+ case EMIE_MOUSE_MOVED: {
if (MouseMarking) {
CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y);
setTextMarkers(MarkBegin, CursorPos);
@@ -1011,7 +1009,7 @@ bool CGUIEditBox::processMouse(const SEvent &event)
// paste from the primary selection
inputString([&] {
- irr::core::stringw inserted_text;
+ core::stringw inserted_text;
if (!Operator)
return inserted_text;
const c8 *inserted_text_utf8 = Operator->getTextFromPrimarySelection();
@@ -1104,10 +1102,7 @@ void CGUIEditBox::breakText()
lineBreak = true;
c = 0;
if (Text[i + 1] == L'\n') { // Windows breaks
- // TODO: I (Michael) think that we shouldn't change the text given by the user for whatever reason.
- // Instead rework the cursor positioning to be able to handle this (but not in stable release
- // branch as users might already expect this behavior).
- Text.erase(i + 1);
+ Text.erase(i);
--size;
if (CursorPos > i)
--CursorPos;
@@ -1352,7 +1347,7 @@ void CGUIEditBox::calculateScrollPos()
{
// get cursor position
// get cursor area
- irr::u32 cursorWidth = font->getDimension(CursorChar.c_str()).Width;
+ u32 cursorWidth = font->getDimension(CursorChar.c_str()).Width;
core::stringw *txtLine = hasBrokenText ? &BrokenText[cursLine] : &Text;
s32 cPos = hasBrokenText ? CursorPos - BrokenTextPositions[cursLine] : CursorPos; // column
s32 cStart = font->getDimension(txtLine->subString(0, cPos).c_str()).Width; // pixels from text-start
@@ -1383,9 +1378,9 @@ void CGUIEditBox::calculateScrollPos()
// calculate vertical scrolling
if (hasBrokenText) {
- irr::u32 lineHeight = font->getDimension(L"A").Height + font->getKerning(L'A').Y;
+ u32 lineHeight = font->getDimension(L"A").Height + font->getKerning(L'A').Y;
// only up to 1 line fits?
- if (lineHeight >= (irr::u32)FrameRect.getHeight()) {
+ if (lineHeight >= (u32)FrameRect.getHeight()) {
VScrollPos = 0;
setTextRect(cursLine);
s32 unscrolledPos = CurrentTextRect.UpperLeftCorner.Y;
@@ -1489,4 +1484,3 @@ bool CGUIEditBox::acceptsIME()
}
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CGUIEditBox.h b/irr/src/CGUIEditBox.h
index 35ab5f73ee..39e21ddec4 100644
--- a/irr/src/CGUIEditBox.h
+++ b/irr/src/CGUIEditBox.h
@@ -8,8 +8,6 @@
#include "irrArray.h"
#include "IOSOperator.h"
-namespace irr
-{
namespace gui
{
class CGUIEditBox : public IGUIEditBox
@@ -117,10 +115,10 @@ public:
//! Set the blinktime for the cursor. 2x blinktime is one full cycle.
//** \param timeMs Blinktime in milliseconds. When set to 0 the cursor is constantly on without blinking */
- void setCursorBlinkTime(irr::u32 timeMs) override;
+ void setCursorBlinkTime(u32 timeMs) override;
//! Get the cursor blinktime
- irr::u32 getCursorBlinkTime() const override;
+ u32 getCursorBlinkTime() const override;
//! Sets whether the edit box is a password box. Setting this to true will
/** disable MultiLine, WordWrap and the ability to copy with ctrl+c or ctrl+x
@@ -176,7 +174,7 @@ protected:
IOSOperator *Operator;
u32 BlinkStartTime;
- irr::u32 CursorBlinkTime;
+ u32 CursorBlinkTime;
core::stringw CursorChar; // IGUIFont::draw needs stringw instead of wchar_t
s32 CursorPos;
s32 HScrollPos, VScrollPos; // scroll position in characters
@@ -193,4 +191,3 @@ protected:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CGUIEnvironment.cpp b/irr/src/CGUIEnvironment.cpp
index abfa0aab92..73b77b1ba9 100644
--- a/irr/src/CGUIEnvironment.cpp
+++ b/irr/src/CGUIEnvironment.cpp
@@ -28,8 +28,6 @@
#endif
#include "os.h"
-namespace irr
-{
namespace gui
{
@@ -992,4 +990,3 @@ IGUIEnvironment *createGUIEnvironment(io::IFileSystem *fs,
}
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CGUIEnvironment.h b/irr/src/CGUIEnvironment.h
index 194941599d..8d315aef72 100644
--- a/irr/src/CGUIEnvironment.h
+++ b/irr/src/CGUIEnvironment.h
@@ -10,9 +10,6 @@
#include "IFileSystem.h"
#include "IOSOperator.h"
-namespace irr
-{
-
namespace gui
{
@@ -223,4 +220,3 @@ private:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CGUIFileOpenDialog.cpp b/irr/src/CGUIFileOpenDialog.cpp
index 7add9d8e15..f570d4a039 100644
--- a/irr/src/CGUIFileOpenDialog.cpp
+++ b/irr/src/CGUIFileOpenDialog.cpp
@@ -14,8 +14,6 @@
#include "IFileList.h"
#include "os.h"
-namespace irr
-{
namespace gui
{
@@ -152,13 +150,13 @@ const wchar_t *CGUIFileOpenDialog::getDirectoryNameW() const
return FileDirectoryFlatW.c_str();
}
-void CGUIFileOpenDialog::setFileName(const irr::io::path &name)
+void CGUIFileOpenDialog::setFileName(const io::path &name)
{
FileName = name;
pathToStringW(FileNameW, FileName);
}
-void CGUIFileOpenDialog::setDirectoryName(const irr::io::path &name)
+void CGUIFileOpenDialog::setDirectoryName(const io::path &name)
{
FileDirectory = name;
FileDirectoryFlat = name;
@@ -307,7 +305,7 @@ void CGUIFileOpenDialog::draw()
IGUIElement::draw();
}
-void CGUIFileOpenDialog::pathToStringW(irr::core::stringw &result, const irr::io::path &p)
+void CGUIFileOpenDialog::pathToStringW(core::stringw &result, const io::path &p)
{
core::multibyteToWString(result, p);
}
@@ -365,4 +363,3 @@ void CGUIFileOpenDialog::sendCancelEvent()
}
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CGUIFileOpenDialog.h b/irr/src/CGUIFileOpenDialog.h
index 133509233e..dba292eb9a 100644
--- a/irr/src/CGUIFileOpenDialog.h
+++ b/irr/src/CGUIFileOpenDialog.h
@@ -10,8 +10,6 @@
#include "IGUIEditBox.h"
#include "IFileSystem.h"
-namespace irr
-{
namespace gui
{
@@ -45,11 +43,11 @@ public:
void draw() override;
protected:
- void setFileName(const irr::io::path &name);
- void setDirectoryName(const irr::io::path &name);
+ void setFileName(const io::path &name);
+ void setDirectoryName(const io::path &name);
//! Ensure filenames are converted correct depending on wide-char settings
- void pathToStringW(irr::core::stringw &result, const irr::io::path &p);
+ void pathToStringW(core::stringw &result, const io::path &p);
//! fills the listbox with files.
void fillListBox();
@@ -81,4 +79,3 @@ protected:
};
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CGUIFont.cpp b/irr/src/CGUIFont.cpp
index 9d8b1d4884..25d61515ff 100644
--- a/irr/src/CGUIFont.cpp
+++ b/irr/src/CGUIFont.cpp
@@ -11,8 +11,6 @@
#include "IVideoDriver.h"
#include "IGUISpriteBank.h"
-namespace irr
-{
namespace gui
{
@@ -396,4 +394,3 @@ IGUISpriteBank *CGUIFont::getSpriteBank() const
}
} // end namespace gui
-} // end namespace irr
diff --git a/irr/src/CGUIFont.h b/irr/src/CGUIFont.h
index 8a3b8100b2..087370a19b 100644
--- a/irr/src/CGUIFont.h
+++ b/irr/src/CGUIFont.h
@@ -10,9 +10,6 @@
#include "irrArray.h"
#include