diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-07 18:25:37 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-07 18:26:38 -0300 |
commit | 2ab83e1abbf5ee6d00e16056a9e9394114026f28 (patch) | |
tree | 7efbb375cc4d00d8e8589fcf1b6a1303bec5df2d /bin/tests | |
parent | 2a38a5eaa844043b846e03d6655f84caf8a31e74 (diff) |
Memory pool vectors (DVector) have been enormously simplified in code, and renamed to PoolVector
Diffstat (limited to 'bin/tests')
-rw-r--r-- | bin/tests/test_math.cpp | 33 | ||||
-rw-r--r-- | bin/tests/test_physics.cpp | 8 | ||||
-rw-r--r-- | bin/tests/test_physics_2d.cpp | 10 | ||||
-rw-r--r-- | bin/tests/test_render.cpp | 2 |
4 files changed, 35 insertions, 18 deletions
diff --git a/bin/tests/test_math.cpp b/bin/tests/test_math.cpp index e3e74af14c..b3b70986c9 100644 --- a/bin/tests/test_math.cpp +++ b/bin/tests/test_math.cpp @@ -477,17 +477,34 @@ uint32_t ihash3( uint32_t a) MainLoop* test() { - Matrix3 m; - m.rotate(Vector3(0,1,0),Math_PI*0.5); - print_line(m.scaled(Vector3(0.5,1,1))); - Matrix3 s; - s.scale(Vector3(0.5,1.0,1.0)); + print_line("Dvectors: "+itos(MemoryPool::allocs_used)); + print_line("Mem used: "+itos(MemoryPool::total_memory)); + print_line("MAx mem used: "+itos(MemoryPool::max_memory)); - print_line(m * s); + PoolVector<int> ints; + ints.resize(20); + { + PoolVector<int>::Write w; + w = ints.write(); + for(int i=0;i<ints.size();i++) { + w[i]=i; + } + } + + PoolVector<int> posho = ints; + { + PoolVector<int>::Read r = posho.read(); + for(int i=0;i<posho.size();i++) { + print_line(itos(i)+" : " +itos(r[i])); + } + } + print_line("later Dvectors: "+itos(MemoryPool::allocs_used)); + print_line("later Mem used: "+itos(MemoryPool::total_memory)); + print_line("Mlater Ax mem used: "+itos(MemoryPool::max_memory)); return NULL; @@ -718,8 +735,8 @@ MainLoop* test() { print_line(String("res://..").simplify_path()); - DVector<uint8_t> a; - DVector<uint8_t> b; + PoolVector<uint8_t> a; + PoolVector<uint8_t> b; a.resize(20); b=a; diff --git a/bin/tests/test_physics.cpp b/bin/tests/test_physics.cpp index 8a270f721f..15dc40a4fd 100644 --- a/bin/tests/test_physics.cpp +++ b/bin/tests/test_physics.cpp @@ -146,7 +146,7 @@ protected: /* BOX SHAPE */ - DVector<Plane> box_planes = Geometry::build_box_planes(Vector3(0.5,0.5,0.5)); + PoolVector<Plane> box_planes = Geometry::build_box_planes(Vector3(0.5,0.5,0.5)); 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); @@ -159,7 +159,7 @@ protected: /* CAPSULE SHAPE */ - DVector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5,0.7,12,Vector3::AXIS_Z); + PoolVector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5,0.7,12,Vector3::AXIS_Z); RID capsule_mesh = vs->mesh_create(); Geometry::MeshData capsule_data = Geometry::build_convex_mesh(capsule_planes); @@ -176,7 +176,7 @@ protected: /* CONVEX SHAPE */ - DVector<Plane> convex_planes = Geometry::build_cylinder_planes(0.5,0.7,5,Vector3::AXIS_Z); + PoolVector<Plane> convex_planes = Geometry::build_cylinder_planes(0.5,0.7,5,Vector3::AXIS_Z); RID convex_mesh = vs->mesh_create(); Geometry::MeshData convex_data = Geometry::build_convex_mesh(convex_planes); @@ -534,7 +534,7 @@ public: PhysicsServer * ps = PhysicsServer::get_singleton(); - DVector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5,1,12,5,Vector3::AXIS_Y); + PoolVector<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); diff --git a/bin/tests/test_physics_2d.cpp b/bin/tests/test_physics_2d.cpp index 93d707b26a..39b4e7edda 100644 --- a/bin/tests/test_physics_2d.cpp +++ b/bin/tests/test_physics_2d.cpp @@ -74,7 +74,7 @@ class TestPhysics2DMainLoop : public MainLoop { { - DVector<uint8_t> pixels; + PoolVector<uint8_t> pixels; pixels.resize(32*2*2); for(int i=0;i<2;i++) { @@ -100,7 +100,7 @@ class TestPhysics2DMainLoop : public MainLoop { { - DVector<uint8_t> pixels; + PoolVector<uint8_t> pixels; pixels.resize(32*32*2); for(int i=0;i<32;i++) { @@ -128,7 +128,7 @@ class TestPhysics2DMainLoop : public MainLoop { { - DVector<uint8_t> pixels; + PoolVector<uint8_t> pixels; pixels.resize(32*32*2); for(int i=0;i<32;i++) { @@ -157,7 +157,7 @@ class TestPhysics2DMainLoop : public MainLoop { { - DVector<uint8_t> pixels; + PoolVector<uint8_t> pixels; pixels.resize(32*64*2); for(int i=0;i<64;i++) { @@ -195,7 +195,7 @@ class TestPhysics2DMainLoop : public MainLoop { RID convex_polygon_shape = ps->shape_create(Physics2DServer::SHAPE_CONVEX_POLYGON); - DVector<Vector2> arr; + PoolVector<Vector2> arr; Point2 sb(32,32); arr.push_back(Point2(20,3)-sb); arr.push_back(Point2(58,23)-sb); diff --git a/bin/tests/test_render.cpp b/bin/tests/test_render.cpp index b971d412aa..51e1366073 100644 --- a/bin/tests/test_render.cpp +++ b/bin/tests/test_render.cpp @@ -87,7 +87,7 @@ public: Vector<Vector3> vts; /* - DVector<Plane> sp = Geometry::build_sphere_planes(2,5,5); + PoolVector<Plane> sp = Geometry::build_sphere_planes(2,5,5); Geometry::MeshData md2 = Geometry::build_convex_mesh(sp); vts=md2.vertices; */ |