diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-08-27 21:07:15 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-08-27 22:13:45 +0200 |
commit | 7ad14e7a3e6f87ddc450f7e34621eb5200808451 (patch) | |
tree | 8804d0dd24cc126087462edfbbbf73ed61b56b0e /main/tests | |
parent | 37da8155a4500a9386027b4d791a86186bc7ab4a (diff) |
Dead code tells no tales
Diffstat (limited to 'main/tests')
-rw-r--r-- | main/tests/test_containers.cpp | 92 | ||||
-rw-r--r-- | main/tests/test_containers.h | 43 | ||||
-rw-r--r-- | main/tests/test_gdscript.cpp | 10 | ||||
-rw-r--r-- | main/tests/test_gui.cpp | 102 | ||||
-rw-r--r-- | main/tests/test_io.cpp | 60 | ||||
-rw-r--r-- | main/tests/test_main.cpp | 21 | ||||
-rw-r--r-- | main/tests/test_math.cpp | 149 | ||||
-rw-r--r-- | main/tests/test_physics.cpp | 155 | ||||
-rw-r--r-- | main/tests/test_shader_lang.cpp | 1 | ||||
-rw-r--r-- | main/tests/test_sound.cpp | 99 | ||||
-rw-r--r-- | main/tests/test_sound.h | 40 |
11 files changed, 5 insertions, 767 deletions
diff --git a/main/tests/test_containers.cpp b/main/tests/test_containers.cpp deleted file mode 100644 index bf6dee10d7..0000000000 --- a/main/tests/test_containers.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************/ -/* test_containers.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "test_containers.h" - -#include "dvector.h" -#include "math_funcs.h" -#include "print_string.h" -#include "servers/visual/default_mouse_cursor.xpm" -#include "set.h" - -#include "image.h" -#include "list.h" -#include "variant.h" - -namespace TestContainers { - -MainLoop *test() { - - /* - HashMap<int,int> int_map; - - for (int i=0;i<68000;i++) { - - int num=(int)Math::random(0,1024); - int_map[i]=num; - } - */ - - { - - }; - -#if 0 - Set<int> set; - - print_line("Begin Insert"); - for (int i=0;i<1100;i++) { - - int num=i;//(int)Math::random(0,1024); - //print_line("inserting "+itos(num)); - set.insert( num ); - } - - /* - for (int i=0;i<400;i++) { - - int num=(int)Math::random(0,1024); - set.erase(num); - } - */ - //set.print_tree(); - - for(Set<int>::Element *I=set.front();I;I=I->next()) { - - print_line("inserted "+itos(I->get())+" prev is "+itos(I->prev()?I->prev()->get():-100)); - - } - - print_line("depth is "+itos(set.calculate_depth())); - print_line("Insert Success"); -#endif - - return NULL; -} -} diff --git a/main/tests/test_containers.h b/main/tests/test_containers.h deleted file mode 100644 index 0c7a5a7378..0000000000 --- a/main/tests/test_containers.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************/ -/* test_containers.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef TEST_CONTAINERS_H -#define TEST_CONTAINERS_H - -#include "os/main_loop.h" -/** - @author Juan Linietsky <reduzio@gmail.com> -*/ - -namespace TestContainers { - -MainLoop *test(); -} - -#endif diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp index bb3bdb30b0..bcf4278bde 100644 --- a/main/tests/test_gdscript.cpp +++ b/main/tests/test_gdscript.cpp @@ -1053,16 +1053,6 @@ MainLoop *test(TestType p_type) { memdelete(fw); } -#if 0 - Parser parser; - Error err = parser.parse(code); - if (err) { - print_line("error:"+itos(parser.get_error_line())+":"+itos(parser.get_error_column())+":"+parser.get_error()); - } else { - print_line("Parse O-K!"); - } -#endif - memdelete(fa); return NULL; diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp index 35844e51d1..d9b2873d6b 100644 --- a/main/tests/test_gui.cpp +++ b/main/tests/test_gui.cpp @@ -70,32 +70,6 @@ public: SceneTree::init(); -#if 0 - - - Viewport *vp = memnew( Viewport ); - vp->set_world( Ref<World>( memnew( World ))); - get_root()->add_child(vp); - - vp->set_rect(Rect2(0,0,256,256)); - vp->set_as_render_target(true); - vp->set_render_target_update_mode(Viewport::RENDER_TARGET_UPDATE_ALWAYS); - - - Camera *camera = memnew( Camera ); - vp->add_child(camera); - camera->make_current(); - - Sprite *sp = memnew( Sprite ); - sp->set_texture( vp->get_render_target_texture() ); - //sp->set_texture( ResourceLoader::load("res://ball.png") ); - sp->set_position(Point2(300,300)); - get_root()->add_child(sp); - - - return; -#endif - Panel *frame = memnew(Panel); frame->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END); frame->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_END); @@ -111,7 +85,6 @@ public: label->set_position(Point2(80, 90)); label->set_size(Point2(170, 80)); label->set_align(Label::ALIGN_FILL); - //label->set_text("There"); label->set_text("There was once upon a time a beautiful unicorn that loved to play with little girls..."); frame->add_child(label); @@ -124,25 +97,6 @@ public: frame->add_child(button); -#if 0 - Sprite *tf = memnew( Sprite ); - frame->add_child(tf); - Image img; - ImageLoader::load_image("LarvoClub.png",&img); - - img.resize(512,512); - img.generate_mipmaps(); - img.compress(Image::COMPRESS_PVRTC4); - Ref<ImageTexture> tt = memnew( ImageTexture ); - tt->create_from_image(img); - tf->set_texture(tt); - tf->set_position(Point2(50,50)); - //tf->set_scale(Point2(0.3,0.3)); - - - return; -#endif - Tree *tree = memnew(Tree); tree->set_columns(2); @@ -182,9 +136,6 @@ public: frame->add_child(tree); - //control = memnew( Control ); - //root->add_child( control ); - LineEdit *line_edit = memnew(LineEdit); line_edit->set_position(Point2(30, 190)); @@ -244,36 +195,6 @@ public: frame->add_child(options); - /* - Tree * tree = memnew( Tree ); - tree->set_columns(2); - - tree->set_position( Point2( 230,210 ) ); - tree->set_size( Point2( 150,250 ) ); - - - TreeItem *item = tree->create_item(); - item->set_editable(0,true); - item->set_text(0,"root"); - item = tree->create_item( tree->get_root() ); - item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); - item->set_editable(0,true); - item->set_text(0,"check"); - item = tree->create_item( tree->get_root() ); - item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE); - item->set_editable(0,true); - item->set_range_config(0,0,20,0.1); - item->set_range(0,2); - item->add_button(0,Theme::get_default()->get_icon("folder","FileDialog")); - item = tree->create_item( tree->get_root() ); - item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE); - item->set_editable(0,true); - item->set_text(0,"Have,Many,Several,Options!"); - item->set_range(0,2); - - frame->add_child(tree); -*/ - RichTextLabel *richtext = memnew(RichTextLabel); richtext->set_position(Point2(600, 210)); @@ -306,18 +227,10 @@ public: richtext->add_text("keep writing a lot of text"); richtext->pop(); richtext->add_text(" so the label control overflows and the scrollbar appears.\n"); - //richtext->push_indent(1); - //richtext->add_text("By the way, testing indent levels! Yohohoho! Everything should appear to the right sightly here!\n"); - //richtext->pop(); richtext->push_meta("http://www.scrollingcapabilities.xz"); richtext->add_text("This allows to test for the scrolling capabilities "); richtext->pop(); richtext->add_text("of the rich text label for huge text (not like this text will really be huge but, you know).\nAs long as it is so long that it will work nicely for a test/demo, then it's welcomed in my book...\nChanging subject, the day is cloudy today and I'm wondering if I'll get che chance to travel somewhere nice. Sometimes, watching the clouds from satellite images may give a nice insight about how pressure zones in our planet work, althogh it also makes it pretty obvious to see why most weather forecasts get it wrong so often.\nClouds are so difficult to predict!\nBut it's pretty cool how our civilization has adapted to having water falling from the sky each time it rains..."); - //richtext->add_text("Hello!\nGorgeous.."); - - //richtext->push_meta("http://www.scrollingcapabilities.xz"); - ///richtext->add_text("Hello!\n"); - //richtext->pop(); TabContainer *tabc = memnew(TabContainer); @@ -346,21 +259,6 @@ public: tabc->set_position(Point2(400, 210)); tabc->set_size(Point2(180, 250)); - - /*Ref<ImageTexture> text = memnew( ImageTexture ); - text->load("test_data/concave.png"); - - Sprite* sprite = memnew(Sprite); - sprite->set_texture(text); - sprite->set_position(Point2(300, 300)); - frame->add_child(sprite); - sprite->show(); - - Sprite* sprite2 = memnew(Sprite); - sprite->set_texture(text); - sprite->add_child(sprite2); - sprite2->set_position(Point2(50, 50)); - sprite2->show();*/ } }; diff --git a/main/tests/test_io.cpp b/main/tests/test_io.cpp index 84de8dddf8..f96c5cfe3c 100644 --- a/main/tests/test_io.cpp +++ b/main/tests/test_io.cpp @@ -112,66 +112,6 @@ MainLoop *test() { FileAccess::make_default<FileAccessMemory>(FileAccess::ACCESS_USERDATA); print_line("archive test"); -#if 0 - Archive arch; - - Archive::get_singleton()->add_package("a_package"); - FileAccessArchive f; - - print_line("opening for read"); - f._open("file.txt", FileAccess::READ); - int pos = f.get_pos(); - printf("file has %i bytes, initial pos %i\n", (int)f.get_len(), pos); - - do { - printf("%c", f.get_8()); - - } while (!f.eof_reached()); - - print_line("opening for stored seek"); - f.open("seek.bin", FileAccess::READ); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - f.seek(128); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - - print_line("opening for deflated seek"); - f.open("seek_deflated.bin", FileAccess::READ); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - f.seek(128); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - f.seek(256); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - f.seek(4); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - - f.close(); - - DirAccessArchive d; - String dir = "../blah1/blah2/blahask/../blah3/.//blah4/"; - printf("changing dir to %s\n", dir.utf8().get_data()); - d.change_dir(dir); - printf("current dir is %s\n", d.get_current_dir().utf8().get_data()); - - FileAccessMemory::cleanup(); -#endif }; print_line("test done"); diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp index f1d2f9b231..794bdb757b 100644 --- a/main/tests/test_main.cpp +++ b/main/tests/test_main.cpp @@ -32,19 +32,16 @@ #ifdef DEBUG_ENABLED -#include "test_containers.h" +#include "test_gdscript.h" #include "test_gui.h" +#include "test_image.h" +#include "test_io.h" #include "test_math.h" #include "test_physics.h" #include "test_physics_2d.h" #include "test_render.h" -#include "test_sound.h" -#include "test_string.h" - -#include "test_gdscript.h" -#include "test_image.h" -#include "test_io.h" #include "test_shader_lang.h" +#include "test_string.h" const char **tests_get_names() { @@ -71,11 +68,6 @@ MainLoop *test_main(String p_test, const List<String> &p_args) { return TestString::test(); } - if (p_test == "containers") { - - return TestContainers::test(); - } - if (p_test == "math") { return TestMath::test(); @@ -103,11 +95,6 @@ MainLoop *test_main(String p_test, const List<String> &p_args) { } #endif - //if (p_test=="sound") { - - // return TestSound::test(); - //} - if (p_test == "io") { return TestIO::test(); diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp index f4dc28f2e9..3ba8ef51b4 100644 --- a/main/tests/test_math.cpp +++ b/main/tests/test_math.cpp @@ -205,54 +205,12 @@ class GetClassAndNamespace { 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; } @@ -413,23 +371,6 @@ void test_vec(Plane p_vec) { print_line("out: " + v0); v0.normal.z = (v0.d / 100.0 * 2.0 - 1.0) * v0.d; print_line("out_F: " + v0); - - /*v0: 0, 0, -0.1, 0.1 -v1: 0, 0, 0, 0.1 -fix: 0, 0, 0, 0.1 -v0: 0, 0, 1.302803, 1.5 -v1: 0, 0, 1.401401, 1.5 -fix: 0, 0, 1.401401, 1.5 -v0: 0, 0, 25.851850, 26 -v1: 0, 0, 25.925926, 26 -fix: 0, 0, 25.925924, 26 -v0: 0, 0, 49.899902, 50 -v1: 0, 0, 49.949947, 50 -fix: 0, 0, 49.949951, 50 -v0: 0, 0, 100, 100 -v1: 0, 0, 100, 100 -fix: 0, 0, 100, 100 -*/ } uint32_t ihash(uint32_t a) { @@ -469,10 +410,9 @@ MainLoop *test() { const float pow2to9 = 512.0f; const float B = 15.0f; - //const float Emax = 31.0f; const float N = 9.0f; - float sharedexp = 65408.000f; //(( pow2to9 - 1.0f)/ pow2to9)*powf( 2.0f, 31.0f - 15.0f); + float sharedexp = 65408.000f; float cRed = MAX(0.0f, MIN(sharedexp, r)); float cGreen = MAX(0.0f, MIN(sharedexp, g)); @@ -480,8 +420,6 @@ MainLoop *test() { float cMax = MAX(cRed, MAX(cGreen, cBlue)); - // expp = MAX(-B - 1, log2(maxc)) + 1 + B - float expp = MAX(-B - 1.0f, floor(Math::log(cMax) / Math_LN2)) + 1.0f + B; float sMax = (float)floor((cMax / Math::pow(2.0f, expp - B - N)) + 0.5f); @@ -591,8 +529,6 @@ MainLoop *test() { hashes.push_back(hashes.size()); } - //hashes.resize(50); - for (int i = nearest_shift(hashes.size()); i < 20; i++) { bool success = true; @@ -625,7 +561,6 @@ MainLoop *test() { } { - //print_line("NUM: "+itos(237641278346127)); print_line("NUM: " + itos(-128)); return NULL; } @@ -635,14 +570,12 @@ MainLoop *test() { v.normalize(); float a = 0.3; - //Quat q(v,a); Basis m(v, a); Vector3 v2(7, 3, 1); v2.normalize(); float a2 = 0.8; - //Quat q(v,a); Basis m2(v2, a2); Quat q = m; @@ -749,86 +682,6 @@ MainLoop *test() { print_line("scalar /=: " + v); } -#if 0 - print_line(String("C:\\momo\\.\\popo\\..\\gongo").simplify_path()); - print_line(String("res://../popo/..//gongo").simplify_path()); - print_line(String("res://..").simplify_path()); - - - PoolVector<uint8_t> a; - PoolVector<uint8_t> b; - - a.resize(20); - b=a; - b.resize(30); - a=b; -#endif - -#if 0 - String za = String::utf8("á"); - printf("unicode: %x\n",za[0]); - CharString cs=za.utf8(); - for(int i=0;i<cs.size();i++) { - uint32_t v = uint8_t(cs[i]); - printf("%i - %x\n",i,v); - } - return NULL; - - print_line(String("C:\\window\\system\\momo").path_to("C:\\window\\momonga")); - print_line(String("res://momo/sampler").path_to("res://pindonga")); - print_line(String("/margarito/terere").path_to("/margarito/pilates")); - print_line(String("/algo").path_to("/algo")); - print_line(String("c:").path_to("c:\\")); - print_line(String("/").path_to("/")); - - - print_line(itos(sizeof(Variant))); - return NULL; - - Vector<StringName> path; - path.push_back("three"); - path.push_back("two"); - path.push_back("one"); - path.push_back("comeon"); - path.revert(); - - NodePath np(path,true); - - print_line(np); - - - return NULL; - - bool a=2; - - print_line(Variant(a)); - - - Transform2D mat2_1; - mat2_1.rotate(0.5); - Transform2D mat2_2; - mat2_2.translate(Vector2(1,2)); - Transform2D mat2_3 = mat2_1 * mat2_2; - mat2_3.affine_invert(); - - print_line(mat2_3.elements[0]); - print_line(mat2_3.elements[1]); - print_line(mat2_3.elements[2]); - - - - Transform mat3_1; - mat3_1.basis.rotate(Vector3(0,0,1),0.5); - Transform mat3_2; - mat3_2.translate(Vector3(1,2,0)); - Transform mat3_3 = mat3_1 * mat3_2; - mat3_3.affine_invert(); - - print_line(mat3_3.basis.get_axis(0)); - print_line(mat3_3.basis.get_axis(1)); - print_line(mat3_3.origin); - -#endif return NULL; } } diff --git a/main/tests/test_physics.cpp b/main/tests/test_physics.cpp index 9bfffad206..f149821928 100644 --- a/main/tests/test_physics.cpp +++ b/main/tests/test_physics.cpp @@ -71,7 +71,6 @@ class TestPhysicsMainLoop : public MainLoop { PhysicsDirectBodyState *state = (PhysicsDirectBodyState *)p_state; VisualServer *vs = VisualServer::get_singleton(); Transform t = state->get_transform(); - //t.basis.scale( Vector3(1.0,0.5,0.2) ); vs->instance_set_transform(p_visual_instance, t); } @@ -208,7 +207,6 @@ protected: d[VS::ARRAY_VERTEX] = p_faces; d[VS::ARRAY_NORMAL] = normals; vs->mesh_add_surface_from_arrays(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, d); - //vs->material_set_flag( trimesh_mat, VisualServer::MATERIAL_FLAG_UNSHADED,true); RID triins = vs->instance_create2(trimesh_mesh, scenario); @@ -219,9 +217,6 @@ protected: Transform tritrans = p_xform; ps->body_set_state(tribody, PhysicsServer::BODY_STATE_TRANSFORM, tritrans); vs->instance_set_transform(triins, tritrans); - //RID trimesh_material = vs->fixed_material_create(); - //vs->material_generate( trimesh_material, Color(0.2,0.4,0.6) ); - //vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_material ); } void make_grid(int p_width, int p_height, float p_cellsize, float p_cellheight, const Transform &p_xform = Transform()) { @@ -305,7 +300,6 @@ public: /* LIGHT */ RID lightaux = vs->light_create(VisualServer::LIGHT_DIRECTIONAL); - //vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) ); scenario = vs->scenario_create(); vs->light_set_shadow(lightaux, true); light = vs->instance_create2(lightaux, scenario); @@ -327,100 +321,14 @@ public: vs->camera_set_perspective(camera, 60, 0.1, 40.0); vs->camera_set_transform(camera, Transform(Basis(), Vector3(0, 9, 12))); - //vs->scenario_set_debug(scenario,VS::SCENARIO_DEBUG_WIREFRAME); Transform gxf; gxf.basis.scale(Vector3(1.4, 0.4, 1.4)); gxf.origin = Vector3(-2, 1, -2); make_grid(5, 5, 2.5, 1, gxf); - //create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,gxf); - //create_static_plane( Plane( Vector3(0,1,0), -2) ); - //test_joint(); test_fall(); - //test_joint(); - - /* - Vector<Vector3> faces; - faces.push_back( Vector3(10,0,-5) ); - faces.push_back( Vector3(0,0,10) ); - faces.push_back( Vector3(-10,-0.2,-5) ); - make_trimesh(faces); -*/ - /* Make Trimesh */ quit = false; return; - -#if 0 -#define GRID_SIZE 5 - - float grid[GRID_SIZE][GRID_SIZE]; - - for (int i=0;i<GRID_SIZE;i++) { - - for (int j=0;j<GRID_SIZE;j++) { - - grid[j][i]=Math::random(0.0, 1.0 ); - } - } - - Vector<Vector3> faces; - - for (int i=1;i<GRID_SIZE;i++) { - - for (int j=1;j<GRID_SIZE;j++) { - -#define MAKE_VERTEX(m_x, m_z) \ - faces.push_back(Vector3(m_x - GRID_SIZE / 2.0, grid[m_x][m_z], m_z - GRID_SIZE / 2.0) * 3.0) - - MAKE_VERTEX(i,j-1); - MAKE_VERTEX(i,j); - MAKE_VERTEX(i-1,j); - - MAKE_VERTEX(i-1,j-1); - MAKE_VERTEX(i,j-1); - MAKE_VERTEX(i-1,j); - - } - } - /* - faces.clear(); - faces.push_back( Vector3(0,0,-5) ); - faces.push_back( Vector3(1,0,-1) ); - faces.push_back( Vector3(-1,-0,-1) ); - */ - - RID trimesh_shape = ps->shape_create(); - ps->shape_set_data(trimesh_shape, PhysicsServer::SHAPE_CONCAVE_POLYGON,faces); - faces=ps->shape_get_shape(trimesh_shape, 0); - Vector<Vector3> normals; // for drawing - for (int i=0;i<faces.size()/3;i++) { - - Plane p( faces[i*3+0],faces[i*3+1], faces[i*3+2] ); - normals.push_back(p.normal); - normals.push_back(p.normal); - normals.push_back(p.normal); - } - - RID trimesh_mesh = vs->mesh_create(); - vs->mesh_add_surface(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, VS::ARRAY_FORMAT_VERTEX|VS::ARRAY_FORMAT_NORMAL, faces.size() ); - vs->mesh_surface_set_array(trimesh_mesh,0,VS::ARRAY_VERTEX, faces ); - vs->mesh_surface_set_array(trimesh_mesh,0,VS::ARRAY_NORMAL, normals ); - RID trimesh_mat = vs->fixed_material_create(); - vs->material_generate( trimesh_mat, Color(1.0,0.5,0.3) ); - vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_mat ); - - RID triins = vs->instance_create2(trimesh_mesh); - - - - RID tribody = ps->body_create( PhysicsServer::BODY_MODE_STATIC, trimesh_shape); - Transform tritrans = Transform( Basis(), Vector3(0,0,-2) ); - ps->body_set_state( tribody, PhysicsServer::BODY_STATE_TRANSFORM, tritrans ); - vs->instance_set_transform( triins, tritrans ); - RID trimesh_material = vs->fixed_material_create(); - vs->material_generate( trimesh_material, Color(0.2,0.4,0.6) ); - vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_material ); -#endif } virtual bool iteration(float p_time) { @@ -445,58 +353,9 @@ public: } void test_joint() { -#if 0 - PhysicsServer * ps = PhysicsServer::get_singleton(); - - mover = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,Transform(Basis(),Vector3(0,0,-24))); - RID b = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform()); - - ps->joint_create_double_pin(b,Vector3(0,0,1.0),mover,Vector3(0,0,0)); - ps->body_add_collision_exception(mover,b); - - - List<String> cmdline = OS::get_singleton()->get_cmdline_args(); - int link_count = LINK_COUNT; - if (cmdline.size() > 0 && cmdline[cmdline.size()-1].to_int()) { - link_count = cmdline[cmdline.size()-1].to_int(); - }; - - for(int i=0;i<link_count;i++) { - - RID c = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform()); - ps->joint_create_double_pin(b,Vector3(0,0,-0.7),c,Vector3(0,0,0.7)); - ps->body_add_collision_exception(c,b); - b=c; - } - - - create_static_plane(Plane(Vector3(0,1,0),-8)); -#endif } void test_hinge() { -#if 0 - PhysicsServer * ps = PhysicsServer::get_singleton(); - - - mover = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,Transform(Basis(),Vector3(0,0,-24))); - RID b = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_RIGID,Transform()); - - ps->joint_create_double_hinge(b,Transform(Basis(),Vector3(1,1,1.0)),mover,Transform(Basis(),Vector3(0,0,0))); - ps->body_add_collision_exception(mover,b); - -/* - for(int i=0;i<20;i++) { - - RID c = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform()); - ps->joint_create_double_hinge(b,Transform(Basis(),Vector3(0,0,-0.7)),c,Transform(Basis(),Vector3(0,0,0.7))); - ps->body_add_collision_exception(c,b); - b=c; - } - -*/ - //create_static_plane(Plane(Vector3(0,1,0),-8)); -#endif } void test_character() { @@ -544,35 +403,21 @@ public: }; PhysicsServer::ShapeType type = shape_idx[i % 4]; - //type=PhysicsServer::SHAPE_CONVEX_POLYGON; Transform t; t.origin = Vector3(0.0 * i, 3.5 + 1.1 * i, 0.7 + 0.0 * i); - //t.origin=Vector3(-0.7+0.0*i,0.5+4.1*i,0); t.basis.rotate(Vector3(0.2, -1, 0), Math_PI / 2 * 0.6); - //t.basis.rotate(Vector3(0,-1,0),Math_PI/4*i); - //t.basis.rotate(Vector3(0,-1,0),Math_PI/4*i); - //t.basis.rotate(Vector3(-1,0,0),Math_PI/4*i); create_body(type, PhysicsServer::BODY_MODE_RIGID, t); - //RID b = create_body(type,i==0?PhysicsServer::BODY_MODE_STATIC:PhysicsServer::BODY_MODE_RIGID,t); } create_static_plane(Plane(Vector3(0, 1, 0), -1)); - - /* - create_static_plane( Plane( Vector3(1,0,0), -2) ); - create_static_plane( Plane( Vector3(-1,0,0), -2) ); - create_static_plane( Plane( Vector3(0,0,1), -2) ); - create_static_plane( Plane( Vector3(0,0,-1), -2) ); -*/ } void test_activate() { create_body(PhysicsServer::SHAPE_BOX, PhysicsServer::BODY_MODE_RIGID, Transform(Basis(), Vector3(0, 2, 0)), true); - //create_body(PhysicsServer::SHAPE_SPHERE,PhysicsServer::BODY_MODE_RIGID,Transform(Basis(),Vector3(0,6,0)),true); create_static_plane(Plane(Vector3(0, 1, 0), -1)); } diff --git a/main/tests/test_shader_lang.cpp b/main/tests/test_shader_lang.cpp index 3545c55d33..a0539f4bdf 100644 --- a/main/tests/test_shader_lang.cpp +++ b/main/tests/test_shader_lang.cpp @@ -37,7 +37,6 @@ #include "scene/gui/control.h" #include "scene/gui/text_edit.h" #include "servers/visual/shader_language.h" -//#include "drivers/gles2/shader_compiler_gles2.h" typedef ShaderLanguage SL; diff --git a/main/tests/test_sound.cpp b/main/tests/test_sound.cpp deleted file mode 100644 index 57fcfe28ab..0000000000 --- a/main/tests/test_sound.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/*************************************************************************/ -/* test_sound.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "test_sound.h" -#include "math_funcs.h" -#include "os/main_loop.h" -#include "servers/visual_server.h" - -#include "io/resource_loader.h" -#include "os/os.h" -#include "print_string.h" -#include "servers/audio_server.h" - -#if 0 -namespace TestSound { - - -class TestMainLoop : public MainLoop { - - bool quit; - Ref<Sample> sample; - -public: - virtual void input_event(const InputEvent& p_event) { - - - } - virtual void request_quit() { - - quit=true; - } - - virtual void init() { - - List<String> cmdline = OS::get_singleton()->get_cmdline_args(); - quit=false; - if (cmdline.size()) { - - sample=ResourceLoader::load(cmdline.back()->get()); - ERR_FAIL_COND(sample.is_null()); - print_line("Sample loaded OK"); - } - - RID voice = AudioServer::get_singleton()->voice_create(); - AudioServer::get_singleton()->voice_play( voice, sample->get_rid() ); - - - } - - virtual bool idle(float p_time) { - return false; - } - - - virtual bool iteration(float p_time) { - - return quit; - } - virtual void finish() { - - } - -}; - - -MainLoop* test() { - - return memnew( TestMainLoop ); - -} - -} -#endif diff --git a/main/tests/test_sound.h b/main/tests/test_sound.h deleted file mode 100644 index 525479ae44..0000000000 --- a/main/tests/test_sound.h +++ /dev/null @@ -1,40 +0,0 @@ -/*************************************************************************/ -/* test_sound.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef TEST_SOUND_H -#define TEST_SOUND_H - -#include "os/main_loop.h" - -namespace TestSound { - -MainLoop *test(); -} - -#endif // TEST_SOUND_H |