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 TypeMethodDescriptionvoidbind(int unit) Binds this sampler to the specified texture unit.static SamplerObjectcreate()Creates a single new sampler object.static SamplerObject[]create(int count) Creates an array of sampler objects.static voidcreate(SamplerObject[] fill) Replaces each element of the specified array with a new sampler object.voidfree()intgetId()voidsetAnisotropy(float value) Sets the anisotropic filtering value.voidsetBorderColor(float red, float green, float blue, float alpha) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER.voidsetBorderColor(int color) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER.voidsetBorderColor(int red, int green, int blue, int alpha) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER.voidsetBorderColorI(int color) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER.voidsetBorderColorI(int red, int green, int blue, int alpha) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER.voidsetBorderColorUI(int color) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER.voidsetBorderColorUI(int red, int green, int blue, int alpha) Sets the border color to use when the wrap mode isTextureFilter.Wrap.CLAMP_TO_BORDER.voidsetCompareFunc(TextureFilter.CompareFunction compareFunction) Sets the depth compare function for depth texture sampling.voidsetCubeMapSeamless(boolean seamless) Allows filtering to work across faces of cubemaps.voidsetFilter(boolean blur, boolean mipmap) Sets the minification and magnification filters to match the specified blur and mipmap states.voidsetFilter(TextureFilter filter) Sets the texture filtering to match the specified state.voidsetWrap(TextureFilter.Wrap wrapX, TextureFilter.Wrap wrapY, TextureFilter.Wrap wrapZ) Sets the texture wrap function for all axes.voidsetWrapX(TextureFilter.Wrap wrap) Sets the X texture wrap function.voidsetWrapY(TextureFilter.Wrap wrap) Sets the Y texture wrap function.voidsetWrapZ(TextureFilter.Wrap wrap) Sets the Z texture wrap function.static voidunbind(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, waitMethods 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_VALUEto 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 ornullto 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 from0to1green- The green value from0to1blue- The blue value from0to1alpha- The alpha value from0to1
-
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 from0to255green- The green value from0to255blue- The blue value from0to255alpha- The alpha value from0to255
-
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 from0to255green- The green value from0to255blue- The blue value from0to255alpha- The alpha value from0to255
-
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 from0to255green- The green value from0to255blue- The blue value from0to255alpha- The alpha value from0to255
-
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:
freein interfaceorg.lwjgl.system.NativeResource
-