Skip to content

Commit

Permalink
assets: add texture filtering support to ImageOptions (.linear as d…
Browse files Browse the repository at this point in the history
…efault)
  • Loading branch information
larpon committed Aug 10, 2024
1 parent 60f138f commit 9da8e93
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/assets.v
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@ fn (mut a Asset) to_image(opt ImageOptions) !Image {
mut smp_desc := gfx.SamplerDesc{
wrap_u: opt.wrap_u // .clamp_to_edge
wrap_v: opt.wrap_v // .clamp_to_edge
min_filter: opt.min_filter // .linear
mag_filter: opt.mag_filter // .linear
}

// println('${image.width} x ${image.height} x ${image.channels} --- ${a.data.len}')
Expand Down Expand Up @@ -903,18 +905,22 @@ mut:

pub type ImageWrap = gfx.Wrap

pub type ImageFilter = gfx.Filter

pub type ResizeValue = Size | f32 | f64

@[params]
pub struct ImageOptions {
AssetLoadOptions
pub:
resize ResizeValue = f32(1.0)
width int
height int
mipmaps int
wrap_u ImageWrap = .clamp_to_edge
wrap_v ImageWrap = .clamp_to_edge
resize ResizeValue = f32(1.0)
width int
height int
mipmaps int
wrap_u ImageWrap = .clamp_to_edge
wrap_v ImageWrap = .clamp_to_edge
min_filter ImageFilter = .linear
mag_filter ImageFilter = .linear
}

//@[params]
Expand Down

0 comments on commit 9da8e93

Please sign in to comment.