Browse Source

Merge pull request #706 from voylin/Fix_Scene_Instancing_Demo_4.0-dev

Tested and fixed Scene Instancing Demo for 4.0-dev
Aaron Franke 3 years ago
parent
commit
e5ceb2d8a5

+ 1 - 1
2d/instancing/README.md

@@ -5,7 +5,7 @@ make many duplicates of the same object.
 
 Language: GDScript
 
-Renderer: GLES 2
+Renderer: Vulkan Mobile
 
 Check out this demo on the asset library: https://godotengine.org/asset-library/asset/148
 

+ 13 - 15
2d/instancing/bowling_ball.png.import

@@ -1,8 +1,9 @@
 [remap]
 
 importer="texture"
-type="StreamTexture2D"
-path="res://.godot/imported/bowling_ball.png-0fe48f78a8537b41cee7fd03e5ee14fe.stex"
+type="CompressedTexture2D"
+uid="uid://cyqshsjd3qwo0"
+path="res://.godot/imported/bowling_ball.png-0fe48f78a8537b41cee7fd03e5ee14fe.ctex"
 metadata={
 "vram_texture": false
 }
@@ -10,26 +11,23 @@ metadata={
 [deps]
 
 source_file="res://bowling_ball.png"
-dest_files=["res://.godot/imported/bowling_ball.png-0fe48f78a8537b41cee7fd03e5ee14fe.stex"]
+dest_files=["res://.godot/imported/bowling_ball.png-0fe48f78a8537b41cee7fd03e5ee14fe.ctex"]
 
 [params]
 
 compress/mode=0
 compress/lossy_quality=0.7
-compress/hdr_mode=0
+compress/hdr_compression=1
 compress/bptc_ldr=0
 compress/normal_map=0
-flags/repeat=0
-flags/filter=true
-flags/mipmaps=false
-flags/anisotropic=false
-flags/srgb=2
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
 process/fix_alpha_border=true
 process/premult_alpha=false
-process/HDR_as_SRGB=false
-process/invert_color=false
 process/normal_map_invert_y=false
-stream=false
-size_limit=0
-detect_3d=true
-svg/scale=1.0
+process/hdr_as_srgb=false
+process/size_limit=0
+detect_3d/compress_to=1

+ 13 - 15
2d/instancing/icon.png.import

@@ -1,8 +1,9 @@
 [remap]
 
 importer="texture"
-type="StreamTexture2D"
-path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
+type="CompressedTexture2D"
+uid="uid://brbriwsl8w3bw"
+path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
 metadata={
 "vram_texture": false
 }
@@ -10,26 +11,23 @@ metadata={
 [deps]
 
 source_file="res://icon.png"
-dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"]
+dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
 
 [params]
 
 compress/mode=0
 compress/lossy_quality=0.7
-compress/hdr_mode=0
+compress/hdr_compression=1
 compress/bptc_ldr=0
 compress/normal_map=0
-flags/repeat=0
-flags/filter=true
-flags/mipmaps=false
-flags/anisotropic=false
-flags/srgb=2
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
 process/fix_alpha_border=true
 process/premult_alpha=false
-process/HDR_as_SRGB=false
-process/invert_color=false
 process/normal_map_invert_y=false
-stream=false
-size_limit=0
-detect_3d=true
-svg/scale=1.0
+process/hdr_as_srgb=false
+process/size_limit=0
+detect_3d/compress_to=1

+ 5 - 12
2d/instancing/project.godot

@@ -6,7 +6,7 @@
 ;   [section] ; section goes between []
 ;   param=value ; assign values to parameters
 
-config_version=4
+config_version=5
 
 [application]
 
@@ -15,25 +15,18 @@ config/description="A demo showing how to use scene instancing to
 make many duplicates of the same object."
 run/main_scene="res://scene_instancing.tscn"
 config/icon="res://icon.png"
+config/features=PackedStringArray("4.0")
 
 [display]
 
-window/size/width=800
-window/dpi/allow_hidpi=true
-window/stretch/mode="2d"
+window/size/viewport_width=800
+window/stretch/mode="canvas_items"
 window/stretch/aspect="expand"
 
-[gdnative]
-
-singletons=[]
-
 [physics]
 
 2d/default_gravity=300
 
 [rendering]
 
-quality/driver/driver_name="GLES2"
-vram_compression/import_etc=true
-vram_compression/import_etc2=false
-environment/default_clear_color=Color(0.301961, 0.301961, 0.301961, 1)
+vulkan/rendering/back_end=1

+ 40 - 34
2d/instancing/scene_instancing.tscn

@@ -1,42 +1,48 @@
-[gd_scene load_steps=13 format=2]
+[gd_scene load_steps=13 format=3 uid="uid://rcsr8t4nw526"]
 
-[ext_resource path="res://ball_factory.gd" type="Script" id=1]
-[ext_resource path="res://ball.tscn" type="PackedScene" id=2]
+[ext_resource type="Script" path="res://ball_factory.gd" id="1"]
+[ext_resource type="PackedScene" path="res://ball.tscn" id="2"]
 
-[sub_resource type="PhysicsMaterial" id=1]
+[sub_resource type="PhysicsMaterial" id="1"]
 bounce = 0.4
 
-[sub_resource type="PhysicsMaterial" id=2]
+[sub_resource type="PhysicsMaterial" id="2"]
 bounce = 0.4
 
-[sub_resource type="PhysicsMaterial" id=3]
+[sub_resource type="PhysicsMaterial" id="3"]
 bounce = 0.4
 
-[sub_resource type="PhysicsMaterial" id=4]
+[sub_resource type="PhysicsMaterial" id="4"]
 bounce = 0.4
 
-[sub_resource type="PhysicsMaterial" id=5]
+[sub_resource type="PhysicsMaterial" id="5"]
 bounce = 0.4
 
-[sub_resource type="PhysicsMaterial" id=6]
+[sub_resource type="PhysicsMaterial" id="6"]
 bounce = 0.4
 
-[sub_resource type="PhysicsMaterial" id=7]
+[sub_resource type="PhysicsMaterial" id="7"]
 bounce = 0.4
 
-[sub_resource type="PhysicsMaterial" id=8]
+[sub_resource type="PhysicsMaterial" id="8"]
 bounce = 0.4
 
-[sub_resource type="PhysicsMaterial" id=9]
+[sub_resource type="PhysicsMaterial" id="9"]
 bounce = 0.4
 
-[sub_resource type="PhysicsMaterial" id=10]
+[sub_resource type="PhysicsMaterial" id="10"]
 bounce = 0.4
 
 [node name="SceneInstancing" type="Node2D"]
 
+[node name="InfoLabel" type="Label" parent="."]
+offset_right = 354.0
+offset_bottom = 26.0
+text = "Click the mouse to spawn a new Ball instance."
+horizontal_alignment = 1
+
 [node name="BallFactory" type="Node2D" parent="."]
-script = ExtResource( 1 )
+script = ExtResource( "1" )
 
 [node name="Static" type="StaticBody2D" parent="."]
 
@@ -47,45 +53,45 @@ polygon = PackedVector2Array(8.68994, 22.1976, 50.4445, 556.656, 292.621, 501.54
 color = Color(1, 0.266667, 0.419608, 1)
 polygon = PackedVector2Array(8.68994, 22.1976, 50.4445, 556.656, 292.621, 501.54, 335.36, 550.855, 510.039, 563.135, 542.137, 526.368, 567.463, 515.822, 612.463, 506.822, 667.291, 495.079, 747.553, 553.575, 793.806, 6.70509, 802.465, 601.097, 4.43558, 596.186)
 
-[node name="Ball1" parent="." instance=ExtResource( 2 )]
+[node name="Ball1" parent="." instance=ExtResource( "2" )]
 position = Vector2(223.823, 161.773)
-physics_material_override = SubResource( 1 )
+physics_material_override = SubResource( "1" )
 
-[node name="Ball2" parent="." instance=ExtResource( 2 )]
+[node name="Ball2" parent="." instance=ExtResource( "2" )]
 position = Vector2(388.078, 213.215)
-physics_material_override = SubResource( 2 )
+physics_material_override = SubResource( "2" )
 
-[node name="Ball3" parent="." instance=ExtResource( 2 )]
+[node name="Ball3" parent="." instance=ExtResource( "2" )]
 position = Vector2(439.52, 104.013)
-physics_material_override = SubResource( 3 )
+physics_material_override = SubResource( "3" )
 
-[node name="Ball4" parent="." instance=ExtResource( 2 )]
+[node name="Ball4" parent="." instance=ExtResource( "2" )]
 position = Vector2(235.555, 336.858)
-physics_material_override = SubResource( 4 )
+physics_material_override = SubResource( "4" )
 
-[node name="Ball5" parent="." instance=ExtResource( 2 )]
+[node name="Ball5" parent="." instance=ExtResource( "2" )]
 position = Vector2(509.555, 362.858)
-physics_material_override = SubResource( 5 )
+physics_material_override = SubResource( "5" )
 
-[node name="Ball6" parent="." instance=ExtResource( 2 )]
+[node name="Ball6" parent="." instance=ExtResource( "2" )]
 position = Vector2(635.555, 147.858)
-physics_material_override = SubResource( 6 )
+physics_material_override = SubResource( "6" )
 
-[node name="Ball7" parent="." instance=ExtResource( 2 )]
+[node name="Ball7" parent="." instance=ExtResource( "2" )]
 position = Vector2(631.872, 325.88)
-physics_material_override = SubResource( 7 )
+physics_material_override = SubResource( "7" )
 
-[node name="Ball8" parent="." instance=ExtResource( 2 )]
+[node name="Ball8" parent="." instance=ExtResource( "2" )]
 position = Vector2(529.97, 205.561)
-physics_material_override = SubResource( 8 )
+physics_material_override = SubResource( "8" )
 
-[node name="Ball9" parent="." instance=ExtResource( 2 )]
+[node name="Ball9" parent="." instance=ExtResource( "2" )]
 position = Vector2(101.489, 167.502)
-physics_material_override = SubResource( 9 )
+physics_material_override = SubResource( "9" )
 
-[node name="Ball10" parent="." instance=ExtResource( 2 )]
+[node name="Ball10" parent="." instance=ExtResource( "2" )]
 position = Vector2(143.756, 295.139)
-physics_material_override = SubResource( 10 )
+physics_material_override = SubResource( "10" )
 
 [node name="Camera2D" type="Camera2D" parent="."]
 offset = Vector2(400, 300)