summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/color.cpp107
-rw-r--r--core/color.h12
-rw-r--r--editor/plugins/baked_lightmap_editor_plugin.cpp2
-rw-r--r--editor/plugins/gi_probe_editor_plugin.cpp2
-rw-r--r--editor/progress_dialog.cpp2
-rw-r--r--platform/javascript/export/export.cpp4
-rw-r--r--platform/javascript/os_javascript.cpp27
-rw-r--r--platform/javascript/os_javascript.h3
8 files changed, 83 insertions, 76 deletions
diff --git a/core/color.cpp b/core/color.cpp
index 36afe5e004..b708f15d69 100644
--- a/core/color.cpp
+++ b/core/color.cpp
@@ -413,96 +413,95 @@ Color::operator String() const {
Color Color::operator+(const Color &p_color) const {
return Color(
- CLAMP(r + p_color.r, 0.0, 1.0),
- CLAMP(g + p_color.g, 0.0, 1.0),
- CLAMP(b + p_color.b, 0.0, 1.0),
- CLAMP(a + p_color.a, 0.0, 1.0));
+ r + p_color.r,
+ g + p_color.g,
+ b + p_color.b,
+ a + p_color.a);
}
void Color::operator+=(const Color &p_color) {
- r = CLAMP(r + p_color.r, 0.0, 1.0);
- g = CLAMP(g + p_color.g, 0.0, 1.0);
- b = CLAMP(b + p_color.b, 0.0, 1.0);
- a = CLAMP(a + p_color.a, 0.0, 1.0);
+ r = r + p_color.r;
+ g = g + p_color.g;
+ b = b + p_color.b;
+ a = a + p_color.a;
}
Color Color::operator-(const Color &p_color) const {
return Color(
- CLAMP(r - p_color.r, 0.0, 1.0),
- CLAMP(g - p_color.g, 0.0, 1.0),
- CLAMP(b - p_color.b, 0.0, 1.0),
- CLAMP(a - p_color.a, 0.0, 1.0));
+ r - p_color.r,
+ g - p_color.g,
+ b - p_color.b,
+ a - p_color.a);
}
void Color::operator-=(const Color &p_color) {
- r = CLAMP(r - p_color.r, 0.0, 1.0);
- g = CLAMP(g - p_color.g, 0.0, 1.0);
- b = CLAMP(b - p_color.b, 0.0, 1.0);
- a = CLAMP(a - p_color.a, 0.0, 1.0);
+ r = r - p_color.r;
+ g = g - p_color.g;
+ b = b - p_color.b;
+ a = a - p_color.a;
}
Color Color::operator*(const Color &p_color) const {
return Color(
- CLAMP(r * p_color.r, 0.0, 1.0),
- CLAMP(g * p_color.g, 0.0, 1.0),
- CLAMP(b * p_color.b, 0.0, 1.0),
- CLAMP(a * p_color.a, 0.0, 1.0));
+ r * p_color.r,
+ g * p_color.g,
+ b * p_color.b,
+ a * p_color.a);
}
Color Color::operator*(const real_t &rvalue) const {
return Color(
- CLAMP(r * rvalue, 0.0, 1.0),
- CLAMP(g * rvalue, 0.0, 1.0),
- CLAMP(b * rvalue, 0.0, 1.0),
- CLAMP(a * rvalue, 0.0, 1.0));
+ r * rvalue,
+ g * rvalue,
+ b * rvalue,
+ a * rvalue);
}
void Color::operator*=(const Color &p_color) {
- r = CLAMP(r * p_color.r, 0.0, 1.0);
- g = CLAMP(g * p_color.g, 0.0, 1.0);
- b = CLAMP(b * p_color.b, 0.0, 1.0);
- a = CLAMP(a * p_color.a, 0.0, 1.0);
+ r = r * p_color.r;
+ g = g * p_color.g;
+ b = b * p_color.b;
+ a = a * p_color.a;
}
void Color::operator*=(const real_t &rvalue) {
- r = CLAMP(r * rvalue, 0.0, 1.0);
- g = CLAMP(g * rvalue, 0.0, 1.0);
- b = CLAMP(b * rvalue, 0.0, 1.0);
- a = CLAMP(a * rvalue, 0.0, 1.0);
-};
+ r = r * rvalue;
+ g = g * rvalue;
+ b = b * rvalue;
+ a = a * rvalue;
+}
Color Color::operator/(const Color &p_color) const {
return Color(
- p_color.r == 0 ? 1 : CLAMP(r / p_color.r, 0.0, 1.0),
- p_color.g == 0 ? 1 : CLAMP(g / p_color.g, 0.0, 1.0),
- p_color.b == 0 ? 1 : CLAMP(b / p_color.b, 0.0, 1.0),
- p_color.a == 0 ? 1 : CLAMP(a / p_color.a, 0.0, 1.0));
+ r / p_color.r,
+ g / p_color.g,
+ b / p_color.b,
+ a / p_color.a);
}
Color Color::operator/(const real_t &rvalue) const {
- if (rvalue == 0) return Color(1.0, 1.0, 1.0, 1.0);
return Color(
- CLAMP(r / rvalue, 0.0, 1.0),
- CLAMP(g / rvalue, 0.0, 1.0),
- CLAMP(b / rvalue, 0.0, 1.0),
- CLAMP(a / rvalue, 0.0, 1.0));
+ r / rvalue,
+ g / rvalue,
+ b / rvalue,
+ a / rvalue);
}
void Color::operator/=(const Color &p_color) {
- r = p_color.r == 0 ? 1 : CLAMP(r / p_color.r, 0.0, 1.0);
- g = p_color.g == 0 ? 1 : CLAMP(g / p_color.g, 0.0, 1.0);
- b = p_color.b == 0 ? 1 : CLAMP(b / p_color.b, 0.0, 1.0);
- a = p_color.a == 0 ? 1 : CLAMP(a / p_color.a, 0.0, 1.0);
+ r = r / p_color.r;
+ g = g / p_color.g;
+ b = b / p_color.b;
+ a = a / p_color.a;
}
void Color::operator/=(const real_t &rvalue) {
@@ -513,18 +512,18 @@ void Color::operator/=(const real_t &rvalue) {
b = 1.0;
a = 1.0;
} else {
- r = CLAMP(r / rvalue, 0.0, 1.0);
- g = CLAMP(g / rvalue, 0.0, 1.0);
- b = CLAMP(b / rvalue, 0.0, 1.0);
- a = CLAMP(a / rvalue, 0.0, 1.0);
+ r = r / rvalue;
+ g = g / rvalue;
+ b = b / rvalue;
+ a = a / rvalue;
}
};
Color Color::operator-() const {
return Color(
- CLAMP(1.0 - r, 0.0, 1.0),
- CLAMP(1.0 - g, 0.0, 1.0),
- CLAMP(1.0 - b, 0.0, 1.0),
- CLAMP(1.0 - a, 0.0, 1.0));
+ 1.0 - r,
+ 1.0 - g,
+ 1.0 - b,
+ 1.0 - a);
}
diff --git a/core/color.h b/core/color.h
index 0ff4fe6edd..9af8fb0a78 100644
--- a/core/color.h
+++ b/core/color.h
@@ -105,18 +105,18 @@ struct Color {
_FORCE_INLINE_ Color darkened(float p_amount) const {
Color res = *this;
- res.r = CLAMP(res.r * (1.0f - p_amount), 0.0, 1.0);
- res.g = CLAMP(res.g * (1.0f - p_amount), 0.0, 1.0);
- res.b = CLAMP(res.b * (1.0f - p_amount), 0.0, 1.0);
+ res.r = res.r * (1.0f - p_amount);
+ res.g = res.g * (1.0f - p_amount);
+ res.b = res.b * (1.0f - p_amount);
return res;
}
_FORCE_INLINE_ Color lightened(float p_amount) const {
Color res = *this;
- res.r = CLAMP(res.r + (1.0f - res.r) * p_amount, 0.0, 1.0);
- res.g = CLAMP(res.g + (1.0f - res.g) * p_amount, 0.0, 1.0);
- res.b = CLAMP(res.b + (1.0f - res.b) * p_amount, 0.0, 1.0);
+ res.r = res.r + (1.0f - res.r) * p_amount;
+ res.g = res.g + (1.0f - res.g) * p_amount;
+ res.b = res.b + (1.0f - res.b) * p_amount;
return res;
}
diff --git a/editor/plugins/baked_lightmap_editor_plugin.cpp b/editor/plugins/baked_lightmap_editor_plugin.cpp
index af175c3493..59b79bd070 100644
--- a/editor/plugins/baked_lightmap_editor_plugin.cpp
+++ b/editor/plugins/baked_lightmap_editor_plugin.cpp
@@ -90,7 +90,7 @@ void BakedLightmapEditorPlugin::bake_func_begin(int p_steps) {
bool BakedLightmapEditorPlugin::bake_func_step(int p_step, const String &p_description) {
ERR_FAIL_COND_V(tmp_progress == NULL, false);
- return tmp_progress->step(p_description, p_step);
+ return tmp_progress->step(p_description, p_step, false);
}
void BakedLightmapEditorPlugin::bake_func_end() {
diff --git a/editor/plugins/gi_probe_editor_plugin.cpp b/editor/plugins/gi_probe_editor_plugin.cpp
index 42aad7a8a1..06da64b181 100644
--- a/editor/plugins/gi_probe_editor_plugin.cpp
+++ b/editor/plugins/gi_probe_editor_plugin.cpp
@@ -73,7 +73,7 @@ void GIProbeEditorPlugin::bake_func_begin(int p_steps) {
void GIProbeEditorPlugin::bake_func_step(int p_step, const String &p_description) {
ERR_FAIL_COND(tmp_progress == NULL);
- tmp_progress->step(p_description, p_step);
+ tmp_progress->step(p_description, p_step, false);
}
void GIProbeEditorPlugin::bake_func_end() {
diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp
index 5d79b8f94c..f735ef97db 100644
--- a/editor/progress_dialog.cpp
+++ b/editor/progress_dialog.cpp
@@ -200,7 +200,7 @@ bool ProgressDialog::task_step(const String &p_task, const String &p_state, int
if (!p_force_redraw) {
uint64_t tus = OS::get_singleton()->get_ticks_usec();
- if (tus - last_progress_tick < 50000) //50ms
+ if (tus - last_progress_tick < 200000) //200ms
return cancelled;
}
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index 61f55beb4e..905bb9ae24 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -71,7 +71,7 @@ public:
virtual void get_platform_features(List<String> *r_features) {
r_features->push_back("web");
- r_features->push_back("JavaScript");
+ r_features->push_back(get_os_name());
}
EditorExportPlatformJavaScript();
@@ -130,7 +130,7 @@ String EditorExportPlatformJavaScript::get_name() const {
String EditorExportPlatformJavaScript::get_os_name() const {
- return "JavaScript";
+ return "HTML5";
}
Ref<Texture> EditorExportPlatformJavaScript::get_logo() const {
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index b10ef821dd..3590c30579 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -81,12 +81,6 @@ void OS_JavaScript::initialize_core() {
FileAccess::make_default<FileAccessBufferedFA<FileAccessUnix> >(FileAccess::ACCESS_RESOURCES);
}
-void OS_JavaScript::set_opengl_extensions(const char *p_gl_extensions) {
-
- ERR_FAIL_COND(!p_gl_extensions);
- gl_extensions = p_gl_extensions;
-}
-
static EM_BOOL _browser_resize_callback(int event_type, const EmscriptenUiEvent *ui_event, void *user_data) {
ERR_FAIL_COND_V(event_type != EMSCRIPTEN_EVENT_RESIZE, false);
@@ -975,7 +969,25 @@ int OS_JavaScript::get_power_percent_left() {
bool OS_JavaScript::_check_internal_feature_support(const String &p_feature) {
- return p_feature == "web" || p_feature == "s3tc"; // TODO check for these features really being available
+ if (p_feature == "HTML5" || p_feature == "web")
+ return true;
+
+#ifdef JAVASCRIPT_EVAL_ENABLED
+ if (p_feature == "JavaScript")
+ return true;
+#endif
+
+ EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_get_current_context();
+ // all extensions are already automatically enabled, this function allows
+ // checking WebGL extension support without inline JavaScript
+ if (p_feature == "s3tc" && emscripten_webgl_enable_extension(ctx, "WEBGL_compressed_texture_s3tc_srgb"))
+ return true;
+ if (p_feature == "etc" && emscripten_webgl_enable_extension(ctx, "WEBGL_compressed_texture_etc1"))
+ return true;
+ if (p_feature == "etc2" && emscripten_webgl_enable_extension(ctx, "WEBGL_compressed_texture_etc"))
+ return true;
+
+ return false;
}
void OS_JavaScript::set_idbfs_available(bool p_idbfs_available) {
@@ -992,7 +1004,6 @@ OS_JavaScript::OS_JavaScript(const char *p_execpath, GetUserDataDirFunc p_get_us
set_cmdline(p_execpath, get_cmdline_args());
main_loop = NULL;
- gl_extensions = NULL;
window_maximized = false;
soft_fs_enabled = false;
canvas_size_adjustment_requested = false;
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index ce4763ab64..f0ba9422e8 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -52,7 +52,6 @@ class OS_JavaScript : public OS_Unix {
VisualServer *visual_server;
AudioDriverJavaScript audio_driver_javascript;
- const char *gl_extensions;
InputDefault *input;
Vector2 windowed_size;
@@ -139,8 +138,6 @@ public:
virtual bool has_touchscreen_ui_hint() const;
- void set_opengl_extensions(const char *p_gl_extensions);
-
virtual Error shell_open(String p_uri);
virtual String get_user_data_dir() const;
String get_executable_path() const;