Fix subsampling to be independent of screen resolution

This commit is contained in:
Luke Hubmayer-Werner 2020-12-22 23:07:46 +10:30
parent ed114f2101
commit 14ebaf2f1e
4 changed files with 18 additions and 23 deletions

View File

@ -184,10 +184,10 @@ grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
min_value = 0.1
max_value = 2.0
step = 0.01
max_value = 1.0
step = 0.05
value = 1.0
tick_count = 3
tick_count = 9
ticks_on_borders = true
__meta__ = {
"_edit_use_anchors_": false
@ -203,10 +203,10 @@ grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
min_value = 0.1
max_value = 2.0
step = 0.01
max_value = 1.0
step = 0.05
value = 1.0
tick_count = 3
tick_count = 9
ticks_on_borders = true
__meta__ = {
"_edit_use_anchors_": false

View File

@ -132,6 +132,14 @@ const COLOR_ARRAY_DOUBLE_MISS_8 := PoolColorArray([
COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS
])
# Normal vertex arrays for our sprites. Might be unnecessary?
const DEFAULT_NORMAL := Vector3(0, 0, 1)
const NORMAL_ARRAY_4 := PoolVector3Array([DEFAULT_NORMAL, DEFAULT_NORMAL, DEFAULT_NORMAL, DEFAULT_NORMAL])
const NORMAL_ARRAY_8 := PoolVector3Array([
DEFAULT_NORMAL, DEFAULT_NORMAL, DEFAULT_NORMAL, DEFAULT_NORMAL,
DEFAULT_NORMAL, DEFAULT_NORMAL, DEFAULT_NORMAL, DEFAULT_NORMAL
])
var screen_filter_min_alpha := 0.2
var screen_filter := Color(0.0, 0.0, 0.0, screen_filter_min_alpha)
signal screen_filter_changed()

View File

@ -44,15 +44,6 @@ var slide_trail_mesh_instances := {}
var noteline_array_image := Image.new()
# Normal vertex arrays for our sprites. Might be unnecessary?
const DEFAULT_NORMAL := Vector3(0, 0, 1)
var NORMAL_ARRAY_4 := PoolVector3Array([DEFAULT_NORMAL, DEFAULT_NORMAL, DEFAULT_NORMAL, DEFAULT_NORMAL])
var NORMAL_ARRAY_8 := PoolVector3Array([
DEFAULT_NORMAL, DEFAULT_NORMAL, DEFAULT_NORMAL, DEFAULT_NORMAL,
DEFAULT_NORMAL, DEFAULT_NORMAL, DEFAULT_NORMAL, DEFAULT_NORMAL
])
# Text UVs
var text_UV_arrays := []
func make_text_UV(row: int, column: int) -> PoolVector2Array:
@ -125,7 +116,6 @@ func make_tap_mesh(mesh: ArrayMesh, note_center: Vector2, scale:=1.0, color_arra
var arrays = []
arrays.resize(Mesh.ARRAY_MAX)
arrays[Mesh.ARRAY_VERTEX] = vertex_array
# arrays[Mesh.ARRAY_NORMAL] = NORMAL_ARRAY_4
arrays[Mesh.ARRAY_TEX_UV] = GameTheme.UV_ARRAY_TAP
arrays[Mesh.ARRAY_COLOR] = color_array
mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLE_STRIP, arrays)
@ -148,7 +138,6 @@ func make_hold_mesh(mesh: ArrayMesh, note_center: Vector2, note_center_rel: Vect
var arrays = []
arrays.resize(Mesh.ARRAY_MAX)
arrays[Mesh.ARRAY_VERTEX] = vertex_array
# arrays[Mesh.ARRAY_NORMAL] = NORMAL_ARRAY_8
arrays[Mesh.ARRAY_TEX_UV] = GameTheme.UV_ARRAY_HOLD
arrays[Mesh.ARRAY_COLOR] = color_array
mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLE_STRIP, arrays)
@ -166,7 +155,6 @@ func make_star_mesh(mesh: ArrayMesh, note_center: Vector2, scale:=1.0, angle:=0.
var arrays = []
arrays.resize(Mesh.ARRAY_MAX)
arrays[Mesh.ARRAY_VERTEX] = vertex_array
# arrays[Mesh.ARRAY_NORMAL] = NORMAL_ARRAY_4
arrays[Mesh.ARRAY_TEX_UV] = GameTheme.UV_ARRAY_STAR
arrays[Mesh.ARRAY_COLOR] = color_array
mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLE_STRIP, arrays)
@ -175,7 +163,6 @@ func make_star_mesh(mesh: ArrayMesh, note_center: Vector2, scale:=1.0, angle:=0.
# var arrays = []
# arrays.resize(Mesh.ARRAY_MAX)
# arrays[Mesh.ARRAY_VERTEX] = vertex_array
## arrays[Mesh.ARRAY_NORMAL] = NORMAL_ARRAY_4
# arrays[Mesh.ARRAY_TEX_UV] = UV_ARRAY_ARROW
# arrays[Mesh.ARRAY_COLOR] = color_array
# mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLE_STRIP, arrays)
@ -481,7 +468,6 @@ func make_noteline_mesh_old() -> ArrayMesh:
var arrays = []
arrays.resize(Mesh.ARRAY_MAX)
arrays[Mesh.ARRAY_VERTEX] = vertex_array_playfield
arrays[Mesh.ARRAY_NORMAL] = NORMAL_ARRAY_4
arrays[Mesh.ARRAY_TEX_UV] = uv_array_playfield
mesh_playfield.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLE_STRIP, arrays)
return mesh_playfield

View File

@ -1,16 +1,17 @@
extends Viewport
func set_render_scale(scale: Vector2):
size = Vector2(1080, 1080) * scale
var ws = OS.window_size
var dim = min(ws.x, ws.y)
size = Vector2(dim, dim) * scale
$Center.position = size * 0.5
$Center.scale = scale
$Center.scale = size/1080
func slider_slot(arg1):
set_render_scale(Vector2($"/root/main/InputHandler/SSXSlider".value, $"/root/main/InputHandler/SSYSlider".value))
# Called when the node enters the scene tree for the first time.
func _ready():
# set_render_scale(Vector2(0.5, 1.0))
$"/root/main/InputHandler/SSXSlider".connect("value_changed", self, "slider_slot")
$"/root/main/InputHandler/SSYSlider".connect("value_changed", self, "slider_slot")
slider_slot(1)