Documentation
¶
Overview ¶
Package instanced is the sprites a Direct source draws on the GPU as instances, by layer or in the order they came.
Index ¶
- Constants
- func BadgeWidth(n int, shape BadgeShape, size float32) float32
- type At
- type AtlasSource
- type BadgeShape
- type DrawMeshOptions
- type Font
- type Labels
- func (l *Labels) Badge(n int, shape BadgeShape, x, y, z, deep, dx, dy, width float32, ...)
- func (l *Labels) Draw(t Target, cam camera.Camera, u Uniforms)
- func (l *Labels) Reset()
- func (l *Labels) Text(font *Font, s string, x, y, z, deep, dx, dy float32, c color.RGBA)
- func (l *Labels) Wrap(w, h float32, x, y bool)
- type Light
- type SpriteID
- type Sprites
- func (s *Sprites) Cutout(on bool)
- func (s *Sprites) Direct(share float32)
- func (s *Sprites) Draw(t Target, cam camera.Camera, u Uniforms)
- func (s *Sprites) Fog(amount float32)
- func (s *Sprites) GiveWay(on bool)
- func (s *Sprites) GivesWay() bool
- func (s *Sprites) Layer(at At, under bool)
- func (s *Sprites) Point(atlas AtlasSource, id SpriteID, x, y, w, h, z, deep float32, light Light)
- func (s *Sprites) Rect(atlas AtlasSource, id SpriteID, x0, y0, x1, y1, u0, v0, u1, v1 float32, ...)
- func (s *Sprites) Reset()
- func (s *Sprites) Shelter(at uint16)
- func (s *Sprites) Take(takes Taking)
- func (s *Sprites) Turned(atlas AtlasSource, id SpriteID, x0, y0, x1, y1, angle float32, light Light)
- func (s *Sprites) Uncover(on bool)
- func (s *Sprites) Uncovers() bool
- func (s *Sprites) Wrap(w, h float32, x, y bool)
- type Taking
- type Target
- type Uniforms
Constants ¶
const ( TakesAll = compose.TakesAll Cutout = compose.Cutout Uncovered = compose.Uncovered )
TakesAll takes every shade and the lamps' light, as a zero Taking does.
Variables ¶
This section is empty.
Functions ¶
func BadgeWidth ¶ added in v0.20.0
func BadgeWidth(n int, shape BadgeShape, size float32) float32
BadgeWidth is how many shown pixels across a badge of shape at least size across is to hold n written in its middle, nothing written where n is not positive. It may be asked on any goroutine.
Types ¶
type AtlasSource ¶
type AtlasSource = gfx.AtlasSource
the names of compose's, gfx's and text's the sprites and labels draw with
type BadgeShape ¶ added in v0.20.0
type BadgeShape uint8
BadgeShape is the outline of a badge.
const ( // BadgeDisc is a round badge. BadgeDisc BadgeShape = iota // BadgeDiamond is a square badge standing on a corner. BadgeDiamond )
type DrawMeshOptions ¶
type DrawMeshOptions = gfx.DrawMeshOptions
the names of compose's, gfx's and text's the sprites and labels draw with
type Font ¶ added in v0.20.0
the names of compose's, gfx's and text's the sprites and labels draw with
type Labels ¶ added in v0.20.0
type Labels struct {
// contains filtered or unexported fields
}
Labels is text a Direct source draws on the GPU by points of the world, a size in shown pixels however far the point, each glyph tested for depth as though it stood upright on its point; and badges, shapes with a number in, drawn alike.
func (*Labels) Badge ¶ added in v0.20.0
func (l *Labels) Badge(n int, shape BadgeShape, x, y, z, deep, dx, dy, width float32, fill, rim color.RGBA)
Badge adds a badge of shape width shown pixels across by the point (x, y) of the world seen at height z, its middle dx and dy shown pixels from where the point shows, standing at height deep, filled with fill within a rim in rim, and n, where it is positive, written in its middle in white or black, whichever stands out of fill.
func (*Labels) Draw ¶ added in v0.20.0
Draw draws the gathered text into the target's screen, a viewport cam's size, by its points as cam lays them under the frame's uniforms u, keeping it for another draw till Reset; against the target's depth, where it has one, what shows of it written. A camera that cannot say its lines of sight draws none.
type Sprites ¶
type Sprites struct {
// contains filtered or unexported fields
}
Sprites is sprites a Direct source draws on the GPU as instances, by Layer or else in the order they came, one call a run sharing an atlas: each a rectangle of the world the GPU lays on the screen as the camera does, what Frame.SpriteRectUV would lay, without the frame.
func (*Sprites) Cutout ¶ added in v0.21.0
Cutout has the pieces added next drawn in the cutout pass: whole, cut at half their alpha, writing the depth, front to back; off, among what is seen through.
func (*Sprites) Direct ¶
Direct has the pieces added next lit share of their light by the distant light, 0 to 1: what a shadow over them takes away.
func (*Sprites) Draw ¶
Draw draws the gathered sprites into the target's screen, a viewport cam's size, as cam lays them under the frame's uniforms u, keeping them for another draw till Reset; into the target's depth, where it has one, each at its height, what shows of it written. In the cutout pass the pieces added under Cutout alone, cut at half their alpha, front to back; in the pass seen through the rest and the points; in the pass of what is uncovered, where those added under Uncover lie. A camera that cannot say its lines of sight draws none.
func (*Sprites) Fog ¶
Fog has the pieces added next turn into the frame's Fog colour by amount, 0 clear to 1 all fog.
func (*Sprites) GiveWay ¶ added in v0.22.0
GiveWay has the pieces added next give way to those uncovered (Uncover), their own or another source's.
func (*Sprites) Layer ¶
Layer has the pieces added next lie at at, drawn back to front and at one place those under before the rest; pieces added before any Layer lie at the zero At.
func (*Sprites) Point ¶ added in v0.19.0
func (s *Sprites) Point(atlas AtlasSource, id SpriteID, x, y, w, h, z, deep float32, light Light)
Point adds sprite id of atlas as a point at the middle (x, y) of a box w by h, seen at height z and lying at height deep, in light: the box as large as it shows, a pixel at least each way, as much less opaque as it shows less. Drawn after the pieces, by no Layer.
func (*Sprites) Rect ¶
func (s *Sprites) Rect( atlas AtlasSource, id SpriteID, x0, y0, x1, y1, u0, v0, u1, v1 float32, light Light)
Rect adds the part u0..u1, v0..v1 of sprite id of atlas over the world rectangle (x0, y0)-(x1, y1), in light.
func (*Sprites) Shelter ¶ added in v0.22.0
Shelter has the pieces added next drawn under the frame's shelter at (Shadowing.Shelter), 0 in the open: their light the lamps' alone, what of the sky's gets in worked out pixel by pixel.
func (*Sprites) Turned ¶
func (s *Sprites) Turned( atlas AtlasSource, id SpriteID, x0, y0, x1, y1, angle float32, light Light)
Turned adds the whole of sprite id of atlas over the world rectangle (x0, y0)-(x1, y1), turned by angle radians about its middle, anticlockwise as the world is seen from above, in light.
func (*Sprites) Uncover ¶ added in v0.22.0
Uncover has the pieces added next uncovered: whatever gives way (GiveWay) is left out over them, thinning outwards, where it lies nearer than they do, in a frame with a depth.