mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 23:10:08 +01:00
It turns out using a TextureRect node isn't necessary :) The typical ViewportContainer + Viewport setup can be used just fine to enable filtering on the ViewportTexture returned by the Viewport. The performance of the new method is equivalent to the old one.
92 lines
2.4 KiB
Plaintext
92 lines
2.4 KiB
Plaintext
[gd_scene load_steps=6 format=2]
|
|
|
|
[ext_resource path="res://noto_sans_ui_regular.ttf" type="DynamicFontData" id=1]
|
|
[ext_resource path="res://cubes.tscn" type="PackedScene" id=2]
|
|
[ext_resource path="res://hud.gd" type="Script" id=3]
|
|
|
|
[sub_resource type="DynamicFont" id=1]
|
|
size = 20
|
|
font_data = ExtResource( 1 )
|
|
|
|
[sub_resource type="Theme" id=2]
|
|
default_font = SubResource( 1 )
|
|
|
|
[node name="HUD" type="Control"]
|
|
anchor_right = 1.0
|
|
anchor_bottom = 1.0
|
|
theme = SubResource( 2 )
|
|
script = ExtResource( 3 )
|
|
__meta__ = {
|
|
"_edit_use_anchors_": false
|
|
}
|
|
|
|
[node name="ViewportContainer" type="ViewportContainer" parent="."]
|
|
anchor_right = 1.0
|
|
anchor_bottom = 1.0
|
|
stretch = true
|
|
__meta__ = {
|
|
"_edit_use_anchors_": false
|
|
}
|
|
|
|
[node name="Viewport" type="Viewport" parent="ViewportContainer"]
|
|
size = Vector2( 1024, 600 )
|
|
handle_input_locally = false
|
|
usage = 3
|
|
render_target_update_mode = 3
|
|
shadow_atlas_size = 4096
|
|
|
|
[node name="Cubes" parent="ViewportContainer/Viewport" instance=ExtResource( 2 )]
|
|
|
|
[node name="Help" type="Label" parent="."]
|
|
anchor_top = 1.0
|
|
anchor_bottom = 1.0
|
|
margin_left = 16.0
|
|
margin_top = -106.0
|
|
margin_right = 554.0
|
|
margin_bottom = -16.0
|
|
custom_fonts/font = SubResource( 1 )
|
|
custom_colors/font_color_shadow = Color( 0, 0, 0, 0.752941 )
|
|
custom_constants/shadow_offset_x = 2
|
|
custom_constants/shadow_offset_y = 2
|
|
custom_constants/shadow_as_outline = 0
|
|
text = "This text will always render at the native resolution.
|
|
Press Space to adjust the 3D viewport's resolution scaling.
|
|
Press Enter to toggle filtering."
|
|
__meta__ = {
|
|
"_edit_use_anchors_": false
|
|
}
|
|
|
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
|
margin_left = 16.0
|
|
margin_top = 16.0
|
|
margin_right = 124.0
|
|
margin_bottom = 76.0
|
|
__meta__ = {
|
|
"_edit_use_anchors_": false
|
|
}
|
|
|
|
[node name="Scale" type="Label" parent="VBoxContainer"]
|
|
margin_right = 137.0
|
|
margin_bottom = 28.0
|
|
custom_colors/font_color_shadow = Color( 0, 0, 0, 0.752941 )
|
|
custom_constants/shadow_offset_x = 2
|
|
custom_constants/shadow_offset_y = 2
|
|
custom_constants/shadow_as_outline = 0
|
|
text = "Scale: 100%"
|
|
__meta__ = {
|
|
"_edit_use_anchors_": false
|
|
}
|
|
|
|
[node name="Filter" type="Label" parent="VBoxContainer"]
|
|
margin_top = 32.0
|
|
margin_right = 137.0
|
|
margin_bottom = 60.0
|
|
custom_colors/font_color_shadow = Color( 0, 0, 0, 0.752941 )
|
|
custom_constants/shadow_offset_x = 2
|
|
custom_constants/shadow_offset_y = 2
|
|
custom_constants/shadow_as_outline = 0
|
|
text = "Filter: Enabled"
|
|
__meta__ = {
|
|
"_edit_use_anchors_": false
|
|
}
|