diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/bullet/rigid_body_bullet.h | 2 | ||||
-rw-r--r-- | modules/bullet/space_bullet.h | 2 | ||||
-rw-r--r-- | modules/freetype/SCsub | 51 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.h | 1 | ||||
-rw-r--r-- | modules/mobile_vr/SCsub | 2 | ||||
-rw-r--r-- | modules/mobile_vr/mobile_vr_interface.cpp | 92 | ||||
-rw-r--r-- | modules/mobile_vr/mobile_vr_interface.h | 12 | ||||
-rw-r--r-- | modules/mobile_vr/shaders/SCsub | 6 | ||||
-rw-r--r-- | modules/mobile_vr/shaders/lens_distorted.glsl | 62 | ||||
-rw-r--r-- | modules/svg/SCsub | 10 |
11 files changed, 47 insertions, 195 deletions
diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h index cd2f215906..25dac30951 100644 --- a/modules/bullet/rigid_body_bullet.h +++ b/modules/bullet/rigid_body_bullet.h @@ -227,7 +227,7 @@ public: void init_kinematic_utilities(); void destroy_kinematic_utilities(); - _FORCE_INLINE_ class KinematicUtilities *get_kinematic_utilities() const { return kinematic_utilities; } + _FORCE_INLINE_ KinematicUtilities *get_kinematic_utilities() const { return kinematic_utilities; } _FORCE_INLINE_ btRigidBody *get_bt_rigid_body() { return btBody; } diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h index d815898ffd..c3d55cbbb1 100644 --- a/modules/bullet/space_bullet.h +++ b/modules/bullet/space_bullet.h @@ -57,7 +57,7 @@ class btDiscreteDynamicsWorld; class btEmptyShape; class btGhostPairCallback; class btSoftRigidDynamicsWorld; -class btSoftBodyWorldInfo; +struct btSoftBodyWorldInfo; class ConstraintBullet; class CollisionObjectBullet; class RigidBodyBullet; diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub index d2f0ad042a..7ca40c1b8b 100644 --- a/modules/freetype/SCsub +++ b/modules/freetype/SCsub @@ -1,9 +1,11 @@ #!/usr/bin/env python Import('env') +Import('env_modules') + from compat import isbasestring -# Not building in a separate env as scene needs it +env_freetype = env_modules.Clone() # Thirdparty source files if env['builtin_freetype']: @@ -54,28 +56,33 @@ if env['builtin_freetype']: ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - sfnt = thirdparty_dir + 'src/sfnt/sfnt.c' - - if 'platform' in env: - if env['platform'] == 'uwp': - # Include header for UWP to fix build issues - env.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"']) - elif env['platform'] == 'javascript': - # Forcibly undefine this macro so SIMD is not used in this file, - # since currently unsupported in WASM - sfnt = env.Object(sfnt, CPPFLAGS=['-U__OPTIMIZE__']) + if env['platform'] == 'uwp': + # Include header for UWP to fix build issues + env_freetype.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"']) + sfnt = thirdparty_dir + 'src/sfnt/sfnt.c' + if env['platform'] == 'javascript': + # Forcibly undefine this macro so SIMD is not used in this file, + # since currently unsupported in WASM + sfnt = env_freetype.Object(sfnt, CPPFLAGS=['-U__OPTIMIZE__']) thirdparty_sources += [sfnt] - env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"]) + env_freetype.Append(CPPPATH=[thirdparty_dir + "/include"]) + # Also needed in main env for scene/ + env.Append(CPPPATH=[thirdparty_dir + "/include"]) - # also requires libpng headers + env_freetype.Append(CCFLAGS=['-DFT2_BUILD_LIBRARY', '-DFT_CONFIG_OPTION_USE_PNG']) + if (env['target'] != 'release'): + env_freetype.Append(CCFLAGS=['-DZLIB_DEBUG']) + + # Also requires libpng headers if env['builtin_libpng']: - env.Append(CPPPATH=["#thirdparty/libpng"]) + env_freetype.Append(CPPPATH=["#thirdparty/libpng"]) + + env_thirdparty = env_freetype.Clone() + env_thirdparty.disable_warnings() + lib = env_thirdparty.add_library("freetype_builtin", thirdparty_sources) - # FIXME: Find a way to build this in a separate env nevertheless - # so that we can disable warnings on thirdparty code - lib = env.add_library("freetype_builtin", thirdparty_sources) # Needs to be appended to arrive after libscene in the linker call, # but we don't want it to arrive *after* system libs, so manual hack # LIBS contains first SCons Library objects ("SCons.Node.FS.File object") @@ -88,12 +95,8 @@ if env['builtin_freetype']: break if not inserted: env.Append(LIBS=[lib]) - env.Append(CCFLAGS=['-DFT2_BUILD_LIBRARY']) - if (env['target'] != 'release'): - env.Append(CCFLAGS=['-DZLIB_DEBUG']) # Godot source files -env.add_source_files(env.modules_sources, "*.cpp") -env.Append(CCFLAGS=['-DFREETYPE_ENABLED', '-DFT_CONFIG_OPTION_USE_PNG']) - -Export('env') +env_freetype.add_source_files(env.modules_sources, "*.cpp") +# Used in scene/, needs to be in main env +env.Append(CCFLAGS=['-DFREETYPE_ENABLED']) diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 5facfe7869..2fa5084d84 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -7835,7 +7835,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) { // Figure out function name for warning String func_name = _find_function_name(op); if (func_name.empty()) { - func_name == "<undetected name>"; + func_name = "<undetected name>"; } _add_warning(GDScriptWarning::RETURN_VALUE_DISCARDED, op->line, func_name); } diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h index c7813a2144..8121fb7f85 100644 --- a/modules/gdscript/gdscript_parser.h +++ b/modules/gdscript/gdscript_parser.h @@ -555,7 +555,6 @@ private: CompletionType completion_type; StringName completion_cursor; - bool completion_static; Variant::Type completion_built_in_constant; Node *completion_node; ClassNode *completion_class; diff --git a/modules/mobile_vr/SCsub b/modules/mobile_vr/SCsub index e5725ceb6f..4bd184f025 100644 --- a/modules/mobile_vr/SCsub +++ b/modules/mobile_vr/SCsub @@ -6,5 +6,3 @@ Import('env_modules') env_mobile_vr = env_modules.Clone() env_mobile_vr.add_source_files(env.modules_sources, '*.cpp') - -SConscript("shaders/SCsub") diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp index 2cabc7bd59..b9a404709e 100644 --- a/modules/mobile_vr/mobile_vr_interface.cpp +++ b/modules/mobile_vr/mobile_vr_interface.cpp @@ -297,49 +297,6 @@ bool MobileVRInterface::initialize() { mag_current_min = Vector3(0, 0, 0); mag_current_max = Vector3(0, 0, 0); -#if !defined(SERVER_ENABLED) - // build our shader - if (lens_shader == NULL) { - ///@TODO need to switch between GLES2 and GLES3 version, Reduz suggested moving this into our drivers and making this a core shader - // create a shader - lens_shader = new LensDistortedShaderGLES3(); - - // create our shader stuff - lens_shader->init(); - - glGenBuffers(1, &half_screen_quad); - glBindBuffer(GL_ARRAY_BUFFER, half_screen_quad); - { - /* clang-format off */ - const float qv[16] = { - 0, -1, - -1, -1, - 0, 1, - -1, 1, - 1, 1, - 1, 1, - 1, -1, - 1, -1, - }; - /* clang-format on */ - - glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 16, qv, GL_STATIC_DRAW); - } - - glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind - - glGenVertexArrays(1, &half_screen_array); - glBindVertexArray(half_screen_array); - glBindBuffer(GL_ARRAY_BUFFER, half_screen_quad); - glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, 0); - glEnableVertexAttribArray(0); - glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, ((uint8_t *)NULL) + 8); - glEnableVertexAttribArray(4); - glBindVertexArray(0); - glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind - } -#endif - // reset our orientation orientation = Basis(); @@ -362,17 +319,6 @@ void MobileVRInterface::uninitialize() { arvr_server->clear_primary_interface_if(this); } -#if !defined(SERVER_ENABLED) - // cleanup our shader and buffers - if (lens_shader != NULL) { - glDeleteVertexArrays(1, &half_screen_array); - glDeleteBuffers(1, &half_screen_quad); - - delete lens_shader; - lens_shader = NULL; - } -#endif - initialized = false; }; }; @@ -448,48 +394,30 @@ void MobileVRInterface::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_t // We must have a valid render target ERR_FAIL_COND(!p_render_target.is_valid()); - // We must have an initialised shader - ERR_FAIL_COND(lens_shader != NULL); - // Because we are rendering to our device we must use our main viewport! ERR_FAIL_COND(p_screen_rect == Rect2()); - float offset_x = 0.0; + Rect2 dest = p_screen_rect; float aspect_ratio = 0.5 * p_screen_rect.size.x / p_screen_rect.size.y; Vector2 eye_center; + // we output half a screen + dest.size.x *= 0.5; + if (p_eye == ARVRInterface::EYE_LEFT) { - offset_x = -1.0; eye_center.x = ((-intraocular_dist / 2.0) + (display_width / 4.0)) / (display_width / 2.0); } else if (p_eye == ARVRInterface::EYE_RIGHT) { + dest.position.x = dest.size.x; eye_center.x = ((intraocular_dist / 2.0) - (display_width / 4.0)) / (display_width / 2.0); } + // we don't offset the eye center vertically (yet) + eye_center.y = 0.0; // unset our render target so we are outputting to our main screen by making RasterizerStorageGLES3::system_fbo our current FBO VSG::rasterizer->set_current_render_target(RID()); - // now output to screen - // VSG::rasterizer->blit_render_target_to_screen(p_render_target, screen_rect, 0); - - // get our render target - RID eye_texture = VSG::storage->render_target_get_texture(p_render_target); - uint32_t texid = VS::get_singleton()->texture_get_texid(eye_texture); -#if !defined(SERVER_ENABLED) - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, texid); - - lens_shader->bind(); - lens_shader->set_uniform(LensDistortedShaderGLES3::OFFSET_X, offset_x); - lens_shader->set_uniform(LensDistortedShaderGLES3::K1, k1); - lens_shader->set_uniform(LensDistortedShaderGLES3::K2, k2); - lens_shader->set_uniform(LensDistortedShaderGLES3::EYE_CENTER, eye_center); - lens_shader->set_uniform(LensDistortedShaderGLES3::UPSCALE, oversample); - lens_shader->set_uniform(LensDistortedShaderGLES3::ASPECT_RATIO, aspect_ratio); - - glBindVertexArray(half_screen_array); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glBindVertexArray(0); -#endif + // and output + VSG::rasterizer->output_lens_distorted_to_screen(p_render_target, dest, k1, k2, eye_center, oversample); }; void MobileVRInterface::process() { @@ -512,8 +440,6 @@ MobileVRInterface::MobileVRInterface() { k1 = 0.215; k2 = 0.215; last_ticks = 0; - - lens_shader = NULL; }; MobileVRInterface::~MobileVRInterface() { diff --git a/modules/mobile_vr/mobile_vr_interface.h b/modules/mobile_vr/mobile_vr_interface.h index 63cad4c738..05b6331f94 100644 --- a/modules/mobile_vr/mobile_vr_interface.h +++ b/modules/mobile_vr/mobile_vr_interface.h @@ -34,10 +34,6 @@ #include "servers/arvr/arvr_interface.h" #include "servers/arvr/arvr_positional_tracker.h" -#if !defined(SERVER_ENABLED) -#include "shaders/lens_distorted.glsl.gen.h" -#endif - /** @author Bastiaan Olij <mux213@gmail.com> @@ -60,14 +56,6 @@ private: float eye_height; uint64_t last_ticks; -#if !defined(SERVER_ENABLED) - LensDistortedShaderGLES3 *lens_shader; - GLuint half_screen_quad; - GLuint half_screen_array; -#else - void *lens_shader; -#endif - real_t intraocular_dist; real_t display_width; real_t display_to_lens; diff --git a/modules/mobile_vr/shaders/SCsub b/modules/mobile_vr/shaders/SCsub deleted file mode 100644 index 97a3598598..0000000000 --- a/modules/mobile_vr/shaders/SCsub +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python - -Import('env') - -if 'GLES3_GLSL' in env['BUILDERS']: - env.GLES3_GLSL('lens_distorted.glsl'); diff --git a/modules/mobile_vr/shaders/lens_distorted.glsl b/modules/mobile_vr/shaders/lens_distorted.glsl deleted file mode 100644 index 92604c891c..0000000000 --- a/modules/mobile_vr/shaders/lens_distorted.glsl +++ /dev/null @@ -1,62 +0,0 @@ -/* clang-format off */ -[vertex] - -layout(location = 0) in highp vec4 vertex_attrib; -/* clang-format on */ -layout(location = 4) in vec2 uv_in; - -uniform float offset_x; - -out vec2 uv_interp; - -void main() { - - uv_interp = uv_in; - gl_Position = vec4(vertex_attrib.x + offset_x, vertex_attrib.y, 0.0, 1.0); -} - -/* clang-format off */ -[fragment] - -uniform sampler2D source; //texunit:0 -/* clang-format on */ - -uniform vec2 eye_center; -uniform float k1; -uniform float k2; -uniform float upscale; -uniform float aspect_ratio; - -in vec2 uv_interp; - -layout(location = 0) out vec4 frag_color; - -void main() { - vec2 coords = uv_interp; - vec2 offset = coords - eye_center; - - // take aspect ratio into account - offset.y /= aspect_ratio; - - // distort - vec2 offset_sq = offset * offset; - float radius_sq = offset_sq.x + offset_sq.y; - float radius_s4 = radius_sq * radius_sq; - float distortion_scale = 1.0 + (k1 * radius_sq) + (k2 * radius_s4); - offset *= distortion_scale; - - // reapply aspect ratio - offset.y *= aspect_ratio; - - // add our eye center back in - coords = offset + eye_center; - coords /= upscale; - - // and check our color - if (coords.x < -1.0 || coords.y < -1.0 || coords.x > 1.0 || coords.y > 1.0) { - frag_color = vec4(0.0, 0.0, 0.0, 1.0); - } else { - coords = (coords + vec2(1.0)) / vec2(2.0); - frag_color = textureLod(source, coords, 0.0); - } -} diff --git a/modules/svg/SCsub b/modules/svg/SCsub index d14191056f..22f0b1e3eb 100644 --- a/modules/svg/SCsub +++ b/modules/svg/SCsub @@ -1,6 +1,9 @@ #!/usr/bin/env python Import('env') +Import('env_modules') + +env_svg = env_modules.Clone() # Thirdparty source files thirdparty_dir = "#thirdparty/nanosvg/" @@ -9,12 +12,15 @@ thirdparty_sources = [ ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] +env_svg.Append(CPPPATH=[thirdparty_dir]) +# FIXME: Needed in editor/editor_themes.cpp for now, but ideally there +# shouldn't be a dependency on modules/ and its own 3rd party deps. env.Append(CPPPATH=[thirdparty_dir]) env.Append(CCFLAGS=["-DSVG_ENABLED"]) -env_thirdparty = env.Clone() +env_thirdparty = env_svg.Clone() env_thirdparty.disable_warnings() env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources) # Godot's own source files -env.add_source_files(env.modules_sources, "*.cpp") +env_svg.add_source_files(env.modules_sources, "*.cpp") |