API Reference · Sprites, lines and points
SpriteNode
public class SpriteNode : NodeA textured quad that always faces the camera, centred on the node's position.
This is what draws anything that is light rather than surface: an engine glow, a beacon, a lamp, the corona around a star. Emissive geometry cannot substitute, because emissive geometry is still geometry — it is occluded by whatever is in front of it and it shrinks to nothing at distance. A sprite with SpriteNode.DepthTest off keeps a ship visible as a point of light long after its hull is sub-pixel, which is exactly the job.
The quad's edges stay parallel to the viewport's, and only the node's translation is read — rotation and scale on a sprite node are ignored, because a quad that is always square-on to the camera has nowhere to put them.
Not sealed, so that LabelNode can be one. A camera-facing textured quad is exactly what a label in a scene is, so a label is drawn, sorted and culled as a sprite on every renderer. Deriving from it yourself is not a way to change how sprites draw: a subclass is drawn from the properties declared here and nothing else.
Properties
| Member | Description |
|---|---|
| How the quad combines with the frame. |
| Linear RGB tint, multiplied with |
| Whether the quad is hidden by geometry in front of it. On by default. |
| Whether the quad writes depth. Off by default, and it should almost always stay off: a sprite that writes depth occludes every sprite drawn after it, so two overlapping glows stop adding up and the nearer one punches a hole in the further one. |
| The quad's extent, so |
| Overall opacity, 0..1, multiplied with the texture's own alpha. |
| The quad's size in world units, so it shrinks with distance like everything else. World units rather than pixels on purpose. A sun's corona is a fixed size in the world and should recede as you leave; a beacon meant to hold its size on screen is a division by range the caller does itself, and that is a calculation only the caller can get right. Screen-space sizing here would make the first case impossible to express. |
| How far in front of solid geometry this quad starts fading out, in world units. Zero — the default — leaves it hard-edged. A billboard is a flat card, and where it approaches a solid the card's own edge shows. With this set the sprite reads the depth of what is already drawn and fades as it approaches it, so a glow meets a hull as smoke rather than as a decal. Set it to about the size of the sprite. Needs a renderer that can copy its depth buffer — see |
| The image to draw. Null draws a plain quad of |
| Which part of The whole image by default. Its reason for existing is the atlas — see A |
Methods
| Member | Description |
|---|---|
| Points
|