Ported: Single Compilation Unit build.

Adds support for simple SCU build.
This speeds up compilation by compiling multiple cpp files within a single translation unit.
- lawnjelly
43e181a00a
This commit is contained in:
Relintai 2023-07-11 16:07:36 +02:00
parent d6018f1818
commit 834cbe8cef
25 changed files with 713 additions and 20 deletions

View File

@ -14,6 +14,7 @@ from collections import OrderedDict
# Local # Local
import methods import methods
import gles_builders import gles_builders
import scu_builders
from platform_methods import run_in_subprocess from platform_methods import run_in_subprocess
# scan possible build platforms # scan possible build platforms
@ -159,6 +160,7 @@ opts.Add(BoolVariable("disable_advanced_gui", "Disable advanced GUI nodes and be
opts.Add(BoolVariable("no_editor_splash", "Don't use the custom splash screen for the editor", True)) opts.Add(BoolVariable("no_editor_splash", "Don't use the custom splash screen for the editor", True))
opts.Add("system_certs_path", "Use this path as SSL certificates default for editor (for package maintainers)", "") opts.Add("system_certs_path", "Use this path as SSL certificates default for editor (for package maintainers)", "")
opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise epsilon (debug option)", False)) opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise epsilon (debug option)", False))
opts.Add(BoolVariable("scu_build", "Use single compilation unit build", False))
opts.Add( opts.Add(
EnumVariable( EnumVariable(
"rids", "rids",
@ -428,6 +430,10 @@ if selected_platform in platform_list:
"for an optimized template with debug features)." "for an optimized template with debug features)."
) )
# Run SCU file generation script if in a SCU build.
if env["scu_build"]:
methods.set_scu_folders(scu_builders.generate_scu_files(env["verbose"], env_base["target"] != "debug"))
# Must happen after the flags' definition, as configure is when most flags # Must happen after the flags' definition, as configure is when most flags
# are actually handled to change compile options, etc. # are actually handled to change compile options, etc.
detect.configure(env) detect.configure(env)

View File

@ -1,4 +1,9 @@
#ifndef COLOR_NAMES_INC_H
#define COLOR_NAMES_INC_H
// Names from https://en.wikipedia.org/wiki/X11_color_names // Names from https://en.wikipedia.org/wiki/X11_color_names
#include "core/containers/rb_map.h" #include "core/containers/rb_map.h"
static RBMap<String, Color> _named_colors; static RBMap<String, Color> _named_colors;
@ -153,3 +158,5 @@ static void _populate_named_colors() {
_named_colors.insert("yellow", Color(1.00, 1.00, 0.00)); _named_colors.insert("yellow", Color(1.00, 1.00, 0.00));
_named_colors.insert("yellowgreen", Color(0.60, 0.80, 0.20)); _named_colors.insert("yellowgreen", Color(0.60, 0.80, 0.20));
} }
#endif

View File

@ -343,8 +343,8 @@ def run(target, source, env):
versions = 13 versions = 13
versions_ext = 6 versions_ext = 6
text = "" text = "#ifndef METHOD_BIND_GEN_INC_H\n#define METHOD_BIND_GEN_INC_H\n"
text_ext = "" text_ext = "#ifndef METHOD_BIND_EXT_GEN_INC_H\n#define METHOD_BIND_EXT_GEN_INC_H\n"
text_free_func = "#ifndef METHOD_BIND_FREE_FUNC_H\n#define METHOD_BIND_FREE_FUNC_H\n" text_free_func = "#ifndef METHOD_BIND_FREE_FUNC_H\n#define METHOD_BIND_FREE_FUNC_H\n"
text_free_func += "\n//including this header file allows method binding to use free functions\n" text_free_func += "\n//including this header file allows method binding to use free functions\n"
text_free_func += ( text_free_func += (
@ -372,6 +372,8 @@ def run(target, source, env):
text_free_func += make_version(template_typed_free_func, i, versions, True, False) text_free_func += make_version(template_typed_free_func, i, versions, True, False)
text_free_func += make_version(template_typed_free_func, i, versions, True, True) text_free_func += make_version(template_typed_free_func, i, versions, True, True)
text += "#endif"
text_ext += "#endif"
text_free_func += "#endif" text_free_func += "#endif"
with open(target[0], "w") as f: with open(target[0], "w") as f:

View File

@ -52,7 +52,7 @@
#endif #endif
#endif #endif
static const GLenum _cube_side_enum[6] = { const GLenum RasterizerSceneGLES2::_cube_side_enum[6] = {
GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_X,
@ -1304,7 +1304,7 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
} }
} }
static const GLenum gl_primitive[] = { const GLenum RasterizerSceneGLES2::gl_primitive[] = {
GL_POINTS, GL_POINTS,
GL_LINES, GL_LINES,
GL_LINE_STRIP, GL_LINE_STRIP,

View File

@ -89,6 +89,8 @@ public:
private: private:
uint32_t _light_counter; uint32_t _light_counter;
static const GLenum gl_primitive[];
static const GLenum _cube_side_enum[6];
public: public:
RasterizerStorageGLES2 *storage; RasterizerStorageGLES2 *storage;

View File

@ -126,7 +126,7 @@ static void _display_error_with_code(const String &p_error, const Vector<const c
ERR_PRINT(p_error); ERR_PRINT(p_error);
} }
static String _mkid(const String &p_id) { String ShaderGLES2::_mkid(const String &p_id) {
String id = "m_" + p_id; String id = "m_" + p_id;
return id.replace("__", "_dus_"); //doubleunderscore is reserved in glsl return id.replace("__", "_dus_"); //doubleunderscore is reserved in glsl
} }

View File

@ -50,6 +50,8 @@
class RasterizerStorageGLES2; class RasterizerStorageGLES2;
class ShaderGLES2 { class ShaderGLES2 {
static String _mkid(const String &p_id);
protected: protected:
struct Enum { struct Enum {
uint64_t mask; uint64_t mask;

View File

@ -59,7 +59,7 @@
#include "scene/resources/texture.h" #include "scene/resources/texture.h"
// The metadata key used to store and retrieve the version text to copy to the clipboard. // The metadata key used to store and retrieve the version text to copy to the clipboard.
static const String META_TEXT_TO_COPY = "text_to_copy"; const String EditorAbout::META_TEXT_TO_COPY = "text_to_copy";
void EditorAbout::_notification(int p_what) { void EditorAbout::_notification(int p_what) {
switch (p_what) { switch (p_what) {

View File

@ -50,6 +50,8 @@ class EditorAbout : public AcceptDialog {
GDCLASS(EditorAbout, AcceptDialog); GDCLASS(EditorAbout, AcceptDialog);
private: private:
static const String META_TEXT_TO_COPY;
void _license_tree_selected(); void _license_tree_selected();
void _version_button_pressed(); void _version_button_pressed();
ScrollContainer *_populate_list(const String &p_name, const List<String> &p_sections, const char *const *const p_src[], const int p_flag_single_column = 0); ScrollContainer *_populate_list(const String &p_name, const List<String> &p_sections, const char *const *const p_src[], const int p_flag_single_column = 0);

View File

@ -1846,7 +1846,7 @@ EditorScriptTextEditor::~EditorScriptTextEditor() {
} }
} }
static EditorScriptEditorBase *create_editor(const RES &p_resource) { EditorScriptEditorBase *EditorScriptTextEditor::create_editor(const RES &p_resource) {
if (Object::cast_to<Script>(*p_resource)) { if (Object::cast_to<Script>(*p_resource)) {
return memnew(EditorScriptTextEditor); return memnew(EditorScriptTextEditor);
} }

View File

@ -153,6 +153,8 @@ class EditorScriptTextEditor : public EditorScriptEditorBase {
LOOKUP_SYMBOL, LOOKUP_SYMBOL,
}; };
static EditorScriptEditorBase *create_editor(const RES &p_resource);
void _enable_code_editor(); void _enable_code_editor();
protected: protected:

View File

@ -477,7 +477,7 @@ void EditorTextEditor::_bind_methods() {
ClassDB::bind_method("_prepare_edit_menu", &EditorTextEditor::_prepare_edit_menu); ClassDB::bind_method("_prepare_edit_menu", &EditorTextEditor::_prepare_edit_menu);
} }
static EditorScriptEditorBase *create_editor(const RES &p_resource) { EditorScriptEditorBase *EditorTextEditor::create_editor(const RES &p_resource) {
if (Object::cast_to<TextFile>(*p_resource)) { if (Object::cast_to<TextFile>(*p_resource)) {
return memnew(EditorTextEditor); return memnew(EditorTextEditor);
} }

View File

@ -119,6 +119,8 @@ private:
BOOKMARK_REMOVE_ALL, BOOKMARK_REMOVE_ALL,
}; };
static EditorScriptEditorBase *create_editor(const RES &p_resource);
protected: protected:
static void _bind_methods(); static void _bind_methods();

View File

@ -1330,3 +1330,5 @@ MainLoop *test() {
return nullptr; return nullptr;
} }
} // namespace TestString } // namespace TestString
#undef CHECK

View File

@ -301,3 +301,5 @@ MainLoop *test() {
return nullptr; return nullptr;
} }
} // namespace TestTheme } // namespace TestTheme
#undef CHECK

View File

@ -13,8 +13,23 @@ from SCons.Script import ARGUMENTS
from SCons.Script import Glob from SCons.Script import Glob
from SCons.Variables.BoolVariable import _text2bool from SCons.Variables.BoolVariable import _text2bool
from pathlib import Path
from os.path import normpath, basename
def add_source_files(self, sources, files): # Get the "Godot" folder name ahead of time
base_folder_path = str(os.path.abspath(Path(__file__).parent)) + "/"
base_folder_only = os.path.basename(os.path.normpath(base_folder_path))
# Listing all the folders we have converted
# for SCU in scu_builders.py
_scu_folders = set()
def set_scu_folders(scu_folders):
global _scu_folders
_scu_folders = scu_folders
def add_source_files_orig(self, sources, files, allow_gen=False):
# Convert string to list of absolute paths (including expanding wildcard) # Convert string to list of absolute paths (including expanding wildcard)
if isbasestring(files): if isbasestring(files):
# Keep SCons project-absolute path as they are (no wildcard support) # Keep SCons project-absolute path as they are (no wildcard support)
@ -29,7 +44,7 @@ def add_source_files(self, sources, files):
skip_gen_cpp = "*" in files skip_gen_cpp = "*" in files
dir_path = self.Dir(".").abspath dir_path = self.Dir(".").abspath
files = sorted(glob.glob(dir_path + "/" + files)) files = sorted(glob.glob(dir_path + "/" + files))
if skip_gen_cpp: if skip_gen_cpp and not allow_gen:
files = [f for f in files if not f.endswith(".gen.cpp")] files = [f for f in files if not f.endswith(".gen.cpp")]
# Add each path as compiled Object following environment (self) configuration # Add each path as compiled Object following environment (self) configuration
@ -40,6 +55,70 @@ def add_source_files(self, sources, files):
continue continue
sources.append(obj) sources.append(obj)
# The section name is used for checking
# the hash table to see whether the folder
# is included in the SCU build.
# It will be something like "core/math".
def _find_scu_section_name(subdir):
section_path = os.path.abspath(subdir) + "/"
folders = []
folder = ""
for i in range(8):
folder = os.path.dirname(section_path)
folder = os.path.basename(folder)
if folder == base_folder_only:
break
folders += [folder]
section_path += "../"
section_path = os.path.abspath(section_path) + "/"
section_name = ""
for n in range(len(folders)):
section_name += folders[len(folders) - n - 1]
if n != (len(folders) - 1):
section_name += "/"
return section_name
def add_source_files_scu(self, sources, files, allow_gen=False):
if self["scu_build"] and isinstance(files, str):
if "*." not in files:
return False
# If the files are in a subdirectory, we want to create the scu gen
# files inside this subdirectory.
subdir = os.path.dirname(files)
if subdir != "":
subdir += "/"
section_name = _find_scu_section_name(subdir)
# if the section name is in the hash table?
# i.e. is it part of the SCU build?
global _scu_folders
if section_name not in (_scu_folders):
return False
if self["verbose"]:
print("SCU building " + section_name)
# Add all the gen.cpp files in the SCU directory
add_source_files_orig(self, sources, subdir + ".scu/scu_*.gen.cpp", True)
return True
return False
# Either builds the folder using the SCU system,
# or reverts to regular build.
def add_source_files(self, sources, files, allow_gen=False):
if not add_source_files_scu(self, sources, files, allow_gen):
# Wraps the original function when scu build is not active.
add_source_files_orig(self, sources, files, allow_gen)
return False
return True
def disable_warnings(self): def disable_warnings(self):
# 'self' is the environment # 'self' is the environment

View File

@ -32,12 +32,6 @@
#include "label.h" #include "label.h"
#include "margin_container.h" #include "margin_container.h"
struct _MinSizeCache {
int min_size;
bool will_stretch;
int final_size;
};
void BoxContainer::_resort() { void BoxContainer::_resort() {
/** First pass, determine minimum size AND amount of stretchable elements */ /** First pass, determine minimum size AND amount of stretchable elements */

View File

@ -35,6 +35,12 @@
class BoxContainer : public Container { class BoxContainer : public Container {
GDCLASS(BoxContainer, Container); GDCLASS(BoxContainer, Container);
struct _MinSizeCache {
int min_size;
bool will_stretch;
int final_size;
};
public: public:
enum AlignMode { enum AlignMode {
ALIGN_BEGIN, ALIGN_BEGIN,

View File

@ -47,7 +47,7 @@
#include "editor/editor_settings.h" #include "editor/editor_settings.h"
#endif #endif
static bool _is_text_char(CharType c) { bool LineEdit::_is_text_char(CharType c) {
return !is_symbol(c); return !is_symbol(c);
} }

View File

@ -149,6 +149,7 @@ private:
void _text_changed(); void _text_changed();
void _emit_text_change(); void _emit_text_change();
bool expand_to_text_length; bool expand_to_text_length;
bool _is_text_char(CharType c);
void update_cached_width(); void update_cached_width();
void update_placeholder_width(); void update_placeholder_width();

578
scu_builders.py Normal file
View File

@ -0,0 +1,578 @@
"""Functions used to generate scu build source files during build time
"""
import glob, os
import math
from pathlib import Path
from os.path import normpath, basename
base_folder_path = str(Path(__file__).parent) + "/"
base_folder_only = os.path.basename(os.path.normpath(base_folder_path))
_verbose = False
_is_release_build = False
_scu_folders = set()
def clear_out_existing_files(output_folder, extension):
output_folder = os.path.abspath(output_folder)
# print("clear_out_existing_files from folder: " + output_folder)
if not os.path.isdir(output_folder):
# folder does not exist or has not been created yet,
# no files to clearout. (this is not an error)
return
os.chdir(output_folder)
for file in glob.glob("*." + extension):
# print("removed pre-existing file: " + file)
os.remove(file)
def folder_not_found(folder):
abs_folder = base_folder_path + folder + "/"
return not os.path.isdir(abs_folder)
def find_files_in_folder(folder, sub_folder, include_list, extension, sought_exceptions, found_exceptions):
abs_folder = base_folder_path + folder + "/" + sub_folder
if not os.path.isdir(abs_folder):
print("ERROR " + abs_folder + " not found.")
return include_list, found_exceptions
os.chdir(abs_folder)
sub_folder_slashed = ""
if sub_folder != "":
sub_folder_slashed = sub_folder + "/"
for file in glob.glob("*." + extension):
simple_name = Path(file).stem
if file.endswith(".gen.cpp"):
continue
li = '#include "' + folder + "/" + sub_folder_slashed + file + '"'
if not simple_name in sought_exceptions:
include_list.append(li)
else:
found_exceptions.append(li)
return include_list, found_exceptions
def write_output_file(file_count, include_list, start_line, end_line, output_folder, output_filename_prefix, extension):
output_folder = os.path.abspath(output_folder)
if not os.path.isdir(output_folder):
# create
os.mkdir(output_folder)
if not os.path.isdir(output_folder):
print("ERROR " + output_folder + " could not be created.")
return
print("CREATING folder " + output_folder)
file_text = ""
for l in range(start_line, end_line):
if l < len(include_list):
line = include_list[l]
li = line + "\n"
file_text += li
num_string = ""
if file_count > 0:
num_string = "_" + str(file_count)
short_filename = output_filename_prefix + num_string + ".gen." + extension
output_filename = output_folder + "/" + short_filename
if _verbose:
print("generating: " + short_filename)
output_path = Path(output_filename)
output_path.write_text(file_text, encoding="utf8")
def write_exception_output_file(file_count, exception_string, output_folder, output_filename_prefix, extension):
output_folder = os.path.abspath(output_folder)
if not os.path.isdir(output_folder):
print("ERROR " + output_folder + " does not exist.")
return
file_text = exception_string + "\n"
num_string = ""
if file_count > 0:
num_string = "_" + str(file_count)
short_filename = output_filename_prefix + "_exception" + num_string + ".gen." + extension
output_filename = output_folder + "/" + short_filename
if _verbose:
print("generating: " + short_filename)
output_path = Path(output_filename)
output_path.write_text(file_text, encoding="utf8")
def find_section_name(sub_folder):
# Construct a useful name for the section from the path for debug logging
section_path = os.path.abspath(base_folder_path + sub_folder) + "/"
folders = []
folder = ""
for i in range(8):
folder = os.path.dirname(section_path)
folder = os.path.basename(folder)
if folder == base_folder_only:
break
folders.append(folder)
section_path += "../"
section_path = os.path.abspath(section_path) + "/"
section_name = ""
for n in range(len(folders)):
section_name += folders[len(folders) - n - 1]
if n != (len(folders) - 1):
section_name += "_"
return section_name
# "folders" is a list of folders to add all the files from to add to the SCU
# "section (like a module)". The name of the scu file will be derived from the first folder
# (thus e.g. scene/3d becomes scu_scene_3d.gen.cpp)
# "includes_per_scu" limits the number of includes in a single scu file.
# This allows the module to be built in several translation units instead of just 1.
# This will usually be slower to compile but will use less memory per compiler instance, which
# is most relevant in release builds.
# "sought_exceptions" are a list of files (without extension) that contain
# e.g. naming conflicts, and are therefore not suitable for the scu build.
# These will automatically be placed in their own separate scu file,
# which is slow like a normal build, but prevents the naming conflicts.
# Ideally in these situations, the source code should be changed to prevent naming conflicts.
# "extension" will usually be cpp, but can also be set to c (for e.g. third party libraries that use c)
def process_folder(folders, sought_exceptions=[], includes_per_scu=0, extension="cpp"):
if len(folders) == 0:
return
# Construct the filename prefix from the FIRST folder name
# e.g. "scene_3d"
out_filename = find_section_name(folders[0])
found_includes = []
found_exceptions = []
main_folder = folders[0]
abs_main_folder = base_folder_path + main_folder
# Keep a record of all folders that have been processed for SCU,
# this enables deciding what to do when we call "add_source_files()"
global _scu_folders
_scu_folders.add(main_folder)
# main folder (first)
found_includes, found_exceptions = find_files_in_folder(
main_folder, "", found_includes, extension, sought_exceptions, found_exceptions
)
# sub folders
for d in range(1, len(folders)):
found_includes, found_exceptions = find_files_in_folder(
main_folder, folders[d], found_includes, extension, sought_exceptions, found_exceptions
)
found_includes = sorted(found_includes)
# calculate how many lines to write in each file
total_lines = len(found_includes)
# adjust number of output files according to whether DEV or release
num_output_files = 1
if _is_release_build:
# always have a maximum in release
includes_per_scu = 8
num_output_files = max(math.ceil(total_lines / includes_per_scu), 1)
else:
if includes_per_scu > 0:
num_output_files = max(math.ceil(total_lines / includes_per_scu), 1)
# error condition
if total_lines == 0:
return
lines_per_file = math.ceil(total_lines / num_output_files)
lines_per_file = max(lines_per_file, 1)
start_line = 0
file_number = 0
# These do not vary throughout the loop
output_folder = abs_main_folder + "/.scu/"
output_filename_prefix = "scu_" + out_filename
# Clear out any existing files (usually we will be overwriting,
# but we want to remove any that are pre-existing that will not be
# overwritten, so as to not compile anything stale)
clear_out_existing_files(output_folder, extension)
for file_count in range(0, num_output_files):
end_line = start_line + lines_per_file
# special case to cover rounding error in final file
if file_count == (num_output_files - 1):
end_line = len(found_includes)
write_output_file(
file_count, found_includes, start_line, end_line, output_folder, output_filename_prefix, extension
)
start_line = end_line
# Write the exceptions each in their own scu gen file,
# so they can effectively compile in "old style / normal build".
for exception_count in range(len(found_exceptions)):
write_exception_output_file(
exception_count, found_exceptions[exception_count], output_folder, output_filename_prefix, extension
)
def generate_scu_files(verbose, is_release_build):
print("=============================")
print("Single Compilation Unit Build")
print("=============================")
print("Generating SCU build files")
global _verbose
_verbose = verbose
global _is_release_build
_is_release_build = is_release_build
curr_folder = os.path.abspath("./")
# check we are running from the correct folder
if folder_not_found("core") or folder_not_found("platform") or folder_not_found("scene"):
raise RuntimeError("scu_builders.py must be run from the godot folder.")
return
process_folder(["core"])
process_folder(["core/bind"])
process_folder(["core/config"])
process_folder(["core/containers"])
process_folder(["core/error"])
process_folder(["core/input"])
process_folder(["core/log"])
process_folder(["core/math"])
process_folder(["core/object"])
process_folder(["core/os"])
process_folder(["core/string"])
process_folder(["core/variant"])
process_folder(["core/io"])
process_folder(["core/crypto"])
process_folder(["drivers/gles2"])
process_folder(["drivers/unix"])
process_folder(["drivers/png"])
process_folder(["editor"])
process_folder(["editor/import"])
process_folder(["editor/plugins"])
process_folder(["main"])
process_folder(["main/tests"])
process_folder(
[
"platform",
"android/export",
"iphone/export",
"javascript/export",
"osx/export",
#"uwp/export",
"windows/export",
"x11/export",
]
)
#TODO most of these should be merged per module
process_folder(["modules/broken_seals_module"])
process_folder(["modules/cscript"])
process_folder(["modules/csg"])
process_folder(["modules/database"])
process_folder(["modules/database_sqlite"])
process_folder(["modules/entity_spell_system"])
process_folder(["modules/entity_spell_system/data/atlases"])
process_folder(["modules/entity_spell_system/data/auras"])
process_folder(["modules/entity_spell_system/data/items"])
process_folder(["modules/entity_spell_system/data/loot"])
process_folder(["modules/entity_spell_system/data/species"])
process_folder(["modules/entity_spell_system/data/spells"])
process_folder(["modules/entity_spell_system/database"])
process_folder(["modules/entity_spell_system/drag_and_drop"])
process_folder(["modules/entity_spell_system/editor"])
process_folder(["modules/entity_spell_system/entities"])
process_folder(["modules/entity_spell_system/entities/ai"])
process_folder(["modules/entity_spell_system/entities/auras"])
process_folder(["modules/entity_spell_system/entities/data"])
process_folder(["modules/entity_spell_system/entities/resources"])
process_folder(["modules/entity_spell_system/entities/skills"])
process_folder(["modules/entity_spell_system/entities/stats"])
process_folder(["modules/entity_spell_system/formations"])
process_folder(["modules/entity_spell_system/infos"])
process_folder(["modules/entity_spell_system/inventory"])
process_folder(["modules/entity_spell_system/material_cache"])
process_folder(["modules/entity_spell_system/pipelines"])
process_folder(["modules/entity_spell_system/profiles"])
process_folder(["modules/entity_spell_system/profiles/actionbar"])
process_folder(["modules/entity_spell_system/profiles/input"])
process_folder(["modules/entity_spell_system/projectiles/3d"])
process_folder(["modules/entity_spell_system/props"])
process_folder(["modules/entity_spell_system/singletons"])
process_folder(["modules/entity_spell_system/skeleton"])
process_folder(["modules/entity_spell_system/spawners"])
process_folder(["modules/entity_spell_system/utility"])
process_folder(["modules/fastnoise"])
process_folder(["modules/gdnative"])
process_folder(["modules/gdnative/gdnative"])
process_folder(["modules/gdnative/nativescript"])
#process_folder(["modules/gdnative/arvr"])
process_folder(["modules/gdnative/pluginscript"])
process_folder(["modules/gdnative/net"])
process_folder(["modules/gdscript"])
#process_folder(["modules/gdscript/language_server"])
process_folder(["modules/gridmap"])
process_folder(["modules/gridmap/geometry_parser"])
process_folder(["modules/http_server_simple"])
process_folder(["modules/lz4"])
process_folder(["modules/material_maker"])
process_folder(["modules/material_maker/algos"])
process_folder(["modules/material_maker/editor"])
process_folder(["modules/material_maker/editor/widgets/color_picker_popup"])
process_folder(["modules/material_maker/editor/widgets/curve_edit"])
process_folder(["modules/material_maker/editor/widgets/file_dialog"])
process_folder(["modules/material_maker/editor/widgets/float_edit"])
process_folder(["modules/material_maker/editor/widgets/gradient_editor"])
process_folder(["modules/material_maker/editor/widgets/image_picker_button"])
process_folder(["modules/material_maker/editor/widgets/mm_dnd_color_picker_button"])
process_folder(["modules/material_maker/editor/widgets/polygon_edit"])
process_folder(["modules/material_maker/editor/widgets/tones_editor"])
process_folder(["modules/material_maker/nodes"])
process_folder(["modules/material_maker/nodes/bases"])
process_folder(["modules/material_maker/nodes/filter"])
process_folder(["modules/material_maker/nodes/gradient"])
process_folder(["modules/material_maker/nodes/noise"])
process_folder(["modules/material_maker/nodes/other"])
process_folder(["modules/material_maker/nodes/pattern"])
process_folder(["modules/material_maker/nodes/sdf2d"])
process_folder(["modules/material_maker/nodes/sdf3d"])
process_folder(["modules/material_maker/nodes/simple"])
process_folder(["modules/material_maker/nodes/transform"])
process_folder(["modules/material_maker/nodes/uniform"])
process_folder(["modules/mbedtls"])
process_folder(["modules/mesh_data_resource"])
process_folder(["modules/mesh_data_resource/editor"])
process_folder(["modules/mesh_data_resource/editor/utilities"])
process_folder(["modules/mesh_data_resource/editor/uv_editor"])
process_folder(["modules/mesh_data_resource/nodes"])
process_folder(["modules/mesh_data_resource/plugin"])
process_folder(["modules/mesh_data_resource/plugin_gltf"])
process_folder(["modules/mesh_data_resource/props"])
process_folder(["modules/mesh_data_resource/props_2d"])
process_folder(["modules/mesh_utils"])
process_folder(["modules/navigation"])
process_folder(["modules/navigation_dummy"])
process_folder(["modules/navigation_geometry_parsers"])
process_folder(["modules/navigation_geometry_parsers/geometry_parser_2d"])
process_folder(["modules/navigation_geometry_parsers/geometry_parser_3d"])
process_folder(["modules/navigation_mesh_generator"])
process_folder(["modules/navigation_mesh_generator/editor"])
process_folder(["modules/network_synchronizer"])
process_folder(["modules/paint"])
process_folder(["modules/paint/actions"])
process_folder(["modules/paint/editor"])
process_folder(["modules/paint/nodes"])
process_folder(["modules/paint/ui"])
process_folder(["modules/paint/ui/property_inspectors"])
process_folder(["modules/props"])
process_folder(["modules/props/clutter"])
process_folder(["modules/props/editor"])
process_folder(["modules/props/jobs"])
process_folder(["modules/props/lights"])
process_folder(["modules/props/material_cache"])
process_folder(["modules/props/props"])
process_folder(["modules/props/singleton"])
process_folder(["modules/props/tiled_wall"])
process_folder(["modules/props_2d"])
process_folder(["modules/props_2d/clutter"])
process_folder(["modules/props_2d/editor"])
process_folder(["modules/props_2d/jobs"])
process_folder(["modules/props_2d/lights"])
process_folder(["modules/props_2d/material_cache"])
process_folder(["modules/props_2d/props"])
process_folder(["modules/props_2d/singleton"])
process_folder(["modules/props_2d/tiled_wall"])
process_folder(["modules/skeleton_2d"])
process_folder(["modules/skeleton_2d/editor"])
process_folder(["modules/skeleton_2d/nodes"])
process_folder(["modules/skeleton_2d/resources"])
process_folder(["modules/skeleton_3d"])
process_folder(["modules/skeleton_3d/editor"])
process_folder(["modules/skeleton_3d/nodes"])
process_folder(["modules/skeleton_3d/resources"])
process_folder(["modules/steering_ai"])
process_folder(["modules/steering_ai/agents"])
process_folder(["modules/steering_ai/behaviors"])
process_folder(["modules/steering_ai/proximities"])
process_folder(["modules/terraman"])
process_folder(["modules/terraman/areas"])
process_folder(["modules/terraman/data"])
process_folder(["modules/terraman/level_generator"])
process_folder(["modules/terraman/library"])
process_folder(["modules/terraman/meshers"])
process_folder(["modules/terraman/meshers/blocky"])
process_folder(["modules/terraman/meshers/default"])
process_folder(["modules/terraman/nodes"])
process_folder(["modules/terraman/world"])
process_folder(["modules/terraman/world/blocky"])
process_folder(["modules/terraman/world/default"])
process_folder(["modules/terraman/world/jobs"])
process_folder(["modules/terraman_2d"])
process_folder(["modules/terraman_2d/areas"])
process_folder(["modules/terraman_2d/data"])
process_folder(["modules/terraman_2d/level_generator"])
process_folder(["modules/terraman_2d/library"])
process_folder(["modules/terraman_2d/meshers"])
process_folder(["modules/terraman_2d/meshers/default"])
process_folder(["modules/terraman_2d/meshers/isometric"])
process_folder(["modules/terraman_2d/meshers/simple"])
process_folder(["modules/terraman_2d/nodes"])
process_folder(["modules/terraman_2d/world"])
process_folder(["modules/terraman_2d/world/default"])
process_folder(["modules/terraman_2d/world/isometric"])
process_folder(["modules/terraman_2d/world/jobs"])
process_folder(["modules/terraman_2d/world/simple"])
process_folder(["modules/texture_packer"])
process_folder(["modules/texture_packer/layers"])
process_folder(["modules/texture_packer/rectpack2D"])
process_folder(["modules/texture_packer/texture_resource"])
process_folder(["modules/tile_map"])
process_folder(["modules/tile_map/geometry_parser"])
process_folder(["modules/ui_extensions"])
process_folder(["modules/unit_test"])
process_folder(["modules/users"])
process_folder(["modules/users/managers"])
process_folder(["modules/users/singleton"])
process_folder(["modules/users/users"])
process_folder(["modules/users/web/middleware"])
process_folder(["modules/users/web/web_nodes"])
process_folder(["modules/voxelman"])
process_folder(["modules/voxelman/areas"])
process_folder(["modules/voxelman/data"])
process_folder(["modules/voxelman/level_generator"])
process_folder(["modules/voxelman/library"])
process_folder(["modules/voxelman/meshers"])
process_folder(["modules/voxelman/meshers/blocky"])
process_folder(["modules/voxelman/meshers/cubic"])
process_folder(["modules/voxelman/meshers/default"])
process_folder(["modules/voxelman/meshers/marching_cubes"])
process_folder(["modules/voxelman/nodes"])
process_folder(["modules/voxelman/world"])
process_folder(["modules/voxelman/world/blocky"])
process_folder(["modules/voxelman/world/cubic"])
process_folder(["modules/voxelman/world/default"])
process_folder(["modules/voxelman/world/jobs"])
process_folder(["modules/voxelman/world/marching_cubes"])
process_folder(["modules/web"])
process_folder(["modules/web/database"])
process_folder(["modules/web/editor"])
process_folder(["modules/web/html"])
process_folder(["modules/web/http"])
process_folder(["modules/web/nodes/admin_panel"])
process_folder(["modules/web/nodes/folder_serve_nodes"])
process_folder(["modules/web/nodes/list_page"])
process_folder(["modules/web/nodes/message_page"])
process_folder(["modules/web/nodes/paged_article"])
process_folder(["modules/web/nodes/redirect"])
process_folder(["modules/web/nodes/static_pages"])
process_folder(["modules/websocket"])
process_folder(["modules/wfc"])
#Editor Modules
process_folder(["editor_modules/editor_code_editor"])
process_folder(["editor_modules/gltf"])
process_folder(["editor_modules/gltf/structures"])
process_folder(["editor_modules/gltf/extensions"])
process_folder(["editor_modules/gltf/extensions/physics"])
process_folder(["editor_modules/plugin_refresher"])
process_folder(["editor_modules/shader_editor"])
process_folder(["editor_modules/text_editor"])
#process_folder(["modules/fbx"])
#process_folder(["modules/fbx/tools"])
#process_folder(["modules/fbx/data"])
#process_folder(["modules/fbx/fbx_parser"])
process_folder(["scene"])
process_folder(["scene/audio"])
process_folder(["scene/debugger"])
process_folder(["scene/2d"])
process_folder(["scene/3d"])
process_folder(["scene/animation"])
process_folder(["scene/gui"])
process_folder(["scene/main"])
process_folder(["scene/resources"])
process_folder(["servers"])
process_folder(["servers/rendering"])
process_folder(["servers/rendering/portals"])
process_folder(["servers/physics_2d"])
process_folder(["servers/physics"])
process_folder(["servers/physics/joints"])
process_folder(["servers/audio"])
process_folder(["servers/audio/effects"])
# Finally change back the path to the calling folder
os.chdir(curr_folder)
return _scu_folders

View File

@ -49,7 +49,7 @@ subject to the following restrictions:
#include "hinge_joint_sw.h" #include "hinge_joint_sw.h"
static void plane_space(const Vector3 &n, Vector3 &p, Vector3 &q) { void HingeJointSW::plane_space(const Vector3 &n, Vector3 &p, Vector3 &q) {
if (Math::abs(n.z) > Math_SQRT12) { if (Math::abs(n.z) > Math_SQRT12) {
// choose p in y-z plane // choose p in y-z plane
real_t a = n[1] * n[1] + n[2] * n[2]; real_t a = n[1] * n[1] + n[2] * n[2];
@ -382,7 +382,7 @@ void HingeJointSW::updateRHS(real_t timeStep)
} }
*/ */
static _FORCE_INLINE_ real_t atan2fast(real_t y, real_t x) { real_t HingeJointSW::atan2fast(real_t y, real_t x) {
real_t coeff_1 = Math_PI / 4.0f; real_t coeff_1 = Math_PI / 4.0f;
real_t coeff_2 = 3.0f * coeff_1; real_t coeff_2 = 3.0f * coeff_1;
real_t abs_y = Math::abs(y); real_t abs_y = Math::abs(y);

View File

@ -94,6 +94,9 @@ class HingeJointSW : public JointSW {
real_t m_appliedImpulse; real_t m_appliedImpulse;
void plane_space(const Vector3 &n, Vector3 &p, Vector3 &q);
_FORCE_INLINE_ real_t atan2fast(real_t y, real_t x);
public: public:
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_HINGE; } virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_HINGE; }

View File

@ -57,7 +57,7 @@ April 04, 2008
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static _FORCE_INLINE_ real_t atan2fast(real_t y, real_t x) { real_t SliderJointSW::atan2fast(real_t y, real_t x) {
real_t coeff_1 = Math_PI / 4.0f; real_t coeff_1 = Math_PI / 4.0f;
real_t coeff_2 = 3.0f * coeff_1; real_t coeff_2 = 3.0f * coeff_1;
real_t abs_y = Math::abs(y); real_t abs_y = Math::abs(y);

View File

@ -149,6 +149,9 @@ protected:
//------------------------ //------------------------
void initParams(); void initParams();
private:
_FORCE_INLINE_ real_t atan2fast(real_t y, real_t x);
public: public:
// constructors // constructors
SliderJointSW(BodySW *rbA, BodySW *rbB, const Transform &frameInA, const Transform &frameInB); SliderJointSW(BodySW *rbA, BodySW *rbB, const Transform &frameInA, const Transform &frameInB);