Documentation ¶
Overview ¶
Package texture contains several types of textures which can be added to materials.
Index ¶
- func DecodeImage(imgfile string) (*image.RGBA, error)
- type Animator
- type Texture2D
- func NewBoard(width, height int, c1, c2, c3, c4 *math32.Color, alpha float32) *Texture2D
- func NewTexture2D() *Texture2D
- func NewTexture2DFromCompressedData(width, height int, iformat int32, size int32, data interface{}) *Texture2D
- func NewTexture2DFromData(width, height int, format int, formatType, iformat int, data interface{}) *Texture2D
- func NewTexture2DFromImage(imgfile string) (*Texture2D, error)
- func NewTexture2DFromRGBA(rgba *image.RGBA) *Texture2D
- func (t *Texture2D) Compressed() bool
- func (t *Texture2D) Data() (int, int, int, int, int, interface{})
- func (t *Texture2D) Dispose()
- func (t *Texture2D) GetUniformNames() (sampler, info string)
- func (t *Texture2D) Height() int
- func (t *Texture2D) Incref() *Texture2D
- func (t *Texture2D) MagFilter() uint32
- func (t *Texture2D) MinFilter() uint32
- func (t *Texture2D) Offset() (float32, float32)
- func (t *Texture2D) RenderSetup(gs *gls.GLS, slotIdx, uniIdx int)
- func (t *Texture2D) Repeat() (float32, float32)
- func (t *Texture2D) SetCompressedData(width, height int, iformat int32, size int32, data interface{})
- func (t *Texture2D) SetData(width, height int, format int, formatType, iformat int32, data interface{})
- func (t *Texture2D) SetFlipY(state bool)
- func (t *Texture2D) SetFromRGBA(rgba *image.RGBA)
- func (t *Texture2D) SetImage(imgfile string) error
- func (t *Texture2D) SetMagFilter(magFilter uint32)
- func (t *Texture2D) SetMinFilter(minFilter uint32)
- func (t *Texture2D) SetOffset(x, y float32)
- func (t *Texture2D) SetRepeat(x, y float32)
- func (t *Texture2D) SetUniformNames(sampler, info string)
- func (t *Texture2D) SetVisible(state bool)
- func (t *Texture2D) SetWrapS(wrapS uint32)
- func (t *Texture2D) SetWrapT(wrapT uint32)
- func (t *Texture2D) Visible() bool
- func (t *Texture2D) Width() int
- func (t *Texture2D) WrapS() uint32
- func (t *Texture2D) WrapT() uint32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Animator ¶
type Animator struct {
// contains filtered or unexported fields
}
Animator can generate a texture animation based on a texture sheet
func NewAnimator ¶
NewAnimator creates and returns a texture sheet animator for the specified texture.
func (*Animator) SetDispTime ¶
SetDispTime sets the display time of each tile in milliseconds. The default value is: 1.0/30.0 = 16.6.ms
func (*Animator) SetMaxCycles ¶
SetMaxCycles sets the number of complete cycles to display. The default value is: 0 (display continuously)
type Texture2D ¶
type Texture2D struct {
// contains filtered or unexported fields
}
Texture2D represents a texture
func NewBoard ¶
NewBoard creates and returns a pointer to a new checker board 2D texture. A checker board texture contains up to 4 different colors arranged in the following order:
+------+------+ | | | | c3 | c4 | | | | +------+------+ | | | | c1 | c2 | height (pixels) | | | +------+------+ width (pixels)
func NewTexture2D ¶ added in v0.2.0
func NewTexture2D() *Texture2D
func NewTexture2DFromCompressedData ¶ added in v0.2.0
func NewTexture2DFromCompressedData(width, height int, iformat int32, size int32, data interface{}) *Texture2D
NewTexture2DFromCompressedData creates a new compressed texture from data
func NewTexture2DFromData ¶
func NewTexture2DFromData(width, height int, format int, formatType, iformat int, data interface{}) *Texture2D
NewTexture2DFromData creates a new texture from data
func NewTexture2DFromImage ¶
NewTexture2DFromImage creates and returns a pointer to a new Texture2D using the specified image file as data. Supported image formats are: PNG, JPEG and GIF.
func NewTexture2DFromRGBA ¶
NewTexture2DFromRGBA creates a new texture from a pointer to an RGBA image object.
func (*Texture2D) Compressed ¶ added in v0.2.0
Compressed returns whether this texture is compressed
func (*Texture2D) Dispose ¶
func (t *Texture2D) Dispose()
Dispose decrements this texture reference count and if necessary releases OpenGL resources and C memory associated with this texture.
func (*Texture2D) GetUniformNames ¶
GetUniformNames returns the names of the uniforms in the shader for sampler and texture info.
func (*Texture2D) Incref ¶
Incref increments the reference count for this texture and returns a pointer to the geometry. It should be used when this texture is shared by another material.
func (*Texture2D) RenderSetup ¶
RenderSetup is called by the material render setup
func (*Texture2D) SetCompressedData ¶ added in v0.2.0
func (t *Texture2D) SetCompressedData(width, height int, iformat int32, size int32, data interface{})
SetCompressedData sets the compressed texture data
func (*Texture2D) SetData ¶
func (t *Texture2D) SetData(width, height int, format int, formatType, iformat int32, data interface{})
SetData sets the texture data
func (*Texture2D) SetFromRGBA ¶
SetFromRGBA sets the texture data from the specified image.RGBA object
func (*Texture2D) SetMagFilter ¶
SetMagFilter sets the filter to be applied when the texture element covers more than on pixel. The default value is gls.Linear.
func (*Texture2D) SetMinFilter ¶
SetMinFilter sets the filter to be applied when the texture element covers less than on pixel. The default value is gls.Linear.
func (*Texture2D) SetUniformNames ¶
SetUniformNames sets the names of the uniforms in the shader for sampler and texture info.
func (*Texture2D) SetVisible ¶
SetVisible sets the visibility state of the texture
func (*Texture2D) SetWrapS ¶
SetWrapS set the wrapping mode for texture S coordinate The default value is GL_CLAMP_TO_EDGE;
func (*Texture2D) SetWrapT ¶
SetWrapT set the wrapping mode for texture T coordinate The default value is GL_CLAMP_TO_EDGE;