/
texfilter.go
58 lines (49 loc) · 1.56 KB
/
texfilter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2014 The Azul3D Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gfx
// TexFilter represents a single texture filter to be used for minification or
// magnification of a texture during drawing.
type TexFilter uint8
// Mipmapped tells if the texture filter is a mipmapped one, that is one of:
// NearestMipmapNearest
// LinearMipmapNearest
// NearestMipmapLinear
// LinearMipmapLinear
func (t TexFilter) Mipmapped() bool {
switch t {
case NearestMipmapNearest:
return true
case LinearMipmapNearest:
return true
case NearestMipmapLinear:
return true
case LinearMipmapLinear:
return true
}
return false
}
const (
// Nearest samples the nearest pixel.
Nearest TexFilter = iota
// Linear samples the four closest pixels and linearly interpolates them.
Linear
// NearestMipmapNearest samples the pixel from the nearest mipmap, it may
// not be used as a magnification filter.
NearestMipmapNearest
// LinearMipmapNearest (AKA Bilinear filtering) samples the pixel from the
// nearest mipmap.
//
// It may not be used as a magnification filter.
LinearMipmapNearest
// NearestMipmapLinear samples the pixel from the two closest mipmaps, and
// linearly blends the result.
//
// It may not be used as a magnification filter.
NearestMipmapLinear
// LinearMipmapLinear (AKA Trilinear filtering) bilinearly filters the
// pixel from the two mipmaps, and linear blends the result.
//
// It may not be used as a magnification filter.
LinearMipmapLinear
)