# HG changeset patch # User Sam # Date 1707574783 -25200 # Node ID cf59fa28ae1633eb360631db43accbef80d8ff78 # Parent 10267da04fba736e47ec887142bf5791790e63e8 add: default samplers diff -r 10267da04fba -r cf59fa28ae16 semicongine/core/imagetypes.nim --- a/semicongine/core/imagetypes.nim Sat Feb 10 21:19:31 2024 +0700 +++ b/semicongine/core/imagetypes.nim Sat Feb 10 21:19:43 2024 +0700 @@ -59,7 +59,7 @@ image[].imagedata[y * image.width + x] = value -proc newImage*[T: Pixel](width, height: int, imagedata: openArray[T]= []): Image[T] = +proc newImage*[T: Pixel](width, height: int, imagedata: openArray[T] = []): Image[T] = assert width > 0 and height > 0 assert imagedata.len == width * height or imagedata.len == 0 @@ -70,17 +70,19 @@ result.width = width result.height = height -let INVALID_TEXTURE* = Texture(name: "Invalid texture", isGrayscale: false, colorImage: newImage(1, 1, @[[255'u8, 0'u8, 255'u8, 255'u8]]), sampler: Sampler( +const + LINEAR_SAMPLER* = Sampler( + magnification: VK_FILTER_LINEAR, + minification: VK_FILTER_LINEAR, + wrapModeS: VK_SAMPLER_ADDRESS_MODE_REPEAT, + wrapModeT: VK_SAMPLER_ADDRESS_MODE_REPEAT, + ) + NEAREST_SAMPLER* = Sampler( magnification: VK_FILTER_NEAREST, minification: VK_FILTER_NEAREST, wrapModeS: VK_SAMPLER_ADDRESS_MODE_REPEAT, wrapModeT: VK_SAMPLER_ADDRESS_MODE_REPEAT, ) -) -let EMPTY_TEXTURE* = Texture(name: "Empty texture", isGrayscale: false, colorImage: newImage(1, 1, @[[255'u8, 255'u8, 255'u8, 255'u8]]), sampler: Sampler( - magnification: VK_FILTER_NEAREST, - minification: VK_FILTER_NEAREST, - wrapModeS: VK_SAMPLER_ADDRESS_MODE_REPEAT, - wrapModeT: VK_SAMPLER_ADDRESS_MODE_REPEAT, - ) -) +let + INVALID_TEXTURE* = Texture(name: "Invalid texture", isGrayscale: false, colorImage: newImage(1, 1, @[[255'u8, 0'u8, 255'u8, 255'u8]]), sampler: NEAREST_SAMPLER) + EMPTY_TEXTURE* = Texture(name: "Empty texture", isGrayscale: false, colorImage: newImage(1, 1, @[[255'u8, 255'u8, 255'u8, 255'u8]]), sampler: NEAREST_SAMPLER)