-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
sampler.go
58 lines (46 loc) · 1.75 KB
/
sampler.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
package gltf
type SamplerMagFilter int
const (
SamplerMagFilter_NEAREST SamplerMagFilter = 9728
SamplerMagFilter_LINEAR SamplerMagFilter = 9729
)
type SamplerMinFilter int
const (
SamplerMinFilter_NEAREST SamplerMinFilter = 9728
SamplerMinFilter_LINEAR SamplerMinFilter = 9729
SamplerMinFilter_NEAREST_MIPMAP_NEAREST SamplerMinFilter = 9984
SamplerMinFilter_LINEAR_MIPMAP_NEAREST SamplerMinFilter = 9985
SamplerMinFilter_NEAREST_MIPMAP_LINEAR SamplerMinFilter = 9986
SamplerMinFilter_LINEAR_MIPMAP_LINEAR SamplerMinFilter = 9987
)
type SamplerWrap int
const (
SamplerWrap_CLAMP_TO_EDGE SamplerWrap = 33071
SamplerWrap_MIRRORED_REPEAT SamplerWrap = 33648
SamplerWrap_REPEAT SamplerWrap = 10497
)
// Texture sampler properties for filtering and wrapping modes.
// https://github.com/KhronosGroup/glTF/blob/main/specification/2.0/schema/sampler.schema.json
type Sampler struct {
ChildOfRootProperty
MagFilter SamplerMagFilter `json:"magFilter,omitempty"` // Magnification filter.
MinFilter SamplerMinFilter `json:"minFilter,omitempty"` // Minification filter
WrapS SamplerWrap `json:"wrapS,omitempty"` // S (U) wrapping mode. All valid values correspond to WebGL enums.
WrapT SamplerWrap `json:"wrapT,omitempty"` // T (V) wrapping mode.
}
func (s *Sampler) equal(other *Sampler) bool {
if s == other { // Either both nil or point to the same object
return true
}
if s == nil || other == nil { // only one can be nil at this point
return false
}
if s.MagFilter != other.MagFilter || s.MinFilter != other.MinFilter ||
s.WrapS != other.WrapS || s.WrapT != other.WrapT {
return false
}
if !s.ChildOfRootProperty.equal(other.ChildOfRootProperty) {
return false
}
return true
}