Facebook Twitter YouTube

class StarField

Defined in:  TSParticles.h
The StarField class renders a star field particle system at infinity.

class StarField : public InfinitePointParticleSystem


StarField(const char *name);

name The name of the star field resource to use. If this is nullptr, then the default star field engine/Stars is used.
The StarField class represents a particle system consisting of stars rendered infinitely far from the camera. The positions and brightnesses of the stars are read from the star field resource specified by the name parameter. A maximum of 12000 stars are rendered.

A star field resource has the file extension .sfd and contains a 20-byte header followed by a StarData structure for each star. Bytes 0 through 3 of a star field resource must contain the 32-bit value kEngineInternalSignature, and bytes 4 through 8 must contain the 32-bit value kEngineInternalVersion. Bytes 8 through 11 must contain the string "sfd" with a null terminator, and bytes 12 through 15 must contain zeros. Finally, bytes 16 through 19 of the header must contain the total number of stars in the resource as a 32-bit value. Little endian byte order must be used throughout the file. Following the 20-byte header is an array of StarData structures containing information about each star. A single StarData structure is 12 bytes in size and contains three 32-bit floating-point fields in the following order: (1) the right ascension of the star, in hours east of the vernal equinox, (2) the declination of the star, in degrees north of the celestial equator, and (3) the apparent magnitude of the star.

The default star field resource engine/Stars contains data for the 12000 brightest stars visible from Earth.
Base Classes
InfinitePointParticleSystem A star field is a particle system that is rendered at infinity.