diff options
266 files changed, 2484 insertions, 2486 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 4b23761e4e..8f1c1779bd 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -87,12 +87,12 @@ void _ResourceLoader::set_abort_on_missing_resources(bool p_abort) { ResourceLoader::set_abort_on_missing_resources(p_abort); } -StringArray _ResourceLoader::get_dependencies(const String& p_path) { +PoolStringArray _ResourceLoader::get_dependencies(const String& p_path) { List<String> deps; ResourceLoader::get_dependencies(p_path, &deps); - StringArray ret; + PoolStringArray ret; for(List<String>::Element *E=deps.front();E;E=E->next()) { ret.push_back(E->get()); } @@ -2398,12 +2398,12 @@ _Thread::~_Thread() { ///////////////////////////////////// -StringArray _ClassDB::get_class_list() const { +PoolStringArray _ClassDB::get_class_list() const { List<StringName> classes; ClassDB::get_class_list(&classes); - StringArray ret; + PoolStringArray ret; ret.resize(classes.size()); int idx=0; for (List<StringName>::Element *E=classes.front();E;E=E->next()) { @@ -2413,12 +2413,12 @@ StringArray _ClassDB::get_class_list() const { return ret; } -StringArray _ClassDB::get_inheriters_from_class( const StringName& p_class) const { +PoolStringArray _ClassDB::get_inheriters_from_class( const StringName& p_class) const { List<StringName> classes; ClassDB::get_inheriters_from_class(p_class,&classes); - StringArray ret; + PoolStringArray ret; ret.resize(classes.size()); int idx=0; for (List<StringName>::Element *E=classes.front();E;E=E->next()) { @@ -2517,12 +2517,12 @@ Array _ClassDB::get_method_list(StringName p_class,bool p_no_inheritance) const return ret; } -StringArray _ClassDB::get_integer_constant_list(const StringName& p_class, bool p_no_inheritance) const { +PoolStringArray _ClassDB::get_integer_constant_list(const StringName& p_class, bool p_no_inheritance) const { List<String> constants; ClassDB::get_integer_constant_list(p_class,&constants,p_no_inheritance); - StringArray ret; + PoolStringArray ret; ret.resize(constants.size()); int idx=0; for (List<String>::Element *E=constants.front();E;E=E->next()) { diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 59f243a0ee..d491483d82 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -52,7 +52,7 @@ public: RES load(const String &p_path,const String& p_type_hint="", bool p_no_cache = false); PoolVector<String> get_recognized_extensions_for_type(const String& p_type); void set_abort_on_missing_resources(bool p_abort); - StringArray get_dependencies(const String& p_path); + PoolStringArray get_dependencies(const String& p_path); bool has(const String& p_path); Ref<ResourceImportMetadata> load_import_metadata(const String& p_path); @@ -602,8 +602,8 @@ protected: static void _bind_methods(); public: - StringArray get_class_list() const; - StringArray get_inheriters_from_class( const StringName& p_class) const; + PoolStringArray get_class_list() const; + PoolStringArray get_inheriters_from_class( const StringName& p_class) const; StringName get_parent_class(const StringName& p_class) const; bool class_exists(const StringName &p_class) const; bool is_parent_class(const StringName &p_class,const StringName& p_inherits) const; @@ -621,7 +621,7 @@ public: Array get_method_list(StringName p_class,bool p_no_inheritance=false) const; - StringArray get_integer_constant_list(const StringName& p_class, bool p_no_inheritance=false) const; + PoolStringArray get_integer_constant_list(const StringName& p_class, bool p_no_inheritance=false) const; bool has_integer_constant(const StringName& p_class, const StringName &p_name) const; int get_integer_constant(const StringName& p_class, const StringName &p_name) const; StringName get_category(const StringName& p_node) const; diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp index f8aa3915d4..71f810422a 100644 --- a/core/compressed_translation.cpp +++ b/core/compressed_translation.cpp @@ -518,9 +518,9 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { void PHashTranslation::_get_property_list( List<PropertyInfo> *p_list) const{ - p_list->push_back( PropertyInfo(Variant::INT_ARRAY, "hash_table")); - p_list->push_back( PropertyInfo(Variant::INT_ARRAY, "bucket_table")); - p_list->push_back( PropertyInfo(Variant::RAW_ARRAY, "strings")); + p_list->push_back( PropertyInfo(Variant::POOL_INT_ARRAY, "hash_table")); + p_list->push_back( PropertyInfo(Variant::POOL_INT_ARRAY, "bucket_table")); + p_list->push_back( PropertyInfo(Variant::POOL_BYTE_ARRAY, "strings")); p_list->push_back( PropertyInfo(Variant::OBJECT, "load_from",PROPERTY_HINT_RESOURCE_TYPE,"Translation",PROPERTY_USAGE_EDITOR)); } diff --git a/core/global_constants.cpp b/core/global_constants.cpp index 88d986f60e..936facdd23 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -517,11 +517,11 @@ static _GlobalConstant _global_constants[]={ {"TYPE_VECTOR2",Variant::VECTOR2}, // 5 {"TYPE_RECT2",Variant::RECT2}, {"TYPE_VECTOR3",Variant::VECTOR3}, - {"TYPE_MATRIX32",Variant::MATRIX32}, + {"TYPE_TRANSFORM2D",Variant::TRANSFORM2D}, {"TYPE_PLANE",Variant::PLANE}, {"TYPE_QUAT",Variant::QUAT}, // 10 - {"TYPE_AABB",Variant::_AABB}, //sorry naming convention fail :( not like it's used often - {"TYPE_MATRIX3",Variant::MATRIX3}, + {"TYPE_RECT3",Variant::RECT3}, //sorry naming convention fail :( not like it's used often + {"TYPE_BASIS",Variant::BASIS}, {"TYPE_TRANSFORM",Variant::TRANSFORM}, {"TYPE_COLOR",Variant::COLOR}, {"TYPE_IMAGE",Variant::IMAGE}, // 15 @@ -531,13 +531,13 @@ static _GlobalConstant _global_constants[]={ {"TYPE_INPUT_EVENT",Variant::INPUT_EVENT}, {"TYPE_DICTIONARY",Variant::DICTIONARY}, // 20 {"TYPE_ARRAY",Variant::ARRAY}, - {"TYPE_RAW_ARRAY",Variant::RAW_ARRAY}, - {"TYPE_INT_ARRAY",Variant::INT_ARRAY}, - {"TYPE_REAL_ARRAY",Variant::REAL_ARRAY}, - {"TYPE_STRING_ARRAY",Variant::STRING_ARRAY}, // 25 - {"TYPE_VECTOR2_ARRAY",Variant::VECTOR2_ARRAY}, - {"TYPE_VECTOR3_ARRAY",Variant::VECTOR3_ARRAY}, - {"TYPE_COLOR_ARRAY",Variant::COLOR_ARRAY}, + {"TYPE_RAW_ARRAY",Variant::POOL_BYTE_ARRAY}, + {"TYPE_INT_ARRAY",Variant::POOL_INT_ARRAY}, + {"TYPE_REAL_ARRAY",Variant::POOL_REAL_ARRAY}, + {"TYPE_STRING_ARRAY",Variant::POOL_STRING_ARRAY}, // 25 + {"TYPE_VECTOR2_ARRAY",Variant::POOL_VECTOR2_ARRAY}, + {"TYPE_VECTOR3_ARRAY",Variant::POOL_VECTOR3_ARRAY}, + {"TYPE_COLOR_ARRAY",Variant::POOL_COLOR_ARRAY}, {"TYPE_MAX",Variant::VARIANT_MAX}, {NULL,0} diff --git a/core/globals.cpp b/core/globals.cpp index 0b5fe4a82e..0dd31e65d0 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -927,9 +927,9 @@ static String _encode_variant(const Variant& p_variant) { Color val = p_variant; return "#"+val.to_html(); } break; - case Variant::STRING_ARRAY: - case Variant::INT_ARRAY: - case Variant::REAL_ARRAY: + case Variant::POOL_STRING_ARRAY: + case Variant::POOL_INT_ARRAY: + case Variant::POOL_REAL_ARRAY: case Variant::ARRAY: { Array arr = p_variant; String str="["; diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index 6039a77337..a9de740806 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -31,11 +31,11 @@ #include "os/file_access.h" #include "variant_parser.h" -StringArray ConfigFile::_get_sections() const { +PoolStringArray ConfigFile::_get_sections() const { List<String> s; get_sections(&s); - StringArray arr; + PoolStringArray arr; arr.resize(s.size()); int idx=0; for(const List<String>::Element *E=s.front();E;E=E->next()) { @@ -46,11 +46,11 @@ StringArray ConfigFile::_get_sections() const { return arr; } -StringArray ConfigFile::_get_section_keys(const String& p_section) const{ +PoolStringArray ConfigFile::_get_section_keys(const String& p_section) const{ List<String> s; get_section_keys(p_section,&s); - StringArray arr; + PoolStringArray arr; arr.resize(s.size()); int idx=0; for(const List<String>::Element *E=s.front();E;E=E->next()) { diff --git a/core/io/config_file.h b/core/io/config_file.h index bd71fa62c6..397342f90f 100644 --- a/core/io/config_file.h +++ b/core/io/config_file.h @@ -38,8 +38,8 @@ class ConfigFile : public Reference { Map< String, Map<String, Variant> > values; - StringArray _get_sections() const; - StringArray _get_section_keys(const String& p_section) const; + PoolStringArray _get_sections() const; + PoolStringArray _get_section_keys(const String& p_section) const; protected: static void _bind_methods(); diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index b556d46105..5e57f55f87 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -193,7 +193,7 @@ Error HTTPClient::send_body_text(const String& p_body){ return OK; } -Error HTTPClient::send_body_data(const ByteArray& p_body){ +Error HTTPClient::send_body_data(const PoolByteArray& p_body){ return OK; } @@ -444,11 +444,11 @@ Dictionary HTTPClient::_get_response_headers_as_dictionary() { return ret; } -StringArray HTTPClient::_get_response_headers() { +PoolStringArray HTTPClient::_get_response_headers() { List<String> rh; get_response_headers(&rh); - StringArray ret; + PoolStringArray ret; ret.resize(rh.size()); int idx=0; for(const List<String>::Element *E=rh.front();E;E=E->next()) { @@ -463,9 +463,9 @@ int HTTPClient::get_response_body_length() const { return body_size; } -ByteArray HTTPClient::read_response_body_chunk() { +PoolByteArray HTTPClient::read_response_body_chunk() { - ERR_FAIL_COND_V( status !=STATUS_BODY, ByteArray() ); + ERR_FAIL_COND_V( status !=STATUS_BODY, PoolByteArray() ); Error err=OK; @@ -487,7 +487,7 @@ ByteArray HTTPClient::read_response_body_chunk() { if (chunk.size()>32) { ERR_PRINT("HTTP Invalid chunk hex len"); status=STATUS_CONNECTION_ERROR; - return ByteArray(); + return PoolByteArray(); } if (chunk.size()>2 && chunk[chunk.size()-2]=='\r' && chunk[chunk.size()-1]=='\n') { @@ -505,14 +505,14 @@ ByteArray HTTPClient::read_response_body_chunk() { else { ERR_PRINT("HTTP Chunk len not in hex!!"); status=STATUS_CONNECTION_ERROR; - return ByteArray(); + return PoolByteArray(); } len<<=4; len|=v; if (len>(1<<24)) { ERR_PRINT("HTTP Chunk too big!! >16mb"); status=STATUS_CONNECTION_ERROR; - return ByteArray(); + return PoolByteArray(); } } @@ -521,7 +521,7 @@ ByteArray HTTPClient::read_response_body_chunk() { //end! status=STATUS_CONNECTED; chunk.clear(); - return ByteArray(); + return PoolByteArray(); } chunk_left=len+2; @@ -542,13 +542,13 @@ ByteArray HTTPClient::read_response_body_chunk() { if (chunk[chunk.size()-2]!='\r' || chunk[chunk.size()-1]!='\n') { ERR_PRINT("HTTP Invalid chunk terminator (not \\r\\n)"); status=STATUS_CONNECTION_ERROR; - return ByteArray(); + return PoolByteArray(); } - ByteArray ret; + PoolByteArray ret; ret.resize(chunk.size()-2); { - ByteArray::Write w = ret.write(); + PoolByteArray::Write w = ret.write(); copymem(w.ptr(),chunk.ptr(),chunk.size()-2); } chunk.clear(); @@ -564,9 +564,9 @@ ByteArray HTTPClient::read_response_body_chunk() { } else { int to_read = MIN(body_left,read_chunk_size); - ByteArray ret; + PoolByteArray ret; ret.resize(to_read); - ByteArray::Write w = ret.write(); + PoolByteArray::Write w = ret.write(); int _offset = 0; while (to_read > 0) { int rec=0; @@ -603,7 +603,7 @@ ByteArray HTTPClient::read_response_body_chunk() { status=STATUS_CONNECTED; } - return ByteArray(); + return PoolByteArray(); } HTTPClient::Status HTTPClient::get_status() const { diff --git a/core/io/http_client.h b/core/io/http_client.h index 231475775f..c6f96db1d6 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -156,7 +156,7 @@ private: Vector<String> response_headers; static void _bind_methods(); - StringArray _get_response_headers(); + PoolStringArray _get_response_headers(); Dictionary _get_response_headers_as_dictionary(); int read_chunk_size; @@ -175,7 +175,7 @@ public: Error request_raw( Method p_method, const String& p_url, const Vector<String>& p_headers,const PoolVector<uint8_t>& p_body); Error request( Method p_method, const String& p_url, const Vector<String>& p_headers,const String& p_body=String()); Error send_body_text(const String& p_body); - Error send_body_data(const ByteArray& p_body); + Error send_body_data(const PoolByteArray& p_body); void close(); @@ -187,7 +187,7 @@ public: Error get_response_headers(List<String> *r_response); int get_response_body_length() const; - ByteArray read_response_body_chunk(); // can't get body as partial text because of most encodings UTF8, gzip, etc. + PoolByteArray read_response_body_chunk(); // can't get body as partial text because of most encodings UTF8, gzip, etc. void set_blocking_mode(bool p_enable); //useful mostly if running in a thread bool is_blocking_mode_enabled() const; diff --git a/core/io/json.cpp b/core/io/json.cpp index 3280f94750..ed1e74967b 100644 --- a/core/io/json.cpp +++ b/core/io/json.cpp @@ -52,9 +52,9 @@ String JSON::_print_var(const Variant& p_var) { case Variant::BOOL: return p_var.operator bool() ? "true": "false"; case Variant::INT: return itos(p_var); case Variant::REAL: return rtos(p_var); - case Variant::INT_ARRAY: - case Variant::REAL_ARRAY: - case Variant::STRING_ARRAY: + case Variant::POOL_INT_ARRAY: + case Variant::POOL_REAL_ARRAY: + case Variant::POOL_STRING_ARRAY: case Variant::ARRAY: { String s = "["; diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 0765fc86c7..67baa117cb 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -164,10 +164,10 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * (*r_len)+=4*3; } break; - case Variant::MATRIX32: { + case Variant::TRANSFORM2D: { ERR_FAIL_COND_V(len<(int)4*6,ERR_INVALID_DATA); - Matrix32 val; + Transform2D val; for(int i=0;i<3;i++) { for(int j=0;j<2;j++) { @@ -209,10 +209,10 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * (*r_len)+=4*4; } break; - case Variant::_AABB: { + case Variant::RECT3: { ERR_FAIL_COND_V(len<(int)4*6,ERR_INVALID_DATA); - AABB val; + Rect3 val; val.pos.x=decode_float(&buf[0]); val.pos.y=decode_float(&buf[4]); val.pos.z=decode_float(&buf[8]); @@ -225,10 +225,10 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * (*r_len)+=4*6; } break; - case Variant::MATRIX3: { + case Variant::BASIS: { ERR_FAIL_COND_V(len<(int)4*9,ERR_INVALID_DATA); - Matrix3 val; + Basis val; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { @@ -548,7 +548,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * } break; // arrays - case Variant::RAW_ARRAY: { + case Variant::POOL_BYTE_ARRAY: { ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA); uint32_t count = decode_uint32(buf); @@ -581,7 +581,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * } break; - case Variant::INT_ARRAY: { + case Variant::POOL_INT_ARRAY: { ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA); uint32_t count = decode_uint32(buf); @@ -608,7 +608,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * } } break; - case Variant::REAL_ARRAY: { + case Variant::POOL_REAL_ARRAY: { ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA); uint32_t count = decode_uint32(buf); @@ -637,7 +637,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * } break; - case Variant::STRING_ARRAY: { + case Variant::POOL_STRING_ARRAY: { ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA); uint32_t count = decode_uint32(buf); @@ -687,7 +687,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * } break; - case Variant::VECTOR2_ARRAY: { + case Variant::POOL_VECTOR2_ARRAY: { ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA); uint32_t count = decode_uint32(buf); @@ -725,7 +725,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * r_variant=varray; } break; - case Variant::VECTOR3_ARRAY: { + case Variant::POOL_VECTOR3_ARRAY: { ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA); uint32_t count = decode_uint32(buf); @@ -764,7 +764,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * r_variant=varray; } break; - case Variant::COLOR_ARRAY: { + case Variant::POOL_COLOR_ARRAY: { ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA); uint32_t count = decode_uint32(buf); @@ -1004,10 +1004,10 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { r_len+=3*4; } break; - case Variant::MATRIX32: { + case Variant::TRANSFORM2D: { if (buf) { - Matrix32 val=p_variant; + Transform2D val=p_variant; for(int i=0;i<3;i++) { for(int j=0;j<2;j++) { @@ -1046,10 +1046,10 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { r_len+=4*4; } break; - case Variant::_AABB: { + case Variant::RECT3: { if (buf) { - AABB aabb=p_variant; + Rect3 aabb=p_variant; encode_float(aabb.pos.x,&buf[0]); encode_float(aabb.pos.y,&buf[4]); encode_float(aabb.pos.z,&buf[8]); @@ -1062,10 +1062,10 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { } break; - case Variant::MATRIX3: { + case Variant::BASIS: { if (buf) { - Matrix3 val=p_variant; + Basis val=p_variant; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { @@ -1294,7 +1294,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { } break; // arrays - case Variant::RAW_ARRAY: { + case Variant::POOL_BYTE_ARRAY: { PoolVector<uint8_t> data = p_variant; int datalen=data.size(); @@ -1313,7 +1313,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { r_len++; } break; - case Variant::INT_ARRAY: { + case Variant::POOL_INT_ARRAY: { PoolVector<int> data = p_variant; int datalen=data.size(); @@ -1331,7 +1331,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { r_len+=4+datalen*datasize; } break; - case Variant::REAL_ARRAY: { + case Variant::POOL_REAL_ARRAY: { PoolVector<real_t> data = p_variant; int datalen=data.size(); @@ -1349,7 +1349,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { r_len+=4+datalen*datasize; } break; - case Variant::STRING_ARRAY: { + case Variant::POOL_STRING_ARRAY: { PoolVector<String> data = p_variant; @@ -1383,7 +1383,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { } } break; - case Variant::VECTOR2_ARRAY: { + case Variant::POOL_VECTOR2_ARRAY: { PoolVector<Vector2> data = p_variant; int len=data.size(); @@ -1411,7 +1411,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { r_len+=4*2*len; } break; - case Variant::VECTOR3_ARRAY: { + case Variant::POOL_VECTOR3_ARRAY: { PoolVector<Vector3> data = p_variant; int len=data.size(); @@ -1440,7 +1440,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { r_len+=4*3*len; } break; - case Variant::COLOR_ARRAY: { + case Variant::POOL_COLOR_ARRAY: { PoolVector<Color> data = p_variant; int len=data.size(); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 16da74fdf1..7383fd7f6d 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -180,7 +180,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { } break; case VARIANT_AABB: { - AABB v; + Rect3 v; v.pos.x=f->get_real(); v.pos.y=f->get_real(); v.pos.z=f->get_real(); @@ -192,7 +192,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { } break; case VARIANT_MATRIX32: { - Matrix32 v; + Transform2D v; v.elements[0].x=f->get_real(); v.elements[0].y=f->get_real(); v.elements[1].x=f->get_real(); @@ -204,7 +204,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { } break; case VARIANT_MATRIX3: { - Matrix3 v; + Basis v; v.elements[0].x=f->get_real(); v.elements[0].y=f->get_real(); v.elements[0].z=f->get_real(); @@ -1509,10 +1509,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, f->store_real(val.w); } break; - case Variant::_AABB: { + case Variant::RECT3: { f->store_32(VARIANT_AABB); - AABB val=p_property; + Rect3 val=p_property; f->store_real(val.pos.x); f->store_real(val.pos.y); f->store_real(val.pos.z); @@ -1521,10 +1521,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, f->store_real(val.size.z); } break; - case Variant::MATRIX32: { + case Variant::TRANSFORM2D: { f->store_32(VARIANT_MATRIX32); - Matrix32 val=p_property; + Transform2D val=p_property; f->store_real(val.elements[0].x); f->store_real(val.elements[0].y); f->store_real(val.elements[1].x); @@ -1533,10 +1533,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, f->store_real(val.elements[2].y); } break; - case Variant::MATRIX3: { + case Variant::BASIS: { f->store_32(VARIANT_MATRIX3); - Matrix3 val=p_property; + Basis val=p_property; f->store_real(val.elements[0].x); f->store_real(val.elements[0].y); f->store_real(val.elements[0].z); @@ -1728,7 +1728,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, } } break; - case Variant::RAW_ARRAY: { + case Variant::POOL_BYTE_ARRAY: { f->store_32(VARIANT_RAW_ARRAY); PoolVector<uint8_t> arr = p_property; @@ -1739,7 +1739,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, _pad_buffer(len); } break; - case Variant::INT_ARRAY: { + case Variant::POOL_INT_ARRAY: { f->store_32(VARIANT_INT_ARRAY); PoolVector<int> arr = p_property; @@ -1750,7 +1750,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, f->store_32(r[i]); } break; - case Variant::REAL_ARRAY: { + case Variant::POOL_REAL_ARRAY: { f->store_32(VARIANT_REAL_ARRAY); PoolVector<real_t> arr = p_property; @@ -1762,7 +1762,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, } } break; - case Variant::STRING_ARRAY: { + case Variant::POOL_STRING_ARRAY: { f->store_32(VARIANT_STRING_ARRAY); PoolVector<String> arr = p_property; @@ -1774,7 +1774,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, } } break; - case Variant::VECTOR3_ARRAY: { + case Variant::POOL_VECTOR3_ARRAY: { f->store_32(VARIANT_VECTOR3_ARRAY); PoolVector<Vector3> arr = p_property; @@ -1788,7 +1788,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, } } break; - case Variant::VECTOR2_ARRAY: { + case Variant::POOL_VECTOR2_ARRAY: { f->store_32(VARIANT_VECTOR2_ARRAY); PoolVector<Vector2> arr = p_property; @@ -1801,7 +1801,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, } } break; - case Variant::COLOR_ARRAY: { + case Variant::POOL_COLOR_ARRAY: { f->store_32(VARIANT_COLOR_ARRAY); PoolVector<Color> arr = p_property; diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp index 639d848110..aab42a2989 100644 --- a/core/io/stream_peer_ssl.cpp +++ b/core/io/stream_peer_ssl.cpp @@ -45,7 +45,7 @@ StreamPeerSSL::LoadCertsFromMemory StreamPeerSSL::load_certs_func=NULL; bool StreamPeerSSL::available=false; bool StreamPeerSSL::initialize_certs=true; -void StreamPeerSSL::load_certs_from_memory(const ByteArray& p_memory) { +void StreamPeerSSL::load_certs_from_memory(const PoolByteArray& p_memory) { if (load_certs_func) load_certs_func(p_memory); } diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h index b36534fcfa..8675433a30 100644 --- a/core/io/stream_peer_ssl.h +++ b/core/io/stream_peer_ssl.h @@ -35,7 +35,7 @@ class StreamPeerSSL : public StreamPeer { GDCLASS(StreamPeerSSL,StreamPeer); public: - typedef void (*LoadCertsFromMemory)(const ByteArray& p_certs); + typedef void (*LoadCertsFromMemory)(const PoolByteArray& p_certs); protected: static StreamPeerSSL* (*_create)(); static void _bind_methods(); @@ -65,7 +65,7 @@ public: static StreamPeerSSL* create(); - static void load_certs_from_memory(const ByteArray& p_memory); + static void load_certs_from_memory(const PoolByteArray& p_memory); static bool is_available(); StreamPeerSSL(); diff --git a/core/math/aabb.cpp b/core/math/aabb.cpp index d304d3e092..3518eea7ac 100644 --- a/core/math/aabb.cpp +++ b/core/math/aabb.cpp @@ -30,24 +30,24 @@ #include "print_string.h" -float AABB::get_area() const { +float Rect3::get_area() const { return size.x*size.y*size.z; } -bool AABB::operator==(const AABB& p_rval) const { +bool Rect3::operator==(const Rect3& p_rval) const { return ((pos==p_rval.pos) && (size==p_rval.size)); } -bool AABB::operator!=(const AABB& p_rval) const { +bool Rect3::operator!=(const Rect3& p_rval) const { return ((pos!=p_rval.pos) || (size!=p_rval.size)); } -void AABB::merge_with(const AABB& p_aabb) { +void Rect3::merge_with(const Rect3& p_aabb) { Vector3 beg_1,beg_2; Vector3 end_1,end_2; @@ -70,7 +70,7 @@ void AABB::merge_with(const AABB& p_aabb) { size=max-min; } -AABB AABB::intersection(const AABB& p_aabb) const { +Rect3 Rect3::intersection(const Rect3& p_aabb) const { Vector3 src_min=pos; Vector3 src_max=pos+size; @@ -80,7 +80,7 @@ AABB AABB::intersection(const AABB& p_aabb) const { Vector3 min,max; if (src_min.x > dst_max.x || src_max.x < dst_min.x ) - return AABB(); + return Rect3(); else { min.x= ( src_min.x > dst_min.x ) ? src_min.x :dst_min.x; @@ -89,7 +89,7 @@ AABB AABB::intersection(const AABB& p_aabb) const { } if (src_min.y > dst_max.y || src_max.y < dst_min.y ) - return AABB(); + return Rect3(); else { min.y= ( src_min.y > dst_min.y ) ? src_min.y :dst_min.y; @@ -98,7 +98,7 @@ AABB AABB::intersection(const AABB& p_aabb) const { } if (src_min.z > dst_max.z || src_max.z < dst_min.z ) - return AABB(); + return Rect3(); else { min.z= ( src_min.z > dst_min.z ) ? src_min.z :dst_min.z; @@ -107,10 +107,10 @@ AABB AABB::intersection(const AABB& p_aabb) const { } - return AABB( min, max-min ); + return Rect3( min, max-min ); } -bool AABB::intersects_ray(const Vector3& p_from, const Vector3& p_dir,Vector3* r_clip,Vector3* r_normal) const { +bool Rect3::intersects_ray(const Vector3& p_from, const Vector3& p_dir,Vector3* r_clip,Vector3* r_normal) const { Vector3 c1, c2; Vector3 end = pos+size; @@ -155,7 +155,7 @@ bool AABB::intersects_ray(const Vector3& p_from, const Vector3& p_dir,Vector3* r } -bool AABB::intersects_segment(const Vector3& p_from, const Vector3& p_to,Vector3* r_clip,Vector3* r_normal) const { +bool Rect3::intersects_segment(const Vector3& p_from, const Vector3& p_to,Vector3* r_clip,Vector3* r_normal) const { real_t min=0,max=1; int axis=0; @@ -216,7 +216,7 @@ bool AABB::intersects_segment(const Vector3& p_from, const Vector3& p_to,Vector3 } -bool AABB::intersects_plane(const Plane &p_plane) const { +bool Rect3::intersects_plane(const Plane &p_plane) const { Vector3 points[8] = { Vector3( pos.x , pos.y , pos.z ), @@ -246,7 +246,7 @@ bool AABB::intersects_plane(const Plane &p_plane) const { -Vector3 AABB::get_longest_axis() const { +Vector3 Rect3::get_longest_axis() const { Vector3 axis(1,0,0); real_t max_size=size.x; @@ -263,7 +263,7 @@ Vector3 AABB::get_longest_axis() const { return axis; } -int AABB::get_longest_axis_index() const { +int Rect3::get_longest_axis_index() const { int axis=0; real_t max_size=size.x; @@ -282,7 +282,7 @@ int AABB::get_longest_axis_index() const { } -Vector3 AABB::get_shortest_axis() const { +Vector3 Rect3::get_shortest_axis() const { Vector3 axis(1,0,0); real_t max_size=size.x; @@ -299,7 +299,7 @@ Vector3 AABB::get_shortest_axis() const { return axis; } -int AABB::get_shortest_axis_index() const { +int Rect3::get_shortest_axis_index() const { int axis=0; real_t max_size=size.x; @@ -317,26 +317,26 @@ int AABB::get_shortest_axis_index() const { return axis; } -AABB AABB::merge(const AABB& p_with) const { +Rect3 Rect3::merge(const Rect3& p_with) const { - AABB aabb=*this; + Rect3 aabb=*this; aabb.merge_with(p_with); return aabb; } -AABB AABB::expand(const Vector3& p_vector) const { - AABB aabb=*this; +Rect3 Rect3::expand(const Vector3& p_vector) const { + Rect3 aabb=*this; aabb.expand_to(p_vector); return aabb; } -AABB AABB::grow(real_t p_by) const { +Rect3 Rect3::grow(real_t p_by) const { - AABB aabb=*this; + Rect3 aabb=*this; aabb.grow_by(p_by); return aabb; } -void AABB::get_edge(int p_edge,Vector3& r_from,Vector3& r_to) const { +void Rect3::get_edge(int p_edge,Vector3& r_from,Vector3& r_to) const { ERR_FAIL_INDEX(p_edge,12); switch(p_edge) { @@ -412,7 +412,7 @@ void AABB::get_edge(int p_edge,Vector3& r_from,Vector3& r_to) const { } -AABB::operator String() const { +Rect3::operator String() const { return String()+pos +" - "+ size; } diff --git a/core/math/aabb.h b/core/math/aabb.h index 1c0adf9012..2816d1f012 100644 --- a/core/math/aabb.h +++ b/core/math/aabb.h @@ -40,7 +40,7 @@ -class AABB { +class Rect3 { public: Vector3 pos; Vector3 size; @@ -62,16 +62,16 @@ public: void set_size(const Vector3& p_size) { size=p_size; } - bool operator==(const AABB& p_rval) const; - bool operator!=(const AABB& p_rval) const; + bool operator==(const Rect3& p_rval) const; + bool operator!=(const Rect3& p_rval) const; - _FORCE_INLINE_ bool intersects(const AABB& p_aabb) const; /// Both AABBs overlap - _FORCE_INLINE_ bool intersects_inclusive(const AABB& p_aabb) const; /// Both AABBs (or their faces) overlap - _FORCE_INLINE_ bool encloses(const AABB & p_aabb) const; /// p_aabb is completely inside this + _FORCE_INLINE_ bool intersects(const Rect3& p_aabb) const; /// Both AABBs overlap + _FORCE_INLINE_ bool intersects_inclusive(const Rect3& p_aabb) const; /// Both AABBs (or their faces) overlap + _FORCE_INLINE_ bool encloses(const Rect3 & p_aabb) const; /// p_aabb is completely inside this - AABB merge(const AABB& p_with) const; - void merge_with(const AABB& p_aabb); ///merge with another AABB - AABB intersection(const AABB& p_aabb) const; ///get box where two intersect, empty if no intersection occurs + Rect3 merge(const Rect3& p_with) const; + void merge_with(const Rect3& p_aabb); ///merge with another AABB + Rect3 intersection(const Rect3& p_aabb) const; ///get box where two intersect, empty if no intersection occurs bool intersects_segment(const Vector3& p_from, const Vector3& p_to,Vector3* r_clip=NULL,Vector3* r_normal=NULL) const; bool intersects_ray(const Vector3& p_from, const Vector3& p_dir,Vector3* r_clip=NULL,Vector3* r_normal=NULL) const; _FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &from,const Vector3& p_dir, float t0, float t1) const; @@ -91,25 +91,25 @@ public: int get_shortest_axis_index() const; _FORCE_INLINE_ real_t get_shortest_axis_size() const; - AABB grow(real_t p_by) const; + Rect3 grow(real_t p_by) const; _FORCE_INLINE_ void grow_by(real_t p_amount); void get_edge(int p_edge,Vector3& r_from,Vector3& r_to) const; _FORCE_INLINE_ Vector3 get_endpoint(int p_point) const; - AABB expand(const Vector3& p_vector) const; + Rect3 expand(const Vector3& p_vector) const; _FORCE_INLINE_ void project_range_in_plane(const Plane& p_plane,float &r_min,float& r_max) const; _FORCE_INLINE_ void expand_to(const Vector3& p_vector); /** expand to contain a point if necesary */ operator String() const; - _FORCE_INLINE_ AABB() {} - inline AABB(const Vector3 &p_pos,const Vector3& p_size) { pos=p_pos; size=p_size; } + _FORCE_INLINE_ Rect3() {} + inline Rect3(const Vector3 &p_pos,const Vector3& p_size) { pos=p_pos; size=p_size; } }; -inline bool AABB::intersects(const AABB& p_aabb) const { +inline bool Rect3::intersects(const Rect3& p_aabb) const { if ( pos.x >= (p_aabb.pos.x + p_aabb.size.x) ) return false; @@ -127,7 +127,7 @@ inline bool AABB::intersects(const AABB& p_aabb) const { return true; } -inline bool AABB::intersects_inclusive(const AABB& p_aabb) const { +inline bool Rect3::intersects_inclusive(const Rect3& p_aabb) const { if ( pos.x > (p_aabb.pos.x + p_aabb.size.x) ) return false; @@ -145,7 +145,7 @@ inline bool AABB::intersects_inclusive(const AABB& p_aabb) const { return true; } -inline bool AABB::encloses(const AABB & p_aabb) const { +inline bool Rect3::encloses(const Rect3 & p_aabb) const { Vector3 src_min=pos; Vector3 src_max=pos+size; @@ -162,7 +162,7 @@ inline bool AABB::encloses(const AABB & p_aabb) const { } -Vector3 AABB::get_support(const Vector3& p_normal) const { +Vector3 Rect3::get_support(const Vector3& p_normal) const { Vector3 half_extents = size * 0.5; Vector3 ofs = pos + half_extents; @@ -175,7 +175,7 @@ Vector3 AABB::get_support(const Vector3& p_normal) const { } -Vector3 AABB::get_endpoint(int p_point) const { +Vector3 Rect3::get_endpoint(int p_point) const { switch(p_point) { case 0: return Vector3( pos.x , pos.y , pos.z ); @@ -191,7 +191,7 @@ Vector3 AABB::get_endpoint(int p_point) const { ERR_FAIL_V(Vector3()); } -bool AABB::intersects_convex_shape(const Plane *p_planes, int p_plane_count) const { +bool Rect3::intersects_convex_shape(const Plane *p_planes, int p_plane_count) const { #if 1 @@ -251,7 +251,7 @@ bool AABB::intersects_convex_shape(const Plane *p_planes, int p_plane_count) con #endif } -bool AABB::has_point(const Vector3& p_point) const { +bool Rect3::has_point(const Vector3& p_point) const { if (p_point.x<pos.x) return false; @@ -270,7 +270,7 @@ bool AABB::has_point(const Vector3& p_point) const { } -inline void AABB::expand_to(const Vector3& p_vector) { +inline void Rect3::expand_to(const Vector3& p_vector) { Vector3 begin=pos; Vector3 end=pos+size; @@ -293,7 +293,7 @@ inline void AABB::expand_to(const Vector3& p_vector) { size=end-begin; } -void AABB::project_range_in_plane(const Plane& p_plane,float &r_min,float& r_max) const { +void Rect3::project_range_in_plane(const Plane& p_plane,float &r_min,float& r_max) const { Vector3 half_extents( size.x * 0.5, size.y * 0.5, size.z * 0.5 ); Vector3 center( pos.x + half_extents.x, pos.y + half_extents.y, pos.z + half_extents.z ); @@ -304,7 +304,7 @@ void AABB::project_range_in_plane(const Plane& p_plane,float &r_min,float& r_max r_max = distance + length; } -inline real_t AABB::get_longest_axis_size() const { +inline real_t Rect3::get_longest_axis_size() const { real_t max_size=size.x; @@ -319,7 +319,7 @@ inline real_t AABB::get_longest_axis_size() const { return max_size; } -inline real_t AABB::get_shortest_axis_size() const { +inline real_t Rect3::get_shortest_axis_size() const { real_t max_size=size.x; @@ -334,7 +334,7 @@ inline real_t AABB::get_shortest_axis_size() const { return max_size; } -bool AABB::smits_intersect_ray(const Vector3 &from,const Vector3& dir, float t0, float t1) const { +bool Rect3::smits_intersect_ray(const Vector3 &from,const Vector3& dir, float t0, float t1) const { float divx=1.0/dir.x; float divy=1.0/dir.y; @@ -381,7 +381,7 @@ bool AABB::smits_intersect_ray(const Vector3 &from,const Vector3& dir, float t0, return ( (tmin < t1) && (tmax > t0) ); } -void AABB::grow_by(real_t p_amount) { +void Rect3::grow_by(real_t p_amount) { pos.x-=p_amount; pos.y-=p_amount; @@ -391,6 +391,5 @@ void AABB::grow_by(real_t p_amount) { size.z+=2.0*p_amount; } -typedef AABB Rect3; #endif // AABB_H diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp index b7194d7ffb..b888b6b56c 100644 --- a/core/math/bsp_tree.cpp +++ b/core/math/bsp_tree.cpp @@ -31,7 +31,7 @@ #include "print_string.h" -void BSP_Tree::from_aabb(const AABB& p_aabb) { +void BSP_Tree::from_aabb(const Rect3& p_aabb) { planes.clear(); @@ -67,7 +67,7 @@ Vector<Plane> BSP_Tree::get_planes() const { return planes; } -AABB BSP_Tree::get_aabb() const { +Rect3 BSP_Tree::get_aabb() const { return aabb; } @@ -518,7 +518,7 @@ BSP_Tree::BSP_Tree(const Variant& p_variant) { ERR_FAIL_COND(src_nodes.size()%3); - if (d["planes"].get_type()==Variant::REAL_ARRAY) { + if (d["planes"].get_type()==Variant::POOL_REAL_ARRAY) { PoolVector<float> src_planes=d["planes"]; int plane_count=src_planes.size(); @@ -613,7 +613,7 @@ BSP_Tree::BSP_Tree(const PoolVector<Face3>& p_faces,float p_error_radius) { error_radius=p_error_radius; } -BSP_Tree::BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const AABB& p_aabb,float p_error_radius) { +BSP_Tree::BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const Rect3& p_aabb,float p_error_radius) { nodes=p_nodes; planes=p_planes; diff --git a/core/math/bsp_tree.h b/core/math/bsp_tree.h index 236b6e5ac2..e01df96555 100644 --- a/core/math/bsp_tree.h +++ b/core/math/bsp_tree.h @@ -65,7 +65,7 @@ private: Vector<Node> nodes; Vector<Plane> planes; - AABB aabb; + Rect3 aabb; float error_radius; int _get_points_inside(int p_node,const Vector3* p_points,int *p_indices, const Vector3& p_center,const Vector3& p_half_extents,int p_indices_count) const; @@ -78,7 +78,7 @@ public: bool is_empty() const { return nodes.size()==0; } Vector<Node> get_nodes() const; Vector<Plane> get_planes() const; - AABB get_aabb() const; + Rect3 get_aabb() const; bool point_is_inside(const Vector3& p_point) const; int get_points_inside(const Vector3* p_points, int p_point_count) const; @@ -87,12 +87,12 @@ public: operator Variant() const; - void from_aabb(const AABB& p_aabb); + void from_aabb(const Rect3& p_aabb); BSP_Tree(); BSP_Tree(const Variant& p_variant); BSP_Tree(const PoolVector<Face3>& p_faces,float p_error_radius=0); - BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const AABB& p_aabb,float p_error_radius=0); + BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const Rect3& p_aabb,float p_error_radius=0); ~BSP_Tree(); }; diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index 7910f5fafc..c44ff4682a 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -564,7 +564,7 @@ void CameraMatrix::make_scale(const Vector3 &p_scale) { } -void CameraMatrix::scale_translate_to_fit(const AABB& p_aabb) { +void CameraMatrix::scale_translate_to_fit(const Rect3& p_aabb) { Vector3 min = p_aabb.pos; Vector3 max = p_aabb.pos+p_aabb.size; diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h index f9fb4837f1..952f1e8fb2 100644 --- a/core/math/camera_matrix.h +++ b/core/math/camera_matrix.h @@ -85,7 +85,7 @@ struct CameraMatrix { operator String() const; - void scale_translate_to_fit(const AABB& p_aabb); + void scale_translate_to_fit(const Rect3& p_aabb); void make_scale(const Vector3 &p_scale); int get_pixels_per_meter(int p_for_pixel_width) const; operator Transform() const; diff --git a/core/math/face3.cpp b/core/math/face3.cpp index 1024143ba1..faf124593e 100644 --- a/core/math/face3.cpp +++ b/core/math/face3.cpp @@ -205,7 +205,7 @@ ClockDirection Face3::get_clock_dir() const { } -bool Face3::intersects_aabb(const AABB& p_aabb) const { +bool Face3::intersects_aabb(const Rect3& p_aabb) const { /** TEST PLANE **/ if (!p_aabb.intersects_plane( get_plane() )) diff --git a/core/math/face3.h b/core/math/face3.h index 4eade1217d..f08eb227b1 100644 --- a/core/math/face3.h +++ b/core/math/face3.h @@ -78,16 +78,16 @@ public: void get_support(const Vector3& p_normal,const Transform& p_transform,Vector3 *p_vertices,int* p_count,int p_max) const; void project_range(const Vector3& p_normal,const Transform& p_transform,float& r_min, float& r_max) const; - AABB get_aabb() const { + Rect3 get_aabb() const { - AABB aabb( vertex[0], Vector3() ); + Rect3 aabb( vertex[0], Vector3() ); aabb.expand_to( vertex[1] ); aabb.expand_to( vertex[2] ); return aabb; } - bool intersects_aabb(const AABB& p_aabb) const; - _FORCE_INLINE_ bool intersects_aabb2(const AABB& p_aabb) const; + bool intersects_aabb(const Rect3& p_aabb) const; + _FORCE_INLINE_ bool intersects_aabb2(const Rect3& p_aabb) const; operator String() const; inline Face3() {} @@ -96,7 +96,7 @@ public: }; -bool Face3::intersects_aabb2(const AABB& p_aabb) const { +bool Face3::intersects_aabb2(const Rect3& p_aabb) const { Vector3 perp = (vertex[0]-vertex[2]).cross(vertex[0]-vertex[1]); diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp index 3232d36262..bf3364a052 100644 --- a/core/math/geometry.cpp +++ b/core/math/geometry.cpp @@ -304,7 +304,7 @@ enum _CellFlags { static inline void _plot_face(uint8_t*** p_cell_status,int x,int y,int z,int len_x,int len_y,int len_z,const Vector3& voxelsize,const Face3& p_face) { - AABB aabb( Vector3(x,y,z),Vector3(len_x,len_y,len_z)); + Rect3 aabb( Vector3(x,y,z),Vector3(len_x,len_y,len_z)); aabb.pos=aabb.pos*voxelsize; aabb.size=aabb.size*voxelsize; @@ -589,7 +589,7 @@ PoolVector< Face3 > Geometry::wrap_geometry( PoolVector< Face3 > p_array,float * PoolVector<Face3>::Read facesr=p_array.read(); const Face3 *faces = facesr.ptr(); - AABB global_aabb; + Rect3 global_aabb; for(int i=0;i<face_count;i++) { diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp index df9383ed1b..c6860ba2e8 100644 --- a/core/math/math_2d.cpp +++ b/core/math/math_2d.cpp @@ -408,22 +408,22 @@ bool Point2i::operator!=(const Point2i& p_vec2) const { return x!=p_vec2.x || y!=p_vec2.y; } -void Matrix32::invert() { +void Transform2D::invert() { // FIXME: this function assumes the basis is a rotation matrix, with no scaling. - // Matrix32::affine_inverse can handle matrices with scaling, so GDScript should eventually use that. + // Transform2D::affine_inverse can handle matrices with scaling, so GDScript should eventually use that. SWAP(elements[0][1],elements[1][0]); elements[2] = basis_xform(-elements[2]); } -Matrix32 Matrix32::inverse() const { +Transform2D Transform2D::inverse() const { - Matrix32 inv=*this; + Transform2D inv=*this; inv.invert(); return inv; } -void Matrix32::affine_invert() { +void Transform2D::affine_invert() { real_t det = basis_determinant(); ERR_FAIL_COND(det==0); @@ -437,27 +437,27 @@ void Matrix32::affine_invert() { } -Matrix32 Matrix32::affine_inverse() const { +Transform2D Transform2D::affine_inverse() const { - Matrix32 inv=*this; + Transform2D inv=*this; inv.affine_invert(); return inv; } -void Matrix32::rotate(real_t p_phi) { - *this = Matrix32(p_phi,Vector2()) * (*this); +void Transform2D::rotate(real_t p_phi) { + *this = Transform2D(p_phi,Vector2()) * (*this); } -real_t Matrix32::get_rotation() const { +real_t Transform2D::get_rotation() const { real_t det = basis_determinant(); - Matrix32 m = orthonormalized(); + Transform2D m = orthonormalized(); if (det < 0) { m.scale_basis(Size2(-1,-1)); } return Math::atan2(m[0].y,m[0].x); } -void Matrix32::set_rotation(real_t p_rot) { +void Transform2D::set_rotation(real_t p_rot) { real_t cr = Math::cos(p_rot); real_t sr = Math::sin(p_rot); @@ -467,7 +467,7 @@ void Matrix32::set_rotation(real_t p_rot) { elements[1][1]=cr; } -Matrix32::Matrix32(real_t p_rot, const Vector2& p_pos) { +Transform2D::Transform2D(real_t p_rot, const Vector2& p_pos) { real_t cr = Math::cos(p_rot); real_t sr = Math::sin(p_rot); @@ -478,16 +478,16 @@ Matrix32::Matrix32(real_t p_rot, const Vector2& p_pos) { elements[2]=p_pos; } -Size2 Matrix32::get_scale() const { +Size2 Transform2D::get_scale() const { real_t det_sign = basis_determinant() > 0 ? 1 : -1; return det_sign * Size2( elements[0].length(), elements[1].length() ); } -void Matrix32::scale(const Size2& p_scale) { +void Transform2D::scale(const Size2& p_scale) { scale_basis(p_scale); elements[2]*=p_scale; } -void Matrix32::scale_basis(const Size2& p_scale) { +void Transform2D::scale_basis(const Size2& p_scale) { elements[0][0]*=p_scale.x; elements[0][1]*=p_scale.y; @@ -495,16 +495,16 @@ void Matrix32::scale_basis(const Size2& p_scale) { elements[1][1]*=p_scale.y; } -void Matrix32::translate( real_t p_tx, real_t p_ty) { +void Transform2D::translate( real_t p_tx, real_t p_ty) { translate(Vector2(p_tx,p_ty)); } -void Matrix32::translate( const Vector2& p_translation ) { +void Transform2D::translate( const Vector2& p_translation ) { elements[2]+=basis_xform(p_translation); } -void Matrix32::orthonormalize() { +void Transform2D::orthonormalize() { // Gram-Schmidt Process @@ -518,15 +518,15 @@ void Matrix32::orthonormalize() { elements[0]=x; elements[1]=y; } -Matrix32 Matrix32::orthonormalized() const { +Transform2D Transform2D::orthonormalized() const { - Matrix32 on=*this; + Transform2D on=*this; on.orthonormalize(); return on; } -bool Matrix32::operator==(const Matrix32& p_transform) const { +bool Transform2D::operator==(const Transform2D& p_transform) const { for(int i=0;i<3;i++) { if (elements[i]!=p_transform.elements[i]) @@ -536,7 +536,7 @@ bool Matrix32::operator==(const Matrix32& p_transform) const { return true; } -bool Matrix32::operator!=(const Matrix32& p_transform) const { +bool Transform2D::operator!=(const Transform2D& p_transform) const { for(int i=0;i<3;i++) { if (elements[i]!=p_transform.elements[i]) @@ -547,7 +547,7 @@ bool Matrix32::operator!=(const Matrix32& p_transform) const { } -void Matrix32::operator*=(const Matrix32& p_transform) { +void Transform2D::operator*=(const Transform2D& p_transform) { elements[2] = xform(p_transform.elements[2]); @@ -565,59 +565,59 @@ void Matrix32::operator*=(const Matrix32& p_transform) { } -Matrix32 Matrix32::operator*(const Matrix32& p_transform) const { +Transform2D Transform2D::operator*(const Transform2D& p_transform) const { - Matrix32 t = *this; + Transform2D t = *this; t*=p_transform; return t; } -Matrix32 Matrix32::scaled(const Size2& p_scale) const { +Transform2D Transform2D::scaled(const Size2& p_scale) const { - Matrix32 copy=*this; + Transform2D copy=*this; copy.scale(p_scale); return copy; } -Matrix32 Matrix32::basis_scaled(const Size2& p_scale) const { +Transform2D Transform2D::basis_scaled(const Size2& p_scale) const { - Matrix32 copy=*this; + Transform2D copy=*this; copy.scale_basis(p_scale); return copy; } -Matrix32 Matrix32::untranslated() const { +Transform2D Transform2D::untranslated() const { - Matrix32 copy=*this; + Transform2D copy=*this; copy.elements[2]=Vector2(); return copy; } -Matrix32 Matrix32::translated(const Vector2& p_offset) const { +Transform2D Transform2D::translated(const Vector2& p_offset) const { - Matrix32 copy=*this; + Transform2D copy=*this; copy.translate(p_offset); return copy; } -Matrix32 Matrix32::rotated(real_t p_phi) const { +Transform2D Transform2D::rotated(real_t p_phi) const { - Matrix32 copy=*this; + Transform2D copy=*this; copy.rotate(p_phi); return copy; } -real_t Matrix32::basis_determinant() const { +real_t Transform2D::basis_determinant() const { return elements[0].x * elements[1].y - elements[0].y * elements[1].x; } -Matrix32 Matrix32::interpolate_with(const Matrix32& p_transform, real_t p_c) const { +Transform2D Transform2D::interpolate_with(const Transform2D& p_transform, real_t p_c) const { //extract parameters Vector2 p1 = get_origin(); @@ -648,12 +648,12 @@ Matrix32 Matrix32::interpolate_with(const Matrix32& p_transform, real_t p_c) con } //construct matrix - Matrix32 res(Math::atan2(v.y, v.x), Vector2::linear_interpolate(p1, p2, p_c)); + Transform2D res(Math::atan2(v.y, v.x), Vector2::linear_interpolate(p1, p2, p_c)); res.scale_basis(Vector2::linear_interpolate(s1, s2, p_c)); return res; } -Matrix32::operator String() const { +Transform2D::operator String() const { return String(String()+elements[0]+", "+elements[1]+", "+elements[2]); } diff --git a/core/math/math_2d.h b/core/math/math_2d.h index adc23f01b1..7896299c24 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -198,7 +198,7 @@ Vector2 Vector2::linear_interpolate(const Vector2& p_a, const Vector2& p_b,real_ typedef Vector2 Size2; typedef Vector2 Point2; -struct Matrix32; +struct Transform2D; struct Rect2 { @@ -249,7 +249,7 @@ struct Rect2 { return dist; } - _FORCE_INLINE_ bool intersects_transformed(const Matrix32& p_xform, const Rect2& p_rect) const; + _FORCE_INLINE_ bool intersects_transformed(const Transform2D& p_xform, const Rect2& p_rect) const; bool intersects_segment(const Point2& p_from, const Point2& p_to, Point2* r_pos=NULL, Point2* r_normal=NULL) const; @@ -551,8 +551,8 @@ struct Rect2i { -struct Matrix32 { - // Warning #1: basis of Matrix32 is stored differently from Matrix3. In terms of elements array, the basis matrix looks like "on paper": +struct Transform2D { + // Warning #1: basis of Transform2D is stored differently from Basis. In terms of elements array, the basis matrix looks like "on paper": // M = (elements[0][0] elements[1][0]) // (elements[0][1] elements[1][1]) // This is such that the columns, which can be interpreted as basis vectors of the coordinate system "painted" on the object, can be accessed as elements[i]. @@ -575,10 +575,10 @@ struct Matrix32 { _FORCE_INLINE_ void set_axis(int p_axis,const Vector2& p_vec) { ERR_FAIL_INDEX(p_axis,3); elements[p_axis]=p_vec; } void invert(); - Matrix32 inverse() const; + Transform2D inverse() const; void affine_invert(); - Matrix32 affine_inverse() const; + Transform2D affine_inverse() const; void set_rotation(real_t p_phi); real_t get_rotation() const; @@ -597,23 +597,23 @@ struct Matrix32 { _FORCE_INLINE_ const Vector2& get_origin() const { return elements[2]; } _FORCE_INLINE_ void set_origin(const Vector2& p_origin) { elements[2]=p_origin; } - Matrix32 scaled(const Size2& p_scale) const; - Matrix32 basis_scaled(const Size2& p_scale) const; - Matrix32 translated(const Vector2& p_offset) const; - Matrix32 rotated(real_t p_phi) const; + Transform2D scaled(const Size2& p_scale) const; + Transform2D basis_scaled(const Size2& p_scale) const; + Transform2D translated(const Vector2& p_offset) const; + Transform2D rotated(real_t p_phi) const; - Matrix32 untranslated() const; + Transform2D untranslated() const; void orthonormalize(); - Matrix32 orthonormalized() const; + Transform2D orthonormalized() const; - bool operator==(const Matrix32& p_transform) const; - bool operator!=(const Matrix32& p_transform) const; + bool operator==(const Transform2D& p_transform) const; + bool operator!=(const Transform2D& p_transform) const; - void operator*=(const Matrix32& p_transform); - Matrix32 operator*(const Matrix32& p_transform) const; + void operator*=(const Transform2D& p_transform); + Transform2D operator*(const Transform2D& p_transform) const; - Matrix32 interpolate_with(const Matrix32& p_transform, real_t p_c) const; + Transform2D interpolate_with(const Transform2D& p_transform, real_t p_c) const; _FORCE_INLINE_ Vector2 basis_xform(const Vector2& p_vec) const; _FORCE_INLINE_ Vector2 basis_xform_inv(const Vector2& p_vec) const; @@ -624,7 +624,7 @@ struct Matrix32 { operator String() const; - Matrix32(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy) { + Transform2D(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy) { elements[0][0] = xx; elements[0][1] = xy; @@ -634,11 +634,11 @@ struct Matrix32 { elements[2][1] = oy; } - Matrix32(real_t p_rot, const Vector2& p_pos); - Matrix32() { elements[0][0]=1.0; elements[1][1]=1.0; } + Transform2D(real_t p_rot, const Vector2& p_pos); + Transform2D() { elements[0][0]=1.0; elements[1][1]=1.0; } }; -bool Rect2::intersects_transformed(const Matrix32& p_xform, const Rect2& p_rect) const { +bool Rect2::intersects_transformed(const Transform2D& p_xform, const Rect2& p_rect) const { //SAT intersection between local and transformed rect2 @@ -793,7 +793,7 @@ bool Rect2::intersects_transformed(const Matrix32& p_xform, const Rect2& p_rect) } -Vector2 Matrix32::basis_xform(const Vector2& v) const { +Vector2 Transform2D::basis_xform(const Vector2& v) const { return Vector2( tdotx(v), @@ -801,7 +801,7 @@ Vector2 Matrix32::basis_xform(const Vector2& v) const { ); } -Vector2 Matrix32::basis_xform_inv(const Vector2& v) const{ +Vector2 Transform2D::basis_xform_inv(const Vector2& v) const{ return Vector2( elements[0].dot(v), @@ -809,14 +809,14 @@ Vector2 Matrix32::basis_xform_inv(const Vector2& v) const{ ); } -Vector2 Matrix32::xform(const Vector2& v) const { +Vector2 Transform2D::xform(const Vector2& v) const { return Vector2( tdotx(v), tdoty(v) ) + elements[2]; } -Vector2 Matrix32::xform_inv(const Vector2& p_vec) const { +Vector2 Transform2D::xform_inv(const Vector2& p_vec) const { Vector2 v = p_vec - elements[2]; @@ -826,7 +826,7 @@ Vector2 Matrix32::xform_inv(const Vector2& p_vec) const { ); } -Rect2 Matrix32::xform(const Rect2& p_rect) const { +Rect2 Transform2D::xform(const Rect2& p_rect) const { Vector2 x=elements[0]*p_rect.size.x; Vector2 y=elements[1]*p_rect.size.y; @@ -840,7 +840,7 @@ Rect2 Matrix32::xform(const Rect2& p_rect) const { return new_rect; } -void Matrix32::set_rotation_and_scale(real_t p_rot,const Size2& p_scale) { +void Transform2D::set_rotation_and_scale(real_t p_rot,const Size2& p_scale) { elements[0][0]=Math::cos(p_rot)*p_scale.x; elements[1][1]=Math::cos(p_rot)*p_scale.y; @@ -849,7 +849,7 @@ void Matrix32::set_rotation_and_scale(real_t p_rot,const Size2& p_scale) { } -Rect2 Matrix32::xform_inv(const Rect2& p_rect) const { +Rect2 Transform2D::xform_inv(const Rect2& p_rect) const { Vector2 ends[4]={ xform_inv( p_rect.pos ), diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp index 44abf8cd36..e9c3442582 100644 --- a/core/math/matrix3.cpp +++ b/core/math/matrix3.cpp @@ -33,7 +33,7 @@ #define cofac(row1,col1, row2, col2)\ (elements[row1][col1] * elements[row2][col2] - elements[row1][col2] * elements[row2][col1]) -void Matrix3::from_z(const Vector3& p_z) { +void Basis::from_z(const Vector3& p_z) { if (Math::abs(p_z.z) > Math_SQRT12 ) { @@ -53,7 +53,7 @@ void Matrix3::from_z(const Vector3& p_z) { elements[2]=p_z; } -void Matrix3::invert() { +void Basis::invert() { real_t co[3]={ @@ -72,7 +72,7 @@ void Matrix3::invert() { } -void Matrix3::orthonormalize() { +void Basis::orthonormalize() { ERR_FAIL_COND(determinant() == 0); // Gram-Schmidt Process @@ -93,26 +93,26 @@ void Matrix3::orthonormalize() { } -Matrix3 Matrix3::orthonormalized() const { +Basis Basis::orthonormalized() const { - Matrix3 c = *this; + Basis c = *this; c.orthonormalize(); return c; } -bool Matrix3::is_orthogonal() const { - Matrix3 id; - Matrix3 m = (*this)*transposed(); +bool Basis::is_orthogonal() const { + Basis id; + Basis m = (*this)*transposed(); return isequal_approx(id,m); } -bool Matrix3::is_rotation() const { +bool Basis::is_rotation() const { return Math::isequal_approx(determinant(), 1) && is_orthogonal(); } -bool Matrix3::is_symmetric() const { +bool Basis::is_symmetric() const { if (Math::abs(elements[0][1] - elements[1][0]) > CMP_EPSILON) return false; @@ -125,19 +125,19 @@ bool Matrix3::is_symmetric() const { } -Matrix3 Matrix3::diagonalize() { +Basis Basis::diagonalize() { //NOTE: only implemented for symmetric matrices //with the Jacobi iterative method method - ERR_FAIL_COND_V(!is_symmetric(), Matrix3()); + ERR_FAIL_COND_V(!is_symmetric(), Basis()); const int ite_max = 1024; real_t off_matrix_norm_2 = elements[0][1] * elements[0][1] + elements[0][2] * elements[0][2] + elements[1][2] * elements[1][2]; int ite = 0; - Matrix3 acc_rot; + Basis acc_rot; while (off_matrix_norm_2 > CMP_EPSILON2 && ite++ < ite_max ) { real_t el01_2 = elements[0][1] * elements[0][1]; real_t el02_2 = elements[0][2] * elements[0][2]; @@ -171,7 +171,7 @@ Matrix3 Matrix3::diagonalize() { } // Compute the rotation matrix - Matrix3 rot; + Basis rot; rot.elements[i][i] = rot.elements[j][j] = Math::cos(angle); rot.elements[i][j] = - (rot.elements[j][i] = Math::sin(angle)); @@ -186,30 +186,30 @@ Matrix3 Matrix3::diagonalize() { return acc_rot; } -Matrix3 Matrix3::inverse() const { +Basis Basis::inverse() const { - Matrix3 inv=*this; + Basis inv=*this; inv.invert(); return inv; } -void Matrix3::transpose() { +void Basis::transpose() { SWAP(elements[0][1],elements[1][0]); SWAP(elements[0][2],elements[2][0]); SWAP(elements[1][2],elements[2][1]); } -Matrix3 Matrix3::transposed() const { +Basis Basis::transposed() const { - Matrix3 tr=*this; + Basis tr=*this; tr.transpose(); return tr; } // Multiplies the matrix from left by the scaling matrix: M -> S.M -// See the comment for Matrix3::rotated for further explanation. -void Matrix3::scale(const Vector3& p_scale) { +// See the comment for Basis::rotated for further explanation. +void Basis::scale(const Vector3& p_scale) { elements[0][0]*=p_scale.x; elements[0][1]*=p_scale.x; @@ -222,14 +222,14 @@ void Matrix3::scale(const Vector3& p_scale) { elements[2][2]*=p_scale.z; } -Matrix3 Matrix3::scaled( const Vector3& p_scale ) const { +Basis Basis::scaled( const Vector3& p_scale ) const { - Matrix3 m = *this; + Basis m = *this; m.scale(p_scale); return m; } -Vector3 Matrix3::get_scale() const { +Vector3 Basis::get_scale() const { // We are assuming M = R.S, and performing a polar decomposition to extract R and S. // FIXME: We eventually need a proper polar decomposition. // As a cheap workaround until then, to ensure that R is a proper rotation matrix with determinant +1 @@ -247,30 +247,30 @@ Vector3 Matrix3::get_scale() const { // Multiplies the matrix from left by the rotation matrix: M -> R.M // Note that this does *not* rotate the matrix itself. // -// The main use of Matrix3 is as Transform.basis, which is used a the transformation matrix +// The main use of Basis is as Transform.basis, which is used a the transformation matrix // of 3D object. Rotate here refers to rotation of the object (which is R * (*this)), // not the matrix itself (which is R * (*this) * R.transposed()). -Matrix3 Matrix3::rotated(const Vector3& p_axis, real_t p_phi) const { - return Matrix3(p_axis, p_phi) * (*this); +Basis Basis::rotated(const Vector3& p_axis, real_t p_phi) const { + return Basis(p_axis, p_phi) * (*this); } -void Matrix3::rotate(const Vector3& p_axis, real_t p_phi) { +void Basis::rotate(const Vector3& p_axis, real_t p_phi) { *this = rotated(p_axis, p_phi); } -Matrix3 Matrix3::rotated(const Vector3& p_euler) const { - return Matrix3(p_euler) * (*this); +Basis Basis::rotated(const Vector3& p_euler) const { + return Basis(p_euler) * (*this); } -void Matrix3::rotate(const Vector3& p_euler) { +void Basis::rotate(const Vector3& p_euler) { *this = rotated(p_euler); } -Vector3 Matrix3::get_rotation() const { +Vector3 Basis::get_rotation() const { // Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S, // and returns the Euler angles corresponding to the rotation part, complementing get_scale(). // See the comment in get_scale() for further information. - Matrix3 m = orthonormalized(); + Basis m = orthonormalized(); real_t det = m.determinant(); if (det < 0) { // Ensure that the determinant is 1, such that result is a proper rotation matrix which can be represented by Euler angles. @@ -290,7 +290,7 @@ Vector3 Matrix3::get_rotation() const { // And thus, assuming the matrix is a rotation matrix, this function returns // the angles in the decomposition R = X(a1).Y(a2).Z(a3) where Z(a) rotates // around the z-axis by a and so on. -Vector3 Matrix3::get_euler() const { +Vector3 Basis::get_euler() const { // Euler angles in XYZ convention. // See https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix @@ -329,27 +329,27 @@ Vector3 Matrix3::get_euler() const { // set_euler expects a vector containing the Euler angles in the format // (c,b,a), where a is the angle of the first rotation, and c is the last. // The current implementation uses XYZ convention (Z is the first rotation). -void Matrix3::set_euler(const Vector3& p_euler) { +void Basis::set_euler(const Vector3& p_euler) { real_t c, s; c = Math::cos(p_euler.x); s = Math::sin(p_euler.x); - Matrix3 xmat(1.0,0.0,0.0,0.0,c,-s,0.0,s,c); + Basis xmat(1.0,0.0,0.0,0.0,c,-s,0.0,s,c); c = Math::cos(p_euler.y); s = Math::sin(p_euler.y); - Matrix3 ymat(c,0.0,s,0.0,1.0,0.0,-s,0.0,c); + Basis ymat(c,0.0,s,0.0,1.0,0.0,-s,0.0,c); c = Math::cos(p_euler.z); s = Math::sin(p_euler.z); - Matrix3 zmat(c,-s,0.0,s,c,0.0,0.0,0.0,1.0); + Basis zmat(c,-s,0.0,s,c,0.0,0.0,0.0,1.0); //optimizer will optimize away all this anyway *this = xmat*(ymat*zmat); } -bool Matrix3::isequal_approx(const Matrix3& a, const Matrix3& b) const { +bool Basis::isequal_approx(const Basis& a, const Basis& b) const { for (int i=0;i<3;i++) { for (int j=0;j<3;j++) { @@ -361,7 +361,7 @@ bool Matrix3::isequal_approx(const Matrix3& a, const Matrix3& b) const { return true; } -bool Matrix3::operator==(const Matrix3& p_matrix) const { +bool Basis::operator==(const Basis& p_matrix) const { for (int i=0;i<3;i++) { for (int j=0;j<3;j++) { @@ -373,12 +373,12 @@ bool Matrix3::operator==(const Matrix3& p_matrix) const { return true; } -bool Matrix3::operator!=(const Matrix3& p_matrix) const { +bool Basis::operator!=(const Basis& p_matrix) const { return (!(*this==p_matrix)); } -Matrix3::operator String() const { +Basis::operator String() const { String mtx; for (int i=0;i<3;i++) { @@ -395,7 +395,7 @@ Matrix3::operator String() const { return mtx; } -Matrix3::operator Quat() const { +Basis::operator Quat() const { ERR_FAIL_COND_V(is_rotation() == false, Quat()); real_t trace = elements[0][0] + elements[1][1] + elements[2][2]; @@ -432,37 +432,37 @@ Matrix3::operator Quat() const { } -static const Matrix3 _ortho_bases[24]={ - Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1), - Matrix3(0, -1, 0, 1, 0, 0, 0, 0, 1), - Matrix3(-1, 0, 0, 0, -1, 0, 0, 0, 1), - Matrix3(0, 1, 0, -1, 0, 0, 0, 0, 1), - Matrix3(1, 0, 0, 0, 0, -1, 0, 1, 0), - Matrix3(0, 0, 1, 1, 0, 0, 0, 1, 0), - Matrix3(-1, 0, 0, 0, 0, 1, 0, 1, 0), - Matrix3(0, 0, -1, -1, 0, 0, 0, 1, 0), - Matrix3(1, 0, 0, 0, -1, 0, 0, 0, -1), - Matrix3(0, 1, 0, 1, 0, 0, 0, 0, -1), - Matrix3(-1, 0, 0, 0, 1, 0, 0, 0, -1), - Matrix3(0, -1, 0, -1, 0, 0, 0, 0, -1), - Matrix3(1, 0, 0, 0, 0, 1, 0, -1, 0), - Matrix3(0, 0, -1, 1, 0, 0, 0, -1, 0), - Matrix3(-1, 0, 0, 0, 0, -1, 0, -1, 0), - Matrix3(0, 0, 1, -1, 0, 0, 0, -1, 0), - Matrix3(0, 0, 1, 0, 1, 0, -1, 0, 0), - Matrix3(0, -1, 0, 0, 0, 1, -1, 0, 0), - Matrix3(0, 0, -1, 0, -1, 0, -1, 0, 0), - Matrix3(0, 1, 0, 0, 0, -1, -1, 0, 0), - Matrix3(0, 0, 1, 0, -1, 0, 1, 0, 0), - Matrix3(0, 1, 0, 0, 0, 1, 1, 0, 0), - Matrix3(0, 0, -1, 0, 1, 0, 1, 0, 0), - Matrix3(0, -1, 0, 0, 0, -1, 1, 0, 0) +static const Basis _ortho_bases[24]={ + Basis(1, 0, 0, 0, 1, 0, 0, 0, 1), + Basis(0, -1, 0, 1, 0, 0, 0, 0, 1), + Basis(-1, 0, 0, 0, -1, 0, 0, 0, 1), + Basis(0, 1, 0, -1, 0, 0, 0, 0, 1), + Basis(1, 0, 0, 0, 0, -1, 0, 1, 0), + Basis(0, 0, 1, 1, 0, 0, 0, 1, 0), + Basis(-1, 0, 0, 0, 0, 1, 0, 1, 0), + Basis(0, 0, -1, -1, 0, 0, 0, 1, 0), + Basis(1, 0, 0, 0, -1, 0, 0, 0, -1), + Basis(0, 1, 0, 1, 0, 0, 0, 0, -1), + Basis(-1, 0, 0, 0, 1, 0, 0, 0, -1), + Basis(0, -1, 0, -1, 0, 0, 0, 0, -1), + Basis(1, 0, 0, 0, 0, 1, 0, -1, 0), + Basis(0, 0, -1, 1, 0, 0, 0, -1, 0), + Basis(-1, 0, 0, 0, 0, -1, 0, -1, 0), + Basis(0, 0, 1, -1, 0, 0, 0, -1, 0), + Basis(0, 0, 1, 0, 1, 0, -1, 0, 0), + Basis(0, -1, 0, 0, 0, 1, -1, 0, 0), + Basis(0, 0, -1, 0, -1, 0, -1, 0, 0), + Basis(0, 1, 0, 0, 0, -1, -1, 0, 0), + Basis(0, 0, 1, 0, -1, 0, 1, 0, 0), + Basis(0, 1, 0, 0, 0, 1, 1, 0, 0), + Basis(0, 0, -1, 0, 1, 0, 1, 0, 0), + Basis(0, -1, 0, 0, 0, -1, 1, 0, 0) }; -int Matrix3::get_orthogonal_index() const { +int Basis::get_orthogonal_index() const { //could be sped up if i come up with a way - Matrix3 orth=*this; + Basis orth=*this; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { @@ -489,7 +489,7 @@ int Matrix3::get_orthogonal_index() const { return 0; } -void Matrix3::set_orthogonal_index(int p_index){ +void Basis::set_orthogonal_index(int p_index){ //there only exist 24 orthogonal bases in r3 ERR_FAIL_INDEX(p_index,24); @@ -500,7 +500,7 @@ void Matrix3::set_orthogonal_index(int p_index){ } -void Matrix3::get_axis_and_angle(Vector3 &r_axis,real_t& r_angle) const { +void Basis::get_axis_and_angle(Vector3 &r_axis,real_t& r_angle) const { ERR_FAIL_COND(is_rotation() == false); @@ -581,13 +581,13 @@ void Matrix3::get_axis_and_angle(Vector3 &r_axis,real_t& r_angle) const { r_angle=angle; } -Matrix3::Matrix3(const Vector3& p_euler) { +Basis::Basis(const Vector3& p_euler) { set_euler( p_euler ); } -Matrix3::Matrix3(const Quat& p_quat) { +Basis::Basis(const Quat& p_quat) { real_t d = p_quat.length_squared(); real_t s = 2.0 / d; @@ -601,7 +601,7 @@ Matrix3::Matrix3(const Quat& p_quat) { } -Matrix3::Matrix3(const Vector3& p_axis, real_t p_phi) { +Basis::Basis(const Vector3& p_axis, real_t p_phi) { // Rotation matrix from axis and angle, see https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle Vector3 axis_sq(p_axis.x*p_axis.x,p_axis.y*p_axis.y,p_axis.z*p_axis.z); diff --git a/core/math/matrix3.h b/core/math/matrix3.h index 0b61e3a56c..abce1ee45d 100644 --- a/core/math/matrix3.h +++ b/core/math/matrix3.h @@ -37,7 +37,7 @@ /** @author Juan Linietsky <reduzio@gmail.com> */ -class Matrix3 { +class Basis { public: Vector3 elements[3]; @@ -54,8 +54,8 @@ public: void invert(); void transpose(); - Matrix3 inverse() const; - Matrix3 transposed() const; + Basis inverse() const; + Basis transposed() const; _FORCE_INLINE_ real_t determinant() const; @@ -73,14 +73,14 @@ public: } void rotate(const Vector3& p_axis, real_t p_phi); - Matrix3 rotated(const Vector3& p_axis, real_t p_phi) const; + Basis rotated(const Vector3& p_axis, real_t p_phi) const; void rotate(const Vector3& p_euler); - Matrix3 rotated(const Vector3& p_euler) const; + Basis rotated(const Vector3& p_euler) const; Vector3 get_rotation() const; void scale( const Vector3& p_scale ); - Matrix3 scaled( const Vector3& p_scale ) const; + Basis scaled( const Vector3& p_scale ) const; Vector3 get_scale() const; Vector3 get_euler() const; @@ -97,21 +97,21 @@ public: return elements[0][2] * v[0] + elements[1][2] * v[1] + elements[2][2] * v[2]; } - bool isequal_approx(const Matrix3& a, const Matrix3& b) const; + bool isequal_approx(const Basis& a, const Basis& b) const; - bool operator==(const Matrix3& p_matrix) const; - bool operator!=(const Matrix3& p_matrix) const; + bool operator==(const Basis& p_matrix) const; + bool operator!=(const Basis& p_matrix) const; _FORCE_INLINE_ Vector3 xform(const Vector3& p_vector) const; _FORCE_INLINE_ Vector3 xform_inv(const Vector3& p_vector) const; - _FORCE_INLINE_ void operator*=(const Matrix3& p_matrix); - _FORCE_INLINE_ Matrix3 operator*(const Matrix3& p_matrix) const; - _FORCE_INLINE_ void operator+=(const Matrix3& p_matrix); - _FORCE_INLINE_ Matrix3 operator+(const Matrix3& p_matrix) const; - _FORCE_INLINE_ void operator-=(const Matrix3& p_matrix); - _FORCE_INLINE_ Matrix3 operator-(const Matrix3& p_matrix) const; + _FORCE_INLINE_ void operator*=(const Basis& p_matrix); + _FORCE_INLINE_ Basis operator*(const Basis& p_matrix) const; + _FORCE_INLINE_ void operator+=(const Basis& p_matrix); + _FORCE_INLINE_ Basis operator+(const Basis& p_matrix) const; + _FORCE_INLINE_ void operator-=(const Basis& p_matrix); + _FORCE_INLINE_ Basis operator-(const Basis& p_matrix) const; _FORCE_INLINE_ void operator*=(real_t p_val); - _FORCE_INLINE_ Matrix3 operator*(real_t p_val) const; + _FORCE_INLINE_ Basis operator*(real_t p_val) const; int get_orthogonal_index() const; void set_orthogonal_index(int p_index); @@ -163,9 +163,9 @@ public: elements[2].zero(); } - _FORCE_INLINE_ Matrix3 transpose_xform(const Matrix3& m) const + _FORCE_INLINE_ Basis transpose_xform(const Basis& m) const { - return Matrix3( + return Basis( elements[0].x * m[0].x + elements[1].x * m[1].x + elements[2].x * m[2].x, elements[0].x * m[0].y + elements[1].x * m[1].y + elements[2].x * m[2].y, elements[0].x * m[0].z + elements[1].x * m[1].z + elements[2].x * m[2].z, @@ -176,31 +176,31 @@ public: elements[0].z * m[0].y + elements[1].z * m[1].y + elements[2].z * m[2].y, elements[0].z * m[0].z + elements[1].z * m[1].z + elements[2].z * m[2].z); } - Matrix3(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz) { + Basis(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz) { set(xx, xy, xz, yx, yy, yz, zx, zy, zz); } void orthonormalize(); - Matrix3 orthonormalized() const; + Basis orthonormalized() const; bool is_symmetric() const; - Matrix3 diagonalize(); + Basis diagonalize(); operator Quat() const; - Matrix3(const Quat& p_quat); // euler - Matrix3(const Vector3& p_euler); // euler - Matrix3(const Vector3& p_axis, real_t p_phi); + Basis(const Quat& p_quat); // euler + Basis(const Vector3& p_euler); // euler + Basis(const Vector3& p_axis, real_t p_phi); - _FORCE_INLINE_ Matrix3(const Vector3& row0, const Vector3& row1, const Vector3& row2) + _FORCE_INLINE_ Basis(const Vector3& row0, const Vector3& row1, const Vector3& row2) { elements[0]=row0; elements[1]=row1; elements[2]=row2; } - _FORCE_INLINE_ Matrix3() { + _FORCE_INLINE_ Basis() { elements[0][0]=1; elements[0][1]=0; @@ -216,7 +216,7 @@ public: }; -_FORCE_INLINE_ void Matrix3::operator*=(const Matrix3& p_matrix) { +_FORCE_INLINE_ void Basis::operator*=(const Basis& p_matrix) { set( p_matrix.tdotx(elements[0]), p_matrix.tdoty(elements[0]), p_matrix.tdotz(elements[0]), @@ -225,9 +225,9 @@ _FORCE_INLINE_ void Matrix3::operator*=(const Matrix3& p_matrix) { } -_FORCE_INLINE_ Matrix3 Matrix3::operator*(const Matrix3& p_matrix) const { +_FORCE_INLINE_ Basis Basis::operator*(const Basis& p_matrix) const { - return Matrix3( + return Basis( p_matrix.tdotx(elements[0]), p_matrix.tdoty(elements[0]), p_matrix.tdotz(elements[0]), p_matrix.tdotx(elements[1]), p_matrix.tdoty(elements[1]), p_matrix.tdotz(elements[1]), p_matrix.tdotx(elements[2]), p_matrix.tdoty(elements[2]), p_matrix.tdotz(elements[2]) ); @@ -235,49 +235,49 @@ _FORCE_INLINE_ Matrix3 Matrix3::operator*(const Matrix3& p_matrix) const { } -_FORCE_INLINE_ void Matrix3::operator+=(const Matrix3& p_matrix) { +_FORCE_INLINE_ void Basis::operator+=(const Basis& p_matrix) { elements[0] += p_matrix.elements[0]; elements[1] += p_matrix.elements[1]; elements[2] += p_matrix.elements[2]; } -_FORCE_INLINE_ Matrix3 Matrix3::operator+(const Matrix3& p_matrix) const { +_FORCE_INLINE_ Basis Basis::operator+(const Basis& p_matrix) const { - Matrix3 ret(*this); + Basis ret(*this); ret += p_matrix; return ret; } -_FORCE_INLINE_ void Matrix3::operator-=(const Matrix3& p_matrix) { +_FORCE_INLINE_ void Basis::operator-=(const Basis& p_matrix) { elements[0] -= p_matrix.elements[0]; elements[1] -= p_matrix.elements[1]; elements[2] -= p_matrix.elements[2]; } -_FORCE_INLINE_ Matrix3 Matrix3::operator-(const Matrix3& p_matrix) const { +_FORCE_INLINE_ Basis Basis::operator-(const Basis& p_matrix) const { - Matrix3 ret(*this); + Basis ret(*this); ret -= p_matrix; return ret; } -_FORCE_INLINE_ void Matrix3::operator*=(real_t p_val) { +_FORCE_INLINE_ void Basis::operator*=(real_t p_val) { elements[0]*=p_val; elements[1]*=p_val; elements[2]*=p_val; } -_FORCE_INLINE_ Matrix3 Matrix3::operator*(real_t p_val) const { +_FORCE_INLINE_ Basis Basis::operator*(real_t p_val) const { - Matrix3 ret(*this); + Basis ret(*this); ret *= p_val; return ret; } -Vector3 Matrix3::xform(const Vector3& p_vector) const { +Vector3 Basis::xform(const Vector3& p_vector) const { return Vector3( elements[0].dot(p_vector), @@ -286,7 +286,7 @@ Vector3 Matrix3::xform(const Vector3& p_vector) const { ); } -Vector3 Matrix3::xform_inv(const Vector3& p_vector) const { +Vector3 Basis::xform_inv(const Vector3& p_vector) const { return Vector3( (elements[0][0]*p_vector.x ) + ( elements[1][0]*p_vector.y ) + ( elements[2][0]*p_vector.z ), @@ -295,7 +295,7 @@ Vector3 Matrix3::xform_inv(const Vector3& p_vector) const { ); } -real_t Matrix3::determinant() const { +real_t Basis::determinant() const { return elements[0][0]*(elements[1][1]*elements[2][2] - elements[2][1]*elements[1][2]) - elements[1][0]*(elements[0][1]*elements[2][2] - elements[2][1]*elements[0][2]) + diff --git a/core/math/octree.h b/core/math/octree.h index 189041cdc5..1a41413a76 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -107,7 +107,7 @@ private: struct Octant { // cached for FAST plane check - AABB aabb; + Rect3 aabb; uint64_t last_pass; Octant *parent; @@ -152,8 +152,8 @@ private: OctreeElementID _id; Octant *common_parent; - AABB aabb; - AABB container_aabb; + Rect3 aabb; + Rect3 container_aabb; List<PairData*,AL> pair_list; @@ -338,7 +338,7 @@ private: void _insert_element(Element *p_element,Octant *p_octant); - void _ensure_valid_root(const AABB& p_aabb); + void _ensure_valid_root(const Rect3& p_aabb); bool _remove_element_from_octant(Element *p_element,Octant *p_octant,Octant *p_limit=NULL); void _remove_element(Element *p_element); void _pair_element(Element *p_element,Octant *p_octant); @@ -356,7 +356,7 @@ private: }; void _cull_convex(Octant *p_octant,_CullConvexData *p_cull); - void _cull_AABB(Octant *p_octant,const AABB& p_aabb, T** p_result_array,int *p_result_idx,int p_result_max,int *p_subindex_array,uint32_t p_mask); + void _cull_AABB(Octant *p_octant,const Rect3& p_aabb, T** p_result_array,int *p_result_idx,int p_result_max,int *p_subindex_array,uint32_t p_mask); void _cull_segment(Octant *p_octant,const Vector3& p_from, const Vector3& p_to,T** p_result_array,int *p_result_idx,int p_result_max,int *p_subindex_array,uint32_t p_mask); void _cull_point(Octant *p_octant,const Vector3& p_point,T** p_result_array,int *p_result_idx,int p_result_max,int *p_subindex_array,uint32_t p_mask); @@ -375,8 +375,8 @@ private: } public: - OctreeElementID create(T* p_userdata, const AABB& p_aabb=AABB(), int p_subindex=0, bool p_pairable=false,uint32_t p_pairable_type=0,uint32_t pairable_mask=1); - void move(OctreeElementID p_id, const AABB& p_aabb); + OctreeElementID create(T* p_userdata, const Rect3& p_aabb=Rect3(), int p_subindex=0, bool p_pairable=false,uint32_t p_pairable_type=0,uint32_t pairable_mask=1); + void move(OctreeElementID p_id, const Rect3& p_aabb); void set_pairable(OctreeElementID p_id,bool p_pairable=false,uint32_t p_pairable_type=0,uint32_t pairable_mask=1); void erase(OctreeElementID p_id); @@ -385,7 +385,7 @@ public: int get_subindex(OctreeElementID p_id) const; int cull_convex(const Vector<Plane>& p_convex,T** p_result_array,int p_result_max,uint32_t p_mask=0xFFFFFFFF); - int cull_AABB(const AABB& p_aabb,T** p_result_array,int p_result_max,int *p_subindex_array=NULL,uint32_t p_mask=0xFFFFFFFF); + int cull_AABB(const Rect3& p_aabb,T** p_result_array,int p_result_max,int *p_subindex_array=NULL,uint32_t p_mask=0xFFFFFFFF); int cull_segment(const Vector3& p_from, const Vector3& p_to,T** p_result_array,int p_result_max,int *p_subindex_array=NULL,uint32_t p_mask=0xFFFFFFFF); int cull_point(const Vector3& p_point,T** p_result_array,int p_result_max,int *p_subindex_array=NULL,uint32_t p_mask=0xFFFFFFFF); @@ -487,7 +487,7 @@ void Octree<T,use_pairs,AL>::_insert_element(Element *p_element,Octant *p_octant } else { /* check againt AABB where child should be */ - AABB aabb=p_octant->aabb; + Rect3 aabb=p_octant->aabb; aabb.size*=0.5; if (i&1) @@ -549,12 +549,12 @@ void Octree<T,use_pairs,AL>::_insert_element(Element *p_element,Octant *p_octant template<class T,bool use_pairs,class AL> -void Octree<T,use_pairs,AL>::_ensure_valid_root(const AABB& p_aabb) { +void Octree<T,use_pairs,AL>::_ensure_valid_root(const Rect3& p_aabb) { if (!root) { // octre is empty - AABB base( Vector3(), Vector3(1.0,1.0,1.0) * unit_size); + Rect3 base( Vector3(), Vector3(1.0,1.0,1.0) * unit_size); while ( !base.encloses(p_aabb) ) { @@ -578,7 +578,7 @@ void Octree<T,use_pairs,AL>::_ensure_valid_root(const AABB& p_aabb) { } else { - AABB base=root->aabb; + Rect3 base=root->aabb; while( !base.encloses( p_aabb ) ) { @@ -814,7 +814,7 @@ void Octree<T,use_pairs,AL>::_remove_element(Element *p_element) { } template<class T,bool use_pairs,class AL> -OctreeElementID Octree<T,use_pairs,AL>::create(T* p_userdata, const AABB& p_aabb, int p_subindex,bool p_pairable,uint32_t p_pairable_type,uint32_t p_pairable_mask) { +OctreeElementID Octree<T,use_pairs,AL>::create(T* p_userdata, const Rect3& p_aabb, int p_subindex,bool p_pairable,uint32_t p_pairable_type,uint32_t p_pairable_mask) { // check for AABB validity #ifdef DEBUG_ENABLED @@ -857,7 +857,7 @@ OctreeElementID Octree<T,use_pairs,AL>::create(T* p_userdata, const AABB& p_aabb template<class T,bool use_pairs,class AL> -void Octree<T,use_pairs,AL>::move(OctreeElementID p_id, const AABB& p_aabb) { +void Octree<T,use_pairs,AL>::move(OctreeElementID p_id, const Rect3& p_aabb) { #ifdef DEBUG_ENABLED // check for AABB validity @@ -906,7 +906,7 @@ void Octree<T,use_pairs,AL>::move(OctreeElementID p_id, const AABB& p_aabb) { if (old_has_surf) { _remove_element(&e); // removing e.common_parent=NULL; - e.aabb=AABB(); + e.aabb=Rect3(); _optimize(); } else { _ensure_valid_root(p_aabb); // inserting @@ -935,7 +935,7 @@ void Octree<T,use_pairs,AL>::move(OctreeElementID p_id, const AABB& p_aabb) { return; } - AABB combined=e.aabb; + Rect3 combined=e.aabb; combined.merge_with(p_aabb); _ensure_valid_root(combined); @@ -1129,7 +1129,7 @@ void Octree<T,use_pairs,AL>::_cull_convex(Octant *p_octant,_CullConvexData *p_cu template<class T,bool use_pairs,class AL> -void Octree<T,use_pairs,AL>::_cull_AABB(Octant *p_octant,const AABB& p_aabb, T** p_result_array,int *p_result_idx,int p_result_max,int *p_subindex_array,uint32_t p_mask) { +void Octree<T,use_pairs,AL>::_cull_AABB(Octant *p_octant,const Rect3& p_aabb, T** p_result_array,int *p_result_idx,int p_result_max,int *p_subindex_array,uint32_t p_mask) { if (*p_result_idx==p_result_max) return; //pointless @@ -1376,7 +1376,7 @@ int Octree<T,use_pairs,AL>::cull_convex(const Vector<Plane>& p_convex,T** p_resu template<class T,bool use_pairs,class AL> -int Octree<T,use_pairs,AL>::cull_AABB(const AABB& p_aabb,T** p_result_array,int p_result_max,int *p_subindex_array,uint32_t p_mask) { +int Octree<T,use_pairs,AL>::cull_AABB(const Rect3& p_aabb,T** p_result_array,int p_result_max,int *p_subindex_array,uint32_t p_mask) { if (!root) diff --git a/core/math/quat.cpp b/core/math/quat.cpp index afe71100e1..055e2b7c35 100644 --- a/core/math/quat.cpp +++ b/core/math/quat.cpp @@ -59,7 +59,7 @@ void Quat::set_euler(const Vector3& p_euler) { // (a1,a2,a3), where a3 is the angle of the first rotation, and a1 is the last. // The current implementation uses XYZ convention (Z is the first rotation). Vector3 Quat::get_euler() const { - Matrix3 m(*this); + Basis m(*this); return m.get_euler(); } diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp index ce6f726418..ab81a068d4 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -38,7 +38,7 @@ Error QuickHull::build(const Vector<Vector3>& p_points, Geometry::MeshData &r_me /* CREATE AABB VOLUME */ - AABB aabb; + Rect3 aabb; for(int i=0;i<p_points.size();i++) { if (i==0) { diff --git a/core/math/transform.cpp b/core/math/transform.cpp index 0dba121013..6d9324c176 100644 --- a/core/math/transform.cpp +++ b/core/math/transform.cpp @@ -69,7 +69,7 @@ void Transform::rotate(const Vector3& p_axis,real_t p_phi) { Transform Transform::rotated(const Vector3& p_axis,real_t p_phi) const{ - return Transform(Matrix3( p_axis, p_phi ), Vector3()) * (*this); + return Transform(Basis( p_axis, p_phi ), Vector3()) * (*this); } void Transform::rotate_basis(const Vector3& p_axis,real_t p_phi) { @@ -210,7 +210,7 @@ Transform::operator String() const { } -Transform::Transform(const Matrix3& p_basis, const Vector3& p_origin) { +Transform::Transform(const Basis& p_basis, const Vector3& p_origin) { basis=p_basis; origin=p_origin; diff --git a/core/math/transform.h b/core/math/transform.h index 5f069ab586..d65e87cc6a 100644 --- a/core/math/transform.h +++ b/core/math/transform.h @@ -38,7 +38,7 @@ class Transform { public: - Matrix3 basis; + Basis basis; Vector3 origin; void invert(); @@ -62,8 +62,8 @@ public: void translate( const Vector3& p_translation ); Transform translated( const Vector3& p_translation ) const; - const Matrix3& get_basis() const { return basis; } - void set_basis(const Matrix3& p_basis) { basis=p_basis; } + const Basis& get_basis() const { return basis; } + void set_basis(const Basis& p_basis) { basis=p_basis; } const Vector3& get_origin() const { return origin; } void set_origin(const Vector3& p_origin) { origin=p_origin; } @@ -80,8 +80,8 @@ public: _FORCE_INLINE_ Plane xform(const Plane& p_plane) const; _FORCE_INLINE_ Plane xform_inv(const Plane& p_plane) const; - _FORCE_INLINE_ AABB xform(const AABB& p_aabb) const; - _FORCE_INLINE_ AABB xform_inv(const AABB& p_aabb) const; + _FORCE_INLINE_ Rect3 xform(const Rect3& p_aabb) const; + _FORCE_INLINE_ Rect3 xform_inv(const Rect3& p_aabb) const; void operator*=(const Transform& p_transform); Transform operator*(const Transform& p_transform) const; @@ -113,7 +113,7 @@ public: operator String() const; - Transform(const Matrix3& p_basis, const Vector3& p_origin=Vector3()); + Transform(const Basis& p_basis, const Vector3& p_origin=Vector3()); Transform() {} }; @@ -168,7 +168,7 @@ _FORCE_INLINE_ Plane Transform::xform_inv(const Plane& p_plane) const { } -_FORCE_INLINE_ AABB Transform::xform(const AABB& p_aabb) const { +_FORCE_INLINE_ Rect3 Transform::xform(const Rect3& p_aabb) const { /* define vertices */ #if 1 Vector3 x=basis.get_axis(0)*p_aabb.size.x; @@ -176,7 +176,7 @@ _FORCE_INLINE_ AABB Transform::xform(const AABB& p_aabb) const { Vector3 z=basis.get_axis(2)*p_aabb.size.z; Vector3 pos = xform( p_aabb.pos ); //could be even further optimized - AABB new_aabb; + Rect3 new_aabb; new_aabb.pos=pos; new_aabb.expand_to( pos+x ); new_aabb.expand_to( pos+y ); @@ -214,7 +214,7 @@ _FORCE_INLINE_ AABB Transform::xform(const AABB& p_aabb) const { #endif } -_FORCE_INLINE_ AABB Transform::xform_inv(const AABB& p_aabb) const { +_FORCE_INLINE_ Rect3 Transform::xform_inv(const Rect3& p_aabb) const { /* define vertices */ Vector3 vertices[8]={ @@ -229,7 +229,7 @@ _FORCE_INLINE_ AABB Transform::xform_inv(const AABB& p_aabb) const { }; - AABB ret; + Rect3 ret; ret.pos=xform_inv(vertices[0]); diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp index 101e164eae..fc5f55066b 100644 --- a/core/math/triangle_mesh.cpp +++ b/core/math/triangle_mesh.cpp @@ -48,7 +48,7 @@ int TriangleMesh::_create_bvh(BVH*p_bvh,BVH** p_bb,int p_from,int p_size,int p_d } - AABB aabb; + Rect3 aabb; aabb=p_bb[p_from]->aabb; for(int i=1;i<p_size;i++) { @@ -176,7 +176,7 @@ void TriangleMesh::create(const PoolVector<Vector3>& p_faces) { } -Vector3 TriangleMesh::get_area_normal(const AABB& p_aabb) const { +Vector3 TriangleMesh::get_area_normal(const Rect3& p_aabb) const { uint32_t* stack = (uint32_t*)alloca(sizeof(int)*max_depth); diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h index 37d32bd7ec..65250c023d 100644 --- a/core/math/triangle_mesh.h +++ b/core/math/triangle_mesh.h @@ -46,7 +46,7 @@ class TriangleMesh : public Reference { struct BVH { - AABB aabb; + Rect3 aabb; Vector3 center; //used for sorting int left; int right; @@ -88,7 +88,7 @@ public: bool is_valid() const; bool intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_point, Vector3 &r_normal) const; bool intersect_ray(const Vector3& p_begin,const Vector3& p_dir,Vector3 &r_point, Vector3 &r_normal) const; - Vector3 get_area_normal(const AABB& p_aabb) const; + Vector3 get_area_normal(const Rect3& p_aabb) const; PoolVector<Face3> get_faces() const; diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp index 7c6cc5182d..3eb978333d 100644 --- a/core/math/vector3.cpp +++ b/core/math/vector3.cpp @@ -32,7 +32,7 @@ void Vector3::rotate(const Vector3& p_axis,float p_phi) { - *this=Matrix3(p_axis,p_phi).xform(*this); + *this=Basis(p_axis,p_phi).xform(*this); } Vector3 Vector3::rotated(const Vector3& p_axis,float p_phi) const { diff --git a/core/math/vector3.h b/core/math/vector3.h index f1f34ce318..9ae9b69dfa 100644 --- a/core/math/vector3.h +++ b/core/math/vector3.h @@ -34,7 +34,7 @@ #include "math_funcs.h" #include "ustring.h" -class Matrix3; +class Basis; struct Vector3 { @@ -93,8 +93,8 @@ struct Vector3 { _FORCE_INLINE_ Vector3 cross(const Vector3& p_b) const; _FORCE_INLINE_ real_t dot(const Vector3& p_b) const; - _FORCE_INLINE_ Matrix3 outer(const Vector3& p_b) const; - _FORCE_INLINE_ Matrix3 to_diagonal_matrix() const; + _FORCE_INLINE_ Basis outer(const Vector3& p_b) const; + _FORCE_INLINE_ Basis to_diagonal_matrix() const; _FORCE_INLINE_ Vector3 abs() const; _FORCE_INLINE_ Vector3 floor() const; @@ -165,17 +165,17 @@ real_t Vector3::dot(const Vector3& p_b) const { return x*p_b.x + y*p_b.y + z*p_b.z; } -Matrix3 Vector3::outer(const Vector3& p_b) const { +Basis Vector3::outer(const Vector3& p_b) const { Vector3 row0(x*p_b.x, x*p_b.y, x*p_b.z); Vector3 row1(y*p_b.x, y*p_b.y, y*p_b.z); Vector3 row2(z*p_b.x, z*p_b.y, z*p_b.z); - return Matrix3(row0, row1, row2); + return Basis(row0, row1, row2); } -Matrix3 Vector3::to_diagonal_matrix() const { - return Matrix3(x, 0, 0, +Basis Vector3::to_diagonal_matrix() const { + return Basis(x, 0, 0, 0, y, 0, 0, 0, z); } diff --git a/core/method_ptrcall.h b/core/method_ptrcall.h index 2e3959c3ab..36b42c84f3 100644 --- a/core/method_ptrcall.h +++ b/core/method_ptrcall.h @@ -71,11 +71,11 @@ MAKE_PTRARG(String); MAKE_PTRARG(Vector2); MAKE_PTRARG(Rect2); MAKE_PTRARG(Vector3); -MAKE_PTRARG(Matrix32); +MAKE_PTRARG(Transform2D); MAKE_PTRARG(Plane); MAKE_PTRARG(Quat); MAKE_PTRARG(AABB); -MAKE_PTRARG(Matrix3); +MAKE_PTRARG(Basis); MAKE_PTRARG(Transform); MAKE_PTRARG(Color); MAKE_PTRARG(Image); diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 5c681f1a82..3cc595208f 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -249,7 +249,7 @@ uint32_t InputEventKey::get_scancode_with_modifiers() const { } -InputEvent InputEvent::xform_by(const Matrix32& p_xform) const { +InputEvent InputEvent::xform_by(const Transform2D& p_xform) const { InputEvent ev=*this; diff --git a/core/os/input_event.h b/core/os/input_event.h index a557de2bd7..3947d86285 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -298,7 +298,7 @@ struct InputEvent { void set_as_action(const String& p_action, bool p_pressed); - InputEvent xform_by(const Matrix32& p_xform) const; + InputEvent xform_by(const Transform2D& p_xform) const; bool operator==(const InputEvent &p_event) const; operator String() const; InputEvent() { zeromem(this,sizeof(InputEvent)); } diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp index 600a61e93d..11396666d2 100644 --- a/core/os/main_loop.cpp +++ b/core/os/main_loop.cpp @@ -43,7 +43,7 @@ void MainLoop::_bind_methods() { BIND_VMETHOD( MethodInfo("_initialize") ); BIND_VMETHOD( MethodInfo("_iteration",PropertyInfo(Variant::REAL,"delta")) ); BIND_VMETHOD( MethodInfo("_idle",PropertyInfo(Variant::REAL,"delta")) ); - BIND_VMETHOD( MethodInfo("_drop_files",PropertyInfo(Variant::STRING_ARRAY,"files"),PropertyInfo(Variant::INT,"screen")) ); + BIND_VMETHOD( MethodInfo("_drop_files",PropertyInfo(Variant::POOL_STRING_ARRAY,"files"),PropertyInfo(Variant::INT,"screen")) ); BIND_VMETHOD( MethodInfo("_finalize") ); BIND_CONSTANT(NOTIFICATION_WM_MOUSE_ENTER); diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp index 77afbfc214..5f3b877822 100644 --- a/core/packed_data_container.cpp +++ b/core/packed_data_container.cpp @@ -239,21 +239,21 @@ uint32_t PackedDataContainer::_pack(const Variant& p_data, Vector<uint8_t>& tmpd case Variant::VECTOR2: case Variant::RECT2: case Variant::VECTOR3: - case Variant::MATRIX32: + case Variant::TRANSFORM2D: case Variant::PLANE: case Variant::QUAT: - case Variant::_AABB: - case Variant::MATRIX3: + case Variant::RECT3: + case Variant::BASIS: case Variant::TRANSFORM: case Variant::IMAGE: case Variant::INPUT_EVENT: - case Variant::RAW_ARRAY: - case Variant::INT_ARRAY: - case Variant::REAL_ARRAY: - case Variant::STRING_ARRAY: - case Variant::VECTOR2_ARRAY: - case Variant::VECTOR3_ARRAY: - case Variant::COLOR_ARRAY: + case Variant::POOL_BYTE_ARRAY: + case Variant::POOL_INT_ARRAY: + case Variant::POOL_REAL_ARRAY: + case Variant::POOL_STRING_ARRAY: + case Variant::POOL_VECTOR2_ARRAY: + case Variant::POOL_VECTOR3_ARRAY: + case Variant::POOL_COLOR_ARRAY: case Variant::NODE_PATH: { uint32_t pos = tmpdata.size(); @@ -390,7 +390,7 @@ void PackedDataContainer::_bind_methods() { ClassDB::bind_method(_MD("pack:Error","value"),&PackedDataContainer::pack); ClassDB::bind_method(_MD("size"),&PackedDataContainer::size); - ADD_PROPERTY( PropertyInfo(Variant::RAW_ARRAY,"__data__"),_SCS("_set_data"),_SCS("_get_data")); + ADD_PROPERTY( PropertyInfo(Variant::POOL_BYTE_ARRAY,"__data__"),_SCS("_set_data"),_SCS("_get_data")); } diff --git a/core/path_remap.cpp b/core/path_remap.cpp index 980e8f76e7..fd5b38fa79 100644 --- a/core/path_remap.cpp +++ b/core/path_remap.cpp @@ -168,9 +168,9 @@ void PathRemap::load_remaps() { for(List<Variant>::Element *E=rk.front();E;E=E->next()) { String source = E->get(); - StringArray sa = remaps[E->get()]; + PoolStringArray sa = remaps[E->get()]; int sas = sa.size(); - StringArray::Read r = sa.read(); + PoolStringArray::Read r = sa.read(); for(int i=0;i<sas;i++) { diff --git a/core/resource.cpp b/core/resource.cpp index 9545d8c3da..db4d2ec0db 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -113,9 +113,9 @@ void ResourceImportMetadata::get_options(List<String> *r_options) const { } -StringArray ResourceImportMetadata::_get_options() const { +PoolStringArray ResourceImportMetadata::_get_options() const { - StringArray option_names; + PoolStringArray option_names; option_names.resize(options.size()); int i=0; for(Map<String,Variant>::Element *E=options.front();E;E=E->next()) { diff --git a/core/resource.h b/core/resource.h index 8b73bcdc57..284c59e1a8 100644 --- a/core/resource.h +++ b/core/resource.h @@ -60,7 +60,7 @@ class ResourceImportMetadata : public Reference { Map<String,Variant> options; - StringArray _get_options() const; + PoolStringArray _get_options() const; protected: diff --git a/core/script_language.h b/core/script_language.h index 8c38af47cb..fd96541b18 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -207,7 +207,7 @@ public: virtual Script *create_script() const=0; virtual bool has_named_classes() const=0; virtual int find_function(const String& p_function,const String& p_code) const=0; - virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const=0; + virtual String make_function(const String& p_class,const String& p_name,const PoolStringArray& p_args) const=0; virtual Error complete_code(const String& p_code, const String& p_base_path, Object*p_owner,List<String>* r_options,String& r_call_hint) { return ERR_UNAVAILABLE; } diff --git a/core/translation.cpp b/core/translation.cpp index dd0f59f343..5215e5f6d1 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -909,7 +909,7 @@ void Translation::_bind_methods() { ClassDB::bind_method(_MD("_set_messages"),&Translation::_set_messages); ClassDB::bind_method(_MD("_get_messages"),&Translation::_get_messages); - ADD_PROPERTY( PropertyInfo(Variant::STRING_ARRAY,"messages",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_messages"), _SCS("_get_messages") ); + ADD_PROPERTY( PropertyInfo(Variant::POOL_STRING_ARRAY,"messages",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_messages"), _SCS("_get_messages") ); ADD_PROPERTY( PropertyInfo(Variant::STRING,"locale"), _SCS("set_locale"), _SCS("get_locale") ); } diff --git a/core/variant.cpp b/core/variant.cpp index 69160fffa7..4ab46edf75 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -74,9 +74,9 @@ String Variant::get_type_name(Variant::Type p_type) { return "Rect2"; } break; - case MATRIX32: { + case TRANSFORM2D: { - return "Matrix32"; + return "Transform2D"; } break; case VECTOR3: { @@ -92,18 +92,18 @@ String Variant::get_type_name(Variant::Type p_type) { } break;*/ - case _AABB: { + case RECT3: { - return "AABB"; + return "Rect3"; } break; case QUAT: { return "Quat"; } break; - case MATRIX3: { + case BASIS: { - return "Matrix3"; + return "Basis"; } break; case TRANSFORM: { @@ -153,38 +153,38 @@ String Variant::get_type_name(Variant::Type p_type) { } break; // arrays - case RAW_ARRAY: { + case POOL_BYTE_ARRAY: { - return "RawArray"; + return "PoolByteArray"; } break; - case INT_ARRAY: { + case POOL_INT_ARRAY: { - return "IntArray"; + return "PoolIntArray"; } break; - case REAL_ARRAY: { + case POOL_REAL_ARRAY: { - return "RealArray"; + return "PoolFloatArray"; } break; - case STRING_ARRAY: { + case POOL_STRING_ARRAY: { - return "StringArray"; + return "PoolStringArray"; } break; - case VECTOR2_ARRAY: { + case POOL_VECTOR2_ARRAY: { - return "Vector2Array"; + return "PoolVector2Array"; } break; - case VECTOR3_ARRAY: { + case POOL_VECTOR3_ARRAY: { - return "Vector3Array"; + return "PoolVector3Array"; } break; - case COLOR_ARRAY: { + case POOL_COLOR_ARRAY: { - return "ColorArray"; + return "PoolColorArray"; } break; default: {} @@ -255,7 +255,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) { invalid_types=invalid; } break; - case MATRIX32: { + case TRANSFORM2D: { static const Type valid[]={ @@ -268,14 +268,14 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) { case QUAT: { static const Type valid[]={ - MATRIX3, + BASIS, NIL }; valid_types=valid; } break; - case MATRIX3: { + case BASIS: { static const Type valid[]={ QUAT, @@ -289,9 +289,9 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) { case TRANSFORM: { static const Type valid[]={ - MATRIX32, + TRANSFORM2D, QUAT, - MATRIX3, + BASIS, NIL }; @@ -341,20 +341,20 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) { static const Type valid[]={ - RAW_ARRAY, - INT_ARRAY, - STRING_ARRAY, - REAL_ARRAY, - COLOR_ARRAY, - VECTOR2_ARRAY, - VECTOR3_ARRAY, + POOL_BYTE_ARRAY, + POOL_INT_ARRAY, + POOL_STRING_ARRAY, + POOL_REAL_ARRAY, + POOL_COLOR_ARRAY, + POOL_VECTOR2_ARRAY, + POOL_VECTOR3_ARRAY, NIL }; valid_types=valid; } break; // arrays - case RAW_ARRAY: { + case POOL_BYTE_ARRAY: { static const Type valid[]={ ARRAY, @@ -363,7 +363,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) { valid_types=valid; } break; - case INT_ARRAY: { + case POOL_INT_ARRAY: { static const Type valid[]={ ARRAY, @@ -371,7 +371,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) { }; valid_types=valid; } break; - case REAL_ARRAY: { + case POOL_REAL_ARRAY: { static const Type valid[]={ ARRAY, @@ -380,7 +380,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) { valid_types=valid; } break; - case STRING_ARRAY: { + case POOL_STRING_ARRAY: { static const Type valid[]={ ARRAY, @@ -388,7 +388,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) { }; valid_types=valid; } break; - case VECTOR2_ARRAY: { + case POOL_VECTOR2_ARRAY: { static const Type valid[]={ ARRAY, @@ -397,7 +397,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) { valid_types=valid; } break; - case VECTOR3_ARRAY: { + case POOL_VECTOR3_ARRAY: { static const Type valid[]={ ARRAY, @@ -406,7 +406,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) { valid_types=valid; } break; - case COLOR_ARRAY: { + case POOL_COLOR_ARRAY: { static const Type valid[]={ ARRAY, @@ -507,7 +507,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_ valid_types=valid; } break; - case MATRIX32: { + case TRANSFORM2D: { static const Type valid[]={ @@ -520,14 +520,14 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_ case QUAT: { static const Type valid[]={ - MATRIX3, + BASIS, NIL }; valid_types=valid; } break; - case MATRIX3: { + case BASIS: { static const Type valid[]={ QUAT, @@ -541,9 +541,9 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_ case TRANSFORM: { static const Type valid[]={ - MATRIX32, + TRANSFORM2D, QUAT, - MATRIX3, + BASIS, NIL }; @@ -593,20 +593,20 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_ static const Type valid[]={ - RAW_ARRAY, - INT_ARRAY, - STRING_ARRAY, - REAL_ARRAY, - COLOR_ARRAY, - VECTOR2_ARRAY, - VECTOR3_ARRAY, + POOL_BYTE_ARRAY, + POOL_INT_ARRAY, + POOL_STRING_ARRAY, + POOL_REAL_ARRAY, + POOL_COLOR_ARRAY, + POOL_VECTOR2_ARRAY, + POOL_VECTOR3_ARRAY, NIL }; valid_types=valid; } break; // arrays - case RAW_ARRAY: { + case POOL_BYTE_ARRAY: { static const Type valid[]={ ARRAY, @@ -615,7 +615,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_ valid_types=valid; } break; - case INT_ARRAY: { + case POOL_INT_ARRAY: { static const Type valid[]={ ARRAY, @@ -623,7 +623,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_ }; valid_types=valid; } break; - case REAL_ARRAY: { + case POOL_REAL_ARRAY: { static const Type valid[]={ ARRAY, @@ -632,7 +632,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_ valid_types=valid; } break; - case STRING_ARRAY: { + case POOL_STRING_ARRAY: { static const Type valid[]={ ARRAY, @@ -640,7 +640,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_ }; valid_types=valid; } break; - case VECTOR2_ARRAY: { + case POOL_VECTOR2_ARRAY: { static const Type valid[]={ ARRAY, @@ -649,7 +649,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_ valid_types=valid; } break; - case VECTOR3_ARRAY: { + case POOL_VECTOR3_ARRAY: { static const Type valid[]={ ARRAY, @@ -658,7 +658,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_ valid_types=valid; } break; - case COLOR_ARRAY: { + case POOL_COLOR_ARRAY: { static const Type valid[]={ ARRAY, @@ -759,9 +759,9 @@ bool Variant::is_zero() const { return *reinterpret_cast<const Rect2*>(_data._mem)==Rect2(); } break; - case MATRIX32: { + case TRANSFORM2D: { - return *_data._matrix32==Matrix32(); + return *_data._transform2d==Transform2D(); } break; case VECTOR3: { @@ -779,18 +779,18 @@ bool Variant::is_zero() const { } break;*/ - case _AABB: { + case RECT3: { - return *_data._aabb==AABB(); + return *_data._rect3==Rect3(); } break; case QUAT: { return *reinterpret_cast<const Quat*>(_data._mem)==Quat(); } break; - case MATRIX3: { + case BASIS: { - return *_data._matrix3==Matrix3(); + return *_data._basis==Basis(); } break; case TRANSFORM: { @@ -840,37 +840,37 @@ bool Variant::is_zero() const { } break; // arrays - case RAW_ARRAY: { + case POOL_BYTE_ARRAY: { return reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem)->size()==0; } break; - case INT_ARRAY: { + case POOL_INT_ARRAY: { return reinterpret_cast<const PoolVector<int>*>(_data._mem)->size()==0; } break; - case REAL_ARRAY: { + case POOL_REAL_ARRAY: { return reinterpret_cast<const PoolVector<real_t>*>(_data._mem)->size()==0; } break; - case STRING_ARRAY: { + case POOL_STRING_ARRAY: { return reinterpret_cast<const PoolVector<String>*>(_data._mem)->size()==0; } break; - case VECTOR2_ARRAY: { + case POOL_VECTOR2_ARRAY: { return reinterpret_cast<const PoolVector<Vector2>*>(_data._mem)->size()==0; } break; - case VECTOR3_ARRAY: { + case POOL_VECTOR3_ARRAY: { return reinterpret_cast<const PoolVector<Vector3>*>(_data._mem)->size()==0; } break; - case COLOR_ARRAY: { + case POOL_COLOR_ARRAY: { return reinterpret_cast<const PoolVector<Color>*>(_data._mem)->size()==0; @@ -987,9 +987,9 @@ void Variant::reference(const Variant& p_variant) { memnew_placement( _data._mem, Rect2( *reinterpret_cast<const Rect2*>(p_variant._data._mem) ) ); } break; - case MATRIX32: { + case TRANSFORM2D: { - _data._matrix32 = memnew( Matrix32( *p_variant._data._matrix32 ) ); + _data._transform2d = memnew( Transform2D( *p_variant._data._transform2d ) ); } break; case VECTOR3: { @@ -1007,18 +1007,18 @@ void Variant::reference(const Variant& p_variant) { } break;*/ - case _AABB: { + case RECT3: { - _data._aabb = memnew( AABB( *p_variant._data._aabb ) ); + _data._rect3 = memnew( Rect3( *p_variant._data._rect3 ) ); } break; case QUAT: { memnew_placement( _data._mem, Quat( *reinterpret_cast<const Quat*>(p_variant._data._mem) ) ); } break; - case MATRIX3: { + case BASIS: { - _data._matrix3 = memnew( Matrix3( *p_variant._data._matrix3 ) ); + _data._basis = memnew( Basis( *p_variant._data._basis ) ); } break; case TRANSFORM: { @@ -1068,37 +1068,37 @@ void Variant::reference(const Variant& p_variant) { } break; // arrays - case RAW_ARRAY: { + case POOL_BYTE_ARRAY: { memnew_placement( _data._mem, PoolVector<uint8_t> ( *reinterpret_cast<const PoolVector<uint8_t>*>(p_variant._data._mem) ) ); } break; - case INT_ARRAY: { + case POOL_INT_ARRAY: { memnew_placement( _data._mem, PoolVector<int> ( *reinterpret_cast<const PoolVector<int>*>(p_variant._data._mem) ) ); } break; - case REAL_ARRAY: { + case POOL_REAL_ARRAY: { memnew_placement( _data._mem, PoolVector<real_t> ( *reinterpret_cast<const PoolVector<real_t>*>(p_variant._data._mem) ) ); } break; - case STRING_ARRAY: { + case POOL_STRING_ARRAY: { memnew_placement( _data._mem, PoolVector<String> ( *reinterpret_cast<const PoolVector<String>*>(p_variant._data._mem) ) ); } break; - case VECTOR2_ARRAY: { + case POOL_VECTOR2_ARRAY: { memnew_placement( _data._mem, PoolVector<Vector2> ( *reinterpret_cast<const PoolVector<Vector2>*>(p_variant._data._mem) ) ); } break; - case VECTOR3_ARRAY: { + case POOL_VECTOR3_ARRAY: { memnew_placement( _data._mem, PoolVector<Vector3> ( *reinterpret_cast<const PoolVector<Vector3>*>(p_variant._data._mem) ) ); } break; - case COLOR_ARRAY: { + case POOL_COLOR_ARRAY: { memnew_placement( _data._mem, PoolVector<Color> ( *reinterpret_cast<const PoolVector<Color>*>(p_variant._data._mem) ) ); @@ -1139,19 +1139,19 @@ void Variant::clear() { VECTOR2, RECT2 */ - case MATRIX32: { + case TRANSFORM2D: { - memdelete( _data._matrix32 ); + memdelete( _data._transform2d ); } break; - case _AABB: { + case RECT3: { - memdelete( _data._aabb ); + memdelete( _data._rect3 ); } break; - case MATRIX3: { + case BASIS: { - memdelete( _data._matrix3 ); + memdelete( _data._basis ); } break; case TRANSFORM: { @@ -1196,37 +1196,37 @@ void Variant::clear() { } break; // arrays - case RAW_ARRAY: { + case POOL_BYTE_ARRAY: { reinterpret_cast< PoolVector<uint8_t>* >(_data._mem)->~PoolVector<uint8_t>(); } break; - case INT_ARRAY: { + case POOL_INT_ARRAY: { reinterpret_cast< PoolVector<int>* >(_data._mem)->~PoolVector<int>(); } break; - case REAL_ARRAY: { + case POOL_REAL_ARRAY: { reinterpret_cast< PoolVector<real_t>* >(_data._mem)->~PoolVector<real_t>(); } break; - case STRING_ARRAY: { + case POOL_STRING_ARRAY: { reinterpret_cast< PoolVector<String>* >(_data._mem)->~PoolVector<String>(); } break; - case VECTOR2_ARRAY: { + case POOL_VECTOR2_ARRAY: { reinterpret_cast< PoolVector<Vector2>* >(_data._mem)->~PoolVector<Vector2>(); } break; - case VECTOR3_ARRAY: { + case POOL_VECTOR3_ARRAY: { reinterpret_cast< PoolVector<Vector3>* >(_data._mem)->~PoolVector<Vector3>(); } break; - case COLOR_ARRAY: { + case POOL_COLOR_ARRAY: { reinterpret_cast< PoolVector<Color>* >(_data._mem)->~PoolVector<Color>(); @@ -1509,19 +1509,19 @@ Variant::operator String() const { case STRING: return *reinterpret_cast<const String*>(_data._mem); case VECTOR2: return "("+operator Vector2()+")"; case RECT2: return "("+operator Rect2()+")"; - case MATRIX32: { + case TRANSFORM2D: { - Matrix32 mat32 = operator Matrix32(); + Transform2D mat32 = operator Transform2D(); return "("+Variant(mat32.elements[0]).operator String()+", "+Variant(mat32.elements[1]).operator String()+", "+Variant(mat32.elements[2]).operator String()+")"; } break; case VECTOR3: return "("+operator Vector3()+")"; case PLANE: return operator Plane(); //case QUAT: - case _AABB: return operator AABB(); + case RECT3: return operator Rect3(); case QUAT: return "("+operator Quat()+")"; - case MATRIX3: { + case BASIS: { - Matrix3 mat3 = operator Matrix3(); + Basis mat3 = operator Basis(); String mtx("("); for (int i=0;i<3;i++) { @@ -1576,7 +1576,7 @@ Variant::operator String() const { return str; } break; - case VECTOR2_ARRAY: { + case POOL_VECTOR2_ARRAY: { PoolVector<Vector2> vec = operator PoolVector<Vector2>(); String str("["); @@ -1589,7 +1589,7 @@ Variant::operator String() const { str += "]"; return str; } break; - case VECTOR3_ARRAY: { + case POOL_VECTOR3_ARRAY: { PoolVector<Vector3> vec = operator PoolVector<Vector3>(); String str("["); @@ -1602,7 +1602,7 @@ Variant::operator String() const { str += "]"; return str; } break; - case STRING_ARRAY: { + case POOL_STRING_ARRAY: { PoolVector<String> vec = operator PoolVector<String>(); String str("["); @@ -1615,7 +1615,7 @@ Variant::operator String() const { str += "]"; return str; } break; - case INT_ARRAY: { + case POOL_INT_ARRAY: { PoolVector<int> vec = operator PoolVector<int>(); String str("["); @@ -1628,7 +1628,7 @@ Variant::operator String() const { str += "]"; return str; } break; - case REAL_ARRAY: { + case POOL_REAL_ARRAY: { PoolVector<real_t> vec = operator PoolVector<real_t>(); String str("["); @@ -1713,32 +1713,32 @@ Variant::operator Plane() const { return Plane(); } -Variant::operator AABB() const { +Variant::operator Rect3() const { - if (type==_AABB) - return *_data._aabb; + if (type==RECT3) + return *_data._rect3; else - return AABB(); + return Rect3(); } -Variant::operator Matrix3() const { +Variant::operator Basis() const { - if (type==MATRIX3) - return *_data._matrix3; + if (type==BASIS) + return *_data._basis; else if (type==QUAT) return *reinterpret_cast<const Quat*>(_data._mem); else if (type==TRANSFORM) return _data._transform->basis; else - return Matrix3(); + return Basis(); } Variant::operator Quat() const { if (type==QUAT) return *reinterpret_cast<const Quat*>(_data._mem); - else if (type==MATRIX3) - return *_data._matrix3; + else if (type==BASIS) + return *_data._basis; else if (type==TRANSFORM) return _data._transform->basis; else @@ -1751,21 +1751,21 @@ Variant::operator Transform() const { if (type==TRANSFORM) return *_data._transform; - else if (type==MATRIX3) - return Transform(*_data._matrix3,Vector3()); + else if (type==BASIS) + return Transform(*_data._basis,Vector3()); else if (type==QUAT) - return Transform(Matrix3(*reinterpret_cast<const Quat*>(_data._mem)),Vector3()); + return Transform(Basis(*reinterpret_cast<const Quat*>(_data._mem)),Vector3()); else return Transform(); } - Variant::operator Matrix32() const { + Variant::operator Transform2D() const { - if (type==MATRIX32) { - return *_data._matrix32; + if (type==TRANSFORM2D) { + return *_data._transform2d; } else if (type==TRANSFORM) { const Transform& t = *_data._transform;; - Matrix32 m; + Transform2D m; m.elements[0][0]=t.basis.elements[0][0]; m.elements[0][1]=t.basis.elements[1][0]; m.elements[1][0]=t.basis.elements[0][1]; @@ -1774,7 +1774,7 @@ Variant::operator Transform() const { m.elements[2][1]=t.origin[1]; return m; } else - return Matrix32(); + return Transform2D(); } @@ -1893,13 +1893,13 @@ inline DA _convert_array_from_variant(const Variant& p_variant) { case Variant::ARRAY: { return _convert_array<DA,Array >( p_variant.operator Array () ); } - case Variant::RAW_ARRAY: { return _convert_array<DA,PoolVector<uint8_t> >( p_variant.operator PoolVector<uint8_t> () ); } - case Variant::INT_ARRAY: { return _convert_array<DA,PoolVector<int> >( p_variant.operator PoolVector<int> () ); } - case Variant::REAL_ARRAY: { return _convert_array<DA,PoolVector<real_t> >( p_variant.operator PoolVector<real_t> () ); } - case Variant::STRING_ARRAY: { return _convert_array<DA,PoolVector<String> >( p_variant.operator PoolVector<String> () ); } - case Variant::VECTOR2_ARRAY: { return _convert_array<DA,PoolVector<Vector2> >( p_variant.operator PoolVector<Vector2> () ); } - case Variant::VECTOR3_ARRAY: { return _convert_array<DA,PoolVector<Vector3> >( p_variant.operator PoolVector<Vector3> () ); } - case Variant::COLOR_ARRAY: { return _convert_array<DA,PoolVector<Color> >( p_variant.operator PoolVector<Color>() ); } + case Variant::POOL_BYTE_ARRAY: { return _convert_array<DA,PoolVector<uint8_t> >( p_variant.operator PoolVector<uint8_t> () ); } + case Variant::POOL_INT_ARRAY: { return _convert_array<DA,PoolVector<int> >( p_variant.operator PoolVector<int> () ); } + case Variant::POOL_REAL_ARRAY: { return _convert_array<DA,PoolVector<real_t> >( p_variant.operator PoolVector<real_t> () ); } + case Variant::POOL_STRING_ARRAY: { return _convert_array<DA,PoolVector<String> >( p_variant.operator PoolVector<String> () ); } + case Variant::POOL_VECTOR2_ARRAY: { return _convert_array<DA,PoolVector<Vector2> >( p_variant.operator PoolVector<Vector2> () ); } + case Variant::POOL_VECTOR3_ARRAY: { return _convert_array<DA,PoolVector<Vector3> >( p_variant.operator PoolVector<Vector3> () ); } + case Variant::POOL_COLOR_ARRAY: { return _convert_array<DA,PoolVector<Color> >( p_variant.operator PoolVector<Color>() ); } default: { return DA(); } } @@ -1916,14 +1916,14 @@ Variant::operator Array() const { Variant::operator PoolVector<uint8_t>() const { - if (type==RAW_ARRAY) + if (type==POOL_BYTE_ARRAY) return *reinterpret_cast<const PoolVector<uint8_t>* >(_data._mem); else return _convert_array_from_variant<PoolVector<uint8_t> >(*this); } Variant::operator PoolVector<int>() const { - if (type==INT_ARRAY) + if (type==POOL_INT_ARRAY) return *reinterpret_cast<const PoolVector<int>* >(_data._mem); else return _convert_array_from_variant<PoolVector<int> >(*this); @@ -1931,7 +1931,7 @@ Variant::operator PoolVector<int>() const { } Variant::operator PoolVector<real_t>() const { - if (type==REAL_ARRAY) + if (type==POOL_REAL_ARRAY) return *reinterpret_cast<const PoolVector<real_t>* >(_data._mem); else return _convert_array_from_variant<PoolVector<real_t> >(*this); @@ -1940,7 +1940,7 @@ Variant::operator PoolVector<real_t>() const { Variant::operator PoolVector<String>() const { - if (type==STRING_ARRAY) + if (type==POOL_STRING_ARRAY) return *reinterpret_cast<const PoolVector<String>* >(_data._mem); else return _convert_array_from_variant<PoolVector<String> >(*this); @@ -1949,7 +1949,7 @@ Variant::operator PoolVector<String>() const { } Variant::operator PoolVector<Vector3>() const { - if (type==VECTOR3_ARRAY) + if (type==POOL_VECTOR3_ARRAY) return *reinterpret_cast<const PoolVector<Vector3>* >(_data._mem); else return _convert_array_from_variant<PoolVector<Vector3> >(*this); @@ -1958,7 +1958,7 @@ Variant::operator PoolVector<Vector3>() const { } Variant::operator PoolVector<Vector2>() const { - if (type==VECTOR2_ARRAY) + if (type==POOL_VECTOR2_ARRAY) return *reinterpret_cast<const PoolVector<Vector2>* >(_data._mem); else return _convert_array_from_variant<PoolVector<Vector2> >(*this); @@ -1968,7 +1968,7 @@ Variant::operator PoolVector<Vector2>() const { Variant::operator PoolVector<Color>() const { - if (type==COLOR_ARRAY) + if (type==POOL_COLOR_ARRAY) return *reinterpret_cast<const PoolVector<Color>* >(_data._mem); else return _convert_array_from_variant<PoolVector<Color> >(*this); @@ -2165,7 +2165,7 @@ Variant::operator Orientation() const { Variant::operator IP_Address() const { - if (type==REAL_ARRAY || type==INT_ARRAY || type==RAW_ARRAY) { + if (type==POOL_REAL_ARRAY || type==POOL_INT_ARRAY || type==POOL_BYTE_ARRAY) { PoolVector<int> addr=operator PoolVector<int>(); if (addr.size()==4) { @@ -2320,16 +2320,16 @@ Variant::Variant(const Plane& p_plane) { memnew_placement( _data._mem, Plane( p_plane ) ); } -Variant::Variant(const AABB& p_aabb) { +Variant::Variant(const Rect3& p_aabb) { - type=_AABB; - _data._aabb = memnew( AABB( p_aabb ) ); + type=RECT3; + _data._rect3 = memnew( Rect3( p_aabb ) ); } -Variant::Variant(const Matrix3& p_matrix) { +Variant::Variant(const Basis& p_matrix) { - type=MATRIX3; - _data._matrix3= memnew( Matrix3( p_matrix ) ); + type=BASIS; + _data._basis= memnew( Basis( p_matrix ) ); } @@ -2346,10 +2346,10 @@ Variant::Variant(const Transform& p_transform) { } -Variant::Variant(const Matrix32& p_transform) { +Variant::Variant(const Transform2D& p_transform) { - type=MATRIX32; - _data._matrix32 = memnew( Matrix32( p_transform ) ); + type=TRANSFORM2D; + _data._transform2d = memnew( Transform2D( p_transform ) ); } Variant::Variant(const Color& p_color) { @@ -2483,44 +2483,44 @@ Variant::Variant(const Vector<Vector2>& p_array) { Variant::Variant(const PoolVector<uint8_t>& p_raw_array) { - type=RAW_ARRAY; + type=POOL_BYTE_ARRAY; memnew_placement( _data._mem, PoolVector<uint8_t>(p_raw_array) ); } Variant::Variant(const PoolVector<int>& p_int_array) { - type=INT_ARRAY; + type=POOL_INT_ARRAY; memnew_placement( _data._mem, PoolVector<int>(p_int_array) ); } Variant::Variant(const PoolVector<real_t>& p_real_array) { - type=REAL_ARRAY; + type=POOL_REAL_ARRAY; memnew_placement( _data._mem, PoolVector<real_t>(p_real_array) ); } Variant::Variant(const PoolVector<String>& p_string_array) { - type=STRING_ARRAY; + type=POOL_STRING_ARRAY; memnew_placement( _data._mem, PoolVector<String>(p_string_array) ); } Variant::Variant(const PoolVector<Vector3>& p_vector3_array) { - type=VECTOR3_ARRAY; + type=POOL_VECTOR3_ARRAY; memnew_placement( _data._mem, PoolVector<Vector3>(p_vector3_array) ); } Variant::Variant(const PoolVector<Vector2>& p_vector2_array) { - type=VECTOR2_ARRAY; + type=POOL_VECTOR2_ARRAY; memnew_placement( _data._mem, PoolVector<Vector2>(p_vector2_array) ); } Variant::Variant(const PoolVector<Color>& p_color_array) { - type=COLOR_ARRAY; + type=POOL_COLOR_ARRAY; memnew_placement( _data._mem, PoolVector<Color>(p_color_array) ); } @@ -2700,13 +2700,13 @@ uint32_t Variant::hash() const { hash = hash_djb2_one_float(reinterpret_cast<const Rect2*>(_data._mem)->size.x,hash); return hash_djb2_one_float(reinterpret_cast<const Rect2*>(_data._mem)->size.y,hash); } break; - case MATRIX32: { + case TRANSFORM2D: { uint32_t hash = 5831; for(int i=0;i<3;i++) { for(int j=0;j<2;j++) { - hash = hash_djb2_one_float(_data._matrix32->elements[i][j],hash); + hash = hash_djb2_one_float(_data._transform2d->elements[i][j],hash); } } @@ -2731,13 +2731,13 @@ uint32_t Variant::hash() const { } break;*/ - case _AABB: { + case RECT3: { uint32_t hash = 5831; for(int i=0;i<3;i++) { - hash = hash_djb2_one_float(_data._aabb->pos[i],hash); - hash = hash_djb2_one_float(_data._aabb->size[i],hash); + hash = hash_djb2_one_float(_data._rect3->pos[i],hash); + hash = hash_djb2_one_float(_data._rect3->size[i],hash); } @@ -2752,13 +2752,13 @@ uint32_t Variant::hash() const { return hash_djb2_one_float(reinterpret_cast<const Quat*>(_data._mem)->w,hash); } break; - case MATRIX3: { + case BASIS: { uint32_t hash = 5831; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { - hash = hash_djb2_one_float(_data._matrix3->elements[i][j],hash); + hash = hash_djb2_one_float(_data._basis->elements[i][j],hash); } } @@ -2824,7 +2824,7 @@ uint32_t Variant::hash() const { return arr.hash(); } break; - case RAW_ARRAY: { + case POOL_BYTE_ARRAY: { const PoolVector<uint8_t>& arr = *reinterpret_cast<const PoolVector<uint8_t>* >(_data._mem); int len = arr.size(); @@ -2833,7 +2833,7 @@ uint32_t Variant::hash() const { return hash_djb2_buffer((uint8_t*)&r[0],len); } break; - case INT_ARRAY: { + case POOL_INT_ARRAY: { const PoolVector<int>& arr = *reinterpret_cast<const PoolVector<int>* >(_data._mem); int len = arr.size(); @@ -2842,7 +2842,7 @@ uint32_t Variant::hash() const { return hash_djb2_buffer((uint8_t*)&r[0],len*sizeof(int)); } break; - case REAL_ARRAY: { + case POOL_REAL_ARRAY: { const PoolVector<real_t>& arr = *reinterpret_cast<const PoolVector<real_t>* >(_data._mem); int len = arr.size(); @@ -2851,7 +2851,7 @@ uint32_t Variant::hash() const { return hash_djb2_buffer((uint8_t*)&r[0],len*sizeof(real_t)); } break; - case STRING_ARRAY: { + case POOL_STRING_ARRAY: { uint32_t hash=5831; const PoolVector<String>& arr = *reinterpret_cast<const PoolVector<String>* >(_data._mem); @@ -2864,7 +2864,7 @@ uint32_t Variant::hash() const { return hash; } break; - case VECTOR2_ARRAY: { + case POOL_VECTOR2_ARRAY: { uint32_t hash=5831; const PoolVector<Vector2>& arr = *reinterpret_cast<const PoolVector<Vector2>* >(_data._mem); @@ -2879,7 +2879,7 @@ uint32_t Variant::hash() const { return hash; } break; - case VECTOR3_ARRAY: { + case POOL_VECTOR3_ARRAY: { uint32_t hash=5831; const PoolVector<Vector3>& arr = *reinterpret_cast<const PoolVector<Vector3>* >(_data._mem); @@ -2895,7 +2895,7 @@ uint32_t Variant::hash() const { return hash; } break; - case COLOR_ARRAY: { + case POOL_COLOR_ARRAY: { uint32_t hash=5831; const PoolVector<Color>& arr = *reinterpret_cast<const PoolVector<Color>* >(_data._mem); diff --git a/core/variant.h b/core/variant.h index 764ba9ae60..9d29fd64c3 100644 --- a/core/variant.h +++ b/core/variant.h @@ -63,13 +63,13 @@ struct PropertyInfo; struct MethodInfo; -typedef PoolVector<uint8_t> ByteArray; -typedef PoolVector<int> IntArray; -typedef PoolVector<real_t> RealArray; -typedef PoolVector<String> StringArray; -typedef PoolVector<Vector2> Vector2Array; -typedef PoolVector<Vector3> Vector3Array; -typedef PoolVector<Color> ColorArray; +typedef PoolVector<uint8_t> PoolByteArray; +typedef PoolVector<int> PoolIntArray; +typedef PoolVector<real_t> PoolRealArray; +typedef PoolVector<String> PoolStringArray; +typedef PoolVector<Vector2> PoolVector2Array; +typedef PoolVector<Vector3> PoolVector3Array; +typedef PoolVector<Color> PoolColorArray; class Variant { public: @@ -89,11 +89,11 @@ public: VECTOR2, // 5 RECT2, VECTOR3, - MATRIX32, + TRANSFORM2D, PLANE, QUAT, // 10 - _AABB, //sorry naming convention fail :( not like it's used often - MATRIX3, + RECT3, //sorry naming convention fail :( not like it's used often + BASIS, TRANSFORM, // misc types @@ -107,13 +107,13 @@ public: ARRAY, // arrays - RAW_ARRAY, - INT_ARRAY, - REAL_ARRAY, - STRING_ARRAY, // 25 - VECTOR2_ARRAY, - VECTOR3_ARRAY, - COLOR_ARRAY, + POOL_BYTE_ARRAY, + POOL_INT_ARRAY, + POOL_REAL_ARRAY, + POOL_STRING_ARRAY, // 25 + POOL_VECTOR2_ARRAY, + POOL_VECTOR3_ARRAY, + POOL_COLOR_ARRAY, VARIANT_MAX @@ -143,9 +143,9 @@ private: bool _bool; int64_t _int; double _real; - Matrix32 *_matrix32; - AABB* _aabb; - Matrix3 *_matrix3; + Transform2D *_transform2d; + Rect3* _rect3; + Basis *_basis; Transform *_transform; RefPtr *_resource; InputEvent *_input_event; @@ -208,11 +208,11 @@ public: operator Rect2() const; operator Vector3() const; operator Plane() const; - operator AABB() const; + operator Rect3() const; operator Quat() const; - operator Matrix3() const; + operator Basis() const; operator Transform() const; - operator Matrix32() const; + operator Transform2D() const; operator Color() const; operator Image() const; @@ -280,10 +280,10 @@ public: Variant(const Rect2& p_rect2); Variant(const Vector3& p_vector3); Variant(const Plane& p_plane); - Variant(const AABB& p_aabb); + Variant(const Rect3& p_aabb); Variant(const Quat& p_quat); - Variant(const Matrix3& p_transform); - Variant(const Matrix32& p_transform); + Variant(const Basis& p_transform); + Variant(const Transform2D& p_transform); Variant(const Transform& p_transform); Variant(const Color& p_color); Variant(const Image& p_image); diff --git a/core/variant_call.cpp b/core/variant_call.cpp index d6fb78ee56..9a61dd73df 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -310,10 +310,10 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var String *s = reinterpret_cast<String*>(p_self._data._mem); CharString charstr = s->ascii(); - ByteArray retval; + PoolByteArray retval; size_t len = charstr.length(); retval.resize(len); - ByteArray::Write w = retval.write(); + PoolByteArray::Write w = retval.write(); copymem(w.ptr(), charstr.ptr(), len); w = PoolVector<uint8_t>::Write(); @@ -325,10 +325,10 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var String *s = reinterpret_cast<String*>(p_self._data._mem); CharString charstr = s->utf8(); - ByteArray retval; + PoolByteArray retval; size_t len = charstr.length(); retval.resize(len); - ByteArray::Write w = retval.write(); + PoolByteArray::Write w = retval.write(); copymem(w.ptr(), charstr.ptr(), len); w = PoolVector<uint8_t>::Write(); @@ -491,12 +491,12 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM0(Array,invert); VCALL_LOCALMEM0R(Array,is_shared); - static void _call_ByteArray_get_string_from_ascii(Variant& r_ret,Variant& p_self,const Variant** p_args) { + static void _call_PoolByteArray_get_string_from_ascii(Variant& r_ret,Variant& p_self,const Variant** p_args) { - ByteArray* ba = reinterpret_cast<ByteArray*>(p_self._data._mem); + PoolByteArray* ba = reinterpret_cast<PoolByteArray*>(p_self._data._mem); String s; if (ba->size()>=0) { - ByteArray::Read r = ba->read(); + PoolByteArray::Read r = ba->read(); CharString cs; cs.resize(ba->size()+1); copymem(cs.ptr(),r.ptr(),ba->size()); @@ -507,94 +507,94 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var r_ret=s; } - static void _call_ByteArray_get_string_from_utf8(Variant& r_ret,Variant& p_self,const Variant** p_args) { + static void _call_PoolByteArray_get_string_from_utf8(Variant& r_ret,Variant& p_self,const Variant** p_args) { - ByteArray* ba = reinterpret_cast<ByteArray*>(p_self._data._mem); + PoolByteArray* ba = reinterpret_cast<PoolByteArray*>(p_self._data._mem); String s; if (ba->size()>=0) { - ByteArray::Read r = ba->read(); + PoolByteArray::Read r = ba->read(); s.parse_utf8((const char*)r.ptr(),ba->size()); } r_ret=s; } - VCALL_LOCALMEM0R(ByteArray,size); - VCALL_LOCALMEM2(ByteArray,set); - VCALL_LOCALMEM1R(ByteArray,get); - VCALL_LOCALMEM1(ByteArray,push_back); - VCALL_LOCALMEM1(ByteArray,resize); - VCALL_LOCALMEM2R(ByteArray,insert); - VCALL_LOCALMEM1(ByteArray,remove); - VCALL_LOCALMEM1(ByteArray,append); - VCALL_LOCALMEM1(ByteArray,append_array); - VCALL_LOCALMEM0(ByteArray,invert); - VCALL_LOCALMEM2R(ByteArray,subarray); - - VCALL_LOCALMEM0R(IntArray,size); - VCALL_LOCALMEM2(IntArray,set); - VCALL_LOCALMEM1R(IntArray,get); - VCALL_LOCALMEM1(IntArray,push_back); - VCALL_LOCALMEM1(IntArray,resize); - VCALL_LOCALMEM2R(IntArray,insert); - VCALL_LOCALMEM1(IntArray,remove); - VCALL_LOCALMEM1(IntArray,append); - VCALL_LOCALMEM1(IntArray,append_array); - VCALL_LOCALMEM0(IntArray,invert); - - VCALL_LOCALMEM0R(RealArray,size); - VCALL_LOCALMEM2(RealArray,set); - VCALL_LOCALMEM1R(RealArray,get); - VCALL_LOCALMEM1(RealArray,push_back); - VCALL_LOCALMEM1(RealArray,resize); - VCALL_LOCALMEM2R(RealArray,insert); - VCALL_LOCALMEM1(RealArray,remove); - VCALL_LOCALMEM1(RealArray,append); - VCALL_LOCALMEM1(RealArray,append_array); - VCALL_LOCALMEM0(RealArray,invert); - - VCALL_LOCALMEM0R(StringArray,size); - VCALL_LOCALMEM2(StringArray,set); - VCALL_LOCALMEM1R(StringArray,get); - VCALL_LOCALMEM1(StringArray,push_back); - VCALL_LOCALMEM1(StringArray,resize); - VCALL_LOCALMEM2R(StringArray,insert); - VCALL_LOCALMEM1(StringArray,remove); - VCALL_LOCALMEM1(StringArray,append); - VCALL_LOCALMEM1(StringArray,append_array); - VCALL_LOCALMEM0(StringArray,invert); - - VCALL_LOCALMEM0R(Vector2Array,size); - VCALL_LOCALMEM2(Vector2Array,set); - VCALL_LOCALMEM1R(Vector2Array,get); - VCALL_LOCALMEM1(Vector2Array,push_back); - VCALL_LOCALMEM1(Vector2Array,resize); - VCALL_LOCALMEM2R(Vector2Array,insert); - VCALL_LOCALMEM1(Vector2Array,remove); - VCALL_LOCALMEM1(Vector2Array,append); - VCALL_LOCALMEM1(Vector2Array,append_array); - VCALL_LOCALMEM0(Vector2Array,invert); - - VCALL_LOCALMEM0R(Vector3Array,size); - VCALL_LOCALMEM2(Vector3Array,set); - VCALL_LOCALMEM1R(Vector3Array,get); - VCALL_LOCALMEM1(Vector3Array,push_back); - VCALL_LOCALMEM1(Vector3Array,resize); - VCALL_LOCALMEM2R(Vector3Array,insert); - VCALL_LOCALMEM1(Vector3Array,remove); - VCALL_LOCALMEM1(Vector3Array,append); - VCALL_LOCALMEM1(Vector3Array,append_array); - VCALL_LOCALMEM0(Vector3Array,invert); - - VCALL_LOCALMEM0R(ColorArray,size); - VCALL_LOCALMEM2(ColorArray,set); - VCALL_LOCALMEM1R(ColorArray,get); - VCALL_LOCALMEM1(ColorArray,push_back); - VCALL_LOCALMEM1(ColorArray,resize); - VCALL_LOCALMEM2R(ColorArray,insert); - VCALL_LOCALMEM1(ColorArray,remove); - VCALL_LOCALMEM1(ColorArray,append); - VCALL_LOCALMEM1(ColorArray,append_array); - VCALL_LOCALMEM0(ColorArray,invert); + VCALL_LOCALMEM0R(PoolByteArray,size); + VCALL_LOCALMEM2(PoolByteArray,set); + VCALL_LOCALMEM1R(PoolByteArray,get); + VCALL_LOCALMEM1(PoolByteArray,push_back); + VCALL_LOCALMEM1(PoolByteArray,resize); + VCALL_LOCALMEM2R(PoolByteArray,insert); + VCALL_LOCALMEM1(PoolByteArray,remove); + VCALL_LOCALMEM1(PoolByteArray,append); + VCALL_LOCALMEM1(PoolByteArray,append_array); + VCALL_LOCALMEM0(PoolByteArray,invert); + VCALL_LOCALMEM2R(PoolByteArray,subarray); + + VCALL_LOCALMEM0R(PoolIntArray,size); + VCALL_LOCALMEM2(PoolIntArray,set); + VCALL_LOCALMEM1R(PoolIntArray,get); + VCALL_LOCALMEM1(PoolIntArray,push_back); + VCALL_LOCALMEM1(PoolIntArray,resize); + VCALL_LOCALMEM2R(PoolIntArray,insert); + VCALL_LOCALMEM1(PoolIntArray,remove); + VCALL_LOCALMEM1(PoolIntArray,append); + VCALL_LOCALMEM1(PoolIntArray,append_array); + VCALL_LOCALMEM0(PoolIntArray,invert); + + VCALL_LOCALMEM0R(PoolRealArray,size); + VCALL_LOCALMEM2(PoolRealArray,set); + VCALL_LOCALMEM1R(PoolRealArray,get); + VCALL_LOCALMEM1(PoolRealArray,push_back); + VCALL_LOCALMEM1(PoolRealArray,resize); + VCALL_LOCALMEM2R(PoolRealArray,insert); + VCALL_LOCALMEM1(PoolRealArray,remove); + VCALL_LOCALMEM1(PoolRealArray,append); + VCALL_LOCALMEM1(PoolRealArray,append_array); + VCALL_LOCALMEM0(PoolRealArray,invert); + + VCALL_LOCALMEM0R(PoolStringArray,size); + VCALL_LOCALMEM2(PoolStringArray,set); + VCALL_LOCALMEM1R(PoolStringArray,get); + VCALL_LOCALMEM1(PoolStringArray,push_back); + VCALL_LOCALMEM1(PoolStringArray,resize); + VCALL_LOCALMEM2R(PoolStringArray,insert); + VCALL_LOCALMEM1(PoolStringArray,remove); + VCALL_LOCALMEM1(PoolStringArray,append); + VCALL_LOCALMEM1(PoolStringArray,append_array); + VCALL_LOCALMEM0(PoolStringArray,invert); + + VCALL_LOCALMEM0R(PoolVector2Array,size); + VCALL_LOCALMEM2(PoolVector2Array,set); + VCALL_LOCALMEM1R(PoolVector2Array,get); + VCALL_LOCALMEM1(PoolVector2Array,push_back); + VCALL_LOCALMEM1(PoolVector2Array,resize); + VCALL_LOCALMEM2R(PoolVector2Array,insert); + VCALL_LOCALMEM1(PoolVector2Array,remove); + VCALL_LOCALMEM1(PoolVector2Array,append); + VCALL_LOCALMEM1(PoolVector2Array,append_array); + VCALL_LOCALMEM0(PoolVector2Array,invert); + + VCALL_LOCALMEM0R(PoolVector3Array,size); + VCALL_LOCALMEM2(PoolVector3Array,set); + VCALL_LOCALMEM1R(PoolVector3Array,get); + VCALL_LOCALMEM1(PoolVector3Array,push_back); + VCALL_LOCALMEM1(PoolVector3Array,resize); + VCALL_LOCALMEM2R(PoolVector3Array,insert); + VCALL_LOCALMEM1(PoolVector3Array,remove); + VCALL_LOCALMEM1(PoolVector3Array,append); + VCALL_LOCALMEM1(PoolVector3Array,append_array); + VCALL_LOCALMEM0(PoolVector3Array,invert); + + VCALL_LOCALMEM0R(PoolColorArray,size); + VCALL_LOCALMEM2(PoolColorArray,set); + VCALL_LOCALMEM1R(PoolColorArray,get); + VCALL_LOCALMEM1(PoolColorArray,push_back); + VCALL_LOCALMEM1(PoolColorArray,resize); + VCALL_LOCALMEM2R(PoolColorArray,insert); + VCALL_LOCALMEM1(PoolColorArray,remove); + VCALL_LOCALMEM1(PoolColorArray,append); + VCALL_LOCALMEM1(PoolColorArray,append_array); + VCALL_LOCALMEM0(PoolColorArray,invert); #define VCALL_PTR0(m_type,m_method)\ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(); } @@ -637,93 +637,93 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_PTR1R(Image, converted); VCALL_PTR0(Image, fix_alpha_edges); - VCALL_PTR0R( AABB, get_area ); - VCALL_PTR0R( AABB, has_no_area ); - VCALL_PTR0R( AABB, has_no_surface ); - VCALL_PTR1R( AABB, intersects ); - VCALL_PTR1R( AABB, encloses ); - VCALL_PTR1R( AABB, merge ); - VCALL_PTR1R( AABB, intersection ); - VCALL_PTR1R( AABB, intersects_plane ); - VCALL_PTR2R( AABB, intersects_segment ); - VCALL_PTR1R( AABB, has_point ); - VCALL_PTR1R( AABB, get_support ); - VCALL_PTR0R( AABB, get_longest_axis ); - VCALL_PTR0R( AABB, get_longest_axis_index ); - VCALL_PTR0R( AABB, get_longest_axis_size ); - VCALL_PTR0R( AABB, get_shortest_axis ); - VCALL_PTR0R( AABB, get_shortest_axis_index ); - VCALL_PTR0R( AABB, get_shortest_axis_size ); - VCALL_PTR1R( AABB, expand ); - VCALL_PTR1R( AABB, grow ); - VCALL_PTR1R( AABB, get_endpoint ); - - VCALL_PTR0R( Matrix32, inverse ); - VCALL_PTR0R( Matrix32, affine_inverse ); - VCALL_PTR0R( Matrix32, get_rotation ); - VCALL_PTR0R( Matrix32, get_origin ); - VCALL_PTR0R( Matrix32, get_scale ); - VCALL_PTR0R( Matrix32, orthonormalized ); - VCALL_PTR1R( Matrix32, rotated ); - VCALL_PTR1R( Matrix32, scaled ); - VCALL_PTR1R( Matrix32, translated ); - VCALL_PTR2R( Matrix32, interpolate_with ); - - static void _call_Matrix32_xform(Variant& r_ret,Variant& p_self,const Variant** p_args) { + VCALL_PTR0R( Rect3, get_area ); + VCALL_PTR0R( Rect3, has_no_area ); + VCALL_PTR0R( Rect3, has_no_surface ); + VCALL_PTR1R( Rect3, intersects ); + VCALL_PTR1R( Rect3, encloses ); + VCALL_PTR1R( Rect3, merge ); + VCALL_PTR1R( Rect3, intersection ); + VCALL_PTR1R( Rect3, intersects_plane ); + VCALL_PTR2R( Rect3, intersects_segment ); + VCALL_PTR1R( Rect3, has_point ); + VCALL_PTR1R( Rect3, get_support ); + VCALL_PTR0R( Rect3, get_longest_axis ); + VCALL_PTR0R( Rect3, get_longest_axis_index ); + VCALL_PTR0R( Rect3, get_longest_axis_size ); + VCALL_PTR0R( Rect3, get_shortest_axis ); + VCALL_PTR0R( Rect3, get_shortest_axis_index ); + VCALL_PTR0R( Rect3, get_shortest_axis_size ); + VCALL_PTR1R( Rect3, expand ); + VCALL_PTR1R( Rect3, grow ); + VCALL_PTR1R( Rect3, get_endpoint ); + + VCALL_PTR0R( Transform2D, inverse ); + VCALL_PTR0R( Transform2D, affine_inverse ); + VCALL_PTR0R( Transform2D, get_rotation ); + VCALL_PTR0R( Transform2D, get_origin ); + VCALL_PTR0R( Transform2D, get_scale ); + VCALL_PTR0R( Transform2D, orthonormalized ); + VCALL_PTR1R( Transform2D, rotated ); + VCALL_PTR1R( Transform2D, scaled ); + VCALL_PTR1R( Transform2D, translated ); + VCALL_PTR2R( Transform2D, interpolate_with ); + + static void _call_Transform2D_xform(Variant& r_ret,Variant& p_self,const Variant** p_args) { switch(p_args[0]->type) { - case Variant::VECTOR2: r_ret=reinterpret_cast<Matrix32*>(p_self._data._ptr)->xform( p_args[0]->operator Vector2()); return; - case Variant::RECT2: r_ret=reinterpret_cast<Matrix32*>(p_self._data._ptr)->xform( p_args[0]->operator Rect2()); return; + case Variant::VECTOR2: r_ret=reinterpret_cast<Transform2D*>(p_self._data._ptr)->xform( p_args[0]->operator Vector2()); return; + case Variant::RECT2: r_ret=reinterpret_cast<Transform2D*>(p_self._data._ptr)->xform( p_args[0]->operator Rect2()); return; default: r_ret=Variant(); } } - static void _call_Matrix32_xform_inv(Variant& r_ret,Variant& p_self,const Variant** p_args) { + static void _call_Transform2D_xform_inv(Variant& r_ret,Variant& p_self,const Variant** p_args) { switch(p_args[0]->type) { - case Variant::VECTOR2: r_ret=reinterpret_cast<Matrix32*>(p_self._data._ptr)->xform_inv( p_args[0]->operator Vector2()); return; - case Variant::RECT2: r_ret=reinterpret_cast<Matrix32*>(p_self._data._ptr)->xform_inv( p_args[0]->operator Rect2()); return; + case Variant::VECTOR2: r_ret=reinterpret_cast<Transform2D*>(p_self._data._ptr)->xform_inv( p_args[0]->operator Vector2()); return; + case Variant::RECT2: r_ret=reinterpret_cast<Transform2D*>(p_self._data._ptr)->xform_inv( p_args[0]->operator Rect2()); return; default: r_ret=Variant(); } } - static void _call_Matrix32_basis_xform(Variant& r_ret,Variant& p_self,const Variant** p_args) { + static void _call_Transform2D_basis_xform(Variant& r_ret,Variant& p_self,const Variant** p_args) { switch(p_args[0]->type) { - case Variant::VECTOR2: r_ret=reinterpret_cast<Matrix32*>(p_self._data._ptr)->basis_xform( p_args[0]->operator Vector2()); return; + case Variant::VECTOR2: r_ret=reinterpret_cast<Transform2D*>(p_self._data._ptr)->basis_xform( p_args[0]->operator Vector2()); return; default: r_ret=Variant(); } } - static void _call_Matrix32_basis_xform_inv(Variant& r_ret,Variant& p_self,const Variant** p_args) { + static void _call_Transform2D_basis_xform_inv(Variant& r_ret,Variant& p_self,const Variant** p_args) { switch(p_args[0]->type) { - case Variant::VECTOR2: r_ret=reinterpret_cast<Matrix32*>(p_self._data._ptr)->basis_xform_inv( p_args[0]->operator Vector2()); return; + case Variant::VECTOR2: r_ret=reinterpret_cast<Transform2D*>(p_self._data._ptr)->basis_xform_inv( p_args[0]->operator Vector2()); return; default: r_ret=Variant(); } } - VCALL_PTR0R( Matrix3, inverse ); - VCALL_PTR0R( Matrix3, transposed ); - VCALL_PTR0R( Matrix3, determinant ); - VCALL_PTR2R( Matrix3, rotated ); - VCALL_PTR1R( Matrix3, scaled ); - VCALL_PTR0R( Matrix3, get_scale ); - VCALL_PTR0R( Matrix3, get_euler ); - VCALL_PTR1R( Matrix3, tdotx ); - VCALL_PTR1R( Matrix3, tdoty ); - VCALL_PTR1R( Matrix3, tdotz ); - VCALL_PTR1R( Matrix3, xform ); - VCALL_PTR1R( Matrix3, xform_inv ); - VCALL_PTR0R( Matrix3, get_orthogonal_index ); - VCALL_PTR0R( Matrix3, orthonormalized ); + VCALL_PTR0R( Basis, inverse ); + VCALL_PTR0R( Basis, transposed ); + VCALL_PTR0R( Basis, determinant ); + VCALL_PTR2R( Basis, rotated ); + VCALL_PTR1R( Basis, scaled ); + VCALL_PTR0R( Basis, get_scale ); + VCALL_PTR0R( Basis, get_euler ); + VCALL_PTR1R( Basis, tdotx ); + VCALL_PTR1R( Basis, tdoty ); + VCALL_PTR1R( Basis, tdotz ); + VCALL_PTR1R( Basis, xform ); + VCALL_PTR1R( Basis, xform_inv ); + VCALL_PTR0R( Basis, get_orthogonal_index ); + VCALL_PTR0R( Basis, orthonormalized ); VCALL_PTR0R( Transform, inverse ); @@ -740,7 +740,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var case Variant::VECTOR3: r_ret=reinterpret_cast<Transform*>(p_self._data._ptr)->xform( p_args[0]->operator Vector3()); return; case Variant::PLANE: r_ret=reinterpret_cast<Transform*>(p_self._data._ptr)->xform( p_args[0]->operator Plane()); return; - case Variant::_AABB: r_ret=reinterpret_cast<Transform*>(p_self._data._ptr)->xform( p_args[0]->operator AABB()); return; + case Variant::RECT3: r_ret=reinterpret_cast<Transform*>(p_self._data._ptr)->xform( p_args[0]->operator Rect3()); return; default: r_ret=Variant(); } @@ -752,7 +752,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var case Variant::VECTOR3: r_ret=reinterpret_cast<Transform*>(p_self._data._ptr)->xform_inv( p_args[0]->operator Vector3()); return; case Variant::PLANE: r_ret=reinterpret_cast<Transform*>(p_self._data._ptr)->xform_inv( p_args[0]->operator Plane()); return; - case Variant::_AABB: r_ret=reinterpret_cast<Transform*>(p_self._data._ptr)->xform_inv( p_args[0]->operator AABB()); return; + case Variant::RECT3: r_ret=reinterpret_cast<Transform*>(p_self._data._ptr)->xform_inv( p_args[0]->operator Rect3()); return; default: r_ret=Variant(); } } @@ -804,15 +804,15 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var r_ret=Rect2(*p_args[0],*p_args[1],*p_args[2],*p_args[3]); } - static void Matrix32_init2(Variant& r_ret,const Variant** p_args) { + static void Transform2D_init2(Variant& r_ret,const Variant** p_args) { - Matrix32 m(*p_args[0], *p_args[1]); + Transform2D m(*p_args[0], *p_args[1]); r_ret=m; } - static void Matrix32_init3(Variant& r_ret,const Variant** p_args) { + static void Transform2D_init3(Variant& r_ret,const Variant** p_args) { - Matrix32 m; + Transform2D m; m[0]=*p_args[0]; m[1]=*p_args[1]; m[2]=*p_args[2]; @@ -873,23 +873,23 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var r_ret=Color::hex(*p_args[0]); } - static void AABB_init1(Variant& r_ret,const Variant** p_args) { + static void Rect3_init1(Variant& r_ret,const Variant** p_args) { - r_ret=AABB(*p_args[0],*p_args[1]); + r_ret=Rect3(*p_args[0],*p_args[1]); } - static void Matrix3_init1(Variant& r_ret,const Variant** p_args) { + static void Basis_init1(Variant& r_ret,const Variant** p_args) { - Matrix3 m; + Basis m; m.set_axis(0,*p_args[0]); m.set_axis(1,*p_args[1]); m.set_axis(2,*p_args[2]); r_ret=m; } - static void Matrix3_init2(Variant& r_ret,const Variant** p_args) { + static void Basis_init2(Variant& r_ret,const Variant** p_args) { - r_ret=Matrix3(p_args[0]->operator Vector3(),p_args[1]->operator real_t()); + r_ret=Basis(p_args[0]->operator Vector3(),p_args[1]->operator real_t()); } static void Transform_init1(Variant& r_ret,const Variant** p_args) { @@ -904,7 +904,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var static void Transform_init2(Variant& r_ret,const Variant** p_args) { - r_ret=Transform(p_args[0]->operator Matrix3(),p_args[1]->operator Vector3()); + r_ret=Transform(p_args[0]->operator Basis(),p_args[1]->operator Vector3()); } static void Image_init1(Variant& r_ret, const Variant** p_args) { @@ -1054,11 +1054,11 @@ Variant Variant::construct(const Variant::Type p_type, const Variant** p_args, i case VECTOR2: return Vector2(); // 5 case RECT2: return Rect2(); case VECTOR3: return Vector3(); - case MATRIX32: return Matrix32(); + case TRANSFORM2D: return Transform2D(); case PLANE: return Plane(); case QUAT: return Quat(); - case _AABB: return AABB(); //sorry naming convention fail :( not like it's used often // 10 - case MATRIX3: return Matrix3(); + case RECT3: return Rect3(); //sorry naming convention fail :( not like it's used often // 10 + case BASIS: return Basis(); case TRANSFORM: return Transform(); // misc types @@ -1070,13 +1070,13 @@ Variant Variant::construct(const Variant::Type p_type, const Variant** p_args, i case INPUT_EVENT: return InputEvent();; case DICTIONARY: return Dictionary();; case ARRAY: return Array();; // 20 - case RAW_ARRAY: return ByteArray();; - case INT_ARRAY: return IntArray();; - case REAL_ARRAY: return RealArray();; - case STRING_ARRAY: return StringArray();; - case VECTOR2_ARRAY: return Vector2Array();; // 25 - case VECTOR3_ARRAY: return Vector3Array();; // 25 - case COLOR_ARRAY: return ColorArray();; + case POOL_BYTE_ARRAY: return PoolByteArray();; + case POOL_INT_ARRAY: return PoolIntArray();; + case POOL_REAL_ARRAY: return PoolRealArray();; + case POOL_STRING_ARRAY: return PoolStringArray();; + case POOL_VECTOR2_ARRAY: return PoolVector2Array();; // 25 + case POOL_VECTOR3_ARRAY: return PoolVector3Array();; // 25 + case POOL_COLOR_ARRAY: return PoolColorArray();; default: return Variant(); } @@ -1125,8 +1125,8 @@ Variant Variant::construct(const Variant::Type p_type, const Variant** p_args, i case VECTOR3: return (Vector3(*p_args[0])); case PLANE: return (Plane(*p_args[0])); case QUAT: return (Quat(*p_args[0])); - case _AABB: return (AABB(*p_args[0])); //sorry naming convention fail :( not like it's used often // 10 - case MATRIX3: return (Matrix3(p_args[0]->operator Matrix3())); + case RECT3: return (Rect3(*p_args[0])); //sorry naming convention fail :( not like it's used often // 10 + case BASIS: return (Basis(p_args[0]->operator Basis())); case TRANSFORM: return (Transform(p_args[0]->operator Transform())); // misc types @@ -1140,13 +1140,13 @@ Variant Variant::construct(const Variant::Type p_type, const Variant** p_args, i case ARRAY: return p_args[0]->operator Array(); // arrays - case RAW_ARRAY: return (ByteArray(*p_args[0])); - case INT_ARRAY: return (IntArray(*p_args[0])); - case REAL_ARRAY: return (RealArray(*p_args[0])); - case STRING_ARRAY: return (StringArray(*p_args[0])); - case VECTOR2_ARRAY: return (Vector2Array(*p_args[0])); // 25 - case VECTOR3_ARRAY: return (Vector3Array(*p_args[0])); // 25 - case COLOR_ARRAY: return (ColorArray(*p_args[0])); + case POOL_BYTE_ARRAY: return (PoolByteArray(*p_args[0])); + case POOL_INT_ARRAY: return (PoolIntArray(*p_args[0])); + case POOL_REAL_ARRAY: return (PoolRealArray(*p_args[0])); + case POOL_STRING_ARRAY: return (PoolStringArray(*p_args[0])); + case POOL_VECTOR2_ARRAY: return (PoolVector2Array(*p_args[0])); // 25 + case POOL_VECTOR3_ARRAY: return (PoolVector3Array(*p_args[0])); // 25 + case POOL_COLOR_ARRAY: return (PoolColorArray(*p_args[0])); default: return Variant(); } } @@ -1389,15 +1389,15 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC1(STRING,BOOL,String,ends_with,STRING,"text",varray()); ADDFUNC1(STRING,BOOL,String,is_subsequence_of,STRING,"text",varray()); ADDFUNC1(STRING,BOOL,String,is_subsequence_ofi,STRING,"text",varray()); - ADDFUNC0(STRING,STRING_ARRAY,String,bigrams,varray()); + ADDFUNC0(STRING,POOL_STRING_ARRAY,String,bigrams,varray()); ADDFUNC1(STRING,REAL,String,similarity,STRING,"text",varray()); ADDFUNC2(STRING,STRING,String,replace,STRING,"what",STRING,"forwhat",varray()); ADDFUNC2(STRING,STRING,String,replacen,STRING,"what",STRING,"forwhat",varray()); ADDFUNC2(STRING,STRING,String,insert,INT,"pos",STRING,"what",varray()); ADDFUNC0(STRING,STRING,String,capitalize,varray()); - ADDFUNC2(STRING,STRING_ARRAY,String,split,STRING,"divisor",BOOL,"allow_empty",varray(true)); - ADDFUNC2(STRING,REAL_ARRAY,String,split_floats,STRING,"divisor",BOOL,"allow_empty",varray(true)); + ADDFUNC2(STRING,POOL_STRING_ARRAY,String,split,STRING,"divisor",BOOL,"allow_empty",varray(true)); + ADDFUNC2(STRING,POOL_REAL_ARRAY,String,split_floats,STRING,"divisor",BOOL,"allow_empty",varray(true)); ADDFUNC0(STRING,STRING,String,to_upper,varray()); ADDFUNC0(STRING,STRING,String,to_lower,varray()); @@ -1413,8 +1413,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC0(STRING,INT,String,hash,varray()); ADDFUNC0(STRING,STRING,String,md5_text,varray()); ADDFUNC0(STRING,STRING,String,sha256_text,varray()); - ADDFUNC0(STRING,RAW_ARRAY,String,md5_buffer,varray()); - ADDFUNC0(STRING,RAW_ARRAY,String,sha256_buffer,varray()); + ADDFUNC0(STRING,POOL_BYTE_ARRAY,String,md5_buffer,varray()); + ADDFUNC0(STRING,POOL_BYTE_ARRAY,String,sha256_buffer,varray()); ADDFUNC0(STRING,BOOL,String,empty,varray()); ADDFUNC0(STRING,BOOL,String,is_abs_path,varray()); ADDFUNC0(STRING,BOOL,String,is_rel_path,varray()); @@ -1438,8 +1438,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC1(STRING,STRING,String,pad_decimals,INT,"digits",varray()); ADDFUNC1(STRING,STRING,String,pad_zeros,INT,"digits",varray()); - ADDFUNC0(STRING,RAW_ARRAY,String,to_ascii,varray()); - ADDFUNC0(STRING,RAW_ARRAY,String,to_utf8,varray()); + ADDFUNC0(STRING,POOL_BYTE_ARRAY,String,to_ascii,varray()); + ADDFUNC0(STRING,POOL_BYTE_ARRAY,String,to_utf8,varray()); @@ -1487,8 +1487,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC4(VECTOR3,VECTOR3,Vector3,cubic_interpolate,VECTOR3,"b",VECTOR3,"pre_a",VECTOR3,"post_b",REAL,"t",varray()); ADDFUNC1(VECTOR3,REAL,Vector3,dot,VECTOR3,"b",varray()); ADDFUNC1(VECTOR3,VECTOR3,Vector3,cross,VECTOR3,"b",varray()); - ADDFUNC1(VECTOR3,MATRIX3,Vector3,outer,VECTOR3,"b",varray()); - ADDFUNC0(VECTOR3,MATRIX3,Vector3,to_diagonal_matrix,varray()); + ADDFUNC1(VECTOR3,BASIS,Vector3,outer,VECTOR3,"b",varray()); + ADDFUNC0(VECTOR3,BASIS,Vector3,to_diagonal_matrix,varray()); ADDFUNC0(VECTOR3,VECTOR3,Vector3,abs,varray()); ADDFUNC0(VECTOR3,VECTOR3,Vector3,abs,varray()); ADDFUNC0(VECTOR3,VECTOR3,Vector3,floor,varray()); @@ -1540,7 +1540,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC1(IMAGE, IMAGE, Image, compressed, INT, "format", varray(0)); ADDFUNC0(IMAGE, IMAGE, Image, decompressed, varray(0)); ADDFUNC3(IMAGE, IMAGE, Image, resized, INT, "x", INT, "y", INT, "interpolation", varray(((int)Image::INTERPOLATE_BILINEAR))); - ADDFUNC0(IMAGE, RAW_ARRAY, Image, get_data, varray()); + ADDFUNC0(IMAGE, POOL_BYTE_ARRAY, Image, get_data, varray()); ADDFUNC3(IMAGE, NIL, Image, blit_rect, IMAGE, "src", RECT2, "src_rect", VECTOR2, "dest", varray(0)); ADDFUNC1(IMAGE, IMAGE, Image, converted, INT, "format", varray(0)); ADDFUNC0(IMAGE, NIL, Image, fix_alpha_edges, varray()); @@ -1590,133 +1590,133 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC0(ARRAY,NIL,Array,invert,varray()); ADDFUNC0(ARRAY,BOOL,Array,is_shared,varray()); - ADDFUNC0(RAW_ARRAY,INT,ByteArray,size,varray()); - ADDFUNC2(RAW_ARRAY,NIL,ByteArray,set,INT,"idx",INT,"byte",varray()); - ADDFUNC1(RAW_ARRAY,NIL,ByteArray,push_back,INT,"byte",varray()); - ADDFUNC1(RAW_ARRAY,NIL,ByteArray,append,INT,"byte",varray()); - ADDFUNC1(RAW_ARRAY,NIL,ByteArray,append_array,RAW_ARRAY,"array",varray()); - ADDFUNC1(RAW_ARRAY,NIL,ByteArray,remove,INT,"idx",varray()); - ADDFUNC2(RAW_ARRAY,INT,ByteArray,insert,INT,"idx",INT,"byte",varray()); - ADDFUNC1(RAW_ARRAY,NIL,ByteArray,resize,INT,"idx",varray()); - ADDFUNC0(RAW_ARRAY,NIL,ByteArray,invert,varray()); - ADDFUNC2(RAW_ARRAY,RAW_ARRAY,ByteArray,subarray,INT,"from",INT,"to",varray()); - - ADDFUNC0(RAW_ARRAY,STRING,ByteArray,get_string_from_ascii,varray()); - ADDFUNC0(RAW_ARRAY,STRING,ByteArray,get_string_from_utf8,varray()); - - - ADDFUNC0(INT_ARRAY,INT,IntArray,size,varray()); - ADDFUNC2(INT_ARRAY,NIL,IntArray,set,INT,"idx",INT,"integer",varray()); - ADDFUNC1(INT_ARRAY,NIL,IntArray,push_back,INT,"integer",varray()); - ADDFUNC1(INT_ARRAY,NIL,IntArray,append,INT,"integer",varray()); - ADDFUNC1(INT_ARRAY,NIL,IntArray,append_array,INT_ARRAY,"array",varray()); - ADDFUNC1(INT_ARRAY,NIL,IntArray,remove,INT,"idx",varray()); - ADDFUNC2(INT_ARRAY,INT,IntArray,insert,INT,"idx",INT,"integer",varray()); - ADDFUNC1(INT_ARRAY,NIL,IntArray,resize,INT,"idx",varray()); - ADDFUNC0(INT_ARRAY,NIL,IntArray,invert,varray()); - - ADDFUNC0(REAL_ARRAY,INT,RealArray,size,varray()); - ADDFUNC2(REAL_ARRAY,NIL,RealArray,set,INT,"idx",REAL,"value",varray()); - ADDFUNC1(REAL_ARRAY,NIL,RealArray,push_back,REAL,"value",varray()); - ADDFUNC1(REAL_ARRAY,NIL,RealArray,append,REAL,"value",varray()); - ADDFUNC1(REAL_ARRAY,NIL,RealArray,append_array,REAL_ARRAY,"array",varray()); - ADDFUNC1(REAL_ARRAY,NIL,RealArray,remove,INT,"idx",varray()); - ADDFUNC2(REAL_ARRAY,INT,RealArray,insert,INT,"idx",REAL,"value",varray()); - ADDFUNC1(REAL_ARRAY,NIL,RealArray,resize,INT,"idx",varray()); - ADDFUNC0(REAL_ARRAY,NIL,RealArray,invert,varray()); - - ADDFUNC0(STRING_ARRAY,INT,StringArray,size,varray()); - ADDFUNC2(STRING_ARRAY,NIL,StringArray,set,INT,"idx",STRING,"string",varray()); - ADDFUNC1(STRING_ARRAY,NIL,StringArray,push_back,STRING,"string",varray()); - ADDFUNC1(STRING_ARRAY,NIL,StringArray,append,STRING,"string",varray()); - ADDFUNC1(STRING_ARRAY,NIL,StringArray,append_array,STRING_ARRAY,"array",varray()); - ADDFUNC1(STRING_ARRAY,NIL,StringArray,remove,INT,"idx",varray()); - ADDFUNC2(STRING_ARRAY,INT,StringArray,insert,INT,"idx",STRING,"string",varray()); - ADDFUNC1(STRING_ARRAY,NIL,StringArray,resize,INT,"idx",varray()); - ADDFUNC0(STRING_ARRAY,NIL,StringArray,invert,varray()); - - ADDFUNC0(VECTOR2_ARRAY,INT,Vector2Array,size,varray()); - ADDFUNC2(VECTOR2_ARRAY,NIL,Vector2Array,set,INT,"idx",VECTOR2,"vector2",varray()); - ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,push_back,VECTOR2,"vector2",varray()); - ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,append,VECTOR2,"vector2",varray()); - ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,append_array,VECTOR2_ARRAY,"array",varray()); - ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,remove,INT,"idx",varray()); - ADDFUNC2(VECTOR2_ARRAY,INT,Vector2Array,insert,INT,"idx",VECTOR2,"vector2",varray()); - ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,resize,INT,"idx",varray()); - ADDFUNC0(VECTOR2_ARRAY,NIL,Vector2Array,invert,varray()); - - ADDFUNC0(VECTOR3_ARRAY,INT,Vector3Array,size,varray()); - ADDFUNC2(VECTOR3_ARRAY,NIL,Vector3Array,set,INT,"idx",VECTOR3,"vector3",varray()); - ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,push_back,VECTOR3,"vector3",varray()); - ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,append,VECTOR3,"vector3",varray()); - ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,append_array,VECTOR3_ARRAY,"array",varray()); - ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,remove,INT,"idx",varray()); - ADDFUNC2(VECTOR3_ARRAY,INT,Vector3Array,insert,INT,"idx",VECTOR3,"vector3",varray()); - ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,resize,INT,"idx",varray()); - ADDFUNC0(VECTOR3_ARRAY,NIL,Vector3Array,invert,varray()); - - ADDFUNC0(COLOR_ARRAY,INT,ColorArray,size,varray()); - ADDFUNC2(COLOR_ARRAY,NIL,ColorArray,set,INT,"idx",COLOR,"color",varray()); - ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,push_back,COLOR,"color",varray()); - ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,append,COLOR,"color",varray()); - ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,append_array,COLOR_ARRAY,"array",varray()); - ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,remove,INT,"idx",varray()); - ADDFUNC2(COLOR_ARRAY,INT,ColorArray,insert,INT,"idx",COLOR,"color",varray()); - ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,resize,INT,"idx",varray()); - ADDFUNC0(COLOR_ARRAY,NIL,ColorArray,invert,varray()); + ADDFUNC0(POOL_BYTE_ARRAY,INT,PoolByteArray,size,varray()); + ADDFUNC2(POOL_BYTE_ARRAY,NIL,PoolByteArray,set,INT,"idx",INT,"byte",varray()); + ADDFUNC1(POOL_BYTE_ARRAY,NIL,PoolByteArray,push_back,INT,"byte",varray()); + ADDFUNC1(POOL_BYTE_ARRAY,NIL,PoolByteArray,append,INT,"byte",varray()); + ADDFUNC1(POOL_BYTE_ARRAY,NIL,PoolByteArray,append_array,POOL_BYTE_ARRAY,"array",varray()); + ADDFUNC1(POOL_BYTE_ARRAY,NIL,PoolByteArray,remove,INT,"idx",varray()); + ADDFUNC2(POOL_BYTE_ARRAY,INT,PoolByteArray,insert,INT,"idx",INT,"byte",varray()); + ADDFUNC1(POOL_BYTE_ARRAY,NIL,PoolByteArray,resize,INT,"idx",varray()); + ADDFUNC0(POOL_BYTE_ARRAY,NIL,PoolByteArray,invert,varray()); + ADDFUNC2(POOL_BYTE_ARRAY,POOL_BYTE_ARRAY,PoolByteArray,subarray,INT,"from",INT,"to",varray()); + + ADDFUNC0(POOL_BYTE_ARRAY,STRING,PoolByteArray,get_string_from_ascii,varray()); + ADDFUNC0(POOL_BYTE_ARRAY,STRING,PoolByteArray,get_string_from_utf8,varray()); + + + ADDFUNC0(POOL_INT_ARRAY,INT,PoolIntArray,size,varray()); + ADDFUNC2(POOL_INT_ARRAY,NIL,PoolIntArray,set,INT,"idx",INT,"integer",varray()); + ADDFUNC1(POOL_INT_ARRAY,NIL,PoolIntArray,push_back,INT,"integer",varray()); + ADDFUNC1(POOL_INT_ARRAY,NIL,PoolIntArray,append,INT,"integer",varray()); + ADDFUNC1(POOL_INT_ARRAY,NIL,PoolIntArray,append_array,POOL_INT_ARRAY,"array",varray()); + ADDFUNC1(POOL_INT_ARRAY,NIL,PoolIntArray,remove,INT,"idx",varray()); + ADDFUNC2(POOL_INT_ARRAY,INT,PoolIntArray,insert,INT,"idx",INT,"integer",varray()); + ADDFUNC1(POOL_INT_ARRAY,NIL,PoolIntArray,resize,INT,"idx",varray()); + ADDFUNC0(POOL_INT_ARRAY,NIL,PoolIntArray,invert,varray()); + + ADDFUNC0(POOL_REAL_ARRAY,INT,PoolRealArray,size,varray()); + ADDFUNC2(POOL_REAL_ARRAY,NIL,PoolRealArray,set,INT,"idx",REAL,"value",varray()); + ADDFUNC1(POOL_REAL_ARRAY,NIL,PoolRealArray,push_back,REAL,"value",varray()); + ADDFUNC1(POOL_REAL_ARRAY,NIL,PoolRealArray,append,REAL,"value",varray()); + ADDFUNC1(POOL_REAL_ARRAY,NIL,PoolRealArray,append_array,POOL_REAL_ARRAY,"array",varray()); + ADDFUNC1(POOL_REAL_ARRAY,NIL,PoolRealArray,remove,INT,"idx",varray()); + ADDFUNC2(POOL_REAL_ARRAY,INT,PoolRealArray,insert,INT,"idx",REAL,"value",varray()); + ADDFUNC1(POOL_REAL_ARRAY,NIL,PoolRealArray,resize,INT,"idx",varray()); + ADDFUNC0(POOL_REAL_ARRAY,NIL,PoolRealArray,invert,varray()); + + ADDFUNC0(POOL_STRING_ARRAY,INT,PoolStringArray,size,varray()); + ADDFUNC2(POOL_STRING_ARRAY,NIL,PoolStringArray,set,INT,"idx",STRING,"string",varray()); + ADDFUNC1(POOL_STRING_ARRAY,NIL,PoolStringArray,push_back,STRING,"string",varray()); + ADDFUNC1(POOL_STRING_ARRAY,NIL,PoolStringArray,append,STRING,"string",varray()); + ADDFUNC1(POOL_STRING_ARRAY,NIL,PoolStringArray,append_array,POOL_STRING_ARRAY,"array",varray()); + ADDFUNC1(POOL_STRING_ARRAY,NIL,PoolStringArray,remove,INT,"idx",varray()); + ADDFUNC2(POOL_STRING_ARRAY,INT,PoolStringArray,insert,INT,"idx",STRING,"string",varray()); + ADDFUNC1(POOL_STRING_ARRAY,NIL,PoolStringArray,resize,INT,"idx",varray()); + ADDFUNC0(POOL_STRING_ARRAY,NIL,PoolStringArray,invert,varray()); + + ADDFUNC0(POOL_VECTOR2_ARRAY,INT,PoolVector2Array,size,varray()); + ADDFUNC2(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,set,INT,"idx",VECTOR2,"vector2",varray()); + ADDFUNC1(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,push_back,VECTOR2,"vector2",varray()); + ADDFUNC1(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,append,VECTOR2,"vector2",varray()); + ADDFUNC1(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,append_array,POOL_VECTOR2_ARRAY,"array",varray()); + ADDFUNC1(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,remove,INT,"idx",varray()); + ADDFUNC2(POOL_VECTOR2_ARRAY,INT,PoolVector2Array,insert,INT,"idx",VECTOR2,"vector2",varray()); + ADDFUNC1(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,resize,INT,"idx",varray()); + ADDFUNC0(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,invert,varray()); + + ADDFUNC0(POOL_VECTOR3_ARRAY,INT,PoolVector3Array,size,varray()); + ADDFUNC2(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,set,INT,"idx",VECTOR3,"vector3",varray()); + ADDFUNC1(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,push_back,VECTOR3,"vector3",varray()); + ADDFUNC1(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,append,VECTOR3,"vector3",varray()); + ADDFUNC1(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,append_array,POOL_VECTOR3_ARRAY,"array",varray()); + ADDFUNC1(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,remove,INT,"idx",varray()); + ADDFUNC2(POOL_VECTOR3_ARRAY,INT,PoolVector3Array,insert,INT,"idx",VECTOR3,"vector3",varray()); + ADDFUNC1(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,resize,INT,"idx",varray()); + ADDFUNC0(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,invert,varray()); + + ADDFUNC0(POOL_COLOR_ARRAY,INT,PoolColorArray,size,varray()); + ADDFUNC2(POOL_COLOR_ARRAY,NIL,PoolColorArray,set,INT,"idx",COLOR,"color",varray()); + ADDFUNC1(POOL_COLOR_ARRAY,NIL,PoolColorArray,push_back,COLOR,"color",varray()); + ADDFUNC1(POOL_COLOR_ARRAY,NIL,PoolColorArray,append,COLOR,"color",varray()); + ADDFUNC1(POOL_COLOR_ARRAY,NIL,PoolColorArray,append_array,POOL_COLOR_ARRAY,"array",varray()); + ADDFUNC1(POOL_COLOR_ARRAY,NIL,PoolColorArray,remove,INT,"idx",varray()); + ADDFUNC2(POOL_COLOR_ARRAY,INT,PoolColorArray,insert,INT,"idx",COLOR,"color",varray()); + ADDFUNC1(POOL_COLOR_ARRAY,NIL,PoolColorArray,resize,INT,"idx",varray()); + ADDFUNC0(POOL_COLOR_ARRAY,NIL,PoolColorArray,invert,varray()); //pointerbased - ADDFUNC0(_AABB,REAL,AABB,get_area,varray()); - ADDFUNC0(_AABB,BOOL,AABB,has_no_area,varray()); - ADDFUNC0(_AABB,BOOL,AABB,has_no_surface,varray()); - ADDFUNC1(_AABB,BOOL,AABB,intersects,_AABB,"with",varray()); - ADDFUNC1(_AABB,BOOL,AABB,encloses,_AABB,"with",varray()); - ADDFUNC1(_AABB,_AABB,AABB,merge,_AABB,"with",varray()); - ADDFUNC1(_AABB,_AABB,AABB,intersection,_AABB,"with",varray()); - ADDFUNC1(_AABB,BOOL,AABB,intersects_plane,PLANE,"plane",varray()); - ADDFUNC2(_AABB,BOOL,AABB,intersects_segment,VECTOR3,"from",VECTOR3,"to",varray()); - ADDFUNC1(_AABB,BOOL,AABB,has_point,VECTOR3,"point",varray()); - ADDFUNC1(_AABB,VECTOR3,AABB,get_support,VECTOR3,"dir",varray()); - ADDFUNC0(_AABB,VECTOR3,AABB,get_longest_axis,varray()); - ADDFUNC0(_AABB,INT,AABB,get_longest_axis_index,varray()); - ADDFUNC0(_AABB,REAL,AABB,get_longest_axis_size,varray()); - ADDFUNC0(_AABB,VECTOR3,AABB,get_shortest_axis,varray()); - ADDFUNC0(_AABB,INT,AABB,get_shortest_axis_index,varray()); - ADDFUNC0(_AABB,REAL,AABB,get_shortest_axis_size,varray()); - ADDFUNC1(_AABB,_AABB,AABB,expand,VECTOR3,"to_point",varray()); - ADDFUNC1(_AABB,_AABB,AABB,grow,REAL,"by",varray()); - ADDFUNC1(_AABB,VECTOR3,AABB,get_endpoint,INT,"idx",varray()); - - ADDFUNC0(MATRIX32,MATRIX32,Matrix32,inverse,varray()); - ADDFUNC0(MATRIX32,MATRIX32,Matrix32,affine_inverse,varray()); - ADDFUNC0(MATRIX32,REAL,Matrix32,get_rotation,varray()); - ADDFUNC0(MATRIX32,VECTOR2,Matrix32,get_origin,varray()); - ADDFUNC0(MATRIX32,VECTOR2,Matrix32,get_scale,varray()); - ADDFUNC0(MATRIX32,MATRIX32,Matrix32,orthonormalized,varray()); - ADDFUNC1(MATRIX32,MATRIX32,Matrix32,rotated,REAL,"phi",varray()); - ADDFUNC1(MATRIX32,MATRIX32,Matrix32,scaled,VECTOR2,"scale",varray()); - ADDFUNC1(MATRIX32,MATRIX32,Matrix32,translated,VECTOR2,"offset",varray()); - ADDFUNC1(MATRIX32,MATRIX32,Matrix32,xform,NIL,"v",varray()); - ADDFUNC1(MATRIX32,MATRIX32,Matrix32,xform_inv,NIL,"v",varray()); - ADDFUNC1(MATRIX32,MATRIX32,Matrix32,basis_xform,NIL,"v",varray()); - ADDFUNC1(MATRIX32,MATRIX32,Matrix32,basis_xform_inv,NIL,"v",varray()); - ADDFUNC2(MATRIX32,MATRIX32,Matrix32,interpolate_with,MATRIX32,"m",REAL,"c",varray()); - - ADDFUNC0(MATRIX3,MATRIX3,Matrix3,inverse,varray()); - ADDFUNC0(MATRIX3,MATRIX3,Matrix3,transposed,varray()); - ADDFUNC0(MATRIX3,MATRIX3,Matrix3,orthonormalized,varray()); - ADDFUNC0(MATRIX3,REAL,Matrix3,determinant,varray()); - ADDFUNC2(MATRIX3,MATRIX3,Matrix3,rotated,VECTOR3,"axis",REAL,"phi",varray()); - ADDFUNC1(MATRIX3,MATRIX3,Matrix3,scaled,VECTOR3,"scale",varray()); - ADDFUNC0(MATRIX3,VECTOR3,Matrix3,get_scale,varray()); - ADDFUNC0(MATRIX3,VECTOR3,Matrix3,get_euler,varray()); - ADDFUNC1(MATRIX3,REAL,Matrix3,tdotx,VECTOR3,"with",varray()); - ADDFUNC1(MATRIX3,REAL,Matrix3,tdoty,VECTOR3,"with",varray()); - ADDFUNC1(MATRIX3,REAL,Matrix3,tdotz,VECTOR3,"with",varray()); - ADDFUNC1(MATRIX3,VECTOR3,Matrix3,xform,VECTOR3,"v",varray()); - ADDFUNC1(MATRIX3,VECTOR3,Matrix3,xform_inv,VECTOR3,"v",varray()); - ADDFUNC0(MATRIX3,INT,Matrix3,get_orthogonal_index,varray()); + ADDFUNC0(RECT3,REAL,Rect3,get_area,varray()); + ADDFUNC0(RECT3,BOOL,Rect3,has_no_area,varray()); + ADDFUNC0(RECT3,BOOL,Rect3,has_no_surface,varray()); + ADDFUNC1(RECT3,BOOL,Rect3,intersects,RECT3,"with",varray()); + ADDFUNC1(RECT3,BOOL,Rect3,encloses,RECT3,"with",varray()); + ADDFUNC1(RECT3,RECT3,Rect3,merge,RECT3,"with",varray()); + ADDFUNC1(RECT3,RECT3,Rect3,intersection,RECT3,"with",varray()); + ADDFUNC1(RECT3,BOOL,Rect3,intersects_plane,PLANE,"plane",varray()); + ADDFUNC2(RECT3,BOOL,Rect3,intersects_segment,VECTOR3,"from",VECTOR3,"to",varray()); + ADDFUNC1(RECT3,BOOL,Rect3,has_point,VECTOR3,"point",varray()); + ADDFUNC1(RECT3,VECTOR3,Rect3,get_support,VECTOR3,"dir",varray()); + ADDFUNC0(RECT3,VECTOR3,Rect3,get_longest_axis,varray()); + ADDFUNC0(RECT3,INT,Rect3,get_longest_axis_index,varray()); + ADDFUNC0(RECT3,REAL,Rect3,get_longest_axis_size,varray()); + ADDFUNC0(RECT3,VECTOR3,Rect3,get_shortest_axis,varray()); + ADDFUNC0(RECT3,INT,Rect3,get_shortest_axis_index,varray()); + ADDFUNC0(RECT3,REAL,Rect3,get_shortest_axis_size,varray()); + ADDFUNC1(RECT3,RECT3,Rect3,expand,VECTOR3,"to_point",varray()); + ADDFUNC1(RECT3,RECT3,Rect3,grow,REAL,"by",varray()); + ADDFUNC1(RECT3,VECTOR3,Rect3,get_endpoint,INT,"idx",varray()); + + ADDFUNC0(TRANSFORM2D,TRANSFORM2D,Transform2D,inverse,varray()); + ADDFUNC0(TRANSFORM2D,TRANSFORM2D,Transform2D,affine_inverse,varray()); + ADDFUNC0(TRANSFORM2D,REAL,Transform2D,get_rotation,varray()); + ADDFUNC0(TRANSFORM2D,VECTOR2,Transform2D,get_origin,varray()); + ADDFUNC0(TRANSFORM2D,VECTOR2,Transform2D,get_scale,varray()); + ADDFUNC0(TRANSFORM2D,TRANSFORM2D,Transform2D,orthonormalized,varray()); + ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,rotated,REAL,"phi",varray()); + ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,scaled,VECTOR2,"scale",varray()); + ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,translated,VECTOR2,"offset",varray()); + ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,xform,NIL,"v",varray()); + ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,xform_inv,NIL,"v",varray()); + ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,basis_xform,NIL,"v",varray()); + ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,basis_xform_inv,NIL,"v",varray()); + ADDFUNC2(TRANSFORM2D,TRANSFORM2D,Transform2D,interpolate_with,TRANSFORM2D,"m",REAL,"c",varray()); + + ADDFUNC0(BASIS,BASIS,Basis,inverse,varray()); + ADDFUNC0(BASIS,BASIS,Basis,transposed,varray()); + ADDFUNC0(BASIS,BASIS,Basis,orthonormalized,varray()); + ADDFUNC0(BASIS,REAL,Basis,determinant,varray()); + ADDFUNC2(BASIS,BASIS,Basis,rotated,VECTOR3,"axis",REAL,"phi",varray()); + ADDFUNC1(BASIS,BASIS,Basis,scaled,VECTOR3,"scale",varray()); + ADDFUNC0(BASIS,VECTOR3,Basis,get_scale,varray()); + ADDFUNC0(BASIS,VECTOR3,Basis,get_euler,varray()); + ADDFUNC1(BASIS,REAL,Basis,tdotx,VECTOR3,"with",varray()); + ADDFUNC1(BASIS,REAL,Basis,tdoty,VECTOR3,"with",varray()); + ADDFUNC1(BASIS,REAL,Basis,tdotz,VECTOR3,"with",varray()); + ADDFUNC1(BASIS,VECTOR3,Basis,xform,VECTOR3,"v",varray()); + ADDFUNC1(BASIS,VECTOR3,Basis,xform_inv,VECTOR3,"v",varray()); + ADDFUNC0(BASIS,INT,Basis,get_orthogonal_index,varray()); ADDFUNC0(TRANSFORM,TRANSFORM,Transform,inverse,varray()); ADDFUNC0(TRANSFORM,TRANSFORM,Transform,affine_inverse,varray()); @@ -1747,8 +1747,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl _VariantCall::add_constructor(_VariantCall::Rect2_init1,Variant::RECT2,"pos",Variant::VECTOR2,"size",Variant::VECTOR2); _VariantCall::add_constructor(_VariantCall::Rect2_init2,Variant::RECT2,"x",Variant::REAL,"y",Variant::REAL,"width",Variant::REAL,"height",Variant::REAL); - _VariantCall::add_constructor(_VariantCall::Matrix32_init2,Variant::MATRIX32,"rot",Variant::REAL,"pos",Variant::VECTOR2); - _VariantCall::add_constructor(_VariantCall::Matrix32_init3,Variant::MATRIX32,"x_axis",Variant::VECTOR2,"y_axis",Variant::VECTOR2,"origin",Variant::VECTOR2); + _VariantCall::add_constructor(_VariantCall::Transform2D_init2,Variant::TRANSFORM2D,"rot",Variant::REAL,"pos",Variant::VECTOR2); + _VariantCall::add_constructor(_VariantCall::Transform2D_init3,Variant::TRANSFORM2D,"x_axis",Variant::VECTOR2,"y_axis",Variant::VECTOR2,"origin",Variant::VECTOR2); _VariantCall::add_constructor(_VariantCall::Vector3_init1,Variant::VECTOR3,"x",Variant::REAL,"y",Variant::REAL,"z",Variant::REAL); @@ -1762,13 +1762,13 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl _VariantCall::add_constructor(_VariantCall::Color_init1,Variant::COLOR,"r",Variant::REAL,"g",Variant::REAL,"b",Variant::REAL,"a",Variant::REAL); _VariantCall::add_constructor(_VariantCall::Color_init2,Variant::COLOR,"r",Variant::REAL,"g",Variant::REAL,"b",Variant::REAL); - _VariantCall::add_constructor(_VariantCall::AABB_init1,Variant::_AABB,"pos",Variant::VECTOR3,"size",Variant::VECTOR3); + _VariantCall::add_constructor(_VariantCall::Rect3_init1,Variant::RECT3,"pos",Variant::VECTOR3,"size",Variant::VECTOR3); - _VariantCall::add_constructor(_VariantCall::Matrix3_init1,Variant::MATRIX3,"x_axis",Variant::VECTOR3,"y_axis",Variant::VECTOR3,"z_axis",Variant::VECTOR3); - _VariantCall::add_constructor(_VariantCall::Matrix3_init2,Variant::MATRIX3,"axis",Variant::VECTOR3,"phi",Variant::REAL); + _VariantCall::add_constructor(_VariantCall::Basis_init1,Variant::BASIS,"x_axis",Variant::VECTOR3,"y_axis",Variant::VECTOR3,"z_axis",Variant::VECTOR3); + _VariantCall::add_constructor(_VariantCall::Basis_init2,Variant::BASIS,"axis",Variant::VECTOR3,"phi",Variant::REAL); _VariantCall::add_constructor(_VariantCall::Transform_init1,Variant::TRANSFORM,"x_axis",Variant::VECTOR3,"y_axis",Variant::VECTOR3,"z_axis",Variant::VECTOR3,"origin",Variant::VECTOR3); - _VariantCall::add_constructor(_VariantCall::Transform_init2,Variant::TRANSFORM,"basis",Variant::MATRIX3,"origin",Variant::VECTOR3); + _VariantCall::add_constructor(_VariantCall::Transform_init2,Variant::TRANSFORM,"basis",Variant::BASIS,"origin",Variant::VECTOR3); _VariantCall::add_constructor(_VariantCall::Image_init1,Variant::IMAGE,"width",Variant::INT,"height",Variant::INT,"mipmaps",Variant::BOOL,"format",Variant::INT); diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 00baffdd3b..1e67d81ae2 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -47,12 +47,12 @@ bool Variant::booleanize(bool &r_valid) const { case STRING: return (*reinterpret_cast<const String*>(_data._mem))!=""; case VECTOR2: case RECT2: - case MATRIX32: + case TRANSFORM2D: case VECTOR3: case PLANE: - case _AABB: + case RECT3: case QUAT: - case MATRIX3: + case BASIS: case TRANSFORM: case COLOR: case IMAGE: r_valid=false; return false; @@ -62,13 +62,13 @@ bool Variant::booleanize(bool &r_valid) const { case INPUT_EVENT: case DICTIONARY: case ARRAY: - case RAW_ARRAY: - case INT_ARRAY: - case REAL_ARRAY: - case STRING_ARRAY: - case VECTOR2_ARRAY: - case VECTOR3_ARRAY: - case COLOR_ARRAY: + case POOL_BYTE_ARRAY: + case POOL_INT_ARRAY: + case POOL_REAL_ARRAY: + case POOL_STRING_ARRAY: + case POOL_VECTOR2_ARRAY: + case POOL_VECTOR3_ARRAY: + case POOL_COLOR_ARRAY: r_valid=false; return false; default: {} @@ -262,12 +262,12 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_STR(==,STRING,String); DEFAULT_OP_LOCALMEM(==,VECTOR2,Vector2); DEFAULT_OP_LOCALMEM(==,RECT2,Rect2); - DEFAULT_OP_PTRREF(==,MATRIX32,_matrix32); + DEFAULT_OP_PTRREF(==,TRANSFORM2D,_transform2d); DEFAULT_OP_LOCALMEM(==,VECTOR3,Vector3); DEFAULT_OP_LOCALMEM(==,PLANE,Plane); DEFAULT_OP_LOCALMEM(==,QUAT,Quat); - DEFAULT_OP_PTRREF(==,_AABB,_aabb); - DEFAULT_OP_PTRREF(==,MATRIX3,_matrix3); + DEFAULT_OP_PTRREF(==,RECT3,_rect3); + DEFAULT_OP_PTRREF(==,BASIS,_basis); DEFAULT_OP_PTRREF(==,TRANSFORM,_transform); DEFAULT_OP_LOCALMEM(==,COLOR,Color); @@ -316,13 +316,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& } break; - DEFAULT_OP_ARRAY_EQ(RAW_ARRAY,uint8_t); - DEFAULT_OP_ARRAY_EQ(INT_ARRAY,int); - DEFAULT_OP_ARRAY_EQ(REAL_ARRAY,real_t); - DEFAULT_OP_ARRAY_EQ(STRING_ARRAY,String); - DEFAULT_OP_ARRAY_EQ(VECTOR2_ARRAY,Vector3); - DEFAULT_OP_ARRAY_EQ(VECTOR3_ARRAY,Vector3); - DEFAULT_OP_ARRAY_EQ(COLOR_ARRAY,Color); + DEFAULT_OP_ARRAY_EQ(POOL_BYTE_ARRAY,uint8_t); + DEFAULT_OP_ARRAY_EQ(POOL_INT_ARRAY,int); + DEFAULT_OP_ARRAY_EQ(POOL_REAL_ARRAY,real_t); + DEFAULT_OP_ARRAY_EQ(POOL_STRING_ARRAY,String); + DEFAULT_OP_ARRAY_EQ(POOL_VECTOR2_ARRAY,Vector3); + DEFAULT_OP_ARRAY_EQ(POOL_VECTOR3_ARRAY,Vector3); + DEFAULT_OP_ARRAY_EQ(POOL_COLOR_ARRAY,Color); case VARIANT_MAX: { r_valid=false; @@ -354,12 +354,12 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_STR(<,STRING,String); DEFAULT_OP_LOCALMEM(<,VECTOR2,Vector2); DEFAULT_OP_FAIL(RECT2); - DEFAULT_OP_FAIL(MATRIX32); + DEFAULT_OP_FAIL(TRANSFORM2D); DEFAULT_OP_LOCALMEM(<,VECTOR3,Vector3); DEFAULT_OP_FAIL(PLANE); DEFAULT_OP_FAIL(QUAT); - DEFAULT_OP_FAIL(_AABB); - DEFAULT_OP_FAIL(MATRIX3); + DEFAULT_OP_FAIL(RECT3); + DEFAULT_OP_FAIL(BASIS); DEFAULT_OP_FAIL(TRANSFORM); DEFAULT_OP_FAIL(COLOR); @@ -393,13 +393,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& _RETURN( false ); } break; - DEFAULT_OP_ARRAY_LT(RAW_ARRAY,uint8_t); - DEFAULT_OP_ARRAY_LT(INT_ARRAY,int); - DEFAULT_OP_ARRAY_LT(REAL_ARRAY,real_t); - DEFAULT_OP_ARRAY_LT(STRING_ARRAY,String); - DEFAULT_OP_ARRAY_LT(VECTOR2_ARRAY,Vector3); - DEFAULT_OP_ARRAY_LT(VECTOR3_ARRAY,Vector3); - DEFAULT_OP_ARRAY_LT(COLOR_ARRAY,Color); + DEFAULT_OP_ARRAY_LT(POOL_BYTE_ARRAY,uint8_t); + DEFAULT_OP_ARRAY_LT(POOL_INT_ARRAY,int); + DEFAULT_OP_ARRAY_LT(POOL_REAL_ARRAY,real_t); + DEFAULT_OP_ARRAY_LT(POOL_STRING_ARRAY,String); + DEFAULT_OP_ARRAY_LT(POOL_VECTOR2_ARRAY,Vector3); + DEFAULT_OP_ARRAY_LT(POOL_VECTOR3_ARRAY,Vector3); + DEFAULT_OP_ARRAY_LT(POOL_COLOR_ARRAY,Color); case VARIANT_MAX: { r_valid=false; return; @@ -420,12 +420,12 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_STR(<=,STRING,String); DEFAULT_OP_LOCALMEM(<=,VECTOR2,Vector2); DEFAULT_OP_FAIL(RECT2); - DEFAULT_OP_FAIL(MATRIX32); + DEFAULT_OP_FAIL(TRANSFORM2D); DEFAULT_OP_LOCALMEM(<=,VECTOR3,Vector3); DEFAULT_OP_FAIL(PLANE); DEFAULT_OP_FAIL(QUAT); - DEFAULT_OP_FAIL(_AABB); - DEFAULT_OP_FAIL(MATRIX3); + DEFAULT_OP_FAIL(RECT3); + DEFAULT_OP_FAIL(BASIS); DEFAULT_OP_FAIL(TRANSFORM); DEFAULT_OP_FAIL(COLOR); @@ -440,13 +440,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_FAIL(INPUT_EVENT); DEFAULT_OP_FAIL(DICTIONARY); DEFAULT_OP_FAIL(ARRAY); - DEFAULT_OP_FAIL(RAW_ARRAY); - DEFAULT_OP_FAIL(INT_ARRAY); - DEFAULT_OP_FAIL(REAL_ARRAY); - DEFAULT_OP_FAIL(STRING_ARRAY); - DEFAULT_OP_FAIL(VECTOR2_ARRAY); - DEFAULT_OP_FAIL(VECTOR3_ARRAY); - DEFAULT_OP_FAIL(COLOR_ARRAY); + DEFAULT_OP_FAIL(POOL_BYTE_ARRAY); + DEFAULT_OP_FAIL(POOL_INT_ARRAY); + DEFAULT_OP_FAIL(POOL_REAL_ARRAY); + DEFAULT_OP_FAIL(POOL_STRING_ARRAY); + DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY); + DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY); + DEFAULT_OP_FAIL(POOL_COLOR_ARRAY); case VARIANT_MAX: { r_valid=false; return; @@ -484,12 +484,12 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_STR(+,STRING,String); DEFAULT_OP_LOCALMEM(+,VECTOR2,Vector2); DEFAULT_OP_FAIL(RECT2); - DEFAULT_OP_FAIL(MATRIX32); + DEFAULT_OP_FAIL(TRANSFORM2D); DEFAULT_OP_LOCALMEM(+,VECTOR3,Vector3); DEFAULT_OP_FAIL(PLANE); DEFAULT_OP_LOCALMEM(+, QUAT, Quat); - DEFAULT_OP_FAIL(_AABB); - DEFAULT_OP_FAIL(MATRIX3); + DEFAULT_OP_FAIL(RECT3); + DEFAULT_OP_FAIL(BASIS); DEFAULT_OP_FAIL(TRANSFORM); DEFAULT_OP_FAIL(COLOR); @@ -517,13 +517,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& sum[i+asize]=array_b[i]; _RETURN( sum ); } - DEFAULT_OP_ARRAY_ADD(RAW_ARRAY,uint8_t); - DEFAULT_OP_ARRAY_ADD(INT_ARRAY,int); - DEFAULT_OP_ARRAY_ADD(REAL_ARRAY,real_t); - DEFAULT_OP_ARRAY_ADD(STRING_ARRAY,String); - DEFAULT_OP_ARRAY_ADD(VECTOR2_ARRAY,Vector2); - DEFAULT_OP_ARRAY_ADD(VECTOR3_ARRAY,Vector3); - DEFAULT_OP_ARRAY_ADD(COLOR_ARRAY,Color); + DEFAULT_OP_ARRAY_ADD(POOL_BYTE_ARRAY,uint8_t); + DEFAULT_OP_ARRAY_ADD(POOL_INT_ARRAY,int); + DEFAULT_OP_ARRAY_ADD(POOL_REAL_ARRAY,real_t); + DEFAULT_OP_ARRAY_ADD(POOL_STRING_ARRAY,String); + DEFAULT_OP_ARRAY_ADD(POOL_VECTOR2_ARRAY,Vector2); + DEFAULT_OP_ARRAY_ADD(POOL_VECTOR3_ARRAY,Vector3); + DEFAULT_OP_ARRAY_ADD(POOL_COLOR_ARRAY,Color); case VARIANT_MAX: { r_valid=false; return; @@ -542,12 +542,12 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_FAIL(STRING); DEFAULT_OP_LOCALMEM(-,VECTOR2,Vector2); DEFAULT_OP_FAIL(RECT2); - DEFAULT_OP_FAIL(MATRIX32); + DEFAULT_OP_FAIL(TRANSFORM2D); DEFAULT_OP_LOCALMEM(-,VECTOR3,Vector3); DEFAULT_OP_FAIL(PLANE); DEFAULT_OP_LOCALMEM(-, QUAT, Quat); - DEFAULT_OP_FAIL(_AABB); - DEFAULT_OP_FAIL(MATRIX3); + DEFAULT_OP_FAIL(RECT3); + DEFAULT_OP_FAIL(BASIS); DEFAULT_OP_FAIL(TRANSFORM); DEFAULT_OP_FAIL(COLOR); @@ -558,13 +558,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_FAIL(INPUT_EVENT); DEFAULT_OP_FAIL(DICTIONARY); DEFAULT_OP_FAIL(ARRAY); - DEFAULT_OP_FAIL(RAW_ARRAY); - DEFAULT_OP_FAIL(INT_ARRAY); - DEFAULT_OP_FAIL(REAL_ARRAY); - DEFAULT_OP_FAIL(STRING_ARRAY); - DEFAULT_OP_FAIL(VECTOR2_ARRAY); - DEFAULT_OP_FAIL(VECTOR3_ARRAY); - DEFAULT_OP_FAIL(COLOR_ARRAY); + DEFAULT_OP_FAIL(POOL_BYTE_ARRAY); + DEFAULT_OP_FAIL(POOL_INT_ARRAY); + DEFAULT_OP_FAIL(POOL_REAL_ARRAY); + DEFAULT_OP_FAIL(POOL_STRING_ARRAY); + DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY); + DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY); + DEFAULT_OP_FAIL(POOL_COLOR_ARRAY); case VARIANT_MAX: { r_valid=false; return; @@ -583,13 +583,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_FAIL(STRING); DEFAULT_OP_LOCALMEM_NUM(*,VECTOR2,Vector2); DEFAULT_OP_FAIL(RECT2); - case MATRIX32: { + case TRANSFORM2D: { - if (p_b.type==MATRIX32) { - _RETURN( *p_a._data._matrix32 * *p_b._data._matrix32 ); + if (p_b.type==TRANSFORM2D) { + _RETURN( *p_a._data._transform2d * *p_b._data._transform2d ); }; if (p_b.type==VECTOR2) { - _RETURN( p_a._data._matrix32->xform( *(const Vector2*)p_b._data._mem) ); + _RETURN( p_a._data._transform2d->xform( *(const Vector2*)p_b._data._mem) ); }; r_valid=false; return; @@ -615,18 +615,18 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& r_valid=false; return; } break; - DEFAULT_OP_FAIL(_AABB); - case MATRIX3: { + DEFAULT_OP_FAIL(RECT3); + case BASIS: { switch(p_b.type) { case VECTOR3: { - _RETURN( p_a._data._matrix3->xform( *(const Vector3*)p_b._data._mem) ); + _RETURN( p_a._data._basis->xform( *(const Vector3*)p_b._data._mem) ); } ; - case MATRIX3: { + case BASIS: { - _RETURN( *p_a._data._matrix3 * *p_b._data._matrix3 ); + _RETURN( *p_a._data._basis * *p_b._data._basis ); }; default: {} @@ -660,13 +660,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_FAIL(INPUT_EVENT); DEFAULT_OP_FAIL(DICTIONARY); DEFAULT_OP_FAIL(ARRAY); - DEFAULT_OP_FAIL(RAW_ARRAY); - DEFAULT_OP_FAIL(INT_ARRAY); - DEFAULT_OP_FAIL(REAL_ARRAY); - DEFAULT_OP_FAIL(STRING_ARRAY); - DEFAULT_OP_FAIL(VECTOR2_ARRAY); - DEFAULT_OP_FAIL(VECTOR3_ARRAY); - DEFAULT_OP_FAIL(COLOR_ARRAY); + DEFAULT_OP_FAIL(POOL_BYTE_ARRAY); + DEFAULT_OP_FAIL(POOL_INT_ARRAY); + DEFAULT_OP_FAIL(POOL_REAL_ARRAY); + DEFAULT_OP_FAIL(POOL_STRING_ARRAY); + DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY); + DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY); + DEFAULT_OP_FAIL(POOL_COLOR_ARRAY); case VARIANT_MAX: { r_valid=false; return; @@ -712,7 +712,7 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_FAIL(STRING); DEFAULT_OP_LOCALMEM_NUM(/,VECTOR2,Vector2); DEFAULT_OP_FAIL(RECT2); - DEFAULT_OP_FAIL(MATRIX32); + DEFAULT_OP_FAIL(TRANSFORM2D); DEFAULT_OP_LOCALMEM_NUM(/,VECTOR3,Vector3); DEFAULT_OP_FAIL(PLANE); case QUAT: { @@ -722,8 +722,8 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& } _RETURN( *reinterpret_cast<const Quat*>(p_a._data._mem) / p_b._data._real); } break; - DEFAULT_OP_FAIL(_AABB); - DEFAULT_OP_FAIL(MATRIX3); + DEFAULT_OP_FAIL(RECT3); + DEFAULT_OP_FAIL(BASIS); DEFAULT_OP_FAIL(TRANSFORM); DEFAULT_OP_FAIL(COLOR); @@ -734,13 +734,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_FAIL(INPUT_EVENT); DEFAULT_OP_FAIL(DICTIONARY); DEFAULT_OP_FAIL(ARRAY); - DEFAULT_OP_FAIL(RAW_ARRAY); - DEFAULT_OP_FAIL(INT_ARRAY); - DEFAULT_OP_FAIL(REAL_ARRAY); - DEFAULT_OP_FAIL(STRING_ARRAY); - DEFAULT_OP_FAIL(VECTOR2_ARRAY); - DEFAULT_OP_FAIL(VECTOR3_ARRAY); - DEFAULT_OP_FAIL(COLOR_ARRAY); + DEFAULT_OP_FAIL(POOL_BYTE_ARRAY); + DEFAULT_OP_FAIL(POOL_INT_ARRAY); + DEFAULT_OP_FAIL(POOL_REAL_ARRAY); + DEFAULT_OP_FAIL(POOL_STRING_ARRAY); + DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY); + DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY); + DEFAULT_OP_FAIL(POOL_COLOR_ARRAY); case VARIANT_MAX: { r_valid=false; return; @@ -757,9 +757,9 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_FAIL(NIL); DEFAULT_OP_FAIL(STRING); DEFAULT_OP_FAIL(RECT2); - DEFAULT_OP_FAIL(MATRIX32); - DEFAULT_OP_FAIL(_AABB); - DEFAULT_OP_FAIL(MATRIX3); + DEFAULT_OP_FAIL(TRANSFORM2D); + DEFAULT_OP_FAIL(RECT3); + DEFAULT_OP_FAIL(BASIS); DEFAULT_OP_FAIL(TRANSFORM); DEFAULT_OP_NUM_POS(BOOL,_bool); DEFAULT_OP_NUM_POS(INT,_int); @@ -777,13 +777,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_FAIL(INPUT_EVENT); DEFAULT_OP_FAIL(DICTIONARY); DEFAULT_OP_FAIL(ARRAY); - DEFAULT_OP_FAIL(RAW_ARRAY); - DEFAULT_OP_FAIL(INT_ARRAY); - DEFAULT_OP_FAIL(REAL_ARRAY); - DEFAULT_OP_FAIL(STRING_ARRAY); - DEFAULT_OP_FAIL(VECTOR2_ARRAY); - DEFAULT_OP_FAIL(VECTOR3_ARRAY); - DEFAULT_OP_FAIL(COLOR_ARRAY); + DEFAULT_OP_FAIL(POOL_BYTE_ARRAY); + DEFAULT_OP_FAIL(POOL_INT_ARRAY); + DEFAULT_OP_FAIL(POOL_REAL_ARRAY); + DEFAULT_OP_FAIL(POOL_STRING_ARRAY); + DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY); + DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY); + DEFAULT_OP_FAIL(POOL_COLOR_ARRAY); case VARIANT_MAX: { r_valid=false; return; @@ -802,12 +802,12 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_FAIL(STRING); DEFAULT_OP_LOCALMEM_NEG(VECTOR2,Vector2); DEFAULT_OP_FAIL(RECT2); - DEFAULT_OP_FAIL(MATRIX32); + DEFAULT_OP_FAIL(TRANSFORM2D); DEFAULT_OP_LOCALMEM_NEG(VECTOR3,Vector3); DEFAULT_OP_LOCALMEM_NEG(PLANE,Plane); DEFAULT_OP_LOCALMEM_NEG(QUAT,Quat); - DEFAULT_OP_FAIL(_AABB); - DEFAULT_OP_FAIL(MATRIX3); + DEFAULT_OP_FAIL(RECT3); + DEFAULT_OP_FAIL(BASIS); DEFAULT_OP_FAIL(TRANSFORM); DEFAULT_OP_FAIL(COLOR); @@ -818,13 +818,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& DEFAULT_OP_FAIL(INPUT_EVENT); DEFAULT_OP_FAIL(DICTIONARY); DEFAULT_OP_FAIL(ARRAY); - DEFAULT_OP_FAIL(RAW_ARRAY); - DEFAULT_OP_FAIL(INT_ARRAY); - DEFAULT_OP_FAIL(REAL_ARRAY); - DEFAULT_OP_FAIL(STRING_ARRAY); - DEFAULT_OP_FAIL(VECTOR2_ARRAY); - DEFAULT_OP_FAIL(VECTOR3_ARRAY); - DEFAULT_OP_FAIL(COLOR_ARRAY); + DEFAULT_OP_FAIL(POOL_BYTE_ARRAY); + DEFAULT_OP_FAIL(POOL_INT_ARRAY); + DEFAULT_OP_FAIL(POOL_REAL_ARRAY); + DEFAULT_OP_FAIL(POOL_STRING_ARRAY); + DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY); + DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY); + DEFAULT_OP_FAIL(POOL_COLOR_ARRAY); case VARIANT_MAX: { r_valid=false; return; @@ -1157,7 +1157,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid) } } } break; - case MATRIX32: { + case TRANSFORM2D: { if (p_value.type!=Variant::VECTOR2) return; @@ -1169,7 +1169,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid) if (index<0) index += 3; if (index>=0 && index<3) { - Matrix32 *v=_data._matrix32; + Transform2D *v=_data._transform2d; valid=true; v->elements[index]=p_value; @@ -1179,7 +1179,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid) //scalar name const String *str=reinterpret_cast<const String*>(p_index._data._mem); - Matrix32 *v=_data._matrix32; + Transform2D *v=_data._transform2d; if (*str=="x") { valid=true; v->elements[0]=p_value; @@ -1305,7 +1305,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid) } } break; - case _AABB: { + case RECT3: { if (p_value.type!=Variant::VECTOR3) return; @@ -1315,7 +1315,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid) //scalar name const String *str=reinterpret_cast<const String*>(p_index._data._mem); - AABB *v=_data._aabb; + Rect3 *v=_data._rect3; if (*str=="pos") { valid=true; v->pos=p_value; @@ -1331,7 +1331,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid) } } } break; //sorry naming convention fail :( not like it's used often // 10 - case MATRIX3: { + case BASIS: { if (p_value.type!=Variant::VECTOR3) return; @@ -1343,7 +1343,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid) if (index<0) index += 3; if (index>=0 && index<3) { - Matrix3 *v=_data._matrix3; + Basis *v=_data._basis; valid=true; v->set_axis(index,p_value); @@ -1352,7 +1352,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid) } else if (p_index.get_type()==Variant::STRING) { const String *str=reinterpret_cast<const String*>(p_index._data._mem); - Matrix3 *v=_data._matrix3; + Basis *v=_data._basis; if (*str=="x") { valid=true; @@ -1398,7 +1398,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid) if (*str=="basis") { - if (p_value.type!=Variant::MATRIX3) + if (p_value.type!=Variant::BASIS) return; valid=true; v->basis=p_value; @@ -1887,13 +1887,13 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid) return; } break; // 20 DEFAULT_OP_ARRAY_CMD(ARRAY, Array, ;, (*arr)[index]=p_value;return) - DEFAULT_OP_DVECTOR_SET(RAW_ARRAY, uint8_t, p_value.type != Variant::REAL && p_value.type != Variant::INT) - DEFAULT_OP_DVECTOR_SET(INT_ARRAY, int, p_value.type != Variant::REAL && p_value.type != Variant::INT) - DEFAULT_OP_DVECTOR_SET(REAL_ARRAY, real_t, p_value.type != Variant::REAL && p_value.type != Variant::INT) - DEFAULT_OP_DVECTOR_SET(STRING_ARRAY, String, p_value.type != Variant::STRING) // 25 - DEFAULT_OP_DVECTOR_SET(VECTOR2_ARRAY, Vector2, p_value.type != Variant::VECTOR2) - DEFAULT_OP_DVECTOR_SET(VECTOR3_ARRAY, Vector3, p_value.type != Variant::VECTOR3) - DEFAULT_OP_DVECTOR_SET(COLOR_ARRAY, Color, p_value.type != Variant::COLOR) + DEFAULT_OP_DVECTOR_SET(POOL_BYTE_ARRAY, uint8_t, p_value.type != Variant::REAL && p_value.type != Variant::INT) + DEFAULT_OP_DVECTOR_SET(POOL_INT_ARRAY, int, p_value.type != Variant::REAL && p_value.type != Variant::INT) + DEFAULT_OP_DVECTOR_SET(POOL_REAL_ARRAY, real_t, p_value.type != Variant::REAL && p_value.type != Variant::INT) + DEFAULT_OP_DVECTOR_SET(POOL_STRING_ARRAY, String, p_value.type != Variant::STRING) // 25 + DEFAULT_OP_DVECTOR_SET(POOL_VECTOR2_ARRAY, Vector2, p_value.type != Variant::VECTOR2) + DEFAULT_OP_DVECTOR_SET(POOL_VECTOR3_ARRAY, Vector3, p_value.type != Variant::VECTOR3) + DEFAULT_OP_DVECTOR_SET(POOL_COLOR_ARRAY, Color, p_value.type != Variant::COLOR) default: return; } @@ -2007,7 +2007,7 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const { } } break; - case MATRIX32: { + case TRANSFORM2D: { if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) { @@ -2016,7 +2016,7 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const { if (index<0) index += 3; if (index>=0 && index<3) { - const Matrix32 *v=_data._matrix32; + const Transform2D *v=_data._transform2d; valid=true; return v->elements[index]; @@ -2025,7 +2025,7 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const { //scalar name const String *str=reinterpret_cast<const String*>(p_index._data._mem); - const Matrix32 *v=_data._matrix32; + const Transform2D *v=_data._transform2d; if (*str=="x") { valid=true; return v->elements[0]; @@ -2086,13 +2086,13 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const { } } break; - case _AABB: { + case RECT3: { if (p_index.get_type()==Variant::STRING) { //scalar name const String *str=reinterpret_cast<const String*>(p_index._data._mem); - const AABB *v=_data._aabb; + const Rect3 *v=_data._rect3; if (*str=="pos") { valid=true; return v->pos; @@ -2105,7 +2105,7 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const { } } } break; //sorry naming convention fail :( not like it's used often // 10 - case MATRIX3: { + case BASIS: { if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) { @@ -2113,7 +2113,7 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const { if (index<0) index += 3; if (index>=0 && index<3) { - const Matrix3 *v=_data._matrix3; + const Basis *v=_data._basis; valid=true; return v->get_axis(index); @@ -2121,7 +2121,7 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const { } else if (p_index.get_type()==Variant::STRING) { const String *str=reinterpret_cast<const String*>(p_index._data._mem); - const Matrix3 *v=_data._matrix3; + const Basis *v=_data._basis; if (*str=="x") { valid=true; @@ -2471,13 +2471,13 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const { } } break; // 20 DEFAULT_OP_ARRAY_CMD(ARRAY, const Array, ;, return (*arr)[index]) - DEFAULT_OP_DVECTOR_GET(RAW_ARRAY, uint8_t) - DEFAULT_OP_DVECTOR_GET(INT_ARRAY, int) - DEFAULT_OP_DVECTOR_GET(REAL_ARRAY, real_t) - DEFAULT_OP_DVECTOR_GET(STRING_ARRAY, String) - DEFAULT_OP_DVECTOR_GET(VECTOR2_ARRAY, Vector2) - DEFAULT_OP_DVECTOR_GET(VECTOR3_ARRAY, Vector3) - DEFAULT_OP_DVECTOR_GET(COLOR_ARRAY, Color) + DEFAULT_OP_DVECTOR_GET(POOL_BYTE_ARRAY, uint8_t) + DEFAULT_OP_DVECTOR_GET(POOL_INT_ARRAY, int) + DEFAULT_OP_DVECTOR_GET(POOL_REAL_ARRAY, real_t) + DEFAULT_OP_DVECTOR_GET(POOL_STRING_ARRAY, String) + DEFAULT_OP_DVECTOR_GET(POOL_VECTOR2_ARRAY, Vector2) + DEFAULT_OP_DVECTOR_GET(POOL_VECTOR3_ARRAY, Vector3) + DEFAULT_OP_DVECTOR_GET(POOL_COLOR_ARRAY, Color) default: return Variant(); } @@ -2557,7 +2557,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { return false; } break; - case RAW_ARRAY: { + case POOL_BYTE_ARRAY: { if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) { int index = p_index; @@ -2576,7 +2576,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { } } break; - case INT_ARRAY: { + case POOL_INT_ARRAY: { if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) { int index = p_index; @@ -2594,7 +2594,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { return false; } } break; - case REAL_ARRAY: { + case POOL_REAL_ARRAY: { if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) { @@ -2614,7 +2614,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { } } break; - case STRING_ARRAY: { + case POOL_STRING_ARRAY: { if (p_index.get_type()==Variant::STRING) { String index = p_index; @@ -2634,7 +2634,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { } } break; //25 - case VECTOR2_ARRAY: { + case POOL_VECTOR2_ARRAY: { if (p_index.get_type()==Variant::VECTOR2) { Vector2 index = p_index; @@ -2654,7 +2654,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { } } break; - case VECTOR3_ARRAY: { + case POOL_VECTOR3_ARRAY: { if (p_index.get_type()==Variant::VECTOR3) { Vector3 index = p_index; @@ -2674,7 +2674,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { } } break; - case COLOR_ARRAY: { + case POOL_COLOR_ARRAY: { if (p_index.get_type()==Variant::COLOR) { @@ -2729,7 +2729,7 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back( PropertyInfo(Variant::REAL,"z")); } break; - case MATRIX32: { + case TRANSFORM2D: { p_list->push_back( PropertyInfo(Variant::VECTOR2,"x")); p_list->push_back( PropertyInfo(Variant::VECTOR2,"y")); @@ -2753,12 +2753,12 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back( PropertyInfo(Variant::REAL,"w")); } break; - case _AABB: { + case RECT3: { p_list->push_back( PropertyInfo(Variant::VECTOR3,"pos")); p_list->push_back( PropertyInfo(Variant::VECTOR3,"size")); p_list->push_back( PropertyInfo(Variant::VECTOR3,"end")); } break; //sorry naming convention fail :( not like it's used often // 10 - case MATRIX3: { + case BASIS: { p_list->push_back( PropertyInfo(Variant::VECTOR3,"x")); p_list->push_back( PropertyInfo(Variant::VECTOR3,"y")); @@ -2767,7 +2767,7 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const { } break; case TRANSFORM: { - p_list->push_back( PropertyInfo(Variant::MATRIX3,"basis")); + p_list->push_back( PropertyInfo(Variant::BASIS,"basis")); p_list->push_back( PropertyInfo(Variant::VECTOR3,"origin")); } break; @@ -2914,12 +2914,12 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const { } } break; // 20 case ARRAY: - case RAW_ARRAY: - case INT_ARRAY: - case REAL_ARRAY: - case STRING_ARRAY: - case VECTOR3_ARRAY: - case COLOR_ARRAY: { + case POOL_BYTE_ARRAY: + case POOL_INT_ARRAY: + case POOL_REAL_ARRAY: + case POOL_STRING_ARRAY: + case POOL_VECTOR3_ARRAY: + case POOL_COLOR_ARRAY: { //nothing } break; @@ -2991,7 +2991,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { r_iter=0; return true; } break; - case RAW_ARRAY: { + case POOL_BYTE_ARRAY: { const PoolVector<uint8_t> *arr=reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem); if (arr->size()==0) return false; @@ -2999,7 +2999,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { return true; } break; - case INT_ARRAY: { + case POOL_INT_ARRAY: { const PoolVector<int> *arr=reinterpret_cast<const PoolVector<int>*>(_data._mem); if (arr->size()==0) return false; @@ -3007,7 +3007,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { return true; } break; - case REAL_ARRAY: { + case POOL_REAL_ARRAY: { const PoolVector<real_t> *arr=reinterpret_cast<const PoolVector<real_t>*>(_data._mem); if (arr->size()==0) return false; @@ -3015,14 +3015,14 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { return true; } break; - case STRING_ARRAY: { + case POOL_STRING_ARRAY: { const PoolVector<String> *arr=reinterpret_cast<const PoolVector<String>*>(_data._mem); if (arr->size()==0) return false; r_iter=0; return true; } break; - case VECTOR2_ARRAY: { + case POOL_VECTOR2_ARRAY: { const PoolVector<Vector2> *arr=reinterpret_cast<const PoolVector<Vector2>*>(_data._mem); if (arr->size()==0) @@ -3030,7 +3030,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { r_iter=0; return true; } break; - case VECTOR3_ARRAY: { + case POOL_VECTOR3_ARRAY: { const PoolVector<Vector3> *arr=reinterpret_cast<const PoolVector<Vector3>*>(_data._mem); if (arr->size()==0) @@ -3038,7 +3038,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { r_iter=0; return true; } break; - case COLOR_ARRAY: { + case POOL_COLOR_ARRAY: { const PoolVector<Color> *arr=reinterpret_cast<const PoolVector<Color>*>(_data._mem); if (arr->size()==0) @@ -3122,7 +3122,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { r_iter=idx; return true; } break; - case RAW_ARRAY: { + case POOL_BYTE_ARRAY: { const PoolVector<uint8_t> *arr=reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem); int idx=r_iter; idx++; @@ -3132,7 +3132,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { return true; } break; - case INT_ARRAY: { + case POOL_INT_ARRAY: { const PoolVector<int> *arr=reinterpret_cast<const PoolVector<int>*>(_data._mem); int idx=r_iter; idx++; @@ -3142,7 +3142,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { return true; } break; - case REAL_ARRAY: { + case POOL_REAL_ARRAY: { const PoolVector<real_t> *arr=reinterpret_cast<const PoolVector<real_t>*>(_data._mem); int idx=r_iter; idx++; @@ -3152,7 +3152,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { return true; } break; - case STRING_ARRAY: { + case POOL_STRING_ARRAY: { const PoolVector<String> *arr=reinterpret_cast<const PoolVector<String>*>(_data._mem); int idx=r_iter; idx++; @@ -3161,7 +3161,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { r_iter=idx; return true; } break; - case VECTOR2_ARRAY: { + case POOL_VECTOR2_ARRAY: { const PoolVector<Vector2> *arr=reinterpret_cast<const PoolVector<Vector2>*>(_data._mem); int idx=r_iter; @@ -3171,7 +3171,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { r_iter=idx; return true; } break; - case VECTOR3_ARRAY: { + case POOL_VECTOR3_ARRAY: { const PoolVector<Vector3> *arr=reinterpret_cast<const PoolVector<Vector3>*>(_data._mem); int idx=r_iter; @@ -3181,7 +3181,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { r_iter=idx; return true; } break; - case COLOR_ARRAY: { + case POOL_COLOR_ARRAY: { const PoolVector<Color> *arr=reinterpret_cast<const PoolVector<Color>*>(_data._mem); int idx=r_iter; @@ -3254,7 +3254,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { #endif return arr->get(idx); } break; - case RAW_ARRAY: { + case POOL_BYTE_ARRAY: { const PoolVector<uint8_t> *arr=reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem); int idx=r_iter; #ifdef DEBUG_ENABLED @@ -3265,7 +3265,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { #endif return arr->get(idx); } break; - case INT_ARRAY: { + case POOL_INT_ARRAY: { const PoolVector<int> *arr=reinterpret_cast<const PoolVector<int>*>(_data._mem); int idx=r_iter; #ifdef DEBUG_ENABLED @@ -3276,7 +3276,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { #endif return arr->get(idx); } break; - case REAL_ARRAY: { + case POOL_REAL_ARRAY: { const PoolVector<real_t> *arr=reinterpret_cast<const PoolVector<real_t>*>(_data._mem); int idx=r_iter; #ifdef DEBUG_ENABLED @@ -3287,7 +3287,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { #endif return arr->get(idx); } break; - case STRING_ARRAY: { + case POOL_STRING_ARRAY: { const PoolVector<String> *arr=reinterpret_cast<const PoolVector<String>*>(_data._mem); int idx=r_iter; #ifdef DEBUG_ENABLED @@ -3298,7 +3298,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { #endif return arr->get(idx); } break; - case VECTOR2_ARRAY: { + case POOL_VECTOR2_ARRAY: { const PoolVector<Vector2> *arr=reinterpret_cast<const PoolVector<Vector2>*>(_data._mem); int idx=r_iter; @@ -3310,7 +3310,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { #endif return arr->get(idx); } break; - case VECTOR3_ARRAY: { + case POOL_VECTOR3_ARRAY: { const PoolVector<Vector3> *arr=reinterpret_cast<const PoolVector<Vector3>*>(_data._mem); int idx=r_iter; @@ -3322,7 +3322,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { #endif return arr->get(idx); } break; - case COLOR_ARRAY: { + case POOL_COLOR_ARRAY: { const PoolVector<Color> *arr=reinterpret_cast<const PoolVector<Color>*>(_data._mem); int idx=r_iter; @@ -3374,10 +3374,10 @@ void Variant::blend(const Variant& a, const Variant& b, float c, Variant &r_dst) r_dst=Rect2(ra->pos + rb->pos * c, ra->size + rb->size * c); } return; case VECTOR3:{ r_dst=*reinterpret_cast<const Vector3*>(a._data._mem)+*reinterpret_cast<const Vector3*>(b._data._mem)*c; } return; - case _AABB:{ - const AABB *ra = reinterpret_cast<const AABB*>(a._data._mem); - const AABB *rb = reinterpret_cast<const AABB*>(b._data._mem); - r_dst=AABB(ra->pos + rb->pos * c, ra->size + rb->size * c); + case RECT3:{ + const Rect3 *ra = reinterpret_cast<const Rect3*>(a._data._mem); + const Rect3 *rb = reinterpret_cast<const Rect3*>(b._data._mem); + r_dst=Rect3(ra->pos + rb->pos * c, ra->size + rb->size * c); } return; case QUAT:{ Quat empty_rot; @@ -3476,11 +3476,11 @@ void Variant::interpolate(const Variant& a, const Variant& b, float c,Variant &r case VECTOR2:{ r_dst=reinterpret_cast<const Vector2*>(a._data._mem)->linear_interpolate(*reinterpret_cast<const Vector2*>(b._data._mem),c); } return; case RECT2:{ r_dst = Rect2( reinterpret_cast<const Rect2*>(a._data._mem)->pos.linear_interpolate(reinterpret_cast<const Rect2*>(b._data._mem)->pos,c), reinterpret_cast<const Rect2*>(a._data._mem)->size.linear_interpolate(reinterpret_cast<const Rect2*>(b._data._mem)->size,c) ); } return; case VECTOR3:{ r_dst=reinterpret_cast<const Vector3*>(a._data._mem)->linear_interpolate(*reinterpret_cast<const Vector3*>(b._data._mem),c); } return; - case MATRIX32:{ r_dst=a._data._matrix32->interpolate_with(*b._data._matrix32,c); } return; + case TRANSFORM2D:{ r_dst=a._data._transform2d->interpolate_with(*b._data._transform2d,c); } return; case PLANE:{ r_dst=a; } return; case QUAT:{ r_dst=reinterpret_cast<const Quat*>(a._data._mem)->slerp(*reinterpret_cast<const Quat*>(b._data._mem),c); } return; - case _AABB:{ r_dst=AABB( a._data._aabb->pos.linear_interpolate(b._data._aabb->pos,c), a._data._aabb->size.linear_interpolate(b._data._aabb->size,c) ); } return; - case MATRIX3:{ r_dst=Transform(*a._data._matrix3).interpolate_with(Transform(*b._data._matrix3),c).basis; } return; + case RECT3:{ r_dst=Rect3( a._data._rect3->pos.linear_interpolate(b._data._rect3->pos,c), a._data._rect3->size.linear_interpolate(b._data._rect3->size,c) ); } return; + case BASIS:{ r_dst=Transform(*a._data._basis).interpolate_with(Transform(*b._data._basis),c).basis; } return; case TRANSFORM:{ r_dst=a._data._transform->interpolate_with(*b._data._transform,c); } return; case COLOR:{ r_dst=reinterpret_cast<const Color*>(a._data._mem)->linear_interpolate(*reinterpret_cast<const Color*>(b._data._mem),c); } return; case IMAGE:{ r_dst=a; } return; @@ -3490,11 +3490,11 @@ void Variant::interpolate(const Variant& a, const Variant& b, float c,Variant &r case INPUT_EVENT:{ r_dst=a; } return; case DICTIONARY:{ } return; case ARRAY:{ r_dst=a; } return; - case RAW_ARRAY:{ r_dst=a; } return; - case INT_ARRAY:{ r_dst=a; } return; - case REAL_ARRAY:{ r_dst=a; } return; - case STRING_ARRAY:{ r_dst=a; } return; - case VECTOR2_ARRAY:{ + case POOL_BYTE_ARRAY:{ r_dst=a; } return; + case POOL_INT_ARRAY:{ r_dst=a; } return; + case POOL_REAL_ARRAY:{ r_dst=a; } return; + case POOL_STRING_ARRAY:{ r_dst=a; } return; + case POOL_VECTOR2_ARRAY:{ const PoolVector<Vector2> *arr_a=reinterpret_cast<const PoolVector<Vector2>* >(a._data._mem); const PoolVector<Vector2> *arr_b=reinterpret_cast<const PoolVector<Vector2>* >(b._data._mem); int sz = arr_a->size(); @@ -3520,7 +3520,7 @@ void Variant::interpolate(const Variant& a, const Variant& b, float c,Variant &r } return; - case VECTOR3_ARRAY:{ + case POOL_VECTOR3_ARRAY:{ const PoolVector<Vector3> *arr_a=reinterpret_cast<const PoolVector<Vector3>* >(a._data._mem); @@ -3547,7 +3547,7 @@ void Variant::interpolate(const Variant& a, const Variant& b, float c,Variant &r } } return; - case COLOR_ARRAY:{ r_dst=a; } return; + case POOL_COLOR_ARRAY:{ r_dst=a; } return; default: { r_dst=a; diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 1a11eb80d5..402c8d41da 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -614,7 +614,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in value=Vector3(args[0],args[1],args[2]); return OK; - } else if (id=="Matrix32"){ + } else if (id=="Transform2D" || id=="Matrix32"){ //compatibility Vector<float> args; Error err = _parse_construct<float>(p_stream,args,line,r_err_str); @@ -624,7 +624,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in if (args.size()!=6) { r_err_str="Expected 6 arguments for constructor"; } - Matrix32 m; + Transform2D m; m[0]=Vector2(args[0],args[1]); m[1]=Vector2(args[2],args[3]); m[2]=Vector2(args[4],args[5]); @@ -657,7 +657,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in value=Quat(args[0],args[1],args[2],args[3]); return OK; - } else if (id=="AABB"){ + } else if (id=="Rect3" || id=="AABB"){ Vector<float> args; Error err = _parse_construct<float>(p_stream,args,line,r_err_str); @@ -668,10 +668,10 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in r_err_str="Expected 6 arguments for constructor"; } - value=AABB(Vector3(args[0],args[1],args[2]),Vector3(args[3],args[4],args[5])); + value=Rect3(Vector3(args[0],args[1],args[2]),Vector3(args[3],args[4],args[5])); return OK; - } else if (id=="Matrix3"){ + } else if (id=="Basis" || id=="Matrix3"){ //compatibility Vector<float> args; Error err = _parse_construct<float>(p_stream,args,line,r_err_str); @@ -682,7 +682,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in r_err_str="Expected 9 arguments for constructor"; } - value=Matrix3(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]); + value=Basis(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]); return OK; } else if (id=="Transform"){ @@ -695,7 +695,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in r_err_str="Expected 12 arguments for constructor"; } - value=Transform(Matrix3(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]),Vector3(args[9],args[10],args[11])); + value=Transform(Basis(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]),Vector3(args[9],args[10],args[11])); return OK; } else if (id=="Color") { @@ -1149,7 +1149,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in return OK; - } else if (id=="ByteArray") { + } else if (id=="PoolByteArray"|| id=="ByteArray") { Vector<uint8_t> args; Error err = _parse_construct<uint8_t>(p_stream,args,line,r_err_str); @@ -1170,7 +1170,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in return OK; - } else if (id=="IntArray") { + } else if (id=="PoolIntArray"|| id=="IntArray") { Vector<int> args; Error err = _parse_construct<int>(p_stream,args,line,r_err_str); @@ -1191,7 +1191,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in return OK; - } else if (id=="FloatArray") { + } else if (id=="PoolFloatArray"|| id=="FloatArray") { Vector<float> args; Error err = _parse_construct<float>(p_stream,args,line,r_err_str); @@ -1211,7 +1211,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in value=arr; return OK; - } else if (id=="StringArray") { + } else if (id=="PoolStringArray"|| id=="StringArray") { get_token(p_stream,token,line,r_err_str); @@ -1266,7 +1266,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in return OK; - } else if (id=="Vector2Array") { + } else if (id=="PoolVector2Array"|| id=="Vector2Array") { Vector<float> args; Error err = _parse_construct<float>(p_stream,args,line,r_err_str); @@ -1287,7 +1287,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in return OK; - } else if (id=="Vector3Array") { + } else if (id=="PoolVector3Array"|| id=="Vector3Array") { Vector<float> args; Error err = _parse_construct<float>(p_stream,args,line,r_err_str); @@ -1308,7 +1308,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in return OK; - } else if (id=="ColorArray") { + } else if (id=="PoolColorArray"|| id=="ColorArray") { Vector<float> args; Error err = _parse_construct<float>(p_stream,args,line,r_err_str); @@ -1898,10 +1898,10 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud,"Plane( "+rtosfix(p.normal.x) +", "+rtosfix(p.normal.y)+", "+rtosfix(p.normal.z)+", "+rtosfix(p.d)+" )" ); } break; - case Variant::_AABB: { + case Variant::RECT3: { - AABB aabb = p_variant; - p_store_string_func(p_store_string_ud,"AABB( "+rtosfix(aabb.pos.x) +", "+rtosfix(aabb.pos.y) +", "+rtosfix(aabb.pos.z) +", "+rtosfix(aabb.size.x) +", "+rtosfix(aabb.size.y) +", "+rtosfix(aabb.size.z)+" )" ); + Rect3 aabb = p_variant; + p_store_string_func(p_store_string_ud,"Rect3( "+rtosfix(aabb.pos.x) +", "+rtosfix(aabb.pos.y) +", "+rtosfix(aabb.pos.z) +", "+rtosfix(aabb.size.x) +", "+rtosfix(aabb.size.y) +", "+rtosfix(aabb.size.z)+" )" ); } break; case Variant::QUAT: { @@ -1910,10 +1910,10 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud,"Quat( "+rtosfix(quat.x)+", "+rtosfix(quat.y)+", "+rtosfix(quat.z)+", "+rtosfix(quat.w)+" )"); } break; - case Variant::MATRIX32: { + case Variant::TRANSFORM2D: { - String s="Matrix32( "; - Matrix32 m3 = p_variant; + String s="Transform2D( "; + Transform2D m3 = p_variant; for (int i=0;i<3;i++) { for (int j=0;j<2;j++) { @@ -1926,10 +1926,10 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud,s+" )"); } break; - case Variant::MATRIX3: { + case Variant::BASIS: { - String s="Matrix3( "; - Matrix3 m3 = p_variant; + String s="Basis( "; + Basis m3 = p_variant; for (int i=0;i<3;i++) { for (int j=0;j<3;j++) { @@ -1946,7 +1946,7 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str String s="Transform( "; Transform t = p_variant; - Matrix3 &m3 = t.basis; + Basis &m3 = t.basis; for (int i=0;i<3;i++) { for (int j=0;j<3;j++) { @@ -2124,9 +2124,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str } break; - case Variant::RAW_ARRAY: { + case Variant::POOL_BYTE_ARRAY: { - p_store_string_func(p_store_string_ud,"ByteArray( "); + p_store_string_func(p_store_string_ud,"PoolByteArray( "); String s; PoolVector<uint8_t> data = p_variant; int len = data.size(); @@ -2144,9 +2144,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud," )"); } break; - case Variant::INT_ARRAY: { + case Variant::POOL_INT_ARRAY: { - p_store_string_func(p_store_string_ud,"IntArray( "); + p_store_string_func(p_store_string_ud,"PoolIntArray( "); PoolVector<int> data = p_variant; int len = data.size(); PoolVector<int>::Read r = data.read(); @@ -2164,9 +2164,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud," )"); } break; - case Variant::REAL_ARRAY: { + case Variant::POOL_REAL_ARRAY: { - p_store_string_func(p_store_string_ud,"FloatArray( "); + p_store_string_func(p_store_string_ud,"PoolFloatArray( "); PoolVector<real_t> data = p_variant; int len = data.size(); PoolVector<real_t>::Read r = data.read(); @@ -2182,9 +2182,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud," )"); } break; - case Variant::STRING_ARRAY: { + case Variant::POOL_STRING_ARRAY: { - p_store_string_func(p_store_string_ud,"StringArray( "); + p_store_string_func(p_store_string_ud,"PoolStringArray( "); PoolVector<String> data = p_variant; int len = data.size(); PoolVector<String>::Read r = data.read(); @@ -2205,9 +2205,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud," )"); } break; - case Variant::VECTOR2_ARRAY: { + case Variant::POOL_VECTOR2_ARRAY: { - p_store_string_func(p_store_string_ud,"Vector2Array( "); + p_store_string_func(p_store_string_ud,"PoolVector2Array( "); PoolVector<Vector2> data = p_variant; int len = data.size(); PoolVector<Vector2>::Read r = data.read(); @@ -2223,9 +2223,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud," )"); } break; - case Variant::VECTOR3_ARRAY: { + case Variant::POOL_VECTOR3_ARRAY: { - p_store_string_func(p_store_string_ud,"Vector3Array( "); + p_store_string_func(p_store_string_ud,"PoolVector3Array( "); PoolVector<Vector3> data = p_variant; int len = data.size(); PoolVector<Vector3>::Read r = data.read(); @@ -2241,9 +2241,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud," )"); } break; - case Variant::COLOR_ARRAY: { + case Variant::POOL_COLOR_ARRAY: { - p_store_string_func(p_store_string_ud,"ColorArray( "); + p_store_string_func(p_store_string_ud,"PoolColorArray( "); PoolVector<Color> data = p_variant; int len = data.size(); diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index 4ef96de9d9..adb9fe0e83 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -299,8 +299,8 @@ String ShaderCompilerGLES2::dump_node_code(SL::Node *p_node,int p_level,bool p_a case SL::TYPE_VEC2: { Vector2 v = cnode->value; code="vec2("+_mknum(v.x)+", "+_mknum(v.y)+")"; } break; case SL::TYPE_VEC3: { Vector3 v = cnode->value; code="vec3("+_mknum(v.x)+", "+_mknum(v.y)+", "+_mknum(v.z)+")"; } break; case SL::TYPE_VEC4: { Plane v = cnode->value; code="vec4("+_mknum(v.normal.x)+", "+_mknum(v.normal.y)+", "+_mknum(v.normal.z)+", "+_mknum(v.d)+")"; } break; - case SL::TYPE_MAT2: { Matrix32 x = cnode->value; code="mat2( vec2("+_mknum(x[0][0])+", "+_mknum(x[0][1])+"), vec2("+_mknum(x[1][0])+", "+_mknum(x[1][1])+"))"; } break; - case SL::TYPE_MAT3: { Matrix3 x = cnode->value; code="mat3( vec3("+_mknum(x.get_axis(0).x)+", "+_mknum(x.get_axis(0).y)+", "+_mknum(x.get_axis(0).z)+"), vec3("+_mknum(x.get_axis(1).x)+", "+_mknum(x.get_axis(1).y)+", "+_mknum(x.get_axis(1).z)+"), vec3("+_mknum(x.get_axis(2).x)+", "+_mknum(x.get_axis(2).y)+", "+_mknum(x.get_axis(2).z)+"))"; } break; + case SL::TYPE_MAT2: { Transform2D x = cnode->value; code="mat2( vec2("+_mknum(x[0][0])+", "+_mknum(x[0][1])+"), vec2("+_mknum(x[1][0])+", "+_mknum(x[1][1])+"))"; } break; + case SL::TYPE_MAT3: { Basis x = cnode->value; code="mat3( vec3("+_mknum(x.get_axis(0).x)+", "+_mknum(x.get_axis(0).y)+", "+_mknum(x.get_axis(0).z)+"), vec3("+_mknum(x.get_axis(1).x)+", "+_mknum(x.get_axis(1).y)+", "+_mknum(x.get_axis(1).z)+"), vec3("+_mknum(x.get_axis(2).x)+", "+_mknum(x.get_axis(2).y)+", "+_mknum(x.get_axis(2).z)+"))"; } break; case SL::TYPE_MAT4: { Transform x = cnode->value; code="mat4( vec4("+_mknum(x.basis.get_axis(0).x)+", "+_mknum(x.basis.get_axis(0).y)+", "+_mknum(x.basis.get_axis(0).z)+",0.0), vec4("+_mknum(x.basis.get_axis(1).x)+", "+_mknum(x.basis.get_axis(1).y)+", "+_mknum(x.basis.get_axis(1).z)+",0.0), vec4("+_mknum(x.basis.get_axis(2).x)+", "+_mknum(x.basis.get_axis(2).y)+", "+_mknum(x.basis.get_axis(2).z)+",0.0), vec4("+_mknum(x.origin.x)+", "+_mknum(x.origin.y)+", "+_mknum(x.origin.z)+",1.0))"; } break; default: code="<error: "+Variant::get_type_name(cnode->value.get_type())+" ("+itos(cnode->datatype)+">"; } diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 6bd440eec1..3c3768be67 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1,7 +1,7 @@ #include "rasterizer_canvas_gles3.h" #include "os/os.h" -static _FORCE_INLINE_ void store_matrix32(const Matrix32& p_mtx, float* p_array) { +static _FORCE_INLINE_ void store_transform2d(const Transform2D& p_mtx, float* p_array) { p_array[ 0]=p_mtx.elements[0][0]; p_array[ 1]=p_mtx.elements[0][1]; @@ -69,8 +69,8 @@ void RasterizerCanvasGLES3::light_internal_update(RID p_rid, Light* p_light) { LightInternal * li = light_internal_owner.getornull(p_rid); ERR_FAIL_COND(!li); - store_matrix32(p_light->light_shader_xform,li->ubo_data.light_matrix); - store_matrix32(p_light->xform_cache.affine_inverse(),li->ubo_data.local_matrix); + store_transform2d(p_light->light_shader_xform,li->ubo_data.light_matrix); + store_transform2d(p_light->xform_cache.affine_inverse(),li->ubo_data.local_matrix); store_camera(p_light->shadow_matrix_cache,li->ubo_data.shadow_matrix); for(int i=0;i<4;i++) { @@ -141,8 +141,8 @@ void RasterizerCanvasGLES3::canvas_begin(){ state.canvas_shader.set_custom_shader(0); state.canvas_shader.bind(); state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE,Color(1,1,1,1)); - state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,Matrix32()); - state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,Matrix32()); + state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,Transform2D()); + state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,Transform2D()); @@ -999,7 +999,7 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const ci->final_modulate.a * p_modulate.a ); state.final_transform = ci->final_transform; - state.extra_matrix=Matrix32(); + state.extra_matrix=Transform2D(); state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE,state.canvas_item_modulate); state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,state.final_transform); @@ -1081,7 +1081,7 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE,state.canvas_item_modulate); state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,state.final_transform); - state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,Matrix32()); + state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,Transform2D()); } @@ -1212,7 +1212,7 @@ void RasterizerCanvasGLES3::canvas_debug_viewport_shadows(Light* p_lights_with_s } -void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, const Matrix32& p_light_xform, int p_light_mask,float p_near, float p_far, LightOccluderInstance* p_occluders, CameraMatrix *p_xform_cache) { +void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D& p_light_xform, int p_light_mask,float p_near, float p_far, LightOccluderInstance* p_occluders, CameraMatrix *p_xform_cache) { RasterizerStorageGLES3::CanvasLightShadow *cls = storage->canvas_light_shadow_owner.get(p_buffer); ERR_FAIL_COND(!cls); @@ -1269,7 +1269,7 @@ void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, cons projection.set_frustum( xmin, xmax, ymin, ymax, nearp, farp ); } - Vector3 cam_target=Matrix3(Vector3(0,0,Math_PI*2*(i/4.0))).xform(Vector3(0,1,0)); + Vector3 cam_target=Basis(Vector3(0,0,Math_PI*2*(i/4.0))).xform(Vector3(0,1,0)); projection = projection * CameraMatrix(Transform().looking_at(cam_target,Vector3(0,0,-1)).affine_inverse()); state.canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES3::PROJECTION_MATRIX,projection); diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h index 670310068c..6630ec38c4 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.h +++ b/drivers/gles3/rasterizer_canvas_gles3.h @@ -42,8 +42,8 @@ public: Transform vp; Color canvas_item_modulate; - Matrix32 extra_matrix; - Matrix32 final_transform; + Transform2D extra_matrix; + Transform2D final_transform; } state; @@ -90,7 +90,7 @@ public: virtual void canvas_render_items(Item *p_item_list,int p_z,const Color& p_modulate,Light *p_light); virtual void canvas_debug_viewport_shadows(Light* p_lights_with_shadow); - virtual void canvas_light_shadow_buffer_update(RID p_buffer, const Matrix32& p_light_xform, int p_light_mask,float p_near, float p_far, LightOccluderInstance* p_occluders, CameraMatrix *p_xform_cache); + virtual void canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D& p_light_xform, int p_light_mask,float p_near, float p_far, LightOccluderInstance* p_occluders, CameraMatrix *p_xform_cache); virtual void reset_canvas(); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index b5904e09d0..5611b4b63a 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -15,7 +15,7 @@ static const GLenum _cube_side_enum[6]={ }; -static _FORCE_INLINE_ void store_matrix32(const Matrix32& p_mtx, float* p_array) { +static _FORCE_INLINE_ void store_transform2d(const Transform2D& p_mtx, float* p_array) { p_array[ 0]=p_mtx.elements[0][0]; p_array[ 1]=p_mtx.elements[0][1]; diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index a3c5bf5577..a4fea29b47 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1601,7 +1601,7 @@ void RasterizerStorageGLES3::shader_get_param_list(RID p_shader, List<PropertyIn case ShaderLanguage::TYPE_UVEC3: case ShaderLanguage::TYPE_UVEC4: { - pi.type=Variant::INT_ARRAY; + pi.type=Variant::POOL_INT_ARRAY; } break; case ShaderLanguage::TYPE_FLOAT: { pi.type=Variant::REAL; @@ -1620,8 +1620,8 @@ void RasterizerStorageGLES3::shader_get_param_list(RID p_shader, List<PropertyIn pi.type=Variant::PLANE; } } break; - case ShaderLanguage::TYPE_MAT2: pi.type=Variant::MATRIX32; break; - case ShaderLanguage::TYPE_MAT3: pi.type=Variant::MATRIX3; break; + case ShaderLanguage::TYPE_MAT2: pi.type=Variant::TRANSFORM2D; break; + case ShaderLanguage::TYPE_MAT3: pi.type=Variant::BASIS; break; case ShaderLanguage::TYPE_MAT4: pi.type=Variant::TRANSFORM; break; case ShaderLanguage::TYPE_SAMPLER2D: case ShaderLanguage::TYPE_ISAMPLER2D: @@ -2009,7 +2009,7 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } } break; case ShaderLanguage::TYPE_MAT2: { - Matrix32 v = value; + Transform2D v = value; GLfloat *gui = (GLfloat*)data; gui[ 0]=v.elements[0][0]; @@ -2020,7 +2020,7 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy case ShaderLanguage::TYPE_MAT3: { - Matrix3 v = value; + Basis v = value; GLfloat *gui = (GLfloat*)data; gui[ 0]=v.elements[0][0]; @@ -2463,7 +2463,7 @@ RID RasterizerStorageGLES3::mesh_create(){ } -void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes,const Vector<AABB>& p_bone_aabbs){ +void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes,const Vector<Rect3>& p_bone_aabbs){ PoolVector<uint8_t> array = p_array; @@ -3009,11 +3009,11 @@ VS::PrimitiveType RasterizerStorageGLES3::mesh_surface_get_primitive_type(RID p_ return mesh->surfaces[p_surface]->primitive; } -AABB RasterizerStorageGLES3::mesh_surface_get_aabb(RID p_mesh, int p_surface) const { +Rect3 RasterizerStorageGLES3::mesh_surface_get_aabb(RID p_mesh, int p_surface) const { const Mesh *mesh = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!mesh,AABB()); - ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),AABB()); + ERR_FAIL_COND_V(!mesh,Rect3()); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),Rect3()); return mesh->surfaces[p_surface]->aabb; @@ -3051,11 +3051,11 @@ Vector<PoolVector<uint8_t> > RasterizerStorageGLES3::mesh_surface_get_blend_shap return bsarr; } -Vector<AABB> RasterizerStorageGLES3::mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const{ +Vector<Rect3> RasterizerStorageGLES3::mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const{ const Mesh *mesh = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!mesh,Vector<AABB >()); - ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),Vector<AABB >()); + ERR_FAIL_COND_V(!mesh,Vector<Rect3 >()); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),Vector<Rect3 >()); return mesh->surfaces[p_surface]->skeleton_bone_aabb; @@ -3103,47 +3103,47 @@ int RasterizerStorageGLES3::mesh_get_surface_count(RID p_mesh) const{ } -void RasterizerStorageGLES3::mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb){ +void RasterizerStorageGLES3::mesh_set_custom_aabb(RID p_mesh,const Rect3& p_aabb){ Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); mesh->custom_aabb=p_aabb; } -AABB RasterizerStorageGLES3::mesh_get_custom_aabb(RID p_mesh) const{ +Rect3 RasterizerStorageGLES3::mesh_get_custom_aabb(RID p_mesh) const{ const Mesh *mesh = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!mesh,AABB()); + ERR_FAIL_COND_V(!mesh,Rect3()); return mesh->custom_aabb; } -AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh,RID p_skeleton) const{ +Rect3 RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh,RID p_skeleton) const{ Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND_V(!mesh,AABB()); + ERR_FAIL_COND_V(!mesh,Rect3()); - if (mesh->custom_aabb!=AABB()) + if (mesh->custom_aabb!=Rect3()) return mesh->custom_aabb; Skeleton *sk=NULL; if (p_skeleton.is_valid()) sk=skeleton_owner.get(p_skeleton); - AABB aabb; + Rect3 aabb; if (sk && sk->size!=0) { for (int i=0;i<mesh->surfaces.size();i++) { - AABB laabb; + Rect3 laabb; if (mesh->surfaces[i]->format&VS::ARRAY_FORMAT_BONES && mesh->surfaces[i]->skeleton_bone_aabb.size()) { int bs = mesh->surfaces[i]->skeleton_bone_aabb.size(); - const AABB *skbones = mesh->surfaces[i]->skeleton_bone_aabb.ptr(); + const Rect3 *skbones = mesh->surfaces[i]->skeleton_bone_aabb.ptr(); const bool *skused = mesh->surfaces[i]->skeleton_bone_used.ptr(); int sbs = sk->size; @@ -3170,7 +3170,7 @@ AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh,RID p_skeleton) const{ mtx.basis.elements[1][1]=dataptr[ 5]; mtx.origin[1]=dataptr[ 7]; - AABB baabb = mtx.xform( skbones[j] ); + Rect3 baabb = mtx.xform( skbones[j] ); if (first) { laabb=baabb; first=false; @@ -3200,7 +3200,7 @@ AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh,RID p_skeleton) const{ mtx.basis.elements[2][2]=dataptr[10]; mtx.origin.z=dataptr[11]; - AABB baabb = mtx.xform ( skbones[j] ); + Rect3 baabb = mtx.xform ( skbones[j] ); if (first) { laabb=baabb; first=false; @@ -3630,7 +3630,7 @@ void RasterizerStorageGLES3::multimesh_instance_set_transform(RID p_multimesh,in } } -void RasterizerStorageGLES3::multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform){ +void RasterizerStorageGLES3::multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Transform2D& p_transform){ MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND(!multimesh); @@ -3726,17 +3726,17 @@ Transform RasterizerStorageGLES3::multimesh_instance_get_transform(RID p_multime return xform; } -Matrix32 RasterizerStorageGLES3::multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const{ +Transform2D RasterizerStorageGLES3::multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const{ MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); - ERR_FAIL_COND_V(!multimesh,Matrix32()); - ERR_FAIL_INDEX_V(p_index,multimesh->size,Matrix32()); - ERR_FAIL_COND_V(multimesh->transform_format==VS::MULTIMESH_TRANSFORM_3D,Matrix32()); + ERR_FAIL_COND_V(!multimesh,Transform2D()); + ERR_FAIL_INDEX_V(p_index,multimesh->size,Transform2D()); + ERR_FAIL_COND_V(multimesh->transform_format==VS::MULTIMESH_TRANSFORM_3D,Transform2D()); int stride = multimesh->color_floats+multimesh->xform_floats; float *dataptr=&multimesh->data[stride*p_index]; - Matrix32 xform; + Transform2D xform; xform.elements[0][0]=dataptr[ 0]; xform.elements[1][0]=dataptr[ 1]; @@ -3795,10 +3795,10 @@ int RasterizerStorageGLES3::multimesh_get_visible_instances(RID p_multimesh) con return multimesh->visible_instances; } -AABB RasterizerStorageGLES3::multimesh_get_aabb(RID p_multimesh) const{ +Rect3 RasterizerStorageGLES3::multimesh_get_aabb(RID p_multimesh) const{ MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); - ERR_FAIL_COND_V(!multimesh,AABB()); + ERR_FAIL_COND_V(!multimesh,Rect3()); const_cast<RasterizerStorageGLES3*>(this)->update_dirty_multimeshes(); //update pending AABBs @@ -3825,7 +3825,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() { if (multimesh->size && multimesh->dirty_aabb) { - AABB mesh_aabb; + Rect3 mesh_aabb; if (multimesh->mesh.is_valid()) { mesh_aabb=mesh_get_aabb(multimesh->mesh,RID()); @@ -3837,7 +3837,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() { int count = multimesh->data.size(); float *data=multimesh->data.ptr(); - AABB aabb; + Rect3 aabb; if (multimesh->transform_format==VS::MULTIMESH_TRANSFORM_2D) { @@ -3852,7 +3852,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() { xform.basis[1][1]=dataptr[ 5]; xform.origin[1]=dataptr[ 7]; - AABB laabb = xform.xform(mesh_aabb); + Rect3 laabb = xform.xform(mesh_aabb); if (i==0) aabb=laabb; else @@ -3878,7 +3878,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() { xform.basis.elements[2][2]=dataptr[10]; xform.origin.z=dataptr[11]; - AABB laabb = xform.xform(mesh_aabb); + Rect3 laabb = xform.xform(mesh_aabb); if (i==0) aabb=laabb; else @@ -4028,10 +4028,10 @@ void RasterizerStorageGLES3::immediate_clear(RID p_immediate) { } -AABB RasterizerStorageGLES3::immediate_get_aabb(RID p_immediate) const { +Rect3 RasterizerStorageGLES3::immediate_get_aabb(RID p_immediate) const { Immediate *im = immediate_owner.get(p_immediate); - ERR_FAIL_COND_V(!im,AABB()); + ERR_FAIL_COND_V(!im,Rect3()); return im->aabb; } @@ -4185,7 +4185,7 @@ Transform RasterizerStorageGLES3::skeleton_bone_get_transform(RID p_skeleton,int return mtx; } -void RasterizerStorageGLES3::skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform){ +void RasterizerStorageGLES3::skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Transform2D& p_transform){ Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); @@ -4208,16 +4208,16 @@ void RasterizerStorageGLES3::skeleton_bone_set_transform_2d(RID p_skeleton,int p } } -Matrix32 RasterizerStorageGLES3::skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone) const{ +Transform2D RasterizerStorageGLES3::skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone) const{ Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); - ERR_FAIL_COND_V(!skeleton,Matrix32()); - ERR_FAIL_INDEX_V(p_bone,skeleton->size,Matrix32()); - ERR_FAIL_COND_V(!skeleton->use_2d,Matrix32()); + ERR_FAIL_COND_V(!skeleton,Transform2D()); + ERR_FAIL_INDEX_V(p_bone,skeleton->size,Transform2D()); + ERR_FAIL_COND_V(!skeleton->use_2d,Transform2D()); - Matrix32 mtx; + Transform2D mtx; float * bones = skeleton->bones.ptr(); mtx.elements[0][0]=bones[p_bone*12+ 0]; @@ -4474,10 +4474,10 @@ uint64_t RasterizerStorageGLES3::light_get_version(RID p_light) const { } -AABB RasterizerStorageGLES3::light_get_aabb(RID p_light) const { +Rect3 RasterizerStorageGLES3::light_get_aabb(RID p_light) const { const Light * light = light_owner.getornull(p_light); - ERR_FAIL_COND_V(!light,AABB()); + ERR_FAIL_COND_V(!light,Rect3()); switch( light->type ) { @@ -4485,22 +4485,22 @@ AABB RasterizerStorageGLES3::light_get_aabb(RID p_light) const { float len=light->param[VS::LIGHT_PARAM_RANGE]; float size=Math::tan(Math::deg2rad(light->param[VS::LIGHT_PARAM_SPOT_ANGLE]))*len; - return AABB( Vector3( -size,-size,-len ), Vector3( size*2, size*2, len ) ); + return Rect3( Vector3( -size,-size,-len ), Vector3( size*2, size*2, len ) ); } break; case VS::LIGHT_OMNI: { float r = light->param[VS::LIGHT_PARAM_RANGE]; - return AABB( -Vector3(r,r,r), Vector3(r,r,r)*2 ); + return Rect3( -Vector3(r,r,r), Vector3(r,r,r)*2 ); } break; case VS::LIGHT_DIRECTIONAL: { - return AABB(); + return Rect3(); } break; default: {} } - ERR_FAIL_V( AABB() ); - return AABB(); + ERR_FAIL_V( Rect3() ); + return Rect3(); } /* PROBE API */ @@ -4635,11 +4635,11 @@ void RasterizerStorageGLES3::reflection_probe_set_cull_mask(RID p_probe, uint32_ } -AABB RasterizerStorageGLES3::reflection_probe_get_aabb(RID p_probe) const { +Rect3 RasterizerStorageGLES3::reflection_probe_get_aabb(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); - ERR_FAIL_COND_V(!reflection_probe,AABB()); + ERR_FAIL_COND_V(!reflection_probe,Rect3()); - AABB aabb; + Rect3 aabb; aabb.pos=-reflection_probe->extents; aabb.size=reflection_probe->extents*2.0; @@ -4744,7 +4744,7 @@ RID RasterizerStorageGLES3::gi_probe_create() { GIProbe *gip = memnew( GIProbe ); - gip->bounds=AABB(Vector3(),Vector3(1,1,1)); + gip->bounds=Rect3(Vector3(),Vector3(1,1,1)); gip->dynamic_range=1.0; gip->energy=1.0; gip->interior=false; @@ -4755,7 +4755,7 @@ RID RasterizerStorageGLES3::gi_probe_create() { return gi_probe_owner.make_rid(gip); } -void RasterizerStorageGLES3::gi_probe_set_bounds(RID p_probe,const AABB& p_bounds){ +void RasterizerStorageGLES3::gi_probe_set_bounds(RID p_probe,const Rect3& p_bounds){ GIProbe *gip = gi_probe_owner.getornull(p_probe); ERR_FAIL_COND(!gip); @@ -4764,10 +4764,10 @@ void RasterizerStorageGLES3::gi_probe_set_bounds(RID p_probe,const AABB& p_bound gip->version++; gip->instance_change_notify(); } -AABB RasterizerStorageGLES3::gi_probe_get_bounds(RID p_probe) const{ +Rect3 RasterizerStorageGLES3::gi_probe_get_bounds(RID p_probe) const{ const GIProbe *gip = gi_probe_owner.getornull(p_probe); - ERR_FAIL_COND_V(!gip,AABB()); + ERR_FAIL_COND_V(!gip,Rect3()); return gip->bounds; } @@ -5074,7 +5074,7 @@ void RasterizerStorageGLES3::particles_set_randomness_ratio(RID p_particles,floa particles->randomness=p_ratio; } -void RasterizerStorageGLES3::particles_set_custom_aabb(RID p_particles,const AABB& p_aabb) { +void RasterizerStorageGLES3::particles_set_custom_aabb(RID p_particles,const Rect3& p_aabb) { Particles *particles = particles_owner.getornull(p_particles); ERR_FAIL_COND(!particles); @@ -5166,10 +5166,10 @@ void RasterizerStorageGLES3::particles_set_draw_pass_mesh(RID p_particles,int p_ } -AABB RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) { +Rect3 RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) { const Particles *particles = particles_owner.getornull(p_particles); - ERR_FAIL_COND_V(!particles,AABB()); + ERR_FAIL_COND_V(!particles,Rect3()); return particles->computed_aabb; } diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 32581e860d..66593b202f 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -526,7 +526,7 @@ public: GLuint vertex_id; GLuint index_id; - Vector<AABB> skeleton_bone_aabb; + Vector<Rect3> skeleton_bone_aabb; Vector<bool> skeleton_bone_used; //bool packed; @@ -538,7 +538,7 @@ public: Vector<MorphTarget> morph_targets; - AABB aabb; + Rect3 aabb; int array_len; int index_array_len; @@ -585,7 +585,7 @@ public: Vector<Surface*> surfaces; int morph_target_count; VS::MorphTargetMode morph_target_mode; - AABB custom_aabb; + Rect3 custom_aabb; mutable uint64_t last_pass; Mesh() { morph_target_mode=VS::MORPH_MODE_NORMALIZED; @@ -599,7 +599,7 @@ public: virtual RID mesh_create(); - virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes=Vector<PoolVector<uint8_t> >(),const Vector<AABB>& p_bone_aabbs=Vector<AABB>()); + virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes=Vector<PoolVector<uint8_t> >(),const Vector<Rect3>& p_bone_aabbs=Vector<Rect3>()); virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount); virtual int mesh_get_morph_target_count(RID p_mesh) const; @@ -621,17 +621,17 @@ public: virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const; virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const; - virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const; + virtual Rect3 mesh_surface_get_aabb(RID p_mesh, int p_surface) const; virtual Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const; - virtual Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const; + virtual Vector<Rect3> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const; virtual void mesh_remove_surface(RID p_mesh, int p_surface); virtual int mesh_get_surface_count(RID p_mesh) const; - virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb); - virtual AABB mesh_get_custom_aabb(RID p_mesh) const; + virtual void mesh_set_custom_aabb(RID p_mesh,const Rect3& p_aabb); + virtual Rect3 mesh_get_custom_aabb(RID p_mesh) const; - virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton) const; + virtual Rect3 mesh_get_aabb(RID p_mesh, RID p_skeleton) const; virtual void mesh_clear(RID p_mesh); void mesh_render_blend_shapes(Surface *s, float *p_weights); @@ -644,7 +644,7 @@ public: VS::MultimeshTransformFormat transform_format; VS::MultimeshColorFormat color_format; Vector<float> data; - AABB aabb; + Rect3 aabb; SelfList<MultiMesh> update_list; GLuint buffer; int visible_instances; @@ -681,19 +681,19 @@ public: virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh); virtual void multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform); - virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform); + virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Transform2D& p_transform); virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color); virtual RID multimesh_get_mesh(RID p_multimesh) const; virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const; - virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const; + virtual Transform2D multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const; virtual Color multimesh_instance_get_color(RID p_multimesh,int p_index) const; virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible); virtual int multimesh_get_visible_instances(RID p_multimesh) const; - virtual AABB multimesh_get_aabb(RID p_multimesh) const; + virtual Rect3 multimesh_get_aabb(RID p_multimesh) const; /* IMMEDIATE API */ @@ -714,7 +714,7 @@ public: List<Chunk> chunks; bool building; int mask; - AABB aabb; + Rect3 aabb; Immediate() { type=GEOMETRY_IMMEDIATE; building=false;} @@ -741,7 +741,7 @@ public: virtual void immediate_clear(RID p_immediate); virtual void immediate_set_material(RID p_immediate,RID p_material); virtual RID immediate_get_material(RID p_immediate) const; - virtual AABB immediate_get_aabb(RID p_immediate) const; + virtual Rect3 immediate_get_aabb(RID p_immediate) const; /* SKELETON API */ @@ -771,8 +771,8 @@ public: virtual int skeleton_get_bone_count(RID p_skeleton) const; virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform); virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone) const; - virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform); - virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone) const; + virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Transform2D& p_transform); + virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone) const; /* Light API */ @@ -823,7 +823,7 @@ public: virtual float light_get_param(RID p_light,VS::LightParam p_param); virtual Color light_get_color(RID p_light); - virtual AABB light_get_aabb(RID p_light) const; + virtual Rect3 light_get_aabb(RID p_light) const; virtual uint64_t light_get_version(RID p_light) const; /* PROBE API */ @@ -862,7 +862,7 @@ public: virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable); virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers); - virtual AABB reflection_probe_get_aabb(RID p_probe) const; + virtual Rect3 reflection_probe_get_aabb(RID p_probe) const; virtual VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const; virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const; @@ -902,7 +902,7 @@ public: struct GIProbe : public Instantiable { - AABB bounds; + Rect3 bounds; Transform to_cell; float cell_size; @@ -922,8 +922,8 @@ public: virtual RID gi_probe_create(); - virtual void gi_probe_set_bounds(RID p_probe,const AABB& p_bounds); - virtual AABB gi_probe_get_bounds(RID p_probe) const; + virtual void gi_probe_set_bounds(RID p_probe,const Rect3& p_bounds); + virtual Rect3 gi_probe_get_bounds(RID p_probe) const; virtual void gi_probe_set_cell_size(RID p_probe, float p_size); virtual float gi_probe_get_cell_size(RID p_probe) const; @@ -977,7 +977,7 @@ public: float pre_process_time; float explosiveness; float randomness; - AABB custom_aabb; + Rect3 custom_aabb; Vector3 gravity; bool use_local_coords; RID process_material; @@ -996,7 +996,7 @@ public: Vector<DrawPass> draw_passes; - AABB computed_aabb; + Rect3 computed_aabb; GLuint particle_buffers[2]; @@ -1053,7 +1053,7 @@ public: virtual void particles_set_pre_process_time(RID p_particles,float p_time); virtual void particles_set_explosiveness_ratio(RID p_particles,float p_ratio); virtual void particles_set_randomness_ratio(RID p_particles,float p_ratio); - virtual void particles_set_custom_aabb(RID p_particles,const AABB& p_aabb); + virtual void particles_set_custom_aabb(RID p_particles,const Rect3& p_aabb); virtual void particles_set_gravity(RID p_particles,const Vector3& p_gravity); virtual void particles_set_use_local_coordinates(RID p_particles,bool p_enable); virtual void particles_set_process_material(RID p_particles,RID p_material); @@ -1070,7 +1070,7 @@ public: virtual void particles_set_draw_pass_material(RID p_particles,int p_pass, RID p_material); virtual void particles_set_draw_pass_mesh(RID p_particles,int p_pass, RID p_mesh); - virtual AABB particles_get_current_aabb(RID p_particles); + virtual Rect3 particles_get_current_aabb(RID p_particles); /* INSTANCE */ diff --git a/drivers/gles3/shader_gles3.h b/drivers/gles3/shader_gles3.h index 8b402716a6..ee8db2ac8c 100644 --- a/drivers/gles3/shader_gles3.h +++ b/drivers/gles3/shader_gles3.h @@ -236,9 +236,9 @@ private: glUniform4f( p_uniform, val.x,val.y,val.z,val.w ); } break; - case Variant::MATRIX32: { + case Variant::TRANSFORM2D: { - Matrix32 tr=p_value; + Transform2D tr=p_value; GLfloat matrix[16]={ /* build a 16x16 matrix */ tr.elements[0][0], tr.elements[0][1], @@ -261,7 +261,7 @@ private: glUniformMatrix4fv(p_uniform,1,false,matrix); } break; - case Variant::MATRIX3: + case Variant::BASIS: case Variant::TRANSFORM: { Transform tr=p_value; diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp index bfce03d663..ab3df3b022 100644 --- a/main/tests/test_gui.cpp +++ b/main/tests/test_gui.cpp @@ -93,7 +93,7 @@ public: TestCube *testcube = memnew( TestCube ); vp->add_child(testcube); - testcube->set_transform(Transform( Matrix3().rotated(Vector3(0,1,0),Math_PI*0.25), Vector3(0,0,-8))); + testcube->set_transform(Transform( Basis().rotated(Vector3(0,1,0),Math_PI*0.25), Vector3(0,0,-8))); Sprite *sp = memnew( Sprite ); sp->set_texture( vp->get_render_target_texture() ); diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp index b3b70986c9..f3d9ddba87 100644 --- a/main/tests/test_math.cpp +++ b/main/tests/test_math.cpp @@ -609,19 +609,19 @@ MainLoop* test() { float a=0.3; //Quat q(v,a); - Matrix3 m(v,a); + Basis m(v,a); Vector3 v2(7,3,1); v2.normalize(); float a2=0.8; //Quat q(v,a); - Matrix3 m2(v2,a2); + Basis m2(v2,a2); Quat q=m; Quat q2=m2; - Matrix3 m3 = m.inverse() * m2; + Basis m3 = m.inverse() * m2; Quat q3 = (q.inverse() * q2);//.normalized(); print_line(Quat(m3)); @@ -642,11 +642,11 @@ MainLoop* test() { print_line(ret); return NULL; - Matrix3 m3; + Basis m3; m3.rotate(Vector3(1,0,0),0.2); m3.rotate(Vector3(0,1,0),1.77); m3.rotate(Vector3(0,0,1),212); - Matrix3 m32; + Basis m32; m32.set_euler(m3.get_euler()); print_line("ELEULEEEEEEEEEEEEEEEEEER: "+m3.get_euler()+" vs "+m32.get_euler()); @@ -784,11 +784,11 @@ MainLoop* test() { print_line(Variant(a)); - Matrix32 mat2_1; + Transform2D mat2_1; mat2_1.rotate(0.5); - Matrix32 mat2_2; + Transform2D mat2_2; mat2_2.translate(Vector2(1,2)); - Matrix32 mat2_3 = mat2_1 * mat2_2; + Transform2D mat2_3 = mat2_1 * mat2_2; mat2_3.affine_invert(); print_line(mat2_3.elements[0]); diff --git a/main/tests/test_physics.cpp b/main/tests/test_physics.cpp index b1a7af8dad..ea5b1cae85 100644 --- a/main/tests/test_physics.cpp +++ b/main/tests/test_physics.cpp @@ -351,7 +351,7 @@ public: vs->viewport_set_scenario( viewport, scenario ); vs->camera_set_perspective(camera,60,0.1,40.0); - vs->camera_set_transform(camera,Transform( Matrix3(), Vector3(0,9,12))); + vs->camera_set_transform(camera,Transform( Basis(), Vector3(0,9,12))); //vs->scenario_set_debug(scenario,VS::SCENARIO_DEBUG_WIREFRAME); Transform gxf; @@ -441,7 +441,7 @@ public: RID tribody = ps->body_create( PhysicsServer::BODY_MODE_STATIC, trimesh_shape); - Transform tritrans = Transform( Matrix3(), Vector3(0,0,-2) ); + Transform tritrans = Transform( Basis(), Vector3(0,0,-2) ); ps->body_set_state( tribody, PhysicsServer::BODY_STATE_TRANSFORM, tritrans ); vs->instance_set_transform( triins, tritrans ); RID trimesh_material = vs->fixed_material_create(); @@ -477,7 +477,7 @@ public: #if 0 PhysicsServer * ps = PhysicsServer::get_singleton(); - mover = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,Transform(Matrix3(),Vector3(0,0,-24))); + mover = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,Transform(Basis(),Vector3(0,0,-24))); RID b = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform()); ps->joint_create_double_pin(b,Vector3(0,0,1.0),mover,Vector3(0,0,0)); @@ -508,17 +508,17 @@ public: PhysicsServer * ps = PhysicsServer::get_singleton(); - mover = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,Transform(Matrix3(),Vector3(0,0,-24))); + mover = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,Transform(Basis(),Vector3(0,0,-24))); RID b = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_RIGID,Transform()); - ps->joint_create_double_hinge(b,Transform(Matrix3(),Vector3(1,1,1.0)),mover,Transform(Matrix3(),Vector3(0,0,0))); + ps->joint_create_double_hinge(b,Transform(Basis(),Vector3(1,1,1.0)),mover,Transform(Basis(),Vector3(0,0,0))); ps->body_add_collision_exception(mover,b); /* for(int i=0;i<20;i++) { RID c = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform()); - ps->joint_create_double_hinge(b,Transform(Matrix3(),Vector3(0,0,-0.7)),c,Transform(Matrix3(),Vector3(0,0,0.7))); + ps->joint_create_double_hinge(b,Transform(Basis(),Vector3(0,0,-0.7)),c,Transform(Basis(),Vector3(0,0,0.7))); ps->body_add_collision_exception(c,b); b=c; } @@ -560,7 +560,7 @@ public: ps->body_set_force_integration_callback(character,this,"body_changed_transform",mesh_instance); - ps->body_set_state( character, PhysicsServer::BODY_STATE_TRANSFORM,Transform(Matrix3(),Vector3(-2,5,-2))); + ps->body_set_state( character, PhysicsServer::BODY_STATE_TRANSFORM,Transform(Basis(),Vector3(-2,5,-2))); bodies.push_back(character); @@ -611,8 +611,8 @@ public: void test_activate() { - create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_RIGID,Transform(Matrix3(),Vector3(0,2,0)),true); - //create_body(PhysicsServer::SHAPE_SPHERE,PhysicsServer::BODY_MODE_RIGID,Transform(Matrix3(),Vector3(0,6,0)),true); + create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_RIGID,Transform(Basis(),Vector3(0,2,0)),true); + //create_body(PhysicsServer::SHAPE_SPHERE,PhysicsServer::BODY_MODE_RIGID,Transform(Basis(),Vector3(0,6,0)),true); create_static_plane( Plane( Vector3(0,1,0), -1) ); } diff --git a/main/tests/test_physics_2d.cpp b/main/tests/test_physics_2d.cpp index 39b4e7edda..2074d532b1 100644 --- a/main/tests/test_physics_2d.cpp +++ b/main/tests/test_physics_2d.cpp @@ -51,7 +51,7 @@ class TestPhysics2DMainLoop : public MainLoop { RID canvas; RID ray; RID ray_query; - Matrix32 view_xform; + Transform2D view_xform; Vector2 ray_from,ray_to; @@ -262,7 +262,7 @@ protected: } } - RID _add_body(Physics2DServer::ShapeType p_shape, const Matrix32& p_xform) { + RID _add_body(Physics2DServer::ShapeType p_shape, const Transform2D& p_xform) { VisualServer *vs = VisualServer::get_singleton(); Physics2DServer *ps = Physics2DServer::get_singleton(); @@ -304,7 +304,7 @@ protected: } - void _add_concave(const Vector<Vector2>& p_points,const Matrix32& p_xform=Matrix32()) { + void _add_concave(const Vector<Vector2>& p_points,const Transform2D& p_xform=Transform2D()) { Physics2DServer *ps = Physics2DServer::get_singleton(); VisualServer *vs = VisualServer::get_singleton(); @@ -382,7 +382,7 @@ public: canvas = vs->canvas_create(); vs->viewport_attach_canvas(vp,canvas); vs->viewport_attach_to_screen(vp,Rect2(Vector2(),OS::get_singleton()->get_window_size())); - Matrix32 smaller; + Transform2D smaller; //smaller.scale(Vector2(0.6,0.6)); //smaller.elements[2]=Vector2(100,0); @@ -410,12 +410,12 @@ public: Physics2DServer::ShapeType type = types[i%4]; // type=Physics2DServer::SHAPE_SEGMENT; - _add_body(type,Matrix32(i*0.8,Point2(152+i*40,100-40*i))); + _add_body(type,Transform2D(i*0.8,Point2(152+i*40,100-40*i))); //if (i==0) // ps->body_set_mode(b,Physics2DServer::BODY_MODE_STATIC); } - //RID b= _add_body(Physics2DServer::SHAPE_CIRCLE,Matrix32(0,Point2(101,140))); + //RID b= _add_body(Physics2DServer::SHAPE_CIRCLE,Transform2D(0,Point2(101,140))); //ps->body_set_mode(b,Physics2DServer::BODY_MODE_STATIC); Point2 prev; diff --git a/main/tests/test_render.cpp b/main/tests/test_render.cpp index 51e1366073..3049ba7d45 100644 --- a/main/tests/test_render.cpp +++ b/main/tests/test_render.cpp @@ -95,7 +95,7 @@ public: static const int s = 20; for(int i=0;i<s;i++) { - Matrix3 rot(Vector3(0,1,0),i*Math_PI/s); + Basis rot(Vector3(0,1,0),i*Math_PI/s); for(int j=0;j<s;j++) { Vector3 v; @@ -179,7 +179,7 @@ public: vs->viewport_set_active(viewport,true); vs->viewport_attach_camera( viewport, camera ); vs->viewport_set_scenario( viewport, scenario ); - vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,3,30 ) ) ); + vs->camera_set_transform(camera, Transform( Basis(), Vector3(0,3,30 ) ) ); vs->camera_set_perspective( camera, 60, 0.1, 1000); @@ -232,7 +232,7 @@ public: for(List<InstanceInfo>::Element *E=instances.front();E;E=E->next()) { - Transform pre( Matrix3(E->get().rot_axis, ofs), Vector3() ); + Transform pre( Basis(E->get().rot_axis, ofs), Vector3() ); vs->instance_set_transform( E->get().instance, pre * E->get().base ); /* if( !E->next() ) { diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index d3c3dac1fd..00b080190f 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -325,7 +325,7 @@ void GDScriptLanguage::get_public_constants(List<Pair<String,Variant> > *p_const p_constants->push_back(pi); } -String GDScriptLanguage::make_function(const String& p_class,const String& p_name,const StringArray& p_args) const { +String GDScriptLanguage::make_function(const String& p_class,const String& p_name,const PoolStringArray& p_args) const { String s="func "+p_name+"("; if (p_args.size()) { @@ -1393,7 +1393,7 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl } static const char*_type_names[Variant::VARIANT_MAX]={ - "null","bool","int","float","String","Vector2","Rect2","Vector3","Matrix32","Plane","Quat","AABB","Matrix3","Transform", + "null","bool","int","float","String","Vector2","Rect2","Vector3","Transform2D","Plane","Quat","AABB","Basis","Transform", "Color","Image","NodePath","RID","Object","InputEvent","Dictionary","Array","RawArray","IntArray","FloatArray","StringArray", "Vector2Array","Vector3Array","ColorArray"}; diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index 64578e5f5c..bf73b14066 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -672,7 +672,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va case VAR_TO_BYTES: { VALIDATE_ARG_COUNT(1); - ByteArray barr; + PoolByteArray barr; int len; Error err = encode_variant(*p_args[0],NULL,len); if (err) { @@ -685,7 +685,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va barr.resize(len); { - ByteArray::Write w = barr.write(); + PoolByteArray::Write w = barr.write(); encode_variant(*p_args[0],w.ptr(),len); } @@ -693,24 +693,24 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va } break; case BYTES_TO_VAR: { VALIDATE_ARG_COUNT(1); - if (p_args[0]->get_type()!=Variant::RAW_ARRAY) { + if (p_args[0]->get_type()!=Variant::POOL_BYTE_ARRAY) { r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument=0; - r_error.expected=Variant::RAW_ARRAY; + r_error.expected=Variant::POOL_BYTE_ARRAY; r_ret=Variant(); return; } - ByteArray varr=*p_args[0]; + PoolByteArray varr=*p_args[0]; Variant ret; { - ByteArray::Read r=varr.read(); + PoolByteArray::Read r=varr.read(); Error err = decode_variant(ret,r.ptr(),varr.size(),NULL); if (err!=OK) { r_ret=RTR("Not enough bytes for decoding bytes, or invalid format."); r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument=0; - r_error.expected=Variant::RAW_ARRAY; + r_error.expected=Variant::POOL_BYTE_ARRAY; return; } @@ -1531,13 +1531,13 @@ MethodInfo GDFunctions::get_info(Function p_func) { } break; case VAR_TO_BYTES: { MethodInfo mi("var2bytes",PropertyInfo(Variant::NIL,"var")); - mi.return_val.type=Variant::RAW_ARRAY; + mi.return_val.type=Variant::POOL_BYTE_ARRAY; return mi; } break; case BYTES_TO_VAR: { - MethodInfo mi("bytes2var:Variant",PropertyInfo(Variant::RAW_ARRAY,"bytes")); + MethodInfo mi("bytes2var:Variant",PropertyInfo(Variant::POOL_BYTE_ARRAY,"bytes")); mi.return_val.type=Variant::NIL; return mi; } break; diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index dec191c01e..960b06f3ff 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -408,7 +408,7 @@ public: virtual Script *create_script() const; virtual bool has_named_classes() const; virtual int find_function(const String& p_function,const String& p_code) const; - virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const; + virtual String make_function(const String& p_class,const String& p_name,const PoolStringArray& p_args) const; virtual Error complete_code(const String& p_code, const String& p_base_path, Object*p_owner,List<String>* r_options,String& r_call_hint); #ifdef TOOLS_ENABLED virtual Error lookup_code(const String& p_code, const String& p_symbol, const String& p_base_path, Object*p_owner, LookupResult& r_result); diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 2b306a92fc..30ac988295 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -788,13 +788,12 @@ void GDTokenizerText::_advance() { {Variant::STRING,"String"}, {Variant::VECTOR2,"Vector2"}, {Variant::RECT2,"Rect2"}, - {Variant::MATRIX32,"Matrix32"}, + {Variant::TRANSFORM2D,"Transform2D"}, {Variant::VECTOR3,"Vector3"}, - {Variant::_AABB,"AABB"}, - {Variant::_AABB,"Rect3"}, + {Variant::RECT3,"Rect3"}, {Variant::PLANE,"Plane"}, {Variant::QUAT,"Quat"}, - {Variant::MATRIX3,"Matrix3"}, + {Variant::BASIS,"Basis"}, {Variant::TRANSFORM,"Transform"}, {Variant::COLOR,"Color"}, {Variant::IMAGE,"Image"}, @@ -804,13 +803,13 @@ void GDTokenizerText::_advance() { {Variant::NODE_PATH,"NodePath"}, {Variant::DICTIONARY,"Dictionary"}, {Variant::ARRAY,"Array"}, - {Variant::RAW_ARRAY,"RawArray"}, - {Variant::INT_ARRAY,"IntArray"}, - {Variant::REAL_ARRAY,"FloatArray"}, - {Variant::STRING_ARRAY,"StringArray"}, - {Variant::VECTOR2_ARRAY,"Vector2Array"}, - {Variant::VECTOR3_ARRAY,"Vector3Array"}, - {Variant::COLOR_ARRAY,"ColorArray"}, + {Variant::POOL_BYTE_ARRAY,"PoolByteArray"}, + {Variant::POOL_INT_ARRAY,"PoolIntArray"}, + {Variant::POOL_REAL_ARRAY,"PoolFloatArray"}, + {Variant::POOL_STRING_ARRAY,"PoolStringArray"}, + {Variant::POOL_VECTOR2_ARRAY,"PoolVector2Array"}, + {Variant::POOL_VECTOR3_ARRAY,"PoolVector3Array"}, + {Variant::POOL_COLOR_ARRAY,"PoolColorArray"}, {Variant::VARIANT_MAX,NULL}, }; diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index b934e7ab1b..b5fa55846c 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -252,7 +252,7 @@ void GridMap::_get_property_list( List<PropertyInfo> *p_list) const { for(const Map<int,Area*>::Element *E=area_map.front();E;E=E->next()) { String base="areas/"+itos(E->key())+"/"; - p_list->push_back( PropertyInfo( Variant::_AABB, base+"bounds", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) ); + p_list->push_back( PropertyInfo( Variant::RECT3, base+"bounds", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) ); p_list->push_back( PropertyInfo( Variant::STRING, base+"name", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) ); p_list->push_back( PropertyInfo( Variant::REAL, base+"disable_distance", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) ); p_list->push_back( PropertyInfo( Variant::COLOR, base+"disable_color", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_STORAGE) ); @@ -678,8 +678,8 @@ void GridMap::_octant_update(const OctantKey &p_key) { ii.multimesh->set_instance_count(ii.cells.size()); - AABB aabb; - AABB mesh_aabb = ii.mesh.is_null()?AABB():ii.mesh->get_aabb(); + Rect3 aabb; + Rect3 mesh_aabb = ii.mesh.is_null()?Rect3():ii.mesh->get_aabb(); Vector3 ofs(cell_size*0.5*int(center_x),cell_size*0.5*int(center_y),cell_size*0.5*int(center_z)); @@ -920,7 +920,7 @@ void GridMap::_octant_bake(const OctantKey &p_key, const Ref<TriangleMesh>& p_tm Vector3 vertex = v.vertex + octant_ofs; //print_line("V GET: "+vertex); - Vector3 normal = tm->get_area_normal( AABB( Vector3(-ofs,-ofs,-ofs)+vertex,Vector3(ofs,ofs,ofs)*2.0)); + Vector3 normal = tm->get_area_normal( Rect3( Vector3(-ofs,-ofs,-ofs)+vertex,Vector3(ofs,ofs,ofs)*2.0)); if (normal==Vector3()) { print_line("couldn't find for vertex: "+vertex); } @@ -1435,7 +1435,7 @@ void GridMap::_update_area_instances() { } -Error GridMap::create_area(int p_id,const AABB& p_bounds) { +Error GridMap::create_area(int p_id,const Rect3& p_bounds) { ERR_FAIL_COND_V(area_map.has(p_id),ERR_ALREADY_EXISTS); ERR_EXPLAIN("ID 0 is taken as global area, start from 1"); @@ -1484,12 +1484,12 @@ Error GridMap::create_area(int p_id,const AABB& p_bounds) { return OK; } -AABB GridMap::area_get_bounds(int p_area) const { +Rect3 GridMap::area_get_bounds(int p_area) const { - ERR_FAIL_COND_V(!area_map.has(p_area),AABB()); + ERR_FAIL_COND_V(!area_map.has(p_area),Rect3()); const Area *a = area_map[p_area]; - AABB aabb; + Rect3 aabb; aabb.pos=Vector3(a->from.x,a->from.y,a->from.z); aabb.size=Vector3(a->to.x,a->to.y,a->to.z)-aabb.pos; diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index 934e9382b3..04d140cdc6 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -268,8 +268,8 @@ public: void set_clip(bool p_enabled, bool p_clip_above=true, int p_floor=0, Vector3::Axis p_axis=Vector3::AXIS_X); - Error create_area(int p_id,const AABB& p_area); - AABB area_get_bounds(int p_area) const; + Error create_area(int p_id,const Rect3& p_area); + Rect3 area_get_bounds(int p_area) const; void area_set_exterior_portal(int p_area,bool p_enable); void area_set_name(int p_area,const String& p_name); String area_get_name(int p_area) const; diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index d8409af634..109f6338db 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -99,7 +99,7 @@ void GridMapEditor::_menu_option(int p_option) { } break; case MENU_OPTION_CURSOR_ROTATE_Y: { - Matrix3 r; + Basis r; if (input_action==INPUT_DUPLICATE) { r.set_orthogonal_index(selection.duplicate_rot); @@ -114,7 +114,7 @@ void GridMapEditor::_menu_option(int p_option) { _update_cursor_transform(); } break; case MENU_OPTION_CURSOR_ROTATE_X: { - Matrix3 r; + Basis r; if (input_action==INPUT_DUPLICATE) { r.set_orthogonal_index(selection.duplicate_rot); @@ -130,7 +130,7 @@ void GridMapEditor::_menu_option(int p_option) { _update_cursor_transform(); } break; case MENU_OPTION_CURSOR_ROTATE_Z: { - Matrix3 r; + Basis r; if (input_action==INPUT_DUPLICATE) { r.set_orthogonal_index(selection.duplicate_rot); @@ -146,21 +146,21 @@ void GridMapEditor::_menu_option(int p_option) { _update_cursor_transform(); } break; case MENU_OPTION_CURSOR_BACK_ROTATE_Y: { - Matrix3 r; + Basis r; r.set_orthogonal_index(cursor_rot); r.rotate(Vector3(0,1,0),Math_PI/2.0); cursor_rot=r.get_orthogonal_index(); _update_cursor_transform(); } break; case MENU_OPTION_CURSOR_BACK_ROTATE_X: { - Matrix3 r; + Basis r; r.set_orthogonal_index(cursor_rot); r.rotate(Vector3(1,0,0),Math_PI/2.0); cursor_rot=r.get_orthogonal_index(); _update_cursor_transform(); } break; case MENU_OPTION_CURSOR_BACK_ROTATE_Z: { - Matrix3 r; + Basis r; r.set_orthogonal_index(cursor_rot); r.rotate(Vector3(0,0,1),Math_PI/2.0); cursor_rot=r.get_orthogonal_index(); @@ -191,7 +191,7 @@ void GridMapEditor::_menu_option(int p_option) { if (!selection.active) break; int area = node->get_unused_area_id(); - Error err = node->create_area(area,AABB(selection.begin,selection.end-selection.begin+Vector3(1,1,1))); + Error err = node->create_area(area,Rect3(selection.begin,selection.end-selection.begin+Vector3(1,1,1))); if (err!=OK) { @@ -358,7 +358,7 @@ bool GridMapEditor::do_input_action(Camera* p_camera,const Point2& p_point,bool } last_mouseover=Vector3(cell[0],cell[1],cell[2]); - VS::get_singleton()->instance_set_transform(grid_instance[edit_axis],Transform(Matrix3(),grid_ofs)); + VS::get_singleton()->instance_set_transform(grid_instance[edit_axis],Transform(Basis(),grid_ofs)); if (cursor_instance.is_valid()) { @@ -459,7 +459,7 @@ void GridMapEditor::_update_duplicate_indicator() { Transform xf; xf.scale(Vector3(1,1,1)*(Vector3(1,1,1)+(selection.end-selection.begin))*node->get_cell_size()); xf.origin=(selection.begin+(selection.current-selection.click))*node->get_cell_size(); - Matrix3 rot; + Basis rot; rot.set_orthogonal_index(selection.duplicate_rot); xf.basis = rot * xf.basis; @@ -481,7 +481,7 @@ void GridMapEditor::_duplicate_paste() { List< __Item > items; - Matrix3 rot; + Basis rot; rot.set_orthogonal_index(selection.duplicate_rot); for(int i=selection.begin.x;i<=selection.end.x;i++) { @@ -498,7 +498,7 @@ void GridMapEditor::_duplicate_paste() { Vector3 rel=Vector3(i,j,k)-selection.begin; rel = rot.xform(rel); - Matrix3 orm; + Basis orm; orm.set_orthogonal_index(orientation); orm = rot * orm; @@ -664,7 +664,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera* p_camera,const InputEven for(List<int>::Element *E=areas.front();E;E=E->next()) { int area = E->get(); - AABB aabb = node->area_get_bounds(area); + Rect3 aabb = node->area_get_bounds(area); aabb.pos*=node->get_cell_size(); aabb.size*=node->get_cell_size(); @@ -972,7 +972,7 @@ void GridMapEditor::update_grid() { grid_ofs[edit_axis]=edit_floor[edit_axis]*node->get_cell_size(); edit_grid_xform.origin=grid_ofs; - edit_grid_xform.basis=Matrix3(); + edit_grid_xform.basis=Basis(); for(int i=0;i<3;i++) { @@ -1142,7 +1142,7 @@ void GridMapEditor::_update_areas_display() { ad.mesh=mesh; ad.instance = VisualServer::get_singleton()->instance_create2(mesh,node->get_world()->get_scenario()); Transform xform; - AABB aabb = node->area_get_bounds(area); + Rect3 aabb = node->area_get_bounds(area); xform.origin=aabb.pos * node->get_cell_size(); xform.basis.scale(aabb.size * node->get_cell_size()); VisualServer::get_singleton()->instance_set_transform(ad.instance,global_xf * xform); @@ -1377,7 +1377,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { for(int i=0;i<12;i++) { - AABB base(Vector3(0,0,0),Vector3(1,1,1)); + Rect3 base(Vector3(0,0,0),Vector3(1,1,1)); Vector3 a,b; base.get_edge(i,a,b); lines.push_back(a); diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp index eca13533e4..140ea1b9e7 100644 --- a/modules/openssl/stream_peer_openssl.cpp +++ b/modules/openssl/stream_peer_openssl.cpp @@ -564,9 +564,9 @@ StreamPeerSSL* StreamPeerOpenSSL::_create_func() { Vector<X509*> StreamPeerOpenSSL::certs; -void StreamPeerOpenSSL::_load_certs(const ByteArray& p_array) { +void StreamPeerOpenSSL::_load_certs(const PoolByteArray& p_array) { - ByteArray::Read r = p_array.read(); + PoolByteArray::Read r = p_array.read(); BIO* mem = BIO_new(BIO_s_mem()); BIO_puts(mem,(const char*)r.ptr()); while(true) { @@ -598,11 +598,11 @@ void StreamPeerOpenSSL::initialize_ssl() { FileAccess *f=FileAccess::open(certs_path,FileAccess::READ); if (f) { - ByteArray arr; + PoolByteArray arr; int flen = f->get_len(); arr.resize(flen+1); { - ByteArray::Write w = arr.write(); + PoolByteArray::Write w = arr.write(); f->get_buffer(w.ptr(),flen); w[flen]=0; //end f string } diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h index b3777959a3..d79fb97ff8 100644 --- a/modules/openssl/stream_peer_openssl.h +++ b/modules/openssl/stream_peer_openssl.h @@ -79,7 +79,7 @@ private: static Vector<X509*> certs; - static void _load_certs(const ByteArray& p_array); + static void _load_certs(const PoolByteArray& p_array); protected: static void _bind_methods(); public: diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 418a42bc18..08796b3868 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -2525,7 +2525,7 @@ int VisualScriptLanguage::find_function(const String& p_function,const String& p return -1; } -String VisualScriptLanguage::make_function(const String& p_class,const String& p_name,const StringArray& p_args) const { +String VisualScriptLanguage::make_function(const String& p_class,const String& p_name,const PoolStringArray& p_args) const { return String(); } diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index d030dcc2cb..acd1c3a670 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -560,7 +560,7 @@ public: virtual Script *create_script() const; virtual bool has_named_classes() const; virtual int find_function(const String& p_function,const String& p_code) const; - virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const; + virtual String make_function(const String& p_class,const String& p_name,const PoolStringArray& p_args) const; virtual void auto_indent_code(String& p_code,int p_from_line,int p_to_line) const; virtual void add_global_constant(const StringName& p_variable,const Variant& p_value); diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 58dbfbc5ad..bd2647d928 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -404,7 +404,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const } break; case BYTES_TO_VAR: { - return PropertyInfo(Variant::RAW_ARRAY,"bytes"); + return PropertyInfo(Variant::POOL_BYTE_ARRAY,"bytes"); } break; case FUNC_MAX:{} } @@ -548,7 +548,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons } break; case VAR_TO_BYTES: { - t=Variant::RAW_ARRAY; + t=Variant::POOL_BYTE_ARRAY; } break; case BYTES_TO_VAR: { @@ -1058,7 +1058,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp case VisualScriptBuiltinFunc::VAR_TO_BYTES: { - ByteArray barr; + PoolByteArray barr; int len; Error err = encode_variant(*p_inputs[0],NULL,len); if (err) { @@ -1071,7 +1071,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp barr.resize(len); { - ByteArray::Write w = barr.write(); + PoolByteArray::Write w = barr.write(); encode_variant(*p_inputs[0],w.ptr(),len); } @@ -1079,24 +1079,24 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp } break; case VisualScriptBuiltinFunc::BYTES_TO_VAR: { - if (p_inputs[0]->get_type()!=Variant::RAW_ARRAY) { + if (p_inputs[0]->get_type()!=Variant::POOL_BYTE_ARRAY) { r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument=0; - r_error.expected=Variant::RAW_ARRAY; + r_error.expected=Variant::POOL_BYTE_ARRAY; return; } - ByteArray varr=*p_inputs[0]; + PoolByteArray varr=*p_inputs[0]; Variant ret; { - ByteArray::Read r=varr.read(); + PoolByteArray::Read r=varr.read(); Error err = decode_variant(ret,r.ptr(),varr.size(),NULL); if (err!=OK) { r_error_str=RTR("Not enough bytes for decoding bytes, or invalid format."); r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument=0; - r_error.expected=Variant::RAW_ARRAY; + r_error.expected=Variant::POOL_BYTE_ARRAY; return; } diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index c359c02205..6f3ea3b4ad 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -326,11 +326,11 @@ static Color _color_from_type(Variant::Type p_type) { case Variant::VECTOR2: color = Color::html("bd91f1"); break; case Variant::RECT2: color = Color::html("f191a5"); break; case Variant::VECTOR3: color = Color::html("d67dee"); break; - case Variant::MATRIX32: color = Color::html("c4ec69"); break; + case Variant::TRANSFORM2D: color = Color::html("c4ec69"); break; case Variant::PLANE: color = Color::html("f77070"); break; case Variant::QUAT: color = Color::html("ec69a3"); break; - case Variant::_AABB: color = Color::html("ee7991"); break; - case Variant::MATRIX3: color = Color::html("e3ec69"); break; + case Variant::RECT3: color = Color::html("ee7991"); break; + case Variant::BASIS: color = Color::html("e3ec69"); break; case Variant::TRANSFORM: color = Color::html("f6a86e"); break; case Variant::COLOR: color = Color::html("9dff70"); break; @@ -342,13 +342,13 @@ static Color _color_from_type(Variant::Type p_type) { case Variant::DICTIONARY: color = Color::html("77edb1"); break; case Variant::ARRAY: color = Color::html("e0e0e0"); break; - case Variant::RAW_ARRAY: color = Color::html("aaf4c8"); break; - case Variant::INT_ARRAY: color = Color::html("afdcf5"); break; - case Variant::REAL_ARRAY: color = Color::html("97e7f8"); break; - case Variant::STRING_ARRAY: color = Color::html("9dc4f2"); break; - case Variant::VECTOR2_ARRAY: color = Color::html("d1b3f5"); break; - case Variant::VECTOR3_ARRAY: color = Color::html("df9bf2"); break; - case Variant::COLOR_ARRAY: color = Color::html("e9ff97"); break; + case Variant::POOL_BYTE_ARRAY: color = Color::html("aaf4c8"); break; + case Variant::POOL_INT_ARRAY: color = Color::html("afdcf5"); break; + case Variant::POOL_REAL_ARRAY: color = Color::html("97e7f8"); break; + case Variant::POOL_STRING_ARRAY: color = Color::html("9dc4f2"); break; + case Variant::POOL_VECTOR2_ARRAY: color = Color::html("d1b3f5"); break; + case Variant::POOL_VECTOR3_ARRAY: color = Color::html("df9bf2"); break; + case Variant::POOL_COLOR_ARRAY: color = Color::html("e9ff97"); break; default: color.set_hsv(p_type/float(Variant::VARIANT_MAX),0.7,0.7); @@ -438,11 +438,11 @@ void VisualScriptEditor::_update_graph(int p_only_id) { Control::get_icon("MiniVector2","EditorIcons"), Control::get_icon("MiniRect2","EditorIcons"), Control::get_icon("MiniVector3","EditorIcons"), - Control::get_icon("MiniMatrix32","EditorIcons"), + Control::get_icon("MiniTransform2D","EditorIcons"), Control::get_icon("MiniPlane","EditorIcons"), Control::get_icon("MiniQuat","EditorIcons"), Control::get_icon("MiniAabb","EditorIcons"), - Control::get_icon("MiniMatrix3","EditorIcons"), + Control::get_icon("MiniBasis","EditorIcons"), Control::get_icon("MiniTransform","EditorIcons"), Control::get_icon("MiniColor","EditorIcons"), Control::get_icon("MiniImage","EditorIcons"), @@ -2321,7 +2321,7 @@ bool VisualScriptEditor::goto_method(const String& p_method){ return true; } -void VisualScriptEditor::add_callback(const String& p_function,StringArray p_args){ +void VisualScriptEditor::add_callback(const String& p_function,PoolStringArray p_args){ if (script->has_function(p_function)) { edited_func=p_function; diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index dbd5d220c2..e120bdc655 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -225,7 +225,7 @@ public: virtual void reload(bool p_soft); virtual void get_breakpoints(List<int> *p_breakpoints); virtual bool goto_method(const String& p_method); - virtual void add_callback(const String& p_function,StringArray p_args); + virtual void add_callback(const String& p_function,PoolStringArray p_args); virtual void update_settings(); virtual void set_debugger_active(bool p_active); virtual void set_tooltip_request_func(String p_method,Object* p_obj); diff --git a/platform/android/java_class_wrapper.h b/platform/android/java_class_wrapper.h index ff213c7f33..f0156563b2 100644 --- a/platform/android/java_class_wrapper.h +++ b/platform/android/java_class_wrapper.h @@ -98,14 +98,14 @@ class JavaClass : public Reference { case ARG_TYPE_CLASS: r_type=Variant::OBJECT; break; case ARG_ARRAY_BIT|ARG_TYPE_VOID: r_type=Variant::NIL; break; case ARG_ARRAY_BIT|ARG_TYPE_BOOLEAN: r_type=Variant::ARRAY; break; - case ARG_ARRAY_BIT|ARG_TYPE_BYTE: r_type=Variant::RAW_ARRAY; likelyhood=1.0; break; - case ARG_ARRAY_BIT|ARG_TYPE_CHAR: r_type=Variant::RAW_ARRAY; likelyhood=0.5; break; - case ARG_ARRAY_BIT|ARG_TYPE_SHORT: r_type=Variant::INT_ARRAY; likelyhood=0.3; break; - case ARG_ARRAY_BIT|ARG_TYPE_INT: r_type=Variant::INT_ARRAY; likelyhood=1.0; break; - case ARG_ARRAY_BIT|ARG_TYPE_LONG: r_type=Variant::INT_ARRAY; likelyhood=0.5; break; - case ARG_ARRAY_BIT|ARG_TYPE_FLOAT: r_type=Variant::REAL_ARRAY; likelyhood=1.0; break; - case ARG_ARRAY_BIT|ARG_TYPE_DOUBLE: r_type=Variant::REAL_ARRAY; likelyhood=0.5; break; - case ARG_ARRAY_BIT|ARG_TYPE_STRING: r_type=Variant::STRING_ARRAY; break; + case ARG_ARRAY_BIT|ARG_TYPE_BYTE: r_type=Variant::POOL_BYTE_ARRAY; likelyhood=1.0; break; + case ARG_ARRAY_BIT|ARG_TYPE_CHAR: r_type=Variant::POOL_BYTE_ARRAY; likelyhood=0.5; break; + case ARG_ARRAY_BIT|ARG_TYPE_SHORT: r_type=Variant::POOL_INT_ARRAY; likelyhood=0.3; break; + case ARG_ARRAY_BIT|ARG_TYPE_INT: r_type=Variant::POOL_INT_ARRAY; likelyhood=1.0; break; + case ARG_ARRAY_BIT|ARG_TYPE_LONG: r_type=Variant::POOL_INT_ARRAY; likelyhood=0.5; break; + case ARG_ARRAY_BIT|ARG_TYPE_FLOAT: r_type=Variant::POOL_REAL_ARRAY; likelyhood=1.0; break; + case ARG_ARRAY_BIT|ARG_TYPE_DOUBLE: r_type=Variant::POOL_REAL_ARRAY; likelyhood=0.5; break; + case ARG_ARRAY_BIT|ARG_TYPE_STRING: r_type=Variant::POOL_STRING_ARRAY; break; case ARG_ARRAY_BIT|ARG_TYPE_CLASS: r_type=Variant::ARRAY; break; } } diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 3e8ce35910..63d53e35a3 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -120,7 +120,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a v.val.l=jStr; v.obj=jStr; } break; - case Variant::STRING_ARRAY: { + case Variant::POOL_STRING_ARRAY: { PoolVector<String> sarray = *p_arg; jobjectArray arr = env->NewObjectArray(sarray.size(),env->FindClass("java/lang/String"),env->NewStringUTF("")); @@ -179,7 +179,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a v.obj=jdict; } break; - case Variant::INT_ARRAY: { + case Variant::POOL_INT_ARRAY: { PoolVector<int> array = *p_arg; jintArray arr = env->NewIntArray(array.size()); @@ -189,7 +189,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a v.obj=arr; } break; - case Variant::RAW_ARRAY: { + case Variant::POOL_BYTE_ARRAY: { PoolVector<uint8_t> array = *p_arg; jbyteArray arr = env->NewByteArray(array.size()); PoolVector<uint8_t>::Read r = array.read(); @@ -198,7 +198,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a v.obj=arr; } break; - case Variant::REAL_ARRAY: { + case Variant::POOL_REAL_ARRAY: { PoolVector<float> array = *p_arg; jfloatArray arr = env->NewFloatArray(array.size()); @@ -324,10 +324,10 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) { jdoubleArray arr = (jdoubleArray)obj; int fCount = env->GetArrayLength(arr); - RealArray sarr; + PoolRealArray sarr; sarr.resize(fCount); - RealArray::Write w = sarr.write(); + PoolRealArray::Write w = sarr.write(); for (int i=0; i<fCount; i++) { @@ -343,11 +343,11 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) { jfloatArray arr = (jfloatArray)obj; int fCount = env->GetArrayLength(arr); - RealArray sarr; + PoolRealArray sarr; sarr.resize(fCount); - RealArray::Write w = sarr.write(); + PoolRealArray::Write w = sarr.write(); for (int i=0; i<fCount; i++) { @@ -384,7 +384,7 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) { jmethodID get_keys = env->GetMethodID(oclass, "get_keys", "()[Ljava/lang/String;"); jobjectArray arr = (jobjectArray)env->CallObjectMethod(obj, get_keys); - StringArray keys = _jobject_to_variant(env, arr); + PoolStringArray keys = _jobject_to_variant(env, arr); env->DeleteLocalRef(arr); jmethodID get_values = env->GetMethodID(oclass, "get_values", "()[Ljava/lang/Object;"); @@ -527,7 +527,7 @@ public: ret = String::utf8(env->GetStringUTFChars((jstring)o, NULL)); env->DeleteLocalRef(o); } break; - case Variant::STRING_ARRAY: { + case Variant::POOL_STRING_ARRAY: { jobjectArray arr = (jobjectArray)env->CallObjectMethodA(instance,E->get().method,v); @@ -535,7 +535,7 @@ public: env->DeleteLocalRef(arr); } break; - case Variant::INT_ARRAY: { + case Variant::POOL_INT_ARRAY: { jintArray arr = (jintArray)env->CallObjectMethodA(instance,E->get().method,v); @@ -549,7 +549,7 @@ public: ret=sarr; env->DeleteLocalRef(arr); } break; - case Variant::REAL_ARRAY: { + case Variant::POOL_REAL_ARRAY: { jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance,E->get().method,v); @@ -1588,10 +1588,10 @@ static Variant::Type get_jni_type(const String& p_type) { {"float",Variant::REAL}, {"double", Variant::REAL}, {"java.lang.String",Variant::STRING}, - {"[I",Variant::INT_ARRAY}, - {"[B",Variant::RAW_ARRAY}, - {"[F",Variant::REAL_ARRAY}, - {"[Ljava.lang.String;",Variant::STRING_ARRAY}, + {"[I",Variant::POOL_INT_ARRAY}, + {"[B",Variant::POOL_BYTE_ARRAY}, + {"[F",Variant::POOL_REAL_ARRAY}, + {"[Ljava.lang.String;",Variant::POOL_STRING_ARRAY}, {"org.godotengine.godot.Dictionary", Variant::DICTIONARY}, {NULL,Variant::NIL} }; diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 3276f3f004..6c387c610f 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -47,7 +47,7 @@ void Camera2D::_update_scroll() { ERR_FAIL_COND( custom_viewport && !ObjectDB::get_instance(custom_viewport_id) ); - Matrix32 xform = get_camera_transform(); + Transform2D xform = get_camera_transform(); if (viewport) { viewport->set_canvas_transform( xform ); @@ -71,12 +71,12 @@ Vector2 Camera2D::get_zoom() const { }; -Matrix32 Camera2D::get_camera_transform() { +Transform2D Camera2D::get_camera_transform() { if (!get_tree()) - return Matrix32(); + return Transform2D(); - ERR_FAIL_COND_V( custom_viewport && !ObjectDB::get_instance(custom_viewport_id), Matrix32() ); + ERR_FAIL_COND_V( custom_viewport && !ObjectDB::get_instance(custom_viewport_id), Transform2D() ); Size2 screen_size = viewport->get_visible_rect().size; @@ -201,7 +201,7 @@ Matrix32 Camera2D::get_camera_transform() { camera_screen_center=screen_rect.pos+screen_rect.size*0.5; - Matrix32 xform; + Transform2D xform; if(rotating){ xform.set_rotation(angle); } @@ -272,7 +272,7 @@ void Camera2D::_notification(int p_what) { if (is_current()) { if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) { - viewport->set_canvas_transform( Matrix32() ); + viewport->set_canvas_transform( Transform2D() ); } } remove_from_group(group_name); @@ -290,7 +290,7 @@ void Camera2D::_notification(int p_what) { if(current) area_axis_width = 3; - Matrix32 inv_camera_transform = get_camera_transform().affine_inverse(); + Transform2D inv_camera_transform = get_camera_transform().affine_inverse(); Size2 screen_size = get_viewport_rect().size; Vector2 screen_endpoints[4]= { @@ -300,7 +300,7 @@ void Camera2D::_notification(int p_what) { inv_camera_transform.xform(Vector2(0, screen_size.height)) }; - Matrix32 inv_transform = get_global_transform().affine_inverse(); // undo global space + Transform2D inv_transform = get_global_transform().affine_inverse(); // undo global space for(int i=0;i<4;i++) { draw_line(inv_transform.xform(screen_endpoints[i]), inv_transform.xform(screen_endpoints[(i+1)%4]), area_axis_color, area_axis_width); diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h index da36b04924..85d90b225a 100644 --- a/scene/2d/camera_2d.h +++ b/scene/2d/camera_2d.h @@ -80,7 +80,7 @@ protected: void _set_old_smoothing(float p_enable); protected: - virtual Matrix32 get_camera_transform(); + virtual Transform2D get_camera_transform(); void _notification(int p_what); static void _bind_methods(); public: diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index d42743afc2..b7d9ba7860 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -325,10 +325,10 @@ void CanvasItem::_update_callback() { pending_update=false; // don't change to false until finished drawing (avoid recursive update) } -Matrix32 CanvasItem::get_global_transform_with_canvas() const { +Transform2D CanvasItem::get_global_transform_with_canvas() const { const CanvasItem *ci = this; - Matrix32 xform; + Transform2D xform; const CanvasItem *last_valid=NULL; while(ci) { @@ -346,7 +346,7 @@ Matrix32 CanvasItem::get_global_transform_with_canvas() const { return xform; } -Matrix32 CanvasItem::get_global_transform() const { +Transform2D CanvasItem::get_global_transform() const { if (global_invalid) { @@ -691,12 +691,12 @@ void CanvasItem::draw_set_transform(const Point2& p_offset, float p_rot, const S ERR_FAIL(); } - Matrix32 xform(p_rot,p_offset); + Transform2D xform(p_rot,p_offset); xform.scale_basis(p_scale); VisualServer::get_singleton()->canvas_item_add_set_transform(canvas_item,xform); } -void CanvasItem::draw_set_transform_matrix(const Matrix32& p_matrix) { +void CanvasItem::draw_set_transform_matrix(const Transform2D& p_matrix) { if (!drawing) { ERR_EXPLAIN("Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); @@ -892,7 +892,7 @@ Vector2 CanvasItem::make_canvas_pos_local(const Vector2& screen_point) const { ERR_FAIL_COND_V(!is_inside_tree(),screen_point); - Matrix32 local_matrix = (get_canvas_transform() * + Transform2D local_matrix = (get_canvas_transform() * get_global_transform()).affine_inverse(); return local_matrix.xform(screen_point); @@ -972,8 +972,8 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(_MD("draw_texture_rect_region","texture:Texture","rect","src_rect","modulate","transpose"),&CanvasItem::draw_texture_rect_region,DEFVAL(Color(1,1,1)),DEFVAL(false)); ClassDB::bind_method(_MD("draw_style_box","style_box:StyleBox","rect"),&CanvasItem::draw_style_box); ClassDB::bind_method(_MD("draw_primitive","points","colors","uvs","texture:Texture","width"),&CanvasItem::draw_primitive,DEFVAL(Variant()),DEFVAL(1.0)); - ClassDB::bind_method(_MD("draw_polygon","points","colors","uvs","texture:Texture"),&CanvasItem::draw_polygon,DEFVAL(Vector2Array()),DEFVAL(Variant())); - ClassDB::bind_method(_MD("draw_colored_polygon","points","color","uvs","texture:Texture"),&CanvasItem::draw_colored_polygon,DEFVAL(Vector2Array()),DEFVAL(Variant())); + ClassDB::bind_method(_MD("draw_polygon","points","colors","uvs","texture:Texture"),&CanvasItem::draw_polygon,DEFVAL(PoolVector2Array()),DEFVAL(Variant())); + ClassDB::bind_method(_MD("draw_colored_polygon","points","color","uvs","texture:Texture"),&CanvasItem::draw_colored_polygon,DEFVAL(PoolVector2Array()),DEFVAL(Variant())); ClassDB::bind_method(_MD("draw_string","font:Font","pos","text","modulate","clip_w"),&CanvasItem::draw_string,DEFVAL(Color(1,1,1)),DEFVAL(-1)); ClassDB::bind_method(_MD("draw_char","font:Font","pos","char","next","modulate"),&CanvasItem::draw_char,DEFVAL(Color(1,1,1))); @@ -1041,9 +1041,9 @@ void CanvasItem::_bind_methods() { } -Matrix32 CanvasItem::get_canvas_transform() const { +Transform2D CanvasItem::get_canvas_transform() const { - ERR_FAIL_COND_V(!is_inside_tree(),Matrix32()); + ERR_FAIL_COND_V(!is_inside_tree(),Transform2D()); if (canvas_layer) return canvas_layer->get_transform(); @@ -1054,9 +1054,9 @@ Matrix32 CanvasItem::get_canvas_transform() const { } -Matrix32 CanvasItem::get_viewport_transform() const { +Transform2D CanvasItem::get_viewport_transform() const { - ERR_FAIL_COND_V(!is_inside_tree(),Matrix32()); + ERR_FAIL_COND_V(!is_inside_tree(),Transform2D()); if (canvas_layer) { diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index d0dd5be5a3..fded547275 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -120,7 +120,7 @@ private: Ref<CanvasItemMaterial> material; - mutable Matrix32 global_transform; + mutable Transform2D global_transform; mutable bool global_invalid; @@ -207,7 +207,7 @@ public: float draw_char(const Ref<Font>& p_font,const Point2& p_pos, const String& p_char,const String& p_next="",const Color& p_modulate=Color(1,1,1)); void draw_set_transform(const Point2& p_offset, float p_rot, const Size2& p_scale); - void draw_set_transform_matrix(const Matrix32& p_matrix); + void draw_set_transform_matrix(const Transform2D& p_matrix); /* RECT / TRANSFORM */ @@ -220,10 +220,10 @@ public: CanvasItem *get_parent_item() const; virtual Rect2 get_item_rect() const=0; - virtual Matrix32 get_transform() const=0; + virtual Transform2D get_transform() const=0; - virtual Matrix32 get_global_transform() const; - virtual Matrix32 get_global_transform_with_canvas() const; + virtual Transform2D get_global_transform() const; + virtual Transform2D get_global_transform_with_canvas() const; Rect2 get_item_and_children_rect() const; @@ -234,8 +234,8 @@ public: bool is_block_transform_notify_enabled() const; - Matrix32 get_canvas_transform() const; - Matrix32 get_viewport_transform() const; + Transform2D get_canvas_transform() const; + Transform2D get_viewport_transform() const; Rect2 get_viewport_rect() const; RID get_viewport_rid() const; RID get_canvas() const; diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index 90ca59d780..817651f57c 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -221,7 +221,7 @@ void CollisionObject2D::_update_pickable() { void CollisionObject2D::_bind_methods() { - ClassDB::bind_method(_MD("add_shape","shape:Shape2D","transform"),&CollisionObject2D::add_shape,DEFVAL(Matrix32())); + ClassDB::bind_method(_MD("add_shape","shape:Shape2D","transform"),&CollisionObject2D::add_shape,DEFVAL(Transform2D())); ClassDB::bind_method(_MD("get_shape_count"),&CollisionObject2D::get_shape_count); ClassDB::bind_method(_MD("set_shape","shape_idx","shape:Shape"),&CollisionObject2D::set_shape); ClassDB::bind_method(_MD("set_shape_transform","shape_idx","transform"),&CollisionObject2D::set_shape_transform); @@ -249,7 +249,7 @@ void CollisionObject2D::_bind_methods() { } -void CollisionObject2D::add_shape(const Ref<Shape2D>& p_shape, const Matrix32& p_transform) { +void CollisionObject2D::add_shape(const Ref<Shape2D>& p_shape, const Transform2D& p_transform) { ERR_FAIL_COND(p_shape.is_null()); @@ -285,7 +285,7 @@ void CollisionObject2D::set_shape(int p_shape_idx, const Ref<Shape2D>& p_shape) // _update_shapes(); } -void CollisionObject2D::set_shape_transform(int p_shape_idx, const Matrix32& p_transform) { +void CollisionObject2D::set_shape_transform(int p_shape_idx, const Transform2D& p_transform) { ERR_FAIL_INDEX(p_shape_idx,shapes.size()); shapes[p_shape_idx].xform=p_transform; @@ -304,9 +304,9 @@ Ref<Shape2D> CollisionObject2D::get_shape(int p_shape_idx) const { return shapes[p_shape_idx].shape; } -Matrix32 CollisionObject2D::get_shape_transform(int p_shape_idx) const { +Transform2D CollisionObject2D::get_shape_transform(int p_shape_idx) const { - ERR_FAIL_INDEX_V(p_shape_idx,shapes.size(),Matrix32()); + ERR_FAIL_INDEX_V(p_shape_idx,shapes.size(),Transform2D()); return shapes[p_shape_idx].xform; } diff --git a/scene/2d/collision_object_2d.h b/scene/2d/collision_object_2d.h index 6f6d3520da..429b4fafe6 100644 --- a/scene/2d/collision_object_2d.h +++ b/scene/2d/collision_object_2d.h @@ -41,7 +41,7 @@ class CollisionObject2D : public Node2D { bool pickable; struct ShapeData { - Matrix32 xform; + Transform2D xform; Ref<Shape2D> shape; bool trigger; @@ -78,12 +78,12 @@ public: - void add_shape(const Ref<Shape2D>& p_shape, const Matrix32& p_transform=Matrix32()); + void add_shape(const Ref<Shape2D>& p_shape, const Transform2D& p_transform=Transform2D()); int get_shape_count() const; void set_shape(int p_shape_idx, const Ref<Shape2D>& p_shape); - void set_shape_transform(int p_shape_idx, const Matrix32& p_transform); + void set_shape_transform(int p_shape_idx, const Transform2D& p_transform); Ref<Shape2D> get_shape(int p_shape_idx) const; - Matrix32 get_shape_transform(int p_shape_idx) const; + Transform2D get_shape_transform(int p_shape_idx) const; void set_shape_as_trigger(int p_shape_idx, bool p_trigger); bool is_shape_set_as_trigger(int p_shape_idx) const; void remove_shape(int p_shape_idx); diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 46baa7c184..04f096f229 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -330,7 +330,7 @@ void CollisionPolygon2D::_bind_methods() { ClassDB::bind_method(_MD("get_collision_object_last_shape"),&CollisionPolygon2D::get_collision_object_last_shape); ADD_PROPERTY( PropertyInfo(Variant::INT,"build_mode",PROPERTY_HINT_ENUM,"Solids,Segments"),_SCS("set_build_mode"),_SCS("get_build_mode")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon")); + ADD_PROPERTY( PropertyInfo(Variant::POOL_VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"shape_range",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_shape_range"),_SCS("_get_shape_range")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"trigger"),_SCS("set_trigger"),_SCS("is_trigger")); diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp index 0d83509f37..987672df38 100644 --- a/scene/2d/joints_2d.cpp +++ b/scene/2d/joints_2d.cpp @@ -283,7 +283,7 @@ RID GrooveJoint2D::_configure_joint(){ else Physics2DServer::get_singleton()->body_remove_collision_exception(body_a->get_rid(),body_b->get_rid()); - Matrix32 gt = get_global_transform(); + Transform2D gt = get_global_transform(); Vector2 groove_A1 = gt.get_origin(); Vector2 groove_A2 = gt.xform( Vector2(0,length) ); Vector2 anchor_B = gt.xform( Vector2(0,initial_offset) ); @@ -384,7 +384,7 @@ RID DampedSpringJoint2D::_configure_joint(){ else Physics2DServer::get_singleton()->body_remove_collision_exception(body_a->get_rid(),body_b->get_rid()); - Matrix32 gt = get_global_transform(); + Transform2D gt = get_global_transform(); Vector2 anchor_A = gt.get_origin(); Vector2 anchor_B = gt.xform( Vector2(0,length) ); diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index b7b280d902..8d447c3e8b 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -89,7 +89,7 @@ void OccluderPolygon2D::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::BOOL,"closed"),_SCS("set_closed"),_SCS("is_closed")); ADD_PROPERTY( PropertyInfo(Variant::INT,"cull_mode",PROPERTY_HINT_ENUM,"Disabled,ClockWise,CounterClockWise"),_SCS("set_cull_mode"),_SCS("get_cull_mode")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon")); + ADD_PROPERTY( PropertyInfo(Variant::POOL_VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon")); BIND_CONSTANT(CULL_DISABLED); BIND_CONSTANT(CULL_CLOCKWISE); diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp index be68c61bd8..2d0fbf1cfc 100644 --- a/scene/2d/navigation2d.cpp +++ b/scene/2d/navigation2d.cpp @@ -212,7 +212,7 @@ void Navigation2D::_navpoly_unlink(int p_id) { } -int Navigation2D::navpoly_create(const Ref<NavigationPolygon>& p_mesh, const Matrix32& p_xform, Object *p_owner) { +int Navigation2D::navpoly_create(const Ref<NavigationPolygon>& p_mesh, const Transform2D& p_xform, Object *p_owner) { int id = last_id++; NavMesh nm; @@ -227,7 +227,7 @@ int Navigation2D::navpoly_create(const Ref<NavigationPolygon>& p_mesh, const Mat return id; } -void Navigation2D::navpoly_set_transform(int p_id, const Matrix32& p_xform){ +void Navigation2D::navpoly_set_transform(int p_id, const Transform2D& p_xform){ ERR_FAIL_COND(!navpoly_map.has(p_id)); NavMesh &nm=navpoly_map[p_id]; diff --git a/scene/2d/navigation2d.h b/scene/2d/navigation2d.h index c1c1600291..63827ebb6d 100644 --- a/scene/2d/navigation2d.h +++ b/scene/2d/navigation2d.h @@ -119,7 +119,7 @@ class Navigation2D : public Node2D { struct NavMesh { Object *owner; - Matrix32 xform; + Transform2D xform; bool linked; Ref<NavigationPolygon> navpoly; List<Polygon> polygons; @@ -164,8 +164,8 @@ protected: public: //API should be as dynamic as possible - int navpoly_create(const Ref<NavigationPolygon>& p_mesh,const Matrix32& p_xform,Object* p_owner=NULL); - void navpoly_set_transform(int p_id, const Matrix32& p_xform); + int navpoly_create(const Ref<NavigationPolygon>& p_mesh,const Transform2D& p_xform,Object* p_owner=NULL); + void navpoly_set_transform(int p_id, const Transform2D& p_xform); void navpoly_remove(int p_id); Vector<Vector2> get_simple_path(const Vector2& p_start, const Vector2& p_end,bool p_optimize=true); diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index add3a183ef..5c1837ad65 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -270,7 +270,7 @@ void NavigationPolygon::_bind_methods() { ClassDB::bind_method(_MD("_set_outlines","outlines"),&NavigationPolygon::_set_outlines); ClassDB::bind_method(_MD("_get_outlines"),&NavigationPolygon::_get_outlines); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR3_ARRAY,"vertices",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_vertices"),_SCS("get_vertices")); + ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY,"vertices",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_vertices"),_SCS("get_vertices")); ADD_PROPERTY(PropertyInfo(Variant::ARRAY,"polygons",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_polygons"),_SCS("_get_polygons")); ADD_PROPERTY(PropertyInfo(Variant::ARRAY,"outlines",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_outlines"),_SCS("_get_outlines")); } diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 800435d4c3..fb71a5b536 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -92,7 +92,7 @@ void Node2D::edit_set_rect(const Rect2& p_edit_rect) { Point2 new_pos = p_edit_rect.pos + p_edit_rect.size*zero_offset;//p_edit_rect.pos - r.pos; - Matrix32 postxf; + Transform2D postxf; postxf.set_rotation_and_scale(angle,_scale); new_pos = postxf.xform(new_pos); @@ -124,7 +124,7 @@ void Node2D::_update_xform_values() { void Node2D::_update_transform() { - Matrix32 mat(angle,pos); + Transform2D mat(angle,pos); _mat.set_rotation_and_scale(angle,_scale); _mat.elements[2]=pos; @@ -222,7 +222,7 @@ void Node2D::_notification(int p_what) { } } -Matrix32 Node2D::get_transform() const { +Transform2D Node2D::get_transform() const { return _mat; } @@ -261,7 +261,7 @@ void Node2D::scale(const Size2& p_amount) { void Node2D::move_x(float p_delta,bool p_scaled){ - Matrix32 t = get_transform(); + Transform2D t = get_transform(); Vector2 m = t[0]; if (!p_scaled) m.normalize(); @@ -270,7 +270,7 @@ void Node2D::move_x(float p_delta,bool p_scaled){ void Node2D::move_y(float p_delta,bool p_scaled){ - Matrix32 t = get_transform(); + Transform2D t = get_transform(); Vector2 m = t[1]; if (!p_scaled) m.normalize(); @@ -285,7 +285,7 @@ Point2 Node2D::get_global_position() const { void Node2D::set_global_position(const Point2& p_pos) { - Matrix32 inv; + Transform2D inv; CanvasItem *pi = get_parent_item(); if (pi) { inv = pi->get_global_transform().affine_inverse(); @@ -342,7 +342,7 @@ void Node2D::set_global_scale(const Size2& p_scale) { } -void Node2D::set_transform(const Matrix32& p_transform) { +void Node2D::set_transform(const Transform2D& p_transform) { _mat=p_transform; _xform_dirty=true; @@ -355,7 +355,7 @@ void Node2D::set_transform(const Matrix32& p_transform) { _notify_transform(); } -void Node2D::set_global_transform(const Matrix32& p_transform) { +void Node2D::set_global_transform(const Transform2D& p_transform) { CanvasItem *pi = get_parent_item(); if (pi) @@ -394,14 +394,14 @@ int Node2D::get_z() const{ return z; } -Matrix32 Node2D::get_relative_transform_to_parent(const Node *p_parent) const { +Transform2D Node2D::get_relative_transform_to_parent(const Node *p_parent) const { if (p_parent==this) - return Matrix32(); + return Transform2D(); Node2D *parent_2d = get_parent()->cast_to<Node2D>(); - ERR_FAIL_COND_V(!parent_2d,Matrix32()); + ERR_FAIL_COND_V(!parent_2d,Transform2D()); if (p_parent==parent_2d) return get_transform(); else @@ -473,13 +473,13 @@ void Node2D::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"rotation",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_rotation"),_SCS("get_rotation")); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"rotation_deg",PROPERTY_HINT_RANGE,"-1440,1440,0.1",PROPERTY_USAGE_EDITOR),_SCS("set_rotation_in_degrees"),_SCS("get_rotation_in_degrees")); ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2,"scale"),_SCS("set_scale"),_SCS("get_scale")); - ADD_PROPERTY(PropertyInfo(Variant::MATRIX32,"transform",PROPERTY_HINT_NONE,"",0),_SCS("set_transform"),_SCS("get_transform")); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D,"transform",PROPERTY_HINT_NONE,"",0),_SCS("set_transform"),_SCS("get_transform")); ADD_PROPERTY(PropertyInfo(Variant::REAL,"global_position",PROPERTY_HINT_NONE,"",0),_SCS("set_global_position"),_SCS("get_global_position")); ADD_PROPERTY(PropertyInfo(Variant::REAL,"global_rotation",PROPERTY_HINT_NONE,"",0),_SCS("set_global_rotation"),_SCS("get_global_rotation")); ADD_PROPERTY(PropertyInfo(Variant::REAL,"global_rotation_deg",PROPERTY_HINT_NONE,"",0),_SCS("set_global_rotation_in_degrees"),_SCS("get_global_rotation_in_degrees")); ADD_PROPERTY(PropertyInfo(Variant::REAL,"global_scale",PROPERTY_HINT_NONE,"",0),_SCS("set_global_scale"),_SCS("get_global_scale")); - ADD_PROPERTY(PropertyInfo(Variant::MATRIX32,"global_transform",PROPERTY_HINT_NONE,"",0),_SCS("set_global_transform"),_SCS("get_global_transform")); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D,"global_transform",PROPERTY_HINT_NONE,"",0),_SCS("set_global_transform"),_SCS("get_global_transform")); ADD_GROUP("Z",""); ADD_PROPERTYNZ(PropertyInfo(Variant::INT,"z",PROPERTY_HINT_RANGE,itos(VS::CANVAS_ITEM_Z_MIN)+","+itos(VS::CANVAS_ITEM_Z_MAX)+",1"),_SCS("set_z"),_SCS("get_z")); diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index 15dfd703fe..2cceef0f06 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -41,7 +41,7 @@ class Node2D : public CanvasItem { int z; bool z_relative; - Matrix32 _mat; + Transform2D _mat; bool _xform_dirty; @@ -92,8 +92,8 @@ public: Size2 get_global_scale() const; virtual Rect2 get_item_rect() const; - void set_transform(const Matrix32& p_transform); - void set_global_transform(const Matrix32& p_transform); + void set_transform(const Transform2D& p_transform); + void set_global_transform(const Transform2D& p_transform); void set_global_position(const Point2& p_pos); void set_global_rotation(float p_radians); void set_global_rotation_in_degrees(float p_degrees); @@ -108,9 +108,9 @@ public: void set_z_as_relative(bool p_enabled); bool is_z_relative() const; - Matrix32 get_relative_transform_to_parent(const Node *p_parent) const; + Transform2D get_relative_transform_to_parent(const Node *p_parent) const; - Matrix32 get_transform() const; + Transform2D get_transform() const; Node2D(); }; diff --git a/scene/2d/parallax_background.cpp b/scene/2d/parallax_background.cpp index 022e31760b..1e6a449fce 100644 --- a/scene/2d/parallax_background.cpp +++ b/scene/2d/parallax_background.cpp @@ -50,7 +50,7 @@ void ParallaxBackground::_notification(int p_what) { } -void ParallaxBackground::_camera_moved(const Matrix32& p_transform) { +void ParallaxBackground::_camera_moved(const Transform2D& p_transform) { set_scroll_offset(p_transform.get_origin()); diff --git a/scene/2d/parallax_background.h b/scene/2d/parallax_background.h index 9eafc07fd6..caef4962e8 100644 --- a/scene/2d/parallax_background.h +++ b/scene/2d/parallax_background.h @@ -50,7 +50,7 @@ class ParallaxBackground : public CanvasLayer { void _update_scroll(); protected: - void _camera_moved(const Matrix32& p_transform); + void _camera_moved(const Transform2D& p_transform); void _notification(int p_what); static void _bind_methods(); diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index f8747d54b7..cb866165ff 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -270,7 +270,7 @@ void Particles2D::_process_particles(float p_delta) { Particle *pdata=&particles[0]; int particle_count=particles.size(); - Matrix32 xform; + Transform2D xform; if (!local_space) xform=get_global_transform(); @@ -293,7 +293,7 @@ void Particles2D::_process_particles(float p_delta) { } int idx=0; - Matrix32 m; + Transform2D m; if (local_space) { m= get_global_transform().affine_inverse(); } @@ -391,7 +391,7 @@ void Particles2D::_process_particles(float p_delta) { float orbitvel = (param[PARAM_ORBIT_VELOCITY]+param[PARAM_ORBIT_VELOCITY]*randomness[PARAM_ORBIT_VELOCITY]*_rand_from_seed(&rand_seed)); if (orbitvel!=0) { Vector2 rel = p.pos - xform.elements[2]; - Matrix32 rot(orbitvel*frame_time,Vector2()); + Transform2D rot(orbitvel*frame_time,Vector2()); p.pos = rot.xform(rel) + xform.elements[2]; } @@ -507,7 +507,7 @@ void Particles2D::_notification(int p_what) { if (texture.is_valid()) texrid = texture->get_rid(); - Matrix32 invxform; + Transform2D invxform; if (!local_space) invxform=get_global_transform().affine_inverse(); @@ -573,7 +573,7 @@ void Particles2D::_notification(int p_what) { //Rect2 r = Rect2(Vecto,rectsize); - Matrix32 xform; + Transform2D xform; if (p.rot) { @@ -1125,7 +1125,7 @@ void Particles2D::_bind_methods() { ADD_PROPERTYNO(PropertyInfo(Variant::COLOR, "color/color"),_SCS("set_color"),_SCS("get_color")); ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"color/color_ramp",PROPERTY_HINT_RESOURCE_TYPE,"ColorRamp"),_SCS("set_color_ramp"),_SCS("get_color_ramp")); - ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2_ARRAY,"emission_points",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_emission_points"),_SCS("get_emission_points")); + ADD_PROPERTYNZ(PropertyInfo(Variant::POOL_VECTOR2_ARRAY,"emission_points",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_emission_points"),_SCS("get_emission_points")); BIND_CONSTANT( PARAM_DIRECTION ); BIND_CONSTANT( PARAM_SPREAD ); diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 6be5689f1d..0c2aa002c4 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -226,7 +226,7 @@ void StaticBody2D::_update_xform() { setting=true; - Matrix32 new_xform = get_global_transform(); //obtain the new one + Transform2D new_xform = get_global_transform(); //obtain the new one set_block_transform_notify(true); Physics2DServer::get_singleton()->body_set_state(get_rid(),Physics2DServer::BODY_STATE_TRANSFORM,*pre_xform); //then simulate motion! @@ -1046,7 +1046,7 @@ Variant KinematicBody2D::_get_collider() const { void KinematicBody2D::revert_motion() { - Matrix32 gt = get_global_transform(); + Transform2D gt = get_global_transform(); gt.elements[2]-=travel; travel=Vector2(); set_global_transform(gt); @@ -1062,7 +1062,7 @@ Vector2 KinematicBody2D::move(const Vector2& p_motion) { #if 1 - Matrix32 gt = get_global_transform(); + Transform2D gt = get_global_transform(); Physics2DServer::MotionResult result; colliding = Physics2DServer::get_singleton()->body_test_motion(get_rid(),gt,p_motion,margin,&result); @@ -1152,7 +1152,7 @@ Vector2 KinematicBody2D::move(const Vector2& p_motion) { - Matrix32 gt = get_global_transform(); + Transform2D gt = get_global_transform(); gt.elements[2]+=recover_motion; set_global_transform(gt); @@ -1203,7 +1203,7 @@ Vector2 KinematicBody2D::move(const Vector2& p_motion) { } else { //it collided, let's get the rest info in unsafe advance - Matrix32 ugt = get_global_transform(); + Transform2D ugt = get_global_transform(); ugt.elements[2]+=p_motion*unsafe; Physics2DDirectSpaceState::ShapeRestInfo rest_info; bool c2 = dss->rest_info(get_shape(best_shape)->get_rid(), ugt*get_shape_transform(best_shape), Vector2(), margin,&rest_info,exclude,get_layer_mask(),mask); @@ -1227,7 +1227,7 @@ Vector2 KinematicBody2D::move(const Vector2& p_motion) { } Vector2 motion=p_motion*safe; - Matrix32 gt = get_global_transform(); + Transform2D gt = get_global_transform(); gt.elements[2]+=motion; set_global_transform(gt); @@ -1318,7 +1318,7 @@ Vector2 KinematicBody2D::move_to(const Vector2& p_position) { return move(p_position-get_global_position()); } -bool KinematicBody2D::test_move(const Matrix32& p_from,const Vector2& p_motion) { +bool KinematicBody2D::test_move(const Transform2D& p_from,const Vector2& p_motion) { ERR_FAIL_COND_V(!is_inside_tree(),false); diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index 240def543d..2637238c04 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -319,7 +319,7 @@ public: Vector2 move(const Vector2& p_motion); Vector2 move_to(const Vector2& p_position); - bool test_move(const Matrix32 &p_from, const Vector2& p_motion); + bool test_move(const Transform2D &p_from, const Vector2& p_motion); bool is_colliding() const; Vector2 get_travel() const; diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 948c8b0818..30e22a8437 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -148,7 +148,7 @@ void Polygon2D::_notification(int p_what) { if (texture.is_valid()) { - Matrix32 texmat(tex_rot,tex_ofs); + Transform2D texmat(tex_rot,tex_ofs); texmat.scale(tex_scale); Size2 tex_size=Vector2(1,1); @@ -372,10 +372,10 @@ void Polygon2D::_bind_methods() { - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"uv"),_SCS("set_uv"),_SCS("get_uv")); + ADD_PROPERTY( PropertyInfo(Variant::POOL_VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon")); + ADD_PROPERTY( PropertyInfo(Variant::POOL_VECTOR2_ARRAY,"uv"),_SCS("set_uv"),_SCS("get_uv")); ADD_PROPERTY( PropertyInfo(Variant::COLOR,"color"),_SCS("set_color"),_SCS("get_color")); - ADD_PROPERTY( PropertyInfo(Variant::COLOR_ARRAY,"vertex_colors"),_SCS("set_vertex_colors"),_SCS("get_vertex_colors")); + ADD_PROPERTY( PropertyInfo(Variant::POOL_COLOR_ARRAY,"vertex_colors"),_SCS("set_vertex_colors"),_SCS("get_vertex_colors")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"offset"),_SCS("set_offset"),_SCS("get_offset")); ADD_GROUP("Texture",""); ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture")); diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index 572575e4ec..14dfc10d9f 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -161,7 +161,7 @@ void RayCast2D::_notification(int p_what) { if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) break; - Matrix32 xf; + Transform2D xf; xf.rotate(cast_to.angle()); xf.translate(Vector2(0,cast_to.length())); @@ -201,7 +201,7 @@ void RayCast2D::_update_raycast_state() { Physics2DDirectSpaceState *dss = Physics2DServer::get_singleton()->space_get_direct_state(w2d->get_space()); ERR_FAIL_COND( !dss ); - Matrix32 gt = get_global_transform(); + Transform2D gt = get_global_transform(); Vector2 to = cast_to; if (to==Vector2()) diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index dbbc261b48..7bd3a5d932 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -114,16 +114,16 @@ void TileMap::_update_quadrant_transform() { if (!is_inside_tree()) return; - Matrix32 global_transform = get_global_transform(); + Transform2D global_transform = get_global_transform(); - Matrix32 nav_rel; + Transform2D nav_rel; if (navigation) nav_rel = get_relative_transform_to_parent(navigation); for (Map<PosKey,Quadrant>::Element *E=quadrant_map.front();E;E=E->next()) { Quadrant &q=E->get(); - Matrix32 xform; + Transform2D xform; xform.set_origin( q.pos ); xform = global_transform * xform; Physics2DServer::get_singleton()->body_set_state(q.body,Physics2DServer::BODY_STATE_TRANSFORM,xform); @@ -218,7 +218,7 @@ bool TileMap::get_center_y() const { return center_y; } -void TileMap::_fix_cell_transform(Matrix32& xform,const Cell& p_cell, const Vector2& p_offset, const Size2 &p_sc) { +void TileMap::_fix_cell_transform(Transform2D& xform,const Cell& p_cell, const Vector2& p_offset, const Size2 &p_sc) { Size2 s=p_sc; Vector2 offset = p_offset; @@ -277,7 +277,7 @@ void TileMap::_update_dirty_quadrants() { Physics2DServer *ps = Physics2DServer::get_singleton(); Vector2 tofs = get_cell_draw_offset(); Vector2 tcenter = cell_size/2; - Matrix32 nav_rel; + Transform2D nav_rel; if (navigation) nav_rel = get_relative_transform_to_parent(navigation); @@ -348,7 +348,7 @@ void TileMap::_update_dirty_quadrants() { if (mat.is_valid()) vs->canvas_item_set_material(canvas_item,mat->get_rid()); vs->canvas_item_set_parent( canvas_item, get_canvas_item() ); - Matrix32 xform; + Transform2D xform; xform.set_origin( q.pos ); vs->canvas_item_set_transform( canvas_item, xform ); vs->canvas_item_set_light_mask(canvas_item,get_light_mask()); @@ -472,7 +472,7 @@ void TileMap::_update_dirty_quadrants() { if (shape.is_valid()) { Vector2 shape_ofs = tile_set->tile_get_shape_offset(c.id); - Matrix32 xform; + Transform2D xform; xform.set_origin(offset.floor()); _fix_cell_transform(xform,c,shape_ofs+center_ofs,s); @@ -489,14 +489,14 @@ void TileMap::_update_dirty_quadrants() { } if (debug_canvas_item.is_valid()) { - vs->canvas_item_add_set_transform(debug_canvas_item,Matrix32()); + vs->canvas_item_add_set_transform(debug_canvas_item,Transform2D()); } if (navigation) { Ref<NavigationPolygon> navpoly = tile_set->tile_get_navigation_polygon(c.id); if (navpoly.is_valid()) { Vector2 npoly_ofs = tile_set->tile_get_navigation_polygon_offset(c.id); - Matrix32 xform; + Transform2D xform; xform.set_origin(offset.floor()+q.pos); _fix_cell_transform(xform,c,npoly_ofs+center_ofs,s); @@ -515,7 +515,7 @@ void TileMap::_update_dirty_quadrants() { if (occluder.is_valid()) { Vector2 occluder_ofs = tile_set->tile_get_occluder_offset(c.id); - Matrix32 xform; + Transform2D xform; xform.set_origin(offset.floor()+q.pos); _fix_cell_transform(xform,c,occluder_ofs+center_ofs,s); @@ -598,7 +598,7 @@ void TileMap::_recompute_rect_cache() { Map<TileMap::PosKey,TileMap::Quadrant>::Element *TileMap::_create_quadrant(const PosKey& p_qk) { - Matrix32 xform; + Transform2D xform; //xform.set_origin(Point2(p_qk.x,p_qk.y)*cell_size*quadrant_size); Quadrant q; q.pos = _map_to_world(p_qk.x*_get_quadrant_size(),p_qk.y*_get_quadrant_size()); @@ -1034,13 +1034,13 @@ TileMap::HalfOffset TileMap::get_half_offset() const { return half_offset; } -Matrix32 TileMap::get_cell_transform() const { +Transform2D TileMap::get_cell_transform() const { switch(mode) { case MODE_SQUARE: { - Matrix32 m; + Transform2D m; m[0]*=cell_size.x; m[1]*=cell_size.y; return m; @@ -1049,7 +1049,7 @@ Matrix32 TileMap::get_cell_transform() const { //isometric only makes sense when y is positive in both x and y vectors, otherwise //the drawing of tiles will overlap - Matrix32 m; + Transform2D m; m[0]=Vector2(cell_size.x*0.5,cell_size.y*0.5); m[1]=Vector2(-cell_size.x*0.5,cell_size.y*0.5); return m; @@ -1061,10 +1061,10 @@ Matrix32 TileMap::get_cell_transform() const { } break; } - return Matrix32(); + return Transform2D(); } -void TileMap::set_custom_transform(const Matrix32& p_xform) { +void TileMap::set_custom_transform(const Transform2D& p_xform) { _clear_quadrants(); custom_transform=p_xform; @@ -1073,7 +1073,7 @@ void TileMap::set_custom_transform(const Matrix32& p_xform) { } -Matrix32 TileMap::get_custom_transform() const{ +Transform2D TileMap::get_custom_transform() const{ return custom_transform; } @@ -1265,7 +1265,7 @@ void TileMap::_bind_methods() { ADD_GROUP("Cell","cell_"); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"cell_size",PROPERTY_HINT_RANGE,"1,8192,1"),_SCS("set_cell_size"),_SCS("get_cell_size")); ADD_PROPERTY( PropertyInfo(Variant::INT,"cell_quadrant_size",PROPERTY_HINT_RANGE,"1,128,1"),_SCS("set_quadrant_size"),_SCS("get_quadrant_size")); - ADD_PROPERTY( PropertyInfo(Variant::MATRIX32,"cell_custom_transform"),_SCS("set_custom_transform"),_SCS("get_custom_transform")); + ADD_PROPERTY( PropertyInfo(Variant::TRANSFORM2D,"cell_custom_transform"),_SCS("set_custom_transform"),_SCS("get_custom_transform")); ADD_PROPERTY( PropertyInfo(Variant::INT,"cell_half_offset",PROPERTY_HINT_ENUM,"Offset X,Offset Y,Disabled"),_SCS("set_half_offset"),_SCS("get_half_offset")); ADD_PROPERTY( PropertyInfo(Variant::INT,"cell_tile_origin",PROPERTY_HINT_ENUM,"Top Left,Center,Bottom Left"),_SCS("set_tile_origin"),_SCS("get_tile_origin")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"cell_y_sort"),_SCS("set_y_sort_mode"),_SCS("is_y_sort_mode_enabled")); diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index f863c0b2ea..ba6de62f8e 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -66,7 +66,7 @@ private: int quadrant_size; bool center_x,center_y; Mode mode; - Matrix32 custom_transform; + Transform2D custom_transform; HalfOffset half_offset; bool use_kinematic; Navigation2D *navigation; @@ -114,12 +114,12 @@ private: struct NavPoly { int id; - Matrix32 xform; + Transform2D xform; }; struct Occluder { RID id; - Matrix32 xform; + Transform2D xform; }; @@ -153,7 +153,7 @@ private: int occluder_light_mask; - void _fix_cell_transform(Matrix32& xform, const Cell& p_cell, const Vector2 &p_offset, const Size2 &p_sc); + void _fix_cell_transform(Transform2D& xform, const Cell& p_cell, const Vector2 &p_offset, const Size2 &p_sc); Map<PosKey,Quadrant>::Element *_create_quadrant(const PosKey& p_qk); void _erase_quadrant(Map<PosKey,Quadrant>::Element *Q); @@ -240,10 +240,10 @@ public: void set_tile_origin(TileOrigin p_tile_origin); TileOrigin get_tile_origin() const; - void set_custom_transform(const Matrix32& p_xform); - Matrix32 get_custom_transform() const; + void set_custom_transform(const Transform2D& p_xform); + Transform2D get_custom_transform() const; - Matrix32 get_cell_transform() const; + Transform2D get_cell_transform() const; Vector2 get_cell_draw_offset() const; Vector2 map_to_world(const Vector2& p_pos, bool p_ignore_ofs=false) const; diff --git a/scene/3d/baked_light_instance.cpp b/scene/3d/baked_light_instance.cpp index 19be12ed91..59d8d7ecac 100644 --- a/scene/3d/baked_light_instance.cpp +++ b/scene/3d/baked_light_instance.cpp @@ -308,7 +308,7 @@ static _FORCE_INLINE_ Vector2 get_uv(const Vector3& p_pos, const Vector3 *p_vtx, return p_uv[0]*u + p_uv[1]*v + p_uv[2]*w; } -void BakedLight::_plot_face(int p_idx, int p_level, const Vector3 *p_vtx, const Vector2* p_uv, const MaterialCache& p_material, const AABB &p_aabb) { +void BakedLight::_plot_face(int p_idx, int p_level, const Vector3 *p_vtx, const Vector2* p_uv, const MaterialCache& p_material, const Rect3 &p_aabb) { @@ -477,7 +477,7 @@ void BakedLight::_plot_face(int p_idx, int p_level, const Vector3 *p_vtx, const //go down for(int i=0;i<8;i++) { - AABB aabb=p_aabb; + Rect3 aabb=p_aabb; aabb.size*=0.5; if (i&1) @@ -488,7 +488,7 @@ void BakedLight::_plot_face(int p_idx, int p_level, const Vector3 *p_vtx, const aabb.pos.z+=aabb.size.z; { - AABB test_aabb=aabb; + Rect3 test_aabb=aabb; //test_aabb.grow_by(test_aabb.get_longest_axis_size()*0.05); //grow a bit to avoid numerical error in real-time Vector3 qsize = test_aabb.size*0.5; //quarter size, for fast aabb test @@ -1534,9 +1534,9 @@ int BakedLight::get_cell_subdiv() const { -AABB BakedLight::get_aabb() const { +Rect3 BakedLight::get_aabb() const { - return AABB(Vector3(0,0,0),Vector3(1,1,1)); + return Rect3(Vector3(0,0,0),Vector3(1,1,1)); } PoolVector<Face3> BakedLight::get_faces(uint32_t p_usage_flags) const { @@ -1549,7 +1549,7 @@ String BakedLight::get_configuration_warning() const { } -void BakedLight::_debug_mesh(int p_idx, int p_level, const AABB &p_aabb,DebugMode p_mode,Ref<MultiMesh> &p_multimesh,int &idx) { +void BakedLight::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb,DebugMode p_mode,Ref<MultiMesh> &p_multimesh,int &idx) { if (p_level==cell_subdiv-1) { @@ -1585,7 +1585,7 @@ void BakedLight::_debug_mesh(int p_idx, int p_level, const AABB &p_aabb,DebugMod if (bake_cells_write[p_idx].childs[i]==CHILD_EMPTY) continue; - AABB aabb=p_aabb; + Rect3 aabb=p_aabb; aabb.size*=0.5; if (i&1) diff --git a/scene/3d/baked_light_instance.h b/scene/3d/baked_light_instance.h index 461b3adeff..2fda26ecea 100644 --- a/scene/3d/baked_light_instance.h +++ b/scene/3d/baked_light_instance.h @@ -49,7 +49,7 @@ public: private: RID baked_light; int cell_subdiv; - AABB bounds; + Rect3 bounds; int cells_per_axis; enum { @@ -112,12 +112,12 @@ private: - void _plot_face(int p_idx,int p_level,const Vector3 *p_vtx,const Vector2* p_uv, const MaterialCache& p_material,const AABB& p_aabb); + void _plot_face(int p_idx,int p_level,const Vector3 *p_vtx,const Vector2* p_uv, const MaterialCache& p_material,const Rect3& p_aabb); void _fixup_plot(int p_idx, int p_level, int p_x, int p_y, int p_z); void _bake_add_mesh(const Transform& p_xform,Ref<Mesh>& p_mesh); void _bake_add_to_aabb(const Transform& p_xform,Ref<Mesh>& p_mesh,bool &first); - void _debug_mesh(int p_idx, int p_level, const AABB &p_aabb,DebugMode p_mode,Ref<MultiMesh> &p_multimesh,int &idx); + void _debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb,DebugMode p_mode,Ref<MultiMesh> &p_multimesh,int &idx); void _debug_mesh_albedo(); void _debug_mesh_light(); @@ -156,7 +156,7 @@ public: void create_debug_mesh(DebugMode p_mode); - virtual AABB get_aabb() const; + virtual Rect3 get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; String get_configuration_warning() const; diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp index 6cc0291707..d0612986df 100644 --- a/scene/3d/collision_polygon.cpp +++ b/scene/3d/collision_polygon.cpp @@ -200,7 +200,7 @@ void CollisionPolygon::set_polygon(const Vector<Point2>& p_polygon) { Vector3 p1(polygon[i].x,polygon[i].y,depth*0.5); if (i==0) - aabb=AABB(p1,Vector3()); + aabb=Rect3(p1,Vector3()); else aabb.expand_to(p1); @@ -209,9 +209,9 @@ void CollisionPolygon::set_polygon(const Vector<Point2>& p_polygon) { } - if (aabb==AABB()) { + if (aabb==Rect3()) { - aabb=AABB(Vector3(-1,-1,-1),Vector3(2,2,2)); + aabb=Rect3(Vector3(-1,-1,-1),Vector3(2,2,2)); } else { aabb.pos-=aabb.size*0.3; aabb.size+=aabb.size*0.6; @@ -240,7 +240,7 @@ CollisionPolygon::BuildMode CollisionPolygon::get_build_mode() const{ return build_mode; } -AABB CollisionPolygon::get_item_rect() const { +Rect3 CollisionPolygon::get_item_rect() const { return aabb; } @@ -294,7 +294,7 @@ void CollisionPolygon::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::INT,"build_mode",PROPERTY_HINT_ENUM,"Solids,Triangles"),_SCS("set_build_mode"),_SCS("get_build_mode")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"depth"),_SCS("set_depth"),_SCS("get_depth")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon")); + ADD_PROPERTY( PropertyInfo(Variant::POOL_VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"shape_range",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_shape_range"),_SCS("_get_shape_range")); } @@ -304,7 +304,7 @@ CollisionPolygon::CollisionPolygon() { shape_to=-1; can_update_body=false; - aabb=AABB(Vector3(-1,-1,-1),Vector3(2,2,2)); + aabb=Rect3(Vector3(-1,-1,-1),Vector3(2,2,2)); build_mode=BUILD_SOLIDS; depth=1.0; diff --git a/scene/3d/collision_polygon.h b/scene/3d/collision_polygon.h index 8373832699..693cf0640a 100644 --- a/scene/3d/collision_polygon.h +++ b/scene/3d/collision_polygon.h @@ -48,7 +48,7 @@ protected: float depth; - AABB aabb; + Rect3 aabb; BuildMode build_mode; Vector<Point2> polygon; @@ -78,7 +78,7 @@ public: void set_polygon(const Vector<Point2>& p_polygon); Vector<Point2> get_polygon() const; - virtual AABB get_item_rect() const; + virtual Rect3 get_item_rect() const; int get_collision_object_first_shape() const { return shape_from; } int get_collision_object_last_shape() const { return shape_to; } diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 438be13394..13e7c175ed 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -2,12 +2,12 @@ #include "mesh_instance.h" -void GIProbeData::set_bounds(const AABB& p_bounds) { +void GIProbeData::set_bounds(const Rect3& p_bounds) { VS::get_singleton()->gi_probe_set_bounds(probe,p_bounds); } -AABB GIProbeData::get_bounds() const{ +Rect3 GIProbeData::get_bounds() const{ return VS::get_singleton()->gi_probe_get_bounds(probe); } @@ -127,11 +127,11 @@ void GIProbeData::_bind_methods() { ClassDB::bind_method(_MD("set_compress","compress"),&GIProbeData::set_compress); ClassDB::bind_method(_MD("is_compressed"),&GIProbeData::is_compressed); - ADD_PROPERTY(PropertyInfo(Variant::_AABB,"bounds",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_bounds"),_SCS("get_bounds")); + ADD_PROPERTY(PropertyInfo(Variant::RECT3,"bounds",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_bounds"),_SCS("get_bounds")); ADD_PROPERTY(PropertyInfo(Variant::REAL,"cell_size",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_cell_size"),_SCS("get_cell_size")); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM,"to_cell_xform",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_to_cell_xform"),_SCS("get_to_cell_xform")); - ADD_PROPERTY(PropertyInfo(Variant::INT_ARRAY,"dynamic_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_dynamic_data"),_SCS("get_dynamic_data")); + ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY,"dynamic_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_dynamic_data"),_SCS("get_dynamic_data")); ADD_PROPERTY(PropertyInfo(Variant::INT,"dynamic_range",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_dynamic_range"),_SCS("get_dynamic_range")); ADD_PROPERTY(PropertyInfo(Variant::REAL,"energy",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_energy"),_SCS("get_energy")); ADD_PROPERTY(PropertyInfo(Variant::BOOL,"interior",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_interior"),_SCS("is_interior")); @@ -427,7 +427,7 @@ static _FORCE_INLINE_ Vector2 get_uv(const Vector3& p_pos, const Vector3 *p_vtx, return p_uv[0]*u + p_uv[1]*v + p_uv[2]*w; } -void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const Vector3 *p_vtx, const Vector2* p_uv, const Baker::MaterialCache& p_material, const AABB &p_aabb,Baker *p_baker) { +void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const Vector3 *p_vtx, const Vector2* p_uv, const Baker::MaterialCache& p_material, const Rect3 &p_aabb,Baker *p_baker) { @@ -611,7 +611,7 @@ void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const V int half = (1<<(p_baker->cell_subdiv-1)) >> (p_level+1); for(int i=0;i<8;i++) { - AABB aabb=p_aabb; + Rect3 aabb=p_aabb; aabb.size*=0.5; int nx=p_x; @@ -635,7 +635,7 @@ void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const V continue; { - AABB test_aabb=aabb; + Rect3 test_aabb=aabb; //test_aabb.grow_by(test_aabb.get_longest_axis_size()*0.05); //grow a bit to avoid numerical error in real-time Vector3 qsize = test_aabb.size*0.5; //quarter size, for fast aabb test @@ -1001,11 +1001,11 @@ void GIProbe::_find_meshes(Node *p_at_node,Baker *p_baker){ Ref<Mesh> mesh = mi->get_mesh(); if (mesh.is_valid()) { - AABB aabb = mesh->get_aabb(); + Rect3 aabb = mesh->get_aabb(); Transform xf = get_global_transform().affine_inverse() * mi->get_global_transform(); - if (AABB(-extents,extents*2).intersects(xf.xform(aabb))) { + if (Rect3(-extents,extents*2).intersects(xf.xform(aabb))) { Baker::PlotMesh pm; pm.local_xform=xf; pm.mesh=mesh; @@ -1039,7 +1039,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug){ baker.bake_cells.resize(1); //find out the actual real bounds, power of 2, which gets the highest subdivision - baker.po2_bounds=AABB(-extents,extents*2.0); + baker.po2_bounds=Rect3(-extents,extents*2.0); int longest_axis = baker.po2_bounds.get_longest_axis_index(); baker.axis_cell_size[longest_axis]=(1<<(baker.cell_subdiv-1)); baker.leaf_voxel_count=0; @@ -1169,7 +1169,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug){ Ref<GIProbeData> probe_data; probe_data.instance(); - probe_data->set_bounds(AABB(-extents,extents*2.0)); + probe_data->set_bounds(Rect3(-extents,extents*2.0)); probe_data->set_cell_size(baker.po2_bounds.size[longest_axis]/baker.axis_cell_size[longest_axis]); probe_data->set_dynamic_data(data); probe_data->set_dynamic_range(dynamic_range); @@ -1190,7 +1190,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug){ } -void GIProbe::_debug_mesh(int p_idx, int p_level, const AABB &p_aabb,Ref<MultiMesh> &p_multimesh,int &idx,Baker *p_baker) { +void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb,Ref<MultiMesh> &p_multimesh,int &idx,Baker *p_baker) { if (p_level==p_baker->cell_subdiv-1) { @@ -1212,7 +1212,7 @@ void GIProbe::_debug_mesh(int p_idx, int p_level, const AABB &p_aabb,Ref<MultiMe if (p_baker->bake_cells[p_idx].childs[i]==Baker::CHILD_EMPTY) continue; - AABB aabb=p_aabb; + Rect3 aabb=p_aabb; aabb.size*=0.5; if (i&1) @@ -1332,9 +1332,9 @@ void GIProbe::_debug_bake() { bake(NULL,true); } -AABB GIProbe::get_aabb() const { +Rect3 GIProbe::get_aabb() const { - return AABB(-extents,extents*2); + return Rect3(-extents,extents*2); } PoolVector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const { diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h index 55cde2960a..e416b28791 100644 --- a/scene/3d/gi_probe.h +++ b/scene/3d/gi_probe.h @@ -17,8 +17,8 @@ public: - void set_bounds(const AABB& p_bounds); - AABB get_bounds() const; + void set_bounds(const Rect3& p_bounds); + Rect3 get_bounds() const; void set_cell_size(float p_size); float get_cell_size() const; @@ -110,7 +110,7 @@ private: int leaf_voxel_count; - AABB po2_bounds; + Rect3 po2_bounds; int axis_cell_size[3]; struct PlotMesh { @@ -140,12 +140,12 @@ private: Vector<Color> _get_bake_texture(Image &p_image,const Color& p_color); Baker::MaterialCache _get_material_cache(Ref<Material> p_material,Baker *p_baker); - void _plot_face(int p_idx, int p_level, int p_x,int p_y,int p_z,const Vector3 *p_vtx, const Vector2* p_uv, const Baker::MaterialCache& p_material, const AABB &p_aabb,Baker *p_baker); + void _plot_face(int p_idx, int p_level, int p_x,int p_y,int p_z,const Vector3 *p_vtx, const Vector2* p_uv, const Baker::MaterialCache& p_material, const Rect3 &p_aabb,Baker *p_baker); void _plot_mesh(const Transform& p_xform, Ref<Mesh>& p_mesh, Baker *p_baker); void _find_meshes(Node *p_at_node,Baker *p_baker); void _fixup_plot(int p_idx, int p_level,int p_x,int p_y, int p_z,Baker *p_baker); - void _debug_mesh(int p_idx, int p_level, const AABB &p_aabb,Ref<MultiMesh> &p_multimesh,int &idx,Baker *p_baker); + void _debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb,Ref<MultiMesh> &p_multimesh,int &idx,Baker *p_baker); void _create_debug_mesh(Baker *p_baker); void _debug_bake(); @@ -178,7 +178,7 @@ public: void bake(Node *p_from_node=NULL,bool p_create_visual_debug=false); - virtual AABB get_aabb() const; + virtual Rect3 get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; GIProbe(); diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp index ee200cb3ea..08fc1f59e8 100644 --- a/scene/3d/immediate_geometry.cpp +++ b/scene/3d/immediate_geometry.cpp @@ -92,7 +92,7 @@ void ImmediateGeometry::clear(){ } -AABB ImmediateGeometry::get_aabb() const { +Rect3 ImmediateGeometry::get_aabb() const { return aabb; } diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h index bf624e67fd..e385a34da1 100644 --- a/scene/3d/immediate_geometry.h +++ b/scene/3d/immediate_geometry.h @@ -42,7 +42,7 @@ class ImmediateGeometry : public GeometryInstance { // in VisualServer from becoming invalid if the texture is no longer used List<Ref<Texture> > cached_textures; bool empty; - AABB aabb; + Rect3 aabb; protected: static void _bind_methods(); @@ -66,7 +66,7 @@ public: - virtual AABB get_aabb() const; + virtual Rect3 get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; ImmediateGeometry(); diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 2322df6a9e..50ee3482c3 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -114,25 +114,25 @@ Color Light::get_shadow_color() const{ } -AABB Light::get_aabb() const { +Rect3 Light::get_aabb() const { if (type==VisualServer::LIGHT_DIRECTIONAL) { - return AABB( Vector3(-1,-1,-1), Vector3(2, 2, 2 ) ); + return Rect3( Vector3(-1,-1,-1), Vector3(2, 2, 2 ) ); } else if (type==VisualServer::LIGHT_OMNI) { - return AABB( Vector3(-1,-1,-1) * param[PARAM_RANGE], Vector3(2, 2, 2 ) * param[PARAM_RANGE]); + return Rect3( Vector3(-1,-1,-1) * param[PARAM_RANGE], Vector3(2, 2, 2 ) * param[PARAM_RANGE]); } else if (type==VisualServer::LIGHT_SPOT) { float len=param[PARAM_RANGE]; float size=Math::tan(Math::deg2rad(param[PARAM_SPOT_ANGLE]))*len; - return AABB( Vector3( -size,-size,-len ), Vector3( size*2, size*2, len ) ); + return Rect3( Vector3( -size,-size,-len ), Vector3( size*2, size*2, len ) ); } - return AABB(); + return Rect3(); } PoolVector<Face3> Light::get_faces(uint32_t p_usage_flags) const { diff --git a/scene/3d/light.h b/scene/3d/light.h index 3481d0229c..d27b9fed12 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -117,7 +117,7 @@ public: Color get_shadow_color() const; - virtual AABB get_aabb() const; + virtual Rect3 get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; Light(); diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index 5b12f80d5c..c4712ecc7a 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -169,12 +169,12 @@ NodePath MeshInstance::get_skeleton_path() { return skeleton_path; } -AABB MeshInstance::get_aabb() const { +Rect3 MeshInstance::get_aabb() const { if (!mesh.is_null()) return mesh->get_aabb(); - return AABB(); + return Rect3(); } PoolVector<Face3> MeshInstance::get_faces(uint32_t p_usage_flags) const { diff --git a/scene/3d/mesh_instance.h b/scene/3d/mesh_instance.h index 1291d6b12f..4d28cc2942 100644 --- a/scene/3d/mesh_instance.h +++ b/scene/3d/mesh_instance.h @@ -80,7 +80,7 @@ public: Node* create_convex_collision_node(); void create_convex_collision(); - virtual AABB get_aabb() const; + virtual Rect3 get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; MeshInstance(); diff --git a/scene/3d/multimesh_instance.cpp b/scene/3d/multimesh_instance.cpp index a9d1de1cfa..31843fadaa 100644 --- a/scene/3d/multimesh_instance.cpp +++ b/scene/3d/multimesh_instance.cpp @@ -63,10 +63,10 @@ PoolVector<Face3> MultiMeshInstance::get_faces(uint32_t p_usage_flags) const { return PoolVector<Face3>(); } -AABB MultiMeshInstance::get_aabb() const { +Rect3 MultiMeshInstance::get_aabb() const { if (multimesh.is_null()) - return AABB(); + return Rect3(); else return multimesh->get_aabb(); } diff --git a/scene/3d/multimesh_instance.h b/scene/3d/multimesh_instance.h index ef2403a44a..535e4275a3 100644 --- a/scene/3d/multimesh_instance.h +++ b/scene/3d/multimesh_instance.h @@ -54,7 +54,7 @@ public: void set_multimesh(const Ref<MultiMesh>& p_multimesh); Ref<MultiMesh> get_multimesh() const; - virtual AABB get_aabb() const; + virtual Rect3 get_aabb() const; MultiMeshInstance(); ~MultiMeshInstance(); diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index 7ec9085e30..434b400e01 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -219,7 +219,7 @@ void NavigationMesh::_bind_methods() { ClassDB::bind_method(_MD("_set_polygons","polygons"),&NavigationMesh::_set_polygons); ClassDB::bind_method(_MD("_get_polygons"),&NavigationMesh::_get_polygons); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR3_ARRAY,"vertices",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_vertices"),_SCS("get_vertices")); + ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY,"vertices",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_vertices"),_SCS("get_vertices")); ADD_PROPERTY(PropertyInfo(Variant::ARRAY,"polygons",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_polygons"),_SCS("_get_polygons")); } diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index 98a81fc150..5e8ded3867 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -137,7 +137,7 @@ void PathFollow::_update_transform() { float tilt = c->interpolate_baked_tilt(o); if (tilt!=0) { - Matrix3 rot(-n,tilt); //remember.. lookat will be znegative.. znegative!! we abide by opengl clan. + Basis rot(-n,tilt); //remember.. lookat will be znegative.. znegative!! we abide by opengl clan. up=rot.xform(up); } } diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp index e4c03a78ee..054b61a4ed 100644 --- a/scene/3d/portal.cpp +++ b/scene/3d/portal.cpp @@ -88,7 +88,7 @@ bool Portal::_get(const StringName& p_name,Variant &r_ret) const { void Portal::_get_property_list( List<PropertyInfo> *p_list) const { - p_list->push_back( PropertyInfo( Variant::REAL_ARRAY, "shape" ) ); + p_list->push_back( PropertyInfo( Variant::POOL_REAL_ARRAY, "shape" ) ); p_list->push_back( PropertyInfo( Variant::BOOL, "enabled" ) ); p_list->push_back( PropertyInfo( Variant::REAL, "disable_distance",PROPERTY_HINT_RANGE,"0,4096,0.01" ) ); p_list->push_back( PropertyInfo( Variant::COLOR, "disabled_color") ); @@ -98,7 +98,7 @@ void Portal::_get_property_list( List<PropertyInfo> *p_list) const { -AABB Portal::get_aabb() const { +Rect3 Portal::get_aabb() const { return aabb; } diff --git a/scene/3d/portal.h b/scene/3d/portal.h index 8464a628f9..077924c7e8 100644 --- a/scene/3d/portal.h +++ b/scene/3d/portal.h @@ -54,7 +54,7 @@ class Portal : public VisualInstance { Color disabled_color; float connect_range; - AABB aabb; + Rect3 aabb; protected: @@ -67,7 +67,7 @@ protected: public: - virtual AABB get_aabb() const; + virtual Rect3 get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; void set_enabled(bool p_enabled); diff --git a/scene/3d/quad.cpp b/scene/3d/quad.cpp index f1c59860af..d1cef0e851 100644 --- a/scene/3d/quad.cpp +++ b/scene/3d/quad.cpp @@ -66,7 +66,7 @@ void Quad::_update() { pointsw[3][a2]=-s2.y+offset.y; - aabb=AABB(pointsw[0],Vector3()); + aabb=Rect3(pointsw[0],Vector3()); for(int i=1;i<4;i++) aabb.expand_to(pointsw[i]); @@ -192,7 +192,7 @@ PoolVector<Face3> Quad::get_faces(uint32_t p_usage_flags) const { return PoolVector<Face3>(); } -AABB Quad::get_aabb() const { +Rect3 Quad::get_aabb() const { return aabb; } diff --git a/scene/3d/quad.h b/scene/3d/quad.h index 94b438c548..af91d7a1f5 100644 --- a/scene/3d/quad.h +++ b/scene/3d/quad.h @@ -42,7 +42,7 @@ class Quad : public GeometryInstance { Vector2 offset; Vector2 size; - AABB aabb; + Rect3 aabb; bool configured; bool pending_update; RID mesh; @@ -68,7 +68,7 @@ public: bool is_centered() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; - virtual AABB get_aabb() const; + virtual Rect3 get_aabb() const; Quad(); ~Quad(); diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp index fe56560483..d9592d9484 100644 --- a/scene/3d/reflection_probe.cpp +++ b/scene/3d/reflection_probe.cpp @@ -162,9 +162,9 @@ ReflectionProbe::UpdateMode ReflectionProbe::get_update_mode() const { } -AABB ReflectionProbe::get_aabb() const { +Rect3 ReflectionProbe::get_aabb() const { - AABB aabb; + Rect3 aabb; aabb.pos=-origin_offset; aabb.size=origin_offset+extents; return aabb; diff --git a/scene/3d/reflection_probe.h b/scene/3d/reflection_probe.h index 789e5837b0..410f590431 100644 --- a/scene/3d/reflection_probe.h +++ b/scene/3d/reflection_probe.h @@ -77,7 +77,7 @@ public: void set_update_mode(UpdateMode p_mode); UpdateMode get_update_mode() const; - virtual AABB get_aabb() const; + virtual Rect3 get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index 137a16490d..0b19aaf151 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -78,12 +78,12 @@ void Room::_notification(int p_what) { -AABB Room::get_aabb() const { +Rect3 Room::get_aabb() const { if (room.is_null()) - return AABB(); + return Rect3(); - return AABB(); + return Rect3(); } PoolVector<Face3> Room::get_faces(uint32_t p_usage_flags) const { diff --git a/scene/3d/room_instance.h b/scene/3d/room_instance.h index 8cdc908ceb..145589a780 100644 --- a/scene/3d/room_instance.h +++ b/scene/3d/room_instance.h @@ -82,7 +82,7 @@ public: NOTIFICATION_AREA_CHANGED=60 }; - virtual AABB get_aabb() const; + virtual Rect3 get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; void set_room( const Ref<RoomBounds>& p_room ); diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 50f9e45019..60580911da 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -83,7 +83,7 @@ void Spatial::_notify_dirty() { void Spatial::_update_local_transform() const { - data.local_transform.basis = Matrix3(); + data.local_transform.basis = Basis(); data.local_transform.basis.scale(data.scale); data.local_transform.basis.rotate(data.rotation); @@ -682,7 +682,7 @@ void Spatial::scale(const Vector3& p_ratio){ } void Spatial::global_rotate(const Vector3& p_normal,float p_radians){ - Matrix3 rotation(p_normal,p_radians); + Basis rotation(p_normal,p_radians); Transform t = get_global_transform(); t.basis= rotation * t.basis; set_global_transform(t); diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 52ae8fc5ab..a2a96d7d0e 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -207,7 +207,7 @@ void SpriteBase3D::_queue_update(){ } -AABB SpriteBase3D::get_aabb() const { +Rect3 SpriteBase3D::get_aabb() const { return aabb; } @@ -445,7 +445,7 @@ void Sprite3D::_draw() { } } - AABB aabb; + Rect3 aabb; for(int i=0;i<4;i++) { VS::get_singleton()->immediate_normal(immediate,normal); @@ -961,7 +961,7 @@ void AnimatedSprite3D::_draw() { } } - AABB aabb; + Rect3 aabb; for(int i=0;i<4;i++) { VS::get_singleton()->immediate_normal(immediate,normal); diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h index f82a391038..f5d3957370 100644 --- a/scene/3d/sprite_3d.h +++ b/scene/3d/sprite_3d.h @@ -73,7 +73,7 @@ private: Vector3::Axis axis; float pixel_size; - AABB aabb; + Rect3 aabb; RID immediate; @@ -91,7 +91,7 @@ protected: void _notification(int p_what); static void _bind_methods(); virtual void _draw()=0; - _FORCE_INLINE_ void set_aabb(const AABB& p_aabb) { aabb=p_aabb; } + _FORCE_INLINE_ void set_aabb(const Rect3& p_aabb) { aabb=p_aabb; } _FORCE_INLINE_ RID& get_immediate() { return immediate; } void _queue_update(); public: @@ -134,7 +134,7 @@ public: virtual Rect2 get_item_rect() const=0; - virtual AABB get_aabb() const; + virtual Rect3 get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; SpriteBase3D(); diff --git a/scene/3d/test_cube.cpp b/scene/3d/test_cube.cpp index c2ebe63e21..c52e596032 100644 --- a/scene/3d/test_cube.cpp +++ b/scene/3d/test_cube.cpp @@ -31,9 +31,9 @@ -AABB TestCube::get_aabb() const { +Rect3 TestCube::get_aabb() const { - return AABB( Vector3(-1,-1,-1), Vector3(2, 2, 2 ) ); + return Rect3( Vector3(-1,-1,-1), Vector3(2, 2, 2 ) ); } PoolVector<Face3> TestCube::get_faces(uint32_t p_usage_flags) const { diff --git a/scene/3d/test_cube.h b/scene/3d/test_cube.h index c62999c34b..4860bacd8d 100644 --- a/scene/3d/test_cube.h +++ b/scene/3d/test_cube.h @@ -46,7 +46,7 @@ class TestCube : public GeometryInstance { public: - virtual AABB get_aabb() const; + virtual Rect3 get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; TestCube(); diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index 0d603902e1..1cb443225c 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -47,8 +47,8 @@ public: btVehicleJacobianEntry() {}; //constraint between two different rigidbodies btVehicleJacobianEntry( - const Matrix3& world2A, - const Matrix3& world2B, + const Basis& world2A, + const Basis& world2B, const Vector3& rel_pos1, const Vector3& rel_pos2, const Vector3& jointAxis, @@ -367,14 +367,14 @@ void VehicleBody::_update_wheel(int p_idx,PhysicsDirectBodyState *s) { real_t steering = wheel.steers?m_steeringValue:0.0; //print_line(itos(p_idx)+": "+rtos(steering)); - Matrix3 steeringMat(up,steering); + Basis steeringMat(up,steering); - Matrix3 rotatingMat(right,-wheel.m_rotation); + Basis rotatingMat(right,-wheel.m_rotation); // if (p_idx==1) // print_line("steeringMat " +steeringMat); - Matrix3 basis2( + Basis basis2( right[0],up[0],fwd[0], right[1],up[1],fwd[1], right[2],up[2],fwd[2] @@ -574,7 +574,7 @@ void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vec Vector3 vel = vel1 - vel2; - Matrix3 b2trans; + Basis b2trans; float b2invmass=0; Vector3 b2lv; Vector3 b2av; @@ -728,7 +728,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) { //const btTransform& wheelTrans = getWheelTransformWS( i ); - Matrix3 wheelBasis0 = wheelInfo.m_worldTransform.basis;//get_global_transform().basis; + Basis wheelBasis0 = wheelInfo.m_worldTransform.basis;//get_global_transform().basis; m_axle[i] = wheelBasis0.get_axis(Vector3::AXIS_X); //m_axle[i] = wheelInfo.m_raycastInfo.m_wheelAxleWS; diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index 508e24497f..0d9d2ad725 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -60,7 +60,7 @@ void VisibilityNotifier::_exit_camera(Camera* p_camera){ } -void VisibilityNotifier::set_aabb(const AABB& p_aabb){ +void VisibilityNotifier::set_aabb(const Rect3& p_aabb){ if (aabb==p_aabb) return; @@ -74,7 +74,7 @@ void VisibilityNotifier::set_aabb(const AABB& p_aabb){ update_gizmo(); } -AABB VisibilityNotifier::get_aabb() const{ +Rect3 VisibilityNotifier::get_aabb() const{ return aabb; } @@ -113,7 +113,7 @@ void VisibilityNotifier::_bind_methods(){ ClassDB::bind_method(_MD("get_aabb"),&VisibilityNotifier::get_aabb); ClassDB::bind_method(_MD("is_on_screen"),&VisibilityNotifier::is_on_screen); - ADD_PROPERTY( PropertyInfo(Variant::_AABB,"aabb"),_SCS("set_aabb"),_SCS("get_aabb")); + ADD_PROPERTY( PropertyInfo(Variant::RECT3,"aabb"),_SCS("set_aabb"),_SCS("get_aabb")); ADD_SIGNAL( MethodInfo("enter_camera",PropertyInfo(Variant::OBJECT,"camera",PROPERTY_HINT_RESOURCE_TYPE,"Camera")) ); ADD_SIGNAL( MethodInfo("exit_camera",PropertyInfo(Variant::OBJECT,"camera",PROPERTY_HINT_RESOURCE_TYPE,"Camera")) ); @@ -124,7 +124,7 @@ void VisibilityNotifier::_bind_methods(){ VisibilityNotifier::VisibilityNotifier() { - aabb=AABB(Vector3(-1,-1,-1),Vector3(2,2,2)); + aabb=Rect3(Vector3(-1,-1,-1),Vector3(2,2,2)); } diff --git a/scene/3d/visibility_notifier.h b/scene/3d/visibility_notifier.h index ca01a9ec18..aa53e1bcd1 100644 --- a/scene/3d/visibility_notifier.h +++ b/scene/3d/visibility_notifier.h @@ -38,7 +38,7 @@ class VisibilityNotifier : public Spatial { Set<Camera*> cameras; - AABB aabb; + Rect3 aabb; protected: @@ -54,8 +54,8 @@ friend class SpatialIndexer; public: - void set_aabb(const AABB& p_aabb); - AABB get_aabb() const; + void set_aabb(const Rect3& p_aabb); + Rect3 get_aabb() const; bool is_on_screen() const; VisibilityNotifier(); diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 812fb93dd1..466c273154 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -33,7 +33,7 @@ #include "scene/scene_string_names.h" #include "skeleton.h" -AABB VisualInstance::get_transformed_aabb() const { +Rect3 VisualInstance::get_transformed_aabb() const { return get_global_transform().xform( get_aabb() ); } diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h index f59ec3a7e6..5955dae236 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -65,10 +65,10 @@ public: }; RID get_instance() const; - virtual AABB get_aabb() const=0; + virtual Rect3 get_aabb() const=0; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const=0; - virtual AABB get_transformed_aabb() const; // helper + virtual Rect3 get_transformed_aabb() const; // helper void set_base(const RID& p_base); diff --git a/scene/animation/animation_cache.cpp b/scene/animation/animation_cache.cpp index b9ed08326d..4ab6e2e575 100644 --- a/scene/animation/animation_cache.cpp +++ b/scene/animation/animation_cache.cpp @@ -292,7 +292,7 @@ void AnimationCache::set_all(float p_time, float p_delta) { Vector3 loc,scale; Quat rot; animation->transform_track_interpolate(i,p_time,&loc,&rot,&scale); - Transform tr( Matrix3(rot), loc ); + Transform tr( Basis(rot), loc ); tr.basis.scale(scale); set_track_transform(i,tr); diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 5bc9a81c85..d2b95c78e6 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -383,11 +383,11 @@ Variant Tween::_run_equation(InterpolateData& p_data) { } break; - case Variant::MATRIX3: + case Variant::BASIS: { - Matrix3 i = initial_val; - Matrix3 d = delta_val; - Matrix3 r; + Basis i = initial_val; + Basis d = delta_val; + Basis r; APPLY_EQUATION(elements[0][0]); APPLY_EQUATION(elements[0][1]); @@ -403,11 +403,11 @@ Variant Tween::_run_equation(InterpolateData& p_data) { } break; - case Variant::MATRIX32: + case Variant::TRANSFORM2D: { - Matrix3 i = initial_val; - Matrix3 d = delta_val; - Matrix3 r; + Basis i = initial_val; + Basis d = delta_val; + Basis r; APPLY_EQUATION(elements[0][0]); APPLY_EQUATION(elements[0][1]); @@ -433,11 +433,11 @@ Variant Tween::_run_equation(InterpolateData& p_data) { result = r; } break; - case Variant::_AABB: + case Variant::RECT3: { - AABB i = initial_val; - AABB d = delta_val; - AABB r; + Rect3 i = initial_val; + Rect3 d = delta_val; + Rect3 r; APPLY_EQUATION(pos.x); APPLY_EQUATION(pos.y); @@ -953,11 +953,11 @@ bool Tween::_calc_delta_val(const Variant& p_initial_val, const Variant& p_final delta_val = final_val.operator Vector3() - initial_val.operator Vector3(); break; - case Variant::MATRIX3: + case Variant::BASIS: { - Matrix3 i = initial_val; - Matrix3 f = final_val; - delta_val = Matrix3(f.elements[0][0] - i.elements[0][0], + Basis i = initial_val; + Basis f = final_val; + delta_val = Basis(f.elements[0][0] - i.elements[0][0], f.elements[0][1] - i.elements[0][1], f.elements[0][2] - i.elements[0][2], f.elements[1][0] - i.elements[1][0], @@ -970,11 +970,11 @@ bool Tween::_calc_delta_val(const Variant& p_initial_val, const Variant& p_final } break; - case Variant::MATRIX32: + case Variant::TRANSFORM2D: { - Matrix32 i = initial_val; - Matrix32 f = final_val; - Matrix32 d = Matrix32(); + Transform2D i = initial_val; + Transform2D f = final_val; + Transform2D d = Transform2D(); d[0][0] = f.elements[0][0] - i.elements[0][0]; d[0][1] = f.elements[0][1] - i.elements[0][1]; d[1][0] = f.elements[1][0] - i.elements[1][0]; @@ -987,11 +987,11 @@ bool Tween::_calc_delta_val(const Variant& p_initial_val, const Variant& p_final case Variant::QUAT: delta_val = final_val.operator Quat() - initial_val.operator Quat(); break; - case Variant::_AABB: + case Variant::RECT3: { - AABB i = initial_val; - AABB f = final_val; - delta_val = AABB(f.pos - i.pos, f.size - i.size); + Rect3 i = initial_val; + Rect3 f = final_val; + delta_val = Rect3(f.pos - i.pos, f.size - i.size); } break; case Variant::TRANSFORM: diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index a4b07d9a13..b3d86f85ea 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -96,7 +96,7 @@ Size2 Control::edit_get_minimum_size() const { void Control::edit_set_rect(const Rect2& p_edit_rect) { - Matrix32 postxf; + Transform2D postxf; postxf.set_rotation_and_scale(data.rotation,data.scale); Vector2 new_pos = postxf.xform(p_edit_rect.pos); @@ -374,7 +374,7 @@ void Control::remove_child_notify(Node *p_child) { void Control::_update_canvas_item_transform() { - Matrix32 xform=Matrix32(data.rotation,get_pos()); + Transform2D xform=Transform2D(data.rotation,get_pos()); xform.scale_basis(data.scale); VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(),xform); @@ -1382,7 +1382,7 @@ Point2 Control::get_global_pos() const { void Control::set_global_pos(const Point2& p_point) { - Matrix32 inv; + Transform2D inv; if (data.parent_canvas_item) { @@ -1918,9 +1918,9 @@ Control::CursorShape Control::get_cursor_shape(const Point2& p_pos) const { return data.default_cursor; } -Matrix32 Control::get_transform() const { +Transform2D Control::get_transform() const { - Matrix32 xform=Matrix32(data.rotation,get_pos()); + Transform2D xform=Transform2D(data.rotation,get_pos()); xform.scale_basis(data.scale); return xform; } @@ -1981,7 +1981,7 @@ Control *Control::_get_focus_neighbour(Margin p_margin,int p_count) { Point2 points[4]; - Matrix32 xform = get_global_transform(); + Transform2D xform = get_global_transform(); Rect2 rect = get_item_rect(); points[0]=xform.xform(rect.pos); @@ -2041,7 +2041,7 @@ void Control::_window_find_focus_neighbour(const Vector2& p_dir, Node *p_at,cons Point2 points[4]; - Matrix32 xform = c->get_global_transform(); + Transform2D xform = c->get_global_transform(); Rect2 rect = c->get_item_rect(); points[0]=xform.xform(rect.pos); diff --git a/scene/gui/control.h b/scene/gui/control.h index 709f19f3f2..68795b054c 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -168,7 +168,7 @@ private: } data; // used internally - Control* _find_control_at_pos(CanvasItem* p_node,const Point2& p_pos,const Matrix32& p_xform,Matrix32& r_inv_xform); + Control* _find_control_at_pos(CanvasItem* p_node,const Point2& p_pos,const Transform2D& p_xform,Transform2D& r_inv_xform); void _window_find_focus_neighbour(const Vector2& p_dir, Node *p_at, const Point2* p_points ,float p_min,float &r_closest_dist,Control **r_closest); @@ -389,7 +389,7 @@ public: virtual CursorShape get_cursor_shape(const Point2& p_pos=Point2i()) const; virtual Rect2 get_item_rect() const; - virtual Matrix32 get_transform() const; + virtual Transform2D get_transform() const; bool is_toplevel_control() const; diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index df08c7ea56..1cd04551c5 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -723,7 +723,7 @@ void FileDialog::_bind_methods() { ClassDB::bind_method(_MD("invalidate"),&FileDialog::invalidate); ADD_SIGNAL(MethodInfo("file_selected",PropertyInfo( Variant::STRING,"path"))); - ADD_SIGNAL(MethodInfo("files_selected",PropertyInfo( Variant::STRING_ARRAY,"paths"))); + ADD_SIGNAL(MethodInfo("files_selected",PropertyInfo( Variant::POOL_STRING_ARRAY,"paths"))); ADD_SIGNAL(MethodInfo("dir_selected",PropertyInfo( Variant::STRING,"dir"))); BIND_CONSTANT( MODE_OPEN_FILE ); @@ -739,7 +739,7 @@ void FileDialog::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"),_SCS("set_mode"),_SCS("get_mode") ); ADD_PROPERTY( PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"),_SCS("set_access"),_SCS("get_access") ); - ADD_PROPERTY( PropertyInfo(Variant::STRING_ARRAY, "filters"),_SCS("set_filters"),_SCS("get_filters") ); + ADD_PROPERTY( PropertyInfo(Variant::POOL_STRING_ARRAY, "filters"),_SCS("set_filters"),_SCS("get_filters") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL, "show_hidden_files"),_SCS("set_show_hidden_files"),_SCS("is_showing_hidden_files") ); } diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index c5fdcddf15..2e2e1d6c80 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -43,7 +43,7 @@ int CanvasLayer::get_layer() const{ return layer; } -void CanvasLayer::set_transform(const Matrix32& p_xform) { +void CanvasLayer::set_transform(const Transform2D& p_xform) { transform=p_xform; locrotscale_dirty=true; @@ -52,7 +52,7 @@ void CanvasLayer::set_transform(const Matrix32& p_xform) { } -Matrix32 CanvasLayer::get_transform() const { +Transform2D CanvasLayer::get_transform() const { return transform; } diff --git a/scene/main/canvas_layer.h b/scene/main/canvas_layer.h index ea05fd7e1f..8efbbd5a05 100644 --- a/scene/main/canvas_layer.h +++ b/scene/main/canvas_layer.h @@ -43,7 +43,7 @@ class CanvasLayer : public Node { Size2 scale; real_t rot; int layer; - Matrix32 transform; + Transform2D transform; Ref<World2D> canvas; ObjectID custom_viewport_id; // to check validity @@ -71,8 +71,8 @@ public: void set_layer(int p_xform); int get_layer() const; - void set_transform(const Matrix32& p_xform); - Matrix32 get_transform() const; + void set_transform(const Transform2D& p_xform); + Transform2D get_transform() const; void set_offset(const Vector2& p_offset); Vector2 get_offset() const; diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 848be375ca..25180b568f 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -150,7 +150,7 @@ Error HTTPRequest::request(const String& p_url, const Vector<String>& p_custom_h client->set_blocking_mode(false); err = _request(); if (err!=OK) { - call_deferred("_request_done",RESULT_CANT_CONNECT,0,StringArray(),ByteArray()); + call_deferred("_request_done",RESULT_CANT_CONNECT,0,PoolStringArray(),PoolByteArray()); return ERR_CANT_CONNECT; } @@ -170,7 +170,7 @@ void HTTPRequest::_thread_func(void *p_userdata) { Error err = hr->_request(); if (err!=OK) { - hr->call_deferred("_request_done",RESULT_CANT_CONNECT,0,StringArray(),ByteArray()); + hr->call_deferred("_request_done",RESULT_CANT_CONNECT,0,PoolStringArray(),PoolByteArray()); } else { while(!hr->thread_request_quit) { @@ -216,7 +216,7 @@ void HTTPRequest::cancel_request() { bool HTTPRequest::_handle_response(bool *ret_value) { if (!client->has_response()) { - call_deferred("_request_done",RESULT_NO_RESPONSE,0,StringArray(),ByteArray()); + call_deferred("_request_done",RESULT_NO_RESPONSE,0,PoolStringArray(),PoolByteArray()); *ret_value=true; return true; } @@ -236,7 +236,7 @@ bool HTTPRequest::_handle_response(bool *ret_value) { //redirect if (max_redirects>=0 && redirections>=max_redirects) { - call_deferred("_request_done",RESULT_REDIRECT_LIMIT_REACHED,response_code,response_headers,ByteArray()); + call_deferred("_request_done",RESULT_REDIRECT_LIMIT_REACHED,response_code,response_headers,PoolByteArray()); *ret_value=true; return true; } @@ -288,7 +288,7 @@ bool HTTPRequest::_update_connection() { switch( client->get_status() ) { case HTTPClient::STATUS_DISCONNECTED: { - call_deferred("_request_done",RESULT_CANT_CONNECT,0,StringArray(),ByteArray()); + call_deferred("_request_done",RESULT_CANT_CONNECT,0,PoolStringArray(),PoolByteArray()); return true; //end it, since it's doing something } break; case HTTPClient::STATUS_RESOLVING: { @@ -297,7 +297,7 @@ bool HTTPRequest::_update_connection() { return false; } break; case HTTPClient::STATUS_CANT_RESOLVE: { - call_deferred("_request_done",RESULT_CANT_RESOLVE,0,StringArray(),ByteArray()); + call_deferred("_request_done",RESULT_CANT_RESOLVE,0,PoolStringArray(),PoolByteArray()); return true; } break; @@ -308,7 +308,7 @@ bool HTTPRequest::_update_connection() { } break; //connecting to ip case HTTPClient::STATUS_CANT_CONNECT: { - call_deferred("_request_done",RESULT_CANT_CONNECT,0,StringArray(),ByteArray()); + call_deferred("_request_done",RESULT_CANT_CONNECT,0,PoolStringArray(),PoolByteArray()); return true; } break; @@ -326,7 +326,7 @@ bool HTTPRequest::_update_connection() { return ret_value; - call_deferred("_request_done",RESULT_SUCCESS,response_code,response_headers,ByteArray()); + call_deferred("_request_done",RESULT_SUCCESS,response_code,response_headers,PoolByteArray()); return true; } if (got_response && body_len<0) { @@ -336,7 +336,7 @@ bool HTTPRequest::_update_connection() { } - call_deferred("_request_done",RESULT_CHUNKED_BODY_SIZE_MISMATCH,response_code,response_headers,ByteArray()); + call_deferred("_request_done",RESULT_CHUNKED_BODY_SIZE_MISMATCH,response_code,response_headers,PoolByteArray()); return true; //request migh have been done } else { @@ -344,7 +344,7 @@ bool HTTPRequest::_update_connection() { Error err = client->request(method,request_string,headers,request_data); if (err!=OK) { - call_deferred("_request_done",RESULT_CONNECTION_ERROR,0,StringArray(),ByteArray()); + call_deferred("_request_done",RESULT_CONNECTION_ERROR,0,PoolStringArray(),PoolByteArray()); return true; } @@ -370,7 +370,7 @@ bool HTTPRequest::_update_connection() { if (!client->is_response_chunked() && client->get_response_body_length()==0) { - call_deferred("_request_done",RESULT_SUCCESS,response_code,response_headers,ByteArray()); + call_deferred("_request_done",RESULT_SUCCESS,response_code,response_headers,PoolByteArray()); return true; } @@ -381,7 +381,7 @@ bool HTTPRequest::_update_connection() { body_len=client->get_response_body_length(); if (body_size_limit>=0 && body_len>body_size_limit) { - call_deferred("_request_done",RESULT_BODY_SIZE_LIMIT_EXCEEDED,response_code,response_headers,ByteArray()); + call_deferred("_request_done",RESULT_BODY_SIZE_LIMIT_EXCEEDED,response_code,response_headers,PoolByteArray()); return true; } } @@ -390,7 +390,7 @@ bool HTTPRequest::_update_connection() { file=FileAccess::open(download_to_file,FileAccess::WRITE); if (!file) { - call_deferred("_request_done",RESULT_DOWNLOAD_FILE_CANT_OPEN,response_code,response_headers,ByteArray()); + call_deferred("_request_done",RESULT_DOWNLOAD_FILE_CANT_OPEN,response_code,response_headers,PoolByteArray()); return true; } } @@ -400,14 +400,14 @@ bool HTTPRequest::_update_connection() { //print_line("BODY: "+itos(body.size())); client->poll(); - ByteArray chunk = client->read_response_body_chunk(); + PoolByteArray chunk = client->read_response_body_chunk(); downloaded+=chunk.size(); if (file) { - ByteArray::Read r=chunk.read(); + PoolByteArray::Read r=chunk.read(); file->store_buffer(r.ptr(),chunk.size()); if (file->get_error()!=OK) { - call_deferred("_request_done",RESULT_DOWNLOAD_FILE_WRITE_ERROR,response_code,response_headers,ByteArray()); + call_deferred("_request_done",RESULT_DOWNLOAD_FILE_WRITE_ERROR,response_code,response_headers,PoolByteArray()); return true; } } else { @@ -415,7 +415,7 @@ bool HTTPRequest::_update_connection() { } if (body_size_limit>=0 && downloaded>body_size_limit) { - call_deferred("_request_done",RESULT_BODY_SIZE_LIMIT_EXCEEDED,response_code,response_headers,ByteArray()); + call_deferred("_request_done",RESULT_BODY_SIZE_LIMIT_EXCEEDED,response_code,response_headers,PoolByteArray()); return true; } @@ -435,11 +435,11 @@ bool HTTPRequest::_update_connection() { } break; // request resulted in body: { } break which must be read case HTTPClient::STATUS_CONNECTION_ERROR: { - call_deferred("_request_done",RESULT_CONNECTION_ERROR,0,StringArray(),ByteArray()); + call_deferred("_request_done",RESULT_CONNECTION_ERROR,0,PoolStringArray(),PoolByteArray()); return true; } break; case HTTPClient::STATUS_SSL_HANDSHAKE_ERROR: { - call_deferred("_request_done",RESULT_SSL_HANDSHAKE_ERROR,0,StringArray(),ByteArray()); + call_deferred("_request_done",RESULT_SSL_HANDSHAKE_ERROR,0,PoolStringArray(),PoolByteArray()); return true; } break; @@ -449,7 +449,7 @@ bool HTTPRequest::_update_connection() { } -void HTTPRequest::_request_done(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data) { +void HTTPRequest::_request_done(int p_status, int p_code, const PoolStringArray& headers, const PoolByteArray& p_data) { cancel_request(); @@ -540,7 +540,7 @@ int HTTPRequest::get_body_size() const{ void HTTPRequest::_bind_methods() { ClassDB::bind_method(_MD("set_ip_type","ip_type"),&HTTPRequest::set_ip_type); - ClassDB::bind_method(_MD("request","url","custom_headers","ssl_validate_domain","method","request_data"),&HTTPRequest::request,DEFVAL(StringArray()),DEFVAL(true),DEFVAL(HTTPClient::METHOD_GET),DEFVAL(String())); + ClassDB::bind_method(_MD("request","url","custom_headers","ssl_validate_domain","method","request_data"),&HTTPRequest::request,DEFVAL(PoolStringArray()),DEFVAL(true),DEFVAL(HTTPClient::METHOD_GET),DEFVAL(String())); ClassDB::bind_method(_MD("cancel_request"),&HTTPRequest::cancel_request); ClassDB::bind_method(_MD("get_http_client_status"),&HTTPRequest::get_http_client_status); @@ -567,7 +567,7 @@ void HTTPRequest::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT,"body_size_limit",PROPERTY_HINT_RANGE,"-1,2000000000"),_SCS("set_body_size_limit"),_SCS("get_body_size_limit")); ADD_PROPERTY(PropertyInfo(Variant::INT,"max_redirects",PROPERTY_HINT_RANGE,"-1,1024"),_SCS("set_max_redirects"),_SCS("get_max_redirects")); - ADD_SIGNAL(MethodInfo("request_completed",PropertyInfo(Variant::INT,"result"),PropertyInfo(Variant::INT,"response_code"),PropertyInfo(Variant::STRING_ARRAY,"headers"),PropertyInfo(Variant::RAW_ARRAY,"body"))); + ADD_SIGNAL(MethodInfo("request_completed",PropertyInfo(Variant::INT,"result"),PropertyInfo(Variant::INT,"response_code"),PropertyInfo(Variant::POOL_STRING_ARRAY,"headers"),PropertyInfo(Variant::POOL_BYTE_ARRAY,"body"))); BIND_CONSTANT( RESULT_SUCCESS ); //BIND_CONSTANT( RESULT_NO_BODY ); diff --git a/scene/main/http_request.h b/scene/main/http_request.h index 59be980077..51c5ddeb69 100644 --- a/scene/main/http_request.h +++ b/scene/main/http_request.h @@ -71,7 +71,7 @@ private: bool request_sent; Ref<HTTPClient> client; - ByteArray body; + PoolByteArray body; volatile bool use_threads; bool got_response; @@ -107,7 +107,7 @@ private: Thread *thread; - void _request_done(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data); + void _request_done(int p_status, int p_code, const PoolStringArray& headers, const PoolByteArray& p_data); static void _thread_func(void *p_userdata); protected: diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp index 289adc3c53..5d1b0495c0 100644 --- a/scene/main/instance_placeholder.cpp +++ b/scene/main/instance_placeholder.cpp @@ -106,7 +106,7 @@ void InstancePlaceholder::replace_by_instance(const Ref<PackedScene> &p_custom_s Dictionary InstancePlaceholder::get_stored_values(bool p_with_order) { Dictionary ret; - StringArray order; + PoolStringArray order; for(List<PropSet>::Element *E=stored_values.front();E;E=E->next()) { ret[E->get().name] = E->get().value; diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index 5cb60d25d9..487b740c34 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -2245,7 +2245,7 @@ void SceneTree::_bind_methods() { ADD_SIGNAL( MethodInfo("idle_frame")); ADD_SIGNAL( MethodInfo("fixed_frame")); - ADD_SIGNAL( MethodInfo("files_dropped",PropertyInfo(Variant::STRING_ARRAY,"files"),PropertyInfo(Variant::INT,"screen")) ); + ADD_SIGNAL( MethodInfo("files_dropped",PropertyInfo(Variant::POOL_STRING_ARRAY,"files"),PropertyInfo(Variant::INT,"screen")) ); ADD_SIGNAL( MethodInfo("network_peer_connected",PropertyInfo(Variant::INT,"id"))); ADD_SIGNAL( MethodInfo("network_peer_disconnected",PropertyInfo(Variant::INT,"id"))); ADD_SIGNAL( MethodInfo("connected_to_server")); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index bd80f97c22..fe363d97f7 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -203,7 +203,7 @@ void Viewport::_update_stretch_transform() { //print_line("sive override size "+size_override_size); //print_line("rect size "+size); - stretch_transform=Matrix32(); + stretch_transform=Transform2D(); Size2 scale = size/(size_override_size+size_override_margin*2); stretch_transform.scale(scale); stretch_transform.elements[2]=size_override_margin*scale; @@ -212,7 +212,7 @@ void Viewport::_update_stretch_transform() { } else { - stretch_transform=Matrix32(); + stretch_transform=Transform2D(); } _update_global_transform(); @@ -833,14 +833,14 @@ bool Viewport::is_audio_listener_2d() const { return audio_listener_2d; } -void Viewport::set_canvas_transform(const Matrix32& p_transform) { +void Viewport::set_canvas_transform(const Transform2D& p_transform) { canvas_transform=p_transform; VisualServer::get_singleton()->viewport_set_canvas_transform(viewport,find_world_2d()->get_canvas(),canvas_transform); - Matrix32 xform = (global_canvas_transform * canvas_transform).affine_inverse(); + Transform2D xform = (global_canvas_transform * canvas_transform).affine_inverse(); Size2 ss = get_visible_rect().size; - SpatialSound2DServer::get_singleton()->listener_set_transform(internal_listener_2d, Matrix32(0, xform.xform(ss*0.5))); + SpatialSound2DServer::get_singleton()->listener_set_transform(internal_listener_2d, Transform2D(0, xform.xform(ss*0.5))); Vector2 ss2 = ss*xform.get_scale(); float panrange = MAX(ss2.x,ss2.y); @@ -849,7 +849,7 @@ void Viewport::set_canvas_transform(const Matrix32& p_transform) { } -Matrix32 Viewport::get_canvas_transform() const{ +Transform2D Viewport::get_canvas_transform() const{ return canvas_transform; } @@ -859,13 +859,13 @@ Matrix32 Viewport::get_canvas_transform() const{ void Viewport::_update_global_transform() { - Matrix32 sxform = stretch_transform * global_canvas_transform; + Transform2D sxform = stretch_transform * global_canvas_transform; VisualServer::get_singleton()->viewport_set_global_canvas_transform(viewport,sxform); - Matrix32 xform = (sxform * canvas_transform).affine_inverse(); + Transform2D xform = (sxform * canvas_transform).affine_inverse(); Size2 ss = get_visible_rect().size; - SpatialSound2DServer::get_singleton()->listener_set_transform(internal_listener_2d, Matrix32(0, xform.xform(ss*0.5))); + SpatialSound2DServer::get_singleton()->listener_set_transform(internal_listener_2d, Transform2D(0, xform.xform(ss*0.5))); Vector2 ss2 = ss*xform.get_scale(); float panrange = MAX(ss2.x,ss2.y); @@ -874,7 +874,7 @@ void Viewport::_update_global_transform() { } -void Viewport::set_global_canvas_transform(const Matrix32& p_transform) { +void Viewport::set_global_canvas_transform(const Transform2D& p_transform) { global_canvas_transform=p_transform; @@ -883,7 +883,7 @@ void Viewport::set_global_canvas_transform(const Matrix32& p_transform) { } -Matrix32 Viewport::get_global_canvas_transform() const{ +Transform2D Viewport::get_global_canvas_transform() const{ return global_canvas_transform; } @@ -1205,7 +1205,7 @@ Camera* Viewport::get_camera() const { } -Matrix32 Viewport::get_final_transform() const { +Transform2D Viewport::get_final_transform() const { return stretch_transform * global_canvas_transform; } @@ -1383,9 +1383,9 @@ void Viewport::clear() { } -Matrix32 Viewport::_get_input_pre_xform() const { +Transform2D Viewport::_get_input_pre_xform() const { - Matrix32 pre_xf; + Transform2D pre_xf; if (to_screen_rect!=Rect2()) { @@ -1415,7 +1415,7 @@ void Viewport::_make_input_local(InputEvent& ev) { Vector2 vp_ofs = _get_window_offset(); - Matrix32 ai = get_final_transform().affine_inverse() * _get_input_pre_xform(); + Transform2D ai = get_final_transform().affine_inverse() * _get_input_pre_xform(); Vector2 g = ai.xform(Vector2(ev.mouse_button.global_x,ev.mouse_button.global_y)); Vector2 l = ai.xform(Vector2(ev.mouse_button.x,ev.mouse_button.y)-vp_ofs); @@ -1430,7 +1430,7 @@ void Viewport::_make_input_local(InputEvent& ev) { Vector2 vp_ofs = _get_window_offset(); - Matrix32 ai = get_final_transform().affine_inverse() * _get_input_pre_xform(); + Transform2D ai = get_final_transform().affine_inverse() * _get_input_pre_xform(); Vector2 g = ai.xform(Vector2(ev.mouse_motion.global_x,ev.mouse_motion.global_y)); Vector2 l = ai.xform(Vector2(ev.mouse_motion.x,ev.mouse_motion.y)-vp_ofs); Vector2 r = ai.basis_xform(Vector2(ev.mouse_motion.relative_x,ev.mouse_motion.relative_y)); @@ -1451,7 +1451,7 @@ void Viewport::_make_input_local(InputEvent& ev) { Vector2 vp_ofs = _get_window_offset(); - Matrix32 ai = get_final_transform().affine_inverse() * _get_input_pre_xform(); + Transform2D ai = get_final_transform().affine_inverse() * _get_input_pre_xform(); Vector2 t = ai.xform(Vector2(ev.screen_touch.x,ev.screen_touch.y)-vp_ofs); @@ -1463,7 +1463,7 @@ void Viewport::_make_input_local(InputEvent& ev) { Vector2 vp_ofs = _get_window_offset(); - Matrix32 ai = get_final_transform().affine_inverse() * _get_input_pre_xform(); + Transform2D ai = get_final_transform().affine_inverse() * _get_input_pre_xform(); Vector2 t = ai.xform(Vector2(ev.screen_drag.x,ev.screen_drag.y)-vp_ofs); Vector2 r = ai.basis_xform(Vector2(ev.screen_drag.relative_x,ev.screen_drag.relative_y)); Vector2 s = ai.basis_xform(Vector2(ev.screen_drag.speed_x,ev.screen_drag.speed_y)); @@ -1699,7 +1699,7 @@ Control* Viewport::_gui_find_control(const Point2& p_global) { if (!sw->is_visible()) continue; - Matrix32 xform; + Transform2D xform; CanvasItem *pci = sw->get_parent_item(); if (pci) xform=pci->get_global_transform_with_canvas(); @@ -1719,7 +1719,7 @@ Control* Viewport::_gui_find_control(const Point2& p_global) { if (!sw->is_visible()) continue; - Matrix32 xform; + Transform2D xform; CanvasItem *pci = sw->get_parent_item(); if (pci) xform=pci->get_global_transform_with_canvas(); @@ -1737,7 +1737,7 @@ Control* Viewport::_gui_find_control(const Point2& p_global) { } -Control* Viewport::_gui_find_control_at_pos(CanvasItem* p_node,const Point2& p_global,const Matrix32& p_xform,Matrix32& r_inv_xform) { +Control* Viewport::_gui_find_control_at_pos(CanvasItem* p_node,const Point2& p_global,const Transform2D& p_xform,Transform2D& r_inv_xform) { if (p_node->cast_to<Viewport>()) return NULL; @@ -1755,7 +1755,7 @@ Control* Viewport::_gui_find_control_at_pos(CanvasItem* p_node,const Point2& p_g return NULL; //canvas item hidden, discard } - Matrix32 matrix = p_xform * p_node->get_transform(); + Transform2D matrix = p_xform * p_node->get_transform(); // matrix.basis_determinant() == 0.0f implies that node does not exist on scene if(matrix.basis_determinant() == 0.0f) return NULL; @@ -2060,7 +2060,7 @@ void Viewport::_gui_input_event(InputEvent p_event) { } - Matrix32 localizer = over->get_global_transform_with_canvas().affine_inverse(); + Transform2D localizer = over->get_global_transform_with_canvas().affine_inverse(); Size2 pos = localizer.xform(mpos); Vector2 speed = localizer.basis_xform(Point2(p_event.mouse_motion.speed_x,p_event.mouse_motion.speed_y)); Vector2 rel = localizer.basis_xform(Point2(p_event.mouse_motion.relative_x,p_event.mouse_motion.relative_y)); @@ -2587,7 +2587,7 @@ void Viewport::set_physics_object_picking(bool p_enable) { Vector2 Viewport::get_camera_coords(const Vector2 &p_viewport_coords) const { - Matrix32 xf = get_final_transform(); + Transform2D xf = get_final_transform(); return xf.xform(p_viewport_coords); diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 6666565069..1f30044cef 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -137,9 +137,9 @@ friend class ViewportTexture; bool audio_listener_2d; RID internal_listener_2d; - Matrix32 canvas_transform; - Matrix32 global_canvas_transform; - Matrix32 stretch_transform; + Transform2D canvas_transform; + Transform2D global_canvas_transform; + Transform2D stretch_transform; Size2 size; Rect2 to_screen_rect; @@ -232,7 +232,7 @@ friend class ViewportTexture; float tooltip_delay; List<Control*> modal_stack; unsigned int cancelled_input_ID; - Matrix32 focus_inv_xform; + Transform2D focus_inv_xform; bool subwindow_order_dirty; List<Control*> subwindows; bool roots_order_dirty; @@ -250,14 +250,14 @@ friend class ViewportTexture; void _gui_sort_roots(); void _gui_sort_modal_stack(); Control* _gui_find_control(const Point2& p_global); - Control* _gui_find_control_at_pos(CanvasItem* p_node,const Point2& p_global,const Matrix32& p_xform,Matrix32& r_inv_xform); + Control* _gui_find_control_at_pos(CanvasItem* p_node,const Point2& p_global,const Transform2D& p_xform,Transform2D& r_inv_xform); void _gui_input_event(InputEvent p_event); void update_worlds(); - _FORCE_INLINE_ Matrix32 _get_input_pre_xform() const; + _FORCE_INLINE_ Transform2D _get_input_pre_xform() const; void _vp_enter_tree(); void _vp_exit_tree(); @@ -351,13 +351,13 @@ public: Ref<World2D> find_world_2d() const; - void set_canvas_transform(const Matrix32& p_transform); - Matrix32 get_canvas_transform() const; + void set_canvas_transform(const Transform2D& p_transform); + Transform2D get_canvas_transform() const; - void set_global_canvas_transform(const Matrix32& p_transform); - Matrix32 get_global_canvas_transform() const; + void set_global_canvas_transform(const Transform2D& p_transform); + Transform2D get_global_canvas_transform() const; - Matrix32 get_final_transform() const; + Transform2D get_final_transform() const; void set_transparent_background(bool p_enable); bool has_transparent_background() const; diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index c962e1a671..1fbb149bf3 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -1203,14 +1203,14 @@ Variant Animation::_cubic_interpolate( const Variant& p_pre_a,const Variant& p_a return a.cubic_slerp(b,pa,pb,p_c); } break; - case Variant::_AABB: { + case Variant::RECT3: { - AABB a=p_a; - AABB b=p_b; - AABB pa=p_pre_a; - AABB pb=p_post_b; + Rect3 a=p_a; + Rect3 b=p_b; + Rect3 pa=p_pre_a; + Rect3 pb=p_post_b; - return AABB( + return Rect3( a.pos.cubic_interpolate(b.pos,pa.pos,pb.pos,p_c), a.size.cubic_interpolate(b.size,pa.size,pb.size,p_c) ); diff --git a/scene/resources/box_shape.cpp b/scene/resources/box_shape.cpp index fa5b35ca41..87585af862 100644 --- a/scene/resources/box_shape.cpp +++ b/scene/resources/box_shape.cpp @@ -34,7 +34,7 @@ Vector<Vector3> BoxShape::_gen_debug_mesh_lines() { Vector<Vector3> lines; - AABB aabb; + Rect3 aabb; aabb.pos=-get_extents(); aabb.size=aabb.pos*-2; diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp index e794643132..6866750006 100644 --- a/scene/resources/concave_polygon_shape_2d.cpp +++ b/scene/resources/concave_polygon_shape_2d.cpp @@ -85,7 +85,7 @@ void ConcavePolygonShape2D::_bind_methods() { ClassDB::bind_method(_MD("set_segments","segments"),&ConcavePolygonShape2D::set_segments); ClassDB::bind_method(_MD("get_segments"),&ConcavePolygonShape2D::get_segments); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"segments"),_SCS("set_segments"),_SCS("get_segments") ); + ADD_PROPERTY( PropertyInfo(Variant::POOL_VECTOR2_ARRAY,"segments"),_SCS("set_segments"),_SCS("get_segments") ); } diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp index cc3b0c063d..0d3ba238f6 100644 --- a/scene/resources/convex_polygon_shape_2d.cpp +++ b/scene/resources/convex_polygon_shape_2d.cpp @@ -67,7 +67,7 @@ void ConvexPolygonShape2D::_bind_methods() { - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"points"),_SCS("set_points"),_SCS("get_points") ); + ADD_PROPERTY( PropertyInfo(Variant::POOL_VECTOR2_ARRAY,"points"),_SCS("set_points"),_SCS("get_points") ); } diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index 50c546b855..e201cb16ac 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -610,7 +610,7 @@ void Curve2D::_bake() const { pointlist.push_back(lastpos); baked_point_cache.resize(pointlist.size()); - Vector2Array::Write w = baked_point_cache.write(); + PoolVector2Array::Write w = baked_point_cache.write(); int idx=0; @@ -645,7 +645,7 @@ Vector2 Curve2D::interpolate_baked(float p_offset,bool p_cubic) const{ return baked_point_cache.get(0); int bpc=baked_point_cache.size(); - Vector2Array::Read r = baked_point_cache.read(); + PoolVector2Array::Read r = baked_point_cache.read(); if (p_offset<0) return r[0]; @@ -674,7 +674,7 @@ Vector2 Curve2D::interpolate_baked(float p_offset,bool p_cubic) const{ } -Vector2Array Curve2D::get_baked_points() const { +PoolVector2Array Curve2D::get_baked_points() const { if (baked_cache_dirty) _bake(); @@ -700,9 +700,9 @@ Dictionary Curve2D::_get_data() const { Dictionary dc; - Vector2Array d; + PoolVector2Array d; d.resize(points.size()*3); - Vector2Array::Write w = d.write(); + PoolVector2Array::Write w = d.write(); for(int i=0;i<points.size();i++) { @@ -713,7 +713,7 @@ Dictionary Curve2D::_get_data() const { } - w=Vector2Array::Write(); + w=PoolVector2Array::Write(); dc["points"]=d; @@ -724,11 +724,11 @@ void Curve2D::_set_data(const Dictionary& p_data){ ERR_FAIL_COND(!p_data.has("points")); - Vector2Array rp=p_data["points"]; + PoolVector2Array rp=p_data["points"]; int pc = rp.size(); ERR_FAIL_COND(pc%3!=0); points.resize(pc/3); - Vector2Array::Read r = rp.read(); + PoolVector2Array::Read r = rp.read(); for(int i=0;i<points.size();i++) { @@ -742,9 +742,9 @@ void Curve2D::_set_data(const Dictionary& p_data){ } -Vector2Array Curve2D::tesselate(int p_max_stages,float p_tolerance) const { +PoolVector2Array Curve2D::tesselate(int p_max_stages,float p_tolerance) const { - Vector2Array tess; + PoolVector2Array tess; if (points.size()==0) { @@ -764,7 +764,7 @@ Vector2Array Curve2D::tesselate(int p_max_stages,float p_tolerance) const { } tess.resize(pc); - Vector2Array::Write bpw=tess.write(); + PoolVector2Array::Write bpw=tess.write(); bpw[0]=points[0].pos; int pidx=0; @@ -781,7 +781,7 @@ Vector2Array Curve2D::tesselate(int p_max_stages,float p_tolerance) const { } - bpw=Vector2Array::Write (); + bpw=PoolVector2Array::Write (); return tess; @@ -1090,11 +1090,11 @@ void Curve3D::_bake() const { pointlist.push_back(Plane(lastpos,lastilt)); baked_point_cache.resize(pointlist.size()); - Vector3Array::Write w = baked_point_cache.write(); + PoolVector3Array::Write w = baked_point_cache.write(); int idx=0; baked_tilt_cache.resize(pointlist.size()); - RealArray::Write wt = baked_tilt_cache.write(); + PoolRealArray::Write wt = baked_tilt_cache.write(); for(List<Plane>::Element *E=pointlist.front();E;E=E->next()) { @@ -1128,7 +1128,7 @@ Vector3 Curve3D::interpolate_baked(float p_offset,bool p_cubic) const{ return baked_point_cache.get(0); int bpc=baked_point_cache.size(); - Vector3Array::Read r = baked_point_cache.read(); + PoolVector3Array::Read r = baked_point_cache.read(); if (p_offset<0) return r[0]; @@ -1172,7 +1172,7 @@ float Curve3D::interpolate_baked_tilt(float p_offset) const{ return baked_tilt_cache.get(0); int bpc=baked_tilt_cache.size(); - RealArray::Read r = baked_tilt_cache.read(); + PoolRealArray::Read r = baked_tilt_cache.read(); if (p_offset<0) return r[0]; @@ -1196,7 +1196,7 @@ float Curve3D::interpolate_baked_tilt(float p_offset) const{ } -Vector3Array Curve3D::get_baked_points() const { +PoolVector3Array Curve3D::get_baked_points() const { if (baked_cache_dirty) _bake(); @@ -1205,7 +1205,7 @@ Vector3Array Curve3D::get_baked_points() const { } -RealArray Curve3D::get_baked_tilts() const { +PoolRealArray Curve3D::get_baked_tilts() const { if (baked_cache_dirty) _bake(); @@ -1231,12 +1231,12 @@ Dictionary Curve3D::_get_data() const { Dictionary dc; - Vector3Array d; + PoolVector3Array d; d.resize(points.size()*3); - Vector3Array::Write w = d.write(); - RealArray t; + PoolVector3Array::Write w = d.write(); + PoolRealArray t; t.resize(points.size()); - RealArray::Write wt = t.write(); + PoolRealArray::Write wt = t.write(); for(int i=0;i<points.size();i++) { @@ -1247,8 +1247,8 @@ Dictionary Curve3D::_get_data() const { wt[i]=points[i].tilt; } - w=Vector3Array::Write(); - wt=RealArray::Write(); + w=PoolVector3Array::Write(); + wt=PoolRealArray::Write(); dc["points"]=d; dc["tilts"]=t; @@ -1261,13 +1261,13 @@ void Curve3D::_set_data(const Dictionary& p_data){ ERR_FAIL_COND(!p_data.has("points")); ERR_FAIL_COND(!p_data.has("tilts")); - Vector3Array rp=p_data["points"]; + PoolVector3Array rp=p_data["points"]; int pc = rp.size(); ERR_FAIL_COND(pc%3!=0); points.resize(pc/3); - Vector3Array::Read r = rp.read(); - RealArray rtl=p_data["tilts"]; - RealArray::Read rt=rtl.read(); + PoolVector3Array::Read r = rp.read(); + PoolRealArray rtl=p_data["tilts"]; + PoolRealArray::Read rt=rtl.read(); for(int i=0;i<points.size();i++) { @@ -1282,9 +1282,9 @@ void Curve3D::_set_data(const Dictionary& p_data){ } -Vector3Array Curve3D::tesselate(int p_max_stages,float p_tolerance) const { +PoolVector3Array Curve3D::tesselate(int p_max_stages,float p_tolerance) const { - Vector3Array tess; + PoolVector3Array tess; if (points.size()==0) { @@ -1304,7 +1304,7 @@ Vector3Array Curve3D::tesselate(int p_max_stages,float p_tolerance) const { } tess.resize(pc); - Vector3Array::Write bpw=tess.write(); + PoolVector3Array::Write bpw=tess.write(); bpw[0]=points[0].pos; int pidx=0; @@ -1321,7 +1321,7 @@ Vector3Array Curve3D::tesselate(int p_max_stages,float p_tolerance) const { } - bpw=Vector3Array::Write (); + bpw=PoolVector3Array::Write (); return tess; diff --git a/scene/resources/curve.h b/scene/resources/curve.h index 670232c9b2..3362109354 100644 --- a/scene/resources/curve.h +++ b/scene/resources/curve.h @@ -103,7 +103,7 @@ class Curve2D : public Resource { }; mutable bool baked_cache_dirty; - mutable Vector2Array baked_point_cache; + mutable PoolVector2Array baked_point_cache; mutable float baked_max_ofs; @@ -145,9 +145,9 @@ public: float get_baked_length() const; Vector2 interpolate_baked(float p_offset,bool p_cubic=false) const; - Vector2Array get_baked_points() const; //useful for going thru + PoolVector2Array get_baked_points() const; //useful for going thru - Vector2Array tesselate(int p_max_stages=5,float p_tolerance=4) const; //useful for display + PoolVector2Array tesselate(int p_max_stages=5,float p_tolerance=4) const; //useful for display Curve2D(); @@ -179,8 +179,8 @@ class Curve3D : public Resource { }; mutable bool baked_cache_dirty; - mutable Vector3Array baked_point_cache; - mutable RealArray baked_tilt_cache; + mutable PoolVector3Array baked_point_cache; + mutable PoolRealArray baked_tilt_cache; mutable float baked_max_ofs; @@ -225,10 +225,10 @@ public: float get_baked_length() const; Vector3 interpolate_baked(float p_offset,bool p_cubic=false) const; float interpolate_baked_tilt(float p_offset) const; - Vector3Array get_baked_points() const; //useful for going thru - RealArray get_baked_tilts() const; //useful for going thru + PoolVector3Array get_baked_points() const; //useful for going thru + PoolRealArray get_baked_tilts() const; //useful for going thru - Vector3Array tesselate(int p_max_stages=5,float p_tolerance=4) const; //useful for display + PoolVector3Array tesselate(int p_max_stages=5,float p_tolerance=4) const; //useful for display Curve3D(); diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 0464a64031..3373478336 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -599,8 +599,8 @@ void BitmapFont::_bind_methods() { ClassDB::bind_method(_MD("get_fallback"),&BitmapFont::get_fallback); ADD_PROPERTY( PropertyInfo( Variant::ARRAY, "textures", PROPERTY_HINT_NONE,"", PROPERTY_USAGE_NOEDITOR ), _SCS("_set_textures"), _SCS("_get_textures") ); - ADD_PROPERTY( PropertyInfo( Variant::INT_ARRAY, "chars", PROPERTY_HINT_NONE,"", PROPERTY_USAGE_NOEDITOR ), _SCS("_set_chars"), _SCS("_get_chars") ); - ADD_PROPERTY( PropertyInfo( Variant::INT_ARRAY, "kernings", PROPERTY_HINT_NONE,"", PROPERTY_USAGE_NOEDITOR ), _SCS("_set_kernings"), _SCS("_get_kernings") ); + ADD_PROPERTY( PropertyInfo( Variant::POOL_INT_ARRAY, "chars", PROPERTY_HINT_NONE,"", PROPERTY_USAGE_NOEDITOR ), _SCS("_set_chars"), _SCS("_get_chars") ); + ADD_PROPERTY( PropertyInfo( Variant::POOL_INT_ARRAY, "kernings", PROPERTY_HINT_NONE,"", PROPERTY_USAGE_NOEDITOR ), _SCS("_set_kernings"), _SCS("_get_kernings") ); ADD_PROPERTY( PropertyInfo( Variant::REAL, "height", PROPERTY_HINT_RANGE,"-1024,1024,1" ), _SCS("set_height"), _SCS("get_height") ); ADD_PROPERTY( PropertyInfo( Variant::REAL, "ascent", PROPERTY_HINT_RANGE,"-1024,1024,1" ), _SCS("set_ascent"), _SCS("get_ascent") ); diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index bad87910ff..74f4e8f5f7 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -162,9 +162,9 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { } ERR_FAIL_COND_V(!d.has("aabb"),false); - AABB aabb = d["aabb"]; + Rect3 aabb = d["aabb"]; - Vector<AABB> bone_aabb; + Vector<Rect3> bone_aabb; if (d.has("bone_aabb")) { Array baabb = d["bone_aabb"]; bone_aabb.resize(baabb.size()); @@ -244,7 +244,7 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { d["format"]=VS::get_singleton()->mesh_surface_get_format(mesh,idx); d["aabb"]=VS::get_singleton()->mesh_surface_get_aabb(mesh,idx); - Vector<AABB> skel_aabb = VS::get_singleton()->mesh_surface_get_skeleton_aabb(mesh,idx); + Vector<Rect3> skel_aabb = VS::get_singleton()->mesh_surface_get_skeleton_aabb(mesh,idx); Array arr; for(int i=0;i<skel_aabb.size();i++) { arr[i]=skel_aabb[i]; @@ -275,7 +275,7 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { void Mesh::_get_property_list( List<PropertyInfo> *p_list) const { if (morph_targets.size()) { - p_list->push_back(PropertyInfo(Variant::STRING_ARRAY,"morph_target/names",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::POOL_STRING_ARRAY,"morph_target/names",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR)); p_list->push_back(PropertyInfo(Variant::INT,"morph_target/mode",PROPERTY_HINT_ENUM,"Normalized,Relative")); } @@ -286,7 +286,7 @@ void Mesh::_get_property_list( List<PropertyInfo> *p_list) const { p_list->push_back( PropertyInfo( Variant::OBJECT,"surface_"+itos(i+1)+"/material", PROPERTY_HINT_RESOURCE_TYPE,"Material",PROPERTY_USAGE_EDITOR ) ); } - p_list->push_back( PropertyInfo( Variant::_AABB,"custom_aabb/custom_aabb" ) ); + p_list->push_back( PropertyInfo( Variant::RECT3,"custom_aabb/custom_aabb" ) ); } @@ -294,7 +294,7 @@ void Mesh::_get_property_list( List<PropertyInfo> *p_list) const { void Mesh::_recompute_aabb() { // regenerate AABB - aabb=AABB(); + aabb=Rect3(); for (int i=0;i<surfaces.size();i++) { @@ -306,7 +306,7 @@ void Mesh::_recompute_aabb() { } -void Mesh::add_surface(uint32_t p_format,PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes,const Vector<AABB>& p_bone_aabbs) { +void Mesh::add_surface(uint32_t p_format,PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes,const Vector<Rect3>& p_bone_aabbs) { Surface s; s.aabb=p_aabb; @@ -337,7 +337,7 @@ void Mesh::add_surface_from_arrays(PrimitiveType p_primitive,const Array& p_arra const Vector3 *vtx=r.ptr(); // check AABB - AABB aabb; + Rect3 aabb; for (int i=0;i<len;i++) { if (i==0) @@ -505,7 +505,7 @@ String Mesh::surface_get_name(int p_idx) const{ } -void Mesh::surface_set_custom_aabb(int p_idx,const AABB& p_aabb) { +void Mesh::surface_set_custom_aabb(int p_idx,const Rect3& p_aabb) { ERR_FAIL_INDEX( p_idx, surfaces.size() ); surfaces[p_idx].aabb=p_aabb; @@ -522,7 +522,7 @@ Ref<Material> Mesh::surface_get_material(int p_idx) const { void Mesh::add_surface_from_mesh_data(const Geometry::MeshData& p_mesh_data) { VisualServer::get_singleton()->mesh_add_surface_from_mesh_data( mesh, p_mesh_data ); - AABB aabb; + Rect3 aabb; for (int i=0;i<p_mesh_data.vertices.size();i++) { if (i==0) @@ -551,19 +551,19 @@ RID Mesh::get_rid() const { return mesh; } -AABB Mesh::get_aabb() const { +Rect3 Mesh::get_aabb() const { return aabb; } -void Mesh::set_custom_aabb(const AABB& p_custom) { +void Mesh::set_custom_aabb(const Rect3& p_custom) { custom_aabb=p_custom; VS::get_singleton()->mesh_set_custom_aabb(mesh,custom_aabb); } -AABB Mesh::get_custom_aabb() const { +Rect3 Mesh::get_custom_aabb() const { return custom_aabb; } diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index f92db837ea..8e0b4d4e25 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -114,15 +114,15 @@ public: private: struct Surface { String name; - AABB aabb; + Rect3 aabb; Ref<Material> material; }; Vector<Surface> surfaces; RID mesh; - AABB aabb; + Rect3 aabb; MorphTargetMode morph_target_mode; Vector<StringName> morph_targets; - AABB custom_aabb; + Rect3 custom_aabb; mutable Ref<TriangleMesh> triangle_mesh; @@ -139,7 +139,7 @@ protected: public: void add_surface_from_arrays(PrimitiveType p_primitive, const Array& p_arrays, const Array& p_blend_shapes=Array(), uint32_t p_flags=ARRAY_COMPRESS_DEFAULT); - void add_surface(uint32_t p_format,PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes=Vector<PoolVector<uint8_t> >(),const Vector<AABB>& p_bone_aabbs=Vector<AABB>()); + void add_surface(uint32_t p_format,PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes=Vector<PoolVector<uint8_t> >(),const Vector<Rect3>& p_bone_aabbs=Vector<Rect3>()); Array surface_get_arrays(int p_surface) const; virtual Array surface_get_morph_arrays(int p_surface) const; @@ -155,7 +155,7 @@ public: int get_surface_count() const; void surface_remove(int p_idx); - void surface_set_custom_aabb(int p_surface,const AABB& p_aabb); //only recognized by driver + void surface_set_custom_aabb(int p_surface,const Rect3& p_aabb); //only recognized by driver int surface_get_array_len(int p_idx) const; @@ -172,10 +172,10 @@ public: void add_surface_from_mesh_data(const Geometry::MeshData& p_mesh_data); - void set_custom_aabb(const AABB& p_custom); - AABB get_custom_aabb() const; + void set_custom_aabb(const Rect3& p_custom); + Rect3 get_custom_aabb() const; - AABB get_aabb() const; + Rect3 get_aabb() const; virtual RID get_rid() const; Ref<Shape> create_trimesh_shape() const; diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index 143870c920..75df4a4e60 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -175,7 +175,7 @@ Color MultiMesh::get_instance_color(int p_instance) const { } -AABB MultiMesh::get_aabb() const { +Rect3 MultiMesh::get_aabb() const { return VisualServer::get_singleton()->multimesh_get_aabb(multimesh); @@ -237,8 +237,8 @@ void MultiMesh::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT,"transform_format",PROPERTY_HINT_ENUM,"2D,3D"), _SCS("set_transform_format"), _SCS("get_transform_format")); ADD_PROPERTY(PropertyInfo(Variant::INT,"instance_count",PROPERTY_HINT_RANGE,"0,16384,1"), _SCS("set_instance_count"), _SCS("get_instance_count")); ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"mesh",PROPERTY_HINT_RESOURCE_TYPE,"Mesh"), _SCS("set_mesh"), _SCS("get_mesh")); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR3_ARRAY,"transform_array",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_transform_array"), _SCS("_get_transform_array")); - ADD_PROPERTY(PropertyInfo(Variant::COLOR_ARRAY,"color_array",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_color_array"), _SCS("_get_color_array")); + ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY,"transform_array",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_transform_array"), _SCS("_get_transform_array")); + ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY,"color_array",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_color_array"), _SCS("_get_color_array")); diff --git a/scene/resources/multimesh.h b/scene/resources/multimesh.h index 3ba109a087..c86b33adcf 100644 --- a/scene/resources/multimesh.h +++ b/scene/resources/multimesh.h @@ -85,7 +85,7 @@ public: void set_instance_color(int p_instance, const Color& p_color); Color get_instance_color(int p_instance) const; - virtual AABB get_aabb() const; + virtual Rect3 get_aabb() const; virtual RID get_rid() const; diff --git a/scene/resources/room.cpp b/scene/resources/room.cpp index 88648272be..069127f291 100644 --- a/scene/resources/room.cpp +++ b/scene/resources/room.cpp @@ -56,7 +56,7 @@ void RoomBounds::_bind_methods() { ClassDB::bind_method(_MD("get_geometry_hint"),&RoomBounds::get_geometry_hint); //ADD_PROPERTY( PropertyInfo( Variant::DICTIONARY, "bounds"), _SCS("set_bounds"),_SCS("get_bounds") ); - ADD_PROPERTY( PropertyInfo( Variant::VECTOR3_ARRAY, "geometry_hint"),_SCS("set_geometry_hint"),_SCS("get_geometry_hint") ); + ADD_PROPERTY( PropertyInfo( Variant::POOL_VECTOR3_ARRAY, "geometry_hint"),_SCS("set_geometry_hint"),_SCS("get_geometry_hint") ); } diff --git a/scene/resources/shape_2d.cpp b/scene/resources/shape_2d.cpp index 4e2af89c05..b5a886b4b9 100644 --- a/scene/resources/shape_2d.cpp +++ b/scene/resources/shape_2d.cpp @@ -47,14 +47,14 @@ real_t Shape2D::get_custom_solver_bias() const{ } -bool Shape2D::collide_with_motion(const Matrix32& p_local_xform, const Vector2& p_local_motion, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform, const Vector2 &p_shape_motion) { +bool Shape2D::collide_with_motion(const Transform2D& p_local_xform, const Vector2& p_local_motion, const Ref<Shape2D>& p_shape, const Transform2D& p_shape_xform, const Vector2 &p_shape_motion) { ERR_FAIL_COND_V(p_shape.is_null(),false); int r; return Physics2DServer::get_singleton()->shape_collide(get_rid(),p_local_xform,p_local_motion,p_shape->get_rid(),p_shape_xform,p_shape_motion,NULL,0,r); } -bool Shape2D::collide(const Matrix32& p_local_xform, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform){ +bool Shape2D::collide(const Transform2D& p_local_xform, const Ref<Shape2D>& p_shape, const Transform2D& p_shape_xform){ ERR_FAIL_COND_V(p_shape.is_null(),false); int r; return Physics2DServer::get_singleton()->shape_collide(get_rid(),p_local_xform,Vector2(),p_shape->get_rid(),p_shape_xform,Vector2(),NULL,0,r); @@ -62,7 +62,7 @@ bool Shape2D::collide(const Matrix32& p_local_xform, const Ref<Shape2D>& p_shap } -Variant Shape2D::collide_with_motion_and_get_contacts(const Matrix32& p_local_xform, const Vector2& p_local_motion, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform, const Vector2 &p_shape_motion){ +Variant Shape2D::collide_with_motion_and_get_contacts(const Transform2D& p_local_xform, const Vector2& p_local_motion, const Ref<Shape2D>& p_shape, const Transform2D& p_shape_xform, const Vector2 &p_shape_motion){ ERR_FAIL_COND_V(p_shape.is_null(),Variant()); const int max_contacts = 16; @@ -81,7 +81,7 @@ Variant Shape2D::collide_with_motion_and_get_contacts(const Matrix32& p_local_xf return results; } -Variant Shape2D::collide_and_get_contacts(const Matrix32& p_local_xform, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform){ +Variant Shape2D::collide_and_get_contacts(const Transform2D& p_local_xform, const Ref<Shape2D>& p_shape, const Transform2D& p_shape_xform){ ERR_FAIL_COND_V(p_shape.is_null(),Variant()); const int max_contacts = 16; diff --git a/scene/resources/shape_2d.h b/scene/resources/shape_2d.h index ea89b31057..6a7ec03a9a 100644 --- a/scene/resources/shape_2d.h +++ b/scene/resources/shape_2d.h @@ -47,11 +47,11 @@ public: void set_custom_solver_bias(real_t p_bias); real_t get_custom_solver_bias() const; - bool collide_with_motion(const Matrix32& p_local_xform, const Vector2& p_local_motion, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform, const Vector2 &p_p_shape_motion); - bool collide(const Matrix32& p_local_xform, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform); + bool collide_with_motion(const Transform2D& p_local_xform, const Vector2& p_local_motion, const Ref<Shape2D>& p_shape, const Transform2D& p_shape_xform, const Vector2 &p_p_shape_motion); + bool collide(const Transform2D& p_local_xform, const Ref<Shape2D>& p_shape, const Transform2D& p_shape_xform); - Variant collide_with_motion_and_get_contacts(const Matrix32& p_local_xform, const Vector2& p_local_motion, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform, const Vector2 &p_p_shape_motion); - Variant collide_and_get_contacts(const Matrix32& p_local_xform, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform); + Variant collide_with_motion_and_get_contacts(const Transform2D& p_local_xform, const Vector2& p_local_motion, const Ref<Shape2D>& p_shape, const Transform2D& p_shape_xform, const Vector2 &p_p_shape_motion); + Variant collide_and_get_contacts(const Transform2D& p_local_xform, const Ref<Shape2D>& p_shape, const Transform2D& p_shape_xform); virtual void draw(const RID& p_to_rid,const Color& p_color) {} virtual Rect2 get_rect() const { return Rect2(); } diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index 64f3dd8b97..3f7261c312 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -41,7 +41,7 @@ struct SpatialIndexer { struct NotifierData { - AABB aabb; + Rect3 aabb; OctreeElementID id; }; @@ -64,7 +64,7 @@ struct SpatialIndexer { uint64_t pass; uint64_t last_frame; - void _notifier_add(VisibilityNotifier* p_notifier,const AABB& p_rect) { + void _notifier_add(VisibilityNotifier* p_notifier,const Rect3& p_rect) { ERR_FAIL_COND(notifiers.has(p_notifier)); notifiers[p_notifier].aabb=p_rect; @@ -73,7 +73,7 @@ struct SpatialIndexer { } - void _notifier_update(VisibilityNotifier* p_notifier,const AABB& p_rect) { + void _notifier_update(VisibilityNotifier* p_notifier,const Rect3& p_rect) { Map<VisibilityNotifier*,NotifierData>::Element *E=notifiers.find(p_notifier); ERR_FAIL_COND(!E); @@ -246,14 +246,14 @@ void World::_remove_camera(Camera* p_camera){ -void World::_register_notifier(VisibilityNotifier* p_notifier,const AABB& p_rect){ +void World::_register_notifier(VisibilityNotifier* p_notifier,const Rect3& p_rect){ #ifndef _3D_DISABLED indexer->_notifier_add(p_notifier,p_rect); #endif } -void World::_update_notifier(VisibilityNotifier* p_notifier,const AABB& p_rect){ +void World::_update_notifier(VisibilityNotifier* p_notifier,const Rect3& p_rect){ #ifndef _3D_DISABLED indexer->_notifier_update(p_notifier,p_rect); diff --git a/scene/resources/world.h b/scene/resources/world.h index 8244261243..bea07882d7 100644 --- a/scene/resources/world.h +++ b/scene/resources/world.h @@ -60,8 +60,8 @@ friend class VisibilityNotifier; void _update_camera(Camera* p_camera); void _remove_camera(Camera* p_camera); - void _register_notifier(VisibilityNotifier* p_notifier,const AABB& p_rect); - void _update_notifier(VisibilityNotifier *p_notifier,const AABB& p_rect); + void _register_notifier(VisibilityNotifier* p_notifier,const Rect3& p_rect); + void _update_notifier(VisibilityNotifier *p_notifier,const Rect3& p_rect); void _remove_notifier(VisibilityNotifier* p_notifier); friend class Viewport; void _update(uint64_t p_frame); diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp index 2f859a4ed4..ceeeafe04a 100644 --- a/servers/physics/body_sw.cpp +++ b/servers/physics/body_sw.cpp @@ -43,8 +43,8 @@ void BodySW::_update_transform_dependant() { principal_inertia_axes = get_transform().basis * principal_inertia_axes_local; // update inertia tensor - Matrix3 tb = principal_inertia_axes; - Matrix3 tbt = tb.transposed(); + Basis tb = principal_inertia_axes; + Basis tbt = tb.transposed(); tb.scale(_inv_inertia); _inv_inertia_tensor = tb * tbt; @@ -81,7 +81,7 @@ void BodySW::update_inertias() { center_of_mass_local /= mass; // Recompute the inertia tensor - Matrix3 inertia_tensor; + Basis inertia_tensor; inertia_tensor.set_zero(); for (int i=0;i<get_shape_count();i++) { @@ -92,15 +92,15 @@ void BodySW::update_inertias() { float mass = area * this->mass / total_area; - Matrix3 shape_inertia_tensor=shape->get_moment_of_inertia(mass).to_diagonal_matrix(); + Basis shape_inertia_tensor=shape->get_moment_of_inertia(mass).to_diagonal_matrix(); Transform shape_transform=get_shape_transform(i); - Matrix3 shape_basis = shape_transform.basis.orthonormalized(); + Basis shape_basis = shape_transform.basis.orthonormalized(); // NOTE: we don't take the scale of collision shapes into account when computing the inertia tensor! shape_inertia_tensor = shape_basis * shape_inertia_tensor * shape_basis.transposed(); Vector3 shape_origin = shape_transform.origin - center_of_mass_local; - inertia_tensor += shape_inertia_tensor + (Matrix3()*shape_origin.dot(shape_origin)-shape_origin.outer(shape_origin))*mass; + inertia_tensor += shape_inertia_tensor + (Basis()*shape_origin.dot(shape_origin)-shape_origin.outer(shape_origin))*mass; } @@ -497,7 +497,7 @@ void BodySW::integrate_forces(real_t p_step) { linear_velocity = (new_transform.origin - get_transform().origin)/p_step; //compute a FAKE angular velocity, not so easy - Matrix3 rot=new_transform.basis.orthonormalized().transposed() * get_transform().basis.orthonormalized(); + Basis rot=new_transform.basis.orthonormalized().transposed() * get_transform().basis.orthonormalized(); Vector3 axis; float angle; @@ -609,8 +609,8 @@ void BodySW::integrate_velocities(real_t p_step) { if (ang_vel!=0.0) { Vector3 ang_vel_axis = total_angular_velocity / ang_vel; - Matrix3 rot( ang_vel_axis, -ang_vel*p_step ); - Matrix3 identity3(1, 0, 0, 0, 1, 0, 0, 0, 1); + Basis rot( ang_vel_axis, -ang_vel*p_step ); + Basis identity3(1, 0, 0, 0, 1, 0, 0, 0, 1); transform.origin += ((identity3 - rot) * transform.basis).xform(center_of_mass_local); transform.basis = rot * transform.basis; transform.orthonormalize(); diff --git a/servers/physics/body_sw.h b/servers/physics/body_sw.h index acdd84d259..e6ed3e75e5 100644 --- a/servers/physics/body_sw.h +++ b/servers/physics/body_sw.h @@ -60,12 +60,12 @@ class BodySW : public CollisionObjectSW { Vector3 _inv_inertia; // Relative to the principal axes of inertia // Relative to the local frame of reference - Matrix3 principal_inertia_axes_local; + Basis principal_inertia_axes_local; Vector3 center_of_mass_local; // In world orientation with local origin - Matrix3 _inv_inertia_tensor; - Matrix3 principal_inertia_axes; + Basis _inv_inertia_tensor; + Basis principal_inertia_axes; Vector3 center_of_mass; Vector3 gravity; @@ -198,7 +198,7 @@ public: _FORCE_INLINE_ void set_omit_force_integration(bool p_omit_force_integration) { omit_force_integration=p_omit_force_integration; } _FORCE_INLINE_ bool get_omit_force_integration() const { return omit_force_integration; } - _FORCE_INLINE_ Matrix3 get_principal_inertia_axes() const { return principal_inertia_axes; } + _FORCE_INLINE_ Basis get_principal_inertia_axes() const { return principal_inertia_axes; } _FORCE_INLINE_ Vector3 get_center_of_mass() const { return center_of_mass; } _FORCE_INLINE_ Vector3 xform_local_to_principal(const Vector3& p_pos) const { return principal_inertia_axes_local.xform(p_pos - center_of_mass_local); } @@ -272,7 +272,7 @@ public: _FORCE_INLINE_ real_t get_inv_mass() const { return _inv_mass; } _FORCE_INLINE_ Vector3 get_inv_inertia() const { return _inv_inertia; } - _FORCE_INLINE_ Matrix3 get_inv_inertia_tensor() const { return _inv_inertia_tensor; } + _FORCE_INLINE_ Basis get_inv_inertia_tensor() const { return _inv_inertia_tensor; } _FORCE_INLINE_ real_t get_friction() const { return friction; } _FORCE_INLINE_ Vector3 get_gravity() const { return gravity; } _FORCE_INLINE_ real_t get_bounce() const { return bounce; } @@ -381,11 +381,11 @@ public: virtual float get_total_linear_damp() const { return body->area_linear_damp; } // get density of this body space/area virtual Vector3 get_center_of_mass() const { return body->get_center_of_mass(); } - virtual Matrix3 get_principal_inertia_axes() const { return body->get_principal_inertia_axes(); } + virtual Basis get_principal_inertia_axes() const { return body->get_principal_inertia_axes(); } virtual float get_inverse_mass() const { return body->get_inv_mass(); } // get the mass virtual Vector3 get_inverse_inertia() const { return body->get_inv_inertia(); } // get density of this body space - virtual Matrix3 get_inverse_inertia_tensor() const { return body->get_inv_inertia_tensor(); } // get density of this body space + virtual Basis get_inverse_inertia_tensor() const { return body->get_inv_inertia_tensor(); } // get density of this body space virtual void set_linear_velocity(const Vector3& p_velocity) { body->set_linear_velocity(p_velocity); } virtual Vector3 get_linear_velocity() const { return body->get_linear_velocity(); } diff --git a/servers/physics/broad_phase_basic.cpp b/servers/physics/broad_phase_basic.cpp index 30b5978594..f1c22caae3 100644 --- a/servers/physics/broad_phase_basic.cpp +++ b/servers/physics/broad_phase_basic.cpp @@ -47,7 +47,7 @@ BroadPhaseSW::ID BroadPhaseBasic::create(CollisionObjectSW *p_object_, int p_sub return current; } -void BroadPhaseBasic::move(ID p_id, const AABB& p_aabb) { +void BroadPhaseBasic::move(ID p_id, const Rect3& p_aabb) { Map<ID,Element>::Element *E=element_map.find(p_id); ERR_FAIL_COND(!E); @@ -115,7 +115,7 @@ int BroadPhaseBasic::cull_segment(const Vector3& p_from, const Vector3& p_to,Col for (Map<ID,Element>::Element *E=element_map.front();E;E=E->next()) { - const AABB aabb=E->get().aabb; + const Rect3 aabb=E->get().aabb; if (aabb.intersects_segment(p_from,p_to)) { p_results[rc]=E->get().owner; @@ -129,13 +129,13 @@ int BroadPhaseBasic::cull_segment(const Vector3& p_from, const Vector3& p_to,Col return rc; } -int BroadPhaseBasic::cull_aabb(const AABB& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices) { +int BroadPhaseBasic::cull_aabb(const Rect3& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices) { int rc=0; for (Map<ID,Element>::Element *E=element_map.front();E;E=E->next()) { - const AABB aabb=E->get().aabb; + const Rect3 aabb=E->get().aabb; if (aabb.intersects(p_aabb)) { p_results[rc]=E->get().owner; diff --git a/servers/physics/broad_phase_basic.h b/servers/physics/broad_phase_basic.h index 423ff0a6a8..9f07e896c4 100644 --- a/servers/physics/broad_phase_basic.h +++ b/servers/physics/broad_phase_basic.h @@ -38,7 +38,7 @@ class BroadPhaseBasic : public BroadPhaseSW { CollisionObjectSW *owner; bool _static; - AABB aabb; + Rect3 aabb; int subindex; }; @@ -78,7 +78,7 @@ public: // 0 is an invalid ID virtual ID create(CollisionObjectSW *p_object_, int p_subindex=0); - virtual void move(ID p_id, const AABB& p_aabb); + virtual void move(ID p_id, const Rect3& p_aabb); virtual void set_static(ID p_id, bool p_static); virtual void remove(ID p_id); @@ -87,7 +87,7 @@ public: virtual int get_subindex(ID p_id) const; virtual int cull_segment(const Vector3& p_from, const Vector3& p_to,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL); - virtual int cull_aabb(const AABB& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL); + virtual int cull_aabb(const Rect3& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL); virtual void set_pair_callback(PairCallback p_pair_callback,void *p_userdata); virtual void set_unpair_callback(UnpairCallback p_unpair_callback,void *p_userdata); diff --git a/servers/physics/broad_phase_octree.cpp b/servers/physics/broad_phase_octree.cpp index 60fbf926bd..89581997a2 100644 --- a/servers/physics/broad_phase_octree.cpp +++ b/servers/physics/broad_phase_octree.cpp @@ -31,11 +31,11 @@ BroadPhaseSW::ID BroadPhaseOctree::create(CollisionObjectSW *p_object, int p_subindex) { - ID oid = octree.create(p_object,AABB(),p_subindex,false,1<<p_object->get_type(),0); + ID oid = octree.create(p_object,Rect3(),p_subindex,false,1<<p_object->get_type(),0); return oid; } -void BroadPhaseOctree::move(ID p_id, const AABB& p_aabb){ +void BroadPhaseOctree::move(ID p_id, const Rect3& p_aabb){ octree.move(p_id,p_aabb); } @@ -71,7 +71,7 @@ int BroadPhaseOctree::cull_segment(const Vector3& p_from, const Vector3& p_to,Co return octree.cull_segment(p_from,p_to,p_results,p_max_results,p_result_indices); } -int BroadPhaseOctree::cull_aabb(const AABB& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices) { +int BroadPhaseOctree::cull_aabb(const Rect3& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices) { return octree.cull_AABB(p_aabb,p_results,p_max_results,p_result_indices); diff --git a/servers/physics/broad_phase_octree.h b/servers/physics/broad_phase_octree.h index 43005812e7..29f1123edf 100644 --- a/servers/physics/broad_phase_octree.h +++ b/servers/physics/broad_phase_octree.h @@ -50,7 +50,7 @@ public: // 0 is an invalid ID virtual ID create(CollisionObjectSW *p_object_, int p_subindex=0); - virtual void move(ID p_id, const AABB& p_aabb); + virtual void move(ID p_id, const Rect3& p_aabb); virtual void set_static(ID p_id, bool p_static); virtual void remove(ID p_id); @@ -59,7 +59,7 @@ public: virtual int get_subindex(ID p_id) const; virtual int cull_segment(const Vector3& p_from, const Vector3& p_to,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL); - virtual int cull_aabb(const AABB& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL); + virtual int cull_aabb(const Rect3& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL); virtual void set_pair_callback(PairCallback p_pair_callback,void *p_userdata); virtual void set_unpair_callback(UnpairCallback p_unpair_callback,void *p_userdata); diff --git a/servers/physics/broad_phase_sw.h b/servers/physics/broad_phase_sw.h index 736b674185..2cc2d7d45e 100644 --- a/servers/physics/broad_phase_sw.h +++ b/servers/physics/broad_phase_sw.h @@ -50,7 +50,7 @@ public: // 0 is an invalid ID virtual ID create(CollisionObjectSW *p_object_, int p_subindex=0)=0; - virtual void move(ID p_id, const AABB& p_aabb)=0; + virtual void move(ID p_id, const Rect3& p_aabb)=0; virtual void set_static(ID p_id, bool p_static)=0; virtual void remove(ID p_id)=0; @@ -59,7 +59,7 @@ public: virtual int get_subindex(ID p_id) const=0; virtual int cull_segment(const Vector3& p_from, const Vector3& p_to,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL)=0; - virtual int cull_aabb(const AABB& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL)=0; + virtual int cull_aabb(const Rect3& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL)=0; virtual void set_pair_callback(PairCallback p_pair_callback,void *p_userdata)=0; virtual void set_unpair_callback(UnpairCallback p_unpair_callback,void *p_userdata)=0; diff --git a/servers/physics/collision_object_sw.cpp b/servers/physics/collision_object_sw.cpp index 2b2b73738a..88aa737579 100644 --- a/servers/physics/collision_object_sw.cpp +++ b/servers/physics/collision_object_sw.cpp @@ -138,7 +138,7 @@ void CollisionObjectSW::_update_shapes() { } //not quite correct, should compute the next matrix.. - AABB shape_aabb=s.shape->get_aabb(); + Rect3 shape_aabb=s.shape->get_aabb(); Transform xform = transform * s.xform; shape_aabb=xform.xform(shape_aabb); s.aabb_cache=shape_aabb; @@ -167,10 +167,10 @@ void CollisionObjectSW::_update_shapes_with_motion(const Vector3& p_motion) { } //not quite correct, should compute the next matrix.. - AABB shape_aabb=s.shape->get_aabb(); + Rect3 shape_aabb=s.shape->get_aabb(); Transform xform = transform * s.xform; shape_aabb=xform.xform(shape_aabb); - shape_aabb=shape_aabb.merge(AABB( shape_aabb.pos+p_motion,shape_aabb.size)); //use motion + shape_aabb=shape_aabb.merge(Rect3( shape_aabb.pos+p_motion,shape_aabb.size)); //use motion s.aabb_cache=shape_aabb; space->get_broadphase()->move(s.bpid,shape_aabb); diff --git a/servers/physics/collision_object_sw.h b/servers/physics/collision_object_sw.h index f3e43c98db..c46a7f4a5f 100644 --- a/servers/physics/collision_object_sw.h +++ b/servers/physics/collision_object_sw.h @@ -60,7 +60,7 @@ private: Transform xform; Transform xform_inv; BroadPhaseSW::ID bpid; - AABB aabb_cache; //for rayqueries + Rect3 aabb_cache; //for rayqueries real_t area_cache; ShapeSW *shape; bool trigger; @@ -123,7 +123,7 @@ public: _FORCE_INLINE_ ShapeSW *get_shape(int p_index) const { return shapes[p_index].shape; } _FORCE_INLINE_ const Transform& get_shape_transform(int p_index) const { return shapes[p_index].xform; } _FORCE_INLINE_ const Transform& get_shape_inv_transform(int p_index) const { return shapes[p_index].xform_inv; } - _FORCE_INLINE_ const AABB& get_shape_aabb(int p_index) const { return shapes[p_index].aabb_cache; } + _FORCE_INLINE_ const Rect3& get_shape_aabb(int p_index) const { return shapes[p_index].aabb_cache; } _FORCE_INLINE_ const real_t get_shape_area(int p_index) const { return shapes[p_index].area_cache; } _FORCE_INLINE_ Transform get_transform() const { return transform; } diff --git a/servers/physics/collision_solver_sw.cpp b/servers/physics/collision_solver_sw.cpp index 886d93c4b4..91ef7913cf 100644 --- a/servers/physics/collision_solver_sw.cpp +++ b/servers/physics/collision_solver_sw.cpp @@ -160,7 +160,7 @@ bool CollisionSolverSW::solve_concave(const ShapeSW *p_shape_A,const Transform& //quickly compute a local AABB - AABB local_aabb; + Rect3 local_aabb; for(int i=0;i<3;i++) { Vector3 axis( p_transform_B.basis.get_axis(i) ); @@ -313,7 +313,7 @@ bool CollisionSolverSW::solve_distance_plane(const ShapeSW *p_shape_A,const Tran return collided; } -bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,Vector3& r_point_A,Vector3& r_point_B,const AABB& p_concave_hint,Vector3 *r_sep_axis) { +bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,Vector3& r_point_A,Vector3& r_point_B,const Rect3& p_concave_hint,Vector3 *r_sep_axis) { if (p_shape_A->is_concave()) return false; @@ -351,14 +351,14 @@ bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A,const Transform& //quickly compute a local AABB - bool use_cc_hint=p_concave_hint!=AABB(); - AABB cc_hint_aabb; + bool use_cc_hint=p_concave_hint!=Rect3(); + Rect3 cc_hint_aabb; if (use_cc_hint) { cc_hint_aabb=p_concave_hint; cc_hint_aabb.pos-=p_transform_B.origin; } - AABB local_aabb; + Rect3 local_aabb; for(int i=0;i<3;i++) { Vector3 axis( p_transform_B.basis.get_axis(i) ); diff --git a/servers/physics/collision_solver_sw.h b/servers/physics/collision_solver_sw.h index 82ac77f73d..16d2b92d70 100644 --- a/servers/physics/collision_solver_sw.h +++ b/servers/physics/collision_solver_sw.h @@ -48,7 +48,7 @@ public: static bool solve_static(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,CallbackResult p_result_callback,void *p_userdata,Vector3 *r_sep_axis=NULL,float p_margin_A=0,float p_margin_B=0); - static bool solve_distance(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,Vector3& r_point_A,Vector3& r_point_B,const AABB& p_concave_hint,Vector3 *r_sep_axis=NULL); + static bool solve_distance(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,Vector3& r_point_A,Vector3& r_point_B,const Rect3& p_concave_hint,Vector3 *r_sep_axis=NULL); }; diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp index 3c0119971a..5824de0127 100644 --- a/servers/physics/joints/generic_6dof_joint_sw.cpp +++ b/servers/physics/joints/generic_6dof_joint_sw.cpp @@ -38,8 +38,8 @@ See corresponding header file for licensing info. #define GENERIC_D6_DISABLE_WARMSTARTING 1 -real_t btGetMatrixElem(const Matrix3& mat, int index); -real_t btGetMatrixElem(const Matrix3& mat, int index) +real_t btGetMatrixElem(const Basis& mat, int index); +real_t btGetMatrixElem(const Basis& mat, int index) { int i = index%3; int j = index/3; @@ -47,8 +47,8 @@ real_t btGetMatrixElem(const Matrix3& mat, int index) } ///MatrixToEulerXYZ from http://www.geometrictools.com/LibFoundation/Mathematics/Wm4Matrix3.inl.html -bool matrixToEulerXYZ(const Matrix3& mat,Vector3& xyz); -bool matrixToEulerXYZ(const Matrix3& mat,Vector3& xyz) +bool matrixToEulerXYZ(const Basis& mat,Vector3& xyz); +bool matrixToEulerXYZ(const Basis& mat,Vector3& xyz) { // // rot = cy*cz -cy*sz sy // // cz*sx*sy+cx*sz cx*cz-sx*sy*sz -cy*sx @@ -296,7 +296,7 @@ Generic6DOFJointSW::Generic6DOFJointSW(BodySW* rbA, BodySW* rbB, const Transform void Generic6DOFJointSW::calculateAngleInfo() { - Matrix3 relative_frame = m_calculatedTransformA.basis.inverse()*m_calculatedTransformB.basis; + Basis relative_frame = m_calculatedTransformA.basis.inverse()*m_calculatedTransformB.basis; matrixToEulerXYZ(relative_frame,m_calculatedAxisAngleDiff); diff --git a/servers/physics/joints/hinge_joint_sw.cpp b/servers/physics/joints/hinge_joint_sw.cpp index 23e00a9e7f..2f07779131 100644 --- a/servers/physics/joints/hinge_joint_sw.cpp +++ b/servers/physics/joints/hinge_joint_sw.cpp @@ -112,7 +112,7 @@ HingeJointSW::HingeJointSW(BodySW* rbA,BodySW* rbB, const Vector3& pivotInA,cons rbAxisA1 = rbAxisA2.cross(axisInA); } - m_rbAFrame.basis=Matrix3( rbAxisA1.x,rbAxisA2.x,axisInA.x, + m_rbAFrame.basis=Basis( rbAxisA1.x,rbAxisA2.x,axisInA.x, rbAxisA1.y,rbAxisA2.y,axisInA.y, rbAxisA1.z,rbAxisA2.z,axisInA.z ); @@ -121,7 +121,7 @@ HingeJointSW::HingeJointSW(BodySW* rbA,BodySW* rbB, const Vector3& pivotInA,cons Vector3 rbAxisB2 = axisInB.cross(rbAxisB1); m_rbBFrame.origin = pivotInB; - m_rbBFrame.basis=Matrix3( rbAxisB1.x,rbAxisB2.x,-axisInB.x, + m_rbBFrame.basis=Basis( rbAxisB1.x,rbAxisB2.x,-axisInB.x, rbAxisB1.y,rbAxisB2.y,-axisInB.y, rbAxisB1.z,rbAxisB2.z,-axisInB.z ); diff --git a/servers/physics/joints/jacobian_entry_sw.h b/servers/physics/joints/jacobian_entry_sw.h index 1a54859956..cd85162ba5 100644 --- a/servers/physics/joints/jacobian_entry_sw.h +++ b/servers/physics/joints/jacobian_entry_sw.h @@ -56,8 +56,8 @@ public: JacobianEntrySW() {}; //constraint between two different rigidbodies JacobianEntrySW( - const Matrix3& world2A, - const Matrix3& world2B, + const Basis& world2A, + const Basis& world2B, const Vector3& rel_pos1,const Vector3& rel_pos2, const Vector3& jointAxis, const Vector3& inertiaInvA, @@ -77,8 +77,8 @@ public: //angular constraint between two different rigidbodies JacobianEntrySW(const Vector3& jointAxis, - const Matrix3& world2A, - const Matrix3& world2B, + const Basis& world2A, + const Basis& world2B, const Vector3& inertiaInvA, const Vector3& inertiaInvB) :m_linearJointAxis(Vector3(real_t(0.),real_t(0.),real_t(0.))) @@ -110,7 +110,7 @@ public: //constraint on one rigidbody JacobianEntrySW( - const Matrix3& world2A, + const Basis& world2A, const Vector3& rel_pos1,const Vector3& rel_pos2, const Vector3& jointAxis, const Vector3& inertiaInvA, diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp index c853dcff35..59ade71475 100644 --- a/servers/physics/shape_sw.cpp +++ b/servers/physics/shape_sw.cpp @@ -35,7 +35,7 @@ #define _FACE_IS_VALID_SUPPORT_TRESHOLD 0.9998 -void ShapeSW::configure(const AABB& p_aabb) { +void ShapeSW::configure(const Rect3& p_aabb) { aabb=p_aabb; configured=true; for (Map<ShapeOwnerSW*,int>::Element *E=owners.front();E;E=E->next()) { @@ -133,7 +133,7 @@ Vector3 PlaneShapeSW::get_moment_of_inertia(float p_mass) const { void PlaneShapeSW::_setup(const Plane& p_plane) { plane=p_plane; - configure(AABB(Vector3(-1e4,-1e4,-1e4),Vector3(1e4*2,1e4*2,1e4*2))); + configure(Rect3(Vector3(-1e4,-1e4,-1e4),Vector3(1e4*2,1e4*2,1e4*2))); } void PlaneShapeSW::set_data(const Variant& p_data) { @@ -204,7 +204,7 @@ Vector3 RayShapeSW::get_moment_of_inertia(float p_mass) const { void RayShapeSW::_setup(float p_length) { length=p_length; - configure(AABB(Vector3(0,0,0),Vector3(0.1,0.1,length))); + configure(Rect3(Vector3(0,0,0),Vector3(0.1,0.1,length))); } void RayShapeSW::set_data(const Variant& p_data) { @@ -271,7 +271,7 @@ void SphereShapeSW::_setup(real_t p_radius) { radius=p_radius; - configure(AABB( Vector3(-radius,-radius,-radius), Vector3(radius*2.0,radius*2.0,radius*2.0))); + configure(Rect3( Vector3(-radius,-radius,-radius), Vector3(radius*2.0,radius*2.0,radius*2.0))); } @@ -412,7 +412,7 @@ void BoxShapeSW::get_supports(const Vector3& p_normal,int p_max,Vector3 *r_suppo bool BoxShapeSW::intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_result, Vector3 &r_normal) const { - AABB aabb(-half_extents,half_extents*2.0); + Rect3 aabb(-half_extents,half_extents*2.0); return aabb.intersects_segment(p_begin,p_end,&r_result,&r_normal); @@ -432,7 +432,7 @@ void BoxShapeSW::_setup(const Vector3& p_half_extents) { half_extents=p_half_extents.abs(); - configure(AABB(-half_extents,half_extents*2)); + configure(Rect3(-half_extents,half_extents*2)); } @@ -604,7 +604,7 @@ void CapsuleShapeSW::_setup(real_t p_height,real_t p_radius) { height=p_height; radius=p_radius; - configure(AABB(Vector3(-radius,-radius,-height*0.5-radius),Vector3(radius*2,radius*2,height+radius*2.0))); + configure(Rect3(Vector3(-radius,-radius,-height*0.5-radius),Vector3(radius*2,radius*2,height+radius*2.0))); } @@ -818,7 +818,7 @@ Vector3 ConvexPolygonShapeSW::get_moment_of_inertia(float p_mass) const { void ConvexPolygonShapeSW::_setup(const Vector<Vector3>& p_vertices) { Error err = QuickHull::build(p_vertices,mesh); - AABB _aabb; + Rect3 _aabb; for(int i=0;i<mesh.vertices.size();i++) { @@ -965,7 +965,7 @@ Vector3 FaceShapeSW::get_moment_of_inertia(float p_mass) const { FaceShapeSW::FaceShapeSW() { - configure(AABB()); + configure(Rect3()); } @@ -1175,13 +1175,13 @@ void ConcavePolygonShapeSW::_cull(int p_idx,_CullParams *p_params) const { } } -void ConcavePolygonShapeSW::cull(const AABB& p_local_aabb,Callback p_callback,void* p_userdata) const { +void ConcavePolygonShapeSW::cull(const Rect3& p_local_aabb,Callback p_callback,void* p_userdata) const { // make matrix local to concave if (faces.size()==0) return; - AABB local_aabb=p_local_aabb; + Rect3 local_aabb=p_local_aabb; // unlock data PoolVector<Face>::Read fr=faces.read(); @@ -1219,7 +1219,7 @@ Vector3 ConcavePolygonShapeSW::get_moment_of_inertia(float p_mass) const { struct _VolumeSW_BVH_Element { - AABB aabb; + Rect3 aabb; Vector3 center; int face_index; }; @@ -1251,7 +1251,7 @@ struct _VolumeSW_BVH_CompareZ { struct _VolumeSW_BVH { - AABB aabb; + Rect3 aabb; _VolumeSW_BVH *left; _VolumeSW_BVH *right; @@ -1276,7 +1276,7 @@ _VolumeSW_BVH* _volume_sw_build_bvh(_VolumeSW_BVH_Element *p_elements,int p_size bvh->face_index=-1; } - AABB aabb; + Rect3 aabb; for(int i=0;i<p_size;i++) { if (i==0) @@ -1351,7 +1351,7 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) { int src_face_count=p_faces.size(); if (src_face_count==0) { - configure(AABB()); + configure(Rect3()); return; } ERR_FAIL_COND(src_face_count%3); @@ -1488,7 +1488,7 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) { PoolVector<Vector3>::Write vw = vertices.write(); Vector3 *verticesw=vw.ptr(); - AABB _aabb; + Rect3 _aabb; for(int i=0;i<src_face_count;i++) { @@ -1593,7 +1593,7 @@ bool HeightMapShapeSW::intersect_segment(const Vector3& p_begin,const Vector3& p } -void HeightMapShapeSW::cull(const AABB& p_local_aabb,Callback p_callback,void* p_userdata) const { +void HeightMapShapeSW::cull(const Rect3& p_local_aabb,Callback p_callback,void* p_userdata) const { @@ -1623,7 +1623,7 @@ void HeightMapShapeSW::_setup(PoolVector<real_t> p_heights,int p_width,int p_dep PoolVector<real_t>::Read r = heights. read(); - AABB aabb; + Rect3 aabb; for(int i=0;i<depth;i++) { diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h index 2298be7530..3cbd1c9609 100644 --- a/servers/physics/shape_sw.h +++ b/servers/physics/shape_sw.h @@ -59,14 +59,14 @@ public: class ShapeSW : public RID_Data { RID self; - AABB aabb; + Rect3 aabb; bool configured; real_t custom_bias; Map<ShapeOwnerSW*,int> owners; protected: - void configure(const AABB& p_aabb); + void configure(const Rect3& p_aabb); public: enum { @@ -80,7 +80,7 @@ public: virtual PhysicsServer::ShapeType get_type() const=0; - _FORCE_INLINE_ AABB get_aabb() const { return aabb; } + _FORCE_INLINE_ Rect3 get_aabb() const { return aabb; } _FORCE_INLINE_ bool is_configured() const { return configured; } virtual bool is_concave() const { return false; } @@ -116,7 +116,7 @@ public: typedef void (*Callback)(void* p_userdata,ShapeSW *p_convex); virtual void get_supports(const Vector3& p_normal,int p_max,Vector3 *r_supports,int & r_amount) const { r_amount=0; } - virtual void cull(const AABB& p_local_aabb,Callback p_callback,void* p_userdata) const=0; + virtual void cull(const Rect3& p_local_aabb,Callback p_callback,void* p_userdata) const=0; ConcaveShapeSW() {} }; @@ -293,7 +293,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW { struct BVH { - AABB aabb; + Rect3 aabb; int left; int right; @@ -304,7 +304,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW { struct _CullParams { - AABB aabb; + Rect3 aabb; Callback callback; void *userdata; const Face *faces; @@ -347,7 +347,7 @@ public: virtual bool intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_result, Vector3 &r_normal) const; - virtual void cull(const AABB& p_local_aabb,Callback p_callback,void* p_userdata) const; + virtual void cull(const Rect3& p_local_aabb,Callback p_callback,void* p_userdata) const; virtual Vector3 get_moment_of_inertia(float p_mass) const; @@ -383,7 +383,7 @@ public: virtual Vector3 get_support(const Vector3& p_normal) const; virtual bool intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_result, Vector3 &r_normal) const; - virtual void cull(const AABB& p_local_aabb,Callback p_callback,void* p_userdata) const; + virtual void cull(const Rect3& p_local_aabb,Callback p_callback,void* p_userdata) const; virtual Vector3 get_moment_of_inertia(float p_mass) const; @@ -455,7 +455,7 @@ struct MotionShapeSW : public ShapeSW { virtual void set_data(const Variant& p_data) {} virtual Variant get_data() const { return Variant(); } - MotionShapeSW() { configure(AABB()); } + MotionShapeSW() { configure(Rect3()); } }; diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp index 596c7af214..d73d5f140e 100644 --- a/servers/physics/space_sw.cpp +++ b/servers/physics/space_sw.cpp @@ -146,7 +146,7 @@ int PhysicsDirectSpaceStateSW::intersect_shape(const RID& p_shape, const Transfo ShapeSW *shape = static_cast<PhysicsServerSW*>(PhysicsServer::get_singleton())->shape_owner.get(p_shape); ERR_FAIL_COND_V(!shape,0); - AABB aabb = p_xform.xform(shape->get_aabb()); + Rect3 aabb = p_xform.xform(shape->get_aabb()); int amount = space->broadphase->cull_aabb(aabb,space->intersection_query_results,SpaceSW::INTERSECTION_QUERY_MAX,space->intersection_query_subindex_results); @@ -200,8 +200,8 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID& p_shape, const Transform& ShapeSW *shape = static_cast<PhysicsServerSW*>(PhysicsServer::get_singleton())->shape_owner.get(p_shape); ERR_FAIL_COND_V(!shape,false); - AABB aabb = p_xform.xform(shape->get_aabb()); - aabb=aabb.merge(AABB(aabb.pos+p_motion,aabb.size)); //motion + Rect3 aabb = p_xform.xform(shape->get_aabb()); + aabb=aabb.merge(Rect3(aabb.pos+p_motion,aabb.size)); //motion aabb=aabb.grow(p_margin); //if (p_motion!=Vector3()) @@ -329,7 +329,7 @@ bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform& p_sh ShapeSW *shape = static_cast<PhysicsServerSW*>(PhysicsServer::get_singleton())->shape_owner.get(p_shape); ERR_FAIL_COND_V(!shape,0); - AABB aabb = p_shape_xform.xform(shape->get_aabb()); + Rect3 aabb = p_shape_xform.xform(shape->get_aabb()); aabb=aabb.grow(p_margin); int amount = space->broadphase->cull_aabb(aabb,space->intersection_query_results,SpaceSW::INTERSECTION_QUERY_MAX,space->intersection_query_subindex_results); @@ -412,7 +412,7 @@ bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform& p_shape_ ShapeSW *shape = static_cast<PhysicsServerSW*>(PhysicsServer::get_singleton())->shape_owner.get(p_shape); ERR_FAIL_COND_V(!shape,0); - AABB aabb = p_shape_xform.xform(shape->get_aabb()); + Rect3 aabb = p_shape_xform.xform(shape->get_aabb()); aabb=aabb.grow(p_margin); int amount = space->broadphase->cull_aabb(aabb,space->intersection_query_results,SpaceSW::INTERSECTION_QUERY_MAX,space->intersection_query_subindex_results); diff --git a/servers/physics_2d/area_2d_sw.cpp b/servers/physics_2d/area_2d_sw.cpp index 5ee983d706..8ccdd51067 100644 --- a/servers/physics_2d/area_2d_sw.cpp +++ b/servers/physics_2d/area_2d_sw.cpp @@ -38,7 +38,7 @@ void Area2DSW::_shapes_changed() { } -void Area2DSW::set_transform(const Matrix32& p_transform) { +void Area2DSW::set_transform(const Transform2D& p_transform) { if (!moved_list.in_list() && get_space()) get_space()->area_add_to_moved_list(&moved_list); diff --git a/servers/physics_2d/area_2d_sw.h b/servers/physics_2d/area_2d_sw.h index ea991e8f6c..6e79b28afc 100644 --- a/servers/physics_2d/area_2d_sw.h +++ b/servers/physics_2d/area_2d_sw.h @@ -162,7 +162,7 @@ public: void set_monitorable(bool p_monitorable); _FORCE_INLINE_ bool is_monitorable() const { return monitorable; } - void set_transform(const Matrix32& p_transform); + void set_transform(const Transform2D& p_transform); void set_space(Space2DSW *p_space); diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp index 9d859c1107..a32e024fe9 100644 --- a/servers/physics_2d/body_2d_sw.cpp +++ b/servers/physics_2d/body_2d_sw.cpp @@ -68,7 +68,7 @@ void Body2DSW::update_inertias() { float mass = area * this->mass / total_area; - Matrix32 mtx = get_shape_transform(i); + Transform2D mtx = get_shape_transform(i); Vector2 scale = mtx.get_scale(); _inertia += shape->get_moment_of_inertia(mass,scale) + mass * mtx.get_origin().length_squared(); //Rect2 ab = get_shape_aabb(i); @@ -287,7 +287,7 @@ void Body2DSW::set_state(Physics2DServer::BodyState p_state, const Variant& p_va _set_inv_transform(get_transform().affine_inverse()); wakeup_neighbours(); } else { - Matrix32 t = p_variant; + Transform2D t = p_variant; t.orthonormalize(); new_transform=get_transform(); //used as old to compute motion if (t==new_transform) @@ -560,7 +560,7 @@ void Body2DSW::integrate_velocities(real_t p_step) { real_t angle = get_transform().get_rotation() + total_angular_velocity * p_step; Vector2 pos = get_transform().get_origin() + total_linear_velocity * p_step; - _set_transform(Matrix32(angle,pos),continuous_cd_mode==Physics2DServer::CCD_MODE_DISABLED); + _set_transform(Transform2D(angle,pos),continuous_cd_mode==Physics2DServer::CCD_MODE_DISABLED); _set_inv_transform(get_transform().inverse()); if (continuous_cd_mode!=Physics2DServer::CCD_MODE_DISABLED) diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h index 59e88f5640..bf9dcaa9b0 100644 --- a/servers/physics_2d/body_2d_sw.h +++ b/servers/physics_2d/body_2d_sw.h @@ -86,7 +86,7 @@ class Body2DSW : public CollisionObject2DSW { bool using_one_way_cache; void _update_inertia(); virtual void _shapes_changed(); - Matrix32 new_transform; + Transform2D new_transform; Map<Constraint2DSW*,int> constraint_map; @@ -373,8 +373,8 @@ public: virtual void set_angular_velocity(real_t p_velocity) { body->set_angular_velocity(p_velocity); } virtual real_t get_angular_velocity() const { return body->get_angular_velocity(); } - virtual void set_transform(const Matrix32& p_transform) { body->set_state(Physics2DServer::BODY_STATE_TRANSFORM,p_transform); } - virtual Matrix32 get_transform() const { return body->get_transform(); } + virtual void set_transform(const Transform2D& p_transform) { body->set_state(Physics2DServer::BODY_STATE_TRANSFORM,p_transform); } + virtual Transform2D get_transform() const { return body->get_transform(); } virtual void set_sleep_state(bool p_enable) { body->set_active(!p_enable); } virtual bool is_sleeping() const { return !body->is_active(); } diff --git a/servers/physics_2d/body_pair_2d_sw.cpp b/servers/physics_2d/body_pair_2d_sw.cpp index 7c00f22dfd..72ae221c39 100644 --- a/servers/physics_2d/body_pair_2d_sw.cpp +++ b/servers/physics_2d/body_pair_2d_sw.cpp @@ -175,7 +175,7 @@ void BodyPair2DSW::_validate_contacts() { } -bool BodyPair2DSW::_test_ccd(float p_step,Body2DSW *p_A, int p_shape_A,const Matrix32& p_xform_A,Body2DSW *p_B, int p_shape_B,const Matrix32& p_xform_B,bool p_swap_result) { +bool BodyPair2DSW::_test_ccd(float p_step,Body2DSW *p_A, int p_shape_A,const Transform2D& p_xform_A,Body2DSW *p_B, int p_shape_B,const Transform2D& p_xform_B,bool p_swap_result) { @@ -202,7 +202,7 @@ bool BodyPair2DSW::_test_ccd(float p_step,Body2DSW *p_A, int p_shape_A,const Mat Vector2 from = p_xform_A.xform(s[0]); Vector2 to = from + motion; - Matrix32 from_inv = p_xform_B.affine_inverse(); + Transform2D from_inv = p_xform_B.affine_inverse(); Vector2 local_from = from_inv.xform(from-mnormal*mlen*0.1); //start from a little inside the bounding box Vector2 local_to = from_inv.xform(to); @@ -245,12 +245,12 @@ bool BodyPair2DSW::setup(float p_step) { _validate_contacts(); Vector2 offset_A = A->get_transform().get_origin(); - Matrix32 xform_Au = A->get_transform().untranslated(); - Matrix32 xform_A = xform_Au * A->get_shape_transform(shape_A); + Transform2D xform_Au = A->get_transform().untranslated(); + Transform2D xform_A = xform_Au * A->get_shape_transform(shape_A); - Matrix32 xform_Bu = B->get_transform(); + Transform2D xform_Bu = B->get_transform(); xform_Bu.translate(-A->get_transform().get_origin()); - Matrix32 xform_B = xform_Bu * B->get_shape_transform(shape_B); + Transform2D xform_B = xform_Bu * B->get_shape_transform(shape_B); Shape2DSW *shape_A_ptr=A->get_shape(shape_A); Shape2DSW *shape_B_ptr=B->get_shape(shape_B); diff --git a/servers/physics_2d/body_pair_2d_sw.h b/servers/physics_2d/body_pair_2d_sw.h index a219b99fd8..b9ff1bd758 100644 --- a/servers/physics_2d/body_pair_2d_sw.h +++ b/servers/physics_2d/body_pair_2d_sw.h @@ -80,7 +80,7 @@ class BodyPair2DSW : public Constraint2DSW { int cc; - bool _test_ccd(float p_step,Body2DSW *p_A, int p_shape_A,const Matrix32& p_xform_A,Body2DSW *p_B, int p_shape_B,const Matrix32& p_xform_B,bool p_swap_result=false); + bool _test_ccd(float p_step,Body2DSW *p_A, int p_shape_A,const Transform2D& p_xform_A,Body2DSW *p_B, int p_shape_B,const Transform2D& p_xform_B,bool p_swap_result=false); void _validate_contacts(); static void _add_contact(const Vector2& p_point_A,const Vector2& p_point_B,void *p_self); _FORCE_INLINE_ void _contact_added_callback(const Vector2& p_point_A,const Vector2& p_point_B); diff --git a/servers/physics_2d/collision_object_2d_sw.cpp b/servers/physics_2d/collision_object_2d_sw.cpp index 94e5d668b1..9ae0e40417 100644 --- a/servers/physics_2d/collision_object_2d_sw.cpp +++ b/servers/physics_2d/collision_object_2d_sw.cpp @@ -29,7 +29,7 @@ #include "collision_object_2d_sw.h" #include "space_2d_sw.h" -void CollisionObject2DSW::add_shape(Shape2DSW *p_shape,const Matrix32& p_transform) { +void CollisionObject2DSW::add_shape(Shape2DSW *p_shape,const Transform2D& p_transform) { Shape s; s.shape=p_shape; @@ -63,7 +63,7 @@ void CollisionObject2DSW::set_shape_metadata(int p_index,const Variant& p_metada } -void CollisionObject2DSW::set_shape_transform(int p_index,const Matrix32& p_transform){ +void CollisionObject2DSW::set_shape_transform(int p_index,const Transform2D& p_transform){ ERR_FAIL_INDEX(p_index,shapes.size()); @@ -149,7 +149,7 @@ void CollisionObject2DSW::_update_shapes() { //not quite correct, should compute the next matrix.. Rect2 shape_aabb=s.shape->get_aabb(); - Matrix32 xform = transform * s.xform; + Transform2D xform = transform * s.xform; shape_aabb=xform.xform(shape_aabb); s.aabb_cache=shape_aabb; s.aabb_cache=s.aabb_cache.grow( (s.aabb_cache.size.x + s.aabb_cache.size.y)*0.5*0.05 ); @@ -176,7 +176,7 @@ void CollisionObject2DSW::_update_shapes_with_motion(const Vector2& p_motion) { //not quite correct, should compute the next matrix.. Rect2 shape_aabb=s.shape->get_aabb(); - Matrix32 xform = transform * s.xform; + Transform2D xform = transform * s.xform; shape_aabb=xform.xform(shape_aabb); shape_aabb=shape_aabb.merge(Rect2( shape_aabb.pos+p_motion,shape_aabb.size)); //use motion s.aabb_cache=shape_aabb; diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h index cf26a28ec4..0f77e9b426 100644 --- a/servers/physics_2d/collision_object_2d_sw.h +++ b/servers/physics_2d/collision_object_2d_sw.h @@ -51,8 +51,8 @@ private: struct Shape { - Matrix32 xform; - Matrix32 xform_inv; + Transform2D xform; + Transform2D xform_inv; BroadPhase2DSW::ID bpid; Rect2 aabb_cache; //for rayqueries Shape2DSW *shape; @@ -63,8 +63,8 @@ private: Vector<Shape> shapes; Space2DSW *space; - Matrix32 transform; - Matrix32 inv_transform; + Transform2D transform; + Transform2D inv_transform; uint32_t collision_mask; uint32_t layer_mask; bool _static; @@ -77,8 +77,8 @@ protected: void _update_shapes_with_motion(const Vector2& p_motion); void _unregister_shapes(); - _FORCE_INLINE_ void _set_transform(const Matrix32& p_transform, bool p_update_shapes=true) { transform=p_transform; if (p_update_shapes) {_update_shapes();} } - _FORCE_INLINE_ void _set_inv_transform(const Matrix32& p_transform) { inv_transform=p_transform; } + _FORCE_INLINE_ void _set_transform(const Transform2D& p_transform, bool p_update_shapes=true) { transform=p_transform; if (p_update_shapes) {_update_shapes();} } + _FORCE_INLINE_ void _set_inv_transform(const Transform2D& p_transform) { inv_transform=p_transform; } void _set_static(bool p_static); virtual void _shapes_changed()=0; @@ -96,21 +96,21 @@ public: void _shape_changed(); _FORCE_INLINE_ Type get_type() const { return type; } - void add_shape(Shape2DSW *p_shape,const Matrix32& p_transform=Matrix32()); + void add_shape(Shape2DSW *p_shape,const Transform2D& p_transform=Transform2D()); void set_shape(int p_index,Shape2DSW *p_shape); - void set_shape_transform(int p_index,const Matrix32& p_transform); + void set_shape_transform(int p_index,const Transform2D& p_transform); void set_shape_metadata(int p_index,const Variant& p_metadata); _FORCE_INLINE_ int get_shape_count() const { return shapes.size(); } _FORCE_INLINE_ Shape2DSW *get_shape(int p_index) const { return shapes[p_index].shape; } - _FORCE_INLINE_ const Matrix32& get_shape_transform(int p_index) const { return shapes[p_index].xform; } - _FORCE_INLINE_ const Matrix32& get_shape_inv_transform(int p_index) const { return shapes[p_index].xform_inv; } + _FORCE_INLINE_ const Transform2D& get_shape_transform(int p_index) const { return shapes[p_index].xform; } + _FORCE_INLINE_ const Transform2D& get_shape_inv_transform(int p_index) const { return shapes[p_index].xform_inv; } _FORCE_INLINE_ const Rect2& get_shape_aabb(int p_index) const { return shapes[p_index].aabb_cache; } _FORCE_INLINE_ const Variant& get_shape_metadata(int p_index) const { return shapes[p_index].metadata; } - _FORCE_INLINE_ Matrix32 get_transform() const { return transform; } - _FORCE_INLINE_ Matrix32 get_inv_transform() const { return inv_transform; } + _FORCE_INLINE_ Transform2D get_transform() const { return transform; } + _FORCE_INLINE_ Transform2D get_inv_transform() const { return inv_transform; } _FORCE_INLINE_ Space2DSW* get_space() const { return space; } _FORCE_INLINE_ void set_shape_as_trigger(int p_idx,bool p_enable) { shapes[p_idx].trigger=p_enable; } diff --git a/servers/physics_2d/collision_solver_2d_sat.cpp b/servers/physics_2d/collision_solver_2d_sat.cpp index d4ab2c3bc6..2e7b0d8835 100644 --- a/servers/physics_2d/collision_solver_2d_sat.cpp +++ b/servers/physics_2d/collision_solver_2d_sat.cpp @@ -343,8 +343,8 @@ class SeparatorAxisTest2D { const ShapeA *shape_A; const ShapeB *shape_B; - const Matrix32 *transform_A; - const Matrix32 *transform_B; + const Transform2D *transform_A; + const Transform2D *transform_B; real_t best_depth; Vector2 best_axis; int best_axis_count; @@ -560,7 +560,7 @@ public: } - _FORCE_INLINE_ SeparatorAxisTest2D(const ShapeA *p_shape_A,const Matrix32& p_transform_a, const ShapeB *p_shape_B,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_A=Vector2(), const Vector2& p_motion_B=Vector2(),real_t p_margin_A=0,real_t p_margin_B=0) { + _FORCE_INLINE_ SeparatorAxisTest2D(const ShapeA *p_shape_A,const Transform2D& p_transform_a, const ShapeB *p_shape_B,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_A=Vector2(), const Vector2& p_motion_B=Vector2(),real_t p_margin_A=0,real_t p_margin_B=0) { margin_A=p_margin_A; margin_B=p_margin_B; @@ -594,11 +594,11 @@ public: (castA && castB && !separator.test_axis(((m_a)+p_motion_a-((m_b)+p_motion_b)).normalized())) ) -typedef void (*CollisionFunc)(const Shape2DSW*,const Matrix32&,const Shape2DSW*,const Matrix32&,_CollectorCallback2D *p_collector,const Vector2&,const Vector2&,float,float); +typedef void (*CollisionFunc)(const Shape2DSW*,const Transform2D&,const Shape2DSW*,const Transform2D&,_CollectorCallback2D *p_collector,const Vector2&,const Vector2&,float,float); template<bool castA, bool castB,bool withMargin> -static void _collision_segment_segment(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_segment_segment(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const SegmentShape2DSW *segment_A = static_cast<const SegmentShape2DSW*>(p_a); const SegmentShape2DSW *segment_B = static_cast<const SegmentShape2DSW*>(p_b); @@ -641,7 +641,7 @@ static void _collision_segment_segment(const Shape2DSW* p_a,const Matrix32& p_tr } template<bool castA, bool castB,bool withMargin> -static void _collision_segment_circle(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_segment_circle(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const SegmentShape2DSW *segment_A = static_cast<const SegmentShape2DSW*>(p_a); @@ -674,7 +674,7 @@ static void _collision_segment_circle(const Shape2DSW* p_a,const Matrix32& p_tra } template<bool castA, bool castB,bool withMargin> -static void _collision_segment_rectangle(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_segment_rectangle(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const SegmentShape2DSW *segment_A = static_cast<const SegmentShape2DSW*>(p_a); const RectangleShape2DSW *rectangle_B = static_cast<const RectangleShape2DSW*>(p_b); @@ -698,7 +698,7 @@ static void _collision_segment_rectangle(const Shape2DSW* p_a,const Matrix32& p_ if (withMargin) { - Matrix32 inv = p_transform_b.affine_inverse(); + Transform2D inv = p_transform_b.affine_inverse(); Vector2 a = p_transform_a.xform(segment_A->get_a()); Vector2 b = p_transform_a.xform(segment_A->get_b()); @@ -739,7 +739,7 @@ static void _collision_segment_rectangle(const Shape2DSW* p_a,const Matrix32& p_ } template<bool castA, bool castB,bool withMargin> -static void _collision_segment_capsule(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_segment_capsule(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const SegmentShape2DSW *segment_A = static_cast<const SegmentShape2DSW*>(p_a); const CapsuleShape2DSW *capsule_B = static_cast<const CapsuleShape2DSW*>(p_b); @@ -771,7 +771,7 @@ static void _collision_segment_capsule(const Shape2DSW* p_a,const Matrix32& p_tr } template<bool castA, bool castB,bool withMargin> -static void _collision_segment_convex_polygon(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_segment_convex_polygon(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const SegmentShape2DSW *segment_A = static_cast<const SegmentShape2DSW*>(p_a); const ConvexPolygonShape2DSW *convex_B = static_cast<const ConvexPolygonShape2DSW*>(p_b); @@ -811,7 +811,7 @@ static void _collision_segment_convex_polygon(const Shape2DSW* p_a,const Matrix3 ///////// template<bool castA, bool castB,bool withMargin> -static void _collision_circle_circle(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_circle_circle(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const CircleShape2DSW *circle_A = static_cast<const CircleShape2DSW*>(p_a); const CircleShape2DSW *circle_B = static_cast<const CircleShape2DSW*>(p_b); @@ -834,7 +834,7 @@ static void _collision_circle_circle(const Shape2DSW* p_a,const Matrix32& p_tran } template<bool castA, bool castB,bool withMargin> -static void _collision_circle_rectangle(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_circle_rectangle(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const CircleShape2DSW *circle_A = static_cast<const CircleShape2DSW*>(p_a); const RectangleShape2DSW *rectangle_B = static_cast<const RectangleShape2DSW*>(p_b); @@ -858,7 +858,7 @@ static void _collision_circle_rectangle(const Shape2DSW* p_a,const Matrix32& p_t if (!separator.test_axis(axis[1].normalized())) return; - Matrix32 binv = p_transform_b.affine_inverse(); + Transform2D binv = p_transform_b.affine_inverse(); { if (!separator.test_axis( rectangle_B->get_circle_axis(p_transform_b,binv,sphere ) ) ) @@ -890,7 +890,7 @@ static void _collision_circle_rectangle(const Shape2DSW* p_a,const Matrix32& p_t } template<bool castA, bool castB,bool withMargin> -static void _collision_circle_capsule(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_circle_capsule(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const CircleShape2DSW *circle_A = static_cast<const CircleShape2DSW*>(p_a); const CapsuleShape2DSW *capsule_B = static_cast<const CapsuleShape2DSW*>(p_b); @@ -920,7 +920,7 @@ static void _collision_circle_capsule(const Shape2DSW* p_a,const Matrix32& p_tra } template<bool castA, bool castB,bool withMargin> -static void _collision_circle_convex_polygon(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_circle_convex_polygon(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const CircleShape2DSW *circle_A = static_cast<const CircleShape2DSW*>(p_a); const ConvexPolygonShape2DSW *convex_B = static_cast<const ConvexPolygonShape2DSW*>(p_b); @@ -952,7 +952,7 @@ static void _collision_circle_convex_polygon(const Shape2DSW* p_a,const Matrix32 ///////// template<bool castA, bool castB,bool withMargin> -static void _collision_rectangle_rectangle(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_rectangle_rectangle(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const RectangleShape2DSW *rectangle_A = static_cast<const RectangleShape2DSW*>(p_a); const RectangleShape2DSW *rectangle_B = static_cast<const RectangleShape2DSW*>(p_b); @@ -982,22 +982,22 @@ static void _collision_rectangle_rectangle(const Shape2DSW* p_a,const Matrix32& if (withMargin) { - Matrix32 invA=p_transform_a.affine_inverse(); - Matrix32 invB=p_transform_b.affine_inverse(); + Transform2D invA=p_transform_a.affine_inverse(); + Transform2D invB=p_transform_b.affine_inverse(); if (!separator.test_axis( rectangle_A->get_box_axis(p_transform_a,invA,rectangle_B,p_transform_b,invB) ) ) return; if (castA || castB) { - Matrix32 aofs = p_transform_a; + Transform2D aofs = p_transform_a; aofs.elements[2]+=p_motion_a; - Matrix32 bofs = p_transform_b; + Transform2D bofs = p_transform_b; bofs.elements[2]+=p_motion_b; - Matrix32 aofsinv = aofs.affine_inverse(); - Matrix32 bofsinv = bofs.affine_inverse(); + Transform2D aofsinv = aofs.affine_inverse(); + Transform2D bofsinv = bofs.affine_inverse(); if (castA) { @@ -1023,7 +1023,7 @@ static void _collision_rectangle_rectangle(const Shape2DSW* p_a,const Matrix32& } template<bool castA, bool castB,bool withMargin> -static void _collision_rectangle_capsule(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_rectangle_capsule(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const RectangleShape2DSW *rectangle_A = static_cast<const RectangleShape2DSW*>(p_a); const CapsuleShape2DSW *capsule_B = static_cast<const CapsuleShape2DSW*>(p_b); @@ -1051,7 +1051,7 @@ static void _collision_rectangle_capsule(const Shape2DSW* p_a,const Matrix32& p_ //box endpoints to capsule circles - Matrix32 boxinv = p_transform_a.affine_inverse(); + Transform2D boxinv = p_transform_a.affine_inverse(); for(int i=0;i<2;i++) { @@ -1096,7 +1096,7 @@ static void _collision_rectangle_capsule(const Shape2DSW* p_a,const Matrix32& p_ } template<bool castA, bool castB,bool withMargin> -static void _collision_rectangle_convex_polygon(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_rectangle_convex_polygon(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const RectangleShape2DSW *rectangle_A = static_cast<const RectangleShape2DSW*>(p_a); const ConvexPolygonShape2DSW *convex_B = static_cast<const ConvexPolygonShape2DSW*>(p_b); @@ -1118,7 +1118,7 @@ static void _collision_rectangle_convex_polygon(const Shape2DSW* p_a,const Matri return; //convex faces - Matrix32 boxinv; + Transform2D boxinv; if (withMargin) { boxinv=p_transform_a.affine_inverse(); } @@ -1158,7 +1158,7 @@ static void _collision_rectangle_convex_polygon(const Shape2DSW* p_a,const Matri ///////// template<bool castA, bool castB,bool withMargin> -static void _collision_capsule_capsule(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_capsule_capsule(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const CapsuleShape2DSW *capsule_A = static_cast<const CapsuleShape2DSW*>(p_a); const CapsuleShape2DSW *capsule_B = static_cast<const CapsuleShape2DSW*>(p_b); @@ -1201,7 +1201,7 @@ static void _collision_capsule_capsule(const Shape2DSW* p_a,const Matrix32& p_tr } template<bool castA, bool castB,bool withMargin> -static void _collision_capsule_convex_polygon(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_capsule_convex_polygon(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const CapsuleShape2DSW *capsule_A = static_cast<const CapsuleShape2DSW*>(p_a); const ConvexPolygonShape2DSW *convex_B = static_cast<const ConvexPolygonShape2DSW*>(p_b); @@ -1247,7 +1247,7 @@ static void _collision_capsule_convex_polygon(const Shape2DSW* p_a,const Matrix3 template<bool castA, bool castB,bool withMargin> -static void _collision_convex_polygon_convex_polygon(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { +static void _collision_convex_polygon_convex_polygon(const Shape2DSW* p_a,const Transform2D& p_transform_a,const Shape2DSW* p_b,const Transform2D& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) { const ConvexPolygonShape2DSW *convex_A = static_cast<const ConvexPolygonShape2DSW*>(p_a); @@ -1294,7 +1294,7 @@ static void _collision_convex_polygon_convex_polygon(const Shape2DSW* p_a,const //////// -bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Matrix32& p_transform_A, const Vector2& p_motion_A, const Shape2DSW *p_shape_B, const Matrix32& p_transform_B,const Vector2& p_motion_B, CollisionSolver2DSW::CallbackResult p_result_callback,void *p_userdata, bool p_swap,Vector2 *sep_axis,float p_margin_A,float p_margin_B) { +bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D& p_transform_A, const Vector2& p_motion_A, const Shape2DSW *p_shape_B, const Transform2D& p_transform_B,const Vector2& p_motion_B, CollisionSolver2DSW::CallbackResult p_result_callback,void *p_userdata, bool p_swap,Vector2 *sep_axis,float p_margin_A,float p_margin_B) { Physics2DServer::ShapeType type_A=p_shape_A->get_type(); @@ -1551,8 +1551,8 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Matrix32& p_ const Shape2DSW *A=p_shape_A; const Shape2DSW *B=p_shape_B; - const Matrix32 *transform_A=&p_transform_A; - const Matrix32 *transform_B=&p_transform_B; + const Transform2D *transform_A=&p_transform_A; + const Transform2D *transform_B=&p_transform_B; const Vector2 *motion_A=&p_motion_A; const Vector2 *motion_B=&p_motion_B; real_t margin_A=p_margin_A,margin_B=p_margin_B; diff --git a/servers/physics_2d/collision_solver_2d_sat.h b/servers/physics_2d/collision_solver_2d_sat.h index b885dba91b..01acf319c7 100644 --- a/servers/physics_2d/collision_solver_2d_sat.h +++ b/servers/physics_2d/collision_solver_2d_sat.h @@ -32,6 +32,6 @@ #include "collision_solver_2d_sw.h" -bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Matrix32& p_transform_A, const Vector2& p_motion_A,const Shape2DSW *p_shape_B, const Matrix32& p_transform_B,const Vector2& p_motion_B, CollisionSolver2DSW::CallbackResult p_result_callback,void *p_userdata, bool p_swap=false,Vector2 *sep_axis=NULL,float p_margin_A=0,float p_margin_B=0); +bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D& p_transform_A, const Vector2& p_motion_A,const Shape2DSW *p_shape_B, const Transform2D& p_transform_B,const Vector2& p_motion_B, CollisionSolver2DSW::CallbackResult p_result_callback,void *p_userdata, bool p_swap=false,Vector2 *sep_axis=NULL,float p_margin_A=0,float p_margin_B=0); #endif // COLLISION_SOLVER_2D_SAT_H diff --git a/servers/physics_2d/collision_solver_2d_sw.cpp b/servers/physics_2d/collision_solver_2d_sw.cpp index 079b0499c2..e509bb76cd 100644 --- a/servers/physics_2d/collision_solver_2d_sw.cpp +++ b/servers/physics_2d/collision_solver_2d_sw.cpp @@ -34,7 +34,7 @@ //#define collision_solver gjk_epa_calculate_penetration -bool CollisionSolver2DSW::solve_static_line(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result) { +bool CollisionSolver2DSW::solve_static_line(const Shape2DSW *p_shape_A,const Transform2D& p_transform_A,const Shape2DSW *p_shape_B,const Transform2D& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result) { const LineShape2DSW *line = static_cast<const LineShape2DSW*>(p_shape_A); @@ -77,7 +77,7 @@ bool CollisionSolver2DSW::solve_static_line(const Shape2DSW *p_shape_A,const Mat return found; } -bool CollisionSolver2DSW::solve_raycast(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis) { +bool CollisionSolver2DSW::solve_raycast(const Shape2DSW *p_shape_A,const Transform2D& p_transform_A,const Shape2DSW *p_shape_B,const Transform2D& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis) { @@ -89,7 +89,7 @@ bool CollisionSolver2DSW::solve_raycast(const Shape2DSW *p_shape_A,const Matrix3 Vector2 to = from+p_transform_A[1]*ray->get_length(); Vector2 support_A=to; - Matrix32 invb = p_transform_B.affine_inverse(); + Transform2D invb = p_transform_B.affine_inverse(); from = invb.xform(from); to = invb.xform(to); @@ -145,9 +145,9 @@ bool CollisionSolver2DSW::solve_ray(const Shape2DSW *p_shape_A,const Matrix32& p struct _ConcaveCollisionInfo2D { - const Matrix32 *transform_A; + const Transform2D *transform_A; const Shape2DSW *shape_A; - const Matrix32 *transform_B; + const Transform2D *transform_B; Vector2 motion_A; Vector2 motion_B; real_t margin_A; @@ -181,7 +181,7 @@ void CollisionSolver2DSW::concave_callback(void *p_userdata, Shape2DSW *p_convex } -bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Vector2& p_motion_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Vector2& p_motion_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis,float p_margin_A,float p_margin_B) { +bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A,const Transform2D& p_transform_A,const Vector2& p_motion_A,const Shape2DSW *p_shape_B,const Transform2D& p_transform_B,const Vector2& p_motion_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis,float p_margin_A,float p_margin_B) { const ConcaveShape2DSW *concave_B=static_cast<const ConcaveShape2DSW*>(p_shape_B); @@ -202,7 +202,7 @@ bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A,const Matrix3 cinfo.aabb_tests=0; - Matrix32 rel_transform = p_transform_A; + Transform2D rel_transform = p_transform_A; rel_transform.translate(-p_transform_B.get_origin()); //quickly compute a local Rect2 @@ -231,7 +231,7 @@ bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A,const Matrix3 } -bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Vector2& p_motion_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Vector2& p_motion_B,CallbackResult p_result_callback,void *p_userdata,Vector2 *sep_axis,float p_margin_A,float p_margin_B) { +bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A,const Transform2D& p_transform_A,const Vector2& p_motion_A,const Shape2DSW *p_shape_B,const Transform2D& p_transform_B,const Vector2& p_motion_B,CallbackResult p_result_callback,void *p_userdata,Vector2 *sep_axis,float p_margin_A,float p_margin_B) { diff --git a/servers/physics_2d/collision_solver_2d_sw.h b/servers/physics_2d/collision_solver_2d_sw.h index 8e421dec70..085d3a49fb 100644 --- a/servers/physics_2d/collision_solver_2d_sw.h +++ b/servers/physics_2d/collision_solver_2d_sw.h @@ -35,16 +35,16 @@ class CollisionSolver2DSW { public: typedef void (*CallbackResult)(const Vector2& p_point_A,const Vector2& p_point_B,void *p_userdata); private: - static bool solve_static_line(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result); + static bool solve_static_line(const Shape2DSW *p_shape_A,const Transform2D& p_transform_A,const Shape2DSW *p_shape_B,const Transform2D& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result); static void concave_callback(void *p_userdata, Shape2DSW *p_convex); - static bool solve_concave(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Vector2& p_motion_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Vector2& p_motion_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis=NULL,float p_margin_A=0,float p_margin_B=0); - static bool solve_raycast(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis=NULL); + static bool solve_concave(const Shape2DSW *p_shape_A,const Transform2D& p_transform_A,const Vector2& p_motion_A,const Shape2DSW *p_shape_B,const Transform2D& p_transform_B,const Vector2& p_motion_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis=NULL,float p_margin_A=0,float p_margin_B=0); + static bool solve_raycast(const Shape2DSW *p_shape_A,const Transform2D& p_transform_A,const Shape2DSW *p_shape_B,const Transform2D& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,Vector2 *sep_axis=NULL); public: - static bool solve(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Vector2& p_motion_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Vector2& p_motion_B,CallbackResult p_result_callback,void *p_userdata,Vector2 *sep_axis=NULL,float p_margin_A=0,float p_margin_B=0); + static bool solve(const Shape2DSW *p_shape_A,const Transform2D& p_transform_A,const Vector2& p_motion_A,const Shape2DSW *p_shape_B,const Transform2D& p_transform_B,const Vector2& p_motion_B,CallbackResult p_result_callback,void *p_userdata,Vector2 *sep_axis=NULL,float p_margin_A=0,float p_margin_B=0); }; diff --git a/servers/physics_2d/joints_2d_sw.cpp b/servers/physics_2d/joints_2d_sw.cpp index 5318212120..7205e90d27 100644 --- a/servers/physics_2d/joints_2d_sw.cpp +++ b/servers/physics_2d/joints_2d_sw.cpp @@ -215,21 +215,21 @@ bool PinJoint2DSW::setup(float p_step) { real_t B_inv_mass = B?B->get_inv_mass():0.0; - Matrix32 K1; + Transform2D K1; K1[0].x = A->get_inv_mass() + B_inv_mass; K1[1].x = 0.0f; K1[0].y = 0.0f; K1[1].y = A->get_inv_mass() + B_inv_mass; - Matrix32 K2; + Transform2D K2; K2[0].x = A->get_inv_inertia() * rA.y * rA.y; K2[1].x = -A->get_inv_inertia() * rA.x * rA.y; K2[0].y = -A->get_inv_inertia() * rA.x * rA.y; K2[1].y = A->get_inv_inertia() * rA.x * rA.x; - Matrix32 K; + Transform2D K; K[0]= K1[0] + K2[0]; K[1]= K1[1] + K2[1]; if (B) { - Matrix32 K3; + Transform2D K3; K3[0].x = B->get_inv_inertia() * rB.y * rB.y; K3[1].x = -B->get_inv_inertia() * rB.x * rB.y; K3[0].y = -B->get_inv_inertia() * rB.x * rB.y; K3[1].y = B->get_inv_inertia() * rB.x * rB.x; diff --git a/servers/physics_2d/joints_2d_sw.h b/servers/physics_2d/joints_2d_sw.h index cbbb6e6db3..91113fa26d 100644 --- a/servers/physics_2d/joints_2d_sw.h +++ b/servers/physics_2d/joints_2d_sw.h @@ -106,7 +106,7 @@ class PinJoint2DSW : public Joint2DSW { Body2DSW *_arr[2]; }; - Matrix32 M; + Transform2D M; Vector2 rA,rB; Vector2 anchor_A; Vector2 anchor_B; diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index abd83c0346..3cc69f470e 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -185,7 +185,7 @@ void Physics2DServerSW::_shape_col_cbk(const Vector2& p_point_A,const Vector2& p } } -bool Physics2DServerSW::shape_collide(RID p_shape_A, const Matrix32& p_xform_A,const Vector2& p_motion_A,RID p_shape_B, const Matrix32& p_xform_B, const Vector2& p_motion_B,Vector2 *r_results,int p_result_max,int &r_result_count) { +bool Physics2DServerSW::shape_collide(RID p_shape_A, const Transform2D& p_xform_A,const Vector2& p_motion_A,RID p_shape_B, const Transform2D& p_xform_B, const Vector2& p_motion_B,Vector2 *r_results,int p_result_max,int &r_result_count) { Shape2DSW *shape_A = shape_owner.get(p_shape_A); @@ -348,7 +348,7 @@ Physics2DServer::AreaSpaceOverrideMode Physics2DServerSW::area_get_space_overrid } -void Physics2DServerSW::area_add_shape(RID p_area, RID p_shape, const Matrix32& p_transform) { +void Physics2DServerSW::area_add_shape(RID p_area, RID p_shape, const Transform2D& p_transform) { Area2DSW *area = area_owner.get(p_area); ERR_FAIL_COND(!area); @@ -372,7 +372,7 @@ void Physics2DServerSW::area_set_shape(RID p_area, int p_shape_idx,RID p_shape) area->set_shape(p_shape_idx,shape); } -void Physics2DServerSW::area_set_shape_transform(RID p_area, int p_shape_idx, const Matrix32& p_transform) { +void Physics2DServerSW::area_set_shape_transform(RID p_area, int p_shape_idx, const Transform2D& p_transform) { Area2DSW *area = area_owner.get(p_area); ERR_FAIL_COND(!area); @@ -398,10 +398,10 @@ RID Physics2DServerSW::area_get_shape(RID p_area, int p_shape_idx) const { return shape->get_self(); } -Matrix32 Physics2DServerSW::area_get_shape_transform(RID p_area, int p_shape_idx) const { +Transform2D Physics2DServerSW::area_get_shape_transform(RID p_area, int p_shape_idx) const { Area2DSW *area = area_owner.get(p_area); - ERR_FAIL_COND_V(!area,Matrix32()); + ERR_FAIL_COND_V(!area,Transform2D()); return area->get_shape_transform(p_shape_idx); } @@ -462,7 +462,7 @@ void Physics2DServerSW::area_set_param(RID p_area,AreaParameter p_param,const Va }; -void Physics2DServerSW::area_set_transform(RID p_area, const Matrix32& p_transform) { +void Physics2DServerSW::area_set_transform(RID p_area, const Transform2D& p_transform) { Area2DSW *area = area_owner.get(p_area); ERR_FAIL_COND(!area); @@ -482,10 +482,10 @@ Variant Physics2DServerSW::area_get_param(RID p_area,AreaParameter p_param) cons return area->get_param(p_param); }; -Matrix32 Physics2DServerSW::area_get_transform(RID p_area) const { +Transform2D Physics2DServerSW::area_get_transform(RID p_area) const { Area2DSW *area = area_owner.get(p_area); - ERR_FAIL_COND_V(!area,Matrix32()); + ERR_FAIL_COND_V(!area,Transform2D()); return area->get_transform(); }; @@ -600,7 +600,7 @@ Physics2DServer::BodyMode Physics2DServerSW::body_get_mode(RID p_body) const { return body->get_mode(); }; -void Physics2DServerSW::body_add_shape(RID p_body, RID p_shape, const Matrix32& p_transform) { +void Physics2DServerSW::body_add_shape(RID p_body, RID p_shape, const Transform2D& p_transform) { Body2DSW *body = body_owner.get(p_body); ERR_FAIL_COND(!body); @@ -624,7 +624,7 @@ void Physics2DServerSW::body_set_shape(RID p_body, int p_shape_idx,RID p_shape) body->set_shape(p_shape_idx,shape); } -void Physics2DServerSW::body_set_shape_transform(RID p_body, int p_shape_idx, const Matrix32& p_transform) { +void Physics2DServerSW::body_set_shape_transform(RID p_body, int p_shape_idx, const Transform2D& p_transform) { Body2DSW *body = body_owner.get(p_body); ERR_FAIL_COND(!body); @@ -666,10 +666,10 @@ RID Physics2DServerSW::body_get_shape(RID p_body, int p_shape_idx) const { return shape->get_self(); } -Matrix32 Physics2DServerSW::body_get_shape_transform(RID p_body, int p_shape_idx) const { +Transform2D Physics2DServerSW::body_get_shape_transform(RID p_body, int p_shape_idx) const { Body2DSW *body = body_owner.get(p_body); - ERR_FAIL_COND_V(!body,Matrix32()); + ERR_FAIL_COND_V(!body,Transform2D()); return body->get_shape_transform(p_shape_idx); } @@ -998,7 +998,7 @@ void Physics2DServerSW::body_set_force_integration_callback(RID p_body,Object *p } -bool Physics2DServerSW::body_collide_shape(RID p_body, int p_body_shape, RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,Vector2 *r_results,int p_result_max,int &r_result_count) { +bool Physics2DServerSW::body_collide_shape(RID p_body, int p_body_shape, RID p_shape, const Transform2D& p_shape_xform,const Vector2& p_motion,Vector2 *r_results,int p_result_max,int &r_result_count) { Body2DSW *body = body_owner.get(p_body); ERR_FAIL_COND_V(!body,false); @@ -1016,7 +1016,7 @@ void Physics2DServerSW::body_set_pickable(RID p_body,bool p_pickable) { } -bool Physics2DServerSW::body_test_motion(RID p_body, const Matrix32 &p_from, const Vector2& p_motion, float p_margin, MotionResult *r_result) { +bool Physics2DServerSW::body_test_motion(RID p_body, const Transform2D &p_from, const Vector2& p_motion, float p_margin, MotionResult *r_result) { Body2DSW *body = body_owner.get(p_body); ERR_FAIL_COND_V(!body,false); diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h index f290e9391f..ba45dd9272 100644 --- a/servers/physics_2d/physics_2d_server_sw.h +++ b/servers/physics_2d/physics_2d_server_sw.h @@ -93,7 +93,7 @@ public: virtual Variant shape_get_data(RID p_shape) const; virtual real_t shape_get_custom_solver_bias(RID p_shape) const; - virtual bool shape_collide(RID p_shape_A, const Matrix32& p_xform_A,const Vector2& p_motion_A,RID p_shape_B, const Matrix32& p_xform_B, const Vector2& p_motion_B,Vector2 *r_results,int p_result_max,int &r_result_count); + virtual bool shape_collide(RID p_shape_A, const Transform2D& p_xform_A,const Vector2& p_motion_A,RID p_shape_B, const Transform2D& p_xform_B, const Vector2& p_motion_B,Vector2 *r_results,int p_result_max,int &r_result_count); /* SPACE API */ @@ -123,13 +123,13 @@ public: virtual void area_set_space(RID p_area, RID p_space); virtual RID area_get_space(RID p_area) const; - virtual void area_add_shape(RID p_area, RID p_shape, const Matrix32& p_transform=Matrix32()); + virtual void area_add_shape(RID p_area, RID p_shape, const Transform2D& p_transform=Transform2D()); virtual void area_set_shape(RID p_area, int p_shape_idx,RID p_shape); - virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Matrix32& p_transform); + virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Transform2D& p_transform); virtual int area_get_shape_count(RID p_area) const; virtual RID area_get_shape(RID p_area, int p_shape_idx) const; - virtual Matrix32 area_get_shape_transform(RID p_area, int p_shape_idx) const; + virtual Transform2D area_get_shape_transform(RID p_area, int p_shape_idx) const; virtual void area_remove_shape(RID p_area, int p_shape_idx); virtual void area_clear_shapes(RID p_area); @@ -138,10 +138,10 @@ public: virtual ObjectID area_get_object_instance_ID(RID p_area) const; virtual void area_set_param(RID p_area,AreaParameter p_param,const Variant& p_value); - virtual void area_set_transform(RID p_area, const Matrix32& p_transform); + virtual void area_set_transform(RID p_area, const Transform2D& p_transform); virtual Variant area_get_param(RID p_parea,AreaParameter p_param) const; - virtual Matrix32 area_get_transform(RID p_area) const; + virtual Transform2D area_get_transform(RID p_area) const; virtual void area_set_monitorable(RID p_area,bool p_monitorable); virtual void area_set_collision_mask(RID p_area,uint32_t p_mask); virtual void area_set_layer_mask(RID p_area,uint32_t p_mask); @@ -163,15 +163,15 @@ public: virtual void body_set_mode(RID p_body, BodyMode p_mode); virtual BodyMode body_get_mode(RID p_body) const; - virtual void body_add_shape(RID p_body, RID p_shape, const Matrix32& p_transform=Matrix32()); + virtual void body_add_shape(RID p_body, RID p_shape, const Transform2D& p_transform=Transform2D()); virtual void body_set_shape(RID p_body, int p_shape_idx,RID p_shape); - virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Matrix32& p_transform); + virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform2D& p_transform); virtual void body_set_shape_metadata(RID p_body, int p_shape_idx, const Variant& p_metadata); virtual int body_get_shape_count(RID p_body) const; virtual RID body_get_shape(RID p_body, int p_shape_idx) const; - virtual Matrix32 body_get_shape_transform(RID p_body, int p_shape_idx) const; + virtual Transform2D body_get_shape_transform(RID p_body, int p_shape_idx) const; virtual Variant body_get_shape_metadata(RID p_body, int p_shape_idx) const; @@ -232,11 +232,11 @@ public: virtual void body_set_force_integration_callback(RID p_body,Object *p_receiver,const StringName& p_method,const Variant& p_udata=Variant()); - virtual bool body_collide_shape(RID p_body, int p_body_shape,RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,Vector2 *r_results,int p_result_max,int &r_result_count); + virtual bool body_collide_shape(RID p_body, int p_body_shape,RID p_shape, const Transform2D& p_shape_xform,const Vector2& p_motion,Vector2 *r_results,int p_result_max,int &r_result_count); virtual void body_set_pickable(RID p_body,bool p_pickable); - virtual bool body_test_motion(RID p_body,const Matrix32& p_from,const Vector2& p_motion,float p_margin=0.001,MotionResult *r_result=NULL); + virtual bool body_test_motion(RID p_body,const Transform2D& p_from,const Vector2& p_motion,float p_margin=0.001,MotionResult *r_result=NULL); /* JOINT API */ diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h index a8e150d8f2..851ba901ec 100644 --- a/servers/physics_2d/physics_2d_server_wrap_mt.h +++ b/servers/physics_2d/physics_2d_server_wrap_mt.h @@ -100,7 +100,7 @@ public: //these work well, but should be used from the main thread only - bool shape_collide(RID p_shape_A, const Matrix32& p_xform_A,const Vector2& p_motion_A,RID p_shape_B, const Matrix32& p_xform_B, const Vector2& p_motion_B,Vector2 *r_results,int p_result_max,int &r_result_count) { + bool shape_collide(RID p_shape_A, const Transform2D& p_xform_A,const Vector2& p_motion_A,RID p_shape_B, const Transform2D& p_xform_B, const Vector2& p_motion_B,Vector2 *r_results,int p_result_max,int &r_result_count) { ERR_FAIL_COND_V(main_thread!=Thread::get_caller_ID(),false); return physics_2d_server->shape_collide(p_shape_A,p_xform_A,p_motion_A,p_shape_B,p_xform_B,p_motion_B,r_results,p_result_max,r_result_count); @@ -150,13 +150,13 @@ public: FUNC2(area_set_space_override_mode,RID,AreaSpaceOverrideMode); FUNC1RC(AreaSpaceOverrideMode,area_get_space_override_mode,RID); - FUNC3(area_add_shape,RID,RID,const Matrix32&); + FUNC3(area_add_shape,RID,RID,const Transform2D&); FUNC3(area_set_shape,RID,int,RID); - FUNC3(area_set_shape_transform,RID,int,const Matrix32&); + FUNC3(area_set_shape_transform,RID,int,const Transform2D&); FUNC1RC(int,area_get_shape_count,RID); FUNC2RC(RID,area_get_shape,RID,int); - FUNC2RC(Matrix32,area_get_shape_transform,RID,int); + FUNC2RC(Transform2D,area_get_shape_transform,RID,int); FUNC2(area_remove_shape,RID,int); FUNC1(area_clear_shapes,RID); @@ -164,10 +164,10 @@ public: FUNC1RC(ObjectID,area_get_object_instance_ID,RID); FUNC3(area_set_param,RID,AreaParameter,const Variant&); - FUNC2(area_set_transform,RID,const Matrix32&); + FUNC2(area_set_transform,RID,const Transform2D&); FUNC2RC(Variant,area_get_param,RID,AreaParameter); - FUNC1RC(Matrix32,area_get_transform,RID); + FUNC1RC(Transform2D,area_get_transform,RID); FUNC2(area_set_collision_mask,RID,uint32_t); FUNC2(area_set_layer_mask,RID,uint32_t); @@ -191,13 +191,13 @@ public: FUNC1RC(BodyMode,body_get_mode,RID); - FUNC3(body_add_shape,RID,RID,const Matrix32&); + FUNC3(body_add_shape,RID,RID,const Transform2D&); FUNC3(body_set_shape,RID,int,RID); - FUNC3(body_set_shape_transform,RID,int,const Matrix32&); + FUNC3(body_set_shape_transform,RID,int,const Transform2D&); FUNC3(body_set_shape_metadata,RID,int,const Variant&); FUNC1RC(int,body_get_shape_count,RID); - FUNC2RC(Matrix32,body_get_shape_transform,RID,int); + FUNC2RC(Transform2D,body_get_shape_transform,RID,int); FUNC2RC(Variant,body_get_shape_metadata,RID,int); FUNC2RC(RID,body_get_shape,RID,int); @@ -260,13 +260,13 @@ public: FUNC4(body_set_force_integration_callback,RID ,Object *,const StringName& ,const Variant& ); - bool body_collide_shape(RID p_body, int p_body_shape,RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,Vector2 *r_results,int p_result_max,int &r_result_count) { + bool body_collide_shape(RID p_body, int p_body_shape,RID p_shape, const Transform2D& p_shape_xform,const Vector2& p_motion,Vector2 *r_results,int p_result_max,int &r_result_count) { return physics_2d_server->body_collide_shape(p_body,p_body_shape,p_shape,p_shape_xform,p_motion,r_results,p_result_max,r_result_count); } FUNC2(body_set_pickable,RID,bool); - bool body_test_motion(RID p_body,const Matrix32& p_from,const Vector2& p_motion,float p_margin=0.001,MotionResult *r_result=NULL) { + bool body_test_motion(RID p_body,const Transform2D& p_from,const Vector2& p_motion,float p_margin=0.001,MotionResult *r_result=NULL) { ERR_FAIL_COND_V(main_thread!=Thread::get_caller_ID(),false); return physics_2d_server->body_test_motion(p_body,p_from,p_motion,p_margin,r_result); diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index e9089e6173..8b19122f17 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -684,7 +684,7 @@ real_t ConvexPolygonShape2DSW::get_moment_of_inertia(float p_mass,const Size2& p void ConvexPolygonShape2DSW::set_data(const Variant& p_data) { - ERR_FAIL_COND(p_data.get_type()!=Variant::VECTOR2_ARRAY && p_data.get_type()!=Variant::REAL_ARRAY); + ERR_FAIL_COND(p_data.get_type()!=Variant::POOL_VECTOR2_ARRAY && p_data.get_type()!=Variant::POOL_REAL_ARRAY); if (points) @@ -692,7 +692,7 @@ void ConvexPolygonShape2DSW::set_data(const Variant& p_data) { points=NULL; point_count=0; - if (p_data.get_type()==Variant::VECTOR2_ARRAY) { + if (p_data.get_type()==Variant::POOL_VECTOR2_ARRAY) { PoolVector<Vector2> arr=p_data; ERR_FAIL_COND(arr.size()==0); point_count=arr.size(); @@ -964,11 +964,11 @@ int ConcavePolygonShape2DSW::_generate_bvh(BVH *p_bvh,int p_len,int p_depth) { void ConcavePolygonShape2DSW::set_data(const Variant& p_data) { - ERR_FAIL_COND(p_data.get_type()!=Variant::VECTOR2_ARRAY && p_data.get_type()!=Variant::REAL_ARRAY); + ERR_FAIL_COND(p_data.get_type()!=Variant::POOL_VECTOR2_ARRAY && p_data.get_type()!=Variant::POOL_REAL_ARRAY); Rect2 aabb; - if (p_data.get_type()==Variant::VECTOR2_ARRAY) { + if (p_data.get_type()==Variant::POOL_VECTOR2_ARRAY) { PoolVector<Vector2> p2arr = p_data; int len = p2arr.size(); diff --git a/servers/physics_2d/shape_2d_sw.h b/servers/physics_2d/shape_2d_sw.h index a955cb1eee..9160d064ef 100644 --- a/servers/physics_2d/shape_2d_sw.h +++ b/servers/physics_2d/shape_2d_sw.h @@ -80,8 +80,8 @@ public: virtual bool contains_point(const Vector2& p_point) const=0; - virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const=0; - virtual void project_range_castv(const Vector2& p_cast, const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const=0; + virtual void project_rangev(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const=0; + virtual void project_range_castv(const Vector2& p_cast, const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const=0; virtual Vector2 get_support(const Vector2& p_normal) const; virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const=0; @@ -99,7 +99,7 @@ public: const Map<ShapeOwner2DSW*,int>& get_owners() const; - _FORCE_INLINE_ void get_supports_transformed_cast(const Vector2& p_cast,const Vector2& p_normal,const Matrix32& p_xform,Vector2 *r_supports,int & r_amount) const { + _FORCE_INLINE_ void get_supports_transformed_cast(const Vector2& p_cast,const Vector2& p_normal,const Transform2D& p_xform,Vector2 *r_supports,int & r_amount) const { get_supports(p_xform.basis_xform_inv(p_normal).normalized(),r_supports,r_amount); for(int i=0;i<r_amount;i++) @@ -142,14 +142,14 @@ public: //let the optimizer do the magic #define DEFAULT_PROJECT_RANGE_CAST \ -virtual void project_range_castv(const Vector2& p_cast, const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const {\ +virtual void project_range_castv(const Vector2& p_cast, const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const {\ project_range_cast(p_cast,p_normal,p_transform,r_min,r_max);\ }\ -_FORCE_INLINE_ void project_range_cast(const Vector2& p_cast, const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const {\ +_FORCE_INLINE_ void project_range_cast(const Vector2& p_cast, const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const {\ \ real_t mina,maxa;\ real_t minb,maxb;\ - Matrix32 ofsb=p_transform;\ + Transform2D ofsb=p_transform;\ ofsb.translate(p_cast);\ project_range(p_normal,p_transform,mina,maxa);\ project_range(p_normal,ofsb,minb,maxb); \ @@ -170,7 +170,7 @@ public: virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_LINE; } - virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } + virtual void project_rangev(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const; virtual bool contains_point(const Vector2& p_point) const; @@ -180,17 +180,17 @@ public: virtual void set_data(const Variant& p_data); virtual Variant get_data() const; - _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { + _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { //real large r_min=-1e10; r_max=1e10; } - virtual void project_range_castv(const Vector2& p_cast, const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { + virtual void project_range_castv(const Vector2& p_cast, const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { project_range_cast(p_cast,p_normal,p_transform,r_min,r_max); } - _FORCE_INLINE_ void project_range_cast(const Vector2& p_cast, const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { + _FORCE_INLINE_ void project_range_cast(const Vector2& p_cast, const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { //real large r_min=-1e10; r_max=1e10; @@ -213,7 +213,7 @@ public: virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_RAY; } - virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } + virtual void project_rangev(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const; virtual bool contains_point(const Vector2& p_point) const; @@ -223,7 +223,7 @@ public: virtual void set_data(const Variant& p_data); virtual Variant get_data() const; - _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { + _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { //real large r_max = p_normal.dot(p_transform.get_origin()); r_min = p_normal.dot(p_transform.xform(Vector2(0,length))); @@ -257,11 +257,11 @@ public: virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_SEGMENT; } - _FORCE_INLINE_ Vector2 get_xformed_normal(const Matrix32& p_xform) const { + _FORCE_INLINE_ Vector2 get_xformed_normal(const Transform2D& p_xform) const { return (p_xform.xform(b) - p_xform.xform(a)).normalized().tangent(); } - virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } + virtual void project_rangev(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const; virtual bool contains_point(const Vector2& p_point) const; @@ -271,7 +271,7 @@ public: virtual void set_data(const Variant& p_data); virtual Variant get_data() const; - _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { + _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { //real large r_max = p_normal.dot(p_transform.xform(a)); r_min = p_normal.dot(p_transform.xform(b)); @@ -299,7 +299,7 @@ public: virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_CIRCLE; } - virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } + virtual void project_rangev(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const; virtual bool contains_point(const Vector2& p_point) const; @@ -309,7 +309,7 @@ public: virtual void set_data(const Variant& p_data); virtual Variant get_data() const; - _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { + _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { //real large real_t d = p_normal.dot( p_transform.get_origin() ); @@ -339,7 +339,7 @@ public: virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_RECTANGLE; } - virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } + virtual void project_rangev(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const; virtual bool contains_point(const Vector2& p_point) const; @@ -349,7 +349,7 @@ public: virtual void set_data(const Variant& p_data); virtual Variant get_data() const; - _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { + _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { // no matter the angle, the box is mirrored anyway r_max=-1e20; r_min=1e20; @@ -367,7 +367,7 @@ public: - _FORCE_INLINE_ Vector2 get_circle_axis(const Matrix32& p_xform, const Matrix32& p_xform_inv,const Vector2& p_circle) const { + _FORCE_INLINE_ Vector2 get_circle_axis(const Transform2D& p_xform, const Transform2D& p_xform_inv,const Vector2& p_circle) const { Vector2 local_v = p_xform_inv.xform(p_circle); @@ -379,7 +379,7 @@ public: return (p_xform.xform(he)-p_circle).normalized(); } - _FORCE_INLINE_ Vector2 get_box_axis(const Matrix32& p_xform, const Matrix32& p_xform_inv,const RectangleShape2DSW *p_B,const Matrix32& p_B_xform, const Matrix32& p_B_xform_inv) const { + _FORCE_INLINE_ Vector2 get_box_axis(const Transform2D& p_xform, const Transform2D& p_xform_inv,const RectangleShape2DSW *p_B,const Transform2D& p_B_xform, const Transform2D& p_B_xform_inv) const { Vector2 a,b; @@ -427,7 +427,7 @@ public: virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_CAPSULE; } - virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } + virtual void project_rangev(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const; virtual bool contains_point(const Vector2& p_point) const; @@ -437,7 +437,7 @@ public: virtual void set_data(const Variant& p_data); virtual Variant get_data() const; - _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { + _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { // no matter the angle, the box is mirrored anyway Vector2 n=p_transform.basis_xform_inv(p_normal).normalized(); float h = (n.y > 0) ? height : -height; @@ -480,7 +480,7 @@ public: _FORCE_INLINE_ int get_point_count() const { return point_count; } _FORCE_INLINE_ const Vector2& get_point(int p_idx) const { return points[p_idx].pos; } _FORCE_INLINE_ const Vector2& get_segment_normal(int p_idx) const { return points[p_idx].normal; } - _FORCE_INLINE_ Vector2 get_xformed_segment_normal(const Matrix32& p_xform, int p_idx) const { + _FORCE_INLINE_ Vector2 get_xformed_segment_normal(const Transform2D& p_xform, int p_idx) const { Vector2 a = points[p_idx].pos; p_idx++; @@ -490,7 +490,7 @@ public: virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_CONVEX_POLYGON; } - virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } + virtual void project_rangev(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); } virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const; virtual bool contains_point(const Vector2& p_point) const; @@ -500,7 +500,7 @@ public: virtual void set_data(const Variant& p_data); virtual Variant get_data() const; - _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { + _FORCE_INLINE_ void project_range(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { // no matter the angle, the box is mirrored anyway r_min = r_max = p_normal.dot(p_transform.xform(points[0].pos)); @@ -577,8 +577,8 @@ public: virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_CONCAVE_POLYGON; } - virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { /*project_range(p_normal,p_transform,r_min,r_max);*/ } - virtual void project_range(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { /*project_range(p_normal,p_transform,r_min,r_max);*/ } + virtual void project_rangev(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { /*project_range(p_normal,p_transform,r_min,r_max);*/ } + virtual void project_range(const Vector2& p_normal, const Transform2D& p_transform, real_t &r_min, real_t &r_max) const { /*project_range(p_normal,p_transform,r_min,r_max);*/ } virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const; virtual bool contains_point(const Vector2& p_point) const; diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index 7985bfef96..2c7b099b36 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -133,7 +133,7 @@ bool Physics2DDirectSpaceStateSW::intersect_ray(const Vector2& p_from, const Vec const CollisionObject2DSW *col_obj=space->intersection_query_results[i]; int shape_idx=space->intersection_query_subindex_results[i]; - Matrix32 inv_xform = col_obj->get_shape_inv_transform(shape_idx) * col_obj->get_inv_transform(); + Transform2D inv_xform = col_obj->get_shape_inv_transform(shape_idx) * col_obj->get_inv_transform(); Vector2 local_from = inv_xform.xform(begin); Vector2 local_to = inv_xform.xform(end); @@ -153,7 +153,7 @@ bool Physics2DDirectSpaceStateSW::intersect_ray(const Vector2& p_from, const Vec - Matrix32 xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx); + Transform2D xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx); shape_point=xform.xform(shape_point); real_t ld = normal.dot(shape_point); @@ -190,7 +190,7 @@ bool Physics2DDirectSpaceStateSW::intersect_ray(const Vector2& p_from, const Vec } -int Physics2DDirectSpaceStateSW::intersect_shape(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,float p_margin,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude,uint32_t p_layer_mask,uint32_t p_object_type_mask) { +int Physics2DDirectSpaceStateSW::intersect_shape(const RID& p_shape, const Transform2D& p_xform,const Vector2& p_motion,float p_margin,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude,uint32_t p_layer_mask,uint32_t p_object_type_mask) { if (p_result_max<=0) return 0; @@ -237,7 +237,7 @@ int Physics2DDirectSpaceStateSW::intersect_shape(const RID& p_shape, const Matri -bool Physics2DDirectSpaceStateSW::cast_motion(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,float p_margin,float &p_closest_safe,float &p_closest_unsafe, const Set<RID>& p_exclude,uint32_t p_layer_mask,uint32_t p_object_type_mask) { +bool Physics2DDirectSpaceStateSW::cast_motion(const RID& p_shape, const Transform2D& p_xform,const Vector2& p_motion,float p_margin,float &p_closest_safe,float &p_closest_unsafe, const Set<RID>& p_exclude,uint32_t p_layer_mask,uint32_t p_object_type_mask) { @@ -280,7 +280,7 @@ bool Physics2DDirectSpaceStateSW::cast_motion(const RID& p_shape, const Matrix32 }*/ - Matrix32 col_obj_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx); + 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)) { continue; @@ -362,7 +362,7 @@ bool Physics2DDirectSpaceStateSW::cast_motion(const RID& p_shape, const Matrix32 } -bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,float p_margin,Vector2 *r_results,int p_result_max,int &r_result_count, const Set<RID>& p_exclude,uint32_t p_layer_mask,uint32_t p_object_type_mask) { +bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Transform2D& p_shape_xform,const Vector2& p_motion,float p_margin,Vector2 *r_results,int p_result_max,int &r_result_count, const Set<RID>& p_exclude,uint32_t p_layer_mask,uint32_t p_object_type_mask) { if (p_result_max<=0) @@ -471,7 +471,7 @@ static void _rest_cbk_result(const Vector2& p_point_A,const Vector2& p_point_B,v } -bool Physics2DDirectSpaceStateSW::rest_info(RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,float p_margin,ShapeRestInfo *r_info, const Set<RID>& p_exclude,uint32_t p_layer_mask,uint32_t p_object_type_mask) { +bool Physics2DDirectSpaceStateSW::rest_info(RID p_shape, const Transform2D& p_shape_xform,const Vector2& p_motion,float p_margin,ShapeRestInfo *r_info, const Set<RID>& p_exclude,uint32_t p_layer_mask,uint32_t p_object_type_mask) { Shape2DSW *shape = Physics2DServerSW::singletonsw->shape_owner.get(p_shape); @@ -592,7 +592,7 @@ int Space2DSW::_cull_aabb_for_body(Body2DSW *p_body,const Rect2& p_aabb) { return amount; } -bool Space2DSW::test_body_motion(Body2DSW *p_body, const Matrix32 &p_from, const Vector2&p_motion, float p_margin, Physics2DServer::MotionResult *r_result) { +bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, const Vector2&p_motion, float p_margin, Physics2DServer::MotionResult *r_result) { //give me back regular physics engine logic //this is madness @@ -618,7 +618,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Matrix32 &p_from, const body_aabb=body_aabb.grow(p_margin); - Matrix32 body_transform = p_from; + Transform2D body_transform = p_from; { //STEP 1, FREE BODY IF STUCK @@ -649,7 +649,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Matrix32 &p_from, const if (p_body->is_shape_set_as_trigger(j)) continue; - Matrix32 body_shape_xform = body_transform * p_body->get_shape_transform(j); + Transform2D body_shape_xform = body_transform * p_body->get_shape_transform(j); Shape2DSW *body_shape = p_body->get_shape(j); for(int i=0;i<amount;i++) { @@ -739,7 +739,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Matrix32 &p_from, const if (p_body->is_shape_set_as_trigger(j)) continue; - Matrix32 body_shape_xform = body_transform * p_body->get_shape_transform(j); + Transform2D body_shape_xform = body_transform * p_body->get_shape_transform(j); Shape2DSW *body_shape = p_body->get_shape(j); bool stuck=false; @@ -753,7 +753,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Matrix32 &p_from, const int shape_idx=intersection_query_subindex_results[i]; - Matrix32 col_obj_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx); + 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(body_shape,body_shape_xform,p_motion,col_obj->get_shape(shape_idx),col_obj_xform,Vector2() ,NULL,NULL,NULL,0)) { continue; @@ -859,7 +859,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Matrix32 &p_from, const } else { //it collided, let's get the rest info in unsafe advance - Matrix32 ugt = body_transform; + Transform2D ugt = body_transform; ugt.translate(p_motion*unsafe); _RestCallbackData2D rcd; @@ -867,7 +867,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Matrix32 &p_from, const rcd.best_object=NULL; rcd.best_shape=0; - Matrix32 body_shape_xform = ugt * p_body->get_shape_transform(best_shape); + Transform2D body_shape_xform = ugt * p_body->get_shape_transform(best_shape); Shape2DSW *body_shape = p_body->get_shape(best_shape); body_aabb.pos+=p_motion*unsafe; diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h index 692cf08c87..5dee3dea5a 100644 --- a/servers/physics_2d/space_2d_sw.h +++ b/servers/physics_2d/space_2d_sw.h @@ -49,10 +49,10 @@ public: virtual int intersect_point(const Vector2& p_point,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION, bool p_pick_point=false); virtual bool intersect_ray(const Vector2& p_from, const Vector2& p_to,RayResult &r_result,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION); - virtual int intersect_shape(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,float p_margin,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION); - virtual bool cast_motion(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,float p_margin,float &p_closest_safe,float &p_closest_unsafe, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION); - virtual bool collide_shape(RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,float p_margin,Vector2 *r_results,int p_result_max,int &r_result_count, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION); - virtual bool rest_info(RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,float p_margin,ShapeRestInfo *r_info, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION); + virtual int intersect_shape(const RID& p_shape, const Transform2D& p_xform,const Vector2& p_motion,float p_margin,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION); + virtual bool cast_motion(const RID& p_shape, const Transform2D& p_xform,const Vector2& p_motion,float p_margin,float &p_closest_safe,float &p_closest_unsafe, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION); + virtual bool collide_shape(RID p_shape, const Transform2D& p_shape_xform,const Vector2& p_motion,float p_margin,Vector2 *r_results,int p_result_max,int &r_result_count, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION); + virtual bool rest_info(RID p_shape, const Transform2D& p_shape_xform,const Vector2& p_motion,float p_margin,ShapeRestInfo *r_info, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION); Physics2DDirectSpaceStateSW(); }; @@ -185,7 +185,7 @@ public: int get_collision_pairs() const { return collision_pairs; } - bool test_body_motion(Body2DSW *p_body, const Matrix32 &p_from, const Vector2&p_motion, float p_margin, Physics2DServer::MotionResult *r_result); + bool test_body_motion(Body2DSW *p_body, const Transform2D &p_from, const Vector2&p_motion, float p_margin, Physics2DServer::MotionResult *r_result); void set_debug_contacts(int p_amount) { contact_debug.resize(p_amount); } diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index 22dbfd6e80..666982ebee 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -132,11 +132,11 @@ RID Physics2DShapeQueryParameters::get_shape_rid() const { return shape; } -void Physics2DShapeQueryParameters::set_transform(const Matrix32& p_transform){ +void Physics2DShapeQueryParameters::set_transform(const Transform2D& p_transform){ transform=p_transform; } -Matrix32 Physics2DShapeQueryParameters::get_transform() const{ +Transform2D Physics2DShapeQueryParameters::get_transform() const{ return transform; } @@ -493,7 +493,7 @@ Physics2DTestMotionResult::Physics2DTestMotionResult(){ -bool Physics2DServer::_body_test_motion(RID p_body,const Matrix32& p_from,const Vector2& p_motion,float p_margin,const Ref<Physics2DTestMotionResult>& p_result) { +bool Physics2DServer::_body_test_motion(RID p_body,const Transform2D& p_from,const Vector2& p_motion,float p_margin,const Ref<Physics2DTestMotionResult>& p_result) { MotionResult *r=NULL; if (p_result.is_valid()) @@ -525,7 +525,7 @@ void Physics2DServer::_bind_methods() { ClassDB::bind_method(_MD("area_set_space_override_mode","area","mode"),&Physics2DServer::area_set_space_override_mode); ClassDB::bind_method(_MD("area_get_space_override_mode","area"),&Physics2DServer::area_get_space_override_mode); - ClassDB::bind_method(_MD("area_add_shape","area","shape","transform"),&Physics2DServer::area_add_shape,DEFVAL(Matrix32())); + ClassDB::bind_method(_MD("area_add_shape","area","shape","transform"),&Physics2DServer::area_add_shape,DEFVAL(Transform2D())); ClassDB::bind_method(_MD("area_set_shape","area","shape_idx","shape"),&Physics2DServer::area_set_shape); ClassDB::bind_method(_MD("area_set_shape_transform","area","shape_idx","transform"),&Physics2DServer::area_set_shape_transform); @@ -558,7 +558,7 @@ void Physics2DServer::_bind_methods() { ClassDB::bind_method(_MD("body_set_mode","body","mode"),&Physics2DServer::body_set_mode); ClassDB::bind_method(_MD("body_get_mode","body"),&Physics2DServer::body_get_mode); - ClassDB::bind_method(_MD("body_add_shape","body","shape","transform"),&Physics2DServer::body_add_shape,DEFVAL(Matrix32())); + ClassDB::bind_method(_MD("body_add_shape","body","shape","transform"),&Physics2DServer::body_add_shape,DEFVAL(Transform2D())); ClassDB::bind_method(_MD("body_set_shape","body","shape_idx","shape"),&Physics2DServer::body_set_shape); ClassDB::bind_method(_MD("body_set_shape_transform","body","shape_idx","transform"),&Physics2DServer::body_set_shape_transform); ClassDB::bind_method(_MD("body_set_shape_metadata","body","shape_idx","metadata"),&Physics2DServer::body_set_shape_metadata); diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index 4b6e6584e6..424d2fa7ce 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -55,8 +55,8 @@ public: virtual void set_angular_velocity(real_t p_velocity)=0; virtual real_t get_angular_velocity() const=0; - virtual void set_transform(const Matrix32& p_transform)=0; - virtual Matrix32 get_transform() const=0; + virtual void set_transform(const Transform2D& p_transform)=0; + virtual Transform2D get_transform() const=0; virtual void set_sleep_state(bool p_enable)=0; virtual bool is_sleeping() const=0; @@ -93,7 +93,7 @@ class Physics2DShapeQueryParameters : public Reference { GDCLASS(Physics2DShapeQueryParameters, Reference); friend class Physics2DDirectSpaceState; RID shape; - Matrix32 transform; + Transform2D transform; Vector2 motion; float margin; Set<RID> exclude; @@ -108,8 +108,8 @@ public: void set_shape_rid(const RID& p_shape); RID get_shape_rid() const; - void set_transform(const Matrix32& p_transform); - Matrix32 get_transform() const; + void set_transform(const Transform2D& p_transform); + Transform2D get_transform() const; void set_motion(const Vector2& p_motion); Vector2 get_motion() const; @@ -184,11 +184,11 @@ public: virtual int intersect_point(const Vector2& p_point,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION,bool p_pick_point=false)=0; - virtual int intersect_shape(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,float p_margin,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0; + virtual int intersect_shape(const RID& p_shape, const Transform2D& p_xform,const Vector2& p_motion,float p_margin,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0; - virtual bool cast_motion(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,float p_margin,float &p_closest_safe,float &p_closest_unsafe, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0; + virtual bool cast_motion(const RID& p_shape, const Transform2D& p_xform,const Vector2& p_motion,float p_margin,float &p_closest_safe,float &p_closest_unsafe, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0; - virtual bool collide_shape(RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,float p_margin,Vector2 *r_results,int p_result_max,int &r_result_count, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0; + virtual bool collide_shape(RID p_shape, const Transform2D& p_shape_xform,const Vector2& p_motion,float p_margin,Vector2 *r_results,int p_result_max,int &r_result_count, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0; struct ShapeRestInfo { @@ -202,7 +202,7 @@ public: }; - virtual bool rest_info(RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,float p_margin,ShapeRestInfo *r_info, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0; + virtual bool rest_info(RID p_shape, const Transform2D& p_shape_xform,const Vector2& p_motion,float p_margin,ShapeRestInfo *r_info, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0; Physics2DDirectSpaceState(); @@ -238,7 +238,7 @@ class Physics2DServer : public Object { static Physics2DServer * singleton; - virtual bool _body_test_motion(RID p_body, const Matrix32 &p_from, const Vector2& p_motion, float p_margin=0.08, const Ref<Physics2DTestMotionResult>& p_result=Ref<Physics2DTestMotionResult>()); + virtual bool _body_test_motion(RID p_body, const Transform2D &p_from, const Vector2& p_motion, float p_margin=0.08, const Ref<Physics2DTestMotionResult>& p_result=Ref<Physics2DTestMotionResult>()); protected: static void _bind_methods(); @@ -268,7 +268,7 @@ public: virtual real_t shape_get_custom_solver_bias(RID p_shape) const=0; //these work well, but should be used from the main thread only - virtual bool shape_collide(RID p_shape_A, const Matrix32& p_xform_A,const Vector2& p_motion_A,RID p_shape_B, const Matrix32& p_xform_B, const Vector2& p_motion_B,Vector2 *r_results,int p_result_max,int &r_result_count)=0; + virtual bool shape_collide(RID p_shape_A, const Transform2D& p_xform_A,const Vector2& p_motion_A,RID p_shape_B, const Transform2D& p_xform_B, const Vector2& p_motion_B,Vector2 *r_results,int p_result_max,int &r_result_count)=0; /* SPACE API */ @@ -333,13 +333,13 @@ public: virtual void area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode)=0; virtual AreaSpaceOverrideMode area_get_space_override_mode(RID p_area) const=0; - virtual void area_add_shape(RID p_area, RID p_shape, const Matrix32& p_transform=Matrix32())=0; + virtual void area_add_shape(RID p_area, RID p_shape, const Transform2D& p_transform=Transform2D())=0; virtual void area_set_shape(RID p_area, int p_shape_idx,RID p_shape)=0; - virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Matrix32& p_transform)=0; + virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Transform2D& p_transform)=0; virtual int area_get_shape_count(RID p_area) const=0; virtual RID area_get_shape(RID p_area, int p_shape_idx) const=0; - virtual Matrix32 area_get_shape_transform(RID p_area, int p_shape_idx) const=0; + virtual Transform2D area_get_shape_transform(RID p_area, int p_shape_idx) const=0; virtual void area_remove_shape(RID p_area, int p_shape_idx)=0; virtual void area_clear_shapes(RID p_area)=0; @@ -348,10 +348,10 @@ public: virtual ObjectID area_get_object_instance_ID(RID p_area) const=0; virtual void area_set_param(RID p_area,AreaParameter p_param,const Variant& p_value)=0; - virtual void area_set_transform(RID p_area, const Matrix32& p_transform)=0; + virtual void area_set_transform(RID p_area, const Transform2D& p_transform)=0; virtual Variant area_get_param(RID p_parea,AreaParameter p_param) const=0; - virtual Matrix32 area_get_transform(RID p_area) const=0; + virtual Transform2D area_get_transform(RID p_area) const=0; virtual void area_set_collision_mask(RID p_area,uint32_t p_mask)=0; virtual void area_set_layer_mask(RID p_area,uint32_t p_mask)=0; @@ -382,14 +382,14 @@ public: virtual void body_set_mode(RID p_body, BodyMode p_mode)=0; virtual BodyMode body_get_mode(RID p_body) const=0; - virtual void body_add_shape(RID p_body, RID p_shape, const Matrix32& p_transform=Matrix32())=0; + virtual void body_add_shape(RID p_body, RID p_shape, const Transform2D& p_transform=Transform2D())=0; virtual void body_set_shape(RID p_body, int p_shape_idx,RID p_shape)=0; - virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Matrix32& p_transform)=0; + virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform2D& p_transform)=0; virtual void body_set_shape_metadata(RID p_body, int p_shape_idx, const Variant& p_metadata)=0; virtual int body_get_shape_count(RID p_body) const=0; virtual RID body_get_shape(RID p_body, int p_shape_idx) const=0; - virtual Matrix32 body_get_shape_transform(RID p_body, int p_shape_idx) const=0; + virtual Transform2D body_get_shape_transform(RID p_body, int p_shape_idx) const=0; virtual Variant body_get_shape_metadata(RID p_body, int p_shape_idx) const=0; virtual void body_set_shape_as_trigger(RID p_body, int p_shape_idx,bool p_enable)=0; @@ -479,7 +479,7 @@ public: virtual void body_set_force_integration_callback(RID p_body,Object *p_receiver,const StringName& p_method,const Variant& p_udata=Variant())=0; - virtual bool body_collide_shape(RID p_body, int p_body_shape,RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,Vector2 *r_results,int p_result_max,int &r_result_count)=0; + virtual bool body_collide_shape(RID p_body, int p_body_shape,RID p_shape, const Transform2D& p_shape_xform,const Vector2& p_motion,Vector2 *r_results,int p_result_max,int &r_result_count)=0; virtual void body_set_pickable(RID p_body,bool p_pickable)=0; @@ -497,7 +497,7 @@ public: Variant collider_metadata; }; - virtual bool body_test_motion(RID p_body,const Matrix32& p_from,const Vector2& p_motion,float p_margin=0.001,MotionResult *r_result=NULL)=0; + virtual bool body_test_motion(RID p_body,const Transform2D& p_from,const Vector2& p_motion,float p_margin=0.001,MotionResult *r_result=NULL)=0; /* JOINT API */ diff --git a/servers/physics_server.h b/servers/physics_server.h index 3070f919b0..d57ca93d92 100644 --- a/servers/physics_server.h +++ b/servers/physics_server.h @@ -46,10 +46,10 @@ public: virtual float get_total_linear_damp() const=0; virtual Vector3 get_center_of_mass() const=0; - virtual Matrix3 get_principal_inertia_axes() const=0; + virtual Basis get_principal_inertia_axes() const=0; virtual float get_inverse_mass() const=0; // get the mass virtual Vector3 get_inverse_inertia() const=0; // get density of this body space - virtual Matrix3 get_inverse_inertia_tensor() const=0; // get density of this body space + virtual Basis get_inverse_inertia_tensor() const=0; // get density of this body space virtual void set_linear_velocity(const Vector3& p_velocity)=0; virtual Vector3 get_linear_velocity() const=0; diff --git a/servers/spatial_sound/spatial_sound_server_sw.cpp b/servers/spatial_sound/spatial_sound_server_sw.cpp index 83b42c5299..ccde73561f 100644 --- a/servers/spatial_sound/spatial_sound_server_sw.cpp +++ b/servers/spatial_sound/spatial_sound_server_sw.cpp @@ -164,9 +164,9 @@ void SpatialSoundServerSW::room_set_space(RID p_room,RID p_space) { Space *space = space_owner.get(p_space); ERR_FAIL_COND(!space); space->rooms.insert(p_room); - room->octree_id=space->octree.create(room,AABB()); + room->octree_id=space->octree.create(room,Rect3()); //set bounds - AABB aabb = room->bounds.is_empty()?AABB():room->bounds.get_aabb(); + Rect3 aabb = room->bounds.is_empty()?Rect3():room->bounds.get_aabb(); space->octree.move(room->octree_id,room->transform.xform(aabb)); room->space=p_space; } @@ -195,7 +195,7 @@ void SpatialSoundServerSW::room_set_bounds(RID p_room, const BSP_Tree& p_bounds) if (!room->space.is_valid()) return; - AABB aabb = room->bounds.is_empty()?AABB():room->bounds.get_aabb(); + Rect3 aabb = room->bounds.is_empty()?Rect3():room->bounds.get_aabb(); Space* space = space_owner.get(room->space); ERR_FAIL_COND(!space); diff --git a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.cpp b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.cpp index a930daf729..33e51eb262 100644 --- a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.cpp +++ b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.cpp @@ -205,7 +205,7 @@ PoolVector<Point2> SpatialSound2DServerSW::room_get_bounds(RID p_room) const { return room->bounds; } -void SpatialSound2DServerSW::room_set_transform(RID p_room, const Matrix32& p_transform) { +void SpatialSound2DServerSW::room_set_transform(RID p_room, const Transform2D& p_transform) { if (space_owner.owns(p_room)) p_room=space_owner.get(p_room)->default_room; @@ -228,13 +228,13 @@ void SpatialSound2DServerSW::room_set_transform(RID p_room, const Matrix32& p_tr }*/ } -Matrix32 SpatialSound2DServerSW::room_get_transform(RID p_room) const { +Transform2D SpatialSound2DServerSW::room_get_transform(RID p_room) const { if (space_owner.owns(p_room)) p_room=space_owner.get(p_room)->default_room; Room *room = room_owner.get(p_room); - ERR_FAIL_COND_V(!room,Matrix32()); + ERR_FAIL_COND_V(!room,Transform2D()); return room->transform; } @@ -365,17 +365,17 @@ int SpatialSound2DServerSW::source_get_polyphony(RID p_source) const { } -void SpatialSound2DServerSW::source_set_transform(RID p_source, const Matrix32& p_transform) { +void SpatialSound2DServerSW::source_set_transform(RID p_source, const Transform2D& p_transform) { Source *source = source_owner.get(p_source); ERR_FAIL_COND(!source); source->transform=p_transform; source->transform.orthonormalize(); } -Matrix32 SpatialSound2DServerSW::source_get_transform(RID p_source) const { +Transform2D SpatialSound2DServerSW::source_get_transform(RID p_source) const { Source *source = source_owner.get(p_source); - ERR_FAIL_COND_V(!source,Matrix32()); + ERR_FAIL_COND_V(!source,Transform2D()); return source->transform; } @@ -518,17 +518,17 @@ void SpatialSound2DServerSW::listener_set_space(RID p_listener,RID p_space) { } -void SpatialSound2DServerSW::listener_set_transform(RID p_listener, const Matrix32& p_transform) { +void SpatialSound2DServerSW::listener_set_transform(RID p_listener, const Transform2D& p_transform) { Listener *listener = listener_owner.get(p_listener); ERR_FAIL_COND(!listener); listener->transform=p_transform; listener->transform.orthonormalize(); //must be done.. } -Matrix32 SpatialSound2DServerSW::listener_get_transform(RID p_listener) const { +Transform2D SpatialSound2DServerSW::listener_get_transform(RID p_listener) const { Listener *listener = listener_owner.get(p_listener); - ERR_FAIL_COND_V(!listener,Matrix32()); + ERR_FAIL_COND_V(!listener,Transform2D()); return listener->transform; } diff --git a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h index d6c09f50a8..16d2c93e7d 100644 --- a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h +++ b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h @@ -80,8 +80,8 @@ class SpatialSound2DServerSW : public SpatialSound2DServer { struct Room : public RID_Data { RID space; - Matrix32 transform; - Matrix32 inverse_transform; + Transform2D transform; + Transform2D inverse_transform; PoolVector<Point2> bounds; RoomReverb reverb; float params[ROOM_PARAM_MAX]; @@ -149,7 +149,7 @@ class SpatialSound2DServerSW : public SpatialSound2DServer { } stream_data; RID space; - Matrix32 transform; + Transform2D transform; float params[SOURCE_PARAM_MAX]; AudioServer::AudioStream *stream; Vector<Voice> voices; @@ -163,7 +163,7 @@ class SpatialSound2DServerSW : public SpatialSound2DServer { struct Listener : public RID_Data { RID space; - Matrix32 transform; + Transform2D transform; float params[LISTENER_PARAM_MAX]; Listener(); @@ -200,8 +200,8 @@ public: virtual void room_set_bounds(RID p_room, const PoolVector<Point2>& p_bounds); virtual PoolVector<Point2> room_get_bounds(RID p_room) const; - virtual void room_set_transform(RID p_room, const Matrix32& p_transform); - virtual Matrix32 room_get_transform(RID p_room) const; + virtual void room_set_transform(RID p_room, const Transform2D& p_transform); + virtual Transform2D room_get_transform(RID p_room) const; virtual void room_set_param(RID p_room, RoomParam p_param, float p_value); @@ -224,8 +224,8 @@ public: virtual void source_set_polyphony(RID p_source,int p_voice_count); virtual int source_get_polyphony(RID p_source) const; - virtual void source_set_transform(RID p_source, const Matrix32& p_transform); - virtual Matrix32 source_get_transform(RID p_source) const; + virtual void source_set_transform(RID p_source, const Transform2D& p_transform); + virtual Transform2D source_get_transform(RID p_source) const; virtual void source_set_param(RID p_source, SourceParam p_param, float p_value); virtual float source_get_param(RID p_source, SourceParam p_param) const; @@ -244,8 +244,8 @@ public: virtual RID listener_create(); virtual void listener_set_space(RID p_listener, RID p_space); - virtual void listener_set_transform(RID p_listener, const Matrix32& p_transform); - virtual Matrix32 listener_get_transform(RID p_listener) const; + virtual void listener_set_transform(RID p_listener, const Transform2D& p_transform); + virtual Transform2D listener_get_transform(RID p_listener) const; virtual void listener_set_param(RID p_listener, ListenerParam p_param, float p_value); virtual float listener_get_param(RID p_listener, ListenerParam p_param) const; diff --git a/servers/spatial_sound_2d_server.h b/servers/spatial_sound_2d_server.h index c19da87c04..331caf8198 100644 --- a/servers/spatial_sound_2d_server.h +++ b/servers/spatial_sound_2d_server.h @@ -59,8 +59,8 @@ public: virtual void room_set_bounds(RID p_room, const PoolVector<Point2>& p_bounds)=0; virtual PoolVector<Point2> room_get_bounds(RID p_room) const=0; - virtual void room_set_transform(RID p_room, const Matrix32& p_transform)=0; - virtual Matrix32 room_get_transform(RID p_room) const=0; + virtual void room_set_transform(RID p_room, const Transform2D& p_transform)=0; + virtual Transform2D room_get_transform(RID p_room) const=0; enum RoomParam { ROOM_PARAM_PITCH_SCALE, @@ -99,8 +99,8 @@ public: virtual RID source_create(RID p_space)=0; - virtual void source_set_transform(RID p_source, const Matrix32& p_transform)=0; - virtual Matrix32 source_get_transform(RID p_source) const=0; + virtual void source_set_transform(RID p_source, const Transform2D& p_transform)=0; + virtual Transform2D source_get_transform(RID p_source) const=0; virtual void source_set_polyphony(RID p_source,int p_voice_count)=0; virtual int source_get_polyphony(RID p_source) const=0; @@ -141,8 +141,8 @@ public: virtual RID listener_create()=0; virtual void listener_set_space(RID p_listener, RID p_space)=0; - virtual void listener_set_transform(RID p_listener, const Matrix32& p_transform)=0; - virtual Matrix32 listener_get_transform(RID p_listener) const=0; + virtual void listener_set_transform(RID p_listener, const Transform2D& p_transform)=0; + virtual Transform2D listener_get_transform(RID p_listener) const=0; virtual void listener_set_param(RID p_listener, ListenerParam p_param, float p_value)=0; virtual float listener_get_param(RID p_listener, ListenerParam p_param) const=0; diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index de570b7e4d..887fc5ac5f 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -242,7 +242,7 @@ public: virtual RID mesh_create()=0; - virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes=Vector<PoolVector<uint8_t> >(),const Vector<AABB>& p_bone_aabbs=Vector<AABB>())=0; + virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes=Vector<PoolVector<uint8_t> >(),const Vector<Rect3>& p_bone_aabbs=Vector<Rect3>())=0; virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount)=0; virtual int mesh_get_morph_target_count(RID p_mesh) const=0; @@ -264,17 +264,17 @@ public: virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const=0; virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const=0; - virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const=0; + virtual Rect3 mesh_surface_get_aabb(RID p_mesh, int p_surface) const=0; virtual Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const=0; - virtual Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const=0; + virtual Vector<Rect3> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const=0; virtual void mesh_remove_surface(RID p_mesh,int p_index)=0; virtual int mesh_get_surface_count(RID p_mesh) const=0; - virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb)=0; - virtual AABB mesh_get_custom_aabb(RID p_mesh) const=0; + virtual void mesh_set_custom_aabb(RID p_mesh,const Rect3& p_aabb)=0; + virtual Rect3 mesh_get_custom_aabb(RID p_mesh) const=0; - virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton) const=0; + virtual Rect3 mesh_get_aabb(RID p_mesh, RID p_skeleton) const=0; virtual void mesh_clear(RID p_mesh)=0; /* MULTIMESH API */ @@ -287,19 +287,19 @@ public: virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh)=0; virtual void multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform)=0; - virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform)=0; + virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Transform2D& p_transform)=0; virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color)=0; virtual RID multimesh_get_mesh(RID p_multimesh) const=0; virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const=0; - virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const=0; + virtual Transform2D multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const=0; virtual Color multimesh_instance_get_color(RID p_multimesh,int p_index) const=0; virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible)=0; virtual int multimesh_get_visible_instances(RID p_multimesh) const=0; - virtual AABB multimesh_get_aabb(RID p_multimesh) const=0; + virtual Rect3 multimesh_get_aabb(RID p_multimesh) const=0; /* IMMEDIATE API */ @@ -315,7 +315,7 @@ public: virtual void immediate_clear(RID p_immediate)=0; virtual void immediate_set_material(RID p_immediate,RID p_material)=0; virtual RID immediate_get_material(RID p_immediate) const=0; - virtual AABB immediate_get_aabb(RID p_immediate) const=0; + virtual Rect3 immediate_get_aabb(RID p_immediate) const=0; /* SKELETON API */ @@ -325,8 +325,8 @@ public: virtual int skeleton_get_bone_count(RID p_skeleton) const=0; virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform)=0; virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone) const =0; - virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform)=0; - virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone) const=0; + virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Transform2D& p_transform)=0; + virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone) const=0; /* Light API */ @@ -353,7 +353,7 @@ public: virtual bool light_has_shadow(RID p_light) const=0; virtual VS::LightType light_get_type(RID p_light) const=0; - virtual AABB light_get_aabb(RID p_light) const=0; + virtual Rect3 light_get_aabb(RID p_light) const=0; virtual float light_get_param(RID p_light,VS::LightParam p_param)=0; virtual Color light_get_color(RID p_light)=0; virtual uint64_t light_get_version(RID p_light) const=0; @@ -376,7 +376,7 @@ public: virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable)=0; virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers)=0; - virtual AABB reflection_probe_get_aabb(RID p_probe) const=0; + virtual Rect3 reflection_probe_get_aabb(RID p_probe) const=0; virtual VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const=0; virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const=0; virtual Vector3 reflection_probe_get_extents(RID p_probe) const=0; @@ -412,8 +412,8 @@ public: virtual RID gi_probe_create()=0; - virtual void gi_probe_set_bounds(RID p_probe,const AABB& p_bounds)=0; - virtual AABB gi_probe_get_bounds(RID p_probe) const=0; + virtual void gi_probe_set_bounds(RID p_probe,const Rect3& p_bounds)=0; + virtual Rect3 gi_probe_get_bounds(RID p_probe) const=0; virtual void gi_probe_set_cell_size(RID p_probe,float p_range)=0; virtual float gi_probe_get_cell_size(RID p_probe) const=0; @@ -459,7 +459,7 @@ public: virtual void particles_set_pre_process_time(RID p_particles,float p_time)=0; virtual void particles_set_explosiveness_ratio(RID p_particles,float p_ratio)=0; virtual void particles_set_randomness_ratio(RID p_particles,float p_ratio)=0; - virtual void particles_set_custom_aabb(RID p_particles,const AABB& p_aabb)=0; + virtual void particles_set_custom_aabb(RID p_particles,const Rect3& p_aabb)=0; virtual void particles_set_gravity(RID p_particles,const Vector3& p_gravity)=0; virtual void particles_set_use_local_coordinates(RID p_particles,bool p_enable)=0; virtual void particles_set_process_material(RID p_particles,RID p_material)=0; @@ -476,7 +476,7 @@ public: virtual void particles_set_draw_pass_material(RID p_particles,int p_pass, RID p_material)=0; virtual void particles_set_draw_pass_mesh(RID p_particles,int p_pass, RID p_mesh)=0; - virtual AABB particles_get_current_aabb(RID p_particles)=0; + virtual Rect3 particles_get_current_aabb(RID p_particles)=0; @@ -541,7 +541,7 @@ public: bool enabled; Color color; - Matrix32 xform; + Transform2D xform; float height; float energy; float scale; @@ -564,11 +564,11 @@ public: void *texture_cache; // implementation dependent Rect2 rect_cache; - Matrix32 xform_cache; + Transform2D xform_cache; float radius_cache; //used for shadow far plane CameraMatrix shadow_matrix_cache; - Matrix32 light_shader_xform; + Transform2D light_shader_xform; Vector2 light_shader_pos; Light *shadows_next_ptr; @@ -710,7 +710,7 @@ public: struct CommandTransform : public Command { - Matrix32 xform; + Transform2D xform; CommandTransform() { type = TYPE_TRANSFORM; } }; @@ -728,7 +728,7 @@ public: Rect2 rect; }; - Matrix32 xform; + Transform2D xform; bool clip; bool visible; bool behind; @@ -750,7 +750,7 @@ public: Color final_modulate; - Matrix32 final_transform; + Transform2D final_transform; Rect2 final_clip_rect; Item* final_clip_owner; Item* material_owner; @@ -773,7 +773,7 @@ public: return rect; } - Matrix32 xf; + Transform2D xf; bool found_xform=false; bool first=true; @@ -828,7 +828,7 @@ public: case Item::Command::TYPE_MESH: { const Item::CommandMesh* mesh = static_cast< const Item::CommandMesh*>(c); - AABB aabb = RasterizerStorage::base_signleton->mesh_get_aabb(mesh->mesh,mesh->skeleton); + Rect3 aabb = RasterizerStorage::base_signleton->mesh_get_aabb(mesh->mesh,mesh->skeleton); r=Rect2(aabb.pos.x,aabb.pos.y,aabb.size.x,aabb.size.y); @@ -836,7 +836,7 @@ public: case Item::Command::TYPE_MULTIMESH: { const Item::CommandMultiMesh* multimesh = static_cast< const Item::CommandMultiMesh*>(c); - AABB aabb = RasterizerStorage::base_signleton->multimesh_get_aabb(multimesh->multimesh); + Rect3 aabb = RasterizerStorage::base_signleton->multimesh_get_aabb(multimesh->multimesh); r=Rect2(aabb.pos.x,aabb.pos.y,aabb.size.x,aabb.size.y); @@ -898,8 +898,8 @@ public: RID polygon; RID polygon_buffer; Rect2 aabb_cache; - Matrix32 xform; - Matrix32 xform_cache; + Transform2D xform; + Transform2D xform_cache; int light_mask; VS::CanvasOccluderPolygonCullMode cull_cache; @@ -910,7 +910,7 @@ public: - virtual void canvas_light_shadow_buffer_update(RID p_buffer, const Matrix32& p_light_xform, int p_light_mask,float p_near, float p_far, LightOccluderInstance* p_occluders, CameraMatrix *p_xform_cache)=0; + virtual void canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D& p_light_xform, int p_light_mask,float p_near, float p_far, LightOccluderInstance* p_occluders, CameraMatrix *p_xform_cache)=0; virtual void reset_canvas()=0; diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index 8e6345960f..d68c580442 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -2,7 +2,7 @@ #include "visual_server_global.h" #include "visual_server_viewport.h" -void VisualServerCanvas::_render_canvas_item_tree(Item *p_canvas_item, const Matrix32& p_transform, const Rect2& p_clip_rect, const Color& p_modulate, RasterizerCanvas::Light *p_lights) { +void VisualServerCanvas::_render_canvas_item_tree(Item *p_canvas_item, const Transform2D& p_transform, const Rect2& p_clip_rect, const Color& p_modulate, RasterizerCanvas::Light *p_lights) { static const int z_range = VS::CANVAS_ITEM_Z_MAX-VS::CANVAS_ITEM_Z_MIN+1; @@ -25,7 +25,7 @@ void VisualServerCanvas::_render_canvas_item_tree(Item *p_canvas_item, const Mat } -void VisualServerCanvas::_render_canvas_item(Item *p_canvas_item,const Matrix32& p_transform,const Rect2& p_clip_rect, const Color &p_modulate,int p_z,RasterizerCanvas::Item **z_list,RasterizerCanvas::Item **z_last_list,Item *p_canvas_clip,Item *p_material_owner) { +void VisualServerCanvas::_render_canvas_item(Item *p_canvas_item,const Transform2D& p_transform,const Rect2& p_clip_rect, const Color &p_modulate,int p_z,RasterizerCanvas::Item **z_list,RasterizerCanvas::Item **z_last_list,Item *p_canvas_clip,Item *p_material_owner) { Item *ci = p_canvas_item; @@ -33,7 +33,7 @@ void VisualServerCanvas::_render_canvas_item(Item *p_canvas_item,const Matrix32& return; Rect2 rect = ci->get_rect(); - Matrix32 xform = p_transform * ci->xform; + Transform2D xform = p_transform * ci->xform; Rect2 global_rect = xform.xform(rect); global_rect.pos+=p_clip_rect.pos; @@ -150,7 +150,7 @@ void VisualServerCanvas::_light_mask_canvas_items(int p_z,RasterizerCanvas::Item } -void VisualServerCanvas::render_canvas(Canvas *p_canvas, const Matrix32 &p_transform, RasterizerCanvas::Light *p_lights, RasterizerCanvas::Light *p_masked_lights, const Rect2 &p_clip_rect) { +void VisualServerCanvas::render_canvas(Canvas *p_canvas, const Transform2D &p_transform, RasterizerCanvas::Light *p_lights, RasterizerCanvas::Light *p_masked_lights, const Rect2 &p_clip_rect) { VSG::canvas_render->canvas_begin(); @@ -200,17 +200,17 @@ void VisualServerCanvas::render_canvas(Canvas *p_canvas, const Matrix32 &p_trans //mirroring (useful for scrolling backgrounds) if (ci.mirror.x!=0) { - Matrix32 xform2 = p_transform * Matrix32(0,Vector2(ci.mirror.x,0)); + Transform2D xform2 = p_transform * Transform2D(0,Vector2(ci.mirror.x,0)); _render_canvas_item_tree(ci.item,xform2,p_clip_rect,p_canvas->modulate,p_lights); } if (ci.mirror.y!=0) { - Matrix32 xform2 = p_transform * Matrix32(0,Vector2(0,ci.mirror.y)); + Transform2D xform2 = p_transform * Transform2D(0,Vector2(0,ci.mirror.y)); _render_canvas_item_tree(ci.item,xform2,p_clip_rect,p_canvas->modulate,p_lights); } if (ci.mirror.y!=0 && ci.mirror.x!=0) { - Matrix32 xform2 = p_transform * Matrix32(0,ci.mirror); + Transform2D xform2 = p_transform * Transform2D(0,ci.mirror); _render_canvas_item_tree(ci.item,xform2,p_clip_rect,p_canvas->modulate,p_lights); } @@ -323,7 +323,7 @@ void VisualServerCanvas::canvas_item_set_light_mask(RID p_item,int p_mask){ } -void VisualServerCanvas::canvas_item_set_transform(RID p_item, const Matrix32& p_transform){ +void VisualServerCanvas::canvas_item_set_transform(RID p_item, const Transform2D& p_transform){ Item *canvas_item = canvas_item_owner.getornull( p_item ); ERR_FAIL_COND(!canvas_item); @@ -618,7 +618,7 @@ void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector } -void VisualServerCanvas::canvas_item_add_set_transform(RID p_item,const Matrix32& p_transform) { +void VisualServerCanvas::canvas_item_add_set_transform(RID p_item,const Transform2D& p_transform) { Item *canvas_item = canvas_item_owner.getornull( p_item ); @@ -809,7 +809,7 @@ void VisualServerCanvas::canvas_light_set_scale(RID p_light, float p_scale){ clight->scale=p_scale; } -void VisualServerCanvas::canvas_light_set_transform(RID p_light, const Matrix32& p_transform){ +void VisualServerCanvas::canvas_light_set_transform(RID p_light, const Transform2D& p_transform){ RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); @@ -1036,7 +1036,7 @@ void VisualServerCanvas::canvas_light_occluder_set_polygon(RID p_occluder,RID p_ } } -void VisualServerCanvas::canvas_light_occluder_set_transform(RID p_occluder,const Matrix32& p_xform) { +void VisualServerCanvas::canvas_light_occluder_set_transform(RID p_occluder,const Transform2D& p_xform) { RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.get(p_occluder); ERR_FAIL_COND(!occluder); diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h index 4a5091e754..035c48d9ef 100644 --- a/servers/visual/visual_server_canvas.h +++ b/servers/visual/visual_server_canvas.h @@ -114,12 +114,12 @@ public: private: - void _render_canvas_item_tree(Item *p_canvas_item, const Matrix32& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, RasterizerCanvas::Light *p_lights); - void _render_canvas_item(Item *p_canvas_item, const Matrix32& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, int p_z, RasterizerCanvas::Item **z_list, RasterizerCanvas::Item **z_last_list, Item *p_canvas_clip, Item *p_material_owner); + void _render_canvas_item_tree(Item *p_canvas_item, const Transform2D& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, RasterizerCanvas::Light *p_lights); + void _render_canvas_item(Item *p_canvas_item, const Transform2D& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, int p_z, RasterizerCanvas::Item **z_list, RasterizerCanvas::Item **z_last_list, Item *p_canvas_clip, Item *p_material_owner); void _light_mask_canvas_items(int p_z,RasterizerCanvas::Item *p_canvas_item,RasterizerCanvas::Light *p_masked_lights); public: - void render_canvas(Canvas *p_canvas, const Matrix32 &p_transform, RasterizerCanvas::Light *p_lights, RasterizerCanvas::Light *p_masked_lights,const Rect2& p_clip_rect); + void render_canvas(Canvas *p_canvas, const Transform2D &p_transform, RasterizerCanvas::Light *p_lights, RasterizerCanvas::Light *p_masked_lights,const Rect2& p_clip_rect); RID canvas_create(); void canvas_set_item_mirroring(RID p_canvas,RID p_item,const Point2& p_mirroring); @@ -132,7 +132,7 @@ public: void canvas_item_set_visible(RID p_item,bool p_visible); void canvas_item_set_light_mask(RID p_item,int p_mask); - void canvas_item_set_transform(RID p_item, const Matrix32& p_transform); + void canvas_item_set_transform(RID p_item, const Transform2D& p_transform); void canvas_item_set_clip(RID p_item, bool p_clip); void canvas_item_set_distance_field_mode(RID p_item, bool p_enable); void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect,const Rect2& p_rect=Rect2()); @@ -153,7 +153,7 @@ public: void canvas_item_add_triangle_array(RID p_item, const Vector<int>& p_indices, const Vector<Point2>& p_points, const Vector<Color>& p_colors,const Vector<Point2>& p_uvs=Vector<Point2>(), RID p_texture=RID(), int p_count=-1); void canvas_item_add_mesh(RID p_item, const RID& p_mesh,RID p_skeleton=RID()); void canvas_item_add_multimesh(RID p_item, RID p_mesh,RID p_skeleton=RID()); - void canvas_item_add_set_transform(RID p_item,const Matrix32& p_transform); + void canvas_item_add_set_transform(RID p_item,const Transform2D& p_transform); void canvas_item_add_clip_ignore(RID p_item, bool p_ignore); void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable); void canvas_item_set_z(RID p_item, int p_z); @@ -171,7 +171,7 @@ public: void canvas_light_attach_to_canvas(RID p_light,RID p_canvas); void canvas_light_set_enabled(RID p_light, bool p_enabled); void canvas_light_set_scale(RID p_light, float p_scale); - void canvas_light_set_transform(RID p_light, const Matrix32& p_transform); + void canvas_light_set_transform(RID p_light, const Transform2D& p_transform); void canvas_light_set_texture(RID p_light, RID p_texture); void canvas_light_set_texture_offset(RID p_light, const Vector2& p_offset); void canvas_light_set_color(RID p_light, const Color& p_color); @@ -197,7 +197,7 @@ public: void canvas_light_occluder_attach_to_canvas(RID p_occluder,RID p_canvas); void canvas_light_occluder_set_enabled(RID p_occluder,bool p_enabled); void canvas_light_occluder_set_polygon(RID p_occluder,RID p_polygon); - void canvas_light_occluder_set_transform(RID p_occluder,const Matrix32& p_xform); + void canvas_light_occluder_set_transform(RID p_occluder,const Transform2D& p_xform); void canvas_light_occluder_set_light_mask(RID p_occluder,int p_mask); RID canvas_occluder_polygon_create(); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 5fb71aa0f5..d9b650d569 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -104,7 +104,7 @@ class VisualServerRaster : public VisualServer { Rasterizer::BakedLightData data; PoolVector<int> sampler; - AABB octree_aabb; + Rect3 octree_aabb; Size2i octree_tex_size; Size2i light_tex_size; @@ -177,8 +177,8 @@ class VisualServerRaster : public VisualServer { RID base_rid; - AABB aabb; - AABB transformed_aabb; + Rect3 aabb; + Rect3 transformed_aabb; uint32_t object_ID; bool visible; bool visible_in_all_rooms; @@ -428,11 +428,11 @@ class VisualServerRaster : public VisualServer { struct CanvasData { Canvas *canvas; - Matrix32 transform; + Transform2D transform; int layer; }; - Matrix32 global_transform; + Transform2D global_transform; Map<RID,CanvasData> canvas_map; @@ -451,7 +451,7 @@ class VisualServerRaster : public VisualServer { float min,max; float z_near,z_far; - void add_aabb(const AABB& p_aabb) { + void add_aabb(const Rect3& p_aabb) { } @@ -554,9 +554,9 @@ class VisualServerRaster : public VisualServer { void _render_no_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario); void _render_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario); static void _render_canvas_item_viewport(VisualServer* p_self,void *p_vp,const Rect2& p_rect); - void _render_canvas_item_tree(CanvasItem *p_canvas_item, const Matrix32& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, Rasterizer::CanvasLight *p_lights); - void _render_canvas_item(CanvasItem *p_canvas_item, const Matrix32& p_transform, const Rect2& p_clip_rect, float p_opacity, int p_z, Rasterizer::CanvasItem **z_list, Rasterizer::CanvasItem **z_last_list, CanvasItem *p_canvas_clip, CanvasItem *p_material_owner); - void _render_canvas(Canvas *p_canvas, const Matrix32 &p_transform, Rasterizer::CanvasLight *p_lights, Rasterizer::CanvasLight *p_masked_lights); + void _render_canvas_item_tree(CanvasItem *p_canvas_item, const Transform2D& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, Rasterizer::CanvasLight *p_lights); + void _render_canvas_item(CanvasItem *p_canvas_item, const Transform2D& p_transform, const Rect2& p_clip_rect, float p_opacity, int p_z, Rasterizer::CanvasItem **z_list, Rasterizer::CanvasItem **z_last_list, CanvasItem *p_canvas_clip, CanvasItem *p_material_owner); + void _render_canvas(Canvas *p_canvas, const Transform2D &p_transform, Rasterizer::CanvasLight *p_lights, Rasterizer::CanvasLight *p_masked_lights); void _light_mask_canvas_items(int p_z,Rasterizer::CanvasItem *p_canvas_item,Rasterizer::CanvasLight *p_masked_lights); Vector<Vector3> _camera_generate_endpoints(Instance *p_light,Camera *p_camera,float p_range_min, float p_range_max); @@ -671,7 +671,7 @@ public: BIND0R(RID,mesh_create) - BIND10(mesh_add_surface,RID,uint32_t,PrimitiveType,const PoolVector<uint8_t>&,int ,const PoolVector<uint8_t>& ,int ,const AABB&,const Vector<PoolVector<uint8_t> >&,const Vector<AABB>& ) + BIND10(mesh_add_surface,RID,uint32_t,PrimitiveType,const PoolVector<uint8_t>&,int ,const PoolVector<uint8_t>& ,int ,const Rect3&,const Vector<PoolVector<uint8_t> >&,const Vector<Rect3>& ) BIND2(mesh_set_morph_target_count,RID,int) BIND1RC(int,mesh_get_morph_target_count,RID) @@ -692,15 +692,15 @@ public: BIND2RC(uint32_t,mesh_surface_get_format,RID,int) BIND2RC(PrimitiveType,mesh_surface_get_primitive_type,RID,int) - BIND2RC(AABB,mesh_surface_get_aabb,RID,int) + BIND2RC(Rect3,mesh_surface_get_aabb,RID,int) BIND2RC(Vector<PoolVector<uint8_t> >,mesh_surface_get_blend_shapes,RID,int) - BIND2RC(Vector<AABB>,mesh_surface_get_skeleton_aabb,RID,int) + BIND2RC(Vector<Rect3>,mesh_surface_get_skeleton_aabb,RID,int) BIND2(mesh_remove_surface,RID,int) BIND1RC(int,mesh_get_surface_count,RID) - BIND2(mesh_set_custom_aabb,RID,const AABB&) - BIND1RC(AABB,mesh_get_custom_aabb,RID) + BIND2(mesh_set_custom_aabb,RID,const Rect3&) + BIND1RC(Rect3,mesh_get_custom_aabb,RID) BIND1(mesh_clear,RID) @@ -714,14 +714,14 @@ public: BIND2(multimesh_set_mesh,RID,RID) BIND3(multimesh_instance_set_transform,RID,int,const Transform&) - BIND3(multimesh_instance_set_transform_2d,RID,int,const Matrix32& ) + BIND3(multimesh_instance_set_transform_2d,RID,int,const Transform2D& ) BIND3(multimesh_instance_set_color,RID,int,const Color&) BIND1RC(RID,multimesh_get_mesh,RID) - BIND1RC(AABB,multimesh_get_aabb,RID) + BIND1RC(Rect3,multimesh_get_aabb,RID) BIND2RC(Transform,multimesh_instance_get_transform,RID,int ) - BIND2RC(Matrix32,multimesh_instance_get_transform_2d,RID,int) + BIND2RC(Transform2D,multimesh_instance_get_transform_2d,RID,int) BIND2RC(Color,multimesh_instance_get_color,RID,int) BIND2(multimesh_set_visible_instances,RID,int) @@ -750,8 +750,8 @@ public: BIND1RC(int,skeleton_get_bone_count,RID) BIND3(skeleton_bone_set_transform,RID,int,const Transform&) BIND2RC(Transform,skeleton_bone_get_transform,RID,int) - BIND3(skeleton_bone_set_transform_2d,RID,int, const Matrix32& ) - BIND2RC(Matrix32,skeleton_bone_get_transform_2d,RID,int) + BIND3(skeleton_bone_set_transform_2d,RID,int, const Transform2D& ) + BIND2RC(Transform2D,skeleton_bone_get_transform_2d,RID,int) /* Light API */ @@ -809,8 +809,8 @@ public: BIND0R(RID, gi_probe_create) - BIND2(gi_probe_set_bounds,RID,const AABB&) - BIND1RC(AABB,gi_probe_get_bounds,RID) + BIND2(gi_probe_set_bounds,RID,const Rect3&) + BIND1RC(Rect3,gi_probe_get_bounds,RID) BIND2(gi_probe_set_cell_size,RID,float) BIND1RC(float,gi_probe_get_cell_size,RID) @@ -843,7 +843,7 @@ public: BIND2(particles_set_pre_process_time,RID,float ) BIND2(particles_set_explosiveness_ratio,RID,float ) BIND2(particles_set_randomness_ratio,RID,float ) - BIND2(particles_set_custom_aabb,RID,const AABB& ) + BIND2(particles_set_custom_aabb,RID,const Rect3& ) BIND2(particles_set_gravity,RID,const Vector3& ) BIND2(particles_set_use_local_coordinates,RID,bool ) BIND2(particles_set_process_material,RID,RID ) @@ -860,7 +860,7 @@ public: BIND3(particles_set_draw_pass_material,RID,int , RID ) BIND3(particles_set_draw_pass_mesh,RID,int , RID ) - BIND1R(AABB,particles_get_current_aabb,RID); + BIND1R(Rect3,particles_get_current_aabb,RID); #undef BINDBASE @@ -912,10 +912,10 @@ public: BIND2(viewport_attach_canvas,RID,RID ) BIND2(viewport_remove_canvas,RID,RID ) - BIND3(viewport_set_canvas_transform,RID ,RID ,const Matrix32& ) + BIND3(viewport_set_canvas_transform,RID ,RID ,const Transform2D& ) BIND2(viewport_set_transparent_background,RID ,bool ) - BIND2(viewport_set_global_canvas_transform,RID,const Matrix32& ) + BIND2(viewport_set_global_canvas_transform,RID,const Transform2D& ) BIND3(viewport_set_canvas_layer,RID ,RID ,int ) BIND2(viewport_set_shadow_atlas_size,RID ,int ) BIND3(viewport_set_shadow_atlas_quadrant_subdivision,RID ,int, int ) @@ -988,7 +988,7 @@ public: BIND2(instance_set_extra_visibility_margin, RID, real_t ) // don't use these in a game! - BIND2RC(Vector<ObjectID>,instances_cull_aabb,const AABB& , RID) + BIND2RC(Vector<ObjectID>,instances_cull_aabb,const Rect3& , RID) BIND3RC(Vector<ObjectID>,instances_cull_ray,const Vector3& , const Vector3& , RID ) BIND2RC(Vector<ObjectID>,instances_cull_convex,const Vector<Plane>& , RID) @@ -1018,7 +1018,7 @@ public: BIND2(canvas_item_set_visible,RID,bool ) BIND2(canvas_item_set_light_mask,RID,int ) - BIND2(canvas_item_set_transform,RID, const Matrix32& ) + BIND2(canvas_item_set_transform,RID, const Transform2D& ) BIND2(canvas_item_set_clip,RID, bool ) BIND2(canvas_item_set_distance_field_mode,RID, bool ) BIND3(canvas_item_set_custom_rect,RID, bool ,const Rect2& ) @@ -1039,7 +1039,7 @@ public: BIND7(canvas_item_add_triangle_array,RID, const Vector<int>& , const Vector<Point2>& , const Vector<Color>& ,const Vector<Point2>& , RID , int) BIND3(canvas_item_add_mesh,RID, const RID& ,RID ) BIND3(canvas_item_add_multimesh,RID, RID ,RID ) - BIND2(canvas_item_add_set_transform,RID,const Matrix32& ) + BIND2(canvas_item_add_set_transform,RID,const Transform2D& ) BIND2(canvas_item_add_clip_ignore,RID, bool ) BIND2(canvas_item_set_sort_children_by_y,RID, bool ) BIND2(canvas_item_set_z,RID, int ) @@ -1058,7 +1058,7 @@ public: BIND2(canvas_light_attach_to_canvas,RID,RID ) BIND2(canvas_light_set_enabled,RID, bool ) BIND2(canvas_light_set_scale,RID, float ) - BIND2(canvas_light_set_transform,RID, const Matrix32& ) + BIND2(canvas_light_set_transform,RID, const Transform2D& ) BIND2(canvas_light_set_texture,RID, RID ) BIND2(canvas_light_set_texture_offset,RID, const Vector2& ) BIND2(canvas_light_set_color,RID, const Color& ) @@ -1083,7 +1083,7 @@ public: BIND2(canvas_light_occluder_attach_to_canvas,RID,RID ) BIND2(canvas_light_occluder_set_enabled,RID,bool ) BIND2(canvas_light_occluder_set_polygon,RID,RID ) - BIND2(canvas_light_occluder_set_transform,RID,const Matrix32& ) + BIND2(canvas_light_occluder_set_transform,RID,const Transform2D& ) BIND2(canvas_light_occluder_set_light_mask,RID,int ) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 0f789d9695..4635b0fcfe 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -933,7 +933,7 @@ void VisualServerScene::instance_set_extra_visibility_margin( RID p_instance, re } -Vector<ObjectID> VisualServerScene::instances_cull_aabb(const AABB& p_aabb, RID p_scenario) const { +Vector<ObjectID> VisualServerScene::instances_cull_aabb(const Rect3& p_aabb, RID p_scenario) const { Vector<ObjectID> instances; @@ -1143,7 +1143,7 @@ void VisualServerScene::_update_instance(Instance *p_instance) { p_instance->mirror = p_instance->transform.basis.determinant() < 0.0; - AABB new_aabb; + Rect3 new_aabb; #if 0 if (p_instance->base_type==INSTANCE_PORTAL) { @@ -1266,7 +1266,7 @@ void VisualServerScene::_update_instance(Instance *p_instance) { void VisualServerScene::_update_instance_aabb(Instance *p_instance) { - AABB new_aabb; + Rect3 new_aabb; ERR_FAIL_COND(p_instance->base_type!=VS::INSTANCE_NONE && !p_instance->base.is_valid()); @@ -2485,7 +2485,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { probe->dynamic.enabled=true; Transform cell_to_xform = VSG::storage->gi_probe_get_to_cell_xform(p_instance->base); - AABB bounds = VSG::storage->gi_probe_get_bounds(p_instance->base); + Rect3 bounds = VSG::storage->gi_probe_get_bounds(p_instance->base); float cell_size = VSG::storage->gi_probe_get_cell_size(p_instance->base); probe->dynamic.light_to_cell_xform=cell_to_xform * p_instance->transform.affine_inverse(); diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index ac272467b4..fc3ea29b00 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -210,8 +210,8 @@ public: SelfList<Instance> update_item; - AABB aabb; - AABB transformed_aabb; + Rect3 aabb; + Rect3 transformed_aabb; float extra_margin; uint32_t object_ID; @@ -504,7 +504,7 @@ public: // don't use these in a game! - virtual Vector<ObjectID> instances_cull_aabb(const AABB& p_aabb, RID p_scenario=RID()) const; + virtual Vector<ObjectID> instances_cull_aabb(const Rect3& p_aabb, RID p_scenario=RID()) const; virtual Vector<ObjectID> instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario=RID()) const; virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane>& p_convex, RID p_scenario=RID()) const; diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index 7ecf041d2a..780335a7f4 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -82,7 +82,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { for (Map<RID,Viewport::CanvasData>::Element *E=p_viewport->canvas_map.front();E;E=E->next()) { - Matrix32 xf = p_viewport->global_transform * E->get().transform; + Transform2D xf = p_viewport->global_transform * E->get().transform; VisualServerCanvas::Canvas *canvas = static_cast<VisualServerCanvas::Canvas*>(E->get().canvas); @@ -108,7 +108,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { cl->filter_next_ptr=lights; lights=cl; cl->texture_cache=NULL; - Matrix32 scale; + Transform2D scale; scale.scale(cl->rect_cache.size); scale.elements[2]=cl->rect_cache.pos; cl->light_shader_xform = (cl->xform_cache * scale).affine_inverse(); @@ -152,7 +152,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { for (Map<RID,Viewport::CanvasData>::Element *E=p_viewport->canvas_map.front();E;E=E->next()) { VisualServerCanvas::Canvas *canvas = static_cast<VisualServerCanvas::Canvas*>(E->get().canvas); - Matrix32 xf = p_viewport->global_transform * E->get().transform; + Transform2D xf = p_viewport->global_transform * E->get().transform; for(Set<RasterizerCanvas::LightOccluderInstance*>::Element *F=canvas->occluders.front();F;F=F->next()) { @@ -198,7 +198,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { // print_line("canvas "+itos(i)+" size: "+itos(I->get()->canvas->child_items.size())); //print_line("GT "+p_viewport->global_transform+". CT: "+E->get()->transform); - Matrix32 xform = p_viewport->global_transform * E->get()->transform; + Transform2D xform = p_viewport->global_transform * E->get()->transform; RasterizerCanvas::Light *canvas_lights=NULL; @@ -461,7 +461,7 @@ void VisualServerViewport::viewport_remove_canvas(RID p_viewport,RID p_canvas){ canvas->viewports.erase(p_viewport); } -void VisualServerViewport::viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Matrix32& p_offset){ +void VisualServerViewport::viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Transform2D& p_offset){ Viewport * viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); @@ -479,7 +479,7 @@ void VisualServerViewport::viewport_set_transparent_background(RID p_viewport,bo } -void VisualServerViewport::viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform){ +void VisualServerViewport::viewport_set_global_canvas_transform(RID p_viewport,const Transform2D& p_transform){ Viewport * viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h index 3b14ee2b1c..ff4bc2601d 100644 --- a/servers/visual/visual_server_viewport.h +++ b/servers/visual/visual_server_viewport.h @@ -56,11 +56,11 @@ public: struct CanvasData { CanvasBase *canvas; - Matrix32 transform; + Transform2D transform; int layer; }; - Matrix32 global_transform; + Transform2D global_transform; Map<RID,CanvasData> canvas_map; @@ -128,10 +128,10 @@ public: void viewport_set_scenario(RID p_viewport,RID p_scenario); void viewport_attach_canvas(RID p_viewport,RID p_canvas); void viewport_remove_canvas(RID p_viewport,RID p_canvas); - void viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Matrix32& p_offset); + void viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Transform2D& p_offset); void viewport_set_transparent_background(RID p_viewport,bool p_enabled); - void viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform); + void viewport_set_global_canvas_transform(RID p_viewport,const Transform2D& p_transform); void viewport_set_canvas_layer(RID p_viewport,RID p_canvas,int p_layer); void viewport_set_shadow_atlas_size(RID p_viewport,int p_size); diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 9de17dc431..71f9c88f2a 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -345,7 +345,7 @@ RID VisualServer::get_white_texture() { } -Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t *p_offsets,uint32_t p_stride,PoolVector<uint8_t> &r_vertex_array,int p_vertex_array_len,PoolVector<uint8_t> &r_index_array,int p_index_array_len,AABB &r_aabb,Vector<AABB> r_bone_aabb) { +Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t *p_offsets,uint32_t p_stride,PoolVector<uint8_t> &r_vertex_array,int p_vertex_array_len,PoolVector<uint8_t> &r_index_array,int p_index_array_len,Rect3 &r_aabb,Vector<Rect3> r_bone_aabb) { PoolVector<uint8_t>::Write vw = r_vertex_array.write(); @@ -420,7 +420,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t } } - r_aabb=AABB(Vector3(aabb.pos.x,aabb.pos.y,0),Vector3(aabb.size.x,aabb.size.y,0)); + r_aabb=Rect3(Vector3(aabb.pos.x,aabb.pos.y,0),Vector3(aabb.size.x,aabb.size.y,0)); } else { @@ -432,7 +432,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t const Vector3* src=read.ptr(); // setting vertices means regenerating the AABB - AABB aabb; + Rect3 aabb; if (p_format&ARRAY_COMPRESS_VERTEX) { @@ -446,7 +446,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t if (i==0) { - aabb=AABB(src[i],Vector3()); + aabb=Rect3(src[i],Vector3()); } else { aabb.expand_to( src[i] ); @@ -464,7 +464,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t if (i==0) { - aabb=AABB(src[i],Vector3()); + aabb=Rect3(src[i],Vector3()); } else { aabb.expand_to( src[i] ); @@ -480,7 +480,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t } break; case VS::ARRAY_NORMAL: { - ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::VECTOR3_ARRAY, ERR_INVALID_PARAMETER ); + ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::POOL_VECTOR3_ARRAY, ERR_INVALID_PARAMETER ); PoolVector<Vector3> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER ); @@ -520,7 +520,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t case VS::ARRAY_TANGENT: { - ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER ); + ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::POOL_REAL_ARRAY, ERR_INVALID_PARAMETER ); PoolVector<real_t> array = p_arrays[ai]; @@ -564,7 +564,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t } break; case VS::ARRAY_COLOR: { - ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::COLOR_ARRAY, ERR_INVALID_PARAMETER ); + ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::POOL_COLOR_ARRAY, ERR_INVALID_PARAMETER ); PoolVector<Color> array = p_arrays[ai]; @@ -604,7 +604,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t } break; case VS::ARRAY_TEX_UV: { - ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::VECTOR2_ARRAY, ERR_INVALID_PARAMETER ); + ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::POOL_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::POOL_VECTOR2_ARRAY, ERR_INVALID_PARAMETER ); PoolVector<Vector2> array = p_arrays[ai]; @@ -640,7 +640,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t case VS::ARRAY_TEX_UV2: { - ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::VECTOR2_ARRAY, ERR_INVALID_PARAMETER ); + ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::POOL_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::POOL_VECTOR2_ARRAY, ERR_INVALID_PARAMETER ); PoolVector<Vector2> array = p_arrays[ai]; @@ -672,7 +672,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t } break; case VS::ARRAY_WEIGHTS: { - ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER ); + ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::POOL_REAL_ARRAY, ERR_INVALID_PARAMETER ); PoolVector<real_t> array = p_arrays[ai]; @@ -712,7 +712,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t } break; case VS::ARRAY_BONES: { - ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::INT_ARRAY, ERR_INVALID_PARAMETER ); + ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::POOL_INT_ARRAY, ERR_INVALID_PARAMETER ); PoolVector<int> array = p_arrays[ai]; @@ -762,7 +762,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t ERR_FAIL_COND_V( p_index_array_len<=0, ERR_INVALID_DATA ); - ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::INT_ARRAY, ERR_INVALID_PARAMETER ); + ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::POOL_INT_ARRAY, ERR_INVALID_PARAMETER ); PoolVector<int> indices = p_arrays[ai]; ERR_FAIL_COND_V( indices.size() == 0, ERR_INVALID_PARAMETER ); @@ -821,7 +821,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t PoolVector<int>::Read rb=bones.read(); PoolVector<float>::Read rw=weights.read(); - AABB *bptr = r_bone_aabb.ptr(); + Rect3 *bptr = r_bone_aabb.ptr(); for(int i=0;i<vs;i++) { @@ -836,7 +836,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t if (bptr->size.x<0) { //first - bptr[idx]=AABB(); + bptr[idx]=Rect3(); bptr[idx].pos=v; any_valid=true; } else { @@ -877,11 +877,11 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi Variant var = p_arrays[i]; switch(var.get_type()) { - case Variant::VECTOR2_ARRAY: { + case Variant::POOL_VECTOR2_ARRAY: { PoolVector<Vector2> v2 = var; array_len=v2.size(); } break; - case Variant::VECTOR3_ARRAY: { + case Variant::POOL_VECTOR3_ARRAY: { PoolVector<Vector3> v3 = var; array_len=v3.size(); } break; @@ -891,11 +891,11 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi } break; } - array_len=Vector3Array(p_arrays[i]).size(); + array_len=PoolVector3Array(p_arrays[i]).size(); ERR_FAIL_COND(array_len==0); } else if (i==VS::ARRAY_INDEX) { - index_array_len=IntArray(p_arrays[i]).size(); + index_array_len=PoolIntArray(p_arrays[i]).size(); } } @@ -939,10 +939,10 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi case VS::ARRAY_VERTEX: { Variant arr = p_arrays[0]; - if (arr.get_type()==Variant::VECTOR2_ARRAY) { + if (arr.get_type()==Variant::POOL_VECTOR2_ARRAY) { elem_size=2; p_compress_format|=ARRAY_FLAG_USE_2D_VERTICES; - } else if (arr.get_type()==Variant::VECTOR3_ARRAY) { + } else if (arr.get_type()==Variant::POOL_VECTOR3_ARRAY) { p_compress_format&=~ARRAY_FLAG_USE_2D_VERTICES; elem_size=3; } else { @@ -1078,8 +1078,8 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi PoolVector<uint8_t> index_array; index_array.resize(index_array_size); - AABB aabb; - Vector<AABB> bone_aabb; + Rect3 aabb; + Vector<Rect3> bone_aabb; Error err = _surface_set_data(p_arrays,format,offsets,total_elem_size,vertex_array,array_len,index_array,index_array_len,aabb,bone_aabb); @@ -1096,7 +1096,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi vertex_array_shape.resize(array_size); PoolVector<uint8_t> noindex; - AABB laabb; + Rect3 laabb; Error err = _surface_set_data(p_blend_shapes[i],format&~ARRAY_FORMAT_INDEX,offsets,total_elem_size,vertex_array_shape,array_len,noindex,0,laabb,bone_aabb); aabb.merge_with(laabb); if (err) { diff --git a/servers/visual_server.h b/servers/visual_server.h index d1a20dd6ba..3e7240af6f 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -62,7 +62,7 @@ protected: RID material_2d[16]; - Error _surface_set_data(Array p_arrays,uint32_t p_format,uint32_t *p_offsets,uint32_t p_stride,PoolVector<uint8_t> &r_vertex_array,int p_vertex_array_len,PoolVector<uint8_t> &r_index_array,int p_index_array_len,AABB &r_aabb,Vector<AABB> r_bone_aabb); + Error _surface_set_data(Array p_arrays,uint32_t p_format,uint32_t *p_offsets,uint32_t p_stride,PoolVector<uint8_t> &r_vertex_array,int p_vertex_array_len,PoolVector<uint8_t> &r_index_array,int p_index_array_len,Rect3 &r_aabb,Vector<Rect3> r_bone_aabb); static VisualServer* (*create_func)(); static void _bind_methods(); @@ -244,7 +244,7 @@ public: virtual void mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes=Array(),uint32_t p_compress_format=ARRAY_COMPRESS_DEFAULT); - virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes=Vector<PoolVector<uint8_t> >(),const Vector<AABB>& p_bone_aabbs=Vector<AABB>())=0; + virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes=Vector<PoolVector<uint8_t> >(),const Vector<Rect3>& p_bone_aabbs=Vector<Rect3>())=0; virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount)=0; virtual int mesh_get_morph_target_count(RID p_mesh) const=0; @@ -271,15 +271,15 @@ public: virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const=0; virtual PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const=0; - virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const=0; + virtual Rect3 mesh_surface_get_aabb(RID p_mesh, int p_surface) const=0; virtual Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const=0; - virtual Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const=0; + virtual Vector<Rect3> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const=0; virtual void mesh_remove_surface(RID p_mesh,int p_index)=0; virtual int mesh_get_surface_count(RID p_mesh) const=0; - virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb)=0; - virtual AABB mesh_get_custom_aabb(RID p_mesh) const=0; + virtual void mesh_set_custom_aabb(RID p_mesh,const Rect3& p_aabb)=0; + virtual Rect3 mesh_get_custom_aabb(RID p_mesh) const=0; virtual void mesh_clear(RID p_mesh)=0; @@ -304,14 +304,14 @@ public: virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh)=0; virtual void multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform)=0; - virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform)=0; + virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Transform2D& p_transform)=0; virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color)=0; virtual RID multimesh_get_mesh(RID p_multimesh) const=0; - virtual AABB multimesh_get_aabb(RID p_multimesh) const=0; + virtual Rect3 multimesh_get_aabb(RID p_multimesh) const=0; virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const=0; - virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const=0; + virtual Transform2D multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const=0; virtual Color multimesh_instance_get_color(RID p_multimesh,int p_index) const=0; virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible)=0; @@ -341,8 +341,8 @@ public: virtual int skeleton_get_bone_count(RID p_skeleton) const=0; virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform)=0; virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone) const=0; - virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform)=0; - virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone)const =0; + virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Transform2D& p_transform)=0; + virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone)const =0; /* Light API */ @@ -451,8 +451,8 @@ public: virtual RID gi_probe_create()=0; - virtual void gi_probe_set_bounds(RID p_probe,const AABB& p_bounds)=0; - virtual AABB gi_probe_get_bounds(RID p_probe) const=0; + virtual void gi_probe_set_bounds(RID p_probe,const Rect3& p_bounds)=0; + virtual Rect3 gi_probe_get_bounds(RID p_probe) const=0; virtual void gi_probe_set_cell_size(RID p_probe,float p_range)=0; virtual float gi_probe_get_cell_size(RID p_probe) const=0; @@ -485,7 +485,7 @@ public: virtual void particles_set_pre_process_time(RID p_particles,float p_time)=0; virtual void particles_set_explosiveness_ratio(RID p_particles,float p_ratio)=0; virtual void particles_set_randomness_ratio(RID p_particles,float p_ratio)=0; - virtual void particles_set_custom_aabb(RID p_particles,const AABB& p_aabb)=0; + virtual void particles_set_custom_aabb(RID p_particles,const Rect3& p_aabb)=0; virtual void particles_set_gravity(RID p_particles,const Vector3& p_gravity)=0; virtual void particles_set_use_local_coordinates(RID p_particles,bool p_enable)=0; virtual void particles_set_process_material(RID p_particles,RID p_material)=0; @@ -521,7 +521,7 @@ public: virtual void particles_set_draw_pass_material(RID p_particles,int p_pass, RID p_material)=0; virtual void particles_set_draw_pass_mesh(RID p_particles,int p_pass, RID p_mesh)=0; - virtual AABB particles_get_current_aabb(RID p_particles)=0; + virtual Rect3 particles_get_current_aabb(RID p_particles)=0; /* CAMERA API */ @@ -584,10 +584,10 @@ public: virtual void viewport_set_scenario(RID p_viewport,RID p_scenario)=0; virtual void viewport_attach_canvas(RID p_viewport,RID p_canvas)=0; virtual void viewport_remove_canvas(RID p_viewport,RID p_canvas)=0; - virtual void viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Matrix32& p_offset)=0; + virtual void viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Transform2D& p_offset)=0; virtual void viewport_set_transparent_background(RID p_viewport,bool p_enabled)=0; - virtual void viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform)=0; + virtual void viewport_set_global_canvas_transform(RID p_viewport,const Transform2D& p_transform)=0; virtual void viewport_set_canvas_layer(RID p_viewport,RID p_canvas,int p_layer)=0; virtual void viewport_set_shadow_atlas_size(RID p_viewport,int p_size)=0; @@ -725,7 +725,7 @@ public: virtual void instance_set_extra_visibility_margin( RID p_instance, real_t p_margin )=0; // don't use these in a game! - virtual Vector<ObjectID> instances_cull_aabb(const AABB& p_aabb, RID p_scenario=RID()) const=0; + virtual Vector<ObjectID> instances_cull_aabb(const Rect3& p_aabb, RID p_scenario=RID()) const=0; virtual Vector<ObjectID> instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario=RID()) const=0; virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane>& p_convex, RID p_scenario=RID()) const=0; @@ -767,7 +767,7 @@ public: virtual void canvas_item_set_visible(RID p_item,bool p_visible)=0; virtual void canvas_item_set_light_mask(RID p_item,int p_mask)=0; - virtual void canvas_item_set_transform(RID p_item, const Matrix32& p_transform)=0; + virtual void canvas_item_set_transform(RID p_item, const Transform2D& p_transform)=0; virtual void canvas_item_set_clip(RID p_item, bool p_clip)=0; virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable)=0; virtual void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect,const Rect2& p_rect=Rect2())=0; @@ -793,7 +793,7 @@ public: virtual void canvas_item_add_triangle_array(RID p_item, const Vector<int>& p_indices, const Vector<Point2>& p_points, const Vector<Color>& p_colors,const Vector<Point2>& p_uvs=Vector<Point2>(), RID p_texture=RID(), int p_count=-1)=0; virtual void canvas_item_add_mesh(RID p_item, const RID& p_mesh,RID p_skeleton=RID())=0; virtual void canvas_item_add_multimesh(RID p_item, RID p_mesh,RID p_skeleton=RID())=0; - virtual void canvas_item_add_set_transform(RID p_item,const Matrix32& p_transform)=0; + virtual void canvas_item_add_set_transform(RID p_item,const Transform2D& p_transform)=0; virtual void canvas_item_add_clip_ignore(RID p_item, bool p_ignore)=0; virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable)=0; virtual void canvas_item_set_z(RID p_item, int p_z)=0; @@ -811,7 +811,7 @@ public: virtual void canvas_light_attach_to_canvas(RID p_light,RID p_canvas)=0; virtual void canvas_light_set_enabled(RID p_light, bool p_enabled)=0; virtual void canvas_light_set_scale(RID p_light, float p_scale)=0; - virtual void canvas_light_set_transform(RID p_light, const Matrix32& p_transform)=0; + virtual void canvas_light_set_transform(RID p_light, const Transform2D& p_transform)=0; virtual void canvas_light_set_texture(RID p_light, RID p_texture)=0; virtual void canvas_light_set_texture_offset(RID p_light, const Vector2& p_offset)=0; virtual void canvas_light_set_color(RID p_light, const Color& p_color)=0; @@ -852,7 +852,7 @@ public: virtual void canvas_light_occluder_attach_to_canvas(RID p_occluder,RID p_canvas)=0; virtual void canvas_light_occluder_set_enabled(RID p_occluder,bool p_enabled)=0; virtual void canvas_light_occluder_set_polygon(RID p_occluder,RID p_polygon)=0; - virtual void canvas_light_occluder_set_transform(RID p_occluder,const Matrix32& p_xform)=0; + virtual void canvas_light_occluder_set_transform(RID p_occluder,const Transform2D& p_xform)=0; virtual void canvas_light_occluder_set_light_mask(RID p_occluder,int p_mask)=0; virtual RID canvas_occluder_polygon_create()=0; diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp index c6953c82be..6b6a864ecc 100644 --- a/tools/doc/doc_data.cpp +++ b/tools/doc/doc_data.cpp @@ -308,23 +308,23 @@ void DocData::generate(bool p_basic_types) { default_arg_text=Variant::get_type_name(default_arg.get_type())+"("+default_arg_text+")"; break; - case Variant::_AABB: //sorry naming convention fail :( not like it's used often // 10 + case Variant::RECT3: //sorry naming convention fail :( not like it's used often // 10 case Variant::COLOR: case Variant::PLANE: - case Variant::RAW_ARRAY: - case Variant::INT_ARRAY: - case Variant::REAL_ARRAY: - case Variant::STRING_ARRAY: //25 - case Variant::VECTOR2_ARRAY: - case Variant::VECTOR3_ARRAY: - case Variant::COLOR_ARRAY: + case Variant::POOL_BYTE_ARRAY: + case Variant::POOL_INT_ARRAY: + case Variant::POOL_REAL_ARRAY: + case Variant::POOL_STRING_ARRAY: //25 + case Variant::POOL_VECTOR2_ARRAY: + case Variant::POOL_VECTOR3_ARRAY: + case Variant::POOL_COLOR_ARRAY: default_arg_text=Variant::get_type_name(default_arg.get_type())+"("+default_arg_text+")"; break; case Variant::VECTOR2: // 5 case Variant::RECT2: case Variant::VECTOR3: case Variant::QUAT: - case Variant::MATRIX3: + case Variant::BASIS: default_arg_text=Variant::get_type_name(default_arg.get_type())+default_arg_text; break; case Variant::OBJECT: diff --git a/tools/doc/doc_dump.cpp b/tools/doc/doc_dump.cpp index cf7c840b30..e1ffcfbbb2 100644 --- a/tools/doc/doc_dump.cpp +++ b/tools/doc/doc_dump.cpp @@ -187,15 +187,15 @@ void DocDump::dump(const String& p_file) { case Variant::VECTOR3: case Variant::PLANE: case Variant::QUAT: - case Variant::_AABB: //sorry naming convention fail :( not like it's used often // 10 - case Variant::MATRIX3: + case Variant::RECT3: //sorry naming convention fail :( not like it's used often // 10 + case Variant::BASIS: case Variant::COLOR: - case Variant::RAW_ARRAY: - case Variant::INT_ARRAY: - case Variant::REAL_ARRAY: - case Variant::STRING_ARRAY: //25 - case Variant::VECTOR3_ARRAY: - case Variant::COLOR_ARRAY: + case Variant::POOL_BYTE_ARRAY: + case Variant::POOL_INT_ARRAY: + case Variant::POOL_REAL_ARRAY: + case Variant::POOL_STRING_ARRAY: //25 + case Variant::POOL_VECTOR3_ARRAY: + case Variant::POOL_COLOR_ARRAY: default_arg_text=Variant::get_type_name(default_arg.get_type())+"("+default_arg_text+")"; break; case Variant::OBJECT: diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index ba18d382ce..a98a435ea2 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -3525,7 +3525,7 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id,int p_last_track) { h.type==Variant::VECTOR2 || h.type==Variant::RECT2 || h.type==Variant::VECTOR3 || - h.type==Variant::_AABB || + h.type==Variant::RECT3 || h.type==Variant::QUAT || h.type==Variant::COLOR || h.type==Variant::TRANSFORM ) { diff --git a/tools/editor/asset_library_editor_plugin.cpp b/tools/editor/asset_library_editor_plugin.cpp index 422bc0db58..11d7a2b58b 100644 --- a/tools/editor/asset_library_editor_plugin.cpp +++ b/tools/editor/asset_library_editor_plugin.cpp @@ -321,7 +321,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { } /////////////////////////////////////////////////////////////////////////////////// -void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data) { +void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int p_code, const PoolStringArray& headers, const PoolByteArray& p_data) { String error_text; @@ -691,12 +691,12 @@ void EditorAssetLibrary::_select_asset(int p_id){ description->popup_centered_minsize();*/ } -void EditorAssetLibrary::_image_update(bool use_cache, bool final, const ByteArray& p_data, int p_queue_id) { +void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByteArray& p_data, int p_queue_id) { Object *obj = ObjectDB::get_instance(image_queue[p_queue_id].target); if (obj) { bool image_set = false; - ByteArray image_data = p_data; + PoolByteArray image_data = p_data; if(use_cache) { String cache_filename_base = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp").plus_file("assetimage_"+image_queue[p_queue_id].image_url.md5_text()); @@ -704,11 +704,11 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const ByteArr FileAccess* file = FileAccess::open(cache_filename_base+".data", FileAccess::READ); if(file) { - ByteArray cached_data; + PoolByteArray cached_data; int len=file->get_32(); cached_data.resize(len); - ByteArray::Write w=cached_data.write(); + PoolByteArray::Write w=cached_data.write(); file->get_buffer(w.ptr(), len); image_data = cached_data; @@ -717,7 +717,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const ByteArr } int len=image_data.size(); - ByteArray::Read r=image_data.read(); + PoolByteArray::Read r=image_data.read(); Image image(r.ptr(),len); if (!image.empty()) { float max_height = 10000; @@ -745,7 +745,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const ByteArr } } -void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data,int p_queue_id) { +void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, const PoolStringArray& headers, const PoolByteArray& p_data,int p_queue_id) { ERR_FAIL_COND( !image_queue.has(p_queue_id) ); @@ -767,7 +767,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons } int len=p_data.size(); - ByteArray::Read r=p_data.read(); + PoolByteArray::Read r=p_data.read(); file = FileAccess::open(cache_filename_base+".data", FileAccess::WRITE); if(file) { file->store_32(len); @@ -855,7 +855,7 @@ void EditorAssetLibrary::_request_image(ObjectID p_for,String p_image_url,ImageT add_child(iq.request); - _image_update(true, false, ByteArray(), iq.queue_id); + _image_update(true, false, PoolByteArray(), iq.queue_id); _update_image_queue(); @@ -1021,14 +1021,14 @@ void EditorAssetLibrary::_api_request(const String& p_request, RequestType p_req -void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data) { +void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const PoolStringArray& headers, const PoolByteArray& p_data) { String str; { int datalen=p_data.size(); - ByteArray::Read r = p_data.read(); + PoolByteArray::Read r = p_data.read(); str.parse_utf8((const char*)r.ptr(),datalen); } diff --git a/tools/editor/asset_library_editor_plugin.h b/tools/editor/asset_library_editor_plugin.h index c7d6ad8bea..4ae229cefe 100644 --- a/tools/editor/asset_library_editor_plugin.h +++ b/tools/editor/asset_library_editor_plugin.h @@ -162,7 +162,7 @@ class EditorAssetLibraryItemDownload : public PanelContainer { void _close(); void _install(); void _make_request(); - void _http_download_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data); + void _http_download_completed(int p_status, int p_code, const PoolStringArray& headers, const PoolByteArray& p_data); protected: @@ -259,8 +259,8 @@ class EditorAssetLibrary : public PanelContainer { int last_queue_id; Map<int,ImageQueue> image_queue; - void _image_update(bool use_cache, bool final, const ByteArray& p_data, int p_queue_id); - void _image_request_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data, int p_queue_id); + void _image_update(bool use_cache, bool final, const PoolByteArray& p_data, int p_queue_id); + void _image_request_completed(int p_status, int p_code, const PoolStringArray& headers, const PoolByteArray& p_data, int p_queue_id); void _request_image(ObjectID p_for,String p_image_url,ImageType p_type,int p_image_index); void _update_image_queue(); @@ -298,8 +298,8 @@ class EditorAssetLibrary : public PanelContainer { void _search(int p_page=0); void _rerun_search(int p_ignore); void _api_request(const String& p_request, RequestType p_request_type, const String &p_arguments=""); - void _http_request_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data); - void _http_download_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data); + void _http_request_completed(int p_status, int p_code, const PoolStringArray& headers, const PoolByteArray& p_data); + void _http_download_completed(int p_status, int p_code, const PoolStringArray& headers, const PoolByteArray& p_data); void _repository_changed(int p_repository_id); void _support_toggled(int p_support); diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp index 33612293d0..6e53c32080 100644 --- a/tools/editor/connections_dialog.cpp +++ b/tools/editor/connections_dialog.cpp @@ -249,8 +249,8 @@ void ConnectDialog::_add_bind() { case Variant::VECTOR3: value = Vector3(); break; case Variant::PLANE: value = Plane(); break; case Variant::QUAT: value = Quat(); break; - case Variant::_AABB: value = AABB(); break; - case Variant::MATRIX3: value = Matrix3(); break; + case Variant::RECT3: value = Rect3(); break; + case Variant::BASIS: value = Basis(); break; case Variant::TRANSFORM: value = Transform(); break; case Variant::COLOR: value = Color(); break; case Variant::IMAGE: value = Image(); break; @@ -343,8 +343,8 @@ ConnectDialog::ConnectDialog() { type_list->add_item("Vector3",Variant::VECTOR3); type_list->add_item("Plane",Variant::PLANE); type_list->add_item("Quat",Variant::QUAT); - type_list->add_item("AABB",Variant::_AABB); - type_list->add_item("Matrix3",Variant::MATRIX3); + type_list->add_item("Rect3",Variant::RECT3); + type_list->add_item("Basis",Variant::BASIS); type_list->add_item("Transform",Variant::TRANSFORM); //type_list->add_separator(); type_list->add_item("Color",Variant::COLOR); @@ -475,7 +475,7 @@ void ConnectionsDock::_connect() { bool defer=connect_dialog->get_deferred(); bool oshot=connect_dialog->get_oneshot(); Vector<Variant> binds = connect_dialog->get_binds(); - StringArray args = it->get_metadata(0).operator Dictionary()["args"]; + PoolStringArray args = it->get_metadata(0).operator Dictionary()["args"]; int flags = CONNECT_PERSIST | (defer?CONNECT_DEFERRED:0) | (oshot?CONNECT_ONESHOT:0); undo_redo->create_action(vformat(TTR("Connect '%s' to '%s'"),signal,String(dst_method))); @@ -668,7 +668,7 @@ void ConnectionsDock::update_tree() { String signaldesc; signaldesc=mi.name+"("; - StringArray argnames; + PoolStringArray argnames; if (mi.arguments.size()) { signaldesc+=" "; for(int i=0;i<mi.arguments.size();i++) { diff --git a/tools/editor/editor_autoload_settings.cpp b/tools/editor/editor_autoload_settings.cpp index 516863eae2..071a237ea8 100644 --- a/tools/editor/editor_autoload_settings.cpp +++ b/tools/editor/editor_autoload_settings.cpp @@ -377,7 +377,7 @@ Variant EditorAutoloadSettings::get_drag_data_fw(const Point2& p_point, Control if (autoload_cache.size() <= 1) return false; - StringArray autoloads; + PoolStringArray autoloads; TreeItem *next = tree->get_next_selected(NULL); @@ -471,7 +471,7 @@ void EditorAutoloadSettings::drop_data_fw(const Point2& p_point, const Variant& } Dictionary drop_data = p_data; - StringArray autoloads = drop_data["autoloads"]; + PoolStringArray autoloads = drop_data["autoloads"]; Vector<int> orders; orders.resize(autoload_cache.size()); diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index 99165c6ed6..408818f729 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -1211,7 +1211,7 @@ void EditorFileDialog::_bind_methods() { ClassDB::bind_method(_MD("invalidate"),&EditorFileDialog::invalidate); ADD_SIGNAL(MethodInfo("file_selected",PropertyInfo( Variant::STRING,"path"))); - ADD_SIGNAL(MethodInfo("files_selected",PropertyInfo( Variant::STRING_ARRAY,"paths"))); + ADD_SIGNAL(MethodInfo("files_selected",PropertyInfo( Variant::POOL_STRING_ARRAY,"paths"))); ADD_SIGNAL(MethodInfo("dir_selected",PropertyInfo( Variant::STRING,"dir"))); BIND_CONSTANT( MODE_OPEN_FILE ); diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index 1804016f47..0003e232c8 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -84,9 +84,9 @@ void EditorImportPlugin::_bind_methods() { ClassDB::add_virtual_method(get_class_static(),MethodInfo(Variant::STRING,"get_visible_name")); ClassDB::add_virtual_method(get_class_static(),MethodInfo("import_dialog",PropertyInfo(Variant::STRING,"from"))); ClassDB::add_virtual_method(get_class_static(),MethodInfo(Variant::INT,"import",PropertyInfo(Variant::STRING,"path"),PropertyInfo(Variant::OBJECT,"from",PROPERTY_HINT_RESOURCE_TYPE,"ResourceImportMetadata"))); - ClassDB::add_virtual_method(get_class_static(),MethodInfo(Variant::RAW_ARRAY,"custom_export",PropertyInfo(Variant::STRING,"path"),PropertyInfo(Variant::OBJECT,"platform",PROPERTY_HINT_RESOURCE_TYPE,"EditorExportPlatform"))); - ClassDB::add_virtual_method(get_class_static(),MethodInfo("import_from_drop",PropertyInfo(Variant::STRING_ARRAY,"files"),PropertyInfo(Variant::STRING,"dest_path"))); - ClassDB::add_virtual_method(get_class_static(),MethodInfo("reimport_multiple_files",PropertyInfo(Variant::STRING_ARRAY,"files"))); + ClassDB::add_virtual_method(get_class_static(),MethodInfo(Variant::POOL_BYTE_ARRAY,"custom_export",PropertyInfo(Variant::STRING,"path"),PropertyInfo(Variant::OBJECT,"platform",PROPERTY_HINT_RESOURCE_TYPE,"EditorExportPlatform"))); + ClassDB::add_virtual_method(get_class_static(),MethodInfo("import_from_drop",PropertyInfo(Variant::POOL_STRING_ARRAY,"files"),PropertyInfo(Variant::STRING,"dest_path"))); + ClassDB::add_virtual_method(get_class_static(),MethodInfo("reimport_multiple_files",PropertyInfo(Variant::POOL_STRING_ARRAY,"files"))); ClassDB::add_virtual_method(get_class_static(),MethodInfo(Variant::BOOL,"can_reimport_multiple_files")); // BIND_VMETHOD( mi ); @@ -175,7 +175,7 @@ EditorImportPlugin::EditorImportPlugin() { void EditorExportPlugin::_bind_methods() { MethodInfo mi = MethodInfo("custom_export:Variant",PropertyInfo(Variant::STRING,"name"),PropertyInfo(Variant::OBJECT,"platform",PROPERTY_HINT_RESOURCE_TYPE,"EditorExportPlatform")); - mi.return_val.type=Variant::RAW_ARRAY; + mi.return_val.type=Variant::POOL_BYTE_ARRAY; BIND_VMETHOD( mi ); } @@ -188,7 +188,7 @@ Vector<uint8_t> EditorExportPlugin::custom_export(String& p_path,const Ref<Edito Variant d = get_script_instance()->call("custom_export",p_path,p_platform); if (d.get_type()==Variant::NIL) return Vector<uint8_t>(); - if (d.get_type()==Variant::RAW_ARRAY) + if (d.get_type()==Variant::POOL_BYTE_ARRAY) return d; ERR_FAIL_COND_V(d.get_type()!=Variant::DICTIONARY,Vector<uint8_t>()); diff --git a/tools/editor/editor_initialize_ssl.cpp b/tools/editor/editor_initialize_ssl.cpp index b7f8e2aad5..9ac4f90e9f 100644 --- a/tools/editor/editor_initialize_ssl.cpp +++ b/tools/editor/editor_initialize_ssl.cpp @@ -34,10 +34,10 @@ void editor_initialize_certificates() { - ByteArray data; + PoolByteArray data; data.resize(_certs_uncompressed_size+1); { - ByteArray::Write w = data.write(); + PoolByteArray::Write w = data.write(); Compression::decompress(w.ptr(),_certs_uncompressed_size,_certs_compressed,_certs_compressed_size,Compression::MODE_DEFLATE); w[_certs_uncompressed_size]=0; //make sure it ends at zero } diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 5fd8f244f7..096999d5e7 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -5358,7 +5358,7 @@ void EditorNode::_bind_methods() { ADD_SIGNAL( MethodInfo("pause_pressed") ); ADD_SIGNAL( MethodInfo("stop_pressed") ); ADD_SIGNAL( MethodInfo("request_help") ); - ADD_SIGNAL( MethodInfo("script_add_function_request",PropertyInfo(Variant::OBJECT,"obj"),PropertyInfo(Variant::STRING,"function"),PropertyInfo(Variant::STRING_ARRAY,"args")) ); + ADD_SIGNAL( MethodInfo("script_add_function_request",PropertyInfo(Variant::OBJECT,"obj"),PropertyInfo(Variant::STRING,"function"),PropertyInfo(Variant::POOL_STRING_ARRAY,"args")) ); ADD_SIGNAL( MethodInfo("resource_saved",PropertyInfo(Variant::OBJECT,"obj")) ); @@ -6784,7 +6784,7 @@ void EditorPluginList::edit(Object* p_object) { } -bool EditorPluginList::forward_gui_input(const Matrix32& p_canvas_xform,const InputEvent& p_event) { +bool EditorPluginList::forward_gui_input(const Transform2D& p_canvas_xform,const InputEvent& p_event) { bool discard = false; @@ -6809,7 +6809,7 @@ bool EditorPluginList::forward_spatial_gui_input(Camera* p_camera, const InputEv return discard; } -void EditorPluginList::forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control* p_canvas) { +void EditorPluginList::forward_draw_over_canvas(const Transform2D& p_canvas_xform,Control* p_canvas) { for (int i = 0; i < plugins_list.size(); i++) { plugins_list[i]->forward_draw_over_canvas(p_canvas_xform,p_canvas); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index fcfd5ca389..2cb1cd00ab 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -792,9 +792,9 @@ public: void make_visible(bool p_visible); void edit(Object *p_object); - bool forward_gui_input(const Matrix32& p_canvas_xform,const InputEvent& p_event); + bool forward_gui_input(const Transform2D& p_canvas_xform,const InputEvent& p_event); bool forward_spatial_gui_input(Camera* p_camera, const InputEvent& p_event); - void forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control* p_canvas); + void forward_draw_over_canvas(const Transform2D& p_canvas_xform,Control* p_canvas); void clear(); bool empty(); diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp index 5722fc556a..8769fe2cd8 100644 --- a/tools/editor/editor_plugin.cpp +++ b/tools/editor/editor_plugin.cpp @@ -141,7 +141,7 @@ Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial* p_spatial) { return Ref<SpatialEditorGizmo>(); } -bool EditorPlugin::forward_canvas_gui_input(const Matrix32& p_canvas_xform,const InputEvent& p_event) { +bool EditorPlugin::forward_canvas_gui_input(const Transform2D& p_canvas_xform,const InputEvent& p_event) { if (get_script_instance() && get_script_instance()->has_method("forward_canvas_gui_input")) { return get_script_instance()->call("forward_canvas_gui_input",p_canvas_xform,p_event); @@ -149,7 +149,7 @@ bool EditorPlugin::forward_canvas_gui_input(const Matrix32& p_canvas_xform,const return false; } -void EditorPlugin::forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control *p_canvas) { +void EditorPlugin::forward_draw_over_canvas(const Transform2D& p_canvas_xform,Control *p_canvas) { if (get_script_instance() && get_script_instance()->has_method("forward_draw_over_canvas")) { get_script_instance()->call("forward_draw_over_canvas",p_canvas_xform,p_canvas); @@ -253,7 +253,7 @@ void EditorPlugin::apply_changes() { void EditorPlugin::get_breakpoints(List<String> *p_breakpoints) { if (get_script_instance() && get_script_instance()->has_method("get_breakpoints")) { - StringArray arr = get_script_instance()->call("get_breakpoints"); + PoolStringArray arr = get_script_instance()->call("get_breakpoints"); for(int i=0;i<arr.size();i++) p_breakpoints->push_back(arr[i]); } @@ -377,8 +377,8 @@ void EditorPlugin::_bind_methods() { ClassDB::bind_method(_MD("queue_save_layout"),&EditorPlugin::queue_save_layout); ClassDB::bind_method(_MD("edit_resource"),&EditorPlugin::edit_resource); - ClassDB::add_virtual_method(get_class_static(),MethodInfo(Variant::BOOL,"forward_canvas_gui_input",PropertyInfo(Variant::MATRIX32,"canvas_xform"),PropertyInfo(Variant::INPUT_EVENT,"event"))); - ClassDB::add_virtual_method(get_class_static(),MethodInfo("forward_draw_over_canvas",PropertyInfo(Variant::MATRIX32,"canvas_xform"),PropertyInfo(Variant::OBJECT,"canvas:Control"))); + ClassDB::add_virtual_method(get_class_static(),MethodInfo(Variant::BOOL,"forward_canvas_gui_input",PropertyInfo(Variant::TRANSFORM2D,"canvas_xform"),PropertyInfo(Variant::INPUT_EVENT,"event"))); + ClassDB::add_virtual_method(get_class_static(),MethodInfo("forward_draw_over_canvas",PropertyInfo(Variant::TRANSFORM2D,"canvas_xform"),PropertyInfo(Variant::OBJECT,"canvas:Control"))); ClassDB::add_virtual_method(get_class_static(),MethodInfo(Variant::BOOL,"forward_spatial_gui_input",PropertyInfo(Variant::OBJECT,"camera",PROPERTY_HINT_RESOURCE_TYPE,"Camera"),PropertyInfo(Variant::INPUT_EVENT,"event"))); MethodInfo gizmo = MethodInfo(Variant::OBJECT,"create_spatial_gizmo",PropertyInfo(Variant::OBJECT,"for_spatial:Spatial")); gizmo.return_val.hint=PROPERTY_HINT_RESOURCE_TYPE; @@ -394,7 +394,7 @@ void EditorPlugin::_bind_methods() { ClassDB::add_virtual_method(get_class_static(),MethodInfo("clear")); ClassDB::add_virtual_method(get_class_static(),MethodInfo("save_external_data")); ClassDB::add_virtual_method(get_class_static(),MethodInfo("apply_changes")); - ClassDB::add_virtual_method(get_class_static(),MethodInfo(Variant::STRING_ARRAY,"get_breakpoints")); + ClassDB::add_virtual_method(get_class_static(),MethodInfo(Variant::POOL_STRING_ARRAY,"get_breakpoints")); ClassDB::add_virtual_method(get_class_static(),MethodInfo("set_window_layout",PropertyInfo(Variant::OBJECT,"layout",PROPERTY_HINT_RESOURCE_TYPE,"ConfigFile"))); ClassDB::add_virtual_method(get_class_static(),MethodInfo("get_window_layout",PropertyInfo(Variant::OBJECT,"layout",PROPERTY_HINT_RESOURCE_TYPE,"ConfigFile"))); diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h index cfa309be11..9943e94d98 100644 --- a/tools/editor/editor_plugin.h +++ b/tools/editor/editor_plugin.h @@ -104,8 +104,8 @@ public: void edit_resource(const Ref<Resource>& p_resource); virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial* p_spatial); - virtual bool forward_canvas_gui_input(const Matrix32& p_canvas_xform, const InputEvent& p_event); - virtual void forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control *p_canvas); + virtual bool forward_canvas_gui_input(const Transform2D& p_canvas_xform, const InputEvent& p_event); + virtual void forward_draw_over_canvas(const Transform2D& p_canvas_xform,Control *p_canvas); virtual bool forward_spatial_gui_input(Camera* p_camera,const InputEvent& p_event); virtual String get_name() const; virtual bool has_main_screen() const; diff --git a/tools/editor/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp index d52247573e..1bf91d4ceb 100644 --- a/tools/editor/filesystem_dock.cpp +++ b/tools/editor/filesystem_dock.cpp @@ -1650,7 +1650,7 @@ void FileSystemDock::_bind_methods() { ClassDB::bind_method(_MD("_preview_invalidated"),&FileSystemDock::_preview_invalidated); - ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::STRING_ARRAY, "files"))); + ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::POOL_STRING_ARRAY, "files"))); ADD_SIGNAL(MethodInfo("open")); } diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 4a1270c1ca..8fd78f11f3 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -1773,7 +1773,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> // get mesh instance and bounding box MeshInstance *mi = p_node->cast_to<MeshInstance>(); - AABB aabb = mi->get_aabb(); + Rect3 aabb = mi->get_aabb(); // create a new rigid body collision node RigidBody * rigid_body = memnew( RigidBody ); @@ -1788,7 +1788,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> Node * mesh = p_node->duplicate(); mesh->set_name(_fixstr(name,"rigid")); // reset the xform matrix of the duplicated node so it can inherit parent node xform - mesh->cast_to<Spatial>()->set_transform(Transform(Matrix3())); + mesh->cast_to<Spatial>()->set_transform(Transform(Basis())); // reparent the new mesh node to the rigid body collision node p_node->add_child(mesh); mesh->set_owner(p_node->get_owner()); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 74a80abbec..5fce9f8f53 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -440,7 +440,7 @@ bool CanvasItemEditor::_is_part_of_subscene(CanvasItem *p_item) { } // slow but modern computers should have no problem -CanvasItem* CanvasItemEditor::_select_canvas_item_at_pos(const Point2& p_pos,Node* p_node,const Matrix32& p_parent_xform,const Matrix32& p_canvas_xform) { +CanvasItem* CanvasItemEditor::_select_canvas_item_at_pos(const Point2& p_pos,Node* p_node,const Transform2D& p_parent_xform,const Transform2D& p_canvas_xform) { if (!p_node) return NULL; @@ -479,7 +479,7 @@ CanvasItem* CanvasItemEditor::_select_canvas_item_at_pos(const Point2& p_pos,Nod return NULL; } -void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos,Node* p_node,const Matrix32& p_parent_xform,const Matrix32& p_canvas_xform, Vector<_SelectResult> &r_items) { +void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos,Node* p_node,const Transform2D& p_parent_xform,const Transform2D& p_canvas_xform, Vector<_SelectResult> &r_items) { if (!p_node) return; if (p_node->cast_to<Viewport>()) @@ -519,7 +519,7 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos,Node* p_nod return; } -void CanvasItemEditor::_find_canvas_items_at_rect(const Rect2& p_rect,Node* p_node,const Matrix32& p_parent_xform,const Matrix32& p_canvas_xform,List<CanvasItem*> *r_items) { +void CanvasItemEditor::_find_canvas_items_at_rect(const Rect2& p_rect,Node* p_node,const Transform2D& p_parent_xform,const Transform2D& p_canvas_xform,List<CanvasItem*> *r_items) { if (!p_node) return; @@ -550,7 +550,7 @@ void CanvasItemEditor::_find_canvas_items_at_rect(const Rect2& p_rect,Node* p_no if (c && c->is_visible() && !c->has_meta("_edit_lock_") && !c->cast_to<CanvasLayer>()) { Rect2 rect = c->get_item_rect(); - Matrix32 xform = p_parent_xform * p_canvas_xform * c->get_transform(); + Transform2D xform = p_parent_xform * p_canvas_xform * c->get_transform(); if ( p_rect.has_point( xform.xform( rect.pos ) ) && p_rect.has_point( xform.xform( rect.pos+Vector2(rect.size.x,0) ) ) && @@ -708,7 +708,7 @@ void CanvasItemEditor::_key_move(const Vector2& p_dir, bool p_snap, KeyMoveMODE if (Node2D *node_2d = canvas_item->cast_to<Node2D>()) { if (p_move_mode == MOVE_LOCAL_WITH_ROT) { - Matrix32 m; + Transform2D m; m.rotate( node_2d->get_rotation() ); drag = m.xform(drag); } @@ -747,7 +747,7 @@ Point2 CanvasItemEditor::_find_topleftmost_point() { Rect2 rect=canvas_item->get_item_rect(); - Matrix32 xform=canvas_item->get_global_transform_with_canvas(); + Transform2D xform=canvas_item->get_global_transform_with_canvas(); r2.expand_to(xform.xform(rect.pos)); r2.expand_to(xform.xform(rect.pos+Vector2(rect.size.x,0))); @@ -805,15 +805,15 @@ CanvasItem *CanvasItemEditor::get_single_item() { return single_item; } -CanvasItemEditor::DragType CanvasItemEditor::_find_drag_type(const Matrix32& p_xform, const Rect2& p_local_rect, const Point2& p_click, Vector2& r_point) { +CanvasItemEditor::DragType CanvasItemEditor::_find_drag_type(const Transform2D& p_xform, const Rect2& p_local_rect, const Point2& p_click, Vector2& r_point) { CanvasItem *canvas_item = get_single_item(); ERR_FAIL_COND_V(!canvas_item,DRAG_NONE); Rect2 rect=canvas_item->get_item_rect(); - Matrix32 xforml=canvas_item->get_global_transform_with_canvas(); - Matrix32 xform=transform * xforml; + Transform2D xforml=canvas_item->get_global_transform_with_canvas(); + Transform2D xform=transform * xforml; Vector2 endpoints[4]={ @@ -1003,7 +1003,7 @@ void CanvasItemEditor::_list_select(const InputEventMouseButton& b) { if (!scene) return; - _find_canvas_items_at_pos(click, scene,transform,Matrix32(), selection_results); + _find_canvas_items_at_pos(click, scene,transform,Transform2D(), selection_results); for(int i=0;i<selection_results.size();i++) { CanvasItem *item=selection_results[i].item; @@ -1295,7 +1295,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) { if (bsfrom.y>bsto.y) SWAP(bsfrom.y,bsto.y); - _find_canvas_items_at_rect(Rect2(bsfrom,bsto-bsfrom),scene,transform,Matrix32(),&selitems); + _find_canvas_items_at_rect(Rect2(bsfrom,bsto-bsfrom),scene,transform,Transform2D(),&selitems); for(List<CanvasItem*>::Element *E=selitems.front();E;E=E->next()) { @@ -1415,7 +1415,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) { return; } - Matrix32 xform = transform * canvas_item->get_global_transform_with_canvas(); + Transform2D xform = transform * canvas_item->get_global_transform_with_canvas(); Rect2 rect=canvas_item->get_item_rect(); // float handle_radius = handle_len * 1.4144; //magic number, guess what it means! @@ -1504,7 +1504,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) { } if (!c) { - c =_select_canvas_item_at_pos(click, scene,transform,Matrix32()); + c =_select_canvas_item_at_pos(click, scene,transform,Transform2D()); CanvasItem* cn = c; @@ -1748,7 +1748,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) { Node2D *n2d = canvas_item->cast_to<Node2D>(); - Matrix32 final_xform = bone_orig_xform; + Transform2D final_xform = bone_orig_xform; @@ -1920,7 +1920,7 @@ void CanvasItemEditor::_viewport_draw() { if (snap_show_grid) { Size2 s = viewport->get_size(); int last_cell; - Matrix32 xform = transform.affine_inverse(); + Transform2D xform = transform.affine_inverse(); if (snap_step.x!=0) { for(int i=0;i<s.width;i++) { @@ -1980,7 +1980,7 @@ void CanvasItemEditor::_viewport_draw() { Rect2 rect=canvas_item->get_item_rect(); - Matrix32 xform=transform * canvas_item->get_global_transform_with_canvas(); + Transform2D xform=transform * canvas_item->get_global_transform_with_canvas(); VisualServer::get_singleton()->canvas_item_add_set_transform(ci,xform); Vector2 endpoints[4]={ @@ -1993,7 +1993,7 @@ void CanvasItemEditor::_viewport_draw() { Color c = Color(1,0.6,0.4,0.7); - VisualServer::get_singleton()->canvas_item_add_set_transform(ci,Matrix32()); + VisualServer::get_singleton()->canvas_item_add_set_transform(ci,Transform2D()); for(int i=0;i<4;i++) { viewport->draw_line(endpoints[i],endpoints[(i+1)%4],c,2); @@ -2043,7 +2043,7 @@ void CanvasItemEditor::_viewport_draw() { } pivot_button->set_disabled(!pivot_found); - VisualServer::get_singleton()->canvas_item_add_set_transform(ci,Matrix32()); + VisualServer::get_singleton()->canvas_item_add_set_transform(ci,Transform2D()); @@ -2215,7 +2215,7 @@ void CanvasItemEditor::_notification(int p_what) { Rect2 r=canvas_item->get_item_rect(); - Matrix32 xform = canvas_item->get_transform(); + Transform2D xform = canvas_item->get_transform(); if (r != se->prev_rect || xform!=se->prev_xform) { viewport->update(); @@ -2330,7 +2330,7 @@ void CanvasItemEditor::edit(CanvasItem *p_canvas_item) { } -void CanvasItemEditor::_find_canvas_items_span(Node *p_node, Rect2& r_rect, const Matrix32& p_xform) { +void CanvasItemEditor::_find_canvas_items_span(Node *p_node, Rect2& r_rect, const Transform2D& p_xform) { @@ -2347,7 +2347,7 @@ void CanvasItemEditor::_find_canvas_items_span(Node *p_node, Rect2& r_rect, cons if (c && !c->is_set_as_toplevel()) _find_canvas_items_span(p_node->get_child(i),r_rect,p_xform * c->get_transform()); else - _find_canvas_items_span(p_node->get_child(i),r_rect,Matrix32()); + _find_canvas_items_span(p_node->get_child(i),r_rect,Transform2D()); } @@ -2355,7 +2355,7 @@ void CanvasItemEditor::_find_canvas_items_span(Node *p_node, Rect2& r_rect, cons if (c) { Rect2 rect = c->get_item_rect(); - Matrix32 xform = p_xform * c->get_transform(); + Transform2D xform = p_xform * c->get_transform(); LockList lock; @@ -2416,7 +2416,7 @@ void CanvasItemEditor::_update_scrollbars() { if (editor->get_edited_scene()) - _find_canvas_items_span(editor->get_edited_scene(),canvas_item_rect,Matrix32()); + _find_canvas_items_span(editor->get_edited_scene(),canvas_item_rect,Transform2D()); List<Map<ObjectID,BoneList>::Element*> bone_to_erase; @@ -2497,7 +2497,7 @@ void CanvasItemEditor::_update_scroll(float) { // current_window->set_scroll(-ofs); - transform=Matrix32(); + transform=Transform2D(); transform.scale_basis(Size2(zoom,zoom)); transform.elements[2]=-ofs; @@ -3160,7 +3160,7 @@ void CanvasItemEditor::_focus_selection(int p_op) { Vector2 scale = canvas_item->get_global_transform().get_scale(); real_t angle = canvas_item->get_global_transform().get_rotation(); - Matrix32 t(angle, Vector2(0.f,0.f)); + Transform2D t(angle, Vector2(0.f,0.f)); item_rect = t.xform(item_rect); Rect2 canvas_item_rect(pos + scale*item_rect.pos, scale*item_rect.size); if (count == 1) { @@ -3783,7 +3783,7 @@ void CanvasItemEditorViewport::_create_nodes(Node* parent, Node* child, String& if (parent->has_method("get_global_pos")) { pos=parent->call("get_global_pos"); } - Matrix32 trans=canvas->get_canvas_transform(); + Transform2D trans=canvas->get_canvas_transform(); Point2 target_pos = (p_point-trans.get_origin())/trans.get_scale().x-pos; if (default_type=="Polygon2D" || default_type=="TouchScreenButton" || default_type=="TextureFrame" || default_type=="Patch9Frame") { target_pos -= texture_size/2; @@ -3831,7 +3831,7 @@ bool CanvasItemEditorViewport::_create_instance(Node* parent, String& path, cons pos=parent_control->get_global_pos(); } } - Matrix32 trans=canvas->get_canvas_transform(); + Transform2D trans=canvas->get_canvas_transform(); editor_data->get_undo_redo().add_do_method(instanced_scene,"set_pos",(p_point-trans.get_origin())/trans.get_scale().x-pos); return true; @@ -3911,7 +3911,7 @@ bool CanvasItemEditorViewport::can_drop_data(const Point2& p_point,const Variant if (!preview->get_parent()){ // create preview only once _create_preview(files); } - Matrix32 trans=canvas->get_canvas_transform(); + Transform2D trans=canvas->get_canvas_transform(); preview->set_position((p_point-trans.get_origin())/trans.get_scale().x); label->set_text(vformat(TTR("Adding %s..."),default_type)); } diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h index ee36554477..f4f628fe28 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.h +++ b/tools/editor/plugins/canvas_item_editor_plugin.h @@ -51,7 +51,7 @@ public: Variant undo_state; Vector2 undo_pivot; - Matrix32 prev_xform; + Transform2D prev_xform; float prev_rot; Rect2 prev_rect; @@ -166,7 +166,7 @@ class CanvasItemEditor : public VBoxContainer { VScrollBar *v_scroll; HBoxContainer *hb; - Matrix32 transform; + Transform2D transform; float zoom; Vector2 snap_offset; Vector2 snap_step; @@ -212,7 +212,7 @@ class CanvasItemEditor : public VBoxContainer { struct BoneList { - Matrix32 xform; + Transform2D xform; Vector2 from; Vector2 to; ObjectID bone; @@ -222,7 +222,7 @@ class CanvasItemEditor : public VBoxContainer { uint64_t bone_last_frame; Map<ObjectID,BoneList> bone_list; - Matrix32 bone_orig_xform; + Transform2D bone_orig_xform; struct BoneIK { @@ -300,9 +300,9 @@ class CanvasItemEditor : public VBoxContainer { int handle_len; bool _is_part_of_subscene(CanvasItem *p_item); - CanvasItem* _select_canvas_item_at_pos(const Point2 &p_pos,Node* p_node,const Matrix32& p_parent_xform,const Matrix32& p_canvas_xform); - void _find_canvas_items_at_pos(const Point2 &p_pos,Node* p_node,const Matrix32& p_parent_xform,const Matrix32& p_canvas_xform, Vector<_SelectResult> &r_items); - void _find_canvas_items_at_rect(const Rect2& p_rect,Node* p_node,const Matrix32& p_parent_xform,const Matrix32& p_canvas_xform,List<CanvasItem*> *r_items); + CanvasItem* _select_canvas_item_at_pos(const Point2 &p_pos,Node* p_node,const Transform2D& p_parent_xform,const Transform2D& p_canvas_xform); + void _find_canvas_items_at_pos(const Point2 &p_pos,Node* p_node,const Transform2D& p_parent_xform,const Transform2D& p_canvas_xform, Vector<_SelectResult> &r_items); + void _find_canvas_items_at_rect(const Rect2& p_rect,Node* p_node,const Transform2D& p_parent_xform,const Transform2D& p_canvas_xform,List<CanvasItem*> *r_items); bool _select(CanvasItem *item, Point2 p_click_pos, bool p_append, bool p_drag=true); @@ -322,7 +322,7 @@ class CanvasItemEditor : public VBoxContainer { void _key_move(const Vector2& p_dir, bool p_snap, KeyMoveMODE p_move_mode); void _list_select(const InputEventMouseButton& b); - DragType _find_drag_type(const Matrix32& p_xform, const Rect2& p_local_rect, const Point2& p_click, Vector2& r_point); + DragType _find_drag_type(const Transform2D& p_xform, const Rect2& p_local_rect, const Point2& p_click, Vector2& r_point); void _popup_callback(int p_op); bool updating_scroll; @@ -342,7 +342,7 @@ class CanvasItemEditor : public VBoxContainer { Point2 _find_topleftmost_point(); - void _find_canvas_items_span(Node *p_node, Rect2& r_rect, const Matrix32& p_xform); + void _find_canvas_items_span(Node *p_node, Rect2& r_rect, const Transform2D& p_xform); Object *_get_editor_data(Object *p_what); @@ -407,7 +407,7 @@ public: Vector2 snap_point(Vector2 p_target, Vector2 p_start = Vector2(0, 0)) const; float snap_angle(float p_target, float p_start = 0) const; - Matrix32 get_canvas_transform() const { return transform; } + Transform2D get_canvas_transform() const { return transform; } static CanvasItemEditor *get_singleton() { return singleton; } Dictionary get_state() const; diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp index 710b9a80c0..263d96ecdf 100644 --- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp @@ -111,7 +111,7 @@ bool CollisionPolygon2DEditor::forward_gui_input(const InputEvent& p_event) { const InputEventMouseButton &mb=p_event.mouse_button; - Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); + Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Vector2 gpoint = Point2(mb.x,mb.y); @@ -346,7 +346,7 @@ void CollisionPolygon2DEditor::_canvas_draw() { poly=node->get_polygon(); - Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); + Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Ref<Texture> handle= get_icon("EditorHandle","EditorIcons"); for(int i=0;i<poly.size();i++) { diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.h b/tools/editor/plugins/collision_polygon_2d_editor_plugin.h index 89f5ed9f06..2c573c1dcf 100644 --- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.h +++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.h @@ -95,7 +95,7 @@ class CollisionPolygon2DEditorPlugin : public EditorPlugin { public: - virtual bool forward_canvas_gui_input(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); } + virtual bool forward_canvas_gui_input(const Transform2D& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); } virtual String get_name() const { return "CollisionPolygon2D"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp b/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp index a7b8e1d704..626ca9e132 100644 --- a/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -321,7 +321,7 @@ bool CollisionShape2DEditor::forward_gui_input(const InputEvent& p_event) { case InputEvent::MOUSE_BUTTON: { const InputEventMouseButton& mb = p_event.mouse_button; - Matrix32 gt = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); + Transform2D gt = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Point2 gpoint(mb.x,mb.y); @@ -436,7 +436,7 @@ void CollisionShape2DEditor::_canvas_draw() { } Control *c = canvas_item_editor->get_viewport_control(); - Matrix32 gt = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); + Transform2D gt = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Ref<Texture> h = get_icon("EditorHandle","EditorIcons"); Vector2 size = h->get_size()*0.5; diff --git a/tools/editor/plugins/collision_shape_2d_editor_plugin.h b/tools/editor/plugins/collision_shape_2d_editor_plugin.h index 589f7ae9f8..37708db5e0 100644 --- a/tools/editor/plugins/collision_shape_2d_editor_plugin.h +++ b/tools/editor/plugins/collision_shape_2d_editor_plugin.h @@ -86,7 +86,7 @@ class CollisionShape2DEditorPlugin : public EditorPlugin { EditorNode* editor; public: - virtual bool forward_canvas_gui_input(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_shape_2d_editor->forward_gui_input(p_event); } + virtual bool forward_canvas_gui_input(const Transform2D& p_canvas_xform,const InputEvent& p_event) { return collision_shape_2d_editor->forward_gui_input(p_event); } virtual String get_name() const { return "CollisionShape2D"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp index c468404f0f..f6a51632a0 100644 --- a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp +++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp @@ -121,7 +121,7 @@ bool LightOccluder2DEditor::forward_gui_input(const InputEvent& p_event) { const InputEventMouseButton &mb=p_event.mouse_button; - Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); + Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Vector2 gpoint = Point2(mb.x,mb.y); @@ -361,7 +361,7 @@ void LightOccluder2DEditor::_canvas_draw() { poly=Variant(node->get_occluder_polygon()->get_polygon()); - Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); + Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Ref<Texture> handle= get_icon("EditorHandle","EditorIcons"); for(int i=0;i<poly.size();i++) { diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.h b/tools/editor/plugins/light_occluder_2d_editor_plugin.h index 8f96e44df5..431c01fe75 100644 --- a/tools/editor/plugins/light_occluder_2d_editor_plugin.h +++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.h @@ -99,7 +99,7 @@ class LightOccluder2DEditorPlugin : public EditorPlugin { public: - virtual bool forward_canvas_gui_input(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); } + virtual bool forward_canvas_gui_input(const Transform2D& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); } virtual String get_name() const { return "LightOccluder2D"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/plugins/multimesh_editor_plugin.cpp b/tools/editor/plugins/multimesh_editor_plugin.cpp index f70eb1fddb..cce1c52215 100644 --- a/tools/editor/plugins/multimesh_editor_plugin.cpp +++ b/tools/editor/plugins/multimesh_editor_plugin.cpp @@ -236,7 +236,7 @@ void MultiMeshEditor::_populate() { xform = xform * axis_xform; - Matrix3 post_xform; + Basis post_xform; post_xform.rotate(xform.basis.get_axis(1),-Math::random(-_rotate_random,_rotate_random)*Math_PI); post_xform.rotate(xform.basis.get_axis(2),-Math::random(-_tilt_random,_tilt_random)*Math_PI); diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp index cefab98e6d..b2d62af7bb 100644 --- a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -137,7 +137,7 @@ bool NavigationPolygonEditor::forward_gui_input(const InputEvent& p_event) { const InputEventMouseButton &mb=p_event.mouse_button; - Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); + Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Vector2 gpoint = Point2(mb.x,mb.y); @@ -411,7 +411,7 @@ void NavigationPolygonEditor::_canvas_draw() { if (node->get_navigation_polygon().is_null()) return; - Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); + Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Ref<Texture> handle= get_icon("EditorHandle","EditorIcons"); diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.h b/tools/editor/plugins/navigation_polygon_editor_plugin.h index d3e56de042..50df4df744 100644 --- a/tools/editor/plugins/navigation_polygon_editor_plugin.h +++ b/tools/editor/plugins/navigation_polygon_editor_plugin.h @@ -101,7 +101,7 @@ class NavigationPolygonEditorPlugin : public EditorPlugin { public: - virtual bool forward_canvas_gui_input(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); } + virtual bool forward_canvas_gui_input(const Transform2D& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); } virtual String get_name() const { return "NavigationPolygonInstance"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/plugins/path_2d_editor_plugin.cpp b/tools/editor/plugins/path_2d_editor_plugin.cpp index 4e3a0ab720..69be969c51 100644 --- a/tools/editor/plugins/path_2d_editor_plugin.cpp +++ b/tools/editor/plugins/path_2d_editor_plugin.cpp @@ -79,7 +79,7 @@ bool Path2DEditor::forward_gui_input(const InputEvent& p_event) { const InputEventMouseButton &mb=p_event.mouse_button; - Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); + Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Vector2 gpoint = Point2(mb.x,mb.y); Vector2 cpoint = !mb.mod.alt? canvas_item_editor->snap_point(xform.affine_inverse().xform(gpoint)) @@ -421,7 +421,7 @@ bool Path2DEditor::forward_gui_input(const InputEvent& p_event) { if ( action!=ACTION_NONE) { - Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); + Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Vector2 gpoint = Point2(mm.x,mm.y); Vector2 cpoint = !mm.mod.alt? canvas_item_editor->snap_point(xform.affine_inverse().xform(gpoint)) : node->get_global_transform().affine_inverse().xform( canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint)) ); @@ -481,7 +481,7 @@ void Path2DEditor::_canvas_draw() { if (!node->get_curve().is_valid()) return ; - Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); + Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Ref<Texture> handle= get_icon("EditorHandle","EditorIcons"); Size2 handle_size = handle->get_size(); diff --git a/tools/editor/plugins/path_2d_editor_plugin.h b/tools/editor/plugins/path_2d_editor_plugin.h index 407d07905f..aa940e4edf 100644 --- a/tools/editor/plugins/path_2d_editor_plugin.h +++ b/tools/editor/plugins/path_2d_editor_plugin.h @@ -108,7 +108,7 @@ class Path2DEditorPlugin : public EditorPlugin { public: - virtual bool forward_canvas_gui_input(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return path2d_editor->forward_gui_input(p_event); } + virtual bool forward_canvas_gui_input(const Transform2D& p_canvas_xform,const InputEvent& p_event) { return path2d_editor->forward_gui_input(p_event); } virtual String get_name() const { return "Path2D"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp index ebff3f3130..ee625cf703 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp @@ -227,7 +227,7 @@ bool Polygon2DEditor::forward_gui_input(const InputEvent& p_event) { const InputEventMouseButton &mb=p_event.mouse_button; - Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); + Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Vector2 gpoint = Point2(mb.x,mb.y); @@ -463,7 +463,7 @@ void Polygon2DEditor::_canvas_draw() { poly=Variant(node->get_polygon()); - Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); + Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Ref<Texture> handle= get_icon("EditorHandle","EditorIcons"); for(int i=0;i<poly.size();i++) { @@ -499,7 +499,7 @@ void Polygon2DEditor::_uv_mode(int p_mode) { void Polygon2DEditor::_uv_input(const InputEvent& p_input) { - Matrix32 mtx; + Transform2D mtx; mtx.elements[2]=-uv_draw_ofs; mtx.scale_basis(Vector2(uv_draw_zoom,uv_draw_zoom)); @@ -680,13 +680,13 @@ void Polygon2DEditor::_uv_draw() { if (base_tex.is_null()) return; - Matrix32 mtx; + Transform2D mtx; mtx.elements[2]=-uv_draw_ofs; mtx.scale_basis(Vector2(uv_draw_zoom,uv_draw_zoom)); VS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(),mtx); uv_edit_draw->draw_texture(base_tex,Point2()); - VS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(),Matrix32()); + VS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(),Transform2D()); if (snap_show_grid) { Size2 s = uv_edit_draw->get_size(); diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.h b/tools/editor/plugins/polygon_2d_editor_plugin.h index c3051ca88d..bff7f4c44c 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.h +++ b/tools/editor/plugins/polygon_2d_editor_plugin.h @@ -151,7 +151,7 @@ class Polygon2DEditorPlugin : public EditorPlugin { public: - virtual bool forward_canvas_gui_input(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); } + virtual bool forward_canvas_gui_input(const Transform2D& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); } virtual String get_name() const { return "Polygon2D"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index e167ba2d56..5b2cb4aa5d 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1654,7 +1654,7 @@ void ScriptEditor::_editor_stop() { } -void ScriptEditor::_add_callback(Object *p_obj, const String& p_function, const StringArray& p_args) { +void ScriptEditor::_add_callback(Object *p_obj, const String& p_function, const PoolStringArray& p_args) { //print_line("add callback! hohoho"); kinda sad to remove this ERR_FAIL_COND(!p_obj); diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index e84c0af9e0..26120c8497 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -99,7 +99,7 @@ public: virtual void reload(bool p_soft)=0; virtual void get_breakpoints(List<int> *p_breakpoints)=0; virtual bool goto_method(const String& p_method)=0; - virtual void add_callback(const String& p_function,StringArray p_args)=0; + virtual void add_callback(const String& p_function,PoolStringArray p_args)=0; virtual void update_settings()=0; virtual void set_debugger_active(bool p_active)=0; virtual bool can_lose_focus_on_node_selection() { return true; } @@ -243,7 +243,7 @@ class ScriptEditor : public VBoxContainer { int edit_pass; - void _add_callback(Object *p_obj, const String& p_function, const StringArray& p_args); + void _add_callback(Object *p_obj, const String& p_function, const PoolStringArray& p_args); void _res_saved_callback(const Ref<Resource>& p_res); bool trim_trailing_whitespace_on_save; diff --git a/tools/editor/plugins/script_text_editor.cpp b/tools/editor/plugins/script_text_editor.cpp index 391578817a..05a2bfdba0 100644 --- a/tools/editor/plugins/script_text_editor.cpp +++ b/tools/editor/plugins/script_text_editor.cpp @@ -225,7 +225,7 @@ void ScriptTextEditor::_notification(int p_what) { } } -void ScriptTextEditor::add_callback(const String& p_function,StringArray p_args) { +void ScriptTextEditor::add_callback(const String& p_function,PoolStringArray p_args) { String code = code_editor->get_text_edit()->get_text(); int pos = script->get_language()->find_function(p_function,code); diff --git a/tools/editor/plugins/script_text_editor.h b/tools/editor/plugins/script_text_editor.h index 215d0626f0..e30a78340e 100644 --- a/tools/editor/plugins/script_text_editor.h +++ b/tools/editor/plugins/script_text_editor.h @@ -137,7 +137,7 @@ public: virtual void reload(bool p_soft); virtual void get_breakpoints(List<int> *p_breakpoints); - virtual void add_callback(const String& p_function,StringArray p_args); + virtual void add_callback(const String& p_function,PoolStringArray p_args); virtual void update_settings(); virtual bool goto_method(const String& p_method); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 7bf0843b2c..6a1098bc6e 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -894,7 +894,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { continue; //optimize by checking AABB (although should pre sort by distance) - AABB aabb = vi->get_global_transform().xform(vi->get_aabb()); + Rect3 aabb = vi->get_global_transform().xform(vi->get_aabb()); if (p.distance_to(aabb.get_support(-ray_dir))>min_d) continue; @@ -1352,7 +1352,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { Transform original=se->original; - Transform base=Transform( Matrix3(), _edit.center); + Transform base=Transform( Basis(), _edit.center); Transform t=base * (r * (base.inverse() * original)); sp->set_global_transform(t); @@ -1501,7 +1501,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { Transform original=se->original; - Transform base=Transform( Matrix3(), _edit.center); + Transform base=Transform( Basis(), _edit.center); Transform t=base * r * base.inverse() * original; sp->set_global_transform(t); @@ -1791,7 +1791,7 @@ void SpatialEditorViewport::_notification(int p_what) { if (se->aabb.has_no_surface()) { - se->aabb=vi?vi->get_aabb():AABB( Vector3(-0.2,-0.2,-0.2),Vector3(0.4,0.4,0.4)); + se->aabb=vi?vi->get_aabb():Rect3( Vector3(-0.2,-0.2,-0.2),Vector3(0.4,0.4,0.4)); } Transform t=sp->get_global_transform(); @@ -2486,10 +2486,10 @@ void SpatialEditor::select_gizmo_hilight_axis(int p_axis) { void SpatialEditor::update_transform_gizmo() { List<Node*> &selection = editor_selection->get_selected_node_list(); - AABB center; + Rect3 center; bool first=true; - Matrix3 gizmo_basis; + Basis gizmo_basis; bool local_gizmo_coords = transform_menu->get_popup()->is_item_checked( transform_menu->get_popup()->get_item_index(MENU_TRANSFORM_LOCAL_COORDS) ); @@ -2513,7 +2513,7 @@ void SpatialEditor::update_transform_gizmo() { } } else { center.expand_to(xf.origin); - gizmo_basis=Matrix3(); + gizmo_basis=Basis(); } // count++; } @@ -2551,7 +2551,7 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) { void SpatialEditor::_generate_selection_box() { - AABB aabb( Vector3(), Vector3(1,1,1) ); + Rect3 aabb( Vector3(), Vector3(1,1,1) ); aabb.grow_by( aabb.get_longest_axis_size()/20.0 ); Ref<SurfaceTool> st = memnew( SurfaceTool ); @@ -3343,8 +3343,8 @@ void SpatialEditor::_init_indicators() { for(int k = 0; k < 7 ; k++) { - Matrix3 ma(ivec,Math_PI*2*float(k)/arrow_sides); - Matrix3 mb(ivec,Math_PI*2*float(k+1)/arrow_sides); + Basis ma(ivec,Math_PI*2*float(k)/arrow_sides); + Basis mb(ivec,Math_PI*2*float(k+1)/arrow_sides); for(int j=0;j<arrow_points-1;j++) { @@ -3388,8 +3388,8 @@ void SpatialEditor::_init_indicators() { for(int k = 0; k < 33 ; k++) { - Matrix3 ma(ivec,Math_PI*2*float(k)/32); - Matrix3 mb(ivec,Math_PI*2*float(k+1)/32); + Basis ma(ivec,Math_PI*2*float(k)/32); + Basis mb(ivec,Math_PI*2*float(k+1)/32); for(int j=0;j<4;j++) { diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index e09a29d4f8..b05b7d8545 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -271,7 +271,7 @@ class SpatialEditorSelectedItem : public Object { public: - AABB aabb; + Rect3 aabb; Transform original; // original location when moving Transform last_xform; // last transform Spatial *sp; diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp index fd3e8fb0f3..15fe95075c 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.cpp +++ b/tools/editor/plugins/texture_region_editor_plugin.cpp @@ -57,13 +57,13 @@ void TextureRegionEditor::_region_draw() if (base_tex.is_null()) return; - Matrix32 mtx; + Transform2D mtx; mtx.elements[2]=-draw_ofs; mtx.scale_basis(Vector2(draw_zoom,draw_zoom)); VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(),mtx); edit_draw->draw_texture(base_tex,Point2()); - VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(),Matrix32()); + VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(),Transform2D()); if (snap_mode == SNAP_GRID) { Size2 s = edit_draw->get_size(); @@ -203,7 +203,7 @@ void TextureRegionEditor::_region_draw() void TextureRegionEditor::_region_input(const InputEvent& p_input) { - Matrix32 mtx; + Transform2D mtx; mtx.elements[2]=-draw_ofs; mtx.scale_basis(Vector2(draw_zoom,draw_zoom)); diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index 1b3bcb7d2c..0d384ea3a2 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -417,7 +417,7 @@ void TileMapEditor::_select(const Point2i& p_from, const Point2i& p_to) { canvas_item_editor->update(); } -void TileMapEditor::_draw_cell(int p_cell, const Point2i& p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Matrix32& p_xform) { +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); @@ -505,7 +505,7 @@ void TileMapEditor::_draw_cell(int p_cell, const Point2i& p_point, bool p_flip_h canvas_item_editor->draw_texture_rect_region(t, rect, r, Color(1,1,1,0.5), p_transpose); } -void TileMapEditor::_draw_fill_preview(int p_cell, const Point2i& p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Matrix32& p_xform) { +void TileMapEditor::_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) { PoolVector<Vector2> points = _bucket_fill(p_point, false, true); PoolVector<Vector2>::Read pr = points.read(); @@ -600,8 +600,8 @@ bool TileMapEditor::forward_gui_input(const InputEvent& p_event) { if (!node || !node->get_tileset().is_valid() || !node->is_visible()) return false; - Matrix32 xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * node->get_global_transform(); - Matrix32 xform_inv = xform.affine_inverse(); + Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * node->get_global_transform(); + Transform2D xform_inv = xform.affine_inverse(); switch(p_event.type) { @@ -1071,10 +1071,10 @@ void TileMapEditor::_canvas_draw() { if (!node) return; - Matrix32 cell_xf = node->get_cell_transform(); + Transform2D cell_xf = node->get_cell_transform(); - Matrix32 xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * node->get_global_transform(); - Matrix32 xform_inv = xform.affine_inverse(); + Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * node->get_global_transform(); + Transform2D xform_inv = xform.affine_inverse(); Size2 screen_size=canvas_item_editor->get_size(); diff --git a/tools/editor/plugins/tile_map_editor_plugin.h b/tools/editor/plugins/tile_map_editor_plugin.h index 79c2dcd0bd..08032d9afd 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.h +++ b/tools/editor/plugins/tile_map_editor_plugin.h @@ -141,8 +141,8 @@ class TileMapEditor : public VBoxContainer { void _select(const Point2i& p_from, const Point2i& p_to); - void _draw_cell(int p_cell, const Point2i& p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Matrix32& 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 Matrix32& p_xform); + 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); void _clear_bucket_cache(); void _update_copydata(); @@ -190,7 +190,7 @@ class TileMapEditorPlugin : public EditorPlugin { public: - virtual bool forward_canvas_gui_input(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return tile_map_editor->forward_gui_input(p_event); } + virtual bool forward_canvas_gui_input(const Transform2D& p_canvas_xform,const InputEvent& p_event) { return tile_map_editor->forward_gui_input(p_event); } virtual String get_name() const { return "TileMap"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index 74ae66d727..fa41090624 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -1133,7 +1133,7 @@ void ProjectManager::_install_project(const String& p_zip_path,const String& p_t npdialog->show_dialog(); } -void ProjectManager::_files_dropped(StringArray p_files, int p_screen) { +void ProjectManager::_files_dropped(PoolStringArray p_files, int p_screen) { Set<String> folders_set; DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); for (int i = 0; i < p_files.size(); i++) { @@ -1142,7 +1142,7 @@ void ProjectManager::_files_dropped(StringArray p_files, int p_screen) { } memdelete(da); if (folders_set.size()>0) { - StringArray folders; + PoolStringArray folders; for (Set<String>::Element *E=folders_set.front();E;E=E->next()) { folders.append(E->get()); } @@ -1174,7 +1174,7 @@ void ProjectManager::_files_dropped(StringArray p_files, int p_screen) { } } -void ProjectManager::_scan_multiple_folders(StringArray p_files) +void ProjectManager::_scan_multiple_folders(PoolStringArray p_files) { for (int i = 0; i < p_files.size(); i++) { _scan_begin(p_files.get(i)); diff --git a/tools/editor/project_manager.h b/tools/editor/project_manager.h index 2240e252fc..1fd8a301ea 100644 --- a/tools/editor/project_manager.h +++ b/tools/editor/project_manager.h @@ -95,8 +95,8 @@ class ProjectManager : public Control { void _panel_input(const InputEvent& p_ev,Node *p_hb); void _unhandled_input(const InputEvent& p_ev); void _favorite_pressed(Node *p_hb); - void _files_dropped(StringArray p_files, int p_screen); - void _scan_multiple_folders(StringArray p_files); + void _files_dropped(PoolStringArray p_files, int p_screen); + void _scan_multiple_folders(PoolStringArray p_files); protected: diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 6e9ea5e873..968333d466 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -795,7 +795,7 @@ void ProjectSettings::add_translation(const String& p_translation) { void ProjectSettings::_translation_add(const String& p_path) { - StringArray translations = GlobalConfig::get_singleton()->get("locale/translations"); + PoolStringArray translations = GlobalConfig::get_singleton()->get("locale/translations"); for(int i=0;i<translations.size();i++) { @@ -828,7 +828,7 @@ void ProjectSettings::_translation_delete(Object *p_item,int p_column, int p_but int idx=ti->get_metadata(0); - StringArray translations = GlobalConfig::get_singleton()->get("locale/translations"); + PoolStringArray translations = GlobalConfig::get_singleton()->get("locale/translations"); ERR_FAIL_INDEX(idx,translations.size()); @@ -865,7 +865,7 @@ void ProjectSettings::_translation_res_add(const String& p_path){ if (remaps.has(p_path)) return; //pointless already has it - remaps[p_path]=StringArray(); + remaps[p_path]=PoolStringArray(); undo_redo->create_action(TTR("Add Remapped Path")); undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translation_remaps",remaps); @@ -895,7 +895,7 @@ void ProjectSettings::_translation_res_option_add(const String& p_path) { String key = k->get_metadata(0); ERR_FAIL_COND(!remaps.has(key)); - StringArray r = remaps[key]; + PoolStringArray r = remaps[key]; r.push_back(p_path+":"+"en"); remaps[key]=r; @@ -948,7 +948,7 @@ void ProjectSettings::_translation_res_option_changed() { ERR_FAIL_COND(!remaps.has(key)); - StringArray r = remaps[key]; + PoolStringArray r = remaps[key]; ERR_FAIL_INDEX(idx,r.size()); r.set(idx,path+":"+langs[which]); remaps[key]=r; @@ -1014,7 +1014,7 @@ void ProjectSettings::_translation_res_option_delete(Object *p_item,int p_column int idx = ed->get_metadata(0); ERR_FAIL_COND(!remaps.has(key)); - StringArray r = remaps[key]; + PoolStringArray r = remaps[key]; ERR_FAIL_INDEX(idx,remaps.size()); r.remove(idx); remaps[key]=r; @@ -1045,7 +1045,7 @@ void ProjectSettings::_update_translations() { translation_list->set_hide_root(true); if (GlobalConfig::get_singleton()->has("locale/translations")) { - StringArray translations = GlobalConfig::get_singleton()->get("locale/translations"); + PoolStringArray translations = GlobalConfig::get_singleton()->get("locale/translations"); for(int i=0;i<translations.size();i++) { TreeItem *t = translation_list->create_item(root); @@ -1105,7 +1105,7 @@ void ProjectSettings::_update_translations() { t->select(0); translation_res_option_add_button->set_disabled(false); - StringArray selected = remaps[keys[i]]; + PoolStringArray selected = remaps[keys[i]]; for(int j=0;j<selected.size();j++) { String s = selected[j]; diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index c4a93c4af0..d59833f0ed 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -721,7 +721,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty value_editor[3]->set_text( String::num( q.w ) ); } break; - case Variant::_AABB: { + case Variant::RECT3: { List<String> names; names.push_back("px"); @@ -732,7 +732,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty names.push_back("sz"); config_value_editors(6,3,16,names); - AABB aabb=v; + Rect3 aabb=v; value_editor[0]->set_text( String::num( aabb.pos.x ) ); value_editor[1]->set_text( String::num( aabb.pos.y ) ); value_editor[2]->set_text( String::num( aabb.pos.z ) ); @@ -741,7 +741,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty value_editor[5]->set_text( String::num( aabb.size.z ) ); } break; - case Variant::MATRIX32: { + case Variant::TRANSFORM2D: { List<String> names; names.push_back("xx"); @@ -752,14 +752,14 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty names.push_back("oy"); config_value_editors(6,2,16,names); - Matrix32 basis=v; + Transform2D basis=v; for(int i=0;i<6;i++) { value_editor[i]->set_text( String::num( basis.elements[i/2][i%2] ) ); } } break; - case Variant::MATRIX3: { + case Variant::BASIS: { List<String> names; names.push_back("xx"); @@ -773,7 +773,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty names.push_back("zz"); config_value_editors(9,3,16,names); - Matrix3 basis=v; + Basis basis=v; for(int i=0;i<9;i++) { value_editor[i]->set_text( String::num( basis.elements[i/3][i%3] ) ); @@ -1005,27 +1005,27 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty } break; - case Variant::RAW_ARRAY: { + case Variant::POOL_BYTE_ARRAY: { } break; - case Variant::INT_ARRAY: { + case Variant::POOL_INT_ARRAY: { } break; - case Variant::REAL_ARRAY: { + case Variant::POOL_REAL_ARRAY: { } break; - case Variant::STRING_ARRAY: { + case Variant::POOL_STRING_ARRAY: { } break; - case Variant::VECTOR3_ARRAY: { + case Variant::POOL_VECTOR3_ARRAY: { } break; - case Variant::COLOR_ARRAY: { + case Variant::POOL_COLOR_ARRAY: { } break; @@ -1703,7 +1703,7 @@ void CustomPropertyEditor::_modified(String p_string) { emit_signal("variant_changed"); } break; - case Variant::_AABB: { + case Variant::RECT3: { Vector3 pos; Vector3 size; @@ -1723,13 +1723,13 @@ void CustomPropertyEditor::_modified(String p_string) { size.y=value_editor[4]->get_text().to_double(); size.z=value_editor[5]->get_text().to_double(); } - v=AABB(pos,size); + v=Rect3(pos,size); emit_signal("variant_changed"); } break; - case Variant::MATRIX32: { + case Variant::TRANSFORM2D: { - Matrix32 m; + Transform2D m; for(int i=0;i<6;i++) { if (evaluator) { m.elements[i/2][i%2]=evaluator->eval(value_editor[i]->get_text()); @@ -1742,9 +1742,9 @@ void CustomPropertyEditor::_modified(String p_string) { emit_signal("variant_changed"); } break; - case Variant::MATRIX3: { + case Variant::BASIS: { - Matrix3 m; + Basis m; for(int i=0;i<9;i++) { if (evaluator) { @@ -1760,7 +1760,7 @@ void CustomPropertyEditor::_modified(String p_string) { } break; case Variant::TRANSFORM: { - Matrix3 basis; + Basis basis; for(int i=0;i<9;i++) { if (evaluator) { @@ -1820,27 +1820,27 @@ void CustomPropertyEditor::_modified(String p_string) { } break; - case Variant::RAW_ARRAY: { + case Variant::POOL_BYTE_ARRAY: { } break; - case Variant::INT_ARRAY: { + case Variant::POOL_INT_ARRAY: { } break; - case Variant::REAL_ARRAY: { + case Variant::POOL_REAL_ARRAY: { } break; - case Variant::STRING_ARRAY: { + case Variant::POOL_STRING_ARRAY: { } break; - case Variant::VECTOR3_ARRAY: { + case Variant::POOL_VECTOR3_ARRAY: { } break; - case Variant::COLOR_ARRAY: { + case Variant::POOL_COLOR_ARRAY: { } break; @@ -1865,9 +1865,9 @@ void CustomPropertyEditor::_focus_enter() { case Variant::VECTOR3: case Variant::PLANE: case Variant::QUAT: - case Variant::_AABB: - case Variant::MATRIX32: - case Variant::MATRIX3: + case Variant::RECT3: + case Variant::TRANSFORM2D: + case Variant::BASIS: case Variant::TRANSFORM: { for (int i=0;i<MAX_VALUE_EDITORS;++i) { if (value_editor[i]->has_focus()) { @@ -1890,9 +1890,9 @@ void CustomPropertyEditor::_focus_exit() { case Variant::VECTOR3: case Variant::PLANE: case Variant::QUAT: - case Variant::_AABB: - case Variant::MATRIX32: - case Variant::MATRIX3: + case Variant::RECT3: + case Variant::TRANSFORM2D: + case Variant::BASIS: case Variant::TRANSFORM: { for (int i=0;i<MAX_VALUE_EDITORS;++i) { value_editor[i]->select(0, 0); @@ -2419,10 +2419,10 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p case Variant::VECTOR3: case Variant::QUAT: case Variant::VECTOR2: - case Variant::_AABB: + case Variant::RECT3: case Variant::RECT2: - case Variant::MATRIX32: - case Variant::MATRIX3: + case Variant::TRANSFORM2D: + case Variant::BASIS: case Variant::TRANSFORM: { p_item->set_text(1,obj->get(p_name)); @@ -3505,7 +3505,7 @@ void PropertyEditor::update_tree() { } break; - case Variant::INT_ARRAY: { + case Variant::POOL_INT_ARRAY: { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->add_button(1,get_icon("EditResource","EditorIcons")); @@ -3520,7 +3520,7 @@ void PropertyEditor::update_tree() { } break; - case Variant::REAL_ARRAY: { + case Variant::POOL_REAL_ARRAY: { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->add_button(1,get_icon("EditResource","EditorIcons")); @@ -3535,7 +3535,7 @@ void PropertyEditor::update_tree() { } break; - case Variant::STRING_ARRAY: { + case Variant::POOL_STRING_ARRAY: { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->add_button(1,get_icon("EditResource","EditorIcons")); @@ -3550,7 +3550,7 @@ void PropertyEditor::update_tree() { } break; - case Variant::RAW_ARRAY: { + case Variant::POOL_BYTE_ARRAY: { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->add_button(1,get_icon("EditResource","EditorIcons")); @@ -3565,7 +3565,7 @@ void PropertyEditor::update_tree() { } break; - case Variant::VECTOR2_ARRAY: { + case Variant::POOL_VECTOR2_ARRAY: { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->add_button(1,get_icon("EditResource","EditorIcons")); @@ -3580,7 +3580,7 @@ void PropertyEditor::update_tree() { } break; - case Variant::VECTOR3_ARRAY: { + case Variant::POOL_VECTOR3_ARRAY: { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->add_button(1,get_icon("EditResource","EditorIcons")); @@ -3595,7 +3595,7 @@ void PropertyEditor::update_tree() { } break; - case Variant::COLOR_ARRAY: { + case Variant::POOL_COLOR_ARRAY: { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->add_button(1,get_icon("EditResource","EditorIcons")); @@ -3637,8 +3637,8 @@ void PropertyEditor::update_tree() { item->set_icon( 0,get_icon("Vector","EditorIcons") ); } break; - case Variant::MATRIX32: - case Variant::MATRIX3: { + case Variant::TRANSFORM2D: + case Variant::BASIS: { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_editable( 1, true ); @@ -3662,11 +3662,11 @@ void PropertyEditor::update_tree() { item->set_icon( 0,get_icon("Plane","EditorIcons") ); } break; - case Variant::_AABB: { + case Variant::RECT3: { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_editable( 1, true ); - item->set_text(1,"AABB"); + item->set_text(1,"Rect3"); if (show_type_icons) item->set_icon( 0,get_icon("Rect3","EditorIcons") ); } break; @@ -3986,10 +3986,10 @@ void PropertyEditor::_item_edited() { case Variant::QUAT: { } break; - case Variant::_AABB: { + case Variant::RECT3: { } break; - case Variant::MATRIX3: { + case Variant::BASIS: { } break; case Variant::TRANSFORM: { @@ -4015,22 +4015,22 @@ void PropertyEditor::_item_edited() { } break; // arrays - case Variant::RAW_ARRAY: { + case Variant::POOL_BYTE_ARRAY: { } break; - case Variant::INT_ARRAY: { + case Variant::POOL_INT_ARRAY: { } break; - case Variant::REAL_ARRAY: { + case Variant::POOL_REAL_ARRAY: { } break; - case Variant::STRING_ARRAY: { + case Variant::POOL_STRING_ARRAY: { } break; - case Variant::VECTOR3_ARRAY: { + case Variant::POOL_VECTOR3_ARRAY: { } break; - case Variant::COLOR_ARRAY: { + case Variant::POOL_COLOR_ARRAY: { } break; @@ -4223,7 +4223,7 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) { emit_signal("object_id_selected",obj->get(n)); print_line("OBJ ID SELECTED"); - } else if (t==Variant::ARRAY || t==Variant::INT_ARRAY || t==Variant::REAL_ARRAY || t==Variant::STRING_ARRAY || t==Variant::VECTOR2_ARRAY || t==Variant::VECTOR3_ARRAY || t==Variant::COLOR_ARRAY || t==Variant::RAW_ARRAY) { + } else if (t==Variant::ARRAY || t==Variant::POOL_INT_ARRAY || t==Variant::POOL_REAL_ARRAY || t==Variant::POOL_STRING_ARRAY || t==Variant::POOL_VECTOR2_ARRAY || t==Variant::POOL_VECTOR3_ARRAY || t==Variant::POOL_COLOR_ARRAY || t==Variant::POOL_BYTE_ARRAY) { Variant v = obj->get(n); diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index 4052c0d468..1c881dfd5e 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -1134,7 +1134,7 @@ void SceneTreeEditor::_bind_methods() { ADD_SIGNAL( MethodInfo("node_changed") ); ADD_SIGNAL( MethodInfo("nodes_dragged") ); ADD_SIGNAL( MethodInfo("nodes_rearranged",PropertyInfo(Variant::ARRAY,"paths"),PropertyInfo(Variant::NODE_PATH,"to_path"),PropertyInfo(Variant::INT,"type") ) ); - ADD_SIGNAL( MethodInfo("files_dropped",PropertyInfo(Variant::STRING_ARRAY,"files"),PropertyInfo(Variant::NODE_PATH,"to_path"),PropertyInfo(Variant::INT,"type") ) ); + ADD_SIGNAL( MethodInfo("files_dropped",PropertyInfo(Variant::POOL_STRING_ARRAY,"files"),PropertyInfo(Variant::NODE_PATH,"to_path"),PropertyInfo(Variant::INT,"type") ) ); ADD_SIGNAL( MethodInfo("script_dropped",PropertyInfo(Variant::STRING,"file"),PropertyInfo(Variant::NODE_PATH,"to_path"))); ADD_SIGNAL( MethodInfo("rmb_pressed",PropertyInfo(Variant::VECTOR2,"pos")) ) ; diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index ed96fe9e3f..62de22a4b3 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -144,7 +144,7 @@ void EditorSpatialGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Mat } if (md) { - mesh->set_custom_aabb(AABB(Vector3(-md,-md,-md),Vector3(md,md,md)*2.0)); + mesh->set_custom_aabb(Rect3(Vector3(-md,-md,-md),Vector3(md,md,md)*2.0)); } } @@ -193,7 +193,7 @@ void EditorSpatialGizmo::add_unscaled_billboard(const Ref<Material>& p_material, } if (md) { - mesh->set_custom_aabb(AABB(Vector3(-md,-md,-md),Vector3(md,md,md)*2.0)); + mesh->set_custom_aabb(Rect3(Vector3(-md,-md,-md),Vector3(md,md,md)*2.0)); } } @@ -271,7 +271,7 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, bool p_bi } if (md) { - mesh->set_custom_aabb(AABB(Vector3(-md,-md,-md),Vector3(md,md,md)*2.0)); + mesh->set_custom_aabb(Rect3(Vector3(-md,-md,-md),Vector3(md,md,md)*2.0)); } } @@ -800,8 +800,8 @@ void LightSpatialGizmo::redraw() { for(int i = 0; i < arrow_sides ; i++) { - Matrix3 ma(Vector3(0,0,1),Math_PI*2*float(i)/arrow_sides); - Matrix3 mb(Vector3(0,0,1),Math_PI*2*float(i+1)/arrow_sides); + Basis ma(Vector3(0,0,1),Math_PI*2*float(i)/arrow_sides); + Basis mb(Vector3(0,0,1),Math_PI*2*float(i+1)/arrow_sides); for(int j=1;j<arrow_points-1;j++) { @@ -1219,7 +1219,7 @@ void SkeletonSpatialGizmo::redraw() { weights[0]=1; - AABB aabb; + Rect3 aabb; Color bonecolor = Color(1.0,0.4,0.4,0.3); Color rootcolor = Color(0.4,1.0,0.4,0.1); @@ -1915,7 +1915,7 @@ void CollisionShapeSpatialGizmo::redraw(){ Ref<BoxShape> bs=s; Vector<Vector3> lines; - AABB aabb; + Rect3 aabb; aabb.pos=-bs->get_extents(); aabb.size=aabb.pos*-2; @@ -2163,7 +2163,7 @@ void VisibilityNotifierGizmo::set_handle(int p_idx,Camera *p_camera, const Point //gt.orthonormalize(); Transform gi = gt.affine_inverse(); - AABB aabb = notifier->get_aabb(); + Rect3 aabb = notifier->get_aabb(); Vector3 ray_from = p_camera->project_ray_origin(p_point); Vector3 ray_dir = p_camera->project_ray_normal(p_point); @@ -2205,7 +2205,7 @@ void VisibilityNotifierGizmo::redraw(){ clear(); Vector<Vector3> lines; - AABB aabb = notifier->get_aabb(); + Rect3 aabb = notifier->get_aabb(); for(int i=0;i<12;i++) { Vector3 a,b; @@ -2257,7 +2257,7 @@ String ReflectionProbeGizmo::get_handle_name(int p_idx) const { } Variant ReflectionProbeGizmo::get_handle_value(int p_idx) const{ - return AABB(probe->get_extents(),probe->get_origin_offset()); + return Rect3(probe->get_extents(),probe->get_origin_offset()); } void ReflectionProbeGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& p_point){ @@ -2313,7 +2313,7 @@ void ReflectionProbeGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& void ReflectionProbeGizmo::commit_handle(int p_idx,const Variant& p_restore,bool p_cancel){ - AABB restore = p_restore; + Rect3 restore = p_restore; if (p_cancel) { probe->set_extents(restore.pos); @@ -2339,7 +2339,7 @@ void ReflectionProbeGizmo::redraw(){ Vector<Vector3> internal_lines; Vector3 extents = probe->get_extents(); - AABB aabb; + Rect3 aabb; aabb.pos=-extents; aabb.size=extents*2; @@ -2468,7 +2468,7 @@ void GIProbeGizmo::redraw(){ static const int subdivs[GIProbe::SUBDIV_MAX]={64,128,256,512}; - AABB aabb = AABB(-extents,extents*2); + Rect3 aabb = Rect3(-extents,extents*2); int subdiv = subdivs[probe->get_subdiv()]; float cell_size = aabb.get_longest_axis_size()/subdiv; |