diff options
322 files changed, 11087 insertions, 8617 deletions
diff --git a/SConstruct b/SConstruct index d168820f66..e08c46c51e 100644 --- a/SConstruct +++ b/SConstruct @@ -138,7 +138,8 @@ opts.Add('etc1','etc1 Texture compression support (yes/no)','yes') opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes') opts.Add('openssl','Use OpenSSL (yes/no/builtin)','no') opts.Add('musepack','Musepack Audio (yes/no)','yes') -opts.Add("CXX", "Compiler"); +opts.Add("CXX", "C++ Compiler") +opts.Add("CC", "C Compiler") opts.Add("CCFLAGS", "Custom flags for the C++ compiler"); opts.Add("CFLAGS", "Custom flags for the C compiler"); opts.Add("LINKFLAGS", "Custom flags for the linker"); diff --git a/bin/tests/test_gdscript.cpp b/bin/tests/test_gdscript.cpp index 4457d70b38..43d65f782b 100644 --- a/bin/tests/test_gdscript.cpp +++ b/bin/tests/test_gdscript.cpp @@ -222,6 +222,7 @@ static String _parser_expr(const GDParser::Node *p_expr) { case GDParser::OperatorNode::OP_BIT_AND: { txt=_parser_expr(c_node->arguments[0])+"&"+_parser_expr(c_node->arguments[1]); } break;; case GDParser::OperatorNode::OP_BIT_OR: { txt=_parser_expr(c_node->arguments[0])+"|"+_parser_expr(c_node->arguments[1]); } break; case GDParser::OperatorNode::OP_BIT_XOR: { txt=_parser_expr(c_node->arguments[0])+"^"+_parser_expr(c_node->arguments[1]); } break; + default: {} } diff --git a/bin/tests/test_math.cpp b/bin/tests/test_math.cpp index 4b686e8af8..e5667bff64 100644 --- a/bin/tests/test_math.cpp +++ b/bin/tests/test_math.cpp @@ -40,12 +40,376 @@ #include "scene/resources/texture.h" #include "vmap.h" #include "os/os.h" +#include "os/file_access.h" #include "method_ptrcall.h" namespace TestMath { +class GetClassAndNamespace { + + String code; + int idx; + int line; + String error_str; + bool error; + Variant value; + + String class_name; + + enum Token { + TK_BRACKET_OPEN, + TK_BRACKET_CLOSE, + TK_CURLY_BRACKET_OPEN, + TK_CURLY_BRACKET_CLOSE, + TK_PERIOD, + TK_COLON, + TK_COMMA, + TK_SYMBOL, + TK_IDENTIFIER, + TK_STRING, + TK_NUMBER, + TK_EOF, + TK_ERROR + }; + + + Token get_token() { + + while (true) { + switch(code[idx]) { + + case '\n': { + + line++; + idx++; + break; + }; + case 0: { + return TK_EOF; + + } break; + case '{': { + + idx++; + return TK_CURLY_BRACKET_OPEN; + }; + case '}': { + + idx++; + return TK_CURLY_BRACKET_CLOSE; + }; + case '[': { + + idx++; + return TK_BRACKET_OPEN; + }; + case ']': { + + idx++; + return TK_BRACKET_CLOSE; + }; + case ':': { + + idx++; + return TK_COLON; + }; + case ',': { + + idx++; + return TK_COMMA; + }; + case '.': { + + idx++; + return TK_PERIOD; + }; + case '#': { + //compiler directive + while(code[idx]!='\n' && code[idx]!=0) { + idx++; + } + continue; + } break; + case '/': { + + + switch(code[idx+1]) { + case '*': { // block comment + + idx+=2; + while(true) { + if (code[idx]==0) { + error_str="Unterminated comment"; + error=true; + return TK_ERROR; + } if (code[idx]=='*' &&code[idx+1]=='/') { + + idx+=2; + break; + } if (code[idx]=='\n') { + line++; + } + + idx++; + } + + } break; + case '/': { // line comment skip + + while(code[idx]!='\n' && code[idx]!=0) { + idx++; + } + + } break; + default: { + value="/"; + idx++; + return TK_SYMBOL; + } + + } + + continue; // a comment + } break; + case '\'': + case '"': { + + CharType begin_str = code[idx]; + idx++; + String tk_string=String(); + while(true) { + if (code[idx]==0) { + error_str="Unterminated String"; + error=true; + return TK_ERROR; + } else if (code[idx]==begin_str) { + idx++; + break; + } else if (code[idx]=='\\') { + //escaped characters... + idx++; + CharType next = code[idx]; + if (next==0) { + error_str="Unterminated String"; + error=true; + return TK_ERROR; + } + CharType res=0; + + switch(next) { + + case 'b': res=8; break; + case 't': res=9; break; + case 'n': res=10; break; + case 'f': res=12; break; + case 'r': res=13; break; + /* too much, not needed for now + case 'u': { + //hexnumbarh - oct is deprecated + + + for(int j=0;j<4;j++) { + CharType c = code[idx+j+1]; + if (c==0) { + r_err_str="Unterminated String"; + return ERR_PARSE_ERROR; + } + if (!((c>='0' && c<='9') || (c>='a' && c<='f') || (c>='A' && c<='F'))) { + + r_err_str="Malformed hex constant in string"; + return ERR_PARSE_ERROR; + } + CharType v; + if (c>='0' && c<='9') { + v=c-'0'; + } else if (c>='a' && c<='f') { + v=c-'a'; + v+=10; + } else if (c>='A' && c<='F') { + v=c-'A'; + v+=10; + } else { + ERR_PRINT("BUG"); + v=0; + } + + res<<=4; + res|=v; + + + } + idx+=4; //will add at the end anyway + + + } break;*/ + case '\"': res='\"'; break; + case '\\': res='\\'; break; + //case '/': res='/'; break; + default: { + res = next; + //r_err_str="Invalid escape sequence"; + //return ERR_PARSE_ERROR; + } break; + } + + tk_string+=res; + + } else { + if (code[idx]=='\n') + line++; + tk_string+=code[idx]; + } + idx++; + } + + value=tk_string; + + return TK_STRING; + + } break; + default: { + + if (code[idx]<=32) { + idx++; + break; + } + + if ( (code[idx]>=33 && code[idx]<=47) || (code[idx]>=58 && code[idx]<=64) || (code[idx]>=91 && code[idx]<=96) || (code[idx]>=123 && code[idx]<=127)){ + value=String::chr(code[idx]); + idx++; + return TK_SYMBOL; + } + + if (code[idx]=='-' || (code[idx]>='0' && code[idx]<='9')) { + //a number + const CharType *rptr; + double number = String::to_double(&code[idx],&rptr); + idx+=(rptr - &code[idx]); + value=number; + return TK_NUMBER; + + } else if ((code[idx]>='A' && code[idx]<='Z') || (code[idx]>='a' && code[idx]<='z') || code[idx]>127) { + + String id; + + while((code[idx]>='A' && code[idx]<='Z') || (code[idx]>='a' && code[idx]<='z') || code[idx]>127) { + + id+=code[idx]; + idx++; + } + + value=id; + return TK_IDENTIFIER; + } else { + error_str="Unexpected character."; + error=true; + return TK_ERROR; + } + } + + } + } + } + +public: + Error parse(const String& p_code,const String& p_known_class_name=String()) { + + code=p_code; + idx=0; + line=0; + error_str=String(); + error=false; + value=Variant(); + class_name=String(); + + bool use_next_class=false; + Token tk = get_token(); + + Map<int,String> namespace_stack; + int curly_stack=0; + + + while(!error || tk!=TK_EOF) { + + if (tk==TK_BRACKET_OPEN) { + tk = get_token(); + if (tk==TK_IDENTIFIER && String(value)=="ScriptClass") { + if (get_token()==TK_BRACKET_CLOSE) { + use_next_class=true; + } + } + } else if (tk==TK_IDENTIFIER && String(value)=="class") { + tk = get_token(); + if (tk==TK_IDENTIFIER) { + String name = value; + if (use_next_class || p_known_class_name==name) { + for (Map<int,String>::Element *E=namespace_stack.front();E;E=E->next()) { + class_name+=E->get()+"."; + } + class_name+=String(value); + break; + } + } + + } else if (tk==TK_IDENTIFIER && String(value)=="namespace") { + String name; + int at_level = curly_stack; + while(true) { + tk = get_token(); + if (tk==TK_IDENTIFIER) { + name+=String(value); + } + + tk = get_token(); + if (tk==TK_PERIOD) { + name+="."; + } else if (tk==TK_CURLY_BRACKET_OPEN) { + curly_stack++; + break; + } else { + break; //whathever else + } + + } + + if (name!=String()) { + namespace_stack[at_level]=name; + } + + } else if (tk==TK_CURLY_BRACKET_OPEN) { + curly_stack++; + } else if (tk==TK_CURLY_BRACKET_CLOSE) { + curly_stack--; + if (namespace_stack.has(curly_stack)) { + namespace_stack.erase(curly_stack); + } + } + + tk = get_token(); + } + + if (error) + return ERR_PARSE_ERROR; + + + + return OK; + + } + + String get_error() { + return error_str; + } + + String get_class() { + return class_name; + } + +}; + + void test_vec(Plane p_vec) { @@ -113,7 +477,41 @@ uint32_t ihash3( uint32_t a) MainLoop* test() { - print_line(itos(Math::step_decimals( 0.0001 ))); + + List<String> cmdlargs = OS::get_singleton()->get_cmdline_args(); + + if (cmdlargs.empty()) { + //try editor! + return NULL; + } + + String test = cmdlargs.back()->get(); + + FileAccess *fa = FileAccess::open(test,FileAccess::READ); + + if (!fa) { + ERR_EXPLAIN("Could not open file: "+test); + ERR_FAIL_V(NULL); + } + + + Vector<uint8_t> buf; + int flen = fa->get_len(); + buf.resize(fa->get_len()+1); + fa->get_buffer(&buf[0],flen); + buf[flen]=0; + + + String code; + code.parse_utf8((const char*)&buf[0]); + + GetClassAndNamespace getclass; + if (getclass.parse(code)) { + print_line("Parse error: "+getclass.get_error()); + } else { + print_line("Found class: "+getclass.get_class()); + } + return NULL; { diff --git a/bin/tests/test_misc.cpp b/bin/tests/test_misc.cpp index 68564c62b0..9d7adc3573 100644 --- a/bin/tests/test_misc.cpp +++ b/bin/tests/test_misc.cpp @@ -431,7 +431,7 @@ public: RID lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL ); //vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) ); //vs->light_set_shadow( lightaux, true ); - RID light = vs->instance_create2( lightaux,scenario ); + vs->instance_create2( lightaux,scenario ); //rot_a=Transform(Matrix3(Vector3(1,0,0),Math_PI/2.0),Vector3()); rot_b=Transform(Matrix3(),Vector3(2,0,0)); diff --git a/bin/tests/test_physics.cpp b/bin/tests/test_physics.cpp index ecd90a13d4..f202d0dda1 100644 --- a/bin/tests/test_physics.cpp +++ b/bin/tests/test_physics.cpp @@ -609,7 +609,7 @@ public: //t.basis.rotate(Vector3(-1,0,0),Math_PI/4*i); - RID b = create_body(type,PhysicsServer::BODY_MODE_RIGID,t); + create_body(type,PhysicsServer::BODY_MODE_RIGID,t); //RID b = create_body(type,i==0?PhysicsServer::BODY_MODE_STATIC:PhysicsServer::BODY_MODE_RIGID,t); } diff --git a/bin/tests/test_physics_2d.cpp b/bin/tests/test_physics_2d.cpp index c5fb734999..845e20b6c3 100644 --- a/bin/tests/test_physics_2d.cpp +++ b/bin/tests/test_physics_2d.cpp @@ -410,7 +410,7 @@ public: Physics2DServer::ShapeType type = types[i%4]; // type=Physics2DServer::SHAPE_SEGMENT; - RID b = _add_body(type,Matrix32(i*0.8,Point2(152+i*40,100-40*i))); + _add_body(type,Matrix32(i*0.8,Point2(152+i*40,100-40*i))); //if (i==0) // ps->body_set_mode(b,Physics2DServer::BODY_MODE_STATIC); } diff --git a/core/array.cpp b/core/array.cpp index 23792f90fc..683a43e3d0 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -276,16 +276,26 @@ void Array::push_front(const Variant& p_value) { _p->array.insert(0,p_value); } -void Array::pop_back(){ +Variant Array::pop_back(){ - if (!_p->array.empty()) - _p->array.resize( _p->array.size() -1 ); + if (!_p->array.empty()) { + int n = _p->array.size() - 1; + Variant ret = _p->array.get(n); + _p->array.resize(n); + return ret; + } + return Variant(); } -void Array::pop_front(){ - if (!_p->array.empty()) +Variant Array::pop_front(){ + + if (!_p->array.empty()) { + Variant ret = _p->array.get(0); _p->array.remove(0); + return ret; + } + return Variant(); } diff --git a/core/array.h b/core/array.h index dfc902525c..eb79b0cf33 100644 --- a/core/array.h +++ b/core/array.h @@ -80,8 +80,8 @@ public: void erase(const Variant& p_value); void push_front(const Variant& p_value); - void pop_back(); - void pop_front(); + Variant pop_back(); + Variant pop_front(); Array(const Array& p_from); Array(bool p_shared=false); diff --git a/core/dvector.h b/core/dvector.h index a5519ed604..9a54641617 100644 --- a/core/dvector.h +++ b/core/dvector.h @@ -262,6 +262,34 @@ public: w[bs+i]=r[i]; } + DVector<T> subarray(int p_from, int p_to) { + + if (p_from<0) { + p_from=size()+p_from; + } + if (p_to<0) { + p_to=size()+p_to; + } + if (p_from<0 || p_from>=size()) { + DVector<T>& aux=*((DVector<T>*)0); // nullreturn + ERR_FAIL_COND_V(p_from<0 || p_from>=size(),aux) + } + if (p_to<0 || p_to>=size()) { + DVector<T>& aux=*((DVector<T>*)0); // nullreturn + ERR_FAIL_COND_V(p_to<0 || p_to>=size(),aux) + } + + DVector<T> slice; + int span=1 + p_to - p_from; + slice.resize(span); + Read r = read(); + Write w = slice.write(); + for (int i=0; i<span; ++i) { + w[i] = r[p_from+i]; + } + + return slice; + } Error insert(int p_pos,const T& p_val) { diff --git a/core/func_ref.cpp b/core/func_ref.cpp index 644d8b5b63..ca890111be 100644 --- a/core/func_ref.cpp +++ b/core/func_ref.cpp @@ -61,11 +61,7 @@ void FuncRef::_bind_methods() { MethodInfo mi; mi.name="call_func"; Vector<Variant> defargs; - for(int i=0;i<10;i++) { - mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); - defargs.push_back(Variant()); - } - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call_func:Variant",&FuncRef::call_func,mi,defargs); + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call_func:Variant",&FuncRef::call_func,mi,defargs); } diff --git a/core/image.cpp b/core/image.cpp index d6ac3f28ea..90051d7d0d 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -2052,6 +2052,7 @@ Error Image::_decompress_bc() { ht/=2; } break; + default: {} } } diff --git a/core/input_map.cpp b/core/input_map.cpp index 3a0f9596f5..09cb7ce426 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -232,64 +232,6 @@ bool InputMap::event_is_action(const InputEvent& p_event, const StringName& p_ac return _find_event(E->get().inputs,p_event)!=NULL; } -bool InputMap::event_is_joy_motion_action_pressed(const InputEvent& p_event) const { - - ERR_FAIL_COND_V(p_event.type!=InputEvent::JOYSTICK_MOTION,false); - bool pressed=false; - - //this could be optimized by having a separate list of joymotions? - - for (Map<StringName, Action>::Element *A=input_map.front();A;A=A->next()) { - - for (List<InputEvent>::Element *E=A->get().inputs.front();E;E=E->next()) { - - const InputEvent& e=E->get(); - if(e.type!=p_event.type) - continue; - if (e.type!=InputEvent::KEY && e.device!=p_event.device) - continue; - - switch(p_event.type) { - - case InputEvent::KEY: { - - if (e.key.scancode==p_event.key.scancode && e.key.mod == p_event.key.mod) - return e.key.pressed; - - } break; - case InputEvent::JOYSTICK_BUTTON: { - - if (e.joy_button.button_index==p_event.joy_button.button_index) { - return e.joy_button.pressed; - } - - } break; - case InputEvent::MOUSE_BUTTON: { - - if (e.mouse_button.button_index==p_event.mouse_button.button_index) { - return e.mouse_button.pressed; - } - - } break; - case InputEvent::JOYSTICK_MOTION: { - - if (e.joy_motion.axis==p_event.joy_motion.axis) { - if ( - (e.joy_motion.axis_value * p_event.joy_motion.axis_value >0) && //same axis - ABS(e.joy_motion.axis_value)>0.5 && ABS(p_event.joy_motion.axis_value)>0.5 ) - pressed=true; - } - - } break; - } - - } - } - - return pressed; - -} - const Map<StringName, InputMap::Action>& InputMap::get_action_map() const { return input_map; } diff --git a/core/input_map.h b/core/input_map.h index a224765d8c..21c479588d 100644 --- a/core/input_map.h +++ b/core/input_map.h @@ -72,7 +72,6 @@ public: const List<InputEvent> *get_action_list(const StringName& p_action); bool event_is_action(const InputEvent& p_event, const StringName& p_action) const; - bool event_is_joy_motion_action_pressed(const InputEvent& p_event) const; const Map<StringName, Action>& get_action_map() const; void load_from_globals(); diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 5c8c741f28..1632b841c6 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -409,6 +409,8 @@ Error DirAccessPack::change_dir(String p_dir) { nd=nd.simplify_path(); + if (nd == "") nd = "."; + if (nd.begins_with("/")) { nd=nd.replace_first("/","") ; absolute=true; diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp new file mode 100644 index 0000000000..5bbbbdaa5a --- /dev/null +++ b/core/math/a_star.cpp @@ -0,0 +1,412 @@ +#include "a_star.h" +#include "geometry.h" + + +int AStar::get_available_point_id() const { + + if (points.empty()) { + return 1; + } + + return points.back()->key()+1; +} + +void AStar::add_point(int p_id, const Vector3 &p_pos, float p_weight_scale) { + ERR_FAIL_COND(p_id<0); + if (!points.has(p_id)) { + Point *pt = memnew( Point ); + pt->id=p_id; + pt->pos=p_pos; + pt->weight_scale=p_weight_scale; + pt->prev_point=NULL; + pt->last_pass=0; + points[p_id]=pt; + } else { + points[p_id]->pos=p_pos; + points[p_id]->weight_scale=p_weight_scale; + } +} + +Vector3 AStar::get_point_pos(int p_id) const{ + + ERR_FAIL_COND_V(!points.has(p_id),Vector3()); + + return points[p_id]->pos; + +} +float AStar::get_point_weight_scale(int p_id) const{ + + ERR_FAIL_COND_V(!points.has(p_id),0); + + return points[p_id]->weight_scale; + +} +void AStar::remove_point(int p_id){ + + ERR_FAIL_COND(!points.has(p_id)); + + Point* p = points[p_id]; + + for(int i=0;i<p->neighbours.size();i++) { + + Segment s(p_id,p->neighbours[i]->id); + segments.erase(s); + p->neighbours[i]->neighbours.erase(p); + } + + memdelete(p); + points.erase(p_id); +} + +void AStar::connect_points(int p_id,int p_with_id){ + + ERR_FAIL_COND(!points.has(p_id)); + ERR_FAIL_COND(!points.has(p_with_id)); + ERR_FAIL_COND(p_id==p_with_id); + + + Point* a = points[p_id]; + Point* b = points[p_with_id]; + a->neighbours.push_back(b); + b->neighbours.push_back(a); + + Segment s(p_id,p_with_id); + if (s.from==p_id) { + s.from_point=a; + s.to_point=b; + } else { + s.from_point=b; + s.to_point=a; + } + + segments.insert(s); + + +} +void AStar::disconnect_points(int p_id,int p_with_id){ + + Segment s(p_id,p_with_id); + ERR_FAIL_COND(!segments.has(s)); + + + segments.erase(s); + + Point *a = points[p_id]; + Point *b = points[p_with_id]; + a->neighbours.erase(b); + b->neighbours.erase(a); + +} +bool AStar::are_points_connected(int p_id,int p_with_id) const{ + + Segment s(p_id,p_with_id); + return segments.has(s); +} + +void AStar::clear(){ + + for (const Map<int,Point*>::Element *E=points.front();E;E=E->next()) { + + memdelete(E->get()); + } + segments.clear(); + points.clear(); +} + + +int AStar::get_closest_point(const Vector3& p_point) const{ + + int closest_id=-1; + float closest_dist=1e20; + + for (const Map<int,Point*>::Element *E=points.front();E;E=E->next()) { + + float d = p_point.distance_squared_to(E->get()->pos); + if (closest_id<0 || d<closest_dist) { + closest_dist=d; + closest_id=E->key(); + } + } + + return closest_id; + + +} +Vector3 AStar::get_closest_pos_in_segment(const Vector3& p_point) const { + + float closest_dist = 1e20; + bool found=false; + Vector3 closest_point; + + + for (const Set<Segment>::Element *E=segments.front();E;E=E->next()) { + + Vector3 segment[2]={ + E->get().from_point->pos, + E->get().to_point->pos, + }; + + Vector3 p = Geometry::get_closest_point_to_segment(p_point,segment); + float d = p_point.distance_squared_to(p); + if (!found || d<closest_dist) { + + closest_point=p; + closest_dist=d; + found=true; + } + } + + return closest_point; +} + +bool AStar::_solve(Point* begin_point, Point* end_point) { + + pass++; + + SelfList<Point>::List open_list; + + bool found_route=false; + + + for(int i=0;i<begin_point->neighbours.size();i++) { + + Point *n = begin_point->neighbours[i]; + n->prev_point=begin_point; + n->distance=n->pos.distance_to(begin_point->pos); + n->distance*=n->weight_scale; + n->last_pass=pass; + open_list.add(&n->list); + + if (end_point==n) { + found_route=true; + break; + } + } + + while(!found_route) { + + if (open_list.first()==NULL) { + //could not find path sadly + break; + } + //check open list + + SelfList<Point> *least_cost_point=NULL; + float least_cost=1e30; + + //this could be faster (cache previous results) + for (SelfList<Point> *E=open_list.first();E;E=E->next()) { + + Point *p=E->self(); + + float cost=p->distance; + cost+=p->pos.distance_to(end_point->pos); + cost*=p->weight_scale; + + if (cost<least_cost) { + + least_cost_point=E; + least_cost=cost; + } + } + + + Point *p=least_cost_point->self(); + //open the neighbours for search + int es = p->neighbours.size(); + + for(int i=0;i<es;i++) { + + + Point* e=p->neighbours[i]; + + + float distance = p->pos.distance_to(e->pos) + p->distance; + distance*=e->weight_scale; + + + + if (e->last_pass==pass) { + //oh this was visited already, can we win the cost? + + if (e->distance>distance) { + + e->prev_point=p; + e->distance=distance; + } + } else { + //add to open neighbours + + e->prev_point=p; + e->distance=distance; + e->last_pass=pass; //mark as used + open_list.add(&e->list); + + if (e==end_point) { + //oh my reached end! stop algorithm + found_route=true; + break; + + } + + } + } + + if (found_route) + break; + + open_list.remove(least_cost_point); + } + + //clear the openf list + while(open_list.first()) { + open_list.remove( open_list.first() ); + } + + return found_route; + +} + +DVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) { + + ERR_FAIL_COND_V(!points.has(p_from_id),DVector<Vector3>()); + ERR_FAIL_COND_V(!points.has(p_to_id),DVector<Vector3>()); + + + pass++; + + Point* a = points[p_from_id]; + Point* b = points[p_to_id]; + + if (a==b) { + DVector<Vector3> ret; + ret.push_back(a->pos); + return ret; + } + + + Point *begin_point=a; + Point *end_point=b; + + bool found_route=_solve(begin_point,end_point); + + if (!found_route) + return DVector<Vector3>(); + + //midpoints + Point *p=end_point; + int pc=1; //begin point + while(p!=begin_point) { + pc++; + p=p->prev_point; + } + + DVector<Vector3> path; + path.resize(pc); + + { + DVector<Vector3>::Write w = path.write(); + + Point *p=end_point; + int idx=pc-1; + while(p!=begin_point) { + w[idx--]=p->pos; + p=p->prev_point; + } + + w[0]=p->pos; //assign first + + } + + return path; + +} + + +DVector<int> AStar::get_id_path(int p_from_id, int p_to_id) { + + ERR_FAIL_COND_V(!points.has(p_from_id),DVector<int>()); + ERR_FAIL_COND_V(!points.has(p_to_id),DVector<int>()); + + + pass++; + + Point* a = points[p_from_id]; + Point* b = points[p_to_id]; + + if (a==b) { + DVector<int> ret; + ret.push_back(a->id); + return ret; + } + + + Point *begin_point=a; + Point *end_point=b; + + bool found_route=_solve(begin_point,end_point); + + if (!found_route) + return DVector<int>(); + + //midpoints + Point *p=end_point; + int pc=1; //begin point + while(p!=begin_point) { + pc++; + p=p->prev_point; + } + + DVector<int> path; + path.resize(pc); + + { + DVector<int>::Write w = path.write(); + + p=end_point; + int idx=pc-1; + while(p!=begin_point) { + w[idx--]=p->id; + p=p->prev_point; + } + + w[0]=p->id; //assign first + + } + + return path; +} + +void AStar::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("get_available_point_id"),&AStar::get_available_point_id); + ObjectTypeDB::bind_method(_MD("add_point","id","pos","weight_scale"),&AStar::add_point,DEFVAL(1.0)); + ObjectTypeDB::bind_method(_MD("get_point_pos","id"),&AStar::get_point_pos); + ObjectTypeDB::bind_method(_MD("get_point_weight_scale","id"),&AStar::get_point_weight_scale); + ObjectTypeDB::bind_method(_MD("remove_point","id"),&AStar::remove_point); + + ObjectTypeDB::bind_method(_MD("connect_points","id","to_id"),&AStar::connect_points); + ObjectTypeDB::bind_method(_MD("disconnect_points","id","to_id"),&AStar::disconnect_points); + ObjectTypeDB::bind_method(_MD("are_points_connected","id","to_id"),&AStar::are_points_connected); + + ObjectTypeDB::bind_method(_MD("clear"),&AStar::clear); + + ObjectTypeDB::bind_method(_MD("get_closest_point","to_pos"),&AStar::get_closest_point); + ObjectTypeDB::bind_method(_MD("get_closest_pos_in_segment","to_pos"),&AStar::get_closest_pos_in_segment); + + ObjectTypeDB::bind_method(_MD("get_point_path","from_id","to_id"),&AStar::get_point_path); + ObjectTypeDB::bind_method(_MD("get_id_path","from_id","to_id"),&AStar::get_id_path); + +} + + +AStar::AStar() { + + pass=1; +} + + +AStar::~AStar() { + + pass=1; +} diff --git a/core/math/a_star.h b/core/math/a_star.h new file mode 100644 index 0000000000..a0517b5941 --- /dev/null +++ b/core/math/a_star.h @@ -0,0 +1,92 @@ +#ifndef ASTAR_H +#define ASTAR_H + +#include "reference.h" +#include "self_list.h" + +class AStar: public Reference { + + OBJ_TYPE(AStar,Reference) + + + uint64_t pass; + + struct Point { + + SelfList<Point> list; + + int id; + Vector3 pos; + float weight_scale; + uint64_t last_pass; + + Vector<Point*> neighbours; + + //used for pathfinding + Point *prev_point; + float distance; + + Point() : list(this) {} + }; + + Map<int,Point*> points; + + struct Segment { + union { + struct { + int32_t from; + int32_t to; + }; + uint64_t key; + }; + + Point *from_point; + Point *to_point; + + bool operator<(const Segment& p_s) const { return key<p_s.key; } + Segment() { key=0; } + Segment(int p_from,int p_to) { + if (p_from > p_to) { + SWAP(p_from,p_to); + } + + from=p_from; + to=p_to; + } + }; + + + Set<Segment> segments; + + bool _solve(Point *begin_point, Point *end_point); + +protected: + + static void _bind_methods(); +public: + + int get_available_point_id() const; + + void add_point(int p_id,const Vector3& p_pos,float p_weight_scale=1); + Vector3 get_point_pos(int p_id) const; + float get_point_weight_scale(int p_id) const; + void remove_point(int p_id); + + void connect_points(int p_id,int p_with_id); + void disconnect_points(int p_id,int p_with_id); + bool are_points_connected(int p_id,int p_with_id) const; + + void clear(); + + + int get_closest_point(const Vector3& p_point) const; + Vector3 get_closest_pos_in_segment(const Vector3& p_point) const; + + DVector<Vector3> get_point_path(int p_from_id, int p_to_id); + DVector<int> get_id_path(int p_from_id, int p_to_id); + + AStar(); + ~AStar(); +}; + +#endif // ASTAR_H diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp index 0e2060008c..2cc11aa738 100644 --- a/core/math/math_2d.cpp +++ b/core/math/math_2d.cpp @@ -475,18 +475,18 @@ Matrix32::Matrix32(real_t p_rot, const Vector2& p_pos) { elements[2]=p_pos; } -Vector2 Matrix32::get_scale() const { +Size2 Matrix32::get_scale() const { - return Vector2( elements[0].length(), elements[1].length() ); + return Size2( elements[0].length(), elements[1].length() ); } -void Matrix32::scale(const Vector2& p_scale) { +void Matrix32::scale(const Size2& p_scale) { elements[0]*=p_scale; elements[1]*=p_scale; elements[2]*=p_scale; } -void Matrix32::scale_basis(const Vector2& p_scale) { +void Matrix32::scale_basis(const Size2& p_scale) { elements[0]*=p_scale; elements[1]*=p_scale; @@ -501,7 +501,6 @@ void Matrix32::translate( const Vector2& p_translation ) { elements[2]+=basis_xform(p_translation); } - void Matrix32::orthonormalize() { // Gram-Schmidt Process @@ -550,11 +549,6 @@ void Matrix32::operator*=(const Matrix32& p_transform) { elements[2] = xform(p_transform.elements[2]); float x0,x1,y0,y1; -/* - x0 = p_transform.tdotx(elements[0]); - x1 = p_transform.tdoty(elements[0]); - y0 = p_transform.tdotx(elements[1]); - y1 = p_transform.tdoty(elements[1]);*/ x0 = tdotx(p_transform.elements[0]); x1 = tdoty(p_transform.elements[0]); @@ -576,7 +570,7 @@ Matrix32 Matrix32::operator*(const Matrix32& p_transform) const { } -Matrix32 Matrix32::scaled(const Vector2& p_scale) const { +Matrix32 Matrix32::scaled(const Size2& p_scale) const { Matrix32 copy=*this; copy.scale(p_scale); @@ -584,7 +578,7 @@ Matrix32 Matrix32::scaled(const Vector2& p_scale) const { } -Matrix32 Matrix32::basis_scaled(const Vector2& p_scale) const { +Matrix32 Matrix32::basis_scaled(const Size2& p_scale) const { Matrix32 copy=*this; copy.scale_basis(p_scale); @@ -629,8 +623,8 @@ Matrix32 Matrix32::interpolate_with(const Matrix32& p_transform, float p_c) cons real_t r1 = get_rotation(); real_t r2 = p_transform.get_rotation(); - Vector2 s1 = get_scale(); - Vector2 s2 = p_transform.get_scale(); + Size2 s1 = get_scale(); + Size2 s2 = p_transform.get_scale(); //slerp rotation Vector2 v1(Math::cos(r1), Math::sin(r1)); diff --git a/core/math/math_2d.h b/core/math/math_2d.h index 90aae9fe50..38c1ac9656 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -553,10 +553,8 @@ struct Rect2i { struct Matrix32 { - Vector2 elements[3]; - _FORCE_INLINE_ float tdotx(const Vector2& v) const { return elements[0][0] * v.x + elements[1][0] * v.y; } _FORCE_INLINE_ float tdoty(const Vector2& v) const { return elements[0][1] * v.x + elements[1][1] * v.y; } @@ -577,26 +575,25 @@ struct Matrix32 { _FORCE_INLINE_ void set_rotation_and_scale(real_t p_phi,const Size2& p_scale); void rotate(real_t p_phi); - void scale(const Vector2& p_scale); - void scale_basis(const Vector2& p_scale); + void scale(const Size2& p_scale); + void scale_basis(const Size2& p_scale); void translate( real_t p_tx, real_t p_ty); void translate( const Vector2& p_translation ); float basis_determinant() const; - Vector2 get_scale() const; + Size2 get_scale() const; _FORCE_INLINE_ const Vector2& get_origin() const { return elements[2]; } _FORCE_INLINE_ void set_origin(const Vector2& p_origin) { elements[2]=p_origin; } - Matrix32 scaled(const Vector2& p_scale) const; - Matrix32 basis_scaled(const Vector2& p_scale) const; + Matrix32 scaled(const Size2& p_scale) const; + Matrix32 basis_scaled(const Size2& p_scale) const; Matrix32 translated(const Vector2& p_offset) const; Matrix32 rotated(float p_phi) const; Matrix32 untranslated() const; - void orthonormalize(); Matrix32 orthonormalized() const; @@ -615,7 +612,6 @@ struct Matrix32 { _FORCE_INLINE_ Rect2 xform(const Rect2& p_vec) const; _FORCE_INLINE_ Rect2 xform_inv(const Rect2& p_vec) const; - operator String() const; Matrix32(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy) { @@ -630,7 +626,6 @@ struct Matrix32 { Matrix32(real_t p_rot, const Vector2& p_pos); Matrix32() { elements[0][0]=1.0; elements[1][1]=1.0; } - }; bool Rect2::intersects_transformed(const Matrix32& p_xform, const Rect2& p_rect) const { diff --git a/core/math/triangulate.cpp b/core/math/triangulate.cpp index 27b7c86675..1f5d5ed6b3 100644 --- a/core/math/triangulate.cpp +++ b/core/math/triangulate.cpp @@ -157,7 +157,10 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour,Vector<int> &result m++; /* remove v from remaining polygon */ - for(s=v,t=v+1;t<nv;s++,t++) V[s] = V[t]; nv--; + for(s=v,t=v+1;t<nv;s++,t++) + V[s] = V[t]; + + nv--; /* resest error detection counter */ count = 2*nv; diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp index 8afd73f482..b4a13d8f6d 100644 --- a/core/math/vector3.cpp +++ b/core/math/vector3.cpp @@ -65,13 +65,9 @@ int Vector3::max_axis() const { void Vector3::snap(float p_val) { - x+=p_val/2.0; - x-=Math::fmod(x,p_val); - y+=p_val/2.0; - y-=Math::fmod(y,p_val); - z+=p_val/2.0; - z-=Math::fmod(z,p_val); - + x=Math::stepify(x,p_val); + y=Math::stepify(y,p_val); + z=Math::stepify(z,p_val); } Vector3 Vector3::snapped(float p_val) const { diff --git a/core/method_bind.h b/core/method_bind.h index 072953743c..04ff5c22c6 100644 --- a/core/method_bind.h +++ b/core/method_bind.h @@ -52,6 +52,7 @@ enum MethodFlags { METHOD_FLAG_REVERSE=16, // used for events METHOD_FLAG_VIRTUAL=32, METHOD_FLAG_FROM_SCRIPT=64, + METHOD_FLAG_VARARG=128, METHOD_FLAGS_DEFAULT=METHOD_FLAG_NORMAL, }; @@ -229,7 +230,7 @@ public: Vector<StringName> get_argument_names() const; #endif void set_hint_flags(uint32_t p_hint) { hint_flags=p_hint; } - uint32_t get_hint_flags() const { return hint_flags|(is_const()?METHOD_FLAG_CONST:0); } + uint32_t get_hint_flags() const { return hint_flags|(is_const()?METHOD_FLAG_CONST:0)|(is_vararg()?METHOD_FLAG_VARARG:0); } virtual String get_instance_type() const=0; _FORCE_INLINE_ int get_argument_count() const { return argument_count; }; @@ -267,7 +268,7 @@ public: _FORCE_INLINE_ int get_method_id() const { return method_id; } _FORCE_INLINE_ bool is_const() const { return _const; } _FORCE_INLINE_ bool has_return() const { return _returns; } - + virtual bool is_vararg() const { return false; } void set_default_arguments(const Vector<Variant>& p_defargs); @@ -277,7 +278,7 @@ public: template<class T> -class MethodBindNative : public MethodBind { +class MethodBindVarArg : public MethodBind { public: typedef Variant (T::*NativeCall)(const Variant**,int ,Variant::CallError &); protected: @@ -319,7 +320,9 @@ public: } #ifdef PTRCALL_ENABLED - virtual void ptrcall(Object* p_object,const void** p_args,void* r_ret) {} //todo + virtual void ptrcall(Object* p_object,const void** p_args,void* r_ret) { + ERR_FAIL(); //can't call + } //todo #endif @@ -327,14 +330,16 @@ public: virtual bool is_const() const { return false; } virtual String get_instance_type() const { return T::get_type_static(); } - MethodBindNative() { call_method=NULL; _set_returns(true);} + virtual bool is_vararg() const { return true; } + + MethodBindVarArg() { call_method=NULL; _set_returns(true);} }; template<class T > -MethodBind* create_native_method_bind( Variant (T::*p_method)(const Variant**,int ,Variant::CallError &), const MethodInfo& p_info ) { +MethodBind* create_vararg_method_bind( Variant (T::*p_method)(const Variant**,int ,Variant::CallError &), const MethodInfo& p_info ) { - MethodBindNative<T > * a = memnew( (MethodBindNative<T >) ); + MethodBindVarArg<T > * a = memnew( (MethodBindVarArg<T >) ); a->set_method(p_method); a->set_method_info(p_info); return a; diff --git a/core/object.cpp b/core/object.cpp index b036efa501..8cd4e07097 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1644,6 +1644,7 @@ void Object::_clear_internal_resource_paths(const Variant &p_var) { _clear_internal_resource_paths(d[E->get()]); } } break; + default: {} } } @@ -1693,42 +1694,26 @@ void Object::_bind_methods() { MethodInfo mi; mi.name="emit_signal"; mi.arguments.push_back( PropertyInfo( Variant::STRING, "signal")); - Vector<Variant> defargs; - for(int i=0;i<VARIANT_ARG_MAX;i++) { - mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); - defargs.push_back(Variant()); - } - - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"emit_signal",&Object::_emit_signal,mi,defargs); + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"emit_signal",&Object::_emit_signal,mi); } { MethodInfo mi; mi.name="call"; mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); - Vector<Variant> defargs; - for(int i=0;i<10;i++) { - mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); - defargs.push_back(Variant()); - } - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call:Variant",&Object::_call_bind,mi,defargs); + + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call:Variant",&Object::_call_bind,mi); } { MethodInfo mi; mi.name="call_deferred"; mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); - Vector<Variant> defargs; - for(int i=0;i<VARIANT_ARG_MAX;i++) { - mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); - defargs.push_back(Variant()); - } - - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call_deferred",&Object::_call_deferred_bind,mi,defargs); + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call_deferred",&Object::_call_deferred_bind,mi); } ObjectTypeDB::bind_method(_MD("callv:Variant","method","arg_array"),&Object::callv); diff --git a/core/object_type_db.cpp b/core/object_type_db.cpp index b6a69e3bd4..e121dc9e98 100644 --- a/core/object_type_db.cpp +++ b/core/object_type_db.cpp @@ -189,6 +189,14 @@ MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,co #endif + +ObjectTypeDB::APIType ObjectTypeDB::current_api=API_CORE; + +void ObjectTypeDB::set_current_api(APIType p_api) { + + current_api=p_api; +} + HashMap<StringName,ObjectTypeDB::TypeInfo,StringNameHasher> ObjectTypeDB::types; HashMap<StringName,StringName,StringNameHasher> ObjectTypeDB::resource_base_extensions; HashMap<StringName,StringName,StringNameHasher> ObjectTypeDB::compat_types; @@ -258,6 +266,171 @@ StringName ObjectTypeDB::type_inherits_from(const StringName& p_type) { return ti->inherits; } +ObjectTypeDB::APIType ObjectTypeDB::get_api_type(const StringName &p_type) { + + OBJTYPE_LOCK; + + TypeInfo *ti = types.getptr(p_type); + ERR_FAIL_COND_V(!ti,API_NONE); + return ti->api; +} + +uint64_t ObjectTypeDB::get_api_hash(APIType p_api) { + +#ifdef DEBUG_METHODS_ENABLED + + uint64_t hash = hash_djb2_one_64(HashMapHahserDefault::hash(VERSION_FULL_NAME)); + + List<StringName> names; + + const StringName *k=NULL; + + while((k=types.next(k))) { + + names.push_back(*k); + } + //must be alphabetically sorted for hash to compute + names.sort_custom<StringName::AlphCompare>(); + + for (List<StringName>::Element *E=names.front();E;E=E->next()) { + + TypeInfo *t = types.getptr(E->get()); + ERR_FAIL_COND_V(!t,0); + if (t->api!=p_api) + continue; + hash = hash_djb2_one_64(t->name.hash(),hash); + hash = hash_djb2_one_64(t->inherits.hash(),hash); + + { //methods + + List<StringName> snames; + + k=NULL; + + while((k=t->method_map.next(k))) { + + snames.push_back(*k); + } + + snames.sort_custom<StringName::AlphCompare>(); + + for (List<StringName>::Element *F=snames.front();F;F=F->next()) { + + MethodBind *mb = t->method_map[F->get()]; + hash = hash_djb2_one_64( mb->get_name().hash(), hash); + hash = hash_djb2_one_64( mb->get_argument_count(), hash); + hash = hash_djb2_one_64( mb->get_argument_type(-1), hash); //return + + for(int i=0;i<mb->get_argument_count();i++) { + hash = hash_djb2_one_64( mb->get_argument_info(i).type, hash ); + hash = hash_djb2_one_64( mb->get_argument_info(i).name.hash(), hash ); + hash = hash_djb2_one_64( mb->get_argument_info(i).hint, hash ); + hash = hash_djb2_one_64( mb->get_argument_info(i).hint_string.hash(), hash ); + } + + hash = hash_djb2_one_64( mb->get_default_argument_count(), hash); + + for(int i=0;i<mb->get_default_argument_count();i++) { + //hash should not change, i hope for tis + Variant da = mb->get_default_argument(i); + hash = hash_djb2_one_64( da.hash(), hash ); + } + + hash = hash_djb2_one_64( mb->get_hint_flags(), hash); + + } + } + + + { //constants + + List<StringName> snames; + + k=NULL; + + while((k=t->constant_map.next(k))) { + + snames.push_back(*k); + } + + snames.sort_custom<StringName::AlphCompare>(); + + for (List<StringName>::Element *F=snames.front();F;F=F->next()) { + + hash = hash_djb2_one_64(F->get().hash(), hash); + hash = hash_djb2_one_64( t->constant_map[F->get()], hash); + } + } + + + { //signals + + List<StringName> snames; + + k=NULL; + + while((k=t->signal_map.next(k))) { + + snames.push_back(*k); + } + + snames.sort_custom<StringName::AlphCompare>(); + + for (List<StringName>::Element *F=snames.front();F;F=F->next()) { + + MethodInfo &mi = t->signal_map[F->get()]; + hash = hash_djb2_one_64( F->get().hash(), hash); + for(int i=0;i<mi.arguments.size();i++) { + hash = hash_djb2_one_64( mi.arguments[i].type, hash); + } + } + } + + { //properties + + List<StringName> snames; + + k=NULL; + + while((k=t->property_setget.next(k))) { + + snames.push_back(*k); + } + + snames.sort_custom<StringName::AlphCompare>(); + + for (List<StringName>::Element *F=snames.front();F;F=F->next()) { + + PropertySetGet *psg=t->property_setget.getptr(F->get()); + + hash = hash_djb2_one_64( F->get().hash(), hash); + hash = hash_djb2_one_64( psg->setter.hash(), hash); + hash = hash_djb2_one_64( psg->getter.hash(), hash); + + } + } + + //property list + for (List<PropertyInfo>::Element *F=t->property_list.front();F;F=F->next()) { + + hash = hash_djb2_one_64( F->get().name.hash(), hash); + hash = hash_djb2_one_64( F->get().type, hash); + hash = hash_djb2_one_64( F->get().hint, hash); + hash = hash_djb2_one_64( F->get().hint_string.hash(), hash); + hash = hash_djb2_one_64( F->get().usage, hash); + } + + + } + + + return hash; +#else + return 0; +#endif + +} + bool ObjectTypeDB::type_exists(const StringName &p_type) { OBJTYPE_LOCK; @@ -309,6 +482,7 @@ void ObjectTypeDB::_add_type2(const StringName& p_type, const StringName& p_inhe TypeInfo &ti=types[name]; ti.name=name; ti.inherits=p_inherits; + ti.api=current_api; if (ti.inherits) { @@ -866,21 +1040,14 @@ MethodBind* ObjectTypeDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , c Vector<Variant> defvals; -#define PARSE_DEFVAL(m_defval)\ -if (d##m_defval.used) defvals.insert(0,d##m_defval.val);\ -else goto set_defvals; - defvals.resize(p_defcount); for(int i=0;i<p_defcount;i++) { defvals[i]=*p_defs[p_defcount-i-1]; } - set_defvals: - p_bind->set_default_arguments(defvals); p_bind->set_hint_flags(p_flags); -#undef PARSE_DEFVAL return p_bind; } diff --git a/core/object_type_db.h b/core/object_type_db.h index 3fcd38aa31..9e9029ff2f 100644 --- a/core/object_type_db.h +++ b/core/object_type_db.h @@ -109,7 +109,13 @@ static _FORCE_INLINE_ const char* _MD(const char* m_name, ...) { return m_name; #endif class ObjectTypeDB { - +public: + enum APIType { + API_CORE, + API_EDITOR, + API_NONE + }; +public: struct PropertySetGet { int index; @@ -122,6 +128,7 @@ class ObjectTypeDB { struct TypeInfo { + APIType api; TypeInfo *inherits_ptr; HashMap<StringName,MethodBind*,StringNameHasher> method_map; HashMap<StringName,int,StringNameHasher> constant_map; @@ -161,6 +168,7 @@ class ObjectTypeDB { #endif + static APIType current_api; static void _add_type2(const StringName& p_type, const StringName& p_inherits); public: @@ -236,6 +244,9 @@ public: static bool is_type(const StringName &p_type,const StringName& p_inherits); static bool can_instance(const StringName &p_type); static Object *instance(const StringName &p_type); + static APIType get_api_type(const StringName &p_type); + + static uint64_t get_api_hash(APIType p_api); #if 0 template<class N, class M> @@ -415,13 +426,13 @@ public: #endif template<class M> - static MethodBind* bind_native_method(uint32_t p_flags, StringName p_name, M p_method,const MethodInfo& p_info=MethodInfo(),const Vector<Variant>& p_default_args=Vector<Variant>()) { + static MethodBind* bind_vararg_method(uint32_t p_flags, StringName p_name, M p_method,const MethodInfo& p_info=MethodInfo(),const Vector<Variant>& p_default_args=Vector<Variant>()) { GLOBAL_LOCK_FUNCTION; - MethodBind *bind = create_native_method_bind(p_method,p_info); + MethodBind *bind = create_vararg_method_bind(p_method,p_info); ERR_FAIL_COND_V(!bind,NULL); String rettype; @@ -499,6 +510,8 @@ public: static void add_compatibility_type(const StringName& p_type,const StringName& p_fallback); static void init(); + + static void set_current_api(APIType p_api); static void cleanup(); }; diff --git a/core/os/input.cpp b/core/os/input.cpp index 401ab7ffe2..4ab57a84ea 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -64,6 +64,10 @@ void Input::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_connected_joysticks"),&Input::get_connected_joysticks); ObjectTypeDB::bind_method(_MD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength); ObjectTypeDB::bind_method(_MD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration); + ObjectTypeDB::bind_method(_MD("get_joy_button_string", "button_index"), &Input::get_joy_button_string); + ObjectTypeDB::bind_method(_MD("get_joy_button_index_from_string", "button"), &Input::get_joy_button_index_from_string); + ObjectTypeDB::bind_method(_MD("get_joy_axis_string", "axis_index"), &Input::get_joy_axis_string); + ObjectTypeDB::bind_method(_MD("get_joy_axis_index_from_string", "axis"), &Input::get_joy_axis_index_from_string); ObjectTypeDB::bind_method(_MD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0)); ObjectTypeDB::bind_method(_MD("stop_joy_vibration", "device"), &Input::stop_joy_vibration); ObjectTypeDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer); @@ -90,7 +94,7 @@ void Input::get_argument_options(const StringName& p_function,int p_idx,List<Str #ifdef TOOLS_ENABLED String pf=p_function; - if (p_idx==0 && (pf=="is_action_pressed" || pf=="action_press" || pf=="action_release")) { + if (p_idx==0 && (pf=="is_action_pressed" || pf=="action_press" || pf=="action_release" || pf=="is_action_just_pressed" || pf=="is_action_just_released")) { List<PropertyInfo> pinfo; Globals::get_singleton()->get_property_list(&pinfo); diff --git a/core/os/input.h b/core/os/input.h index 665fb4ad99..d8f3be09df 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -96,6 +96,11 @@ public: virtual void set_custom_mouse_cursor(const RES& p_cursor,const Vector2& p_hotspot=Vector2())=0; virtual void set_mouse_in_window(bool p_in_window)=0; + virtual String get_joy_button_string(int p_button)=0; + virtual String get_joy_axis_string(int p_axis)=0; + virtual int get_joy_button_index_from_string(String p_button)=0; + virtual int get_joy_axis_index_from_string(String p_axis)=0; + Input(); }; diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 9d920724e1..9982767be1 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -204,7 +204,7 @@ bool InputEvent::is_pressed() const { case MOUSE_BUTTON: return mouse_button.pressed; case JOYSTICK_BUTTON: return joy_button.pressed; case SCREEN_TOUCH: return screen_touch.pressed; - case JOYSTICK_MOTION: return InputMap::get_singleton()->event_is_joy_motion_action_pressed(*this); + case JOYSTICK_MOTION: return ABS(joy_motion.axis_value) > 0.5; case ACTION: return action.pressed; default: {} } diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 3de26573f4..7e4ba039c5 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -33,6 +33,7 @@ #include "io/config_file.h" #include "os/main_loop.h" #include "io/packet_peer.h" +#include "math/a_star.h" #include "globals.h" #include "object_type_db.h" #include "geometry.h" @@ -147,6 +148,7 @@ void register_core_types() { ObjectTypeDB::register_type<PackedDataContainer>(); ObjectTypeDB::register_virtual_type<PackedDataContainerRef>(); + ObjectTypeDB::register_type<AStar>(); ip = IP::create(); diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index d3cd824620..6d685d3c43 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -221,7 +221,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) { if (F->get().get_type()==Variant::OBJECT) { packet_peer_stream->put_var("*"+E->get()); - packet_peer_stream->put_var(safe_get_instance_id(F->get())); + String pretty_print = F->get().operator String(); + packet_peer_stream->put_var(pretty_print.ascii().get_data()); } else { packet_peer_stream->put_var(E->get()); packet_peer_stream->put_var(F->get()); @@ -244,7 +245,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) { if (F->get().get_type()==Variant::OBJECT) { packet_peer_stream->put_var("*"+E->get()); - packet_peer_stream->put_var(safe_get_instance_id(F->get())); + String pretty_print = F->get().operator String(); + packet_peer_stream->put_var(pretty_print.ascii().get_data()); } else { packet_peer_stream->put_var(E->get()); packet_peer_stream->put_var(F->get()); diff --git a/core/script_language.h b/core/script_language.h index 1b037e908c..53af4c74d1 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -122,6 +122,7 @@ public: virtual void get_script_method_list(List<MethodInfo> *p_list) const=0; virtual void get_script_property_list(List<PropertyInfo> *p_list) const=0; + virtual int get_member_line(const StringName& p_member) const { return 0; } Script() {} }; @@ -207,7 +208,26 @@ public: virtual bool has_named_classes() const=0; virtual int find_function(const String& p_function,const String& p_code) const=0; virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const=0; + virtual 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; } + + struct LookupResult { + enum Type { + RESULT_SCRIPT_LOCATION, + RESULT_CLASS, + RESULT_CLASS_CONSTANT, + RESULT_CLASS_PROPERTY, + RESULT_CLASS_METHOD + }; + Type type; + Ref<Script> script; + String class_name; + String class_member; + int location; + }; + + virtual Error lookup_code(const String& p_code, const String& p_symbol,const String& p_base_path, Object*p_owner,LookupResult& r_result) { return ERR_UNAVAILABLE; } + virtual void auto_indent_code(String& p_code,int p_from_line,int p_to_line) const=0; virtual void add_global_constant(const StringName& p_variable,const Variant& p_value)=0; diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index 99740b365c..e8a71d4991 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -490,13 +490,9 @@ void UndoRedo::_bind_methods() { mi.name="add_do_method"; mi.arguments.push_back( PropertyInfo( Variant::OBJECT, "object")); mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); - Vector<Variant> defargs; - for(int i=0;i<VARIANT_ARG_MAX;++i) { - mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); - defargs.push_back(Variant()); - } - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"add_do_method",&UndoRedo::_add_do_method,mi,defargs); + + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"add_do_method",&UndoRedo::_add_do_method,mi); } { @@ -504,13 +500,9 @@ void UndoRedo::_bind_methods() { mi.name="add_undo_method"; mi.arguments.push_back( PropertyInfo( Variant::OBJECT, "object")); mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); - Vector<Variant> defargs; - for(int i=0;i<VARIANT_ARG_MAX;++i) { - mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); - defargs.push_back(Variant()); - } - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"add_undo_method",&UndoRedo::_add_undo_method,mi,defargs); + + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"add_undo_method",&UndoRedo::_add_undo_method,mi); } ObjectTypeDB::bind_method(_MD("add_do_property","object", "property", "value:Variant"),&UndoRedo::add_do_property); diff --git a/core/ustring.cpp b/core/ustring.cpp index 0d887210c3..f7dcba6b14 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3173,7 +3173,7 @@ bool String::is_valid_identifier() const { //kind of poor should be rewritten properly -String String::world_wrap(int p_chars_per_line) const { +String String::word_wrap(int p_chars_per_line) const { int from=0; int last_space=0; diff --git a/core/ustring.h b/core/ustring.h index bb57b11d88..09d13a9e64 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -218,7 +218,7 @@ public: String c_escape() const; String c_unescape() const; String json_escape() const; - String world_wrap(int p_chars_per_line) const; + String word_wrap(int p_chars_per_line) const; String percent_encode() const; String percent_decode() const; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index e7e71e8251..a84eed4d88 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -346,6 +346,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM0R(Vector2,angle); // VCALL_LOCALMEM1R(Vector2,cross); VCALL_LOCALMEM0R(Vector2,abs); + VCALL_LOCALMEM1R(Vector2,clamped); VCALL_LOCALMEM0R(Rect2,get_area); VCALL_LOCALMEM1R(Rect2,intersects); @@ -464,8 +465,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM0R(Array,hash); VCALL_LOCALMEM1(Array,push_back); VCALL_LOCALMEM1(Array,push_front); - VCALL_LOCALMEM0(Array,pop_back); - VCALL_LOCALMEM0(Array,pop_front); + VCALL_LOCALMEM0R(Array,pop_back); + VCALL_LOCALMEM0R(Array,pop_front); VCALL_LOCALMEM1(Array,append); VCALL_LOCALMEM1(Array,resize); VCALL_LOCALMEM2(Array,insert); @@ -518,6 +519,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM1(ByteArray,append); VCALL_LOCALMEM1(ByteArray,append_array); VCALL_LOCALMEM0(ByteArray,invert); + VCALL_LOCALMEM2R(ByteArray,subarray); VCALL_LOCALMEM0R(IntArray,size); VCALL_LOCALMEM2(IntArray,set); @@ -1456,6 +1458,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC1(VECTOR2,VECTOR2,Vector2,reflect,VECTOR2,"vec",varray()); //ADDFUNC1(VECTOR2,REAL,Vector2,cross,VECTOR2,"with",varray()); ADDFUNC0(VECTOR2,VECTOR2,Vector2,abs,varray()); + ADDFUNC1(VECTOR2,VECTOR2,Vector2,clamped,REAL,"length",varray()); ADDFUNC0(RECT2,REAL,Rect2,get_area,varray()); ADDFUNC1(RECT2,BOOL,Rect2,intersects,RECT2,"b",varray()); @@ -1592,6 +1595,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC2(RAW_ARRAY,INT,ByteArray,insert,INT,"idx",INT,"byte",varray()); ADDFUNC1(RAW_ARRAY,NIL,ByteArray,resize,INT,"idx",varray()); ADDFUNC0(RAW_ARRAY,NIL,ByteArray,invert,varray()); + ADDFUNC2(RAW_ARRAY,RAW_ARRAY,ByteArray,subarray,INT,"from",INT,"to",varray()); ADDFUNC0(RAW_ARRAY,STRING,ByteArray,get_string_from_ascii,varray()); ADDFUNC0(RAW_ARRAY,STRING,ByteArray,get_string_from_utf8,varray()); diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 07fd9980e0..deed5c5cda 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -2153,6 +2153,120 @@ <constants> </constants> </class> +<class name="AStar" inherits="Reference" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="add_point"> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="pos" type="Vector3"> + </argument> + <argument index="2" name="weight_scale" type="float" default="1"> + </argument> + <description> + </description> + </method> + <method name="are_points_connected" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="to_id" type="int"> + </argument> + <description> + </description> + </method> + <method name="clear"> + <description> + </description> + </method> + <method name="connect_points"> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="to_id" type="int"> + </argument> + <description> + </description> + </method> + <method name="disconnect_points"> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="to_id" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_available_point_id" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_closest_point" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="to_pos" type="Vector3"> + </argument> + <description> + </description> + </method> + <method name="get_closest_pos_in_segment" qualifiers="const"> + <return type="Vector3"> + </return> + <argument index="0" name="to_pos" type="Vector3"> + </argument> + <description> + </description> + </method> + <method name="get_id_path"> + <return type="IntArray"> + </return> + <argument index="0" name="from_id" type="int"> + </argument> + <argument index="1" name="to_id" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_point_path"> + <return type="Vector3Array"> + </return> + <argument index="0" name="from_id" type="int"> + </argument> + <argument index="1" name="to_id" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_point_pos" qualifiers="const"> + <return type="Vector3"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_point_weight_scale" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="remove_point"> + <argument index="0" name="id" type="int"> + </argument> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="AcceptDialog" inherits="WindowDialog" category="Core"> <brief_description> Base dialog for user notification. @@ -2221,6 +2335,12 @@ Register a [LineEdit] in the dialog. When the enter key is pressed, the dialog will be accepted. </description> </method> + <method name="set_child_rect"> + <argument index="0" name="child" type="Control"> + </argument> + <description> + </description> + </method> <method name="set_hide_on_ok"> <argument index="0" name="enabled" type="bool"> </argument> @@ -4018,7 +4138,7 @@ </argument> <argument index="2" name="area_shape" type="int"> </argument> - <argument index="3" name="area_shape" type="int"> + <argument index="3" name="self_shape" type="int"> </argument> <description> This signal triggers only once when an area enters this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering. @@ -4038,7 +4158,7 @@ </argument> <argument index="2" name="area_shape" type="int"> </argument> - <argument index="3" name="area_shape" type="int"> + <argument index="3" name="self_shape" type="int"> </argument> <description> This signal triggers only once when an area exits this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering. @@ -4360,7 +4480,7 @@ </argument> <argument index="2" name="area_shape" type="int"> </argument> - <argument index="3" name="area_shape" type="int"> + <argument index="3" name="self_shape" type="int"> </argument> <description> This signal triggers only once when an area enters this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering. @@ -4380,7 +4500,7 @@ </argument> <argument index="2" name="area_shape" type="int"> </argument> - <argument index="3" name="area_shape" type="int"> + <argument index="3" name="self_shape" type="int"> </argument> <description> This signal triggers only once when an area exits this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering. @@ -6749,6 +6869,12 @@ <description> </description> </method> + <method name="get_custom_viewport" qualifiers="const"> + <return type="Viewport"> + </return> + <description> + </description> + </method> <method name="get_drag_margin" qualifiers="const"> <return type="float"> </return> @@ -6852,6 +6978,12 @@ <description> </description> </method> + <method name="set_custom_viewport"> + <argument index="0" name="viewport" type="Viewport"> + </argument> + <description> + </description> + </method> <method name="set_drag_margin"> <argument index="0" name="margin" type="int"> </argument> @@ -7554,6 +7686,12 @@ Canvas Item layer. [CanvasItem] nodes that are direct or indirect children of a [CanvasLayer] will be drawn in that layer. The layer is a numeric index that defines the draw order. The default 2D scene renders with index 0, so a [CanvasLayer] with index -1 will be drawn below, and one with index 1 will be drawn above. This is very useful for HUDs (in layer 1+ or above), or backgrounds (in layer -1 or below). </description> <methods> + <method name="get_custom_viewport" qualifiers="const"> + <return type="Viewport"> + </return> + <description> + </description> + </method> <method name="get_layer" qualifiers="const"> <return type="int"> </return> @@ -7596,13 +7734,6 @@ Return the base transform for this layer. </description> </method> - <method name="get_viewport" qualifiers="const"> - <return type="RID"> - </return> - <description> - Return the viewport RID for this layer. - </description> - </method> <method name="get_world_2d" qualifiers="const"> <return type="World2D"> </return> @@ -7610,6 +7741,12 @@ Return the [World2D] used by this layer. </description> </method> + <method name="set_custom_viewport"> + <argument index="0" name="viewport" type="Viewport"> + </argument> + <description> + </description> + </method> <method name="set_layer"> <argument index="0" name="layer" type="int"> </argument> @@ -8672,6 +8809,28 @@ <constants> </constants> </class> +<class name="ColorFrame" inherits="Control" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="get_frame_color" qualifiers="const"> + <return type="Color"> + </return> + <description> + </description> + </method> + <method name="set_frame_color"> + <argument index="0" name="color" type="Color"> + </argument> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="ColorPicker" inherits="BoxContainer" category="Core"> <brief_description> Color picker control. @@ -10871,7 +11030,7 @@ </return> <description> Initialise the stream used to list all files and directories using the [method get_next] function, closing the current opened stream if needed. Once the stream has been processed, it should typically be closed with [method list_dir_end]. - Return false if the stream could not be initialised. + Return true if the stream could not be initialised. </description> </method> <method name="list_dir_end"> @@ -11261,6 +11420,184 @@ </constant> </constants> </class> +<class name="EditorFileSystem" inherits="Node" category="Core"> + <brief_description> + Resource filesystem, as the editor sees it. + </brief_description> + <description> + This object holds information of all resources in the filesystem, their types, etc. + </description> + <methods> + <method name="get_file_type" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <description> + Get the type of the file, given the full path. + </description> + </method> + <method name="get_filesystem"> + <return type="EditorFileSystemDirectory"> + </return> + <description> + Get the root directory object. + </description> + </method> + <method name="get_path"> + <return type="EditorFileSystemDirectory"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <description> + </description> + </method> + <method name="get_scanning_progress" qualifiers="const"> + <return type="float"> + </return> + <description> + Return the scan progress for 0 to 1 if the FS is being scanned. + </description> + </method> + <method name="is_scanning" qualifiers="const"> + <return type="bool"> + </return> + <description> + Return true of the filesystem is being scanned. + </description> + </method> + <method name="scan"> + <description> + Scan the filesystem for changes. + </description> + </method> + <method name="scan_sources"> + <description> + Check if the source of any imported resource changed. + </description> + </method> + <method name="update_file"> + <argument index="0" name="path" type="String"> + </argument> + <description> + Update a file information. Call this if an external program (not Godot) modified the file. + </description> + </method> + </methods> + <signals> + <signal name="filesystem_changed"> + <description> + Emitted if the filesystem changed. + </description> + </signal> + <signal name="sources_changed"> + <argument index="0" name="exist" type="bool"> + </argument> + <description> + Emitted if the source of any imported file changed. + </description> + </signal> + </signals> + <constants> + </constants> +</class> +<class name="EditorFileSystemDirectory" inherits="Object" category="Core"> + <brief_description> + A diretory for the resource filesystem. + </brief_description> + <description> + </description> + <methods> + <method name="find_dir_index" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + <method name="find_file_index" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + <method name="get_file" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_file_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_file_path" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_file_type" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_name"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_parent"> + <return type="EditorFileSystemDirectory"> + </return> + <description> + </description> + </method> + <method name="get_path" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_subdir"> + <return type="Object"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_subdir_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="is_missing_sources" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="EditorImportPlugin" inherits="Reference" category="Core"> <brief_description> Import plugin for editor @@ -11459,14 +11796,24 @@ This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object. </description> </method> - <method name="forward_input_event" qualifiers="virtual"> + <method name="forward_canvas_input_event" qualifiers="virtual"> <return type="bool"> </return> - <argument index="0" name="event" type="InputEvent"> + <argument index="0" name="canvas_xform" type="Matrix32"> + </argument> + <argument index="1" name="event" type="InputEvent"> </argument> <description> - This is a low level function for plugins that edit a given object type derived from CanvasItem to capture the input in the 2D editor viewport. The function is only being called if your object is being edited. - Return true if you want to capture the input, otherwise false. + If your plugin is active (because handles() returned true to the object), any input interaction with the 2D canvas editor will be first forwarded here. The canvas transform (containing zoom and offset to transform to edited world coordinates) is provided, but the input supplied is in untransformed coordinates to the canvas editor. Return true if you want to eat this event and not pass it to the canvas editor. + </description> + </method> + <method name="forward_draw_over_canvas" qualifiers="virtual"> + <argument index="0" name="canvas_xform" type="Matrix32"> + </argument> + <argument index="1" name="canvas" type="Control"> + </argument> + <description> + This function is called every time the 2D canvas editor draws (which overlays over the edited scene). Drawing over the supplied control will draw over the edited scene. To convert from control coordinates to edited scene coordinates (including zoom and offset), a transform is also provided. If you require this control to be redraw, call [method update_canvas](). </description> </method> <method name="forward_spatial_input_event" qualifiers="virtual"> @@ -11503,6 +11850,13 @@ Get the general settings for the editor (the same window that appears in the Settings menu). </description> </method> + <method name="get_editor_viewport"> + <return type="Control"> + </return> + <description> + Get the main editor control. Use this as a parent for main screens. + </description> + </method> <method name="get_name" qualifiers="virtual"> <return type="String"> </return> @@ -11510,6 +11864,20 @@ Get the name of the editor plugin. For main scren plugins this is what will appear in the selector (which by default is 2D, 3D, Script). </description> </method> + <method name="get_resource_filesystem"> + <return type="EditorFileSystem"> + </return> + <description> + Get the filesystem cache for all resources in the project. + </description> + </method> + <method name="get_resource_previewer"> + <return type="EditorResourcePreview"> + </return> + <description> + Get tool for generating resource previews. + </description> + </method> <method name="get_selection"> <return type="EditorSelection"> </return> @@ -11554,6 +11922,25 @@ Return true if this is a main screen editor plugin (it goes in the main screen selector together with 2D, 3D, Script). </description> </method> + <method name="hide_bottom_panel"> + <description> + </description> + </method> + <method name="inspect_object"> + <argument index="0" name="object" type="Object"> + </argument> + <argument index="1" name="for_property" type="String" default=""""> + </argument> + <description> + Inspect an object in the inspector. + </description> + </method> + <method name="make_bottom_panel_item_visible"> + <argument index="0" name="item" type="Control"> + </argument> + <description> + </description> + </method> <method name="make_visible" qualifiers="virtual"> <argument index="0" name="visible" type="bool"> </argument> @@ -11621,6 +12008,11 @@ Restore the plugin GUI layout saved by [method EditorPlugin.get_window_layout]. </description> </method> + <method name="update_canvas"> + <description> + Updates the control used to draw the edited scene over the 2D canvas. This is used together with [method forward_canvas_input_event](). + </description> + </method> </methods> <constants> <constant name="CONTAINER_TOOLBAR" value="0"> @@ -11657,6 +12049,117 @@ </constant> </constants> </class> +<class name="EditorResourcePreview" inherits="Node" category="Core"> + <brief_description> + Helper to generate previews of reources or files. + </brief_description> + <description> + This object is used to generate previews for resources of files. + </description> + <methods> + <method name="add_preview_generator"> + <argument index="0" name="generator" type="EditorResourcePreviewGenerator"> + </argument> + <description> + Create an own, custom preview generator. + </description> + </method> + <method name="check_for_invalidation"> + <argument index="0" name="path" type="String"> + </argument> + <description> + Check if the resource changed, if so it will be invalidated and the corresponding signal emitted. + </description> + </method> + <method name="queue_edited_resource_preview"> + <argument index="0" name="resource" type="Resource"> + </argument> + <argument index="1" name="receiver" type="Object"> + </argument> + <argument index="2" name="receiver_func" type="String"> + </argument> + <argument index="3" name="userdata" type="Variant"> + </argument> + <description> + Queue a resource being edited for preview (using an instance). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texure (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything. + </description> + </method> + <method name="queue_resource_preview"> + <argument index="0" name="path" type="String"> + </argument> + <argument index="1" name="receiver" type="Object"> + </argument> + <argument index="2" name="receiver_func" type="String"> + </argument> + <argument index="3" name="userdata" type="Variant"> + </argument> + <description> + Queue a resource file for preview (using a path). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texure (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything. + </description> + </method> + <method name="remove_preview_generator"> + <argument index="0" name="generator" type="EditorResourcePreviewGenerator"> + </argument> + <description> + Remove a custom preview generator. + </description> + </method> + </methods> + <signals> + <signal name="preview_invalidated"> + <argument index="0" name="path" type="String"> + </argument> + <description> + If a preview was invalidated (changed) this signal will emit (using the path of the preview) + </description> + </signal> + </signals> + <constants> + </constants> +</class> +<class name="EditorResourcePreviewGenerator" inherits="Reference" category="Core"> + <brief_description> + Custom generator of previews. + </brief_description> + <description> + Custom code to generate previews. Please check "file_dialog/thumbnail_size" in EditorSettings to find out the right size to do previews at. + </description> + <methods> + <method name="generate" qualifiers="virtual"> + <return type="Texture"> + </return> + <argument index="0" name="from" type="Resource"> + </argument> + <description> + Generate a preview from a given resource. This must be always implemented. + Returning an empty texture is an OK way to fail and let another generator take care. + Care must be taken because this function is always called from a thread (not the main thread). + </description> + </method> + <method name="generate_from_path" qualifiers="virtual"> + <return type="Texture"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <description> + Generate a preview directly from a path, implementing this is optional, as default code will load and call generate() + Returning an empty texture is an OK way to fail and let another generator take care. + Care must be taken because this function is always called from a thread (not the main thread). + </description> + </method> + <method name="handles" qualifiers="virtual"> + <return type="bool"> + </return> + <argument index="0" name="type" type="String"> + </argument> + <description> + Return if your generator supports this resource type. + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="EditorScenePostImport" inherits="Reference" category="Core"> <brief_description> Base script for post-processing scenes being imported. @@ -11732,6 +12235,13 @@ Get the list of selectes nodes. </description> </method> + <method name="get_transformable_selected_nodes"> + <return type="Array"> + </return> + <description> + Get the list of selected nodes, optimized for transform operations (ie, moving them, rotating, etc). This list avoids situations where a node is selected and also chid/grandchild. + </description> + </method> <method name="remove_node"> <argument index="0" name="node" type="Node"> </argument> @@ -13189,31 +13699,10 @@ However, by creating a [FuncRef] using the [method @GDScript.funcref] function, a reference to a function in a given object can be created, passed around and called. </description> <methods> - <method name="call_func"> + <method name="call_func" qualifiers="vararg"> <return type="Variant"> </return> - <argument index="0" name="arg0" type="Variant" default="NULL"> - </argument> - <argument index="1" name="arg1" type="Variant" default="NULL"> - </argument> - <argument index="2" name="arg2" type="Variant" default="NULL"> - </argument> - <argument index="3" name="arg3" type="Variant" default="NULL"> - </argument> - <argument index="4" name="arg4" type="Variant" default="NULL"> - </argument> - <argument index="5" name="arg5" type="Variant" default="NULL"> - </argument> - <argument index="6" name="arg6" type="Variant" default="NULL"> - </argument> - <argument index="7" name="arg7" type="Variant" default="NULL"> - </argument> - <argument index="8" name="arg8" type="Variant" default="NULL"> - </argument> - <argument index="9" name="arg9" type="Variant" default="NULL"> - </argument> <description> - Call the referenced function with the given arguments. The argument count must correspond to the required number of arguments in the function. Returns the return value of the function call. </description> </method> <method name="set_function"> @@ -13290,7 +13779,7 @@ <description> </description> </method> - <method name="new"> + <method name="new" qualifiers="vararg"> <return type="Object"> </return> <description> @@ -14465,6 +14954,8 @@ </theme_item> <theme_item name="comment" type="StyleBox"> </theme_item> + <theme_item name="commentfocus" type="StyleBox"> + </theme_item> <theme_item name="defaultfocus" type="StyleBox"> </theme_item> <theme_item name="defaultframe" type="StyleBox"> @@ -15390,10 +15881,11 @@ </argument> <argument index="2" name="ssl_validate_domain" type="bool" default="true"> </argument> + <argument index="3" name="method" type="int" default="0"> + </argument> + <argument index="4" name="request_data" type="String" default=""""> + </argument> <description> - Make a HTTP GET request. The url is the complete url including "http://" or "https://" which will be parsed for a host and a port. - The custom_headers are HTTP request headers which will be used. If User-Agent is not specified a Godot specific will be used. - The ssl_validate_domain specifies if in case of HTTPS the server certificate should be verified. </description> </method> <method name="set_body_size_limit"> @@ -16023,6 +16515,8 @@ </argument> <argument index="2" name="radius" type="float"> </argument> + <argument index="3" name="add_uv" type="bool" default="true"> + </argument> <description> Simple helper to draw an uvsphere, with given latitudes, longitude and radius. </description> @@ -16124,7 +16618,7 @@ Add a new mapping entry (in SDL2 format) to the mapping database. Optionally update already connected devices. </description> </method> - <method name="get_accelerometer"> + <method name="get_accelerometer" qualifiers="const"> <return type="Vector3"> </return> <description> @@ -16138,14 +16632,14 @@ Returns an [Array] containing the device IDs of all currently connected joysticks. </description> </method> - <method name="get_gyroscope"> + <method name="get_gyroscope" qualifiers="const"> <return type="Vector3"> </return> <description> If the device has a gyroscope, this will return the rate of rotation in rad/s around a device's x, y, and z axis. </description> </method> - <method name="get_joy_axis"> + <method name="get_joy_axis" qualifiers="const"> <return type="float"> </return> <argument index="0" name="device" type="int"> @@ -16156,6 +16650,38 @@ Returns the current value of the joystick axis at given index (see JOY_* constants in [@Global Scope]) </description> </method> + <method name="get_joy_axis_index_from_string"> + <return type="int"> + </return> + <argument index="0" name="axis" type="String"> + </argument> + <description> + </description> + </method> + <method name="get_joy_axis_string"> + <return type="String"> + </return> + <argument index="0" name="axis_index" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_joy_button_index_from_string"> + <return type="int"> + </return> + <argument index="0" name="button" type="String"> + </argument> + <description> + </description> + </method> + <method name="get_joy_button_string"> + <return type="String"> + </return> + <argument index="0" name="button_index" type="int"> + </argument> + <description> + </description> + </method> <method name="get_joy_guid" qualifiers="const"> <return type="String"> </return> @@ -16192,7 +16718,7 @@ Returns the strength of the joystick vibration: x is the strength of the weak motor, and y is the strength of the strong motor. </description> </method> - <method name="get_magnetometer"> + <method name="get_magnetometer" qualifiers="const"> <return type="Vector3"> </return> <description> @@ -16220,7 +16746,23 @@ Returns the mouse speed for the last time the cursor was moved, and this until the next frame where the mouse moves. This means that even if the mouse is not moving, this function will still return the value of the last motion. </description> </method> - <method name="is_action_pressed"> + <method name="is_action_just_pressed" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="action" type="String"> + </argument> + <description> + </description> + </method> + <method name="is_action_just_released" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="action" type="String"> + </argument> + <description> + </description> + </method> + <method name="is_action_pressed" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="action" type="String"> @@ -16229,7 +16771,7 @@ Returns true or false depending on whether the action event is pressed. Actions and their events can be set in the Project Settings / Input Map tab. Or be set with [InputMap]. </description> </method> - <method name="is_joy_button_pressed"> + <method name="is_joy_button_pressed" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="device" type="int"> @@ -16249,7 +16791,7 @@ Returns if the specified device is known by the system. This means that it sets all button and axis indices exactly as defined in the JOY_* constants (see [@Global Scope]). Unknown joysticks are not expected to match these constants, but you can still retrieve events from them. </description> </method> - <method name="is_key_pressed"> + <method name="is_key_pressed" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="scancode" type="int"> @@ -16258,7 +16800,7 @@ Returns true or false depending on whether the key is pressed or not. You can pass KEY_*, which are pre-defined constants listed in [@Global Scope]. </description> </method> - <method name="is_mouse_button_pressed"> + <method name="is_mouse_button_pressed" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="button" type="int"> @@ -16300,7 +16842,8 @@ <argument index="3" name="duration" type="float" default="0"> </argument> <description> - Starts to vibrate the joystick. Joysticks usually come with two rumble motors, a strong and a weak one. weak_magnitude is the strength of the weak motor (between 0 and 1) and strong_magnitude is the strength of the strong motor (between 0 and 1). duration is the duration of the effect in seconds (a duration of 0 will play the vibration indefinitely). + Starts to vibrate the joystick. Joysticks usually come with two rumble motors, a strong and a weak one. weak_magnitude is the strength of the weak motor (between 0 and 1) and strong_magnitude is the strength of the strong motor (between 0 and 1). duration is the duration of the effect in seconds (a duration of 0 will try to play the vibration indefinitely). + Note that not every hardware is compatible with long effect durations, it is recommended to restart an effect if in need to play it for more than a few seconds. </description> </method> <method name="stop_joy_vibration"> @@ -17947,6 +18490,13 @@ Returns the list of selected indexes. </description> </method> + <method name="get_v_scroll"> + <return type="Object"> + </return> + <description> + Returns the current vertical scroll bar for the List. + </description> + </method> <method name="is_item_disabled" qualifiers="const"> <return type="bool"> </return> @@ -17965,6 +18515,15 @@ Returns whether or not the item at the specified index is selectable. </description> </method> + <method name="is_item_tooltip_enabled" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Returns whether the tooptip is enabled for specified item index. + </description> + </method> <method name="is_same_column_width" qualifiers="const"> <return type="int"> </return> @@ -18101,6 +18660,15 @@ Sets tooltip hint for item at specified index. </description> </method> + <method name="set_item_tooltip_enabled"> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="enable" type="bool"> + </argument> + <description> + Sets whether the tooltip is enabled for specified item index. + </description> + </method> <method name="set_max_columns"> <argument index="0" name="amount" type="int"> </argument> @@ -18606,7 +19174,9 @@ </argument> <argument index="1" name="floor_normal" type="Vector2" default="Vector2(0, 0)"> </argument> - <argument index="2" name="max_bounces" type="int" default="4"> + <argument index="2" name="slope_stop_min_velocity" type="float" default="5"> + </argument> + <argument index="3" name="max_bounces" type="int" default="4"> </argument> <description> </description> @@ -18635,10 +19205,12 @@ <method name="test_move"> <return type="bool"> </return> - <argument index="0" name="rel_vec" type="Vector2"> + <argument index="0" name="from" type="Matrix32"> + </argument> + <argument index="1" name="rel_vec" type="Vector2"> </argument> <description> - Return true if there would be a collision if the body moved in the given direction. + Return true if there would be a collision if the body moved from the given point in the given direction. </description> </method> </methods> @@ -19436,7 +20008,7 @@ </description> </method> <method name="cursor_set_blink_enabled"> - <argument index="0" name="enable" type="bool"> + <argument index="0" name="enabled" type="bool"> </argument> <description> Set the line edit caret to blink. @@ -19462,6 +20034,12 @@ Return the cursor position inside the [LineEdit]. </description> </method> + <method name="get_expand_to_text_length" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="get_max_length" qualifiers="const"> <return type="int"> </return> @@ -19547,6 +20125,12 @@ Set the [i]editable[/i] status of the [LineEdit]. When disabled, existing text can't be modified and new text can't be added. </description> </method> + <method name="set_expand_to_text_length"> + <argument index="0" name="enabled" type="bool"> + </argument> + <description> + </description> + </method> <method name="set_max_length"> <argument index="0" name="chars" type="int"> </argument> @@ -22479,7 +23063,7 @@ Replace a node in a scene by a given one. Subscriptions that pass through this node will be lost. </description> </method> - <method name="rpc"> + <method name="rpc" qualifiers="vararg"> <argument index="0" name="method" type="String"> </argument> <description> @@ -22493,22 +23077,22 @@ <description> </description> </method> - <method name="rpc_id"> - <argument index="0" name="peer_" type="int"> + <method name="rpc_id" qualifiers="vararg"> + <argument index="0" name="peer_id" type="int"> </argument> <argument index="1" name="method" type="String"> </argument> <description> </description> </method> - <method name="rpc_unreliable"> + <method name="rpc_unreliable" qualifiers="vararg"> <argument index="0" name="method" type="String"> </argument> <description> </description> </method> - <method name="rpc_unreliable_id"> - <argument index="0" name="peer_" type="int"> + <method name="rpc_unreliable_id" qualifiers="vararg"> + <argument index="0" name="peer_id" type="int"> </argument> <argument index="1" name="method" type="String"> </argument> @@ -23960,50 +24544,18 @@ Add a user signal (can be added anytime). Arguments are optional, but can be added as an array of dictionaries, each containing "name" and "type" (from [@Global Scope] TYPE_*). </description> </method> - <method name="call"> + <method name="call" qualifiers="vararg"> <return type="Variant"> </return> <argument index="0" name="method" type="String"> </argument> - <argument index="1" name="arg0" type="Variant" default="NULL"> - </argument> - <argument index="2" name="arg1" type="Variant" default="NULL"> - </argument> - <argument index="3" name="arg2" type="Variant" default="NULL"> - </argument> - <argument index="4" name="arg3" type="Variant" default="NULL"> - </argument> - <argument index="5" name="arg4" type="Variant" default="NULL"> - </argument> - <argument index="6" name="arg5" type="Variant" default="NULL"> - </argument> - <argument index="7" name="arg6" type="Variant" default="NULL"> - </argument> - <argument index="8" name="arg7" type="Variant" default="NULL"> - </argument> - <argument index="9" name="arg8" type="Variant" default="NULL"> - </argument> - <argument index="10" name="arg9" type="Variant" default="NULL"> - </argument> <description> - Call a function in the object, result is returned. </description> </method> - <method name="call_deferred"> + <method name="call_deferred" qualifiers="vararg"> <argument index="0" name="method" type="String"> </argument> - <argument index="1" name="arg0" type="Variant" default="NULL"> - </argument> - <argument index="2" name="arg1" type="Variant" default="NULL"> - </argument> - <argument index="3" name="arg2" type="Variant" default="NULL"> - </argument> - <argument index="4" name="arg3" type="Variant" default="NULL"> - </argument> - <argument index="5" name="arg4" type="Variant" default="NULL"> - </argument> <description> - Create and store a function in the object. The call will take place on idle time. </description> </method> <method name="callv"> @@ -24051,21 +24603,10 @@ Disconnect a signal from a method. </description> </method> - <method name="emit_signal"> + <method name="emit_signal" qualifiers="vararg"> <argument index="0" name="signal" type="String"> </argument> - <argument index="1" name="arg0" type="Variant" default="NULL"> - </argument> - <argument index="2" name="arg1" type="Variant" default="NULL"> - </argument> - <argument index="3" name="arg2" type="Variant" default="NULL"> - </argument> - <argument index="4" name="arg3" type="Variant" default="NULL"> - </argument> - <argument index="5" name="arg4" type="Variant" default="NULL"> - </argument> <description> - Emit a signal. Arguments are passed in an array. </description> </method> <method name="free"> @@ -27280,14 +27821,16 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="motion" type="Vector2"> + <argument index="1" name="from" type="Matrix32"> </argument> - <argument index="2" name="margin" type="float" default="0.08"> + <argument index="2" name="motion" type="Vector2"> </argument> - <argument index="3" name="result" type="Physics2DTestMotionResult" default="NULL"> + <argument index="3" name="margin" type="float" default="0.08"> + </argument> + <argument index="4" name="result" type="Physics2DTestMotionResult" default="NULL"> </argument> <description> - Return whether a body can move in a given direction. Apart from the boolean return value, a [Physics2DTestMotionResult] can be passed to return additional information in. + Return whether a body can move from a given point in a given direction. Apart from the boolean return value, a [Physics2DTestMotionResult] can be passed to return additional information in. </description> </method> <method name="damped_spring_joint_create"> @@ -31301,6 +31844,17 @@ Return the size of the array. </description> </method> + <method name="subarray"> + <return type="RawArray"> + </return> + <argument index="0" name="from" type="int"> + </argument> + <argument index="1" name="to" type="int"> + </argument> + <description> + Returns the slice of the [RawArray] between indices (inclusive) as a new [RawArray]. Any negative index is considered to be from the end of the array. + </description> + </method> </methods> <constants> </constants> @@ -31484,6 +32038,12 @@ Returns the collision point in which the ray intersects the closest object. </description> </method> + <method name="get_exclude_parent_body" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="get_layer_mask" qualifiers="const"> <return type="int"> </return> @@ -31538,6 +32098,12 @@ Enables the RayCast2D. Only enabled raycasts will be able to query the space and report collisions. </description> </method> + <method name="set_exclude_parent_body"> + <argument index="0" name="mask" type="bool"> + </argument> + <description> + </description> + </method> <method name="set_layer_mask"> <argument index="0" name="mask" type="int"> </argument> @@ -31989,6 +32555,28 @@ <constants> </constants> </class> +<class name="RemoteTransform" inherits="Spatial" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="get_remote_node" qualifiers="const"> + <return type="NodePath"> + </return> + <description> + </description> + </method> + <method name="set_remote_node"> + <argument index="0" name="path" type="NodePath"> + </argument> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="RemoteTransform2D" inherits="Node2D" category="Core"> <brief_description> </brief_description> @@ -34548,23 +35136,13 @@ <description> </description> <methods> - <method name="call_group"> + <method name="call_group" qualifiers="vararg"> <argument index="0" name="flags" type="int"> </argument> <argument index="1" name="group" type="String"> </argument> <argument index="2" name="method" type="String"> </argument> - <argument index="3" name="arg0" type="Variant" default="NULL"> - </argument> - <argument index="4" name="arg1" type="Variant" default="NULL"> - </argument> - <argument index="5" name="arg2" type="Variant" default="NULL"> - </argument> - <argument index="6" name="arg3" type="Variant" default="NULL"> - </argument> - <argument index="7" name="arg4" type="Variant" default="NULL"> - </argument> <description> </description> </method> @@ -34988,7 +35566,7 @@ A helper node for displaying scrollable elements (e.g. lists). </brief_description> <description> - A ScrollContainer node with a [Control] child and scrollbar child ([HScrollbar], [VScrollBar], or both) will only draw the Control within the ScrollContainer area. Scrollbars will automatically be drawn at the right (for vertical) or bottom (for horizontal) and will enable dragging to move the viewable Control (and its children) within the ScrollContainer. Scrollbars will also automatically resize the grabber based on the minimum_size of the Control relative to the ScrollContainer. Works great with a [Panel] control. + A ScrollContainer node with a [Control] child and scrollbar child ([HScrollbar], [VScrollBar], or both) will only draw the Control within the ScrollContainer area. Scrollbars will automatically be drawn at the right (for vertical) or bottom (for horizontal) and will enable dragging to move the viewable Control (and its children) within the ScrollContainer. Scrollbars will also automatically resize the grabber based on the minimum_size of the Control relative to the ScrollContainer. Works great with a [Panel] control. You can set EXPAND on children size flags, so they will upscale to ScrollContainer size if ScrollContainer size is bigger (scroll is invisible for chosen dimension). </description> <methods> <method name="get_h_scroll" qualifiers="const"> @@ -40527,6 +41105,16 @@ <description> </description> </signal> + <signal name="symbol_lookup"> + <argument index="0" name="symbol" type="String"> + </argument> + <argument index="1" name="row" type="int"> + </argument> + <argument index="2" name="column" type="int"> + </argument> + <description> + </description> + </signal> <signal name="text_changed"> <description> Emitted when the text changes. @@ -42537,18 +43125,33 @@ </class> <class name="Tree" inherits="Control" category="Core"> <brief_description> + Control to show a tree of items. </brief_description> <description> + This shows a tree of items that can be selected, expanded and collapsed. The tree can have multiple columns with custom controls like text editing, buttons and popups. It can be useful for structural displaying and interactions. + Trees are built via code, using [TreeItem] objects to create the structure. They have a single root but multiple root can be simulated if a dummy hidden root is added. + [codeblock] + func _ready(): + var tree = Tree.new() + var root = tree.create_item() + tree.set_hide_root(true) + var child1 = tree.create_item(root) + var child2 = tree.create_item(root) + var subchild1 = tree.create_item(child1) + subchild1.set_text(0, "Subchild1") + [/codeblock] </description> <methods> <method name="are_column_titles_visible" qualifiers="const"> <return type="bool"> </return> <description> + Get whether the column titles are being shown. </description> </method> <method name="clear"> <description> + Clear the tree. This erases all of the items. </description> </method> <method name="create_item"> @@ -42557,16 +43160,19 @@ <argument index="0" name="parent" type="TreeItem" default="NULL"> </argument> <description> + Create an item in the tree and add it as the last child of [code]parent[/code]. If parent is not given, it will be added as the last child of the root, or it'll the be the root itself if the tree is empty. </description> </method> <method name="ensure_cursor_is_visible"> <description> + Make the current selected item visible. This will scroll the tree to make sure the selected item is in sight. </description> </method> <method name="get_allow_rmb_select" qualifiers="const"> <return type="bool"> </return> <description> + Get whether a right click can select items. </description> </method> <method name="get_column_at_pos" qualifiers="const"> @@ -42575,6 +43181,7 @@ <argument index="0" name="pos" type="Vector2"> </argument> <description> + Get the column index under the given point. </description> </method> <method name="get_column_title" qualifiers="const"> @@ -42583,6 +43190,7 @@ <argument index="0" name="column" type="int"> </argument> <description> + Get the title of the given column. </description> </method> <method name="get_column_width" qualifiers="const"> @@ -42591,36 +43199,42 @@ <argument index="0" name="column" type="int"> </argument> <description> + Get the width of the given column in pixels. </description> </method> <method name="get_columns" qualifiers="const"> <return type="int"> </return> <description> + Get the amount of columns. </description> </method> <method name="get_custom_popup_rect" qualifiers="const"> <return type="Rect2"> </return> <description> + Get the rectangle for custom popups. Helper to create custom cell controls that display a popup. See [method TreeItem.set_cell_mode]. </description> </method> <method name="get_drop_mode_flags" qualifiers="const"> <return type="int"> </return> <description> + Get the flags of the current drop mode. </description> </method> <method name="get_edited" qualifiers="const"> <return type="TreeItem"> </return> <description> + Get the current edited item. This is only available for custom cell mode. </description> </method> <method name="get_edited_column" qualifiers="const"> <return type="int"> </return> <description> + Get the column of the cell for the current edited icon. This is only available for custom cell mode. </description> </method> <method name="get_item_area_rect" qualifiers="const"> @@ -42631,6 +43245,7 @@ <argument index="1" name="column" type="int" default="-1"> </argument> <description> + Get the rectangle area of the the specified item. If column is specified, only get the position and size of that column, otherwise get the rectangle containing all columns. </description> </method> <method name="get_item_at_pos" qualifiers="const"> @@ -42639,6 +43254,7 @@ <argument index="0" name="pos" type="Vector2"> </argument> <description> + Get the tree item at the specified position (relative to the tree origin position). </description> </method> <method name="get_next_selected"> @@ -42647,42 +43263,49 @@ <argument index="0" name="from" type="TreeItem"> </argument> <description> + Get the next selected item after the given one. </description> </method> <method name="get_pressed_button" qualifiers="const"> <return type="int"> </return> <description> + Get the index of the last pressed button. </description> </method> <method name="get_root"> <return type="TreeItem"> </return> <description> + Get the root item of the tree. </description> </method> <method name="get_scroll" qualifiers="const"> <return type="Vector2"> </return> <description> + Get the current scrolling position. </description> </method> <method name="get_selected" qualifiers="const"> <return type="TreeItem"> </return> <description> + Get the currently selected item. </description> </method> <method name="get_selected_column" qualifiers="const"> <return type="int"> </return> <description> + Get the column number of the current selection. </description> </method> <method name="get_single_select_cell_editing_only_when_already_selected" qualifiers="const"> <return type="bool"> </return> <description> + Get whether the editing of a cell should only happen when it is already selected. </description> </method> <method name="is_delayed_text_editor_enabled" qualifiers="const"> @@ -42695,12 +43318,14 @@ <return type="bool"> </return> <description> + Get whether the folding arrow is hidden. </description> </method> <method name="set_allow_rmb_select"> <argument index="0" name="allow" type="bool"> </argument> <description> + Set whether or not a right mouse button click can select items. </description> </method> <method name="set_column_expand"> @@ -42709,6 +43334,7 @@ <argument index="1" name="expand" type="bool"> </argument> <description> + Set whether a column will have the "Expand" flag of [Control]. </description> </method> <method name="set_column_min_width"> @@ -42717,6 +43343,7 @@ <argument index="1" name="min_width" type="int"> </argument> <description> + Set the minimum width of a column. </description> </method> <method name="set_column_title"> @@ -42725,18 +43352,21 @@ <argument index="1" name="title" type="String"> </argument> <description> + Set the title of a column. </description> </method> <method name="set_column_titles_visible"> <argument index="0" name="visible" type="bool"> </argument> <description> + Set whether the column titles visibility. </description> </method> <method name="set_columns"> <argument index="0" name="amount" type="int"> </argument> <description> + Set the amount of columns. </description> </method> <method name="set_delayed_text_editor"> @@ -42749,30 +43379,35 @@ <argument index="0" name="flags" type="int"> </argument> <description> + Set the drop mode as an OR combination of flags. See [code]DROP_MODE_*[/code] constants. </description> </method> <method name="set_hide_folding"> <argument index="0" name="hide" type="bool"> </argument> <description> + Set whether the folding arrow should be hidden. </description> </method> <method name="set_hide_root"> <argument index="0" name="enable" type="bool"> </argument> <description> + Set whether the root of the tree should be hidden. </description> </method> <method name="set_select_mode"> <argument index="0" name="mode" type="int"> </argument> <description> + Set the selection mode. Use one of the [code]SELECT_*[/code] constants. </description> </method> <method name="set_single_select_cell_editing_only_when_already_selected"> <argument index="0" name="enable" type="bool"> </argument> <description> + Set whether the editing of a cell should only happen when it is already selected. </description> </method> </methods> @@ -42785,32 +43420,38 @@ <argument index="2" name="id" type="int"> </argument> <description> + Emitted when a button on the tree was pressed (see [method TreeItem.add_button]). </description> </signal> <signal name="cell_selected"> <description> + Emitted when a cell is selected. </description> </signal> <signal name="custom_popup_edited"> <argument index="0" name="arrow_clicked" type="bool"> </argument> <description> + Emitted when a cell with the [code]CELL_MODE_CUSTOM[/code] is clicked to be edited. </description> </signal> <signal name="empty_tree_rmb_selected"> <argument index="0" name="pos" type="Vector2"> </argument> <description> + Emitted when the right mouse button is pressed if RMB selection is active and the tree is empty. </description> </signal> <signal name="item_activated"> <description> + Emitted when an item is activated (double-clicked). </description> </signal> <signal name="item_collapsed"> <argument index="0" name="item" type="Object"> </argument> <description> + Emitted when an item is collapsed by a click on the folding arrow. </description> </signal> <signal name="item_double_clicked"> @@ -42819,16 +43460,19 @@ </signal> <signal name="item_edited"> <description> + Emitted when an item is editted. </description> </signal> <signal name="item_rmb_selected"> <argument index="0" name="pos" type="Vector2"> </argument> <description> + Emitted when an item is selected with right mouse button. </description> </signal> <signal name="item_selected"> <description> + Emitted when an item is selected with right mouse button. </description> </signal> <signal name="multi_selected"> @@ -43800,24 +44444,12 @@ Common behavior is to create an action, then add do/undo calls to functions or property changes, then commiting the action. </description> <methods> - <method name="add_do_method"> + <method name="add_do_method" qualifiers="vararg"> <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="method" type="String"> </argument> - <argument index="2" name="arg0" type="Variant" default="NULL"> - </argument> - <argument index="3" name="arg1" type="Variant" default="NULL"> - </argument> - <argument index="4" name="arg2" type="Variant" default="NULL"> - </argument> - <argument index="5" name="arg3" type="Variant" default="NULL"> - </argument> - <argument index="6" name="arg4" type="Variant" default="NULL"> - </argument> <description> - Add a call to a method in a given object with custom - arguments. </description> </method> <method name="add_do_property"> @@ -43838,23 +44470,12 @@ Add a 'do' reference that will be erased if the 'do' history is lost. This is useful mostly for new nodes created for the 'do' call. Do not use for resources. </description> </method> - <method name="add_undo_method"> + <method name="add_undo_method" qualifiers="vararg"> <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="method" type="String"> </argument> - <argument index="2" name="arg0" type="Variant" default="NULL"> - </argument> - <argument index="3" name="arg1" type="Variant" default="NULL"> - </argument> - <argument index="4" name="arg2" type="Variant" default="NULL"> - </argument> - <argument index="5" name="arg3" type="Variant" default="NULL"> - </argument> - <argument index="6" name="arg4" type="Variant" default="NULL"> - </argument> <description> - Add a call to an undo method in a given object with custom arguments. Undo calls are used to revert 'do' calls. </description> </method> <method name="add_undo_property"> @@ -44125,6 +44746,14 @@ do_property]. Returns the angle in radians between the line connecting the two points and the x coordinate. </description> </method> + <method name="clamped"> + <return type="Vector2"> + </return> + <argument index="0" name="length" type="float"> + </argument> + <description> + </description> + </method> <method name="cubic_interpolate"> <return type="Vector2"> </return> @@ -44878,136 +45507,160 @@ do_property]. </class> <class name="VideoPlayer" inherits="Control" category="Core"> <brief_description> + Control to play video files. </brief_description> <description> + This control has the ability to play video streams. The only format accepted is the OGV Theora, so any other format must be converted before using in a project. </description> <methods> <method name="get_audio_track" qualifiers="const"> <return type="int"> </return> <description> + Get the selected audio track (for multitrack videos). </description> </method> <method name="get_buffering_msec" qualifiers="const"> <return type="int"> </return> <description> + Get the amount of miliseconds to store in buffer while playing. </description> </method> <method name="get_stream" qualifiers="const"> <return type="VideoStream"> </return> <description> + Get the video stream. </description> </method> <method name="get_stream_name" qualifiers="const"> <return type="String"> </return> <description> + Get the name of the video stream. </description> </method> <method name="get_stream_pos" qualifiers="const"> <return type="float"> </return> <description> + Get the current position of the stream, in seconds. </description> </method> <method name="get_video_texture"> <return type="Texture"> </return> <description> + Get the current frame of the video as a [Texture]. </description> </method> <method name="get_volume" qualifiers="const"> <return type="float"> </return> <description> + Get the volume of the audio track as a linear value. </description> </method> <method name="get_volume_db" qualifiers="const"> <return type="float"> </return> <description> + Get the volume of the audio track in decibels. </description> </method> <method name="has_autoplay" qualifiers="const"> <return type="bool"> </return> <description> + Get whether or not the video is set as autoplay. </description> </method> <method name="has_expand" qualifiers="const"> <return type="bool"> </return> <description> + Get whether or not the expand property is set. </description> </method> <method name="is_paused" qualifiers="const"> <return type="bool"> </return> <description> + Get whether or not the video is paused. </description> </method> <method name="is_playing" qualifiers="const"> <return type="bool"> </return> <description> + Get whether or not the video is playing. </description> </method> <method name="play"> <description> + Start the video playback. </description> </method> <method name="set_audio_track"> <argument index="0" name="track" type="int"> </argument> <description> + Set the audio track (for multitrack videos). </description> </method> <method name="set_autoplay"> <argument index="0" name="enabled" type="bool"> </argument> <description> + Set whether this node should start playing automatically. </description> </method> <method name="set_buffering_msec"> <argument index="0" name="msec" type="int"> </argument> <description> + Set the amount of miliseconds to buffer during playback. </description> </method> <method name="set_expand"> <argument index="0" name="enable" type="bool"> </argument> <description> + Set the expand property. If enabled, the video will grow or shrink to fit the player size, otherwise it will play at the stream resolution. </description> </method> <method name="set_paused"> <argument index="0" name="paused" type="bool"> </argument> <description> + Set whether the video should pause the playback. </description> </method> <method name="set_stream"> <argument index="0" name="stream" type="VideoStream"> </argument> <description> + Set the video stream for this player. </description> </method> <method name="set_volume"> <argument index="0" name="volume" type="float"> </argument> <description> + Set the audio volume as a linear value. </description> </method> <method name="set_volume_db"> <argument index="0" name="db" type="float"> </argument> <description> + Set the audio volume in decibels. </description> </method> <method name="stop"> <description> + Stop the video playback. </description> </method> </methods> @@ -45187,6 +45840,12 @@ do_property]. Return the 3D world of the viewport. </description> </method> + <method name="get_world_2d" qualifiers="const"> + <return type="World2D"> + </return> + <description> + </description> + </method> <method name="gui_get_drag_data" qualifiers="const"> <return type="Variant"> </return> @@ -45410,6 +46069,12 @@ do_property]. Change the 3D world of the viewport. </description> </method> + <method name="set_world_2d"> + <argument index="0" name="world_2d" type="World2D"> + </argument> + <description> + </description> + </method> <method name="unhandled_input"> <argument index="0" name="local_event" type="InputEvent"> </argument> @@ -45730,12 +46395,24 @@ do_property]. <description> </description> <methods> + <method name="get_aabb" qualifiers="const"> + <return type="AABB"> + </return> + <description> + </description> + </method> <method name="get_layer_mask" qualifiers="const"> <return type="int"> </return> <description> </description> </method> + <method name="get_transformed_aabb" qualifiers="const"> + <return type="AABB"> + </return> + <description> + </description> + </method> <method name="set_base"> <argument index="0" name="base" type="RID"> </argument> @@ -46156,6 +46833,40 @@ do_property]. <constants> </constants> </class> +<class name="VisualScriptBasicTypeConstant" inherits="VisualScriptNode" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="get_basic_type" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_basic_type_constant" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_basic_type"> + <argument index="0" name="name" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_basic_type_constant"> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="VisualScriptBuiltinFunc" inherits="VisualScriptNode" category="Core"> <brief_description> </brief_description> @@ -46178,6 +46889,40 @@ do_property]. <constants> </constants> </class> +<class name="VisualScriptClassConstant" inherits="VisualScriptNode" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="get_base_type"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_class_constant"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_base_type"> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_class_constant"> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="VisualScriptComment" inherits="VisualScriptNode" category="Core"> <brief_description> </brief_description> @@ -46506,6 +47251,16 @@ do_property]. <constants> </constants> </class> +<class name="VisualScriptExpression" inherits="VisualScriptNode" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + </methods> + <constants> + </constants> +</class> <class name="VisualScriptFunction" inherits="VisualScriptNode" category="Core"> <brief_description> </brief_description> @@ -46576,6 +47331,12 @@ do_property]. <description> </description> </method> + <method name="get_validate" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="set_base_path"> <argument index="0" name="base_path" type="NodePath"> </argument> @@ -46630,6 +47391,12 @@ do_property]. <description> </description> </method> + <method name="set_validate"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> </methods> <constants> <constant name="CALL_MODE_SELF" value="0"> @@ -46724,12 +47491,24 @@ do_property]. <description> </description> <methods> + <method name="get_action_mode" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> <method name="get_action_name" qualifiers="const"> <return type="String"> </return> <description> </description> </method> + <method name="set_action_mode"> + <argument index="0" name="mode" type="int"> + </argument> + <description> + </description> + </method> <method name="set_action_name"> <argument index="0" name="name" type="String"> </argument> @@ -46750,16 +47529,6 @@ do_property]. <constants> </constants> </class> -<class name="VisualScriptInputSelector" inherits="VisualScriptNode" category="Core"> - <brief_description> - </brief_description> - <description> - </description> - <methods> - </methods> - <constants> - </constants> -</class> <class name="VisualScriptIterator" inherits="VisualScriptNode" category="Core"> <brief_description> </brief_description> @@ -47290,6 +48059,16 @@ do_property]. <constants> </constants> </class> +<class name="VisualScriptSwitch" inherits="VisualScriptNode" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + </methods> + <constants> + </constants> +</class> <class name="VisualScriptTypeCast" inherits="VisualScriptNode" category="Core"> <brief_description> </brief_description> @@ -49305,14 +50084,17 @@ do_property]. </class> <class name="XMLParser" inherits="Reference" category="Core"> <brief_description> + Low-level class for creating parsers for XML files. </brief_description> <description> + This class can serve as base to make custom XML parsers. Since XML is a very flexible standard, this interface is low level so it can be applied to any possible schema. </description> <methods> <method name="get_attribute_count" qualifiers="const"> <return type="int"> </return> <description> + Get the amount of attributes in the current element. </description> </method> <method name="get_attribute_name" qualifiers="const"> @@ -49321,6 +50103,7 @@ do_property]. <argument index="0" name="idx" type="int"> </argument> <description> + Get the name of the attribute specified by the index in [code]idx[/code] argument. </description> </method> <method name="get_attribute_value" qualifiers="const"> @@ -49329,12 +50112,14 @@ do_property]. <argument index="0" name="idx" type="int"> </argument> <description> + Get the value of the attribute specified by the index in [code]idx[/code] argument. </description> </method> <method name="get_current_line" qualifiers="const"> <return type="int"> </return> <description> + Get the current line in the parsed file (currently not implemented). </description> </method> <method name="get_named_attribute_value" qualifiers="const"> @@ -49343,6 +50128,7 @@ do_property]. <argument index="0" name="name" type="String"> </argument> <description> + Get the value of a certain attribute of the current element by name. This will raise an error if the element has no such attribute. </description> </method> <method name="get_named_attribute_value_safe" qualifiers="const"> @@ -49351,30 +50137,35 @@ do_property]. <argument index="0" name="name" type="String"> </argument> <description> + Get the value of a certain attribute of the current element by name. This will return an empty [String] if the attribute is not found. </description> </method> <method name="get_node_data" qualifiers="const"> <return type="String"> </return> <description> + Get the contents of a text node. This will raise an error in any other type of node. </description> </method> <method name="get_node_name" qualifiers="const"> <return type="String"> </return> <description> + Get the name of the current element node. This will raise an error if the current node type is not [code]NODE_ELEMENT[/code] nor [code]NODE_ELEMENT_END[/code] </description> </method> <method name="get_node_offset" qualifiers="const"> <return type="int"> </return> <description> + Get the byte offset of the current node since the beginning of the file or buffer. </description> </method> <method name="get_node_type"> <return type="int"> </return> <description> + Get the type of the current node. Compare with [code]NODE_*[/code] constants. </description> </method> <method name="has_attribute" qualifiers="const"> @@ -49383,12 +50174,14 @@ do_property]. <argument index="0" name="name" type="String"> </argument> <description> + Check whether or not the current element has a certain attribute. </description> </method> <method name="is_empty" qualifiers="const"> <return type="bool"> </return> <description> + Check whether the current element is empty (this only works for completely empty tags, e.g. <element \>). </description> </method> <method name="open"> @@ -49397,6 +50190,7 @@ do_property]. <argument index="0" name="file" type="String"> </argument> <description> + Open a XML file for parsing. This returns an error code. </description> </method> <method name="open_buffer"> @@ -49405,12 +50199,14 @@ do_property]. <argument index="0" name="buffer" type="RawArray"> </argument> <description> + Open a XML raw buffer for parsing. This returns an error code. </description> </method> <method name="read"> <return type="int"> </return> <description> + Read the next node of the file. This returns an error code. </description> </method> <method name="seek"> @@ -49419,27 +50215,36 @@ do_property]. <argument index="0" name="pos" type="int"> </argument> <description> + Move the buffer cursor to a certain offset (since the beginning) and read the next node there. This returns an error code. </description> </method> <method name="skip_section"> <description> + Skips the current section. If the node contains other elements, they will be ignored and the cursor will go to the closing of the current element. </description> </method> </methods> <constants> <constant name="NODE_NONE" value="0"> + There's no node (no file or buffer opened) </constant> <constant name="NODE_ELEMENT" value="1"> + Element (tag) </constant> <constant name="NODE_ELEMENT_END" value="2"> + End of element </constant> <constant name="NODE_TEXT" value="3"> + Text node </constant> <constant name="NODE_COMMENT" value="4"> + Comment node </constant> <constant name="NODE_CDATA" value="5"> + CDATA content </constant> <constant name="NODE_UNKNOWN" value="6"> + Unknown node </constant> </constants> </class> diff --git a/drivers/SCsub b/drivers/SCsub index 79cbe50685..8243483e17 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -17,6 +17,7 @@ SConscript('gl_context/SCsub'); SConscript('pnm/SCsub'); if (env['openssl']!='no'): + env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']); env_drivers.Append(CPPFLAGS=['-DOPENSSL_ENABLED']); if (env['openssl']=="builtin"): env_drivers.Append(CPPPATH=['#drivers/builtin_openssl2']) diff --git a/drivers/builtin_openssl2/SCsub b/drivers/builtin_openssl2/SCsub index bd0f428cfc..a28bc2922c 100644 --- a/drivers/builtin_openssl2/SCsub +++ b/drivers/builtin_openssl2/SCsub @@ -642,6 +642,7 @@ openssl_sources = [ #env.drivers_sources+=openssl_sources +env.Append(CPPPATH=["#drivers/builtin_openssl2"]) env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto"]) env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/openssl"]) env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/evp"]) @@ -650,6 +651,9 @@ env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/modes"]) #env_ssl.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/store"]) env_drivers.Append(CPPFLAGS=["-DOPENSSL_NO_ASM","-DOPENSSL_THREADS","-DL_ENDIAN"]) +if "platform" in env and env["platform"] == "winrt": + openssl_sources += ['winrt.cpp'] + # Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517) import os if not (os.name=="nt" and os.getenv("VSINSTALLDIR")!=None): # not Windows and not MSVC diff --git a/drivers/builtin_openssl2/crypto/rand/rand_win.c b/drivers/builtin_openssl2/crypto/rand/rand_win.c index 06670ae017..70fd52a7aa 100644 --- a/drivers/builtin_openssl2/crypto/rand/rand_win.c +++ b/drivers/builtin_openssl2/crypto/rand/rand_win.c @@ -118,8 +118,10 @@ # ifndef _WIN32_WINNT # define _WIN32_WINNT 0x0400 # endif +#ifndef WINRT_ENABLED # include <wincrypt.h> # include <tlhelp32.h> +#endif /* * Limit the time spent walking through the heap, processes, threads and @@ -161,7 +163,7 @@ typedef struct tagCURSORINFO { # define CURSOR_SHOWING 0x00000001 # endif /* CURSOR_SHOWING */ -# if !defined(OPENSSL_SYS_WINCE) +# if !defined(OPENSSL_SYS_WINCE) && !defined(WINRT_ENABLED) typedef BOOL(WINAPI *CRYPTACQUIRECONTEXTW) (HCRYPTPROV *, LPCWSTR, LPCWSTR, DWORD, DWORD); typedef BOOL(WINAPI *CRYPTGENRANDOM) (HCRYPTPROV, DWORD, BYTE *); @@ -196,6 +198,7 @@ typedef NET_API_STATUS(NET_API_FUNCTION *NETFREE) (LPBYTE); # endif /* 1 */ # endif /* !OPENSSL_SYS_WINCE */ +#if !defined(WINRT_ENABLED) int RAND_poll(void) { MEMORYSTATUS m; @@ -580,6 +583,8 @@ int RAND_poll(void) return (1); } +#endif // WINRT_ENABLED + int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam) { double add_entropy = 0; @@ -682,7 +687,7 @@ static void readtimer(void) static void readscreen(void) { -# if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN) +# if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN) && !defined(WINRT_ENABLED) HDC hScrDC; /* screen DC */ HBITMAP hBitmap; /* handle for our bitmap */ BITMAP bm; /* bitmap properties */ diff --git a/drivers/builtin_openssl2/openssl/dtls1.h b/drivers/builtin_openssl2/openssl/dtls1.h index 64ad3c87d0..a58aca248d 100644 --- a/drivers/builtin_openssl2/openssl/dtls1.h +++ b/drivers/builtin_openssl2/openssl/dtls1.h @@ -81,6 +81,9 @@ # include <sys/time.h> # endif # endif +#ifdef WINRT_ENABLED +#include <winsock2.h> +#endif #ifdef __cplusplus extern "C" { diff --git a/drivers/builtin_openssl2/winrt.cpp b/drivers/builtin_openssl2/winrt.cpp new file mode 100644 index 0000000000..c3a6f8bfcc --- /dev/null +++ b/drivers/builtin_openssl2/winrt.cpp @@ -0,0 +1,155 @@ +/* Snippets extracted from https://github.com/Microsoft/openssl/blob/ec7e430e06e4e3ac87c183dee33cb216814cf980/ms/winrt.cpp + * Adapted for Godot definitions + */ +/* winrt.cpp + * Copyright 2014 Microsoft Corporation + * C++/CX Entropy/shims for Windows Phone/Windows Store platform + * written by Alejandro Jimenez Martinez + * (aljim@microsoft.com) for the OpenSSL project 2014. + */ + +#include <windows.h> +#if defined(WINAPI_FAMILY) +extern "C" +{ + unsigned entropyRT(BYTE *buffer, unsigned len); + void RAND_add(const void *buf,int num,double entropy); + int RAND_poll(void); +} +#endif + +unsigned entropyRT(BYTE *buffer, unsigned len) + { + using namespace Platform; + using namespace Windows::Foundation; + using namespace Windows::Foundation::Collections; + using namespace Windows::Security::Cryptography; + using namespace Windows::Storage::Streams; + IBuffer ^buf = CryptographicBuffer::GenerateRandom(len); + Array<unsigned char> ^arr; + CryptographicBuffer::CopyToByteArray(buf, &arr); + unsigned arrayLen = arr->Length; + + // Make sure not to overflow the copy + arrayLen = (arrayLen > len) ? len : arrayLen; + memcpy(buffer, arr->Data, arrayLen); + return arrayLen; + } + +int RAND_poll(void) + { + BYTE buf[60]; + unsigned collected = entropyRT(buf , sizeof(buf)); + RAND_add(buf, collected, collected); + return 1; + } + +#if defined(WINRT_ENABLED) +extern "C" +{ +#include<stdio.h> +#include<string.h> +#include<stdlib.h> + + void* GetModuleHandle( + _In_opt_ LPCTSTR lpModuleName + ) + { + return NULL; + } + //no log for phone + int RegisterEventSource( + _In_ LPCTSTR lpUNCServerName, + _In_ LPCTSTR lpSourceName + ) + { + return NULL; + } + + int ReportEvent( + _In_ HANDLE hEventLog, + _In_ WORD wType, + _In_ WORD wCategory, + _In_ DWORD dwEventID, + _In_ PSID lpUserSid, + _In_ WORD wNumStrings, + _In_ DWORD dwDataSize, + _In_ LPCTSTR *lpStrings, + _In_ LPVOID lpRawData + ) + { + return 0; + } + int MessageBox( + _In_opt_ HWND hWnd, + _In_opt_ LPCTSTR lpText, + _In_opt_ LPCTSTR lpCaption, + _In_ UINT uType + ) + { + return 0; + } + int __cdecl GetProcessWindowStation(void) + { + return NULL; + } + BOOL __cdecl GetUserObjectInformationW( + _In_ HANDLE hObj, + _In_ int nIndex, + _Out_opt_ PVOID pvInfo, + _In_ DWORD nLength, + _Out_opt_ LPDWORD lpnLengthNeeded + ) + { + return 0; + } + int __cdecl GetStdHandle( + _In_ DWORD nStdHandle + ) + { + return 0; + } + BOOL DeregisterEventSource( + _Inout_ HANDLE hEventLog + ) + { + return 0; + } + char *getenv( + const char *varname + ) + { + //hardcoded environmental variables used for the appx testing application for store/phone + if (!strcmp(varname, "OPENSSL_CONF")) + { + return "./openssl.cnf"; + } + return 0; + } + int setenv(const char *envname, const char *envval, int overwrite) + { + return -1; + } + int _getch(void) + { + return 0; + } + int _kbhit() + { + return 0; + } + BOOL __cdecl FlushConsoleInputBuffer( + _In_ HANDLE hConsoleInput + ) + { + return 0; + } + int winrt_GetTickCount(void) + { + LARGE_INTEGER t; + return(int) (QueryPerformanceCounter(&t) ? t.QuadPart : 0); + } + void *OPENSSL_UplinkTable [26]= {0}; +} //extern C + +#endif /*defined(WINRT_ENABLED)*/ diff --git a/drivers/builtin_openssl2/winrt_fix.patch b/drivers/builtin_openssl2/winrt_fix.patch new file mode 100644 index 0000000000..caf180a75b --- /dev/null +++ b/drivers/builtin_openssl2/winrt_fix.patch @@ -0,0 +1,64 @@ +diff --git a/drivers/builtin_openssl2/crypto/rand/rand_win.c b/drivers/builtin_openssl2/crypto/rand/rand_win.c +index 06670ae..70fd52a 100644 +--- a/drivers/builtin_openssl2/crypto/rand/rand_win.c ++++ b/drivers/builtin_openssl2/crypto/rand/rand_win.c +@@ -118,8 +118,10 @@ + # ifndef _WIN32_WINNT + # define _WIN32_WINNT 0x0400 + # endif ++#ifndef WINRT_ENABLED + # include <wincrypt.h> + # include <tlhelp32.h> ++#endif + + /* + * Limit the time spent walking through the heap, processes, threads and +@@ -161,7 +163,7 @@ typedef struct tagCURSORINFO { + # define CURSOR_SHOWING 0x00000001 + # endif /* CURSOR_SHOWING */ + +-# if !defined(OPENSSL_SYS_WINCE) ++# if !defined(OPENSSL_SYS_WINCE) && !defined(WINRT_ENABLED) + typedef BOOL(WINAPI *CRYPTACQUIRECONTEXTW) (HCRYPTPROV *, LPCWSTR, LPCWSTR, + DWORD, DWORD); + typedef BOOL(WINAPI *CRYPTGENRANDOM) (HCRYPTPROV, DWORD, BYTE *); +@@ -196,6 +198,7 @@ typedef NET_API_STATUS(NET_API_FUNCTION *NETFREE) (LPBYTE); + # endif /* 1 */ + # endif /* !OPENSSL_SYS_WINCE */ + ++#if !defined(WINRT_ENABLED) + int RAND_poll(void) + { + MEMORYSTATUS m; +@@ -580,6 +583,8 @@ int RAND_poll(void) + return (1); + } + ++#endif // WINRT_ENABLED ++ + int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam) + { + double add_entropy = 0; +@@ -682,7 +687,7 @@ static void readtimer(void) + + static void readscreen(void) + { +-# if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN) ++# if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN) && !defined(WINRT_ENABLED) + HDC hScrDC; /* screen DC */ + HBITMAP hBitmap; /* handle for our bitmap */ + BITMAP bm; /* bitmap properties */ +diff --git a/drivers/builtin_openssl2/openssl/dtls1.h b/drivers/builtin_openssl2/openssl/dtls1.h +index 64ad3c8..a58aca2 100644 +--- a/drivers/builtin_openssl2/openssl/dtls1.h ++++ b/drivers/builtin_openssl2/openssl/dtls1.h +@@ -81,6 +81,9 @@ + # include <sys/time.h> + # endif + # endif ++#ifdef WINRT_ENABLED ++#include <winsock2.h> ++#endif + + #ifdef __cplusplus + extern "C" { diff --git a/drivers/freetype/SCsub b/drivers/freetype/SCsub index 0c7ab91ba2..4ddc785088 100644 --- a/drivers/freetype/SCsub +++ b/drivers/freetype/SCsub @@ -48,6 +48,11 @@ ft_sources=[\ if (env["freetype"]=="builtin"): + + # Include header for WinRT to fix build issues + if "platform" in env and env["platform"] == "winrt": + env.Append(CCFLAGS=['/FI', '"drivers/freetype/winrtdef.h"']) + # fix for Windows' shell miserably failing on long lines, split in two libraries half1=[] half2=[] diff --git a/tools/ios_xcode_template/godot_ios/main.m b/drivers/freetype/winrtdef.h index 3e4ea5e129..69c6baf532 100644 --- a/tools/ios_xcode_template/godot_ios/main.m +++ b/drivers/freetype/winrtdef.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* main.m */ +/* winrtdef.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,13 +27,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#import <UIKit/UIKit.h> - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) -{ - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} +// "generic" is a reserved keyword in C++/CX code +// this avoids the errors in the variable name from Freetype code +#define generic freetype_generic diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 3809f4c7b9..aeb3d9e039 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -1998,7 +1998,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, if (use_VBO) { elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLushort); - elem_count=VS::ARRAY_WEIGHTS_SIZE; valid_local=false; bind=true; normalize=true; @@ -2007,7 +2006,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, } else { elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLfloat); - elem_count=VS::ARRAY_WEIGHTS_SIZE; valid_local=false; bind=false; datatype=GL_FLOAT; @@ -2019,7 +2017,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, if (use_VBO) { elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLubyte); - elem_count=VS::ARRAY_WEIGHTS_SIZE; valid_local=false; bind=true; datatype=GL_UNSIGNED_BYTE; @@ -2027,7 +2024,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, } else { elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLushort); - elem_count=VS::ARRAY_WEIGHTS_SIZE; valid_local=false; bind=false; datatype=GL_UNSIGNED_SHORT; @@ -4666,7 +4662,7 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const { enablers.push_back("#define USE_LIGHT_SHADER_CODE\n"); } if (light_flags.uses_shadow_color) { - enablers.push_back("#define USE_LIGHT_SHADOW_COLOR\n"); + enablers.push_back("#define USE_OUTPUT_SHADOW_COLOR\n"); } if (light_flags.uses_time || fragment_flags.uses_time || vertex_flags.uses_time) { enablers.push_back("#define USE_TIME\n"); @@ -4709,7 +4705,7 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const { enablers.push_back("#define USE_TEXPIXEL_SIZE\n"); } if (light_flags.uses_shadow_color) { - enablers.push_back("#define USE_LIGHT_SHADOW_COLOR\n"); + enablers.push_back("#define USE_OUTPUT_SHADOW_COLOR\n"); } if (vertex_flags.uses_worldvec) { @@ -5210,7 +5206,6 @@ bool RasterizerGLES2::_setup_material(const Geometry *p_geometry,const Material material_shader.set_conditional(MaterialShaderGLES2::USE_FOG,current_env && current_env->fx_enabled[VS::ENV_FX_FOG]); //glDepthMask( true ); - } @@ -6778,7 +6773,7 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans } } - if (e->instance->billboard || e->instance->depth_scale) { + if (e->instance->billboard || e->instance->billboard_y || e->instance->depth_scale) { Transform xf=e->instance->transform; if (e->instance->depth_scale) { @@ -6809,6 +6804,21 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans xf.basis.scale(scale); } + + if (e->instance->billboard_y) { + + Vector3 scale = xf.basis.get_scale(); + Vector3 look_at = p_view_transform.get_origin(); + look_at.y = 0.0; + Vector3 look_at_norm = look_at.normalized(); + + if (current_rt && current_rt_vflip) { + xf.set_look_at(xf.origin,xf.origin + look_at_norm, Vector3(0.0, -1.0, 0.0)); + } else { + xf.set_look_at(xf.origin,xf.origin + look_at_norm, Vector3(0.0, 1.0, 0.0)); + } + xf.basis.scale(scale); + } material_shader.set_uniform(MaterialShaderGLES2::WORLD_TRANSFORM, xf); } else { @@ -7008,6 +7018,10 @@ void RasterizerGLES2::_process_glow_bloom() { void RasterizerGLES2::_process_hdr() { + if (framebuffer.luminance.empty()) { + return; + } + glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.luminance[0].fbo); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, framebuffer.color ); @@ -10843,6 +10857,11 @@ void RasterizerGLES2::init() { copy_shader.set_conditional(CopyShaderGLES2::USE_GLES_OVER_GL,true); #endif +#ifdef ANGLE_ENABLED + // Fix for ANGLE + material_shader.set_conditional(MaterialShaderGLES2::DISABLE_FRONT_FACING, true); +#endif + shadow=NULL; shadow_pass=0; @@ -10930,7 +10949,11 @@ void RasterizerGLES2::init() { srgb_supported=extensions.has("GL_EXT_sRGB"); +#ifndef ANGLE_ENABLED s3tc_srgb_supported = s3tc_supported && extensions.has("GL_EXT_texture_compression_s3tc"); +#else + s3tc_srgb_supported = s3tc_supported; +#endif latc_supported = extensions.has("GL_EXT_texture_compression_latc"); anisotropic_level=1.0; use_anisotropic_filter=extensions.has("GL_EXT_texture_filter_anisotropic"); diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index 3be0fdab17..d4636ed444 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -904,6 +904,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() { mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_VEC"]="light_vec"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_HEIGHT"]="light_height"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_COLOR"]="light"; + mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_SHADOW"]="light_shadow_color"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_UV"]="light_uv"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT"]="light_out"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["SHADOW"]="shadow_color"; diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index 285abd30ff..5f4767940d 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -244,7 +244,7 @@ FRAGMENT_SHADER_CODE vec2 light_uv = light_uv_interp.xy; vec4 light = texture2D(light_texture,light_uv) * light_color; -#if defined(USE_LIGHT_SHADOW_COLOR) +#if defined(USE_OUTPUT_SHADOW_COLOR) vec4 shadow_color=vec4(0.0,0.0,0.0,0.0); #endif @@ -380,7 +380,7 @@ LIGHT_SHADER_CODE #endif -#if defined(USE_LIGHT_SHADOW_COLOR) +#if defined(USE_OUTPUT_SHADOW_COLOR) color=mix(shadow_color,color,shadow_attenuation); #else //color*=shadow_attenuation; diff --git a/drivers/gles2/shaders/material.glsl b/drivers/gles2/shaders/material.glsl index e68949b056..477a451f2f 100644 --- a/drivers/gles2/shaders/material.glsl +++ b/drivers/gles2/shaders/material.glsl @@ -811,7 +811,11 @@ void main() { float specular_exp=1.0; float glow=0.0; float shade_param=0.0; +#ifdef DISABLE_FRONT_FACING + float side=float(1)*2.0-1.0; +#else float side=float(gl_FrontFacing)*2.0-1.0; +#endif #if defined(ENABLE_TANGENT_INTERP) vec3 binormal = normalize(binormal_interp)*side; vec3 tangent = normalize(tangent_interp)*side; @@ -1181,7 +1185,7 @@ FRAGMENT_SHADER_CODE vec3 mdiffuse = diffuse.rgb; vec3 light; -#if defined(USE_LIGHT_SHADOW_COLOR) +#if defined(USE_OUTPUT_SHADOW_COLOR) vec3 shadow_color=vec3(0.0,0.0,0.0); #endif @@ -1205,7 +1209,7 @@ LIGHT_SHADER_CODE #endif diffuse.rgb = const_light_mult * ambient_light *diffuse.rgb + light * attenuation * shadow_attenuation; -#if defined(USE_LIGHT_SHADOW_COLOR) +#if defined(USE_OUTPUT_SHADOW_COLOR) diffuse.rgb += light * shadow_color * attenuation * (1.0 - shadow_attenuation); #endif diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index e10ac7493f..4967b0f9df 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -270,7 +270,7 @@ static void user_read_data(png_structp png_ptr,png_bytep data, png_size_t p_leng PNGReadStatus *rstatus; rstatus=(PNGReadStatus*)png_get_io_ptr(png_ptr); - int to_read=p_length; + png_size_t to_read=p_length; if (rstatus->size>=0) { to_read = MIN( p_length, rstatus->size - rstatus->offset); } diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 4804bc5630..954d2c20f2 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -175,8 +175,8 @@ void AudioDriverPulseAudio::finish() { exit_thread = true; Thread::wait_to_finish(thread); - if (pulse) - pa_simple_free(pulse); + if (pulse) + pa_simple_free(pulse); if (samples_in) { memdelete_arr(samples_in); diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp index 535a425302..08a8c19583 100644 --- a/drivers/unix/ip_unix.cpp +++ b/drivers/unix/ip_unix.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "ip_unix.h" -#if defined(UNIX_ENABLED) || defined(WINDOWS_ENABLED) && !defined(WINRT_ENABLED) +#if defined(UNIX_ENABLED) || defined(WINDOWS_ENABLED) #ifdef WINDOWS_ENABLED @@ -83,6 +83,19 @@ IP_Address IP_Unix::_resolve_hostname(const String& p_hostname) { void IP_Unix::get_local_addresses(List<IP_Address> *r_addresses) const { + using namespace Windows::Networking; + using namespace Windows::Networking::Connectivity; + + auto hostnames = NetworkInformation::GetHostNames(); + + for (int i = 0; i < hostnames->Size; i++) { + + if (hostnames->GetAt(i)->Type == HostNameType::Ipv4 && hostnames->GetAt(i)->IPInformation != nullptr) { + + r_addresses->push_back(IP_Address(String(hostnames->GetAt(i)->CanonicalName->Data()))); + + } + } }; #else diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index fd515d6dd3..271cf302ef 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -390,7 +390,7 @@ Error OS_Unix::execute(const String& p_path, const List<String>& p_arguments,boo if (p_blocking) { int status; - pid_t rpid = waitpid(pid,&status,0); + waitpid(pid,&status,0); if (r_exitcode) *r_exitcode=WEXITSTATUS(status); } else { diff --git a/drivers/vorbis/SCsub b/drivers/vorbis/SCsub index 87805cc2d8..4afafcc4ba 100644 --- a/drivers/vorbis/SCsub +++ b/drivers/vorbis/SCsub @@ -5,7 +5,7 @@ sources = [ ] sources_lib = [ - "vorbis/analysis.c", + #"vorbis/analysis.c", #"vorbis/barkmel.c", "vorbis/bitrate.c", "vorbis/block.c", @@ -27,7 +27,7 @@ sources_lib = [ "vorbis/smallft.c", "vorbis/synthesis.c", #"vorbis/tone.c", - "vorbis/vorbisenc.c", + #"vorbis/vorbisenc.c", "vorbis/vorbisfile.c", "vorbis/window.c", ] diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index 90e43d2518..ad4e8f301c 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -37,12 +37,6 @@ #include <stdio.h> #include "print_string.h" -#ifdef WINRT_ENABLED -#include <Synchapi.h> -#include <collection.h> -#include <ppltasks.h> -#endif - /* [03:57] <reduz> yessopie, so i dont havemak to rely on unicows @@ -135,14 +129,6 @@ Error DirAccessWindows::change_dir(String p_dir) { GLOBAL_LOCK_FUNCTION -#ifdef WINRT_ENABLED - - p_dir = fix_path(p_dir); - current_dir = normalize_path(p_dir); - - return OK; -#else - p_dir=fix_path(p_dir); @@ -178,19 +164,12 @@ Error DirAccessWindows::change_dir(String p_dir) { //} return worked?OK:ERR_INVALID_PARAMETER; -#endif } Error DirAccessWindows::make_dir(String p_dir) { GLOBAL_LOCK_FUNCTION -#ifdef WINRT_ENABLED - - return ERR_CANT_CREATE; - -#else - if (p_dir.is_rel_path()) p_dir=get_current_dir().plus_file(p_dir); @@ -215,8 +194,6 @@ Error DirAccessWindows::make_dir(String p_dir) { }; return ERR_CANT_CREATE; - -#endif } @@ -259,7 +236,6 @@ bool DirAccessWindows::file_exists(String p_file) { return false; return !(fileAttr&FILE_ATTRIBUTE_DIRECTORY); - } bool DirAccessWindows::dir_exists(String p_dir) { @@ -282,7 +258,6 @@ bool DirAccessWindows::dir_exists(String p_dir) { if (INVALID_FILE_ATTRIBUTES == fileAttr) return false; return (fileAttr&FILE_ATTRIBUTE_DIRECTORY); - } Error DirAccessWindows::rename(String p_path,String p_new_path) { diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index 3f27068fb2..36dcab1d67 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -124,7 +124,16 @@ void FileAccessWindows::close() { bool rename_error; + +#ifdef WINRT_ENABLED + // WinRT has no PathFileExists, so we check attributes instead + DWORD fileAttr; + + fileAttr = GetFileAttributesW(save_path.c_str()); + if (INVALID_FILE_ATTRIBUTES == fileAttr) { +#else if (!PathFileExistsW(save_path.c_str())) { +#endif //creating new file rename_error = _wrename((save_path+".tmp").c_str(),save_path.c_str())!=0; } else { @@ -139,7 +148,6 @@ void FileAccessWindows::close() { ERR_FAIL_COND( rename_error ); } - } bool FileAccessWindows::is_open() const { diff --git a/drivers/windows/semaphore_windows.cpp b/drivers/windows/semaphore_windows.cpp index 74094f482a..8d11d1b1c1 100644 --- a/drivers/windows/semaphore_windows.cpp +++ b/drivers/windows/semaphore_windows.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "semaphore_windows.h" -#if defined(WINDOWS_ENABLED) && !defined(WINRT_ENABLED) +#if defined(WINDOWS_ENABLED) #include "os/memory.h" diff --git a/main/input_default.cpp b/main/input_default.cpp index d84b0b0f58..92f4a6fb72 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -504,7 +504,7 @@ void InputDefault::action_release(const StringName& p_action){ action.fixed_frame=OS::get_singleton()->get_fixed_frames(); action.idle_frame=OS::get_singleton()->get_idle_frames(); - action.pressed=true; + action.pressed=false; action_state[p_action]=action; } @@ -655,7 +655,7 @@ static const char *s_ControllerMappings [] = "030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,a:b0,b:b2,x:b1,y:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,", "030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,y:b3,x:b1,start:b9,guide:,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,", "030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a5,", - "030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e0400001907000000010000,X360 Wireless Controller,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:h0.8,lefttrigger:a2,x:b2,dpup:h0.1,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:h0.2,righttrigger:a5,b:b1,", "030000005e0400008902000021010000,Microsoft X-Box pad v2 (US),x:b3,a:b0,b:b1,y:b4,back:b6,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b5,lefttrigger:a2,rightshoulder:b2,righttrigger:a5,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a3,righty:a4,", "030000005e0400008e02000001000000,Microsoft X-Box 360 pad,leftstick:b9,leftx:a0,lefty:a1,dpdown:h0.1,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:h0.2,lefttrigger:a2,x:b2,dpup:h0.4,back:b6,leftshoulder:b4,y:b3,a:b0,dpright:h0.8,righttrigger:a5,b:b1,", "030000005e0400008e02000004010000,Microsoft X-Box 360 pad,a:b0,b:b1,x:b2,y:b3,back:b6,start:b7,guide:b8,leftshoulder:b4,rightshoulder:b5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,", @@ -738,6 +738,10 @@ static const char *s_ControllerMappings [] = "303534632d303563342d576972656c65,PS4 Controller USB/Win,leftx:a0,lefty:a1,dpdown:b15,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a5,lefttrigger:a3,x:b0,dpup:b14,dpleft:b16,dpright:b17,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b1,righttrigger:b7,b:b2,", "c2a94d6963726f736f66742058626f78,Wireless X360 Controller,leftx:a0,lefty:a1,dpdown:b14,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:b11,lefttrigger:a2,x:b2,dpup:b13,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:b12,righttrigger:a5,b:b1,", #endif + + #ifdef WINRT_ENABLED + "__WINRT_GAMEPAD__,Xbox Controller,a:b2,b:b3,x:b4,y:b5,start:b0,back:b1,leftstick:b12,rightstick:b13,leftshoulder:b10,rightshoulder:b11,dpup:b6,dpdown:b7,dpleft:b8,dpright:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,", + #endif NULL }; @@ -845,6 +849,13 @@ uint32_t InputDefault::joy_axis(uint32_t p_last_id, int p_device, int p_axis, co return p_last_id; } + if (ABS(joy.last_axis[p_axis]) > 0.5 && joy.last_axis[p_axis] * p_value.value < 0) { + //changed direction quickly, insert fake event to release pending inputmap actions + JoyAxis jx; + jx.min = p_value.min; + jx.value = p_value.value < 0 ? 0.1 : -0.1; + p_last_id = joy_axis(p_last_id, p_device, p_axis, jx); + } joy.last_axis[p_axis] = p_value.value; float val = p_value.min == 0 ? -1.0f + 2.0f * p_value.value : p_value.value; @@ -1148,3 +1159,61 @@ Array InputDefault::get_connected_joysticks() { } return ret; } + +static const char* _buttons[] = { + "Face Button Bottom", + "Face Button Right", + "Face Button Left", + "Face Button Top", + "L", + "R", + "L2", + "R2", + "L3", + "R3", + "Select", + "Start", + "DPAD Up", + "DPAD Down", + "DPAD Left", + "DPAD Right" +}; + +static const char* _axes[] = { + "Left Stick X", + "Left Stick Y", + "Right Stick X", + "Right Stick Y", + "", + "", + "L2", + "R2" +}; + +String InputDefault::get_joy_button_string(int p_button) { + ERR_FAIL_INDEX_V(p_button, JOY_BUTTON_MAX, ""); + return _buttons[p_button]; +} + +int InputDefault::get_joy_button_index_from_string(String p_button) { + for (int i = 0; i < JOY_BUTTON_MAX; i++) { + if (p_button == _buttons[i]) { + return i; + } + } + ERR_FAIL_V(-1); +} + +String InputDefault::get_joy_axis_string(int p_axis) { + ERR_FAIL_INDEX_V(p_axis, JOY_AXIS_MAX, ""); + return _axes[p_axis]; +} + +int InputDefault::get_joy_axis_index_from_string(String p_axis) { + for (int i = 0; i < JOY_AXIS_MAX; i++) { + if (p_axis == _axes[i]) { + return i; + } + } + ERR_FAIL_V(-1); +} diff --git a/main/input_default.h b/main/input_default.h index fbf7837b3b..2db6d28abf 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -235,6 +235,11 @@ public: virtual bool is_joy_known(int p_device); virtual String get_joy_guid(int p_device) const; + virtual String get_joy_button_string(int p_button); + virtual String get_joy_axis_string(int p_axis); + virtual int get_joy_axis_index_from_string(String p_axis); + virtual int get_joy_button_index_from_string(String p_button); + bool is_joy_mapped(int p_device); String get_joy_guid_remapped(int p_device) const; void set_fallback_mapping(String p_guid); diff --git a/main/main.cpp b/main/main.cpp index e8c989c88b..a1f62c7628 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1004,8 +1004,11 @@ Error Main::setup2() { } } #ifdef TOOLS_ENABLED + ObjectTypeDB::set_current_api(ObjectTypeDB::API_EDITOR); EditorNode::register_editor_types(); ObjectTypeDB::register_type<PCKPacker>(); // todo: move somewhere else + ObjectTypeDB::set_current_api(ObjectTypeDB::API_CORE); + #endif MAIN_PRINT("Main: Load Scripts, Modules, Drivers"); @@ -1032,6 +1035,8 @@ Error Main::setup2() { _start_success=true; locale=String(); + ObjectTypeDB::set_current_api(ObjectTypeDB::API_NONE); //no more api is registered at this point + MAIN_PRINT("Main: Done"); return OK; @@ -1304,9 +1309,10 @@ bool Main::start() { } + String local_game_path; if (game_path!="" && !project_manager_request) { - String local_game_path=game_path.replace("\\","/"); + local_game_path=game_path.replace("\\","/"); if (!local_game_path.begins_with("res://")) { bool absolute=(local_game_path.size()>1) && (local_game_path[0]=='/' || local_game_path[1]==':'); @@ -1373,98 +1379,99 @@ bool Main::start() { OS::get_singleton()->set_context(OS::CONTEXT_EDITOR); //editor_node->set_edited_scene(game); - } else { + } #endif + } - { - //autoload - List<PropertyInfo> props; - Globals::get_singleton()->get_property_list(&props); - - //first pass, add the constants so they exist before any script is loaded - for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) { - - String s = E->get().name; - if (!s.begins_with("autoload/")) - continue; - String name = s.get_slicec('/',1); - String path = Globals::get_singleton()->get(s); - bool global_var=false; - if (path.begins_with("*")) { - global_var=true; - } - - if (global_var) { - for(int i=0;i<ScriptServer::get_language_count();i++) { - ScriptServer::get_language(i)->add_global_constant(name,Variant()); - } - } - + if (!project_manager_request && !editor) { + if (game_path!="" || script!="") { + //autoload + List<PropertyInfo> props; + Globals::get_singleton()->get_property_list(&props); + + //first pass, add the constants so they exist before any script is loaded + for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) { + + String s = E->get().name; + if (!s.begins_with("autoload/")) + continue; + String name = s.get_slicec('/',1); + String path = Globals::get_singleton()->get(s); + bool global_var=false; + if (path.begins_with("*")) { + global_var=true; } - //second pass, load into global constants - List<Node*> to_add; - for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) { - - String s = E->get().name; - if (!s.begins_with("autoload/")) - continue; - String name = s.get_slicec('/',1); - String path = Globals::get_singleton()->get(s); - bool global_var=false; - if (path.begins_with("*")) { - global_var=true; - path=path.substr(1,path.length()-1); + if (global_var) { + for(int i=0;i<ScriptServer::get_language_count();i++) { + ScriptServer::get_language(i)->add_global_constant(name,Variant()); } + } - RES res = ResourceLoader::load(path); - ERR_EXPLAIN("Can't autoload: "+path); - ERR_CONTINUE(res.is_null()); - Node *n=NULL; - if (res->is_type("PackedScene")) { - Ref<PackedScene> ps = res; - n=ps->instance(); - } else if (res->is_type("Script")) { - Ref<Script> s = res; - StringName ibt = s->get_instance_base_type(); - bool valid_type = ObjectTypeDB::is_type(ibt,"Node"); - ERR_EXPLAIN("Script does not inherit a Node: "+path); - ERR_CONTINUE( !valid_type ); - - Object *obj = ObjectTypeDB::instance(ibt); - - ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: "+String(ibt)); - ERR_CONTINUE( obj==NULL ); - - n = obj->cast_to<Node>(); - n->set_script(s.get_ref_ptr()); - } - - ERR_EXPLAIN("Path in autoload not a node or script: "+path); - ERR_CONTINUE(!n); - n->set_name(name); - - //defer so references are all valid on _ready() - //sml->get_root()->add_child(n); - to_add.push_back(n); + } - if (global_var) { - for(int i=0;i<ScriptServer::get_language_count();i++) { - ScriptServer::get_language(i)->add_global_constant(name,n); - } - } + //second pass, load into global constants + List<Node*> to_add; + for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) { + + String s = E->get().name; + if (!s.begins_with("autoload/")) + continue; + String name = s.get_slicec('/',1); + String path = Globals::get_singleton()->get(s); + bool global_var=false; + if (path.begins_with("*")) { + global_var=true; + path=path.substr(1,path.length()-1); + } + RES res = ResourceLoader::load(path); + ERR_EXPLAIN("Can't autoload: "+path); + ERR_CONTINUE(res.is_null()); + Node *n=NULL; + if (res->is_type("PackedScene")) { + Ref<PackedScene> ps = res; + n=ps->instance(); + } else if (res->is_type("Script")) { + Ref<Script> s = res; + StringName ibt = s->get_instance_base_type(); + bool valid_type = ObjectTypeDB::is_type(ibt,"Node"); + ERR_EXPLAIN("Script does not inherit a Node: "+path); + ERR_CONTINUE( !valid_type ); + + Object *obj = ObjectTypeDB::instance(ibt); + + ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: "+String(ibt)); + ERR_CONTINUE( obj==NULL ); + + n = obj->cast_to<Node>(); + n->set_script(s.get_ref_ptr()); } - for(List<Node*>::Element *E=to_add.front();E;E=E->next()) { + ERR_EXPLAIN("Path in autoload not a node or script: "+path); + ERR_CONTINUE(!n); + n->set_name(name); - sml->get_root()->add_child(E->get()); + //defer so references are all valid on _ready() + //sml->get_root()->add_child(n); + to_add.push_back(n); + + if (global_var) { + for(int i=0;i<ScriptServer::get_language_count();i++) { + ScriptServer::get_language(i)->add_global_constant(name,n); + } } + } + for(List<Node*>::Element *E=to_add.front();E;E=E->next()) { + sml->get_root()->add_child(E->get()); } + //singletons + } + if (game_path!="") { Node *scene=NULL; Ref<PackedScene> scenedata = ResourceLoader::load(local_game_path); if (scenedata.is_valid()) @@ -1481,12 +1488,7 @@ bool Main::start() { if (icon.load(iconpath)==OK) OS::get_singleton()->set_icon(icon); } - - - //singletons -#ifdef TOOLS_ENABLED } -#endif } #ifdef TOOLS_ENABLED diff --git a/methods.py b/methods.py index e29fd760ba..c28ed55dda 100755 --- a/methods.py +++ b/methods.py @@ -1379,6 +1379,7 @@ def use_windows_spawn_fix(self, platform=None): cmdline = cmd + " " + newargs rv=0 + env = {str(key): str(value) for key, value in env.iteritems()} if len(cmdline) > 32000 and cmd.endswith("ar") : cmdline = cmd + " " + args[1] + " " + args[2] + " " for i in range(3,len(args)) : @@ -1450,3 +1451,72 @@ def colored(sys,env): env.Append( JARCOMSTR=[java_library_message] ) env.Append( JAVACCOMSTR=[java_compile_source_message] ) +def detect_visual_c_compiler_version(tools_env): + # tools_env is the variable scons uses to call tools that execute tasks, SCons's env['ENV'] that executes tasks... + # (see the SCons documentation for more information on what it does)... + # in order for this function to be well encapsulated i choose to force it to recieve SCons's TOOLS env (env['ENV'] + # and not scons setup environment (env)... so make sure you call the right environment on it or it will fail to detect + # the propper vc version that will be called + + # These is no flag to give to visual c compilers to set the architecture, ie scons bits argument (32,64,ARM etc) + # There are many different cl.exe files that are run, and each one compiles & links to a different architecture + # As far as I know, the only way to figure out what compiler will be run when Scons calls cl.exe via Program() + # is to check the PATH varaible and figure out which one will be called first. Code bellow does that and returns: + # the following string values: + + # "" Compiler not detected + # "amd64" Native 64 bit compiler + # "amd64_x86" 64 bit Cross Compiler for 32 bit + # "x86" Native 32 bit compiler + # "x86_amd64" 32 bit Cross Compiler for 64 bit + + # There are other architectures, but Godot does not support them currently, so this function does not detect arm/amd64_arm + # and similar architectures/compilers + + # Set chosen compiler to "not detected" + vc_chosen_compiler_index = -1 + vc_chosen_compiler_str = "" + + # find() works with -1 so big ifs bellow are needed... the simplest solution, in fact + # First test if amd64 and amd64_x86 compilers are present in the path + vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN\\amd64;") + if(vc_amd64_compiler_detection_index > -1): + vc_chosen_compiler_index = vc_amd64_compiler_detection_index + vc_chosen_compiler_str = "amd64" + + vc_amd64_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN\\amd64_x86;") + if(vc_amd64_x86_compiler_detection_index > -1 + and (vc_chosen_compiler_index == -1 + or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)): + vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index + vc_chosen_compiler_str = "amd64_x86" + + + # Now check the 32 bit compilers + vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN;") + if(vc_x86_compiler_detection_index > -1 + and (vc_chosen_compiler_index == -1 + or vc_chosen_compiler_index > vc_x86_compiler_detection_index)): + vc_chosen_compiler_index = vc_x86_compiler_detection_index + vc_chosen_compiler_str = "x86" + + vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env['VCINSTALLDIR']+"BIN\\x86_amd64;") + if(vc_x86_amd64_compiler_detection_index > -1 + and (vc_chosen_compiler_index == -1 + or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)): + vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index + vc_chosen_compiler_str = "x86_amd64" + + # debug help + #print vc_amd64_compiler_detection_index + #print vc_amd64_x86_compiler_detection_index + #print vc_x86_compiler_detection_index + #print vc_x86_amd64_compiler_detection_index + #print "chosen "+str(vc_chosen_compiler_index)+ " | "+str(vc_chosen_compiler_str) + + return vc_chosen_compiler_str + +def precious_program(env, program, sources, **args): + program = env.ProgramOriginal(program, sources, **args) + env.Precious(program) + return program diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index 18a4347edf..4134ed037f 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -359,7 +359,7 @@ Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer,int &r_buffe incoming_packets.pop_front(); *r_buffer=(const uint8_t*)(¤t_packet.packet->data[12]); - r_buffer_size=current_packet.packet->dataLength; + r_buffer_size=current_packet.packet->dataLength-12; return OK; } diff --git a/modules/enet/win32.c b/modules/enet/win32.c index d77fa9a49a..15edd7acbb 100644 --- a/modules/enet/win32.c +++ b/modules/enet/win32.c @@ -28,7 +28,9 @@ enet_initialize (void) return -1; } +#ifndef WINRT_ENABLED timeBeginPeriod (1); +#endif return 0; } @@ -36,11 +38,22 @@ enet_initialize (void) void enet_deinitialize (void) { +#ifndef WINRT_ENABLED timeEndPeriod (1); +#endif WSACleanup (); } +#ifdef WINRT_ENABLED +enet_uint32 +timeGetTime() { + ULONGLONG ticks = GetTickCount64(); + return (enet_uint32)ticks; +} +#endif + + enet_uint32 enet_host_random_seed (void) { diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index ce8b6a6ea4..2e2cbe7b29 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -662,6 +662,46 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre return p_stack_level|GDFunction::ADDR_TYPE_STACK<<GDFunction::ADDR_BITS; } break; + // ternary operators + case GDParser::OperatorNode::OP_TERNARY_IF: { + + // x IF a ELSE y operator with early out on failure + + int res = _parse_expression(codegen,on->arguments[0],p_stack_level); + if (res<0) + return res; + codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_IF_NOT); + codegen.opcodes.push_back(res); + int jump_fail_pos=codegen.opcodes.size(); + codegen.opcodes.push_back(0); + + + res = _parse_expression(codegen,on->arguments[1],p_stack_level); + if (res<0) + return res; + + codegen.alloc_stack(p_stack_level); //it will be used.. + codegen.opcodes.push_back(GDFunction::OPCODE_ASSIGN); + codegen.opcodes.push_back(p_stack_level|GDFunction::ADDR_TYPE_STACK<<GDFunction::ADDR_BITS); + codegen.opcodes.push_back(res); + codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + int jump_past_pos=codegen.opcodes.size(); + codegen.opcodes.push_back(0); + + codegen.opcodes[jump_fail_pos]=codegen.opcodes.size(); + res = _parse_expression(codegen,on->arguments[2],p_stack_level); + if (res<0) + return res; + + codegen.opcodes.push_back(GDFunction::OPCODE_ASSIGN); + codegen.opcodes.push_back(p_stack_level|GDFunction::ADDR_TYPE_STACK<<GDFunction::ADDR_BITS); + codegen.opcodes.push_back(res); + + codegen.opcodes[jump_past_pos]=codegen.opcodes.size(); + + return p_stack_level|GDFunction::ADDR_TYPE_STACK<<GDFunction::ADDR_BITS; + + } break; //unary operators case GDParser::OperatorNode::OP_NEG: { if (!_create_unary_operator(codegen,on,Variant::OP_NEGATE,p_stack_level)) return -1;} break; case GDParser::OperatorNode::OP_NOT: { if (!_create_unary_operator(codegen,on,Variant::OP_NOT,p_stack_level)) return -1;} break; @@ -1403,6 +1443,10 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode * #endif if (p_func) { gdfunc->_initial_line=p_func->line; +#ifdef TOOLS_ENABLED + + p_script->member_lines[func_name]=p_func->line; +#endif } else { gdfunc->_initial_line=0; } @@ -1632,6 +1676,12 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa p_script->member_indices[name]=minfo; p_script->members.insert(name); +#ifdef TOOLS_ENABLED + + p_script->member_lines[name]=p_class->variables[i].line; +#endif + + } for(int i=0;i<p_class->constant_expressions.size();i++) { @@ -1643,6 +1693,11 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa p_script->constants.insert(name,constant->value); //p_script->constants[constant->value].make_const(); +#ifdef TOOLS_ENABLED + + p_script->member_lines[name]=p_class->constant_expressions[i].expression->line; +#endif + } for(int i=0;i<p_class->_signals.size();i++) { @@ -1691,6 +1746,10 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa if (err) return err; +#ifdef TOOLS_ENABLED + + p_script->member_lines[name]=p_class->subclasses[i]->line; +#endif p_script->constants.insert(name,subclass); //once parsed, goes to the list of constants p_script->subclasses.insert(name,subclass); diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 2a80531ec5..c3e59836a2 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -351,6 +351,7 @@ struct GDCompletionIdentifier { Ref<GDScript> script; Variant::Type type; Variant value; //im case there is a value, also return it + }; @@ -935,6 +936,7 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser:: return false; } + static bool _guess_identifier_type_in_block(GDCompletionContext& context,int p_line,const StringName& p_identifier,GDCompletionIdentifier &r_type) { @@ -2094,7 +2096,7 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base GDParser p; - Error err = p.parse(p_code,p_base_path,false,"",true); + p.parse(p_code,p_base_path,false,"",true); bool isfunction=false; Set<String> options; @@ -2141,7 +2143,18 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base GDCompletionIdentifier t; if (_guess_expression_type(context,static_cast<const GDParser::OperatorNode *>(node)->arguments[0],p.get_completion_line(),t)) { - if (t.type==Variant::OBJECT && t.obj_type!=StringName()) { + if (t.type==Variant::OBJECT && t.obj_type=="GDNativeClass") { + //native enum + Ref<GDNativeClass> gdn = t.value; + if (gdn.is_valid()) { + StringName cn = gdn->get_name(); + List<String> cnames; + ObjectTypeDB::get_integer_constant_list(cn,&cnames); + for (List<String>::Element *E=cnames.front();E;E=E->next()) { + options.insert(E->get()); + } + } + } else if (t.type==Variant::OBJECT && t.obj_type!=StringName()) { Ref<GDScript> on_script; @@ -2511,3 +2524,442 @@ void GDScriptLanguage::auto_indent_code(String& p_code,int p_from_line,int p_to_ } } + +#ifdef TOOLS_ENABLED + +Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol,const String& p_base_path, Object*p_owner,LookupResult& r_result) { + + + //before parsing, try the usual stuff + if (ObjectTypeDB::type_exists(p_symbol)) { + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS; + r_result.class_name=p_symbol; + return OK; + } + + for(int i=0;i<Variant::VARIANT_MAX;i++) { + Variant::Type t = Variant::Type(i); + if (Variant::get_type_name(t)==p_symbol) { + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS; + r_result.class_name=Variant::get_type_name(t); + return OK; + } + } + + for(int i=0;i<GDFunctions::FUNC_MAX;i++) { + if (GDFunctions::get_func_name(GDFunctions::Function(i))==p_symbol) { + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_METHOD; + r_result.class_name="@GDScript"; + r_result.class_member=p_symbol; + return OK; + } + } + + GDParser p; + p.parse(p_code,p_base_path,false,"",true); + + if (p.get_completion_type()==GDParser::COMPLETION_NONE) + return ERR_CANT_RESOLVE; + + GDCompletionContext context; + + context._class=p.get_completion_class(); + context.block=p.get_completion_block(); + context.function=p.get_completion_function(); + context.base=p_owner; + context.base_path=p_base_path; + bool isfunction=false; + + switch(p.get_completion_type()) { + + case GDParser::COMPLETION_NONE: { + } break; + case GDParser::COMPLETION_BUILT_IN_TYPE_CONSTANT: { + + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT; + r_result.class_name=Variant::get_type_name(p.get_completion_built_in_constant()); + r_result.class_member=p_symbol; + return OK; + + } break; + case GDParser::COMPLETION_FUNCTION: { + + + if (context._class && context._class->functions.size()) { + for(int i=0;i<context._class->functions.size();i++) { + if (context._class->functions[i]->name==p_symbol) { + r_result.type=ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION; + r_result.location=context._class->functions[i]->line; + return OK; + } + } + } + + Ref<GDScript> parent = _get_parent_class(context); + while(parent.is_valid()) { + int line = parent->get_member_line(p_symbol); + if (line>=0) { + r_result.type=ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION; + r_result.location=line; + r_result.script=parent; + return OK; + + } + + parent=parent->get_base(); + } + + GDCompletionIdentifier identifier = _get_native_class(context); + print_line("identifier: "+String(identifier.obj_type)); + + if (ObjectTypeDB::has_method(identifier.obj_type,p_symbol)) { + + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_METHOD; + r_result.class_name=identifier.obj_type; + r_result.class_member=p_symbol; + return OK; + } + + + } break; + case GDParser::COMPLETION_IDENTIFIER: { + + //check if a function + if (p.get_completion_identifier_is_function()) { + if (context._class && context._class->functions.size()) { + for(int i=0;i<context._class->functions.size();i++) { + if (context._class->functions[i]->name==p_symbol) { + r_result.type=ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION; + r_result.location=context._class->functions[i]->line; + return OK; + } + } + } + + Ref<GDScript> parent = _get_parent_class(context); + while(parent.is_valid()) { + int line = parent->get_member_line(p_symbol); + if (line>=0) { + r_result.type=ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION; + r_result.location=line; + r_result.script=parent; + return OK; + + } + + parent=parent->get_base(); + } + + GDCompletionIdentifier identifier = _get_native_class(context); + + + if (ObjectTypeDB::has_method(identifier.obj_type,p_symbol)) { + + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_METHOD; + r_result.class_name=identifier.obj_type; + r_result.class_member=p_symbol; + return OK; + } + } else { + + + const GDParser::BlockNode *block=context.block; + //search in blocks going up (local var?) + while(block) { + + + + for (int i=0;i<block->statements.size();i++) { + + if (block->statements[i]->line>p.get_completion_line()) + continue; + + + if (block->statements[i]->type==GDParser::BlockNode::TYPE_LOCAL_VAR) { + + const GDParser::LocalVarNode *lv=static_cast<const GDParser::LocalVarNode *>(block->statements[i]); + + if (lv->assign && lv->name==p_symbol) { + + r_result.type=ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION; + r_result.location=block->statements[i]->line; + return OK; + } + } + } + block=block->parent_block; + } + + //guess from function arguments + if (context.function && context.function->name!=StringName()) { + + for(int i=0;i<context.function->arguments.size();i++) { + + if (context.function->arguments[i]==p_symbol) { + r_result.type=ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION; + r_result.location=context.function->line; + return OK; + } + + } + } + + //guess in class constants + + for(int i=0;i<context._class->constant_expressions.size();i++) { + + if (context._class->constant_expressions[i].identifier==p_symbol) { + r_result.type=ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION; + r_result.location=context._class->constant_expressions[i].expression->line; + return OK; + } + } + + //guess in class variables + if (!(context.function && context.function->_static)) { + + for(int i=0;i<context._class->variables.size();i++) { + + if (context._class->variables[i].identifier==p_symbol) { + + r_result.type=ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION; + r_result.location=context._class->variables[i].line; + return OK; + } + } + } + + //guess in autoloads as singletons + List<PropertyInfo> props; + Globals::get_singleton()->get_property_list(&props); + + for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) { + + String s = E->get().name; + if (!s.begins_with("autoload/")) + continue; + String name = s.get_slice("/",1); + if (name==String(p_symbol)) { + + String path = Globals::get_singleton()->get(s); + if (path.begins_with("*")) { + String script =path.substr(1,path.length()); + + if (!script.ends_with(".gd")) { + //not a script, try find the script anyway, + //may have some success + script=script.basename()+".gd"; + } + + if (FileAccess::exists(script)) { + + r_result.type=ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION; + r_result.location=0; + r_result.script=ResourceLoader::load(script); + return OK; + } + } + } + } + + //global + for(Map<StringName,int>::Element *E=GDScriptLanguage::get_singleton()->get_global_map().front();E;E=E->next()) { + if (E->key()==p_symbol) { + + Variant value = GDScriptLanguage::get_singleton()->get_global_array()[E->get()]; + if (value.get_type()==Variant::OBJECT) { + Object *obj = value; + if (obj) { + + if (obj->cast_to<GDNativeClass>()) { + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS; + r_result.class_name=obj->cast_to<GDNativeClass>()->get_name(); + + } else { + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS; + r_result.class_name=obj->get_type(); + } + return OK; + } + } else { + + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT; + r_result.class_name="@Global Scope"; + r_result.class_member=p_symbol; + return OK; + } + } + + } +#if 0 + GDCompletionIdentifier identifier; + if (_guess_identifier_type(context,p.get_completion_line(),p_symbol,identifier)) { + + print_line("var type: "+Variant::get_type_name(identifier.type)); + if (identifier.script.is_valid()) { + print_line("var script: "+identifier.script->get_path()); + } + print_line("obj type: "+String(identifier.obj_type)); + print_line("value: "+String(identifier.value)); + } +#endif + } + + } break; + case GDParser::COMPLETION_PARENT_FUNCTION: { + + } break; + case GDParser::COMPLETION_METHOD: + isfunction=true; + case GDParser::COMPLETION_INDEX: { + + const GDParser::Node *node = p.get_completion_node(); + if (node->type!=GDParser::Node::TYPE_OPERATOR) + break; + + + + + GDCompletionIdentifier t; + if (_guess_expression_type(context,static_cast<const GDParser::OperatorNode *>(node)->arguments[0],p.get_completion_line(),t)) { + + if (t.type==Variant::OBJECT && t.obj_type=="GDNativeClass") { + //native enum + Ref<GDNativeClass> gdn = t.value; + if (gdn.is_valid()) { + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT; + r_result.class_name=gdn->get_name();; + r_result.class_member=p_symbol; + return OK; + + } + } else if (t.type==Variant::OBJECT && t.obj_type!=StringName()) { + + Ref<GDScript> on_script; + + if (t.value.get_type()) { + Object *obj=t.value; + + + if (obj) { + + + on_script=obj->get_script(); + + if (on_script.is_valid()) { + int loc = on_script->get_member_line(p_symbol); + if (loc>=0) { + r_result.script=on_script; + r_result.type=ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION; + r_result.location=loc; + return OK; + } + } + } + } + + if (ObjectTypeDB::has_method(t.obj_type,p_symbol)) { + + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_METHOD; + r_result.class_name=t.obj_type; + r_result.class_member=p_symbol; + return OK; + + } + + bool success; + ObjectTypeDB::get_integer_constant(t.obj_type,p_symbol,&success); + if (success) { + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT; + r_result.class_name=t.obj_type; + r_result.class_member=p_symbol; + return OK; + } + + ObjectTypeDB::get_property_type(t.obj_type,p_symbol,&success); + + if (success) { + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_PROPERTY; + r_result.class_name=t.obj_type; + r_result.class_member=p_symbol; + return OK; + } + + + } else { + + Variant::CallError ce; + Variant v = Variant::construct(t.type,NULL,0,ce); + + bool valid; + v.get_numeric_constant_value(t.type,p_symbol,&valid); + if (valid) { + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT; + r_result.class_name=Variant::get_type_name(t.type); + r_result.class_member=p_symbol; + return OK; + } + + //todo check all inputevent types for property + + v.get(p_symbol,&valid); + + if (valid) { + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_PROPERTY; + r_result.class_name=Variant::get_type_name(t.type); + r_result.class_member=p_symbol; + return OK; + } + + if (v.has_method(p_symbol)) { + + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_METHOD; + r_result.class_name=Variant::get_type_name(t.type); + r_result.class_member=p_symbol; + return OK; + + } + + + } + } + + + } break; + case GDParser::COMPLETION_CALL_ARGUMENTS: { + + return ERR_CANT_RESOLVE; + } break; + case GDParser::COMPLETION_VIRTUAL_FUNC: { + + GDCompletionIdentifier cid = _get_native_class(context); + + if (cid.obj_type!=StringName()) { + List<MethodInfo> vm; + ObjectTypeDB::get_virtual_methods(cid.obj_type,&vm); + for(List<MethodInfo>::Element *E=vm.front();E;E=E->next()) { + + if (p_symbol==E->get().name) { + + r_result.type=ScriptLanguage::LookupResult::RESULT_CLASS_METHOD; + r_result.class_name=cid.obj_type; + r_result.class_member=p_symbol; + return OK; + + } + } + } + } break; + case GDParser::COMPLETION_YIELD: { + + return ERR_CANT_RESOLVE; + + } break; + + } + + + return ERR_CANT_RESOLVE; +} + +#endif diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp index b2cc6341c1..094e21bb4f 100644 --- a/modules/gdscript/gd_function.cpp +++ b/modules/gdscript/gd_function.cpp @@ -1437,7 +1437,7 @@ void GDFunctionState::_bind_methods() { ObjectTypeDB::bind_method(_MD("resume:Variant","arg"),&GDFunctionState::resume,DEFVAL(Variant())); ObjectTypeDB::bind_method(_MD("is_valid"),&GDFunctionState::is_valid); - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"_signal_callback",&GDFunctionState::_signal_callback,MethodInfo("_signal_callback")); + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"_signal_callback",&GDFunctionState::_signal_callback,MethodInfo("_signal_callback")); } diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index e5a8dc0152..8f4f5ef4ca 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -203,6 +203,7 @@ bool GDParser::_get_completable_identifier(CompletionType p_type,StringName& ide completion_line=tokenizer->get_token_line(); completion_block=current_block; completion_found=true; + completion_ident_is_call=false; tokenizer->advance(); if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER) { @@ -210,6 +211,9 @@ bool GDParser::_get_completable_identifier(CompletionType p_type,StringName& ide tokenizer->advance(); } + if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_OPEN) { + completion_ident_is_call=true; + } return true; } @@ -936,6 +940,8 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ case GDTokenizer::TK_OP_BIT_OR: op=OperatorNode::OP_BIT_OR ; break; case GDTokenizer::TK_OP_BIT_XOR: op=OperatorNode::OP_BIT_XOR ; break; case GDTokenizer::TK_PR_EXTENDS: op=OperatorNode::OP_EXTENDS; break; + case GDTokenizer::TK_CF_IF: op=OperatorNode::OP_TERNARY_IF; break; + case GDTokenizer::TK_CF_ELSE: op=OperatorNode::OP_TERNARY_ELSE; break; default: valid=false; break; } @@ -958,6 +964,7 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ int next_op=-1; int min_priority=0xFFFFF; bool is_unary=false; + bool is_ternary=false; for(int i=0;i<expression.size();i++) { @@ -971,6 +978,8 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ int priority; bool unary=false; + bool ternary=false; + bool error=false; switch(expression[i].op) { @@ -1001,25 +1010,27 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ case OperatorNode::OP_EQUAL: priority=8; break; case OperatorNode::OP_NOT_EQUAL: priority=8; break; + case OperatorNode::OP_IN: priority=10; break; - + case OperatorNode::OP_NOT: priority=11; unary=true; break; case OperatorNode::OP_AND: priority=12; break; case OperatorNode::OP_OR: priority=13; break; - - // ?: = 10 - - case OperatorNode::OP_ASSIGN: priority=14; break; - case OperatorNode::OP_ASSIGN_ADD: priority=14; break; - case OperatorNode::OP_ASSIGN_SUB: priority=14; break; - case OperatorNode::OP_ASSIGN_MUL: priority=14; break; - case OperatorNode::OP_ASSIGN_DIV: priority=14; break; - case OperatorNode::OP_ASSIGN_MOD: priority=14; break; - case OperatorNode::OP_ASSIGN_SHIFT_LEFT: priority=14; break; - case OperatorNode::OP_ASSIGN_SHIFT_RIGHT: priority=14; break; - case OperatorNode::OP_ASSIGN_BIT_AND: priority=14; break; - case OperatorNode::OP_ASSIGN_BIT_OR: priority=14; break; - case OperatorNode::OP_ASSIGN_BIT_XOR: priority=14; break; + + case OperatorNode::OP_TERNARY_IF: priority=14; ternary=true; break; + case OperatorNode::OP_TERNARY_ELSE: priority=14; error=true; break; // Errors out when found without IF (since IF would consume it) + + case OperatorNode::OP_ASSIGN: priority=15; break; + case OperatorNode::OP_ASSIGN_ADD: priority=15; break; + case OperatorNode::OP_ASSIGN_SUB: priority=15; break; + case OperatorNode::OP_ASSIGN_MUL: priority=15; break; + case OperatorNode::OP_ASSIGN_DIV: priority=15; break; + case OperatorNode::OP_ASSIGN_MOD: priority=15; break; + case OperatorNode::OP_ASSIGN_SHIFT_LEFT: priority=15; break; + case OperatorNode::OP_ASSIGN_SHIFT_RIGHT: priority=15; break; + case OperatorNode::OP_ASSIGN_BIT_AND: priority=15; break; + case OperatorNode::OP_ASSIGN_BIT_OR: priority=15; break; + case OperatorNode::OP_ASSIGN_BIT_XOR: priority=15; break; default: { @@ -1030,11 +1041,16 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ } if (priority<min_priority) { + if(error) { + _set_error("Unexpected operator"); + return NULL; + } // < is used for left to right (default) // <= is used for right to left next_op=i; min_priority=priority; is_unary=unary; + is_ternary=ternary; } } @@ -1075,6 +1091,62 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ } + } else if(is_ternary) { + if (next_op <1 || next_op>=(expression.size()-1)) { + _set_error("Parser bug.."); + ERR_FAIL_V(NULL); + } + + if(next_op>=(expression.size()-2) || expression[next_op+2].op != OperatorNode::OP_TERNARY_ELSE) { + _set_error("Expected else after ternary if."); + ERR_FAIL_V(NULL); + } + if(next_op>=(expression.size()-3)) { + _set_error("Expected value after ternary else."); + ERR_FAIL_V(NULL); + } + + OperatorNode *op = alloc_node<OperatorNode>(); + op->op=expression[next_op].op; + op->line=op_line; //line might have been changed from a \n + + if (expression[next_op-1].is_op) { + + _set_error("Parser bug.."); + ERR_FAIL_V(NULL); + } + + if (expression[next_op+1].is_op) { + // this is not invalid and can really appear + // but it becomes invalid anyway because no binary op + // can be followed by an unary op in a valid combination, + // due to how precedence works, unaries will always dissapear first + + _set_error("Unexpected two consecutive operators after ternary if."); + return NULL; + } + + if (expression[next_op+3].is_op) { + // this is not invalid and can really appear + // but it becomes invalid anyway because no binary op + // can be followed by an unary op in a valid combination, + // due to how precedence works, unaries will always dissapear first + + _set_error("Unexpected two consecutive operators after ternary else."); + return NULL; + } + + + op->arguments.push_back(expression[next_op+1].node); //next expression goes as first + op->arguments.push_back(expression[next_op-1].node); //left expression goes as when-true + op->arguments.push_back(expression[next_op+3].node); //expression after next goes as when-false + + //replace all 3 nodes by this operator and make it an expression + expression[next_op-1].node=op; + expression.remove(next_op); + expression.remove(next_op); + expression.remove(next_op); + expression.remove(next_op); } else { if (next_op <1 || next_op>=(expression.size()-1)) { @@ -3157,6 +3229,114 @@ void GDParser::_parse_class(ClassNode *p_class) { } } break; + case GDTokenizer::TK_PR_ENUM: { + //mutiple constant declarations.. + + int last_assign = -1; // Incremented by 1 right before the assingment. + String enum_name; + Dictionary enum_dict; + + tokenizer->advance(); + if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER) { + enum_name=tokenizer->get_token_identifier(); + tokenizer->advance(); + } + if (tokenizer->get_token()!=GDTokenizer::TK_CURLY_BRACKET_OPEN) { + _set_error("Expected '{' in enum declaration"); + return; + } + tokenizer->advance(); + + while(true) { + if(tokenizer->get_token()==GDTokenizer::TK_NEWLINE) { + + tokenizer->advance(); // Ignore newlines + } else if (tokenizer->get_token()==GDTokenizer::TK_CURLY_BRACKET_CLOSE) { + + tokenizer->advance(); + break; // End of enum + } else if (tokenizer->get_token()!=GDTokenizer::TK_IDENTIFIER) { + + if(tokenizer->get_token()==GDTokenizer::TK_EOF) { + _set_error("Unexpected end of file."); + } else { + _set_error(String("Unexpected ") + GDTokenizer::get_token_name(tokenizer->get_token()) + ", expected identifier"); + } + + return; + } else { // tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER + ClassNode::Constant constant; + + constant.identifier=tokenizer->get_token_identifier(); + + tokenizer->advance(); + + if (tokenizer->get_token()==GDTokenizer::TK_OP_ASSIGN) { + tokenizer->advance(); + + Node *subexpr=NULL; + + subexpr = _parse_and_reduce_expression(p_class,true,true); + if (!subexpr) { + if (_recover_from_completion()) { + break; + } + return; + } + + if (subexpr->type!=Node::TYPE_CONSTANT) { + _set_error("Expected constant expression"); + } + + const ConstantNode *subexpr_const = static_cast<const ConstantNode*>(subexpr); + + if(subexpr_const->value.get_type() != Variant::INT) { + _set_error("Expected an int value for enum"); + } + + last_assign = subexpr_const->value; + + constant.expression=subexpr; + + } else { + last_assign = last_assign + 1; + ConstantNode *cn = alloc_node<ConstantNode>(); + cn->value = last_assign; + constant.expression = cn; + } + + if(tokenizer->get_token()==GDTokenizer::TK_COMMA) { + tokenizer->advance(); + } + + if(enum_name != "") { + const ConstantNode *cn = static_cast<const ConstantNode*>(constant.expression); + enum_dict[constant.identifier] = cn->value; + } + + p_class->constant_expressions.push_back(constant); + } + + } + + if(enum_name != "") { + ClassNode::Constant enum_constant; + enum_constant.identifier=enum_name; + ConstantNode *cn = alloc_node<ConstantNode>(); + cn->value = enum_dict; + enum_constant.expression=cn; + p_class->constant_expressions.push_back(enum_constant); + } + + if (!_end_statement()) { + _set_error("Expected end of statement (enum)"); + return; + } + + + + + } break; default: { @@ -3376,6 +3556,11 @@ int GDParser::get_completion_argument_index() { return completion_argument; } +int GDParser::get_completion_identifier_is_function() { + + return completion_ident_is_call; +} + GDParser::GDParser() { head=NULL; diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h index 9e6f6e6765..75653e0916 100644 --- a/modules/gdscript/gd_parser.h +++ b/modules/gdscript/gd_parser.h @@ -247,6 +247,9 @@ public: OP_BIT_AND, OP_BIT_OR, OP_BIT_XOR, + //ternary operators + OP_TERNARY_IF, + OP_TERNARY_ELSE, }; Operator op; @@ -429,6 +432,7 @@ private: int completion_line; int completion_argument; bool completion_found; + bool completion_ident_is_call; PropertyInfo current_export; @@ -475,7 +479,7 @@ public: BlockNode *get_completion_block(); FunctionNode *get_completion_function(); int get_completion_argument_index(); - + int get_completion_identifier_is_function(); void clear(); GDParser(); diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index b97a0fcbb6..0ea10950df 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -751,7 +751,7 @@ void GDScript::_get_property_list(List<PropertyInfo> *p_properties) const { void GDScript::_bind_methods() { - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"new",&GDScript::_new,MethodInfo(Variant::OBJECT,"new")); + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"new",&GDScript::_new,MethodInfo(Variant::OBJECT,"new")); ObjectTypeDB::bind_method(_MD("get_as_byte_code"),&GDScript::get_as_byte_code); diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 0c3e1eb614..051e80634f 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -65,6 +65,7 @@ class GDScript : public Script { StringName setter; StringName getter; ScriptInstance::RPCMode rpc_mode; + }; friend class GDInstance; @@ -86,8 +87,11 @@ friend class GDScriptLanguage; Map<StringName,Ref<GDScript> > subclasses; Map<StringName,Vector<StringName> > _signals; + #ifdef TOOLS_ENABLED + Map<StringName,int> member_lines; + Map<StringName,Variant> member_default_values; List<PropertyInfo> members_cache; @@ -193,6 +197,16 @@ public: virtual ScriptLanguage *get_language() const; + virtual int get_member_line(const StringName& p_member) const { +#ifdef TOOLS_ENABLED + if (member_lines.has(p_member)) + return member_lines[p_member]; + else +#endif + return -1; + + } + GDScript(); ~GDScript(); }; @@ -394,6 +408,9 @@ public: 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 Error complete_code(const String& p_code, const String& p_base_path, Object*p_owner,List<String>* r_options,String& r_call_hint); +#ifdef TOOLS_ENABLED + virtual Error lookup_code(const String& p_code, const String& p_symbol, const String& p_base_path, Object*p_owner, LookupResult& r_result); +#endif virtual void auto_indent_code(String& p_code,int p_from_line,int p_to_line) const; virtual void add_global_constant(const StringName& p_variable,const Variant& p_value); diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 47e740b227..2041ec12ad 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -95,6 +95,7 @@ const char* GDTokenizer::token_names[TK_MAX]={ "setget", "const", "var", +"enum", "preload", "assert", "yield", @@ -874,6 +875,7 @@ void GDTokenizerText::_advance() { {TK_PR_SLAVE,"slave"}, {TK_PR_SYNC,"sync"}, {TK_PR_CONST,"const"}, + {TK_PR_ENUM,"enum"}, //controlflow {TK_CF_IF,"if"}, {TK_CF_ELIF,"elif"}, @@ -1330,7 +1332,7 @@ StringName GDTokenizerBuffer::get_token_identifier(int p_offset) const{ ERR_FAIL_INDEX_V(offset,tokens.size(),StringName()); uint32_t identifier = tokens[offset]>>TOKEN_BITS; - ERR_FAIL_INDEX_V(identifier,identifiers.size(),StringName()); + ERR_FAIL_INDEX_V(identifier,(uint32_t)identifiers.size(),StringName()); return identifiers[identifier]; } @@ -1389,7 +1391,7 @@ const Variant& GDTokenizerBuffer::get_token_constant(int p_offset) const{ int offset = token+p_offset; ERR_FAIL_INDEX_V(offset,tokens.size(),nil); uint32_t constant = tokens[offset]>>TOKEN_BITS; - ERR_FAIL_INDEX_V(constant,constants.size(),nil); + ERR_FAIL_INDEX_V(constant,(uint32_t)constants.size(),nil); return constants[constant]; } diff --git a/modules/gdscript/gd_tokenizer.h b/modules/gdscript/gd_tokenizer.h index 1815f82894..b91229ab1e 100644 --- a/modules/gdscript/gd_tokenizer.h +++ b/modules/gdscript/gd_tokenizer.h @@ -102,6 +102,7 @@ public: TK_PR_SETGET, TK_PR_CONST, TK_PR_VAR, + TK_PR_ENUM, TK_PR_PRELOAD, TK_PR_ASSERT, TK_PR_YIELD, diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 4de593760d..bd042c8989 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -1130,6 +1130,7 @@ void VisualScript::get_script_property_list(List<PropertyInfo> *p_list) const { } } +#ifdef TOOLS_ENABLED bool VisualScript::are_subnodes_edited() const { for(const Map<StringName,Function>::Element *E=functions.front();E;E=E->next()) { @@ -1143,7 +1144,7 @@ bool VisualScript::are_subnodes_edited() const { return false; } - +#endif void VisualScript::_set_data(const Dictionary& p_data) { @@ -1416,7 +1417,8 @@ bool VisualScriptInstance::get(const StringName& p_name, Variant &r_ret) const { if (!E) return false; - return E->get(); + r_ret=E->get(); + return true; } void VisualScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const{ @@ -2437,7 +2439,7 @@ void VisualScriptFunctionState::_bind_methods() { ObjectTypeDB::bind_method(_MD("connect_to_signal","obj","signals","args"),&VisualScriptFunctionState::connect_to_signal); ObjectTypeDB::bind_method(_MD("resume:Array","args"),&VisualScriptFunctionState::resume,DEFVAL(Variant())); ObjectTypeDB::bind_method(_MD("is_valid"),&VisualScriptFunctionState::is_valid); - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"_signal_callback",&VisualScriptFunctionState::_signal_callback,MethodInfo("_signal_callback")); + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"_signal_callback",&VisualScriptFunctionState::_signal_callback,MethodInfo("_signal_callback")); } VisualScriptFunctionState::VisualScriptFunctionState() { diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index 794230d694..63b018b0c2 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -344,7 +344,9 @@ public: virtual void get_script_property_list(List<PropertyInfo> *p_list) const; +#ifdef TOOLS_ENABLED virtual bool are_subnodes_edited() const; +#endif VisualScript(); ~VisualScript(); diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 1d0bca0b30..24a44d3506 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -65,6 +65,21 @@ const char* VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX "bytes2var", }; +VisualScriptBuiltinFunc::BuiltinFunc VisualScriptBuiltinFunc::find_function(const String& p_string) { + + for(int i=0;i<FUNC_MAX;i++) { + if (p_string==func_name[i]) + return BuiltinFunc(i); + } + + return FUNC_MAX; +} + +String VisualScriptBuiltinFunc::get_func_name(BuiltinFunc p_func) { + + ERR_FAIL_INDEX_V(p_func,FUNC_MAX,String()); + return func_name[p_func]; +} int VisualScriptBuiltinFunc::get_output_sequence_port_count() const { @@ -88,10 +103,10 @@ bool VisualScriptBuiltinFunc::has_input_sequence_port() const{ } -int VisualScriptBuiltinFunc::get_input_value_port_count() const{ +int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) { - switch(func) { + switch(p_func) { case MATH_RANDOMIZE: case MATH_RAND: @@ -157,6 +172,11 @@ int VisualScriptBuiltinFunc::get_input_value_port_count() const{ } return 0; } + +int VisualScriptBuiltinFunc::get_input_value_port_count() const{ + + return get_func_argument_count(func); +} int VisualScriptBuiltinFunc::get_output_value_port_count() const{ switch(func) { @@ -560,118 +580,124 @@ VisualScriptBuiltinFunc::BuiltinFunc VisualScriptBuiltinFunc::get_func() { r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;\ r_error.argument=m_arg;\ r_error.expected=Variant::REAL;\ - return 0;\ + return;\ } -class VisualScriptNodeInstanceBuiltinFunc : public VisualScriptNodeInstance { -public: - VisualScriptBuiltinFunc *node; - VisualScriptInstance *instance; +void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func,const Variant** p_inputs,Variant* r_return,Variant::CallError& r_error,String& r_error_str) { - VisualScriptBuiltinFunc::BuiltinFunc func; + switch(p_func) { + case VisualScriptBuiltinFunc::MATH_SIN: { + VALIDATE_ARG_NUM(0); + *r_return=Math::sin(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_COS: { - //virtual int get_working_memory_size() const { return 0; } - //virtual bool is_output_port_unsequenced(int p_idx) const { return false; } - //virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; } + VALIDATE_ARG_NUM(0); + *r_return=Math::cos(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_TAN: { - virtual int step(const Variant** p_inputs,Variant** p_outputs,StartMode p_start_mode,Variant* p_working_mem,Variant::CallError& r_error,String& r_error_str) { + VALIDATE_ARG_NUM(0); + *r_return=Math::tan(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_SINH: { - switch(func) { - case VisualScriptBuiltinFunc::MATH_SIN: { + VALIDATE_ARG_NUM(0); + *r_return=Math::sinh(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_COSH: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::sin(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_COS: { + VALIDATE_ARG_NUM(0); + *r_return=Math::cosh(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_TANH: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::cos(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_TAN: { + VALIDATE_ARG_NUM(0); + *r_return=Math::tanh(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_ASIN: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::tan(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_SINH: { + VALIDATE_ARG_NUM(0); + *r_return=Math::asin(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_ACOS: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::sinh(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_COSH: { + VALIDATE_ARG_NUM(0); + *r_return=Math::acos(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_ATAN: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::cosh(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_TANH: { + VALIDATE_ARG_NUM(0); + *r_return=Math::atan(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_ATAN2: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::tanh(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_ASIN: { + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + *r_return=Math::atan2(*p_inputs[0],*p_inputs[1]); + } break; + case VisualScriptBuiltinFunc::MATH_SQRT: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::asin(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_ACOS: { + VALIDATE_ARG_NUM(0); + *r_return=Math::sqrt(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_FMOD: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::acos(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_ATAN: { + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + *r_return=Math::fmod(*p_inputs[0],*p_inputs[1]); + } break; + case VisualScriptBuiltinFunc::MATH_FPOSMOD: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::atan(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_ATAN2: { + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + *r_return=Math::fposmod(*p_inputs[0],*p_inputs[1]); + } break; + case VisualScriptBuiltinFunc::MATH_FLOOR: { - VALIDATE_ARG_NUM(0); - VALIDATE_ARG_NUM(1); - *p_outputs[0]=Math::atan2(*p_inputs[0],*p_inputs[1]); - } break; - case VisualScriptBuiltinFunc::MATH_SQRT: { + VALIDATE_ARG_NUM(0); + *r_return=Math::floor(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_CEIL: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::sqrt(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_FMOD: { + VALIDATE_ARG_NUM(0); + *r_return=Math::ceil(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_ROUND: { - VALIDATE_ARG_NUM(0); - VALIDATE_ARG_NUM(1); - *p_outputs[0]=Math::fmod(*p_inputs[0],*p_inputs[1]); - } break; - case VisualScriptBuiltinFunc::MATH_FPOSMOD: { + VALIDATE_ARG_NUM(0); + *r_return=Math::round(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_ABS: { - VALIDATE_ARG_NUM(0); - VALIDATE_ARG_NUM(1); - *p_outputs[0]=Math::fposmod(*p_inputs[0],*p_inputs[1]); - } break; - case VisualScriptBuiltinFunc::MATH_FLOOR: { + if (p_inputs[0]->get_type()==Variant::INT) { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::floor(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_CEIL: { + int64_t i = *p_inputs[0]; + *r_return=ABS(i); + } else if (p_inputs[0]->get_type()==Variant::REAL) { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::ceil(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_ROUND: { + real_t r = *p_inputs[0]; + *r_return=Math::abs(r); + } else { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::round(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_ABS: { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::REAL; + + } + } break; + case VisualScriptBuiltinFunc::MATH_SIGN: { if (p_inputs[0]->get_type()==Variant::INT) { int64_t i = *p_inputs[0]; - *p_outputs[0]=ABS(i); + *r_return= i < 0 ? -1 : ( i > 0 ? +1 : 0); } else if (p_inputs[0]->get_type()==Variant::REAL) { real_t r = *p_inputs[0]; - *p_outputs[0]=Math::abs(r); + *r_return= r < 0.0 ? -1.0 : ( r > 0.0 ? +1.0 : 0.0); } else { r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; @@ -679,410 +705,412 @@ public: r_error.expected=Variant::REAL; } - } break; - case VisualScriptBuiltinFunc::MATH_SIGN: { + } break; + case VisualScriptBuiltinFunc::MATH_POW: { - if (p_inputs[0]->get_type()==Variant::INT) { + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + *r_return=Math::pow(*p_inputs[0],*p_inputs[1]); + } break; + case VisualScriptBuiltinFunc::MATH_LOG: { - int64_t i = *p_inputs[0]; - *p_outputs[0]= i < 0 ? -1 : ( i > 0 ? +1 : 0); - } else if (p_inputs[0]->get_type()==Variant::REAL) { + VALIDATE_ARG_NUM(0); + *r_return=Math::log(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_EXP: { - real_t r = *p_inputs[0]; - *p_outputs[0]= r < 0.0 ? -1.0 : ( r > 0.0 ? +1.0 : 0.0); - } else { + VALIDATE_ARG_NUM(0); + *r_return=Math::exp(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_ISNAN: { - r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; - r_error.argument=0; - r_error.expected=Variant::REAL; + VALIDATE_ARG_NUM(0); + *r_return=Math::is_nan(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_ISINF: { - } - } break; - case VisualScriptBuiltinFunc::MATH_POW: { + VALIDATE_ARG_NUM(0); + *r_return=Math::is_inf(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_EASE: { - VALIDATE_ARG_NUM(0); - VALIDATE_ARG_NUM(1); - *p_outputs[0]=Math::pow(*p_inputs[0],*p_inputs[1]); - } break; - case VisualScriptBuiltinFunc::MATH_LOG: { + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + *r_return=Math::ease(*p_inputs[0],*p_inputs[1]); + } break; + case VisualScriptBuiltinFunc::MATH_DECIMALS: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::log(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_EXP: { + VALIDATE_ARG_NUM(0); + *r_return=Math::step_decimals(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_STEPIFY: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::exp(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_ISNAN: { + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + *r_return=Math::stepify(*p_inputs[0],*p_inputs[1]); + } break; + case VisualScriptBuiltinFunc::MATH_LERP: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::is_nan(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_ISINF: { + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + VALIDATE_ARG_NUM(2); + *r_return=Math::lerp(*p_inputs[0],*p_inputs[1],*p_inputs[2]); + } break; + case VisualScriptBuiltinFunc::MATH_DECTIME: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::is_inf(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_EASE: { + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + VALIDATE_ARG_NUM(2); + *r_return=Math::dectime(*p_inputs[0],*p_inputs[1],*p_inputs[2]); + } break; + case VisualScriptBuiltinFunc::MATH_RANDOMIZE: { + Math::randomize(); - VALIDATE_ARG_NUM(0); - VALIDATE_ARG_NUM(1); - *p_outputs[0]=Math::ease(*p_inputs[0],*p_inputs[1]); - } break; - case VisualScriptBuiltinFunc::MATH_DECIMALS: { + } break; + case VisualScriptBuiltinFunc::MATH_RAND: { + *r_return=Math::rand(); + } break; + case VisualScriptBuiltinFunc::MATH_RANDF: { + *r_return=Math::randf(); + } break; + case VisualScriptBuiltinFunc::MATH_RANDOM: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::step_decimals(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_STEPIFY: { + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + *r_return=Math::random(*p_inputs[0],*p_inputs[1]); + } break; + case VisualScriptBuiltinFunc::MATH_SEED: { - VALIDATE_ARG_NUM(0); - VALIDATE_ARG_NUM(1); - *p_outputs[0]=Math::stepify(*p_inputs[0],*p_inputs[1]); - } break; - case VisualScriptBuiltinFunc::MATH_LERP: { + VALIDATE_ARG_NUM(0); + uint32_t seed=*p_inputs[0]; + Math::seed(seed); - VALIDATE_ARG_NUM(0); - VALIDATE_ARG_NUM(1); - VALIDATE_ARG_NUM(2); - *p_outputs[0]=Math::lerp(*p_inputs[0],*p_inputs[1],*p_inputs[2]); - } break; - case VisualScriptBuiltinFunc::MATH_DECTIME: { + } break; + case VisualScriptBuiltinFunc::MATH_RANDSEED: { - VALIDATE_ARG_NUM(0); - VALIDATE_ARG_NUM(1); - VALIDATE_ARG_NUM(2); - *p_outputs[0]=Math::dectime(*p_inputs[0],*p_inputs[1],*p_inputs[2]); - } break; - case VisualScriptBuiltinFunc::MATH_RANDOMIZE: { - Math::randomize(); - - } break; - case VisualScriptBuiltinFunc::MATH_RAND: { - *p_outputs[0]=Math::rand(); - } break; - case VisualScriptBuiltinFunc::MATH_RANDF: { - *p_outputs[0]=Math::randf(); - } break; - case VisualScriptBuiltinFunc::MATH_RANDOM: { + VALIDATE_ARG_NUM(0); + uint32_t seed=*p_inputs[0]; + int ret = Math::rand_from_seed(&seed); + Array reta; + reta.push_back(ret); + reta.push_back(seed); + *r_return=reta; - VALIDATE_ARG_NUM(0); - VALIDATE_ARG_NUM(1); - *p_outputs[0]=Math::random(*p_inputs[0],*p_inputs[1]); - } break; - case VisualScriptBuiltinFunc::MATH_SEED: { + } break; + case VisualScriptBuiltinFunc::MATH_DEG2RAD: { - VALIDATE_ARG_NUM(0); - uint32_t seed=*p_inputs[0]; - Math::seed(seed); + VALIDATE_ARG_NUM(0); + *r_return=Math::deg2rad(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_RAD2DEG: { - } break; - case VisualScriptBuiltinFunc::MATH_RANDSEED: { + VALIDATE_ARG_NUM(0); + *r_return=Math::rad2deg(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_LINEAR2DB: { - VALIDATE_ARG_NUM(0); - uint32_t seed=*p_inputs[0]; - int ret = Math::rand_from_seed(&seed); - Array reta; - reta.push_back(ret); - reta.push_back(seed); - *p_outputs[0]=reta; + VALIDATE_ARG_NUM(0); + *r_return=Math::linear2db(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::MATH_DB2LINEAR: { - } break; - case VisualScriptBuiltinFunc::MATH_DEG2RAD: { + VALIDATE_ARG_NUM(0); + *r_return=Math::db2linear(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::LOGIC_MAX: { - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::deg2rad(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_RAD2DEG: { + if (p_inputs[0]->get_type()==Variant::INT && p_inputs[1]->get_type()==Variant::INT) { + int64_t a = *p_inputs[0]; + int64_t b = *p_inputs[1]; + *r_return=MAX(a,b); + } else { VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::rad2deg(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_LINEAR2DB: { + VALIDATE_ARG_NUM(1); - VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::linear2db(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::MATH_DB2LINEAR: { + real_t a = *p_inputs[0]; + real_t b = *p_inputs[1]; + + *r_return=MAX(a,b); + } + } break; + case VisualScriptBuiltinFunc::LOGIC_MIN: { + + if (p_inputs[0]->get_type()==Variant::INT && p_inputs[1]->get_type()==Variant::INT) { + + int64_t a = *p_inputs[0]; + int64_t b = *p_inputs[1]; + *r_return=MIN(a,b); + } else { VALIDATE_ARG_NUM(0); - *p_outputs[0]=Math::db2linear(*p_inputs[0]); - } break; - case VisualScriptBuiltinFunc::LOGIC_MAX: { + VALIDATE_ARG_NUM(1); - if (p_inputs[0]->get_type()==Variant::INT && p_inputs[1]->get_type()==Variant::INT) { + real_t a = *p_inputs[0]; + real_t b = *p_inputs[1]; - int64_t a = *p_inputs[0]; - int64_t b = *p_inputs[1]; - *p_outputs[0]=MAX(a,b); - } else { - VALIDATE_ARG_NUM(0); - VALIDATE_ARG_NUM(1); + *r_return=MIN(a,b); + } + } break; + case VisualScriptBuiltinFunc::LOGIC_CLAMP: { - real_t a = *p_inputs[0]; - real_t b = *p_inputs[1]; + if (p_inputs[0]->get_type()==Variant::INT && p_inputs[1]->get_type()==Variant::INT && p_inputs[2]->get_type()==Variant::INT) { - *p_outputs[0]=MAX(a,b); - } + int64_t a = *p_inputs[0]; + int64_t b = *p_inputs[1]; + int64_t c = *p_inputs[2]; + *r_return=CLAMP(a,b,c); + } else { + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + VALIDATE_ARG_NUM(2); - } break; - case VisualScriptBuiltinFunc::LOGIC_MIN: { + real_t a = *p_inputs[0]; + real_t b = *p_inputs[1]; + real_t c = *p_inputs[2]; - if (p_inputs[0]->get_type()==Variant::INT && p_inputs[1]->get_type()==Variant::INT) { + *r_return=CLAMP(a,b,c); + } + } break; + case VisualScriptBuiltinFunc::LOGIC_NEAREST_PO2: { - int64_t a = *p_inputs[0]; - int64_t b = *p_inputs[1]; - *p_outputs[0]=MIN(a,b); - } else { - VALIDATE_ARG_NUM(0); - VALIDATE_ARG_NUM(1); + VALIDATE_ARG_NUM(0); + int64_t num = *p_inputs[0]; + *r_return = nearest_power_of_2(num); + } break; + case VisualScriptBuiltinFunc::OBJ_WEAKREF: { - real_t a = *p_inputs[0]; - real_t b = *p_inputs[1]; + if (p_inputs[0]->get_type()!=Variant::OBJECT) { - *p_outputs[0]=MIN(a,b); - } - } break; - case VisualScriptBuiltinFunc::LOGIC_CLAMP: { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::OBJECT; - if (p_inputs[0]->get_type()==Variant::INT && p_inputs[1]->get_type()==Variant::INT && p_inputs[2]->get_type()==Variant::INT) { + return; - int64_t a = *p_inputs[0]; - int64_t b = *p_inputs[1]; - int64_t c = *p_inputs[2]; - *p_outputs[0]=CLAMP(a,b,c); - } else { - VALIDATE_ARG_NUM(0); - VALIDATE_ARG_NUM(1); - VALIDATE_ARG_NUM(2); + } - real_t a = *p_inputs[0]; - real_t b = *p_inputs[1]; - real_t c = *p_inputs[2]; + if (p_inputs[0]->is_ref()) { - *p_outputs[0]=CLAMP(a,b,c); + REF r = *p_inputs[0]; + if (!r.is_valid()) { + + return; } - } break; - case VisualScriptBuiltinFunc::LOGIC_NEAREST_PO2: { - VALIDATE_ARG_NUM(0); - int64_t num = *p_inputs[0]; - *p_outputs[0] = nearest_power_of_2(num); - } break; - case VisualScriptBuiltinFunc::OBJ_WEAKREF: { + Ref<WeakRef> wref = memnew( WeakRef ); + wref->set_ref(r); + *r_return=wref; + } else { + Object *obj = *p_inputs[0]; + if (!obj) { - if (p_inputs[0]->get_type()!=Variant::OBJECT) { + return; + } + Ref<WeakRef> wref = memnew( WeakRef ); + wref->set_obj(obj); + *r_return=wref; + } - r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; - r_error.argument=0; - r_error.expected=Variant::OBJECT; - return 0; - } - if (p_inputs[0]->is_ref()) { + } break; + case VisualScriptBuiltinFunc::FUNC_FUNCREF: { - REF r = *p_inputs[0]; - if (!r.is_valid()) { + if (p_inputs[0]->get_type()!=Variant::OBJECT) { - return 0; - } + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::OBJECT; - Ref<WeakRef> wref = memnew( WeakRef ); - wref->set_ref(r); - *p_outputs[0]=wref; - } else { - Object *obj = *p_inputs[0]; - if (!obj) { - - return 0; - } - Ref<WeakRef> wref = memnew( WeakRef ); - wref->set_obj(obj); - *p_outputs[0]=wref; - } + return; + } + if (p_inputs[1]->get_type()!=Variant::STRING && p_inputs[1]->get_type()!=Variant::NODE_PATH) { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=1; + r_error.expected=Variant::STRING; + return; - } break; - case VisualScriptBuiltinFunc::FUNC_FUNCREF: { + } - if (p_inputs[0]->get_type()!=Variant::OBJECT) { + Ref<FuncRef> fr = memnew( FuncRef); - r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; - r_error.argument=0; - r_error.expected=Variant::OBJECT; + fr->set_instance(*p_inputs[0]); + fr->set_function(*p_inputs[1]); - return 0; + *r_return=fr; - } - if (p_inputs[1]->get_type()!=Variant::STRING && p_inputs[1]->get_type()!=Variant::NODE_PATH) { + } break; + case VisualScriptBuiltinFunc::TYPE_CONVERT: { - r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; - r_error.argument=1; - r_error.expected=Variant::STRING; + VALIDATE_ARG_NUM(1); + int type=*p_inputs[1]; + if (type<0 || type>=Variant::VARIANT_MAX) { - return 0; + r_error_str=RTR("Invalid type argument to convert(), use TYPE_* constants."); + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::INT; + return; - } + } else { - Ref<FuncRef> fr = memnew( FuncRef); - fr->set_instance(*p_inputs[0]); - fr->set_function(*p_inputs[1]); + *r_return=Variant::construct(Variant::Type(type),p_inputs,1,r_error); + } + } break; + case VisualScriptBuiltinFunc::TYPE_OF: { - *p_outputs[0]=fr; - } break; - case VisualScriptBuiltinFunc::TYPE_CONVERT: { + *r_return = p_inputs[0]->get_type(); - VALIDATE_ARG_NUM(1); - int type=*p_inputs[1]; - if (type<0 || type>=Variant::VARIANT_MAX) { + } break; + case VisualScriptBuiltinFunc::TYPE_EXISTS: { - *p_outputs[0]=RTR("Invalid type argument to convert(), use TYPE_* constants."); - r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; - r_error.argument=0; - r_error.expected=Variant::INT; - return 0; - } else { + *r_return = ObjectTypeDB::type_exists(*p_inputs[0]); + } break; + case VisualScriptBuiltinFunc::TEXT_STR: { - *p_outputs[0]=Variant::construct(Variant::Type(type),p_inputs,1,r_error); - } - } break; - case VisualScriptBuiltinFunc::TYPE_OF: { + String str = *p_inputs[0]; + + *r_return=str; + } break; + case VisualScriptBuiltinFunc::TEXT_PRINT: { - *p_outputs[0] = p_inputs[0]->get_type(); + String str = *p_inputs[0]; + print_line(str); - } break; - case VisualScriptBuiltinFunc::TYPE_EXISTS: { + } break; - *p_outputs[0] = ObjectTypeDB::type_exists(*p_inputs[0]); + case VisualScriptBuiltinFunc::TEXT_PRINTERR: { - } break; - case VisualScriptBuiltinFunc::TEXT_STR: { + String str = *p_inputs[0]; - String str = *p_inputs[0]; + //str+="\n"; + OS::get_singleton()->printerr("%s\n",str.utf8().get_data()); - *p_outputs[0]=str; - } break; - case VisualScriptBuiltinFunc::TEXT_PRINT: { + } break; + case VisualScriptBuiltinFunc::TEXT_PRINTRAW: { + String str = *p_inputs[0]; - String str = *p_inputs[0]; - print_line(str); + //str+="\n"; + OS::get_singleton()->print("%s",str.utf8().get_data()); - } break; + } break; + case VisualScriptBuiltinFunc::VAR_TO_STR: { - case VisualScriptBuiltinFunc::TEXT_PRINTERR: { + String vars; + VariantWriter::write_to_string(*p_inputs[0],vars); + *r_return=vars; + } break; + case VisualScriptBuiltinFunc::STR_TO_VAR: { - String str = *p_inputs[0]; + if (p_inputs[0]->get_type()!=Variant::STRING) { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::STRING; - //str+="\n"; - OS::get_singleton()->printerr("%s\n",str.utf8().get_data()); + return; + } + VariantParser::StreamString ss; + ss.s=*p_inputs[0]; - } break; - case VisualScriptBuiltinFunc::TEXT_PRINTRAW: { - String str = *p_inputs[0]; + String errs; + int line; + Error err = VariantParser::parse(&ss,*r_return,errs,line); - //str+="\n"; - OS::get_singleton()->print("%s",str.utf8().get_data()); + if (err!=OK) { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::STRING; + *r_return="Parse error at line "+itos(line)+": "+errs; + return; + } + } break; + case VisualScriptBuiltinFunc::VAR_TO_BYTES: { - } break; - case VisualScriptBuiltinFunc::VAR_TO_STR: { - String vars; - VariantWriter::write_to_string(*p_inputs[0],vars); - *p_outputs[0]=vars; - } break; - case VisualScriptBuiltinFunc::STR_TO_VAR: { + ByteArray barr; + int len; + Error err = encode_variant(*p_inputs[0],NULL,len); + if (err) { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::NIL; + r_error_str="Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID)."; + return; + } - if (p_inputs[0]->get_type()!=Variant::STRING) { - r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; - r_error.argument=0; - r_error.expected=Variant::STRING; + barr.resize(len); + { + ByteArray::Write w = barr.write(); + encode_variant(*p_inputs[0],w.ptr(),len); - return 0; - } + } + *r_return=barr; + } break; + case VisualScriptBuiltinFunc::BYTES_TO_VAR: { - VariantParser::StreamString ss; - ss.s=*p_inputs[0]; + if (p_inputs[0]->get_type()!=Variant::RAW_ARRAY) { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::RAW_ARRAY; - String errs; - int line; - Error err = VariantParser::parse(&ss,*p_outputs[0],errs,line); + return; + } + ByteArray varr=*p_inputs[0]; + Variant ret; + { + ByteArray::Read r=varr.read(); + Error err = decode_variant(ret,r.ptr(),varr.size(),NULL); if (err!=OK) { + r_error_str=RTR("Not enough bytes for decoding bytes, or invalid format."); r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument=0; - r_error.expected=Variant::STRING; - *p_outputs[0]="Parse error at line "+itos(line)+": "+errs; - return 0; + r_error.expected=Variant::RAW_ARRAY; + return; } - } break; - case VisualScriptBuiltinFunc::VAR_TO_BYTES: { + } + *r_return=ret; - ByteArray barr; - int len; - Error err = encode_variant(*p_inputs[0],NULL,len); - if (err) { - r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; - r_error.argument=0; - r_error.expected=Variant::NIL; - *p_outputs[0]="Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID)."; - return 0; - } + } break; + default: {} + } - barr.resize(len); - { - ByteArray::Write w = barr.write(); - encode_variant(*p_inputs[0],w.ptr(),len); +} - } - *p_outputs[0]=barr; - } break; - case VisualScriptBuiltinFunc::BYTES_TO_VAR: { - if (p_inputs[0]->get_type()!=Variant::RAW_ARRAY) { - r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; - r_error.argument=0; - r_error.expected=Variant::RAW_ARRAY; +class VisualScriptNodeInstanceBuiltinFunc : public VisualScriptNodeInstance { +public: - return 0; - } + VisualScriptBuiltinFunc *node; + VisualScriptInstance *instance; - ByteArray varr=*p_inputs[0]; - Variant ret; - { - ByteArray::Read r=varr.read(); - Error err = decode_variant(ret,r.ptr(),varr.size(),NULL); - if (err!=OK) { - *p_outputs[0]=RTR("Not enough bytes for decoding bytes, or invalid format."); - r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; - r_error.argument=0; - r_error.expected=Variant::RAW_ARRAY; - return 0; - } + VisualScriptBuiltinFunc::BuiltinFunc func; - } - *p_outputs[0]=ret; + //virtual int get_working_memory_size() const { return 0; } + //virtual bool is_output_port_unsequenced(int p_idx) const { return false; } + //virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; } + + virtual int step(const Variant** p_inputs,Variant** p_outputs,StartMode p_start_mode,Variant* p_working_mem,Variant::CallError& r_error,String& r_error_str) { - } break; - default: {} - } + VisualScriptBuiltinFunc::exec_func(func,p_inputs,p_outputs[0],r_error,r_error_str); return 0; } diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h index ebf227a192..000230d84f 100644 --- a/modules/visual_script/visual_script_builtin_funcs.h +++ b/modules/visual_script/visual_script_builtin_funcs.h @@ -68,6 +68,11 @@ public: FUNC_MAX }; + static int get_func_argument_count(BuiltinFunc p_func); + static String get_func_name(BuiltinFunc p_func); + static void exec_func(BuiltinFunc p_func, const Variant** p_inputs, Variant* r_return, Variant::CallError& r_error, String& r_error_str); + static BuiltinFunc find_function(const String& p_string); + private: static const char* func_name[FUNC_MAX]; BuiltinFunc func; diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 14708799af..02d3c453c4 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -331,7 +331,7 @@ static Color _color_from_type(Variant::Type p_type) { case Variant::QUAT: color = Color::html("ec69a3"); break; case Variant::_AABB: color = Color::html("ee7991"); break; case Variant::MATRIX3: color = Color::html("e3ec69"); break; - case Variant::TRANSFORM: color = Color::html("ecd669"); break; + case Variant::TRANSFORM: color = Color::html("f6a86e"); break; case Variant::COLOR: color = Color::html("9dff70"); break; case Variant::IMAGE: color = Color::html("93f1b9"); break; @@ -503,13 +503,21 @@ void VisualScriptEditor::_update_graph(int p_only_id) { } - Label *text = memnew( Label ); - text->set_text(node->get_text()); - gnode->add_child(text); if (node->cast_to<VisualScriptExpression>()) { - text->add_font_override("font",get_font("source","EditorFonts")); + + LineEdit *line_edit = memnew( LineEdit ); + line_edit->set_text(node->get_text()); + line_edit->set_expand_to_text_length(true); + line_edit->add_font_override("font",get_font("source","EditorFonts")); + gnode->add_child(line_edit); + line_edit->connect("text_changed",this,"_expression_text_changed",varray(E->get())); + } else { + Label *text = memnew( Label ); + text->set_text(node->get_text()); + gnode->add_child(text); } + if (node->cast_to<VisualScriptComment>()) { Ref<VisualScriptComment> vsc=node; gnode->set_comment(true); @@ -1201,6 +1209,30 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt } } +void VisualScriptEditor::_expression_text_changed(const String& p_text,int p_id) { + + Ref<VisualScriptExpression> vse = script->get_node(edited_func,p_id); + if (!vse.is_valid()) + return; + + + updating_graph=true; + + undo_redo->create_action(TTR("Change Expression"),UndoRedo::MERGE_ENDS); + undo_redo->add_do_property(vse.ptr(),"expression",p_text); + undo_redo->add_undo_property(vse.ptr(),"expression",vse->get("expression")); + undo_redo->add_do_method(this,"_update_graph",p_id); + undo_redo->add_undo_method(this,"_update_graph",p_id); + undo_redo->commit_action(); + + Node *node = graph->get_node(itos(p_id)); + if (node->cast_to<Control>()) + node->cast_to<Control>()->set_size(Vector2(1,1)); //shrink if text is smaller + + updating_graph=false; + +} + void VisualScriptEditor::_available_node_doubleclicked() { TreeItem *item = nodes->get_selected(); @@ -2108,6 +2140,7 @@ Vector<String> VisualScriptEditor::get_functions(){ void VisualScriptEditor::set_edited_script(const Ref<Script>& p_script){ + script=p_script; signal_editor->script=p_script; signal_editor->undo_redo=undo_redo; @@ -3224,6 +3257,7 @@ void VisualScriptEditor::_bind_methods() { ObjectTypeDB::bind_method("_button_resource_previewed",&VisualScriptEditor::_button_resource_previewed); ObjectTypeDB::bind_method("_port_action_menu",&VisualScriptEditor::_port_action_menu); ObjectTypeDB::bind_method("_selected_connect_node_method_or_setget",&VisualScriptEditor::_selected_connect_node_method_or_setget); + ObjectTypeDB::bind_method("_expression_text_changed",&VisualScriptEditor::_expression_text_changed); diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index 5191ed540a..483ae1644c 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -168,6 +168,7 @@ class VisualScriptEditor : public ScriptEditorBase { void _member_button(Object *p_item, int p_column, int p_button); + void _expression_text_changed(const String& p_text,int p_id); String revert_on_drag; diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp index 3cfb1c154e..cc3b5f2174 100644 --- a/modules/visual_script/visual_script_expression.cpp +++ b/modules/visual_script/visual_script_expression.cpp @@ -120,7 +120,7 @@ void VisualScriptExpression::_get_property_list( List<PropertyInfo> *p_list) con argt+=","+Variant::get_type_name(Variant::Type(i)); } - p_list->push_back(PropertyInfo(Variant::STRING,"expression")); + p_list->push_back(PropertyInfo(Variant::STRING,"expression",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR)); p_list->push_back(PropertyInfo(Variant::INT,"out_type",PROPERTY_HINT_ENUM,argt)); p_list->push_back(PropertyInfo(Variant::INT,"input_count",PROPERTY_HINT_RANGE,"0,64,1")); p_list->push_back(PropertyInfo(Variant::BOOL,"sequenced")); @@ -577,6 +577,13 @@ Error VisualScriptExpression::_get_token(Token& r_token) { } } + VisualScriptBuiltinFunc::BuiltinFunc bifunc = VisualScriptBuiltinFunc::find_function(id); + if (bifunc!=VisualScriptBuiltinFunc::FUNC_MAX) { + r_token.type=TK_BUILTIN_FUNC; + r_token.value=bifunc; + return OK; + } + r_token.type=TK_IDENTIFIER; r_token.value=id; } @@ -603,6 +610,7 @@ const char* VisualScriptExpression::token_name[TK_MAX]={ "PARENTHESIS OPEN", "PARENTHESIS CLOSE", "IDENTIFIER", +"BUILTIN FUNC", "SELF", "CONSTANT", "BASIC TYPE", @@ -814,6 +822,53 @@ VisualScriptExpression::ENode* VisualScriptExpression::_parse_expression() { expr=constructor; } break; + case TK_BUILTIN_FUNC: { + //builtin function + + Variant::Type bt = Variant::Type(int(tk.value)); + _get_token(tk); + if (tk.type!=TK_PARENTHESIS_OPEN) { + _set_error("Expected '('"); + return NULL; + } + + BuiltinFuncNode *bifunc = alloc_node<BuiltinFuncNode>(); + bifunc->func=VisualScriptBuiltinFunc::BuiltinFunc(int(tk.value)); + + while(true) { + + int cofs=str_ofs; + _get_token(tk); + if (tk.type==TK_PARENTHESIS_CLOSE) { + break; + } + str_ofs=cofs; //revert + //parse an expression + ENode* expr=_parse_expression(); + if (!expr) + return NULL; + + bifunc->arguments.push_back(expr); + + cofs=str_ofs; + _get_token(tk); + if (tk.type==TK_COMMA) { + //all good + } else if (tk.type==TK_PARENTHESIS_CLOSE) { + str_ofs=cofs; + } else { + _set_error("Expected ',' or ')'"); + } + } + + int expected_args = VisualScriptBuiltinFunc::get_func_argument_count(bifunc->func); + if (bifunc->arguments.size() != expected_args) { + _set_error("Builtin func '"+VisualScriptBuiltinFunc::get_func_name(bifunc->func)+"' expects "+itos(expected_args)+" arguments."); + } + + expr=bifunc; + + } break; case TK_OP_SUB: { Expression e; @@ -1338,6 +1393,34 @@ public: } break; + case VisualScriptExpression::ENode::TYPE_BUILTIN_FUNC: { + + const VisualScriptExpression::BuiltinFuncNode *bifunc = static_cast<const VisualScriptExpression::BuiltinFuncNode*>(p_node); + + Vector<Variant> arr; + Vector<const Variant*> argp; + arr.resize(bifunc->arguments.size()); + argp.resize(bifunc->arguments.size()); + + for (int i=0;i<bifunc->arguments.size();i++) { + + Variant value; + bool ret = _execute(p_inputs,bifunc->arguments[i],value,r_error_str,ce); + if (ret) + return true; + arr[i]=value; + argp[i]=&arr[i]; + } + + + VisualScriptBuiltinFunc::exec_func(bifunc->func,argp.ptr(),&r_ret,ce,r_error_str); + + if (ce.error!=Variant::CallError::CALL_OK) { + r_error_str="Builtin Call Failed. "+r_error_str; + return true; + } + + } break; case VisualScriptExpression::ENode::TYPE_CALL: { const VisualScriptExpression::CallNode *call = static_cast<const VisualScriptExpression::CallNode*>(p_node); @@ -1396,8 +1479,8 @@ public: r_error_str+="Can't convert expression result from "+Variant::get_type_name(p_outputs[0]->get_type())+" to "+Variant::get_type_name(expression->output_type)+"."; r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD; -#endif } +#endif return 0; } diff --git a/modules/visual_script/visual_script_expression.h b/modules/visual_script/visual_script_expression.h index 90b955b5da..4edae133c7 100644 --- a/modules/visual_script/visual_script_expression.h +++ b/modules/visual_script/visual_script_expression.h @@ -2,6 +2,7 @@ #define VISUALSCRIPTEXPRESSION_H #include "visual_script.h" +#include "visual_script_builtin_funcs.h" class VisualScriptExpression : public VisualScriptNode { @@ -35,6 +36,7 @@ friend class VisualScriptNodeInstanceExpression; TK_PARENTHESIS_OPEN, TK_PARENTHESIS_CLOSE, TK_IDENTIFIER, + TK_BUILTIN_FUNC, TK_SELF, TK_CONSTANT, TK_BASIC_TYPE, @@ -101,6 +103,7 @@ friend class VisualScriptNodeInstanceExpression; TYPE_ARRAY, TYPE_DICTIONARY, TYPE_CONSTRUCTOR, + TYPE_BUILTIN_FUNC, TYPE_CALL }; @@ -214,6 +217,14 @@ friend class VisualScriptNodeInstanceExpression; }; + struct BuiltinFuncNode : public ENode { + VisualScriptBuiltinFunc::BuiltinFunc func; + Vector<ENode*> arguments; + BuiltinFuncNode() { + type=TYPE_BUILTIN_FUNC; + } + }; + template<class T> T* alloc_node() { T* node = memnew(T); diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index de99beacaf..5a21cb40e9 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -417,6 +417,14 @@ void VisualScriptFunctionCall::_update_method_cache() { method_cache.return_val = mb->get_argument_info(-1); #endif + + if (mb->is_vararg()) { + //for vararg just give it 10 arguments (should be enough for most use cases) + for(int i=0;i<10;i++) { + method_cache.arguments.push_back(PropertyInfo(Variant::NIL,"arg"+itos(i))); + use_default_args++; + } + } } else if (script.is_valid() && script->has_method(function)) { method_cache = script->get_method_info(function); diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template index 24951b921b..873eef0566 100644 --- a/platform/android/build.gradle.template +++ b/platform/android/build.gradle.template @@ -67,7 +67,6 @@ android { $$GRADLE_ASSET_DIRS$$ ] jniLibs.srcDirs = [ - 'libs' $$GRADLE_JNI_DIRS$$ ] } diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 10d77aba6c..4735a91f43 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -495,7 +495,7 @@ static String _parse_string(const uint8_t *p_bytes,bool p_utf8) { Vector<uint8_t> str8; str8.resize(len+1); - for(int i=0;i<len;i++) { + for(uint32_t i=0;i<len;i++) { str8[i]=p_bytes[offset+i]; } str8[len]=0; @@ -505,7 +505,7 @@ static String _parse_string(const uint8_t *p_bytes,bool p_utf8) { } else { String str; - for(int i=0;i<len;i++) { + for(uint32_t i=0;i<len;i++) { CharType c = decode_uint16(&p_bytes[offset+i*2]); if (c==0) break; @@ -535,7 +535,7 @@ void EditorExportPlatformAndroid::_fix_resources(Vector<uint8_t>& p_manifest) { printf("stirng count: %i\n",string_count); printf("flags: %x\n",string_flags); - for(int i=0;i<string_count;i++) { + for(uint32_t i=0;i<string_count;i++) { uint32_t offset = decode_uint32(&p_manifest[string_table_begins+i*4]); offset+=string_table_begins+string_count*4; @@ -569,7 +569,7 @@ void EditorExportPlatformAndroid::_fix_resources(Vector<uint8_t>& p_manifest) { Vector<uint8_t> ret; ret.resize(string_table_begins+string_table.size()*4); - for(int i=0;i<string_table_begins;i++) { + for(uint32_t i=0;i<string_table_begins;i++) { ret[i]=p_manifest[i]; } @@ -660,7 +660,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool uint32_t filesize = decode_uint32(&p_manifest[ofs+4]); ofs+=8; -// print_line("FILESIZE: "+itos(filesize)+" ACTUAL: "+itos(p_manifest.size())); + //print_line("FILESIZE: "+itos(filesize)+" ACTUAL: "+itos(p_manifest.size())); uint32_t string_count; uint32_t styles_count; @@ -672,7 +672,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool uint32_t string_table_ends; Vector<uint8_t> stable_extra; - while(ofs < p_manifest.size()) { + while(ofs < (uint32_t)p_manifest.size()) { uint32_t chunk = decode_uint32(&p_manifest[ofs]); uint32_t size = decode_uint32(&p_manifest[ofs+4]); @@ -687,7 +687,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool string_count=decode_uint32(&p_manifest[iofs]); styles_count=decode_uint32(&p_manifest[iofs+4]); - uint32_t string_flags=decode_uint32(&p_manifest[iofs+8]); + string_flags=decode_uint32(&p_manifest[iofs+8]); string_data_offset=decode_uint32(&p_manifest[iofs+12]); styles_offset=decode_uint32(&p_manifest[iofs+16]); /* @@ -703,7 +703,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool string_table_begins=st_offset; - for(int i=0;i<string_count;i++) { + for(uint32_t i=0;i<string_count;i++) { uint32_t string_at = decode_uint32(&p_manifest[st_offset+i*4]); string_at+=st_offset+string_count*4; @@ -719,7 +719,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool uint32_t len = decode_uint16(&p_manifest[string_at]); Vector<CharType> ucstring; ucstring.resize(len+1); - for(int j=0;j<len;j++) { + for(uint32_t j=0;j<len;j++) { uint16_t c=decode_uint16(&p_manifest[string_at+2+2*j]); ucstring[j]=c; } @@ -732,7 +732,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool // print_line("String "+itos(i)+": "+string_table[i]); } - for(int i=string_end;i<(ofs+size);i++) { + for(uint32_t i=string_end;i<(ofs+size);i++) { stable_extra.push_back(p_manifest[i]); } @@ -758,7 +758,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool uint32_t attrcount=decode_uint32(&p_manifest[iofs+20]); iofs+=28; //printf("ATTRCOUNT: %x\n",attrcount); - for(int i=0;i<attrcount;i++) { + for(uint32_t i=0;i<attrcount;i++) { uint32_t attr_nspace=decode_uint32(&p_manifest[iofs]); uint32_t attr_name=decode_uint32(&p_manifest[iofs+4]); uint32_t attr_value=decode_uint32(&p_manifest[iofs+8]); @@ -883,7 +883,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool Vector<uint8_t> ret; ret.resize(string_table_begins+string_table.size()*4); - for(int i=0;i<string_table_begins;i++) { + for(uint32_t i=0;i<string_table_begins;i++) { ret[i]=p_manifest[i]; } @@ -913,21 +913,19 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool } - ret.resize(ret.size()+stable_extra.size()); - while(ret.size()%4) - ret.push_back(0); - for(int i=0;i<stable_extra.size();i++) { - - chars[i]=stable_extra[i]; + ret.push_back(stable_extra[i]); } + while(ret.size()%4) + ret.push_back(0); + uint32_t new_stable_end=ret.size(); uint32_t extra = (p_manifest.size()-string_table_ends); ret.resize(new_stable_end + extra); - for(int i=0;i<extra;i++) + for(uint32_t i=0;i<extra;i++) ret[new_stable_end+i]=p_manifest[string_table_ends+i]; while(ret.size()%4) @@ -1355,7 +1353,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d args.push_back(unaligned_path); args.push_back(user); int retval; - int err = OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval); + OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval); if (retval) { EditorNode::add_io_error("'jarsigner' returned with error #"+itos(retval)); return ERR_CANT_CREATE; @@ -1368,7 +1366,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d args.push_back(unaligned_path); args.push_back("-verbose"); - err = OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval); + OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval); if (retval) { EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use jarsigner from Java 6."); return ERR_CANT_CREATE; @@ -1515,7 +1513,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) { List<String> args; args.push_back("devices"); int ec; - Error err = OS::get_singleton()->execute(adb,args,true,NULL,&devices,&ec); + OS::get_singleton()->execute(adb,args,true,NULL,&devices,&ec); Vector<String> ds = devices.split("\n"); Vector<String> ldevices; for(int i=1;i<ds.size();i++) { @@ -1574,7 +1572,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) { int ec; String dp; - Error err = OS::get_singleton()->execute(adb,args,true,NULL,&dp,&ec); + OS::get_singleton()->execute(adb,args,true,NULL,&dp,&ec); Vector<String> props = dp.split("\n"); String vendor; diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 4e395a6f9f..862709fc7d 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -132,15 +132,10 @@ void OS_Android::initialize(const VideoMode& p_desired,int p_video_driver,int p_ AudioDriverManagerSW::add_driver(&audio_driver_android); - if (true) { - RasterizerGLES2 *rasterizer_gles22=memnew( RasterizerGLES2(false,use_reload_hooks,false,use_reload_hooks ) ); - if (gl_extensions) - rasterizer_gles22->set_extensions(gl_extensions); - rasterizer = rasterizer_gles22; - } else { - //rasterizer = memnew( RasterizerGLES1(use_reload_hooks, use_reload_hooks) ); - - } + RasterizerGLES2 *rasterizer_gles22=memnew( RasterizerGLES2(false,use_reload_hooks,false,use_reload_hooks ) ); + if (gl_extensions) + rasterizer_gles22->set_extensions(gl_extensions); + rasterizer = rasterizer_gles22; rasterizer->set_force_16_bits_fbo(use_16bits_fbo); diff --git a/platform/osx/SCsub b/platform/osx/SCsub index 3785eb3fb3..4169795519 100644 --- a/platform/osx/SCsub +++ b/platform/osx/SCsub @@ -7,6 +7,7 @@ files = [ 'sem_osx.cpp', # 'context_gl_osx.cpp', 'dir_access_osx.mm', + 'joystick_osx.cpp', ] env.Program('#bin/godot',files) diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 1982beb10e..01ea09fa21 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -92,7 +92,7 @@ def configure(env): env.Append(LIBS=['pthread']) #env.Append(CPPFLAGS=['-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-mmacosx-version-min=10.4']) #env.Append(LINKFLAGS=['-mmacosx-version-min=10.4', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk']) - env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit','-lz']) + env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit','-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback']) if (env["CXX"]=="clang++"): env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 47b0392b25..30f4c58150 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -445,7 +445,7 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug { //write datapack - int err = zipOpenNewFileInZip(dpkg, + zipOpenNewFileInZip(dpkg, (pkg_name+".app/Contents/Resources/data.pck").utf8().get_data(), NULL, NULL, diff --git a/platform/osx/joystick_osx.cpp b/platform/osx/joystick_osx.cpp new file mode 100644 index 0000000000..ffb6ac326b --- /dev/null +++ b/platform/osx/joystick_osx.cpp @@ -0,0 +1,623 @@ +/*************************************************************************/ +/* joystick_osx.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "joystick_osx.h" +#include <machine/endian.h> + +#define GODOT_JOY_LOOP_RUN_MODE CFSTR("GodotJoystick") + +static JoystickOSX* self = NULL; + +joystick::joystick() { + device_ref = NULL; + ff_device = NULL; + ff_axes = NULL; + ff_directions = NULL; + ffservice = 0; + ff_timestamp = 0; + id = 0; + + ff_constant_force.lMagnitude = 10000; + ff_effect.dwDuration = 0; + ff_effect.dwSamplePeriod = 0; + ff_effect.dwGain = 10000; + ff_effect.dwFlags = FFEFF_OBJECTOFFSETS; + ff_effect.dwTriggerButton = FFEB_NOTRIGGER; + ff_effect.dwStartDelay = 0; + ff_effect.dwTriggerRepeatInterval = 0; + ff_effect.lpEnvelope = NULL; + ff_effect.cbTypeSpecificParams = sizeof(FFCONSTANTFORCE); + ff_effect.lpvTypeSpecificParams = &ff_constant_force; + ff_effect.dwSize = sizeof(ff_effect); +} + +void joystick::free() { + if (device_ref) { + IOHIDDeviceUnscheduleFromRunLoop(device_ref, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE); + } + if (ff_device) { + FFDeviceReleaseEffect(ff_device, ff_object); + FFReleaseDevice(ff_device); + memfree(ff_axes); + memfree(ff_directions); + } +} + +bool joystick::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_list) const { + for (int i = 0; i < p_list->size(); i++) { + if (p_cookie == p_list->get(i).cookie) { + return true; + } + } + return false; +} + +int joystick::get_hid_element_state(rec_element *p_element) const { + int value = 0; + if (p_element && p_element->ref) { + IOHIDValueRef valueRef; + if (IOHIDDeviceGetValue(device_ref, p_element->ref, &valueRef) == kIOReturnSuccess) { + value = (SInt32) IOHIDValueGetIntegerValue(valueRef); + + /* record min and max for auto calibration */ + if (value < p_element->min) { + p_element->min = value; + } + if (value > p_element->max) { + p_element->max = value; + } + } + } + return value; +} +void joystick::add_hid_element(IOHIDElementRef p_element) { + const CFTypeID elementTypeID = p_element ? CFGetTypeID(p_element) : 0; + + if (p_element && (elementTypeID == IOHIDElementGetTypeID())) { + const IOHIDElementCookie cookie = IOHIDElementGetCookie(p_element); + const uint32_t usagePage = IOHIDElementGetUsagePage(p_element); + const uint32_t usage = IOHIDElementGetUsage(p_element); + Vector<rec_element> *list = NULL; + + switch (IOHIDElementGetType(p_element)) { + case kIOHIDElementTypeInput_Misc: + case kIOHIDElementTypeInput_Button: + case kIOHIDElementTypeInput_Axis: { + switch (usagePage) { + case kHIDPage_GenericDesktop: + switch (usage) { + case kHIDUsage_GD_X: + case kHIDUsage_GD_Y: + case kHIDUsage_GD_Z: + case kHIDUsage_GD_Rx: + case kHIDUsage_GD_Ry: + case kHIDUsage_GD_Rz: + case kHIDUsage_GD_Slider: + case kHIDUsage_GD_Dial: + case kHIDUsage_GD_Wheel: + if (!has_element(cookie, &axis_elements)) { + list = &axis_elements; + } + break; + + case kHIDUsage_GD_Hatswitch: + if (!has_element(cookie, &hat_elements)) { + list = &hat_elements; + } + break; + case kHIDUsage_GD_DPadUp: + case kHIDUsage_GD_DPadDown: + case kHIDUsage_GD_DPadRight: + case kHIDUsage_GD_DPadLeft: + case kHIDUsage_GD_Start: + case kHIDUsage_GD_Select: + if (!has_element(cookie, &button_elements)) { + list = &button_elements; + } + break; + } + break; + + case kHIDPage_Simulation: + switch (usage) { + case kHIDUsage_Sim_Rudder: + case kHIDUsage_Sim_Throttle: + if (!has_element(cookie, &axis_elements)) { + list = &axis_elements; + } + break; + + default: + break; + } + break; + + case kHIDPage_Button: + case kHIDPage_Consumer: + if (!has_element(cookie, &button_elements)) { + list = &button_elements; + } + break; + + default: + break; + } + } + break; + + case kIOHIDElementTypeCollection: { + CFArrayRef array = IOHIDElementGetChildren(p_element); + if (array) { + add_hid_elements(array); + } + } + break; + + default: + break; + } + + if (list) { /* add to list */ + rec_element element; + + element.ref = p_element; + element.usage = usage; + + element.min = (SInt32) IOHIDElementGetLogicalMin(p_element); + element.max = (SInt32) IOHIDElementGetLogicalMax(p_element); + element.cookie = IOHIDElementGetCookie(p_element); + list->push_back(element); + list->sort_custom<rec_element::Comparator>(); + } + } +} + +static void hid_element_added(const void *p_value, void *p_parameter) { + joystick *joy = (joystick*) p_parameter; + joy->add_hid_element((IOHIDElementRef) p_value); +} + +void joystick::add_hid_elements(CFArrayRef p_array) { + CFRange range = { 0, CFArrayGetCount(p_array) }; + CFArrayApplyFunction(p_array, range,hid_element_added,this); +} + +static void joystick_removed_callback(void *ctx, IOReturn result, void *sender) { + int id = (intptr_t) ctx; + self->_device_removed(id); +} + + +static void joystick_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) { + self->_device_added(res, ioHIDDeviceObject); +} + +static bool is_joystick(IOHIDDeviceRef p_device_ref) { + CFTypeRef refCF = NULL; + int usage_page = 0; + int usage = 0; + refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDPrimaryUsagePageKey)); + if (refCF) { + CFNumberGetValue((CFNumberRef) refCF, kCFNumberSInt32Type, &usage_page); + } + if (usage_page != kHIDPage_GenericDesktop) { + return false; + } + + refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDPrimaryUsageKey)); + if (refCF) { + CFNumberGetValue((CFNumberRef) refCF, kCFNumberSInt32Type, &usage); + } + if ((usage != kHIDUsage_GD_Joystick && + usage != kHIDUsage_GD_GamePad && + usage != kHIDUsage_GD_MultiAxisController)) { + return false; + } + return true; +} + +void JoystickOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) { + + if (p_res != kIOReturnSuccess || have_device(p_device)) { + return; + } + + joystick new_joystick; + if (is_joystick(p_device)) { + configure_joystick(p_device, &new_joystick); +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 + if (IOHIDDeviceGetService != NULL) { +#endif + const io_service_t ioservice = IOHIDDeviceGetService(p_device); + if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joystick.config_force_feedback(ioservice)) { + new_joystick.ffservice = ioservice; + } +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 + } +#endif + device_list.push_back(new_joystick); + } + IOHIDDeviceRegisterRemovalCallback(p_device, joystick_removed_callback, (void*) (intptr_t) new_joystick.id); + IOHIDDeviceScheduleWithRunLoop(p_device, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE); +} + +void JoystickOSX::_device_removed(int p_id) { + + int device = get_joy_index(p_id); + ERR_FAIL_COND(device == -1); + + input->joy_connection_changed(p_id, false, ""); + device_list[device].free(); + device_list.remove(device); + attached_devices[p_id] = false; +} + +static String _hex_str(uint8_t p_byte) { + + static const char* dict = "0123456789abcdef"; + char ret[3]; + ret[2] = 0; + + ret[0] = dict[p_byte>>4]; + ret[1] = dict[p_byte & 0xF]; + + return ret; +} + +bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_joy) { + + CFTypeRef refCF = NULL; + + p_joy->device_ref = p_device_ref; + /* get device name */ + String name; + char c_name[256]; + refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDProductKey)); + if (!refCF) { + refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDManufacturerKey)); + } + if ((!refCF) || (!CFStringGetCString((CFStringRef) refCF, c_name, sizeof (c_name), kCFStringEncodingUTF8))) { + name = "Unidentified Joystick"; + } + name = c_name; + + int id = get_free_joy_id(); + ERR_FAIL_COND_V(id == -1, false); + p_joy->id = id; + int vendor = 0; + refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDVendorIDKey)); + if (refCF) { + CFNumberGetValue((CFNumberRef)refCF, kCFNumberSInt32Type, &vendor); + } + + int product_id = 0; + refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDProductIDKey)); + if (refCF) { + CFNumberGetValue((CFNumberRef)refCF, kCFNumberSInt32Type, &product_id); + } + if (vendor && product_id) { + char uid[128]; + sprintf(uid, "%04x%08x%04x%08x", OSSwapHostToBigInt32(vendor),0, OSSwapHostToBigInt32(product_id), 0); + input->joy_connection_changed(id, true, name, uid); + } + else { + //bluetooth device + String guid = "05000000"; + for (int i = 0; i < 12; i++) { + if (i < name.size()) guid += _hex_str(name[i]); + else guid += "00"; + } + input->joy_connection_changed(id, true, name, guid); + } + + CFArrayRef array = NULL; + array = IOHIDDeviceCopyMatchingElements(p_device_ref, NULL, kIOHIDOptionsTypeNone); + if (array) { + p_joy->add_hid_elements(array); + CFRelease(array); + } + return true; +} + +#define FF_ERR() { if (ret != FF_OK) { FFReleaseDevice(ff_device); return false; } } +bool joystick::config_force_feedback(io_service_t p_service) { + + HRESULT ret = FFCreateDevice(p_service, &ff_device); + ERR_FAIL_COND_V(ret != FF_OK, false); + + ret = FFDeviceSendForceFeedbackCommand(ff_device, FFSFFC_RESET); + FF_ERR(); + + ret = FFDeviceSendForceFeedbackCommand(ff_device, FFSFFC_SETACTUATORSON); + FF_ERR(); + + if (check_ff_features()) { + ret = FFDeviceCreateEffect(ff_device, kFFEffectType_ConstantForce_ID, &ff_effect, &ff_object); + FF_ERR(); + return true; + } + FFReleaseDevice(ff_device); + return false; +} +#undef FF_ERR + +#define TEST_FF(ff) (features.supportedEffects & (ff)) +bool joystick::check_ff_features() { + + FFCAPABILITIES features; + HRESULT ret = FFDeviceGetForceFeedbackCapabilities(ff_device, &features); + if (ret == FF_OK && (features.supportedEffects & FFCAP_ET_CONSTANTFORCE)) { + uint32_t val; + ret = FFDeviceGetForceFeedbackProperty(ff_device, FFPROP_FFGAIN, &val, sizeof(val)); + if (ret != FF_OK) return false; + int num_axes = features.numFfAxes; + ff_axes = (DWORD*) memalloc(sizeof(DWORD) * num_axes); + ff_directions = (LONG*) memalloc(sizeof(LONG) * num_axes); + + for (int i = 0; i < num_axes; i++) { + ff_axes[i] = features.ffAxes[i]; + ff_directions[i] = 0; + } + + ff_effect.cAxes = num_axes; + ff_effect.rgdwAxes = ff_axes; + ff_effect.rglDirection = ff_directions; + return true; + } + return false; +} + +static int process_hat_value(int p_min, int p_max, int p_value) { + int range = (p_max - p_min + 1); + int value = p_value - p_min; + int hat_value = InputDefault::HAT_MASK_CENTER; + if (range == 4) { + value *= 2; + } + + switch (value) { + case 0: + hat_value = InputDefault::HAT_MASK_UP; + break; + case 1: + hat_value = InputDefault::HAT_MASK_UP | InputDefault::HAT_MASK_RIGHT; + break; + case 2: + hat_value = InputDefault::HAT_MASK_RIGHT; + break; + case 3: + hat_value = InputDefault::HAT_MASK_DOWN | InputDefault::HAT_MASK_RIGHT; + break; + case 4: + hat_value = InputDefault::HAT_MASK_DOWN; + break; + case 5: + hat_value = InputDefault::HAT_MASK_DOWN | InputDefault::HAT_MASK_LEFT; + break; + case 6: + hat_value = InputDefault::HAT_MASK_LEFT; + break; + case 7: + hat_value = InputDefault::HAT_MASK_UP | InputDefault::HAT_MASK_LEFT; + break; + default: + hat_value = InputDefault::HAT_MASK_CENTER; + break; + } + return hat_value; +} + +void JoystickOSX::poll_joysticks() const { + while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) { + /* no-op. Pending callbacks will fire. */ + } +} + +static const InputDefault::JoyAxis axis_correct(int p_value, int p_min, int p_max) { + InputDefault::JoyAxis jx; + if (p_min < 0) { + jx.min = -1; + if (p_value < 0) { + jx.value = (float) -p_value / p_min; + } + else jx.value = (float) p_value / p_max; + } + if (p_min == 0) { + jx.min = 0; + jx.value = 0.0f + (float) p_value / p_max; + } + return jx; +} + +uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){ + poll_joysticks(); + + for (int i = 0; i < device_list.size(); i++) { + joystick &joy = device_list[i]; + + for (int j = 0; j < joy.axis_elements.size(); j++) { + rec_element &elem = joy.axis_elements[j]; + int value = joy.get_hid_element_state(&elem); + p_last_id = input->joy_axis(p_last_id, joy.id, j, axis_correct(value, elem.min, elem.max)); + } + for (int j = 0; j < joy.button_elements.size(); j++) { + int value = joy.get_hid_element_state(&joy.button_elements[j]); + p_last_id = input->joy_button(p_last_id, joy.id, j, (value>=1)); + } + for (int j = 0; j < joy.hat_elements.size(); j++) { + rec_element &elem = joy.hat_elements[j]; + int value = joy.get_hid_element_state(&elem); + int hat_value = process_hat_value(elem.min, elem.max, value); + p_last_id = input->joy_hat(p_last_id, joy.id, hat_value); + } + + if (joy.ffservice) { + uint64_t timestamp = input->get_joy_vibration_timestamp(joy.id); + if (timestamp > joy.ff_timestamp) { + Vector2 strength = input->get_joy_vibration_strength(joy.id); + float duration = input->get_joy_vibration_duration(joy.id); + if (strength.x == 0 && strength.y == 0) { + joystick_vibration_stop(joy.id, timestamp); + } + else { + float gain = MAX(strength.x, strength.y); + joystick_vibration_start(joy.id, gain, duration, timestamp); + } + } + } + } + return p_last_id; +} + +void JoystickOSX::joystick_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp) { + joystick *joy = &device_list[get_joy_index(p_id)]; + joy->ff_timestamp = p_timestamp; + joy->ff_effect.dwDuration = p_duration * FF_SECONDS; + joy->ff_effect.dwGain = p_magnitude * FF_FFNOMINALMAX; + FFEffectSetParameters(joy->ff_object, &joy->ff_effect, FFEP_DURATION | FFEP_GAIN); + FFEffectStart(joy->ff_object, 1, 0); +} + +void JoystickOSX::joystick_vibration_stop(int p_id, uint64_t p_timestamp) { + joystick* joy = &device_list[get_joy_index(p_id)]; + joy->ff_timestamp = p_timestamp; + FFEffectStop(joy->ff_object); +} + +int JoystickOSX::get_free_joy_id() { + for (int i = 0; i < JOYSTICKS_MAX; i++) { + if (!attached_devices[i]) { + attached_devices[i] = true; + return i; + } + } + return -1; +} + +int JoystickOSX::get_joy_index(int p_id) const { + for (int i = 0; i < device_list.size(); i++) { + if (device_list[i].id == p_id) return i; + } + return -1; +} + +bool JoystickOSX::have_device(IOHIDDeviceRef p_device) const { + for (int i = 0; i < device_list.size(); i++) { + if (device_list[i].device_ref == p_device) { + return true; + } + } + return false; +} + +static CFDictionaryRef create_match_dictionary(const UInt32 page, const UInt32 usage, int *okay) +{ + CFDictionaryRef retval = NULL; + CFNumberRef pageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page); + CFNumberRef usageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage); + const void *keys[2] = { (void *) CFSTR(kIOHIDDeviceUsagePageKey), (void *) CFSTR(kIOHIDDeviceUsageKey) }; + const void *vals[2] = { (void *) pageNumRef, (void *) usageNumRef }; + + if (pageNumRef && usageNumRef) { + retval = CFDictionaryCreate(kCFAllocatorDefault, keys, vals, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + } + + if (pageNumRef) { + CFRelease(pageNumRef); + } + if (usageNumRef) { + CFRelease(usageNumRef); + } + + if (!retval) { + *okay = 0; + } + + return retval; +} + +void JoystickOSX::config_hid_manager(CFArrayRef p_matching_array) const { + + CFRunLoopRef runloop = CFRunLoopGetCurrent(); + IOReturn ret = IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone); + ERR_FAIL_COND(ret != kIOReturnSuccess); + + IOHIDManagerSetDeviceMatchingMultiple(hid_manager, p_matching_array); + IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joystick_added_callback, NULL); + IOHIDManagerScheduleWithRunLoop(hid_manager, runloop, GODOT_JOY_LOOP_RUN_MODE); + + while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) { + /* no-op. Callback fires once per existing device. */ + } +} + +JoystickOSX::JoystickOSX() +{ + self = this; + input = (InputDefault*)Input::get_singleton(); + + for (int i = 0; i < JOYSTICKS_MAX; i++) { + attached_devices[i] = false; + } + + int okay = 1; + const void *vals[] = { + (void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick, &okay), + (void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad, &okay), + (void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController, &okay), + }; + const size_t n_elements = sizeof(vals)/sizeof(vals[0]); + CFArrayRef array = okay ? CFArrayCreate(kCFAllocatorDefault, vals, n_elements, &kCFTypeArrayCallBacks) : NULL; + + for (int i = 0; i < n_elements; i++) { + if (vals[i]) { + CFRelease((CFTypeRef) vals[i]); + } + } + + if (array) { + hid_manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); + if (hid_manager != NULL) { + config_hid_manager(array); + } + CFRelease(array); + } +} + +JoystickOSX::~JoystickOSX() { + + for (int i = 0; i < device_list.size(); i++) { + device_list[i].free(); + } + + IOHIDManagerUnscheduleFromRunLoop(hid_manager, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE); + IOHIDManagerClose(hid_manager, kIOHIDOptionsTypeNone); + CFRelease(hid_manager); + hid_manager = NULL; +} + diff --git a/platform/osx/joystick_osx.h b/platform/osx/joystick_osx.h new file mode 100644 index 0000000000..38a4e3b1d3 --- /dev/null +++ b/platform/osx/joystick_osx.h @@ -0,0 +1,125 @@ +/*************************************************************************/ +/* joystick_osx.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef JOYSTICKOSX_H +#define JOYSTICKOSX_H + +#ifdef MACOS_10_0_4 +#include <IOKit/hidsystem/IOHIDUsageTables.h> +#else +#include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h> +#endif +#include <IOKit/hid/IOHIDLib.h> +#include <ForceFeedback/ForceFeedback.h> +#include <ForceFeedback/ForceFeedbackConstants.h> + +#include "main/input_default.h" + +struct rec_element { + IOHIDElementRef ref; + IOHIDElementCookie cookie; + + uint32_t usage; + + int min; + int max; + + struct Comparator { + bool operator()(const rec_element p_a, const rec_element p_b) const { return p_a.usage < p_b.usage; } + }; +}; + +struct joystick { + IOHIDDeviceRef device_ref; + + Vector<rec_element> axis_elements; + Vector<rec_element> button_elements; + Vector<rec_element> hat_elements; + + int id; + + io_service_t ffservice; /* Interface for force feedback, 0 = no ff */ + FFCONSTANTFORCE ff_constant_force; + FFDeviceObjectReference ff_device; + FFEffectObjectReference ff_object; + uint64_t ff_timestamp; + LONG *ff_directions; + FFEFFECT ff_effect; + DWORD *ff_axes; + + void add_hid_elements(CFArrayRef p_array); + void add_hid_element(IOHIDElementRef p_element); + + bool has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_list) const; + bool config_force_feedback(io_service_t p_service); + bool check_ff_features(); + + int get_hid_element_state(rec_element *p_element) const; + + void free(); + joystick(); +}; + +class JoystickOSX { + + enum { + JOYSTICKS_MAX = 16, + }; + +private: + InputDefault *input; + IOHIDManagerRef hid_manager; + + bool attached_devices[JOYSTICKS_MAX]; + Vector<joystick> device_list; + + bool have_device(IOHIDDeviceRef p_device) const; + bool configure_joystick(IOHIDDeviceRef p_device_ref, joystick *p_joy); + + + int get_free_joy_id(); + int get_joy_index(int p_id) const; + + void poll_joysticks() const; + void setup_joystick_objects(); + void config_hid_manager(CFArrayRef p_matching_array) const; + + void joystick_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp); + void joystick_vibration_stop(int p_id, uint64_t p_timestamp); + +public: + uint32_t process_joysticks(uint32_t p_last_id); + + void _device_added(IOReturn p_res, IOHIDDeviceRef p_device); + void _device_removed(int p_id); + + JoystickOSX(); + ~JoystickOSX(); +}; + +#endif // JOYSTICKOSX_H diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 8f89695a68..e23ae49a35 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -31,6 +31,7 @@ #include "os/input.h" +#include "joystick_osx.h" #include "drivers/unix/os_unix.h" #include "main/input_default.h" #include "servers/visual_server.h" @@ -76,6 +77,7 @@ public: SpatialSound2DServerSW *spatial_sound_2d_server; InputDefault *input; + JoystickOSX *joystick_osx; /* objc */ @@ -203,6 +205,7 @@ public: virtual void set_window_maximized(bool p_enabled); virtual bool is_window_maximized() const; virtual void request_attention(); + virtual String get_joy_guid(int p_device) const; void run(); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index b084a08ecc..cc893cc7a0 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1123,6 +1123,7 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi physics_2d_server->init(); input = memnew( InputDefault ); + joystick_osx = memnew( JoystickOSX ); _ensure_data_dir(); @@ -1165,7 +1166,7 @@ void OS_OSX::finalize() { spatial_sound_2d_server->finish(); memdelete(spatial_sound_2d_server); - + memdelete(joystick_osx); memdelete(input); memdelete(sample_manager); @@ -1738,7 +1739,7 @@ void OS_OSX::run() { while (!force_quit) { process_events(); // get rid of pending events -// process_joysticks(); + last_id = joystick_osx->process_joysticks(last_id); if (Main::iteration()==true) break; }; @@ -1773,6 +1774,10 @@ OS::MouseMode OS_OSX::get_mouse_mode() const { return mouse_mode; } +String OS_OSX::get_joy_guid(int p_device) const { + return input->get_joy_guid_remapped(p_device); +} + OS_OSX* OS_OSX::singleton=NULL; OS_OSX::OS_OSX() { diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 2414cee57e..0548b84cfa 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -90,6 +90,7 @@ import os import sys +import methods def is_active(): return True @@ -258,7 +259,7 @@ def configure(env): env['ENV'] = os.environ; # This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code - compiler_version_str = detect_visual_c_compiler_version(env['ENV']) + compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV']) # Note: this detection/override code from here onward should be here instead of in SConstruct because it's platform and compiler specific (MSVC/Windows) if(env["bits"] != "default"): @@ -272,7 +273,7 @@ def configure(env): # that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with) env["bits"]="32" env["x86_opt_vc"]=True - + print "Detected MSVC compiler: "+compiler_version_str # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"): @@ -282,9 +283,14 @@ def configure(env): elif (compiler_version_str=="x86" or compiler_version_str == "amd64_x86"): print "Compiled program architecture will be a 32 bit executable. (forcing bits=32)." else: - print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup." + print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup." if env["bits"]=="64": env.Append(CCFLAGS=['/D_WIN64']) + + # Incremental linking fix + env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program'] + env['BUILDERS']['Program'] = methods.precious_program + else: # Workaround for MinGW. See: @@ -379,73 +385,7 @@ def configure(env): env['is_mingw']=True env.Append( BUILDERS = { 'RES' : env.Builder(action = build_res_file, suffix = '.o',src_suffix = '.rc') } ) - import methods env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } ) env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) - -def detect_visual_c_compiler_version(tools_env): - # tools_env is the variable scons uses to call tools that execute tasks, SCons's env['ENV'] that executes tasks... - # (see the SCons documentation for more information on what it does)... - # in order for this function to be well encapsulated i choose to force it to recieve SCons's TOOLS env (env['ENV'] - # and not scons setup environment (env)... so make sure you call the right environment on it or it will fail to detect - # the propper vc version that will be called - - # These is no flag to give to visual c compilers to set the architecture, ie scons bits argument (32,64,ARM etc) - # There are many different cl.exe files that are run, and each one compiles & links to a different architecture - # As far as I know, the only way to figure out what compiler will be run when Scons calls cl.exe via Program() - # is to check the PATH varaible and figure out which one will be called first. Code bellow does that and returns: - # the following string values: - - # "" Compiler not detected - # "amd64" Native 64 bit compiler - # "amd64_x86" 64 bit Cross Compiler for 32 bit - # "x86" Native 32 bit compiler - # "x86_amd64" 32 bit Cross Compiler for 64 bit - - # There are other architectures, but Godot does not support them currently, so this function does not detect arm/amd64_arm - # and similar architectures/compilers - - # Set chosen compiler to "not detected" - vc_chosen_compiler_index = -1 - vc_chosen_compiler_str = "" - - # find() works with -1 so big ifs bellow are needed... the simplest solution, in fact - # First test if amd64 and amd64_x86 compilers are present in the path - vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN\\amd64;") - if(vc_amd64_compiler_detection_index > -1): - vc_chosen_compiler_index = vc_amd64_compiler_detection_index - vc_chosen_compiler_str = "amd64" - - vc_amd64_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN\\amd64_x86;") - if(vc_amd64_x86_compiler_detection_index > -1 - and (vc_chosen_compiler_index == -1 - or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)): - vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index - vc_chosen_compiler_str = "amd64_x86" - - - # Now check the 32 bit compilers - vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN;") - if(vc_x86_compiler_detection_index > -1 - and (vc_chosen_compiler_index == -1 - or vc_chosen_compiler_index > vc_x86_compiler_detection_index)): - vc_chosen_compiler_index = vc_x86_compiler_detection_index - vc_chosen_compiler_str = "x86" - - vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env['VCINSTALLDIR']+"BIN\\x86_amd64;") - if(vc_x86_amd64_compiler_detection_index > -1 - and (vc_chosen_compiler_index == -1 - or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)): - vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index - vc_chosen_compiler_str = "x86_amd64" - - # debug help - #print vc_amd64_compiler_detection_index - #print vc_amd64_x86_compiler_detection_index - #print vc_x86_compiler_detection_index - #print vc_x86_amd64_compiler_detection_index - #print "chosen "+str(vc_chosen_compiler_index)+ " | "+str(vc_chosen_compiler_str) - - return vc_chosen_compiler_str diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index a3ac12a838..35d90a8308 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1312,10 +1312,13 @@ void OS_Windows::finalize_core() { void OS_Windows::vprint(const char* p_format, va_list p_list, bool p_stderr) { - char buf[16384+1]; - int len = vsnprintf(buf,16384,p_format,p_list); + const unsigned int BUFFER_SIZE = 16384; + char buf[BUFFER_SIZE+1]; // +1 for the terminating character + int len = vsnprintf(buf,BUFFER_SIZE,p_format,p_list); if (len<=0) return; + if(len >= BUFFER_SIZE) + len = BUFFER_SIZE; // Output is too big, will be truncated buf[len]=0; diff --git a/platform/winrt/SCsub b/platform/winrt/SCsub index 2ea8cbd0de..fde0c11f3b 100644 --- a/platform/winrt/SCsub +++ b/platform/winrt/SCsub @@ -2,10 +2,21 @@ Import('env') files = [ 'thread_winrt.cpp', -# '#platform/windows/stream_peer_winsock.cpp', + '#platform/windows/tcp_server_winsock.cpp', + '#platform/windows/packet_peer_udp_winsock.cpp', + '#platform/windows/stream_peer_winsock.cpp', + '#platform/windows/key_mapping_win.cpp', + 'joystick_winrt.cpp', 'gl_context_egl.cpp', + 'audio_driver_winrt.cpp', 'app.cpp', 'os_winrt.cpp', ] -env.Program('#bin/godot', files) +if "build_angle" in env and env["build_angle"]: + cmd = env.AlwaysBuild(env.ANGLE('libANGLE.lib', None)) + +prog = env.Program('#bin/godot', files) + +if "build_angle" in env and env["build_angle"]: + env.Depends(prog, [cmd]) diff --git a/platform/winrt/app.cpp b/platform/winrt/app.cpp index ea7619a64b..c2b7ba0641 100644 --- a/platform/winrt/app.cpp +++ b/platform/winrt/app.cpp @@ -1,4 +1,32 @@ -// +/*************************************************************************/ +/* app.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +// // This file demonstrates how to initialize EGL in a Windows Store app, using ICoreWindow. // @@ -7,17 +35,25 @@ #include "main/main.h" #include "core/os/dir_access.h" #include "core/os/file_access.h" +#include "core/os/keyboard.h" + +#include "platform/windows/key_mapping_win.h" + +#include <collection.h> using namespace Windows::ApplicationModel::Core; using namespace Windows::ApplicationModel::Activation; using namespace Windows::UI::Core; using namespace Windows::UI::Input; +using namespace Windows::Devices::Input; +using namespace Windows::UI::Xaml::Input; using namespace Windows::Foundation; using namespace Windows::Graphics::Display; +using namespace Windows::System; +using namespace Windows::System::Threading::Core; using namespace Microsoft::WRL; -using namespace Platform; -using namespace $ext_safeprojectname$; +using namespace GodotWinRT; // Helper to convert a length in device-independent pixels (DIPs) to a length in physical pixels. inline float ConvertDipsToPixels(float dips, float dpi) @@ -27,7 +63,7 @@ inline float ConvertDipsToPixels(float dips, float dpi) } // Implementation of the IFrameworkViewSource interface, necessary to run our app. -ref class HelloTriangleApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource +ref class GodotWinrtViewSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource { public: virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView() @@ -40,8 +76,8 @@ public: [Platform::MTAThread] int main(Platform::Array<Platform::String^>^) { - auto helloTriangleApplicationSource = ref new HelloTriangleApplicationSource(); - CoreApplication::Run(helloTriangleApplicationSource); + auto godotApplicationSource = ref new GodotWinrtViewSource(); + CoreApplication::Run(godotApplicationSource); return 0; } @@ -52,7 +88,8 @@ App::App() : mWindowHeight(0), mEglDisplay(EGL_NO_DISPLAY), mEglContext(EGL_NO_CONTEXT), - mEglSurface(EGL_NO_SURFACE) + mEglSurface(EGL_NO_SURFACE), + number_of_contacts(0) { } @@ -69,6 +106,7 @@ void App::Initialize(CoreApplicationView^ applicationView) // http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh994930.aspx os = new OSWinrt; + } // Called when the CoreWindow object is created (or re-created). @@ -95,20 +133,31 @@ void App::SetWindow(CoreWindow^ p_window) window->PointerPressed += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerPressed); - window->PointerMoved += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerMoved); - window->PointerReleased += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerReleased); + window->PointerWheelChanged += + ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerWheelChanged); + + mouseChangedNotifier = SignalNotifier::AttachToEvent(L"os_mouse_mode_changed", ref new SignalHandler( + this, &App::OnMouseModeChanged + )); - //window->PointerWheelChanged += - // ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerWheelChanged); + mouseChangedNotifier->Enable(); + window->CharacterReceived += + ref new TypedEventHandler<CoreWindow^, CharacterReceivedEventArgs^>(this, &App::OnCharacterReceived); + window->KeyDown += + ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &App::OnKeyDown); + window->KeyUp += + ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &App::OnKeyUp); - char* args[] = {"-path", "game", NULL}; - Main::setup("winrt", 2, args, false); + unsigned int argc; + char** argv = get_command_line(&argc); + + Main::setup("winrt", argc, argv, false); // The CoreWindow has been created, so EGL can be initialized. ContextEGL* context = memnew(ContextEGL(window)); @@ -217,7 +266,7 @@ static int _get_finger(uint32_t p_touch_id) { return p_touch_id % 31; // for now }; -void App::pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args, bool p_pressed) { +void App::pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args, bool p_pressed, bool p_is_wheel) { Windows::UI::Input::PointerPoint ^point = args->CurrentPoint; Windows::Foundation::Point pos = _get_pixel_position(window, point->Position, os); @@ -236,7 +285,7 @@ void App::pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core last_touch_y[event.screen_touch.index] = pos.Y; os->input_event(event); - if (event.screen_touch.index != 0) + if (number_of_contacts > 1) return; }; // fallthrought of sorts @@ -251,6 +300,14 @@ void App::pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core event.mouse_button.global_x = pos.X; event.mouse_button.global_y = pos.Y; + if (p_is_wheel) { + if (point->Properties->MouseWheelDelta > 0) { + event.mouse_button.button_index = point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_UP; + } else if (point->Properties->MouseWheelDelta < 0) { + event.mouse_button.button_index = point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_LEFT : BUTTON_WHEEL_DOWN; + } + } + last_touch_x[31] = pos.X; last_touch_y[31] = pos.Y; @@ -260,21 +317,56 @@ void App::pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core void App::OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) { + number_of_contacts++; pointer_event(sender, args, true); }; void App::OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) { + number_of_contacts--; pointer_event(sender, args, false); }; +void App::OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) { + + pointer_event(sender, args, true, true); +} + +void App::OnMouseModeChanged(Windows::System::Threading::Core::SignalNotifier^ signalNotifier, bool timedOut) { + + OS::MouseMode mode = os->get_mouse_mode(); + SignalNotifier^ notifier = mouseChangedNotifier; + + window->Dispatcher->RunAsync( + CoreDispatcherPriority::High, + ref new DispatchedHandler( + [mode, notifier, this]() { + if (mode == OS::MOUSE_MODE_CAPTURED) { + + this->MouseMovedToken = MouseDevice::GetForCurrentView()->MouseMoved += + ref new TypedEventHandler<MouseDevice^, MouseEventArgs^>(this, &App::OnMouseMoved); + + } else { + + MouseDevice::GetForCurrentView()->MouseMoved -= MouseMovedToken; + + } + + notifier->Enable(); + })); + + ResetEvent(os->mouse_mode_changed); + + +} + void App::OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) { Windows::UI::Input::PointerPoint ^point = args->CurrentPoint; Windows::Foundation::Point pos = _get_pixel_position(window, point->Position, os); - if (_is_touch(point)) { + if (point->IsInContact && _is_touch(point)) { InputEvent event; event.type = InputEvent::SCREEN_DRAG; @@ -286,11 +378,15 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Cor event.screen_drag.relative_y = event.screen_drag.y - last_touch_y[event.screen_drag.index]; os->input_event(event); - if (event.screen_drag.index != 0) + if (number_of_contacts > 1) return; }; // fallthrought of sorts + // In case the mouse grabbed, MouseMoved will handle this + if (os->get_mouse_mode() == OS::MouseMode::MOUSE_MODE_CAPTURED) + return; + InputEvent event; event.type = InputEvent::MOUSE_MOTION; event.device = 0; @@ -301,16 +397,90 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Cor event.mouse_motion.relative_x = pos.X - last_touch_x[31]; event.mouse_motion.relative_y = pos.Y - last_touch_y[31]; + last_mouse_pos = pos; + os->input_event(event); -}; +} + +void App::OnMouseMoved(MouseDevice ^ mouse_device, MouseEventArgs ^ args) { + + // In case the mouse isn't grabbed, PointerMoved will handle this + if (os->get_mouse_mode() != OS::MouseMode::MOUSE_MODE_CAPTURED) + return; + + Windows::Foundation::Point pos; + pos.X = last_mouse_pos.X + args->MouseDelta.X; + pos.Y = last_mouse_pos.Y + args->MouseDelta.Y; + + InputEvent event; + event.type = InputEvent::MOUSE_MOTION; + event.device = 0; + event.mouse_motion.x = pos.X; + event.mouse_motion.y = pos.Y; + event.mouse_motion.global_x = pos.X; + event.mouse_motion.global_y = pos.Y; + event.mouse_motion.relative_x = args->MouseDelta.X; + event.mouse_motion.relative_y = args->MouseDelta.Y; + + last_mouse_pos = pos; + + os->input_event(event); +} + +void App::key_event(Windows::UI::Core::CoreWindow^ sender, bool p_pressed, Windows::UI::Core::KeyEventArgs^ key_args, Windows::UI::Core::CharacterReceivedEventArgs^ char_args) +{ + + OSWinrt::KeyEvent ke; + + InputModifierState mod; + mod.meta = false; + mod.command = false; + mod.control = sender->GetAsyncKeyState(VirtualKey::Control) == CoreVirtualKeyStates::Down; + mod.alt = sender->GetAsyncKeyState(VirtualKey::Menu) == CoreVirtualKeyStates::Down; + mod.shift = sender->GetAsyncKeyState(VirtualKey::Shift) == CoreVirtualKeyStates::Down; + ke.mod_state = mod; + + ke.pressed = p_pressed; + + if (key_args != nullptr) { + + ke.type = OSWinrt::KeyEvent::MessageType::KEY_EVENT_MESSAGE; + ke.unicode = 0; + ke.scancode = KeyMappingWindows::get_keysym((unsigned int)key_args->VirtualKey); + ke.echo = (!p_pressed && !key_args->KeyStatus.IsKeyReleased) || (p_pressed && key_args->KeyStatus.WasKeyDown); + + } else { + + ke.type = OSWinrt::KeyEvent::MessageType::CHAR_EVENT_MESSAGE; + ke.unicode = char_args->KeyCode; + ke.scancode = 0; + ke.echo = (!p_pressed && !char_args->KeyStatus.IsKeyReleased) || (p_pressed && char_args->KeyStatus.WasKeyDown); + } + + os->queue_key_event(ke); + +} +void App::OnKeyDown(CoreWindow^ sender, KeyEventArgs^ args) +{ + key_event(sender, true, args); +} + +void App::OnKeyUp(CoreWindow^ sender, KeyEventArgs^ args) +{ + key_event(sender, false, args); +} + +void App::OnCharacterReceived(CoreWindow^ sender, CharacterReceivedEventArgs^ args) +{ + key_event(sender, true, nullptr, args); +} // Initializes scene resources void App::Load(Platform::String^ entryPoint) { - //char* args[] = {"-test", "render", NULL}; - //Main::setup("winrt", 2, args); + } // This method is called after the window becomes active. @@ -383,3 +553,95 @@ void App::UpdateWindowSize(Size size) vm.resizable = false; os->set_video_mode(vm); } + +char** App::get_command_line(unsigned int* out_argc) { + + static char* fail_cl[] = { "-path", "game", NULL }; + *out_argc = 2; + + FILE* f = _wfopen(L"__cl__.cl", L"rb"); + + if (f == NULL) { + + wprintf(L"Couldn't open command line file."); + return fail_cl; + } + +#define READ_LE_4(v) ((int)(##v[3] & 0xFF) << 24) | ((int)(##v[2] & 0xFF) << 16) | ((int)(##v[1] & 0xFF) << 8) | ((int)(##v[0] & 0xFF)) +#define CMD_MAX_LEN 65535 + + uint8_t len[4]; + int r = fread(len, sizeof(uint8_t), 4, f); + + Platform::Collections::Vector<Platform::String^> cl; + + if (r < 4) { + fclose(f); + wprintf(L"Wrong cmdline length."); + return(fail_cl); + } + + int argc = READ_LE_4(len); + + for (int i = 0; i < argc; i++) { + + r = fread(len, sizeof(uint8_t), 4, f); + + if (r < 4) { + fclose(f); + wprintf(L"Wrong cmdline param length."); + return(fail_cl); + } + + int strlen = READ_LE_4(len); + + if (strlen > CMD_MAX_LEN) { + fclose(f); + wprintf(L"Wrong command length."); + return(fail_cl); + } + + char* arg = new char[strlen + 1]; + r = fread(arg, sizeof(char), strlen, f); + arg[strlen] = '\0'; + + if (r == strlen) { + + int warg_size = MultiByteToWideChar(CP_UTF8, 0, arg, -1, NULL, 0); + wchar_t* warg = new wchar_t[warg_size]; + + MultiByteToWideChar(CP_UTF8, 0, arg, -1, warg, warg_size); + + cl.Append(ref new Platform::String(warg, warg_size)); + + } else { + + delete[] arg; + fclose(f); + wprintf(L"Error reading command."); + return(fail_cl); + } + } + +#undef READ_LE_4 +#undef CMD_MAX_LEN + + fclose(f); + + char** ret = new char*[cl.Size + 1]; + + for (int i = 0; i < cl.Size; i++) { + + int arg_size = WideCharToMultiByte(CP_UTF8, 0, cl.GetAt(i)->Data(), -1, NULL, 0, NULL, NULL); + char* arg = new char[arg_size]; + + WideCharToMultiByte(CP_UTF8, 0, cl.GetAt(i)->Data(), -1, arg, arg_size, NULL, NULL); + + ret[i] = arg; + + } + ret[cl.Size] = NULL; + *out_argc = cl.Size; + + return ret; +} diff --git a/platform/winrt/app.h b/platform/winrt/app.h index 25b0d524ae..652ec86e1f 100644 --- a/platform/winrt/app.h +++ b/platform/winrt/app.h @@ -1,4 +1,32 @@ -#pragma once +/*************************************************************************/ +/* app.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#pragma once #include <string> @@ -7,7 +35,7 @@ #include "os_winrt.h" #include "GLES2/gl2.h" -namespace $ext_safeprojectname$ +namespace GodotWinRT { ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView { @@ -21,6 +49,11 @@ namespace $ext_safeprojectname$ virtual void Run(); virtual void Uninitialize(); + property Windows::Foundation::EventRegistrationToken MouseMovedToken { + Windows::Foundation::EventRegistrationToken get() { return this->mouseMovedToken; } + void set(Windows::Foundation::EventRegistrationToken p_token) { this->mouseMovedToken = p_token; } + }; + private: void RecreateRenderer(); @@ -32,16 +65,28 @@ namespace $ext_safeprojectname$ void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args); - void pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args, bool p_pressed); + void pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args, bool p_pressed, bool p_is_wheel = false); void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); + void OnMouseMoved(Windows::Devices::Input::MouseDevice^ mouse_device, Windows::Devices::Input::MouseEventArgs^ args); + void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); + + Windows::System::Threading::Core::SignalNotifier^ mouseChangedNotifier; + Windows::Foundation::EventRegistrationToken mouseMovedToken; + void OnMouseModeChanged(Windows::System::Threading::Core::SignalNotifier^ signalNotifier, bool timedOut); + void key_event(Windows::UI::Core::CoreWindow^ sender, bool p_pressed, Windows::UI::Core::KeyEventArgs^ key_args = nullptr, Windows::UI::Core::CharacterReceivedEventArgs^ char_args = nullptr); + void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); + void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); + void OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args); void UpdateWindowSize(Windows::Foundation::Size size); void InitializeEGL(Windows::UI::Core::CoreWindow^ window); void CleanupEGL(); + char** get_command_line(unsigned int* out_argc); + bool mWindowClosed; bool mWindowVisible; GLsizei mWindowWidth; @@ -56,6 +101,8 @@ namespace $ext_safeprojectname$ int last_touch_x[32]; // 20 fingers, index 31 reserved for the mouse int last_touch_y[32]; + int number_of_contacts; + Windows::Foundation::Point last_mouse_pos; }; } diff --git a/platform/winrt/audio_driver_winrt.cpp b/platform/winrt/audio_driver_winrt.cpp new file mode 100644 index 0000000000..ff46244ac3 --- /dev/null +++ b/platform/winrt/audio_driver_winrt.cpp @@ -0,0 +1,244 @@ +/*************************************************************************/ +/* audio_driver_winrt.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "audio_driver_winrt.h" + +#include "globals.h" +#include "os/os.h" + +using namespace Windows::Media; +using namespace Windows::Media::Core; +using namespace Windows::Media::MediaProperties; +using namespace Windows::Media::Editing; +using namespace Windows::Foundation; + +const char * AudioDriverWinRT::get_name() const +{ + return "WinRT"; +} + +Error AudioDriverWinRT::init() { + + active = false; + thread_exited = false; + exit_thread = false; + pcm_open = false; + samples_in = NULL; + + + mix_rate = 48000; + output_format = OUTPUT_STEREO; + channels = 2; + + int latency = GLOBAL_DEF("audio/output_latency", 25); + buffer_size = nearest_power_of_2(latency * mix_rate / 1000); + + samples_in = memnew_arr(int32_t, buffer_size*channels); + for (int i = 0; i < AUDIO_BUFFERS; i++) { + samples_out[i] = memnew_arr(int16_t, buffer_size*channels); + xaudio_buffer[i].AudioBytes = buffer_size * channels * sizeof(int16_t); + xaudio_buffer[i].pAudioData = (const BYTE*)(samples_out[i]); + xaudio_buffer[i].Flags = 0; + } + + HRESULT hr; + hr = XAudio2Create(&xaudio, 0, XAUDIO2_DEFAULT_PROCESSOR); + if (hr != S_OK) { + ERR_EXPLAIN("Error creating XAudio2 engine."); + ERR_FAIL_V(ERR_UNAVAILABLE); + } + hr = xaudio->CreateMasteringVoice(&mastering_voice); + if (hr != S_OK) { + ERR_EXPLAIN("Error creating XAudio2 mastering voice."); + ERR_FAIL_V(ERR_UNAVAILABLE); + } + + wave_format.nChannels = channels; + wave_format.cbSize = 0; + wave_format.nSamplesPerSec = mix_rate; + wave_format.wFormatTag = WAVE_FORMAT_PCM; + wave_format.wBitsPerSample = 16; + wave_format.nBlockAlign = channels * wave_format.wBitsPerSample >> 3; + wave_format.nAvgBytesPerSec = mix_rate * wave_format.nBlockAlign; + + voice_callback = memnew(XAudio2DriverVoiceCallback); + + hr = xaudio->CreateSourceVoice(&source_voice, &wave_format, 0, XAUDIO2_MAX_FREQ_RATIO, voice_callback); + if (hr != S_OK) { + ERR_EXPLAIN("Error creating XAudio2 source voice. " + itos(hr)); + ERR_FAIL_V(ERR_UNAVAILABLE); + } + + mutex = Mutex::create(); + thread = Thread::create(AudioDriverWinRT::thread_func, this); + + return OK; +}; + +void AudioDriverWinRT::thread_func(void* p_udata) { + + AudioDriverWinRT* ad = (AudioDriverWinRT*)p_udata; + + uint64_t usdelay = (ad->buffer_size / float(ad->mix_rate)) * 1000000; + + while (!ad->exit_thread) { + + + if (!ad->active) { + + for (int i = 0; i < AUDIO_BUFFERS; i++) { + ad->xaudio_buffer[i].Flags = XAUDIO2_END_OF_STREAM; + } + + } else { + + ad->lock(); + + ad->audio_server_process(ad->buffer_size, ad->samples_in); + + ad->unlock(); + + for (unsigned int i = 0;i < ad->buffer_size*ad->channels;i++) { + + ad->samples_out[ad->current_buffer][i] = ad->samples_in[i] >> 16; + } + + ad->xaudio_buffer[ad->current_buffer].Flags = 0; + ad->xaudio_buffer[ad->current_buffer].AudioBytes = ad->buffer_size * ad->channels * sizeof(int16_t); + ad->xaudio_buffer[ad->current_buffer].pAudioData = (const BYTE*)(ad->samples_out[ad->current_buffer]); + ad->xaudio_buffer[ad->current_buffer].PlayBegin = 0; + ad->source_voice->SubmitSourceBuffer(&(ad->xaudio_buffer[ad->current_buffer])); + + ad->current_buffer = (ad->current_buffer + 1) % AUDIO_BUFFERS; + + XAUDIO2_VOICE_STATE state; + while (ad->source_voice->GetState(&state), state.BuffersQueued > AUDIO_BUFFERS - 1) + { + WaitForSingleObject(ad->voice_callback->buffer_end_event, INFINITE); + } + } + + }; + + ad->thread_exited = true; + +}; + +void AudioDriverWinRT::start() { + + active = true; + HRESULT hr = source_voice->Start(0); + if (hr != S_OK) { + ERR_EXPLAIN("XAudio2 start error " + itos(hr)); + ERR_FAIL(); + } +}; + +int AudioDriverWinRT::get_mix_rate() const { + + return mix_rate; +}; + +AudioDriverSW::OutputFormat AudioDriverWinRT::get_output_format() const { + + return output_format; +}; + +float AudioDriverWinRT::get_latency() { + + XAUDIO2_PERFORMANCE_DATA perf_data; + xaudio->GetPerformanceData(&perf_data); + if (perf_data.CurrentLatencyInSamples) { + return (float)(perf_data.CurrentLatencyInSamples / ((float)mix_rate)); + } else { + return 0; + } +} + +void AudioDriverWinRT::lock() { + + if (!thread || !mutex) + return; + mutex->lock(); +}; +void AudioDriverWinRT::unlock() { + + if (!thread || !mutex) + return; + mutex->unlock(); +}; + +void AudioDriverWinRT::finish() { + + if (!thread) + return; + + exit_thread = true; + Thread::wait_to_finish(thread); + + if (source_voice) { + source_voice->Stop(0); + memdelete(source_voice); + } + + if (samples_in) { + memdelete_arr(samples_in); + }; + if (samples_out[0]) { + for (int i = 0; i < AUDIO_BUFFERS; i++) { + memdelete_arr(samples_out[i]); + } + }; + + memdelete(voice_callback); + memdelete(mastering_voice); + + memdelete(thread); + if (mutex) + memdelete(mutex); + thread = NULL; +}; + +AudioDriverWinRT::AudioDriverWinRT() { + + mutex = NULL; + thread = NULL; + wave_format = { 0 }; + for (int i = 0; i < AUDIO_BUFFERS; i++) { + xaudio_buffer[i] = { 0 }; + samples_out[i] = 0; + } + current_buffer = 0; +}; + +AudioDriverWinRT::~AudioDriverWinRT() { + + +}; + + diff --git a/platform/winrt/audio_driver_winrt.h b/platform/winrt/audio_driver_winrt.h new file mode 100644 index 0000000000..d7a69994f8 --- /dev/null +++ b/platform/winrt/audio_driver_winrt.h @@ -0,0 +1,109 @@ +/*************************************************************************/ +/* audio_driver_winrt.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef AUDIO_DRIVER_WINRT_H +#define AUDIO_DRIVER_WINRT_H + +#include "servers/audio/audio_server_sw.h" + +#include "core/os/thread.h" +#include "core/os/mutex.h" + +#include <windows.h> +#include <mmsystem.h> +#include <mmreg.h> +#include <xaudio2.h> +#include <wrl/client.h> + +class AudioDriverWinRT : public AudioDriverSW { + + enum { + AUDIO_BUFFERS = 2 + }; + + struct XAudio2DriverVoiceCallback : public IXAudio2VoiceCallback { + + HANDLE buffer_end_event; + XAudio2DriverVoiceCallback() : buffer_end_event(CreateEvent(NULL, FALSE, FALSE, NULL)) {} + void STDMETHODCALLTYPE OnBufferEnd(void* pBufferContext) { /*print_line("buffer ended");*/ SetEvent(buffer_end_event); } + + //Unused methods are stubs + void STDMETHODCALLTYPE OnStreamEnd() { } + void STDMETHODCALLTYPE OnVoiceProcessingPassEnd() { } + void STDMETHODCALLTYPE OnVoiceProcessingPassStart(UINT32 SamplesRequired) { } + void STDMETHODCALLTYPE OnBufferStart(void * pBufferContext) { } + void STDMETHODCALLTYPE OnLoopEnd(void * pBufferContext) { } + void STDMETHODCALLTYPE OnVoiceError(void * pBufferContext, HRESULT Error) { } + + }; + + Thread* thread; + Mutex* mutex; + + int32_t* samples_in; + int16_t* samples_out[AUDIO_BUFFERS]; + + static void thread_func(void* p_udata); + int buffer_size; + + unsigned int mix_rate; + OutputFormat output_format; + + int channels; + + bool active; + bool thread_exited; + mutable bool exit_thread; + bool pcm_open; + + WAVEFORMATEX wave_format; + Microsoft::WRL::ComPtr<IXAudio2> xaudio; + int current_buffer; + IXAudio2MasteringVoice* mastering_voice; + XAUDIO2_BUFFER xaudio_buffer[AUDIO_BUFFERS]; + IXAudio2SourceVoice* source_voice; + XAudio2DriverVoiceCallback* voice_callback; + +public: + + const char* get_name() const; + + virtual Error init(); + virtual void start(); + virtual int get_mix_rate() const; + virtual OutputFormat get_output_format() const; + virtual float get_latency(); + virtual void lock(); + virtual void unlock(); + virtual void finish(); + + AudioDriverWinRT(); + ~AudioDriverWinRT(); +}; + +#endif diff --git a/platform/winrt/detect.py b/platform/winrt/detect.py index 86028d3af8..7f220736d7 100644 --- a/platform/winrt/detect.py +++ b/platform/winrt/detect.py @@ -1,9 +1,8 @@ - - import os import sys import string +import methods def is_active(): @@ -16,6 +15,10 @@ def can_build(): if (os.name=="nt"): #building natively on windows! if (os.getenv("VSINSTALLDIR")): + + if (os.getenv("ANGLE_SRC_PATH") == None): + return False + return True return False @@ -24,133 +27,139 @@ def get_opts(): def get_flags(): - return [] + return [ + ('tools', 'no'), + ('openssl', 'builtin'), + ] def configure(env): - env.Append(CPPPATH=['#platform/winrt', '#platform/winrt/include']) - arch = "" - - if os.getenv('PLATFORM') == "ARM": - - # compiler commandline - # debug: /Yu"pch.h" /MP /GS /analyze- /W3 /wd"4453" /wd"28204" /Zc:wchar_t /I"C:\Users\ariel\Documents\Visual Studio 2013\Projects\App2\App2\App2.WindowsPhone\" /I"Generated Files\" /I"ARM\Debug\" /I"C:\Users\ariel\Documents\Visual Studio 2013\Projects\App2\App2\App2.Shared\" /ZW:nostdlib /Zi /Gm- /Od /sdl /Fd"ARM\Debug\vc120.pdb" /fp:precise /D "PSAPI_VERSION=2" /D "WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP" /D "_UITHREADCTXT_SUPPORT=0" /D "_UNICODE" /D "UNICODE" /D "_DEBUG" /errorReport:prompt /WX- /Zc:forScope /RTC1 /ZW /Gd /Oy- /MDd /Fa"ARM\Debug\" /EHsc /nologo /Fo"ARM\Debug\" /Fp"ARM\Debug\App2.WindowsPhone.pch" - # release: /Yu"pch.h" /MP /GS /GL /analyze- /W3 /wd"4453" /wd"28204" /Gy /Zc:wchar_t /I"C:\Users\ariel\Documents\Visual Studio 2013\Projects\App2\App2\App2.WindowsPhone\" /I"Generated Files\" /I"ARM\Release\" /I"C:\Users\ariel\Documents\Visual Studio 2013\Projects\App2\App2\App2.Shared\" /ZW:nostdlib /Zi /Gm- /O2 /sdl /Fd"ARM\Release\vc120.pdb" /fp:precise /D "PSAPI_VERSION=2" /D "WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP" /D "_UITHREADCTXT_SUPPORT=0" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /ZW /Gd /Oy- /Oi /MD /Fa"ARM\Release\" /EHsc /nologo /Fo"ARM\Release\" /Fp"ARM\Release\App2.WindowsPhone.pch" - - # linker commandline - # debug: /OUT:"C:\Users\ariel\Documents\Visual Studio 2013\Projects\App2\ARM\Debug\App2.WindowsPhone\App2.WindowsPhone.exe" /MANIFEST:NO /NXCOMPAT /PDB:"C:\Users\ariel\Documents\Visual Studio 2013\Projects\App2\ARM\Debug\App2.WindowsPhone\App2.WindowsPhone.pdb" /DYNAMICBASE "WindowsPhoneCore.lib" "RuntimeObject.lib" "PhoneAppModelHost.lib" /DEBUG /MACHINE:ARM /NODEFAULTLIB:"kernel32.lib" /NODEFAULTLIB:"ole32.lib" /WINMD /APPCONTAINER /INCREMENTAL /PGD:"C:\Users\ariel\Documents\Visual Studio 2013\Projects\App2\ARM\Debug\App2.WindowsPhone\App2.WindowsPhone.pgd" /WINMDFILE:"C:\Users\ariel\Documents\Visual Studio 2013\Projects\App2\ARM\Debug\App2.WindowsPhone\App2.winmd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:NO /ManifestFile:"ARM\Debug\App2.WindowsPhone.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /TLBID:1 - # release: /OUT:"C:\Users\ariel\Documents\Visual Studio 2013\Projects\App2\ARM\Release\App2.WindowsPhone\App2.WindowsPhone.exe" /MANIFEST:NO /LTCG /NXCOMPAT /PDB:"C:\Users\ariel\Documents\Visual Studio 2013\Projects\App2\ARM\Release\App2.WindowsPhone\App2.WindowsPhone.pdb" /DYNAMICBASE "WindowsPhoneCore.lib" "RuntimeObject.lib" "PhoneAppModelHost.lib" /DEBUG /MACHINE:ARM /NODEFAULTLIB:"kernel32.lib" /NODEFAULTLIB:"ole32.lib" /WINMD /APPCONTAINER /OPT:REF /PGD:"C:\Users\ariel\Documents\Visual Studio 2013\Projects\App2\ARM\Release\App2.WindowsPhone\App2.WindowsPhone.pgd" /WINMDFILE:"C:\Users\ariel\Documents\Visual Studio 2013\Projects\App2\ARM\Release\App2.WindowsPhone\App2.winmd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:NO /ManifestFile:"ARM\Release\App2.WindowsPhone.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /TLBID:1 - - arch = "arm" + if(env["bits"] != "default"): + print "Error: bits argument is disabled for MSVC" + print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)" + +" that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=winrt) and SCons will attempt to detect what MSVC compiler" + +" will be executed and inform you.") + sys.exit() - env.Append(LINKFLAGS=['/INCREMENTAL:NO', '/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', "WindowsPhoneCore.lib", "RuntimeObject.lib", "PhoneAppModelHost.lib", "/DEBUG", "/MACHINE:ARM", '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"', '/WINMD', '/APPCONTAINER', '/MANIFESTUAC:NO', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1']) - env.Append(LIBPATH=['#platform/winrt/ARM/lib']) + arch = "" + env['ENV'] = os.environ; - env.Append(CCFLAGS=string.split('/MP /GS /wd"4453" /wd"28204" /analyze- /Zc:wchar_t /Zi /Gm- /Od /fp:precise /fp:precise /D "PSAPI_VERSION=2" /D "WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP" /DWINDOWSPHONE_ENABLED /D "_UITHREADCTXT_SUPPORT=0" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MD /RTC1 /Gd /EHsc /nologo')) - env.Append(CXXFLAGS=string.split('/ZW')) + # ANGLE + angle_root = os.getenv("ANGLE_SRC_PATH") + env.Append(CPPPATH=[angle_root + '/include']) + jobs = str(env.GetOption("num_jobs")) + angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform=" - if (env["target"]=="release"): + if os.path.isfile(str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"): + env["build_angle"] = True - env.Append(CCFLAGS=['/O2']) - env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS']) + if os.getenv('Platform') == "ARM": - elif (env["target"]=="test"): + print "Compiled program architecture will be an ARM executable. (forcing bits=32)." - env.Append(CCFLAGS=['/O2','/DDEBUG_ENABLED','/DD3D_DEBUG_INFO']) - env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) + arch="arm" + env["bits"]="32" + env.Append(LINKFLAGS=['/MACHINE:ARM']) + env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/arm']) - elif (env["target"]=="debug"): + angle_build_cmd += "ARM" - env.Append(CCFLAGS=['/Zi','/DDEBUG_ENABLED','/DD3D_DEBUG_INFO']) - env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) - env.Append(LINKFLAGS=['/DEBUG', '/D_DEBUG']) + env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_ARM/lib']) - elif (env["target"]=="profile"): + else: - env.Append(CCFLAGS=['-g','-pg']) - env.Append(LINKFLAGS=['-pg']) + compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV']) + if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"): + env["bits"]="64" + print "Compiled program architecture will be a x64 executable (forcing bits=64)." + elif (compiler_version_str=="x86" or compiler_version_str == "amd64_x86"): + env["bits"]="32" + print "Compiled program architecture will be a x86 executable. (forcing bits=32)." + else: + print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup." + env["bits"]="32" - env['ENV'] = os.environ; - # fix environment for windows phone 8.1 - env['ENV']['WINDOWSPHONEKITDIR'] = env['ENV']['WINDOWSPHONEKITDIR'].replace("8.0", "8.1") # wtf - env['ENV']['INCLUDE'] = env['ENV']['INCLUDE'].replace("8.0", "8.1") - env['ENV']['LIB'] = env['ENV']['LIB'].replace("8.0", "8.1") - env['ENV']['PATH'] = env['ENV']['PATH'].replace("8.0", "8.1") - env['ENV']['LIBPATH'] = env['ENV']['LIBPATH'].replace("8.0\\Windows Metadata", "8.1\\References\\CommonConfiguration\\Neutral") + if (env["bits"] == "32"): + arch = "x86" - else: + angle_build_cmd += "Win32" - arch = "x64" - env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', "kernel32.lib", '/MACHINE:X64', '/WINMD', '/APPCONTAINER', '/MANIFESTUAC:NO', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1']) + env.Append(CPPFLAGS=['/DPNG_ABORT=abort']) + env.Append(LINKFLAGS=['/MACHINE:X86']) + env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store']) + env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_Win32/lib']) - env.Append(LIBPATH=['#platform/winrt/x64/lib']) + else: + arch = "x64" + angle_build_cmd += "x64" - if (env["target"]=="release"): + env.Append(LINKFLAGS=['/MACHINE:X64']) + env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/amd64']) + env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_x64/lib']) - env.Append(CCFLAGS=['/O2']) - env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS']) - env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup']) + env.Append(CPPPATH=['#platform/winrt','#drivers/windows']) + env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"']) + env.Append(CPPFLAGS=['/D','__WRL_NO_DEFAULT_LIB__','/D','WIN32']) + env.Append(CPPFLAGS=['/FU', os.environ['VCINSTALLDIR'] + 'lib/store/references/platform.winmd']) + env.Append(CPPFLAGS=['/AI', os.environ['VCINSTALLDIR'] + 'lib/store/references']) - elif (env["target"]=="test"): + env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/references']) - env.Append(CCFLAGS=['/O2','/DDEBUG_ENABLED','/DD3D_DEBUG_INFO']) - env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) + if (env["target"]=="release"): - elif (env["target"]=="debug"): + env.Append(CPPFLAGS=['/O2', '/GL']) + env.Append(CPPFLAGS=['/MD']) + env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS', '/LTCG']) - env.Append(CCFLAGS=['/Zi','/DDEBUG_ENABLED','/DD3D_DEBUG_INFO']) - env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) - env.Append(LINKFLAGS=['/DEBUG', '/D_DEBUG']) + elif (env["target"]=="release_debug"): - elif (env["target"]=="profile"): + env.Append(CCFLAGS=['/O2','/Zi','/DDEBUG_ENABLED']) + env.Append(CPPFLAGS=['/MD']) + env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) - env.Append(CCFLAGS=['-g','-pg']) - env.Append(LINKFLAGS=['-pg']) + elif (env["target"]=="debug"): + env.Append(CCFLAGS=['/Zi','/DDEBUG_ENABLED','/DDEBUG_MEMORY_ENABLED']) + env.Append(CPPFLAGS=['/MDd']) + env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) + env.Append(LINKFLAGS=['/DEBUG']) - env.Append(CCFLAGS=string.split('/MP /GS /wd"4453" /wd"28204" /Zc:wchar_t /Gm- /Od /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /MDd /EHsc /nologo')) - env.Append(CXXFLAGS=string.split('/ZW')) - env.Append(CCFLAGS=['/AI', os.environ['VCINSTALLDIR']+'\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR']+'\\References\\CommonConfiguration\\Neutral']) - env.Append(CCFLAGS=['/DWINAPI_FAMILY=WINAPI_FAMILY_APP', '/D_WIN32_WINNT=0x0603', '/DNTDDI_VERSION=0x06030000']) - env['ENV'] = os.environ; + env.Append(CCFLAGS=string.split('/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo')) + env.Append(CXXFLAGS=string.split('/ZW /FS')) + env.Append(CCFLAGS=['/AI', os.environ['VCINSTALLDIR']+'\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR']+'\\References\\CommonConfiguration\\Neutral']) env["PROGSUFFIX"]="."+arch+env["PROGSUFFIX"] env["OBJSUFFIX"]="."+arch+env["OBJSUFFIX"] env["LIBSUFFIX"]="."+arch+env["LIBSUFFIX"] - - #env.Append(CCFLAGS=['/Gd','/GR','/nologo', '/EHsc']) - #env.Append(CXXFLAGS=['/TP', '/ZW']) - #env.Append(CPPFLAGS=['/DMSVC', '/GR', ]) - ##env.Append(CCFLAGS=['/I'+os.getenv("WindowsSdkDir")+"/Include"]) env.Append(CCFLAGS=['/DWINRT_ENABLED']) env.Append(CCFLAGS=['/DWINDOWS_ENABLED']) - env.Append(CCFLAGS=['/DRTAUDIO_ENABLED']) - #env.Append(CCFLAGS=['/DWIN32']) env.Append(CCFLAGS=['/DTYPED_METHOD_BIND']) - env.Append(CCFLAGS=['/DGLES2_ENABLED']) - #env.Append(CCFLAGS=['/DGLES1_ENABLED']) + env.Append(CCFLAGS=['/DGLES2_ENABLED','/DGL_GLEXT_PROTOTYPES','/DEGL_EGLEXT_PROTOTYPES','/DANGLE_ENABLED']) - LIBS=[ - #'winmm', + LIBS = [ + 'xaudio2', + 'WindowsApp', + 'mincore', + 'libANGLE', 'libEGL', 'libGLESv2', - 'libANGLE', - #'kernel32','ole32','user32', 'advapi32' ] env.Append(LINKFLAGS=[p+".lib" for p in LIBS]) - import methods + # Incremental linking fix + env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program'] + env['BUILDERS']['Program'] = methods.precious_program + + env.Append( BUILDERS = { 'ANGLE' : env.Builder(action = angle_build_cmd) } ) + env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } ) env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) - - -#/c/Program Files (x86)/Windows Phone Kits/8.1/lib/ARM/WindowsPhoneCore.lib diff --git a/platform/winrt/export/export.cpp b/platform/winrt/export/export.cpp new file mode 100644 index 0000000000..eca9f09de6 --- /dev/null +++ b/platform/winrt/export/export.cpp @@ -0,0 +1,2391 @@ +/*************************************************************************/ +/* export.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +/************************************************************************* + * The code for signing the package was ported from fb-util-for-appx + * available at https://github.com/facebook/fb-util-for-appx + * and distributed also under the following license: + +BSD License + +For fb-util-for-appx software + +Copyright (c) 2016, Facebook, Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name Facebook nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*************************************************************************/ + + +#include "version.h" +#include "export.h" +#include "object.h" +#include "tools/editor/editor_import_export.h" +#include "tools/editor/editor_node.h" +#include "platform/winrt/logo.h" +#include "os/file_access.h" +#include "io/zip.h" +#include "io/unzip.h" +#include "io/zip_io.h" +#include "io/sha256.h" +#include "io/base64.h" +#include "bind/core_bind.h" +#include "globals.h" +#include "io/marshalls.h" + +#include <zlib.h> + +// Capabilities +static const char* uwp_capabilities[] = { + "allJoyn", + "codeGeneration", + "internetClient", + "internetClientServer", + "privateNetworkClientServer", + NULL +}; +static const char* uwp_uap_capabilities[] = { + "appointments", + "blockedChatMessages", + "chat", + "contacts", + "enterpriseAuthentication", + "musicLibrary", + "objects3D", + "picturesLibrary", + "phoneCall", + "removableStorage", + "sharedUserCertificates", + "userAccountInformation", + "videosLibrary", + "voipCall", + NULL +}; +static const char* uwp_device_capabilites[] = { + "bluetooth", + "location", + "microphone", + "proximity", + "webcam", + NULL +}; + +#ifdef OPENSSL_ENABLED +#include <openssl/bio.h> +#include <openssl/asn1.h> +#include <openssl/pkcs7.h> +#include <openssl/pkcs12.h> +#include <openssl/err.h> +#include <openssl/asn1t.h> +#include <openssl/x509.h> +#include <openssl/ossl_typ.h> + +namespace asn1 { + // https://msdn.microsoft.com/en-us/gg463180.aspx + + struct SPCStatementType { + ASN1_OBJECT *type; + }; + DECLARE_ASN1_FUNCTIONS(SPCStatementType) + + struct SPCSpOpusInfo { + ASN1_TYPE *programName; + ASN1_TYPE *moreInfo; + }; + DECLARE_ASN1_FUNCTIONS(SPCSpOpusInfo) + + struct DigestInfo { + X509_ALGOR *digestAlgorithm; + ASN1_OCTET_STRING *digest; + }; + DECLARE_ASN1_FUNCTIONS(DigestInfo) + + struct SPCAttributeTypeAndOptionalValue { + ASN1_OBJECT *type; + ASN1_TYPE *value; // SPCInfoValue + }; + DECLARE_ASN1_FUNCTIONS(SPCAttributeTypeAndOptionalValue) + + // Undocumented. + struct SPCInfoValue { + ASN1_INTEGER *i1; + ASN1_OCTET_STRING *s1; + ASN1_INTEGER *i2; + ASN1_INTEGER *i3; + ASN1_INTEGER *i4; + ASN1_INTEGER *i5; + ASN1_INTEGER *i6; + }; + DECLARE_ASN1_FUNCTIONS(SPCInfoValue) + + struct SPCIndirectDataContent { + SPCAttributeTypeAndOptionalValue *data; + DigestInfo *messageDigest; + }; + DECLARE_ASN1_FUNCTIONS(SPCIndirectDataContent) + + IMPLEMENT_ASN1_FUNCTIONS(SPCIndirectDataContent) + ASN1_SEQUENCE(SPCIndirectDataContent) = { + ASN1_SIMPLE(SPCIndirectDataContent, data, + SPCAttributeTypeAndOptionalValue), + ASN1_SIMPLE(SPCIndirectDataContent, messageDigest, DigestInfo), + } ASN1_SEQUENCE_END(SPCIndirectDataContent) + + IMPLEMENT_ASN1_FUNCTIONS(SPCAttributeTypeAndOptionalValue) + ASN1_SEQUENCE(SPCAttributeTypeAndOptionalValue) = { + ASN1_SIMPLE(SPCAttributeTypeAndOptionalValue, type, + ASN1_OBJECT), + ASN1_OPT(SPCAttributeTypeAndOptionalValue, value, ASN1_ANY), + } ASN1_SEQUENCE_END(SPCAttributeTypeAndOptionalValue) + + IMPLEMENT_ASN1_FUNCTIONS(SPCInfoValue) + ASN1_SEQUENCE(SPCInfoValue) = { + ASN1_SIMPLE(SPCInfoValue, i1, ASN1_INTEGER), + ASN1_SIMPLE(SPCInfoValue, s1, ASN1_OCTET_STRING), + ASN1_SIMPLE(SPCInfoValue, i2, ASN1_INTEGER), + ASN1_SIMPLE(SPCInfoValue, i3, ASN1_INTEGER), + ASN1_SIMPLE(SPCInfoValue, i4, ASN1_INTEGER), + ASN1_SIMPLE(SPCInfoValue, i5, ASN1_INTEGER), + ASN1_SIMPLE(SPCInfoValue, i6, ASN1_INTEGER), + } ASN1_SEQUENCE_END(SPCInfoValue) + + IMPLEMENT_ASN1_FUNCTIONS(DigestInfo) + ASN1_SEQUENCE(DigestInfo) = { + ASN1_SIMPLE(DigestInfo, digestAlgorithm, X509_ALGOR), + ASN1_SIMPLE(DigestInfo, digest, ASN1_OCTET_STRING), + } ASN1_SEQUENCE_END(DigestInfo) + + ASN1_SEQUENCE(SPCSpOpusInfo) = { + ASN1_OPT(SPCSpOpusInfo, programName, ASN1_ANY), + ASN1_OPT(SPCSpOpusInfo, moreInfo, ASN1_ANY), + } ASN1_SEQUENCE_END(SPCSpOpusInfo) + IMPLEMENT_ASN1_FUNCTIONS(SPCSpOpusInfo) + + ASN1_SEQUENCE(SPCStatementType) = { + ASN1_SIMPLE(SPCStatementType, type, ASN1_OBJECT), + } ASN1_SEQUENCE_END(SPCStatementType) + IMPLEMENT_ASN1_FUNCTIONS(SPCStatementType) +} + +class EncodedASN1 { + + uint8_t* i_data; + size_t i_size; + + EncodedASN1(uint8_t** p_data, size_t p_size) { + + i_data = *p_data; + i_size = p_size; + } + +public: + + template <typename T, int(*TEncode)(T *, uint8_t **)> + static EncodedASN1 FromItem(T *item) { + uint8_t *dataRaw = NULL; + int size = TEncode(item, &dataRaw); + + return EncodedASN1(&dataRaw, size); + } + + const uint8_t *data() const { + return i_data; + } + + size_t size() const { + return i_size; + } + + // Assumes the encoded ASN.1 represents a SEQUENCE and puts it into + // an ASN1_STRING. + // + // The returned object holds a copy of this object's data. + ASN1_STRING* ToSequenceString() { + ASN1_STRING* string = ASN1_STRING_new(); + if (!string) { + return NULL; + } + if (!ASN1_STRING_set(string, i_data, i_size)) { + return NULL; + } + return string; + } + + // Assumes the encoded ASN.1 represents a SEQUENCE and puts it into + // an ASN1_TYPE. + // + // The returned object holds a copy of this object's data. + ASN1_TYPE* ToSequenceType() { + ASN1_STRING* string = ToSequenceString(); + ASN1_TYPE* type = ASN1_TYPE_new(); + if (!type) { + return NULL; + } + type->type = V_ASN1_SEQUENCE; + type->value.sequence = string; + return type; + } + +}; + +#endif // OPENSSL_ENABLED + +class AppxPackager { + + enum { + FILE_HEADER_MAGIC = 0x04034b50, + DATA_DESCRIPTOR_MAGIC = 0x08074b50, + CENTRAL_DIR_MAGIC = 0x02014b50, + END_OF_CENTRAL_DIR_MAGIC = 0x06054b50, + ZIP64_END_OF_CENTRAL_DIR_MAGIC = 0x06064b50, + ZIP64_END_DIR_LOCATOR_MAGIC = 0x07064b50, + P7X_SIGNATURE = 0x58434b50, + ZIP64_HEADER_ID = 0x0001, + ZIP_VERSION = 20, + ZIP_ARCHIVE_VERSION = 45, + GENERAL_PURPOSE = 0x00, + BASE_FILE_HEADER_SIZE = 30, + DATA_DESCRIPTOR_SIZE = 24, + BASE_CENTRAL_DIR_SIZE = 46, + EXTRA_FIELD_LENGTH = 28, + ZIP64_HEADER_SIZE = 24, + ZIP64_END_OF_CENTRAL_DIR_SIZE = (56 - 12), + END_OF_CENTRAL_DIR_SIZE = 42, + BLOCK_SIZE = 65536, + }; + + struct BlockHash { + + String base64_hash; + size_t compressed_size; + }; + + struct FileMeta { + + String name; + int lfh_size; + bool compressed; + size_t compressed_size; + size_t uncompressed_size; + Vector<BlockHash> hashes; + uLong file_crc32; + ZPOS64_T zip_offset; + }; + + String progress_task; + FileAccess *package; + String tmp_blockmap_file_path; + String tmp_content_types_file_path; + + Set<String> mime_types; + + Vector<FileMeta> file_metadata; + + ZPOS64_T central_dir_offset; + ZPOS64_T end_of_central_dir_offset; + Vector<uint8_t> central_dir_data; + + String hash_block(uint8_t* p_block_data, size_t p_block_len); + + void make_block_map(); + void make_content_types(); + + + _FORCE_INLINE_ unsigned int buf_put_int16(uint16_t p_val, uint8_t * p_buf) { + for (int i = 0; i < 2; i++) { + *p_buf++ = (p_val >> (i * 8)) & 0xFF; + } + return 2; + } + + _FORCE_INLINE_ unsigned int buf_put_int32(uint32_t p_val, uint8_t * p_buf) { + for (int i = 0; i < 4; i++) { + *p_buf++ = (p_val >> (i * 8)) & 0xFF; + } + return 4; + } + + _FORCE_INLINE_ unsigned int buf_put_int64(uint64_t p_val, uint8_t * p_buf) { + for (int i = 0; i < 8; i++) { + *p_buf++ = (p_val >> (i * 8)) & 0xFF; + } + return 8; + } + + _FORCE_INLINE_ unsigned int buf_put_string(String p_val, uint8_t * p_buf) { + for (int i = 0; i < p_val.length(); i++) { + *p_buf++ = p_val.utf8().get(i); + } + return p_val.length(); + } + + Vector<uint8_t> make_file_header(FileMeta p_file_meta); + void store_central_dir_header(const FileMeta p_file, bool p_do_hash = true); + Vector<uint8_t> make_end_of_central_record(); + + String content_type(String p_extension); + +#ifdef OPENSSL_ENABLED + + // Signing methods and structs: + + String certificate_path; + String certificate_pass; + bool sign_package; + + struct CertFile { + + EVP_PKEY* private_key; + X509* certificate; + }; + + SHA256_CTX axpc_context; // SHA256 context for ZIP file entries + SHA256_CTX axcd_context; // SHA256 context for ZIP directory entries + + struct AppxDigests { + + uint8_t axpc[SHA256_DIGEST_LENGTH]; // ZIP file entries + uint8_t axcd[SHA256_DIGEST_LENGTH]; // ZIP directory entry + uint8_t axct[SHA256_DIGEST_LENGTH]; // Content types XML + uint8_t axbm[SHA256_DIGEST_LENGTH]; // Block map XML + uint8_t axci[SHA256_DIGEST_LENGTH]; // Code Integrity file (optional) + }; + + CertFile cert_file; + AppxDigests digests; + + void MakeSPCInfoValue(asn1::SPCInfoValue &info); + Error MakeIndirectDataContent(asn1::SPCIndirectDataContent &idc); + Error add_attributes(PKCS7_SIGNER_INFO *signerInfo); + void make_digests(); + void write_digest(Vector<uint8_t> &p_out_buffer); + + Error openssl_error(unsigned long p_err); + Error read_cert_file(const String &p_path, const String &p_password, CertFile* p_out_cf); + Error sign(const CertFile &p_cert, const AppxDigests &digests, PKCS7* p_out_signature); + +#endif // OPENSSL_ENABLED + +public: + + enum SignOption { + + SIGN, + DONT_SIGN, + }; + + void set_progress_task(String p_task) { progress_task = p_task; } + void init(FileAccess* p_fa, SignOption p_sign, String &p_certificate_path, String &p_certificate_password); + void add_file(String p_file_name, const uint8_t* p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress = false); + void finish(); + + AppxPackager(); + ~AppxPackager(); +}; + +class EditorExportPlatformWinrt : public EditorExportPlatform { + + OBJ_TYPE(EditorExportPlatformWinrt, EditorExportPlatform); + + Ref<ImageTexture> logo; + + enum Platform { + ARM, + X86, + X64 + } arch; + + bool is_debug; + + String custom_release_package; + String custom_debug_package; + + String cmdline; + + String display_name; + String short_name; + String unique_name; + String description; + String publisher; + String publisher_display_name; + + String product_guid; + String publisher_guid; + + int version_major; + int version_minor; + int version_build; + int version_revision; + + bool orientation_landscape; + bool orientation_portrait; + bool orientation_landscape_flipped; + bool orientation_portrait_flipped; + + String background_color; + Ref<ImageTexture> store_logo; + Ref<ImageTexture> square44; + Ref<ImageTexture> square71; + Ref<ImageTexture> square150; + Ref<ImageTexture> square310; + Ref<ImageTexture> wide310; + Ref<ImageTexture> splash; + + bool name_on_square150; + bool name_on_square310; + bool name_on_wide; + + Set<String> capabilities; + Set<String> uap_capabilities; + Set<String> device_capabilities; + + bool sign_package; + String certificate_path; + String certificate_pass; + + _FORCE_INLINE_ bool array_has(const char** p_array, const char* p_value) const { + while (*p_array) { + if (String(*p_array) == String(p_value)) return true; + p_array++; + } + return false; + } + + bool _valid_resource_name(const String &p_name) const; + bool _valid_guid(const String &p_guid) const; + bool _valid_bgcolor(const String &p_color) const; + bool _valid_image(const Ref<ImageTexture> p_image, int p_width, int p_height) const; + + Vector<uint8_t> _fix_manifest(const Vector<uint8_t> &p_template, bool p_give_internet) const; + Vector<uint8_t> _get_image_data(const String &p_path); + + static Error save_appx_file(void *p_userdata, const String& p_path, const Vector<uint8_t>& p_data, int p_file, int p_total); + static bool _should_compress_asset(const String& p_path, const Vector<uint8_t>& p_data); + +protected: + + bool _set(const StringName& p_name, const Variant& p_value); + bool _get(const StringName& p_name, Variant &r_ret) const; + void _get_property_list(List<PropertyInfo> *p_list) const; + +public: + + virtual String get_name() const { return "Windows Universal"; } + virtual ImageCompression get_image_compression() const { return IMAGE_COMPRESSION_ETC1; } + virtual Ref<Texture> get_logo() const { return logo; } + + virtual bool can_export(String *r_error = NULL) const; + virtual String get_binary_extension() const { return "appx"; } + + virtual Error export_project(const String& p_path, bool p_debug, int p_flags = 0); + + EditorExportPlatformWinrt(); + ~EditorExportPlatformWinrt(); +}; + + +/////////////////////////////////////////////////////////////////////////// + +String AppxPackager::hash_block(uint8_t * p_block_data, size_t p_block_len) { + + char hash[32]; + char base64[45]; + + sha256_context ctx; + sha256_init(&ctx); + sha256_hash(&ctx, p_block_data, p_block_len); + sha256_done(&ctx, (uint8_t*)hash); + + base64_encode(base64, hash, 32); + base64[44] = '\0'; + + return String(base64); +} + +void AppxPackager::make_block_map() { + + FileAccess* tmp_file = FileAccess::open(tmp_blockmap_file_path, FileAccess::WRITE); + + tmp_file->store_string("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"); + tmp_file->store_string("<BlockMap xmlns=\"http://schemas.microsoft.com/appx/2010/blockmap\" HashMethod=\"http://www.w3.org/2001/04/xmlenc#sha256\">"); + + for (int i = 0; i < file_metadata.size(); i++) { + + FileMeta file = file_metadata[i]; + + tmp_file->store_string( + "<File Name=\"" + file.name.replace("/", "\\") + + "\" Size=\"" + itos(file.uncompressed_size) + + "\" LfhSize=\"" + itos(file.lfh_size) + "\">"); + + + for (int j = 0; j < file.hashes.size(); j++) { + + tmp_file->store_string("<Block Hash=\"" + + file.hashes[j].base64_hash + "\" "); + if (file.compressed) + tmp_file->store_string("Size=\"" + itos(file.hashes[j].compressed_size) + "\" "); + tmp_file->store_string("/>"); + } + + tmp_file->store_string("</File>"); + } + + tmp_file->store_string("</BlockMap>"); + + tmp_file->close(); + memdelete(tmp_file); + tmp_file = NULL; +} + +String AppxPackager::content_type(String p_extension) { + + if (p_extension == "png") + return "image/png"; + else if (p_extension == "jpg") + return "image/jpg"; + else if (p_extension == "xml") + return "application/xml"; + else if (p_extension == "exe" || p_extension == "dll") + return "application/x-msdownload"; + else + return "application/octet-stream"; +} + +void AppxPackager::make_content_types() { + + FileAccess* tmp_file = FileAccess::open(tmp_content_types_file_path, FileAccess::WRITE); + + tmp_file->store_string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); + tmp_file->store_string("<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">"); + + Map<String, String> types; + + for (int i = 0; i < file_metadata.size(); i++) { + + String ext = file_metadata[i].name.extension(); + + if (types.has(ext)) continue; + + types[ext] = content_type(ext); + + tmp_file->store_string("<Default Extension=\"" + ext + + "\" ContentType=\"" + + types[ext] + "\" />"); + } + + // Appx signature file + tmp_file->store_string("<Default Extension=\"p7x\" ContentType=\"application/octet-stream\" />"); + + // Override for package files + tmp_file->store_string("<Override PartName=\"/AppxManifest.xml\" ContentType=\"application/vnd.ms-appx.manifest+xml\" />"); + tmp_file->store_string("<Override PartName=\"/AppxBlockMap.xml\" ContentType=\"application/vnd.ms-appx.blockmap+xml\" />"); + tmp_file->store_string("<Override PartName=\"/AppxSignature.p7x\" ContentType=\"application/vnd.ms-appx.signature\" />"); + tmp_file->store_string("<Override PartName=\"/AppxMetadata/CodeIntegrity.cat\" ContentType=\"application/vnd.ms-pkiseccat\" />"); + + tmp_file->store_string("</Types>"); + + tmp_file->close(); + memdelete(tmp_file); + tmp_file = NULL; +} + +Vector<uint8_t> AppxPackager::make_file_header(FileMeta p_file_meta) { + + Vector<uint8_t> buf; + buf.resize(BASE_FILE_HEADER_SIZE + p_file_meta.name.length()); + + int offs = 0; + // Write magic + offs += buf_put_int32(FILE_HEADER_MAGIC, &buf[offs]); + + // Version + offs += buf_put_int16(ZIP_VERSION, &buf[offs]); + + // Special flag + offs += buf_put_int16(GENERAL_PURPOSE, &buf[offs]); + + // Compression + offs += buf_put_int16(p_file_meta.compressed ? Z_DEFLATED : 0, &buf[offs]); + + // File date and time + offs += buf_put_int32(0, &buf[offs]); + + // CRC-32 + offs += buf_put_int32(p_file_meta.file_crc32, &buf[offs]); + + // Compressed size + offs += buf_put_int32(p_file_meta.compressed_size, &buf[offs]); + + // Uncompressed size + offs += buf_put_int32(p_file_meta.uncompressed_size, &buf[offs]); + + // File name length + offs += buf_put_int16(p_file_meta.name.length(), &buf[offs]); + + // Extra data length + offs += buf_put_int16(0, &buf[offs]); + + // File name + offs += buf_put_string(p_file_meta.name, &buf[offs]); + + // Done! + return buf; +} + +void AppxPackager::store_central_dir_header(const FileMeta p_file, bool p_do_hash) { + + Vector<uint8_t> &buf = central_dir_data; + int offs = buf.size(); + buf.resize(buf.size() + BASE_CENTRAL_DIR_SIZE + p_file.name.length()); + + + // Write magic + offs += buf_put_int32(CENTRAL_DIR_MAGIC, &buf[offs]); + + // ZIP versions + offs += buf_put_int16(ZIP_ARCHIVE_VERSION, &buf[offs]); + offs += buf_put_int16(ZIP_VERSION, &buf[offs]); + + // General purpose flag + offs += buf_put_int16(GENERAL_PURPOSE, &buf[offs]); + + // Compression + offs += buf_put_int16(p_file.compressed ? Z_DEFLATED : 0, &buf[offs]); + + // Modification date/time + offs += buf_put_int32(0, &buf[offs]); + + // Crc-32 + offs += buf_put_int32(p_file.file_crc32, &buf[offs]); + + // File sizes + offs += buf_put_int32(p_file.compressed_size, &buf[offs]); + offs += buf_put_int32(p_file.uncompressed_size, &buf[offs]); + + // File name length + offs += buf_put_int16(p_file.name.length(), &buf[offs]); + + // Extra field length + offs += buf_put_int16(0, &buf[offs]); + + // Comment length + offs += buf_put_int16(0, &buf[offs]); + + // Disk number start, internal/external file attributes + for (int i = 0; i < 8; i++) { + buf[offs++] = 0; + } + + // Relative offset + offs += buf_put_int32(p_file.zip_offset, &buf[offs]); + + // File name + offs += buf_put_string(p_file.name, &buf[offs]); + +#ifdef OPENSSL_ENABLED + // Calculate the hash for signing + if (p_do_hash) + SHA256_Update(&axcd_context, buf.ptr(), buf.size()); +#endif // OPENSSL_ENABLED + + // Done! +} + +Vector<uint8_t> AppxPackager::make_end_of_central_record() { + + Vector<uint8_t> buf; + buf.resize(ZIP64_END_OF_CENTRAL_DIR_SIZE + 12 + END_OF_CENTRAL_DIR_SIZE); // Size plus magic + + int offs = 0; + + // Write magic + offs += buf_put_int32(ZIP64_END_OF_CENTRAL_DIR_MAGIC, &buf[offs]); + + // Size of this record + offs += buf_put_int64(ZIP64_END_OF_CENTRAL_DIR_SIZE, &buf[offs]); + + // Version (yes, twice) + offs += buf_put_int16(ZIP_ARCHIVE_VERSION, &buf[offs]); + offs += buf_put_int16(ZIP_ARCHIVE_VERSION, &buf[offs]); + + // Disk number + for (int i = 0; i < 8; i++) { + buf[offs++] = 0; + } + + // Number of entries (total and per disk) + offs += buf_put_int64(file_metadata.size(), &buf[offs]); + offs += buf_put_int64(file_metadata.size(), &buf[offs]); + + // Size of central dir + offs += buf_put_int64(central_dir_data.size(), &buf[offs]); + + // Central dir offset + offs += buf_put_int64(central_dir_offset, &buf[offs]); + + ////// ZIP64 locator + + // Write magic for zip64 central dir locator + offs += buf_put_int32(ZIP64_END_DIR_LOCATOR_MAGIC, &buf[offs]); + + // Disk number + for (int i = 0; i < 4; i++) { + buf[offs++] = 0; + } + + // Relative offset + offs += buf_put_int64(end_of_central_dir_offset, &buf[offs]); + + // Number of disks + offs += buf_put_int32(1, &buf[offs]); + + /////// End of zip directory + + // Write magic for end central dir + offs += buf_put_int32(END_OF_CENTRAL_DIR_MAGIC, &buf[offs]); + + // Dummy stuff for Zip64 + for (int i = 0; i < 4; i++) { + buf[offs++] = 0x0; + } + for (int i = 0; i < 12; i++) { + buf[offs++] = 0xFF; + } + + // Size of comments + for (int i = 0; i < 2; i++) { + buf[offs++] = 0; + } + + // Done! + return buf; +} + +void AppxPackager::init(FileAccess * p_fa, SignOption p_sign, String &p_certificate_path, String &p_certificate_password) { + + package = p_fa; + central_dir_offset = 0; + end_of_central_dir_offset = 0; + tmp_blockmap_file_path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpblockmap.xml"; + tmp_content_types_file_path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpcontenttypes.xml"; +#ifdef OPENSSL_ENABLED + certificate_path = p_certificate_path; + certificate_pass = p_certificate_password; + sign_package = p_sign == SIGN; + SHA256_Init(&axpc_context); + SHA256_Init(&axcd_context); +#endif // OPENSSL_ENABLED +} + +void AppxPackager::add_file(String p_file_name, const uint8_t * p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress) { + + if (p_file_no >= 1 && p_total_files >= 1) { + EditorNode::progress_task_step(progress_task, "File: " + p_file_name, (p_file_no * 100) / p_total_files); + } + + bool do_hash = p_file_name != "AppxSignature.p7x"; + + FileMeta meta; + meta.name = p_file_name; + meta.uncompressed_size = p_len; + meta.compressed_size = p_len; + meta.compressed = p_compress; + meta.zip_offset = package->get_pos(); + + Vector<uint8_t> file_buffer; + + // Data for compression + z_stream strm; + FileAccess* strm_f = NULL; + Vector<uint8_t> strm_in; + strm_in.resize(BLOCK_SIZE); + Vector<uint8_t> strm_out; + + if (p_compress) { + + strm.zalloc = zipio_alloc; + strm.zfree = zipio_free; + strm.opaque = &strm_f; + + strm_out.resize(BLOCK_SIZE + 8); + + deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY); + } + + int step = 0; + + while (p_len - step > 0) { + + size_t block_size = (p_len - step) > BLOCK_SIZE ? BLOCK_SIZE : (p_len - step); + + for (int i = 0; i < block_size; i++) { + strm_in[i] = p_buffer[step + i]; + } + + BlockHash bh; + bh.base64_hash = hash_block(strm_in.ptr(), block_size); + + if (p_compress) { + + strm.avail_in = block_size; + strm.avail_out = strm_out.size(); + strm.next_in = strm_in.ptr(); + strm.next_out = strm_out.ptr(); + + int total_out_before = strm.total_out; + + deflate(&strm, Z_FULL_FLUSH); + bh.compressed_size = strm.total_out - total_out_before; + + //package->store_buffer(strm_out.ptr(), strm.total_out - total_out_before); + int start = file_buffer.size(); + file_buffer.resize(file_buffer.size() + bh.compressed_size); + for (int i = 0; i < bh.compressed_size; i++) + file_buffer[start + i] = strm_out[i]; +#ifdef OPENSSL_ENABLED + if (do_hash) + SHA256_Update(&axpc_context, strm_out.ptr(), strm.total_out - total_out_before); +#endif // OPENSSL_ENABLED + + } else { + bh.compressed_size = block_size; + //package->store_buffer(strm_in.ptr(), block_size); + int start = file_buffer.size(); + file_buffer.resize(file_buffer.size() + block_size); + for (int i = 0; i < bh.compressed_size; i++) + file_buffer[start + i] = strm_in[i]; +#ifdef OPENSSL_ENABLED + if (do_hash) + SHA256_Update(&axpc_context, strm_in.ptr(), block_size); +#endif // OPENSSL_ENABLED + } + + meta.hashes.push_back(bh); + + step += block_size; + } + + if (p_compress) { + + strm.avail_in = 0; + strm.avail_out = strm_out.size(); + strm.next_in = strm_in.ptr(); + strm.next_out = strm_out.ptr(); + + int total_out_before = strm.total_out; + + deflate(&strm, Z_FINISH); + + //package->store_buffer(strm_out.ptr(), strm.total_out - total_out_before); + int start = file_buffer.size(); + file_buffer.resize(file_buffer.size() + (strm.total_out - total_out_before)); + for (int i = 0; i < (strm.total_out - total_out_before); i++) + file_buffer[start + i] = strm_out[i]; +#ifdef OPENSSL_ENABLED + if (do_hash) + SHA256_Update(&axpc_context, strm_out.ptr(), strm.total_out - total_out_before); +#endif // OPENSSL_ENABLED + + deflateEnd(&strm); + meta.compressed_size = strm.total_out; + + } else { + + meta.compressed_size = p_len; + } + + // Calculate file CRC-32 + uLong crc = crc32(0L, Z_NULL, 0); + crc = crc32(crc, p_buffer, p_len); + meta.file_crc32 = crc; + + // Create file header + Vector<uint8_t> file_header = make_file_header(meta); + meta.lfh_size = file_header.size(); + +#ifdef OPENSSL_ENABLED + // Hash the data for signing + if (do_hash) { + SHA256_Update(&axpc_context, file_header.ptr(), file_header.size()); + SHA256_Update(&axpc_context, file_buffer.ptr(), file_buffer.size()); + } +#endif // OPENSSL_ENABLED + + // Store the header and file; + package->store_buffer(file_header.ptr(), file_header.size()); + package->store_buffer(file_buffer.ptr(), file_buffer.size()); + + file_metadata.push_back(meta); +} + +void AppxPackager::finish() { + + // Create and add block map file + EditorNode::progress_task_step("export", "Creating block map...", 4); + + make_block_map(); + FileAccess* blockmap_file = FileAccess::open(tmp_blockmap_file_path, FileAccess::READ); + Vector<uint8_t> blockmap_buffer; + blockmap_buffer.resize(blockmap_file->get_len()); + + blockmap_file->get_buffer(blockmap_buffer.ptr(), blockmap_buffer.size()); + +#ifdef OPENSSL_ENABLED + // Hash the file for signing + if (sign_package) { + SHA256_CTX axbm_context; + SHA256_Init(&axbm_context); + SHA256_Update(&axbm_context, blockmap_buffer.ptr(), blockmap_buffer.size()); + SHA256_Final(digests.axbm, &axbm_context); + } +#endif // OPENSSL_ENABLED + + add_file("AppxBlockMap.xml", blockmap_buffer.ptr(), blockmap_buffer.size(), -1, -1, true); + + blockmap_file->close(); + memdelete(blockmap_file); + blockmap_file = NULL; + + // Add content types + EditorNode::progress_task_step("export", "Setting content types...", 5); + make_content_types(); + + FileAccess* types_file = FileAccess::open(tmp_content_types_file_path, FileAccess::READ); + Vector<uint8_t> types_buffer; + types_buffer.resize(types_file->get_len()); + + types_file->get_buffer(types_buffer.ptr(), types_buffer.size()); + +#ifdef OPENSSL_ENABLED + if (sign_package) { + // Hash the file for signing + SHA256_CTX axct_context; + SHA256_Init(&axct_context); + SHA256_Update(&axct_context, types_buffer.ptr(), types_buffer.size()); + SHA256_Final(digests.axct, &axct_context); + } +#endif // OPENSSL_ENABLED + + add_file("[Content_Types].xml", types_buffer.ptr(), types_buffer.size(), -1, -1, true); + + types_file->close(); + memdelete(types_file); + types_file = NULL; + + // Pre-process central directory before signing + for (int i = 0; i < file_metadata.size(); i++) { + store_central_dir_header(file_metadata[i]); + } + +#ifdef OPENSSL_ENABLED + // Create the signature file + if (sign_package) { + + Error err = read_cert_file(certificate_path, certificate_pass, &cert_file); + + if (err != OK) { + EditorNode::add_io_error(TTR("Couldn't read the certficate file. Are the path and password both correct?")); + package->close(); + memdelete(package); + package = NULL; + return; + } + + + // Make a temp end of the zip for hashing + central_dir_offset = package->get_pos(); + end_of_central_dir_offset = central_dir_offset + central_dir_data.size(); + Vector<uint8_t> zip_end_dir = make_end_of_central_record(); + + // Hash the end directory + SHA256_Update(&axcd_context, zip_end_dir.ptr(), zip_end_dir.size()); + + // Finish the hashes + make_digests(); + + PKCS7* signature = PKCS7_new(); + if (!signature) { + EditorNode::add_io_error(TTR("Error creating the signature object.")); + package->close(); + memdelete(package); + package = NULL; + return; + } + + err = sign(cert_file, digests, signature); + + if (err != OK) { + EditorNode::add_io_error(TTR("Error creating the package signature.")); + package->close(); + memdelete(package); + package = NULL; + return; + } + + // Read the signature as bytes + BIO* bio_out = BIO_new(BIO_s_mem()); + i2d_PKCS7_bio(bio_out, signature); + + BIO_flush(bio_out); + + uint8_t* bio_ptr; + size_t bio_size = BIO_get_mem_data(bio_out, &bio_ptr); + + // Create the signature buffer with magic number + Vector<uint8_t> signature_file; + signature_file.resize(4 + bio_size); + buf_put_int32(P7X_SIGNATURE, signature_file.ptr()); + for (int i = 0; i < bio_size; i++) + signature_file[i + 4] = bio_ptr[i]; + + // Add the signature to the package + add_file("AppxSignature.p7x", signature_file.ptr(), signature_file.size(), -1, -1, true); + + // Add central directory entry + store_central_dir_header(file_metadata[file_metadata.size() - 1], false); + } +#endif // OPENSSL_ENABLED + + + // Write central directory + EditorNode::progress_task_step("export", "Finishing package...", 6); + central_dir_offset = package->get_pos(); + package->store_buffer(central_dir_data.ptr(), central_dir_data.size()); + + // End record + end_of_central_dir_offset = package->get_pos(); + Vector<uint8_t> end_record = make_end_of_central_record(); + package->store_buffer(end_record.ptr(), end_record.size()); + + package->close(); + memdelete(package); + package = NULL; +} + +#ifdef OPENSSL_ENABLED +// https://support.microsoft.com/en-us/kb/287547 +const char SPC_INDIRECT_DATA_OBJID[] = "1.3.6.1.4.1.311.2.1.4"; +const char SPC_STATEMENT_TYPE_OBJID[] = "1.3.6.1.4.1.311.2.1.11"; +const char SPC_SP_OPUS_INFO_OBJID[] = "1.3.6.1.4.1.311.2.1.12"; +const char SPC_SIPINFO_OBJID[] = "1.3.6.1.4.1.311.2.1.30"; +#endif // OPENSSL_ENABLED + +AppxPackager::AppxPackager() {} + +AppxPackager::~AppxPackager() {} + + +//////////////////////////////////////////////////////////////////// + +#ifdef OPENSSL_ENABLED +Error AppxPackager::openssl_error(unsigned long p_err) { + + ERR_load_crypto_strings(); + + char buffer[256]; + ERR_error_string_n(p_err, buffer, sizeof(buffer)); + + String err(buffer); + + ERR_EXPLAIN(err); + ERR_FAIL_V(FAILED); +} + +void AppxPackager::MakeSPCInfoValue(asn1::SPCInfoValue &info) { + + // I have no idea what these numbers mean. + static uint8_t s1Magic[] = { + 0x4B, 0xDF, 0xC5, 0x0A, 0x07, 0xCE, 0xE2, 0x4D, + 0xB7, 0x6E, 0x23, 0xC8, 0x39, 0xA0, 0x9F, 0xD1, + }; + ASN1_INTEGER_set(info.i1, 0x01010000); + ASN1_OCTET_STRING_set(info.s1, s1Magic, sizeof(s1Magic)); + ASN1_INTEGER_set(info.i2, 0x00000000); + ASN1_INTEGER_set(info.i3, 0x00000000); + ASN1_INTEGER_set(info.i4, 0x00000000); + ASN1_INTEGER_set(info.i5, 0x00000000); + ASN1_INTEGER_set(info.i6, 0x00000000); +} + +Error AppxPackager::MakeIndirectDataContent(asn1::SPCIndirectDataContent &idc) { + + using namespace asn1; + + ASN1_TYPE* algorithmParameter = ASN1_TYPE_new(); + if (!algorithmParameter) { + return openssl_error(ERR_peek_last_error()); + } + algorithmParameter->type = V_ASN1_NULL; + + SPCInfoValue* infoValue = SPCInfoValue_new(); + if (!infoValue) { + return openssl_error(ERR_peek_last_error()); + } + MakeSPCInfoValue(*infoValue); + + ASN1_TYPE* value = + EncodedASN1::FromItem<asn1::SPCInfoValue, + asn1::i2d_SPCInfoValue>(infoValue) + .ToSequenceType(); + + { + Vector<uint8_t> digest; + write_digest(digest); + if (!ASN1_OCTET_STRING_set(idc.messageDigest->digest, + digest.ptr(), digest.size())) { + + return openssl_error(ERR_peek_last_error()); + } + } + + idc.data->type = OBJ_txt2obj(SPC_SIPINFO_OBJID, 1); + idc.data->value = value; + idc.messageDigest->digestAlgorithm->algorithm = OBJ_nid2obj(NID_sha256); + idc.messageDigest->digestAlgorithm->parameter = algorithmParameter; + + return OK; +} + +Error AppxPackager::add_attributes(PKCS7_SIGNER_INFO * p_signer_info) { + + // Add opus attribute + asn1::SPCSpOpusInfo* opus = asn1::SPCSpOpusInfo_new(); + if (!opus) return openssl_error(ERR_peek_last_error()); + + ASN1_STRING* opus_value = EncodedASN1::FromItem<asn1::SPCSpOpusInfo, asn1::i2d_SPCSpOpusInfo>(opus) + .ToSequenceString(); + + if (!PKCS7_add_signed_attribute( + p_signer_info, + OBJ_txt2nid(SPC_SP_OPUS_INFO_OBJID), + V_ASN1_SEQUENCE, + opus_value + )) { + + asn1::SPCSpOpusInfo_free(opus); + + ASN1_STRING_free(opus_value); + return openssl_error(ERR_peek_last_error()); + } + + // Add content type attribute + if (!PKCS7_add_signed_attribute( + p_signer_info, + NID_pkcs9_contentType, + V_ASN1_OBJECT, + OBJ_txt2obj(SPC_INDIRECT_DATA_OBJID, 1) + )) { + + asn1::SPCSpOpusInfo_free(opus); + ASN1_STRING_free(opus_value); + return openssl_error(ERR_peek_last_error()); + } + + // Add statement type attribute + asn1::SPCStatementType* statement_type = asn1::SPCStatementType_new(); + if (!statement_type) return openssl_error(ERR_peek_last_error()); + + statement_type->type = OBJ_nid2obj(NID_ms_code_ind); + ASN1_STRING* statement_type_value = + EncodedASN1::FromItem<asn1::SPCStatementType, asn1::i2d_SPCStatementType>(statement_type) + .ToSequenceString(); + + if (!PKCS7_add_signed_attribute( + p_signer_info, + OBJ_txt2nid(SPC_STATEMENT_TYPE_OBJID), + V_ASN1_SEQUENCE, + statement_type_value + )) { + + ASN1_STRING_free(opus_value); + asn1::SPCStatementType_free(statement_type); + ASN1_STRING_free(statement_type_value); + + return openssl_error(ERR_peek_last_error()); + } + + return OK; + +} + +void AppxPackager::make_digests() { + + // AXPC + SHA256_Final(digests.axpc, &axpc_context); + + // AXCD + SHA256_Final(digests.axcd, &axcd_context); + + // AXCI + for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) + digests.axci[i] = 0; + +} + +void AppxPackager::write_digest(Vector<uint8_t>& p_out_buffer) { + + // Size of digests plus 6 32-bit magic numbers + p_out_buffer.resize((SHA256_DIGEST_LENGTH * 5) + (6 * 4)); + + int offs = 0; + + // APPX + uint32_t sig = 0x58505041; + offs += buf_put_int32(sig, &p_out_buffer[offs]); + + // AXPC + uint32_t axpc_sig = 0x43505841; + offs += buf_put_int32(axpc_sig, &p_out_buffer[offs]); + for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) { + p_out_buffer[offs++] = digests.axpc[i]; + } + + // AXCD + uint32_t axcd_sig = 0x44435841; + offs += buf_put_int32(axcd_sig, &p_out_buffer[offs]); + for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) { + p_out_buffer[offs++] = digests.axcd[i]; + } + + // AXCT + uint32_t axct_sig = 0x54435841; + offs += buf_put_int32(axct_sig, &p_out_buffer[offs]); + for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) { + p_out_buffer[offs++] = digests.axct[i]; + } + + // AXBM + uint32_t axbm_sig = 0x4D425841; + offs += buf_put_int32(axbm_sig, &p_out_buffer[offs]); + for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) { + p_out_buffer[offs++] = digests.axbm[i]; + } + + // AXCI + uint32_t axci_sig = 0x49435841; + offs += buf_put_int32(axci_sig, &p_out_buffer[offs]); + for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) { + p_out_buffer[offs++] = digests.axci[i]; + } + + // Done! +} + +Error AppxPackager::read_cert_file(const String & p_path, const String &p_password, CertFile* p_out_cf) { + + ERR_FAIL_COND_V(!p_out_cf, ERR_INVALID_PARAMETER); + + BIO* bio = BIO_new_file(p_path.utf8().get_data(), "rb"); + if (!bio) { + return openssl_error(ERR_peek_last_error()); + } + + PKCS12* data = d2i_PKCS12_bio(bio, NULL); + if (!data) { + BIO_free(bio); + return openssl_error(ERR_peek_last_error()); + } + + /* Fails to link with GCC, need to solve when implement signing + if (!PKCS12_parse(data, p_password.utf8().get_data(), &p_out_cf->private_key, &p_out_cf->certificate, NULL)) { + PKCS12_free(data); + BIO_free(bio); + return openssl_error(ERR_peek_last_error()); + }*/ + + if (!p_out_cf->private_key) { + PKCS12_free(data); + BIO_free(bio); + return openssl_error(ERR_peek_last_error()); + } + + if (!p_out_cf->certificate) { + PKCS12_free(data); + BIO_free(bio); + return openssl_error(ERR_peek_last_error()); + } + + PKCS12_free(data); + BIO_free(bio); + + return OK; +} + +Error AppxPackager::sign(const CertFile & p_cert, const AppxDigests & digests, PKCS7 * p_out_signature) { + + OpenSSL_add_all_algorithms(); + + // Register object IDs + OBJ_create_and_add_object(SPC_INDIRECT_DATA_OBJID, NULL, NULL); + OBJ_create_and_add_object(SPC_SIPINFO_OBJID, NULL, NULL); + OBJ_create_and_add_object(SPC_SP_OPUS_INFO_OBJID, NULL, NULL); + OBJ_create_and_add_object(SPC_STATEMENT_TYPE_OBJID, NULL, NULL); + + if (!PKCS7_set_type(p_out_signature, NID_pkcs7_signed)) { + + return openssl_error(ERR_peek_last_error()); + } + + PKCS7_SIGNER_INFO *signer_info = PKCS7_add_signature(p_out_signature, p_cert.certificate, p_cert.private_key, EVP_sha256()); + if (!signer_info) return openssl_error(ERR_peek_last_error()); + + add_attributes(signer_info); + + if (!PKCS7_content_new(p_out_signature, NID_pkcs7_data)) { + + return openssl_error(ERR_peek_last_error()); + } + + if (!PKCS7_add_certificate(p_out_signature, p_cert.certificate)) { + + return openssl_error(ERR_peek_last_error()); + } + + asn1::SPCIndirectDataContent* idc = asn1::SPCIndirectDataContent_new(); + + MakeIndirectDataContent(*idc); + EncodedASN1 idc_encoded = + EncodedASN1::FromItem<asn1::SPCIndirectDataContent, asn1::i2d_SPCIndirectDataContent>(idc); + + BIO* signed_data = PKCS7_dataInit(p_out_signature, NULL); + + if (idc_encoded.size() < 2) { + + ERR_EXPLAIN("Invalid encoded size"); + ERR_FAIL_V(FAILED); + } + + if ((idc_encoded.data()[1] & 0x80) == 0x00) { + + ERR_EXPLAIN("Invalid encoded data"); + ERR_FAIL_V(FAILED); + } + + size_t skip = 4; + + if (BIO_write(signed_data, idc_encoded.data() + skip, idc_encoded.size() - skip) + != idc_encoded.size() - skip) { + + return openssl_error(ERR_peek_last_error()); + } + if (BIO_flush(signed_data) != 1) { + + return openssl_error(ERR_peek_last_error()); + } + + if (!PKCS7_dataFinal(p_out_signature, signed_data)) { + + return openssl_error(ERR_peek_last_error()); + } + + PKCS7* content = PKCS7_new(); + if (!content) { + + return openssl_error(ERR_peek_last_error()); + } + + content->type = OBJ_txt2obj(SPC_INDIRECT_DATA_OBJID, 1); + + ASN1_TYPE* idc_sequence = idc_encoded.ToSequenceType(); + content->d.other = idc_sequence; + + if (!PKCS7_set_content(p_out_signature, content)) { + + return openssl_error(ERR_peek_last_error()); + } + + return OK; +} + +#endif // OPENSSL_ENABLED + +//////////////////////////////////////////////////////////////////// + + +bool EditorExportPlatformWinrt::_valid_resource_name(const String &p_name) const { + + if (p_name.empty()) return false; + if (p_name.ends_with(".")) return false; + + static const char* invalid_names[] = { + "CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7", + "COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9", + NULL + }; + + const char** t = invalid_names; + while (*t) { + if (p_name == *t) return false; + t++; + } + + return true; +} + +bool EditorExportPlatformWinrt::_valid_guid(const String & p_guid) const { + + Vector<String> parts = p_guid.split("-"); + + if (parts.size() != 5) return false; + if (parts[0].length() != 8) return false; + for (int i = 1; i < 4; i++) + if (parts[i].length() != 4) return false; + if (parts[4].length() != 12) return false; + + return true; +} + +bool EditorExportPlatformWinrt::_valid_bgcolor(const String & p_color) const { + + if (p_color.empty()) return true; + if (p_color.begins_with("#") && p_color.is_valid_html_color()) return true; + + // Colors from https://msdn.microsoft.com/en-us/library/windows/apps/dn934817.aspx + static const char* valid_colors[] = { + "aliceBlue","antiqueWhite","aqua","aquamarine","azure","beige", + "bisque","black","blanchedAlmond","blue","blueViolet","brown", + "burlyWood","cadetBlue","chartreuse","chocolate","coral","cornflowerBlue", + "cornsilk","crimson","cyan","darkBlue","darkCyan","darkGoldenrod", + "darkGray","darkGreen","darkKhaki","darkMagenta","darkOliveGreen","darkOrange", + "darkOrchid","darkRed","darkSalmon","darkSeaGreen","darkSlateBlue","darkSlateGray", + "darkTurquoise","darkViolet","deepPink","deepSkyBlue","dimGray","dodgerBlue", + "firebrick","floralWhite","forestGreen","fuchsia","gainsboro","ghostWhite", + "gold","goldenrod","gray","green","greenYellow","honeydew", + "hotPink","indianRed","indigo","ivory","khaki","lavender", + "lavenderBlush","lawnGreen","lemonChiffon","lightBlue","lightCoral","lightCyan", + "lightGoldenrodYellow","lightGreen","lightGray","lightPink","lightSalmon","lightSeaGreen", + "lightSkyBlue","lightSlateGray","lightSteelBlue","lightYellow","lime","limeGreen", + "linen","magenta","maroon","mediumAquamarine","mediumBlue","mediumOrchid", + "mediumPurple","mediumSeaGreen","mediumSlateBlue","mediumSpringGreen","mediumTurquoise","mediumVioletRed", + "midnightBlue","mintCream","mistyRose","moccasin","navajoWhite","navy", + "oldLace","olive","oliveDrab","orange","orangeRed","orchid", + "paleGoldenrod","paleGreen","paleTurquoise","paleVioletRed","papayaWhip","peachPuff", + "peru","pink","plum","powderBlue","purple","red", + "rosyBrown","royalBlue","saddleBrown","salmon","sandyBrown","seaGreen", + "seaShell","sienna","silver","skyBlue","slateBlue","slateGray", + "snow","springGreen","steelBlue","tan","teal","thistle", + "tomato","transparent","turquoise","violet","wheat","white", + "whiteSmoke","yellow","yellowGreen", + NULL + }; + + const char** color = valid_colors; + + while(*color) { + if (p_color == *color) return true; + color++; + } + + return false; +} + +bool EditorExportPlatformWinrt::_valid_image(const Ref<ImageTexture> p_image, int p_width, int p_height) const { + + if (!p_image.is_valid()) return false; + + // TODO: Add resource creation or image rescaling to enable other scales: + // 1.25, 1.5, 2.0 + real_t scales[] = { 1.0 }; + bool valid_w = false; + bool valid_h = false; + + for (int i = 0; i < 1; i++) { + + int w = ceil(p_width * scales[i]); + int h = ceil(p_height * scales[i]); + + if (w == p_image->get_width()) + valid_w = true; + if (h == p_image->get_height()) + valid_h = true; + } + + return valid_w && valid_h; +} + +Vector<uint8_t> EditorExportPlatformWinrt::_fix_manifest(const Vector<uint8_t> &p_template, bool p_give_internet) const { + + String result = String::utf8((const char*)p_template.ptr(), p_template.size()); + + result = result.replace("$godot_version$", VERSION_FULL_NAME); + + result = result.replace("$identity_name$", unique_name); + result = result.replace("$publisher$", publisher); + + result = result.replace("$product_guid$", product_guid); + result = result.replace("$publisher_guid$", publisher_guid); + + String version = itos(version_major) + "." + itos(version_minor) + "." + itos(version_build) + "." + itos(version_revision); + result = result.replace("$version_string$", version); + + String architecture = arch == ARM ? "ARM" : arch == X86 ? "x86" : "x64"; + result = result.replace("$architecture$", architecture); + + result = result.replace("$display_name$", display_name.empty() ? (String)Globals::get_singleton()->get("application/name") : display_name); + result = result.replace("$publisher_display_name$", publisher_display_name); + result = result.replace("$app_description$", description); + result = result.replace("$bg_color$", background_color); + result = result.replace("$short_name$", short_name); + + String name_on_tiles = ""; + if (name_on_square150) { + name_on_tiles += " <uap:ShowOn Tile=\"square150x150Logo\" />\n"; + } + if (name_on_wide) { + name_on_tiles += " <uap:ShowOn Tile=\"wide310x150Logo\" />\n"; + } + if (name_on_square310) { + name_on_tiles += " <uap:ShowOn Tile=\"square310x310Logo\" />\n"; + } + + String show_name_on_tiles = ""; + if (!name_on_tiles.empty()) { + show_name_on_tiles = "<uap:ShowNameOnTiles>\n" + name_on_tiles + " </uap:ShowNameOnTiles>"; + } + + result = result.replace("$name_on_tiles$", name_on_tiles); + + String rotations = ""; + if (orientation_landscape) { + rotations += " <uap:Rotation Preference=\"landscape\" />\n"; + } + if (orientation_portrait) { + rotations += " <uap:Rotation Preference=\"portrait\" />\n"; + } + if (orientation_landscape_flipped) { + rotations += " <uap:Rotation Preference=\"landscapeFlipped\" />\n"; + } + if (orientation_portrait_flipped) { + rotations += " <uap:Rotation Preference=\"portraitFlipped\" />\n"; + } + + String rotation_preference = ""; + if (!rotations.empty()) { + rotation_preference = "<uap:InitialRotationPreference>\n" + rotations + " </uap:InitialRotationPreference>"; + } + + result = result.replace("$rotation_preference$", rotation_preference); + + String capabilities_elements = ""; + const char **basic = uwp_capabilities; + while (*basic) { + if (capabilities.has(*basic)) { + capabilities_elements += " <Capability Name=\"" + String(*basic) + "\" />\n"; + } + basic++; + } + const char **uap = uwp_uap_capabilities; + while (*uap) { + if (uap_capabilities.has(*uap)) { + capabilities_elements += " <uap:Capability Name=\"" + String(*uap) + "\" />\n"; + } + uap++; + } + const char **device = uwp_device_capabilites; + while (*device) { + if (uap_capabilities.has(*device)) { + capabilities_elements += " <DeviceCapability Name=\"" + String(*device) + "\" />\n"; + } + device++; + } + + if (!capabilities.has("internetClient") && p_give_internet) { + capabilities_elements += " <Capability Name=\"internetClient\" />\n"; + } + + String capabilities_string = "<Capabilities />"; + if (!capabilities_elements.empty()) { + capabilities_string = "<Capabilities>\n" + capabilities_elements + " </Capabilities>"; + } + + result = result.replace("$capabilities_place$", capabilities_string); + + Vector<uint8_t> r_ret; + r_ret.resize(result.length()); + + for (int i = 0; i < result.length(); i++) + r_ret[i] = result.utf8().get(i); + + return r_ret; +} + +Vector<uint8_t> EditorExportPlatformWinrt::_get_image_data(const String & p_path) { + + Vector<uint8_t> data; + Ref<ImageTexture> ref; + + if (p_path.find("StoreLogo") != -1) { + ref = store_logo; + } else if (p_path.find("Square44x44Logo") != -1) { + ref = square44; + } else if (p_path.find("Square71x71Logo") != -1) { + ref = square71; + } else if (p_path.find("Square150x150Logo") != -1) { + ref = square150; + } else if (p_path.find("Square310x310Logo") != -1) { + ref = square310; + } else if (p_path.find("Wide310x150Logo") != -1) { + ref = wide310; + } else if (p_path.find("SplashScreen") != -1) { + ref = splash; + } + + if (!ref.is_valid()) return data; + + + String tmp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp/uwp_tmp_logo.png"); + + Error err = ref->get_data().save_png(tmp_path); + + if (err != OK) { + + String err_string = "Couldn't save temp logo file."; + + EditorNode::add_io_error(err_string); + ERR_EXPLAIN(err_string); + ERR_FAIL_V(data); + } + + FileAccess* f = FileAccess::open(tmp_path, FileAccess::READ, &err); + + if (err != OK) { + + String err_string = "Couldn't open temp logo file."; + + EditorNode::add_io_error(err_string); + ERR_EXPLAIN(err_string); + ERR_FAIL_V(data); + } + + data.resize(f->get_len()); + f->get_buffer(data.ptr(), data.size()); + + f->close(); + memdelete(f); + + // Delete temp file + DirAccess* dir = DirAccess::open(tmp_path.get_base_dir(), &err); + + if (err != OK) { + + String err_string = "Couldn't open temp path to remove temp logo file."; + + EditorNode::add_io_error(err_string); + ERR_EXPLAIN(err_string); + ERR_FAIL_V(data); + } + + err = dir->remove(tmp_path); + + memdelete(dir); + + if (err != OK) { + + String err_string = "Couldn't remove temp logo file."; + + EditorNode::add_io_error(err_string); + ERR_EXPLAIN(err_string); + ERR_FAIL_V(data); + } + + return data; +} + +Error EditorExportPlatformWinrt::save_appx_file(void * p_userdata, const String & p_path, const Vector<uint8_t>& p_data, int p_file, int p_total) { + + AppxPackager *packager = (AppxPackager*)p_userdata; + String dst_path = p_path.replace_first("res://", "game/"); + + packager->add_file(dst_path, p_data.ptr(), p_data.size(), p_file, p_total, _should_compress_asset(p_path, p_data)); + + return OK; +} + +bool EditorExportPlatformWinrt::_should_compress_asset(const String & p_path, const Vector<uint8_t>& p_data) { + + /* TODO: This was copied verbatim from Android export. It should be + * refactored to the parent class and also be used for .zip export. + */ + + /* + * By not compressing files with little or not benefit in doing so, + * a performance gain is expected at runtime. Moreover, if the APK is + * zip-aligned, assets stored as they are can be efficiently read by + * Android by memory-mapping them. + */ + + // -- Unconditional uncompress to mimic AAPT plus some other + + static const char* unconditional_compress_ext[] = { + // From https://github.com/android/platform_frameworks_base/blob/master/tools/aapt/Package.cpp + // These formats are already compressed, or don't compress well: + ".jpg", ".jpeg", ".png", ".gif", + ".wav", ".mp2", ".mp3", ".ogg", ".aac", + ".mpg", ".mpeg", ".mid", ".midi", ".smf", ".jet", + ".rtttl", ".imy", ".xmf", ".mp4", ".m4a", + ".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2", + ".amr", ".awb", ".wma", ".wmv", + // Godot-specific: + ".webp", // Same reasoning as .png + ".cfb", // Don't let small config files slow-down startup + // Trailer for easier processing + NULL + }; + + for (const char** ext = unconditional_compress_ext; *ext; ++ext) { + if (p_path.to_lower().ends_with(String(*ext))) { + return false; + } + } + + // -- Compressed resource? + + if (p_data.size() >= 4 && p_data[0] == 'R' && p_data[1] == 'S' && p_data[2] == 'C' && p_data[3] == 'C') { + // Already compressed + return false; + } + + // --- TODO: Decide on texture resources according to their image compression setting + + return true; +} + +bool EditorExportPlatformWinrt::_set(const StringName& p_name, const Variant& p_value) { + + String n = p_name; + + if (n == "architecture/target") + arch = (Platform)((int)p_value); + else if (n == "custom_package/debug") + custom_debug_package = p_value; + else if (n == "custom_package/release") + custom_release_package = p_value; + else if (n == "command_line/extra_args") + cmdline = p_value; + else if (n == "package/display_name") + display_name = p_value; + else if (n == "package/short_name") + short_name = p_value; + else if (n == "package/unique_name") + unique_name = p_value; + else if (n == "package/description") + description = p_value; + else if (n == "package/publisher") + publisher = p_value; + else if (n == "package/publisher_display_name") + publisher_display_name = p_value; + else if (n == "identity/product_guid") + product_guid = p_value; + else if (n == "identity/publisher_guid") + publisher_guid = p_value; + else if (n == "version/major") + version_major = p_value; + else if (n == "version/minor") + version_minor = p_value; + else if (n == "version/build") + version_build = p_value; + else if (n == "version/revision") + version_revision = p_value; + else if (n == "orientation/landscape") + orientation_landscape = p_value; + else if (n == "orientation/portrait") + orientation_portrait = p_value; + else if (n == "orientation/landscape_flipped") + orientation_landscape_flipped = p_value; + else if (n == "orientation/portrait_flipped") + orientation_portrait_flipped = p_value; + else if (n == "images/background_color") + background_color = p_value; + else if (n == "images/store_logo") + store_logo = p_value; + else if (n == "images/square44x44_logo") + square44 = p_value; + else if (n == "images/square71x71_logo") + square71 = p_value; + else if (n == "images/square150x150_logo") + square150 = p_value; + else if (n == "images/square310x310_logo") + square310 = p_value; + else if (n == "images/wide310x150_logo") + wide310 = p_value; + else if (n == "images/splash_screen") + splash = p_value; + else if (n == "tiles/show_name_on_square150x150") + name_on_square150 = p_value; + else if (n == "tiles/show_name_on_wide310x150") + name_on_wide = p_value; + else if (n == "tiles/show_name_on_square310x310") + name_on_square310 = p_value; + +#if 0 // Signing disabled + else if (n == "signing/sign") + sign_package = p_value; + else if (n == "signing/certificate_file") + certificate_path = p_value; + else if (n == "signing/certificate_password") + certificate_pass = p_value; +#endif + else if (n.begins_with("capabilities/")) { + + String what = n.get_slice("/", 1).replace("_", ""); + bool enable = p_value; + + if (array_has(uwp_capabilities, what.utf8().get_data())) { + + if (enable) + capabilities.insert(what); + else + capabilities.erase(what); + + } else if (array_has(uwp_uap_capabilities, what.utf8().get_data())) { + + if (enable) + uap_capabilities.insert(what); + else + uap_capabilities.erase(what); + + } else if (array_has(uwp_device_capabilites, what.utf8().get_data())) { + + if (enable) + device_capabilities.insert(what); + else + device_capabilities.erase(what); + } + } else return false; + + return true; +} + +bool EditorExportPlatformWinrt::_get(const StringName& p_name, Variant &r_ret) const { + + String n = p_name; + + if (n == "architecture/target") + r_ret = (int)arch; + else if (n == "custom_package/debug") + r_ret = custom_debug_package; + else if (n == "custom_package/release") + r_ret = custom_release_package; + else if (n == "command_line/extra_args") + r_ret = cmdline; + else if (n == "package/display_name") + r_ret = display_name; + else if (n == "package/short_name") + r_ret = short_name; + else if (n == "package/unique_name") + r_ret = unique_name; + else if (n == "package/description") + r_ret = description; + else if (n == "package/publisher") + r_ret = publisher; + else if (n == "package/publisher_display_name") + r_ret = publisher_display_name; + else if (n == "identity/product_guid") + r_ret = product_guid; + else if (n == "identity/publisher_guid") + r_ret = publisher_guid; + else if (n == "version/major") + r_ret = version_major; + else if (n == "version/minor") + r_ret = version_minor; + else if (n == "version/build") + r_ret = version_build; + else if (n == "version/revision") + r_ret = version_revision; + else if (n == "orientation/landscape") + r_ret = orientation_landscape; + else if (n == "orientation/portrait") + r_ret = orientation_portrait; + else if (n == "orientation/landscape_flipped") + r_ret = orientation_landscape_flipped; + else if (n == "orientation/portrait_flipped") + r_ret = orientation_portrait_flipped; + else if (n == "images/background_color") + r_ret = background_color; + else if (n == "images/store_logo") + r_ret = store_logo; + else if (n == "images/square44x44_logo") + r_ret = square44; + else if (n == "images/square71x71_logo") + r_ret = square71; + else if (n == "images/square150x150_logo") + r_ret = square150; + else if (n == "images/square310x310_logo") + r_ret = square310; + else if (n == "images/wide310x150_logo") + r_ret = wide310; + else if (n == "images/splash_screen") + r_ret = splash; + else if (n == "tiles/show_name_on_square150x150") + r_ret = name_on_square150; + else if (n == "tiles/show_name_on_wide310x150") + r_ret = name_on_wide; + else if (n == "tiles/show_name_on_square310x310") + r_ret = name_on_square310; + +#if 0 // Signing disabled + else if (n == "signing/sign") + r_ret = sign_package; + else if (n == "signing/certificate_file") + r_ret = certificate_path; + else if (n == "signing/certificate_password") + r_ret = certificate_pass; +#endif + else if (n.begins_with("capabilities/")) { + + String what = n.get_slice("/", 1).replace("_", ""); + + if (array_has(uwp_capabilities, what.utf8().get_data())) { + + r_ret = capabilities.has(what); + + } else if (array_has(uwp_uap_capabilities, what.utf8().get_data())) { + + r_ret = uap_capabilities.has(what); + + } else if (array_has(uwp_device_capabilites, what.utf8().get_data())) { + + r_ret = device_capabilities.has(what); + } + } else return false; + + return true; +} + +void EditorExportPlatformWinrt::_get_property_list(List<PropertyInfo>* p_list) const { + + p_list->push_back(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "appx")); + p_list->push_back(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "appx")); + + p_list->push_back(PropertyInfo(Variant::INT, "architecture/target", PROPERTY_HINT_ENUM, "ARM,x86,x64")); + + p_list->push_back(PropertyInfo(Variant::STRING, "command_line/extra_args")); + + p_list->push_back(PropertyInfo(Variant::STRING, "package/display_name")); + p_list->push_back(PropertyInfo(Variant::STRING, "package/short_name")); + p_list->push_back(PropertyInfo(Variant::STRING, "package/unique_name")); + p_list->push_back(PropertyInfo(Variant::STRING, "package/description")); + p_list->push_back(PropertyInfo(Variant::STRING, "package/publisher")); + p_list->push_back(PropertyInfo(Variant::STRING, "package/publisher_display_name")); + + p_list->push_back(PropertyInfo(Variant::STRING, "identity/product_guid")); + p_list->push_back(PropertyInfo(Variant::STRING, "identity/publisher_guid")); + + p_list->push_back(PropertyInfo(Variant::INT, "version/major")); + p_list->push_back(PropertyInfo(Variant::INT, "version/minor")); + p_list->push_back(PropertyInfo(Variant::INT, "version/build")); + p_list->push_back(PropertyInfo(Variant::INT, "version/revision")); + + p_list->push_back(PropertyInfo(Variant::BOOL, "orientation/landscape")); + p_list->push_back(PropertyInfo(Variant::BOOL, "orientation/portrait")); + p_list->push_back(PropertyInfo(Variant::BOOL, "orientation/landscape_flipped")); + p_list->push_back(PropertyInfo(Variant::BOOL, "orientation/portrait_flipped")); + + p_list->push_back(PropertyInfo(Variant::STRING, "images/background_color")); + p_list->push_back(PropertyInfo(Variant::OBJECT, "images/store_logo", PROPERTY_HINT_RESOURCE_TYPE, "ImageTexture")); + p_list->push_back(PropertyInfo(Variant::OBJECT, "images/square44x44_logo", PROPERTY_HINT_RESOURCE_TYPE, "ImageTexture")); + p_list->push_back(PropertyInfo(Variant::OBJECT, "images/square71x71_logo", PROPERTY_HINT_RESOURCE_TYPE, "ImageTexture")); + p_list->push_back(PropertyInfo(Variant::OBJECT, "images/square150x150_logo", PROPERTY_HINT_RESOURCE_TYPE, "ImageTexture")); + p_list->push_back(PropertyInfo(Variant::OBJECT, "images/square310x310_logo", PROPERTY_HINT_RESOURCE_TYPE, "ImageTexture")); + p_list->push_back(PropertyInfo(Variant::OBJECT, "images/wide310x150_logo", PROPERTY_HINT_RESOURCE_TYPE, "ImageTexture")); + p_list->push_back(PropertyInfo(Variant::OBJECT, "images/splash_screen", PROPERTY_HINT_RESOURCE_TYPE, "ImageTexture")); + + p_list->push_back(PropertyInfo(Variant::BOOL, "tiles/show_name_on_square150x150")); + p_list->push_back(PropertyInfo(Variant::BOOL, "tiles/show_name_on_wide310x150")); + p_list->push_back(PropertyInfo(Variant::BOOL, "tiles/show_name_on_square310x310")); + +#if 0 // Signing does not work :( disabling for now + p_list->push_back(PropertyInfo(Variant::BOOL, "signing/sign")); + p_list->push_back(PropertyInfo(Variant::STRING, "signing/certificate_file", PROPERTY_HINT_GLOBAL_FILE, "pfx")); + p_list->push_back(PropertyInfo(Variant::STRING, "signing/certificate_password")); +#endif + + // Capabilites + const char **basic = uwp_capabilities; + while (*basic) { + p_list->push_back(PropertyInfo(Variant::BOOL, "capabilities/" + String(*basic).camelcase_to_underscore(false))); + basic++; + } + + const char **uap = uwp_uap_capabilities; + while (*uap) { + p_list->push_back(PropertyInfo(Variant::BOOL, "capabilities/" + String(*uap).camelcase_to_underscore(false))); + uap++; + } + + const char **device = uwp_device_capabilites; + while (*device) { + p_list->push_back(PropertyInfo(Variant::BOOL, "capabilities/" + String(*device).camelcase_to_underscore(false))); + device++; + } + +} + +bool EditorExportPlatformWinrt::can_export(String * r_error) const { + + String err; + bool valid = true; + + if (!exists_export_template("winrt_x86_debug.zip") || !exists_export_template("winrt_x86_release.zip") + || !exists_export_template("winrt_arm_debug.zip") || !exists_export_template("winrt_arm_release.zip") + || !exists_export_template("winrt_x64_debug.zip") || !exists_export_template("winrt_x64_release.zip")) { + valid = false; + err += TTR("No export templates found.\nDownload and install export templates.") + "\n"; + } + + if (custom_debug_package != "" && !FileAccess::exists(custom_debug_package)) { + valid = false; + err += TTR("Custom debug package not found.") + "\n"; + } + + if (custom_release_package != "" && !FileAccess::exists(custom_release_package)) { + valid = false; + err += TTR("Custom release package not found.") + "\n"; + } + + if (!_valid_resource_name(unique_name)) { + valid = false; + err += TTR("Invalid unique name.") + "\n"; + } + + if (!_valid_guid(product_guid)) { + valid = false; + err += TTR("Invalid product GUID.") + "\n"; + } + + if (!_valid_guid(publisher_guid)) { + valid = false; + err += TTR("Invalid publisher GUID.") + "\n"; + } + + if (!_valid_bgcolor(background_color)) { + valid = false; + err += TTR("Invalid background color.") + "\n"; + } + + if (store_logo.is_valid() && !_valid_image(store_logo, 50, 50)) { + valid = false; + err += TTR("Invalid Store Logo image dimensions (should be 50x50).") + "\n"; + } + + if (square44.is_valid() && !_valid_image(square44, 44, 44)) { + valid = false; + err += TTR("Invalid square 44x44 logo image dimensions (should be 44x44).") + "\n"; + } + + if (square71.is_valid() && !_valid_image(square71, 71, 71)) { + valid = false; + err += TTR("Invalid square 71x71 logo image dimensions (should be 71x71).") + "\n"; + } + + if (square150.is_valid() && !_valid_image(square150, 150, 150)) { + valid = false; + err += TTR("Invalid square 150x150 logo image dimensions (should be 150x150).") + "\n"; + } + + if (square310.is_valid() && !_valid_image(square310, 310, 310)) { + valid = false; + err += TTR("Invalid square 310x310 logo image dimensions (should be 310x310).") + "\n"; + } + + if (wide310.is_valid() && !_valid_image(wide310, 310, 150)) { + valid = false; + err += TTR("Invalid wide 310x150 logo image dimensions (should be 310x150).") + "\n"; + } + + if (splash.is_valid() && !_valid_image(splash, 620, 300)) { + valid = false; + err += TTR("Invalid splash screen image dimensions (should be 620x300).") + "\n"; + } + + if (r_error) + *r_error = err; + + return valid; +} + +Error EditorExportPlatformWinrt::export_project(const String & p_path, bool p_debug, int p_flags) { + + String src_appx; + + EditorProgress ep("export", "Exporting for Windows Universal", 7); + + if (is_debug) + src_appx = custom_debug_package; + else + src_appx = custom_release_package; + + if (src_appx == "") { + String err; + if (p_debug) { + switch (arch) { + case X86: { + src_appx = find_export_template("winrt_x86_debug.zip", &err); + break; + } + case X64: { + src_appx = find_export_template("winrt_x64_debug.zip", &err); + break; + } + case ARM: { + src_appx = find_export_template("winrt_arm_debug.zip", &err); + break; + } + } + } else { + switch (arch) { + case X86: { + src_appx = find_export_template("winrt_x86_release.zip", &err); + break; + } + case X64: { + src_appx = find_export_template("winrt_x64_release.zip", &err); + break; + } + case ARM: { + src_appx = find_export_template("winrt_arm_release.zip", &err); + break; + } + } + } + if (src_appx == "") { + EditorNode::add_io_error(err); + return ERR_FILE_NOT_FOUND; + } + } + + Error err = OK; + + FileAccess *fa_pack = FileAccess::open(p_path, FileAccess::WRITE, &err); + ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE); + + AppxPackager packager; + packager.init(fa_pack, sign_package ? AppxPackager::SIGN : AppxPackager::DONT_SIGN, certificate_path, certificate_pass); + + FileAccess *src_f = NULL; + zlib_filefunc_def io = zipio_create_io_from_file(&src_f); + + ep.step("Creating package...", 0); + + unzFile pkg = unzOpen2(src_appx.utf8().get_data(), &io); + + if (!pkg) { + + EditorNode::add_io_error("Could not find template appx to export:\n" + src_appx); + return ERR_FILE_NOT_FOUND; + } + + int ret = unzGoToFirstFile(pkg); + + ep.step("Copying template files...", 1); + + EditorNode::progress_add_task("template_files", "Template files", 100); + packager.set_progress_task("template_files"); + + int template_files_amount = 9; + int template_file_no = 1; + + while (ret == UNZ_OK) { + + // get file name + unz_file_info info; + char fname[16834]; + ret = unzGetCurrentFileInfo(pkg, &info, fname, 16834, NULL, 0, NULL, 0); + + String path = fname; + + if (path.ends_with("/")) { + // Ignore directories + ret = unzGoToNextFile(pkg); + continue; + } + + Vector<uint8_t> data; + bool do_read = true; + + if (path.begins_with("Assets/")) { + + path = path.replace(".scale-100", ""); + + data = _get_image_data(path); + if (data.size() > 0) do_read = false; + } + + //read + if (do_read) { + data.resize(info.uncompressed_size); + unzOpenCurrentFile(pkg); + unzReadCurrentFile(pkg, data.ptr(), data.size()); + unzCloseCurrentFile(pkg); + } + + if (path == "AppxManifest.xml") { + + data = _fix_manifest(data, p_flags&(EXPORT_DUMB_CLIENT | EXPORT_REMOTE_DEBUG)); + } + + print_line("ADDING: " + path); + + packager.add_file(path, data.ptr(), data.size(), template_file_no++, template_files_amount, _should_compress_asset(path, data)); + + ret = unzGoToNextFile(pkg); + } + + EditorNode::progress_end_task("template_files"); + + ep.step("Creating command line...", 2); + + Vector<String> cl = cmdline.strip_edges().split(" "); + for (int i = 0;i<cl.size();i++) { + if (cl[i].strip_edges().length() == 0) { + cl.remove(i); + i--; + } + } + + if (!(p_flags & EXPORT_DUMB_CLIENT)) { + cl.push_back("-path"); + cl.push_back("game"); + } + + gen_export_flags(cl, p_flags); + + // Command line file + Vector<uint8_t> clf; + + // Argc + clf.resize(4); + encode_uint32(cl.size(), clf.ptr()); + + for (int i = 0; i < cl.size(); i++) { + + CharString txt = cl[i].utf8(); + int base = clf.size(); + clf.resize(base + 4 + txt.length()); + encode_uint32(txt.length(), &clf[base]); + copymem(&clf[base + 4], txt.ptr(), txt.length()); + print_line(itos(i) + " param: " + cl[i]); + } + + packager.add_file("__cl__.cl", clf.ptr(), clf.size(), -1, -1, false); + + ep.step("Adding project files...", 3); + + EditorNode::progress_add_task("project_files", "Project Files", 100); + packager.set_progress_task("project_files"); + + err = export_project_files(save_appx_file, &packager, false); + + EditorNode::progress_end_task("project_files"); + + ep.step("Closing package...", 7); + + unzClose(pkg); + + packager.finish(); + + return OK; +} + +EditorExportPlatformWinrt::EditorExportPlatformWinrt() { + + Image img(_winrt_logo); + logo = Ref<ImageTexture>(memnew(ImageTexture)); + logo->create_from_image(img); + + is_debug = true; + + custom_release_package = ""; + custom_debug_package = ""; + + arch = X86; + + display_name = ""; + short_name = "Godot"; + unique_name = "Godot.Engine"; + description = "Godot Engine"; + publisher = "CN=GodotEngine"; + publisher_display_name = "Godot Engine"; + + product_guid = "00000000-0000-0000-0000-000000000000"; + publisher_guid = "00000000-0000-0000-0000-000000000000"; + + version_major = 1; + version_minor = 0; + version_build = 0; + version_revision = 0; + + orientation_landscape = true; + orientation_portrait = true; + orientation_landscape_flipped = true; + orientation_portrait_flipped = true; + + background_color = "transparent"; + + name_on_square150 = false; + name_on_square310 = false; + name_on_wide = false; + + sign_package = false; + certificate_path = ""; + certificate_pass = ""; +} + +EditorExportPlatformWinrt::~EditorExportPlatformWinrt() {} + + +void register_winrt_exporter() { + + Ref<EditorExportPlatformWinrt> exporter = Ref<EditorExportPlatformWinrt>(memnew(EditorExportPlatformWinrt)); + EditorImportExport::get_singleton()->add_export_platform(exporter); +} diff --git a/tools/ios_xcode_template/godot_iosTests/godot_iosTests.m b/platform/winrt/export/export.h index d9fac0a250..278d6d23cd 100644 --- a/tools/ios_xcode_template/godot_iosTests/godot_iosTests.m +++ b/platform/winrt/export/export.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* godot_iosTests.m */ +/* export.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -26,30 +26,4 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ - -#import <XCTest/XCTest.h> - -@interface godot_iosTests : XCTestCase - -@end - -@implementation godot_iosTests - -- (void)setUp -{ - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown -{ - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -- (void)testExample -{ - XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); -} - -@end +void register_winrt_exporter(); diff --git a/platform/winrt/gl_context_egl.cpp b/platform/winrt/gl_context_egl.cpp index 12ccd404a9..f7b514b3c0 100644 --- a/platform/winrt/gl_context_egl.cpp +++ b/platform/winrt/gl_context_egl.cpp @@ -103,9 +103,22 @@ Error ContextEGL::initialize() { const EGLint displayAttributes[] = { - EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, + /*EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, 9, EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, 3, + EGL_NONE,*/ + // These are the default display attributes, used to request ANGLE's D3D11 renderer. + // eglInitialize will only succeed with these attributes if the hardware supports D3D11 Feature Level 10_0+. + EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, + + // EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER is an optimization that can have large performance benefits on mobile devices. + // Its syntax is subject to change, though. Please update your Visual Studio templates if you experience compilation issues with it. + //EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE, + + // EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE is an option that enables ANGLE to automatically call + // the IDXGIDevice3::Trim method on behalf of the application when it gets suspended. + // Calling IDXGIDevice3::Trim when an application is suspended is a Windows Store application certification requirement. + EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE, EGL_NONE, }; diff --git a/platform/winrt/gl_context_egl.h b/platform/winrt/gl_context_egl.h index 68dcdd5035..8124c2903d 100644 --- a/platform/winrt/gl_context_egl.h +++ b/platform/winrt/gl_context_egl.h @@ -49,6 +49,8 @@ class ContextEGL : public ContextGL { EGLint width; EGLint height; + bool vsync; + public: virtual void release_current(); @@ -59,6 +61,9 @@ public: virtual int get_window_height(); virtual void swap_buffers(); + void set_use_vsync(bool use) { vsync = use; } + bool is_using_vsync() const { return vsync; } + virtual Error initialize(); void reset(); diff --git a/platform/winrt/include/EGL/egl.h b/platform/winrt/include/EGL/egl.h deleted file mode 100644 index 12590a0e20..0000000000 --- a/platform/winrt/include/EGL/egl.h +++ /dev/null @@ -1,298 +0,0 @@ -#ifndef __egl_h_ -#define __egl_h_ 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Copyright (c) 2013-2014 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ -/* -** This header is generated from the Khronos OpenGL / OpenGL ES XML -** API Registry. The current version of the Registry, generator scripts -** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision: 27018 $ on $Date: 2014-06-10 08:06:12 -0700 (Tue, 10 Jun 2014) $ -*/ - -#include <EGL/eglplatform.h> - -/* Generated on date 20140610 */ - -/* Generated C header for: - * API: egl - * Versions considered: .* - * Versions emitted: .* - * Default extensions included: None - * Additional extensions included: _nomatch_^ - * Extensions removed: _nomatch_^ - */ - -#ifndef EGL_VERSION_1_0 -#define EGL_VERSION_1_0 1 -typedef unsigned int EGLBoolean; -typedef void *EGLDisplay; -#include <KHR/khrplatform.h> -#include <EGL/eglplatform.h> -typedef void *EGLConfig; -typedef void *EGLSurface; -typedef void *EGLContext; -typedef void (*__eglMustCastToProperFunctionPointerType)(void); -#define EGL_ALPHA_SIZE 0x3021 -#define EGL_BAD_ACCESS 0x3002 -#define EGL_BAD_ALLOC 0x3003 -#define EGL_BAD_ATTRIBUTE 0x3004 -#define EGL_BAD_CONFIG 0x3005 -#define EGL_BAD_CONTEXT 0x3006 -#define EGL_BAD_CURRENT_SURFACE 0x3007 -#define EGL_BAD_DISPLAY 0x3008 -#define EGL_BAD_MATCH 0x3009 -#define EGL_BAD_NATIVE_PIXMAP 0x300A -#define EGL_BAD_NATIVE_WINDOW 0x300B -#define EGL_BAD_PARAMETER 0x300C -#define EGL_BAD_SURFACE 0x300D -#define EGL_BLUE_SIZE 0x3022 -#define EGL_BUFFER_SIZE 0x3020 -#define EGL_CONFIG_CAVEAT 0x3027 -#define EGL_CONFIG_ID 0x3028 -#define EGL_CORE_NATIVE_ENGINE 0x305B -#define EGL_DEPTH_SIZE 0x3025 -#define EGL_DONT_CARE ((EGLint)-1) -#define EGL_DRAW 0x3059 -#define EGL_EXTENSIONS 0x3055 -#define EGL_FALSE 0 -#define EGL_GREEN_SIZE 0x3023 -#define EGL_HEIGHT 0x3056 -#define EGL_LARGEST_PBUFFER 0x3058 -#define EGL_LEVEL 0x3029 -#define EGL_MAX_PBUFFER_HEIGHT 0x302A -#define EGL_MAX_PBUFFER_PIXELS 0x302B -#define EGL_MAX_PBUFFER_WIDTH 0x302C -#define EGL_NATIVE_RENDERABLE 0x302D -#define EGL_NATIVE_VISUAL_ID 0x302E -#define EGL_NATIVE_VISUAL_TYPE 0x302F -#define EGL_NONE 0x3038 -#define EGL_NON_CONFORMANT_CONFIG 0x3051 -#define EGL_NOT_INITIALIZED 0x3001 -#define EGL_NO_CONTEXT ((EGLContext)0) -#define EGL_NO_DISPLAY ((EGLDisplay)0) -#define EGL_NO_SURFACE ((EGLSurface)0) -#define EGL_PBUFFER_BIT 0x0001 -#define EGL_PIXMAP_BIT 0x0002 -#define EGL_READ 0x305A -#define EGL_RED_SIZE 0x3024 -#define EGL_SAMPLES 0x3031 -#define EGL_SAMPLE_BUFFERS 0x3032 -#define EGL_SLOW_CONFIG 0x3050 -#define EGL_STENCIL_SIZE 0x3026 -#define EGL_SUCCESS 0x3000 -#define EGL_SURFACE_TYPE 0x3033 -#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 -#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 -#define EGL_TRANSPARENT_RED_VALUE 0x3037 -#define EGL_TRANSPARENT_RGB 0x3052 -#define EGL_TRANSPARENT_TYPE 0x3034 -#define EGL_TRUE 1 -#define EGL_VENDOR 0x3053 -#define EGL_VERSION 0x3054 -#define EGL_WIDTH 0x3057 -#define EGL_WINDOW_BIT 0x0004 -EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); -EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); -EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); -EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); -EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); -EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface); -EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); -EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); -EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void); -EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw); -EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id); -EGLAPI EGLint EGLAPIENTRY eglGetError (void); -EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname); -EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); -EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); -EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name); -EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); -EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface); -EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy); -EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void); -EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine); -#endif /* EGL_VERSION_1_0 */ - -#ifndef EGL_VERSION_1_1 -#define EGL_VERSION_1_1 1 -#define EGL_BACK_BUFFER 0x3084 -#define EGL_BIND_TO_TEXTURE_RGB 0x3039 -#define EGL_BIND_TO_TEXTURE_RGBA 0x303A -#define EGL_CONTEXT_LOST 0x300E -#define EGL_MIN_SWAP_INTERVAL 0x303B -#define EGL_MAX_SWAP_INTERVAL 0x303C -#define EGL_MIPMAP_TEXTURE 0x3082 -#define EGL_MIPMAP_LEVEL 0x3083 -#define EGL_NO_TEXTURE 0x305C -#define EGL_TEXTURE_2D 0x305F -#define EGL_TEXTURE_FORMAT 0x3080 -#define EGL_TEXTURE_RGB 0x305D -#define EGL_TEXTURE_RGBA 0x305E -#define EGL_TEXTURE_TARGET 0x3081 -EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); -EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); -EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); -EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval); -#endif /* EGL_VERSION_1_1 */ - -#ifndef EGL_VERSION_1_2 -#define EGL_VERSION_1_2 1 -typedef unsigned int EGLenum; -typedef void *EGLClientBuffer; -#define EGL_ALPHA_FORMAT 0x3088 -#define EGL_ALPHA_FORMAT_NONPRE 0x308B -#define EGL_ALPHA_FORMAT_PRE 0x308C -#define EGL_ALPHA_MASK_SIZE 0x303E -#define EGL_BUFFER_PRESERVED 0x3094 -#define EGL_BUFFER_DESTROYED 0x3095 -#define EGL_CLIENT_APIS 0x308D -#define EGL_COLORSPACE 0x3087 -#define EGL_COLORSPACE_sRGB 0x3089 -#define EGL_COLORSPACE_LINEAR 0x308A -#define EGL_COLOR_BUFFER_TYPE 0x303F -#define EGL_CONTEXT_CLIENT_TYPE 0x3097 -#define EGL_DISPLAY_SCALING 10000 -#define EGL_HORIZONTAL_RESOLUTION 0x3090 -#define EGL_LUMINANCE_BUFFER 0x308F -#define EGL_LUMINANCE_SIZE 0x303D -#define EGL_OPENGL_ES_BIT 0x0001 -#define EGL_OPENVG_BIT 0x0002 -#define EGL_OPENGL_ES_API 0x30A0 -#define EGL_OPENVG_API 0x30A1 -#define EGL_OPENVG_IMAGE 0x3096 -#define EGL_PIXEL_ASPECT_RATIO 0x3092 -#define EGL_RENDERABLE_TYPE 0x3040 -#define EGL_RENDER_BUFFER 0x3086 -#define EGL_RGB_BUFFER 0x308E -#define EGL_SINGLE_BUFFER 0x3085 -#define EGL_SWAP_BEHAVIOR 0x3093 -#define EGL_UNKNOWN ((EGLint)-1) -#define EGL_VERTICAL_RESOLUTION 0x3091 -EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api); -EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void); -EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void); -EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void); -#endif /* EGL_VERSION_1_2 */ - -#ifndef EGL_VERSION_1_3 -#define EGL_VERSION_1_3 1 -#define EGL_CONFORMANT 0x3042 -#define EGL_CONTEXT_CLIENT_VERSION 0x3098 -#define EGL_MATCH_NATIVE_PIXMAP 0x3041 -#define EGL_OPENGL_ES2_BIT 0x0004 -#define EGL_VG_ALPHA_FORMAT 0x3088 -#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B -#define EGL_VG_ALPHA_FORMAT_PRE 0x308C -#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 -#define EGL_VG_COLORSPACE 0x3087 -#define EGL_VG_COLORSPACE_sRGB 0x3089 -#define EGL_VG_COLORSPACE_LINEAR 0x308A -#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 -#endif /* EGL_VERSION_1_3 */ - -#ifndef EGL_VERSION_1_4 -#define EGL_VERSION_1_4 1 -#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) -#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 -#define EGL_MULTISAMPLE_RESOLVE 0x3099 -#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A -#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B -#define EGL_OPENGL_API 0x30A2 -#define EGL_OPENGL_BIT 0x0008 -#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 -EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void); -#endif /* EGL_VERSION_1_4 */ - -#ifndef EGL_VERSION_1_5 -#define EGL_VERSION_1_5 1 -typedef void *EGLSync; -typedef intptr_t EGLAttrib; -typedef khronos_utime_nanoseconds_t EGLTime; -#define EGL_CONTEXT_MAJOR_VERSION 0x3098 -#define EGL_CONTEXT_MINOR_VERSION 0x30FB -#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD -#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD -#define EGL_NO_RESET_NOTIFICATION 0x31BE -#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF -#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001 -#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002 -#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0 -#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1 -#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2 -#define EGL_OPENGL_ES3_BIT 0x00000040 -#define EGL_CL_EVENT_HANDLE 0x309C -#define EGL_SYNC_CL_EVENT 0x30FE -#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF -#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0 -#define EGL_SYNC_TYPE 0x30F7 -#define EGL_SYNC_STATUS 0x30F1 -#define EGL_SYNC_CONDITION 0x30F8 -#define EGL_SIGNALED 0x30F2 -#define EGL_UNSIGNALED 0x30F3 -#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001 -#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull -#define EGL_TIMEOUT_EXPIRED 0x30F5 -#define EGL_CONDITION_SATISFIED 0x30F6 -#define EGL_NO_SYNC ((EGLSync)0) -#define EGL_SYNC_FENCE 0x30F9 -#define EGL_GL_COLORSPACE 0x309D -#define EGL_GL_COLORSPACE_SRGB 0x3089 -#define EGL_GL_COLORSPACE_LINEAR 0x308A -#define EGL_GL_RENDERBUFFER 0x30B9 -#define EGL_GL_TEXTURE_2D 0x30B1 -#define EGL_GL_TEXTURE_LEVEL 0x30BC -#define EGL_GL_TEXTURE_3D 0x30B2 -#define EGL_GL_TEXTURE_ZOFFSET 0x30BD -#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3 -#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4 -#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5 -#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6 -#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7 -#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8 -EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync); -EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); -EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); -EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); -EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); -EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags); -#endif /* EGL_VERSION_1_5 */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/winrt/include/EGL/eglext.h b/platform/winrt/include/EGL/eglext.h deleted file mode 100644 index 05b2555f31..0000000000 --- a/platform/winrt/include/EGL/eglext.h +++ /dev/null @@ -1,766 +0,0 @@ -#ifndef __eglext_h_ -#define __eglext_h_ 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Copyright (c) 2013-2014 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ -/* -** This header is generated from the Khronos OpenGL / OpenGL ES XML -** API Registry. The current version of the Registry, generator scripts -** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision: 27018 $ on $Date: 2014-06-10 08:06:12 -0700 (Tue, 10 Jun 2014) $ -*/ - -#include <EGL/eglplatform.h> - -#define EGL_EGLEXT_VERSION 20140610 - -/* Generated C header for: - * API: egl - * Versions considered: .* - * Versions emitted: _nomatch_^ - * Default extensions included: egl - * Additional extensions included: _nomatch_^ - * Extensions removed: _nomatch_^ - */ - -#ifndef EGL_KHR_cl_event -#define EGL_KHR_cl_event 1 -#define EGL_CL_EVENT_HANDLE_KHR 0x309C -#define EGL_SYNC_CL_EVENT_KHR 0x30FE -#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF -#endif /* EGL_KHR_cl_event */ - -#ifndef EGL_KHR_cl_event2 -#define EGL_KHR_cl_event2 1 -typedef void *EGLSyncKHR; -typedef intptr_t EGLAttribKHR; -typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); -#endif -#endif /* EGL_KHR_cl_event2 */ - -#ifndef EGL_KHR_client_get_all_proc_addresses -#define EGL_KHR_client_get_all_proc_addresses 1 -#endif /* EGL_KHR_client_get_all_proc_addresses */ - -#ifndef EGL_KHR_config_attribs -#define EGL_KHR_config_attribs 1 -#define EGL_CONFORMANT_KHR 0x3042 -#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 -#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 -#endif /* EGL_KHR_config_attribs */ - -#ifndef EGL_KHR_create_context -#define EGL_KHR_create_context 1 -#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 -#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB -#define EGL_CONTEXT_FLAGS_KHR 0x30FC -#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD -#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD -#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE -#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF -#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 -#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 -#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 -#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 -#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 -#define EGL_OPENGL_ES3_BIT_KHR 0x00000040 -#endif /* EGL_KHR_create_context */ - -#ifndef EGL_KHR_fence_sync -#define EGL_KHR_fence_sync 1 -#ifdef KHRONOS_SUPPORT_INT64 -#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0 -#define EGL_SYNC_CONDITION_KHR 0x30F8 -#define EGL_SYNC_FENCE_KHR 0x30F9 -#endif /* KHRONOS_SUPPORT_INT64 */ -#endif /* EGL_KHR_fence_sync */ - -#ifndef EGL_KHR_get_all_proc_addresses -#define EGL_KHR_get_all_proc_addresses 1 -#endif /* EGL_KHR_get_all_proc_addresses */ - -#ifndef EGL_KHR_gl_colorspace -#define EGL_KHR_gl_colorspace 1 -#define EGL_GL_COLORSPACE_KHR 0x309D -#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089 -#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A -#endif /* EGL_KHR_gl_colorspace */ - -#ifndef EGL_KHR_gl_renderbuffer_image -#define EGL_KHR_gl_renderbuffer_image 1 -#define EGL_GL_RENDERBUFFER_KHR 0x30B9 -#endif /* EGL_KHR_gl_renderbuffer_image */ - -#ifndef EGL_KHR_gl_texture_2D_image -#define EGL_KHR_gl_texture_2D_image 1 -#define EGL_GL_TEXTURE_2D_KHR 0x30B1 -#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC -#endif /* EGL_KHR_gl_texture_2D_image */ - -#ifndef EGL_KHR_gl_texture_3D_image -#define EGL_KHR_gl_texture_3D_image 1 -#define EGL_GL_TEXTURE_3D_KHR 0x30B2 -#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD -#endif /* EGL_KHR_gl_texture_3D_image */ - -#ifndef EGL_KHR_gl_texture_cubemap_image -#define EGL_KHR_gl_texture_cubemap_image 1 -#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 -#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 -#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 -#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 -#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 -#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 -#endif /* EGL_KHR_gl_texture_cubemap_image */ - -#ifndef EGL_KHR_image -#define EGL_KHR_image 1 -typedef void *EGLImageKHR; -#define EGL_NATIVE_PIXMAP_KHR 0x30B0 -#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) -typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); -#endif -#endif /* EGL_KHR_image */ - -#ifndef EGL_KHR_image_base -#define EGL_KHR_image_base 1 -#define EGL_IMAGE_PRESERVED_KHR 0x30D2 -#endif /* EGL_KHR_image_base */ - -#ifndef EGL_KHR_image_pixmap -#define EGL_KHR_image_pixmap 1 -#endif /* EGL_KHR_image_pixmap */ - -#ifndef EGL_KHR_lock_surface -#define EGL_KHR_lock_surface 1 -#define EGL_READ_SURFACE_BIT_KHR 0x0001 -#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 -#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 -#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 -#define EGL_MATCH_FORMAT_KHR 0x3043 -#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 -#define EGL_FORMAT_RGB_565_KHR 0x30C1 -#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 -#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 -#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 -#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 -#define EGL_BITMAP_POINTER_KHR 0x30C6 -#define EGL_BITMAP_PITCH_KHR 0x30C7 -#define EGL_BITMAP_ORIGIN_KHR 0x30C8 -#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 -#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA -#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB -#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC -#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD -#define EGL_LOWER_LEFT_KHR 0x30CE -#define EGL_UPPER_LEFT_KHR 0x30CF -typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface); -#endif -#endif /* EGL_KHR_lock_surface */ - -#ifndef EGL_KHR_lock_surface2 -#define EGL_KHR_lock_surface2 1 -#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110 -#endif /* EGL_KHR_lock_surface2 */ - -#ifndef EGL_KHR_lock_surface3 -#define EGL_KHR_lock_surface3 1 -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); -#endif -#endif /* EGL_KHR_lock_surface3 */ - -#ifndef EGL_KHR_platform_android -#define EGL_KHR_platform_android 1 -#define EGL_PLATFORM_ANDROID_KHR 0x3141 -#endif /* EGL_KHR_platform_android */ - -#ifndef EGL_KHR_platform_gbm -#define EGL_KHR_platform_gbm 1 -#define EGL_PLATFORM_GBM_KHR 0x31D7 -#endif /* EGL_KHR_platform_gbm */ - -#ifndef EGL_KHR_platform_wayland -#define EGL_KHR_platform_wayland 1 -#define EGL_PLATFORM_WAYLAND_KHR 0x31D8 -#endif /* EGL_KHR_platform_wayland */ - -#ifndef EGL_KHR_platform_x11 -#define EGL_KHR_platform_x11 1 -#define EGL_PLATFORM_X11_KHR 0x31D5 -#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6 -#endif /* EGL_KHR_platform_x11 */ - -#ifndef EGL_KHR_reusable_sync -#define EGL_KHR_reusable_sync 1 -typedef khronos_utime_nanoseconds_t EGLTimeKHR; -#ifdef KHRONOS_SUPPORT_INT64 -#define EGL_SYNC_STATUS_KHR 0x30F1 -#define EGL_SIGNALED_KHR 0x30F2 -#define EGL_UNSIGNALED_KHR 0x30F3 -#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 -#define EGL_CONDITION_SATISFIED_KHR 0x30F6 -#define EGL_SYNC_TYPE_KHR 0x30F7 -#define EGL_SYNC_REUSABLE_KHR 0x30FA -#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 -#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull -#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0) -typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); -typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync); -EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); -EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); -EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); -#endif -#endif /* KHRONOS_SUPPORT_INT64 */ -#endif /* EGL_KHR_reusable_sync */ - -#ifndef EGL_KHR_stream -#define EGL_KHR_stream 1 -typedef void *EGLStreamKHR; -typedef khronos_uint64_t EGLuint64KHR; -#ifdef KHRONOS_SUPPORT_INT64 -#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0) -#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210 -#define EGL_PRODUCER_FRAME_KHR 0x3212 -#define EGL_CONSUMER_FRAME_KHR 0x3213 -#define EGL_STREAM_STATE_KHR 0x3214 -#define EGL_STREAM_STATE_CREATED_KHR 0x3215 -#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 -#define EGL_STREAM_STATE_EMPTY_KHR 0x3217 -#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218 -#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219 -#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A -#define EGL_BAD_STREAM_KHR 0x321B -#define EGL_BAD_STATE_KHR 0x321C -typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream); -EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); -#endif -#endif /* KHRONOS_SUPPORT_INT64 */ -#endif /* EGL_KHR_stream */ - -#ifndef EGL_KHR_stream_consumer_gltexture -#define EGL_KHR_stream_consumer_gltexture 1 -#ifdef EGL_KHR_stream -#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream); -EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream); -EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream); -#endif -#endif /* EGL_KHR_stream */ -#endif /* EGL_KHR_stream_consumer_gltexture */ - -#ifndef EGL_KHR_stream_cross_process_fd -#define EGL_KHR_stream_cross_process_fd 1 -typedef int EGLNativeFileDescriptorKHR; -#ifdef EGL_KHR_stream -#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1)) -typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); -typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream); -EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); -#endif -#endif /* EGL_KHR_stream */ -#endif /* EGL_KHR_stream_cross_process_fd */ - -#ifndef EGL_KHR_stream_fifo -#define EGL_KHR_stream_fifo 1 -#ifdef EGL_KHR_stream -#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC -#define EGL_STREAM_TIME_NOW_KHR 0x31FD -#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE -#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); -#endif -#endif /* EGL_KHR_stream */ -#endif /* EGL_KHR_stream_fifo */ - -#ifndef EGL_KHR_stream_producer_aldatalocator -#define EGL_KHR_stream_producer_aldatalocator 1 -#ifdef EGL_KHR_stream -#endif /* EGL_KHR_stream */ -#endif /* EGL_KHR_stream_producer_aldatalocator */ - -#ifndef EGL_KHR_stream_producer_eglsurface -#define EGL_KHR_stream_producer_eglsurface 1 -#ifdef EGL_KHR_stream -#define EGL_STREAM_BIT_KHR 0x0800 -typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); -#endif -#endif /* EGL_KHR_stream */ -#endif /* EGL_KHR_stream_producer_eglsurface */ - -#ifndef EGL_KHR_surfaceless_context -#define EGL_KHR_surfaceless_context 1 -#endif /* EGL_KHR_surfaceless_context */ - -#ifndef EGL_KHR_vg_parent_image -#define EGL_KHR_vg_parent_image 1 -#define EGL_VG_PARENT_IMAGE_KHR 0x30BA -#endif /* EGL_KHR_vg_parent_image */ - -#ifndef EGL_KHR_wait_sync -#define EGL_KHR_wait_sync 1 -typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); -#endif -#endif /* EGL_KHR_wait_sync */ - -#ifndef EGL_ANDROID_blob_cache -#define EGL_ANDROID_blob_cache 1 -typedef khronos_ssize_t EGLsizeiANDROID; -typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize); -typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize); -typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); -#endif -#endif /* EGL_ANDROID_blob_cache */ - -#ifndef EGL_ANDROID_framebuffer_target -#define EGL_ANDROID_framebuffer_target 1 -#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147 -#endif /* EGL_ANDROID_framebuffer_target */ - -#ifndef EGL_ANDROID_image_native_buffer -#define EGL_ANDROID_image_native_buffer 1 -#define EGL_NATIVE_BUFFER_ANDROID 0x3140 -#endif /* EGL_ANDROID_image_native_buffer */ - -#ifndef EGL_ANDROID_native_fence_sync -#define EGL_ANDROID_native_fence_sync 1 -#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144 -#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145 -#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146 -#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1 -typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync); -#endif -#endif /* EGL_ANDROID_native_fence_sync */ - -#ifndef EGL_ANDROID_recordable -#define EGL_ANDROID_recordable 1 -#define EGL_RECORDABLE_ANDROID 0x3142 -#endif /* EGL_ANDROID_recordable */ - -#ifndef EGL_ANGLE_d3d_share_handle_client_buffer -#define EGL_ANGLE_d3d_share_handle_client_buffer 1 -#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200 -#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */ - -#ifndef EGL_ANGLE_window_fixed_size -#define EGL_ANGLE_window_fixed_size 1 -#define EGL_FIXED_SIZE_ANGLE 0x3201 -#endif /* EGL_ANGLE_window_fixed_size */ - -#ifndef EGL_ANGLE_query_surface_pointer -#define EGL_ANGLE_query_surface_pointer 1 -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); -#endif -#endif /* EGL_ANGLE_query_surface_pointer */ - -#ifndef EGL_ANGLE_software_display -#define EGL_ANGLE_software_display 1 -#define EGL_SOFTWARE_DISPLAY_ANGLE ((EGLNativeDisplayType)-1) -#endif /* EGL_ANGLE_software_display */ - -#ifndef EGL_ANGLE_direct3d_display -#define EGL_ANGLE_direct3d_display 1 -#define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ((EGLNativeDisplayType)-2) -#define EGL_D3D11_ONLY_DISPLAY_ANGLE ((EGLNativeDisplayType)-3) -#endif /* EGL_ANGLE_direct3d_display */ - -#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle -#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1 -#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */ - -#ifndef EGL_ANGLE_surface_d3d_render_to_back_buffer -#define EGL_ANGLE_surface_d3d_render_to_back_buffer 1 -#define EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER 0x320B -#define EGL_ANGLE_SURFACE_RENDER_TO_BACK_BUFFER 0x320C -#endif /* EGL_ANGLE_surface_d3d_render_to_back_buffer */ - -#ifndef EGL_ANGLE_platform_angle -#define EGL_ANGLE_platform_angle 1 -#define EGL_PLATFORM_ANGLE_ANGLE 0x3201 -#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202 -#define EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE 0x3203 -#define EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3204 -#define EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3205 -#endif /* EGL_ANGLE_platform_angle */ - -#ifndef EGL_ANGLE_platform_angle_d3d -#define EGL_ANGLE_platform_angle_d3d 1 -#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3206 -#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3207 -#define EGL_PLATFORM_ANGLE_USE_WARP_ANGLE 0x3208 -#endif /* EGL_ANGLE_platform_angle_d3d */ - -#ifndef EGL_ANGLE_platform_angle_opengl -#define EGL_ANGLE_platform_angle_opengl 1 -#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x3209 -#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320A -#endif /* EGL_ANGLE_platform_angle_opengl */ - -#ifndef EGL_ARM_pixmap_multisample_discard -#define EGL_ARM_pixmap_multisample_discard 1 -#define EGL_DISCARD_SAMPLES_ARM 0x3286 -#endif /* EGL_ARM_pixmap_multisample_discard */ - -#ifndef EGL_EXT_buffer_age -#define EGL_EXT_buffer_age 1 -#define EGL_BUFFER_AGE_EXT 0x313D -#endif /* EGL_EXT_buffer_age */ - -#ifndef EGL_EXT_client_extensions -#define EGL_EXT_client_extensions 1 -#endif /* EGL_EXT_client_extensions */ - -#ifndef EGL_EXT_create_context_robustness -#define EGL_EXT_create_context_robustness 1 -#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF -#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138 -#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE -#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF -#endif /* EGL_EXT_create_context_robustness */ - -#ifndef EGL_EXT_device_base -#define EGL_EXT_device_base 1 -typedef void *EGLDeviceEXT; -#define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0)) -#define EGL_BAD_DEVICE_EXT 0x322B -#define EGL_DEVICE_EXT 0x322C -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); -typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); -EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); -#endif -#endif /* EGL_EXT_device_base */ - -#ifndef EGL_EXT_image_dma_buf_import -#define EGL_EXT_image_dma_buf_import 1 -#define EGL_LINUX_DMA_BUF_EXT 0x3270 -#define EGL_LINUX_DRM_FOURCC_EXT 0x3271 -#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272 -#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273 -#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274 -#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275 -#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276 -#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277 -#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278 -#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279 -#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A -#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B -#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C -#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D -#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E -#define EGL_ITU_REC601_EXT 0x327F -#define EGL_ITU_REC709_EXT 0x3280 -#define EGL_ITU_REC2020_EXT 0x3281 -#define EGL_YUV_FULL_RANGE_EXT 0x3282 -#define EGL_YUV_NARROW_RANGE_EXT 0x3283 -#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284 -#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285 -#endif /* EGL_EXT_image_dma_buf_import */ - -#ifndef EGL_EXT_multiview_window -#define EGL_EXT_multiview_window 1 -#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134 -#endif /* EGL_EXT_multiview_window */ - -#ifndef EGL_EXT_platform_base -#define EGL_EXT_platform_base 1 -typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list); -typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); -typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list); -EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); -EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); -#endif -#endif /* EGL_EXT_platform_base */ - -#ifndef EGL_EXT_platform_device -#define EGL_EXT_platform_device 1 -#define EGL_PLATFORM_DEVICE_EXT 0x313F -#endif /* EGL_EXT_platform_device */ - -#ifndef EGL_EXT_platform_wayland -#define EGL_EXT_platform_wayland 1 -#define EGL_PLATFORM_WAYLAND_EXT 0x31D8 -#endif /* EGL_EXT_platform_wayland */ - -#ifndef EGL_EXT_platform_x11 -#define EGL_EXT_platform_x11 1 -#define EGL_PLATFORM_X11_EXT 0x31D5 -#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6 -#endif /* EGL_EXT_platform_x11 */ - -#ifndef EGL_EXT_protected_surface -#define EGL_EXT_protected_surface 1 -#define EGL_PROTECTED_CONTENT_EXT 0x32C0 -#endif /* EGL_EXT_protected_surface */ - -#ifndef EGL_EXT_swap_buffers_with_damage -#define EGL_EXT_swap_buffers_with_damage 1 -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); -#endif -#endif /* EGL_EXT_swap_buffers_with_damage */ - -#ifndef EGL_HI_clientpixmap -#define EGL_HI_clientpixmap 1 -struct EGLClientPixmapHI { - void *pData; - EGLint iWidth; - EGLint iHeight; - EGLint iStride; -}; -#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74 -typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); -#endif -#endif /* EGL_HI_clientpixmap */ - -#ifndef EGL_HI_colorformats -#define EGL_HI_colorformats 1 -#define EGL_COLOR_FORMAT_HI 0x8F70 -#define EGL_COLOR_RGB_HI 0x8F71 -#define EGL_COLOR_RGBA_HI 0x8F72 -#define EGL_COLOR_ARGB_HI 0x8F73 -#endif /* EGL_HI_colorformats */ - -#ifndef EGL_IMG_context_priority -#define EGL_IMG_context_priority 1 -#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 -#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 -#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 -#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 -#endif /* EGL_IMG_context_priority */ - -#ifndef EGL_MESA_drm_image -#define EGL_MESA_drm_image 1 -#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 -#define EGL_DRM_BUFFER_USE_MESA 0x31D1 -#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 -#define EGL_DRM_BUFFER_MESA 0x31D3 -#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 -#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 -#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 -typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); -#endif -#endif /* EGL_MESA_drm_image */ - -#ifndef EGL_MESA_platform_gbm -#define EGL_MESA_platform_gbm 1 -#define EGL_PLATFORM_GBM_MESA 0x31D7 -#endif /* EGL_MESA_platform_gbm */ - -#ifndef EGL_NOK_swap_region -#define EGL_NOK_swap_region 1 -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); -#endif -#endif /* EGL_NOK_swap_region */ - -#ifndef EGL_NOK_swap_region2 -#define EGL_NOK_swap_region2 1 -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); -#endif -#endif /* EGL_NOK_swap_region2 */ - -#ifndef EGL_NOK_texture_from_pixmap -#define EGL_NOK_texture_from_pixmap 1 -#define EGL_Y_INVERTED_NOK 0x307F -#endif /* EGL_NOK_texture_from_pixmap */ - -#ifndef EGL_NV_3dvision_surface -#define EGL_NV_3dvision_surface 1 -#define EGL_AUTO_STEREO_NV 0x3136 -#endif /* EGL_NV_3dvision_surface */ - -#ifndef EGL_NV_coverage_sample -#define EGL_NV_coverage_sample 1 -#define EGL_COVERAGE_BUFFERS_NV 0x30E0 -#define EGL_COVERAGE_SAMPLES_NV 0x30E1 -#endif /* EGL_NV_coverage_sample */ - -#ifndef EGL_NV_coverage_sample_resolve -#define EGL_NV_coverage_sample_resolve 1 -#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131 -#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132 -#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133 -#endif /* EGL_NV_coverage_sample_resolve */ - -#ifndef EGL_NV_depth_nonlinear -#define EGL_NV_depth_nonlinear 1 -#define EGL_DEPTH_ENCODING_NV 0x30E2 -#define EGL_DEPTH_ENCODING_NONE_NV 0 -#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 -#endif /* EGL_NV_depth_nonlinear */ - -#ifndef EGL_NV_native_query -#define EGL_NV_native_query 1 -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); -#endif -#endif /* EGL_NV_native_query */ - -#ifndef EGL_NV_post_convert_rounding -#define EGL_NV_post_convert_rounding 1 -#endif /* EGL_NV_post_convert_rounding */ - -#ifndef EGL_NV_post_sub_buffer -#define EGL_NV_post_sub_buffer 1 -#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE -typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); -#endif -#endif /* EGL_NV_post_sub_buffer */ - -#ifndef EGL_NV_stream_sync -#define EGL_NV_stream_sync 1 -#define EGL_SYNC_NEW_FRAME_NV 0x321F -typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); -#endif -#endif /* EGL_NV_stream_sync */ - -#ifndef EGL_NV_sync -#define EGL_NV_sync 1 -typedef void *EGLSyncNV; -typedef khronos_utime_nanoseconds_t EGLTimeNV; -#ifdef KHRONOS_SUPPORT_INT64 -#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 -#define EGL_SYNC_STATUS_NV 0x30E7 -#define EGL_SIGNALED_NV 0x30E8 -#define EGL_UNSIGNALED_NV 0x30E9 -#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001 -#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull -#define EGL_ALREADY_SIGNALED_NV 0x30EA -#define EGL_TIMEOUT_EXPIRED_NV 0x30EB -#define EGL_CONDITION_SATISFIED_NV 0x30EC -#define EGL_SYNC_TYPE_NV 0x30ED -#define EGL_SYNC_CONDITION_NV 0x30EE -#define EGL_SYNC_FENCE_NV 0x30EF -#define EGL_NO_SYNC_NV ((EGLSyncNV)0) -typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync); -typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync); -EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync); -EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); -EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); -EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); -#endif -#endif /* KHRONOS_SUPPORT_INT64 */ -#endif /* EGL_NV_sync */ - -#ifndef EGL_NV_system_time -#define EGL_NV_system_time 1 -typedef khronos_utime_nanoseconds_t EGLuint64NV; -#ifdef KHRONOS_SUPPORT_INT64 -typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void); -typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void); -EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void); -#endif -#endif /* KHRONOS_SUPPORT_INT64 */ -#endif /* EGL_NV_system_time */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/winrt/include/EGL/eglplatform.h b/platform/winrt/include/EGL/eglplatform.h deleted file mode 100644 index 71dadc79d5..0000000000 --- a/platform/winrt/include/EGL/eglplatform.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef __eglplatform_h_ -#define __eglplatform_h_ - -/* -** Copyright (c) 2007-2013 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -/* Platform-specific types and definitions for egl.h - * $Revision: 23432 $ on $Date: 2013-10-09 00:57:24 -0700 (Wed, 09 Oct 2013) $ - * - * Adopters may modify khrplatform.h and this file to suit their platform. - * You are encouraged to submit all modifications to the Khronos group so that - * they can be included in future versions of this file. Please submit changes - * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) - * by filing a bug against product "EGL" component "Registry". - */ - -#include <KHR/khrplatform.h> - -/* Macros used in EGL function prototype declarations. - * - * EGL functions should be prototyped as: - * - * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); - * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); - * - * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h - */ - -#ifndef EGLAPI -#define EGLAPI KHRONOS_APICALL -#endif - -#ifndef EGLAPIENTRY -#define EGLAPIENTRY KHRONOS_APIENTRY -#endif -#define EGLAPIENTRYP EGLAPIENTRY* - -/* The types NativeDisplayType, NativeWindowType, and NativePixmapType - * are aliases of window-system-dependent types, such as X Display * or - * Windows Device Context. They must be defined in platform-specific - * code below. The EGL-prefixed versions of Native*Type are the same - * types, renamed in EGL 1.3 so all types in the API start with "EGL". - * - * Khronos STRONGLY RECOMMENDS that you use the default definitions - * provided below, since these changes affect both binary and source - * portability of applications using EGL running on different EGL - * implementations. - */ - -#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif -#include <windows.h> - -typedef HDC EGLNativeDisplayType; -typedef HBITMAP EGLNativePixmapType; - -#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) /* Windows Store */ -#include <inspectable.h> -typedef IInspectable* EGLNativeWindowType; -#else -typedef HWND EGLNativeWindowType; -#endif - -#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ - -typedef int EGLNativeDisplayType; -typedef void *EGLNativeWindowType; -typedef void *EGLNativePixmapType; - -#elif defined(__ANDROID__) || defined(ANDROID) - -#include <android/native_window.h> - -struct egl_native_pixmap_t; - -typedef struct ANativeWindow* EGLNativeWindowType; -typedef struct egl_native_pixmap_t* EGLNativePixmapType; -typedef void* EGLNativeDisplayType; - -#elif defined(__unix__) - -/* X11 (tentative) */ -#include <X11/Xlib.h> -#include <X11/Xutil.h> - -typedef Display *EGLNativeDisplayType; -typedef Pixmap EGLNativePixmapType; -typedef Window EGLNativeWindowType; - -#else -#error "Platform not recognized" -#endif - -/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ -typedef EGLNativeDisplayType NativeDisplayType; -typedef EGLNativePixmapType NativePixmapType; -typedef EGLNativeWindowType NativeWindowType; - - -/* Define EGLint. This must be a signed integral type large enough to contain - * all legal attribute names and values passed into and out of EGL, whether - * their type is boolean, bitmask, enumerant (symbolic constant), integer, - * handle, or other. While in general a 32-bit integer will suffice, if - * handles are 64 bit types, then EGLint should be defined as a signed 64-bit - * integer type. - */ -typedef khronos_int32_t EGLint; - -#endif /* __eglplatform_h */ diff --git a/platform/winrt/include/GLES2/gl2.h b/platform/winrt/include/GLES2/gl2.h deleted file mode 100644 index c2d8357268..0000000000 --- a/platform/winrt/include/GLES2/gl2.h +++ /dev/null @@ -1,620 +0,0 @@ -#ifndef __gl2_h_ -#define __gl2_h_ - -/* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */ - -#include <GLES2/gl2platform.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -/*------------------------------------------------------------------------- - * Data type definitions - *-----------------------------------------------------------------------*/ - -typedef void GLvoid; -typedef char GLchar; -typedef unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef khronos_int8_t GLbyte; -typedef short GLshort; -typedef int GLint; -typedef int GLsizei; -typedef khronos_uint8_t GLubyte; -typedef unsigned short GLushort; -typedef unsigned int GLuint; -typedef khronos_float_t GLfloat; -typedef khronos_float_t GLclampf; -typedef khronos_int32_t GLfixed; - -/* GL types for handling large vertex buffer objects */ -typedef khronos_intptr_t GLintptr; -typedef khronos_ssize_t GLsizeiptr; - -/* OpenGL ES core versions */ -#define GL_ES_VERSION_2_0 1 - -/* ClearBufferMask */ -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_COLOR_BUFFER_BIT 0x00004000 - -/* Boolean */ -#define GL_FALSE 0 -#define GL_TRUE 1 - -/* BeginMode */ -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 - -/* AlphaFunction (not supported in ES20) */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* BlendingFactorDest */ -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 - -/* BlendingFactorSrc */ -/* GL_ZERO */ -/* GL_ONE */ -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -/* GL_SRC_ALPHA */ -/* GL_ONE_MINUS_SRC_ALPHA */ -/* GL_DST_ALPHA */ -/* GL_ONE_MINUS_DST_ALPHA */ - -/* BlendEquationSeparate */ -#define GL_FUNC_ADD 0x8006 -#define GL_BLEND_EQUATION 0x8009 -#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */ -#define GL_BLEND_EQUATION_ALPHA 0x883D - -/* BlendSubtract */ -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B - -/* Separate Blend Functions */ -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 - -/* Buffer Objects */ -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 - -#define GL_STREAM_DRAW 0x88E0 -#define GL_STATIC_DRAW 0x88E4 -#define GL_DYNAMIC_DRAW 0x88E8 - -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 - -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 - -/* CullFaceMode */ -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_FRONT_AND_BACK 0x0408 - -/* DepthFunction */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* EnableCap */ -#define GL_TEXTURE_2D 0x0DE1 -#define GL_CULL_FACE 0x0B44 -#define GL_BLEND 0x0BE2 -#define GL_DITHER 0x0BD0 -#define GL_STENCIL_TEST 0x0B90 -#define GL_DEPTH_TEST 0x0B71 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_COVERAGE 0x80A0 - -/* ErrorCode */ -#define GL_NO_ERROR 0 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_OPERATION 0x0502 -#define GL_OUT_OF_MEMORY 0x0505 - -/* FrontFaceDirection */ -#define GL_CW 0x0900 -#define GL_CCW 0x0901 - -/* GetPName */ -#define GL_LINE_WIDTH 0x0B21 -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#define GL_VIEWPORT 0x0BA2 -#define GL_SCISSOR_BOX 0x0C10 -/* GL_SCISSOR_TEST */ -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_ALPHA_BITS 0x0D55 -#define GL_DEPTH_BITS 0x0D56 -#define GL_STENCIL_BITS 0x0D57 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -/* GL_POLYGON_OFFSET_FILL */ -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB - -/* GetTextureParameter */ -/* GL_TEXTURE_MAG_FILTER */ -/* GL_TEXTURE_MIN_FILTER */ -/* GL_TEXTURE_WRAP_S */ -/* GL_TEXTURE_WRAP_T */ - -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 - -/* HintMode */ -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 - -/* HintTarget */ -#define GL_GENERATE_MIPMAP_HINT 0x8192 - -/* DataType */ -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_FIXED 0x140C - -/* PixelFormat */ -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A - -/* PixelType */ -/* GL_UNSIGNED_BYTE */ -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 - -/* Shaders */ -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_SHADER_TYPE 0x8B4F -#define GL_DELETE_STATUS 0x8B80 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D - -/* StencilFunction */ -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 - -/* StencilOp */ -/* GL_ZERO */ -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -#define GL_INVERT 0x150A -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 - -/* StringName */ -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 - -/* TextureMagFilter */ -#define GL_NEAREST 0x2600 -#define GL_LINEAR 0x2601 - -/* TextureMinFilter */ -/* GL_NEAREST */ -/* GL_LINEAR */ -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 - -/* TextureParameterName */ -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 - -/* TextureTarget */ -/* GL_TEXTURE_2D */ -#define GL_TEXTURE 0x1702 - -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C - -/* TextureUnit */ -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 - -/* TextureWrapMode */ -#define GL_REPEAT 0x2901 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_MIRRORED_REPEAT 0x8370 - -/* Uniform Types */ -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_CUBE 0x8B60 - -/* Vertex Arrays */ -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F - -/* Read Format */ -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B - -/* Shader Source */ -#define GL_COMPILE_STATUS 0x8B81 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_SHADER_COMPILER 0x8DFA - -/* Shader Binary */ -#define GL_SHADER_BINARY_FORMATS 0x8DF8 -#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 - -/* Shader Precision-Specified Types */ -#define GL_LOW_FLOAT 0x8DF0 -#define GL_MEDIUM_FLOAT 0x8DF1 -#define GL_HIGH_FLOAT 0x8DF2 -#define GL_LOW_INT 0x8DF3 -#define GL_MEDIUM_INT 0x8DF4 -#define GL_HIGH_INT 0x8DF5 - -/* Framebuffer Object. */ -#define GL_FRAMEBUFFER 0x8D40 -#define GL_RENDERBUFFER 0x8D41 - -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGB565 0x8D62 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_STENCIL_INDEX8 0x8D48 - -#define GL_RENDERBUFFER_WIDTH 0x8D42 -#define GL_RENDERBUFFER_HEIGHT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 -#define GL_RENDERBUFFER_RED_SIZE 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 - -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 - -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_DEPTH_ATTACHMENT 0x8D00 -#define GL_STENCIL_ATTACHMENT 0x8D20 - -#define GL_NONE 0 - -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD - -#define GL_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_RENDERBUFFER_BINDING 0x8CA7 -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 - -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 - -/*------------------------------------------------------------------------- - * GL core functions. - *-----------------------------------------------------------------------*/ - -GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); -GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name); -GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); -GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); -GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); -GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode ); -GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); -GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); -GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); -GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); -GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); -GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); -GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); -GL_APICALL void GL_APIENTRY glClearStencil (GLint s); -GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); -GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); -GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); -GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); -GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers); -GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers); -GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); -GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers); -GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); -GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures); -GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); -GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); -GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); -GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glDisable (GLenum cap); -GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); -GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); -GL_APICALL void GL_APIENTRY glEnable (GLenum cap); -GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glFinish (void); -GL_APICALL void GL_APIENTRY glFlush (void); -GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); -GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); -GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); -GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers); -GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers); -GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); -GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); -GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); -GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); -GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); -GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); -GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL GLenum GL_APIENTRY glGetError (void); -GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); -GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); -GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); -GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); -GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); -GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); -GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); -GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); -GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); -GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); -GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); -GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); -GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); -GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); -GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); -GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); -GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); -GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); -GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); -GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); -GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); -GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); -GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); -GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length); -GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); -GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); -GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); -GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params); -GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params); -GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); -GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); -GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); -GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); -GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); -GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); -GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); -GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); -GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); -GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); - -#ifdef __cplusplus -} -#endif - -#endif /* __gl2_h_ */ diff --git a/platform/winrt/include/GLES2/gl2ext.h b/platform/winrt/include/GLES2/gl2ext.h deleted file mode 100644 index d5a9dd195b..0000000000 --- a/platform/winrt/include/GLES2/gl2ext.h +++ /dev/null @@ -1,2013 +0,0 @@ -#ifndef __gl2ext_h_ -#define __gl2ext_h_ - -/* $Revision: 20795 $ on $Date:: 2013-03-07 01:01:58 -0800 #$ */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -#ifndef GL_APIENTRYP -# define GL_APIENTRYP GL_APIENTRY* -#endif - -/*------------------------------------------------------------------------* - * OES extension tokens - *------------------------------------------------------------------------*/ - -/* GL_OES_compressed_ETC1_RGB8_texture */ -#ifndef GL_OES_compressed_ETC1_RGB8_texture -#define GL_ETC1_RGB8_OES 0x8D64 -#endif - -/* GL_OES_compressed_paletted_texture */ -#ifndef GL_OES_compressed_paletted_texture -#define GL_PALETTE4_RGB8_OES 0x8B90 -#define GL_PALETTE4_RGBA8_OES 0x8B91 -#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 -#define GL_PALETTE4_RGBA4_OES 0x8B93 -#define GL_PALETTE4_RGB5_A1_OES 0x8B94 -#define GL_PALETTE8_RGB8_OES 0x8B95 -#define GL_PALETTE8_RGBA8_OES 0x8B96 -#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 -#define GL_PALETTE8_RGBA4_OES 0x8B98 -#define GL_PALETTE8_RGB5_A1_OES 0x8B99 -#endif - -/* GL_OES_depth24 */ -#ifndef GL_OES_depth24 -#define GL_DEPTH_COMPONENT24_OES 0x81A6 -#endif - -/* GL_OES_depth32 */ -#ifndef GL_OES_depth32 -#define GL_DEPTH_COMPONENT32_OES 0x81A7 -#endif - -/* GL_OES_depth_texture */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_EGL_image */ -#ifndef GL_OES_EGL_image -typedef void* GLeglImageOES; -#endif - -/* GL_OES_EGL_image_external */ -#ifndef GL_OES_EGL_image_external -/* GLeglImageOES defined in GL_OES_EGL_image already. */ -#define GL_TEXTURE_EXTERNAL_OES 0x8D65 -#define GL_SAMPLER_EXTERNAL_OES 0x8D66 -#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 -#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 -#endif - -/* GL_OES_element_index_uint */ -#ifndef GL_OES_element_index_uint -#define GL_UNSIGNED_INT 0x1405 -#endif - -/* GL_OES_get_program_binary */ -#ifndef GL_OES_get_program_binary -#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE -#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF -#endif - -/* GL_OES_mapbuffer */ -#ifndef GL_OES_mapbuffer -#define GL_WRITE_ONLY_OES 0x88B9 -#define GL_BUFFER_ACCESS_OES 0x88BB -#define GL_BUFFER_MAPPED_OES 0x88BC -#define GL_BUFFER_MAP_POINTER_OES 0x88BD -#endif - -/* GL_OES_packed_depth_stencil */ -#ifndef GL_OES_packed_depth_stencil -#define GL_DEPTH_STENCIL_OES 0x84F9 -#define GL_UNSIGNED_INT_24_8_OES 0x84FA -#define GL_DEPTH24_STENCIL8_OES 0x88F0 -#endif - -/* GL_OES_required_internalformat */ -#ifndef GL_OES_required_internalformat -#define GL_ALPHA8_OES 0x803C -#define GL_DEPTH_COMPONENT16_OES 0x81A5 -/* reuse GL_DEPTH_COMPONENT24_OES */ -/* reuse GL_DEPTH24_STENCIL8_OES */ -/* reuse GL_DEPTH_COMPONENT32_OES */ -#define GL_LUMINANCE4_ALPHA4_OES 0x8043 -#define GL_LUMINANCE8_ALPHA8_OES 0x8045 -#define GL_LUMINANCE8_OES 0x8040 -#define GL_RGBA4_OES 0x8056 -#define GL_RGB5_A1_OES 0x8057 -#define GL_RGB565_OES 0x8D62 -/* reuse GL_RGB8_OES */ -/* reuse GL_RGBA8_OES */ -/* reuse GL_RGB10_EXT */ -/* reuse GL_RGB10_A2_EXT */ -#endif - -/* GL_OES_rgb8_rgba8 */ -#ifndef GL_OES_rgb8_rgba8 -#define GL_RGB8_OES 0x8051 -#define GL_RGBA8_OES 0x8058 -#endif - -/* GL_OES_standard_derivatives */ -#ifndef GL_OES_standard_derivatives -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B -#endif - -/* GL_OES_stencil1 */ -#ifndef GL_OES_stencil1 -#define GL_STENCIL_INDEX1_OES 0x8D46 -#endif - -/* GL_OES_stencil4 */ -#ifndef GL_OES_stencil4 -#define GL_STENCIL_INDEX4_OES 0x8D47 -#endif - -#ifndef GL_OES_surfaceless_context -#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219 -#endif - -/* GL_OES_texture_3D */ -#ifndef GL_OES_texture_3D -#define GL_TEXTURE_WRAP_R_OES 0x8072 -#define GL_TEXTURE_3D_OES 0x806F -#define GL_TEXTURE_BINDING_3D_OES 0x806A -#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 -#define GL_SAMPLER_3D_OES 0x8B5F -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 -#endif - -/* GL_OES_texture_float */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_texture_float_linear */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_texture_half_float */ -#ifndef GL_OES_texture_half_float -#define GL_HALF_FLOAT_OES 0x8D61 -#endif - -/* GL_OES_texture_half_float_linear */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_texture_npot */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_vertex_array_object */ -#ifndef GL_OES_vertex_array_object -#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 -#endif - -/* GL_OES_vertex_half_float */ -/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */ - -/* GL_OES_vertex_type_10_10_10_2 */ -#ifndef GL_OES_vertex_type_10_10_10_2 -#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 -#define GL_INT_10_10_10_2_OES 0x8DF7 -#endif - -/*------------------------------------------------------------------------* - * KHR extension tokens - *------------------------------------------------------------------------*/ - -#ifndef GL_KHR_debug -typedef void (GL_APIENTRYP GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); -#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 -#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 -#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 -#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 -#define GL_DEBUG_SOURCE_API 0x8246 -#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 -#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 -#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 -#define GL_DEBUG_SOURCE_APPLICATION 0x824A -#define GL_DEBUG_SOURCE_OTHER 0x824B -#define GL_DEBUG_TYPE_ERROR 0x824C -#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D -#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E -#define GL_DEBUG_TYPE_PORTABILITY 0x824F -#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 -#define GL_DEBUG_TYPE_OTHER 0x8251 -#define GL_DEBUG_TYPE_MARKER 0x8268 -#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 -#define GL_DEBUG_TYPE_POP_GROUP 0x826A -#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B -#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C -#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D -#define GL_BUFFER 0x82E0 -#define GL_SHADER 0x82E1 -#define GL_PROGRAM 0x82E2 -#define GL_QUERY 0x82E3 -/* PROGRAM_PIPELINE only in GL */ -#define GL_SAMPLER 0x82E6 -/* DISPLAY_LIST only in GL */ -#define GL_MAX_LABEL_LENGTH 0x82E8 -#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES 0x9145 -#define GL_DEBUG_SEVERITY_HIGH 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 -#define GL_DEBUG_SEVERITY_LOW 0x9148 -#define GL_DEBUG_OUTPUT 0x92E0 -#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 -#define GL_STACK_OVERFLOW 0x0503 -#define GL_STACK_UNDERFLOW 0x0504 -#endif - -#ifndef GL_KHR_texture_compression_astc_ldr -#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 -#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 -#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 -#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 -#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 -#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 -#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 -#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 -#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 -#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 -#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA -#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB -#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC -#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD -#endif - -/*------------------------------------------------------------------------* - * AMD extension tokens - *------------------------------------------------------------------------*/ - -/* GL_AMD_compressed_3DC_texture */ -#ifndef GL_AMD_compressed_3DC_texture -#define GL_3DC_X_AMD 0x87F9 -#define GL_3DC_XY_AMD 0x87FA -#endif - -/* GL_AMD_compressed_ATC_texture */ -#ifndef GL_AMD_compressed_ATC_texture -#define GL_ATC_RGB_AMD 0x8C92 -#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 -#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE -#endif - -/* GL_AMD_performance_monitor */ -#ifndef GL_AMD_performance_monitor -#define GL_COUNTER_TYPE_AMD 0x8BC0 -#define GL_COUNTER_RANGE_AMD 0x8BC1 -#define GL_UNSIGNED_INT64_AMD 0x8BC2 -#define GL_PERCENTAGE_AMD 0x8BC3 -#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 -#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 -#define GL_PERFMON_RESULT_AMD 0x8BC6 -#endif - -/* GL_AMD_program_binary_Z400 */ -#ifndef GL_AMD_program_binary_Z400 -#define GL_Z400_BINARY_AMD 0x8740 -#endif - -/*------------------------------------------------------------------------* - * ANGLE extension tokens - *------------------------------------------------------------------------*/ - -/* GL_ANGLE_depth_texture */ -#ifndef GL_ANGLE_depth_texture -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_DEPTH_STENCIL_OES 0x84F9 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_UNSIGNED_INT 0x1405 -#define GL_UNSIGNED_INT_24_8_OES 0x84FA -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_DEPTH_COMPONENT32_OES 0x81A7 -#define GL_DEPTH24_STENCIL8_OES 0x88F0 -#endif - -/* GL_ANGLE_framebuffer_blit */ -#ifndef GL_ANGLE_framebuffer_blit -#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA -#endif - -/* GL_ANGLE_framebuffer_multisample */ -#ifndef GL_ANGLE_framebuffer_multisample -#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 -#define GL_MAX_SAMPLES_ANGLE 0x8D57 -#endif - -/* GL_ANGLE_instanced_arrays */ -#ifndef GL_ANGLE_instanced_arrays -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE -#endif - -/* GL_ANGLE_pack_reverse_row_order */ -#ifndef GL_ANGLE_pack_reverse_row_order -#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 -#endif - -/* GL_ANGLE_program_binary */ -#ifndef GL_ANGLE_program_binary -#define GL_PROGRAM_BINARY_ANGLE 0x93A6 -#endif - -/* GL_ANGLE_texture_compression_dxt3 */ -#ifndef GL_ANGLE_texture_compression_dxt3 -#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 -#endif - -/* GL_ANGLE_texture_compression_dxt5 */ -#ifndef GL_ANGLE_texture_compression_dxt5 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 -#endif - -/* GL_ANGLE_texture_usage */ -#ifndef GL_ANGLE_texture_usage -#define GL_TEXTURE_USAGE_ANGLE 0x93A2 -#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 -#endif - -/* GL_ANGLE_translated_shader_source */ -#ifndef GL_ANGLE_translated_shader_source -#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 -#endif - -/*------------------------------------------------------------------------* - * APPLE extension tokens - *------------------------------------------------------------------------*/ - -/* GL_APPLE_copy_texture_levels */ -/* No new tokens introduced by this extension. */ - -/* GL_APPLE_framebuffer_multisample */ -#ifndef GL_APPLE_framebuffer_multisample -#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 -#define GL_MAX_SAMPLES_APPLE 0x8D57 -#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA -#endif - -/* GL_APPLE_rgb_422 */ -#ifndef GL_APPLE_rgb_422 -#define GL_RGB_422_APPLE 0x8A1F -#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB -#endif - -/* GL_APPLE_sync */ -#ifndef GL_APPLE_sync - -#ifndef __gl3_h_ -/* These types are defined with reference to <inttypes.h> - * in the Apple extension spec, but here we use the Khronos - * portable types in khrplatform.h, and assume those types - * are always defined. - * If any other extensions using these types are defined, - * the typedefs must move out of this block and be shared. - */ -typedef khronos_int64_t GLint64; -typedef khronos_uint64_t GLuint64; -typedef struct __GLsync *GLsync; -#endif - -#define GL_SYNC_OBJECT_APPLE 0x8A53 -#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111 -#define GL_OBJECT_TYPE_APPLE 0x9112 -#define GL_SYNC_CONDITION_APPLE 0x9113 -#define GL_SYNC_STATUS_APPLE 0x9114 -#define GL_SYNC_FLAGS_APPLE 0x9115 -#define GL_SYNC_FENCE_APPLE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117 -#define GL_UNSIGNALED_APPLE 0x9118 -#define GL_SIGNALED_APPLE 0x9119 -#define GL_ALREADY_SIGNALED_APPLE 0x911A -#define GL_TIMEOUT_EXPIRED_APPLE 0x911B -#define GL_CONDITION_SATISFIED_APPLE 0x911C -#define GL_WAIT_FAILED_APPLE 0x911D -#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001 -#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull -#endif - -/* GL_APPLE_texture_format_BGRA8888 */ -#ifndef GL_APPLE_texture_format_BGRA8888 -#define GL_BGRA_EXT 0x80E1 -#endif - -/* GL_APPLE_texture_max_level */ -#ifndef GL_APPLE_texture_max_level -#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D -#endif - -/*------------------------------------------------------------------------* - * ARM extension tokens - *------------------------------------------------------------------------*/ - -/* GL_ARM_mali_program_binary */ -#ifndef GL_ARM_mali_program_binary -#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61 -#endif - -/* GL_ARM_mali_shader_binary */ -#ifndef GL_ARM_mali_shader_binary -#define GL_MALI_SHADER_BINARY_ARM 0x8F60 -#endif - -/* GL_ARM_rgba8 */ -/* No new tokens introduced by this extension. */ - -/*------------------------------------------------------------------------* - * EXT extension tokens - *------------------------------------------------------------------------*/ - -/* GL_EXT_blend_minmax */ -#ifndef GL_EXT_blend_minmax -#define GL_MIN_EXT 0x8007 -#define GL_MAX_EXT 0x8008 -#endif - -/* GL_EXT_color_buffer_half_float */ -#ifndef GL_EXT_color_buffer_half_float -#define GL_RGBA16F_EXT 0x881A -#define GL_RGB16F_EXT 0x881B -#define GL_RG16F_EXT 0x822F -#define GL_R16F_EXT 0x822D -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 -#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 -#endif - -/* GL_EXT_debug_label */ -#ifndef GL_EXT_debug_label -#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F -#define GL_PROGRAM_OBJECT_EXT 0x8B40 -#define GL_SHADER_OBJECT_EXT 0x8B48 -#define GL_BUFFER_OBJECT_EXT 0x9151 -#define GL_QUERY_OBJECT_EXT 0x9153 -#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 -#endif - -/* GL_EXT_debug_marker */ -/* No new tokens introduced by this extension. */ - -/* GL_EXT_discard_framebuffer */ -#ifndef GL_EXT_discard_framebuffer -#define GL_COLOR_EXT 0x1800 -#define GL_DEPTH_EXT 0x1801 -#define GL_STENCIL_EXT 0x1802 -#endif - -/* GL_EXT_map_buffer_range */ -#ifndef GL_EXT_map_buffer_range -#define GL_MAP_READ_BIT_EXT 0x0001 -#define GL_MAP_WRITE_BIT_EXT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020 -#endif - -/* GL_EXT_multisampled_render_to_texture */ -#ifndef GL_EXT_multisampled_render_to_texture -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C -/* reuse values from GL_EXT_framebuffer_multisample (desktop extension) */ -#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 -#define GL_MAX_SAMPLES_EXT 0x8D57 -#endif - -/* GL_EXT_multiview_draw_buffers */ -#ifndef GL_EXT_multiview_draw_buffers -#define GL_COLOR_ATTACHMENT_EXT 0x90F0 -#define GL_MULTIVIEW_EXT 0x90F1 -#define GL_DRAW_BUFFER_EXT 0x0C01 -#define GL_READ_BUFFER_EXT 0x0C02 -#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2 -#endif - -/* GL_EXT_multi_draw_arrays */ -/* No new tokens introduced by this extension. */ - -/* GL_EXT_occlusion_query_boolean */ -#ifndef GL_EXT_occlusion_query_boolean -#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A -#define GL_CURRENT_QUERY_EXT 0x8865 -#define GL_QUERY_RESULT_EXT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 -#endif - -/* GL_EXT_read_format_bgra */ -#ifndef GL_EXT_read_format_bgra -#define GL_BGRA_EXT 0x80E1 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 -#endif - -/* GL_EXT_robustness */ -#ifndef GL_EXT_robustness -/* reuse GL_NO_ERROR */ -#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 -#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 -#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 -#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 -#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 -#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 -#endif - -/* GL_EXT_separate_shader_objects */ -#ifndef GL_EXT_separate_shader_objects -#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 -#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 -#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF -#define GL_PROGRAM_SEPARABLE_EXT 0x8258 -#define GL_ACTIVE_PROGRAM_EXT 0x8259 -#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A -#endif - -/* GL_EXT_shader_framebuffer_fetch */ -#ifndef GL_EXT_shader_framebuffer_fetch -#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 -#endif - -/* GL_EXT_shader_texture_lod */ -/* No new tokens introduced by this extension. */ - -/* GL_EXT_shadow_samplers */ -#ifndef GL_EXT_shadow_samplers -#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C -#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D -#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E -#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 -#endif - -/* GL_EXT_sRGB */ -#ifndef GL_EXT_sRGB -#define GL_SRGB_EXT 0x8C40 -#define GL_SRGB_ALPHA_EXT 0x8C42 -#define GL_SRGB8_ALPHA8_EXT 0x8C43 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 -#endif - -/* GL_EXT_texture_compression_dxt1 */ -#ifndef GL_EXT_texture_compression_dxt1 -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 -#endif - -/* GL_EXT_texture_filter_anisotropic */ -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF -#endif - -/* GL_EXT_texture_format_BGRA8888 */ -#ifndef GL_EXT_texture_format_BGRA8888 -#define GL_BGRA_EXT 0x80E1 -#endif - -/* GL_EXT_texture_rg */ -#ifndef GL_EXT_texture_rg -#define GL_RED_EXT 0x1903 -#define GL_RG_EXT 0x8227 -#define GL_R8_EXT 0x8229 -#define GL_RG8_EXT 0x822B -#endif - -/* GL_EXT_texture_storage */ -#ifndef GL_EXT_texture_storage -#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F -#define GL_ALPHA8_EXT 0x803C -#define GL_LUMINANCE8_EXT 0x8040 -#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_RGBA32F_EXT 0x8814 -#define GL_RGB32F_EXT 0x8815 -#define GL_ALPHA32F_EXT 0x8816 -#define GL_LUMINANCE32F_EXT 0x8818 -#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 -/* reuse GL_RGBA16F_EXT */ -/* reuse GL_RGB16F_EXT */ -#define GL_ALPHA16F_EXT 0x881C -#define GL_LUMINANCE16F_EXT 0x881E -#define GL_LUMINANCE_ALPHA16F_EXT 0x881F -#define GL_RGB10_A2_EXT 0x8059 -#define GL_RGB10_EXT 0x8052 -#define GL_BGRA8_EXT 0x93A1 -#define GL_R8_EXT 0x8229 -#define GL_RG8_EXT 0x822B -#define GL_R32F_EXT 0x822E -#define GL_RG32F_EXT 0x8230 -#define GL_R16F_EXT 0x822D -#define GL_RG16F_EXT 0x822F -#endif - -/* GL_EXT_texture_type_2_10_10_10_REV */ -#ifndef GL_EXT_texture_type_2_10_10_10_REV -#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 -#endif - -/* GL_EXT_unpack_subimage */ -#ifndef GL_EXT_unpack_subimage -#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2 -#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4 -#endif - -/*------------------------------------------------------------------------* - * DMP extension tokens - *------------------------------------------------------------------------*/ - -/* GL_DMP_shader_binary */ -#ifndef GL_DMP_shader_binary -#define GL_SHADER_BINARY_DMP 0x9250 -#endif - -/*------------------------------------------------------------------------* - * FJ extension tokens - *------------------------------------------------------------------------*/ - -/* GL_FJ_shader_binary_GCCSO */ -#ifndef GL_FJ_shader_binary_GCCSO -#define GL_GCCSO_SHADER_BINARY_F 0x9260 -#endif - -/*------------------------------------------------------------------------* - * IMG extension tokens - *------------------------------------------------------------------------*/ - -/* GL_IMG_program_binary */ -#ifndef GL_IMG_program_binary -#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 -#endif - -/* GL_IMG_read_format */ -#ifndef GL_IMG_read_format -#define GL_BGRA_IMG 0x80E1 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 -#endif - -/* GL_IMG_shader_binary */ -#ifndef GL_IMG_shader_binary -#define GL_SGX_BINARY_IMG 0x8C0A -#endif - -/* GL_IMG_texture_compression_pvrtc */ -#ifndef GL_IMG_texture_compression_pvrtc -#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 -#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 -#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 -#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 -#endif - -/* GL_IMG_texture_compression_pvrtc2 */ -#ifndef GL_IMG_texture_compression_pvrtc2 -#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 -#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 -#endif - -/* GL_IMG_multisampled_render_to_texture */ -#ifndef GL_IMG_multisampled_render_to_texture -#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 -#define GL_MAX_SAMPLES_IMG 0x9135 -#define GL_TEXTURE_SAMPLES_IMG 0x9136 -#endif - -/*------------------------------------------------------------------------* - * NV extension tokens - *------------------------------------------------------------------------*/ - -/* GL_NV_coverage_sample */ -#ifndef GL_NV_coverage_sample -#define GL_COVERAGE_COMPONENT_NV 0x8ED0 -#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 -#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 -#define GL_COVERAGE_BUFFERS_NV 0x8ED3 -#define GL_COVERAGE_SAMPLES_NV 0x8ED4 -#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 -#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 -#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 -#define GL_COVERAGE_BUFFER_BIT_NV 0x8000 -#endif - -/* GL_NV_depth_nonlinear */ -#ifndef GL_NV_depth_nonlinear -#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C -#endif - -/* GL_NV_draw_buffers */ -#ifndef GL_NV_draw_buffers -#define GL_MAX_DRAW_BUFFERS_NV 0x8824 -#define GL_DRAW_BUFFER0_NV 0x8825 -#define GL_DRAW_BUFFER1_NV 0x8826 -#define GL_DRAW_BUFFER2_NV 0x8827 -#define GL_DRAW_BUFFER3_NV 0x8828 -#define GL_DRAW_BUFFER4_NV 0x8829 -#define GL_DRAW_BUFFER5_NV 0x882A -#define GL_DRAW_BUFFER6_NV 0x882B -#define GL_DRAW_BUFFER7_NV 0x882C -#define GL_DRAW_BUFFER8_NV 0x882D -#define GL_DRAW_BUFFER9_NV 0x882E -#define GL_DRAW_BUFFER10_NV 0x882F -#define GL_DRAW_BUFFER11_NV 0x8830 -#define GL_DRAW_BUFFER12_NV 0x8831 -#define GL_DRAW_BUFFER13_NV 0x8832 -#define GL_DRAW_BUFFER14_NV 0x8833 -#define GL_DRAW_BUFFER15_NV 0x8834 -#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 -#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 -#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 -#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 -#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 -#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 -#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 -#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 -#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 -#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 -#define GL_COLOR_ATTACHMENT10_NV 0x8CEA -#define GL_COLOR_ATTACHMENT11_NV 0x8CEB -#define GL_COLOR_ATTACHMENT12_NV 0x8CEC -#define GL_COLOR_ATTACHMENT13_NV 0x8CED -#define GL_COLOR_ATTACHMENT14_NV 0x8CEE -#define GL_COLOR_ATTACHMENT15_NV 0x8CEF -#endif - -/* GL_EXT_draw_buffers */ -#ifndef GL_EXT_draw_buffers -#define GL_MAX_DRAW_BUFFERS_EXT 0x8824 -#define GL_DRAW_BUFFER0_EXT 0x8825 -#define GL_DRAW_BUFFER1_EXT 0x8826 -#define GL_DRAW_BUFFER2_EXT 0x8827 -#define GL_DRAW_BUFFER3_EXT 0x8828 -#define GL_DRAW_BUFFER4_EXT 0x8829 -#define GL_DRAW_BUFFER5_EXT 0x882A -#define GL_DRAW_BUFFER6_EXT 0x882B -#define GL_DRAW_BUFFER7_EXT 0x882C -#define GL_DRAW_BUFFER8_EXT 0x882D -#define GL_DRAW_BUFFER9_EXT 0x882E -#define GL_DRAW_BUFFER10_EXT 0x882F -#define GL_DRAW_BUFFER11_EXT 0x8830 -#define GL_DRAW_BUFFER12_EXT 0x8831 -#define GL_DRAW_BUFFER13_EXT 0x8832 -#define GL_DRAW_BUFFER14_EXT 0x8833 -#define GL_DRAW_BUFFER15_EXT 0x8834 -#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 -#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 -#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 -#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 -#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 -#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 -#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 -#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 -#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 -#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA -#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB -#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC -#define GL_COLOR_ATTACHMENT13_EXT 0x8CED -#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE -#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF -#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF -#endif - -/* GL_NV_draw_instanced */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_fbo_color_attachments */ -#ifndef GL_NV_fbo_color_attachments -#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF -/* GL_COLOR_ATTACHMENT{0-15}_NV defined in GL_NV_draw_buffers already. */ -#endif - -/* GL_NV_fence */ -#ifndef GL_NV_fence -#define GL_ALL_COMPLETED_NV 0x84F2 -#define GL_FENCE_STATUS_NV 0x84F3 -#define GL_FENCE_CONDITION_NV 0x84F4 -#endif - -/* GL_NV_framebuffer_blit */ -#ifndef GL_NV_framebuffer_blit -#define GL_READ_FRAMEBUFFER_NV 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA -#endif - -/* GL_NV_framebuffer_multisample */ -#ifndef GL_NV_framebuffer_multisample -#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56 -#define GL_MAX_SAMPLES_NV 0x8D57 -#endif - -/* GL_NV_generate_mipmap_sRGB */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_instanced_arrays */ -#ifndef GL_NV_instanced_arrays -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE -#endif - -/* GL_NV_read_buffer */ -#ifndef GL_NV_read_buffer -#define GL_READ_BUFFER_NV 0x0C02 -#endif - -/* GL_NV_read_buffer_front */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_read_depth */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_read_depth_stencil */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_read_stencil */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_shadow_samplers_array */ -#ifndef GL_NV_shadow_samplers_array -#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4 -#endif - -/* GL_NV_shadow_samplers_cube */ -#ifndef GL_NV_shadow_samplers_cube -#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5 -#endif - -/* GL_NV_sRGB_formats */ -#ifndef GL_NV_sRGB_formats -#define GL_SLUMINANCE_NV 0x8C46 -#define GL_SLUMINANCE_ALPHA_NV 0x8C44 -#define GL_SRGB8_NV 0x8C41 -#define GL_SLUMINANCE8_NV 0x8C47 -#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45 -#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F -#define GL_ETC1_SRGB8_NV 0x88EE -#endif - -/* GL_NV_texture_border_clamp */ -#ifndef GL_NV_texture_border_clamp -#define GL_TEXTURE_BORDER_COLOR_NV 0x1004 -#define GL_CLAMP_TO_BORDER_NV 0x812D -#endif - -/* GL_NV_texture_compression_s3tc_update */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_texture_npot_2D_mipmap */ -/* No new tokens introduced by this extension. */ - -/*------------------------------------------------------------------------* - * QCOM extension tokens - *------------------------------------------------------------------------*/ - -/* GL_QCOM_alpha_test */ -#ifndef GL_QCOM_alpha_test -#define GL_ALPHA_TEST_QCOM 0x0BC0 -#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 -#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 -#endif - -/* GL_QCOM_binning_control */ -#ifndef GL_QCOM_binning_control -#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0 -#define GL_CPU_OPTIMIZED_QCOM 0x8FB1 -#define GL_GPU_OPTIMIZED_QCOM 0x8FB2 -#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3 -#endif - -/* GL_QCOM_driver_control */ -/* No new tokens introduced by this extension. */ - -/* GL_QCOM_extended_get */ -#ifndef GL_QCOM_extended_get -#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 -#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 -#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 -#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 -#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 -#define GL_TEXTURE_TYPE_QCOM 0x8BD7 -#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 -#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 -#define GL_TEXTURE_TARGET_QCOM 0x8BDA -#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB -#define GL_STATE_RESTORE 0x8BDC -#endif - -/* GL_QCOM_extended_get2 */ -/* No new tokens introduced by this extension. */ - -/* GL_QCOM_perfmon_global_mode */ -#ifndef GL_QCOM_perfmon_global_mode -#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 -#endif - -/* GL_QCOM_writeonly_rendering */ -#ifndef GL_QCOM_writeonly_rendering -#define GL_WRITEONLY_RENDERING_QCOM 0x8823 -#endif - -/* GL_QCOM_tiled_rendering */ -#ifndef GL_QCOM_tiled_rendering -#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 -#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 -#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 -#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 -#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 -#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 -#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 -#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 -#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 -#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 -#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 -#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 -#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 -#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 -#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 -#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 -#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 -#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 -#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 -#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 -#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 -#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 -#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 -#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 -#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 -#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 -#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 -#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 -#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 -#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 -#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 -#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 -#endif - -/*------------------------------------------------------------------------* - * VIV extension tokens - *------------------------------------------------------------------------*/ - -/* GL_VIV_shader_binary */ -#ifndef GL_VIV_shader_binary -#define GL_SHADER_BINARY_VIV 0x8FC4 -#endif - -/*------------------------------------------------------------------------* - * End of extension tokens, start of corresponding extension functions - *------------------------------------------------------------------------*/ - -/*------------------------------------------------------------------------* - * OES extension functions - *------------------------------------------------------------------------*/ - -/* GL_OES_compressed_ETC1_RGB8_texture */ -#ifndef GL_OES_compressed_ETC1_RGB8_texture -#define GL_OES_compressed_ETC1_RGB8_texture 1 -#endif - -/* GL_OES_compressed_paletted_texture */ -#ifndef GL_OES_compressed_paletted_texture -#define GL_OES_compressed_paletted_texture 1 -#endif - -/* GL_OES_depth24 */ -#ifndef GL_OES_depth24 -#define GL_OES_depth24 1 -#endif - -/* GL_OES_depth32 */ -#ifndef GL_OES_depth32 -#define GL_OES_depth32 1 -#endif - -/* GL_OES_depth_texture */ -#ifndef GL_OES_depth_texture -#define GL_OES_depth_texture 1 -#endif - -/* GL_OES_EGL_image */ -#ifndef GL_OES_EGL_image -#define GL_OES_EGL_image 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); -GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); -#endif -typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); -typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); -#endif - -/* GL_OES_EGL_image_external */ -#ifndef GL_OES_EGL_image_external -#define GL_OES_EGL_image_external 1 -/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */ -#endif - -/* GL_OES_element_index_uint */ -#ifndef GL_OES_element_index_uint -#define GL_OES_element_index_uint 1 -#endif - -/* GL_OES_fbo_render_mipmap */ -#ifndef GL_OES_fbo_render_mipmap -#define GL_OES_fbo_render_mipmap 1 -#endif - -/* GL_OES_fragment_precision_high */ -#ifndef GL_OES_fragment_precision_high -#define GL_OES_fragment_precision_high 1 -#endif - -/* GL_OES_get_program_binary */ -#ifndef GL_OES_get_program_binary -#define GL_OES_get_program_binary 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); -#endif -typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); -#endif - -/* GL_OES_mapbuffer */ -#ifndef GL_OES_mapbuffer -#define GL_OES_mapbuffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); -GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); -GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params); -#endif -typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); -typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); -typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params); -#endif - -/* GL_OES_packed_depth_stencil */ -#ifndef GL_OES_packed_depth_stencil -#define GL_OES_packed_depth_stencil 1 -#endif - -/* GL_OES_required_internalformat */ -#ifndef GL_OES_required_internalformat -#define GL_OES_required_internalformat 1 -#endif - -/* GL_OES_rgb8_rgba8 */ -#ifndef GL_OES_rgb8_rgba8 -#define GL_OES_rgb8_rgba8 1 -#endif - -/* GL_OES_standard_derivatives */ -#ifndef GL_OES_standard_derivatives -#define GL_OES_standard_derivatives 1 -#endif - -/* GL_OES_stencil1 */ -#ifndef GL_OES_stencil1 -#define GL_OES_stencil1 1 -#endif - -/* GL_OES_stencil4 */ -#ifndef GL_OES_stencil4 -#define GL_OES_stencil4 1 -#endif - -#ifndef GL_OES_surfaceless_context -#define GL_OES_surfaceless_context 1 -#endif - -/* GL_OES_texture_3D */ -#ifndef GL_OES_texture_3D -#define GL_OES_texture_3D 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -#endif -typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); -typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); -typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -#endif - -/* GL_OES_texture_float */ -#ifndef GL_OES_texture_float -#define GL_OES_texture_float 1 -#endif - -/* GL_OES_texture_float_linear */ -#ifndef GL_OES_texture_float_linear -#define GL_OES_texture_float_linear 1 -#endif - -/* GL_OES_texture_half_float */ -#ifndef GL_OES_texture_half_float -#define GL_OES_texture_half_float 1 -#endif - -/* GL_OES_texture_half_float_linear */ -#ifndef GL_OES_texture_half_float_linear -#define GL_OES_texture_half_float_linear 1 -#endif - -/* GL_OES_texture_npot */ -#ifndef GL_OES_texture_npot -#define GL_OES_texture_npot 1 -#endif - -/* GL_OES_vertex_array_object */ -#ifndef GL_OES_vertex_array_object -#define GL_OES_vertex_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array); -GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); -GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); -GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); -#endif -typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); -typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); -typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); -#endif - -/* GL_OES_vertex_half_float */ -#ifndef GL_OES_vertex_half_float -#define GL_OES_vertex_half_float 1 -#endif - -/* GL_OES_vertex_type_10_10_10_2 */ -#ifndef GL_OES_vertex_type_10_10_10_2 -#define GL_OES_vertex_type_10_10_10_2 1 -#endif - -/*------------------------------------------------------------------------* - * KHR extension functions - *------------------------------------------------------------------------*/ - -#ifndef GL_KHR_debug -#define GL_KHR_debug 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -GL_APICALL void GL_APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -GL_APICALL void GL_APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam); -GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -GL_APICALL void GL_APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message); -GL_APICALL void GL_APIENTRY glPopDebugGroup (void); -GL_APICALL void GL_APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -GL_APICALL void GL_APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -GL_APICALL void GL_APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label); -GL_APICALL void GL_APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -GL_APICALL void GL_APIENTRY glGetPointerv (GLenum pname, void **params); -#endif -typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam); -typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); -typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void); -typedef void (GL_APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETPOINTERVPROC) (GLenum pname, void **params); -#endif - -#ifndef GL_KHR_texture_compression_astc_ldr -#define GL_KHR_texture_compression_astc_ldr 1 -#endif - - -/*------------------------------------------------------------------------* - * AMD extension functions - *------------------------------------------------------------------------*/ - -/* GL_AMD_compressed_3DC_texture */ -#ifndef GL_AMD_compressed_3DC_texture -#define GL_AMD_compressed_3DC_texture 1 -#endif - -/* GL_AMD_compressed_ATC_texture */ -#ifndef GL_AMD_compressed_ATC_texture -#define GL_AMD_compressed_ATC_texture 1 -#endif - -/* AMD_performance_monitor */ -#ifndef GL_AMD_performance_monitor -#define GL_AMD_performance_monitor 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); -GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data); -GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); -GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); -GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); -GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor); -GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); -#endif -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data); -typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); -typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); -typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); -#endif - -/* GL_AMD_program_binary_Z400 */ -#ifndef GL_AMD_program_binary_Z400 -#define GL_AMD_program_binary_Z400 1 -#endif - -/*------------------------------------------------------------------------* - * ANGLE extension functions - *------------------------------------------------------------------------*/ - -/* GL_ANGLE_depth_texture */ -#ifndef GL_ANGLE_depth_texture -#define GL_ANGLE_depth_texture 1 -#endif - -/* GL_ANGLE_framebuffer_blit */ -#ifndef GL_ANGLE_framebuffer_blit -#define GL_ANGLE_framebuffer_blit 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif -typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif - -/* GL_ANGLE_framebuffer_multisample */ -#ifndef GL_ANGLE_framebuffer_multisample -#define GL_ANGLE_framebuffer_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif - -#ifndef GL_ANGLE_instanced_arrays -#define GL_ANGLE_instanced_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor); -#endif -typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); -#endif - -/* GL_ANGLE_pack_reverse_row_order */ -#ifndef GL_ANGLE_pack_reverse_row_order -#define GL_ANGLE_pack_reverse_row_order 1 -#endif - -/* GL_ANGLE_program_binary */ -#ifndef GL_ANGLE_program_binary -#define GL_ANGLE_program_binary 1 -#endif - -/* GL_ANGLE_texture_compression_dxt3 */ -#ifndef GL_ANGLE_texture_compression_dxt3 -#define GL_ANGLE_texture_compression_dxt3 1 -#endif - -/* GL_ANGLE_texture_compression_dxt5 */ -#ifndef GL_ANGLE_texture_compression_dxt5 -#define GL_ANGLE_texture_compression_dxt5 1 -#endif - -/* GL_ANGLE_texture_usage */ -#ifndef GL_ANGLE_texture_usage -#define GL_ANGLE_texture_usage 1 -#endif - -#ifndef GL_ANGLE_translated_shader_source -#define GL_ANGLE_translated_shader_source 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -#endif -typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -#endif - -/*------------------------------------------------------------------------* - * APPLE extension functions - *------------------------------------------------------------------------*/ - -/* GL_APPLE_copy_texture_levels */ -#ifndef GL_APPLE_copy_texture_levels -#define GL_APPLE_copy_texture_levels 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); -#endif -typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); -#endif - -/* GL_APPLE_framebuffer_multisample */ -#ifndef GL_APPLE_framebuffer_multisample -#define GL_APPLE_framebuffer_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); -#endif - -/* GL_APPLE_rgb_422 */ -#ifndef GL_APPLE_rgb_422 -#define GL_APPLE_rgb_422 1 -#endif - -/* GL_APPLE_sync */ -#ifndef GL_APPLE_sync -#define GL_APPLE_sync 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags); -GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync); -GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync); -GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params); -GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -#endif -typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags); -typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync); -typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync); -typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params); -typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -#endif - -/* GL_APPLE_texture_format_BGRA8888 */ -#ifndef GL_APPLE_texture_format_BGRA8888 -#define GL_APPLE_texture_format_BGRA8888 1 -#endif - -/* GL_APPLE_texture_max_level */ -#ifndef GL_APPLE_texture_max_level -#define GL_APPLE_texture_max_level 1 -#endif - -/*------------------------------------------------------------------------* - * ARM extension functions - *------------------------------------------------------------------------*/ - -/* GL_ARM_mali_program_binary */ -#ifndef GL_ARM_mali_program_binary -#define GL_ARM_mali_program_binary 1 -#endif - -/* GL_ARM_mali_shader_binary */ -#ifndef GL_ARM_mali_shader_binary -#define GL_ARM_mali_shader_binary 1 -#endif - -/* GL_ARM_rgba8 */ -#ifndef GL_ARM_rgba8 -#define GL_ARM_rgba8 1 -#endif - -/*------------------------------------------------------------------------* - * EXT extension functions - *------------------------------------------------------------------------*/ - -/* GL_EXT_blend_minmax */ -#ifndef GL_EXT_blend_minmax -#define GL_EXT_blend_minmax 1 -#endif - -/* GL_EXT_color_buffer_half_float */ -#ifndef GL_EXT_color_buffer_half_float -#define GL_EXT_color_buffer_half_float 1 -#endif - -/* GL_EXT_debug_label */ -#ifndef GL_EXT_debug_label -#define GL_EXT_debug_label 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); -GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); -#endif -typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); -#endif - -/* GL_EXT_debug_marker */ -#ifndef GL_EXT_debug_marker -#define GL_EXT_debug_marker 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); -GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); -GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void); -#endif -typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); -typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); -typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); -#endif - -/* GL_EXT_discard_framebuffer */ -#ifndef GL_EXT_discard_framebuffer -#define GL_EXT_discard_framebuffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); -#endif -typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); -#endif - -/* GL_EXT_map_buffer_range */ -#ifndef GL_EXT_map_buffer_range -#define GL_EXT_map_buffer_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void* GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length); -#endif -typedef void* (GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length); -#endif - -/* GL_EXT_multisampled_render_to_texture */ -#ifndef GL_EXT_multisampled_render_to_texture -#define GL_EXT_multisampled_render_to_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); -#endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); -#endif - -/* GL_EXT_multiview_draw_buffers */ -#ifndef GL_EXT_multiview_draw_buffers -#define GL_EXT_multiview_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index); -GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices); -GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data); -#endif -typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index); -typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices); -typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data); -#endif - -#ifndef GL_EXT_multi_draw_arrays -#define GL_EXT_multi_draw_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, const GLint *, const GLsizei *, GLsizei); -GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -#endif - -/* GL_EXT_occlusion_query_boolean */ -#ifndef GL_EXT_occlusion_query_boolean -#define GL_EXT_occlusion_query_boolean 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); -GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); -GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id); -GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id); -GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target); -GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); -#endif -typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); -typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); -typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); -typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); -typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); -#endif - -/* GL_EXT_read_format_bgra */ -#ifndef GL_EXT_read_format_bgra -#define GL_EXT_read_format_bgra 1 -#endif - -/* GL_EXT_robustness */ -#ifndef GL_EXT_robustness -#define GL_EXT_robustness 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void); -GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params); -GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params); -#endif -typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); -typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params); -typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); -#endif - -/* GL_EXT_separate_shader_objects */ -#ifndef GL_EXT_separate_shader_objects -#define GL_EXT_separate_shader_objects 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); -GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program); -GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); -GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); -GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines); -GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines); -GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline); -GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); -GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x); -GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y); -GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z); -GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); -GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x); -GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline); -GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -#endif -typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); -typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); -typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); -typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); -typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); -typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); -typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -#endif - -/* GL_EXT_shader_framebuffer_fetch */ -#ifndef GL_EXT_shader_framebuffer_fetch -#define GL_EXT_shader_framebuffer_fetch 1 -#endif - -/* GL_EXT_shader_texture_lod */ -#ifndef GL_EXT_shader_texture_lod -#define GL_EXT_shader_texture_lod 1 -#endif - -/* GL_EXT_shadow_samplers */ -#ifndef GL_EXT_shadow_samplers -#define GL_EXT_shadow_samplers 1 -#endif - -/* GL_EXT_sRGB */ -#ifndef GL_EXT_sRGB -#define GL_EXT_sRGB 1 -#endif - -/* GL_EXT_texture_compression_dxt1 */ -#ifndef GL_EXT_texture_compression_dxt1 -#define GL_EXT_texture_compression_dxt1 1 -#endif - -/* GL_EXT_texture_filter_anisotropic */ -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_EXT_texture_filter_anisotropic 1 -#endif - -/* GL_EXT_texture_format_BGRA8888 */ -#ifndef GL_EXT_texture_format_BGRA8888 -#define GL_EXT_texture_format_BGRA8888 1 -#endif - -/* GL_EXT_texture_rg */ -#ifndef GL_EXT_texture_rg -#define GL_EXT_texture_rg 1 -#endif - -/* GL_EXT_texture_storage */ -#ifndef GL_EXT_texture_storage -#define GL_EXT_texture_storage 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -#endif -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -#endif - -/* GL_EXT_texture_type_2_10_10_10_REV */ -#ifndef GL_EXT_texture_type_2_10_10_10_REV -#define GL_EXT_texture_type_2_10_10_10_REV 1 -#endif - -/* GL_EXT_unpack_subimage */ -#ifndef GL_EXT_unpack_subimage -#define GL_EXT_unpack_subimage 1 -#endif - -/*------------------------------------------------------------------------* - * DMP extension functions - *------------------------------------------------------------------------*/ - -/* GL_DMP_shader_binary */ -#ifndef GL_DMP_shader_binary -#define GL_DMP_shader_binary 1 -#endif - -/*------------------------------------------------------------------------* - * FJ extension functions - *------------------------------------------------------------------------*/ - -/* GL_FJ_shader_binary_GCCSO */ -#ifndef GL_FJ_shader_binary_GCCSO -#define GL_FJ_shader_binary_GCCSO 1 -#endif - -/*------------------------------------------------------------------------* - * IMG extension functions - *------------------------------------------------------------------------*/ - -/* GL_IMG_program_binary */ -#ifndef GL_IMG_program_binary -#define GL_IMG_program_binary 1 -#endif - -/* GL_IMG_read_format */ -#ifndef GL_IMG_read_format -#define GL_IMG_read_format 1 -#endif - -/* GL_IMG_shader_binary */ -#ifndef GL_IMG_shader_binary -#define GL_IMG_shader_binary 1 -#endif - -/* GL_IMG_texture_compression_pvrtc */ -#ifndef GL_IMG_texture_compression_pvrtc -#define GL_IMG_texture_compression_pvrtc 1 -#endif - -/* GL_IMG_texture_compression_pvrtc2 */ -#ifndef GL_IMG_texture_compression_pvrtc2 -#define GL_IMG_texture_compression_pvrtc2 1 -#endif - -/* GL_IMG_multisampled_render_to_texture */ -#ifndef GL_IMG_multisampled_render_to_texture -#define GL_IMG_multisampled_render_to_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); -#endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); -#endif - -/*------------------------------------------------------------------------* - * NV extension functions - *------------------------------------------------------------------------*/ - -/* GL_NV_coverage_sample */ -#ifndef GL_NV_coverage_sample -#define GL_NV_coverage_sample 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask); -GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation); -#endif -typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); -typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); -#endif - -/* GL_NV_depth_nonlinear */ -#ifndef GL_NV_depth_nonlinear -#define GL_NV_depth_nonlinear 1 -#endif - -/* GL_NV_draw_buffers */ -#ifndef GL_NV_draw_buffers -#define GL_NV_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs); -#endif -typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); -#endif - -/* GL_EXT_draw_buffers */ -#ifndef GL_EXT_draw_buffers -#define GL_EXT_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs); -#endif -typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs); -#endif - -/* GL_NV_draw_instanced */ -#ifndef GL_NV_draw_instanced -#define GL_NV_draw_instanced 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); -#endif -typedef void (GL_APIENTRYP PFNDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (GL_APIENTRYP PFNDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); -#endif - -/* GL_NV_fbo_color_attachments */ -#ifndef GL_NV_fbo_color_attachments -#define GL_NV_fbo_color_attachments 1 -#endif - -/* GL_NV_fence */ -#ifndef GL_NV_fence -#define GL_NV_fence 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); -GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *); -GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint); -GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint); -GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); -GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint); -GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint, GLenum); -#endif -typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); -typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); -typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); -typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); -typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); -typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); -#endif - -/* GL_NV_framebuffer_blit */ -#ifndef GL_NV_framebuffer_blit -#define GL_NV_framebuffer_blit 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glBlitFramebufferNV (int srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif -typedef void (GL_APIENTRYP PFNBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif - -/* GL_NV_framebuffer_multisample */ -#ifndef GL_NV_framebuffer_multisample -#define GL_NV_framebuffer_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif -typedef void (GL_APIENTRYP PFNRENDERBUFFERSTORAGEMULTISAMPLENVPROC) ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif - -/* GL_NV_generate_mipmap_sRGB */ -#ifndef GL_NV_generate_mipmap_sRGB -#define GL_NV_generate_mipmap_sRGB 1 -#endif - -/* GL_NV_instanced_arrays */ -#ifndef GL_NV_instanced_arrays -#define GL_NV_instanced_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor); -#endif -typedef void (GL_APIENTRYP PFNVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor); -#endif - -/* GL_NV_read_buffer */ -#ifndef GL_NV_read_buffer -#define GL_NV_read_buffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode); -#endif -typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); -#endif - -/* GL_NV_read_buffer_front */ -#ifndef GL_NV_read_buffer_front -#define GL_NV_read_buffer_front 1 -#endif - -/* GL_NV_read_depth */ -#ifndef GL_NV_read_depth -#define GL_NV_read_depth 1 -#endif - -/* GL_NV_read_depth_stencil */ -#ifndef GL_NV_read_depth_stencil -#define GL_NV_read_depth_stencil 1 -#endif - -/* GL_NV_read_stencil */ -#ifndef GL_NV_read_stencil -#define GL_NV_read_stencil 1 -#endif - -/* GL_NV_shadow_samplers_array */ -#ifndef GL_NV_shadow_samplers_array -#define GL_NV_shadow_samplers_array 1 -#endif - -/* GL_NV_shadow_samplers_cube */ -#ifndef GL_NV_shadow_samplers_cube -#define GL_NV_shadow_samplers_cube 1 -#endif - -/* GL_NV_sRGB_formats */ -#ifndef GL_NV_sRGB_formats -#define GL_NV_sRGB_formats 1 -#endif - -/* GL_NV_texture_border_clamp */ -#ifndef GL_NV_texture_border_clamp -#define GL_NV_texture_border_clamp 1 -#endif - -/* GL_NV_texture_compression_s3tc_update */ -#ifndef GL_NV_texture_compression_s3tc_update -#define GL_NV_texture_compression_s3tc_update 1 -#endif - -/* GL_NV_texture_npot_2D_mipmap */ -#ifndef GL_NV_texture_npot_2D_mipmap -#define GL_NV_texture_npot_2D_mipmap 1 -#endif - -/*------------------------------------------------------------------------* - * QCOM extension functions - *------------------------------------------------------------------------*/ - -/* GL_QCOM_alpha_test */ -#ifndef GL_QCOM_alpha_test -#define GL_QCOM_alpha_test 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref); -#endif -typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref); -#endif - -/* GL_QCOM_binning_control */ -#ifndef GL_QCOM_binning_control -#define GL_QCOM_binning_control 1 -#endif - -/* GL_QCOM_driver_control */ -#ifndef GL_QCOM_driver_control -#define GL_QCOM_driver_control 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); -GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); -GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); -GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl); -#endif -typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); -typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); -typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); -typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); -#endif - -/* GL_QCOM_extended_get */ -#ifndef GL_QCOM_extended_get -#define GL_QCOM_extended_get 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); -GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); -GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); -GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); -GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); -GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params); -#endif -typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); -typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); -typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); -typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params); -#endif - -/* GL_QCOM_extended_get2 */ -#ifndef GL_QCOM_extended_get2 -#define GL_QCOM_extended_get2 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); -GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); -GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); -GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length); -#endif -typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); -typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); -typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); -typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); -#endif - -/* GL_QCOM_perfmon_global_mode */ -#ifndef GL_QCOM_perfmon_global_mode -#define GL_QCOM_perfmon_global_mode 1 -#endif - -/* GL_QCOM_writeonly_rendering */ -#ifndef GL_QCOM_writeonly_rendering -#define GL_QCOM_writeonly_rendering 1 -#endif - -/* GL_QCOM_tiled_rendering */ -#ifndef GL_QCOM_tiled_rendering -#define GL_QCOM_tiled_rendering 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); -GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask); -#endif -typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); -typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); -#endif - -/*------------------------------------------------------------------------* - * VIV extension tokens - *------------------------------------------------------------------------*/ - -/* GL_VIV_shader_binary */ -#ifndef GL_VIV_shader_binary -#define GL_VIV_shader_binary 1 -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* __gl2ext_h_ */ diff --git a/platform/winrt/include/GLES2/gl2platform.h b/platform/winrt/include/GLES2/gl2platform.h deleted file mode 100644 index c9fa3c4d64..0000000000 --- a/platform/winrt/include/GLES2/gl2platform.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __gl2platform_h_ -#define __gl2platform_h_ - -/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h - * - * Adopters may modify khrplatform.h and this file to suit their platform. - * You are encouraged to submit all modifications to the Khronos group so that - * they can be included in future versions of this file. Please submit changes - * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) - * by filing a bug against product "OpenGL-ES" component "Registry". - */ - -#include <KHR/khrplatform.h> - -#ifndef GL_APICALL -#define GL_APICALL KHRONOS_APICALL -#endif - -#ifndef GL_APIENTRY -#define GL_APIENTRY KHRONOS_APIENTRY -#endif - -#endif /* __gl2platform_h_ */ diff --git a/platform/winrt/include/GLES3/gl3.h b/platform/winrt/include/GLES3/gl3.h deleted file mode 100644 index b7e91e6881..0000000000 --- a/platform/winrt/include/GLES3/gl3.h +++ /dev/null @@ -1,1061 +0,0 @@ -#ifndef __gl3_h_ -#define __gl3_h_ - -/* - * gl3.h last updated on $Date: 2013-02-12 14:37:24 -0800 (Tue, 12 Feb 2013) $ - */ - -#include <GLES3/gl3platform.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Copyright (c) 2007-2013 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -/*------------------------------------------------------------------------- - * Data type definitions - *-----------------------------------------------------------------------*/ - -/* OpenGL ES 2.0 */ - -typedef void GLvoid; -typedef char GLchar; -typedef unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef khronos_int8_t GLbyte; -typedef short GLshort; -typedef int GLint; -typedef int GLsizei; -typedef khronos_uint8_t GLubyte; -typedef unsigned short GLushort; -typedef unsigned int GLuint; -typedef khronos_float_t GLfloat; -typedef khronos_float_t GLclampf; -typedef khronos_int32_t GLfixed; -typedef khronos_intptr_t GLintptr; -typedef khronos_ssize_t GLsizeiptr; - -/* OpenGL ES 3.0 */ - -typedef unsigned short GLhalf; -typedef khronos_int64_t GLint64; -typedef khronos_uint64_t GLuint64; -typedef struct __GLsync *GLsync; - -/*------------------------------------------------------------------------- - * Token definitions - *-----------------------------------------------------------------------*/ - -/* OpenGL ES core versions */ -#define GL_ES_VERSION_3_0 1 -#define GL_ES_VERSION_2_0 1 - -/* OpenGL ES 2.0 */ - -/* ClearBufferMask */ -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_COLOR_BUFFER_BIT 0x00004000 - -/* Boolean */ -#define GL_FALSE 0 -#define GL_TRUE 1 - -/* BeginMode */ -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 - -/* BlendingFactorDest */ -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 - -/* BlendingFactorSrc */ -/* GL_ZERO */ -/* GL_ONE */ -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -/* GL_SRC_ALPHA */ -/* GL_ONE_MINUS_SRC_ALPHA */ -/* GL_DST_ALPHA */ -/* GL_ONE_MINUS_DST_ALPHA */ - -/* BlendEquationSeparate */ -#define GL_FUNC_ADD 0x8006 -#define GL_BLEND_EQUATION 0x8009 -#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */ -#define GL_BLEND_EQUATION_ALPHA 0x883D - -/* BlendSubtract */ -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B - -/* Separate Blend Functions */ -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 - -/* Buffer Objects */ -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 - -#define GL_STREAM_DRAW 0x88E0 -#define GL_STATIC_DRAW 0x88E4 -#define GL_DYNAMIC_DRAW 0x88E8 - -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 - -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 - -/* CullFaceMode */ -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_FRONT_AND_BACK 0x0408 - -/* DepthFunction */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* EnableCap */ -#define GL_TEXTURE_2D 0x0DE1 -#define GL_CULL_FACE 0x0B44 -#define GL_BLEND 0x0BE2 -#define GL_DITHER 0x0BD0 -#define GL_STENCIL_TEST 0x0B90 -#define GL_DEPTH_TEST 0x0B71 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_COVERAGE 0x80A0 - -/* ErrorCode */ -#define GL_NO_ERROR 0 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_OPERATION 0x0502 -#define GL_OUT_OF_MEMORY 0x0505 - -/* FrontFaceDirection */ -#define GL_CW 0x0900 -#define GL_CCW 0x0901 - -/* GetPName */ -#define GL_LINE_WIDTH 0x0B21 -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#define GL_VIEWPORT 0x0BA2 -#define GL_SCISSOR_BOX 0x0C10 -/* GL_SCISSOR_TEST */ -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_ALPHA_BITS 0x0D55 -#define GL_DEPTH_BITS 0x0D56 -#define GL_STENCIL_BITS 0x0D57 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -/* GL_POLYGON_OFFSET_FILL */ -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB - -/* GetTextureParameter */ -/* GL_TEXTURE_MAG_FILTER */ -/* GL_TEXTURE_MIN_FILTER */ -/* GL_TEXTURE_WRAP_S */ -/* GL_TEXTURE_WRAP_T */ - -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 - -/* HintMode */ -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 - -/* HintTarget */ -#define GL_GENERATE_MIPMAP_HINT 0x8192 - -/* DataType */ -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_FIXED 0x140C - -/* PixelFormat */ -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A - -/* PixelType */ -/* GL_UNSIGNED_BYTE */ -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 - -/* Shaders */ -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_SHADER_TYPE 0x8B4F -#define GL_DELETE_STATUS 0x8B80 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D - -/* StencilFunction */ -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 - -/* StencilOp */ -/* GL_ZERO */ -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -#define GL_INVERT 0x150A -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 - -/* StringName */ -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 - -/* TextureMagFilter */ -#define GL_NEAREST 0x2600 -#define GL_LINEAR 0x2601 - -/* TextureMinFilter */ -/* GL_NEAREST */ -/* GL_LINEAR */ -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 - -/* TextureParameterName */ -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 - -/* TextureTarget */ -/* GL_TEXTURE_2D */ -#define GL_TEXTURE 0x1702 - -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C - -/* TextureUnit */ -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 - -/* TextureWrapMode */ -#define GL_REPEAT 0x2901 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_MIRRORED_REPEAT 0x8370 - -/* Uniform Types */ -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_CUBE 0x8B60 - -/* Vertex Arrays */ -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F - -/* Read Format */ -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B - -/* Shader Source */ -#define GL_COMPILE_STATUS 0x8B81 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_SHADER_COMPILER 0x8DFA - -/* Shader Binary */ -#define GL_SHADER_BINARY_FORMATS 0x8DF8 -#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 - -/* Shader Precision-Specified Types */ -#define GL_LOW_FLOAT 0x8DF0 -#define GL_MEDIUM_FLOAT 0x8DF1 -#define GL_HIGH_FLOAT 0x8DF2 -#define GL_LOW_INT 0x8DF3 -#define GL_MEDIUM_INT 0x8DF4 -#define GL_HIGH_INT 0x8DF5 - -/* Framebuffer Object. */ -#define GL_FRAMEBUFFER 0x8D40 -#define GL_RENDERBUFFER 0x8D41 - -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGB565 0x8D62 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_STENCIL_INDEX8 0x8D48 - -#define GL_RENDERBUFFER_WIDTH 0x8D42 -#define GL_RENDERBUFFER_HEIGHT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 -#define GL_RENDERBUFFER_RED_SIZE 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 - -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 - -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_DEPTH_ATTACHMENT 0x8D00 -#define GL_STENCIL_ATTACHMENT 0x8D20 - -#define GL_NONE 0 - -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD - -#define GL_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_RENDERBUFFER_BINDING 0x8CA7 -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 - -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 - -/* OpenGL ES 3.0 */ - -#define GL_READ_BUFFER 0x0C02 -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#define GL_PACK_ROW_LENGTH 0x0D02 -#define GL_PACK_SKIP_ROWS 0x0D03 -#define GL_PACK_SKIP_PIXELS 0x0D04 -#define GL_COLOR 0x1800 -#define GL_DEPTH 0x1801 -#define GL_STENCIL 0x1802 -#define GL_RED 0x1903 -#define GL_RGB8 0x8051 -#define GL_RGBA8 0x8058 -#define GL_RGB10_A2 0x8059 -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_COMPARE_FUNC 0x884D -#define GL_CURRENT_QUERY 0x8865 -#define GL_QUERY_RESULT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE 0x8867 -#define GL_BUFFER_MAPPED 0x88BC -#define GL_BUFFER_MAP_POINTER 0x88BD -#define GL_STREAM_READ 0x88E1 -#define GL_STREAM_COPY 0x88E2 -#define GL_STATIC_READ 0x88E5 -#define GL_STATIC_COPY 0x88E6 -#define GL_DYNAMIC_READ 0x88E9 -#define GL_DYNAMIC_COPY 0x88EA -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A -#define GL_SRGB 0x8C40 -#define GL_SRGB8 0x8C41 -#define GL_SRGB8_ALPHA8 0x8C43 -#define GL_COMPARE_REF_TO_TEXTURE 0x884E -#define GL_MAJOR_VERSION 0x821B -#define GL_MINOR_VERSION 0x821C -#define GL_NUM_EXTENSIONS 0x821D -#define GL_RGBA32F 0x8814 -#define GL_RGB32F 0x8815 -#define GL_RGBA16F 0x881A -#define GL_RGB16F 0x881B -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD -#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF -#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 -#define GL_MAX_VARYING_COMPONENTS 0x8B4B -#define GL_TEXTURE_2D_ARRAY 0x8C1A -#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D -#define GL_R11F_G11F_B10F 0x8C3A -#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B -#define GL_RGB9_E5 0x8C3D -#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E -#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 -#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 -#define GL_RASTERIZER_DISCARD 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B -#define GL_INTERLEAVED_ATTRIBS 0x8C8C -#define GL_SEPARATE_ATTRIBS 0x8C8D -#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F -#define GL_RGBA32UI 0x8D70 -#define GL_RGB32UI 0x8D71 -#define GL_RGBA16UI 0x8D76 -#define GL_RGB16UI 0x8D77 -#define GL_RGBA8UI 0x8D7C -#define GL_RGB8UI 0x8D7D -#define GL_RGBA32I 0x8D82 -#define GL_RGB32I 0x8D83 -#define GL_RGBA16I 0x8D88 -#define GL_RGB16I 0x8D89 -#define GL_RGBA8I 0x8D8E -#define GL_RGB8I 0x8D8F -#define GL_RED_INTEGER 0x8D94 -#define GL_RGB_INTEGER 0x8D98 -#define GL_RGBA_INTEGER 0x8D99 -#define GL_SAMPLER_2D_ARRAY 0x8DC1 -#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 -#define GL_UNSIGNED_INT_VEC2 0x8DC6 -#define GL_UNSIGNED_INT_VEC3 0x8DC7 -#define GL_UNSIGNED_INT_VEC4 0x8DC8 -#define GL_INT_SAMPLER_2D 0x8DCA -#define GL_INT_SAMPLER_3D 0x8DCB -#define GL_INT_SAMPLER_CUBE 0x8DCC -#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF -#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 -#define GL_BUFFER_ACCESS_FLAGS 0x911F -#define GL_BUFFER_MAP_LENGTH 0x9120 -#define GL_BUFFER_MAP_OFFSET 0x9121 -#define GL_DEPTH_COMPONENT32F 0x8CAC -#define GL_DEPTH32F_STENCIL8 0x8CAD -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 -#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 -#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 -#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 -#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 -#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 -#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 -#define GL_FRAMEBUFFER_DEFAULT 0x8218 -#define GL_FRAMEBUFFER_UNDEFINED 0x8219 -#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A -#define GL_DEPTH_STENCIL 0x84F9 -#define GL_UNSIGNED_INT_24_8 0x84FA -#define GL_DEPTH24_STENCIL8 0x88F0 -#define GL_UNSIGNED_NORMALIZED 0x8C17 -#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING -#define GL_READ_FRAMEBUFFER 0x8CA8 -#define GL_DRAW_FRAMEBUFFER 0x8CA9 -#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA -#define GL_RENDERBUFFER_SAMPLES 0x8CAB -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 -#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF -#define GL_COLOR_ATTACHMENT1 0x8CE1 -#define GL_COLOR_ATTACHMENT2 0x8CE2 -#define GL_COLOR_ATTACHMENT3 0x8CE3 -#define GL_COLOR_ATTACHMENT4 0x8CE4 -#define GL_COLOR_ATTACHMENT5 0x8CE5 -#define GL_COLOR_ATTACHMENT6 0x8CE6 -#define GL_COLOR_ATTACHMENT7 0x8CE7 -#define GL_COLOR_ATTACHMENT8 0x8CE8 -#define GL_COLOR_ATTACHMENT9 0x8CE9 -#define GL_COLOR_ATTACHMENT10 0x8CEA -#define GL_COLOR_ATTACHMENT11 0x8CEB -#define GL_COLOR_ATTACHMENT12 0x8CEC -#define GL_COLOR_ATTACHMENT13 0x8CED -#define GL_COLOR_ATTACHMENT14 0x8CEE -#define GL_COLOR_ATTACHMENT15 0x8CEF -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 -#define GL_MAX_SAMPLES 0x8D57 -#define GL_HALF_FLOAT 0x140B -#define GL_MAP_READ_BIT 0x0001 -#define GL_MAP_WRITE_BIT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#define GL_RG 0x8227 -#define GL_RG_INTEGER 0x8228 -#define GL_R8 0x8229 -#define GL_RG8 0x822B -#define GL_R16F 0x822D -#define GL_R32F 0x822E -#define GL_RG16F 0x822F -#define GL_RG32F 0x8230 -#define GL_R8I 0x8231 -#define GL_R8UI 0x8232 -#define GL_R16I 0x8233 -#define GL_R16UI 0x8234 -#define GL_R32I 0x8235 -#define GL_R32UI 0x8236 -#define GL_RG8I 0x8237 -#define GL_RG8UI 0x8238 -#define GL_RG16I 0x8239 -#define GL_RG16UI 0x823A -#define GL_RG32I 0x823B -#define GL_RG32UI 0x823C -#define GL_VERTEX_ARRAY_BINDING 0x85B5 -#define GL_R8_SNORM 0x8F94 -#define GL_RG8_SNORM 0x8F95 -#define GL_RGB8_SNORM 0x8F96 -#define GL_RGBA8_SNORM 0x8F97 -#define GL_SIGNED_NORMALIZED 0x8F9C -#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 -#define GL_COPY_READ_BUFFER 0x8F36 -#define GL_COPY_WRITE_BUFFER 0x8F37 -#define GL_COPY_READ_BUFFER_BINDING GL_COPY_READ_BUFFER -#define GL_COPY_WRITE_BUFFER_BINDING GL_COPY_WRITE_BUFFER -#define GL_UNIFORM_BUFFER 0x8A11 -#define GL_UNIFORM_BUFFER_BINDING 0x8A28 -#define GL_UNIFORM_BUFFER_START 0x8A29 -#define GL_UNIFORM_BUFFER_SIZE 0x8A2A -#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B -#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D -#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E -#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F -#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 -#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 -#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 -#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 -#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 -#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 -#define GL_UNIFORM_TYPE 0x8A37 -#define GL_UNIFORM_SIZE 0x8A38 -#define GL_UNIFORM_NAME_LENGTH 0x8A39 -#define GL_UNIFORM_BLOCK_INDEX 0x8A3A -#define GL_UNIFORM_OFFSET 0x8A3B -#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C -#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D -#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E -#define GL_UNIFORM_BLOCK_BINDING 0x8A3F -#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 -#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 -#define GL_INVALID_INDEX 0xFFFFFFFFu -#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 -#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 -#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 -#define GL_OBJECT_TYPE 0x9112 -#define GL_SYNC_CONDITION 0x9113 -#define GL_SYNC_STATUS 0x9114 -#define GL_SYNC_FLAGS 0x9115 -#define GL_SYNC_FENCE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 -#define GL_UNSIGNALED 0x9118 -#define GL_SIGNALED 0x9119 -#define GL_ALREADY_SIGNALED 0x911A -#define GL_TIMEOUT_EXPIRED 0x911B -#define GL_CONDITION_SATISFIED 0x911C -#define GL_WAIT_FAILED 0x911D -#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 -#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE -#define GL_ANY_SAMPLES_PASSED 0x8C2F -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A -#define GL_SAMPLER_BINDING 0x8919 -#define GL_RGB10_A2UI 0x906F -#define GL_TEXTURE_SWIZZLE_R 0x8E42 -#define GL_TEXTURE_SWIZZLE_G 0x8E43 -#define GL_TEXTURE_SWIZZLE_B 0x8E44 -#define GL_TEXTURE_SWIZZLE_A 0x8E45 -#define GL_GREEN 0x1904 -#define GL_BLUE 0x1905 -#define GL_INT_2_10_10_10_REV 0x8D9F -#define GL_TRANSFORM_FEEDBACK 0x8E22 -#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 -#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 -#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 -#define GL_PROGRAM_BINARY_LENGTH 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE -#define GL_PROGRAM_BINARY_FORMATS 0x87FF -#define GL_COMPRESSED_R11_EAC 0x9270 -#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 -#define GL_COMPRESSED_RG11_EAC 0x9272 -#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 -#define GL_COMPRESSED_RGB8_ETC2 0x9274 -#define GL_COMPRESSED_SRGB8_ETC2 0x9275 -#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 -#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 -#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 -#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 -#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F -#define GL_MAX_ELEMENT_INDEX 0x8D6B -#define GL_NUM_SAMPLE_COUNTS 0x9380 -#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF - -/*------------------------------------------------------------------------- - * Entrypoint definitions - *-----------------------------------------------------------------------*/ - -/* OpenGL ES 2.0 */ - -GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); -GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name); -GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); -GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); -GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); -GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode); -GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); -GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); -GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); -GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); -GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); -GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); -GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat depth); -GL_APICALL void GL_APIENTRY glClearStencil (GLint s); -GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); -GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); -GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); -GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); -GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers); -GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers); -GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); -GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers); -GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); -GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures); -GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); -GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); -GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f); -GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glDisable (GLenum cap); -GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); -GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); -GL_APICALL void GL_APIENTRY glEnable (GLenum cap); -GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glFinish (void); -GL_APICALL void GL_APIENTRY glFlush (void); -GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); -GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); -GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); -GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers); -GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers); -GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); -GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); -GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); -GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); -GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); -GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); -GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL GLenum GL_APIENTRY glGetError (void); -GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); -GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); -GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); -GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); -GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); -GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); -GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); -GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); -GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); -GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); -GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); -GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); -GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); -GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); -GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); -GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); -GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); -GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); -GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); -GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); -GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); -GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); -GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); -GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length); -GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); -GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); -GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); -GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params); -GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params); -GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); -GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); -GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); -GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); -GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); -GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); -GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); -GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); -GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); -GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); - -/* OpenGL ES 3.0 */ - -GL_APICALL void GL_APIENTRY glReadBuffer (GLenum mode); -GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices); -GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glGenQueries (GLsizei n, GLuint* ids); -GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint* ids); -GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id); -GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id); -GL_APICALL void GL_APIENTRY glEndQuery (GLenum target); -GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint* params); -GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target); -GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, GLvoid** params); -GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum* bufs); -GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -GL_APICALL GLvoid* GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); -GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array); -GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint* arrays); -GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint* arrays); -GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array); -GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint* data); -GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode); -GL_APICALL void GL_APIENTRY glEndTransformFeedback (void); -GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); -GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode); -GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name); -GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer); -GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint* params); -GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); -GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint* v); -GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint* v); -GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint* params); -GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name); -GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0); -GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1); -GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); -GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint* value); -GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint* value); -GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint* value); -GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint* value); -GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint* value); -GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint* value); -GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat* value); -GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -GL_APICALL const GLubyte* GL_APIENTRY glGetStringi (GLenum name, GLuint index); -GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices); -GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params); -GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar* uniformBlockName); -GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName); -GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instanceCount); -GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount); -GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags); -GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync); -GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync); -GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64* params); -GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values); -GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64* data); -GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64* params); -GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint* samplers); -GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint* samplers); -GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler); -GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler); -GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint* param); -GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); -GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat* param); -GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); -GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id); -GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint* ids); -GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint* ids); -GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id); -GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void); -GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void); -GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary); -GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length); -GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); -GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum* attachments); -GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/winrt/include/GLES3/gl3ext.h b/platform/winrt/include/GLES3/gl3ext.h deleted file mode 100644 index 4d4ea96c4d..0000000000 --- a/platform/winrt/include/GLES3/gl3ext.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __gl3ext_h_ -#define __gl3ext_h_ - -/* $Revision: 17809 $ on $Date:: 2012-05-14 08:03:36 -0700 #$ */ - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -/* OpenGL ES 3 Extensions - * - * After an OES extension's interactions with OpenGl ES 3.0 have been documented, - * its tokens and function definitions should be added to this file in a manner - * that does not conflict with gl2ext.h or gl3.h. - * - * Tokens and function definitions for extensions that have become standard - * features in OpenGL ES 3.0 will not be added to this file. - * - * Applications using OpenGL-ES-2-only extensions should include gl2ext.h - */ - -#endif /* __gl3ext_h_ */ - diff --git a/platform/winrt/include/GLES3/gl3platform.h b/platform/winrt/include/GLES3/gl3platform.h deleted file mode 100644 index 1bd1a850fa..0000000000 --- a/platform/winrt/include/GLES3/gl3platform.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __gl3platform_h_ -#define __gl3platform_h_ - -/* $Revision: 18437 $ on $Date:: 2012-07-08 23:31:39 -0700 #$ */ - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -/* Platform-specific types and definitions for OpenGL ES 3.X gl3.h - * - * Adopters may modify khrplatform.h and this file to suit their platform. - * You are encouraged to submit all modifications to the Khronos group so that - * they can be included in future versions of this file. Please submit changes - * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) - * by filing a bug against product "OpenGL-ES" component "Registry". - */ - -#include <KHR/khrplatform.h> - -#ifndef GL_APICALL -#define GL_APICALL KHRONOS_APICALL -#endif - -#ifndef GL_APIENTRY -#define GL_APIENTRY KHRONOS_APIENTRY -#endif - -#endif /* __gl3platform_h_ */ diff --git a/platform/winrt/include/GLSLANG/ShaderLang.h b/platform/winrt/include/GLSLANG/ShaderLang.h deleted file mode 100644 index e486692482..0000000000 --- a/platform/winrt/include/GLSLANG/ShaderLang.h +++ /dev/null @@ -1,411 +0,0 @@ -// -// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -#ifndef _COMPILER_INTERFACE_INCLUDED_ -#define _COMPILER_INTERFACE_INCLUDED_ - -#if defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC) -#if defined(_WIN32) || defined(_WIN64) - -#if defined(ANGLE_TRANSLATOR_IMPLEMENTATION) -#define COMPILER_EXPORT __declspec(dllexport) -#else -#define COMPILER_EXPORT __declspec(dllimport) -#endif // defined(ANGLE_TRANSLATOR_IMPLEMENTATION) - -#else // defined(_WIN32) || defined(_WIN64) -#define COMPILER_EXPORT __attribute__((visibility("default"))) -#endif - -#else // defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC) -#define COMPILER_EXPORT -#endif - -#include <stddef.h> - -#include "KHR/khrplatform.h" - -#include <map> -#include <string> -#include <vector> - -// -// This is the platform independent interface between an OGL driver -// and the shading language compiler. -// - -namespace sh -{ -// GLenum alias -typedef unsigned int GLenum; -} - -// Must be included after GLenum proxy typedef -// Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h -#include "ShaderVars.h" - -// Version number for shader translation API. -// It is incremented every time the API changes. -#define ANGLE_SH_VERSION 132 - -typedef enum { - SH_GLES2_SPEC = 0x8B40, - SH_WEBGL_SPEC = 0x8B41, - - SH_GLES3_SPEC = 0x8B86, - SH_WEBGL2_SPEC = 0x8B87, - - // The CSS Shaders spec is a subset of the WebGL spec. - // - // In both CSS vertex and fragment shaders, ANGLE: - // (1) Reserves the "css_" prefix. - // (2) Renames the main function to css_main. - // (3) Disables the gl_MaxDrawBuffers built-in. - // - // In CSS fragment shaders, ANGLE: - // (1) Disables the gl_FragColor built-in. - // (2) Disables the gl_FragData built-in. - // (3) Enables the css_MixColor built-in. - // (4) Enables the css_ColorMatrix built-in. - // - // After passing a CSS shader through ANGLE, the browser is expected to append - // a new main function to it. - // This new main function will call the css_main function. - // It may also perform additional operations like varying assignment, texture - // access, and gl_FragColor assignment in order to implement the CSS Shaders - // blend modes. - // - SH_CSS_SHADERS_SPEC = 0x8B42 -} ShShaderSpec; - -typedef enum { - SH_ESSL_OUTPUT = 0x8B45, - SH_GLSL_OUTPUT = 0x8B46, - SH_HLSL_OUTPUT = 0x8B47, - SH_HLSL9_OUTPUT = 0x8B47, - SH_HLSL11_OUTPUT = 0x8B48 -} ShShaderOutput; - -// Compile options. -typedef enum { - SH_VALIDATE = 0, - SH_VALIDATE_LOOP_INDEXING = 0x0001, - SH_INTERMEDIATE_TREE = 0x0002, - SH_OBJECT_CODE = 0x0004, - SH_VARIABLES = 0x0008, - SH_LINE_DIRECTIVES = 0x0010, - SH_SOURCE_PATH = 0x0020, - SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0040, - // If a sampler array index happens to be a loop index, - // 1) if its type is integer, unroll the loop. - // 2) if its type is float, fail the shader compile. - // This is to work around a mac driver bug. - SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX = 0x0080, - - // This is needed only as a workaround for certain OpenGL driver bugs. - SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100, - - // This is an experimental flag to enforce restrictions that aim to prevent - // timing attacks. - // It generates compilation errors for shaders that could expose sensitive - // texture information via the timing channel. - // To use this flag, you must compile the shader under the WebGL spec - // (using the SH_WEBGL_SPEC flag). - SH_TIMING_RESTRICTIONS = 0x0200, - - // This flag prints the dependency graph that is used to enforce timing - // restrictions on fragment shaders. - // This flag only has an effect if all of the following are true: - // - The shader spec is SH_WEBGL_SPEC. - // - The compile options contain the SH_TIMING_RESTRICTIONS flag. - // - The shader type is GL_FRAGMENT_SHADER. - SH_DEPENDENCY_GRAPH = 0x0400, - - // Enforce the GLSL 1.017 Appendix A section 7 packing restrictions. - // This flag only enforces (and can only enforce) the packing - // restrictions for uniform variables in both vertex and fragment - // shaders. ShCheckVariablesWithinPackingLimits() lets embedders - // enforce the packing restrictions for varying variables during - // program link time. - SH_ENFORCE_PACKING_RESTRICTIONS = 0x0800, - - // This flag ensures all indirect (expression-based) array indexing - // is clamped to the bounds of the array. This ensures, for example, - // that you cannot read off the end of a uniform, whether an array - // vec234, or mat234 type. The ShArrayIndexClampingStrategy enum, - // specified in the ShBuiltInResources when constructing the - // compiler, selects the strategy for the clamping implementation. - SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x1000, - - // This flag limits the complexity of an expression. - SH_LIMIT_EXPRESSION_COMPLEXITY = 0x2000, - - // This flag limits the depth of the call stack. - SH_LIMIT_CALL_STACK_DEPTH = 0x4000, - - // This flag initializes gl_Position to vec4(0,0,0,0) at the - // beginning of the vertex shader's main(), and has no effect in the - // fragment shader. It is intended as a workaround for drivers which - // incorrectly fail to link programs if gl_Position is not written. - SH_INIT_GL_POSITION = 0x8000, - - // This flag replaces - // "a && b" with "a ? b : false", - // "a || b" with "a ? true : b". - // This is to work around a MacOSX driver bug that |b| is executed - // independent of |a|'s value. - SH_UNFOLD_SHORT_CIRCUIT = 0x10000, - - // This flag initializes varyings without static use in vertex shader - // at the beginning of main(), and has no effects in the fragment shader. - // It is intended as a workaround for drivers which incorrectly optimize - // out such varyings and cause a link failure. - SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x20000, - - // This flag scalarizes vec/ivec/bvec/mat constructor args. - // It is intended as a workaround for Linux/Mac driver bugs. - SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS = 0x40000, - - // This flag overwrites a struct name with a unique prefix. - // It is intended as a workaround for drivers that do not handle - // struct scopes correctly, including all Mac drivers and Linux AMD. - SH_REGENERATE_STRUCT_NAMES = 0x80000, -} ShCompileOptions; - -// Defines alternate strategies for implementing array index clamping. -typedef enum { - // Use the clamp intrinsic for array index clamping. - SH_CLAMP_WITH_CLAMP_INTRINSIC = 1, - - // Use a user-defined function for array index clamping. - SH_CLAMP_WITH_USER_DEFINED_INT_CLAMP_FUNCTION -} ShArrayIndexClampingStrategy; - -// -// Driver must call this first, once, before doing any other -// compiler operations. -// If the function succeeds, the return value is true, else false. -// -COMPILER_EXPORT bool ShInitialize(); -// -// Driver should call this at shutdown. -// If the function succeeds, the return value is true, else false. -// -COMPILER_EXPORT bool ShFinalize(); - -// The 64 bits hash function. The first parameter is the input string; the -// second parameter is the string length. -typedef khronos_uint64_t (*ShHashFunction64)(const char*, size_t); - -// -// Implementation dependent built-in resources (constants and extensions). -// The names for these resources has been obtained by stripping gl_/GL_. -// -typedef struct -{ - // Constants. - int MaxVertexAttribs; - int MaxVertexUniformVectors; - int MaxVaryingVectors; - int MaxVertexTextureImageUnits; - int MaxCombinedTextureImageUnits; - int MaxTextureImageUnits; - int MaxFragmentUniformVectors; - int MaxDrawBuffers; - - // Extensions. - // Set to 1 to enable the extension, else 0. - int OES_standard_derivatives; - int OES_EGL_image_external; - int ARB_texture_rectangle; - int EXT_draw_buffers; - int EXT_frag_depth; - int EXT_shader_texture_lod; - - // Set to 1 to enable replacing GL_EXT_draw_buffers #extension directives - // with GL_NV_draw_buffers in ESSL output. This flag can be used to emulate - // EXT_draw_buffers by using it in combination with GLES3.0 glDrawBuffers - // function. This applies to Tegra K1 devices. - int NV_draw_buffers; - - // Set to 1 if highp precision is supported in the fragment language. - // Default is 0. - int FragmentPrecisionHigh; - - // GLSL ES 3.0 constants. - int MaxVertexOutputVectors; - int MaxFragmentInputVectors; - int MinProgramTexelOffset; - int MaxProgramTexelOffset; - - // Name Hashing. - // Set a 64 bit hash function to enable user-defined name hashing. - // Default is NULL. - ShHashFunction64 HashFunction; - - // Selects a strategy to use when implementing array index clamping. - // Default is SH_CLAMP_WITH_CLAMP_INTRINSIC. - ShArrayIndexClampingStrategy ArrayIndexClampingStrategy; - - // The maximum complexity an expression can be. - int MaxExpressionComplexity; - - // The maximum depth a call stack can be. - int MaxCallStackDepth; -} ShBuiltInResources; - -// -// Initialize built-in resources with minimum expected values. -// Parameters: -// resources: The object to initialize. Will be comparable with memcmp. -// -COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources *resources); - -// -// ShHandle held by but opaque to the driver. It is allocated, -// managed, and de-allocated by the compiler. Its contents -// are defined by and used by the compiler. -// -// If handle creation fails, 0 will be returned. -// -typedef void *ShHandle; - -// -// Returns the a concatenated list of the items in ShBuiltInResources as a -// null-terminated string. -// This function must be updated whenever ShBuiltInResources is changed. -// Parameters: -// handle: Specifies the handle of the compiler to be used. -COMPILER_EXPORT const std::string &ShGetBuiltInResourcesString(const ShHandle handle); - -// -// Driver calls these to create and destroy compiler objects. -// -// Returns the handle of constructed compiler, null if the requested compiler is -// not supported. -// Parameters: -// type: Specifies the type of shader - GL_FRAGMENT_SHADER or GL_VERTEX_SHADER. -// spec: Specifies the language spec the compiler must conform to - -// SH_GLES2_SPEC or SH_WEBGL_SPEC. -// output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT, -// SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT. -// resources: Specifies the built-in resources. -COMPILER_EXPORT ShHandle ShConstructCompiler( - sh::GLenum type, - ShShaderSpec spec, - ShShaderOutput output, - const ShBuiltInResources *resources); -COMPILER_EXPORT void ShDestruct(ShHandle handle); - -// -// Compiles the given shader source. -// If the function succeeds, the return value is true, else false. -// Parameters: -// handle: Specifies the handle of compiler to be used. -// shaderStrings: Specifies an array of pointers to null-terminated strings -// containing the shader source code. -// numStrings: Specifies the number of elements in shaderStrings array. -// compileOptions: A mask containing the following parameters: -// SH_VALIDATE: Validates shader to ensure that it conforms to the spec -// specified during compiler construction. -// SH_VALIDATE_LOOP_INDEXING: Validates loop and indexing in the shader to -// ensure that they do not exceed the minimum -// functionality mandated in GLSL 1.0 spec, -// Appendix A, Section 4 and 5. -// There is no need to specify this parameter when -// compiling for WebGL - it is implied. -// SH_INTERMEDIATE_TREE: Writes intermediate tree to info log. -// Can be queried by calling ShGetInfoLog(). -// SH_OBJECT_CODE: Translates intermediate tree to glsl or hlsl shader. -// Can be queried by calling ShGetObjectCode(). -// SH_VARIABLES: Extracts attributes, uniforms, and varyings. -// Can be queried by calling ShGetVariableInfo(). -// -COMPILER_EXPORT bool ShCompile( - const ShHandle handle, - const char * const shaderStrings[], - size_t numStrings, - int compileOptions); - -// Return the version of the shader language. -COMPILER_EXPORT int ShGetShaderVersion(const ShHandle handle); - -// Return the currently set language output type. -COMPILER_EXPORT ShShaderOutput ShGetShaderOutputType( - const ShHandle handle); - -// Returns null-terminated information log for a compiled shader. -// Parameters: -// handle: Specifies the compiler -COMPILER_EXPORT const std::string &ShGetInfoLog(const ShHandle handle); - -// Returns null-terminated object code for a compiled shader. -// Parameters: -// handle: Specifies the compiler -COMPILER_EXPORT const std::string &ShGetObjectCode(const ShHandle handle); - -// Returns a (original_name, hash) map containing all the user defined -// names in the shader, including variable names, function names, struct -// names, and struct field names. -// Parameters: -// handle: Specifies the compiler -COMPILER_EXPORT const std::map<std::string, std::string> *ShGetNameHashingMap( - const ShHandle handle); - -// Shader variable inspection. -// Returns a pointer to a list of variables of the designated type. -// (See ShaderVars.h for type definitions, included above) -// Returns NULL on failure. -// Parameters: -// handle: Specifies the compiler -COMPILER_EXPORT const std::vector<sh::Uniform> *ShGetUniforms(const ShHandle handle); -COMPILER_EXPORT const std::vector<sh::Varying> *ShGetVaryings(const ShHandle handle); -COMPILER_EXPORT const std::vector<sh::Attribute> *ShGetAttributes(const ShHandle handle); -COMPILER_EXPORT const std::vector<sh::Attribute> *ShGetOutputVariables(const ShHandle handle); -COMPILER_EXPORT const std::vector<sh::InterfaceBlock> *ShGetInterfaceBlocks(const ShHandle handle); - -typedef struct -{ - sh::GLenum type; - int size; -} ShVariableInfo; - -// Returns true if the passed in variables pack in maxVectors following -// the packing rules from the GLSL 1.017 spec, Appendix A, section 7. -// Returns false otherwise. Also look at the SH_ENFORCE_PACKING_RESTRICTIONS -// flag above. -// Parameters: -// maxVectors: the available rows of registers. -// varInfoArray: an array of variable info (types and sizes). -// varInfoArraySize: the size of the variable array. -COMPILER_EXPORT bool ShCheckVariablesWithinPackingLimits( - int maxVectors, - ShVariableInfo *varInfoArray, - size_t varInfoArraySize); - -// Gives the compiler-assigned register for an interface block. -// The method writes the value to the output variable "indexOut". -// Returns true if it found a valid interface block, false otherwise. -// Parameters: -// handle: Specifies the compiler -// interfaceBlockName: Specifies the interface block -// indexOut: output variable that stores the assigned register -COMPILER_EXPORT bool ShGetInterfaceBlockRegister(const ShHandle handle, - const std::string &interfaceBlockName, - unsigned int *indexOut); - -// Gives the compiler-assigned register for uniforms in the default -// interface block. -// The method writes the value to the output variable "indexOut". -// Returns true if it found a valid default uniform, false otherwise. -// Parameters: -// handle: Specifies the compiler -// interfaceBlockName: Specifies the uniform -// indexOut: output variable that stores the assigned register -COMPILER_EXPORT bool ShGetUniformRegister(const ShHandle handle, - const std::string &uniformName, - unsigned int *indexOut); - -#endif // _COMPILER_INTERFACE_INCLUDED_ diff --git a/platform/winrt/include/GLSLANG/ShaderVars.h b/platform/winrt/include/GLSLANG/ShaderVars.h deleted file mode 100644 index da21c3e76e..0000000000 --- a/platform/winrt/include/GLSLANG/ShaderVars.h +++ /dev/null @@ -1,185 +0,0 @@ -// -// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// ShaderVars.h: -// Types to represent GL variables (varyings, uniforms, etc) -// - -#ifndef _COMPILER_INTERFACE_VARIABLES_ -#define _COMPILER_INTERFACE_VARIABLES_ - -#include <string> -#include <vector> -#include <algorithm> - -// Assume ShaderLang.h is included before ShaderVars.h, for sh::GLenum -// Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h - -namespace sh -{ - -// Varying interpolation qualifier, see section 4.3.9 of the ESSL 3.00.4 spec -enum InterpolationType -{ - INTERPOLATION_SMOOTH, - INTERPOLATION_CENTROID, - INTERPOLATION_FLAT -}; - -// Uniform block layout qualifier, see section 4.3.8.3 of the ESSL 3.00.4 spec -enum BlockLayoutType -{ - BLOCKLAYOUT_STANDARD, - BLOCKLAYOUT_PACKED, - BLOCKLAYOUT_SHARED -}; - -// Base class for all variables defined in shaders, including Varyings, Uniforms, etc -// Note: we must override the copy constructor and assignment operator so we can -// work around excessive GCC binary bloating: -// See https://code.google.com/p/angleproject/issues/detail?id=697 -struct COMPILER_EXPORT ShaderVariable -{ - ShaderVariable(); - ShaderVariable(GLenum typeIn, unsigned int arraySizeIn); - ~ShaderVariable(); - ShaderVariable(const ShaderVariable &other); - ShaderVariable &operator=(const ShaderVariable &other); - - bool isArray() const { return arraySize > 0; } - unsigned int elementCount() const { return std::max(1u, arraySize); } - bool isStruct() const { return !fields.empty(); } - - // All of the shader's variables are described using nested data - // structures. This is needed in order to disambiguate similar looking - // types, such as two structs containing the same fields, but in - // different orders. "findInfoByMappedName" provides an easy query for - // users to dive into the data structure and fetch the unique variable - // instance corresponding to a dereferencing chain of the top-level - // variable. - // Given a mapped name like 'a[0].b.c[0]', return the ShaderVariable - // that defines 'c' in |leafVar|, and the original name 'A[0].B.C[0]' - // in |originalName|, based on the assumption that |this| defines 'a'. - // If no match is found, return false. - bool findInfoByMappedName(const std::string &mappedFullName, - const ShaderVariable **leafVar, - std::string* originalFullName) const; - - GLenum type; - GLenum precision; - std::string name; - std::string mappedName; - unsigned int arraySize; - bool staticUse; - std::vector<ShaderVariable> fields; - std::string structName; - - protected: - bool isSameVariableAtLinkTime(const ShaderVariable &other, - bool matchPrecision) const; - - bool operator==(const ShaderVariable &other) const; - bool operator!=(const ShaderVariable &other) const - { - return !operator==(other); - } -}; - -struct COMPILER_EXPORT Uniform : public ShaderVariable -{ - Uniform(); - ~Uniform(); - Uniform(const Uniform &other); - Uniform &operator=(const Uniform &other); - bool operator==(const Uniform &other) const; - bool operator!=(const Uniform &other) const - { - return !operator==(other); - } - - // Decide whether two uniforms are the same at shader link time, - // assuming one from vertex shader and the other from fragment shader. - // See GLSL ES Spec 3.00.3, sec 4.3.5. - bool isSameUniformAtLinkTime(const Uniform &other) const; -}; - -struct COMPILER_EXPORT Attribute : public ShaderVariable -{ - Attribute(); - ~Attribute(); - Attribute(const Attribute &other); - Attribute &operator=(const Attribute &other); - bool operator==(const Attribute &other) const; - bool operator!=(const Attribute &other) const - { - return !operator==(other); - } - - int location; -}; - -struct COMPILER_EXPORT InterfaceBlockField : public ShaderVariable -{ - InterfaceBlockField(); - ~InterfaceBlockField(); - InterfaceBlockField(const InterfaceBlockField &other); - InterfaceBlockField &operator=(const InterfaceBlockField &other); - bool operator==(const InterfaceBlockField &other) const; - bool operator!=(const InterfaceBlockField &other) const - { - return !operator==(other); - } - - // Decide whether two InterfaceBlock fields are the same at shader - // link time, assuming one from vertex shader and the other from - // fragment shader. - // See GLSL ES Spec 3.00.3, sec 4.3.7. - bool isSameInterfaceBlockFieldAtLinkTime( - const InterfaceBlockField &other) const; - - bool isRowMajorLayout; -}; - -struct COMPILER_EXPORT Varying : public ShaderVariable -{ - Varying(); - ~Varying(); - Varying(const Varying &otherg); - Varying &operator=(const Varying &other); - bool operator==(const Varying &other) const; - bool operator!=(const Varying &other) const - { - return !operator==(other); - } - - // Decide whether two varyings are the same at shader link time, - // assuming one from vertex shader and the other from fragment shader. - // See GLSL ES Spec 3.00.3, sec 4.3.9. - bool isSameVaryingAtLinkTime(const Varying &other) const; - - InterpolationType interpolation; - bool isInvariant; -}; - -struct COMPILER_EXPORT InterfaceBlock -{ - InterfaceBlock(); - ~InterfaceBlock(); - InterfaceBlock(const InterfaceBlock &other); - InterfaceBlock &operator=(const InterfaceBlock &other); - - std::string name; - std::string mappedName; - std::string instanceName; - unsigned int arraySize; - BlockLayoutType layout; - bool isRowMajorLayout; - bool staticUse; - std::vector<InterfaceBlockField> fields; -}; - -} - -#endif // _COMPILER_INTERFACE_VARIABLES_ diff --git a/platform/winrt/include/KHR/khrplatform.h b/platform/winrt/include/KHR/khrplatform.h deleted file mode 100644 index 43aac97a73..0000000000 --- a/platform/winrt/include/KHR/khrplatform.h +++ /dev/null @@ -1,282 +0,0 @@ -#ifndef __khrplatform_h_ -#define __khrplatform_h_ - -/* -** Copyright (c) 2008-2009 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -/* Khronos platform-specific types and definitions. - * - * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $ - * - * Adopters may modify this file to suit their platform. Adopters are - * encouraged to submit platform specific modifications to the Khronos - * group so that they can be included in future versions of this file. - * Please submit changes by sending them to the public Khronos Bugzilla - * (http://khronos.org/bugzilla) by filing a bug against product - * "Khronos (general)" component "Registry". - * - * A predefined template which fills in some of the bug fields can be - * reached using http://tinyurl.com/khrplatform-h-bugreport, but you - * must create a Bugzilla login first. - * - * - * See the Implementer's Guidelines for information about where this file - * should be located on your system and for more details of its use: - * http://www.khronos.org/registry/implementers_guide.pdf - * - * This file should be included as - * #include <KHR/khrplatform.h> - * by Khronos client API header files that use its types and defines. - * - * The types in khrplatform.h should only be used to define API-specific types. - * - * Types defined in khrplatform.h: - * khronos_int8_t signed 8 bit - * khronos_uint8_t unsigned 8 bit - * khronos_int16_t signed 16 bit - * khronos_uint16_t unsigned 16 bit - * khronos_int32_t signed 32 bit - * khronos_uint32_t unsigned 32 bit - * khronos_int64_t signed 64 bit - * khronos_uint64_t unsigned 64 bit - * khronos_intptr_t signed same number of bits as a pointer - * khronos_uintptr_t unsigned same number of bits as a pointer - * khronos_ssize_t signed size - * khronos_usize_t unsigned size - * khronos_float_t signed 32 bit floating point - * khronos_time_ns_t unsigned 64 bit time in nanoseconds - * khronos_utime_nanoseconds_t unsigned time interval or absolute time in - * nanoseconds - * khronos_stime_nanoseconds_t signed time interval in nanoseconds - * khronos_boolean_enum_t enumerated boolean type. This should - * only be used as a base type when a client API's boolean type is - * an enum. Client APIs which use an integer or other type for - * booleans cannot use this as the base type for their boolean. - * - * Tokens defined in khrplatform.h: - * - * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. - * - * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. - * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. - * - * Calling convention macros defined in this file: - * KHRONOS_APICALL - * KHRONOS_APIENTRY - * KHRONOS_APIATTRIBUTES - * - * These may be used in function prototypes as: - * - * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( - * int arg1, - * int arg2) KHRONOS_APIATTRIBUTES; - */ - -/*------------------------------------------------------------------------- - * Definition of KHRONOS_APICALL - *------------------------------------------------------------------------- - * This precedes the return type of the function in the function prototype. - */ -#if defined(_WIN32) && !defined(__SCITECH_SNAP__) -# define KHRONOS_APICALL __declspec(dllimport) -#elif defined (__SYMBIAN32__) -# define KHRONOS_APICALL IMPORT_C -#else -# define KHRONOS_APICALL -#endif - -/*------------------------------------------------------------------------- - * Definition of KHRONOS_APIENTRY - *------------------------------------------------------------------------- - * This follows the return type of the function and precedes the function - * name in the function prototype. - */ -#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) - /* Win32 but not WinCE */ -# define KHRONOS_APIENTRY __stdcall -#else -# define KHRONOS_APIENTRY -#endif - -/*------------------------------------------------------------------------- - * Definition of KHRONOS_APIATTRIBUTES - *------------------------------------------------------------------------- - * This follows the closing parenthesis of the function prototype arguments. - */ -#if defined (__ARMCC_2__) -#define KHRONOS_APIATTRIBUTES __softfp -#else -#define KHRONOS_APIATTRIBUTES -#endif - -/*------------------------------------------------------------------------- - * basic type definitions - *-----------------------------------------------------------------------*/ -#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) - - -/* - * Using <stdint.h> - */ -#include <stdint.h> -typedef int32_t khronos_int32_t; -typedef uint32_t khronos_uint32_t; -typedef int64_t khronos_int64_t; -typedef uint64_t khronos_uint64_t; -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#elif defined(__VMS ) || defined(__sgi) - -/* - * Using <inttypes.h> - */ -#include <inttypes.h> -typedef int32_t khronos_int32_t; -typedef uint32_t khronos_uint32_t; -typedef int64_t khronos_int64_t; -typedef uint64_t khronos_uint64_t; -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) - -/* - * Win32 - */ -typedef __int32 khronos_int32_t; -typedef unsigned __int32 khronos_uint32_t; -typedef __int64 khronos_int64_t; -typedef unsigned __int64 khronos_uint64_t; -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#elif defined(__sun__) || defined(__digital__) - -/* - * Sun or Digital - */ -typedef int khronos_int32_t; -typedef unsigned int khronos_uint32_t; -#if defined(__arch64__) || defined(_LP64) -typedef long int khronos_int64_t; -typedef unsigned long int khronos_uint64_t; -#else -typedef long long int khronos_int64_t; -typedef unsigned long long int khronos_uint64_t; -#endif /* __arch64__ */ -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#elif 0 - -/* - * Hypothetical platform with no float or int64 support - */ -typedef int khronos_int32_t; -typedef unsigned int khronos_uint32_t; -#define KHRONOS_SUPPORT_INT64 0 -#define KHRONOS_SUPPORT_FLOAT 0 - -#else - -/* - * Generic fallback - */ -#include <stdint.h> -typedef int32_t khronos_int32_t; -typedef uint32_t khronos_uint32_t; -typedef int64_t khronos_int64_t; -typedef uint64_t khronos_uint64_t; -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#endif - - -/* - * Types that are (so far) the same on all platforms - */ -typedef signed char khronos_int8_t; -typedef unsigned char khronos_uint8_t; -typedef signed short int khronos_int16_t; -typedef unsigned short int khronos_uint16_t; - -/* - * Types that differ between LLP64 and LP64 architectures - in LLP64, - * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears - * to be the only LLP64 architecture in current use. - */ -#ifdef _WIN64 -typedef signed long long int khronos_intptr_t; -typedef unsigned long long int khronos_uintptr_t; -typedef signed long long int khronos_ssize_t; -typedef unsigned long long int khronos_usize_t; -#else -typedef signed long int khronos_intptr_t; -typedef unsigned long int khronos_uintptr_t; -typedef signed long int khronos_ssize_t; -typedef unsigned long int khronos_usize_t; -#endif - -#if KHRONOS_SUPPORT_FLOAT -/* - * Float type - */ -typedef float khronos_float_t; -#endif - -#if KHRONOS_SUPPORT_INT64 -/* Time types - * - * These types can be used to represent a time interval in nanoseconds or - * an absolute Unadjusted System Time. Unadjusted System Time is the number - * of nanoseconds since some arbitrary system event (e.g. since the last - * time the system booted). The Unadjusted System Time is an unsigned - * 64 bit value that wraps back to 0 every 584 years. Time intervals - * may be either signed or unsigned. - */ -typedef khronos_uint64_t khronos_utime_nanoseconds_t; -typedef khronos_int64_t khronos_stime_nanoseconds_t; -#endif - -/* - * Dummy value used to pad enum types to 32 bits. - */ -#ifndef KHRONOS_MAX_ENUM -#define KHRONOS_MAX_ENUM 0x7FFFFFFF -#endif - -/* - * Enumerated boolean type - * - * Values other than zero should be considered to be true. Therefore - * comparisons should not be made against KHRONOS_TRUE. - */ -typedef enum { - KHRONOS_FALSE = 0, - KHRONOS_TRUE = 1, - KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM -} khronos_boolean_enum_t; - -#endif /* __khrplatform_h_ */ diff --git a/platform/winrt/include/LICENSE.ANGLE.txt b/platform/winrt/include/LICENSE.ANGLE.txt deleted file mode 100644 index bdacb32e36..0000000000 --- a/platform/winrt/include/LICENSE.ANGLE.txt +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2002-2013 The ANGLE Project Authors. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// Neither the name of TransGaming Inc., Google Inc., 3DLabs Inc. -// Ltd., nor the names of their contributors may be used to endorse -// or promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/platform/winrt/include/angle_gl.h b/platform/winrt/include/angle_gl.h deleted file mode 100644 index d093f75ee2..0000000000 --- a/platform/winrt/include/angle_gl.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// angle_gl.h: -// Includes all necessary GL headers and definitions for ANGLE. -// - -#ifndef ANGLE_GL_H_ -#define ANGLE_GL_H_ - -#include "GLES2/gl2.h" -#include "GLES2/gl2ext.h" -#include "GLES3/gl3.h" -#include "GLES3/gl3ext.h" - -// The following enum is used in ANGLE, but is from desktop GL -#ifndef GL_SAMPLER_2D_RECT_ARB -#define GL_SAMPLER_2D_RECT_ARB 0x8B63 -#endif - -#endif // ANGLE_GL_H_ diff --git a/platform/winrt/include/angle_windowsstore.h b/platform/winrt/include/angle_windowsstore.h deleted file mode 100644 index 53ec93e037..0000000000 --- a/platform/winrt/include/angle_windowsstore.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// angle_windowsstore.h: - -#ifndef ANGLE_WINDOWSSTORE_H_ -#define ANGLE_WINDOWSSTORE_H_ - -// The following properties can be set on the CoreApplication to support additional -// ANGLE configuration options. -// -// The Visual Studio sample templates provided with this version of ANGLE have examples -// of how to set these property values. - -// -// Property: EGLNativeWindowTypeProperty -// Type: IInspectable -// Description: Set this property to specify the window type to use for creating a surface. -// If this property is missing, surface creation will fail. -// -const wchar_t EGLNativeWindowTypeProperty[] = L"EGLNativeWindowTypeProperty"; - -// -// Property: EGLRenderSurfaceSizeProperty -// Type: Size -// Description: Set this property to specify a preferred size in pixels of the render surface. -// The render surface size width and height must be greater than 0. -// If this property is set, then the render surface size is fixed. -// If this property is missing, a default behavior will be provided. -// The default behavior uses the window size if a CoreWindow is specified or -// the size of the SwapChainPanel control if one is specified. -// -const wchar_t EGLRenderSurfaceSizeProperty[] = L"EGLRenderSurfaceSizeProperty"; - -#endif // ANGLE_WINDOWSSTORE_H_ diff --git a/platform/winrt/joystick_winrt.cpp b/platform/winrt/joystick_winrt.cpp new file mode 100644 index 0000000000..9f93c5a26b --- /dev/null +++ b/platform/winrt/joystick_winrt.cpp @@ -0,0 +1,147 @@ +/*************************************************************************/ +/* joystick.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "joystick_winrt.h" + +using namespace Windows::Gaming::Input; +using namespace Windows::Foundation; + +void JoystickWinrt::register_events() { + + Gamepad::GamepadAdded += + ref new EventHandler<Gamepad^>(this, &JoystickWinrt::OnGamepadAdded); + Gamepad::GamepadRemoved += + ref new EventHandler<Gamepad^>(this, &JoystickWinrt::OnGamepadRemoved); +} + +uint32_t JoystickWinrt::process_controllers(uint32_t p_last_id) { + + for (int i = 0; i < MAX_CONTROLLERS; i++) { + + if (!controllers[i].connected) break; + + switch (controllers[i].type) { + + case ControllerType::GAMEPAD_CONTROLLER: { + + GamepadReading reading = ((Gamepad^)controllers[i].controller_reference)->GetCurrentReading(); + + int button_mask = (int)GamepadButtons::Menu; + for (int j = 0; j < 14; j++) { + + p_last_id = input->joy_button(p_last_id, controllers[i].id, j,(int)reading.Buttons & button_mask); + button_mask *= 2; + } + + p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_0, axis_correct(reading.LeftThumbstickX)); + p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_1, axis_correct(reading.LeftThumbstickY, true)); + p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_2, axis_correct(reading.RightThumbstickX)); + p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_3, axis_correct(reading.RightThumbstickY, true)); + p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_4, axis_correct(reading.LeftTrigger, false, true)); + p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_5, axis_correct(reading.RightTrigger, false, true)); + + break; + } + } + } + + return p_last_id; +} + +JoystickWinrt::JoystickWinrt() { + + for (int i = 0; i < MAX_CONTROLLERS; i++) + controllers[i].id = i; +} + +JoystickWinrt::JoystickWinrt(InputDefault * p_input) { + + input = p_input; + + JoystickWinrt(); +} + +void JoystickWinrt::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) { + + short idx = -1; + + for (int i = 0; i < MAX_CONTROLLERS; i++) { + + if (!controllers[i].connected) { + idx = i; + break; + } + } + + ERR_FAIL_COND(idx == -1); + + controllers[idx].connected = true; + controllers[idx].controller_reference = value; + controllers[idx].id = idx; + controllers[idx].type = ControllerType::GAMEPAD_CONTROLLER; + + input->joy_connection_changed(controllers[idx].id, true, "Xbox Controller", "__WINRT_GAMEPAD__"); +} + +void JoystickWinrt::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) { + + short idx = -1; + + for (int i = 0; i < MAX_CONTROLLERS; i++) { + + if (controllers[i].controller_reference == value) { + idx = i; + break; + } + } + + ERR_FAIL_COND(idx == -1); + + for (int i = idx + 1; i < MAX_CONTROLLERS - 1; i++) { + + if (!controllers[i].connected) { + break; + } + + controllers[i - 1] = controllers[i]; + } + controllers[MAX_CONTROLLERS - 1] = ControllerDevice(); + + input->joy_connection_changed(idx, false, "Xbox Controller"); +} + +InputDefault::JoyAxis JoystickWinrt::axis_correct(double p_val, bool p_negate, bool p_trigger) const { + + InputDefault::JoyAxis jx; + + jx.min = p_trigger ? 0 : -1; + jx.value = (float)(p_negate ? -p_val : p_val); + + return jx; +} diff --git a/platform/winrt/joystick_winrt.h b/platform/winrt/joystick_winrt.h new file mode 100644 index 0000000000..17f9565708 --- /dev/null +++ b/platform/winrt/joystick_winrt.h @@ -0,0 +1,81 @@ +/*************************************************************************/ +/* joystick.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef JOYSTICK_WINRT_H +#define JOYSTICK_WINRT_H + +#include "main/input_default.h" + +ref class JoystickWinrt sealed { + +internal: + + void register_events(); + uint32_t process_controllers(uint32_t p_last_id); + + JoystickWinrt(); + JoystickWinrt(InputDefault* p_input); + +private: + + enum { + MAX_CONTROLLERS = 4, + }; + + enum ControllerType { + GAMEPAD_CONTROLLER, + ARCADE_STICK_CONTROLLER, + RACING_WHEEL_CONTROLLER, + }; + + struct ControllerDevice { + + Windows::Gaming::Input::IGameController^ controller_reference; + + int id; + bool connected; + ControllerType type; + + ControllerDevice() { + id = -1; + connected = false; + type = ControllerType::GAMEPAD_CONTROLLER; + } + }; + + ControllerDevice controllers[MAX_CONTROLLERS]; + + InputDefault* input; + + void OnGamepadAdded(Platform::Object^ sender, Windows::Gaming::Input::Gamepad^ value); + void OnGamepadRemoved(Platform::Object^ sender, Windows::Gaming::Input::Gamepad^ value); + + InputDefault::JoyAxis axis_correct(double p_val, bool p_negate = false, bool p_trigger = false) const; +}; + +#endif diff --git a/platform/winrt/os_winrt.cpp b/platform/winrt/os_winrt.cpp index f045f54bf6..0ce561f88a 100644 --- a/platform/winrt/os_winrt.cpp +++ b/platform/winrt/os_winrt.cpp @@ -32,7 +32,7 @@ #include "drivers/unix/memory_pool_static_malloc.h" #include "os/memory_pool_dynamic_static.h" #include "thread_winrt.h" -//#include "drivers/windows/semaphore_windows.h" +#include "drivers/windows/semaphore_windows.h" #include "drivers/windows/mutex_windows.h" #include "main/main.h" #include "drivers/windows/file_access_windows.h" @@ -47,15 +47,27 @@ #include "globals.h" #include "io/marshalls.h" +#include "platform/windows/packet_peer_udp_winsock.h" +#include "platform/windows/stream_peer_winsock.h" +#include "platform/windows/tcp_server_winsock.h" +#include "drivers/unix/ip_unix.h" + #include <wrl.h> +#include <ppltasks.h> using namespace Windows::ApplicationModel::Core; using namespace Windows::ApplicationModel::Activation; using namespace Windows::UI::Core; using namespace Windows::UI::Input; +using namespace Windows::UI::Popups; using namespace Windows::Foundation; using namespace Windows::Graphics::Display; using namespace Microsoft::WRL; +using namespace Windows::UI::ViewManagement; +using namespace Windows::Devices::Input; +using namespace Windows::Devices::Sensors; +using namespace Windows::ApplicationModel::DataTransfer; +using namespace concurrency; int OSWinrt::get_video_driver_count() const { @@ -72,6 +84,66 @@ OS::VideoMode OSWinrt::get_default_video_mode() const { return video_mode; } +Size2 OSWinrt::get_window_size() const { + Size2 size; + size.width = video_mode.width; + size.height = video_mode.height; + return size; +} + +void OSWinrt::set_window_size(const Size2 p_size) { + + Windows::Foundation::Size new_size; + new_size.Width = p_size.width; + new_size.Height = p_size.height; + + ApplicationView^ view = ApplicationView::GetForCurrentView(); + + if (view->TryResizeView(new_size)) { + + video_mode.width = p_size.width; + video_mode.height = p_size.height; + } +} + +void OSWinrt::set_window_fullscreen(bool p_enabled) { + + ApplicationView^ view = ApplicationView::GetForCurrentView(); + + video_mode.fullscreen = view->IsFullScreenMode; + + if (video_mode.fullscreen == p_enabled) + return; + + if (p_enabled) { + + video_mode.fullscreen = view->TryEnterFullScreenMode(); + + } else { + + view->ExitFullScreenMode(); + video_mode.fullscreen = false; + + } +} + +bool OSWinrt::is_window_fullscreen() const { + + return ApplicationView::GetForCurrentView()->IsFullScreenMode; +} + +void OSWinrt::set_keep_screen_on(bool p_enabled) { + + if (is_keep_screen_on() == p_enabled) return; + + if (p_enabled) + display_request->RequestActive(); + else + display_request->RequestRelease(); + + OS::set_keep_screen_on(p_enabled); +} + int OSWinrt::get_audio_driver_count() const { return AudioDriverManagerSW::get_driver_count(); @@ -94,7 +166,7 @@ void OSWinrt::initialize_core() { //RedirectIOToConsole(); ThreadWinrt::make_default(); - //SemaphoreWindows::make_default(); + SemaphoreWindows::make_default(); MutexWindows::make_default(); FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_RESOURCES); @@ -108,6 +180,10 @@ void OSWinrt::initialize_core() { //TCPServerWinsock::make_default(); //StreamPeerWinsock::make_default(); + TCPServerWinsock::make_default(); + StreamPeerWinsock::make_default(); + PacketPeerUDPWinsock::make_default(); + mempool_static = new MemoryPoolStaticMalloc; #if 1 mempool_dynamic = memnew( MemoryPoolDynamicStatic ); @@ -126,6 +202,8 @@ void OSWinrt::initialize_core() { ticks_start = 0; ticks_start = get_ticks_usec(); + IP_Unix::make_default(); + cursor_shape=CURSOR_ARROW; } @@ -154,9 +232,38 @@ void OSWinrt::initialize(const VideoMode& p_desired,int p_video_driver,int p_aud VideoMode vm; vm.width = gl_context->get_window_width(); vm.height = gl_context->get_window_height(); - vm.fullscreen = true; vm.resizable = false; + ApplicationView^ view = ApplicationView::GetForCurrentView(); + vm.fullscreen = view->IsFullScreenMode; + + view->SetDesiredBoundsMode(ApplicationViewBoundsMode::UseVisible); + view->PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize; + + if (p_desired.fullscreen != view->IsFullScreenMode) { + if (p_desired.fullscreen) { + + vm.fullscreen = view->TryEnterFullScreenMode(); + + } else { + + view->ExitFullScreenMode(); + vm.fullscreen = false; + } + } + + Windows::Foundation::Size desired; + desired.Width = p_desired.width; + desired.Height = p_desired.height; + + view->PreferredLaunchViewSize = desired; + + if (view->TryResizeView(desired)) { + + vm.width = view->VisibleBounds.Width; + vm.height = view->VisibleBounds.Height; + } + set_video_mode(vm); gl_context->make_current(); @@ -179,6 +286,9 @@ void OSWinrt::initialize(const VideoMode& p_desired,int p_video_driver,int p_aud input = memnew( InputDefault ); + joystick = ref new JoystickWinrt(input); + joystick->register_events(); + AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton(); if (AudioDriverManagerSW::get_driver(p_audio_driver)->init()!=OK) { @@ -196,96 +306,77 @@ void OSWinrt::initialize(const VideoMode& p_desired,int p_video_driver,int p_aud spatial_sound_2d_server = memnew( SpatialSound2DServerSW ); spatial_sound_2d_server->init(); + managed_object->update_clipboard(); - _ensure_data_dir(); -} - -void OSWinrt::set_clipboard(const String& p_text) { - - /* - if (!OpenClipboard(hWnd)) { - ERR_EXPLAIN("Unable to open clipboard."); - ERR_FAIL(); - }; - EmptyClipboard(); - - HGLOBAL mem = GlobalAlloc(GMEM_MOVEABLE, (p_text.length() + 1) * sizeof(CharType)); - if (mem == NULL) { - ERR_EXPLAIN("Unable to allocate memory for clipboard contents."); - ERR_FAIL(); - }; - LPWSTR lptstrCopy = (LPWSTR)GlobalLock(mem); - memcpy(lptstrCopy, p_text.c_str(), (p_text.length() + 1) * sizeof(CharType)); - //memset((lptstrCopy + p_text.length()), 0, sizeof(CharType)); - GlobalUnlock(mem); - - SetClipboardData(CF_UNICODETEXT, mem); - - // set the CF_TEXT version (not needed?) - CharString utf8 = p_text.utf8(); - mem = GlobalAlloc(GMEM_MOVEABLE, utf8.length() + 1); - if (mem == NULL) { - ERR_EXPLAIN("Unable to allocate memory for clipboard contents."); - ERR_FAIL(); - }; - LPTSTR ptr = (LPTSTR)GlobalLock(mem); - memcpy(ptr, utf8.get_data(), utf8.length()); - ptr[utf8.length()] = 0; - GlobalUnlock(mem); - - SetClipboardData(CF_TEXT, mem); - - CloseClipboard(); - */ -}; + Clipboard::ContentChanged += ref new EventHandler<Platform::Object^>(managed_object, &ManagedType::on_clipboard_changed); -String OSWinrt::get_clipboard() const { + accelerometer = Accelerometer::GetDefault(); + if (accelerometer != nullptr) { + // 60 FPS + accelerometer->ReportInterval = (1.0f / 60.0f) * 1000; + accelerometer->ReadingChanged += + ref new TypedEventHandler<Accelerometer^, AccelerometerReadingChangedEventArgs^> + (managed_object, &ManagedType::on_accelerometer_reading_changed); + } - /* - String ret; - if (!OpenClipboard(hWnd)) { - ERR_EXPLAIN("Unable to open clipboard."); - ERR_FAIL_V(""); - }; + magnetometer = Magnetometer::GetDefault(); + if (magnetometer != nullptr) { + // 60 FPS + magnetometer->ReportInterval = (1.0f / 60.0f) * 1000; + magnetometer->ReadingChanged += + ref new TypedEventHandler<Magnetometer^, MagnetometerReadingChangedEventArgs^> + (managed_object, &ManagedType::on_magnetometer_reading_changed); + } - if (IsClipboardFormatAvailable(CF_UNICODETEXT)) { + gyrometer = Gyrometer::GetDefault(); + if (gyrometer != nullptr) { + // 60 FPS + gyrometer->ReportInterval = (1.0f / 60.0f) * 1000; + gyrometer->ReadingChanged += + ref new TypedEventHandler<Gyrometer^, GyrometerReadingChangedEventArgs^> + (managed_object, &ManagedType::on_gyroscope_reading_changed); + } - HGLOBAL mem = GetClipboardData(CF_UNICODETEXT); - if (mem != NULL) { + _ensure_data_dir(); - LPWSTR ptr = (LPWSTR)GlobalLock(mem); - if (ptr != NULL) { + if (is_keep_screen_on()) + display_request->RequestActive(); - ret = String((CharType*)ptr); - GlobalUnlock(mem); - }; - }; + set_keep_screen_on(GLOBAL_DEF("display/keep_screen_on", true)); - } else if (IsClipboardFormatAvailable(CF_TEXT)) { +} - HGLOBAL mem = GetClipboardData(CF_UNICODETEXT); - if (mem != NULL) { +void OSWinrt::set_clipboard(const String& p_text) { - LPTSTR ptr = (LPTSTR)GlobalLock(mem); - if (ptr != NULL) { + DataPackage^ clip = ref new DataPackage(); + clip->RequestedOperation = DataPackageOperation::Copy; + clip->SetText(ref new Platform::String((const wchar_t*)p_text.c_str())); - ret.parse_utf8((const char*)ptr); - GlobalUnlock(mem); - }; - }; - }; + Clipboard::SetContent(clip); +}; - CloseClipboard(); +String OSWinrt::get_clipboard() const { - return ret; - */ - return ""; + if (managed_object->clipboard != nullptr) + return managed_object->clipboard->Data(); + else + return ""; }; void OSWinrt::input_event(InputEvent &p_event) { + p_event.ID = ++last_id; + input->parse_input_event(p_event); + + if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed && p_event.mouse_button.button_index>3) { + + //send release for mouse wheel + p_event.mouse_button.pressed = false; + p_event.ID = ++last_id; + input->parse_input_event(p_event); + } }; void OSWinrt::delete_main_loop() { @@ -339,6 +430,8 @@ void OSWinrt::finalize() { physics_2d_server->finish(); memdelete(physics_2d_server); + joystick = nullptr; + } void OSWinrt::finalize_core() { @@ -370,9 +463,6 @@ void OSWinrt::vprint(const char* p_format, va_list p_list, bool p_stderr) { else wprintf(L"%s",wbuf); -#ifdef STDOUT_FILE - //vwfprintf(stdo,p_format,p_list); -#endif free(wbuf); fflush(stdout); @@ -380,11 +470,101 @@ void OSWinrt::vprint(const char* p_format, va_list p_list, bool p_stderr) { void OSWinrt::alert(const String& p_alert,const String& p_title) { - print_line("ALERT: "+p_alert); + Platform::String^ alert = ref new Platform::String(p_alert.c_str()); + Platform::String^ title = ref new Platform::String(p_title.c_str()); + + MessageDialog^ msg = ref new MessageDialog(alert, title); + + UICommand^ close = ref new UICommand("Close", ref new UICommandInvokedHandler(managed_object, &OSWinrt::ManagedType::alert_close)); + msg->Commands->Append(close); + msg->DefaultCommandIndex = 0; + + managed_object->alert_close_handle = true; + + msg->ShowAsync(); +} + +void OSWinrt::ManagedType::alert_close(IUICommand^ command) { + + alert_close_handle = false; +} + +void OSWinrt::ManagedType::on_clipboard_changed(Platform::Object ^ sender, Platform::Object ^ ev) { + + update_clipboard(); +} + +void OSWinrt::ManagedType::update_clipboard() { + + DataPackageView^ data = Clipboard::GetContent(); + + if (data->Contains(StandardDataFormats::Text)) { + + create_task(data->GetTextAsync()).then( + [this](Platform::String^ clipboard_content) { + + this->clipboard = clipboard_content; + }); + } +} + +void OSWinrt::ManagedType::on_accelerometer_reading_changed(Accelerometer ^ sender, AccelerometerReadingChangedEventArgs ^ args) { + + AccelerometerReading^ reading = args->Reading; + + os->input->set_accelerometer(Vector3( + reading->AccelerationX, + reading->AccelerationY, + reading->AccelerationZ + )); +} + +void OSWinrt::ManagedType::on_magnetometer_reading_changed(Magnetometer ^ sender, MagnetometerReadingChangedEventArgs ^ args) { + + MagnetometerReading^ reading = args->Reading; + + os->input->set_magnetometer(Vector3( + reading->MagneticFieldX, + reading->MagneticFieldY, + reading->MagneticFieldZ + )); +} + +void OSWinrt::ManagedType::on_gyroscope_reading_changed(Gyrometer ^ sender, GyrometerReadingChangedEventArgs ^ args) { + + GyrometerReading^ reading = args->Reading; + + os->input->set_magnetometer(Vector3( + reading->AngularVelocityX, + reading->AngularVelocityY, + reading->AngularVelocityZ + )); } void OSWinrt::set_mouse_mode(MouseMode p_mode) { + if (p_mode == MouseMode::MOUSE_MODE_CAPTURED) { + + CoreWindow::GetForCurrentThread()->SetPointerCapture(); + + } else { + + CoreWindow::GetForCurrentThread()->ReleasePointerCapture(); + + } + + if (p_mode == MouseMode::MOUSE_MODE_CAPTURED || p_mode == MouseMode::MOUSE_MODE_HIDDEN) { + + CoreWindow::GetForCurrentThread()->PointerCursor = nullptr; + + } else { + + CoreWindow::GetForCurrentThread()->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0); + } + + mouse_mode = p_mode; + + SetEvent(mouse_mode_changed); } OSWinrt::MouseMode OSWinrt::get_mouse_mode() const{ @@ -482,7 +662,7 @@ OS::Time OSWinrt::get_time(bool utc) const { return time; } -OS::TimeZoneInfo OS_Windows::get_time_zone_info() const { +OS::TimeZoneInfo OSWinrt::get_time_zone_info() const { TIME_ZONE_INFORMATION info; bool daylight = false; if (GetTimeZoneInformation(&info) == TIME_ZONE_ID_DAYLIGHT) @@ -503,7 +683,7 @@ uint64_t OSWinrt::get_unix_time() const { FILETIME ft; SYSTEMTIME st; - GetSystemTime(&systemtime); + GetSystemTime(&st); SystemTimeToFileTime(&st, &ft); SYSTEMTIME ep; @@ -546,10 +726,79 @@ uint64_t OSWinrt::get_ticks_usec() const { void OSWinrt::process_events() { + last_id = joystick->process_controllers(last_id); + process_key_events(); +} + +void OSWinrt::process_key_events() +{ + + for (int i = 0; i < key_event_pos; i++) { + + KeyEvent &kev = key_event_buffer[i]; + InputEvent iev; + + iev.type = InputEvent::KEY; + iev.key.mod = kev.mod_state; + iev.key.echo = kev.echo; + iev.key.scancode = kev.scancode; + iev.key.unicode = kev.unicode; + iev.key.pressed = kev.pressed; + + input_event(iev); + + } + key_event_pos = 0; +} + +void OSWinrt::queue_key_event(KeyEvent & p_event) +{ + // This merges Char events with the previous Key event, so + // the unicode can be retrieved without sending duplicate events. + if (p_event.type == KeyEvent::MessageType::CHAR_EVENT_MESSAGE && key_event_pos > 0) { + + KeyEvent &old = key_event_buffer[key_event_pos - 1]; + ERR_FAIL_COND(old.type != KeyEvent::MessageType::KEY_EVENT_MESSAGE); + + key_event_buffer[key_event_pos - 1].unicode = p_event.unicode; + return; + } + + ERR_FAIL_COND(key_event_pos >= KEY_EVENT_BUFFER_SIZE); + + key_event_buffer[key_event_pos++] = p_event; } void OSWinrt::set_cursor_shape(CursorShape p_shape) { + ERR_FAIL_INDEX(p_shape, CURSOR_MAX); + + if (cursor_shape == p_shape) + return; + + static const CoreCursorType uwp_cursors[CURSOR_MAX] = { + CoreCursorType::Arrow, + CoreCursorType::IBeam, + CoreCursorType::Hand, + CoreCursorType::Cross, + CoreCursorType::Wait, + CoreCursorType::Wait, + CoreCursorType::Arrow, + CoreCursorType::Arrow, + CoreCursorType::UniversalNo, + CoreCursorType::SizeNorthSouth, + CoreCursorType::SizeWestEast, + CoreCursorType::SizeNortheastSouthwest, + CoreCursorType::SizeNorthwestSoutheast, + CoreCursorType::SizeAll, + CoreCursorType::SizeNorthSouth, + CoreCursorType::SizeWestEast, + CoreCursorType::Help + }; + + CoreWindow::GetForCurrentThread()->PointerCursor = ref new CoreCursor(uwp_cursors[p_shape], 0); + + cursor_shape = p_shape; } Error OSWinrt::execute(const String& p_path, const List<String>& p_arguments,bool p_blocking,ProcessID *r_child_id,String* r_pipe,int *r_exitcode) { @@ -609,7 +858,7 @@ String OSWinrt::get_locale() const { return "en"; #else Platform::String ^language = Windows::Globalization::Language::CurrentInputMethodLanguageTag; - return language->Data(); + return String(language->Data()).replace("-", "_"); #endif } @@ -628,6 +877,29 @@ void OSWinrt::swap_buffers() { gl_context->swap_buffers(); } +bool OSWinrt::has_touchscreen_ui_hint() const { + + TouchCapabilities^ tc = ref new TouchCapabilities(); + return tc->TouchPresent != 0 || UIViewSettings::GetForCurrentView()->UserInteractionMode == UserInteractionMode::Touch; +} + +bool OSWinrt::has_virtual_keyboard() const { + + return UIViewSettings::GetForCurrentView()->UserInteractionMode == UserInteractionMode::Touch; +} + +void OSWinrt::show_virtual_keyboard(const String & p_existing_text, const Rect2 & p_screen_rect) { + + InputPane^ pane = InputPane::GetForCurrentView(); + pane->TryShow(); +} + +void OSWinrt::hide_virtual_keyboard() { + + InputPane^ pane = InputPane::GetForCurrentView(); + pane->TryHide(); +} + void OSWinrt::run() { @@ -644,6 +916,7 @@ void OSWinrt::run() { while (!force_quit) { CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); + if (managed_object->alert_close_handle) continue; process_events(); // get rid of pending events if (Main::iteration()==true) break; @@ -665,7 +938,7 @@ String OSWinrt::get_data_dir() const { Windows::Storage::StorageFolder ^data_folder = Windows::Storage::ApplicationData::Current->LocalFolder; - return data_folder->Path->Data(); + return String(data_folder->Path->Data()).replace("\\", "/"); } @@ -690,6 +963,13 @@ OSWinrt::OSWinrt() { gl_context = NULL; + display_request = ref new Windows::System::Display::DisplayRequest(); + + managed_object = ref new ManagedType; + managed_object->os = this; + + mouse_mode_changed = CreateEvent(NULL, TRUE, FALSE, L"os_mouse_mode_changed"); + AudioDriverManagerSW::add_driver(&audio_driver); } diff --git a/platform/winrt/os_winrt.h b/platform/winrt/os_winrt.h index 145ccf0f7a..1816e0cec7 100644 --- a/platform/winrt/os_winrt.h +++ b/platform/winrt/os_winrt.h @@ -40,10 +40,13 @@ #include "servers/spatial_sound/spatial_sound_server_sw.h" #include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h" #include "servers/physics_2d/physics_2d_server_sw.h" -#include "servers/audio/audio_driver_dummy.h" +#include "audio_driver_winrt.h" #include "gl_context_egl.h" +#include "core/math/math_2d.h" +#include "core/ustring.h" + #include <windows.h> #include <io.h> @@ -52,11 +55,35 @@ #include <stdio.h> #include "main/input_default.h" +#include "joystick_winrt.h" + /** @author Juan Linietsky <reduzio@gmail.com> */ class OSWinrt : public OS { +public: + + struct KeyEvent { + + enum MessageType + { + KEY_EVENT_MESSAGE, + CHAR_EVENT_MESSAGE + }; + + InputModifierState mod_state; + MessageType type; + bool pressed; + unsigned int scancode; + unsigned int unicode; + bool echo; + CorePhysicalKeyStatus status; + + }; + +private: + enum { JOYSTICKS_MAX = 8, JOY_AXIS_COUNT = 6, @@ -66,16 +93,6 @@ class OSWinrt : public OS { FILE *stdo; - - struct KeyEvent { - - InputModifierState mod_state; - UINT uMsg; - WPARAM wParam; - LPARAM lParam; - - }; - KeyEvent key_event_buffer[KEY_EVENT_BUFFER_SIZE]; int key_event_pos; @@ -97,37 +114,11 @@ class OSWinrt : public OS { ContextEGL* gl_context; - struct Joystick { - - int id; - bool attached; - - DWORD last_axis[JOY_AXIS_COUNT]; - DWORD last_buttons; - DWORD last_pov; - String name; - - Joystick() { - id = -1; - attached = false; - for (int i=0; i<JOY_AXIS_COUNT; i++) { - - last_axis[i] = 0; - }; - last_buttons = 0; - last_pov = 0; - }; - }; - - List<Joystick> joystick_change_queue; - int joystick_count; - Joystick joysticks[JOYSTICKS_MAX]; - VideoMode video_mode; MainLoop *main_loop; - AudioDriverDummy audio_driver; + AudioDriverWinRT audio_driver; AudioServerSW *audio_server; SampleManagerMallocSW *sample_manager; SpatialSoundServerSW *spatial_sound_server; @@ -146,11 +137,34 @@ class OSWinrt : public OS { InputDefault *input; + JoystickWinrt^ joystick; + + Windows::System::Display::DisplayRequest^ display_request; + void _post_dpad(DWORD p_dpad, int p_device, bool p_pressed); void _drag_event(int idx,UINT uMsg, WPARAM wParam, LPARAM lParam); void _touch_event(int idx, UINT uMsg, WPARAM wParam, LPARAM lParam); + ref class ManagedType { + public: + property bool alert_close_handle; + property Platform::String^ clipboard; + void alert_close(Windows::UI::Popups::IUICommand^ command); + void on_clipboard_changed(Platform::Object^ sender, Platform::Object^ ev); + void update_clipboard(); + void on_accelerometer_reading_changed(Windows::Devices::Sensors::Accelerometer^ sender, Windows::Devices::Sensors::AccelerometerReadingChangedEventArgs^ args); + void on_magnetometer_reading_changed(Windows::Devices::Sensors::Magnetometer^ sender, Windows::Devices::Sensors::MagnetometerReadingChangedEventArgs^ args); + void on_gyroscope_reading_changed(Windows::Devices::Sensors::Gyrometer^ sender, Windows::Devices::Sensors::GyrometerReadingChangedEventArgs^ args); + + internal: + ManagedType() { alert_close_handle = false; } + property OSWinrt* os; + }; + ManagedType^ managed_object; + Windows::Devices::Sensors::Accelerometer^ accelerometer; + Windows::Devices::Sensors::Magnetometer^ magnetometer; + Windows::Devices::Sensors::Gyrometer^ gyrometer; // functions used by main to initialize/deintialize the OS protected: @@ -173,12 +187,13 @@ protected: void process_events(); - void probe_joysticks(); - void process_joysticks(); void process_key_events(); public: + // Event to send to the app wrapper + HANDLE mouse_mode_changed; + void print_error(const char* p_function,const char* p_file,int p_line,const char *p_code,const char*p_rationale,ErrorType p_type); virtual void vprint(const char *p_format, va_list p_list, bool p_stderr=false); @@ -195,6 +210,11 @@ public: virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0); virtual VideoMode get_video_mode(int p_screen=0) const; virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const; + virtual Size2 get_window_size() const; + virtual void set_window_size(const Size2 p_size); + virtual void set_window_fullscreen(bool p_enabled); + virtual bool is_window_fullscreen() const; + virtual void set_keep_screen_on(bool p_enabled); virtual MainLoop *get_main_loop() const; @@ -237,7 +257,11 @@ public: virtual void make_rendering_thread(); virtual void swap_buffers(); - virtual bool has_touchscreen_ui_hint() const { return true; }; + virtual bool has_touchscreen_ui_hint() const; + + virtual bool has_virtual_keyboard() const; + virtual void show_virtual_keyboard(const String& p_existing_text, const Rect2& p_screen_rect = Rect2()); + virtual void hide_virtual_keyboard(); virtual Error shell_open(String p_uri); @@ -247,6 +271,8 @@ public: void input_event(InputEvent &p_event); + void queue_key_event(KeyEvent &p_event); + OSWinrt(); ~OSWinrt(); diff --git a/platform/winrt/thread_winrt.cpp b/platform/winrt/thread_winrt.cpp index e7028bd9dc..8e3e0d5bef 100644 --- a/platform/winrt/thread_winrt.cpp +++ b/platform/winrt/thread_winrt.cpp @@ -59,7 +59,9 @@ Thread::ID ThreadWinrt::get_ID() const { }; void ThreadWinrt::make_default() { - + create_func = create_func_winrt; + get_thread_ID_func = get_thread_ID_func_winrt; + wait_to_finish_func = wait_to_finish_func_winrt; }; ThreadWinrt::ThreadWinrt() { diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 356de7b2bc..ba232f6d4e 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -155,7 +155,7 @@ def configure(env): if os.system("pkg-config --exists alsa")==0: print("Enabling ALSA") env.Append(CPPFLAGS=["-DALSA_ENABLED"]) - env.Append(LIBS=['asound']) + env.ParseConfig('pkg-config alsa --cflags --libs') else: print("ALSA libraries not found, disabling driver") diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 9a2d610e78..5f1ab5b4aa 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1176,6 +1176,19 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { event.key.mod.shift=true; } + //don't set mod state if modifier keys are released by themselves + //else event.is_action() will not work correctly here + if (!event.key.pressed) { + if (event.key.scancode == KEY_SHIFT) + event.key.mod.shift = false; + else if (event.key.scancode == KEY_CONTROL) + event.key.mod.control = false; + else if (event.key.scancode == KEY_ALT) + event.key.mod.alt = false; + else if (event.key.scancode == KEY_META) + event.key.mod.meta = false; + } + //printf("key: %x\n",event.key.scancode); input->parse_input_event( event); } diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index 71728966fd..e8954b7e98 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -650,8 +650,8 @@ void Area2D::_bind_methods() { ADD_SIGNAL( MethodInfo("body_enter",PropertyInfo(Variant::OBJECT,"body",PROPERTY_HINT_RESOURCE_TYPE,"PhysicsBody2D"))); ADD_SIGNAL( MethodInfo("body_exit",PropertyInfo(Variant::OBJECT,"body",PROPERTY_HINT_RESOURCE_TYPE,"PhysicsBody2D"))); - ADD_SIGNAL( MethodInfo("area_enter_shape",PropertyInfo(Variant::INT,"area_id"),PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area2D"),PropertyInfo(Variant::INT,"area_shape"),PropertyInfo(Variant::INT,"area_shape"))); - ADD_SIGNAL( MethodInfo("area_exit_shape",PropertyInfo(Variant::INT,"area_id"),PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area2D"),PropertyInfo(Variant::INT,"area_shape"),PropertyInfo(Variant::INT,"area_shape"))); + ADD_SIGNAL( MethodInfo("area_enter_shape",PropertyInfo(Variant::INT,"area_id"),PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area2D"),PropertyInfo(Variant::INT,"area_shape"),PropertyInfo(Variant::INT,"self_shape"))); + ADD_SIGNAL( MethodInfo("area_exit_shape",PropertyInfo(Variant::INT,"area_id"),PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area2D"),PropertyInfo(Variant::INT,"area_shape"),PropertyInfo(Variant::INT,"self_shape"))); ADD_SIGNAL( MethodInfo("area_enter",PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area2D"))); ADD_SIGNAL( MethodInfo("area_exit",PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area2D"))); diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index e576aa10e0..f33faaabd8 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -44,6 +44,9 @@ void Camera2D::_update_scroll() { } if (current) { + + ERR_FAIL_COND( custom_viewport && !ObjectDB::get_instance(custom_viewport_id) ); + Matrix32 xform = get_camera_transform(); if (viewport) { @@ -73,8 +76,9 @@ Matrix32 Camera2D::get_camera_transform() { if (!get_tree()) return Matrix32(); - Size2 screen_size = get_viewport_rect().size; - screen_size=get_viewport_rect().size; + ERR_FAIL_COND_V( custom_viewport && !ObjectDB::get_instance(custom_viewport_id), Matrix32() ); + + Size2 screen_size = viewport->get_visible_rect().size; Point2 new_camera_pos = get_global_transform().get_origin(); @@ -240,14 +244,10 @@ void Camera2D::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - viewport = NULL; - Node *n=this; - while(n){ - - viewport = n->cast_to<Viewport>(); - if (viewport) - break; - n=n->get_parent(); + if (custom_viewport && ObjectDB::get_instance(custom_viewport_id)) { + viewport=custom_viewport; + } else { + viewport=get_viewport(); } canvas = get_canvas(); @@ -270,8 +270,8 @@ void Camera2D::_notification(int p_what) { } break; case NOTIFICATION_EXIT_TREE: { - if (is_current()) { - if (viewport) { + if (is_current()) { + if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) { viewport->set_canvas_transform( Matrix32() ); } } @@ -447,8 +447,10 @@ void Camera2D::reset_smoothing() { void Camera2D::align() { - Size2 screen_size = get_viewport_rect().size; - screen_size=get_viewport_rect().size; + ERR_FAIL_COND( custom_viewport && !ObjectDB::get_instance(custom_viewport_id) ); + + Size2 screen_size = viewport->get_visible_rect().size; + Point2 current_camera_pos = get_global_transform().get_origin(); if (anchor_mode==ANCHOR_MODE_DRAG_CENTER) { if (h_ofs<0) { @@ -549,6 +551,42 @@ bool Camera2D::is_follow_smoothing_enabled() const { return smoothing_enabled; } +void Camera2D::set_custom_viewport(Node *p_viewport) { + ERR_FAIL_NULL(p_viewport); + if (is_inside_tree()) { + remove_from_group(group_name); + remove_from_group(canvas_group_name); + } + + custom_viewport=p_viewport->cast_to<Viewport>(); + + if (custom_viewport) { + custom_viewport_id=custom_viewport->get_instance_ID(); + } else { + custom_viewport_id=0; + } + + if (is_inside_tree()) { + + if (custom_viewport) + viewport=custom_viewport; + else + viewport=get_viewport(); + + RID vp = viewport->get_viewport(); + group_name = "__cameras_"+itos(vp.get_id()); + canvas_group_name ="__cameras_c"+itos(canvas.get_id()); + add_to_group(group_name); + add_to_group(canvas_group_name); + } + +} + +Node* Camera2D::get_custom_viewport() const { + + return custom_viewport; +} + void Camera2D::_bind_methods() { @@ -597,6 +635,8 @@ void Camera2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_zoom","zoom"),&Camera2D::set_zoom); ObjectTypeDB::bind_method(_MD("get_zoom"),&Camera2D::get_zoom); + ObjectTypeDB::bind_method(_MD("set_custom_viewport","viewport:Viewport"),&Camera2D::set_custom_viewport); + ObjectTypeDB::bind_method(_MD("get_custom_viewport:Viewport"),&Camera2D::get_custom_viewport); ObjectTypeDB::bind_method(_MD("set_follow_smoothing","follow_smoothing"),&Camera2D::set_follow_smoothing); ObjectTypeDB::bind_method(_MD("get_follow_smoothing"),&Camera2D::get_follow_smoothing); @@ -662,6 +702,8 @@ Camera2D::Camera2D() { first=true; smoothing_enabled=false; limit_smoothing_enabled=false; + custom_viewport=NULL; + custom_viewport_id=0; smoothing=5.0; zoom = Vector2(1, 1); diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h index 9f3e4254bb..a4d6dc5b96 100644 --- a/scene/2d/camera_2d.h +++ b/scene/2d/camera_2d.h @@ -48,6 +48,8 @@ protected: Point2 smoothed_camera_pos; bool first; + ObjectID custom_viewport_id; // to check validity + Viewport *custom_viewport; Viewport *viewport; StringName group_name; @@ -128,6 +130,9 @@ public: Point2 get_camera_screen_center() const; + void set_custom_viewport(Node *p_viewport); + Node* get_custom_viewport() const; + Vector2 get_camera_pos() const; void force_update_scroll(); void reset_smoothing(); diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index df43e8e373..b3f925cb14 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -253,7 +253,7 @@ void Node2D::global_translate(const Vector2& p_amount) { set_global_pos( get_global_pos() + p_amount ); } -void Node2D::scale(const Vector2& p_amount) { +void Node2D::scale(const Size2& p_amount) { set_scale( get_scale() * p_amount ); } diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index aa8d0ef33c..b31ee08af6 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -79,7 +79,7 @@ public: void move_y(float p_delta,bool p_scaled=false); void translate(const Vector2& p_amount); void global_translate(const Vector2& p_amount); - void scale(const Vector2& p_amount); + void scale(const Size2& p_amount); Point2 get_pos() const; float get_rot() const; @@ -110,8 +110,6 @@ public: Matrix32 get_relative_transform_to_parent(const Node *p_parent) const; - - Matrix32 get_transform() const; Node2D(); diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index cfb87fb998..12893524d1 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -288,12 +288,12 @@ float Polygon2D::_get_texture_rotationd() const{ } -void Polygon2D::set_texture_scale(const Vector2& p_scale){ +void Polygon2D::set_texture_scale(const Size2& p_scale){ tex_scale=p_scale; update(); } -Vector2 Polygon2D::get_texture_scale() const{ +Size2 Polygon2D::get_texture_scale() const{ return tex_scale; } diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h index 04e8aeb6fd..cecb9081f7 100644 --- a/scene/2d/polygon_2d.h +++ b/scene/2d/polygon_2d.h @@ -40,7 +40,7 @@ class Polygon2D : public Node2D { DVector<Color> vertex_colors; Color color; Ref<Texture> texture; - Vector2 tex_scale; + Size2 tex_scale; Vector2 tex_ofs; bool tex_tile; float tex_rot; @@ -81,8 +81,8 @@ public: void set_texture_rotation(float p_rot); float get_texture_rotation() const; - void set_texture_scale(const Vector2& p_scale); - Vector2 get_texture_scale() const; + void set_texture_scale(const Size2& p_scale); + Size2 get_texture_scale() const; void set_invert(bool p_rot); bool get_invert() const; diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index a8a4122016..c1d0d1a97c 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -640,8 +640,8 @@ void Area::_bind_methods() { ADD_SIGNAL( MethodInfo("body_enter",PropertyInfo(Variant::OBJECT,"body"))); ADD_SIGNAL( MethodInfo("body_exit",PropertyInfo(Variant::OBJECT,"body"))); - ADD_SIGNAL( MethodInfo("area_enter_shape",PropertyInfo(Variant::INT,"area_id"),PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area"),PropertyInfo(Variant::INT,"area_shape"),PropertyInfo(Variant::INT,"area_shape"))); - ADD_SIGNAL( MethodInfo("area_exit_shape",PropertyInfo(Variant::INT,"area_id"),PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area"),PropertyInfo(Variant::INT,"area_shape"),PropertyInfo(Variant::INT,"area_shape"))); + ADD_SIGNAL( MethodInfo("area_enter_shape",PropertyInfo(Variant::INT,"area_id"),PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area"),PropertyInfo(Variant::INT,"area_shape"),PropertyInfo(Variant::INT,"self_shape"))); + ADD_SIGNAL( MethodInfo("area_exit_shape",PropertyInfo(Variant::INT,"area_id"),PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area"),PropertyInfo(Variant::INT,"area_shape"),PropertyInfo(Variant::INT,"self_shape"))); ADD_SIGNAL( MethodInfo("area_enter",PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area"))); ADD_SIGNAL( MethodInfo("area_exit",PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area"))); diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp index e83fa69b4f..99c7fd047f 100644 --- a/scene/3d/immediate_geometry.cpp +++ b/scene/3d/immediate_geometry.cpp @@ -72,6 +72,7 @@ void ImmediateGeometry::add_vertex(const Vector3& p_vertex){ if (empty) { aabb.pos=p_vertex; aabb.size=Vector3(); + empty=false; } else { aabb.expand_to(p_vertex); } @@ -102,7 +103,7 @@ DVector<Face3> ImmediateGeometry::get_faces(uint32_t p_usage_flags) const { -void ImmediateGeometry::add_sphere(int p_lats,int p_lons,float p_radius) { +void ImmediateGeometry::add_sphere(int p_lats, int p_lons, float p_radius, bool p_add_uv) { for(int i = 1; i <= p_lats; i++) { double lat0 = Math_PI * (-0.5 + (double) (i - 1) / p_lats); @@ -132,6 +133,10 @@ void ImmediateGeometry::add_sphere(int p_lats,int p_lons,float p_radius) { }; #define ADD_POINT(m_idx)\ + if (p_add_uv) {\ + set_uv(Vector2(Math::atan2(v[m_idx].x,v[m_idx].z)/Math_PI * 0.5+0.5,v[m_idx].y*0.5+0.5));\ + set_tangent(Plane(Vector3(-v[m_idx].z,v[m_idx].y,v[m_idx].x),1)); \ + }\ set_normal(v[m_idx]);\ add_vertex(v[m_idx]*p_radius); @@ -156,7 +161,7 @@ void ImmediateGeometry::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_uv","uv"),&ImmediateGeometry::set_uv); ObjectTypeDB::bind_method(_MD("set_uv2","uv"),&ImmediateGeometry::set_uv2); ObjectTypeDB::bind_method(_MD("add_vertex","pos"),&ImmediateGeometry::add_vertex); - ObjectTypeDB::bind_method(_MD("add_sphere","lats","lons","radius"),&ImmediateGeometry::add_sphere); + ObjectTypeDB::bind_method(_MD("add_sphere","lats","lons","radius","add_uv"),&ImmediateGeometry::add_sphere,DEFVAL(true)); ObjectTypeDB::bind_method(_MD("end"),&ImmediateGeometry::end); ObjectTypeDB::bind_method(_MD("clear"),&ImmediateGeometry::clear); diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h index c1cc4f87d5..fc7f4de634 100644 --- a/scene/3d/immediate_geometry.h +++ b/scene/3d/immediate_geometry.h @@ -62,7 +62,7 @@ public: void clear(); - void add_sphere(int p_lats,int p_lons,float p_radius); + void add_sphere(int p_lats,int p_lons,float p_radius,bool p_add_uv=true); diff --git a/scene/3d/remote_transform.cpp b/scene/3d/remote_transform.cpp new file mode 100644 index 0000000000..d43870417a --- /dev/null +++ b/scene/3d/remote_transform.cpp @@ -0,0 +1,132 @@ + +/*************************************************************************/ +/* remote_transform.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "remote_transform.h" + +void RemoteTransform::_update_cache() { + cache=0; + if (has_node(remote_node)) { + Node *node = get_node(remote_node); + if (!node || this==node || node->is_a_parent_of(this) || this->is_a_parent_of(node)) { + return; + } + + cache=node->get_instance_ID(); + } +} + +void RemoteTransform::_update_remote() { + + + if (!is_inside_tree()) + return; + + if (!cache) + return; + + Object *obj = ObjectDB::get_instance(cache); + if (!obj) + return; + + Spatial *n = obj->cast_to<Spatial>(); + if (!n) + return; + + if (!n->is_inside_tree()) + return; + + //todo make faster + n->set_global_transform(get_global_transform()); + +} + +void RemoteTransform::_notification(int p_what) { + + switch(p_what) { + + case NOTIFICATION_READY: { + + _update_cache(); + + } break; + case NOTIFICATION_TRANSFORM_CHANGED: { + if (!is_inside_tree()) + break; + + if (cache) { + + _update_remote(); + + } + + } break; + + } +} + + +void RemoteTransform::set_remote_node(const NodePath& p_remote_node) { + + remote_node=p_remote_node; + if (is_inside_tree()) + _update_cache(); + + update_configuration_warning(); +} + +NodePath RemoteTransform::get_remote_node() const{ + + return remote_node; +} + + +String RemoteTransform::get_configuration_warning() const { + + if (!has_node(remote_node) || !get_node(remote_node) || !get_node(remote_node)->cast_to<Spatial>()) { + return TTR("Path property must point to a valid Spatial node to work."); + } + + return String(); +} + +void RemoteTransform::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("set_remote_node","path"),&RemoteTransform::set_remote_node); + ObjectTypeDB::bind_method(_MD("get_remote_node"),&RemoteTransform::get_remote_node); + + ADD_PROPERTY( PropertyInfo(Variant::NODE_PATH,"remote_path"),_SCS("set_remote_node"),_SCS("get_remote_node")); +} + +RemoteTransform::RemoteTransform() { + + cache=0; + +} + diff --git a/scene/3d/remote_transform.h b/scene/3d/remote_transform.h new file mode 100644 index 0000000000..78f0fec1e9 --- /dev/null +++ b/scene/3d/remote_transform.h @@ -0,0 +1,30 @@ +#ifndef REMOTETRANSFORM_H +#define REMOTETRANSFORM_H + +#include "scene/3d/spatial.h" + +class RemoteTransform : public Spatial +{ + OBJ_TYPE(RemoteTransform,Spatial); + + NodePath remote_node; + + ObjectID cache; + + void _update_remote(); + void _update_cache(); + +protected: + static void _bind_methods(); + void _notification(int p_what); +public: + void set_remote_node(const NodePath& p_remote_node); + NodePath get_remote_node() const; + + virtual String get_configuration_warning() const; + + RemoteTransform(); + +}; + +#endif // REMOTETRANSFORM_H diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index b15226cce3..b4f7a4e5b4 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -128,6 +128,8 @@ void VisualInstance::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_layer_mask","mask"), &VisualInstance::set_layer_mask); ObjectTypeDB::bind_method(_MD("get_layer_mask"), &VisualInstance::get_layer_mask); + ObjectTypeDB::bind_method(_MD("get_transformed_aabb"), &VisualInstance::get_transformed_aabb); + ADD_PROPERTY( PropertyInfo( Variant::INT, "layers",PROPERTY_HINT_ALL_FLAGS), _SCS("set_layer_mask"), _SCS("get_layer_mask")); @@ -376,6 +378,8 @@ void GeometryInstance::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_extra_cull_margin","margin"), &GeometryInstance::set_extra_cull_margin); ObjectTypeDB::bind_method(_MD("get_extra_cull_margin"), &GeometryInstance::get_extra_cull_margin); + ObjectTypeDB::bind_method(_MD("get_aabb"),&GeometryInstance::get_aabb); + ObjectTypeDB::bind_method(_MD("_baked_light_changed"), &GeometryInstance::_baked_light_changed); ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/visible"), _SCS("set_flag"), _SCS("get_flag"),FLAG_VISIBLE); diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 6f6f5d3aff..adc8f9c8cf 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -619,6 +619,8 @@ void Tween::_tween_process(float p_delta) { }; object->call(data.key, (const Variant **) arg, data.args, error); } + if (!repeat) + call_deferred("remove", object, data.key); } continue; } diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index b69646432e..5e66544153 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -41,13 +41,13 @@ void update_material(Ref<CanvasItemMaterial>mat,const Color& p_color,float h,flo if (!sdr.is_valid()) return; - mat->set_shader_param("R",p_color.r); - mat->set_shader_param("G",p_color.g); - mat->set_shader_param("B",p_color.b); - mat->set_shader_param("H",h); - mat->set_shader_param("S",s); - mat->set_shader_param("V",v); - mat->set_shader_param("A",p_color.a); + mat->set_shader_param("R",p_color.r); + mat->set_shader_param("G",p_color.g); + mat->set_shader_param("B",p_color.b); + mat->set_shader_param("H",h); + mat->set_shader_param("S",s); + mat->set_shader_param("V",v); + mat->set_shader_param("A",p_color.a); } void ColorPicker::_notification(int p_what) { @@ -397,9 +397,10 @@ void ColorPicker::_screen_input(const InputEvent &ev) if (!r->get_rect().has_point(Point2(mev.global_x,mev.global_y))) return; Image img =r->get_screen_capture(); - if (!img.empty()) + if (!img.empty()) { last_capture=img; r->queue_screen_capture(); + } if (!last_capture.empty()) set_color(last_capture.get_pixel(mev.global_x,mev.global_y)); } diff --git a/scene/gui/color_rect.cpp b/scene/gui/color_rect.cpp new file mode 100644 index 0000000000..a0e4df66b5 --- /dev/null +++ b/scene/gui/color_rect.cpp @@ -0,0 +1,36 @@ +#include "color_rect.h" + + + + +void ColorFrame::set_frame_color(const Color& p_color) { + + color=p_color; + update(); +} + +Color ColorFrame::get_frame_color() const{ + + return color; +} + +void ColorFrame::_notification(int p_what) { + + if (p_what==NOTIFICATION_DRAW) { + draw_rect(Rect2(Point2(),get_size()),color); + } +} + +void ColorFrame::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("set_frame_color","color"),&ColorFrame::set_frame_color); + ObjectTypeDB::bind_method(_MD("get_frame_color"),&ColorFrame::get_frame_color); + + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"color"),_SCS("set_frame_color"),_SCS("get_frame_color") ); +} + +ColorFrame::ColorFrame() { + + color=Color(1,1,1); +} + diff --git a/scene/gui/color_rect.h b/scene/gui/color_rect.h new file mode 100644 index 0000000000..3816d44052 --- /dev/null +++ b/scene/gui/color_rect.h @@ -0,0 +1,22 @@ +#ifndef COLORRECT_H +#define COLORRECT_H + +#include "scene/gui/control.h" + +class ColorFrame : public Control { + OBJ_TYPE(ColorFrame,Control) + + Color color; +protected: + + void _notification(int p_what); + static void _bind_methods(); +public: + + void set_frame_color(const Color& p_color); + Color get_frame_color() const; + + ColorFrame(); +}; + +#endif // COLORRECT_H diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index bf35fd25bd..a5bee32a69 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -431,8 +431,7 @@ void Control::add_child_notify(Node *p_child) { return; if (child_c->data.theme.is_null() && data.theme_owner) { - child_c->data.theme_owner=data.theme_owner; - child_c->notification(NOTIFICATION_THEME_CHANGED); + _propagate_theme_changed(child_c,data.theme_owner); //need to propagate here, since many controls may require setting up stuff } } @@ -443,8 +442,7 @@ void Control::remove_child_notify(Node *p_child) { return; if (child_c->data.theme_owner && child_c->data.theme.is_null()) { - child_c->data.theme_owner=NULL; - //notification(NOTIFICATION_THEME_CHANGED); + _propagate_theme_changed(child_c,NULL); } } @@ -482,10 +480,10 @@ void Control::_notification(int p_notification) { if (is_set_as_toplevel()) { data.SI=get_viewport()->_gui_add_subwindow_control(this); - if (data.theme.is_null() && data.parent && data.parent->data.theme_owner) { + /*if (data.theme.is_null() && data.parent && data.parent->data.theme_owner) { data.theme_owner=data.parent->data.theme_owner; notification(NOTIFICATION_THEME_CHANGED); - } + }*/ } else { @@ -521,10 +519,10 @@ void Control::_notification(int p_notification) { if (parent_control) { //do nothing, has a parent control - if (data.theme.is_null() && parent_control->data.theme_owner) { + /*if (data.theme.is_null() && parent_control->data.theme_owner) { data.theme_owner=parent_control->data.theme_owner; notification(NOTIFICATION_THEME_CHANGED); - } + }*/ } else if (subwindow) { //is a subwindow (process input before other controls for that canvas) data.SI=get_viewport()->_gui_add_subwindow_control(this); @@ -1915,7 +1913,7 @@ void Control::_propagate_theme_changed(CanvasItem *p_at,Control *p_owner,bool p_ CanvasItem *child = p_at->get_child(i)->cast_to<CanvasItem>(); if (child) { - _propagate_theme_changed(child,p_owner); + _propagate_theme_changed(child,p_owner,p_assign); } } @@ -1926,7 +1924,7 @@ void Control::_propagate_theme_changed(CanvasItem *p_at,Control *p_owner,bool p_ if (p_assign) { c->data.theme_owner=p_owner; } - c->_notification(NOTIFICATION_THEME_CHANGED); + c->notification(NOTIFICATION_THEME_CHANGED); c->update(); } } @@ -2408,6 +2406,35 @@ bool Control::is_visibility_clip_disabled() const { return data.disable_visibility_clip; } +void Control::get_argument_options(const StringName& p_function,int p_idx,List<String>*r_options) const { + + Node::get_argument_options(p_function,p_idx,r_options); + + if (p_idx==0) { + List<StringName> sn; + String pf = p_function; + if (pf=="add_color_override" || pf=="has_color" || pf=="has_color_override" || pf=="get_color") { + Theme::get_default()->get_color_list(get_type(),&sn); + } else if (pf=="add_style_override" || pf=="has_style" || pf=="has_style_override" || pf=="get_style") { + Theme::get_default()->get_stylebox_list(get_type(),&sn); + } else if (pf=="add_font_override" || pf=="has_font" || pf=="has_font_override" || pf=="get_font") { + Theme::get_default()->get_font_list(get_type(),&sn); + } else if (pf=="add_constant_override" || pf=="has_constant" || pf=="has_constant_override" || pf=="get_constant") { + Theme::get_default()->get_constant_list(get_type(),&sn); + } else if (pf=="add_color_override" || pf=="has_color" || pf=="has_color_override" || pf=="get_color") { + Theme::get_default()->get_color_list(get_type(),&sn); + } + + sn.sort_custom<StringName::AlphCompare>(); + for (List<StringName>::Element *E=sn.front();E;E=E->next()) { + r_options->push_back("\""+E->get()+"\""); + } + } + + +} + + void Control::_bind_methods() { diff --git a/scene/gui/control.h b/scene/gui/control.h index 558439efbf..37efd80970 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -407,6 +407,8 @@ public: void set_disable_visibility_clip(bool p_ignore); bool is_visibility_clip_disabled() const; + virtual void get_argument_options(const StringName& p_function,int p_idx,List<String>*r_options) const; + Control(); ~Control(); diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 4dbc106834..15ff334c92 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -368,6 +368,7 @@ void AcceptDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("_custom_action"),&AcceptDialog::_custom_action); ObjectTypeDB::bind_method(_MD("set_text","text"),&AcceptDialog::set_text); ObjectTypeDB::bind_method(_MD("get_text"),&AcceptDialog::get_text); + ObjectTypeDB::bind_method(_MD("set_child_rect","child:Control"),&AcceptDialog::set_child_rect); ADD_SIGNAL( MethodInfo("confirmed") ); ADD_SIGNAL( MethodInfo("custom_action",PropertyInfo(Variant::STRING,"action")) ); @@ -399,8 +400,6 @@ AcceptDialog::AcceptDialog() { add_child(label); hbc = memnew( HBoxContainer ); - hbc->set_area_as_parent_rect(margin); - hbc->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,button_margin); add_child(hbc); hbc->add_spacer(); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 8b03dbbc2d..0de6add8cb 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -360,7 +360,8 @@ bool GraphEdit::_filter_input(const Point2& p_point) { Ref<Texture> port =get_icon("port","GraphNode"); - float grab_r=port->get_width()*0.5; + float grab_r_extend = 2.0; + float grab_r=port->get_width()*0.5*grab_r_extend; for(int i=get_child_count()-1;i>=0;i--) { GraphNode *gn=get_child(i)->cast_to<GraphNode>(); @@ -379,8 +380,9 @@ bool GraphEdit::_filter_input(const Point2& p_point) { for(int j=0;j<gn->get_connection_input_count();j++) { Vector2 pos = gn->get_connection_input_pos(j)+gn->get_pos(); - if (pos.distance_to(p_point)<grab_r) + if (pos.distance_to(p_point)<grab_r) { return true; + } } @@ -392,11 +394,13 @@ bool GraphEdit::_filter_input(const Point2& p_point) { void GraphEdit::_top_layer_input(const InputEvent& p_ev) { + + float grab_r_extend = 2.0; if (p_ev.type==InputEvent::MOUSE_BUTTON && p_ev.mouse_button.button_index==BUTTON_LEFT && p_ev.mouse_button.pressed) { Ref<Texture> port =get_icon("port","GraphNode"); Vector2 mpos(p_ev.mouse_button.x,p_ev.mouse_button.y); - float grab_r=port->get_width()*0.5; + float grab_r=port->get_width()*0.5*grab_r_extend; for(int i=get_child_count()-1;i>=0;i--) { GraphNode *gn=get_child(i)->cast_to<GraphNode>(); @@ -517,7 +521,7 @@ void GraphEdit::_top_layer_input(const InputEvent& p_ev) { Ref<Texture> port =get_icon("port","GraphNode"); Vector2 mpos(p_ev.mouse_button.x,p_ev.mouse_button.y); - float grab_r=port->get_width()*0.5; + float grab_r=port->get_width()*0.5*grab_r_extend; for(int i=get_child_count()-1;i>=0;i--) { GraphNode *gn=get_child(i)->cast_to<GraphNode>(); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 105d919338..89cd509fbd 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -40,6 +40,7 @@ void ItemList::add_item(const String& p_item,const Ref<Texture>& p_texture,bool item.selectable=p_selectable; item.selected=false; item.disabled=false; + item.tooltip_enabled=true; item.custom_bg=Color(0,0,0,0); items.push_back(item); @@ -57,6 +58,7 @@ void ItemList::add_icon_item(const Ref<Texture>& p_item,bool p_selectable){ item.selectable=p_selectable; item.selected=false; item.disabled=false; + item.tooltip_enabled=true; item.custom_bg=Color(0,0,0,0); items.push_back(item); @@ -82,6 +84,16 @@ String ItemList::get_item_text(int p_idx) const{ } +void ItemList::set_item_tooltip_enabled(int p_idx, const bool p_enabled) { + ERR_FAIL_INDEX(p_idx,items.size()); + items[p_idx].tooltip_enabled = p_enabled; +} + +bool ItemList::is_item_tooltip_enabled(int p_idx) const { + ERR_FAIL_INDEX_V(p_idx,items.size(), false); + return items[p_idx].tooltip_enabled; +} + void ItemList::set_item_tooltip(int p_idx,const String& p_tooltip){ ERR_FAIL_INDEX(p_idx,items.size()); @@ -1198,6 +1210,9 @@ String ItemList::get_tooltip(const Point2& p_pos) const { int closest = get_item_at_pos(p_pos); if (closest!=-1) { + if (!items[closest].tooltip_enabled) { + return ""; + } if (items[closest].tooltip!="") { return items[closest].tooltip; } @@ -1294,6 +1309,9 @@ void ItemList::_bind_methods(){ ObjectTypeDB::bind_method(_MD("set_item_custom_bg_color","idx","custom_bg_color"),&ItemList::set_item_custom_bg_color); ObjectTypeDB::bind_method(_MD("get_item_custom_bg_color","idx"),&ItemList::get_item_custom_bg_color); + ObjectTypeDB::bind_method(_MD("set_item_tooltip_enabled","idx","enable"),&ItemList::set_item_tooltip_enabled); + ObjectTypeDB::bind_method(_MD("is_item_tooltip_enabled","idx"),&ItemList::is_item_tooltip_enabled); + ObjectTypeDB::bind_method(_MD("set_item_tooltip","idx","tooltip"),&ItemList::set_item_tooltip); ObjectTypeDB::bind_method(_MD("get_item_tooltip","idx"),&ItemList::get_item_tooltip); @@ -1340,6 +1358,8 @@ void ItemList::_bind_methods(){ ObjectTypeDB::bind_method(_MD("ensure_current_is_visible"),&ItemList::ensure_current_is_visible); + ObjectTypeDB::bind_method(_MD("get_v_scroll"),&ItemList::get_v_scroll); + ObjectTypeDB::bind_method(_MD("_scroll_changed"),&ItemList::_scroll_changed); ObjectTypeDB::bind_method(_MD("_input_event"),&ItemList::_input_event); diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h index e1902d1c1f..cb5908bc79 100644 --- a/scene/gui/item_list.h +++ b/scene/gui/item_list.h @@ -56,6 +56,7 @@ private: bool selectable; bool selected; bool disabled; + bool tooltip_enabled; Variant metadata; String tooltip; Color custom_bg; @@ -135,6 +136,9 @@ public: void set_item_tag_icon(int p_idx,const Ref<Texture>& p_tag_icon); Ref<Texture> get_item_tag_icon(int p_idx) const; + void set_item_tooltip_enabled(int p_idx, const bool p_enabled); + bool is_item_tooltip_enabled(int p_idx) const; + void set_item_tooltip(int p_idx,const String& p_tooltip); String get_item_tooltip(int p_idx) const; @@ -191,6 +195,8 @@ public: void set_icon_scale(real_t p_scale); real_t get_icon_scale() const; + VScrollBar *get_v_scroll() { return scroll_bar; } + ItemList(); ~ItemList(); }; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 778e4cfa2a..f7d74b2b49 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -193,8 +193,8 @@ void LineEdit::_input_event(InputEvent p_event) { } set_cursor_pos(0); - emit_signal("text_changed",text); - _change_notify("text"); + _text_changed(); + } @@ -215,8 +215,7 @@ void LineEdit::_input_event(InputEvent p_event) { selection_clear(); undo_text = text; text = text.substr(0,cursor_pos); - emit_signal("text_changed",text); - _change_notify("text"); + _text_changed(); } } break; @@ -475,9 +474,7 @@ void LineEdit::_input_event(InputEvent p_event) { selection_delete(); CharType ucodestr[2]={(CharType)k.unicode,0}; append_at_cursor(ucodestr); - emit_signal("text_changed",text); - _change_notify("text"); - + _text_changed(); accept_event(); } @@ -642,6 +639,7 @@ void LineEdit::_notification(int p_what) { if(text.empty()) font_color.a *= placeholder_alpha; + int caret_height = font->get_height() > y_area ? y_area : font->get_height(); while(true) { //end of string, break! @@ -660,14 +658,14 @@ void LineEdit::_notification(int p_what) { bool selected=selection.enabled && char_ofs>=selection.begin && char_ofs<selection.end; if (selected) - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(char_width, y_area)), selection_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(char_width, caret_height)), selection_color); font->draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, selected ? font_color_selected : font_color); if (char_ofs==cursor_pos && draw_caret) { VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2( - Point2( x_ofs , y_ofs ), Size2( 1, y_area ) ), cursor_color ); + Point2( x_ofs , y_ofs ), Size2( 1, caret_height ) ), cursor_color ); } x_ofs+=char_width; @@ -676,7 +674,7 @@ void LineEdit::_notification(int p_what) { if (char_ofs==cursor_pos && draw_caret) {//may be at the end VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2( - Point2( x_ofs , y_ofs ), Size2( 1, y_area ) ), cursor_color ); + Point2( x_ofs , y_ofs ), Size2( 1, caret_height ) ), cursor_color ); } } break; case NOTIFICATION_FOCUS_ENTER: { @@ -725,8 +723,7 @@ void LineEdit::paste_text() { if(selection.enabled) selection_delete(); append_at_cursor(paste_buffer); - emit_signal("text_changed",text); - _change_notify("text"); + _text_changed(); } @@ -750,9 +747,7 @@ void LineEdit::undo() { set_cursor_pos(old_cursor_pos); } - emit_signal("text_changed",text); - _change_notify("text"); - + _text_changed(); } void LineEdit::shift_selection_check_pre(bool p_shift) { @@ -881,8 +876,7 @@ void LineEdit::delete_char() { // set_window_pos(cursor_pos-get_window_length()); } - emit_signal("text_changed",text); - _change_notify("text"); + _text_changed(); } void LineEdit::delete_text(int p_from_column, int p_to_column) { @@ -914,8 +908,7 @@ void LineEdit::delete_text(int p_from_column, int p_to_column) { window_pos=cursor_pos; } - emit_signal("text_changed",text); - _change_notify("text"); + _text_changed(); } void LineEdit::set_text(String p_text) { @@ -930,8 +923,7 @@ void LineEdit::set_text(String p_text) { void LineEdit::clear() { clear_internal(); - emit_signal("text_changed",text); - _change_notify("text"); + _text_changed(); } String LineEdit::get_text() const { @@ -1070,7 +1062,17 @@ Size2 LineEdit::get_minimum_size() const { Size2 min=style->get_minimum_size(); min.height+=font->get_height(); - min.width+=get_constant("minimum_spaces")*font->get_char_size(' ').x; + + //minimum size of text + int space_size = font->get_char_size(' ').x; + int mstext = get_constant("minimum_spaces")*space_size; + + if (expand_to_text_length) { + mstext=MAX(mstext,font->get_string_size(text).x+space_size); //add a spce because some fonts are too exact + } + + min.width+=mstext; + return min; } @@ -1190,24 +1192,28 @@ void LineEdit::menu_option(int p_option) { switch(p_option) { case MENU_CUT: { - cut_text(); + if (editable) { + cut_text(); + } } break; case MENU_COPY: { copy_text(); } break; case MENU_PASTE: { - - paste_text(); + if (editable) { + paste_text(); + } } break; case MENU_CLEAR: { - clear(); + if (editable) { + clear(); + } } break; case MENU_SELECT_ALL: { select_all(); } break; case MENU_UNDO: { - undo(); } break; @@ -1226,6 +1232,29 @@ PopupMenu *LineEdit::get_menu() const { } #endif + +void LineEdit::set_expand_to_text_length(bool p_enabled) { + + expand_to_text_length = p_enabled; + minimum_size_changed(); +} + +bool LineEdit::get_expand_to_text_length() const{ + + return expand_to_text_length; +} + + +void LineEdit::_text_changed() { + + if (expand_to_text_length) + minimum_size_changed(); + + emit_signal("text_changed",text); + _change_notify("text"); + +} + void LineEdit::_bind_methods() { ObjectTypeDB::bind_method(_MD("_toggle_draw_caret"),&LineEdit::_toggle_draw_caret); @@ -1248,7 +1277,9 @@ void LineEdit::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_placeholder_alpha"),&LineEdit::get_placeholder_alpha); ObjectTypeDB::bind_method(_MD("set_cursor_pos","pos"),&LineEdit::set_cursor_pos); ObjectTypeDB::bind_method(_MD("get_cursor_pos"),&LineEdit::get_cursor_pos); - ObjectTypeDB::bind_method(_MD("cursor_set_blink_enabled", "enable"),&LineEdit::cursor_set_blink_enabled); + ObjectTypeDB::bind_method(_MD("set_expand_to_text_length","enabled"),&LineEdit::set_expand_to_text_length); + ObjectTypeDB::bind_method(_MD("get_expand_to_text_length"),&LineEdit::get_expand_to_text_length); + ObjectTypeDB::bind_method(_MD("cursor_set_blink_enabled", "enabled"),&LineEdit::cursor_set_blink_enabled); ObjectTypeDB::bind_method(_MD("cursor_get_blink_enabled"),&LineEdit::cursor_get_blink_enabled); ObjectTypeDB::bind_method(_MD("cursor_set_blink_speed", "blink_speed"),&LineEdit::cursor_set_blink_speed); ObjectTypeDB::bind_method(_MD("cursor_get_blink_speed"),&LineEdit::cursor_get_blink_speed); @@ -1286,6 +1317,7 @@ void LineEdit::_bind_methods() { ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "max_length" ), _SCS("set_max_length"),_SCS("get_max_length") ); ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "editable" ), _SCS("set_editable"),_SCS("is_editable") ); ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "secret" ), _SCS("set_secret"),_SCS("is_secret") ); + ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "expand_to_len" ), _SCS("set_expand_to_text_length"),_SCS("get_expand_to_text_length") ); ADD_PROPERTY( PropertyInfo( Variant::INT,"focus_mode", PROPERTY_HINT_ENUM, "None,Click,All" ), _SCS("set_focus_mode"), _SCS("get_focus_mode") ); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret/caret_blink"), _SCS("cursor_set_blink_enabled"), _SCS("cursor_get_blink_enabled"));; ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "caret/caret_blink_speed",PROPERTY_HINT_RANGE,"0.1,10,0.1"), _SCS("cursor_set_blink_speed"),_SCS("cursor_get_blink_speed") ); @@ -1327,7 +1359,7 @@ LineEdit::LineEdit() { menu->add_separator(); menu->add_item(TTR("Undo"),MENU_UNDO,KEY_MASK_CMD|KEY_Z); menu->connect("item_pressed",this,"menu_option"); - + expand_to_text_length=false; } diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index 112e4ad55e..47d5706bbe 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -90,6 +90,11 @@ private: } selection; Timer *caret_blink_timer; + + + void _text_changed(); + bool expand_to_text_length; + bool caret_blink_enabled; bool draw_caret; bool window_has_focus; @@ -169,6 +174,9 @@ public: virtual Size2 get_minimum_size() const; + void set_expand_to_text_length(bool p_len); + bool get_expand_to_text_length() const; + virtual bool is_text_field() const; LineEdit(); ~LineEdit(); diff --git a/scene/gui/panel.h b/scene/gui/panel.h index efa9ebcaa0..9e2e7df7f0 100644 --- a/scene/gui/panel.h +++ b/scene/gui/panel.h @@ -45,4 +45,6 @@ public: }; + + #endif diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 190e8e141f..479bb96fe2 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -228,14 +228,14 @@ void ScrollContainer::_notification(int p_what) { child_max_size.y = MAX(child_max_size.y, minsize.y); Rect2 r = Rect2(-scroll,minsize); - if (!scroll_h) { + if (!(scroll_h || h_scroll->is_visible())) { r.pos.x=0; if (c->get_h_size_flags()&SIZE_EXPAND) r.size.width=MAX(size.width,minsize.width); else r.size.width=minsize.width; } - if (!scroll_v) { + if (!(scroll_v || v_scroll->is_visible())) { r.pos.y=0; r.size.height=size.height; if (c->get_v_size_flags()&SIZE_EXPAND) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 4756fdee26..8a9ed98a5f 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -34,6 +34,7 @@ #include "globals.h" #include "message_queue.h" +#include "scene/main/viewport.h" #define TAB_PIXELS @@ -699,6 +700,7 @@ void TextEdit::_notification(int p_what) { bool prev_is_char=false; bool prev_is_number = false; bool in_keyword=false; + bool underlined=false; bool in_word = false; bool in_function_name = false; bool in_member_variable = false; @@ -824,8 +826,10 @@ void TextEdit::_notification(int p_what) { } } - if (!is_char) + if (!is_char) { in_keyword=false; + underlined=false; + } if (in_region==-1 && !in_keyword && is_char && !prev_is_char) { @@ -843,6 +847,12 @@ void TextEdit::_notification(int p_what) { in_keyword=true; keyword_color=*col; } + + if (select_identifiers_enabled && hilighted_word!=String()) { + if (hilighted_word==range) { + underlined=true; + } + } } if (!in_function_name && in_word && !in_keyword) { @@ -1023,8 +1033,12 @@ void TextEdit::_notification(int p_what) { color = cache.caret_background_color; } - if (str[j]>=32) - cache.font->draw_char(ci,Point2i( char_ofs+char_margin, ofs_y+ascent),str[j],str[j+1],in_selection?cache.font_selected_color:color); + if (str[j]>=32) { + int w = cache.font->draw_char(ci,Point2i( char_ofs+char_margin, ofs_y+ascent),str[j],str[j+1],in_selection?cache.font_selected_color:color); + if (underlined) { + draw_rect(Rect2( char_ofs+char_margin, ofs_y+ascent+2,w,1),in_selection?cache.font_selected_color:color); + } + } else if (draw_tabs && str[j]=='\t') { int yofs= (get_row_height() - cache.tab_icon->get_height())/2; @@ -1500,11 +1514,19 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { } if (mb.button_index==BUTTON_LEFT) { + _reset_caret_blink_timer(); int row,col; _get_mouse_pos(Point2i(mb.x,mb.y), row,col); + if (mb.mod.command && hilighted_word!=String()) { + + emit_signal("symbol_lookup",hilighted_word,row,col); + return; + } + + // toggle breakpoint on gutter click if (draw_breakpoint_gutter) { int gutter=cache.style_normal->get_margin(MARGIN_LEFT); @@ -1651,7 +1673,23 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { const InputEventMouseMotion &mm=p_input_event.mouse_motion; - if (mm.button_mask&BUTTON_MASK_LEFT) { + if (select_identifiers_enabled) { + if (mm.mod.command && mm.button_mask==0) { + + String new_word = get_word_at_pos(Vector2(mm.x,mm.y)); + if (new_word!=hilighted_word) { + hilighted_word=new_word; + update(); + } + } else { + if (hilighted_word!=String()) { + hilighted_word=String(); + update(); + } + } + } + + if (mm.button_mask&BUTTON_MASK_LEFT && get_viewport()->gui_get_drag_data()==Variant()) { //ignore if dragging if (selection.selecting_mode!=Selection::MODE_NONE) { @@ -1678,6 +1716,27 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { InputEventKey k=p_input_event.key; + +#ifdef OSX_ENABLED + if (k.scancode==KEY_META) { +#else + if (k.scancode==KEY_CONTROL) { + +#endif + if (select_identifiers_enabled) { + + if (k.pressed) { + + hilighted_word = get_word_at_pos(get_local_mouse_pos()); + update(); + + } else { + hilighted_word=String(); + update(); + } + } + } + if (!k.pressed) return; @@ -1845,6 +1904,8 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { if (!k.mod.command) { _reset_caret_blink_timer(); } + + // save here for insert mode, just in case it is cleared in the following section bool had_selection = selection.active; @@ -2481,7 +2542,9 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { } break; case KEY_X: { - + if (readonly) { + break; + } if (!k.mod.command || k.mod.shift || k.mod.alt) { scancode_handled=false; break; @@ -2513,7 +2576,9 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { undo(); } break; case KEY_V: { - + if (readonly) { + break; + } if (!k.mod.command || k.mod.shift || k.mod.alt) { scancode_handled=false; break; @@ -2558,7 +2623,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { } update(); } - break;} + } break; default: { @@ -3222,6 +3287,9 @@ void TextEdit::insert_text_at_cursor(const String& p_text) { } Control::CursorShape TextEdit::get_cursor_shape(const Point2& p_pos) const { + if (hilighted_word!=String()) + return CURSOR_POINTING_HAND; + int gutter=cache.style_normal->get_margin(MARGIN_LEFT)+cache.line_number_w+cache.breakpoint_gutter_width; if((completion_active && completion_rect.has_point(p_pos)) || p_pos.x < gutter) { return CURSOR_ARROW; @@ -3264,6 +3332,36 @@ String TextEdit::get_text() { }; + +String TextEdit::get_text_for_lookup_completion() { + + + int row,col; + _get_mouse_pos(get_local_mouse_pos(), row,col); + + + String longthing; + int len = text.size(); + for (int i=0;i<len;i++) { + + if (i==row) { + longthing+=text[i].substr(0,col); + longthing+=String::chr(0xFFFF); //not unicode, represents the cursor + longthing+=text[i].substr(col,text[i].size()); + } else { + + longthing+=text[i]; + } + + + if (i!=len-1) + longthing+="\n"; + } + + return longthing; + +} + String TextEdit::get_text_for_completion() { String longthing; @@ -4301,6 +4399,38 @@ void TextEdit::code_complete(const Vector<String> &p_strings) { } +String TextEdit::get_word_at_pos(const Vector2& p_pos) const { + + int row,col; + _get_mouse_pos(p_pos, row, col); + + String s = text[row]; + if (s.length()==0) + return ""; + int beg=CLAMP(col,0,s.length()); + int end=beg; + + + if (s[beg]>32 || beg==s.length()) { + + bool symbol = beg < s.length() && _is_symbol(s[beg]); //not sure if right but most editors behave like this + + while(beg>0 && s[beg-1]>32 && (symbol==_is_symbol(s[beg-1]))) { + beg--; + } + while(end<s.length() && s[end+1]>32 && (symbol==_is_symbol(s[end+1]))) { + end++; + } + + if (end<s.length()) + end+=1; + + return s.substr(beg,end-beg); + } + + return String(); +} + String TextEdit::get_tooltip(const Point2& p_pos) const { if (!tooltip_obj) @@ -4401,18 +4531,22 @@ void TextEdit::menu_option(int p_option) { switch( p_option ) { case MENU_CUT: { - - cut(); + if (!readonly) { + cut(); + } } break; case MENU_COPY: { copy(); } break; case MENU_PASTE: { - - paste(); + if (!readonly) { + paste(); + } } break; case MENU_CLEAR: { - clear(); + if (!readonly) { + clear(); + } } break; case MENU_SELECT_ALL: { select_all(); @@ -4424,6 +4558,18 @@ void TextEdit::menu_option(int p_option) { }; } + +void TextEdit::set_select_identifiers_on_hover(bool p_enable) { + + select_identifiers_enabled=p_enable; +} + +bool TextEdit::is_selecting_identifiers_on_hover_enabled() const { + + return select_identifiers_enabled; +} + + PopupMenu *TextEdit::get_menu() const { return menu; } @@ -4520,6 +4666,7 @@ void TextEdit::_bind_methods() { ADD_SIGNAL(MethodInfo("text_changed")); ADD_SIGNAL(MethodInfo("request_completion")); ADD_SIGNAL(MethodInfo("breakpoint_toggled", PropertyInfo( Variant::INT, "row"))); + ADD_SIGNAL(MethodInfo("symbol_lookup", PropertyInfo(Variant::STRING,"symbol"),PropertyInfo( Variant::INT, "row"),PropertyInfo( Variant::INT, "column"))); BIND_CONSTANT( MENU_CUT ); BIND_CONSTANT( MENU_COPY ); @@ -4640,6 +4787,7 @@ TextEdit::TextEdit() { auto_indent=false; insert_mode = false; window_has_focus=true; + select_identifiers_enabled=false; menu = memnew( PopupMenu ); add_child(menu); diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index f0301fc250..cb49618f18 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -242,6 +242,9 @@ class TextEdit : public Control { bool auto_indent; bool cut_copy_line; bool insert_mode; + bool select_identifiers_enabled; + + String hilighted_word; uint64_t last_dblclk; @@ -444,6 +447,7 @@ public: String get_selection_text() const; String get_word_under_cursor() const; + String get_word_at_pos(const Vector2& p_pos) const; bool search(const String &p_key,uint32_t p_search_flags, int p_from_line, int p_from_column,int &r_line,int &r_column) const; @@ -492,9 +496,13 @@ public: void set_code_hint(const String& p_hint); void query_code_comple(); + void set_select_identifiers_on_hover(bool p_enable); + bool is_selecting_identifiers_on_hover_enabled() const; + PopupMenu *get_menu() const; String get_text_for_completion(); + String get_text_for_lookup_completion(); virtual bool is_text_field() const; TextEdit(); diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp index 923a35031c..2c576b6ba5 100644 --- a/scene/gui/texture_progress.cpp +++ b/scene/gui/texture_progress.cpp @@ -297,6 +297,7 @@ void TextureProgress::_bind_methods() { TextureProgress::TextureProgress() { mode=FILL_LEFT_TO_RIGHT; + rad_init_angle=0; rad_center_off=Point2(); rad_max_degrees=360; } diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index c31a57f819..8e238c7d77 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -168,20 +168,13 @@ void CanvasLayer::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - Node *n = this; - vp=NULL; + if (custom_viewport && ObjectDB::get_instance(custom_viewport_id)) { - while(n) { + vp=custom_viewport; + } else { + vp=Node::get_viewport(); - if (n->cast_to<Viewport>()) { - - vp = n->cast_to<Viewport>(); - break; - } - n=n->get_parent(); } - - ERR_FAIL_COND(!vp); viewport=vp->get_viewport(); @@ -205,6 +198,7 @@ Size2 CanvasLayer::get_viewport_size() const { if (!is_inside_tree()) return Size2(1,1); + Rect2 r = vp->get_visible_rect(); return r.size; } @@ -215,6 +209,43 @@ RID CanvasLayer::get_viewport() const { return viewport; } +void CanvasLayer::set_custom_viewport(Node *p_viewport) { + ERR_FAIL_NULL(p_viewport); + if (is_inside_tree()) { + VisualServer::get_singleton()->viewport_remove_canvas(viewport,canvas->get_canvas()); + viewport=RID(); + } + + custom_viewport=p_viewport->cast_to<Viewport>(); + + if (custom_viewport) { + custom_viewport_id=custom_viewport->get_instance_ID(); + } else { + custom_viewport_id=0; + } + + if (is_inside_tree()) { + + + if (custom_viewport) + vp=custom_viewport; + else + vp=Node::get_viewport(); + + viewport = vp->get_viewport(); + + VisualServer::get_singleton()->viewport_attach_canvas(viewport,canvas->get_canvas()); + VisualServer::get_singleton()->viewport_set_canvas_layer(viewport,canvas->get_canvas(),layer); + VisualServer::get_singleton()->viewport_set_canvas_transform(viewport,canvas->get_canvas(),transform); + } + +} + +Node* CanvasLayer::get_custom_viewport() const { + + return custom_viewport; +} + void CanvasLayer::_bind_methods() { @@ -241,8 +272,11 @@ void CanvasLayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_scale","scale"),&CanvasLayer::set_scale); ObjectTypeDB::bind_method(_MD("get_scale"),&CanvasLayer::get_scale); + ObjectTypeDB::bind_method(_MD("set_custom_viewport","viewport:Viewport"),&CanvasLayer::set_custom_viewport); + ObjectTypeDB::bind_method(_MD("get_custom_viewport:Viewport"),&CanvasLayer::get_custom_viewport); + ObjectTypeDB::bind_method(_MD("get_world_2d:World2D"),&CanvasLayer::get_world_2d); - ObjectTypeDB::bind_method(_MD("get_viewport"),&CanvasLayer::get_viewport); +// ObjectTypeDB::bind_method(_MD("get_viewport"),&CanvasLayer::get_viewport); ADD_PROPERTY( PropertyInfo(Variant::INT,"layer",PROPERTY_HINT_RANGE,"-128,128,1"),_SCS("set_layer"),_SCS("get_layer") ); //ADD_PROPERTY( PropertyInfo(Variant::MATRIX32,"transform",PROPERTY_HINT_RANGE),_SCS("set_transform"),_SCS("get_transform") ); @@ -260,4 +294,6 @@ CanvasLayer::CanvasLayer() { locrotscale_dirty=false; layer=1; canvas = Ref<World2D>( memnew(World2D) ); + custom_viewport=NULL; + custom_viewport_id=0; } diff --git a/scene/main/canvas_layer.h b/scene/main/canvas_layer.h index a3e8211a43..a1311390be 100644 --- a/scene/main/canvas_layer.h +++ b/scene/main/canvas_layer.h @@ -40,11 +40,15 @@ class CanvasLayer : public Node { bool locrotscale_dirty; Vector2 ofs; - Vector2 scale; + Size2 scale; real_t rot; int layer; Matrix32 transform; Ref<World2D> canvas; + + ObjectID custom_viewport_id; // to check validity + Viewport *custom_viewport; + RID viewport; Viewport *vp; @@ -55,6 +59,7 @@ class CanvasLayer : public Node { void _update_xform(); void _update_locrotscale(); + protected: void _notification(int p_what); @@ -76,8 +81,8 @@ public: void set_rotationd(real_t p_degrees); real_t get_rotationd() const; - void set_scale(const Vector2& p_scale); - Vector2 get_scale() const; + void set_scale(const Size2& p_scale); + Size2 get_scale() const; Ref<World2D> get_world_2d() const; @@ -85,6 +90,9 @@ public: RID get_viewport() const; + void set_custom_viewport(Node *p_viewport); + Node* get_custom_viewport() const; + CanvasLayer(); }; diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 9b79af32bf..c713b5e4dc 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -96,7 +96,7 @@ Error HTTPRequest::_parse_url(const String& p_url) { return OK; } -Error HTTPRequest::request(const String& p_url, const Vector<String>& p_custom_headers, bool p_ssl_validate_domain) { +Error HTTPRequest::request(const String& p_url, const Vector<String>& p_custom_headers, bool p_ssl_validate_domain, HTTPClient::Method p_method, const String& p_request_data) { ERR_FAIL_COND_V(!is_inside_tree(),ERR_UNCONFIGURED); if ( requesting ) { @@ -104,6 +104,8 @@ Error HTTPRequest::request(const String& p_url, const Vector<String>& p_custom_h ERR_FAIL_V(ERR_BUSY); } + method=p_method; + Error err = _parse_url(p_url); if (err) return err; @@ -114,6 +116,8 @@ Error HTTPRequest::request(const String& p_url, const Vector<String>& p_custom_h bool has_accept=false; headers=p_custom_headers; + request_data = p_request_data; + for(int i=0;i<headers.size();i++) { if (headers[i].findn("user-agent:")==0) @@ -281,7 +285,7 @@ bool HTTPRequest::_update_connection() { switch( client->get_status() ) { case HTTPClient::STATUS_DISCONNECTED: { call_deferred("_request_done",RESULT_CANT_CONNECT,0,StringArray(),ByteArray()); - return true; //end it, since it's doing something + return true; //end it, since it's doing something } break; case HTTPClient::STATUS_RESOLVING: { client->poll(); @@ -334,7 +338,7 @@ bool HTTPRequest::_update_connection() { } else { //did not request yet, do request - Error err = client->request(HTTPClient::METHOD_GET,request_string,headers); + Error err = client->request(method,request_string,headers,request_data); if (err!=OK) { call_deferred("_request_done",RESULT_CONNECTION_ERROR,0,StringArray(),ByteArray()); return true; @@ -531,7 +535,7 @@ int HTTPRequest::get_body_size() const{ void HTTPRequest::_bind_methods() { - ObjectTypeDB::bind_method(_MD("request","url","custom_headers","ssl_validate_domain"),&HTTPRequest::request,DEFVAL(StringArray()),DEFVAL(true)); + ObjectTypeDB::bind_method(_MD("request","url","custom_headers","ssl_validate_domain","method","request_data"),&HTTPRequest::request,DEFVAL(StringArray()),DEFVAL(true),DEFVAL(HTTPClient::METHOD_GET),DEFVAL(String())); ObjectTypeDB::bind_method(_MD("cancel_request"),&HTTPRequest::cancel_request); ObjectTypeDB::bind_method(_MD("get_http_client_status"),&HTTPRequest::get_http_client_status); diff --git a/scene/main/http_request.h b/scene/main/http_request.h index 8dd433982b..705799f044 100644 --- a/scene/main/http_request.h +++ b/scene/main/http_request.h @@ -66,6 +66,8 @@ private: Vector<String> headers; bool validate_ssl; bool use_ssl; + HTTPClient::Method method; + String request_data; bool request_sent; Ref<HTTPClient> client; @@ -114,7 +116,7 @@ protected: static void _bind_methods(); public: - Error request(const String& p_url,const Vector<String>& p_custom_headers=Vector<String>(),bool p_ssl_validate_domain=true); //connects to a full url and perform request + Error request(const String& p_url, const Vector<String>& p_custom_headers=Vector<String>(), bool p_ssl_validate_domain=true, HTTPClient::Method p_method=HTTPClient::METHOD_GET, const String& p_request_data=""); //connects to a full url and perform request void cancel_request(); HTTPClient::Status get_http_client_status() const; diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 086b69c1c5..1892240426 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2903,16 +2903,16 @@ void Node::_bind_methods() { mi.name="rpc"; - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"rpc",&Node::_rpc_bind,mi); + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"rpc",&Node::_rpc_bind,mi); mi.name="rpc_unreliable"; - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"rpc_unreliable",&Node::_rpc_unreliable_bind,mi); + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"rpc_unreliable",&Node::_rpc_unreliable_bind,mi); - mi.arguments.push_front( PropertyInfo( Variant::INT, "peer_") ); + mi.arguments.push_front( PropertyInfo( Variant::INT, "peer_id") ); mi.name="rpc_id"; - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"rpc_id",&Node::_rpc_id_bind,mi); + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"rpc_id",&Node::_rpc_id_bind,mi); mi.name="rpc_unreliable_id"; - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"rpc_unreliable_id",&Node::_rpc_unreliable_id_bind,mi); + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"rpc_unreliable_id",&Node::_rpc_unreliable_id_bind,mi); } diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index 4c7b7c1399..e3472c074a 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -2200,13 +2200,9 @@ void SceneTree::_bind_methods() { mi.arguments.push_back( PropertyInfo( Variant::INT, "flags")); mi.arguments.push_back( PropertyInfo( Variant::STRING, "group")); mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); - Vector<Variant> defargs; - for(int i=0;i<VARIANT_ARG_MAX;i++) { - mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); - defargs.push_back(Variant()); - } - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call_group",&SceneTree::_call_group,mi,defargs); + + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call_group",&SceneTree::_call_group,mi); ObjectTypeDB::bind_method(_MD("set_current_scene","child_node:Node"),&SceneTree::set_current_scene); ObjectTypeDB::bind_method(_MD("get_current_scene:Node"),&SceneTree::get_current_scene); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 7970229c06..b22d1fcdf4 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -359,13 +359,7 @@ void Viewport::_notification(int p_what) { _update_listener_2d(); _update_rect(); - if (world_2d.is_valid()) { - find_world_2d()->_register_viewport(this,Rect2()); -//best to defer this and not do it here, as it can annoy a lot of setup logic if user -//adds a node and then moves it, will get enter/exit screen/viewport notifications -//unnecesarily -// update_worlds(); - } + find_world_2d()->_register_viewport(this,Rect2()); add_to_group("_viewports"); if (get_tree()->is_debugging_collisions_hint()) { @@ -1001,19 +995,34 @@ bool Viewport::has_transparent_background() const { return transparent_bg; } -#if 0 void Viewport::set_world_2d(const Ref<World2D>& p_world_2d) { + if (world_2d==p_world_2d) + return; + + if (parent && parent->find_world_2d()==p_world_2d) { + WARN_PRINT("Unable to use parent world as world_2d"); + return; + } + + if (is_inside_tree()) { + find_world_2d()->_remove_viewport(this); + VisualServer::get_singleton()->viewport_remove_canvas(viewport,current_canvas); + } + + if (p_world_2d.is_valid()) + world_2d=p_world_2d; + else { + WARN_PRINT("Invalid world"); + world_2d=Ref<World2D>( memnew( World2D )); + } - world_2d=p_world_2d; _update_listener_2d(); - if (is_inside_scene()) { - if (current_canvas.is_valid()) - VisualServer::get_singleton()->viewport_remove_canvas(viewport,current_canvas); + if (is_inside_tree()) { current_canvas=find_world_2d()->get_canvas(); VisualServer::get_singleton()->viewport_attach_canvas(viewport,current_canvas); + find_world_2d()->_register_viewport(this,Rect2()); } - } Ref<World2D> Viewport::find_world_2d() const{ @@ -1025,13 +1034,6 @@ Ref<World2D> Viewport::find_world_2d() const{ else return Ref<World2D>(); } -#endif - -Ref<World2D> Viewport::find_world_2d() const{ - - return world_2d; -} - void Viewport::_propagate_enter_world(Node *p_node) { @@ -1141,6 +1143,11 @@ Ref<World> Viewport::get_world() const{ return world; } +Ref<World2D> Viewport::get_world_2d() const{ + + return world_2d; +} + Ref<World> Viewport::find_world() const{ if (own_world.is_valid()) @@ -1303,6 +1310,9 @@ void Viewport::render_target_clear() { void Viewport::set_render_target_filter(bool p_enable) { + if(!render_target) + return; + render_target_texture->set_flags(p_enable?int(Texture::FLAG_FILTER):int(0)); } @@ -1344,6 +1354,15 @@ Matrix32 Viewport::_get_input_pre_xform() const { return pre_xf; } +Vector2 Viewport::_get_window_offset() const { + + if (parent_control) { + return (parent_control->get_viewport()->get_final_transform() * parent_control->get_global_transform_with_canvas()).get_origin(); + } + + return Vector2(); +} + void Viewport::_make_input_local(InputEvent& ev) { @@ -1351,10 +1370,7 @@ void Viewport::_make_input_local(InputEvent& ev) { case InputEvent::MOUSE_BUTTON: { - Vector2 vp_ofs; - if (parent_control) { - vp_ofs = (parent_control->get_viewport()->get_final_transform() * parent_control->get_global_transform_with_canvas()).get_origin(); - } + Vector2 vp_ofs = _get_window_offset(); Matrix32 ai = get_final_transform().affine_inverse() * _get_input_pre_xform(); Vector2 g = ai.xform(Vector2(ev.mouse_button.global_x,ev.mouse_button.global_y)); @@ -1369,10 +1385,7 @@ void Viewport::_make_input_local(InputEvent& ev) { } break; case InputEvent::MOUSE_MOTION: { - Vector2 vp_ofs; - if (parent_control) { - vp_ofs = (parent_control->get_viewport()->get_final_transform() * parent_control->get_global_transform_with_canvas()).get_origin(); - } + Vector2 vp_ofs = _get_window_offset(); Matrix32 ai = get_final_transform().affine_inverse() * _get_input_pre_xform(); Vector2 g = ai.xform(Vector2(ev.mouse_motion.global_x,ev.mouse_motion.global_y)); @@ -1393,10 +1406,7 @@ void Viewport::_make_input_local(InputEvent& ev) { } break; case InputEvent::SCREEN_TOUCH: { - Vector2 vp_ofs; - if (parent_control) { - vp_ofs = (parent_control->get_viewport()->get_final_transform() * parent_control->get_global_transform_with_canvas()).get_origin(); - } + Vector2 vp_ofs = _get_window_offset(); Matrix32 ai = get_final_transform().affine_inverse() * _get_input_pre_xform(); Vector2 t = ai.xform(Vector2(ev.screen_touch.x,ev.screen_touch.y)-vp_ofs); @@ -1408,10 +1418,7 @@ void Viewport::_make_input_local(InputEvent& ev) { } break; case InputEvent::SCREEN_DRAG: { - Vector2 vp_ofs; - if (parent_control) { - vp_ofs = (parent_control->get_viewport()->get_final_transform() * parent_control->get_global_transform_with_canvas()).get_origin(); - } + Vector2 vp_ofs = _get_window_offset(); Matrix32 ai = get_final_transform().affine_inverse() * _get_input_pre_xform(); Vector2 t = ai.xform(Vector2(ev.screen_drag.x,ev.screen_drag.y)-vp_ofs); @@ -1490,7 +1497,7 @@ void Viewport::_vp_unhandled_input(const InputEvent& p_ev) { Vector2 Viewport::get_mouse_pos() const { - return (get_final_transform().affine_inverse() * _get_input_pre_xform()).xform(Input::get_singleton()->get_mouse_pos()); + return (get_final_transform().affine_inverse() * _get_input_pre_xform()).xform(Input::get_singleton()->get_mouse_pos() - _get_window_offset()); } void Viewport::warp_mouse(const Vector2& p_pos) { @@ -2590,8 +2597,8 @@ void Viewport::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_rect","rect"), &Viewport::set_rect); ObjectTypeDB::bind_method(_MD("get_rect"), &Viewport::get_rect); - //ObjectTypeDB::bind_method(_MD("set_world_2d","world_2d:World2D"), &Viewport::set_world_2d); - //ObjectTypeDB::bind_method(_MD("get_world_2d:World2D"), &Viewport::get_world_2d); + ObjectTypeDB::bind_method(_MD("set_world_2d","world_2d:World2D"), &Viewport::set_world_2d); + ObjectTypeDB::bind_method(_MD("get_world_2d:World2D"), &Viewport::get_world_2d); ObjectTypeDB::bind_method(_MD("find_world_2d:World2D"), &Viewport::find_world_2d); ObjectTypeDB::bind_method(_MD("set_world","world:World"), &Viewport::set_world); ObjectTypeDB::bind_method(_MD("get_world:World"), &Viewport::get_world); diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 22a97a9888..f657f0507d 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -268,6 +268,8 @@ friend class Control; Control *_gui_get_focus_owner(); + Vector2 _get_window_offset() const; + friend class Listener; void _listener_transform_changed_notify(); void _listener_set(Listener* p_listener); @@ -303,9 +305,11 @@ public: RID get_viewport() const; void set_world(const Ref<World>& p_world); + void set_world_2d(const Ref<World2D>& p_world_2d); Ref<World> get_world() const; Ref<World> find_world() const; + Ref<World2D> get_world_2d() const; Ref<World2D> find_world_2d() const; diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index be2c12d63a..104aeb2b5e 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -55,6 +55,7 @@ #include "scene/gui/option_button.h" #include "scene/gui/color_picker.h" #include "scene/gui/texture_frame.h" +#include "scene/gui/color_rect.h" #include "scene/gui/patch_9_frame.h" #include "scene/gui/menu_button.h" #include "scene/gui/check_box.h" @@ -182,6 +183,7 @@ #include "scene/3d/spatial.h" +#include "scene/3d/remote_transform.h" #include "scene/3d/skeleton.h" #include "scene/3d/bone_attachment.h" #include "scene/3d/room_instance.h" @@ -338,6 +340,7 @@ void register_scene_types() { OS::get_singleton()->yield(); //may take time to init ObjectTypeDB::register_type<TextureFrame>(); + ObjectTypeDB::register_type<ColorFrame>(); ObjectTypeDB::register_type<Patch9Frame>(); ObjectTypeDB::register_type<TabContainer>(); ObjectTypeDB::register_type<Tabs>(); @@ -453,6 +456,7 @@ void register_scene_types() { ObjectTypeDB::register_type<BakedLightInstance>(); ObjectTypeDB::register_type<BakedLightSampler>(); ObjectTypeDB::register_type<WorldEnvironment>(); + ObjectTypeDB::register_type<RemoteTransform>(); ObjectTypeDB::register_virtual_type<Joint>(); ObjectTypeDB::register_type<PinJoint>(); diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 03f28bef08..dea612735c 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -40,7 +40,7 @@ typedef Map<const void*,Ref<ImageTexture> > TexCacheMap; static TexCacheMap *tex_cache; -static int scale=1; +static float scale=1; template<class T> static Ref<StyleBoxTexture> make_stylebox(T p_src,float p_left, float p_top, float p_right, float p_botton,float p_margin_left=-1, float p_margin_top=-1, float p_margin_right=-1, float p_margin_botton=-1, bool p_draw_center=true) { @@ -54,10 +54,21 @@ static Ref<StyleBoxTexture> make_stylebox(T p_src,float p_left, float p_top, flo texture = Ref<ImageTexture>( memnew( ImageTexture ) ); Image img(p_src); + if (scale>1) { + Size2 orig_size = Size2(img.get_width(),img.get_height()); + img.convert(Image::FORMAT_RGBA); img.expand_x2_hq2x(); + if (scale!=2.0) { + img.resize(orig_size.x*scale,orig_size.y*scale); + } + } else if (scale<1) { + Size2 orig_size = Size2(img.get_width(),img.get_height()); + img.convert(Image::FORMAT_RGBA); + img.resize(orig_size.x*scale,orig_size.y*scale); } + texture->create_from_image( img,ImageTexture::FLAG_FILTER ); (*tex_cache)[p_src]=texture; } @@ -95,8 +106,17 @@ static Ref<Texture> make_icon(T p_src) { Ref<ImageTexture> texture( memnew( ImageTexture ) ); Image img = Image(p_src); if (scale>1) { + Size2 orig_size = Size2(img.get_width(),img.get_height()); + img.convert(Image::FORMAT_RGBA); img.expand_x2_hq2x(); + if (scale!=2.0) { + img.resize(orig_size.x*scale,orig_size.y*scale); + } + } else if (scale<1) { + Size2 orig_size = Size2(img.get_width(),img.get_height()); + img.convert(Image::FORMAT_RGBA); + img.resize(orig_size.x*scale,orig_size.y*scale); } texture->create_from_image( img,ImageTexture::FLAG_FILTER ); @@ -194,12 +214,9 @@ static Ref<StyleBox> make_empty_stylebox(float p_margin_left=-1, float p_margin_ return style; } -void fill_default_theme(Ref<Theme>& t,const Ref<Font> & default_font,const Ref<Font> & large_font,Ref<Texture>& default_icon, Ref<StyleBox>& default_style,bool p_hidpi) { +void fill_default_theme(Ref<Theme>& t, const Ref<Font> & default_font, const Ref<Font> & large_font, Ref<Texture>& default_icon, Ref<StyleBox>& default_style, float p_scale) { - if (p_hidpi) - scale=2; - else - scale=1; + scale=p_scale; tex_cache = memnew( TexCacheMap ); @@ -969,7 +986,7 @@ void make_default_theme(bool p_hidpi,Ref<Font> p_font) { default_font=make_font2(_lodpi_font_height,_lodpi_font_ascent,_lodpi_font_charcount,&_lodpi_font_charrects[0][0],_lodpi_font_kerning_pair_count,&_lodpi_font_kerning_pairs[0][0],_lodpi_font_img_width,_lodpi_font_img_height,_lodpi_font_img_data); } Ref<BitmapFont> large_font=default_font; - fill_default_theme(t,default_font,large_font,default_icon,default_style,p_hidpi); + fill_default_theme(t,default_font,large_font,default_icon,default_style,p_hidpi?2.0:1.0); Theme::set_default( t ); Theme::set_default_icon( default_icon ); diff --git a/scene/resources/default_theme/default_theme.h b/scene/resources/default_theme/default_theme.h index a2a45ac004..3312b2d812 100644 --- a/scene/resources/default_theme/default_theme.h +++ b/scene/resources/default_theme/default_theme.h @@ -35,7 +35,7 @@ @author Juan Linietsky <reduzio@gmail.com> */ -void fill_default_theme(Ref<Theme>& theme,const Ref<Font> & default_font,const Ref<Font> & large_font,Ref<Texture>& default_icon, Ref<StyleBox>& default_style,bool p_hidpi); +void fill_default_theme(Ref<Theme>& theme,const Ref<Font> & default_font,const Ref<Font> & large_font,Ref<Texture>& default_icon, Ref<StyleBox>& default_style,float p_scale); void make_default_theme(bool p_hidpi, Ref<Font> p_font); void clear_default_theme(); diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 40ae26ba5d..02faa9425d 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -1483,6 +1483,8 @@ const ShaderGraph::InOutParamInfo ShaderGraph::inout_param_info[]={ {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightColor","LIGHT_COLOR.rgb","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightAlpha","LIGHT_COLOR.a","",SLOT_TYPE_SCALAR,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightHeight","LIGHT_HEIGHT","",SLOT_TYPE_SCALAR,SLOT_IN}, + {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowColor","LIGHT_SHADOW.rgb","",SLOT_TYPE_VEC,SLOT_IN}, + {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowAlpha","LIGHT_SHADOW.a","",SLOT_TYPE_SCALAR,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"TexPixelSize","vec3(TEXTURE_PIXEL_SIZE,0)","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_IN}, @@ -1490,6 +1492,8 @@ const ShaderGraph::InOutParamInfo ShaderGraph::inout_param_info[]={ //canvas item light out {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightColor","LIGHT.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightAlpha","LIGHT.a","",SLOT_TYPE_SCALAR,SLOT_OUT}, + {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowColor","SHADOW.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, + {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowAlpha","SHADOW.a","",SLOT_TYPE_SCALAR,SLOT_OUT}, //end {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,NULL,NULL,NULL,SLOT_TYPE_SCALAR,SLOT_OUT}, diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 9291aa6c17..77245c687d 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -136,7 +136,7 @@ bool LineShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_en return true; } -real_t LineShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t LineShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { return 0; } @@ -191,7 +191,7 @@ bool RayShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_end } -real_t RayShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t RayShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { return 0; //rays are mass-less } @@ -252,7 +252,7 @@ bool SegmentShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p return true; } -real_t SegmentShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t SegmentShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { Vector2 s[2]={a*p_scale,b*p_scale}; @@ -336,7 +336,7 @@ bool CircleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_ return true; } -real_t CircleShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t CircleShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { return (radius*radius)*(p_scale.x*0.5+p_scale.y*0.5); @@ -407,7 +407,7 @@ bool RectangleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& return get_aabb().intersects_segment(p_begin,p_end,&r_point,&r_normal); } -real_t RectangleShape2DSW::get_moment_of_inertia(float p_mass,const Vector2& p_scale) const { +real_t RectangleShape2DSW::get_moment_of_inertia(float p_mass,const Size2& p_scale) const { Vector2 he2=half_extents*2*p_scale; return p_mass*he2.dot(he2)/12.0f; @@ -540,7 +540,7 @@ bool CapsuleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p return collided; //todo } -real_t CapsuleShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t CapsuleShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { Vector2 he2=Vector2(radius*2,height+radius*2)*p_scale; return p_mass*he2.dot(he2)/12.0f; @@ -670,7 +670,7 @@ bool ConvexPolygonShape2DSW::intersect_segment(const Vector2& p_begin,const Vect return inters; //todo } -real_t ConvexPolygonShape2DSW::get_moment_of_inertia(float p_mass,const Vector2& p_scale) const { +real_t ConvexPolygonShape2DSW::get_moment_of_inertia(float p_mass,const Size2& p_scale) const { Rect2 aabb; aabb.pos=points[0].pos*p_scale; diff --git a/servers/physics_2d/shape_2d_sw.h b/servers/physics_2d/shape_2d_sw.h index 4164896696..b90c36bc04 100644 --- a/servers/physics_2d/shape_2d_sw.h +++ b/servers/physics_2d/shape_2d_sw.h @@ -86,7 +86,7 @@ public: virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const=0; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const=0; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const=0; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const=0; virtual void set_data(const Variant& p_data)=0; virtual Variant get_data() const=0; @@ -175,7 +175,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -218,7 +218,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -266,7 +266,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -304,7 +304,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -344,7 +344,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -432,7 +432,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -495,7 +495,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -584,7 +584,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const { return 0; } + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const { return 0; } virtual void set_data(const Variant& p_data); virtual Variant get_data() const; diff --git a/servers/visual/rasterizer.cpp b/servers/visual/rasterizer.cpp index 32f5b80e55..a4b91e17fe 100644 --- a/servers/visual/rasterizer.cpp +++ b/servers/visual/rasterizer.cpp @@ -290,9 +290,6 @@ RID Rasterizer::_create_shader(const FixedMaterialShaderKey& p_key) { //print_line("**VERTEX SHADER GENERATED code: \n"+vcode); - double tf = (OS::get_singleton()->get_ticks_usec()-t)/1000.0; -// print_line("generate: "+rtos(tf)); - shader_set_code(fms.shader,vcode,code,lcode,0,0); fixed_material_shaders[p_key]=fms; diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 09b3ada509..fdf3cb622d 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -1180,6 +1180,7 @@ const ShaderLanguage::BuiltinsDef ShaderLanguage::ci_light_builtins_defs[]={ { "LIGHT_HEIGHT", TYPE_FLOAT}, { "LIGHT_COLOR", TYPE_VEC4}, { "LIGHT_UV", TYPE_VEC2}, + { "LIGHT_SHADOW", TYPE_VEC4}, { "LIGHT", TYPE_VEC4}, { "SHADOW", TYPE_VEC4}, { "POINT_COORD", TYPE_VEC2}, diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index f7614ac080..8d228ad859 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -7534,10 +7534,10 @@ void VisualServerRaster::_draw_cursors_and_margins() { ERR_CONTINUE( !tex ); if (cursors[i].region.has_no_area()) { Point2 size(texture_get_width(tex), texture_get_height(tex)); - rasterizer->canvas_draw_rect(Rect2(cursors[i].pos, size), 0, Rect2(), tex, Color(1, 1, 1, 1)); + rasterizer->canvas_draw_rect(Rect2(cursors[i].pos-cursors[i].center, size), 0, Rect2(), tex, Color(1, 1, 1, 1)); } else { Point2 size = cursors[i].region.size; - rasterizer->canvas_draw_rect(Rect2(cursors[i].pos, size), Rasterizer::CANVAS_RECT_REGION, cursors[i].region, tex, Color(1, 1, 1, 1)); + rasterizer->canvas_draw_rect(Rect2(cursors[i].pos-cursors[i].center, size), Rasterizer::CANVAS_RECT_REGION, cursors[i].region, tex, Color(1, 1, 1, 1)); } }; diff --git a/tools/SCsub b/tools/SCsub index f6c14a13fb..aaebab724a 100644 --- a/tools/SCsub +++ b/tools/SCsub @@ -115,10 +115,7 @@ if (env["tools"]!="no"): env.Command('#tools/editor/builtin_fonts.h',flist,make_fonts_header) SConscript('editor/SCsub'); - #SConscript('scintilla/SCsub'); SConscript('collada/SCsub'); - SConscript('docdump/SCsub'); - #SConscript('freetype/SCsub'); SConscript('doc/SCsub') SConscript('pck/SCsub') diff --git a/tools/addheader/files b/tools/addheader/files deleted file mode 100644 index 7b0968236c..0000000000 --- a/tools/addheader/files +++ /dev/null @@ -1,158 +0,0 @@ -./scene/*.h -./scene/*.cpp -./scene/io/*.h -./scene/io/*.cpp -./scene/main/*.h -./scene/main/*.cpp -./scene/resources/*.h -./scene/resources/*.cpp -./scene/gui/*.h -./scene/gui/*.cpp -./scene/audio/*.h -./scene/audio/*.cpp -./scene/3d/*.h -./scene/3d/*.cpp -./scene/2d/*.h -./scene/2d/*.cpp -./scene/animation/*.h -./scene/animation/*.cpp -./bin/tests/*.h -./bin/tests/*.cpp -./main/*.h -./main/*.cpp -./modules/gridmap/*.h -./modules/gridmap/*.cpp -./servers/*.h -./servers/*.cpp -./servers/physics_2d/*.h -./servers/physics_2d/*.cpp -./servers/physics/*.h -./servers/physics/*.cpp -./servers/visual/*.h -./servers/visual/*.cpp -./servers/spatial_sound_2d/*.h -./servers/spatial_sound_2d/*.cpp -./servers/audio/*.h -./servers/audio/*.cpp -./tools/doc/doc_data.h -./tools/doc/doc_data.cpp -./tools/collada/collada.h -./tools/collada/collada.cpp -./tools/editor/*.h -./tools/editor/*.cpp -./tools/editor/plugins/*.h -./tools/editor/plugins/*.cpp -./tools/editor/io_plugins/*.h -./tools/editor/io_plugins/*.cpp -./tools/docdump/doc_dump.h -./tools/docdump/doc_dump.cpp -./core/*.h -./core/*.cpp -./core/io/object_format_binary.h -./core/io/file_access_buffered_fa.h -./core/io/file_access_buffered.h -./core/io/resource_saver.h -./core/io/file_access_compressed.cpp -./core/io/object_format_xml.cpp -./core/io/http_client.h -./core/io/object_format_xml.h -./core/io/compression.h -./core/io/ip_address.h -./core/io/file_access_pack.h -./core/io/ip.h -./core/io/tcp_server.h -./core/io/tcp_server.cpp -./core/io/packet_peer.cpp -./core/io/marshalls.h -./core/io/stream_peer.cpp -./core/io/resource_loader.cpp -./core/io/stream_peer_tcp.h -./core/io/stream_peer_tcp.cpp -./core/io/translation_loader_po.h -./core/io/zip_io.h -./core/io/ip_address.cpp -./core/io/object_saver_base.cpp -./core/io/object_loader.cpp -./core/io/xml_parser.h -./core/io/file_access_network.cpp -./core/io/resource_loader.h -./core/io/packet_peer.h -./core/io/stream_peer.h -./core/io/marshalls.cpp -./core/io/config_file.h -./core/io/ip.cpp -./core/io/file_access_zip.cpp -./core/io/resource_format_binary.h -./core/io/image_loader.h -./core/io/file_access_zip.h -./core/io/http_client.cpp -./core/io/file_access_memory.h -./core/io/xml_parser.cpp -./core/io/object_saver_base.h -./core/io/object_saver.cpp -./core/io/compression.cpp -./core/io/resource_format_xml.cpp -./core/io/object_format_binary.cpp -./core/io/file_access_compressed.h -./core/io/json.h -./core/io/file_access_pack.cpp -./core/io/resource_format_binary.cpp -./core/io/object_loader.h -./core/io/object_saver.h -./core/io/json.cpp -./core/io/file_access_network.h -./core/io/resource_saver.cpp -./core/io/file_access_memory.cpp -./core/io/image_loader.cpp -./core/io/resource_format_xml.h -./core/io/file_access_buffered.cpp -./core/io/config_file.cpp -./core/io/translation_loader_po.cpp -./core/os/*.h -./core/os/*.cpp -./core/math/*.h -./core/math/*.cpp -./script/gdscript/*.h -./script/gdscript/*.cpp -./script/multiscript/multi_script.cpp -./script/multiscript/multi_script.h -./script/register_script_types.h -./platform/android/*.h -./platform/android/*.cpp -./platform/android/java/src/com/android/godot/*.java -./platform/server/*.h -./platform/server/*.cpp -./platform/bb10/*.h -./platform/bb10/*.cpp -./platform/javascript/*.h -./platform/javascript/*.cpp -./platform/javascript/export/export.h -./platform/javascript/export/export.cpp -./platform/iphone/*.h -./platform/iphone/*.cpp -./platform/iphone/*.mm -./platform/windows/*.h -./platform/windows/*.cpp -./platform/osx/*.h -./platform/osx/*.cpp -./platform/osx/*.mm -./platform/x11/*.h -./platform/x11/*.cpp -./drivers/unix/*.h -./drivers/unix/*.cpp -./drivers/gles2/*.h -./drivers/gles2/*.cpp -./drivers/chibi/*.h -./drivers/chibi/*.cpp -./drivers/png/resource_saver_png.cpp -./drivers/png/image_loader_png.cpp -./drivers/png/image_loader_png.h -./drivers/vorbis/audio_stream_ogg_vorbis.h -./drivers/vorbis/audio_stream_ogg_vorbis.cpp -./drivers/gl_context/context_gl.h -./drivers/gles1/*.h -./drivers/gles1/*.cpp -./drivers/windows/*.h -./drivers/windows/*.cpp -./drivers/alsa/audio_driver_alsa.h -./drivers/alsa/audio_driver_alsa.cpp diff --git a/tools/addheader/header.txt b/tools/addheader/header.txt deleted file mode 100644 index e4efb2dcfc..0000000000 --- a/tools/addheader/header.txt +++ /dev/null @@ -1,12 +0,0 @@ -/*************************************************/ -/* $filename */ -/*************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/*************************************************/ -/* Source code within this file is: */ -/* (c) 2007-2016 Juan Linietsky, Ariel Manzur */ -/* All Rights Reserved. */ -/*************************************************/ - - diff --git a/tools/buildstuff/zlib_freetype231_jpeg_libpng-bin-win32-vs81.zip b/tools/buildstuff/zlib_freetype231_jpeg_libpng-bin-win32-vs81.zip Binary files differdeleted file mode 100644 index 4adf30ea29..0000000000 --- a/tools/buildstuff/zlib_freetype231_jpeg_libpng-bin-win32-vs81.zip +++ /dev/null diff --git a/tools/docker/Dockerfile b/tools/dist/docker/Dockerfile index 428de9d1a7..428de9d1a7 100644 --- a/tools/docker/Dockerfile +++ b/tools/dist/docker/Dockerfile diff --git a/tools/docker/README.md b/tools/dist/docker/README.md index 7f10b46ad8..7f10b46ad8 100644 --- a/tools/docker/README.md +++ b/tools/dist/docker/README.md diff --git a/tools/docker/scripts/install-android-tools b/tools/dist/docker/scripts/install-android-tools index 8a617d9942..8a617d9942 100644 --- a/tools/docker/scripts/install-android-tools +++ b/tools/dist/docker/scripts/install-android-tools diff --git a/tools/html_fs/godot.html b/tools/dist/html_fs/godot.html index c354826e1f..c354826e1f 100644 --- a/tools/html_fs/godot.html +++ b/tools/dist/html_fs/godot.html diff --git a/tools/html_fs/godotfs.js b/tools/dist/html_fs/godotfs.js index 2c59344cf5..2c59344cf5 100644 --- a/tools/html_fs/godotfs.js +++ b/tools/dist/html_fs/godotfs.js diff --git a/platform/iphone/xcode/godot_xcode/data.pck b/tools/dist/ios_xcode/godot_xcode/data.pck index e69de29bb2..e69de29bb2 100644 --- a/platform/iphone/xcode/godot_xcode/data.pck +++ b/tools/dist/ios_xcode/godot_xcode/data.pck diff --git a/platform/iphone/xcode/godot_xcode/godot_debug.iphone b/tools/dist/ios_xcode/godot_xcode/godot_debug.iphone index e69de29bb2..e69de29bb2 100755 --- a/platform/iphone/xcode/godot_xcode/godot_debug.iphone +++ b/tools/dist/ios_xcode/godot_xcode/godot_debug.iphone diff --git a/platform/iphone/xcode/godot_xcode/godot_ios.xcodeproj/project.pbxproj b/tools/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.pbxproj index bdba8488c8..bdba8488c8 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios.xcodeproj/project.pbxproj +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.pbxproj diff --git a/platform/iphone/xcode/godot_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tools/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 3c9ba38bbe..3c9ba38bbe 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Default-568h@2x~iphone.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-568h@2x~iphone.png Binary files differindex 1d5e472665..1d5e472665 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Default-568h@2x~iphone.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-568h@2x~iphone.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Default-667h.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-667h.png Binary files differindex b13a399c83..b13a399c83 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Default-667h.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-667h.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Default-667h@2x.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-667h@2x.png Binary files differindex b51598fed0..b51598fed0 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Default-667h@2x.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-667h@2x.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Default-736h.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-736h.png Binary files differindex 8c44edbccd..8c44edbccd 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Default-736h.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-736h.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Default-736h@3x.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-736h@3x.png Binary files differindex 33847ac136..33847ac136 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Default-736h@3x.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-736h@3x.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Default-Landscape-736h.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape-736h.png Binary files differindex 2a025b745b..2a025b745b 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Default-Landscape-736h.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape-736h.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Default-Landscape@2x~ipad.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape@2x~ipad.png Binary files differindex 7099f3e18d..7099f3e18d 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Default-Landscape@2x~ipad.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape@2x~ipad.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Default-Landscape~ipad.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape~ipad.png Binary files differindex 4a761c339a..4a761c339a 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Default-Landscape~ipad.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape~ipad.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Default-Portrait@2x~ipad.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait@2x~ipad.png Binary files differindex b09cf21186..b09cf21186 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Default-Portrait@2x~ipad.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait@2x~ipad.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Default-Portrait~ipad.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait~ipad.png Binary files differindex fa698eb70c..fa698eb70c 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Default-Portrait~ipad.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait~ipad.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Default@2x~iphone.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default@2x~iphone.png Binary files differindex ddf2861f4d..ddf2861f4d 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Default@2x~iphone.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default@2x~iphone.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Default~iphone.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default~iphone.png Binary files differindex c485a33b03..c485a33b03 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Default~iphone.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Default~iphone.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json index a458b67873..a458b67873 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.png Binary files differindex 165f4423b3..165f4423b3 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.png Binary files differindex 2e205e920c..2e205e920c 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.png Binary files differindex 6245f83f48..6245f83f48 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.png Binary files differindex 7b24e01bc6..7b24e01bc6 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.png Binary files differindex 344b470fa3..344b470fa3 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.png Binary files differindex 0dcebbc3f2..0dcebbc3f2 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.png Binary files differindex 9ae94e9aaf..9ae94e9aaf 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.png Binary files differindex 569f24df91..569f24df91 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.png Binary files differindex 9e69ed3121..9e69ed3121 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.png Binary files differindex b970fa3067..b970fa3067 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.png Binary files differindex 6097a6c73b..6097a6c73b 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.png Binary files differindex 21b9622eb6..21b9622eb6 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.png Binary files differindex 34dea8e6ad..34dea8e6ad 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.png Binary files differindex f72eb0b345..f72eb0b345 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.png Binary files differindex 793c9b1f5f..793c9b1f5f 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.png Binary files differindex 7cd0e054ab..7cd0e054ab 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.png b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.png Binary files differindex e9b2429754..e9b2429754 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.png +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.png diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes index e328a62cb6..e328a62cb6 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/en.lproj/InfoPlist.strings b/tools/dist/ios_xcode/godot_xcode/godot_ios/en.lproj/InfoPlist.strings index 477b28ff8f..477b28ff8f 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/en.lproj/InfoPlist.strings +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/en.lproj/InfoPlist.strings diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/godot_ios-Info.plist b/tools/dist/ios_xcode/godot_xcode/godot_ios/godot_ios-Info.plist index f97b0fca36..f97b0fca36 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/godot_ios-Info.plist +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/godot_ios-Info.plist diff --git a/platform/iphone/xcode/godot_xcode/godot_ios/main.m b/tools/dist/ios_xcode/godot_xcode/godot_ios/main.m index 3e4ea5e129..3e4ea5e129 100644 --- a/platform/iphone/xcode/godot_xcode/godot_ios/main.m +++ b/tools/dist/ios_xcode/godot_xcode/godot_ios/main.m diff --git a/platform/iphone/xcode/godot_xcode/godot_opt.iphone b/tools/dist/ios_xcode/godot_xcode/godot_opt.iphone index e69de29bb2..e69de29bb2 100755 --- a/platform/iphone/xcode/godot_xcode/godot_opt.iphone +++ b/tools/dist/ios_xcode/godot_xcode/godot_opt.iphone diff --git a/tools/osx_template.app/Contents/Info.plist b/tools/dist/osx_template.app/Contents/Info.plist index 5146c875bc..5146c875bc 100755 --- a/tools/osx_template.app/Contents/Info.plist +++ b/tools/dist/osx_template.app/Contents/Info.plist diff --git a/tools/Godot.app/Contents/PkgInfo b/tools/dist/osx_template.app/Contents/PkgInfo index 6f749b0f37..6f749b0f37 100644 --- a/tools/Godot.app/Contents/PkgInfo +++ b/tools/dist/osx_template.app/Contents/PkgInfo diff --git a/tools/osx_template.app/Contents/Resources/icon.icns b/tools/dist/osx_template.app/Contents/Resources/icon.icns Binary files differindex 375f61437d..375f61437d 100644 --- a/tools/osx_template.app/Contents/Resources/icon.icns +++ b/tools/dist/osx_template.app/Contents/Resources/icon.icns diff --git a/tools/Godot.app/Contents/Info.plist b/tools/dist/osx_tools.app/Contents/Info.plist index 2a3e727133..2a3e727133 100755 --- a/tools/Godot.app/Contents/Info.plist +++ b/tools/dist/osx_tools.app/Contents/Info.plist diff --git a/tools/osx_template.app/Contents/PkgInfo b/tools/dist/osx_tools.app/Contents/PkgInfo index 6f749b0f37..6f749b0f37 100644 --- a/tools/osx_template.app/Contents/PkgInfo +++ b/tools/dist/osx_tools.app/Contents/PkgInfo diff --git a/tools/Godot.app/Contents/Resources/Godot.icns b/tools/dist/osx_tools.app/Contents/Resources/Godot.icns Binary files differindex 375f61437d..375f61437d 100644 --- a/tools/Godot.app/Contents/Resources/Godot.icns +++ b/tools/dist/osx_tools.app/Contents/Resources/Godot.icns diff --git a/tools/dist/uwp_template/AppxManifest.xml b/tools/dist/uwp_template/AppxManifest.xml new file mode 100644 index 0000000000..48a2ba7eb3 --- /dev/null +++ b/tools/dist/uwp_template/AppxManifest.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp build" xmlns:build="http://schemas.microsoft.com/developer/appx/2015/build">
+ <Identity Name="$identity_name$" Publisher="$publisher$" Version="$version_string$" ProcessorArchitecture="$architecture$" />
+ <mp:PhoneIdentity PhoneProductId="$product_guid$" PhonePublisherId="$publisher_guid$" />
+ <Properties>
+ <DisplayName>$display_name$</DisplayName>
+ <PublisherDisplayName>$publisher_display_name$</PublisherDisplayName>
+ <Logo>Assets\StoreLogo.png</Logo>
+ </Properties>
+ <Dependencies>
+ <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10240.0" MaxVersionTested="10.0.14393.0" />
+ <PackageDependency Name="Microsoft.VCLibs.140.00" MinVersion="14.0.24123.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
+ </Dependencies>
+ <Resources>
+ <Resource Language="EN-US" />
+ </Resources>
+ <Applications>
+ <Application Id="App" Executable="godot.winrt.exe" EntryPoint="GodotWinRT.App">
+ <uap:VisualElements DisplayName="$display_name$" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="$app_description$" BackgroundColor="$bg_color$">
+ <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" Square310x310Logo="Assets\Square310x310Logo.png" Square71x71Logo="Assets\Square71x71Logo.png" ShortName="$short_name$">
+ $name_on_tiles$
+ </uap:DefaultTile>
+ <uap:SplashScreen Image="Assets\SplashScreen.png" />
+ $rotation_preference$
+ </uap:VisualElements>
+ </Application>
+ </Applications>
+ $capabilities_place$
+ <build:Metadata>
+ <build:Item Name="GodotEngine" Version="$godot_version$" />
+ </build:Metadata>
+</Package>
\ No newline at end of file diff --git a/tools/dist/uwp_template/Assets/SplashScreen.scale-100.png b/tools/dist/uwp_template/Assets/SplashScreen.scale-100.png Binary files differnew file mode 100644 index 0000000000..540bfb1c01 --- /dev/null +++ b/tools/dist/uwp_template/Assets/SplashScreen.scale-100.png diff --git a/tools/dist/uwp_template/Assets/Square150x150Logo.scale-100.png b/tools/dist/uwp_template/Assets/Square150x150Logo.scale-100.png Binary files differnew file mode 100644 index 0000000000..6cff663eb5 --- /dev/null +++ b/tools/dist/uwp_template/Assets/Square150x150Logo.scale-100.png diff --git a/tools/dist/uwp_template/Assets/Square310x310Logo.scale-100.png b/tools/dist/uwp_template/Assets/Square310x310Logo.scale-100.png Binary files differnew file mode 100644 index 0000000000..12ec232c87 --- /dev/null +++ b/tools/dist/uwp_template/Assets/Square310x310Logo.scale-100.png diff --git a/tools/dist/uwp_template/Assets/Square44x44Logo.scale-100.png b/tools/dist/uwp_template/Assets/Square44x44Logo.scale-100.png Binary files differnew file mode 100644 index 0000000000..ad059994ed --- /dev/null +++ b/tools/dist/uwp_template/Assets/Square44x44Logo.scale-100.png diff --git a/tools/dist/uwp_template/Assets/Square71x71Logo.scale-100.png b/tools/dist/uwp_template/Assets/Square71x71Logo.scale-100.png Binary files differnew file mode 100644 index 0000000000..b1bf331365 --- /dev/null +++ b/tools/dist/uwp_template/Assets/Square71x71Logo.scale-100.png diff --git a/tools/dist/uwp_template/Assets/StoreLogo.scale-100.png b/tools/dist/uwp_template/Assets/StoreLogo.scale-100.png Binary files differnew file mode 100644 index 0000000000..8d7a625c82 --- /dev/null +++ b/tools/dist/uwp_template/Assets/StoreLogo.scale-100.png diff --git a/tools/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png b/tools/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png Binary files differnew file mode 100644 index 0000000000..b06f1ad50f --- /dev/null +++ b/tools/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp index 479b99a03d..4a8fdfb215 100644 --- a/tools/doc/doc_data.cpp +++ b/tools/doc/doc_data.cpp @@ -198,6 +198,11 @@ void DocData::generate(bool p_basic_types) { if (method.qualifiers!="") method.qualifiers+=" "; method.qualifiers+="const"; + + } else if (E->get().flags&METHOD_FLAG_VARARG) { + if (method.qualifiers!="") + method.qualifiers+=" "; + method.qualifiers+="vararg"; } for(int i=-1;i<E->get().arguments.size();i++) { diff --git a/tools/docdump/doc_dump.cpp b/tools/doc/doc_dump.cpp index fbf13f9e8f..fbf13f9e8f 100644 --- a/tools/docdump/doc_dump.cpp +++ b/tools/doc/doc_dump.cpp diff --git a/tools/docdump/doc_dump.h b/tools/doc/doc_dump.h index 372f5e0969..372f5e0969 100644 --- a/tools/docdump/doc_dump.h +++ b/tools/doc/doc_dump.h diff --git a/tools/docdump/SCsub b/tools/docdump/SCsub deleted file mode 100644 index 34524f10ef..0000000000 --- a/tools/docdump/SCsub +++ /dev/null @@ -1,5 +0,0 @@ -Import('env') - -env.add_source_files(env.tool_sources,"*.cpp") - -Export('env') diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index 2779275ea8..9240e3527c 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -356,7 +356,7 @@ void FindReplaceBar::_show_search() { show(); search_text->grab_focus(); - if (text_edit->is_selection_active()) { + if (text_edit->is_selection_active() && !selection_only->is_pressed()) { search_text->set_text(text_edit->get_selection_text()); } @@ -376,12 +376,16 @@ void FindReplaceBar::popup_search() { void FindReplaceBar::popup_replace() { + if (!replace_hbc->is_visible() || !replace_options_hbc->is_visible()) { replace_text->clear(); replace_hbc->show(); replace_options_hbc->show(); + } + selection_only->set_pressed( (text_edit->is_selection_active() && text_edit->get_selection_from_line() < text_edit->get_selection_to_line()) ); + _show_search(); } @@ -409,6 +413,14 @@ void FindReplaceBar::_search_text_entered(const String& p_text) { search_next(); } +void FindReplaceBar::_replace_text_entered(const String& p_text) { + + if (selection_only->is_pressed() && text_edit->is_selection_active()) { + _replace_all(); + _hide_bar(); + } +} + String FindReplaceBar::get_search_text() const { return search_text->get_text(); @@ -452,6 +464,7 @@ void FindReplaceBar::_bind_methods() { ObjectTypeDB::bind_method("_editor_text_changed",&FindReplaceBar::_editor_text_changed); ObjectTypeDB::bind_method("_search_text_changed",&FindReplaceBar::_search_text_changed); ObjectTypeDB::bind_method("_search_text_entered",&FindReplaceBar::_search_text_entered); + ObjectTypeDB::bind_method("_replace_text_entered",&FindReplaceBar::_replace_text_entered); ObjectTypeDB::bind_method("_search_current",&FindReplaceBar::search_current); ObjectTypeDB::bind_method("_search_next",&FindReplaceBar::search_next); ObjectTypeDB::bind_method("_search_prev",&FindReplaceBar::search_prev); @@ -497,18 +510,19 @@ FindReplaceBar::FindReplaceBar() { replace_text = memnew(LineEdit); replace_hbc->add_child(replace_text); replace_text->set_custom_minimum_size(Size2(200, 0)); - replace_text->connect("text_entered",this,"_search_text_entered"); + replace_text->connect("text_entered",this,"_replace_text_entered"); + - replace = memnew(ToolButton); + replace = memnew(Button); replace_hbc->add_child(replace); replace->set_text(TTR("Replace")); - replace->set_focus_mode(FOCUS_NONE); + //replace->set_focus_mode(FOCUS_NONE); replace->connect("pressed",this,"_replace_pressed"); - replace_all = memnew(ToolButton); + replace_all = memnew(Button); replace_hbc->add_child(replace_all); replace_all->set_text(TTR("Replace All")); - replace_all->set_focus_mode(FOCUS_NONE); + //replace_all->set_focus_mode(FOCUS_NONE); replace_all->connect("pressed",this,"_replace_all_pressed"); Control *spacer_split = memnew( Control ); @@ -581,8 +595,10 @@ void FindReplaceDialog::popup_search() { void FindReplaceDialog::popup_replace() { + set_title(TTR("Replace")); bool do_selection=(text_edit->is_selection_active() && text_edit->get_selection_from_line() < text_edit->get_selection_to_line()); + set_replace_selection_only(do_selection); if (!do_selection && text_edit->is_selection_active()) { @@ -1112,8 +1128,10 @@ void CodeTextEditor::_update_font() { font_overridden = true; } } - if(!font_overridden) + if(!font_overridden) { + text_editor->add_font_override("font",get_font("source","EditorFonts")); + } } void CodeTextEditor::_on_settings_change() { @@ -1152,7 +1170,7 @@ void CodeTextEditor::_notification(int p_what) { _load_theme_settings(); emit_signal("load_theme_settings"); } - if (p_what==NOTIFICATION_ENTER_TREE) { + if (p_what==NOTIFICATION_THEME_CHANGED) { _update_font(); } } diff --git a/tools/editor/code_editor.h b/tools/editor/code_editor.h index 2affa31482..6f59dda1ee 100644 --- a/tools/editor/code_editor.h +++ b/tools/editor/code_editor.h @@ -73,8 +73,8 @@ class FindReplaceBar : public HBoxContainer { TextureButton *hide_button; LineEdit *replace_text; - ToolButton *replace; - ToolButton *replace_all; + Button *replace; + Button *replace_all; CheckBox *selection_only; VBoxContainer *text_vbc; @@ -98,6 +98,7 @@ class FindReplaceBar : public HBoxContainer { void _search_options_changed(bool p_pressed); void _search_text_changed(const String& p_text); void _search_text_entered(const String& p_text); + void _replace_text_entered(const String& p_text); protected: void _notification(int p_what); diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp index 5aac8bff09..320939cb97 100644 --- a/tools/editor/create_dialog.cpp +++ b/tools/editor/create_dialog.cpp @@ -42,11 +42,84 @@ void CreateDialog::popup(bool p_dontclear) { + recent->clear(); + + FileAccess *f = FileAccess::open( EditorSettings::get_singleton()->get_project_settings_path().plus_file("create_recent."+base_type), FileAccess::READ ); + + if (f) { + + TreeItem *root = recent->create_item(); + + while(!f->eof_reached()) { + String l = f->get_line().strip_edges(); + + if (l!=String()) { + + TreeItem *ti = recent->create_item(root); + ti->set_text(0,l); + if (has_icon(l,"EditorIcons")) { + + ti->set_icon(0,get_icon(l,"EditorIcons")); + } else { + ti->set_icon(0,get_icon("Object","EditorIcons")); + } + } + } + + memdelete(f); + } + + favorites->clear(); + + f = FileAccess::open( EditorSettings::get_singleton()->get_project_settings_path().plus_file("favorites."+base_type), FileAccess::READ ); + + favorite_list.clear(); + + if (f) { + + + while(!f->eof_reached()) { + String l = f->get_line().strip_edges(); + + if (l!=String()) { + favorite_list.push_back(l); + } + } + + memdelete(f); + } else { +#if 0 +// I think this was way too confusing + if (base_type=="Node") { + //harcode some favorites :D + favorite_list.push_back("Panel"); + favorite_list.push_back("Button"); + favorite_list.push_back("Label"); + favorite_list.push_back("LineEdit"); + favorite_list.push_back("Node2D"); + favorite_list.push_back("Sprite"); + favorite_list.push_back("Camera2D"); + favorite_list.push_back("Area2D"); + favorite_list.push_back("CollisionShape2D"); + favorite_list.push_back("Spatial"); + favorite_list.push_back("Camera"); + favorite_list.push_back("Area"); + favorite_list.push_back("CollisionShape"); + favorite_list.push_back("TestCube"); + favorite_list.push_back("AnimationPlayer"); + + } +#endif + } + + _update_favorite_list(); + popup_centered_ratio(); if (p_dontclear) search_box->select_all(); - else + else { search_box->clear(); + } search_box->grab_focus(); _update_search(); @@ -104,7 +177,7 @@ void CreateDialog::add_type(const String& p_type,HashMap<String,TreeItem*>& p_ty item->set_selectable(0,false); } else { - if (!*to_select && (search_box->get_text().is_subsequence_ofi(p_type))) { + if ((!*to_select && (search_box->get_text().is_subsequence_ofi(p_type))) || search_box->get_text()==p_type) { *to_select=item; } @@ -140,6 +213,8 @@ void CreateDialog::_update_search() { search_options->clear(); + favorite->set_disabled(true); + help_bit->set_text(""); /* TreeItem *root = search_options->create_item(); @@ -225,7 +300,7 @@ void CreateDialog::_update_search() { } - if (!to_select) { + if (!to_select || ct[i].name==search_box->get_text()) { to_select=item; } @@ -234,8 +309,11 @@ void CreateDialog::_update_search() { } } - if (to_select) + if (to_select) { to_select->select(0); + favorite->set_disabled(false); + favorite->set_pressed(favorite_list.find(to_select->get_text(0))!=-1); + } get_ok()->set_disabled(root->get_children()==NULL); @@ -246,6 +324,32 @@ void CreateDialog::_confirmed() { TreeItem *ti = search_options->get_selected(); if (!ti) return; + + FileAccess *f = FileAccess::open( EditorSettings::get_singleton()->get_project_settings_path().plus_file("create_recent."+base_type), FileAccess::WRITE ); + + if (f) { + f->store_line(get_selected_type()); + TreeItem *t = recent->get_root(); + if (t) + t=t->get_children(); + int count=0; + while(t) { + if (t->get_text(0)!=get_selected_type()) { + + f->store_line(t->get_text(0)); + } + + if (count>32) { + //limit it to 32 entries.. + break; + } + t=t->get_next(); + count++; + } + + memdelete(f); + } + emit_signal("create"); hide(); } @@ -255,6 +359,7 @@ void CreateDialog::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { connect("confirmed",this,"_confirmed"); + favorite->set_icon(get_icon("Favorites","EditorIcons")); } if (p_what==NOTIFICATION_EXIT_TREE) { @@ -344,6 +449,9 @@ void CreateDialog::_item_selected() { String name = item->get_text(0); + favorite->set_disabled(false); + favorite->set_pressed(favorite_list.find(name)!=-1); + if (!EditorHelp::get_doc_data()->class_list.has(name)) return; @@ -351,12 +459,182 @@ void CreateDialog::_item_selected() { } + +void CreateDialog::_favorite_toggled() { + + TreeItem *item = search_options->get_selected(); + if (!item) + return; + + String name = item->get_text(0); + + if (favorite_list.find(name)==-1) { + favorite_list.push_back(name); + favorite->set_pressed(true); + } else { + favorite_list.erase(name); + favorite->set_pressed(false); + } + + _save_favorite_list(); + _update_favorite_list(); +} + +void CreateDialog::_save_favorite_list() { + + FileAccess *f = FileAccess::open( EditorSettings::get_singleton()->get_project_settings_path().plus_file("favorites."+base_type), FileAccess::WRITE ); + + if (f) { + + for(int i=0;i<favorite_list.size();i++) { + + f->store_line(favorite_list[i]); + } + memdelete(f); + } +} + +void CreateDialog::_update_favorite_list() { + + favorites->clear(); + TreeItem *root = favorites->create_item(); + for(int i=0;i<favorite_list.size();i++) { + TreeItem *ti = favorites->create_item(root); + String l = favorite_list[i]; + ti->set_text(0,l); + + if (has_icon(l,"EditorIcons")) { + + ti->set_icon(0,get_icon(l,"EditorIcons")); + } else { + ti->set_icon(0,get_icon("Object","EditorIcons")); + } + } +} + + +void CreateDialog::_history_selected() { + + TreeItem *item = recent->get_selected(); + if (!item) + return; + + search_box->set_text(item->get_text(0)); + _update_search(); + +} + +void CreateDialog::_favorite_selected(){ + + TreeItem *item = favorites->get_selected(); + if (!item) + return; + + search_box->set_text(item->get_text(0)); + _update_search(); + +} + +void CreateDialog::_history_activated() { + + _confirmed(); +} + +void CreateDialog::_favorite_activated(){ + + _confirmed(); +} + +Variant CreateDialog::get_drag_data_fw(const Point2& p_point,Control* p_from) { + + TreeItem *ti = favorites->get_item_at_pos(p_point); + if (ti) { + Dictionary d; + d["type"]="create_favorite_drag"; + d["class"]=ti->get_text(0); + + ToolButton *tb = memnew( ToolButton ); + tb->set_icon(ti->get_icon(0)); + tb->set_text(ti->get_text(0)); + set_drag_preview(tb); + + return d; + } + + return Variant(); +} + +bool CreateDialog::can_drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from) const{ + + Dictionary d = p_data; + if (d.has("type") && String(d["type"])=="create_favorite_drag") { + favorites->set_drop_mode_flags(Tree::DROP_MODE_INBETWEEN); + return true; + } + + return false; +} +void CreateDialog::drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from){ + + Dictionary d = p_data; + + TreeItem *ti = favorites->get_item_at_pos(p_point); + if (!ti) + return; + + String drop_at = ti->get_text(0); + int ds = favorites->get_drop_section_at_pos(p_point); + + int drop_idx = favorite_list.find(drop_at); + if (drop_idx<0) + return; + + String type = d["class"]; + + int from_idx = favorite_list.find(type); + if (from_idx<0) + return; + + if (drop_idx==from_idx) { + ds=-1; //cause it will be gone + } else if (drop_idx>from_idx) { + drop_idx--; + } + + favorite_list.remove(from_idx); + + if (ds<0) { + favorite_list.insert(drop_idx,type); + } else { + if (drop_idx>=favorite_list.size()-1) { + favorite_list.push_back(type); + } else { + favorite_list.insert(drop_idx+1,type); + } + } + + _save_favorite_list(); + _update_favorite_list(); + + +} + void CreateDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("_text_changed"),&CreateDialog::_text_changed); ObjectTypeDB::bind_method(_MD("_confirmed"),&CreateDialog::_confirmed); ObjectTypeDB::bind_method(_MD("_sbox_input"),&CreateDialog::_sbox_input); ObjectTypeDB::bind_method(_MD("_item_selected"),&CreateDialog::_item_selected); + ObjectTypeDB::bind_method(_MD("_favorite_toggled"),&CreateDialog::_favorite_toggled); + ObjectTypeDB::bind_method(_MD("_history_selected"),&CreateDialog::_history_selected); + ObjectTypeDB::bind_method(_MD("_favorite_selected"),&CreateDialog::_favorite_selected); + ObjectTypeDB::bind_method(_MD("_history_activated"),&CreateDialog::_history_activated); + ObjectTypeDB::bind_method(_MD("_favorite_activated"),&CreateDialog::_favorite_activated); + + + ObjectTypeDB::bind_method("get_drag_data_fw",&CreateDialog::get_drag_data_fw); + ObjectTypeDB::bind_method("can_drop_data_fw",&CreateDialog::can_drop_data_fw); + ObjectTypeDB::bind_method("drop_data_fw",&CreateDialog::drop_data_fw); ADD_SIGNAL(MethodInfo("create")); @@ -365,12 +643,44 @@ void CreateDialog::_bind_methods() { CreateDialog::CreateDialog() { + HSplitContainer *hbc = memnew( HSplitContainer ); + + add_child(hbc); + set_child_rect(hbc); + + VBoxContainer *lvbc = memnew( VBoxContainer); + hbc->add_child(lvbc); + lvbc->set_custom_minimum_size(Size2(150,0)*EDSCALE); + + favorites = memnew (Tree ); + lvbc->add_margin_child(TTR("Favorites:"),favorites,true); + favorites->set_hide_root(true); + favorites->set_hide_folding(true); + favorites->connect("cell_selected",this,"_favorite_selected"); + favorites->connect("item_activated",this,"_favorite_activated"); + favorites->set_drag_forwarding(this); + + + recent = memnew (Tree ); + lvbc->add_margin_child(TTR("Recent:"),recent,true); + recent->set_hide_root(true); + recent->set_hide_folding(true); + recent->connect("cell_selected",this,"_history_selected"); + recent->connect("item_activated",this,"_history_activated"); + VBoxContainer *vbc = memnew( VBoxContainer ); - add_child(vbc); - set_child_rect(vbc); + hbc->add_child(vbc); + vbc->set_h_size_flags(SIZE_EXPAND_FILL); + HBoxContainer *search_hb = memnew( HBoxContainer ); search_box = memnew( LineEdit ); - vbc->add_margin_child(TTR("Search:"),search_box); + search_box->set_h_size_flags(SIZE_EXPAND_FILL); + search_hb->add_child(search_box); + favorite = memnew( Button ); + favorite->set_toggle_mode(true); + search_hb->add_child(favorite); + favorite->connect("pressed",this,"_favorite_toggled"); + vbc->add_margin_child(TTR("Search:"),search_hb); search_box->connect("text_changed",this,"_text_changed"); search_box->connect("input_event",this,"_sbox_input"); search_options = memnew( Tree ); diff --git a/tools/editor/create_dialog.h b/tools/editor/create_dialog.h index 41156b538a..706a06ae16 100644 --- a/tools/editor/create_dialog.h +++ b/tools/editor/create_dialog.h @@ -32,6 +32,7 @@ #include "scene/gui/dialogs.h" #include "scene/gui/button.h" #include "scene/gui/tree.h" +#include "scene/gui/item_list.h" #include "scene/gui/line_edit.h" #include "scene/gui/label.h" #include "editor_help.h" @@ -46,6 +47,12 @@ class CreateDialog : public ConfirmationDialog { OBJ_TYPE(CreateDialog,ConfirmationDialog ) + + Vector<String> favorite_list; + Tree *favorites; + Tree *recent; + + Button *favorite; LineEdit *search_box; Tree *search_options; String base_type; @@ -55,6 +62,15 @@ class CreateDialog : public ConfirmationDialog { void _item_selected(); void _update_search(); + void _update_favorite_list(); + void _save_favorite_list(); + void _favorite_toggled(); + + void _history_selected(); + void _favorite_selected(); + + void _history_activated(); + void _favorite_activated(); void _sbox_input(const InputEvent& p_ie); @@ -63,6 +79,9 @@ class CreateDialog : public ConfirmationDialog { void add_type(const String& p_type,HashMap<String,TreeItem*>& p_types,TreeItem *p_root,TreeItem **to_select); + Variant get_drag_data_fw(const Point2& p_point,Control* p_from); + bool can_drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from) const; + void drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from); protected: diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index 35ec1ebfcc..8fc18b5b39 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -877,8 +877,7 @@ bool EditorSelection::is_selected(Node * p_node) const { return selection.has(p_node); } - -Array EditorSelection::_get_selected_nodes() { +Array EditorSelection::_get_transformable_selected_nodes() { Array ret; @@ -890,6 +889,18 @@ Array EditorSelection::_get_selected_nodes() { return ret; } +Array EditorSelection::_get_selected_nodes() { + + Array ret; + + for (Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) { + + ret.push_back(E->key()); + } + + return ret; +} + void EditorSelection::_bind_methods() { ObjectTypeDB::bind_method(_MD("_node_removed"),&EditorSelection::_node_removed); @@ -897,6 +908,7 @@ void EditorSelection::_bind_methods() { ObjectTypeDB::bind_method(_MD("add_node","node:Node"),&EditorSelection::add_node); ObjectTypeDB::bind_method(_MD("remove_node","node:Node"),&EditorSelection::remove_node); ObjectTypeDB::bind_method(_MD("get_selected_nodes"),&EditorSelection::_get_selected_nodes); + ObjectTypeDB::bind_method(_MD("get_transformable_selected_nodes"),&EditorSelection::_get_transformable_selected_nodes); ADD_SIGNAL( MethodInfo("selection_changed") ); } diff --git a/tools/editor/editor_data.h b/tools/editor/editor_data.h index a0b716f560..59f9d4e4f3 100644 --- a/tools/editor/editor_data.h +++ b/tools/editor/editor_data.h @@ -233,6 +233,8 @@ public: void _update_nl(); Array _get_selected_nodes(); + Array _get_transformable_selected_nodes(); + protected: static void _bind_methods(); diff --git a/tools/editor/editor_dir_dialog.cpp b/tools/editor/editor_dir_dialog.cpp index f6ce7bf3f8..cf0732501e 100644 --- a/tools/editor/editor_dir_dialog.cpp +++ b/tools/editor/editor_dir_dialog.cpp @@ -143,7 +143,7 @@ void EditorDirDialog::set_current_path(const String& p_path) { reload(); String p = p_path; if (p.begins_with("res://")) - p.replace_first("res://",""); + p = p.replace_first("res://",""); Vector<String> dirs = p.split("/"); @@ -162,13 +162,13 @@ void EditorDirDialog::set_current_path(const String& p_path) { ERR_FAIL_COND(!p); String pp = p->get_metadata(0); if (pp=="") { + p->set_metadata(0,String(r->get_metadata(0)).plus_file(d)); _update_dir(p); - updating=true; - p->set_collapsed(false); - updating=false; - _item_collapsed(p); - } + updating=true; + p->set_collapsed(false); + updating=false; + _item_collapsed(p); r=p; } @@ -216,7 +216,7 @@ void EditorDirDialog::_make_dir_confirm() { if (err!=OK) { mkdirerr->popup_centered_minsize(Size2(250,80)); } else { - reload(); + set_current_path(dir.plus_file(makedirname->get_text())); } makedirname->set_text(""); // reset label } diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index 582b9e2490..be1af16576 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -208,10 +208,14 @@ void EditorFileSystemDirectory::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_file_count"),&EditorFileSystemDirectory::get_file_count); ObjectTypeDB::bind_method(_MD("get_file","idx"),&EditorFileSystemDirectory::get_file); ObjectTypeDB::bind_method(_MD("get_file_path","idx"),&EditorFileSystemDirectory::get_file_path); - ObjectTypeDB::bind_method(_MD("get_file_types","idx"),&EditorFileSystemDirectory::get_file_type); + ObjectTypeDB::bind_method(_MD("get_file_type","idx"),&EditorFileSystemDirectory::get_file_type); ObjectTypeDB::bind_method(_MD("is_missing_sources","idx"),&EditorFileSystemDirectory::is_missing_sources); ObjectTypeDB::bind_method(_MD("get_name"),&EditorFileSystemDirectory::get_name); - ObjectTypeDB::bind_method(_MD("get_parent"),&EditorFileSystemDirectory::get_parent); + ObjectTypeDB::bind_method(_MD("get_path"),&EditorFileSystemDirectory::get_path); + ObjectTypeDB::bind_method(_MD("get_parent:EditorFileSystemDirectory"),&EditorFileSystemDirectory::get_parent); + ObjectTypeDB::bind_method(_MD("find_file_index","name"),&EditorFileSystemDirectory::find_file_index); + ObjectTypeDB::bind_method(_MD("find_dir_index","name"),&EditorFileSystemDirectory::find_dir_index); + } @@ -1341,6 +1345,16 @@ void EditorFileSystem::update_file(const String& p_file) { void EditorFileSystem::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("get_filesystem:EditorFileSystemDirectory"),&EditorFileSystem::get_filesystem); + ObjectTypeDB::bind_method(_MD("is_scanning"),&EditorFileSystem::is_scanning); + ObjectTypeDB::bind_method(_MD("get_scanning_progress"),&EditorFileSystem::get_scanning_progress); + ObjectTypeDB::bind_method(_MD("scan"),&EditorFileSystem::scan); + ObjectTypeDB::bind_method(_MD("scan_sources"),&EditorFileSystem::scan_sources); + ObjectTypeDB::bind_method(_MD("update_file","path"),&EditorFileSystem::update_file); + ObjectTypeDB::bind_method(_MD("get_path:EditorFileSystemDirectory","path"),&EditorFileSystem::get_path); + ObjectTypeDB::bind_method(_MD("get_file_type","path"),&EditorFileSystem::get_file_type); + ADD_SIGNAL( MethodInfo("filesystem_changed") ); ADD_SIGNAL( MethodInfo("sources_changed",PropertyInfo(Variant::BOOL,"exist")) ); diff --git a/tools/editor/editor_fonts.cpp b/tools/editor/editor_fonts.cpp index 47891eef6c..bcf41cbac8 100644 --- a/tools/editor/editor_fonts.cpp +++ b/tools/editor/editor_fonts.cpp @@ -158,17 +158,10 @@ void editor_register_fonts(Ref<Theme> p_theme) { p_theme->set_font("doc_source","EditorFonts",df_doc_code); - if (editor_is_hidpi()) { - //replace default theme - Ref<Texture> di; - Ref<StyleBox> ds; - fill_default_theme(p_theme,df,df_doc,di,ds,true); + //replace default theme + Ref<Texture> di; + Ref<StyleBox> ds; + fill_default_theme(p_theme,df,df_doc,di,ds,EDSCALE); - } else { - Ref<Texture> di; - Ref<StyleBox> ds; - fill_default_theme(p_theme,df,df_doc,di,ds,false); - - } } diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 8f486ba0c2..4f83dc2f66 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -882,6 +882,15 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->pop(); } + if (cd.methods[i].qualifiers.find("vararg")!=-1) { + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->add_text(","); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); + class_desc->add_text(" ... "); + class_desc->pop(); + class_desc->pop(); + } + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); class_desc->add_text(cd.methods[i].arguments.size()?" )":")"); class_desc->pop(); diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index 357d139c04..d90a175811 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -1441,7 +1441,7 @@ bool EditorExportPlatformPC::can_export(String *r_error) const { String err; bool valid=true; - if (use64 && (!exists_export_template(debug_binary64)) || !exists_export_template(release_binary64)) { + if (use64 && (!exists_export_template(debug_binary64) || !exists_export_template(release_binary64))) { valid=false; err="No 64 bits export templates found.\nDownload and install export templates.\n"; } diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index f4b67f6e2b..fe97fe2881 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -176,17 +176,6 @@ void EditorNode::_unhandled_input(const InputEvent& p_event) { if (p_event.type==InputEvent::KEY && p_event.key.pressed && !p_event.key.echo && !gui_base->get_viewport()->gui_has_modal_stack()) { - if (ED_IS_SHORTCUT("editor/fullscreen_mode", p_event)) { - if (distraction_free_mode) { - distraction_free_mode = false; - _update_top_menu_visibility(); - } else { - set_docks_visible(!get_docks_visible()); - } - } - if (ED_IS_SHORTCUT("editor/distraction_free_mode", p_event)) { - set_distraction_free_mode(!get_distraction_free_mode()); - } if (ED_IS_SHORTCUT("editor/next_tab", p_event)) { int next_tab = editor_data.get_edited_scene() + 1; next_tab %= editor_data.get_edited_scene_count(); @@ -785,7 +774,7 @@ bool EditorNode::_find_and_save_resource(RES res,Map<RES,bool>& processed,int32_ if (changed || subchanged) { //save print_line("Also saving modified external resource: "+res->get_path()); - Error err = ResourceSaver::save(res->get_path(),res,flags); + ResourceSaver::save(res->get_path(),res,flags); } processed[res]=false; //because it's a file @@ -1228,7 +1217,8 @@ void EditorNode::_dialog_action(String p_file) { //_save_scene(p_file); _save_scene_with_preview(p_file); - _run(false); + _call_build(); + _run(true); } } break; @@ -1374,6 +1364,7 @@ void EditorNode::_dialog_action(String p_file) { unzClose(pkg); } break; + case RESOURCE_SAVE: case RESOURCE_SAVE_AS: { @@ -2646,6 +2637,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case RUN_PLAY: { _menu_option_confirm(RUN_STOP,true); + _call_build(); _run(false); } break; @@ -2681,6 +2673,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case RUN_PLAY_SCENE: { _menu_option_confirm(RUN_STOP,true); + _call_build(); _run(true); } break; @@ -2692,6 +2685,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } if (run_native->is_deploy_debug_remote_enabled()){ _menu_option_confirm(RUN_STOP,true); + _call_build(); emit_signal("play_pressed"); editor_run.run_native_notify(); } @@ -2817,6 +2811,12 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { file_templates->popup_centered_ratio(); } break; + case SETTINGS_TOGGLE_FULLSCREN: { + + OS::get_singleton()->set_window_fullscreen( !OS::get_singleton()->is_window_fullscreen() ); + + + } break; case SETTINGS_PICK_MAIN_SCENE: { @@ -3002,6 +3002,8 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor) { singleton->main_editor_buttons.push_back(tb); singleton->main_editor_button_vb->add_child(tb); singleton->editor_table.push_back(p_editor); + + singleton->distraction_free->raise(); } singleton->editor_data.add_editor_plugin( p_editor ); singleton->add_child(p_editor); @@ -3014,7 +3016,11 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor) { for(int i=0;i<singleton->main_editor_buttons.size();i++) { - if (p_editor->get_name()==singleton->main_editor_buttons[i]->get_name()) { + if (p_editor->get_name()==singleton->main_editor_buttons[i]->get_text()) { + + if (singleton->main_editor_buttons[i]->is_pressed()) { + singleton->_editor_select(EDITOR_SCRIPT); + } memdelete( singleton->main_editor_buttons[i] ); singleton->main_editor_buttons.remove(i); @@ -4044,6 +4050,7 @@ void EditorNode::_quick_opened() { void EditorNode::_quick_run() { + _call_build(); _run(false,quick_run->get_selected()); } @@ -4139,6 +4146,11 @@ void EditorNode::register_editor_types() { //ObjectTypeDB::register_type<EditorImportExport>(); ObjectTypeDB::register_type<EditorSettings>(); ObjectTypeDB::register_type<EditorSpatialGizmo>(); + ObjectTypeDB::register_type<EditorResourcePreview>(); + ObjectTypeDB::register_type<EditorResourcePreviewGenerator>(); + ObjectTypeDB::register_type<EditorFileSystem>(); + ObjectTypeDB::register_type<EditorFileSystemDirectory>(); + //ObjectTypeDB::register_type<EditorImporter>(); @@ -4602,7 +4614,10 @@ void EditorNode::_update_dock_slots_visibility() { } void EditorNode::_update_top_menu_visibility() { - if (distraction_free_mode) { + + return; // I think removing top menu is too much + /* + if (distraction_free->is_pressed()) { play_cc->hide(); menu_hb->hide(); scene_tabs->hide(); @@ -4610,7 +4625,7 @@ void EditorNode::_update_top_menu_visibility() { play_cc->show(); menu_hb->show(); scene_tabs->show(); - } + }*/ } void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String& p_section) { @@ -4986,8 +5001,14 @@ bool EditorNode::get_docks_visible() const { return docks_visible; } +void EditorNode::_toggle_distraction_free_mode() { + + set_distraction_free_mode( distraction_free->is_pressed() ); +} + void EditorNode::set_distraction_free_mode(bool p_enter) { - distraction_free_mode = p_enter; + + distraction_free->set_pressed(p_enter); if (p_enter) { if (docks_visible) { @@ -5000,7 +5021,7 @@ void EditorNode::set_distraction_free_mode(bool p_enter) { } bool EditorNode::get_distraction_free_mode() const { - return distraction_free_mode; + return distraction_free->is_pressed(); } void EditorNode::add_control_to_dock(DockSlot p_slot,Control* p_control) { @@ -5232,6 +5253,24 @@ void EditorNode::add_plugin_init_callback(EditorPluginInitializeCallback p_callb EditorPluginInitializeCallback EditorNode::plugin_init_callbacks[EditorNode::MAX_INIT_CALLBACKS]; +int EditorNode::build_callback_count=0; + +void EditorNode::add_build_callback(EditorBuildCallback p_callback) { + + ERR_FAIL_COND(build_callback_count==MAX_INIT_CALLBACKS); + + build_callbacks[build_callback_count++]=p_callback; +} + +EditorPluginInitializeCallback EditorNode::build_callbacks[EditorNode::MAX_BUILD_CALLBACKS]; + +void EditorNode::_call_build() { + + for(int i=0;i<build_callback_count;i++) { + build_callbacks[i](); + } +} + void EditorNode::_bind_methods() { @@ -5300,6 +5339,7 @@ void EditorNode::_bind_methods() { ObjectTypeDB::bind_method("_clear_search_box",&EditorNode::_clear_search_box); ObjectTypeDB::bind_method("_clear_undo_history",&EditorNode::_clear_undo_history); ObjectTypeDB::bind_method("_dropped_files",&EditorNode::_dropped_files); + ObjectTypeDB::bind_method("_toggle_distraction_free_mode",&EditorNode::_toggle_distraction_free_mode); @@ -5344,7 +5384,7 @@ EditorNode::EditorNode() { changing_scene=false; _initializing_addons=false; docks_visible = true; - distraction_free_mode=false; + FileAccess::set_backup_save(true); @@ -5353,19 +5393,27 @@ EditorNode::EditorNode() { // load settings if (!EditorSettings::get_singleton()) EditorSettings::create(); + + bool use_single_dock_column = false; { int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode"); if (dpi_mode==0) { - editor_set_hidpi( OS::get_singleton()->get_screen_dpi(0) > 150 ); + editor_set_scale( OS::get_singleton()->get_screen_dpi(0) > 150 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x>2000 ? 2.0 : 1.0 ); + + use_single_dock_column = OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x<1200; + + } else if (dpi_mode==1) { + editor_set_scale(0.75); } else if (dpi_mode==2) { - editor_set_hidpi(true); - } else { - editor_set_hidpi(false); + editor_set_scale(1.0); + } else if (dpi_mode==3) { + editor_set_scale(1.5); + } else if (dpi_mode==4) { + editor_set_scale(2.0); } } - ResourceLoader::set_abort_on_missing_resources(false); FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); EditorFileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); @@ -5414,9 +5462,9 @@ EditorNode::EditorNode() { theme_base->add_child(gui_base); gui_base->set_area_as_parent_rect(); - theme_base->set_theme( create_default_theme() ); - theme = create_editor_theme(); - gui_base->set_theme(theme); + Ref<Theme> theme = create_editor_theme(); + theme_base->set_theme( theme ); + gui_base->set_theme(create_custom_theme()); resource_preview = memnew( EditorResourcePreview ); add_child(resource_preview); @@ -5672,8 +5720,6 @@ EditorNode::EditorNode() { prev_scene->set_pos(Point2(3,24)); prev_scene->hide(); - ED_SHORTCUT("editor/fullscreen_mode",TTR("Fullscreen Mode"),KEY_MASK_SHIFT|KEY_F11); - ED_SHORTCUT("editor/distraction_free_mode",TTR("Distraction Free Mode"),KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_F11); ED_SHORTCUT("editor/next_tab", TTR("Next tab"), KEY_MASK_CMD+KEY_TAB); @@ -5744,6 +5790,13 @@ EditorNode::EditorNode() { editor_region->add_child(main_editor_button_vb); menu_hb->add_child(editor_region); + distraction_free = memnew( ToolButton ); + main_editor_button_vb->add_child(distraction_free); + distraction_free->set_shortcut( ED_SHORTCUT("editor/distraction_free_mode",TTR("Distraction Free Mode"),KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_F11) ); + distraction_free->connect("pressed",this,"_toggle_distraction_free_mode"); + distraction_free->set_icon(gui_base->get_icon("DistractionFree","EditorIcons")); + distraction_free->set_toggle_mode(true); + //menu_hb->add_spacer(); #if 0 node_menu = memnew( MenuButton ); @@ -5984,6 +6037,9 @@ EditorNode::EditorNode() { p->add_child(editor_layouts); editor_layouts->connect("item_pressed",this,"_layout_menu_option"); p->add_submenu_item(TTR("Editor Layout"), "Layouts"); + + p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode",TTR("Toggle Fullscreen"),KEY_MASK_SHIFT|KEY_F11),SETTINGS_TOGGLE_FULLSCREN); + p->add_separator(); p->add_item(TTR("Install Export Templates"),SETTINGS_LOAD_EXPORT_TEMPLATES); p->add_separator(); @@ -6176,12 +6232,24 @@ EditorNode::EditorNode() { node_dock = memnew( NodeDock ); //node_dock->set_undoredo(&editor_data.get_undo_redo()); - dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(node_dock); + if (use_single_dock_column) { + dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(node_dock); + } else { + dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(node_dock); + } scenes_dock = memnew( FileSystemDock(this) ); scenes_dock->set_name(TTR("FileSystem")); scenes_dock->set_display_mode(int(EditorSettings::get_singleton()->get("filesystem_dock/display_mode"))); - dock_slot[DOCK_SLOT_LEFT_UR]->add_child(scenes_dock); + + if (use_single_dock_column) { + dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(scenes_dock); + left_r_vsplit->hide(); + dock_slot[DOCK_SLOT_LEFT_UR]->hide(); + dock_slot[DOCK_SLOT_LEFT_BR]->hide(); + } else { + dock_slot[DOCK_SLOT_LEFT_UR]->add_child(scenes_dock); + } //prop_pallete->add_child(scenes_dock); scenes_dock->connect("open",this,"open_request"); scenes_dock->connect("instance",this,"_instance_request"); @@ -6190,9 +6258,9 @@ EditorNode::EditorNode() { overridden_default_layout=-1; default_layout.instance(); - default_layout->set_value(docks_section, "dock_3", TTR("Scene")); - default_layout->set_value(docks_section, "dock_4", TTR("FileSystem")); - default_layout->set_value(docks_section, "dock_5", TTR("Inspector")); + default_layout->set_value(docks_section, "dock_3", TTR("FileSystem")); + default_layout->set_value(docks_section, "dock_5", TTR("Scene")); + default_layout->set_value(docks_section, "dock_6", TTR("Inspector")+","+TTR("Node")); for(int i=0;i<DOCK_SLOT_MAX/2;i++) default_layout->set_value(docks_section, "dock_hsplit_"+itos(i+1), 0); @@ -6543,11 +6611,6 @@ EditorNode::EditorNode() { Globals::get_singleton()->set("debug/indicators_enabled",true); Globals::get_singleton()->set("render/room_cull_enabled",false); - theme->set_color("prop_category","Editor",Color::hex(0x3f3a44ff)); - theme->set_color("prop_section","Editor",Color::hex(0x35313aff)); - theme->set_color("prop_subsection","Editor",Color::hex(0x312e37ff)); - theme->set_color("fg_selected","Editor",Color::html("ffbd8e8e")); - theme->set_color("fg_error","Editor",Color::html("ffbd8e8e")); reference_resource_mem=true; save_external_resources_mem=true; @@ -6684,45 +6747,54 @@ EditorNode::~EditorNode() { void EditorPluginList::make_visible(bool p_visible) { - if (!plugins_list.empty()) { - for (int i = 0; i < plugins_list.size(); i++) { - plugins_list[i]->make_visible(p_visible); - } + + for (int i = 0; i < plugins_list.size(); i++) { + plugins_list[i]->make_visible(p_visible); } + } void EditorPluginList::edit(Object* p_object) { - if (!plugins_list.empty()) { - for (int i = 0; i < plugins_list.size(); i++) { - plugins_list[i]->edit(p_object); - } + + for (int i = 0; i < plugins_list.size(); i++) { + plugins_list[i]->edit(p_object); } + } -bool EditorPluginList::forward_input_event(const InputEvent& p_event) { +bool EditorPluginList::forward_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { + bool discard = false; - if (!plugins_list.empty()) { - for (int i = 0; i < plugins_list.size(); i++) { - if (plugins_list[i]->forward_input_event(p_event)) { - discard = true; - } + + for (int i = 0; i < plugins_list.size(); i++) { + if (plugins_list[i]->forward_canvas_input_event(p_canvas_xform,p_event)) { + discard = true; } } + return discard; } bool EditorPluginList::forward_spatial_input_event(Camera* p_camera, const InputEvent& p_event) { bool discard = false; - if (!plugins_list.empty()) { - for (int i = 0; i < plugins_list.size(); i++) { - if (plugins_list[i]->forward_spatial_input_event(p_camera, p_event)) { - discard = true; - } + + for (int i = 0; i < plugins_list.size(); i++) { + if (plugins_list[i]->forward_spatial_input_event(p_camera, p_event)) { + discard = true; } } + return discard; } +void EditorPluginList::forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control* p_canvas) { + + for (int i = 0; i < plugins_list.size(); i++) { + plugins_list[i]->forward_draw_over_canvas(p_canvas_xform,p_canvas); + } + +} + bool EditorPluginList::empty() { return plugins_list.empty(); } diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index e69063d56d..0393cd19a9 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -95,6 +95,7 @@ typedef void (*EditorNodeInitCallback)(); typedef void (*EditorPluginInitializeCallback)(); +typedef void (*EditorBuildCallback)(); class EditorPluginList; @@ -186,6 +187,7 @@ private: SETTINGS_LAYOUT_DEFAULT, SETTINGS_LOAD_EXPORT_TEMPLATES, SETTINGS_PICK_MAIN_SCENE, + SETTINGS_TOGGLE_FULLSCREN, SETTINGS_HELP, SETTINGS_ABOUT, SOURCES_REIMPORT, @@ -356,7 +358,7 @@ private: int dock_popup_selected; Timer *dock_drag_timer; bool docks_visible; - bool distraction_free_mode; + ToolButton *distraction_free; String _tmp_import_path; @@ -576,13 +578,21 @@ private: static void _file_access_close_error_notify(const String& p_str); + void _toggle_distraction_free_mode(); enum { - MAX_INIT_CALLBACKS=128 + MAX_INIT_CALLBACKS=128, + MAX_BUILD_CALLBACKS=128 }; + + static int plugin_init_callback_count; static EditorPluginInitializeCallback plugin_init_callbacks[MAX_INIT_CALLBACKS]; + + void _call_build(); + static int build_callback_count; + static EditorBuildCallback build_callbacks[MAX_BUILD_CALLBACKS]; protected: void _notification(int p_what); static void _bind_methods(); @@ -751,6 +761,7 @@ public: void get_singleton(const char* arg1, bool arg2); static void add_init_callback(EditorNodeInitCallback p_callback) { _init_callbacks.push_back(p_callback); } + static void add_build_callback(EditorBuildCallback p_callback); @@ -781,8 +792,9 @@ public: void make_visible(bool p_visible); void edit(Object *p_object); - bool forward_input_event(const InputEvent& p_event); + bool forward_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event); bool forward_spatial_input_event(Camera* p_camera, const InputEvent& p_event); + void forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control* p_canvas); void clear(); bool empty(); diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp index 5e671549ef..4b82d5e59c 100644 --- a/tools/editor/editor_plugin.cpp +++ b/tools/editor/editor_plugin.cpp @@ -32,6 +32,7 @@ #include "plugins/spatial_editor_plugin.h" #include "tools/editor/editor_node.h" #include "tools/editor/editor_settings.h" +#include "editor_resource_preview.h" void EditorPlugin::add_custom_type(const String& p_type, const String& p_base,const Ref<Script>& p_script, const Ref<Texture>& p_icon) { @@ -70,6 +71,11 @@ void EditorPlugin::remove_control_from_bottom_panel(Control *p_control) { } +Control * EditorPlugin::get_editor_viewport() { + + return EditorNode::get_singleton()->get_viewport(); +} + void EditorPlugin::add_control_to_container(CustomControlContainer p_location,Control *p_control) { switch(p_location) { @@ -130,13 +136,25 @@ Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial* p_spatial) { return Ref<SpatialEditorGizmo>(); } -bool EditorPlugin::forward_input_event(const InputEvent& p_event) { +bool EditorPlugin::forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { - if (get_script_instance() && get_script_instance()->has_method("forward_input_event")) { - return get_script_instance()->call("forward_input_event",p_event); + if (get_script_instance() && get_script_instance()->has_method("forward_canvas_input_event")) { + return get_script_instance()->call("forward_canvas_input_event",p_canvas_xform,p_event); } return false; } + +void EditorPlugin::forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control *p_canvas) { + + if (get_script_instance() && get_script_instance()->has_method("forward_draw_over_canvas")) { + get_script_instance()->call("forward_draw_over_canvas",p_canvas_xform,p_canvas); + } +} + +void EditorPlugin::update_canvas() { + CanvasItemEditor::get_singleton()->get_viewport_control()->update(); +} + bool EditorPlugin::forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event) { if (get_script_instance() && get_script_instance()->has_method("forward_spatial_input_event")) { @@ -272,6 +290,10 @@ EditorSettings *EditorPlugin::get_editor_settings() { return EditorSettings::get_singleton(); } +EditorResourcePreview *EditorPlugin::get_resource_previewer() { + return EditorResourcePreview::get_singleton(); +} + void EditorPlugin::add_import_plugin(const Ref<EditorImportPlugin>& p_editor_import) { EditorNode::get_singleton()->add_editor_import_plugin(p_editor_import); @@ -298,6 +320,24 @@ Control *EditorPlugin::get_base_control() { return EditorNode::get_singleton()->get_gui_base(); } +void EditorPlugin::make_bottom_panel_item_visible(Control * p_item) { + + EditorNode::get_singleton()->make_bottom_panel_item_visible(p_item); +} + +void EditorPlugin::hide_bottom_panel() { + + EditorNode::get_singleton()->hide_bottom_panel(); +} + +void EditorPlugin::inspect_object(Object *p_obj,const String& p_for_property) { + + EditorNode::get_singleton()->push_item(p_obj,p_for_property); +} + +EditorFileSystem *EditorPlugin::get_resource_file_system() { + return EditorFileSystem::get_singleton(); +} void EditorPlugin::_bind_methods() { @@ -308,6 +348,7 @@ void EditorPlugin::_bind_methods() { ObjectTypeDB::bind_method(_MD("remove_control_from_bottom_panel","control:Control"),&EditorPlugin::remove_control_from_bottom_panel); ObjectTypeDB::bind_method(_MD("add_custom_type","type","base","script:Script","icon:Texture"),&EditorPlugin::add_custom_type); ObjectTypeDB::bind_method(_MD("remove_custom_type","type"),&EditorPlugin::remove_custom_type); + ObjectTypeDB::bind_method(_MD("get_editor_viewport:Control"), &EditorPlugin::get_editor_viewport); ObjectTypeDB::bind_method(_MD("add_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::add_import_plugin); ObjectTypeDB::bind_method(_MD("remove_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::remove_import_plugin); @@ -315,6 +356,14 @@ void EditorPlugin::_bind_methods() { ObjectTypeDB::bind_method(_MD("add_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::add_export_plugin); ObjectTypeDB::bind_method(_MD("remove_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::remove_export_plugin); + ObjectTypeDB::bind_method(_MD("get_resource_previewer:EditorResourcePreview"),&EditorPlugin::get_resource_previewer); + ObjectTypeDB::bind_method(_MD("get_resource_filesystem:EditorFileSystem"),&EditorPlugin::get_resource_file_system); + + ObjectTypeDB::bind_method(_MD("inspect_object","object","for_property"),&EditorPlugin::inspect_object,DEFVAL(String())); + ObjectTypeDB::bind_method(_MD("update_canvas"),&EditorPlugin::update_canvas); + + ObjectTypeDB::bind_method(_MD("make_bottom_panel_item_visible","item:Control"), &EditorPlugin::make_bottom_panel_item_visible); + ObjectTypeDB::bind_method(_MD("hide_bottom_panel"), &EditorPlugin::hide_bottom_panel); ObjectTypeDB::bind_method(_MD("get_base_control:Control"),&EditorPlugin::get_base_control); ObjectTypeDB::bind_method(_MD("get_undo_redo:UndoRedo"),&EditorPlugin::_get_undo_redo); @@ -322,7 +371,8 @@ void EditorPlugin::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_editor_settings:EditorSettings"),&EditorPlugin::get_editor_settings); ObjectTypeDB::bind_method(_MD("queue_save_layout"),&EditorPlugin::queue_save_layout); - ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_input_event",PropertyInfo(Variant::INPUT_EVENT,"event"))); + ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_canvas_input_event",PropertyInfo(Variant::MATRIX32,"canvas_xform"),PropertyInfo(Variant::INPUT_EVENT,"event"))); + ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("forward_draw_over_canvas",PropertyInfo(Variant::MATRIX32,"canvas_xform"),PropertyInfo(Variant::OBJECT,"canvas:Control"))); ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_spatial_input_event",PropertyInfo(Variant::OBJECT,"camera",PROPERTY_HINT_RESOURCE_TYPE,"Camera"),PropertyInfo(Variant::INPUT_EVENT,"event"))); MethodInfo gizmo = MethodInfo(Variant::OBJECT,"create_spatial_gizmo",PropertyInfo(Variant::OBJECT,"for_spatial:Spatial")); gizmo.return_val.hint=PROPERTY_HINT_RESOURCE_TYPE; diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h index 9a9c32357d..2700c49a6c 100644 --- a/tools/editor/editor_plugin.h +++ b/tools/editor/editor_plugin.h @@ -34,6 +34,7 @@ #include "scene/resources/texture.h" #include "undo_redo.h" #include "io/config_file.h" + /** @author Juan Linietsky <reduzio@gmail.com> */ @@ -47,6 +48,8 @@ class EditorSettings; class SpatialEditorGizmo; class EditorImportPlugin; class EditorExportPlugin; +class EditorResourcePreview; +class EditorFileSystem; class EditorPlugin : public Node { @@ -97,9 +100,11 @@ public: void add_control_to_dock(DockSlot p_slot,Control *p_control); void remove_control_from_docks(Control *p_control); void remove_control_from_bottom_panel(Control *p_control); + Control* get_editor_viewport(); virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial* p_spatial); - virtual bool forward_input_event(const InputEvent& p_event); + virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform, const InputEvent& p_event); + virtual void forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control *p_canvas); virtual bool forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event); virtual String get_name() const; virtual bool has_main_screen() const; @@ -116,12 +121,19 @@ public: virtual bool get_remove_list(List<Node*> *p_list); virtual void set_window_layout(Ref<ConfigFile> p_layout); virtual void get_window_layout(Ref<ConfigFile> p_layout); - virtual void edited_scene_changed(){}; // if changes are pending in editor, apply them + virtual void edited_scene_changed(){} // if changes are pending in editor, apply them + + void update_canvas(); + + virtual void inspect_object(Object *p_obj,const String& p_for_property=String()); void queue_save_layout() const; Control *get_base_control(); + void make_bottom_panel_item_visible(Control *p_item); + void hide_bottom_panel(); + void add_import_plugin(const Ref<EditorImportPlugin>& p_editor_import); void remove_import_plugin(const Ref<EditorImportPlugin>& p_editor_import); @@ -131,6 +143,8 @@ public: EditorSelection* get_selection(); //EditorImportExport *get_import_export(); EditorSettings *get_editor_settings(); + EditorResourcePreview *get_resource_previewer(); + EditorFileSystem *get_resource_file_system(); virtual void restore_global_state(); virtual void save_global_state(); diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp index a02fe2a531..6afc3e2a34 100644 --- a/tools/editor/editor_resource_preview.cpp +++ b/tools/editor/editor_resource_preview.cpp @@ -35,14 +35,46 @@ #include "editor_scale.h" #include "message_queue.h" +bool EditorResourcePreviewGenerator::handles(const String& p_type) const { + + if (get_script_instance() && get_script_instance()->has_method("handles")) { + return get_script_instance()->call("handles",p_type); + } + ERR_EXPLAIN("EditorResourcePreviewGenerator::handles needs to be overriden"); + ERR_FAIL_V(false); +} +Ref<Texture> EditorResourcePreviewGenerator::generate(const RES& p_from){ + + if (get_script_instance() && get_script_instance()->has_method("generate")) { + return get_script_instance()->call("generate",p_from); + } + ERR_EXPLAIN("EditorResourcePreviewGenerator::generate needs to be overriden"); + ERR_FAIL_V(Ref<Texture>()); + +} + + Ref<Texture> EditorResourcePreviewGenerator::generate_from_path(const String& p_path) { + if (get_script_instance() && get_script_instance()->has_method("generate_from_path")) { + return get_script_instance()->call("generate_from_path",p_path); + } + RES res = ResourceLoader::load(p_path); if (!res.is_valid()) return res; return generate(res); } + +void EditorResourcePreviewGenerator::_bind_methods() { + + ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"handles",PropertyInfo(Variant::STRING,"type"))); + ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::OBJECT,"generate:Texture",PropertyInfo(Variant::OBJECT,"from",PROPERTY_HINT_RESOURCE_TYPE,"Resource"))); + ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::OBJECT,"generate_from_path:Texture",PropertyInfo(Variant::STRING,"path",PROPERTY_HINT_FILE))); + +} + EditorResourcePreviewGenerator::EditorResourcePreviewGenerator() { @@ -330,6 +362,11 @@ void EditorResourcePreview::add_preview_generator(const Ref<EditorResourcePrevie preview_generators.push_back(p_generator); } +void EditorResourcePreview::remove_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator) { + + preview_generators.erase(p_generator); +} + EditorResourcePreview* EditorResourcePreview::get_singleton() { return singleton; @@ -338,6 +375,11 @@ EditorResourcePreview* EditorResourcePreview::get_singleton() { void EditorResourcePreview::_bind_methods() { ObjectTypeDB::bind_method("_preview_ready",&EditorResourcePreview::_preview_ready); + + ObjectTypeDB::bind_method(_MD("queue_resource_preview","path","receiver","receiver_func","userdata:Variant"),&EditorResourcePreview::queue_resource_preview); + ObjectTypeDB::bind_method(_MD("queue_edited_resource_preview","resource:Resource","receiver","receiver_func","userdata:Variant"),&EditorResourcePreview::queue_edited_resource_preview); + ObjectTypeDB::bind_method(_MD("add_preview_generator","generator:EditorResourcePreviewGenerator"),&EditorResourcePreview::add_preview_generator); + ObjectTypeDB::bind_method(_MD("remove_preview_generator","generator:EditorResourcePreviewGenerator"),&EditorResourcePreview::remove_preview_generator); ObjectTypeDB::bind_method(_MD("check_for_invalidation","path"),&EditorResourcePreview::check_for_invalidation); diff --git a/tools/editor/editor_resource_preview.h b/tools/editor/editor_resource_preview.h index 51a00965eb..2756360130 100644 --- a/tools/editor/editor_resource_preview.h +++ b/tools/editor/editor_resource_preview.h @@ -57,10 +57,13 @@ class EditorResourcePreviewGenerator : public Reference { OBJ_TYPE(EditorResourcePreviewGenerator,Reference ); +protected: + + static void _bind_methods(); public: - virtual bool handles(const String& p_type) const=0; - virtual Ref<Texture> generate(const RES& p_from)=0; + virtual bool handles(const String& p_type) const; + virtual Ref<Texture> generate(const RES& p_from); virtual Ref<Texture> generate_from_path(const String& p_path); EditorResourcePreviewGenerator(); @@ -121,6 +124,7 @@ public: void queue_edited_resource_preview(const Ref<Resource>& p_path, Object* p_receiver, const StringName& p_receiver_func, const Variant& p_userdata); void add_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator); + void remove_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator); void check_for_invalidation(const String& p_path); EditorResourcePreview(); diff --git a/tools/editor/editor_scale.cpp b/tools/editor/editor_scale.cpp index c332acc0ca..8575e1c30a 100644 --- a/tools/editor/editor_scale.cpp +++ b/tools/editor/editor_scale.cpp @@ -1,14 +1,13 @@ #include "editor_scale.h" #include "os/os.h" -static bool editor_hidpi=false; +static float scale = 1.0; -void editor_set_hidpi(bool p_hidpi) { +void editor_set_scale(float p_scale) { - editor_hidpi=p_hidpi; + scale=p_scale; } +float editor_get_scale() { -bool editor_is_hidpi() { - - return editor_hidpi; + return scale; } diff --git a/tools/editor/editor_scale.h b/tools/editor/editor_scale.h index a60cf00f0a..90e575f771 100644 --- a/tools/editor/editor_scale.h +++ b/tools/editor/editor_scale.h @@ -1,8 +1,8 @@ #ifndef EDITOR_SCALE_H #define EDITOR_SCALE_H -void editor_set_hidpi(bool p_hidpi); -bool editor_is_hidpi(); +void editor_set_scale(float p_scale); +float editor_get_scale(); -#define EDSCALE (editor_is_hidpi() ? 2 : 1) +#define EDSCALE (editor_get_scale()) #endif // EDITOR_SCALE_H diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 99c80fdc36..4778a7ce90 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -511,7 +511,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { } set("global/hidpi_mode",0); - hints["global/hidpi_mode"]=PropertyInfo(Variant::INT,"global/hidpi_mode",PROPERTY_HINT_ENUM,"Auto,LoDPI,HiDPI",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + hints["global/hidpi_mode"]=PropertyInfo(Variant::INT,"global/hidpi_mode",PROPERTY_HINT_ENUM,"Auto,VeryLoDPI,LoDPI,MidDPI,HiDPI",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); set("global/show_script_in_scene_tabs",false); set("global/font_size",14); hints["global/font_size"]=PropertyInfo(Variant::INT,"global/font_size",PROPERTY_HINT_RANGE,"10,40,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); @@ -574,6 +574,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("grid_map/pick_distance", 5000.0); + set("3d_editor/grid_color",Color(0,1,0,0.2)); + hints["3d_editor/grid_color"]=PropertyInfo(Variant::COLOR,"3d_editor/grid_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + set("3d_editor/default_fov",45.0); set("3d_editor/default_z_near",0.1); set("3d_editor/default_z_far",500.0); diff --git a/tools/editor/editor_themes.cpp b/tools/editor/editor_themes.cpp index 44e21aee85..08f14ec167 100644 --- a/tools/editor/editor_themes.cpp +++ b/tools/editor/editor_themes.cpp @@ -32,8 +32,9 @@ #include "editor_fonts.h" #include "editor_settings.h" #include "core/io/resource_loader.h" +#include "editor_scale.h" -Ref<Theme> create_default_theme() +Ref<Theme> create_editor_theme() { Ref<Theme> theme = Ref<Theme>( memnew( Theme ) ); @@ -43,32 +44,36 @@ Ref<Theme> create_default_theme() Ref<StyleBoxTexture> focus_sbt=memnew( StyleBoxTexture ); focus_sbt->set_texture(theme->get_icon("EditorFocus","EditorIcons")); for(int i=0;i<4;i++) { - focus_sbt->set_margin_size(Margin(i),16); - focus_sbt->set_default_margin(Margin(i),16); + focus_sbt->set_margin_size(Margin(i),16*EDSCALE); + focus_sbt->set_default_margin(Margin(i),16*EDSCALE); } focus_sbt->set_draw_center(false); theme->set_stylebox("EditorFocus","EditorStyles",focus_sbt); + theme->set_color("prop_category","Editor",Color::hex(0x3f3a44ff)); + theme->set_color("prop_section","Editor",Color::hex(0x35313aff)); + theme->set_color("prop_subsection","Editor",Color::hex(0x312e37ff)); + theme->set_color("fg_selected","Editor",Color::html("ffbd8e8e")); + theme->set_color("fg_error","Editor",Color::html("ffbd8e8e")); return theme; } -Ref<Theme> create_editor_theme() +Ref<Theme> create_custom_theme() { - Ref<Theme> theme = NULL; + Ref<Theme> theme; String custom_theme = EditorSettings::get_singleton()->get("global/custom_theme"); if (custom_theme!="") { theme = ResourceLoader::load(custom_theme); } - if (theme.is_null() || !theme.is_valid()) { - theme = create_default_theme(); - } - String global_font = EditorSettings::get_singleton()->get("global/custom_font"); if (global_font!="") { Ref<Font> fnt = ResourceLoader::load(global_font); if (fnt.is_valid()) { + if (!theme.is_valid()) { + theme.instance(); + } theme->set_default_theme_font(fnt); } } diff --git a/tools/editor/editor_themes.h b/tools/editor/editor_themes.h index dbff8b3079..db49801600 100644 --- a/tools/editor/editor_themes.h +++ b/tools/editor/editor_themes.h @@ -31,8 +31,8 @@ #include "scene/resources/theme.h" -Ref<Theme> create_default_theme(); - Ref<Theme> create_editor_theme(); +Ref<Theme> create_custom_theme(); + #endif diff --git a/tools/editor/icons/2x/icon_distraction_free.png b/tools/editor/icons/2x/icon_distraction_free.png Binary files differnew file mode 100644 index 0000000000..034239a4e7 --- /dev/null +++ b/tools/editor/icons/2x/icon_distraction_free.png diff --git a/tools/editor/icons/2x/icon_mini_aabb.png b/tools/editor/icons/2x/icon_mini_aabb.png Binary files differindex f0fd5620e9..25603eec49 100644 --- a/tools/editor/icons/2x/icon_mini_aabb.png +++ b/tools/editor/icons/2x/icon_mini_aabb.png diff --git a/tools/editor/icons/2x/icon_mini_transform.png b/tools/editor/icons/2x/icon_mini_transform.png Binary files differindex cb106ba5fa..5144871c5c 100644 --- a/tools/editor/icons/2x/icon_mini_transform.png +++ b/tools/editor/icons/2x/icon_mini_transform.png diff --git a/tools/editor/icons/2x/icon_remote_transform.png b/tools/editor/icons/2x/icon_remote_transform.png Binary files differnew file mode 100644 index 0000000000..dad528615a --- /dev/null +++ b/tools/editor/icons/2x/icon_remote_transform.png diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index bc104294cb..44e28f49e6 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -61,8 +61,10 @@ def make_editor_icons_action(target, source, env): s.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n") s.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n") - s.write("\tImage img((editor_is_hidpi()&&p_hidpi_png)?p_hidpi_png:p_png);\n") - s.write("\tif (editor_is_hidpi() && !p_hidpi_png) { img.convert(Image::FORMAT_RGBA); img.expand_x2_hq2x(); }\n") + s.write("\tbool use_hidpi_image=(editor_get_scale()>1.0&&p_hidpi_png);\n") + s.write("\tImage img(use_hidpi_image?p_hidpi_png:p_png);\n") + s.write("\tif (editor_get_scale()>1.0 && !p_hidpi_png) { img.convert(Image::FORMAT_RGBA); img.expand_x2_hq2x(); use_hidpi_image=true;}\n") + s.write("\timg.resize(img.get_width()*EDSCALE/(use_hidpi_image?2:1),img.get_height()*EDSCALE/(use_hidpi_image?2:1));\n") s.write("\ttexture->create_from_image( img,ImageTexture::FLAG_FILTER );\n") s.write("\treturn texture;\n") s.write("}\n\n") diff --git a/tools/editor/icons/icon_color_frame.png b/tools/editor/icons/icon_color_frame.png Binary files differnew file mode 100644 index 0000000000..a82eefc10a --- /dev/null +++ b/tools/editor/icons/icon_color_frame.png diff --git a/tools/editor/icons/icon_distraction_free.png b/tools/editor/icons/icon_distraction_free.png Binary files differnew file mode 100644 index 0000000000..c6f8a08874 --- /dev/null +++ b/tools/editor/icons/icon_distraction_free.png diff --git a/tools/editor/icons/icon_mini_aabb.png b/tools/editor/icons/icon_mini_aabb.png Binary files differindex 3a6be5605a..eebc4633e4 100644 --- a/tools/editor/icons/icon_mini_aabb.png +++ b/tools/editor/icons/icon_mini_aabb.png diff --git a/tools/editor/icons/icon_mini_transform.png b/tools/editor/icons/icon_mini_transform.png Binary files differindex 0107107a96..068ea0506c 100644 --- a/tools/editor/icons/icon_mini_transform.png +++ b/tools/editor/icons/icon_mini_transform.png diff --git a/tools/editor/icons/icon_remote_transform.png b/tools/editor/icons/icon_remote_transform.png Binary files differnew file mode 100644 index 0000000000..2a8b5f4d0e --- /dev/null +++ b/tools/editor/icons/icon_remote_transform.png diff --git a/tools/editor/icons/source/icon_distraction_free.svg b/tools/editor/icons/source/icon_distraction_free.svg new file mode 100644 index 0000000000..4ae48b2fb6 --- /dev/null +++ b/tools/editor/icons/source/icon_distraction_free.svg @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="16" + height="16" + viewBox="0 0 16 16" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png" + inkscape:export-xdpi="45" + inkscape:export-ydpi="45" + sodipodi:docname="icon_distraction_free.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="32.000001" + inkscape:cx="10.344519" + inkscape:cy="8.9631686" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="false" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:window-width="1920" + inkscape:window-height="1016" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:snap-midpoints="true" + inkscape:snap-smooth-nodes="true" + inkscape:object-nodes="true"> + <inkscape:grid + type="xygrid" + id="grid3336" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1036.3622)"> + <path + style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 3.7578125 2.34375 L 2.34375 3.7578125 L 5.2929688 6.7070312 L 6.7070312 5.2929688 L 3.7578125 2.34375 z M 12.242188 2.34375 L 9.2929688 5.2929688 L 10.707031 6.7070312 L 13.65625 3.7578125 L 12.242188 2.34375 z M 5.2929688 9.2929688 L 2.34375 12.242188 L 3.7578125 13.65625 L 6.7070312 10.707031 L 5.2929688 9.2929688 z M 10.707031 9.2929688 L 9.2929688 10.707031 L 12.242188 13.65625 L 13.65625 12.242188 L 10.707031 9.2929688 z " + transform="translate(0,1036.3622)" + id="rect4137" /> + <path + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 1,1051.3622 0,-5 5,5 z" + id="path4155" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccc" /> + <path + sodipodi:nodetypes="cccc" + inkscape:connector-curvature="0" + id="path4158" + d="m 15,1051.3622 0,-5 -5,5 z" + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <path + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 15,1037.3622 0,5 -5,-5 z" + id="path4160" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccc" /> + <path + sodipodi:nodetypes="cccc" + inkscape:connector-curvature="0" + id="path4162" + d="m 1,1037.3622 0,5 5,-5 z" + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + </g> +</svg> diff --git a/tools/editor/icons/source/icon_mini_aabb.svg b/tools/editor/icons/source/icon_mini_aabb.svg index f6cc3feda1..ebfd505bea 100644 --- a/tools/editor/icons/source/icon_mini_aabb.svg +++ b/tools/editor/icons/source/icon_mini_aabb.svg @@ -29,8 +29,8 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="45.254835" - inkscape:cx="3.148993" - inkscape:cy="6.4579802" + inkscape:cx="5.0272453" + inkscape:cy="5.132155" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -76,7 +76,7 @@ id="path4893" inkscape:connector-curvature="0" /> <path - style="fill:#f5acbb;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#f39bad;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m 3,1046.3622 a 3,3 0 0 0 -3,3 3,3 0 0 0 3,3 l 2,0 0,-6 -2,0 z m 0,2 0,2 a 1.0000174,1.0000174 0 0 1 -1,-1 1.0000174,1.0000174 0 0 1 1,-1 z" id="path4234" inkscape:connector-curvature="0" /> @@ -99,7 +99,7 @@ id="rect4149" style="fill:#ee7991;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> <path - style="fill:#f5acbb;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#f39bad;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m 8,1044.3622 0,8 2,0 a 3,3 0 0 0 3,-3 3,3 0 0 0 -3,-3 l 0,-2 -2,0 z m 2,4 a 1.0000174,1.0000174 0 0 1 1,1 1.0000174,1.0000174 0 0 1 -1,1 l 0,-2 z" id="path4151" inkscape:connector-curvature="0" /> diff --git a/tools/editor/icons/source/icon_mini_transform.svg b/tools/editor/icons/source/icon_mini_transform.svg index a844171dd4..6da4eb806d 100644 --- a/tools/editor/icons/source/icon_mini_transform.svg +++ b/tools/editor/icons/source/icon_mini_transform.svg @@ -29,8 +29,8 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="32" - inkscape:cx="5.8969613" - inkscape:cy="6.372864" + inkscape:cx="8.2643591" + inkscape:cy="7.6152896" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -71,26 +71,20 @@ id="layer1" transform="translate(0,-1040.3622)"> <path - style="fill:#f3e49c;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - d="m 3,1042.3622 a 3,3 0 0 0 -3,3 l 0,5 2,0 0,-2 1,0 0,-2 -1,0 0,-1 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z" - id="rect4455" - inkscape:connector-curvature="0" /> + style="fill:#f6a86e;fill-opacity:1;stroke:none;stroke-width:20;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 4,1042.3622 3.0917969,1044.5438 2,1042.3622 l -2,0 2,4 -2,4 2,0 0.9082031,-2.1816 L 4,1050.3622 l 2,0 -2,-4 2,-4 z" + id="rect4214" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccccccccccc" /> <path - style="fill:#ecd669;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - d="m 8,1044.3622 0,6 2,0 0,-4 a 1.0000174,1.0000174 0 0 1 1,1 l 0,3 2,0 0,-3 0,-1 a 1.0000174,1.0000174 0 0 1 1,1 l 0,3 2,0 0,-3 a 3,3 0 0 0 -3,-3 l -2,0 0,0.1758 a 3,3 0 0 0 -1,-0.1758 l -2,0 z" - id="path4771" + style="fill:#f8bf95;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="m 9,1042.3622 a 3,3 0 0 0 -3,3 l 0,5 2,0 0,-2 1,0 0,-2 -1,0 0,-1 a 1.0000174,1.0000174 0 0 1 1,-1 l 1,0 0,-2 -1,0 z" + id="rect4455" inkscape:connector-curvature="0" /> <path - style="fill:#ecd669;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - d="m 7,1044.3622 a 3,3 0 0 0 -3,3 l 0,3 2,0 0,-3 a 1.0000174,1.0000174 0 0 1 1,-1 l 0,-2 z" - id="rect4601" - inkscape:connector-curvature="0" /> - <rect - style="fill:#f3e49c;fill-opacity:1;stroke:none" - id="rect4139" - width="1" - height="2" - x="3" - y="1042.3622" /> + style="fill:#f6a86e;fill-opacity:1;stroke:none;stroke-width:20;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 10 4 L 10 6 L 10 8 L 10 10 L 12 10 L 12 8 L 13 9 L 14 8 L 14 10 L 16 10 L 16 8 L 16 6 L 16 4 L 14 4 L 13 6 L 12 4 L 10 4 z " + transform="translate(0,1040.3622)" + id="rect4231" /> </g> </svg> diff --git a/tools/editor/icons/source/icon_remote_transform.svg b/tools/editor/icons/source/icon_remote_transform.svg new file mode 100644 index 0000000000..fbbfacf629 --- /dev/null +++ b/tools/editor/icons/source/icon_remote_transform.svg @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="16" + height="16" + viewBox="0 0 16 16" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_node_2d.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" + sodipodi:docname="icon_remote_transform.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="16" + inkscape:cx="7.0691739" + inkscape:cy="9.3738931" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="true" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:window-width="1680" + inkscape:window-height="1050" + inkscape:window-x="1366" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:object-paths="true" + inkscape:snap-intersection-paths="true" + inkscape:object-nodes="true" + inkscape:snap-smooth-nodes="true"> + <inkscape:grid + type="xygrid" + id="grid3336" + empspacing="4" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1036.3622)"> + <path + style="opacity:1;fill:#fc9c9c;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4155" + sodipodi:type="arc" + sodipodi:cx="744.13245" + sodipodi:cy="734.23291" + sodipodi:rx="4" + sodipodi:ry="4" + sodipodi:start="0" + sodipodi:end="3.1415927" + d="m 748.13245,734.23291 a 4,4 0 0 1 -2,3.4641 4,4 0 0 1 -4,0 4,4 0 0 1 -2,-3.4641 l 4,0 z" + inkscape:transform-center-y="0.58575321" + transform="matrix(0.70710678,0.70710678,-0.70710678,0.70710678,0,0)" + inkscape:transform-center-x="0.58575732" /> + <circle + style="opacity:1;fill:#fc9c9c;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4159" + cx="7" + cy="1045.3622" + r="1" /> + <path + style="opacity:1;fill:#fc9c9c;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 13.242641,1039.1196 a 6.0000172,6.0000172 0 0 0 -8.4852817,0 l 0.7071068,0.7071 a 5.0000172,5.0000172 0 0 1 7.0710679,0 5.0000172,5.0000172 0 0 1 0,7.071 l 0.707107,0.7071 a 6.0000172,6.0000172 0 0 0 0,-8.4852 z" + id="circle4163" + inkscape:connector-curvature="0" + inkscape:transform-center-y="-0.87867618" + inkscape:transform-center-x="-0.8786559" /> + <path + style="opacity:1;fill:#fc9c9c;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 11.828427,1040.5338 a 4.0000172,4.0000172 0 0 0 -5.6568541,0 l 0.7071068,0.7071 a 3.0000174,3.0000174 0 0 1 4.2426403,0 3.0000174,3.0000174 0 0 1 0,4.2426 l 0.707107,0.7071 a 4.0000172,4.0000172 0 0 0 0,-5.6568 z" + id="circle4168" + inkscape:connector-curvature="0" + inkscape:transform-center-y="-0.58578284" + inkscape:transform-center-x="-0.58576926" /> + <path + style="opacity:1;fill:#fc9c9c;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 10.414214,1041.948 a 2,2 0 0 0 -2.8284276,0 l 0.7071068,0.7071 a 1.0000174,1.0000174 0 0 1 1.4142136,0 1.0000174,1.0000174 0 0 1 0,1.4142 l 0.7071072,0.7071 a 2,2 0 0 0 0,-2.8284 z" + id="circle4172" + inkscape:connector-curvature="0" + inkscape:transform-center-y="-0.29289334" + inkscape:transform-center-x="-0.29288664" /> + <path + style="fill:#fc9c9c;fill-opacity:0.99607843;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 1,1051.3622 4,-5 1,0 0,5 z" + id="path4181" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" /> + </g> +</svg> diff --git a/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp b/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp index dca7d011ff..757d2ed5d4 100644 --- a/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp @@ -147,7 +147,7 @@ public: dst = dst.plus_file(bitmasks[i].get_file().basename() + ".pbm"); - Error err = plugin->import(dst, imd); + plugin->import(dst, imd); } hide(); diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp index ac0795f522..7dc74e58dd 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp @@ -298,7 +298,7 @@ public: dst = dst.plus_file(samples[i].get_file().basename()+".smp"); - Error err = plugin->import(dst,imd); + plugin->import(dst,imd); } hide(); diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index fa62283e37..190b56faba 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -1447,6 +1447,7 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Map<Ref<Imag } } break; + default: {} } @@ -2325,7 +2326,7 @@ void EditorSceneImportPlugin::_filter_tracks(Node *scene, const String& p_text) if (!scene->has_node(String("AnimationPlayer"))) return; - Node* n = scene->get_node(String("AnimationPlayer")); + Node* n = scene->get_node(String("AnimationPlayer")); ERR_FAIL_COND(!n); AnimationPlayer *anim = n->cast_to<AnimationPlayer>(); ERR_FAIL_COND(!anim); @@ -2443,7 +2444,7 @@ void EditorSceneImportPlugin::_optimize_animations(Node *scene, float p_max_lin_ if (!scene->has_node(String("AnimationPlayer"))) return; - Node* n = scene->get_node(String("AnimationPlayer")); + Node* n = scene->get_node(String("AnimationPlayer")); ERR_FAIL_COND(!n); AnimationPlayer *anim = n->cast_to<AnimationPlayer>(); ERR_FAIL_COND(!anim); @@ -2842,7 +2843,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c } } - Error err = EditorTextureImportPlugin::get_singleton()->import(target_path,imd); + EditorTextureImportPlugin::get_singleton()->import(target_path,imd); } } diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp index a2e94e8855..f43bec1cd3 100644 --- a/tools/editor/plugins/baked_light_baker.cpp +++ b/tools/editor/plugins/baked_light_baker.cpp @@ -1177,8 +1177,6 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c diffuse_at_point.g=res_light.g*diffuse_at_point.g; diffuse_at_point.b=res_light.b*diffuse_at_point.b; - float ret=1e6; - if (p_bounces>0) { @@ -1220,7 +1218,7 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c #endif - ret=_throw_ray(thread_stack,p_bake_direct,r_point,r_point+rn*p_rest,p_rest,diffuse_at_point,p_att_curve,p_att_pos,p_att_curve_len,p_bounces-1); + _throw_ray(thread_stack,p_bake_direct,r_point,r_point+rn*p_rest,p_rest,diffuse_at_point,p_att_curve,p_att_pos,p_att_curve_len,p_bounces-1); } if (use_specular && (specular_at_point.r>CMP_EPSILON || specular_at_point.g>CMP_EPSILON || specular_at_point.b>CMP_EPSILON)) { diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 57707ffa72..b0e002ba44 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -290,6 +290,7 @@ Dictionary CanvasItemEditor::get_state() const { state["snap_rotation"]=snap_rotation; state["snap_relative"]=snap_relative; state["snap_pixel"]=snap_pixel; + state["skeleton_show_bones"]=skeleton_show_bones; return state; } void CanvasItemEditor::set_state(const Dictionary& p_state){ @@ -351,6 +352,12 @@ void CanvasItemEditor::set_state(const Dictionary& p_state){ int idx = edit_menu->get_popup()->get_item_index(SNAP_USE_PIXEL); edit_menu->get_popup()->set_item_checked(idx,snap_pixel); } + + if (state.has("skeleton_show_bones")) { + skeleton_show_bones=state["skeleton_show_bones"]; + int idx = skeleton_menu->get_item_index(SKELETON_SHOW_BONES); + skeleton_menu->set_item_checked(idx,skeleton_show_bones); + } } @@ -1051,7 +1058,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { EditorPluginList *over_plugin_list = en->get_editor_plugins_over(); if (!over_plugin_list->empty()) { - bool discard = over_plugin_list->forward_input_event(p_event); + bool discard = over_plugin_list->forward_input_event(transform,p_event); if (discard) { accept_event(); return; @@ -2083,76 +2090,90 @@ void CanvasItemEditor::_viewport_draw() { } - int bone_width = EditorSettings::get_singleton()->get("2d_editor/bone_width"); - Color bone_color1 = EditorSettings::get_singleton()->get("2d_editor/bone_color1"); - Color bone_color2 = EditorSettings::get_singleton()->get("2d_editor/bone_color2"); - Color bone_ik_color = EditorSettings::get_singleton()->get("2d_editor/bone_ik_color"); - Color bone_selected_color = EditorSettings::get_singleton()->get("2d_editor/bone_selected_color"); + { - for(Map<ObjectID,BoneList>::Element*E=bone_list.front();E;E=E->next()) { + EditorNode *en = editor; + EditorPluginList *over_plugin_list = en->get_editor_plugins_over(); - E->get().from=Vector2(); - E->get().to=Vector2(); + if (!over_plugin_list->empty()) { - Object *obj = ObjectDB::get_instance(E->get().bone); - if (!obj) - continue; + over_plugin_list->forward_draw_over_canvas(transform,viewport); - Node2D* n2d = obj->cast_to<Node2D>(); - if (!n2d) - continue; + } + } - if (!n2d->get_parent()) - continue; + if (skeleton_show_bones) { + int bone_width = EditorSettings::get_singleton()->get("2d_editor/bone_width"); + Color bone_color1 = EditorSettings::get_singleton()->get("2d_editor/bone_color1"); + Color bone_color2 = EditorSettings::get_singleton()->get("2d_editor/bone_color2"); + Color bone_ik_color = EditorSettings::get_singleton()->get("2d_editor/bone_ik_color"); + Color bone_selected_color = EditorSettings::get_singleton()->get("2d_editor/bone_selected_color"); - CanvasItem *pi = n2d->get_parent_item(); + for(Map<ObjectID,BoneList>::Element*E=bone_list.front();E;E=E->next()) { + E->get().from=Vector2(); + E->get().to=Vector2(); - Node2D* pn2d=n2d->get_parent()->cast_to<Node2D>(); + Object *obj = ObjectDB::get_instance(E->get().bone); + if (!obj) + continue; - if (!pn2d) - continue; + Node2D* n2d = obj->cast_to<Node2D>(); + if (!n2d) + continue; - Vector2 from = transform.xform(pn2d->get_global_pos()); - Vector2 to = transform.xform(n2d->get_global_pos()); + if (!n2d->get_parent()) + continue; - E->get().from=from; - E->get().to=to; + CanvasItem *pi = n2d->get_parent_item(); - Vector2 rel = to-from; - Vector2 relt = rel.tangent().normalized()*bone_width; + Node2D* pn2d=n2d->get_parent()->cast_to<Node2D>(); + if (!pn2d) + continue; - Vector<Vector2> bone_shape; - bone_shape.push_back(from); - bone_shape.push_back(from+rel*0.2+relt); - bone_shape.push_back(to); - bone_shape.push_back(from+rel*0.2-relt); - Vector<Color> colors; - if (pi->has_meta("_edit_ik_")) { + Vector2 from = transform.xform(pn2d->get_global_pos()); + Vector2 to = transform.xform(n2d->get_global_pos()); - colors.push_back(bone_ik_color); - colors.push_back(bone_ik_color); - colors.push_back(bone_ik_color); - colors.push_back(bone_ik_color); - } else { - colors.push_back(bone_color1); - colors.push_back(bone_color2); - colors.push_back(bone_color1); - colors.push_back(bone_color2); - } + E->get().from=from; + E->get().to=to; + Vector2 rel = to-from; + Vector2 relt = rel.tangent().normalized()*bone_width; - VisualServer::get_singleton()->canvas_item_add_primitive(ci,bone_shape,colors,Vector<Vector2>(),RID()); - if (editor_selection->is_selected(pi)) { - for(int i=0;i<bone_shape.size();i++) { - VisualServer::get_singleton()->canvas_item_add_line(ci,bone_shape[i],bone_shape[(i+1)%bone_shape.size()],bone_selected_color,2); + Vector<Vector2> bone_shape; + bone_shape.push_back(from); + bone_shape.push_back(from+rel*0.2+relt); + bone_shape.push_back(to); + bone_shape.push_back(from+rel*0.2-relt); + Vector<Color> colors; + if (pi->has_meta("_edit_ik_")) { + + colors.push_back(bone_ik_color); + colors.push_back(bone_ik_color); + colors.push_back(bone_ik_color); + colors.push_back(bone_ik_color); + } else { + colors.push_back(bone_color1); + colors.push_back(bone_color2); + colors.push_back(bone_color1); + colors.push_back(bone_color2); } - } + + VisualServer::get_singleton()->canvas_item_add_primitive(ci,bone_shape,colors,Vector<Vector2>(),RID()); + + if (editor_selection->is_selected(pi)) { + for(int i=0;i<bone_shape.size();i++) { + + VisualServer::get_singleton()->canvas_item_add_line(ci,bone_shape[i],bone_shape[(i+1)%bone_shape.size()],bone_selected_color,2); + } + } + + } } } @@ -2536,6 +2557,12 @@ void CanvasItemEditor::_popup_callback(int p_op) { ((SnapDialog *)snap_dialog)->set_fields(snap_offset, snap_step, snap_rotation_offset, snap_rotation_step); snap_dialog->popup_centered(Size2(220,160)); } break; + case SKELETON_SHOW_BONES: { + skeleton_show_bones = !skeleton_show_bones; + int idx = skeleton_menu->get_item_index(SKELETON_SHOW_BONES); + skeleton_menu->set_item_checked(idx,skeleton_show_bones); + viewport->update(); + } break; case ZOOM_IN: { if (zoom>MAX_ZOOM) return; @@ -2999,6 +3026,8 @@ void CanvasItemEditor::_popup_callback(int p_op) { continue; n2d->set_meta("_edit_bone_",true); + if (!skeleton_show_bones) + skeleton_menu->activate_item(skeleton_menu->get_item_index(SKELETON_SHOW_BONES)); } viewport->update(); @@ -3017,6 +3046,8 @@ void CanvasItemEditor::_popup_callback(int p_op) { continue; n2d->set_meta("_edit_bone_",Variant()); + if (!skeleton_show_bones) + skeleton_menu->activate_item(skeleton_menu->get_item_index(SKELETON_SHOW_BONES)); } viewport->update(); @@ -3036,6 +3067,8 @@ void CanvasItemEditor::_popup_callback(int p_op) { continue; canvas_item->set_meta("_edit_ik_",true); + if (!skeleton_show_bones) + skeleton_menu->activate_item(skeleton_menu->get_item_index(SKELETON_SHOW_BONES)); } @@ -3055,6 +3088,8 @@ void CanvasItemEditor::_popup_callback(int p_op) { continue; n2d->set_meta("_edit_ik_",Variant()); + if (!skeleton_show_bones) + skeleton_menu->activate_item(skeleton_menu->get_item_index(SKELETON_SHOW_BONES)); } viewport->update(); @@ -3401,15 +3436,17 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { p->add_shortcut(ED_SHORTCUT("canvas_item_editor/expand_to_parent", TTR("Expand to Parent"), KEY_MASK_CMD | KEY_P), EXPAND_TO_PARENT); p->add_separator(); p->add_submenu_item(TTR("Skeleton.."),"skeleton"); - PopupMenu *p2 = memnew(PopupMenu); - p->add_child(p2); - p2->set_name("skeleton"); - p2->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_make_bones", TTR("Make Bones"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B ),SKELETON_MAKE_BONES); - p2->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_bones", TTR("Clear Bones")), SKELETON_CLEAR_BONES); - p2->add_separator(); - p2->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_set_ik_chain", TTR("Make IK Chain")), SKELETON_SET_IK_CHAIN); - p2->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_ik_chain", TTR("Clear IK Chain")), SKELETON_CLEAR_IK_CHAIN); - p2->connect("item_pressed", this,"_popup_callback"); + skeleton_menu = memnew(PopupMenu); + p->add_child(skeleton_menu); + skeleton_menu->set_name("skeleton"); + skeleton_menu->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_make_bones", TTR("Make Bones"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B ),SKELETON_MAKE_BONES); + skeleton_menu->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_bones", TTR("Clear Bones")), SKELETON_CLEAR_BONES); + skeleton_menu->add_separator(); + skeleton_menu->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_show_bones", TTR("Show Bones")), SKELETON_SHOW_BONES); + skeleton_menu->add_separator(); + skeleton_menu->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_set_ik_chain", TTR("Make IK Chain")), SKELETON_SET_IK_CHAIN); + skeleton_menu->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_ik_chain", TTR("Clear IK Chain")), SKELETON_CLEAR_IK_CHAIN); + skeleton_menu->connect("item_pressed", this,"_popup_callback"); /* @@ -3535,6 +3572,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { snap_show_grid=false; snap_rotation=false; snap_pixel=false; + skeleton_show_bones=true; + skeleton_menu->set_item_checked(skeleton_menu->get_item_index(SKELETON_SHOW_BONES),true); updating_value_dialog=false; box_selecting=false; //zoom=0.5; diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h index ea582f6fa7..9f4bc46eb4 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.h +++ b/tools/editor/plugins/canvas_item_editor_plugin.h @@ -124,6 +124,7 @@ class CanvasItemEditor : public VBoxContainer { VIEW_FRAME_TO_SELECTION, SKELETON_MAKE_BONES, SKELETON_CLEAR_BONES, + SKELETON_SHOW_BONES, SKELETON_SET_IK_CHAIN, SKELETON_CLEAR_IK_CHAIN @@ -175,6 +176,7 @@ class CanvasItemEditor : public VBoxContainer { bool snap_rotation; bool snap_relative; bool snap_pixel; + bool skeleton_show_bones; bool box_selecting; Point2 box_selecting_to; bool key_pos; @@ -256,6 +258,7 @@ class CanvasItemEditor : public VBoxContainer { ToolButton *ungroup_button; MenuButton *edit_menu; + PopupMenu *skeleton_menu; MenuButton *view_menu; HBoxContainer *animation_hb; MenuButton *animation_menu; diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.h b/tools/editor/plugins/collision_polygon_2d_editor_plugin.h index 982ba35fe8..431d3651c1 100644 --- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.h +++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.h @@ -95,7 +95,7 @@ class CollisionPolygon2DEditorPlugin : public EditorPlugin { public: - virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); } + virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); } virtual String get_name() const { return "CollisionPolygon2D"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/plugins/collision_shape_2d_editor_plugin.h b/tools/editor/plugins/collision_shape_2d_editor_plugin.h index 1ee81eda43..a8930dc0f2 100644 --- a/tools/editor/plugins/collision_shape_2d_editor_plugin.h +++ b/tools/editor/plugins/collision_shape_2d_editor_plugin.h @@ -86,7 +86,7 @@ class CollisionShape2DEditorPlugin : public EditorPlugin { EditorNode* editor; public: - virtual bool forward_input_event(const InputEvent& p_event) { return collision_shape_2d_editor->forward_input_event(p_event); } + virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_shape_2d_editor->forward_input_event(p_event); } virtual String get_name() const { return "CollisionShape2D"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.h b/tools/editor/plugins/light_occluder_2d_editor_plugin.h index b570fff506..0176eb87dd 100644 --- a/tools/editor/plugins/light_occluder_2d_editor_plugin.h +++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.h @@ -99,7 +99,7 @@ class LightOccluder2DEditorPlugin : public EditorPlugin { public: - virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); } + virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); } virtual String get_name() const { return "LightOccluder2D"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.h b/tools/editor/plugins/navigation_polygon_editor_plugin.h index 503b4c2662..defdebbec2 100644 --- a/tools/editor/plugins/navigation_polygon_editor_plugin.h +++ b/tools/editor/plugins/navigation_polygon_editor_plugin.h @@ -101,7 +101,7 @@ class NavigationPolygonEditorPlugin : public EditorPlugin { public: - virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); } + virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); } virtual String get_name() const { return "NavigationPolygonInstance"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/plugins/path_2d_editor_plugin.h b/tools/editor/plugins/path_2d_editor_plugin.h index 973c17464e..acbc481e09 100644 --- a/tools/editor/plugins/path_2d_editor_plugin.h +++ b/tools/editor/plugins/path_2d_editor_plugin.h @@ -108,7 +108,7 @@ class Path2DEditorPlugin : public EditorPlugin { public: - virtual bool forward_input_event(const InputEvent& p_event) { return path2d_editor->forward_input_event(p_event); } + virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return path2d_editor->forward_input_event(p_event); } virtual String get_name() const { return "Path2D"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.h b/tools/editor/plugins/polygon_2d_editor_plugin.h index d8b951ec44..33bae94340 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.h +++ b/tools/editor/plugins/polygon_2d_editor_plugin.h @@ -151,7 +151,7 @@ class Polygon2DEditorPlugin : public EditorPlugin { public: - virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); } + virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); } virtual String get_name() const { return "Polygon2D"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index fdb7856b83..fd25843de9 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -43,6 +43,17 @@ /*** SCRIPT EDITOR ****/ + +void ScriptEditorBase::_bind_methods() { + + ADD_SIGNAL(MethodInfo("name_changed")); + ADD_SIGNAL(MethodInfo("request_help_search",PropertyInfo(Variant::STRING,"topic"))); + ADD_SIGNAL(MethodInfo("request_open_script_at_line",PropertyInfo(Variant::OBJECT,"script"),PropertyInfo(Variant::INT,"line"))); + ADD_SIGNAL(MethodInfo("request_save_history")); + ADD_SIGNAL(MethodInfo("go_to_help",PropertyInfo(Variant::STRING,"what"))); + +} + static bool _can_open_in_editor(Script* p_script) { String path = p_script->get_path(); @@ -346,6 +357,34 @@ void ScriptEditor::_update_history_arrows() { script_forward->set_disabled( history_pos>=history.size()-1 ); } +void ScriptEditor::_save_history() { + + + if (history_pos>=0 && history_pos<history.size() && history[history_pos].control==tab_container->get_current_tab_control()) { + + Node *n = tab_container->get_current_tab_control(); + + if (n->cast_to<ScriptEditorBase>()) { + + history[history_pos].state=n->cast_to<ScriptEditorBase>()->get_edit_state(); + } + if (n->cast_to<EditorHelp>()) { + + history[history_pos].state=n->cast_to<EditorHelp>()->get_scroll(); + } + } + + history.resize(history_pos+1); + ScriptHistory sh; + sh.control=tab_container->get_current_tab_control(); + sh.state=Variant(); + + history.push_back(sh); + history_pos++; + + _update_history_arrows(); +} + void ScriptEditor::_go_to_tab(int p_idx) { @@ -480,6 +519,33 @@ void ScriptEditor::_close_docs_tab() { } +void ScriptEditor::_close_all_tabs() { + + int child_count = tab_container->get_child_count(); + for (int i = child_count-1; i>=0; i--) { + + tab_container->set_current_tab(i); + ScriptEditorBase *se = tab_container->get_child(i)->cast_to<ScriptEditorBase>(); + + if (se) { + + // Maybe there are unsaved changes + if (se->is_unsaved()) { + _ask_close_current_unsaved_tab(se); + continue; + } + + } + + _close_current_tab(); + } + +} + +void ScriptEditor::_ask_close_current_unsaved_tab(ScriptEditorBase *current) { + erase_tab_confirm->set_text("Close and save changes?\n\""+current->get_name()+"\""); + erase_tab_confirm->popup_centered_minsize(); +} void ScriptEditor::_resave_scripts(const String& p_str) { @@ -831,8 +897,7 @@ void ScriptEditor::_menu_option(int p_option) { case FILE_CLOSE: { if (current->is_unsaved()) { - erase_tab_confirm->set_text("Close and save changes?\n\""+current->get_name()+"\""); - erase_tab_confirm->popup_centered_minsize(); + _ask_close_current_unsaved_tab(current); } else { _close_current_tab(); } @@ -840,6 +905,9 @@ void ScriptEditor::_menu_option(int p_option) { case CLOSE_DOCS: { _close_docs_tab(); } break; + case CLOSE_ALL: { + _close_all_tabs(); + } break; case DEBUG_NEXT: { if (debugger) @@ -913,6 +981,9 @@ void ScriptEditor::_menu_option(int p_option) { case CLOSE_DOCS: { _close_docs_tab(); } break; + case CLOSE_ALL: { + _close_all_tabs(); + } break; } @@ -1291,9 +1362,8 @@ struct _ScriptEditorItemData { void ScriptEditor::_update_script_colors() { - bool enabled = EditorSettings::get_singleton()->get("text_editor/script_temperature_enabled"); - if (!enabled) - return; + bool script_temperature_enabled = EditorSettings::get_singleton()->get("text_editor/script_temperature_enabled"); + bool highlight_current = EditorSettings::get_singleton()->get("text_editor/highlight_current_script"); int hist_size = EditorSettings::get_singleton()->get("text_editor/script_temperature_history_size"); Color hot_color=EditorSettings::get_singleton()->get("text_editor/script_temperature_hot_color"); @@ -1307,20 +1377,27 @@ void ScriptEditor::_update_script_colors() { continue; script_list->set_item_custom_bg_color(i,Color(0,0,0,0)); - if (!n->has_meta("__editor_pass")) { - continue; - } - int pass=n->get_meta("__editor_pass"); - int h = edit_pass - pass; - if (h>hist_size) { - continue; - } - int non_zero_hist_size = ( hist_size == 0 ) ? 1 : hist_size; - float v = Math::ease((edit_pass-pass)/float(non_zero_hist_size),0.4); + bool current = tab_container->get_current_tab() == c; + if (current && highlight_current) { + script_list->set_item_custom_bg_color(i, EditorSettings::get_singleton()->get("text_editor/current_script_background_color")); + } else if (script_temperature_enabled) { - script_list->set_item_custom_bg_color(i,hot_color.linear_interpolate(cold_color,v)); + if (!n->has_meta("__editor_pass")) { + continue; + } + + int pass=n->get_meta("__editor_pass"); + int h = edit_pass - pass; + if (h>hist_size) { + continue; + } + int non_zero_hist_size = ( hist_size == 0 ) ? 1 : hist_size; + float v = Math::ease((edit_pass-pass)/float(non_zero_hist_size),0.4); + + script_list->set_item_custom_bg_color(i,hot_color.linear_interpolate(cold_color,v)); + } } } @@ -1476,6 +1553,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script, bool p_grab_focus) { } ERR_FAIL_COND(!se); tab_container->add_child(se); + se->set_edited_script(p_script); se->set_tooltip_request_func("_get_debug_tooltip",this); if (se->get_edit_menu()) { @@ -1497,6 +1575,11 @@ void ScriptEditor::edit(const Ref<Script>& p_script, bool p_grab_focus) { _save_layout(); se->connect("name_changed",this,"_update_script_names"); se->connect("request_help_search",this,"_help_search"); + se->connect("request_open_script_at_line",this,"_goto_script_line"); + se->connect("go_to_help",this,"_help_class_goto"); + se->connect("request_save_history",this,"_save_history"); + + //test for modification, maybe the script was not edited but was loaded @@ -1653,6 +1736,7 @@ void ScriptEditor::_editor_settings_changed() { se->update_settings(); } + _update_script_colors(); ScriptServer::set_reload_scripts_on_save(EDITOR_DEF("text_editor/auto_reload_and_parse_scripts_on_save",true)); @@ -1802,7 +1886,6 @@ void ScriptEditor::_help_class_open(const String& p_class) { void ScriptEditor::_help_class_goto(const String& p_desc) { - String cname=p_desc.get_slice(":",1); for(int i=0;i<tab_container->get_child_count();i++) { @@ -1972,6 +2055,7 @@ void ScriptEditor::_bind_methods() { ObjectTypeDB::bind_method("_menu_option",&ScriptEditor::_menu_option); ObjectTypeDB::bind_method("_close_current_tab",&ScriptEditor::_close_current_tab); ObjectTypeDB::bind_method("_close_docs_tab", &ScriptEditor::_close_docs_tab); + ObjectTypeDB::bind_method("_close_all_tabs", &ScriptEditor::_close_all_tabs); ObjectTypeDB::bind_method("_editor_play",&ScriptEditor::_editor_play); ObjectTypeDB::bind_method("_editor_pause",&ScriptEditor::_editor_pause); ObjectTypeDB::bind_method("_editor_stop",&ScriptEditor::_editor_stop); @@ -1982,6 +2066,8 @@ void ScriptEditor::_bind_methods() { ObjectTypeDB::bind_method("_goto_script_line",&ScriptEditor::_goto_script_line); ObjectTypeDB::bind_method("_goto_script_line2",&ScriptEditor::_goto_script_line2); ObjectTypeDB::bind_method("_help_search",&ScriptEditor::_help_search); + ObjectTypeDB::bind_method("_save_history",&ScriptEditor::_save_history); + ObjectTypeDB::bind_method("_breaked",&ScriptEditor::_breaked); @@ -2052,8 +2138,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reload_script_soft", TTR("Soft Reload Script"), KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_R), FILE_TOOL_RELOAD_SOFT); file_menu->get_popup()->add_separator(); - file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Prev"), KEY_MASK_CTRL|KEY_MASK_ALT|KEY_LEFT), WINDOW_PREV); - file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_next", TTR("History Next"), KEY_MASK_CTRL|KEY_MASK_ALT|KEY_RIGHT), WINDOW_NEXT); + file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Prev"), KEY_MASK_ALT|KEY_LEFT), WINDOW_PREV); + file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_next", TTR("History Next"), KEY_MASK_ALT|KEY_RIGHT), WINDOW_NEXT); file_menu->get_popup()->add_separator(); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/import_theme", TTR("Import Theme")), FILE_IMPORT_THEME); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reload_theme", TTR("Reload Theme")), FILE_RELOAD_THEME); @@ -2062,6 +2148,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { file_menu->get_popup()->add_separator(); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_docs", TTR("Close Docs")), CLOSE_DOCS); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTR("Close"), KEY_MASK_CMD | KEY_W), FILE_CLOSE); + file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_all", TTR("Close All")), CLOSE_ALL); file_menu->get_popup()->connect("item_pressed", this,"_menu_option"); @@ -2356,9 +2443,11 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) { EDITOR_DEF("external_editor/use_external_editor",false); EDITOR_DEF("external_editor/exec_path",""); EDITOR_DEF("text_editor/script_temperature_enabled",true); + EDITOR_DEF("text_editor/highlight_current_script", true); EDITOR_DEF("text_editor/script_temperature_history_size",15); EDITOR_DEF("text_editor/script_temperature_hot_color",Color(1,0,0,0.3)); EDITOR_DEF("text_editor/script_temperature_cold_color",Color(0,0,1,0.3)); + EDITOR_DEF("text_editor/current_script_background_color",Color(0.81,0.81,0.14,0.63)); EDITOR_DEF("text_editor/group_help_pages",true); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"external_editor/exec_path",PROPERTY_HINT_GLOBAL_FILE)); EDITOR_DEF("external_editor/exec_flags",""); diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 1a23ffed72..10f3bce14e 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -78,7 +78,8 @@ class ScriptEditorDebugger; class ScriptEditorBase : public Control { OBJ_TYPE( ScriptEditorBase, Control ); - +protected: + static void _bind_methods(); public: virtual void apply_code()=0; @@ -133,6 +134,7 @@ class ScriptEditor : public VBoxContainer { FILE_SAVE_THEME_AS, FILE_CLOSE, CLOSE_DOCS, + CLOSE_ALL, FILE_TOOL_RELOAD, FILE_TOOL_RELOAD_SOFT, DEBUG_NEXT, @@ -221,6 +223,9 @@ class ScriptEditor : public VBoxContainer { void _close_current_tab(); void _close_docs_tab(); + void _close_all_tabs(); + + void _ask_close_current_unsaved_tab(ScriptEditorBase *current); bool grab_focus_block; @@ -278,6 +283,7 @@ class ScriptEditor : public VBoxContainer { void _help_class_open(const String& p_class); void _help_class_goto(const String& p_desc); void _update_history_arrows(); + void _save_history(); void _go_to_tab(int p_idx); void _update_history_pos(int p_new_pos); void _update_script_colors(); diff --git a/tools/editor/plugins/script_text_editor.cpp b/tools/editor/plugins/script_text_editor.cpp index 57cf8cbea3..ca0398f069 100644 --- a/tools/editor/plugins/script_text_editor.cpp +++ b/tools/editor/plugins/script_text_editor.cpp @@ -30,6 +30,7 @@ #include "tools/editor/editor_settings.h" #include "os/keyboard.h" #include "tools/editor/script_editor_debugger.h" +#include "tools/editor/editor_node.h" Vector<String> ScriptTextEditor::get_functions() { @@ -525,6 +526,74 @@ static void swap_lines(TextEdit *tx, int line1, int line2) tx->cursor_set_line(line2); } +void ScriptTextEditor::_lookup_symbol(const String& p_symbol,int p_row, int p_column) { + + Node *base = get_tree()->get_edited_scene_root(); + if (base) { + base = _find_node_for_script(base,base,script); + } + + + ScriptLanguage::LookupResult result; + if (script->get_language()->lookup_code(code_editor->get_text_edit()->get_text_for_lookup_completion(),p_symbol,script->get_path().get_base_dir(),base,result)==OK) { + + _goto_line(p_row); + + switch(result.type) { + case ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION: { + + if (result.script.is_valid()) { + emit_signal("request_open_script_at_line",result.script,result.location-1); + } else { + emit_signal("request_save_history"); + _goto_line(result.location-1); + } + } break; + case ScriptLanguage::LookupResult::RESULT_CLASS: { + emit_signal("go_to_help","class_name:"+result.class_name); + } break; + case ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT: { + + StringName cname = result.class_name; + bool success; + while(true) { + ObjectTypeDB::get_integer_constant(cname,result.class_member,&success); + if (success) { + result.class_name=cname; + cname=ObjectTypeDB::type_inherits_from(cname); + } else { + break; + } + } + + + emit_signal("go_to_help","class_constant:"+result.class_name+":"+result.class_member); + + } break; + case ScriptLanguage::LookupResult::RESULT_CLASS_PROPERTY: { + emit_signal("go_to_help","class_property:"+result.class_name+":"+result.class_member); + + } break; + case ScriptLanguage::LookupResult::RESULT_CLASS_METHOD: { + + StringName cname = result.class_name; + + while(true) { + if (ObjectTypeDB::has_method(cname,result.class_member)) { + result.class_name=cname; + cname=ObjectTypeDB::type_inherits_from(cname); + } else { + break; + } + } + + emit_signal("go_to_help","class_method:"+result.class_name+":"+result.class_member); + + } break; + } + + } +} void ScriptTextEditor::_edit_option(int p_op) { @@ -919,9 +988,14 @@ void ScriptTextEditor::_bind_methods() { ObjectTypeDB::bind_method("_breakpoint_toggled",&ScriptTextEditor::_breakpoint_toggled); ObjectTypeDB::bind_method("_edit_option",&ScriptTextEditor::_edit_option); ObjectTypeDB::bind_method("_goto_line",&ScriptTextEditor::_goto_line); + ObjectTypeDB::bind_method("_lookup_symbol",&ScriptTextEditor::_lookup_symbol); + + + + ObjectTypeDB::bind_method("get_drag_data_fw",&ScriptTextEditor::get_drag_data_fw); + ObjectTypeDB::bind_method("can_drop_data_fw",&ScriptTextEditor::can_drop_data_fw); + ObjectTypeDB::bind_method("drop_data_fw",&ScriptTextEditor::drop_data_fw); - ADD_SIGNAL(MethodInfo("name_changed")); - ADD_SIGNAL(MethodInfo("request_help_search",PropertyInfo(Variant::STRING,"topic"))); } Control *ScriptTextEditor::get_edit_menu() { @@ -957,6 +1031,144 @@ void ScriptTextEditor::set_debugger_active(bool p_active) { } + +Variant ScriptTextEditor::get_drag_data_fw(const Point2& p_point,Control* p_from) { + + return Variant(); +} + +bool ScriptTextEditor::can_drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from) const{ + + Dictionary d = p_data; + if (d.has("type") && + ( + + String(d["type"])=="resource" || + String(d["type"])=="files" || + String(d["type"])=="nodes" + ) ) { + + + return true; + } + + + return false; + +} + +#ifdef TOOLS_ENABLED + +static Node* _find_script_node(Node* p_edited_scene,Node* p_current_node,const Ref<Script> &script) { + + if (p_edited_scene!=p_current_node && p_current_node->get_owner()!=p_edited_scene) + return NULL; + + Ref<Script> scr = p_current_node->get_script(); + + if (scr.is_valid() && scr==script) + return p_current_node; + + for(int i=0;i<p_current_node->get_child_count();i++) { + Node *n = _find_script_node(p_edited_scene,p_current_node->get_child(i),script); + if (n) + return n; + } + + return NULL; +} + +#else + +static Node* _find_script_node(Node* p_edited_scene,Node* p_current_node,const Ref<Script> &script) { + + return NULL; +} +#endif + + + + +void ScriptTextEditor::drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from){ + + Dictionary d = p_data; + + if (d.has("type") && String(d["type"])=="resource") { + + Ref<Resource> res = d["resource"]; + if (!res.is_valid()) { + return; + } + + if (res->get_path().is_resource_file()) { + EditorNode::get_singleton()->show_warning("Only resources from filesystem can be dropped."); + return; + } + + code_editor->get_text_edit()->insert_text_at_cursor(res->get_path()); + + } + + if (d.has("type") && String(d["type"])=="files") { + + + Array files = d["files"]; + + String text_to_drop; + for(int i=0;i<files.size();i++) { + + if (i>0) + text_to_drop+=","; + text_to_drop+="\""+String(files[i]).c_escape()+"\""; + + } + + code_editor->get_text_edit()->insert_text_at_cursor(text_to_drop); + + } + + if (d.has("type") && String(d["type"])=="nodes") { + + Node* sn = _find_script_node(get_tree()->get_edited_scene_root(),get_tree()->get_edited_scene_root(),script); + + + if (!sn) { + EditorNode::get_singleton()->show_warning("Can't drop nodes because script '"+get_name()+"' is not used in this scene."); + return; + } + + + Array nodes = d["nodes"]; + String text_to_drop; + for(int i=0;i<nodes.size();i++) { + + if (i>0) + text_to_drop+=","; + + NodePath np = nodes[i]; + Node *node = get_node(np); + if (!node) { + continue; + } + + + + String path = sn->get_path_to(node); + text_to_drop+="\""+path.c_escape()+"\""; + + + } + + code_editor->get_text_edit()->insert_text_at_cursor(text_to_drop); + + + } + + + +} + + ScriptTextEditor::ScriptTextEditor() { code_editor = memnew( CodeTextEditor ); @@ -966,6 +1178,8 @@ ScriptTextEditor::ScriptTextEditor() { code_editor->connect("load_theme_settings",this,"_load_theme_settings"); code_editor->set_code_complete_func(_code_complete_scripts,this); code_editor->get_text_edit()->connect("breakpoint_toggled", this, "_breakpoint_toggled"); + code_editor->get_text_edit()->connect("symbol_lookup", this, "_lookup_symbol"); + code_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); code_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); @@ -982,6 +1196,8 @@ ScriptTextEditor::ScriptTextEditor() { EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"), EditorSettings::get_singleton()->get("text_editor/callhint_tooltip_offset")); + code_editor->get_text_edit()->set_select_identifiers_on_hover(true); + edit_hb = memnew (HBoxContainer); edit_menu = memnew( MenuButton ); @@ -1039,6 +1255,9 @@ ScriptTextEditor::ScriptTextEditor() { goto_line_dialog = memnew(GotoLineDialog); add_child(goto_line_dialog); + + + code_editor->get_text_edit()->set_drag_forwarding(this); } static ScriptEditorBase * create_editor(const Ref<Script>& p_script) { @@ -1060,8 +1279,8 @@ void ScriptTextEditor::register_editor() { ED_SHORTCUT("script_text_editor/select_all", TTR("Select All"), KEY_MASK_CMD|KEY_A); ED_SHORTCUT("script_text_editor/move_up", TTR("Move Up"), KEY_MASK_ALT|KEY_UP); ED_SHORTCUT("script_text_editor/move_down", TTR("Move Down"), KEY_MASK_ALT|KEY_DOWN); - ED_SHORTCUT("script_text_editor/indent_left", TTR("Indent Left"), KEY_MASK_ALT|KEY_LEFT); - ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), KEY_MASK_ALT|KEY_RIGHT); + ED_SHORTCUT("script_text_editor/indent_left", TTR("Indent Left"), 0); + ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), 0); ED_SHORTCUT("script_text_editor/toggle_comment", TTR("Toggle Comment"), KEY_MASK_CMD|KEY_K); ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD|KEY_B); #ifdef OSX_ENABLED diff --git a/tools/editor/plugins/script_text_editor.h b/tools/editor/plugins/script_text_editor.h index 247fd97e81..2c7eac6095 100644 --- a/tools/editor/plugins/script_text_editor.h +++ b/tools/editor/plugins/script_text_editor.h @@ -98,6 +98,12 @@ protected: void _edit_option(int p_op); void _goto_line(int p_line) { goto_line(p_line); } + void _lookup_symbol(const String& p_symbol,int p_row, int p_column); + + Variant get_drag_data_fw(const Point2& p_point,Control* p_from); + bool can_drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from) const; + void drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from); + public: virtual void apply_code(); diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index 815da48e96..3ab906f84e 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -901,6 +901,7 @@ void ShaderGraphView::_variant_edited() { case Variant::COLOR: v2=Color(); break; + default: {} } UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); ur->create_action(TTR("Change Default Value")); @@ -1321,6 +1322,7 @@ void ShaderGraphView::_default_changed(int p_id, Node *p_button, int p_param, in h=PROPERTY_HINT_COLOR_NO_ALPHA; v=Color(); break; + default: {} } ped_popup->edit(NULL,"",vt,v,h,p_hint); @@ -1347,6 +1349,8 @@ ToolButton *ShaderGraphView::make_label(String text, Variant::Type v_type) { break; case Variant::COLOR: l->set_icon(ped_popup->get_icon("Color", "EditorIcons")); + break; + default: {} } return l; } @@ -1372,7 +1376,7 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int case Variant::TRANSFORM: edit->set_icon(ped_popup->get_icon("Matrix", "EditorIcons")); break; - case Variant::COLOR: + case Variant::COLOR: { Image icon_color = Image(15,15,false,Image::FORMAT_RGB); Color c = graph->default_get_value(type,p_id,param); for (int x=1;x<14;x++) @@ -1382,7 +1386,8 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int t.instance(); t->create_from_image(icon_color); edit->set_icon(t); - break; + } break; + default: {} } return edit; } @@ -2417,6 +2422,7 @@ void ShaderGraphView::_create_node(int p_id) { colors.push_back("Color"); colors.push_back("LightColor"); colors.push_back("Light"); + colors.push_back("ShadowColor"); colors.push_back("Diffuse"); colors.push_back("Specular"); colors.push_back("Emmision"); @@ -2429,6 +2435,7 @@ void ShaderGraphView::_create_node(int p_id) { reals.push_back("ShadeParam"); reals.push_back("SpecularExp"); reals.push_back("LightAlpha"); + reals.push_back("ShadowAlpha"); reals.push_back("PointSize"); reals.push_back("Discard"); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 95106d2c81..9701b8030d 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -3151,6 +3151,8 @@ void SpatialEditor::_init_indicators() { Vector<Color> origin_colors; Vector<Vector3> origin_points; + Color grid_color = EditorSettings::get_singleton()->get("3d_editor/grid_color"); + for(int i=0;i<3;i++) { Vector3 axis; axis[i]=1; @@ -3168,10 +3170,10 @@ void SpatialEditor::_init_indicators() { for(int j=-ORIGIN_GRID_SIZE;j<=ORIGIN_GRID_SIZE;j++) { - grid_colors[i].push_back(Color(axis.x,axis.y,axis.z,0.2)); - grid_colors[i].push_back(Color(axis.x,axis.y,axis.z,0.2)); - grid_colors[i].push_back(Color(axis.x,axis.y,axis.z,0.2)); - grid_colors[i].push_back(Color(axis.x,axis.y,axis.z,0.2)); + grid_colors[i].push_back(grid_color); + grid_colors[i].push_back(grid_color); + grid_colors[i].push_back(grid_color); + grid_colors[i].push_back(grid_color); grid_points[i].push_back(axis_n1*ORIGIN_GRID_SIZE+axis_n2*j); grid_points[i].push_back(-axis_n1*ORIGIN_GRID_SIZE+axis_n2*j); grid_points[i].push_back(axis_n2*ORIGIN_GRID_SIZE+axis_n1*j); @@ -3467,6 +3469,8 @@ void SpatialEditor::_unhandled_key_input(InputEvent p_event) { if (!is_visible() || get_viewport()->gui_has_modal_stack()) return; +#if 0 +//i don't remember this being used, why was it here? { EditorNode *en = editor; @@ -3478,6 +3482,7 @@ void SpatialEditor::_unhandled_key_input(InputEvent p_event) { } } +#endif switch(p_event.type) { diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index 822d9e6c87..43fe7d7ea9 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -289,15 +289,16 @@ void TileMapEditor::_pick_tile(const Point2& p_pos) { canvas_item_editor->update(); } -DVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start) { +DVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start, bool erase) { - if (node->get_cell(p_start.x, p_start.y) != TileMap::INVALID_CELL) - return DVector<Vector2>(); + int prev_id = node->get_cell(p_start.x, p_start.y); + int id = TileMap::INVALID_CELL; + if (!erase) { + id = get_selected_tile(); - int id = get_selected_tile(); - - if (id == TileMap::INVALID_CELL) - return DVector<Vector2>(); + if (id == TileMap::INVALID_CELL) + return DVector<Vector2>(); + } Rect2 r = node->get_item_rect(); r.pos = r.pos/node->get_cell_size(); @@ -316,7 +317,7 @@ DVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start) { if (!r.has_point(n)) continue; - if (node->get_cell(n.x, n.y) == TileMap::INVALID_CELL) { + if (node->get_cell(n.x, n.y) == prev_id) { node->set_cellv(n, id, flip_h, flip_v, transpose); @@ -685,6 +686,12 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) { } else if (tool==TOOL_BUCKET) { + Dictionary pop; + pop["id"] = node->get_cell(over_tile.x, over_tile.y); + pop["flip_h"] = node->is_cell_x_flipped(over_tile.x, over_tile.y); + pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y); + pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y); + DVector<Vector2> points = _bucket_fill(over_tile); if (points.size() == 0) @@ -699,7 +706,7 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) { undo_redo->create_action("Bucket Fill"); undo_redo->add_do_method(this, "_fill_points", points, op); - undo_redo->add_undo_method(this, "_erase_points", points); + undo_redo->add_undo_method(this, "_fill_points", points, pop); undo_redo->commit_action(); } @@ -782,6 +789,26 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) { tool=TOOL_NONE; return true; + + } else if (tool==TOOL_BUCKET) { + + Dictionary pop; + pop["id"] = node->get_cell(over_tile.x, over_tile.y); + pop["flip_h"] = node->is_cell_x_flipped(over_tile.x, over_tile.y); + pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y); + pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y); + + DVector<Vector2> points = _bucket_fill(over_tile, true); + + if (points.size() == 0) + return false; + + undo_redo->create_action("Bucket Fill"); + + undo_redo->add_do_method(this, "_erase_points", points); + undo_redo->add_undo_method(this, "_fill_points", points, pop); + + undo_redo->commit_action(); } } } @@ -798,7 +825,7 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) { canvas_item_editor->update(); } - int tile_under = node->get_cell(over_tile.x, over_tile.y); + int tile_under = node->get_cell(over_tile.x, over_tile.y); String tile_name = "none"; if (node->get_tileset()->has_tile(tile_under)) diff --git a/tools/editor/plugins/tile_map_editor_plugin.h b/tools/editor/plugins/tile_map_editor_plugin.h index 666290489b..2f24002770 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.h +++ b/tools/editor/plugins/tile_map_editor_plugin.h @@ -129,7 +129,7 @@ class TileMapEditor : public VBoxContainer { void _pick_tile(const Point2& p_pos); - DVector<Vector2> _bucket_fill(const Point2i& p_start); + DVector<Vector2> _bucket_fill(const Point2i& p_start, bool erase=false); void _fill_points(const DVector<Vector2> p_points, const Dictionary& p_op); void _erase_points(const DVector<Vector2> p_points); @@ -181,7 +181,7 @@ class TileMapEditorPlugin : public EditorPlugin { public: - virtual bool forward_input_event(const InputEvent& p_event) { return tile_map_editor->forward_input_event(p_event); } + virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return tile_map_editor->forward_input_event(p_event); } virtual String get_name() const { return "TileMap"; } bool has_main_screen() const { return false; } diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index dc1d6ec0f9..b2eae2f6d1 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -1185,26 +1185,27 @@ ProjectManager::ProjectManager() { { int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode"); if (dpi_mode==0) { - editor_set_hidpi( OS::get_singleton()->get_screen_dpi(0) > 150 ); + editor_set_scale( OS::get_singleton()->get_screen_dpi(0) > 150 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x>2000 ? 2.0 : 1.0 ); + } else if (dpi_mode==1) { + editor_set_scale(0.75); } else if (dpi_mode==2) { - editor_set_hidpi(true); - } else { - editor_set_hidpi(false); + editor_set_scale(1.0); + } else if (dpi_mode==3) { + editor_set_scale(1.5); + } else if (dpi_mode==4) { + editor_set_scale(2.0); } } FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); set_area_as_parent_rect(); + set_theme(create_editor_theme()); gui_base = memnew( Control ); add_child(gui_base); gui_base->set_area_as_parent_rect(); - set_theme(create_default_theme()); - Ref<Theme> theme = create_editor_theme(); - gui_base->set_theme(theme); - Panel *panel = memnew( Panel ); gui_base->add_child(panel); panel->set_area_as_parent_rect(); @@ -1391,6 +1392,8 @@ ProjectManager::ProjectManager() { last_clicked = ""; SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped"); + + gui_base->set_theme(create_custom_theme()); } diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 2ea28e26ad..6641297491 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -214,6 +214,12 @@ void CustomPropertyEditor::_menu_option(int p_which) { } } } break; + case OBJ_MENU_NEW_SCRIPT: { + + if (owner->cast_to<Node>()) + EditorNode::get_singleton()->get_scene_tree_dock()->open_script_dialog(owner->cast_to<Node>()); + + } break; default: { @@ -850,8 +856,10 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty menu->clear(); menu->set_size(Size2(1,1)); - - if (hint_text!="") { + if (p_name=="script/script" && hint_text=="Script" && owner->cast_to<Node>()) { + menu->add_icon_item(get_icon("Script","EditorIcons"),TTR("New Script"),OBJ_MENU_NEW_SCRIPT); + menu->add_separator(); + } else if (hint_text!="") { int idx=0; for(int i=0;i<hint_text.get_slice_count(",");i++) { @@ -3041,7 +3049,7 @@ void PropertyEditor::update_tree() { if (E) { descr=E->get().brief_description; } - class_descr_cache[type]=descr.world_wrap(80); + class_descr_cache[type]=descr.word_wrap(80); } @@ -3134,7 +3142,7 @@ void PropertyEditor::update_tree() { if (E) { for(int i=0;i<E->get().methods.size();i++) { if (E->get().methods[i].name==setter.operator String()) { - descr=E->get().methods[i].description.strip_edges().world_wrap(80); + descr=E->get().methods[i].description.strip_edges().word_wrap(80); } } } @@ -4557,7 +4565,7 @@ void SectionedPropertyEditor::update_category_list() { else if ( !(pi.usage&PROPERTY_USAGE_EDITOR) ) continue; - if (pi.name.find(":")!=-1 || pi.name=="script/script") + if (pi.name.find(":")!=-1 || pi.name=="script/script" || pi.name.begins_with("resource/")) continue; int sp = pi.name.find("/"); if (sp!=-1) { diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index 6c6c309d32..3fe332bf87 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -65,6 +65,7 @@ class CustomPropertyEditor : public Popup { OBJ_MENU_COPY=4, OBJ_MENU_PASTE=5, OBJ_MENU_REIMPORT=6, + OBJ_MENU_NEW_SCRIPT=7, TYPE_BASE_ID=100 }; diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 506dfd3889..9c4e641535 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -1841,6 +1841,12 @@ void SceneTreeDock::_focus_node() { } } +void SceneTreeDock::open_script_dialog(Node* p_for_node) { + + scene_tree->set_selected(p_for_node,false); + _tool_selected(TOOL_SCRIPT); +} + void SceneTreeDock::_bind_methods() { ObjectTypeDB::bind_method(_MD("_tool_selected"),&SceneTreeDock::_tool_selected,DEFVAL(false)); diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h index d92f12c34b..971013a568 100644 --- a/tools/editor/scene_tree_dock.h +++ b/tools/editor/scene_tree_dock.h @@ -175,6 +175,7 @@ public: SceneTreeEditor *get_tree_editor() { return scene_tree; } + void open_script_dialog(Node* p_for_node); SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelection *p_editor_selection,EditorData &p_editor_data); }; diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index e5a97fa26e..53bfe8cc57 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -254,7 +254,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id) String config_err = n->get_configuration_warning(); if (config_err==String()) return; - config_err=config_err.world_wrap(80); + config_err=config_err.word_wrap(80); warning->set_text(config_err); warning->popup_centered_minsize(); diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index 694413cf18..c8170ca9a3 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -1089,6 +1089,9 @@ void ScriptEditorDebugger::start() { stop(); + if (!EditorNode::get_log()->is_visible()) { + EditorNode::get_singleton()->make_bottom_panel_item_visible(EditorNode::get_log()); + } uint16_t port = GLOBAL_DEF("debug/remote_port",6007); perf_history.clear(); diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 480d33fd0a..84803eb6db 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -422,8 +422,6 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po if (billboard_handle) { t.set_look_at(t.origin,t.origin+p_camera->get_transform().basis.get_axis(2),p_camera->get_transform().basis.get_axis(1)); } - Transform ti=t.affine_inverse(); - float min_d=1e20; int idx=-1; diff --git a/tools/ios_xcode_template/data.pck b/tools/ios_xcode_template/data.pck deleted file mode 100644 index e69de29bb2..0000000000 --- a/tools/ios_xcode_template/data.pck +++ /dev/null diff --git a/tools/ios_xcode_template/godot_ios.xcodeproj/project.pbxproj b/tools/ios_xcode_template/godot_ios.xcodeproj/project.pbxproj deleted file mode 100644 index 4ae1ec8a53..0000000000 --- a/tools/ios_xcode_template/godot_ios.xcodeproj/project.pbxproj +++ /dev/null @@ -1,469 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - D0BCFE3818AEBDA2004A7AAE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE3718AEBDA2004A7AAE /* Foundation.framework */; }; - D0BCFE3A18AEBDA2004A7AAE /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE3918AEBDA2004A7AAE /* CoreGraphics.framework */; }; - D0BCFE3C18AEBDA2004A7AAE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE3B18AEBDA2004A7AAE /* UIKit.framework */; }; - D0BCFE3E18AEBDA2004A7AAE /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE3D18AEBDA2004A7AAE /* GLKit.framework */; }; - D0BCFE4018AEBDA2004A7AAE /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE3F18AEBDA2004A7AAE /* OpenGLES.framework */; }; - D0BCFE4618AEBDA2004A7AAE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE4418AEBDA2004A7AAE /* InfoPlist.strings */; }; - D0BCFE6218AEBDA3004A7AAE /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE6118AEBDA3004A7AAE /* XCTest.framework */; }; - D0BCFE6318AEBDA3004A7AAE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE3718AEBDA2004A7AAE /* Foundation.framework */; }; - D0BCFE6418AEBDA3004A7AAE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE3B18AEBDA2004A7AAE /* UIKit.framework */; }; - D0BCFE6C18AEBDA3004A7AAE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE6A18AEBDA3004A7AAE /* InfoPlist.strings */; }; - D0BCFE6E18AEBDA3004A7AAE /* godot_iosTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D0BCFE6D18AEBDA3004A7AAE /* godot_iosTests.m */; }; - D0BCFE7818AEBFEB004A7AAE /* data.pck in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE7718AEBFEB004A7AAE /* data.pck */; }; - D0BCFE7A18AEC06A004A7AAE /* godot_opt.iphone in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE7918AEC06A004A7AAE /* godot_opt.iphone */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - D0BCFE6518AEBDA3004A7AAE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D0BCFE2C18AEBDA2004A7AAE /* Project object */; - proxyType = 1; - remoteGlobalIDString = D0BCFE3318AEBDA2004A7AAE; - remoteInfo = godot_ios; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - D0BCFE3418AEBDA2004A7AAE /* godot_ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = godot_ios.app; sourceTree = BUILT_PRODUCTS_DIR; }; - D0BCFE3718AEBDA2004A7AAE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - D0BCFE3918AEBDA2004A7AAE /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - D0BCFE3B18AEBDA2004A7AAE /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - D0BCFE3D18AEBDA2004A7AAE /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; }; - D0BCFE3F18AEBDA2004A7AAE /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; - D0BCFE4318AEBDA2004A7AAE /* godot_ios-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "godot_ios-Info.plist"; sourceTree = "<group>"; }; - D0BCFE4518AEBDA2004A7AAE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - D0BCFE4918AEBDA2004A7AAE /* godot_ios-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "godot_ios-Prefix.pch"; sourceTree = "<group>"; }; - D0BCFE6018AEBDA3004A7AAE /* godot_iosTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = godot_iosTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - D0BCFE6118AEBDA3004A7AAE /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; - D0BCFE6918AEBDA3004A7AAE /* godot_iosTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "godot_iosTests-Info.plist"; sourceTree = "<group>"; }; - D0BCFE6B18AEBDA3004A7AAE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - D0BCFE6D18AEBDA3004A7AAE /* godot_iosTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = godot_iosTests.m; sourceTree = "<group>"; }; - D0BCFE7718AEBFEB004A7AAE /* data.pck */ = {isa = PBXFileReference; lastKnownFileType = file; path = data.pck; sourceTree = "<group>"; }; - D0BCFE7918AEC06A004A7AAE /* godot_opt.iphone */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = godot_opt.iphone; sourceTree = "<group>"; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - D0BCFE3118AEBDA2004A7AAE /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D0BCFE4018AEBDA2004A7AAE /* OpenGLES.framework in Frameworks */, - D0BCFE3A18AEBDA2004A7AAE /* CoreGraphics.framework in Frameworks */, - D0BCFE3C18AEBDA2004A7AAE /* UIKit.framework in Frameworks */, - D0BCFE3E18AEBDA2004A7AAE /* GLKit.framework in Frameworks */, - D0BCFE3818AEBDA2004A7AAE /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D0BCFE5D18AEBDA3004A7AAE /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D0BCFE6218AEBDA3004A7AAE /* XCTest.framework in Frameworks */, - D0BCFE6418AEBDA3004A7AAE /* UIKit.framework in Frameworks */, - D0BCFE6318AEBDA3004A7AAE /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - D0BCFE2B18AEBDA2004A7AAE = { - isa = PBXGroup; - children = ( - D0BCFE7918AEC06A004A7AAE /* godot_opt.iphone */, - D0BCFE7718AEBFEB004A7AAE /* data.pck */, - D0BCFE4118AEBDA2004A7AAE /* godot_ios */, - D0BCFE6718AEBDA3004A7AAE /* godot_iosTests */, - D0BCFE3618AEBDA2004A7AAE /* Frameworks */, - D0BCFE3518AEBDA2004A7AAE /* Products */, - ); - sourceTree = "<group>"; - }; - D0BCFE3518AEBDA2004A7AAE /* Products */ = { - isa = PBXGroup; - children = ( - D0BCFE3418AEBDA2004A7AAE /* godot_ios.app */, - D0BCFE6018AEBDA3004A7AAE /* godot_iosTests.xctest */, - ); - name = Products; - sourceTree = "<group>"; - }; - D0BCFE3618AEBDA2004A7AAE /* Frameworks */ = { - isa = PBXGroup; - children = ( - D0BCFE3718AEBDA2004A7AAE /* Foundation.framework */, - D0BCFE3918AEBDA2004A7AAE /* CoreGraphics.framework */, - D0BCFE3B18AEBDA2004A7AAE /* UIKit.framework */, - D0BCFE3D18AEBDA2004A7AAE /* GLKit.framework */, - D0BCFE3F18AEBDA2004A7AAE /* OpenGLES.framework */, - D0BCFE6118AEBDA3004A7AAE /* XCTest.framework */, - ); - name = Frameworks; - sourceTree = "<group>"; - }; - D0BCFE4118AEBDA2004A7AAE /* godot_ios */ = { - isa = PBXGroup; - children = ( - D0BCFE4218AEBDA2004A7AAE /* Supporting Files */, - ); - path = godot_ios; - sourceTree = "<group>"; - }; - D0BCFE4218AEBDA2004A7AAE /* Supporting Files */ = { - isa = PBXGroup; - children = ( - D0BCFE4318AEBDA2004A7AAE /* godot_ios-Info.plist */, - D0BCFE4418AEBDA2004A7AAE /* InfoPlist.strings */, - D0BCFE4918AEBDA2004A7AAE /* godot_ios-Prefix.pch */, - ); - name = "Supporting Files"; - sourceTree = "<group>"; - }; - D0BCFE6718AEBDA3004A7AAE /* godot_iosTests */ = { - isa = PBXGroup; - children = ( - D0BCFE6D18AEBDA3004A7AAE /* godot_iosTests.m */, - D0BCFE6818AEBDA3004A7AAE /* Supporting Files */, - ); - path = godot_iosTests; - sourceTree = "<group>"; - }; - D0BCFE6818AEBDA3004A7AAE /* Supporting Files */ = { - isa = PBXGroup; - children = ( - D0BCFE6918AEBDA3004A7AAE /* godot_iosTests-Info.plist */, - D0BCFE6A18AEBDA3004A7AAE /* InfoPlist.strings */, - ); - name = "Supporting Files"; - sourceTree = "<group>"; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - D0BCFE3318AEBDA2004A7AAE /* godot_ios */ = { - isa = PBXNativeTarget; - buildConfigurationList = D0BCFE7118AEBDA3004A7AAE /* Build configuration list for PBXNativeTarget "godot_ios" */; - buildPhases = ( - D0BCFE3018AEBDA2004A7AAE /* Sources */, - D0BCFE3118AEBDA2004A7AAE /* Frameworks */, - D0BCFE3218AEBDA2004A7AAE /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = godot_ios; - productName = godot_ios; - productReference = D0BCFE3418AEBDA2004A7AAE /* godot_ios.app */; - productType = "com.apple.product-type.application"; - }; - D0BCFE5F18AEBDA3004A7AAE /* godot_iosTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = D0BCFE7418AEBDA3004A7AAE /* Build configuration list for PBXNativeTarget "godot_iosTests" */; - buildPhases = ( - D0BCFE5C18AEBDA3004A7AAE /* Sources */, - D0BCFE5D18AEBDA3004A7AAE /* Frameworks */, - D0BCFE5E18AEBDA3004A7AAE /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - D0BCFE6618AEBDA3004A7AAE /* PBXTargetDependency */, - ); - name = godot_iosTests; - productName = godot_iosTests; - productReference = D0BCFE6018AEBDA3004A7AAE /* godot_iosTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - D0BCFE2C18AEBDA2004A7AAE /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0500; - ORGANIZATIONNAME = GodotEngine; - TargetAttributes = { - D0BCFE5F18AEBDA3004A7AAE = { - TestTargetID = D0BCFE3318AEBDA2004A7AAE; - }; - }; - }; - buildConfigurationList = D0BCFE2F18AEBDA2004A7AAE /* Build configuration list for PBXProject "godot_ios" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = D0BCFE2B18AEBDA2004A7AAE; - productRefGroup = D0BCFE3518AEBDA2004A7AAE /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - D0BCFE3318AEBDA2004A7AAE /* godot_ios */, - D0BCFE5F18AEBDA3004A7AAE /* godot_iosTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - D0BCFE3218AEBDA2004A7AAE /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D0BCFE7818AEBFEB004A7AAE /* data.pck in Resources */, - D0BCFE4618AEBDA2004A7AAE /* InfoPlist.strings in Resources */, - D0BCFE7A18AEC06A004A7AAE /* godot_opt.iphone in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D0BCFE5E18AEBDA3004A7AAE /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D0BCFE6C18AEBDA3004A7AAE /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - D0BCFE3018AEBDA2004A7AAE /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D0BCFE5C18AEBDA3004A7AAE /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D0BCFE6E18AEBDA3004A7AAE /* godot_iosTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - D0BCFE6618AEBDA3004A7AAE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = D0BCFE3318AEBDA2004A7AAE /* godot_ios */; - targetProxy = D0BCFE6518AEBDA3004A7AAE /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - D0BCFE4418AEBDA2004A7AAE /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - D0BCFE4518AEBDA2004A7AAE /* en */, - ); - name = InfoPlist.strings; - sourceTree = "<group>"; - }; - D0BCFE6A18AEBDA3004A7AAE /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - D0BCFE6B18AEBDA3004A7AAE /* en */, - ); - name = InfoPlist.strings; - sourceTree = "<group>"; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - D0BCFE6F18AEBDA3004A7AAE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - D0BCFE7018AEBDA3004A7AAE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - D0BCFE7218AEBDA3004A7AAE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD)"; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "godot_ios/godot_ios-Prefix.pch"; - INFOPLIST_FILE = "godot_ios/godot_ios-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - VALID_ARCHS = "armv7 armv7s"; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - D0BCFE7318AEBDA3004A7AAE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD)"; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "godot_ios/godot_ios-Prefix.pch"; - INFOPLIST_FILE = "godot_ios/godot_ios-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - VALID_ARCHS = "armv7 armv7s"; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; - D0BCFE7518AEBDA3004A7AAE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/godot_ios.app/godot_ios"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "godot_ios/godot_ios-Prefix.pch"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = "godot_iosTests/godot_iosTests-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = xctest; - }; - name = Debug; - }; - D0BCFE7618AEBDA3004A7AAE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/godot_ios.app/godot_ios"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "godot_ios/godot_ios-Prefix.pch"; - INFOPLIST_FILE = "godot_iosTests/godot_iosTests-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = xctest; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - D0BCFE2F18AEBDA2004A7AAE /* Build configuration list for PBXProject "godot_ios" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D0BCFE6F18AEBDA3004A7AAE /* Debug */, - D0BCFE7018AEBDA3004A7AAE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D0BCFE7118AEBDA3004A7AAE /* Build configuration list for PBXNativeTarget "godot_ios" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D0BCFE7218AEBDA3004A7AAE /* Debug */, - D0BCFE7318AEBDA3004A7AAE /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; - D0BCFE7418AEBDA3004A7AAE /* Build configuration list for PBXNativeTarget "godot_iosTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D0BCFE7518AEBDA3004A7AAE /* Debug */, - D0BCFE7618AEBDA3004A7AAE /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - }; - rootObject = D0BCFE2C18AEBDA2004A7AAE /* Project object */; -} diff --git a/tools/ios_xcode_template/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tools/ios_xcode_template/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 3c9ba38bbe..0000000000 --- a/tools/ios_xcode_template/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Workspace - version = "1.0"> - <FileRef - location = "self:godot_ios.xcodeproj"> - </FileRef> -</Workspace> diff --git a/tools/ios_xcode_template/godot_ios.xcodeproj/project.xcworkspace/xcuserdata/punto.xcuserdatad/UserInterfaceState.xcuserstate b/tools/ios_xcode_template/godot_ios.xcodeproj/project.xcworkspace/xcuserdata/punto.xcuserdatad/UserInterfaceState.xcuserstate Binary files differdeleted file mode 100644 index 7c338929ed..0000000000 --- a/tools/ios_xcode_template/godot_ios.xcodeproj/project.xcworkspace/xcuserdata/punto.xcuserdatad/UserInterfaceState.xcuserstate +++ /dev/null diff --git a/tools/ios_xcode_template/godot_ios.xcodeproj/xcuserdata/punto.xcuserdatad/xcschemes/godot_ios.xcscheme b/tools/ios_xcode_template/godot_ios.xcodeproj/xcuserdata/punto.xcuserdatad/xcschemes/godot_ios.xcscheme deleted file mode 100644 index 19af55b4a2..0000000000 --- a/tools/ios_xcode_template/godot_ios.xcodeproj/xcuserdata/punto.xcuserdatad/xcschemes/godot_ios.xcscheme +++ /dev/null @@ -1,96 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Scheme - LastUpgradeVersion = "0500" - version = "1.3"> - <BuildAction - parallelizeBuildables = "YES" - buildImplicitDependencies = "YES"> - <BuildActionEntries> - <BuildActionEntry - buildForTesting = "YES" - buildForRunning = "YES" - buildForProfiling = "YES" - buildForArchiving = "YES" - buildForAnalyzing = "YES"> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "D0BCFE3318AEBDA2004A7AAE" - BuildableName = "godot_ios.app" - BlueprintName = "godot_ios" - ReferencedContainer = "container:godot_ios.xcodeproj"> - </BuildableReference> - </BuildActionEntry> - </BuildActionEntries> - </BuildAction> - <TestAction - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES" - buildConfiguration = "Debug"> - <Testables> - <TestableReference - skipped = "NO"> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "D0BCFE5F18AEBDA3004A7AAE" - BuildableName = "godot_iosTests.xctest" - BlueprintName = "godot_iosTests" - ReferencedContainer = "container:godot_ios.xcodeproj"> - </BuildableReference> - </TestableReference> - </Testables> - <MacroExpansion> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "D0BCFE3318AEBDA2004A7AAE" - BuildableName = "godot_ios.app" - BlueprintName = "godot_ios" - ReferencedContainer = "container:godot_ios.xcodeproj"> - </BuildableReference> - </MacroExpansion> - </TestAction> - <LaunchAction - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - launchStyle = "0" - useCustomWorkingDirectory = "NO" - buildConfiguration = "Debug" - ignoresPersistentStateOnLaunch = "NO" - debugDocumentVersioning = "YES" - allowLocationSimulation = "YES"> - <BuildableProductRunnable> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "D0BCFE3318AEBDA2004A7AAE" - BuildableName = "godot_ios.app" - BlueprintName = "godot_ios" - ReferencedContainer = "container:godot_ios.xcodeproj"> - </BuildableReference> - </BuildableProductRunnable> - <AdditionalOptions> - </AdditionalOptions> - </LaunchAction> - <ProfileAction - shouldUseLaunchSchemeArgsEnv = "YES" - savedToolIdentifier = "" - useCustomWorkingDirectory = "NO" - buildConfiguration = "Release" - debugDocumentVersioning = "YES"> - <BuildableProductRunnable> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "D0BCFE3318AEBDA2004A7AAE" - BuildableName = "godot_ios.app" - BlueprintName = "godot_ios" - ReferencedContainer = "container:godot_ios.xcodeproj"> - </BuildableReference> - </BuildableProductRunnable> - </ProfileAction> - <AnalyzeAction - buildConfiguration = "Debug"> - </AnalyzeAction> - <ArchiveAction - buildConfiguration = "Release" - revealArchiveInOrganizer = "YES"> - </ArchiveAction> -</Scheme> diff --git a/tools/ios_xcode_template/godot_ios.xcodeproj/xcuserdata/punto.xcuserdatad/xcschemes/xcschememanagement.plist b/tools/ios_xcode_template/godot_ios.xcodeproj/xcuserdata/punto.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 4a3a16cbdb..0000000000 --- a/tools/ios_xcode_template/godot_ios.xcodeproj/xcuserdata/punto.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>SchemeUserState</key> - <dict> - <key>godot_ios.xcscheme</key> - <dict> - <key>orderHint</key> - <integer>0</integer> - </dict> - </dict> - <key>SuppressBuildableAutocreation</key> - <dict> - <key>D0BCFE3318AEBDA2004A7AAE</key> - <dict> - <key>primary</key> - <true/> - </dict> - <key>D0BCFE5F18AEBDA3004A7AAE</key> - <dict> - <key>primary</key> - <true/> - </dict> - </dict> -</dict> -</plist> diff --git a/tools/ios_xcode_template/godot_ios/en.lproj/InfoPlist.strings b/tools/ios_xcode_template/godot_ios/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff8f..0000000000 --- a/tools/ios_xcode_template/godot_ios/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/tools/ios_xcode_template/godot_ios/godot_ios-Info.plist b/tools/ios_xcode_template/godot_ios/godot_ios-Info.plist deleted file mode 100644 index 357970920a..0000000000 --- a/tools/ios_xcode_template/godot_ios/godot_ios-Info.plist +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>en</string> - <key>CFBundleDisplayName</key> - <string>${PRODUCT_NAME}</string> - <key>CFBundleExecutable</key> - <string>godot_opt.iphone</string> - <key>CFBundleIdentifier</key> - <string>org.godotengine.${PRODUCT_NAME:rfc1034identifier}</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>${PRODUCT_NAME}</string> - <key>CFBundlePackageType</key> - <string>APPL</string> - <key>CFBundleShortVersionString</key> - <string>1.0</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleVersion</key> - <string>1.0</string> - <key>LSRequiresIPhoneOS</key> - <true/> - <key>UIRequiredDeviceCapabilities</key> - <array> - <string>armv7</string> - </array> - <key>UIStatusBarHidden</key> - <true/> - <key>UISupportedInterfaceOrientations</key> - <array> - <string>UIInterfaceOrientationPortrait</string> - <string>UIInterfaceOrientationLandscapeLeft</string> - <string>UIInterfaceOrientationLandscapeRight</string> - </array> - <key>UISupportedInterfaceOrientations~ipad</key> - <array> - <string>UIInterfaceOrientationPortrait</string> - <string>UIInterfaceOrientationPortraitUpsideDown</string> - <string>UIInterfaceOrientationLandscapeLeft</string> - <string>UIInterfaceOrientationLandscapeRight</string> - </array> -</dict> -</plist> diff --git a/tools/ios_xcode_template/godot_ios/godot_ios-Prefix.pch b/tools/ios_xcode_template/godot_ios/godot_ios-Prefix.pch deleted file mode 100644 index 82a2bb4507..0000000000 --- a/tools/ios_xcode_template/godot_ios/godot_ios-Prefix.pch +++ /dev/null @@ -1,16 +0,0 @@ -// -// Prefix header -// -// The contents of this file are implicitly included at the beginning of every source file. -// - -#import <Availability.h> - -#ifndef __IPHONE_5_0 -#warning "This project uses features only available in iOS SDK 5.0 and later." -#endif - -#ifdef __OBJC__ - #import <UIKit/UIKit.h> - #import <Foundation/Foundation.h> -#endif diff --git a/tools/ios_xcode_template/godot_iosTests/en.lproj/InfoPlist.strings b/tools/ios_xcode_template/godot_iosTests/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff8f..0000000000 --- a/tools/ios_xcode_template/godot_iosTests/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/tools/ios_xcode_template/godot_iosTests/godot_iosTests-Info.plist b/tools/ios_xcode_template/godot_iosTests/godot_iosTests-Info.plist deleted file mode 100644 index 0f69aa80eb..0000000000 --- a/tools/ios_xcode_template/godot_iosTests/godot_iosTests-Info.plist +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>en</string> - <key>CFBundleExecutable</key> - <string>${EXECUTABLE_NAME}</string> - <key>CFBundleIdentifier</key> - <string>org.godotengine.${PRODUCT_NAME:rfc1034identifier}</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundlePackageType</key> - <string>BNDL</string> - <key>CFBundleShortVersionString</key> - <string>1.0</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleVersion</key> - <string>1</string> -</dict> -</plist> diff --git a/tools/script_plugins/terrain/plugin.cfg b/tools/script_plugins/terrain/plugin.cfg deleted file mode 100644 index d2f2917420..0000000000 --- a/tools/script_plugins/terrain/plugin.cfg +++ /dev/null @@ -1,16 +0,0 @@ -[plugin] - -name="Terrain" -description="Simple plugin for generating and editing grid-based terrains. This type of terrains were all the rage in the early 2000's, but lost popularity to hand crafted geometry towards the end of the decade." -author="Juan Linietsky" -version="1.0" -installs=true -script="terrain.gd" -install_files=["terrain.gd","terrain_node.gd","icon_terrain.png"] - - - - - - - diff --git a/tools/script_plugins/terrain/terrain.gd b/tools/script_plugins/terrain/terrain.gd deleted file mode 100644 index b3e3121e7a..0000000000 --- a/tools/script_plugins/terrain/terrain.gd +++ /dev/null @@ -1,17 +0,0 @@ -tool # Always declare as Tool, if it's meant to run in the editor. -extends EditorPlugin - - -func get_name(): - return "Terrain" - - -func _init(): - print("PLUGIN INIT") - - -func _enter_scene(): - add_custom_type("Terrain","Spatial",preload("terrain_node.gd"),preload("terrain.png")) - -func _exit_scene(): - remove_custom_type("Terrain") diff --git a/tools/script_plugins/terrain/terrain.png b/tools/script_plugins/terrain/terrain.png Binary files differdeleted file mode 100644 index 7c1c3d70d6..0000000000 --- a/tools/script_plugins/terrain/terrain.png +++ /dev/null diff --git a/tools/script_plugins/terrain/terrain_node.gd b/tools/script_plugins/terrain/terrain_node.gd deleted file mode 100644 index 91cf3fcb2b..0000000000 --- a/tools/script_plugins/terrain/terrain_node.gd +++ /dev/null @@ -1,3 +0,0 @@ -extends Spatial - - diff --git a/tools/script_plugins/time/plugin.cfg b/tools/script_plugins/time/plugin.cfg deleted file mode 100644 index 5430306a79..0000000000 --- a/tools/script_plugins/time/plugin.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[plugin] - -name="The Time" -description="This plugin displays the current local time, with great accuracy, by harvesting the power of quartz crystals inside your computer.\nIt may also serve as simple example on how to write a non-installable editor plugin, or just remind you that it's time to go back home." -author="Juan Linietsky" -version="1.0" -installs=false -script="time.gd" - - - - - - diff --git a/tools/script_plugins/time/time.gd b/tools/script_plugins/time/time.gd deleted file mode 100644 index 2e56d89d4f..0000000000 --- a/tools/script_plugins/time/time.gd +++ /dev/null @@ -1,32 +0,0 @@ -tool # Always declare as Tool, if it's meant to run in the editor. -extends EditorPlugin - -var timer = null -var label = null - -func _timeout(): - if (label): - var time = OS.get_time() - label.set_text(str(time.hour).pad_zeros(2)+":"+str(time.minute).pad_zeros(2)+":"+str(time.second).pad_zeros(2)) - -func get_name(): - return "The Time" - - -func _init(): - print("PLUGIN INIT") - timer = Timer.new() - add_child(timer) - timer.set_wait_time(0.5) - timer.set_one_shot(false) - timer.connect("timeout",self,"_timeout") - -func _enter_tree(): - label = Label.new() - add_custom_control(CONTAINER_TOOLBAR,label) - timer.start() - -func _exit_tree(): - timer.stop() - label.free() - label=null diff --git a/tools/addheader/addheader.py b/tools/scripts/addheader.py index d040d8b5d6..d040d8b5d6 100644 --- a/tools/addheader/addheader.py +++ b/tools/scripts/addheader.py diff --git a/tools/bmfhdr/makehdr.py b/tools/scripts/make_bmfhdr.py index 0f6f453004..0f6f453004 100644 --- a/tools/bmfhdr/makehdr.py +++ b/tools/scripts/make_bmfhdr.py diff --git a/tools/glwrapper/makewrapper.py b/tools/scripts/make_glwrapper.py index 2e5f06be12..f3f8d39837 100644 --- a/tools/glwrapper/makewrapper.py +++ b/tools/scripts/make_glwrapper.py @@ -2,7 +2,7 @@ import sys if (len(sys.argv)<2): - print("usage: makewrapper.py <headers>") + print("usage: make_glwrapper.py <headers>") sys.exit(255) diff --git a/tools/steam/make_icons.sh b/tools/scripts/make_icons.sh index 71037cd1c3..71037cd1c3 100644 --- a/tools/steam/make_icons.sh +++ b/tools/scripts/make_icons.sh diff --git a/tools/memsort.py b/tools/scripts/memsort.py index d2e4fe0226..d2e4fe0226 100644 --- a/tools/memsort.py +++ b/tools/scripts/memsort.py |