Merge pull request #38 from Calinou/tweak-texture-size-limits

Tweak texture size limits for consistency, set default size to 1024x1024
This commit is contained in:
Rodz Labs 2019-10-20 23:00:47 +02:00 committed by GitHub
commit ede29a90ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View File

@ -20,7 +20,7 @@ func get_type_name():
return "Buffer"
func get_parameter_defs():
return [ { name="size", type="size", first=4, last=11, default=4 } ]
return [ { name="size", type="size", first=4, last=12, default=4 } ]
func get_input_defs():
return [ { name="in", type="rgba" } ]

View File

@ -15,6 +15,15 @@ const TEXTURE_LIST = [
{ port=6, texture="depth_texture" }
]
# The minimum allowed texture size as a power-of-two exponent
const TEXTURE_SIZE_MIN = 4 # 16x16
# The maximum allowed texture size as a power-of-two exponent
const TEXTURE_SIZE_MAX = 12 # 4096x4096
# The default texture size as a power-of-two exponent
const TEXTURE_SIZE_DEFAULT = 10 # 1024x1024
func _ready():
texture_list = TEXTURE_LIST
for t in texture_list:
@ -39,7 +48,7 @@ func get_parameter_defs():
{ name="normal_scale", label="Normal", type="float", min=0.0, max=8.0, step=0.05, default=1.0 },
{ name="ao_light_affect", label="Ambient occlusion", type="float", min=0.0, max=1.0, step=0.05, default=1.0 },
{ name="depth_scale", label="Depth", type="float", min=0.0, max=1.0, step=0.05, default=1.0 },
{ name="size", label="Size", type="size", first=7, last=11, default=9 }
{ name="size", label="Size", type="size", first=TEXTURE_SIZE_MIN, last=TEXTURE_SIZE_MAX, default=TEXTURE_SIZE_DEFAULT }
]
func get_input_defs():
@ -56,9 +65,9 @@ func get_input_defs():
func get_image_size():
var rv : int
if parameters.has("size"):
rv = int(pow(2, parameters.size+7))
rv = int(pow(2, parameters.size+TEXTURE_SIZE_MIN))
else:
rv = 512
rv = int(pow(2, TEXTURE_SIZE_DEFAULT))
return rv
func update_preview():

View File

@ -3,7 +3,7 @@ extends HBoxContainer
var size_first = 0
var size_last = 12
var size_default = 8
var size_default = 10
func _ready():
update_size_configuration()