mirror of
https://github.com/godotengine/godot-tests.git
synced 2025-12-31 13:48:10 +03:00
Merge pull request #29 from fire/remove-old-tests
Proposal to remove benchmarks.
This commit is contained in:
9
benchmarks/CustomLogicParticles/.gitignore
vendored
9
benchmarks/CustomLogicParticles/.gitignore
vendored
@@ -1,9 +0,0 @@
|
||||
# Godot-specific ignores
|
||||
.import/
|
||||
export.cfg
|
||||
.fscache
|
||||
logs/
|
||||
|
||||
# System/tool-specific ignores
|
||||
.directory
|
||||
*~
|
||||
@@ -1,194 +0,0 @@
|
||||
extends Spatial
|
||||
################################### R E A D M E ##################################
|
||||
#
|
||||
# Hints after first rework in 3.0:
|
||||
# Main performance bottleneck is GDScript. I should rewrite those to shader at some point, but maybe it will be enough
|
||||
# to have this code in c# or as gdnative. You can easily test this by emitting 4000 particles with current code, observe
|
||||
# fps drop and then disable logic (but not the rendering!) disableLogic()
|
||||
#
|
||||
|
||||
##################################################################################
|
||||
##### Variables (Constants, Export Variables, Node Vars, Normal variables) #####
|
||||
######################### var myvar setget myvar_set,myvar_get ###################
|
||||
const NMB_OF_PARTICLES = 12000; #max amount. feel fry to increase if the language you are testing is able to reach the limit, but ensure you have similar results with visualisation off
|
||||
const WHITE_COLOR = Color(1,1,1,1);
|
||||
|
||||
export (Mesh) var particleMesh;
|
||||
|
||||
var waitingParticles = PoolIntArray();
|
||||
var activeParticles = PoolIntArray();
|
||||
|
||||
#var particleGlobalPosRoots = Vector3Array();
|
||||
var particlesData = [];
|
||||
|
||||
var multimeshInstance;
|
||||
|
||||
##################################################################################
|
||||
######### Init code #########
|
||||
##################################################################################
|
||||
var firstTimeInReady = true;
|
||||
func _notification(what):
|
||||
if (what == NOTIFICATION_INSTANCED):
|
||||
pass
|
||||
elif(what == NOTIFICATION_READY):
|
||||
if(firstTimeInReady):
|
||||
firstTimeInReady = false;
|
||||
initGlobalParticles();
|
||||
hide();
|
||||
set_process(false);
|
||||
|
||||
func initGlobalParticles():
|
||||
multimeshInstance = get_node("MultiMeshInst");
|
||||
|
||||
var multimeshRes = MultiMesh.new();
|
||||
multimeshRes.transform_format = MultiMesh.TRANSFORM_3D;
|
||||
multimeshRes.color_format = MultiMesh.COLOR_FLOAT;
|
||||
multimeshRes.set_mesh(particleMesh);
|
||||
multimeshRes.set_instance_count(NMB_OF_PARTICLES);
|
||||
|
||||
multimeshInstance.set_multimesh(multimeshRes);
|
||||
initParticlesData();
|
||||
|
||||
func initParticlesData():
|
||||
particlesData.resize(NMB_OF_PARTICLES);
|
||||
for idx in range(NMB_OF_PARTICLES):
|
||||
particlesData[idx] = ParticleData.new();
|
||||
|
||||
var multimesh = multimeshInstance.get_multimesh();
|
||||
var particlesCount = multimesh.get_instance_count();
|
||||
for idxParticle in range(particlesCount):
|
||||
waitingParticles.append(idxParticle);
|
||||
hideParticle(multimesh, idxParticle);
|
||||
|
||||
multimesh.set_instance_color(idxParticle, WHITE_COLOR);
|
||||
|
||||
##################################################################################
|
||||
######### Getters and Setters #########
|
||||
##################################################################################
|
||||
func getAmountOfActiveParticles():
|
||||
return activeParticles.size();
|
||||
|
||||
func isLogicEnabled():
|
||||
return is_processing();
|
||||
|
||||
##################################################################################
|
||||
######### Should be implemented in inheritanced #########
|
||||
##################################################################################
|
||||
|
||||
##################################################################################
|
||||
######### Implemented from ancestor #########
|
||||
##################################################################################
|
||||
func _process(delta):
|
||||
|
||||
#
|
||||
var multimesh = multimeshInstance.get_multimesh();
|
||||
|
||||
#
|
||||
var nmbOfActiveParticles = activeParticles.size();
|
||||
for idxInActiveParticlesList in range(nmbOfActiveParticles): #nmbOfActiveParticles):
|
||||
if(idxInActiveParticlesList>=activeParticles.size()): return;
|
||||
var activeParticleIdx = activeParticles[idxInActiveParticlesList];
|
||||
var particleData = particlesData[activeParticleIdx];
|
||||
particleData.lifeTime += delta;
|
||||
|
||||
#
|
||||
var particlePercentLife = particleData.lifeTime / particleData.maxLifeTime;
|
||||
|
||||
#life time end
|
||||
if(particlePercentLife>1.0):
|
||||
waitingParticles.append(activeParticleIdx);
|
||||
activeParticles.remove(idxInActiveParticlesList);
|
||||
nmbOfActiveParticles = nmbOfActiveParticles-1;
|
||||
hideParticle(multimesh, activeParticleIdx, (nmbOfActiveParticles==0));
|
||||
|
||||
idxInActiveParticlesList = idxInActiveParticlesList-1;
|
||||
continue;
|
||||
|
||||
#
|
||||
var currentLocalBasePos = multimesh.get_instance_transform(activeParticleIdx).origin; #get_global_transform().origin;
|
||||
currentLocalBasePos = currentLocalBasePos + (particleData.direction*delta);
|
||||
|
||||
var lscale;
|
||||
if(particlePercentLife<particleData.matureAtLifePercent): lscale = interpolateLinearBetween2Points(0.0, 0.0,particleData.matureAtLifePercent, particleData.maxScale, particlePercentLife); #ease(particlePercentLife*2.0, -0.5);
|
||||
elif(particlePercentLife<1.0): lscale = interpolateLinearBetween2Points(particleData.matureAtLifePercent, particleData.maxScale,1.0,0.0, particlePercentLife); #ease(1.0-particlePercentLife, -0.5);
|
||||
else: lscale = 0.0;
|
||||
|
||||
particleData.rot_amount += particleData.rot_speed * delta;
|
||||
var trans = Transform(Basis().rotated(particleData.rot_direction, particleData.rot_amount).scaled(Vector3(lscale,lscale,lscale)), currentLocalBasePos);
|
||||
# var rotationBasis = Basis().rotated(Vector3(), particleData.rot_amount).scaled(Vector3(lscale,lscale,lscale));
|
||||
# var trans = Transform();
|
||||
|
||||
multimesh.set_instance_transform(activeParticleIdx, trans);
|
||||
|
||||
#is there any way to actually not render a mesh in multimesh? Know for sure it was not possible in 2.0.
|
||||
#if yes then will need to rewrite this node
|
||||
func hideParticle(inMultimesh, inParticleId, forceTurnOffEmitter = false):
|
||||
var zeroScaleTransform = Transform()
|
||||
zeroScaleTransform = zeroScaleTransform.scaled(Vector3(0,0,0))
|
||||
inMultimesh.set_instance_transform(inParticleId, zeroScaleTransform);
|
||||
if(activeParticles.size()==0) || forceTurnOffEmitter:
|
||||
set_process(false);
|
||||
hide();
|
||||
|
||||
func showParticle(inMultimesh, inParticleId, inPos, inColor):
|
||||
inMultimesh.set_instance_transform(inParticleId, Transform(Basis().scaled(Vector3(0,0,0)), inPos));
|
||||
inMultimesh.set_instance_color(inParticleId, inColor);
|
||||
|
||||
##################################################################################
|
||||
######### Public Methods #########
|
||||
##################################################################################
|
||||
func disableLogic():
|
||||
set_process(false);
|
||||
|
||||
func enableLogic():
|
||||
set_process(true);
|
||||
|
||||
func canEmitNewParticle():
|
||||
return waitingParticles.size()>0;
|
||||
|
||||
func emitParticle(inEmitPos, maxLifetime, maxScale = 1.0, direction = Vector3(0,1,0), rotationDirection = Vector3(0,1,0),
|
||||
rotationSpeed = 0.0, inColor = Color()):
|
||||
if(activeParticles.size() > NMB_OF_PARTICLES): return;
|
||||
if(waitingParticles.size()<=0): return;
|
||||
|
||||
var multimesh = multimeshInstance.get_multimesh();
|
||||
#get first free particle;
|
||||
var freeParticleIdx = waitingParticles.size()-1;
|
||||
var particleID = waitingParticles[freeParticleIdx];
|
||||
waitingParticles.remove(freeParticleIdx);
|
||||
activeParticles.append(particleID);
|
||||
|
||||
var particleData = particlesData[particleID];
|
||||
particleData.maxLifeTime = maxLifetime;
|
||||
particleData.maxScale = maxScale;
|
||||
particleData.direction = direction;
|
||||
particleData.rot_direction = rotationDirection;
|
||||
particleData.rot_speed = rotationSpeed;
|
||||
particleData.lifeTime = 0.0;
|
||||
particleData.rot_amount = randf() * 2 * PI; #0.0;
|
||||
|
||||
showParticle(multimesh, particleID, inEmitPos, inColor);
|
||||
|
||||
##################################################################################
|
||||
######### Inner Methods #########
|
||||
##################################################################################
|
||||
|
||||
|
||||
|
||||
#as far as I know similar method is now part of godot core. But hey! It's a language benchmark after all!
|
||||
static func interpolateLinearBetween2Points( inP1, inP1Val, inP2, inP2Val, interpolationPoint):
|
||||
return ((interpolationPoint * inP1Val) - (interpolationPoint * inP2Val) + (inP1 * inP2Val) - (inP2 * inP1Val))/ (inP1 - inP2);
|
||||
|
||||
|
||||
##################################################################################
|
||||
######### Inner Classes #########A
|
||||
##################################################################################
|
||||
class ParticleData:
|
||||
var lifeTime = 0.0;
|
||||
var maxLifeTime = 0.0;
|
||||
var maxScale = 0.75;
|
||||
var matureAtLifePercent = 0.005;
|
||||
var direction = Vector3();
|
||||
var rot_direction = Vector3();
|
||||
var rot_amount = 0.0
|
||||
var rot_speed = 1.0;
|
||||
@@ -1,31 +0,0 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://CustomParticles/GDScript/MultimeshParticles/MeshGlobalParticles.gd" type="Script" id=1]
|
||||
[ext_resource path="res://CustomParticles/assets/particle.mesh" type="ArrayMesh" id=2]
|
||||
|
||||
[node name="MeshGlobalParticles" type="Spatial"]
|
||||
|
||||
script = ExtResource( 1 )
|
||||
particleMesh = ExtResource( 2 )
|
||||
|
||||
[node name="MultiMeshInst" type="MultiMeshInstance" parent="."]
|
||||
|
||||
layers = 1
|
||||
material_override = null
|
||||
cast_shadow = 0
|
||||
extra_cull_margin = 0.0
|
||||
use_in_baked_light = false
|
||||
lod_min_distance = 0.0
|
||||
lod_min_hysteresis = 0.0
|
||||
lod_max_distance = 0.0
|
||||
lod_max_hysteresis = 0.0
|
||||
multimesh = null
|
||||
|
||||
[node name="Tween" type="Tween" parent="."]
|
||||
|
||||
playback_process_mode = 1
|
||||
playback/active = false
|
||||
playback/repeat = false
|
||||
playback/speed = 1.0
|
||||
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
extends Node
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# This is a language benchmark, not rendering one. Increased amount of particles should not have any
|
||||
# influence on the fps change, since they are rendered even if not visible.
|
||||
# The reason of fps drop is because computations are made for each single particle.
|
||||
# When performance will drop for couple consecutive frames, the logic for particles will be turned off,
|
||||
# so after that amount of fps should be the save as at the very beginning
|
||||
|
||||
|
||||
const SPAWN_EXTENDS = Vector3(10,1,10) * 1.0;
|
||||
const NMB_OF_MEASUREMENTS_BEFORE_TURN_OFF = 10;
|
||||
|
||||
export var visualisation = true;
|
||||
export var turnOffTheLogicBelowFps = 45;
|
||||
export var amount2EmitInOneGameTick = 5;
|
||||
|
||||
onready var particles = get_node("MeshGlobalParticles");
|
||||
|
||||
var delay = 0.0;
|
||||
var nmbOfConsequentLowFpsFrames = 0;
|
||||
|
||||
func _ready():
|
||||
set_process(false);
|
||||
|
||||
func _process(delta):
|
||||
var fps = round(1.0 / delta); #Engine.get_frames_per_second();
|
||||
var text = "fps: " + str(fps) + " | particles: " + str(particles.getAmountOfActiveParticles());
|
||||
get_node("Label").set_text(text);
|
||||
|
||||
if(!particles.isLogicEnabled()):
|
||||
get_node("Label").set_text(text + " | logic turned off below fps: " + str(turnOffTheLogicBelowFps));
|
||||
return
|
||||
|
||||
if(fps < turnOffTheLogicBelowFps):
|
||||
nmbOfConsequentLowFpsFrames+=1;
|
||||
if(nmbOfConsequentLowFpsFrames>NMB_OF_MEASUREMENTS_BEFORE_TURN_OFF):
|
||||
particles.disableLogic();
|
||||
else:
|
||||
nmbOfConsequentLowFpsFrames = 0;
|
||||
for idx in range(amount2EmitInOneGameTick):
|
||||
emit();
|
||||
|
||||
func emit():
|
||||
var randPosition = Vector3(rand_range(-1.0,1.0)*SPAWN_EXTENDS.x, 1.0 + rand_range(-1.0,1.0)*SPAWN_EXTENDS.y,
|
||||
rand_range(-1.0,1.0)*SPAWN_EXTENDS.z);
|
||||
var lifetime = 500.0;
|
||||
var maxScale = 0.1 + randf()*0.2;
|
||||
var direction = Vector3(rand_range(-1.0, 1.0),1.0 + randf(),rand_range(-1.0, 1.0)).normalized() * (0.5 + randf() * 0.3);
|
||||
var rotDirection = Vector3(rand_range(-1.0, 1.0),rand_range(-1.0, 1.0),rand_range(-1.0, 1.0)).normalized();
|
||||
var rotSpeed = randf();
|
||||
var color = Color(0.1+randf()*0.9,0.1+randf()*0.9,0.1+randf()*0.9,1.0);
|
||||
particles.emitParticle(randPosition, lifetime, maxScale, direction, rotDirection, rotSpeed, color);
|
||||
|
||||
|
||||
func _on_InitTimer_timeout():
|
||||
set_process(true);
|
||||
particles.enableLogic();
|
||||
if(visualisation):
|
||||
particles.show();
|
||||
@@ -1,248 +0,0 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://CustomParticles/GDScript/MultimeshParticlesGDScriptTest.gd" type="Script" id=1]
|
||||
[ext_resource path="res://CustomParticles/GDScript/MultimeshParticles/MeshGlobalParticles.tscn" type="PackedScene" id=2]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
|
||||
render_priority = 0
|
||||
flags_transparent = false
|
||||
flags_unshaded = false
|
||||
flags_vertex_lighting = false
|
||||
flags_no_depth_test = false
|
||||
flags_use_point_size = false
|
||||
flags_world_triplanar = false
|
||||
flags_fixed_size = false
|
||||
vertex_color_use_as_albedo = false
|
||||
vertex_color_is_srgb = false
|
||||
params_diffuse_mode = 1
|
||||
params_specular_mode = 0
|
||||
params_blend_mode = 0
|
||||
params_cull_mode = 0
|
||||
params_depth_draw_mode = 0
|
||||
params_line_width = 1.0
|
||||
params_point_size = 1.0
|
||||
params_billboard_mode = 0
|
||||
params_grow = false
|
||||
params_use_alpha_scissor = false
|
||||
albedo_color = Color( 0.244995, 0.871094, 0.342823, 1 )
|
||||
metallic = 0.0
|
||||
metallic_specular = 0.5
|
||||
metallic_texture_channel = 0
|
||||
roughness = 0.0
|
||||
roughness_texture_channel = 0
|
||||
emission_enabled = false
|
||||
normal_enabled = false
|
||||
rim_enabled = false
|
||||
clearcoat_enabled = false
|
||||
anisotropy_enabled = false
|
||||
ao_enabled = false
|
||||
depth_enabled = false
|
||||
subsurf_scatter_enabled = false
|
||||
transmission_enabled = false
|
||||
refraction_enabled = false
|
||||
detail_enabled = false
|
||||
uv1_scale = Vector3( 1, 1, 1 )
|
||||
uv1_offset = Vector3( 0, 0, 0 )
|
||||
uv1_triplanar = false
|
||||
uv1_triplanar_sharpness = 1.0
|
||||
uv2_scale = Vector3( 1, 1, 1 )
|
||||
uv2_offset = Vector3( 0, 0, 0 )
|
||||
uv2_triplanar = false
|
||||
uv2_triplanar_sharpness = 1.0
|
||||
proximity_fade_enable = false
|
||||
proximity_fade_distance = 1.0
|
||||
distance_fade_enable = false
|
||||
_sections_unfolded = [ "Albedo" ]
|
||||
|
||||
[sub_resource type="PlaneMesh" id=2]
|
||||
|
||||
material = SubResource( 1 )
|
||||
size = Vector2( 20, 20 )
|
||||
subdivide_width = 0
|
||||
subdivide_depth = 0
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
|
||||
resource_name = "default"
|
||||
length = 1.0
|
||||
loop = false
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:translation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector3( 0, 10.6541, 13.7136 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:rotation_degrees")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector3( -39.5465, 0, 0 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=4]
|
||||
|
||||
resource_name = "idle"
|
||||
length = 10.0
|
||||
loop = true
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:translation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 2.5, 5, 7.5 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector3( 0, 9.53792, 17.2225 ), Vector3( 16.6245, 8.50416, 10.3837 ), Vector3( 18.2209, 7.4704, -4.59814 ), Vector3( 16.6245, 8.50416, 10.3837 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:rotation_degrees")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 5 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector3( -9.6413, 0, 0 ), Vector3( -4.32044, 104.559, 0 ) ]
|
||||
}
|
||||
|
||||
[node name="MultimeshParticlesGDScriptTest" type="Node"]
|
||||
|
||||
script = ExtResource( 1 )
|
||||
visualisation = true
|
||||
turnOffTheLogicBelowFps = 45
|
||||
amount2EmitInOneGameTick = 3
|
||||
|
||||
[node name="MeshGlobalParticles" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="StaticBody" type="StaticBody" parent="."]
|
||||
|
||||
input_ray_pickable = true
|
||||
input_capture_on_drag = false
|
||||
collision_layer = 1
|
||||
collision_mask = 1
|
||||
friction = 1.0
|
||||
bounce = 0.0
|
||||
constant_linear_velocity = Vector3( 0, 0, 0 )
|
||||
constant_angular_velocity = Vector3( 0, 0, 0 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody"]
|
||||
|
||||
layers = 1
|
||||
material_override = null
|
||||
cast_shadow = 1
|
||||
extra_cull_margin = 0.0
|
||||
use_in_baked_light = false
|
||||
lod_min_distance = 0.0
|
||||
lod_min_hysteresis = 0.0
|
||||
lod_max_distance = 0.0
|
||||
lod_max_hysteresis = 0.0
|
||||
mesh = SubResource( 2 )
|
||||
skeleton = NodePath("..")
|
||||
material/0 = null
|
||||
_sections_unfolded = [ "material" ]
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 233.0
|
||||
margin_bottom = 14.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 4
|
||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||
custom_colors/font_color_shadow = Color( 0, 0, 0, 1 )
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
_sections_unfolded = [ "custom_colors", "custom_fonts", "custom_styles" ]
|
||||
|
||||
[node name="camPos" type="Spatial" parent="."]
|
||||
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.00759, 0 )
|
||||
|
||||
[node name="Camera" type="Camera" parent="camPos"]
|
||||
|
||||
editor/display_folded = true
|
||||
transform = Transform( 0.999334, -0.00604445, 0.0359856, 0, 0.986185, 0.165648, -0.0364897, -0.165538, 0.985529, 0.66498, 9.49656, 16.9489 )
|
||||
projection = 0
|
||||
fov = 72.0
|
||||
near = 0.1
|
||||
far = 100.0
|
||||
keep_aspect = 1
|
||||
current = true
|
||||
cull_mask = 1048575
|
||||
environment = null
|
||||
h_offset = 0.0
|
||||
v_offset = 0.0
|
||||
doppler/tracking = 0
|
||||
_sections_unfolded = [ "Transform" ]
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="camPos/Camera"]
|
||||
|
||||
playback_process_mode = 1
|
||||
playback_default_blend_time = 0.0
|
||||
root_node = NodePath("..")
|
||||
anims/default = SubResource( 3 )
|
||||
anims/idle = SubResource( 4 )
|
||||
playback/active = true
|
||||
playback/speed = 0.2
|
||||
blend_times = [ ]
|
||||
autoplay = "idle"
|
||||
_sections_unfolded = [ "playback" ]
|
||||
|
||||
[node name="DirectionalLight" type="DirectionalLight" parent="."]
|
||||
|
||||
transform = Transform( 0.623013, -0.733525, 0.271654, 0.321394, 0.55667, 0.766044, -0.713134, -0.389948, 0.582563, 23.9795, 0, 0 )
|
||||
layers = 1
|
||||
light_color = Color( 1, 1, 1, 1 )
|
||||
light_energy = 2.0
|
||||
light_negative = false
|
||||
light_specular = 0.5
|
||||
light_cull_mask = -1
|
||||
shadow_enabled = false
|
||||
shadow_color = Color( 0, 0, 0, 1 )
|
||||
shadow_bias = 0.1
|
||||
shadow_contact = 0.0
|
||||
shadow_reverse_cull_face = false
|
||||
editor_only = false
|
||||
directional_shadow_mode = 2
|
||||
directional_shadow_split_1 = 0.1
|
||||
directional_shadow_split_2 = 0.2
|
||||
directional_shadow_split_3 = 0.5
|
||||
directional_shadow_blend_splits = false
|
||||
directional_shadow_normal_bias = 0.8
|
||||
directional_shadow_bias_split_scale = 0.25
|
||||
directional_shadow_depth_range = 0
|
||||
directional_shadow_max_distance = 200.0
|
||||
_sections_unfolded = [ "Directional Shadow", "Light", "Shadow" ]
|
||||
|
||||
[node name="InitTimer" type="Timer" parent="."]
|
||||
|
||||
process_mode = 1
|
||||
wait_time = 0.2
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[connection signal="timeout" from="InitTimer" to="." method="_on_InitTimer_timeout"]
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,109 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
|
||||
<asset>
|
||||
<contributor>
|
||||
<author>Anonymous</author>
|
||||
<authoring_tool>Collada Exporter for Blender 2.6+, by Juan Linietsky (juan@codenix.com)</authoring_tool>
|
||||
</contributor>
|
||||
<created>2017-10-21T17:17:57Z</created>
|
||||
<modified>2017-10-21T17:17:57Z</modified>
|
||||
<unit meter="1.0" name="meter"/>
|
||||
<up_axis>Z_UP</up_axis>
|
||||
</asset>
|
||||
<library_effects>
|
||||
<effect id="id-fx-2" name="Material-fx">
|
||||
<profile_COMMON>
|
||||
<technique sid="common">
|
||||
<blinn>
|
||||
<emission>
|
||||
<color> 0.0 0.0 0.0 1.0 </color>
|
||||
</emission>
|
||||
<ambient>
|
||||
<color> 0.0 0.0 0.0 1.0 </color>
|
||||
</ambient>
|
||||
<diffuse>
|
||||
<color> 0.6400000190734865 0.6400000190734865 0.6400000190734865 1.0 </color>
|
||||
</diffuse>
|
||||
<specular>
|
||||
<color> 0.5 0.5 0.5 1.0 </color>
|
||||
</specular>
|
||||
<shininess>
|
||||
<float>50</float>
|
||||
</shininess>
|
||||
<reflective>
|
||||
<color> 1.0 1.0 1.0 1.0 </color>
|
||||
</reflective>
|
||||
<index_of_refraction>
|
||||
<float>4.0</float>
|
||||
</index_of_refraction>
|
||||
</blinn>
|
||||
<extra>
|
||||
<technique profile="FCOLLADA">
|
||||
</technique>
|
||||
<technique profile="GOOGLEEARTH">
|
||||
<double_sided>0</double_sided>
|
||||
</technique>
|
||||
</extra>
|
||||
</technique>
|
||||
</profile_COMMON>
|
||||
</effect>
|
||||
</library_effects>
|
||||
<library_materials>
|
||||
<material id="id-material-3" name="Material">
|
||||
<instance_effect url="#id-fx-2"/>
|
||||
</material>
|
||||
</library_materials>
|
||||
<library_geometries>
|
||||
<geometry id="id-mesh-4" name="Cube">
|
||||
<mesh>
|
||||
<source id="id-mesh-4-positions">
|
||||
<float_array id="id-mesh-4-positions-array" count="216"> 0.0 -0.19999998807907104 -0.2828426957130432 -0.28284263610839844 0.20000006258487701 -4.470348358154297e-08 0.0 0.19999997317790985 -0.2828426957130432 0.282842755317688 0.1999998837709427 -7.450580596923828e-08 -4.470348358154297e-08 -0.19999991357326508 0.282842755317688 0.28284260630607605 -0.2000001072883606 8.940696716308594e-08 0.282842755317688 0.1999998837709427 -7.450580596923828e-08 0.0 -0.19999998807907104 -0.2828426957130432 0.0 0.19999997317790985 -0.2828426957130432 0.28284260630607605 -0.2000001072883606 8.940696716308594e-08 -0.2828426957130432 -0.19999995827674866 1.4901161193847656e-08 0.0 -0.19999998807907104 -0.2828426957130432 -4.470348358154297e-08 -0.19999991357326508 0.282842755317688 -0.28284263610839844 0.20000006258487701 -4.470348358154297e-08 -0.2828426957130432 -0.19999995827674866 1.4901161193847656e-08 0.0 0.19999997317790985 -0.2828426957130432 1.4901161193847656e-08 0.19999998807907104 0.2828426957130432 0.282842755317688 0.1999998837709427 -7.450580596923828e-08 -0.04142136499285698 -0.34142133593559265 0.04142137989401817 -0.2999999523162842 0.14142130315303802 -0.10000009834766388 -0.10000002384185791 -0.1414213627576828 -0.29999998211860657 0.041421372443437576 0.34142133593559265 -0.04142138734459877 0.2999999225139618 -0.14142130315303802 0.10000016540288925 0.24142137169837952 0.05857850983738899 -0.24142131209373474 0.24142137169837952 0.05857850983738899 -0.24142131209373474 -0.04142136499285698 -0.34142133593559265 0.04142137989401817 -0.10000002384185791 -0.1414213627576828 -0.29999998211860657 0.2999999225139618 -0.14142130315303802 0.10000016540288925 -0.24142134189605713 -0.05857860669493675 0.24142134189605713 -0.04142136499285698 -0.34142133593559265 0.04142137989401817 0.09999997913837433 0.14142142236232758 0.2999999523162842 -0.2999999523162842 0.14142130315303802 -0.10000009834766388 -0.24142134189605713 -0.05857860669493675 0.24142134189605713 -0.10000002384185791 -0.1414213627576828 -0.29999998211860657 0.041421372443437576 0.34142133593559265 -0.04142138734459877 0.24142137169837952 0.05857850983738899 -0.24142131209373474 0.0 -0.19999998807907104 -0.2828426957130432 -0.2828426957130432 -0.19999995827674866 1.4901161193847656e-08 -0.28284263610839844 0.20000006258487701 -4.470348358154297e-08 0.282842755317688 0.1999998837709427 -7.450580596923828e-08 1.4901161193847656e-08 0.19999998807907104 0.2828426957130432 -4.470348358154297e-08 -0.19999991357326508 0.282842755317688 0.282842755317688 0.1999998837709427 -7.450580596923828e-08 0.28284260630607605 -0.2000001072883606 8.940696716308594e-08 0.0 -0.19999998807907104 -0.2828426957130432 0.28284260630607605 -0.2000001072883606 8.940696716308594e-08 -4.470348358154297e-08 -0.19999991357326508 0.282842755317688 -0.2828426957130432 -0.19999995827674866 1.4901161193847656e-08 -4.470348358154297e-08 -0.19999991357326508 0.282842755317688 1.4901161193847656e-08 0.19999998807907104 0.2828426957130432 -0.28284263610839844 0.20000006258487701 -4.470348358154297e-08 0.0 0.19999997317790985 -0.2828426957130432 -0.28284263610839844 0.20000006258487701 -4.470348358154297e-08 1.4901161193847656e-08 0.19999998807907104 0.2828426957130432 -0.04142136499285698 -0.34142133593559265 0.04142137989401817 -0.24142134189605713 -0.05857860669493675 0.24142134189605713 -0.2999999523162842 0.14142130315303802 -0.10000009834766388 0.041421372443437576 0.34142133593559265 -0.04142138734459877 0.09999997913837433 0.14142142236232758 0.2999999523162842 0.2999999225139618 -0.14142130315303802 0.10000016540288925 0.24142137169837952 0.05857850983738899 -0.24142131209373474 0.2999999225139618 -0.14142130315303802 0.10000016540288925 -0.04142136499285698 -0.34142133593559265 0.04142137989401817 0.2999999225139618 -0.14142130315303802 0.10000016540288925 0.09999997913837433 0.14142142236232758 0.2999999523162842 -0.24142134189605713 -0.05857860669493675 0.24142134189605713 0.09999997913837433 0.14142142236232758 0.2999999523162842 0.041421372443437576 0.34142133593559265 -0.04142138734459877 -0.2999999523162842 0.14142130315303802 -0.10000009834766388 -0.10000002384185791 -0.1414213627576828 -0.29999998211860657 -0.2999999523162842 0.14142130315303802 -0.10000009834766388 0.041421372443437576 0.34142133593559265 -0.04142138734459877</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#id-mesh-4-positions-array" count="72" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="id-mesh-4-normals">
|
||||
<float_array id="id-mesh-4-normals-array" count="216"> -0.7071068286895752 0.0 -0.7071067690849304 -0.7071068286895752 0.0 -0.7071067690849304 -0.7071068286895752 0.0 -0.7071067690849304 0.7071068286895752 9.313227877782992e-08 0.7071067690849304 0.7071068286895752 9.313227877782992e-08 0.7071067690849304 0.7071068286895752 9.313227877782992e-08 0.7071067690849304 0.7071066498756409 0.0 -0.7071068286895752 0.7071066498756409 0.0 -0.7071068286895752 0.7071066498756409 0.0 -0.7071068286895752 -2.63417859969195e-07 -1.0 -9.313227167240257e-08 -2.63417859969195e-07 -1.0 -9.313227167240257e-08 -2.63417859969195e-07 -1.0 -9.313227167240257e-08 -0.70710688829422 2.1073421407891146e-07 0.7071065902709961 -0.70710688829422 2.1073421407891146e-07 0.7071065902709961 -0.70710688829422 2.1073421407891146e-07 0.7071065902709961 3.424431156417995e-07 1.0 -4.6566128730773926e-08 3.424431156417995e-07 1.0 -4.6566128730773926e-08 3.424431156417995e-07 1.0 -4.6566128730773926e-08 -0.8535534143447876 -0.4999999403953552 -0.14644654095172882 -0.8535534143447876 -0.4999999403953552 -0.14644654095172882 -0.8535534143447876 -0.4999999403953552 -0.14644654095172882 0.8535534143447876 0.5 0.14644654095172882 0.8535534143447876 0.5 0.14644654095172882 0.8535534143447876 0.5 0.14644654095172882 0.4999997913837433 -0.7071070075035095 -0.4999999701976776 0.4999997913837433 -0.7071070075035095 -0.4999999701976776 0.4999997913837433 -0.7071070075035095 -0.4999999701976776 0.1464463770389557 -0.5000001192092896 0.8535534143447876 0.1464463770389557 -0.5000001192092896 0.8535534143447876 0.1464463770389557 -0.5000001192092896 0.8535534143447876 -0.5000001192092896 0.7071068286895752 0.4999997019767761 -0.5000001192092896 0.7071068286895752 0.4999997019767761 -0.5000001192092896 0.7071068286895752 0.4999997019767761 -0.14644622802734375 0.49999991059303284 -0.8535535335540771 -0.14644622802734375 0.49999991059303284 -0.8535535335540771 -0.14644622802734375 0.49999991059303284 -0.8535535335540771 -0.7071068286895752 2.2096436680385523e-08 -0.7071068286895752 -0.7071068286895752 2.2096436680385523e-08 -0.7071068286895752 -0.7071068286895752 2.2096436680385523e-08 -0.7071068286895752 0.70710688829422 1.110223194031746e-14 0.7071067690849304 0.70710688829422 1.110223194031746e-14 0.7071067690849304 0.70710688829422 1.110223194031746e-14 0.7071067690849304 0.7071070075035095 -5.587936584561248e-07 -0.7071065902709961 0.7071070075035095 -5.587936584561248e-07 -0.7071065902709961 0.7071070075035095 -5.587936584561248e-07 -0.7071065902709961 -2.6341791681261384e-07 -1.0 4.190952438420936e-07 -2.6341791681261384e-07 -1.0 4.190952438420936e-07 -2.6341791681261384e-07 -1.0 4.190952438420936e-07 -0.7071069478988647 1.8626457176651456e-07 0.7071065902709961 -0.7071069478988647 1.8626457176651456e-07 0.7071065902709961 -0.7071069478988647 1.8626457176651456e-07 0.7071065902709961 2.89759668703482e-07 1.0 4.656614294162864e-08 2.89759668703482e-07 1.0 4.656614294162864e-08 2.89759668703482e-07 1.0 4.656614294162864e-08 -0.8535534143447876 -0.4999999403953552 -0.14644649624824524 -0.8535534143447876 -0.4999999403953552 -0.14644649624824524 -0.8535534143447876 -0.4999999403953552 -0.14644649624824524 0.8535534143447876 0.4999999701976776 0.14644655585289001 0.8535534143447876 0.4999999701976776 0.14644655585289001 0.8535534143447876 0.4999999701976776 0.14644655585289001 0.5000003576278687 -0.7071070075035095 -0.49999934434890747 0.5000003576278687 -0.7071070075035095 -0.49999934434890747 0.5000003576278687 -0.7071070075035095 -0.49999934434890747 0.14644651114940643 -0.4999995827674866 0.8535535931587219 0.14644651114940643 -0.4999995827674866 0.8535535931587219 0.14644651114940643 -0.4999995827674866 0.8535535931587219 -0.5000001788139343 0.7071067690849304 0.4999998211860657 -0.5000001788139343 0.7071067690849304 0.4999998211860657 -0.5000001788139343 0.7071067690849304 0.4999998211860657 -0.14644639194011688 0.49999991059303284 -0.8535534143447876 -0.14644639194011688 0.49999991059303284 -0.8535534143447876 -0.14644639194011688 0.49999991059303284 -0.8535534143447876</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#id-mesh-4-normals-array" count="72" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<vertices id="id-mesh-4-vertices">
|
||||
<input semantic="POSITION" source="#id-mesh-4-positions"/>
|
||||
</vertices>
|
||||
<triangles count="24" material="id-trimat-5">
|
||||
<input semantic="VERTEX" source="#id-mesh-4-vertices" offset="0"/>
|
||||
<input semantic="NORMAL" source="#id-mesh-4-normals" offset="0"/>
|
||||
<p> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 </p>
|
||||
</triangles>
|
||||
</mesh>
|
||||
</geometry>
|
||||
</library_geometries>
|
||||
<library_visual_scenes>
|
||||
<visual_scene id="id-scene-1" name="scene">
|
||||
<node id="Cube" name="Cube" type="NODE">
|
||||
<matrix sid="transform"> 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 </matrix>
|
||||
<instance_geometry url="#id-mesh-4">
|
||||
<bind_material>
|
||||
<technique_common>
|
||||
<instance_material symbol="id-trimat-5" target="#id-material-3"/>
|
||||
</technique_common>
|
||||
</bind_material>
|
||||
</instance_geometry>
|
||||
</node>
|
||||
</visual_scene>
|
||||
</library_visual_scenes>
|
||||
<library_animations>
|
||||
</library_animations>
|
||||
<scene>
|
||||
<instance_visual_scene url="#id-scene-1" />
|
||||
</scene>
|
||||
</COLLADA>
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1 +0,0 @@
|
||||
CustomParticlesBenchmark
|
||||
@@ -1,99 +0,0 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
radiance_size = 4
|
||||
sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 )
|
||||
sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 )
|
||||
sky_curve = 0.25
|
||||
sky_energy = 1.0
|
||||
ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 )
|
||||
ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 )
|
||||
ground_curve = 0.01
|
||||
ground_energy = 1.0
|
||||
sun_color = Color( 1, 1, 1, 1 )
|
||||
sun_latitude = 35.0
|
||||
sun_longitude = 0.0
|
||||
sun_angle_min = 1.0
|
||||
sun_angle_max = 100.0
|
||||
sun_curve = 0.05
|
||||
sun_energy = 16.0
|
||||
texture_size = 2
|
||||
|
||||
[resource]
|
||||
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
background_sky_custom_fov = 0.0
|
||||
background_color = Color( 0, 0, 0, 1 )
|
||||
background_energy = 1.0
|
||||
background_canvas_max_layer = 0
|
||||
ambient_light_color = Color( 0, 0, 0, 1 )
|
||||
ambient_light_energy = 1.0
|
||||
ambient_light_sky_contribution = 1.0
|
||||
fog_enabled = false
|
||||
fog_color = Color( 0.5, 0.6, 0.7, 1 )
|
||||
fog_sun_color = Color( 1, 0.9, 0.7, 1 )
|
||||
fog_sun_amount = 0.0
|
||||
fog_depth_enabled = true
|
||||
fog_depth_begin = 10.0
|
||||
fog_depth_curve = 1.0
|
||||
fog_transmit_enabled = false
|
||||
fog_transmit_curve = 1.0
|
||||
fog_height_enabled = false
|
||||
fog_height_min = 0.0
|
||||
fog_height_max = 100.0
|
||||
fog_height_curve = 1.0
|
||||
tonemap_mode = 0
|
||||
tonemap_exposure = 1.0
|
||||
tonemap_white = 1.0
|
||||
auto_exposure_enabled = false
|
||||
auto_exposure_scale = 0.4
|
||||
auto_exposure_min_luma = 0.05
|
||||
auto_exposure_max_luma = 8.0
|
||||
auto_exposure_speed = 0.5
|
||||
ss_reflections_enabled = false
|
||||
ss_reflections_max_steps = 64
|
||||
ss_reflections_fade_in = 0.15
|
||||
ss_reflections_fade_out = 2.0
|
||||
ss_reflections_depth_tolerance = 0.2
|
||||
ss_reflections_roughness = true
|
||||
ssao_enabled = false
|
||||
ssao_radius = 1.0
|
||||
ssao_intensity = 1.0
|
||||
ssao_radius2 = 0.0
|
||||
ssao_intensity2 = 1.0
|
||||
ssao_bias = 0.01
|
||||
ssao_light_affect = 0.0
|
||||
ssao_color = Color( 0, 0, 0, 1 )
|
||||
ssao_blur = true
|
||||
dof_blur_far_enabled = false
|
||||
dof_blur_far_distance = 10.0
|
||||
dof_blur_far_transition = 5.0
|
||||
dof_blur_far_amount = 0.1
|
||||
dof_blur_far_quality = 1
|
||||
dof_blur_near_enabled = false
|
||||
dof_blur_near_distance = 2.0
|
||||
dof_blur_near_transition = 1.0
|
||||
dof_blur_near_amount = 0.1
|
||||
dof_blur_near_quality = 1
|
||||
glow_enabled = false
|
||||
glow_levels/1 = false
|
||||
glow_levels/2 = false
|
||||
glow_levels/3 = true
|
||||
glow_levels/4 = false
|
||||
glow_levels/5 = true
|
||||
glow_levels/6 = false
|
||||
glow_levels/7 = false
|
||||
glow_intensity = 0.8
|
||||
glow_strength = 1.0
|
||||
glow_bloom = 0.0
|
||||
glow_blend_mode = 2
|
||||
glow_hdr_threshold = 1.0
|
||||
glow_hdr_scale = 2.0
|
||||
glow_bicubic_upscale = false
|
||||
adjustment_enabled = false
|
||||
adjustment_brightness = 1.0
|
||||
adjustment_contrast = 1.0
|
||||
adjustment_saturation = 1.0
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.4 KiB |
@@ -1,24 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
@@ -1,23 +0,0 @@
|
||||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=3
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Multimesh particles custom logic benchmark"
|
||||
run/main_scene="res://CustomParticles/GDScript/MultimeshParticlesGDScriptTest.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[gdnative]
|
||||
|
||||
singletons=[ ]
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_environment="res://default_env.tres"
|
||||
@@ -1,2 +0,0 @@
|
||||
Add Godot benchmarks here, each benchmark test suite in a single dir, with a configuration file of it's own.
|
||||
We can later to scripts to run one or many benchmarks.
|
||||
@@ -1,350 +0,0 @@
|
||||
# This script prints how much time GDScript takes to performs specific instructions.
|
||||
|
||||
# Times values are in arbitrary units but share the same scale,
|
||||
# so for example if test A prints 100 and test B prints 200,
|
||||
# we can say that test A is 2x faster than test B.
|
||||
|
||||
# All tests run a very long loop containing the code to profile,
|
||||
# in order to obtain a reasonable time information.
|
||||
# The cost of the loop itself is then subtracted to all tests.
|
||||
# Iteration count is the same for all tests.
|
||||
# There shouldn't be race conditions between loops.
|
||||
|
||||
# Results will be approximate and vary between executions and CPU speed,
|
||||
# but the error margin should be low enough to make conclusions on most tests.
|
||||
# If not, please set the ITERATIONS constant to higher values to reduce the margin.
|
||||
|
||||
|
||||
# TODO Output results in a JSON file so we can reload and compare them afterwards
|
||||
# TODO Add tests for complete algorithms such as primes, fibonacci etc
|
||||
# TODO Add tests on strings
|
||||
|
||||
tool
|
||||
extends SceneTree
|
||||
|
||||
# How many times test loops are ran. Higher is slower, but gives better average.
|
||||
const ITERATIONS = 500000
|
||||
|
||||
# Per case:
|
||||
# True: print time for 1 loop
|
||||
# False: print time for all loops
|
||||
const PRINT_PER_TEST_TIME = false
|
||||
|
||||
var _time_before = 0
|
||||
var _for_time = 0
|
||||
var _test_name = ""
|
||||
var _test_results = []
|
||||
|
||||
# ---------
|
||||
# Members used by tests
|
||||
var _test_a = 1
|
||||
# ---------
|
||||
|
||||
|
||||
func _init():
|
||||
_ready()
|
||||
quit()
|
||||
|
||||
|
||||
func _ready():
|
||||
print("-------------------")
|
||||
|
||||
_time_before = OS.get_ticks_msec()
|
||||
|
||||
start()
|
||||
|
||||
for i in range(0,ITERATIONS):
|
||||
pass
|
||||
|
||||
_for_time = stop()
|
||||
print("For time: " + str(_for_time))
|
||||
|
||||
print("")
|
||||
if PRINT_PER_TEST_TIME:
|
||||
print("The following times are in microseconds taken for 1 test.")
|
||||
else:
|
||||
print("The following times are in seconds for the whole test.")
|
||||
print("")
|
||||
|
||||
#-------------------------------------------------------
|
||||
test_empty_func()
|
||||
test_increment()
|
||||
test_increment_x5()
|
||||
test_increment_with_member_var()
|
||||
test_increment_with_local_outside_loop()
|
||||
test_increment_with_local_inside_loop()
|
||||
test_increment_vector2()
|
||||
test_increment_vector3()
|
||||
test_increment_vector3_constant()
|
||||
test_increment_vector3_individual_xyz()
|
||||
test_unused_local()
|
||||
test_divide()
|
||||
test_increment_with_dictionary_member()
|
||||
test_increment_with_array_member()
|
||||
test_while_time()
|
||||
test_if_true()
|
||||
test_if_true_else()
|
||||
test_variant_array_resize()
|
||||
test_variant_array_assign()
|
||||
test_int_array_resize()
|
||||
test_int_array_assign()
|
||||
|
||||
print("-------------------")
|
||||
print("Done.")
|
||||
|
||||
|
||||
func start(name=""):
|
||||
_test_name = name
|
||||
_time_before = OS.get_ticks_msec()
|
||||
|
||||
|
||||
func stop():
|
||||
var time = OS.get_ticks_msec() - _time_before
|
||||
if _test_name.length() != 0:
|
||||
var test_time = time - _for_time
|
||||
|
||||
if PRINT_PER_TEST_TIME:
|
||||
# Time taken for 1 test
|
||||
var k = 1000000.0 / ITERATIONS
|
||||
test_time = k * test_time
|
||||
|
||||
print(_test_name + ": " + str(test_time))# + " (with for: " + str(time) + ")")
|
||||
_test_results.append({
|
||||
name = _test_name,
|
||||
time = test_time
|
||||
})
|
||||
return time
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_empty_func():
|
||||
start("Empty func (void function call cost)")
|
||||
|
||||
for i in range(0,ITERATIONS):
|
||||
empty_func()
|
||||
|
||||
stop()
|
||||
|
||||
func empty_func():
|
||||
pass
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_increment():
|
||||
var a = 0
|
||||
|
||||
start("Increment")
|
||||
|
||||
for i in range(0,ITERATIONS):
|
||||
a += 1
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_increment_x5():
|
||||
var a = 0
|
||||
|
||||
start("Increment x5")
|
||||
|
||||
for i in range(0,ITERATIONS):
|
||||
a += 1
|
||||
a += 1
|
||||
a += 1
|
||||
a += 1
|
||||
a += 1
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_increment_with_member_var():
|
||||
var a = 0
|
||||
|
||||
start("Increment with member var")
|
||||
|
||||
for i in range(0,ITERATIONS):
|
||||
a += _test_a
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_increment_with_local_outside_loop():
|
||||
var a = 0
|
||||
var b = 1
|
||||
|
||||
start("Increment with local (outside loop)")
|
||||
|
||||
for i in range(0,ITERATIONS):
|
||||
a += b
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_increment_with_local_inside_loop():
|
||||
var a = 0
|
||||
|
||||
start("Increment with local (inside loop)")
|
||||
|
||||
for i in range(0,ITERATIONS):
|
||||
var b = 1
|
||||
a += b
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_increment_vector2():
|
||||
var a = Vector2(0,0)
|
||||
var b = Vector2(1,1)
|
||||
|
||||
start("Increment Vector2")
|
||||
|
||||
for i in range(0, ITERATIONS):
|
||||
a += b
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_increment_vector3():
|
||||
var a = Vector3(0,0,0)
|
||||
var b = Vector3(1,1,1)
|
||||
|
||||
start("Increment Vector3")
|
||||
|
||||
for i in range(0, ITERATIONS):
|
||||
a += b
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_increment_vector3_constant():
|
||||
var a = Vector3(0,0,0)
|
||||
|
||||
start("Increment Vector3 with constant")
|
||||
|
||||
for i in range(0, ITERATIONS):
|
||||
a += Vector3(1,1,1)
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_increment_vector3_individual_xyz():
|
||||
var a = Vector3(0,0,0)
|
||||
var b = Vector3(1,1,1)
|
||||
|
||||
start("Increment Vector3 coordinate by coordinate")
|
||||
|
||||
for i in range(0, ITERATIONS):
|
||||
a.x += b.x
|
||||
a.y += b.y
|
||||
a.z += b.z
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_unused_local():
|
||||
start("Unused local (declaration cost)")
|
||||
|
||||
for i in range(0,ITERATIONS):
|
||||
var b = 1
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_divide():
|
||||
start("Divide")
|
||||
|
||||
var a = 9999
|
||||
for i in range(0,ITERATIONS):
|
||||
a /= 1.01
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_increment_with_dictionary_member():
|
||||
start("Increment with dictionary member")
|
||||
|
||||
var a = 0
|
||||
var dic = {b = 1}
|
||||
for i in range(0,ITERATIONS):
|
||||
a += dic.b
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_increment_with_array_member():
|
||||
start("Increment with array member")
|
||||
|
||||
var a = 0
|
||||
var arr = [1]
|
||||
for i in range(0,ITERATIONS):
|
||||
a += arr[0]
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_while_time():
|
||||
start("While time")
|
||||
|
||||
var i = 0
|
||||
while i < ITERATIONS:
|
||||
i += 1
|
||||
|
||||
print("While time (for equivalent with manual increment): " + str(OS.get_ticks_msec() - _time_before))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_if_true():
|
||||
start("if(true) time")
|
||||
for i in range(0,ITERATIONS):
|
||||
if true:
|
||||
pass
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_if_true_else():
|
||||
start("if(true)else time")
|
||||
for i in range(0,ITERATIONS):
|
||||
if true:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
func test_variant_array_resize():
|
||||
start("VariantArray resize")
|
||||
for i in range(0,ITERATIONS):
|
||||
var line = []
|
||||
line.resize(1000)
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------
|
||||
func test_variant_array_assign():
|
||||
var v_array = []
|
||||
v_array.resize(100)
|
||||
|
||||
start("VariantArray set element")
|
||||
for i in range(0, ITERATIONS):
|
||||
v_array[42] = 0
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------
|
||||
func test_int_array_resize():
|
||||
start("PoolIntArray resize")
|
||||
for i in range(0,ITERATIONS):
|
||||
var line = PoolIntArray()
|
||||
line.resize(1000)
|
||||
|
||||
stop()
|
||||
|
||||
#-------------------------------------------------------
|
||||
func test_int_array_assign():
|
||||
var i_array = PoolIntArray()
|
||||
i_array.resize(100)
|
||||
|
||||
start("PoolIntArray set element")
|
||||
for i in range(0, ITERATIONS):
|
||||
i_array[42] = 0
|
||||
|
||||
stop()
|
||||
Reference in New Issue
Block a user