Skip to content

Commit

Permalink
Merge pull request #706 from voylin/Fix_Scene_Instancing_Demo_4.0-dev
Browse files Browse the repository at this point in the history
Tested and fixed Scene Instancing Demo for 4.0-dev
  • Loading branch information
aaronfranke authored Apr 3, 2022
2 parents 713dfd0 + 5c53252 commit e5ceb2d
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 77 deletions.
2 changes: 1 addition & 1 deletion 2d/instancing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
28 changes: 13 additions & 15 deletions 2d/instancing/bowling_ball.png.import
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
[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
}

[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
28 changes: 13 additions & 15 deletions 2d/instancing/icon.png.import
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
[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
}

[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
17 changes: 5 additions & 12 deletions 2d/instancing/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
; [section] ; section goes between []
; param=value ; assign values to parameters

config_version=4
config_version=5

[application]

Expand All @@ -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
74 changes: 40 additions & 34 deletions 2d/instancing/scene_instancing.tscn
Original file line number Diff line number Diff line change
@@ -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="."]

Expand All @@ -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)
Expand Down

0 comments on commit e5ceb2d

Please sign in to comment.