diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-10-03 16:33:42 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-10-03 21:35:16 +0200 |
commit | 22d83bc9f655d5ae7a1b49709c4c1b663725daf5 (patch) | |
tree | a817195c08d4713a70ca014a3f63f5937934fe36 /bin | |
parent | 78d97b060a6873a454e710380cb9ef1bde5e4c65 (diff) |
Begining of GLES3 renderer:
-Most 2D drawing is implemented
-Missing shaders
-Missing all 3D
-Editor needs to be set on update always to be used, otherwise it does not refresh
-Large parts of editor not working
Diffstat (limited to 'bin')
-rw-r--r-- | bin/tests/test_detailer.cpp | 217 | ||||
-rw-r--r-- | bin/tests/test_detailer.h | 44 | ||||
-rw-r--r-- | bin/tests/test_gui.cpp | 4 | ||||
-rw-r--r-- | bin/tests/test_main.cpp | 34 | ||||
-rw-r--r-- | bin/tests/test_misc.cpp | 499 | ||||
-rw-r--r-- | bin/tests/test_misc.h | 40 | ||||
-rw-r--r-- | bin/tests/test_particles.cpp | 121 | ||||
-rw-r--r-- | bin/tests/test_particles.h | 43 | ||||
-rw-r--r-- | bin/tests/test_physics.cpp | 28 | ||||
-rw-r--r-- | bin/tests/test_physics_2d.cpp | 10 | ||||
-rw-r--r-- | bin/tests/test_python.cpp | 56 | ||||
-rw-r--r-- | bin/tests/test_python.h | 43 | ||||
-rw-r--r-- | bin/tests/test_render.cpp | 8 | ||||
-rw-r--r-- | bin/tests/test_shader_lang.cpp | 18 |
14 files changed, 32 insertions, 1133 deletions
diff --git a/bin/tests/test_detailer.cpp b/bin/tests/test_detailer.cpp deleted file mode 100644 index 5dba7c3f72..0000000000 --- a/bin/tests/test_detailer.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/*************************************************************************/ -/* test_detailer.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 "test_detailer.h" -#include "servers/visual_server.h" -#include "os/main_loop.h" -#include "math_funcs.h" -#include "print_string.h" -#include "geometry.h" -#include "quick_hull.h" -namespace TestMultiMesh { - - -class TestMainLoop : public MainLoop { - - RID instance; - RID camera; - RID viewport; - RID light; - RID mesh; - RID scenario; - -#define MULTIMESH_COUNT 1500 - - float ofs_x,ofs_y; - bool quit; -public: - - - virtual void _update_qh() { - - VisualServer *vs=VisualServer::get_singleton(); - Vector<Vector3> vts; -/* - - static const int s = 20; - for(int i=0;i<s;i++) { - Matrix3 rot(Vector3(0,1,0),i*Math_PI/s); - - for(int j=0;j<s;j++) { - Vector3 v; - v.x=Math::sin(j*Math_PI*2/s); - v.y=Math::cos(j*Math_PI*2/s); - - vts.push_back( rot.xform(v*2 ) ); - } - }*/ - /* - Math::seed(0); - for(int i=0;i<50;i++) { - - vts.push_back( Vector3(Math::randf()*2-1.0,Math::randf()*2-1.0,Math::randf()*2-1.0).normalized()*2); - }*/ - /* - vts.push_back(Vector3(0,0,1)); - vts.push_back(Vector3(0,0,-1)); - vts.push_back(Vector3(0,1,0)); - vts.push_back(Vector3(0,-1,0)); - vts.push_back(Vector3(1,0,0)); - vts.push_back(Vector3(-1,0,0));*/ -/* - vts.push_back(Vector3(1,1,1)); - vts.push_back(Vector3(1,-1,1)); - vts.push_back(Vector3(-1,1,1)); - vts.push_back(Vector3(-1,-1,1)); - vts.push_back(Vector3(1,1,-1)); - vts.push_back(Vector3(1,-1,-1)); - vts.push_back(Vector3(-1,1,-1)); - vts.push_back(Vector3(-1,-1,-1)); -*/ - - - DVector<Plane> convex_planes = Geometry::build_cylinder_planes(0.5,0.7,4,Vector3::AXIS_Z); - Geometry::MeshData convex_data = Geometry::build_convex_mesh(convex_planes); - vts=convex_data.vertices; - - Geometry::MeshData md; - Error err = QuickHull::build(vts,md); - print_line("ERR: "+itos(err)); - - vs->mesh_remove_surface(mesh,0); - vs->mesh_add_surface_from_mesh_data(mesh,md); - - - - //vs->scenario_set_debug(scenario,VS::SCENARIO_DEBUG_WIREFRAME); - - /* - RID sm = vs->shader_create(); - //vs->shader_set_fragment_code(sm,"OUT_ALPHA=mod(TIME,1);"); - //vs->shader_set_vertex_code(sm,"OUT_VERTEX=IN_VERTEX*mod(TIME,1);"); - vs->shader_set_fragment_code(sm,"OUT_DIFFUSE=vec3(1,0,1);OUT_GLOW=abs(sin(TIME));"); - RID tcmat = vs->mesh_surface_get_material(test_cube,0); - vs->material_set_shader(tcmat,sm); - */ - - } - - virtual void input_event(const InputEvent& p_event) { - - if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&4) { - - ofs_x+=p_event.mouse_motion.relative_y/200.0; - ofs_y+=p_event.mouse_motion.relative_x/200.0; - } - if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed && p_event.mouse_button.button_index==1) { - - QuickHull::debug_stop_after++; - _update_qh(); - } - if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed && p_event.mouse_button.button_index==2) { - - if (QuickHull::debug_stop_after>0) - QuickHull::debug_stop_after--; - _update_qh(); - } - - - } - - virtual void request_quit() { - - quit=true; - } - - - - virtual void init() { - - VisualServer *vs=VisualServer::get_singleton(); - - - mesh = vs->mesh_create(); - - scenario = vs->scenario_create(); - - QuickHull::debug_stop_after=0; - _update_qh(); - - instance = vs->instance_create2(mesh,scenario); - - camera = vs->camera_create(); - - - vs->camera_set_perspective( camera, 60.0,0.1, 100.0 ); - viewport = vs->viewport_create(); - vs->viewport_attach_camera( viewport, camera ); - vs->viewport_attach_to_screen(viewport); - vs->viewport_set_scenario( viewport, scenario ); - - vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,0,2 ) ) ); - - RID lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL ); - //vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.3,0.3,0.3) ); - light = vs->instance_create2( lightaux,scenario ); - vs->instance_set_transform(light,Transform(Matrix3(Vector3(0.1,0.4,0.7).normalized(),0.9))); - - ofs_x=0; - ofs_y=0; - quit=false; - } - - virtual bool idle(float p_time) { - return false; - } - - virtual bool iteration(float p_time) { - - VisualServer *vs=VisualServer::get_singleton(); - - Transform tr_camera; - tr_camera.rotate( Vector3(0,1,0), ofs_y ); - tr_camera.rotate( Vector3(1,0,0),ofs_x ); - tr_camera.translate(0,0,10); - - vs->camera_set_transform( camera, tr_camera ); - - return quit; - } - virtual void finish() { - - } - -}; - -MainLoop* test() { - - return memnew(TestMainLoop); - -} - -} diff --git a/bin/tests/test_detailer.h b/bin/tests/test_detailer.h deleted file mode 100644 index 597e088caf..0000000000 --- a/bin/tests/test_detailer.h +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************/ -/* test_detailer.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 TEST_MULTIMESH_H -#define TEST_MULTIMESH_H - -/** - @author Juan Linietsky <reduzio@gmail.com> -*/ -#include "os/main_loop.h" - -namespace TestMultiMesh { - -MainLoop* test(); - -} - - -#endif diff --git a/bin/tests/test_gui.cpp b/bin/tests/test_gui.cpp index f4341fd7b3..bfce03d663 100644 --- a/bin/tests/test_gui.cpp +++ b/bin/tests/test_gui.cpp @@ -370,7 +370,7 @@ public: tabc->set_size( Point2( 180,250 ) ); - Ref<ImageTexture> text = memnew( ImageTexture ); + /*Ref<ImageTexture> text = memnew( ImageTexture ); text->load("test_data/concave.png"); Sprite* sprite = memnew(Sprite); @@ -383,7 +383,7 @@ public: sprite->set_texture(text); sprite->add_child(sprite2); sprite2->set_pos(Point2(50, 50)); - sprite2->show(); + sprite2->show();*/ } diff --git a/bin/tests/test_main.cpp b/bin/tests/test_main.cpp index 363aede96e..1f7f2d7dda 100644 --- a/bin/tests/test_main.cpp +++ b/bin/tests/test_main.cpp @@ -37,13 +37,10 @@ #include "test_gui.h" #include "test_render.h" #include "test_sound.h" -#include "test_misc.h" #include "test_physics.h" #include "test_physics_2d.h" -#include "test_python.h" + #include "test_io.h" -#include "test_particles.h" -#include "test_detailer.h" #include "test_shader_lang.h" #include "test_gdscript.h" #include "test_image.h" @@ -56,7 +53,6 @@ const char ** tests_get_names() { "containers", "math", "render", - "particles", "multimesh", "gui", "io", @@ -96,11 +92,6 @@ MainLoop* test_main(String p_test,const List<String>& p_args) { return TestPhysics2D::test(); } - if (p_test=="misc") { - - return TestMisc::test(); - } - if (p_test=="render") { return TestRender::test(); @@ -123,16 +114,6 @@ MainLoop* test_main(String p_test,const List<String>& p_args) { return TestIO::test(); } - if (p_test=="particles") { - - return TestParticles::test(); - } - - if (p_test=="multimesh") { - - return TestMultiMesh::test(); - } - if (p_test=="shaderlang") { return TestShaderLang::test(); @@ -163,19 +144,6 @@ MainLoop* test_main(String p_test,const List<String>& p_args) { return TestImage::test(); } - if (p_test=="detailer") { - - return TestMultiMesh::test(); - } - -#ifdef PYTHON_ENABLED - - if (p_test=="python") { - - return TestPython::test(); - } -#endif - return NULL; } diff --git a/bin/tests/test_misc.cpp b/bin/tests/test_misc.cpp deleted file mode 100644 index 9d7adc3573..0000000000 --- a/bin/tests/test_misc.cpp +++ /dev/null @@ -1,499 +0,0 @@ -/*************************************************************************/ -/* test_misc.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 "test_misc.h" -#include "servers/visual_server.h" -#include "os/main_loop.h" -#include "math_funcs.h" -#include "print_string.h" - - -namespace TestMisc { - -struct ConvexTestResult -{ - - Vector3 edgeA[2]; - Vector3 edgeB[2]; - bool valid; - Vector3 contactA; - Vector3 contactB; - Vector3 contactNormal; - float depth; - - /* - Vector3 contactA; - Vector3 contactB; - Vector3 contactNormal; - Vector3 contactX; - Vector3 contactY; - Vector3 edgeA[2]; - Vector3 edgeB[2]; - float depth; - bool valid; - bool isEdgeEdge; - bool needTransform; - neBool ComputerEdgeContactPoint(ConvexTestResult & res); - neBool ComputerEdgeContactPoint2(float & au, float & bu); - void Reverse() - { - neSwap(contactA, contactB); - contactNormal *= -1.0f; - }*/ - bool ComputerEdgeContactPoint2(float & au, float & bu); -}; - - - -bool ConvexTestResult::ComputerEdgeContactPoint2(float & au, float & bu) -{ - float d1343, d4321, d1321, d4343, d2121; - float numer, denom; - - Vector3 p13; - Vector3 p43; - Vector3 p21; - Vector3 diff; - - p13 = (edgeA[0]) - (edgeB[0]); - p43 = (edgeB[1]) - (edgeB[0]); - - if ( p43.length_squared() < CMP_EPSILON2 ) - { - valid = false; - goto ComputerEdgeContactPoint2_Exit; - } - - p21 = (edgeA[1]) - (edgeA[0]); - - if ( p21.length_squared()<CMP_EPSILON2 ) - { - valid = false; - goto ComputerEdgeContactPoint2_Exit; - } - - d1343 = p13.dot(p43); - d4321 = p43.dot(p21); - d1321 = p13.dot(p21); - d4343 = p43.dot(p43); - d2121 = p21.dot(p21); - - denom = d2121 * d4343 - d4321 * d4321; - - if (ABS(denom) < CMP_EPSILON) - { - valid = false; - - goto ComputerEdgeContactPoint2_Exit; - } - - numer = d1343 * d4321 - d1321 * d4343; - au = numer / denom; - bu = (d1343 + d4321 * (au)) / d4343; - - if (au < 0.0f || au >= 1.0f) - { - valid = false; - } - else if (bu < 0.0f || bu >= 1.0f) - { - valid = false; - } - else - { - valid = true; - } - { - Vector3 tmpv; - - tmpv = p21 * au; - contactA = (edgeA[0]) + tmpv; - - tmpv = p43 * bu; - contactB = (edgeB[0]) + tmpv; - } - - diff = contactA - contactB; - - depth = Math::sqrt(diff.dot(diff)); - - return true; - -ComputerEdgeContactPoint2_Exit: - - return false; -} - -struct neCollisionResult { - - float depth; - bool penetrate; - Matrix3 collisionFrame; - Vector3 contactA; - Vector3 contactB; -}; - - -struct TConvex { - - float radius; - float half_height; - float CylinderRadius() const { return radius; } - float CylinderHalfHeight() const { return half_height; } -}; - -float GetDistanceFromLine2(Vector3 v, Vector3 & project, const Vector3 & pointA, const Vector3 & pointB) -{ - Vector3 ba = pointB - pointA; - - float len = ba.length(); - - if (len<CMP_EPSILON) - ba=Vector3(); - else - ba *= 1.0f / len; - - Vector3 pa = v - pointA; - - float k = pa.dot(ba); - - project = pointA + ba * k; - - Vector3 diff = v - project; - - return diff.length(); -} - -void TestCylinderVertEdge(neCollisionResult & result, Vector3 & edgeA1, Vector3 & edgeA2, Vector3 & vertB, - TConvex & cA, TConvex & cB, Transform & transA, Transform & transB, bool flip) -{ - Vector3 project; - - float dist = GetDistanceFromLine2(vertB,project, edgeA1, edgeA2); - - float depth = cA.CylinderRadius() + cB.CylinderRadius() - dist; - - if (depth <= 0.0f) - return; - - if (depth <= result.depth) - return; - - result.penetrate = true; - - result.depth = depth; - - if (!flip) - { - result.collisionFrame.set_axis(2,(project - vertB).normalized()); - - result.contactA = project - result.collisionFrame.get_axis(2) * cA.CylinderRadius(); - - result.contactB = vertB + result.collisionFrame.get_axis(2) * cB.CylinderRadius(); - } - else - { - - result.collisionFrame.set_axis(2,(vertB - project).normalized()); - - result.contactA = vertB - result.collisionFrame.get_axis(2) * cB.CylinderRadius(); - - result.contactB = project + result.collisionFrame.get_axis(2) * cA.CylinderRadius(); - } -} - -void TestCylinderVertVert(neCollisionResult & result, Vector3 & vertA, Vector3 & vertB, - TConvex & cA, TConvex & cB, Transform & transA, Transform & transB) -{ - Vector3 diff = vertA - vertB; - - float dist = diff.length(); - - float depth = cA.CylinderRadius() + cB.CylinderRadius() - dist; - - if (depth <= 0.0f) - return; - - if (depth <= result.depth) - return; - - result.penetrate = true; - - result.depth = depth; - - result.collisionFrame.set_axis(2, diff * (1.0f / dist)); - - result.contactA = vertA - result.collisionFrame.get_axis(2) * cA.CylinderRadius(); - - result.contactB = vertB + result.collisionFrame.get_axis(2) * cB.CylinderRadius(); -} - -void Cylinder2CylinderTest(neCollisionResult & result, TConvex & cA, Transform & transA, TConvex & cB, Transform & transB) -{ - result.penetrate = false; - - Vector3 dir = transA.basis.get_axis(1).cross(transB.basis.get_axis(1)); - - float len = dir.length(); - -// bool isParallel = len<CMP_EPSILON; - -// int doVertCheck = 0; - - ConvexTestResult cr; - - cr.edgeA[0] = transA.origin + transA.basis.get_axis(1) * cA.CylinderHalfHeight(); - cr.edgeA[1] = transA.origin - transA.basis.get_axis(1) * cA.CylinderHalfHeight(); - cr.edgeB[0] = transB.origin + transB.basis.get_axis(1) * cB.CylinderHalfHeight(); - cr.edgeB[1] = transB.origin - transB.basis.get_axis(1) * cB.CylinderHalfHeight(); - -// float dot = transA.basis.get_axis(1).dot(transB.basis.get_axis(1)); - - if (len>CMP_EPSILON) - { - float au, bu; - - cr.ComputerEdgeContactPoint2(au, bu); - - if (cr.valid) - { - float depth = cA.CylinderRadius() + cB.CylinderRadius() - cr.depth; - - if (depth <= 0.0f) - return; - - result.depth = depth; - - result.penetrate = true; - - result.collisionFrame.set_axis(2, (cr.contactA - cr.contactB)*(1.0f / cr.depth)); - - result.contactA = cr.contactA - result.collisionFrame.get_axis(2) * cA.CylinderRadius(); - - result.contactB = cr.contactB + result.collisionFrame.get_axis(2) * cB.CylinderRadius(); - - return; - } - } - result.depth = -1.0e6f; - - int i; - - for (i = 0; i < 2; i++) - { - //project onto edge b - - Vector3 diff = cr.edgeA[i] - cr.edgeB[1]; - - float dot = diff.dot(transB.basis.get_axis(1)); - - if (dot < 0.0f) - { - TestCylinderVertVert(result, cr.edgeA[i], cr.edgeB[1], cA, cB, transA, transB); - } - else if (dot > (2.0f * cB.CylinderHalfHeight())) - { - TestCylinderVertVert(result, cr.edgeA[i], cr.edgeB[0], cA, cB, transA, transB); - } - else - { - TestCylinderVertEdge(result, cr.edgeB[0], cr.edgeB[1], cr.edgeA[i], cB, cA, transB, transA, true); - } - } - for (i = 0; i < 2; i++) - { - //project onto edge b - - Vector3 diff = cr.edgeB[i] - cr.edgeA[1]; - - float dot = diff.dot(transA.basis.get_axis(1)); - - if (dot < 0.0f) - { - TestCylinderVertVert(result, cr.edgeB[i], cr.edgeA[1], cA, cB, transA, transB); - } - else if (dot > (2.0f * cB.CylinderHalfHeight())) - { - TestCylinderVertVert(result, cr.edgeB[i], cr.edgeA[0], cA, cB, transA, transB); - } - else - { - TestCylinderVertEdge(result, cr.edgeA[0], cr.edgeA[1], cr.edgeB[i], cA, cB, transA, transB, false); - } - } -} - - -class TestMainLoop : public MainLoop { - - RID meshA; - RID meshB; - RID poly; - RID instance; - RID camera; - RID viewport; - RID boxA; - RID boxB; - RID scenario; - - Transform rot_a; - Transform rot_b; - - bool quit; -public: - virtual void input_event(const InputEvent& p_event) { - - if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&BUTTON_MASK_LEFT) { - - rot_b.origin.y+=-p_event.mouse_motion.relative_y/100.0; - rot_b.origin.x+=p_event.mouse_motion.relative_x/100.0; - } - if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&BUTTON_MASK_MIDDLE) { - - //rot_b.origin.x+=-p_event.mouse_motion.relative_y/100.0; - rot_b.origin.z+=p_event.mouse_motion.relative_x/100.0; - } - if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&BUTTON_MASK_RIGHT) { - - float rot_x=-p_event.mouse_motion.relative_y/100.0; - float rot_y=p_event.mouse_motion.relative_x/100.0; - rot_b.basis = rot_b.basis * Matrix3(Vector3(1,0,0),rot_x) * Matrix3(Vector3(0,1,0),rot_y); - } - - } - virtual void request_quit() { - - quit=true; - } - virtual void init() { - - VisualServer *vs=VisualServer::get_singleton(); - - camera = vs->camera_create(); - - viewport = vs->viewport_create(); - vs->viewport_attach_to_screen(viewport); - vs->viewport_attach_camera( viewport, camera ); - vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,0,3 ) ) ); - - /* CONVEX SHAPE */ - - DVector<Plane> cylinder_planes = Geometry::build_cylinder_planes(0.5,2,9,Vector3::AXIS_Y); - RID cylinder_material = vs->fixed_material_create(); - vs->fixed_material_set_param( cylinder_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(0.8,0.2,0.9)); - vs->material_set_flag( cylinder_material, VisualServer::MATERIAL_FLAG_ONTOP,true); - //vs->material_set_flag( cylinder_material, VisualServer::MATERIAL_FLAG_WIREFRAME,true); - vs->material_set_flag( cylinder_material, VisualServer::MATERIAL_FLAG_DOUBLE_SIDED,true); - vs->material_set_flag( cylinder_material, VisualServer::MATERIAL_FLAG_UNSHADED,true); - - RID cylinder_mesh = vs->mesh_create(); - Geometry::MeshData cylinder_data = Geometry::build_convex_mesh(cylinder_planes); - vs->mesh_add_surface_from_mesh_data(cylinder_mesh,cylinder_data); - vs->mesh_surface_set_material( cylinder_mesh, 0, cylinder_material ); - - meshA=vs->instance_create2(cylinder_mesh,scenario); - meshB=vs->instance_create2(cylinder_mesh,scenario); - boxA=vs->instance_create2(vs->get_test_cube(),scenario); - boxB=vs->instance_create2(vs->get_test_cube(),scenario); - - /* - RID lightaux = vs->light_create( VisualServer::LIGHT_OMNI ); - vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_RADIUS, 80 ); - vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ATTENUATION, 1 ); - vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ENERGY, 1.5 ); - light = vs->instance_create2( lightaux ); - */ - 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 ); - 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)); - - //rot_x=0; - //rot_y=0; - quit=false; - } - virtual bool idle(float p_time) { - - VisualServer *vs=VisualServer::get_singleton(); - - vs->instance_set_transform(meshA,rot_a); - vs->instance_set_transform(meshB,rot_b); - - - neCollisionResult res; - TConvex a; - a.radius=0.5; - a.half_height=1; - Cylinder2CylinderTest(res,a,rot_a,a,rot_b); - if (res.penetrate) { - - Matrix3 scale; - scale.scale(Vector3(0.1,0.1,0.1)); - vs->instance_set_transform(boxA,Transform(scale,res.contactA)); - vs->instance_set_transform(boxB,Transform(scale,res.contactB)); - print_line("depth: "+rtos(res.depth)); - } else { - - Matrix3 scale; - scale.scale(Vector3()); - vs->instance_set_transform(boxA,Transform(scale,res.contactA)); - vs->instance_set_transform(boxB,Transform(scale,res.contactB)); - - } - print_line("collided: "+itos(res.penetrate)); - - return false; - } - - - virtual bool iteration(float p_time) { - - - - return quit; - } - virtual void finish() { - - } - -}; - - -MainLoop* test() { - - return memnew( TestMainLoop ); - -} - -} - - - diff --git a/bin/tests/test_misc.h b/bin/tests/test_misc.h deleted file mode 100644 index 55608f6a0e..0000000000 --- a/bin/tests/test_misc.h +++ /dev/null @@ -1,40 +0,0 @@ -/*************************************************************************/ -/* test_misc.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 TEST_MISC_H -#define TEST_MISC_H - -#include "os/main_loop.h" - -namespace TestMisc { - -MainLoop* test(); - -} - -#endif diff --git a/bin/tests/test_particles.cpp b/bin/tests/test_particles.cpp deleted file mode 100644 index 23a4b9e635..0000000000 --- a/bin/tests/test_particles.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/*************************************************************************/ -/* test_particles.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 "test_particles.h" -#include "servers/visual_server.h" -#include "os/main_loop.h" -#include "math_funcs.h" -#include "print_string.h" - -namespace TestParticles { - - -class TestMainLoop : public MainLoop { - - RID particles; - RID instance; - RID camera; - RID viewport; - RID light; - RID scenario; - - struct InstanceInfo { - - RID instance; - Transform base; - Vector3 rot_axis; - }; - - List<InstanceInfo> instances; - - float ofs; - bool quit; -public: - virtual void input_event(const InputEvent& p_event) { - - - } - virtual void request_quit() { - - quit=true; - } - virtual void init() { - - VisualServer *vs=VisualServer::get_singleton(); - particles = vs->particles_create(); - vs->particles_set_amount(particles,1000); - - instance = vs->instance_create2(particles,scenario); - - - camera = vs->camera_create(); - -// vs->camera_set_perspective( camera, 60.0,0.1, 100.0 ); - viewport = vs->viewport_create(); - vs->viewport_attach_camera( viewport, camera ); - vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,0,20 ) ) ); - /* - RID lightaux = vs->light_create( VisualServer::LIGHT_OMNI ); - vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_RADIUS, 80 ); - vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ATTENUATION, 1 ); - vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ENERGY, 1.5 ); - light = vs->instance_create2( lightaux ); - */ - RID lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL ); - // vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) ); - light = vs->instance_create2( lightaux, scenario ); - - ofs=0; - quit=false; - } - virtual bool idle(float p_time) { - return false; - } - - - virtual bool iteration(float p_time) { - -// VisualServer *vs=VisualServer::get_singleton(); - - ofs+=p_time; - return quit; - } - virtual void finish() { - - } - -}; - - -MainLoop* test() { - - return memnew( TestMainLoop ); - -} - -} diff --git a/bin/tests/test_particles.h b/bin/tests/test_particles.h deleted file mode 100644 index e95637a4e6..0000000000 --- a/bin/tests/test_particles.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************/ -/* test_particles.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 TEST_PARTICLES_H -#define TEST_PARTICLES_H - -/** - @author Juan Linietsky <reduzio@gmail.com> -*/ -#include "os/main_loop.h" - -namespace TestParticles { - -MainLoop* test(); - -} - -#endif diff --git a/bin/tests/test_physics.cpp b/bin/tests/test_physics.cpp index f202d0dda1..3a8ca65734 100644 --- a/bin/tests/test_physics.cpp +++ b/bin/tests/test_physics.cpp @@ -138,10 +138,6 @@ protected: /* SPHERE SHAPE */ RID sphere_mesh = vs->make_sphere_mesh(10,20,0.5); - RID sphere_material = vs->fixed_material_create(); - //vs->material_set_flag( sphere_material, VisualServer::MATERIAL_FLAG_WIREFRAME, true ); - vs->fixed_material_set_param( sphere_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(0.7,0.8,3.0) ); - vs->mesh_surface_set_material( sphere_mesh, 0, sphere_material ); type_mesh_map[PhysicsServer::SHAPE_SPHERE]=sphere_mesh; RID sphere_shape=ps->shape_create(PhysicsServer::SHAPE_SPHERE); @@ -151,12 +147,9 @@ protected: /* BOX SHAPE */ DVector<Plane> box_planes = Geometry::build_box_planes(Vector3(0.5,0.5,0.5)); - RID box_material = vs->fixed_material_create(); - vs->fixed_material_set_param( box_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(1.0,0.2,0.2) ); RID box_mesh = vs->mesh_create(); Geometry::MeshData box_data = Geometry::build_convex_mesh(box_planes); vs->mesh_add_surface_from_mesh_data(box_mesh,box_data); - vs->mesh_surface_set_material( box_mesh, 0, box_material ); type_mesh_map[PhysicsServer::SHAPE_BOX]=box_mesh; RID box_shape=ps->shape_create(PhysicsServer::SHAPE_BOX); @@ -167,13 +160,11 @@ protected: /* CAPSULE SHAPE */ DVector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5,0.7,12,Vector3::AXIS_Z); - RID capsule_material = vs->fixed_material_create(); - vs->fixed_material_set_param( capsule_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(0.3,0.4,1.0) ); RID capsule_mesh = vs->mesh_create(); Geometry::MeshData capsule_data = Geometry::build_convex_mesh(capsule_planes); vs->mesh_add_surface_from_mesh_data(capsule_mesh,capsule_data); - vs->mesh_surface_set_material( capsule_mesh, 0, capsule_material ); + type_mesh_map[PhysicsServer::SHAPE_CAPSULE]=capsule_mesh; RID capsule_shape=ps->shape_create(PhysicsServer::SHAPE_CAPSULE); @@ -186,14 +177,12 @@ protected: /* CONVEX SHAPE */ DVector<Plane> convex_planes = Geometry::build_cylinder_planes(0.5,0.7,5,Vector3::AXIS_Z); - RID convex_material = vs->fixed_material_create(); - vs->fixed_material_set_param( convex_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(0.8,0.2,0.9)); RID convex_mesh = vs->mesh_create(); Geometry::MeshData convex_data = Geometry::build_convex_mesh(convex_planes); QuickHull::build(convex_data.vertices,convex_data); vs->mesh_add_surface_from_mesh_data(convex_mesh,convex_data); - vs->mesh_surface_set_material( convex_mesh, 0, convex_material ); + type_mesh_map[PhysicsServer::SHAPE_CONVEX_POLYGON]=convex_mesh; RID convex_shape=ps->shape_create(PhysicsServer::SHAPE_CONVEX_POLYGON); @@ -223,11 +212,9 @@ protected: d.resize(VS::ARRAY_MAX); d[VS::ARRAY_VERTEX]=p_faces; d[VS::ARRAY_NORMAL]=normals; - vs->mesh_add_surface(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, d ); - RID trimesh_mat = vs->fixed_material_create(); - vs->fixed_material_set_param( trimesh_mat, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(1.0,0.5,0.8)); + vs->mesh_add_surface_from_arrays(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, d ); //vs->material_set_flag( trimesh_mat, VisualServer::MATERIAL_FLAG_UNSHADED,true); - vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_mat ); + RID triins = vs->instance_create2(trimesh_mesh,scenario); @@ -464,7 +451,7 @@ public: } virtual bool iteration(float p_time) { - if (mover) { + if (mover.is_valid()) { static float joy_speed = 10; PhysicsServer * ps = PhysicsServer::get_singleton(); Transform t = ps->body_get_state(mover,PhysicsServer::BODY_STATE_TRANSFORM); @@ -548,15 +535,10 @@ public: DVector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5,1,12,5,Vector3::AXIS_Y); - RID capsule_material = vs->fixed_material_create(); - - vs->fixed_material_set_param( capsule_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(1,1,1) ); - RID capsule_mesh = vs->mesh_create(); Geometry::MeshData capsule_data = Geometry::build_convex_mesh(capsule_planes); vs->mesh_add_surface_from_mesh_data(capsule_mesh,capsule_data); - vs->mesh_surface_set_material( capsule_mesh, 0, capsule_material ); type_mesh_map[PhysicsServer::SHAPE_CAPSULE]=capsule_mesh; RID capsule_shape=ps->shape_create(PhysicsServer::SHAPE_CAPSULE); diff --git a/bin/tests/test_physics_2d.cpp b/bin/tests/test_physics_2d.cpp index 845e20b6c3..f369c361d3 100644 --- a/bin/tests/test_physics_2d.cpp +++ b/bin/tests/test_physics_2d.cpp @@ -85,7 +85,7 @@ class TestPhysics2DMainLoop : public MainLoop { } } - Image image(32,2,0,Image::FORMAT_GRAYSCALE_ALPHA,pixels); + Image image(32,2,0,Image::FORMAT_LA8,pixels); body_shape_data[Physics2DServer::SHAPE_SEGMENT].image=vs->texture_create_from_image(image); @@ -113,7 +113,7 @@ class TestPhysics2DMainLoop : public MainLoop { } } - Image image(32,32,0,Image::FORMAT_GRAYSCALE_ALPHA,pixels); + Image image(32,32,0,Image::FORMAT_LA8,pixels); body_shape_data[Physics2DServer::SHAPE_CIRCLE].image=vs->texture_create_from_image(image); @@ -141,7 +141,7 @@ class TestPhysics2DMainLoop : public MainLoop { } } - Image image(32,32,0,Image::FORMAT_GRAYSCALE_ALPHA,pixels); + Image image(32,32,0,Image::FORMAT_LA8,pixels); body_shape_data[Physics2DServer::SHAPE_RECTANGLE].image=vs->texture_create_from_image(image); @@ -173,7 +173,7 @@ class TestPhysics2DMainLoop : public MainLoop { } } - Image image(32,64,0,Image::FORMAT_GRAYSCALE_ALPHA,pixels); + Image image(32,64,0,Image::FORMAT_LA8,pixels); body_shape_data[Physics2DServer::SHAPE_CAPSULE].image=vs->texture_create_from_image(image); @@ -381,7 +381,7 @@ public: RID vp = vs->viewport_create(); canvas = vs->canvas_create(); vs->viewport_attach_canvas(vp,canvas); - vs->viewport_attach_to_screen(vp); + vs->viewport_attach_to_screen(vp,Rect2(Vector2(),OS::get_singleton()->get_window_size())); Matrix32 smaller; //smaller.scale(Vector2(0.6,0.6)); //smaller.elements[2]=Vector2(100,0); diff --git a/bin/tests/test_python.cpp b/bin/tests/test_python.cpp deleted file mode 100644 index f4a3d7a3a2..0000000000 --- a/bin/tests/test_python.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************/ -/* test_python.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 "test_python.h" - -#ifdef PYTHON_ENABLED - -#include "Python.h" -#include "print_string.h" - -namespace TestPython { - -void test() { - - print_line("testing python"); - PyRun_SimpleString("import engine\n"); - PyRun_SimpleString("def test(self):\n\tprint(\"noway\")\n"); - PyRun_SimpleString("a=engine.ObjectPtr()\n"); - PyRun_SimpleString("a.noway(22,'hello')\n"); - PyRun_SimpleString("a.normalize()\n"); - PyRun_SimpleString("class Moch(engine.ObjectPtr):\n\tdef mooch(self):\n\t\tprint('muchi')\n"); - PyRun_SimpleString("b=Moch();\n"); - PyRun_SimpleString("b.mooch();\n"); - PyRun_SimpleString("b.meis();\n"); - - -} - -} - -#endif diff --git a/bin/tests/test_python.h b/bin/tests/test_python.h deleted file mode 100644 index 77e9603fe2..0000000000 --- a/bin/tests/test_python.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************/ -/* test_python.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 TEST_PYTHON_H -#define TEST_PYTHON_H - -#ifdef PYTHON_ENABLED -/** - @author Juan Linietsky <reduzio@gmail.com> -*/ -namespace TestPython { - -void test(); - -} - -#endif -#endif diff --git a/bin/tests/test_render.cpp b/bin/tests/test_render.cpp index 9c3a287afa..7bf833c8a7 100644 --- a/bin/tests/test_render.cpp +++ b/bin/tests/test_render.cpp @@ -173,7 +173,7 @@ public: // vs->camera_set_perspective( camera, 60.0,0.1, 100.0 ); viewport = vs->viewport_create(); - vs->viewport_attach_to_screen(viewport); + vs->viewport_attach_to_screen(viewport,Rect2(Vector2(),OS::get_singleton()->get_window_size())); vs->viewport_attach_camera( viewport, camera ); vs->viewport_set_scenario( viewport, scenario ); vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,3,30 ) ) ); @@ -192,7 +192,7 @@ public: //* 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_color( lightaux, VisualServer::LIGHT_COLOR_DIFFUSE, Color(1.0,1.0,1.0) ); + vs->light_set_color( lightaux, Color(1.0,1.0,1.0) ); //vs->light_set_shadow( lightaux, true ); light = vs->instance_create2( lightaux, scenario ); Transform lla; @@ -205,8 +205,8 @@ public: //* lightaux = vs->light_create( VisualServer::LIGHT_OMNI ); // vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,1.0) ); - vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_DIFFUSE, Color(1.0,1.0,0.0) ); - vs->light_set_param( lightaux, VisualServer::LIGHT_PARAM_RADIUS, 4 ); + vs->light_set_color( lightaux, Color(1.0,1.0,0.0) ); + vs->light_set_param( lightaux, VisualServer::LIGHT_PARAM_RANGE, 4 ); vs->light_set_param( lightaux, VisualServer::LIGHT_PARAM_ENERGY, 8 ); //vs->light_set_shadow( lightaux, true ); //light = vs->instance_create( lightaux ); diff --git a/bin/tests/test_shader_lang.cpp b/bin/tests/test_shader_lang.cpp index 9c0075c47d..6c8132122c 100644 --- a/bin/tests/test_shader_lang.cpp +++ b/bin/tests/test_shader_lang.cpp @@ -37,9 +37,9 @@ #include "scene/gui/text_edit.h" #include "print_string.h" #include "servers/visual/shader_language.h" -#include "drivers/gles2/shader_compiler_gles2.h" - +//#include "drivers/gles2/shader_compiler_gles2.h" +#if 0 typedef ShaderLanguage SL; namespace TestShaderLang { @@ -323,7 +323,7 @@ MainLoop* test() { if (!err) { print_line(rcode); } - +#if 0 ShaderCompilerGLES2 comp; String codeline,globalsline; SL::VarInfo vi; @@ -333,6 +333,18 @@ MainLoop* test() { ShaderCompilerGLES2::Flags fl; comp.compile(code,ShaderLanguage::SHADER_MATERIAL_FRAGMENT,codeline,globalsline,fl); +#endif + return NULL; +} + +} +#endif + +typedef ShaderLanguage SL; + +namespace TestShaderLang { + +MainLoop* test() { return NULL; } |