Type renames:
Matrix32 -> Transform2D Matrix3 -> Basis AABB -> Rect3 RawArray -> PoolByteArray IntArray -> PoolIntArray FloatArray -> PoolFloatArray Vector2Array -> PoolVector2Array Vector3Array -> PoolVector3Array ColorArray -> PoolColorArray
This commit is contained in:
parent
710692278d
commit
bc26f90581
|
@ -87,12 +87,12 @@ void _ResourceLoader::set_abort_on_missing_resources(bool p_abort) {
|
||||||
ResourceLoader::set_abort_on_missing_resources(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;
|
List<String> deps;
|
||||||
ResourceLoader::get_dependencies(p_path, &deps);
|
ResourceLoader::get_dependencies(p_path, &deps);
|
||||||
|
|
||||||
StringArray ret;
|
PoolStringArray ret;
|
||||||
for(List<String>::Element *E=deps.front();E;E=E->next()) {
|
for(List<String>::Element *E=deps.front();E;E=E->next()) {
|
||||||
ret.push_back(E->get());
|
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;
|
List<StringName> classes;
|
||||||
ClassDB::get_class_list(&classes);
|
ClassDB::get_class_list(&classes);
|
||||||
|
|
||||||
StringArray ret;
|
PoolStringArray ret;
|
||||||
ret.resize(classes.size());
|
ret.resize(classes.size());
|
||||||
int idx=0;
|
int idx=0;
|
||||||
for (List<StringName>::Element *E=classes.front();E;E=E->next()) {
|
for (List<StringName>::Element *E=classes.front();E;E=E->next()) {
|
||||||
|
@ -2413,12 +2413,12 @@ StringArray _ClassDB::get_class_list() const {
|
||||||
return ret;
|
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;
|
List<StringName> classes;
|
||||||
ClassDB::get_inheriters_from_class(p_class,&classes);
|
ClassDB::get_inheriters_from_class(p_class,&classes);
|
||||||
|
|
||||||
StringArray ret;
|
PoolStringArray ret;
|
||||||
ret.resize(classes.size());
|
ret.resize(classes.size());
|
||||||
int idx=0;
|
int idx=0;
|
||||||
for (List<StringName>::Element *E=classes.front();E;E=E->next()) {
|
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;
|
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;
|
List<String> constants;
|
||||||
ClassDB::get_integer_constant_list(p_class,&constants,p_no_inheritance);
|
ClassDB::get_integer_constant_list(p_class,&constants,p_no_inheritance);
|
||||||
|
|
||||||
StringArray ret;
|
PoolStringArray ret;
|
||||||
ret.resize(constants.size());
|
ret.resize(constants.size());
|
||||||
int idx=0;
|
int idx=0;
|
||||||
for (List<String>::Element *E=constants.front();E;E=E->next()) {
|
for (List<String>::Element *E=constants.front();E;E=E->next()) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
RES load(const String &p_path,const String& p_type_hint="", bool p_no_cache = false);
|
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);
|
PoolVector<String> get_recognized_extensions_for_type(const String& p_type);
|
||||||
void set_abort_on_missing_resources(bool p_abort);
|
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);
|
bool has(const String& p_path);
|
||||||
Ref<ResourceImportMetadata> load_import_metadata(const String& p_path);
|
Ref<ResourceImportMetadata> load_import_metadata(const String& p_path);
|
||||||
|
|
||||||
|
@ -602,8 +602,8 @@ protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
public:
|
public:
|
||||||
|
|
||||||
StringArray get_class_list() const;
|
PoolStringArray get_class_list() const;
|
||||||
StringArray get_inheriters_from_class( const StringName& p_class) const;
|
PoolStringArray get_inheriters_from_class( const StringName& p_class) const;
|
||||||
StringName get_parent_class(const StringName& p_class) const;
|
StringName get_parent_class(const StringName& p_class) const;
|
||||||
bool class_exists(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;
|
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;
|
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;
|
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;
|
int get_integer_constant(const StringName& p_class, const StringName &p_name) const;
|
||||||
StringName get_category(const StringName& p_node) const;
|
StringName get_category(const StringName& p_node) const;
|
||||||
|
|
|
@ -518,9 +518,9 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const {
|
||||||
|
|
||||||
void PHashTranslation::_get_property_list( List<PropertyInfo> *p_list) 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::POOL_INT_ARRAY, "hash_table"));
|
||||||
p_list->push_back( PropertyInfo(Variant::INT_ARRAY, "bucket_table"));
|
p_list->push_back( PropertyInfo(Variant::POOL_INT_ARRAY, "bucket_table"));
|
||||||
p_list->push_back( PropertyInfo(Variant::RAW_ARRAY, "strings"));
|
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));
|
p_list->push_back( PropertyInfo(Variant::OBJECT, "load_from",PROPERTY_HINT_RESOURCE_TYPE,"Translation",PROPERTY_USAGE_EDITOR));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -517,11 +517,11 @@ static _GlobalConstant _global_constants[]={
|
||||||
{"TYPE_VECTOR2",Variant::VECTOR2}, // 5
|
{"TYPE_VECTOR2",Variant::VECTOR2}, // 5
|
||||||
{"TYPE_RECT2",Variant::RECT2},
|
{"TYPE_RECT2",Variant::RECT2},
|
||||||
{"TYPE_VECTOR3",Variant::VECTOR3},
|
{"TYPE_VECTOR3",Variant::VECTOR3},
|
||||||
{"TYPE_MATRIX32",Variant::MATRIX32},
|
{"TYPE_TRANSFORM2D",Variant::TRANSFORM2D},
|
||||||
{"TYPE_PLANE",Variant::PLANE},
|
{"TYPE_PLANE",Variant::PLANE},
|
||||||
{"TYPE_QUAT",Variant::QUAT}, // 10
|
{"TYPE_QUAT",Variant::QUAT}, // 10
|
||||||
{"TYPE_AABB",Variant::_AABB}, //sorry naming convention fail :( not like it's used often
|
{"TYPE_RECT3",Variant::RECT3}, //sorry naming convention fail :( not like it's used often
|
||||||
{"TYPE_MATRIX3",Variant::MATRIX3},
|
{"TYPE_BASIS",Variant::BASIS},
|
||||||
{"TYPE_TRANSFORM",Variant::TRANSFORM},
|
{"TYPE_TRANSFORM",Variant::TRANSFORM},
|
||||||
{"TYPE_COLOR",Variant::COLOR},
|
{"TYPE_COLOR",Variant::COLOR},
|
||||||
{"TYPE_IMAGE",Variant::IMAGE}, // 15
|
{"TYPE_IMAGE",Variant::IMAGE}, // 15
|
||||||
|
@ -531,13 +531,13 @@ static _GlobalConstant _global_constants[]={
|
||||||
{"TYPE_INPUT_EVENT",Variant::INPUT_EVENT},
|
{"TYPE_INPUT_EVENT",Variant::INPUT_EVENT},
|
||||||
{"TYPE_DICTIONARY",Variant::DICTIONARY}, // 20
|
{"TYPE_DICTIONARY",Variant::DICTIONARY}, // 20
|
||||||
{"TYPE_ARRAY",Variant::ARRAY},
|
{"TYPE_ARRAY",Variant::ARRAY},
|
||||||
{"TYPE_RAW_ARRAY",Variant::RAW_ARRAY},
|
{"TYPE_RAW_ARRAY",Variant::POOL_BYTE_ARRAY},
|
||||||
{"TYPE_INT_ARRAY",Variant::INT_ARRAY},
|
{"TYPE_INT_ARRAY",Variant::POOL_INT_ARRAY},
|
||||||
{"TYPE_REAL_ARRAY",Variant::REAL_ARRAY},
|
{"TYPE_REAL_ARRAY",Variant::POOL_REAL_ARRAY},
|
||||||
{"TYPE_STRING_ARRAY",Variant::STRING_ARRAY}, // 25
|
{"TYPE_STRING_ARRAY",Variant::POOL_STRING_ARRAY}, // 25
|
||||||
{"TYPE_VECTOR2_ARRAY",Variant::VECTOR2_ARRAY},
|
{"TYPE_VECTOR2_ARRAY",Variant::POOL_VECTOR2_ARRAY},
|
||||||
{"TYPE_VECTOR3_ARRAY",Variant::VECTOR3_ARRAY},
|
{"TYPE_VECTOR3_ARRAY",Variant::POOL_VECTOR3_ARRAY},
|
||||||
{"TYPE_COLOR_ARRAY",Variant::COLOR_ARRAY},
|
{"TYPE_COLOR_ARRAY",Variant::POOL_COLOR_ARRAY},
|
||||||
{"TYPE_MAX",Variant::VARIANT_MAX},
|
{"TYPE_MAX",Variant::VARIANT_MAX},
|
||||||
{NULL,0}
|
{NULL,0}
|
||||||
|
|
||||||
|
|
|
@ -927,9 +927,9 @@ static String _encode_variant(const Variant& p_variant) {
|
||||||
Color val = p_variant;
|
Color val = p_variant;
|
||||||
return "#"+val.to_html();
|
return "#"+val.to_html();
|
||||||
} break;
|
} break;
|
||||||
case Variant::STRING_ARRAY:
|
case Variant::POOL_STRING_ARRAY:
|
||||||
case Variant::INT_ARRAY:
|
case Variant::POOL_INT_ARRAY:
|
||||||
case Variant::REAL_ARRAY:
|
case Variant::POOL_REAL_ARRAY:
|
||||||
case Variant::ARRAY: {
|
case Variant::ARRAY: {
|
||||||
Array arr = p_variant;
|
Array arr = p_variant;
|
||||||
String str="[";
|
String str="[";
|
||||||
|
|
|
@ -31,11 +31,11 @@
|
||||||
#include "os/file_access.h"
|
#include "os/file_access.h"
|
||||||
#include "variant_parser.h"
|
#include "variant_parser.h"
|
||||||
|
|
||||||
StringArray ConfigFile::_get_sections() const {
|
PoolStringArray ConfigFile::_get_sections() const {
|
||||||
|
|
||||||
List<String> s;
|
List<String> s;
|
||||||
get_sections(&s);
|
get_sections(&s);
|
||||||
StringArray arr;
|
PoolStringArray arr;
|
||||||
arr.resize(s.size());
|
arr.resize(s.size());
|
||||||
int idx=0;
|
int idx=0;
|
||||||
for(const List<String>::Element *E=s.front();E;E=E->next()) {
|
for(const List<String>::Element *E=s.front();E;E=E->next()) {
|
||||||
|
@ -46,11 +46,11 @@ StringArray ConfigFile::_get_sections() const {
|
||||||
return arr;
|
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;
|
List<String> s;
|
||||||
get_section_keys(p_section,&s);
|
get_section_keys(p_section,&s);
|
||||||
StringArray arr;
|
PoolStringArray arr;
|
||||||
arr.resize(s.size());
|
arr.resize(s.size());
|
||||||
int idx=0;
|
int idx=0;
|
||||||
for(const List<String>::Element *E=s.front();E;E=E->next()) {
|
for(const List<String>::Element *E=s.front();E;E=E->next()) {
|
||||||
|
|
|
@ -38,8 +38,8 @@ class ConfigFile : public Reference {
|
||||||
|
|
||||||
Map< String, Map<String, Variant> > values;
|
Map< String, Map<String, Variant> > values;
|
||||||
|
|
||||||
StringArray _get_sections() const;
|
PoolStringArray _get_sections() const;
|
||||||
StringArray _get_section_keys(const String& p_section) const;
|
PoolStringArray _get_section_keys(const String& p_section) const;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
|
@ -193,7 +193,7 @@ Error HTTPClient::send_body_text(const String& p_body){
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error HTTPClient::send_body_data(const ByteArray& p_body){
|
Error HTTPClient::send_body_data(const PoolByteArray& p_body){
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -444,11 +444,11 @@ Dictionary HTTPClient::_get_response_headers_as_dictionary() {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringArray HTTPClient::_get_response_headers() {
|
PoolStringArray HTTPClient::_get_response_headers() {
|
||||||
|
|
||||||
List<String> rh;
|
List<String> rh;
|
||||||
get_response_headers(&rh);
|
get_response_headers(&rh);
|
||||||
StringArray ret;
|
PoolStringArray ret;
|
||||||
ret.resize(rh.size());
|
ret.resize(rh.size());
|
||||||
int idx=0;
|
int idx=0;
|
||||||
for(const List<String>::Element *E=rh.front();E;E=E->next()) {
|
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;
|
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;
|
Error err=OK;
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ ByteArray HTTPClient::read_response_body_chunk() {
|
||||||
if (chunk.size()>32) {
|
if (chunk.size()>32) {
|
||||||
ERR_PRINT("HTTP Invalid chunk hex len");
|
ERR_PRINT("HTTP Invalid chunk hex len");
|
||||||
status=STATUS_CONNECTION_ERROR;
|
status=STATUS_CONNECTION_ERROR;
|
||||||
return ByteArray();
|
return PoolByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chunk.size()>2 && chunk[chunk.size()-2]=='\r' && chunk[chunk.size()-1]=='\n') {
|
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 {
|
else {
|
||||||
ERR_PRINT("HTTP Chunk len not in hex!!");
|
ERR_PRINT("HTTP Chunk len not in hex!!");
|
||||||
status=STATUS_CONNECTION_ERROR;
|
status=STATUS_CONNECTION_ERROR;
|
||||||
return ByteArray();
|
return PoolByteArray();
|
||||||
}
|
}
|
||||||
len<<=4;
|
len<<=4;
|
||||||
len|=v;
|
len|=v;
|
||||||
if (len>(1<<24)) {
|
if (len>(1<<24)) {
|
||||||
ERR_PRINT("HTTP Chunk too big!! >16mb");
|
ERR_PRINT("HTTP Chunk too big!! >16mb");
|
||||||
status=STATUS_CONNECTION_ERROR;
|
status=STATUS_CONNECTION_ERROR;
|
||||||
return ByteArray();
|
return PoolByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -521,7 +521,7 @@ ByteArray HTTPClient::read_response_body_chunk() {
|
||||||
//end!
|
//end!
|
||||||
status=STATUS_CONNECTED;
|
status=STATUS_CONNECTED;
|
||||||
chunk.clear();
|
chunk.clear();
|
||||||
return ByteArray();
|
return PoolByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
chunk_left=len+2;
|
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') {
|
if (chunk[chunk.size()-2]!='\r' || chunk[chunk.size()-1]!='\n') {
|
||||||
ERR_PRINT("HTTP Invalid chunk terminator (not \\r\\n)");
|
ERR_PRINT("HTTP Invalid chunk terminator (not \\r\\n)");
|
||||||
status=STATUS_CONNECTION_ERROR;
|
status=STATUS_CONNECTION_ERROR;
|
||||||
return ByteArray();
|
return PoolByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArray ret;
|
PoolByteArray ret;
|
||||||
ret.resize(chunk.size()-2);
|
ret.resize(chunk.size()-2);
|
||||||
{
|
{
|
||||||
ByteArray::Write w = ret.write();
|
PoolByteArray::Write w = ret.write();
|
||||||
copymem(w.ptr(),chunk.ptr(),chunk.size()-2);
|
copymem(w.ptr(),chunk.ptr(),chunk.size()-2);
|
||||||
}
|
}
|
||||||
chunk.clear();
|
chunk.clear();
|
||||||
|
@ -564,9 +564,9 @@ ByteArray HTTPClient::read_response_body_chunk() {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
int to_read = MIN(body_left,read_chunk_size);
|
int to_read = MIN(body_left,read_chunk_size);
|
||||||
ByteArray ret;
|
PoolByteArray ret;
|
||||||
ret.resize(to_read);
|
ret.resize(to_read);
|
||||||
ByteArray::Write w = ret.write();
|
PoolByteArray::Write w = ret.write();
|
||||||
int _offset = 0;
|
int _offset = 0;
|
||||||
while (to_read > 0) {
|
while (to_read > 0) {
|
||||||
int rec=0;
|
int rec=0;
|
||||||
|
@ -603,7 +603,7 @@ ByteArray HTTPClient::read_response_body_chunk() {
|
||||||
status=STATUS_CONNECTED;
|
status=STATUS_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ByteArray();
|
return PoolByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
HTTPClient::Status HTTPClient::get_status() const {
|
HTTPClient::Status HTTPClient::get_status() const {
|
||||||
|
|
|
@ -156,7 +156,7 @@ private:
|
||||||
Vector<String> response_headers;
|
Vector<String> response_headers;
|
||||||
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
StringArray _get_response_headers();
|
PoolStringArray _get_response_headers();
|
||||||
Dictionary _get_response_headers_as_dictionary();
|
Dictionary _get_response_headers_as_dictionary();
|
||||||
int read_chunk_size;
|
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_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 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_text(const String& p_body);
|
||||||
Error send_body_data(const ByteArray& p_body);
|
Error send_body_data(const PoolByteArray& p_body);
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ public:
|
||||||
Error get_response_headers(List<String> *r_response);
|
Error get_response_headers(List<String> *r_response);
|
||||||
int get_response_body_length() const;
|
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
|
void set_blocking_mode(bool p_enable); //useful mostly if running in a thread
|
||||||
bool is_blocking_mode_enabled() const;
|
bool is_blocking_mode_enabled() const;
|
||||||
|
|
|
@ -52,9 +52,9 @@ String JSON::_print_var(const Variant& p_var) {
|
||||||
case Variant::BOOL: return p_var.operator bool() ? "true": "false";
|
case Variant::BOOL: return p_var.operator bool() ? "true": "false";
|
||||||
case Variant::INT: return itos(p_var);
|
case Variant::INT: return itos(p_var);
|
||||||
case Variant::REAL: return rtos(p_var);
|
case Variant::REAL: return rtos(p_var);
|
||||||
case Variant::INT_ARRAY:
|
case Variant::POOL_INT_ARRAY:
|
||||||
case Variant::REAL_ARRAY:
|
case Variant::POOL_REAL_ARRAY:
|
||||||
case Variant::STRING_ARRAY:
|
case Variant::POOL_STRING_ARRAY:
|
||||||
case Variant::ARRAY: {
|
case Variant::ARRAY: {
|
||||||
|
|
||||||
String s = "[";
|
String s = "[";
|
||||||
|
|
|
@ -164,10 +164,10 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
|
||||||
(*r_len)+=4*3;
|
(*r_len)+=4*3;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::MATRIX32: {
|
case Variant::TRANSFORM2D: {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(len<(int)4*6,ERR_INVALID_DATA);
|
ERR_FAIL_COND_V(len<(int)4*6,ERR_INVALID_DATA);
|
||||||
Matrix32 val;
|
Transform2D val;
|
||||||
for(int i=0;i<3;i++) {
|
for(int i=0;i<3;i++) {
|
||||||
for(int j=0;j<2;j++) {
|
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;
|
(*r_len)+=4*4;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::_AABB: {
|
case Variant::RECT3: {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(len<(int)4*6,ERR_INVALID_DATA);
|
ERR_FAIL_COND_V(len<(int)4*6,ERR_INVALID_DATA);
|
||||||
AABB val;
|
Rect3 val;
|
||||||
val.pos.x=decode_float(&buf[0]);
|
val.pos.x=decode_float(&buf[0]);
|
||||||
val.pos.y=decode_float(&buf[4]);
|
val.pos.y=decode_float(&buf[4]);
|
||||||
val.pos.z=decode_float(&buf[8]);
|
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;
|
(*r_len)+=4*6;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::MATRIX3: {
|
case Variant::BASIS: {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(len<(int)4*9,ERR_INVALID_DATA);
|
ERR_FAIL_COND_V(len<(int)4*9,ERR_INVALID_DATA);
|
||||||
Matrix3 val;
|
Basis val;
|
||||||
for(int i=0;i<3;i++) {
|
for(int i=0;i<3;i++) {
|
||||||
for(int j=0;j<3;j++) {
|
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;
|
} break;
|
||||||
|
|
||||||
// arrays
|
// arrays
|
||||||
case Variant::RAW_ARRAY: {
|
case Variant::POOL_BYTE_ARRAY: {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
||||||
uint32_t count = decode_uint32(buf);
|
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;
|
} break;
|
||||||
case Variant::INT_ARRAY: {
|
case Variant::POOL_INT_ARRAY: {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
||||||
uint32_t count = decode_uint32(buf);
|
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;
|
} break;
|
||||||
case Variant::REAL_ARRAY: {
|
case Variant::POOL_REAL_ARRAY: {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
||||||
uint32_t count = decode_uint32(buf);
|
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;
|
} break;
|
||||||
case Variant::STRING_ARRAY: {
|
case Variant::POOL_STRING_ARRAY: {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
||||||
uint32_t count = decode_uint32(buf);
|
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;
|
} break;
|
||||||
case Variant::VECTOR2_ARRAY: {
|
case Variant::POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
||||||
uint32_t count = decode_uint32(buf);
|
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;
|
r_variant=varray;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::VECTOR3_ARRAY: {
|
case Variant::POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
||||||
uint32_t count = decode_uint32(buf);
|
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;
|
r_variant=varray;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::COLOR_ARRAY: {
|
case Variant::POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
|
||||||
uint32_t count = decode_uint32(buf);
|
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;
|
r_len+=3*4;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::MATRIX32: {
|
case Variant::TRANSFORM2D: {
|
||||||
|
|
||||||
if (buf) {
|
if (buf) {
|
||||||
Matrix32 val=p_variant;
|
Transform2D val=p_variant;
|
||||||
for(int i=0;i<3;i++) {
|
for(int i=0;i<3;i++) {
|
||||||
for(int j=0;j<2;j++) {
|
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;
|
r_len+=4*4;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::_AABB: {
|
case Variant::RECT3: {
|
||||||
|
|
||||||
if (buf) {
|
if (buf) {
|
||||||
AABB aabb=p_variant;
|
Rect3 aabb=p_variant;
|
||||||
encode_float(aabb.pos.x,&buf[0]);
|
encode_float(aabb.pos.x,&buf[0]);
|
||||||
encode_float(aabb.pos.y,&buf[4]);
|
encode_float(aabb.pos.y,&buf[4]);
|
||||||
encode_float(aabb.pos.z,&buf[8]);
|
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;
|
} break;
|
||||||
case Variant::MATRIX3: {
|
case Variant::BASIS: {
|
||||||
|
|
||||||
if (buf) {
|
if (buf) {
|
||||||
Matrix3 val=p_variant;
|
Basis val=p_variant;
|
||||||
for(int i=0;i<3;i++) {
|
for(int i=0;i<3;i++) {
|
||||||
for(int j=0;j<3;j++) {
|
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;
|
} break;
|
||||||
// arrays
|
// arrays
|
||||||
case Variant::RAW_ARRAY: {
|
case Variant::POOL_BYTE_ARRAY: {
|
||||||
|
|
||||||
PoolVector<uint8_t> data = p_variant;
|
PoolVector<uint8_t> data = p_variant;
|
||||||
int datalen=data.size();
|
int datalen=data.size();
|
||||||
|
@ -1313,7 +1313,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
|
||||||
r_len++;
|
r_len++;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::INT_ARRAY: {
|
case Variant::POOL_INT_ARRAY: {
|
||||||
|
|
||||||
PoolVector<int> data = p_variant;
|
PoolVector<int> data = p_variant;
|
||||||
int datalen=data.size();
|
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;
|
r_len+=4+datalen*datasize;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::REAL_ARRAY: {
|
case Variant::POOL_REAL_ARRAY: {
|
||||||
|
|
||||||
PoolVector<real_t> data = p_variant;
|
PoolVector<real_t> data = p_variant;
|
||||||
int datalen=data.size();
|
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;
|
r_len+=4+datalen*datasize;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::STRING_ARRAY: {
|
case Variant::POOL_STRING_ARRAY: {
|
||||||
|
|
||||||
|
|
||||||
PoolVector<String> data = p_variant;
|
PoolVector<String> data = p_variant;
|
||||||
|
@ -1383,7 +1383,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::VECTOR2_ARRAY: {
|
case Variant::POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
PoolVector<Vector2> data = p_variant;
|
PoolVector<Vector2> data = p_variant;
|
||||||
int len=data.size();
|
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;
|
r_len+=4*2*len;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::VECTOR3_ARRAY: {
|
case Variant::POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
PoolVector<Vector3> data = p_variant;
|
PoolVector<Vector3> data = p_variant;
|
||||||
int len=data.size();
|
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;
|
r_len+=4*3*len;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::COLOR_ARRAY: {
|
case Variant::POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
PoolVector<Color> data = p_variant;
|
PoolVector<Color> data = p_variant;
|
||||||
int len=data.size();
|
int len=data.size();
|
||||||
|
|
|
@ -180,7 +180,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
|
||||||
} break;
|
} break;
|
||||||
case VARIANT_AABB: {
|
case VARIANT_AABB: {
|
||||||
|
|
||||||
AABB v;
|
Rect3 v;
|
||||||
v.pos.x=f->get_real();
|
v.pos.x=f->get_real();
|
||||||
v.pos.y=f->get_real();
|
v.pos.y=f->get_real();
|
||||||
v.pos.z=f->get_real();
|
v.pos.z=f->get_real();
|
||||||
|
@ -192,7 +192,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
|
||||||
} break;
|
} break;
|
||||||
case VARIANT_MATRIX32: {
|
case VARIANT_MATRIX32: {
|
||||||
|
|
||||||
Matrix32 v;
|
Transform2D v;
|
||||||
v.elements[0].x=f->get_real();
|
v.elements[0].x=f->get_real();
|
||||||
v.elements[0].y=f->get_real();
|
v.elements[0].y=f->get_real();
|
||||||
v.elements[1].x=f->get_real();
|
v.elements[1].x=f->get_real();
|
||||||
|
@ -204,7 +204,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
|
||||||
} break;
|
} break;
|
||||||
case VARIANT_MATRIX3: {
|
case VARIANT_MATRIX3: {
|
||||||
|
|
||||||
Matrix3 v;
|
Basis v;
|
||||||
v.elements[0].x=f->get_real();
|
v.elements[0].x=f->get_real();
|
||||||
v.elements[0].y=f->get_real();
|
v.elements[0].y=f->get_real();
|
||||||
v.elements[0].z=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);
|
f->store_real(val.w);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::_AABB: {
|
case Variant::RECT3: {
|
||||||
|
|
||||||
f->store_32(VARIANT_AABB);
|
f->store_32(VARIANT_AABB);
|
||||||
AABB val=p_property;
|
Rect3 val=p_property;
|
||||||
f->store_real(val.pos.x);
|
f->store_real(val.pos.x);
|
||||||
f->store_real(val.pos.y);
|
f->store_real(val.pos.y);
|
||||||
f->store_real(val.pos.z);
|
f->store_real(val.pos.z);
|
||||||
|
@ -1521,10 +1521,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
|
||||||
f->store_real(val.size.z);
|
f->store_real(val.size.z);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::MATRIX32: {
|
case Variant::TRANSFORM2D: {
|
||||||
|
|
||||||
f->store_32(VARIANT_MATRIX32);
|
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].x);
|
||||||
f->store_real(val.elements[0].y);
|
f->store_real(val.elements[0].y);
|
||||||
f->store_real(val.elements[1].x);
|
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);
|
f->store_real(val.elements[2].y);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::MATRIX3: {
|
case Variant::BASIS: {
|
||||||
|
|
||||||
f->store_32(VARIANT_MATRIX3);
|
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].x);
|
||||||
f->store_real(val.elements[0].y);
|
f->store_real(val.elements[0].y);
|
||||||
f->store_real(val.elements[0].z);
|
f->store_real(val.elements[0].z);
|
||||||
|
@ -1728,7 +1728,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::RAW_ARRAY: {
|
case Variant::POOL_BYTE_ARRAY: {
|
||||||
|
|
||||||
f->store_32(VARIANT_RAW_ARRAY);
|
f->store_32(VARIANT_RAW_ARRAY);
|
||||||
PoolVector<uint8_t> arr = p_property;
|
PoolVector<uint8_t> arr = p_property;
|
||||||
|
@ -1739,7 +1739,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
|
||||||
_pad_buffer(len);
|
_pad_buffer(len);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::INT_ARRAY: {
|
case Variant::POOL_INT_ARRAY: {
|
||||||
|
|
||||||
f->store_32(VARIANT_INT_ARRAY);
|
f->store_32(VARIANT_INT_ARRAY);
|
||||||
PoolVector<int> arr = p_property;
|
PoolVector<int> arr = p_property;
|
||||||
|
@ -1750,7 +1750,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
|
||||||
f->store_32(r[i]);
|
f->store_32(r[i]);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::REAL_ARRAY: {
|
case Variant::POOL_REAL_ARRAY: {
|
||||||
|
|
||||||
f->store_32(VARIANT_REAL_ARRAY);
|
f->store_32(VARIANT_REAL_ARRAY);
|
||||||
PoolVector<real_t> arr = p_property;
|
PoolVector<real_t> arr = p_property;
|
||||||
|
@ -1762,7 +1762,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::STRING_ARRAY: {
|
case Variant::POOL_STRING_ARRAY: {
|
||||||
|
|
||||||
f->store_32(VARIANT_STRING_ARRAY);
|
f->store_32(VARIANT_STRING_ARRAY);
|
||||||
PoolVector<String> arr = p_property;
|
PoolVector<String> arr = p_property;
|
||||||
|
@ -1774,7 +1774,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::VECTOR3_ARRAY: {
|
case Variant::POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
f->store_32(VARIANT_VECTOR3_ARRAY);
|
f->store_32(VARIANT_VECTOR3_ARRAY);
|
||||||
PoolVector<Vector3> arr = p_property;
|
PoolVector<Vector3> arr = p_property;
|
||||||
|
@ -1788,7 +1788,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::VECTOR2_ARRAY: {
|
case Variant::POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
f->store_32(VARIANT_VECTOR2_ARRAY);
|
f->store_32(VARIANT_VECTOR2_ARRAY);
|
||||||
PoolVector<Vector2> arr = p_property;
|
PoolVector<Vector2> arr = p_property;
|
||||||
|
@ -1801,7 +1801,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::COLOR_ARRAY: {
|
case Variant::POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
f->store_32(VARIANT_COLOR_ARRAY);
|
f->store_32(VARIANT_COLOR_ARRAY);
|
||||||
PoolVector<Color> arr = p_property;
|
PoolVector<Color> arr = p_property;
|
||||||
|
|
|
@ -45,7 +45,7 @@ StreamPeerSSL::LoadCertsFromMemory StreamPeerSSL::load_certs_func=NULL;
|
||||||
bool StreamPeerSSL::available=false;
|
bool StreamPeerSSL::available=false;
|
||||||
bool StreamPeerSSL::initialize_certs=true;
|
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)
|
if (load_certs_func)
|
||||||
load_certs_func(p_memory);
|
load_certs_func(p_memory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class StreamPeerSSL : public StreamPeer {
|
||||||
GDCLASS(StreamPeerSSL,StreamPeer);
|
GDCLASS(StreamPeerSSL,StreamPeer);
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef void (*LoadCertsFromMemory)(const ByteArray& p_certs);
|
typedef void (*LoadCertsFromMemory)(const PoolByteArray& p_certs);
|
||||||
protected:
|
protected:
|
||||||
static StreamPeerSSL* (*_create)();
|
static StreamPeerSSL* (*_create)();
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
@ -65,7 +65,7 @@ public:
|
||||||
|
|
||||||
static StreamPeerSSL* create();
|
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();
|
static bool is_available();
|
||||||
|
|
||||||
StreamPeerSSL();
|
StreamPeerSSL();
|
||||||
|
|
|
@ -30,24 +30,24 @@
|
||||||
|
|
||||||
#include "print_string.h"
|
#include "print_string.h"
|
||||||
|
|
||||||
float AABB::get_area() const {
|
float Rect3::get_area() const {
|
||||||
|
|
||||||
return size.x*size.y*size.z;
|
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));
|
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));
|
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 beg_1,beg_2;
|
||||||
Vector3 end_1,end_2;
|
Vector3 end_1,end_2;
|
||||||
|
@ -70,7 +70,7 @@ void AABB::merge_with(const AABB& p_aabb) {
|
||||||
size=max-min;
|
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_min=pos;
|
||||||
Vector3 src_max=pos+size;
|
Vector3 src_max=pos+size;
|
||||||
|
@ -80,7 +80,7 @@ AABB AABB::intersection(const AABB& p_aabb) const {
|
||||||
Vector3 min,max;
|
Vector3 min,max;
|
||||||
|
|
||||||
if (src_min.x > dst_max.x || src_max.x < dst_min.x )
|
if (src_min.x > dst_max.x || src_max.x < dst_min.x )
|
||||||
return AABB();
|
return Rect3();
|
||||||
else {
|
else {
|
||||||
|
|
||||||
min.x= ( src_min.x > dst_min.x ) ? src_min.x :dst_min.x;
|
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 )
|
if (src_min.y > dst_max.y || src_max.y < dst_min.y )
|
||||||
return AABB();
|
return Rect3();
|
||||||
else {
|
else {
|
||||||
|
|
||||||
min.y= ( src_min.y > dst_min.y ) ? src_min.y :dst_min.y;
|
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 )
|
if (src_min.z > dst_max.z || src_max.z < dst_min.z )
|
||||||
return AABB();
|
return Rect3();
|
||||||
else {
|
else {
|
||||||
|
|
||||||
min.z= ( src_min.z > dst_min.z ) ? src_min.z :dst_min.z;
|
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 c1, c2;
|
||||||
Vector3 end = pos+size;
|
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;
|
real_t min=0,max=1;
|
||||||
int axis=0;
|
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 points[8] = {
|
||||||
Vector3( pos.x , pos.y , pos.z ),
|
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);
|
Vector3 axis(1,0,0);
|
||||||
real_t max_size=size.x;
|
real_t max_size=size.x;
|
||||||
|
@ -263,7 +263,7 @@ Vector3 AABB::get_longest_axis() const {
|
||||||
|
|
||||||
return axis;
|
return axis;
|
||||||
}
|
}
|
||||||
int AABB::get_longest_axis_index() const {
|
int Rect3::get_longest_axis_index() const {
|
||||||
|
|
||||||
int axis=0;
|
int axis=0;
|
||||||
real_t max_size=size.x;
|
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);
|
Vector3 axis(1,0,0);
|
||||||
real_t max_size=size.x;
|
real_t max_size=size.x;
|
||||||
|
@ -299,7 +299,7 @@ Vector3 AABB::get_shortest_axis() const {
|
||||||
|
|
||||||
return axis;
|
return axis;
|
||||||
}
|
}
|
||||||
int AABB::get_shortest_axis_index() const {
|
int Rect3::get_shortest_axis_index() const {
|
||||||
|
|
||||||
int axis=0;
|
int axis=0;
|
||||||
real_t max_size=size.x;
|
real_t max_size=size.x;
|
||||||
|
@ -317,26 +317,26 @@ int AABB::get_shortest_axis_index() const {
|
||||||
return axis;
|
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);
|
aabb.merge_with(p_with);
|
||||||
return aabb;
|
return aabb;
|
||||||
}
|
}
|
||||||
AABB AABB::expand(const Vector3& p_vector) const {
|
Rect3 Rect3::expand(const Vector3& p_vector) const {
|
||||||
AABB aabb=*this;
|
Rect3 aabb=*this;
|
||||||
aabb.expand_to(p_vector);
|
aabb.expand_to(p_vector);
|
||||||
return aabb;
|
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);
|
aabb.grow_by(p_by);
|
||||||
return aabb;
|
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);
|
ERR_FAIL_INDEX(p_edge,12);
|
||||||
switch(p_edge) {
|
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;
|
return String()+pos +" - "+ size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AABB {
|
class Rect3 {
|
||||||
public:
|
public:
|
||||||
Vector3 pos;
|
Vector3 pos;
|
||||||
Vector3 size;
|
Vector3 size;
|
||||||
|
@ -62,16 +62,16 @@ public:
|
||||||
void set_size(const Vector3& p_size) { size=p_size; }
|
void set_size(const Vector3& p_size) { size=p_size; }
|
||||||
|
|
||||||
|
|
||||||
bool operator==(const AABB& p_rval) const;
|
bool operator==(const Rect3& p_rval) const;
|
||||||
bool operator!=(const AABB& 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(const Rect3& 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 intersects_inclusive(const Rect3& 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 encloses(const Rect3 & p_aabb) const; /// p_aabb is completely inside this
|
||||||
|
|
||||||
AABB merge(const AABB& p_with) const;
|
Rect3 merge(const Rect3& p_with) const;
|
||||||
void merge_with(const AABB& p_aabb); ///merge with another AABB
|
void merge_with(const Rect3& p_aabb); ///merge with another AABB
|
||||||
AABB intersection(const AABB& p_aabb) const; ///get box where two intersect, empty if no intersection occurs
|
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_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;
|
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;
|
_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;
|
int get_shortest_axis_index() const;
|
||||||
_FORCE_INLINE_ real_t get_shortest_axis_size() 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);
|
_FORCE_INLINE_ void grow_by(real_t p_amount);
|
||||||
|
|
||||||
void get_edge(int p_edge,Vector3& r_from,Vector3& r_to) const;
|
void get_edge(int p_edge,Vector3& r_from,Vector3& r_to) const;
|
||||||
_FORCE_INLINE_ Vector3 get_endpoint(int p_point) 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 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 */
|
_FORCE_INLINE_ void expand_to(const Vector3& p_vector); /** expand to contain a point if necesary */
|
||||||
|
|
||||||
operator String() const;
|
operator String() const;
|
||||||
|
|
||||||
_FORCE_INLINE_ AABB() {}
|
_FORCE_INLINE_ Rect3() {}
|
||||||
inline AABB(const Vector3 &p_pos,const Vector3& p_size) { pos=p_pos; size=p_size; }
|
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) )
|
if ( pos.x >= (p_aabb.pos.x + p_aabb.size.x) )
|
||||||
return false;
|
return false;
|
||||||
|
@ -127,7 +127,7 @@ inline bool AABB::intersects(const AABB& p_aabb) const {
|
||||||
return true;
|
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) )
|
if ( pos.x > (p_aabb.pos.x + p_aabb.size.x) )
|
||||||
return false;
|
return false;
|
||||||
|
@ -145,7 +145,7 @@ inline bool AABB::intersects_inclusive(const AABB& p_aabb) const {
|
||||||
return true;
|
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_min=pos;
|
||||||
Vector3 src_max=pos+size;
|
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 half_extents = size * 0.5;
|
||||||
Vector3 ofs = pos + half_extents;
|
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) {
|
switch(p_point) {
|
||||||
case 0: return Vector3( pos.x , pos.y , pos.z );
|
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());
|
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
|
#if 1
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ bool AABB::intersects_convex_shape(const Plane *p_planes, int p_plane_count) con
|
||||||
#endif
|
#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)
|
if (p_point.x<pos.x)
|
||||||
return false;
|
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 begin=pos;
|
||||||
Vector3 end=pos+size;
|
Vector3 end=pos+size;
|
||||||
|
@ -293,7 +293,7 @@ inline void AABB::expand_to(const Vector3& p_vector) {
|
||||||
size=end-begin;
|
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 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 );
|
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;
|
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;
|
real_t max_size=size.x;
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ inline real_t AABB::get_longest_axis_size() const {
|
||||||
return max_size;
|
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;
|
real_t max_size=size.x;
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ inline real_t AABB::get_shortest_axis_size() const {
|
||||||
return max_size;
|
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 divx=1.0/dir.x;
|
||||||
float divy=1.0/dir.y;
|
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) );
|
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.x-=p_amount;
|
||||||
pos.y-=p_amount;
|
pos.y-=p_amount;
|
||||||
|
@ -391,6 +391,5 @@ void AABB::grow_by(real_t p_amount) {
|
||||||
size.z+=2.0*p_amount;
|
size.z+=2.0*p_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef AABB Rect3;
|
|
||||||
|
|
||||||
#endif // AABB_H
|
#endif // AABB_H
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "print_string.h"
|
#include "print_string.h"
|
||||||
|
|
||||||
|
|
||||||
void BSP_Tree::from_aabb(const AABB& p_aabb) {
|
void BSP_Tree::from_aabb(const Rect3& p_aabb) {
|
||||||
|
|
||||||
planes.clear();
|
planes.clear();
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ Vector<Plane> BSP_Tree::get_planes() const {
|
||||||
return planes;
|
return planes;
|
||||||
}
|
}
|
||||||
|
|
||||||
AABB BSP_Tree::get_aabb() const {
|
Rect3 BSP_Tree::get_aabb() const {
|
||||||
|
|
||||||
return aabb;
|
return aabb;
|
||||||
}
|
}
|
||||||
|
@ -518,7 +518,7 @@ BSP_Tree::BSP_Tree(const Variant& p_variant) {
|
||||||
ERR_FAIL_COND(src_nodes.size()%3);
|
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"];
|
PoolVector<float> src_planes=d["planes"];
|
||||||
int plane_count=src_planes.size();
|
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;
|
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;
|
nodes=p_nodes;
|
||||||
planes=p_planes;
|
planes=p_planes;
|
||||||
|
|
|
@ -65,7 +65,7 @@ private:
|
||||||
|
|
||||||
Vector<Node> nodes;
|
Vector<Node> nodes;
|
||||||
Vector<Plane> planes;
|
Vector<Plane> planes;
|
||||||
AABB aabb;
|
Rect3 aabb;
|
||||||
float error_radius;
|
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;
|
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; }
|
bool is_empty() const { return nodes.size()==0; }
|
||||||
Vector<Node> get_nodes() const;
|
Vector<Node> get_nodes() const;
|
||||||
Vector<Plane> get_planes() const;
|
Vector<Plane> get_planes() const;
|
||||||
AABB get_aabb() const;
|
Rect3 get_aabb() const;
|
||||||
|
|
||||||
bool point_is_inside(const Vector3& p_point) const;
|
bool point_is_inside(const Vector3& p_point) const;
|
||||||
int get_points_inside(const Vector3* p_points, int p_point_count) const;
|
int get_points_inside(const Vector3* p_points, int p_point_count) const;
|
||||||
|
@ -87,12 +87,12 @@ public:
|
||||||
|
|
||||||
operator Variant() const;
|
operator Variant() const;
|
||||||
|
|
||||||
void from_aabb(const AABB& p_aabb);
|
void from_aabb(const Rect3& p_aabb);
|
||||||
|
|
||||||
BSP_Tree();
|
BSP_Tree();
|
||||||
BSP_Tree(const Variant& p_variant);
|
BSP_Tree(const Variant& p_variant);
|
||||||
BSP_Tree(const PoolVector<Face3>& p_faces,float p_error_radius=0);
|
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();
|
~BSP_Tree();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -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 min = p_aabb.pos;
|
||||||
Vector3 max = p_aabb.pos+p_aabb.size;
|
Vector3 max = p_aabb.pos+p_aabb.size;
|
||||||
|
|
|
@ -85,7 +85,7 @@ struct CameraMatrix {
|
||||||
|
|
||||||
operator String() const;
|
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);
|
void make_scale(const Vector3 &p_scale);
|
||||||
int get_pixels_per_meter(int p_for_pixel_width) const;
|
int get_pixels_per_meter(int p_for_pixel_width) const;
|
||||||
operator Transform() const;
|
operator Transform() const;
|
||||||
|
|
|
@ -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 **/
|
/** TEST PLANE **/
|
||||||
if (!p_aabb.intersects_plane( get_plane() ))
|
if (!p_aabb.intersects_plane( get_plane() ))
|
||||||
|
|
|
@ -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 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;
|
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[1] );
|
||||||
aabb.expand_to( vertex[2] );
|
aabb.expand_to( vertex[2] );
|
||||||
return aabb;
|
return aabb;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool intersects_aabb(const AABB& p_aabb) const;
|
bool intersects_aabb(const Rect3& p_aabb) const;
|
||||||
_FORCE_INLINE_ bool intersects_aabb2(const AABB& p_aabb) const;
|
_FORCE_INLINE_ bool intersects_aabb2(const Rect3& p_aabb) const;
|
||||||
operator String() const;
|
operator String() const;
|
||||||
|
|
||||||
inline Face3() {}
|
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]);
|
Vector3 perp = (vertex[0]-vertex[2]).cross(vertex[0]-vertex[1]);
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
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.pos=aabb.pos*voxelsize;
|
||||||
aabb.size=aabb.size*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();
|
PoolVector<Face3>::Read facesr=p_array.read();
|
||||||
const Face3 *faces = facesr.ptr();
|
const Face3 *faces = facesr.ptr();
|
||||||
|
|
||||||
AABB global_aabb;
|
Rect3 global_aabb;
|
||||||
|
|
||||||
for(int i=0;i<face_count;i++) {
|
for(int i=0;i<face_count;i++) {
|
||||||
|
|
||||||
|
|
|
@ -408,22 +408,22 @@ bool Point2i::operator!=(const Point2i& p_vec2) const {
|
||||||
return x!=p_vec2.x || y!=p_vec2.y;
|
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.
|
// 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]);
|
SWAP(elements[0][1],elements[1][0]);
|
||||||
elements[2] = basis_xform(-elements[2]);
|
elements[2] = basis_xform(-elements[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix32 Matrix32::inverse() const {
|
Transform2D Transform2D::inverse() const {
|
||||||
|
|
||||||
Matrix32 inv=*this;
|
Transform2D inv=*this;
|
||||||
inv.invert();
|
inv.invert();
|
||||||
return inv;
|
return inv;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix32::affine_invert() {
|
void Transform2D::affine_invert() {
|
||||||
|
|
||||||
real_t det = basis_determinant();
|
real_t det = basis_determinant();
|
||||||
ERR_FAIL_COND(det==0);
|
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();
|
inv.affine_invert();
|
||||||
return inv;
|
return inv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix32::rotate(real_t p_phi) {
|
void Transform2D::rotate(real_t p_phi) {
|
||||||
*this = Matrix32(p_phi,Vector2()) * (*this);
|
*this = Transform2D(p_phi,Vector2()) * (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
real_t Matrix32::get_rotation() const {
|
real_t Transform2D::get_rotation() const {
|
||||||
real_t det = basis_determinant();
|
real_t det = basis_determinant();
|
||||||
Matrix32 m = orthonormalized();
|
Transform2D m = orthonormalized();
|
||||||
if (det < 0) {
|
if (det < 0) {
|
||||||
m.scale_basis(Size2(-1,-1));
|
m.scale_basis(Size2(-1,-1));
|
||||||
}
|
}
|
||||||
return Math::atan2(m[0].y,m[0].x);
|
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 cr = Math::cos(p_rot);
|
||||||
real_t sr = Math::sin(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;
|
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 cr = Math::cos(p_rot);
|
||||||
real_t sr = Math::sin(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;
|
elements[2]=p_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
Size2 Matrix32::get_scale() const {
|
Size2 Transform2D::get_scale() const {
|
||||||
real_t det_sign = basis_determinant() > 0 ? 1 : -1;
|
real_t det_sign = basis_determinant() > 0 ? 1 : -1;
|
||||||
return det_sign * Size2( elements[0].length(), elements[1].length() );
|
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);
|
scale_basis(p_scale);
|
||||||
elements[2]*=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][0]*=p_scale.x;
|
||||||
elements[0][1]*=p_scale.y;
|
elements[0][1]*=p_scale.y;
|
||||||
|
@ -495,16 +495,16 @@ void Matrix32::scale_basis(const Size2& p_scale) {
|
||||||
elements[1][1]*=p_scale.y;
|
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));
|
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);
|
elements[2]+=basis_xform(p_translation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix32::orthonormalize() {
|
void Transform2D::orthonormalize() {
|
||||||
|
|
||||||
// Gram-Schmidt Process
|
// Gram-Schmidt Process
|
||||||
|
|
||||||
|
@ -518,15 +518,15 @@ void Matrix32::orthonormalize() {
|
||||||
elements[0]=x;
|
elements[0]=x;
|
||||||
elements[1]=y;
|
elements[1]=y;
|
||||||
}
|
}
|
||||||
Matrix32 Matrix32::orthonormalized() const {
|
Transform2D Transform2D::orthonormalized() const {
|
||||||
|
|
||||||
Matrix32 on=*this;
|
Transform2D on=*this;
|
||||||
on.orthonormalize();
|
on.orthonormalize();
|
||||||
return on;
|
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++) {
|
for(int i=0;i<3;i++) {
|
||||||
if (elements[i]!=p_transform.elements[i])
|
if (elements[i]!=p_transform.elements[i])
|
||||||
|
@ -536,7 +536,7 @@ bool Matrix32::operator==(const Matrix32& p_transform) const {
|
||||||
return true;
|
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++) {
|
for(int i=0;i<3;i++) {
|
||||||
if (elements[i]!=p_transform.elements[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]);
|
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;
|
t*=p_transform;
|
||||||
return t;
|
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);
|
copy.scale(p_scale);
|
||||||
return copy;
|
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);
|
copy.scale_basis(p_scale);
|
||||||
return copy;
|
return copy;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix32 Matrix32::untranslated() const {
|
Transform2D Transform2D::untranslated() const {
|
||||||
|
|
||||||
Matrix32 copy=*this;
|
Transform2D copy=*this;
|
||||||
copy.elements[2]=Vector2();
|
copy.elements[2]=Vector2();
|
||||||
return copy;
|
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);
|
copy.translate(p_offset);
|
||||||
return copy;
|
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);
|
copy.rotate(p_phi);
|
||||||
return copy;
|
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;
|
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
|
//extract parameters
|
||||||
Vector2 p1 = get_origin();
|
Vector2 p1 = get_origin();
|
||||||
|
@ -648,12 +648,12 @@ Matrix32 Matrix32::interpolate_with(const Matrix32& p_transform, real_t p_c) con
|
||||||
}
|
}
|
||||||
|
|
||||||
//construct matrix
|
//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));
|
res.scale_basis(Vector2::linear_interpolate(s1, s2, p_c));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix32::operator String() const {
|
Transform2D::operator String() const {
|
||||||
|
|
||||||
return String(String()+elements[0]+", "+elements[1]+", "+elements[2]);
|
return String(String()+elements[0]+", "+elements[1]+", "+elements[2]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ Vector2 Vector2::linear_interpolate(const Vector2& p_a, const Vector2& p_b,real_
|
||||||
typedef Vector2 Size2;
|
typedef Vector2 Size2;
|
||||||
typedef Vector2 Point2;
|
typedef Vector2 Point2;
|
||||||
|
|
||||||
struct Matrix32;
|
struct Transform2D;
|
||||||
|
|
||||||
|
|
||||||
struct Rect2 {
|
struct Rect2 {
|
||||||
|
@ -249,7 +249,7 @@ struct Rect2 {
|
||||||
return dist;
|
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;
|
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 {
|
struct Transform2D {
|
||||||
// Warning #1: basis of Matrix32 is stored differently from Matrix3. In terms of elements array, the basis matrix looks like "on paper":
|
// 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])
|
// M = (elements[0][0] elements[1][0])
|
||||||
// (elements[0][1] elements[1][1])
|
// (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].
|
// 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; }
|
_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();
|
void invert();
|
||||||
Matrix32 inverse() const;
|
Transform2D inverse() const;
|
||||||
|
|
||||||
void affine_invert();
|
void affine_invert();
|
||||||
Matrix32 affine_inverse() const;
|
Transform2D affine_inverse() const;
|
||||||
|
|
||||||
void set_rotation(real_t p_phi);
|
void set_rotation(real_t p_phi);
|
||||||
real_t get_rotation() const;
|
real_t get_rotation() const;
|
||||||
|
@ -597,23 +597,23 @@ struct Matrix32 {
|
||||||
_FORCE_INLINE_ const Vector2& get_origin() const { return elements[2]; }
|
_FORCE_INLINE_ const Vector2& get_origin() const { return elements[2]; }
|
||||||
_FORCE_INLINE_ void set_origin(const Vector2& p_origin) { elements[2]=p_origin; }
|
_FORCE_INLINE_ void set_origin(const Vector2& p_origin) { elements[2]=p_origin; }
|
||||||
|
|
||||||
Matrix32 scaled(const Size2& p_scale) const;
|
Transform2D scaled(const Size2& p_scale) const;
|
||||||
Matrix32 basis_scaled(const Size2& p_scale) const;
|
Transform2D basis_scaled(const Size2& p_scale) const;
|
||||||
Matrix32 translated(const Vector2& p_offset) const;
|
Transform2D translated(const Vector2& p_offset) const;
|
||||||
Matrix32 rotated(real_t p_phi) const;
|
Transform2D rotated(real_t p_phi) const;
|
||||||
|
|
||||||
Matrix32 untranslated() const;
|
Transform2D untranslated() const;
|
||||||
|
|
||||||
void orthonormalize();
|
void orthonormalize();
|
||||||
Matrix32 orthonormalized() const;
|
Transform2D orthonormalized() const;
|
||||||
|
|
||||||
bool operator==(const Matrix32& p_transform) const;
|
bool operator==(const Transform2D& p_transform) const;
|
||||||
bool operator!=(const Matrix32& p_transform) const;
|
bool operator!=(const Transform2D& p_transform) const;
|
||||||
|
|
||||||
void operator*=(const Matrix32& p_transform);
|
void operator*=(const Transform2D& p_transform);
|
||||||
Matrix32 operator*(const Matrix32& p_transform) const;
|
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(const Vector2& p_vec) const;
|
||||||
_FORCE_INLINE_ Vector2 basis_xform_inv(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;
|
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][0] = xx;
|
||||||
elements[0][1] = xy;
|
elements[0][1] = xy;
|
||||||
|
@ -634,11 +634,11 @@ struct Matrix32 {
|
||||||
elements[2][1] = oy;
|
elements[2][1] = oy;
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix32(real_t p_rot, const Vector2& p_pos);
|
Transform2D(real_t p_rot, const Vector2& p_pos);
|
||||||
Matrix32() { elements[0][0]=1.0; elements[1][1]=1.0; }
|
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
|
//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(
|
return Vector2(
|
||||||
tdotx(v),
|
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(
|
return Vector2(
|
||||||
elements[0].dot(v),
|
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(
|
return Vector2(
|
||||||
tdotx(v),
|
tdotx(v),
|
||||||
tdoty(v)
|
tdoty(v)
|
||||||
) + elements[2];
|
) + 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];
|
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 x=elements[0]*p_rect.size.x;
|
||||||
Vector2 y=elements[1]*p_rect.size.y;
|
Vector2 y=elements[1]*p_rect.size.y;
|
||||||
|
@ -840,7 +840,7 @@ Rect2 Matrix32::xform(const Rect2& p_rect) const {
|
||||||
return new_rect;
|
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[0][0]=Math::cos(p_rot)*p_scale.x;
|
||||||
elements[1][1]=Math::cos(p_rot)*p_scale.y;
|
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]={
|
Vector2 ends[4]={
|
||||||
xform_inv( p_rect.pos ),
|
xform_inv( p_rect.pos ),
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#define cofac(row1,col1, row2, col2)\
|
#define cofac(row1,col1, row2, col2)\
|
||||||
(elements[row1][col1] * elements[row2][col2] - elements[row1][col2] * elements[row2][col1])
|
(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 ) {
|
if (Math::abs(p_z.z) > Math_SQRT12 ) {
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ void Matrix3::from_z(const Vector3& p_z) {
|
||||||
elements[2]=p_z;
|
elements[2]=p_z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix3::invert() {
|
void Basis::invert() {
|
||||||
|
|
||||||
|
|
||||||
real_t co[3]={
|
real_t co[3]={
|
||||||
|
@ -72,7 +72,7 @@ void Matrix3::invert() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix3::orthonormalize() {
|
void Basis::orthonormalize() {
|
||||||
ERR_FAIL_COND(determinant() == 0);
|
ERR_FAIL_COND(determinant() == 0);
|
||||||
|
|
||||||
// Gram-Schmidt Process
|
// 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();
|
c.orthonormalize();
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Matrix3::is_orthogonal() const {
|
bool Basis::is_orthogonal() const {
|
||||||
Matrix3 id;
|
Basis id;
|
||||||
Matrix3 m = (*this)*transposed();
|
Basis m = (*this)*transposed();
|
||||||
|
|
||||||
return isequal_approx(id,m);
|
return isequal_approx(id,m);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Matrix3::is_rotation() const {
|
bool Basis::is_rotation() const {
|
||||||
return Math::isequal_approx(determinant(), 1) && is_orthogonal();
|
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)
|
if (Math::abs(elements[0][1] - elements[1][0]) > CMP_EPSILON)
|
||||||
return false;
|
return false;
|
||||||
|
@ -125,19 +125,19 @@ bool Matrix3::is_symmetric() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Matrix3 Matrix3::diagonalize() {
|
Basis Basis::diagonalize() {
|
||||||
|
|
||||||
//NOTE: only implemented for symmetric matrices
|
//NOTE: only implemented for symmetric matrices
|
||||||
//with the Jacobi iterative method method
|
//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;
|
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];
|
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;
|
int ite = 0;
|
||||||
Matrix3 acc_rot;
|
Basis acc_rot;
|
||||||
while (off_matrix_norm_2 > CMP_EPSILON2 && ite++ < ite_max ) {
|
while (off_matrix_norm_2 > CMP_EPSILON2 && ite++ < ite_max ) {
|
||||||
real_t el01_2 = elements[0][1] * elements[0][1];
|
real_t el01_2 = elements[0][1] * elements[0][1];
|
||||||
real_t el02_2 = elements[0][2] * elements[0][2];
|
real_t el02_2 = elements[0][2] * elements[0][2];
|
||||||
|
@ -171,7 +171,7 @@ Matrix3 Matrix3::diagonalize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the rotation matrix
|
// Compute the rotation matrix
|
||||||
Matrix3 rot;
|
Basis rot;
|
||||||
rot.elements[i][i] = rot.elements[j][j] = Math::cos(angle);
|
rot.elements[i][i] = rot.elements[j][j] = Math::cos(angle);
|
||||||
rot.elements[i][j] = - (rot.elements[j][i] = Math::sin(angle));
|
rot.elements[i][j] = - (rot.elements[j][i] = Math::sin(angle));
|
||||||
|
|
||||||
|
@ -186,30 +186,30 @@ Matrix3 Matrix3::diagonalize() {
|
||||||
return acc_rot;
|
return acc_rot;
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix3 Matrix3::inverse() const {
|
Basis Basis::inverse() const {
|
||||||
|
|
||||||
Matrix3 inv=*this;
|
Basis inv=*this;
|
||||||
inv.invert();
|
inv.invert();
|
||||||
return inv;
|
return inv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix3::transpose() {
|
void Basis::transpose() {
|
||||||
|
|
||||||
SWAP(elements[0][1],elements[1][0]);
|
SWAP(elements[0][1],elements[1][0]);
|
||||||
SWAP(elements[0][2],elements[2][0]);
|
SWAP(elements[0][2],elements[2][0]);
|
||||||
SWAP(elements[1][2],elements[2][1]);
|
SWAP(elements[1][2],elements[2][1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix3 Matrix3::transposed() const {
|
Basis Basis::transposed() const {
|
||||||
|
|
||||||
Matrix3 tr=*this;
|
Basis tr=*this;
|
||||||
tr.transpose();
|
tr.transpose();
|
||||||
return tr;
|
return tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multiplies the matrix from left by the scaling matrix: M -> S.M
|
// Multiplies the matrix from left by the scaling matrix: M -> S.M
|
||||||
// See the comment for Matrix3::rotated for further explanation.
|
// See the comment for Basis::rotated for further explanation.
|
||||||
void Matrix3::scale(const Vector3& p_scale) {
|
void Basis::scale(const Vector3& p_scale) {
|
||||||
|
|
||||||
elements[0][0]*=p_scale.x;
|
elements[0][0]*=p_scale.x;
|
||||||
elements[0][1]*=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;
|
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);
|
m.scale(p_scale);
|
||||||
return m;
|
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.
|
// We are assuming M = R.S, and performing a polar decomposition to extract R and S.
|
||||||
// FIXME: We eventually need a proper polar decomposition.
|
// 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
|
// 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
|
// Multiplies the matrix from left by the rotation matrix: M -> R.M
|
||||||
// Note that this does *not* rotate the matrix itself.
|
// 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)),
|
// 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()).
|
// not the matrix itself (which is R * (*this) * R.transposed()).
|
||||||
Matrix3 Matrix3::rotated(const Vector3& p_axis, real_t p_phi) const {
|
Basis Basis::rotated(const Vector3& p_axis, real_t p_phi) const {
|
||||||
return Matrix3(p_axis, p_phi) * (*this);
|
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);
|
*this = rotated(p_axis, p_phi);
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix3 Matrix3::rotated(const Vector3& p_euler) const {
|
Basis Basis::rotated(const Vector3& p_euler) const {
|
||||||
return Matrix3(p_euler) * (*this);
|
return Basis(p_euler) * (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix3::rotate(const Vector3& p_euler) {
|
void Basis::rotate(const Vector3& p_euler) {
|
||||||
*this = rotated(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,
|
// 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().
|
// and returns the Euler angles corresponding to the rotation part, complementing get_scale().
|
||||||
// See the comment in get_scale() for further information.
|
// See the comment in get_scale() for further information.
|
||||||
Matrix3 m = orthonormalized();
|
Basis m = orthonormalized();
|
||||||
real_t det = m.determinant();
|
real_t det = m.determinant();
|
||||||
if (det < 0) {
|
if (det < 0) {
|
||||||
// Ensure that the determinant is 1, such that result is a proper rotation matrix which can be represented by Euler angles.
|
// 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
|
// 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
|
// 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.
|
// around the z-axis by a and so on.
|
||||||
Vector3 Matrix3::get_euler() const {
|
Vector3 Basis::get_euler() const {
|
||||||
|
|
||||||
// Euler angles in XYZ convention.
|
// Euler angles in XYZ convention.
|
||||||
// See https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix
|
// 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
|
// 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.
|
// (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).
|
// 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;
|
real_t c, s;
|
||||||
|
|
||||||
c = Math::cos(p_euler.x);
|
c = Math::cos(p_euler.x);
|
||||||
s = Math::sin(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);
|
c = Math::cos(p_euler.y);
|
||||||
s = Math::sin(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);
|
c = Math::cos(p_euler.z);
|
||||||
s = Math::sin(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
|
//optimizer will optimize away all this anyway
|
||||||
*this = xmat*(ymat*zmat);
|
*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 i=0;i<3;i++) {
|
||||||
for (int j=0;j<3;j++) {
|
for (int j=0;j<3;j++) {
|
||||||
|
@ -361,7 +361,7 @@ bool Matrix3::isequal_approx(const Matrix3& a, const Matrix3& b) const {
|
||||||
return true;
|
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 i=0;i<3;i++) {
|
||||||
for (int j=0;j<3;j++) {
|
for (int j=0;j<3;j++) {
|
||||||
|
@ -373,12 +373,12 @@ bool Matrix3::operator==(const Matrix3& p_matrix) const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Matrix3::operator!=(const Matrix3& p_matrix) const {
|
bool Basis::operator!=(const Basis& p_matrix) const {
|
||||||
|
|
||||||
return (!(*this==p_matrix));
|
return (!(*this==p_matrix));
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix3::operator String() const {
|
Basis::operator String() const {
|
||||||
|
|
||||||
String mtx;
|
String mtx;
|
||||||
for (int i=0;i<3;i++) {
|
for (int i=0;i<3;i++) {
|
||||||
|
@ -395,7 +395,7 @@ Matrix3::operator String() const {
|
||||||
return mtx;
|
return mtx;
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix3::operator Quat() const {
|
Basis::operator Quat() const {
|
||||||
ERR_FAIL_COND_V(is_rotation() == false, Quat());
|
ERR_FAIL_COND_V(is_rotation() == false, Quat());
|
||||||
|
|
||||||
real_t trace = elements[0][0] + elements[1][1] + elements[2][2];
|
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]={
|
static const Basis _ortho_bases[24]={
|
||||||
Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1),
|
Basis(1, 0, 0, 0, 1, 0, 0, 0, 1),
|
||||||
Matrix3(0, -1, 0, 1, 0, 0, 0, 0, 1),
|
Basis(0, -1, 0, 1, 0, 0, 0, 0, 1),
|
||||||
Matrix3(-1, 0, 0, 0, -1, 0, 0, 0, 1),
|
Basis(-1, 0, 0, 0, -1, 0, 0, 0, 1),
|
||||||
Matrix3(0, 1, 0, -1, 0, 0, 0, 0, 1),
|
Basis(0, 1, 0, -1, 0, 0, 0, 0, 1),
|
||||||
Matrix3(1, 0, 0, 0, 0, -1, 0, 1, 0),
|
Basis(1, 0, 0, 0, 0, -1, 0, 1, 0),
|
||||||
Matrix3(0, 0, 1, 1, 0, 0, 0, 1, 0),
|
Basis(0, 0, 1, 1, 0, 0, 0, 1, 0),
|
||||||
Matrix3(-1, 0, 0, 0, 0, 1, 0, 1, 0),
|
Basis(-1, 0, 0, 0, 0, 1, 0, 1, 0),
|
||||||
Matrix3(0, 0, -1, -1, 0, 0, 0, 1, 0),
|
Basis(0, 0, -1, -1, 0, 0, 0, 1, 0),
|
||||||
Matrix3(1, 0, 0, 0, -1, 0, 0, 0, -1),
|
Basis(1, 0, 0, 0, -1, 0, 0, 0, -1),
|
||||||
Matrix3(0, 1, 0, 1, 0, 0, 0, 0, -1),
|
Basis(0, 1, 0, 1, 0, 0, 0, 0, -1),
|
||||||
Matrix3(-1, 0, 0, 0, 1, 0, 0, 0, -1),
|
Basis(-1, 0, 0, 0, 1, 0, 0, 0, -1),
|
||||||
Matrix3(0, -1, 0, -1, 0, 0, 0, 0, -1),
|
Basis(0, -1, 0, -1, 0, 0, 0, 0, -1),
|
||||||
Matrix3(1, 0, 0, 0, 0, 1, 0, -1, 0),
|
Basis(1, 0, 0, 0, 0, 1, 0, -1, 0),
|
||||||
Matrix3(0, 0, -1, 1, 0, 0, 0, -1, 0),
|
Basis(0, 0, -1, 1, 0, 0, 0, -1, 0),
|
||||||
Matrix3(-1, 0, 0, 0, 0, -1, 0, -1, 0),
|
Basis(-1, 0, 0, 0, 0, -1, 0, -1, 0),
|
||||||
Matrix3(0, 0, 1, -1, 0, 0, 0, -1, 0),
|
Basis(0, 0, 1, -1, 0, 0, 0, -1, 0),
|
||||||
Matrix3(0, 0, 1, 0, 1, 0, -1, 0, 0),
|
Basis(0, 0, 1, 0, 1, 0, -1, 0, 0),
|
||||||
Matrix3(0, -1, 0, 0, 0, 1, -1, 0, 0),
|
Basis(0, -1, 0, 0, 0, 1, -1, 0, 0),
|
||||||
Matrix3(0, 0, -1, 0, -1, 0, -1, 0, 0),
|
Basis(0, 0, -1, 0, -1, 0, -1, 0, 0),
|
||||||
Matrix3(0, 1, 0, 0, 0, -1, -1, 0, 0),
|
Basis(0, 1, 0, 0, 0, -1, -1, 0, 0),
|
||||||
Matrix3(0, 0, 1, 0, -1, 0, 1, 0, 0),
|
Basis(0, 0, 1, 0, -1, 0, 1, 0, 0),
|
||||||
Matrix3(0, 1, 0, 0, 0, 1, 1, 0, 0),
|
Basis(0, 1, 0, 0, 0, 1, 1, 0, 0),
|
||||||
Matrix3(0, 0, -1, 0, 1, 0, 1, 0, 0),
|
Basis(0, 0, -1, 0, 1, 0, 1, 0, 0),
|
||||||
Matrix3(0, -1, 0, 0, 0, -1, 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
|
//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 i=0;i<3;i++) {
|
||||||
for(int j=0;j<3;j++) {
|
for(int j=0;j<3;j++) {
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ int Matrix3::get_orthogonal_index() const {
|
||||||
return 0;
|
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
|
//there only exist 24 orthogonal bases in r3
|
||||||
ERR_FAIL_INDEX(p_index,24);
|
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);
|
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;
|
r_angle=angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix3::Matrix3(const Vector3& p_euler) {
|
Basis::Basis(const Vector3& p_euler) {
|
||||||
|
|
||||||
set_euler( 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 d = p_quat.length_squared();
|
||||||
real_t s = 2.0 / d;
|
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
|
// 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);
|
Vector3 axis_sq(p_axis.x*p_axis.x,p_axis.y*p_axis.y,p_axis.z*p_axis.z);
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
/**
|
/**
|
||||||
@author Juan Linietsky <reduzio@gmail.com>
|
@author Juan Linietsky <reduzio@gmail.com>
|
||||||
*/
|
*/
|
||||||
class Matrix3 {
|
class Basis {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Vector3 elements[3];
|
Vector3 elements[3];
|
||||||
|
@ -54,8 +54,8 @@ public:
|
||||||
void invert();
|
void invert();
|
||||||
void transpose();
|
void transpose();
|
||||||
|
|
||||||
Matrix3 inverse() const;
|
Basis inverse() const;
|
||||||
Matrix3 transposed() const;
|
Basis transposed() const;
|
||||||
|
|
||||||
_FORCE_INLINE_ real_t determinant() const;
|
_FORCE_INLINE_ real_t determinant() const;
|
||||||
|
|
||||||
|
@ -73,14 +73,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void rotate(const Vector3& p_axis, real_t p_phi);
|
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);
|
void rotate(const Vector3& p_euler);
|
||||||
Matrix3 rotated(const Vector3& p_euler) const;
|
Basis rotated(const Vector3& p_euler) const;
|
||||||
Vector3 get_rotation() const;
|
Vector3 get_rotation() const;
|
||||||
|
|
||||||
void scale( const Vector3& p_scale );
|
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_scale() const;
|
||||||
|
|
||||||
Vector3 get_euler() 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];
|
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 Basis& p_matrix) const;
|
||||||
bool operator!=(const Matrix3& p_matrix) const;
|
bool operator!=(const Basis& p_matrix) const;
|
||||||
|
|
||||||
_FORCE_INLINE_ Vector3 xform(const Vector3& p_vector) const;
|
_FORCE_INLINE_ Vector3 xform(const Vector3& p_vector) const;
|
||||||
_FORCE_INLINE_ Vector3 xform_inv(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_ void operator*=(const Basis& p_matrix);
|
||||||
_FORCE_INLINE_ Matrix3 operator*(const Matrix3& p_matrix) const;
|
_FORCE_INLINE_ Basis operator*(const Basis& p_matrix) const;
|
||||||
_FORCE_INLINE_ void operator+=(const Matrix3& p_matrix);
|
_FORCE_INLINE_ void operator+=(const Basis& p_matrix);
|
||||||
_FORCE_INLINE_ Matrix3 operator+(const Matrix3& p_matrix) const;
|
_FORCE_INLINE_ Basis operator+(const Basis& p_matrix) const;
|
||||||
_FORCE_INLINE_ void operator-=(const Matrix3& p_matrix);
|
_FORCE_INLINE_ void operator-=(const Basis& p_matrix);
|
||||||
_FORCE_INLINE_ Matrix3 operator-(const Matrix3& p_matrix) const;
|
_FORCE_INLINE_ Basis operator-(const Basis& p_matrix) const;
|
||||||
_FORCE_INLINE_ void operator*=(real_t p_val);
|
_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;
|
int get_orthogonal_index() const;
|
||||||
void set_orthogonal_index(int p_index);
|
void set_orthogonal_index(int p_index);
|
||||||
|
@ -163,9 +163,9 @@ public:
|
||||||
elements[2].zero();
|
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].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].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,
|
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].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);
|
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);
|
set(xx, xy, xz, yx, yy, yz, zx, zy, zz);
|
||||||
}
|
}
|
||||||
|
|
||||||
void orthonormalize();
|
void orthonormalize();
|
||||||
Matrix3 orthonormalized() const;
|
Basis orthonormalized() const;
|
||||||
|
|
||||||
bool is_symmetric() const;
|
bool is_symmetric() const;
|
||||||
Matrix3 diagonalize();
|
Basis diagonalize();
|
||||||
|
|
||||||
operator Quat() const;
|
operator Quat() const;
|
||||||
|
|
||||||
Matrix3(const Quat& p_quat); // euler
|
Basis(const Quat& p_quat); // euler
|
||||||
Matrix3(const Vector3& p_euler); // euler
|
Basis(const Vector3& p_euler); // euler
|
||||||
Matrix3(const Vector3& p_axis, real_t p_phi);
|
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[0]=row0;
|
||||||
elements[1]=row1;
|
elements[1]=row1;
|
||||||
elements[2]=row2;
|
elements[2]=row2;
|
||||||
}
|
}
|
||||||
|
|
||||||
_FORCE_INLINE_ Matrix3() {
|
_FORCE_INLINE_ Basis() {
|
||||||
|
|
||||||
elements[0][0]=1;
|
elements[0][0]=1;
|
||||||
elements[0][1]=0;
|
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(
|
set(
|
||||||
p_matrix.tdotx(elements[0]), p_matrix.tdoty(elements[0]), p_matrix.tdotz(elements[0]),
|
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[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[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]) );
|
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[0] += p_matrix.elements[0];
|
||||||
elements[1] += p_matrix.elements[1];
|
elements[1] += p_matrix.elements[1];
|
||||||
elements[2] += p_matrix.elements[2];
|
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;
|
ret += p_matrix;
|
||||||
return ret;
|
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[0] -= p_matrix.elements[0];
|
||||||
elements[1] -= p_matrix.elements[1];
|
elements[1] -= p_matrix.elements[1];
|
||||||
elements[2] -= p_matrix.elements[2];
|
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;
|
ret -= p_matrix;
|
||||||
return ret;
|
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[0]*=p_val;
|
||||||
elements[1]*=p_val;
|
elements[1]*=p_val;
|
||||||
elements[2]*=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;
|
ret *= p_val;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 Matrix3::xform(const Vector3& p_vector) const {
|
Vector3 Basis::xform(const Vector3& p_vector) const {
|
||||||
|
|
||||||
return Vector3(
|
return Vector3(
|
||||||
elements[0].dot(p_vector),
|
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(
|
return Vector3(
|
||||||
(elements[0][0]*p_vector.x ) + ( elements[1][0]*p_vector.y ) + ( elements[2][0]*p_vector.z ),
|
(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]) -
|
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]) +
|
elements[1][0]*(elements[0][1]*elements[2][2] - elements[2][1]*elements[0][2]) +
|
||||||
|
|
|
@ -107,7 +107,7 @@ private:
|
||||||
struct Octant {
|
struct Octant {
|
||||||
|
|
||||||
// cached for FAST plane check
|
// cached for FAST plane check
|
||||||
AABB aabb;
|
Rect3 aabb;
|
||||||
|
|
||||||
uint64_t last_pass;
|
uint64_t last_pass;
|
||||||
Octant *parent;
|
Octant *parent;
|
||||||
|
@ -152,8 +152,8 @@ private:
|
||||||
OctreeElementID _id;
|
OctreeElementID _id;
|
||||||
Octant *common_parent;
|
Octant *common_parent;
|
||||||
|
|
||||||
AABB aabb;
|
Rect3 aabb;
|
||||||
AABB container_aabb;
|
Rect3 container_aabb;
|
||||||
|
|
||||||
List<PairData*,AL> pair_list;
|
List<PairData*,AL> pair_list;
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
void _insert_element(Element *p_element,Octant *p_octant);
|
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);
|
bool _remove_element_from_octant(Element *p_element,Octant *p_octant,Octant *p_limit=NULL);
|
||||||
void _remove_element(Element *p_element);
|
void _remove_element(Element *p_element);
|
||||||
void _pair_element(Element *p_element,Octant *p_octant);
|
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_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_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);
|
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:
|
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);
|
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 AABB& p_aabb);
|
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 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);
|
void erase(OctreeElementID p_id);
|
||||||
|
|
||||||
|
@ -385,7 +385,7 @@ public:
|
||||||
int get_subindex(OctreeElementID p_id) const;
|
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_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_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);
|
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 {
|
} else {
|
||||||
/* check againt AABB where child should be */
|
/* check againt AABB where child should be */
|
||||||
|
|
||||||
AABB aabb=p_octant->aabb;
|
Rect3 aabb=p_octant->aabb;
|
||||||
aabb.size*=0.5;
|
aabb.size*=0.5;
|
||||||
|
|
||||||
if (i&1)
|
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>
|
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) {
|
if (!root) {
|
||||||
// octre is empty
|
// 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) ) {
|
while ( !base.encloses(p_aabb) ) {
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ void Octree<T,use_pairs,AL>::_ensure_valid_root(const AABB& p_aabb) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
AABB base=root->aabb;
|
Rect3 base=root->aabb;
|
||||||
|
|
||||||
while( !base.encloses( p_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>
|
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
|
// check for AABB validity
|
||||||
#ifdef DEBUG_ENABLED
|
#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>
|
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
|
#ifdef DEBUG_ENABLED
|
||||||
// check for AABB validity
|
// 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) {
|
if (old_has_surf) {
|
||||||
_remove_element(&e); // removing
|
_remove_element(&e); // removing
|
||||||
e.common_parent=NULL;
|
e.common_parent=NULL;
|
||||||
e.aabb=AABB();
|
e.aabb=Rect3();
|
||||||
_optimize();
|
_optimize();
|
||||||
} else {
|
} else {
|
||||||
_ensure_valid_root(p_aabb); // inserting
|
_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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AABB combined=e.aabb;
|
Rect3 combined=e.aabb;
|
||||||
combined.merge_with(p_aabb);
|
combined.merge_with(p_aabb);
|
||||||
_ensure_valid_root(combined);
|
_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>
|
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)
|
if (*p_result_idx==p_result_max)
|
||||||
return; //pointless
|
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>
|
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)
|
if (!root)
|
||||||
|
|
|
@ -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.
|
// (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).
|
// The current implementation uses XYZ convention (Z is the first rotation).
|
||||||
Vector3 Quat::get_euler() const {
|
Vector3 Quat::get_euler() const {
|
||||||
Matrix3 m(*this);
|
Basis m(*this);
|
||||||
return m.get_euler();
|
return m.get_euler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ Error QuickHull::build(const Vector<Vector3>& p_points, Geometry::MeshData &r_me
|
||||||
|
|
||||||
/* CREATE AABB VOLUME */
|
/* CREATE AABB VOLUME */
|
||||||
|
|
||||||
AABB aabb;
|
Rect3 aabb;
|
||||||
for(int i=0;i<p_points.size();i++) {
|
for(int i=0;i<p_points.size();i++) {
|
||||||
|
|
||||||
if (i==0) {
|
if (i==0) {
|
||||||
|
|
|
@ -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{
|
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) {
|
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;
|
basis=p_basis;
|
||||||
origin=p_origin;
|
origin=p_origin;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
class Transform {
|
class Transform {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Matrix3 basis;
|
Basis basis;
|
||||||
Vector3 origin;
|
Vector3 origin;
|
||||||
|
|
||||||
void invert();
|
void invert();
|
||||||
|
@ -62,8 +62,8 @@ public:
|
||||||
void translate( const Vector3& p_translation );
|
void translate( const Vector3& p_translation );
|
||||||
Transform translated( const Vector3& p_translation ) const;
|
Transform translated( const Vector3& p_translation ) const;
|
||||||
|
|
||||||
const Matrix3& get_basis() const { return basis; }
|
const Basis& get_basis() const { return basis; }
|
||||||
void set_basis(const Matrix3& p_basis) { basis=p_basis; }
|
void set_basis(const Basis& p_basis) { basis=p_basis; }
|
||||||
|
|
||||||
const Vector3& get_origin() const { return origin; }
|
const Vector3& get_origin() const { return origin; }
|
||||||
void set_origin(const Vector3& p_origin) { origin=p_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(const Plane& p_plane) const;
|
||||||
_FORCE_INLINE_ Plane xform_inv(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_ Rect3 xform(const Rect3& p_aabb) const;
|
||||||
_FORCE_INLINE_ AABB xform_inv(const AABB& p_aabb) const;
|
_FORCE_INLINE_ Rect3 xform_inv(const Rect3& p_aabb) const;
|
||||||
|
|
||||||
void operator*=(const Transform& p_transform);
|
void operator*=(const Transform& p_transform);
|
||||||
Transform operator*(const Transform& p_transform) const;
|
Transform operator*(const Transform& p_transform) const;
|
||||||
|
@ -113,7 +113,7 @@ public:
|
||||||
|
|
||||||
operator String() const;
|
operator String() const;
|
||||||
|
|
||||||
Transform(const Matrix3& p_basis, const Vector3& p_origin=Vector3());
|
Transform(const Basis& p_basis, const Vector3& p_origin=Vector3());
|
||||||
Transform() {}
|
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 */
|
/* define vertices */
|
||||||
#if 1
|
#if 1
|
||||||
Vector3 x=basis.get_axis(0)*p_aabb.size.x;
|
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 z=basis.get_axis(2)*p_aabb.size.z;
|
||||||
Vector3 pos = xform( p_aabb.pos );
|
Vector3 pos = xform( p_aabb.pos );
|
||||||
//could be even further optimized
|
//could be even further optimized
|
||||||
AABB new_aabb;
|
Rect3 new_aabb;
|
||||||
new_aabb.pos=pos;
|
new_aabb.pos=pos;
|
||||||
new_aabb.expand_to( pos+x );
|
new_aabb.expand_to( pos+x );
|
||||||
new_aabb.expand_to( pos+y );
|
new_aabb.expand_to( pos+y );
|
||||||
|
@ -214,7 +214,7 @@ _FORCE_INLINE_ AABB Transform::xform(const AABB& p_aabb) const {
|
||||||
#endif
|
#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 */
|
/* define vertices */
|
||||||
Vector3 vertices[8]={
|
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]);
|
ret.pos=xform_inv(vertices[0]);
|
||||||
|
|
||||||
|
|
|
@ -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;
|
aabb=p_bb[p_from]->aabb;
|
||||||
for(int i=1;i<p_size;i++) {
|
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);
|
uint32_t* stack = (uint32_t*)alloca(sizeof(int)*max_depth);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ class TriangleMesh : public Reference {
|
||||||
|
|
||||||
struct BVH {
|
struct BVH {
|
||||||
|
|
||||||
AABB aabb;
|
Rect3 aabb;
|
||||||
Vector3 center; //used for sorting
|
Vector3 center; //used for sorting
|
||||||
int left;
|
int left;
|
||||||
int right;
|
int right;
|
||||||
|
@ -88,7 +88,7 @@ public:
|
||||||
bool is_valid() const;
|
bool is_valid() const;
|
||||||
bool intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_point, Vector3 &r_normal) 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;
|
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;
|
PoolVector<Face3> get_faces() const;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
void Vector3::rotate(const Vector3& p_axis,float p_phi) {
|
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 {
|
Vector3 Vector3::rotated(const Vector3& p_axis,float p_phi) const {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include "math_funcs.h"
|
#include "math_funcs.h"
|
||||||
#include "ustring.h"
|
#include "ustring.h"
|
||||||
|
|
||||||
class Matrix3;
|
class Basis;
|
||||||
|
|
||||||
struct Vector3 {
|
struct Vector3 {
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ struct Vector3 {
|
||||||
|
|
||||||
_FORCE_INLINE_ Vector3 cross(const Vector3& p_b) const;
|
_FORCE_INLINE_ Vector3 cross(const Vector3& p_b) const;
|
||||||
_FORCE_INLINE_ real_t dot(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_ Basis outer(const Vector3& p_b) const;
|
||||||
_FORCE_INLINE_ Matrix3 to_diagonal_matrix() const;
|
_FORCE_INLINE_ Basis to_diagonal_matrix() const;
|
||||||
|
|
||||||
_FORCE_INLINE_ Vector3 abs() const;
|
_FORCE_INLINE_ Vector3 abs() const;
|
||||||
_FORCE_INLINE_ Vector3 floor() 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;
|
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 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 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);
|
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 {
|
Basis Vector3::to_diagonal_matrix() const {
|
||||||
return Matrix3(x, 0, 0,
|
return Basis(x, 0, 0,
|
||||||
0, y, 0,
|
0, y, 0,
|
||||||
0, 0, z);
|
0, 0, z);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,11 +71,11 @@ MAKE_PTRARG(String);
|
||||||
MAKE_PTRARG(Vector2);
|
MAKE_PTRARG(Vector2);
|
||||||
MAKE_PTRARG(Rect2);
|
MAKE_PTRARG(Rect2);
|
||||||
MAKE_PTRARG(Vector3);
|
MAKE_PTRARG(Vector3);
|
||||||
MAKE_PTRARG(Matrix32);
|
MAKE_PTRARG(Transform2D);
|
||||||
MAKE_PTRARG(Plane);
|
MAKE_PTRARG(Plane);
|
||||||
MAKE_PTRARG(Quat);
|
MAKE_PTRARG(Quat);
|
||||||
MAKE_PTRARG(AABB);
|
MAKE_PTRARG(AABB);
|
||||||
MAKE_PTRARG(Matrix3);
|
MAKE_PTRARG(Basis);
|
||||||
MAKE_PTRARG(Transform);
|
MAKE_PTRARG(Transform);
|
||||||
MAKE_PTRARG(Color);
|
MAKE_PTRARG(Color);
|
||||||
MAKE_PTRARG(Image);
|
MAKE_PTRARG(Image);
|
||||||
|
|
|
@ -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;
|
InputEvent ev=*this;
|
||||||
|
|
|
@ -298,7 +298,7 @@ struct InputEvent {
|
||||||
void set_as_action(const String& p_action, bool p_pressed);
|
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;
|
bool operator==(const InputEvent &p_event) const;
|
||||||
operator String() const;
|
operator String() const;
|
||||||
InputEvent() { zeromem(this,sizeof(InputEvent)); }
|
InputEvent() { zeromem(this,sizeof(InputEvent)); }
|
||||||
|
|
|
@ -43,7 +43,7 @@ void MainLoop::_bind_methods() {
|
||||||
BIND_VMETHOD( MethodInfo("_initialize") );
|
BIND_VMETHOD( MethodInfo("_initialize") );
|
||||||
BIND_VMETHOD( MethodInfo("_iteration",PropertyInfo(Variant::REAL,"delta")) );
|
BIND_VMETHOD( MethodInfo("_iteration",PropertyInfo(Variant::REAL,"delta")) );
|
||||||
BIND_VMETHOD( MethodInfo("_idle",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_VMETHOD( MethodInfo("_finalize") );
|
||||||
|
|
||||||
BIND_CONSTANT(NOTIFICATION_WM_MOUSE_ENTER);
|
BIND_CONSTANT(NOTIFICATION_WM_MOUSE_ENTER);
|
||||||
|
|
|
@ -239,21 +239,21 @@ uint32_t PackedDataContainer::_pack(const Variant& p_data, Vector<uint8_t>& tmpd
|
||||||
case Variant::VECTOR2:
|
case Variant::VECTOR2:
|
||||||
case Variant::RECT2:
|
case Variant::RECT2:
|
||||||
case Variant::VECTOR3:
|
case Variant::VECTOR3:
|
||||||
case Variant::MATRIX32:
|
case Variant::TRANSFORM2D:
|
||||||
case Variant::PLANE:
|
case Variant::PLANE:
|
||||||
case Variant::QUAT:
|
case Variant::QUAT:
|
||||||
case Variant::_AABB:
|
case Variant::RECT3:
|
||||||
case Variant::MATRIX3:
|
case Variant::BASIS:
|
||||||
case Variant::TRANSFORM:
|
case Variant::TRANSFORM:
|
||||||
case Variant::IMAGE:
|
case Variant::IMAGE:
|
||||||
case Variant::INPUT_EVENT:
|
case Variant::INPUT_EVENT:
|
||||||
case Variant::RAW_ARRAY:
|
case Variant::POOL_BYTE_ARRAY:
|
||||||
case Variant::INT_ARRAY:
|
case Variant::POOL_INT_ARRAY:
|
||||||
case Variant::REAL_ARRAY:
|
case Variant::POOL_REAL_ARRAY:
|
||||||
case Variant::STRING_ARRAY:
|
case Variant::POOL_STRING_ARRAY:
|
||||||
case Variant::VECTOR2_ARRAY:
|
case Variant::POOL_VECTOR2_ARRAY:
|
||||||
case Variant::VECTOR3_ARRAY:
|
case Variant::POOL_VECTOR3_ARRAY:
|
||||||
case Variant::COLOR_ARRAY:
|
case Variant::POOL_COLOR_ARRAY:
|
||||||
case Variant::NODE_PATH: {
|
case Variant::NODE_PATH: {
|
||||||
|
|
||||||
uint32_t pos = tmpdata.size();
|
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("pack:Error","value"),&PackedDataContainer::pack);
|
||||||
ClassDB::bind_method(_MD("size"),&PackedDataContainer::size);
|
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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -168,9 +168,9 @@ void PathRemap::load_remaps() {
|
||||||
for(List<Variant>::Element *E=rk.front();E;E=E->next()) {
|
for(List<Variant>::Element *E=rk.front();E;E=E->next()) {
|
||||||
|
|
||||||
String source = E->get();
|
String source = E->get();
|
||||||
StringArray sa = remaps[E->get()];
|
PoolStringArray sa = remaps[E->get()];
|
||||||
int sas = sa.size();
|
int sas = sa.size();
|
||||||
StringArray::Read r = sa.read();
|
PoolStringArray::Read r = sa.read();
|
||||||
|
|
||||||
for(int i=0;i<sas;i++) {
|
for(int i=0;i<sas;i++) {
|
||||||
|
|
||||||
|
|
|
@ -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());
|
option_names.resize(options.size());
|
||||||
int i=0;
|
int i=0;
|
||||||
for(Map<String,Variant>::Element *E=options.front();E;E=E->next()) {
|
for(Map<String,Variant>::Element *E=options.front();E;E=E->next()) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ResourceImportMetadata : public Reference {
|
||||||
|
|
||||||
Map<String,Variant> options;
|
Map<String,Variant> options;
|
||||||
|
|
||||||
StringArray _get_options() const;
|
PoolStringArray _get_options() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ public:
|
||||||
virtual Script *create_script() const=0;
|
virtual Script *create_script() const=0;
|
||||||
virtual bool has_named_classes() const=0;
|
virtual bool has_named_classes() const=0;
|
||||||
virtual int find_function(const String& p_function,const String& p_code) 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; }
|
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; }
|
||||||
|
|
||||||
|
|
|
@ -909,7 +909,7 @@ void Translation::_bind_methods() {
|
||||||
ClassDB::bind_method(_MD("_set_messages"),&Translation::_set_messages);
|
ClassDB::bind_method(_MD("_set_messages"),&Translation::_set_messages);
|
||||||
ClassDB::bind_method(_MD("_get_messages"),&Translation::_get_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") );
|
ADD_PROPERTY( PropertyInfo(Variant::STRING,"locale"), _SCS("set_locale"), _SCS("get_locale") );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
340
core/variant.cpp
340
core/variant.cpp
|
@ -74,9 +74,9 @@ String Variant::get_type_name(Variant::Type p_type) {
|
||||||
|
|
||||||
return "Rect2";
|
return "Rect2";
|
||||||
} break;
|
} break;
|
||||||
case MATRIX32: {
|
case TRANSFORM2D: {
|
||||||
|
|
||||||
return "Matrix32";
|
return "Transform2D";
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3: {
|
case VECTOR3: {
|
||||||
|
|
||||||
|
@ -92,18 +92,18 @@ String Variant::get_type_name(Variant::Type p_type) {
|
||||||
|
|
||||||
|
|
||||||
} break;*/
|
} break;*/
|
||||||
case _AABB: {
|
case RECT3: {
|
||||||
|
|
||||||
return "AABB";
|
return "Rect3";
|
||||||
} break;
|
} break;
|
||||||
case QUAT: {
|
case QUAT: {
|
||||||
|
|
||||||
return "Quat";
|
return "Quat";
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case MATRIX3: {
|
case BASIS: {
|
||||||
|
|
||||||
return "Matrix3";
|
return "Basis";
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case TRANSFORM: {
|
case TRANSFORM: {
|
||||||
|
@ -153,38 +153,38 @@ String Variant::get_type_name(Variant::Type p_type) {
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
// arrays
|
// arrays
|
||||||
case RAW_ARRAY: {
|
case POOL_BYTE_ARRAY: {
|
||||||
|
|
||||||
return "RawArray";
|
return "PoolByteArray";
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case INT_ARRAY: {
|
case POOL_INT_ARRAY: {
|
||||||
|
|
||||||
return "IntArray";
|
return "PoolIntArray";
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case REAL_ARRAY: {
|
case POOL_REAL_ARRAY: {
|
||||||
|
|
||||||
return "RealArray";
|
return "PoolFloatArray";
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case STRING_ARRAY: {
|
case POOL_STRING_ARRAY: {
|
||||||
|
|
||||||
return "StringArray";
|
return "PoolStringArray";
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2_ARRAY: {
|
case POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
return "Vector2Array";
|
return "PoolVector2Array";
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3_ARRAY: {
|
case POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
return "Vector3Array";
|
return "PoolVector3Array";
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case COLOR_ARRAY: {
|
case POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
return "ColorArray";
|
return "PoolColorArray";
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
default: {}
|
default: {}
|
||||||
|
@ -255,7 +255,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||||
|
|
||||||
invalid_types=invalid;
|
invalid_types=invalid;
|
||||||
} break;
|
} break;
|
||||||
case MATRIX32: {
|
case TRANSFORM2D: {
|
||||||
|
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
|
@ -268,14 +268,14 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||||
case QUAT: {
|
case QUAT: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
MATRIX3,
|
BASIS,
|
||||||
NIL
|
NIL
|
||||||
};
|
};
|
||||||
|
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case MATRIX3: {
|
case BASIS: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
QUAT,
|
QUAT,
|
||||||
|
@ -289,9 +289,9 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||||
case TRANSFORM: {
|
case TRANSFORM: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
MATRIX32,
|
TRANSFORM2D,
|
||||||
QUAT,
|
QUAT,
|
||||||
MATRIX3,
|
BASIS,
|
||||||
NIL
|
NIL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -341,20 +341,20 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||||
|
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
RAW_ARRAY,
|
POOL_BYTE_ARRAY,
|
||||||
INT_ARRAY,
|
POOL_INT_ARRAY,
|
||||||
STRING_ARRAY,
|
POOL_STRING_ARRAY,
|
||||||
REAL_ARRAY,
|
POOL_REAL_ARRAY,
|
||||||
COLOR_ARRAY,
|
POOL_COLOR_ARRAY,
|
||||||
VECTOR2_ARRAY,
|
POOL_VECTOR2_ARRAY,
|
||||||
VECTOR3_ARRAY,
|
POOL_VECTOR3_ARRAY,
|
||||||
NIL
|
NIL
|
||||||
};
|
};
|
||||||
|
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
} break;
|
} break;
|
||||||
// arrays
|
// arrays
|
||||||
case RAW_ARRAY: {
|
case POOL_BYTE_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -363,7 +363,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||||
|
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
} break;
|
} break;
|
||||||
case INT_ARRAY: {
|
case POOL_INT_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -371,7 +371,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||||
};
|
};
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
} break;
|
} break;
|
||||||
case REAL_ARRAY: {
|
case POOL_REAL_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -380,7 +380,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||||
|
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
} break;
|
} break;
|
||||||
case STRING_ARRAY: {
|
case POOL_STRING_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -388,7 +388,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||||
};
|
};
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2_ARRAY: {
|
case POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -397,7 +397,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3_ARRAY: {
|
case POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -406,7 +406,7 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case COLOR_ARRAY: {
|
case POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -507,7 +507,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||||
|
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
} break;
|
} break;
|
||||||
case MATRIX32: {
|
case TRANSFORM2D: {
|
||||||
|
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
|
@ -520,14 +520,14 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||||
case QUAT: {
|
case QUAT: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
MATRIX3,
|
BASIS,
|
||||||
NIL
|
NIL
|
||||||
};
|
};
|
||||||
|
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case MATRIX3: {
|
case BASIS: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
QUAT,
|
QUAT,
|
||||||
|
@ -541,9 +541,9 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||||
case TRANSFORM: {
|
case TRANSFORM: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
MATRIX32,
|
TRANSFORM2D,
|
||||||
QUAT,
|
QUAT,
|
||||||
MATRIX3,
|
BASIS,
|
||||||
NIL
|
NIL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -593,20 +593,20 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||||
|
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
RAW_ARRAY,
|
POOL_BYTE_ARRAY,
|
||||||
INT_ARRAY,
|
POOL_INT_ARRAY,
|
||||||
STRING_ARRAY,
|
POOL_STRING_ARRAY,
|
||||||
REAL_ARRAY,
|
POOL_REAL_ARRAY,
|
||||||
COLOR_ARRAY,
|
POOL_COLOR_ARRAY,
|
||||||
VECTOR2_ARRAY,
|
POOL_VECTOR2_ARRAY,
|
||||||
VECTOR3_ARRAY,
|
POOL_VECTOR3_ARRAY,
|
||||||
NIL
|
NIL
|
||||||
};
|
};
|
||||||
|
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
} break;
|
} break;
|
||||||
// arrays
|
// arrays
|
||||||
case RAW_ARRAY: {
|
case POOL_BYTE_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -615,7 +615,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||||
|
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
} break;
|
} break;
|
||||||
case INT_ARRAY: {
|
case POOL_INT_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -623,7 +623,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||||
};
|
};
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
} break;
|
} break;
|
||||||
case REAL_ARRAY: {
|
case POOL_REAL_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -632,7 +632,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||||
|
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
} break;
|
} break;
|
||||||
case STRING_ARRAY: {
|
case POOL_STRING_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -640,7 +640,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||||
};
|
};
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2_ARRAY: {
|
case POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -649,7 +649,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3_ARRAY: {
|
case POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -658,7 +658,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from,Variant::Type p_type_
|
||||||
valid_types=valid;
|
valid_types=valid;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case COLOR_ARRAY: {
|
case POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
static const Type valid[]={
|
static const Type valid[]={
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
@ -759,9 +759,9 @@ bool Variant::is_zero() const {
|
||||||
return *reinterpret_cast<const Rect2*>(_data._mem)==Rect2();
|
return *reinterpret_cast<const Rect2*>(_data._mem)==Rect2();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case MATRIX32: {
|
case TRANSFORM2D: {
|
||||||
|
|
||||||
return *_data._matrix32==Matrix32();
|
return *_data._transform2d==Transform2D();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3: {
|
case VECTOR3: {
|
||||||
|
@ -779,18 +779,18 @@ bool Variant::is_zero() const {
|
||||||
|
|
||||||
|
|
||||||
} break;*/
|
} break;*/
|
||||||
case _AABB: {
|
case RECT3: {
|
||||||
|
|
||||||
return *_data._aabb==AABB();
|
return *_data._rect3==Rect3();
|
||||||
} break;
|
} break;
|
||||||
case QUAT: {
|
case QUAT: {
|
||||||
|
|
||||||
return *reinterpret_cast<const Quat*>(_data._mem)==Quat();
|
return *reinterpret_cast<const Quat*>(_data._mem)==Quat();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case MATRIX3: {
|
case BASIS: {
|
||||||
|
|
||||||
return *_data._matrix3==Matrix3();
|
return *_data._basis==Basis();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case TRANSFORM: {
|
case TRANSFORM: {
|
||||||
|
@ -840,37 +840,37 @@ bool Variant::is_zero() const {
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
// arrays
|
// arrays
|
||||||
case RAW_ARRAY: {
|
case POOL_BYTE_ARRAY: {
|
||||||
|
|
||||||
return reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem)->size()==0;
|
return reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem)->size()==0;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case INT_ARRAY: {
|
case POOL_INT_ARRAY: {
|
||||||
|
|
||||||
return reinterpret_cast<const PoolVector<int>*>(_data._mem)->size()==0;
|
return reinterpret_cast<const PoolVector<int>*>(_data._mem)->size()==0;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case REAL_ARRAY: {
|
case POOL_REAL_ARRAY: {
|
||||||
|
|
||||||
return reinterpret_cast<const PoolVector<real_t>*>(_data._mem)->size()==0;
|
return reinterpret_cast<const PoolVector<real_t>*>(_data._mem)->size()==0;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case STRING_ARRAY: {
|
case POOL_STRING_ARRAY: {
|
||||||
|
|
||||||
return reinterpret_cast<const PoolVector<String>*>(_data._mem)->size()==0;
|
return reinterpret_cast<const PoolVector<String>*>(_data._mem)->size()==0;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2_ARRAY: {
|
case POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
return reinterpret_cast<const PoolVector<Vector2>*>(_data._mem)->size()==0;
|
return reinterpret_cast<const PoolVector<Vector2>*>(_data._mem)->size()==0;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3_ARRAY: {
|
case POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
return reinterpret_cast<const PoolVector<Vector3>*>(_data._mem)->size()==0;
|
return reinterpret_cast<const PoolVector<Vector3>*>(_data._mem)->size()==0;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case COLOR_ARRAY: {
|
case POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
return reinterpret_cast<const PoolVector<Color>*>(_data._mem)->size()==0;
|
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) ) );
|
memnew_placement( _data._mem, Rect2( *reinterpret_cast<const Rect2*>(p_variant._data._mem) ) );
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case MATRIX32: {
|
case TRANSFORM2D: {
|
||||||
|
|
||||||
_data._matrix32 = memnew( Matrix32( *p_variant._data._matrix32 ) );
|
_data._transform2d = memnew( Transform2D( *p_variant._data._transform2d ) );
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3: {
|
case VECTOR3: {
|
||||||
|
@ -1007,18 +1007,18 @@ void Variant::reference(const Variant& p_variant) {
|
||||||
|
|
||||||
|
|
||||||
} break;*/
|
} break;*/
|
||||||
case _AABB: {
|
case RECT3: {
|
||||||
|
|
||||||
_data._aabb = memnew( AABB( *p_variant._data._aabb ) );
|
_data._rect3 = memnew( Rect3( *p_variant._data._rect3 ) );
|
||||||
} break;
|
} break;
|
||||||
case QUAT: {
|
case QUAT: {
|
||||||
|
|
||||||
memnew_placement( _data._mem, Quat( *reinterpret_cast<const Quat*>(p_variant._data._mem) ) );
|
memnew_placement( _data._mem, Quat( *reinterpret_cast<const Quat*>(p_variant._data._mem) ) );
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case MATRIX3: {
|
case BASIS: {
|
||||||
|
|
||||||
_data._matrix3 = memnew( Matrix3( *p_variant._data._matrix3 ) );
|
_data._basis = memnew( Basis( *p_variant._data._basis ) );
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case TRANSFORM: {
|
case TRANSFORM: {
|
||||||
|
@ -1068,37 +1068,37 @@ void Variant::reference(const Variant& p_variant) {
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
// arrays
|
// 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) ) );
|
memnew_placement( _data._mem, PoolVector<uint8_t> ( *reinterpret_cast<const PoolVector<uint8_t>*>(p_variant._data._mem) ) );
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case INT_ARRAY: {
|
case POOL_INT_ARRAY: {
|
||||||
|
|
||||||
memnew_placement( _data._mem, PoolVector<int> ( *reinterpret_cast<const PoolVector<int>*>(p_variant._data._mem) ) );
|
memnew_placement( _data._mem, PoolVector<int> ( *reinterpret_cast<const PoolVector<int>*>(p_variant._data._mem) ) );
|
||||||
|
|
||||||
} break;
|
} 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) ) );
|
memnew_placement( _data._mem, PoolVector<real_t> ( *reinterpret_cast<const PoolVector<real_t>*>(p_variant._data._mem) ) );
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case STRING_ARRAY: {
|
case POOL_STRING_ARRAY: {
|
||||||
|
|
||||||
memnew_placement( _data._mem, PoolVector<String> ( *reinterpret_cast<const PoolVector<String>*>(p_variant._data._mem) ) );
|
memnew_placement( _data._mem, PoolVector<String> ( *reinterpret_cast<const PoolVector<String>*>(p_variant._data._mem) ) );
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2_ARRAY: {
|
case POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
memnew_placement( _data._mem, PoolVector<Vector2> ( *reinterpret_cast<const PoolVector<Vector2>*>(p_variant._data._mem) ) );
|
memnew_placement( _data._mem, PoolVector<Vector2> ( *reinterpret_cast<const PoolVector<Vector2>*>(p_variant._data._mem) ) );
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3_ARRAY: {
|
case POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
memnew_placement( _data._mem, PoolVector<Vector3> ( *reinterpret_cast<const PoolVector<Vector3>*>(p_variant._data._mem) ) );
|
memnew_placement( _data._mem, PoolVector<Vector3> ( *reinterpret_cast<const PoolVector<Vector3>*>(p_variant._data._mem) ) );
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case COLOR_ARRAY: {
|
case POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
memnew_placement( _data._mem, PoolVector<Color> ( *reinterpret_cast<const PoolVector<Color>*>(p_variant._data._mem) ) );
|
memnew_placement( _data._mem, PoolVector<Color> ( *reinterpret_cast<const PoolVector<Color>*>(p_variant._data._mem) ) );
|
||||||
|
|
||||||
|
@ -1139,19 +1139,19 @@ void Variant::clear() {
|
||||||
VECTOR2,
|
VECTOR2,
|
||||||
RECT2
|
RECT2
|
||||||
*/
|
*/
|
||||||
case MATRIX32: {
|
case TRANSFORM2D: {
|
||||||
|
|
||||||
memdelete( _data._matrix32 );
|
memdelete( _data._transform2d );
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case _AABB: {
|
case RECT3: {
|
||||||
|
|
||||||
memdelete( _data._aabb );
|
memdelete( _data._rect3 );
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case MATRIX3: {
|
case BASIS: {
|
||||||
|
|
||||||
memdelete( _data._matrix3 );
|
memdelete( _data._basis );
|
||||||
} break;
|
} break;
|
||||||
case TRANSFORM: {
|
case TRANSFORM: {
|
||||||
|
|
||||||
|
@ -1196,37 +1196,37 @@ void Variant::clear() {
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
// arrays
|
// arrays
|
||||||
case RAW_ARRAY: {
|
case POOL_BYTE_ARRAY: {
|
||||||
|
|
||||||
reinterpret_cast< PoolVector<uint8_t>* >(_data._mem)->~PoolVector<uint8_t>();
|
reinterpret_cast< PoolVector<uint8_t>* >(_data._mem)->~PoolVector<uint8_t>();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case INT_ARRAY: {
|
case POOL_INT_ARRAY: {
|
||||||
|
|
||||||
reinterpret_cast< PoolVector<int>* >(_data._mem)->~PoolVector<int>();
|
reinterpret_cast< PoolVector<int>* >(_data._mem)->~PoolVector<int>();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case REAL_ARRAY: {
|
case POOL_REAL_ARRAY: {
|
||||||
|
|
||||||
reinterpret_cast< PoolVector<real_t>* >(_data._mem)->~PoolVector<real_t>();
|
reinterpret_cast< PoolVector<real_t>* >(_data._mem)->~PoolVector<real_t>();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case STRING_ARRAY: {
|
case POOL_STRING_ARRAY: {
|
||||||
|
|
||||||
reinterpret_cast< PoolVector<String>* >(_data._mem)->~PoolVector<String>();
|
reinterpret_cast< PoolVector<String>* >(_data._mem)->~PoolVector<String>();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2_ARRAY: {
|
case POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
reinterpret_cast< PoolVector<Vector2>* >(_data._mem)->~PoolVector<Vector2>();
|
reinterpret_cast< PoolVector<Vector2>* >(_data._mem)->~PoolVector<Vector2>();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3_ARRAY: {
|
case POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
reinterpret_cast< PoolVector<Vector3>* >(_data._mem)->~PoolVector<Vector3>();
|
reinterpret_cast< PoolVector<Vector3>* >(_data._mem)->~PoolVector<Vector3>();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case COLOR_ARRAY: {
|
case POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
reinterpret_cast< PoolVector<Color>* >(_data._mem)->~PoolVector<Color>();
|
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 STRING: return *reinterpret_cast<const String*>(_data._mem);
|
||||||
case VECTOR2: return "("+operator Vector2()+")";
|
case VECTOR2: return "("+operator Vector2()+")";
|
||||||
case RECT2: return "("+operator Rect2()+")";
|
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()+")";
|
return "("+Variant(mat32.elements[0]).operator String()+", "+Variant(mat32.elements[1]).operator String()+", "+Variant(mat32.elements[2]).operator String()+")";
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3: return "("+operator Vector3()+")";
|
case VECTOR3: return "("+operator Vector3()+")";
|
||||||
case PLANE: return operator Plane();
|
case PLANE: return operator Plane();
|
||||||
//case QUAT:
|
//case QUAT:
|
||||||
case _AABB: return operator AABB();
|
case RECT3: return operator Rect3();
|
||||||
case QUAT: return "("+operator Quat()+")";
|
case QUAT: return "("+operator Quat()+")";
|
||||||
case MATRIX3: {
|
case BASIS: {
|
||||||
|
|
||||||
Matrix3 mat3 = operator Matrix3();
|
Basis mat3 = operator Basis();
|
||||||
|
|
||||||
String mtx("(");
|
String mtx("(");
|
||||||
for (int i=0;i<3;i++) {
|
for (int i=0;i<3;i++) {
|
||||||
|
@ -1576,7 +1576,7 @@ Variant::operator String() const {
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2_ARRAY: {
|
case POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
PoolVector<Vector2> vec = operator PoolVector<Vector2>();
|
PoolVector<Vector2> vec = operator PoolVector<Vector2>();
|
||||||
String str("[");
|
String str("[");
|
||||||
|
@ -1589,7 +1589,7 @@ Variant::operator String() const {
|
||||||
str += "]";
|
str += "]";
|
||||||
return str;
|
return str;
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3_ARRAY: {
|
case POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
PoolVector<Vector3> vec = operator PoolVector<Vector3>();
|
PoolVector<Vector3> vec = operator PoolVector<Vector3>();
|
||||||
String str("[");
|
String str("[");
|
||||||
|
@ -1602,7 +1602,7 @@ Variant::operator String() const {
|
||||||
str += "]";
|
str += "]";
|
||||||
return str;
|
return str;
|
||||||
} break;
|
} break;
|
||||||
case STRING_ARRAY: {
|
case POOL_STRING_ARRAY: {
|
||||||
|
|
||||||
PoolVector<String> vec = operator PoolVector<String>();
|
PoolVector<String> vec = operator PoolVector<String>();
|
||||||
String str("[");
|
String str("[");
|
||||||
|
@ -1615,7 +1615,7 @@ Variant::operator String() const {
|
||||||
str += "]";
|
str += "]";
|
||||||
return str;
|
return str;
|
||||||
} break;
|
} break;
|
||||||
case INT_ARRAY: {
|
case POOL_INT_ARRAY: {
|
||||||
|
|
||||||
PoolVector<int> vec = operator PoolVector<int>();
|
PoolVector<int> vec = operator PoolVector<int>();
|
||||||
String str("[");
|
String str("[");
|
||||||
|
@ -1628,7 +1628,7 @@ Variant::operator String() const {
|
||||||
str += "]";
|
str += "]";
|
||||||
return str;
|
return str;
|
||||||
} break;
|
} break;
|
||||||
case REAL_ARRAY: {
|
case POOL_REAL_ARRAY: {
|
||||||
|
|
||||||
PoolVector<real_t> vec = operator PoolVector<real_t>();
|
PoolVector<real_t> vec = operator PoolVector<real_t>();
|
||||||
String str("[");
|
String str("[");
|
||||||
|
@ -1713,32 +1713,32 @@ Variant::operator Plane() const {
|
||||||
return Plane();
|
return Plane();
|
||||||
|
|
||||||
}
|
}
|
||||||
Variant::operator AABB() const {
|
Variant::operator Rect3() const {
|
||||||
|
|
||||||
if (type==_AABB)
|
if (type==RECT3)
|
||||||
return *_data._aabb;
|
return *_data._rect3;
|
||||||
else
|
else
|
||||||
return AABB();
|
return Rect3();
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant::operator Matrix3() const {
|
Variant::operator Basis() const {
|
||||||
|
|
||||||
if (type==MATRIX3)
|
if (type==BASIS)
|
||||||
return *_data._matrix3;
|
return *_data._basis;
|
||||||
else if (type==QUAT)
|
else if (type==QUAT)
|
||||||
return *reinterpret_cast<const Quat*>(_data._mem);
|
return *reinterpret_cast<const Quat*>(_data._mem);
|
||||||
else if (type==TRANSFORM)
|
else if (type==TRANSFORM)
|
||||||
return _data._transform->basis;
|
return _data._transform->basis;
|
||||||
else
|
else
|
||||||
return Matrix3();
|
return Basis();
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant::operator Quat() const {
|
Variant::operator Quat() const {
|
||||||
|
|
||||||
if (type==QUAT)
|
if (type==QUAT)
|
||||||
return *reinterpret_cast<const Quat*>(_data._mem);
|
return *reinterpret_cast<const Quat*>(_data._mem);
|
||||||
else if (type==MATRIX3)
|
else if (type==BASIS)
|
||||||
return *_data._matrix3;
|
return *_data._basis;
|
||||||
else if (type==TRANSFORM)
|
else if (type==TRANSFORM)
|
||||||
return _data._transform->basis;
|
return _data._transform->basis;
|
||||||
else
|
else
|
||||||
|
@ -1751,21 +1751,21 @@ Variant::operator Transform() const {
|
||||||
|
|
||||||
if (type==TRANSFORM)
|
if (type==TRANSFORM)
|
||||||
return *_data._transform;
|
return *_data._transform;
|
||||||
else if (type==MATRIX3)
|
else if (type==BASIS)
|
||||||
return Transform(*_data._matrix3,Vector3());
|
return Transform(*_data._basis,Vector3());
|
||||||
else if (type==QUAT)
|
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
|
else
|
||||||
return Transform();
|
return Transform();
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant::operator Matrix32() const {
|
Variant::operator Transform2D() const {
|
||||||
|
|
||||||
if (type==MATRIX32) {
|
if (type==TRANSFORM2D) {
|
||||||
return *_data._matrix32;
|
return *_data._transform2d;
|
||||||
} else if (type==TRANSFORM) {
|
} else if (type==TRANSFORM) {
|
||||||
const Transform& t = *_data._transform;;
|
const Transform& t = *_data._transform;;
|
||||||
Matrix32 m;
|
Transform2D m;
|
||||||
m.elements[0][0]=t.basis.elements[0][0];
|
m.elements[0][0]=t.basis.elements[0][0];
|
||||||
m.elements[0][1]=t.basis.elements[1][0];
|
m.elements[0][1]=t.basis.elements[1][0];
|
||||||
m.elements[1][0]=t.basis.elements[0][1];
|
m.elements[1][0]=t.basis.elements[0][1];
|
||||||
|
@ -1774,7 +1774,7 @@ Variant::operator Transform() const {
|
||||||
m.elements[2][1]=t.origin[1];
|
m.elements[2][1]=t.origin[1];
|
||||||
return m;
|
return m;
|
||||||
} else
|
} 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::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::POOL_BYTE_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::POOL_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::POOL_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::POOL_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::POOL_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::POOL_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_COLOR_ARRAY: { return _convert_array<DA,PoolVector<Color> >( p_variant.operator PoolVector<Color>() ); }
|
||||||
default: { return DA(); }
|
default: { return DA(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1916,14 +1916,14 @@ Variant::operator Array() const {
|
||||||
|
|
||||||
Variant::operator PoolVector<uint8_t>() 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);
|
return *reinterpret_cast<const PoolVector<uint8_t>* >(_data._mem);
|
||||||
else
|
else
|
||||||
return _convert_array_from_variant<PoolVector<uint8_t> >(*this);
|
return _convert_array_from_variant<PoolVector<uint8_t> >(*this);
|
||||||
}
|
}
|
||||||
Variant::operator PoolVector<int>() const {
|
Variant::operator PoolVector<int>() const {
|
||||||
|
|
||||||
if (type==INT_ARRAY)
|
if (type==POOL_INT_ARRAY)
|
||||||
return *reinterpret_cast<const PoolVector<int>* >(_data._mem);
|
return *reinterpret_cast<const PoolVector<int>* >(_data._mem);
|
||||||
else
|
else
|
||||||
return _convert_array_from_variant<PoolVector<int> >(*this);
|
return _convert_array_from_variant<PoolVector<int> >(*this);
|
||||||
|
@ -1931,7 +1931,7 @@ Variant::operator PoolVector<int>() const {
|
||||||
}
|
}
|
||||||
Variant::operator PoolVector<real_t>() 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);
|
return *reinterpret_cast<const PoolVector<real_t>* >(_data._mem);
|
||||||
else
|
else
|
||||||
return _convert_array_from_variant<PoolVector<real_t> >(*this);
|
return _convert_array_from_variant<PoolVector<real_t> >(*this);
|
||||||
|
@ -1940,7 +1940,7 @@ Variant::operator PoolVector<real_t>() const {
|
||||||
|
|
||||||
Variant::operator PoolVector<String>() const {
|
Variant::operator PoolVector<String>() const {
|
||||||
|
|
||||||
if (type==STRING_ARRAY)
|
if (type==POOL_STRING_ARRAY)
|
||||||
return *reinterpret_cast<const PoolVector<String>* >(_data._mem);
|
return *reinterpret_cast<const PoolVector<String>* >(_data._mem);
|
||||||
else
|
else
|
||||||
return _convert_array_from_variant<PoolVector<String> >(*this);
|
return _convert_array_from_variant<PoolVector<String> >(*this);
|
||||||
|
@ -1949,7 +1949,7 @@ Variant::operator PoolVector<String>() const {
|
||||||
}
|
}
|
||||||
Variant::operator PoolVector<Vector3>() const {
|
Variant::operator PoolVector<Vector3>() const {
|
||||||
|
|
||||||
if (type==VECTOR3_ARRAY)
|
if (type==POOL_VECTOR3_ARRAY)
|
||||||
return *reinterpret_cast<const PoolVector<Vector3>* >(_data._mem);
|
return *reinterpret_cast<const PoolVector<Vector3>* >(_data._mem);
|
||||||
else
|
else
|
||||||
return _convert_array_from_variant<PoolVector<Vector3> >(*this);
|
return _convert_array_from_variant<PoolVector<Vector3> >(*this);
|
||||||
|
@ -1958,7 +1958,7 @@ Variant::operator PoolVector<Vector3>() const {
|
||||||
}
|
}
|
||||||
Variant::operator PoolVector<Vector2>() const {
|
Variant::operator PoolVector<Vector2>() const {
|
||||||
|
|
||||||
if (type==VECTOR2_ARRAY)
|
if (type==POOL_VECTOR2_ARRAY)
|
||||||
return *reinterpret_cast<const PoolVector<Vector2>* >(_data._mem);
|
return *reinterpret_cast<const PoolVector<Vector2>* >(_data._mem);
|
||||||
else
|
else
|
||||||
return _convert_array_from_variant<PoolVector<Vector2> >(*this);
|
return _convert_array_from_variant<PoolVector<Vector2> >(*this);
|
||||||
|
@ -1968,7 +1968,7 @@ Variant::operator PoolVector<Vector2>() const {
|
||||||
|
|
||||||
Variant::operator PoolVector<Color>() const {
|
Variant::operator PoolVector<Color>() const {
|
||||||
|
|
||||||
if (type==COLOR_ARRAY)
|
if (type==POOL_COLOR_ARRAY)
|
||||||
return *reinterpret_cast<const PoolVector<Color>* >(_data._mem);
|
return *reinterpret_cast<const PoolVector<Color>* >(_data._mem);
|
||||||
else
|
else
|
||||||
return _convert_array_from_variant<PoolVector<Color> >(*this);
|
return _convert_array_from_variant<PoolVector<Color> >(*this);
|
||||||
|
@ -2165,7 +2165,7 @@ Variant::operator Orientation() const {
|
||||||
|
|
||||||
Variant::operator IP_Address() 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>();
|
PoolVector<int> addr=operator PoolVector<int>();
|
||||||
if (addr.size()==4) {
|
if (addr.size()==4) {
|
||||||
|
@ -2320,16 +2320,16 @@ Variant::Variant(const Plane& p_plane) {
|
||||||
memnew_placement( _data._mem, Plane( p_plane ) );
|
memnew_placement( _data._mem, Plane( p_plane ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
Variant::Variant(const AABB& p_aabb) {
|
Variant::Variant(const Rect3& p_aabb) {
|
||||||
|
|
||||||
type=_AABB;
|
type=RECT3;
|
||||||
_data._aabb = memnew( AABB( p_aabb ) );
|
_data._rect3 = memnew( Rect3( p_aabb ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant::Variant(const Matrix3& p_matrix) {
|
Variant::Variant(const Basis& p_matrix) {
|
||||||
|
|
||||||
type=MATRIX3;
|
type=BASIS;
|
||||||
_data._matrix3= memnew( Matrix3( p_matrix ) );
|
_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;
|
type=TRANSFORM2D;
|
||||||
_data._matrix32 = memnew( Matrix32( p_transform ) );
|
_data._transform2d = memnew( Transform2D( p_transform ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
Variant::Variant(const Color& p_color) {
|
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) {
|
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) );
|
memnew_placement( _data._mem, PoolVector<uint8_t>(p_raw_array) );
|
||||||
|
|
||||||
}
|
}
|
||||||
Variant::Variant(const PoolVector<int>& p_int_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) );
|
memnew_placement( _data._mem, PoolVector<int>(p_int_array) );
|
||||||
|
|
||||||
}
|
}
|
||||||
Variant::Variant(const PoolVector<real_t>& p_real_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) );
|
memnew_placement( _data._mem, PoolVector<real_t>(p_real_array) );
|
||||||
|
|
||||||
}
|
}
|
||||||
Variant::Variant(const PoolVector<String>& p_string_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) );
|
memnew_placement( _data._mem, PoolVector<String>(p_string_array) );
|
||||||
|
|
||||||
}
|
}
|
||||||
Variant::Variant(const PoolVector<Vector3>& p_vector3_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) );
|
memnew_placement( _data._mem, PoolVector<Vector3>(p_vector3_array) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant::Variant(const PoolVector<Vector2>& p_vector2_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) );
|
memnew_placement( _data._mem, PoolVector<Vector2>(p_vector2_array) );
|
||||||
|
|
||||||
}
|
}
|
||||||
Variant::Variant(const PoolVector<Color>& p_color_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) );
|
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);
|
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);
|
return hash_djb2_one_float(reinterpret_cast<const Rect2*>(_data._mem)->size.y,hash);
|
||||||
} break;
|
} break;
|
||||||
case MATRIX32: {
|
case TRANSFORM2D: {
|
||||||
|
|
||||||
uint32_t hash = 5831;
|
uint32_t hash = 5831;
|
||||||
for(int i=0;i<3;i++) {
|
for(int i=0;i<3;i++) {
|
||||||
|
|
||||||
for(int j=0;j<2;j++) {
|
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;*/
|
} break;*/
|
||||||
case _AABB: {
|
case RECT3: {
|
||||||
|
|
||||||
uint32_t hash = 5831;
|
uint32_t hash = 5831;
|
||||||
for(int i=0;i<3;i++) {
|
for(int i=0;i<3;i++) {
|
||||||
|
|
||||||
hash = hash_djb2_one_float(_data._aabb->pos[i],hash);
|
hash = hash_djb2_one_float(_data._rect3->pos[i],hash);
|
||||||
hash = hash_djb2_one_float(_data._aabb->size[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);
|
return hash_djb2_one_float(reinterpret_cast<const Quat*>(_data._mem)->w,hash);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case MATRIX3: {
|
case BASIS: {
|
||||||
|
|
||||||
uint32_t hash = 5831;
|
uint32_t hash = 5831;
|
||||||
for(int i=0;i<3;i++) {
|
for(int i=0;i<3;i++) {
|
||||||
|
|
||||||
for(int j=0;j<3;j++) {
|
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();
|
return arr.hash();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case RAW_ARRAY: {
|
case POOL_BYTE_ARRAY: {
|
||||||
|
|
||||||
const PoolVector<uint8_t>& arr = *reinterpret_cast<const PoolVector<uint8_t>* >(_data._mem);
|
const PoolVector<uint8_t>& arr = *reinterpret_cast<const PoolVector<uint8_t>* >(_data._mem);
|
||||||
int len = arr.size();
|
int len = arr.size();
|
||||||
|
@ -2833,7 +2833,7 @@ uint32_t Variant::hash() const {
|
||||||
return hash_djb2_buffer((uint8_t*)&r[0],len);
|
return hash_djb2_buffer((uint8_t*)&r[0],len);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case INT_ARRAY: {
|
case POOL_INT_ARRAY: {
|
||||||
|
|
||||||
const PoolVector<int>& arr = *reinterpret_cast<const PoolVector<int>* >(_data._mem);
|
const PoolVector<int>& arr = *reinterpret_cast<const PoolVector<int>* >(_data._mem);
|
||||||
int len = arr.size();
|
int len = arr.size();
|
||||||
|
@ -2842,7 +2842,7 @@ uint32_t Variant::hash() const {
|
||||||
return hash_djb2_buffer((uint8_t*)&r[0],len*sizeof(int));
|
return hash_djb2_buffer((uint8_t*)&r[0],len*sizeof(int));
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case REAL_ARRAY: {
|
case POOL_REAL_ARRAY: {
|
||||||
|
|
||||||
const PoolVector<real_t>& arr = *reinterpret_cast<const PoolVector<real_t>* >(_data._mem);
|
const PoolVector<real_t>& arr = *reinterpret_cast<const PoolVector<real_t>* >(_data._mem);
|
||||||
int len = arr.size();
|
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));
|
return hash_djb2_buffer((uint8_t*)&r[0],len*sizeof(real_t));
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case STRING_ARRAY: {
|
case POOL_STRING_ARRAY: {
|
||||||
|
|
||||||
uint32_t hash=5831;
|
uint32_t hash=5831;
|
||||||
const PoolVector<String>& arr = *reinterpret_cast<const PoolVector<String>* >(_data._mem);
|
const PoolVector<String>& arr = *reinterpret_cast<const PoolVector<String>* >(_data._mem);
|
||||||
|
@ -2864,7 +2864,7 @@ uint32_t Variant::hash() const {
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2_ARRAY: {
|
case POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
uint32_t hash=5831;
|
uint32_t hash=5831;
|
||||||
const PoolVector<Vector2>& arr = *reinterpret_cast<const PoolVector<Vector2>* >(_data._mem);
|
const PoolVector<Vector2>& arr = *reinterpret_cast<const PoolVector<Vector2>* >(_data._mem);
|
||||||
|
@ -2879,7 +2879,7 @@ uint32_t Variant::hash() const {
|
||||||
return hash;
|
return hash;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3_ARRAY: {
|
case POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
uint32_t hash=5831;
|
uint32_t hash=5831;
|
||||||
const PoolVector<Vector3>& arr = *reinterpret_cast<const PoolVector<Vector3>* >(_data._mem);
|
const PoolVector<Vector3>& arr = *reinterpret_cast<const PoolVector<Vector3>* >(_data._mem);
|
||||||
|
@ -2895,7 +2895,7 @@ uint32_t Variant::hash() const {
|
||||||
return hash;
|
return hash;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case COLOR_ARRAY: {
|
case POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
uint32_t hash=5831;
|
uint32_t hash=5831;
|
||||||
const PoolVector<Color>& arr = *reinterpret_cast<const PoolVector<Color>* >(_data._mem);
|
const PoolVector<Color>& arr = *reinterpret_cast<const PoolVector<Color>* >(_data._mem);
|
||||||
|
|
|
@ -63,13 +63,13 @@ struct PropertyInfo;
|
||||||
struct MethodInfo;
|
struct MethodInfo;
|
||||||
|
|
||||||
|
|
||||||
typedef PoolVector<uint8_t> ByteArray;
|
typedef PoolVector<uint8_t> PoolByteArray;
|
||||||
typedef PoolVector<int> IntArray;
|
typedef PoolVector<int> PoolIntArray;
|
||||||
typedef PoolVector<real_t> RealArray;
|
typedef PoolVector<real_t> PoolRealArray;
|
||||||
typedef PoolVector<String> StringArray;
|
typedef PoolVector<String> PoolStringArray;
|
||||||
typedef PoolVector<Vector2> Vector2Array;
|
typedef PoolVector<Vector2> PoolVector2Array;
|
||||||
typedef PoolVector<Vector3> Vector3Array;
|
typedef PoolVector<Vector3> PoolVector3Array;
|
||||||
typedef PoolVector<Color> ColorArray;
|
typedef PoolVector<Color> PoolColorArray;
|
||||||
|
|
||||||
class Variant {
|
class Variant {
|
||||||
public:
|
public:
|
||||||
|
@ -89,11 +89,11 @@ public:
|
||||||
VECTOR2, // 5
|
VECTOR2, // 5
|
||||||
RECT2,
|
RECT2,
|
||||||
VECTOR3,
|
VECTOR3,
|
||||||
MATRIX32,
|
TRANSFORM2D,
|
||||||
PLANE,
|
PLANE,
|
||||||
QUAT, // 10
|
QUAT, // 10
|
||||||
_AABB, //sorry naming convention fail :( not like it's used often
|
RECT3, //sorry naming convention fail :( not like it's used often
|
||||||
MATRIX3,
|
BASIS,
|
||||||
TRANSFORM,
|
TRANSFORM,
|
||||||
|
|
||||||
// misc types
|
// misc types
|
||||||
|
@ -107,13 +107,13 @@ public:
|
||||||
ARRAY,
|
ARRAY,
|
||||||
|
|
||||||
// arrays
|
// arrays
|
||||||
RAW_ARRAY,
|
POOL_BYTE_ARRAY,
|
||||||
INT_ARRAY,
|
POOL_INT_ARRAY,
|
||||||
REAL_ARRAY,
|
POOL_REAL_ARRAY,
|
||||||
STRING_ARRAY, // 25
|
POOL_STRING_ARRAY, // 25
|
||||||
VECTOR2_ARRAY,
|
POOL_VECTOR2_ARRAY,
|
||||||
VECTOR3_ARRAY,
|
POOL_VECTOR3_ARRAY,
|
||||||
COLOR_ARRAY,
|
POOL_COLOR_ARRAY,
|
||||||
|
|
||||||
VARIANT_MAX
|
VARIANT_MAX
|
||||||
|
|
||||||
|
@ -143,9 +143,9 @@ private:
|
||||||
bool _bool;
|
bool _bool;
|
||||||
int64_t _int;
|
int64_t _int;
|
||||||
double _real;
|
double _real;
|
||||||
Matrix32 *_matrix32;
|
Transform2D *_transform2d;
|
||||||
AABB* _aabb;
|
Rect3* _rect3;
|
||||||
Matrix3 *_matrix3;
|
Basis *_basis;
|
||||||
Transform *_transform;
|
Transform *_transform;
|
||||||
RefPtr *_resource;
|
RefPtr *_resource;
|
||||||
InputEvent *_input_event;
|
InputEvent *_input_event;
|
||||||
|
@ -208,11 +208,11 @@ public:
|
||||||
operator Rect2() const;
|
operator Rect2() const;
|
||||||
operator Vector3() const;
|
operator Vector3() const;
|
||||||
operator Plane() const;
|
operator Plane() const;
|
||||||
operator AABB() const;
|
operator Rect3() const;
|
||||||
operator Quat() const;
|
operator Quat() const;
|
||||||
operator Matrix3() const;
|
operator Basis() const;
|
||||||
operator Transform() const;
|
operator Transform() const;
|
||||||
operator Matrix32() const;
|
operator Transform2D() const;
|
||||||
|
|
||||||
operator Color() const;
|
operator Color() const;
|
||||||
operator Image() const;
|
operator Image() const;
|
||||||
|
@ -280,10 +280,10 @@ public:
|
||||||
Variant(const Rect2& p_rect2);
|
Variant(const Rect2& p_rect2);
|
||||||
Variant(const Vector3& p_vector3);
|
Variant(const Vector3& p_vector3);
|
||||||
Variant(const Plane& p_plane);
|
Variant(const Plane& p_plane);
|
||||||
Variant(const AABB& p_aabb);
|
Variant(const Rect3& p_aabb);
|
||||||
Variant(const Quat& p_quat);
|
Variant(const Quat& p_quat);
|
||||||
Variant(const Matrix3& p_transform);
|
Variant(const Basis& p_transform);
|
||||||
Variant(const Matrix32& p_transform);
|
Variant(const Transform2D& p_transform);
|
||||||
Variant(const Transform& p_transform);
|
Variant(const Transform& p_transform);
|
||||||
Variant(const Color& p_color);
|
Variant(const Color& p_color);
|
||||||
Variant(const Image& p_image);
|
Variant(const Image& p_image);
|
||||||
|
|
|
@ -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);
|
String *s = reinterpret_cast<String*>(p_self._data._mem);
|
||||||
CharString charstr = s->ascii();
|
CharString charstr = s->ascii();
|
||||||
|
|
||||||
ByteArray retval;
|
PoolByteArray retval;
|
||||||
size_t len = charstr.length();
|
size_t len = charstr.length();
|
||||||
retval.resize(len);
|
retval.resize(len);
|
||||||
ByteArray::Write w = retval.write();
|
PoolByteArray::Write w = retval.write();
|
||||||
copymem(w.ptr(), charstr.ptr(), len);
|
copymem(w.ptr(), charstr.ptr(), len);
|
||||||
w = PoolVector<uint8_t>::Write();
|
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);
|
String *s = reinterpret_cast<String*>(p_self._data._mem);
|
||||||
CharString charstr = s->utf8();
|
CharString charstr = s->utf8();
|
||||||
|
|
||||||
ByteArray retval;
|
PoolByteArray retval;
|
||||||
size_t len = charstr.length();
|
size_t len = charstr.length();
|
||||||
retval.resize(len);
|
retval.resize(len);
|
||||||
ByteArray::Write w = retval.write();
|
PoolByteArray::Write w = retval.write();
|
||||||
copymem(w.ptr(), charstr.ptr(), len);
|
copymem(w.ptr(), charstr.ptr(), len);
|
||||||
w = PoolVector<uint8_t>::Write();
|
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_LOCALMEM0(Array,invert);
|
||||||
VCALL_LOCALMEM0R(Array,is_shared);
|
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;
|
String s;
|
||||||
if (ba->size()>=0) {
|
if (ba->size()>=0) {
|
||||||
ByteArray::Read r = ba->read();
|
PoolByteArray::Read r = ba->read();
|
||||||
CharString cs;
|
CharString cs;
|
||||||
cs.resize(ba->size()+1);
|
cs.resize(ba->size()+1);
|
||||||
copymem(cs.ptr(),r.ptr(),ba->size());
|
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;
|
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;
|
String s;
|
||||||
if (ba->size()>=0) {
|
if (ba->size()>=0) {
|
||||||
ByteArray::Read r = ba->read();
|
PoolByteArray::Read r = ba->read();
|
||||||
s.parse_utf8((const char*)r.ptr(),ba->size());
|
s.parse_utf8((const char*)r.ptr(),ba->size());
|
||||||
}
|
}
|
||||||
r_ret=s;
|
r_ret=s;
|
||||||
}
|
}
|
||||||
|
|
||||||
VCALL_LOCALMEM0R(ByteArray,size);
|
VCALL_LOCALMEM0R(PoolByteArray,size);
|
||||||
VCALL_LOCALMEM2(ByteArray,set);
|
VCALL_LOCALMEM2(PoolByteArray,set);
|
||||||
VCALL_LOCALMEM1R(ByteArray,get);
|
VCALL_LOCALMEM1R(PoolByteArray,get);
|
||||||
VCALL_LOCALMEM1(ByteArray,push_back);
|
VCALL_LOCALMEM1(PoolByteArray,push_back);
|
||||||
VCALL_LOCALMEM1(ByteArray,resize);
|
VCALL_LOCALMEM1(PoolByteArray,resize);
|
||||||
VCALL_LOCALMEM2R(ByteArray,insert);
|
VCALL_LOCALMEM2R(PoolByteArray,insert);
|
||||||
VCALL_LOCALMEM1(ByteArray,remove);
|
VCALL_LOCALMEM1(PoolByteArray,remove);
|
||||||
VCALL_LOCALMEM1(ByteArray,append);
|
VCALL_LOCALMEM1(PoolByteArray,append);
|
||||||
VCALL_LOCALMEM1(ByteArray,append_array);
|
VCALL_LOCALMEM1(PoolByteArray,append_array);
|
||||||
VCALL_LOCALMEM0(ByteArray,invert);
|
VCALL_LOCALMEM0(PoolByteArray,invert);
|
||||||
VCALL_LOCALMEM2R(ByteArray,subarray);
|
VCALL_LOCALMEM2R(PoolByteArray,subarray);
|
||||||
|
|
||||||
VCALL_LOCALMEM0R(IntArray,size);
|
VCALL_LOCALMEM0R(PoolIntArray,size);
|
||||||
VCALL_LOCALMEM2(IntArray,set);
|
VCALL_LOCALMEM2(PoolIntArray,set);
|
||||||
VCALL_LOCALMEM1R(IntArray,get);
|
VCALL_LOCALMEM1R(PoolIntArray,get);
|
||||||
VCALL_LOCALMEM1(IntArray,push_back);
|
VCALL_LOCALMEM1(PoolIntArray,push_back);
|
||||||
VCALL_LOCALMEM1(IntArray,resize);
|
VCALL_LOCALMEM1(PoolIntArray,resize);
|
||||||
VCALL_LOCALMEM2R(IntArray,insert);
|
VCALL_LOCALMEM2R(PoolIntArray,insert);
|
||||||
VCALL_LOCALMEM1(IntArray,remove);
|
VCALL_LOCALMEM1(PoolIntArray,remove);
|
||||||
VCALL_LOCALMEM1(IntArray,append);
|
VCALL_LOCALMEM1(PoolIntArray,append);
|
||||||
VCALL_LOCALMEM1(IntArray,append_array);
|
VCALL_LOCALMEM1(PoolIntArray,append_array);
|
||||||
VCALL_LOCALMEM0(IntArray,invert);
|
VCALL_LOCALMEM0(PoolIntArray,invert);
|
||||||
|
|
||||||
VCALL_LOCALMEM0R(RealArray,size);
|
VCALL_LOCALMEM0R(PoolRealArray,size);
|
||||||
VCALL_LOCALMEM2(RealArray,set);
|
VCALL_LOCALMEM2(PoolRealArray,set);
|
||||||
VCALL_LOCALMEM1R(RealArray,get);
|
VCALL_LOCALMEM1R(PoolRealArray,get);
|
||||||
VCALL_LOCALMEM1(RealArray,push_back);
|
VCALL_LOCALMEM1(PoolRealArray,push_back);
|
||||||
VCALL_LOCALMEM1(RealArray,resize);
|
VCALL_LOCALMEM1(PoolRealArray,resize);
|
||||||
VCALL_LOCALMEM2R(RealArray,insert);
|
VCALL_LOCALMEM2R(PoolRealArray,insert);
|
||||||
VCALL_LOCALMEM1(RealArray,remove);
|
VCALL_LOCALMEM1(PoolRealArray,remove);
|
||||||
VCALL_LOCALMEM1(RealArray,append);
|
VCALL_LOCALMEM1(PoolRealArray,append);
|
||||||
VCALL_LOCALMEM1(RealArray,append_array);
|
VCALL_LOCALMEM1(PoolRealArray,append_array);
|
||||||
VCALL_LOCALMEM0(RealArray,invert);
|
VCALL_LOCALMEM0(PoolRealArray,invert);
|
||||||
|
|
||||||
VCALL_LOCALMEM0R(StringArray,size);
|
VCALL_LOCALMEM0R(PoolStringArray,size);
|
||||||
VCALL_LOCALMEM2(StringArray,set);
|
VCALL_LOCALMEM2(PoolStringArray,set);
|
||||||
VCALL_LOCALMEM1R(StringArray,get);
|
VCALL_LOCALMEM1R(PoolStringArray,get);
|
||||||
VCALL_LOCALMEM1(StringArray,push_back);
|
VCALL_LOCALMEM1(PoolStringArray,push_back);
|
||||||
VCALL_LOCALMEM1(StringArray,resize);
|
VCALL_LOCALMEM1(PoolStringArray,resize);
|
||||||
VCALL_LOCALMEM2R(StringArray,insert);
|
VCALL_LOCALMEM2R(PoolStringArray,insert);
|
||||||
VCALL_LOCALMEM1(StringArray,remove);
|
VCALL_LOCALMEM1(PoolStringArray,remove);
|
||||||
VCALL_LOCALMEM1(StringArray,append);
|
VCALL_LOCALMEM1(PoolStringArray,append);
|
||||||
VCALL_LOCALMEM1(StringArray,append_array);
|
VCALL_LOCALMEM1(PoolStringArray,append_array);
|
||||||
VCALL_LOCALMEM0(StringArray,invert);
|
VCALL_LOCALMEM0(PoolStringArray,invert);
|
||||||
|
|
||||||
VCALL_LOCALMEM0R(Vector2Array,size);
|
VCALL_LOCALMEM0R(PoolVector2Array,size);
|
||||||
VCALL_LOCALMEM2(Vector2Array,set);
|
VCALL_LOCALMEM2(PoolVector2Array,set);
|
||||||
VCALL_LOCALMEM1R(Vector2Array,get);
|
VCALL_LOCALMEM1R(PoolVector2Array,get);
|
||||||
VCALL_LOCALMEM1(Vector2Array,push_back);
|
VCALL_LOCALMEM1(PoolVector2Array,push_back);
|
||||||
VCALL_LOCALMEM1(Vector2Array,resize);
|
VCALL_LOCALMEM1(PoolVector2Array,resize);
|
||||||
VCALL_LOCALMEM2R(Vector2Array,insert);
|
VCALL_LOCALMEM2R(PoolVector2Array,insert);
|
||||||
VCALL_LOCALMEM1(Vector2Array,remove);
|
VCALL_LOCALMEM1(PoolVector2Array,remove);
|
||||||
VCALL_LOCALMEM1(Vector2Array,append);
|
VCALL_LOCALMEM1(PoolVector2Array,append);
|
||||||
VCALL_LOCALMEM1(Vector2Array,append_array);
|
VCALL_LOCALMEM1(PoolVector2Array,append_array);
|
||||||
VCALL_LOCALMEM0(Vector2Array,invert);
|
VCALL_LOCALMEM0(PoolVector2Array,invert);
|
||||||
|
|
||||||
VCALL_LOCALMEM0R(Vector3Array,size);
|
VCALL_LOCALMEM0R(PoolVector3Array,size);
|
||||||
VCALL_LOCALMEM2(Vector3Array,set);
|
VCALL_LOCALMEM2(PoolVector3Array,set);
|
||||||
VCALL_LOCALMEM1R(Vector3Array,get);
|
VCALL_LOCALMEM1R(PoolVector3Array,get);
|
||||||
VCALL_LOCALMEM1(Vector3Array,push_back);
|
VCALL_LOCALMEM1(PoolVector3Array,push_back);
|
||||||
VCALL_LOCALMEM1(Vector3Array,resize);
|
VCALL_LOCALMEM1(PoolVector3Array,resize);
|
||||||
VCALL_LOCALMEM2R(Vector3Array,insert);
|
VCALL_LOCALMEM2R(PoolVector3Array,insert);
|
||||||
VCALL_LOCALMEM1(Vector3Array,remove);
|
VCALL_LOCALMEM1(PoolVector3Array,remove);
|
||||||
VCALL_LOCALMEM1(Vector3Array,append);
|
VCALL_LOCALMEM1(PoolVector3Array,append);
|
||||||
VCALL_LOCALMEM1(Vector3Array,append_array);
|
VCALL_LOCALMEM1(PoolVector3Array,append_array);
|
||||||
VCALL_LOCALMEM0(Vector3Array,invert);
|
VCALL_LOCALMEM0(PoolVector3Array,invert);
|
||||||
|
|
||||||
VCALL_LOCALMEM0R(ColorArray,size);
|
VCALL_LOCALMEM0R(PoolColorArray,size);
|
||||||
VCALL_LOCALMEM2(ColorArray,set);
|
VCALL_LOCALMEM2(PoolColorArray,set);
|
||||||
VCALL_LOCALMEM1R(ColorArray,get);
|
VCALL_LOCALMEM1R(PoolColorArray,get);
|
||||||
VCALL_LOCALMEM1(ColorArray,push_back);
|
VCALL_LOCALMEM1(PoolColorArray,push_back);
|
||||||
VCALL_LOCALMEM1(ColorArray,resize);
|
VCALL_LOCALMEM1(PoolColorArray,resize);
|
||||||
VCALL_LOCALMEM2R(ColorArray,insert);
|
VCALL_LOCALMEM2R(PoolColorArray,insert);
|
||||||
VCALL_LOCALMEM1(ColorArray,remove);
|
VCALL_LOCALMEM1(PoolColorArray,remove);
|
||||||
VCALL_LOCALMEM1(ColorArray,append);
|
VCALL_LOCALMEM1(PoolColorArray,append);
|
||||||
VCALL_LOCALMEM1(ColorArray,append_array);
|
VCALL_LOCALMEM1(PoolColorArray,append_array);
|
||||||
VCALL_LOCALMEM0(ColorArray,invert);
|
VCALL_LOCALMEM0(PoolColorArray,invert);
|
||||||
|
|
||||||
#define VCALL_PTR0(m_type,m_method)\
|
#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(); }
|
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_PTR1R(Image, converted);
|
||||||
VCALL_PTR0(Image, fix_alpha_edges);
|
VCALL_PTR0(Image, fix_alpha_edges);
|
||||||
|
|
||||||
VCALL_PTR0R( AABB, get_area );
|
VCALL_PTR0R( Rect3, get_area );
|
||||||
VCALL_PTR0R( AABB, has_no_area );
|
VCALL_PTR0R( Rect3, has_no_area );
|
||||||
VCALL_PTR0R( AABB, has_no_surface );
|
VCALL_PTR0R( Rect3, has_no_surface );
|
||||||
VCALL_PTR1R( AABB, intersects );
|
VCALL_PTR1R( Rect3, intersects );
|
||||||
VCALL_PTR1R( AABB, encloses );
|
VCALL_PTR1R( Rect3, encloses );
|
||||||
VCALL_PTR1R( AABB, merge );
|
VCALL_PTR1R( Rect3, merge );
|
||||||
VCALL_PTR1R( AABB, intersection );
|
VCALL_PTR1R( Rect3, intersection );
|
||||||
VCALL_PTR1R( AABB, intersects_plane );
|
VCALL_PTR1R( Rect3, intersects_plane );
|
||||||
VCALL_PTR2R( AABB, intersects_segment );
|
VCALL_PTR2R( Rect3, intersects_segment );
|
||||||
VCALL_PTR1R( AABB, has_point );
|
VCALL_PTR1R( Rect3, has_point );
|
||||||
VCALL_PTR1R( AABB, get_support );
|
VCALL_PTR1R( Rect3, get_support );
|
||||||
VCALL_PTR0R( AABB, get_longest_axis );
|
VCALL_PTR0R( Rect3, get_longest_axis );
|
||||||
VCALL_PTR0R( AABB, get_longest_axis_index );
|
VCALL_PTR0R( Rect3, get_longest_axis_index );
|
||||||
VCALL_PTR0R( AABB, get_longest_axis_size );
|
VCALL_PTR0R( Rect3, get_longest_axis_size );
|
||||||
VCALL_PTR0R( AABB, get_shortest_axis );
|
VCALL_PTR0R( Rect3, get_shortest_axis );
|
||||||
VCALL_PTR0R( AABB, get_shortest_axis_index );
|
VCALL_PTR0R( Rect3, get_shortest_axis_index );
|
||||||
VCALL_PTR0R( AABB, get_shortest_axis_size );
|
VCALL_PTR0R( Rect3, get_shortest_axis_size );
|
||||||
VCALL_PTR1R( AABB, expand );
|
VCALL_PTR1R( Rect3, expand );
|
||||||
VCALL_PTR1R( AABB, grow );
|
VCALL_PTR1R( Rect3, grow );
|
||||||
VCALL_PTR1R( AABB, get_endpoint );
|
VCALL_PTR1R( Rect3, get_endpoint );
|
||||||
|
|
||||||
VCALL_PTR0R( Matrix32, inverse );
|
VCALL_PTR0R( Transform2D, inverse );
|
||||||
VCALL_PTR0R( Matrix32, affine_inverse );
|
VCALL_PTR0R( Transform2D, affine_inverse );
|
||||||
VCALL_PTR0R( Matrix32, get_rotation );
|
VCALL_PTR0R( Transform2D, get_rotation );
|
||||||
VCALL_PTR0R( Matrix32, get_origin );
|
VCALL_PTR0R( Transform2D, get_origin );
|
||||||
VCALL_PTR0R( Matrix32, get_scale );
|
VCALL_PTR0R( Transform2D, get_scale );
|
||||||
VCALL_PTR0R( Matrix32, orthonormalized );
|
VCALL_PTR0R( Transform2D, orthonormalized );
|
||||||
VCALL_PTR1R( Matrix32, rotated );
|
VCALL_PTR1R( Transform2D, rotated );
|
||||||
VCALL_PTR1R( Matrix32, scaled );
|
VCALL_PTR1R( Transform2D, scaled );
|
||||||
VCALL_PTR1R( Matrix32, translated );
|
VCALL_PTR1R( Transform2D, translated );
|
||||||
VCALL_PTR2R( Matrix32, interpolate_with );
|
VCALL_PTR2R( Transform2D, interpolate_with );
|
||||||
|
|
||||||
static void _call_Matrix32_xform(Variant& r_ret,Variant& p_self,const Variant** p_args) {
|
static void _call_Transform2D_xform(Variant& r_ret,Variant& p_self,const Variant** p_args) {
|
||||||
|
|
||||||
switch(p_args[0]->type) {
|
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::VECTOR2: r_ret=reinterpret_cast<Transform2D*>(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::RECT2: r_ret=reinterpret_cast<Transform2D*>(p_self._data._ptr)->xform( p_args[0]->operator Rect2()); return;
|
||||||
default: r_ret=Variant();
|
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) {
|
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::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<Matrix32*>(p_self._data._ptr)->xform_inv( p_args[0]->operator Rect2()); 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();
|
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) {
|
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();
|
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) {
|
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();
|
default: r_ret=Variant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VCALL_PTR0R( Matrix3, inverse );
|
VCALL_PTR0R( Basis, inverse );
|
||||||
VCALL_PTR0R( Matrix3, transposed );
|
VCALL_PTR0R( Basis, transposed );
|
||||||
VCALL_PTR0R( Matrix3, determinant );
|
VCALL_PTR0R( Basis, determinant );
|
||||||
VCALL_PTR2R( Matrix3, rotated );
|
VCALL_PTR2R( Basis, rotated );
|
||||||
VCALL_PTR1R( Matrix3, scaled );
|
VCALL_PTR1R( Basis, scaled );
|
||||||
VCALL_PTR0R( Matrix3, get_scale );
|
VCALL_PTR0R( Basis, get_scale );
|
||||||
VCALL_PTR0R( Matrix3, get_euler );
|
VCALL_PTR0R( Basis, get_euler );
|
||||||
VCALL_PTR1R( Matrix3, tdotx );
|
VCALL_PTR1R( Basis, tdotx );
|
||||||
VCALL_PTR1R( Matrix3, tdoty );
|
VCALL_PTR1R( Basis, tdoty );
|
||||||
VCALL_PTR1R( Matrix3, tdotz );
|
VCALL_PTR1R( Basis, tdotz );
|
||||||
VCALL_PTR1R( Matrix3, xform );
|
VCALL_PTR1R( Basis, xform );
|
||||||
VCALL_PTR1R( Matrix3, xform_inv );
|
VCALL_PTR1R( Basis, xform_inv );
|
||||||
VCALL_PTR0R( Matrix3, get_orthogonal_index );
|
VCALL_PTR0R( Basis, get_orthogonal_index );
|
||||||
VCALL_PTR0R( Matrix3, orthonormalized );
|
VCALL_PTR0R( Basis, orthonormalized );
|
||||||
|
|
||||||
|
|
||||||
VCALL_PTR0R( Transform, inverse );
|
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::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::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();
|
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::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::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();
|
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]);
|
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;
|
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[0]=*p_args[0];
|
||||||
m[1]=*p_args[1];
|
m[1]=*p_args[1];
|
||||||
m[2]=*p_args[2];
|
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]);
|
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(0,*p_args[0]);
|
||||||
m.set_axis(1,*p_args[1]);
|
m.set_axis(1,*p_args[1]);
|
||||||
m.set_axis(2,*p_args[2]);
|
m.set_axis(2,*p_args[2]);
|
||||||
r_ret=m;
|
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) {
|
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) {
|
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) {
|
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 VECTOR2: return Vector2(); // 5
|
||||||
case RECT2: return Rect2();
|
case RECT2: return Rect2();
|
||||||
case VECTOR3: return Vector3();
|
case VECTOR3: return Vector3();
|
||||||
case MATRIX32: return Matrix32();
|
case TRANSFORM2D: return Transform2D();
|
||||||
case PLANE: return Plane();
|
case PLANE: return Plane();
|
||||||
case QUAT: return Quat();
|
case QUAT: return Quat();
|
||||||
case _AABB: return AABB(); //sorry naming convention fail :( not like it's used often // 10
|
case RECT3: return Rect3(); //sorry naming convention fail :( not like it's used often // 10
|
||||||
case MATRIX3: return Matrix3();
|
case BASIS: return Basis();
|
||||||
case TRANSFORM: return Transform();
|
case TRANSFORM: return Transform();
|
||||||
|
|
||||||
// misc types
|
// 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 INPUT_EVENT: return InputEvent();;
|
||||||
case DICTIONARY: return Dictionary();;
|
case DICTIONARY: return Dictionary();;
|
||||||
case ARRAY: return Array();; // 20
|
case ARRAY: return Array();; // 20
|
||||||
case RAW_ARRAY: return ByteArray();;
|
case POOL_BYTE_ARRAY: return PoolByteArray();;
|
||||||
case INT_ARRAY: return IntArray();;
|
case POOL_INT_ARRAY: return PoolIntArray();;
|
||||||
case REAL_ARRAY: return RealArray();;
|
case POOL_REAL_ARRAY: return PoolRealArray();;
|
||||||
case STRING_ARRAY: return StringArray();;
|
case POOL_STRING_ARRAY: return PoolStringArray();;
|
||||||
case VECTOR2_ARRAY: return Vector2Array();; // 25
|
case POOL_VECTOR2_ARRAY: return PoolVector2Array();; // 25
|
||||||
case VECTOR3_ARRAY: return Vector3Array();; // 25
|
case POOL_VECTOR3_ARRAY: return PoolVector3Array();; // 25
|
||||||
case COLOR_ARRAY: return ColorArray();;
|
case POOL_COLOR_ARRAY: return PoolColorArray();;
|
||||||
default: return Variant();
|
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 VECTOR3: return (Vector3(*p_args[0]));
|
||||||
case PLANE: return (Plane(*p_args[0]));
|
case PLANE: return (Plane(*p_args[0]));
|
||||||
case QUAT: return (Quat(*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 RECT3: return (Rect3(*p_args[0])); //sorry naming convention fail :( not like it's used often // 10
|
||||||
case MATRIX3: return (Matrix3(p_args[0]->operator Matrix3()));
|
case BASIS: return (Basis(p_args[0]->operator Basis()));
|
||||||
case TRANSFORM: return (Transform(p_args[0]->operator Transform()));
|
case TRANSFORM: return (Transform(p_args[0]->operator Transform()));
|
||||||
|
|
||||||
// misc types
|
// 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();
|
case ARRAY: return p_args[0]->operator Array();
|
||||||
|
|
||||||
// arrays
|
// arrays
|
||||||
case RAW_ARRAY: return (ByteArray(*p_args[0]));
|
case POOL_BYTE_ARRAY: return (PoolByteArray(*p_args[0]));
|
||||||
case INT_ARRAY: return (IntArray(*p_args[0]));
|
case POOL_INT_ARRAY: return (PoolIntArray(*p_args[0]));
|
||||||
case REAL_ARRAY: return (RealArray(*p_args[0]));
|
case POOL_REAL_ARRAY: return (PoolRealArray(*p_args[0]));
|
||||||
case STRING_ARRAY: return (StringArray(*p_args[0]));
|
case POOL_STRING_ARRAY: return (PoolStringArray(*p_args[0]));
|
||||||
case VECTOR2_ARRAY: return (Vector2Array(*p_args[0])); // 25
|
case POOL_VECTOR2_ARRAY: return (PoolVector2Array(*p_args[0])); // 25
|
||||||
case VECTOR3_ARRAY: return (Vector3Array(*p_args[0])); // 25
|
case POOL_VECTOR3_ARRAY: return (PoolVector3Array(*p_args[0])); // 25
|
||||||
case COLOR_ARRAY: return (ColorArray(*p_args[0]));
|
case POOL_COLOR_ARRAY: return (PoolColorArray(*p_args[0]));
|
||||||
default: return Variant();
|
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,ends_with,STRING,"text",varray());
|
||||||
ADDFUNC1(STRING,BOOL,String,is_subsequence_of,STRING,"text",varray());
|
ADDFUNC1(STRING,BOOL,String,is_subsequence_of,STRING,"text",varray());
|
||||||
ADDFUNC1(STRING,BOOL,String,is_subsequence_ofi,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());
|
ADDFUNC1(STRING,REAL,String,similarity,STRING,"text",varray());
|
||||||
|
|
||||||
ADDFUNC2(STRING,STRING,String,replace,STRING,"what",STRING,"forwhat",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,replacen,STRING,"what",STRING,"forwhat",varray());
|
||||||
ADDFUNC2(STRING,STRING,String,insert,INT,"pos",STRING,"what",varray());
|
ADDFUNC2(STRING,STRING,String,insert,INT,"pos",STRING,"what",varray());
|
||||||
ADDFUNC0(STRING,STRING,String,capitalize,varray());
|
ADDFUNC0(STRING,STRING,String,capitalize,varray());
|
||||||
ADDFUNC2(STRING,STRING_ARRAY,String,split,STRING,"divisor",BOOL,"allow_empty",varray(true));
|
ADDFUNC2(STRING,POOL_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_REAL_ARRAY,String,split_floats,STRING,"divisor",BOOL,"allow_empty",varray(true));
|
||||||
|
|
||||||
ADDFUNC0(STRING,STRING,String,to_upper,varray());
|
ADDFUNC0(STRING,STRING,String,to_upper,varray());
|
||||||
ADDFUNC0(STRING,STRING,String,to_lower,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,INT,String,hash,varray());
|
||||||
ADDFUNC0(STRING,STRING,String,md5_text,varray());
|
ADDFUNC0(STRING,STRING,String,md5_text,varray());
|
||||||
ADDFUNC0(STRING,STRING,String,sha256_text,varray());
|
ADDFUNC0(STRING,STRING,String,sha256_text,varray());
|
||||||
ADDFUNC0(STRING,RAW_ARRAY,String,md5_buffer,varray());
|
ADDFUNC0(STRING,POOL_BYTE_ARRAY,String,md5_buffer,varray());
|
||||||
ADDFUNC0(STRING,RAW_ARRAY,String,sha256_buffer,varray());
|
ADDFUNC0(STRING,POOL_BYTE_ARRAY,String,sha256_buffer,varray());
|
||||||
ADDFUNC0(STRING,BOOL,String,empty,varray());
|
ADDFUNC0(STRING,BOOL,String,empty,varray());
|
||||||
ADDFUNC0(STRING,BOOL,String,is_abs_path,varray());
|
ADDFUNC0(STRING,BOOL,String,is_abs_path,varray());
|
||||||
ADDFUNC0(STRING,BOOL,String,is_rel_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_decimals,INT,"digits",varray());
|
||||||
ADDFUNC1(STRING,STRING,String,pad_zeros,INT,"digits",varray());
|
ADDFUNC1(STRING,STRING,String,pad_zeros,INT,"digits",varray());
|
||||||
|
|
||||||
ADDFUNC0(STRING,RAW_ARRAY,String,to_ascii,varray());
|
ADDFUNC0(STRING,POOL_BYTE_ARRAY,String,to_ascii,varray());
|
||||||
ADDFUNC0(STRING,RAW_ARRAY,String,to_utf8,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());
|
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,REAL,Vector3,dot,VECTOR3,"b",varray());
|
||||||
ADDFUNC1(VECTOR3,VECTOR3,Vector3,cross,VECTOR3,"b",varray());
|
ADDFUNC1(VECTOR3,VECTOR3,Vector3,cross,VECTOR3,"b",varray());
|
||||||
ADDFUNC1(VECTOR3,MATRIX3,Vector3,outer,VECTOR3,"b",varray());
|
ADDFUNC1(VECTOR3,BASIS,Vector3,outer,VECTOR3,"b",varray());
|
||||||
ADDFUNC0(VECTOR3,MATRIX3,Vector3,to_diagonal_matrix,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,abs,varray());
|
ADDFUNC0(VECTOR3,VECTOR3,Vector3,abs,varray());
|
||||||
ADDFUNC0(VECTOR3,VECTOR3,Vector3,floor,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));
|
ADDFUNC1(IMAGE, IMAGE, Image, compressed, INT, "format", varray(0));
|
||||||
ADDFUNC0(IMAGE, IMAGE, Image, decompressed, 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)));
|
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));
|
ADDFUNC3(IMAGE, NIL, Image, blit_rect, IMAGE, "src", RECT2, "src_rect", VECTOR2, "dest", varray(0));
|
||||||
ADDFUNC1(IMAGE, IMAGE, Image, converted, INT, "format", varray(0));
|
ADDFUNC1(IMAGE, IMAGE, Image, converted, INT, "format", varray(0));
|
||||||
ADDFUNC0(IMAGE, NIL, Image, fix_alpha_edges, varray());
|
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,NIL,Array,invert,varray());
|
||||||
ADDFUNC0(ARRAY,BOOL,Array,is_shared,varray());
|
ADDFUNC0(ARRAY,BOOL,Array,is_shared,varray());
|
||||||
|
|
||||||
ADDFUNC0(RAW_ARRAY,INT,ByteArray,size,varray());
|
ADDFUNC0(POOL_BYTE_ARRAY,INT,PoolByteArray,size,varray());
|
||||||
ADDFUNC2(RAW_ARRAY,NIL,ByteArray,set,INT,"idx",INT,"byte",varray());
|
ADDFUNC2(POOL_BYTE_ARRAY,NIL,PoolByteArray,set,INT,"idx",INT,"byte",varray());
|
||||||
ADDFUNC1(RAW_ARRAY,NIL,ByteArray,push_back,INT,"byte",varray());
|
ADDFUNC1(POOL_BYTE_ARRAY,NIL,PoolByteArray,push_back,INT,"byte",varray());
|
||||||
ADDFUNC1(RAW_ARRAY,NIL,ByteArray,append,INT,"byte",varray());
|
ADDFUNC1(POOL_BYTE_ARRAY,NIL,PoolByteArray,append,INT,"byte",varray());
|
||||||
ADDFUNC1(RAW_ARRAY,NIL,ByteArray,append_array,RAW_ARRAY,"array",varray());
|
ADDFUNC1(POOL_BYTE_ARRAY,NIL,PoolByteArray,append_array,POOL_BYTE_ARRAY,"array",varray());
|
||||||
ADDFUNC1(RAW_ARRAY,NIL,ByteArray,remove,INT,"idx",varray());
|
ADDFUNC1(POOL_BYTE_ARRAY,NIL,PoolByteArray,remove,INT,"idx",varray());
|
||||||
ADDFUNC2(RAW_ARRAY,INT,ByteArray,insert,INT,"idx",INT,"byte",varray());
|
ADDFUNC2(POOL_BYTE_ARRAY,INT,PoolByteArray,insert,INT,"idx",INT,"byte",varray());
|
||||||
ADDFUNC1(RAW_ARRAY,NIL,ByteArray,resize,INT,"idx",varray());
|
ADDFUNC1(POOL_BYTE_ARRAY,NIL,PoolByteArray,resize,INT,"idx",varray());
|
||||||
ADDFUNC0(RAW_ARRAY,NIL,ByteArray,invert,varray());
|
ADDFUNC0(POOL_BYTE_ARRAY,NIL,PoolByteArray,invert,varray());
|
||||||
ADDFUNC2(RAW_ARRAY,RAW_ARRAY,ByteArray,subarray,INT,"from",INT,"to",varray());
|
ADDFUNC2(POOL_BYTE_ARRAY,POOL_BYTE_ARRAY,PoolByteArray,subarray,INT,"from",INT,"to",varray());
|
||||||
|
|
||||||
ADDFUNC0(RAW_ARRAY,STRING,ByteArray,get_string_from_ascii,varray());
|
ADDFUNC0(POOL_BYTE_ARRAY,STRING,PoolByteArray,get_string_from_ascii,varray());
|
||||||
ADDFUNC0(RAW_ARRAY,STRING,ByteArray,get_string_from_utf8,varray());
|
ADDFUNC0(POOL_BYTE_ARRAY,STRING,PoolByteArray,get_string_from_utf8,varray());
|
||||||
|
|
||||||
|
|
||||||
ADDFUNC0(INT_ARRAY,INT,IntArray,size,varray());
|
ADDFUNC0(POOL_INT_ARRAY,INT,PoolIntArray,size,varray());
|
||||||
ADDFUNC2(INT_ARRAY,NIL,IntArray,set,INT,"idx",INT,"integer",varray());
|
ADDFUNC2(POOL_INT_ARRAY,NIL,PoolIntArray,set,INT,"idx",INT,"integer",varray());
|
||||||
ADDFUNC1(INT_ARRAY,NIL,IntArray,push_back,INT,"integer",varray());
|
ADDFUNC1(POOL_INT_ARRAY,NIL,PoolIntArray,push_back,INT,"integer",varray());
|
||||||
ADDFUNC1(INT_ARRAY,NIL,IntArray,append,INT,"integer",varray());
|
ADDFUNC1(POOL_INT_ARRAY,NIL,PoolIntArray,append,INT,"integer",varray());
|
||||||
ADDFUNC1(INT_ARRAY,NIL,IntArray,append_array,INT_ARRAY,"array",varray());
|
ADDFUNC1(POOL_INT_ARRAY,NIL,PoolIntArray,append_array,POOL_INT_ARRAY,"array",varray());
|
||||||
ADDFUNC1(INT_ARRAY,NIL,IntArray,remove,INT,"idx",varray());
|
ADDFUNC1(POOL_INT_ARRAY,NIL,PoolIntArray,remove,INT,"idx",varray());
|
||||||
ADDFUNC2(INT_ARRAY,INT,IntArray,insert,INT,"idx",INT,"integer",varray());
|
ADDFUNC2(POOL_INT_ARRAY,INT,PoolIntArray,insert,INT,"idx",INT,"integer",varray());
|
||||||
ADDFUNC1(INT_ARRAY,NIL,IntArray,resize,INT,"idx",varray());
|
ADDFUNC1(POOL_INT_ARRAY,NIL,PoolIntArray,resize,INT,"idx",varray());
|
||||||
ADDFUNC0(INT_ARRAY,NIL,IntArray,invert,varray());
|
ADDFUNC0(POOL_INT_ARRAY,NIL,PoolIntArray,invert,varray());
|
||||||
|
|
||||||
ADDFUNC0(REAL_ARRAY,INT,RealArray,size,varray());
|
ADDFUNC0(POOL_REAL_ARRAY,INT,PoolRealArray,size,varray());
|
||||||
ADDFUNC2(REAL_ARRAY,NIL,RealArray,set,INT,"idx",REAL,"value",varray());
|
ADDFUNC2(POOL_REAL_ARRAY,NIL,PoolRealArray,set,INT,"idx",REAL,"value",varray());
|
||||||
ADDFUNC1(REAL_ARRAY,NIL,RealArray,push_back,REAL,"value",varray());
|
ADDFUNC1(POOL_REAL_ARRAY,NIL,PoolRealArray,push_back,REAL,"value",varray());
|
||||||
ADDFUNC1(REAL_ARRAY,NIL,RealArray,append,REAL,"value",varray());
|
ADDFUNC1(POOL_REAL_ARRAY,NIL,PoolRealArray,append,REAL,"value",varray());
|
||||||
ADDFUNC1(REAL_ARRAY,NIL,RealArray,append_array,REAL_ARRAY,"array",varray());
|
ADDFUNC1(POOL_REAL_ARRAY,NIL,PoolRealArray,append_array,POOL_REAL_ARRAY,"array",varray());
|
||||||
ADDFUNC1(REAL_ARRAY,NIL,RealArray,remove,INT,"idx",varray());
|
ADDFUNC1(POOL_REAL_ARRAY,NIL,PoolRealArray,remove,INT,"idx",varray());
|
||||||
ADDFUNC2(REAL_ARRAY,INT,RealArray,insert,INT,"idx",REAL,"value",varray());
|
ADDFUNC2(POOL_REAL_ARRAY,INT,PoolRealArray,insert,INT,"idx",REAL,"value",varray());
|
||||||
ADDFUNC1(REAL_ARRAY,NIL,RealArray,resize,INT,"idx",varray());
|
ADDFUNC1(POOL_REAL_ARRAY,NIL,PoolRealArray,resize,INT,"idx",varray());
|
||||||
ADDFUNC0(REAL_ARRAY,NIL,RealArray,invert,varray());
|
ADDFUNC0(POOL_REAL_ARRAY,NIL,PoolRealArray,invert,varray());
|
||||||
|
|
||||||
ADDFUNC0(STRING_ARRAY,INT,StringArray,size,varray());
|
ADDFUNC0(POOL_STRING_ARRAY,INT,PoolStringArray,size,varray());
|
||||||
ADDFUNC2(STRING_ARRAY,NIL,StringArray,set,INT,"idx",STRING,"string",varray());
|
ADDFUNC2(POOL_STRING_ARRAY,NIL,PoolStringArray,set,INT,"idx",STRING,"string",varray());
|
||||||
ADDFUNC1(STRING_ARRAY,NIL,StringArray,push_back,STRING,"string",varray());
|
ADDFUNC1(POOL_STRING_ARRAY,NIL,PoolStringArray,push_back,STRING,"string",varray());
|
||||||
ADDFUNC1(STRING_ARRAY,NIL,StringArray,append,STRING,"string",varray());
|
ADDFUNC1(POOL_STRING_ARRAY,NIL,PoolStringArray,append,STRING,"string",varray());
|
||||||
ADDFUNC1(STRING_ARRAY,NIL,StringArray,append_array,STRING_ARRAY,"array",varray());
|
ADDFUNC1(POOL_STRING_ARRAY,NIL,PoolStringArray,append_array,POOL_STRING_ARRAY,"array",varray());
|
||||||
ADDFUNC1(STRING_ARRAY,NIL,StringArray,remove,INT,"idx",varray());
|
ADDFUNC1(POOL_STRING_ARRAY,NIL,PoolStringArray,remove,INT,"idx",varray());
|
||||||
ADDFUNC2(STRING_ARRAY,INT,StringArray,insert,INT,"idx",STRING,"string",varray());
|
ADDFUNC2(POOL_STRING_ARRAY,INT,PoolStringArray,insert,INT,"idx",STRING,"string",varray());
|
||||||
ADDFUNC1(STRING_ARRAY,NIL,StringArray,resize,INT,"idx",varray());
|
ADDFUNC1(POOL_STRING_ARRAY,NIL,PoolStringArray,resize,INT,"idx",varray());
|
||||||
ADDFUNC0(STRING_ARRAY,NIL,StringArray,invert,varray());
|
ADDFUNC0(POOL_STRING_ARRAY,NIL,PoolStringArray,invert,varray());
|
||||||
|
|
||||||
ADDFUNC0(VECTOR2_ARRAY,INT,Vector2Array,size,varray());
|
ADDFUNC0(POOL_VECTOR2_ARRAY,INT,PoolVector2Array,size,varray());
|
||||||
ADDFUNC2(VECTOR2_ARRAY,NIL,Vector2Array,set,INT,"idx",VECTOR2,"vector2",varray());
|
ADDFUNC2(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,set,INT,"idx",VECTOR2,"vector2",varray());
|
||||||
ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,push_back,VECTOR2,"vector2",varray());
|
ADDFUNC1(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,push_back,VECTOR2,"vector2",varray());
|
||||||
ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,append,VECTOR2,"vector2",varray());
|
ADDFUNC1(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,append,VECTOR2,"vector2",varray());
|
||||||
ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,append_array,VECTOR2_ARRAY,"array",varray());
|
ADDFUNC1(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,append_array,POOL_VECTOR2_ARRAY,"array",varray());
|
||||||
ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,remove,INT,"idx",varray());
|
ADDFUNC1(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,remove,INT,"idx",varray());
|
||||||
ADDFUNC2(VECTOR2_ARRAY,INT,Vector2Array,insert,INT,"idx",VECTOR2,"vector2",varray());
|
ADDFUNC2(POOL_VECTOR2_ARRAY,INT,PoolVector2Array,insert,INT,"idx",VECTOR2,"vector2",varray());
|
||||||
ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,resize,INT,"idx",varray());
|
ADDFUNC1(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,resize,INT,"idx",varray());
|
||||||
ADDFUNC0(VECTOR2_ARRAY,NIL,Vector2Array,invert,varray());
|
ADDFUNC0(POOL_VECTOR2_ARRAY,NIL,PoolVector2Array,invert,varray());
|
||||||
|
|
||||||
ADDFUNC0(VECTOR3_ARRAY,INT,Vector3Array,size,varray());
|
ADDFUNC0(POOL_VECTOR3_ARRAY,INT,PoolVector3Array,size,varray());
|
||||||
ADDFUNC2(VECTOR3_ARRAY,NIL,Vector3Array,set,INT,"idx",VECTOR3,"vector3",varray());
|
ADDFUNC2(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,set,INT,"idx",VECTOR3,"vector3",varray());
|
||||||
ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,push_back,VECTOR3,"vector3",varray());
|
ADDFUNC1(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,push_back,VECTOR3,"vector3",varray());
|
||||||
ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,append,VECTOR3,"vector3",varray());
|
ADDFUNC1(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,append,VECTOR3,"vector3",varray());
|
||||||
ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,append_array,VECTOR3_ARRAY,"array",varray());
|
ADDFUNC1(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,append_array,POOL_VECTOR3_ARRAY,"array",varray());
|
||||||
ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,remove,INT,"idx",varray());
|
ADDFUNC1(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,remove,INT,"idx",varray());
|
||||||
ADDFUNC2(VECTOR3_ARRAY,INT,Vector3Array,insert,INT,"idx",VECTOR3,"vector3",varray());
|
ADDFUNC2(POOL_VECTOR3_ARRAY,INT,PoolVector3Array,insert,INT,"idx",VECTOR3,"vector3",varray());
|
||||||
ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,resize,INT,"idx",varray());
|
ADDFUNC1(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,resize,INT,"idx",varray());
|
||||||
ADDFUNC0(VECTOR3_ARRAY,NIL,Vector3Array,invert,varray());
|
ADDFUNC0(POOL_VECTOR3_ARRAY,NIL,PoolVector3Array,invert,varray());
|
||||||
|
|
||||||
ADDFUNC0(COLOR_ARRAY,INT,ColorArray,size,varray());
|
ADDFUNC0(POOL_COLOR_ARRAY,INT,PoolColorArray,size,varray());
|
||||||
ADDFUNC2(COLOR_ARRAY,NIL,ColorArray,set,INT,"idx",COLOR,"color",varray());
|
ADDFUNC2(POOL_COLOR_ARRAY,NIL,PoolColorArray,set,INT,"idx",COLOR,"color",varray());
|
||||||
ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,push_back,COLOR,"color",varray());
|
ADDFUNC1(POOL_COLOR_ARRAY,NIL,PoolColorArray,push_back,COLOR,"color",varray());
|
||||||
ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,append,COLOR,"color",varray());
|
ADDFUNC1(POOL_COLOR_ARRAY,NIL,PoolColorArray,append,COLOR,"color",varray());
|
||||||
ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,append_array,COLOR_ARRAY,"array",varray());
|
ADDFUNC1(POOL_COLOR_ARRAY,NIL,PoolColorArray,append_array,POOL_COLOR_ARRAY,"array",varray());
|
||||||
ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,remove,INT,"idx",varray());
|
ADDFUNC1(POOL_COLOR_ARRAY,NIL,PoolColorArray,remove,INT,"idx",varray());
|
||||||
ADDFUNC2(COLOR_ARRAY,INT,ColorArray,insert,INT,"idx",COLOR,"color",varray());
|
ADDFUNC2(POOL_COLOR_ARRAY,INT,PoolColorArray,insert,INT,"idx",COLOR,"color",varray());
|
||||||
ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,resize,INT,"idx",varray());
|
ADDFUNC1(POOL_COLOR_ARRAY,NIL,PoolColorArray,resize,INT,"idx",varray());
|
||||||
ADDFUNC0(COLOR_ARRAY,NIL,ColorArray,invert,varray());
|
ADDFUNC0(POOL_COLOR_ARRAY,NIL,PoolColorArray,invert,varray());
|
||||||
|
|
||||||
//pointerbased
|
//pointerbased
|
||||||
|
|
||||||
ADDFUNC0(_AABB,REAL,AABB,get_area,varray());
|
ADDFUNC0(RECT3,REAL,Rect3,get_area,varray());
|
||||||
ADDFUNC0(_AABB,BOOL,AABB,has_no_area,varray());
|
ADDFUNC0(RECT3,BOOL,Rect3,has_no_area,varray());
|
||||||
ADDFUNC0(_AABB,BOOL,AABB,has_no_surface,varray());
|
ADDFUNC0(RECT3,BOOL,Rect3,has_no_surface,varray());
|
||||||
ADDFUNC1(_AABB,BOOL,AABB,intersects,_AABB,"with",varray());
|
ADDFUNC1(RECT3,BOOL,Rect3,intersects,RECT3,"with",varray());
|
||||||
ADDFUNC1(_AABB,BOOL,AABB,encloses,_AABB,"with",varray());
|
ADDFUNC1(RECT3,BOOL,Rect3,encloses,RECT3,"with",varray());
|
||||||
ADDFUNC1(_AABB,_AABB,AABB,merge,_AABB,"with",varray());
|
ADDFUNC1(RECT3,RECT3,Rect3,merge,RECT3,"with",varray());
|
||||||
ADDFUNC1(_AABB,_AABB,AABB,intersection,_AABB,"with",varray());
|
ADDFUNC1(RECT3,RECT3,Rect3,intersection,RECT3,"with",varray());
|
||||||
ADDFUNC1(_AABB,BOOL,AABB,intersects_plane,PLANE,"plane",varray());
|
ADDFUNC1(RECT3,BOOL,Rect3,intersects_plane,PLANE,"plane",varray());
|
||||||
ADDFUNC2(_AABB,BOOL,AABB,intersects_segment,VECTOR3,"from",VECTOR3,"to",varray());
|
ADDFUNC2(RECT3,BOOL,Rect3,intersects_segment,VECTOR3,"from",VECTOR3,"to",varray());
|
||||||
ADDFUNC1(_AABB,BOOL,AABB,has_point,VECTOR3,"point",varray());
|
ADDFUNC1(RECT3,BOOL,Rect3,has_point,VECTOR3,"point",varray());
|
||||||
ADDFUNC1(_AABB,VECTOR3,AABB,get_support,VECTOR3,"dir",varray());
|
ADDFUNC1(RECT3,VECTOR3,Rect3,get_support,VECTOR3,"dir",varray());
|
||||||
ADDFUNC0(_AABB,VECTOR3,AABB,get_longest_axis,varray());
|
ADDFUNC0(RECT3,VECTOR3,Rect3,get_longest_axis,varray());
|
||||||
ADDFUNC0(_AABB,INT,AABB,get_longest_axis_index,varray());
|
ADDFUNC0(RECT3,INT,Rect3,get_longest_axis_index,varray());
|
||||||
ADDFUNC0(_AABB,REAL,AABB,get_longest_axis_size,varray());
|
ADDFUNC0(RECT3,REAL,Rect3,get_longest_axis_size,varray());
|
||||||
ADDFUNC0(_AABB,VECTOR3,AABB,get_shortest_axis,varray());
|
ADDFUNC0(RECT3,VECTOR3,Rect3,get_shortest_axis,varray());
|
||||||
ADDFUNC0(_AABB,INT,AABB,get_shortest_axis_index,varray());
|
ADDFUNC0(RECT3,INT,Rect3,get_shortest_axis_index,varray());
|
||||||
ADDFUNC0(_AABB,REAL,AABB,get_shortest_axis_size,varray());
|
ADDFUNC0(RECT3,REAL,Rect3,get_shortest_axis_size,varray());
|
||||||
ADDFUNC1(_AABB,_AABB,AABB,expand,VECTOR3,"to_point",varray());
|
ADDFUNC1(RECT3,RECT3,Rect3,expand,VECTOR3,"to_point",varray());
|
||||||
ADDFUNC1(_AABB,_AABB,AABB,grow,REAL,"by",varray());
|
ADDFUNC1(RECT3,RECT3,Rect3,grow,REAL,"by",varray());
|
||||||
ADDFUNC1(_AABB,VECTOR3,AABB,get_endpoint,INT,"idx",varray());
|
ADDFUNC1(RECT3,VECTOR3,Rect3,get_endpoint,INT,"idx",varray());
|
||||||
|
|
||||||
ADDFUNC0(MATRIX32,MATRIX32,Matrix32,inverse,varray());
|
ADDFUNC0(TRANSFORM2D,TRANSFORM2D,Transform2D,inverse,varray());
|
||||||
ADDFUNC0(MATRIX32,MATRIX32,Matrix32,affine_inverse,varray());
|
ADDFUNC0(TRANSFORM2D,TRANSFORM2D,Transform2D,affine_inverse,varray());
|
||||||
ADDFUNC0(MATRIX32,REAL,Matrix32,get_rotation,varray());
|
ADDFUNC0(TRANSFORM2D,REAL,Transform2D,get_rotation,varray());
|
||||||
ADDFUNC0(MATRIX32,VECTOR2,Matrix32,get_origin,varray());
|
ADDFUNC0(TRANSFORM2D,VECTOR2,Transform2D,get_origin,varray());
|
||||||
ADDFUNC0(MATRIX32,VECTOR2,Matrix32,get_scale,varray());
|
ADDFUNC0(TRANSFORM2D,VECTOR2,Transform2D,get_scale,varray());
|
||||||
ADDFUNC0(MATRIX32,MATRIX32,Matrix32,orthonormalized,varray());
|
ADDFUNC0(TRANSFORM2D,TRANSFORM2D,Transform2D,orthonormalized,varray());
|
||||||
ADDFUNC1(MATRIX32,MATRIX32,Matrix32,rotated,REAL,"phi",varray());
|
ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,rotated,REAL,"phi",varray());
|
||||||
ADDFUNC1(MATRIX32,MATRIX32,Matrix32,scaled,VECTOR2,"scale",varray());
|
ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,scaled,VECTOR2,"scale",varray());
|
||||||
ADDFUNC1(MATRIX32,MATRIX32,Matrix32,translated,VECTOR2,"offset",varray());
|
ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,translated,VECTOR2,"offset",varray());
|
||||||
ADDFUNC1(MATRIX32,MATRIX32,Matrix32,xform,NIL,"v",varray());
|
ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,xform,NIL,"v",varray());
|
||||||
ADDFUNC1(MATRIX32,MATRIX32,Matrix32,xform_inv,NIL,"v",varray());
|
ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,xform_inv,NIL,"v",varray());
|
||||||
ADDFUNC1(MATRIX32,MATRIX32,Matrix32,basis_xform,NIL,"v",varray());
|
ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,basis_xform,NIL,"v",varray());
|
||||||
ADDFUNC1(MATRIX32,MATRIX32,Matrix32,basis_xform_inv,NIL,"v",varray());
|
ADDFUNC1(TRANSFORM2D,TRANSFORM2D,Transform2D,basis_xform_inv,NIL,"v",varray());
|
||||||
ADDFUNC2(MATRIX32,MATRIX32,Matrix32,interpolate_with,MATRIX32,"m",REAL,"c",varray());
|
ADDFUNC2(TRANSFORM2D,TRANSFORM2D,Transform2D,interpolate_with,TRANSFORM2D,"m",REAL,"c",varray());
|
||||||
|
|
||||||
ADDFUNC0(MATRIX3,MATRIX3,Matrix3,inverse,varray());
|
ADDFUNC0(BASIS,BASIS,Basis,inverse,varray());
|
||||||
ADDFUNC0(MATRIX3,MATRIX3,Matrix3,transposed,varray());
|
ADDFUNC0(BASIS,BASIS,Basis,transposed,varray());
|
||||||
ADDFUNC0(MATRIX3,MATRIX3,Matrix3,orthonormalized,varray());
|
ADDFUNC0(BASIS,BASIS,Basis,orthonormalized,varray());
|
||||||
ADDFUNC0(MATRIX3,REAL,Matrix3,determinant,varray());
|
ADDFUNC0(BASIS,REAL,Basis,determinant,varray());
|
||||||
ADDFUNC2(MATRIX3,MATRIX3,Matrix3,rotated,VECTOR3,"axis",REAL,"phi",varray());
|
ADDFUNC2(BASIS,BASIS,Basis,rotated,VECTOR3,"axis",REAL,"phi",varray());
|
||||||
ADDFUNC1(MATRIX3,MATRIX3,Matrix3,scaled,VECTOR3,"scale",varray());
|
ADDFUNC1(BASIS,BASIS,Basis,scaled,VECTOR3,"scale",varray());
|
||||||
ADDFUNC0(MATRIX3,VECTOR3,Matrix3,get_scale,varray());
|
ADDFUNC0(BASIS,VECTOR3,Basis,get_scale,varray());
|
||||||
ADDFUNC0(MATRIX3,VECTOR3,Matrix3,get_euler,varray());
|
ADDFUNC0(BASIS,VECTOR3,Basis,get_euler,varray());
|
||||||
ADDFUNC1(MATRIX3,REAL,Matrix3,tdotx,VECTOR3,"with",varray());
|
ADDFUNC1(BASIS,REAL,Basis,tdotx,VECTOR3,"with",varray());
|
||||||
ADDFUNC1(MATRIX3,REAL,Matrix3,tdoty,VECTOR3,"with",varray());
|
ADDFUNC1(BASIS,REAL,Basis,tdoty,VECTOR3,"with",varray());
|
||||||
ADDFUNC1(MATRIX3,REAL,Matrix3,tdotz,VECTOR3,"with",varray());
|
ADDFUNC1(BASIS,REAL,Basis,tdotz,VECTOR3,"with",varray());
|
||||||
ADDFUNC1(MATRIX3,VECTOR3,Matrix3,xform,VECTOR3,"v",varray());
|
ADDFUNC1(BASIS,VECTOR3,Basis,xform,VECTOR3,"v",varray());
|
||||||
ADDFUNC1(MATRIX3,VECTOR3,Matrix3,xform_inv,VECTOR3,"v",varray());
|
ADDFUNC1(BASIS,VECTOR3,Basis,xform_inv,VECTOR3,"v",varray());
|
||||||
ADDFUNC0(MATRIX3,INT,Matrix3,get_orthogonal_index,varray());
|
ADDFUNC0(BASIS,INT,Basis,get_orthogonal_index,varray());
|
||||||
|
|
||||||
ADDFUNC0(TRANSFORM,TRANSFORM,Transform,inverse,varray());
|
ADDFUNC0(TRANSFORM,TRANSFORM,Transform,inverse,varray());
|
||||||
ADDFUNC0(TRANSFORM,TRANSFORM,Transform,affine_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_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::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::Transform2D_init2,Variant::TRANSFORM2D,"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_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);
|
_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_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::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::Basis_init1,Variant::BASIS,"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_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_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);
|
_VariantCall::add_constructor(_VariantCall::Image_init1,Variant::IMAGE,"width",Variant::INT,"height",Variant::INT,"mipmaps",Variant::BOOL,"format",Variant::INT);
|
||||||
|
|
||||||
|
|
|
@ -47,12 +47,12 @@ bool Variant::booleanize(bool &r_valid) const {
|
||||||
case STRING: return (*reinterpret_cast<const String*>(_data._mem))!="";
|
case STRING: return (*reinterpret_cast<const String*>(_data._mem))!="";
|
||||||
case VECTOR2:
|
case VECTOR2:
|
||||||
case RECT2:
|
case RECT2:
|
||||||
case MATRIX32:
|
case TRANSFORM2D:
|
||||||
case VECTOR3:
|
case VECTOR3:
|
||||||
case PLANE:
|
case PLANE:
|
||||||
case _AABB:
|
case RECT3:
|
||||||
case QUAT:
|
case QUAT:
|
||||||
case MATRIX3:
|
case BASIS:
|
||||||
case TRANSFORM:
|
case TRANSFORM:
|
||||||
case COLOR:
|
case COLOR:
|
||||||
case IMAGE: r_valid=false; return false;
|
case IMAGE: r_valid=false; return false;
|
||||||
|
@ -62,13 +62,13 @@ bool Variant::booleanize(bool &r_valid) const {
|
||||||
case INPUT_EVENT:
|
case INPUT_EVENT:
|
||||||
case DICTIONARY:
|
case DICTIONARY:
|
||||||
case ARRAY:
|
case ARRAY:
|
||||||
case RAW_ARRAY:
|
case POOL_BYTE_ARRAY:
|
||||||
case INT_ARRAY:
|
case POOL_INT_ARRAY:
|
||||||
case REAL_ARRAY:
|
case POOL_REAL_ARRAY:
|
||||||
case STRING_ARRAY:
|
case POOL_STRING_ARRAY:
|
||||||
case VECTOR2_ARRAY:
|
case POOL_VECTOR2_ARRAY:
|
||||||
case VECTOR3_ARRAY:
|
case POOL_VECTOR3_ARRAY:
|
||||||
case COLOR_ARRAY:
|
case POOL_COLOR_ARRAY:
|
||||||
r_valid=false;
|
r_valid=false;
|
||||||
return false;
|
return false;
|
||||||
default: {}
|
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_STR(==,STRING,String);
|
||||||
DEFAULT_OP_LOCALMEM(==,VECTOR2,Vector2);
|
DEFAULT_OP_LOCALMEM(==,VECTOR2,Vector2);
|
||||||
DEFAULT_OP_LOCALMEM(==,RECT2,Rect2);
|
DEFAULT_OP_LOCALMEM(==,RECT2,Rect2);
|
||||||
DEFAULT_OP_PTRREF(==,MATRIX32,_matrix32);
|
DEFAULT_OP_PTRREF(==,TRANSFORM2D,_transform2d);
|
||||||
DEFAULT_OP_LOCALMEM(==,VECTOR3,Vector3);
|
DEFAULT_OP_LOCALMEM(==,VECTOR3,Vector3);
|
||||||
DEFAULT_OP_LOCALMEM(==,PLANE,Plane);
|
DEFAULT_OP_LOCALMEM(==,PLANE,Plane);
|
||||||
DEFAULT_OP_LOCALMEM(==,QUAT,Quat);
|
DEFAULT_OP_LOCALMEM(==,QUAT,Quat);
|
||||||
DEFAULT_OP_PTRREF(==,_AABB,_aabb);
|
DEFAULT_OP_PTRREF(==,RECT3,_rect3);
|
||||||
DEFAULT_OP_PTRREF(==,MATRIX3,_matrix3);
|
DEFAULT_OP_PTRREF(==,BASIS,_basis);
|
||||||
DEFAULT_OP_PTRREF(==,TRANSFORM,_transform);
|
DEFAULT_OP_PTRREF(==,TRANSFORM,_transform);
|
||||||
|
|
||||||
DEFAULT_OP_LOCALMEM(==,COLOR,Color);
|
DEFAULT_OP_LOCALMEM(==,COLOR,Color);
|
||||||
|
@ -316,13 +316,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_OP_ARRAY_EQ(RAW_ARRAY,uint8_t);
|
DEFAULT_OP_ARRAY_EQ(POOL_BYTE_ARRAY,uint8_t);
|
||||||
DEFAULT_OP_ARRAY_EQ(INT_ARRAY,int);
|
DEFAULT_OP_ARRAY_EQ(POOL_INT_ARRAY,int);
|
||||||
DEFAULT_OP_ARRAY_EQ(REAL_ARRAY,real_t);
|
DEFAULT_OP_ARRAY_EQ(POOL_REAL_ARRAY,real_t);
|
||||||
DEFAULT_OP_ARRAY_EQ(STRING_ARRAY,String);
|
DEFAULT_OP_ARRAY_EQ(POOL_STRING_ARRAY,String);
|
||||||
DEFAULT_OP_ARRAY_EQ(VECTOR2_ARRAY,Vector3);
|
DEFAULT_OP_ARRAY_EQ(POOL_VECTOR2_ARRAY,Vector3);
|
||||||
DEFAULT_OP_ARRAY_EQ(VECTOR3_ARRAY,Vector3);
|
DEFAULT_OP_ARRAY_EQ(POOL_VECTOR3_ARRAY,Vector3);
|
||||||
DEFAULT_OP_ARRAY_EQ(COLOR_ARRAY,Color);
|
DEFAULT_OP_ARRAY_EQ(POOL_COLOR_ARRAY,Color);
|
||||||
|
|
||||||
case VARIANT_MAX: {
|
case VARIANT_MAX: {
|
||||||
r_valid=false;
|
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_STR(<,STRING,String);
|
||||||
DEFAULT_OP_LOCALMEM(<,VECTOR2,Vector2);
|
DEFAULT_OP_LOCALMEM(<,VECTOR2,Vector2);
|
||||||
DEFAULT_OP_FAIL(RECT2);
|
DEFAULT_OP_FAIL(RECT2);
|
||||||
DEFAULT_OP_FAIL(MATRIX32);
|
DEFAULT_OP_FAIL(TRANSFORM2D);
|
||||||
DEFAULT_OP_LOCALMEM(<,VECTOR3,Vector3);
|
DEFAULT_OP_LOCALMEM(<,VECTOR3,Vector3);
|
||||||
DEFAULT_OP_FAIL(PLANE);
|
DEFAULT_OP_FAIL(PLANE);
|
||||||
DEFAULT_OP_FAIL(QUAT);
|
DEFAULT_OP_FAIL(QUAT);
|
||||||
DEFAULT_OP_FAIL(_AABB);
|
DEFAULT_OP_FAIL(RECT3);
|
||||||
DEFAULT_OP_FAIL(MATRIX3);
|
DEFAULT_OP_FAIL(BASIS);
|
||||||
DEFAULT_OP_FAIL(TRANSFORM);
|
DEFAULT_OP_FAIL(TRANSFORM);
|
||||||
|
|
||||||
DEFAULT_OP_FAIL(COLOR);
|
DEFAULT_OP_FAIL(COLOR);
|
||||||
|
@ -393,13 +393,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
|
||||||
_RETURN( false );
|
_RETURN( false );
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
DEFAULT_OP_ARRAY_LT(RAW_ARRAY,uint8_t);
|
DEFAULT_OP_ARRAY_LT(POOL_BYTE_ARRAY,uint8_t);
|
||||||
DEFAULT_OP_ARRAY_LT(INT_ARRAY,int);
|
DEFAULT_OP_ARRAY_LT(POOL_INT_ARRAY,int);
|
||||||
DEFAULT_OP_ARRAY_LT(REAL_ARRAY,real_t);
|
DEFAULT_OP_ARRAY_LT(POOL_REAL_ARRAY,real_t);
|
||||||
DEFAULT_OP_ARRAY_LT(STRING_ARRAY,String);
|
DEFAULT_OP_ARRAY_LT(POOL_STRING_ARRAY,String);
|
||||||
DEFAULT_OP_ARRAY_LT(VECTOR2_ARRAY,Vector3);
|
DEFAULT_OP_ARRAY_LT(POOL_VECTOR2_ARRAY,Vector3);
|
||||||
DEFAULT_OP_ARRAY_LT(VECTOR3_ARRAY,Vector3);
|
DEFAULT_OP_ARRAY_LT(POOL_VECTOR3_ARRAY,Vector3);
|
||||||
DEFAULT_OP_ARRAY_LT(COLOR_ARRAY,Color);
|
DEFAULT_OP_ARRAY_LT(POOL_COLOR_ARRAY,Color);
|
||||||
case VARIANT_MAX: {
|
case VARIANT_MAX: {
|
||||||
r_valid=false;
|
r_valid=false;
|
||||||
return;
|
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_STR(<=,STRING,String);
|
||||||
DEFAULT_OP_LOCALMEM(<=,VECTOR2,Vector2);
|
DEFAULT_OP_LOCALMEM(<=,VECTOR2,Vector2);
|
||||||
DEFAULT_OP_FAIL(RECT2);
|
DEFAULT_OP_FAIL(RECT2);
|
||||||
DEFAULT_OP_FAIL(MATRIX32);
|
DEFAULT_OP_FAIL(TRANSFORM2D);
|
||||||
DEFAULT_OP_LOCALMEM(<=,VECTOR3,Vector3);
|
DEFAULT_OP_LOCALMEM(<=,VECTOR3,Vector3);
|
||||||
DEFAULT_OP_FAIL(PLANE);
|
DEFAULT_OP_FAIL(PLANE);
|
||||||
DEFAULT_OP_FAIL(QUAT);
|
DEFAULT_OP_FAIL(QUAT);
|
||||||
DEFAULT_OP_FAIL(_AABB);
|
DEFAULT_OP_FAIL(RECT3);
|
||||||
DEFAULT_OP_FAIL(MATRIX3);
|
DEFAULT_OP_FAIL(BASIS);
|
||||||
DEFAULT_OP_FAIL(TRANSFORM);
|
DEFAULT_OP_FAIL(TRANSFORM);
|
||||||
|
|
||||||
DEFAULT_OP_FAIL(COLOR);
|
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(INPUT_EVENT);
|
||||||
DEFAULT_OP_FAIL(DICTIONARY);
|
DEFAULT_OP_FAIL(DICTIONARY);
|
||||||
DEFAULT_OP_FAIL(ARRAY);
|
DEFAULT_OP_FAIL(ARRAY);
|
||||||
DEFAULT_OP_FAIL(RAW_ARRAY);
|
DEFAULT_OP_FAIL(POOL_BYTE_ARRAY);
|
||||||
DEFAULT_OP_FAIL(INT_ARRAY);
|
DEFAULT_OP_FAIL(POOL_INT_ARRAY);
|
||||||
DEFAULT_OP_FAIL(REAL_ARRAY);
|
DEFAULT_OP_FAIL(POOL_REAL_ARRAY);
|
||||||
DEFAULT_OP_FAIL(STRING_ARRAY);
|
DEFAULT_OP_FAIL(POOL_STRING_ARRAY);
|
||||||
DEFAULT_OP_FAIL(VECTOR2_ARRAY);
|
DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY);
|
||||||
DEFAULT_OP_FAIL(VECTOR3_ARRAY);
|
DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY);
|
||||||
DEFAULT_OP_FAIL(COLOR_ARRAY);
|
DEFAULT_OP_FAIL(POOL_COLOR_ARRAY);
|
||||||
case VARIANT_MAX: {
|
case VARIANT_MAX: {
|
||||||
r_valid=false;
|
r_valid=false;
|
||||||
return;
|
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_STR(+,STRING,String);
|
||||||
DEFAULT_OP_LOCALMEM(+,VECTOR2,Vector2);
|
DEFAULT_OP_LOCALMEM(+,VECTOR2,Vector2);
|
||||||
DEFAULT_OP_FAIL(RECT2);
|
DEFAULT_OP_FAIL(RECT2);
|
||||||
DEFAULT_OP_FAIL(MATRIX32);
|
DEFAULT_OP_FAIL(TRANSFORM2D);
|
||||||
DEFAULT_OP_LOCALMEM(+,VECTOR3,Vector3);
|
DEFAULT_OP_LOCALMEM(+,VECTOR3,Vector3);
|
||||||
DEFAULT_OP_FAIL(PLANE);
|
DEFAULT_OP_FAIL(PLANE);
|
||||||
DEFAULT_OP_LOCALMEM(+, QUAT, Quat);
|
DEFAULT_OP_LOCALMEM(+, QUAT, Quat);
|
||||||
DEFAULT_OP_FAIL(_AABB);
|
DEFAULT_OP_FAIL(RECT3);
|
||||||
DEFAULT_OP_FAIL(MATRIX3);
|
DEFAULT_OP_FAIL(BASIS);
|
||||||
DEFAULT_OP_FAIL(TRANSFORM);
|
DEFAULT_OP_FAIL(TRANSFORM);
|
||||||
|
|
||||||
DEFAULT_OP_FAIL(COLOR);
|
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];
|
sum[i+asize]=array_b[i];
|
||||||
_RETURN( sum );
|
_RETURN( sum );
|
||||||
}
|
}
|
||||||
DEFAULT_OP_ARRAY_ADD(RAW_ARRAY,uint8_t);
|
DEFAULT_OP_ARRAY_ADD(POOL_BYTE_ARRAY,uint8_t);
|
||||||
DEFAULT_OP_ARRAY_ADD(INT_ARRAY,int);
|
DEFAULT_OP_ARRAY_ADD(POOL_INT_ARRAY,int);
|
||||||
DEFAULT_OP_ARRAY_ADD(REAL_ARRAY,real_t);
|
DEFAULT_OP_ARRAY_ADD(POOL_REAL_ARRAY,real_t);
|
||||||
DEFAULT_OP_ARRAY_ADD(STRING_ARRAY,String);
|
DEFAULT_OP_ARRAY_ADD(POOL_STRING_ARRAY,String);
|
||||||
DEFAULT_OP_ARRAY_ADD(VECTOR2_ARRAY,Vector2);
|
DEFAULT_OP_ARRAY_ADD(POOL_VECTOR2_ARRAY,Vector2);
|
||||||
DEFAULT_OP_ARRAY_ADD(VECTOR3_ARRAY,Vector3);
|
DEFAULT_OP_ARRAY_ADD(POOL_VECTOR3_ARRAY,Vector3);
|
||||||
DEFAULT_OP_ARRAY_ADD(COLOR_ARRAY,Color);
|
DEFAULT_OP_ARRAY_ADD(POOL_COLOR_ARRAY,Color);
|
||||||
case VARIANT_MAX: {
|
case VARIANT_MAX: {
|
||||||
r_valid=false;
|
r_valid=false;
|
||||||
return;
|
return;
|
||||||
|
@ -542,12 +542,12 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
|
||||||
DEFAULT_OP_FAIL(STRING);
|
DEFAULT_OP_FAIL(STRING);
|
||||||
DEFAULT_OP_LOCALMEM(-,VECTOR2,Vector2);
|
DEFAULT_OP_LOCALMEM(-,VECTOR2,Vector2);
|
||||||
DEFAULT_OP_FAIL(RECT2);
|
DEFAULT_OP_FAIL(RECT2);
|
||||||
DEFAULT_OP_FAIL(MATRIX32);
|
DEFAULT_OP_FAIL(TRANSFORM2D);
|
||||||
DEFAULT_OP_LOCALMEM(-,VECTOR3,Vector3);
|
DEFAULT_OP_LOCALMEM(-,VECTOR3,Vector3);
|
||||||
DEFAULT_OP_FAIL(PLANE);
|
DEFAULT_OP_FAIL(PLANE);
|
||||||
DEFAULT_OP_LOCALMEM(-, QUAT, Quat);
|
DEFAULT_OP_LOCALMEM(-, QUAT, Quat);
|
||||||
DEFAULT_OP_FAIL(_AABB);
|
DEFAULT_OP_FAIL(RECT3);
|
||||||
DEFAULT_OP_FAIL(MATRIX3);
|
DEFAULT_OP_FAIL(BASIS);
|
||||||
DEFAULT_OP_FAIL(TRANSFORM);
|
DEFAULT_OP_FAIL(TRANSFORM);
|
||||||
|
|
||||||
DEFAULT_OP_FAIL(COLOR);
|
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(INPUT_EVENT);
|
||||||
DEFAULT_OP_FAIL(DICTIONARY);
|
DEFAULT_OP_FAIL(DICTIONARY);
|
||||||
DEFAULT_OP_FAIL(ARRAY);
|
DEFAULT_OP_FAIL(ARRAY);
|
||||||
DEFAULT_OP_FAIL(RAW_ARRAY);
|
DEFAULT_OP_FAIL(POOL_BYTE_ARRAY);
|
||||||
DEFAULT_OP_FAIL(INT_ARRAY);
|
DEFAULT_OP_FAIL(POOL_INT_ARRAY);
|
||||||
DEFAULT_OP_FAIL(REAL_ARRAY);
|
DEFAULT_OP_FAIL(POOL_REAL_ARRAY);
|
||||||
DEFAULT_OP_FAIL(STRING_ARRAY);
|
DEFAULT_OP_FAIL(POOL_STRING_ARRAY);
|
||||||
DEFAULT_OP_FAIL(VECTOR2_ARRAY);
|
DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY);
|
||||||
DEFAULT_OP_FAIL(VECTOR3_ARRAY);
|
DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY);
|
||||||
DEFAULT_OP_FAIL(COLOR_ARRAY);
|
DEFAULT_OP_FAIL(POOL_COLOR_ARRAY);
|
||||||
case VARIANT_MAX: {
|
case VARIANT_MAX: {
|
||||||
r_valid=false;
|
r_valid=false;
|
||||||
return;
|
return;
|
||||||
|
@ -583,13 +583,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
|
||||||
DEFAULT_OP_FAIL(STRING);
|
DEFAULT_OP_FAIL(STRING);
|
||||||
DEFAULT_OP_LOCALMEM_NUM(*,VECTOR2,Vector2);
|
DEFAULT_OP_LOCALMEM_NUM(*,VECTOR2,Vector2);
|
||||||
DEFAULT_OP_FAIL(RECT2);
|
DEFAULT_OP_FAIL(RECT2);
|
||||||
case MATRIX32: {
|
case TRANSFORM2D: {
|
||||||
|
|
||||||
if (p_b.type==MATRIX32) {
|
if (p_b.type==TRANSFORM2D) {
|
||||||
_RETURN( *p_a._data._matrix32 * *p_b._data._matrix32 );
|
_RETURN( *p_a._data._transform2d * *p_b._data._transform2d );
|
||||||
};
|
};
|
||||||
if (p_b.type==VECTOR2) {
|
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;
|
r_valid=false;
|
||||||
return;
|
return;
|
||||||
|
@ -615,18 +615,18 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
|
||||||
r_valid=false;
|
r_valid=false;
|
||||||
return;
|
return;
|
||||||
} break;
|
} break;
|
||||||
DEFAULT_OP_FAIL(_AABB);
|
DEFAULT_OP_FAIL(RECT3);
|
||||||
case MATRIX3: {
|
case BASIS: {
|
||||||
|
|
||||||
switch(p_b.type) {
|
switch(p_b.type) {
|
||||||
case VECTOR3: {
|
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: {}
|
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(INPUT_EVENT);
|
||||||
DEFAULT_OP_FAIL(DICTIONARY);
|
DEFAULT_OP_FAIL(DICTIONARY);
|
||||||
DEFAULT_OP_FAIL(ARRAY);
|
DEFAULT_OP_FAIL(ARRAY);
|
||||||
DEFAULT_OP_FAIL(RAW_ARRAY);
|
DEFAULT_OP_FAIL(POOL_BYTE_ARRAY);
|
||||||
DEFAULT_OP_FAIL(INT_ARRAY);
|
DEFAULT_OP_FAIL(POOL_INT_ARRAY);
|
||||||
DEFAULT_OP_FAIL(REAL_ARRAY);
|
DEFAULT_OP_FAIL(POOL_REAL_ARRAY);
|
||||||
DEFAULT_OP_FAIL(STRING_ARRAY);
|
DEFAULT_OP_FAIL(POOL_STRING_ARRAY);
|
||||||
DEFAULT_OP_FAIL(VECTOR2_ARRAY);
|
DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY);
|
||||||
DEFAULT_OP_FAIL(VECTOR3_ARRAY);
|
DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY);
|
||||||
DEFAULT_OP_FAIL(COLOR_ARRAY);
|
DEFAULT_OP_FAIL(POOL_COLOR_ARRAY);
|
||||||
case VARIANT_MAX: {
|
case VARIANT_MAX: {
|
||||||
r_valid=false;
|
r_valid=false;
|
||||||
return;
|
return;
|
||||||
|
@ -712,7 +712,7 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
|
||||||
DEFAULT_OP_FAIL(STRING);
|
DEFAULT_OP_FAIL(STRING);
|
||||||
DEFAULT_OP_LOCALMEM_NUM(/,VECTOR2,Vector2);
|
DEFAULT_OP_LOCALMEM_NUM(/,VECTOR2,Vector2);
|
||||||
DEFAULT_OP_FAIL(RECT2);
|
DEFAULT_OP_FAIL(RECT2);
|
||||||
DEFAULT_OP_FAIL(MATRIX32);
|
DEFAULT_OP_FAIL(TRANSFORM2D);
|
||||||
DEFAULT_OP_LOCALMEM_NUM(/,VECTOR3,Vector3);
|
DEFAULT_OP_LOCALMEM_NUM(/,VECTOR3,Vector3);
|
||||||
DEFAULT_OP_FAIL(PLANE);
|
DEFAULT_OP_FAIL(PLANE);
|
||||||
case QUAT: {
|
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);
|
_RETURN( *reinterpret_cast<const Quat*>(p_a._data._mem) / p_b._data._real);
|
||||||
} break;
|
} break;
|
||||||
DEFAULT_OP_FAIL(_AABB);
|
DEFAULT_OP_FAIL(RECT3);
|
||||||
DEFAULT_OP_FAIL(MATRIX3);
|
DEFAULT_OP_FAIL(BASIS);
|
||||||
DEFAULT_OP_FAIL(TRANSFORM);
|
DEFAULT_OP_FAIL(TRANSFORM);
|
||||||
|
|
||||||
DEFAULT_OP_FAIL(COLOR);
|
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(INPUT_EVENT);
|
||||||
DEFAULT_OP_FAIL(DICTIONARY);
|
DEFAULT_OP_FAIL(DICTIONARY);
|
||||||
DEFAULT_OP_FAIL(ARRAY);
|
DEFAULT_OP_FAIL(ARRAY);
|
||||||
DEFAULT_OP_FAIL(RAW_ARRAY);
|
DEFAULT_OP_FAIL(POOL_BYTE_ARRAY);
|
||||||
DEFAULT_OP_FAIL(INT_ARRAY);
|
DEFAULT_OP_FAIL(POOL_INT_ARRAY);
|
||||||
DEFAULT_OP_FAIL(REAL_ARRAY);
|
DEFAULT_OP_FAIL(POOL_REAL_ARRAY);
|
||||||
DEFAULT_OP_FAIL(STRING_ARRAY);
|
DEFAULT_OP_FAIL(POOL_STRING_ARRAY);
|
||||||
DEFAULT_OP_FAIL(VECTOR2_ARRAY);
|
DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY);
|
||||||
DEFAULT_OP_FAIL(VECTOR3_ARRAY);
|
DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY);
|
||||||
DEFAULT_OP_FAIL(COLOR_ARRAY);
|
DEFAULT_OP_FAIL(POOL_COLOR_ARRAY);
|
||||||
case VARIANT_MAX: {
|
case VARIANT_MAX: {
|
||||||
r_valid=false;
|
r_valid=false;
|
||||||
return;
|
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(NIL);
|
||||||
DEFAULT_OP_FAIL(STRING);
|
DEFAULT_OP_FAIL(STRING);
|
||||||
DEFAULT_OP_FAIL(RECT2);
|
DEFAULT_OP_FAIL(RECT2);
|
||||||
DEFAULT_OP_FAIL(MATRIX32);
|
DEFAULT_OP_FAIL(TRANSFORM2D);
|
||||||
DEFAULT_OP_FAIL(_AABB);
|
DEFAULT_OP_FAIL(RECT3);
|
||||||
DEFAULT_OP_FAIL(MATRIX3);
|
DEFAULT_OP_FAIL(BASIS);
|
||||||
DEFAULT_OP_FAIL(TRANSFORM);
|
DEFAULT_OP_FAIL(TRANSFORM);
|
||||||
DEFAULT_OP_NUM_POS(BOOL,_bool);
|
DEFAULT_OP_NUM_POS(BOOL,_bool);
|
||||||
DEFAULT_OP_NUM_POS(INT,_int);
|
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(INPUT_EVENT);
|
||||||
DEFAULT_OP_FAIL(DICTIONARY);
|
DEFAULT_OP_FAIL(DICTIONARY);
|
||||||
DEFAULT_OP_FAIL(ARRAY);
|
DEFAULT_OP_FAIL(ARRAY);
|
||||||
DEFAULT_OP_FAIL(RAW_ARRAY);
|
DEFAULT_OP_FAIL(POOL_BYTE_ARRAY);
|
||||||
DEFAULT_OP_FAIL(INT_ARRAY);
|
DEFAULT_OP_FAIL(POOL_INT_ARRAY);
|
||||||
DEFAULT_OP_FAIL(REAL_ARRAY);
|
DEFAULT_OP_FAIL(POOL_REAL_ARRAY);
|
||||||
DEFAULT_OP_FAIL(STRING_ARRAY);
|
DEFAULT_OP_FAIL(POOL_STRING_ARRAY);
|
||||||
DEFAULT_OP_FAIL(VECTOR2_ARRAY);
|
DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY);
|
||||||
DEFAULT_OP_FAIL(VECTOR3_ARRAY);
|
DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY);
|
||||||
DEFAULT_OP_FAIL(COLOR_ARRAY);
|
DEFAULT_OP_FAIL(POOL_COLOR_ARRAY);
|
||||||
case VARIANT_MAX: {
|
case VARIANT_MAX: {
|
||||||
r_valid=false;
|
r_valid=false;
|
||||||
return;
|
return;
|
||||||
|
@ -802,12 +802,12 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
|
||||||
DEFAULT_OP_FAIL(STRING);
|
DEFAULT_OP_FAIL(STRING);
|
||||||
DEFAULT_OP_LOCALMEM_NEG(VECTOR2,Vector2);
|
DEFAULT_OP_LOCALMEM_NEG(VECTOR2,Vector2);
|
||||||
DEFAULT_OP_FAIL(RECT2);
|
DEFAULT_OP_FAIL(RECT2);
|
||||||
DEFAULT_OP_FAIL(MATRIX32);
|
DEFAULT_OP_FAIL(TRANSFORM2D);
|
||||||
DEFAULT_OP_LOCALMEM_NEG(VECTOR3,Vector3);
|
DEFAULT_OP_LOCALMEM_NEG(VECTOR3,Vector3);
|
||||||
DEFAULT_OP_LOCALMEM_NEG(PLANE,Plane);
|
DEFAULT_OP_LOCALMEM_NEG(PLANE,Plane);
|
||||||
DEFAULT_OP_LOCALMEM_NEG(QUAT,Quat);
|
DEFAULT_OP_LOCALMEM_NEG(QUAT,Quat);
|
||||||
DEFAULT_OP_FAIL(_AABB);
|
DEFAULT_OP_FAIL(RECT3);
|
||||||
DEFAULT_OP_FAIL(MATRIX3);
|
DEFAULT_OP_FAIL(BASIS);
|
||||||
DEFAULT_OP_FAIL(TRANSFORM);
|
DEFAULT_OP_FAIL(TRANSFORM);
|
||||||
|
|
||||||
DEFAULT_OP_FAIL(COLOR);
|
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(INPUT_EVENT);
|
||||||
DEFAULT_OP_FAIL(DICTIONARY);
|
DEFAULT_OP_FAIL(DICTIONARY);
|
||||||
DEFAULT_OP_FAIL(ARRAY);
|
DEFAULT_OP_FAIL(ARRAY);
|
||||||
DEFAULT_OP_FAIL(RAW_ARRAY);
|
DEFAULT_OP_FAIL(POOL_BYTE_ARRAY);
|
||||||
DEFAULT_OP_FAIL(INT_ARRAY);
|
DEFAULT_OP_FAIL(POOL_INT_ARRAY);
|
||||||
DEFAULT_OP_FAIL(REAL_ARRAY);
|
DEFAULT_OP_FAIL(POOL_REAL_ARRAY);
|
||||||
DEFAULT_OP_FAIL(STRING_ARRAY);
|
DEFAULT_OP_FAIL(POOL_STRING_ARRAY);
|
||||||
DEFAULT_OP_FAIL(VECTOR2_ARRAY);
|
DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY);
|
||||||
DEFAULT_OP_FAIL(VECTOR3_ARRAY);
|
DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY);
|
||||||
DEFAULT_OP_FAIL(COLOR_ARRAY);
|
DEFAULT_OP_FAIL(POOL_COLOR_ARRAY);
|
||||||
case VARIANT_MAX: {
|
case VARIANT_MAX: {
|
||||||
r_valid=false;
|
r_valid=false;
|
||||||
return;
|
return;
|
||||||
|
@ -1157,7 +1157,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case MATRIX32: {
|
case TRANSFORM2D: {
|
||||||
|
|
||||||
if (p_value.type!=Variant::VECTOR2)
|
if (p_value.type!=Variant::VECTOR2)
|
||||||
return;
|
return;
|
||||||
|
@ -1169,7 +1169,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
|
||||||
if (index<0)
|
if (index<0)
|
||||||
index += 3;
|
index += 3;
|
||||||
if (index>=0 && index<3) {
|
if (index>=0 && index<3) {
|
||||||
Matrix32 *v=_data._matrix32;
|
Transform2D *v=_data._transform2d;
|
||||||
|
|
||||||
valid=true;
|
valid=true;
|
||||||
v->elements[index]=p_value;
|
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
|
//scalar name
|
||||||
const String *str=reinterpret_cast<const String*>(p_index._data._mem);
|
const String *str=reinterpret_cast<const String*>(p_index._data._mem);
|
||||||
Matrix32 *v=_data._matrix32;
|
Transform2D *v=_data._transform2d;
|
||||||
if (*str=="x") {
|
if (*str=="x") {
|
||||||
valid=true;
|
valid=true;
|
||||||
v->elements[0]=p_value;
|
v->elements[0]=p_value;
|
||||||
|
@ -1305,7 +1305,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case _AABB: {
|
case RECT3: {
|
||||||
|
|
||||||
if (p_value.type!=Variant::VECTOR3)
|
if (p_value.type!=Variant::VECTOR3)
|
||||||
return;
|
return;
|
||||||
|
@ -1315,7 +1315,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
|
||||||
//scalar name
|
//scalar name
|
||||||
|
|
||||||
const String *str=reinterpret_cast<const String*>(p_index._data._mem);
|
const String *str=reinterpret_cast<const String*>(p_index._data._mem);
|
||||||
AABB *v=_data._aabb;
|
Rect3 *v=_data._rect3;
|
||||||
if (*str=="pos") {
|
if (*str=="pos") {
|
||||||
valid=true;
|
valid=true;
|
||||||
v->pos=p_value;
|
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
|
} break; //sorry naming convention fail :( not like it's used often // 10
|
||||||
case MATRIX3: {
|
case BASIS: {
|
||||||
|
|
||||||
if (p_value.type!=Variant::VECTOR3)
|
if (p_value.type!=Variant::VECTOR3)
|
||||||
return;
|
return;
|
||||||
|
@ -1343,7 +1343,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
|
||||||
if (index<0)
|
if (index<0)
|
||||||
index += 3;
|
index += 3;
|
||||||
if (index>=0 && index<3) {
|
if (index>=0 && index<3) {
|
||||||
Matrix3 *v=_data._matrix3;
|
Basis *v=_data._basis;
|
||||||
|
|
||||||
valid=true;
|
valid=true;
|
||||||
v->set_axis(index,p_value);
|
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) {
|
} else if (p_index.get_type()==Variant::STRING) {
|
||||||
|
|
||||||
const String *str=reinterpret_cast<const String*>(p_index._data._mem);
|
const String *str=reinterpret_cast<const String*>(p_index._data._mem);
|
||||||
Matrix3 *v=_data._matrix3;
|
Basis *v=_data._basis;
|
||||||
|
|
||||||
if (*str=="x") {
|
if (*str=="x") {
|
||||||
valid=true;
|
valid=true;
|
||||||
|
@ -1398,7 +1398,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
|
||||||
|
|
||||||
if (*str=="basis") {
|
if (*str=="basis") {
|
||||||
|
|
||||||
if (p_value.type!=Variant::MATRIX3)
|
if (p_value.type!=Variant::BASIS)
|
||||||
return;
|
return;
|
||||||
valid=true;
|
valid=true;
|
||||||
v->basis=p_value;
|
v->basis=p_value;
|
||||||
|
@ -1887,13 +1887,13 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
|
||||||
return;
|
return;
|
||||||
} break; // 20
|
} break; // 20
|
||||||
DEFAULT_OP_ARRAY_CMD(ARRAY, Array, ;, (*arr)[index]=p_value;return)
|
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(POOL_BYTE_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(POOL_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(POOL_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(POOL_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(POOL_VECTOR2_ARRAY, Vector2, p_value.type != Variant::VECTOR2)
|
||||||
DEFAULT_OP_DVECTOR_SET(VECTOR3_ARRAY, Vector3, p_value.type != Variant::VECTOR3)
|
DEFAULT_OP_DVECTOR_SET(POOL_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_COLOR_ARRAY, Color, p_value.type != Variant::COLOR)
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2007,7 +2007,7 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case MATRIX32: {
|
case TRANSFORM2D: {
|
||||||
|
|
||||||
if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) {
|
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)
|
if (index<0)
|
||||||
index += 3;
|
index += 3;
|
||||||
if (index>=0 && index<3) {
|
if (index>=0 && index<3) {
|
||||||
const Matrix32 *v=_data._matrix32;
|
const Transform2D *v=_data._transform2d;
|
||||||
|
|
||||||
valid=true;
|
valid=true;
|
||||||
return v->elements[index];
|
return v->elements[index];
|
||||||
|
@ -2025,7 +2025,7 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const {
|
||||||
|
|
||||||
//scalar name
|
//scalar name
|
||||||
const String *str=reinterpret_cast<const String*>(p_index._data._mem);
|
const String *str=reinterpret_cast<const String*>(p_index._data._mem);
|
||||||
const Matrix32 *v=_data._matrix32;
|
const Transform2D *v=_data._transform2d;
|
||||||
if (*str=="x") {
|
if (*str=="x") {
|
||||||
valid=true;
|
valid=true;
|
||||||
return v->elements[0];
|
return v->elements[0];
|
||||||
|
@ -2086,13 +2086,13 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case _AABB: {
|
case RECT3: {
|
||||||
|
|
||||||
if (p_index.get_type()==Variant::STRING) {
|
if (p_index.get_type()==Variant::STRING) {
|
||||||
//scalar name
|
//scalar name
|
||||||
|
|
||||||
const String *str=reinterpret_cast<const String*>(p_index._data._mem);
|
const String *str=reinterpret_cast<const String*>(p_index._data._mem);
|
||||||
const AABB *v=_data._aabb;
|
const Rect3 *v=_data._rect3;
|
||||||
if (*str=="pos") {
|
if (*str=="pos") {
|
||||||
valid=true;
|
valid=true;
|
||||||
return v->pos;
|
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
|
} 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) {
|
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)
|
if (index<0)
|
||||||
index += 3;
|
index += 3;
|
||||||
if (index>=0 && index<3) {
|
if (index>=0 && index<3) {
|
||||||
const Matrix3 *v=_data._matrix3;
|
const Basis *v=_data._basis;
|
||||||
|
|
||||||
valid=true;
|
valid=true;
|
||||||
return v->get_axis(index);
|
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) {
|
} else if (p_index.get_type()==Variant::STRING) {
|
||||||
|
|
||||||
const String *str=reinterpret_cast<const String*>(p_index._data._mem);
|
const String *str=reinterpret_cast<const String*>(p_index._data._mem);
|
||||||
const Matrix3 *v=_data._matrix3;
|
const Basis *v=_data._basis;
|
||||||
|
|
||||||
if (*str=="x") {
|
if (*str=="x") {
|
||||||
valid=true;
|
valid=true;
|
||||||
|
@ -2471,13 +2471,13 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const {
|
||||||
}
|
}
|
||||||
} break; // 20
|
} break; // 20
|
||||||
DEFAULT_OP_ARRAY_CMD(ARRAY, const Array, ;, return (*arr)[index])
|
DEFAULT_OP_ARRAY_CMD(ARRAY, const Array, ;, return (*arr)[index])
|
||||||
DEFAULT_OP_DVECTOR_GET(RAW_ARRAY, uint8_t)
|
DEFAULT_OP_DVECTOR_GET(POOL_BYTE_ARRAY, uint8_t)
|
||||||
DEFAULT_OP_DVECTOR_GET(INT_ARRAY, int)
|
DEFAULT_OP_DVECTOR_GET(POOL_INT_ARRAY, int)
|
||||||
DEFAULT_OP_DVECTOR_GET(REAL_ARRAY, real_t)
|
DEFAULT_OP_DVECTOR_GET(POOL_REAL_ARRAY, real_t)
|
||||||
DEFAULT_OP_DVECTOR_GET(STRING_ARRAY, String)
|
DEFAULT_OP_DVECTOR_GET(POOL_STRING_ARRAY, String)
|
||||||
DEFAULT_OP_DVECTOR_GET(VECTOR2_ARRAY, Vector2)
|
DEFAULT_OP_DVECTOR_GET(POOL_VECTOR2_ARRAY, Vector2)
|
||||||
DEFAULT_OP_DVECTOR_GET(VECTOR3_ARRAY, Vector3)
|
DEFAULT_OP_DVECTOR_GET(POOL_VECTOR3_ARRAY, Vector3)
|
||||||
DEFAULT_OP_DVECTOR_GET(COLOR_ARRAY, Color)
|
DEFAULT_OP_DVECTOR_GET(POOL_COLOR_ARRAY, Color)
|
||||||
default: return Variant();
|
default: return Variant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2557,7 +2557,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case RAW_ARRAY: {
|
case POOL_BYTE_ARRAY: {
|
||||||
if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) {
|
if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) {
|
||||||
|
|
||||||
int index = p_index;
|
int index = p_index;
|
||||||
|
@ -2576,7 +2576,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case INT_ARRAY: {
|
case POOL_INT_ARRAY: {
|
||||||
if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) {
|
if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) {
|
||||||
|
|
||||||
int index = p_index;
|
int index = p_index;
|
||||||
|
@ -2594,7 +2594,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case REAL_ARRAY: {
|
case POOL_REAL_ARRAY: {
|
||||||
|
|
||||||
if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) {
|
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;
|
} break;
|
||||||
case STRING_ARRAY: {
|
case POOL_STRING_ARRAY: {
|
||||||
if (p_index.get_type()==Variant::STRING) {
|
if (p_index.get_type()==Variant::STRING) {
|
||||||
|
|
||||||
String index = p_index;
|
String index = p_index;
|
||||||
|
@ -2634,7 +2634,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
} break; //25
|
} break; //25
|
||||||
case VECTOR2_ARRAY: {
|
case POOL_VECTOR2_ARRAY: {
|
||||||
if (p_index.get_type()==Variant::VECTOR2) {
|
if (p_index.get_type()==Variant::VECTOR2) {
|
||||||
|
|
||||||
Vector2 index = p_index;
|
Vector2 index = p_index;
|
||||||
|
@ -2654,7 +2654,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3_ARRAY: {
|
case POOL_VECTOR3_ARRAY: {
|
||||||
if (p_index.get_type()==Variant::VECTOR3) {
|
if (p_index.get_type()==Variant::VECTOR3) {
|
||||||
|
|
||||||
Vector3 index = p_index;
|
Vector3 index = p_index;
|
||||||
|
@ -2674,7 +2674,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case COLOR_ARRAY: {
|
case POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
if (p_index.get_type()==Variant::COLOR) {
|
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"));
|
p_list->push_back( PropertyInfo(Variant::REAL,"z"));
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case MATRIX32: {
|
case TRANSFORM2D: {
|
||||||
|
|
||||||
p_list->push_back( PropertyInfo(Variant::VECTOR2,"x"));
|
p_list->push_back( PropertyInfo(Variant::VECTOR2,"x"));
|
||||||
p_list->push_back( PropertyInfo(Variant::VECTOR2,"y"));
|
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"));
|
p_list->push_back( PropertyInfo(Variant::REAL,"w"));
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case _AABB: {
|
case RECT3: {
|
||||||
p_list->push_back( PropertyInfo(Variant::VECTOR3,"pos"));
|
p_list->push_back( PropertyInfo(Variant::VECTOR3,"pos"));
|
||||||
p_list->push_back( PropertyInfo(Variant::VECTOR3,"size"));
|
p_list->push_back( PropertyInfo(Variant::VECTOR3,"size"));
|
||||||
p_list->push_back( PropertyInfo(Variant::VECTOR3,"end"));
|
p_list->push_back( PropertyInfo(Variant::VECTOR3,"end"));
|
||||||
} break; //sorry naming convention fail :( not like it's used often // 10
|
} 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,"x"));
|
||||||
p_list->push_back( PropertyInfo(Variant::VECTOR3,"y"));
|
p_list->push_back( PropertyInfo(Variant::VECTOR3,"y"));
|
||||||
|
@ -2767,7 +2767,7 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const {
|
||||||
} break;
|
} break;
|
||||||
case TRANSFORM: {
|
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"));
|
p_list->push_back( PropertyInfo(Variant::VECTOR3,"origin"));
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
@ -2914,12 +2914,12 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const {
|
||||||
}
|
}
|
||||||
} break; // 20
|
} break; // 20
|
||||||
case ARRAY:
|
case ARRAY:
|
||||||
case RAW_ARRAY:
|
case POOL_BYTE_ARRAY:
|
||||||
case INT_ARRAY:
|
case POOL_INT_ARRAY:
|
||||||
case REAL_ARRAY:
|
case POOL_REAL_ARRAY:
|
||||||
case STRING_ARRAY:
|
case POOL_STRING_ARRAY:
|
||||||
case VECTOR3_ARRAY:
|
case POOL_VECTOR3_ARRAY:
|
||||||
case COLOR_ARRAY: {
|
case POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
//nothing
|
//nothing
|
||||||
} break;
|
} break;
|
||||||
|
@ -2991,7 +2991,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const {
|
||||||
r_iter=0;
|
r_iter=0;
|
||||||
return true;
|
return true;
|
||||||
} break;
|
} break;
|
||||||
case RAW_ARRAY: {
|
case POOL_BYTE_ARRAY: {
|
||||||
const PoolVector<uint8_t> *arr=reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem);
|
const PoolVector<uint8_t> *arr=reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem);
|
||||||
if (arr->size()==0)
|
if (arr->size()==0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -2999,7 +2999,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case INT_ARRAY: {
|
case POOL_INT_ARRAY: {
|
||||||
const PoolVector<int> *arr=reinterpret_cast<const PoolVector<int>*>(_data._mem);
|
const PoolVector<int> *arr=reinterpret_cast<const PoolVector<int>*>(_data._mem);
|
||||||
if (arr->size()==0)
|
if (arr->size()==0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -3007,7 +3007,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case REAL_ARRAY: {
|
case POOL_REAL_ARRAY: {
|
||||||
const PoolVector<real_t> *arr=reinterpret_cast<const PoolVector<real_t>*>(_data._mem);
|
const PoolVector<real_t> *arr=reinterpret_cast<const PoolVector<real_t>*>(_data._mem);
|
||||||
if (arr->size()==0)
|
if (arr->size()==0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -3015,14 +3015,14 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case STRING_ARRAY: {
|
case POOL_STRING_ARRAY: {
|
||||||
const PoolVector<String> *arr=reinterpret_cast<const PoolVector<String>*>(_data._mem);
|
const PoolVector<String> *arr=reinterpret_cast<const PoolVector<String>*>(_data._mem);
|
||||||
if (arr->size()==0)
|
if (arr->size()==0)
|
||||||
return false;
|
return false;
|
||||||
r_iter=0;
|
r_iter=0;
|
||||||
return true;
|
return true;
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2_ARRAY: {
|
case POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
const PoolVector<Vector2> *arr=reinterpret_cast<const PoolVector<Vector2>*>(_data._mem);
|
const PoolVector<Vector2> *arr=reinterpret_cast<const PoolVector<Vector2>*>(_data._mem);
|
||||||
if (arr->size()==0)
|
if (arr->size()==0)
|
||||||
|
@ -3030,7 +3030,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const {
|
||||||
r_iter=0;
|
r_iter=0;
|
||||||
return true;
|
return true;
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3_ARRAY: {
|
case POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
const PoolVector<Vector3> *arr=reinterpret_cast<const PoolVector<Vector3>*>(_data._mem);
|
const PoolVector<Vector3> *arr=reinterpret_cast<const PoolVector<Vector3>*>(_data._mem);
|
||||||
if (arr->size()==0)
|
if (arr->size()==0)
|
||||||
|
@ -3038,7 +3038,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const {
|
||||||
r_iter=0;
|
r_iter=0;
|
||||||
return true;
|
return true;
|
||||||
} break;
|
} break;
|
||||||
case COLOR_ARRAY: {
|
case POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
const PoolVector<Color> *arr=reinterpret_cast<const PoolVector<Color>*>(_data._mem);
|
const PoolVector<Color> *arr=reinterpret_cast<const PoolVector<Color>*>(_data._mem);
|
||||||
if (arr->size()==0)
|
if (arr->size()==0)
|
||||||
|
@ -3122,7 +3122,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const {
|
||||||
r_iter=idx;
|
r_iter=idx;
|
||||||
return true;
|
return true;
|
||||||
} break;
|
} break;
|
||||||
case RAW_ARRAY: {
|
case POOL_BYTE_ARRAY: {
|
||||||
const PoolVector<uint8_t> *arr=reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem);
|
const PoolVector<uint8_t> *arr=reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem);
|
||||||
int idx=r_iter;
|
int idx=r_iter;
|
||||||
idx++;
|
idx++;
|
||||||
|
@ -3132,7 +3132,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case INT_ARRAY: {
|
case POOL_INT_ARRAY: {
|
||||||
const PoolVector<int> *arr=reinterpret_cast<const PoolVector<int>*>(_data._mem);
|
const PoolVector<int> *arr=reinterpret_cast<const PoolVector<int>*>(_data._mem);
|
||||||
int idx=r_iter;
|
int idx=r_iter;
|
||||||
idx++;
|
idx++;
|
||||||
|
@ -3142,7 +3142,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case REAL_ARRAY: {
|
case POOL_REAL_ARRAY: {
|
||||||
const PoolVector<real_t> *arr=reinterpret_cast<const PoolVector<real_t>*>(_data._mem);
|
const PoolVector<real_t> *arr=reinterpret_cast<const PoolVector<real_t>*>(_data._mem);
|
||||||
int idx=r_iter;
|
int idx=r_iter;
|
||||||
idx++;
|
idx++;
|
||||||
|
@ -3152,7 +3152,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case STRING_ARRAY: {
|
case POOL_STRING_ARRAY: {
|
||||||
const PoolVector<String> *arr=reinterpret_cast<const PoolVector<String>*>(_data._mem);
|
const PoolVector<String> *arr=reinterpret_cast<const PoolVector<String>*>(_data._mem);
|
||||||
int idx=r_iter;
|
int idx=r_iter;
|
||||||
idx++;
|
idx++;
|
||||||
|
@ -3161,7 +3161,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const {
|
||||||
r_iter=idx;
|
r_iter=idx;
|
||||||
return true;
|
return true;
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2_ARRAY: {
|
case POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
const PoolVector<Vector2> *arr=reinterpret_cast<const PoolVector<Vector2>*>(_data._mem);
|
const PoolVector<Vector2> *arr=reinterpret_cast<const PoolVector<Vector2>*>(_data._mem);
|
||||||
int idx=r_iter;
|
int idx=r_iter;
|
||||||
|
@ -3171,7 +3171,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const {
|
||||||
r_iter=idx;
|
r_iter=idx;
|
||||||
return true;
|
return true;
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3_ARRAY: {
|
case POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
const PoolVector<Vector3> *arr=reinterpret_cast<const PoolVector<Vector3>*>(_data._mem);
|
const PoolVector<Vector3> *arr=reinterpret_cast<const PoolVector<Vector3>*>(_data._mem);
|
||||||
int idx=r_iter;
|
int idx=r_iter;
|
||||||
|
@ -3181,7 +3181,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const {
|
||||||
r_iter=idx;
|
r_iter=idx;
|
||||||
return true;
|
return true;
|
||||||
} break;
|
} break;
|
||||||
case COLOR_ARRAY: {
|
case POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
const PoolVector<Color> *arr=reinterpret_cast<const PoolVector<Color>*>(_data._mem);
|
const PoolVector<Color> *arr=reinterpret_cast<const PoolVector<Color>*>(_data._mem);
|
||||||
int idx=r_iter;
|
int idx=r_iter;
|
||||||
|
@ -3254,7 +3254,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const {
|
||||||
#endif
|
#endif
|
||||||
return arr->get(idx);
|
return arr->get(idx);
|
||||||
} break;
|
} break;
|
||||||
case RAW_ARRAY: {
|
case POOL_BYTE_ARRAY: {
|
||||||
const PoolVector<uint8_t> *arr=reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem);
|
const PoolVector<uint8_t> *arr=reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem);
|
||||||
int idx=r_iter;
|
int idx=r_iter;
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
|
@ -3265,7 +3265,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const {
|
||||||
#endif
|
#endif
|
||||||
return arr->get(idx);
|
return arr->get(idx);
|
||||||
} break;
|
} break;
|
||||||
case INT_ARRAY: {
|
case POOL_INT_ARRAY: {
|
||||||
const PoolVector<int> *arr=reinterpret_cast<const PoolVector<int>*>(_data._mem);
|
const PoolVector<int> *arr=reinterpret_cast<const PoolVector<int>*>(_data._mem);
|
||||||
int idx=r_iter;
|
int idx=r_iter;
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
|
@ -3276,7 +3276,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const {
|
||||||
#endif
|
#endif
|
||||||
return arr->get(idx);
|
return arr->get(idx);
|
||||||
} break;
|
} break;
|
||||||
case REAL_ARRAY: {
|
case POOL_REAL_ARRAY: {
|
||||||
const PoolVector<real_t> *arr=reinterpret_cast<const PoolVector<real_t>*>(_data._mem);
|
const PoolVector<real_t> *arr=reinterpret_cast<const PoolVector<real_t>*>(_data._mem);
|
||||||
int idx=r_iter;
|
int idx=r_iter;
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
|
@ -3287,7 +3287,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const {
|
||||||
#endif
|
#endif
|
||||||
return arr->get(idx);
|
return arr->get(idx);
|
||||||
} break;
|
} break;
|
||||||
case STRING_ARRAY: {
|
case POOL_STRING_ARRAY: {
|
||||||
const PoolVector<String> *arr=reinterpret_cast<const PoolVector<String>*>(_data._mem);
|
const PoolVector<String> *arr=reinterpret_cast<const PoolVector<String>*>(_data._mem);
|
||||||
int idx=r_iter;
|
int idx=r_iter;
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
|
@ -3298,7 +3298,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const {
|
||||||
#endif
|
#endif
|
||||||
return arr->get(idx);
|
return arr->get(idx);
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2_ARRAY: {
|
case POOL_VECTOR2_ARRAY: {
|
||||||
|
|
||||||
const PoolVector<Vector2> *arr=reinterpret_cast<const PoolVector<Vector2>*>(_data._mem);
|
const PoolVector<Vector2> *arr=reinterpret_cast<const PoolVector<Vector2>*>(_data._mem);
|
||||||
int idx=r_iter;
|
int idx=r_iter;
|
||||||
|
@ -3310,7 +3310,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const {
|
||||||
#endif
|
#endif
|
||||||
return arr->get(idx);
|
return arr->get(idx);
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3_ARRAY: {
|
case POOL_VECTOR3_ARRAY: {
|
||||||
|
|
||||||
const PoolVector<Vector3> *arr=reinterpret_cast<const PoolVector<Vector3>*>(_data._mem);
|
const PoolVector<Vector3> *arr=reinterpret_cast<const PoolVector<Vector3>*>(_data._mem);
|
||||||
int idx=r_iter;
|
int idx=r_iter;
|
||||||
|
@ -3322,7 +3322,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const {
|
||||||
#endif
|
#endif
|
||||||
return arr->get(idx);
|
return arr->get(idx);
|
||||||
} break;
|
} break;
|
||||||
case COLOR_ARRAY: {
|
case POOL_COLOR_ARRAY: {
|
||||||
|
|
||||||
const PoolVector<Color> *arr=reinterpret_cast<const PoolVector<Color>*>(_data._mem);
|
const PoolVector<Color> *arr=reinterpret_cast<const PoolVector<Color>*>(_data._mem);
|
||||||
int idx=r_iter;
|
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);
|
r_dst=Rect2(ra->pos + rb->pos * c, ra->size + rb->size * c);
|
||||||
} return;
|
} return;
|
||||||
case VECTOR3:{ r_dst=*reinterpret_cast<const Vector3*>(a._data._mem)+*reinterpret_cast<const Vector3*>(b._data._mem)*c; } return;
|
case VECTOR3:{ r_dst=*reinterpret_cast<const Vector3*>(a._data._mem)+*reinterpret_cast<const Vector3*>(b._data._mem)*c; } return;
|
||||||
case _AABB:{
|
case RECT3:{
|
||||||
const AABB *ra = reinterpret_cast<const AABB*>(a._data._mem);
|
const Rect3 *ra = reinterpret_cast<const Rect3*>(a._data._mem);
|
||||||
const AABB *rb = reinterpret_cast<const AABB*>(b._data._mem);
|
const Rect3 *rb = reinterpret_cast<const Rect3*>(b._data._mem);
|
||||||
r_dst=AABB(ra->pos + rb->pos * c, ra->size + rb->size * c);
|
r_dst=Rect3(ra->pos + rb->pos * c, ra->size + rb->size * c);
|
||||||
} return;
|
} return;
|
||||||
case QUAT:{
|
case QUAT:{
|
||||||
Quat empty_rot;
|
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 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 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 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 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 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 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 MATRIX3:{ r_dst=Transform(*a._data._matrix3).interpolate_with(Transform(*b._data._matrix3),c).basis; } 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 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 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;
|
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 INPUT_EVENT:{ r_dst=a; } return;
|
||||||
case DICTIONARY:{ } return;
|
case DICTIONARY:{ } return;
|
||||||
case ARRAY:{ r_dst=a; } return;
|
case ARRAY:{ r_dst=a; } return;
|
||||||
case RAW_ARRAY:{ r_dst=a; } return;
|
case POOL_BYTE_ARRAY:{ r_dst=a; } return;
|
||||||
case INT_ARRAY:{ r_dst=a; } return;
|
case POOL_INT_ARRAY:{ r_dst=a; } return;
|
||||||
case REAL_ARRAY:{ r_dst=a; } return;
|
case POOL_REAL_ARRAY:{ r_dst=a; } return;
|
||||||
case STRING_ARRAY:{ r_dst=a; } return;
|
case POOL_STRING_ARRAY:{ r_dst=a; } return;
|
||||||
case VECTOR2_ARRAY:{
|
case POOL_VECTOR2_ARRAY:{
|
||||||
const PoolVector<Vector2> *arr_a=reinterpret_cast<const PoolVector<Vector2>* >(a._data._mem);
|
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);
|
const PoolVector<Vector2> *arr_b=reinterpret_cast<const PoolVector<Vector2>* >(b._data._mem);
|
||||||
int sz = arr_a->size();
|
int sz = arr_a->size();
|
||||||
|
@ -3520,7 +3520,7 @@ void Variant::interpolate(const Variant& a, const Variant& b, float c,Variant &r
|
||||||
|
|
||||||
|
|
||||||
} return;
|
} return;
|
||||||
case VECTOR3_ARRAY:{
|
case POOL_VECTOR3_ARRAY:{
|
||||||
|
|
||||||
|
|
||||||
const PoolVector<Vector3> *arr_a=reinterpret_cast<const PoolVector<Vector3>* >(a._data._mem);
|
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;
|
} return;
|
||||||
case COLOR_ARRAY:{ r_dst=a; } return;
|
case POOL_COLOR_ARRAY:{ r_dst=a; } return;
|
||||||
default: {
|
default: {
|
||||||
|
|
||||||
r_dst=a;
|
r_dst=a;
|
||||||
|
|
|
@ -614,7 +614,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
|
||||||
|
|
||||||
value=Vector3(args[0],args[1],args[2]);
|
value=Vector3(args[0],args[1],args[2]);
|
||||||
return OK;
|
return OK;
|
||||||
} else if (id=="Matrix32"){
|
} else if (id=="Transform2D" || id=="Matrix32"){ //compatibility
|
||||||
|
|
||||||
Vector<float> args;
|
Vector<float> args;
|
||||||
Error err = _parse_construct<float>(p_stream,args,line,r_err_str);
|
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) {
|
if (args.size()!=6) {
|
||||||
r_err_str="Expected 6 arguments for constructor";
|
r_err_str="Expected 6 arguments for constructor";
|
||||||
}
|
}
|
||||||
Matrix32 m;
|
Transform2D m;
|
||||||
m[0]=Vector2(args[0],args[1]);
|
m[0]=Vector2(args[0],args[1]);
|
||||||
m[1]=Vector2(args[2],args[3]);
|
m[1]=Vector2(args[2],args[3]);
|
||||||
m[2]=Vector2(args[4],args[5]);
|
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]);
|
value=Quat(args[0],args[1],args[2],args[3]);
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
} else if (id=="AABB"){
|
} else if (id=="Rect3" || id=="AABB"){
|
||||||
|
|
||||||
Vector<float> args;
|
Vector<float> args;
|
||||||
Error err = _parse_construct<float>(p_stream,args,line,r_err_str);
|
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";
|
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;
|
return OK;
|
||||||
|
|
||||||
} else if (id=="Matrix3"){
|
} else if (id=="Basis" || id=="Matrix3"){ //compatibility
|
||||||
|
|
||||||
Vector<float> args;
|
Vector<float> args;
|
||||||
Error err = _parse_construct<float>(p_stream,args,line,r_err_str);
|
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";
|
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;
|
return OK;
|
||||||
} else if (id=="Transform"){
|
} 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";
|
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;
|
return OK;
|
||||||
|
|
||||||
} else if (id=="Color") {
|
} else if (id=="Color") {
|
||||||
|
@ -1149,7 +1149,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
} else if (id=="ByteArray") {
|
} else if (id=="PoolByteArray"|| id=="ByteArray") {
|
||||||
|
|
||||||
Vector<uint8_t> args;
|
Vector<uint8_t> args;
|
||||||
Error err = _parse_construct<uint8_t>(p_stream,args,line,r_err_str);
|
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;
|
return OK;
|
||||||
|
|
||||||
} else if (id=="IntArray") {
|
} else if (id=="PoolIntArray"|| id=="IntArray") {
|
||||||
|
|
||||||
Vector<int> args;
|
Vector<int> args;
|
||||||
Error err = _parse_construct<int>(p_stream,args,line,r_err_str);
|
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;
|
return OK;
|
||||||
|
|
||||||
} else if (id=="FloatArray") {
|
} else if (id=="PoolFloatArray"|| id=="FloatArray") {
|
||||||
|
|
||||||
Vector<float> args;
|
Vector<float> args;
|
||||||
Error err = _parse_construct<float>(p_stream,args,line,r_err_str);
|
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;
|
value=arr;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
} else if (id=="StringArray") {
|
} else if (id=="PoolStringArray"|| id=="StringArray") {
|
||||||
|
|
||||||
|
|
||||||
get_token(p_stream,token,line,r_err_str);
|
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;
|
return OK;
|
||||||
|
|
||||||
|
|
||||||
} else if (id=="Vector2Array") {
|
} else if (id=="PoolVector2Array"|| id=="Vector2Array") {
|
||||||
|
|
||||||
Vector<float> args;
|
Vector<float> args;
|
||||||
Error err = _parse_construct<float>(p_stream,args,line,r_err_str);
|
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;
|
return OK;
|
||||||
|
|
||||||
} else if (id=="Vector3Array") {
|
} else if (id=="PoolVector3Array"|| id=="Vector3Array") {
|
||||||
|
|
||||||
Vector<float> args;
|
Vector<float> args;
|
||||||
Error err = _parse_construct<float>(p_stream,args,line,r_err_str);
|
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;
|
return OK;
|
||||||
|
|
||||||
} else if (id=="ColorArray") {
|
} else if (id=="PoolColorArray"|| id=="ColorArray") {
|
||||||
|
|
||||||
Vector<float> args;
|
Vector<float> args;
|
||||||
Error err = _parse_construct<float>(p_stream,args,line,r_err_str);
|
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)+" )" );
|
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;
|
} break;
|
||||||
case Variant::_AABB: {
|
case Variant::RECT3: {
|
||||||
|
|
||||||
AABB aabb = p_variant;
|
Rect3 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)+" )" );
|
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;
|
} break;
|
||||||
case Variant::QUAT: {
|
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)+" )");
|
p_store_string_func(p_store_string_ud,"Quat( "+rtosfix(quat.x)+", "+rtosfix(quat.y)+", "+rtosfix(quat.z)+", "+rtosfix(quat.w)+" )");
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::MATRIX32: {
|
case Variant::TRANSFORM2D: {
|
||||||
|
|
||||||
String s="Matrix32( ";
|
String s="Transform2D( ";
|
||||||
Matrix32 m3 = p_variant;
|
Transform2D m3 = p_variant;
|
||||||
for (int i=0;i<3;i++) {
|
for (int i=0;i<3;i++) {
|
||||||
for (int j=0;j<2;j++) {
|
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+" )");
|
p_store_string_func(p_store_string_ud,s+" )");
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::MATRIX3: {
|
case Variant::BASIS: {
|
||||||
|
|
||||||
String s="Matrix3( ";
|
String s="Basis( ";
|
||||||
Matrix3 m3 = p_variant;
|
Basis m3 = p_variant;
|
||||||
for (int i=0;i<3;i++) {
|
for (int i=0;i<3;i++) {
|
||||||
for (int j=0;j<3;j++) {
|
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( ";
|
String s="Transform( ";
|
||||||
Transform t = p_variant;
|
Transform t = p_variant;
|
||||||
Matrix3 &m3 = t.basis;
|
Basis &m3 = t.basis;
|
||||||
for (int i=0;i<3;i++) {
|
for (int i=0;i<3;i++) {
|
||||||
for (int j=0;j<3;j++) {
|
for (int j=0;j<3;j++) {
|
||||||
|
|
||||||
|
@ -2124,9 +2124,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
|
||||||
|
|
||||||
} break;
|
} 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;
|
String s;
|
||||||
PoolVector<uint8_t> data = p_variant;
|
PoolVector<uint8_t> data = p_variant;
|
||||||
int len = data.size();
|
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," )");
|
p_store_string_func(p_store_string_ud," )");
|
||||||
|
|
||||||
} break;
|
} 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;
|
PoolVector<int> data = p_variant;
|
||||||
int len = data.size();
|
int len = data.size();
|
||||||
PoolVector<int>::Read r = data.read();
|
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," )");
|
p_store_string_func(p_store_string_ud," )");
|
||||||
|
|
||||||
} break;
|
} 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;
|
PoolVector<real_t> data = p_variant;
|
||||||
int len = data.size();
|
int len = data.size();
|
||||||
PoolVector<real_t>::Read r = data.read();
|
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," )");
|
p_store_string_func(p_store_string_ud," )");
|
||||||
|
|
||||||
} break;
|
} 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;
|
PoolVector<String> data = p_variant;
|
||||||
int len = data.size();
|
int len = data.size();
|
||||||
PoolVector<String>::Read r = data.read();
|
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," )");
|
p_store_string_func(p_store_string_ud," )");
|
||||||
|
|
||||||
} break;
|
} 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;
|
PoolVector<Vector2> data = p_variant;
|
||||||
int len = data.size();
|
int len = data.size();
|
||||||
PoolVector<Vector2>::Read r = data.read();
|
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," )");
|
p_store_string_func(p_store_string_ud," )");
|
||||||
|
|
||||||
} break;
|
} 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;
|
PoolVector<Vector3> data = p_variant;
|
||||||
int len = data.size();
|
int len = data.size();
|
||||||
PoolVector<Vector3>::Read r = data.read();
|
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," )");
|
p_store_string_func(p_store_string_ud," )");
|
||||||
|
|
||||||
} break;
|
} 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;
|
PoolVector<Color> data = p_variant;
|
||||||
int len = data.size();
|
int len = data.size();
|
||||||
|
|
|
@ -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_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_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_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_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: { 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_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;
|
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)+">";
|
default: code="<error: "+Variant::get_type_name(cnode->value.get_type())+" ("+itos(cnode->datatype)+">";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "rasterizer_canvas_gles3.h"
|
#include "rasterizer_canvas_gles3.h"
|
||||||
#include "os/os.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[ 0]=p_mtx.elements[0][0];
|
||||||
p_array[ 1]=p_mtx.elements[0][1];
|
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);
|
LightInternal * li = light_internal_owner.getornull(p_rid);
|
||||||
ERR_FAIL_COND(!li);
|
ERR_FAIL_COND(!li);
|
||||||
|
|
||||||
store_matrix32(p_light->light_shader_xform,li->ubo_data.light_matrix);
|
store_transform2d(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->xform_cache.affine_inverse(),li->ubo_data.local_matrix);
|
||||||
store_camera(p_light->shadow_matrix_cache,li->ubo_data.shadow_matrix);
|
store_camera(p_light->shadow_matrix_cache,li->ubo_data.shadow_matrix);
|
||||||
|
|
||||||
for(int i=0;i<4;i++) {
|
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.set_custom_shader(0);
|
||||||
state.canvas_shader.bind();
|
state.canvas_shader.bind();
|
||||||
state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE,Color(1,1,1,1));
|
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::MODELVIEW_MATRIX,Transform2D());
|
||||||
state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,Matrix32());
|
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 );
|
ci->final_modulate.a * p_modulate.a );
|
||||||
|
|
||||||
state.final_transform = ci->final_transform;
|
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::FINAL_MODULATE,state.canvas_item_modulate);
|
||||||
state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,state.final_transform);
|
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::FINAL_MODULATE,state.canvas_item_modulate);
|
||||||
state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,state.final_transform);
|
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);
|
RasterizerStorageGLES3::CanvasLightShadow *cls = storage->canvas_light_shadow_owner.get(p_buffer);
|
||||||
ERR_FAIL_COND(!cls);
|
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 );
|
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());
|
projection = projection * CameraMatrix(Transform().looking_at(cam_target,Vector3(0,0,-1)).affine_inverse());
|
||||||
|
|
||||||
state.canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES3::PROJECTION_MATRIX,projection);
|
state.canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES3::PROJECTION_MATRIX,projection);
|
||||||
|
|
|
@ -42,8 +42,8 @@ public:
|
||||||
Transform vp;
|
Transform vp;
|
||||||
|
|
||||||
Color canvas_item_modulate;
|
Color canvas_item_modulate;
|
||||||
Matrix32 extra_matrix;
|
Transform2D extra_matrix;
|
||||||
Matrix32 final_transform;
|
Transform2D final_transform;
|
||||||
|
|
||||||
} state;
|
} 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_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_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();
|
virtual void reset_canvas();
|
||||||
|
|
|
@ -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[ 0]=p_mtx.elements[0][0];
|
||||||
p_array[ 1]=p_mtx.elements[0][1];
|
p_array[ 1]=p_mtx.elements[0][1];
|
||||||
|
|
|
@ -1601,7 +1601,7 @@ void RasterizerStorageGLES3::shader_get_param_list(RID p_shader, List<PropertyIn
|
||||||
case ShaderLanguage::TYPE_UVEC3:
|
case ShaderLanguage::TYPE_UVEC3:
|
||||||
case ShaderLanguage::TYPE_UVEC4: {
|
case ShaderLanguage::TYPE_UVEC4: {
|
||||||
|
|
||||||
pi.type=Variant::INT_ARRAY;
|
pi.type=Variant::POOL_INT_ARRAY;
|
||||||
} break;
|
} break;
|
||||||
case ShaderLanguage::TYPE_FLOAT: {
|
case ShaderLanguage::TYPE_FLOAT: {
|
||||||
pi.type=Variant::REAL;
|
pi.type=Variant::REAL;
|
||||||
|
@ -1620,8 +1620,8 @@ void RasterizerStorageGLES3::shader_get_param_list(RID p_shader, List<PropertyIn
|
||||||
pi.type=Variant::PLANE;
|
pi.type=Variant::PLANE;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case ShaderLanguage::TYPE_MAT2: pi.type=Variant::MATRIX32; break;
|
case ShaderLanguage::TYPE_MAT2: pi.type=Variant::TRANSFORM2D; break;
|
||||||
case ShaderLanguage::TYPE_MAT3: pi.type=Variant::MATRIX3; break;
|
case ShaderLanguage::TYPE_MAT3: pi.type=Variant::BASIS; break;
|
||||||
case ShaderLanguage::TYPE_MAT4: pi.type=Variant::TRANSFORM; break;
|
case ShaderLanguage::TYPE_MAT4: pi.type=Variant::TRANSFORM; break;
|
||||||
case ShaderLanguage::TYPE_SAMPLER2D:
|
case ShaderLanguage::TYPE_SAMPLER2D:
|
||||||
case ShaderLanguage::TYPE_ISAMPLER2D:
|
case ShaderLanguage::TYPE_ISAMPLER2D:
|
||||||
|
@ -2009,7 +2009,7 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case ShaderLanguage::TYPE_MAT2: {
|
case ShaderLanguage::TYPE_MAT2: {
|
||||||
Matrix32 v = value;
|
Transform2D v = value;
|
||||||
GLfloat *gui = (GLfloat*)data;
|
GLfloat *gui = (GLfloat*)data;
|
||||||
|
|
||||||
gui[ 0]=v.elements[0][0];
|
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: {
|
case ShaderLanguage::TYPE_MAT3: {
|
||||||
|
|
||||||
|
|
||||||
Matrix3 v = value;
|
Basis v = value;
|
||||||
GLfloat *gui = (GLfloat*)data;
|
GLfloat *gui = (GLfloat*)data;
|
||||||
|
|
||||||
gui[ 0]=v.elements[0][0];
|
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;
|
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;
|
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);
|
const Mesh *mesh = mesh_owner.getornull(p_mesh);
|
||||||
ERR_FAIL_COND_V(!mesh,AABB());
|
ERR_FAIL_COND_V(!mesh,Rect3());
|
||||||
ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),AABB());
|
ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),Rect3());
|
||||||
|
|
||||||
return mesh->surfaces[p_surface]->aabb;
|
return mesh->surfaces[p_surface]->aabb;
|
||||||
|
|
||||||
|
@ -3051,11 +3051,11 @@ Vector<PoolVector<uint8_t> > RasterizerStorageGLES3::mesh_surface_get_blend_shap
|
||||||
return bsarr;
|
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);
|
const Mesh *mesh = mesh_owner.getornull(p_mesh);
|
||||||
ERR_FAIL_COND_V(!mesh,Vector<AABB >());
|
ERR_FAIL_COND_V(!mesh,Vector<Rect3 >());
|
||||||
ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),Vector<AABB >());
|
ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),Vector<Rect3 >());
|
||||||
|
|
||||||
return mesh->surfaces[p_surface]->skeleton_bone_aabb;
|
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);
|
Mesh *mesh = mesh_owner.getornull(p_mesh);
|
||||||
ERR_FAIL_COND(!mesh);
|
ERR_FAIL_COND(!mesh);
|
||||||
|
|
||||||
mesh->custom_aabb=p_aabb;
|
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);
|
const Mesh *mesh = mesh_owner.getornull(p_mesh);
|
||||||
ERR_FAIL_COND_V(!mesh,AABB());
|
ERR_FAIL_COND_V(!mesh,Rect3());
|
||||||
|
|
||||||
return mesh->custom_aabb;
|
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 );
|
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;
|
return mesh->custom_aabb;
|
||||||
|
|
||||||
Skeleton *sk=NULL;
|
Skeleton *sk=NULL;
|
||||||
if (p_skeleton.is_valid())
|
if (p_skeleton.is_valid())
|
||||||
sk=skeleton_owner.get(p_skeleton);
|
sk=skeleton_owner.get(p_skeleton);
|
||||||
|
|
||||||
AABB aabb;
|
Rect3 aabb;
|
||||||
|
|
||||||
if (sk && sk->size!=0) {
|
if (sk && sk->size!=0) {
|
||||||
|
|
||||||
|
|
||||||
for (int i=0;i<mesh->surfaces.size();i++) {
|
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()) {
|
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();
|
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();
|
const bool *skused = mesh->surfaces[i]->skeleton_bone_used.ptr();
|
||||||
|
|
||||||
int sbs = sk->size;
|
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.basis.elements[1][1]=dataptr[ 5];
|
||||||
mtx.origin[1]=dataptr[ 7];
|
mtx.origin[1]=dataptr[ 7];
|
||||||
|
|
||||||
AABB baabb = mtx.xform( skbones[j] );
|
Rect3 baabb = mtx.xform( skbones[j] );
|
||||||
if (first) {
|
if (first) {
|
||||||
laabb=baabb;
|
laabb=baabb;
|
||||||
first=false;
|
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.basis.elements[2][2]=dataptr[10];
|
||||||
mtx.origin.z=dataptr[11];
|
mtx.origin.z=dataptr[11];
|
||||||
|
|
||||||
AABB baabb = mtx.xform ( skbones[j] );
|
Rect3 baabb = mtx.xform ( skbones[j] );
|
||||||
if (first) {
|
if (first) {
|
||||||
laabb=baabb;
|
laabb=baabb;
|
||||||
first=false;
|
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);
|
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
|
||||||
ERR_FAIL_COND(!multimesh);
|
ERR_FAIL_COND(!multimesh);
|
||||||
|
@ -3726,17 +3726,17 @@ Transform RasterizerStorageGLES3::multimesh_instance_get_transform(RID p_multime
|
||||||
|
|
||||||
return xform;
|
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);
|
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
|
||||||
ERR_FAIL_COND_V(!multimesh,Matrix32());
|
ERR_FAIL_COND_V(!multimesh,Transform2D());
|
||||||
ERR_FAIL_INDEX_V(p_index,multimesh->size,Matrix32());
|
ERR_FAIL_INDEX_V(p_index,multimesh->size,Transform2D());
|
||||||
ERR_FAIL_COND_V(multimesh->transform_format==VS::MULTIMESH_TRANSFORM_3D,Matrix32());
|
ERR_FAIL_COND_V(multimesh->transform_format==VS::MULTIMESH_TRANSFORM_3D,Transform2D());
|
||||||
|
|
||||||
int stride = multimesh->color_floats+multimesh->xform_floats;
|
int stride = multimesh->color_floats+multimesh->xform_floats;
|
||||||
float *dataptr=&multimesh->data[stride*p_index];
|
float *dataptr=&multimesh->data[stride*p_index];
|
||||||
|
|
||||||
Matrix32 xform;
|
Transform2D xform;
|
||||||
|
|
||||||
xform.elements[0][0]=dataptr[ 0];
|
xform.elements[0][0]=dataptr[ 0];
|
||||||
xform.elements[1][0]=dataptr[ 1];
|
xform.elements[1][0]=dataptr[ 1];
|
||||||
|
@ -3795,10 +3795,10 @@ int RasterizerStorageGLES3::multimesh_get_visible_instances(RID p_multimesh) con
|
||||||
return multimesh->visible_instances;
|
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);
|
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
|
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) {
|
if (multimesh->size && multimesh->dirty_aabb) {
|
||||||
|
|
||||||
AABB mesh_aabb;
|
Rect3 mesh_aabb;
|
||||||
|
|
||||||
if (multimesh->mesh.is_valid()) {
|
if (multimesh->mesh.is_valid()) {
|
||||||
mesh_aabb=mesh_get_aabb(multimesh->mesh,RID());
|
mesh_aabb=mesh_get_aabb(multimesh->mesh,RID());
|
||||||
|
@ -3837,7 +3837,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() {
|
||||||
int count = multimesh->data.size();
|
int count = multimesh->data.size();
|
||||||
float *data=multimesh->data.ptr();
|
float *data=multimesh->data.ptr();
|
||||||
|
|
||||||
AABB aabb;
|
Rect3 aabb;
|
||||||
|
|
||||||
if (multimesh->transform_format==VS::MULTIMESH_TRANSFORM_2D) {
|
if (multimesh->transform_format==VS::MULTIMESH_TRANSFORM_2D) {
|
||||||
|
|
||||||
|
@ -3852,7 +3852,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() {
|
||||||
xform.basis[1][1]=dataptr[ 5];
|
xform.basis[1][1]=dataptr[ 5];
|
||||||
xform.origin[1]=dataptr[ 7];
|
xform.origin[1]=dataptr[ 7];
|
||||||
|
|
||||||
AABB laabb = xform.xform(mesh_aabb);
|
Rect3 laabb = xform.xform(mesh_aabb);
|
||||||
if (i==0)
|
if (i==0)
|
||||||
aabb=laabb;
|
aabb=laabb;
|
||||||
else
|
else
|
||||||
|
@ -3878,7 +3878,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() {
|
||||||
xform.basis.elements[2][2]=dataptr[10];
|
xform.basis.elements[2][2]=dataptr[10];
|
||||||
xform.origin.z=dataptr[11];
|
xform.origin.z=dataptr[11];
|
||||||
|
|
||||||
AABB laabb = xform.xform(mesh_aabb);
|
Rect3 laabb = xform.xform(mesh_aabb);
|
||||||
if (i==0)
|
if (i==0)
|
||||||
aabb=laabb;
|
aabb=laabb;
|
||||||
else
|
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);
|
Immediate *im = immediate_owner.get(p_immediate);
|
||||||
ERR_FAIL_COND_V(!im,AABB());
|
ERR_FAIL_COND_V(!im,Rect3());
|
||||||
return im->aabb;
|
return im->aabb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4185,7 +4185,7 @@ Transform RasterizerStorageGLES3::skeleton_bone_get_transform(RID p_skeleton,int
|
||||||
|
|
||||||
return mtx;
|
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);
|
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);
|
Skeleton *skeleton = skeleton_owner.getornull(p_skeleton);
|
||||||
|
|
||||||
|
|
||||||
ERR_FAIL_COND_V(!skeleton,Matrix32());
|
ERR_FAIL_COND_V(!skeleton,Transform2D());
|
||||||
ERR_FAIL_INDEX_V(p_bone,skeleton->size,Matrix32());
|
ERR_FAIL_INDEX_V(p_bone,skeleton->size,Transform2D());
|
||||||
ERR_FAIL_COND_V(!skeleton->use_2d,Matrix32());
|
ERR_FAIL_COND_V(!skeleton->use_2d,Transform2D());
|
||||||
|
|
||||||
Matrix32 mtx;
|
Transform2D mtx;
|
||||||
|
|
||||||
float * bones = skeleton->bones.ptr();
|
float * bones = skeleton->bones.ptr();
|
||||||
mtx.elements[0][0]=bones[p_bone*12+ 0];
|
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);
|
const Light * light = light_owner.getornull(p_light);
|
||||||
ERR_FAIL_COND_V(!light,AABB());
|
ERR_FAIL_COND_V(!light,Rect3());
|
||||||
|
|
||||||
switch( light->type ) {
|
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 len=light->param[VS::LIGHT_PARAM_RANGE];
|
||||||
float size=Math::tan(Math::deg2rad(light->param[VS::LIGHT_PARAM_SPOT_ANGLE]))*len;
|
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;
|
} break;
|
||||||
case VS::LIGHT_OMNI: {
|
case VS::LIGHT_OMNI: {
|
||||||
|
|
||||||
float r = light->param[VS::LIGHT_PARAM_RANGE];
|
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;
|
} break;
|
||||||
case VS::LIGHT_DIRECTIONAL: {
|
case VS::LIGHT_DIRECTIONAL: {
|
||||||
|
|
||||||
return AABB();
|
return Rect3();
|
||||||
} break;
|
} break;
|
||||||
default: {}
|
default: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
ERR_FAIL_V( AABB() );
|
ERR_FAIL_V( Rect3() );
|
||||||
return AABB();
|
return Rect3();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PROBE API */
|
/* 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);
|
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.pos=-reflection_probe->extents;
|
||||||
aabb.size=reflection_probe->extents*2.0;
|
aabb.size=reflection_probe->extents*2.0;
|
||||||
|
|
||||||
|
@ -4744,7 +4744,7 @@ RID RasterizerStorageGLES3::gi_probe_create() {
|
||||||
|
|
||||||
GIProbe *gip = memnew( GIProbe );
|
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->dynamic_range=1.0;
|
||||||
gip->energy=1.0;
|
gip->energy=1.0;
|
||||||
gip->interior=false;
|
gip->interior=false;
|
||||||
|
@ -4755,7 +4755,7 @@ RID RasterizerStorageGLES3::gi_probe_create() {
|
||||||
return gi_probe_owner.make_rid(gip);
|
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);
|
GIProbe *gip = gi_probe_owner.getornull(p_probe);
|
||||||
ERR_FAIL_COND(!gip);
|
ERR_FAIL_COND(!gip);
|
||||||
|
@ -4764,10 +4764,10 @@ void RasterizerStorageGLES3::gi_probe_set_bounds(RID p_probe,const AABB& p_bound
|
||||||
gip->version++;
|
gip->version++;
|
||||||
gip->instance_change_notify();
|
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);
|
const GIProbe *gip = gi_probe_owner.getornull(p_probe);
|
||||||
ERR_FAIL_COND_V(!gip,AABB());
|
ERR_FAIL_COND_V(!gip,Rect3());
|
||||||
|
|
||||||
return gip->bounds;
|
return gip->bounds;
|
||||||
}
|
}
|
||||||
|
@ -5074,7 +5074,7 @@ void RasterizerStorageGLES3::particles_set_randomness_ratio(RID p_particles,floa
|
||||||
particles->randomness=p_ratio;
|
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);
|
Particles *particles = particles_owner.getornull(p_particles);
|
||||||
ERR_FAIL_COND(!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);
|
const Particles *particles = particles_owner.getornull(p_particles);
|
||||||
ERR_FAIL_COND_V(!particles,AABB());
|
ERR_FAIL_COND_V(!particles,Rect3());
|
||||||
|
|
||||||
return particles->computed_aabb;
|
return particles->computed_aabb;
|
||||||
}
|
}
|
||||||
|
|
|
@ -526,7 +526,7 @@ public:
|
||||||
GLuint vertex_id;
|
GLuint vertex_id;
|
||||||
GLuint index_id;
|
GLuint index_id;
|
||||||
|
|
||||||
Vector<AABB> skeleton_bone_aabb;
|
Vector<Rect3> skeleton_bone_aabb;
|
||||||
Vector<bool> skeleton_bone_used;
|
Vector<bool> skeleton_bone_used;
|
||||||
|
|
||||||
//bool packed;
|
//bool packed;
|
||||||
|
@ -538,7 +538,7 @@ public:
|
||||||
|
|
||||||
Vector<MorphTarget> morph_targets;
|
Vector<MorphTarget> morph_targets;
|
||||||
|
|
||||||
AABB aabb;
|
Rect3 aabb;
|
||||||
|
|
||||||
int array_len;
|
int array_len;
|
||||||
int index_array_len;
|
int index_array_len;
|
||||||
|
@ -585,7 +585,7 @@ public:
|
||||||
Vector<Surface*> surfaces;
|
Vector<Surface*> surfaces;
|
||||||
int morph_target_count;
|
int morph_target_count;
|
||||||
VS::MorphTargetMode morph_target_mode;
|
VS::MorphTargetMode morph_target_mode;
|
||||||
AABB custom_aabb;
|
Rect3 custom_aabb;
|
||||||
mutable uint64_t last_pass;
|
mutable uint64_t last_pass;
|
||||||
Mesh() {
|
Mesh() {
|
||||||
morph_target_mode=VS::MORPH_MODE_NORMALIZED;
|
morph_target_mode=VS::MORPH_MODE_NORMALIZED;
|
||||||
|
@ -599,7 +599,7 @@ public:
|
||||||
|
|
||||||
virtual RID mesh_create();
|
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 void mesh_set_morph_target_count(RID p_mesh,int p_amount);
|
||||||
virtual int mesh_get_morph_target_count(RID p_mesh) const;
|
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 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 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<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 void mesh_remove_surface(RID p_mesh, int p_surface);
|
||||||
virtual int mesh_get_surface_count(RID p_mesh) const;
|
virtual int mesh_get_surface_count(RID p_mesh) const;
|
||||||
|
|
||||||
virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb);
|
virtual void mesh_set_custom_aabb(RID p_mesh,const Rect3& p_aabb);
|
||||||
virtual AABB mesh_get_custom_aabb(RID p_mesh) const;
|
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);
|
virtual void mesh_clear(RID p_mesh);
|
||||||
|
|
||||||
void mesh_render_blend_shapes(Surface *s, float *p_weights);
|
void mesh_render_blend_shapes(Surface *s, float *p_weights);
|
||||||
|
@ -644,7 +644,7 @@ public:
|
||||||
VS::MultimeshTransformFormat transform_format;
|
VS::MultimeshTransformFormat transform_format;
|
||||||
VS::MultimeshColorFormat color_format;
|
VS::MultimeshColorFormat color_format;
|
||||||
Vector<float> data;
|
Vector<float> data;
|
||||||
AABB aabb;
|
Rect3 aabb;
|
||||||
SelfList<MultiMesh> update_list;
|
SelfList<MultiMesh> update_list;
|
||||||
GLuint buffer;
|
GLuint buffer;
|
||||||
int visible_instances;
|
int visible_instances;
|
||||||
|
@ -681,19 +681,19 @@ public:
|
||||||
|
|
||||||
virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh);
|
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(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 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 RID multimesh_get_mesh(RID p_multimesh) const;
|
||||||
|
|
||||||
virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) 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 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 void multimesh_set_visible_instances(RID p_multimesh,int p_visible);
|
||||||
virtual int multimesh_get_visible_instances(RID p_multimesh) const;
|
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 */
|
/* IMMEDIATE API */
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ public:
|
||||||
List<Chunk> chunks;
|
List<Chunk> chunks;
|
||||||
bool building;
|
bool building;
|
||||||
int mask;
|
int mask;
|
||||||
AABB aabb;
|
Rect3 aabb;
|
||||||
|
|
||||||
Immediate() { type=GEOMETRY_IMMEDIATE; building=false;}
|
Immediate() { type=GEOMETRY_IMMEDIATE; building=false;}
|
||||||
|
|
||||||
|
@ -741,7 +741,7 @@ public:
|
||||||
virtual void immediate_clear(RID p_immediate);
|
virtual void immediate_clear(RID p_immediate);
|
||||||
virtual void immediate_set_material(RID p_immediate,RID p_material);
|
virtual void immediate_set_material(RID p_immediate,RID p_material);
|
||||||
virtual RID immediate_get_material(RID p_immediate) const;
|
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 */
|
/* SKELETON API */
|
||||||
|
|
||||||
|
@ -771,8 +771,8 @@ public:
|
||||||
virtual int skeleton_get_bone_count(RID p_skeleton) const;
|
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 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 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 void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Transform2D& p_transform);
|
||||||
virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone) const;
|
virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone) const;
|
||||||
|
|
||||||
/* Light API */
|
/* Light API */
|
||||||
|
|
||||||
|
@ -823,7 +823,7 @@ public:
|
||||||
virtual float light_get_param(RID p_light,VS::LightParam p_param);
|
virtual float light_get_param(RID p_light,VS::LightParam p_param);
|
||||||
virtual Color light_get_color(RID p_light);
|
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;
|
virtual uint64_t light_get_version(RID p_light) const;
|
||||||
|
|
||||||
/* PROBE API */
|
/* 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_enable_shadows(RID p_probe, bool p_enable);
|
||||||
virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers);
|
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 VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const;
|
||||||
virtual uint32_t reflection_probe_get_cull_mask(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 {
|
struct GIProbe : public Instantiable {
|
||||||
|
|
||||||
|
|
||||||
AABB bounds;
|
Rect3 bounds;
|
||||||
Transform to_cell;
|
Transform to_cell;
|
||||||
float cell_size;
|
float cell_size;
|
||||||
|
|
||||||
|
@ -922,8 +922,8 @@ public:
|
||||||
|
|
||||||
virtual RID gi_probe_create();
|
virtual RID gi_probe_create();
|
||||||
|
|
||||||
virtual void gi_probe_set_bounds(RID p_probe,const AABB& p_bounds);
|
virtual void gi_probe_set_bounds(RID p_probe,const Rect3& p_bounds);
|
||||||
virtual AABB gi_probe_get_bounds(RID p_probe) const;
|
virtual Rect3 gi_probe_get_bounds(RID p_probe) const;
|
||||||
|
|
||||||
virtual void gi_probe_set_cell_size(RID p_probe, float p_size);
|
virtual void gi_probe_set_cell_size(RID p_probe, float p_size);
|
||||||
virtual float gi_probe_get_cell_size(RID p_probe) const;
|
virtual float gi_probe_get_cell_size(RID p_probe) const;
|
||||||
|
@ -977,7 +977,7 @@ public:
|
||||||
float pre_process_time;
|
float pre_process_time;
|
||||||
float explosiveness;
|
float explosiveness;
|
||||||
float randomness;
|
float randomness;
|
||||||
AABB custom_aabb;
|
Rect3 custom_aabb;
|
||||||
Vector3 gravity;
|
Vector3 gravity;
|
||||||
bool use_local_coords;
|
bool use_local_coords;
|
||||||
RID process_material;
|
RID process_material;
|
||||||
|
@ -996,7 +996,7 @@ public:
|
||||||
|
|
||||||
Vector<DrawPass> draw_passes;
|
Vector<DrawPass> draw_passes;
|
||||||
|
|
||||||
AABB computed_aabb;
|
Rect3 computed_aabb;
|
||||||
|
|
||||||
GLuint particle_buffers[2];
|
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_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_explosiveness_ratio(RID p_particles,float p_ratio);
|
||||||
virtual void particles_set_randomness_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_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_use_local_coordinates(RID p_particles,bool p_enable);
|
||||||
virtual void particles_set_process_material(RID p_particles,RID p_material);
|
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_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 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 */
|
/* INSTANCE */
|
||||||
|
|
||||||
|
|
|
@ -236,9 +236,9 @@ private:
|
||||||
glUniform4f( p_uniform, val.x,val.y,val.z,val.w );
|
glUniform4f( p_uniform, val.x,val.y,val.z,val.w );
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case Variant::MATRIX32: {
|
case Variant::TRANSFORM2D: {
|
||||||
|
|
||||||
Matrix32 tr=p_value;
|
Transform2D tr=p_value;
|
||||||
GLfloat matrix[16]={ /* build a 16x16 matrix */
|
GLfloat matrix[16]={ /* build a 16x16 matrix */
|
||||||
tr.elements[0][0],
|
tr.elements[0][0],
|
||||||
tr.elements[0][1],
|
tr.elements[0][1],
|
||||||
|
@ -261,7 +261,7 @@ private:
|
||||||
glUniformMatrix4fv(p_uniform,1,false,matrix);
|
glUniformMatrix4fv(p_uniform,1,false,matrix);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::MATRIX3:
|
case Variant::BASIS:
|
||||||
case Variant::TRANSFORM: {
|
case Variant::TRANSFORM: {
|
||||||
|
|
||||||
Transform tr=p_value;
|
Transform tr=p_value;
|
||||||
|
|
|
@ -93,7 +93,7 @@ public:
|
||||||
|
|
||||||
TestCube *testcube = memnew( TestCube );
|
TestCube *testcube = memnew( TestCube );
|
||||||
vp->add_child(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 );
|
Sprite *sp = memnew( Sprite );
|
||||||
sp->set_texture( vp->get_render_target_texture() );
|
sp->set_texture( vp->get_render_target_texture() );
|
||||||
|
|
|
@ -609,19 +609,19 @@ MainLoop* test() {
|
||||||
float a=0.3;
|
float a=0.3;
|
||||||
|
|
||||||
//Quat q(v,a);
|
//Quat q(v,a);
|
||||||
Matrix3 m(v,a);
|
Basis m(v,a);
|
||||||
|
|
||||||
Vector3 v2(7,3,1);
|
Vector3 v2(7,3,1);
|
||||||
v2.normalize();
|
v2.normalize();
|
||||||
float a2=0.8;
|
float a2=0.8;
|
||||||
|
|
||||||
//Quat q(v,a);
|
//Quat q(v,a);
|
||||||
Matrix3 m2(v2,a2);
|
Basis m2(v2,a2);
|
||||||
|
|
||||||
Quat q=m;
|
Quat q=m;
|
||||||
Quat q2=m2;
|
Quat q2=m2;
|
||||||
|
|
||||||
Matrix3 m3 = m.inverse() * m2;
|
Basis m3 = m.inverse() * m2;
|
||||||
Quat q3 = (q.inverse() * q2);//.normalized();
|
Quat q3 = (q.inverse() * q2);//.normalized();
|
||||||
|
|
||||||
print_line(Quat(m3));
|
print_line(Quat(m3));
|
||||||
|
@ -642,11 +642,11 @@ MainLoop* test() {
|
||||||
print_line(ret);
|
print_line(ret);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
Matrix3 m3;
|
Basis m3;
|
||||||
m3.rotate(Vector3(1,0,0),0.2);
|
m3.rotate(Vector3(1,0,0),0.2);
|
||||||
m3.rotate(Vector3(0,1,0),1.77);
|
m3.rotate(Vector3(0,1,0),1.77);
|
||||||
m3.rotate(Vector3(0,0,1),212);
|
m3.rotate(Vector3(0,0,1),212);
|
||||||
Matrix3 m32;
|
Basis m32;
|
||||||
m32.set_euler(m3.get_euler());
|
m32.set_euler(m3.get_euler());
|
||||||
print_line("ELEULEEEEEEEEEEEEEEEEEER: "+m3.get_euler()+" vs "+m32.get_euler());
|
print_line("ELEULEEEEEEEEEEEEEEEEEER: "+m3.get_euler()+" vs "+m32.get_euler());
|
||||||
|
|
||||||
|
@ -784,11 +784,11 @@ MainLoop* test() {
|
||||||
print_line(Variant(a));
|
print_line(Variant(a));
|
||||||
|
|
||||||
|
|
||||||
Matrix32 mat2_1;
|
Transform2D mat2_1;
|
||||||
mat2_1.rotate(0.5);
|
mat2_1.rotate(0.5);
|
||||||
Matrix32 mat2_2;
|
Transform2D mat2_2;
|
||||||
mat2_2.translate(Vector2(1,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();
|
mat2_3.affine_invert();
|
||||||
|
|
||||||
print_line(mat2_3.elements[0]);
|
print_line(mat2_3.elements[0]);
|
||||||
|
|
|
@ -351,7 +351,7 @@ public:
|
||||||
vs->viewport_set_scenario( viewport, scenario );
|
vs->viewport_set_scenario( viewport, scenario );
|
||||||
|
|
||||||
vs->camera_set_perspective(camera,60,0.1,40.0);
|
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);
|
//vs->scenario_set_debug(scenario,VS::SCENARIO_DEBUG_WIREFRAME);
|
||||||
|
|
||||||
Transform gxf;
|
Transform gxf;
|
||||||
|
@ -441,7 +441,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
RID tribody = ps->body_create( PhysicsServer::BODY_MODE_STATIC, trimesh_shape);
|
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 );
|
ps->body_set_state( tribody, PhysicsServer::BODY_STATE_TRANSFORM, tritrans );
|
||||||
vs->instance_set_transform( triins, tritrans );
|
vs->instance_set_transform( triins, tritrans );
|
||||||
RID trimesh_material = vs->fixed_material_create();
|
RID trimesh_material = vs->fixed_material_create();
|
||||||
|
@ -477,7 +477,7 @@ public:
|
||||||
#if 0
|
#if 0
|
||||||
PhysicsServer * ps = PhysicsServer::get_singleton();
|
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());
|
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));
|
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();
|
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());
|
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);
|
ps->body_add_collision_exception(mover,b);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for(int i=0;i<20;i++) {
|
for(int i=0;i<20;i++) {
|
||||||
|
|
||||||
RID c = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform());
|
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);
|
ps->body_add_collision_exception(c,b);
|
||||||
b=c;
|
b=c;
|
||||||
}
|
}
|
||||||
|
@ -560,7 +560,7 @@ public:
|
||||||
ps->body_set_force_integration_callback(character,this,"body_changed_transform",mesh_instance);
|
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);
|
bodies.push_back(character);
|
||||||
|
|
||||||
|
|
||||||
|
@ -611,8 +611,8 @@ public:
|
||||||
|
|
||||||
void test_activate() {
|
void test_activate() {
|
||||||
|
|
||||||
create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_RIGID,Transform(Matrix3(),Vector3(0,2,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(Matrix3(),Vector3(0,6,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) );
|
create_static_plane( Plane( Vector3(0,1,0), -1) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ class TestPhysics2DMainLoop : public MainLoop {
|
||||||
RID canvas;
|
RID canvas;
|
||||||
RID ray;
|
RID ray;
|
||||||
RID ray_query;
|
RID ray_query;
|
||||||
Matrix32 view_xform;
|
Transform2D view_xform;
|
||||||
|
|
||||||
Vector2 ray_from,ray_to;
|
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();
|
VisualServer *vs = VisualServer::get_singleton();
|
||||||
Physics2DServer *ps = Physics2DServer::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();
|
Physics2DServer *ps = Physics2DServer::get_singleton();
|
||||||
VisualServer *vs = VisualServer::get_singleton();
|
VisualServer *vs = VisualServer::get_singleton();
|
||||||
|
@ -382,7 +382,7 @@ public:
|
||||||
canvas = vs->canvas_create();
|
canvas = vs->canvas_create();
|
||||||
vs->viewport_attach_canvas(vp,canvas);
|
vs->viewport_attach_canvas(vp,canvas);
|
||||||
vs->viewport_attach_to_screen(vp,Rect2(Vector2(),OS::get_singleton()->get_window_size()));
|
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.scale(Vector2(0.6,0.6));
|
||||||
//smaller.elements[2]=Vector2(100,0);
|
//smaller.elements[2]=Vector2(100,0);
|
||||||
|
|
||||||
|
@ -410,12 +410,12 @@ public:
|
||||||
|
|
||||||
Physics2DServer::ShapeType type = types[i%4];
|
Physics2DServer::ShapeType type = types[i%4];
|
||||||
// type=Physics2DServer::SHAPE_SEGMENT;
|
// 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)
|
//if (i==0)
|
||||||
// ps->body_set_mode(b,Physics2DServer::BODY_MODE_STATIC);
|
// 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);
|
//ps->body_set_mode(b,Physics2DServer::BODY_MODE_STATIC);
|
||||||
|
|
||||||
Point2 prev;
|
Point2 prev;
|
||||||
|
|
|
@ -95,7 +95,7 @@ public:
|
||||||
|
|
||||||
static const int s = 20;
|
static const int s = 20;
|
||||||
for(int i=0;i<s;i++) {
|
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++) {
|
for(int j=0;j<s;j++) {
|
||||||
Vector3 v;
|
Vector3 v;
|
||||||
|
@ -179,7 +179,7 @@ public:
|
||||||
vs->viewport_set_active(viewport,true);
|
vs->viewport_set_active(viewport,true);
|
||||||
vs->viewport_attach_camera( viewport, camera );
|
vs->viewport_attach_camera( viewport, camera );
|
||||||
vs->viewport_set_scenario( viewport, scenario );
|
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);
|
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()) {
|
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 );
|
vs->instance_set_transform( E->get().instance, pre * E->get().base );
|
||||||
/*
|
/*
|
||||||
if( !E->next() ) {
|
if( !E->next() ) {
|
||||||
|
|
|
@ -325,7 +325,7 @@ void GDScriptLanguage::get_public_constants(List<Pair<String,Variant> > *p_const
|
||||||
p_constants->push_back(pi);
|
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+"(";
|
String s="func "+p_name+"(";
|
||||||
if (p_args.size()) {
|
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]={
|
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",
|
"Color","Image","NodePath","RID","Object","InputEvent","Dictionary","Array","RawArray","IntArray","FloatArray","StringArray",
|
||||||
"Vector2Array","Vector3Array","ColorArray"};
|
"Vector2Array","Vector3Array","ColorArray"};
|
||||||
|
|
||||||
|
|
|
@ -672,7 +672,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
|
||||||
case VAR_TO_BYTES: {
|
case VAR_TO_BYTES: {
|
||||||
VALIDATE_ARG_COUNT(1);
|
VALIDATE_ARG_COUNT(1);
|
||||||
|
|
||||||
ByteArray barr;
|
PoolByteArray barr;
|
||||||
int len;
|
int len;
|
||||||
Error err = encode_variant(*p_args[0],NULL,len);
|
Error err = encode_variant(*p_args[0],NULL,len);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -685,7 +685,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
|
||||||
|
|
||||||
barr.resize(len);
|
barr.resize(len);
|
||||||
{
|
{
|
||||||
ByteArray::Write w = barr.write();
|
PoolByteArray::Write w = barr.write();
|
||||||
encode_variant(*p_args[0],w.ptr(),len);
|
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;
|
} break;
|
||||||
case BYTES_TO_VAR: {
|
case BYTES_TO_VAR: {
|
||||||
VALIDATE_ARG_COUNT(1);
|
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.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument=0;
|
r_error.argument=0;
|
||||||
r_error.expected=Variant::RAW_ARRAY;
|
r_error.expected=Variant::POOL_BYTE_ARRAY;
|
||||||
r_ret=Variant();
|
r_ret=Variant();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArray varr=*p_args[0];
|
PoolByteArray varr=*p_args[0];
|
||||||
Variant ret;
|
Variant ret;
|
||||||
{
|
{
|
||||||
ByteArray::Read r=varr.read();
|
PoolByteArray::Read r=varr.read();
|
||||||
Error err = decode_variant(ret,r.ptr(),varr.size(),NULL);
|
Error err = decode_variant(ret,r.ptr(),varr.size(),NULL);
|
||||||
if (err!=OK) {
|
if (err!=OK) {
|
||||||
r_ret=RTR("Not enough bytes for decoding bytes, or invalid format.");
|
r_ret=RTR("Not enough bytes for decoding bytes, or invalid format.");
|
||||||
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument=0;
|
r_error.argument=0;
|
||||||
r_error.expected=Variant::RAW_ARRAY;
|
r_error.expected=Variant::POOL_BYTE_ARRAY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1531,13 +1531,13 @@ MethodInfo GDFunctions::get_info(Function p_func) {
|
||||||
} break;
|
} break;
|
||||||
case VAR_TO_BYTES: {
|
case VAR_TO_BYTES: {
|
||||||
MethodInfo mi("var2bytes",PropertyInfo(Variant::NIL,"var"));
|
MethodInfo mi("var2bytes",PropertyInfo(Variant::NIL,"var"));
|
||||||
mi.return_val.type=Variant::RAW_ARRAY;
|
mi.return_val.type=Variant::POOL_BYTE_ARRAY;
|
||||||
return mi;
|
return mi;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case BYTES_TO_VAR: {
|
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;
|
mi.return_val.type=Variant::NIL;
|
||||||
return mi;
|
return mi;
|
||||||
} break;
|
} break;
|
||||||
|
|
|
@ -408,7 +408,7 @@ public:
|
||||||
virtual Script *create_script() const;
|
virtual Script *create_script() const;
|
||||||
virtual bool has_named_classes() const;
|
virtual bool has_named_classes() const;
|
||||||
virtual int find_function(const String& p_function,const String& p_code) 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);
|
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
|
#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);
|
virtual Error lookup_code(const String& p_code, const String& p_symbol, const String& p_base_path, Object*p_owner, LookupResult& r_result);
|
||||||
|
|
|
@ -788,13 +788,12 @@ void GDTokenizerText::_advance() {
|
||||||
{Variant::STRING,"String"},
|
{Variant::STRING,"String"},
|
||||||
{Variant::VECTOR2,"Vector2"},
|
{Variant::VECTOR2,"Vector2"},
|
||||||
{Variant::RECT2,"Rect2"},
|
{Variant::RECT2,"Rect2"},
|
||||||
{Variant::MATRIX32,"Matrix32"},
|
{Variant::TRANSFORM2D,"Transform2D"},
|
||||||
{Variant::VECTOR3,"Vector3"},
|
{Variant::VECTOR3,"Vector3"},
|
||||||
{Variant::_AABB,"AABB"},
|
{Variant::RECT3,"Rect3"},
|
||||||
{Variant::_AABB,"Rect3"},
|
|
||||||
{Variant::PLANE,"Plane"},
|
{Variant::PLANE,"Plane"},
|
||||||
{Variant::QUAT,"Quat"},
|
{Variant::QUAT,"Quat"},
|
||||||
{Variant::MATRIX3,"Matrix3"},
|
{Variant::BASIS,"Basis"},
|
||||||
{Variant::TRANSFORM,"Transform"},
|
{Variant::TRANSFORM,"Transform"},
|
||||||
{Variant::COLOR,"Color"},
|
{Variant::COLOR,"Color"},
|
||||||
{Variant::IMAGE,"Image"},
|
{Variant::IMAGE,"Image"},
|
||||||
|
@ -804,13 +803,13 @@ void GDTokenizerText::_advance() {
|
||||||
{Variant::NODE_PATH,"NodePath"},
|
{Variant::NODE_PATH,"NodePath"},
|
||||||
{Variant::DICTIONARY,"Dictionary"},
|
{Variant::DICTIONARY,"Dictionary"},
|
||||||
{Variant::ARRAY,"Array"},
|
{Variant::ARRAY,"Array"},
|
||||||
{Variant::RAW_ARRAY,"RawArray"},
|
{Variant::POOL_BYTE_ARRAY,"PoolByteArray"},
|
||||||
{Variant::INT_ARRAY,"IntArray"},
|
{Variant::POOL_INT_ARRAY,"PoolIntArray"},
|
||||||
{Variant::REAL_ARRAY,"FloatArray"},
|
{Variant::POOL_REAL_ARRAY,"PoolFloatArray"},
|
||||||
{Variant::STRING_ARRAY,"StringArray"},
|
{Variant::POOL_STRING_ARRAY,"PoolStringArray"},
|
||||||
{Variant::VECTOR2_ARRAY,"Vector2Array"},
|
{Variant::POOL_VECTOR2_ARRAY,"PoolVector2Array"},
|
||||||
{Variant::VECTOR3_ARRAY,"Vector3Array"},
|
{Variant::POOL_VECTOR3_ARRAY,"PoolVector3Array"},
|
||||||
{Variant::COLOR_ARRAY,"ColorArray"},
|
{Variant::POOL_COLOR_ARRAY,"PoolColorArray"},
|
||||||
{Variant::VARIANT_MAX,NULL},
|
{Variant::VARIANT_MAX,NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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()) {
|
for(const Map<int,Area*>::Element *E=area_map.front();E;E=E->next()) {
|
||||||
|
|
||||||
String base="areas/"+itos(E->key())+"/";
|
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::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::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) );
|
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());
|
ii.multimesh->set_instance_count(ii.cells.size());
|
||||||
|
|
||||||
AABB aabb;
|
Rect3 aabb;
|
||||||
AABB mesh_aabb = ii.mesh.is_null()?AABB():ii.mesh->get_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));
|
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;
|
Vector3 vertex = v.vertex + octant_ofs;
|
||||||
//print_line("V GET: "+vertex);
|
//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()) {
|
if (normal==Vector3()) {
|
||||||
print_line("couldn't find for vertex: "+vertex);
|
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_FAIL_COND_V(area_map.has(p_id),ERR_ALREADY_EXISTS);
|
||||||
ERR_EXPLAIN("ID 0 is taken as global area, start from 1");
|
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;
|
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];
|
const Area *a = area_map[p_area];
|
||||||
AABB aabb;
|
Rect3 aabb;
|
||||||
aabb.pos=Vector3(a->from.x,a->from.y,a->from.z);
|
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;
|
aabb.size=Vector3(a->to.x,a->to.y,a->to.z)-aabb.pos;
|
||||||
|
|
||||||
|
|
|
@ -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);
|
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);
|
Error create_area(int p_id,const Rect3& p_area);
|
||||||
AABB area_get_bounds(int p_area) const;
|
Rect3 area_get_bounds(int p_area) const;
|
||||||
void area_set_exterior_portal(int p_area,bool p_enable);
|
void area_set_exterior_portal(int p_area,bool p_enable);
|
||||||
void area_set_name(int p_area,const String& p_name);
|
void area_set_name(int p_area,const String& p_name);
|
||||||
String area_get_name(int p_area) const;
|
String area_get_name(int p_area) const;
|
||||||
|
|
|
@ -99,7 +99,7 @@ void GridMapEditor::_menu_option(int p_option) {
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case MENU_OPTION_CURSOR_ROTATE_Y: {
|
case MENU_OPTION_CURSOR_ROTATE_Y: {
|
||||||
Matrix3 r;
|
Basis r;
|
||||||
if (input_action==INPUT_DUPLICATE) {
|
if (input_action==INPUT_DUPLICATE) {
|
||||||
|
|
||||||
r.set_orthogonal_index(selection.duplicate_rot);
|
r.set_orthogonal_index(selection.duplicate_rot);
|
||||||
|
@ -114,7 +114,7 @@ void GridMapEditor::_menu_option(int p_option) {
|
||||||
_update_cursor_transform();
|
_update_cursor_transform();
|
||||||
} break;
|
} break;
|
||||||
case MENU_OPTION_CURSOR_ROTATE_X: {
|
case MENU_OPTION_CURSOR_ROTATE_X: {
|
||||||
Matrix3 r;
|
Basis r;
|
||||||
if (input_action==INPUT_DUPLICATE) {
|
if (input_action==INPUT_DUPLICATE) {
|
||||||
|
|
||||||
r.set_orthogonal_index(selection.duplicate_rot);
|
r.set_orthogonal_index(selection.duplicate_rot);
|
||||||
|
@ -130,7 +130,7 @@ void GridMapEditor::_menu_option(int p_option) {
|
||||||
_update_cursor_transform();
|
_update_cursor_transform();
|
||||||
} break;
|
} break;
|
||||||
case MENU_OPTION_CURSOR_ROTATE_Z: {
|
case MENU_OPTION_CURSOR_ROTATE_Z: {
|
||||||
Matrix3 r;
|
Basis r;
|
||||||
if (input_action==INPUT_DUPLICATE) {
|
if (input_action==INPUT_DUPLICATE) {
|
||||||
|
|
||||||
r.set_orthogonal_index(selection.duplicate_rot);
|
r.set_orthogonal_index(selection.duplicate_rot);
|
||||||
|
@ -146,21 +146,21 @@ void GridMapEditor::_menu_option(int p_option) {
|
||||||
_update_cursor_transform();
|
_update_cursor_transform();
|
||||||
} break;
|
} break;
|
||||||
case MENU_OPTION_CURSOR_BACK_ROTATE_Y: {
|
case MENU_OPTION_CURSOR_BACK_ROTATE_Y: {
|
||||||
Matrix3 r;
|
Basis r;
|
||||||
r.set_orthogonal_index(cursor_rot);
|
r.set_orthogonal_index(cursor_rot);
|
||||||
r.rotate(Vector3(0,1,0),Math_PI/2.0);
|
r.rotate(Vector3(0,1,0),Math_PI/2.0);
|
||||||
cursor_rot=r.get_orthogonal_index();
|
cursor_rot=r.get_orthogonal_index();
|
||||||
_update_cursor_transform();
|
_update_cursor_transform();
|
||||||
} break;
|
} break;
|
||||||
case MENU_OPTION_CURSOR_BACK_ROTATE_X: {
|
case MENU_OPTION_CURSOR_BACK_ROTATE_X: {
|
||||||
Matrix3 r;
|
Basis r;
|
||||||
r.set_orthogonal_index(cursor_rot);
|
r.set_orthogonal_index(cursor_rot);
|
||||||
r.rotate(Vector3(1,0,0),Math_PI/2.0);
|
r.rotate(Vector3(1,0,0),Math_PI/2.0);
|
||||||
cursor_rot=r.get_orthogonal_index();
|
cursor_rot=r.get_orthogonal_index();
|
||||||
_update_cursor_transform();
|
_update_cursor_transform();
|
||||||
} break;
|
} break;
|
||||||
case MENU_OPTION_CURSOR_BACK_ROTATE_Z: {
|
case MENU_OPTION_CURSOR_BACK_ROTATE_Z: {
|
||||||
Matrix3 r;
|
Basis r;
|
||||||
r.set_orthogonal_index(cursor_rot);
|
r.set_orthogonal_index(cursor_rot);
|
||||||
r.rotate(Vector3(0,0,1),Math_PI/2.0);
|
r.rotate(Vector3(0,0,1),Math_PI/2.0);
|
||||||
cursor_rot=r.get_orthogonal_index();
|
cursor_rot=r.get_orthogonal_index();
|
||||||
|
@ -191,7 +191,7 @@ void GridMapEditor::_menu_option(int p_option) {
|
||||||
if (!selection.active)
|
if (!selection.active)
|
||||||
break;
|
break;
|
||||||
int area = node->get_unused_area_id();
|
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) {
|
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]);
|
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()) {
|
if (cursor_instance.is_valid()) {
|
||||||
|
@ -459,7 +459,7 @@ void GridMapEditor::_update_duplicate_indicator() {
|
||||||
Transform xf;
|
Transform xf;
|
||||||
xf.scale(Vector3(1,1,1)*(Vector3(1,1,1)+(selection.end-selection.begin))*node->get_cell_size());
|
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();
|
xf.origin=(selection.begin+(selection.current-selection.click))*node->get_cell_size();
|
||||||
Matrix3 rot;
|
Basis rot;
|
||||||
rot.set_orthogonal_index(selection.duplicate_rot);
|
rot.set_orthogonal_index(selection.duplicate_rot);
|
||||||
xf.basis = rot * xf.basis;
|
xf.basis = rot * xf.basis;
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ void GridMapEditor::_duplicate_paste() {
|
||||||
|
|
||||||
List< __Item > items;
|
List< __Item > items;
|
||||||
|
|
||||||
Matrix3 rot;
|
Basis rot;
|
||||||
rot.set_orthogonal_index(selection.duplicate_rot);
|
rot.set_orthogonal_index(selection.duplicate_rot);
|
||||||
|
|
||||||
for(int i=selection.begin.x;i<=selection.end.x;i++) {
|
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;
|
Vector3 rel=Vector3(i,j,k)-selection.begin;
|
||||||
rel = rot.xform(rel);
|
rel = rot.xform(rel);
|
||||||
|
|
||||||
Matrix3 orm;
|
Basis orm;
|
||||||
orm.set_orthogonal_index(orientation);
|
orm.set_orthogonal_index(orientation);
|
||||||
orm = rot * orm;
|
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()) {
|
for(List<int>::Element *E=areas.front();E;E=E->next()) {
|
||||||
|
|
||||||
int area = E->get();
|
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.pos*=node->get_cell_size();
|
||||||
aabb.size*=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();
|
grid_ofs[edit_axis]=edit_floor[edit_axis]*node->get_cell_size();
|
||||||
|
|
||||||
edit_grid_xform.origin=grid_ofs;
|
edit_grid_xform.origin=grid_ofs;
|
||||||
edit_grid_xform.basis=Matrix3();
|
edit_grid_xform.basis=Basis();
|
||||||
|
|
||||||
|
|
||||||
for(int i=0;i<3;i++) {
|
for(int i=0;i<3;i++) {
|
||||||
|
@ -1142,7 +1142,7 @@ void GridMapEditor::_update_areas_display() {
|
||||||
ad.mesh=mesh;
|
ad.mesh=mesh;
|
||||||
ad.instance = VisualServer::get_singleton()->instance_create2(mesh,node->get_world()->get_scenario());
|
ad.instance = VisualServer::get_singleton()->instance_create2(mesh,node->get_world()->get_scenario());
|
||||||
Transform xform;
|
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.origin=aabb.pos * node->get_cell_size();
|
||||||
xform.basis.scale(aabb.size * node->get_cell_size());
|
xform.basis.scale(aabb.size * node->get_cell_size());
|
||||||
VisualServer::get_singleton()->instance_set_transform(ad.instance,global_xf * xform);
|
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++) {
|
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;
|
Vector3 a,b;
|
||||||
base.get_edge(i,a,b);
|
base.get_edge(i,a,b);
|
||||||
lines.push_back(a);
|
lines.push_back(a);
|
||||||
|
|
|
@ -564,9 +564,9 @@ StreamPeerSSL* StreamPeerOpenSSL::_create_func() {
|
||||||
Vector<X509*> StreamPeerOpenSSL::certs;
|
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* mem = BIO_new(BIO_s_mem());
|
||||||
BIO_puts(mem,(const char*)r.ptr());
|
BIO_puts(mem,(const char*)r.ptr());
|
||||||
while(true) {
|
while(true) {
|
||||||
|
@ -598,11 +598,11 @@ void StreamPeerOpenSSL::initialize_ssl() {
|
||||||
|
|
||||||
FileAccess *f=FileAccess::open(certs_path,FileAccess::READ);
|
FileAccess *f=FileAccess::open(certs_path,FileAccess::READ);
|
||||||
if (f) {
|
if (f) {
|
||||||
ByteArray arr;
|
PoolByteArray arr;
|
||||||
int flen = f->get_len();
|
int flen = f->get_len();
|
||||||
arr.resize(flen+1);
|
arr.resize(flen+1);
|
||||||
{
|
{
|
||||||
ByteArray::Write w = arr.write();
|
PoolByteArray::Write w = arr.write();
|
||||||
f->get_buffer(w.ptr(),flen);
|
f->get_buffer(w.ptr(),flen);
|
||||||
w[flen]=0; //end f string
|
w[flen]=0; //end f string
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ private:
|
||||||
|
|
||||||
static Vector<X509*> certs;
|
static Vector<X509*> certs;
|
||||||
|
|
||||||
static void _load_certs(const ByteArray& p_array);
|
static void _load_certs(const PoolByteArray& p_array);
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -2525,7 +2525,7 @@ int VisualScriptLanguage::find_function(const String& p_function,const String& p
|
||||||
|
|
||||||
return -1;
|
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();
|
return String();
|
||||||
}
|
}
|
||||||
|
|
|
@ -560,7 +560,7 @@ public:
|
||||||
virtual Script *create_script() const;
|
virtual Script *create_script() const;
|
||||||
virtual bool has_named_classes() const;
|
virtual bool has_named_classes() const;
|
||||||
virtual int find_function(const String& p_function,const String& p_code) 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 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);
|
virtual void add_global_constant(const StringName& p_variable,const Variant& p_value);
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
|
||||||
} break;
|
} break;
|
||||||
case BYTES_TO_VAR: {
|
case BYTES_TO_VAR: {
|
||||||
|
|
||||||
return PropertyInfo(Variant::RAW_ARRAY,"bytes");
|
return PropertyInfo(Variant::POOL_BYTE_ARRAY,"bytes");
|
||||||
} break;
|
} break;
|
||||||
case FUNC_MAX:{}
|
case FUNC_MAX:{}
|
||||||
}
|
}
|
||||||
|
@ -548,7 +548,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VAR_TO_BYTES: {
|
case VAR_TO_BYTES: {
|
||||||
t=Variant::RAW_ARRAY;
|
t=Variant::POOL_BYTE_ARRAY;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case BYTES_TO_VAR: {
|
case BYTES_TO_VAR: {
|
||||||
|
@ -1058,7 +1058,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
|
||||||
case VisualScriptBuiltinFunc::VAR_TO_BYTES: {
|
case VisualScriptBuiltinFunc::VAR_TO_BYTES: {
|
||||||
|
|
||||||
|
|
||||||
ByteArray barr;
|
PoolByteArray barr;
|
||||||
int len;
|
int len;
|
||||||
Error err = encode_variant(*p_inputs[0],NULL,len);
|
Error err = encode_variant(*p_inputs[0],NULL,len);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -1071,7 +1071,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
|
||||||
|
|
||||||
barr.resize(len);
|
barr.resize(len);
|
||||||
{
|
{
|
||||||
ByteArray::Write w = barr.write();
|
PoolByteArray::Write w = barr.write();
|
||||||
encode_variant(*p_inputs[0],w.ptr(),len);
|
encode_variant(*p_inputs[0],w.ptr(),len);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1079,24 +1079,24 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inp
|
||||||
} break;
|
} break;
|
||||||
case VisualScriptBuiltinFunc::BYTES_TO_VAR: {
|
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.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument=0;
|
r_error.argument=0;
|
||||||
r_error.expected=Variant::RAW_ARRAY;
|
r_error.expected=Variant::POOL_BYTE_ARRAY;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArray varr=*p_inputs[0];
|
PoolByteArray varr=*p_inputs[0];
|
||||||
Variant ret;
|
Variant ret;
|
||||||
{
|
{
|
||||||
ByteArray::Read r=varr.read();
|
PoolByteArray::Read r=varr.read();
|
||||||
Error err = decode_variant(ret,r.ptr(),varr.size(),NULL);
|
Error err = decode_variant(ret,r.ptr(),varr.size(),NULL);
|
||||||
if (err!=OK) {
|
if (err!=OK) {
|
||||||
r_error_str=RTR("Not enough bytes for decoding bytes, or invalid format.");
|
r_error_str=RTR("Not enough bytes for decoding bytes, or invalid format.");
|
||||||
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument=0;
|
r_error.argument=0;
|
||||||
r_error.expected=Variant::RAW_ARRAY;
|
r_error.expected=Variant::POOL_BYTE_ARRAY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -326,11 +326,11 @@ static Color _color_from_type(Variant::Type p_type) {
|
||||||
case Variant::VECTOR2: color = Color::html("bd91f1"); break;
|
case Variant::VECTOR2: color = Color::html("bd91f1"); break;
|
||||||
case Variant::RECT2: color = Color::html("f191a5"); break;
|
case Variant::RECT2: color = Color::html("f191a5"); break;
|
||||||
case Variant::VECTOR3: color = Color::html("d67dee"); 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::PLANE: color = Color::html("f77070"); break;
|
||||||
case Variant::QUAT: color = Color::html("ec69a3"); break;
|
case Variant::QUAT: color = Color::html("ec69a3"); break;
|
||||||
case Variant::_AABB: color = Color::html("ee7991"); break;
|
case Variant::RECT3: color = Color::html("ee7991"); break;
|
||||||
case Variant::MATRIX3: color = Color::html("e3ec69"); break;
|
case Variant::BASIS: color = Color::html("e3ec69"); break;
|
||||||
case Variant::TRANSFORM: color = Color::html("f6a86e"); break;
|
case Variant::TRANSFORM: color = Color::html("f6a86e"); break;
|
||||||
|
|
||||||
case Variant::COLOR: color = Color::html("9dff70"); 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::DICTIONARY: color = Color::html("77edb1"); break;
|
||||||
|
|
||||||
case Variant::ARRAY: color = Color::html("e0e0e0"); break;
|
case Variant::ARRAY: color = Color::html("e0e0e0"); break;
|
||||||
case Variant::RAW_ARRAY: color = Color::html("aaf4c8"); break;
|
case Variant::POOL_BYTE_ARRAY: color = Color::html("aaf4c8"); break;
|
||||||
case Variant::INT_ARRAY: color = Color::html("afdcf5"); break;
|
case Variant::POOL_INT_ARRAY: color = Color::html("afdcf5"); break;
|
||||||
case Variant::REAL_ARRAY: color = Color::html("97e7f8"); break;
|
case Variant::POOL_REAL_ARRAY: color = Color::html("97e7f8"); break;
|
||||||
case Variant::STRING_ARRAY: color = Color::html("9dc4f2"); break;
|
case Variant::POOL_STRING_ARRAY: color = Color::html("9dc4f2"); break;
|
||||||
case Variant::VECTOR2_ARRAY: color = Color::html("d1b3f5"); break;
|
case Variant::POOL_VECTOR2_ARRAY: color = Color::html("d1b3f5"); break;
|
||||||
case Variant::VECTOR3_ARRAY: color = Color::html("df9bf2"); break;
|
case Variant::POOL_VECTOR3_ARRAY: color = Color::html("df9bf2"); break;
|
||||||
case Variant::COLOR_ARRAY: color = Color::html("e9ff97"); break;
|
case Variant::POOL_COLOR_ARRAY: color = Color::html("e9ff97"); break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
color.set_hsv(p_type/float(Variant::VARIANT_MAX),0.7,0.7);
|
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("MiniVector2","EditorIcons"),
|
||||||
Control::get_icon("MiniRect2","EditorIcons"),
|
Control::get_icon("MiniRect2","EditorIcons"),
|
||||||
Control::get_icon("MiniVector3","EditorIcons"),
|
Control::get_icon("MiniVector3","EditorIcons"),
|
||||||
Control::get_icon("MiniMatrix32","EditorIcons"),
|
Control::get_icon("MiniTransform2D","EditorIcons"),
|
||||||
Control::get_icon("MiniPlane","EditorIcons"),
|
Control::get_icon("MiniPlane","EditorIcons"),
|
||||||
Control::get_icon("MiniQuat","EditorIcons"),
|
Control::get_icon("MiniQuat","EditorIcons"),
|
||||||
Control::get_icon("MiniAabb","EditorIcons"),
|
Control::get_icon("MiniAabb","EditorIcons"),
|
||||||
Control::get_icon("MiniMatrix3","EditorIcons"),
|
Control::get_icon("MiniBasis","EditorIcons"),
|
||||||
Control::get_icon("MiniTransform","EditorIcons"),
|
Control::get_icon("MiniTransform","EditorIcons"),
|
||||||
Control::get_icon("MiniColor","EditorIcons"),
|
Control::get_icon("MiniColor","EditorIcons"),
|
||||||
Control::get_icon("MiniImage","EditorIcons"),
|
Control::get_icon("MiniImage","EditorIcons"),
|
||||||
|
@ -2321,7 +2321,7 @@ bool VisualScriptEditor::goto_method(const String& p_method){
|
||||||
return true;
|
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)) {
|
if (script->has_function(p_function)) {
|
||||||
edited_func=p_function;
|
edited_func=p_function;
|
||||||
|
|
|
@ -225,7 +225,7 @@ public:
|
||||||
virtual void reload(bool p_soft);
|
virtual void reload(bool p_soft);
|
||||||
virtual void get_breakpoints(List<int> *p_breakpoints);
|
virtual void get_breakpoints(List<int> *p_breakpoints);
|
||||||
virtual bool goto_method(const String& p_method);
|
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 update_settings();
|
||||||
virtual void set_debugger_active(bool p_active);
|
virtual void set_debugger_active(bool p_active);
|
||||||
virtual void set_tooltip_request_func(String p_method,Object* p_obj);
|
virtual void set_tooltip_request_func(String p_method,Object* p_obj);
|
||||||
|
|
|
@ -98,14 +98,14 @@ class JavaClass : public Reference {
|
||||||
case ARG_TYPE_CLASS: r_type=Variant::OBJECT; break;
|
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_VOID: r_type=Variant::NIL; break;
|
||||||
case ARG_ARRAY_BIT|ARG_TYPE_BOOLEAN: r_type=Variant::ARRAY; 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_BYTE: r_type=Variant::POOL_BYTE_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_CHAR: r_type=Variant::POOL_BYTE_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_SHORT: r_type=Variant::POOL_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_INT: r_type=Variant::POOL_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_LONG: r_type=Variant::POOL_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_FLOAT: r_type=Variant::POOL_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_DOUBLE: r_type=Variant::POOL_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_STRING: r_type=Variant::POOL_STRING_ARRAY; break;
|
||||||
case ARG_ARRAY_BIT|ARG_TYPE_CLASS: r_type=Variant::ARRAY; break;
|
case ARG_ARRAY_BIT|ARG_TYPE_CLASS: r_type=Variant::ARRAY; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a
|
||||||
v.val.l=jStr;
|
v.val.l=jStr;
|
||||||
v.obj=jStr;
|
v.obj=jStr;
|
||||||
} break;
|
} break;
|
||||||
case Variant::STRING_ARRAY: {
|
case Variant::POOL_STRING_ARRAY: {
|
||||||
|
|
||||||
PoolVector<String> sarray = *p_arg;
|
PoolVector<String> sarray = *p_arg;
|
||||||
jobjectArray arr = env->NewObjectArray(sarray.size(),env->FindClass("java/lang/String"),env->NewStringUTF(""));
|
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;
|
v.obj=jdict;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case Variant::INT_ARRAY: {
|
case Variant::POOL_INT_ARRAY: {
|
||||||
|
|
||||||
PoolVector<int> array = *p_arg;
|
PoolVector<int> array = *p_arg;
|
||||||
jintArray arr = env->NewIntArray(array.size());
|
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;
|
v.obj=arr;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::RAW_ARRAY: {
|
case Variant::POOL_BYTE_ARRAY: {
|
||||||
PoolVector<uint8_t> array = *p_arg;
|
PoolVector<uint8_t> array = *p_arg;
|
||||||
jbyteArray arr = env->NewByteArray(array.size());
|
jbyteArray arr = env->NewByteArray(array.size());
|
||||||
PoolVector<uint8_t>::Read r = array.read();
|
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;
|
v.obj=arr;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Variant::REAL_ARRAY: {
|
case Variant::POOL_REAL_ARRAY: {
|
||||||
|
|
||||||
PoolVector<float> array = *p_arg;
|
PoolVector<float> array = *p_arg;
|
||||||
jfloatArray arr = env->NewFloatArray(array.size());
|
jfloatArray arr = env->NewFloatArray(array.size());
|
||||||
|
@ -324,10 +324,10 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
|
||||||
|
|
||||||
jdoubleArray arr = (jdoubleArray)obj;
|
jdoubleArray arr = (jdoubleArray)obj;
|
||||||
int fCount = env->GetArrayLength(arr);
|
int fCount = env->GetArrayLength(arr);
|
||||||
RealArray sarr;
|
PoolRealArray sarr;
|
||||||
sarr.resize(fCount);
|
sarr.resize(fCount);
|
||||||
|
|
||||||
RealArray::Write w = sarr.write();
|
PoolRealArray::Write w = sarr.write();
|
||||||
|
|
||||||
for (int i=0; i<fCount; i++) {
|
for (int i=0; i<fCount; i++) {
|
||||||
|
|
||||||
|
@ -343,11 +343,11 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
|
||||||
|
|
||||||
jfloatArray arr = (jfloatArray)obj;
|
jfloatArray arr = (jfloatArray)obj;
|
||||||
int fCount = env->GetArrayLength(arr);
|
int fCount = env->GetArrayLength(arr);
|
||||||
RealArray sarr;
|
PoolRealArray sarr;
|
||||||
sarr.resize(fCount);
|
sarr.resize(fCount);
|
||||||
|
|
||||||
|
|
||||||
RealArray::Write w = sarr.write();
|
PoolRealArray::Write w = sarr.write();
|
||||||
|
|
||||||
for (int i=0; i<fCount; i++) {
|
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;");
|
jmethodID get_keys = env->GetMethodID(oclass, "get_keys", "()[Ljava/lang/String;");
|
||||||
jobjectArray arr = (jobjectArray)env->CallObjectMethod(obj, get_keys);
|
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);
|
env->DeleteLocalRef(arr);
|
||||||
|
|
||||||
jmethodID get_values = env->GetMethodID(oclass, "get_values", "()[Ljava/lang/Object;");
|
jmethodID get_values = env->GetMethodID(oclass, "get_values", "()[Ljava/lang/Object;");
|
||||||
|
@ -527,7 +527,7 @@ public:
|
||||||
ret = String::utf8(env->GetStringUTFChars((jstring)o, NULL));
|
ret = String::utf8(env->GetStringUTFChars((jstring)o, NULL));
|
||||||
env->DeleteLocalRef(o);
|
env->DeleteLocalRef(o);
|
||||||
} break;
|
} break;
|
||||||
case Variant::STRING_ARRAY: {
|
case Variant::POOL_STRING_ARRAY: {
|
||||||
|
|
||||||
jobjectArray arr = (jobjectArray)env->CallObjectMethodA(instance,E->get().method,v);
|
jobjectArray arr = (jobjectArray)env->CallObjectMethodA(instance,E->get().method,v);
|
||||||
|
|
||||||
|
@ -535,7 +535,7 @@ public:
|
||||||
|
|
||||||
env->DeleteLocalRef(arr);
|
env->DeleteLocalRef(arr);
|
||||||
} break;
|
} break;
|
||||||
case Variant::INT_ARRAY: {
|
case Variant::POOL_INT_ARRAY: {
|
||||||
|
|
||||||
jintArray arr = (jintArray)env->CallObjectMethodA(instance,E->get().method,v);
|
jintArray arr = (jintArray)env->CallObjectMethodA(instance,E->get().method,v);
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ public:
|
||||||
ret=sarr;
|
ret=sarr;
|
||||||
env->DeleteLocalRef(arr);
|
env->DeleteLocalRef(arr);
|
||||||
} break;
|
} break;
|
||||||
case Variant::REAL_ARRAY: {
|
case Variant::POOL_REAL_ARRAY: {
|
||||||
|
|
||||||
jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance,E->get().method,v);
|
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},
|
{"float",Variant::REAL},
|
||||||
{"double", Variant::REAL},
|
{"double", Variant::REAL},
|
||||||
{"java.lang.String",Variant::STRING},
|
{"java.lang.String",Variant::STRING},
|
||||||
{"[I",Variant::INT_ARRAY},
|
{"[I",Variant::POOL_INT_ARRAY},
|
||||||
{"[B",Variant::RAW_ARRAY},
|
{"[B",Variant::POOL_BYTE_ARRAY},
|
||||||
{"[F",Variant::REAL_ARRAY},
|
{"[F",Variant::POOL_REAL_ARRAY},
|
||||||
{"[Ljava.lang.String;",Variant::STRING_ARRAY},
|
{"[Ljava.lang.String;",Variant::POOL_STRING_ARRAY},
|
||||||
{"org.godotengine.godot.Dictionary", Variant::DICTIONARY},
|
{"org.godotengine.godot.Dictionary", Variant::DICTIONARY},
|
||||||
{NULL,Variant::NIL}
|
{NULL,Variant::NIL}
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,7 +47,7 @@ void Camera2D::_update_scroll() {
|
||||||
|
|
||||||
ERR_FAIL_COND( custom_viewport && !ObjectDB::get_instance(custom_viewport_id) );
|
ERR_FAIL_COND( custom_viewport && !ObjectDB::get_instance(custom_viewport_id) );
|
||||||
|
|
||||||
Matrix32 xform = get_camera_transform();
|
Transform2D xform = get_camera_transform();
|
||||||
|
|
||||||
if (viewport) {
|
if (viewport) {
|
||||||
viewport->set_canvas_transform( xform );
|
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())
|
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;
|
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;
|
camera_screen_center=screen_rect.pos+screen_rect.size*0.5;
|
||||||
|
|
||||||
Matrix32 xform;
|
Transform2D xform;
|
||||||
if(rotating){
|
if(rotating){
|
||||||
xform.set_rotation(angle);
|
xform.set_rotation(angle);
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ void Camera2D::_notification(int p_what) {
|
||||||
|
|
||||||
if (is_current()) {
|
if (is_current()) {
|
||||||
if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) {
|
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);
|
remove_from_group(group_name);
|
||||||
|
@ -290,7 +290,7 @@ void Camera2D::_notification(int p_what) {
|
||||||
if(current)
|
if(current)
|
||||||
area_axis_width = 3;
|
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;
|
Size2 screen_size = get_viewport_rect().size;
|
||||||
|
|
||||||
Vector2 screen_endpoints[4]= {
|
Vector2 screen_endpoints[4]= {
|
||||||
|
@ -300,7 +300,7 @@ void Camera2D::_notification(int p_what) {
|
||||||
inv_camera_transform.xform(Vector2(0, screen_size.height))
|
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++) {
|
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);
|
draw_line(inv_transform.xform(screen_endpoints[i]), inv_transform.xform(screen_endpoints[(i+1)%4]), area_axis_color, area_axis_width);
|
||||||
|
|
|
@ -80,7 +80,7 @@ protected:
|
||||||
void _set_old_smoothing(float p_enable);
|
void _set_old_smoothing(float p_enable);
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual Matrix32 get_camera_transform();
|
virtual Transform2D get_camera_transform();
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -325,10 +325,10 @@ void CanvasItem::_update_callback() {
|
||||||
pending_update=false; // don't change to false until finished drawing (avoid recursive update)
|
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;
|
const CanvasItem *ci = this;
|
||||||
Matrix32 xform;
|
Transform2D xform;
|
||||||
const CanvasItem *last_valid=NULL;
|
const CanvasItem *last_valid=NULL;
|
||||||
|
|
||||||
while(ci) {
|
while(ci) {
|
||||||
|
@ -346,7 +346,7 @@ Matrix32 CanvasItem::get_global_transform_with_canvas() const {
|
||||||
return xform;
|
return xform;
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix32 CanvasItem::get_global_transform() const {
|
Transform2D CanvasItem::get_global_transform() const {
|
||||||
|
|
||||||
|
|
||||||
if (global_invalid) {
|
if (global_invalid) {
|
||||||
|
@ -691,12 +691,12 @@ void CanvasItem::draw_set_transform(const Point2& p_offset, float p_rot, const S
|
||||||
ERR_FAIL();
|
ERR_FAIL();
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix32 xform(p_rot,p_offset);
|
Transform2D xform(p_rot,p_offset);
|
||||||
xform.scale_basis(p_scale);
|
xform.scale_basis(p_scale);
|
||||||
VisualServer::get_singleton()->canvas_item_add_set_transform(canvas_item,xform);
|
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) {
|
if (!drawing) {
|
||||||
ERR_EXPLAIN("Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
|
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);
|
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();
|
get_global_transform()).affine_inverse();
|
||||||
|
|
||||||
return local_matrix.xform(screen_point);
|
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_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_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_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_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(Vector2Array()),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_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)));
|
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)
|
if (canvas_layer)
|
||||||
return canvas_layer->get_transform();
|
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) {
|
if (canvas_layer) {
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ private:
|
||||||
|
|
||||||
Ref<CanvasItemMaterial> material;
|
Ref<CanvasItemMaterial> material;
|
||||||
|
|
||||||
mutable Matrix32 global_transform;
|
mutable Transform2D global_transform;
|
||||||
mutable bool global_invalid;
|
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));
|
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(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 */
|
/* RECT / TRANSFORM */
|
||||||
|
|
||||||
|
@ -220,10 +220,10 @@ public:
|
||||||
CanvasItem *get_parent_item() const;
|
CanvasItem *get_parent_item() const;
|
||||||
|
|
||||||
virtual Rect2 get_item_rect() const=0;
|
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 Transform2D get_global_transform() const;
|
||||||
virtual Matrix32 get_global_transform_with_canvas() const;
|
virtual Transform2D get_global_transform_with_canvas() const;
|
||||||
|
|
||||||
Rect2 get_item_and_children_rect() const;
|
Rect2 get_item_and_children_rect() const;
|
||||||
|
|
||||||
|
@ -234,8 +234,8 @@ public:
|
||||||
bool is_block_transform_notify_enabled() const;
|
bool is_block_transform_notify_enabled() const;
|
||||||
|
|
||||||
|
|
||||||
Matrix32 get_canvas_transform() const;
|
Transform2D get_canvas_transform() const;
|
||||||
Matrix32 get_viewport_transform() const;
|
Transform2D get_viewport_transform() const;
|
||||||
Rect2 get_viewport_rect() const;
|
Rect2 get_viewport_rect() const;
|
||||||
RID get_viewport_rid() const;
|
RID get_viewport_rid() const;
|
||||||
RID get_canvas() const;
|
RID get_canvas() const;
|
||||||
|
|
|
@ -221,7 +221,7 @@ void CollisionObject2D::_update_pickable() {
|
||||||
|
|
||||||
void CollisionObject2D::_bind_methods() {
|
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("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","shape_idx","shape:Shape"),&CollisionObject2D::set_shape);
|
||||||
ClassDB::bind_method(_MD("set_shape_transform","shape_idx","transform"),&CollisionObject2D::set_shape_transform);
|
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());
|
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();
|
// _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());
|
ERR_FAIL_INDEX(p_shape_idx,shapes.size());
|
||||||
shapes[p_shape_idx].xform=p_transform;
|
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;
|
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;
|
return shapes[p_shape_idx].xform;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class CollisionObject2D : public Node2D {
|
||||||
bool pickable;
|
bool pickable;
|
||||||
|
|
||||||
struct ShapeData {
|
struct ShapeData {
|
||||||
Matrix32 xform;
|
Transform2D xform;
|
||||||
Ref<Shape2D> shape;
|
Ref<Shape2D> shape;
|
||||||
bool trigger;
|
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;
|
int get_shape_count() const;
|
||||||
void set_shape(int p_shape_idx, const Ref<Shape2D>& p_shape);
|
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;
|
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);
|
void set_shape_as_trigger(int p_shape_idx, bool p_trigger);
|
||||||
bool is_shape_set_as_trigger(int p_shape_idx) const;
|
bool is_shape_set_as_trigger(int p_shape_idx) const;
|
||||||
void remove_shape(int p_shape_idx);
|
void remove_shape(int p_shape_idx);
|
||||||
|
|
|
@ -330,7 +330,7 @@ void CollisionPolygon2D::_bind_methods() {
|
||||||
ClassDB::bind_method(_MD("get_collision_object_last_shape"),&CollisionPolygon2D::get_collision_object_last_shape);
|
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::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::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"));
|
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"trigger"),_SCS("set_trigger"),_SCS("is_trigger"));
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,7 @@ RID GrooveJoint2D::_configure_joint(){
|
||||||
else
|
else
|
||||||
Physics2DServer::get_singleton()->body_remove_collision_exception(body_a->get_rid(),body_b->get_rid());
|
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_A1 = gt.get_origin();
|
||||||
Vector2 groove_A2 = gt.xform( Vector2(0,length) );
|
Vector2 groove_A2 = gt.xform( Vector2(0,length) );
|
||||||
Vector2 anchor_B = gt.xform( Vector2(0,initial_offset) );
|
Vector2 anchor_B = gt.xform( Vector2(0,initial_offset) );
|
||||||
|
@ -384,7 +384,7 @@ RID DampedSpringJoint2D::_configure_joint(){
|
||||||
else
|
else
|
||||||
Physics2DServer::get_singleton()->body_remove_collision_exception(body_a->get_rid(),body_b->get_rid());
|
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_A = gt.get_origin();
|
||||||
Vector2 anchor_B = gt.xform( Vector2(0,length) );
|
Vector2 anchor_B = gt.xform( Vector2(0,length) );
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ void OccluderPolygon2D::_bind_methods() {
|
||||||
|
|
||||||
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"closed"),_SCS("set_closed"),_SCS("is_closed"));
|
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::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_DISABLED);
|
||||||
BIND_CONSTANT(CULL_CLOCKWISE);
|
BIND_CONSTANT(CULL_CLOCKWISE);
|
||||||
|
|
|
@ -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++;
|
int id = last_id++;
|
||||||
NavMesh nm;
|
NavMesh nm;
|
||||||
|
@ -227,7 +227,7 @@ int Navigation2D::navpoly_create(const Ref<NavigationPolygon>& p_mesh, const Mat
|
||||||
return id;
|
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));
|
ERR_FAIL_COND(!navpoly_map.has(p_id));
|
||||||
NavMesh &nm=navpoly_map[p_id];
|
NavMesh &nm=navpoly_map[p_id];
|
||||||
|
|
|
@ -119,7 +119,7 @@ class Navigation2D : public Node2D {
|
||||||
struct NavMesh {
|
struct NavMesh {
|
||||||
|
|
||||||
Object *owner;
|
Object *owner;
|
||||||
Matrix32 xform;
|
Transform2D xform;
|
||||||
bool linked;
|
bool linked;
|
||||||
Ref<NavigationPolygon> navpoly;
|
Ref<NavigationPolygon> navpoly;
|
||||||
List<Polygon> polygons;
|
List<Polygon> polygons;
|
||||||
|
@ -164,8 +164,8 @@ protected:
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//API should be as dynamic as possible
|
//API should be as dynamic as possible
|
||||||
int navpoly_create(const Ref<NavigationPolygon>& p_mesh,const Matrix32& p_xform,Object* p_owner=NULL);
|
int navpoly_create(const Ref<NavigationPolygon>& p_mesh,const Transform2D& p_xform,Object* p_owner=NULL);
|
||||||
void navpoly_set_transform(int p_id, const Matrix32& p_xform);
|
void navpoly_set_transform(int p_id, const Transform2D& p_xform);
|
||||||
void navpoly_remove(int p_id);
|
void navpoly_remove(int p_id);
|
||||||
|
|
||||||
Vector<Vector2> get_simple_path(const Vector2& p_start, const Vector2& p_end,bool p_optimize=true);
|
Vector<Vector2> get_simple_path(const Vector2& p_start, const Vector2& p_end,bool p_optimize=true);
|
||||||
|
|
|
@ -270,7 +270,7 @@ void NavigationPolygon::_bind_methods() {
|
||||||
ClassDB::bind_method(_MD("_set_outlines","outlines"),&NavigationPolygon::_set_outlines);
|
ClassDB::bind_method(_MD("_set_outlines","outlines"),&NavigationPolygon::_set_outlines);
|
||||||
ClassDB::bind_method(_MD("_get_outlines"),&NavigationPolygon::_get_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,"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"));
|
ADD_PROPERTY(PropertyInfo(Variant::ARRAY,"outlines",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_outlines"),_SCS("_get_outlines"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
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);
|
postxf.set_rotation_and_scale(angle,_scale);
|
||||||
new_pos = postxf.xform(new_pos);
|
new_pos = postxf.xform(new_pos);
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ void Node2D::_update_xform_values() {
|
||||||
|
|
||||||
void Node2D::_update_transform() {
|
void Node2D::_update_transform() {
|
||||||
|
|
||||||
Matrix32 mat(angle,pos);
|
Transform2D mat(angle,pos);
|
||||||
_mat.set_rotation_and_scale(angle,_scale);
|
_mat.set_rotation_and_scale(angle,_scale);
|
||||||
_mat.elements[2]=pos;
|
_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;
|
return _mat;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ void Node2D::scale(const Size2& p_amount) {
|
||||||
|
|
||||||
void Node2D::move_x(float p_delta,bool p_scaled){
|
void Node2D::move_x(float p_delta,bool p_scaled){
|
||||||
|
|
||||||
Matrix32 t = get_transform();
|
Transform2D t = get_transform();
|
||||||
Vector2 m = t[0];
|
Vector2 m = t[0];
|
||||||
if (!p_scaled)
|
if (!p_scaled)
|
||||||
m.normalize();
|
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){
|
void Node2D::move_y(float p_delta,bool p_scaled){
|
||||||
|
|
||||||
Matrix32 t = get_transform();
|
Transform2D t = get_transform();
|
||||||
Vector2 m = t[1];
|
Vector2 m = t[1];
|
||||||
if (!p_scaled)
|
if (!p_scaled)
|
||||||
m.normalize();
|
m.normalize();
|
||||||
|
@ -285,7 +285,7 @@ Point2 Node2D::get_global_position() const {
|
||||||
|
|
||||||
void Node2D::set_global_position(const Point2& p_pos) {
|
void Node2D::set_global_position(const Point2& p_pos) {
|
||||||
|
|
||||||
Matrix32 inv;
|
Transform2D inv;
|
||||||
CanvasItem *pi = get_parent_item();
|
CanvasItem *pi = get_parent_item();
|
||||||
if (pi) {
|
if (pi) {
|
||||||
inv = pi->get_global_transform().affine_inverse();
|
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;
|
_mat=p_transform;
|
||||||
_xform_dirty=true;
|
_xform_dirty=true;
|
||||||
|
@ -355,7 +355,7 @@ void Node2D::set_transform(const Matrix32& p_transform) {
|
||||||
_notify_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();
|
CanvasItem *pi = get_parent_item();
|
||||||
if (pi)
|
if (pi)
|
||||||
|
@ -394,14 +394,14 @@ int Node2D::get_z() const{
|
||||||
return z;
|
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)
|
if (p_parent==this)
|
||||||
return Matrix32();
|
return Transform2D();
|
||||||
|
|
||||||
Node2D *parent_2d = get_parent()->cast_to<Node2D>();
|
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)
|
if (p_parent==parent_2d)
|
||||||
return get_transform();
|
return get_transform();
|
||||||
else
|
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",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_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_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_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",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_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::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_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"));
|
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"));
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Node2D : public CanvasItem {
|
||||||
int z;
|
int z;
|
||||||
bool z_relative;
|
bool z_relative;
|
||||||
|
|
||||||
Matrix32 _mat;
|
Transform2D _mat;
|
||||||
|
|
||||||
bool _xform_dirty;
|
bool _xform_dirty;
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ public:
|
||||||
Size2 get_global_scale() const;
|
Size2 get_global_scale() const;
|
||||||
virtual Rect2 get_item_rect() const;
|
virtual Rect2 get_item_rect() const;
|
||||||
|
|
||||||
void set_transform(const Matrix32& p_transform);
|
void set_transform(const Transform2D& p_transform);
|
||||||
void set_global_transform(const Matrix32& p_transform);
|
void set_global_transform(const Transform2D& p_transform);
|
||||||
void set_global_position(const Point2& p_pos);
|
void set_global_position(const Point2& p_pos);
|
||||||
void set_global_rotation(float p_radians);
|
void set_global_rotation(float p_radians);
|
||||||
void set_global_rotation_in_degrees(float p_degrees);
|
void set_global_rotation_in_degrees(float p_degrees);
|
||||||
|
@ -108,9 +108,9 @@ public:
|
||||||
void set_z_as_relative(bool p_enabled);
|
void set_z_as_relative(bool p_enabled);
|
||||||
bool is_z_relative() const;
|
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();
|
Node2D();
|
||||||
};
|
};
|
||||||
|
|
|
@ -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());
|
set_scroll_offset(p_transform.get_origin());
|
||||||
|
|
|
@ -50,7 +50,7 @@ class ParallaxBackground : public CanvasLayer {
|
||||||
void _update_scroll();
|
void _update_scroll();
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void _camera_moved(const Matrix32& p_transform);
|
void _camera_moved(const Transform2D& p_transform);
|
||||||
|
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
|
@ -270,7 +270,7 @@ void Particles2D::_process_particles(float p_delta) {
|
||||||
|
|
||||||
Particle *pdata=&particles[0];
|
Particle *pdata=&particles[0];
|
||||||
int particle_count=particles.size();
|
int particle_count=particles.size();
|
||||||
Matrix32 xform;
|
Transform2D xform;
|
||||||
if (!local_space)
|
if (!local_space)
|
||||||
xform=get_global_transform();
|
xform=get_global_transform();
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ void Particles2D::_process_particles(float p_delta) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int idx=0;
|
int idx=0;
|
||||||
Matrix32 m;
|
Transform2D m;
|
||||||
if (local_space) {
|
if (local_space) {
|
||||||
m= get_global_transform().affine_inverse();
|
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));
|
float orbitvel = (param[PARAM_ORBIT_VELOCITY]+param[PARAM_ORBIT_VELOCITY]*randomness[PARAM_ORBIT_VELOCITY]*_rand_from_seed(&rand_seed));
|
||||||
if (orbitvel!=0) {
|
if (orbitvel!=0) {
|
||||||
Vector2 rel = p.pos - xform.elements[2];
|
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];
|
p.pos = rot.xform(rel) + xform.elements[2];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ void Particles2D::_notification(int p_what) {
|
||||||
if (texture.is_valid())
|
if (texture.is_valid())
|
||||||
texrid = texture->get_rid();
|
texrid = texture->get_rid();
|
||||||
|
|
||||||
Matrix32 invxform;
|
Transform2D invxform;
|
||||||
if (!local_space)
|
if (!local_space)
|
||||||
invxform=get_global_transform().affine_inverse();
|
invxform=get_global_transform().affine_inverse();
|
||||||
|
|
||||||
|
@ -573,7 +573,7 @@ void Particles2D::_notification(int p_what) {
|
||||||
|
|
||||||
//Rect2 r = Rect2(Vecto,rectsize);
|
//Rect2 r = Rect2(Vecto,rectsize);
|
||||||
|
|
||||||
Matrix32 xform;
|
Transform2D xform;
|
||||||
|
|
||||||
if (p.rot) {
|
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_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::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_DIRECTION );
|
||||||
BIND_CONSTANT( PARAM_SPREAD );
|
BIND_CONSTANT( PARAM_SPREAD );
|
||||||
|
|
|
@ -226,7 +226,7 @@ void StaticBody2D::_update_xform() {
|
||||||
setting=true;
|
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);
|
set_block_transform_notify(true);
|
||||||
Physics2DServer::get_singleton()->body_set_state(get_rid(),Physics2DServer::BODY_STATE_TRANSFORM,*pre_xform); //then simulate motion!
|
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() {
|
void KinematicBody2D::revert_motion() {
|
||||||
|
|
||||||
Matrix32 gt = get_global_transform();
|
Transform2D gt = get_global_transform();
|
||||||
gt.elements[2]-=travel;
|
gt.elements[2]-=travel;
|
||||||
travel=Vector2();
|
travel=Vector2();
|
||||||
set_global_transform(gt);
|
set_global_transform(gt);
|
||||||
|
@ -1062,7 +1062,7 @@ Vector2 KinematicBody2D::move(const Vector2& p_motion) {
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
|
||||||
Matrix32 gt = get_global_transform();
|
Transform2D gt = get_global_transform();
|
||||||
Physics2DServer::MotionResult result;
|
Physics2DServer::MotionResult result;
|
||||||
colliding = Physics2DServer::get_singleton()->body_test_motion(get_rid(),gt,p_motion,margin,&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;
|
gt.elements[2]+=recover_motion;
|
||||||
set_global_transform(gt);
|
set_global_transform(gt);
|
||||||
|
|
||||||
|
@ -1203,7 +1203,7 @@ Vector2 KinematicBody2D::move(const Vector2& p_motion) {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//it collided, let's get the rest info in unsafe advance
|
//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;
|
ugt.elements[2]+=p_motion*unsafe;
|
||||||
Physics2DDirectSpaceState::ShapeRestInfo rest_info;
|
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);
|
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;
|
Vector2 motion=p_motion*safe;
|
||||||
Matrix32 gt = get_global_transform();
|
Transform2D gt = get_global_transform();
|
||||||
gt.elements[2]+=motion;
|
gt.elements[2]+=motion;
|
||||||
set_global_transform(gt);
|
set_global_transform(gt);
|
||||||
|
|
||||||
|
@ -1318,7 +1318,7 @@ Vector2 KinematicBody2D::move_to(const Vector2& p_position) {
|
||||||
return move(p_position-get_global_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);
|
ERR_FAIL_COND_V(!is_inside_tree(),false);
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ public:
|
||||||
Vector2 move(const Vector2& p_motion);
|
Vector2 move(const Vector2& p_motion);
|
||||||
Vector2 move_to(const Vector2& p_position);
|
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;
|
bool is_colliding() const;
|
||||||
|
|
||||||
Vector2 get_travel() const;
|
Vector2 get_travel() const;
|
||||||
|
|
|
@ -148,7 +148,7 @@ void Polygon2D::_notification(int p_what) {
|
||||||
|
|
||||||
if (texture.is_valid()) {
|
if (texture.is_valid()) {
|
||||||
|
|
||||||
Matrix32 texmat(tex_rot,tex_ofs);
|
Transform2D texmat(tex_rot,tex_ofs);
|
||||||
texmat.scale(tex_scale);
|
texmat.scale(tex_scale);
|
||||||
Size2 tex_size=Vector2(1,1);
|
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::POOL_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,"uv"),_SCS("set_uv"),_SCS("get_uv"));
|
||||||
ADD_PROPERTY( PropertyInfo(Variant::COLOR,"color"),_SCS("set_color"),_SCS("get_color"));
|
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_PROPERTY( PropertyInfo(Variant::VECTOR2,"offset"),_SCS("set_offset"),_SCS("get_offset"));
|
||||||
ADD_GROUP("Texture","");
|
ADD_GROUP("Texture","");
|
||||||
ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"));
|
ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"));
|
||||||
|
|
|
@ -161,7 +161,7 @@ void RayCast2D::_notification(int p_what) {
|
||||||
|
|
||||||
if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
|
if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
|
||||||
break;
|
break;
|
||||||
Matrix32 xf;
|
Transform2D xf;
|
||||||
xf.rotate(cast_to.angle());
|
xf.rotate(cast_to.angle());
|
||||||
xf.translate(Vector2(0,cast_to.length()));
|
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());
|
Physics2DDirectSpaceState *dss = Physics2DServer::get_singleton()->space_get_direct_state(w2d->get_space());
|
||||||
ERR_FAIL_COND( !dss );
|
ERR_FAIL_COND( !dss );
|
||||||
|
|
||||||
Matrix32 gt = get_global_transform();
|
Transform2D gt = get_global_transform();
|
||||||
|
|
||||||
Vector2 to = cast_to;
|
Vector2 to = cast_to;
|
||||||
if (to==Vector2())
|
if (to==Vector2())
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue