Class Sampler
Texture sampler properties for filtering and wrapping modes.
Inherited Members
Namespace: GLTFast.Schema
Assembly: glTFast.dll
Syntax
[Serializable]
public class Sampler : NamedObject
Constructors
Sampler()
Parameter-less constructor
Declaration
public Sampler()
Sampler(FilterMode, TextureWrapMode, TextureWrapMode)
Constructs a Sampler with filter and wrap modes.
Declaration
public Sampler(FilterMode filterMode, TextureWrapMode wrapModeU, TextureWrapMode wrapModeV)
Parameters
Type | Name | Description |
---|---|---|
FilterMode | filterMode | Unity texture filter mode |
TextureWrapMode | wrapModeU | Unity texture wrap mode (horizontal) |
TextureWrapMode | wrapModeV | Unity texture wrap mode (vertical) |
Fields
magFilter
Magnification filter.
Valid values correspond to WebGL enums: 9728
(NEAREST) and 9729
(LINEAR).
Declaration
public Sampler.MagFilterMode magFilter
Field Value
Type | Description |
---|---|
Sampler.MagFilterMode |
minFilter
Minification filter. All valid values correspond to WebGL enums.
Declaration
public Sampler.MinFilterMode minFilter
Field Value
Type | Description |
---|---|
Sampler.MinFilterMode |
wrapS
s wrapping mode. All valid values correspond to WebGL enums.
Declaration
public Sampler.WrapMode wrapS
Field Value
Type | Description |
---|---|
Sampler.WrapMode |
wrapT
t wrapping mode. All valid values correspond to WebGL enums.
Declaration
public Sampler.WrapMode wrapT
Field Value
Type | Description |
---|---|
Sampler.WrapMode |
Properties
FilterMode
Declaration
public FilterMode FilterMode { get; }
Property Value
Type | Description |
---|---|
FilterMode |
WrapU
Unity texture wrap mode (horizontal), derived from glTF's wrapS value.
Declaration
public TextureWrapMode WrapU { get; }
Property Value
Type | Description |
---|---|
TextureWrapMode |
WrapV
Unity texture wrap mode (vertical), derived from glTF's wrapT value.
Declaration
public TextureWrapMode WrapV { get; }
Property Value
Type | Description |
---|---|
TextureWrapMode |
Methods
Apply(Texture2D, MinFilterMode, MagFilterMode)
Applies the Sampler's settings to a Unity texture.
Declaration
public void Apply(Texture2D image, Sampler.MinFilterMode defaultMinFilter = MinFilterMode.Linear, Sampler.MagFilterMode defaultMagFilter = MagFilterMode.Linear)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | image | Texture to apply the settings to |
Sampler.MinFilterMode | defaultMinFilter | Fallback minification filter |
Sampler.MagFilterMode | defaultMagFilter | Fallback magnification filter |