Class SamplerObject
java.lang.Object
foundry.veil.api.client.render.texture.SamplerObject
- All Implemented Interfaces:
AutoCloseable
,org.lwjgl.system.NativeResource
Sampler objects allow shaders to sample from the same texture storage in
different ways depending on what samplers are bound.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
bind
(int unit) Binds this sampler to the specified texture unit.static SamplerObject
create()
Creates a single new sampler object.static SamplerObject[]
create
(int count) Creates an array of sampler objects.static void
create
(SamplerObject[] fill) Replaces each element of the specified array with a new sampler object.void
free()
int
getId()
void
setAnisotropy
(float value) Sets the anisotropic filtering value.void
setBorderColor
(float red, float green, float blue, float alpha) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.void
setBorderColor
(int color) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.void
setBorderColor
(int red, int green, int blue, int alpha) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.void
setBorderColorI
(int color) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.void
setBorderColorI
(int red, int green, int blue, int alpha) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.void
setBorderColorUI
(int color) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.void
setBorderColorUI
(int red, int green, int blue, int alpha) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.void
setCompareFunc
(TextureFilter.CompareFunction compareFunction) Sets the depth compare function for depth texture sampling.void
setCubeMapSeamless
(boolean seamless) Allows filtering to work across faces of cubemaps.void
setFilter
(boolean blur, boolean mipmap) Sets the minification and magnification filters to match the specified blur and mipmap states.void
setFilter
(TextureFilter filter) Sets the texture filtering to match the specified state.void
setWrap
(TextureFilter.Wrap wrapX, TextureFilter.Wrap wrapY, TextureFilter.Wrap wrapZ) Sets the texture wrap function for all axes.void
setWrapX
(TextureFilter.Wrap wrap) Sets the X texture wrap function.void
setWrapY
(TextureFilter.Wrap wrap) Sets the Y texture wrap function.void
setWrapZ
(TextureFilter.Wrap wrap) Sets the Z texture wrap function.static void
unbind
(int unit) Unbinds the sampler from the specified unit.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.lwjgl.system.NativeResource
close
-
Method Details
-
create
Creates a single new sampler object.- Returns:
- A new sampler
-
create
Creates an array of sampler objects.- Parameters:
count
- The number of samplers to create- Returns:
- An array of new sampler objects
-
create
Replaces each element of the specified array with a new sampler object.- Parameters:
fill
- The array to fill
-
bind
public void bind(int unit) Binds this sampler to the specified texture unit.- Parameters:
unit
- The unit to bind to
-
unbind
public static void unbind(int unit) Unbinds the sampler from the specified unit.- Parameters:
unit
- The unit to unbind from
-
getId
public int getId()- Returns:
- The OpenGL id of this sampler
-
setFilter
Sets the texture filtering to match the specified state.- Parameters:
filter
- The new texture filtering state to use
-
setFilter
public void setFilter(boolean blur, boolean mipmap) Sets the minification and magnification filters to match the specified blur and mipmap states.- Parameters:
blur
- Whether to use linear or nearest neighbor filteringmipmap
- Whether to interpolate between mipmap levels or not
-
setAnisotropy
public void setAnisotropy(float value) Sets the anisotropic filtering value. Any value >1 is considered to be enabled. Set toFloat.MAX_VALUE
to set to the platform maximum- Parameters:
value
- The new anisotropic filtering value
-
setCompareFunc
Sets the depth compare function for depth texture sampling.- Parameters:
compareFunction
- The new function ornull
to disable
-
setWrapX
Sets the X texture wrap function.- Parameters:
wrap
- The new X wrap value
-
setWrapY
Sets the Y texture wrap function.- Parameters:
wrap
- The new Y wrap value
-
setWrapZ
Sets the Z texture wrap function.- Parameters:
wrap
- The new Z wrap value
-
setWrap
Sets the texture wrap function for all axes.- Parameters:
wrapX
- The new X wrap valuewrapY
- The new Y wrap valuewrapZ
- The new Z wrap value
-
setBorderColor
public void setBorderColor(float red, float green, float blue, float alpha) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.- Parameters:
red
- The red value from0
to1
green
- The green value from0
to1
blue
- The blue value from0
to1
alpha
- The alpha value from0
to1
-
setBorderColor
public void setBorderColor(int red, int green, int blue, int alpha) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.- Parameters:
red
- The red value from0
to255
green
- The green value from0
to255
blue
- The blue value from0
to255
alpha
- The alpha value from0
to255
-
setBorderColor
public void setBorderColor(int color) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.- Parameters:
color
- The color value encoded as an RGBA int
-
setBorderColorI
public void setBorderColorI(int red, int green, int blue, int alpha) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.- Parameters:
red
- The red value from0
to255
green
- The green value from0
to255
blue
- The blue value from0
to255
alpha
- The alpha value from0
to255
-
setBorderColorI
public void setBorderColorI(int color) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.- Parameters:
color
- The color value encoded as an RGBA int
-
setBorderColorUI
public void setBorderColorUI(int red, int green, int blue, int alpha) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.- Parameters:
red
- The red value from0
to255
green
- The green value from0
to255
blue
- The blue value from0
to255
alpha
- The alpha value from0
to255
-
setBorderColorUI
public void setBorderColorUI(int color) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER
.- Parameters:
color
- The color value encoded as an RGBA int
-
setCubeMapSeamless
public void setCubeMapSeamless(boolean seamless) Allows filtering to work across faces of cubemaps.- Parameters:
seamless
- Whether to enable seamless cube maps
-
free
public void free()- Specified by:
free
in interfaceorg.lwjgl.system.NativeResource
-