diff options
327 files changed, 5899 insertions, 17131 deletions
diff --git a/core/array.cpp b/core/array.cpp index 44c553e4eb..ebad0df126 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -355,11 +355,58 @@ Variant Array::pop_front() { return Variant(); } +Variant Array::min() const { + + Variant minval; + for (int i = 0; i < size(); i++) { + if (i == 0) { + minval = get(i); + } else { + bool valid; + Variant ret; + Variant test = get(i); + Variant::evaluate(Variant::OP_LESS, test, minval, ret, valid); + if (!valid) { + return Variant(); //not a valid comparison + } + if (bool(ret)) { + //is less + minval = test; + } + } + } + return minval; +} + +Variant Array::max() const { + + Variant maxval; + for (int i = 0; i < size(); i++) { + if (i == 0) { + maxval = get(i); + } else { + bool valid; + Variant ret; + Variant test = get(i); + Variant::evaluate(Variant::OP_GREATER, test, maxval, ret, valid); + if (!valid) { + return Variant(); //not a valid comparison + } + if (bool(ret)) { + //is less + maxval = test; + } + } + } + return maxval; +} + Array::Array(const Array &p_from) { _p = NULL; _ref(p_from); } + Array::Array() { _p = memnew(ArrayPrivate); diff --git a/core/array.h b/core/array.h index e549a886e6..c824c9b4f7 100644 --- a/core/array.h +++ b/core/array.h @@ -90,6 +90,9 @@ public: Array duplicate(bool p_deep = false) const; + Variant min() const; + Variant max() const; + Array(const Array &p_from); Array(); ~Array(); diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 26ba28370f..2bd271205a 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -240,6 +240,14 @@ PoolStringArray _OS::get_connected_midi_inputs() { return OS::get_singleton()->get_connected_midi_inputs(); } +void _OS::open_midi_inputs() { + return OS::get_singleton()->open_midi_inputs(); +} + +void _OS::close_midi_inputs() { + return OS::get_singleton()->close_midi_inputs(); +} + void _OS::set_video_mode(const Size2 &p_size, bool p_fullscreen, bool p_resizeable, int p_screen) { OS::VideoMode vm; @@ -1085,6 +1093,8 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_audio_driver_count"), &_OS::get_audio_driver_count); ClassDB::bind_method(D_METHOD("get_audio_driver_name", "driver"), &_OS::get_audio_driver_name); ClassDB::bind_method(D_METHOD("get_connected_midi_inputs"), &_OS::get_connected_midi_inputs); + ClassDB::bind_method(D_METHOD("open_midi_inputs"), &_OS::open_midi_inputs); + ClassDB::bind_method(D_METHOD("close_midi_inputs"), &_OS::close_midi_inputs); ClassDB::bind_method(D_METHOD("get_screen_count"), &_OS::get_screen_count); ClassDB::bind_method(D_METHOD("get_current_screen"), &_OS::get_current_screen); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index b587b9257f..21aea12b23 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -157,6 +157,8 @@ public: virtual String get_audio_driver_name(int p_driver) const; virtual PoolStringArray get_connected_midi_inputs(); + virtual void open_midi_inputs(); + virtual void close_midi_inputs(); virtual int get_screen_count() const; virtual int get_current_screen() const; diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp index 5c1fd26e2a..46df63066b 100644 --- a/core/compressed_translation.cpp +++ b/core/compressed_translation.cpp @@ -50,7 +50,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { int size = Math::larger_prime(keys.size()); - print_line("compressing keys: " + itos(keys.size())); Vector<Vector<Pair<int, CharString> > > buckets; Vector<Map<uint32_t, int> > table; Vector<uint32_t> hfunc_table; @@ -107,7 +106,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { } int bucket_table_size = 0; - print_line("total compressed string size: " + itos(total_compression_size) + " (" + itos(total_string_size) + " uncompressed)."); for (int i = 0; i < size; i++) { @@ -117,8 +115,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { if (b.size() == 0) continue; - //print_line("bucket: "+itos(i)+" - elements: "+itos(b.size())); - int d = 1; int item = 0; @@ -140,9 +136,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { bucket_table_size += 2 + b.size() * 4; } - print_line("bucket table size: " + itos(bucket_table_size * 4)); - print_line("hash table size: " + itos(size * 4)); - hash_table.resize(size); bucket_table.resize(bucket_table_size); @@ -178,8 +171,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { } } - print_line("total collisions: " + itos(collisions)); - strings.resize(total_compression_size); PoolVector<uint8_t>::Write cw = strings.write(); @@ -198,15 +189,11 @@ bool PHashTranslation::_set(const StringName &p_name, const Variant &p_value) { String name = p_name.operator String(); if (name == "hash_table") { hash_table = p_value; - //print_line("translation: loaded hash table of size: "+itos(hash_table.size())); } else if (name == "bucket_table") { bucket_table = p_value; - //print_line("translation: loaded bucket table of size: "+itos(bucket_table.size())); } else if (name == "strings") { strings = p_value; - //print_line("translation: loaded string table of size: "+itos(strings.size())); } else if (name == "load_from") { - //print_line("generating"); generate(p_value); } else return false; @@ -248,11 +235,7 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const { uint32_t p = htptr[h % htsize]; - //print_line("String: "+p_src_text.operator String()); - //print_line("Hash: "+itos(p)); - if (p == 0xFFFFFFFF) { - //print_line("GETMSG: Nothing!"); return StringName(); //nothing } @@ -271,9 +254,7 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const { } } - //print_line("bucket pos: "+itos(idx)); if (idx == -1) { - //print_line("GETMSG: Not in Bucket!"); return StringName(); } @@ -281,8 +262,6 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const { String rstr; rstr.parse_utf8(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].uncomp_size); - //print_line("Uncompressed, size: "+itos(bucket.elem[idx].comp_size)); - //print_line("Return: "+rstr); return rstr; } else { @@ -292,8 +271,6 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const { smaz_decompress(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].comp_size, uncomp.ptrw(), bucket.elem[idx].uncomp_size); String rstr; rstr.parse_utf8(uncomp.get_data()); - //print_line("Compressed, size: "+itos(bucket.elem[idx].comp_size)); - //print_line("Return: "+rstr); return rstr; } } diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index bb7a444ccc..812e881114 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -43,7 +43,6 @@ Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8_t> &p_key, Mode p_mode) { - //print_line("open and parse!"); ERR_FAIL_COND_V(file != NULL, ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(p_key.size() != 32, ERR_INVALID_PARAMETER); diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index e0a2dbf507..d72d3ca9f1 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -93,8 +93,6 @@ void FileAccessNetworkClient::_thread_func() { DEBUG_TIME("sem_unlock"); //DEBUG_PRINT("semwait returned "+itos(werr)); DEBUG_PRINT("MUTEX LOCK " + itos(lockcount)); - DEBUG_PRINT("POPO"); - DEBUG_PRINT("PEPE"); lock_mutex(); DEBUG_PRINT("MUTEX PASS"); diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h index 8a40e6d78c..f29e431d9a 100644 --- a/core/io/file_access_pack.h +++ b/core/io/file_access_pack.h @@ -175,7 +175,6 @@ public: FileAccess *PackedData::try_open_path(const String &p_path) { - //print_line("try open path " + p_path); PathMD5 pmd5(p_path.md5_buffer()); Map<PathMD5, PackedFile>::Element *E = files.find(pmd5); if (!E) diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 8b0655deb0..c01aff9144 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -204,8 +204,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p if (!p_no_cache && ResourceCache::has(local_path)) { - if (OS::get_singleton()->is_stdout_verbose()) - print_line("load resource: " + local_path + " (cached)"); + print_verbose("Loading resource: " + local_path + " (cached)"); if (r_error) *r_error = OK; return RES(ResourceCache::get(local_path)); @@ -216,9 +215,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p ERR_FAIL_COND_V(path == "", RES()); - if (OS::get_singleton()->is_stdout_verbose()) - print_line("load resource: " + path); - + print_verbose("Loading resource: " + path); RES res = _load(path, local_path, p_type_hint, p_no_cache, r_error); if (res.is_null()) { @@ -286,9 +283,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_ if (!p_no_cache && ResourceCache::has(local_path)) { - if (OS::get_singleton()->is_stdout_verbose()) - print_line("load resource: " + local_path + " (cached)"); - + print_verbose("Loading resource: " + local_path + " (cached)"); Ref<Resource> res_cached = ResourceCache::get(local_path); Ref<ResourceInteractiveLoaderDefault> ril = Ref<ResourceInteractiveLoaderDefault>(memnew(ResourceInteractiveLoaderDefault)); @@ -298,14 +293,10 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_ bool xl_remapped = false; String path = _path_remap(local_path, &xl_remapped); - ERR_FAIL_COND_V(path == "", Ref<ResourceInteractiveLoader>()); - - if (OS::get_singleton()->is_stdout_verbose()) - print_line("load resource: "); + print_verbose("Loading resource: " + path); bool found = false; - for (int i = 0; i < loader_count; i++) { if (!loader[i]->recognize_path(path, p_type_hint)) diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp index e7e9662d24..25adb6a6ee 100644 --- a/core/io/stream_peer_ssl.cpp +++ b/core/io/stream_peer_ssl.cpp @@ -81,7 +81,7 @@ PoolByteArray StreamPeerSSL::get_project_cert_array() { memdelete(f); #ifdef DEBUG_ENABLED - print_line("Loaded certs from '" + certs_path); + print_verbose(vformat("Loaded certs from '%s'.", certs_path)); #endif } } diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 1a79385a29..ba40cb4586 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -622,15 +622,12 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant case TEXT_PRINTERR: { String str = *p_inputs[0]; - - //str+="\n"; print_error(str); } break; case TEXT_PRINTRAW: { - String str = *p_inputs[0]; - //str+="\n"; + String str = *p_inputs[0]; OS::get_singleton()->print("%s", str.utf8().get_data()); } break; diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp index 7ab28daf20..d8cb657b5e 100644 --- a/core/math/geometry.cpp +++ b/core/math/geometry.cpp @@ -626,7 +626,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e voxelsize.z /= div_z; // create and initialize cells to zero - //print_line("Wrapper: Initializing Cells"); uint8_t ***cell_status = memnew_arr(uint8_t **, div_x); for (int i = 0; i < div_x; i++) { @@ -645,7 +644,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e } // plot faces into cells - //print_line("Wrapper (1/6): Plotting Faces"); for (int i = 0; i < face_count; i++) { @@ -659,8 +657,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e // determine which cells connect to the outside by traversing the outside and recursively flood-fill marking - //print_line("Wrapper (2/6): Flood Filling"); - for (int i = 0; i < div_x; i++) { for (int j = 0; j < div_y; j++) { @@ -690,8 +686,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e // build faces for the inside-outside cell divisors - //print_line("Wrapper (3/6): Building Faces"); - PoolVector<Face3> wrapped_faces; for (int i = 0; i < div_x; i++) { @@ -705,8 +699,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e } } - //print_line("Wrapper (4/6): Transforming Back Vertices"); - // transform face vertices to global coords int wrapped_faces_count = wrapped_faces.size(); @@ -724,7 +716,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e } // clean up grid - //print_line("Wrapper (5/6): Grid Cleanup"); for (int i = 0; i < div_x; i++) { @@ -740,7 +731,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e if (p_error) *p_error = voxelsize.length(); - //print_line("Wrapper (6/6): Finished."); return wrapped_faces; } diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp index 45c106102e..9d4f4f66b7 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -62,7 +62,6 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me Vector3 sp = p_points[i].snapped(Vector3(0.0001, 0.0001, 0.0001)); if (valid_cache.has(sp)) { valid_points.write[i] = false; - //print_line("INVALIDATED: "+itos(i)); } else { valid_points.write[i] = true; valid_cache.insert(sp); @@ -455,7 +454,6 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me //fill mesh r_mesh.faces.clear(); r_mesh.faces.resize(ret_faces.size()); - //print_line("FACECOUNT: "+itos(r_mesh.faces.size())); int idx = 0; for (List<Geometry::MeshData::Face>::Element *E = ret_faces.front(); E; E = E->next()) { @@ -473,12 +471,5 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me r_mesh.vertices = p_points; - //r_mesh.optimize_vertices(); - /* - print_line("FACES: "+itos(r_mesh.faces.size())); - print_line("EDGES: "+itos(r_mesh.edges.size())); - print_line("VERTICES: "+itos(r_mesh.vertices.size())); -*/ - return OK; } diff --git a/core/message_queue.cpp b/core/message_queue.cpp index 3adaad868a..97ee236a46 100644 --- a/core/message_queue.cpp +++ b/core/message_queue.cpp @@ -50,9 +50,9 @@ Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, const V String type; if (ObjectDB::get_instance(p_id)) type = ObjectDB::get_instance(p_id)->get_class(); - print_line("failed method: " + type + ":" + p_method + " target ID: " + itos(p_id)); + print_line("Failed method: " + type + ":" + p_method + " target ID: " + itos(p_id)); statistics(); - ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings"); + ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings."); ERR_FAIL_V(ERR_OUT_OF_MEMORY); } @@ -101,9 +101,9 @@ Error MessageQueue::push_set(ObjectID p_id, const StringName &p_prop, const Vari String type; if (ObjectDB::get_instance(p_id)) type = ObjectDB::get_instance(p_id)->get_class(); - print_line("failed set: " + type + ":" + p_prop + " target ID: " + itos(p_id)); + print_line("Failed set: " + type + ":" + p_prop + " target ID: " + itos(p_id)); statistics(); - ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings"); + ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings."); ERR_FAIL_V(ERR_OUT_OF_MEMORY); } @@ -134,9 +134,9 @@ Error MessageQueue::push_notification(ObjectID p_id, int p_notification) { String type; if (ObjectDB::get_instance(p_id)) type = ObjectDB::get_instance(p_id)->get_class(); - print_line("failed notification: " + itos(p_notification) + " target ID: " + itos(p_id)); + print_line("Failed notification: " + itos(p_notification) + " target ID: " + itos(p_id)); statistics(); - ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings"); + ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings."); ERR_FAIL_V(ERR_OUT_OF_MEMORY); } @@ -210,8 +210,7 @@ void MessageQueue::statistics() { } //object was deleted - //WARN_PRINT("Object was deleted while awaiting a callback") - //should it print a warning? + print_line("Object was deleted while awaiting a callback"); } else { null_count++; @@ -226,17 +225,14 @@ void MessageQueue::statistics() { print_line("NULL count: " + itos(null_count)); for (Map<StringName, int>::Element *E = set_count.front(); E; E = E->next()) { - print_line("SET " + E->key() + ": " + itos(E->get())); } for (Map<StringName, int>::Element *E = call_count.front(); E; E = E->next()) { - print_line("CALL " + E->key() + ": " + itos(E->get())); } for (Map<int, int>::Element *E = notify_count.front(); E; E = E->next()) { - print_line("NOTIFY " + itos(E->key()) + ": " + itos(E->get())); } } @@ -268,7 +264,6 @@ void MessageQueue::flush() { if (buffer_end > buffer_max_used) { buffer_max_used = buffer_end; - //statistics(); } uint32_t read_pos = 0; diff --git a/core/oa_hash_map.h b/core/oa_hash_map.h index 0b3b40f30c..3a17fc21f3 100644 --- a/core/oa_hash_map.h +++ b/core/oa_hash_map.h @@ -320,7 +320,7 @@ public: memdelete_arr(keys); memdelete_arr(values); - memdelete(hashes); + memdelete_arr(hashes); } }; diff --git a/core/object.cpp b/core/object.cpp index 76226d113a..e83abaece7 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -2080,10 +2080,10 @@ void ObjectDB::cleanup() { String node_name; if (instances[*K]->is_class("Node")) - node_name = " - Node Name: " + String(instances[*K]->call("get_name")); + node_name = " - Node name: " + String(instances[*K]->call("get_name")); if (instances[*K]->is_class("Resource")) - node_name = " - Resource Name: " + String(instances[*K]->call("get_name")) + " Path: " + String(instances[*K]->call("get_path")); - print_line("Leaked Instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + node_name); + node_name = " - Resource name: " + String(instances[*K]->call("get_name")) + " Path: " + String(instances[*K]->call("get_path")); + print_line("Leaked instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + node_name); } } } diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index 330a9153ef..e631d6e994 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -98,22 +98,18 @@ static Error _erase_recursive(DirAccess *da) { err = _erase_recursive(da); if (err) { - print_line("err recurso " + E->get()); da->change_dir(".."); return err; } err = da->change_dir(".."); if (err) { - print_line("no go back " + E->get()); return err; } err = da->remove(da->get_current_dir().plus_file(E->get())); if (err) { - print_line("no remove dir" + E->get()); return err; } } else { - print_line("no change to " + E->get()); return err; } } @@ -122,8 +118,6 @@ static Error _erase_recursive(DirAccess *da) { Error err = da->remove(da->get_current_dir().plus_file(E->get())); if (err) { - - print_line("no remove file" + E->get()); return err; } } diff --git a/core/os/os.cpp b/core/os/os.cpp index 97dae05919..e90d714450 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -689,6 +689,18 @@ PoolStringArray OS::get_connected_midi_inputs() { return list; } +void OS::open_midi_inputs() { + + if (MIDIDriver::get_singleton()) + MIDIDriver::get_singleton()->open(); +} + +void OS::close_midi_inputs() { + + if (MIDIDriver::get_singleton()) + MIDIDriver::get_singleton()->close(); +} + OS::OS() { void *volatile stack_bottom; diff --git a/core/os/os.h b/core/os/os.h index 12c0222ad4..6f9a72d451 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -190,6 +190,8 @@ public: virtual const char *get_audio_driver_name(int p_driver) const; virtual PoolStringArray get_connected_midi_inputs(); + virtual void open_midi_inputs(); + virtual void close_midi_inputs(); virtual int get_screen_count() const { return 1; } virtual int get_current_screen() const { return 0; } diff --git a/core/os/rw_lock.h b/core/os/rw_lock.h index 9053794c83..3e53300c9f 100644 --- a/core/os/rw_lock.h +++ b/core/os/rw_lock.h @@ -56,8 +56,10 @@ class RWLockRead { RWLock *lock; public: - RWLockRead(RWLock *p_lock) { - lock = p_lock; + RWLockRead(const RWLock *p_lock) { + if (p_lock) { + lock = const_cast<RWLock *>(p_lock); + } if (lock) lock->read_lock(); } ~RWLockRead() { diff --git a/core/print_string.cpp b/core/print_string.cpp index 0355154488..e1e42d2b56 100644 --- a/core/print_string.cpp +++ b/core/print_string.cpp @@ -107,3 +107,10 @@ void print_error(String p_string) { _global_unlock(); } + +void print_verbose(String p_string) { + + if (OS::get_singleton()->is_stdout_verbose()) { + print_line(p_string); + } +} diff --git a/core/print_string.h b/core/print_string.h index 3465888d4c..c1d2d0ff3a 100644 --- a/core/print_string.h +++ b/core/print_string.h @@ -58,5 +58,6 @@ extern bool _print_line_enabled; extern bool _print_error_enabled; extern void print_line(String p_string); extern void print_error(String p_string); +extern void print_verbose(String p_string); #endif diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 87a5c3e493..890789ec6f 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -191,7 +191,7 @@ bool ProjectSettings::_get(const StringName &p_name, Variant &r_ret) const { name = feature_overrides[name]; } if (!props.has(name)) { - print_line("WARNING: not found: " + String(name)); + WARN_PRINTS("Property not found: " + String(name)); return false; } r_ret = props[name].variant; diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index c5daaeea47..2b9b5d6037 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -82,17 +82,16 @@ Error ScriptDebuggerRemote::connect_to_host(const String &p_host, uint16_t p_por const int ms = waits[i]; OS::get_singleton()->delay_usec(ms * 1000); - print_line("Remote Debugger: Connection failed with status: '" + String::num(tcp_client->get_status()) + "', retrying in " + String::num(ms) + " msec."); + ERR_PRINTS("Remote Debugger: Connection failed with status: '" + String::num(tcp_client->get_status()) + "', retrying in " + String::num(ms) + " msec."); }; }; if (tcp_client->get_status() != StreamPeerTCP::STATUS_CONNECTED) { - print_line("Remote Debugger: Unable to connect"); + ERR_PRINTS("Remote Debugger: Unable to connect."); return FAILED; }; - // print_line("Remote Debugger: Connection OK!"); packet_peer_stream->set_stream_peer(tcp_client); return OK; diff --git a/core/string_db.cpp b/core/string_db.cpp index 2475cbe3e8..067e4493a1 100644 --- a/core/string_db.cpp +++ b/core/string_db.cpp @@ -73,7 +73,6 @@ void StringName::cleanup() { _Data *d = _table[i]; lost_strings++; if (OS::get_singleton()->is_stdout_verbose()) { - if (d->cname) { print_line("Orphan StringName: " + String(d->cname)); } else { @@ -85,8 +84,8 @@ void StringName::cleanup() { memdelete(d); } } - if (OS::get_singleton()->is_stdout_verbose() && lost_strings) { - print_line("StringName: " + itos(lost_strings) + " unclaimed string names at exit."); + if (lost_strings) { + print_verbose("StringName: " + itos(lost_strings) + " unclaimed string names at exit."); } lock->unlock(); diff --git a/core/translation.cpp b/core/translation.cpp index 78115c3749..82a16d0b17 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -1098,7 +1098,6 @@ bool TranslationServer::_load_translations(const String &p_from) { for (int i = 0; i < tcount; i++) { - //print_line( "Loading translation from " + r[i] ); Ref<Translation> tr = ResourceLoader::load(r[i]); if (tr.is_valid()) add_translation(tr); diff --git a/core/ustring.cpp b/core/ustring.cpp index 35cd27f7f3..96e3a3d784 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -1340,7 +1340,7 @@ String String::utf8(const char *p_utf8, int p_len) { bool String::parse_utf8(const char *p_utf8, int p_len) { -#define _UNICERROR(m_err) print_line("unicode error: " + String(m_err)); +#define _UNICERROR(m_err) print_line("Unicode error: " + String(m_err)); String aux; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 1c50df75f5..8b18b274b6 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -516,6 +516,8 @@ struct _VariantCall { VCALL_LOCALMEM4R(Array, bsearch_custom); VCALL_LOCALMEM1R(Array, duplicate); VCALL_LOCALMEM0(Array, invert); + VCALL_LOCALMEM0R(Array, max); + VCALL_LOCALMEM0R(Array, min); static void _call_PoolByteArray_get_string_from_ascii(Variant &r_ret, Variant &p_self, const Variant **p_args) { @@ -1705,6 +1707,8 @@ void register_variant_methods() { ADDFUNC4R(ARRAY, INT, Array, bsearch_custom, NIL, "value", OBJECT, "obj", STRING, "func", BOOL, "before", varray(true)); ADDFUNC0NC(ARRAY, NIL, Array, invert, varray()); ADDFUNC1R(ARRAY, ARRAY, Array, duplicate, BOOL, "deep", varray(false)); + ADDFUNC0R(ARRAY, NIL, Array, max, varray()); + ADDFUNC0R(ARRAY, NIL, Array, min, varray()); ADDFUNC0R(POOL_BYTE_ARRAY, INT, PoolByteArray, size, varray()); ADDFUNC2(POOL_BYTE_ARRAY, NIL, PoolByteArray, set, INT, "idx", INT, "byte", varray()); diff --git a/doc/classes/Particles.xml b/doc/classes/Particles.xml index b03cf6cadb..2e30750bf9 100644 --- a/doc/classes/Particles.xml +++ b/doc/classes/Particles.xml @@ -77,7 +77,7 @@ Emission randomness ratio. Default value: [code]0[/code]. </member> <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale"> - Speed scaling ratio. Default value: [code]1[/code]. + Speed scaling ratio. Default value: [code]1[/code]. A value of [code]0[/code] can be used to pause the particles. </member> <member name="visibility_aabb" type="AABB" setter="set_visibility_aabb" getter="get_visibility_aabb"> The [AABB] that determines the area of the world part of which needs to be visible on screen for the particle system to be active. diff --git a/doc/classes/Particles2D.xml b/doc/classes/Particles2D.xml index 47265054b0..f872552a49 100644 --- a/doc/classes/Particles2D.xml +++ b/doc/classes/Particles2D.xml @@ -66,7 +66,7 @@ Emission lifetime randomness ratio. Default value: [code]0[/code]. </member> <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale"> - Particle system's running speed scaling ratio. Default value: [code]1[/code]. + Particle system's running speed scaling ratio. Default value: [code]1[/code]. A value of [code]0[/code] can be used to pause the particles. </member> <member name="texture" type="Texture" setter="set_texture" getter="get_texture"> Particle texture. If [code]null[/code] particles will be squares. diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp index a44a11a46d..1f53d52951 100644 --- a/drivers/alsa/audio_driver_alsa.cpp +++ b/drivers/alsa/audio_driver_alsa.cpp @@ -116,9 +116,7 @@ Error AudioDriverALSA::init_device() { status = snd_pcm_hw_params_set_period_size_near(pcm_handle, hwparams, &period_size, NULL); CHECK_FAIL(status < 0); - if (OS::get_singleton()->is_stdout_verbose()) { - print_line("audio buffer frames: " + itos(period_size) + " calculated latency: " + itos(period_size * 1000 / mix_rate) + "ms"); - } + print_verbose("Audio buffer frames: " + itos(period_size) + " calculated latency: " + itos(period_size * 1000 / mix_rate) + "ms"); status = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &periods, NULL); CHECK_FAIL(status < 0); diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp index e1f47cb8c2..689f1f462d 100644 --- a/drivers/coreaudio/audio_driver_coreaudio.cpp +++ b/drivers/coreaudio/audio_driver_coreaudio.cpp @@ -178,10 +178,8 @@ Error AudioDriverCoreAudio::init() { input_position = 0; input_size = 0; - if (OS::get_singleton()->is_stdout_verbose()) { - print_line("CoreAudio: detected " + itos(channels) + " channels"); - print_line("CoreAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); - } + print_verbose("CoreAudio: detected " + itos(channels) + " channels"); + print_verbose("CoreAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); AURenderCallbackStruct callback; zeromem(&callback, sizeof(AURenderCallbackStruct)); diff --git a/drivers/coremidi/core_midi.cpp b/drivers/coremidi/core_midi.cpp index 3619be4a8e..6d4624e05b 100644 --- a/drivers/coremidi/core_midi.cpp +++ b/drivers/coremidi/core_midi.cpp @@ -92,6 +92,25 @@ void MIDIDriverCoreMidi::close() { } } +PoolStringArray MIDIDriverCoreMidi::get_connected_inputs() { + + PoolStringArray list; + + for (int i = 0; i < connected_sources.size(); i++) { + MIDIEndpointRef source = connected_sources[i]; + CFStringRef ref = NULL; + char name[256]; + + MIDIObjectGetStringProperty(source, kMIDIPropertyDisplayName, &ref); + CFStringGetCString(ref, name, sizeof(name), kCFStringEncodingUTF8); + CFRelease(ref); + + list.push_back(name); + } + + return list; +} + MIDIDriverCoreMidi::MIDIDriverCoreMidi() { client = 0; diff --git a/drivers/coremidi/core_midi.h b/drivers/coremidi/core_midi.h index fd35e12f4b..c6b443764f 100644 --- a/drivers/coremidi/core_midi.h +++ b/drivers/coremidi/core_midi.h @@ -53,6 +53,8 @@ public: virtual Error open(); virtual void close(); + PoolStringArray get_connected_inputs(); + MIDIDriverCoreMidi(); virtual ~MIDIDriverCoreMidi(); }; diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp index d6fbf04353..9a9ede761a 100644 --- a/drivers/gles2/rasterizer_canvas_gles2.cpp +++ b/drivers/gles2/rasterizer_canvas_gles2.cpp @@ -152,7 +152,7 @@ RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(con state.current_tex = RID(); state.current_tex_ptr = NULL; - glActiveTexture(GL_TEXTURE0); + glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 1); glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex); } else { @@ -167,7 +167,7 @@ RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(con texture->render_target->used_in_frame = true; } - glActiveTexture(GL_TEXTURE0); + glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 1); glBindTexture(GL_TEXTURE_2D, texture->tex_id); state.current_tex = p_texture; @@ -179,7 +179,7 @@ RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(con state.current_tex = RID(); state.current_tex_ptr = NULL; - glActiveTexture(GL_TEXTURE0); + glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 1); glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex); } @@ -486,7 +486,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur RasterizerStorageGLES2::Texture *tex = _bind_canvas_texture(np->texture, np->normal_map); if (!tex) { - print_line("TODO: ninepatch without texture"); + // FIXME: Handle textureless ninepatch gracefully + WARN_PRINT("NinePatch without texture not supported yet in GLES2 backend, skipping."); continue; } @@ -612,8 +613,6 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur buffer[(3 * 4 * 4) + 14] = (source.position.x + source.size.x) * texpixel_size.x; buffer[(3 * 4 * 4) + 15] = (source.position.y + source.size.y) * texpixel_size.y; - - // print_line(String::num((source.position.y + source.size.y) * texpixel_size.y)); } glBindBuffer(GL_ARRAY_BUFFER, data.ninepatch_vertices); @@ -789,7 +788,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur } break; default: { - print_line("other"); + // FIXME: Proper error handling if relevant + //print_line("other"); } break; } } @@ -889,7 +889,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons for (int i = 0; i < tc; i++) { - glActiveTexture(GL_TEXTURE2 + i); + glActiveTexture(GL_TEXTURE0 + i); RasterizerStorageGLES2::Texture *t = storage->texture_owner.getornull(textures[i].second); @@ -937,7 +937,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons } int blend_mode = shader_cache ? shader_cache->canvas_item.blend_mode : RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_MIX; - bool unshaded = true || (shader_cache && blend_mode != RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_MIX); + bool unshaded = (shader_cache && blend_mode != RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_MIX); bool reclip = false; if (last_blend_mode != blend_mode) { @@ -1027,8 +1027,8 @@ void RasterizerCanvasGLES2::reset_canvas() { // keeping this for now as there's nothing else that uses texture unit 2 // TODO ^ if (storage->frame.current_rt) { - glActiveTexture(GL_TEXTURE0 + 2); - glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->copy_screen_effect.color); + // glActiveTexture(GL_TEXTURE0 + 2); + // glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->copy_screen_effect.color); } glBindBuffer(GL_ARRAY_BUFFER, 0); diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index a1a0b9e2c6..c926f2bcc4 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -138,9 +138,7 @@ RasterizerScene *RasterizerGLES2::get_scene() { void RasterizerGLES2::initialize() { - if (OS::get_singleton()->is_stdout_verbose()) { - print_line("Using GLES2 video driver"); - } + print_verbose("Using GLES2 video driver"); #ifdef GLAD_ENABLED if (!gladLoadGL()) { @@ -327,7 +325,7 @@ void RasterizerGLES2::set_boot_image(const Ref<Image> &p_image, const Color &p_c screenrect.position += ((Size2(window_w, window_h) - screenrect.size) / 2.0).floor(); RasterizerStorageGLES2::Texture *t = storage->texture_owner.get(texture); - glActiveTexture(GL_TEXTURE0); + glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 1); glBindTexture(GL_TEXTURE_2D, t->tex_id); canvas->draw_generic_textured_rect(screenrect, Rect2(0, 0, 1, 1)); glBindTexture(GL_TEXTURE_2D, 0); @@ -354,7 +352,7 @@ void RasterizerGLES2::blit_render_target_to_screen(RID p_render_target, const Re canvas->canvas_begin(); glDisable(GL_BLEND); glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES2::system_fbo); - glActiveTexture(GL_TEXTURE0); + glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 1); glBindTexture(GL_TEXTURE_2D, rt->color); // TODO normals diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index 288a144b32..e21998d55e 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -107,7 +107,7 @@ void RasterizerSceneGLES2::shadow_atlas_set_size(RID p_atlas, int p_size) { glActiveTexture(GL_TEXTURE0); glGenTextures(1, &shadow_atlas->depth); glBindTexture(GL_TEXTURE_2D, shadow_atlas->depth); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, shadow_atlas->size, shadow_atlas->size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, shadow_atlas->size, shadow_atlas->size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -837,7 +837,7 @@ static const GLenum gl_primitive[] = { GL_TRIANGLE_FAN }; -void RasterizerSceneGLES2::_setup_material(RasterizerStorageGLES2::Material *p_material, bool p_reverse_cull, Size2i p_skeleton_tex_size) { +void RasterizerSceneGLES2::_setup_material(RasterizerStorageGLES2::Material *p_material, bool p_reverse_cull, bool p_alpha_pass, Size2i p_skeleton_tex_size) { // material parameters @@ -851,6 +851,20 @@ void RasterizerSceneGLES2::_setup_material(RasterizerStorageGLES2::Material *p_m glEnable(GL_DEPTH_TEST); } + switch (p_material->shader->spatial.depth_draw_mode) { + case RasterizerStorageGLES2::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS: + case RasterizerStorageGLES2::Shader::Spatial::DEPTH_DRAW_OPAQUE: { + + glDepthMask(!p_alpha_pass); + } break; + case RasterizerStorageGLES2::Shader::Spatial::DEPTH_DRAW_ALWAYS: { + glDepthMask(GL_TRUE); + } break; + case RasterizerStorageGLES2::Shader::Spatial::DEPTH_DRAW_NEVER: { + glDepthMask(GL_FALSE); + } break; + } + // TODO whyyyyy???? p_reverse_cull = true; @@ -913,8 +927,8 @@ void RasterizerSceneGLES2::_setup_material(RasterizerStorageGLES2::Material *p_m void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, RasterizerStorageGLES2::Skeleton *p_skeleton) { state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON, p_skeleton != NULL); - // state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON_SOFTWARE, !storage->config.float_texture_supported); - state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON_SOFTWARE, true); + state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON_SOFTWARE, !storage->config.float_texture_supported); + // state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON_SOFTWARE, true); switch (p_element->instance->base_type) { @@ -951,9 +965,9 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste } break; } - if (false && storage->config.float_texture_supported) { + if (storage->config.float_texture_supported) { if (p_skeleton) { - glActiveTexture(GL_TEXTURE4); + glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 1); glBindTexture(GL_TEXTURE_2D, p_skeleton->tex_id); } @@ -1202,6 +1216,12 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) { glDisableVertexAttribArray(15); // color glDisableVertexAttribArray(8); // custom data + if (!s->attribs[VS::ARRAY_COLOR].enabled) { + glDisableVertexAttribArray(VS::ARRAY_COLOR); + + glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1); + } + glVertexAttrib4f(15, 1, 1, 1, 1); glVertexAttrib4f(8, 0, 0, 0, 0); @@ -1245,7 +1265,12 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) { } if (multi_mesh->color_floats) { - glVertexAttrib4fv(15, buffer + color_ofs); + if (multi_mesh->color_format == VS::MULTIMESH_COLOR_8BIT) { + uint8_t *color_data = (uint8_t *)(buffer + color_ofs); + glVertexAttrib4f(15, color_data[0] / 255.0, color_data[1] / 255.0, color_data[2] / 255.0, color_data[3] / 255.0); + } else { + glVertexAttrib4fv(15, buffer + color_ofs); + } } if (multi_mesh->custom_data_floats) { @@ -1432,7 +1457,7 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements, _setup_geometry(e, skeleton); - _setup_material(material, p_reverse_cull, Size2i(skeleton ? skeleton->size * 3 : 0, 0)); + _setup_material(material, p_reverse_cull, p_alpha_pass, Size2i(skeleton ? skeleton->size * 3 : 0, 0)); if (use_radiance_map) { state.scene_shader.set_uniform(SceneShaderGLES2::RADIANCE_INVERSE_XFORM, p_view_transform); @@ -1568,7 +1593,7 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements, { _setup_geometry(e, skeleton); - _setup_material(material, p_reverse_cull, Size2i(skeleton ? skeleton->size * 3 : 0, 0)); + _setup_material(material, p_reverse_cull, p_alpha_pass, Size2i(skeleton ? skeleton->size * 3 : 0, 0)); if (shadow_atlas != NULL) { glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 4); glBindTexture(GL_TEXTURE_2D, shadow_atlas->depth); @@ -1757,7 +1782,7 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements, RasterizerStorageGLES2::Skeleton *skeleton = storage->skeleton_owner.getornull(e->instance->skeleton); { - _setup_material(material, p_reverse_cull, Size2i(skeleton ? skeleton->size * 3 : 0, 0)); + _setup_material(material, p_reverse_cull, false, Size2i(skeleton ? skeleton->size * 3 : 0, 0)); if (directional_shadow.depth) { glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 4); // TODO move into base pass @@ -2401,7 +2426,7 @@ void RasterizerSceneGLES2::initialize() { glBindTexture(GL_TEXTURE_CUBE_MAP, cube.cubemap); for (int i = 0; i < 6; i++) { - glTexImage2D(_cube_side_enum[i], 0, GL_DEPTH_COMPONENT16, cube_size, cube_size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, NULL); + glTexImage2D(_cube_side_enum[i], 0, GL_DEPTH_COMPONENT, cube_size, cube_size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, NULL); } glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -2435,7 +2460,7 @@ void RasterizerSceneGLES2::initialize() { glGenTextures(1, &directional_shadow.depth); glBindTexture(GL_TEXTURE_2D, directional_shadow.depth); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, directional_shadow.size, directional_shadow.size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, directional_shadow.size, directional_shadow.size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h index e153080e15..72dbe14387 100644 --- a/drivers/gles2/rasterizer_scene_gles2.h +++ b/drivers/gles2/rasterizer_scene_gles2.h @@ -563,7 +563,7 @@ public: void _draw_sky(RasterizerStorageGLES2::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy); - void _setup_material(RasterizerStorageGLES2::Material *p_material, bool p_reverse_cull, Size2i p_skeleton_tex_size = Size2i(0, 0)); + void _setup_material(RasterizerStorageGLES2::Material *p_material, bool p_reverse_cull, bool p_alpha_pass, Size2i p_skeleton_tex_size = Size2i(0, 0)); void _setup_geometry(RenderList::Element *p_element, RasterizerStorageGLES2::Skeleton *p_skeleton); void _render_geometry(RenderList::Element *p_element); diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index e2d8ec1178..3cee42983d 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "rasterizer_storage_gles2.h" + #include "project_settings.h" #include "rasterizer_canvas_gles2.h" #include "rasterizer_scene_gles2.h" @@ -384,6 +385,10 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_ case VS::TEXTURE_TYPE_3D: { texture->images.resize(p_depth_3d); } break; + default: { + ERR_PRINT("Unknown texture type!"); + return; + } } Image::Format real_format; @@ -597,8 +602,6 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer) glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); - //print_line("GET FORMAT: " + Image::get_format_name(texture->format) + " mipmaps: " + itos(texture->mipmaps)); - for (int i = 0; i < texture->mipmaps; i++) { int ofs = 0; @@ -636,6 +639,8 @@ void RasterizerStorageGLES2::texture_set_flags(RID p_texture, uint32_t p_flags) bool had_mipmaps = texture->flags & VS::TEXTURE_FLAG_MIPMAPS; + texture->flags = p_flags; + glActiveTexture(GL_TEXTURE0); glBindTexture(texture->target, texture->tex_id); @@ -1303,6 +1308,10 @@ void RasterizerStorageGLES2::shader_get_param_list(RID p_shader, List<PropertyIn pi.hint = PROPERTY_HINT_RESOURCE_TYPE; pi.hint_string = "CubeMap"; } break; + + default: { + + } break; } p_param_list->push_back(pi); @@ -2848,7 +2857,11 @@ void RasterizerStorageGLES2::skeleton_allocate(RID p_skeleton, int p_bones, bool glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, skeleton->tex_id); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, p_bones * 3, 1, 0, GL_RGB, GL_FLOAT, NULL); +#ifdef GLES_OVER_GL + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, p_bones * 3, 1, 0, GL_RGBA, GL_FLOAT, NULL); +#else + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, p_bones * 3, 1, 0, GL_RGBA, GL_FLOAT, NULL); +#endif glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index 5ac2af6e5c..1c87b3ffb5 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -161,7 +161,7 @@ static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNo return text.as_string(); } break; - case SL::TYPE_FLOAT: return f2sp0(p_values[0].real) + "f"; + case SL::TYPE_FLOAT: return f2sp0(p_values[0].real); case SL::TYPE_VEC2: case SL::TYPE_VEC3: case SL::TYPE_VEC4: { @@ -596,6 +596,7 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener default: { SL::DataType type = op_node->arguments[3]->get_datatype(); + // FIXME: Proper error print or graceful handling print_line(String("uhhhh invalid mix with type: ") + itos(type)); } break; } diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp index e9b58cb272..3b2a29d3ee 100644 --- a/drivers/gles2/shader_gles2.cpp +++ b/drivers/gles2/shader_gles2.cpp @@ -231,7 +231,6 @@ static String _fix_error_code_line(const String &p_error, int p_code_start, int continue; String numstr = error.substr(last_find_pos + 1, (end_pos - last_find_pos) - 1); - print_line("numstr: " + numstr); String begin = error.substr(0, last_find_pos + 1); String end = error.substr(end_pos, error.length()); int num = numstr.to_int() + p_code_start - p_offset; @@ -967,19 +966,7 @@ void ShaderGLES2::use_material(void *p_material) { value.second.write[15].real = 1; } break; - case ShaderLanguage::TYPE_SAMPLER2D: { - - } break; - - case ShaderLanguage::TYPE_ISAMPLER2D: { - - } break; - - case ShaderLanguage::TYPE_USAMPLER2D: { - - } break; - - case ShaderLanguage::TYPE_SAMPLERCUBE: { + default: { } break; } diff --git a/drivers/gles2/shaders/blend_shape.glsl b/drivers/gles2/shaders/blend_shape.glsl index 4e0d066823..d019062ba0 100644 --- a/drivers/gles2/shaders/blend_shape.glsl +++ b/drivers/gles2/shaders/blend_shape.glsl @@ -1,6 +1,5 @@ [vertex] - /* from VisualServer: @@ -23,56 +22,56 @@ ARRAY_INDEX=8, /* INPUT ATTRIBS */ -layout(location=0) in highp VFORMAT vertex_attrib; -layout(location=1) in vec3 normal_attrib; +layout(location = 0) in highp VFORMAT vertex_attrib; +layout(location = 1) in vec3 normal_attrib; #ifdef ENABLE_TANGENT -layout(location=2) in vec4 tangent_attrib; +layout(location = 2) in vec4 tangent_attrib; #endif #ifdef ENABLE_COLOR -layout(location=3) in vec4 color_attrib; +layout(location = 3) in vec4 color_attrib; #endif #ifdef ENABLE_UV -layout(location=4) in vec2 uv_attrib; +layout(location = 4) in vec2 uv_attrib; #endif #ifdef ENABLE_UV2 -layout(location=5) in vec2 uv2_attrib; +layout(location = 5) in vec2 uv2_attrib; #endif #ifdef ENABLE_SKELETON -layout(location=6) in ivec4 bone_attrib; -layout(location=7) in vec4 weight_attrib; +layout(location = 6) in ivec4 bone_attrib; +layout(location = 7) in vec4 weight_attrib; #endif /* BLEND ATTRIBS */ #ifdef ENABLE_BLEND -layout(location=8) in highp VFORMAT vertex_attrib_blend; -layout(location=9) in vec3 normal_attrib_blend; +layout(location = 8) in highp VFORMAT vertex_attrib_blend; +layout(location = 9) in vec3 normal_attrib_blend; #ifdef ENABLE_TANGENT -layout(location=10) in vec4 tangent_attrib_blend; +layout(location = 10) in vec4 tangent_attrib_blend; #endif #ifdef ENABLE_COLOR -layout(location=11) in vec4 color_attrib_blend; +layout(location = 11) in vec4 color_attrib_blend; #endif #ifdef ENABLE_UV -layout(location=12) in vec2 uv_attrib_blend; +layout(location = 12) in vec2 uv_attrib_blend; #endif #ifdef ENABLE_UV2 -layout(location=13) in vec2 uv2_attrib_blend; +layout(location = 13) in vec2 uv2_attrib_blend; #endif #ifdef ENABLE_SKELETON -layout(location=14) in ivec4 bone_attrib_blend; -layout(location=15) in vec4 weight_attrib_blend; +layout(location = 14) in ivec4 bone_attrib_blend; +layout(location = 15) in vec4 weight_attrib_blend; #endif #endif @@ -110,7 +109,6 @@ uniform float blend_amount; void main() { - #ifdef ENABLE_BLEND vertex_out = vertex_attrib_blend + vertex_attrib * blend_amount; @@ -140,7 +138,6 @@ void main() { uv2_out = uv2_attrib_blend + uv2_attrib * blend_amount; #endif - #ifdef ENABLE_SKELETON bone_out = bone_attrib_blend; @@ -149,7 +146,6 @@ void main() { #else //ENABLE_BLEND - vertex_out = vertex_attrib * blend_amount; #ifdef ENABLE_NORMAL @@ -177,7 +173,6 @@ void main() { uv2_out = uv2_attrib * blend_amount; #endif - #ifdef ENABLE_SKELETON bone_out = bone_attrib; @@ -190,8 +185,6 @@ void main() { [fragment] - void main() { } - diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index 29d81bb2c4..cee68a58ff 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -75,7 +75,7 @@ void main() { #endif { - vec2 src_vtx=outvec.xy; + vec2 src_vtx = outvec.xy; VERTEX_SHADER_CODE } @@ -83,7 +83,6 @@ VERTEX_SHADER_CODE color_interp = color; gl_Position = projection_matrix * modelview_matrix * outvec; - } [fragment] @@ -96,9 +95,9 @@ precision mediump float; precision mediump int; #endif -uniform sampler2D color_texture; // texunit:0 +uniform sampler2D color_texture; // texunit:-1 uniform highp vec2 color_texpixel_size; -uniform mediump sampler2D normal_texture; // texunit:1 +uniform mediump sampler2D normal_texture; // texunit:-2 varying mediump vec2 uv_interp; varying mediump vec4 color_interp; @@ -109,7 +108,7 @@ uniform vec4 final_modulate; #ifdef SCREEN_TEXTURE_USED -uniform sampler2D screen_texture; // texunit:2 +uniform sampler2D screen_texture; // texunit:-3 #endif @@ -121,7 +120,6 @@ uniform vec2 screen_pixel_size; FRAGMENT_SHADER_GLOBALS - void main() { vec4 color = color_interp; @@ -135,11 +133,9 @@ void main() { FRAGMENT_SHADER_CODE - } color *= final_modulate; gl_FragColor = color; - } diff --git a/drivers/gles2/shaders/canvas_shadow.glsl b/drivers/gles2/shaders/canvas_shadow.glsl index c757990de0..81af486101 100644 --- a/drivers/gles2/shaders/canvas_shadow.glsl +++ b/drivers/gles2/shaders/canvas_shadow.glsl @@ -1,20 +1,18 @@ [vertex] - - uniform highp mat4 projection_matrix; uniform highp mat4 light_matrix; uniform highp mat4 world_matrix; uniform highp float distance_norm; -layout(location=0) in highp vec3 vertex; +layout(location = 0) in highp vec3 vertex; out highp vec4 position_interp; void main() { - gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex,1.0))); - position_interp=gl_Position; + gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex, 1.0))); + position_interp = gl_Position; } [fragment] @@ -23,27 +21,26 @@ in highp vec4 position_interp; #ifdef USE_RGBA_SHADOWS -layout(location=0) out lowp vec4 distance_buf; +layout(location = 0) out lowp vec4 distance_buf; #else -layout(location=0) out highp float distance_buf; +layout(location = 0) out highp float distance_buf; #endif void main() { - highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0;//bias; + highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0; //bias; #ifdef USE_RGBA_SHADOWS highp vec4 comp = fract(depth * vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0)); comp -= comp.xxyz * vec4(0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0); - distance_buf=comp; + distance_buf = comp; #else - distance_buf=depth; + distance_buf = depth; #endif } - diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl index feaeb2152b..6e9aad2a5d 100644 --- a/drivers/gles2/shaders/copy.glsl +++ b/drivers/gles2/shaders/copy.glsl @@ -85,17 +85,15 @@ uniform float custom_alpha; vec4 texturePanorama(sampler2D pano, vec3 normal) { vec2 st = vec2( - atan(normal.x, normal.z), - acos(normal.y) - ); + atan(normal.x, normal.z), + acos(normal.y)); - if(st.x < 0.0) - st.x += M_PI*2.0; + if (st.x < 0.0) + st.x += M_PI * 2.0; - st/=vec2(M_PI*2.0,M_PI); - - return texture2D(pano,st); + st /= vec2(M_PI * 2.0, M_PI); + return texture2D(pano, st); } #endif @@ -109,16 +107,15 @@ void main() { #elif defined(USE_CUBEMAP) vec4 color = textureCube(source_cube, normalize(cube_interp)); #else - vec4 color = texture2D( source, uv_interp ); + vec4 color = texture2D(source, uv_interp); #endif - #ifdef USE_NO_ALPHA - color.a=1.0; + color.a = 1.0; #endif #ifdef USE_CUSTOM_ALPHA - color.a=custom_alpha; + color.a = custom_alpha; #endif #ifdef USE_MULTIPLIER diff --git a/drivers/gles2/shaders/cube_to_dp.glsl b/drivers/gles2/shaders/cube_to_dp.glsl index 0b3f53a870..b44aab8946 100644 --- a/drivers/gles2/shaders/cube_to_dp.glsl +++ b/drivers/gles2/shaders/cube_to_dp.glsl @@ -39,55 +39,53 @@ uniform highp float bias; void main() { - highp vec3 normal = vec3( uv_interp * 2.0 - 1.0, 0.0 ); -/* - if(z_flip) { - normal.z = 0.5 - 0.5*((normal.x * normal.x) + (normal.y * normal.y)); + highp vec3 normal = vec3(uv_interp * 2.0 - 1.0, 0.0); + /* + if (z_flip) { + normal.z = 0.5 - 0.5 * ((normal.x * normal.x) + (normal.y * normal.y)); } else { - normal.z = -0.5 + 0.5*((normal.x * normal.x) + (normal.y * normal.y)); + normal.z = -0.5 + 0.5 * ((normal.x * normal.x) + (normal.y * normal.y)); } -*/ + */ - //normal.z = sqrt(1.0-dot(normal.xy,normal.xy)); - //normal.xy*=1.0+normal.z; + //normal.z = sqrt(1.0 - dot(normal.xy, normal.xy)); + //normal.xy *= 1.0 + normal.z; - normal.z = 0.5 - 0.5*((normal.x * normal.x) + (normal.y * normal.y)); + normal.z = 0.5 - 0.5 * ((normal.x * normal.x) + (normal.y * normal.y)); normal = normalize(normal); + /* + normal.z = 0.5; + normal = normalize(normal); + */ -/* - normal.z=0.5; - normal=normalize(normal); -*/ if (!z_flip) { - normal.z=-normal.z; + normal.z = -normal.z; } //normal = normalize(vec3( uv_interp * 2.0 - 1.0, 1.0 )); - float depth = textureCube(source_cube,normal).r; + float depth = textureCube(source_cube, normal).r; // absolute values for direction cosines, bigger value equals closer to basis axis vec3 unorm = abs(normal); - if ( (unorm.x >= unorm.y) && (unorm.x >= unorm.z) ) { - // x code - unorm = normal.x > 0.0 ? vec3( 1.0, 0.0, 0.0 ) : vec3( -1.0, 0.0, 0.0 ) ; - } else if ( (unorm.y > unorm.x) && (unorm.y >= unorm.z) ) { - // y code - unorm = normal.y > 0.0 ? vec3( 0.0, 1.0, 0.0 ) : vec3( 0.0, -1.0, 0.0 ) ; - } else if ( (unorm.z > unorm.x) && (unorm.z > unorm.y) ) { - // z code - unorm = normal.z > 0.0 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 0.0, 0.0, -1.0 ) ; + if ((unorm.x >= unorm.y) && (unorm.x >= unorm.z)) { + // x code + unorm = normal.x > 0.0 ? vec3(1.0, 0.0, 0.0) : vec3(-1.0, 0.0, 0.0); + } else if ((unorm.y > unorm.x) && (unorm.y >= unorm.z)) { + // y code + unorm = normal.y > 0.0 ? vec3(0.0, 1.0, 0.0) : vec3(0.0, -1.0, 0.0); + } else if ((unorm.z > unorm.x) && (unorm.z > unorm.y)) { + // z code + unorm = normal.z > 0.0 ? vec3(0.0, 0.0, 1.0) : vec3(0.0, 0.0, -1.0); } else { - // oh-no we messed up code - // has to be - unorm = vec3( 1.0, 0.0, 0.0 ); + // oh-no we messed up code + // has to be + unorm = vec3(1.0, 0.0, 0.0); } - float depth_fix = 1.0 / dot(normal,unorm); - + float depth_fix = 1.0 / dot(normal, unorm); depth = 2.0 * depth - 1.0; float linear_depth = 2.0 * z_near * z_far / (z_far + z_near - depth * (z_far - z_near)); - gl_FragDepth = (linear_depth*depth_fix+bias) / z_far; + gl_FragDepth = (linear_depth * depth_fix + bias) / z_far; } - diff --git a/drivers/gles2/shaders/cubemap_filter.glsl b/drivers/gles2/shaders/cubemap_filter.glsl index 62ecd9471b..0d60104480 100644 --- a/drivers/gles2/shaders/cubemap_filter.glsl +++ b/drivers/gles2/shaders/cubemap_filter.glsl @@ -15,13 +15,18 @@ varying highp vec2 uv_interp; void main() { - uv_interp=uv; - gl_Position=vec4(vertex,0,1); + uv_interp = uv; + gl_Position = vec4(vertex, 0, 1); } [fragment] -#extension GL_ARB_shader_texture_lod : require +#extension GL_ARB_shader_texture_lod : enable + +#ifndef GL_ARB_shader_texture_lod +#define texture2DLod(img, coord, lod) texture2D(img, coord) +#define textureCubeLod(img, coord, lod) textureCube(img, coord) +#endif #ifdef USE_GLES_OVER_GL #define mediump @@ -60,17 +65,15 @@ uniform sampler2D radical_inverse_vdc_cache; // texunit:1 vec4 texturePanorama(sampler2D pano, vec3 normal) { vec2 st = vec2( - atan(normal.x, normal.z), - acos(normal.y) - ); + atan(normal.x, normal.z), + acos(normal.y)); - if(st.x < 0.0) - st.x += M_PI*2.0; + if (st.x < 0.0) + st.x += M_PI * 2.0; - st/=vec2(M_PI*2.0,M_PI); - - return texture2DLod(pano,st,0.0); + st /= vec2(M_PI * 2.0, M_PI); + return texture2DLod(pano, st, 0.0); } #endif @@ -79,24 +82,24 @@ vec3 texelCoordToVec(vec2 uv, int faceID) { mat3 faceUvVectors[6]; // -x - faceUvVectors[0][0] = vec3(0.0, 0.0, 1.0); // u -> +z + faceUvVectors[0][0] = vec3(0.0, 0.0, 1.0); // u -> +z faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y faceUvVectors[0][2] = vec3(-1.0, 0.0, 0.0); // -x face // +x faceUvVectors[1][0] = vec3(0.0, 0.0, -1.0); // u -> -z faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y - faceUvVectors[1][2] = vec3(1.0, 0.0, 0.0); // +x face + faceUvVectors[1][2] = vec3(1.0, 0.0, 0.0); // +x face // -y - faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x faceUvVectors[2][1] = vec3(0.0, 0.0, -1.0); // v -> -z faceUvVectors[2][2] = vec3(0.0, -1.0, 0.0); // -y face // +y - faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x - faceUvVectors[3][1] = vec3(0.0, 0.0, 1.0); // v -> +z - faceUvVectors[3][2] = vec3(0.0, 1.0, 0.0); // +y face + faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[3][1] = vec3(0.0, 0.0, 1.0); // v -> +z + faceUvVectors[3][2] = vec3(0.0, 1.0, 0.0); // +y face // -z faceUvVectors[4][0] = vec3(-1.0, 0.0, 0.0); // u -> -x @@ -104,9 +107,9 @@ vec3 texelCoordToVec(vec2 uv, int faceID) { faceUvVectors[4][2] = vec3(0.0, 0.0, -1.0); // -z face // +z - faceUvVectors[5][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[5][0] = vec3(1.0, 0.0, 0.0); // u -> +x faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y - faceUvVectors[5][2] = vec3(0.0, 0.0, 1.0); // +z face + faceUvVectors[5][2] = vec3(0.0, 0.0, 1.0); // +z face // out = u * s_faceUv[0] + v * s_faceUv[1] + s_faceUv[2]. vec3 result = (faceUvVectors[faceID][0] * uv.x) + (faceUvVectors[faceID][1] * uv.y) + faceUvVectors[faceID][2]; @@ -118,7 +121,7 @@ vec3 ImportanceSampleGGX(vec2 Xi, float Roughness, vec3 N) { // Compute distribution direction float Phi = 2.0 * M_PI * Xi.x; - float CosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a*a - 1.0) * Xi.y)); + float CosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a * a - 1.0) * Xi.y)); float SinTheta = sqrt(1.0 - CosTheta * CosTheta); // Convert to spherical direction @@ -167,21 +170,17 @@ void main() { if (NdotL > 0.0) { #ifdef USE_SOURCE_PANORAMA - sum.rgb += texturePanorama(source_panorama, H).rgb * NdotL; + sum.rgb += texturePanorama(source_panorama, L).rgb * NdotL; #else - H.y = -H.y; - sum.rgb += textureCubeLod(source_cube, H, 0.0).rgb * NdotL; + L.y = -L.y; + sum.rgb += textureCubeLod(source_cube, L, 0.0).rgb * NdotL; #endif sum.a += NdotL; - } - } sum /= sum.a; gl_FragColor = vec4(sum.rgb, 1.0); - } - diff --git a/drivers/gles2/shaders/effect_blur.glsl b/drivers/gles2/shaders/effect_blur.glsl index b5f98a1244..0e2d28af20 100644 --- a/drivers/gles2/shaders/effect_blur.glsl +++ b/drivers/gles2/shaders/effect_blur.glsl @@ -1,8 +1,7 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; -layout(location=4) in vec2 uv_in; +layout(location = 0) in highp vec4 vertex_attrib; +layout(location = 4) in vec2 uv_in; out vec2 uv_interp; @@ -39,7 +38,6 @@ uniform sampler2D source_ssao; //texunit:1 uniform float lod; uniform vec2 pixel_size; - layout(location = 0) out vec4 frag_color; #ifdef SSAO_MERGE @@ -48,31 +46,31 @@ uniform vec4 ssao_color; #endif -#if defined (GLOW_GAUSSIAN_HORIZONTAL) || defined(GLOW_GAUSSIAN_VERTICAL) +#if defined(GLOW_GAUSSIAN_HORIZONTAL) || defined(GLOW_GAUSSIAN_VERTICAL) uniform float glow_strength; #endif -#if defined(DOF_FAR_BLUR) || defined (DOF_NEAR_BLUR) +#if defined(DOF_FAR_BLUR) || defined(DOF_NEAR_BLUR) #ifdef DOF_QUALITY_LOW -const int dof_kernel_size=5; -const int dof_kernel_from=2; -const float dof_kernel[5] = float[] (0.153388,0.221461,0.250301,0.221461,0.153388); +const int dof_kernel_size = 5; +const int dof_kernel_from = 2; +const float dof_kernel[5] = float[](0.153388, 0.221461, 0.250301, 0.221461, 0.153388); #endif #ifdef DOF_QUALITY_MEDIUM -const int dof_kernel_size=11; -const int dof_kernel_from=5; -const float dof_kernel[11] = float[] (0.055037,0.072806,0.090506,0.105726,0.116061,0.119726,0.116061,0.105726,0.090506,0.072806,0.055037); +const int dof_kernel_size = 11; +const int dof_kernel_from = 5; +const float dof_kernel[11] = float[](0.055037, 0.072806, 0.090506, 0.105726, 0.116061, 0.119726, 0.116061, 0.105726, 0.090506, 0.072806, 0.055037); #endif #ifdef DOF_QUALITY_HIGH -const int dof_kernel_size=21; -const int dof_kernel_from=10; -const float dof_kernel[21] = float[] (0.028174,0.032676,0.037311,0.041944,0.046421,0.050582,0.054261,0.057307,0.059587,0.060998,0.061476,0.060998,0.059587,0.057307,0.054261,0.050582,0.046421,0.041944,0.037311,0.032676,0.028174); +const int dof_kernel_size = 21; +const int dof_kernel_from = 10; +const float dof_kernel[21] = float[](0.028174, 0.032676, 0.037311, 0.041944, 0.046421, 0.050582, 0.054261, 0.057307, 0.059587, 0.060998, 0.061476, 0.060998, 0.059587, 0.057307, 0.054261, 0.050582, 0.046421, 0.041944, 0.037311, 0.032676, 0.028174); #endif uniform sampler2D dof_source_depth; //texunit:1 @@ -88,7 +86,6 @@ uniform sampler2D source_dof_original; //texunit:2 #endif - #ifdef GLOW_FIRST_PASS uniform float exposure; @@ -112,53 +109,51 @@ uniform float camera_z_near; void main() { - - #ifdef GAUSSIAN_HORIZONTAL vec2 pix_size = pixel_size; - pix_size*=0.5; //reading from larger buffer, so use more samples - vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pix_size,lod )*0.214607; - color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pix_size,lod )*0.189879; - color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pix_size,lod )*0.157305; - color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pix_size,lod )*0.071303; - color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pix_size,lod )*0.189879; - color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pix_size,lod )*0.157305; - color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pix_size,lod )*0.071303; + pix_size *= 0.5; //reading from larger buffer, so use more samples + vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pix_size, lod) * 0.214607; + color += textureLod(source_color, uv_interp + vec2(1.0, 0.0) * pix_size, lod) * 0.189879; + color += textureLod(source_color, uv_interp + vec2(2.0, 0.0) * pix_size, lod) * 0.157305; + color += textureLod(source_color, uv_interp + vec2(3.0, 0.0) * pix_size, lod) * 0.071303; + color += textureLod(source_color, uv_interp + vec2(-1.0, 0.0) * pix_size, lod) * 0.189879; + color += textureLod(source_color, uv_interp + vec2(-2.0, 0.0) * pix_size, lod) * 0.157305; + color += textureLod(source_color, uv_interp + vec2(-3.0, 0.0) * pix_size, lod) * 0.071303; frag_color = color; #endif #ifdef GAUSSIAN_VERTICAL - vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pixel_size,lod )*0.38774; - color+=textureLod( source_color, uv_interp+vec2( 0.0, 1.0)*pixel_size,lod )*0.24477; - color+=textureLod( source_color, uv_interp+vec2( 0.0, 2.0)*pixel_size,lod )*0.06136; - color+=textureLod( source_color, uv_interp+vec2( 0.0,-1.0)*pixel_size,lod )*0.24477; - color+=textureLod( source_color, uv_interp+vec2( 0.0,-2.0)*pixel_size,lod )*0.06136; + vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pixel_size, lod) * 0.38774; + color += textureLod(source_color, uv_interp + vec2(0.0, 1.0) * pixel_size, lod) * 0.24477; + color += textureLod(source_color, uv_interp + vec2(0.0, 2.0) * pixel_size, lod) * 0.06136; + color += textureLod(source_color, uv_interp + vec2(0.0, -1.0) * pixel_size, lod) * 0.24477; + color += textureLod(source_color, uv_interp + vec2(0.0, -2.0) * pixel_size, lod) * 0.06136; frag_color = color; #endif -//glow uses larger sigma for a more rounded blur effect + //glow uses larger sigma for a more rounded blur effect #ifdef GLOW_GAUSSIAN_HORIZONTAL vec2 pix_size = pixel_size; - pix_size*=0.5; //reading from larger buffer, so use more samples - vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pix_size,lod )*0.174938; - color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pix_size,lod )*0.165569; - color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pix_size,lod )*0.140367; - color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pix_size,lod )*0.106595; - color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pix_size,lod )*0.165569; - color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pix_size,lod )*0.140367; - color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pix_size,lod )*0.106595; - color*=glow_strength; + pix_size *= 0.5; //reading from larger buffer, so use more samples + vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pix_size, lod) * 0.174938; + color += textureLod(source_color, uv_interp + vec2(1.0, 0.0) * pix_size, lod) * 0.165569; + color += textureLod(source_color, uv_interp + vec2(2.0, 0.0) * pix_size, lod) * 0.140367; + color += textureLod(source_color, uv_interp + vec2(3.0, 0.0) * pix_size, lod) * 0.106595; + color += textureLod(source_color, uv_interp + vec2(-1.0, 0.0) * pix_size, lod) * 0.165569; + color += textureLod(source_color, uv_interp + vec2(-2.0, 0.0) * pix_size, lod) * 0.140367; + color += textureLod(source_color, uv_interp + vec2(-3.0, 0.0) * pix_size, lod) * 0.106595; + color *= glow_strength; frag_color = color; #endif #ifdef GLOW_GAUSSIAN_VERTICAL - vec4 color =textureLod( source_color, uv_interp+vec2(0.0, 0.0)*pixel_size,lod )*0.288713; - color+=textureLod( source_color, uv_interp+vec2(0.0, 1.0)*pixel_size,lod )*0.233062; - color+=textureLod( source_color, uv_interp+vec2(0.0, 2.0)*pixel_size,lod )*0.122581; - color+=textureLod( source_color, uv_interp+vec2(0.0,-1.0)*pixel_size,lod )*0.233062; - color+=textureLod( source_color, uv_interp+vec2(0.0,-2.0)*pixel_size,lod )*0.122581; - color*=glow_strength; + vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pixel_size, lod) * 0.288713; + color += textureLod(source_color, uv_interp + vec2(0.0, 1.0) * pixel_size, lod) * 0.233062; + color += textureLod(source_color, uv_interp + vec2(0.0, 2.0) * pixel_size, lod) * 0.122581; + color += textureLod(source_color, uv_interp + vec2(0.0, -1.0) * pixel_size, lod) * 0.233062; + color += textureLod(source_color, uv_interp + vec2(0.0, -2.0) * pixel_size, lod) * 0.122581; + color *= glow_strength; frag_color = color; #endif @@ -166,47 +161,45 @@ void main() { vec4 color_accum = vec4(0.0); - float depth = textureLod( dof_source_depth, uv_interp, 0.0).r; + float depth = textureLod(dof_source_depth, uv_interp, 0.0).r; depth = depth * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + depth = ((depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near)); #endif - float amount = smoothstep(dof_begin,dof_end,depth); - float k_accum=0.0; + float amount = smoothstep(dof_begin, dof_end, depth); + float k_accum = 0.0; - for(int i=0;i<dof_kernel_size;i++) { + for (int i = 0; i < dof_kernel_size; i++) { - int int_ofs = i-dof_kernel_from; + int int_ofs = i - dof_kernel_from; vec2 tap_uv = uv_interp + dof_dir * float(int_ofs) * amount * dof_radius; float tap_k = dof_kernel[i]; - float tap_depth = texture( dof_source_depth, tap_uv, 0.0).r; + float tap_depth = texture(dof_source_depth, tap_uv, 0.0).r; tap_depth = tap_depth * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - tap_depth = ((tap_depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + tap_depth = ((tap_depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else tap_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - tap_depth * (camera_z_far - camera_z_near)); #endif - float tap_amount = mix(smoothstep(dof_begin,dof_end,tap_depth),1.0,int_ofs==0); - tap_amount*=tap_amount*tap_amount; //prevent undesired glow effect - - vec4 tap_color = textureLod( source_color, tap_uv, 0.0) * tap_k; - - k_accum+=tap_k*tap_amount; - color_accum+=tap_color*tap_amount; + float tap_amount = mix(smoothstep(dof_begin, dof_end, tap_depth), 1.0, int_ofs == 0); + tap_amount *= tap_amount * tap_amount; //prevent undesired glow effect + vec4 tap_color = textureLod(source_color, tap_uv, 0.0) * tap_k; + k_accum += tap_k * tap_amount; + color_accum += tap_color * tap_amount; } - if (k_accum>0.0) { - color_accum/=k_accum; + if (k_accum > 0.0) { + color_accum /= k_accum; } - frag_color = color_accum;///k_accum; + frag_color = color_accum; ///k_accum; #endif @@ -214,47 +207,45 @@ void main() { vec4 color_accum = vec4(0.0); - float max_accum=0; + float max_accum = 0; - for(int i=0;i<dof_kernel_size;i++) { + for (int i = 0; i < dof_kernel_size; i++) { - int int_ofs = i-dof_kernel_from; + int int_ofs = i - dof_kernel_from; vec2 tap_uv = uv_interp + dof_dir * float(int_ofs) * dof_radius; - float ofs_influence = max(0.0,1.0-float(abs(int_ofs))/float(dof_kernel_from)); + float ofs_influence = max(0.0, 1.0 - float(abs(int_ofs)) / float(dof_kernel_from)); float tap_k = dof_kernel[i]; - vec4 tap_color = textureLod( source_color, tap_uv, 0.0); + vec4 tap_color = textureLod(source_color, tap_uv, 0.0); - float tap_depth = texture( dof_source_depth, tap_uv, 0.0).r; + float tap_depth = texture(dof_source_depth, tap_uv, 0.0).r; tap_depth = tap_depth * 2.0 - 1.0; -#ifdef USE_ORTHOGONAL_PROJECTION - tap_depth = ((tap_depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; +#ifdef USE_ORTHOGONAL_PROJECTION + tap_depth = ((tap_depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else tap_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - tap_depth * (camera_z_far - camera_z_near)); #endif - float tap_amount = 1.0-smoothstep(dof_end,dof_begin,tap_depth); - tap_amount*=tap_amount*tap_amount; //prevent undesired glow effect + float tap_amount = 1.0 - smoothstep(dof_end, dof_begin, tap_depth); + tap_amount *= tap_amount * tap_amount; //prevent undesired glow effect #ifdef DOF_NEAR_FIRST_TAP - tap_color.a= 1.0-smoothstep(dof_end,dof_begin,tap_depth); + tap_color.a = 1.0 - smoothstep(dof_end, dof_begin, tap_depth); #endif - max_accum=max(max_accum,tap_amount*ofs_influence); - - color_accum+=tap_color*tap_k; + max_accum = max(max_accum, tap_amount * ofs_influence); + color_accum += tap_color * tap_k; } - color_accum.a=max(color_accum.a,sqrt(max_accum)); - + color_accum.a = max(color_accum.a, sqrt(max_accum)); #ifdef DOF_NEAR_BLUR_MERGE - vec4 original = textureLod( source_dof_original, uv_interp, 0.0); - color_accum = mix(original,color_accum,color_accum.a); + vec4 original = textureLod(source_dof_original, uv_interp, 0.0); + color_accum = mix(original, color_accum, color_accum.a); #endif @@ -265,37 +256,32 @@ void main() { #endif - - #ifdef GLOW_FIRST_PASS #ifdef GLOW_USE_AUTO_EXPOSURE - frag_color/=texelFetch(source_auto_exposure,ivec2(0,0),0).r/auto_exposure_grey; + frag_color /= texelFetch(source_auto_exposure, ivec2(0, 0), 0).r / auto_exposure_grey; #endif - frag_color*=exposure; + frag_color *= exposure; - float luminance = max(frag_color.r,max(frag_color.g,frag_color.b)); - float feedback = max( smoothstep(glow_hdr_threshold,glow_hdr_threshold+glow_hdr_scale,luminance), glow_bloom ); + float luminance = max(frag_color.r, max(frag_color.g, frag_color.b)); + float feedback = max(smoothstep(glow_hdr_threshold, glow_hdr_threshold + glow_hdr_scale, luminance), glow_bloom); frag_color *= feedback; #endif - #ifdef SIMPLE_COPY - vec4 color =textureLod( source_color, uv_interp,0.0); + vec4 color = textureLod(source_color, uv_interp, 0.0); frag_color = color; #endif #ifdef SSAO_MERGE - vec4 color =textureLod( source_color, uv_interp,0.0); - float ssao =textureLod( source_ssao, uv_interp,0.0).r; + vec4 color = textureLod(source_color, uv_interp, 0.0); + float ssao = textureLod(source_ssao, uv_interp, 0.0).r; - frag_color = vec4( mix(color.rgb,color.rgb*mix(ssao_color.rgb,vec3(1.0),ssao),color.a), 1.0 ); + frag_color = vec4(mix(color.rgb, color.rgb * mix(ssao_color.rgb, vec3(1.0), ssao), color.a), 1.0); #endif - - } diff --git a/drivers/gles2/shaders/exposure.glsl b/drivers/gles2/shaders/exposure.glsl index 001b90a0f1..18fff1ae36 100644 --- a/drivers/gles2/shaders/exposure.glsl +++ b/drivers/gles2/shaders/exposure.glsl @@ -1,18 +1,14 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; - +layout(location = 0) in highp vec4 vertex_attrib; void main() { gl_Position = vertex_attrib; - } [fragment] - uniform highp sampler2D source_exposure; //texunit:0 #ifdef EXPOSURE_BEGIN @@ -33,66 +29,56 @@ uniform highp float max_luminance; layout(location = 0) out highp float exposure; - - void main() { - - #ifdef EXPOSURE_BEGIN - - ivec2 src_pos = ivec2(gl_FragCoord.xy)*source_render_size/target_size; + ivec2 src_pos = ivec2(gl_FragCoord.xy) * source_render_size / target_size; #if 1 //more precise and expensive, but less jittery - ivec2 next_pos = ivec2(gl_FragCoord.xy+ivec2(1))*source_render_size/target_size; - next_pos = max(next_pos,src_pos+ivec2(1)); //so it at least reads one pixel - highp vec3 source_color=vec3(0.0); - for(int i=src_pos.x;i<next_pos.x;i++) { - for(int j=src_pos.y;j<next_pos.y;j++) { - source_color += texelFetch(source_exposure,ivec2(i,j),0).rgb; + ivec2 next_pos = ivec2(gl_FragCoord.xy + ivec2(1)) * source_render_size / target_size; + next_pos = max(next_pos, src_pos + ivec2(1)); //so it at least reads one pixel + highp vec3 source_color = vec3(0.0); + for (int i = src_pos.x; i < next_pos.x; i++) { + for (int j = src_pos.y; j < next_pos.y; j++) { + source_color += texelFetch(source_exposure, ivec2(i, j), 0).rgb; } } - source_color/=float( (next_pos.x-src_pos.x)*(next_pos.y-src_pos.y) ); + source_color /= float((next_pos.x - src_pos.x) * (next_pos.y - src_pos.y)); #else - highp vec3 source_color = texelFetch(source_exposure,src_pos,0).rgb; + highp vec3 source_color = texelFetch(source_exposure, src_pos, 0).rgb; #endif - exposure = max(source_color.r,max(source_color.g,source_color.b)); + exposure = max(source_color.r, max(source_color.g, source_color.b)); #else ivec2 coord = ivec2(gl_FragCoord.xy); - exposure = texelFetch(source_exposure,coord*3+ivec2(0,0),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(1,0),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(2,0),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(0,1),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(1,1),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(2,1),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(0,2),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(1,2),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(2,2),0).r; - exposure *= (1.0/9.0); + exposure = texelFetch(source_exposure, coord * 3 + ivec2(0, 0), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(1, 0), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(2, 0), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(0, 1), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(1, 1), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(2, 1), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(0, 2), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(1, 2), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(2, 2), 0).r; + exposure *= (1.0 / 9.0); #ifdef EXPOSURE_END #ifdef EXPOSURE_FORCE_SET //will stay as is #else - highp float prev_lum = texelFetch(prev_exposure,ivec2(0,0),0).r; //1 pixel previous exposure - exposure = clamp( prev_lum + (exposure-prev_lum)*exposure_adjust,min_luminance,max_luminance); + highp float prev_lum = texelFetch(prev_exposure, ivec2(0, 0), 0).r; //1 pixel previous exposure + exposure = clamp(prev_lum + (exposure - prev_lum) * exposure_adjust, min_luminance, max_luminance); #endif //EXPOSURE_FORCE_SET - #endif //EXPOSURE_END #endif //EXPOSURE_BEGIN - - } - - diff --git a/drivers/gles2/shaders/particles.glsl b/drivers/gles2/shaders/particles.glsl index a62c124dfe..5af4b65b28 100644 --- a/drivers/gles2/shaders/particles.glsl +++ b/drivers/gles2/shaders/particles.glsl @@ -1,14 +1,11 @@ [vertex] - - -layout(location=0) in highp vec4 color; -layout(location=1) in highp vec4 velocity_active; -layout(location=2) in highp vec4 custom; -layout(location=3) in highp vec4 xform_1; -layout(location=4) in highp vec4 xform_2; -layout(location=5) in highp vec4 xform_3; - +layout(location = 0) in highp vec4 color; +layout(location = 1) in highp vec4 velocity_active; +layout(location = 2) in highp vec4 custom; +layout(location = 3) in highp vec4 xform_1; +layout(location = 4) in highp vec4 xform_2; +layout(location = 5) in highp vec4 xform_3; struct Attractor { @@ -39,7 +36,6 @@ uniform float lifetime; uniform mat4 emission_transform; uniform uint random_seed; - out highp vec4 out_color; //tfb: out highp vec4 out_velocity_active; //tfb: out highp vec4 out_custom; //tfb: @@ -47,7 +43,6 @@ out highp vec4 out_xform_1; //tfb: out highp vec4 out_xform_2; //tfb: out highp vec4 out_xform_3; //tfb: - #if defined(USE_MATERIAL) layout(std140) uniform UniformData { //ubo:0 @@ -58,7 +53,6 @@ MATERIAL_UNIFORMS #endif - VERTEX_SHADER_GLOBALS uint hash(uint x) { @@ -69,13 +63,12 @@ uint hash(uint x) { return x; } - void main() { #ifdef PARTICLES_COPY - out_color=color; - out_velocity_active=velocity_active; + out_color = color; + out_velocity_active = velocity_active; out_custom = custom; out_xform_1 = xform_1; out_xform_2 = xform_2; @@ -83,34 +76,34 @@ void main() { #else - bool apply_forces=true; - bool apply_velocity=true; - float local_delta=delta; + bool apply_forces = true; + bool apply_velocity = true; + float local_delta = delta; float mass = 1.0; - float restart_phase = float(gl_VertexID)/float(total_particles); + float restart_phase = float(gl_VertexID) / float(total_particles); - if (randomness>0.0) { + if (randomness > 0.0) { uint seed = cycle; if (restart_phase >= system_phase) { - seed-=uint(1); + seed -= uint(1); } - seed*=uint(total_particles); - seed+=uint(gl_VertexID); + seed *= uint(total_particles); + seed += uint(gl_VertexID); float random = float(hash(seed) % uint(65536)) / 65536.0; - restart_phase+=randomness * random * 1.0 / float(total_particles); + restart_phase += randomness * random * 1.0 / float(total_particles); } - restart_phase*= (1.0-explosiveness); - bool restart=false; + restart_phase *= (1.0 - explosiveness); + bool restart = false; bool shader_active = velocity_active.a > 0.5; if (system_phase > prev_system_phase) { // restart_phase >= prev_system_phase is used so particles emit in the first frame they are processed - if (restart_phase >= prev_system_phase && restart_phase < system_phase ) { - restart=true; + if (restart_phase >= prev_system_phase && restart_phase < system_phase) { + restart = true; #ifdef USE_FRACTIONAL_DELTA local_delta = (system_phase - restart_phase) * lifetime; #endif @@ -118,12 +111,12 @@ void main() { } else { if (restart_phase >= prev_system_phase) { - restart=true; + restart = true; #ifdef USE_FRACTIONAL_DELTA local_delta = (1.0 - restart_phase + system_phase) * lifetime; #endif - } else if (restart_phase < system_phase ) { - restart=true; + } else if (restart_phase < system_phase) { + restart = true; #ifdef USE_FRACTIONAL_DELTA local_delta = (system_phase - restart_phase) * lifetime; #endif @@ -133,14 +126,14 @@ void main() { uint current_cycle = cycle; if (system_phase < restart_phase) { - current_cycle-=uint(1); + current_cycle -= uint(1); } uint particle_number = current_cycle * uint(total_particles) + uint(gl_VertexID); int index = int(gl_VertexID); if (restart) { - shader_active=emitting; + shader_active = emitting; } mat4 xform; @@ -150,30 +143,31 @@ void main() { #else if (clear || restart) { #endif - out_color=vec4(1.0); - out_velocity_active=vec4(0.0); - out_custom=vec4(0.0); + out_color = vec4(1.0); + out_velocity_active = vec4(0.0); + out_custom = vec4(0.0); if (!restart) - shader_active=false; + shader_active = false; xform = mat4( - vec4(1.0,0.0,0.0,0.0), - vec4(0.0,1.0,0.0,0.0), - vec4(0.0,0.0,1.0,0.0), - vec4(0.0,0.0,0.0,1.0) - ); + vec4(1.0, 0.0, 0.0, 0.0), + vec4(0.0, 1.0, 0.0, 0.0), + vec4(0.0, 0.0, 1.0, 0.0), + vec4(0.0, 0.0, 0.0, 1.0)); } else { - out_color=color; - out_velocity_active=velocity_active; - out_custom=custom; - xform = transpose(mat4(xform_1,xform_2,xform_3,vec4(vec3(0.0),1.0))); + out_color = color; + out_velocity_active = velocity_active; + out_custom = custom; + xform = transpose(mat4(xform_1, xform_2, xform_3, vec4(vec3(0.0), 1.0))); } if (shader_active) { //execute shader { + VERTEX_SHADER_CODE + } #if !defined(DISABLE_FORCE) @@ -181,26 +175,25 @@ VERTEX_SHADER_CODE if (false) { vec3 force = vec3(0.0); - for(int i=0;i<attractor_count;i++) { + for (int i = 0; i < attractor_count; i++) { vec3 rel_vec = xform[3].xyz - attractors[i].pos; float dist = length(rel_vec); if (attractors[i].radius < dist) continue; - if (attractors[i].eat_radius>0.0 && attractors[i].eat_radius > dist) { - out_velocity_active.a=0.0; + if (attractors[i].eat_radius > 0.0 && attractors[i].eat_radius > dist) { + out_velocity_active.a = 0.0; } rel_vec = normalize(rel_vec); - float attenuation = pow(dist / attractors[i].radius,attractors[i].attenuation); + float attenuation = pow(dist / attractors[i].radius, attractors[i].attenuation); - if (attractors[i].dir==vec3(0.0)) { + if (attractors[i].dir == vec3(0.0)) { //towards center - force+=attractors[i].strength * rel_vec * attenuation * mass; + force += attractors[i].strength * rel_vec * attenuation * mass; } else { - force+=attractors[i].strength * attractors[i].dir * attenuation *mass; - + force += attractors[i].strength * attractors[i].dir * attenuation * mass; } } @@ -216,26 +209,24 @@ VERTEX_SHADER_CODE } #endif } else { - xform=mat4(0.0); + xform = mat4(0.0); } xform = transpose(xform); - out_velocity_active.a = mix(0.0,1.0,shader_active); + out_velocity_active.a = mix(0.0, 1.0, shader_active); out_xform_1 = xform[0]; out_xform_2 = xform[1]; out_xform_3 = xform[2]; #endif //PARTICLES_COPY - } [fragment] //any code here is never executed, stuff is filled just so it works - #if defined(USE_MATERIAL) layout(std140) uniform UniformData { diff --git a/drivers/gles2/shaders/resolve.glsl b/drivers/gles2/shaders/resolve.glsl index 0b50a9c57b..05bb922eec 100644 --- a/drivers/gles2/shaders/resolve.glsl +++ b/drivers/gles2/shaders/resolve.glsl @@ -1,12 +1,10 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; -layout(location=4) in vec2 uv_in; +layout(location = 0) in highp vec4 vertex_attrib; +layout(location = 4) in vec2 uv_in; out vec2 uv_interp; - void main() { uv_interp = uv_in; @@ -31,14 +29,12 @@ layout(location = 0) out vec4 frag_color; void main() { - vec4 specular = texture( source_specular, uv_interp ); + vec4 specular = texture(source_specular, uv_interp); #ifdef USE_SSR - - vec4 ssr = textureLod(source_ssr,uv_interp,0.0); - specular.rgb = mix(specular.rgb,ssr.rgb*specular.a,ssr.a); + vec4 ssr = textureLod(source_ssr, uv_interp, 0.0); + specular.rgb = mix(specular.rgb, ssr.rgb * specular.a, ssr.a); #endif - frag_color = vec4(specular.rgb,1.0); + frag_color = vec4(specular.rgb, 1.0); } - diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl index 3e64c92e96..8bcb3b5f1d 100644 --- a/drivers/gles2/shaders/scene.glsl +++ b/drivers/gles2/shaders/scene.glsl @@ -10,8 +10,6 @@ precision mediump int; #include "stdlib.glsl" - - // // attributes // @@ -66,8 +64,6 @@ attribute highp vec4 instance_custom_data; // attrib:8 #endif - - // // uniforms // @@ -88,7 +84,6 @@ uniform float light_bias; uniform float light_normal_bias; #endif - // // varyings // @@ -113,7 +108,6 @@ varying vec2 uv_interp; varying vec2 uv2_interp; #endif - VERTEX_SHADER_GLOBALS void main() { @@ -124,10 +118,11 @@ void main() { #ifdef USE_INSTANCING { - highp mat4 m = mat4(instance_xform_row_0, - instance_xform_row_1, - instance_xform_row_2, - vec4(0.0, 0.0, 0.0, 1.0)); + highp mat4 m = mat4( + instance_xform_row_0, + instance_xform_row_1, + instance_xform_row_2, + vec4(0.0, 0.0, 0.0, 1.0)); world_matrix = world_matrix * transpose(m); } #endif @@ -161,14 +156,14 @@ void main() { normal = normalize((world_matrix * vec4(normal, 0.0)).xyz); #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) - tangent = normalize((world_matrix * vec4(tangent, 0.0)),xyz); + tangent = normalize((world_matrix * vec4(tangent, 0.0)), xyz); binormal = normalize((world_matrix * vec4(binormal, 0.0)).xyz); #endif #endif #ifdef USE_SKELETON - highp mat4 bone_transform = mat4(1.0); + highp mat4 bone_transform = mat4(0.0); #ifdef USE_SKELETON_SOFTWARE // passing the transform as attributes @@ -185,10 +180,11 @@ void main() { for (int i = 0; i < 4; i++) { ivec2 tex_ofs = ivec2(int(bone_ids[i]) * 3, 0); - highp mat4 b = mat4(texel2DFetch(bone_transforms, skeleton_texture_size, tex_ofs + ivec2(0, 0)), - texel2DFetch(bone_transforms, skeleton_texture_size, tex_ofs + ivec2(1, 0)), - texel2DFetch(bone_transforms, skeleton_texture_size, tex_ofs + ivec2(2, 0)), - vec4(0.0, 0.0, 0.0, 1.0)); + highp mat4 b = mat4( + texel2DFetch(bone_transforms, skeleton_texture_size, tex_ofs + ivec2(0, 0)), + texel2DFetch(bone_transforms, skeleton_texture_size, tex_ofs + ivec2(1, 0)), + texel2DFetch(bone_transforms, skeleton_texture_size, tex_ofs + ivec2(2, 0)), + vec4(0.0, 0.0, 0.0, 1.0)); bone_transform += transpose(b) * bone_weights[i]; } @@ -199,7 +195,6 @@ void main() { world_matrix = bone_transform * world_matrix; #endif - #ifdef USE_INSTANCING vec4 instance_custom = instance_custom_data; #else @@ -207,7 +202,6 @@ void main() { #endif - mat4 modelview = camera_matrix * world_matrix; #define world_transform world_matrix @@ -258,11 +252,15 @@ VERTEX_SHADER_CODE #endif gl_Position = projection_matrix * vec4(vertex_interp, 1.0); - } [fragment] -#extension GL_ARB_shader_texture_lod : require +#extension GL_ARB_shader_texture_lod : enable + +#ifndef GL_ARB_shader_texture_lod +#define texture2DLod(img, coord, lod) texture2D(img, coord) +#define textureCubeLod(img, coord, lod) textureCube(img, coord) +#endif #ifdef USE_GLES_OVER_GL #define mediump @@ -289,7 +287,6 @@ uniform mat4 world_transform; uniform highp float time; - #ifdef SCREEN_UV_USED uniform vec2 screen_pixel_size; #endif @@ -343,7 +340,6 @@ uniform float light_spot_attenuation; uniform float light_spot_range; uniform float light_spot_angle; - // shadows uniform highp sampler2D light_shadow_atlas; //texunit:-4 uniform float light_has_shadow; @@ -362,7 +358,6 @@ uniform mat4 light_shadow_matrix3; uniform mat4 light_shadow_matrix4; #endif - // // varyings // @@ -397,27 +392,27 @@ vec3 metallic_to_specular_color(float metallic, float specular, vec3 albedo) { FRAGMENT_SHADER_GLOBALS - #ifdef LIGHT_PASS -void light_compute(vec3 N, - vec3 L, - vec3 V, - vec3 B, - vec3 T, - vec3 light_color, - vec3 attenuation, - vec3 diffuse_color, - vec3 transmission, - float specular_blob_intensity, - float roughness, - float metallic, - float rim, - float rim_tint, - float clearcoat, - float clearcoat_gloss, - float anisotropy, - inout vec3 diffuse_light, - inout vec3 specular_light) { +void light_compute( + vec3 N, + vec3 L, + vec3 V, + vec3 B, + vec3 T, + vec3 light_color, + vec3 attenuation, + vec3 diffuse_color, + vec3 transmission, + float specular_blob_intensity, + float roughness, + float metallic, + float rim, + float rim_tint, + float clearcoat, + float clearcoat_gloss, + float anisotropy, + inout vec3 diffuse_light, + inout vec3 specular_light) { float NdotL = dot(N, L); float cNdotL = max(NdotL, 0.0); @@ -430,7 +425,7 @@ void light_compute(vec3 N, // TODO hardcode Oren Nayar for now float diffuse_brdf_NL; - diffuse_brdf_NL = max(0.0,(NdotL + roughness) / ((1.0 + roughness) * (1.0 + roughness))); + diffuse_brdf_NL = max(0.0, (NdotL + roughness) / ((1.0 + roughness) * (1.0 + roughness))); // diffuse_brdf_NL = cNdotL * (1.0 / M_PI); diffuse_light += light_color * diffuse_color * diffuse_brdf_NL * attenuation; @@ -439,25 +434,21 @@ void light_compute(vec3 N, { // calculate specular reflection - vec3 R = normalize(-reflect(L,N)); + vec3 R = normalize(-reflect(L, N)); float cRdotV = max(dot(R, V), 0.0); float blob_intensity = pow(cRdotV, (1.0 - roughness) * 256.0); specular_light += light_color * attenuation * blob_intensity * specular_blob_intensity; - } } - - - // shadows -float sample_shadow(highp sampler2D shadow, - vec2 shadow_pixel_size, - vec2 pos, - float depth, - vec4 clamp_rect) -{ +float sample_shadow( + highp sampler2D shadow, + vec2 shadow_pixel_size, + vec2 pos, + float depth, + vec4 clamp_rect) { // vec4 depth_value = texture2D(shadow, pos); // return depth_value.z; @@ -465,11 +456,9 @@ float sample_shadow(highp sampler2D shadow, // return (depth_value.x + depth_value.y + depth_value.z + depth_value.w) / 4.0; } - #endif -void main() -{ +void main() { highp vec3 vertex = vertex_interp; vec3 albedo = vec3(1.0); @@ -493,7 +482,6 @@ void main() float ao_light_affect = 0.0; #endif - #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) vec3 binormal = normalize(binormal_interp) * side; vec3 tangent = normalize(tangent_interp) * side; @@ -508,7 +496,6 @@ void main() #endif float normaldepth = 1.0; - #ifdef ALPHA_SCISSOR_USED float alpha_scissor = 0.5; #endif @@ -521,7 +508,6 @@ void main() FRAGMENT_SHADER_CODE - } #if defined(ENABLE_NORMALMAP) @@ -567,7 +553,7 @@ FRAGMENT_SHADER_CODE vec3 attenuation = vec3(omni_attenuation); if (light_has_shadow > 0.5) { - highp vec3 splane = (light_shadow_matrix * vec4(vertex, 1.0)).xyz; + highp vec3 splane = (light_shadow_matrix * vec4(vertex, 1.0)).xyz; float shadow_len = length(splane); splane = normalize(splane); @@ -596,25 +582,26 @@ FRAGMENT_SHADER_CODE } } - light_compute(normal, - normalize(light_vec), - eye_position, - binormal, - tangent, - light_color.xyz * light_energy, - attenuation, - albedo, - transmission, - specular * light_specular, - roughness, - metallic, - rim, - rim_tint, - clearcoat, - clearcoat_gloss, - anisotropy, - diffuse_light, - specular_light); + light_compute( + normal, + normalize(light_vec), + eye_position, + binormal, + tangent, + light_color.xyz * light_energy, + attenuation, + albedo, + transmission, + specular * light_specular, + roughness, + metallic, + rim, + rim_tint, + clearcoat, + clearcoat_gloss, + anisotropy, + diffuse_light, + specular_light); } else if (light_type == LIGHT_TYPE_DIRECTIONAL) { @@ -633,133 +620,130 @@ FRAGMENT_SHADER_CODE if (depth_z < light_split_offsets.x) { #endif - vec3 pssm_coord; - float pssm_fade = 0.0; + vec3 pssm_coord; + float pssm_fade = 0.0; #ifdef LIGHT_USE_PSSM_BLEND - float pssm_blend; - vec3 pssm_coord2; - bool use_blend = true; + float pssm_blend; + vec3 pssm_coord2; + bool use_blend = true; #endif #ifdef LIGHT_USE_PSSM4 - if (depth_z < light_split_offsets.y) { - if (depth_z < light_split_offsets.x) { - highp vec4 splane = (light_shadow_matrix1 * vec4(vertex, 1.0)); - pssm_coord = splane.xyz / splane.w; + if (depth_z < light_split_offsets.y) { + if (depth_z < light_split_offsets.x) { + highp vec4 splane = (light_shadow_matrix1 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; #ifdef LIGHT_USE_PSSM_BLEND - splane = (light_shadow_matrix2 * vec4(vertex, 1.0)); - pssm_coord2 = splane.xyz / splane.w; + splane = (light_shadow_matrix2 * vec4(vertex, 1.0)); + pssm_coord2 = splane.xyz / splane.w; - pssm_blend = smoothstep(0.0, light_split_offsets.x, depth_z); + pssm_blend = smoothstep(0.0, light_split_offsets.x, depth_z); #endif - } else { - highp vec4 splane = (light_shadow_matrix2 * vec4(vertex, 1.0)); - pssm_coord = splane.xyz / splane.w; + } else { + highp vec4 splane = (light_shadow_matrix2 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; #ifdef LIGHT_USE_PSSM_BLEND - splane = (light_shadow_matrix3 * vec4(vertex, 1.0)); - pssm_coord2 = splane.xyz / splane.w; + splane = (light_shadow_matrix3 * vec4(vertex, 1.0)); + pssm_coord2 = splane.xyz / splane.w; - pssm_blend = smoothstep(light_split_offsets.x, light_split_offsets.y, depth_z); + pssm_blend = smoothstep(light_split_offsets.x, light_split_offsets.y, depth_z); #endif - } - } else { - if (depth_z < light_split_offsets.z) { + } + } else { + if (depth_z < light_split_offsets.z) { - highp vec4 splane = (light_shadow_matrix3 * vec4(vertex, 1.0)); - pssm_coord = splane.xyz / splane.w; + highp vec4 splane = (light_shadow_matrix3 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; #if defined(LIGHT_USE_PSSM_BLEND) - splane = (light_shadow_matrix4 * vec4(vertex, 1.0)); - pssm_coord2 = splane.xyz / splane.w; - pssm_blend = smoothstep(light_split_offsets.y, light_split_offsets.z, depth_z); + splane = (light_shadow_matrix4 * vec4(vertex, 1.0)); + pssm_coord2 = splane.xyz / splane.w; + pssm_blend = smoothstep(light_split_offsets.y, light_split_offsets.z, depth_z); #endif - } else { + } else { - highp vec4 splane = (light_shadow_matrix4 * vec4(vertex, 1.0)); - pssm_coord = splane.xyz / splane.w; - pssm_fade = smoothstep(light_split_offsets.z, light_split_offsets.w, depth_z); + highp vec4 splane = (light_shadow_matrix4 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; + pssm_fade = smoothstep(light_split_offsets.z, light_split_offsets.w, depth_z); #if defined(LIGHT_USE_PSSM_BLEND) - use_blend = false; + use_blend = false; #endif + } } - } #endif // LIGHT_USE_PSSM4 #ifdef LIGHT_USE_PSSM2 - if (depth_z < light_split_offsets.x) { + if (depth_z < light_split_offsets.x) { - highp vec4 splane = (light_shadow_matrix1 * vec4(vertex, 1.0)); - pssm_coord = splane.xyz / splane.w; + highp vec4 splane = (light_shadow_matrix1 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; #ifdef LIGHT_USE_PSSM_BLEND - splane = (light_shadow_matrix2 * vec4(vertex, 1.0)); - pssm_coord2 = splane.xyz / splane.w; - pssm_blend = smoothstep(0.0, light_split_offsets.x, depth_z); + splane = (light_shadow_matrix2 * vec4(vertex, 1.0)); + pssm_coord2 = splane.xyz / splane.w; + pssm_blend = smoothstep(0.0, light_split_offsets.x, depth_z); #endif - } else { - highp vec4 splane = (light_shadow_matrix2 * vec4(vertex, 1.0)); - pssm_coord = splane.xyz / splane.w; - pssm_fade = smoothstep(light_split_offsets.x, light_split_offsets.y, depth_z); + } else { + highp vec4 splane = (light_shadow_matrix2 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; + pssm_fade = smoothstep(light_split_offsets.x, light_split_offsets.y, depth_z); #ifdef LIGHT_USE_PSSM_BLEND - use_blend = false; + use_blend = false; #endif - } + } #endif // LIGHT_USE_PSSM2 #if !defined(LIGHT_USE_PSSM4) && !defined(LIGHT_USE_PSSM2) - { - highp vec4 splane = (light_shadow_matrix1 * vec4(vertex, 1.0)); - pssm_coord = splane.xyz / splane.w; - } + { + highp vec4 splane = (light_shadow_matrix1 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; + } #endif - float shadow = sample_shadow(light_shadow_atlas, vec2(0.0), pssm_coord.xy, pssm_coord.z, light_clamp); + float shadow = sample_shadow(light_shadow_atlas, vec2(0.0), pssm_coord.xy, pssm_coord.z, light_clamp); #ifdef LIGHT_USE_PSSM_BLEND - if (use_blend) { - shadow = mix(shadow, sample_shadow(light_shadow_atlas, vec2(0.0), pssm_coord2.xy, pssm_coord2.z, light_clamp), pssm_blend); - } + if (use_blend) { + shadow = mix(shadow, sample_shadow(light_shadow_atlas, vec2(0.0), pssm_coord2.xy, pssm_coord2.z, light_clamp), pssm_blend); + } #endif - attenuation *= shadow; - - - } - + attenuation *= shadow; + } } light_compute(normal, - normalize(light_vec), - eye_position, - binormal, - tangent, - light_color.xyz * light_energy, - attenuation, - albedo, - transmission, - specular * light_specular, - roughness, - metallic, - rim, - rim_tint, - clearcoat, - clearcoat_gloss, - anisotropy, - diffuse_light, - specular_light); + normalize(light_vec), + eye_position, + binormal, + tangent, + light_color.xyz * light_energy, + attenuation, + albedo, + transmission, + specular * light_specular, + roughness, + metallic, + rim, + rim_tint, + clearcoat, + clearcoat_gloss, + anisotropy, + diffuse_light, + specular_light); } else if (light_type == LIGHT_TYPE_SPOT) { vec3 light_att = vec3(1.0); if (light_has_shadow > 0.5) { - highp vec4 splane = (light_shadow_matrix * vec4(vertex, 1.0)); + highp vec4 splane = (light_shadow_matrix * vec4(vertex, 1.0)); splane.xyz /= splane.w; float shadow = sample_shadow(light_shadow_atlas, vec2(0.0), splane.xy, splane.z, light_clamp); @@ -768,8 +752,6 @@ FRAGMENT_SHADER_CODE } else { light_att = vec3(0.0); } - - } vec3 light_rel_vec = light_position - vertex; @@ -788,25 +770,26 @@ FRAGMENT_SHADER_CODE light_att *= vec3(spot_attenuation); - light_compute(normal, - normalize(light_rel_vec), - eye_position, - binormal, - tangent, - light_color.xyz * light_energy, - light_att, - albedo, - transmission, - specular * light_specular, - roughness, - metallic, - rim, - rim_tint, - clearcoat, - clearcoat_gloss, - anisotropy, - diffuse_light, - specular_light); + light_compute( + normal, + normalize(light_rel_vec), + eye_position, + binormal, + tangent, + light_color.xyz * light_energy, + light_att, + albedo, + transmission, + specular * light_specular, + roughness, + metallic, + rim, + rim_tint, + clearcoat, + clearcoat_gloss, + anisotropy, + diffuse_light, + specular_light); } gl_FragColor = vec4(ambient_light + diffuse_light + specular_light, alpha); @@ -818,7 +801,6 @@ FRAGMENT_SHADER_CODE #ifdef USE_RADIANCE_MAP - vec3 ref_vec = reflect(-eye_position, N); ref_vec = normalize((radiance_inverse_xform * vec4(ref_vec, 0.0)).xyz); @@ -831,7 +813,6 @@ FRAGMENT_SHADER_CODE vec3 env_ambient = textureCubeLod(radiance_map, ambient_dir, RADIANCE_MAX_LOD).xyz * bg_energy; ambient_light = mix(ambient_color.rgb, env_ambient, ambient_sky_contribution); - } ambient_light *= ambient_energy; @@ -855,28 +836,23 @@ FRAGMENT_SHADER_CODE // TODO shadeless { const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022); - const vec4 c1 = vec4( 1.0, 0.0425, 1.04, -0.04); + const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04); vec4 r = roughness * c0 + c1; - float ndotv = clamp(dot(normal,eye_position),0.0,1.0); - float a004 = min( r.x * r.x, exp2( -9.28 * ndotv ) ) * r.x + r.y; - vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw; + float ndotv = clamp(dot(normal, eye_position), 0.0, 1.0); + float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y; + vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw; vec3 specular_color = metallic_to_specular_color(metallic, specular, albedo); specular_light *= AB.x * specular_color + AB.y; } - gl_FragColor = vec4(ambient_light + diffuse_light + specular_light, alpha); // gl_FragColor = vec4(normal, 1.0); - #else gl_FragColor = vec4(albedo, alpha); #endif #endif // RENDER_DEPTH - #endif // lighting - - } diff --git a/drivers/gles2/shaders/screen_space_reflection.glsl b/drivers/gles2/shaders/screen_space_reflection.glsl index b2e6f7a736..77af874ee4 100644 --- a/drivers/gles2/shaders/screen_space_reflection.glsl +++ b/drivers/gles2/shaders/screen_space_reflection.glsl @@ -1,8 +1,7 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; -layout(location=4) in vec2 uv_in; +layout(location = 0) in highp vec4 vertex_attrib; +layout(location = 4) in vec2 uv_in; out vec2 uv_interp; out vec2 pos_interp; @@ -11,12 +10,11 @@ void main() { uv_interp = uv_in; gl_Position = vertex_attrib; - pos_interp.xy=gl_Position.xy; + pos_interp.xy = gl_Position.xy; } [fragment] - in vec2 uv_interp; in vec2 pos_interp; @@ -40,81 +38,70 @@ uniform float depth_tolerance; uniform float distance_fade; uniform float curve_fade_in; - layout(location = 0) out vec4 frag_color; - -vec2 view_to_screen(vec3 view_pos,out float w) { - vec4 projected = projection * vec4(view_pos, 1.0); - projected.xyz /= projected.w; - projected.xy = projected.xy * 0.5 + 0.5; - w=projected.w; - return projected.xy; +vec2 view_to_screen(vec3 view_pos, out float w) { + vec4 projected = projection * vec4(view_pos, 1.0); + projected.xyz /= projected.w; + projected.xy = projected.xy * 0.5 + 0.5; + w = projected.w; + return projected.xy; } - - #define M_PI 3.14159265359 void main() { - - //// - - vec4 diffuse = texture( source_diffuse, uv_interp ); - vec4 normal_roughness = texture( source_normal_roughness, uv_interp); + vec4 diffuse = texture(source_diffuse, uv_interp); + vec4 normal_roughness = texture(source_normal_roughness, uv_interp); vec3 normal; - normal = normal_roughness.xyz*2.0-1.0; + normal = normal_roughness.xyz * 2.0 - 1.0; float roughness = normal_roughness.w; - float depth_tex = texture(source_depth,uv_interp).r; + float depth_tex = texture(source_depth, uv_interp).r; - vec4 world_pos = inverse_projection * vec4( uv_interp*2.0-1.0, depth_tex*2.0-1.0, 1.0 ); - vec3 vertex = world_pos.xyz/world_pos.w; + vec4 world_pos = inverse_projection * vec4(uv_interp * 2.0 - 1.0, depth_tex * 2.0 - 1.0, 1.0); + vec3 vertex = world_pos.xyz / world_pos.w; vec3 view_dir = normalize(vertex); vec3 ray_dir = normalize(reflect(view_dir, normal)); - if (dot(ray_dir,normal)<0.001) { - frag_color=vec4(0.0); + if (dot(ray_dir, normal) < 0.001) { + frag_color = vec4(0.0); return; } //ray_dir = normalize(view_dir - normal * dot(normal,view_dir) * 2.0); //ray_dir = normalize(vec3(1,1,-1)); - //////////////// - //make ray length and clip it against the near plane (don't want to trace beyond visible) float ray_len = (vertex.z + ray_dir.z * camera_z_far) > -camera_z_near ? (-camera_z_near - vertex.z) / ray_dir.z : camera_z_far; - vec3 ray_end = vertex + ray_dir*ray_len; + vec3 ray_end = vertex + ray_dir * ray_len; float w_begin; - vec2 vp_line_begin = view_to_screen(vertex,w_begin); + vec2 vp_line_begin = view_to_screen(vertex, w_begin); float w_end; - vec2 vp_line_end = view_to_screen( ray_end, w_end); - vec2 vp_line_dir = vp_line_end-vp_line_begin; + vec2 vp_line_end = view_to_screen(ray_end, w_end); + vec2 vp_line_dir = vp_line_end - vp_line_begin; //we need to interpolate w along the ray, to generate perspective correct reflections - w_begin = 1.0/w_begin; - w_end = 1.0/w_end; + w_begin = 1.0 / w_begin; + w_end = 1.0 / w_end; + float z_begin = vertex.z * w_begin; + float z_end = ray_end.z * w_end; - float z_begin = vertex.z*w_begin; - float z_end = ray_end.z*w_end; - - vec2 line_begin = vp_line_begin/pixel_size; - vec2 line_dir = vp_line_dir/pixel_size; + vec2 line_begin = vp_line_begin / pixel_size; + vec2 line_dir = vp_line_dir / pixel_size; float z_dir = z_end - z_begin; float w_dir = w_end - w_begin; - // clip the line to the viewport edges float scale_max_x = min(1.0, 0.99 * (1.0 - vp_line_begin.x) / max(1e-5, vp_line_dir.x)); @@ -124,121 +111,109 @@ void main() { float line_clip = min(scale_max_x, scale_max_y) * min(scale_min_x, scale_min_y); line_dir *= line_clip; z_dir *= line_clip; - w_dir *=line_clip; + w_dir *= line_clip; //clip z and w advance to line advance vec2 line_advance = normalize(line_dir); //down to pixel - float step_size = length(line_advance)/length(line_dir); - float z_advance = z_dir*step_size; // adapt z advance to line advance - float w_advance = w_dir*step_size; // adapt w advance to line advance + float step_size = length(line_advance) / length(line_dir); + float z_advance = z_dir * step_size; // adapt z advance to line advance + float w_advance = w_dir * step_size; // adapt w advance to line advance //make line advance faster if direction is closer to pixel edges (this avoids sampling the same pixel twice) - float advance_angle_adj = 1.0/max(abs(line_advance.x),abs(line_advance.y)); - line_advance*=advance_angle_adj; // adapt z advance to line advance - z_advance*=advance_angle_adj; - w_advance*=advance_angle_adj; + float advance_angle_adj = 1.0 / max(abs(line_advance.x), abs(line_advance.y)); + line_advance *= advance_angle_adj; // adapt z advance to line advance + z_advance *= advance_angle_adj; + w_advance *= advance_angle_adj; vec2 pos = line_begin; float z = z_begin; float w = w_begin; - float z_from=z/w; - float z_to=z_from; + float z_from = z / w; + float z_to = z_from; float depth; - vec2 prev_pos=pos; + vec2 prev_pos = pos; - bool found=false; + bool found = false; - float steps_taken=0.0; + float steps_taken = 0.0; - for(int i=0;i<num_steps;i++) { + for (int i = 0; i < num_steps; i++) { - pos+=line_advance; - z+=z_advance; - w+=w_advance; + pos += line_advance; + z += z_advance; + w += w_advance; //convert to linear depth - depth = texture(source_depth, pos*pixel_size).r * 2.0 - 1.0; + depth = texture(source_depth, pos * pixel_size).r * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + depth = ((depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near)); #endif - depth=-depth; + depth = -depth; z_from = z_to; - z_to = z/w; + z_to = z / w; - if (depth>z_to) { + if (depth > z_to) { //if depth was surpassed - if (depth<=max(z_to,z_from)+depth_tolerance) { + if (depth <= max(z_to, z_from) + depth_tolerance) { //check the depth tolerance - found=true; + found = true; } break; } - steps_taken+=1.0; - prev_pos=pos; + steps_taken += 1.0; + prev_pos = pos; } - - - if (found) { - float margin_blend=1.0; - + float margin_blend = 1.0; - vec2 margin = vec2((viewport_size.x+viewport_size.y)*0.5*0.05); //make a uniform margin - if (any(bvec4(lessThan(pos,-margin),greaterThan(pos,viewport_size+margin)))) { + vec2 margin = vec2((viewport_size.x + viewport_size.y) * 0.5 * 0.05); //make a uniform margin + if (any(bvec4(lessThan(pos, -margin), greaterThan(pos, viewport_size + margin)))) { //clip outside screen + margin - frag_color=vec4(0.0); + frag_color = vec4(0.0); return; } { //blend fading out towards external margin - vec2 margin_grad = mix(pos-viewport_size,-pos,lessThan(pos,vec2(0.0))); - margin_blend = 1.0-smoothstep(0.0,margin.x,max(margin_grad.x,margin_grad.y)); + vec2 margin_grad = mix(pos - viewport_size, -pos, lessThan(pos, vec2(0.0))); + margin_blend = 1.0 - smoothstep(0.0, margin.x, max(margin_grad.x, margin_grad.y)); //margin_blend=1.0; - } vec2 final_pos; float grad; - grad=steps_taken/float(num_steps); - float initial_fade = curve_fade_in==0.0 ? 1.0 : pow(clamp(grad,0.0,1.0),curve_fade_in); - float fade = pow(clamp(1.0-grad,0.0,1.0),distance_fade)*initial_fade; - final_pos=pos; - - - - - - + grad = steps_taken / float(num_steps); + float initial_fade = curve_fade_in == 0.0 ? 1.0 : pow(clamp(grad, 0.0, 1.0), curve_fade_in); + float fade = pow(clamp(1.0 - grad, 0.0, 1.0), distance_fade) * initial_fade; + final_pos = pos; #ifdef REFLECT_ROUGHNESS - vec4 final_color; //if roughness is enabled, do screen space cone tracing if (roughness > 0.001) { /////////////////////////////////////////////////////////////////////////////////////// //use a blurred version (in consecutive mipmaps) of the screen to simulate roughness - float gloss = 1.0-roughness; + float gloss = 1.0 - roughness; float cone_angle = roughness * M_PI * 0.5; vec2 cone_dir = final_pos - line_begin; float cone_len = length(cone_dir); cone_dir = normalize(cone_dir); //will be used normalized from now on float max_mipmap = filter_mipmap_levels - 1.0; - float gloss_mult=gloss; + float gloss_mult = gloss; - float rem_alpha=1.0; + float rem_alpha = 1.0; final_color = vec4(0.0); - for(int i=0;i<7;i++) { + for (int i = 0; i < 7; i++) { float op_len = 2.0 * tan(cone_angle) * cone_len; //opposite side of iso triangle float radius; @@ -258,30 +233,30 @@ void main() { } //find the place where screen must be sampled - vec2 sample_pos = ( line_begin + cone_dir * (cone_len - radius) ) * pixel_size; + vec2 sample_pos = (line_begin + cone_dir * (cone_len - radius)) * pixel_size; //radius is in pixels, so it's natural that log2(radius) maps to the right mipmap for the amount of pixels - float mipmap = clamp( log2( radius ), 0.0, max_mipmap ); + float mipmap = clamp(log2(radius), 0.0, max_mipmap); //mipmap = max(mipmap-1.0,0.0); //do sampling vec4 sample_color; { - sample_color = textureLod(source_diffuse,sample_pos,mipmap); + sample_color = textureLod(source_diffuse, sample_pos, mipmap); } //multiply by gloss - sample_color.rgb*=gloss_mult; - sample_color.a=gloss_mult; + sample_color.rgb *= gloss_mult; + sample_color.a = gloss_mult; rem_alpha -= sample_color.a; - if(rem_alpha < 0.0) { + if (rem_alpha < 0.0) { sample_color.rgb *= (1.0 - abs(rem_alpha)); } - final_color+=sample_color; + final_color += sample_color; - if (final_color.a>=0.95) { + if (final_color.a >= 0.95) { // This code of accumulating gloss and aborting on near one // makes sense when you think of cone tracing. // Think of it as if roughness was 0, then we could abort on the first @@ -290,29 +265,21 @@ void main() { break; } - cone_len-=radius*2.0; //go to next (smaller) circle. - - gloss_mult*=gloss; - + cone_len -= radius * 2.0; //go to next (smaller) circle. + gloss_mult *= gloss; } } else { - final_color = textureLod(source_diffuse,final_pos*pixel_size,0.0); + final_color = textureLod(source_diffuse, final_pos * pixel_size, 0.0); } - frag_color = vec4(final_color.rgb,fade*margin_blend); + frag_color = vec4(final_color.rgb, fade * margin_blend); #else - frag_color = vec4(textureLod(source_diffuse,final_pos*pixel_size,0.0).rgb,fade*margin_blend); + frag_color = vec4(textureLod(source_diffuse, final_pos * pixel_size, 0.0).rgb, fade * margin_blend); #endif - - } else { - frag_color = vec4(0.0,0.0,0.0,0.0); + frag_color = vec4(0.0, 0.0, 0.0, 0.0); } - - - } - diff --git a/drivers/gles2/shaders/ssao.glsl b/drivers/gles2/shaders/ssao.glsl index 219f0957e0..8dbe8c6ba9 100644 --- a/drivers/gles2/shaders/ssao.glsl +++ b/drivers/gles2/shaders/ssao.glsl @@ -1,12 +1,11 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; +layout(location = 0) in highp vec4 vertex_attrib; void main() { gl_Position = vertex_attrib; - gl_Position.z=1.0; + gl_Position.z = 1.0; } [fragment] @@ -43,19 +42,20 @@ void main() { // This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent // taps from lining up. This particular choice was tuned for NUM_SAMPLES == 9 -const int ROTATIONS[] = int[]( 1, 1, 2, 3, 2, 5, 2, 3, 2, -3, 3, 5, 5, 3, 4, 7, 5, 5, 7, -9, 8, 5, 5, 7, 7, 7, 8, 5, 8, -11, 12, 7, 10, 13, 8, 11, 8, 7, 14, -11, 11, 13, 12, 13, 19, 17, 13, 11, 18, -19, 11, 11, 14, 17, 21, 15, 16, 17, 18, -13, 17, 11, 17, 19, 18, 25, 18, 19, 19, -29, 21, 19, 27, 31, 29, 21, 18, 17, 29, -31, 31, 23, 18, 25, 26, 25, 23, 19, 34, -19, 27, 21, 25, 39, 29, 17, 21, 27 ); +const int ROTATIONS[] = int[]( + 1, 1, 2, 3, 2, 5, 2, 3, 2, + 3, 3, 5, 5, 3, 4, 7, 5, 5, 7, + 9, 8, 5, 5, 7, 7, 7, 8, 5, 8, + 11, 12, 7, 10, 13, 8, 11, 8, 7, 14, + 11, 11, 13, 12, 13, 19, 17, 13, 11, 18, + 19, 11, 11, 14, 17, 21, 15, 16, 17, 18, + 13, 17, 11, 17, 19, 18, 25, 18, 19, 19, + 29, 21, 19, 27, 31, 29, 21, 18, 17, 29, + 31, 31, 23, 18, 25, 26, 25, 23, 19, 34, + 19, 27, 21, 25, 39, 29, 17, 21, 27); //#define NUM_SPIRAL_TURNS (7) -const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES-1]; +const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES - 1]; uniform sampler2D source_depth; //texunit:0 uniform highp usampler2D source_depth_mipmaps; //texunit:1 @@ -90,44 +90,41 @@ vec3 reconstructCSPosition(vec2 S, float z) { } vec3 getPosition(ivec2 ssP) { - vec3 P; - P.z = texelFetch(source_depth, ssP, 0).r; + vec3 P; + P.z = texelFetch(source_depth, ssP, 0).r; - P.z = P.z * 2.0 - 1.0; + P.z = P.z * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - P.z = ((P.z + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + P.z = ((P.z + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else - P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near)); + P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near)); #endif - P.z = -P.z; + P.z = -P.z; - // Offset to pixel center - P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z); - return P; + // Offset to pixel center + P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z); + return P; } /** Reconstructs screen-space unit normal from screen-space position */ vec3 reconstructCSFaceNormal(vec3 C) { - return normalize(cross(dFdy(C), dFdx(C))); + return normalize(cross(dFdy(C), dFdx(C))); } - - /** Returns a unit vector and a screen-space radius for the tap on a unit disk (the caller should scale by the actual disk radius) */ -vec2 tapLocation(int sampleNumber, float spinAngle, out float ssR){ - // Radius relative to ssR - float alpha = (float(sampleNumber) + 0.5) * (1.0 / float(NUM_SAMPLES)); - float angle = alpha * (float(NUM_SPIRAL_TURNS) * 6.28) + spinAngle; +vec2 tapLocation(int sampleNumber, float spinAngle, out float ssR) { + // Radius relative to ssR + float alpha = (float(sampleNumber) + 0.5) * (1.0 / float(NUM_SAMPLES)); + float angle = alpha * (float(NUM_SPIRAL_TURNS) * 6.28) + spinAngle; - ssR = alpha; - return vec2(cos(angle), sin(angle)); + ssR = alpha; + return vec2(cos(angle), sin(angle)); } - /** Read the camera-space position of the point at screen-space pixel ssP + unitOffset * ssR. Assumes length(unitOffset) == 1 */ vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) { - // Derivation: - // mipLevel = floor(log(ssR / MAX_OFFSET)); + // Derivation: + // mipLevel = floor(log(ssR / MAX_OFFSET)); int mipLevel = clamp(int(floor(log2(ssR))) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL); ivec2 ssP = ivec2(ssR * unitOffset) + ssC; @@ -138,13 +135,12 @@ vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) { // Manually clamp to the texture size because texelFetch bypasses the texture unit ivec2 mipP = clamp(ssP >> mipLevel, ivec2(0), (screen_size >> mipLevel) - ivec2(1)); - if (mipLevel < 1) { //read from depth buffer P.z = texelFetch(source_depth, mipP, 0).r; P.z = P.z * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - P.z = ((P.z + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + P.z = ((P.z + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near)); @@ -153,78 +149,74 @@ vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) { } else { //read from mipmaps - uint d = texelFetch(source_depth_mipmaps, mipP, mipLevel-1).r; - P.z = -(float(d)/65535.0)*camera_z_far; + uint d = texelFetch(source_depth_mipmaps, mipP, mipLevel - 1).r; + P.z = -(float(d) / 65535.0) * camera_z_far; } - // Offset to pixel center P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z); return P; } - - /** Compute the occlusion due to sample with index \a i about the pixel at \a ssC that corresponds - to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius + to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius - Note that units of H() in the HPG12 paper are meters, not - unitless. The whole falloff/sampling function is therefore - unitless. In this implementation, we factor out (9 / radius). + Note that units of H() in the HPG12 paper are meters, not + unitless. The whole falloff/sampling function is therefore + unitless. In this implementation, we factor out (9 / radius). - Four versions of the falloff function are implemented below + Four versions of the falloff function are implemented below */ -float sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius,in float p_radius, in int tapIndex, in float randomPatternRotationAngle) { - // Offset on the unit disk, spun for this pixel - float ssR; - vec2 unitOffset = tapLocation(tapIndex, randomPatternRotationAngle, ssR); - ssR *= ssDiskRadius; +float sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius, in float p_radius, in int tapIndex, in float randomPatternRotationAngle) { + // Offset on the unit disk, spun for this pixel + float ssR; + vec2 unitOffset = tapLocation(tapIndex, randomPatternRotationAngle, ssR); + ssR *= ssDiskRadius; - // The occluding point in camera space - vec3 Q = getOffsetPosition(ssC, unitOffset, ssR); + // The occluding point in camera space + vec3 Q = getOffsetPosition(ssC, unitOffset, ssR); - vec3 v = Q - C; + vec3 v = Q - C; - float vv = dot(v, v); - float vn = dot(v, n_C); + float vv = dot(v, v); + float vn = dot(v, n_C); - const float epsilon = 0.01; - float radius2 = p_radius*p_radius; + const float epsilon = 0.01; + float radius2 = p_radius * p_radius; - // A: From the HPG12 paper - // Note large epsilon to avoid overdarkening within cracks - //return float(vv < radius2) * max((vn - bias) / (epsilon + vv), 0.0) * radius2 * 0.6; + // A: From the HPG12 paper + // Note large epsilon to avoid overdarkening within cracks + //return float(vv < radius2) * max((vn - bias) / (epsilon + vv), 0.0) * radius2 * 0.6; - // B: Smoother transition to zero (lowers contrast, smoothing out corners). [Recommended] - float f=max(radius2 - vv, 0.0); - return f * f * f * max((vn - bias) / (epsilon + vv), 0.0); + // B: Smoother transition to zero (lowers contrast, smoothing out corners). [Recommended] + float f = max(radius2 - vv, 0.0); + return f * f * f * max((vn - bias) / (epsilon + vv), 0.0); - // C: Medium contrast (which looks better at high radii), no division. Note that the - // contribution still falls off with radius^2, but we've adjusted the rate in a way that is - // more computationally efficient and happens to be aesthetically pleasing. - // return 4.0 * max(1.0 - vv * invRadius2, 0.0) * max(vn - bias, 0.0); + // C: Medium contrast (which looks better at high radii), no division. Note that the + // contribution still falls off with radius^2, but we've adjusted the rate in a way that is + // more computationally efficient and happens to be aesthetically pleasing. + // return 4.0 * max(1.0 - vv * invRadius2, 0.0) * max(vn - bias, 0.0); - // D: Low contrast, no division operation - // return 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0); + // D: Low contrast, no division operation + // return 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0); } - - void main() { - // Pixel being shaded ivec2 ssC = ivec2(gl_FragCoord.xy); // World space point being shaded vec3 C = getPosition(ssC); -/* if (C.z <= -camera_z_far*0.999) { - // We're on the skybox - visibility=1.0; - return; - }*/ + /* + if (C.z <= -camera_z_far*0.999) { + // We're on the skybox + visibility=1.0; + return; + } + */ //visibility=-C.z/camera_z_far; //return; @@ -251,7 +243,7 @@ void main() { #endif float sum = 0.0; for (int i = 0; i < NUM_SAMPLES; ++i) { - sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius,i, randomPatternRotationAngle); + sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius, i, randomPatternRotationAngle); } float A = max(0.0, 1.0 - sum * intensity_div_r6 * (5.0 / float(NUM_SAMPLES))); @@ -271,10 +263,10 @@ void main() { sum = 0.0; for (int i = 0; i < NUM_SAMPLES; ++i) { - sum += sampleAO(ssC, C, n_C, ssDiskRadius,radius2, i, randomPatternRotationAngle); + sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius2, i, randomPatternRotationAngle); } - A= min(A,max(0.0, 1.0 - sum * intensity_div_r62 * (5.0 / float(NUM_SAMPLES)))); + A = min(A, max(0.0, 1.0 - sum * intensity_div_r62 * (5.0 / float(NUM_SAMPLES)))); #endif // Bilateral box-filter over a quad for free, respecting depth edges // (the difference that this makes is subtle) @@ -286,8 +278,4 @@ void main() { } visibility = A; - } - - - diff --git a/drivers/gles2/shaders/ssao_blur.glsl b/drivers/gles2/shaders/ssao_blur.glsl index 472dc21acf..82b735a2b4 100644 --- a/drivers/gles2/shaders/ssao_blur.glsl +++ b/drivers/gles2/shaders/ssao_blur.glsl @@ -1,26 +1,21 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; - +layout(location = 0) in highp vec4 vertex_attrib; void main() { gl_Position = vertex_attrib; - gl_Position.z=1.0; + gl_Position.z = 1.0; } [fragment] - uniform sampler2D source_ssao; //texunit:0 uniform sampler2D source_depth; //texunit:1 uniform sampler2D source_normal; //texunit:3 - layout(location = 0) out float visibility; - ////////////////////////////////////////////////////////////////////////////////////////////// // Tunable Parameters: @@ -28,32 +23,30 @@ layout(location = 0) out float visibility; uniform float edge_sharpness; /** Step in 2-pixel intervals since we already blurred against neighbors in the - first AO pass. This constant can be increased while R decreases to improve - performance at the expense of some dithering artifacts. + first AO pass. This constant can be increased while R decreases to improve + performance at the expense of some dithering artifacts. - Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was - unobjectionable after shading was applied but eliminated most temporal incoherence - from using small numbers of sample taps. - */ + Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was + unobjectionable after shading was applied but eliminated most temporal incoherence + from using small numbers of sample taps. + */ uniform int filter_scale; /** Filter radius in pixels. This will be multiplied by SCALE. */ -#define R (4) - +#define R (4) ////////////////////////////////////////////////////////////////////////////////////////////// - // Gaussian coefficients const float gaussian[R + 1] = -// float[](0.356642, 0.239400, 0.072410, 0.009869); -// float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134); // stddev = 1.0 - float[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970); // stddev = 2.0 -// float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0 + //float[](0.356642, 0.239400, 0.072410, 0.009869); + //float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134); // stddev = 1.0 + float[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970); // stddev = 2.0 + //float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0 /** (1, 0) or (0, 1)*/ -uniform ivec2 axis; +uniform ivec2 axis; uniform float camera_z_far; uniform float camera_z_near; @@ -72,11 +65,11 @@ void main() { float depth_divide = 1.0 / camera_z_far; -// depth*=depth_divide; + //depth *= depth_divide; /* - if (depth > camera_z_far*0.999) { - discard;//skybox + if (depth > camera_z_far * 0.999) { + discard; //skybox } */ @@ -96,23 +89,21 @@ void main() { if (r != 0) { ivec2 ppos = ssC + axis * (r * filter_scale); - float value = texelFetch(source_ssao, clamp(ppos,ivec2(0),clamp_limit), 0).r; - ivec2 rpos = clamp(ppos,ivec2(0),clamp_limit); + float value = texelFetch(source_ssao, clamp(ppos, ivec2(0), clamp_limit), 0).r; + ivec2 rpos = clamp(ppos, ivec2(0), clamp_limit); float temp_depth = texelFetch(source_depth, rpos, 0).r; //vec3 temp_normal = texelFetch(source_normal, rpos, 0).rgb * 2.0 - 1.0; temp_depth = temp_depth * 2.0 - 1.0; temp_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - temp_depth * (camera_z_far - camera_z_near)); -// temp_depth *= depth_divide; + // temp_depth *= depth_divide; // spatial domain: offset gaussian tap float weight = 0.3 + gaussian[abs(r)]; //weight *= max(0.0,dot(temp_normal,normal)); // range domain (the "bilateral" weight). As depth difference increases, decrease weight. - weight *= max(0.0, 1.0 - - edge_sharpness * abs(temp_depth - depth) - ); + weight *= max(0.0, 1.0 - edge_sharpness * abs(temp_depth - depth)); sum += value * weight; totalWeight += weight; diff --git a/drivers/gles2/shaders/ssao_minify.glsl b/drivers/gles2/shaders/ssao_minify.glsl index 647c762438..777a0069fc 100644 --- a/drivers/gles2/shaders/ssao_minify.glsl +++ b/drivers/gles2/shaders/ssao_minify.glsl @@ -1,7 +1,6 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; +layout(location = 0) in highp vec4 vertex_attrib; void main() { @@ -10,7 +9,6 @@ void main() { [fragment] - #ifdef MINIFY_START #define SDEPTH_TYPE highp sampler2D @@ -32,28 +30,23 @@ layout(location = 0) out mediump uint depth; void main() { - ivec2 ssP = ivec2(gl_FragCoord.xy); - // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling. - // On DX9, the bit-and can be implemented with floating-point modulo + // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling. + // On DX9, the bit-and can be implemented with floating-point modulo #ifdef MINIFY_START float fdepth = texelFetch(source_depth, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), from_size - ivec2(1)), source_mipmap).r; fdepth = fdepth * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - fdepth = ((fdepth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + fdepth = ((fdepth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else fdepth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - fdepth * (camera_z_far - camera_z_near)); #endif fdepth /= camera_z_far; - depth = uint(clamp(fdepth*65535.0,0.0,65535.0)); + depth = uint(clamp(fdepth * 65535.0, 0.0, 65535.0)); #else depth = texelFetch(source_depth, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), from_size - ivec2(1)), source_mipmap).r; #endif - - } - - diff --git a/drivers/gles2/shaders/stdlib.glsl b/drivers/gles2/shaders/stdlib.glsl index ebbdb96311..6bc81a22d8 100644 --- a/drivers/gles2/shaders/stdlib.glsl +++ b/drivers/gles2/shaders/stdlib.glsl @@ -1,6 +1,5 @@ -vec2 select2(vec2 a, vec2 b, bvec2 c) -{ +vec2 select2(vec2 a, vec2 b, bvec2 c) { vec2 ret; ret.x = c.x ? b.x : a.x; @@ -9,8 +8,7 @@ vec2 select2(vec2 a, vec2 b, bvec2 c) return ret; } -vec3 select3(vec3 a, vec3 b, bvec3 c) -{ +vec3 select3(vec3 a, vec3 b, bvec3 c) { vec3 ret; ret.x = c.x ? b.x : a.x; @@ -20,8 +18,7 @@ vec3 select3(vec3 a, vec3 b, bvec3 c) return ret; } -vec4 select4(vec4 a, vec4 b, bvec4 c) -{ +vec4 select4(vec4 a, vec4 b, bvec4 c) { vec4 ret; ret.x = c.x ? b.x : a.x; @@ -32,14 +29,9 @@ vec4 select4(vec4 a, vec4 b, bvec4 c) return ret; } - -highp vec4 texel2DFetch(highp sampler2D tex, ivec2 size, ivec2 coord) -{ +highp vec4 texel2DFetch(highp sampler2D tex, ivec2 size, ivec2 coord) { float x_coord = float(2 * coord.x + 1) / float(size.x * 2); float y_coord = float(2 * coord.y + 1) / float(size.y * 2); - x_coord = float(coord.x) / float(size.x); - y_coord = float(coord.y) / float(size.y); - return texture2DLod(tex, vec2(x_coord, y_coord), 0.0); } diff --git a/drivers/gles2/shaders/subsurf_scattering.glsl b/drivers/gles2/shaders/subsurf_scattering.glsl index fc66d66198..fb7908f06a 100644 --- a/drivers/gles2/shaders/subsurf_scattering.glsl +++ b/drivers/gles2/shaders/subsurf_scattering.glsl @@ -1,12 +1,10 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; -layout(location=4) in vec2 uv_in; +layout(location = 0) in highp vec4 vertex_attrib; +layout(location = 4) in vec2 uv_in; out vec2 uv_interp; - void main() { uv_interp = uv_in; @@ -19,87 +17,73 @@ void main() { #define QUALIFIER const #ifdef USE_25_SAMPLES - -const int kernel_size=25; -QUALIFIER vec2 kernel[25] = vec2[] ( - vec2(0.530605, 0.0), - vec2(0.000973794, -3.0), - vec2(0.00333804, -2.52083), - vec2(0.00500364, -2.08333), - vec2(0.00700976, -1.6875), - vec2(0.0094389, -1.33333), - vec2(0.0128496, -1.02083), - vec2(0.017924, -0.75), - vec2(0.0263642, -0.520833), - vec2(0.0410172, -0.333333), - vec2(0.0493588, -0.1875), - vec2(0.0402784, -0.0833333), - vec2(0.0211412, -0.0208333), - vec2(0.0211412, 0.0208333), - vec2(0.0402784, 0.0833333), - vec2(0.0493588, 0.1875), - vec2(0.0410172, 0.333333), - vec2(0.0263642, 0.520833), - vec2(0.017924, 0.75), - vec2(0.0128496, 1.02083), - vec2(0.0094389, 1.33333), - vec2(0.00700976, 1.6875), - vec2(0.00500364, 2.08333), - vec2(0.00333804, 2.52083), - vec2(0.000973794, 3.0) -); - +const int kernel_size = 25; +QUALIFIER vec2 kernel[25] = vec2[]( + vec2(0.530605, 0.0), + vec2(0.000973794, -3.0), + vec2(0.00333804, -2.52083), + vec2(0.00500364, -2.08333), + vec2(0.00700976, -1.6875), + vec2(0.0094389, -1.33333), + vec2(0.0128496, -1.02083), + vec2(0.017924, -0.75), + vec2(0.0263642, -0.520833), + vec2(0.0410172, -0.333333), + vec2(0.0493588, -0.1875), + vec2(0.0402784, -0.0833333), + vec2(0.0211412, -0.0208333), + vec2(0.0211412, 0.0208333), + vec2(0.0402784, 0.0833333), + vec2(0.0493588, 0.1875), + vec2(0.0410172, 0.333333), + vec2(0.0263642, 0.520833), + vec2(0.017924, 0.75), + vec2(0.0128496, 1.02083), + vec2(0.0094389, 1.33333), + vec2(0.00700976, 1.6875), + vec2(0.00500364, 2.08333), + vec2(0.00333804, 2.52083), + vec2(0.000973794, 3.0)); #endif //USE_25_SAMPLES #ifdef USE_17_SAMPLES - -const int kernel_size=17; - +const int kernel_size = 17; QUALIFIER vec2 kernel[17] = vec2[]( - vec2(0.536343, 0.0), - vec2(0.00317394, -2.0), - vec2(0.0100386, -1.53125), - vec2(0.0144609, -1.125), - vec2(0.0216301, -0.78125), - vec2(0.0347317, -0.5), - vec2(0.0571056, -0.28125), - vec2(0.0582416, -0.125), - vec2(0.0324462, -0.03125), - vec2(0.0324462, 0.03125), - vec2(0.0582416, 0.125), - vec2(0.0571056, 0.28125), - vec2(0.0347317, 0.5), - vec2(0.0216301, 0.78125), - vec2(0.0144609, 1.125), - vec2(0.0100386, 1.53125), - vec2(0.00317394,2.0) -); - + vec2(0.536343, 0.0), + vec2(0.00317394, -2.0), + vec2(0.0100386, -1.53125), + vec2(0.0144609, -1.125), + vec2(0.0216301, -0.78125), + vec2(0.0347317, -0.5), + vec2(0.0571056, -0.28125), + vec2(0.0582416, -0.125), + vec2(0.0324462, -0.03125), + vec2(0.0324462, 0.03125), + vec2(0.0582416, 0.125), + vec2(0.0571056, 0.28125), + vec2(0.0347317, 0.5), + vec2(0.0216301, 0.78125), + vec2(0.0144609, 1.125), + vec2(0.0100386, 1.53125), + vec2(0.00317394, 2.0)); #endif //USE_17_SAMPLES - #ifdef USE_11_SAMPLES - -const int kernel_size=11; - +const int kernel_size = 11; QUALIFIER vec2 kernel[11] = vec2[]( - vec2(0.560479, 0.0), - vec2(0.00471691, -2.0), - vec2(0.0192831, -1.28), - vec2(0.03639, -0.72), - vec2(0.0821904, -0.32), - vec2(0.0771802, -0.08), - vec2(0.0771802, 0.08), - vec2(0.0821904, 0.32), - vec2(0.03639, 0.72), - vec2(0.0192831, 1.28), - vec2(0.00471691,2.0) -); - + vec2(0.560479, 0.0), + vec2(0.00471691, -2.0), + vec2(0.0192831, -1.28), + vec2(0.03639, -0.72), + vec2(0.0821904, -0.32), + vec2(0.0771802, -0.08), + vec2(0.0771802, 0.08), + vec2(0.0821904, 0.32), + vec2(0.03639, 0.72), + vec2(0.0192831, 1.28), + vec2(0.00471691, 2.0)); #endif //USE_11_SAMPLES - - uniform float max_radius; uniform float camera_z_far; uniform float camera_z_near; @@ -115,28 +99,24 @@ layout(location = 0) out vec4 frag_color; void main() { - float strength = texture(source_sss,uv_interp).r; - strength*=strength; //stored as sqrt + float strength = texture(source_sss, uv_interp).r; + strength *= strength; //stored as sqrt // Fetch color of current pixel: vec4 base_color = texture(source_diffuse, uv_interp); - - if (strength>0.0) { - + if (strength > 0.0) { // Fetch linear depth of current pixel: float depth = texture(source_depth, uv_interp).r * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + depth = ((depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; float scale = unit_size; //remember depth is negative by default in OpenGL #else depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near)); float scale = unit_size / depth; //remember depth is negative by default in OpenGL #endif - - // Calculate the final step to fetch the surrounding pixels: vec2 step = max_radius * scale * dir; step *= strength; // Modulate it using the alpha channel. @@ -157,35 +137,33 @@ void main() { #ifdef ENABLE_FOLLOW_SURFACE // If the difference in depth is huge, we lerp color back to "colorM": - float depth_cmp = texture(source_depth, offset).r *2.0 - 1.0; + float depth_cmp = texture(source_depth, offset).r * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - depth_cmp = ((depth_cmp + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + depth_cmp = ((depth_cmp + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else depth_cmp = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth_cmp * (camera_z_far - camera_z_near)); #endif - float s = clamp(300.0f * scale * - max_radius * abs(depth - depth_cmp),0.0,1.0); + float s = clamp(300.0f * scale * max_radius * abs(depth - depth_cmp), 0.0, 1.0); color = mix(color, base_color.rgb, s); #endif // Accumulate: - color*=kernel[i].x; + color *= kernel[i].x; #ifdef ENABLE_STRENGTH_WEIGHTING float color_s = texture(source_sss, offset).r; - color_weight+=color_s * kernel[i].x; - color*=color_s; + color_weight += color_s * kernel[i].x; + color *= color_s; #endif color_accum += color; - } #ifdef ENABLE_STRENGTH_WEIGHTING - color_accum/=color_weight; + color_accum /= color_weight; #endif - frag_color = vec4(color_accum,base_color.a); //keep alpha (used for SSAO) + frag_color = vec4(color_accum, base_color.a); //keep alpha (used for SSAO) } else { frag_color = base_color; } diff --git a/drivers/gles2/shaders/tonemap.glsl b/drivers/gles2/shaders/tonemap.glsl index 2f671158b2..f3f6a85565 100644 --- a/drivers/gles2/shaders/tonemap.glsl +++ b/drivers/gles2/shaders/tonemap.glsl @@ -1,8 +1,7 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; -layout(location=4) in vec2 uv_in; +layout(location = 0) in highp vec4 vertex_attrib; +layout(location = 4) in vec2 uv_in; out vec2 uv_interp; @@ -11,9 +10,8 @@ void main() { gl_Position = vertex_attrib; uv_interp = uv_in; #ifdef V_FLIP - uv_interp.y = 1.0-uv_interp.y; + uv_interp.y = 1.0 - uv_interp.y; #endif - } [fragment] @@ -22,7 +20,6 @@ void main() { precision mediump float; #endif - in vec2 uv_interp; uniform highp sampler2D source; //texunit:0 @@ -56,64 +53,54 @@ uniform sampler2D color_correction; //texunit:3 #endif - layout(location = 0) out vec4 frag_color; #ifdef USE_GLOW_FILTER_BICUBIC // w0, w1, w2, and w3 are the four cubic B-spline basis functions -float w0(float a) -{ - return (1.0/6.0)*(a*(a*(-a + 3.0) - 3.0) + 1.0); +float w0(float a) { + return (1.0 / 6.0) * (a * (a * (-a + 3.0) - 3.0) + 1.0); } -float w1(float a) -{ - return (1.0/6.0)*(a*a*(3.0*a - 6.0) + 4.0); +float w1(float a) { + return (1.0 / 6.0) * (a * a * (3.0 * a - 6.0) + 4.0); } -float w2(float a) -{ - return (1.0/6.0)*(a*(a*(-3.0*a + 3.0) + 3.0) + 1.0); +float w2(float a) { + return (1.0 / 6.0) * (a * (a * (-3.0 * a + 3.0) + 3.0) + 1.0); } -float w3(float a) -{ - return (1.0/6.0)*(a*a*a); +float w3(float a) { + return (1.0 / 6.0) * (a * a * a); } // g0 and g1 are the two amplitude functions -float g0(float a) -{ - return w0(a) + w1(a); +float g0(float a) { + return w0(a) + w1(a); } -float g1(float a) -{ - return w2(a) + w3(a); +float g1(float a) { + return w2(a) + w3(a); } // h0 and h1 are the two offset functions -float h0(float a) -{ - return -1.0 + w1(a) / (w0(a) + w1(a)); +float h0(float a) { + return -1.0 + w1(a) / (w0(a) + w1(a)); } -float h1(float a) -{ - return 1.0 + w3(a) / (w2(a) + w3(a)); +float h1(float a) { + return 1.0 + w3(a) / (w2(a) + w3(a)); } uniform ivec2 glow_texture_size; -vec4 texture2D_bicubic(sampler2D tex, vec2 uv,int p_lod) -{ - float lod=float(p_lod); +vec4 texture2D_bicubic(sampler2D tex, vec2 uv, int p_lod) { + float lod = float(p_lod); vec2 tex_size = vec2(glow_texture_size >> p_lod); - vec2 pixel_size =1.0/tex_size; - uv = uv*tex_size + 0.5; - vec2 iuv = floor( uv ); - vec2 fuv = fract( uv ); + vec2 pixel_size = 1.0 / tex_size; + uv = uv * tex_size + 0.5; + vec2 iuv = floor(uv); + vec2 fuv = fract(uv); float g0x = g0(fuv.x); float g1x = g1(fuv.x); @@ -127,24 +114,19 @@ vec4 texture2D_bicubic(sampler2D tex, vec2 uv,int p_lod) vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - 0.5) * pixel_size; vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - 0.5) * pixel_size; - return g0(fuv.y) * (g0x * textureLod(tex, p0,lod) + - g1x * textureLod(tex, p1,lod)) + - g1(fuv.y) * (g0x * textureLod(tex, p2,lod) + - g1x * textureLod(tex, p3,lod)); + return (g0(fuv.y) * (g0x * textureLod(tex, p0, lod) + g1x * textureLod(tex, p1, lod))) + + (g1(fuv.y) * (g0x * textureLod(tex, p2, lod) + g1x * textureLod(tex, p3, lod))); } - - -#define GLOW_TEXTURE_SAMPLE(m_tex,m_uv,m_lod) texture2D_bicubic(m_tex,m_uv,m_lod) +#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2D_bicubic(m_tex, m_uv, m_lod) #else -#define GLOW_TEXTURE_SAMPLE(m_tex,m_uv,m_lod) textureLod(m_tex,m_uv,float(m_lod)) +#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) textureLod(m_tex, m_uv, float(m_lod)) #endif - -vec3 tonemap_filmic(vec3 color,float white) { +vec3 tonemap_filmic(vec3 color, float white) { float A = 0.15; float B = 0.50; @@ -154,11 +136,10 @@ vec3 tonemap_filmic(vec3 color,float white) { float F = 0.30; float W = 11.2; - vec3 coltn = ((color*(A*color+C*B)+D*E)/(color*(A*color+B)+D*F))-E/F; - float whitetn = ((white*(A*white+C*B)+D*E)/(white*(A*white+B)+D*F))-E/F; - - return coltn/whitetn; + vec3 coltn = ((color * (A * color + C * B) + D * E) / (color * (A * color + B) + D * F)) - E / F; + float whitetn = ((white * (A * white + C * B) + D * E) / (white * (A * white + B) + D * F)) - E / F; + return coltn / whitetn; } vec3 tonemap_aces(vec3 color) { @@ -167,12 +148,12 @@ vec3 tonemap_aces(vec3 color) { float c = 2.43f; float d = 0.59f; float e = 0.14f; - return color = clamp((color*(a*color+b))/(color*(c*color+d)+e),vec3(0.0),vec3(1.0)); + return color = clamp((color * (a * color + b)) / (color * (c * color + d) + e), vec3(0.0), vec3(1.0)); } -vec3 tonemap_reindhart(vec3 color,float white) { +vec3 tonemap_reindhart(vec3 color, float white) { - return ( color * ( 1.0 + ( color / ( white) ) ) ) / ( 1.0 + color ); + return (color * (1.0 + (color / (white)))) / (1.0 + color); } void main() { @@ -181,10 +162,10 @@ void main() { #ifdef USE_AUTO_EXPOSURE - color/=texelFetch(source_auto_exposure,ivec2(0,0),0).r/auto_exposure_grey; + color /= texelFetch(source_auto_exposure, ivec2(0, 0), 0).r / auto_exposure_grey; #endif - color*=exposure; + color *= exposure; #if defined(USE_GLOW_LEVEL1) || defined(USE_GLOW_LEVEL2) || defined(USE_GLOW_LEVEL3) || defined(USE_GLOW_LEVEL4) || defined(USE_GLOW_LEVEL5) || defined(USE_GLOW_LEVEL6) || defined(USE_GLOW_LEVEL7) #define USING_GLOW @@ -195,56 +176,54 @@ void main() { #ifdef USE_GLOW_LEVEL1 - glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,1).rgb; + glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 1).rgb; #endif #ifdef USE_GLOW_LEVEL2 - glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,2).rgb; + glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 2).rgb; #endif #ifdef USE_GLOW_LEVEL3 - glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,3).rgb; + glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 3).rgb; #endif #ifdef USE_GLOW_LEVEL4 - glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,4).rgb; + glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 4).rgb; #endif #ifdef USE_GLOW_LEVEL5 - glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,5).rgb; + glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 5).rgb; #endif #ifdef USE_GLOW_LEVEL6 - glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,6).rgb; + glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 6).rgb; #endif #ifdef USE_GLOW_LEVEL7 - glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,7).rgb; + glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 7).rgb; #endif - glow *= glow_intensity; #endif - #ifdef USE_REINDHART_TONEMAPPER - color.rgb = tonemap_reindhart(color.rgb,white); + color.rgb = tonemap_reindhart(color.rgb, white); -# if defined(USING_GLOW) - glow = tonemap_reindhart(glow,white); -# endif +#if defined(USING_GLOW) + glow = tonemap_reindhart(glow, white); +#endif #endif #ifdef USE_FILMIC_TONEMAPPER - color.rgb = tonemap_filmic(color.rgb,white); + color.rgb = tonemap_filmic(color.rgb, white); -# if defined(USING_GLOW) - glow = tonemap_filmic(glow,white); -# endif +#if defined(USING_GLOW) + glow = tonemap_filmic(glow, white); +#endif #endif @@ -252,26 +231,26 @@ void main() { color.rgb = tonemap_aces(color.rgb); -# if defined(USING_GLOW) +#if defined(USING_GLOW) glow = tonemap_aces(glow); -# endif +#endif #endif //regular Linear -> SRGB conversion vec3 a = vec3(0.055); - color.rgb = mix( (vec3(1.0)+a)*pow(color.rgb,vec3(1.0/2.4))-a , 12.92*color.rgb , lessThan(color.rgb,vec3(0.0031308))); + color.rgb = mix((vec3(1.0) + a) * pow(color.rgb, vec3(1.0 / 2.4)) - a, 12.92 * color.rgb, lessThan(color.rgb, vec3(0.0031308))); #if defined(USING_GLOW) - glow = mix( (vec3(1.0)+a)*pow(glow,vec3(1.0/2.4))-a , 12.92*glow , lessThan(glow,vec3(0.0031308))); + glow = mix((vec3(1.0) + a) * pow(glow, vec3(1.0 / 2.4)) - a, 12.92 * glow, lessThan(glow, vec3(0.0031308))); #endif -//glow needs to be added in SRGB space (together with image space effects) + //glow needs to be added in SRGB space (together with image space effects) - color.rgb = clamp(color.rgb,0.0,1.0); + color.rgb = clamp(color.rgb, 0.0, 1.0); #if defined(USING_GLOW) - glow = clamp(glow,0.0,1.0); + glow = clamp(glow, 0.0, 1.0); #endif #ifdef USE_GLOW_REPLACE @@ -291,33 +270,32 @@ void main() { { glow = (glow * 0.5) + 0.5; - color.r = (glow.r <= 0.5) ? (color.r - (1.0 - 2.0 * glow.r) * color.r * (1.0 - color.r)) : (((glow.r > 0.5) && (color.r <= 0.25)) ? (color.r + (2.0 * glow.r - 1.0) * (4.0 * color.r * (4.0 * color.r + 1.0) * (color.r - 1.0) + 7.0 * color.r)) : (color.r + (2.0 * glow.r - 1.0) * (sqrt(color.r) - color.r))); - color.g = (glow.g <= 0.5) ? (color.g - (1.0 - 2.0 * glow.g) * color.g * (1.0 - color.g)) : (((glow.g > 0.5) && (color.g <= 0.25)) ? (color.g + (2.0 * glow.g - 1.0) * (4.0 * color.g * (4.0 * color.g + 1.0) * (color.g - 1.0) + 7.0 * color.g)) : (color.g + (2.0 * glow.g - 1.0) * (sqrt(color.g) - color.g))); - color.b = (glow.b <= 0.5) ? (color.b - (1.0 - 2.0 * glow.b) * color.b * (1.0 - color.b)) : (((glow.b > 0.5) && (color.b <= 0.25)) ? (color.b + (2.0 * glow.b - 1.0) * (4.0 * color.b * (4.0 * color.b + 1.0) * (color.b - 1.0) + 7.0 * color.b)) : (color.b + (2.0 * glow.b - 1.0) * (sqrt(color.b) - color.b))); + color.r = (glow.r <= 0.5) ? (color.r - (1.0 - 2.0 * glow.r) * color.r * (1.0 - color.r)) : (((glow.r > 0.5) && (color.r <= 0.25)) ? (color.r + (2.0 * glow.r - 1.0) * (4.0 * color.r * (4.0 * color.r + 1.0) * (color.r - 1.0) + 7.0 * color.r)) : (color.r + (2.0 * glow.r - 1.0) * (sqrt(color.r) - color.r))); + color.g = (glow.g <= 0.5) ? (color.g - (1.0 - 2.0 * glow.g) * color.g * (1.0 - color.g)) : (((glow.g > 0.5) && (color.g <= 0.25)) ? (color.g + (2.0 * glow.g - 1.0) * (4.0 * color.g * (4.0 * color.g + 1.0) * (color.g - 1.0) + 7.0 * color.g)) : (color.g + (2.0 * glow.g - 1.0) * (sqrt(color.g) - color.g))); + color.b = (glow.b <= 0.5) ? (color.b - (1.0 - 2.0 * glow.b) * color.b * (1.0 - color.b)) : (((glow.b > 0.5) && (color.b <= 0.25)) ? (color.b + (2.0 * glow.b - 1.0) * (4.0 * color.b * (4.0 * color.b + 1.0) * (color.b - 1.0) + 7.0 * color.b)) : (color.b + (2.0 * glow.b - 1.0) * (sqrt(color.b) - color.b))); } #endif #if defined(USING_GLOW) && !defined(USE_GLOW_SCREEN) && !defined(USE_GLOW_SOFTLIGHT) && !defined(USE_GLOW_REPLACE) //additive - color.rgb+=glow; + color.rgb += glow; #endif #ifdef USE_BCS - color.rgb = mix(vec3(0.0),color.rgb,bcs.x); - color.rgb = mix(vec3(0.5),color.rgb,bcs.y); - color.rgb = mix(vec3(dot(vec3(1.0),color.rgb)*0.33333),color.rgb,bcs.z); + color.rgb = mix(vec3(0.0), color.rgb, bcs.x); + color.rgb = mix(vec3(0.5), color.rgb, bcs.y); + color.rgb = mix(vec3(dot(vec3(1.0), color.rgb) * 0.33333), color.rgb, bcs.z); #endif #ifdef USE_COLOR_CORRECTION - color.r = texture(color_correction,vec2(color.r,0.0)).r; - color.g = texture(color_correction,vec2(color.g,0.0)).g; - color.b = texture(color_correction,vec2(color.b,0.0)).b; + color.r = texture(color_correction, vec2(color.r, 0.0)).r; + color.g = texture(color_correction, vec2(color.g, 0.0)).g; + color.b = texture(color_correction, vec2(color.b, 0.0)).b; #endif - - frag_color=vec4(color.rgb,1.0); + frag_color = vec4(color.rgb, 1.0); } diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 5e13bed198..643d50797e 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1173,8 +1173,8 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons { //skeleton handling - if (ci->skeleton.is_valid()) { - skeleton = storage->skeleton_owner.getornull(ci->skeleton); + if (ci->skeleton.is_valid() && storage->skeleton_owner.owns(ci->skeleton)) { + skeleton = storage->skeleton_owner.get(ci->skeleton); if (!skeleton->use_2d) { skeleton = NULL; } else { @@ -1557,17 +1557,12 @@ void RasterizerCanvasGLES3::canvas_debug_viewport_shadows(Light *p_lights_with_s int ofs = h; glDisable(GL_BLEND); - //print_line(" debug lights "); while (light) { - - //print_line("debug light"); if (light->shadow_buffer.is_valid()) { - //print_line("sb is valid"); RasterizerStorageGLES3::CanvasLightShadow *sb = storage->canvas_light_shadow_owner.get(light->shadow_buffer); if (sb) { glBindTexture(GL_TEXTURE_2D, sb->distance); - //glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); draw_generic_textured_rect(Rect2(h, ofs, w - h * 2, h), Rect2(0, 0, 1, 1)); ofs += h * 2; } @@ -1677,19 +1672,7 @@ void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, cons } break; } } - /* - if (i==0) { - for(int i=0;i<cc->lines.size();i++) { - Vector2 p = instance->xform_cache.xform(cc->lines.get(i)); - Plane pp(Vector3(p.x,p.y,0),1); - pp.normal = light.xform(pp.normal); - pp = projection.xform4(pp); - print_line(itos(i)+": "+pp.normal/pp.d); - //pp=light_mat.xform4(pp); - //print_line(itos(i)+": "+pp.normal/pp.d); - } - } -*/ + glBindVertexArray(cc->array_id); glDrawElements(GL_TRIANGLES, cc->len * 3, GL_UNSIGNED_SHORT, 0); diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index cb17695c5f..0d42635194 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -33,7 +33,9 @@ #include "gl_context/context_gl.h" #include "os/os.h" #include "project_settings.h" + #include <string.h> + RasterizerStorage *RasterizerGLES3::get_storage() { return storage; @@ -136,9 +138,7 @@ typedef void (*DebugMessageCallbackARB)(DEBUGPROCARB callback, const void *userP void RasterizerGLES3::initialize() { - if (OS::get_singleton()->is_stdout_verbose()) { - print_line("Using GLES3 video driver"); - } + print_verbose("Using GLES3 video driver"); #ifdef GLAD_ENABLED if (!gladLoadGL()) { diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 0c353d42bb..a78a392cbd 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -436,8 +436,6 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener continue; } - print_line("u - "+String(E->key())+" offset: "+itos(r_gen_code.uniform_offsets[E->get().order])); - } */ diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index ca0ce5cd3e..007600bb42 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -240,8 +240,6 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() { CharString code_globals; CharString material_string; - //print_line("code version? "+itos(conditional_version.code_version)); - CustomCode *cc = NULL; if (conditional_version.code_version > 0) { @@ -743,13 +741,6 @@ void ShaderGLES3::set_custom_shader(uint32_t p_code_id) { void ShaderGLES3::free_custom_shader(uint32_t p_code_id) { - /* if (! custom_code_map.has( p_code_id )) { - print_line("no code id "+itos(p_code_id)); - } else { - print_line("freed code id "+itos(p_code_id)); - - }*/ - ERR_FAIL_COND(!custom_code_map.has(p_code_id)); if (conditional_version.code_version == p_code_id) conditional_version.code_version = 0; //bye diff --git a/drivers/gles3/shaders/blend_shape.glsl b/drivers/gles3/shaders/blend_shape.glsl index 4e0d066823..d019062ba0 100644 --- a/drivers/gles3/shaders/blend_shape.glsl +++ b/drivers/gles3/shaders/blend_shape.glsl @@ -1,6 +1,5 @@ [vertex] - /* from VisualServer: @@ -23,56 +22,56 @@ ARRAY_INDEX=8, /* INPUT ATTRIBS */ -layout(location=0) in highp VFORMAT vertex_attrib; -layout(location=1) in vec3 normal_attrib; +layout(location = 0) in highp VFORMAT vertex_attrib; +layout(location = 1) in vec3 normal_attrib; #ifdef ENABLE_TANGENT -layout(location=2) in vec4 tangent_attrib; +layout(location = 2) in vec4 tangent_attrib; #endif #ifdef ENABLE_COLOR -layout(location=3) in vec4 color_attrib; +layout(location = 3) in vec4 color_attrib; #endif #ifdef ENABLE_UV -layout(location=4) in vec2 uv_attrib; +layout(location = 4) in vec2 uv_attrib; #endif #ifdef ENABLE_UV2 -layout(location=5) in vec2 uv2_attrib; +layout(location = 5) in vec2 uv2_attrib; #endif #ifdef ENABLE_SKELETON -layout(location=6) in ivec4 bone_attrib; -layout(location=7) in vec4 weight_attrib; +layout(location = 6) in ivec4 bone_attrib; +layout(location = 7) in vec4 weight_attrib; #endif /* BLEND ATTRIBS */ #ifdef ENABLE_BLEND -layout(location=8) in highp VFORMAT vertex_attrib_blend; -layout(location=9) in vec3 normal_attrib_blend; +layout(location = 8) in highp VFORMAT vertex_attrib_blend; +layout(location = 9) in vec3 normal_attrib_blend; #ifdef ENABLE_TANGENT -layout(location=10) in vec4 tangent_attrib_blend; +layout(location = 10) in vec4 tangent_attrib_blend; #endif #ifdef ENABLE_COLOR -layout(location=11) in vec4 color_attrib_blend; +layout(location = 11) in vec4 color_attrib_blend; #endif #ifdef ENABLE_UV -layout(location=12) in vec2 uv_attrib_blend; +layout(location = 12) in vec2 uv_attrib_blend; #endif #ifdef ENABLE_UV2 -layout(location=13) in vec2 uv2_attrib_blend; +layout(location = 13) in vec2 uv2_attrib_blend; #endif #ifdef ENABLE_SKELETON -layout(location=14) in ivec4 bone_attrib_blend; -layout(location=15) in vec4 weight_attrib_blend; +layout(location = 14) in ivec4 bone_attrib_blend; +layout(location = 15) in vec4 weight_attrib_blend; #endif #endif @@ -110,7 +109,6 @@ uniform float blend_amount; void main() { - #ifdef ENABLE_BLEND vertex_out = vertex_attrib_blend + vertex_attrib * blend_amount; @@ -140,7 +138,6 @@ void main() { uv2_out = uv2_attrib_blend + uv2_attrib * blend_amount; #endif - #ifdef ENABLE_SKELETON bone_out = bone_attrib_blend; @@ -149,7 +146,6 @@ void main() { #else //ENABLE_BLEND - vertex_out = vertex_attrib * blend_amount; #ifdef ENABLE_NORMAL @@ -177,7 +173,6 @@ void main() { uv2_out = uv2_attrib * blend_amount; #endif - #ifdef ENABLE_SKELETON bone_out = bone_attrib; @@ -190,8 +185,6 @@ void main() { [fragment] - void main() { } - diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index e7828d265c..9e99305fe7 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -1,12 +1,11 @@ [vertex] - -layout(location=0) in highp vec2 vertex; -layout(location=3) in vec4 color_attrib; +layout(location = 0) in highp vec2 vertex; +layout(location = 3) in vec4 color_attrib; #ifdef USE_SKELETON -layout(location=6) in uvec4 bone_indices; // attrib:6 -layout(location=7) in vec4 bone_weights; // attrib:7 +layout(location = 6) in uvec4 bone_indices; // attrib:6 +layout(location = 7) in vec4 bone_weights; // attrib:7 #endif #ifdef USE_TEXTURE_RECT @@ -18,25 +17,24 @@ uniform vec4 src_rect; #ifdef USE_INSTANCING -layout(location=8) in highp vec4 instance_xform0; -layout(location=9) in highp vec4 instance_xform1; -layout(location=10) in highp vec4 instance_xform2; -layout(location=11) in lowp vec4 instance_color; +layout(location = 8) in highp vec4 instance_xform0; +layout(location = 9) in highp vec4 instance_xform1; +layout(location = 10) in highp vec4 instance_xform2; +layout(location = 11) in lowp vec4 instance_color; #ifdef USE_INSTANCE_CUSTOM -layout(location=12) in highp vec4 instance_custom_data; +layout(location = 12) in highp vec4 instance_custom_data; #endif #endif -layout(location=4) in highp vec2 uv_attrib; +layout(location = 4) in highp vec2 uv_attrib; -//skeletn +// skeleton #endif uniform highp vec2 color_texpixel_size; - layout(std140) uniform CanvasItemData { //ubo:0 highp mat4 projection_matrix; @@ -46,7 +44,6 @@ layout(std140) uniform CanvasItemData { //ubo:0 uniform highp mat4 modelview_matrix; uniform highp mat4 extra_matrix; - out highp vec2 uv_interp; out mediump vec4 color_interp; @@ -55,7 +52,6 @@ out mediump vec4 color_interp; out highp vec2 pixel_size_interp; #endif - #ifdef USE_SKELETON uniform mediump sampler2D skeleton_texture; // texunit:-1 uniform highp mat4 skeleton_transform; @@ -66,7 +62,7 @@ uniform highp mat4 skeleton_transform_inverse; layout(std140) uniform LightData { //ubo:1 - //light matrices + // light matrices highp mat4 light_matrix; highp mat4 light_local_matrix; highp mat4 shadow_matrix; @@ -80,11 +76,9 @@ layout(std140) uniform LightData { //ubo:1 highp float shadow_distance_mult; }; - out vec4 light_uv_interp; out vec2 transformed_light_uv; - out vec4 local_rot; #ifdef USE_SHADOWS @@ -101,7 +95,6 @@ uniform int h_frames; uniform int v_frames; #endif - #if defined(USE_MATERIAL) layout(std140) uniform UniformData { //ubo:2 @@ -112,7 +105,6 @@ MATERIAL_UNIFORMS #endif - VERTEX_SHADER_GLOBALS void main() { @@ -120,8 +112,8 @@ void main() { vec4 color = color_attrib; #ifdef USE_INSTANCING - mat4 extra_matrix2 = extra_matrix * transpose(mat4(instance_xform0,instance_xform1,instance_xform2,vec4(0.0,0.0,0.0,1.0))); - color*=instance_color; + mat4 extra_matrix2 = extra_matrix * transpose(mat4(instance_xform0, instance_xform1, instance_xform2, vec4(0.0, 0.0, 0.0, 1.0))); + color *= instance_color; vec4 instance_custom = instance_custom_data; #else @@ -136,29 +128,27 @@ void main() { } else { uv_interp = src_rect.xy + abs(src_rect.zw) * vertex; } - highp vec4 outvec = vec4(dst_rect.xy + abs(dst_rect.zw) * mix(vertex,vec2(1.0,1.0)-vertex,lessThan(src_rect.zw,vec2(0.0,0.0))),0.0,1.0); + highp vec4 outvec = vec4(dst_rect.xy + abs(dst_rect.zw) * mix(vertex, vec2(1.0, 1.0) - vertex, lessThan(src_rect.zw, vec2(0.0, 0.0))), 0.0, 1.0); #else uv_interp = uv_attrib; - highp vec4 outvec = vec4(vertex,0.0,1.0); + highp vec4 outvec = vec4(vertex, 0.0, 1.0); #endif - #ifdef USE_PARTICLES //scale by texture size - outvec.xy/=color_texpixel_size; + outvec.xy /= color_texpixel_size; //compute h and v frames and adjust UV interp for animation int total_frames = h_frames * v_frames; - int frame = min(int(float(total_frames) *instance_custom.z),total_frames-1); - float frame_w = 1.0/float(h_frames); - float frame_h = 1.0/float(v_frames); + int frame = min(int(float(total_frames) * instance_custom.z), total_frames - 1); + float frame_w = 1.0 / float(h_frames); + float frame_h = 1.0 / float(v_frames); uv_interp.x = uv_interp.x * frame_w + frame_w * float(frame % h_frames); uv_interp.y = uv_interp.y * frame_h + frame_h * float(frame / h_frames); #endif - #define extra_matrix extra_matrix2 { @@ -167,10 +157,9 @@ VERTEX_SHADER_CODE } - #ifdef USE_NINEPATCH - pixel_size_interp=abs(dst_rect.zw) * vertex; + pixel_size_interp = abs(dst_rect.zw) * vertex; #endif #if !defined(SKIP_TRANSFORM_USED) @@ -184,47 +173,46 @@ VERTEX_SHADER_CODE #ifdef USE_PIXEL_SNAP - outvec.xy=floor(outvec+0.5).xy; + outvec.xy = floor(outvec + 0.5).xy; #endif - #ifdef USE_SKELETON - if (bone_weights!=vec4(0.0)){ //must be a valid bone + if (bone_weights != vec4(0.0)) { //must be a valid bone //skeleton transform ivec4 bone_indicesi = ivec4(bone_indices); - ivec2 tex_ofs = ivec2( bone_indicesi.x%256, (bone_indicesi.x/256)*2 ); + ivec2 tex_ofs = ivec2(bone_indicesi.x % 256, (bone_indicesi.x / 256) * 2); - highp mat2x4 m = mat2x4( - texelFetch(skeleton_texture,tex_ofs,0), - texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0) - ) * bone_weights.x; + highp mat2x4 m; + m = mat2x4( + texelFetch(skeleton_texture, tex_ofs, 0), + texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0)) + * bone_weights.x; - tex_ofs = ivec2( bone_indicesi.y%256, (bone_indicesi.y/256)*2 ); + tex_ofs = ivec2(bone_indicesi.y % 256, (bone_indicesi.y / 256) * 2); - m+= mat2x4( - texelFetch(skeleton_texture,tex_ofs,0), - texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0) - ) * bone_weights.y; + m += mat2x4( + texelFetch(skeleton_texture, tex_ofs, 0), + texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0)) + * bone_weights.y; - tex_ofs = ivec2( bone_indicesi.z%256, (bone_indicesi.z/256)*2 ); + tex_ofs = ivec2(bone_indicesi.z % 256, (bone_indicesi.z / 256) * 2); - m+= mat2x4( - texelFetch(skeleton_texture,tex_ofs,0), - texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0) - ) * bone_weights.z; + m += mat2x4( + texelFetch(skeleton_texture, tex_ofs, 0), + texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0)) + * bone_weights.z; + tex_ofs = ivec2(bone_indicesi.w % 256, (bone_indicesi.w / 256) * 2); - tex_ofs = ivec2( bone_indicesi.w%256, (bone_indicesi.w/256)*2 ); + m += mat2x4( + texelFetch(skeleton_texture, tex_ofs, 0), + texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0)) + * bone_weights.w; - m+= mat2x4( - texelFetch(skeleton_texture,tex_ofs,0), - texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0) - ) * bone_weights.w; - - mat4 bone_matrix = skeleton_transform * transpose(mat4(m[0],m[1],vec4(0.0,0.0,1.0,0.0),vec4(0.0,0.0,0.0,1.0))) * skeleton_transform_inverse; + mat4 bone_matrix = skeleton_transform * transpose(mat4(m[0], m[1], vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0))) * skeleton_transform_inverse; outvec = bone_matrix * outvec; } @@ -236,45 +224,37 @@ VERTEX_SHADER_CODE #ifdef USE_LIGHTING light_uv_interp.xy = (light_matrix * outvec).xy; - light_uv_interp.zw =(light_local_matrix * outvec).xy; + light_uv_interp.zw = (light_local_matrix * outvec).xy; mat3 inverse_light_matrix = mat3(inverse(light_matrix)); inverse_light_matrix[0] = normalize(inverse_light_matrix[0]); inverse_light_matrix[1] = normalize(inverse_light_matrix[1]); inverse_light_matrix[2] = normalize(inverse_light_matrix[2]); - transformed_light_uv = (inverse_light_matrix * vec3(light_uv_interp.zw,0.0)).xy; //for normal mapping + transformed_light_uv = (inverse_light_matrix * vec3(light_uv_interp.zw, 0.0)).xy; //for normal mapping #ifdef USE_SHADOWS - pos=outvec.xy; + pos = outvec.xy; #endif - - local_rot.xy=normalize( (modelview_matrix * ( extra_matrix * vec4(1.0,0.0,0.0,0.0) )).xy ); - local_rot.zw=normalize( (modelview_matrix * ( extra_matrix * vec4(0.0,1.0,0.0,0.0) )).xy ); + local_rot.xy = normalize((modelview_matrix * (extra_matrix * vec4(1.0, 0.0, 0.0, 0.0))).xy); + local_rot.zw = normalize((modelview_matrix * (extra_matrix * vec4(0.0, 1.0, 0.0, 0.0))).xy); #ifdef USE_TEXTURE_RECT - local_rot.xy*=sign(src_rect.z); - local_rot.zw*=sign(src_rect.w); + local_rot.xy *= sign(src_rect.z); + local_rot.zw *= sign(src_rect.w); #endif - - #endif - } [fragment] - - uniform mediump sampler2D color_texture; // texunit:0 uniform highp vec2 color_texpixel_size; uniform mediump sampler2D normal_texture; // texunit:1 - in highp vec2 uv_interp; in mediump vec4 color_interp; - #if defined(SCREEN_TEXTURE_USED) uniform sampler2D screen_texture; // texunit:-3 @@ -292,7 +272,6 @@ layout(std140) uniform CanvasItemData { highp float time; }; - #ifdef USE_LIGHTING layout(std140) uniform LightData { @@ -314,10 +293,8 @@ uniform lowp sampler2D light_texture; // texunit:-1 in vec4 light_uv_interp; in vec2 transformed_light_uv; - in vec4 local_rot; - #ifdef USE_SHADOWS uniform highp sampler2D shadow_texture; // texunit:-2 @@ -332,11 +309,7 @@ const bool at_light_pass = false; uniform mediump vec4 final_modulate; - - - -layout(location=0) out mediump vec4 frag_color; - +layout(location = 0) out mediump vec4 frag_color; #if defined(USE_MATERIAL) @@ -351,25 +324,24 @@ MATERIAL_UNIFORMS FRAGMENT_SHADER_GLOBALS void light_compute( - inout vec4 light, - inout vec2 light_vec, - inout float light_height, - inout vec4 light_color, - vec2 light_uv, - inout vec4 shadow_color, - vec3 normal, - vec2 uv, + inout vec4 light, + inout vec2 light_vec, + inout float light_height, + inout vec4 light_color, + vec2 light_uv, + inout vec4 shadow_color, + vec3 normal, + vec2 uv, #if defined(SCREEN_UV_USED) - vec2 screen_uv, + vec2 screen_uv, #endif - vec4 color) { + vec4 color) { #if defined(USE_LIGHT_SHADER_CODE) LIGHT_SHADER_CODE #endif - } #ifdef USE_TEXTURE_RECT @@ -385,48 +357,44 @@ in highp vec2 pixel_size_interp; uniform int np_repeat_v; uniform int np_repeat_h; uniform bool np_draw_center; -//left top right bottom in pixel coordinates +// left top right bottom in pixel coordinates uniform vec4 np_margins; +float map_ninepatch_axis(float pixel, float draw_size, float tex_pixel_size, float margin_begin, float margin_end, int np_repeat, inout int draw_center) { - -float map_ninepatch_axis(float pixel, float draw_size,float tex_pixel_size,float margin_begin,float margin_end,int np_repeat,inout int draw_center) { - - - float tex_size = 1.0/tex_pixel_size; + float tex_size = 1.0 / tex_pixel_size; if (pixel < margin_begin) { return pixel * tex_pixel_size; - } else if (pixel >= draw_size-margin_end) { - return (tex_size-(draw_size-pixel)) * tex_pixel_size; + } else if (pixel >= draw_size - margin_end) { + return (tex_size - (draw_size - pixel)) * tex_pixel_size; } else { - if (!np_draw_center){ + if (!np_draw_center) { draw_center--; } - if (np_repeat==0) { //stretch + if (np_repeat == 0) { //stretch //convert to ratio float ratio = (pixel - margin_begin) / (draw_size - margin_begin - margin_end); //scale to source texture return (margin_begin + ratio * (tex_size - margin_begin - margin_end)) * tex_pixel_size; - } else if (np_repeat==1) { //tile + } else if (np_repeat == 1) { //tile //convert to ratio float ofs = mod((pixel - margin_begin), tex_size - margin_begin - margin_end); //scale to source texture return (margin_begin + ofs) * tex_pixel_size; - } else if (np_repeat==2) { //tile fit + } else if (np_repeat == 2) { //tile fit //convert to ratio float src_area = draw_size - margin_begin - margin_end; float dst_area = tex_size - margin_begin - margin_end; - float scale = max(1.0,floor(src_area / max(dst_area,0.0000001) + 0.5)); + float scale = max(1.0, floor(src_area / max(dst_area, 0.0000001) + 0.5)); //convert to ratio float ratio = (pixel - margin_begin) / src_area; - ratio = mod(ratio * scale,1.0); + ratio = mod(ratio * scale, 1.0); return (margin_begin + ratio * dst_area) * tex_pixel_size; } } - } #endif @@ -443,42 +411,39 @@ void main() { #ifdef USE_NINEPATCH - int draw_center=2; + int draw_center = 2; uv = vec2( - map_ninepatch_axis(pixel_size_interp.x,abs(dst_rect.z),color_texpixel_size.x,np_margins.x,np_margins.z,np_repeat_h,draw_center), - map_ninepatch_axis(pixel_size_interp.y,abs(dst_rect.w),color_texpixel_size.y,np_margins.y,np_margins.w,np_repeat_v,draw_center) - ); + map_ninepatch_axis(pixel_size_interp.x, abs(dst_rect.z), color_texpixel_size.x, np_margins.x, np_margins.z, np_repeat_h, draw_center), + map_ninepatch_axis(pixel_size_interp.y, abs(dst_rect.w), color_texpixel_size.y, np_margins.y, np_margins.w, np_repeat_v, draw_center)); - if (draw_center==0) { - color.a=0.0; + if (draw_center == 0) { + color.a = 0.0; } - uv = uv*src_rect.zw+src_rect.xy; //apply region if needed + uv = uv * src_rect.zw + src_rect.xy; //apply region if needed #endif if (clip_rect_uv) { - uv = clamp(uv,src_rect.xy,src_rect.xy+abs(src_rect.zw)); + uv = clamp(uv, src_rect.xy, src_rect.xy + abs(src_rect.zw)); } #endif #if !defined(COLOR_USED) -//default behavior, texture by color + //default behavior, texture by color #ifdef USE_DISTANCE_FIELD - const float smoothing = 1.0/32.0; - float distance = textureLod(color_texture, uv,0.0).a; + const float smoothing = 1.0 / 32.0; + float distance = textureLod(color_texture, uv, 0.0).a; color.a = smoothstep(0.5 - smoothing, 0.5 + smoothing, distance) * color.a; #else - color *= texture( color_texture, uv ); + color *= texture(color_texture, uv); #endif #endif - - vec3 normal; #if defined(NORMAL_USED) @@ -489,59 +454,52 @@ void main() { #endif if (use_default_normal) { - normal.xy = textureLod(normal_texture, uv,0.0).xy * 2.0 - 1.0; - normal.z = sqrt(1.0-dot(normal.xy,normal.xy)); - normal_used=true; + normal.xy = textureLod(normal_texture, uv, 0.0).xy * 2.0 - 1.0; + normal.z = sqrt(1.0 - dot(normal.xy, normal.xy)); + normal_used = true; } else { - normal = vec3(0.0,0.0,1.0); + normal = vec3(0.0, 0.0, 1.0); } - - #if defined(SCREEN_UV_USED) - vec2 screen_uv = gl_FragCoord.xy*screen_pixel_size; + vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size; #endif - -{ - float normal_depth=1.0; + { + float normal_depth = 1.0; #if defined(NORMALMAP_USED) - vec3 normal_map=vec3(0.0,0.0,1.0); + vec3 normal_map = vec3(0.0, 0.0, 1.0); #endif FRAGMENT_SHADER_CODE #if defined(NORMALMAP_USED) - normal = mix(vec3(0.0,0.0,1.0), normal_map * vec3(2.0,-2.0,1.0) - vec3( 1.0, -1.0, 0.0 ), normal_depth ); + normal = mix(vec3(0.0, 0.0, 1.0), normal_map * vec3(2.0, -2.0, 1.0) - vec3(1.0, -1.0, 0.0), normal_depth); #endif - -} + } #ifdef DEBUG_ENCODED_32 - highp float enc32 = dot( color,highp vec4(1.0 / (256.0 * 256.0 * 256.0),1.0 / (256.0 * 256.0),1.0 / 256.0,1) ); - color = vec4(vec3(enc32),1.0); + highp float enc32 = dot(color, highp vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1)); + color = vec4(vec3(enc32), 1.0); #endif - - color*=final_modulate; - - + color *= final_modulate; #ifdef USE_LIGHTING vec2 light_vec = transformed_light_uv; if (normal_used) { - normal.xy = mat2(local_rot.xy,local_rot.zw) * normal.xy; + normal.xy = mat2(local_rot.xy, local_rot.zw) * normal.xy; } - float att=1.0; + float att = 1.0; vec2 light_uv = light_uv_interp.xy; - vec4 light = texture(light_texture,light_uv); + vec4 light = texture(light_texture, light_uv); - if (any(lessThan(light_uv_interp.xy,vec2(0.0,0.0))) || any(greaterThanEqual(light_uv_interp.xy,vec2(1.0,1.0)))) { - color.a*=light_outside_alpha; //invisible + if (any(lessThan(light_uv_interp.xy, vec2(0.0, 0.0))) || any(greaterThanEqual(light_uv_interp.xy, vec2(1.0, 1.0)))) { + color.a *= light_outside_alpha; //invisible } else { float real_light_height = light_height; @@ -549,178 +507,176 @@ FRAGMENT_SHADER_CODE vec4 real_light_shadow_color = light_shadow_color; #if defined(USE_LIGHT_SHADER_CODE) -//light is written by the light shader + //light is written by the light shader light_compute( - light, - light_vec, - real_light_height, - real_light_color, - light_uv, - real_light_shadow_color, - normal, - uv, + light, + light_vec, + real_light_height, + real_light_color, + light_uv, + real_light_shadow_color, + normal, + uv, #if defined(SCREEN_UV_USED) - screen_uv, + screen_uv, #endif - color); + color); #endif light *= real_light_color; if (normal_used) { - vec3 light_normal = normalize(vec3(light_vec,-real_light_height)); - light*=max(dot(-light_normal,normal),0.0); + vec3 light_normal = normalize(vec3(light_vec, -real_light_height)); + light *= max(dot(-light_normal, normal), 0.0); } - color*=light; + color *= light; #ifdef USE_SHADOWS light_vec = light_uv_interp.zw; //for shadows - float angle_to_light = -atan(light_vec.x,light_vec.y); + float angle_to_light = -atan(light_vec.x, light_vec.y); float PI = 3.14159265358979323846264; /*int i = int(mod(floor((angle_to_light+7.0*PI/6.0)/(4.0*PI/6.0))+1.0, 3.0)); // +1 pq os indices estao em ordem 2,0,1 nos arrays float ang*/ - float su,sz; + float su, sz; float abs_angle = abs(angle_to_light); vec2 point; float sh; - if (abs_angle<45.0*PI/180.0) { + if (abs_angle < 45.0 * PI / 180.0) { point = light_vec; - sh=0.0+(1.0/8.0); - } else if (abs_angle>135.0*PI/180.0) { + sh = 0.0 + (1.0 / 8.0); + } else if (abs_angle > 135.0 * PI / 180.0) { point = -light_vec; - sh = 0.5+(1.0/8.0); - } else if (angle_to_light>0.0) { + sh = 0.5 + (1.0 / 8.0); + } else if (angle_to_light > 0.0) { - point = vec2(light_vec.y,-light_vec.x); - sh = 0.25+(1.0/8.0); + point = vec2(light_vec.y, -light_vec.x); + sh = 0.25 + (1.0 / 8.0); } else { - point = vec2(-light_vec.y,light_vec.x); - sh = 0.75+(1.0/8.0); - + point = vec2(-light_vec.y, light_vec.x); + sh = 0.75 + (1.0 / 8.0); } - - highp vec4 s = shadow_matrix * vec4(point,0.0,1.0); - s.xyz/=s.w; - su=s.x*0.5+0.5; - sz=s.z*0.5+0.5; + highp vec4 s = shadow_matrix * vec4(point, 0.0, 1.0); + s.xyz /= s.w; + su = s.x * 0.5 + 0.5; + sz = s.z * 0.5 + 0.5; //sz=lightlength(light_vec); - highp float shadow_attenuation=0.0; + highp float shadow_attenuation = 0.0; #ifdef USE_RGBA_SHADOWS -#define SHADOW_DEPTH(m_tex,m_uv) dot(texture((m_tex),(m_uv)),vec4(1.0 / (256.0 * 256.0 * 256.0),1.0 / (256.0 * 256.0),1.0 / 256.0,1) ) +#define SHADOW_DEPTH(m_tex, m_uv) dot(texture((m_tex), (m_uv)), vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1)) #else -#define SHADOW_DEPTH(m_tex,m_uv) (texture((m_tex),(m_uv)).r) +#define SHADOW_DEPTH(m_tex, m_uv) (texture((m_tex), (m_uv)).r) #endif - - #ifdef SHADOW_USE_GRADIENT -#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture,vec2(m_ofs,sh)); shadow_attenuation+=1.0-smoothstep(sd,sd+shadow_gradient,sz); } +#define SHADOW_TEST(m_ofs) \ + { \ + highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); \ + shadow_attenuation += 1.0 - smoothstep(sd, sd + shadow_gradient, sz); \ + } #else -#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture,vec2(m_ofs,sh)); shadow_attenuation+=step(sz,sd); } +#define SHADOW_TEST(m_ofs) \ + { \ + highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); \ + shadow_attenuation += step(sz, sd); \ + } #endif - #ifdef SHADOW_FILTER_NEAREST SHADOW_TEST(su); #endif - #ifdef SHADOW_FILTER_PCF3 - SHADOW_TEST(su+shadowpixel_size); + SHADOW_TEST(su + shadowpixel_size); SHADOW_TEST(su); - SHADOW_TEST(su-shadowpixel_size); - shadow_attenuation/=3.0; + SHADOW_TEST(su - shadowpixel_size); + shadow_attenuation /= 3.0; #endif - #ifdef SHADOW_FILTER_PCF5 - SHADOW_TEST(su+shadowpixel_size*2.0); - SHADOW_TEST(su+shadowpixel_size); + SHADOW_TEST(su + shadowpixel_size * 2.0); + SHADOW_TEST(su + shadowpixel_size); SHADOW_TEST(su); - SHADOW_TEST(su-shadowpixel_size); - SHADOW_TEST(su-shadowpixel_size*2.0); - shadow_attenuation/=5.0; + SHADOW_TEST(su - shadowpixel_size); + SHADOW_TEST(su - shadowpixel_size * 2.0); + shadow_attenuation /= 5.0; #endif - #ifdef SHADOW_FILTER_PCF7 - SHADOW_TEST(su+shadowpixel_size*3.0); - SHADOW_TEST(su+shadowpixel_size*2.0); - SHADOW_TEST(su+shadowpixel_size); + SHADOW_TEST(su + shadowpixel_size * 3.0); + SHADOW_TEST(su + shadowpixel_size * 2.0); + SHADOW_TEST(su + shadowpixel_size); SHADOW_TEST(su); - SHADOW_TEST(su-shadowpixel_size); - SHADOW_TEST(su-shadowpixel_size*2.0); - SHADOW_TEST(su-shadowpixel_size*3.0); - shadow_attenuation/=7.0; + SHADOW_TEST(su - shadowpixel_size); + SHADOW_TEST(su - shadowpixel_size * 2.0); + SHADOW_TEST(su - shadowpixel_size * 3.0); + shadow_attenuation /= 7.0; #endif - #ifdef SHADOW_FILTER_PCF9 - SHADOW_TEST(su+shadowpixel_size*4.0); - SHADOW_TEST(su+shadowpixel_size*3.0); - SHADOW_TEST(su+shadowpixel_size*2.0); - SHADOW_TEST(su+shadowpixel_size); + SHADOW_TEST(su + shadowpixel_size * 4.0); + SHADOW_TEST(su + shadowpixel_size * 3.0); + SHADOW_TEST(su + shadowpixel_size * 2.0); + SHADOW_TEST(su + shadowpixel_size); SHADOW_TEST(su); - SHADOW_TEST(su-shadowpixel_size); - SHADOW_TEST(su-shadowpixel_size*2.0); - SHADOW_TEST(su-shadowpixel_size*3.0); - SHADOW_TEST(su-shadowpixel_size*4.0); - shadow_attenuation/=9.0; + SHADOW_TEST(su - shadowpixel_size); + SHADOW_TEST(su - shadowpixel_size * 2.0); + SHADOW_TEST(su - shadowpixel_size * 3.0); + SHADOW_TEST(su - shadowpixel_size * 4.0); + shadow_attenuation /= 9.0; #endif #ifdef SHADOW_FILTER_PCF13 - SHADOW_TEST(su+shadowpixel_size*6.0); - SHADOW_TEST(su+shadowpixel_size*5.0); - SHADOW_TEST(su+shadowpixel_size*4.0); - SHADOW_TEST(su+shadowpixel_size*3.0); - SHADOW_TEST(su+shadowpixel_size*2.0); - SHADOW_TEST(su+shadowpixel_size); + SHADOW_TEST(su + shadowpixel_size * 6.0); + SHADOW_TEST(su + shadowpixel_size * 5.0); + SHADOW_TEST(su + shadowpixel_size * 4.0); + SHADOW_TEST(su + shadowpixel_size * 3.0); + SHADOW_TEST(su + shadowpixel_size * 2.0); + SHADOW_TEST(su + shadowpixel_size); SHADOW_TEST(su); - SHADOW_TEST(su-shadowpixel_size); - SHADOW_TEST(su-shadowpixel_size*2.0); - SHADOW_TEST(su-shadowpixel_size*3.0); - SHADOW_TEST(su-shadowpixel_size*4.0); - SHADOW_TEST(su-shadowpixel_size*5.0); - SHADOW_TEST(su-shadowpixel_size*6.0); - shadow_attenuation/=13.0; + SHADOW_TEST(su - shadowpixel_size); + SHADOW_TEST(su - shadowpixel_size * 2.0); + SHADOW_TEST(su - shadowpixel_size * 3.0); + SHADOW_TEST(su - shadowpixel_size * 4.0); + SHADOW_TEST(su - shadowpixel_size * 5.0); + SHADOW_TEST(su - shadowpixel_size * 6.0); + shadow_attenuation /= 13.0; #endif - //color*=shadow_attenuation; - color=mix(real_light_shadow_color,color,shadow_attenuation); + //color *= shadow_attenuation; + color = mix(real_light_shadow_color, color, shadow_attenuation); //use shadows #endif } //use lighting #endif - //color.rgb*=color.a; + //color.rgb *= color.a; frag_color = color; - } diff --git a/drivers/gles3/shaders/canvas_shadow.glsl b/drivers/gles3/shaders/canvas_shadow.glsl index c757990de0..b06e9076d9 100644 --- a/drivers/gles3/shaders/canvas_shadow.glsl +++ b/drivers/gles3/shaders/canvas_shadow.glsl @@ -1,20 +1,18 @@ [vertex] - - uniform highp mat4 projection_matrix; uniform highp mat4 light_matrix; uniform highp mat4 world_matrix; uniform highp float distance_norm; -layout(location=0) in highp vec3 vertex; +layout(location = 0) in highp vec3 vertex; out highp vec4 position_interp; void main() { - gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex,1.0))); - position_interp=gl_Position; + gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex, 1.0))); + position_interp = gl_Position; } [fragment] @@ -22,28 +20,22 @@ void main() { in highp vec4 position_interp; #ifdef USE_RGBA_SHADOWS - -layout(location=0) out lowp vec4 distance_buf; - +layout(location = 0) out lowp vec4 distance_buf; #else - -layout(location=0) out highp float distance_buf; - +layout(location = 0) out highp float distance_buf; #endif void main() { - highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0;//bias; + highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0; // bias #ifdef USE_RGBA_SHADOWS highp vec4 comp = fract(depth * vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0)); comp -= comp.xxyz * vec4(0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0); - distance_buf=comp; + distance_buf = comp; #else - distance_buf=depth; - + distance_buf = depth; #endif } - diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl index 1b7c626d3c..e17b71df27 100644 --- a/drivers/gles3/shaders/copy.glsl +++ b/drivers/gles3/shaders/copy.glsl @@ -1,13 +1,12 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; +layout(location = 0) in highp vec4 vertex_attrib; #if defined(USE_CUBEMAP) || defined(USE_PANORAMA) -layout(location=4) in vec3 cube_in; +layout(location = 4) in vec3 cube_in; #else -layout(location=4) in vec2 uv_in; +layout(location = 4) in vec2 uv_in; #endif -layout(location=5) in vec2 uv2_in; +layout(location = 5) in vec2 uv2_in; #if defined(USE_CUBEMAP) || defined(USE_PANORAMA) out vec3 cube_interp; @@ -32,7 +31,7 @@ void main() { #else uv_interp = uv_in; #ifdef V_FLIP - uv_interp.y = 1.0-uv_interp.y; + uv_interp.y = 1.0 - uv_interp.y; #endif #endif @@ -44,7 +43,6 @@ void main() { uv_interp = copy_section.xy + uv_interp * copy_section.zw; gl_Position.xy = (copy_section.xy + (gl_Position.xy * 0.5 + 0.5) * copy_section.zw) * 2.0 - 1.0; #endif - } [fragment] @@ -72,38 +70,33 @@ uniform samplerCube source_cube; //texunit:0 uniform sampler2D source; //texunit:0 #endif - #ifdef USE_MULTIPLIER uniform float multiplier; #endif #if defined(USE_PANORAMA) || defined(USE_ASYM_PANO) -vec4 texturePanorama(vec3 normal,sampler2D pano ) { +vec4 texturePanorama(vec3 normal, sampler2D pano) { vec2 st = vec2( - atan(normal.x, normal.z), - acos(normal.y) - ); - - if(st.x < 0.0) - st.x += M_PI*2.0; + atan(normal.x, normal.z), + acos(normal.y)); - st/=vec2(M_PI*2.0,M_PI); + if (st.x < 0.0) + st.x += M_PI * 2.0; - return textureLod(pano,st,0.0); + st /= vec2(M_PI * 2.0, M_PI); + return textureLod(pano, st, 0.0); } #endif - uniform float stuff; uniform vec2 pixel_size; in vec2 uv2_interp; - #ifdef USE_BCS uniform vec3 bcs; @@ -118,20 +111,17 @@ uniform sampler2D color_correction; //texunit:1 layout(location = 0) out vec4 frag_color; - - - void main() { //vec4 color = color_interp; #ifdef USE_PANORAMA - vec4 color = texturePanorama( normalize(cube_interp), source ); + vec4 color = texturePanorama(normalize(cube_interp), source); #elif defined(USE_ASYM_PANO) - // When an asymmetrical projection matrix is used (applicable for stereoscopic rendering i.e. VR) we need to do this calculation per fragment to get a perspective correct result. + // When an asymmetrical projection matrix is used (applicable for stereoscopic rendering i.e. VR) we need to do this calculation per fragment to get a perspective correct result. // Note that we're ignoring the x-offset for IPD, with Z sufficiently in the distance it becomes neglectible, as a result we could probably just set cube_normal.z to -1. // The Matrix[2][0] (= asym_proj.x) and Matrix[2][1] (= asym_proj.z) values are what provide the right shift in the image. @@ -142,72 +132,68 @@ void main() { cube_normal = mat3(pano_transform) * cube_normal; cube_normal.z = -cube_normal.z; - vec4 color = texturePanorama( normalize(cube_normal.xyz), source ); + vec4 color = texturePanorama(normalize(cube_normal.xyz), source); #elif defined(USE_CUBEMAP) - vec4 color = texture( source_cube, normalize(cube_interp) ); + vec4 color = texture(source_cube, normalize(cube_interp)); #else - vec4 color = textureLod( source, uv_interp,0.0 ); + vec4 color = textureLod(source, uv_interp, 0.0); #endif - - #ifdef LINEAR_TO_SRGB //regular Linear -> SRGB conversion vec3 a = vec3(0.055); - color.rgb = mix( (vec3(1.0)+a)*pow(color.rgb,vec3(1.0/2.4))-a , 12.92*color.rgb , lessThan(color.rgb,vec3(0.0031308))); + color.rgb = mix((vec3(1.0) + a) * pow(color.rgb, vec3(1.0 / 2.4)) - a, 12.92 * color.rgb, lessThan(color.rgb, vec3(0.0031308))); #endif #ifdef SRGB_TO_LINEAR - color.rgb = mix(pow((color.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)),vec3(2.4)),color.rgb * (1.0 / 12.92),lessThan(color.rgb,vec3(0.04045))); + color.rgb = mix(pow((color.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)), vec3(2.4)), color.rgb * (1.0 / 12.92), lessThan(color.rgb, vec3(0.04045))); #endif #ifdef DEBUG_GRADIENT - color.rg=uv_interp; - color.b=0.0; + color.rg = uv_interp; + color.b = 0.0; #endif #ifdef DISABLE_ALPHA - color.a=1.0; + color.a = 1.0; #endif - #ifdef GAUSSIAN_HORIZONTAL - color*=0.38774; - color+=texture( source, uv_interp+vec2( 1.0, 0.0)*pixel_size )*0.24477; - color+=texture( source, uv_interp+vec2( 2.0, 0.0)*pixel_size )*0.06136; - color+=texture( source, uv_interp+vec2(-1.0, 0.0)*pixel_size )*0.24477; - color+=texture( source, uv_interp+vec2(-2.0, 0.0)*pixel_size )*0.06136; + color *= 0.38774; + color += texture(source, uv_interp + vec2(1.0, 0.0) * pixel_size) * 0.24477; + color += texture(source, uv_interp + vec2(2.0, 0.0) * pixel_size) * 0.06136; + color += texture(source, uv_interp + vec2(-1.0, 0.0) * pixel_size) * 0.24477; + color += texture(source, uv_interp + vec2(-2.0, 0.0) * pixel_size) * 0.06136; #endif #ifdef GAUSSIAN_VERTICAL - color*=0.38774; - color+=texture( source, uv_interp+vec2( 0.0, 1.0)*pixel_size )*0.24477; - color+=texture( source, uv_interp+vec2( 0.0, 2.0)*pixel_size )*0.06136; - color+=texture( source, uv_interp+vec2( 0.0,-1.0)*pixel_size )*0.24477; - color+=texture( source, uv_interp+vec2( 0.0,-2.0)*pixel_size )*0.06136; + color *= 0.38774; + color += texture(source, uv_interp + vec2(0.0, 1.0) * pixel_size) * 0.24477; + color += texture(source, uv_interp + vec2(0.0, 2.0) * pixel_size) * 0.06136; + color += texture(source, uv_interp + vec2(0.0, -1.0) * pixel_size) * 0.24477; + color += texture(source, uv_interp + vec2(0.0, -2.0) * pixel_size) * 0.06136; #endif #ifdef USE_BCS - color.rgb = mix(vec3(0.0),color.rgb,bcs.x); - color.rgb = mix(vec3(0.5),color.rgb,bcs.y); - color.rgb = mix(vec3(dot(vec3(1.0),color.rgb)*0.33333),color.rgb,bcs.z); + color.rgb = mix(vec3(0.0), color.rgb, bcs.x); + color.rgb = mix(vec3(0.5), color.rgb, bcs.y); + color.rgb = mix(vec3(dot(vec3(1.0), color.rgb) * 0.33333), color.rgb, bcs.z); #endif #ifdef USE_COLOR_CORRECTION - color.r = texture(color_correction,vec2(color.r,0.0)).r; - color.g = texture(color_correction,vec2(color.g,0.0)).g; - color.b = texture(color_correction,vec2(color.b,0.0)).b; + color.r = texture(color_correction, vec2(color.r, 0.0)).r; + color.g = texture(color_correction, vec2(color.g, 0.0)).g; + color.b = texture(color_correction, vec2(color.b, 0.0)).b; #endif #ifdef USE_MULTIPLIER - color.rgb*=multiplier; + color.rgb *= multiplier; #endif frag_color = color; } - diff --git a/drivers/gles3/shaders/cube_to_dp.glsl b/drivers/gles3/shaders/cube_to_dp.glsl index 5ffc78c0b9..2911746bb7 100644 --- a/drivers/gles3/shaders/cube_to_dp.glsl +++ b/drivers/gles3/shaders/cube_to_dp.glsl @@ -1,8 +1,7 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; -layout(location=4) in vec2 uv_in; +layout(location = 0) in highp vec4 vertex_attrib; +layout(location = 4) in vec2 uv_in; out vec2 uv_interp; @@ -14,7 +13,6 @@ void main() { [fragment] - uniform highp samplerCube source_cube; //texunit:0 in vec2 uv_interp; @@ -25,55 +23,53 @@ uniform highp float bias; void main() { - highp vec3 normal = vec3( uv_interp * 2.0 - 1.0, 0.0 ); -/* - if(z_flip) { - normal.z = 0.5 - 0.5*((normal.x * normal.x) + (normal.y * normal.y)); + highp vec3 normal = vec3(uv_interp * 2.0 - 1.0, 0.0); + /* + if (z_flip) { + normal.z = 0.5 - 0.5 * ((normal.x * normal.x) + (normal.y * normal.y)); } else { - normal.z = -0.5 + 0.5*((normal.x * normal.x) + (normal.y * normal.y)); + normal.z = -0.5 + 0.5 * ((normal.x * normal.x) + (normal.y * normal.y)); } -*/ + */ - //normal.z = sqrt(1.0-dot(normal.xy,normal.xy)); - //normal.xy*=1.0+normal.z; + //normal.z = sqrt(1.0 - dot(normal.xy, normal.xy)); + //normal.xy *= 1.0 + normal.z; - normal.z = 0.5 - 0.5*((normal.x * normal.x) + (normal.y * normal.y)); + normal.z = 0.5 - 0.5 * ((normal.x * normal.x) + (normal.y * normal.y)); + normal = normalize(normal); + /* + normal.z = 0.5; normal = normalize(normal); + */ -/* - normal.z=0.5; - normal=normalize(normal); -*/ if (!z_flip) { - normal.z=-normal.z; + normal.z = -normal.z; } - //normal = normalize(vec3( uv_interp * 2.0 - 1.0, 1.0 )); - float depth = texture(source_cube,normal).r; + //normal = normalize(vec3(uv_interp * 2.0 - 1.0, 1.0)); + float depth = texture(source_cube, normal).r; // absolute values for direction cosines, bigger value equals closer to basis axis vec3 unorm = abs(normal); - if ( (unorm.x >= unorm.y) && (unorm.x >= unorm.z) ) { - // x code - unorm = normal.x > 0.0 ? vec3( 1.0, 0.0, 0.0 ) : vec3( -1.0, 0.0, 0.0 ) ; - } else if ( (unorm.y > unorm.x) && (unorm.y >= unorm.z) ) { - // y code - unorm = normal.y > 0.0 ? vec3( 0.0, 1.0, 0.0 ) : vec3( 0.0, -1.0, 0.0 ) ; - } else if ( (unorm.z > unorm.x) && (unorm.z > unorm.y) ) { - // z code - unorm = normal.z > 0.0 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 0.0, 0.0, -1.0 ) ; + if ((unorm.x >= unorm.y) && (unorm.x >= unorm.z)) { + // x code + unorm = normal.x > 0.0 ? vec3(1.0, 0.0, 0.0) : vec3(-1.0, 0.0, 0.0); + } else if ((unorm.y > unorm.x) && (unorm.y >= unorm.z)) { + // y code + unorm = normal.y > 0.0 ? vec3(0.0, 1.0, 0.0) : vec3(0.0, -1.0, 0.0); + } else if ((unorm.z > unorm.x) && (unorm.z > unorm.y)) { + // z code + unorm = normal.z > 0.0 ? vec3(0.0, 0.0, 1.0) : vec3(0.0, 0.0, -1.0); } else { - // oh-no we messed up code - // has to be - unorm = vec3( 1.0, 0.0, 0.0 ); + // oh-no we messed up code + // has to be + unorm = vec3(1.0, 0.0, 0.0); } - float depth_fix = 1.0 / dot(normal,unorm); - + float depth_fix = 1.0 / dot(normal, unorm); depth = 2.0 * depth - 1.0; float linear_depth = 2.0 * z_near * z_far / (z_far + z_near - depth * (z_far - z_near)); - gl_FragDepth = (linear_depth*depth_fix+bias) / z_far; + gl_FragDepth = (linear_depth * depth_fix + bias) / z_far; } - diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl index 485fbb6ee0..7f2dc5057c 100644 --- a/drivers/gles3/shaders/cubemap_filter.glsl +++ b/drivers/gles3/shaders/cubemap_filter.glsl @@ -1,21 +1,19 @@ [vertex] +layout(location = 0) in highp vec2 vertex; -layout(location=0) in highp vec2 vertex; - -layout(location=4) in highp vec2 uv; +layout(location = 4) in highp vec2 uv; out highp vec2 uv_interp; void main() { - uv_interp=uv; - gl_Position=vec4(vertex,0,1); + uv_interp = uv; + gl_Position = vec4(vertex, 0, 1); } [fragment] - precision highp float; precision highp int; @@ -36,90 +34,85 @@ uniform int face_id; uniform float roughness; in highp vec2 uv_interp; - layout(location = 0) out vec4 frag_color; - #define M_PI 3.14159265359 - -vec3 texelCoordToVec(vec2 uv, int faceID) -{ - mat3 faceUvVectors[6]; -/* - // -x - faceUvVectors[1][0] = vec3(0.0, 0.0, 1.0); // u -> +z - faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y - faceUvVectors[1][2] = vec3(-1.0, 0.0, 0.0); // -x face - - // +x - faceUvVectors[0][0] = vec3(0.0, 0.0, -1.0); // u -> -z - faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y - faceUvVectors[0][2] = vec3(1.0, 0.0, 0.0); // +x face - - // -y - faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x - faceUvVectors[3][1] = vec3(0.0, 0.0, -1.0); // v -> -z - faceUvVectors[3][2] = vec3(0.0, -1.0, 0.0); // -y face - - // +y - faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x - faceUvVectors[2][1] = vec3(0.0, 0.0, 1.0); // v -> +z - faceUvVectors[2][2] = vec3(0.0, 1.0, 0.0); // +y face - - // -z - faceUvVectors[5][0] = vec3(-1.0, 0.0, 0.0); // u -> -x - faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y - faceUvVectors[5][2] = vec3(0.0, 0.0, -1.0); // -z face - - // +z - faceUvVectors[4][0] = vec3(1.0, 0.0, 0.0); // u -> +x - faceUvVectors[4][1] = vec3(0.0, -1.0, 0.0); // v -> -y - faceUvVectors[4][2] = vec3(0.0, 0.0, 1.0); // +z face -*/ - - // -x - faceUvVectors[0][0] = vec3(0.0, 0.0, 1.0); // u -> +z - faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y - faceUvVectors[0][2] = vec3(-1.0, 0.0, 0.0); // -x face - - // +x - faceUvVectors[1][0] = vec3(0.0, 0.0, -1.0); // u -> -z - faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y - faceUvVectors[1][2] = vec3(1.0, 0.0, 0.0); // +x face - - // -y - faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x - faceUvVectors[2][1] = vec3(0.0, 0.0, -1.0); // v -> -z - faceUvVectors[2][2] = vec3(0.0, -1.0, 0.0); // -y face - - // +y - faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x - faceUvVectors[3][1] = vec3(0.0, 0.0, 1.0); // v -> +z - faceUvVectors[3][2] = vec3(0.0, 1.0, 0.0); // +y face - - // -z - faceUvVectors[4][0] = vec3(-1.0, 0.0, 0.0); // u -> -x - faceUvVectors[4][1] = vec3(0.0, -1.0, 0.0); // v -> -y - faceUvVectors[4][2] = vec3(0.0, 0.0, -1.0); // -z face - - // +z - faceUvVectors[5][0] = vec3(1.0, 0.0, 0.0); // u -> +x - faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y - faceUvVectors[5][2] = vec3(0.0, 0.0, 1.0); // +z face - - // out = u * s_faceUv[0] + v * s_faceUv[1] + s_faceUv[2]. - vec3 result = (faceUvVectors[faceID][0] * uv.x) + (faceUvVectors[faceID][1] * uv.y) + faceUvVectors[faceID][2]; - return normalize(result); +vec3 texelCoordToVec(vec2 uv, int faceID) { + mat3 faceUvVectors[6]; + /* + // -x + faceUvVectors[1][0] = vec3(0.0, 0.0, 1.0); // u -> +z + faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[1][2] = vec3(-1.0, 0.0, 0.0); // -x face + + // +x + faceUvVectors[0][0] = vec3(0.0, 0.0, -1.0); // u -> -z + faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[0][2] = vec3(1.0, 0.0, 0.0); // +x face + + // -y + faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[3][1] = vec3(0.0, 0.0, -1.0); // v -> -z + faceUvVectors[3][2] = vec3(0.0, -1.0, 0.0); // -y face + + // +y + faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[2][1] = vec3(0.0, 0.0, 1.0); // v -> +z + faceUvVectors[2][2] = vec3(0.0, 1.0, 0.0); // +y face + + // -z + faceUvVectors[5][0] = vec3(-1.0, 0.0, 0.0); // u -> -x + faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[5][2] = vec3(0.0, 0.0, -1.0); // -z face + + // +z + faceUvVectors[4][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[4][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[4][2] = vec3(0.0, 0.0, 1.0); // +z face + */ + + // -x + faceUvVectors[0][0] = vec3(0.0, 0.0, 1.0); // u -> +z + faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[0][2] = vec3(-1.0, 0.0, 0.0); // -x face + + // +x + faceUvVectors[1][0] = vec3(0.0, 0.0, -1.0); // u -> -z + faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[1][2] = vec3(1.0, 0.0, 0.0); // +x face + + // -y + faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[2][1] = vec3(0.0, 0.0, -1.0); // v -> -z + faceUvVectors[2][2] = vec3(0.0, -1.0, 0.0); // -y face + + // +y + faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[3][1] = vec3(0.0, 0.0, 1.0); // v -> +z + faceUvVectors[3][2] = vec3(0.0, 1.0, 0.0); // +y face + + // -z + faceUvVectors[4][0] = vec3(-1.0, 0.0, 0.0); // u -> -x + faceUvVectors[4][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[4][2] = vec3(0.0, 0.0, -1.0); // -z face + + // +z + faceUvVectors[5][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[5][2] = vec3(0.0, 0.0, 1.0); // +z face + + // out = u * s_faceUv[0] + v * s_faceUv[1] + s_faceUv[2]. + vec3 result = (faceUvVectors[faceID][0] * uv.x) + (faceUvVectors[faceID][1] * uv.y) + faceUvVectors[faceID][2]; + return normalize(result); } -vec3 ImportanceSampleGGX(vec2 Xi, float Roughness, vec3 N) -{ +vec3 ImportanceSampleGGX(vec2 Xi, float Roughness, vec3 N) { float a = Roughness * Roughness; // DISNEY'S ROUGHNESS [see Burley'12 siggraph] // Compute distribution direction float Phi = 2.0 * M_PI * Xi.x; - float CosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a*a - 1.0) * Xi.y)); + float CosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a * a - 1.0) * Xi.y)); float SinTheta = sqrt(1.0 - CosTheta * CosTheta); // Convert to spherical direction @@ -137,33 +130,29 @@ vec3 ImportanceSampleGGX(vec2 Xi, float Roughness, vec3 N) } // http://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html -float GGX(float NdotV, float a) -{ +float GGX(float NdotV, float a) { float k = a / 2.0; return NdotV / (NdotV * (1.0 - k) + k); } // http://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html -float G_Smith(float a, float nDotV, float nDotL) -{ +float G_Smith(float a, float nDotV, float nDotL) { return GGX(nDotL, a * a) * GGX(nDotV, a * a); } float radicalInverse_VdC(uint bits) { - bits = (bits << 16u) | (bits >> 16u); - bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); - bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); - bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); - bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); - return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 } vec2 Hammersley(uint i, uint N) { - return vec2(float(i)/float(N), radicalInverse_VdC(i)); + return vec2(float(i) / float(N), radicalInverse_VdC(i)); } - - #ifdef LOW_QUALITY #define SAMPLE_COUNT 64u @@ -178,37 +167,33 @@ uniform bool z_flip; #ifdef USE_SOURCE_PANORAMA -vec4 texturePanorama(vec3 normal,sampler2D pano ) { +vec4 texturePanorama(vec3 normal, sampler2D pano) { vec2 st = vec2( - atan(normal.x, normal.z), - acos(normal.y) - ); - - if(st.x < 0.0) - st.x += M_PI*2.0; + atan(normal.x, normal.z), + acos(normal.y)); - st/=vec2(M_PI*2.0,M_PI); + if (st.x < 0.0) + st.x += M_PI * 2.0; - return textureLod(pano,st,0.0); + st /= vec2(M_PI * 2.0, M_PI); + return textureLod(pano, st, 0.0); } #endif #ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY - vec4 textureDualParaboloidArray(vec3 normal) { vec3 norm = normalize(normal); - norm.xy/=1.0+abs(norm.z); - norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25); - if (norm.z<0.0) { - norm.y=0.5-norm.y+0.5; + norm.xy /= 1.0 + abs(norm.z); + norm.xy = norm.xy * vec2(0.5, 0.25) + vec2(0.5, 0.25); + if (norm.z < 0.0) { + norm.y = 0.5 - norm.y + 0.5; } - return textureLod(source_dual_paraboloid_array, vec3(norm.xy, float(source_array_index) ), 0.0); - + return textureLod(source_dual_paraboloid_array, vec3(norm.xy, float(source_array_index)), 0.0); } #endif @@ -217,19 +202,18 @@ void main() { #ifdef USE_DUAL_PARABOLOID - vec3 N = vec3( uv_interp * 2.0 - 1.0, 0.0 ); - N.z = 0.5 - 0.5*((N.x * N.x) + (N.y * N.y)); + vec3 N = vec3(uv_interp * 2.0 - 1.0, 0.0); + N.z = 0.5 - 0.5 * ((N.x * N.x) + (N.y * N.y)); N = normalize(N); if (z_flip) { - N.y=-N.y; //y is flipped to improve blending between both sides - N.z=-N.z; + N.y = -N.y; //y is flipped to improve blending between both sides + N.z = -N.z; } - #else - vec2 uv = (uv_interp * 2.0) - 1.0; - vec3 N = texelCoordToVec(uv, face_id); + vec2 uv = (uv_interp * 2.0) - 1.0; + vec3 N = texelCoordToVec(uv, face_id); #endif //vec4 color = color_interp; @@ -237,49 +221,46 @@ void main() { #ifdef USE_SOURCE_PANORAMA - frag_color=vec4(texturePanorama(N,source_panorama).rgb,1.0); + frag_color = vec4(texturePanorama(N, source_panorama).rgb, 1.0); #endif #ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY - frag_color=vec4(textureDualParaboloidArray(N).rgb,1.0); + frag_color = vec4(textureDualParaboloidArray(N).rgb, 1.0); #endif #if !defined(USE_SOURCE_DUAL_PARABOLOID_ARRAY) && !defined(USE_SOURCE_PANORAMA) - N.y=-N.y; - frag_color=vec4(texture(N,source_cube).rgb,1.0); + N.y = -N.y; + frag_color = vec4(texture(N, source_cube).rgb, 1.0); #endif - - - #else vec4 sum = vec4(0.0, 0.0, 0.0, 0.0); - for(uint sampleNum = 0u; sampleNum < SAMPLE_COUNT; sampleNum++) { + for (uint sampleNum = 0u; sampleNum < SAMPLE_COUNT; sampleNum++) { vec2 xi = Hammersley(sampleNum, SAMPLE_COUNT); - vec3 H = ImportanceSampleGGX( xi, roughness, N ); - vec3 V = N; - vec3 L = normalize(2.0 * dot( V, H ) * H - V); + vec3 H = ImportanceSampleGGX(xi, roughness, N); + vec3 V = N; + vec3 L = (2.0 * dot(V, H) * H - V); - float ndotl = clamp(dot(N, L),0.0,1.0); + float ndotl = clamp(dot(N, L), 0.0, 1.0); - if (ndotl>0.0) { + if (ndotl > 0.0) { #ifdef USE_SOURCE_PANORAMA - sum.rgb += texturePanorama(H,source_panorama).rgb *ndotl; + sum.rgb += texturePanorama(L, source_panorama).rgb * ndotl; #endif #ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY - sum.rgb += textureDualParaboloidArray(H).rgb *ndotl; + sum.rgb += textureDualParaboloidArray(L).rgb * ndotl; #endif #if !defined(USE_SOURCE_DUAL_PARABOLOID_ARRAY) && !defined(USE_SOURCE_PANORAMA) - H.y=-H.y; - sum.rgb += textureLod(source_cube, H, 0.0).rgb *ndotl; + L.y = -L.y; + sum.rgb += textureLod(source_cube, L, 0.0).rgb * ndotl; #endif sum.a += ndotl; } @@ -289,6 +270,4 @@ void main() { frag_color = vec4(sum.rgb, 1.0); #endif - } - diff --git a/drivers/gles3/shaders/effect_blur.glsl b/drivers/gles3/shaders/effect_blur.glsl index c8567b4d53..3872ee8d1d 100644 --- a/drivers/gles3/shaders/effect_blur.glsl +++ b/drivers/gles3/shaders/effect_blur.glsl @@ -1,8 +1,7 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; -layout(location=4) in vec2 uv_in; +layout(location = 0) in highp vec4 vertex_attrib; +layout(location = 4) in vec2 uv_in; out vec2 uv_interp; @@ -39,7 +38,6 @@ uniform sampler2D source_ssao; //texunit:1 uniform float lod; uniform vec2 pixel_size; - layout(location = 0) out vec4 frag_color; #ifdef SSAO_MERGE @@ -48,31 +46,31 @@ uniform vec4 ssao_color; #endif -#if defined (GLOW_GAUSSIAN_HORIZONTAL) || defined(GLOW_GAUSSIAN_VERTICAL) +#if defined(GLOW_GAUSSIAN_HORIZONTAL) || defined(GLOW_GAUSSIAN_VERTICAL) uniform float glow_strength; #endif -#if defined(DOF_FAR_BLUR) || defined (DOF_NEAR_BLUR) +#if defined(DOF_FAR_BLUR) || defined(DOF_NEAR_BLUR) #ifdef DOF_QUALITY_LOW -const int dof_kernel_size=5; -const int dof_kernel_from=2; -const float dof_kernel[5] = float[] (0.153388,0.221461,0.250301,0.221461,0.153388); +const int dof_kernel_size = 5; +const int dof_kernel_from = 2; +const float dof_kernel[5] = float[](0.153388, 0.221461, 0.250301, 0.221461, 0.153388); #endif #ifdef DOF_QUALITY_MEDIUM -const int dof_kernel_size=11; -const int dof_kernel_from=5; -const float dof_kernel[11] = float[] (0.055037,0.072806,0.090506,0.105726,0.116061,0.119726,0.116061,0.105726,0.090506,0.072806,0.055037); +const int dof_kernel_size = 11; +const int dof_kernel_from = 5; +const float dof_kernel[11] = float[](0.055037, 0.072806, 0.090506, 0.105726, 0.116061, 0.119726, 0.116061, 0.105726, 0.090506, 0.072806, 0.055037); #endif #ifdef DOF_QUALITY_HIGH -const int dof_kernel_size=21; -const int dof_kernel_from=10; -const float dof_kernel[21] = float[] (0.028174,0.032676,0.037311,0.041944,0.046421,0.050582,0.054261,0.057307,0.059587,0.060998,0.061476,0.060998,0.059587,0.057307,0.054261,0.050582,0.046421,0.041944,0.037311,0.032676,0.028174); +const int dof_kernel_size = 21; +const int dof_kernel_from = 10; +const float dof_kernel[21] = float[](0.028174, 0.032676, 0.037311, 0.041944, 0.046421, 0.050582, 0.054261, 0.057307, 0.059587, 0.060998, 0.061476, 0.060998, 0.059587, 0.057307, 0.054261, 0.050582, 0.046421, 0.041944, 0.037311, 0.032676, 0.028174); #endif uniform sampler2D dof_source_depth; //texunit:1 @@ -88,7 +86,6 @@ uniform sampler2D source_dof_original; //texunit:2 #endif - #ifdef GLOW_FIRST_PASS uniform float exposure; @@ -112,53 +109,51 @@ uniform float camera_z_near; void main() { - - #ifdef GAUSSIAN_HORIZONTAL vec2 pix_size = pixel_size; - pix_size*=0.5; //reading from larger buffer, so use more samples - vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pix_size,lod )*0.214607; - color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pix_size,lod )*0.189879; - color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pix_size,lod )*0.157305; - color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pix_size,lod )*0.071303; - color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pix_size,lod )*0.189879; - color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pix_size,lod )*0.157305; - color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pix_size,lod )*0.071303; + pix_size *= 0.5; //reading from larger buffer, so use more samples + vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pix_size, lod) * 0.214607; + color += textureLod(source_color, uv_interp + vec2(1.0, 0.0) * pix_size, lod) * 0.189879; + color += textureLod(source_color, uv_interp + vec2(2.0, 0.0) * pix_size, lod) * 0.157305; + color += textureLod(source_color, uv_interp + vec2(3.0, 0.0) * pix_size, lod) * 0.071303; + color += textureLod(source_color, uv_interp + vec2(-1.0, 0.0) * pix_size, lod) * 0.189879; + color += textureLod(source_color, uv_interp + vec2(-2.0, 0.0) * pix_size, lod) * 0.157305; + color += textureLod(source_color, uv_interp + vec2(-3.0, 0.0) * pix_size, lod) * 0.071303; frag_color = color; #endif #ifdef GAUSSIAN_VERTICAL - vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pixel_size,lod )*0.38774; - color+=textureLod( source_color, uv_interp+vec2( 0.0, 1.0)*pixel_size,lod )*0.24477; - color+=textureLod( source_color, uv_interp+vec2( 0.0, 2.0)*pixel_size,lod )*0.06136; - color+=textureLod( source_color, uv_interp+vec2( 0.0,-1.0)*pixel_size,lod )*0.24477; - color+=textureLod( source_color, uv_interp+vec2( 0.0,-2.0)*pixel_size,lod )*0.06136; + vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pixel_size, lod) * 0.38774; + color += textureLod(source_color, uv_interp + vec2(0.0, 1.0) * pixel_size, lod) * 0.24477; + color += textureLod(source_color, uv_interp + vec2(0.0, 2.0) * pixel_size, lod) * 0.06136; + color += textureLod(source_color, uv_interp + vec2(0.0, -1.0) * pixel_size, lod) * 0.24477; + color += textureLod(source_color, uv_interp + vec2(0.0, -2.0) * pixel_size, lod) * 0.06136; frag_color = color; #endif -//glow uses larger sigma for a more rounded blur effect + //glow uses larger sigma for a more rounded blur effect #ifdef GLOW_GAUSSIAN_HORIZONTAL vec2 pix_size = pixel_size; - pix_size*=0.5; //reading from larger buffer, so use more samples - vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pix_size,lod )*0.174938; - color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pix_size,lod )*0.165569; - color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pix_size,lod )*0.140367; - color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pix_size,lod )*0.106595; - color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pix_size,lod )*0.165569; - color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pix_size,lod )*0.140367; - color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pix_size,lod )*0.106595; - color*=glow_strength; + pix_size *= 0.5; //reading from larger buffer, so use more samples + vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pix_size, lod) * 0.174938; + color += textureLod(source_color, uv_interp + vec2(1.0, 0.0) * pix_size, lod) * 0.165569; + color += textureLod(source_color, uv_interp + vec2(2.0, 0.0) * pix_size, lod) * 0.140367; + color += textureLod(source_color, uv_interp + vec2(3.0, 0.0) * pix_size, lod) * 0.106595; + color += textureLod(source_color, uv_interp + vec2(-1.0, 0.0) * pix_size, lod) * 0.165569; + color += textureLod(source_color, uv_interp + vec2(-2.0, 0.0) * pix_size, lod) * 0.140367; + color += textureLod(source_color, uv_interp + vec2(-3.0, 0.0) * pix_size, lod) * 0.106595; + color *= glow_strength; frag_color = color; #endif #ifdef GLOW_GAUSSIAN_VERTICAL - vec4 color =textureLod( source_color, uv_interp+vec2(0.0, 0.0)*pixel_size,lod )*0.288713; - color+=textureLod( source_color, uv_interp+vec2(0.0, 1.0)*pixel_size,lod )*0.233062; - color+=textureLod( source_color, uv_interp+vec2(0.0, 2.0)*pixel_size,lod )*0.122581; - color+=textureLod( source_color, uv_interp+vec2(0.0,-1.0)*pixel_size,lod )*0.233062; - color+=textureLod( source_color, uv_interp+vec2(0.0,-2.0)*pixel_size,lod )*0.122581; - color*=glow_strength; + vec4 color = textureLod(source_color, uv_interp + vec2(0.0, 0.0) * pixel_size, lod) * 0.288713; + color += textureLod(source_color, uv_interp + vec2(0.0, 1.0) * pixel_size, lod) * 0.233062; + color += textureLod(source_color, uv_interp + vec2(0.0, 2.0) * pixel_size, lod) * 0.122581; + color += textureLod(source_color, uv_interp + vec2(0.0, -1.0) * pixel_size, lod) * 0.233062; + color += textureLod(source_color, uv_interp + vec2(0.0, -2.0) * pixel_size, lod) * 0.122581; + color *= glow_strength; frag_color = color; #endif @@ -166,47 +161,45 @@ void main() { vec4 color_accum = vec4(0.0); - float depth = textureLod( dof_source_depth, uv_interp, 0.0).r; + float depth = textureLod(dof_source_depth, uv_interp, 0.0).r; depth = depth * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + depth = ((depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near)); #endif - float amount = smoothstep(dof_begin,dof_end,depth); - float k_accum=0.0; + float amount = smoothstep(dof_begin, dof_end, depth); + float k_accum = 0.0; - for(int i=0;i<dof_kernel_size;i++) { + for (int i = 0; i < dof_kernel_size; i++) { - int int_ofs = i-dof_kernel_from; + int int_ofs = i - dof_kernel_from; vec2 tap_uv = uv_interp + dof_dir * float(int_ofs) * amount * dof_radius; float tap_k = dof_kernel[i]; - float tap_depth = texture( dof_source_depth, tap_uv, 0.0).r; + float tap_depth = texture(dof_source_depth, tap_uv, 0.0).r; tap_depth = tap_depth * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - tap_depth = ((tap_depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + tap_depth = ((tap_depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else tap_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - tap_depth * (camera_z_far - camera_z_near)); #endif - float tap_amount = mix(smoothstep(dof_begin,dof_end,tap_depth),1.0,int_ofs==0); - tap_amount*=tap_amount*tap_amount; //prevent undesired glow effect - - vec4 tap_color = textureLod( source_color, tap_uv, 0.0) * tap_k; - - k_accum+=tap_k*tap_amount; - color_accum+=tap_color*tap_amount; + float tap_amount = mix(smoothstep(dof_begin, dof_end, tap_depth), 1.0, int_ofs == 0); + tap_amount *= tap_amount * tap_amount; //prevent undesired glow effect + vec4 tap_color = textureLod(source_color, tap_uv, 0.0) * tap_k; + k_accum += tap_k * tap_amount; + color_accum += tap_color * tap_amount; } - if (k_accum>0.0) { - color_accum/=k_accum; + if (k_accum > 0.0) { + color_accum /= k_accum; } - frag_color = color_accum;///k_accum; + frag_color = color_accum; ///k_accum; #endif @@ -214,47 +207,45 @@ void main() { vec4 color_accum = vec4(0.0); - float max_accum=0.0; + float max_accum = 0.0; - for(int i=0;i<dof_kernel_size;i++) { + for (int i = 0; i < dof_kernel_size; i++) { - int int_ofs = i-dof_kernel_from; + int int_ofs = i - dof_kernel_from; vec2 tap_uv = uv_interp + dof_dir * float(int_ofs) * dof_radius; - float ofs_influence = max(0.0,1.0-float(abs(int_ofs))/float(dof_kernel_from)); + float ofs_influence = max(0.0, 1.0 - float(abs(int_ofs)) / float(dof_kernel_from)); float tap_k = dof_kernel[i]; - vec4 tap_color = textureLod( source_color, tap_uv, 0.0); + vec4 tap_color = textureLod(source_color, tap_uv, 0.0); - float tap_depth = texture( dof_source_depth, tap_uv, 0.0).r; + float tap_depth = texture(dof_source_depth, tap_uv, 0.0).r; tap_depth = tap_depth * 2.0 - 1.0; -#ifdef USE_ORTHOGONAL_PROJECTION - tap_depth = ((tap_depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; +#ifdef USE_ORTHOGONAL_PROJECTION + tap_depth = ((tap_depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else tap_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - tap_depth * (camera_z_far - camera_z_near)); #endif - float tap_amount = 1.0-smoothstep(dof_end,dof_begin,tap_depth); - tap_amount*=tap_amount*tap_amount; //prevent undesired glow effect + float tap_amount = 1.0 - smoothstep(dof_end, dof_begin, tap_depth); + tap_amount *= tap_amount * tap_amount; //prevent undesired glow effect #ifdef DOF_NEAR_FIRST_TAP - tap_color.a= 1.0-smoothstep(dof_end,dof_begin,tap_depth); + tap_color.a = 1.0 - smoothstep(dof_end, dof_begin, tap_depth); #endif - max_accum=max(max_accum,tap_amount*ofs_influence); - - color_accum+=tap_color*tap_k; + max_accum = max(max_accum, tap_amount * ofs_influence); + color_accum += tap_color * tap_k; } - color_accum.a=max(color_accum.a,sqrt(max_accum)); - + color_accum.a = max(color_accum.a, sqrt(max_accum)); #ifdef DOF_NEAR_BLUR_MERGE - vec4 original = textureLod( source_dof_original, uv_interp, 0.0); - color_accum = mix(original,color_accum,color_accum.a); + vec4 original = textureLod(source_dof_original, uv_interp, 0.0); + color_accum = mix(original, color_accum, color_accum.a); #endif @@ -265,37 +256,32 @@ void main() { #endif - - #ifdef GLOW_FIRST_PASS #ifdef GLOW_USE_AUTO_EXPOSURE - frag_color/=texelFetch(source_auto_exposure,ivec2(0,0),0).r/auto_exposure_grey; + frag_color /= texelFetch(source_auto_exposure, ivec2(0, 0), 0).r / auto_exposure_grey; #endif - frag_color*=exposure; + frag_color *= exposure; - float luminance = max(frag_color.r,max(frag_color.g,frag_color.b)); - float feedback = max( smoothstep(glow_hdr_threshold,glow_hdr_threshold+glow_hdr_scale,luminance), glow_bloom ); + float luminance = max(frag_color.r, max(frag_color.g, frag_color.b)); + float feedback = max(smoothstep(glow_hdr_threshold, glow_hdr_threshold + glow_hdr_scale, luminance), glow_bloom); frag_color *= feedback; #endif - #ifdef SIMPLE_COPY - vec4 color =textureLod( source_color, uv_interp,0.0); + vec4 color = textureLod(source_color, uv_interp, 0.0); frag_color = color; #endif #ifdef SSAO_MERGE - vec4 color =textureLod( source_color, uv_interp,0.0); - float ssao =textureLod( source_ssao, uv_interp,0.0).r; + vec4 color = textureLod(source_color, uv_interp, 0.0); + float ssao = textureLod(source_ssao, uv_interp, 0.0).r; - frag_color = vec4( mix(color.rgb,color.rgb*mix(ssao_color.rgb,vec3(1.0),ssao),color.a), 1.0 ); + frag_color = vec4(mix(color.rgb, color.rgb * mix(ssao_color.rgb, vec3(1.0), ssao), color.a), 1.0); #endif - - } diff --git a/drivers/gles3/shaders/exposure.glsl b/drivers/gles3/shaders/exposure.glsl index 001b90a0f1..18fff1ae36 100644 --- a/drivers/gles3/shaders/exposure.glsl +++ b/drivers/gles3/shaders/exposure.glsl @@ -1,18 +1,14 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; - +layout(location = 0) in highp vec4 vertex_attrib; void main() { gl_Position = vertex_attrib; - } [fragment] - uniform highp sampler2D source_exposure; //texunit:0 #ifdef EXPOSURE_BEGIN @@ -33,66 +29,56 @@ uniform highp float max_luminance; layout(location = 0) out highp float exposure; - - void main() { - - #ifdef EXPOSURE_BEGIN - - ivec2 src_pos = ivec2(gl_FragCoord.xy)*source_render_size/target_size; + ivec2 src_pos = ivec2(gl_FragCoord.xy) * source_render_size / target_size; #if 1 //more precise and expensive, but less jittery - ivec2 next_pos = ivec2(gl_FragCoord.xy+ivec2(1))*source_render_size/target_size; - next_pos = max(next_pos,src_pos+ivec2(1)); //so it at least reads one pixel - highp vec3 source_color=vec3(0.0); - for(int i=src_pos.x;i<next_pos.x;i++) { - for(int j=src_pos.y;j<next_pos.y;j++) { - source_color += texelFetch(source_exposure,ivec2(i,j),0).rgb; + ivec2 next_pos = ivec2(gl_FragCoord.xy + ivec2(1)) * source_render_size / target_size; + next_pos = max(next_pos, src_pos + ivec2(1)); //so it at least reads one pixel + highp vec3 source_color = vec3(0.0); + for (int i = src_pos.x; i < next_pos.x; i++) { + for (int j = src_pos.y; j < next_pos.y; j++) { + source_color += texelFetch(source_exposure, ivec2(i, j), 0).rgb; } } - source_color/=float( (next_pos.x-src_pos.x)*(next_pos.y-src_pos.y) ); + source_color /= float((next_pos.x - src_pos.x) * (next_pos.y - src_pos.y)); #else - highp vec3 source_color = texelFetch(source_exposure,src_pos,0).rgb; + highp vec3 source_color = texelFetch(source_exposure, src_pos, 0).rgb; #endif - exposure = max(source_color.r,max(source_color.g,source_color.b)); + exposure = max(source_color.r, max(source_color.g, source_color.b)); #else ivec2 coord = ivec2(gl_FragCoord.xy); - exposure = texelFetch(source_exposure,coord*3+ivec2(0,0),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(1,0),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(2,0),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(0,1),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(1,1),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(2,1),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(0,2),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(1,2),0).r; - exposure += texelFetch(source_exposure,coord*3+ivec2(2,2),0).r; - exposure *= (1.0/9.0); + exposure = texelFetch(source_exposure, coord * 3 + ivec2(0, 0), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(1, 0), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(2, 0), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(0, 1), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(1, 1), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(2, 1), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(0, 2), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(1, 2), 0).r; + exposure += texelFetch(source_exposure, coord * 3 + ivec2(2, 2), 0).r; + exposure *= (1.0 / 9.0); #ifdef EXPOSURE_END #ifdef EXPOSURE_FORCE_SET //will stay as is #else - highp float prev_lum = texelFetch(prev_exposure,ivec2(0,0),0).r; //1 pixel previous exposure - exposure = clamp( prev_lum + (exposure-prev_lum)*exposure_adjust,min_luminance,max_luminance); + highp float prev_lum = texelFetch(prev_exposure, ivec2(0, 0), 0).r; //1 pixel previous exposure + exposure = clamp(prev_lum + (exposure - prev_lum) * exposure_adjust, min_luminance, max_luminance); #endif //EXPOSURE_FORCE_SET - #endif //EXPOSURE_END #endif //EXPOSURE_BEGIN - - } - - diff --git a/drivers/gles3/shaders/particles.glsl b/drivers/gles3/shaders/particles.glsl index fbee08c0fe..56e5545efe 100644 --- a/drivers/gles3/shaders/particles.glsl +++ b/drivers/gles3/shaders/particles.glsl @@ -1,14 +1,11 @@ [vertex] - - -layout(location=0) in highp vec4 color; -layout(location=1) in highp vec4 velocity_active; -layout(location=2) in highp vec4 custom; -layout(location=3) in highp vec4 xform_1; -layout(location=4) in highp vec4 xform_2; -layout(location=5) in highp vec4 xform_3; - +layout(location = 0) in highp vec4 color; +layout(location = 1) in highp vec4 velocity_active; +layout(location = 2) in highp vec4 custom; +layout(location = 3) in highp vec4 xform_1; +layout(location = 4) in highp vec4 xform_2; +layout(location = 5) in highp vec4 xform_3; struct Attractor { @@ -39,7 +36,6 @@ uniform float lifetime; uniform mat4 emission_transform; uniform uint random_seed; - out highp vec4 out_color; //tfb: out highp vec4 out_velocity_active; //tfb: out highp vec4 out_custom; //tfb: @@ -47,7 +43,6 @@ out highp vec4 out_xform_1; //tfb: out highp vec4 out_xform_2; //tfb: out highp vec4 out_xform_3; //tfb: - #if defined(USE_MATERIAL) layout(std140) uniform UniformData { //ubo:0 @@ -58,7 +53,6 @@ MATERIAL_UNIFORMS #endif - VERTEX_SHADER_GLOBALS uint hash(uint x) { @@ -69,13 +63,12 @@ uint hash(uint x) { return x; } - void main() { #ifdef PARTICLES_COPY - out_color=color; - out_velocity_active=velocity_active; + out_color = color; + out_velocity_active = velocity_active; out_custom = custom; out_xform_1 = xform_1; out_xform_2 = xform_2; @@ -83,47 +76,47 @@ void main() { #else - bool apply_forces=true; - bool apply_velocity=true; - float local_delta=delta; + bool apply_forces = true; + bool apply_velocity = true; + float local_delta = delta; float mass = 1.0; - float restart_phase = float(gl_VertexID)/float(total_particles); + float restart_phase = float(gl_VertexID) / float(total_particles); - if (randomness>0.0) { + if (randomness > 0.0) { uint seed = cycle; if (restart_phase >= system_phase) { - seed-=uint(1); + seed -= uint(1); } - seed*=uint(total_particles); - seed+=uint(gl_VertexID); + seed *= uint(total_particles); + seed += uint(gl_VertexID); float random = float(hash(seed) % uint(65536)) / 65536.0; - restart_phase+=randomness * random * 1.0 / float(total_particles); + restart_phase += randomness * random * 1.0 / float(total_particles); } - restart_phase*= (1.0-explosiveness); - bool restart=false; + restart_phase *= (1.0 - explosiveness); + bool restart = false; bool shader_active = velocity_active.a > 0.5; if (system_phase > prev_system_phase) { // restart_phase >= prev_system_phase is used so particles emit in the first frame they are processed - if (restart_phase >= prev_system_phase && restart_phase < system_phase ) { - restart=true; + if (restart_phase >= prev_system_phase && restart_phase < system_phase) { + restart = true; #ifdef USE_FRACTIONAL_DELTA local_delta = (system_phase - restart_phase) * lifetime; #endif } - } else if(delta > 0.0) { + } else if (delta > 0.0) { if (restart_phase >= prev_system_phase) { - restart=true; + restart = true; #ifdef USE_FRACTIONAL_DELTA local_delta = (1.0 - restart_phase + system_phase) * lifetime; #endif - } else if (restart_phase < system_phase ) { - restart=true; + } else if (restart_phase < system_phase) { + restart = true; #ifdef USE_FRACTIONAL_DELTA local_delta = (system_phase - restart_phase) * lifetime; #endif @@ -133,14 +126,14 @@ void main() { uint current_cycle = cycle; if (system_phase < restart_phase) { - current_cycle-=uint(1); + current_cycle -= uint(1); } uint particle_number = current_cycle * uint(total_particles) + uint(gl_VertexID); int index = int(gl_VertexID); if (restart) { - shader_active=emitting; + shader_active = emitting; } mat4 xform; @@ -150,23 +143,22 @@ void main() { #else if (clear || restart) { #endif - out_color=vec4(1.0); - out_velocity_active=vec4(0.0); - out_custom=vec4(0.0); + out_color = vec4(1.0); + out_velocity_active = vec4(0.0); + out_custom = vec4(0.0); if (!restart) - shader_active=false; + shader_active = false; xform = mat4( - vec4(1.0,0.0,0.0,0.0), - vec4(0.0,1.0,0.0,0.0), - vec4(0.0,0.0,1.0,0.0), - vec4(0.0,0.0,0.0,1.0) - ); + vec4(1.0, 0.0, 0.0, 0.0), + vec4(0.0, 1.0, 0.0, 0.0), + vec4(0.0, 0.0, 1.0, 0.0), + vec4(0.0, 0.0, 0.0, 1.0)); } else { - out_color=color; - out_velocity_active=velocity_active; - out_custom=custom; - xform = transpose(mat4(xform_1,xform_2,xform_3,vec4(vec3(0.0),1.0))); + out_color = color; + out_velocity_active = velocity_active; + out_custom = custom; + xform = transpose(mat4(xform_1, xform_2, xform_3, vec4(vec3(0.0), 1.0))); } if (shader_active) { @@ -181,26 +173,25 @@ VERTEX_SHADER_CODE if (false) { vec3 force = vec3(0.0); - for(int i=0;i<attractor_count;i++) { + for (int i = 0; i < attractor_count; i++) { vec3 rel_vec = xform[3].xyz - attractors[i].pos; float dist = length(rel_vec); if (attractors[i].radius < dist) continue; - if (attractors[i].eat_radius>0.0 && attractors[i].eat_radius > dist) { - out_velocity_active.a=0.0; + if (attractors[i].eat_radius > 0.0 && attractors[i].eat_radius > dist) { + out_velocity_active.a = 0.0; } rel_vec = normalize(rel_vec); - float attenuation = pow(dist / attractors[i].radius,attractors[i].attenuation); + float attenuation = pow(dist / attractors[i].radius, attractors[i].attenuation); - if (attractors[i].dir==vec3(0.0)) { + if (attractors[i].dir == vec3(0.0)) { //towards center - force+=attractors[i].strength * rel_vec * attenuation * mass; + force += attractors[i].strength * rel_vec * attenuation * mass; } else { - force+=attractors[i].strength * attractors[i].dir * attenuation *mass; - + force += attractors[i].strength * attractors[i].dir * attenuation * mass; } } @@ -216,25 +207,23 @@ VERTEX_SHADER_CODE } #endif } else { - xform=mat4(0.0); + xform = mat4(0.0); } xform = transpose(xform); - out_velocity_active.a = mix(0.0,1.0,shader_active); + out_velocity_active.a = mix(0.0, 1.0, shader_active); out_xform_1 = xform[0]; out_xform_2 = xform[1]; out_xform_3 = xform[2]; #endif //PARTICLES_COPY - } [fragment] -//any code here is never executed, stuff is filled just so it works - +// any code here is never executed, stuff is filled just so it works #if defined(USE_MATERIAL) diff --git a/drivers/gles3/shaders/resolve.glsl b/drivers/gles3/shaders/resolve.glsl index 0b50a9c57b..d860fa544f 100644 --- a/drivers/gles3/shaders/resolve.glsl +++ b/drivers/gles3/shaders/resolve.glsl @@ -1,12 +1,10 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; -layout(location=4) in vec2 uv_in; +layout(location = 0) in highp vec4 vertex_attrib; +layout(location = 4) in vec2 uv_in; out vec2 uv_interp; - void main() { uv_interp = uv_in; @@ -20,8 +18,8 @@ precision mediump float; #endif in vec2 uv_interp; -uniform sampler2D source_specular; //texunit:0 -uniform sampler2D source_ssr; //texunit:1 +uniform sampler2D source_specular; // texunit:0 +uniform sampler2D source_ssr; // texunit:1 uniform vec2 pixel_size; @@ -31,14 +29,12 @@ layout(location = 0) out vec4 frag_color; void main() { - vec4 specular = texture( source_specular, uv_interp ); + vec4 specular = texture(source_specular, uv_interp); #ifdef USE_SSR - - vec4 ssr = textureLod(source_ssr,uv_interp,0.0); - specular.rgb = mix(specular.rgb,ssr.rgb*specular.a,ssr.a); + vec4 ssr = textureLod(source_ssr, uv_interp, 0.0); + specular.rgb = mix(specular.rgb, ssr.rgb * specular.a, ssr.a); #endif - frag_color = vec4(specular.rgb,1.0); + frag_color = vec4(specular.rgb, 1.0); } - diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 2d6f42679f..cacce93dc5 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -16,50 +16,49 @@ ARRAY_WEIGHTS=7, ARRAY_INDEX=8, */ -//hack to use uv if no uv present so it works with lightmap - +// hack to use uv if no uv present so it works with lightmap /* INPUT ATTRIBS */ -layout(location=0) in highp vec4 vertex_attrib; -layout(location=1) in vec3 normal_attrib; +layout(location = 0) in highp vec4 vertex_attrib; +layout(location = 1) in vec3 normal_attrib; #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) -layout(location=2) in vec4 tangent_attrib; +layout(location = 2) in vec4 tangent_attrib; #endif #if defined(ENABLE_COLOR_INTERP) -layout(location=3) in vec4 color_attrib; +layout(location = 3) in vec4 color_attrib; #endif #if defined(ENABLE_UV_INTERP) -layout(location=4) in vec2 uv_attrib; +layout(location = 4) in vec2 uv_attrib; #endif #if defined(ENABLE_UV2_INTERP) || defined(USE_LIGHTMAP) -layout(location=5) in vec2 uv2_attrib; +layout(location = 5) in vec2 uv2_attrib; #endif uniform float normal_mult; #ifdef USE_SKELETON -layout(location=6) in uvec4 bone_indices; // attrib:6 -layout(location=7) in vec4 bone_weights; // attrib:7 +layout(location = 6) in uvec4 bone_indices; // attrib:6 +layout(location = 7) in vec4 bone_weights; // attrib:7 #endif #ifdef USE_INSTANCING -layout(location=8) in highp vec4 instance_xform0; -layout(location=9) in highp vec4 instance_xform1; -layout(location=10) in highp vec4 instance_xform2; -layout(location=11) in lowp vec4 instance_color; +layout(location = 8) in highp vec4 instance_xform0; +layout(location = 9) in highp vec4 instance_xform1; +layout(location = 10) in highp vec4 instance_xform2; +layout(location = 11) in lowp vec4 instance_color; #if defined(ENABLE_INSTANCE_CUSTOM) -layout(location=12) in highp vec4 instance_custom_data; +layout(location = 12) in highp vec4 instance_custom_data; #endif #endif -layout(std140) uniform SceneData { //ubo:0 +layout(std140) uniform SceneData { // ubo:0 highp mat4 projection_matrix; highp mat4 inv_projection_matrix; @@ -102,12 +101,10 @@ layout(std140) uniform SceneData { //ubo:0 highp float fog_height_min; highp float fog_height_max; highp float fog_height_curve; - }; uniform highp mat4 world_transform; - #ifdef USE_LIGHT_DIRECTIONAL layout(std140) uniform DirectionalLightData { //ubo:3 @@ -115,7 +112,7 @@ layout(std140) uniform DirectionalLightData { //ubo:3 highp vec4 light_pos_inv_radius; mediump vec4 light_direction_attenuation; mediump vec4 light_color_energy; - mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled, + mediump vec4 light_params; // cone attenuation, angle, specular, shadow enabled, mediump vec4 light_clamp; mediump vec4 shadow_color_contact; highp mat4 shadow_matrix1; @@ -135,14 +132,12 @@ struct LightData { highp vec4 light_pos_inv_radius; mediump vec4 light_direction_attenuation; mediump vec4 light_color_energy; - mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled, + mediump vec4 light_params; // cone attenuation, angle, specular, shadow enabled, mediump vec4 light_clamp; mediump vec4 shadow_color_contact; highp mat4 shadow_matrix; - }; - layout(std140) uniform OmniLightData { //ubo:4 LightData omni_lights[MAX_LIGHT_DATA_STRUCTS]; @@ -155,7 +150,6 @@ layout(std140) uniform SpotLightData { //ubo:5 #ifdef USE_FORWARD_LIGHTING - uniform int omni_light_indices[MAX_FORWARD_LIGHTS]; uniform int omni_light_count; @@ -167,49 +161,45 @@ uniform int spot_light_count; out vec4 diffuse_light_interp; out vec4 specular_light_interp; -void light_compute(vec3 N, vec3 L,vec3 V, vec3 light_color, float roughness, inout vec3 diffuse, inout vec3 specular) { +void light_compute(vec3 N, vec3 L, vec3 V, vec3 light_color, float roughness, inout vec3 diffuse, inout vec3 specular) { - float dotNL = max(dot(N,L), 0.0 ); + float dotNL = max(dot(N, L), 0.0); diffuse += dotNL * light_color / M_PI; if (roughness > 0.0) { vec3 H = normalize(V + L); - float dotNH = max(dot(N,H), 0.0 ); - float intensity = (roughness >= 1.0 ? 1.0 : pow( dotNH, (1.0-roughness) * 256.0)); + float dotNH = max(dot(N, H), 0.0); + float intensity = (roughness >= 1.0 ? 1.0 : pow(dotNH, (1.0 - roughness) * 256.0)); specular += light_color * intensity; - } } -void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal, float roughness,inout vec3 diffuse, inout vec3 specular) { - - vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz-vertex; - float light_length = length( light_rel_vec ); - float normalized_distance = light_length*omni_lights[idx].light_pos_inv_radius.w; - vec3 light_attenuation = vec3(pow( max(1.0 - normalized_distance, 0.0), omni_lights[idx].light_direction_attenuation.w )); +void light_process_omni(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, float roughness, inout vec3 diffuse, inout vec3 specular) { - light_compute(normal,normalize(light_rel_vec),eye_vec,omni_lights[idx].light_color_energy.rgb * light_attenuation,roughness,diffuse,specular); + vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz - vertex; + float light_length = length(light_rel_vec); + float normalized_distance = light_length * omni_lights[idx].light_pos_inv_radius.w; + vec3 light_attenuation = vec3(pow(max(1.0 - normalized_distance, 0.0), omni_lights[idx].light_direction_attenuation.w)); + light_compute(normal, normalize(light_rel_vec), eye_vec, omni_lights[idx].light_color_energy.rgb * light_attenuation, roughness, diffuse, specular); } void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, float roughness, inout vec3 diffuse, inout vec3 specular) { - vec3 light_rel_vec = spot_lights[idx].light_pos_inv_radius.xyz-vertex; - float light_length = length( light_rel_vec ); - float normalized_distance = light_length*spot_lights[idx].light_pos_inv_radius.w; - vec3 light_attenuation = vec3(pow( max(1.0 - normalized_distance, 0.001), spot_lights[idx].light_direction_attenuation.w )); + vec3 light_rel_vec = spot_lights[idx].light_pos_inv_radius.xyz - vertex; + float light_length = length(light_rel_vec); + float normalized_distance = light_length * spot_lights[idx].light_pos_inv_radius.w; + vec3 light_attenuation = vec3(pow(max(1.0 - normalized_distance, 0.001), spot_lights[idx].light_direction_attenuation.w)); vec3 spot_dir = spot_lights[idx].light_direction_attenuation.xyz; - float spot_cutoff=spot_lights[idx].light_params.y; - float scos = max(dot(-normalize(light_rel_vec), spot_dir),spot_cutoff); + float spot_cutoff = spot_lights[idx].light_params.y; + float scos = max(dot(-normalize(light_rel_vec), spot_dir), spot_cutoff); float spot_rim = (1.0 - scos) / (1.0 - spot_cutoff); - light_attenuation *= 1.0 - pow( max(spot_rim,0.001), spot_lights[idx].light_params.x); - + light_attenuation *= 1.0 - pow(max(spot_rim, 0.001), spot_lights[idx].light_params.x); - light_compute(normal,normalize(light_rel_vec),eye_vec,spot_lights[idx].light_color_energy.rgb*light_attenuation,roughness,diffuse,specular); + light_compute(normal, normalize(light_rel_vec), eye_vec, spot_lights[idx].light_color_energy.rgb * light_attenuation, roughness, diffuse, specular); } - #endif /* Varyings */ @@ -225,20 +215,18 @@ out vec4 color_interp; out vec2 uv_interp; #endif -#if defined(ENABLE_UV2_INTERP) || defined (USE_LIGHTMAP) +#if defined(ENABLE_UV2_INTERP) || defined(USE_LIGHTMAP) out vec2 uv2_interp; #endif - #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) out vec3 tangent_interp; out vec3 binormal_interp; #endif - #if defined(USE_MATERIAL) -layout(std140) uniform UniformData { //ubo:1 +layout(std140) uniform UniformData { // ubo:1 MATERIAL_UNIFORMS @@ -257,7 +245,7 @@ out highp float dp_clip; #define SKELETON_TEXTURE_WIDTH 256 #ifdef USE_SKELETON -uniform highp sampler2D skeleton_texture; //texunit:-1 +uniform highp sampler2D skeleton_texture; // texunit:-1 #endif out highp vec4 position_interp; @@ -272,21 +260,19 @@ void main() { mat4 world_matrix = world_transform; - #ifdef USE_INSTANCING { - highp mat4 m=mat4(instance_xform0,instance_xform1,instance_xform2,vec4(0.0,0.0,0.0,1.0)); + highp mat4 m = mat4(instance_xform0, instance_xform1, instance_xform2, vec4(0.0, 0.0, 0.0, 1.0)); world_matrix = world_matrix * transpose(m); } #endif vec3 normal = normal_attrib * normal_mult; - #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) vec3 tangent = tangent_attrib.xyz; - tangent*=normal_mult; + tangent *= normal_mult; float binormalf = tangent_attrib.a; #endif @@ -298,10 +284,9 @@ void main() { #endif - #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) - vec3 binormal = normalize( cross(normal,tangent) * binormalf ); + vec3 binormal = normalize(cross(normal, tangent) * binormalf); #endif #if defined(ENABLE_UV_INTERP) @@ -329,13 +314,13 @@ void main() { mat3 normal_matrix = mat3(transpose(inverse(world_matrix))); normal = normal_matrix * normal; #else - normal = normalize((world_matrix * vec4(normal,0.0)).xyz); + normal = normalize((world_matrix * vec4(normal, 0.0)).xyz); #endif #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) - tangent = normalize((world_matrix * vec4(tangent,0.0)).xyz); - binormal = normalize((world_matrix * vec4(binormal,0.0)).xyz); + tangent = normalize((world_matrix * vec4(tangent, 0.0)).xyz); + binormal = normalize((world_matrix * vec4(binormal, 0.0)).xyz); #endif #endif @@ -345,45 +330,44 @@ void main() { #define projection_matrix local_projection #define world_transform world_matrix - #ifdef USE_SKELETON { //skeleton transform ivec4 bone_indicesi = ivec4(bone_indices); // cast to signed int - ivec2 tex_ofs = ivec2( bone_indicesi.x%256, (bone_indicesi.x/256)*3 ); - highp mat3x4 m = mat3x4( - texelFetch(skeleton_texture,tex_ofs,0), - texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0), - texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0) - ) * bone_weights.x; - - tex_ofs = ivec2( bone_indicesi.y%256, (bone_indicesi.y/256)*3 ); + ivec2 tex_ofs = ivec2(bone_indicesi.x % 256, (bone_indicesi.x / 256) * 3); + highp mat3x4 m; + m = mat3x4( + texelFetch(skeleton_texture, tex_ofs, 0), + texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0), + texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0)) + * bone_weights.x; - m+= mat3x4( - texelFetch(skeleton_texture,tex_ofs,0), - texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0), - texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0) - ) * bone_weights.y; + tex_ofs = ivec2(bone_indicesi.y % 256, (bone_indicesi.y / 256) * 3); - tex_ofs = ivec2( bone_indicesi.z%256, (bone_indicesi.z/256)*3 ); + m += mat3x4( + texelFetch(skeleton_texture, tex_ofs, 0), + texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0), + texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0)) + * bone_weights.y; - m+= mat3x4( - texelFetch(skeleton_texture,tex_ofs,0), - texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0), - texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0) - ) * bone_weights.z; + tex_ofs = ivec2(bone_indicesi.z % 256, (bone_indicesi.z / 256) * 3); + m += mat3x4( + texelFetch(skeleton_texture, tex_ofs, 0), + texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0), + texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0)) + * bone_weights.z; - tex_ofs = ivec2( bone_indicesi.w%256, (bone_indicesi.w/256)*3 ); + tex_ofs = ivec2(bone_indicesi.w % 256, (bone_indicesi.w / 256) * 3); - m+= mat3x4( - texelFetch(skeleton_texture,tex_ofs,0), - texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0), - texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0) - ) * bone_weights.w; + m += mat3x4( + texelFetch(skeleton_texture, tex_ofs, 0), + texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0), + texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0)) + * bone_weights.w; - mat4 bone_matrix = transpose(mat4(m[0],m[1],m[2],vec4(0.0,0.0,0.0,1.0))); + mat4 bone_matrix = transpose(mat4(m[0], m[1], m[2], vec4(0.0, 0.0, 0.0, 1.0))); world_matrix = bone_matrix * world_matrix; } @@ -396,9 +380,7 @@ VERTEX_SHADER_CODE } - - -//using local coordinates (default) +// using local coordinates (default) #if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED) vertex = modelview * vertex; @@ -407,13 +389,13 @@ VERTEX_SHADER_CODE mat3 normal_matrix = mat3(transpose(inverse(modelview))); normal = normal_matrix * normal; #else - normal = normalize((modelview * vec4(normal,0.0)).xyz); + normal = normalize((modelview * vec4(normal, 0.0)).xyz); #endif #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) - tangent = normalize((modelview * vec4(tangent,0.0)).xyz); - binormal = normalize((modelview * vec4(binormal,0.0)).xyz); + tangent = normalize((modelview * vec4(tangent, 0.0)).xyz); + binormal = normalize((modelview * vec4(binormal, 0.0)).xyz); #endif #endif @@ -421,74 +403,70 @@ VERTEX_SHADER_CODE #if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED) vertex = camera_inverse_matrix * vertex; - normal = normalize((camera_inverse_matrix * vec4(normal,0.0)).xyz); + normal = normalize((camera_inverse_matrix * vec4(normal, 0.0)).xyz); #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) - tangent = normalize((camera_inverse_matrix * vec4(tangent,0.0)).xyz); - binormal = normalize((camera_inverse_matrix * vec4(binormal,0.0)).xyz); + tangent = normalize((camera_inverse_matrix * vec4(tangent, 0.0)).xyz); + binormal = normalize((camera_inverse_matrix * vec4(binormal, 0.0)).xyz); #endif #endif vertex_interp = vertex.xyz; normal_interp = normal; - #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) tangent_interp = tangent; binormal_interp = binormal; #endif - #ifdef RENDER_DEPTH - #ifdef RENDER_DEPTH_DUAL_PARABOLOID - vertex_interp.z*= shadow_dual_paraboloid_render_side; - normal_interp.z*= shadow_dual_paraboloid_render_side; + vertex_interp.z *= shadow_dual_paraboloid_render_side; + normal_interp.z *= shadow_dual_paraboloid_render_side; - dp_clip=vertex_interp.z; //this attempts to avoid noise caused by objects sent to the other parabolloid side due to bias + dp_clip = vertex_interp.z; //this attempts to avoid noise caused by objects sent to the other parabolloid side due to bias //for dual paraboloid shadow mapping, this is the fastest but least correct way, as it curves straight edges - highp vec3 vtx = vertex_interp+normalize(vertex_interp)*z_offset; + highp vec3 vtx = vertex_interp + normalize(vertex_interp) * z_offset; highp float distance = length(vtx); vtx = normalize(vtx); - vtx.xy/=1.0-vtx.z; - vtx.z=(distance/shadow_dual_paraboloid_render_zfar); - vtx.z=vtx.z * 2.0 - 1.0; + vtx.xy /= 1.0 - vtx.z; + vtx.z = (distance / shadow_dual_paraboloid_render_zfar); + vtx.z = vtx.z * 2.0 - 1.0; vertex_interp = vtx; - #else float z_ofs = z_offset; - z_ofs += (1.0-abs(normal_interp.z))*z_slope_scale; - vertex_interp.z-=z_ofs; + z_ofs += (1.0 - abs(normal_interp.z)) * z_slope_scale; + vertex_interp.z -= z_ofs; #endif //RENDER_DEPTH_DUAL_PARABOLOID #endif //RENDER_DEPTH - gl_Position = projection_matrix * vec4(vertex_interp,1.0); + gl_Position = projection_matrix * vec4(vertex_interp, 1.0); - position_interp=gl_Position; + position_interp = gl_Position; #ifdef USE_VERTEX_LIGHTING - diffuse_light_interp=vec4(0.0); - specular_light_interp=vec4(0.0); + diffuse_light_interp = vec4(0.0); + specular_light_interp = vec4(0.0); #ifdef USE_FORWARD_LIGHTING - for(int i=0;i<omni_light_count;i++) { - light_process_omni(omni_light_indices[i],vertex_interp,-normalize( vertex_interp ),normal_interp,roughness,diffuse_light_interp.rgb,specular_light_interp.rgb); + for (int i = 0; i < omni_light_count; i++) { + light_process_omni(omni_light_indices[i], vertex_interp, -normalize(vertex_interp), normal_interp, roughness, diffuse_light_interp.rgb, specular_light_interp.rgb); } - for(int i=0;i<spot_light_count;i++) { - light_process_spot(spot_light_indices[i],vertex_interp,-normalize( vertex_interp ),normal_interp,roughness,diffuse_light_interp.rgb,specular_light_interp.rgb); + for (int i = 0; i < spot_light_count; i++) { + light_process_spot(spot_light_indices[i], vertex_interp, -normalize(vertex_interp), normal_interp, roughness, diffuse_light_interp.rgb, specular_light_interp.rgb); } #endif @@ -496,36 +474,33 @@ VERTEX_SHADER_CODE vec3 directional_diffuse = vec3(0.0); vec3 directional_specular = vec3(0.0); - light_compute(normal_interp,-light_direction_attenuation.xyz,-normalize( vertex_interp ),light_color_energy.rgb,roughness,directional_diffuse,directional_specular); + light_compute(normal_interp, -light_direction_attenuation.xyz, -normalize(vertex_interp), light_color_energy.rgb, roughness, directional_diffuse, directional_specular); - float diff_avg = dot(diffuse_light_interp.rgb,vec3(0.33333)); - float diff_dir_avg = dot(directional_diffuse,vec3(0.33333)); - if (diff_avg>0.0) { - diffuse_light_interp.a=diff_dir_avg/(diff_avg+diff_dir_avg); + float diff_avg = dot(diffuse_light_interp.rgb, vec3(0.33333)); + float diff_dir_avg = dot(directional_diffuse, vec3(0.33333)); + if (diff_avg > 0.0) { + diffuse_light_interp.a = diff_dir_avg / (diff_avg + diff_dir_avg); } else { - diffuse_light_interp.a=1.0; + diffuse_light_interp.a = 1.0; } - diffuse_light_interp.rgb+=directional_diffuse; + diffuse_light_interp.rgb += directional_diffuse; - float spec_avg = dot(specular_light_interp.rgb,vec3(0.33333)); - float spec_dir_avg = dot(directional_specular,vec3(0.33333)); - if (spec_avg>0.0) { - specular_light_interp.a=spec_dir_avg/(spec_avg+spec_dir_avg); + float spec_avg = dot(specular_light_interp.rgb, vec3(0.33333)); + float spec_dir_avg = dot(directional_specular, vec3(0.33333)); + if (spec_avg > 0.0) { + specular_light_interp.a = spec_dir_avg / (spec_avg + spec_dir_avg); } else { - specular_light_interp.a=1.0; + specular_light_interp.a = 1.0; } - specular_light_interp.rgb+=directional_specular; + specular_light_interp.rgb += directional_specular; #endif //USE_LIGHT_DIRECTIONAL - #endif // USE_VERTEX_LIGHTING - } - [fragment] /* texture unit usage, N is max_texture_unity-N @@ -569,14 +544,11 @@ in vec3 binormal_interp; in highp vec3 vertex_interp; in vec3 normal_interp; - /* PBR CHANNELS */ #ifdef USE_RADIANCE_MAP - - -layout(std140) uniform Radiance { //ubo:2 +layout(std140) uniform Radiance { // ubo:2 mat4 radiance_inverse_xform; float radiance_ambient_contribution; @@ -587,19 +559,19 @@ layout(std140) uniform Radiance { //ubo:2 #ifdef USE_RADIANCE_MAP_ARRAY -uniform sampler2DArray radiance_map; //texunit:-2 +uniform sampler2DArray radiance_map; // texunit:-2 -vec3 textureDualParaboloid(sampler2DArray p_tex, vec3 p_vec,float p_roughness) { +vec3 textureDualParaboloid(sampler2DArray p_tex, vec3 p_vec, float p_roughness) { vec3 norm = normalize(p_vec); - norm.xy/=1.0+abs(norm.z); - norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25); + norm.xy /= 1.0 + abs(norm.z); + norm.xy = norm.xy * vec2(0.5, 0.25) + vec2(0.5, 0.25); // we need to lie the derivatives (normg) and assume that DP side is always the same // to get proper texture filtering - vec2 normg=norm.xy; - if (norm.z>0.0) { - norm.y=0.5-norm.y+0.5; + vec2 normg = norm.xy; + if (norm.z > 0.0) { + norm.y = 0.5 - norm.y + 0.5; } // thanks to OpenGL spec using floor(layer + 0.5) for texture arrays, @@ -608,22 +580,22 @@ vec3 textureDualParaboloid(sampler2DArray p_tex, vec3 p_vec,float p_roughness) { float index = p_roughness * RADIANCE_MAX_LOD; int indexi = int(index * 256.0); - vec3 base = textureGrad(p_tex, vec3(norm.xy, float(indexi/256)),dFdx(normg),dFdy(normg)).xyz; - vec3 next = textureGrad(p_tex, vec3(norm.xy, float(indexi/256+1)),dFdx(normg),dFdy(normg)).xyz; - return mix(base,next,float(indexi%256)/256.0); + vec3 base = textureGrad(p_tex, vec3(norm.xy, float(indexi / 256)), dFdx(normg), dFdy(normg)).xyz; + vec3 next = textureGrad(p_tex, vec3(norm.xy, float(indexi / 256 + 1)), dFdx(normg), dFdy(normg)).xyz; + return mix(base, next, float(indexi % 256) / 256.0); } #else -uniform sampler2D radiance_map; //texunit:-2 +uniform sampler2D radiance_map; // texunit:-2 -vec3 textureDualParaboloid(sampler2D p_tex, vec3 p_vec,float p_roughness) { +vec3 textureDualParaboloid(sampler2D p_tex, vec3 p_vec, float p_roughness) { vec3 norm = normalize(p_vec); - norm.xy/=1.0+abs(norm.z); - norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25); - if (norm.z>0.0) { - norm.y=0.5-norm.y+0.5; + norm.xy /= 1.0 + abs(norm.z); + norm.xy = norm.xy * vec2(0.5, 0.25) + vec2(0.5, 0.25); + if (norm.z > 0.0) { + norm.y = 0.5 - norm.y + 0.5; } return textureLod(p_tex, norm.xy, p_roughness * RADIANCE_MAX_LOD).xyz; } @@ -634,8 +606,6 @@ vec3 textureDualParaboloid(sampler2D p_tex, vec3 p_vec,float p_roughness) { /* Material Uniforms */ - - #if defined(USE_MATERIAL) layout(std140) uniform UniformData { @@ -702,7 +672,7 @@ layout(std140) uniform DirectionalLightData { highp vec4 light_pos_inv_radius; mediump vec4 light_direction_attenuation; mediump vec4 light_color_energy; - mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled, + mediump vec4 light_params; // cone attenuation, angle, specular, shadow enabled, mediump vec4 light_clamp; mediump vec4 shadow_color_contact; highp mat4 shadow_matrix1; @@ -712,8 +682,7 @@ layout(std140) uniform DirectionalLightData { mediump vec4 shadow_split_offsets; }; - -uniform highp sampler2DShadow directional_shadow; //texunit:-4 +uniform highp sampler2DShadow directional_shadow; // texunit:-4 #endif @@ -721,52 +690,48 @@ uniform highp sampler2DShadow directional_shadow; //texunit:-4 in vec4 diffuse_light_interp; in vec4 specular_light_interp; #endif -//omni and spot +// omni and spot struct LightData { highp vec4 light_pos_inv_radius; mediump vec4 light_direction_attenuation; mediump vec4 light_color_energy; - mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled, + mediump vec4 light_params; // cone attenuation, angle, specular, shadow enabled, mediump vec4 light_clamp; mediump vec4 shadow_color_contact; highp mat4 shadow_matrix; }; - -layout(std140) uniform OmniLightData { //ubo:4 +layout(std140) uniform OmniLightData { // ubo:4 LightData omni_lights[MAX_LIGHT_DATA_STRUCTS]; }; -layout(std140) uniform SpotLightData { //ubo:5 +layout(std140) uniform SpotLightData { // ubo:5 LightData spot_lights[MAX_LIGHT_DATA_STRUCTS]; }; - -uniform highp sampler2DShadow shadow_atlas; //texunit:-5 - +uniform highp sampler2DShadow shadow_atlas; // texunit:-5 struct ReflectionData { mediump vec4 box_extents; mediump vec4 box_offset; mediump vec4 params; // intensity, 0, interior , boxproject - mediump vec4 ambient; //ambient color, energy + mediump vec4 ambient; // ambient color, energy mediump vec4 atlas_clamp; - highp mat4 local_matrix; //up to here for spot and omni, rest is for directional - //notes: for ambientblend, use distance to edge to blend between already existing global environment + highp mat4 local_matrix; // up to here for spot and omni, rest is for directional + // notes: for ambientblend, use distance to edge to blend between already existing global environment }; layout(std140) uniform ReflectionProbeData { //ubo:6 ReflectionData reflections[MAX_REFLECTION_DATA_STRUCTS]; }; -uniform mediump sampler2D reflection_atlas; //texunit:-3 - +uniform mediump sampler2D reflection_atlas; // texunit:-3 #ifdef USE_FORWARD_LIGHTING @@ -781,39 +746,38 @@ uniform int reflection_count; #endif - #if defined(SCREEN_TEXTURE_USED) -uniform highp sampler2D screen_texture; //texunit:-7 +uniform highp sampler2D screen_texture; // texunit:-7 #endif #ifdef USE_MULTIPLE_RENDER_TARGETS -layout(location=0) out vec4 diffuse_buffer; -layout(location=1) out vec4 specular_buffer; -layout(location=2) out vec4 normal_mr_buffer; +layout(location = 0) out vec4 diffuse_buffer; +layout(location = 1) out vec4 specular_buffer; +layout(location = 2) out vec4 normal_mr_buffer; #if defined(ENABLE_SSS) -layout(location=3) out float sss_buffer; +layout(location = 3) out float sss_buffer; #endif #else -layout(location=0) out vec4 frag_color; +layout(location = 0) out vec4 frag_color; #endif in highp vec4 position_interp; -uniform highp sampler2D depth_buffer; //texunit:-8 +uniform highp sampler2D depth_buffer; // texunit:-8 #ifdef USE_CONTACT_SHADOWS float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) { - if (abs(dir.z)>0.99) + if (abs(dir.z) > 0.99) return 1.0; - vec3 endpoint = pos+dir*max_distance; + vec3 endpoint = pos + dir * max_distance; vec4 source = position_interp; vec4 dest = projection_matrix * vec4(endpoint, 1.0); @@ -822,51 +786,48 @@ float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) { vec2 screen_rel = to_screen - from_screen; - if (length(screen_rel)<0.00001) - return 1.0; //too small, don't do anything + if (length(screen_rel) < 0.00001) + return 1.0; // too small, don't do anything - /*float pixel_size; //approximate pixel size + /* + float pixel_size; // approximate pixel size if (screen_rel.x > screen_rel.y) { - pixel_size = abs((pos.x-endpoint.x)/(screen_rel.x/screen_pixel_size.x)); + pixel_size = abs((pos.x - endpoint.x) / (screen_rel.x / screen_pixel_size.x)); } else { - pixel_size = abs((pos.y-endpoint.y)/(screen_rel.y/screen_pixel_size.y)); - - }*/ - vec4 bias = projection_matrix * vec4(pos+vec3(0.0,0.0,max_distance*0.5), 1.0); //todo un-harcode the 0.04 - - - - vec2 pixel_incr = normalize(screen_rel)*screen_pixel_size; + pixel_size = abs((pos.y - endpoint.y) / (screen_rel.y / screen_pixel_size.y)); + } + */ + vec4 bias = projection_matrix * vec4(pos + vec3(0.0, 0.0, max_distance * 0.5), 1.0); + vec2 pixel_incr = normalize(screen_rel) * screen_pixel_size; float steps = length(screen_rel) / length(pixel_incr); - steps = min(2000.0,steps); //put a limit to avoid freezing in some strange situation - //steps=10.0; + steps = min(2000.0, steps); // put a limit to avoid freezing in some strange situation + //steps = 10.0; - vec4 incr = (dest - source)/steps; - float ratio=0.0; - float ratio_incr = 1.0/steps; + vec4 incr = (dest - source) / steps; + float ratio = 0.0; + float ratio_incr = 1.0 / steps; - while(steps>0.0) { - source += incr*2.0; - bias+=incr*2.0; + while (steps > 0.0) { + source += incr * 2.0; + bias += incr * 2.0; vec3 uv_depth = (source.xyz / source.w) * 0.5 + 0.5; - float depth = texture(depth_buffer,uv_depth.xy).r; + float depth = texture(depth_buffer, uv_depth.xy).r; if (depth < uv_depth.z) { - if (depth > (bias.z/bias.w) * 0.5 + 0.5) { - return min(pow(ratio,4.0),1.0); + if (depth > (bias.z / bias.w) * 0.5 + 0.5) { + return min(pow(ratio, 4.0), 1.0); } else { return 1.0; } } - - ratio+=ratio_incr; - steps-=1.0; + ratio += ratio_incr; + steps -= 1.0; } return 1.0; @@ -874,7 +835,6 @@ float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) { #endif - // This returns the G_GGX function divided by 2 cos_theta_m, where in practice cos_theta_m is either N.L or N.V. // We're dividing this factor off because the overall term we'll end up looks like // (see, for example, the first unnumbered equation in B. Burley, "Physically Based Shading at Disney", SIGGRAPH 2012): @@ -896,51 +856,48 @@ float G_GGX_2cos(float cos_theta_m, float alpha) { // C. Schlick, "An Inexpensive BRDF Model for Physically-based Rendering", Computer Graphics Forum. 13 (3): 233 (1994) // Eq. (19), although see Heitz (2014) the about the problems with his derivation. // It nevertheless approximates GGX well with k = alpha/2. - float k = 0.5*alpha; + float k = 0.5 * alpha; return 0.5 / (cos_theta_m * (1.0 - k) + k); - // float cos2 = cos_theta_m*cos_theta_m; - // float sin2 = (1.0-cos2); - // return 1.0 /( cos_theta_m + sqrt(cos2 + alpha*alpha*sin2) ); + // float cos2 = cos_theta_m * cos_theta_m; + // float sin2 = (1.0 - cos2); + // return 1.0 / (cos_theta_m + sqrt(cos2 + alpha * alpha * sin2)); } float D_GGX(float cos_theta_m, float alpha) { - float alpha2 = alpha*alpha; - float d = 1.0 + (alpha2-1.0)*cos_theta_m*cos_theta_m; - return alpha2/(M_PI * d * d); + float alpha2 = alpha * alpha; + float d = 1.0 + (alpha2 - 1.0) * cos_theta_m * cos_theta_m; + return alpha2 / (M_PI * d * d); } float G_GGX_anisotropic_2cos(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) { float cos2 = cos_theta_m * cos_theta_m; - float sin2 = (1.0-cos2); + float sin2 = (1.0 - cos2); float s_x = alpha_x * cos_phi; float s_y = alpha_y * sin_phi; - return 1.0 / max(cos_theta_m + sqrt(cos2 + (s_x*s_x + s_y*s_y)*sin2 ), 0.001); + return 1.0 / max(cos_theta_m + sqrt(cos2 + (s_x * s_x + s_y * s_y) * sin2), 0.001); } float D_GGX_anisotropic(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) { float cos2 = cos_theta_m * cos_theta_m; - float sin2 = (1.0-cos2); - float r_x = cos_phi/alpha_x; - float r_y = sin_phi/alpha_y; - float d = cos2 + sin2*(r_x * r_x + r_y * r_y); + float sin2 = (1.0 - cos2); + float r_x = cos_phi / alpha_x; + float r_y = sin_phi / alpha_y; + float d = cos2 + sin2 * (r_x * r_x + r_y * r_y); return 1.0 / max(M_PI * alpha_x * alpha_y * d * d, 0.001); } - -float SchlickFresnel(float u) -{ - float m = 1.0-u; - float m2 = m*m; - return m2*m2*m; // pow(m,5) +float SchlickFresnel(float u) { + float m = 1.0 - u; + float m2 = m * m; + return m2 * m2 * m; // pow(m,5) } -float GTR1(float NdotH, float a) -{ - if (a >= 1.0) return 1.0/M_PI; - float a2 = a*a; - float t = 1.0 + (a2-1.0)*NdotH*NdotH; - return (a2-1.0) / (M_PI*log(a2)*t); +float GTR1(float NdotH, float a) { + if (a >= 1.0) return 1.0 / M_PI; + float a2 = a * a; + float t = 1.0 + (a2 - 1.0) * NdotH * NdotH; + return (a2 - 1.0) / (M_PI * log(a2) * t); } vec3 metallic_to_specular_color(float metallic, float specular, vec3 albedo) { @@ -952,7 +909,7 @@ vec3 metallic_to_specular_color(float metallic, float specular, vec3 albedo) { void light_compute(vec3 N, vec3 L, vec3 V, vec3 B, vec3 T, vec3 light_color, vec3 attenuation, vec3 diffuse_color, vec3 transmission, float specular_blob_intensity, float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, inout vec3 diffuse_light, inout vec3 specular_light) { #if defined(USE_LIGHT_SHADER_CODE) -//light is written by the light shader + // light is written by the light shader vec3 normal = N; vec3 albedo = diffuse_color; @@ -961,9 +918,8 @@ void light_compute(vec3 N, vec3 L, vec3 V, vec3 B, vec3 T, vec3 light_color, vec LIGHT_SHADER_CODE - #else - float NdotL = dot(N,L); + float NdotL = dot(N, L); float cNdotL = max(NdotL, 0.0); // clamped NdotL float NdotV = dot(N, V); float cNdotV = max(NdotV, 0.0); @@ -975,10 +931,9 @@ LIGHT_SHADER_CODE float diffuse_brdf_NL; // BRDF times N.L for calculating diffuse radiance #endif - #if defined(DIFFUSE_LAMBERT_WRAP) - //energy conserving lambert wrap shader - diffuse_brdf_NL = max(0.0,(NdotL + roughness) / ((1.0 + roughness) * (1.0 + roughness))); + // energy conserving lambert wrap shader + diffuse_brdf_NL = max(0.0, (NdotL + roughness) / ((1.0 + roughness) * (1.0 + roughness))); #elif defined(DIFFUSE_OREN_NAYAR) @@ -986,12 +941,11 @@ LIGHT_SHADER_CODE // see http://mimosa-pudica.net/improved-oren-nayar.html float LdotV = dot(L, V); - float s = LdotV - NdotL * NdotV; float t = mix(1.0, max(NdotL, NdotV), step(0.0, s)); float sigma2 = roughness * roughness; // TODO: this needs checking - vec3 A = 1.0 + sigma2 * (- 0.5 / (sigma2 + 0.33) + 0.17*diffuse_color / (sigma2 + 0.13) ); + vec3 A = 1.0 + sigma2 * (-0.5 / (sigma2 + 0.33) + 0.17 * diffuse_color / (sigma2 + 0.13)); float B = 0.45 * sigma2 / (sigma2 + 0.09); diffuse_brdf_NL = cNdotL * (A + vec3(B) * s / t) * (1.0 / M_PI); @@ -999,21 +953,20 @@ LIGHT_SHADER_CODE #elif defined(DIFFUSE_TOON) - diffuse_brdf_NL = smoothstep(-roughness,max(roughness,0.01),NdotL); + diffuse_brdf_NL = smoothstep(-roughness, max(roughness, 0.01), NdotL); #elif defined(DIFFUSE_BURLEY) { - vec3 H = normalize(V + L); - float cLdotH = max(0.0,dot(L, H)); + float cLdotH = max(0.0, dot(L, H)); float FD90 = 0.5 + 2.0 * cLdotH * cLdotH * roughness; float FdV = 1.0 + (FD90 - 1.0) * SchlickFresnel(cNdotV); float FdL = 1.0 + (FD90 - 1.0) * SchlickFresnel(cNdotL); diffuse_brdf_NL = (1.0 / M_PI) * FdV * FdL * cNdotL; - /* + /* float energyBias = mix(roughness, 0.0, 0.5); float energyFactor = mix(roughness, 1.0, 1.0 / 1.51); float fd90 = energyBias + 2.0 * VoH * VoH * roughness; @@ -1021,10 +974,11 @@ LIGHT_SHADER_CODE float lightScatter = f0 + (fd90 - f0) * pow(1.0 - cNdotL, 5.0); float viewScatter = f0 + (fd90 - f0) * pow(1.0 - cNdotV, 5.0); - diffuse_brdf_NL = lightScatter * viewScatter * energyFactor;*/ + diffuse_brdf_NL = lightScatter * viewScatter * energyFactor; + */ } #else - //lambert + // lambert diffuse_brdf_NL = cNdotL * (1.0 / M_PI); #endif @@ -1034,70 +988,67 @@ LIGHT_SHADER_CODE diffuse_light += light_color * diffuse_color * (vec3(1.0 / M_PI) - diffuse_brdf_NL) * transmission * attenuation; #endif - #if defined(LIGHT_USE_RIM) - float rim_light = pow(max(0.0,1.0-cNdotV), max(0.0,(1.0-roughness)*16.0)); - diffuse_light += rim_light * rim * mix(vec3(1.0),diffuse_color,rim_tint) * light_color; + float rim_light = pow(max(0.0, 1.0 - cNdotV), max(0.0, (1.0 - roughness) * 16.0)); + diffuse_light += rim_light * rim * mix(vec3(1.0), diffuse_color, rim_tint) * light_color; #endif } - if (roughness > 0.0) { // FIXME: roughness == 0 should not disable specular light entirely - // D #if defined(SPECULAR_BLINN) vec3 H = normalize(V + L); - float cNdotH = max(dot(N,H), 0.0 ); - float intensity = pow( cNdotH, (1.0-roughness) * 256.0); + float cNdotH = max(dot(N, H), 0.0); + float intensity = pow(cNdotH, (1.0 - roughness) * 256.0); specular_light += light_color * intensity * specular_blob_intensity * attenuation; #elif defined(SPECULAR_PHONG) - vec3 R = normalize(-reflect(L,N)); - float cRdotV = max(0.0,dot(R,V)); - float intensity = pow( cRdotV, (1.0-roughness) * 256.0); - specular_light += light_color * intensity * specular_blob_intensity * attenuation; + vec3 R = normalize(-reflect(L, N)); + float cRdotV = max(0.0, dot(R, V)); + float intensity = pow(cRdotV, (1.0 - roughness) * 256.0); + specular_light += light_color * intensity * specular_blob_intensity * attenuation; #elif defined(SPECULAR_TOON) - vec3 R = normalize(-reflect(L,N)); - float RdotV = dot(R,V); - float mid = 1.0-roughness; - mid*=mid; - float intensity = smoothstep(mid-roughness*0.5, mid+roughness*0.5, RdotV) * mid; + vec3 R = normalize(-reflect(L, N)); + float RdotV = dot(R, V); + float mid = 1.0 - roughness; + mid *= mid; + float intensity = smoothstep(mid - roughness * 0.5, mid + roughness * 0.5, RdotV) * mid; diffuse_light += light_color * intensity * specular_blob_intensity * attenuation; // write to diffuse_light, as in toon shading you generally want no reflection #elif defined(SPECULAR_DISABLED) - //none.. + // none.. #elif defined(SPECULAR_SCHLICK_GGX) // shlick+ggx as default vec3 H = normalize(V + L); - float cNdotH = max(dot(N,H), 0.0); - float cLdotH = max(dot(L,H), 0.0); + float cNdotH = max(dot(N, H), 0.0); + float cLdotH = max(dot(L, H), 0.0); -# if defined(LIGHT_USE_ANISOTROPY) +#if defined(LIGHT_USE_ANISOTROPY) - float aspect = sqrt(1.0-anisotropy*0.9); - float rx = roughness/aspect; - float ry = roughness*aspect; - float ax = rx*rx; - float ay = ry*ry; - float XdotH = dot( T, H ); - float YdotH = dot( B, H ); + float aspect = sqrt(1.0 - anisotropy * 0.9); + float rx = roughness / aspect; + float ry = roughness * aspect; + float ax = rx * rx; + float ay = ry * ry; + float XdotH = dot(T, H); + float YdotH = dot(B, H); float D = D_GGX_anisotropic(cNdotH, ax, ay, XdotH, YdotH); float G = G_GGX_anisotropic_2cos(cNdotL, ax, ay, XdotH, YdotH) * G_GGX_anisotropic_2cos(cNdotV, ax, ay, XdotH, YdotH); -# else +#else float alpha = roughness * roughness; float D = D_GGX(cNdotH, alpha); float G = G_GGX_2cos(cNdotL, alpha) * G_GGX_2cos(cNdotV, alpha); -# endif +#endif // F float F0 = 1.0; // FIXME float cLdotH5 = SchlickFresnel(cLdotH); @@ -1110,19 +1061,18 @@ LIGHT_SHADER_CODE #if defined(LIGHT_USE_CLEARCOAT) if (clearcoat_gloss > 0.0) { -# if !defined(SPECULAR_SCHLICK_GGX) && !defined(SPECULAR_BLINN) +#if !defined(SPECULAR_SCHLICK_GGX) && !defined(SPECULAR_BLINN) vec3 H = normalize(V + L); -# endif -# if !defined(SPECULAR_SCHLICK_GGX) - float cNdotH = max(dot(N,H), 0.0); - float cLdotH = max(dot(L,H), 0.0); +#endif +#if !defined(SPECULAR_SCHLICK_GGX) + float cNdotH = max(dot(N, H), 0.0); + float cLdotH = max(dot(L, H), 0.0); float cLdotH5 = SchlickFresnel(cLdotH); #endif float Dr = GTR1(cNdotH, mix(.1, .001, clearcoat_gloss)); float Fr = mix(.04, 1.0, cLdotH5); float Gr = G_GGX_2cos(cNdotL, .25) * G_GGX_2cos(cNdotV, .25); - float specular_brdf_NL = 0.25 * clearcoat * Gr * Fr * Dr * cNdotL; specular_light += specular_brdf_NL * light_color * specular_blob_intensity * attenuation; @@ -1130,45 +1080,42 @@ LIGHT_SHADER_CODE #endif } - #endif //defined(USE_LIGHT_SHADER_CODE) } - float sample_shadow(highp sampler2DShadow shadow, vec2 shadow_pixel_size, vec2 pos, float depth, vec4 clamp_rect) { #ifdef SHADOW_MODE_PCF_13 - float avg=textureProj(shadow,vec4(pos,depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,0.0),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,0.0),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(0.0,shadow_pixel_size.y),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,shadow_pixel_size.y),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,shadow_pixel_size.y),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,-shadow_pixel_size.y),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,-shadow_pixel_size.y),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x*2.0,0.0),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x*2.0,0.0),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(0.0,shadow_pixel_size.y*2.0),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y*2.0),depth,1.0)); - return avg*(1.0/13.0); + float avg = textureProj(shadow, vec4(pos, depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(shadow_pixel_size.x, 0.0), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(-shadow_pixel_size.x, 0.0), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(0.0, shadow_pixel_size.y), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(0.0, -shadow_pixel_size.y), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(shadow_pixel_size.x, shadow_pixel_size.y), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(-shadow_pixel_size.x, shadow_pixel_size.y), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(shadow_pixel_size.x, -shadow_pixel_size.y), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(-shadow_pixel_size.x, -shadow_pixel_size.y), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(shadow_pixel_size.x * 2.0, 0.0), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(-shadow_pixel_size.x * 2.0, 0.0), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(0.0, shadow_pixel_size.y * 2.0), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(0.0, -shadow_pixel_size.y * 2.0), depth, 1.0)); + return avg * (1.0 / 13.0); #elif defined(SHADOW_MODE_PCF_5) - float avg=textureProj(shadow,vec4(pos,depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,0.0),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,0.0),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(0.0,shadow_pixel_size.y),depth,1.0)); - avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y),depth,1.0)); - return avg*(1.0/5.0); + float avg = textureProj(shadow, vec4(pos, depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(shadow_pixel_size.x, 0.0), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(-shadow_pixel_size.x, 0.0), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(0.0, shadow_pixel_size.y), depth, 1.0)); + avg += textureProj(shadow, vec4(pos + vec2(0.0, -shadow_pixel_size.y), depth, 1.0)); + return avg * (1.0 / 5.0); #else - return textureProj(shadow,vec4(pos,depth,1.0)); + return textureProj(shadow, vec4(pos, depth, 1.0)); #endif - } #ifdef RENDER_DEPTH_DUAL_PARABOLOID @@ -1177,239 +1124,227 @@ in highp float dp_clip; #endif - - #if 0 -//need to save texture depth for this - +// need to save texture depth for this vec3 light_transmittance(float translucency,vec3 light_vec, vec3 normal, vec3 pos, float distance) { float scale = 8.25 * (1.0 - translucency) / subsurface_scatter_width; float d = scale * distance; - /** - * Armed with the thickness, we can now calculate the color by means of the - * precalculated transmittance profile. - * (It can be precomputed into a texture, for maximum performance): - */ + /** + * Armed with the thickness, we can now calculate the color by means of the + * precalculated transmittance profile. + * (It can be precomputed into a texture, for maximum performance): + */ float dd = -d * d; - vec3 profile = vec3(0.233, 0.455, 0.649) * exp(dd / 0.0064) + - vec3(0.1, 0.336, 0.344) * exp(dd / 0.0484) + - vec3(0.118, 0.198, 0.0) * exp(dd / 0.187) + - vec3(0.113, 0.007, 0.007) * exp(dd / 0.567) + - vec3(0.358, 0.004, 0.0) * exp(dd / 1.99) + - vec3(0.078, 0.0, 0.0) * exp(dd / 7.41); - - /** - * Using the profile, we finally approximate the transmitted lighting from - * the back of the object: - */ - return profile * clamp(0.3 + dot(light_vec, normal),0.0,1.0); + vec3 profile = + vec3(0.233, 0.455, 0.649) * exp(dd / 0.0064) + + vec3(0.1, 0.336, 0.344) * exp(dd / 0.0484) + + vec3(0.118, 0.198, 0.0) * exp(dd / 0.187) + + vec3(0.113, 0.007, 0.007) * exp(dd / 0.567) + + vec3(0.358, 0.004, 0.0) * exp(dd / 1.99) + + vec3(0.078, 0.0, 0.0) * exp(dd / 7.41); + + /** + * Using the profile, we finally approximate the transmitted lighting from + * the back of the object: + */ + return profile * clamp(0.3 + dot(light_vec, normal),0.0,1.0); } #endif -void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) { +void light_process_omni(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) { - vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz-vertex; - float light_length = length( light_rel_vec ); - float normalized_distance = light_length*omni_lights[idx].light_pos_inv_radius.w; - float omni_attenuation = pow( max(1.0 - normalized_distance, 0.0), omni_lights[idx].light_direction_attenuation.w ); + vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz - vertex; + float light_length = length(light_rel_vec); + float normalized_distance = light_length * omni_lights[idx].light_pos_inv_radius.w; + float omni_attenuation = pow(max(1.0 - normalized_distance, 0.0), omni_lights[idx].light_direction_attenuation.w); vec3 light_attenuation = vec3(omni_attenuation); #if !defined(SHADOWS_DISABLED) - if (omni_lights[idx].light_params.w>0.5) { - //there is a shadowmap + if (omni_lights[idx].light_params.w > 0.5) { + // there is a shadowmap - highp vec3 splane=(omni_lights[idx].shadow_matrix * vec4(vertex,1.0)).xyz; - float shadow_len=length(splane); - splane=normalize(splane); - vec4 clamp_rect=omni_lights[idx].light_clamp; + highp vec3 splane = (omni_lights[idx].shadow_matrix * vec4(vertex, 1.0)).xyz; + float shadow_len = length(splane); + splane = normalize(splane); + vec4 clamp_rect = omni_lights[idx].light_clamp; - if (splane.z>=0.0) { + if (splane.z >= 0.0) { - splane.z+=1.0; + splane.z += 1.0; - clamp_rect.y+=clamp_rect.w; + clamp_rect.y += clamp_rect.w; } else { - splane.z=1.0 - splane.z; + splane.z = 1.0 - splane.z; /* - if (clamp_rect.z<clamp_rect.w) { - clamp_rect.x+=clamp_rect.z; + if (clamp_rect.z < clamp_rect.w) { + clamp_rect.x += clamp_rect.z; } else { - clamp_rect.y+=clamp_rect.w; + clamp_rect.y += clamp_rect.w; } */ - } - splane.xy/=splane.z; - splane.xy=splane.xy * 0.5 + 0.5; + splane.xy /= splane.z; + splane.xy = splane.xy * 0.5 + 0.5; splane.z = shadow_len * omni_lights[idx].light_pos_inv_radius.w; - splane.xy = clamp_rect.xy+splane.xy*clamp_rect.zw; - float shadow = sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,clamp_rect); + splane.xy = clamp_rect.xy + splane.xy * clamp_rect.zw; + float shadow = sample_shadow(shadow_atlas, shadow_atlas_pixel_size, splane.xy, splane.z, clamp_rect); #ifdef USE_CONTACT_SHADOWS - if (shadow>0.01 && omni_lights[idx].shadow_color_contact.a>0.0) { - - float contact_shadow = contact_shadow_compute(vertex,normalize(light_rel_vec),min(light_length,omni_lights[idx].shadow_color_contact.a)); - shadow=min(shadow,contact_shadow); + if (shadow > 0.01 && omni_lights[idx].shadow_color_contact.a > 0.0) { + float contact_shadow = contact_shadow_compute(vertex, normalize(light_rel_vec), min(light_length, omni_lights[idx].shadow_color_contact.a)); + shadow = min(shadow, contact_shadow); } #endif - light_attenuation*=mix(omni_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow); + light_attenuation *= mix(omni_lights[idx].shadow_color_contact.rgb, vec3(1.0), shadow); } #endif //SHADOWS_DISABLED - - light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,omni_lights[idx].light_color_energy.rgb,light_attenuation,albedo,transmission,omni_lights[idx].light_params.z*p_blob_intensity,roughness,metallic,rim * omni_attenuation,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); - + light_compute(normal, normalize(light_rel_vec), eye_vec, binormal, tangent, omni_lights[idx].light_color_energy.rgb, light_attenuation, albedo, transmission, omni_lights[idx].light_params.z * p_blob_intensity, roughness, metallic, rim * omni_attenuation, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light); } -void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent,vec3 albedo, vec3 transmission,float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy,float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) { +void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) { - vec3 light_rel_vec = spot_lights[idx].light_pos_inv_radius.xyz-vertex; - float light_length = length( light_rel_vec ); - float normalized_distance = light_length*spot_lights[idx].light_pos_inv_radius.w; - float spot_attenuation = pow( max(1.0 - normalized_distance, 0.001), spot_lights[idx].light_direction_attenuation.w ); + vec3 light_rel_vec = spot_lights[idx].light_pos_inv_radius.xyz - vertex; + float light_length = length(light_rel_vec); + float normalized_distance = light_length * spot_lights[idx].light_pos_inv_radius.w; + float spot_attenuation = pow(max(1.0 - normalized_distance, 0.001), spot_lights[idx].light_direction_attenuation.w); vec3 spot_dir = spot_lights[idx].light_direction_attenuation.xyz; - float spot_cutoff=spot_lights[idx].light_params.y; - float scos = max(dot(-normalize(light_rel_vec), spot_dir),spot_cutoff); - float spot_rim = max(0.0001,(1.0 - scos) / (1.0 - spot_cutoff)); - spot_attenuation*= 1.0 - pow( spot_rim, spot_lights[idx].light_params.x); + float spot_cutoff = spot_lights[idx].light_params.y; + float scos = max(dot(-normalize(light_rel_vec), spot_dir), spot_cutoff); + float spot_rim = max(0.0001, (1.0 - scos) / (1.0 - spot_cutoff)); + spot_attenuation *= 1.0 - pow(spot_rim, spot_lights[idx].light_params.x); vec3 light_attenuation = vec3(spot_attenuation); #if !defined(SHADOWS_DISABLED) - if (spot_lights[idx].light_params.w>0.5) { + if (spot_lights[idx].light_params.w > 0.5) { //there is a shadowmap - highp vec4 splane=(spot_lights[idx].shadow_matrix * vec4(vertex,1.0)); - splane.xyz/=splane.w; + highp vec4 splane = (spot_lights[idx].shadow_matrix * vec4(vertex, 1.0)); + splane.xyz /= splane.w; - float shadow = sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,spot_lights[idx].light_clamp); + float shadow = sample_shadow(shadow_atlas, shadow_atlas_pixel_size, splane.xy, splane.z, spot_lights[idx].light_clamp); #ifdef USE_CONTACT_SHADOWS - if (shadow>0.01 && spot_lights[idx].shadow_color_contact.a>0.0) { - - float contact_shadow = contact_shadow_compute(vertex,normalize(light_rel_vec),min(light_length,spot_lights[idx].shadow_color_contact.a)); - shadow=min(shadow,contact_shadow); + if (shadow > 0.01 && spot_lights[idx].shadow_color_contact.a > 0.0) { + float contact_shadow = contact_shadow_compute(vertex, normalize(light_rel_vec), min(light_length, spot_lights[idx].shadow_color_contact.a)); + shadow = min(shadow, contact_shadow); } #endif - light_attenuation*=mix(spot_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow); + light_attenuation *= mix(spot_lights[idx].shadow_color_contact.rgb, vec3(1.0), shadow); } #endif //SHADOWS_DISABLED - light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,spot_lights[idx].light_color_energy.rgb,light_attenuation,albedo,transmission,spot_lights[idx].light_params.z*p_blob_intensity,roughness,metallic,rim * spot_attenuation,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); - + light_compute(normal, normalize(light_rel_vec), eye_vec, binormal, tangent, spot_lights[idx].light_color_energy.rgb, light_attenuation, albedo, transmission, spot_lights[idx].light_params.z * p_blob_intensity, roughness, metallic, rim * spot_attenuation, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light); } -void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 tangent,float roughness,float anisotropy,vec3 ambient,vec3 skybox, inout highp vec4 reflection_accum,inout highp vec4 ambient_accum) { +void reflection_process(int idx, vec3 vertex, vec3 normal, vec3 binormal, vec3 tangent, float roughness, float anisotropy, vec3 ambient, vec3 skybox, inout highp vec4 reflection_accum, inout highp vec4 ambient_accum) { - vec3 ref_vec = normalize(reflect(vertex,normal)); - vec3 local_pos = (reflections[idx].local_matrix * vec4(vertex,1.0)).xyz; + vec3 ref_vec = normalize(reflect(vertex, normal)); + vec3 local_pos = (reflections[idx].local_matrix * vec4(vertex, 1.0)).xyz; vec3 box_extents = reflections[idx].box_extents.xyz; - if (any(greaterThan(abs(local_pos),box_extents))) { //out of the reflection box + if (any(greaterThan(abs(local_pos), box_extents))) { //out of the reflection box return; } vec3 inner_pos = abs(local_pos / box_extents); - float blend = max(inner_pos.x,max(inner_pos.y,inner_pos.z)); + float blend = max(inner_pos.x, max(inner_pos.y, inner_pos.z)); //make blend more rounded - blend=mix(length(inner_pos),blend,blend); - blend*=blend; - blend=max(0.0, 1.0-blend); + blend = mix(length(inner_pos), blend, blend); + blend *= blend; + blend = max(0.0, 1.0 - blend); - if (reflections[idx].params.x>0.0){// compute reflection + if (reflections[idx].params.x > 0.0) { // compute reflection - vec3 local_ref_vec = (reflections[idx].local_matrix * vec4(ref_vec,0.0)).xyz; + vec3 local_ref_vec = (reflections[idx].local_matrix * vec4(ref_vec, 0.0)).xyz; if (reflections[idx].params.w > 0.5) { //box project vec3 nrdir = normalize(local_ref_vec); - vec3 rbmax = (box_extents - local_pos)/nrdir; - vec3 rbmin = (-box_extents - local_pos)/nrdir; + vec3 rbmax = (box_extents - local_pos) / nrdir; + vec3 rbmin = (-box_extents - local_pos) / nrdir; - - vec3 rbminmax = mix(rbmin,rbmax,greaterThan(nrdir,vec3(0.0,0.0,0.0))); + vec3 rbminmax = mix(rbmin, rbmax, greaterThan(nrdir, vec3(0.0, 0.0, 0.0))); float fa = min(min(rbminmax.x, rbminmax.y), rbminmax.z); vec3 posonbox = local_pos + nrdir * fa; local_ref_vec = posonbox - reflections[idx].box_offset.xyz; } - - vec4 clamp_rect=reflections[idx].atlas_clamp; + vec4 clamp_rect = reflections[idx].atlas_clamp; vec3 norm = normalize(local_ref_vec); - norm.xy/=1.0+abs(norm.z); - norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25); - if (norm.z>0.0) { - norm.y=0.5-norm.y+0.5; + norm.xy /= 1.0 + abs(norm.z); + norm.xy = norm.xy * vec2(0.5, 0.25) + vec2(0.5, 0.25); + if (norm.z > 0.0) { + norm.y = 0.5 - norm.y + 0.5; } - vec2 atlas_uv = norm.xy * clamp_rect.zw + clamp_rect.xy; - atlas_uv = clamp(atlas_uv,clamp_rect.xy,clamp_rect.xy+clamp_rect.zw); + vec2 atlas_uv = norm.xy * clamp_rect.zw + clamp_rect.xy; + atlas_uv = clamp(atlas_uv, clamp_rect.xy, clamp_rect.xy + clamp_rect.zw); highp vec4 reflection; - reflection.rgb = textureLod(reflection_atlas,atlas_uv,roughness*5.0).rgb; + reflection.rgb = textureLod(reflection_atlas, atlas_uv, roughness * 5.0).rgb; if (reflections[idx].params.z < 0.5) { - reflection.rgb = mix(skybox,reflection.rgb,blend); + reflection.rgb = mix(skybox, reflection.rgb, blend); } - reflection.rgb*=reflections[idx].params.x; + reflection.rgb *= reflections[idx].params.x; reflection.a = blend; - reflection.rgb*=reflection.a; + reflection.rgb *= reflection.a; - reflection_accum+=reflection; + reflection_accum += reflection; } #ifndef USE_LIGHTMAP - if (reflections[idx].ambient.a>0.0) { //compute ambient using skybox - + if (reflections[idx].ambient.a > 0.0) { //compute ambient using skybox - vec3 local_amb_vec = (reflections[idx].local_matrix * vec4(normal,0.0)).xyz; + vec3 local_amb_vec = (reflections[idx].local_matrix * vec4(normal, 0.0)).xyz; - vec3 splane=normalize(local_amb_vec); - vec4 clamp_rect=reflections[idx].atlas_clamp; + vec3 splane = normalize(local_amb_vec); + vec4 clamp_rect = reflections[idx].atlas_clamp; - splane.z*=-1.0; - if (splane.z>=0.0) { - splane.z+=1.0; - clamp_rect.y+=clamp_rect.w; + splane.z *= -1.0; + if (splane.z >= 0.0) { + splane.z += 1.0; + clamp_rect.y += clamp_rect.w; } else { - splane.z=1.0 - splane.z; - splane.y=-splane.y; + splane.z = 1.0 - splane.z; + splane.y = -splane.y; } - splane.xy/=splane.z; - splane.xy=splane.xy * 0.5 + 0.5; + splane.xy /= splane.z; + splane.xy = splane.xy * 0.5 + 0.5; splane.xy = splane.xy * clamp_rect.zw + clamp_rect.xy; - splane.xy = clamp(splane.xy,clamp_rect.xy,clamp_rect.xy+clamp_rect.zw); + splane.xy = clamp(splane.xy, clamp_rect.xy, clamp_rect.xy + clamp_rect.zw); highp vec4 ambient_out; - ambient_out.a=blend; - ambient_out.rgb = textureLod(reflection_atlas,splane.xy,5.0).rgb; - ambient_out.rgb=mix(reflections[idx].ambient.rgb,ambient_out.rgb,reflections[idx].ambient.a); + ambient_out.a = blend; + ambient_out.rgb = textureLod(reflection_atlas, splane.xy, 5.0).rgb; + ambient_out.rgb = mix(reflections[idx].ambient.rgb, ambient_out.rgb, reflections[idx].ambient.a); if (reflections[idx].params.z < 0.5) { - ambient_out.rgb = mix(ambient,ambient_out.rgb,blend); + ambient_out.rgb = mix(ambient, ambient_out.rgb, blend); } ambient_out.rgb *= ambient_out.a; - ambient_accum+=ambient_out; + ambient_accum += ambient_out; } else { highp vec4 ambient_out; - ambient_out.a=blend; - ambient_out.rgb=reflections[idx].ambient.rgb; + ambient_out.a = blend; + ambient_out.rgb = reflections[idx].ambient.rgb; if (reflections[idx].params.z < 0.5) { - ambient_out.rgb = mix(ambient,ambient_out.rgb,blend); + ambient_out.rgb = mix(ambient, ambient_out.rgb, blend); } ambient_out.rgb *= ambient_out.a; - ambient_accum+=ambient_out; - + ambient_accum += ambient_out; } #endif } @@ -1448,13 +1383,13 @@ uniform bool gi_probe_blend_ambient2; vec3 voxel_cone_trace(mediump sampler3D probe, vec3 cell_size, vec3 pos, vec3 ambient, bool blend_ambient, vec3 direction, float tan_half_angle, float max_distance, float p_bias) { - float dist = p_bias;//1.0; //dot(direction,mix(vec3(-1.0),vec3(1.0),greaterThan(direction,vec3(0.0))))*2.0; - float alpha=0.0; + float dist = p_bias; //1.0; //dot(direction,mix(vec3(-1.0),vec3(1.0),greaterThan(direction,vec3(0.0))))*2.0; + float alpha = 0.0; vec3 color = vec3(0.0); - while(dist < max_distance && alpha < 0.95) { + while (dist < max_distance && alpha < 0.95) { float diameter = max(1.0, 2.0 * tan_half_angle * dist); - vec4 scolor = textureLod(probe, (pos + dist * direction) * cell_size, log2(diameter) ); + vec4 scolor = textureLod(probe, (pos + dist * direction) * cell_size, log2(diameter)); float a = (1.0 - alpha); color += scolor.rgb * a; alpha += a * scolor.a; @@ -1462,35 +1397,33 @@ vec3 voxel_cone_trace(mediump sampler3D probe, vec3 cell_size, vec3 pos, vec3 am } if (blend_ambient) { - color.rgb = mix(ambient,color.rgb,min(1.0,alpha/0.95)); + color.rgb = mix(ambient, color.rgb, min(1.0, alpha / 0.95)); } return color; } -void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_size,vec3 pos, vec3 ambient, vec3 environment, bool blend_ambient,float multiplier, mat3 normal_mtx,vec3 ref_vec, float roughness,float p_bias,float p_normal_bias, inout vec4 out_spec, inout vec4 out_diff) { - - +void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds, vec3 cell_size, vec3 pos, vec3 ambient, vec3 environment, bool blend_ambient, float multiplier, mat3 normal_mtx, vec3 ref_vec, float roughness, float p_bias, float p_normal_bias, inout vec4 out_spec, inout vec4 out_diff) { - vec3 probe_pos = (probe_xform * vec4(pos,1.0)).xyz; - vec3 ref_pos = (probe_xform * vec4(pos+ref_vec,1.0)).xyz; + vec3 probe_pos = (probe_xform * vec4(pos, 1.0)).xyz; + vec3 ref_pos = (probe_xform * vec4(pos + ref_vec, 1.0)).xyz; ref_vec = normalize(ref_pos - probe_pos); - probe_pos+=(probe_xform * vec4(normal_mtx[2],0.0)).xyz*p_normal_bias; + probe_pos += (probe_xform * vec4(normal_mtx[2], 0.0)).xyz * p_normal_bias; -/* out_diff.rgb = voxel_cone_trace(probe,cell_size,probe_pos,normalize((probe_xform * vec4(ref_vec,0.0)).xyz),0.0 ,100.0); + /* out_diff.rgb = voxel_cone_trace(probe,cell_size,probe_pos,normalize((probe_xform * vec4(ref_vec,0.0)).xyz),0.0 ,100.0); out_diff.a = 1.0; return;*/ //out_diff = vec4(textureLod(probe,probe_pos*cell_size,3.0).rgb,1.0); //return; //this causes corrupted pixels, i have no idea why.. - if (any(bvec2(any(lessThan(probe_pos,vec3(0.0))),any(greaterThan(probe_pos,bounds))))) { + if (any(bvec2(any(lessThan(probe_pos, vec3(0.0))), any(greaterThan(probe_pos, bounds))))) { return; } - vec3 blendv = abs(probe_pos/bounds * 2.0 - 1.0); - float blend = clamp(1.0-max(blendv.x,max(blendv.y,blendv.z)), 0.0, 1.0); + vec3 blendv = abs(probe_pos / bounds * 2.0 - 1.0); + float blend = clamp(1.0 - max(blendv.x, max(blendv.y, blendv.z)), 0.0, 1.0); //float blend=1.0; float max_distance = length(bounds); @@ -1499,14 +1432,13 @@ void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds,vec #ifdef VCT_QUALITY_HIGH #define MAX_CONE_DIRS 6 - vec3 cone_dirs[MAX_CONE_DIRS] = vec3[] ( - vec3(0, 0, 1), - vec3(0.866025, 0, 0.5), - vec3(0.267617, 0.823639, 0.5), - vec3(-0.700629, 0.509037, 0.5), - vec3(-0.700629, -0.509037, 0.5), - vec3(0.267617, -0.823639, 0.5) - ); + vec3 cone_dirs[MAX_CONE_DIRS] = vec3[]( + vec3(0, 0, 1), + vec3(0.866025, 0, 0.5), + vec3(0.267617, 0.823639, 0.5), + vec3(-0.700629, 0.509037, 0.5), + vec3(-0.700629, -0.509037, 0.5), + vec3(0.267617, -0.823639, 0.5)); float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.15, 0.15, 0.15, 0.15, 0.15); float cone_angle_tan = 0.577; @@ -1515,54 +1447,50 @@ void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds,vec #define MAX_CONE_DIRS 4 - vec3 cone_dirs[MAX_CONE_DIRS] = vec3[] ( + vec3 cone_dirs[MAX_CONE_DIRS] = vec3[]( vec3(0.707107, 0, 0.707107), vec3(0, 0.707107, 0.707107), vec3(-0.707107, 0, 0.707107), - vec3(0, -0.707107, 0.707107) - ); + vec3(0, -0.707107, 0.707107)); float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.25, 0.25, 0.25); float cone_angle_tan = 0.98269; - max_distance*=0.5; + max_distance *= 0.5; float min_ref_tan = 0.2; #endif - vec3 light=vec3(0.0); - for(int i=0;i<MAX_CONE_DIRS;i++) { - - vec3 dir = normalize( (probe_xform * vec4(pos + normal_mtx * cone_dirs[i],1.0)).xyz - probe_pos); - light+=cone_weights[i] * voxel_cone_trace(probe,cell_size,probe_pos,ambient,blend_ambient,dir,cone_angle_tan,max_distance,p_bias); + vec3 light = vec3(0.0); + for (int i = 0; i < MAX_CONE_DIRS; i++) { + vec3 dir = normalize((probe_xform * vec4(pos + normal_mtx * cone_dirs[i], 1.0)).xyz - probe_pos); + light += cone_weights[i] * voxel_cone_trace(probe, cell_size, probe_pos, ambient, blend_ambient, dir, cone_angle_tan, max_distance, p_bias); } - light*=multiplier; + light *= multiplier; - out_diff += vec4(light*blend,blend); + out_diff += vec4(light * blend, blend); //irradiance - vec3 irr_light = voxel_cone_trace(probe,cell_size,probe_pos,environment,blend_ambient,ref_vec,max(min_ref_tan,tan(roughness * 0.5 * M_PI)) ,max_distance,p_bias); + vec3 irr_light = voxel_cone_trace(probe, cell_size, probe_pos, environment, blend_ambient, ref_vec, max(min_ref_tan, tan(roughness * 0.5 * M_PI)), max_distance, p_bias); irr_light *= multiplier; //irr_light=vec3(0.0); - out_spec += vec4(irr_light*blend,blend); - + out_spec += vec4(irr_light * blend, blend); } - void gi_probes_compute(vec3 pos, vec3 normal, float roughness, inout vec3 out_specular, inout vec3 out_ambient) { roughness = roughness * roughness; - vec3 ref_vec = normalize(reflect(normalize(pos),normal)); + vec3 ref_vec = normalize(reflect(normalize(pos), normal)); //find arbitrary tangent and bitangent, then build a matrix vec3 v0 = abs(normal.z) < 0.999 ? vec3(0, 0, 1) : vec3(0, 1, 0); vec3 tangent = normalize(cross(v0, normal)); vec3 bitangent = normalize(cross(tangent, normal)); - mat3 normal_mat = mat3(tangent,bitangent,normal); + mat3 normal_mat = mat3(tangent, bitangent, normal); vec4 diff_accum = vec4(0.0); vec4 spec_accum = vec4(0.0); @@ -1574,35 +1502,32 @@ void gi_probes_compute(vec3 pos, vec3 normal, float roughness, inout vec3 out_sp out_specular = vec3(0.0); - gi_probe_compute(gi_probe1,gi_probe_xform1,gi_probe_bounds1,gi_probe_cell_size1,pos,ambient,environment,gi_probe_blend_ambient1,gi_probe_multiplier1,normal_mat,ref_vec,roughness,gi_probe_bias1,gi_probe_normal_bias1,spec_accum,diff_accum); + gi_probe_compute(gi_probe1, gi_probe_xform1, gi_probe_bounds1, gi_probe_cell_size1, pos, ambient, environment, gi_probe_blend_ambient1, gi_probe_multiplier1, normal_mat, ref_vec, roughness, gi_probe_bias1, gi_probe_normal_bias1, spec_accum, diff_accum); if (gi_probe2_enabled) { - gi_probe_compute(gi_probe2,gi_probe_xform2,gi_probe_bounds2,gi_probe_cell_size2,pos,ambient,environment,gi_probe_blend_ambient2,gi_probe_multiplier2,normal_mat,ref_vec,roughness,gi_probe_bias2,gi_probe_normal_bias2,spec_accum,diff_accum); + gi_probe_compute(gi_probe2, gi_probe_xform2, gi_probe_bounds2, gi_probe_cell_size2, pos, ambient, environment, gi_probe_blend_ambient2, gi_probe_multiplier2, normal_mat, ref_vec, roughness, gi_probe_bias2, gi_probe_normal_bias2, spec_accum, diff_accum); } - if (diff_accum.a>0.0) { - diff_accum.rgb/=diff_accum.a; + if (diff_accum.a > 0.0) { + diff_accum.rgb /= diff_accum.a; } - if (spec_accum.a>0.0) { - spec_accum.rgb/=spec_accum.a; + if (spec_accum.a > 0.0) { + spec_accum.rgb /= spec_accum.a; } - out_specular+=spec_accum.rgb; - out_ambient+=diff_accum.rgb; - + out_specular += spec_accum.rgb; + out_ambient += diff_accum.rgb; } #endif - - void main() { #ifdef RENDER_DEPTH_DUAL_PARABOLOID - if (dp_clip>0.0) + if (dp_clip > 0.0) discard; #endif @@ -1622,37 +1547,36 @@ void main() { vec2 anisotropy_flow = vec2(1.0, 0.0); #if defined(ENABLE_AO) - float ao=1.0; - float ao_light_affect=0.0; + float ao = 1.0; + float ao_light_affect = 0.0; #endif float alpha = 1.0; #if defined(DO_SIDE_CHECK) - float side=gl_FrontFacing ? 1.0 : -1.0; + float side = gl_FrontFacing ? 1.0 : -1.0; #else - float side=1.0; + float side = 1.0; #endif - #if defined(ALPHA_SCISSOR_USED) float alpha_scissor = 0.5; #endif #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) - vec3 binormal = normalize(binormal_interp)*side; - vec3 tangent = normalize(tangent_interp)*side; + vec3 binormal = normalize(binormal_interp) * side; + vec3 tangent = normalize(tangent_interp) * side; #else vec3 binormal = vec3(0.0); vec3 tangent = vec3(0.0); #endif - vec3 normal = normalize(normal_interp)*side; + vec3 normal = normalize(normal_interp) * side; #if defined(ENABLE_UV_INTERP) vec2 uv = uv_interp; #endif -#if defined(ENABLE_UV2_INTERP) || defined (USE_LIGHTMAP) +#if defined(ENABLE_UV2_INTERP) || defined(USE_LIGHTMAP) vec2 uv2 = uv2_interp; #endif @@ -1665,33 +1589,31 @@ void main() { vec3 normalmap = vec3(0.5); #endif - float normaldepth=1.0; + float normaldepth = 1.0; #if defined(SCREEN_UV_USED) - vec2 screen_uv = gl_FragCoord.xy*screen_pixel_size; + vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size; #endif -#if defined (ENABLE_SSS) - float sss_strength=0.0; +#if defined(ENABLE_SSS) + float sss_strength = 0.0; #endif { - FRAGMENT_SHADER_CODE } - #if defined(ALPHA_SCISSOR_USED) - if (alpha<alpha_scissor) { + if (alpha < alpha_scissor) { discard; } #endif #ifdef USE_OPAQUE_PREPASS - if (alpha<opaque_prepass_threshold) { + if (alpha < opaque_prepass_threshold) { discard; } @@ -1699,33 +1621,33 @@ FRAGMENT_SHADER_CODE #if defined(ENABLE_NORMALMAP) - normalmap.xy=normalmap.xy*2.0-1.0; - normalmap.z=sqrt(max(0.0, 1.0-dot(normalmap.xy,normalmap.xy))); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc. + normalmap.xy = normalmap.xy * 2.0 - 1.0; + normalmap.z = sqrt(max(0.0, 1.0 - dot(normalmap.xy, normalmap.xy))); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc. - normal = normalize( mix(normal_interp,tangent * normalmap.x + binormal * normalmap.y + normal * normalmap.z,normaldepth) ) * side; + normal = normalize(mix(normal_interp, tangent * normalmap.x + binormal * normalmap.y + normal * normalmap.z, normaldepth)) * side; #endif #if defined(LIGHT_USE_ANISOTROPY) - if (anisotropy>0.01) { + if (anisotropy > 0.01) { //rotation matrix - mat3 rot = mat3( tangent, binormal, normal ); + mat3 rot = mat3(tangent, binormal, normal); //make local to space - tangent = normalize(rot * vec3(anisotropy_flow.x,anisotropy_flow.y,0.0)); - binormal = normalize(rot * vec3(-anisotropy_flow.y,anisotropy_flow.x,0.0)); + tangent = normalize(rot * vec3(anisotropy_flow.x, anisotropy_flow.y, 0.0)); + binormal = normalize(rot * vec3(-anisotropy_flow.y, anisotropy_flow.x, 0.0)); } #endif #ifdef ENABLE_CLIP_ALPHA - if (albedo.a<0.99) { + if (albedo.a < 0.99) { //used for doublepass and shadowmapping discard; } #endif -/////////////////////// LIGHTING ////////////////////////////// + /////////////////////// LIGHTING ////////////////////////////// //apply energy conservation @@ -1735,44 +1657,40 @@ FRAGMENT_SHADER_CODE vec3 diffuse_light = diffuse_light_interp.rgb; #else - vec3 specular_light = vec3(0.0,0.0,0.0); - vec3 diffuse_light = vec3(0.0,0.0,0.0); + vec3 specular_light = vec3(0.0, 0.0, 0.0); + vec3 diffuse_light = vec3(0.0, 0.0, 0.0); #endif vec3 ambient_light; - vec3 env_reflection_light = vec3(0.0,0.0,0.0); - - vec3 eye_vec = -normalize( vertex_interp ); - + vec3 env_reflection_light = vec3(0.0, 0.0, 0.0); + vec3 eye_vec = -normalize(vertex_interp); #ifdef USE_RADIANCE_MAP #ifdef AMBIENT_LIGHT_DISABLED - ambient_light=vec3(0.0,0.0,0.0); + ambient_light = vec3(0.0, 0.0, 0.0); #else { { //read radiance from dual paraboloid - vec3 ref_vec = reflect(-eye_vec,normal); //2.0 * ndotv * normal - view; // reflect(v, n); - ref_vec=normalize((radiance_inverse_xform * vec4(ref_vec,0.0)).xyz); - vec3 radiance = textureDualParaboloid(radiance_map,ref_vec,roughness) * bg_energy; + vec3 ref_vec = reflect(-eye_vec, normal); //2.0 * ndotv * normal - view; // reflect(v, n); + ref_vec = normalize((radiance_inverse_xform * vec4(ref_vec, 0.0)).xyz); + vec3 radiance = textureDualParaboloid(radiance_map, ref_vec, roughness) * bg_energy; env_reflection_light = radiance; - } //no longer a cubemap //vec3 radiance = textureLod(radiance_cube, r, lod).xyz * ( brdf.x + brdf.y); - } #ifndef USE_LIGHTMAP { - vec3 ambient_dir=normalize((radiance_inverse_xform * vec4(normal,0.0)).xyz); - vec3 env_ambient=textureDualParaboloid(radiance_map,ambient_dir,1.0) * bg_energy; + vec3 ambient_dir = normalize((radiance_inverse_xform * vec4(normal, 0.0)).xyz); + vec3 env_ambient = textureDualParaboloid(radiance_map, ambient_dir, 1.0) * bg_energy; - ambient_light=mix(ambient_light_color.rgb,env_ambient,radiance_ambient_contribution); + ambient_light = mix(ambient_light_color.rgb, env_ambient, radiance_ambient_contribution); //ambient_light=vec3(0.0,0.0,0.0); } #endif @@ -1781,23 +1699,23 @@ FRAGMENT_SHADER_CODE #else #ifdef AMBIENT_LIGHT_DISABLED - ambient_light=vec3(0.0,0.0,0.0); + ambient_light = vec3(0.0, 0.0, 0.0); #else - ambient_light=ambient_light_color.rgb; + ambient_light = ambient_light_color.rgb; #endif //AMBIENT_LIGHT_DISABLED #endif - ambient_light*=ambient_energy; + ambient_light *= ambient_energy; - float specular_blob_intensity=1.0; + float specular_blob_intensity = 1.0; #if defined(SPECULAR_TOON) - specular_blob_intensity*=specular * 2.0; + specular_blob_intensity *= specular * 2.0; #endif #if defined(USE_LIGHT_DIRECTIONAL) - vec3 light_attenuation=vec3(1.0); + vec3 light_attenuation = vec3(1.0); float depth_z = -vertex.z; #ifdef LIGHT_DIRECTIONAL_SHADOW @@ -1811,261 +1729,234 @@ FRAGMENT_SHADER_CODE if (depth_z < shadow_split_offsets.x) { #endif //LIGHT_USE_PSSM4 - vec3 pssm_coord; - float pssm_fade=0.0; + vec3 pssm_coord; + float pssm_fade = 0.0; #ifdef LIGHT_USE_PSSM_BLEND - float pssm_blend; - vec3 pssm_coord2; - bool use_blend=true; + float pssm_blend; + vec3 pssm_coord2; + bool use_blend = true; #endif - #ifdef LIGHT_USE_PSSM4 + if (depth_z < shadow_split_offsets.y) { - if (depth_z < shadow_split_offsets.y) { - - if (depth_z < shadow_split_offsets.x) { - - highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0)); - pssm_coord=splane.xyz/splane.w; + if (depth_z < shadow_split_offsets.x) { + highp vec4 splane = (shadow_matrix1 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; #if defined(LIGHT_USE_PSSM_BLEND) - splane=(shadow_matrix2 * vec4(vertex,1.0)); - pssm_coord2=splane.xyz/splane.w; - pssm_blend=smoothstep(0.0,shadow_split_offsets.x,depth_z); + splane = (shadow_matrix2 * vec4(vertex, 1.0)); + pssm_coord2 = splane.xyz / splane.w; + pssm_blend = smoothstep(0.0, shadow_split_offsets.x, depth_z); #endif - } else { + } else { - highp vec4 splane=(shadow_matrix2 * vec4(vertex,1.0)); - pssm_coord=splane.xyz/splane.w; + highp vec4 splane = (shadow_matrix2 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; #if defined(LIGHT_USE_PSSM_BLEND) - splane=(shadow_matrix3 * vec4(vertex,1.0)); - pssm_coord2=splane.xyz/splane.w; - pssm_blend=smoothstep(shadow_split_offsets.x,shadow_split_offsets.y,depth_z); + splane = (shadow_matrix3 * vec4(vertex, 1.0)); + pssm_coord2 = splane.xyz / splane.w; + pssm_blend = smoothstep(shadow_split_offsets.x, shadow_split_offsets.y, depth_z); #endif + } + } else { - } - } else { - - - if (depth_z < shadow_split_offsets.z) { + if (depth_z < shadow_split_offsets.z) { - highp vec4 splane=(shadow_matrix3 * vec4(vertex,1.0)); - pssm_coord=splane.xyz/splane.w; + highp vec4 splane = (shadow_matrix3 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; #if defined(LIGHT_USE_PSSM_BLEND) - splane=(shadow_matrix4 * vec4(vertex,1.0)); - pssm_coord2=splane.xyz/splane.w; - pssm_blend=smoothstep(shadow_split_offsets.y,shadow_split_offsets.z,depth_z); + splane = (shadow_matrix4 * vec4(vertex, 1.0)); + pssm_coord2 = splane.xyz / splane.w; + pssm_blend = smoothstep(shadow_split_offsets.y, shadow_split_offsets.z, depth_z); #endif - } else { + } else { - highp vec4 splane=(shadow_matrix4 * vec4(vertex,1.0)); - pssm_coord=splane.xyz/splane.w; - pssm_fade = smoothstep(shadow_split_offsets.z,shadow_split_offsets.w,depth_z); + highp vec4 splane = (shadow_matrix4 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; + pssm_fade = smoothstep(shadow_split_offsets.z, shadow_split_offsets.w, depth_z); #if defined(LIGHT_USE_PSSM_BLEND) - use_blend=false; + use_blend = false; #endif - + } } - } - - #endif //LIGHT_USE_PSSM4 #ifdef LIGHT_USE_PSSM2 - if (depth_z < shadow_split_offsets.x) { - - highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0)); - pssm_coord=splane.xyz/splane.w; + if (depth_z < shadow_split_offsets.x) { + highp vec4 splane = (shadow_matrix1 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; #if defined(LIGHT_USE_PSSM_BLEND) - splane=(shadow_matrix2 * vec4(vertex,1.0)); - pssm_coord2=splane.xyz/splane.w; - pssm_blend=smoothstep(0.0,shadow_split_offsets.x,depth_z); + splane = (shadow_matrix2 * vec4(vertex, 1.0)); + pssm_coord2 = splane.xyz / splane.w; + pssm_blend = smoothstep(0.0, shadow_split_offsets.x, depth_z); #endif - } else { - highp vec4 splane=(shadow_matrix2 * vec4(vertex,1.0)); - pssm_coord=splane.xyz/splane.w; - pssm_fade = smoothstep(shadow_split_offsets.x,shadow_split_offsets.y,depth_z); + } else { + highp vec4 splane = (shadow_matrix2 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; + pssm_fade = smoothstep(shadow_split_offsets.x, shadow_split_offsets.y, depth_z); #if defined(LIGHT_USE_PSSM_BLEND) - use_blend=false; + use_blend = false; #endif - - } + } #endif //LIGHT_USE_PSSM2 #if !defined(LIGHT_USE_PSSM4) && !defined(LIGHT_USE_PSSM2) - { //regular orthogonal - highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0)); - pssm_coord=splane.xyz/splane.w; - } + { //regular orthogonal + highp vec4 splane = (shadow_matrix1 * vec4(vertex, 1.0)); + pssm_coord = splane.xyz / splane.w; + } #endif + //one one sample - //one one sample - - float shadow = sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord.xy,pssm_coord.z,light_clamp); + float shadow = sample_shadow(directional_shadow, directional_shadow_pixel_size, pssm_coord.xy, pssm_coord.z, light_clamp); #if defined(LIGHT_USE_PSSM_BLEND) - if (use_blend) { - shadow=mix(shadow, sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord2.xy,pssm_coord2.z,light_clamp),pssm_blend); - } + if (use_blend) { + shadow = mix(shadow, sample_shadow(directional_shadow, directional_shadow_pixel_size, pssm_coord2.xy, pssm_coord2.z, light_clamp), pssm_blend); + } #endif #ifdef USE_CONTACT_SHADOWS - if (shadow>0.01 && shadow_color_contact.a>0.0) { + if (shadow > 0.01 && shadow_color_contact.a > 0.0) { - float contact_shadow = contact_shadow_compute(vertex,-light_direction_attenuation.xyz,shadow_color_contact.a); - shadow=min(shadow,contact_shadow); - - } + float contact_shadow = contact_shadow_compute(vertex, -light_direction_attenuation.xyz, shadow_color_contact.a); + shadow = min(shadow, contact_shadow); + } #endif - light_attenuation=mix(mix(shadow_color_contact.rgb,vec3(1.0),shadow),vec3(1.0),pssm_fade); - - + light_attenuation = mix(mix(shadow_color_contact.rgb, vec3(1.0), shadow), vec3(1.0), pssm_fade); } - #endif // !defined(SHADOWS_DISABLED) #endif //LIGHT_DIRECTIONAL_SHADOW #ifdef USE_VERTEX_LIGHTING - diffuse_light*=mix(vec3(1.0),light_attenuation,diffuse_light_interp.a); - specular_light*=mix(vec3(1.0),light_attenuation,specular_light_interp.a); + diffuse_light *= mix(vec3(1.0), light_attenuation, diffuse_light_interp.a); + specular_light *= mix(vec3(1.0), light_attenuation, specular_light_interp.a); #else - light_compute(normal,-light_direction_attenuation.xyz,eye_vec,binormal,tangent,light_color_energy.rgb,light_attenuation,albedo,transmission,light_params.z*specular_blob_intensity,roughness,metallic,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); + light_compute(normal, -light_direction_attenuation.xyz, eye_vec, binormal, tangent, light_color_energy.rgb, light_attenuation, albedo, transmission, light_params.z * specular_blob_intensity, roughness, metallic, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light); #endif - #endif //#USE_LIGHT_DIRECTIONAL #ifdef USE_GI_PROBES - gi_probes_compute(vertex,normal,roughness,env_reflection_light,ambient_light); + gi_probes_compute(vertex, normal, roughness, env_reflection_light, ambient_light); #endif #ifdef USE_LIGHTMAP - ambient_light = texture(lightmap,uv2).rgb * lightmap_energy; + ambient_light = texture(lightmap, uv2).rgb * lightmap_energy; #endif #ifdef USE_LIGHTMAP_CAPTURE { - vec3 cone_dirs[12] = vec3[] ( - vec3(0, 0, 1), - vec3(0.866025, 0, 0.5), - vec3(0.267617, 0.823639, 0.5), - vec3(-0.700629, 0.509037, 0.5), - vec3(-0.700629, -0.509037, 0.5), - vec3(0.267617, -0.823639, 0.5), - vec3(0, 0, -1), - vec3(0.866025, 0, -0.5), - vec3(0.267617, 0.823639, -0.5), - vec3(-0.700629, 0.509037, -0.5), - vec3(-0.700629, -0.509037, -0.5), - vec3(0.267617, -0.823639, -0.5) - ); - - - vec3 local_normal = normalize(camera_matrix * vec4(normal,0.0)).xyz; + vec3 cone_dirs[12] = vec3[]( + vec3(0, 0, 1), + vec3(0.866025, 0, 0.5), + vec3(0.267617, 0.823639, 0.5), + vec3(-0.700629, 0.509037, 0.5), + vec3(-0.700629, -0.509037, 0.5), + vec3(0.267617, -0.823639, 0.5), + vec3(0, 0, -1), + vec3(0.866025, 0, -0.5), + vec3(0.267617, 0.823639, -0.5), + vec3(-0.700629, 0.509037, -0.5), + vec3(-0.700629, -0.509037, -0.5), + vec3(0.267617, -0.823639, -0.5)); + + vec3 local_normal = normalize(camera_matrix * vec4(normal, 0.0)).xyz; vec4 captured = vec4(0.0); float sum = 0.0; - for(int i=0;i<12;i++) { - float amount = max(0.0,dot(local_normal,cone_dirs[i])); //not correct, but creates a nice wrap around effect - captured += lightmap_captures[i]*amount; - sum+=amount; + for (int i = 0; i < 12; i++) { + float amount = max(0.0, dot(local_normal, cone_dirs[i])); //not correct, but creates a nice wrap around effect + captured += lightmap_captures[i] * amount; + sum += amount; } - captured/=sum; + captured /= sum; if (lightmap_capture_sky) { - ambient_light = mix( ambient_light, captured.rgb, captured.a); + ambient_light = mix(ambient_light, captured.rgb, captured.a); } else { ambient_light = captured.rgb; } - } #endif #ifdef USE_FORWARD_LIGHTING - - highp vec4 reflection_accum = vec4(0.0,0.0,0.0,0.0); - highp vec4 ambient_accum = vec4(0.0,0.0,0.0,0.0); - for(int i=0;i<reflection_count;i++) { - reflection_process(reflection_indices[i],vertex,normal,binormal,tangent,roughness,anisotropy,ambient_light,env_reflection_light,reflection_accum,ambient_accum); + highp vec4 reflection_accum = vec4(0.0, 0.0, 0.0, 0.0); + highp vec4 ambient_accum = vec4(0.0, 0.0, 0.0, 0.0); + for (int i = 0; i < reflection_count; i++) { + reflection_process(reflection_indices[i], vertex, normal, binormal, tangent, roughness, anisotropy, ambient_light, env_reflection_light, reflection_accum, ambient_accum); } - if (reflection_accum.a>0.0) { - specular_light+=reflection_accum.rgb/reflection_accum.a; + if (reflection_accum.a > 0.0) { + specular_light += reflection_accum.rgb / reflection_accum.a; } else { - specular_light+=env_reflection_light; + specular_light += env_reflection_light; } #ifndef USE_LIGHTMAP - if (ambient_accum.a>0.0) { - ambient_light=ambient_accum.rgb/ambient_accum.a; + if (ambient_accum.a > 0.0) { + ambient_light = ambient_accum.rgb / ambient_accum.a; } #endif - #ifdef USE_VERTEX_LIGHTING - diffuse_light*=albedo; + diffuse_light *= albedo; #else - for(int i=0;i<omni_light_count;i++) { - light_process_omni(omni_light_indices[i],vertex,eye_vec,normal,binormal,tangent,albedo,transmission,roughness,metallic,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,specular_blob_intensity,diffuse_light,specular_light); + for (int i = 0; i < omni_light_count; i++) { + light_process_omni(omni_light_indices[i], vertex, eye_vec, normal, binormal, tangent, albedo, transmission, roughness, metallic, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, specular_blob_intensity, diffuse_light, specular_light); } - for(int i=0;i<spot_light_count;i++) { - light_process_spot(spot_light_indices[i],vertex,eye_vec,normal,binormal,tangent,albedo,transmission,roughness,metallic,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,specular_blob_intensity,diffuse_light,specular_light); + for (int i = 0; i < spot_light_count; i++) { + light_process_spot(spot_light_indices[i], vertex, eye_vec, normal, binormal, tangent, albedo, transmission, roughness, metallic, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, specular_blob_intensity, diffuse_light, specular_light); } #endif //USE_VERTEX_LIGHTING #endif - - - #ifdef RENDER_DEPTH //nothing happens, so a tree-ssa optimizer will result in no fragment shader :) #else - specular_light*=reflection_multiplier; - ambient_light*=albedo; //ambient must be multiplied by albedo at the end + specular_light *= reflection_multiplier; + ambient_light *= albedo; //ambient must be multiplied by albedo at the end #if defined(ENABLE_AO) - ambient_light*=ao; - ao_light_affect = mix(1.0,ao,ao_light_affect); - specular_light*=ao_light_affect; - diffuse_light*=ao_light_affect; + ambient_light *= ao; + ao_light_affect = mix(1.0, ao, ao_light_affect); + specular_light *= ao_light_affect; + diffuse_light *= ao_light_affect; #endif - - //energy conservation - diffuse_light *= 1.0-metallic; // TODO: avoid all diffuse and ambient light calculations when metallic == 1 up to this point - ambient_light *= 1.0-metallic; - + diffuse_light *= 1.0 - metallic; // TODO: avoid all diffuse and ambient light calculations when metallic == 1 up to this point + ambient_light *= 1.0 - metallic; { @@ -2076,27 +1967,24 @@ FRAGMENT_SHADER_CODE // Environment brdf approximation (Lazarov 2013) // see https://www.unrealengine.com/en-US/blog/physically-based-shading-on-mobile const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022); - const vec4 c1 = vec4( 1.0, 0.0425, 1.04, -0.04); + const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04); vec4 r = roughness * c0 + c1; - float ndotv = clamp(dot(normal,eye_vec),0.0,1.0); - float a004 = min( r.x * r.x, exp2( -9.28 * ndotv ) ) * r.x + r.y; - vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw; + float ndotv = clamp(dot(normal, eye_vec), 0.0, 1.0); + float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y; + vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw; vec3 specular_color = metallic_to_specular_color(metallic, specular, albedo); specular_light *= AB.x * specular_color + AB.y; #endif - } if (fog_color_enabled.a > 0.5) { - float fog_amount=0.0; - - + float fog_amount = 0.0; #ifdef USE_LIGHT_DIRECTIONAL - vec3 fog_color = mix( fog_color_enabled.rgb, fog_sun_color_amount.rgb,fog_sun_color_amount.a * pow(max( dot(normalize(vertex),-light_direction_attenuation.xyz), 0.0),8.0) ); + vec3 fog_color = mix(fog_color_enabled.rgb, fog_sun_color_amount.rgb, fog_sun_color_amount.a * pow(max(dot(normalize(vertex), -light_direction_attenuation.xyz), 0.0), 8.0)); #else vec3 fog_color = fog_color_enabled.rgb; @@ -2106,78 +1994,67 @@ FRAGMENT_SHADER_CODE if (fog_depth_enabled) { - float fog_z = smoothstep(fog_depth_begin,z_far,length(vertex)); + float fog_z = smoothstep(fog_depth_begin, z_far, length(vertex)); - fog_amount = pow(fog_z,fog_depth_curve); + fog_amount = pow(fog_z, fog_depth_curve); if (fog_transmit_enabled) { vec3 total_light = emission + ambient_light + specular_light + diffuse_light; - float transmit = pow(fog_z,fog_transmit_curve); - fog_color = mix(max(total_light,fog_color),fog_color,transmit); + float transmit = pow(fog_z, fog_transmit_curve); + fog_color = mix(max(total_light, fog_color), fog_color, transmit); } } if (fog_height_enabled) { - float y = (camera_matrix * vec4(vertex,1.0)).y; - fog_amount = max(fog_amount,pow(smoothstep(fog_height_min,fog_height_max,y),fog_height_curve)); + float y = (camera_matrix * vec4(vertex, 1.0)).y; + fog_amount = max(fog_amount, pow(smoothstep(fog_height_min, fog_height_max, y), fog_height_curve)); } float rev_amount = 1.0 - fog_amount; - emission = emission * rev_amount + fog_color * fog_amount; - ambient_light*=rev_amount; - specular_light*rev_amount; - diffuse_light*=rev_amount; - + ambient_light *= rev_amount; + specular_light *rev_amount; + diffuse_light *= rev_amount; } #ifdef USE_MULTIPLE_RENDER_TARGETS - #ifdef SHADELESS - diffuse_buffer=vec4(albedo.rgb,0.0); - specular_buffer=vec4(0.0); + diffuse_buffer = vec4(albedo.rgb, 0.0); + specular_buffer = vec4(0.0); #else - - //approximate ambient scale for SSAO, since we will lack full ambient - float max_emission=max(emission.r,max(emission.g,emission.b)); - float max_ambient=max(ambient_light.r,max(ambient_light.g,ambient_light.b)); - float max_diffuse=max(diffuse_light.r,max(diffuse_light.g,diffuse_light.b)); - float total_ambient = max_ambient+max_diffuse+max_emission; - float ambient_scale = (total_ambient>0.0) ? (max_ambient+ambient_occlusion_affect_light*max_diffuse)/total_ambient : 0.0; + float max_emission = max(emission.r, max(emission.g, emission.b)); + float max_ambient = max(ambient_light.r, max(ambient_light.g, ambient_light.b)); + float max_diffuse = max(diffuse_light.r, max(diffuse_light.g, diffuse_light.b)); + float total_ambient = max_ambient + max_diffuse + max_emission; + float ambient_scale = (total_ambient > 0.0) ? (max_ambient + ambient_occlusion_affect_light * max_diffuse) / total_ambient : 0.0; #if defined(ENABLE_AO) - ambient_scale=mix(0.0,ambient_scale,ambient_occlusion_affect_ao_channel); + ambient_scale = mix(0.0, ambient_scale, ambient_occlusion_affect_ao_channel); #endif - diffuse_buffer=vec4(emission+diffuse_light+ambient_light,ambient_scale); - specular_buffer=vec4(specular_light,metallic); + diffuse_buffer = vec4(emission + diffuse_light + ambient_light, ambient_scale); + specular_buffer = vec4(specular_light, metallic); #endif //SHADELESS - normal_mr_buffer=vec4(normalize(normal)*0.5+0.5,roughness); + normal_mr_buffer = vec4(normalize(normal) * 0.5 + 0.5, roughness); -#if defined (ENABLE_SSS) +#if defined(ENABLE_SSS) sss_buffer = sss_strength; #endif - #else //USE_MULTIPLE_RENDER_TARGETS - #ifdef SHADELESS - frag_color=vec4(albedo,alpha); + frag_color = vec4(albedo, alpha); #else - frag_color=vec4(emission+ambient_light+diffuse_light+specular_light,alpha); + frag_color = vec4(emission + ambient_light + diffuse_light + specular_light, alpha); #endif //SHADELESS #endif //USE_MULTIPLE_RENDER_TARGETS - - #endif //RENDER_DEPTH - - } diff --git a/drivers/gles3/shaders/screen_space_reflection.glsl b/drivers/gles3/shaders/screen_space_reflection.glsl index b2e6f7a736..73b1ddbb0e 100644 --- a/drivers/gles3/shaders/screen_space_reflection.glsl +++ b/drivers/gles3/shaders/screen_space_reflection.glsl @@ -1,8 +1,7 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; -layout(location=4) in vec2 uv_in; +layout(location = 0) in highp vec4 vertex_attrib; +layout(location = 4) in vec2 uv_in; out vec2 uv_interp; out vec2 pos_interp; @@ -11,12 +10,11 @@ void main() { uv_interp = uv_in; gl_Position = vertex_attrib; - pos_interp.xy=gl_Position.xy; + pos_interp.xy = gl_Position.xy; } [fragment] - in vec2 uv_interp; in vec2 pos_interp; @@ -40,81 +38,67 @@ uniform float depth_tolerance; uniform float distance_fade; uniform float curve_fade_in; - layout(location = 0) out vec4 frag_color; - -vec2 view_to_screen(vec3 view_pos,out float w) { - vec4 projected = projection * vec4(view_pos, 1.0); - projected.xyz /= projected.w; - projected.xy = projected.xy * 0.5 + 0.5; - w=projected.w; - return projected.xy; +vec2 view_to_screen(vec3 view_pos, out float w) { + vec4 projected = projection * vec4(view_pos, 1.0); + projected.xyz /= projected.w; + projected.xy = projected.xy * 0.5 + 0.5; + w = projected.w; + return projected.xy; } - - #define M_PI 3.14159265359 void main() { - - //// - - vec4 diffuse = texture( source_diffuse, uv_interp ); - vec4 normal_roughness = texture( source_normal_roughness, uv_interp); + vec4 diffuse = texture(source_diffuse, uv_interp); + vec4 normal_roughness = texture(source_normal_roughness, uv_interp); vec3 normal; - - normal = normal_roughness.xyz*2.0-1.0; + normal = normal_roughness.xyz * 2.0 - 1.0; float roughness = normal_roughness.w; - float depth_tex = texture(source_depth,uv_interp).r; + float depth_tex = texture(source_depth, uv_interp).r; - vec4 world_pos = inverse_projection * vec4( uv_interp*2.0-1.0, depth_tex*2.0-1.0, 1.0 ); - vec3 vertex = world_pos.xyz/world_pos.w; + vec4 world_pos = inverse_projection * vec4(uv_interp * 2.0 - 1.0, depth_tex * 2.0 - 1.0, 1.0); + vec3 vertex = world_pos.xyz / world_pos.w; vec3 view_dir = normalize(vertex); vec3 ray_dir = normalize(reflect(view_dir, normal)); - if (dot(ray_dir,normal)<0.001) { - frag_color=vec4(0.0); + if (dot(ray_dir, normal) < 0.001) { + frag_color = vec4(0.0); return; } //ray_dir = normalize(view_dir - normal * dot(normal,view_dir) * 2.0); - - //ray_dir = normalize(vec3(1,1,-1)); - + //ray_dir = normalize(vec3(1, 1, -1)); //////////////// - - //make ray length and clip it against the near plane (don't want to trace beyond visible) + // make ray length and clip it against the near plane (don't want to trace beyond visible) float ray_len = (vertex.z + ray_dir.z * camera_z_far) > -camera_z_near ? (-camera_z_near - vertex.z) / ray_dir.z : camera_z_far; - vec3 ray_end = vertex + ray_dir*ray_len; + vec3 ray_end = vertex + ray_dir * ray_len; float w_begin; - vec2 vp_line_begin = view_to_screen(vertex,w_begin); + vec2 vp_line_begin = view_to_screen(vertex, w_begin); float w_end; - vec2 vp_line_end = view_to_screen( ray_end, w_end); - vec2 vp_line_dir = vp_line_end-vp_line_begin; - - //we need to interpolate w along the ray, to generate perspective correct reflections - - w_begin = 1.0/w_begin; - w_end = 1.0/w_end; + vec2 vp_line_end = view_to_screen(ray_end, w_end); + vec2 vp_line_dir = vp_line_end - vp_line_begin; + // we need to interpolate w along the ray, to generate perspective correct reflections + w_begin = 1.0 / w_begin; + w_end = 1.0 / w_end; - float z_begin = vertex.z*w_begin; - float z_end = ray_end.z*w_end; + float z_begin = vertex.z * w_begin; + float z_end = ray_end.z * w_end; - vec2 line_begin = vp_line_begin/pixel_size; - vec2 line_dir = vp_line_dir/pixel_size; + vec2 line_begin = vp_line_begin / pixel_size; + vec2 line_dir = vp_line_dir / pixel_size; float z_dir = z_end - z_begin; float w_dir = w_end - w_begin; - // clip the line to the viewport edges float scale_max_x = min(1.0, 0.99 * (1.0 - vp_line_begin.x) / max(1e-5, vp_line_dir.x)); @@ -124,126 +108,114 @@ void main() { float line_clip = min(scale_max_x, scale_max_y) * min(scale_min_x, scale_min_y); line_dir *= line_clip; z_dir *= line_clip; - w_dir *=line_clip; + w_dir *= line_clip; - //clip z and w advance to line advance - vec2 line_advance = normalize(line_dir); //down to pixel - float step_size = length(line_advance)/length(line_dir); - float z_advance = z_dir*step_size; // adapt z advance to line advance - float w_advance = w_dir*step_size; // adapt w advance to line advance + // clip z and w advance to line advance + vec2 line_advance = normalize(line_dir); // down to pixel + float step_size = length(line_advance) / length(line_dir); + float z_advance = z_dir * step_size; // adapt z advance to line advance + float w_advance = w_dir * step_size; // adapt w advance to line advance - //make line advance faster if direction is closer to pixel edges (this avoids sampling the same pixel twice) - float advance_angle_adj = 1.0/max(abs(line_advance.x),abs(line_advance.y)); - line_advance*=advance_angle_adj; // adapt z advance to line advance - z_advance*=advance_angle_adj; - w_advance*=advance_angle_adj; + // make line advance faster if direction is closer to pixel edges (this avoids sampling the same pixel twice) + float advance_angle_adj = 1.0 / max(abs(line_advance.x), abs(line_advance.y)); + line_advance *= advance_angle_adj; // adapt z advance to line advance + z_advance *= advance_angle_adj; + w_advance *= advance_angle_adj; vec2 pos = line_begin; float z = z_begin; float w = w_begin; - float z_from=z/w; - float z_to=z_from; + float z_from = z / w; + float z_to = z_from; float depth; - vec2 prev_pos=pos; + vec2 prev_pos = pos; - bool found=false; + bool found = false; - float steps_taken=0.0; + float steps_taken = 0.0; - for(int i=0;i<num_steps;i++) { + for (int i = 0; i < num_steps; i++) { - pos+=line_advance; - z+=z_advance; - w+=w_advance; + pos += line_advance; + z += z_advance; + w += w_advance; - //convert to linear depth + // convert to linear depth - depth = texture(source_depth, pos*pixel_size).r * 2.0 - 1.0; + depth = texture(source_depth, pos * pixel_size).r * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + depth = ((depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near)); #endif - depth=-depth; + depth = -depth; z_from = z_to; - z_to = z/w; + z_to = z / w; - if (depth>z_to) { - //if depth was surpassed - if (depth<=max(z_to,z_from)+depth_tolerance) { - //check the depth tolerance - found=true; + if (depth > z_to) { + // if depth was surpassed + if (depth <= max(z_to, z_from) + depth_tolerance) { + // check the depth tolerance + found = true; } break; } - steps_taken+=1.0; - prev_pos=pos; + steps_taken += 1.0; + prev_pos = pos; } - - - if (found) { - float margin_blend=1.0; + float margin_blend = 1.0; - - vec2 margin = vec2((viewport_size.x+viewport_size.y)*0.5*0.05); //make a uniform margin - if (any(bvec4(lessThan(pos,-margin),greaterThan(pos,viewport_size+margin)))) { - //clip outside screen + margin - frag_color=vec4(0.0); + vec2 margin = vec2((viewport_size.x + viewport_size.y) * 0.5 * 0.05); // make a uniform margin + if (any(bvec4(lessThan(pos, -margin), greaterThan(pos, viewport_size + margin)))) { + // clip outside screen + margin + frag_color = vec4(0.0); return; } { //blend fading out towards external margin - vec2 margin_grad = mix(pos-viewport_size,-pos,lessThan(pos,vec2(0.0))); - margin_blend = 1.0-smoothstep(0.0,margin.x,max(margin_grad.x,margin_grad.y)); - //margin_blend=1.0; - + vec2 margin_grad = mix(pos - viewport_size, -pos, lessThan(pos, vec2(0.0))); + margin_blend = 1.0 - smoothstep(0.0, margin.x, max(margin_grad.x, margin_grad.y)); + //margin_blend = 1.0; } vec2 final_pos; float grad; - grad=steps_taken/float(num_steps); - float initial_fade = curve_fade_in==0.0 ? 1.0 : pow(clamp(grad,0.0,1.0),curve_fade_in); - float fade = pow(clamp(1.0-grad,0.0,1.0),distance_fade)*initial_fade; - final_pos=pos; - - - - - - + grad = steps_taken / float(num_steps); + float initial_fade = curve_fade_in == 0.0 ? 1.0 : pow(clamp(grad, 0.0, 1.0), curve_fade_in); + float fade = pow(clamp(1.0 - grad, 0.0, 1.0), distance_fade) * initial_fade; + final_pos = pos; #ifdef REFLECT_ROUGHNESS - vec4 final_color; - //if roughness is enabled, do screen space cone tracing + // if roughness is enabled, do screen space cone tracing if (roughness > 0.001) { /////////////////////////////////////////////////////////////////////////////////////// - //use a blurred version (in consecutive mipmaps) of the screen to simulate roughness + // use a blurred version (in consecutive mipmaps) of the screen to simulate roughness - float gloss = 1.0-roughness; + float gloss = 1.0 - roughness; float cone_angle = roughness * M_PI * 0.5; vec2 cone_dir = final_pos - line_begin; float cone_len = length(cone_dir); - cone_dir = normalize(cone_dir); //will be used normalized from now on + cone_dir = normalize(cone_dir); // will be used normalized from now on float max_mipmap = filter_mipmap_levels - 1.0; - float gloss_mult=gloss; + float gloss_mult = gloss; - float rem_alpha=1.0; + float rem_alpha = 1.0; final_color = vec4(0.0); - for(int i=0;i<7;i++) { + for (int i = 0; i < 7; i++) { - float op_len = 2.0 * tan(cone_angle) * cone_len; //opposite side of iso triangle + float op_len = 2.0 * tan(cone_angle) * cone_len; // opposite side of iso triangle float radius; { - //fit to sphere inside cone (sphere ends at end of cone), something like this: + // fit to sphere inside cone (sphere ends at end of cone), something like this: // ___ // \O/ // V @@ -257,31 +229,31 @@ void main() { radius = (a * (sqrt(a2 + fh2) - a)) / (4.0f * h); } - //find the place where screen must be sampled - vec2 sample_pos = ( line_begin + cone_dir * (cone_len - radius) ) * pixel_size; - //radius is in pixels, so it's natural that log2(radius) maps to the right mipmap for the amount of pixels - float mipmap = clamp( log2( radius ), 0.0, max_mipmap ); + // find the place where screen must be sampled + vec2 sample_pos = (line_begin + cone_dir * (cone_len - radius)) * pixel_size; + // radius is in pixels, so it's natural that log2(radius) maps to the right mipmap for the amount of pixels + float mipmap = clamp(log2(radius), 0.0, max_mipmap); + //mipmap = max(mipmap - 1.0, 0.0); - //mipmap = max(mipmap-1.0,0.0); - //do sampling + // do sampling vec4 sample_color; { - sample_color = textureLod(source_diffuse,sample_pos,mipmap); + sample_color = textureLod(source_diffuse, sample_pos, mipmap); } - //multiply by gloss - sample_color.rgb*=gloss_mult; - sample_color.a=gloss_mult; + // multiply by gloss + sample_color.rgb *= gloss_mult; + sample_color.a = gloss_mult; rem_alpha -= sample_color.a; - if(rem_alpha < 0.0) { + if (rem_alpha < 0.0) { sample_color.rgb *= (1.0 - abs(rem_alpha)); } - final_color+=sample_color; + final_color += sample_color; - if (final_color.a>=0.95) { + if (final_color.a >= 0.95) { // This code of accumulating gloss and aborting on near one // makes sense when you think of cone tracing. // Think of it as if roughness was 0, then we could abort on the first @@ -290,29 +262,21 @@ void main() { break; } - cone_len-=radius*2.0; //go to next (smaller) circle. - - gloss_mult*=gloss; - + cone_len -= radius * 2.0; // go to next (smaller) circle. + gloss_mult *= gloss; } } else { - final_color = textureLod(source_diffuse,final_pos*pixel_size,0.0); + final_color = textureLod(source_diffuse, final_pos * pixel_size, 0.0); } - frag_color = vec4(final_color.rgb,fade*margin_blend); + frag_color = vec4(final_color.rgb, fade * margin_blend); #else - frag_color = vec4(textureLod(source_diffuse,final_pos*pixel_size,0.0).rgb,fade*margin_blend); + frag_color = vec4(textureLod(source_diffuse, final_pos * pixel_size, 0.0).rgb, fade * margin_blend); #endif - - } else { - frag_color = vec4(0.0,0.0,0.0,0.0); + frag_color = vec4(0.0, 0.0, 0.0, 0.0); } - - - } - diff --git a/drivers/gles3/shaders/ssao.glsl b/drivers/gles3/shaders/ssao.glsl index 219f0957e0..2eeeac31c3 100644 --- a/drivers/gles3/shaders/ssao.glsl +++ b/drivers/gles3/shaders/ssao.glsl @@ -1,12 +1,11 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; +layout(location = 0) in highp vec4 vertex_attrib; void main() { gl_Position = vertex_attrib; - gl_Position.z=1.0; + gl_Position.z = 1.0; } [fragment] @@ -14,21 +13,15 @@ void main() { #define TWO_PI 6.283185307179586476925286766559 #ifdef SSAO_QUALITY_HIGH - #define NUM_SAMPLES (80) - #endif #ifdef SSAO_QUALITY_LOW - #define NUM_SAMPLES (15) - #endif #if !defined(SSAO_QUALITY_LOW) && !defined(SSAO_QUALITY_HIGH) - #define NUM_SAMPLES (40) - #endif // If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower @@ -43,19 +36,21 @@ void main() { // This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent // taps from lining up. This particular choice was tuned for NUM_SAMPLES == 9 -const int ROTATIONS[] = int[]( 1, 1, 2, 3, 2, 5, 2, 3, 2, -3, 3, 5, 5, 3, 4, 7, 5, 5, 7, -9, 8, 5, 5, 7, 7, 7, 8, 5, 8, -11, 12, 7, 10, 13, 8, 11, 8, 7, 14, -11, 11, 13, 12, 13, 19, 17, 13, 11, 18, -19, 11, 11, 14, 17, 21, 15, 16, 17, 18, -13, 17, 11, 17, 19, 18, 25, 18, 19, 19, -29, 21, 19, 27, 31, 29, 21, 18, 17, 29, -31, 31, 23, 18, 25, 26, 25, 23, 19, 34, -19, 27, 21, 25, 39, 29, 17, 21, 27 ); +const int ROTATIONS[] = int[]( + 1, 1, 2, 3, 2, 5, 2, 3, 2, + 3, 3, 5, 5, 3, 4, 7, 5, 5, 7, + 9, 8, 5, 5, 7, 7, 7, 8, 5, 8, + 11, 12, 7, 10, 13, 8, 11, 8, 7, 14, + 11, 11, 13, 12, 13, 19, 17, 13, 11, 18, + 19, 11, 11, 14, 17, 21, 15, 16, 17, 18, + 13, 17, 11, 17, 19, 18, 25, 18, 19, 19, + 29, 21, 19, 27, 31, 29, 21, 18, 17, 29, + 31, 31, 23, 18, 25, 26, 25, 23, 19, 34, + 19, 27, 21, 25, 39, 29, 17, 21, 27 +); //#define NUM_SPIRAL_TURNS (7) -const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES-1]; +const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES - 1]; uniform sampler2D source_depth; //texunit:0 uniform highp usampler2D source_depth_mipmaps; //texunit:1 @@ -90,44 +85,41 @@ vec3 reconstructCSPosition(vec2 S, float z) { } vec3 getPosition(ivec2 ssP) { - vec3 P; - P.z = texelFetch(source_depth, ssP, 0).r; + vec3 P; + P.z = texelFetch(source_depth, ssP, 0).r; - P.z = P.z * 2.0 - 1.0; + P.z = P.z * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - P.z = ((P.z + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + P.z = ((P.z + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else - P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near)); + P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near)); #endif - P.z = -P.z; + P.z = -P.z; - // Offset to pixel center - P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z); - return P; + // Offset to pixel center + P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z); + return P; } /** Reconstructs screen-space unit normal from screen-space position */ vec3 reconstructCSFaceNormal(vec3 C) { - return normalize(cross(dFdy(C), dFdx(C))); + return normalize(cross(dFdy(C), dFdx(C))); } - - /** Returns a unit vector and a screen-space radius for the tap on a unit disk (the caller should scale by the actual disk radius) */ -vec2 tapLocation(int sampleNumber, float spinAngle, out float ssR){ - // Radius relative to ssR - float alpha = (float(sampleNumber) + 0.5) * (1.0 / float(NUM_SAMPLES)); - float angle = alpha * (float(NUM_SPIRAL_TURNS) * 6.28) + spinAngle; +vec2 tapLocation(int sampleNumber, float spinAngle, out float ssR) { + // Radius relative to ssR + float alpha = (float(sampleNumber) + 0.5) * (1.0 / float(NUM_SAMPLES)); + float angle = alpha * (float(NUM_SPIRAL_TURNS) * 6.28) + spinAngle; - ssR = alpha; - return vec2(cos(angle), sin(angle)); + ssR = alpha; + return vec2(cos(angle), sin(angle)); } - /** Read the camera-space position of the point at screen-space pixel ssP + unitOffset * ssR. Assumes length(unitOffset) == 1 */ vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) { - // Derivation: - // mipLevel = floor(log(ssR / MAX_OFFSET)); + // Derivation: + // mipLevel = floor(log(ssR / MAX_OFFSET)); int mipLevel = clamp(int(floor(log2(ssR))) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL); ivec2 ssP = ivec2(ssR * unitOffset) + ssC; @@ -138,98 +130,91 @@ vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) { // Manually clamp to the texture size because texelFetch bypasses the texture unit ivec2 mipP = clamp(ssP >> mipLevel, ivec2(0), (screen_size >> mipLevel) - ivec2(1)); - if (mipLevel < 1) { //read from depth buffer P.z = texelFetch(source_depth, mipP, 0).r; P.z = P.z * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - P.z = ((P.z + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + P.z = ((P.z + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near)); - #endif P.z = -P.z; } else { //read from mipmaps - uint d = texelFetch(source_depth_mipmaps, mipP, mipLevel-1).r; - P.z = -(float(d)/65535.0)*camera_z_far; + uint d = texelFetch(source_depth_mipmaps, mipP, mipLevel - 1).r; + P.z = -(float(d) / 65535.0) * camera_z_far; } - // Offset to pixel center P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z); return P; } - - /** Compute the occlusion due to sample with index \a i about the pixel at \a ssC that corresponds - to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius + to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius - Note that units of H() in the HPG12 paper are meters, not - unitless. The whole falloff/sampling function is therefore - unitless. In this implementation, we factor out (9 / radius). + Note that units of H() in the HPG12 paper are meters, not + unitless. The whole falloff/sampling function is therefore + unitless. In this implementation, we factor out (9 / radius). - Four versions of the falloff function are implemented below + Four versions of the falloff function are implemented below */ -float sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius,in float p_radius, in int tapIndex, in float randomPatternRotationAngle) { - // Offset on the unit disk, spun for this pixel - float ssR; - vec2 unitOffset = tapLocation(tapIndex, randomPatternRotationAngle, ssR); - ssR *= ssDiskRadius; +float sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius, in float p_radius, in int tapIndex, in float randomPatternRotationAngle) { + // Offset on the unit disk, spun for this pixel + float ssR; + vec2 unitOffset = tapLocation(tapIndex, randomPatternRotationAngle, ssR); + ssR *= ssDiskRadius; - // The occluding point in camera space - vec3 Q = getOffsetPosition(ssC, unitOffset, ssR); + // The occluding point in camera space + vec3 Q = getOffsetPosition(ssC, unitOffset, ssR); - vec3 v = Q - C; + vec3 v = Q - C; - float vv = dot(v, v); - float vn = dot(v, n_C); + float vv = dot(v, v); + float vn = dot(v, n_C); - const float epsilon = 0.01; - float radius2 = p_radius*p_radius; + const float epsilon = 0.01; + float radius2 = p_radius * p_radius; - // A: From the HPG12 paper - // Note large epsilon to avoid overdarkening within cracks - //return float(vv < radius2) * max((vn - bias) / (epsilon + vv), 0.0) * radius2 * 0.6; + // A: From the HPG12 paper + // Note large epsilon to avoid overdarkening within cracks + //return float(vv < radius2) * max((vn - bias) / (epsilon + vv), 0.0) * radius2 * 0.6; - // B: Smoother transition to zero (lowers contrast, smoothing out corners). [Recommended] - float f=max(radius2 - vv, 0.0); - return f * f * f * max((vn - bias) / (epsilon + vv), 0.0); + // B: Smoother transition to zero (lowers contrast, smoothing out corners). [Recommended] + float f = max(radius2 - vv, 0.0); + return f * f * f * max((vn - bias) / (epsilon + vv), 0.0); - // C: Medium contrast (which looks better at high radii), no division. Note that the - // contribution still falls off with radius^2, but we've adjusted the rate in a way that is - // more computationally efficient and happens to be aesthetically pleasing. - // return 4.0 * max(1.0 - vv * invRadius2, 0.0) * max(vn - bias, 0.0); + // C: Medium contrast (which looks better at high radii), no division. Note that the + // contribution still falls off with radius^2, but we've adjusted the rate in a way that is + // more computationally efficient and happens to be aesthetically pleasing. + // return 4.0 * max(1.0 - vv * invRadius2, 0.0) * max(vn - bias, 0.0); - // D: Low contrast, no division operation - // return 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0); + // D: Low contrast, no division operation + // return 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0); } - - void main() { - - // Pixel being shaded ivec2 ssC = ivec2(gl_FragCoord.xy); // World space point being shaded vec3 C = getPosition(ssC); -/* if (C.z <= -camera_z_far*0.999) { - // We're on the skybox - visibility=1.0; - return; - }*/ + /* + if (C.z <= -camera_z_far * 0.999) { + // We're on the skybox + visibility=1.0; + return; + } + */ - //visibility=-C.z/camera_z_far; + //visibility = -C.z / camera_z_far; //return; #if 0 - vec3 n_C = texelFetch(source_normal,ssC,0).rgb * 2.0 - 1.0; + vec3 n_C = texelFetch(source_normal, ssC, 0).rgb * 2.0 - 1.0; #else vec3 n_C = reconstructCSFaceNormal(C); n_C = -n_C; @@ -251,7 +236,7 @@ void main() { #endif float sum = 0.0; for (int i = 0; i < NUM_SAMPLES; ++i) { - sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius,i, randomPatternRotationAngle); + sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius, i, randomPatternRotationAngle); } float A = max(0.0, 1.0 - sum * intensity_div_r6 * (5.0 / float(NUM_SAMPLES))); @@ -271,10 +256,10 @@ void main() { sum = 0.0; for (int i = 0; i < NUM_SAMPLES; ++i) { - sum += sampleAO(ssC, C, n_C, ssDiskRadius,radius2, i, randomPatternRotationAngle); + sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius2, i, randomPatternRotationAngle); } - A= min(A,max(0.0, 1.0 - sum * intensity_div_r62 * (5.0 / float(NUM_SAMPLES)))); + A = min(A, max(0.0, 1.0 - sum * intensity_div_r62 * (5.0 / float(NUM_SAMPLES)))); #endif // Bilateral box-filter over a quad for free, respecting depth edges // (the difference that this makes is subtle) @@ -286,8 +271,4 @@ void main() { } visibility = A; - } - - - diff --git a/drivers/gles3/shaders/ssao_blur.glsl b/drivers/gles3/shaders/ssao_blur.glsl index 472dc21acf..5526d0de18 100644 --- a/drivers/gles3/shaders/ssao_blur.glsl +++ b/drivers/gles3/shaders/ssao_blur.glsl @@ -1,26 +1,21 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; - +layout(location = 0) in highp vec4 vertex_attrib; void main() { gl_Position = vertex_attrib; - gl_Position.z=1.0; + gl_Position.z = 1.0; } [fragment] - uniform sampler2D source_ssao; //texunit:0 uniform sampler2D source_depth; //texunit:1 uniform sampler2D source_normal; //texunit:3 - layout(location = 0) out float visibility; - ////////////////////////////////////////////////////////////////////////////////////////////// // Tunable Parameters: @@ -28,18 +23,18 @@ layout(location = 0) out float visibility; uniform float edge_sharpness; /** Step in 2-pixel intervals since we already blurred against neighbors in the - first AO pass. This constant can be increased while R decreases to improve - performance at the expense of some dithering artifacts. + first AO pass. This constant can be increased while R decreases to improve + performance at the expense of some dithering artifacts. - Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was - unobjectionable after shading was applied but eliminated most temporal incoherence - from using small numbers of sample taps. - */ + Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was + unobjectionable after shading was applied but eliminated most temporal incoherence + from using small numbers of sample taps. + */ uniform int filter_scale; /** Filter radius in pixels. This will be multiplied by SCALE. */ -#define R (4) +#define R (4) ////////////////////////////////////////////////////////////////////////////////////////////// @@ -47,13 +42,13 @@ uniform int filter_scale; // Gaussian coefficients const float gaussian[R + 1] = -// float[](0.356642, 0.239400, 0.072410, 0.009869); -// float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134); // stddev = 1.0 - float[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970); // stddev = 2.0 -// float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0 +// float[](0.356642, 0.239400, 0.072410, 0.009869); +// float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134); // stddev = 1.0 + float[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970); // stddev = 2.0 +// float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0 -/** (1, 0) or (0, 1)*/ -uniform ivec2 axis; +/** (1, 0) or (0, 1) */ +uniform ivec2 axis; uniform float camera_z_far; uniform float camera_z_near; @@ -65,18 +60,18 @@ void main() { ivec2 ssC = ivec2(gl_FragCoord.xy); float depth = texelFetch(source_depth, ssC, 0).r; - //vec3 normal = texelFetch(source_normal,ssC,0).rgb * 2.0 - 1.0; + //vec3 normal = texelFetch(source_normal, ssC, 0).rgb * 2.0 - 1.0; depth = depth * 2.0 - 1.0; depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near)); float depth_divide = 1.0 / camera_z_far; -// depth*=depth_divide; + //depth *= depth_divide; /* - if (depth > camera_z_far*0.999) { - discard;//skybox + if (depth > camera_z_far * 0.999) { + discard; //skybox } */ @@ -96,23 +91,21 @@ void main() { if (r != 0) { ivec2 ppos = ssC + axis * (r * filter_scale); - float value = texelFetch(source_ssao, clamp(ppos,ivec2(0),clamp_limit), 0).r; - ivec2 rpos = clamp(ppos,ivec2(0),clamp_limit); + float value = texelFetch(source_ssao, clamp(ppos, ivec2(0), clamp_limit), 0).r; + ivec2 rpos = clamp(ppos, ivec2(0), clamp_limit); float temp_depth = texelFetch(source_depth, rpos, 0).r; //vec3 temp_normal = texelFetch(source_normal, rpos, 0).rgb * 2.0 - 1.0; temp_depth = temp_depth * 2.0 - 1.0; temp_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - temp_depth * (camera_z_far - camera_z_near)); -// temp_depth *= depth_divide; + //temp_depth *= depth_divide; // spatial domain: offset gaussian tap float weight = 0.3 + gaussian[abs(r)]; - //weight *= max(0.0,dot(temp_normal,normal)); + //weight *= max(0.0, dot(temp_normal, normal)); // range domain (the "bilateral" weight). As depth difference increases, decrease weight. - weight *= max(0.0, 1.0 - - edge_sharpness * abs(temp_depth - depth) - ); + weight *= max(0.0, 1.0 - edge_sharpness * abs(temp_depth - depth)); sum += value * weight; totalWeight += weight; diff --git a/drivers/gles3/shaders/ssao_minify.glsl b/drivers/gles3/shaders/ssao_minify.glsl index 647c762438..777a0069fc 100644 --- a/drivers/gles3/shaders/ssao_minify.glsl +++ b/drivers/gles3/shaders/ssao_minify.glsl @@ -1,7 +1,6 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; +layout(location = 0) in highp vec4 vertex_attrib; void main() { @@ -10,7 +9,6 @@ void main() { [fragment] - #ifdef MINIFY_START #define SDEPTH_TYPE highp sampler2D @@ -32,28 +30,23 @@ layout(location = 0) out mediump uint depth; void main() { - ivec2 ssP = ivec2(gl_FragCoord.xy); - // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling. - // On DX9, the bit-and can be implemented with floating-point modulo + // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling. + // On DX9, the bit-and can be implemented with floating-point modulo #ifdef MINIFY_START float fdepth = texelFetch(source_depth, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), from_size - ivec2(1)), source_mipmap).r; fdepth = fdepth * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - fdepth = ((fdepth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + fdepth = ((fdepth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else fdepth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - fdepth * (camera_z_far - camera_z_near)); #endif fdepth /= camera_z_far; - depth = uint(clamp(fdepth*65535.0,0.0,65535.0)); + depth = uint(clamp(fdepth * 65535.0, 0.0, 65535.0)); #else depth = texelFetch(source_depth, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), from_size - ivec2(1)), source_mipmap).r; #endif - - } - - diff --git a/drivers/gles3/shaders/subsurf_scattering.glsl b/drivers/gles3/shaders/subsurf_scattering.glsl index fc66d66198..af0d5a0e62 100644 --- a/drivers/gles3/shaders/subsurf_scattering.glsl +++ b/drivers/gles3/shaders/subsurf_scattering.glsl @@ -1,12 +1,10 @@ [vertex] - -layout(location=0) in highp vec4 vertex_attrib; -layout(location=4) in vec2 uv_in; +layout(location = 0) in highp vec4 vertex_attrib; +layout(location = 4) in vec2 uv_in; out vec2 uv_interp; - void main() { uv_interp = uv_in; @@ -19,87 +17,77 @@ void main() { #define QUALIFIER const #ifdef USE_25_SAMPLES - -const int kernel_size=25; +const int kernel_size = 25; QUALIFIER vec2 kernel[25] = vec2[] ( - vec2(0.530605, 0.0), - vec2(0.000973794, -3.0), - vec2(0.00333804, -2.52083), - vec2(0.00500364, -2.08333), - vec2(0.00700976, -1.6875), - vec2(0.0094389, -1.33333), - vec2(0.0128496, -1.02083), - vec2(0.017924, -0.75), - vec2(0.0263642, -0.520833), - vec2(0.0410172, -0.333333), - vec2(0.0493588, -0.1875), - vec2(0.0402784, -0.0833333), - vec2(0.0211412, -0.0208333), - vec2(0.0211412, 0.0208333), - vec2(0.0402784, 0.0833333), - vec2(0.0493588, 0.1875), - vec2(0.0410172, 0.333333), - vec2(0.0263642, 0.520833), - vec2(0.017924, 0.75), - vec2(0.0128496, 1.02083), - vec2(0.0094389, 1.33333), - vec2(0.00700976, 1.6875), - vec2(0.00500364, 2.08333), - vec2(0.00333804, 2.52083), - vec2(0.000973794, 3.0) + vec2(0.530605, 0.0), + vec2(0.000973794, -3.0), + vec2(0.00333804, -2.52083), + vec2(0.00500364, -2.08333), + vec2(0.00700976, -1.6875), + vec2(0.0094389, -1.33333), + vec2(0.0128496, -1.02083), + vec2(0.017924, -0.75), + vec2(0.0263642, -0.520833), + vec2(0.0410172, -0.333333), + vec2(0.0493588, -0.1875), + vec2(0.0402784, -0.0833333), + vec2(0.0211412, -0.0208333), + vec2(0.0211412, 0.0208333), + vec2(0.0402784, 0.0833333), + vec2(0.0493588, 0.1875), + vec2(0.0410172, 0.333333), + vec2(0.0263642, 0.520833), + vec2(0.017924, 0.75), + vec2(0.0128496, 1.02083), + vec2(0.0094389, 1.33333), + vec2(0.00700976, 1.6875), + vec2(0.00500364, 2.08333), + vec2(0.00333804, 2.52083), + vec2(0.000973794, 3.0) ); - #endif //USE_25_SAMPLES #ifdef USE_17_SAMPLES - -const int kernel_size=17; - +const int kernel_size = 17; QUALIFIER vec2 kernel[17] = vec2[]( - vec2(0.536343, 0.0), - vec2(0.00317394, -2.0), - vec2(0.0100386, -1.53125), - vec2(0.0144609, -1.125), - vec2(0.0216301, -0.78125), - vec2(0.0347317, -0.5), - vec2(0.0571056, -0.28125), - vec2(0.0582416, -0.125), - vec2(0.0324462, -0.03125), - vec2(0.0324462, 0.03125), - vec2(0.0582416, 0.125), - vec2(0.0571056, 0.28125), - vec2(0.0347317, 0.5), - vec2(0.0216301, 0.78125), - vec2(0.0144609, 1.125), - vec2(0.0100386, 1.53125), - vec2(0.00317394,2.0) + vec2(0.536343, 0.0), + vec2(0.00317394, -2.0), + vec2(0.0100386, -1.53125), + vec2(0.0144609, -1.125), + vec2(0.0216301, -0.78125), + vec2(0.0347317, -0.5), + vec2(0.0571056, -0.28125), + vec2(0.0582416, -0.125), + vec2(0.0324462, -0.03125), + vec2(0.0324462, 0.03125), + vec2(0.0582416, 0.125), + vec2(0.0571056, 0.28125), + vec2(0.0347317, 0.5), + vec2(0.0216301, 0.78125), + vec2(0.0144609, 1.125), + vec2(0.0100386, 1.53125), + vec2(0.00317394, 2.0) ); - #endif //USE_17_SAMPLES #ifdef USE_11_SAMPLES - -const int kernel_size=11; - +const int kernel_size = 11; QUALIFIER vec2 kernel[11] = vec2[]( - vec2(0.560479, 0.0), - vec2(0.00471691, -2.0), - vec2(0.0192831, -1.28), - vec2(0.03639, -0.72), - vec2(0.0821904, -0.32), - vec2(0.0771802, -0.08), - vec2(0.0771802, 0.08), - vec2(0.0821904, 0.32), - vec2(0.03639, 0.72), - vec2(0.0192831, 1.28), - vec2(0.00471691,2.0) + vec2(0.560479, 0.0), + vec2(0.00471691, -2.0), + vec2(0.0192831, -1.28), + vec2(0.03639, -0.72), + vec2(0.0821904, -0.32), + vec2(0.0771802, -0.08), + vec2(0.0771802, 0.08), + vec2(0.0821904, 0.32), + vec2(0.03639, 0.72), + vec2(0.0192831, 1.28), + vec2(0.00471691, 2.0) ); - #endif //USE_11_SAMPLES - - uniform float max_radius; uniform float camera_z_far; uniform float camera_z_near; @@ -115,28 +103,24 @@ layout(location = 0) out vec4 frag_color; void main() { - float strength = texture(source_sss,uv_interp).r; - strength*=strength; //stored as sqrt + float strength = texture(source_sss, uv_interp).r; + strength *= strength; //stored as sqrt // Fetch color of current pixel: vec4 base_color = texture(source_diffuse, uv_interp); - - if (strength>0.0) { - + if (strength > 0.0) { // Fetch linear depth of current pixel: float depth = texture(source_depth, uv_interp).r * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + depth = ((depth + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; float scale = unit_size; //remember depth is negative by default in OpenGL #else depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near)); float scale = unit_size / depth; //remember depth is negative by default in OpenGL #endif - - // Calculate the final step to fetch the surrounding pixels: vec2 step = max_radius * scale * dir; step *= strength; // Modulate it using the alpha channel. @@ -157,35 +141,33 @@ void main() { #ifdef ENABLE_FOLLOW_SURFACE // If the difference in depth is huge, we lerp color back to "colorM": - float depth_cmp = texture(source_depth, offset).r *2.0 - 1.0; + float depth_cmp = texture(source_depth, offset).r * 2.0 - 1.0; #ifdef USE_ORTHOGONAL_PROJECTION - depth_cmp = ((depth_cmp + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0; + depth_cmp = ((depth_cmp + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0; #else depth_cmp = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth_cmp * (camera_z_far - camera_z_near)); #endif - float s = clamp(300.0f * scale * - max_radius * abs(depth - depth_cmp),0.0,1.0); + float s = clamp(300.0f * scale * max_radius * abs(depth - depth_cmp), 0.0, 1.0); color = mix(color, base_color.rgb, s); #endif // Accumulate: - color*=kernel[i].x; + color *= kernel[i].x; #ifdef ENABLE_STRENGTH_WEIGHTING float color_s = texture(source_sss, offset).r; - color_weight+=color_s * kernel[i].x; - color*=color_s; + color_weight += color_s * kernel[i].x; + color *= color_s; #endif color_accum += color; - } #ifdef ENABLE_STRENGTH_WEIGHTING - color_accum/=color_weight; + color_accum /= color_weight; #endif - frag_color = vec4(color_accum,base_color.a); //keep alpha (used for SSAO) + frag_color = vec4(color_accum, base_color.a); //keep alpha (used for SSAO) } else { frag_color = base_color; } diff --git a/drivers/gles3/shaders/tonemap.glsl b/drivers/gles3/shaders/tonemap.glsl index 63475c9039..56876bdb72 100644 --- a/drivers/gles3/shaders/tonemap.glsl +++ b/drivers/gles3/shaders/tonemap.glsl @@ -1,25 +1,24 @@ [vertex] -layout (location = 0) in highp vec4 vertex_attrib; -layout (location = 4) in vec2 uv_in; +layout(location = 0) in highp vec4 vertex_attrib; +layout(location = 4) in vec2 uv_in; out vec2 uv_interp; -void main() -{ +void main() { gl_Position = vertex_attrib; uv_interp = uv_in; - #ifdef V_FLIP - uv_interp.y = 1.0f - uv_interp.y; - #endif +#ifdef V_FLIP + uv_interp.y = 1.0f - uv_interp.y; +#endif } [fragment] #if !defined(GLES_OVER_GL) - precision mediump float; +precision mediump float; #endif in vec2 uv_interp; @@ -30,109 +29,99 @@ uniform float exposure; uniform float white; #ifdef USE_AUTO_EXPOSURE - uniform highp sampler2D source_auto_exposure; //texunit:1 - uniform highp float auto_exposure_grey; +uniform highp sampler2D source_auto_exposure; //texunit:1 +uniform highp float auto_exposure_grey; #endif #if defined(USE_GLOW_LEVEL1) || defined(USE_GLOW_LEVEL2) || defined(USE_GLOW_LEVEL3) || defined(USE_GLOW_LEVEL4) || defined(USE_GLOW_LEVEL5) || defined(USE_GLOW_LEVEL6) || defined(USE_GLOW_LEVEL7) - #define USING_GLOW // only use glow when at least one glow level is selected +#define USING_GLOW // only use glow when at least one glow level is selected - uniform highp sampler2D source_glow; //texunit:2 - uniform highp float glow_intensity; +uniform highp sampler2D source_glow; //texunit:2 +uniform highp float glow_intensity; #endif #ifdef USE_BCS - uniform vec3 bcs; +uniform vec3 bcs; #endif #ifdef USE_COLOR_CORRECTION - uniform sampler2D color_correction; //texunit:3 +uniform sampler2D color_correction; //texunit:3 #endif -layout (location = 0) out vec4 frag_color; +layout(location = 0) out vec4 frag_color; #ifdef USE_GLOW_FILTER_BICUBIC - // w0, w1, w2, and w3 are the four cubic B-spline basis functions - float w0(float a) - { - return (1.0f / 6.0f) * (a * (a * (-a + 3.0f) - 3.0f) + 1.0f); - } - - float w1(float a) - { - return (1.0f / 6.0f) * (a * a * (3.0f * a - 6.0f) + 4.0f); - } - - float w2(float a) - { - return (1.0f / 6.0f) * (a * (a * (-3.0f * a + 3.0f) + 3.0f) + 1.0f); - } - - float w3(float a) - { - return (1.0f / 6.0f) * (a * a * a); - } - - // g0 and g1 are the two amplitude functions - float g0(float a) - { - return w0(a) + w1(a); - } - - float g1(float a) - { - return w2(a) + w3(a); - } - - // h0 and h1 are the two offset functions - float h0(float a) - { - return -1.0f + w1(a) / (w0(a) + w1(a)); - } - - float h1(float a) - { - return 1.0f + w3(a) / (w2(a) + w3(a)); - } - - uniform ivec2 glow_texture_size; - - vec4 texture2D_bicubic(sampler2D tex, vec2 uv, int p_lod) - { - float lod = float(p_lod); - vec2 tex_size = vec2(glow_texture_size >> p_lod); - vec2 pixel_size = vec2(1.0f) / tex_size; - - uv = uv * tex_size + vec2(0.5f); - - vec2 iuv = floor(uv); - vec2 fuv = fract(uv); - - float g0x = g0(fuv.x); - float g1x = g1(fuv.x); - float h0x = h0(fuv.x); - float h1x = h1(fuv.x); - float h0y = h0(fuv.y); - float h1y = h1(fuv.y); - - vec2 p0 = (vec2(iuv.x + h0x, iuv.y + h0y) - vec2(0.5f)) * pixel_size; - vec2 p1 = (vec2(iuv.x + h1x, iuv.y + h0y) - vec2(0.5f)) * pixel_size; - vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - vec2(0.5f)) * pixel_size; - vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - vec2(0.5f)) * pixel_size; - - return g0(fuv.y) * (g0x * textureLod(tex, p0,lod) + - g1x * textureLod(tex, p1,lod)) + - g1(fuv.y) * (g0x * textureLod(tex, p2,lod) + - g1x * textureLod(tex, p3,lod)); - } - - #define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2D_bicubic(m_tex, m_uv, m_lod) +// w0, w1, w2, and w3 are the four cubic B-spline basis functions +float w0(float a) { + return (1.0f / 6.0f) * (a * (a * (-a + 3.0f) - 3.0f) + 1.0f); +} + +float w1(float a) { + return (1.0f / 6.0f) * (a * a * (3.0f * a - 6.0f) + 4.0f); +} + +float w2(float a) { + return (1.0f / 6.0f) * (a * (a * (-3.0f * a + 3.0f) + 3.0f) + 1.0f); +} + +float w3(float a) { + return (1.0f / 6.0f) * (a * a * a); +} + +// g0 and g1 are the two amplitude functions +float g0(float a) { + return w0(a) + w1(a); +} + +float g1(float a) { + return w2(a) + w3(a); +} + +// h0 and h1 are the two offset functions +float h0(float a) { + return -1.0f + w1(a) / (w0(a) + w1(a)); +} + +float h1(float a) { + return 1.0f + w3(a) / (w2(a) + w3(a)); +} + +uniform ivec2 glow_texture_size; + +vec4 texture2D_bicubic(sampler2D tex, vec2 uv, int p_lod) { + float lod = float(p_lod); + vec2 tex_size = vec2(glow_texture_size >> p_lod); + vec2 pixel_size = vec2(1.0f) / tex_size; + + uv = uv * tex_size + vec2(0.5f); + + vec2 iuv = floor(uv); + vec2 fuv = fract(uv); + + float g0x = g0(fuv.x); + float g1x = g1(fuv.x); + float h0x = h0(fuv.x); + float h1x = h1(fuv.x); + float h0y = h0(fuv.y); + float h1y = h1(fuv.y); + + vec2 p0 = (vec2(iuv.x + h0x, iuv.y + h0y) - vec2(0.5f)) * pixel_size; + vec2 p1 = (vec2(iuv.x + h1x, iuv.y + h0y) - vec2(0.5f)) * pixel_size; + vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - vec2(0.5f)) * pixel_size; + vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - vec2(0.5f)) * pixel_size; + + return g0(fuv.y) * (g0x * textureLod(tex, p0, lod) + + g1x * textureLod(tex, p1, lod)) + + g1(fuv.y) * (g0x * textureLod(tex, p2, lod) + + g1x * textureLod(tex, p3, lod)); +} + +#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2D_bicubic(m_tex, m_uv, m_lod) #else - #define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) textureLod(m_tex, m_uv, float(m_lod)) +#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) textureLod(m_tex, m_uv, float(m_lod)) #endif -vec3 tonemap_filmic(vec3 color, float white) -{ +vec3 tonemap_filmic(vec3 color, float white) { const float A = 0.15f; const float B = 0.50f; const float C = 0.10f; @@ -147,8 +136,7 @@ vec3 tonemap_filmic(vec3 color, float white) return clamp(color_tonemapped / white_tonemapped, vec3(0.0f), vec3(1.0f)); } -vec3 tonemap_aces(vec3 color, float white) -{ +vec3 tonemap_aces(vec3 color, float white) { const float A = 2.51f; const float B = 0.03f; const float C = 2.43f; @@ -161,96 +149,90 @@ vec3 tonemap_aces(vec3 color, float white) return clamp(color_tonemapped / white_tonemapped, vec3(0.0f), vec3(1.0f)); } -vec3 tonemap_reindhart(vec3 color, float white) -{ +vec3 tonemap_reindhart(vec3 color, float white) { return clamp((color) / (1.0f + color) * (1.0f + (color / (white))), vec3(0.0f), vec3(1.0f)); // whitepoint is probably not in linear space here! } -vec3 linear_to_srgb(vec3 color) // convert linear rgb to srgb, assumes clamped input in range [0;1] -{ +vec3 linear_to_srgb(vec3 color) { // convert linear rgb to srgb, assumes clamped input in range [0;1] const vec3 a = vec3(0.055f); return mix((vec3(1.0f) + a) * pow(color.rgb, vec3(1.0f / 2.4f)) - a, 12.92f * color.rgb, lessThan(color.rgb, vec3(0.0031308f))); } -vec3 apply_tonemapping(vec3 color, float white) // inputs are LINEAR, always outputs clamped [0;1] color -{ - #ifdef USE_REINDHART_TONEMAPPER - return tonemap_reindhart(color, white); - #endif +vec3 apply_tonemapping(vec3 color, float white) { // inputs are LINEAR, always outputs clamped [0;1] color +#ifdef USE_REINDHART_TONEMAPPER + return tonemap_reindhart(color, white); +#endif - #ifdef USE_FILMIC_TONEMAPPER - return tonemap_filmic(color, white); - #endif +#ifdef USE_FILMIC_TONEMAPPER + return tonemap_filmic(color, white); +#endif - #ifdef USE_ACES_TONEMAPPER - return tonemap_aces(color, white); - #endif +#ifdef USE_ACES_TONEMAPPER + return tonemap_aces(color, white); +#endif return clamp(color, vec3(0.0f), vec3(1.0f)); // no other seleced -> linear } -vec3 gather_glow(sampler2D tex, vec2 uv) // sample all selected glow levels -{ +vec3 gather_glow(sampler2D tex, vec2 uv) { // sample all selected glow levels vec3 glow = vec3(0.0f); - #ifdef USE_GLOW_LEVEL1 - glow += GLOW_TEXTURE_SAMPLE(tex, uv, 1).rgb; - #endif +#ifdef USE_GLOW_LEVEL1 + glow += GLOW_TEXTURE_SAMPLE(tex, uv, 1).rgb; +#endif - #ifdef USE_GLOW_LEVEL2 - glow += GLOW_TEXTURE_SAMPLE(tex, uv, 2).rgb; - #endif +#ifdef USE_GLOW_LEVEL2 + glow += GLOW_TEXTURE_SAMPLE(tex, uv, 2).rgb; +#endif - #ifdef USE_GLOW_LEVEL3 - glow += GLOW_TEXTURE_SAMPLE(tex, uv, 3).rgb; - #endif +#ifdef USE_GLOW_LEVEL3 + glow += GLOW_TEXTURE_SAMPLE(tex, uv, 3).rgb; +#endif - #ifdef USE_GLOW_LEVEL4 - glow += GLOW_TEXTURE_SAMPLE(tex, uv, 4).rgb; - #endif +#ifdef USE_GLOW_LEVEL4 + glow += GLOW_TEXTURE_SAMPLE(tex, uv, 4).rgb; +#endif - #ifdef USE_GLOW_LEVEL5 - glow += GLOW_TEXTURE_SAMPLE(tex, uv, 5).rgb; - #endif +#ifdef USE_GLOW_LEVEL5 + glow += GLOW_TEXTURE_SAMPLE(tex, uv, 5).rgb; +#endif - #ifdef USE_GLOW_LEVEL6 - glow += GLOW_TEXTURE_SAMPLE(tex, uv, 6).rgb; - #endif +#ifdef USE_GLOW_LEVEL6 + glow += GLOW_TEXTURE_SAMPLE(tex, uv, 6).rgb; +#endif - #ifdef USE_GLOW_LEVEL7 - glow += GLOW_TEXTURE_SAMPLE(tex, uv, 7).rgb; - #endif +#ifdef USE_GLOW_LEVEL7 + glow += GLOW_TEXTURE_SAMPLE(tex, uv, 7).rgb; +#endif return glow; } -vec3 apply_glow(vec3 color, vec3 glow) // apply glow using the selected blending mode -{ - #ifdef USE_GLOW_REPLACE - color = glow; - #endif +vec3 apply_glow(vec3 color, vec3 glow) { // apply glow using the selected blending mode +#ifdef USE_GLOW_REPLACE + color = glow; +#endif - #ifdef USE_GLOW_SCREEN - color = max((color + glow) - (color * glow), vec3(0.0)); - #endif +#ifdef USE_GLOW_SCREEN + color = max((color + glow) - (color * glow), vec3(0.0)); +#endif - #ifdef USE_GLOW_SOFTLIGHT - glow = glow * vec3(0.5f) + vec3(0.5f); +#ifdef USE_GLOW_SOFTLIGHT + glow = glow * vec3(0.5f) + vec3(0.5f); - color.r = (glow.r <= 0.5f) ? (color.r - (1.0f - 2.0f * glow.r) * color.r * (1.0f - color.r)) : (((glow.r > 0.5f) && (color.r <= 0.25f)) ? (color.r + (2.0f * glow.r - 1.0f) * (4.0f * color.r * (4.0f * color.r + 1.0f) * (color.r - 1.0f) + 7.0f * color.r)) : (color.r + (2.0f * glow.r - 1.0f) * (sqrt(color.r) - color.r))); - color.g = (glow.g <= 0.5f) ? (color.g - (1.0f - 2.0f * glow.g) * color.g * (1.0f - color.g)) : (((glow.g > 0.5f) && (color.g <= 0.25f)) ? (color.g + (2.0f * glow.g - 1.0f) * (4.0f * color.g * (4.0f * color.g + 1.0f) * (color.g - 1.0f) + 7.0f * color.g)) : (color.g + (2.0f * glow.g - 1.0f) * (sqrt(color.g) - color.g))); - color.b = (glow.b <= 0.5f) ? (color.b - (1.0f - 2.0f * glow.b) * color.b * (1.0f - color.b)) : (((glow.b > 0.5f) && (color.b <= 0.25f)) ? (color.b + (2.0f * glow.b - 1.0f) * (4.0f * color.b * (4.0f * color.b + 1.0f) * (color.b - 1.0f) + 7.0f * color.b)) : (color.b + (2.0f * glow.b - 1.0f) * (sqrt(color.b) - color.b))); - #endif + color.r = (glow.r <= 0.5f) ? (color.r - (1.0f - 2.0f * glow.r) * color.r * (1.0f - color.r)) : (((glow.r > 0.5f) && (color.r <= 0.25f)) ? (color.r + (2.0f * glow.r - 1.0f) * (4.0f * color.r * (4.0f * color.r + 1.0f) * (color.r - 1.0f) + 7.0f * color.r)) : (color.r + (2.0f * glow.r - 1.0f) * (sqrt(color.r) - color.r))); + color.g = (glow.g <= 0.5f) ? (color.g - (1.0f - 2.0f * glow.g) * color.g * (1.0f - color.g)) : (((glow.g > 0.5f) && (color.g <= 0.25f)) ? (color.g + (2.0f * glow.g - 1.0f) * (4.0f * color.g * (4.0f * color.g + 1.0f) * (color.g - 1.0f) + 7.0f * color.g)) : (color.g + (2.0f * glow.g - 1.0f) * (sqrt(color.g) - color.g))); + color.b = (glow.b <= 0.5f) ? (color.b - (1.0f - 2.0f * glow.b) * color.b * (1.0f - color.b)) : (((glow.b > 0.5f) && (color.b <= 0.25f)) ? (color.b + (2.0f * glow.b - 1.0f) * (4.0f * color.b * (4.0f * color.b + 1.0f) * (color.b - 1.0f) + 7.0f * color.b)) : (color.b + (2.0f * glow.b - 1.0f) * (sqrt(color.b) - color.b))); +#endif - #if !defined(USE_GLOW_SCREEN) && !defined(USE_GLOW_SOFTLIGHT) && !defined(USE_GLOW_REPLACE) // no other selected -> additive - color += glow; - #endif +#if !defined(USE_GLOW_SCREEN) && !defined(USE_GLOW_SOFTLIGHT) && !defined(USE_GLOW_REPLACE) // no other selected -> additive + color += glow; +#endif return color; } -vec3 apply_bcs(vec3 color, vec3 bcs) -{ +vec3 apply_bcs(vec3 color, vec3 bcs) { color = mix(vec3(0.0f), color, bcs.x); color = mix(vec3(0.5f), color, bcs.y); color = mix(vec3(dot(vec3(1.0f), color) * 0.33333f), color, bcs.z); @@ -258,8 +240,7 @@ vec3 apply_bcs(vec3 color, vec3 bcs) return color; } -vec3 apply_color_correction(vec3 color, sampler2D correction_tex) -{ +vec3 apply_color_correction(vec3 color, sampler2D correction_tex) { color.r = texture(correction_tex, vec2(color.r, 0.0f)).r; color.g = texture(correction_tex, vec2(color.g, 0.0f)).g; color.b = texture(correction_tex, vec2(color.b, 0.0f)).b; @@ -267,15 +248,14 @@ vec3 apply_color_correction(vec3 color, sampler2D correction_tex) return color; } -void main() -{ +void main() { vec3 color = textureLod(source, uv_interp, 0.0f).rgb; // Exposure - #ifdef USE_AUTO_EXPOSURE - color /= texelFetch(source_auto_exposure, ivec2(0, 0), 0).r / auto_exposure_grey; - #endif +#ifdef USE_AUTO_EXPOSURE + color /= texelFetch(source_auto_exposure, ivec2(0, 0), 0).r / auto_exposure_grey; +#endif color *= exposure; @@ -283,33 +263,33 @@ void main() color = apply_tonemapping(color, white); - #ifdef KEEP_3D_LINEAR - // leave color as is (-> don't convert to SRGB) - #else - color = linear_to_srgb(color); // regular linear -> SRGB conversion - #endif +#ifdef KEEP_3D_LINEAR + // leave color as is (-> don't convert to SRGB) +#else + color = linear_to_srgb(color); // regular linear -> SRGB conversion +#endif // Glow - #ifdef USING_GLOW - vec3 glow = gather_glow(source_glow, uv_interp) * glow_intensity; +#ifdef USING_GLOW + vec3 glow = gather_glow(source_glow, uv_interp) * glow_intensity; - // high dynamic range -> SRGB - glow = apply_tonemapping(glow, white); - glow = linear_to_srgb(glow); + // high dynamic range -> SRGB + glow = apply_tonemapping(glow, white); + glow = linear_to_srgb(glow); - color = apply_glow(color, glow); - #endif + color = apply_glow(color, glow); +#endif // Additional effects - #ifdef USE_BCS - color = apply_bcs(color, bcs); - #endif +#ifdef USE_BCS + color = apply_bcs(color, bcs); +#endif - #ifdef USE_COLOR_CORRECTION - color = apply_color_correction(color, color_correction); - #endif +#ifdef USE_COLOR_CORRECTION + color = apply_color_correction(color, color_correction); +#endif frag_color = vec4(color, 1.0f); } diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index 3f512af8d5..b08688892e 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -271,7 +271,6 @@ static void _write_png_data(png_structp png_ptr, png_bytep data, png_size_t p_le v.resize(vs + p_length); PoolVector<uint8_t>::Write w = v.write(); copymem(&w[vs], data, p_length); - //print_line("png write: "+itos(p_length)); } static PoolVector<uint8_t> _lossless_pack_png(const Ref<Image> &p_image) { diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index d1104eec18..744b3a35e6 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -183,10 +183,8 @@ Error AudioDriverPulseAudio::init_device() { buffer_frames = closest_power_of_2(latency * mix_rate / 1000); pa_buffer_size = buffer_frames * pa_map.channels; - if (OS::get_singleton()->is_stdout_verbose()) { - print_line("PulseAudio: detected " + itos(pa_map.channels) + " channels"); - print_line("PulseAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); - } + print_verbose("PulseAudio: detected " + itos(pa_map.channels) + " channels"); + print_verbose("PulseAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); pa_sample_spec spec; spec.format = PA_SAMPLE_S16LE; @@ -614,9 +612,7 @@ Error AudioDriverPulseAudio::capture_init_device() { break; } - if (OS::get_singleton()->is_stdout_verbose()) { - print_line("PulseAudio: detected " + itos(pa_rec_map.channels) + " input channels"); - } + print_verbose("PulseAudio: detected " + itos(pa_rec_map.channels) + " input channels"); pa_sample_spec spec; diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp index 365788e192..69830b542b 100644 --- a/drivers/rtaudio/audio_driver_rtaudio.cpp +++ b/drivers/rtaudio/audio_driver_rtaudio.cpp @@ -112,10 +112,7 @@ Error AudioDriverRtAudio::init() { int latency = GLOBAL_DEF("audio/output_latency", DEFAULT_OUTPUT_LATENCY); unsigned int buffer_frames = closest_power_of_2(latency * mix_rate / 1000); - - if (OS::get_singleton()->is_stdout_verbose()) { - print_line("audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); - } + print_verbose("Audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); short int tries = 2; diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp index c25d34125d..ca16c6fcae 100644 --- a/drivers/unix/file_access_unix.cpp +++ b/drivers/unix/file_access_unix.cpp @@ -106,7 +106,6 @@ Error FileAccessUnix::_open(const String &p_path, int p_mode_flags) { if (is_backup_save_enabled() && (p_mode_flags & WRITE) && !(p_mode_flags & READ)) { save_path = path; path = path + ".tmp"; - //print_line("saving instead to "+path); } f = fopen(path.utf8().get_data(), mode_string); @@ -134,9 +133,6 @@ void FileAccessUnix::close() { } if (save_path != "") { - - //unlink(save_path.utf8().get_data()); - //print_line("renaming..."); int rename_error = rename((save_path + ".tmp").utf8().get_data(), save_path.utf8().get_data()); if (rename_error && close_fail_notify) { @@ -291,8 +287,7 @@ uint64_t FileAccessUnix::_get_modified_time(const String &p_file) { if (!err) { return flags.st_mtime; } else { - print_line("ERROR IN: " + p_file); - + ERR_EXPLAIN("Failed to get modified time for: " + p_file); ERR_FAIL_V(0); }; } diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp index 2dcb4ff3d8..11abe3256e 100644 --- a/drivers/wasapi/audio_driver_wasapi.cpp +++ b/drivers/wasapi/audio_driver_wasapi.cpp @@ -321,10 +321,8 @@ Error AudioDriverWASAPI::init_render_device(bool reinit) { input_position = 0; input_size = 0; - if (OS::get_singleton()->is_stdout_verbose()) { - print_line("WASAPI: detected " + itos(channels) + " channels"); - print_line("WASAPI: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); - } + print_verbose("WASAPI: detected " + itos(channels) + " channels"); + print_verbose("WASAPI: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); return OK; } diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index ea194e5eae..b4492a2022 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -31,11 +31,13 @@ #ifdef WINDOWS_ENABLED #include "file_access_windows.h" -#include "os/os.h" -#include "shlwapi.h" + +#include "core/os/os.h" +#include "core/print_string.h" + +#include <shlwapi.h> #include <windows.h> -#include "print_string.h" #include <sys/stat.h> #include <sys/types.h> #include <tchar.h> @@ -133,11 +135,6 @@ void FileAccessWindows::close() { if (save_path != "") { - //unlink(save_path.utf8().get_data()); - //print_line("renaming..."); - //_wunlink(save_path.c_str()); //unlink if exists - //int rename_error = _wrename((save_path+".tmp").c_str(),save_path.c_str()); - bool rename_error = true; int attempts = 4; while (rename_error && attempts) { @@ -305,11 +302,10 @@ uint64_t FileAccessWindows::_get_modified_time(const String &p_file) { return st.st_mtime; } else { - print_line("no access to " + file); + ERR_EXPLAIN("Failed to get modified time for: " + file); + ERR_FAIL_V(0); } - - ERR_FAIL_V(0); -}; +} FileAccessWindows::FileAccessWindows() { diff --git a/drivers/winmidi/win_midi.cpp b/drivers/winmidi/win_midi.cpp index 6da6e31b2b..63f7f13685 100644 --- a/drivers/winmidi/win_midi.cpp +++ b/drivers/winmidi/win_midi.cpp @@ -53,6 +53,12 @@ Error MIDIDriverWinMidi::open() { char err[256]; midiInGetErrorText(res, err, 256); ERR_PRINTS("midiInOpen error: " + String(err)); + + MIDIINCAPS caps; + res = midiInGetDevCaps(i, &caps, sizeof(MIDIINCAPS)); + if (res == MMSYSERR_NOERROR) { + ERR_PRINTS("Can't open MIDI device \"" + String(caps.szPname) + "\", is it being used by another application?"); + } } } diff --git a/drivers/xaudio2/audio_driver_xaudio2.h b/drivers/xaudio2/audio_driver_xaudio2.h index 42e1adb2b7..0867c56128 100644 --- a/drivers/xaudio2/audio_driver_xaudio2.h +++ b/drivers/xaudio2/audio_driver_xaudio2.h @@ -51,7 +51,7 @@ class AudioDriverXAudio2 : public AudioDriver { HANDLE buffer_end_event; XAudio2DriverVoiceCallback() : buffer_end_event(CreateEvent(NULL, FALSE, FALSE, NULL)) {} - void STDMETHODCALLTYPE OnBufferEnd(void *pBufferContext) { /*print_line("buffer ended");*/ + void STDMETHODCALLTYPE OnBufferEnd(void *pBufferContext) { SetEvent(buffer_end_event); } diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index 6d444c5422..590621816e 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -974,8 +974,6 @@ void AnimationTrackEditTypeAudio::drop_data(const Point2 &p_point, const Variant ofs += 0.001; } - print_line("inserting"); - *get_block_animation_update_ptr() = true; get_undo_redo()->create_action("Add Audio Track Clip"); get_undo_redo()->add_do_method(get_animation().ptr(), "audio_track_insert_key", get_track(), ofs, stream); @@ -1124,7 +1122,6 @@ Rect2 AnimationTrackEditTypeAnimation::get_key_rect(int p_index, float p_pixels_ } String anim = get_animation()->animation_track_get_key_animation(get_track(), p_index); - print_line("anim " + anim + " has " + itos(ap->has_animation(anim))); if (anim != "[stop]" && ap->has_animation(anim)) { diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 9d4333bc29..2fecf24d7d 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -717,7 +717,6 @@ void CodeTextEditor::_complete_request() { if (code_complete_func) { code_complete_func(code_complete_ud, ctext, &entries, forced); } - // print_line("COMPLETE: "+p_request); if (entries.size() == 0) return; Vector<String> strs; diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index c4a17d5402..62ae14c988 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -336,12 +336,9 @@ void DependencyEditorOwners::_fill_owners(EditorFileSystemDirectory *efsd) { for (int i = 0; i < efsd->get_file_count(); i++) { Vector<String> deps = efsd->get_file_deps(i); - //print_line(":::"+efsd->get_file_path(i)); bool found = false; for (int j = 0; j < deps.size(); j++) { - //print_line("\t"+deps[j]+" vs "+editing); if (deps[j] == editing) { - //print_line("found"); found = true; break; } @@ -510,7 +507,7 @@ void DependencyRemoveDialog::ok_pressed() { res->set_path(""); } String path = OS::get_singleton()->get_resource_dir() + files_to_delete[i].replace_first("res://", "/"); - print_line("Moving to trash: " + path); + print_verbose("Moving to trash: " + path); Error err = OS::get_singleton()->move_to_trash(path); if (err != OK) { EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + files_to_delete[i] + "\n"); @@ -525,7 +522,7 @@ void DependencyRemoveDialog::ok_pressed() { for (int i = 0; i < dirs_to_delete.size(); ++i) { String path = OS::get_singleton()->get_resource_dir() + dirs_to_delete[i].replace_first("res://", "/"); - print_line("Moving to trash: " + path); + print_verbose("Moving to trash: " + path); Error err = OS::get_singleton()->move_to_trash(path); if (err != OK) { EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + dirs_to_delete[i] + "\n"); @@ -673,7 +670,6 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa if (!p_parent) { Vector<String> deps = efsd->get_file_deps(i); - //print_line(":::"+efsd->get_file_path(i)); for (int j = 0; j < deps.size(); j++) { if (!refs.has(deps[j])) { diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp index 91a29f5717..fe1cf3484e 100644 --- a/editor/doc/doc_data.cpp +++ b/editor/doc/doc_data.cpp @@ -792,7 +792,6 @@ Error DocData::_load(Ref<XMLParser> parser) { class_list[name] = ClassDoc(); ClassDoc &c = class_list[name]; - //print_line("class: "+name); c.name = name; if (parser->has_attribute("inherits")) c.inherits = parser->get_attribute_value("inherits"); diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index f1c8c08d08..d99908a3c3 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -172,7 +172,6 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { parent = root; } else { String ppath = path.substr(0, pp); - print_line("PPATH IS: " + ppath); ERR_CONTINUE(!dir_map.has(ppath)); parent = dir_map[ppath]; } diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index a084437226..9c775be87e 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -482,10 +482,8 @@ void EditorAudioBus::drop_data(const Point2 &p_point, const Variant &p_data) { Variant EditorAudioBus::get_drag_data_fw(const Point2 &p_point, Control *p_from) { - print_line("drag fw"); TreeItem *item = effects->get_item_at_position(p_point); if (!item) { - print_line("no item"); return Variant(); } diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 721158cebb..e46fe96885 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -1486,8 +1486,6 @@ void EditorExportTextSceneToBinaryPlugin::_export_file(const String &p_path, con return; } - print_line("exporting " + p_path); - bool convert = GLOBAL_GET("editor/convert_text_resources_to_binary_on_export"); if (!convert) return; diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 50b3810e52..5a0a49d577 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1907,8 +1907,6 @@ void EditorHelpBit::_go_to_help(String p_what) { void EditorHelpBit::_meta_clicked(String p_select) { - print_line("got meta " + p_select); - if (p_select.begins_with("$")) { //enum String select = p_select.substr(1, p_select.length()); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 0ca70c41fa..353dce5b20 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -108,7 +108,6 @@ #include "editor/plugins/script_editor_plugin.h" #include "editor/plugins/script_text_editor.h" #include "editor/plugins/shader_editor_plugin.h" -#include "editor/plugins/shader_graph_editor_plugin.h" #include "editor/plugins/skeleton_2d_editor_plugin.h" #include "editor/plugins/skeleton_editor_plugin.h" #include "editor/plugins/skeleton_ik_editor_plugin.h" diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 6818de8281..1f2e73654c 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -104,14 +104,12 @@ Vector<Ref<Texture> > EditorInterface::make_mesh_previews(const Vector<Ref<Mesh> continue; } AABB aabb = mesh->get_aabb(); - print_line("aabb: " + aabb); Vector3 ofs = aabb.position + aabb.size * 0.5; aabb.position -= ofs; Transform xform; xform.basis = Basis().rotated(Vector3(0, 1, 0), -Math_PI * 0.25); xform.basis = Basis().rotated(Vector3(1, 0, 0), Math_PI * 0.25) * xform.basis; AABB rot_aabb = xform.xform(aabb); - print_line("rot_aabb: " + rot_aabb); float m = MAX(rot_aabb.size.x, rot_aabb.size.y) * 0.5; if (m == 0) { textures.push_back(Ref<Texture>()); @@ -119,7 +117,6 @@ Vector<Ref<Texture> > EditorInterface::make_mesh_previews(const Vector<Ref<Mesh> } m = 1.0 / m; m *= 0.5; - print_line("scale: " + rtos(m)); xform.basis.scale(Vector3(m, m, m)); xform.origin = -xform.basis.xform(ofs); //-ofs*m; xform.origin.z -= rot_aabb.size.z * 2; @@ -133,7 +130,6 @@ Vector<Ref<Texture> > EditorInterface::make_mesh_previews(const Vector<Ref<Mesh> Ref<ImageTexture> it(memnew(ImageTexture)); it->create_from_image(img); - //print_line("loaded image, size: "+rtos(m)+" dist: "+rtos(dist)+" empty?"+itos(img.empty())+" w: "+itos(it->get_width())+" h: "+itos(it->get_height())); VS::get_singleton()->free(inst); textures.push_back(it); diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp index 67700b59de..f57c863bcf 100644 --- a/editor/editor_profiler.cpp +++ b/editor/editor_profiler.cpp @@ -100,6 +100,8 @@ void EditorProfiler::clear() { updating_frame = false; hover_metric = -1; seeking = false; + + _update_plot(); } static String _get_percent_txt(float p_value, float p_total) { @@ -167,7 +169,7 @@ void EditorProfiler::_update_plot() { int w = graph->get_size().width; int h = graph->get_size().height; - bool reset_texture = false; + bool reset_texture = graph_texture.is_null(); int desired_len = w * h * 4; @@ -342,7 +344,6 @@ void EditorProfiler::_update_plot() { } time = OS::get_singleton()->get_ticks_usec() - time; - //print_line("Taken: "+rtos(USEC_TO_SEC(time))); } wr = PoolVector<uint8_t>::Write(); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 5f1e7273e5..3c3df6b8ef 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -258,19 +258,40 @@ void EditorPropertyPath::setup(const Vector<String> &p_extensions, bool p_folder global = p_global; } +void EditorPropertyPath::_notification(int p_what) { + + if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { + path_edit->set_icon(get_icon("Folder", "EditorIcons")); + } +} + +void EditorPropertyPath::_path_focus_exited() { + + _path_selected(path->get_text()); +} + void EditorPropertyPath::_bind_methods() { ClassDB::bind_method(D_METHOD("_path_pressed"), &EditorPropertyPath::_path_pressed); ClassDB::bind_method(D_METHOD("_path_selected"), &EditorPropertyPath::_path_selected); + ClassDB::bind_method(D_METHOD("_path_focus_exited"), &EditorPropertyPath::_path_focus_exited); } EditorPropertyPath::EditorPropertyPath() { - path = memnew(Button); - path->set_clip_text(true); - add_child(path); + HBoxContainer *path_hb = memnew(HBoxContainer); + add_child(path_hb); + path = memnew(LineEdit); + path_hb->add_child(path); + path->connect("text_entered", this, "_path_selected"); + path->connect("focus_exited", this, "_path_focus_exited"); + path->set_h_size_flags(SIZE_EXPAND_FILL); + + path_edit = memnew(Button); + path_edit->set_clip_text(true); + path_hb->add_child(path_edit); add_focusable(path); dialog = NULL; - path->connect("pressed", this, "_path_pressed"); + path_edit->connect("pressed", this, "_path_pressed"); folder = false; global = false; } diff --git a/editor/editor_properties.h b/editor/editor_properties.h index 5726ccfa41..cfc433b880 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -107,13 +107,16 @@ class EditorPropertyPath : public EditorProperty { bool folder; bool global; EditorFileDialog *dialog; - Button *path; + LineEdit *path; + Button *path_edit; void _path_selected(const String &p_path); void _path_pressed(); + void _path_focus_exited(); protected: static void _bind_methods(); + void _notification(int p_what); public: void setup(const Vector<String> &p_extensions, bool p_folder, bool p_global); diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index a9eaad47b7..bc56a95b47 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -152,8 +152,6 @@ Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem &p_item, c f->store_line(itos(FileAccess::get_modified_time(p_item.path))); f->store_line(FileAccess::get_md5(p_item.path)); memdelete(f); - } else { - //print_line("was not generated"); } } diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 9278d7676a..5d3c6dd087 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -146,7 +146,7 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const { const VariantContainer *v = props.getptr(p_name); if (!v) { - print_line("EditorSettings::_get - Warning, not found: " + String(p_name)); + WARN_PRINTS("EditorSettings::_get - Property not found: " + String(p_name)); return false; } r_ret = v->variant; @@ -853,10 +853,7 @@ void EditorSettings::create() { singleton->data_dir = data_dir; singleton->cache_dir = cache_dir; - if (OS::get_singleton()->is_stdout_verbose()) { - - print_line("EditorSettings: Load OK!"); - } + print_verbose("EditorSettings: Load OK!"); singleton->setup_language(); singleton->setup_network(); @@ -968,8 +965,8 @@ void EditorSettings::save() { if (err != OK) { ERR_PRINTS("Error saving editor settings to " + singleton->config_file_path); - } else if (OS::get_singleton()->is_stdout_verbose()) { - print_line("EditorSettings Save OK!"); + } else { + print_verbose("EditorSettings: Save OK!"); } } diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 50d71f1c98..7ed7b920d9 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -238,7 +238,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = clock_t end_time = clock(); #else - print_line("Sorry no icons for you"); + print_line("SVG support disabled, editor icons won't be rendered."); #endif } diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp index b9e0c7d0fa..28b1095256 100644 --- a/editor/fileserver/editor_file_server.cpp +++ b/editor/fileserver/editor_file_server.cpp @@ -34,9 +34,10 @@ #include "io/marshalls.h" //#define DEBUG_PRINT(m_p) print_line(m_p) -#define DEBUG_TIME(m_what) printf("MS: %s - %lu\n", m_what, OS::get_singleton()->get_ticks_usec()); +//#define DEBUG_TIME(m_what) printf("MS: %s - %lu\n", m_what, OS::get_singleton()->get_ticks_usec()); -//#define DEBUG_TIME(m_what) +#define DEBUG_PRINT(m_what) +#define DEBUG_TIME(m_what) void EditorFileServer::_close_client(ClientData *cd) { @@ -107,7 +108,6 @@ void EditorFileServer::_subthread_start(void *s) { //wait for ID err = cd->connection->get_data(buf4, 4); - //#define DEBUG_PRINT(m_p) print_line(m_p) DEBUG_TIME("get_data") if (err != OK) { @@ -150,13 +150,13 @@ void EditorFileServer::_subthread_start(void *s) { s.parse_utf8(fileutf8.ptr()); if (cmd == FileAccessNetwork::COMMAND_FILE_EXISTS) { - print_line("FILE EXISTS: " + s); + DEBUG_PRINT("FILE EXISTS: " + s); } if (cmd == FileAccessNetwork::COMMAND_GET_MODTIME) { - print_line("MOD TIME: " + s); + DEBUG_PRINT("MOD TIME: " + s); } if (cmd == FileAccessNetwork::COMMAND_OPEN_FILE) { - print_line("OPEN: " + s); + DEBUG_PRINT("OPEN: " + s); } if (!s.begins_with("res://")) { @@ -243,7 +243,7 @@ void EditorFileServer::_subthread_start(void *s) { int read = cd->files[id]->get_buffer(buf.ptrw(), blocklen); ERR_CONTINUE(read < 0); - print_line("GET BLOCK - offset: " + itos(offset) + ", blocklen: " + itos(blocklen)); + DEBUG_PRINT("GET BLOCK - offset: " + itos(offset) + ", blocklen: " + itos(blocklen)); //not found, continue encode_uint32(id, buf4); @@ -259,7 +259,7 @@ void EditorFileServer::_subthread_start(void *s) { } break; case FileAccessNetwork::COMMAND_CLOSE: { - print_line("CLOSED"); + DEBUG_PRINT("CLOSED"); ERR_CONTINUE(!cd->files.has(id)); memdelete(cd->files[id]); cd->files.erase(id); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index ec1153a015..cb38c2f85e 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -809,7 +809,7 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_ } DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES); - print_line("Moving " + old_path + " -> " + new_path); + print_verbose("Moving " + old_path + " -> " + new_path); Error err = da->rename(old_path, new_path); if (err == OK) { //Move/Rename any corresponding import settings too @@ -837,7 +837,7 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_ //Only treat as a changed dependency if it was successfully moved for (int i = 0; i < file_changed_paths.size(); ++i) { p_file_renames[file_changed_paths[i]] = file_changed_paths[i].replace_first(old_path, new_path); - print_line(" Remap: " + file_changed_paths[i] + " -> " + p_file_renames[file_changed_paths[i]]); + print_verbose(" Remap: " + file_changed_paths[i] + " -> " + p_file_renames[file_changed_paths[i]]); } for (int i = 0; i < folder_changed_paths.size(); ++i) { p_folder_renames[folder_changed_paths[i]] = folder_changed_paths[i].replace_first(old_path, new_path); @@ -865,7 +865,7 @@ void FileSystemDock::_try_duplicate_item(const FileOrFolder &p_item, const Strin } DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES); - print_line("Duplicating " + old_path + " -> " + new_path); + print_verbose("Duplicating " + old_path + " -> " + new_path); Error err = p_item.is_file ? da->copy(old_path, new_path) : da->copy_dir(old_path, new_path); if (err == OK) { //Move/Rename any corresponding import settings too @@ -942,7 +942,7 @@ void FileSystemDock::_update_dependencies_after_move(const Map<String, String> & for (int i = 0; i < remaps.size(); ++i) { //Because we haven't called a rescan yet the found remap might still be an old path itself. String file = p_renames.has(remaps[i]) ? p_renames[remaps[i]] : remaps[i]; - print_line("Remapping dependencies for: " + file); + print_verbose("Remapping dependencies for: " + file); Error err = ResourceLoader::rename_dependencies(file, p_renames); if (err == OK) { if (ResourceLoader::get_resource_type(file) == "PackedScene") @@ -998,7 +998,7 @@ void FileSystemDock::_make_dir_confirm() { return; } - print_line("Making folder " + dir_name + " in " + path); + print_verbose("Making folder " + dir_name + " in " + path); DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES); Error err = da->change_dir(path); if (err == OK) { @@ -1007,7 +1007,7 @@ void FileSystemDock::_make_dir_confirm() { memdelete(da); if (err == OK) { - print_line("call rescan!"); + print_verbose("FileSystem: calling rescan."); _rescan(); } else { EditorNode::get_singleton()->show_warning(TTR("Could not create folder.")); @@ -1054,7 +1054,7 @@ void FileSystemDock::_rename_operation_confirm() { _update_favorite_dirs_list_after_move(folder_renames); //Rescan everything - print_line("call rescan!"); + print_verbose("FileSystem: calling rescan."); _rescan(); } @@ -1089,7 +1089,7 @@ void FileSystemDock::_duplicate_operation_confirm() { _try_duplicate_item(to_duplicate, new_path); //Rescan everything - print_line("call rescan!"); + print_verbose("FileSystem: calling rescan."); _rescan(); } @@ -1146,7 +1146,7 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool overw _update_project_settings_after_move(file_renames); _update_favorite_dirs_list_after_move(folder_renames); - print_line("call rescan!"); + print_verbose("FileSystem: calling rescan."); _rescan(); } } diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index ef7409fd43..9ede8a05bc 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -123,12 +123,12 @@ void FindInFiles::_notification(int p_notification) { void FindInFiles::start() { if (_pattern == "") { - print_line("Nothing to search, pattern is empty"); + print_verbose("Nothing to search, pattern is empty"); emit_signal(SIGNAL_FINISHED); return; } if (_extension_filter.size() == 0) { - print_line("Nothing to search, filter matches no files"); + print_verbose("Nothing to search, filter matches no files"); emit_signal(SIGNAL_FINISHED); return; } @@ -207,7 +207,7 @@ void FindInFiles::_iterate() { _scan_file(fpath); } else { - print_line("Search complete"); + print_verbose("Search complete"); set_process(false); _current_dir = ""; _searching = false; @@ -226,7 +226,7 @@ void FindInFiles::_scan_dir(String path, PoolStringArray &out_folders) { DirAccess *dir = DirAccess::open(path); if (dir == NULL) { - print_line("Cannot open directory! " + path); + print_verbose("Cannot open directory! " + path); return; } @@ -258,7 +258,7 @@ void FindInFiles::_scan_file(String fpath) { FileAccess *f = FileAccess::open(fpath, FileAccess::READ); if (f == NULL) { - print_line(String("Cannot open file ") + fpath); + print_verbose(String("Cannot open file ") + fpath); return; } @@ -896,7 +896,7 @@ void FindInFilesPanel::apply_replaces_in_file(String fpath, const Vector<Result> int _; if (!find_next(line, search_text, repl_begin, _finder->is_match_case(), _finder->is_whole_words(), _, _)) { // Make sure the replace is still valid in case the file was tampered with. - print_line(String("Occurrence no longer matches, replace will be ignored in {0}: line {1}, col {2}").format(varray(fpath, repl_line_number, repl_begin))); + print_verbose(String("Occurrence no longer matches, replace will be ignored in {0}: line {1}, col {2}").format(varray(fpath, repl_line_number, repl_begin))); continue; } diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 22ea5883e8..d4bd4f85e6 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -119,7 +119,6 @@ Error ColladaImport::_populate_skeleton(Skeleton *p_skeleton, Collada::Node *p_n Collada::NodeJoint *joint = static_cast<Collada::NodeJoint *>(p_node); - print_line("populating joint " + joint->name); p_skeleton->add_bone(p_node->name); if (p_parent >= 0) p_skeleton->set_bone_parent(r_bone, p_parent); @@ -137,8 +136,7 @@ Error ColladaImport::_populate_skeleton(Skeleton *p_skeleton, Collada::Node *p_n p_skeleton->set_bone_rest(r_bone, collada.fix_transform(collada.state.bone_rest_map[joint->sid])); //should map this bone to something for animation? } else { - print_line("no rest: " + joint->sid); - WARN_PRINT("Joint has no rest..."); + WARN_PRINT("Collada: Joint has no rest."); } int id = r_bone++; @@ -585,9 +583,6 @@ static void _generate_tangents_and_binormals(const PoolVector<int> &p_indices, c binormals.write[index_arrayr[idx * 3 + 1]] += binormal; tangents.write[index_arrayr[idx * 3 + 2]] += tangent; binormals.write[index_arrayr[idx * 3 + 2]] += binormal; - - //print_line(itos(idx)+" tangent: "+tangent); - //print_line(itos(idx)+" binormal: "+binormal); } r_tangents.resize(vlen * 4); @@ -1028,7 +1023,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me material = material_cache[target]; } else if (p.material != "") { - print_line("Warning, unreferenced material in geometry instance: " + p.material); + WARN_PRINTS("Collada: Unreferenced material in geometry instance: " + p.material); } } @@ -1352,7 +1347,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres mesh_cache[meshid] = mesh; } else { - print_line("Warning, will not import geometry: " + meshid); + WARN_PRINTS("Collada: Will not import geometry: " + meshid); } } @@ -1379,7 +1374,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres mi->set_surface_material(i, material); } else if (matname != "") { - print_line("Warning, unreferenced material in geometry instance: " + matname); + WARN_PRINTS("Collada: Unreferenced material in geometry instance: " + matname); } } } @@ -1541,7 +1536,6 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones, bool p_im for (int i = 0; i < collada.state.animation_tracks.size(); i++) { const Collada::AnimationTrack &at = collada.state.animation_tracks[i]; - //print_line("CHANNEL: "+at.target+" PARAM: "+at.param); String node; @@ -1551,7 +1545,7 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones, bool p_im node = node_name_map[at.target]; } else { - print_line("Couldn't find node: " + at.target); + WARN_PRINTS("Collada: Couldn't find node: " + at.target); continue; } } else { @@ -1570,7 +1564,6 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones, bool p_im } create_animation(-1, p_make_tracks_in_all_bones, p_import_value_tracks); - //print_line("clipcount: "+itos(collada.state.animation_clips.size())); for (int i = 0; i < collada.state.animation_clips.size(); i++) create_animation(i, p_make_tracks_in_all_bones, p_import_value_tracks); } @@ -1580,11 +1573,8 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones Ref<Animation> animation = Ref<Animation>(memnew(Animation)); if (p_clip == -1) { - - //print_line("default"); animation->set_name("default"); } else { - //print_line("clip name: "+collada.state.animation_clips[p_clip].name); animation->set_name(collada.state.animation_clips[p_clip].name); } @@ -1658,7 +1648,6 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones } } - //print_line("anim len: "+rtos(anim_length)); animation->set_length(anim_length); bool tracks_found = false; @@ -1736,7 +1725,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones } if (xform_idx == -1) { - print_line("couldn't find matching node " + at.target + " xform for track " + at.param); + WARN_PRINTS("Collada: Couldn't find matching node " + at.target + " xform for track " + at.param); continue; } @@ -1758,14 +1747,9 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones ERR_CONTINUE(data.size() > 1); xf.data.write[cn] = data[0]; } else if (data.size() == xf.data.size()) { - xf.data = data; } else { - - if (data.size() != xf.data.size()) { - print_line("component " + at.component + " datasize " + itos(data.size()) + " xfdatasize " + itos(xf.data.size())); - } - + ERR_EXPLAIN("Component " + at.component + " has datasize " + itos(data.size()) + ", xfdatasize " + itos(xf.data.size())); ERR_CONTINUE(data.size() != xf.data.size()); } } @@ -1781,7 +1765,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones xform = sk->get_bone_rest(nm.bone).affine_inverse() * xform; } else { - ERR_PRINT("INVALID SKELETON!!!!"); + ERR_PRINT("Collada: Invalid skeleton"); } } @@ -1812,8 +1796,6 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones if (E->get()) continue; - //print_line("BONE LACKS ANIM: "+E->key()); - NodeMap &nm = node_map[E->key()]; String path = scene->get_path_to(nm.node); ERR_CONTINUE(nm.bone < 0); @@ -1823,7 +1805,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones Collada::Node *cn = collada.state.scene_map[E->key()]; if (cn->ignore_anim) { - print_line("warning, ignoring animation on node: " + path); + WARN_PRINTS("Collada: Ignoring animation on node: " + path); continue; } @@ -1889,10 +1871,9 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones } else if (data.size() == 16) { //matrix - print_line("value keys for matrices not supported"); + WARN_PRINT("Collada: Value keys for matrices not supported."); } else { - - print_line("don't know what to do with this amount of value keys: " + itos(data.size())); + WARN_PRINTS("Collada: Unexpected amount of value keys: " + itos(data.size())); } animation->track_insert_key(track, time, value); @@ -1994,7 +1975,6 @@ Ref<Animation> EditorSceneImporterCollada::import_animation(const String &p_path if (state.animations.size() == 0) return Ref<Animation>(); Ref<Animation> anim = state.animations[0]; - print_line("Anim Load OK"); String base = p_path.get_basename().to_lower(); if (p_flags & IMPORT_ANIMATION_DETECT_LOOP) { diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 906d902b4a..4d5c292847 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -323,7 +323,7 @@ Error EditorSceneImporterGLTF::_parse_buffers(GLTFState &state, const String &p_ } } - print_line("total buffers: " + itos(state.buffers.size())); + print_verbose("glTF: Total buffers: " + itos(state.buffers.size())); return OK; } @@ -359,7 +359,7 @@ Error EditorSceneImporterGLTF::_parse_buffer_views(GLTFState &state) { state.buffer_views.push_back(buffer_view); } - print_line("total buffer views: " + itos(state.buffer_views.size())); + print_verbose("glTF: Total buffer views: " + itos(state.buffer_views.size())); return OK; } @@ -451,7 +451,7 @@ Error EditorSceneImporterGLTF::_parse_accessors(GLTFState &state) { state.accessors.push_back(accessor); } - print_line("total accessors: " + itos(state.accessors.size())); + print_verbose("glTF: Total accessors: " + itos(state.accessors.size())); return OK; } @@ -501,8 +501,8 @@ Error EditorSceneImporterGLTF::_decode_buffer_view(GLTFState &state, int p_buffe const uint8_t *bufptr = buffer.ptr(); //use to debug - //print_line("type " + _get_type_name(type) + " component type: " + _get_component_type_name(component_type) + " stride: " + itos(stride) + " amount " + itos(count)); - print_line("accessor offset" + itos(byte_offset) + " view offset: " + itos(bv.byte_offset) + " total buffer len: " + itos(buffer.size()) + " view len " + itos(bv.byte_length)); + print_verbose("glTF: type " + _get_type_name(type) + " component type: " + _get_component_type_name(component_type) + " stride: " + itos(stride) + " amount " + itos(count)); + print_verbose("glTF: accessor offset" + itos(byte_offset) + " view offset: " + itos(bv.byte_offset) + " total buffer len: " + itos(buffer.size()) + " view len " + itos(bv.byte_length)); int buffer_end = (stride * (count - 1)) + element_size; ERR_FAIL_COND_V(buffer_end > bv.byte_length, ERR_PARSE_ERROR); @@ -853,7 +853,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { Array meshes = state.json["meshes"]; for (int i = 0; i < meshes.size(); i++) { - print_line("on mesh: " + itos(i)); + print_verbose("glTF: Parsing mesh: " + itos(i)); Dictionary d = meshes[i]; GLTFMesh mesh; @@ -935,7 +935,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { w[j + 3] /= total; } - //print_line(itos(j / 4) + ": " + itos(r[j + 0]) + ":" + rtos(w[j + 0]) + ", " + itos(r[j + 1]) + ":" + rtos(w[j + 1]) + ", " + itos(r[j + 2]) + ":" + rtos(w[j + 2]) + ", " + itos(r[j + 3]) + ":" + rtos(w[j + 3])); + //print_verbose(itos(j / 4) + ": " + itos(r[j + 0]) + ":" + rtos(w[j + 0]) + ", " + itos(r[j + 1]) + ":" + rtos(w[j + 1]) + ", " + itos(r[j + 2]) + ":" + rtos(w[j + 2]) + ", " + itos(r[j + 3]) + ":" + rtos(w[j + 3])); } } array[Mesh::ARRAY_WEIGHTS] = weights; @@ -996,7 +996,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { Array morphs; //blend shapes if (p.has("targets")) { - print_line("has targets!"); + print_verbose("glTF: Mesh has targets"); Array targets = p["targets"]; if (j == 0) { @@ -1091,7 +1091,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { state.meshes.push_back(mesh); } - print_line("total meshes: " + itos(state.meshes.size())); + print_verbose("glTF: Total meshes: " + itos(state.meshes.size())); return OK; } @@ -1183,7 +1183,7 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b ERR_FAIL_V(ERR_FILE_CORRUPT); } - print_line("total images: " + itos(state.images.size())); + print_verbose("Total images: " + itos(state.images.size())); return OK; } @@ -1338,7 +1338,7 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) { state.materials.push_back(material); } - print_line("total materials: " + itos(state.materials.size())); + print_verbose("Total materials: " + itos(state.materials.size())); return OK; } @@ -1381,12 +1381,11 @@ Error EditorSceneImporterGLTF::_parse_skins(GLTFState &state) { skin.bones.push_back(bone); } - print_line("skin has skeleton? " + itos(d.has("skeleton"))); + print_verbose("glTF: Skin has skeleton? " + itos(d.has("skeleton"))); if (d.has("skeleton")) { int skeleton = d["skeleton"]; ERR_FAIL_INDEX_V(skeleton, state.nodes.size(), ERR_PARSE_ERROR); - //state.nodes[skeleton]->skeleton_skin = state.skins.size(); - print_line("setting skeleton skin to" + itos(skeleton)); + print_verbose("glTF: Setting skeleton skin to" + itos(skeleton)); skin.skeleton = skeleton; if (!state.skeleton_nodes.has(skeleton)) { state.skeleton_nodes[skeleton] = Vector<int>(); @@ -1443,7 +1442,7 @@ Error EditorSceneImporterGLTF::_parse_skins(GLTFState &state) { */ state.skins.push_back(skin); } - print_line("total skins: " + itos(state.skins.size())); + print_verbose("glTF: Total skins: " + itos(state.skins.size())); //now @@ -1496,7 +1495,7 @@ Error EditorSceneImporterGLTF::_parse_cameras(GLTFState &state) { state.cameras.push_back(camera); } - print_line("total cameras: " + itos(state.cameras.size())); + print_verbose("glTF: Total cameras: " + itos(state.cameras.size())); return OK; } @@ -1574,7 +1573,6 @@ Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) { } } - print_line("path: " + path); PoolVector<float> times = _decode_accessor_as_floats(state, input, false); if (path == "translation") { PoolVector<Vector3> translations = _decode_accessor_as_vec3(state, output, false); @@ -1624,7 +1622,7 @@ Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) { state.animations.push_back(animation); } - print_line("total animations: " + itos(state.animations.size())); + print_verbose("glTF: Total animations: " + itos(state.animations.size())); return OK; } @@ -1656,7 +1654,7 @@ void EditorSceneImporterGLTF::_generate_node(GLTFState &state, int p_node, Node if (n->mesh >= 0) { ERR_FAIL_INDEX(n->mesh, state.meshes.size()); MeshInstance *mi = memnew(MeshInstance); - print_line("**creating mesh for: " + n->name); + print_verbose("glTF: Creating mesh for: " + n->name); GLTFMesh &mesh = state.meshes.write[n->mesh]; mi->set_mesh(mesh.mesh); if (mesh.mesh->get_name() == "") { diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index 5babf6419c..3f101cd04d 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -63,7 +63,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati material_map[current_name] = current; } else if (l.begins_with("Ka ")) { //uv - print_line("Warning: Ambient light for material '" + current_name + "' is ignored in PBR"); + WARN_PRINTS("OBJ: Ambient light for material '" + current_name + "' is ignored in PBR"); } else if (l.begins_with("Kd ")) { //normal @@ -119,7 +119,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati } else if (l.begins_with("map_Ka ")) { //uv - print_line("Warning: Ambient light texture for material '" + current_name + "' is ignored in PBR"); + WARN_PRINTS("OBJ: Ambient light texture for material '" + current_name + "' is ignored in PBR"); } else if (l.begins_with("map_Kd ")) { //normal @@ -335,8 +335,8 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p surf_tool->index(); - print_line("current material library " + current_material_library + " has " + itos(material_map.has(current_material_library))); - print_line("current material " + current_material + " has " + itos(material_map.has(current_material_library) && material_map[current_material_library].has(current_material))); + print_verbose("OBJ: Current material library " + current_material_library + " has " + itos(material_map.has(current_material_library))); + print_verbose("OBJ: Current material " + current_material + " has " + itos(material_map.has(current_material_library) && material_map[current_material_library].has(current_material))); if (material_map.has(current_material_library) && material_map[current_material_library].has(current_material)) { surf_tool->set_material(material_map[current_material_library][current_material]); @@ -350,7 +350,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p mesh->surface_set_name(mesh->get_surface_count() - 1, current_group); } - print_line("Added surface :" + mesh->surface_get_name(mesh->get_surface_count() - 1)); + print_verbose("OBJ: Added surface :" + mesh->surface_get_name(mesh->get_surface_count() - 1)); surf_tool->clear(); surf_tool->begin(Mesh::PRIMITIVE_TRIANGLES); } diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index b5e3466b12..f544811eb0 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -281,12 +281,11 @@ static String _fixstr(const String &p_what, const String &p_str) { Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<ArrayMesh>, Ref<Shape> > &collision_map, LightBakeMode p_light_bake_mode) { - // children first.. + // children first for (int i = 0; i < p_node->get_child_count(); i++) { Node *r = _fix_node(p_node->get_child(i), p_root, collision_map, p_light_bake_mode); if (!r) { - print_line("was erased..."); i--; //was erased } } @@ -391,7 +390,6 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array colshape->set_owner(p_node->get_owner()); } else if (p_node->has_meta("empty_draw_type")) { String empty_draw_type = String(p_node->get_meta("empty_draw_type")); - print_line(empty_draw_type); StaticBody *sb = memnew(StaticBody); sb->set_name(_fixstr(name, "colonly")); Object::cast_to<Spatial>(sb)->set_transform(Object::cast_to<Spatial>(p_node)->get_transform()); @@ -723,15 +721,11 @@ void ResourceImporterScene::_filter_anim_tracks(Ref<Animation> anim, Set<String> Ref<Animation> a = anim; ERR_FAIL_COND(!a.is_valid()); - print_line("From Anim " + anim->get_name() + ":"); - for (int j = 0; j < a->get_track_count(); j++) { String path = a->track_get_path(j); if (!keep.has(path)) { - - print_line("Remove: " + path); a->remove_track(j); j--; } @@ -899,8 +893,6 @@ void ResourceImporterScene::_find_meshes(Node *p_node, Map<Ref<ArrayMesh>, Trans } meshes[mesh] = transform; - - print_line("mesh transform: " + meshes[mesh]); } } for (int i = 0; i < p_node->get_child_count(); i++) { @@ -913,8 +905,6 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String List<PropertyInfo> pi; - print_line("node: " + String(p_node->get_name())); - if (p_make_animations) { if (Object::cast_to<AnimationPlayer>(p_node)) { AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node); @@ -1316,7 +1306,6 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p if (bool(p_options["external_files/store_in_subdir"])) { String subdir_name = p_source_file.get_file().get_basename(); DirAccess *da = DirAccess::open(base_path); - print_line("at path " + da->get_current_dir() + " making " + subdir_name); Error err = da->make_dir(subdir_name); memdelete(da); ERR_FAIL_COND_V(err != OK && err != ERR_ALREADY_EXISTS, err); @@ -1421,7 +1410,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p Ref<PackedScene> packer = memnew(PackedScene); packer->pack(scene); - print_line("SAVING TO: " + p_save_path + ".scn"); + print_verbose("Saving scene to: " + p_save_path + ".scn"); err = ResourceSaver::save(p_save_path + ".scn", packer); //do not take over, let the changed files reload themselves ERR_FAIL_COND_V(err != OK, err); diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index 9e99dcc5c8..d04f29ea5e 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -205,7 +205,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s /*print_line("chunksize: "+itos(chunksize)); print_line("channels: "+itos(format_channels)); print_line("bits: "+itos(format_bits)); -*/ + */ int len = frames; if (format_channels == 2) @@ -293,6 +293,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s bool is16 = format_bits != 8; int rate = format_freq; + /* print_line("Input Sample: "); print_line("\tframes: " + itos(frames)); print_line("\tformat_channels: " + itos(format_channels)); @@ -301,18 +302,16 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s print_line("\tloop: " + itos(loop)); print_line("\tloop begin: " + itos(loop_begin)); print_line("\tloop end: " + itos(loop_end)); + */ //apply frequency limit bool limit_rate = p_options["force/max_rate"]; int limit_rate_hz = p_options["force/max_rate_hz"]; if (limit_rate && rate > limit_rate_hz && rate > 0 && frames > 0) { - //resampleeee!!! + // resample! int new_data_frames = (int)(frames * (float)limit_rate_hz / (float)rate); - print_line("\tresampling ratio: " + rtos((float)limit_rate_hz / (float)rate)); - print_line("\tnew frames: " + itos(new_data_frames)); - Vector<float> new_data; new_data.resize(new_data_frames * format_channels); for (int c = 0; c < format_channels; c++) { @@ -492,8 +491,6 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s } } - //print_line("compressing ima-adpcm, resulting buffersize is "+itos(dst_data.size())+" from "+itos(data.size())); - } else { dst_format = is16 ? AudioStreamSample::FORMAT_16_BITS : AudioStreamSample::FORMAT_8_BITS; diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp index 418936ac9f..93bed035a5 100644 --- a/editor/plugin_config_dialog.cpp +++ b/editor/plugin_config_dialog.cpp @@ -112,7 +112,6 @@ void PluginConfigDialog::_notification(int p_what) { void PluginConfigDialog::config(const String &p_config_path) { if (p_config_path.length()) { Ref<ConfigFile> cf = memnew(ConfigFile); - print_line(p_config_path); cf->load(p_config_path); name_edit->set_text(cf->get_value("plugin", "name", "")); diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index e5476aaf08..2d240b5a5c 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -349,7 +349,6 @@ void AnimationNodeBlendSpace2DEditor::_tool_switch(int p_tool) { points.push_back(blend_space->get_blend_point_position(i)); } Vector<Delaunay2D::Triangle> tr = Delaunay2D::triangulate(points); - print_line("triangleS: " + itos(tr.size())); for (int i = 0; i < tr.size(); i++) { blend_space->add_triangle(tr[i].points[0], tr[i].points[1], tr[i].points[2]); } diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 42e32b9788..dbb5fa578b 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -38,7 +38,6 @@ void AnimationNodeBlendTreeEditor::remove_custom_type(const Ref<Script> &p_scrip void AnimationNodeBlendTreeEditor::_update_options_menu() { - print_line("update options"); add_node->get_popup()->clear(); for (int i = 0; i < add_options.size(); i++) { add_node->get_popup()->add_item(add_options[i].name, i); @@ -650,8 +649,9 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) { blend_tree->get_node_connections(&conns); for (List<AnimationNodeBlendTree::NodeConnection>::Element *E = conns.front(); E; E = E->next()) { float activity = 0; + StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + E->get().input_node; if (AnimationTreeEditor::get_singleton()->get_tree() && !AnimationTreeEditor::get_singleton()->get_tree()->is_state_invalid()) { - activity = blend_tree->get_connection_activity(E->get().input_node, E->get().input_index); + activity = AnimationTreeEditor::get_singleton()->get_tree()->get_connection_activity(path, E->get().input_index); } graph->set_connection_activity(E->get().output_node, 0, E->get().input_node, E->get().input_index, activity); } @@ -777,6 +777,30 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima visible_properties[i]->set_object_and_property(visible_properties[i]->get_edited_object(), new_name); } } + + //recreate connections + graph->clear_connections(); + + List<AnimationNodeBlendTree::NodeConnection> connections; + blend_tree->get_node_connections(&connections); + + for (List<AnimationNodeBlendTree::NodeConnection>::Element *E = connections.front(); E; E = E->next()) { + + StringName from = E->get().output_node; + StringName to = E->get().input_node; + int to_idx = E->get().input_index; + + graph->connect_node(from, 0, to, to_idx); + } + + //update animations + for (Map<StringName, ProgressBar *>::Element *E = animations.front(); E; E = E->next()) { + if (E->key() == prev_name) { + animations[new_name] = animations[prev_name]; + animations.erase(prev_name); + break; + } + } } void AnimationNodeBlendTreeEditor::_node_renamed_focus_out(Node *le, Ref<AnimationNode> p_node) { diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index ea8f921034..7b7e23531a 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -97,13 +97,11 @@ void MeshEditor::edit(Ref<Mesh> p_mesh) { _update_rotation(); AABB aabb = mesh->get_aabb(); - print_line("aabb: " + aabb); Vector3 ofs = aabb.position + aabb.size * 0.5; float m = aabb.get_longest_axis_size(); if (m != 0) { m = 1.0 / m; m *= 0.5; - //print_line("scale: "+rtos(m)); Transform xform; xform.basis.scale(Vector3(m, m, m)); xform.origin = -xform.basis.xform(ofs); //-ofs*m; diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 99a28be555..c24c96bdc5 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -169,8 +169,6 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library, void MeshLibraryEditor::_import_scene_cbk(const String &p_str) { - print_line("Impot Callback!"); - Ref<PackedScene> ps = ResourceLoader::load(p_str, "PackedScene"); ERR_FAIL_COND(ps.is_null()); Node *scene = ps->instance(); diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index b50e0dfe88..ae5d510502 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -58,8 +58,6 @@ void Particles2DEditorPlugin::make_visible(bool p_visible) { void Particles2DEditorPlugin::_file_selected(const String &p_file) { - print_line("file: " + p_file); - source_emission_file = p_file; emission_mask->popup_centered_minsize(); } @@ -73,7 +71,7 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) { generate_seconds->set_value(1.0); else generate_seconds->set_value(trunc(gen_time) + 1.0); - generate_aabb->popup_centered_minsize(); + generate_visibility_rect->popup_centered_minsize(); } break; case MENU_LOAD_EMISSION_MASK: { @@ -93,7 +91,7 @@ void Particles2DEditorPlugin::_generate_visibility_rect() { float running = 0.0; - EditorProgress ep("gen_aabb", TTR("Generating AABB"), int(time)); + EditorProgress ep("gen_vrect", TTR("Generating Visibility Rect"), int(time)); bool was_emitting = particles->is_emitting(); if (!was_emitting) { @@ -376,19 +374,19 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { epoints->set_value(512); file->get_vbox()->add_margin_child(TTR("Generated Point Count:"), epoints); - generate_aabb = memnew(ConfirmationDialog); - generate_aabb->set_title(TTR("Generate Visibility Rect")); + generate_visibility_rect = memnew(ConfirmationDialog); + generate_visibility_rect->set_title(TTR("Generate Visibility Rect")); VBoxContainer *genvb = memnew(VBoxContainer); - generate_aabb->add_child(genvb); + generate_visibility_rect->add_child(genvb); generate_seconds = memnew(SpinBox); genvb->add_margin_child(TTR("Generation Time (sec):"), generate_seconds); generate_seconds->set_min(0.1); generate_seconds->set_max(25); generate_seconds->set_value(2); - toolbar->add_child(generate_aabb); + toolbar->add_child(generate_visibility_rect); - generate_aabb->connect("confirmed", this, "_generate_visibility_rect"); + generate_visibility_rect->connect("confirmed", this, "_generate_visibility_rect"); emission_mask = memnew(ConfirmationDialog); emission_mask->set_title(TTR("Generate Visibility Rect")); diff --git a/editor/plugins/particles_2d_editor_plugin.h b/editor/plugins/particles_2d_editor_plugin.h index addf65789c..2b6123141b 100644 --- a/editor/plugins/particles_2d_editor_plugin.h +++ b/editor/plugins/particles_2d_editor_plugin.h @@ -66,7 +66,7 @@ class Particles2DEditorPlugin : public EditorPlugin { SpinBox *epoints; - ConfirmationDialog *generate_aabb; + ConfirmationDialog *generate_visibility_rect; SpinBox *generate_seconds; ConfirmationDialog *emission_mask; diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 6a99dcb9a5..3c381158a4 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -262,6 +262,7 @@ void ParticlesEditor::_notification(int p_notification) { if (p_notification == NOTIFICATION_ENTER_TREE) { options->set_icon(options->get_popup()->get_icon("Particles", "EditorIcons")); + get_tree()->connect("node_removed", this, "_node_removed"); } } @@ -444,6 +445,7 @@ void ParticlesEditor::_bind_methods() { ClassDB::bind_method("_menu_option", &ParticlesEditor::_menu_option); ClassDB::bind_method("_generate_aabb", &ParticlesEditor::_generate_aabb); + ClassDB::bind_method("_node_removed", &ParticlesEditor::_node_removed); } ParticlesEditor::ParticlesEditor() { diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 4840b1899d..a437cd5362 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -36,6 +36,7 @@ #include "os/input.h" #include "os/keyboard.h" #include "scene/2d/skeleton_2d.h" + Node2D *Polygon2DEditor::_get_node() const { return node; @@ -82,7 +83,6 @@ void Polygon2DEditor::_notification(int p_what) { void Polygon2DEditor::_sync_bones() { - print_line("syncinc"); if (!node->has_node(node->get_skeleton())) { error->set_text(TTR("The skeleton property of the Polygon2D does not point to a Skeleton2D node")); error->popup_centered_minsize(); @@ -101,8 +101,6 @@ void Polygon2DEditor::_sync_bones() { Array prev_bones = node->call("_get_bones"); node->clear_bones(); - print_line("bones in skeleton: " + itos(skeleton->get_bone_count())); - for (int i = 0; i < skeleton->get_bone_count(); i++) { NodePath path = skeleton->get_path_to(skeleton->get_bone(i)); PoolVector<float> weights; diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp index 89c1b3a978..af3c09afc5 100644 --- a/editor/plugins/root_motion_editor_plugin.cpp +++ b/editor/plugins/root_motion_editor_plugin.cpp @@ -276,7 +276,6 @@ void EditorInspectorRootMotionPlugin::parse_begin(Object *p_object) { bool EditorInspectorRootMotionPlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage) { if (p_path == "root_motion_track" && p_object->is_class("AnimationTree") && p_type == Variant::NODE_PATH) { - print_line("use custom!"); EditorPropertyRootMotion *editor = memnew(EditorPropertyRootMotion); if (p_hint == PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE && p_hint_text != String()) { editor->setup(p_hint_text); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 522ce52234..4e7047ee38 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -60,7 +60,6 @@ void ScriptTextEditor::apply_code() { if (script.is_null()) return; - //print_line("applying code"); script->set_source_code(code_editor->get_text_edit()->get_text()); script->update_exports(); _update_member_keywords(); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index ea1876c27a..5ee40dc90a 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -37,7 +37,6 @@ #include "editor/editor_node.h" #include "editor/editor_settings.h" #include "editor/property_editor.h" -#include "scene/resources/shader_graph.h" #include "servers/visual/shader_types.h" /*** SHADER SCRIPT EDITOR ****/ @@ -167,7 +166,6 @@ void ShaderTextEditor::_check_shader_mode() { String type = ShaderLanguage::get_shader_type(get_text_edit()->get_text()); - print_line("type is: " + type); Shader::Mode mode; if (type == "canvas_item") { diff --git a/editor/plugins/shader_graph_editor_plugin.cpp b/editor/plugins/shader_graph_editor_plugin.cpp deleted file mode 100644 index 1a9d980feb..0000000000 --- a/editor/plugins/shader_graph_editor_plugin.cpp +++ /dev/null @@ -1,2932 +0,0 @@ -/*************************************************************************/ -/* shader_graph_editor_plugin.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -// FIXME: Godot 3.0 broke compatibility with ShaderGraphEditorPlugin, -// it needs to be ported to the new shader language. -#if 0 -#include "shader_graph_editor_plugin.h" - -#include "canvas_item_editor_plugin.h" -#include "os/keyboard.h" -#include "scene/gui/check_box.h" -#include "scene/gui/menu_button.h" -#include "scene/gui/panel.h" -#include "spatial_editor_plugin.h" - -void GraphColorRampEdit::_gui_input(const InputEvent& p_event) { - - if (p_event.type==InputEvent::KEY && p_event->is_pressed() && p_event->get_scancode()==KEY_DELETE && grabbed!=-1) { - - points.remove(grabbed); - grabbed=-1; - update(); - emit_signal("ramp_changed"); - accept_event(); - } - - if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && p_event->is_pressed()) { - - update(); - int x = p_event->get_position().x; - int total_w = get_size().width-get_size().height-3; - if (x>total_w+3) { - - if (grabbed==-1) - return; - Size2 ms = Size2(350, picker->get_combined_minimum_size().height+10); - picker->set_color(points[grabbed].color); - popup->set_position(get_global_position()-Size2(0,ms.height)); - popup->set_size(ms); - popup->popup(); - return; - } - - - float ofs = CLAMP(x/float(total_w),0,1); - - grabbed=-1; - grabbing=true; - int pos=-1; - for(int i=0;i<points.size();i++) { - - if (ABS(x-points[i].offset*total_w)<4) { - grabbed=i; - } - if (points[i].offset<ofs) - pos=i; - } - - grabbed_at=ofs; - //grab or select - if (grabbed!=-1) { - return; - } - //insert - - - Point p; - p.offset=ofs; - - Point prev; - Point next; - - if (pos==-1) { - - prev.color=Color(0,0,0); - prev.offset=0; - if (points.size()) { - next=points[0]; - } else { - next.color=Color(1,1,1); - next.offset=1.0; - } - } else { - - if (pos==points.size()-1) { - next.color=Color(1,1,1); - next.offset=1.0; - } else { - next=points[pos+1]; - } - prev=points[pos]; - - } - - p.color=prev.color.linear_interpolate(next.color,(p.offset-prev.offset)/(next.offset-prev.offset)); - - points.push_back(p); - points.sort(); - for(int i=0;i<points.size();i++) { - if (points[i].offset==ofs) { - grabbed=i; - break; - } - } - - emit_signal("ramp_changed"); - - } - - if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && !p_event->is_pressed()) { - - if (grabbing) { - grabbing=false; - emit_signal("ramp_changed"); - } - update(); - } - - if (p_event.type==InputEvent::MOUSE_MOTION && grabbing) { - - int total_w = get_size().width-get_size().height-3; - - int x = p_event.mouse_motion.x; - float newofs = CLAMP(x/float(total_w),0,1); - - bool valid=true; - for(int i=0;i<points.size();i++) { - - if (points[i].offset==newofs && i!=grabbed) { - valid=false; - } - } - - if (!valid) - return; - - points[grabbed].offset=newofs; - - points.sort(); - for(int i=0;i<points.size();i++) { - if (points[i].offset==newofs) { - grabbed=i; - break; - } - } - - emit_signal("ramp_changed"); - - update(); - } -} - -void GraphColorRampEdit::_notification(int p_what){ - - if (p_what==NOTIFICATION_ENTER_TREE) { - if (!picker->is_connected("color_changed",this,"_color_changed")) { - picker->connect("color_changed",this,"_color_changed"); - } - } - if (p_what==NOTIFICATION_DRAW) { - - - Point prev; - prev.offset=0; - prev.color=Color(0,0,0); - - int h = get_size().y; - int total_w = get_size().width-get_size().height-3; - - for(int i=-1;i<points.size();i++) { - - Point next; - if (i+1==points.size()) { - next.color=Color(1,1,1); - next.offset=1; - } else { - next=points[i+1]; - } - - if (prev.offset==next.offset) { - prev=next; - continue; - } - - Vector<Vector2> points; - Vector<Color> colors; - points.push_back(Vector2(prev.offset*total_w,h)); - points.push_back(Vector2(prev.offset*total_w,0)); - points.push_back(Vector2(next.offset*total_w,0)); - points.push_back(Vector2(next.offset*total_w,h)); - colors.push_back(prev.color); - colors.push_back(prev.color); - colors.push_back(next.color); - colors.push_back(next.color); - draw_primitive(points,colors,Vector<Point2>()); - prev=next; - } - - for(int i=0;i<points.size();i++) { - - Color col=i==grabbed?Color(1,0.0,0.0,0.9):Color(1,1,1,0.8); - - draw_line(Vector2(points[i].offset*total_w,0),Vector2(points[i].offset*total_w,h-1),Color(0,0,0,0.7)); - draw_line(Vector2(points[i].offset*total_w-1,h/2),Vector2(points[i].offset*total_w-1,h-1),col); - draw_line(Vector2(points[i].offset*total_w+1,h/2),Vector2(points[i].offset*total_w+1,h-1),col); - draw_line(Vector2(points[i].offset*total_w-1,h/2),Vector2(points[i].offset*total_w+1,h/2),col); - draw_line(Vector2(points[i].offset*total_w-1,h-1),Vector2(points[i].offset*total_w+1,h-1),col); - - } - - if (grabbed!=-1) { - - draw_rect(Rect2(total_w+3,0,h,h),points[grabbed].color); - } - - if (has_focus()) { - - draw_line(Vector2(-1,-1),Vector2(total_w+1,-1),Color(1,1,1,0.6)); - draw_line(Vector2(total_w+1,-1),Vector2(total_w+1,h+1),Color(1,1,1,0.6)); - draw_line(Vector2(total_w+1,h+1),Vector2(-1,h+1),Color(1,1,1,0.6)); - draw_line(Vector2(-1,-1),Vector2(-1,h+1),Color(1,1,1,0.6)); - } - - } -} - -Size2 GraphColorRampEdit::get_minimum_size() const { - - return Vector2(0,16); -} - - -void GraphColorRampEdit::_color_changed(const Color& p_color) { - - if (grabbed==-1) - return; - points[grabbed].color=p_color; - update(); - emit_signal("ramp_changed"); - -} - -void GraphColorRampEdit::set_ramp(const Vector<float>& p_offsets,const Vector<Color>& p_colors) { - - ERR_FAIL_COND(p_offsets.size()!=p_colors.size()); - points.clear(); - for(int i=0;i<p_offsets.size();i++) { - Point p; - p.offset=p_offsets[i]; - p.color=p_colors[i]; - points.push_back(p); - } - - points.sort(); - update(); -} - -Vector<float> GraphColorRampEdit::get_offsets() const{ - Vector<float> ret; - for(int i=0;i<points.size();i++) - ret.push_back(points[i].offset); - return ret; -} -Vector<Color> GraphColorRampEdit::get_colors() const{ - - Vector<Color> ret; - for(int i=0;i<points.size();i++) - ret.push_back(points[i].color); - return ret; -} - - -void GraphColorRampEdit::_bind_methods(){ - - ClassDB::bind_method(D_METHOD("_gui_input"),&GraphColorRampEdit::_gui_input); - ClassDB::bind_method(D_METHOD("_color_changed"),&GraphColorRampEdit::_color_changed); - ADD_SIGNAL(MethodInfo("ramp_changed")); -} - -GraphColorRampEdit::GraphColorRampEdit(){ - - grabbed=-1; - grabbing=false; - set_focus_mode(FOCUS_ALL); - - popup = memnew( PopupPanel ); - picker = memnew( ColorPicker ); - popup->add_child(picker); - /popup->set_child_rect(picker); - add_child(popup); - -} -//////////// - -void GraphCurveMapEdit::_gui_input(const InputEvent& p_event) { - - if (p_event.type==InputEvent::KEY && p_event->is_pressed() && p_event->get_scancode()==KEY_DELETE && grabbed!=-1) { - - points.remove(grabbed); - grabbed=-1; - update(); - emit_signal("curve_changed"); - accept_event(); - } - - if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && p_event->is_pressed()) { - - update(); - Point2 p = Vector2(p_event->get_position().x,p_event->get_position().y)/get_size(); - p.y=1.0-p.y; - grabbed=-1; - grabbing=true; - - for(int i=0;i<points.size();i++) { - - Vector2 ps = p*get_size(); - Vector2 pt = Vector2(points[i].offset,points[i].height)*get_size(); - if (ps.distance_to(pt)<4) { - grabbed=i; - } - - } - - - //grab or select - if (grabbed!=-1) { - return; - } - //insert - - - Point np; - np.offset=p.x; - np.height=p.y; - - points.push_back(np); - points.sort(); - for(int i=0;i<points.size();i++) { - if (points[i].offset==p.x && points[i].height==p.y) { - grabbed=i; - break; - } - } - - emit_signal("curve_changed"); - - } - - if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && !p_event->is_pressed()) { - - if (grabbing) { - grabbing=false; - emit_signal("curve_changed"); - } - update(); - } - - if (p_event.type==InputEvent::MOUSE_MOTION && grabbing && grabbed != -1) { - - Point2 p = Vector2(p_event->get_position().x,p_event->get_position().y)/get_size(); - p.y=1.0-p.y; - - p.x = CLAMP(p.x,0.0,1.0); - p.y = CLAMP(p.y,0.0,1.0); - - bool valid=true; - - for(int i=0;i<points.size();i++) { - - if (points[i].offset==p.x && points[i].height==p.y && i!=grabbed) { - valid=false; - } - } - - if (!valid) - return; - - points[grabbed].offset=p.x; - points[grabbed].height=p.y; - - points.sort(); - for(int i=0;i<points.size();i++) { - if (points[i].offset==p.x && points[i].height==p.y) { - grabbed=i; - break; - } - } - - emit_signal("curve_changed"); - - update(); - } -} - -void GraphCurveMapEdit::_plot_curve(const Vector2& p_a,const Vector2& p_b,const Vector2& p_c,const Vector2& p_d) { - - float geometry[4][4]; - float tmp1[4][4]; - float tmp2[4][4]; - float deltas[4][4]; - double x, dx, dx2, dx3; - double y, dy, dy2, dy3; - double d, d2, d3; - int lastx, lasty; - int newx, newy; - int ntimes; - int i,j; - - int xmax=get_size().x; - int ymax=get_size().y; - - /* construct the geometry matrix from the segment */ - for (i = 0; i < 4; i++) { - geometry[i][2] = 0; - geometry[i][3] = 0; - } - - geometry[0][0] = (p_a[0] * xmax); - geometry[1][0] = (p_b[0] * xmax); - geometry[2][0] = (p_c[0] * xmax); - geometry[3][0] = (p_d[0] * xmax); - - geometry[0][1] = (p_a[1] * ymax); - geometry[1][1] = (p_b[1] * ymax); - geometry[2][1] = (p_c[1] * ymax); - geometry[3][1] = (p_d[1] * ymax); - - /* subdivide the curve ntimes (1000) times */ - ntimes = 4 * xmax; - /* ntimes can be adjusted to give a finer or coarser curve */ - d = 1.0 / ntimes; - d2 = d * d; - d3 = d * d * d; - - /* construct a temporary matrix for determining the forward differencing deltas */ - tmp2[0][0] = 0; tmp2[0][1] = 0; tmp2[0][2] = 0; tmp2[0][3] = 1; - tmp2[1][0] = d3; tmp2[1][1] = d2; tmp2[1][2] = d; tmp2[1][3] = 0; - tmp2[2][0] = 6*d3; tmp2[2][1] = 2*d2; tmp2[2][2] = 0; tmp2[2][3] = 0; - tmp2[3][0] = 6*d3; tmp2[3][1] = 0; tmp2[3][2] = 0; tmp2[3][3] = 0; - - /* compose the basis and geometry matrices */ - - static const float CR_basis[4][4] = { - { -0.5, 1.5, -1.5, 0.5 }, - { 1.0, -2.5, 2.0, -0.5 }, - { -0.5, 0.0, 0.5, 0.0 }, - { 0.0, 1.0, 0.0, 0.0 }, - }; - - for (i = 0; i < 4; i++) - { - for (j = 0; j < 4; j++) - { - tmp1[i][j] = (CR_basis[i][0] * geometry[0][j] + - CR_basis[i][1] * geometry[1][j] + - CR_basis[i][2] * geometry[2][j] + - CR_basis[i][3] * geometry[3][j]); - } - } - /* compose the above results to get the deltas matrix */ - - for (i = 0; i < 4; i++) - { - for (j = 0; j < 4; j++) - { - deltas[i][j] = (tmp2[i][0] * tmp1[0][j] + - tmp2[i][1] * tmp1[1][j] + - tmp2[i][2] * tmp1[2][j] + - tmp2[i][3] * tmp1[3][j]); - } - } - - - /* extract the x deltas */ - x = deltas[0][0]; - dx = deltas[1][0]; - dx2 = deltas[2][0]; - dx3 = deltas[3][0]; - - /* extract the y deltas */ - y = deltas[0][1]; - dy = deltas[1][1]; - dy2 = deltas[2][1]; - dy3 = deltas[3][1]; - - - lastx = CLAMP (x, 0, xmax); - lasty = CLAMP (y, 0, ymax); - - /* if (fix255) - { - cd->curve[cd->outline][lastx] = lasty; - } - else - { - cd->curve_ptr[cd->outline][lastx] = lasty; - if(gb_debug) printf("bender_plot_curve xmax:%d ymax:%d\n", (int)xmax, (int)ymax); - } -*/ - /* loop over the curve */ - for (i = 0; i < ntimes; i++) - { - /* increment the x values */ - x += dx; - dx += dx2; - dx2 += dx3; - - /* increment the y values */ - y += dy; - dy += dy2; - dy2 += dy3; - - newx = CLAMP ((Math::round (x)), 0, xmax); - newy = CLAMP ((Math::round (y)), 0, ymax); - - /* if this point is different than the last one...then draw it */ - if ((lastx != newx) || (lasty != newy)) { - draw_line(Vector2(lastx,ymax-lasty),Vector2(newx,ymax-newy),Color(0.8,0.8,0.8,0.8),2.0); - } - - lastx = newx; - lasty = newy; - } -} - - -void GraphCurveMapEdit::_notification(int p_what){ - - if (p_what==NOTIFICATION_DRAW) { - - draw_style_box(get_stylebox("bg","Tree"),Rect2(Point2(),get_size())); - - int w = get_size().x; - int h = get_size().y; - - Vector2 prev=Vector2(0,0); - Vector2 prev2=Vector2(0,0); - - for(int i=-1;i<points.size();i++) { - - Vector2 next; - Vector2 next2; - if (i+1>=points.size()) { - next=Vector2(1,1); - } else { - next=Vector2(points[i+1].offset,points[i+1].height); - } - - if (i+2>=points.size()) { - next2=Vector2(1,1); - } else { - next2=Vector2(points[i+2].offset,points[i+2].height); - } - - /*if (i==-1 && prev.offset==next.offset) { - prev=next; - continue; - }*/ - - _plot_curve(prev2,prev,next,next2); - - prev2=prev; - prev=next; - } - - for(int i=0;i<points.size();i++) { - - Color col=i==grabbed?Color(1,0.0,0.0,0.9):Color(1,1,1,0.8); - - - draw_rect(Rect2( Vector2(points[i].offset,1.0-points[i].height)*get_size()-Vector2(2,2),Vector2(5,5)),col); - } - - /* if (grabbed!=-1) { - - draw_rect(Rect2(total_w+3,0,h,h),points[grabbed].color); - } -*/ - if (has_focus()) { - - draw_line(Vector2(-1,-1),Vector2(w+1,-1),Color(1,1,1,0.6)); - draw_line(Vector2(w+1,-1),Vector2(w+1,h+1),Color(1,1,1,0.6)); - draw_line(Vector2(w+1,h+1),Vector2(-1,h+1),Color(1,1,1,0.6)); - draw_line(Vector2(-1,-1),Vector2(-1,h+1),Color(1,1,1,0.6)); - } - - } -} - -Size2 GraphCurveMapEdit::get_minimum_size() const { - - return Vector2(64,64); -} - - - -void GraphCurveMapEdit::set_points(const Vector<Vector2>& p_points) { - - - points.clear(); - for(int i=0;i<p_points.size();i++) { - Point p; - p.offset=p_points[i].x; - p.height=p_points[i].y; - points.push_back(p); - } - - points.sort(); - update(); -} - -Vector<Vector2> GraphCurveMapEdit::get_points() const { - Vector<Vector2> ret; - for(int i=0;i<points.size();i++) - ret.push_back(Vector2(points[i].offset,points[i].height)); - return ret; -} - -void GraphCurveMapEdit::_bind_methods(){ - - ClassDB::bind_method(D_METHOD("_gui_input"),&GraphCurveMapEdit::_gui_input); - ADD_SIGNAL(MethodInfo("curve_changed")); -} - -GraphCurveMapEdit::GraphCurveMapEdit(){ - - grabbed=-1; - grabbing=false; - set_focus_mode(FOCUS_ALL); - -} - - -////cbacks -/// -void ShaderGraphView::_scalar_const_changed(double p_value,int p_id) { - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Scalar Constant"),UndoRedo::MERGE_ENDS); - ur->add_do_method(graph.ptr(),"scalar_const_node_set_value",type,p_id,p_value); - ur->add_undo_method(graph.ptr(),"scalar_const_node_set_value",type,p_id,graph->scalar_const_node_get_value(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; -} - -void ShaderGraphView::_vec_const_changed(double p_value, int p_id,Array p_arr){ - - Vector3 val; - for(int i=0;i<p_arr.size();i++) { - val[i]=p_arr[i].call("get_val"); - } - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Vec Constant"),UndoRedo::MERGE_ENDS); - ur->add_do_method(graph.ptr(),"vec_const_node_set_value",type,p_id,val); - ur->add_undo_method(graph.ptr(),"vec_const_node_set_value",type,p_id,graph->vec_const_node_get_value(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; - -} -void ShaderGraphView::_rgb_const_changed(const Color& p_color, int p_id){ - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change RGB Constant"),UndoRedo::MERGE_ENDS); - ur->add_do_method(graph.ptr(),"rgb_const_node_set_value",type,p_id,p_color); - ur->add_undo_method(graph.ptr(),"rgb_const_node_set_value",type,p_id,graph->rgb_const_node_get_value(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; - -} -void ShaderGraphView::_scalar_op_changed(int p_op, int p_id){ - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Scalar Operator")); - ur->add_do_method(graph.ptr(),"scalar_op_node_set_op",type,p_id,p_op); - ur->add_undo_method(graph.ptr(),"scalar_op_node_set_op",type,p_id,graph->scalar_op_node_get_op(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; - -} -void ShaderGraphView::_vec_op_changed(int p_op, int p_id){ - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Vec Operator")); - ur->add_do_method(graph.ptr(),"vec_op_node_set_op",type,p_id,p_op); - ur->add_undo_method(graph.ptr(),"vec_op_node_set_op",type,p_id,graph->vec_op_node_get_op(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; -} -void ShaderGraphView::_vec_scalar_op_changed(int p_op, int p_id){ - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Vec Scalar Operator")); - ur->add_do_method(graph.ptr(),"vec_scalar_op_node_set_op",type,p_id,p_op); - ur->add_undo_method(graph.ptr(),"vec_scalar_op_node_set_op",type,p_id,graph->vec_scalar_op_node_get_op(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; - -} -void ShaderGraphView::_rgb_op_changed(int p_op, int p_id){ - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change RGB Operator")); - ur->add_do_method(graph.ptr(),"rgb_op_node_set_op",type,p_id,p_op); - ur->add_undo_method(graph.ptr(),"rgb_op_node_set_op",type,p_id,graph->rgb_op_node_get_op(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; -} -void ShaderGraphView::_xform_inv_rev_changed(bool p_enabled, int p_id){ - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Toggle Rot Only")); - ur->add_do_method(graph.ptr(),"xform_vec_mult_node_set_no_translation",type,p_id,p_enabled); - ur->add_undo_method(graph.ptr(),"xform_vec_mult_node_set_no_translation",type,p_id,graph->xform_vec_mult_node_get_no_translation(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; -} -void ShaderGraphView::_scalar_func_changed(int p_func, int p_id){ - - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Scalar Function")); - ur->add_do_method(graph.ptr(),"scalar_func_node_set_function",type,p_id,p_func); - ur->add_undo_method(graph.ptr(),"scalar_func_node_set_function",type,p_id,graph->scalar_func_node_get_function(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; -} -void ShaderGraphView::_vec_func_changed(int p_func, int p_id){ - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Vec Function")); - ur->add_do_method(graph.ptr(),"vec_func_node_set_function",type,p_id,p_func); - ur->add_undo_method(graph.ptr(),"vec_func_node_set_function",type,p_id,graph->vec_func_node_get_function(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; - -} -void ShaderGraphView::_scalar_input_changed(double p_value,int p_id){ - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Scalar Uniform"),UndoRedo::MERGE_ENDS); - ur->add_do_method(graph.ptr(),"scalar_input_node_set_value",type,p_id,p_value); - ur->add_undo_method(graph.ptr(),"scalar_input_node_set_value",type,p_id,graph->scalar_input_node_get_value(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; - -} -void ShaderGraphView::_vec_input_changed(double p_value, int p_id,Array p_arr){ - - Vector3 val; - for(int i=0;i<p_arr.size();i++) { - val[i]=p_arr[i].call("get_val"); - } - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Vec Uniform"),UndoRedo::MERGE_ENDS); - ur->add_do_method(graph.ptr(),"vec_input_node_set_value",type,p_id,val); - ur->add_undo_method(graph.ptr(),"vec_input_node_set_value",type,p_id,graph->vec_input_node_get_value(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; - -} -void ShaderGraphView::_xform_input_changed(int p_id, Node *p_button){ - - - ToolButton *tb = Object::cast_to<ToolButton>(p_button); - ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height)); - ped_popup->set_size(tb->get_size()); - edited_id=p_id; - edited_def=-1; - ped_popup->edit(NULL,"",Variant::TRANSFORM,graph->xform_input_node_get_value(type,p_id),PROPERTY_HINT_NONE,""); - ped_popup->popup(); - -} -void ShaderGraphView::_xform_const_changed(int p_id, Node *p_button){ - - ToolButton *tb = Object::cast_to<ToolButton>(p_button); - ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height)); - ped_popup->set_size(tb->get_size()); - edited_id=p_id; - edited_def=-1; - ped_popup->edit(NULL,"",Variant::TRANSFORM,graph->xform_const_node_get_value(type,p_id),PROPERTY_HINT_NONE,""); - ped_popup->popup(); - -} - -void ShaderGraphView::_rgb_input_changed(const Color& p_color, int p_id){ - - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change RGB Uniform"),UndoRedo::MERGE_ENDS); - ur->add_do_method(graph.ptr(),"rgb_input_node_set_value",type,p_id,p_color); - ur->add_undo_method(graph.ptr(),"rgb_input_node_set_value",type,p_id,graph->rgb_input_node_get_value(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; -} -void ShaderGraphView::_tex_input_change(int p_id, Node *p_button){ - - -} -void ShaderGraphView::_cube_input_change(int p_id){ - - -} - -void ShaderGraphView::_variant_edited() { - - if (edited_def != -1) { - - Variant v = ped_popup->get_variant(); - Variant v2 = graph->default_get_value(type,edited_id,edited_def); - if (v2.get_type() == Variant::NIL) - switch (v.get_type()) { - case Variant::VECTOR3: - v2=Vector3(); - break; - case Variant::REAL: - v2=0.0; - break; - case Variant::TRANSFORM: - v2=Transform(); - break; - case Variant::COLOR: - v2=Color(); - break; - default: {} - } - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Default Value")); - ur->add_do_method(graph.ptr(),"default_set_value",type,edited_id,edited_def, v); - ur->add_undo_method(graph.ptr(),"default_set_value",type,edited_id,edited_def, v2); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - ur->commit_action(); - return; - } - - if (graph->node_get_type(type,edited_id)==ShaderGraph::NODE_XFORM_CONST) { - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change XForm Uniform")); - ur->add_do_method(graph.ptr(),"xform_const_node_set_value",type,edited_id,ped_popup->get_variant()); - ur->add_undo_method(graph.ptr(),"xform_const_node_set_value",type,edited_id,graph->xform_const_node_get_value(type,edited_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - ur->commit_action(); - } - - - if (graph->node_get_type(type,edited_id)==ShaderGraph::NODE_XFORM_INPUT) { - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change XForm Uniform")); - ur->add_do_method(graph.ptr(),"xform_input_node_set_value",type,edited_id,ped_popup->get_variant()); - ur->add_undo_method(graph.ptr(),"xform_input_node_set_value",type,edited_id,graph->xform_input_node_get_value(type,edited_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - ur->commit_action(); - } - - if (graph->node_get_type(type,edited_id)==ShaderGraph::NODE_TEXTURE_INPUT) { - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Texture Uniform")); - ur->add_do_method(graph.ptr(),"texture_input_node_set_value",type,edited_id,ped_popup->get_variant()); - ur->add_undo_method(graph.ptr(),"texture_input_node_set_value",type,edited_id,graph->texture_input_node_get_value(type,edited_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - ur->commit_action(); - } - - if (graph->node_get_type(type,edited_id)==ShaderGraph::NODE_CUBEMAP_INPUT) { - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Cubemap Uniform")); - ur->add_do_method(graph.ptr(),"cubemap_input_node_set_value",type,edited_id,ped_popup->get_variant()); - ur->add_undo_method(graph.ptr(),"cubemap_input_node_set_value",type,edited_id,graph->cubemap_input_node_get_value(type,edited_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - ur->commit_action(); - } - -} - -void ShaderGraphView::_comment_edited(int p_id,Node* p_button) { - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - TextEdit *te=Object::cast_to<TextEdit>(p_button); - ur->create_action(TTR("Change Comment"),UndoRedo::MERGE_ENDS); - ur->add_do_method(graph.ptr(),"comment_node_set_text",type,p_id,te->get_text()); - ur->add_undo_method(graph.ptr(),"comment_node_set_text",type,p_id,graph->comment_node_get_text(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; - -} - -void ShaderGraphView::_color_ramp_changed(int p_id,Node* p_ramp) { - - GraphColorRampEdit *cr=Object::cast_to<GraphColorRampEdit>(p_ramp); - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - - - Vector<float> offsets=cr->get_offsets(); - Vector<Color> colors=cr->get_colors(); - - PoolVector<float> new_offsets; - PoolVector<Color> new_colors; - { - new_offsets.resize(offsets.size()); - new_colors.resize(colors.size()); - PoolVector<float>::Write ow=new_offsets.write(); - PoolVector<Color>::Write cw=new_colors.write(); - for(int i=0;i<new_offsets.size();i++) { - ow[i]=offsets[i]; - cw[i]=colors[i]; - } - - } - - - PoolVector<float> old_offsets=graph->color_ramp_node_get_offsets(type,p_id); - PoolVector<Color> old_colors=graph->color_ramp_node_get_colors(type,p_id); - - if (old_offsets.size()!=new_offsets.size()) - ur->create_action(TTR("Add/Remove to Color Ramp")); - else - ur->create_action(TTR("Modify Color Ramp"),UndoRedo::MERGE_ENDS); - - ur->add_do_method(graph.ptr(),"color_ramp_node_set_ramp",type,p_id,new_colors,new_offsets); - ur->add_undo_method(graph.ptr(),"color_ramp_node_set_ramp",type,p_id,old_colors,old_offsets); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; -} - -void ShaderGraphView::_curve_changed(int p_id,Node* p_curve) { - - GraphCurveMapEdit *cr=Object::cast_to<GraphCurveMapEdit>(p_curve); - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - - - Vector<Point2> points=cr->get_points(); - - PoolVector<Vector2> new_points; - { - new_points.resize(points.size()); - PoolVector<Vector2>::Write ow=new_points.write(); - for(int i=0;i<new_points.size();i++) { - ow[i]=points[i]; - } - - } - - - PoolVector<Vector2> old_points=graph->curve_map_node_get_points(type,p_id); - - if (old_points.size()!=new_points.size()) - ur->create_action(TTR("Add/Remove to Curve Map")); - else - ur->create_action(TTR("Modify Curve Map"),UndoRedo::MERGE_ENDS); - - ur->add_do_method(graph.ptr(),"curve_map_node_set_points",type,p_id,new_points); - ur->add_undo_method(graph.ptr(),"curve_map_node_set_points",type,p_id,old_points); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; -} - - -void ShaderGraphView::_input_name_changed(const String& p_name, int p_id, Node *p_line_edit) { - - LineEdit *le=Object::cast_to<LineEdit>(p_line_edit); - ERR_FAIL_COND(!le); - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Input Name")); - ur->add_do_method(graph.ptr(),"input_node_set_name",type,p_id,p_name); - ur->add_undo_method(graph.ptr(),"input_node_set_name",type,p_id,graph->input_node_get_name(type,p_id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - block_update=true; - ur->commit_action(); - block_update=false; - le->set_text(graph->input_node_get_name(type,p_id)); -} - -void ShaderGraphView::_tex_edited(int p_id,Node* p_button) { - - ToolButton *tb = Object::cast_to<ToolButton>(p_button); - ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height)); - ped_popup->set_size(tb->get_size()); - edited_id=p_id; - edited_def=-1; - ped_popup->edit(NULL,"",Variant::OBJECT,graph->texture_input_node_get_value(type,p_id),PROPERTY_HINT_RESOURCE_TYPE,"Texture"); -} - -void ShaderGraphView::_cube_edited(int p_id,Node* p_button) { - - ToolButton *tb = Object::cast_to<ToolButton>(p_button); - ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height)); - ped_popup->set_size(tb->get_size()); - edited_id=p_id; - edited_def=-1; - ped_popup->edit(NULL,"",Variant::OBJECT,graph->cubemap_input_node_get_value(type,p_id),PROPERTY_HINT_RESOURCE_TYPE,"CubeMap"); -} - - -//////////////view///////////// - - -void ShaderGraphView::_connection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot) { - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - - int from_idx=-1; - int to_idx=-1; - for (Map<int,GraphNode*>::Element *E=node_map.front();E;E=E->next()) { - - if (p_from==E->get()->get_name()) - from_idx=E->key(); - if (p_to==E->get()->get_name()) - to_idx=E->key(); - } - - ERR_FAIL_COND(from_idx==-1); - ERR_FAIL_COND(to_idx==-1); - - ur->create_action(TTR("Connect Graph Nodes")); - - List<ShaderGraph::Connection> conns; - - graph->get_node_connections(type,&conns); - //disconnect/reconnect dependencies - ur->add_undo_method(graph.ptr(),"disconnect_node",type,from_idx,p_from_slot,to_idx,p_to_slot); - for(List<ShaderGraph::Connection>::Element *E=conns.front();E;E=E->next()) { - - if (E->get().dst_id==to_idx && E->get().dst_slot==p_to_slot) { - ur->add_do_method(graph.ptr(),"disconnect_node",type,E->get().src_id,E->get().src_slot,E->get().dst_id,E->get().dst_slot); - ur->add_undo_method(graph.ptr(),"connect_node",type,E->get().src_id,E->get().src_slot,E->get().dst_id,E->get().dst_slot); - } - } - ur->add_do_method(graph.ptr(),"connect_node",type,from_idx,p_from_slot,to_idx,p_to_slot); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - ur->commit_action(); - - -} - -void ShaderGraphView::_disconnection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot) { - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - - int from_idx=-1; - int to_idx=-1; - for (Map<int,GraphNode*>::Element *E=node_map.front();E;E=E->next()) { - - if (p_from==E->get()->get_name()) - from_idx=E->key(); - if (p_to==E->get()->get_name()) - to_idx=E->key(); - } - - ERR_FAIL_COND(from_idx==-1); - ERR_FAIL_COND(to_idx==-1); - - if (!graph->is_node_connected(type,from_idx,p_from_slot,to_idx,p_to_slot)) - return; //nothing to disconnect - - ur->create_action(TTR("Disconnect Graph Nodes")); - - List<ShaderGraph::Connection> conns; - - graph->get_node_connections(type,&conns); - //disconnect/reconnect dependencies - ur->add_do_method(graph.ptr(),"disconnect_node",type,from_idx,p_from_slot,to_idx,p_to_slot); - ur->add_undo_method(graph.ptr(),"connect_node",type,from_idx,p_from_slot,to_idx,p_to_slot); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - ur->commit_action(); - - -} - -void ShaderGraphView::_node_removed(int p_id) { - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Remove Shader Graph Node")); - - ur->add_do_method(graph.ptr(),"node_remove",type,p_id); - ur->add_undo_method(graph.ptr(),"node_add",type,graph->node_get_type(type,p_id),p_id); - ur->add_undo_method(graph.ptr(),"node_set_state",type,p_id,graph->node_get_state(type,p_id)); - List<ShaderGraph::Connection> conns; - - graph->get_node_connections(type,&conns); - for(List<ShaderGraph::Connection>::Element *E=conns.front();E;E=E->next()) { - - if (E->get().dst_id==p_id || E->get().src_id==p_id) { - ur->add_undo_method(graph.ptr(),"connect_node",type,E->get().src_id,E->get().src_slot,E->get().dst_id,E->get().dst_slot); - } - } - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - ur->commit_action(); - -} - -void ShaderGraphView::_begin_node_move() -{ - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Move Shader Graph Node")); -} - -void ShaderGraphView::_node_moved(const Vector2& p_from, const Vector2& p_to,int p_id) { - - - ERR_FAIL_COND(!node_map.has(p_id)); - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->add_do_method(this,"_move_node",p_id,p_to); - ur->add_undo_method(this,"_move_node",p_id,p_from); -} - -void ShaderGraphView::_end_node_move() -{ - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->commit_action(); -} - -void ShaderGraphView::_move_node(int p_id,const Vector2& p_to) { - - ERR_FAIL_COND(!node_map.has(p_id)); - node_map[p_id]->set_offset(p_to); - graph->node_set_position(type,p_id,p_to); -} - -void ShaderGraphView::_duplicate_nodes_request() -{ - Array s_id; - - for(Map<int,GraphNode*>::Element *E=node_map.front();E;E=E->next()) { - ShaderGraph::NodeType t=graph->node_get_type(type, E->key()); - if (t==ShaderGraph::NODE_OUTPUT || t==ShaderGraph::NODE_INPUT) - continue; - GraphNode *gn = E->get(); - if (gn && gn->is_selected()) - s_id.push_back(E->key()); - } - - if (s_id.size()==0) - return; - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Duplicate Graph Node(s)")); - ur->add_do_method(this,"_duplicate_nodes",s_id); - List<int> n_ids = graph->generate_ids(type, s_id.size()); - for (List<int>::Element *E=n_ids.front();E;E=E->next()) - ur->add_undo_method(graph.ptr(),"node_remove",type,E->get()); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - ur->commit_action(); - -} - -void ShaderGraphView::_duplicate_nodes(const Array &p_nodes) -{ - List<int> n = List<int>(); - for (int i=0; i<p_nodes.size();i++) - n.push_back(p_nodes.get(i)); - graph->duplicate_nodes(type, n); - call_deferred("_update_graph"); -} - -void ShaderGraphView::_delete_nodes_request() -{ - List<int> s_id=List<int>(); - - for(Map<int,GraphNode*>::Element *E=node_map.front();E;E=E->next()) { - ShaderGraph::NodeType t=graph->node_get_type(type, E->key()); - if (t==ShaderGraph::NODE_OUTPUT) - continue; - GraphNode *gn = E->get(); - if (gn && gn->is_selected()) - s_id.push_back(E->key()); - } - - if (s_id.size()==0) - return; - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Delete Shader Graph Node(s)")); - - for (List<int>::Element *N=s_id.front();N;N=N->next()) { - ur->add_do_method(graph.ptr(),"node_remove",type,N->get()); - ur->add_undo_method(graph.ptr(),"node_add",type,graph->node_get_type(type,N->get()),N->get()); - ur->add_undo_method(graph.ptr(),"node_set_state",type,N->get(),graph->node_get_state(type,N->get())); - List<ShaderGraph::Connection> conns; - - graph->get_node_connections(type,&conns); - for(List<ShaderGraph::Connection>::Element *E=conns.front();E;E=E->next()) { - - if (E->get().dst_id==N->get() || E->get().src_id==N->get()) { - ur->add_undo_method(graph.ptr(),"connect_node",type,E->get().src_id,E->get().src_slot,E->get().dst_id,E->get().dst_slot); - } - } - } - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - ur->commit_action(); - -} - -void ShaderGraphView::_default_changed(int p_id, Node *p_button, int p_param, int v_type, String p_hint) -{ - ToolButton *tb = Object::cast_to<ToolButton>(p_button); - ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height)); - ped_popup->set_size(tb->get_size()); - edited_id=p_id; - edited_def=p_param; - Variant::Type vt = (Variant::Type)v_type; - Variant v = graph->default_get_value(type,p_id,edited_def); - int h=PROPERTY_HINT_NONE; - if (v.get_type() == Variant::NIL) - switch (vt) { - case Variant::VECTOR3: - v=Vector3(); - break; - case Variant::REAL: - h=PROPERTY_HINT_RANGE; - v=0.0; - break; - case Variant::TRANSFORM: - v=Transform(); - break; - case Variant::COLOR: - h=PROPERTY_HINT_COLOR_NO_ALPHA; - v=Color(); - break; - default: {} - } - - ped_popup->edit(NULL,"",vt,v,h,p_hint); - - ped_popup->popup(); -} - -ToolButton *ShaderGraphView::make_label(String text, Variant::Type v_type) { - ToolButton *l = memnew( ToolButton ); - l->set_text(text); - l->set_text_align(ToolButton::ALIGN_LEFT); - l->add_style_override("hover", l->get_stylebox("normal", "ToolButton")); - l->add_style_override("pressed", l->get_stylebox("normal", "ToolButton")); - l->add_style_override("focus", l->get_stylebox("normal", "ToolButton")); - switch (v_type) { - case Variant::REAL: - l->set_icon(ped_popup->get_icon("Real", "EditorIcons")); - break; - case Variant::VECTOR3: - l->set_icon(ped_popup->get_icon("Vector", "EditorIcons")); - break; - case Variant::TRANSFORM: - l->set_icon(ped_popup->get_icon("Matrix", "EditorIcons")); - break; - case Variant::COLOR: - l->set_icon(ped_popup->get_icon("Color", "EditorIcons")); - break; - default: {} - } - return l; -} - -ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int param,Variant::Type v_type, String p_hint) { - ToolButton *edit = memnew( ToolButton ); - edit->set_text(text); - edit->set_text_align(ToolButton::ALIGN_LEFT); - edit->set_flat(false); - edit->add_style_override("normal", gn->get_stylebox("defaultframe", "GraphNode")); - edit->add_style_override("hover", gn->get_stylebox("defaultframe", "GraphNode")); - edit->add_style_override("pressed", gn->get_stylebox("defaultframe", "GraphNode")); - edit->add_style_override("focus", gn->get_stylebox("defaultfocus", "GraphNode")); - edit->connect("pressed",this,"_default_changed",varray(p_id,edit,param,v_type,p_hint)); - - switch (v_type) { - case Variant::REAL: - edit->set_icon(ped_popup->get_icon("Real", "EditorIcons")); - break; - case Variant::VECTOR3: - edit->set_icon(ped_popup->get_icon("Vector", "EditorIcons")); - break; - case Variant::TRANSFORM: - edit->set_icon(ped_popup->get_icon("Matrix", "EditorIcons")); - break; - case Variant::COLOR: { - Image icon_color = Image(15,15,false,Image::FORMAT_RGB8); - Color c = graph->default_get_value(type,p_id,param); - for (int x=1;x<14;x++) - for (int y=1;y<14;y++) - icon_color.set_pixel(x,y,c); - Ref<ImageTexture> t; - t.instance(); - t->create_from_image(icon_color); - edit->set_icon(t); - } break; - default: {} - } - return edit; -} - -void ShaderGraphView::_create_node(int p_id) { - - - GraphNode *gn = memnew( GraphNode ); - gn->set_show_close_button(true); - Color typecol[4]={ - Color(0.9,0.4,1), - Color(0.8,1,0.2), - Color(1,0.2,0.2), - Color(0,1,1) - }; - - const String hint_spin = "-65536,65535,0.001"; - const String hint_slider = "0.0,1.0,0.01,slider"; - - - switch(graph->node_get_type(type,p_id)) { - - case ShaderGraph::NODE_INPUT: { - - gn->set_title("Input"); - - List<ShaderGraph::SlotInfo> si; - ShaderGraph::get_input_output_node_slot_info(graph->get_mode(),type,&si); - - int idx=0; - for (List<ShaderGraph::SlotInfo>::Element *E=si.front();E;E=E->next()) { - ShaderGraph::SlotInfo& s=E->get(); - if (s.dir==ShaderGraph::SLOT_IN) { - - Label *l= memnew( Label ); - l->set_text(s.name); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child(l); - gn->set_slot(idx,false,0,Color(),true,s.type,typecol[s.type]); - idx++; - } - } - - } break; // all inputs (case Shader type dependent) - case ShaderGraph::NODE_SCALAR_CONST: { - gn->set_title("Scalar"); - SpinBox *sb = memnew( SpinBox ); - sb->set_min(-100000); - sb->set_max(100000); - sb->set_step(0.001); - sb->set_val(graph->scalar_const_node_get_value(type,p_id)); - sb->connect("value_changed",this,"_scalar_const_changed",varray(p_id)); - gn->add_child(sb); - gn->set_slot(0,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - - } break; //scalar constant - case ShaderGraph::NODE_VEC_CONST: { - - gn->set_title("Vector"); - Array v3p(true); - for(int i=0;i<3;i++) { - HBoxContainer *hbc = memnew( HBoxContainer ); - Label *l = memnew( Label ); - l->set_text(String::chr('X'+i)); - hbc->add_child(l); - SpinBox *sb = memnew( SpinBox ); - sb->set_h_size_flags(Control::SIZE_EXPAND_FILL); - sb->set_min(-100000); - sb->set_max(100000); - sb->set_step(0.001); - sb->set_val(graph->vec_const_node_get_value(type,p_id)[i]); - sb->connect("value_changed",this,"_vec_const_changed",varray(p_id,v3p)); - v3p.push_back(sb); - hbc->add_child(sb); - gn->add_child(hbc); - } - gn->set_slot(0,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - - } break; //vec3 constant - case ShaderGraph::NODE_RGB_CONST: { - - gn->set_title("Color"); - ColorPickerButton *cpb = memnew( ColorPickerButton ); - cpb->set_color(graph->rgb_const_node_get_value(type,p_id)); - cpb->connect("color_changed",this,"_rgb_const_changed",varray(p_id)); - gn->add_child(cpb); - Label *l = memnew( Label ); - l->set_text("RGB"); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child(l); - l = memnew( Label ); - l->set_text("Alpha"); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child(l); - - gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(2,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - - } break; //rgb constant (shows a color picker instead) - case ShaderGraph::NODE_XFORM_CONST: { - gn->set_title("XForm"); - ToolButton *edit = memnew( ToolButton ); - edit->set_text("edit..."); - edit->connect("pressed",this,"_xform_const_changed",varray(p_id,edit)); - gn->add_child(edit); - gn->set_slot(0,false,0,Color(),true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM]); - - } break; // 4x4 matrix constant - case ShaderGraph::NODE_TIME: { - - gn->set_title("Time"); - Label *l = memnew( Label ); - l->set_text("(s)"); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child(l); - gn->set_slot(0,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - - } break; // time in seconds - case ShaderGraph::NODE_SCREEN_TEX: { - - gn->set_title("ScreenTex"); - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (!graph->is_slot_connected(type,p_id,0)) { - Vector3 v = graph->default_get_value(type, p_id, 0); - hbc->add_child(make_editor("UV: " + v,gn,p_id,0,Variant::VECTOR3)); - } else { - hbc->add_child(make_label("UV",Variant::VECTOR3)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("RGB"))); - gn->add_child(hbc); - gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - - } break; // screen texture sampler (takes UV) (only usable in fragment case Shader) - case ShaderGraph::NODE_SCALAR_OP: { - - gn->set_title("ScalarOp"); - static const char* op_name[ShaderGraph::SCALAR_MAX_OP]={ - ("Add"), - ("Sub"), - ("Mul"), - ("Div"), - ("Mod"), - ("Pow"), - ("Max"), - ("Min"), - ("Atan2") - }; - - OptionButton *ob = memnew( OptionButton ); - for(int i=0;i<ShaderGraph::SCALAR_MAX_OP;i++) { - - ob->add_item(op_name[i],i); - } - - ob->select(graph->scalar_op_node_get_op(type,p_id)); - ob->connect("item_selected",this,"_scalar_op_changed",varray(p_id)); - gn->add_child(ob); - - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("a",Variant::REAL)); - } else { - float v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("a: ")+Variant(v),gn,p_id,0,Variant::REAL,hint_spin)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("out"))); - gn->add_child(hbc); - if (graph->is_slot_connected(type, p_id, 1)) { - gn->add_child(make_label("b",Variant::REAL)); - } else { - float v = graph->default_get_value(type,p_id,1); - gn->add_child(make_editor(String("b: ")+Variant(v),gn,p_id,1,Variant::REAL,hint_spin)); - } - - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color()); - - - } break; // scalar vs scalar op (mul: { } break; add: { } break; div: { } break; etc) - case ShaderGraph::NODE_VEC_OP: { - - gn->set_title("VecOp"); - static const char* op_name[ShaderGraph::VEC_MAX_OP]={ - ("Add"), - ("Sub"), - ("Mul"), - ("Div"), - ("Mod"), - ("Pow"), - ("Max"), - ("Min"), - ("Cross") - }; - - OptionButton *ob = memnew( OptionButton ); - for(int i=0;i<ShaderGraph::VEC_MAX_OP;i++) { - - ob->add_item(op_name[i],i); - } - - ob->select(graph->vec_op_node_get_op(type,p_id)); - ob->connect("item_selected",this,"_vec_op_changed",varray(p_id)); - gn->add_child(ob); - - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("a",Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("a: ")+v,gn,p_id,0,Variant::VECTOR3)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("out"))); - gn->add_child(hbc); - if (graph->is_slot_connected(type, p_id, 1)) { - gn->add_child(make_label("b",Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,1); - gn->add_child(make_editor(String("b: ")+v,gn,p_id,1,Variant::VECTOR3)); - } - - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color()); - - - } break; // vec3 vs vec3 op (mul: { } break;ad: { } break;div: { } break;crossprod: { } break;etc) - case ShaderGraph::NODE_VEC_SCALAR_OP: { - - gn->set_title("VecScalarOp"); - static const char* op_name[ShaderGraph::VEC_SCALAR_MAX_OP]={ - ("Mul"), - ("Div"), - ("Pow"), - }; - - OptionButton *ob = memnew( OptionButton ); - for(int i=0;i<ShaderGraph::VEC_SCALAR_MAX_OP;i++) { - - ob->add_item(op_name[i],i); - } - - ob->select(graph->vec_scalar_op_node_get_op(type,p_id)); - ob->connect("item_selected",this,"_vec_scalar_op_changed",varray(p_id)); - gn->add_child(ob); - - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("a",Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("a: ")+v,gn,p_id,0,Variant::VECTOR3)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("out"))); - gn->add_child(hbc); - - if (graph->is_slot_connected(type, p_id, 1)) { - gn->add_child(make_label("b",Variant::REAL)); - } else { - float v = graph->default_get_value(type,p_id,1); - gn->add_child(make_editor(String("b: ")+Variant(v),gn,p_id,1,Variant::REAL,hint_spin)); - } - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color()); - - - } break; // vec3 vs scalar op (mul: { } break; add: { } break; div: { } break; etc) - case ShaderGraph::NODE_RGB_OP: { - - gn->set_title("RGB Op"); - static const char* op_name[ShaderGraph::RGB_MAX_OP]={ - ("Screen"), - ("Difference"), - ("Darken"), - ("Lighten"), - ("Overlay"), - ("Dodge"), - ("Burn"), - ("SoftLight"), - ("HardLight") - }; - - OptionButton *ob = memnew( OptionButton ); - for(int i=0;i<ShaderGraph::RGB_MAX_OP;i++) { - - ob->add_item(op_name[i],i); - } - - ob->select(graph->rgb_op_node_get_op(type,p_id)); - ob->connect("item_selected",this,"_rgb_op_changed",varray(p_id)); - gn->add_child(ob); - - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("a",Variant::COLOR)); - } else { - hbc->add_child(make_editor(String("a: "),gn,p_id,0,Variant::COLOR)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("out"))); - gn->add_child(hbc); - if (graph->is_slot_connected(type, p_id, 1)) { - gn->add_child(make_label("b",Variant::COLOR)); - } else { - gn->add_child(make_editor(String("b: "),gn,p_id,1,Variant::COLOR)); - } - - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color()); - - } break; // vec3 vs vec3 rgb op (with scalar amount): { } break; like brighten: { } break; darken: { } break; burn: { } break; dodge: { } break; multiply: { } break; etc. - case ShaderGraph::NODE_XFORM_MULT: { - - gn->set_title("XFMult"); - HBoxContainer *hbc = memnew( HBoxContainer ); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("a",Variant::TRANSFORM)); - } else { - hbc->add_child(make_editor(String("a: edit..."),gn,p_id,0,Variant::TRANSFORM)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("out"))); - gn->add_child(hbc); - if (graph->is_slot_connected(type, p_id, 1)) { - gn->add_child(make_label("b",Variant::TRANSFORM)); - } else { - gn->add_child(make_editor(String("b: edit..."),gn,p_id,1,Variant::TRANSFORM)); - } - - gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM],true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM]); - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM],false,0,Color()); - - - } break; // mat4 x mat4 - case ShaderGraph::NODE_XFORM_VEC_MULT: { - - gn->set_title("XFVecMult"); - - CheckBox *button = memnew (CheckBox("RotOnly")); - button->set_pressed(graph->xform_vec_mult_node_get_no_translation(type,p_id)); - button->connect("toggled",this,"_xform_inv_rev_changed",varray(p_id)); - - gn->add_child(button); - - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("xf",Variant::TRANSFORM)); - } else { - hbc->add_child(make_editor(String("xf: edit..."),gn,p_id,0,Variant::TRANSFORM)); - } - hbc->add_spacer(); - Label *l = memnew(Label("out")); - l->set_align(Label::ALIGN_RIGHT); - hbc->add_child( l); - gn->add_child(hbc); - if (graph->is_slot_connected(type, p_id, 1)) { - gn->add_child(make_label("a",Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,1); - gn->add_child(make_editor(String("a: ")+v,gn,p_id,1,Variant::VECTOR3)); - } - - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color()); - - } break; - case ShaderGraph::NODE_XFORM_VEC_INV_MULT: { - - gn->set_title("XFVecInvMult"); - - - CheckBox *button = memnew( CheckBox("RotOnly")); - button->set_pressed(graph->xform_vec_mult_node_get_no_translation(type,p_id)); - button->connect("toggled",this,"_xform_inv_rev_changed",varray(p_id)); - - gn->add_child(button); - - if (graph->is_slot_connected(type, p_id, 0)) { - gn->add_child(make_label("a",Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,0); - gn->add_child(make_editor(String("a: ")+v,gn,p_id,0,Variant::VECTOR3)); - } - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 1)) { - hbc->add_child(make_label("xf", Variant::TRANSFORM)); - } else { - hbc->add_child(make_editor(String("xf: edit..."),gn,p_id,1,Variant::TRANSFORM)); - } - hbc->add_spacer(); - Label *l = memnew(Label("out")); - l->set_align(Label::ALIGN_RIGHT); - hbc->add_child( l); - gn->add_child(hbc); - - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color()); - gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - - - } break; // mat4 x vec3 inverse mult (with no-translation option) - case ShaderGraph::NODE_SCALAR_FUNC: { - - gn->set_title("ScalarFunc"); - static const char* func_name[ShaderGraph::SCALAR_MAX_FUNC]={ - ("Sin"), - ("Cos"), - ("Tan"), - ("ASin"), - ("ACos"), - ("ATan"), - ("SinH"), - ("CosH"), - ("TanH"), - ("Log"), - ("Exp"), - ("Sqrt"), - ("Abs"), - ("Sign"), - ("Floor"), - ("Round"), - ("Ceil"), - ("Frac"), - ("Satr"), - ("Neg") - }; - - OptionButton *ob = memnew( OptionButton ); - for(int i=0;i<ShaderGraph::SCALAR_MAX_FUNC;i++) { - - ob->add_item(func_name[i],i); - } - - ob->select(graph->scalar_func_node_get_function(type,p_id)); - ob->connect("item_selected",this,"_scalar_func_changed",varray(p_id)); - gn->add_child(ob); - - HBoxContainer *hbc = memnew( HBoxContainer ); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("in", Variant::REAL)); - } else { - float v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("in: ")+Variant(v),gn,p_id,0,Variant::REAL,hint_spin)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("out"))); - gn->add_child(hbc); - - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - - - } break; // scalar function (sin: { } break; cos: { } break; etc) - case ShaderGraph::NODE_VEC_FUNC: { - - - - gn->set_title("VecFunc"); - static const char* func_name[ShaderGraph::VEC_MAX_FUNC]={ - ("Normalize"), - ("Saturate"), - ("Negate"), - ("Reciprocal"), - ("RGB to HSV"), - ("HSV to RGB"), - }; - - OptionButton *ob = memnew( OptionButton ); - for(int i=0;i<ShaderGraph::VEC_MAX_FUNC;i++) { - - ob->add_item(func_name[i],i); - } - - ob->select(graph->vec_func_node_get_function(type,p_id)); - ob->connect("item_selected",this,"_vec_func_changed",varray(p_id)); - gn->add_child(ob); - - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("in", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("in: ")+v,gn,p_id,0,Variant::VECTOR3)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("out"))); - gn->add_child(hbc); - - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - - } break; // vector function (normalize: { } break; negate: { } break; reciprocal: { } break; rgb2hsv: { } break; hsv2rgb: { } break; etc: { } break; etc) - case ShaderGraph::NODE_VEC_LEN: { - gn->set_title("VecLength"); - HBoxContainer *hbc = memnew( HBoxContainer ); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("in", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("in: ")+v,gn,p_id,0,Variant::VECTOR3)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("len"))); - gn->add_child(hbc); - - gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - - } break; // vec3 length - case ShaderGraph::NODE_DOT_PROD: { - - gn->set_title("DotProduct"); - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("a", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("a: ")+v,gn,p_id,0,Variant::VECTOR3)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("dp"))); - gn->add_child(hbc); - if (graph->is_slot_connected(type, p_id, 1)) { - gn->add_child(make_label("b", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,1); - gn->add_child(make_editor(String("b: ")+v,gn,p_id,1,Variant::VECTOR3)); - } - - gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color()); - - } break; // vec3 . vec3 (dot product -> scalar output) - case ShaderGraph::NODE_VEC_TO_SCALAR: { - - gn->set_title("Vec2Scalar"); - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("vec", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("vec: ")+v,gn,p_id,0,Variant::VECTOR3)); - } - hbc->add_spacer(); - Label *l=memnew(Label("x")); - l->set_align(Label::ALIGN_RIGHT); - hbc->add_child( l); - gn->add_child(hbc); - l=memnew(Label("y")); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child( l ); - l=memnew(Label("z")); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child( l); - - gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - gn->set_slot(2,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - - - - - } break; // 1 vec3 input: { } break; 3 scalar outputs - case ShaderGraph::NODE_SCALAR_TO_VEC: { - - gn->set_title("Scalar2Vec"); - HBoxContainer *hbc = memnew( HBoxContainer ); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("x", Variant::REAL)); - } else { - float v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("x: ")+Variant(v),gn,p_id,0,Variant::REAL)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("vec"))); - gn->add_child(hbc); - if (graph->is_slot_connected(type, p_id, 1)) { - gn->add_child(make_label("y", Variant::REAL)); - } else { - float v = graph->default_get_value(type,p_id,1); - gn->add_child(make_editor(String("y: ")+Variant(v),gn,p_id,1,Variant::REAL)); - } - if (graph->is_slot_connected(type, p_id, 2)) { - gn->add_child(make_label("in", Variant::REAL)); - } else { - float v = graph->default_get_value(type,p_id,2); - gn->add_child(make_editor(String("in: ")+Variant(v),gn,p_id,2,Variant::REAL)); - } - - gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color()); - gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color()); - - } break; // 3 scalar input: { } break; 1 vec3 output - case ShaderGraph::NODE_VEC_TO_XFORM: { - - gn->set_title("Vec2XForm"); - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("x", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("x: ")+v,gn,p_id,0,Variant::VECTOR3)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("xf"))); - gn->add_child(hbc); - if (graph->is_slot_connected(type, p_id, 1)) { - gn->add_child(make_label("y", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,1); - gn->add_child(make_editor(String("y: ")+v,gn,p_id,1,Variant::VECTOR3)); - } - if (graph->is_slot_connected(type, p_id, 2)) { - gn->add_child(make_label("z", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,2); - gn->add_child(make_editor(String("z: ")+v,gn,p_id,2,Variant::VECTOR3)); - } - if (graph->is_slot_connected(type, p_id, 3)) { - gn->add_child(make_label("ofs", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,3); - gn->add_child(make_editor(String("ofs: ")+v,gn,p_id,3,Variant::VECTOR3)); - } - - gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM]); - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color()); - gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color()); - gn->set_slot(3,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color()); - - } break; // 3 vec input: { } break; 1 xform output - case ShaderGraph::NODE_XFORM_TO_VEC: { - - gn->set_title("XForm2Vec"); - - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("fx", Variant::TRANSFORM)); - } else { - hbc->add_child(make_editor(String("fx: edit..."),gn,p_id,0,Variant::TRANSFORM)); - } - hbc->add_spacer(); - Label *l=memnew(Label("x")); - l->set_align(Label::ALIGN_RIGHT); - hbc->add_child( l); - gn->add_child(hbc); - l=memnew(Label("y")); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child( l ); - l=memnew(Label("z")); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child( l); - l=memnew(Label("ofs")); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child( l); - - gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(2,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(3,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - - } break; // 3 vec input: { } break; 1 xform output - case ShaderGraph::NODE_SCALAR_INTERP: { - - gn->set_title("ScalarInterp"); - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("a", Variant::REAL)); - } else { - float v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("a: ")+Variant(v),gn,p_id,0,Variant::REAL,hint_spin)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("interp"))); - gn->add_child(hbc); - if (graph->is_slot_connected(type, p_id, 1)) { - gn->add_child(make_label("b", Variant::REAL)); - } else { - float v = graph->default_get_value(type,p_id,1); - gn->add_child(make_editor(String("b: ")+Variant(v),gn,p_id,1,Variant::REAL,hint_spin)); - } - if (graph->is_slot_connected(type, p_id, 2)) { - gn->add_child(make_label("c", Variant::REAL)); - } else { - float v = graph->default_get_value(type,p_id,2); - gn->add_child(make_editor(String("c: ")+Variant(v),gn,p_id,2,Variant::REAL,hint_slider)); - } - - gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color()); - gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color()); - - - } break; // scalar interpolation (with optional curve) - case ShaderGraph::NODE_VEC_INTERP: { - - gn->set_title("VecInterp"); - HBoxContainer *hbc = memnew( HBoxContainer ); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("a", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("a: ")+v,gn,p_id,0,Variant::VECTOR3)); - } - hbc->add_spacer(); - hbc->add_child( memnew(Label("interp"))); - gn->add_child(hbc); - if (graph->is_slot_connected(type, p_id, 1)) { - gn->add_child(make_label("b", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,1); - gn->add_child(make_editor(String("b: ")+v,gn,p_id,1,Variant::VECTOR3)); - } - if (graph->is_slot_connected(type, p_id, 2)) { - gn->add_child(make_label("c", Variant::REAL)); - } else { - float v = graph->default_get_value(type,p_id,2); - gn->add_child(make_editor(String("c: ")+Variant(v),gn,p_id,2,Variant::REAL,hint_slider)); - } - - gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],false,0,Color()); - gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],false,0,Color()); - - } break; // vec3 interpolation (with optional curve) - case ShaderGraph::NODE_COLOR_RAMP: { - - gn->set_title("ColorRamp"); - GraphColorRampEdit * ramp = memnew( GraphColorRampEdit ); - - PoolVector<real_t> offsets = graph->color_ramp_node_get_offsets(type,p_id); - PoolVector<Color> colors = graph->color_ramp_node_get_colors(type,p_id); - - int oc = offsets.size(); - - if (oc) { - PoolVector<real_t>::Read rofs = offsets.read(); - PoolVector<Color>::Read rcol = colors.read(); - - Vector<float> ofsv; - Vector<Color> colorv; - for(int i=0;i<oc;i++) { - ofsv.push_back(rofs[i]); - colorv.push_back(rcol[i]); - } - - ramp->set_ramp(ofsv,colorv); - - } - - ramp->connect("ramp_changed",this,"_color_ramp_changed",varray(p_id,ramp)); - ramp->set_custom_minimum_size(Size2(128,1)); - gn->add_child(ramp); - - - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("c", Variant::REAL)); - } else { - float v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("c: ")+Variant(v),gn,p_id,0,Variant::REAL,hint_slider)); - } - hbc->add_spacer(); - Label *l=memnew(Label("rgb")); - l->set_align(Label::ALIGN_RIGHT); - hbc->add_child( l); - gn->add_child(hbc); - l=memnew(Label("alpha")); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child( l); - - - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(2,false,ShaderGraph::SLOT_MAX,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - - - } break; // scalar interpolation (with optional curve) - case ShaderGraph::NODE_CURVE_MAP: { - - gn->set_title("CurveMap"); - GraphCurveMapEdit * map = memnew( GraphCurveMapEdit ); - - PoolVector<Vector2> points = graph->curve_map_node_get_points(type,p_id); - - int oc = points.size(); - - if (oc) { - PoolVector<Vector2>::Read rofs = points.read(); - - - Vector<Vector2> ofsv; - for(int i=0;i<oc;i++) { - ofsv.push_back(rofs[i]); - } - - map->set_points(ofsv); - - } - map->connect("curve_changed",this,"_curve_changed",varray(p_id,map)); - - //map->connect("map_changed",this,"_curve_map_changed",varray(p_id,map)); - map->set_custom_minimum_size(Size2(128,64)); - gn->add_child(map); - - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("c", Variant::REAL)); - } else { - float v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("c: ")+Variant(v),gn,p_id,0,Variant::REAL,hint_slider)); - } - hbc->add_spacer(); - Label *l=memnew(Label("cmap")); - l->set_align(Label::ALIGN_RIGHT); - hbc->add_child( l); - gn->add_child(hbc); - - - gn->set_slot(1,true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR],true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - - - } break; // scalar interpolation (with optional curve) - - case ShaderGraph::NODE_SCALAR_INPUT: { - - gn->set_title("ScalarUniform"); - LineEdit *le = memnew( LineEdit ); - gn->add_child(le); - le->set_text(graph->input_node_get_name(type,p_id)); - le->connect("text_entered",this,"_input_name_changed",varray(p_id,le)); - SpinBox *sb = memnew( SpinBox ); - sb->set_min(-100000); - sb->set_max(100000); - sb->set_step(0.001); - sb->set_val(graph->scalar_input_node_get_value(type,p_id)); - sb->connect("value_changed",this,"_scalar_input_changed",varray(p_id)); - gn->add_child(sb); - gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - - } break; // scalar uniform (assignable in material) - case ShaderGraph::NODE_VEC_INPUT: { - - gn->set_title("VectorUniform"); - LineEdit *le = memnew( LineEdit ); - gn->add_child(le); - le->set_text(graph->input_node_get_name(type,p_id)); - le->connect("text_entered",this,"_input_name_changed",varray(p_id,le)); - Array v3p(true); - for(int i=0;i<3;i++) { - HBoxContainer *hbc = memnew( HBoxContainer ); - Label *l = memnew( Label ); - l->set_text(String::chr('X'+i)); - hbc->add_child(l); - SpinBox *sb = memnew( SpinBox ); - sb->set_h_size_flags(Control::SIZE_EXPAND_FILL); - sb->set_min(-100000); - sb->set_max(100000); - sb->set_step(0.001); - sb->set_val(graph->vec_input_node_get_value(type,p_id)[i]); - sb->connect("value_changed",this,"_vec_input_changed",varray(p_id,v3p)); - v3p.push_back(sb); - hbc->add_child(sb); - gn->add_child(hbc); - } - gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - - } break; // vec3 uniform (assignable in material) - case ShaderGraph::NODE_RGB_INPUT: { - - gn->set_title("ColorUniform"); - LineEdit *le = memnew( LineEdit ); - gn->add_child(le); - le->set_text(graph->input_node_get_name(type,p_id)); - le->connect("text_entered",this,"_input_name_changed",varray(p_id,le)); - ColorPickerButton *cpb = memnew( ColorPickerButton ); - cpb->set_color(graph->rgb_input_node_get_value(type,p_id)); - cpb->connect("color_changed",this,"_rgb_input_changed",varray(p_id)); - gn->add_child(cpb); - Label *l = memnew( Label ); - l->set_text("RGB"); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child(l); - l = memnew( Label ); - l->set_text("Alpha"); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child(l); - - gn->set_slot(2,false,0,Color(),true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(3,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - - - } break; // color uniform (assignable in material) - case ShaderGraph::NODE_XFORM_INPUT: { - gn->set_title("XFUniform"); - LineEdit *le = memnew( LineEdit ); - gn->add_child(le); - le->set_text(graph->input_node_get_name(type,p_id)); - le->connect("text_entered",this,"_input_name_changed",varray(p_id,le)); - ToolButton *edit = memnew( ToolButton ); - edit->set_text("edit..."); - edit->connect("pressed",this,"_xform_input_changed",varray(p_id,edit)); - gn->add_child(edit); - gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM]); - - } break; // mat4 uniform (assignable in material) - case ShaderGraph::NODE_TEXTURE_INPUT: { - - gn->set_title("TexUniform"); - LineEdit *le = memnew( LineEdit ); - gn->add_child(le); - le->set_text(graph->input_node_get_name(type,p_id)); - le->connect("text_entered",this,"_input_name_changed",varray(p_id,le)); - TextureRect *tex = memnew( TextureRect ); - tex->set_expand(true); - tex->set_custom_minimum_size(Size2(80,80)); - tex->set_drag_forwarding(this); - gn->add_child(tex); - tex->set_mouse_filter(MOUSE_FILTER_PASS); - tex->set_texture(graph->texture_input_node_get_value(type,p_id)); - ToolButton *edit = memnew( ToolButton ); - edit->set_text("edit..."); - edit->connect("pressed",this,"_tex_edited",varray(p_id,edit)); - gn->add_child(edit); - - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("UV", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("UV: ")+v,gn,p_id,0,Variant::VECTOR3)); - } - hbc->add_spacer(); - Label *l=memnew(Label("RGB")); - l->set_align(Label::ALIGN_RIGHT); - hbc->add_child(l); - gn->add_child(hbc); - l = memnew( Label ); - l->set_text("Alpha"); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child(l); - - gn->set_slot(3,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(4,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - - } break; // texture input (assignable in material) - case ShaderGraph::NODE_CUBEMAP_INPUT: { - - gn->set_title("TexUniform"); - LineEdit *le = memnew( LineEdit ); - gn->add_child(le); - le->set_text(graph->input_node_get_name(type,p_id)); - le->connect("text_entered",this,"_input_name_changed",varray(p_id,le)); - - ToolButton *edit = memnew( ToolButton ); - edit->set_text("edit..."); - edit->connect("pressed",this,"_cube_edited",varray(p_id,edit)); - gn->add_child(edit); - - - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("UV", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("UV: ")+v,gn,p_id,0,Variant::VECTOR3)); - } - hbc->add_spacer(); - Label *l=memnew(Label("RGB")); - l->set_align(Label::ALIGN_RIGHT); - hbc->add_child(l); - gn->add_child(hbc); - l = memnew( Label ); - l->set_text("Alpha"); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child(l); - - gn->set_slot(2,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(3,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - - } break; // cubemap input (assignable in material) - case ShaderGraph::NODE_DEFAULT_TEXTURE: { - - gn->set_title("CanvasItemTex"); - HBoxContainer *hbc = memnew( HBoxContainer ); - hbc->add_constant_override("separation",0); - if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("UV", Variant::VECTOR3)); - } else { - Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("UV: ")+v,gn,p_id,0,Variant::VECTOR3)); - } - hbc->add_spacer(); - Label *l=memnew(Label("RGB")); - l->set_align(Label::ALIGN_RIGHT); - hbc->add_child(l); - gn->add_child(hbc); - l = memnew( Label ); - l->set_text("Alpha"); - l->set_align(Label::ALIGN_RIGHT); - gn->add_child(l); - - gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); - gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_SCALAR,typecol[ShaderGraph::SLOT_TYPE_SCALAR]); - - - } break; // screen texture sampler (takes UV) (only usable in fragment case Shader) - - case ShaderGraph::NODE_OUTPUT: { - gn->set_title("Output"); - gn->set_show_close_button(false); - - List<ShaderGraph::SlotInfo> si; - ShaderGraph::get_input_output_node_slot_info(graph->get_mode(),type,&si); - - Array colors; - colors.push_back("Color"); - colors.push_back("LightColor"); - colors.push_back("Light"); - colors.push_back("ShadowColor"); - colors.push_back("Diffuse"); - colors.push_back("Specular"); - colors.push_back("Emission"); - Array reals; - reals.push_back("Alpha"); - reals.push_back("DiffuseAlpha"); - reals.push_back("NormalMapDepth"); - reals.push_back("SpecExp"); - reals.push_back("Glow"); - reals.push_back("ShadeParam"); - reals.push_back("SpecularExp"); - reals.push_back("LightAlpha"); - reals.push_back("ShadowAlpha"); - reals.push_back("PointSize"); - reals.push_back("Discard"); - - int idx=0; - for (List<ShaderGraph::SlotInfo>::Element *E=si.front();E;E=E->next()) { - ShaderGraph::SlotInfo& s=E->get(); - if (s.dir==ShaderGraph::SLOT_OUT) { - Variant::Type v; - if (colors.find(s.name)>=0) - v=Variant::COLOR; - else if (reals.find(s.name)>=0) - v=Variant::REAL; - else - v=Variant::VECTOR3; - gn->add_child(make_label(s.name, v)); - gn->set_slot(idx,true,s.type,typecol[s.type],false,0,Color()); - idx++; - } - } - - } break; // output (case Shader type dependent) - case ShaderGraph::NODE_COMMENT: { - gn->set_title("Comment"); - TextEdit *te = memnew(TextEdit); - te->set_custom_minimum_size(Size2(100,100)); - gn->add_child(te); - te->set_text(graph->comment_node_get_text(type,p_id)); - te->connect("text_changed",this,"_comment_edited",varray(p_id,te)); - - } break; // comment - - - - } - - gn->connect("dragged",this,"_node_moved",varray(p_id)); - gn->connect("close_request",this,"_node_removed",varray(p_id),CONNECT_DEFERRED); - graph_edit->add_child(gn); - node_map[p_id]=gn; - gn->set_offset(graph->node_get_position(type,p_id)); - - -} - -void ShaderGraphView::_update_graph() { - - - if (block_update) - return; - - for (Map<int,GraphNode*>::Element *E=node_map.front();E;E=E->next()) { - - memdelete(E->get()); - } - - node_map.clear(); - - if (!graph.is_valid()) - return; - - - List<int> nl; - graph->get_node_list(type,&nl); - - for(List<int>::Element *E=nl.front();E;E=E->next()) { - - _create_node(E->get()); - } - graph_edit->clear_connections(); - - List<ShaderGraph::Connection> connections; - graph->get_node_connections(type,&connections); - for(List<ShaderGraph::Connection>::Element *E=connections.front();E;E=E->next()) { - - ERR_CONTINUE(!node_map.has(E->get().src_id) || !node_map.has(E->get().dst_id)); - graph_edit->connect_node(node_map[E->get().src_id]->get_name(),E->get().src_slot,node_map[E->get().dst_id]->get_name(),E->get().dst_slot); - } - -} - -void ShaderGraphView::_sg_updated() { - - if (!graph.is_valid()) - return; - switch(graph->get_graph_error(type)) { - case ShaderGraph::GRAPH_OK: status->set_text(""); break; - case ShaderGraph::GRAPH_ERROR_CYCLIC: status->set_text(TTR("Error: Cyclic Connection Link")); break; - case ShaderGraph::GRAPH_ERROR_MISSING_CONNECTIONS: status->set_text(TTR("Error: Missing Input Connections")); break; - } -} - -Variant ShaderGraphView::get_drag_data_fw(const Point2 &p_point, Control *p_from) -{ - TextureRect* frame = Object::cast_to<TextureRect>(p_from); - if (!frame) - return Variant(); - - if (!frame->get_texture().is_valid()) - return Variant(); - - RES res = frame->get_texture(); - return EditorNode::get_singleton()->drag_resource(res,p_from); - - return Variant(); -} - -bool ShaderGraphView::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const -{ - if (p_data.get_type() != Variant::DICTIONARY) - return false; - - Dictionary d = p_data; - - if (d.has("type")){ - if (d["type"] == "resource" && d.has("resource")) { - Variant val = d["resource"]; - - if (val.get_type()==Variant::OBJECT) { - RES res = val; - if (res.is_valid() && Object::cast_to<Texture>(res)) - return true; - } - } - else if (d["type"] == "files" && d.has("files")) { - Vector<String> files = d["files"]; - if (files.size() != 1) - return false; - return (ResourceLoader::get_resource_type(files[0]) == "ImageTexture"); - } - } - - return false; -} - -void ShaderGraphView::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) -{ - if (!can_drop_data_fw(p_point, p_data, p_from)) - return; - - TextureRect *frame = Object::cast_to<TextureRect>(p_from); - if (!frame) - return; - - Dictionary d = p_data; - Ref<Texture> tex; - - if (d.has("type")) { - if (d["type"] == "resource" && d.has("resource")){ - Variant val = d["resource"]; - - if (val.get_type()==Variant::OBJECT) { - RES res = val; - if (res.is_valid()) - tex = Ref<Texture>(Object::cast_to<Texture>(*res)); - } - } - else if (d["type"] == "files" && d.has("files")) { - Vector<String> files = d["files"]; - RES res = ResourceLoader::load(files[0]); - if (res.is_valid()) - tex = Ref<Texture>(Object::cast_to<Texture>(*res)); - } - } - - if (!tex.is_valid()) return; - - GraphNode *gn = Object::cast_to<GraphNode>(frame->get_parent()); - if (!gn) return; - - int id = -1; - for(Map<int,GraphNode*>::Element *E = node_map.front();E;E=E->next()) - if (E->get() == gn) { - id = E->key(); - break; - } - print_line(String::num(double(id))); - if (id < 0) return; - - if (graph->node_get_type(type,id)==ShaderGraph::NODE_TEXTURE_INPUT) { - - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Change Texture Uniform")); - ur->add_do_method(graph.ptr(),"texture_input_node_set_value",type,id,tex); - ur->add_undo_method(graph.ptr(),"texture_input_node_set_value",type,id,graph->texture_input_node_get_value(type,id)); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - ur->commit_action(); - } -} - -void ShaderGraphView::set_graph(Ref<ShaderGraph> p_graph){ - - - if (graph.is_valid()) { - graph->disconnect("updated",this,"_sg_updated"); - } - graph=p_graph; - if (graph.is_valid()) { - graph->connect("updated",this,"_sg_updated"); - } - _update_graph(); - _sg_updated(); - -} - -void ShaderGraphView::_notification(int p_what) { - - if (p_what==NOTIFICATION_ENTER_TREE) { - - ped_popup->connect("variant_changed",this,"_variant_edited"); - } -} - -void ShaderGraphView::add_node(int p_type, const Vector2 &location) { - - if (p_type==ShaderGraph::NODE_INPUT && graph->node_count(type, p_type)>0) - return; - - List<int> existing; - graph->get_node_list(type,&existing); - existing.sort(); - int newid=1; - for(List<int>::Element *E=existing.front();E;E=E->next()) { - if (!E->next() || (E->get()+1!=E->next()->get())){ - newid=E->get()+1; - break; - } - } - - Vector2 init_ofs = location; - while(true) { - bool valid=true; - for(List<int>::Element *E=existing.front();E;E=E->next()) { - Vector2 pos = graph->node_get_position(type,E->get()); - if (init_ofs==pos) { - init_ofs+=Vector2(20,20); - valid=false; - break; - - } - } - - if (valid) - break; - } - UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Add Shader Graph Node")); - ur->add_do_method(graph.ptr(),"node_add",type,p_type,newid); - ur->add_do_method(graph.ptr(),"node_set_position",type,newid,init_ofs); - ur->add_undo_method(graph.ptr(),"node_remove",type,newid); - ur->add_do_method(this,"_update_graph"); - ur->add_undo_method(this,"_update_graph"); - ur->commit_action(); - -} - -void ShaderGraphView::_bind_methods() { - - ClassDB::bind_method("_update_graph",&ShaderGraphView::_update_graph); - ClassDB::bind_method("_begin_node_move", &ShaderGraphView::_begin_node_move); - ClassDB::bind_method("_node_moved",&ShaderGraphView::_node_moved); - ClassDB::bind_method("_end_node_move", &ShaderGraphView::_end_node_move); - ClassDB::bind_method("_move_node",&ShaderGraphView::_move_node); - ClassDB::bind_method("_node_removed",&ShaderGraphView::_node_removed); - ClassDB::bind_method("_connection_request",&ShaderGraphView::_connection_request); - ClassDB::bind_method("_disconnection_request",&ShaderGraphView::_disconnection_request); - ClassDB::bind_method("_duplicate_nodes_request", &ShaderGraphView::_duplicate_nodes_request); - ClassDB::bind_method("_duplicate_nodes", &ShaderGraphView::_duplicate_nodes); - ClassDB::bind_method("_delete_nodes_request", &ShaderGraphView::_delete_nodes_request); - - ClassDB::bind_method("_default_changed",&ShaderGraphView::_default_changed); - ClassDB::bind_method("_scalar_const_changed",&ShaderGraphView::_scalar_const_changed); - ClassDB::bind_method("_vec_const_changed",&ShaderGraphView::_vec_const_changed); - ClassDB::bind_method("_rgb_const_changed",&ShaderGraphView::_rgb_const_changed); - ClassDB::bind_method("_xform_const_changed",&ShaderGraphView::_xform_const_changed); - ClassDB::bind_method("_scalar_op_changed",&ShaderGraphView::_scalar_op_changed); - ClassDB::bind_method("_vec_op_changed",&ShaderGraphView::_vec_op_changed); - ClassDB::bind_method("_vec_scalar_op_changed",&ShaderGraphView::_vec_scalar_op_changed); - ClassDB::bind_method("_rgb_op_changed",&ShaderGraphView::_rgb_op_changed); - ClassDB::bind_method("_xform_inv_rev_changed",&ShaderGraphView::_xform_inv_rev_changed); - ClassDB::bind_method("_scalar_func_changed",&ShaderGraphView::_scalar_func_changed); - ClassDB::bind_method("_vec_func_changed",&ShaderGraphView::_vec_func_changed); - ClassDB::bind_method("_scalar_input_changed",&ShaderGraphView::_scalar_input_changed); - ClassDB::bind_method("_vec_input_changed",&ShaderGraphView::_vec_input_changed); - ClassDB::bind_method("_xform_input_changed",&ShaderGraphView::_xform_input_changed); - ClassDB::bind_method("_rgb_input_changed",&ShaderGraphView::_rgb_input_changed); - ClassDB::bind_method("_tex_input_change",&ShaderGraphView::_tex_input_change); - ClassDB::bind_method("_cube_input_change",&ShaderGraphView::_cube_input_change); - ClassDB::bind_method("_input_name_changed",&ShaderGraphView::_input_name_changed); - ClassDB::bind_method("_tex_edited",&ShaderGraphView::_tex_edited); - ClassDB::bind_method("_variant_edited",&ShaderGraphView::_variant_edited); - ClassDB::bind_method("_cube_edited",&ShaderGraphView::_cube_edited); - ClassDB::bind_method("_comment_edited",&ShaderGraphView::_comment_edited); - ClassDB::bind_method("_color_ramp_changed",&ShaderGraphView::_color_ramp_changed); - ClassDB::bind_method("_curve_changed",&ShaderGraphView::_curve_changed); - - ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &ShaderGraphView::get_drag_data_fw); - ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &ShaderGraphView::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw"), &ShaderGraphView::drop_data_fw); - - ClassDB::bind_method("_sg_updated",&ShaderGraphView::_sg_updated); -} - -ShaderGraphView::ShaderGraphView(ShaderGraph::ShaderType p_type) { - - type=p_type; - graph_edit = memnew( GraphEdit ); - block_update=false; - ped_popup = memnew( CustomPropertyEditor ); - graph_edit->add_child(ped_popup); - status = memnew( Label ); - graph_edit->get_top_layer()->add_child(status); - graph_edit->connect("_begin_node_move", this, "_begin_node_move"); - graph_edit->connect("_end_node_move", this, "_end_node_move"); - status->set_position(Vector2(5,5)); - status->add_color_override("font_color_shadow",Color(0,0,0)); - status->add_color_override("font_color",Color(1,0.4,0.3)); - status->add_constant_override("shadow_as_outline",1); - status->add_constant_override("shadow_offset_x",2); - status->add_constant_override("shadow_offset_y",2); - status->set_text(""); -} - - -//////////////edit////////////// -void ShaderGraphEditor::edit(Ref<ShaderGraph> p_shader) { - - for(int i=0;i<ShaderGraph::SHADER_TYPE_MAX;i++) { - graph_edits[i]->set_graph(p_shader); - } -} - -void ShaderGraphEditor::_add_node(int p_type) { - - ShaderGraph::ShaderType shader_type=ShaderGraph::ShaderType(tabs->get_current_tab()); - graph_edits[shader_type]->add_node(p_type, next_location); -} - -void ShaderGraphEditor::_popup_requested(const Vector2 &p_position) -{ - Vector2 scroll_ofs=graph_edits[tabs->get_current_tab()]->get_graph_edit()->get_scroll_ofs(); - next_location = get_local_mouse_position() + scroll_ofs; - popup->set_global_position(p_position); - popup->set_size( Size2( 200, 0) ); - popup->popup(); -} - -void ShaderGraphEditor::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_TREE) { - - for(int i=0;i<ShaderGraph::NODE_TYPE_MAX;i++) { - - if (i==ShaderGraph::NODE_OUTPUT) - continue; - if (!_2d && i==ShaderGraph::NODE_DEFAULT_TEXTURE) - continue; - - String nn = node_names[i]; - String ic = nn.get_slice(":",0); - String v = nn.get_slice(":",1); - bool addsep=false; - if (nn.ends_with(":")) { - addsep=true; - } - popup->add_icon_item(get_icon(ic,"EditorIcons"),v,i); - if (addsep) - popup->add_separator(); - } - popup->connect("id_pressed",this,"_add_node"); - - - } -} - -void ShaderGraphEditor::_bind_methods() { - - ClassDB::bind_method("_add_node",&ShaderGraphEditor::_add_node); - ClassDB::bind_method("_popup_requested",&ShaderGraphEditor::_popup_requested); -} - - -const char* ShaderGraphEditor::node_names[ShaderGraph::NODE_TYPE_MAX]={ - ("GraphInput:Input"), // all inputs (shader type dependent) - ("GraphScalar:Scalar Constant"), //scalar constant - ("GraphVector:Vector Constant"), //vec3 constant - ("GraphRgb:RGB Constant"), //rgb constant (shows a color picker instead) - ("GraphXform:XForm Constant"), // 4x4 matrix constant - ("GraphTime:Time:"), // time in seconds - ("GraphTexscreen:Screen Sample"), // screen texture sampler (takes uv) (only usable in fragment shader) - ("GraphScalarOp:Scalar Operator"), // scalar vs scalar op (mul", add", div", etc) - ("GraphVecOp:Vector Operator"), // vec3 vs vec3 op (mul",ad",div",crossprod",etc) - ("GraphVecScalarOp:Scalar+Vector Operator"), // vec3 vs scalar op (mul", add", div", etc) - ("GraphRgbOp:RGB Operator:"), // vec3 vs vec3 rgb op (with scalar amount)", like brighten", darken", burn", dodge", multiply", etc. - ("GraphXformMult:XForm Multiply"), // mat4 x mat4 - ("GraphXformVecMult:XForm+Vector Multiply"), // mat4 x vec3 mult (with no-translation option) - ("GraphXformVecImult:Form+Vector InvMultiply:"), // mat4 x vec3 inverse mult (with no-translation option) - ("GraphXformScalarFunc:Scalar Function"), // scalar function (sin", cos", etc) - ("GraphXformVecFunc:Vector Function"), // vector function (normalize", negate", reciprocal", rgb2hsv", hsv2rgb", etc", etc) - ("GraphVecLength:Vector Length"), // vec3 length - ("GraphVecDp:Dot Product:"), // vec3 . vec3 (dot product -> scalar output) - ("GraphVecToScalars:Vector -> Scalars"), // 1 vec3 input", 3 scalar outputs - ("GraphScalarsToVec:Scalars -> Vector"), // 3 scalar input", 1 vec3 output - ("GraphXformToVecs:XForm -> Vectors"), // 3 vec input", 1 xform output - ("GraphVecsToXform:Vectors -> XForm:"), // 3 vec input", 1 xform output - ("GraphScalarInterp:Scalar Interpolate"), // scalar interpolation (with optional curve) - ("GraphVecInterp:Vector Interpolate:"), // vec3 interpolation (with optional curve) - ("GraphColorRamp:Color Ramp"), // vec3 interpolation (with optional curve) - ("GraphCurveMap:Curve Remap:"), // vec3 interpolation (with optional curve) - ("GraphScalarUniform:Scalar Uniform"), // scalar uniform (assignable in material) - ("GraphVectorUniform:Vector Uniform"), // vec3 uniform (assignable in material) - ("GraphRgbUniform:RGB Uniform"), // color uniform (assignable in material) - ("GraphXformUniform:XForm Uniform"), // mat4 uniform (assignable in material) - ("GraphTextureUniform:Texture Uniform"), // texture input (assignable in material) - ("GraphCubeUniform:CubeMap Uniform:"), // cubemap input (assignable in material) - ("GraphDefaultTexture:CanvasItem Texture:"), // cubemap input (assignable in material) - ("Output"), // output (shader type dependent) - ("GraphComment:Comment"), // comment - - -}; -ShaderGraphEditor::ShaderGraphEditor(bool p_2d) { - _2d=p_2d; - - popup = memnew( PopupMenu ); - add_child(popup); - - - tabs = memnew(TabContainer); - tabs->set_v_size_flags(SIZE_EXPAND_FILL); - add_child(tabs); - const char* sname[ShaderGraph::SHADER_TYPE_MAX]={ - "Vertex", - "Fragment", - "Light" - }; - for(int i=0;i<ShaderGraph::SHADER_TYPE_MAX;i++) { - - graph_edits[i]= memnew( ShaderGraphView(ShaderGraph::ShaderType(i)) ); - add_child(graph_edits[i]); - graph_edits[i]->get_graph_edit()->set_name(sname[i]); - tabs->add_child(graph_edits[i]->get_graph_edit()); - graph_edits[i]->get_graph_edit()->connect("connection_request",graph_edits[i],"_connection_request"); - graph_edits[i]->get_graph_edit()->connect("disconnection_request",graph_edits[i],"_disconnection_request"); - graph_edits[i]->get_graph_edit()->connect("duplicate_nodes_request", graph_edits[i], "_duplicate_nodes_request"); - graph_edits[i]->get_graph_edit()->connect("popup_request",this,"_popup_requested"); - graph_edits[i]->get_graph_edit()->connect("delete_nodes_request",graph_edits[i],"_delete_nodes_request"); - graph_edits[i]->get_graph_edit()->set_right_disconnects(true); - } - - tabs->set_current_tab(1); - - set_custom_minimum_size(Size2(100,300)); -} - - -void ShaderGraphEditorPlugin::edit(Object *p_object) { - - shader_editor->edit(Object::cast_to<ShaderGraph>(p_object)); -} - -bool ShaderGraphEditorPlugin::handles(Object *p_object) const { - - ShaderGraph *shader=Object::cast_to<ShaderGraph>(p_object); - if (!shader) - return false; - if (_2d) - return shader->get_mode()==Shader::MODE_CANVAS_ITEM; - else - return shader->get_mode()==Shader::MODE_MATERIAL; -} - -void ShaderGraphEditorPlugin::make_visible(bool p_visible) { - - if (p_visible) { - shader_editor->show(); - } else { - - shader_editor->hide(); - } - -} - -ShaderGraphEditorPlugin::ShaderGraphEditorPlugin(EditorNode *p_node, bool p_2d) { - - _2d=p_2d; - editor=p_node; - shader_editor = memnew( ShaderGraphEditor(p_2d) ); - shader_editor->hide(); - if (p_2d) - CanvasItemEditor::get_singleton()->get_bottom_split()->add_child(shader_editor); - else - SpatialEditor::get_singleton()->get_shader_split()->add_child(shader_editor); - - - //editor->get_viewport()->add_child(shader_editor); - //shader_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); - //shader_editor->hide(); - -} - - -ShaderGraphEditorPlugin::~ShaderGraphEditorPlugin() -{ -} - -#endif diff --git a/editor/plugins/shader_graph_editor_plugin.h b/editor/plugins/shader_graph_editor_plugin.h deleted file mode 100644 index f273507fcf..0000000000 --- a/editor/plugins/shader_graph_editor_plugin.h +++ /dev/null @@ -1,248 +0,0 @@ -/*************************************************************************/ -/* shader_graph_editor_plugin.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef SHADER_GRAPH_EDITOR_PLUGIN_H -#define SHADER_GRAPH_EDITOR_PLUGIN_H - -// FIXME: Godot 3.0 broke compatibility with ShaderGraphEditorPlugin, -// it needs to be ported to the new shader language. -#if 0 - -#include "editor/editor_node.h" -#include "editor/editor_plugin.h" -#include "editor/property_editor.h" -#include "scene/gui/button.h" -#include "scene/gui/graph_edit.h" -#include "scene/gui/popup.h" -#include "scene/gui/tree.h" -#include "scene/resources/shader.h" -#include "scene/resources/shader_graph.h" - -/** - @author Juan Linietsky <reduzio@gmail.com> -*/ - -class GraphColorRampEdit : public Control { - - GDCLASS(GraphColorRampEdit,Control); - - - struct Point { - - float offset; - Color color; - bool operator<(const Point& p_ponit) const { - return offset<p_ponit.offset; - } - }; - - PopupPanel *popup; - ColorPicker *picker; - - - bool grabbing; - int grabbed; - float grabbed_at; - Vector<Point> points; - - void _color_changed(const Color& p_color); - -protected: - void _gui_input(const InputEvent& p_event); - void _notification(int p_what); - static void _bind_methods(); -public: - - void set_ramp(const Vector<float>& p_offsets,const Vector<Color>& p_colors); - Vector<float> get_offsets() const; - Vector<Color> get_colors() const; - virtual Size2 get_minimum_size() const; - GraphColorRampEdit(); -}; - - -class GraphCurveMapEdit : public Control { - - GDCLASS(GraphCurveMapEdit,Control); - - - struct Point { - - float offset; - float height; - bool operator<(const Point& p_ponit) const { - return offset<p_ponit.offset; - } - }; - - - bool grabbing; - int grabbed; - Vector<Point> points; - - void _plot_curve(const Vector2& p_a,const Vector2& p_b,const Vector2& p_c,const Vector2& p_d); -protected: - void _gui_input(const InputEvent& p_event); - void _notification(int p_what); - static void _bind_methods(); -public: - - void set_points(const Vector<Vector2>& p_points); - Vector<Vector2> get_points() const; - virtual Size2 get_minimum_size() const; - GraphCurveMapEdit(); -}; - -class ShaderGraphView : public Control { - - GDCLASS(ShaderGraphView,Control); - - - - CustomPropertyEditor *ped_popup; - bool block_update; - - Label *status; - GraphEdit *graph_edit; - Ref<ShaderGraph> graph; - int edited_id; - int edited_def; - - ShaderGraph::ShaderType type; - - void _update_graph(); - void _create_node(int p_id); - - - ToolButton *make_label(String text, Variant::Type v_type = Variant::NIL); - ToolButton *make_editor(String text, GraphNode* gn, int p_id, int param, Variant::Type type, String p_hint=""); - - void _connection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot); - void _disconnection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot); - - void _node_removed(int p_id); - void _begin_node_move(); - void _node_moved(const Vector2& p_from, const Vector2& p_to,int p_id); - void _end_node_move(); - void _move_node(int p_id,const Vector2& p_to); - void _duplicate_nodes_request(); - void _duplicate_nodes(const Array &p_nodes); - void _delete_nodes_request(); - - - void _default_changed(int p_id, Node* p_button, int p_param, int v_type, String p_hint); - - void _scalar_const_changed(double p_value,int p_id); - void _vec_const_changed(double p_value, int p_id, Array p_arr); - void _rgb_const_changed(const Color& p_color, int p_id); - void _xform_const_changed(int p_id,Node* p_button); - void _scalar_op_changed(int p_op, int p_id); - void _vec_op_changed(int p_op, int p_id); - void _vec_scalar_op_changed(int p_op, int p_id); - void _rgb_op_changed(int p_op, int p_id); - void _xform_inv_rev_changed(bool p_enabled, int p_id); - void _scalar_func_changed(int p_func, int p_id); - void _vec_func_changed(int p_func, int p_id); - void _scalar_input_changed(double p_value,int p_id); - void _vec_input_changed(double p_value, int p_id, Array p_arr); - void _xform_input_changed(int p_id,Node* p_button); - void _rgb_input_changed(const Color& p_color, int p_id); - void _tex_input_change(int p_id,Node* p_button); - void _cube_input_change(int p_id); - void _input_name_changed(const String& p_name,int p_id,Node* p_line_edit); - void _tex_edited(int p_id,Node* p_button); - void _cube_edited(int p_id,Node* p_button); - void _variant_edited(); - void _comment_edited(int p_id,Node* p_button); - void _color_ramp_changed(int p_id,Node* p_ramp); - void _curve_changed(int p_id,Node* p_curve); - void _sg_updated(); - Map<int,GraphNode*> node_map; - - Variant get_drag_data_fw(const Point2& p_point,Control* p_from); - bool can_drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from) const; - void drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from); -protected: - void _notification(int p_what); - static void _bind_methods(); -public: - - void add_node(int p_type, const Vector2 &location); - GraphEdit *get_graph_edit() { return graph_edit; } - void set_graph(Ref<ShaderGraph> p_graph); - - ShaderGraphView(ShaderGraph::ShaderType p_type=ShaderGraph::SHADER_TYPE_FRAGMENT); -}; - -class ShaderGraphEditor : public VBoxContainer { - - GDCLASS(ShaderGraphEditor,VBoxContainer); - - PopupMenu *popup; - TabContainer *tabs; - ShaderGraphView *graph_edits[ShaderGraph::SHADER_TYPE_MAX]; - static const char* node_names[ShaderGraph::NODE_TYPE_MAX]; - Vector2 next_location; - - bool _2d; - void _add_node(int p_type); - void _popup_requested(const Vector2 &p_position); -protected: - void _notification(int p_what); - static void _bind_methods(); -public: - - void edit(Ref<ShaderGraph> p_shader); - ShaderGraphEditor(bool p_2d); -}; - -class ShaderGraphEditorPlugin : public EditorPlugin { - - GDCLASS( ShaderGraphEditorPlugin, EditorPlugin ); - - bool _2d; - ShaderGraphEditor *shader_editor; - EditorNode *editor; - -public: - - virtual String get_name() const { return "ShaderGraph"; } - bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; - virtual void make_visible(bool p_visible); - - ShaderGraphEditorPlugin(EditorNode *p_node,bool p_2d); - ~ShaderGraphEditorPlugin(); - -}; - -#endif -#endif // SHADER_GRAPH_EDITOR_PLUGIN_H diff --git a/editor/plugins/skeleton_editor_plugin.cpp b/editor/plugins/skeleton_editor_plugin.cpp index fe7d1df50c..314db4198d 100644 --- a/editor/plugins/skeleton_editor_plugin.cpp +++ b/editor/plugins/skeleton_editor_plugin.cpp @@ -126,9 +126,16 @@ PhysicalBone *SkeletonEditor::create_physical_bone(int bone_id, int bone_child_i } void SkeletonEditor::edit(Skeleton *p_node) { + skeleton = p_node; } +void SkeletonEditor::_notification(int p_what) { + if (p_what == NOTIFICATION_ENTER_TREE) { + get_tree()->connect("node_removed", this, "_node_removed"); + } +} + void SkeletonEditor::_node_removed(Node *p_node) { if (p_node == skeleton) { @@ -139,6 +146,7 @@ void SkeletonEditor::_node_removed(Node *p_node) { void SkeletonEditor::_bind_methods() { ClassDB::bind_method("_on_click_option", &SkeletonEditor::_on_click_option); + ClassDB::bind_method("_node_removed", &SkeletonEditor::_node_removed); } SkeletonEditor::SkeletonEditor() { diff --git a/editor/plugins/skeleton_editor_plugin.h b/editor/plugins/skeleton_editor_plugin.h index b9bdf91902..0ab94c15b5 100644 --- a/editor/plugins/skeleton_editor_plugin.h +++ b/editor/plugins/skeleton_editor_plugin.h @@ -61,6 +61,7 @@ class SkeletonEditor : public Node { friend class SkeletonEditorPlugin; protected: + void _notification(int p_what); void _node_removed(Node *p_node); static void _bind_methods(); diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp index 9bf1178b58..58a1835e68 100644 --- a/editor/plugins/sprite_editor_plugin.cpp +++ b/editor/plugins/sprite_editor_plugin.cpp @@ -160,7 +160,6 @@ void SpriteEditor::_update_mesh_data() { Vector<Vector<Vector2> > lines = bm->clip_opaque_to_polygons(rect, epsilon); - print_line("lines: " + itos(lines.size())); uv_lines.clear(); computed_vertices.clear(); @@ -190,21 +189,6 @@ void SpriteEditor::_update_mesh_data() { computed_vertices.push_back(vtx); } -#if 0 - Vector<Vector<Vector2> > polys = Geometry::decompose_polygon(lines[j]); - print_line("polygon: " + itos(polys.size())); - - for (int i = 0; i < polys.size(); i++) { - for (int k = 0; k < polys[i].size(); k++) { - - int idxn = (k + 1) % polys[i].size(); - uv_lines.push_back(polys[i][k]); - uv_lines.push_back(polys[i][idxn]); - } - } -#endif - -#if 1 Vector<int> poly = Geometry::triangulate_polygon(lines[j]); @@ -218,14 +202,6 @@ void SpriteEditor::_update_mesh_data() { computed_indices.push_back(poly[idx] + index_ofs); } } -#endif - -#if 0 - for (int i = 0; i < lines[j].size() - 1; i++) { - uv_lines.push_back(lines[j][i]); - uv_lines.push_back(lines[j][i + 1]); - } -#endif } debug_uv->update(); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index a9afc7a670..fcbbee2b9c 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -89,7 +89,6 @@ void SpriteFramesEditor::_file_load_request(const PoolVector<String> &p_path, in } if (resources.empty()) { - //print_line("added frames!"); return; } @@ -108,7 +107,6 @@ void SpriteFramesEditor::_file_load_request(const PoolVector<String> &p_path, in undo_redo->add_undo_method(this, "_update_library"); undo_redo->commit_action(); - //print_line("added frames!"); } void SpriteFramesEditor::_load_pressed() { diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 0a421bdffe..34dd36692c 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -79,9 +79,9 @@ void TileMapEditor::_notification(int p_what) { PopupMenu *p = options->get_popup(); p->set_item_icon(p->get_item_index(OPTION_PAINTING), get_icon("Edit", "EditorIcons")); p->set_item_icon(p->get_item_index(OPTION_PICK_TILE), get_icon("ColorPick", "EditorIcons")); - p->set_item_icon(p->get_item_index(OPTION_SELECT), get_icon("ToolSelect", "EditorIcons")); - p->set_item_icon(p->get_item_index(OPTION_MOVE), get_icon("ToolMove", "EditorIcons")); - p->set_item_icon(p->get_item_index(OPTION_DUPLICATE), get_icon("Duplicate", "EditorIcons")); + p->set_item_icon(p->get_item_index(OPTION_SELECT), get_icon("ActionCopy", "EditorIcons")); + p->set_item_icon(p->get_item_index(OPTION_CUT), get_icon("ActionCut", "EditorIcons")); + p->set_item_icon(p->get_item_index(OPTION_COPY), get_icon("Duplicate", "EditorIcons")); p->set_item_icon(p->get_item_index(OPTION_ERASE_SELECTION), get_icon("Remove", "EditorIcons")); } break; @@ -119,12 +119,12 @@ void TileMapEditor::_menu_option(int p_option) { canvas_item_editor->update(); } break; - case OPTION_DUPLICATE: { + case OPTION_COPY: { _update_copydata(); if (selection_active) { - tool = TOOL_DUPLICATING; + tool = TOOL_PASTING; canvas_item_editor->update(); } @@ -135,12 +135,7 @@ void TileMapEditor::_menu_option(int p_option) { return; _start_undo(TTR("Erase Selection")); - for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) { - for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) { - - _set_cell(Point2i(j, i), invalid_cell, false, false, false); - } - } + _erase_selection(); _finish_undo(); selection_active = false; @@ -157,11 +152,19 @@ void TileMapEditor::_menu_option(int p_option) { undo_redo->commit_action(); } break; - case OPTION_MOVE: { + case OPTION_CUT: { if (selection_active) { _update_copydata(); - tool = TOOL_MOVING; + + _start_undo(TTR("Cut Selection")); + _erase_selection(); + _finish_undo(); + + selection_active = false; + + tool = TOOL_PASTING; + canvas_item_editor->update(); } } break; @@ -669,6 +672,18 @@ void TileMapEditor::_select(const Point2i &p_from, const Point2i &p_to) { canvas_item_editor->update(); } +void TileMapEditor::_erase_selection() { + if (!selection_active) + return; + + for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) { + for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) { + + _set_cell(Point2i(j, i), invalid_cell, false, false, false); + } + } +} + void TileMapEditor::_draw_cell(int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform) { Ref<Texture> t = node->get_tileset()->tile_get_texture(p_cell); @@ -980,12 +995,12 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { canvas_item_editor->update(); } - } else if (tool == TOOL_DUPLICATING) { + } else if (tool == TOOL_PASTING) { Point2 ofs = over_tile - rectangle.position; Vector<int> ids; - _start_undo(TTR("Duplicate")); + _start_undo(TTR("Paste")); ids.push_back(0); for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) { @@ -994,34 +1009,9 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { } _finish_undo(); - copydata.clear(); - - canvas_item_editor->update(); - } else if (tool == TOOL_MOVING) { - - Point2 ofs = over_tile - rectangle.position; - Vector<int> ids; - - _start_undo(TTR("Move")); - ids.push_back(TileMap::INVALID_CELL); - for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) { - for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) { - - _set_cell(Point2i(j, i), ids, false, false, false); - } - } - for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) { - - ids.write[0] = E->get().cell; - _set_cell(E->get().pos + ofs, ids, E->get().flip_h, E->get().flip_v, E->get().transpose); - } - _finish_undo(); - - copydata.clear(); - selection_active = false; - canvas_item_editor->update(); + return true; // We want to keep the Pasting tool } else if (tool == TOOL_SELECTING) { canvas_item_editor->update(); @@ -1068,17 +1058,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { return true; } - if (tool == TOOL_DUPLICATING) { - - tool = TOOL_NONE; - copydata.clear(); - - canvas_item_editor->update(); - - return true; - } - - if (tool == TOOL_MOVING) { + if (tool == TOOL_PASTING) { tool = TOOL_NONE; copydata.clear(); @@ -1305,7 +1285,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { if (k->get_scancode() == KEY_ESCAPE) { - if (tool == TOOL_DUPLICATING || tool == TOOL_MOVING) + if (tool == TOOL_PASTING) copydata.clear(); else if (tool == TOOL_SELECTING || selection_active) selection_active = false; @@ -1349,21 +1329,29 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { return true; } - if (ED_IS_SHORTCUT("tile_map_editor/duplicate_selection", p_event)) { + if (ED_IS_SHORTCUT("tile_map_editor/copy_selection", p_event)) { _update_copydata(); if (selection_active) { - tool = TOOL_DUPLICATING; + tool = TOOL_PASTING; canvas_item_editor->update(); return true; } } - if (ED_IS_SHORTCUT("tile_map_editor/move_selection", p_event)) { + if (ED_IS_SHORTCUT("tile_map_editor/cut_selection", p_event)) { if (selection_active) { _update_copydata(); - tool = TOOL_MOVING; + + _start_undo(TTR("Cut Selection")); + _erase_selection(); + _finish_undo(); + + selection_active = false; + + tool = TOOL_PASTING; + canvas_item_editor->update(); return true; } @@ -1564,7 +1552,7 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) { _draw_cell(ids[0], Point2i(j, i), flip_h, flip_v, transpose, xform); } } - } else if (tool == TOOL_DUPLICATING || tool == TOOL_MOVING) { + } else if (tool == TOOL_PASTING) { if (copydata.empty()) return; @@ -1844,8 +1832,8 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { p->add_item(TTR("Pick Tile"), OPTION_PICK_TILE, KEY_CONTROL); p->add_separator(); p->add_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_MASK_CMD + KEY_B), OPTION_SELECT); - p->add_shortcut(ED_SHORTCUT("tile_map_editor/move_selection", TTR("Move Selection"), KEY_MASK_CMD + KEY_M), OPTION_MOVE); - p->add_shortcut(ED_SHORTCUT("tile_map_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_CMD + KEY_D), OPTION_DUPLICATE); + p->add_shortcut(ED_SHORTCUT("tile_map_editor/cut_selection", TTR("Cut Selection"), KEY_MASK_CMD + KEY_X), OPTION_CUT); + p->add_shortcut(ED_SHORTCUT("tile_map_editor/copy_selection", TTR("Copy Selection"), KEY_MASK_CMD + KEY_C), OPTION_COPY); p->add_shortcut(ED_GET_SHORTCUT("tile_map_editor/erase_selection"), OPTION_ERASE_SELECTION); p->add_separator(); p->add_item(TTR("Fix Invalid Tiles"), OPTION_FIX_INVALID); @@ -1903,6 +1891,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { TileMapEditor::~TileMapEditor() { _clear_bucket_cache(); + copydata.clear(); } /////////////////////////////////////////////////////////////// diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index d72224263a..c824824d56 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -61,8 +61,7 @@ class TileMapEditor : public VBoxContainer { TOOL_SELECTING, TOOL_BUCKET, TOOL_PICKING, - TOOL_DUPLICATING, - TOOL_MOVING + TOOL_PASTING }; enum Options { @@ -70,11 +69,11 @@ class TileMapEditor : public VBoxContainer { OPTION_BUCKET, OPTION_PICK_TILE, OPTION_SELECT, - OPTION_DUPLICATE, + OPTION_COPY, OPTION_ERASE_SELECTION, OPTION_PAINTING, OPTION_FIX_INVALID, - OPTION_MOVE + OPTION_CUT }; TileMap *node; @@ -167,6 +166,7 @@ class TileMapEditor : public VBoxContainer { void _erase_points(const PoolVector<Vector2> p_points); void _select(const Point2i &p_from, const Point2i &p_to); + void _erase_selection(); void _draw_cell(int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform); void _draw_fill_preview(int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index aad9258ed9..3a6a73d3cc 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1390,7 +1390,7 @@ void ProjectManager::_open_project_confirm() { return; } - print_line("OPENING: " + path + " (" + selected + ")"); + print_line("Editing project: " + path + " (" + selected + ")"); List<String> args; @@ -1447,7 +1447,7 @@ void ProjectManager::_run_project_confirm() { return; } - print_line("OPENING: " + path + " (" + selected + ")"); + print_line("Running project: " + path + " (" + selected + ")"); List<String> args; @@ -1513,13 +1513,13 @@ void ProjectManager::_scan_dir(DirAccess *da, float pos, float total, List<Strin void ProjectManager::_scan_begin(const String &p_base) { - print_line("SCAN PROJECTS AT: " + p_base); + print_line("Scanning projects at: " + p_base); List<String> projects; DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); da->change_dir(p_base); _scan_dir(da, 0, 1, &projects); memdelete(da); - print_line("found: " + itos(projects.size()) + " projects."); + print_line("Found " + itos(projects.size()) + " projects."); for (List<String>::Element *E = projects.front(); E; E = E->next()) { String proj = E->get().replace("/", "::"); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 65b2e2301b..a7c336eb16 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -891,7 +891,6 @@ void ProjectSettingsEditor::_item_del() { return; } - print_line("to delete.. " + property); undo_redo->create_action(TTR("Delete Item")); Variant value = ProjectSettings::get_singleton()->get(property); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 408e67149a..d9812f7425 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -3992,7 +3992,6 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) { String prop = d["name"]; emit_signal("property_keyed", prop, obj->get(prop), false); } else if (p_button == 5) { - print_line("PB5"); if (!d.has("name")) return; String prop = d["name"]; @@ -4732,7 +4731,7 @@ double PropertyValueEvaluator::eval(const String &p_text) { script->set_source_code(_build_script(p_new_text)); Error err = script->reload(); if (err) { - print_line("[PropertyValueEvaluator] Error loading script for expression: " + p_new_text); + ERR_PRINTS("PropertyValueEvaluator: Error loading script for expression: " + p_new_text); return _default_eval(p_new_text); } @@ -4748,7 +4747,7 @@ double PropertyValueEvaluator::eval(const String &p_text) { if (call_err.error == Variant::CallError::CALL_OK) { return result; } - print_line("[PropertyValueEvaluator]: Error eval! Error code: " + itos(call_err.error)); + ERR_PRINTS("PropertyValueEvaluator: Eval failed, error code: " + itos(call_err.error)); return _default_eval(p_new_text); } diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index d927e07976..dae1bdeeb0 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -237,7 +237,6 @@ void PropertySelector::_update_search() { Ref<Texture> icon; script_methods = false; - print_line("name: " + E->get().name); String rep = E->get().name.replace("*", ""); if (E->get().name == "*Script Methods") { icon = get_icon("Script", "EditorIcons"); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 607d974025..39250ab391 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1512,7 +1512,6 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) { } editor_data->get_undo_redo().commit_action(); - print_line("test: " + String(Variant(selected.front()->get()->get_meta("_editor_icon")))); editor->push_item(p_script.operator->()); } diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 88d614ab89..a916ae23f6 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -521,8 +521,10 @@ void SceneTreeEditor::_selected_changed() { void SceneTreeEditor::_deselect_items() { // Clear currently elected items in scene tree dock. - if (editor_selection) + if (editor_selection) { editor_selection->clear(); + emit_signal("node_changed"); + } } void SceneTreeEditor::_cell_multi_selected(Object *p_object, int p_cell, bool p_selected) { @@ -546,6 +548,7 @@ void SceneTreeEditor::_cell_multi_selected(Object *p_object, int p_cell, bool p_ } else { editor_selection->remove_node(n); } + emit_signal("node_changed"); } void SceneTreeEditor::_notification(int p_what) { @@ -965,7 +968,6 @@ void SceneTreeEditor::_warning_changed(Node *p_for_node) { //should use a timer update_timer->start(); - //print_line("WARNING CHANGED "+String(p_for_node->get_name())); } void SceneTreeEditor::_editor_settings_changed() { diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 746e1cd28f..9db53fe5f5 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1133,7 +1133,6 @@ void ScriptEditorDebugger::_notification(int p_what) { } message_type = cmd; - //print_line("GOT: "+message_type); ret = ppeer->get_var(cmd); if (ret != OK) { @@ -1285,15 +1284,13 @@ void ScriptEditorDebugger::_profiler_activate(bool p_enable) { max_funcs = CLAMP(max_funcs, 16, 512); msg.push_back(max_funcs); ppeer->put_var(msg); - - print_line("BEGIN PROFILING!"); + print_verbose("Starting profiling."); } else { Array msg; msg.push_back("stop_profiling"); ppeer->put_var(msg); - - print_line("END PROFILING!"); + print_verbose("Ending profiling."); } } @@ -1430,8 +1427,6 @@ void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_n return; } - - //print_line("method"); } void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p_property, const Variant &p_value) { @@ -1500,8 +1495,6 @@ void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p return; } - - //print_line("prop"); } void ScriptEditorDebugger::_method_changeds(void *p_ud, Object *p_base, const StringName &p_name, VARIANT_ARG_DECLARE) { diff --git a/editor/translations/af.po b/editor/translations/af.po index b51e90b9f5..a92264f015 100644 --- a/editor/translations/af.po +++ b/editor/translations/af.po @@ -5669,134 +5669,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/ar.po b/editor/translations/ar.po index a48bee47d8..5631c1884d 100644 --- a/editor/translations/ar.po +++ b/editor/translations/ar.po @@ -5794,134 +5794,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "تعديل منحدر اللون" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9402,6 +9274,9 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Modify Color Ramp" +#~ msgstr "تعديل منحدر اللون" + #~ msgid "Disabled" #~ msgstr "معطّل" diff --git a/editor/translations/bg.po b/editor/translations/bg.po index eb38abf260..beeb2be3c6 100644 --- a/editor/translations/bg.po +++ b/editor/translations/bg.po @@ -5672,134 +5672,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/bn.po b/editor/translations/bn.po index f93e41143d..f4021e9731 100644 --- a/editor/translations/bn.po +++ b/editor/translations/bn.po @@ -6024,134 +6024,6 @@ msgstr "প্রাসঙ্গিক সাহায্য" msgid "Shader" msgstr "শেডার" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "স্কেলার ধ্রুবক পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "ভেক্টর ধ্রুবক পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "RGB ধ্রুবক পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "স্কেলার অপারেটর পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "ভেক্টর অপারেটর পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "ভেক্টর স্কেলার অপারেটর পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "RGB অপারেটর পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "শুধুমাত্র ঘূর্ণন টগল করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "স্কেলার ফাংশন পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "ভেক্টর ফাংশন পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "স্কেলার ইউনিফর্ম পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "ভেক্টর ইউনিফর্ম পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "RGB ইউনিফর্ম পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "প্রাথমিক মান পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "XForm ইউনিফর্ম পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "টেক্সার ইউনিফর্ম পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Cubemap ইউনিফর্ম পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "কমেন্ট পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "রঙ্গের র্যাম্পে সংযোজন/বিয়োজন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "রঙ্গের র্যাম্প পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Curve Map-এ সংযোজন/বিয়োজন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Curve Map পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "ইনপুট নাম পরিবর্তন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "গ্রাফের নোডসমূহ সংযুক্ত করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "গ্রাফের নোডসমূহ বিচ্ছিন্ন করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Shader Graph Node অপসারণ করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Shader Graph Node সরান" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "গ্রাফ নোড(সমূহ) প্রতিলিপি করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Shader Graph Node(s) অপসারণ করুন" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "সমস্যা: আবর্তনশীল সংযোগ লিঙ্ক" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "সমস্যা: ইনপুট সংযোগ নেই" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Shader Graph Node যোগ করুন" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9907,6 +9779,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "স্কেলার ধ্রুবক পরিবর্তন করুন" + +#~ msgid "Change Vec Constant" +#~ msgstr "ভেক্টর ধ্রুবক পরিবর্তন করুন" + +#~ msgid "Change RGB Constant" +#~ msgstr "RGB ধ্রুবক পরিবর্তন করুন" + +#~ msgid "Change Scalar Operator" +#~ msgstr "স্কেলার অপারেটর পরিবর্তন করুন" + +#~ msgid "Change Vec Operator" +#~ msgstr "ভেক্টর অপারেটর পরিবর্তন করুন" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "ভেক্টর স্কেলার অপারেটর পরিবর্তন করুন" + +#~ msgid "Change RGB Operator" +#~ msgstr "RGB অপারেটর পরিবর্তন করুন" + +#~ msgid "Toggle Rot Only" +#~ msgstr "শুধুমাত্র ঘূর্ণন টগল করুন" + +#~ msgid "Change Scalar Function" +#~ msgstr "স্কেলার ফাংশন পরিবর্তন করুন" + +#~ msgid "Change Vec Function" +#~ msgstr "ভেক্টর ফাংশন পরিবর্তন করুন" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "স্কেলার ইউনিফর্ম পরিবর্তন করুন" + +#~ msgid "Change Vec Uniform" +#~ msgstr "ভেক্টর ইউনিফর্ম পরিবর্তন করুন" + +#~ msgid "Change RGB Uniform" +#~ msgstr "RGB ইউনিফর্ম পরিবর্তন করুন" + +#~ msgid "Change Default Value" +#~ msgstr "প্রাথমিক মান পরিবর্তন করুন" + +#~ msgid "Change XForm Uniform" +#~ msgstr "XForm ইউনিফর্ম পরিবর্তন করুন" + +#~ msgid "Change Texture Uniform" +#~ msgstr "টেক্সার ইউনিফর্ম পরিবর্তন করুন" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Cubemap ইউনিফর্ম পরিবর্তন করুন" + +#~ msgid "Change Comment" +#~ msgstr "কমেন্ট পরিবর্তন করুন" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "রঙ্গের র্যাম্পে সংযোজন/বিয়োজন করুন" + +#~ msgid "Modify Color Ramp" +#~ msgstr "রঙ্গের র্যাম্প পরিবর্তন করুন" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Curve Map-এ সংযোজন/বিয়োজন করুন" + +#~ msgid "Modify Curve Map" +#~ msgstr "Curve Map পরিবর্তন করুন" + +#~ msgid "Change Input Name" +#~ msgstr "ইনপুট নাম পরিবর্তন করুন" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "গ্রাফের নোডসমূহ সংযুক্ত করুন" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "গ্রাফের নোডসমূহ বিচ্ছিন্ন করুন" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Shader Graph Node অপসারণ করুন" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Shader Graph Node সরান" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "গ্রাফ নোড(সমূহ) প্রতিলিপি করুন" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Shader Graph Node(s) অপসারণ করুন" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "সমস্যা: আবর্তনশীল সংযোগ লিঙ্ক" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "সমস্যা: ইনপুট সংযোগ নেই" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Shader Graph Node যোগ করুন" + #~ msgid "Disabled" #~ msgstr "অসমর্থ" diff --git a/editor/translations/ca.po b/editor/translations/ca.po index 3b683b9f9a..075b112224 100644 --- a/editor/translations/ca.po +++ b/editor/translations/ca.po @@ -5828,134 +5828,6 @@ msgstr "Ajuda Contextual" msgid "Shader" msgstr "Ombreig" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Modificar una constant escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Modificar una constant vectorial" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Modificar una constant RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Modifica un operador escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Modifica un operador vectorial" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Modifica un operador vectorial- escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Modifica un operador RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "només Rotacio" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Modifica una Funció Escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Modifica una Funció Vectorial" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Modificar un Uniforme Escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Modifica un Uniforme Vectorial" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Modifica un Uniforme RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Modifica el Valor per Defecte" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Modifica el Uniforme XForm" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Modifica un Uniforme Textura" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Modifica un Uniforme 'CubeMap'" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Modifica el Comentari" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Afegeix/Elimina-ho de la Rampa de Colors" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Modifica la Rampa de Color" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Afegeix/Ellimina-ho del Mapa de Corbes" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Modifica el Mapa de Corbes" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Modifica el Nom de l'Entrada" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Connecta els Nodes de Graf" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Desconnecta el Nodes de Graf" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Elimina el Node de Graf d'Ombreig" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Mou el Node de Graf d'Ombreig" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Duplica el(s) Node(s) de Graf" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Elimina el(s) Node(s) de Graf d'Ombreig" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Error: Enllaç de Connexió Cíclic" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Error: Manquen les Connexions d'Entrada" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Afegeix un Node de Graf d'Ombreig" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9599,6 +9471,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Modificar una constant escalar" + +#~ msgid "Change Vec Constant" +#~ msgstr "Modificar una constant vectorial" + +#~ msgid "Change RGB Constant" +#~ msgstr "Modificar una constant RGB" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Modifica un operador escalar" + +#~ msgid "Change Vec Operator" +#~ msgstr "Modifica un operador vectorial" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Modifica un operador vectorial- escalar" + +#~ msgid "Change RGB Operator" +#~ msgstr "Modifica un operador RGB" + +#~ msgid "Toggle Rot Only" +#~ msgstr "només Rotacio" + +#~ msgid "Change Scalar Function" +#~ msgstr "Modifica una Funció Escalar" + +#~ msgid "Change Vec Function" +#~ msgstr "Modifica una Funció Vectorial" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Modificar un Uniforme Escalar" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Modifica un Uniforme Vectorial" + +#~ msgid "Change RGB Uniform" +#~ msgstr "Modifica un Uniforme RGB" + +#~ msgid "Change Default Value" +#~ msgstr "Modifica el Valor per Defecte" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Modifica el Uniforme XForm" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Modifica un Uniforme Textura" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Modifica un Uniforme 'CubeMap'" + +#~ msgid "Change Comment" +#~ msgstr "Modifica el Comentari" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Afegeix/Elimina-ho de la Rampa de Colors" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Modifica la Rampa de Color" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Afegeix/Ellimina-ho del Mapa de Corbes" + +#~ msgid "Modify Curve Map" +#~ msgstr "Modifica el Mapa de Corbes" + +#~ msgid "Change Input Name" +#~ msgstr "Modifica el Nom de l'Entrada" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Connecta els Nodes de Graf" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Desconnecta el Nodes de Graf" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Elimina el Node de Graf d'Ombreig" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Mou el Node de Graf d'Ombreig" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Duplica el(s) Node(s) de Graf" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Elimina el(s) Node(s) de Graf d'Ombreig" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Error: Enllaç de Connexió Cíclic" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Error: Manquen les Connexions d'Entrada" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Afegeix un Node de Graf d'Ombreig" + #~ msgid "Disabled" #~ msgstr "Desactivat" diff --git a/editor/translations/cs.po b/editor/translations/cs.po index d0372cf7aa..0da8ebee3c 100644 --- a/editor/translations/cs.po +++ b/editor/translations/cs.po @@ -5770,134 +5770,6 @@ msgstr "Kontextová nápověda" msgid "Shader" msgstr "Shader" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Změnit skalární konstantu" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Změna RGB konstanty" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Změnit skalární operátor" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Změnit RGB operátor" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Změnit skalární funkci" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Změnit vektorovou funkci" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Změnit výchozí hodnotu" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Změnit komentář" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Upravit mapu křivky" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Změnit název vstupu" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Propojit uzly grafu" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Odpojit uzly grafu" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9471,6 +9343,42 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Změnit skalární konstantu" + +#~ msgid "Change RGB Constant" +#~ msgstr "Změna RGB konstanty" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Změnit skalární operátor" + +#~ msgid "Change RGB Operator" +#~ msgstr "Změnit RGB operátor" + +#~ msgid "Change Scalar Function" +#~ msgstr "Změnit skalární funkci" + +#~ msgid "Change Vec Function" +#~ msgstr "Změnit vektorovou funkci" + +#~ msgid "Change Default Value" +#~ msgstr "Změnit výchozí hodnotu" + +#~ msgid "Change Comment" +#~ msgstr "Změnit komentář" + +#~ msgid "Modify Curve Map" +#~ msgstr "Upravit mapu křivky" + +#~ msgid "Change Input Name" +#~ msgstr "Změnit název vstupu" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Propojit uzly grafu" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Odpojit uzly grafu" + #~ msgid "Disabled" #~ msgstr "Zakázáno" diff --git a/editor/translations/da.po b/editor/translations/da.po index 192240ec0a..d3a036452a 100644 --- a/editor/translations/da.po +++ b/editor/translations/da.po @@ -5812,134 +5812,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/de.po b/editor/translations/de.po index 2a97f8ef3d..641d06841b 100644 --- a/editor/translations/de.po +++ b/editor/translations/de.po @@ -5883,134 +5883,6 @@ msgstr "Kontexthilfe" msgid "Shader" msgstr "Shader" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Ändere skalare Konstante" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Ändere Vektorkonstante" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Ändere RGB-Konstante" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Ändere skalaren Operator" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Ändere Vektoroperator" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Ändere Vektor-Skalar-Operator" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Ändere RGB-Operator" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "schalte exklusive Rotation um" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Ändere skalare Funktion" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Ändere Vektorfunktion" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Ändere Skalar-Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Ändere Vektor-Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Ändere RGB-Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Ändere Standardwert" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Ändere XForm-Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Ändere Textur-Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Ändere Cubemap-Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Ändere Kommentar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Hinzufügen/Entfernen zum Farbgradienten" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Farbverlauf anpassen" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Hinzfügen/Entfernen zum Curve-Map" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Verändere Curve-Map" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Ändere Eingabename" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Verbinde Graph-Nodes" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Trenne Graph-Nodes" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Entferne Shader-Graph-Node" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Verschiebe Shader-Graph-Node" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Dupliziere Graph-Node(s)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Entferne Shade-Graph-Node(s)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Fehler: Zyklische Verbindung" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Fehler: Fehlende Eingangsverbindung" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Shader-Graph-Node hinzufügen" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9676,6 +9548,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Ändere skalare Konstante" + +#~ msgid "Change Vec Constant" +#~ msgstr "Ändere Vektorkonstante" + +#~ msgid "Change RGB Constant" +#~ msgstr "Ändere RGB-Konstante" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Ändere skalaren Operator" + +#~ msgid "Change Vec Operator" +#~ msgstr "Ändere Vektoroperator" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Ändere Vektor-Skalar-Operator" + +#~ msgid "Change RGB Operator" +#~ msgstr "Ändere RGB-Operator" + +#~ msgid "Toggle Rot Only" +#~ msgstr "schalte exklusive Rotation um" + +#~ msgid "Change Scalar Function" +#~ msgstr "Ändere skalare Funktion" + +#~ msgid "Change Vec Function" +#~ msgstr "Ändere Vektorfunktion" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Ändere Skalar-Uniform" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Ändere Vektor-Uniform" + +#~ msgid "Change RGB Uniform" +#~ msgstr "Ändere RGB-Uniform" + +#~ msgid "Change Default Value" +#~ msgstr "Ändere Standardwert" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Ändere XForm-Uniform" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Ändere Textur-Uniform" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Ändere Cubemap-Uniform" + +#~ msgid "Change Comment" +#~ msgstr "Ändere Kommentar" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Hinzufügen/Entfernen zum Farbgradienten" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Farbverlauf anpassen" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Hinzfügen/Entfernen zum Curve-Map" + +#~ msgid "Modify Curve Map" +#~ msgstr "Verändere Curve-Map" + +#~ msgid "Change Input Name" +#~ msgstr "Ändere Eingabename" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Verbinde Graph-Nodes" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Trenne Graph-Nodes" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Entferne Shader-Graph-Node" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Verschiebe Shader-Graph-Node" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Dupliziere Graph-Node(s)" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Entferne Shade-Graph-Node(s)" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Fehler: Zyklische Verbindung" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Fehler: Fehlende Eingangsverbindung" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Shader-Graph-Node hinzufügen" + #~ msgid "Disabled" #~ msgstr "Deaktiviert" diff --git a/editor/translations/de_CH.po b/editor/translations/de_CH.po index a0068f6038..3c10dc874c 100644 --- a/editor/translations/de_CH.po +++ b/editor/translations/de_CH.po @@ -5704,134 +5704,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/editor.pot b/editor/translations/editor.pot index 3dd3be8809..4437b58965 100644 --- a/editor/translations/editor.pot +++ b/editor/translations/editor.pot @@ -5542,134 +5542,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/el.po b/editor/translations/el.po index 64e88cd3be..6dc1f9459d 100644 --- a/editor/translations/el.po +++ b/editor/translations/el.po @@ -5847,134 +5847,6 @@ msgstr "Βοήθεια ανάλογα με τα συμφραζόμενα" msgid "Shader" msgstr "Πρόγραμμα σκίασης" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Αλλαγή μονόμετρης σταθεράς" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Αλλαγή διανυσματικής σταθεράς" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Αλλαγή χρωματικής σταθεράς" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Αλλαγή μονόμετρου τελεστή" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Αλλαγή διανυσματικού τελεστή" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Αλλαγή διανυσματικού - μονόμετρου τελεστή" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Αλλαγή χρωματικού τελεστή" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Εναλλαγή μόνο περιστροφή" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Αλλαγή μονόμετρης συνάρτησης" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Αλλαγή διανυσματικής συνάρτησης" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Αλλαγή μονόμετρης ομοιόμορφης μεταβλητής" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Αλλαγή διανυσματικής ομοιόμορφης μεταβλητής" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Αλλαγή χρωματικής ομοιόμορφης μεταβλητής" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Αλλαγή προεπιλλεγμένης τιμής" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Αλλαγή ομοιόμορφης μεταβλητής XForm" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Αλλαγή ομοιόμορφης μεταβλητής υφής" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Αλλαγή ομοιόμορφης μεταβλητής χάρτη κύβου" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Αλλαγή σχολίου" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Προσθήκη/Αφαίρεση σε διαβάθμηση χρώματος" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Επεξεργασία διαβάθμισης χρωμάτων" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Προσθήκη/Αφαίρεση σε χάρτη καμπύλης" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Τροποποίηση χάρτη καμπύλης" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Αλλαγή ονόματος εισόδου" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Σύνδεση κόμβων γραφήματος" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Αποσύνδεση κόμβων γραφήματος" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Αφαίρεση κόμβου γραφήματος" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Μετακίνηση κόμβου γραφήματος" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Διπλασιασμός κόμβων γραφήματος" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Διαγραφή κόμβων γραφήματος" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Σφάλμα: Κυκλικός σύνδεσμος" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Σφάλμα: Οι συνδέσεις εισόδου λείπουν" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Προσθήκη κόμβου γραφήματος" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9643,6 +9515,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Αλλαγή μονόμετρης σταθεράς" + +#~ msgid "Change Vec Constant" +#~ msgstr "Αλλαγή διανυσματικής σταθεράς" + +#~ msgid "Change RGB Constant" +#~ msgstr "Αλλαγή χρωματικής σταθεράς" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Αλλαγή μονόμετρου τελεστή" + +#~ msgid "Change Vec Operator" +#~ msgstr "Αλλαγή διανυσματικού τελεστή" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Αλλαγή διανυσματικού - μονόμετρου τελεστή" + +#~ msgid "Change RGB Operator" +#~ msgstr "Αλλαγή χρωματικού τελεστή" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Εναλλαγή μόνο περιστροφή" + +#~ msgid "Change Scalar Function" +#~ msgstr "Αλλαγή μονόμετρης συνάρτησης" + +#~ msgid "Change Vec Function" +#~ msgstr "Αλλαγή διανυσματικής συνάρτησης" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Αλλαγή μονόμετρης ομοιόμορφης μεταβλητής" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Αλλαγή διανυσματικής ομοιόμορφης μεταβλητής" + +#~ msgid "Change RGB Uniform" +#~ msgstr "Αλλαγή χρωματικής ομοιόμορφης μεταβλητής" + +#~ msgid "Change Default Value" +#~ msgstr "Αλλαγή προεπιλλεγμένης τιμής" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Αλλαγή ομοιόμορφης μεταβλητής XForm" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Αλλαγή ομοιόμορφης μεταβλητής υφής" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Αλλαγή ομοιόμορφης μεταβλητής χάρτη κύβου" + +#~ msgid "Change Comment" +#~ msgstr "Αλλαγή σχολίου" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Προσθήκη/Αφαίρεση σε διαβάθμηση χρώματος" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Επεξεργασία διαβάθμισης χρωμάτων" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Προσθήκη/Αφαίρεση σε χάρτη καμπύλης" + +#~ msgid "Modify Curve Map" +#~ msgstr "Τροποποίηση χάρτη καμπύλης" + +#~ msgid "Change Input Name" +#~ msgstr "Αλλαγή ονόματος εισόδου" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Σύνδεση κόμβων γραφήματος" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Αποσύνδεση κόμβων γραφήματος" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Αφαίρεση κόμβου γραφήματος" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Μετακίνηση κόμβου γραφήματος" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Διπλασιασμός κόμβων γραφήματος" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Διαγραφή κόμβων γραφήματος" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Σφάλμα: Κυκλικός σύνδεσμος" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Σφάλμα: Οι συνδέσεις εισόδου λείπουν" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Προσθήκη κόμβου γραφήματος" + #~ msgid "Disabled" #~ msgstr "Απενεργοποιημένο" diff --git a/editor/translations/es.po b/editor/translations/es.po index 14b5840256..efc8ae334d 100644 --- a/editor/translations/es.po +++ b/editor/translations/es.po @@ -5885,134 +5885,6 @@ msgstr "Ayuda contextual" msgid "Shader" msgstr "Shader" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Cambiar constante escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Cambiar Constante Vec." - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Cambiar Constante RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Cambiar operador escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Cambiar operador Vec" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Cambiar operador Vec Scalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Cambiar operador RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Act/desact. solo Rot" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Cambiar función Scalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Cambiar función Vec" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Cambiar Scalar uniforme" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Cambiar Vec uniforme" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Cambiar RGB uniforme" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Cambiar valor por defecto" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Cambiar XForm uniforme" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Cambiar textura uniforme" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Cambiar Cubemap uniforme" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Cambiar comentario" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Añadir/quitar de rampa de color" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Modificar rampa de color" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Añadir/quitar a/de mapa de curvas" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Modificar mapa de curvas" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Cambiar nombre de entrada" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Conectar nodos gráficos" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Desconectar nodos gráficos" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Eliminar el nodo gráfico del shader" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Mover el nodo gráfico del shader" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Duplicar nodo(s) gráfico" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Eliminar nodo(s) gráfico(s) del shader" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Error: Link de conexión cíclico" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Error: Conexiones de entrada faltantes" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Añadir nodo gráfico del shader" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9669,6 +9541,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Cambiar constante escalar" + +#~ msgid "Change Vec Constant" +#~ msgstr "Cambiar Constante Vec." + +#~ msgid "Change RGB Constant" +#~ msgstr "Cambiar Constante RGB" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Cambiar operador escalar" + +#~ msgid "Change Vec Operator" +#~ msgstr "Cambiar operador Vec" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Cambiar operador Vec Scalar" + +#~ msgid "Change RGB Operator" +#~ msgstr "Cambiar operador RGB" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Act/desact. solo Rot" + +#~ msgid "Change Scalar Function" +#~ msgstr "Cambiar función Scalar" + +#~ msgid "Change Vec Function" +#~ msgstr "Cambiar función Vec" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Cambiar Scalar uniforme" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Cambiar Vec uniforme" + +#~ msgid "Change RGB Uniform" +#~ msgstr "Cambiar RGB uniforme" + +#~ msgid "Change Default Value" +#~ msgstr "Cambiar valor por defecto" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Cambiar XForm uniforme" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Cambiar textura uniforme" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Cambiar Cubemap uniforme" + +#~ msgid "Change Comment" +#~ msgstr "Cambiar comentario" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Añadir/quitar de rampa de color" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Modificar rampa de color" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Añadir/quitar a/de mapa de curvas" + +#~ msgid "Modify Curve Map" +#~ msgstr "Modificar mapa de curvas" + +#~ msgid "Change Input Name" +#~ msgstr "Cambiar nombre de entrada" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Conectar nodos gráficos" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Desconectar nodos gráficos" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Eliminar el nodo gráfico del shader" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Mover el nodo gráfico del shader" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Duplicar nodo(s) gráfico" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Eliminar nodo(s) gráfico(s) del shader" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Error: Link de conexión cíclico" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Error: Conexiones de entrada faltantes" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Añadir nodo gráfico del shader" + #~ msgid "Disabled" #~ msgstr "Desactivado" diff --git a/editor/translations/es_AR.po b/editor/translations/es_AR.po index 70e4273c72..457b63c44b 100644 --- a/editor/translations/es_AR.po +++ b/editor/translations/es_AR.po @@ -5849,134 +5849,6 @@ msgstr "Ayuda Contextual" msgid "Shader" msgstr "Shader" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Cambiar Constante Escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Cambiar Constante Vec." - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Cambiar Constante RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Cambiar Operador Escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Cambiar Operador Vec." - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Cambiar Operador Vec. Escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Cambiar Operador RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Act/Desact. Solo Rot." - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Cambiar Función Escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Cambiar Función Vec." - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Cambiar Uniforme Escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Cambiar Uniforme Vec." - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Cambiar Uniforme RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Cambiar Valor por Defecto" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Cambiar Uniforme XForm" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Cambiar Uniforme Textura" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Cambiar Uniforme Cubemap" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Cambiar Comentarío" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Agregar/Quitar a Rampa de Color" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Modificar Rampa de Color" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Agregar/quitar a Mapa de Curvas" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Modificar Mapa de Curvas" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Cambiar Nombre de Entrada" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Conectar Nodos de Gráfico" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Desconectar Nodo de Gráfico" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Quitar Nodo de Gráfico de Shaders" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Mover Nodo de Gráfico de Shaders" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Duplicar Nodo(s) de Gráfico" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Quitar Nodo(s) de Gráfico de Shaders" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Error: Link de Conección Cíclico" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Error: Conecciones de Entrada Faltantes" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Agregar Nodo de Gráficos de Shader" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9626,6 +9498,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Cambiar Constante Escalar" + +#~ msgid "Change Vec Constant" +#~ msgstr "Cambiar Constante Vec." + +#~ msgid "Change RGB Constant" +#~ msgstr "Cambiar Constante RGB" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Cambiar Operador Escalar" + +#~ msgid "Change Vec Operator" +#~ msgstr "Cambiar Operador Vec." + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Cambiar Operador Vec. Escalar" + +#~ msgid "Change RGB Operator" +#~ msgstr "Cambiar Operador RGB" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Act/Desact. Solo Rot." + +#~ msgid "Change Scalar Function" +#~ msgstr "Cambiar Función Escalar" + +#~ msgid "Change Vec Function" +#~ msgstr "Cambiar Función Vec." + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Cambiar Uniforme Escalar" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Cambiar Uniforme Vec." + +#~ msgid "Change RGB Uniform" +#~ msgstr "Cambiar Uniforme RGB" + +#~ msgid "Change Default Value" +#~ msgstr "Cambiar Valor por Defecto" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Cambiar Uniforme XForm" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Cambiar Uniforme Textura" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Cambiar Uniforme Cubemap" + +#~ msgid "Change Comment" +#~ msgstr "Cambiar Comentarío" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Agregar/Quitar a Rampa de Color" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Modificar Rampa de Color" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Agregar/quitar a Mapa de Curvas" + +#~ msgid "Modify Curve Map" +#~ msgstr "Modificar Mapa de Curvas" + +#~ msgid "Change Input Name" +#~ msgstr "Cambiar Nombre de Entrada" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Conectar Nodos de Gráfico" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Desconectar Nodo de Gráfico" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Quitar Nodo de Gráfico de Shaders" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Mover Nodo de Gráfico de Shaders" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Duplicar Nodo(s) de Gráfico" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Quitar Nodo(s) de Gráfico de Shaders" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Error: Link de Conección Cíclico" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Error: Conecciones de Entrada Faltantes" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Agregar Nodo de Gráficos de Shader" + #~ msgid "Disabled" #~ msgstr "Desactivado" diff --git a/editor/translations/fa.po b/editor/translations/fa.po index 699df3a09a..2a5818db88 100644 --- a/editor/translations/fa.po +++ b/editor/translations/fa.po @@ -5732,134 +5732,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/fi.po b/editor/translations/fi.po index 8f9293dac2..c6efa1f56a 100644 --- a/editor/translations/fi.po +++ b/editor/translations/fi.po @@ -5830,134 +5830,6 @@ msgstr "Asiayhteydellinen ohje" msgid "Shader" msgstr "Sävytin" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Muuta skalaarivakiota" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Muuta vektorivakiota" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Muuta RGB-värivakiota" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Muuta skalaarioperaattoria" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Muuta vektorioperaattoria" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Muuta vektori- ja skalaarioperaattoria" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Muuta RGB-värioperaattoria" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Vain kierto" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Muuta skalaarifunktiota" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Muuta vektorifunktiota" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Muuta skalaariuniformia" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Muuta vektoriuniformia" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Muuta RGB-uniformia" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Muuta oletusarvoa" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Muuta XForm-uniformia" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Muuta tekstuuriuniformia" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Muuta Cubemap-uniformia" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Vaihda kommenttia" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Lisää tai poista väriluiskalta" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Muokkaa väriliukumaa" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Lisää tai poista käyräkartalta" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Muokkaa käyräkarttaa" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Vaihda syötteen nimi" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Yhdistä graafin solmut" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Erota graafin solmut" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Poista sävytingraafin solmu" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Siirrä sävytingraafin solmua" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Kahdenna graafin solmut(t)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Poista sävytingraafin solmuja" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Virhe: syklinen kytkentä" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Virhe: syöteliitännät puuttuvat" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Lisää sävytingraafin solmu" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9600,6 +9472,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Muuta skalaarivakiota" + +#~ msgid "Change Vec Constant" +#~ msgstr "Muuta vektorivakiota" + +#~ msgid "Change RGB Constant" +#~ msgstr "Muuta RGB-värivakiota" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Muuta skalaarioperaattoria" + +#~ msgid "Change Vec Operator" +#~ msgstr "Muuta vektorioperaattoria" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Muuta vektori- ja skalaarioperaattoria" + +#~ msgid "Change RGB Operator" +#~ msgstr "Muuta RGB-värioperaattoria" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Vain kierto" + +#~ msgid "Change Scalar Function" +#~ msgstr "Muuta skalaarifunktiota" + +#~ msgid "Change Vec Function" +#~ msgstr "Muuta vektorifunktiota" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Muuta skalaariuniformia" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Muuta vektoriuniformia" + +#~ msgid "Change RGB Uniform" +#~ msgstr "Muuta RGB-uniformia" + +#~ msgid "Change Default Value" +#~ msgstr "Muuta oletusarvoa" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Muuta XForm-uniformia" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Muuta tekstuuriuniformia" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Muuta Cubemap-uniformia" + +#~ msgid "Change Comment" +#~ msgstr "Vaihda kommenttia" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Lisää tai poista väriluiskalta" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Muokkaa väriliukumaa" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Lisää tai poista käyräkartalta" + +#~ msgid "Modify Curve Map" +#~ msgstr "Muokkaa käyräkarttaa" + +#~ msgid "Change Input Name" +#~ msgstr "Vaihda syötteen nimi" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Yhdistä graafin solmut" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Erota graafin solmut" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Poista sävytingraafin solmu" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Siirrä sävytingraafin solmua" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Kahdenna graafin solmut(t)" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Poista sävytingraafin solmuja" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Virhe: syklinen kytkentä" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Virhe: syöteliitännät puuttuvat" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Lisää sävytingraafin solmu" + #~ msgid "Disabled" #~ msgstr "Poistettu käytöstä" diff --git a/editor/translations/fr.po b/editor/translations/fr.po index e60e8ef18c..2f98c3cf99 100644 --- a/editor/translations/fr.po +++ b/editor/translations/fr.po @@ -5901,134 +5901,6 @@ msgstr "Aide contextuelle" msgid "Shader" msgstr "Shader" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Modifier une constante scalaire" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Modifier une constance vectorielle" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Modifier une constante RVB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Modifier un opérateur scalaire" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Modifier un opérateur vectoriel" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Modifier un opérateur vectoriel scalaire" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Modifier un opérateur RVB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Basculer en mode rotation seule" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Modifier une fonction scalaire" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Modifier une fonction vecteur" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Modifier échelle" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Modifier vecteur" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Modifier RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Changer la valeur par défaut" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Modifier XForm" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Modifier texture" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Modifier Cubemap" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Modifier un commentaire" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Ajouter/supprimer de la rampe de couleurs" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Modifier une rampe de couleurs" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Ajouter/supprimer de la carte de courbes" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Modifier la carte de courbes" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Changer le nom de l'entrée" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Connecter les nœuds de graphe" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Déconnecter les nœuds de graphe" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Supprimer le nœud de graphe Shader" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Déplacer le nœud de graphe Shader" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Dupliquer le(s) nœud(s) de graphe" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Effacer le(s) nœud(s) de graphe Shader" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Erreur: lien de connexion cyclique" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Erreur : connexions d'entrée manquantes" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Ajouter un nœud de graphe Shader" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9687,6 +9559,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Modifier une constante scalaire" + +#~ msgid "Change Vec Constant" +#~ msgstr "Modifier une constance vectorielle" + +#~ msgid "Change RGB Constant" +#~ msgstr "Modifier une constante RVB" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Modifier un opérateur scalaire" + +#~ msgid "Change Vec Operator" +#~ msgstr "Modifier un opérateur vectoriel" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Modifier un opérateur vectoriel scalaire" + +#~ msgid "Change RGB Operator" +#~ msgstr "Modifier un opérateur RVB" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Basculer en mode rotation seule" + +#~ msgid "Change Scalar Function" +#~ msgstr "Modifier une fonction scalaire" + +#~ msgid "Change Vec Function" +#~ msgstr "Modifier une fonction vecteur" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Modifier échelle" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Modifier vecteur" + +#~ msgid "Change RGB Uniform" +#~ msgstr "Modifier RGB" + +#~ msgid "Change Default Value" +#~ msgstr "Changer la valeur par défaut" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Modifier XForm" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Modifier texture" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Modifier Cubemap" + +#~ msgid "Change Comment" +#~ msgstr "Modifier un commentaire" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Ajouter/supprimer de la rampe de couleurs" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Modifier une rampe de couleurs" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Ajouter/supprimer de la carte de courbes" + +#~ msgid "Modify Curve Map" +#~ msgstr "Modifier la carte de courbes" + +#~ msgid "Change Input Name" +#~ msgstr "Changer le nom de l'entrée" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Connecter les nœuds de graphe" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Déconnecter les nœuds de graphe" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Supprimer le nœud de graphe Shader" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Déplacer le nœud de graphe Shader" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Dupliquer le(s) nœud(s) de graphe" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Effacer le(s) nœud(s) de graphe Shader" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Erreur: lien de connexion cyclique" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Erreur : connexions d'entrée manquantes" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Ajouter un nœud de graphe Shader" + #~ msgid "Disabled" #~ msgstr "Désactivé" diff --git a/editor/translations/he.po b/editor/translations/he.po index 2902886cf9..43bfd2a473 100644 --- a/editor/translations/he.po +++ b/editor/translations/he.po @@ -5685,134 +5685,6 @@ msgstr "עזרה תלוית הקשר" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "שינוי ערך בררת המחדל" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "שינוי הערה" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "שינוי שם קלט" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "שגיאה: חסרים חיבורי קלט" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9273,6 +9145,18 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Default Value" +#~ msgstr "שינוי ערך בררת המחדל" + +#~ msgid "Change Comment" +#~ msgstr "שינוי הערה" + +#~ msgid "Change Input Name" +#~ msgstr "שינוי שם קלט" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "שגיאה: חסרים חיבורי קלט" + #~ msgid "Disabled" #~ msgstr "מושבת" diff --git a/editor/translations/hi.po b/editor/translations/hi.po index 3352ef5e68..87c09cdd07 100644 --- a/editor/translations/hi.po +++ b/editor/translations/hi.po @@ -5632,134 +5632,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/hu.po b/editor/translations/hu.po index d4aa6e9a16..1518b02617 100644 --- a/editor/translations/hu.po +++ b/editor/translations/hu.po @@ -5825,134 +5825,6 @@ msgstr "Kontextusérzékeny Súgó" msgid "Shader" msgstr "Árnyaló" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Skaláris állandó változtatás" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Vec állandó változtatás" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "RGB állandó változtatás" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Skaláris kezelő változtatás" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Vec kezelő változtatás" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Vektor skalár kezelő változtatás" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "RGB kezelő változtatás" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Csak vörös kapcsolása" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Skalár-függvény változtatás" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Vektor-függvény változtatás" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Egységes-skalár változtatás" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Egységes-vektor változtatás" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Egységes-RGB változtatás" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Alapérték változtatás" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Szín Gradiens Módosítása" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9425,6 +9297,51 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Skaláris állandó változtatás" + +#~ msgid "Change Vec Constant" +#~ msgstr "Vec állandó változtatás" + +#~ msgid "Change RGB Constant" +#~ msgstr "RGB állandó változtatás" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Skaláris kezelő változtatás" + +#~ msgid "Change Vec Operator" +#~ msgstr "Vec kezelő változtatás" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Vektor skalár kezelő változtatás" + +#~ msgid "Change RGB Operator" +#~ msgstr "RGB kezelő változtatás" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Csak vörös kapcsolása" + +#~ msgid "Change Scalar Function" +#~ msgstr "Skalár-függvény változtatás" + +#~ msgid "Change Vec Function" +#~ msgstr "Vektor-függvény változtatás" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Egységes-skalár változtatás" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Egységes-vektor változtatás" + +#~ msgid "Change RGB Uniform" +#~ msgstr "Egységes-RGB változtatás" + +#~ msgid "Change Default Value" +#~ msgstr "Alapérték változtatás" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Szín Gradiens Módosítása" + #~ msgid "Disabled" #~ msgstr "Tiltva" diff --git a/editor/translations/id.po b/editor/translations/id.po index 1aaa1233cb..d8ffaf2e05 100644 --- a/editor/translations/id.po +++ b/editor/translations/id.po @@ -5861,134 +5861,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/is.po b/editor/translations/is.po index d0dabb0516..5aedc67388 100644 --- a/editor/translations/is.po +++ b/editor/translations/is.po @@ -5576,134 +5576,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/it.po b/editor/translations/it.po index 919b8079aa..4c60b4d34f 100644 --- a/editor/translations/it.po +++ b/editor/translations/it.po @@ -5881,134 +5881,6 @@ msgstr "Aiuto Contestuale" msgid "Shader" msgstr "Shader" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Cambia Costante Scalare" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Cambia Costante Vett." - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Cambia Costante RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Cambia Operatore Scalare" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Cambia Operatore Vett." - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Cambia Operatore Scalare Vett." - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Cambia Operatore RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Abilita Solo Rot" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Cambia Funzione Scalare" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Cambia Funzione Vett." - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Cambia Uniforme Scalare" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Cambia Uniforme Vett." - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Cambia Uniforme RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Cambia Valore di Default" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Cambia Uniforme XForm" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Cambia Uniforme Texture" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Cambia Uniforme Cubemap" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Cambia Commento" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Aggiungi/Rimuovi alla Rampa Colori" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Modifica Rampa Colori" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Aggiung/Rimuovi alla Mappa Curve" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Modifica la Mappa Curve" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Cambia Nome Input" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Connetti Nodi Grafico" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Disconnetti Nodi Grafico" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Rimuovi Nodo Grafico di Shader" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Sposta Nodo Grafico di Shader" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Duplica Nodo(i) Grafico" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Elimina Nodo(i) Grafico di Shader" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Errore: Giunzione ciclica" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Errore: Connessioni Input MAncanti" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Aggiungi Nodo Grafico Shader" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9749,6 +9621,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Cambia Costante Scalare" + +#~ msgid "Change Vec Constant" +#~ msgstr "Cambia Costante Vett." + +#~ msgid "Change RGB Constant" +#~ msgstr "Cambia Costante RGB" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Cambia Operatore Scalare" + +#~ msgid "Change Vec Operator" +#~ msgstr "Cambia Operatore Vett." + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Cambia Operatore Scalare Vett." + +#~ msgid "Change RGB Operator" +#~ msgstr "Cambia Operatore RGB" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Abilita Solo Rot" + +#~ msgid "Change Scalar Function" +#~ msgstr "Cambia Funzione Scalare" + +#~ msgid "Change Vec Function" +#~ msgstr "Cambia Funzione Vett." + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Cambia Uniforme Scalare" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Cambia Uniforme Vett." + +#~ msgid "Change RGB Uniform" +#~ msgstr "Cambia Uniforme RGB" + +#~ msgid "Change Default Value" +#~ msgstr "Cambia Valore di Default" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Cambia Uniforme XForm" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Cambia Uniforme Texture" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Cambia Uniforme Cubemap" + +#~ msgid "Change Comment" +#~ msgstr "Cambia Commento" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Aggiungi/Rimuovi alla Rampa Colori" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Modifica Rampa Colori" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Aggiung/Rimuovi alla Mappa Curve" + +#~ msgid "Modify Curve Map" +#~ msgstr "Modifica la Mappa Curve" + +#~ msgid "Change Input Name" +#~ msgstr "Cambia Nome Input" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Connetti Nodi Grafico" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Disconnetti Nodi Grafico" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Rimuovi Nodo Grafico di Shader" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Sposta Nodo Grafico di Shader" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Duplica Nodo(i) Grafico" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Elimina Nodo(i) Grafico di Shader" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Errore: Giunzione ciclica" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Errore: Connessioni Input MAncanti" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Aggiungi Nodo Grafico Shader" + #~ msgid "Disabled" #~ msgstr "Disabilitato" diff --git a/editor/translations/ja.po b/editor/translations/ja.po index bf038ba7e0..0f87aaeec5 100644 --- a/editor/translations/ja.po +++ b/editor/translations/ja.po @@ -6385,150 +6385,6 @@ msgstr "文脈参照ヘルプ" msgid "Shader" msgstr "シェーダー" -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Change Scalar Constant" -msgstr "スカラ定数を変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Change Vec Constant" -msgstr "ベクトル定数を変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Change RGB Constant" -msgstr "RGB定数を変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Change Scalar Operator" -msgstr "スカラ演算子を変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Change Vec Operator" -msgstr "ベクトル演算子を変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Change Vec Scalar Operator" -msgstr "ベクトル・スカラ演算子を変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Change RGB Operator" -msgstr "RGB演算子を変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "回転のみ変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Change Scalar Function" -msgstr "スカラ関数を変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Change Vec Function" -msgstr "ベクトル関数を変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "スカラUniformを変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "ベクトルUniformを変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "RGB Uniformを変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "規定値を変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "XForm Uniformを変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "テクスチャUniformを変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "キューブマップUniformを変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "コメントを変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Add/Remove to Color Ramp" -msgstr "色の傾斜を付加/消去" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "色変化の傾斜を修正" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Add/Remove to Curve Map" -msgstr "カーブマップを加える/除去" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "カーブマップを修正" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "入力の名前を変更" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Connect Graph Nodes" -msgstr "グラフノードを接続" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Disconnect Graph Nodes" -msgstr "グラフノードを切断" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Remove Shader Graph Node" -msgstr "シェーダーグラフノードを除去" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Move Shader Graph Node" -msgstr "シェーダーグラフノードを移動" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "グラフノードを複製" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "シェーダーグラフノードを消去" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "エラー:循環結合リンク" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Error: Missing Input Connections" -msgstr "エラー:入力コネクションが失われています" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "シェーダーグラフノードを追加" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -10415,6 +10271,118 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#, fuzzy +#~ msgid "Change Scalar Constant" +#~ msgstr "スカラ定数を変更" + +#, fuzzy +#~ msgid "Change Vec Constant" +#~ msgstr "ベクトル定数を変更" + +#, fuzzy +#~ msgid "Change RGB Constant" +#~ msgstr "RGB定数を変更" + +#, fuzzy +#~ msgid "Change Scalar Operator" +#~ msgstr "スカラ演算子を変更" + +#, fuzzy +#~ msgid "Change Vec Operator" +#~ msgstr "ベクトル演算子を変更" + +#, fuzzy +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "ベクトル・スカラ演算子を変更" + +#, fuzzy +#~ msgid "Change RGB Operator" +#~ msgstr "RGB演算子を変更" + +#~ msgid "Toggle Rot Only" +#~ msgstr "回転のみ変更" + +#, fuzzy +#~ msgid "Change Scalar Function" +#~ msgstr "スカラ関数を変更" + +#, fuzzy +#~ msgid "Change Vec Function" +#~ msgstr "ベクトル関数を変更" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "スカラUniformを変更" + +#~ msgid "Change Vec Uniform" +#~ msgstr "ベクトルUniformを変更" + +#~ msgid "Change RGB Uniform" +#~ msgstr "RGB Uniformを変更" + +#~ msgid "Change Default Value" +#~ msgstr "規定値を変更" + +#~ msgid "Change XForm Uniform" +#~ msgstr "XForm Uniformを変更" + +#~ msgid "Change Texture Uniform" +#~ msgstr "テクスチャUniformを変更" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "キューブマップUniformを変更" + +#~ msgid "Change Comment" +#~ msgstr "コメントを変更" + +#, fuzzy +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "色の傾斜を付加/消去" + +#~ msgid "Modify Color Ramp" +#~ msgstr "色変化の傾斜を修正" + +#, fuzzy +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "カーブマップを加える/除去" + +#~ msgid "Modify Curve Map" +#~ msgstr "カーブマップを修正" + +#~ msgid "Change Input Name" +#~ msgstr "入力の名前を変更" + +#, fuzzy +#~ msgid "Connect Graph Nodes" +#~ msgstr "グラフノードを接続" + +#, fuzzy +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "グラフノードを切断" + +#, fuzzy +#~ msgid "Remove Shader Graph Node" +#~ msgstr "シェーダーグラフノードを除去" + +#, fuzzy +#~ msgid "Move Shader Graph Node" +#~ msgstr "シェーダーグラフノードを移動" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "グラフノードを複製" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "シェーダーグラフノードを消去" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "エラー:循環結合リンク" + +#, fuzzy +#~ msgid "Error: Missing Input Connections" +#~ msgstr "エラー:入力コネクションが失われています" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "シェーダーグラフノードを追加" + #~ msgid "Disabled" #~ msgstr "無効" diff --git a/editor/translations/ka.po b/editor/translations/ka.po index 2c9fe70e36..b8b3e848be 100644 --- a/editor/translations/ka.po +++ b/editor/translations/ka.po @@ -5606,134 +5606,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/ko.po b/editor/translations/ko.po index 7cfa54d1e4..10ee7d659b 100644 --- a/editor/translations/ko.po +++ b/editor/translations/ko.po @@ -5818,134 +5818,6 @@ msgstr "도움말 보기" msgid "Shader" msgstr "셰이더" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Scalar 상수 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Vec 상수 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "RGB 상수 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Scalar 연산자 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Vec 연산자 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Vec Scalar 연산자 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "RGB 연산자 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "회전만 토글" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Scalar 함수 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Vec 함수 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Scalar uniform 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Vec uniform 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "RGB uniform 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "기본값 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "XForm uniform 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "텍스쳐 uniform 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "큐브맵 uniform 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "주석 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "색상 램프 추가/삭제" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "칼라 램프 수정" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "커브 맵 추가/삭제" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "커브맵 수정" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "입력 이름 변경" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "그래프 노드 연결" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "그래프 노드 연결 해제" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "셰이더 그래프 노드 삭제" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "셰이더 그래프 노드 이동" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "그래프 노드 복제" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "셰이더 그래프 노드 삭제" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "에러: 순환 연결 링크" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "에러: 입력 연결 누락" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "셰이더 그래프 노드 추가" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9561,6 +9433,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Scalar 상수 변경" + +#~ msgid "Change Vec Constant" +#~ msgstr "Vec 상수 변경" + +#~ msgid "Change RGB Constant" +#~ msgstr "RGB 상수 변경" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Scalar 연산자 변경" + +#~ msgid "Change Vec Operator" +#~ msgstr "Vec 연산자 변경" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Vec Scalar 연산자 변경" + +#~ msgid "Change RGB Operator" +#~ msgstr "RGB 연산자 변경" + +#~ msgid "Toggle Rot Only" +#~ msgstr "회전만 토글" + +#~ msgid "Change Scalar Function" +#~ msgstr "Scalar 함수 변경" + +#~ msgid "Change Vec Function" +#~ msgstr "Vec 함수 변경" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Scalar uniform 변경" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Vec uniform 변경" + +#~ msgid "Change RGB Uniform" +#~ msgstr "RGB uniform 변경" + +#~ msgid "Change Default Value" +#~ msgstr "기본값 변경" + +#~ msgid "Change XForm Uniform" +#~ msgstr "XForm uniform 변경" + +#~ msgid "Change Texture Uniform" +#~ msgstr "텍스쳐 uniform 변경" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "큐브맵 uniform 변경" + +#~ msgid "Change Comment" +#~ msgstr "주석 변경" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "색상 램프 추가/삭제" + +#~ msgid "Modify Color Ramp" +#~ msgstr "칼라 램프 수정" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "커브 맵 추가/삭제" + +#~ msgid "Modify Curve Map" +#~ msgstr "커브맵 수정" + +#~ msgid "Change Input Name" +#~ msgstr "입력 이름 변경" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "그래프 노드 연결" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "그래프 노드 연결 해제" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "셰이더 그래프 노드 삭제" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "셰이더 그래프 노드 이동" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "그래프 노드 복제" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "셰이더 그래프 노드 삭제" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "에러: 순환 연결 링크" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "에러: 입력 연결 누락" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "셰이더 그래프 노드 추가" + #~ msgid "Disabled" #~ msgstr "비활성화됨" diff --git a/editor/translations/lt.po b/editor/translations/lt.po index 335001493e..f646555da2 100644 --- a/editor/translations/lt.po +++ b/editor/translations/lt.po @@ -5618,134 +5618,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/lv.po b/editor/translations/lv.po index 33494d0309..7dc72def39 100644 --- a/editor/translations/lv.po +++ b/editor/translations/lv.po @@ -5599,134 +5599,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/ms.po b/editor/translations/ms.po index 569408a4e1..e7e084af56 100644 --- a/editor/translations/ms.po +++ b/editor/translations/ms.po @@ -5557,134 +5557,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/nb.po b/editor/translations/nb.po index 9bb2b196c5..fc4a1bed6e 100644 --- a/editor/translations/nb.po +++ b/editor/translations/nb.po @@ -5878,134 +5878,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Endre Kommentar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Modifiser Farge-Rampe" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9534,6 +9406,12 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Comment" +#~ msgstr "Endre Kommentar" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Modifiser Farge-Rampe" + #~ msgid "Disabled" #~ msgstr "Deaktivert" diff --git a/editor/translations/nl.po b/editor/translations/nl.po index 9807fc11e4..5c0aa6546c 100644 --- a/editor/translations/nl.po +++ b/editor/translations/nl.po @@ -5865,135 +5865,6 @@ msgstr "Contextuele Hulp" msgid "Shader" msgstr "Shader" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Verander Shalar Constante" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Verander Vec Constante" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Verander RGB Constante" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Verander Scalar Operator" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Verander Vec Operator" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Verander Vec Scalar Operator" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Verander RGB Operator" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Aan/Uit Alleen Rot" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Verander Scalar Functie" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Verander Vec Functie" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Verander Scalar Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Verander Vec Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Verander RGB Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Verander Standaardwaarde" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Verander XForm Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Verander Textuur Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Verander Cubemap Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Verander Commentaar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Voeg Toe/Verwijder van Kleur Helling" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Modify Color Ramp" -msgstr "Wijzig Kleuren Helling" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Voeg Toe/Verwijder van Curve Map" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Wijzig Curve Map" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Verander Input Naam" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Verbind Graaf Knooppunten" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Ontkoppel Graaf Knooppunten" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Verwijder Shader Graaf Knooppunten" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Verplaats Shader Graaf Knooppunten" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Dupliceer Graaf Knooppunt(en)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Verwijder Shader Graaf Knooppunt(en)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Fout: Cyclische Connectie Link" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Fout: Ontbrekende Input Connecties" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Voeg Shader Graaf Knooppunt Toe" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9629,6 +9500,103 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Verander Shalar Constante" + +#~ msgid "Change Vec Constant" +#~ msgstr "Verander Vec Constante" + +#~ msgid "Change RGB Constant" +#~ msgstr "Verander RGB Constante" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Verander Scalar Operator" + +#~ msgid "Change Vec Operator" +#~ msgstr "Verander Vec Operator" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Verander Vec Scalar Operator" + +#~ msgid "Change RGB Operator" +#~ msgstr "Verander RGB Operator" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Aan/Uit Alleen Rot" + +#~ msgid "Change Scalar Function" +#~ msgstr "Verander Scalar Functie" + +#~ msgid "Change Vec Function" +#~ msgstr "Verander Vec Functie" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Verander Scalar Uniform" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Verander Vec Uniform" + +#~ msgid "Change RGB Uniform" +#~ msgstr "Verander RGB Uniform" + +#~ msgid "Change Default Value" +#~ msgstr "Verander Standaardwaarde" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Verander XForm Uniform" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Verander Textuur Uniform" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Verander Cubemap Uniform" + +#~ msgid "Change Comment" +#~ msgstr "Verander Commentaar" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Voeg Toe/Verwijder van Kleur Helling" + +#, fuzzy +#~ msgid "Modify Color Ramp" +#~ msgstr "Wijzig Kleuren Helling" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Voeg Toe/Verwijder van Curve Map" + +#~ msgid "Modify Curve Map" +#~ msgstr "Wijzig Curve Map" + +#~ msgid "Change Input Name" +#~ msgstr "Verander Input Naam" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Verbind Graaf Knooppunten" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Ontkoppel Graaf Knooppunten" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Verwijder Shader Graaf Knooppunten" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Verplaats Shader Graaf Knooppunten" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Dupliceer Graaf Knooppunt(en)" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Verwijder Shader Graaf Knooppunt(en)" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Fout: Cyclische Connectie Link" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Fout: Ontbrekende Input Connecties" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Voeg Shader Graaf Knooppunt Toe" + #~ msgid "Disabled" #~ msgstr "Uitgeschakeld" diff --git a/editor/translations/pl.po b/editor/translations/pl.po index 96a679a788..3a74f61167 100644 --- a/editor/translations/pl.po +++ b/editor/translations/pl.po @@ -5878,136 +5878,6 @@ msgstr "Pomoc kontekstowa" msgid "Shader" msgstr "Shader" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Zmień wartość stałej skalarnej" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Zmień stałą Vec" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Zmień stałą RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Zmień operator skalara" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Zmień operator Vec" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Zmień operator Vec Scalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Zmień operator RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Przełącz tylko rotacje" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Change Scalar Function" -msgstr "Zamień funkcję skalarną" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Zmień funkcję wektorową" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Zmień Wartość Domyślną" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Zmień komentarz" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Modyfikuj Color Ramp" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Dodaj/Usuń do mapy krzywej" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Edytuj mape krzywej" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Change Input Name" -msgstr "Zmień nazwę wejścia" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Połącz węzły grafu" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Odłącz węzły grafu" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Usuń węzeł Shader Graph" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Duplikuj węzły grafu" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Usuń węzeł(y) Shader Graph" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Błąd: Brakujące połączenia wejścia" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9674,6 +9544,74 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Zmień wartość stałej skalarnej" + +#~ msgid "Change Vec Constant" +#~ msgstr "Zmień stałą Vec" + +#~ msgid "Change RGB Constant" +#~ msgstr "Zmień stałą RGB" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Zmień operator skalara" + +#~ msgid "Change Vec Operator" +#~ msgstr "Zmień operator Vec" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Zmień operator Vec Scalar" + +#~ msgid "Change RGB Operator" +#~ msgstr "Zmień operator RGB" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Przełącz tylko rotacje" + +#, fuzzy +#~ msgid "Change Scalar Function" +#~ msgstr "Zamień funkcję skalarną" + +#~ msgid "Change Vec Function" +#~ msgstr "Zmień funkcję wektorową" + +#~ msgid "Change Default Value" +#~ msgstr "Zmień Wartość Domyślną" + +#~ msgid "Change Comment" +#~ msgstr "Zmień komentarz" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Modyfikuj Color Ramp" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Dodaj/Usuń do mapy krzywej" + +#~ msgid "Modify Curve Map" +#~ msgstr "Edytuj mape krzywej" + +#, fuzzy +#~ msgid "Change Input Name" +#~ msgstr "Zmień nazwę wejścia" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Połącz węzły grafu" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Odłącz węzły grafu" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Usuń węzeł Shader Graph" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Duplikuj węzły grafu" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Usuń węzeł(y) Shader Graph" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Błąd: Brakujące połączenia wejścia" + #~ msgid "Disabled" #~ msgstr "Wyłączone" diff --git a/editor/translations/pr.po b/editor/translations/pr.po index 091d384aae..1ea7dca649 100644 --- a/editor/translations/pr.po +++ b/editor/translations/pr.po @@ -5633,134 +5633,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/pt_BR.po b/editor/translations/pt_BR.po index 1da8d0b968..c88dc3ea2c 100644 --- a/editor/translations/pt_BR.po +++ b/editor/translations/pt_BR.po @@ -5857,134 +5857,6 @@ msgstr "Ajuda Contextual" msgid "Shader" msgstr "Shader" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Alterar Constante Escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Alterar Constante Vet" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Alterar Constante RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Alterar Operador Escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Alterar Operador Vet" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Alterar Operador Vet Escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Alterar Operador RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Alternar Rotação Somente" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Alterar Função Escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Alterar Função Vet" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Alterar Uniforme Escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Alterar Uniforme Vet" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Alterar Uniforme RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Alterar Valor Padrão" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Alterar Uniforme XForm" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Alterar Uniforme da Textura" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Alterar Uniforme do Cubemap" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Alterar Comentário" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Adicionar/Remover para Curva de Cores" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Modificar Curva de Cores" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Adicionar/Remover para Curve Map" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Modificar Curve Map" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Alterar Nome da Entrada" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Conectar Nodes de Grafos" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Desconectar Nodes de Grafos" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Remover Nó de Shader Graph" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Mover Nó de Shader Graph" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Duplicar Nó(s) de Grafo(s)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Deletar Nó(s) de Shader Graph(s)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Erro: Vínculo de Conexão Cíclico" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Erro: Faltando as Conexões da Entrada" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Adicionar Nó de Shader Graph" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9628,6 +9500,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Alterar Constante Escalar" + +#~ msgid "Change Vec Constant" +#~ msgstr "Alterar Constante Vet" + +#~ msgid "Change RGB Constant" +#~ msgstr "Alterar Constante RGB" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Alterar Operador Escalar" + +#~ msgid "Change Vec Operator" +#~ msgstr "Alterar Operador Vet" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Alterar Operador Vet Escalar" + +#~ msgid "Change RGB Operator" +#~ msgstr "Alterar Operador RGB" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Alternar Rotação Somente" + +#~ msgid "Change Scalar Function" +#~ msgstr "Alterar Função Escalar" + +#~ msgid "Change Vec Function" +#~ msgstr "Alterar Função Vet" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Alterar Uniforme Escalar" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Alterar Uniforme Vet" + +#~ msgid "Change RGB Uniform" +#~ msgstr "Alterar Uniforme RGB" + +#~ msgid "Change Default Value" +#~ msgstr "Alterar Valor Padrão" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Alterar Uniforme XForm" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Alterar Uniforme da Textura" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Alterar Uniforme do Cubemap" + +#~ msgid "Change Comment" +#~ msgstr "Alterar Comentário" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Adicionar/Remover para Curva de Cores" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Modificar Curva de Cores" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Adicionar/Remover para Curve Map" + +#~ msgid "Modify Curve Map" +#~ msgstr "Modificar Curve Map" + +#~ msgid "Change Input Name" +#~ msgstr "Alterar Nome da Entrada" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Conectar Nodes de Grafos" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Desconectar Nodes de Grafos" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Remover Nó de Shader Graph" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Mover Nó de Shader Graph" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Duplicar Nó(s) de Grafo(s)" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Deletar Nó(s) de Shader Graph(s)" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Erro: Vínculo de Conexão Cíclico" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Erro: Faltando as Conexões da Entrada" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Adicionar Nó de Shader Graph" + #~ msgid "Disabled" #~ msgstr "Desabilitado" diff --git a/editor/translations/pt_PT.po b/editor/translations/pt_PT.po index 90cba5adfa..9a4a70a1fc 100644 --- a/editor/translations/pt_PT.po +++ b/editor/translations/pt_PT.po @@ -5832,134 +5832,6 @@ msgstr "Ajuda contextual" msgid "Shader" msgstr "Shader" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Mudar constante escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Mudar constante vetorial" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Mudar constante RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Mudar operador escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Mudar operador vetorial" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Mudar operador escalar/vetorial" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Mudar operador RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Alternar só rotação" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Mudar Função escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Mudar Função vetorial" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Mudar uniforme escalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Mudar uniforme vetorial" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Mudar uniforme RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Mudar valor padrão" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Mudar uniforme XForm" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Mudar uniforme textura" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Mudar uniforme Cubemap" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Mudar comentário" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Adicionar/remover da rampa de cores" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Modificar rampa de cores" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Adicionar/remover do mapa de curva" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Modificar mapa de curva" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Mudar nome de entrada" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Conectar Nós do gráfico" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Desconectar Nós do gráfico" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Remover Nó Shader" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Mover Nó Shader" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Duplicar Nó(s)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Apagar Nó(s) Shader" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Erro: conexão cíclica" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Erro: Faltam conexões de entrada" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Adicionar Nó Shader" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9601,6 +9473,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Mudar constante escalar" + +#~ msgid "Change Vec Constant" +#~ msgstr "Mudar constante vetorial" + +#~ msgid "Change RGB Constant" +#~ msgstr "Mudar constante RGB" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Mudar operador escalar" + +#~ msgid "Change Vec Operator" +#~ msgstr "Mudar operador vetorial" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Mudar operador escalar/vetorial" + +#~ msgid "Change RGB Operator" +#~ msgstr "Mudar operador RGB" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Alternar só rotação" + +#~ msgid "Change Scalar Function" +#~ msgstr "Mudar Função escalar" + +#~ msgid "Change Vec Function" +#~ msgstr "Mudar Função vetorial" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Mudar uniforme escalar" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Mudar uniforme vetorial" + +#~ msgid "Change RGB Uniform" +#~ msgstr "Mudar uniforme RGB" + +#~ msgid "Change Default Value" +#~ msgstr "Mudar valor padrão" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Mudar uniforme XForm" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Mudar uniforme textura" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Mudar uniforme Cubemap" + +#~ msgid "Change Comment" +#~ msgstr "Mudar comentário" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Adicionar/remover da rampa de cores" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Modificar rampa de cores" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Adicionar/remover do mapa de curva" + +#~ msgid "Modify Curve Map" +#~ msgstr "Modificar mapa de curva" + +#~ msgid "Change Input Name" +#~ msgstr "Mudar nome de entrada" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Conectar Nós do gráfico" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Desconectar Nós do gráfico" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Remover Nó Shader" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Mover Nó Shader" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Duplicar Nó(s)" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Apagar Nó(s) Shader" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Erro: conexão cíclica" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Erro: Faltam conexões de entrada" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Adicionar Nó Shader" + #~ msgid "Disabled" #~ msgstr "Desativado" diff --git a/editor/translations/ro.po b/editor/translations/ro.po index 524d449391..f668c20d96 100644 --- a/editor/translations/ro.po +++ b/editor/translations/ro.po @@ -5815,134 +5815,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Modifică Rampa de Culori" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9406,6 +9278,9 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Modify Color Ramp" +#~ msgstr "Modifică Rampa de Culori" + #~ msgid "Disabled" #~ msgstr "Dezactivat" diff --git a/editor/translations/ru.po b/editor/translations/ru.po index 2588e2ec88..117fff72c3 100644 --- a/editor/translations/ru.po +++ b/editor/translations/ru.po @@ -5849,134 +5849,6 @@ msgstr "Контекстная справка" msgid "Shader" msgstr "Шейдер" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Изменить числовую константу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Изменить векторную константу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Изменить RGB константу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Изменить числовой оператор" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Изменить векторный оператор" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Изменить векторно-числовой оператор" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Изменить RGB оператор" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Переключить - только поворот" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Изменить числовую функцию" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Изменить векторную функцию" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Изменить числовую единицу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Изменить векторную единицу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Изменить RGB единицу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Изменить значение по умолчанию" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Изменить XForm единицу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Изменить текстурную единицу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Изменить единицу кубической карты" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Изменить комментарий" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Добавить/Удалить в Color Ramp" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Редактировать Color Ramp" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Добавить/Удалить в Curve Map" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Редактировать карту кривой" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Изменить имя входа" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Соединить узлы графа" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Разъединить узлы графа" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Удалить узел графа шейдера" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Передвинуть узел графа шейдера" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Дублировать узел(ы) графа" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Удалить узел(ы) графа шейдера" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Ошибка: Циклическое подключение" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Ошибка: Отсутствует входное подключение" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Добавить узел графа шейдера" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9617,6 +9489,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Изменить числовую константу" + +#~ msgid "Change Vec Constant" +#~ msgstr "Изменить векторную константу" + +#~ msgid "Change RGB Constant" +#~ msgstr "Изменить RGB константу" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Изменить числовой оператор" + +#~ msgid "Change Vec Operator" +#~ msgstr "Изменить векторный оператор" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Изменить векторно-числовой оператор" + +#~ msgid "Change RGB Operator" +#~ msgstr "Изменить RGB оператор" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Переключить - только поворот" + +#~ msgid "Change Scalar Function" +#~ msgstr "Изменить числовую функцию" + +#~ msgid "Change Vec Function" +#~ msgstr "Изменить векторную функцию" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Изменить числовую единицу" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Изменить векторную единицу" + +#~ msgid "Change RGB Uniform" +#~ msgstr "Изменить RGB единицу" + +#~ msgid "Change Default Value" +#~ msgstr "Изменить значение по умолчанию" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Изменить XForm единицу" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Изменить текстурную единицу" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Изменить единицу кубической карты" + +#~ msgid "Change Comment" +#~ msgstr "Изменить комментарий" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Добавить/Удалить в Color Ramp" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Редактировать Color Ramp" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Добавить/Удалить в Curve Map" + +#~ msgid "Modify Curve Map" +#~ msgstr "Редактировать карту кривой" + +#~ msgid "Change Input Name" +#~ msgstr "Изменить имя входа" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Соединить узлы графа" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Разъединить узлы графа" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Удалить узел графа шейдера" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Передвинуть узел графа шейдера" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Дублировать узел(ы) графа" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Удалить узел(ы) графа шейдера" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Ошибка: Циклическое подключение" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Ошибка: Отсутствует входное подключение" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Добавить узел графа шейдера" + #~ msgid "Disabled" #~ msgstr "Отключено" diff --git a/editor/translations/sk.po b/editor/translations/sk.po index fb6bbcb1df..fd3f69f1d2 100644 --- a/editor/translations/sk.po +++ b/editor/translations/sk.po @@ -5632,134 +5632,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/sl.po b/editor/translations/sl.po index 4eec1ad26f..707fc575e7 100644 --- a/editor/translations/sl.po +++ b/editor/translations/sl.po @@ -5792,134 +5792,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/sr_Cyrl.po b/editor/translations/sr_Cyrl.po index 54151d3ab3..aa41c3e609 100644 --- a/editor/translations/sr_Cyrl.po +++ b/editor/translations/sr_Cyrl.po @@ -5835,134 +5835,6 @@ msgstr "Контекстуална помоћ" msgid "Shader" msgstr "Шејдер" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Промени скаларну константу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Промени векторску константу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Промени RGB константу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Промени скаларни оператор" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Промени векторски оператор" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Промени векторско-скаларни оператор" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Промени RGB оператор" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Само ротација" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Промени скаларну функцију" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Промени векторску функцију" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Промени скаларну униформу (uniform)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Промени векторску униформу (uniform)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Промени RGB униформу (uniform)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Промени уобичајену вредност" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Промени XForm униформу (uniform)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Промени текстурну униформу (uniform)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Промени Cubemap униформу (uniform)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Промени коментар" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Додај/обириши из рампе боје" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Измени рампу боје" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Додај/обриши из мапе криве" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Модификуј мапу криве" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Промени улазно име" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Повежи чворове графа" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Искључи чворове графа" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Обриши чвор графа шејдера" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Помери чвор графа шејдера" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Дуплирај чвор/ове графа" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Обриши чвор/ове графа шејдера" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Грешка: пронађена циклична веза" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Грешка: недостаје улазна конекција" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Додај чвор графа шејдера" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9483,6 +9355,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Промени скаларну константу" + +#~ msgid "Change Vec Constant" +#~ msgstr "Промени векторску константу" + +#~ msgid "Change RGB Constant" +#~ msgstr "Промени RGB константу" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Промени скаларни оператор" + +#~ msgid "Change Vec Operator" +#~ msgstr "Промени векторски оператор" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Промени векторско-скаларни оператор" + +#~ msgid "Change RGB Operator" +#~ msgstr "Промени RGB оператор" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Само ротација" + +#~ msgid "Change Scalar Function" +#~ msgstr "Промени скаларну функцију" + +#~ msgid "Change Vec Function" +#~ msgstr "Промени векторску функцију" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Промени скаларну униформу (uniform)" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Промени векторску униформу (uniform)" + +#~ msgid "Change RGB Uniform" +#~ msgstr "Промени RGB униформу (uniform)" + +#~ msgid "Change Default Value" +#~ msgstr "Промени уобичајену вредност" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Промени XForm униформу (uniform)" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Промени текстурну униформу (uniform)" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Промени Cubemap униформу (uniform)" + +#~ msgid "Change Comment" +#~ msgstr "Промени коментар" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Додај/обириши из рампе боје" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Измени рампу боје" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Додај/обриши из мапе криве" + +#~ msgid "Modify Curve Map" +#~ msgstr "Модификуј мапу криве" + +#~ msgid "Change Input Name" +#~ msgstr "Промени улазно име" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Повежи чворове графа" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Искључи чворове графа" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Обриши чвор графа шејдера" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Помери чвор графа шејдера" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Дуплирај чвор/ове графа" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Обриши чвор/ове графа шејдера" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Грешка: пронађена циклична веза" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Грешка: недостаје улазна конекција" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Додај чвор графа шејдера" + #~ msgid "Disabled" #~ msgstr "Онемогућено" diff --git a/editor/translations/sr_Latn.po b/editor/translations/sr_Latn.po index 0f23981fc1..d0458037ba 100644 --- a/editor/translations/sr_Latn.po +++ b/editor/translations/sr_Latn.po @@ -5566,134 +5566,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/sv.po b/editor/translations/sv.po index 6e41fcbaa9..c9f39bdd5d 100644 --- a/editor/translations/sv.po +++ b/editor/translations/sv.po @@ -6121,135 +6121,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -#, fuzzy -msgid "Change Comment" -msgstr "Ändra Kommentar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9932,6 +9803,10 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#, fuzzy +#~ msgid "Change Comment" +#~ msgstr "Ändra Kommentar" + #~ msgid "Disabled" #~ msgstr "Avaktiverad" diff --git a/editor/translations/ta.po b/editor/translations/ta.po index 20f7143578..c3084b15ba 100644 --- a/editor/translations/ta.po +++ b/editor/translations/ta.po @@ -5559,134 +5559,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/th.po b/editor/translations/th.po index de5da160cd..7828977638 100644 --- a/editor/translations/th.po +++ b/editor/translations/th.po @@ -5771,134 +5771,6 @@ msgstr "ค้นหาคำที่เลือกในคู่มือ" msgid "Shader" msgstr "Shader" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "แก้ไขค่าคงที่สเกลาร์" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "แก้ไขค่าคงที่เวกเตอร์" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "แก้ไขค่าคงที่สี" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "แก้ไขเครื่องหมายสเกลาร์" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "แก้ไขเครื่องหมายเวกเตอร์" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "แก้ไขเครื่องหมายเวกเตอร์สเกลาร์" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "แก้ไขเครื่องหมาย RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "สลับเฉพาะการหมุน" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "แก้ไขฟังก์ชันสเกลาร์" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "แก้ไขฟังก์ชันเวกเตอร์" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "แก้ไขสเกลาร์ Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "แก้ไขเวกเตอร์ Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "แก้ไข RGB Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "แก้ไขค่าปริยาย" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "แก้ไข XForm Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "แก้ไข Texture Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "แก้ไข Cubemap Uniform" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "เปลี่ยนข้อคิดเห็น" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "เพิ่ม/ลบในการไล่สี" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "แก้ไขการไล่สี" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "เพิ่ม/ลบในเส้นโค้ง" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "แก้ไขเส้นโค้ง" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "เปลี่ยนชื่ออินพุต" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "เชื่อมต่อโหนด" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "ตัดการเชื่อมต่อโหนด" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "ลบโหนด" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "ย้ายโหนด" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "ทำซ้ำโหนด" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "ลบโหนด" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "ผิดพลาด: เชื่อมต่อเป็นวง" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "ผิดพลาด: ไม่มีขาเข้า" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "เพิ่มโหนด" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9461,6 +9333,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "แก้ไขค่าคงที่สเกลาร์" + +#~ msgid "Change Vec Constant" +#~ msgstr "แก้ไขค่าคงที่เวกเตอร์" + +#~ msgid "Change RGB Constant" +#~ msgstr "แก้ไขค่าคงที่สี" + +#~ msgid "Change Scalar Operator" +#~ msgstr "แก้ไขเครื่องหมายสเกลาร์" + +#~ msgid "Change Vec Operator" +#~ msgstr "แก้ไขเครื่องหมายเวกเตอร์" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "แก้ไขเครื่องหมายเวกเตอร์สเกลาร์" + +#~ msgid "Change RGB Operator" +#~ msgstr "แก้ไขเครื่องหมาย RGB" + +#~ msgid "Toggle Rot Only" +#~ msgstr "สลับเฉพาะการหมุน" + +#~ msgid "Change Scalar Function" +#~ msgstr "แก้ไขฟังก์ชันสเกลาร์" + +#~ msgid "Change Vec Function" +#~ msgstr "แก้ไขฟังก์ชันเวกเตอร์" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "แก้ไขสเกลาร์ Uniform" + +#~ msgid "Change Vec Uniform" +#~ msgstr "แก้ไขเวกเตอร์ Uniform" + +#~ msgid "Change RGB Uniform" +#~ msgstr "แก้ไข RGB Uniform" + +#~ msgid "Change Default Value" +#~ msgstr "แก้ไขค่าปริยาย" + +#~ msgid "Change XForm Uniform" +#~ msgstr "แก้ไข XForm Uniform" + +#~ msgid "Change Texture Uniform" +#~ msgstr "แก้ไข Texture Uniform" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "แก้ไข Cubemap Uniform" + +#~ msgid "Change Comment" +#~ msgstr "เปลี่ยนข้อคิดเห็น" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "เพิ่ม/ลบในการไล่สี" + +#~ msgid "Modify Color Ramp" +#~ msgstr "แก้ไขการไล่สี" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "เพิ่ม/ลบในเส้นโค้ง" + +#~ msgid "Modify Curve Map" +#~ msgstr "แก้ไขเส้นโค้ง" + +#~ msgid "Change Input Name" +#~ msgstr "เปลี่ยนชื่ออินพุต" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "เชื่อมต่อโหนด" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "ตัดการเชื่อมต่อโหนด" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "ลบโหนด" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "ย้ายโหนด" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "ทำซ้ำโหนด" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "ลบโหนด" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "ผิดพลาด: เชื่อมต่อเป็นวง" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "ผิดพลาด: ไม่มีขาเข้า" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "เพิ่มโหนด" + #~ msgid "Disabled" #~ msgstr "ปิดใช้งาน" diff --git a/editor/translations/tr.po b/editor/translations/tr.po index 904af0db92..6b9de6a394 100644 --- a/editor/translations/tr.po +++ b/editor/translations/tr.po @@ -5836,134 +5836,6 @@ msgstr "Bağlamsal Yardım" msgid "Shader" msgstr "Gölgelendirici" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Basamaklı Sabiti Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Vec Sabitini Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "RGB Sabitini Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Skaler Operatörünü Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Vec İşletmenini Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Vec Basamaklı İşletmeni Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "RGB İşletmenini Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Yalnız Döndürmeye Geçiş Yap" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Basamaklı İşlevi Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Vec İşlevini Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Basamaklı Tekdüzenini Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Vec Tekdüzenini Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "RGB Tekdüzenini Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Varsayılan Değeri Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "XForm Tekdüzenini Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Doku Tekdüzenini Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Küp Eşleşme Tekdüzenini Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Yorumu Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Renk Yokuşuna Ekle / Kaldır" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Renk Yokuşunu Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Eğri Haritası Ekle / Kaldır" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Eğri Haritasını Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Giriş Adını Değiştir" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "Çizge Düğümlerini Bağla" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Çizge Düğümlerinin Bağlantılarını Kes" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Gölgelendirici Çizge Düğümünü Kaldır" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Gölgelendirici Çizge Düğümünü Taşı" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Grafik Düğüm(lerini) Çoğalt" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Gölgelendirici Çizge Düğümünü Sil" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Hata: Döngüsel Bağlantı Bağlantısı" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Hata: Girdi Bağlantıları Eksik" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Gölgelendirici Çizge Düğümü Ekle" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9598,6 +9470,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Basamaklı Sabiti Değiştir" + +#~ msgid "Change Vec Constant" +#~ msgstr "Vec Sabitini Değiştir" + +#~ msgid "Change RGB Constant" +#~ msgstr "RGB Sabitini Değiştir" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Skaler Operatörünü Değiştir" + +#~ msgid "Change Vec Operator" +#~ msgstr "Vec İşletmenini Değiştir" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Vec Basamaklı İşletmeni Değiştir" + +#~ msgid "Change RGB Operator" +#~ msgstr "RGB İşletmenini Değiştir" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Yalnız Döndürmeye Geçiş Yap" + +#~ msgid "Change Scalar Function" +#~ msgstr "Basamaklı İşlevi Değiştir" + +#~ msgid "Change Vec Function" +#~ msgstr "Vec İşlevini Değiştir" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Basamaklı Tekdüzenini Değiştir" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Vec Tekdüzenini Değiştir" + +#~ msgid "Change RGB Uniform" +#~ msgstr "RGB Tekdüzenini Değiştir" + +#~ msgid "Change Default Value" +#~ msgstr "Varsayılan Değeri Değiştir" + +#~ msgid "Change XForm Uniform" +#~ msgstr "XForm Tekdüzenini Değiştir" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Doku Tekdüzenini Değiştir" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Küp Eşleşme Tekdüzenini Değiştir" + +#~ msgid "Change Comment" +#~ msgstr "Yorumu Değiştir" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Renk Yokuşuna Ekle / Kaldır" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Renk Yokuşunu Değiştir" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Eğri Haritası Ekle / Kaldır" + +#~ msgid "Modify Curve Map" +#~ msgstr "Eğri Haritasını Değiştir" + +#~ msgid "Change Input Name" +#~ msgstr "Giriş Adını Değiştir" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "Çizge Düğümlerini Bağla" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Çizge Düğümlerinin Bağlantılarını Kes" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Gölgelendirici Çizge Düğümünü Kaldır" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Gölgelendirici Çizge Düğümünü Taşı" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Grafik Düğüm(lerini) Çoğalt" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Gölgelendirici Çizge Düğümünü Sil" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Hata: Döngüsel Bağlantı Bağlantısı" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Hata: Girdi Bağlantıları Eksik" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Gölgelendirici Çizge Düğümü Ekle" + #~ msgid "Disabled" #~ msgstr "Devre dışı" diff --git a/editor/translations/uk.po b/editor/translations/uk.po index b0b029c9b2..153d01f551 100644 --- a/editor/translations/uk.po +++ b/editor/translations/uk.po @@ -5835,134 +5835,6 @@ msgstr "Контекстна довідка" msgid "Shader" msgstr "Шейдер" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "Змінити числову сталу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "Змінити векторну константу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "Змінити сталу RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "Змінити числовий оператор" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "Змінити векторний оператор" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "Змінити векторно-числовий оператор" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "Змінити оператор RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "Перемкнути лише поворот" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "Змінити скалярну функцію" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "Змінити векторну функцію" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "Змінити числову одиницю" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "Змінити векторну одиницю" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "Змінити одиницю RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "Змінити значення за промовчанням" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "Змінити одиницю XForm" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "Змінити одиницю текстури" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "Змінити одиницю кубічної мапи" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "Змінити коментар" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "Додати до рампи кольорів або вилучити з неї" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "Змінити градієнт" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "Додати до карти кривих або вилучити з неї" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "Змінити карту кривої" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "Змінити назву входу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "З'єднати вузли графу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "Роз'єднати вузли графу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "Вилучити вузол графу шейдера" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "Пересунути вузол графу шейдера" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "Дублювати вузли графу" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "Вилучити взули графу шейдера" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "Помилка: циклічне посилання" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "Помилка: пропущено вхідні з'єднання" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "Додати вузол графу шейдера" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9606,6 +9478,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "Змінити числову сталу" + +#~ msgid "Change Vec Constant" +#~ msgstr "Змінити векторну константу" + +#~ msgid "Change RGB Constant" +#~ msgstr "Змінити сталу RGB" + +#~ msgid "Change Scalar Operator" +#~ msgstr "Змінити числовий оператор" + +#~ msgid "Change Vec Operator" +#~ msgstr "Змінити векторний оператор" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "Змінити векторно-числовий оператор" + +#~ msgid "Change RGB Operator" +#~ msgstr "Змінити оператор RGB" + +#~ msgid "Toggle Rot Only" +#~ msgstr "Перемкнути лише поворот" + +#~ msgid "Change Scalar Function" +#~ msgstr "Змінити скалярну функцію" + +#~ msgid "Change Vec Function" +#~ msgstr "Змінити векторну функцію" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "Змінити числову одиницю" + +#~ msgid "Change Vec Uniform" +#~ msgstr "Змінити векторну одиницю" + +#~ msgid "Change RGB Uniform" +#~ msgstr "Змінити одиницю RGB" + +#~ msgid "Change Default Value" +#~ msgstr "Змінити значення за промовчанням" + +#~ msgid "Change XForm Uniform" +#~ msgstr "Змінити одиницю XForm" + +#~ msgid "Change Texture Uniform" +#~ msgstr "Змінити одиницю текстури" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "Змінити одиницю кубічної мапи" + +#~ msgid "Change Comment" +#~ msgstr "Змінити коментар" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "Додати до рампи кольорів або вилучити з неї" + +#~ msgid "Modify Color Ramp" +#~ msgstr "Змінити градієнт" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "Додати до карти кривих або вилучити з неї" + +#~ msgid "Modify Curve Map" +#~ msgstr "Змінити карту кривої" + +#~ msgid "Change Input Name" +#~ msgstr "Змінити назву входу" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "З'єднати вузли графу" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "Роз'єднати вузли графу" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "Вилучити вузол графу шейдера" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "Пересунути вузол графу шейдера" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "Дублювати вузли графу" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "Вилучити взули графу шейдера" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "Помилка: циклічне посилання" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "Помилка: пропущено вхідні з'єднання" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "Додати вузол графу шейдера" + #~ msgid "Disabled" #~ msgstr "Вимкнено" diff --git a/editor/translations/ur_PK.po b/editor/translations/ur_PK.po index 6f4d4e4032..47be7ef1d1 100644 --- a/editor/translations/ur_PK.po +++ b/editor/translations/ur_PK.po @@ -5601,134 +5601,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/vi.po b/editor/translations/vi.po index 89ea2362f7..18d0de7612 100644 --- a/editor/translations/vi.po +++ b/editor/translations/vi.po @@ -5637,134 +5637,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/zh_CN.po b/editor/translations/zh_CN.po index 586efb42f4..d1d840a745 100644 --- a/editor/translations/zh_CN.po +++ b/editor/translations/zh_CN.po @@ -5789,134 +5789,6 @@ msgstr "搜索光标位置" msgid "Shader" msgstr "着色器" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "修改Scalar常量系数" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "修改Vec常量系数" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "修改RGB常量系数" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "更改标量运算符(Scalar Operator)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "更改 Vec 运算符(Vec Operator)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "更改Vec标量运算符(Vec Scalar Operator)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "更改RGB运算符(RGB Operator)" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "切换旋转模式" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "修改Function Scalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "修改Function Vec" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "修改Uniform Scalar" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "修改Uniform Vec" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "修改Uniform RGB" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "修改默认值" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "修改Uniform XForm" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "修改Uniform纹理" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "修改Uniform Cubemap" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "修改注释" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "添加/删除颜色坡度" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "修改色彩曲线图" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "添加/删除曲线地图" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "修改曲线图" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "更改输入名称" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "连接Graph Node" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "断开Graph Node连接" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "移除Graph Node节点" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "移动Graph Node节点" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "复制Graph Node节点" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "删除Graph Node节点" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "错误:循环的连接" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "错误:缺少输入连接" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "添加着色器Graph Node" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" @@ -9482,6 +9354,102 @@ msgstr "" msgid "Varyings can only be assigned in vertex function." msgstr "" +#~ msgid "Change Scalar Constant" +#~ msgstr "修改Scalar常量系数" + +#~ msgid "Change Vec Constant" +#~ msgstr "修改Vec常量系数" + +#~ msgid "Change RGB Constant" +#~ msgstr "修改RGB常量系数" + +#~ msgid "Change Scalar Operator" +#~ msgstr "更改标量运算符(Scalar Operator)" + +#~ msgid "Change Vec Operator" +#~ msgstr "更改 Vec 运算符(Vec Operator)" + +#~ msgid "Change Vec Scalar Operator" +#~ msgstr "更改Vec标量运算符(Vec Scalar Operator)" + +#~ msgid "Change RGB Operator" +#~ msgstr "更改RGB运算符(RGB Operator)" + +#~ msgid "Toggle Rot Only" +#~ msgstr "切换旋转模式" + +#~ msgid "Change Scalar Function" +#~ msgstr "修改Function Scalar" + +#~ msgid "Change Vec Function" +#~ msgstr "修改Function Vec" + +#~ msgid "Change Scalar Uniform" +#~ msgstr "修改Uniform Scalar" + +#~ msgid "Change Vec Uniform" +#~ msgstr "修改Uniform Vec" + +#~ msgid "Change RGB Uniform" +#~ msgstr "修改Uniform RGB" + +#~ msgid "Change Default Value" +#~ msgstr "修改默认值" + +#~ msgid "Change XForm Uniform" +#~ msgstr "修改Uniform XForm" + +#~ msgid "Change Texture Uniform" +#~ msgstr "修改Uniform纹理" + +#~ msgid "Change Cubemap Uniform" +#~ msgstr "修改Uniform Cubemap" + +#~ msgid "Change Comment" +#~ msgstr "修改注释" + +#~ msgid "Add/Remove to Color Ramp" +#~ msgstr "添加/删除颜色坡度" + +#~ msgid "Modify Color Ramp" +#~ msgstr "修改色彩曲线图" + +#~ msgid "Add/Remove to Curve Map" +#~ msgstr "添加/删除曲线地图" + +#~ msgid "Modify Curve Map" +#~ msgstr "修改曲线图" + +#~ msgid "Change Input Name" +#~ msgstr "更改输入名称" + +#~ msgid "Connect Graph Nodes" +#~ msgstr "连接Graph Node" + +#~ msgid "Disconnect Graph Nodes" +#~ msgstr "断开Graph Node连接" + +#~ msgid "Remove Shader Graph Node" +#~ msgstr "移除Graph Node节点" + +#~ msgid "Move Shader Graph Node" +#~ msgstr "移动Graph Node节点" + +#~ msgid "Duplicate Graph Node(s)" +#~ msgstr "复制Graph Node节点" + +#~ msgid "Delete Shader Graph Node(s)" +#~ msgstr "删除Graph Node节点" + +#~ msgid "Error: Cyclic Connection Link" +#~ msgstr "错误:循环的连接" + +#~ msgid "Error: Missing Input Connections" +#~ msgstr "错误:缺少输入连接" + +#~ msgid "Add Shader Graph Node" +#~ msgstr "添加着色器Graph Node" + #~ msgid "Disabled" #~ msgstr "已禁用" diff --git a/editor/translations/zh_HK.po b/editor/translations/zh_HK.po index da699b0bc4..9897e6f5a5 100644 --- a/editor/translations/zh_HK.po +++ b/editor/translations/zh_HK.po @@ -5877,134 +5877,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/editor/translations/zh_TW.po b/editor/translations/zh_TW.po index abaeb9af32..5ce0ea7f67 100644 --- a/editor/translations/zh_TW.po +++ b/editor/translations/zh_TW.po @@ -5748,134 +5748,6 @@ msgstr "" msgid "Shader" msgstr "" -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Constant" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Scalar Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Operator" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Toggle Rot Only" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Function" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Scalar Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Vec Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change RGB Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Default Value" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change XForm Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Texture Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Cubemap Uniform" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Comment" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Color Ramp" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add/Remove to Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Modify Curve Map" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Change Input Name" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Connect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Disconnect Graph Nodes" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Remove Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Move Shader Graph Node" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Duplicate Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Delete Shader Graph Node(s)" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Cyclic Connection Link" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Error: Missing Input Connections" -msgstr "" - -#: editor/plugins/shader_graph_editor_plugin.cpp -msgid "Add Shader Graph Node" -msgstr "" - #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "This skeleton has no bones, create some children Bone2D nodes." msgstr "" diff --git a/main/input_default.cpp b/main/input_default.cpp index 4363fc1c88..d074e05f43 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -265,9 +265,6 @@ void InputDefault::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool Ref<InputEventKey> k = p_event; if (k.is_valid() && !k->is_echo() && k->get_scancode() != 0) { - - //print_line(p_event); - if (k->is_pressed()) keys_pressed.insert(k->get_scancode()); else diff --git a/main/main.cpp b/main/main.cpp index 2fd9cfa734..21851337b7 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1092,7 +1092,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) { boot_logo_path = boot_logo_path.strip_edges(); - if (boot_logo_path != String() /*&& FileAccess::exists(boot_logo_path)*/) { + if (boot_logo_path != String()) { print_line("Boot splash path: " + boot_logo_path); boot_logo.instance(); Error err = boot_logo->load(boot_logo_path); @@ -1164,10 +1164,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) { if (String(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image")) != String()) { - //print_line("use custom cursor"); Ref<Texture> cursor = ResourceLoader::load(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image")); if (cursor.is_valid()) { - //print_line("loaded ok"); Vector2 hotspot = ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image_hotspot"); Input::get_singleton()->set_custom_mouse_cursor(cursor, Input::CURSOR_ARROW, hotspot); } @@ -1214,10 +1212,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) { ClassDB::set_current_api(ClassDB::API_NONE); //no more api is registered at this point - if (OS::get_singleton()->is_stdout_verbose()) { - print_line("CORE API HASH: " + itos(ClassDB::get_api_hash(ClassDB::API_CORE))); - print_line("EDITOR API HASH: " + itos(ClassDB::get_api_hash(ClassDB::API_EDITOR))); - } + print_verbose("CORE API HASH: " + itos(ClassDB::get_api_hash(ClassDB::API_CORE))); + print_verbose("EDITOR API HASH: " + itos(ClassDB::get_api_hash(ClassDB::API_EDITOR))); MAIN_PRINT("Main: Done"); return OK; diff --git a/misc/dist/html/default.html b/misc/dist/html/fixed-size.html index 14766e8239..14766e8239 100644 --- a/misc/dist/html/default.html +++ b/misc/dist/html/fixed-size.html diff --git a/misc/dist/html/full-size.html b/misc/dist/html/full-size.html new file mode 100644 index 0000000000..44b009524c --- /dev/null +++ b/misc/dist/html/full-size.html @@ -0,0 +1,260 @@ +<!DOCTYPE html> +<html xmlns='http://www.w3.org/1999/xhtml' lang='' xml:lang=''> +<head> + <meta charset='utf-8' /> + <meta name='viewport' content='width=device-width, user-scalable=no' /> + <title></title> + <style type='text/css'> + + body { + touch-action: none; + margin: 0; + border: 0 none; + padding: 0; + text-align: center; + background-color: black; + } + + #canvas { + display: block; + margin: 0; + color: white; + } + + #canvas:focus { + outline: none; + } + + .godot { + font-family: 'Noto Sans', 'Droid Sans', Arial, sans-serif; + color: #e0e0e0; + background-color: #3b3943; + background-image: linear-gradient(to bottom, #403e48, #35333c); + border: 1px solid #45434e; + box-shadow: 0 0 1px 1px #2f2d35; + } + + + /* Status display + * ============== */ + + #status { + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + display: flex; + justify-content: center; + align-items: center; + /* don't consume click events - make children visible explicitly */ + visibility: hidden; + } + + #status-progress { + width: 366px; + height: 7px; + background-color: #38363A; + border: 1px solid #444246; + padding: 1px; + box-shadow: 0 0 2px 1px #1B1C22; + border-radius: 2px; + visibility: visible; + } + + @media only screen and (orientation:portrait) { + #status-progress { + width: 61.8%; + } + } + + #status-progress-inner { + height: 100%; + width: 0; + box-sizing: border-box; + transition: width 0.5s linear; + background-color: #202020; + border: 1px solid #222223; + box-shadow: 0 0 1px 1px #27282E; + border-radius: 3px; + } + + #status-indeterminate { + visibility: visible; + position: relative; + } + + #status-indeterminate > div { + width: 4.5px; + height: 0; + border-style: solid; + border-width: 9px 3px 0 3px; + border-color: #2b2b2b transparent transparent transparent; + transform-origin: center 21px; + position: absolute; + } + + #status-indeterminate > div:nth-child(1) { transform: rotate( 22.5deg); } + #status-indeterminate > div:nth-child(2) { transform: rotate( 67.5deg); } + #status-indeterminate > div:nth-child(3) { transform: rotate(112.5deg); } + #status-indeterminate > div:nth-child(4) { transform: rotate(157.5deg); } + #status-indeterminate > div:nth-child(5) { transform: rotate(202.5deg); } + #status-indeterminate > div:nth-child(6) { transform: rotate(247.5deg); } + #status-indeterminate > div:nth-child(7) { transform: rotate(292.5deg); } + #status-indeterminate > div:nth-child(8) { transform: rotate(337.5deg); } + + #status-notice { + margin: 0 100px; + line-height: 1.3; + visibility: visible; + padding: 4px 6px; + visibility: visible; + } + </style> +$GODOT_HEAD_INCLUDE +</head> +<body> + <canvas id='canvas'> + HTML5 canvas appears to be unsupported in the current browser.<br /> + Please try updating or use a different browser. + </canvas> + <div id='status'> + <div id='status-progress' style='display: none;' oncontextmenu='event.preventDefault();'><div id ='status-progress-inner'></div></div> + <div id='status-indeterminate' style='display: none;' oncontextmenu='event.preventDefault();'> + <div></div> + <div></div> + <div></div> + <div></div> + <div></div> + <div></div> + <div></div> + <div></div> + </div> + <div id='status-notice' class='godot' style='display: none;'></div> + </div> + + <script type='text/javascript' src='$GODOT_BASENAME.js'></script> + <script type='text/javascript'>//<![CDATA[ + + var engine = new Engine; + var setStatusMode; + var setStatusNotice; + + (function() { + + const MAIN_PACK = '$GODOT_BASENAME.pck'; + const INDETERMINATE_STATUS_STEP_MS = 100; + + var canvas = document.getElementById('canvas'); + var statusProgress = document.getElementById('status-progress'); + var statusProgressInner = document.getElementById('status-progress-inner'); + var statusIndeterminate = document.getElementById('status-indeterminate'); + var statusNotice = document.getElementById('status-notice'); + + var initializing = true; + var statusMode = 'hidden'; + + var animationCallbacks = []; + function animate(time) { + animationCallbacks.forEach(callback => callback(time)); + requestAnimationFrame(animate); + } + requestAnimationFrame(animate); + + function adjustCanvasDimensions() { + canvas.width = innerWidth; + canvas.height = innerHeight; + } + animationCallbacks.push(adjustCanvasDimensions); + adjustCanvasDimensions(); + + setStatusMode = function setStatusMode(mode) { + + if (statusMode === mode || !initializing) + return; + [statusProgress, statusIndeterminate, statusNotice].forEach(elem => { + elem.style.display = 'none'; + }); + if (animateStatusIndeterminate in animationCallbacks) { + animationCallbacks.erase(animateStatusIndeterminate); + } + switch (mode) { + case 'progress': + statusProgress.style.display = 'block'; + break; + case 'indeterminate': + statusIndeterminate.style.display = 'block'; + animationCallbacks.push(animateStatusIndeterminate); + break; + case 'notice': + statusNotice.style.display = 'block'; + break; + case 'hidden': + break; + default: + throw new Error('Invalid status mode'); + } + statusMode = mode; + } + + function animateStatusIndeterminate(ms) { + + var i = Math.floor(ms / INDETERMINATE_STATUS_STEP_MS % 8); + if (statusIndeterminate.children[i].style.borderTopColor == '') { + Array.prototype.slice.call(statusIndeterminate.children).forEach(child => { + child.style.borderTopColor = ''; + }); + statusIndeterminate.children[i].style.borderTopColor = '#dfdfdf'; + } + } + + setStatusNotice = function setStatusNotice(text) { + + while (statusNotice.lastChild) { + statusNotice.removeChild(statusNotice.lastChild); + } + var lines = text.split('\n'); + lines.forEach((line) => { + statusNotice.appendChild(document.createTextNode(line)); + statusNotice.appendChild(document.createElement('br')); + }); + }; + + engine.setProgressFunc((current, total) => { + + if (total > 0) { + statusProgressInner.style.width = current/total * 100 + '%'; + setStatusMode('progress'); + if (current === total) { + // wait for progress bar animation + setTimeout(() => { + setStatusMode('indeterminate'); + }, 500); + } + } else { + setStatusMode('indeterminate'); + } + }); + + function displayFailureNotice(err) { + var msg = err.message || err; + console.error(msg); + setStatusNotice(msg); + setStatusMode('notice'); + initializing = false; + }; + + if (!Engine.isWebGLAvailable()) { + displayFailureNotice('WebGL not available'); + } else { + setStatusMode('indeterminate'); + engine.setCanvas(canvas); + engine.startGame(MAIN_PACK).then(() => { + setStatusMode('hidden'); + initializing = false; + }, displayFailureNotice); + } + })(); + //]]></script> +</body> +</html> diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp index b004641838..3668088590 100644 --- a/modules/bullet/area_bullet.cpp +++ b/modules/bullet/area_bullet.cpp @@ -236,7 +236,7 @@ void AreaBullet::set_param(PhysicsServer::AreaParameter p_param, const Variant & set_spOv_gravityPointAttenuation(p_value); break; default: - print_line("The Bullet areas doesn't suppot this param: " + itos(p_param)); + WARN_PRINTS("Area doesn't support this parameter in the Bullet backend: " + itos(p_param)); } } @@ -259,7 +259,7 @@ Variant AreaBullet::get_param(PhysicsServer::AreaParameter p_param) const { case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION: return spOv_gravityPointAttenuation; default: - print_line("The Bullet areas doesn't suppot this param: " + itos(p_param)); + WARN_PRINTS("Area doesn't support this parameter in the Bullet backend: " + itos(p_param)); return Variant(); } } diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp index 70f70e7e5f..dbd27a3564 100644 --- a/modules/bullet/bullet_physics_server.cpp +++ b/modules/bullet/bullet_physics_server.cpp @@ -1001,11 +1001,13 @@ void BulletPhysicsServer::soft_body_get_collision_exceptions(RID p_body, List<RI } void BulletPhysicsServer::soft_body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) { - print_line("TODO MUST BE IMPLEMENTED"); + // FIXME: Must be implemented. + WARN_PRINT("soft_body_state is not implemented yet in Bullet backend."); } Variant BulletPhysicsServer::soft_body_get_state(RID p_body, BodyState p_state) const { - print_line("TODO MUST BE IMPLEMENTED"); + // FIXME: Must be implemented. + WARN_PRINT("soft_body_state is not implemented yet in Bullet backend."); return Variant(); } @@ -1439,7 +1441,7 @@ RID BulletPhysicsServer::joint_create_generic_6dof(RID p_body_A, const Transform ERR_FAIL_COND_V(body_A == body_B, RID()); - JointBullet *joint = bulletnew(Generic6DOFJointBullet(body_A, body_B, p_local_frame_A, p_local_frame_B, true)); + JointBullet *joint = bulletnew(Generic6DOFJointBullet(body_A, body_B, p_local_frame_A, p_local_frame_B)); AddJointToSpace(body_A, joint); CreateThenReturnRID(joint_owner, joint); diff --git a/modules/bullet/cone_twist_joint_bullet.cpp b/modules/bullet/cone_twist_joint_bullet.cpp index 472ad3b52c..6b5438c60f 100644 --- a/modules/bullet/cone_twist_joint_bullet.cpp +++ b/modules/bullet/cone_twist_joint_bullet.cpp @@ -64,26 +64,6 @@ ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet setup(coneConstraint); } -void ConeTwistJointBullet::set_angular_only(bool angularOnly) { - coneConstraint->setAngularOnly(angularOnly); -} - -void ConeTwistJointBullet::set_limit(real_t _swingSpan1, real_t _swingSpan2, real_t _twistSpan, real_t _softness, real_t _biasFactor, real_t _relaxationFactor) { - coneConstraint->setLimit(_swingSpan1, _swingSpan2, _twistSpan, _softness, _biasFactor, _relaxationFactor); -} - -int ConeTwistJointBullet::get_solve_twist_limit() { - return coneConstraint->getSolveTwistLimit(); -} - -int ConeTwistJointBullet::get_solve_swing_limit() { - return coneConstraint->getSolveSwingLimit(); -} - -real_t ConeTwistJointBullet::get_twist_limit_sign() { - return coneConstraint->getTwistLimitSign(); -} - void ConeTwistJointBullet::set_param(PhysicsServer::ConeTwistJointParam p_param, real_t p_value) { switch (p_param) { case PhysicsServer::CONE_TWIST_JOINT_SWING_SPAN: diff --git a/modules/bullet/cone_twist_joint_bullet.h b/modules/bullet/cone_twist_joint_bullet.h index bd6eb49196..d6040fd6ec 100644 --- a/modules/bullet/cone_twist_joint_bullet.h +++ b/modules/bullet/cone_twist_joint_bullet.h @@ -47,14 +47,6 @@ public: virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_CONE_TWIST; } - void set_angular_only(bool angularOnly); - - void set_limit(real_t _swingSpan1, real_t _swingSpan2, real_t _twistSpan, real_t _softness = 0.8f, real_t _biasFactor = 0.3f, real_t _relaxationFactor = 1.0f); - int get_solve_twist_limit(); - - int get_solve_swing_limit(); - real_t get_twist_limit_sign(); - void set_param(PhysicsServer::ConeTwistJointParam p_param, real_t p_value); real_t get_param(PhysicsServer::ConeTwistJointParam p_param) const; }; diff --git a/modules/bullet/generic_6dof_joint_bullet.cpp b/modules/bullet/generic_6dof_joint_bullet.cpp index adfad7803f..6275a0d2ed 100644 --- a/modules/bullet/generic_6dof_joint_bullet.cpp +++ b/modules/bullet/generic_6dof_joint_bullet.cpp @@ -34,13 +34,13 @@ #include "bullet_utilities.h" #include "rigid_body_bullet.h" -#include <BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h> +#include <BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h> /** @author AndreaCatania */ -Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA) : +Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB) : JointBullet() { Transform scaled_AFrame(frameInA.scaled(rbA->get_body_scale())); @@ -58,9 +58,9 @@ Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBu btTransform btFrameB; G_TO_B(scaled_BFrame, btFrameB); - sixDOFConstraint = bulletnew(btGeneric6DofConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB, useLinearReferenceFrameA)); + sixDOFConstraint = bulletnew(btGeneric6DofSpring2Constraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB)); } else { - sixDOFConstraint = bulletnew(btGeneric6DofConstraint(*rbA->get_bt_rigid_body(), btFrameA, useLinearReferenceFrameA)); + sixDOFConstraint = bulletnew(btGeneric6DofSpring2Constraint(*rbA->get_bt_rigid_body(), btFrameA)); } setup(sixDOFConstraint); @@ -123,20 +123,11 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO switch (p_param) { case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT: limits_lower[0][p_axis] = p_value; - set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter + set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter break; case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT: limits_upper[0][p_axis] = p_value; - set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter - break; - case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS: - sixDOFConstraint->getTranslationalLimitMotor()->m_limitSoftness = p_value; - break; - case PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION: - sixDOFConstraint->getTranslationalLimitMotor()->m_restitution = p_value; - break; - case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING: - sixDOFConstraint->getTranslationalLimitMotor()->m_damping = p_value; + set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter break; case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY: sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis] = p_value; @@ -146,23 +137,11 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO break; case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT: limits_lower[1][p_axis] = p_value; - set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter + set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter break; case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT: limits_upper[1][p_axis] = p_value; - set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter - break; - case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS: - sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_limitSoftness = p_value; - break; - case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING: - sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_damping = p_value; - break; - case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION: - sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_bounce = p_value; - break; - case PhysicsServer::G6DOF_JOINT_ANGULAR_FORCE_LIMIT: - sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce = p_value; + set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter break; case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_stopERP = p_value; @@ -171,7 +150,7 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_targetVelocity = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT: - sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce = p_value; + sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxMotorForce = p_value; break; default: WARN_PRINT("This parameter is not supported"); @@ -185,12 +164,6 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6 return limits_lower[0][p_axis]; case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT: return limits_upper[0][p_axis]; - case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS: - return sixDOFConstraint->getTranslationalLimitMotor()->m_limitSoftness; - case PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION: - return sixDOFConstraint->getTranslationalLimitMotor()->m_restitution; - case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING: - return sixDOFConstraint->getTranslationalLimitMotor()->m_damping; case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY: return sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis]; case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT: @@ -199,20 +172,14 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6 return limits_lower[1][p_axis]; case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT: return limits_upper[1][p_axis]; - case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS: - return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_limitSoftness; - case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING: - return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_damping; case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION: return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_bounce; - case PhysicsServer::G6DOF_JOINT_ANGULAR_FORCE_LIMIT: - return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce; case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP: return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_stopERP; case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY: return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_targetVelocity; case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT: - return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce; + return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxMotorForce; default: WARN_PRINT("This parameter is not supported"); return 0.; diff --git a/modules/bullet/generic_6dof_joint_bullet.h b/modules/bullet/generic_6dof_joint_bullet.h index ad06582eac..176127ed6c 100644 --- a/modules/bullet/generic_6dof_joint_bullet.h +++ b/modules/bullet/generic_6dof_joint_bullet.h @@ -40,7 +40,7 @@ class RigidBodyBullet; class Generic6DOFJointBullet : public JointBullet { - class btGeneric6DofConstraint *sixDOFConstraint; + class btGeneric6DofSpring2Constraint *sixDOFConstraint; // First is linear second is angular Vector3 limits_lower[2]; @@ -48,7 +48,7 @@ class Generic6DOFJointBullet : public JointBullet { bool flags[3][PhysicsServer::G6DOF_JOINT_FLAG_MAX]; public: - Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA); + Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB); virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_6DOF; } diff --git a/modules/bullet/hinge_joint_bullet.cpp b/modules/bullet/hinge_joint_bullet.cpp index 97ea7ca3df..07fde6efb9 100644 --- a/modules/bullet/hinge_joint_bullet.cpp +++ b/modules/bullet/hinge_joint_bullet.cpp @@ -97,7 +97,7 @@ void HingeJointBullet::set_param(PhysicsServer::HingeJointParam p_param, real_t switch (p_param) { case PhysicsServer::HINGE_JOINT_BIAS: if (0 < p_value) { - print_line("The Bullet Hinge Joint doesn't support bias, So it's always 0"); + WARN_PRINTS("HingeJoint doesn't support bias in the Bullet backend, so it's always 0."); } break; case PhysicsServer::HINGE_JOINT_LIMIT_UPPER: @@ -122,7 +122,7 @@ void HingeJointBullet::set_param(PhysicsServer::HingeJointParam p_param, real_t hingeConstraint->setMaxMotorImpulse(p_value); break; default: - WARN_PRINTS("The Bullet Hinge Joint doesn't support this parameter: " + itos(p_param) + ", value: " + itos(p_value)); + WARN_PRINTS("HingeJoint doesn't support this parameter in the Bullet backend: " + itos(p_param) + ", value: " + itos(p_value)); } } @@ -146,7 +146,7 @@ real_t HingeJointBullet::get_param(PhysicsServer::HingeJointParam p_param) const case PhysicsServer::HINGE_JOINT_MOTOR_MAX_IMPULSE: return hingeConstraint->getMaxMotorImpulse(); default: - WARN_PRINTS("The Bullet Hinge Joint doesn't support this parameter: " + itos(p_param)); + WARN_PRINTS("HingeJoint doesn't support this parameter in the Bullet backend: " + itos(p_param)); return 0; } } diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 9f2171a82a..258c628d93 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -161,8 +161,6 @@ CSGBrush *CSGShape::_get_brush() { void CSGShape::_update_shape() { - //print_line("updating shape for " + String(get_path())); - if (parent) return; @@ -372,7 +370,6 @@ void CSGShape::_notification(int p_what) { if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) { - //print_line("local xform changed"); if (parent) { parent->_make_dirty(); } @@ -641,7 +638,6 @@ CSGBrush *CSGMesh::_build_brush() { } } - //print_line("total vertices? " + itos(vertices.size())); if (vertices.size() == 0) return NULL; diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index 9424080b6d..3cb24d0407 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -217,8 +217,6 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path, if (!(flags & DDSD_MIPMAPCOUNT)) mipmaps = 1; - //print_line("found format: "+String(dds_format_info[dds_format].name)); - PoolVector<uint8_t> src_data; const DDSFormatInfo &info = dds_format_info[dds_format]; diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp index ddfa7af771..f5c817c816 100644 --- a/modules/etc/image_etc.cpp +++ b/modules/etc/image_etc.cpp @@ -199,7 +199,7 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f int wofs = 0; - print_line("begin encoding, format: " + Image::get_format_name(etc_format)); + print_verbose("ETC: Begin encoding, format: " + Image::get_format_name(etc_format)); uint64_t t = OS::get_singleton()->get_ticks_msec(); for (int i = 0; i < mmc; i++) { // convert source image to internal etc2comp format (which is equivalent to Image::FORMAT_RGBAF) @@ -227,7 +227,7 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f delete[] src_rgba_f; } - print_line("time encoding: " + rtos(OS::get_singleton()->get_ticks_msec() - t)); + print_verbose("ETC: Time encoding: " + rtos(OS::get_singleton()->get_ticks_msec() - t)); p_img->create(imgw, imgh, p_img->has_mipmaps(), etc_format, dst_data); } diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 5125b58b41..e05bc7d591 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -294,11 +294,6 @@ bool GDScript::get_property_default_value(const StringName &p_property, Variant #ifdef TOOLS_ENABLED - /* - for (const Map<StringName,Variant>::Element *I=member_default_values.front();I;I=I->next()) { - print_line("\t"+String(String(I->key())+":"+String(I->get()))); - } - */ const Map<StringName, Variant>::Element *E = member_default_values_cache.find(p_property); if (E) { r_value = E->get(); @@ -335,17 +330,8 @@ ScriptInstance *GDScript::instance_create(Object *p_this) { PlaceHolderScriptInstance *GDScript::placeholder_instance_create(Object *p_this) { #ifdef TOOLS_ENABLED - - //instance a fake script for editing the values - //plist.invert(); - - /*print_line("CREATING PLACEHOLDER"); - for(List<PropertyInfo>::Element *E=plist.front();E;E=E->next()) { - print_line(E->get().name); - }*/ PlaceHolderScriptInstance *si = memnew(PlaceHolderScriptInstance(GDScriptLanguage::get_singleton(), Ref<Script>(this), p_this)); placeholders.insert(si); - //_update_placeholder(si); _update_exports(); return si; #else @@ -409,7 +395,6 @@ bool GDScript::_update_exports() { bool changed = false; if (source_changed_cache) { - //print_line("updating source for "+get_path()); source_changed_cache = false; changed = true; @@ -456,11 +441,8 @@ bool GDScript::_update_exports() { if (bf.is_valid()) { - //print_line("parent is: "+bf->get_path()); base_cache = bf; bf->inheriters_cache.insert(get_instance_id()); - - //bf->_update_exports(p_instances,true,false); } } else { ERR_PRINT(("Path extending itself in " + path).utf8().get_data()); @@ -475,7 +457,6 @@ bool GDScript::_update_exports() { continue; members_cache.push_back(c->variables[i]._export); - //print_line("found "+c->variables[i]._export.name); member_default_values_cache[c->variables[i].identifier] = c->variables[i].default_value; } @@ -490,7 +471,6 @@ bool GDScript::_update_exports() { } } } else { - //print_line("unchanged is "+get_path()); } if (base_cache.is_valid()) { @@ -499,11 +479,9 @@ bool GDScript::_update_exports() { } } - if (/*changed &&*/ placeholders.size()) { //hm :( - - //print_line("updating placeholders for "+get_path()); + if (placeholders.size()) { //hm :( - //update placeholders if any + // update placeholders if any Map<StringName, Variant> values; List<PropertyInfo> propnames; _update_exports_values(values, propnames); @@ -529,7 +507,6 @@ void GDScript::update_exports() { Set<ObjectID> copy = inheriters_cache; //might get modified - //print_line("update exports for "+get_path()+" ic: "+itos(copy.size())); for (Set<ObjectID>::Element *E = copy.front(); E; E = E->next()) { Object *id = ObjectDB::get_instance(E->get()); GDScript *s = Object::cast_to<GDScript>(id); @@ -825,7 +802,6 @@ Error GDScript::load_source_code(const String &p_path) { #ifdef TOOLS_ENABLED source_changed_cache = true; #endif - //print_line("LSC :"+get_path()); path = p_path; return OK; } @@ -1507,7 +1483,6 @@ int GDScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_ p_info_arr[current].self_time = elem->self()->profile.last_frame_self_time; p_info_arr[current].total_time = elem->self()->profile.last_frame_total_time; p_info_arr[current].signature = elem->self()->profile.signature; - //print_line(String(elem->self()->profile.signature)+": "+itos(elem->self()->profile.last_frame_call_count)); current++; } elem = elem->next(); @@ -1546,7 +1521,7 @@ struct GDScriptDepSort { void GDScriptLanguage::reload_all_scripts() { #ifdef DEBUG_ENABLED - print_line("RELOAD ALL SCRIPTS"); + print_verbose("GDScript: Reloading all scripts"); if (lock) { lock->lock(); } @@ -1556,7 +1531,7 @@ void GDScriptLanguage::reload_all_scripts() { SelfList<GDScript> *elem = script_list.first(); while (elem) { if (elem->self()->get_path().is_resource_file()) { - print_line("FOUND: " + elem->self()->get_path()); + print_verbose("GDScript: Found: " + elem->self()->get_path()); scripts.push_back(Ref<GDScript>(elem->self())); //cast to gdscript to avoid being erased by accident } elem = elem->next(); @@ -1572,7 +1547,7 @@ void GDScriptLanguage::reload_all_scripts() { for (List<Ref<GDScript> >::Element *E = scripts.front(); E; E = E->next()) { - print_line("RELOADING: " + E->get()->get_path()); + print_verbose("GDScript: Reloading: " + E->get()->get_path()); E->get()->load_source_code(E->get()->get_path()); E->get()->reload(true); } @@ -1703,7 +1678,6 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so void GDScriptLanguage::frame() { - //print_line("calls: "+itos(calls)); calls = 0; #ifdef DEBUG_ENABLED diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 368601127d..1403184557 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -1009,8 +1009,6 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser:: return prev_pos; int retval = prev_pos; - //print_line("retval: "+itos(retval)); - if (retval & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) { slevel++; codegen.alloc_stack(slevel); @@ -2073,8 +2071,6 @@ Error GDScriptCompiler::_parse_class_blocks(GDScript *p_script, const GDScriptPa //validate instances if keeping state if (p_keep_state) { - - print_line("RELOAD KEEP " + p_script->path); for (Set<Object *>::Element *E = p_script->instances.front(); E;) { Set<Object *>::Element *N = E->next(); diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 934c93059a..30400f01e9 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -192,7 +192,6 @@ int GDScriptLanguage::find_function(const String &p_function, const String &p_co if (tokenizer.get_token() == GDScriptTokenizer::TK_NEWLINE) { indent = tokenizer.get_token_line_indent(); } - //print_line("TOKEN: "+String(GDScriptTokenizer::get_token_name(tokenizer.get_token()))); if (indent == 0 && tokenizer.get_token() == GDScriptTokenizer::TK_PR_FUNCTION && tokenizer.get_token(1) == GDScriptTokenizer::TK_IDENTIFIER) { String identifier = tokenizer.get_token_identifier(1); @@ -201,7 +200,6 @@ int GDScriptLanguage::find_function(const String &p_function, const String &p_co } } tokenizer.advance(); - //print_line("NEXT: "+String(GDScriptTokenizer::get_token_name(tokenizer.get_token()))); } return -1; } @@ -2930,7 +2928,6 @@ void GDScriptLanguage::auto_indent_code(String &p_code, int p_from_line, int p_t break; } - //print_line(itos(indent_stack.size())+","+itos(tc)+": "+l); lines.write[i] = l; } diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index f2e52d48dd..d9c20868bd 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -642,7 +642,6 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ str += p_args[i]->operator String(); } - //str+="\n"; print_line(str); r_ret = Variant(); @@ -657,7 +656,6 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ str += p_args[i]->operator String(); } - //str+="\n"; print_line(str); r_ret = Variant(); @@ -672,7 +670,6 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ str += p_args[i]->operator String(); } - //str+="\n"; print_line(str); r_ret = Variant(); @@ -686,7 +683,6 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ str += p_args[i]->operator String(); } - //str+="\n"; print_error(str); r_ret = Variant(); @@ -698,7 +694,6 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ str += p_args[i]->operator String(); } - //str+="\n"; OS::get_singleton()->print("%s", str.utf8().get_data()); r_ret = Variant(); @@ -716,7 +711,6 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ str += "At: " + script->debug_get_stack_level_source(0) + ":" + itos(script->debug_get_stack_level_line(0)); // + " in function '" + script->debug_get_stack_level_function(0) + "'"; } - //str+="\n"; print_line(str); r_ret = Variant(); } break; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 2c0d541d8f..a3f5e1819e 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -1074,9 +1074,6 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s } else { //find list [ or find dictionary { - - //print_line("found bug?"); - _set_error("Error parsing expression, misplaced: " + String(tokenizer->get_token_name(tokenizer->get_token()))); return NULL; //nothing } diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index 537a0c5eaf..6e7842f190 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -937,7 +937,6 @@ void GDScriptTokenizerText::_advance() { _make_constant(val); } else if (period_found || exponent_found) { double val = str.to_double(); - //print_line("*%*%*%*% to convert: "+str+" result: "+rtos(val)); _make_constant(val); } else { int64_t val = str.to_int64(); diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 8b63987cde..776c18da64 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -486,8 +486,6 @@ bool GridMap::_octant_update(const OctantKey &p_key) { if (!mesh_library.is_valid() || !mesh_library->has_item(c.item)) continue; - //print_line("OCTANT, CELLS: "+itos(ii.cells.size())); - Vector3 cellpos = Vector3(E->get().x, E->get().y, E->get().z); Vector3 ofs = _get_offset(); @@ -524,8 +522,6 @@ bool GridMap::_octant_update(const OctantKey &p_key) { if (g.collision_debug.is_valid()) { shapes.write[i].shape->add_vertices_to_array(col_debug, xform * shapes[i].local_transform); } - - //print_line("PHIS x: "+xform); } // add the item's navmesh at given xform to GridMap's Navigation ancestor @@ -614,7 +610,6 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) { Octant &g = *octant_map[p_key]; PhysicsServer::get_singleton()->body_set_state(g.static_body, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform()); PhysicsServer::get_singleton()->body_set_space(g.static_body, get_world()->get_space()); - //print_line("BODYPOS: "+get_global_transform()); if (g.collision_debug_instance.is_valid()) { VS::get_singleton()->instance_set_scenario(g.collision_debug_instance, get_world()->get_scenario()); @@ -1086,7 +1081,6 @@ void GridMap::make_baked_meshes(bool p_gen_lightmap_uv, float p_lightmap_uv_texe for (Map<OctantKey, Map<Ref<Material>, Ref<SurfaceTool> > >::Element *E = surface_map.front(); E; E = E->next()) { - print_line("generating mesh " + itos(ofs++) + "/" + itos(surface_map.size())); Ref<ArrayMesh> mesh; mesh.instance(); for (Map<Ref<Material>, Ref<SurfaceTool> >::Element *F = E->get().front(); F; F = F->next()) { diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index cd1a8266ed..b8b77924f7 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2118,11 +2118,7 @@ Error CSharpScript::reload(bool p_keep_state) { if (script_class) { #ifdef DEBUG_ENABLED - if (OS::get_singleton()->is_stdout_verbose()) { - OS::get_singleton()->print(String("Found class " + script_class->get_namespace() + "." + - script_class->get_name() + " for script " + get_path() + "\n") - .utf8()); - } + print_verbose("Found class " + script_class->get_namespace() + "." + script_class->get_name() + " for script " + get_path()); #endif tool = script_class->has_attribute(CACHED_CLASS(ToolAttribute)); diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp index 0fb8734410..2faab1718d 100644 --- a/modules/mono/editor/godotsharp_builds.cpp +++ b/modules/mono/editor/godotsharp_builds.cpp @@ -97,8 +97,7 @@ MonoString *godot_icall_BuildInstance_get_MSBuildPath() { return GDMonoMarshal::mono_string_from_godot(msbuild_tools_path + "MSBuild.exe"); } - if (OS::get_singleton()->is_stdout_verbose()) - OS::get_singleton()->print("Cannot find executable for '" PROP_NAME_MSBUILD_VS "'. Trying with '" PROP_NAME_MSBUILD_MONO "'...\n"); + print_verbose("Cannot find executable for '" PROP_NAME_MSBUILD_VS "'. Trying with '" PROP_NAME_MSBUILD_MONO "'..."); } // FALL THROUGH case GodotSharpBuilds::MSBUILD_MONO: { String msbuild_path = GDMono::get_singleton()->get_mono_reg_info().bin_dir.plus_file("msbuild.bat"); @@ -556,8 +555,9 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) { exited = true; exit_code = klass->get_field("exitCode")->get_int_value(mono_object); - if (exit_code != 0 && OS::get_singleton()->is_stdout_verbose()) - OS::get_singleton()->print(String("MSBuild finished with exit code " + itos(exit_code) + "\n").utf8()); + if (exit_code != 0) { + print_verbose("MSBuild finished with exit code " + itos(exit_code)); + } build_tab->on_build_exit(exit_code == 0 ? MonoBuildTab::RESULT_SUCCESS : MonoBuildTab::RESULT_ERROR); } else { diff --git a/modules/mono/glue/cs_files/AABB.cs b/modules/mono/glue/cs_files/AABB.cs index 39f2d2ed51..0df2e615f1 100644 --- a/modules/mono/glue/cs_files/AABB.cs +++ b/modules/mono/glue/cs_files/AABB.cs @@ -15,39 +15,33 @@ namespace Godot { public struct AABB : IEquatable<AABB> { - private Vector3 position; - private Vector3 size; + private Vector3 _position; + private Vector3 _size; public Vector3 Position { - get - { - return position; - } + get { return _position; } + set { _position = value; } } public Vector3 Size { - get - { - return size; - } + get { return _size; } + set { _size = value; } } public Vector3 End { - get - { - return position + size; - } + get { return _position + _size; } + set { _size = value - _position; } } public bool Encloses(AABB with) { - Vector3 src_min = position; - Vector3 src_max = position + size; - Vector3 dst_min = with.position; - Vector3 dst_max = with.position + with.size; + Vector3 src_min = _position; + Vector3 src_max = _position + _size; + Vector3 dst_min = with._position; + Vector3 dst_max = with._position + with._size; return src_min.x <= dst_min.x && src_max.x > dst_max.x && @@ -59,8 +53,8 @@ namespace Godot public AABB Expand(Vector3 to_point) { - Vector3 begin = position; - Vector3 end = position + size; + Vector3 begin = _position; + Vector3 end = _position + _size; if (to_point.x < begin.x) begin.x = to_point.x; @@ -81,7 +75,7 @@ namespace Godot public real_t GetArea() { - return size.x * size.y * size.z; + return _size.x * _size.y * _size.z; } public Vector3 GetEndpoint(int idx) @@ -89,21 +83,21 @@ namespace Godot switch (idx) { case 0: - return new Vector3(position.x, position.y, position.z); + return new Vector3(_position.x, _position.y, _position.z); case 1: - return new Vector3(position.x, position.y, position.z + size.z); + return new Vector3(_position.x, _position.y, _position.z + _size.z); case 2: - return new Vector3(position.x, position.y + size.y, position.z); + return new Vector3(_position.x, _position.y + _size.y, _position.z); case 3: - return new Vector3(position.x, position.y + size.y, position.z + size.z); + return new Vector3(_position.x, _position.y + _size.y, _position.z + _size.z); case 4: - return new Vector3(position.x + size.x, position.y, position.z); + return new Vector3(_position.x + _size.x, _position.y, _position.z); case 5: - return new Vector3(position.x + size.x, position.y, position.z + size.z); + return new Vector3(_position.x + _size.x, _position.y, _position.z + _size.z); case 6: - return new Vector3(position.x + size.x, position.y + size.y, position.z); + return new Vector3(_position.x + _size.x, _position.y + _size.y, _position.z); case 7: - return new Vector3(position.x + size.x, position.y + size.y, position.z + size.z); + return new Vector3(_position.x + _size.x, _position.y + _size.y, _position.z + _size.z); default: throw new ArgumentOutOfRangeException(nameof(idx), String.Format("Index is {0}, but a value from 0 to 7 is expected.", idx)); } @@ -112,15 +106,15 @@ namespace Godot public Vector3 GetLongestAxis() { var axis = new Vector3(1f, 0f, 0f); - real_t max_size = size.x; + real_t max_size = _size.x; - if (size.y > max_size) + if (_size.y > max_size) { axis = new Vector3(0f, 1f, 0f); - max_size = size.y; + max_size = _size.y; } - if (size.z > max_size) + if (_size.z > max_size) { axis = new Vector3(0f, 0f, 1f); } @@ -131,15 +125,15 @@ namespace Godot public Vector3.Axis GetLongestAxisIndex() { var axis = Vector3.Axis.X; - real_t max_size = size.x; + real_t max_size = _size.x; - if (size.y > max_size) + if (_size.y > max_size) { axis = Vector3.Axis.Y; - max_size = size.y; + max_size = _size.y; } - if (size.z > max_size) + if (_size.z > max_size) { axis = Vector3.Axis.Z; } @@ -149,13 +143,13 @@ namespace Godot public real_t GetLongestAxisSize() { - real_t max_size = size.x; + real_t max_size = _size.x; - if (size.y > max_size) - max_size = size.y; + if (_size.y > max_size) + max_size = _size.y; - if (size.z > max_size) - max_size = size.z; + if (_size.z > max_size) + max_size = _size.z; return max_size; } @@ -163,15 +157,15 @@ namespace Godot public Vector3 GetShortestAxis() { var axis = new Vector3(1f, 0f, 0f); - real_t max_size = size.x; + real_t max_size = _size.x; - if (size.y < max_size) + if (_size.y < max_size) { axis = new Vector3(0f, 1f, 0f); - max_size = size.y; + max_size = _size.y; } - if (size.z < max_size) + if (_size.z < max_size) { axis = new Vector3(0f, 0f, 1f); } @@ -182,15 +176,15 @@ namespace Godot public Vector3.Axis GetShortestAxisIndex() { var axis = Vector3.Axis.X; - real_t max_size = size.x; + real_t max_size = _size.x; - if (size.y < max_size) + if (_size.y < max_size) { axis = Vector3.Axis.Y; - max_size = size.y; + max_size = _size.y; } - if (size.z < max_size) + if (_size.z < max_size) { axis = Vector3.Axis.Z; } @@ -200,21 +194,21 @@ namespace Godot public real_t GetShortestAxisSize() { - real_t max_size = size.x; + real_t max_size = _size.x; - if (size.y < max_size) - max_size = size.y; + if (_size.y < max_size) + max_size = _size.y; - if (size.z < max_size) - max_size = size.z; + if (_size.z < max_size) + max_size = _size.z; return max_size; } public Vector3 GetSupport(Vector3 dir) { - Vector3 half_extents = size * 0.5f; - Vector3 ofs = position + half_extents; + Vector3 half_extents = _size * 0.5f; + Vector3 ofs = _position + half_extents; return ofs + new Vector3( dir.x > 0f ? -half_extents.x : half_extents.x, @@ -226,39 +220,39 @@ namespace Godot { var res = this; - res.position.x -= by; - res.position.y -= by; - res.position.z -= by; - res.size.x += 2.0f * by; - res.size.y += 2.0f * by; - res.size.z += 2.0f * by; + res._position.x -= by; + res._position.y -= by; + res._position.z -= by; + res._size.x += 2.0f * by; + res._size.y += 2.0f * by; + res._size.z += 2.0f * by; return res; } public bool HasNoArea() { - return size.x <= 0f || size.y <= 0f || size.z <= 0f; + return _size.x <= 0f || _size.y <= 0f || _size.z <= 0f; } public bool HasNoSurface() { - return size.x <= 0f && size.y <= 0f && size.z <= 0f; + return _size.x <= 0f && _size.y <= 0f && _size.z <= 0f; } public bool HasPoint(Vector3 point) { - if (point.x < position.x) + if (point.x < _position.x) return false; - if (point.y < position.y) + if (point.y < _position.y) return false; - if (point.z < position.z) + if (point.z < _position.z) return false; - if (point.x > position.x + size.x) + if (point.x > _position.x + _size.x) return false; - if (point.y > position.y + size.y) + if (point.y > _position.y + _size.y) return false; - if (point.z > position.z + size.z) + if (point.z > _position.z + _size.z) return false; return true; @@ -266,10 +260,10 @@ namespace Godot public AABB Intersection(AABB with) { - Vector3 src_min = position; - Vector3 src_max = position + size; - Vector3 dst_min = with.position; - Vector3 dst_max = with.position + with.size; + Vector3 src_min = _position; + Vector3 src_max = _position + _size; + Vector3 dst_min = with._position; + Vector3 dst_max = with._position + with._size; Vector3 min, max; @@ -302,17 +296,17 @@ namespace Godot public bool Intersects(AABB with) { - if (position.x >= with.position.x + with.size.x) + if (_position.x >= with._position.x + with._size.x) return false; - if (position.x + size.x <= with.position.x) + if (_position.x + _size.x <= with._position.x) return false; - if (position.y >= with.position.y + with.size.y) + if (_position.y >= with._position.y + with._size.y) return false; - if (position.y + size.y <= with.position.y) + if (_position.y + _size.y <= with._position.y) return false; - if (position.z >= with.position.z + with.size.z) + if (_position.z >= with._position.z + with._size.z) return false; - if (position.z + size.z <= with.position.z) + if (_position.z + _size.z <= with._position.z) return false; return true; @@ -322,14 +316,14 @@ namespace Godot { Vector3[] points = { - new Vector3(position.x, position.y, position.z), - new Vector3(position.x, position.y, position.z + size.z), - new Vector3(position.x, position.y + size.y, position.z), - new Vector3(position.x, position.y + size.y, position.z + size.z), - new Vector3(position.x + size.x, position.y, position.z), - new Vector3(position.x + size.x, position.y, position.z + size.z), - new Vector3(position.x + size.x, position.y + size.y, position.z), - new Vector3(position.x + size.x, position.y + size.y, position.z + size.z) + new Vector3(_position.x, _position.y, _position.z), + new Vector3(_position.x, _position.y, _position.z + _size.z), + new Vector3(_position.x, _position.y + _size.y, _position.z), + new Vector3(_position.x, _position.y + _size.y, _position.z + _size.z), + new Vector3(_position.x + _size.x, _position.y, _position.z), + new Vector3(_position.x + _size.x, _position.y, _position.z + _size.z), + new Vector3(_position.x + _size.x, _position.y + _size.y, _position.z), + new Vector3(_position.x + _size.x, _position.y + _size.y, _position.z + _size.z) }; bool over = false; @@ -355,8 +349,8 @@ namespace Godot { real_t seg_from = from[i]; real_t seg_to = to[i]; - real_t box_begin = position[i]; - real_t box_end = box_begin + size[i]; + real_t box_begin = _position[i]; + real_t box_end = box_begin + _size[i]; real_t cmin, cmax; if (seg_from < seg_to) @@ -394,10 +388,10 @@ namespace Godot public AABB Merge(AABB with) { - Vector3 beg_1 = position; - Vector3 beg_2 = with.position; - var end_1 = new Vector3(size.x, size.y, size.z) + beg_1; - var end_2 = new Vector3(with.size.x, with.size.y, with.size.z) + beg_2; + Vector3 beg_1 = _position; + Vector3 beg_2 = with._position; + var end_1 = new Vector3(_size.x, _size.y, _size.z) + beg_1; + var end_2 = new Vector3(with._size.x, with._size.y, with._size.z) + beg_2; var min = new Vector3( beg_1.x < beg_2.x ? beg_1.x : beg_2.x, @@ -417,8 +411,8 @@ namespace Godot // Constructors public AABB(Vector3 position, Vector3 size) { - this.position = position; - this.size = size; + _position = position; + _size = size; } public static bool operator ==(AABB left, AABB right) @@ -443,20 +437,20 @@ namespace Godot public bool Equals(AABB other) { - return position == other.position && size == other.size; + return _position == other._position && _size == other._size; } public override int GetHashCode() { - return position.GetHashCode() ^ size.GetHashCode(); + return _position.GetHashCode() ^ _size.GetHashCode(); } public override string ToString() { return String.Format("{0} - {1}", new object[] { - position.ToString(), - size.ToString() + _position.ToString(), + _size.ToString() }); } @@ -464,8 +458,8 @@ namespace Godot { return String.Format("{0} - {1}", new object[] { - position.ToString(format), - size.ToString(format) + _position.ToString(format), + _size.ToString(format) }); } } diff --git a/modules/mono/glue/cs_files/Attributes/ExportAttribute.cs b/modules/mono/glue/cs_files/Attributes/ExportAttribute.cs new file mode 100644 index 0000000000..6adf044886 --- /dev/null +++ b/modules/mono/glue/cs_files/Attributes/ExportAttribute.cs @@ -0,0 +1,17 @@ +using System; + +namespace Godot +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class ExportAttribute : Attribute + { + private PropertyHint hint; + private string hintString; + + public ExportAttribute(PropertyHint hint = PropertyHint.None, string hintString = "") + { + this.hint = hint; + this.hintString = hintString; + } + } +} diff --git a/modules/mono/glue/cs_files/GodotMethodAttribute.cs b/modules/mono/glue/cs_files/Attributes/GodotMethodAttribute.cs index 55848769d5..55848769d5 100644 --- a/modules/mono/glue/cs_files/GodotMethodAttribute.cs +++ b/modules/mono/glue/cs_files/Attributes/GodotMethodAttribute.cs diff --git a/modules/mono/glue/cs_files/RPCAttributes.cs b/modules/mono/glue/cs_files/Attributes/RPCAttributes.cs index 6bf9560bfa..6bf9560bfa 100644 --- a/modules/mono/glue/cs_files/RPCAttributes.cs +++ b/modules/mono/glue/cs_files/Attributes/RPCAttributes.cs diff --git a/modules/mono/glue/cs_files/SignalAttribute.cs b/modules/mono/glue/cs_files/Attributes/SignalAttribute.cs index 3957387be9..3957387be9 100644 --- a/modules/mono/glue/cs_files/SignalAttribute.cs +++ b/modules/mono/glue/cs_files/Attributes/SignalAttribute.cs diff --git a/modules/mono/glue/cs_files/Attributes/ToolAttribute.cs b/modules/mono/glue/cs_files/Attributes/ToolAttribute.cs new file mode 100644 index 0000000000..d0437409af --- /dev/null +++ b/modules/mono/glue/cs_files/Attributes/ToolAttribute.cs @@ -0,0 +1,7 @@ +using System; + +namespace Godot +{ + [AttributeUsage(AttributeTargets.Class)] + public class ToolAttribute : Attribute {} +} diff --git a/modules/mono/glue/cs_files/ExportAttribute.cs b/modules/mono/glue/cs_files/ExportAttribute.cs deleted file mode 100644 index e6f569e1bb..0000000000 --- a/modules/mono/glue/cs_files/ExportAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace Godot -{ - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public class ExportAttribute : Attribute - { - private PropertyHint hint; - private string hintString; - - public ExportAttribute(PropertyHint hint = PropertyHint.None, string hintString = "") - { - this.hint = hint; - this.hintString = hintString; - } - } -} diff --git a/modules/mono/glue/cs_files/NodeExtensions.cs b/modules/mono/glue/cs_files/Extensions/NodeExtensions.cs index 71534d7782..71534d7782 100644 --- a/modules/mono/glue/cs_files/NodeExtensions.cs +++ b/modules/mono/glue/cs_files/Extensions/NodeExtensions.cs diff --git a/modules/mono/glue/cs_files/ObjectExtensions.cs b/modules/mono/glue/cs_files/Extensions/ObjectExtensions.cs index 5c9e6609f4..5c9e6609f4 100644 --- a/modules/mono/glue/cs_files/ObjectExtensions.cs +++ b/modules/mono/glue/cs_files/Extensions/ObjectExtensions.cs diff --git a/modules/mono/glue/cs_files/ResourceLoaderExtensions.cs b/modules/mono/glue/cs_files/Extensions/ResourceLoaderExtensions.cs index ceecc589e6..ceecc589e6 100644 --- a/modules/mono/glue/cs_files/ResourceLoaderExtensions.cs +++ b/modules/mono/glue/cs_files/Extensions/ResourceLoaderExtensions.cs diff --git a/modules/mono/glue/cs_files/IAwaiter.cs b/modules/mono/glue/cs_files/IAwaiter.cs deleted file mode 100644 index b5aa1a5389..0000000000 --- a/modules/mono/glue/cs_files/IAwaiter.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Runtime.CompilerServices; - -namespace Godot -{ - public interface IAwaiter : INotifyCompletion - { - bool IsCompleted { get; } - - void GetResult(); - } - - public interface IAwaiter<out TResult> : INotifyCompletion - { - bool IsCompleted { get; } - - TResult GetResult(); - } -} diff --git a/modules/mono/glue/cs_files/IAwaitable.cs b/modules/mono/glue/cs_files/Interfaces/IAwaitable.cs index 0397957d00..0397957d00 100644 --- a/modules/mono/glue/cs_files/IAwaitable.cs +++ b/modules/mono/glue/cs_files/Interfaces/IAwaitable.cs diff --git a/modules/mono/glue/cs_files/Interfaces/IAwaiter.cs b/modules/mono/glue/cs_files/Interfaces/IAwaiter.cs new file mode 100644 index 0000000000..d3be9d781c --- /dev/null +++ b/modules/mono/glue/cs_files/Interfaces/IAwaiter.cs @@ -0,0 +1,18 @@ +using System.Runtime.CompilerServices; + +namespace Godot +{ + public interface IAwaiter : INotifyCompletion + { + bool IsCompleted { get; } + + void GetResult(); + } + + public interface IAwaiter<out TResult> : INotifyCompletion + { + bool IsCompleted { get; } + + TResult GetResult(); + } +} diff --git a/modules/mono/glue/cs_files/Rect2.cs b/modules/mono/glue/cs_files/Rect2.cs index e772665009..cb25c267bc 100644 --- a/modules/mono/glue/cs_files/Rect2.cs +++ b/modules/mono/glue/cs_files/Rect2.cs @@ -29,6 +29,7 @@ namespace Godot public Vector2 End { get { return _position + _size; } + set { _size = value - _position; } } public real_t Area diff --git a/modules/mono/glue/cs_files/StringExtensions.cs b/modules/mono/glue/cs_files/StringExtensions.cs index eaeed7b37b..b58f8bc6a8 100644 --- a/modules/mono/glue/cs_files/StringExtensions.cs +++ b/modules/mono/glue/cs_files/StringExtensions.cs @@ -1,5 +1,3 @@ -//using System; - using System; using System.Collections.Generic; using System.Globalization; @@ -583,7 +581,7 @@ namespace Godot // </summary> public static byte[] Md5Buffer(this string instance) { - return NativeCalls.godot_icall_String_md5_buffer(instance); + return NativeCalls.godot_icall_String_md5_buffer(instance); } // <summary> @@ -591,7 +589,7 @@ namespace Godot // </summary> public static string Md5Text(this string instance) { - return NativeCalls.godot_icall_String_md5_text(instance); + return NativeCalls.godot_icall_String_md5_text(instance); } // <summary> @@ -750,7 +748,7 @@ namespace Godot // </summary> public static int Rfind(this string instance, string what, int from = -1) { - return NativeCalls.godot_icall_String_rfind(instance, what, from); + return NativeCalls.godot_icall_String_rfind(instance, what, from); } // <summary> @@ -758,7 +756,7 @@ namespace Godot // </summary> public static int Rfindn(this string instance, string what, int from = -1) { - return NativeCalls.godot_icall_String_rfindn(instance, what, from); + return NativeCalls.godot_icall_String_rfindn(instance, what, from); } // <summary> @@ -777,7 +775,7 @@ namespace Godot public static byte[] Sha256Buffer(this string instance) { - return NativeCalls.godot_icall_String_sha256_buffer(instance); + return NativeCalls.godot_icall_String_sha256_buffer(instance); } // <summary> @@ -785,7 +783,7 @@ namespace Godot // </summary> public static string Sha256Text(this string instance) { - return NativeCalls.godot_icall_String_sha256_text(instance); + return NativeCalls.godot_icall_String_sha256_text(instance); } // <summary> diff --git a/modules/mono/glue/cs_files/ToolAttribute.cs b/modules/mono/glue/cs_files/ToolAttribute.cs deleted file mode 100644 index d8601b5b32..0000000000 --- a/modules/mono/glue/cs_files/ToolAttribute.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; - -namespace Godot -{ - [AttributeUsage(AttributeTargets.Class)] - public class ToolAttribute : Attribute {} -} diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index f564b93f8f..fadac941e9 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -148,7 +148,7 @@ void GDMono::initialize() { ERR_FAIL_NULL(Engine::get_singleton()); - OS::get_singleton()->print("Mono: Initializing module...\n"); + print_verbose("Mono: Initializing module..."); #ifdef DEBUG_METHODS_ENABLED _initialize_and_check_api_hashes(); @@ -202,7 +202,7 @@ void GDMono::initialize() { runtime_initialized = true; - OS::get_singleton()->print("Mono: Runtime initialized\n"); + print_verbose("Mono: Runtime initialized"); // mscorlib assembly MUST be present at initialization ERR_EXPLAIN("Mono: Failed to load mscorlib assembly"); @@ -226,7 +226,7 @@ void GDMono::initialize() { #ifdef DEBUG_ENABLED bool debugger_attached = _wait_for_debugger_msecs(500); if (!debugger_attached && OS::get_singleton()->is_stdout_verbose()) - OS::get_singleton()->printerr("Mono: Debugger wait timeout\n"); + print_error("Mono: Debugger wait timeout"); #endif _register_internal_calls(); @@ -256,7 +256,7 @@ void GDMono::initialize() { metadata_set_api_assembly_invalidated(APIAssembly::API_EDITOR, true); } - OS::get_singleton()->print("Mono: Proceeding to unload scripts domain because of invalid API assemblies\n"); + print_line("Mono: Proceeding to unload scripts domain because of invalid API assemblies."); Error err = _unload_scripts_domain(); if (err != OK) { @@ -269,11 +269,10 @@ void GDMono::initialize() { } } #else - if (OS::get_singleton()->is_stdout_verbose()) - OS::get_singleton()->print("Mono: Glue disabled, ignoring script assemblies\n"); + print_verbose("Mono: Glue disabled, ignoring script assemblies."); #endif - OS::get_singleton()->print("Mono: INITIALIZED\n"); + print_verbose("Mono: INITIALIZED"); } #ifndef MONO_GLUE_DISABLED @@ -352,8 +351,7 @@ bool GDMono::load_assembly(const String &p_name, MonoAssemblyName *p_aname, GDMo CRASH_COND(!r_assembly); - if (OS::get_singleton()->is_stdout_verbose()) - OS::get_singleton()->print((String() + "Mono: Loading assembly " + p_name + (p_refonly ? " (refonly)" : "") + "...\n").utf8()); + print_verbose("Mono: Loading assembly " + p_name + (p_refonly ? " (refonly)" : "") + "..."); MonoImageOpenStatus status = MONO_IMAGE_OK; MonoAssembly *assembly = mono_assembly_load_full(p_aname, NULL, &status, p_refonly); @@ -372,8 +370,7 @@ bool GDMono::load_assembly(const String &p_name, MonoAssemblyName *p_aname, GDMo *r_assembly = *stored_assembly; - if (OS::get_singleton()->is_stdout_verbose()) - OS::get_singleton()->print(String("Mono: Assembly " + p_name + (p_refonly ? " (refonly)" : "") + " loaded from path: " + (*r_assembly)->get_path() + "\n").utf8()); + print_verbose("Mono: Assembly " + p_name + (p_refonly ? " (refonly)" : "") + " loaded from path: " + (*r_assembly)->get_path()); return true; } @@ -500,7 +497,7 @@ bool GDMono::_load_project_assembly() { mono_assembly_set_main(project_assembly->get_assembly()); } else { if (OS::get_singleton()->is_stdout_verbose()) - OS::get_singleton()->printerr("Mono: Failed to load project assembly\n"); + print_error("Mono: Failed to load project assembly"); } return success; @@ -510,13 +507,13 @@ bool GDMono::_load_api_assemblies() { if (!_load_core_api_assembly()) { if (OS::get_singleton()->is_stdout_verbose()) - OS::get_singleton()->printerr("Mono: Failed to load Core API assembly\n"); + print_error("Mono: Failed to load Core API assembly"); return false; } else { #ifdef TOOLS_ENABLED if (!_load_editor_api_assembly()) { if (OS::get_singleton()->is_stdout_verbose()) - OS::get_singleton()->printerr("Mono: Failed to load Editor API assembly\n"); + print_error("Mono: Failed to load Editor API assembly"); return false; } #endif @@ -593,9 +590,7 @@ Error GDMono::_load_scripts_domain() { ERR_FAIL_COND_V(scripts_domain != NULL, ERR_BUG); - if (OS::get_singleton()->is_stdout_verbose()) { - OS::get_singleton()->print("Mono: Loading scripts domain...\n"); - } + print_verbose("Mono: Loading scripts domain..."); scripts_domain = GDMonoUtils::create_domain("GodotEngine.ScriptsDomain"); @@ -611,9 +606,7 @@ Error GDMono::_unload_scripts_domain() { ERR_FAIL_NULL_V(scripts_domain, ERR_BUG); - if (OS::get_singleton()->is_stdout_verbose()) { - OS::get_singleton()->print("Mono: Unloading scripts domain...\n"); - } + print_verbose("Mono: Unloading scripts domain..."); _GodotSharp::get_singleton()->_dispose_callback(); @@ -661,9 +654,7 @@ Error GDMono::_load_tools_domain() { ERR_FAIL_COND_V(tools_domain != NULL, ERR_BUG); - if (OS::get_singleton()->is_stdout_verbose()) { - OS::get_singleton()->print("Mono: Loading tools domain...\n"); - } + print_verbose("Mono: Loading tools domain..."); tools_domain = GDMonoUtils::create_domain("GodotEngine.ToolsDomain"); @@ -728,8 +719,7 @@ Error GDMono::reload_scripts_domain() { if (!_load_project_assembly()) return ERR_CANT_OPEN; #else - if (OS::get_singleton()->is_stdout_verbose()) - OS::get_singleton()->print("Mono: Glue disabled, ignoring script assemblies\n"); + print_verbose("Mono: Glue disabled, ignoring script assemblies."); #endif return OK; @@ -742,9 +732,7 @@ Error GDMono::finalize_and_unload_domain(MonoDomain *p_domain) { String domain_name = mono_domain_get_friendly_name(p_domain); - if (OS::get_singleton()->is_stdout_verbose()) { - OS::get_singleton()->print(String("Mono: Unloading domain `" + domain_name + "`...\n").utf8()); - } + print_verbose("Mono: Unloading domain `" + domain_name + "`..."); if (mono_domain_get() != root_domain) mono_domain_set(root_domain, true); @@ -877,7 +865,7 @@ GDMono::~GDMono() { GDMonoUtils::clear_cache(); - OS::get_singleton()->print("Mono: Runtime cleanup...\n"); + print_verbose("Mono: Runtime cleanup..."); runtime_initialized = false; mono_jit_cleanup(root_domain); diff --git a/modules/mono/mono_gd/gd_mono_log.cpp b/modules/mono/mono_gd/gd_mono_log.cpp index eabea8dc3c..5224d309de 100644 --- a/modules/mono/mono_gd/gd_mono_log.cpp +++ b/modules/mono/mono_gd/gd_mono_log.cpp @@ -152,8 +152,7 @@ void GDMonoLog::initialize() { log_level_id = log_level_get_id(log_level); if (log_file) { - if (OS::get_singleton()->is_stdout_verbose()) - OS::get_singleton()->print(String("Mono: Logfile is " + log_file_path + "\n").utf8()); + print_verbose("Mono: Logfile is " + log_file_path); mono_trace_set_log_handler(gdmono_MonoLogCallback, this); } else { OS::get_singleton()->printerr("Mono: No log file, using default log handler\n"); diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp index 911d629956..bebc3b863f 100644 --- a/modules/mono/mono_gd/gd_mono_utils.cpp +++ b/modules/mono/mono_gd/gd_mono_utils.cpp @@ -590,14 +590,14 @@ current_invoke_count = 0; MonoObject *runtime_invoke(MonoMethod *p_method, void *p_obj, void **p_params, MonoException **p_exc) { GD_MONO_BEGIN_RUNTIME_INVOKE; - MonoObject *ret = mono_runtime_invoke(p_method, p_obj, p_params, (MonoObject **)&p_exc); + MonoObject *ret = mono_runtime_invoke(p_method, p_obj, p_params, (MonoObject **)p_exc); GD_MONO_END_RUNTIME_INVOKE; return ret; } MonoObject *runtime_invoke_array(MonoMethod *p_method, void *p_obj, MonoArray *p_params, MonoException **p_exc) { GD_MONO_BEGIN_RUNTIME_INVOKE; - MonoObject *ret = mono_runtime_invoke_array(p_method, p_obj, p_params, (MonoObject **)&p_exc); + MonoObject *ret = mono_runtime_invoke_array(p_method, p_obj, p_params, (MonoObject **)p_exc); GD_MONO_END_RUNTIME_INVOKE; return ret; } diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index f5d35714e1..6ec44023c1 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -93,7 +93,7 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path, print_line("bmask: "+itos(bmask)); print_line("amask: "+itos(amask)); print_line("surfcount: "+itos(surfcount)); -*/ + */ PoolVector<uint8_t> data; data.resize(surfsize); @@ -159,8 +159,6 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path, if (mipmaps) tex_flags |= Texture::FLAG_MIPMAPS; - print_line("flip: " + itos(flags & PVR_VFLIP)); - Ref<Image> image = memnew(Image(width, height, mipmaps, format, data)); ERR_FAIL_COND_V(image->empty(), RES()); @@ -646,12 +644,6 @@ static void decompress_pvrtc(PVRTCBlock *p_comp_img, const int p_2bit, const int static void _pvrtc_decompress(Image *p_img) { - /* - static void decompress_pvrtc(const void *p_comp_img, const int p_2bit, const int p_width, const int p_height, unsigned char* p_dst) { - decompress_pvrtc((PVRTCBlock*)p_comp_img,p_2bit,p_width,p_height,1,p_dst); - } - */ - ERR_FAIL_COND(p_img->get_format() != Image::FORMAT_PVRTC2 && p_img->get_format() != Image::FORMAT_PVRTC2A && p_img->get_format() != Image::FORMAT_PVRTC4 && p_img->get_format() != Image::FORMAT_PVRTC4A); bool _2bit = (p_img->get_format() == Image::FORMAT_PVRTC2 || p_img->get_format() == Image::FORMAT_PVRTC2A); @@ -665,12 +657,6 @@ static void _pvrtc_decompress(Image *p_img) { decompress_pvrtc((PVRTCBlock *)r.ptr(), _2bit, p_img->get_width(), p_img->get_height(), 0, (unsigned char *)w.ptr()); - /* - for(int i=0;i<newdata.size();i++) { - print_line(itos(w[i])); - } - */ - w = PoolVector<uint8_t>::Write(); r = PoolVector<uint8_t>::Read(); diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index 25fc897146..653dd82351 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -59,7 +59,7 @@ void image_decompress_squish(Image *p_image) { } else if (p_image->get_format() == Image::FORMAT_RGTC_RG) { squish_flags = squish::kBc5; } else { - print_line("Can't decompress unknown format: " + itos(p_image->get_format())); + ERR_EXPLAIN("Squish: Can't decompress unknown format: " + itos(p_image->get_format())); ERR_FAIL_COND(true); return; } diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index c95a8ac2dd..0e533d3978 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -208,8 +208,6 @@ void AudioStreamOGGVorbis::set_data(const PoolVector<uint8_t> &p_data) { //does this work? (it's less mem..) //decode_mem_size = ogg_alloc.alloc_buffer_length_in_bytes + info.setup_memory_required + info.temp_memory_required + info.max_frame_size; - //print_line("succeeded "+itos(ogg_alloc.alloc_buffer_length_in_bytes)+" setup "+itos(info.setup_memory_required)+" setup temp "+itos(info.setup_temp_memory_required)+" temp "+itos(info.temp_memory_required)+" maxframe"+itos(info.max_frame_size)); - length = stb_vorbis_stream_length_in_seconds(ogg_stream); stb_vorbis_close(ogg_stream); diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index 881808873b..68087ac01f 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -387,7 +387,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) { thread_sem->post(); #endif - //print_line("play "+rtos(p_delta)); time += p_delta; if (videobuf_time > get_time()) { @@ -442,16 +441,8 @@ void VideoStreamPlaybackTheora::update(float p_delta) { int tr = vorbis_synthesis_read(&vd, ret - to_read); - if (vd.granulepos >= 0) { - //print_line("wrote: "+itos(audio_frames_wrote)+" gpos: "+itos(vd.granulepos)); - } - - //print_line("mix audio!"); - audio_frames_wrote += ret - to_read; - //print_line("AGP: "+itos(vd.granulepos)+" added "+itos(ret-to_read)); - } else { /* no pending audio; is there a pending packet to decode? */ @@ -460,7 +451,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) { vorbis_synthesis_blockin(&vd, &vb); } } else { /* we need more data; break out to suck in another page */ - //printf("need moar data\n"); break; }; } diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 73b6d702c1..8e98b08b22 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -1144,15 +1144,12 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in case VisualScriptBuiltinFunc::TEXT_PRINTERR: { String str = *p_inputs[0]; - - //str+="\n"; print_error(str); } break; case VisualScriptBuiltinFunc::TEXT_PRINTRAW: { - String str = *p_inputs[0]; - //str+="\n"; + String str = *p_inputs[0]; OS::get_singleton()->print("%s", str.utf8().get_data()); } break; diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 45a27d1e79..4471fbd0c4 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -882,7 +882,6 @@ void VisualScriptEditor::_member_selected() { ERR_FAIL_COND(!ti); selected = ti->get_metadata(0); - //print_line("selected: "+String(selected)); if (ti->get_parent() == members->get_root()->get_children()) { diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index ad886bc758..f926d4e2eb 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -394,7 +394,6 @@ void VisualScriptFunctionCall::_update_method_cache() { } } - //print_line("BASE: "+String(type)+" FUNC: "+String(function)); MethodBind *mb = ClassDB::get_method(type, function); if (mb) { use_default_args = mb->get_default_argument_count(); diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp index e4dfc5fe45..f79c81ad88 100644 --- a/modules/visual_script/visual_script_property_selector.cpp +++ b/modules/visual_script/visual_script_property_selector.cpp @@ -285,7 +285,6 @@ void VisualScriptPropertySelector::_update_search() { Ref<Texture> icon; script_methods = false; - print_line("name: " + E->get().name); String rep = E->get().name.replace("*", ""); if (E->get().name == "*Script Methods") { icon = get_icon("Script", "EditorIcons"); diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp index b9f1f1eab0..46bd691290 100644 --- a/platform/android/audio_driver_jandroid.cpp +++ b/platform/android/audio_driver_jandroid.cpp @@ -82,9 +82,7 @@ Error AudioDriverAndroid::init() { int latency = GLOBAL_DEF_RST("audio/output_latency", 25); unsigned int buffer_size = next_power_of_2(latency * mix_rate / 1000); - if (OS::get_singleton()->is_stdout_verbose()) { - print_line("audio buffer size: " + itos(buffer_size)); - } + print_verbose("Audio buffer size: " + itos(buffer_size)); audioBuffer = env->CallObjectMethod(io, _init_audio, mix_rate, buffer_size); diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index e8ab1558cc..b76b0d5dbe 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -257,7 +257,6 @@ class EditorExportAndroid : public EditorExportPlatform { if (dpos == -1) continue; d = d.substr(0, dpos).strip_edges(); - //print_line("found device: "+d); ldevices.push_back(d); } @@ -345,8 +344,6 @@ class EditorExportAndroid : public EditorExportPlatform { } d.name = vendor + " " + device; - //print_line("name: "+d.name); - //print_line("description: "+d.description); } ndevices.push_back(d); @@ -671,19 +668,14 @@ class EditorExportAndroid : public EditorExportPlatform { ucstring.write[len] = 0; string_table.write[i] = ucstring.ptr(); } - - //print_line("String "+itos(i)+": "+string_table[i]); } for (uint32_t i = string_end; i < (ofs + size); i++) { stable_extra.push_back(p_manifest[i]); } - //printf("stable extra: %i\n",int(stable_extra.size())); string_table_ends = ofs + size; - //print_line("STABLE SIZE: "+itos(size)+" ACTUAL: "+itos(string_table_ends)); - } break; case CHUNK_XML_START_TAG: { @@ -714,35 +706,25 @@ class EditorExportAndroid : public EditorExportPlatform { //replace project information if (tname == "manifest" && attrname == "package") { - - print_line("FOUND package"); string_table.write[attr_value] = get_package_name(package_name); } - if (tname == "manifest" && /*nspace=="android" &&*/ attrname == "versionCode") { - - print_line("FOUND versionCode"); + if (tname == "manifest" && attrname == "versionCode") { encode_uint32(version_code, &p_manifest.write[iofs + 16]); } - if (tname == "manifest" && /*nspace=="android" &&*/ attrname == "versionName") { - - print_line("FOUND versionName"); + if (tname == "manifest" && attrname == "versionName") { if (attr_value == 0xFFFFFFFF) { WARN_PRINT("Version name in a resource, should be plaintext") } else string_table.write[attr_value] = version_name; } - if (tname == "activity" && /*nspace=="android" &&*/ attrname == "screenOrientation") { + if (tname == "activity" && attrname == "screenOrientation") { encode_uint32(orientation == 0 ? 0 : 1, &p_manifest.write[iofs + 16]); } - if (tname == "uses-feature" && /*nspace=="android" &&*/ attrname == "glEsVersion") { - print_line("version number: " + itos(decode_uint32(&p_manifest[iofs + 16]))); - } - if (tname == "supports-screens") { if (attrname == "smallScreens") { @@ -773,7 +755,6 @@ class EditorExportAndroid : public EditorExportPlatform { String tname = string_table[name]; if (tname == "manifest") { - print_line("Found manifest end"); // save manifest ending so we can restore it Vector<uint8_t> manifest_end; @@ -913,8 +894,6 @@ class EditorExportAndroid : public EditorExportPlatform { encode_uint32(string_table.size(), &ret.write[16]); //update new number of strings encode_uint32(string_data_offset - 8, &ret.write[28]); //update new string data offset - //print_line("file size: "+itos(ret.size())); - p_manifest = ret; } @@ -956,7 +935,6 @@ class EditorExportAndroid : public EditorExportPlatform { void _fix_resources(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &p_manifest) { const int UTF8_FLAG = 0x00000100; - print_line("*******************GORRRGLE***********************"); uint32_t string_block_len = decode_uint32(&p_manifest[16]); uint32_t string_count = decode_uint32(&p_manifest[20]); @@ -1088,8 +1066,8 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "graphics/32_bits_framebuffer"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "one_click_deploy/clear_previous_install"), true)); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "apk"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "apk"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "*.apk"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "*.apk"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "command_line/extra_args"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "version/code", PROPERTY_HINT_RANGE, "1,4096,1,or_greater"), 1)); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "version/name"), "1.0")); @@ -1104,10 +1082,10 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_xlarge"), true)); for (int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_icons[i].option_id, PROPERTY_HINT_FILE, "png"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_icons[i].option_id, PROPERTY_HINT_FILE, "*.png"), "")); } - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "keystore/release", PROPERTY_HINT_GLOBAL_FILE, "keystore"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "keystore/release", PROPERTY_HINT_GLOBAL_FILE, "*.keystore"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "keystore/release_user"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "keystore/release_password"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "apk_expansion/enable"), false)); @@ -1234,8 +1212,8 @@ public: err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv); } - print_line("Installing into device (please wait..): " + devices[p_device].name); - ep.step("Installing to Device (please wait..)..", 2); + print_line("Installing to device (please wait...): " + devices[p_device].name); + ep.step("Installing to device (please wait...)", 2); args.clear(); args.push_back("-s"); @@ -1899,7 +1877,7 @@ void register_android_exporter() { EDITOR_DEF("export/android/jarsigner", ""); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/jarsigner", PROPERTY_HINT_GLOBAL_FILE, exe_ext)); EDITOR_DEF("export/android/debug_keystore", ""); - EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/debug_keystore", PROPERTY_HINT_GLOBAL_FILE, "keystore")); + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/debug_keystore", PROPERTY_HINT_GLOBAL_FILE, "*.keystore")); EDITOR_DEF("export/android/debug_keystore_user", "androiddebugkey"); EDITOR_DEF("export/android/debug_keystore_pass", "android"); EDITOR_DEF("export/android/force_system_user", false); diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index 0e5f4fb93a..061e05f5ee 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -928,7 +928,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_Godot_registerMethod(JNIEnv *e jmethodID mid = env->GetMethodID(cls, mname.ascii().get_data(), cs.ascii().get_data()); if (!mid) { - print_line("FAILED GETTING METHOD ID " + mname); + print_line("RegisterMethod: Failed getting method ID: " + mname); } s->add_method(mname, mid, types, get_jni_type(retval)); diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp index 446a5911e5..022ccb7d89 100644 --- a/platform/android/java_class_wrapper.cpp +++ b/platform/android/java_class_wrapper.cpp @@ -554,7 +554,6 @@ bool JavaClassWrapper::_get_type_sig(JNIEnv *env, jobject obj, uint32_t &sig, St jstring name2 = (jstring)env->CallObjectMethod(obj, Class_getName); String str_type = env->GetStringUTFChars(name2, NULL); - print_line("name: " + str_type); env->DeleteLocalRef(name2); uint32_t t = 0; @@ -1191,9 +1190,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) { env->DeleteLocalRef(obj); env->DeleteLocalRef(param_types); env->DeleteLocalRef(return_type); - - //args[i] = _jobject_to_variant(env, obj); - //print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type())); }; env->DeleteLocalRef(methods); @@ -1210,7 +1206,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) { jstring name = (jstring)env->CallObjectMethod(obj, Field_getName); String str_field = env->GetStringUTFChars(name, NULL); env->DeleteLocalRef(name); - print_line("FIELD: " + str_field); int mods = env->CallIntMethod(obj, Field_getModifiers); if ((mods & 0x8) && (mods & 0x10) && (mods & 0x1)) { //static final public! diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index f9eda9dff1..c8bdf98923 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -337,8 +337,6 @@ void OS_Android::process_event(Ref<InputEvent> p_event) { void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos> &p_points) { - //print_line("ev: "+itos(p_what)+" pnt: "+itos(p_pointer)+" pointc: "+itos(p_points.size())); - switch (p_what) { case 0: { //gesture begin diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index ab8d9909a0..008e213e5e 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -172,8 +172,8 @@ static const LoadingScreenInfo loading_screen_infos[] = { void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options) { - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/app_store_team_id"), "")); @@ -193,18 +193,18 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options) r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/version"), "1.0")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/copyright"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "required_icons/iphone_120x120", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPhone/iPod Touch with retina display - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "required_icons/ipad_76x76", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPad - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "required_icons/app_store_1024x1024", PROPERTY_HINT_FILE, "png"), "")); // App Store + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "required_icons/iphone_120x120", PROPERTY_HINT_FILE, "*.png"), "")); // Home screen on iPhone/iPod Touch with retina display + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "required_icons/ipad_76x76", PROPERTY_HINT_FILE, "*.png"), "")); // Home screen on iPad + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "required_icons/app_store_1024x1024", PROPERTY_HINT_FILE, "*.png"), "")); // App Store - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/iphone_180x180", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPhone with retina HD display - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/ipad_152x152", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPad with retina display - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/ipad_167x167", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPad Pro - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_40x40", PROPERTY_HINT_FILE, "png"), "")); // Spotlight - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_80x80", PROPERTY_HINT_FILE, "png"), "")); // Spotlight on devices with retina display + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/iphone_180x180", PROPERTY_HINT_FILE, "*.png"), "")); // Home screen on iPhone with retina HD display + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/ipad_152x152", PROPERTY_HINT_FILE, "*.png"), "")); // Home screen on iPad with retina display + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/ipad_167x167", PROPERTY_HINT_FILE, "*.png"), "")); // Home screen on iPad Pro + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_40x40", PROPERTY_HINT_FILE, "*.png"), "")); // Spotlight + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_80x80", PROPERTY_HINT_FILE, "*.png"), "")); // Spotlight on devices with retina display for (int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) { - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, loading_screen_infos[i].preset_key, PROPERTY_HINT_FILE, "png"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, loading_screen_infos[i].preset_key, PROPERTY_HINT_FILE, "*.png"), "")); } r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), false)); @@ -739,7 +739,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p String library_to_use = "libgodot.iphone." + String(p_debug ? "debug" : "release") + ".fat.a"; - print_line("static library: " + library_to_use); + print_line("Static library: " + library_to_use); String pkg_name; if (p_preset->get("application/name") != "") pkg_name = p_preset->get("application/name"); // app_name @@ -809,7 +809,6 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p file = file.replace_first("iphone/", ""); if (files_to_parse.has(file)) { - print_line(String("parse ") + file); _fix_config_file(p_preset, data, config_data, p_debug); } else if (file.begins_with("libgodot.iphone")) { if (file != library_to_use) { diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub index 98988d97fd..a93c98a89f 100644 --- a/platform/javascript/SCsub +++ b/platform/javascript/SCsub @@ -32,6 +32,6 @@ zip_files = env.InstallAs([ ], [ js_wrapped, wasm, - '#misc/dist/html/default.html' + '#misc/dist/html/full-size.html' ]) env.Zip('#bin/godot', zip_files, ZIPROOT=zip_dir, ZIPSUFFIX='${PROGSUFFIX}${ZIPSUFFIX}', ZIPCOMSTR='Archving $SOURCES as $TARGET') diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 78e60af3e0..a7f0084562 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -120,10 +120,10 @@ void EditorExportPlatformJavaScript::get_export_options(List<ExportOption> *r_op r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), true)); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "html/custom_html_shell", PROPERTY_HINT_FILE, "html"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "html/custom_html_shell", PROPERTY_HINT_FILE, "*.html"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "html/head_include", PROPERTY_HINT_MULTILINE_TEXT), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); } String EditorExportPlatformJavaScript::get_name() const { diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index a2c6bdd629..5a8a05d4df 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -71,14 +71,6 @@ static bool is_canvas_focused() { static bool cursor_inside_canvas = true; -EM_BOOL OS_JavaScript::browser_resize_callback(int p_event_type, const EmscriptenUiEvent *p_event, void *p_user_data) { - - // The order of the fullscreen change event and the window size change - // event varies, even within just one browser, so defer handling. - get_singleton()->canvas_size_adjustment_requested = true; - return false; -} - EM_BOOL OS_JavaScript::fullscreen_change_callback(int p_event_type, const EmscriptenFullscreenChangeEvent *p_event, void *p_user_data) { OS_JavaScript *os = get_singleton(); @@ -88,7 +80,13 @@ EM_BOOL OS_JavaScript::fullscreen_change_callback(int p_event_type, const Emscri // This event property is the only reliable data on // browser fullscreen state. os->video_mode.fullscreen = p_event->isFullscreen; - os->canvas_size_adjustment_requested = true; + if (os->video_mode.fullscreen) { + os->entering_fullscreen = false; + } else { + // Restoring maximized window now will cause issues, + // so delay until main_loop_iterate. + os->just_exited_fullscreen = true; + } } return false; } @@ -114,14 +112,14 @@ Size2 OS_JavaScript::get_screen_size(int p_screen) const { void OS_JavaScript::set_window_size(const Size2 p_size) { windowed_size = p_size; - if (is_window_fullscreen()) { + if (video_mode.fullscreen) { window_maximized = false; set_window_fullscreen(false); - } else if (is_window_maximized()) { - set_window_maximized(false); } else { - video_mode.width = p_size.x; - video_mode.height = p_size.y; + if (window_maximized) { + emscripten_exit_soft_fullscreen(); + window_maximized = false; + } emscripten_set_canvas_size(p_size.x, p_size.y); } } @@ -135,31 +133,22 @@ Size2 OS_JavaScript::get_window_size() const { void OS_JavaScript::set_window_maximized(bool p_enabled) { - window_maximized = p_enabled; - if (is_window_fullscreen()) { + if (video_mode.fullscreen) { + window_maximized = p_enabled; set_window_fullscreen(false); - return; - } - // Calling emscripten_enter_soft_fullscreen mutltiple times hides all - // page elements except the canvas permanently, so track state. - if (p_enabled && !soft_fullscreen_enabled) { - + } else if (!p_enabled) { + emscripten_exit_soft_fullscreen(); + window_maximized = false; + } else if (!window_maximized) { + // Prevent calling emscripten_enter_soft_fullscreen mutltiple times, + // this would hide page elements permanently. EmscriptenFullscreenStrategy strategy; strategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH; strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF; strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT; strategy.canvasResizedCallback = NULL; emscripten_enter_soft_fullscreen(NULL, &strategy); - soft_fullscreen_enabled = true; - video_mode.width = get_window_size().width; - video_mode.height = get_window_size().height; - } else if (!p_enabled) { - - emscripten_exit_soft_fullscreen(); - soft_fullscreen_enabled = false; - video_mode.width = windowed_size.width; - video_mode.height = windowed_size.height; - emscripten_set_canvas_size(video_mode.width, video_mode.height); + window_maximized = p_enabled; } } @@ -170,30 +159,33 @@ bool OS_JavaScript::is_window_maximized() const { void OS_JavaScript::set_window_fullscreen(bool p_enabled) { - if (p_enabled == is_window_fullscreen()) { + if (p_enabled == video_mode.fullscreen) { return; } - // Just request changes here, if successful, canvas is resized in - // _browser_resize_callback or _fullscreen_change_callback. - EMSCRIPTEN_RESULT result; + // Just request changes here, if successful, logic continues in + // fullscreen_change_callback. if (p_enabled) { if (window_maximized) { - // Soft fullsreen during real fulllscreen can cause issues. - set_window_maximized(false); - window_maximized = true; + // Soft fullsreen during real fullscreen can cause issues, so exit. + // This must be called before requesting full screen. + emscripten_exit_soft_fullscreen(); } EmscriptenFullscreenStrategy strategy; strategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH; strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF; strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT; strategy.canvasResizedCallback = NULL; - emscripten_request_fullscreen_strategy(NULL, false, &strategy); + EMSCRIPTEN_RESULT result = emscripten_request_fullscreen_strategy(NULL, false, &strategy); + ERR_EXPLAIN("Enabling fullscreen is only possible from an input callback for the HTML5 platform"); + ERR_FAIL_COND(result == EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED); + ERR_FAIL_COND(result != EMSCRIPTEN_RESULT_SUCCESS); + // Not fullscreen yet, so prevent "windowed" canvas dimensions from + // being overwritten. + entering_fullscreen = true; } else { - result = emscripten_exit_fullscreen(); - if (result != EMSCRIPTEN_RESULT_SUCCESS) { - ERR_PRINTS("Failed to exit fullscreen: Code " + itos(result)); - } + // No logic allowed here, since exiting w/ ESC key won't use this function. + ERR_FAIL_COND(emscripten_exit_fullscreen() != EMSCRIPTEN_RESULT_SUCCESS); } } @@ -725,7 +717,6 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, SET_EM_CALLBACK("#canvas", keydown, keydown_callback) SET_EM_CALLBACK("#canvas", keypress, keypress_callback) SET_EM_CALLBACK("#canvas", keyup, keyup_callback) - SET_EM_CALLBACK(NULL, resize, browser_resize_callback) SET_EM_CALLBACK(NULL, fullscreenchange, fullscreen_change_callback) SET_EM_CALLBACK_NOTARGET(gamepadconnected, gamepad_change_callback) SET_EM_CALLBACK_NOTARGET(gamepaddisconnected, gamepad_change_callback) @@ -794,18 +785,32 @@ bool OS_JavaScript::main_loop_iterate() { /* clang-format on */ } } + process_joypads(); - if (canvas_size_adjustment_requested) { - if (video_mode.fullscreen || window_maximized) { - video_mode.width = get_window_size().width; - video_mode.height = get_window_size().height; - } - if (!video_mode.fullscreen) { - set_window_maximized(window_maximized); + if (just_exited_fullscreen) { + if (window_maximized) { + EmscriptenFullscreenStrategy strategy; + strategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH; + strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF; + strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT; + strategy.canvasResizedCallback = NULL; + emscripten_enter_soft_fullscreen(NULL, &strategy); + } else { + emscripten_set_canvas_size(windowed_size.width, windowed_size.height); } - canvas_size_adjustment_requested = false; + just_exited_fullscreen = false; } + + int canvas[3]; + emscripten_get_canvas_size(canvas, canvas + 1, canvas + 2); + video_mode.width = canvas[0]; + video_mode.height = canvas[1]; + if (!window_maximized && !video_mode.fullscreen && !just_exited_fullscreen && !entering_fullscreen) { + windowed_size.width = canvas[0]; + windowed_size.height = canvas[1]; + } + return Main::iteration(); } @@ -958,8 +963,8 @@ OS_JavaScript::OS_JavaScript(int p_argc, char *p_argv[]) { set_cmdline(p_argv[0], arguments); window_maximized = false; - soft_fullscreen_enabled = false; - canvas_size_adjustment_requested = false; + entering_fullscreen = false; + just_exited_fullscreen = false; main_loop = NULL; diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index 915320fe39..f40fb8fc7e 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -44,8 +44,8 @@ class OS_JavaScript : public OS_Unix { VideoMode video_mode; Vector2 windowed_size; bool window_maximized; - bool soft_fullscreen_enabled; - bool canvas_size_adjustment_requested; + bool entering_fullscreen; + bool just_exited_fullscreen; InputDefault *input; Ref<InputEventKey> deferred_key_event; @@ -59,7 +59,6 @@ class OS_JavaScript : public OS_Unix { int64_t sync_wait_time; int64_t last_sync_check_time; - static EM_BOOL browser_resize_callback(int p_event_type, const EmscriptenUiEvent *p_event, void *p_user_data); static EM_BOOL fullscreen_change_callback(int p_event_type, const EmscriptenFullscreenChangeEvent *p_event, void *p_user_data); static EM_BOOL keydown_callback(int p_event_type, const EmscriptenKeyboardEvent *p_event, void *p_user_data); diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index f0945e2e1e..880705b507 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -109,12 +109,12 @@ void EditorExportPlatformOSX::get_preset_features(const Ref<EditorExportPreset> void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) { - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Game Name"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/info"), "Made with Godot Engine")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "png"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.png"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/identifier", PROPERTY_HINT_PLACEHOLDER_TEXT, "com.example.game"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/signature"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/short_version"), "1.0")); @@ -380,7 +380,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p String file = fname; - print_line("READ: " + file); Vector<uint8_t> data; data.resize(info.uncompressed_size); @@ -394,7 +393,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p file = file.replace_first("osx_template.app/", ""); if (file == "Contents/Info.plist") { - print_line("parse plist"); _fix_plist(p_preset, data, pkg_name); } @@ -415,13 +413,12 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p iconpath = p_preset->get("application/icon"); else iconpath = ProjectSettings::get_singleton()->get("application/config/icon"); - print_line("icon? " + iconpath); + if (iconpath != "") { Ref<Image> icon; icon.instance(); icon->load(iconpath); if (!icon->empty()) { - print_line("loaded?"); _make_icon(icon, data); } } @@ -475,9 +472,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p Z_DEFLATED, Z_DEFAULT_COMPRESSION); - print_line("OPEN ERR: " + itos(zerr)); zerr = zipWriteInFileInZip(dst_pkg_zip, data.ptr(), data.size()); - print_line("WRITE ERR: " + itos(zerr)); zipCloseFileInZip(dst_pkg_zip); } } diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 7bf274310d..41cfada723 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1351,8 +1351,6 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a AudioDriverManager::initialize(p_audio_driver); - midi_driver.open(); - input = memnew(InputDefault); joypad_osx = memnew(JoypadOSX); @@ -1370,6 +1368,8 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a void OS_OSX::finalize() { + midi_driver.close(); + CFNotificationCenterRemoveObserver(CFNotificationCenterGetDistributedCenter(), NULL, kTISNotifySelectedKeyboardInputSourceChanged, NULL); CGDisplayRemoveReconfigurationCallback(displays_arrangement_changed, NULL); diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index cb6633434b..1ad5293b44 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -1087,8 +1087,8 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "tiles/show_name_on_wide310x150"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "tiles/show_name_on_square310x310"), false)); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); // Capabilities const char **basic = uwp_capabilities; diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index a158237418..59435b04ea 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -68,20 +68,6 @@ void ContextGL_Win::swap_buffers() { SwapBuffers(hDC); } -/* -static GLWrapperFuncPtr wrapper_get_proc_address(const char* p_function) { - - print_line(String()+"getting proc of: "+p_function); - GLWrapperFuncPtr func=(GLWrapperFuncPtr)get_gl_proc_address(p_function); - if (!func) { - print_line("Couldn't find function: "+String(p_function)); - print_line("error: "+itos(GetLastError())); - } - return func; - -} -*/ - void ContextGL_Win::set_use_vsync(bool p_use) { if (wglSwapIntervalEXT) { diff --git a/platform/windows/detect.py b/platform/windows/detect.py index dcd3597e88..150d418502 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -210,6 +210,7 @@ def configure_msvc(env, manual_msvc_config): 'WIN32', 'MSVC', {'WINVER' : '$target_win_version', '_WIN32_WINNT': '$target_win_version'}]) + env.AppendUnique(CPPDEFINES=['NOMINMAX']) # disable bogus min/max WinDef.h macros if env["bits"] == "64": env.AppendUnique(CPPDEFINES=['_WIN64']) diff --git a/platform/windows/joypad.cpp b/platform/windows/joypad.cpp index 796531fe24..b56fb6509e 100644 --- a/platform/windows/joypad.cpp +++ b/platform/windows/joypad.cpp @@ -540,9 +540,7 @@ void JoypadWindows::load_xinput() { } if (!xinput_dll) { - if (OS::get_singleton()->is_stdout_verbose()) { - print_line("Could not find XInput, using DirectInput only"); - } + print_verbose("Could not find XInput, using DirectInput only"); return; } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 56ac467dc6..fa8717a4b8 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -449,7 +449,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) input->set_mouse_position(c); mm->set_speed(Vector2(0, 0)); - if (raw->data.mouse.usFlags ==MOUSE_MOVE_RELATIVE) { + if (raw->data.mouse.usFlags == MOUSE_MOVE_RELATIVE) { mm->set_relative(Vector2(raw->data.mouse.lLastX, raw->data.mouse.lLastY)); } else if (raw->data.mouse.usFlags == MOUSE_MOVE_ABSOLUTE) { @@ -460,9 +460,8 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) int nScreenTop = GetSystemMetrics(SM_YVIRTUALSCREEN); Vector2 abs_pos( - (double(raw->data.mouse.lLastX) - 65536.0 / (nScreenWidth) ) * nScreenWidth / 65536.0 + nScreenLeft, - (double(raw->data.mouse.lLastY) - 65536.0 / (nScreenHeight) ) * nScreenHeight / 65536.0 + nScreenTop - ); + (double(raw->data.mouse.lLastX) - 65536.0 / (nScreenWidth)) * nScreenWidth / 65536.0 + nScreenLeft, + (double(raw->data.mouse.lLastY) - 65536.0 / (nScreenHeight)) * nScreenHeight / 65536.0 + nScreenTop); POINT coords; //client coords coords.x = abs_pos.x; @@ -470,15 +469,13 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ScreenToClient(hWnd, &coords); - - mm->set_relative(Vector2(coords.x - old_x, coords.y - old_y )); + mm->set_relative(Vector2(coords.x - old_x, coords.y - old_y)); old_x = coords.x; old_y = coords.y; /*Input.mi.dx = (int)((((double)(pos.x)-nScreenLeft) * 65536) / nScreenWidth + 65536 / (nScreenWidth)); Input.mi.dy = (int)((((double)(pos.y)-nScreenTop) * 65536) / nScreenHeight + 65536 / (nScreenHeight)); */ - } if (window_has_focus && main_loop) @@ -856,14 +853,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (ke.uMsg == WM_SYSKEYUP) ke.uMsg = WM_KEYUP; - /*if (ke.uMsg==WM_KEYDOWN && alt_mem && uMsg!=WM_SYSKEYDOWN) { - //altgr hack for intl keyboards, not sure how good it is - //windows is weeeeird - ke.mod_state.alt=false; - ke.mod_state.control=false; - print_line("") - }*/ - ke.wParam = wParam; ke.lParam = lParam; key_event_buffer[key_event_pos++] = ke; @@ -871,7 +860,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) } break; case WM_INPUTLANGCHANGEREQUEST: { - print_line("input lang change"); + // FIXME: Do something? } break; case WM_TOUCH: { @@ -1126,7 +1115,6 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int WNDCLASSEXW wc; if (is_hidpi_allowed()) { - print_line("hidpi aware?"); HMODULE Shcore = LoadLibraryW(L"Shcore.dll"); if (Shcore != NULL) { @@ -1201,8 +1189,6 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int WindowRect.right = data.size.width; WindowRect.bottom = data.size.height; - print_line("wr right " + itos(WindowRect.right) + ", " + itos(WindowRect.bottom)); - /* DEVMODE dmScreenSettings; memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); dmScreenSettings.dmSize=sizeof(dmScreenSettings); @@ -1335,10 +1321,6 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int AudioDriverManager::initialize(p_audio_driver); -#ifdef WINMIDI_ENABLED - driver_midi.open(); -#endif - TRACKMOUSEEVENT tme; tme.cbSize = sizeof(TRACKMOUSEEVENT); tme.dwFlags = TME_LEAVE; @@ -1490,12 +1472,6 @@ void OS_Windows::finalize() { if (user_proc) { SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)user_proc); }; - - /* - if (debugger_connection_console) { - memdelete(debugger_connection_console); - } - */ } void OS_Windows::finalize_core() { @@ -1759,9 +1735,6 @@ void OS_Windows::set_window_fullscreen(bool p_enabled) { if (pre_fs_valid) { GetWindowRect(hWnd, &pre_fs_rect); - //print_line("A: "+itos(pre_fs_rect.left)+","+itos(pre_fs_rect.top)+","+itos(pre_fs_rect.right-pre_fs_rect.left)+","+itos(pre_fs_rect.bottom-pre_fs_rect.top)); - //MapWindowPoints(hWnd, GetParent(hWnd), (LPPOINT) &pre_fs_rect, 2); - //print_line("B: "+itos(pre_fs_rect.left)+","+itos(pre_fs_rect.top)+","+itos(pre_fs_rect.right-pre_fs_rect.left)+","+itos(pre_fs_rect.bottom-pre_fs_rect.top)); } int cs = get_current_screen(); diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp index cd76667c64..5a239e326b 100644 --- a/platform/x11/context_gl_x11.cpp +++ b/platform/x11/context_gl_x11.cpp @@ -65,19 +65,6 @@ void ContextGL_X11::swap_buffers() { glXSwapBuffers(x11_display, x11_window); } -/* -static GLWrapperFuncPtr wrapper_get_proc_address(const char* p_function) { - - //print_line(String()+"getting proc of: "+p_function); - GLWrapperFuncPtr func=(GLWrapperFuncPtr)glXGetProcAddress( (const GLubyte*) p_function); - if (!func) { - print_line("Couldn't find function: "+String(p_function)); - } - - return func; - -}*/ - static bool ctxErrorOccurred = false; static int ctxErrorHandler(Display *dpy, XErrorEvent *ev) { ctxErrorOccurred = true; diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 733d2509f7..56b0c975c4 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -170,13 +170,13 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a #ifdef TOUCH_ENABLED if (!XQueryExtension(x11_display, "XInputExtension", &touch.opcode, &event_base, &error_base)) { - fprintf(stderr, "XInput extension not available"); + print_verbose("XInput extension not available, touch support disabled."); } else { // 2.2 is the first release with multitouch int xi_major = 2; int xi_minor = 2; if (XIQueryVersion(x11_display, &xi_major, &xi_minor) != Success) { - fprintf(stderr, "XInput 2.2 not available (server supports %d.%d)\n", xi_major, xi_minor); + print_verbose(vformat("XInput 2.2 not available (server supports %d.%d), touch support disabled.", xi_major, xi_minor)); touch.opcode = 0; } else { int dev_count; @@ -198,14 +198,14 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a } if (direct_touch) { touch.devices.push_back(dev->deviceid); - fprintf(stderr, "Using touch device: %s\n", dev->name); + print_verbose("XInput: Using touch device: " + String(dev->name)); } } XIFreeDeviceInfo(info); - if (is_stdout_verbose() && !touch.devices.size()) { - fprintf(stderr, "No touch devices found\n"); + if (!touch.devices.size()) { + print_verbose("XInput: No touch devices found."); } } } @@ -266,7 +266,6 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a */ // maybe contextgl wants to be in charge of creating the window -//print_line("def videomode "+itos(current_videomode.width)+","+itos(current_videomode.height)); #if defined(OPENGL_ENABLED) ContextGL_X11::ContextType opengl_api_type = ContextGL_X11::GLES_3_0_COMPATIBLE; @@ -342,10 +341,6 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a AudioDriverManager::initialize(p_audio_driver); -#ifdef ALSAMIDI_ENABLED - driver_alsamidi.open(); -#endif - ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE); ERR_FAIL_COND_V(x11_window == 0, ERR_UNAVAILABLE); @@ -427,9 +422,7 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a cursor_theme = XcursorGetTheme(x11_display); if (!cursor_theme) { - if (is_stdout_verbose()) { - print_line("XcursorGetTheme could not get cursor theme"); - } + print_verbose("XcursorGetTheme could not get cursor theme"); cursor_theme = "default"; } @@ -442,7 +435,6 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a current_cursor = CURSOR_ARROW; if (cursor_theme) { - //print_line("cursor theme: "+String(cursor_theme)); for (int i = 0; i < CURSOR_MAX; i++) { static const char *cursor_file[] = { @@ -468,10 +460,8 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size); if (img[i]) { cursors[i] = XcursorImageLoadCursor(x11_display, img[i]); - //print_line("found cursor: "+String(cursor_file[i])+" id "+itos(cursors[i])); } else { - if (OS::is_stdout_verbose()) - print_line("failed cursor: " + String(cursor_file[i])); + print_verbose("Failed loading custom cursor: " + String(cursor_file[i])); } } } @@ -1516,7 +1506,6 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { // KeyMappingX11 also translates keysym to unicode. // It does a binary search on a table to translate // most properly. - //print_line("keysym_unicode: "+rtos(keysym_unicode)); unsigned int unicode = keysym_unicode > 0 ? KeyMappingX11::get_unicode_from_keysym(keysym_unicode) : 0; /* Phase 4, determine if event must be filtered */ @@ -1539,7 +1528,7 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { // know Mod1 was ALT and Mod4 was META (applekey/winkey) // just tried Mods until i found them. - //print_line("mod1: "+itos(xkeyevent->state&Mod1Mask)+" mod 5: "+itos(xkeyevent->state&Mod5Mask)); + //print_verbose("mod1: "+itos(xkeyevent->state&Mod1Mask)+" mod 5: "+itos(xkeyevent->state&Mod5Mask)); Ref<InputEventKey> k; k.instance(); diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index 85f8564ac2..1e6a251c9c 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -139,8 +139,6 @@ class CanvasItem : public Node { GDCLASS(CanvasItem, Node); - friend class CanvasLayer; - public: enum BlendMode { diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index 52d04ac10a..1e2184bd41 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -38,7 +38,7 @@ void CollisionObject2D::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - Transform2D global_transform = get_global_transform_with_canvas(); + Transform2D global_transform = get_global_transform(); if (area) Physics2DServer::get_singleton()->area_set_transform(rid, global_transform); @@ -64,7 +64,7 @@ void CollisionObject2D::_notification(int p_what) { } break; case NOTIFICATION_TRANSFORM_CHANGED: { - Transform2D global_transform = get_global_transform_with_canvas(); + Transform2D global_transform = get_global_transform(); if (only_update_transform_changes && global_transform == last_transform) { return; diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp index e3b048fd74..9eec8e6cc3 100644 --- a/scene/2d/navigation2d.cpp +++ b/scene/2d/navigation2d.cpp @@ -121,7 +121,6 @@ void Navigation2D::_navpoly_link(int p_id) { pending.edge = j; p.edges.write[j].P = C->get().pending.push_back(pending); continue; - //print_line(String()+_get_vertex(ek.a)+" -> "+_get_vertex(ek.b)); } C->get().B = &p; @@ -144,8 +143,6 @@ void Navigation2D::_navpoly_unlink(int p_id) { NavMesh &nm = navpoly_map[p_id]; ERR_FAIL_COND(!nm.linked); - //print_line("UNLINK"); - for (List<Polygon>::Element *E = nm.polygons.front(); E; E = E->next()) { Polygon &p = E->get(); @@ -341,7 +338,6 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect path.resize(2); path.write[0] = begin_point; path.write[1] = end_point; - //print_line("Direct Path"); return path; } @@ -379,7 +375,6 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect while (!found_route) { if (open_list.size() == 0) { - //print_line("NOU OPEN LIST"); break; } //check open list @@ -526,7 +521,6 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect if (portal_left.distance_squared_to(apex_point) < CMP_EPSILON || CLOCK_TANGENT(apex_point, left, portal_right) > 0) { left_poly = p; portal_left = left; - //print_line("***ADVANCE LEFT"); } else { apex_point = portal_right; @@ -537,8 +531,6 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect if (!path.size() || path[path.size() - 1].distance_to(apex_point) > CMP_EPSILON) path.push_back(apex_point); skip = true; - //print_line("addpoint left"); - //print_line("***CLIP LEFT"); } } @@ -547,7 +539,6 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect if (portal_right.distance_squared_to(apex_point) < CMP_EPSILON || CLOCK_TANGENT(apex_point, right, portal_left) < 0) { right_poly = p; portal_right = right; - //print_line("***ADVANCE RIGHT"); } else { apex_point = portal_left; @@ -557,8 +548,6 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect portal_left = apex_point; if (!path.size() || path[path.size() - 1].distance_to(apex_point) > CMP_EPSILON) path.push_back(apex_point); - //print_line("addpoint right"); - //print_line("***CLIP RIGHT"); } } diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 2d6679272a..84b12b0bfe 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -257,7 +257,7 @@ void NavigationPolygon::make_polygons_from_outlines() { TriangulatorPartition tpart; if (tpart.ConvexPartition_HM(&in_poly, &out_poly) == 0) { //failed! - print_line("convex partition failed!"); + ERR_PRINTS("NavigationPolygon: Convex partition failed!"); return; } diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index 1da1d44b17..a4c3057416 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -74,14 +74,14 @@ void Particles2D::set_randomness_ratio(float p_ratio) { randomness_ratio = p_ratio; VS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio); } -void Particles2D::set_visibility_rect(const Rect2 &p_aabb) { +void Particles2D::set_visibility_rect(const Rect2 &p_visibility_rect) { - visibility_rect = p_aabb; + visibility_rect = p_visibility_rect; AABB aabb; - aabb.position.x = p_aabb.position.x; - aabb.position.y = p_aabb.position.y; - aabb.size.x = p_aabb.size.x; - aabb.size.y = p_aabb.size.y; + aabb.position.x = p_visibility_rect.position.x; + aabb.position.y = p_visibility_rect.position.y; + aabb.size.x = p_visibility_rect.size.x; + aabb.size.y = p_visibility_rect.size.y; VS::get_singleton()->particles_set_custom_aabb(particles, aabb); @@ -326,7 +326,7 @@ void Particles2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pre_process_time", "secs"), &Particles2D::set_pre_process_time); ClassDB::bind_method(D_METHOD("set_explosiveness_ratio", "ratio"), &Particles2D::set_explosiveness_ratio); ClassDB::bind_method(D_METHOD("set_randomness_ratio", "ratio"), &Particles2D::set_randomness_ratio); - ClassDB::bind_method(D_METHOD("set_visibility_rect", "aabb"), &Particles2D::set_visibility_rect); + ClassDB::bind_method(D_METHOD("set_visibility_rect", "visibility_rect"), &Particles2D::set_visibility_rect); ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &Particles2D::set_use_local_coordinates); ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &Particles2D::set_fixed_fps); ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &Particles2D::set_fractional_delta); @@ -372,13 +372,13 @@ void Particles2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_RANGE, "0.01,600.0,0.01,or_greater"), "set_lifetime", "get_lifetime"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "get_one_shot"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_speed_scale", "get_speed_scale"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_speed_scale", "get_speed_scale"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "explosiveness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_explosiveness_ratio", "get_explosiveness_ratio"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "randomness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_randomness_ratio", "get_randomness_ratio"); ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fract_delta"), "set_fractional_delta", "get_fractional_delta"); ADD_GROUP("Drawing", ""); - ADD_PROPERTY(PropertyInfo(Variant::AABB, "visibility_rect"), "set_visibility_rect", "get_visibility_rect"); + ADD_PROPERTY(PropertyInfo(Variant::RECT2, "visibility_rect"), "set_visibility_rect", "get_visibility_rect"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "local_coords"), "set_use_local_coordinates", "get_use_local_coordinates"); ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_order", PROPERTY_HINT_ENUM, "Index,Lifetime"), "set_draw_order", "get_draw_order"); ADD_GROUP("Process Material", "process_"); diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h index f367095581..31a66afb2a 100644 --- a/scene/2d/particles_2d.h +++ b/scene/2d/particles_2d.h @@ -84,7 +84,7 @@ public: void set_pre_process_time(float p_time); void set_explosiveness_ratio(float p_ratio); void set_randomness_ratio(float p_ratio); - void set_visibility_rect(const Rect2 &p_aabb); + void set_visibility_rect(const Rect2 &p_visibility_rect); void set_use_local_coordinates(bool p_enable); void set_process_material(const Ref<Material> &p_material); void set_speed_scale(float p_scale); diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 66686f10a8..8e31688d90 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -35,6 +35,19 @@ #include "engine.h" #include "math_funcs.h" #include "scene/scene_string_names.h" +void PhysicsBody2D::_notification(int p_what) { + + /* + switch(p_what) { + + case NOTIFICATION_TRANSFORM_CHANGED: { + + Physics2DServer::get_singleton()->body_set_state(get_rid(),Physics2DServer::BODY_STATE_TRANSFORM,get_global_transform()); + + } break; + } + */ +} void PhysicsBody2D::_set_layers(uint32_t p_mask) { @@ -352,13 +365,6 @@ void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap ERR_FAIL_COND(!contact_monitor); Map<ObjectID, BodyState>::Element *E = contact_monitor->body_map.find(objid); - /*if (obj) { - if (body_in) - print_line("in: "+String(obj->call("get_name"))); - else - print_line("out: "+String(obj->call("get_name"))); - }*/ - ERR_FAIL_COND(!body_in && !E); if (body_in) { @@ -423,7 +429,7 @@ bool RigidBody2D::_test_motion(const Vector2 &p_motion, bool p_infinite_inertia, Physics2DServer::MotionResult *r = NULL; if (p_result.is_valid()) r = p_result->get_result_ptr(); - return Physics2DServer::get_singleton()->body_test_motion(get_rid(), get_global_transform_with_canvas(), p_motion, p_infinite_inertia, p_margin, r); + return Physics2DServer::get_singleton()->body_test_motion(get_rid(), get_global_transform(), p_motion, p_infinite_inertia, p_margin, r); } void RigidBody2D::_direct_state_changed(Object *p_state) { @@ -436,7 +442,7 @@ void RigidBody2D::_direct_state_changed(Object *p_state) { set_block_transform_notify(true); // don't want notify (would feedback loop) if (mode != MODE_KINEMATIC) - set_global_transform(get_canvas_transform().affine_inverse() * state->get_transform()); + set_global_transform(state->get_transform()); linear_velocity = state->get_linear_velocity(); angular_velocity = state->get_angular_velocity(); if (sleeping != state->is_sleeping()) { @@ -1131,7 +1137,7 @@ bool KinematicBody2D::separate_raycast_shapes(bool p_infinite_inertia, Collision Physics2DServer::SeparationResult sep_res[8]; //max 8 rays - Transform2D gt = get_global_transform_with_canvas(); + Transform2D gt = get_global_transform(); Vector2 recover; int hits = Physics2DServer::get_singleton()->body_test_ray_separation(get_rid(), gt, p_infinite_inertia, recover, sep_res, 8, margin); @@ -1145,7 +1151,7 @@ bool KinematicBody2D::separate_raycast_shapes(bool p_infinite_inertia, Collision } gt.elements[2] += recover; - set_global_transform(get_canvas_transform().affine_inverse() * gt); + set_global_transform(gt); if (deepest != -1) { r_collision.collider = sep_res[deepest].collider_id; @@ -1166,7 +1172,7 @@ bool KinematicBody2D::separate_raycast_shapes(bool p_infinite_inertia, Collision bool KinematicBody2D::move_and_collide(const Vector2 &p_motion, bool p_infinite_inertia, Collision &r_collision, bool p_exclude_raycast_shapes, bool p_test_only) { - Transform2D gt = get_global_transform_with_canvas(); + Transform2D gt = get_global_transform(); Physics2DServer::MotionResult result; bool colliding = Physics2DServer::get_singleton()->body_test_motion(get_rid(), gt, p_motion, p_infinite_inertia, margin, &result, p_exclude_raycast_shapes); @@ -1185,7 +1191,7 @@ bool KinematicBody2D::move_and_collide(const Vector2 &p_motion, bool p_infinite_ if (!p_test_only) { gt.elements[2] += result.motion; - set_global_transform(get_canvas_transform().affine_inverse() * gt); + set_global_transform(gt); } return colliding; @@ -1259,9 +1265,9 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const if (p_stop_on_slope) { if (Vector2() == lv_n + p_floor_direction) { - Transform2D gt = get_global_transform_with_canvas(); + Transform2D gt = get_global_transform(); gt.elements[2] -= collision.travel; - set_global_transform(get_canvas_transform().affine_inverse() * gt); + set_global_transform(gt); return Vector2(); } } @@ -1310,7 +1316,7 @@ Vector2 KinematicBody2D::move_and_slide_with_snap(const Vector2 &p_linear_veloci } Collision col; - Transform2D gt = get_global_transform_with_canvas(); + Transform2D gt = get_global_transform(); if (move_and_collide(p_snap, p_infinite_inertia, col, false, true)) { gt.elements[2] += col.travel; @@ -1319,7 +1325,7 @@ Vector2 KinematicBody2D::move_and_slide_with_snap(const Vector2 &p_linear_veloci on_floor_body = col.collider_rid; floor_velocity = col.collider_vel; } - set_global_transform(get_canvas_transform().affine_inverse() * gt); + set_global_transform(gt); } return ret; @@ -1416,22 +1422,22 @@ void KinematicBody2D::_direct_state_changed(Object *p_state) { last_valid_transform = state->get_transform(); set_notify_local_transform(false); - set_global_transform(get_canvas_transform().affine_inverse() * last_valid_transform); + set_global_transform(last_valid_transform); set_notify_local_transform(true); } void KinematicBody2D::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - last_valid_transform = get_global_transform_with_canvas(); + last_valid_transform = get_global_transform(); } if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) { //used by sync to physics, send the new transform to the physics - Transform2D new_transform = get_global_transform_with_canvas(); + Transform2D new_transform = get_global_transform(); Physics2DServer::get_singleton()->body_set_state(get_rid(), Physics2DServer::BODY_STATE_TRANSFORM, new_transform); //but then revert changes set_notify_local_transform(false); - set_global_transform(get_canvas_transform().affine_inverse() * last_valid_transform); + set_global_transform(last_valid_transform); set_notify_local_transform(true); } } diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index 0900438e3c..852963a721 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -49,6 +49,7 @@ class PhysicsBody2D : public CollisionObject2D { uint32_t _get_layers() const; protected: + void _notification(int p_what); PhysicsBody2D(Physics2DServer::BodyMode p_mode); static void _bind_methods(); diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 34f4ccc03e..fc0741cc5c 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -253,7 +253,6 @@ void Polygon2D::_notification(int p_what) { //normalize for (int j = 0; j < 4; j++) { weightsw[i * 4 + j] /= tw; - // print_line("point " + itos(i) + " idx " + itos(j) + " index: " + itos(bonesw[i * 4 + j]) + " weight: " + rtos(weightsw[i * 4 + j])); } } } @@ -345,8 +344,6 @@ void Polygon2D::_notification(int p_what) { } } - //print_line("loops: " + itos(loops.size()) + " indices: " + itos(indices.size())); - VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID()); } diff --git a/scene/2d/remote_transform_2d.cpp b/scene/2d/remote_transform_2d.cpp index 63c3d78dfd..f0274e5206 100644 --- a/scene/2d/remote_transform_2d.cpp +++ b/scene/2d/remote_transform_2d.cpp @@ -67,7 +67,7 @@ void RemoteTransform2D::_update_remote() { } else { Transform2D n_trans = n->get_global_transform(); Transform2D our_trans = get_global_transform(); - Vector2 n_scale = n->get_global_scale(); + Vector2 n_scale = n->get_scale(); if (!update_remote_position) our_trans.set_origin(n_trans.get_origin()); @@ -131,8 +131,10 @@ void RemoteTransform2D::_notification(int p_what) { void RemoteTransform2D::set_remote_node(const NodePath &p_remote_node) { remote_node = p_remote_node; - if (is_inside_tree()) + if (is_inside_tree()) { _update_cache(); + _update_remote(); + } update_configuration_warning(); } @@ -144,6 +146,7 @@ NodePath RemoteTransform2D::get_remote_node() const { void RemoteTransform2D::set_use_global_coordinates(const bool p_enable) { use_global_coordinates = p_enable; + _update_remote(); } bool RemoteTransform2D::get_use_global_coordinates() const { diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index ebe0e81f6e..bb5990fa79 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -298,6 +298,11 @@ int Sprite::get_hframes() const { bool Sprite::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { + return is_pixel_opaque(p_point); +} + +bool Sprite::is_pixel_opaque(const Point2 &p_point) const { + if (texture.is_null()) return false; @@ -316,32 +321,6 @@ bool Sprite::_edit_is_selected_on_click(const Point2 &p_point, double p_toleranc q.y = 1.0f - q.y; q = q * src_rect.size + src_rect.position; - Ref<Image> image; - Ref<AtlasTexture> atlasTexture = texture; - if (atlasTexture.is_null()) { - image = texture->get_data(); - } else { - ERR_FAIL_COND_V(atlasTexture->get_atlas().is_null(), false); - - image = atlasTexture->get_atlas()->get_data(); - - Rect2 region = atlasTexture->get_region(); - Rect2 margin = atlasTexture->get_margin(); - - q -= margin.position; - - if ((q.x > region.size.width) || (q.y > region.size.height)) { - return false; - } - - q += region.position; - } - - ERR_FAIL_COND_V(image.is_null(), false); - if (image->is_compressed()) { - return dst_rect.has_point(p_point); - } - bool is_repeat = texture->get_flags() & Texture::FLAG_REPEAT; bool is_mirrored_repeat = texture->get_flags() & Texture::FLAG_MIRRORED_REPEAT; if (is_repeat) { @@ -363,11 +342,8 @@ bool Sprite::_edit_is_selected_on_click(const Point2 &p_point, double p_toleranc q.x = MIN(q.x, texture->get_size().width - 1); q.y = MIN(q.y, texture->get_size().height - 1); } - image->lock(); - const Color c = image->get_pixel((int)q.x, (int)q.y); - image->unlock(); - return c.a > 0.01; + return texture->is_pixel_opaque((int)q.x, (int)q.y); } Rect2 Sprite::get_rect() const { @@ -437,6 +413,8 @@ void Sprite::_bind_methods() { ClassDB::bind_method(D_METHOD("set_region", "enabled"), &Sprite::set_region); ClassDB::bind_method(D_METHOD("is_region"), &Sprite::is_region); + ClassDB::bind_method(D_METHOD("is_pixel_opaque", "pos"), &Sprite::is_pixel_opaque); + ClassDB::bind_method(D_METHOD("set_region_rect", "rect"), &Sprite::set_region_rect); ClassDB::bind_method(D_METHOD("get_region_rect"), &Sprite::get_region_rect); diff --git a/scene/2d/sprite.h b/scene/2d/sprite.h index 0a5ff002cd..ab444f89fc 100644 --- a/scene/2d/sprite.h +++ b/scene/2d/sprite.h @@ -75,6 +75,8 @@ public: virtual bool _edit_use_pivot() const; virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const; + bool is_pixel_opaque(const Point2 &p_point) const; + virtual Rect2 _edit_get_rect() const; virtual bool _edit_use_rect() const; diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp index 26fd5ed658..2cb59c871c 100644 --- a/scene/3d/baked_lightmap.cpp +++ b/scene/3d/baked_lightmap.cpp @@ -374,9 +374,6 @@ BakedLightmap::BakeError BakedLightmap::bake(Node *p_from_node, bool p_create_vi capture_subdiv--; css *= 2.0; } - - print_line("bake subdiv: " + itos(bake_subdiv)); - print_line("capture subdiv: " + itos(capture_subdiv)); } baker.begin_bake(bake_subdiv, bake_bounds); diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index bcd015875b..a4582b7d7d 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -867,6 +867,9 @@ void ClippedCamera::_bind_methods() { ADD_GROUP("Clip To", "clip_to"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clip_to_areas", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_clip_to_areas", "is_clip_to_areas_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clip_to_bodies", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_clip_to_bodies", "is_clip_to_bodies_enabled"); + + BIND_ENUM_CONSTANT(CLIP_PROCESS_PHYSICS); + BIND_ENUM_CONSTANT(CLIP_PROCESS_IDLE); } ClippedCamera::ClippedCamera() { margin = 0; diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp index 8b2000d2e9..fa14174089 100644 --- a/scene/3d/cpu_particles.cpp +++ b/scene/3d/cpu_particles.cpp @@ -921,8 +921,6 @@ void CPUParticles::_update_particle_data_buffer() { t = un_transform * t; } - // print_line(" particle " + itos(i) + ": " + String(r[idx].active ? "[x]" : "[ ]") + "\n\txform " + r[idx].transform + "\n\t" + r[idx].velocity + "\n\tcolor: " + r[idx].color); - if (r[idx].active) { ptr[0] = t.basis.elements[0][0]; ptr[1] = t.basis.elements[0][1]; @@ -1190,7 +1188,7 @@ void CPUParticles::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_EXP_RANGE, "0.01,600.0,0.01"), "set_lifetime", "get_lifetime"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "get_one_shot"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_EXP_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_speed_scale", "get_speed_scale"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_speed_scale", "get_speed_scale"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "explosiveness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_explosiveness_ratio", "get_explosiveness_ratio"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "randomness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_randomness_ratio", "get_randomness_ratio"); ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps"); diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp index f5b77d361c..8d84d2408c 100644 --- a/scene/3d/navigation.cpp +++ b/scene/3d/navigation.cpp @@ -120,9 +120,7 @@ void Navigation::_navmesh_link(int p_id) { pending.edge = j; p.edges.write[j].P = C->get().pending.push_back(pending); continue; - //print_line(String()+_get_vertex(ek.a)+" -> "+_get_vertex(ek.b)); } - //ERR_CONTINUE(C->get().B!=NULL); //wut C->get().B = &p; C->get().B_edge = j; @@ -312,7 +310,6 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3 &p_start, const Vector if (!begin_poly || !end_poly) { - //print_line("No Path Path"); return Vector<Vector3>(); //no path } @@ -322,7 +319,6 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3 &p_start, const Vector path.resize(2); path.write[0] = begin_point; path.write[1] = end_point; - //print_line("Direct Path"); return path; } @@ -347,7 +343,6 @@ Vector<Vector3> Navigation::get_simple_path(const Vector3 &p_start, const Vector while (!found_route) { if (open_list.size() == 0) { - //print_line("NOU OPEN LIST"); break; } //check open list @@ -581,10 +576,6 @@ Vector3 Navigation::get_closest_point_to_segment(const Vector3 &p_from, const Ve } } - if (closest_navmesh && closest_navmesh->owner) { - //print_line("navmesh is: "+Object::cast_to<Node>(closest_navmesh->owner)->get_name()); - } - return closest_point; } diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 4900692155..6ba569ac75 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -329,7 +329,7 @@ void Particles::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_EXP_RANGE, "0.01,600.0,0.01"), "set_lifetime", "get_lifetime"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "get_one_shot"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_EXP_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_speed_scale", "get_speed_scale"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_speed_scale", "get_speed_scale"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "explosiveness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_explosiveness_ratio", "get_explosiveness_ratio"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "randomness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_randomness_ratio", "get_randomness_ratio"); ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps"); diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp index 7988c43eab..a30fc0ac3e 100644 --- a/scene/3d/physics_joint.cpp +++ b/scene/3d/physics_joint.cpp @@ -48,18 +48,14 @@ void Joint::_update_joint(bool p_only_free) { Node *node_a = has_node(get_node_a()) ? get_node(get_node_a()) : (Node *)NULL; Node *node_b = has_node(get_node_b()) ? get_node(get_node_b()) : (Node *)NULL; - if (!node_a || !node_b) - return; - PhysicsBody *body_a = Object::cast_to<PhysicsBody>(node_a); PhysicsBody *body_b = Object::cast_to<PhysicsBody>(node_b); - if (!body_a || !body_b) - return; - - if (!body_a) { + if (!body_a && body_b) SWAP(body_a, body_b); - } + + if (!body_a) + return; joint = _configure_joint(body_a, body_b); @@ -69,7 +65,8 @@ void Joint::_update_joint(bool p_only_free) { PhysicsServer::get_singleton()->joint_set_solver_priority(joint, solver_priority); ba = body_a->get_rid(); - bb = body_b->get_rid(); + if (body_b) + bb = body_b->get_rid(); PhysicsServer::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision); } diff --git a/scene/3d/remote_transform.cpp b/scene/3d/remote_transform.cpp index 2156e24cd0..c12e49fb47 100644 --- a/scene/3d/remote_transform.cpp +++ b/scene/3d/remote_transform.cpp @@ -124,8 +124,10 @@ void RemoteTransform::_notification(int p_what) { void RemoteTransform::set_remote_node(const NodePath &p_remote_node) { remote_node = p_remote_node; - if (is_inside_tree()) + if (is_inside_tree()) { _update_cache(); + _update_remote(); + } update_configuration_warning(); } diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index 26958930e4..f9d096633c 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -366,22 +366,14 @@ void VehicleBody::_update_wheel(int p_idx, PhysicsDirectBodyState *s) { const Vector3 &right = wheel.m_raycastInfo.m_wheelAxleWS; Vector3 fwd = up.cross(right); fwd = fwd.normalized(); - //up = right.cross(fwd); - //up.normalize(); //rotate around steering over de wheelAxleWS real_t steering = wheel.steers ? m_steeringValue : 0.0; - //print_line(itos(p_idx)+": "+rtos(steering)); Basis steeringMat(up, steering); Basis rotatingMat(right, wheel.m_rotation); - /* - if (p_idx==1) - print_line("steeringMat " +steeringMat); - */ - Basis basis2( right[0], up[0], fwd[0], right[1], up[1], fwd[1], @@ -420,8 +412,6 @@ real_t VehicleBody::_ray_cast(int p_idx, PhysicsDirectBodyState *s) { wheel.m_raycastInfo.m_groundObject = 0; if (col) { - //print_line("WHEEL "+itos(p_idx)+" FROM "+source+" TO: "+target); - //print_line("WHEEL "+itos(p_idx)+" COLLIDE? "+itos(col)); param = source.distance_to(rr.position) / source.distance_to(target); depth = raylen * param; wheel.m_raycastInfo.m_contactNormalWS = rr.normal; diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp index f3abdc6bbe..e846e1763d 100644 --- a/scene/3d/voxel_light_baker.cpp +++ b/scene/3d/voxel_light_baker.cpp @@ -491,8 +491,6 @@ Vector<Color> VoxelLightBaker::_get_bake_texture(Ref<Image> p_image, const Color p_image = p_image->duplicate(); if (p_image->is_compressed()) { - print_line("DECOMPRESSING!!!!"); - p_image->decompress(); } p_image->convert(Image::FORMAT_RGBA8); @@ -859,7 +857,6 @@ void VoxelLightBaker::plot_light_directional(const Vector3 &p_direction, const C int idx = first_leaf; while (idx >= 0) { - //print_line("plot idx " + itos(idx)); Light *light = &light_data[idx]; Vector3 to(light->x + 0.5, light->y + 0.5, light->z + 0.5); @@ -949,7 +946,6 @@ void VoxelLightBaker::plot_light_omni(const Vector3 &p_pos, const Color &p_color int idx = first_leaf; while (idx >= 0) { - //print_line("plot idx " + itos(idx)); Light *light = &light_data[idx]; Vector3 to(light->x + 0.5, light->y + 0.5, light->z + 0.5); @@ -1079,7 +1075,6 @@ void VoxelLightBaker::plot_light_spot(const Vector3 &p_pos, const Vector3 &p_axi int idx = first_leaf; while (idx >= 0) { - //print_line("plot idx " + itos(idx)); Light *light = &light_data[idx]; Vector3 to(light->x + 0.5, light->y + 0.5, light->z + 0.5); @@ -1498,12 +1493,8 @@ void VoxelLightBaker::_sample_baked_octree_filtered_and_anisotropic(const Vector for (int i = 0; i < 6; i++) { //anisotropic read light float amount = p_direction.dot(aniso_normal[i]); - //if (c == 0) { - // print_line("\t" + itos(n) + " aniso " + itos(i) + " " + rtos(light[cell].accum[i][0]) + " VEC: " + aniso_normal[i]); - //} if (amount < 0) amount = 0; - //amount = 1; color[c][n].x += light[cell].accum[i][0] * amount; color[c][n].y += light[cell].accum[i][1] * amount; color[c][n].z += light[cell].accum[i][2] * amount; @@ -1513,8 +1504,6 @@ void VoxelLightBaker::_sample_baked_octree_filtered_and_anisotropic(const Vector color[c][n].y += cells[cell].emission[1]; color[c][n].z += cells[cell].emission[2]; } - - //print_line("\tlev " + itos(c) + " - " + itos(n) + " alpha: " + rtos(cells[test_cell].alpha) + " col: " + color[c][n]); } } @@ -1559,8 +1548,6 @@ void VoxelLightBaker::_sample_baked_octree_filtered_and_anisotropic(const Vector r_color = color_interp[0].linear_interpolate(color_interp[1], level_filter); r_alpha = Math::lerp(alpha_interp[0], alpha_interp[1], level_filter); - - // print_line("pos: " + p_posf + " level " + rtos(p_level) + " down to " + itos(target_level) + "." + rtos(level_filter) + " color " + r_color + " alpha " + rtos(r_alpha)); } Vector3 VoxelLightBaker::_voxel_cone_trace(const Vector3 &p_pos, const Vector3 &p_normal, float p_aperture) { @@ -1577,8 +1564,6 @@ Vector3 VoxelLightBaker::_voxel_cone_trace(const Vector3 &p_pos, const Vector3 & while (dist < max_distance && alpha < 0.95) { float diameter = MAX(1.0, 2.0 * p_aperture * dist); - //print_line("VCT: pos " + (p_pos + dist * p_normal) + " dist " + rtos(dist) + " mipmap " + rtos(log2(diameter)) + " alpha " + rtos(alpha)); - //Plane scolor = textureLod(probe, (pos + dist * direction) * cell_size, log2(diameter) ); _sample_baked_octree_filtered_and_anisotropic(p_pos + dist * p_normal, p_normal, log2(diameter), scolor, salpha); float a = (1.0 - alpha); color += scolor * a; @@ -1601,7 +1586,6 @@ Vector3 VoxelLightBaker::_compute_pixel_light_at_pos(const Vector3 &p_pos, const Vector3 bitangent = tangent.cross(p_normal).normalized(); Basis normal_xform = Basis(tangent, bitangent, p_normal).transposed(); - // print_line("normal xform: " + normal_xform); const Vector3 *cone_dirs; const float *cone_weights; int cone_dir_count; @@ -1667,10 +1651,7 @@ Vector3 VoxelLightBaker::_compute_pixel_light_at_pos(const Vector3 &p_pos, const Vector3 accum; for (int i = 0; i < cone_dir_count; i++) { - // if (i > 0) - // continue; Vector3 dir = normal_xform.xform(cone_dirs[i]).normalized(); //normal may not completely correct when transformed to cell - //print_line("direction: " + dir); accum += _voxel_cone_trace(p_pos, dir, cone_aperture) * cone_weights[i]; } @@ -1802,7 +1783,6 @@ void VoxelLightBaker::_lightmap_bake_point(uint32_t p_x, LightMap *p_line) { LightMap *pixel = &p_line[p_x]; if (pixel->pos == Vector3()) return; - //print_line("pos: " + pixel->pos + " normal " + pixel->normal); switch (bake_mode) { case BAKE_MODE_CONE_TRACE: { pixel->light = _compute_pixel_light_at_pos(pixel->pos, pixel->normal) * energy; @@ -1810,8 +1790,6 @@ void VoxelLightBaker::_lightmap_bake_point(uint32_t p_x, LightMap *p_line) { case BAKE_MODE_RAY_TRACE: { pixel->light = _compute_ray_trace_at_pos(pixel->pos, pixel->normal) * energy; } break; - // pixel->light = Vector3(1, 1, 1); - //} } } @@ -1895,7 +1873,6 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh if (bake_mode == BAKE_MODE_RAY_TRACE) { //blur - print_line("bluring, use pos for separatable copy"); //gauss kernel, 7 step sigma 2 static const float gauss_kernel[4] = { 0.214607, 0.189879, 0.131514, 0.071303 }; //horizontal pass @@ -1960,8 +1937,6 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh #pragma omp parallel #endif for (int i = 0; i < height; i++) { - - //print_line("bake line " + itos(i) + " / " + itos(height)); #ifdef _OPENMP #pragma omp parallel for schedule(dynamic, 1) #endif @@ -2304,7 +2279,6 @@ Ref<MultiMesh> VoxelLightBaker::create_debug_multimesh(DebugMode p_mode) { mm->set_transform_format(MultiMesh::TRANSFORM_3D); mm->set_color_format(MultiMesh::COLOR_8BIT); - print_line("leaf voxels: " + itos(leaf_voxel_count)); mm->set_instance_count(leaf_voxel_count); Ref<ArrayMesh> mesh; diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index 66a9c5babd..10bab3ce38 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -987,17 +987,6 @@ void AnimationNodeBlendTree::disconnect_node(const StringName &p_node, int p_inp nodes[p_node].connections.write[p_input_index] = StringName(); } -float AnimationNodeBlendTree::get_connection_activity(const StringName &p_input_node, int p_input_index) const { - - ERR_FAIL_COND_V(!nodes.has(p_input_node), 0); - - Ref<AnimationNode> input = nodes[p_input_node].node; - ERR_FAIL_INDEX_V(p_input_index, nodes[p_input_node].connections.size(), 0); - - //return input->get_input_activity(p_input_index); - return 0; -} - AnimationNodeBlendTree::ConnectionError AnimationNodeBlendTree::can_connect_node(const StringName &p_input_node, int p_input_index, const StringName &p_output_node) const { if (!nodes.has(p_output_node) || p_output_node == SceneStringNames::get_singleton()->output) { diff --git a/scene/animation/animation_blend_tree.h b/scene/animation/animation_blend_tree.h index 37bd45c74a..7bf2917c1e 100644 --- a/scene/animation/animation_blend_tree.h +++ b/scene/animation/animation_blend_tree.h @@ -349,7 +349,6 @@ public: void connect_node(const StringName &p_input_node, int p_input_index, const StringName &p_output_node); void disconnect_node(const StringName &p_node, int p_input_index); - float get_connection_activity(const StringName &p_input_node, int p_input_index) const; struct NodeConnection { StringName input_node; diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp index c28e918a16..09c36eb081 100644 --- a/scene/animation/animation_node_state_machine.cpp +++ b/scene/animation/animation_node_state_machine.cpp @@ -124,7 +124,6 @@ void AnimationNodeStateMachinePlayback::start(const StringName &p_state) { start_request_travel = false; start_request = p_state; stop_request = false; - print_line("wants start"); } void AnimationNodeStateMachinePlayback::stop() { diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index a660665d3f..d8db1973d2 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -960,8 +960,6 @@ Error AnimationPlayer::add_animation(const StringName &p_name, const Ref<Animati ERR_FAIL_COND_V(p_animation.is_null(), ERR_INVALID_PARAMETER); - //print_line("Add anim: "+String(p_name)+" name: "+p_animation->get_name()); - if (animation_set.has(p_name)) { _unref_anim(animation_set[p_name].animation); diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 1513010a8a..73bd00e456 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -109,8 +109,16 @@ float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p Ref<AnimationNode> node = blend_tree->get_node(node_name); //inputs.write[p_input].last_pass = state->last_pass; - float activity; - return _blend_node(node_name, blend_tree->get_node_connection_array(node_name), NULL, node, p_time, p_seek, p_blend, p_filter, p_optimize, &activity); + float activity = 0; + float ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), NULL, node, p_time, p_seek, p_blend, p_filter, p_optimize, &activity); + + Vector<AnimationTree::Activity> *activity_ptr = state->tree->input_activity_map.getptr(base_path); + + if (activity_ptr && p_input < activity_ptr->size()) { + activity_ptr->write[p_input].last_pass = state->last_pass; + activity_ptr->write[p_input].activity = activity; + } + return ret; } float AnimationNode::blend_node(const StringName &p_sub_path, Ref<AnimationNode> p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize) { @@ -690,6 +698,28 @@ void AnimationTree::_process_graph(float p_delta) { AnimationPlayer *player = Object::cast_to<AnimationPlayer>(get_node(animation_player)); + ObjectID current_animation_player = 0; + + if (player) { + current_animation_player = player->get_instance_id(); + } + + if (last_animation_player != current_animation_player) { + + if (last_animation_player) { + Object *old_player = ObjectDB::get_instance(last_animation_player); + if (old_player) { + old_player->disconnect("caches_cleared", this, "_clear_caches"); + } + } + + if (player) { + player->connect("caches_cleared", this, "_clear_caches"); + } + + last_animation_player = current_animation_player; + } + if (!player) { ERR_PRINT("AnimationTree: path points to a node not an AnimationPlayer, disabling playback"); set_active(false); @@ -1189,6 +1219,13 @@ void AnimationTree::_notification(int p_what) { if (p_what == NOTIFICATION_EXIT_TREE) { _clear_caches(); + if (last_animation_player) { + + Object *old_player = ObjectDB::get_instance(last_animation_player); + if (old_player) { + old_player->disconnect("caches_cleared", this, "_clear_caches"); + } + } } } @@ -1285,6 +1322,18 @@ void AnimationTree::_update_properties_for_node(const String &p_base_path, Ref<A property_parent_map[p_base_path] = HashMap<StringName, StringName>(); } + if (node->get_input_count() && !input_activity_map.has(p_base_path)) { + + Vector<Activity> activity; + for (int i = 0; i < node->get_input_count(); i++) { + Activity a; + a.last_pass = 0; + activity.push_back(a); + } + input_activity_map[p_base_path] = activity; + input_activity_map_get[String(p_base_path).substr(0, String(p_base_path).length() - 1)] = &input_activity_map[p_base_path]; + } + List<PropertyInfo> plist; node->get_parameter_list(&plist); for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) { @@ -1317,6 +1366,8 @@ void AnimationTree::_update_properties() { properties.clear(); property_parent_map.clear(); + input_activity_map.clear(); + input_activity_map_get.clear(); if (root.is_valid()) { _update_properties_for_node(SceneStringNames::get_singleton()->parameters_base_path, root); @@ -1380,6 +1431,24 @@ void AnimationTree::rename_parameter(const String &p_base, const String &p_new_b _update_properties(); } +float AnimationTree::get_connection_activity(const StringName &p_path, int p_connection) const { + + if (!input_activity_map_get.has(p_path)) { + return 0; + } + const Vector<Activity> *activity = input_activity_map_get[p_path]; + + if (!activity || p_connection < 0 || p_connection >= activity->size()) { + return 0; + } + + if ((*activity)[p_connection].last_pass != process_pass) { + return 0; + } + + return (*activity)[p_connection].activity; +} + void AnimationTree::_bind_methods() { ClassDB::bind_method(D_METHOD("set_active", "active"), &AnimationTree::set_active); ClassDB::bind_method(D_METHOD("is_active"), &AnimationTree::is_active); @@ -1406,6 +1475,7 @@ void AnimationTree::_bind_methods() { ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationTree::advance); ClassDB::bind_method(D_METHOD("_node_removed"), &AnimationTree::_node_removed); + ClassDB::bind_method(D_METHOD("_clear_caches"), &AnimationTree::_clear_caches); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "tree_root", PROPERTY_HINT_RESOURCE_TYPE, "AnimationRootNode"), "set_tree_root", "get_tree_root"); ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "anim_player", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "AnimationPlayer"), "set_animation_player", "get_animation_player"); @@ -1427,6 +1497,7 @@ AnimationTree::AnimationTree() { setup_pass = 1; started = true; properties_dirty = true; + last_animation_player = 0; } AnimationTree::~AnimationTree() { diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h index 3c615b2f92..6cb363d50a 100644 --- a/scene/animation/animation_tree.h +++ b/scene/animation/animation_tree.h @@ -55,7 +55,7 @@ public: Vector<float> blends; State *state; - String path; + float _pre_process(const StringName &p_base_path, AnimationNode *p_parent, State *p_state, float p_time, bool p_seek, const Vector<StringName> &p_connections); void _pre_update_animations(HashMap<NodePath, int> *track_map); @@ -256,8 +256,18 @@ private: HashMap<StringName, HashMap<StringName, StringName> > property_parent_map; HashMap<StringName, Variant> property_map; + struct Activity { + uint64_t last_pass; + float activity; + }; + + HashMap<StringName, Vector<Activity> > input_activity_map; + HashMap<StringName, Vector<Activity> *> input_activity_map_get; + void _update_properties_for_node(const String &p_base_path, Ref<AnimationNode> node); + ObjectID last_animation_player; + protected: bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; @@ -289,6 +299,7 @@ public: Transform get_root_motion_transform() const; + float get_connection_activity(const StringName &p_path, int p_connection) const; void advance(float p_time); void rename_parameter(const String &p_base, const String &p_new_base); diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index acdbd9de08..d17ae1d84c 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -31,7 +31,6 @@ #include "base_button.h" #include "os/keyboard.h" -#include "print_string.h" #include "scene/main/viewport.h" #include "scene/scene_string_names.h" @@ -361,7 +360,6 @@ BaseButton::DrawMode BaseButton::get_draw_mode() const { return DRAW_DISABLED; }; - //print_line("press attempt: "+itos(status.press_attempt)+" hover: "+itos(status.hovering)+" pressed: "+itos(status.pressed)); if (status.press_attempt == false && status.hovering && !status.pressed) { return DRAW_HOVER; diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 03b25a138f..a34f2f1ad5 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -29,7 +29,6 @@ /*************************************************************************/ #include "button.h" -#include "print_string.h" #include "servers/visual_server.h" #include "translation.h" @@ -76,8 +75,6 @@ void Button::_notification(int p_what) { Color color; Color color_icon(1, 1, 1, 1); - //print_line(get_text()+": "+itos(is_flat())+" hover "+itos(get_draw_mode())); - Ref<StyleBox> style = get_stylebox("normal"); switch (get_draw_mode()) { diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 18f06eca31..e094a063be 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -357,7 +357,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const { if (data.shader_override.has(E->get())) hint |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; - p_list->push_back(PropertyInfo(Variant::OBJECT, "custom_shaders/" + E->get(), PROPERTY_HINT_RESOURCE_TYPE, "CanvasItemShader,CanvasItemShaderGraph", hint)); + p_list->push_back(PropertyInfo(Variant::OBJECT, "custom_shaders/" + E->get(), PROPERTY_HINT_RESOURCE_TYPE, "Shader,VisualShader", hint)); } } { @@ -769,6 +769,7 @@ void Control::force_drag(const Variant &p_data, Control *p_control) { void Control::set_drag_preview(Control *p_control) { ERR_FAIL_COND(!is_inside_tree()); + ERR_FAIL_COND(get_viewport()->gui_is_dragging()); get_viewport()->_gui_set_drag_preview(this, p_control); } diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp index d862e8669c..8560efdde5 100644 --- a/scene/gui/link_button.cpp +++ b/scene/gui/link_button.cpp @@ -68,8 +68,6 @@ void LinkButton::_notification(int p_what) { Color color; bool do_underline = false; - //print_line(get_text()+": "+itos(is_flat())+" hover "+itos(get_draw_mode())); - switch (get_draw_mode()) { case DRAW_NORMAL: { diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index a3748bf14c..a5f9bea1b1 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -2034,7 +2034,6 @@ void RichTextLabel::selection_copy() { if (text != "") { OS::get_singleton()->set_clipboard(text); - //print_line("COPY: "+text); } } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 9a8dc62e4e..ec98b01ced 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -5640,6 +5640,10 @@ void TextEdit::_confirm_completion() { end_complex_operation(); _cancel_completion(); + + if (last_completion_char == '(') { + query_code_comple(); + } } void TextEdit::_cancel_code_hint() { @@ -5692,15 +5696,12 @@ void TextEdit::_update_completion_candidates() { bool pre_keyword = false; bool cancel = false; - //print_line("inquote: "+itos(inquote)+"first quote "+itos(first_quote)+" cofs-1 "+itos(cofs-1)); if (!inquote && first_quote == cofs - 1) { //no completion here - //print_line("cancel!"); cancel = true; } else if (inquote && first_quote != -1) { s = l.substr(first_quote, cofs - first_quote); - //print_line("s: 1"+s); } else if (cofs > 0 && l[cofs - 1] == ' ') { int kofs = cofs - 1; String kw; @@ -5713,7 +5714,6 @@ void TextEdit::_update_completion_candidates() { } pre_keyword = keywords.has(kw); - //print_line("KW "+kw+"? "+itos(pre_keyword)); } else { @@ -5755,43 +5755,23 @@ void TextEdit::_update_completion_candidates() { completion_strings.write[i] = completion_strings[i].unquote().quote("'"); } - if (s == completion_strings[i]) { - // A perfect match, stop completion - _cancel_completion(); - return; + if (completion_strings[i].begins_with(s)) { + completion_options.push_back(completion_strings[i]); } + } - if (s.is_subsequence_ofi(completion_strings[i])) { - // don't remove duplicates if no input is provided - if (s != "" && completion_options.find(completion_strings[i]) != -1) { - continue; - } - // Calculate the similarity to keep completions in good order - float similarity; - if (completion_strings[i].begins_with(s)) { - // Substrings (same case) are the best candidates - similarity = 1.2; - } else if (completion_strings[i].to_lower().begins_with(s.to_lower())) { - // then any substrings - similarity = 1.1; - } else { - // Otherwise compute the similarity - similarity = s.to_lower().similarity(completion_strings[i].to_lower()); + if (completion_options.size() == 0) { + for (int i = 0; i < completion_strings.size(); i++) { + if (s.is_subsequence_of(completion_strings[i])) { + completion_options.push_back(completion_strings[i]); } + } + } - int comp_size = completion_options.size(); - if (comp_size == 0) { + if (completion_options.size() == 0) { + for (int i = 0; i < completion_strings.size(); i++) { + if (s.is_subsequence_ofi(completion_strings[i])) { completion_options.push_back(completion_strings[i]); - sim_cache.push_back(similarity); - } else { - float comp_sim; - int pos = 0; - do { - comp_sim = sim_cache[pos++]; - } while (pos < comp_size && similarity < comp_sim); - pos = similarity > comp_sim ? pos - 1 : pos; // Pos will be off by one - completion_options.insert(pos, completion_strings[i]); - sim_cache.insert(pos, similarity); } } } @@ -5799,7 +5779,12 @@ void TextEdit::_update_completion_candidates() { if (completion_options.size() == 0) { //no options to complete, cancel _cancel_completion(); + return; + } + if (completion_options.size() == 1 && s == completion_options[0]) { + // A perfect match, stop completion + _cancel_completion(); return; } diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp index 6e4fe88dbf..ff90576c1b 100644 --- a/scene/gui/texture_progress.cpp +++ b/scene/gui/texture_progress.cpp @@ -266,6 +266,8 @@ void TextureProgress::draw_nine_patch_stretched(const Ref<Texture> &p_texture, F } } + p_texture->get_rect_region(dst_rect, src_rect, dst_rect, src_rect); + RID ci = get_canvas_item(); VS::get_singleton()->canvas_item_add_nine_patch(ci, dst_rect, src_rect, p_texture->get_rid(), topleft, bottomright, VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, true, p_modulate); } diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index c044443b51..a2e890e7a7 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -29,7 +29,6 @@ /*************************************************************************/ #include "canvas_layer.h" -#include "scene/2d/canvas_item.h" #include "viewport.h" void CanvasLayer::set_layer(int p_xform) { @@ -63,24 +62,6 @@ void CanvasLayer::_update_xform() { transform.set_origin(ofs); if (viewport.is_valid()) VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform); - - if (!is_inside_tree()) - return; - - _notify_xform(this); -} - -void CanvasLayer::_notify_xform(Node *p_node) { - - for (int i = 0; i < p_node->get_child_count(); i++) { - - CanvasItem *ci = Object::cast_to<CanvasItem>(p_node->get_child(i)); - if (ci) { - ci->_notify_transform(ci); - } else { - _notify_xform(p_node->get_child(i)); - } - } } void CanvasLayer::_update_locrotscale() { diff --git a/scene/main/canvas_layer.h b/scene/main/canvas_layer.h index fd347c4739..aae23fbb12 100644 --- a/scene/main/canvas_layer.h +++ b/scene/main/canvas_layer.h @@ -56,7 +56,6 @@ class CanvasLayer : public Node { int sort_index; void _update_xform(); - void _notify_xform(Node *p_node); void _update_locrotscale(); protected: diff --git a/scene/main/node.cpp b/scene/main/node.cpp index f6905e7c2e..e30f58e012 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2082,9 +2082,7 @@ void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p } else { Object *obj = ClassDB::instance(get_class()); - if (!obj) { - print_line("could not duplicate: " + String(get_class())); - } + ERR_EXPLAIN("Node: Could not duplicate: " + String(get_class())); ERR_FAIL_COND(!obj); node = Object::cast_to<Node>(obj); if (!node) @@ -2179,9 +2177,7 @@ Node *Node::duplicate_and_reown(const Map<Node *, Node *> &p_reown_map) const { Node *node = NULL; Object *obj = ClassDB::instance(get_class()); - if (!obj) { - print_line("could not duplicate: " + String(get_class())); - } + ERR_EXPLAIN("Node: Could not duplicate: " + String(get_class())); ERR_FAIL_COND_V(!obj, NULL); node = Object::cast_to<Node>(obj); if (!node) @@ -2472,7 +2468,7 @@ static void _Node_debug_sn(Object *p_obj) { path = n->get_name(); else path = String(p->get_name()) + "/" + p->get_path_to(n); - print_line(itos(p_obj->get_instance_id()) + "- Stray Node: " + path + " (Type: " + n->get_class() + ")"); + print_line(itos(p_obj->get_instance_id()) + " - Stray Node: " + path + " (Type: " + n->get_class() + ")"); } void Node::_print_stray_nodes() { diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index e99f785848..1d23650a1e 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -1195,8 +1195,6 @@ void SceneTree::_update_root_rect() { VisualServer::get_singleton()->black_bars_set_margins(0, 0, 0, 0); } - //print_line("VP SIZE: "+viewport_size+" OFFSET: "+offset+" = "+(offset*2+viewport_size)); - //print_line("SS: "+video_mode); switch (stretch_mode) { case STRETCH_MODE_2D: { diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index f92b6e7583..d1b3eb9d9a 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -185,6 +185,7 @@ public: Viewport::GUI::GUI() { + dragging = false; mouse_focus = NULL; mouse_click_grabber = NULL; mouse_focus_button = -1; @@ -1506,12 +1507,6 @@ Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_ if (Object::cast_to<Viewport>(p_node)) return NULL; - Control *c = Object::cast_to<Control>(p_node); - - if (c) { - //print_line("at "+String(c->get_path())+" POS "+c->get_position()+" bt "+p_xform); - } - //subwindows first!! if (!p_node->is_visible()) { @@ -1524,6 +1519,8 @@ Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_ if (matrix.basis_determinant() == 0.0f) return NULL; + Control *c = Object::cast_to<Control>(p_node); + if (!c || !c->clips_input() || c->has_point(matrix.affine_inverse().xform(p_global))) { for (int i = p_node->get_child_count() - 1; i >= 0; i--) { @@ -1654,7 +1651,6 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { */ gui.mouse_focus = _gui_find_control(pos); - //print_line("has mf "+itos(gui.mouse_focus!=NULL)); gui.mouse_focus_button = mb->get_button_index(); if (!gui.mouse_focus) { @@ -1683,11 +1679,6 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { arr.push_back(gui.mouse_focus->get_class()); ScriptDebugger::get_singleton()->send_message("click_ctrl", arr); } - -/*if (bool(GLOBAL_DEF("debug/print_clicked_control",false))) { - - print_line(String(gui.mouse_focus->get_path())+" - "+pos); - }*/ #endif if (mb->get_button_index() == BUTTON_LEFT) { //assign focus @@ -1728,6 +1719,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { } gui.drag_data = Variant(); + gui.dragging = false; if (gui.drag_preview) { memdelete(gui.drag_preview); @@ -1757,6 +1749,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { } gui.drag_data = Variant(); + gui.dragging = false; _propagate_viewport_notification(this, NOTIFICATION_DRAG_END); //change mouse accordingly } @@ -1819,10 +1812,13 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { Control *control = Object::cast_to<Control>(ci); if (control) { + gui.dragging = true; gui.drag_data = control->get_drag_data(control->get_global_transform_with_canvas().affine_inverse().xform(mpos) - gui.drag_accum); if (gui.drag_data.get_type() != Variant::NIL) { gui.mouse_focus = NULL; + } else { + gui.dragging = false; } if (control->data.mouse_filter == Control::MOUSE_FILTER_STOP) @@ -2262,6 +2258,7 @@ void Viewport::_gui_force_drag(Control *p_base, const Variant &p_data, Control * ERR_EXPLAIN("Drag data must be a value"); ERR_FAIL_COND(p_data.get_type() == Variant::NIL); + gui.dragging = true; gui.drag_data = p_data; gui.mouse_focus = NULL; @@ -2701,6 +2698,9 @@ bool Viewport::is_snap_controls_to_pixels_enabled() const { return snap_controls_to_pixels; } +bool Viewport::gui_is_dragging() const { + return gui.dragging; +} void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("set_use_arvr", "use"), &Viewport::set_use_arvr); @@ -2787,6 +2787,7 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("gui_has_modal_stack"), &Viewport::gui_has_modal_stack); ClassDB::bind_method(D_METHOD("gui_get_drag_data"), &Viewport::gui_get_drag_data); + ClassDB::bind_method(D_METHOD("gui_is_dragging"), &Viewport::gui_is_dragging); ClassDB::bind_method(D_METHOD("set_disable_input", "disable"), &Viewport::set_disable_input); ClassDB::bind_method(D_METHOD("is_input_disabled"), &Viewport::is_input_disabled); diff --git a/scene/main/viewport.h b/scene/main/viewport.h index e4ef373c77..450f235b79 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -274,6 +274,7 @@ private: bool roots_order_dirty; List<Control *> roots; int canvas_sort_index; //for sorting items with canvas as root + bool dragging; GUI(); } gui; @@ -474,6 +475,8 @@ public: void _subwindow_visibility_changed(); + bool gui_is_dragging() const; + Viewport(); ~Viewport(); }; diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index da4e2f991d..dccdd244ef 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -150,7 +150,6 @@ #include "scene/resources/rectangle_shape_2d.h" #include "scene/resources/scene_format_text.h" #include "scene/resources/segment_shape_2d.h" -#include "scene/resources/shader_graph.h" #include "scene/resources/shape_line_2d.h" #include "scene/resources/sky_box.h" #include "scene/resources/sphere_shape.h" @@ -564,6 +563,9 @@ void register_scene_types() { /* REGISTER RESOURCES */ ClassDB::register_virtual_class<Shader>(); + ClassDB::register_class<ParticlesMaterial>(); + SceneTree::add_idle_callback(ParticlesMaterial::flush_changes); + ParticlesMaterial::init_shaders(); #ifndef _3D_DISABLED ClassDB::register_virtual_class<Mesh>(); @@ -581,10 +583,6 @@ void register_scene_types() { SceneTree::add_idle_callback(SpatialMaterial::flush_changes); SpatialMaterial::init_shaders(); - ClassDB::register_class<ParticlesMaterial>(); - SceneTree::add_idle_callback(ParticlesMaterial::flush_changes); - ParticlesMaterial::init_shaders(); - ClassDB::register_class<MultiMesh>(); ClassDB::register_class<MeshLibrary>(); diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 7041b62487..58e6db3f5e 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -2906,8 +2906,6 @@ bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0, cons //able to optimize more erase = false; } else { - - //print_line(itos(i)+"because of interp"); } } } diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp index 39206ed043..5694099754 100644 --- a/scene/resources/bit_mask.cpp +++ b/scene/resources/bit_mask.cpp @@ -492,18 +492,14 @@ static void fill_bits(const BitMap *p_src, Ref<BitMap> &p_map, const Point2i &p_ } } while (reenter || popped); -#ifdef DEBUG_ENABLED - print_line("max stack size: " + itos(stack.size())); -#endif + print_verbose("BitMap: Max stack size: " + itos(stack.size())); } Vector<Vector<Vector2> > BitMap::clip_opaque_to_polygons(const Rect2 &p_rect, float p_epsilon) const { Rect2i r = Rect2i(0, 0, width, height).clip(p_rect); + print_verbose("BitMap: Rect: " + r); -#ifdef DEBUG_ENABLED - print_line("Rect: " + r); -#endif Point2i from; Ref<BitMap> fill; fill.instance(); @@ -515,13 +511,9 @@ Vector<Vector<Vector2> > BitMap::clip_opaque_to_polygons(const Rect2 &p_rect, fl if (!fill->get_bit(Point2(j, i)) && get_bit(Point2(j, i))) { Vector<Vector2> polygon = _march_square(r, Point2i(j, i)); -#ifdef DEBUG_ENABLED - print_line("pre reduce: " + itos(polygon.size())); -#endif + print_verbose("BitMap: Pre reduce: " + itos(polygon.size())); polygon = reduce(polygon, r, p_epsilon); -#ifdef DEBUG_ENABLED - print_line("post reduce: " + itos(polygon.size())); -#endif + print_verbose("BitMap: Post reduce: " + itos(polygon.size())); polygons.push_back(polygon); fill_bits(this, fill, Point2i(j, i), r); } diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 2f2abd4e08..4df849df6a 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -435,8 +435,6 @@ DynamicFontAtSize::TexturePosition DynamicFontAtSize::_find_texture_pos_for_glyp break; } - //print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" X: "+itos(tex_x)+" Y: "+itos(tex_y)); - if (ret.index == -1) { //could not find texture to fit, create one ret.x = 0; @@ -1036,6 +1034,8 @@ SelfList<DynamicFont>::List DynamicFont::dynamic_fonts; DynamicFont::DynamicFont() : font_list(this) { + cache_id.size = 16; + outline_cache_id.size = 16; spacing_top = 0; spacing_bottom = 0; spacing_char = 0; diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp index 29f1106d16..be394e19c4 100644 --- a/scene/resources/dynamic_font_stb.cpp +++ b/scene/resources/dynamic_font_stb.cpp @@ -214,7 +214,6 @@ void DynamicFontAtSize::_update_char(CharType p_char) { int advance; stbtt_GetCodepointHMetrics(&font->info, p_char, &advance, 0); - //print_line("char has no bitmap: "+itos(p_char)+" but advance is "+itos(advance*scale)); Character ch; ch.texture_idx = -1; ch.advance = advance * scale; @@ -279,8 +278,6 @@ void DynamicFontAtSize::_update_char(CharType p_char) { break; } - //print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" X: "+itos(tex_x)+" Y: "+itos(tex_y)); - if (tex_index == -1) { //could not find texture to fit, create one tex_x = 0; @@ -364,8 +361,6 @@ void DynamicFontAtSize::_update_char(CharType p_char) { chr.rect = Rect2(tex_x + rect_margin, tex_y + rect_margin, w, h); - //print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" RECT: "+chr.rect+" X OFS: "+itos(xofs)+" Y OFS: "+itos(yofs)); - char_map[p_char] = chr; stbtt_FreeBitmap(cpbitmap, NULL); diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index dcd87a2a61..042cf28fec 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -1241,7 +1241,7 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe surfaces_tools.push_back(st); //stay there } - print_line("gen indices: " + itos(gen_index_count)); + print_verbose("Mesh: Gen indices: " + itos(gen_index_count)); //go through all indices for (int i = 0; i < gen_index_count; i += 3) { diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 07783d5f4a..f034e07ff9 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -106,7 +106,6 @@ Node *SceneState::instance(GenEditState p_edit_state) const { if (i == 0 && base_scene_idx >= 0) { //scene inheritance on root node - //print_line("scene inherit"); Ref<PackedScene> sdata = props[base_scene_idx]; ERR_FAIL_COND_V(!sdata.is_valid(), NULL); node = sdata->instance(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); //only main gets main edit state @@ -117,7 +116,6 @@ Node *SceneState::instance(GenEditState p_edit_state) const { } else if (n.instance >= 0) { //instance a scene into this node - //print_line("instance"); if (n.instance & FLAG_INSTANCE_IS_PLACEHOLDER) { String path = props[n.instance & FLAG_MASK]; @@ -141,7 +139,6 @@ Node *SceneState::instance(GenEditState p_edit_state) const { } } else if (n.type == TYPE_INSTANCED) { - //print_line("instanced"); //get the node from somewhere, it likely already exists from another instance if (parent) { node = parent->_get_child_by_name(snames[n.name]); @@ -152,7 +149,6 @@ Node *SceneState::instance(GenEditState p_edit_state) const { #endif } } else if (ClassDB::is_class_enabled(snames[n.type])) { - //print_line("created"); //node belongs to this scene and must be created Object *obj = ClassDB::instance(snames[n.type]); if (!Object::cast_to<Node>(obj)) { @@ -491,15 +487,6 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map if (E->get().usage & PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE) { isdefault = true; //is script default value } - /* - if (nd.instance<0 && ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONZERO) && value.is_zero()) || ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONONE) && value.is_one())) { - continue; - } - */ - - //print_line("PASSED!"); - //print_line("at: "+String(p_node->get_name())+"::"+name+": - nz: "+itos(E->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO)+" no: "+itos(E->get().usage&PROPERTY_USAGE_STORE_IF_NONONE)); - //print_line("value: "+String(value)+" is zero: "+itos(value.is_zero())+" is one" +itos(value.is_one())); if (pack_state_stack.size()) { // we are on part of an instanced subscene diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp deleted file mode 100644 index 070cc84863..0000000000 --- a/scene/resources/shader_graph.cpp +++ /dev/null @@ -1,2596 +0,0 @@ -/*************************************************************************/ -/* shader_graph.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "shader_graph.h" - -#include "scene/scene_string_names.h" - -// FIXME: Needs to be ported to the new 3.0 shader API -#if 0 -Array ShaderGraph::_get_node_list(ShaderType p_type) const { - - List<int> nodes; - get_node_list(p_type,&nodes); - Array arr(true); - for (List<int>::Element *E=nodes.front();E;E=E->next()) - arr.push_back(E->get()); - return arr; -} -Array ShaderGraph::_get_connections(ShaderType p_type) const { - - List<Connection> connections; - get_node_connections(p_type,&connections); - Array arr(true); - for (List<Connection>::Element *E=connections.front();E;E=E->next()) { - - Dictionary d(true); - d["src_id"]=E->get().src_id; - d["src_slot"]=E->get().src_slot; - d["dst_id"]=E->get().dst_id; - d["dst_slot"]=E->get().dst_slot; - arr.push_back(d); - - } - return arr; -} - -void ShaderGraph::_set_data(const Dictionary &p_data) { - - Dictionary d=p_data; - ERR_FAIL_COND(!d.has("shaders")); - Array sh=d["shaders"]; - ERR_FAIL_COND(sh.size()!=3); - - for(int t=0;t<3;t++) { - Array data=sh[t]; - ERR_FAIL_COND((data.size()%6)!=0); - shader[t].node_map.clear(); - for(int i=0;i<data.size();i+=6) { - - Node n; - n.id=data[i+0]; - n.type=NodeType(int(data[i+1])); - n.pos=data[i+2]; - n.param1=data[i+3]; - n.param2=data[i+4]; - - Array conns=data[i+5]; - ERR_FAIL_COND((conns.size()%3)!=0); - - for(int j=0;j<conns.size();j+=3) { - SourceSlot ss; - int ls=conns[j+0]; - if (ls == SLOT_DEFAULT_VALUE) { - n.defaults[conns[j+1]]=conns[j+2]; - } else { - ss.id=conns[j+1]; - ss.slot=conns[j+2]; - n.connections[ls]=ss; - } - } - shader[t].node_map[n.id]=n; - - } - } - - _pending_update_shader=true; - _update_shader(); - -} - -Dictionary ShaderGraph::_get_data() const { - - Array sh; - for(int i=0;i<3;i++) { - Array data; - int ec = shader[i].node_map.size(); - data.resize(ec*6); - int idx=0; - for (Map<int,Node>::Element*E=shader[i].node_map.front();E;E=E->next()) { - - data[idx+0]=E->key(); - data[idx+1]=E->get().type; - data[idx+2]=E->get().pos; - data[idx+3]=E->get().param1; - data[idx+4]=E->get().param2; - - Array conns; - conns.resize(E->get().connections.size()*3+E->get().defaults.size()*3); - int idx2=0; - for(Map<int,SourceSlot>::Element*F=E->get().connections.front();F;F=F->next()) { - - conns[idx2+0]=F->key(); - conns[idx2+1]=F->get().id; - conns[idx2+2]=F->get().slot; - idx2+=3; - } - for(Map<int,Variant>::Element*F=E->get().defaults.front();F;F=F->next()) { - - conns[idx2+0]=SLOT_DEFAULT_VALUE; - conns[idx2+1]=F->key(); - conns[idx2+2]=F->get(); - idx2+=3; - } - - data[idx+5]=conns; - idx+=6; - } - sh.push_back(data); - } - - Dictionary data; - data["shaders"]=sh; - return data; -} - - - -ShaderGraph::GraphError ShaderGraph::get_graph_error(ShaderType p_type) const { - - ERR_FAIL_INDEX_V(p_type,3,GRAPH_OK); - return shader[p_type].error; -} - -int ShaderGraph::node_count(ShaderType p_which, int p_type) -{ - int count=0; - for (Map<int,Node>::Element *E=shader[p_which].node_map.front();E;E=E->next()) - if (E->get().type==p_type) - count++; - return count; -} - -void ShaderGraph::_bind_methods() { - - ClassDB::bind_method(D_METHOD("_update_shader"),&ShaderGraph::_update_shader); - - ClassDB::bind_method(D_METHOD("node_add","shader_type","node_type","id"),&ShaderGraph::node_add); - ClassDB::bind_method(D_METHOD("node_remove","shader_type","id"),&ShaderGraph::node_remove); - ClassDB::bind_method(D_METHOD("node_set_position","shader_type","id","position"),&ShaderGraph::node_set_position); - ClassDB::bind_method(D_METHOD("node_get_position","shader_type","id"),&ShaderGraph::node_get_position); - - ClassDB::bind_method(D_METHOD("node_get_type","shader_type","id"),&ShaderGraph::node_get_type); - - ClassDB::bind_method(D_METHOD("get_node_list","shader_type"),&ShaderGraph::_get_node_list); - - ClassDB::bind_method(D_METHOD("default_set_value","shader_type","id","param_id","value"), &ShaderGraph::default_set_value); - ClassDB::bind_method(D_METHOD("default_get_value","shader_type","id","param_id"), &ShaderGraph::default_get_value); - - ClassDB::bind_method(D_METHOD("scalar_const_node_set_value","shader_type","id","value"),&ShaderGraph::scalar_const_node_set_value); - ClassDB::bind_method(D_METHOD("scalar_const_node_get_value","shader_type","id"),&ShaderGraph::scalar_const_node_get_value); - - ClassDB::bind_method(D_METHOD("vec_const_node_set_value","shader_type","id","value"),&ShaderGraph::vec_const_node_set_value); - ClassDB::bind_method(D_METHOD("vec_const_node_get_value","shader_type","id"),&ShaderGraph::vec_const_node_get_value); - - ClassDB::bind_method(D_METHOD("rgb_const_node_set_value","shader_type","id","value"),&ShaderGraph::rgb_const_node_set_value); - ClassDB::bind_method(D_METHOD("rgb_const_node_get_value","shader_type","id"),&ShaderGraph::rgb_const_node_get_value); - - ClassDB::bind_method(D_METHOD("xform_const_node_set_value","shader_type","id","value"),&ShaderGraph::xform_const_node_set_value); - ClassDB::bind_method(D_METHOD("xform_const_node_get_value","shader_type","id"),&ShaderGraph::xform_const_node_get_value); - - - //void get_node_list(ShaderType p_which,List<int> *p_node_list) const; - - ClassDB::bind_method(D_METHOD("texture_node_set_filter_size","shader_type","id","filter_size"),&ShaderGraph::texture_node_set_filter_size); - ClassDB::bind_method(D_METHOD("texture_node_get_filter_size","shader_type","id"),&ShaderGraph::texture_node_get_filter_size); - - ClassDB::bind_method(D_METHOD("texture_node_set_filter_strength","shader_type","id","filter_strength"),&ShaderGraph::texture_node_set_filter_strength); - ClassDB::bind_method(D_METHOD("texture_node_get_filter_strength","shader_type","id"),&ShaderGraph::texture_node_get_filter_strength); - - ClassDB::bind_method(D_METHOD("scalar_op_node_set_op","shader_type","id","op"),&ShaderGraph::scalar_op_node_set_op); - ClassDB::bind_method(D_METHOD("scalar_op_node_get_op","shader_type","id"),&ShaderGraph::scalar_op_node_get_op); - - ClassDB::bind_method(D_METHOD("vec_op_node_set_op","shader_type","id","op"),&ShaderGraph::vec_op_node_set_op); - ClassDB::bind_method(D_METHOD("vec_op_node_get_op","shader_type","id"),&ShaderGraph::vec_op_node_get_op); - - ClassDB::bind_method(D_METHOD("vec_scalar_op_node_set_op","shader_type","id","op"),&ShaderGraph::vec_scalar_op_node_set_op); - ClassDB::bind_method(D_METHOD("vec_scalar_op_node_get_op","shader_type","id"),&ShaderGraph::vec_scalar_op_node_get_op); - - ClassDB::bind_method(D_METHOD("rgb_op_node_set_op","shader_type","id","op"),&ShaderGraph::rgb_op_node_set_op); - ClassDB::bind_method(D_METHOD("rgb_op_node_get_op","shader_type","id"),&ShaderGraph::rgb_op_node_get_op); - - - ClassDB::bind_method(D_METHOD("xform_vec_mult_node_set_no_translation","shader_type","id","disable"),&ShaderGraph::xform_vec_mult_node_set_no_translation); - ClassDB::bind_method(D_METHOD("xform_vec_mult_node_get_no_translation","shader_type","id"),&ShaderGraph::xform_vec_mult_node_get_no_translation); - - ClassDB::bind_method(D_METHOD("scalar_func_node_set_function","shader_type","id","func"),&ShaderGraph::scalar_func_node_set_function); - ClassDB::bind_method(D_METHOD("scalar_func_node_get_function","shader_type","id"),&ShaderGraph::scalar_func_node_get_function); - - ClassDB::bind_method(D_METHOD("vec_func_node_set_function","shader_type","id","func"),&ShaderGraph::vec_func_node_set_function); - ClassDB::bind_method(D_METHOD("vec_func_node_get_function","shader_type","id"),&ShaderGraph::vec_func_node_get_function); - - ClassDB::bind_method(D_METHOD("input_node_set_name","shader_type","id","name"),&ShaderGraph::input_node_set_name); - ClassDB::bind_method(D_METHOD("input_node_get_name","shader_type","id"),&ShaderGraph::input_node_get_name); - - ClassDB::bind_method(D_METHOD("scalar_input_node_set_value","shader_type","id","value"),&ShaderGraph::scalar_input_node_set_value); - ClassDB::bind_method(D_METHOD("scalar_input_node_get_value","shader_type","id"),&ShaderGraph::scalar_input_node_get_value); - - ClassDB::bind_method(D_METHOD("vec_input_node_set_value","shader_type","id","value"),&ShaderGraph::vec_input_node_set_value); - ClassDB::bind_method(D_METHOD("vec_input_node_get_value","shader_type","id"),&ShaderGraph::vec_input_node_get_value); - - ClassDB::bind_method(D_METHOD("rgb_input_node_set_value","shader_type","id","value"),&ShaderGraph::rgb_input_node_set_value); - ClassDB::bind_method(D_METHOD("rgb_input_node_get_value","shader_type","id"),&ShaderGraph::rgb_input_node_get_value); - - ClassDB::bind_method(D_METHOD("xform_input_node_set_value","shader_type","id","value"),&ShaderGraph::xform_input_node_set_value); - ClassDB::bind_method(D_METHOD("xform_input_node_get_value","shader_type","id"),&ShaderGraph::xform_input_node_get_value); - - ClassDB::bind_method(D_METHOD("texture_input_node_set_value","shader_type","id","value"),&ShaderGraph::texture_input_node_set_value); - ClassDB::bind_method(D_METHOD("texture_input_node_get_value","shader_type","id"),&ShaderGraph::texture_input_node_get_value); - - ClassDB::bind_method(D_METHOD("cubemap_input_node_set_value","shader_type","id","value"),&ShaderGraph::cubemap_input_node_set_value); - ClassDB::bind_method(D_METHOD("cubemap_input_node_get_value","shader_type","id"),&ShaderGraph::cubemap_input_node_get_value); - - ClassDB::bind_method(D_METHOD("comment_node_set_text","shader_type","id","text"),&ShaderGraph::comment_node_set_text); - ClassDB::bind_method(D_METHOD("comment_node_get_text","shader_type","id"),&ShaderGraph::comment_node_get_text); - - ClassDB::bind_method(D_METHOD("color_ramp_node_set_ramp","shader_type","id","colors","offsets"),&ShaderGraph::color_ramp_node_set_ramp); - ClassDB::bind_method(D_METHOD("color_ramp_node_get_colors","shader_type","id"),&ShaderGraph::color_ramp_node_get_colors); - ClassDB::bind_method(D_METHOD("color_ramp_node_get_offsets","shader_type","id"),&ShaderGraph::color_ramp_node_get_offsets); - - ClassDB::bind_method(D_METHOD("curve_map_node_set_points","shader_type","id","points"),&ShaderGraph::curve_map_node_set_points); - ClassDB::bind_method(D_METHOD("curve_map_node_get_points","shader_type","id"),&ShaderGraph::curve_map_node_get_points); - - ClassDB::bind_method(D_METHOD("connect_node","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::connect_node); - ClassDB::bind_method(D_METHOD("is_node_connected","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::is_node_connected); - ClassDB::bind_method(D_METHOD("disconnect_node","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::disconnect_node); - ClassDB::bind_method(D_METHOD("get_node_connections","shader_type"),&ShaderGraph::_get_connections); - - ClassDB::bind_method(D_METHOD("clear","shader_type"),&ShaderGraph::clear); - - ClassDB::bind_method(D_METHOD("node_set_state","shader_type","id","state"),&ShaderGraph::node_set_state); - ClassDB::bind_method(D_METHOD("node_get_state","shader_type","id"),&ShaderGraph::node_get_state); - - ClassDB::bind_method(D_METHOD("_set_data"),&ShaderGraph::_set_data); - ClassDB::bind_method(D_METHOD("_get_data"),&ShaderGraph::_get_data); - - ADD_PROPERTY( PropertyInfo(Variant::DICTIONARY,"_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data","_get_data"); - - //void get_connections(ShaderType p_which,List<Connection> *p_connections) const; - - - BIND_ENUM_CONSTANT( NODE_INPUT ); // all inputs (shader type dependent) - BIND_ENUM_CONSTANT( NODE_SCALAR_CONST ); //scalar constant - BIND_ENUM_CONSTANT( NODE_VEC_CONST ); //vec3 constant - BIND_ENUM_CONSTANT( NODE_RGB_CONST ); //rgb constant (shows a color picker instead) - BIND_ENUM_CONSTANT( NODE_XFORM_CONST ); // 4x4 matrix constant - BIND_ENUM_CONSTANT( NODE_TIME ); // time in seconds - BIND_ENUM_CONSTANT( NODE_SCREEN_TEX ); // screen texture sampler (takes UV) (only usable in fragment shader) - BIND_ENUM_CONSTANT( NODE_SCALAR_OP ); // scalar vs scalar op (mul ); add ); div ); etc) - BIND_ENUM_CONSTANT( NODE_VEC_OP ); // vec3 vs vec3 op (mul );ad );div );crossprod );etc) - BIND_ENUM_CONSTANT( NODE_VEC_SCALAR_OP ); // vec3 vs scalar op (mul ); add ); div ); etc) - BIND_ENUM_CONSTANT( NODE_RGB_OP ); // vec3 vs vec3 rgb op (with scalar amount) ); like brighten ); darken ); burn ); dodge ); multiply ); etc. - BIND_ENUM_CONSTANT( NODE_XFORM_MULT ); // mat4 x mat4 - BIND_ENUM_CONSTANT( NODE_XFORM_VEC_MULT ); // mat4 x vec3 mult (with no-translation option) - BIND_ENUM_CONSTANT( NODE_XFORM_VEC_INV_MULT ); // mat4 x vec3 inverse mult (with no-translation option) - BIND_ENUM_CONSTANT( NODE_SCALAR_FUNC ); // scalar function (sin ); cos ); etc) - BIND_ENUM_CONSTANT( NODE_VEC_FUNC ); // vector function (normalize ); negate ); reciprocal ); rgb2hsv ); hsv2rgb ); etc ); etc) - BIND_ENUM_CONSTANT( NODE_VEC_LEN ); // vec3 length - BIND_ENUM_CONSTANT( NODE_DOT_PROD ); // vec3 . vec3 (dot product -> scalar output) - BIND_ENUM_CONSTANT( NODE_VEC_TO_SCALAR ); // 1 vec3 input ); 3 scalar outputs - BIND_ENUM_CONSTANT( NODE_SCALAR_TO_VEC ); // 3 scalar input ); 1 vec3 output - BIND_ENUM_CONSTANT( NODE_VEC_TO_XFORM ); // 3 vec input ); 1 xform output - BIND_ENUM_CONSTANT( NODE_XFORM_TO_VEC ); // 3 vec input ); 1 xform output - BIND_ENUM_CONSTANT( NODE_SCALAR_INTERP ); // scalar interpolation (with optional curve) - BIND_ENUM_CONSTANT( NODE_VEC_INTERP ); // vec3 interpolation (with optional curve) - BIND_ENUM_CONSTANT( NODE_COLOR_RAMP ); - BIND_ENUM_CONSTANT( NODE_CURVE_MAP ); - BIND_ENUM_CONSTANT( NODE_SCALAR_INPUT ); // scalar uniform (assignable in material) - BIND_ENUM_CONSTANT( NODE_VEC_INPUT ); // vec3 uniform (assignable in material) - BIND_ENUM_CONSTANT( NODE_RGB_INPUT ); // color uniform (assignable in material) - BIND_ENUM_CONSTANT( NODE_XFORM_INPUT ); // mat4 uniform (assignable in material) - BIND_ENUM_CONSTANT( NODE_TEXTURE_INPUT ); // texture input (assignable in material) - BIND_ENUM_CONSTANT( NODE_CUBEMAP_INPUT ); // cubemap input (assignable in material) - BIND_ENUM_CONSTANT( NODE_DEFAULT_TEXTURE ); - BIND_ENUM_CONSTANT( NODE_OUTPUT ); // output (shader type dependent) - BIND_ENUM_CONSTANT( NODE_COMMENT ); // comment - BIND_ENUM_CONSTANT( NODE_TYPE_MAX ); - - BIND_ENUM_CONSTANT( SLOT_TYPE_SCALAR ); - BIND_ENUM_CONSTANT( SLOT_TYPE_VEC ); - BIND_ENUM_CONSTANT( SLOT_TYPE_XFORM ); - BIND_ENUM_CONSTANT( SLOT_TYPE_TEXTURE ); - BIND_ENUM_CONSTANT( SLOT_MAX ); - - BIND_ENUM_CONSTANT( SHADER_TYPE_VERTEX ); - BIND_ENUM_CONSTANT( SHADER_TYPE_FRAGMENT ); - BIND_ENUM_CONSTANT( SHADER_TYPE_LIGHT ); - BIND_ENUM_CONSTANT( SHADER_TYPE_MAX ); - - - BIND_ENUM_CONSTANT( SLOT_IN ); - BIND_ENUM_CONSTANT( SLOT_OUT ); - - BIND_ENUM_CONSTANT( GRAPH_OK ); - BIND_ENUM_CONSTANT( GRAPH_ERROR_CYCLIC ); - BIND_ENUM_CONSTANT( GRAPH_ERROR_MISSING_CONNECTIONS ); - - BIND_ENUM_CONSTANT( SCALAR_OP_ADD ); - BIND_ENUM_CONSTANT( SCALAR_OP_SUB ); - BIND_ENUM_CONSTANT( SCALAR_OP_MUL ); - BIND_ENUM_CONSTANT( SCALAR_OP_DIV ); - BIND_ENUM_CONSTANT( SCALAR_OP_MOD ); - BIND_ENUM_CONSTANT( SCALAR_OP_POW ); - BIND_ENUM_CONSTANT( SCALAR_OP_MAX ); - BIND_ENUM_CONSTANT( SCALAR_OP_MIN ); - BIND_ENUM_CONSTANT( SCALAR_OP_ATAN2 ); - BIND_ENUM_CONSTANT( SCALAR_MAX_OP ); - - BIND_ENUM_CONSTANT( VEC_OP_ADD ); - BIND_ENUM_CONSTANT( VEC_OP_SUB ); - BIND_ENUM_CONSTANT( VEC_OP_MUL ); - BIND_ENUM_CONSTANT( VEC_OP_DIV ); - BIND_ENUM_CONSTANT( VEC_OP_MOD ); - BIND_ENUM_CONSTANT( VEC_OP_POW ); - BIND_ENUM_CONSTANT( VEC_OP_MAX ); - BIND_ENUM_CONSTANT( VEC_OP_MIN ); - BIND_ENUM_CONSTANT( VEC_OP_CROSS ); - BIND_ENUM_CONSTANT( VEC_MAX_OP ); - - BIND_ENUM_CONSTANT( VEC_SCALAR_OP_MUL ); - BIND_ENUM_CONSTANT( VEC_SCALAR_OP_DIV ); - BIND_ENUM_CONSTANT( VEC_SCALAR_OP_POW ); - BIND_ENUM_CONSTANT( VEC_SCALAR_MAX_OP ); - - BIND_ENUM_CONSTANT( RGB_OP_SCREEN ); - BIND_ENUM_CONSTANT( RGB_OP_DIFFERENCE ); - BIND_ENUM_CONSTANT( RGB_OP_DARKEN ); - BIND_ENUM_CONSTANT( RGB_OP_LIGHTEN ); - BIND_ENUM_CONSTANT( RGB_OP_OVERLAY ); - BIND_ENUM_CONSTANT( RGB_OP_DODGE ); - BIND_ENUM_CONSTANT( RGB_OP_BURN ); - BIND_ENUM_CONSTANT( RGB_OP_SOFT_LIGHT ); - BIND_ENUM_CONSTANT( RGB_OP_HARD_LIGHT ); - BIND_ENUM_CONSTANT( RGB_MAX_OP ); - - BIND_ENUM_CONSTANT( SCALAR_FUNC_SIN ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_COS ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_TAN ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_ASIN ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_ACOS ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_ATAN ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_SINH ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_COSH ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_TANH ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_LOG ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_EXP ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_SQRT ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_ABS ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_SIGN ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_FLOOR ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_ROUND ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_CEIL ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_FRAC ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_SATURATE ); - BIND_ENUM_CONSTANT( SCALAR_FUNC_NEGATE ); - BIND_ENUM_CONSTANT( SCALAR_MAX_FUNC ); - - BIND_ENUM_CONSTANT( VEC_FUNC_NORMALIZE ); - BIND_ENUM_CONSTANT( VEC_FUNC_SATURATE ); - BIND_ENUM_CONSTANT( VEC_FUNC_NEGATE ); - BIND_ENUM_CONSTANT( VEC_FUNC_RECIPROCAL ); - BIND_ENUM_CONSTANT( VEC_FUNC_RGB2HSV ); - BIND_ENUM_CONSTANT( VEC_FUNC_HSV2RGB ); - BIND_ENUM_CONSTANT( VEC_MAX_FUNC ); - - ADD_SIGNAL(MethodInfo("updated")); -} - - -String ShaderGraph::_find_unique_name(const String& p_base) { - - - - int idx=1; - while(true) { - String tocmp=p_base; - if (idx>1) { - tocmp+="_"+itos(idx); - } - bool valid=true; - for(int i=0;i<3;i++) { - if (!valid) - break; - for (Map<int,Node>::Element *E=shader[i].node_map.front();E;E=E->next()) { - if (E->get().type!=NODE_SCALAR_INPUT && E->get().type!=NODE_VEC_INPUT && E->get().type==NODE_RGB_INPUT && E->get().type==NODE_XFORM_INPUT && E->get().type==NODE_TEXTURE_INPUT && E->get().type==NODE_CUBEMAP_INPUT) - continue; - String name = E->get().param1; - if (name==tocmp) { - valid=false; - break; - } - - } - } - - if (!valid) { - idx++; - continue; - } - return tocmp; - } - return String(); -} - -void ShaderGraph::node_add(ShaderType p_type, NodeType p_node_type,int p_id) { - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(p_id==0); - ERR_FAIL_COND(p_node_type==NODE_OUTPUT); //can't create output - ERR_FAIL_COND( shader[p_type].node_map.has(p_id ) ); - ERR_FAIL_INDEX( p_node_type, NODE_TYPE_MAX ); - Node node; - - if (p_node_type==NODE_INPUT) { - //see if it already exists - for(Map<int,Node>::Element *E=shader[p_type].node_map.front();E;E=E->next()) { - if (E->get().type==NODE_INPUT) { - ERR_EXPLAIN("Only one input node can be added to the graph."); - ERR_FAIL_COND(E->get().type==NODE_INPUT); - } - } - } - node.type=p_node_type; - node.id=p_id; - - switch(p_node_type) { - case NODE_INPUT: {} break; // all inputs (shader type dependent) - case NODE_SCALAR_CONST: { node.param1=0;} break; //scalar constant - case NODE_VEC_CONST: {node.param1=Vector3();} break; //vec3 constant - case NODE_RGB_CONST: {node.param1=Color();} break; //rgb constant (shows a color picker instead) - case NODE_XFORM_CONST: {node.param1=Transform();} break; // 4x4 matrix constant - case NODE_TIME: {} break; // time in seconds - case NODE_SCREEN_TEX: {Array arr; arr.push_back(0); arr.push_back(0); node.param2=arr;} break; // screen texture sampler (takes UV) (only usable in fragment shader) - case NODE_SCALAR_OP: {node.param1=SCALAR_OP_ADD;} break; // scalar vs scalar op (mul: {} break; add: {} break; div: {} break; etc) - case NODE_VEC_OP: {node.param1=VEC_OP_ADD;} break; // vec3 vs vec3 op (mul: {} break;ad: {} break;div: {} break;crossprod: {} break;etc) - case NODE_VEC_SCALAR_OP: {node.param1=VEC_SCALAR_OP_MUL;} break; // vec3 vs scalar op (mul: {} break; add: {} break; div: {} break; etc) - case NODE_RGB_OP: {node.param1=RGB_OP_SCREEN;} break; // vec3 vs vec3 rgb op (with scalar amount): {} break; like brighten: {} break; darken: {} break; burn: {} break; dodge: {} break; multiply: {} break; etc. - case NODE_XFORM_MULT: {} break; // mat4 x mat4 - case NODE_XFORM_VEC_MULT: {} break; // mat4 x vec3 mult (with no-translation option) - case NODE_XFORM_VEC_INV_MULT: {} break; // mat4 x vec3 inverse mult (with no-translation option) - case NODE_SCALAR_FUNC: {node.param1=SCALAR_FUNC_SIN;} break; // scalar function (sin: {} break; cos: {} break; etc) - case NODE_VEC_FUNC: {node.param1=VEC_FUNC_NORMALIZE;} break; // vector function (normalize: {} break; negate: {} break; reciprocal: {} break; rgb2hsv: {} break; hsv2rgb: {} break; etc: {} break; etc) - case NODE_VEC_LEN: {} break; // vec3 length - case NODE_DOT_PROD: {} break; // vec3 . vec3 (dot product -> scalar output) - case NODE_VEC_TO_SCALAR: {} break; // 1 vec3 input: {} break; 3 scalar outputs - case NODE_SCALAR_TO_VEC: {} break; // 3 scalar input: {} break; 1 vec3 output - case NODE_VEC_TO_XFORM: {} break; // 3 scalar input: {} break; 1 vec3 output - case NODE_XFORM_TO_VEC: {} break; // 3 scalar input: {} break; 1 vec3 output - case NODE_SCALAR_INTERP: {} break; // scalar interpolation (with optional curve) - case NODE_VEC_INTERP: {} break; // vec3 interpolation (with optional curve) - case NODE_COLOR_RAMP: { node.param1=PoolVector<Color>(); node.param2=PoolVector<real_t>();} break; // vec3 interpolation (with optional curve) - case NODE_CURVE_MAP: { node.param1=PoolVector<Vector2>();} break; // vec3 interpolation (with optional curve) - case NODE_SCALAR_INPUT: {node.param1=_find_unique_name("Scalar"); node.param2=0;} break; // scalar uniform (assignable in material) - case NODE_VEC_INPUT: {node.param1=_find_unique_name("Vec3");node.param2=Vector3();} break; // vec3 uniform (assignable in material) - case NODE_RGB_INPUT: {node.param1=_find_unique_name("Color");node.param2=Color();} break; // color uniform (assignable in material) - case NODE_XFORM_INPUT: {node.param1=_find_unique_name("XForm"); node.param2=Transform();} break; // mat4 uniform (assignable in material) - case NODE_TEXTURE_INPUT: {node.param1=_find_unique_name("Tex"); } break; // texture input (assignable in material) - case NODE_CUBEMAP_INPUT: {node.param1=_find_unique_name("Cube"); } break; // cubemap input (assignable in material) - case NODE_DEFAULT_TEXTURE: {}; break; - case NODE_OUTPUT: {} break; // output (shader type dependent) - case NODE_COMMENT: {} break; // comment - case NODE_TYPE_MAX: {}; - } - - shader[p_type].node_map[p_id]=node; - _request_update(); -} - -void ShaderGraph::node_set_position(ShaderType p_type,int p_id, const Vector2& p_pos) { - ERR_FAIL_INDEX(p_type,3); - - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - shader[p_type].node_map[p_id].pos=p_pos; - _request_update(); - -} -Vector2 ShaderGraph::node_get_position(ShaderType p_type,int p_id) const { - ERR_FAIL_INDEX_V(p_type,3,Vector2()); - - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Vector2()); - return shader[p_type].node_map[p_id].pos; -} - - -void ShaderGraph::node_remove(ShaderType p_type,int p_id) { - - ERR_FAIL_COND(p_id==0); - ERR_FAIL_INDEX(p_type,3); - - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - - //erase connections associated with node - for(Map<int,Node>::Element *E=shader[p_type].node_map.front();E;E=E->next()) { - if (E->key()==p_id) - continue; //no self - - for (Map<int,SourceSlot>::Element *F=E->get().connections.front();F;) { - Map<int,SourceSlot>::Element *N=F->next(); - - if (F->get().id==p_id) { - E->get().connections.erase(F); - } - - F=N; - } - } - - shader[p_type].node_map.erase(p_id); - - _request_update(); - -} - - - -void ShaderGraph::get_node_list(ShaderType p_type,List<int> *p_node_list) const { - - ERR_FAIL_INDEX(p_type,3); - - Map<int,Node>::Element *E = shader[p_type].node_map.front(); - - while(E) { - - p_node_list->push_back(E->key()); - E=E->next(); - } -} - - -ShaderGraph::NodeType ShaderGraph::node_get_type(ShaderType p_type,int p_id) const { - - ERR_FAIL_INDEX_V(p_type,3,NODE_TYPE_MAX); - - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),NODE_TYPE_MAX); - return shader[p_type].node_map[p_id].type; -} - - -Error ShaderGraph::connect_node(ShaderType p_type,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) { - ERR_FAIL_INDEX_V(p_type,3,ERR_INVALID_PARAMETER); - - ERR_FAIL_COND_V(p_src_id==p_dst_id, ERR_INVALID_PARAMETER); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_src_id), ERR_INVALID_PARAMETER); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_dst_id), ERR_INVALID_PARAMETER); - NodeType type_src=shader[p_type].node_map[p_src_id].type; - NodeType type_dst=shader[p_type].node_map[p_dst_id].type; - ERR_FAIL_INDEX_V( p_src_slot, get_node_output_slot_count(get_mode(),p_type,type_src), ERR_INVALID_PARAMETER ); - ERR_FAIL_INDEX_V( p_dst_slot, get_node_input_slot_count(get_mode(),p_type,type_dst), ERR_INVALID_PARAMETER ); - ERR_FAIL_COND_V(get_node_output_slot_type(get_mode(),p_type,type_src,p_src_slot) != get_node_input_slot_type(get_mode(),p_type,type_dst,p_dst_slot), ERR_INVALID_PARAMETER ); - - - SourceSlot ts; - ts.id=p_src_id; - ts.slot=p_src_slot; - shader[p_type].node_map[p_dst_id].connections[p_dst_slot]=ts; - _request_update(); - - return OK; -} - -bool ShaderGraph::is_node_connected(ShaderType p_type,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) const { - - ERR_FAIL_INDEX_V(p_type,3,false); - - SourceSlot ts; - ts.id=p_src_id; - ts.slot=p_src_slot; - return shader[p_type].node_map.has(p_dst_id) && shader[p_type].node_map[p_dst_id].connections.has(p_dst_slot) && - shader[p_type].node_map[p_dst_id].connections[p_dst_slot]==ts; -} - -void ShaderGraph::disconnect_node(ShaderType p_type,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) { - ERR_FAIL_INDEX(p_type,3); - - SourceSlot ts; - ts.id=p_src_id; - ts.slot=p_src_slot; - if (shader[p_type].node_map.has(p_dst_id) && shader[p_type].node_map[p_dst_id].connections.has(p_dst_slot) && - shader[p_type].node_map[p_dst_id].connections[p_dst_slot]==ts) { - shader[p_type].node_map[p_dst_id].connections.erase(p_dst_slot); - - } - _request_update(); - -} - -void ShaderGraph::get_node_connections(ShaderType p_type,List<Connection> *p_connections) const { - - ERR_FAIL_INDEX(p_type,3); - - for(const Map<int,Node>::Element *E=shader[p_type].node_map.front();E;E=E->next()) { - for (const Map<int,SourceSlot>::Element *F=E->get().connections.front();F;F=F->next()) { - - Connection c; - c.dst_id=E->key(); - c.dst_slot=F->key(); - c.src_id=F->get().id; - c.src_slot=F->get().slot; - p_connections->push_back(c); - } - } -} - -bool ShaderGraph::is_slot_connected(ShaderGraph::ShaderType p_type, int p_dst_id, int slot_id) -{ - for(const Map<int,Node>::Element *E=shader[p_type].node_map.front();E;E=E->next()) { - for (const Map<int,SourceSlot>::Element *F=E->get().connections.front();F;F=F->next()) { - - if (p_dst_id == E->key() && slot_id==F->key()) - return true; - } - } - return false; -} - - -void ShaderGraph::clear(ShaderType p_type) { - - ERR_FAIL_INDEX(p_type,3); - shader[p_type].node_map.clear(); - Node out; - out.pos=Vector2(300,300); - out.type=NODE_OUTPUT; - shader[p_type].node_map.insert(0,out); - - _request_update(); - -} - - -void ShaderGraph::scalar_const_node_set_value(ShaderType p_type,int p_id,float p_value) { - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_SCALAR_CONST); - n.param1=p_value; - _request_update(); - -} - -float ShaderGraph::scalar_const_node_get_value(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,0); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),0); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_SCALAR_CONST,0); - return n.param1; -} - -void ShaderGraph::vec_const_node_set_value(ShaderType p_type,int p_id,const Vector3& p_value){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_VEC_CONST); - n.param1=p_value; - _request_update(); - - -} -Vector3 ShaderGraph::vec_const_node_get_value(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,Vector3()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Vector3()); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_VEC_CONST,Vector3()); - return n.param1; - -} - -void ShaderGraph::rgb_const_node_set_value(ShaderType p_type,int p_id,const Color& p_value){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_RGB_CONST); - n.param1=p_value; - _request_update(); - -} -Color ShaderGraph::rgb_const_node_get_value(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,Color()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Color()); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_RGB_CONST,Color()); - return n.param1; - -} - -void ShaderGraph::xform_const_node_set_value(ShaderType p_type,int p_id,const Transform& p_value){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_XFORM_CONST); - n.param1=p_value; - _request_update(); - -} -Transform ShaderGraph::xform_const_node_get_value(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,Transform()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Transform()); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_XFORM_CONST,Transform()); - return n.param1; - -} - -void ShaderGraph::texture_node_set_filter_size(ShaderType p_type,int p_id,int p_size){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_TEXTURE_INPUT && n.type!=NODE_SCREEN_TEX); - Array arr = n.param2; - arr[0]=p_size; - n.param2=arr; - _request_update(); - -} -int ShaderGraph::texture_node_get_filter_size(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,0); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),0); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_TEXTURE_INPUT && n.type!=NODE_SCREEN_TEX,0); - Array arr = n.param2; - return arr[0]; - -} - -void ShaderGraph::texture_node_set_filter_strength(ShaderType p_type,float p_id,float p_strength){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_TEXTURE_INPUT && n.type!=NODE_SCREEN_TEX); - Array arr = n.param2; - arr[1]=p_strength; - n.param2=arr; - _request_update(); - -} -float ShaderGraph::texture_node_get_filter_strength(ShaderType p_type,float p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,0); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),0); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_TEXTURE_INPUT && n.type!=NODE_SCREEN_TEX,0); - Array arr = n.param2; - return arr[1]; -} - -void ShaderGraph::duplicate_nodes(ShaderType p_which, List<int> &p_nodes) -{ - //Create new node IDs - Map<int,int> duplicates = Map<int,int>(); - int i=1; - for(List<int>::Element *E=p_nodes.front();E; E=E->next()) { - while (shader[p_which].node_map.has(i)) - i++; - duplicates.insert(E->get(), i); - i++; - } - - for(List<int>::Element *E = p_nodes.front();E; E=E->next()) { - - const Node &n=shader[p_which].node_map[E->get()]; - Node nn=n; - nn.id=duplicates.find(n.id)->get(); - nn.pos += Vector2(0,100); - for (Map<int,SourceSlot>::Element *C=nn.connections.front();C;C=C->next()) { - SourceSlot &c=C->get(); - if (p_nodes.find(c.id)) - c.id=duplicates.find(c.id)->get(); - } - shader[p_which].node_map[nn.id]=nn; - } - _request_update(); -} - -List<int> ShaderGraph::generate_ids(ShaderType p_type, int count) -{ - List<int> ids = List<int>(); - int i=1; - while (ids.size() < count) { - while (shader[p_type].node_map.has(i)) - i++; - ids.push_back(i); - i++; - } - return ids; -} - - -void ShaderGraph::scalar_op_node_set_op(ShaderType p_type,float p_id,ScalarOp p_op){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_SCALAR_OP); - n.param1=p_op; - _request_update(); - -} -ShaderGraph::ScalarOp ShaderGraph::scalar_op_node_get_op(ShaderType p_type,float p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,SCALAR_MAX_OP); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),SCALAR_MAX_OP); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_SCALAR_OP,SCALAR_MAX_OP); - int op = n.param1; - return ScalarOp(op); - -} - - -void ShaderGraph::vec_op_node_set_op(ShaderType p_type,float p_id,VecOp p_op){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_VEC_OP); - n.param1=p_op; - _request_update(); - -} -ShaderGraph::VecOp ShaderGraph::vec_op_node_get_op(ShaderType p_type,float p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,VEC_MAX_OP); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),VEC_MAX_OP); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_VEC_OP,VEC_MAX_OP); - int op = n.param1; - return VecOp(op); - -} - - -void ShaderGraph::vec_scalar_op_node_set_op(ShaderType p_type,float p_id,VecScalarOp p_op){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_VEC_SCALAR_OP); - n.param1=p_op; - _request_update(); - -} -ShaderGraph::VecScalarOp ShaderGraph::vec_scalar_op_node_get_op(ShaderType p_type,float p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,VEC_SCALAR_MAX_OP); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),VEC_SCALAR_MAX_OP); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_VEC_SCALAR_OP,VEC_SCALAR_MAX_OP); - int op = n.param1; - return VecScalarOp(op); - -} - -void ShaderGraph::rgb_op_node_set_op(ShaderType p_type,float p_id,RGBOp p_op){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_RGB_OP); - n.param1=p_op; - - _request_update(); - -} -ShaderGraph::RGBOp ShaderGraph::rgb_op_node_get_op(ShaderType p_type,float p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,RGB_MAX_OP); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),RGB_MAX_OP); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_RGB_OP,RGB_MAX_OP); - int op = n.param1; - return RGBOp(op); - -} - - -void ShaderGraph::xform_vec_mult_node_set_no_translation(ShaderType p_type,int p_id,bool p_no_translation){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_XFORM_VEC_MULT && n.type!=NODE_XFORM_VEC_INV_MULT); - n.param1=p_no_translation; - _request_update(); - -} -bool ShaderGraph::xform_vec_mult_node_get_no_translation(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,false); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),false); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_XFORM_VEC_MULT && n.type!=NODE_XFORM_VEC_INV_MULT,false); - return n.param1; - -} - -void ShaderGraph::scalar_func_node_set_function(ShaderType p_type,int p_id,ScalarFunc p_func){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_SCALAR_FUNC); - int func = p_func; - ERR_FAIL_INDEX(func,SCALAR_MAX_FUNC); - n.param1=func; - _request_update(); - -} -ShaderGraph::ScalarFunc ShaderGraph::scalar_func_node_get_function(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,SCALAR_MAX_FUNC); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),SCALAR_MAX_FUNC); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_SCALAR_FUNC,SCALAR_MAX_FUNC); - int func = n.param1; - return ScalarFunc(func); -} - -void ShaderGraph::default_set_value(ShaderGraph::ShaderType p_which, int p_id, int p_param, const Variant &p_value) -{ - ERR_FAIL_INDEX(p_which,3); - ERR_FAIL_COND(!shader[p_which].node_map.has(p_id)); - Node& n = shader[p_which].node_map[p_id]; - if(p_value.get_type()==Variant::NIL) - n.defaults.erase(n.defaults.find(p_param)); - else - n.defaults[p_param]=p_value; - - _request_update(); - -} - -Variant ShaderGraph::default_get_value(ShaderGraph::ShaderType p_which, int p_id, int p_param) -{ - ERR_FAIL_INDEX_V(p_which,3,Variant()); - ERR_FAIL_COND_V(!shader[p_which].node_map.has(p_id),Variant()); - const Node& n = shader[p_which].node_map[p_id]; - - if (!n.defaults.has(p_param)) - return Variant(); - return n.defaults[p_param]; -} - - - -void ShaderGraph::vec_func_node_set_function(ShaderType p_type,int p_id,VecFunc p_func){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_VEC_FUNC); - int func = p_func; - ERR_FAIL_INDEX(func,VEC_MAX_FUNC); - n.param1=func; - - _request_update(); - -} -ShaderGraph::VecFunc ShaderGraph::vec_func_node_get_function(ShaderType p_type, int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,VEC_MAX_FUNC); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),VEC_MAX_FUNC); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_VEC_FUNC,VEC_MAX_FUNC); - int func = n.param1; - return VecFunc(func); -} - -void ShaderGraph::color_ramp_node_set_ramp(ShaderType p_type,int p_id,const PoolVector<Color>& p_colors, const PoolVector<real_t>& p_offsets){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - ERR_FAIL_COND(p_colors.size()!=p_offsets.size()); - Node& n = shader[p_type].node_map[p_id]; - n.param1=p_colors; - n.param2=p_offsets; - _request_update(); - -} - -PoolVector<Color> ShaderGraph::color_ramp_node_get_colors(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,PoolVector<Color>()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),PoolVector<Color>()); - const Node& n = shader[p_type].node_map[p_id]; - return n.param1; - - -} - -PoolVector<real_t> ShaderGraph::color_ramp_node_get_offsets(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,PoolVector<real_t>()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),PoolVector<real_t>()); - const Node& n = shader[p_type].node_map[p_id]; - return n.param2; - -} - - -void ShaderGraph::curve_map_node_set_points(ShaderType p_type,int p_id,const PoolVector<Vector2>& p_points) { - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - n.param1=p_points; - _request_update(); - -} - -PoolVector<Vector2> ShaderGraph::curve_map_node_get_points(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,PoolVector<Vector2>()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),PoolVector<Vector2>()); - const Node& n = shader[p_type].node_map[p_id]; - return n.param1; - -} - - - -void ShaderGraph::input_node_set_name(ShaderType p_type,int p_id,const String& p_name){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - ERR_FAIL_COND(!p_name.is_valid_identifier()); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_SCALAR_INPUT && n.type!=NODE_VEC_INPUT && n.type==NODE_RGB_INPUT && n.type==NODE_XFORM_INPUT && n.type==NODE_TEXTURE_INPUT && n.type==NODE_CUBEMAP_INPUT); - - n.param1=""; - n.param1=_find_unique_name(p_name); - _request_update(); - -} -String ShaderGraph::input_node_get_name(ShaderType p_type,int p_id){ - - ERR_FAIL_INDEX_V(p_type,3,String()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),String()); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_SCALAR_INPUT && n.type!=NODE_VEC_INPUT && n.type==NODE_RGB_INPUT && n.type==NODE_XFORM_INPUT && n.type==NODE_TEXTURE_INPUT && n.type==NODE_CUBEMAP_INPUT,String()); - return n.param1; -} - - -void ShaderGraph::scalar_input_node_set_value(ShaderType p_type,int p_id,float p_value) { - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_SCALAR_INPUT); - n.param2=p_value; - _request_update(); - -} - -float ShaderGraph::scalar_input_node_get_value(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,0); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),0); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_SCALAR_INPUT,0); - - return n.param2; -} - -void ShaderGraph::vec_input_node_set_value(ShaderType p_type,int p_id,const Vector3& p_value){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_VEC_INPUT); - - n.param2=p_value; - _request_update(); - -} -Vector3 ShaderGraph::vec_input_node_get_value(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,Vector3()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Vector3()); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_VEC_INPUT,Vector3()); - return n.param2; -} - -void ShaderGraph::rgb_input_node_set_value(ShaderType p_type,int p_id,const Color& p_value){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_RGB_INPUT); - n.param2=p_value; - _request_update(); - -} -Color ShaderGraph::rgb_input_node_get_value(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,Color()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Color()); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_RGB_INPUT,Color()); - return n.param2; -} - -void ShaderGraph::xform_input_node_set_value(ShaderType p_type,int p_id,const Transform& p_value){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_XFORM_INPUT); - n.param2=p_value; - _request_update(); - -} -Transform ShaderGraph::xform_input_node_get_value(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,Transform()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Transform()); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_XFORM_INPUT,Transform()); - return n.param2; -} - - -void ShaderGraph::texture_input_node_set_value(ShaderType p_type,int p_id,const Ref<Texture>& p_texture) { - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_TEXTURE_INPUT); - n.param2=p_texture; - _request_update(); - -} - -Ref<Texture> ShaderGraph::texture_input_node_get_value(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,Ref<Texture>()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Ref<Texture>()); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_TEXTURE_INPUT,Ref<Texture>()); - return n.param2; -} - -void ShaderGraph::cubemap_input_node_set_value(ShaderType p_type,int p_id,const Ref<CubeMap>& p_cubemap){ - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_CUBEMAP_INPUT); - n.param2=p_cubemap; - _request_update(); - -} - -Ref<CubeMap> ShaderGraph::cubemap_input_node_get_value(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,Ref<CubeMap>()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Ref<CubeMap>()); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_CUBEMAP_INPUT,Ref<CubeMap>()); - return n.param2; - -} - - -void ShaderGraph::comment_node_set_text(ShaderType p_type,int p_id,const String& p_comment) { - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND(n.type!=NODE_COMMENT); - n.param1=p_comment; - -} - -String ShaderGraph::comment_node_get_text(ShaderType p_type,int p_id) const{ - - ERR_FAIL_INDEX_V(p_type,3,String()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),String()); - const Node& n = shader[p_type].node_map[p_id]; - ERR_FAIL_COND_V(n.type!=NODE_COMMENT,String()); - return n.param1; - -} - -void ShaderGraph::_request_update() { - - if (_pending_update_shader) - return; - - _pending_update_shader=true; - call_deferred("_update_shader"); - -} - -Variant ShaderGraph::node_get_state(ShaderType p_type,int p_id) const { - - ERR_FAIL_INDEX_V(p_type,3,Variant()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Variant()); - const Node& n = shader[p_type].node_map[p_id]; - Dictionary s; - s["position"]=n.pos; - s["param1"]=n.param1; - s["param2"]=n.param2; - Array keys; - for (Map<int,Variant>::Element *E=n.defaults.front();E;E=E->next()) { - keys.append(E->key()); - s[E->key()]=E->get(); - } - s["default_keys"]=keys; - return s; - -} -void ShaderGraph::node_set_state(ShaderType p_type,int p_id,const Variant& p_state) { - - ERR_FAIL_INDEX(p_type,3); - ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); - Node& n = shader[p_type].node_map[p_id]; - Dictionary d = p_state; - ERR_FAIL_COND(!d.has("position")); - ERR_FAIL_COND(!d.has("param1")); - ERR_FAIL_COND(!d.has("param2")); - ERR_FAIL_COND(!d.has("default_keys")); - - n.pos=d["position"]; - n.param1=d["param1"]; - n.param2=d["param2"]; - Array keys = d["default_keys"]; - for(int i=0;i<keys.size();i++) { - n.defaults[keys[i]]=d[keys[i]]; - } -} - -ShaderGraph::ShaderGraph(Mode p_mode) : Shader(p_mode) { - - //shader = VisualServer::get_singleton()->shader_create(); - _pending_update_shader=false; - - Node input; - input.id=1; - input.pos=Vector2(50,40); - input.type=NODE_INPUT; - - Node output; - output.id=0; - output.pos=Vector2(350,40); - output.type=NODE_OUTPUT; - - for(int i=0;i<3;i++) { - - shader[i].node_map.insert(0,output); - shader[i].node_map.insert(1,input); - } -} - -ShaderGraph::~ShaderGraph() { - - //VisualServer::get_singleton()->free(shader); -} - - -const ShaderGraph::InOutParamInfo ShaderGraph::inout_param_info[]={ - //material vertex in - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Vertex","SRC_VERTEX","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Normal","SRC_NORMAL","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Tangent","SRC_TANGENT","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"BinormalF","SRC_BINORMALF","",SLOT_TYPE_SCALAR,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Color","SRC_COLOR","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Alpha","SRC_ALPHA","",SLOT_TYPE_SCALAR,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"UV","SRC_UV","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"UV2","SRC_UV2","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"WorldMatrix","WORLD_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"InvCameraMatrix","INV_CAMERA_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"ProjectionMatrix","PROJECTION_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"ModelviewMatrix","MODELVIEW_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"InstanceID","INSTANCE_ID","",SLOT_TYPE_SCALAR,SLOT_IN}, - - //material vertex out - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Vertex","VERTEX","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Normal","NORMAL","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Tangent","TANGENT","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Binormal","BINORMAL","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"UV","UV",".xy",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"UV2","UV2",".xy",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Color","COLOR.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Alpha","COLOR.a","",SLOT_TYPE_SCALAR,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"SpecExp","SPEC_EXP","",SLOT_TYPE_SCALAR,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_VERTEX,"PointSize","POINT_SIZE","",SLOT_TYPE_SCALAR,SLOT_OUT}, - //pixel vertex in - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Vertex","VERTEX","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Position","POSITION.xyz","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Normal","IN_NORMAL","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Tangent","TANGENT","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Binormal","BINORMAL","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"UV","vec3(UV,0)","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"UV2","vec3(UV2,0)","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"UVScreen","vec3(SCREEN_UV,0)","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"PointCoord","POINT_COORD","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Color","COLOR.rgb","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Alpha","COLOR.a","",SLOT_TYPE_SCALAR,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"InvCameraMatrix","INV_CAMERA_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_IN}, - //pixel vertex out - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Diffuse","DIFFUSE_OUT","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"DiffuseAlpha","ALPHA_OUT","",SLOT_TYPE_SCALAR,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Specular","SPECULAR","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"SpecularExp","SPEC_EXP","",SLOT_TYPE_SCALAR,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Emission","EMISSION","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Glow","GLOW","",SLOT_TYPE_SCALAR,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"ShadeParam","SHADE_PARAM","",SLOT_TYPE_SCALAR,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Normal","NORMAL","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"NormalMap","NORMALMAP","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"NormalMapDepth","NORMALMAP_DEPTH","",SLOT_TYPE_SCALAR,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,"Discard","DISCARD",">0.5",SLOT_TYPE_SCALAR,SLOT_OUT}, - //light in - {MODE_MATERIAL,SHADER_TYPE_LIGHT,"Normal","NORMAL","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_LIGHT,"LightDir","LIGHT_DIR","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_LIGHT,"LightDiffuse","LIGHT_DIFFUSE","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_LIGHT,"LightSpecular","LIGHT_SPECULAR","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_LIGHT,"EyeVec","EYE_VEC","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_LIGHT,"Diffuse","DIFFUSE","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_LIGHT,"Specular","SPECULAR","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_LIGHT,"SpecExp","SPECULAR_EXP","",SLOT_TYPE_SCALAR,SLOT_IN}, - {MODE_MATERIAL,SHADER_TYPE_LIGHT,"ShadeParam","SHADE_PARAM","",SLOT_TYPE_SCALAR,SLOT_IN}, - //light out - {MODE_MATERIAL,SHADER_TYPE_LIGHT,"Light","LIGHT","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_MATERIAL,SHADER_TYPE_LIGHT,"Shadow", "SHADOW", "",SLOT_TYPE_VEC, SLOT_OUT }, - //canvas item vertex in - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Vertex","vec3(SRC_VERTEX,0)","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"UV","SRC_UV","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Color","SRC_COLOR.rgb","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Alpha","SRC_COLOR.a","",SLOT_TYPE_SCALAR,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"WorldMatrix","WORLD_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"ExtraMatrix","EXTRA_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"ProjectionMatrix","PROJECTION_MATRIX","",SLOT_TYPE_XFORM,SLOT_IN}, - //canvas item vertex out - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Vertex","VERTEX",".xy",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"UV","UV",".xy",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Color","COLOR.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Alpha","COLOR.a","",SLOT_TYPE_SCALAR,SLOT_OUT}, - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"PointSize","POINT_SIZE","",SLOT_TYPE_SCALAR,SLOT_OUT}, - //canvas item fragment in - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Color","SRC_COLOR.rgb","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Alpha","SRC_COLOR.a","",SLOT_TYPE_SCALAR,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"UV","vec3(UV,0)","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"UVScreen","vec3(SCREEN_UV,0)","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"TexPixelSize","vec3(TEXTURE_PIXEL_SIZE,0)","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"PointCoord","POINT_COORD","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Position","POSITION","",SLOT_TYPE_VEC,SLOT_IN}, - //canvas item fragment out - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Color","COLOR.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Alpha","COLOR.a","",SLOT_TYPE_SCALAR,SLOT_OUT}, - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Normal","NORMAL","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"NormalMap","NORMALMAP","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"NormalMapDepth","NORMALMAP_DEPTH","",SLOT_TYPE_SCALAR,SLOT_OUT}, - //canvas item light in - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Color","COLOR.rgb","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Alpha","COLOR.a","",SLOT_TYPE_SCALAR,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Normal","NORMAL","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"UV","vec3(UV,0)","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightColor","LIGHT_COLOR.rgb","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightAlpha","LIGHT_COLOR.a","",SLOT_TYPE_SCALAR,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightHeight","LIGHT_HEIGHT","",SLOT_TYPE_SCALAR,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowColor","LIGHT_SHADOW.rgb","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowAlpha","LIGHT_SHADOW.a","",SLOT_TYPE_SCALAR,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"TexPixelSize","vec3(TEXTURE_PIXEL_SIZE,0)","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"PointCoord","POINT_COORD","",SLOT_TYPE_VEC,SLOT_IN}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Position","POSITION","",SLOT_TYPE_VEC,SLOT_IN}, - //canvas item light out - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightColor","LIGHT.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightAlpha","LIGHT.a","",SLOT_TYPE_SCALAR,SLOT_OUT}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowColor","SHADOW.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, - {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowAlpha","SHADOW.a","",SLOT_TYPE_SCALAR,SLOT_OUT}, - //end - {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,NULL,NULL,NULL,SLOT_TYPE_SCALAR,SLOT_OUT}, - - - -}; - -void ShaderGraph::get_input_output_node_slot_info(Mode p_mode, ShaderType p_type, List<SlotInfo> *r_slots) { - - const InOutParamInfo* iop = &inout_param_info[0]; - while(iop->name) { - if (p_mode==iop->shader_mode && p_type==iop->shader_type) { - - SlotInfo si; - si.dir=iop->dir; - si.name=iop->name; - si.type=iop->slot_type; - r_slots->push_back(si); - } - iop++; - } -} - - -const ShaderGraph::NodeSlotInfo ShaderGraph::node_slot_info[]= { - - {NODE_SCALAR_CONST,{SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, //scalar constant - {NODE_VEC_CONST,{SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, //vec3 constant - {NODE_RGB_CONST,{SLOT_MAX},{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX}}, //rgb constant (shows a color picker instead) - {NODE_XFORM_CONST,{SLOT_MAX},{SLOT_TYPE_XFORM,SLOT_MAX}}, // 4x4 matrix constant - {NODE_TIME,{SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // time in seconds - {NODE_SCREEN_TEX,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // screen texture sampler (takes UV) (only usable in fragment shader) - {NODE_SCALAR_OP,{SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR,SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // scalar vs scalar op (mul,{SLOT_MAX},{SLOT_MAX}}, add,{SLOT_MAX},{SLOT_MAX}}, div,{SLOT_MAX},{SLOT_MAX}}, etc) - {NODE_VEC_OP,{SLOT_TYPE_VEC,SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // scalar vs scalar op (mul,{SLOT_MAX},{SLOT_MAX}}, add,{SLOT_MAX},{SLOT_MAX}}, div,{SLOT_MAX},{SLOT_MAX}}, etc) - {NODE_VEC_SCALAR_OP,{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // vec3 vs scalar op (mul,{SLOT_MAX},{SLOT_MAX}}, add,{SLOT_MAX},{SLOT_MAX}}, div,{SLOT_MAX},{SLOT_MAX}}, etc) - {NODE_RGB_OP,{SLOT_TYPE_VEC,SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // vec3 vs scalar op (mul,{SLOT_MAX},{SLOT_MAX}}, add,{SLOT_MAX},{SLOT_MAX}}, div,{SLOT_MAX},{SLOT_MAX}}, etc) - {NODE_XFORM_MULT,{SLOT_TYPE_XFORM,SLOT_TYPE_XFORM,SLOT_MAX},{SLOT_TYPE_XFORM,SLOT_MAX}}, // mat4 x mat4 - {NODE_XFORM_VEC_MULT,{SLOT_TYPE_XFORM,SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // mat4 x vec3 mult (with no-translation option) - {NODE_XFORM_VEC_INV_MULT,{SLOT_TYPE_VEC,SLOT_TYPE_XFORM,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // mat4 x vec3 inverse mult (with no-translation option) - {NODE_SCALAR_FUNC,{SLOT_TYPE_SCALAR,SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // scalar function (sin,{SLOT_MAX},{SLOT_MAX}}, cos,{SLOT_MAX},{SLOT_MAX}}, etc) - {NODE_VEC_FUNC,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // vector function (normalize,{SLOT_MAX},{SLOT_MAX}}, negate,{SLOT_MAX},{SLOT_MAX}}, reciprocal,{SLOT_MAX},{SLOT_MAX}}, rgb2hsv,{SLOT_MAX},{SLOT_MAX}}, hsv2rgb,{SLOT_MAX},{SLOT_MAX}}, etc,{SLOT_MAX},{SLOT_MAX}}, etc) - {NODE_VEC_LEN,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // vec3 length - {NODE_DOT_PROD,{SLOT_TYPE_VEC,SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // vec3 . vec3 (dot product -> scalar output) - {NODE_VEC_TO_SCALAR,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR}}, // 1 vec3 input,{SLOT_MAX},{SLOT_MAX}}, 3 scalar outputs - {NODE_SCALAR_TO_VEC,{SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR},{SLOT_TYPE_VEC,SLOT_MAX}}, // 3 scalar input,{SLOT_MAX},{SLOT_MAX}}, 1 vec3 output - {NODE_SCALAR_INTERP,{SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR,SLOT_TYPE_SCALAR},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // scalar interpolation (with optional curve) - {NODE_VEC_INTERP,{SLOT_TYPE_VEC,SLOT_TYPE_VEC,SLOT_TYPE_SCALAR},{SLOT_TYPE_VEC,SLOT_MAX}}, // vec3 interpolation (with optional curve) - {NODE_COLOR_RAMP,{SLOT_TYPE_SCALAR,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX}}, // vec3 interpolation (with optional curve) - {NODE_CURVE_MAP,{SLOT_TYPE_SCALAR,SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // vec3 interpolation (with optional curve) - {NODE_SCALAR_INPUT,{SLOT_MAX},{SLOT_TYPE_SCALAR,SLOT_MAX}}, // scalar uniform (assignable in material) - {NODE_VEC_INPUT,{SLOT_MAX},{SLOT_TYPE_VEC,SLOT_MAX}}, // vec3 uniform (assignable in material) - {NODE_RGB_INPUT,{SLOT_MAX},{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX}}, // color uniform (assignable in material) - {NODE_XFORM_INPUT,{SLOT_MAX},{SLOT_TYPE_XFORM,SLOT_MAX}}, // mat4 uniform (assignable in material) - {NODE_TEXTURE_INPUT,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX}}, // texture input (assignable in material) - {NODE_CUBEMAP_INPUT,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX}}, // cubemap input (assignable in material) - {NODE_DEFAULT_TEXTURE,{SLOT_TYPE_VEC,SLOT_MAX},{SLOT_TYPE_VEC,SLOT_TYPE_SCALAR,SLOT_MAX}}, // cubemap input (assignable in material) - {NODE_COMMENT,{SLOT_MAX},{SLOT_MAX}}, // comment - {NODE_TYPE_MAX,{SLOT_MAX},{SLOT_MAX}} -}; - -int ShaderGraph::get_node_input_slot_count(Mode p_mode, ShaderType p_shader_type,NodeType p_type) { - - if (p_type==NODE_INPUT || p_type==NODE_OUTPUT) { - - const InOutParamInfo* iop = &inout_param_info[0]; - int pc=0; - while(iop->name) { - if (p_mode==iop->shader_mode && p_shader_type==iop->shader_type) { - - if (iop->dir==SLOT_OUT) - pc++; - } - iop++; - } - return pc; - } else if (p_type==NODE_VEC_TO_XFORM){ - return 4; - } else if (p_type==NODE_XFORM_TO_VEC){ - return 1; - } else { - - const NodeSlotInfo*nsi=&node_slot_info[0]; - while(nsi->type!=NODE_TYPE_MAX) { - - if (nsi->type==p_type) { - int pc=0; - for(int i=0;i<NodeSlotInfo::MAX_INS;i++) { - if (nsi->ins[i]==SLOT_MAX) - break; - pc++; - } - return pc; - } - - nsi++; - } - - return 0; - - } -} - -int ShaderGraph::get_node_output_slot_count(Mode p_mode, ShaderType p_shader_type,NodeType p_type){ - - if (p_type==NODE_INPUT || p_type==NODE_OUTPUT) { - - const InOutParamInfo* iop = &inout_param_info[0]; - int pc=0; - while(iop->name) { - if (p_mode==iop->shader_mode && p_shader_type==iop->shader_type) { - - if (iop->dir==SLOT_IN) - pc++; - } - iop++; - } - return pc; - } else if (p_type==NODE_VEC_TO_XFORM){ - return 1; - } else if (p_type==NODE_XFORM_TO_VEC){ - return 4; - } else { - - const NodeSlotInfo*nsi=&node_slot_info[0]; - while(nsi->type!=NODE_TYPE_MAX) { - - if (nsi->type==p_type) { - int pc=0; - for(int i=0;i<NodeSlotInfo::MAX_OUTS;i++) { - if (nsi->outs[i]==SLOT_MAX) - break; - pc++; - } - return pc; - } - - nsi++; - } - - return 0; - - } -} -ShaderGraph::SlotType ShaderGraph::get_node_input_slot_type(Mode p_mode, ShaderType p_shader_type,NodeType p_type,int p_idx){ - - if (p_type==NODE_INPUT || p_type==NODE_OUTPUT) { - - const InOutParamInfo* iop = &inout_param_info[0]; - int pc=0; - while(iop->name) { - if (p_mode==iop->shader_mode && p_shader_type==iop->shader_type) { - - if (iop->dir==SLOT_OUT) { - if (pc==p_idx) - return iop->slot_type; - pc++; - } - } - iop++; - } - ERR_FAIL_V(SLOT_MAX); - } else if (p_type==NODE_VEC_TO_XFORM){ - return SLOT_TYPE_VEC; - } else if (p_type==NODE_XFORM_TO_VEC){ - return SLOT_TYPE_XFORM; - } else { - - const NodeSlotInfo*nsi=&node_slot_info[0]; - while(nsi->type!=NODE_TYPE_MAX) { - - if (nsi->type==p_type) { - for(int i=0;i<NodeSlotInfo::MAX_INS;i++) { - - if (nsi->ins[i]==SLOT_MAX) - break; - if (i==p_idx) - return nsi->ins[i]; - } - } - - nsi++; - } - - ERR_FAIL_V(SLOT_MAX); - - } -} -ShaderGraph::SlotType ShaderGraph::get_node_output_slot_type(Mode p_mode, ShaderType p_shader_type,NodeType p_type,int p_idx){ - - if (p_type==NODE_INPUT || p_type==NODE_OUTPUT) { - - const InOutParamInfo* iop = &inout_param_info[0]; - int pc=0; - while(iop->name) { - if (p_mode==iop->shader_mode && p_shader_type==iop->shader_type) { - - if (iop->dir==SLOT_IN) { - if (pc==p_idx) - return iop->slot_type; - pc++; - } - } - iop++; - } - ERR_FAIL_V(SLOT_MAX); - } else if (p_type==NODE_VEC_TO_XFORM){ - return SLOT_TYPE_XFORM; - } else if (p_type==NODE_XFORM_TO_VEC){ - return SLOT_TYPE_VEC; - } else { - - const NodeSlotInfo*nsi=&node_slot_info[0]; - while(nsi->type!=NODE_TYPE_MAX) { - - if (nsi->type==p_type) { - for(int i=0;i<NodeSlotInfo::MAX_OUTS;i++) { - if (nsi->outs[i]==SLOT_MAX) - break; - if (i==p_idx) - return nsi->outs[i]; - } - } - - nsi++; - } - - ERR_FAIL_V(SLOT_MAX); - } -} - - - - - -void ShaderGraph::_update_shader() { - - - String code[3]; - - List<StringName> names; - get_default_texture_param_list(&names); - - for (List<StringName>::Element *E=names.front();E;E=E->next()) { - - set_default_texture_param(E->get(),Ref<Texture>()); - } - - - for(int i=0;i<3;i++) { - - int idx=0; - for (Map<int,Node>::Element *E=shader[i].node_map.front();E;E=E->next()) { - - E->get().sort_order=idx++; - } - //simple method for graph solving using bubblesort derived algorithm - int iters=0; - int iter_max=shader[i].node_map.size()*shader[i].node_map.size(); - - while(true) { - if (iters>iter_max) - break; - - int swaps=0; - for (Map<int,Node>::Element *E=shader[i].node_map.front();E;E=E->next()) { - - for(Map<int,SourceSlot>::Element *F=E->get().connections.front();F;F=F->next()) { - - //this is kinda slow, could be sped up - Map<int,Node>::Element *G = shader[i].node_map.find(F->get().id); - ERR_FAIL_COND(!G); - if (G->get().sort_order > E->get().sort_order) { - - SWAP(G->get().sort_order,E->get().sort_order); - swaps++; - } - } - } - - iters++; - if (swaps==0) { - iters=0; - break; - } - } - - if (iters>0) { - - shader[i].error=GRAPH_ERROR_CYCLIC; - continue; - } - - Vector<Node*> order; - order.resize(shader[i].node_map.size()); - - for (Map<int,Node>::Element *E=shader[i].node_map.front();E;E=E->next()) { - - order[E->get().sort_order]=&E->get(); - } - - //generate code for the ordered graph - bool failed=false; - - if (i==SHADER_TYPE_FRAGMENT && get_mode()==MODE_MATERIAL) { - code[i]+="vec3 DIFFUSE_OUT=vec3(0,0,0);\n"; - code[i]+="float ALPHA_OUT=0;\n"; - } - - - Map<String,String> inputs_xlate; - Map<String,String> input_names_xlate; - Set<String> inputs_used; - - for(int j=0;j<order.size();j++) { - - Node *n=order[j]; - if (n->type==NODE_INPUT) { - - const InOutParamInfo* iop = &inout_param_info[0]; - int idx=0; - while(iop->name) { - if (get_mode()==iop->shader_mode && i==iop->shader_type && SLOT_IN==iop->dir) { - - const char *typestr[4]={"float","vec3","mat4","texture"}; - - String vname=("nd"+itos(n->id)+"sl"+itos(idx)); - inputs_xlate[vname]=String(typestr[iop->slot_type])+" "+vname+"="+iop->variable+";\n"; - input_names_xlate[vname]=iop->variable; - idx++; - } - iop++; - } - - } else if (n->type==NODE_OUTPUT) { - - - bool use_alpha=false; - const InOutParamInfo* iop = &inout_param_info[0]; - int idx=0; - while(iop->name) { - if (get_mode()==iop->shader_mode && i==iop->shader_type && SLOT_OUT==iop->dir) { - - if (n->connections.has(idx)) { - String iname=("nd"+itos(n->connections[idx].id)+"sl"+itos(n->connections[idx].slot)); - if (node_get_type(ShaderType(i),n->connections[idx].id)==NODE_INPUT) - inputs_used.insert(iname); - code[i]+=String(iop->variable)+"="+iname+String(iop->postfix)+";\n"; - if (i==SHADER_TYPE_FRAGMENT && get_mode()==MODE_MATERIAL && String(iop->name)=="DiffuseAlpha") - use_alpha=true; - } - idx++; - } - iop++; - } - - if (i==SHADER_TYPE_FRAGMENT && get_mode()==MODE_MATERIAL) { - - if (use_alpha) { - code[i]+="DIFFUSE_ALPHA=vec4(DIFFUSE_OUT,ALPHA_OUT);\n"; - } else { - code[i]+="DIFFUSE=DIFFUSE_OUT;\n"; - } - } - - } else { - Vector<String> inputs; - int max = get_node_input_slot_count(get_mode(),ShaderType(i),n->type); - for(int k=0;k<max;k++) { - String iname; - if (!n->connections.has(k)) { - iname="nd"+itos(n->id)+"sl"+itos(k)+"def"; - } else { - iname="nd"+itos(n->connections[k].id)+"sl"+itos(n->connections[k].slot); - if (node_get_type(ShaderType(i),n->connections[k].id)==NODE_INPUT) { - inputs_used.insert(iname); - } - - } - inputs.push_back(iname); - } - - if (failed) - break; - - if (n->type==NODE_TEXTURE_INPUT || n->type==NODE_CUBEMAP_INPUT) { - - set_default_texture_param(n->param1,n->param2); - - } - _add_node_code(ShaderType(i),n,inputs,code[i]); - } - - } - - if (failed) - continue; - - - for(Set<String>::Element *E=inputs_used.front();E;E=E->next()) { - - ERR_CONTINUE( !inputs_xlate.has(E->get())); - code[i]=inputs_xlate[E->get()]+code[i]; - String name=input_names_xlate[E->get()]; - - if (i==SHADER_TYPE_VERTEX && get_mode()==MODE_MATERIAL) { - if (name==("SRC_COLOR")) - code[i]="vec3 SRC_COLOR=COLOR.rgb;\n"+code[i]; - if (name==("SRC_ALPHA")) - code[i]="float SRC_ALPHA=COLOR.a;\n"+code[i]; - if (name==("SRC_UV")) - code[i]="vec3 SRC_UV=vec3(UV,0);\n"+code[i]; - if (name==("SRC_UV2")) - code[i]="float SRC_UV2=vec3(UV2,0);\n"+code[i]; - } else if (i==SHADER_TYPE_FRAGMENT && get_mode()==MODE_MATERIAL) { - if (name==("IN_NORMAL")) - code[i]="vec3 IN_NORMAL=NORMAL;\n"+code[i]; - } else if (i==SHADER_TYPE_VERTEX && get_mode()==MODE_CANVAS_ITEM) { - if (name==("SRC_COLOR")) - code[i]="vec3 SRC_COLOR=COLOR.rgb;\n"+code[i]; - if (name==("SRC_UV")) - code[i]="vec3 SRC_UV=vec3(UV,0);\n"+code[i]; - } - - } - - - - shader[i].error=GRAPH_OK; - - } - - bool all_ok=true; - for(int i=0;i<3;i++) { - if (shader[i].error!=GRAPH_OK) - all_ok=false; - } - - /*print_line("VERTEX: \n"+code[0]); - print_line("FRAGMENT: \n"+code[1]); - print_line("LIGHT: \n"+code[2]);*/ - - if (all_ok) { - set_code(code[0],code[1],code[2]); - } - //do shader here - - _pending_update_shader=false; - emit_signal(SceneStringNames::get_singleton()->updated); -} - -void ShaderGraph::_plot_curve(const Vector2& p_a,const Vector2& p_b,const Vector2& p_c,const Vector2& p_d,uint8_t* p_heights,bool *p_useds) { - - float geometry[4][4]; - float tmp1[4][4]; - float tmp2[4][4]; - float deltas[4][4]; - double x, dx, dx2, dx3; - double y, dy, dy2, dy3; - double d, d2, d3; - int lastx, lasty; - int newx, newy; - int ntimes; - int i,j; - - int xmax=255; - int ymax=255; - - /* construct the geometry matrix from the segment */ - for (i = 0; i < 4; i++) { - geometry[i][2] = 0; - geometry[i][3] = 0; - } - - geometry[0][0] = (p_a[0] * xmax); - geometry[1][0] = (p_b[0] * xmax); - geometry[2][0] = (p_c[0] * xmax); - geometry[3][0] = (p_d[0] * xmax); - - geometry[0][1] = (p_a[1] * ymax); - geometry[1][1] = (p_b[1] * ymax); - geometry[2][1] = (p_c[1] * ymax); - geometry[3][1] = (p_d[1] * ymax); - - /* subdivide the curve ntimes (1000) times */ - ntimes = 4 * xmax; - /* ntimes can be adjusted to give a finer or coarser curve */ - d = 1.0 / ntimes; - d2 = d * d; - d3 = d * d * d; - - /* construct a temporary matrix for determining the forward differencing deltas */ - tmp2[0][0] = 0; tmp2[0][1] = 0; tmp2[0][2] = 0; tmp2[0][3] = 1; - tmp2[1][0] = d3; tmp2[1][1] = d2; tmp2[1][2] = d; tmp2[1][3] = 0; - tmp2[2][0] = 6*d3; tmp2[2][1] = 2*d2; tmp2[2][2] = 0; tmp2[2][3] = 0; - tmp2[3][0] = 6*d3; tmp2[3][1] = 0; tmp2[3][2] = 0; tmp2[3][3] = 0; - - /* compose the basis and geometry matrices */ - - static const float CR_basis[4][4] = { - { -0.5, 1.5, -1.5, 0.5 }, - { 1.0, -2.5, 2.0, -0.5 }, - { -0.5, 0.0, 0.5, 0.0 }, - { 0.0, 1.0, 0.0, 0.0 }, - }; - - for (i = 0; i < 4; i++) - { - for (j = 0; j < 4; j++) - { - tmp1[i][j] = (CR_basis[i][0] * geometry[0][j] + - CR_basis[i][1] * geometry[1][j] + - CR_basis[i][2] * geometry[2][j] + - CR_basis[i][3] * geometry[3][j]); - } - } - /* compose the above results to get the deltas matrix */ - - for (i = 0; i < 4; i++) - { - for (j = 0; j < 4; j++) - { - deltas[i][j] = (tmp2[i][0] * tmp1[0][j] + - tmp2[i][1] * tmp1[1][j] + - tmp2[i][2] * tmp1[2][j] + - tmp2[i][3] * tmp1[3][j]); - } - } - - - /* extract the x deltas */ - x = deltas[0][0]; - dx = deltas[1][0]; - dx2 = deltas[2][0]; - dx3 = deltas[3][0]; - - /* extract the y deltas */ - y = deltas[0][1]; - dy = deltas[1][1]; - dy2 = deltas[2][1]; - dy3 = deltas[3][1]; - - - lastx = CLAMP (x, 0, xmax); - lasty = CLAMP (y, 0, ymax); - - p_heights[lastx] = lasty; - p_useds[lastx] = true; - - /* loop over the curve */ - for (i = 0; i < ntimes; i++) - { - /* increment the x values */ - x += dx; - dx += dx2; - dx2 += dx3; - - /* increment the y values */ - y += dy; - dy += dy2; - dy2 += dy3; - - newx = CLAMP ((Math::round (x)), 0, xmax); - newy = CLAMP ((Math::round (y)), 0, ymax); - - /* if this point is different than the last one...then draw it */ - if ((lastx != newx) || (lasty != newy)) - { - p_useds[newx]=true; - p_heights[newx]=newy; - } - - lastx = newx; - lasty = newy; - } -} - - -void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vector<String>& p_inputs,String& code) { - - - const char *typestr[4]={"float","vec3","mat4","texture"}; -#define OUTNAME(id, slot) (String(typestr[get_node_output_slot_type(get_mode(), p_type, p_node->type, slot)]) + " " + ("nd" + itos(id) + "sl" + itos(slot))) -#define OUTVAR(id, slot) ("nd" + itos(id) + "sl" + itos(slot)) -#define DEF_VEC(slot) \ - if (p_inputs[slot].ends_with("def")) { \ - Vector3 v = p_node->defaults[slot]; \ - code += String(typestr[1]) + " " + p_inputs[slot] + "=vec3(" + v + ");\n"; \ - } -#define DEF_SCALAR(slot) \ - if (p_inputs[slot].ends_with("def")) { \ - double v = p_node->defaults[slot]; \ - code += String(typestr[0]) + " " + p_inputs[slot] + "=" + rtos(v) + ";\n"; \ - } -#define DEF_COLOR(slot) \ - if (p_inputs[slot].ends_with("def")) { \ - Color col = p_node->defaults[slot]; \ - code += String(typestr[1]) + " " + p_inputs[slot] + "=vec3(" + rtos(col.r) + "," + rtos(col.g) + "," + rtos(col.b) + ");\n"; \ - } -#define DEF_MATRIX(slot) \ - if (p_inputs[slot].ends_with("def")) { \ - Transform xf = p_node->defaults[slot]; \ - code += String(typestr[2]) + " " + p_inputs[slot] + "=mat4(\n"; \ - code += "\tvec4(vec3(" + rtos(xf.basis.get_axis(0).x) + "," + rtos(xf.basis.get_axis(0).y) + "," + rtos(xf.basis.get_axis(0).z) + "),0),\n"; \ - code += "\tvec4(vec3(" + rtos(xf.basis.get_axis(1).x) + "," + rtos(xf.basis.get_axis(1).y) + "," + rtos(xf.basis.get_axis(1).z) + "),0),\n"; \ - code += "\tvec4(vec3(" + rtos(xf.basis.get_axis(2).x) + "," + rtos(xf.basis.get_axis(2).y) + "," + rtos(xf.basis.get_axis(2).z) + "),0),\n"; \ - code += "\tvec4(vec3(" + rtos(xf.origin.x) + "," + rtos(xf.origin.y) + "," + rtos(xf.origin.z) + "),1)\n"; \ - code += ");\n"; \ - } - - switch(p_node->type) { - - case NODE_INPUT: { - - - }break; - case NODE_SCALAR_CONST: { - - double scalar = p_node->param1; - code+=OUTNAME(p_node->id,0)+"="+rtos(scalar)+";\n"; - }break; - case NODE_VEC_CONST: { - Vector3 vec = p_node->param1; - code+=OUTNAME(p_node->id,0)+"=vec3("+rtos(vec.x)+","+rtos(vec.y)+","+rtos(vec.z)+");\n"; - }break; - case NODE_RGB_CONST: { - Color col = p_node->param1; - code+=OUTNAME(p_node->id,0)+"=vec3("+rtos(col.r)+","+rtos(col.g)+","+rtos(col.b)+");\n"; - code+=OUTNAME(p_node->id,1)+"="+rtos(col.a)+";\n"; - }break; - case NODE_XFORM_CONST: { - - Transform xf = p_node->param1; - code+=OUTNAME(p_node->id,0)+"=mat4(\n"; - code+="\tvec4(vec3("+rtos(xf.basis.get_axis(0).x)+","+rtos(xf.basis.get_axis(0).y)+","+rtos(xf.basis.get_axis(0).z)+"),0),\n"; - code+="\tvec4(vec3("+rtos(xf.basis.get_axis(1).x)+","+rtos(xf.basis.get_axis(1).y)+","+rtos(xf.basis.get_axis(1).z)+"),0),\n"; - code+="\tvec4(vec3("+rtos(xf.basis.get_axis(2).x)+","+rtos(xf.basis.get_axis(2).y)+","+rtos(xf.basis.get_axis(2).z)+"),0),\n"; - code+="\tvec4(vec3("+rtos(xf.origin.x)+","+rtos(xf.origin.y)+","+rtos(xf.origin.z)+"),1)\n"; - code+=");"; - - }break; - case NODE_TIME: { - code+=OUTNAME(p_node->id,0)+"=TIME;\n"; - }break; - case NODE_SCREEN_TEX: { - DEF_VEC(0); - code+=OUTNAME(p_node->id,0)+"=texscreen("+p_inputs[0]+".xy);\n"; - }break; - case NODE_SCALAR_OP: { - DEF_SCALAR(0); - DEF_SCALAR(1); - int op = p_node->param1; - String optxt; - switch(op) { - - case SCALAR_OP_ADD: optxt = p_inputs[0]+"+"+p_inputs[1]+";"; break; - case SCALAR_OP_SUB: optxt = p_inputs[0]+"-"+p_inputs[1]+";"; break; - case SCALAR_OP_MUL: optxt = p_inputs[0]+"*"+p_inputs[1]+";"; break; - case SCALAR_OP_DIV: optxt = p_inputs[0]+"/"+p_inputs[1]+";"; break; - case SCALAR_OP_MOD: optxt = "mod("+p_inputs[0]+","+p_inputs[1]+");"; break; - case SCALAR_OP_POW: optxt = "pow("+p_inputs[0]+","+p_inputs[1]+");"; break; - case SCALAR_OP_MAX: optxt = "max("+p_inputs[0]+","+p_inputs[1]+");"; break; - case SCALAR_OP_MIN: optxt = "min("+p_inputs[0]+","+p_inputs[1]+");"; break; - case SCALAR_OP_ATAN2: optxt = "atan2("+p_inputs[0]+","+p_inputs[1]+");"; break; - - } - code+=OUTNAME(p_node->id,0)+"="+optxt+"\n"; - - }break; - case NODE_VEC_OP: { - DEF_VEC(0); - DEF_VEC(1); - int op = p_node->param1; - String optxt; - switch(op) { - case VEC_OP_ADD: optxt = p_inputs[0]+"+"+p_inputs[1]+";"; break; - case VEC_OP_SUB: optxt = p_inputs[0]+"-"+p_inputs[1]+";"; break; - case VEC_OP_MUL: optxt = p_inputs[0]+"*"+p_inputs[1]+";"; break; - case VEC_OP_DIV: optxt = p_inputs[0]+"/"+p_inputs[1]+";"; break; - case VEC_OP_MOD: optxt = "mod("+p_inputs[0]+","+p_inputs[1]+");"; break; - case VEC_OP_POW: optxt = "pow("+p_inputs[0]+","+p_inputs[1]+");"; break; - case VEC_OP_MAX: optxt = "max("+p_inputs[0]+","+p_inputs[1]+");"; break; - case VEC_OP_MIN: optxt = "min("+p_inputs[0]+","+p_inputs[1]+");"; break; - case VEC_OP_CROSS: optxt = "cross("+p_inputs[0]+","+p_inputs[1]+");"; break; - } - code+=OUTNAME(p_node->id,0)+"="+optxt+"\n"; - - }break; - case NODE_VEC_SCALAR_OP: { - DEF_VEC(0); - DEF_SCALAR(1); - int op = p_node->param1; - String optxt; - switch(op) { - case VEC_SCALAR_OP_MUL: optxt = p_inputs[0]+"*"+p_inputs[1]+";"; break; - case VEC_SCALAR_OP_DIV: optxt = p_inputs[0]+"/"+p_inputs[1]+";"; break; - case VEC_SCALAR_OP_POW: optxt = "pow("+p_inputs[0]+","+p_inputs[1]+");"; break; - } - code+=OUTNAME(p_node->id,0)+"="+optxt+"\n"; - - }break; - case NODE_RGB_OP: { - DEF_COLOR(0); - DEF_COLOR(1); - - int op = p_node->param1; - static const char*axisn[3]={"x","y","z"}; - switch(op) { - case RGB_OP_SCREEN: { - - code += OUTNAME(p_node->id,0)+"=vec3(1.0)-(vec3(1.0)-"+p_inputs[0]+")*(vec3(1.0)-"+p_inputs[1]+");\n"; - } break; - case RGB_OP_DIFFERENCE: { - - code += OUTNAME(p_node->id,0)+"=abs("+p_inputs[0]+"-"+p_inputs[1]+");\n"; - } break; - case RGB_OP_DARKEN: { - - code += OUTNAME(p_node->id,0)+"=min("+p_inputs[0]+","+p_inputs[1]+");\n"; - } break; - case RGB_OP_LIGHTEN: { - - code += OUTNAME(p_node->id,0)+"=max("+p_inputs[0]+","+p_inputs[1]+");\n"; - - } break; - case RGB_OP_OVERLAY: { - - code += OUTNAME(p_node->id,0)+";\n"; - for(int i=0;i<3;i++) { - code += "{\n"; - code += "\tfloat base="+p_inputs[0]+"."+axisn[i]+";\n"; - code += "\tfloat blend="+p_inputs[1]+"."+axisn[i]+";\n"; - code += "\tif (base < 0.5) {\n"; - code += "\t\t"+OUTVAR(p_node->id,0)+"."+axisn[i]+" = 2.0 * base * blend;\n"; - code += "\t} else {\n"; - code += "\t\t"+OUTVAR(p_node->id,0)+"."+axisn[i]+" = 1.0 - 2.0 * (1.0 - blend) * (1.0 - base);\n"; - code += "\t}\n"; - code += "}\n"; - } - - } break; - case RGB_OP_DODGE: { - - code += OUTNAME(p_node->id,0)+"=("+p_inputs[0]+")/(vec3(1.0)-"+p_inputs[1]+");\n"; - - } break; - case RGB_OP_BURN: { - - code += OUTNAME(p_node->id,0)+"=vec3(1.0)-(vec3(1.0)-"+p_inputs[0]+")/("+p_inputs[1]+");\n"; - } break; - case RGB_OP_SOFT_LIGHT: { - - code += OUTNAME(p_node->id,0)+";\n"; - for(int i=0;i<3;i++) { - code += "{\n"; - code += "\tfloat base="+p_inputs[0]+"."+axisn[i]+";\n"; - code += "\tfloat blend="+p_inputs[1]+"."+axisn[i]+";\n"; - code += "\tif (base < 0.5) {\n"; - code += "\t\t"+OUTVAR(p_node->id,0)+"."+axisn[i]+" = (base * (blend+0.5));\n"; - code += "\t} else {\n"; - code += "\t\t"+OUTVAR(p_node->id,0)+"."+axisn[i]+" = (1 - (1-base) * (1-(blend-0.5)));\n"; - code += "\t}\n"; - code += "}\n"; - } - - } break; - case RGB_OP_HARD_LIGHT: { - - code += OUTNAME(p_node->id,0)+";\n"; - for(int i=0;i<3;i++) { - code += "{\n"; - code += "\tfloat base="+p_inputs[0]+"."+axisn[i]+";\n"; - code += "\tfloat blend="+p_inputs[1]+"."+axisn[i]+";\n"; - code += "\tif (base < 0.5) {\n"; - code += "\t\t"+OUTVAR(p_node->id,0)+"."+axisn[i]+" = (base * (2*blend));\n"; - code += "\t} else {\n"; - code += "\t\t"+OUTVAR(p_node->id,0)+"."+axisn[i]+" = (1 - (1-base) * (1-2*(blend-0.5)));\n"; - code += "\t}\n"; - code += "}\n"; - } - - } break; - } - }break; - case NODE_XFORM_MULT: { - DEF_MATRIX(0); - DEF_MATRIX(1); - - code += OUTNAME(p_node->id,0)+"="+p_inputs[0]+"*"+p_inputs[1]+";\n"; - - }break; - case NODE_XFORM_VEC_MULT: { - DEF_MATRIX(0); - DEF_VEC(1); - - bool no_translation = p_node->param1; - if (no_translation) { - code += OUTNAME(p_node->id,0)+"=("+p_inputs[0]+"*vec4("+p_inputs[1]+",0)).xyz;\n"; - } else { - code += OUTNAME(p_node->id,0)+"=("+p_inputs[0]+"*vec4("+p_inputs[1]+",1)).xyz;\n"; - } - - }break; - case NODE_XFORM_VEC_INV_MULT: { - DEF_VEC(0); - DEF_MATRIX(1); - bool no_translation = p_node->param1; - if (no_translation) { - code += OUTNAME(p_node->id,0)+"=("+p_inputs[1]+"*vec4("+p_inputs[0]+",0)).xyz;\n"; - } else { - code += OUTNAME(p_node->id,0)+"=("+p_inputs[1]+"*vec4("+p_inputs[0]+",1)).xyz;\n"; - } - }break; - case NODE_SCALAR_FUNC: { - DEF_SCALAR(0); - static const char*scalar_func_id[SCALAR_MAX_FUNC]={ - "sin($)", - "cos($)", - "tan($)", - "asin($)", - "acos($)", - "atan($)", - "sinh($)", - "cosh($)", - "tanh($)", - "log($)", - "exp($)", - "sqrt($)", - "abs($)", - "sign($)", - "floor($)", - "round($)", - "ceil($)", - "fract($)", - "min(max($,0),1)", - "-($)", - }; - - int func = p_node->param1; - ERR_FAIL_INDEX(func,SCALAR_MAX_FUNC); - code += OUTNAME(p_node->id,0)+"="+String(scalar_func_id[func]).replace("$",p_inputs[0])+";\n"; - - } break; - case NODE_VEC_FUNC: { - DEF_VEC(0); - static const char*vec_func_id[VEC_MAX_FUNC]={ - "normalize($)", - "max(min($,vec3(1,1,1)),vec3(0,0,0))", - "-($)", - "1.0/($)", - "", - "", - }; - - - int func = p_node->param1; - ERR_FAIL_INDEX(func,VEC_MAX_FUNC); - if (func==VEC_FUNC_RGB2HSV) { - code += OUTNAME(p_node->id,0)+";\n"; - code+="{\n"; - code+="\tvec3 c = "+p_inputs[0]+";\n"; - code+="\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n"; - code+="\tvec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n"; - code+="\tvec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n"; - code+="\tfloat d = q.x - min(q.w, q.y);\n"; - code+="\tfloat e = 1.0e-10;\n"; - code+="\t"+OUTVAR(p_node->id,0)+"=vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n"; - code+="}\n"; - } else if (func==VEC_FUNC_HSV2RGB) { - code += OUTNAME(p_node->id,0)+";\n"; - code+="{\n"; - code+="\tvec3 c = "+p_inputs[0]+";\n"; - code+="\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n"; - code+="\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n"; - code+="\t"+OUTVAR(p_node->id,0)+"=c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n"; - code+="}\n"; - - } else { - code += OUTNAME(p_node->id,0)+"="+String(vec_func_id[func]).replace("$",p_inputs[0])+";\n"; - } - }break; - case NODE_VEC_LEN: { - DEF_VEC(0); - - code += OUTNAME(p_node->id,0)+"=length("+p_inputs[0]+");\n"; - - }break; - case NODE_DOT_PROD: { - DEF_VEC(0); - DEF_VEC(1); - code += OUTNAME(p_node->id,0)+"=dot("+p_inputs[1]+","+p_inputs[0]+");\n"; - - }break; - case NODE_VEC_TO_SCALAR: { - DEF_VEC(0); - code += OUTNAME(p_node->id,0)+"="+p_inputs[0]+".x;\n"; - code += OUTNAME(p_node->id,1)+"="+p_inputs[0]+".y;\n"; - code += OUTNAME(p_node->id,2)+"="+p_inputs[0]+".z;\n"; - - }break; - case NODE_SCALAR_TO_VEC: { - DEF_SCALAR(0); - DEF_SCALAR(1); - DEF_SCALAR(2); - code += OUTNAME(p_node->id,0)+"=vec3("+p_inputs[0]+","+p_inputs[1]+","+p_inputs[2]+""+");\n"; - - }break; - case NODE_VEC_TO_XFORM: { - DEF_VEC(0); - DEF_VEC(1); - DEF_VEC(2); - DEF_VEC(3); - code += OUTNAME(p_node->id, 0) + "=mat4(" + - "vec4(" + p_inputs[0] + ".x," + p_inputs[0] + ".y," + p_inputs[0] + ".z, 0.0)," - "vec4(" + p_inputs[1] + ".x," + p_inputs[1] + ".y," + p_inputs[1] + ".z, 0.0)," - "vec4(" + p_inputs[2] + ".x," + p_inputs[2] + ".y," + p_inputs[2] + ".z, 0.0)," - "vec4(" + p_inputs[3] + ".x," + p_inputs[3] + ".y," + p_inputs[3] + ".z, 1.0));\n"; - - }break; - case NODE_XFORM_TO_VEC: { - DEF_MATRIX(0); - code += OUTNAME(p_node->id, 0) + ";\n"; - code += OUTNAME(p_node->id, 1) + ";\n"; - code += OUTNAME(p_node->id, 2) + ";\n"; - code += OUTNAME(p_node->id, 3) + ";\n"; - code += "{\n"; - code += "\tvec4 xform_row_01=" + p_inputs[0] + ".x;\n"; - code += "\tvec4 xform_row_02=" + p_inputs[0] + ".y;\n"; - code += "\tvec4 xform_row_03=" + p_inputs[0] + ".z;\n"; - code += "\tvec4 xform_row_04=" + p_inputs[0] + ".w;\n"; - code += "\t" + OUTVAR(p_node->id, 0) + "=vec3(xform_row_01.x, xform_row_01.y, xform_row_01.z);\n"; - code += "\t" + OUTVAR(p_node->id, 1) + "=vec3(xform_row_02.x, xform_row_02.y, xform_row_02.z);\n"; - code += "\t" + OUTVAR(p_node->id, 2) + "=vec3(xform_row_03.x, xform_row_03.y, xform_row_03.z);\n"; - code += "\t" + OUTVAR(p_node->id, 3) + "=vec3(xform_row_04.x, xform_row_04.y, xform_row_04.z);\n"; - code += "}\n"; - }break; - case NODE_SCALAR_INTERP: { - DEF_SCALAR(0); - DEF_SCALAR(1); - DEF_SCALAR(2); - - code += OUTNAME(p_node->id,0)+"=mix("+p_inputs[0]+","+p_inputs[1]+","+p_inputs[2]+");\n"; - - }break; - case NODE_VEC_INTERP: { - DEF_VEC(0); - DEF_VEC(1); - DEF_SCALAR(2); - code += OUTNAME(p_node->id,0)+"=mix("+p_inputs[0]+","+p_inputs[1]+","+p_inputs[2]+");\n"; - - }break; - case NODE_COLOR_RAMP: { - DEF_SCALAR(0); - - static const int color_ramp_len=512; - PoolVector<uint8_t> cramp; - cramp.resize(color_ramp_len*4); - { - - PoolVector<Color> colors=p_node->param1; - PoolVector<real_t> offsets=p_node->param2; - int cc =colors.size(); - PoolVector<uint8_t>::Write crw = cramp.write(); - PoolVector<Color>::Read cr = colors.read(); - PoolVector<real_t>::Read ofr = offsets.read(); - - int at=0; - Color color_at(0,0,0,1); - for(int i=0;i<=cc;i++) { - - int pos; - Color to; - if (i==cc) { - if (at==color_ramp_len) - break; - pos=color_ramp_len; - to=Color(1,1,1,1); - } else { - to=cr[i]; - pos= MIN(ofr[i]*color_ramp_len,color_ramp_len); - } - for(int j=at;j<pos;j++) { - float t = (j-at)/float(pos-at); - Color c = color_at.linear_interpolate(to,t); - crw[j*4+0]=Math::fast_ftoi( CLAMP(c.r*255.0,0,255) ); - crw[j*4+1]=Math::fast_ftoi( CLAMP(c.g*255.0,0,255) ); - crw[j*4+2]=Math::fast_ftoi( CLAMP(c.b*255.0,0,255) ); - crw[j*4+3]=Math::fast_ftoi( CLAMP(c.a*255.0,0,255) ); - } - - at=pos; - color_at=to; - } - } - - Image gradient(color_ramp_len,1,0,Image::FORMAT_RGBA8,cramp); - Ref<ImageTexture> it = memnew( ImageTexture ); - it->create_from_image(gradient,Texture::FLAG_FILTER|Texture::FLAG_MIPMAPS); - - String crampname= "cramp_"+itos(p_node->id); - set_default_texture_param(crampname,it); - - code +="uniform texture "+crampname+";\n"; - code +="vec4 "+crampname+"_r=tex("+crampname+",vec2("+p_inputs[0]+",0));\n"; - code += OUTNAME(p_node->id,0)+"="+crampname+"_r.rgb;\n"; - code += OUTNAME(p_node->id,1)+"="+crampname+"_r.a;\n"; - - }break; - case NODE_CURVE_MAP: { - DEF_SCALAR(0); - static const int curve_map_len=256; - bool mapped[256]; - zeromem(mapped,sizeof(mapped)); - PoolVector<uint8_t> cmap; - cmap.resize(curve_map_len); - { - - PoolVector<Point2> points=p_node->param1; - int pc =points.size(); - PoolVector<uint8_t>::Write cmw = cmap.write(); - PoolVector<Point2>::Read pr = points.read(); - - Vector2 prev=Vector2(0,0); - Vector2 prev2=Vector2(0,0); - - for(int i=-1;i<pc;i++) { - - Vector2 next; - Vector2 next2; - if (i+1>=pc) { - next=Vector2(1,1); - } else { - next=Vector2(pr[i+1].x,pr[i+1].y); - } - - if (i+2>=pc) { - next2=Vector2(1,1); - } else { - next2=Vector2(pr[i+2].x,pr[i+2].y); - } - - /*if (i==-1 && prev.offset==next.offset) { - prev=next; - continue; - }*/ - - _plot_curve(prev2,prev,next,next2,cmw.ptr(),mapped); - - prev2=prev; - prev=next; - } - - uint8_t pp=0; - for(int i=0;i<curve_map_len;i++) { - - if (!mapped[i]) { - cmw[i]=pp; - } else { - pp=cmw[i]; - } - } - } - - - - Image gradient(curve_map_len,1,0,Image::FORMAT_L8,cmap); - Ref<ImageTexture> it = memnew( ImageTexture ); - it->create_from_image(gradient,Texture::FLAG_FILTER|Texture::FLAG_MIPMAPS); - - String cmapname= "cmap_"+itos(p_node->id); - set_default_texture_param(cmapname,it); - - code +="uniform texture "+cmapname+";\n"; - code += OUTNAME(p_node->id,0)+"=tex("+cmapname+",vec2("+p_inputs[0]+",0)).r;\n"; - - }break; - case NODE_SCALAR_INPUT: { - String name = p_node->param1; - float dv=p_node->param2; - code +="uniform float "+name+"="+rtos(dv)+";\n"; - code += OUTNAME(p_node->id,0)+"="+name+";\n"; - }break; - case NODE_VEC_INPUT: { - - String name = p_node->param1; - Vector3 dv=p_node->param2; - code +="uniform vec3 "+name+"=vec3("+rtos(dv.x)+","+rtos(dv.y)+","+rtos(dv.z)+");\n"; - code += OUTNAME(p_node->id,0)+"="+name+";\n"; - }break; - case NODE_RGB_INPUT: { - - String name = p_node->param1; - Color dv= p_node->param2; - - code +="uniform color "+name+"=vec4("+rtos(dv.r)+","+rtos(dv.g)+","+rtos(dv.b)+","+rtos(dv.a)+");\n"; - code += OUTNAME(p_node->id,0)+"="+name+".rgb;\n"; - code += OUTNAME(p_node->id,1)+"="+name+".a;\n"; - - }break; - case NODE_XFORM_INPUT: { - - String name = p_node->param1; - Transform dv= p_node->param2; - - code +="uniform mat4 "+name+"=mat4(\n"; - code+="\tvec4(vec3("+rtos(dv.basis.get_axis(0).x)+","+rtos(dv.basis.get_axis(0).y)+","+rtos(dv.basis.get_axis(0).z)+"),0),\n"; - code+="\tvec4(vec3("+rtos(dv.basis.get_axis(1).x)+","+rtos(dv.basis.get_axis(1).y)+","+rtos(dv.basis.get_axis(1).z)+"),0),\n"; - code+="\tvec4(vec3("+rtos(dv.basis.get_axis(2).x)+","+rtos(dv.basis.get_axis(2).y)+","+rtos(dv.basis.get_axis(2).z)+"),0),\n"; - code+="\tvec4(vec3("+rtos(dv.origin.x)+","+rtos(dv.origin.y)+","+rtos(dv.origin.z)+"),1)\n"; - code+=");"; - - code += OUTNAME(p_node->id,0)+"="+name+";\n"; - - }break; - case NODE_TEXTURE_INPUT: { - DEF_VEC(0); - String name = p_node->param1; - String rname="rt_read_tex"+itos(p_node->id); - code +="uniform texture "+name+";"; - code +="vec4 "+rname+"=tex("+name+","+p_inputs[0]+".xy);\n"; - code += OUTNAME(p_node->id,0)+"="+rname+".rgb;\n"; - code += OUTNAME(p_node->id,1)+"="+rname+".a;\n"; - - }break; - case NODE_CUBEMAP_INPUT: { - DEF_VEC(0); - String name = p_node->param1; - code +="uniform cubemap "+name+";"; - String rname="rt_read_tex"+itos(p_node->id); - code +="vec4 "+rname+"=texcube("+name+","+p_inputs[0]+".xy);\n"; - code += OUTNAME(p_node->id,0)+"="+rname+".rgb;\n"; - code += OUTNAME(p_node->id,1)+"="+rname+".a;\n"; - }break; - case NODE_DEFAULT_TEXTURE: { - DEF_VEC(0); - - if (get_mode()==MODE_CANVAS_ITEM && p_type==SHADER_TYPE_FRAGMENT) { - - String rname="rt_default_tex"+itos(p_node->id); - code +="vec4 "+rname+"=tex(TEXTURE,"+p_inputs[0]+".xy);\n"; - code += OUTNAME(p_node->id,0)+"="+rname+".rgb;\n"; - code += OUTNAME(p_node->id,1)+"="+rname+".a;\n"; - - } else { - //not supported - code += OUTNAME(p_node->id,0)+"=vec3(0,0,0);\n"; - code += OUTNAME(p_node->id,1)+"=1.0;\n"; - - } - } break; - case NODE_OUTPUT: { - - - }break; - case NODE_COMMENT: { - - }break; - case NODE_TYPE_MAX: { - - } - } -#undef DEF_SCALAR -#undef DEF_COLOR -#undef DEF_MATRIX -#undef DEF_VEC -} - -#endif diff --git a/scene/resources/shader_graph.h b/scene/resources/shader_graph.h deleted file mode 100644 index e3a68f8572..0000000000 --- a/scene/resources/shader_graph.h +++ /dev/null @@ -1,446 +0,0 @@ -/*************************************************************************/ -/* shader_graph.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef SHADER_GRAPH_H -#define SHADER_GRAPH_H - -// FIXME: Needs to be ported to the new 3.0 shader API -#if 0 -#include "map.h" -#include "scene/resources/shader.h" - -class ShaderGraph : public Shader { - - GDCLASS( ShaderGraph, Shader ); - RES_BASE_EXTENSION("vshader"); - -public: - - enum NodeType { - NODE_INPUT, // all inputs (shader type dependent) - NODE_SCALAR_CONST, //scalar constant - NODE_VEC_CONST, //vec3 constant - NODE_RGB_CONST, //rgb constant (shows a color picker instead) - NODE_XFORM_CONST, // 4x4 matrix constant - NODE_TIME, // time in seconds - NODE_SCREEN_TEX, // screen texture sampler (takes UV) (only usable in fragment shader) - NODE_SCALAR_OP, // scalar vs scalar op (mul, add, div, etc) - NODE_VEC_OP, // vec3 vs vec3 op (mul,ad,div,crossprod,etc) - NODE_VEC_SCALAR_OP, // vec3 vs scalar op (mul, add, div, etc) - NODE_RGB_OP, // vec3 vs vec3 rgb op (with scalar amount), like brighten, darken, burn, dodge, multiply, etc. - NODE_XFORM_MULT, // mat4 x mat4 - NODE_XFORM_VEC_MULT, // mat4 x vec3 mult (with no-translation option) - NODE_XFORM_VEC_INV_MULT, // mat4 x vec3 inverse mult (with no-translation option) - NODE_SCALAR_FUNC, // scalar function (sin, cos, etc) - NODE_VEC_FUNC, // vector function (normalize, negate, reciprocal, rgb2hsv, hsv2rgb, etc, etc) - NODE_VEC_LEN, // vec3 length - NODE_DOT_PROD, // vec3 . vec3 (dot product -> scalar output) - NODE_VEC_TO_SCALAR, // 1 vec3 input, 3 scalar outputs - NODE_SCALAR_TO_VEC, // 3 scalar input, 1 vec3 output - NODE_XFORM_TO_VEC, // 3 vec input, 1 xform output - NODE_VEC_TO_XFORM, // 3 vec input, 1 xform output - NODE_SCALAR_INTERP, // scalar interpolation (with optional curve) - NODE_VEC_INTERP, // vec3 interpolation (with optional curve) - NODE_COLOR_RAMP, //take scalar, output vec3 - NODE_CURVE_MAP, //take scalar, otput scalar - NODE_SCALAR_INPUT, // scalar uniform (assignable in material) - NODE_VEC_INPUT, // vec3 uniform (assignable in material) - NODE_RGB_INPUT, // color uniform (assignable in material) - NODE_XFORM_INPUT, // mat4 uniform (assignable in material) - NODE_TEXTURE_INPUT, // texture input (assignable in material) - NODE_CUBEMAP_INPUT, // cubemap input (assignable in material) - NODE_DEFAULT_TEXTURE, - NODE_OUTPUT, // output (shader type dependent) - NODE_COMMENT, // comment - NODE_TYPE_MAX - }; - - - struct Connection { - - int src_id; - int src_slot; - int dst_id; - int dst_slot; - }; - - enum SlotType { - - SLOT_TYPE_SCALAR, - SLOT_TYPE_VEC, - SLOT_TYPE_XFORM, - SLOT_TYPE_TEXTURE, - SLOT_MAX - }; - - enum ShaderType { - SHADER_TYPE_VERTEX, - SHADER_TYPE_FRAGMENT, - SHADER_TYPE_LIGHT, - SHADER_TYPE_MAX - }; - - enum SlotDir { - SLOT_IN, - SLOT_OUT - }; - - enum GraphError { - GRAPH_OK, - GRAPH_ERROR_CYCLIC, - GRAPH_ERROR_MISSING_CONNECTIONS - }; - -private: - - String _find_unique_name(const String& p_base); - - enum {SLOT_DEFAULT_VALUE = 0x7FFFFFFF}; - struct SourceSlot { - - int id; - int slot; - bool operator==(const SourceSlot& p_slot) const { - return id==p_slot.id && slot==p_slot.slot; - } - }; - - struct Node { - - Vector2 pos; - NodeType type; - Variant param1; - Variant param2; - Map<int, Variant> defaults; - int id; - mutable int order; // used for sorting - int sort_order; - Map<int,SourceSlot> connections; - - }; - - struct ShaderData { - Map<int,Node> node_map; - GraphError error; - } shader[3]; - - - - struct InOutParamInfo { - Mode shader_mode; - ShaderType shader_type; - const char *name; - const char *variable; - const char *postfix; - SlotType slot_type; - SlotDir dir; - }; - - static const InOutParamInfo inout_param_info[]; - - struct NodeSlotInfo { - - enum { MAX_INS=3, MAX_OUTS=3 }; - NodeType type; - const SlotType ins[MAX_INS]; - const SlotType outs[MAX_OUTS]; - }; - - static const NodeSlotInfo node_slot_info[]; - - bool _pending_update_shader; - void _update_shader(); - void _request_update(); - - void _plot_curve(const Vector2& p_a,const Vector2& p_b,const Vector2& p_c,const Vector2& p_d,uint8_t* p_heights,bool *p_useds); - void _add_node_code(ShaderType p_type,Node *p_node,const Vector<String>& p_inputs,String& code); - - Array _get_node_list(ShaderType p_type) const; - Array _get_connections(ShaderType p_type) const; - - void _set_data(const Dictionary& p_data); - Dictionary _get_data() const; -protected: - - static void _bind_methods(); - -public: - - - void node_add(ShaderType p_type, NodeType p_node_type, int p_id); - void node_remove(ShaderType p_which,int p_id); - void node_set_position(ShaderType p_which,int p_id,const Point2& p_pos); - Point2 node_get_position(ShaderType p_which,int p_id) const; - - void get_node_list(ShaderType p_which,List<int> *p_node_list) const; - NodeType node_get_type(ShaderType p_which,int p_id) const; - - void scalar_const_node_set_value(ShaderType p_which,int p_id,float p_value); - float scalar_const_node_get_value(ShaderType p_which,int p_id) const; - - void vec_const_node_set_value(ShaderType p_which,int p_id,const Vector3& p_value); - Vector3 vec_const_node_get_value(ShaderType p_which,int p_id) const; - - void rgb_const_node_set_value(ShaderType p_which,int p_id,const Color& p_value); - Color rgb_const_node_get_value(ShaderType p_which,int p_id) const; - - void xform_const_node_set_value(ShaderType p_which,int p_id,const Transform& p_value); - Transform xform_const_node_get_value(ShaderType p_which,int p_id) const; - - void texture_node_set_filter_size(ShaderType p_which,int p_id,int p_size); - int texture_node_get_filter_size(ShaderType p_which,int p_id) const; - - void texture_node_set_filter_strength(ShaderType p_which,float p_id,float p_strength); - float texture_node_get_filter_strength(ShaderType p_which,float p_id) const; - - void duplicate_nodes(ShaderType p_which, List<int> &p_nodes); - - List<int> generate_ids(ShaderType p_type, int count); - - enum ScalarOp { - SCALAR_OP_ADD, - SCALAR_OP_SUB, - SCALAR_OP_MUL, - SCALAR_OP_DIV, - SCALAR_OP_MOD, - SCALAR_OP_POW, - SCALAR_OP_MAX, - SCALAR_OP_MIN, - SCALAR_OP_ATAN2, - SCALAR_MAX_OP - }; - - void scalar_op_node_set_op(ShaderType p_which,float p_id,ScalarOp p_op); - ScalarOp scalar_op_node_get_op(ShaderType p_which,float p_id) const; - - enum VecOp { - VEC_OP_ADD, - VEC_OP_SUB, - VEC_OP_MUL, - VEC_OP_DIV, - VEC_OP_MOD, - VEC_OP_POW, - VEC_OP_MAX, - VEC_OP_MIN, - VEC_OP_CROSS, - VEC_MAX_OP - }; - - void vec_op_node_set_op(ShaderType p_which,float p_id,VecOp p_op); - VecOp vec_op_node_get_op(ShaderType p_which,float p_id) const; - - enum VecScalarOp { - VEC_SCALAR_OP_MUL, - VEC_SCALAR_OP_DIV, - VEC_SCALAR_OP_POW, - VEC_SCALAR_MAX_OP - }; - - void vec_scalar_op_node_set_op(ShaderType p_which,float p_id,VecScalarOp p_op); - VecScalarOp vec_scalar_op_node_get_op(ShaderType p_which,float p_id) const; - - enum RGBOp { - RGB_OP_SCREEN, - RGB_OP_DIFFERENCE, - RGB_OP_DARKEN, - RGB_OP_LIGHTEN, - RGB_OP_OVERLAY, - RGB_OP_DODGE, - RGB_OP_BURN, - RGB_OP_SOFT_LIGHT, - RGB_OP_HARD_LIGHT, - RGB_MAX_OP - }; - - void rgb_op_node_set_op(ShaderType p_which,float p_id,RGBOp p_op); - RGBOp rgb_op_node_get_op(ShaderType p_which,float p_id) const; - - void xform_vec_mult_node_set_no_translation(ShaderType p_which,int p_id,bool p_no_translation); - bool xform_vec_mult_node_get_no_translation(ShaderType p_which,int p_id) const; - - enum ScalarFunc { - SCALAR_FUNC_SIN, - SCALAR_FUNC_COS, - SCALAR_FUNC_TAN, - SCALAR_FUNC_ASIN, - SCALAR_FUNC_ACOS, - SCALAR_FUNC_ATAN, - SCALAR_FUNC_SINH, - SCALAR_FUNC_COSH, - SCALAR_FUNC_TANH, - SCALAR_FUNC_LOG, - SCALAR_FUNC_EXP, - SCALAR_FUNC_SQRT, - SCALAR_FUNC_ABS, - SCALAR_FUNC_SIGN, - SCALAR_FUNC_FLOOR, - SCALAR_FUNC_ROUND, - SCALAR_FUNC_CEIL, - SCALAR_FUNC_FRAC, - SCALAR_FUNC_SATURATE, - SCALAR_FUNC_NEGATE, - SCALAR_MAX_FUNC - }; - - void scalar_func_node_set_function(ShaderType p_which,int p_id,ScalarFunc p_func); - ScalarFunc scalar_func_node_get_function(ShaderType p_which,int p_id) const; - - enum VecFunc { - VEC_FUNC_NORMALIZE, - VEC_FUNC_SATURATE, - VEC_FUNC_NEGATE, - VEC_FUNC_RECIPROCAL, - VEC_FUNC_RGB2HSV, - VEC_FUNC_HSV2RGB, - VEC_MAX_FUNC - }; - - void default_set_value(ShaderType p_which,int p_id,int p_param, const Variant& p_value); - Variant default_get_value(ShaderType p_which,int p_id,int p_param); - - void vec_func_node_set_function(ShaderType p_which,int p_id,VecFunc p_func); - VecFunc vec_func_node_get_function(ShaderType p_which,int p_id) const; - - void color_ramp_node_set_ramp(ShaderType p_which,int p_id,const PoolVector<Color>& p_colors, const PoolVector<real_t>& p_offsets); - PoolVector<Color> color_ramp_node_get_colors(ShaderType p_which,int p_id) const; - PoolVector<real_t> color_ramp_node_get_offsets(ShaderType p_which,int p_id) const; - - void curve_map_node_set_points(ShaderType p_which, int p_id, const PoolVector<Vector2>& p_points); - PoolVector<Vector2> curve_map_node_get_points(ShaderType p_which,int p_id) const; - - void input_node_set_name(ShaderType p_which,int p_id,const String& p_name); - String input_node_get_name(ShaderType p_which,int p_id); - - void scalar_input_node_set_value(ShaderType p_which,int p_id,float p_value); - float scalar_input_node_get_value(ShaderType p_which,int p_id) const; - - void vec_input_node_set_value(ShaderType p_which,int p_id,const Vector3& p_value); - Vector3 vec_input_node_get_value(ShaderType p_which,int p_id) const; - - void rgb_input_node_set_value(ShaderType p_which,int p_id,const Color& p_value); - Color rgb_input_node_get_value(ShaderType p_which,int p_id) const; - - void xform_input_node_set_value(ShaderType p_which,int p_id,const Transform& p_value); - Transform xform_input_node_get_value(ShaderType p_which,int p_id) const; - - void texture_input_node_set_value(ShaderType p_which,int p_id,const Ref<Texture>& p_texture); - Ref<Texture> texture_input_node_get_value(ShaderType p_which,int p_id) const; - - void cubemap_input_node_set_value(ShaderType p_which,int p_id,const Ref<CubeMap>& p_cubemap); - Ref<CubeMap> cubemap_input_node_get_value(ShaderType p_which,int p_id) const; - - void comment_node_set_text(ShaderType p_which,int p_id,const String& p_comment); - String comment_node_get_text(ShaderType p_which,int p_id) const; - - Error connect_node(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot); - bool is_node_connected(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot) const; - void disconnect_node(ShaderType p_which,int p_src_id,int p_src_slot, int p_dst_id,int p_dst_slot); - - void get_node_connections(ShaderType p_which,List<Connection> *p_connections) const; - - bool is_slot_connected(ShaderType p_which,int p_dst_id,int slot_id); - - void clear(ShaderType p_which); - - Variant node_get_state(ShaderType p_type, int p_node) const; - void node_set_state(ShaderType p_type, int p_id, const Variant& p_state); - - GraphError get_graph_error(ShaderType p_type) const; - - int node_count(ShaderType p_which, int p_type); - - static int get_type_input_count(NodeType p_type); - static int get_type_output_count(NodeType p_type); - static SlotType get_type_input_type(NodeType p_type,int p_idx); - static SlotType get_type_output_type(NodeType p_type,int p_idx); - static bool is_type_valid(Mode p_mode,ShaderType p_type); - - - struct SlotInfo { - String name; - SlotType type; - SlotDir dir; - }; - - static void get_input_output_node_slot_info(Mode p_mode, ShaderType p_type, List<SlotInfo> *r_slots); - - static int get_node_input_slot_count(Mode p_mode, ShaderType p_shader_type,NodeType p_type); - static int get_node_output_slot_count(Mode p_mode, ShaderType p_shader_type,NodeType p_type); - static SlotType get_node_input_slot_type(Mode p_mode, ShaderType p_shader_type,NodeType p_type,int p_idx); - static SlotType get_node_output_slot_type(Mode p_mode, ShaderType p_shader_type,NodeType p_type,int p_idx); - - - ShaderGraph(Mode p_mode); - ~ShaderGraph(); -}; - -//helper functions - - - - -VARIANT_ENUM_CAST( ShaderGraph::NodeType ); -VARIANT_ENUM_CAST( ShaderGraph::ShaderType ); -VARIANT_ENUM_CAST( ShaderGraph::SlotType ); -VARIANT_ENUM_CAST( ShaderGraph::ScalarOp ); -VARIANT_ENUM_CAST( ShaderGraph::VecOp ); -VARIANT_ENUM_CAST( ShaderGraph::VecScalarOp ); -VARIANT_ENUM_CAST( ShaderGraph::RGBOp ); -VARIANT_ENUM_CAST( ShaderGraph::ScalarFunc ); -VARIANT_ENUM_CAST( ShaderGraph::VecFunc ); -VARIANT_ENUM_CAST( ShaderGraph::GraphError ); - - -class MaterialShaderGraph : public ShaderGraph { - - GDCLASS( MaterialShaderGraph, ShaderGraph ); - -public: - - - MaterialShaderGraph() : ShaderGraph(MODE_MATERIAL) { - - } -}; - -class CanvasItemShaderGraph : public ShaderGraph { - - GDCLASS( CanvasItemShaderGraph, ShaderGraph ); - -public: - - - CanvasItemShaderGraph() : ShaderGraph(MODE_CANVAS_ITEM) { - - } -}; - -#endif -#endif // SHADER_GRAPH_H diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index ec489e5c5b..81fabf40fe 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -755,15 +755,11 @@ void SurfaceTool::append_from(const Ref<Mesh> &p_existing, int p_surface, const for (List<int>::Element *E = nindices.front(); E; E = E->next()) { int dst_index = E->get() + vfrom; - /* - if (dst_index <0 || dst_index>=vertex_array.size()) { - print_line("invalid index!"); - } - */ index_array.push_back(dst_index); } - if (index_array.size() % 3) - print_line("IA not div of 3?"); + if (index_array.size() % 3) { + WARN_PRINT("SurfaceTool: Index array not a multiple of 3."); + } } //mikktspace callbacks diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index d8efbeba17..811e5c3d2c 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "texture.h" +#include "bit_mask.h" #include "core/method_bind_ext.gen.inc" #include "core/os/os.h" #include "core_string_names.h" @@ -39,6 +40,9 @@ Size2 Texture::get_size() const { return Size2(get_width(), get_height()); } +bool Texture::is_pixel_opaque(int p_x, int p_y) const { + return true; +} void Texture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture> &p_normal_map) const { RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); @@ -234,6 +238,7 @@ void ImageTexture::set_data(const Ref<Image> &p_image) { VisualServer::get_singleton()->texture_set_data(texture, p_image); _change_notify(); + alpha_cache.unref(); } void ImageTexture::_resource_path_changed() { @@ -288,6 +293,41 @@ void ImageTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, cons VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, texture, p_src_rect, p_modulate, p_transpose, normal_rid, p_clip_uv); } +bool ImageTexture::is_pixel_opaque(int p_x, int p_y) const { + + if (!alpha_cache.is_valid()) { + Ref<Image> img = get_data(); + if (img.is_valid()) { + if (img->is_compressed()) { //must decompress, if compressed + Ref<Image> decom = img->duplicate(); + decom->decompress(); + img = decom; + } + alpha_cache.instance(); + alpha_cache->create_from_image_alpha(img); + } + } + + if (alpha_cache.is_valid()) { + + int aw = int(alpha_cache->get_size().width); + int ah = int(alpha_cache->get_size().height); + if (aw == 0 || ah == 0) { + return true; + } + + int x = p_x * aw / w; + int y = p_y * ah / h; + + x = CLAMP(x, 0, aw); + y = CLAMP(y, 0, aw); + + return alpha_cache->get_bit(Point2(x, y)); + } + + return true; +} + void ImageTexture::set_size_override(const Size2 &p_size) { Size2 s = p_size; @@ -421,6 +461,8 @@ Image::Format StreamTexture::get_format() const { Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &flags, Ref<Image> &image, int p_size_limit) { + alpha_cache.unref(); + ERR_FAIL_COND_V(image.is_null(), ERR_INVALID_PARAMETER); FileAccess *f = FileAccess::open(p_path, FileAccess::READ); @@ -438,7 +480,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla flags = f->get_32(); //texture flags! uint32_t df = f->get_32(); //data format -/* + /* print_line("width: " + itos(tw)); print_line("height: " + itos(th)); print_line("flags: " + itos(flags)); @@ -709,6 +751,40 @@ Ref<Image> StreamTexture::get_data() const { return VS::get_singleton()->texture_get_data(texture); } +bool StreamTexture::is_pixel_opaque(int p_x, int p_y) const { + + if (!alpha_cache.is_valid()) { + Ref<Image> img = get_data(); + if (img.is_valid()) { + if (img->is_compressed()) { //must decompress, if compressed + Ref<Image> decom = img->duplicate(); + decom->decompress(); + img = decom; + } + alpha_cache.instance(); + alpha_cache->create_from_image_alpha(img); + } + } + + if (alpha_cache.is_valid()) { + + int aw = int(alpha_cache->get_size().width); + int ah = int(alpha_cache->get_size().height); + if (aw == 0 || ah == 0) { + return true; + } + + int x = p_x * aw / w; + int y = p_y * ah / h; + + x = CLAMP(x, 0, aw); + y = CLAMP(y, 0, aw); + + return alpha_cache->get_bit(Point2(x, y)); + } + + return true; +} void StreamTexture::set_flags(uint32_t p_flags) { flags = p_flags; VS::get_singleton()->texture_set_flags(texture, flags); @@ -946,30 +1022,12 @@ void AtlasTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile void AtlasTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture> &p_normal_map, bool p_clip_uv) const { //this might not necessarily work well if using a rect, needs to be fixed properly - Rect2 rc = region; - if (!atlas.is_valid()) return; - Rect2 src = p_src_rect; - src.position += (rc.position - margin.position); - Rect2 src_c = rc.clip(src); - if (src_c.size == Size2()) - return; - Vector2 ofs = (src_c.position - src.position); - - Vector2 scale = p_rect.size / p_src_rect.size; - if (scale.x < 0) { - float mx = (margin.size.width - margin.position.x); - mx -= margin.position.x; - ofs.x = -(ofs.x + mx); - } - if (scale.y < 0) { - float my = margin.size.height - margin.position.y; - my -= margin.position.y; - ofs.y = -(ofs.y + my); - } - Rect2 dr(p_rect.position + ofs * scale, src_c.size * scale); + Rect2 dr; + Rect2 src_c; + get_rect_region(p_rect, p_src_rect, dr, src_c); RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); VS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), src_c, p_modulate, p_transpose, normal_rid, filter_clip); @@ -983,13 +1041,17 @@ bool AtlasTexture::get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, return false; Rect2 src = p_src_rect; + if (src.size == Size2()) { + src.size = rc.size; + } + Vector2 scale = p_rect.size / src.size; + src.position += (rc.position - margin.position); Rect2 src_c = rc.clip(src); if (src_c.size == Size2()) return false; Vector2 ofs = (src_c.position - src.position); - Vector2 scale = p_rect.size / p_src_rect.size; if (scale.x < 0) { float mx = (margin.size.width - margin.position.x); mx -= margin.position.x; @@ -1007,6 +1069,15 @@ bool AtlasTexture::get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, return true; } +bool AtlasTexture::is_pixel_opaque(int p_x, int p_y) const { + + if (atlas.is_valid()) { + return atlas->is_pixel_opaque(p_x + region.position.x + margin.position.x, p_x + region.position.y + margin.position.y); + } + + return true; +} + AtlasTexture::AtlasTexture() { filter_clip = false; } @@ -1184,6 +1255,23 @@ void LargeTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, cons } } +bool LargeTexture::is_pixel_opaque(int p_x, int p_y) const { + + for (int i = 0; i < pieces.size(); i++) { + + // TODO + if (!pieces[i].texture.is_valid()) + continue; + + Rect2 rect(pieces[i].offset, pieces[i].texture->get_size()); + if (rect.has_point(Point2(p_x, p_y))) { + return pieces[i].texture->is_pixel_opaque(p_x - rect.position.x, p_y - rect.position.y); + } + } + + return true; +} + LargeTexture::LargeTexture() { } @@ -1666,7 +1754,7 @@ ProxyTexture::~ProxyTexture() { void AnimatedTexture::_update_proxy() { - _THREAD_SAFE_METHOD_ + RWLockRead r(rw_lock); float delta; if (prev_ticks == 0) { @@ -1712,7 +1800,7 @@ void AnimatedTexture::_update_proxy() { void AnimatedTexture::set_frames(int p_frames) { ERR_FAIL_COND(p_frames < 1 || p_frames > MAX_FRAMES); - _THREAD_SAFE_METHOD_ + RWLockWrite r(rw_lock); frame_count = p_frames; } @@ -1723,14 +1811,14 @@ int AnimatedTexture::get_frames() const { void AnimatedTexture::set_frame_texture(int p_frame, const Ref<Texture> &p_texture) { ERR_FAIL_INDEX(p_frame, MAX_FRAMES); - _THREAD_SAFE_METHOD_ + RWLockWrite w(rw_lock); frames[p_frame].texture = p_texture; } Ref<Texture> AnimatedTexture::get_frame_texture(int p_frame) const { ERR_FAIL_INDEX_V(p_frame, MAX_FRAMES, Ref<Texture>()); - _THREAD_SAFE_METHOD_ + RWLockRead r(rw_lock); return frames[p_frame].texture; } @@ -1738,14 +1826,14 @@ Ref<Texture> AnimatedTexture::get_frame_texture(int p_frame) const { void AnimatedTexture::set_frame_delay(int p_frame, float p_delay_sec) { ERR_FAIL_INDEX(p_frame, MAX_FRAMES); - _THREAD_SAFE_METHOD_ + RWLockRead r(rw_lock); frames[p_frame].delay_sec = p_delay_sec; } float AnimatedTexture::get_frame_delay(int p_frame) const { ERR_FAIL_INDEX_V(p_frame, MAX_FRAMES, 0); - _THREAD_SAFE_METHOD_ + RWLockRead r(rw_lock); return frames[p_frame].delay_sec; } @@ -1760,8 +1848,7 @@ float AnimatedTexture::get_fps() const { } int AnimatedTexture::get_width() const { - - _THREAD_SAFE_METHOD_ + RWLockRead r(rw_lock); if (!frames[current_frame].texture.is_valid()) { return 1; @@ -1770,8 +1857,7 @@ int AnimatedTexture::get_width() const { return frames[current_frame].texture->get_width(); } int AnimatedTexture::get_height() const { - - _THREAD_SAFE_METHOD_ + RWLockRead r(rw_lock); if (!frames[current_frame].texture.is_valid()) { return 1; @@ -1785,7 +1871,7 @@ RID AnimatedTexture::get_rid() const { bool AnimatedTexture::has_alpha() const { - _THREAD_SAFE_METHOD_ + RWLockRead r(rw_lock); if (!frames[current_frame].texture.is_valid()) { return false; @@ -1796,7 +1882,7 @@ bool AnimatedTexture::has_alpha() const { Ref<Image> AnimatedTexture::get_data() const { - _THREAD_SAFE_METHOD_ + RWLockRead r(rw_lock); if (!frames[current_frame].texture.is_valid()) { return Ref<Image>(); @@ -1805,11 +1891,21 @@ Ref<Image> AnimatedTexture::get_data() const { return frames[current_frame].texture->get_data(); } +bool AnimatedTexture::is_pixel_opaque(int p_x, int p_y) const { + + RWLockRead r(rw_lock); + + if (frames[current_frame].texture.is_valid()) { + return frames[current_frame].texture->is_pixel_opaque(p_x, p_y); + } + return true; +} + void AnimatedTexture::set_flags(uint32_t p_flags) { } uint32_t AnimatedTexture::get_flags() const { - _THREAD_SAFE_METHOD_ + RWLockRead r(rw_lock); if (!frames[current_frame].texture.is_valid()) { return 0; @@ -1862,10 +1958,19 @@ AnimatedTexture::AnimatedTexture() { prev_ticks = 0; current_frame = 0; VisualServer::get_singleton()->connect("frame_pre_draw", this, "_update_proxy"); + +#ifndef NO_THREADS + rw_lock = RWLock::create(); +#else + rw_lock = NULL; +#endif } AnimatedTexture::~AnimatedTexture() { VS::get_singleton()->free(proxy); + if (rw_lock) { + memdelete(rw_lock); + } } /////////////////////////////// diff --git a/scene/resources/texture.h b/scene/resources/texture.h index c1331fb3fe..79e6d2cdf9 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -34,6 +34,7 @@ #include "curve.h" #include "io/resource_loader.h" #include "os/mutex.h" +#include "os/rw_lock.h" #include "os/thread_safe.h" #include "rect2.h" #include "resource.h" @@ -67,6 +68,8 @@ public: virtual Size2 get_size() const; virtual RID get_rid() const = 0; + virtual bool is_pixel_opaque(int p_x, int p_y) const; + virtual bool has_alpha() const = 0; virtual void set_flags(uint32_t p_flags) = 0; @@ -84,6 +87,8 @@ public: VARIANT_ENUM_CAST(Texture::Flags); +class BitMap; + class ImageTexture : public Texture { GDCLASS(ImageTexture, Texture); @@ -104,6 +109,7 @@ private: Storage storage; Size2 size_override; float lossy_storage_quality; + mutable Ref<BitMap> alpha_cache; protected: virtual void reload_from_file(); @@ -143,6 +149,8 @@ public: void set_storage(Storage p_storage); Storage get_storage() const; + bool is_pixel_opaque(int p_x, int p_y) const; + void set_lossy_storage_quality(float p_lossy_storage_quality); float get_lossy_storage_quality() const; @@ -183,6 +191,7 @@ private: Image::Format format; uint32_t flags; int w, h; + mutable Ref<BitMap> alpha_cache; virtual void reload_from_file(); @@ -215,6 +224,7 @@ public: virtual bool has_alpha() const; virtual void set_flags(uint32_t p_flags); + bool is_pixel_opaque(int p_x, int p_y) const; virtual Ref<Image> get_data() const; @@ -272,6 +282,8 @@ public: virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture> &p_normal_map = Ref<Texture>(), bool p_clip_uv = true) const; virtual bool get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const; + bool is_pixel_opaque(int p_x, int p_y) const; + AtlasTexture(); }; @@ -319,6 +331,8 @@ public: virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture> &p_normal_map = Ref<Texture>()) const; virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture> &p_normal_map = Ref<Texture>(), bool p_clip_uv = true) const; + bool is_pixel_opaque(int p_x, int p_y) const; + LargeTexture(); }; @@ -609,7 +623,8 @@ public: class AnimatedTexture : public Texture { GDCLASS(AnimatedTexture, Texture) - _THREAD_SAFE_CLASS_ + //use readers writers lock for this, since its far more times read than written to + RWLock *rw_lock; private: enum { @@ -668,6 +683,8 @@ public: virtual Ref<Image> get_data() const; + bool is_pixel_opaque(int p_x, int p_y) const; + AnimatedTexture(); ~AnimatedTexture(); }; diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index d8fc3677fb..dac12205b6 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -431,7 +431,6 @@ String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port global_code += "\n\n"; String final_code = global_code; final_code += code; - //print_line(final_code); return final_code; } @@ -914,7 +913,6 @@ void VisualShader::_update_shader() const { String final_code = global_code; final_code += code; const_cast<VisualShader *>(this)->set_code(final_code); - //print_line(final_code); for (int i = 0; i < default_tex_params.size(); i++) { const_cast<VisualShader *>(this)->set_default_texture_param(default_tex_params[i].name, default_tex_params[i].param); } diff --git a/servers/arvr_server.cpp b/servers/arvr_server.cpp index 0d1aad0dff..2040377dd4 100644 --- a/servers/arvr_server.cpp +++ b/servers/arvr_server.cpp @@ -178,7 +178,7 @@ void ARVRServer::remove_interface(const Ref<ARVRInterface> &p_interface) { ERR_FAIL_COND(idx == -1); - print_line("Removed interface" + p_interface->get_name()); + print_verbose("ARVR: Removed interface" + p_interface->get_name()); emit_signal("interface_removed", p_interface->get_name()); interfaces.remove(idx); @@ -320,12 +320,12 @@ Ref<ARVRInterface> ARVRServer::get_primary_interface() const { void ARVRServer::set_primary_interface(const Ref<ARVRInterface> &p_primary_interface) { primary_interface = p_primary_interface; - print_line("Primary interface set to: " + primary_interface->get_name()); + print_verbose("ARVR: Primary interface set to: " + primary_interface->get_name()); }; void ARVRServer::clear_primary_interface_if(const Ref<ARVRInterface> &p_primary_interface) { if (primary_interface == p_primary_interface) { - print_line("Clearing primary interface"); + print_verbose("ARVR: Clearing primary interface"); primary_interface.unref(); }; }; diff --git a/servers/physics/collision_solver_sat.cpp b/servers/physics/collision_solver_sat.cpp index b059c20c95..294b1df241 100644 --- a/servers/physics/collision_solver_sat.cpp +++ b/servers/physics/collision_solver_sat.cpp @@ -44,12 +44,6 @@ struct _CollectorCallback { _FORCE_INLINE_ void call(const Vector3 &p_point_A, const Vector3 &p_point_B) { - /* - if (normal.dot(p_point_A) >= normal.dot(p_point_B)) - return; - print_line("** A: "+p_point_A+" B: "+p_point_B+" D: "+rtos(p_point_A.distance_to(p_point_B))); - */ - if (swap) callback(p_point_B, p_point_A, userdata); else @@ -410,26 +404,13 @@ public: supports_B[i] += best_axis * margin_B; } } - /* - print_line("best depth: "+rtos(best_depth)); - print_line("best axis: "+(best_axis)); - for(int i=0;i<support_count_A;i++) { - print_line("A-"+itos(i)+": "+supports_A[i]); - } - for(int i=0;i<support_count_B;i++) { - - print_line("B-"+itos(i)+": "+supports_B[i]); - } -*/ callback->normal = best_axis; if (callback->prev_axis) *callback->prev_axis = best_axis; _generate_contacts_from_supports(supports_A, support_count_A, supports_B, support_count_B, callback); callback->collided = true; - //CollisionSolverSW::CallbackResult cbk=NULL; - //cbk(Vector3(),Vector3(),NULL); } _FORCE_INLINE_ SeparatorAxisTest(const ShapeA *p_shape_A, const Transform &p_transform_A, const ShapeB *p_shape_B, const Transform &p_transform_B, _CollectorCallback *p_callback, real_t p_margin_A = 0, real_t p_margin_B = 0) { @@ -445,9 +426,6 @@ public: }; /****** SAT TESTS *******/ -/****** SAT TESTS *******/ -/****** SAT TESTS *******/ -/****** SAT TESTS *******/ typedef void (*CollisionFunc)(const ShapeSW *, const Transform &, const ShapeSW *, const Transform &, _CollectorCallback *p_callback, real_t, real_t); diff --git a/servers/physics/collision_solver_sw.cpp b/servers/physics/collision_solver_sw.cpp index 0037b9a862..2f2f6d2908 100644 --- a/servers/physics/collision_solver_sw.cpp +++ b/servers/physics/collision_solver_sw.cpp @@ -176,7 +176,6 @@ bool CollisionSolverSW::solve_concave(const ShapeSW *p_shape_A, const Transform } concave_B->cull(local_aabb, concave_callback, &cinfo); - //print_line("COL AABB TESTS: "+itos(cinfo.aabb_tests)); return cinfo.collided; } @@ -364,13 +363,10 @@ bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A, const Transform concave_B->cull(local_aabb, concave_distance_callback, &cinfo); if (!cinfo.collided) { - //print_line(itos(cinfo.tested)); r_point_A = cinfo.close_A; r_point_B = cinfo.close_B; } - //print_line("DIST AABB TESTS: "+itos(cinfo.aabb_tests)); - return !cinfo.collided; } else { diff --git a/servers/physics/joints/hinge_joint_sw.cpp b/servers/physics/joints/hinge_joint_sw.cpp index d660eba879..368a349632 100644 --- a/servers/physics/joints/hinge_joint_sw.cpp +++ b/servers/physics/joints/hinge_joint_sw.cpp @@ -224,18 +224,12 @@ bool HingeJointSW::setup(real_t p_step) { // Compute limit information real_t hingeAngle = get_hinge_angle(); - //print_line("angle: "+rtos(hingeAngle)); //set bias, sign, clear accumulator m_correction = real_t(0.); m_limitSign = real_t(0.); m_solveLimit = false; m_accLimitImpulse = real_t(0.); - /*if (m_useLimit) { - print_line("low: "+rtos(m_lowerLimit)); - print_line("hi: "+rtos(m_upperLimit)); - }*/ - //if (m_lowerLimit < m_upperLimit) if (m_useLimit && m_lowerLimit <= m_upperLimit) { //if (hingeAngle <= m_lowerLimit*m_limitSoftness) diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp index cae2e6fb00..b2ab7bec16 100644 --- a/servers/physics/space_sw.cpp +++ b/servers/physics/space_sw.cpp @@ -231,11 +231,6 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform aabb = aabb.merge(AABB(aabb.position + p_motion, aabb.size)); //motion aabb = aabb.grow(p_margin); - /* - if (p_motion!=Vector3()) - print_line(p_motion); - */ - int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results); real_t best_safe = 1; @@ -267,7 +262,6 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform Transform col_obj_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx); //test initial overlap, does it collide if going all the way? if (CollisionSolverSW::solve_distance(&mshape, p_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, aabb, &sep_axis)) { - //print_line("failed motion cast (no collision)"); continue; } @@ -275,7 +269,6 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform sep_axis = p_motion.normalized(); if (!CollisionSolverSW::solve_distance(shape, p_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, aabb, &sep_axis)) { - //print_line("failed motion cast (no collision)"); return false; } @@ -298,7 +291,6 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform if (collided) { - //print_line(itos(i)+": "+rtos(ofs)); hi = ofs; } else { @@ -376,9 +368,6 @@ bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_sh continue; } - //print_line("AGAINST: "+itos(col_obj->get_self().get_id())+":"+itos(shape_idx)); - //print_line("THE ABBB: "+(col_obj->get_transform() * col_obj->get_shape_transform(shape_idx)).xform(col_obj->get_shape(shape_idx)->get_aabb())); - if (CollisionSolverSW::solve_static(shape, p_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, NULL, p_margin)) { collided = true; } @@ -832,13 +821,11 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve Transform col_obj_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx); //test initial overlap, does it collide if going all the way? if (CollisionSolverSW::solve_distance(&mshape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, motion_aabb, &sep_axis)) { - //print_line("failed motion cast (no collision)"); continue; } sep_axis = p_motion.normalized(); if (!CollisionSolverSW::solve_distance(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, motion_aabb, &sep_axis)) { - //print_line("failed motion cast (no collision)"); stuck = true; break; } @@ -862,7 +849,6 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve if (collided) { - //print_line(itos(i)+": "+rtos(ofs)); hi = ofs; } else { diff --git a/servers/physics/step_sw.cpp b/servers/physics/step_sw.cpp index ad08cb6353..4128e1ec1a 100644 --- a/servers/physics/step_sw.cpp +++ b/servers/physics/step_sw.cpp @@ -228,7 +228,6 @@ void StepSW::step(SpaceSW *p_space, real_t p_delta, int p_iterations) { profile_begtime = profile_endtime; } - //print_line("island count: "+itos(island_count)+" active count: "+itos(active_count)); /* SETUP CONSTRAINT ISLANDS */ { diff --git a/servers/physics_2d/collision_solver_2d_sat.cpp b/servers/physics_2d/collision_solver_2d_sat.cpp index 0d1ffca50d..98fe4adb80 100644 --- a/servers/physics_2d/collision_solver_2d_sat.cpp +++ b/servers/physics_2d/collision_solver_2d_sat.cpp @@ -300,7 +300,6 @@ public: } } -//print_line("test axis: "+p_axis+" depth: "+rtos(best_depth)); #ifdef DEBUG_ENABLED best_axis_count++; #endif diff --git a/servers/physics_2d/collision_solver_2d_sw.cpp b/servers/physics_2d/collision_solver_2d_sw.cpp index 6ce019f36e..b03a193d97 100644 --- a/servers/physics_2d/collision_solver_2d_sw.cpp +++ b/servers/physics_2d/collision_solver_2d_sw.cpp @@ -114,35 +114,6 @@ bool CollisionSolver2DSW::solve_raycast(const Shape2DSW *p_shape_A, const Vector return true; } -/* -bool CollisionSolver2DSW::solve_ray(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Matrix32& p_inverse_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result) { - - - const RayShape2DSW *ray = static_cast<const RayShape2DSW*>(p_shape_A); - - Vector2 from = p_transform_A.origin; - Vector2 to = from+p_transform_A.basis.get_axis(2)*ray->get_length(); - Vector2 support_A=to; - - from = p_inverse_B.xform(from); - to = p_inverse_B.xform(to); - - Vector2 p,n; - if (!p_shape_B->intersect_segment(from,to,&p,&n)) - return false; - - Vector2 support_B=p_transform_B.xform(p); - - if (p_result_callback) { - if (p_swap_result) - p_result_callback(support_B,support_A,p_userdata); - else - p_result_callback(support_A,support_B,p_userdata); - } - return true; -} -*/ - struct _ConcaveCollisionInfo2D { const Transform2D *transform_A; @@ -219,7 +190,6 @@ bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A, const Transf concave_B->cull(local_aabb, concave_callback, &cinfo); - //print_line("Rect2 TESTS: "+itos(cinfo.aabb_tests)); return cinfo.collided; } @@ -245,10 +215,6 @@ bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A, const Transform2D &p if (type_B == Physics2DServer::SHAPE_LINE || type_B == Physics2DServer::SHAPE_RAY) { return false; } - /* - if (type_B==Physics2DServer::SHAPE_RAY) { - return false; - */ if (swap) { return solve_static_line(p_shape_B, p_transform_B, p_shape_A, p_transform_A, p_result_callback, p_userdata, true); @@ -256,17 +222,6 @@ bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A, const Transform2D &p return solve_static_line(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false); } - /*} else if (type_A==Physics2DServer::SHAPE_RAY) { - - if (type_B==Physics2DServer::SHAPE_RAY) - return false; - - if (swap) { - return solve_ray(p_shape_B,p_transform_B,p_shape_A,p_transform_A,p_inverse_A,p_result_callback,p_userdata,true); - } else { - return solve_ray(p_shape_A,p_transform_A,p_shape_B,p_transform_B,p_inverse_B,p_result_callback,p_userdata,false); - } -*/ } else if (type_A == Physics2DServer::SHAPE_RAY) { if (type_B == Physics2DServer::SHAPE_RAY) { diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index 15e80bcd5e..721f21fc40 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -171,13 +171,14 @@ void Physics2DServerSW::_shape_col_cbk(const Vector2 &p_point_A, const Vector2 & } if (cbk->valid_dir.dot((p_point_A - p_point_B).normalized()) < 0.7071) { cbk->invalid_by_dir++; - ; - /* print_line("A: "+p_point_A); + + /* + print_line("A: "+p_point_A); print_line("B: "+p_point_B); print_line("discard too angled "+rtos(cbk->valid_dir.dot((p_point_A-p_point_B)))); print_line("resnorm: "+(p_point_A-p_point_B).normalized()); print_line("distance: "+rtos(p_point_A.distance_to(p_point_B))); -*/ + */ return; } } diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index ecebd09436..746aa2d49b 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -234,11 +234,6 @@ bool Physics2DDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transfor aabb = aabb.merge(Rect2(aabb.position + p_motion, aabb.size)); //motion aabb = aabb.grow(p_margin); - /* - if (p_motion!=Vector2()) - print_line(p_motion); - */ - int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space2DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results); real_t best_safe = 1; @@ -255,15 +250,6 @@ bool Physics2DDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transfor const CollisionObject2DSW *col_obj = space->intersection_query_results[i]; int shape_idx = space->intersection_query_subindex_results[i]; - /*if (col_obj->get_type()==CollisionObject2DSW::TYPE_BODY) { - - const Body2DSW *body=static_cast<const Body2DSW*>(col_obj); - if (body->get_one_way_collision_direction()!=Vector2() && p_motion.dot(body->get_one_way_collision_direction())<=CMP_EPSILON) { - print_line("failed in motion dir"); - continue; - } - }*/ - Transform2D col_obj_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx); //test initial overlap, does it collide if going all the way? if (!CollisionSolver2DSW::solve(shape, p_xform, p_motion, col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), NULL, NULL, NULL, p_margin)) { diff --git a/servers/physics_2d/step_2d_sw.cpp b/servers/physics_2d/step_2d_sw.cpp index 6108b885f0..d1078f1506 100644 --- a/servers/physics_2d/step_2d_sw.cpp +++ b/servers/physics_2d/step_2d_sw.cpp @@ -209,8 +209,6 @@ void Step2DSW::step(Space2DSW *p_space, real_t p_delta, int p_iterations) { p_space->area_remove_from_moved_list((SelfList<Area2DSW> *)aml.first()); //faster to remove here } - //print_line("island count: "+itos(island_count)+" active count: "+itos(active_count)); - { //profile profile_endtime = OS::get_singleton()->get_ticks_usec(); p_space->set_elapsed_time(Space2DSW::ELAPSED_TIME_GENERATE_ISLANDS, profile_endtime - profile_begtime); diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 8705033326..ffb130048f 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2533,7 +2533,6 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons expr = constant; } else if (tk.type == TK_TRUE) { - //print_line("found true"); //handle true constant ConstantNode *constant = alloc_node<ConstantNode>(); diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 213b3ad8f6..1e255591f0 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1180,7 +1180,7 @@ _FORCE_INLINE_ static void _light_capture_sample_octree(const RasterizerStorage: r_color = color_interp[0].linear_interpolate(color_interp[1], level_filter); r_alpha = Math::lerp(alpha_interp[0], alpha_interp[1], level_filter); - // print_line("pos: " + p_posf + " level " + rtos(p_level) + " down to " + itos(target_level) + "." + rtos(level_filter) + " color " + r_color + " alpha " + rtos(r_alpha)); + //print_line("pos: " + p_posf + " level " + rtos(p_level) + " down to " + itos(target_level) + "." + rtos(level_filter) + " color " + r_color + " alpha " + rtos(r_alpha)); } _FORCE_INLINE_ static Color _light_capture_voxel_cone_trace(const RasterizerStorage::LightmapCaptureOctree *p_octree, const Vector3 &p_pos, const Vector3 &p_dir, float p_aperture, int p_cell_subdiv) { @@ -1799,11 +1799,12 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca //light_samplers_culled=0; - /* print_line("OT: "+rtos( (OS::get_singleton()->get_ticks_usec()-t)/1000.0)); + /* + print_line("OT: "+rtos( (OS::get_singleton()->get_ticks_usec()-t)/1000.0)); print_line("OTO: "+itos(p_scenario->octree.get_octant_count())); - //print_line("OTE: "+itos(p_scenario->octree.get_elem_count())); + print_line("OTE: "+itos(p_scenario->octree.get_elem_count())); print_line("OTP: "+itos(p_scenario->octree.get_pair_count())); -*/ + */ /* STEP 3 - PROCESS PORTALS, VALIDATE ROOMS */ //removed, will replace with culling @@ -2302,7 +2303,6 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { int size_divisor = 1; if (probe->dynamic.compression == RasterizerStorage::GI_PROBE_S3TC) { - print_line("S3TC"); size_limit = 4; size_divisor = 4; } @@ -2391,7 +2391,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { probe->dynamic.mipmaps_s3tc.resize(mipmap_count); for (int i = 0; i < mipmap_count; i++) { - print_line("S3TC level: " + itos(i) + " blocks: " + itos(comp_blocks[i].size())); + //print_line("S3TC level: " + itos(i) + " blocks: " + itos(comp_blocks[i].size())); probe->dynamic.mipmaps_s3tc.write[i].resize(comp_blocks[i].size()); PoolVector<InstanceGIProbeData::CompBlockS3TC>::Write w = probe->dynamic.mipmaps_s3tc.write[i].write(); int block_idx = 0; @@ -2759,7 +2759,7 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co light->energy[2] += int32_t(light_b * att * ((cell->albedo) & 0xFF) / 255.0); } } - // print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0)); + //print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0)); } break; } } @@ -3180,7 +3180,7 @@ void VisualServerScene::render_probes() { } break; case GI_UPDATE_STAGE_UPLOADING: { - // uint64_t us = OS::get_singleton()->get_ticks_usec(); + //uint64_t us = OS::get_singleton()->get_ticks_usec(); for (int i = 0; i < (int)probe->dynamic.mipmaps_3d.size(); i++) { @@ -3190,7 +3190,7 @@ void VisualServerScene::render_probes() { probe->dynamic.updating_stage = GI_UPDATE_STAGE_CHECK; - // print_line("UPLOAD TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0)); + //print_line("UPLOAD TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0)); } break; } } diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index a700fcf11b..90acba306a 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -137,7 +137,6 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E } } - //print_line("lights: "+itos(light_count)); canvas_map[Viewport::CanvasKey(E->key(), E->get().layer)] = &E->get(); } @@ -194,8 +193,6 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E VisualServerCanvas::Canvas *canvas = static_cast<VisualServerCanvas::Canvas *>(E->get()->canvas); - //print_line("canvas "+itos(i)+" size: "+itos(I->get()->canvas->child_items.size())); - //print_line("GT "+p_viewport->global_transform+". CT: "+E->get()->transform); Transform2D xform = p_viewport->global_transform * E->get()->transform; RasterizerCanvas::Light *canvas_lights = NULL; diff --git a/servers/visual/visual_server_wrap_mt.cpp b/servers/visual/visual_server_wrap_mt.cpp index 93f3792bdc..1cafc47685 100644 --- a/servers/visual/visual_server_wrap_mt.cpp +++ b/servers/visual/visual_server_wrap_mt.cpp @@ -107,16 +107,16 @@ void VisualServerWrapMT::init() { if (create_thread) { - print_line("CREATING RENDER THREAD"); + print_verbose("VisualServerWrapMT: Creating render thread"); OS::get_singleton()->release_rendering_thread(); if (create_thread) { thread = Thread::create(_thread_callback, this); - print_line("STARTING RENDER THREAD"); + print_verbose("VisualServerWrapMT: Starting render thread"); } while (!draw_thread_up) { OS::get_singleton()->delay_usec(1000); } - print_line("DONE RENDER THREAD"); + print_verbose("VisualServerWrapMT: Finished render thread"); } else { visual_server->init(); diff --git a/thirdparty/cvtt/ConvectionKernels.cpp b/thirdparty/cvtt/ConvectionKernels.cpp index 6661d8120d..5137e35730 100644 --- a/thirdparty/cvtt/ConvectionKernels.cpp +++ b/thirdparty/cvtt/ConvectionKernels.cpp @@ -233,7 +233,7 @@ namespace cvtt { __m128 m_values[2]; - inline Float operator+(const Float& other) const + inline Float operator+(const Float &other) const { Float result; result.m_values[0] = _mm_add_ps(m_values[0], other.m_values[0]); @@ -281,7 +281,7 @@ namespace cvtt return result; } - inline Float operator/(const Float& other) const + inline Float operator/(const Float &other) const { Float result; result.m_values[0] = _mm_div_ps(m_values[0], other.m_values[0]); @@ -302,14 +302,14 @@ namespace cvtt { __m128i m_value; - inline Int16CompFlag operator&(const Int16CompFlag& other) const + inline Int16CompFlag operator&(const Int16CompFlag &other) const { Int16CompFlag result; result.m_value = _mm_and_si128(m_value, other.m_value); return result; } - inline Int16CompFlag operator|(const Int16CompFlag& other) const + inline Int16CompFlag operator|(const Int16CompFlag &other) const { Int16CompFlag result; result.m_value = _mm_or_si128(m_value, other.m_value); @@ -338,7 +338,7 @@ namespace cvtt return result; } - static Float Select(FloatCompFlag flag, Float a, Float b) + static Float Select(const FloatCompFlag &flag, const Float &a, const Float &b) { Float result; for (int i = 0; i < 2; i++) @@ -347,7 +347,7 @@ namespace cvtt } template<int TSubtype> - static VInt16<TSubtype> Select(Int16CompFlag flag, const VInt16<TSubtype> &a, const VInt16<TSubtype> &b) + static VInt16<TSubtype> Select(const Int16CompFlag &flag, const VInt16<TSubtype> &a, const VInt16<TSubtype> &b) { VInt16<TSubtype> result; result.m_value = _mm_or_si128(_mm_and_si128(flag.m_value, a.m_value), _mm_andnot_si128(flag.m_value, b.m_value)); @@ -355,7 +355,7 @@ namespace cvtt } template<int TSubtype> - static VInt16<TSubtype> SelectOrZero(Int16CompFlag flag, const VInt16<TSubtype> &a) + static VInt16<TSubtype> SelectOrZero(const Int16CompFlag &flag, const VInt16<TSubtype> &a) { VInt16<TSubtype> result; result.m_value = _mm_and_si128(flag.m_value, a.m_value); @@ -363,12 +363,12 @@ namespace cvtt } template<int TSubtype> - static void ConditionalSet(VInt16<TSubtype>& dest, Int16CompFlag flag, const VInt16<TSubtype> src) + static void ConditionalSet(VInt16<TSubtype> &dest, const Int16CompFlag &flag, const VInt16<TSubtype> &src) { dest.m_value = _mm_or_si128(_mm_andnot_si128(flag.m_value, dest.m_value), _mm_and_si128(flag.m_value, src.m_value)); } - static SInt16 ConditionalNegate(const Int16CompFlag &flag, const SInt16& v) + static SInt16 ConditionalNegate(const Int16CompFlag &flag, const SInt16 &v) { SInt16 result; result.m_value = _mm_add_epi16(_mm_xor_si128(flag.m_value, v.m_value), _mm_srli_epi16(flag.m_value, 15)); @@ -376,18 +376,18 @@ namespace cvtt } template<int TSubtype> - static void NotConditionalSet(VInt16<TSubtype>& dest, Int16CompFlag flag, const VInt16<TSubtype> src) + static void NotConditionalSet(VInt16<TSubtype> &dest, const Int16CompFlag &flag, const VInt16<TSubtype> &src) { dest.m_value = _mm_or_si128(_mm_and_si128(flag.m_value, dest.m_value), _mm_andnot_si128(flag.m_value, src.m_value)); } - static void ConditionalSet(Float& dest, FloatCompFlag flag, const Float src) + static void ConditionalSet(Float &dest, const FloatCompFlag &flag, const Float &src) { for (int i = 0; i < 2; i++) dest.m_values[i] = _mm_or_ps(_mm_andnot_ps(flag.m_values[i], dest.m_values[i]), _mm_and_ps(flag.m_values[i], src.m_values[i])); } - static void NotConditionalSet(Float& dest, FloatCompFlag flag, const Float src) + static void NotConditionalSet(Float &dest, const FloatCompFlag &flag, const Float &src) { for (int i = 0; i < 2; i++) dest.m_values[i] = _mm_or_ps(_mm_and_ps(flag.m_values[i], dest.m_values[i]), _mm_andnot_ps(flag.m_values[i], src.m_values[i])); @@ -443,7 +443,7 @@ namespace cvtt return result; } - static Float Min(Float a, Float b) + static Float Min(const Float &a, const Float &b) { Float result; for (int i = 0; i < 2; i++) @@ -474,7 +474,7 @@ namespace cvtt return result; } - static Float Max(Float a, Float b) + static Float Max(const Float &a, const Float &b) { Float result; for (int i = 0; i < 2; i++) @@ -482,7 +482,7 @@ namespace cvtt return result; } - static Float Clamp(Float v, float min, float max) + static Float Clamp(const Float &v, float min, float max) { Float result; for (int i = 0; i < 2; i++) @@ -490,7 +490,7 @@ namespace cvtt return result; } - static Float Reciprocal(Float v) + static Float Reciprocal(const Float &v) { Float result; for (int i = 0; i < 2; i++) @@ -498,7 +498,7 @@ namespace cvtt return result; } - static void ConvertLDRInputs(const PixelBlockU8* inputBlocks, int pxOffset, int channel, UInt15& chOut) + static void ConvertLDRInputs(const PixelBlockU8* inputBlocks, int pxOffset, int channel, UInt15 &chOut) { int16_t values[8]; for (int i = 0; i < 8; i++) @@ -507,7 +507,7 @@ namespace cvtt chOut.m_value = _mm_set_epi16(values[7], values[6], values[5], values[4], values[3], values[2], values[1], values[0]); } - static void ConvertHDRInputs(const PixelBlockF16* inputBlocks, int pxOffset, int channel, SInt16& chOut) + static void ConvertHDRInputs(const PixelBlockF16* inputBlocks, int pxOffset, int channel, SInt16 &chOut) { int16_t values[8]; for (int i = 0; i < 8; i++) @@ -648,7 +648,7 @@ namespace cvtt return result; } - static FloatCompFlag LessOrEqual(Float a, Float b) + static FloatCompFlag LessOrEqual(const Float &a, const Float &b) { FloatCompFlag result; for (int i = 0; i < 2; i++) @@ -664,7 +664,7 @@ namespace cvtt return result; } - static FloatCompFlag Equal(Float a, Float b) + static FloatCompFlag Equal(const Float &a, const Float &b) { FloatCompFlag result; for (int i = 0; i < 2; i++) @@ -776,7 +776,7 @@ namespace cvtt return result; } - static UInt16 RoundAndConvertToU16(Float v, const void* /*roundingMode*/) + static UInt16 RoundAndConvertToU16(const Float &v, const void* /*roundingMode*/) { __m128i lo = _mm_cvtps_epi32(_mm_add_ps(v.m_values[0], _mm_set1_ps(-32768))); __m128i hi = _mm_cvtps_epi32(_mm_add_ps(v.m_values[1], _mm_set1_ps(-32768))); @@ -788,7 +788,7 @@ namespace cvtt return result; } - static UInt15 RoundAndConvertToU15(Float v, const void* /*roundingMode*/) + static UInt15 RoundAndConvertToU15(const Float &v, const void* /*roundingMode*/) { __m128i lo = _mm_cvtps_epi32(v.m_values[0]); __m128i hi = _mm_cvtps_epi32(v.m_values[1]); @@ -800,7 +800,7 @@ namespace cvtt return result; } - static SInt16 RoundAndConvertToS16(Float v, const void* /*roundingMode*/) + static SInt16 RoundAndConvertToS16(const Float &v, const void* /*roundingMode*/) { __m128i lo = _mm_cvtps_epi32(v.m_values[0]); __m128i hi = _mm_cvtps_epi32(v.m_values[1]); @@ -812,7 +812,7 @@ namespace cvtt return result; } - static Float Sqrt(Float f) + static Float Sqrt(const Float &f) { Float result; for (int i = 0; i < 2; i++) @@ -1071,22 +1071,22 @@ namespace cvtt return XMultiply(b, a); } - static bool AnySet(Int16CompFlag v) + static bool AnySet(const Int16CompFlag &v) { return _mm_movemask_epi8(v.m_value) != 0; } - static bool AllSet(Int16CompFlag v) + static bool AllSet(const Int16CompFlag &v) { return _mm_movemask_epi8(v.m_value) == 0xffff; } - static bool AnySet(FloatCompFlag v) + static bool AnySet(const FloatCompFlag &v) { return _mm_movemask_ps(v.m_values[0]) != 0 || _mm_movemask_ps(v.m_values[1]) != 0; } - static bool AllSet(FloatCompFlag v) + static bool AllSet(const FloatCompFlag &v) { return _mm_movemask_ps(v.m_values[0]) == 0xf && _mm_movemask_ps(v.m_values[1]) == 0xf; } @@ -2562,7 +2562,7 @@ namespace cvtt } }; - void ComputeTweakFactors2(int tweak, int range, float* outFactors) + void ComputeTweakFactors(int tweak, int range, float *outFactors) { int totalUnits = range - 1; int minOutsideUnits = ((tweak >> 1) & 1); @@ -2573,7 +2573,7 @@ namespace cvtt outFactors[1] = static_cast<float>(maxOutsideUnits) / static_cast<float>(insideUnits) + 1.0f; } - ParallelMath::Float ScaleHDRValue(ParallelMath::Float v, bool isSigned) + ParallelMath::Float ScaleHDRValue(const ParallelMath::Float &v, bool isSigned) { if (isSigned) { @@ -2591,7 +2591,7 @@ namespace cvtt assert(ParallelMath::Extract(v, i) != -32768) #endif - ParallelMath::Int16CompFlag negative = ParallelMath::Less(v, ParallelMath::MakeSInt16(0)); + ParallelMath::Int16CompFlag negative = ParallelMath::Less(v, ParallelMath::MakeSInt16(0)); ParallelMath::UInt15 absComp = ParallelMath::LosslessCast<ParallelMath::UInt15>::Cast(ParallelMath::Select(negative, ParallelMath::SInt16(ParallelMath::MakeSInt16(0) - v), v)); ParallelMath::UInt31 multiplied = ParallelMath::XMultiply(absComp, ParallelMath::MakeUInt15(31)); @@ -2635,7 +2635,7 @@ namespace cvtt { } - UnfinishedEndpoints(const MFloat base[TVectorSize], const MFloat offset[TVectorSize]) + UnfinishedEndpoints(const MFloat *base, const MFloat *offset) { for (int ch = 0; ch < TVectorSize; ch++) m_base[ch] = base[ch]; @@ -2651,10 +2651,10 @@ namespace cvtt m_offset[ch] = other.m_offset[ch]; } - void FinishHDRUnsigned(int tweak, int range, MSInt16* outEP0, MSInt16* outEP1, ParallelMath::RoundTowardNearestForScope* roundingMode) + void FinishHDRUnsigned(int tweak, int range, MSInt16 *outEP0, MSInt16 *outEP1, ParallelMath::RoundTowardNearestForScope *roundingMode) { float tweakFactors[2]; - ComputeTweakFactors2(tweak, range, tweakFactors); + ComputeTweakFactors(tweak, range, tweakFactors); for (int ch = 0; ch < TVectorSize; ch++) { @@ -2673,7 +2673,7 @@ namespace cvtt void FinishHDRSigned(int tweak, int range, MSInt16* outEP0, MSInt16* outEP1, ParallelMath::RoundTowardNearestForScope* roundingMode) { float tweakFactors[2]; - ComputeTweakFactors2(tweak, range, tweakFactors); + ComputeTweakFactors(tweak, range, tweakFactors); for (int ch = 0; ch < TVectorSize; ch++) { @@ -2694,7 +2694,7 @@ namespace cvtt ParallelMath::RoundTowardNearestForScope roundingMode; float tweakFactors[2]; - ComputeTweakFactors2(tweak, range, tweakFactors); + ComputeTweakFactors(tweak, range, tweakFactors); for (int ch = 0; ch < TVectorSize; ch++) { @@ -2752,7 +2752,7 @@ namespace cvtt m_values[i] = ParallelMath::MakeFloatZero(); } - void Add(const ParallelMath::Float vec[TMatrixSize], ParallelMath::Float weight) + void Add(const ParallelMath::Float *vec, const ParallelMath::Float &weight) { int index = 0; for (int row = 0; row < TMatrixSize; row++) @@ -2765,7 +2765,7 @@ namespace cvtt } } - void Product(MFloat outVec[TMatrixSize], const MFloat inVec[TMatrixSize]) + void Product(MFloat *outVec, const MFloat *inVec) { for (int row = 0; row < TMatrixSize; row++) { @@ -2809,7 +2809,7 @@ namespace cvtt m_maxDist = ParallelMath::MakeFloat(-FLT_MAX); } - void ContributePass(const MFloat value[TVectorSize], int pass, MFloat weight) + void ContributePass(const MFloat *value, int pass, const MFloat &weight) { if (pass == 0) ContributeCentroid(value, weight); @@ -2849,7 +2849,7 @@ namespace cvtt } private: - void ContributeCentroid(const MFloat value[TVectorSize], MFloat weight) + void ContributeCentroid(const MFloat *value, const MFloat &weight) { for (int ch = 0; ch < TVectorSize; ch++) m_centroid[ch] = m_centroid[ch] + value[ch] * weight; @@ -2865,7 +2865,7 @@ namespace cvtt m_centroid[ch] = m_centroid[ch] / denom; } - void ContributeDirection(const MFloat value[TVectorSize], MFloat weight) + void ContributeDirection(const MFloat *value, const MFloat &weight) { MFloat diff[TVectorSize]; for (int ch = 0; ch < TVectorSize; ch++) @@ -2908,7 +2908,7 @@ namespace cvtt m_direction[ch] = approx[ch] / approxLen; } - void ContributeMinMax(const MFloat value[TVectorSize]) + void ContributeMinMax(const MFloat *value) { MFloat dist = ParallelMath::MakeFloatZero(); for (int ch = 0; ch < TVectorSize; ch++) @@ -2961,7 +2961,7 @@ namespace cvtt typedef ParallelMath::UInt31 MUInt31; template<class TInterpolationEPType, class TColorEPType> - void Init(const float channelWeights[TVectorSize], const TInterpolationEPType interpolationEndPoints[2][TVectorSize], const TColorEPType colorSpaceEndpoints[2][TVectorSize], int range) + void Init(const float *channelWeights, const TInterpolationEPType interpolationEndPoints[2][TVectorSize], const TColorEPType colorSpaceEndpoints[2][TVectorSize], int range) { // In BC6H, the interpolation endpoints are higher-precision than the endpoints in color space. // We need to select indexes using the color-space endpoints. @@ -3184,7 +3184,7 @@ namespace cvtt ReconstructHDRUnsignedUninverted(InvertSingle(index), pixel); } - void ConditionalInvert(ParallelMath::Int16CompFlag invert) + void ConditionalInvert(const ParallelMath::Int16CompFlag &invert) { m_isInverted = invert; } @@ -3268,7 +3268,7 @@ namespace cvtt m_wu = 0; } - void ContributePW(const MFloat *pwFloatPixel, const MUInt15 &index, MFloat weight) + void ContributePW(const MFloat *pwFloatPixel, const MUInt15 &index, const MFloat &weight) { MFloat t = ParallelMath::ToFloat(index) * m_rcpMaxIndex; @@ -3555,7 +3555,7 @@ namespace cvtt ParallelMath::RoundTowardNearestForScope roundingMode; float tf[2]; - ComputeTweakFactors2(tweak, range, tf); + ComputeTweakFactors(tweak, range, tf); MFloat base = ParallelMath::ToFloat(original[0]); MFloat offs = ParallelMath::ToFloat(original[1]) - base; @@ -5390,7 +5390,7 @@ namespace cvtt else if (numRefineRounds > MaxRefineRounds) numRefineRounds = MaxRefineRounds; - bool fastIndexing = (flags & cvtt::Flags::BC6H_FastIndexing); + bool fastIndexing = ((flags & cvtt::Flags::BC6H_FastIndexing) != 0); float channelWeightsSq[3]; ParallelMath::RoundTowardNearestForScope rtn; @@ -6550,7 +6550,7 @@ namespace cvtt } } - static void TestCounts(uint32_t flags, const int *counts, int nCounts, MUInt15 numElements, const MUInt15 pixels[16][4], const MFloat floatPixels[16][4], const MFloat preWeightedPixels[16][4], bool alphaTest, + static void TestCounts(uint32_t flags, const int *counts, int nCounts, const MUInt15 &numElements, const MUInt15 pixels[16][4], const MFloat floatPixels[16][4], const MFloat preWeightedPixels[16][4], bool alphaTest, const MFloat floatSortedInputs[16][4], const MFloat preWeightedFloatSortedInputs[16][4], const float *channelWeights, MFloat &bestError, MUInt15 bestEndpoints[2][3], MUInt15 bestIndexes[16], MUInt15 &bestRange, const ParallelMath::RoundTowardNearestForScope* rtn) { |