-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
48eb973
commit c7eb049
Showing
32 changed files
with
1,357 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# 3D Physics Tests | ||
|
||
This demo contains a series of tests for the 3D | ||
physics engine. | ||
|
||
They can be used for different purpose: | ||
- Functional tests to check for regressions and | ||
compare the behavior between physics engines | ||
- Performance tests to evaluate and compare | ||
performance between physics engines | ||
|
||
Language: GDScript | ||
|
||
Renderer: GLES 3 | ||
|
||
## Screenshots | ||
|
||
![Screenshot](screenshots/screenshot.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
extends Node | ||
class_name Test | ||
|
||
var timer : Timer | ||
var timer_started : bool = false | ||
|
||
func start_timer(timeout : float) -> Timer: | ||
if !timer: | ||
timer = Timer.new() | ||
timer.one_shot = true | ||
add_child(timer) | ||
timer.connect("timeout", self, "on_timer_done") | ||
else: | ||
cancel_timer() | ||
|
||
timer.start(timeout) | ||
timer_started = true | ||
|
||
return timer | ||
|
||
func cancel_timer(): | ||
if timer_started: | ||
timer.paused = true | ||
timer.emit_signal("timeout") | ||
timer.paused = false | ||
|
||
func is_timer_canceled() -> bool: | ||
return timer.paused | ||
|
||
func on_timer_done(): | ||
timer_started = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
extends Node | ||
|
||
var tests = [ | ||
{ | ||
"id" : "Functional Tests/Shapes", | ||
"path" : "res://tests/functional/test_shapes.tscn", | ||
}, | ||
{ | ||
"id" : "Functional Tests/Compound Shapes", | ||
"path" : "res://tests/functional/test_compound_shapes.tscn", | ||
}, | ||
{ | ||
"id" : "Functional Tests/Friction", | ||
"path" : "res://tests/functional/test_friction.tscn", | ||
}, | ||
{ | ||
"id" : "Performance Tests/Contacts", | ||
"path" : "res://tests/performance/test_perf_contacts.tscn", | ||
}, | ||
] | ||
|
||
func _ready(): | ||
var test_menu = $Tests_Menu | ||
for test in tests: | ||
test_menu.add_test(test.id, test.path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
extends OptionMenu | ||
|
||
class TestData : | ||
var id : String | ||
var scene_path : String | ||
|
||
var test_list = [] | ||
|
||
var current_test = null | ||
var current_test_scene = null | ||
|
||
func _ready(): | ||
connect("option_selected", self, "on_option_selected") | ||
|
||
func _process(_delta): | ||
if Input.is_action_just_pressed("restart_test"): | ||
if (current_test): | ||
start_test(current_test) | ||
|
||
func add_test(id : String, scene_path : String): | ||
var test_data = TestData.new() | ||
test_data.id = id | ||
test_data.scene_path = scene_path | ||
test_list.append(test_data) | ||
|
||
add_menu_item(id) | ||
|
||
func on_option_selected(item_path : String): | ||
for test in test_list: | ||
if test.id == item_path: | ||
start_test(test) | ||
|
||
func start_test(test : TestData): | ||
current_test = test | ||
|
||
if current_test_scene: | ||
current_test_scene.queue_free() | ||
current_test_scene = null | ||
|
||
Log.print_log("*** STARTING TEST: " + test.id) | ||
var scene = load(test.scene_path) | ||
current_test_scene = scene.instance() | ||
get_tree().root.add_child(current_test_scene) | ||
|
||
var label_test = get_node("../Label_Test") | ||
label_test.test_name = test.id |
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
3d/physics_tests/assets/robot_head/godot3_robot_head_collision.tres
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
- Robot Head model created by James Redmond (fracteed) 2018 | ||
|
||
- http://www.fracteed.com/godot.html | ||
|
||
- created with Godot 3.0.5 | ||
|
||
- models created using Blender 2.79 and Sunstance Painter/Designer | ||
|
||
- Creative Commons License CC-BY: | ||
"This license lets others distribute, remix, tweak, and build upon your work, even commercially, as long as they credit you for the original creation. | ||
This is the most accommodating of licenses offered. Recommended for maximum dissemination and use of licensed materials." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[gd_resource type="Environment" format=2] | ||
|
||
[resource] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="StreamTexture" | ||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://icon.png" | ||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/lossy_quality=0.7 | ||
compress/hdr_mode=0 | ||
compress/bptc_ldr=0 | ||
compress/normal_map=0 | ||
flags/repeat=0 | ||
flags/filter=true | ||
flags/mipmaps=false | ||
flags/anisotropic=false | ||
flags/srgb=2 | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/HDR_as_SRGB=false | ||
process/invert_color=false | ||
stream=false | ||
size_limit=0 | ||
detect_3d=true | ||
svg/scale=1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
[gd_scene load_steps=10 format=2] | ||
|
||
[ext_resource path="res://utils/Label_FPS.gd" type="Script" id=1] | ||
[ext_resource path="res://utils/Label_Version.gd" type="Script" id=2] | ||
[ext_resource path="res://utils/Label_Engine.gd" type="Script" id=3] | ||
[ext_resource path="res://Tests_Menu.gd" type="Script" id=4] | ||
[ext_resource path="res://utils/Label_Test.gd" type="Script" id=5] | ||
[ext_resource path="res://utils/Container_Log.gd" type="Script" id=10] | ||
[ext_resource path="res://utils/Scroll_Log.gd" type="Script" id=11] | ||
[ext_resource path="res://Tests.gd" type="Script" id=12] | ||
|
||
[sub_resource type="StyleBoxFlat" id=1] | ||
bg_color = Color( 0, 0, 0, 0.176471 ) | ||
|
||
[node name="Main" type="Control"] | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
mouse_filter = 2 | ||
script = ExtResource( 12 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="Tests_Menu" type="MenuButton" parent="."] | ||
margin_left = 10.0 | ||
margin_top = 10.0 | ||
margin_right = 125.0 | ||
margin_bottom = 30.0 | ||
text = "TESTS" | ||
flat = false | ||
script = ExtResource( 4 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="Label_Controls" type="Label" parent="."] | ||
margin_left = 157.0 | ||
margin_top = 13.0 | ||
margin_right = 375.0 | ||
margin_bottom = 27.0 | ||
text = "R - RESTART / D - TOGGLE COLLISION / F - TOGGLE FULL SCREEN / ESC - QUIT" | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="Label_FPS" type="Label" parent="."] | ||
anchor_top = 1.0 | ||
anchor_bottom = 1.0 | ||
margin_left = 10.0 | ||
margin_top = -19.0 | ||
margin_right = 50.0 | ||
margin_bottom = -5.0 | ||
text = "FPS: 0" | ||
script = ExtResource( 1 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="Label_Engine" type="Label" parent="."] | ||
anchor_top = 1.0 | ||
anchor_bottom = 1.0 | ||
margin_left = 10.0 | ||
margin_top = -39.0 | ||
margin_right = 50.0 | ||
margin_bottom = -25.0 | ||
text = "Physics engine:" | ||
script = ExtResource( 3 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="Label_Version" type="Label" parent="."] | ||
anchor_top = 1.0 | ||
anchor_bottom = 1.0 | ||
margin_left = 10.0 | ||
margin_top = -59.0 | ||
margin_right = 50.0 | ||
margin_bottom = -45.0 | ||
text = "Godot Version:" | ||
script = ExtResource( 2 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="Label_Test" type="Label" parent="."] | ||
anchor_top = 1.0 | ||
anchor_bottom = 1.0 | ||
margin_left = 10.0 | ||
margin_top = -79.0 | ||
margin_right = 50.0 | ||
margin_bottom = -65.0 | ||
text = "Test:" | ||
script = ExtResource( 5 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="Panel_Log" type="Panel" parent="."] | ||
anchor_left = 1.0 | ||
anchor_top = 1.0 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
margin_left = -428.0 | ||
margin_top = -125.0 | ||
custom_styles/panel = SubResource( 1 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="Button_Clear" type="Button" parent="Panel_Log"] | ||
anchor_left = 1.0 | ||
anchor_top = 1.0 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
margin_left = -48.0 | ||
margin_top = -25.0 | ||
margin_right = -5.0 | ||
margin_bottom = -5.0 | ||
focus_mode = 0 | ||
enabled_focus_mode = 0 | ||
text = "clear" | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="CheckBox_Scroll" type="CheckBox" parent="Panel_Log"] | ||
anchor_left = 1.0 | ||
anchor_top = 1.0 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
margin_left = -150.0 | ||
margin_top = -27.0 | ||
margin_right = -54.0 | ||
margin_bottom = -3.0 | ||
focus_mode = 0 | ||
pressed = true | ||
enabled_focus_mode = 0 | ||
text = "auto-scroll" | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="Scroll_Log" type="ScrollContainer" parent="Panel_Log"] | ||
margin_left = 10.0 | ||
margin_top = 5.0 | ||
margin_right = 418.0 | ||
margin_bottom = 94.0 | ||
scroll_horizontal_enabled = false | ||
script = ExtResource( 11 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
auto_scroll = true | ||
|
||
[node name="VBox_Log" type="VBoxContainer" parent="Panel_Log/Scroll_Log"] | ||
margin_right = 408.0 | ||
margin_bottom = 89.0 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 3 | ||
alignment = 2 | ||
script = ExtResource( 10 ) | ||
|
||
[node name="Label_Log" type="Label" parent="Panel_Log/Scroll_Log/VBox_Log"] | ||
margin_top = 75.0 | ||
margin_right = 408.0 | ||
margin_bottom = 89.0 | ||
text = "Log start" | ||
valign = 2 | ||
max_lines_visible = 5 | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
[connection signal="pressed" from="Panel_Log/Button_Clear" to="Panel_Log/Scroll_Log/VBox_Log" method="clear"] | ||
[connection signal="toggled" from="Panel_Log/CheckBox_Scroll" to="Panel_Log/Scroll_Log" method="set_auto_scroll"] |
Oops, something went wrong.