summaryrefslogtreecommitdiff
path: root/main/tests
diff options
context:
space:
mode:
Diffstat (limited to 'main/tests')
-rw-r--r--main/tests/SCsub2
-rw-r--r--main/tests/test_astar.cpp4
-rw-r--r--main/tests/test_gdscript.cpp20
-rw-r--r--main/tests/test_gui.cpp8
-rw-r--r--main/tests/test_main.cpp23
-rw-r--r--main/tests/test_main.h3
-rw-r--r--main/tests/test_math.cpp12
-rw-r--r--main/tests/test_oa_hash_map.cpp5
-rw-r--r--main/tests/test_oa_hash_map.h1
-rw-r--r--main/tests/test_ordered_hash_map.cpp6
-rw-r--r--main/tests/test_ordered_hash_map.h4
-rw-r--r--main/tests/test_physics_2d.cpp89
-rw-r--r--main/tests/test_physics_3d.cpp (renamed from main/tests/test_physics.cpp)151
-rw-r--r--main/tests/test_physics_3d.h (renamed from main/tests/test_physics.h)4
-rw-r--r--main/tests/test_render.cpp27
-rw-r--r--main/tests/test_shader_lang.cpp12
-rw-r--r--main/tests/test_string.cpp6
17 files changed, 193 insertions, 184 deletions
diff --git a/main/tests/SCsub b/main/tests/SCsub
index 437d9ed777..cb1d35b12f 100644
--- a/main/tests/SCsub
+++ b/main/tests/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/python
-Import('env')
+Import("env")
env.tests_sources = []
env.add_source_files(env.tests_sources, "*.cpp")
diff --git a/main/tests/test_astar.cpp b/main/tests/test_astar.cpp
index e82d885af2..e0b4a7f2c8 100644
--- a/main/tests/test_astar.cpp
+++ b/main/tests/test_astar.cpp
@@ -351,7 +351,7 @@ TestFunc test_funcs[] = {
test_abcx,
test_add_remove,
test_solutions,
- NULL
+ nullptr
};
MainLoop *test() {
@@ -370,7 +370,7 @@ MainLoop *test() {
}
OS::get_singleton()->print("\n");
OS::get_singleton()->print("Passed %i of %i tests\n", passed, count);
- return NULL;
+ return nullptr;
}
} // namespace TestAStar
diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp
index 0e7c45f603..971460c655 100644
--- a/main/tests/test_gdscript.cpp
+++ b/main/tests/test_gdscript.cpp
@@ -396,7 +396,7 @@ static void _parser_show_block(const GDScriptParser::BlockNode *p_block, int p_i
}
}
-static void _parser_show_function(const GDScriptParser::FunctionNode *p_func, int p_indent, GDScriptParser::BlockNode *p_initializer = NULL) {
+static void _parser_show_function(const GDScriptParser::FunctionNode *p_func, int p_indent, GDScriptParser::BlockNode *p_initializer = nullptr) {
String txt;
if (p_func->_static)
@@ -947,17 +947,17 @@ MainLoop *test(TestType p_type) {
List<String> cmdlargs = OS::get_singleton()->get_cmdline_args();
if (cmdlargs.empty()) {
- return NULL;
+ return nullptr;
}
String test = cmdlargs.back()->get();
if (!test.ends_with(".gd") && !test.ends_with(".gdc")) {
print_line("This test expects a path to a GDScript file as its last parameter. Got: " + test);
- return NULL;
+ return nullptr;
}
FileAccess *fa = FileAccess::open(test, FileAccess::READ);
- ERR_FAIL_COND_V_MSG(!fa, NULL, "Could not open file: " + test);
+ ERR_FAIL_COND_V_MSG(!fa, nullptr, "Could not open file: " + test);
Vector<uint8_t> buf;
int flen = fa->get_len();
@@ -1030,11 +1030,11 @@ MainLoop *test(TestType p_type) {
if (err) {
print_line("Parse Error:\n" + itos(parser.get_error_line()) + ":" + itos(parser.get_error_column()) + ":" + parser.get_error());
memdelete(fa);
- return NULL;
+ return nullptr;
}
const GDScriptParser::Node *root = parser.get_parse_tree();
- ERR_FAIL_COND_V(root->type != GDScriptParser::Node::TYPE_CLASS, NULL);
+ ERR_FAIL_COND_V(root->type != GDScriptParser::Node::TYPE_CLASS, nullptr);
const GDScriptParser::ClassNode *cnode = static_cast<const GDScriptParser::ClassNode *>(root);
_parser_show_class(cnode, 0, lines);
@@ -1048,7 +1048,7 @@ MainLoop *test(TestType p_type) {
if (err) {
print_line("Parse Error:\n" + itos(parser.get_error_line()) + ":" + itos(parser.get_error_column()) + ":" + parser.get_error());
memdelete(fa);
- return NULL;
+ return nullptr;
}
Ref<GDScript> gds;
@@ -1059,7 +1059,7 @@ MainLoop *test(TestType p_type) {
if (err) {
print_line("Compile Error:\n" + itos(gdc.get_error_line()) + ":" + itos(gdc.get_error_column()) + ":" + gdc.get_error());
- return NULL;
+ return nullptr;
}
Ref<GDScript> current = gds;
@@ -1083,7 +1083,7 @@ MainLoop *test(TestType p_type) {
memdelete(fa);
- return NULL;
+ return nullptr;
}
} // namespace TestGDScript
@@ -1093,7 +1093,7 @@ namespace TestGDScript {
MainLoop *test(TestType p_type) {
ERR_PRINT("The GDScript module is disabled, therefore GDScript tests cannot be used.");
- return NULL;
+ return nullptr;
}
} // namespace TestGDScript
diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp
index f0b00aeeae..c5c8917a51 100644
--- a/main/tests/test_gui.cpp
+++ b/main/tests/test_gui.cpp
@@ -35,7 +35,7 @@
#include "core/io/image_loader.h"
#include "core/os/os.h"
#include "core/print_string.h"
-#include "scene/2d/sprite.h"
+#include "scene/2d/sprite_2d.h"
#include "scene/gui/button.h"
#include "scene/gui/control.h"
#include "scene/gui/label.h"
@@ -53,8 +53,8 @@
#include "scene/gui/tree.h"
#include "scene/main/scene_tree.h"
-#include "scene/3d/camera.h"
-#include "scene/main/viewport.h"
+#include "scene/3d/camera_3d.h"
+#include "scene/main/window.h"
namespace TestGUI {
@@ -220,7 +220,7 @@ public:
richtext->add_text("faeries.\n");
richtext->pop();
richtext->add_text("In this new episode, we will attempt to ");
- richtext->push_font(richtext->get_font("mono_font", "Fonts"));
+ richtext->push_font(richtext->get_theme_font("mono_font", "Fonts"));
richtext->push_color(Color(0.7, 0.5, 1.0));
richtext->add_text("deliver something nice");
richtext->pop();
diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp
index 2c2e6e8b45..922a55b88e 100644
--- a/main/tests/test_main.cpp
+++ b/main/tests/test_main.cpp
@@ -28,8 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "test_main.h"
+
#include "core/list.h"
-#include "core/os/main_loop.h"
#ifdef DEBUG_ENABLED
@@ -39,8 +40,8 @@
#include "test_math.h"
#include "test_oa_hash_map.h"
#include "test_ordered_hash_map.h"
-#include "test_physics.h"
#include "test_physics_2d.h"
+#include "test_physics_3d.h"
#include "test_render.h"
#include "test_shader_lang.h"
#include "test_string.h"
@@ -50,8 +51,8 @@ const char **tests_get_names() {
static const char *test_names[] = {
"string",
"math",
- "physics",
"physics_2d",
+ "physics_3d",
"render",
"oa_hash_map",
"gui",
@@ -62,7 +63,7 @@ const char **tests_get_names() {
"gd_bytecode",
"ordered_hash_map",
"astar",
- NULL
+ nullptr
};
return test_names;
@@ -80,14 +81,14 @@ MainLoop *test_main(String p_test, const List<String> &p_args) {
return TestMath::test();
}
- if (p_test == "physics") {
+ if (p_test == "physics_2d") {
- return TestPhysics::test();
+ return TestPhysics2D::test();
}
- if (p_test == "physics_2d") {
+ if (p_test == "physics_3d") {
- return TestPhysics2D::test();
+ return TestPhysics3D::test();
}
if (p_test == "render") {
@@ -143,7 +144,7 @@ MainLoop *test_main(String p_test, const List<String> &p_args) {
}
print_line("Unknown test: " + p_test);
- return NULL;
+ return nullptr;
}
#else
@@ -151,7 +152,7 @@ MainLoop *test_main(String p_test, const List<String> &p_args) {
const char **tests_get_names() {
static const char *test_names[] = {
- NULL
+ nullptr
};
return test_names;
@@ -159,7 +160,7 @@ const char **tests_get_names() {
MainLoop *test_main(String p_test, const List<String> &p_args) {
- return NULL;
+ return nullptr;
}
#endif
diff --git a/main/tests/test_main.h b/main/tests/test_main.h
index 56db3ea2a5..bdb1668d21 100644
--- a/main/tests/test_main.h
+++ b/main/tests/test_main.h
@@ -32,9 +32,10 @@
#define TEST_MAIN_H
#include "core/list.h"
+#include "core/os/main_loop.h"
#include "core/ustring.h"
const char **tests_get_names();
MainLoop *test_main(String p_test, const List<String> &p_args);
-#endif
+#endif // TEST_MAIN_H
diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp
index d91503501d..38f7371802 100644
--- a/main/tests/test_math.cpp
+++ b/main/tests/test_math.cpp
@@ -43,7 +43,7 @@
#include "core/vmap.h"
#include "scene/main/node.h"
#include "scene/resources/texture.h"
-#include "servers/visual/shader_language.h"
+#include "servers/rendering/shader_language.h"
#include "core/method_ptrcall.h"
@@ -475,18 +475,18 @@ MainLoop *test() {
if (cmdlargs.empty()) {
//try editor!
- return NULL;
+ return nullptr;
}
String test = cmdlargs.back()->get();
if (test == "math") {
// Not a file name but the test name, abort.
// FIXME: This test is ugly as heck, needs fixing :)
- return NULL;
+ return nullptr;
}
FileAccess *fa = FileAccess::open(test, FileAccess::READ);
- ERR_FAIL_COND_V_MSG(!fa, NULL, "Could not open file: " + test);
+ ERR_FAIL_COND_V_MSG(!fa, nullptr, "Could not open file: " + test);
Vector<uint8_t> buf;
int flen = fa->get_len();
@@ -580,7 +580,7 @@ MainLoop *test() {
List<String> args;
args.push_back("-l");
- Error err = OS::get_singleton()->execute("/bin/ls", args, true, NULL, &ret);
+ Error err = OS::get_singleton()->execute("/bin/ls", args, true, nullptr, &ret);
print_line("error: " + itos(err));
print_line(ret);
@@ -660,6 +660,6 @@ MainLoop *test() {
print_line("scalar /=: " + v);
}
- return NULL;
+ return nullptr;
}
} // namespace TestMath
diff --git a/main/tests/test_oa_hash_map.cpp b/main/tests/test_oa_hash_map.cpp
index edb57f2a9f..cffec7fa77 100644
--- a/main/tests/test_oa_hash_map.cpp
+++ b/main/tests/test_oa_hash_map.cpp
@@ -30,9 +30,8 @@
#include "test_oa_hash_map.h"
-#include "core/os/os.h"
-
#include "core/oa_hash_map.h"
+#include "core/os/os.h"
namespace TestOAHashMap {
@@ -153,6 +152,6 @@ MainLoop *test() {
map.set(5, 1);
}
- return NULL;
+ return nullptr;
}
} // namespace TestOAHashMap
diff --git a/main/tests/test_oa_hash_map.h b/main/tests/test_oa_hash_map.h
index 60cde961c5..eb2b3d1e99 100644
--- a/main/tests/test_oa_hash_map.h
+++ b/main/tests/test_oa_hash_map.h
@@ -37,4 +37,5 @@ namespace TestOAHashMap {
MainLoop *test();
}
+
#endif // TEST_OA_HASH_MAP_H
diff --git a/main/tests/test_ordered_hash_map.cpp b/main/tests/test_ordered_hash_map.cpp
index cc779119bc..0720eebaf9 100644
--- a/main/tests/test_ordered_hash_map.cpp
+++ b/main/tests/test_ordered_hash_map.cpp
@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "test_ordered_hash_map.h"
+
#include "core/ordered_hash_map.h"
#include "core/os/os.h"
#include "core/pair.h"
@@ -139,7 +141,7 @@ TestFunc test_funcs[] = {
test_size,
test_iteration,
test_const_iteration,
- 0
+ nullptr
};
@@ -166,6 +168,6 @@ MainLoop *test() {
OS::get_singleton()->print("Passed %i of %i tests\n", passed, count);
- return NULL;
+ return nullptr;
}
} // namespace TestOrderedHashMap
diff --git a/main/tests/test_ordered_hash_map.h b/main/tests/test_ordered_hash_map.h
index 03e559107e..f251da0ba2 100644
--- a/main/tests/test_ordered_hash_map.h
+++ b/main/tests/test_ordered_hash_map.h
@@ -31,9 +31,11 @@
#ifndef TEST_ORDERED_HASH_MAP_H
#define TEST_ORDERED_HASH_MAP_H
+#include "core/os/main_loop.h"
+
namespace TestOrderedHashMap {
MainLoop *test();
}
-#endif
+#endif // TEST_ORDERED_HASH_MAP_H
diff --git a/main/tests/test_physics_2d.cpp b/main/tests/test_physics_2d.cpp
index 160c25f43a..6feff3b0a9 100644
--- a/main/tests/test_physics_2d.cpp
+++ b/main/tests/test_physics_2d.cpp
@@ -35,8 +35,9 @@
#include "core/os/os.h"
#include "core/print_string.h"
#include "scene/resources/texture.h"
-#include "servers/physics_2d_server.h"
-#include "servers/visual_server.h"
+#include "servers/display_server.h"
+#include "servers/physics_server_2d.h"
+#include "servers/rendering_server.h"
static const unsigned char convex_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0,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6f, 0x76, 0xb9, 0x5c, 0x9f, 0x89, 0xa2, 0x58, 0xbf, 0xb8, 0xb8, 0x8, 0x26, 0x93, 0x29, 0x3b, 0x3c, 0x3c, 0x8c, 0xed, 0x76, 0x7b, 0xd2, 0x68, 0x34, 0xfe, 0xd0, 0xd8, 0xd8, 0x98, 0xae, 0xb6, 0xe0, 0x8a, 0x1, 0x50, 0xb, 0xe6, 0xa9, 0x5, 0xbf, 0x9c, 0x97, 0xf3, 0xff, 0xf3, 0x2f, 0x6a, 0x82, 0x7f, 0xf6, 0x4e, 0xca, 0x1b, 0xf5, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
@@ -65,8 +66,8 @@ class TestPhysics2DMainLoop : public MainLoop {
BodyShapeData body_shape_data[8];
void _create_body_shape_data() {
- VisualServer *vs = VisualServer::get_singleton();
- Physics2DServer *ps = Physics2DServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
+ PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
// SEGMENT
@@ -85,13 +86,13 @@ class TestPhysics2DMainLoop : public MainLoop {
Ref<Image> image = memnew(Image(32, 2, 0, Image::FORMAT_LA8, pixels));
- body_shape_data[Physics2DServer::SHAPE_SEGMENT].image = vs->texture_2d_create(image);
+ body_shape_data[PhysicsServer2D::SHAPE_SEGMENT].image = vs->texture_2d_create(image);
RID segment_shape = ps->segment_shape_create();
Rect2 sg(Point2(-16, 0), Point2(16, 0));
ps->shape_set_data(segment_shape, sg);
- body_shape_data[Physics2DServer::SHAPE_SEGMENT].shape = segment_shape;
+ body_shape_data[PhysicsServer2D::SHAPE_SEGMENT].shape = segment_shape;
}
// CIRCLE
@@ -112,12 +113,12 @@ class TestPhysics2DMainLoop : public MainLoop {
Ref<Image> image = memnew(Image(32, 32, 0, Image::FORMAT_LA8, pixels));
- body_shape_data[Physics2DServer::SHAPE_CIRCLE].image = vs->texture_2d_create(image);
+ body_shape_data[PhysicsServer2D::SHAPE_CIRCLE].image = vs->texture_2d_create(image);
RID circle_shape = ps->circle_shape_create();
ps->shape_set_data(circle_shape, 16);
- body_shape_data[Physics2DServer::SHAPE_CIRCLE].shape = circle_shape;
+ body_shape_data[PhysicsServer2D::SHAPE_CIRCLE].shape = circle_shape;
}
// BOX
@@ -139,12 +140,12 @@ class TestPhysics2DMainLoop : public MainLoop {
Ref<Image> image = memnew(Image(32, 32, 0, Image::FORMAT_LA8, pixels));
- body_shape_data[Physics2DServer::SHAPE_RECTANGLE].image = vs->texture_2d_create(image);
+ body_shape_data[PhysicsServer2D::SHAPE_RECTANGLE].image = vs->texture_2d_create(image);
RID rectangle_shape = ps->rectangle_shape_create();
ps->shape_set_data(rectangle_shape, Vector2(16, 16));
- body_shape_data[Physics2DServer::SHAPE_RECTANGLE].shape = rectangle_shape;
+ body_shape_data[PhysicsServer2D::SHAPE_RECTANGLE].shape = rectangle_shape;
}
// CAPSULE
@@ -167,12 +168,12 @@ class TestPhysics2DMainLoop : public MainLoop {
Ref<Image> image = memnew(Image(32, 64, 0, Image::FORMAT_LA8, pixels));
- body_shape_data[Physics2DServer::SHAPE_CAPSULE].image = vs->texture_2d_create(image);
+ body_shape_data[PhysicsServer2D::SHAPE_CAPSULE].image = vs->texture_2d_create(image);
RID capsule_shape = ps->capsule_shape_create();
ps->shape_set_data(capsule_shape, Vector2(16, 32));
- body_shape_data[Physics2DServer::SHAPE_CAPSULE].shape = capsule_shape;
+ body_shape_data[PhysicsServer2D::SHAPE_CAPSULE].shape = capsule_shape;
}
// CONVEX
@@ -181,7 +182,7 @@ class TestPhysics2DMainLoop : public MainLoop {
Ref<Image> image = memnew(Image(convex_png));
- body_shape_data[Physics2DServer::SHAPE_CONVEX_POLYGON].image = vs->texture_2d_create(image);
+ body_shape_data[PhysicsServer2D::SHAPE_CONVEX_POLYGON].image = vs->texture_2d_create(image);
RID convex_polygon_shape = ps->convex_polygon_shape_create();
@@ -196,14 +197,14 @@ class TestPhysics2DMainLoop : public MainLoop {
arr.push_back(Point2(11, 7) - sb);
ps->shape_set_data(convex_polygon_shape, arr);
- body_shape_data[Physics2DServer::SHAPE_CONVEX_POLYGON].shape = convex_polygon_shape;
+ body_shape_data[PhysicsServer2D::SHAPE_CONVEX_POLYGON].shape = convex_polygon_shape;
}
}
void _do_ray_query() {
/*
- Physics2DServer *ps = Physics2DServer::get_singleton();
+ PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
ps->query_intersection_segment(ray_query,ray_from,ray_to);
*/
}
@@ -245,16 +246,16 @@ protected:
}
}
- RID _add_body(Physics2DServer::ShapeType p_shape, const Transform2D &p_xform) {
+ RID _add_body(PhysicsServer2D::ShapeType p_shape, const Transform2D &p_xform) {
- VisualServer *vs = VisualServer::get_singleton();
- Physics2DServer *ps = Physics2DServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
+ PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
RID body = ps->body_create();
ps->body_add_shape(body, body_shape_data[p_shape].shape);
ps->body_set_space(body, space);
- ps->body_set_continuous_collision_detection_mode(body, Physics2DServer::CCD_MODE_CAST_SHAPE);
- ps->body_set_state(body, Physics2DServer::BODY_STATE_TRANSFORM, p_xform);
+ ps->body_set_continuous_collision_detection_mode(body, PhysicsServer2D::CCD_MODE_CAST_SHAPE);
+ ps->body_set_state(body, PhysicsServer2D::BODY_STATE_TRANSFORM, p_xform);
//print_line("add body with xform: "+p_xform);
RID sprite = vs->canvas_item_create();
@@ -272,7 +273,7 @@ protected:
void _add_plane(const Vector2 &p_normal, real_t p_d) {
- Physics2DServer *ps = Physics2DServer::get_singleton();
+ PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
Array arr;
arr.push_back(p_normal);
@@ -282,23 +283,23 @@ protected:
ps->shape_set_data(plane, arr);
RID plane_body = ps->body_create();
- ps->body_set_mode(plane_body, Physics2DServer::BODY_MODE_STATIC);
+ ps->body_set_mode(plane_body, PhysicsServer2D::BODY_MODE_STATIC);
ps->body_set_space(plane_body, space);
ps->body_add_shape(plane_body, plane);
}
void _add_concave(const Vector<Vector2> &p_points, const Transform2D &p_xform = Transform2D()) {
- Physics2DServer *ps = Physics2DServer::get_singleton();
- VisualServer *vs = VisualServer::get_singleton();
+ PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
RID concave = ps->concave_polygon_shape_create();
ps->shape_set_data(concave, p_points);
RID body = ps->body_create();
- ps->body_set_mode(body, Physics2DServer::BODY_MODE_STATIC);
+ ps->body_set_mode(body, PhysicsServer2D::BODY_MODE_STATIC);
ps->body_set_space(body, space);
ps->body_add_shape(body, concave);
- ps->body_set_state(body, Physics2DServer::BODY_STATE_TRANSFORM, p_xform);
+ ps->body_set_state(body, PhysicsServer2D::BODY_STATE_TRANSFORM, p_xform);
RID sprite = vs->canvas_item_create();
vs->canvas_item_set_parent(sprite, canvas);
@@ -309,8 +310,8 @@ protected:
}
void _body_moved(Object *p_state, RID p_sprite) {
- Physics2DDirectBodyState *state = (Physics2DDirectBodyState *)p_state;
- VisualServer::get_singleton()->canvas_item_set_transform(p_sprite, state->get_transform());
+ PhysicsDirectBodyState2D *state = (PhysicsDirectBodyState2D *)p_state;
+ RenderingServer::get_singleton()->canvas_item_set_transform(p_sprite, state->get_transform());
}
void _ray_query_callback(const RID &p_rid, ObjectID p_id, int p_shape, const Vector2 &p_point, const Vector2 &p_normal) {
@@ -323,7 +324,7 @@ protected:
ray_end = ray_to;
}
- VisualServer *vs = VisualServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
vs->canvas_item_clear(ray);
vs->canvas_item_add_line(ray, ray_from, ray_end, p_rid.is_valid() ? Color(0, 1, 0.4) : Color(1, 0.4, 0), 2);
@@ -340,21 +341,21 @@ protected:
public:
virtual void init() {
- VisualServer *vs = VisualServer::get_singleton();
- Physics2DServer *ps = Physics2DServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
+ PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
space = ps->space_create();
ps->space_set_active(space, true);
ps->set_active(true);
- ps->area_set_param(space, Physics2DServer::AREA_PARAM_GRAVITY_VECTOR, Vector2(0, 1));
- ps->area_set_param(space, Physics2DServer::AREA_PARAM_GRAVITY, 98);
+ ps->area_set_param(space, PhysicsServer2D::AREA_PARAM_GRAVITY_VECTOR, Vector2(0, 1));
+ ps->area_set_param(space, PhysicsServer2D::AREA_PARAM_GRAVITY, 98);
{
RID vp = vs->viewport_create();
canvas = vs->canvas_create();
- Size2i screen_size = OS::get_singleton()->get_window_size();
+ Size2i screen_size = DisplayServer::get_singleton()->window_get_size();
vs->viewport_attach_canvas(vp, canvas);
vs->viewport_set_size(vp, screen_size.x, screen_size.y);
vs->viewport_attach_to_screen(vp, Rect2(Vector2(), screen_size));
@@ -377,25 +378,25 @@ public:
for (int i = 0; i < 32; i++) {
- Physics2DServer::ShapeType types[4] = {
- Physics2DServer::SHAPE_CIRCLE,
- Physics2DServer::SHAPE_CAPSULE,
- Physics2DServer::SHAPE_RECTANGLE,
- Physics2DServer::SHAPE_CONVEX_POLYGON,
+ PhysicsServer2D::ShapeType types[4] = {
+ PhysicsServer2D::SHAPE_CIRCLE,
+ PhysicsServer2D::SHAPE_CAPSULE,
+ PhysicsServer2D::SHAPE_RECTANGLE,
+ PhysicsServer2D::SHAPE_CONVEX_POLYGON,
};
- Physics2DServer::ShapeType type = types[i % 4];
- //type=Physics2DServer::SHAPE_SEGMENT;
+ PhysicsServer2D::ShapeType type = types[i % 4];
+ //type=PhysicsServer2D::SHAPE_SEGMENT;
_add_body(type, Transform2D(i * 0.8, Point2(152 + i * 40, 100 - 40 * i)));
/*
if (i==0)
- ps->body_set_mode(b,Physics2DServer::BODY_MODE_STATIC);
+ ps->body_set_mode(b,PhysicsServer2D::BODY_MODE_STATIC);
*/
}
- //RID b= _add_body(Physics2DServer::SHAPE_CIRCLE,Transform2D(0,Point2(101,140)));
- //ps->body_set_mode(b,Physics2DServer::BODY_MODE_STATIC);
+ //RID b= _add_body(PhysicsServer2D::SHAPE_CIRCLE,Transform2D(0,Point2(101,140)));
+ //ps->body_set_mode(b,PhysicsServer2D::BODY_MODE_STATIC);
Point2 prev;
diff --git a/main/tests/test_physics.cpp b/main/tests/test_physics_3d.cpp
index 4931d42674..2d208ee317 100644
--- a/main/tests/test_physics.cpp
+++ b/main/tests/test_physics_3d.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* test_physics.cpp */
+/* test_physics_3d.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "test_physics.h"
+#include "test_physics_3d.h"
#include "core/map.h"
#include "core/math/math_funcs.h"
@@ -36,12 +36,13 @@
#include "core/os/main_loop.h"
#include "core/os/os.h"
#include "core/print_string.h"
-#include "servers/physics_server.h"
-#include "servers/visual_server.h"
+#include "servers/display_server.h"
+#include "servers/physics_server_3d.h"
+#include "servers/rendering_server.h"
-class TestPhysicsMainLoop : public MainLoop {
+class TestPhysics3DMainLoop : public MainLoop {
- GDCLASS(TestPhysicsMainLoop, MainLoop);
+ GDCLASS(TestPhysics3DMainLoop, MainLoop);
enum {
LINK_COUNT = 20,
@@ -64,13 +65,13 @@ class TestPhysicsMainLoop : public MainLoop {
Point2 joy_direction;
List<RID> bodies;
- Map<PhysicsServer::ShapeType, RID> type_shape_map;
- Map<PhysicsServer::ShapeType, RID> type_mesh_map;
+ Map<PhysicsServer3D::ShapeType, RID> type_shape_map;
+ Map<PhysicsServer3D::ShapeType, RID> type_mesh_map;
void body_changed_transform(Object *p_state, RID p_visual_instance) {
- PhysicsDirectBodyState *state = (PhysicsDirectBodyState *)p_state;
- VisualServer *vs = VisualServer::get_singleton();
+ PhysicsDirectBodyState3D *state = (PhysicsDirectBodyState3D *)p_state;
+ RenderingServer *vs = RenderingServer::get_singleton();
Transform t = state->get_transform();
vs->instance_set_transform(p_visual_instance, t);
}
@@ -80,26 +81,26 @@ class TestPhysicsMainLoop : public MainLoop {
protected:
static void _bind_methods() {
- ClassDB::bind_method("body_changed_transform", &TestPhysicsMainLoop::body_changed_transform);
+ ClassDB::bind_method("body_changed_transform", &TestPhysics3DMainLoop::body_changed_transform);
}
- RID create_body(PhysicsServer::ShapeType p_shape, PhysicsServer::BodyMode p_body, const Transform p_location, bool p_active_default = true, const Transform &p_shape_xform = Transform()) {
+ RID create_body(PhysicsServer3D::ShapeType p_shape, PhysicsServer3D::BodyMode p_body, const Transform p_location, bool p_active_default = true, const Transform &p_shape_xform = Transform()) {
- VisualServer *vs = VisualServer::get_singleton();
- PhysicsServer *ps = PhysicsServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
+ PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
RID mesh_instance = vs->instance_create2(type_mesh_map[p_shape], scenario);
RID body = ps->body_create(p_body, !p_active_default);
ps->body_set_space(body, space);
- ps->body_set_param(body, PhysicsServer::BODY_PARAM_BOUNCE, 0.0);
+ ps->body_set_param(body, PhysicsServer3D::BODY_PARAM_BOUNCE, 0.0);
//todo set space
ps->body_add_shape(body, type_shape_map[p_shape]);
ps->body_set_force_integration_callback(body, this, "body_changed_transform", mesh_instance);
- ps->body_set_state(body, PhysicsServer::BODY_STATE_TRANSFORM, p_location);
+ ps->body_set_state(body, PhysicsServer3D::BODY_STATE_TRANSFORM, p_location);
bodies.push_back(body);
- if (p_body == PhysicsServer::BODY_MODE_STATIC) {
+ if (p_body == PhysicsServer3D::BODY_MODE_STATIC) {
vs->instance_set_transform(mesh_instance, p_location);
}
@@ -108,12 +109,12 @@ protected:
RID create_static_plane(const Plane &p_plane) {
- PhysicsServer *ps = PhysicsServer::get_singleton();
+ PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
- RID world_margin_shape = ps->shape_create(PhysicsServer::SHAPE_PLANE);
+ RID world_margin_shape = ps->shape_create(PhysicsServer3D::SHAPE_PLANE);
ps->shape_set_data(world_margin_shape, p_plane);
- RID b = ps->body_create(PhysicsServer::BODY_MODE_STATIC);
+ RID b = ps->body_create(PhysicsServer3D::BODY_MODE_STATIC);
ps->body_set_space(b, space);
//todo set space
ps->body_add_shape(b, world_margin_shape);
@@ -122,24 +123,24 @@ protected:
void configure_body(RID p_body, float p_mass, float p_friction, float p_bounce) {
- PhysicsServer *ps = PhysicsServer::get_singleton();
- ps->body_set_param(p_body, PhysicsServer::BODY_PARAM_MASS, p_mass);
- ps->body_set_param(p_body, PhysicsServer::BODY_PARAM_FRICTION, p_friction);
- ps->body_set_param(p_body, PhysicsServer::BODY_PARAM_BOUNCE, p_bounce);
+ PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
+ ps->body_set_param(p_body, PhysicsServer3D::BODY_PARAM_MASS, p_mass);
+ ps->body_set_param(p_body, PhysicsServer3D::BODY_PARAM_FRICTION, p_friction);
+ ps->body_set_param(p_body, PhysicsServer3D::BODY_PARAM_BOUNCE, p_bounce);
}
void init_shapes() {
- VisualServer *vs = VisualServer::get_singleton();
- PhysicsServer *ps = PhysicsServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
+ PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
/* SPHERE SHAPE */
RID sphere_mesh = vs->make_sphere_mesh(10, 20, 0.5);
- type_mesh_map[PhysicsServer::SHAPE_SPHERE] = sphere_mesh;
+ type_mesh_map[PhysicsServer3D::SHAPE_SPHERE] = sphere_mesh;
- RID sphere_shape = ps->shape_create(PhysicsServer::SHAPE_SPHERE);
+ RID sphere_shape = ps->shape_create(PhysicsServer3D::SHAPE_SPHERE);
ps->shape_set_data(sphere_shape, 0.5);
- type_shape_map[PhysicsServer::SHAPE_SPHERE] = sphere_shape;
+ type_shape_map[PhysicsServer3D::SHAPE_SPHERE] = sphere_shape;
/* BOX SHAPE */
@@ -147,11 +148,11 @@ protected:
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);
- type_mesh_map[PhysicsServer::SHAPE_BOX] = box_mesh;
+ type_mesh_map[PhysicsServer3D::SHAPE_BOX] = box_mesh;
- RID box_shape = ps->shape_create(PhysicsServer::SHAPE_BOX);
+ RID box_shape = ps->shape_create(PhysicsServer3D::SHAPE_BOX);
ps->shape_set_data(box_shape, Vector3(0.5, 0.5, 0.5));
- type_shape_map[PhysicsServer::SHAPE_BOX] = box_shape;
+ type_shape_map[PhysicsServer3D::SHAPE_BOX] = box_shape;
/* CAPSULE SHAPE */
@@ -161,14 +162,14 @@ protected:
Geometry::MeshData capsule_data = Geometry::build_convex_mesh(capsule_planes);
vs->mesh_add_surface_from_mesh_data(capsule_mesh, capsule_data);
- type_mesh_map[PhysicsServer::SHAPE_CAPSULE] = capsule_mesh;
+ type_mesh_map[PhysicsServer3D::SHAPE_CAPSULE] = capsule_mesh;
- RID capsule_shape = ps->shape_create(PhysicsServer::SHAPE_CAPSULE);
+ RID capsule_shape = ps->shape_create(PhysicsServer3D::SHAPE_CAPSULE);
Dictionary capsule_params;
capsule_params["radius"] = 0.5;
capsule_params["height"] = 1.4;
ps->shape_set_data(capsule_shape, capsule_params);
- type_shape_map[PhysicsServer::SHAPE_CAPSULE] = capsule_shape;
+ type_shape_map[PhysicsServer3D::SHAPE_CAPSULE] = capsule_shape;
/* CONVEX SHAPE */
@@ -179,18 +180,18 @@ protected:
QuickHull::build(convex_data.vertices, convex_data);
vs->mesh_add_surface_from_mesh_data(convex_mesh, convex_data);
- type_mesh_map[PhysicsServer::SHAPE_CONVEX_POLYGON] = convex_mesh;
+ type_mesh_map[PhysicsServer3D::SHAPE_CONVEX_POLYGON] = convex_mesh;
- RID convex_shape = ps->shape_create(PhysicsServer::SHAPE_CONVEX_POLYGON);
+ RID convex_shape = ps->shape_create(PhysicsServer3D::SHAPE_CONVEX_POLYGON);
ps->shape_set_data(convex_shape, convex_data.vertices);
- type_shape_map[PhysicsServer::SHAPE_CONVEX_POLYGON] = convex_shape;
+ type_shape_map[PhysicsServer3D::SHAPE_CONVEX_POLYGON] = convex_shape;
}
void make_trimesh(Vector<Vector3> p_faces, const Transform &p_xform = Transform()) {
- VisualServer *vs = VisualServer::get_singleton();
- PhysicsServer *ps = PhysicsServer::get_singleton();
- RID trimesh_shape = ps->shape_create(PhysicsServer::SHAPE_CONCAVE_POLYGON);
+ RenderingServer *vs = RenderingServer::get_singleton();
+ PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
+ RID trimesh_shape = ps->shape_create(PhysicsServer3D::SHAPE_CONCAVE_POLYGON);
ps->shape_set_data(trimesh_shape, p_faces);
p_faces = ps->shape_get_data(trimesh_shape); // optimized one
Vector<Vector3> normals; // for drawing
@@ -204,19 +205,19 @@ protected:
RID trimesh_mesh = vs->mesh_create();
Array d;
- d.resize(VS::ARRAY_MAX);
- d[VS::ARRAY_VERTEX] = p_faces;
- d[VS::ARRAY_NORMAL] = normals;
- vs->mesh_add_surface_from_arrays(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, d);
+ d.resize(RS::ARRAY_MAX);
+ d[RS::ARRAY_VERTEX] = p_faces;
+ d[RS::ARRAY_NORMAL] = normals;
+ vs->mesh_add_surface_from_arrays(trimesh_mesh, RS::PRIMITIVE_TRIANGLES, d);
RID triins = vs->instance_create2(trimesh_mesh, scenario);
- RID tribody = ps->body_create(PhysicsServer::BODY_MODE_STATIC);
+ RID tribody = ps->body_create(PhysicsServer3D::BODY_MODE_STATIC);
ps->body_set_space(tribody, space);
//todo set space
ps->body_add_shape(tribody, trimesh_shape);
Transform tritrans = p_xform;
- ps->body_set_state(tribody, PhysicsServer::BODY_STATE_TRANSFORM, tritrans);
+ ps->body_set_state(tribody, PhysicsServer3D::BODY_STATE_TRANSFORM, tritrans);
vs->instance_set_transform(triins, tritrans);
}
@@ -275,11 +276,11 @@ public:
if (mover.is_valid()) {
- PhysicsServer *ps = PhysicsServer::get_singleton();
- Transform t = ps->body_get_state(mover, PhysicsServer::BODY_STATE_TRANSFORM);
+ PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
+ Transform t = ps->body_get_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM);
t.origin += Vector3(x, y, 0);
- ps->body_set_state(mover, PhysicsServer::BODY_STATE_TRANSFORM, t);
+ ps->body_set_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM, t);
}
}
}
@@ -293,11 +294,11 @@ public:
ofs_x = ofs_y = 0;
init_shapes();
- PhysicsServer *ps = PhysicsServer::get_singleton();
+ PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
space = ps->space_create();
ps->space_set_active(space, true);
- VisualServer *vs = VisualServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
/* LIGHT */
RID lightaux = vs->directional_light_create();
@@ -313,7 +314,7 @@ public:
camera = vs->camera_create();
RID viewport = vs->viewport_create();
- Size2i screen_size = OS::get_singleton()->get_window_size();
+ Size2i screen_size = DisplayServer::get_singleton()->window_get_size();
vs->viewport_set_size(viewport, screen_size.x, screen_size.y);
vs->viewport_attach_to_screen(viewport, Rect2(Vector2(), screen_size));
vs->viewport_set_active(viewport, true);
@@ -334,17 +335,17 @@ public:
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);
+ PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
+ Transform t = ps->body_get_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM);
t.origin += Vector3(joy_speed * joy_direction.x * p_time, -joy_speed * joy_direction.y * p_time, 0);
- ps->body_set_state(mover, PhysicsServer::BODY_STATE_TRANSFORM, t);
+ ps->body_set_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM, t);
};
Transform cameratr;
cameratr.rotate(Vector3(0, 1, 0), ofs_x);
cameratr.rotate(Vector3(1, 0, 0), -ofs_y);
cameratr.translate(Vector3(0, 2, 8));
- VisualServer *vs = VisualServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
vs->camera_set_transform(camera, cameratr);
return quit;
@@ -360,17 +361,17 @@ public:
void test_character() {
- VisualServer *vs = VisualServer::get_singleton();
- PhysicsServer *ps = PhysicsServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
+ PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
Vector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5, 1, 12, 5, Vector3::AXIS_Y);
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);
- type_mesh_map[PhysicsServer::SHAPE_CAPSULE] = capsule_mesh;
+ type_mesh_map[PhysicsServer3D::SHAPE_CAPSULE] = capsule_mesh;
- RID capsule_shape = ps->shape_create(PhysicsServer::SHAPE_CAPSULE);
+ RID capsule_shape = ps->shape_create(PhysicsServer3D::SHAPE_CAPSULE);
Dictionary capsule_params;
capsule_params["radius"] = 0.5;
capsule_params["height"] = 1;
@@ -380,14 +381,14 @@ public:
ps->shape_set_data(capsule_shape, capsule_params);
RID mesh_instance = vs->instance_create2(capsule_mesh, scenario);
- character = ps->body_create(PhysicsServer::BODY_MODE_CHARACTER);
+ character = ps->body_create(PhysicsServer3D::BODY_MODE_CHARACTER);
ps->body_set_space(character, space);
//todo add space
ps->body_add_shape(character, capsule_shape);
ps->body_set_force_integration_callback(character, this, "body_changed_transform", mesh_instance);
- ps->body_set_state(character, PhysicsServer::BODY_STATE_TRANSFORM, Transform(Basis(), Vector3(-2, 5, -2)));
+ ps->body_set_state(character, PhysicsServer3D::BODY_STATE_TRANSFORM, Transform(Basis(), Vector3(-2, 5, -2)));
bodies.push_back(character);
}
@@ -395,21 +396,21 @@ public:
for (int i = 0; i < 35; i++) {
- static const PhysicsServer::ShapeType shape_idx[] = {
- PhysicsServer::SHAPE_CAPSULE,
- PhysicsServer::SHAPE_BOX,
- PhysicsServer::SHAPE_SPHERE,
- PhysicsServer::SHAPE_CONVEX_POLYGON
+ static const PhysicsServer3D::ShapeType shape_idx[] = {
+ PhysicsServer3D::SHAPE_CAPSULE,
+ PhysicsServer3D::SHAPE_BOX,
+ PhysicsServer3D::SHAPE_SPHERE,
+ PhysicsServer3D::SHAPE_CONVEX_POLYGON
};
- PhysicsServer::ShapeType type = shape_idx[i % 4];
+ PhysicsServer3D::ShapeType type = shape_idx[i % 4];
Transform t;
t.origin = Vector3(0.0 * i, 3.5 + 1.1 * i, 0.7 + 0.0 * i);
t.basis.rotate(Vector3(0.2, -1, 0), Math_PI / 2 * 0.6);
- create_body(type, PhysicsServer::BODY_MODE_RIGID, t);
+ create_body(type, PhysicsServer3D::BODY_MODE_RIGID, t);
}
create_static_plane(Plane(Vector3(0, 1, 0), -1));
@@ -417,7 +418,7 @@ public:
void test_activate() {
- create_body(PhysicsServer::SHAPE_BOX, PhysicsServer::BODY_MODE_RIGID, Transform(Basis(), Vector3(0, 2, 0)), true);
+ create_body(PhysicsServer3D::SHAPE_BOX, PhysicsServer3D::BODY_MODE_RIGID, Transform(Basis(), Vector3(0, 2, 0)), true);
create_static_plane(Plane(Vector3(0, 1, 0), -1));
}
@@ -425,14 +426,14 @@ public:
return false;
}
- TestPhysicsMainLoop() {
+ TestPhysics3DMainLoop() {
}
};
-namespace TestPhysics {
+namespace TestPhysics3D {
MainLoop *test() {
- return memnew(TestPhysicsMainLoop);
+ return memnew(TestPhysics3DMainLoop);
}
-} // namespace TestPhysics
+} // namespace TestPhysics3D
diff --git a/main/tests/test_physics.h b/main/tests/test_physics_3d.h
index fbbc59bba9..d03f2c6573 100644
--- a/main/tests/test_physics.h
+++ b/main/tests/test_physics_3d.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* test_physics.h */
+/* test_physics_3d.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -33,7 +33,7 @@
#include "core/os/main_loop.h"
-namespace TestPhysics {
+namespace TestPhysics3D {
MainLoop *test();
}
diff --git a/main/tests/test_render.cpp b/main/tests/test_render.cpp
index 62239a5cb5..bcfcf61e25 100644
--- a/main/tests/test_render.cpp
+++ b/main/tests/test_render.cpp
@@ -36,7 +36,8 @@
#include "core/os/main_loop.h"
#include "core/os/os.h"
#include "core/print_string.h"
-#include "servers/visual_server.h"
+#include "servers/display_server.h"
+#include "servers/rendering_server.h"
#define OBJECT_COUNT 50
@@ -74,7 +75,7 @@ public:
virtual void init() {
print_line("INITIALIZING TEST RENDER");
- VisualServer *vs = VisualServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
test_cube = vs->get_test_cube();
scenario = vs->scenario_create();
@@ -125,7 +126,7 @@ public:
print_line("ERR: " + itos(err));
test_cube = vs->mesh_create();
vs->mesh_add_surface_from_mesh_data(test_cube, md);
- //vs->scenario_set_debug(scenario,VS::SCENARIO_DEBUG_WIREFRAME);
+ //vs->scenario_set_debug(scenario,RS::SCENARIO_DEBUG_WIREFRAME);
/*
RID sm = vs->shader_create();
@@ -163,7 +164,7 @@ public:
// vs->camera_set_perspective( camera, 60.0,0.1, 100.0 );
viewport = vs->viewport_create();
- Size2i screen_size = OS::get_singleton()->get_window_size();
+ Size2i screen_size = DisplayServer::get_singleton()->window_get_size();
vs->viewport_set_size(viewport, screen_size.x, screen_size.y);
vs->viewport_attach_to_screen(viewport, Rect2(Vector2(), screen_size));
vs->viewport_set_active(viewport, true);
@@ -173,16 +174,16 @@ public:
vs->camera_set_perspective(camera, 60, 0.1, 1000);
/*
- 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 );
+ RID lightaux = vs->light_create( RenderingServer::LIGHT_OMNI );
+ vs->light_set_var( lightaux, RenderingServer::LIGHT_VAR_RADIUS, 80 );
+ vs->light_set_var( lightaux, RenderingServer::LIGHT_VAR_ATTENUATION, 1 );
+ vs->light_set_var( lightaux, RenderingServer::LIGHT_VAR_ENERGY, 1.5 );
light = vs->instance_create( lightaux );
*/
RID lightaux;
lightaux = vs->directional_light_create();
- //vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) );
+ //vs->light_set_color( lightaux, RenderingServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.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);
@@ -193,10 +194,10 @@ public:
vs->instance_set_transform(light, lla);
lightaux = vs->omni_light_create();
- //vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,1.0) );
+ //vs->light_set_color( lightaux, RenderingServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,1.0) );
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_param(lightaux, RenderingServer::LIGHT_PARAM_RANGE, 4);
+ vs->light_set_param(lightaux, RenderingServer::LIGHT_PARAM_ENERGY, 8);
//vs->light_set_shadow( lightaux, true );
//light = vs->instance_create( lightaux );
@@ -205,7 +206,7 @@ public:
}
virtual bool iteration(float p_time) {
- VisualServer *vs = VisualServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
//Transform t;
//t.rotate(Vector3(0, 1, 0), ofs);
//t.translate(Vector3(0,0,20 ));
diff --git a/main/tests/test_shader_lang.cpp b/main/tests/test_shader_lang.cpp
index 941a6771bf..dbe2da86cf 100644
--- a/main/tests/test_shader_lang.cpp
+++ b/main/tests/test_shader_lang.cpp
@@ -37,7 +37,7 @@
#include "core/print_string.h"
#include "scene/gui/control.h"
#include "scene/gui/text_edit.h"
-#include "servers/visual/shader_language.h"
+#include "servers/rendering/shader_language.h"
typedef ShaderLanguage SL;
@@ -310,7 +310,7 @@ MainLoop *test() {
if (cmdlargs.empty()) {
//try editor!
print_line("usage: godot -test shader_lang <shader>");
- return NULL;
+ return nullptr;
}
String test = cmdlargs.back()->get();
@@ -318,7 +318,7 @@ MainLoop *test() {
FileAccess *fa = FileAccess::open(test, FileAccess::READ);
if (!fa) {
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
String code;
@@ -342,18 +342,18 @@ MainLoop *test() {
Set<String> types;
types.insert("spatial");
- Error err = sl.compile(code, dt, rm, types);
+ Error err = sl.compile(code, dt, rm, types, NULL);
if (err) {
print_line("Error at line: " + rtos(sl.get_error_line()) + ": " + sl.get_error_text());
- return NULL;
+ return nullptr;
} else {
String code2;
recreate_code(&code2, sl.get_shader());
print_line("code:\n\n" + code2);
}
- return NULL;
+ return nullptr;
}
} // namespace TestShaderLang
diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp
index 84731746fa..7438e2bae9 100644
--- a/main/tests/test_string.cpp
+++ b/main/tests/test_string.cpp
@@ -1071,7 +1071,7 @@ bool test_33() {
OS::get_singleton()->print("\n\nTest 33: parse_utf8(null, -1)\n");
String empty;
- return empty.parse_utf8(NULL, -1);
+ return empty.parse_utf8(nullptr, -1);
}
bool test_34() {
@@ -1164,7 +1164,7 @@ TestFunc test_funcs[] = {
test_33,
test_34,
test_35,
- 0
+ nullptr
};
@@ -1195,6 +1195,6 @@ MainLoop *test() {
OS::get_singleton()->print("Passed %i of %i tests\n", passed, count);
- return NULL;
+ return nullptr;
}
} // namespace TestString