MSFCelestialSprite

Objective-C


@interface MSFCelestialSprite : MSFCelestialObject

Swift

class MSFCelestialSprite : MSFCelestialObject

A flat, camera-facing object in the sky: a disc, a point of light, an icon overhead.

Its size is given either as an ANGULAR size in degrees - which is what a real body has, so it grows and shrinks with the field of view like everything else in the world - or as a fixed SCREEN size in pixels, which is what an icon or a marker wants. A sprite with no bitmap is drawn as a soft disc in its own color, which is enough for most bodies and costs no texture at all.

  • Undocumented

    Declaration

    Objective-C

    -(id)init;

    Swift

    init!()
  • Returns the angular size of the sprite.

    Declaration

    Objective-C

    - (float)getAngularSize;

    Swift

    func getAngularSize() -> Float

    Return Value

    The angular diameter in degrees, or 0 if the sprite is sized in pixels.

  • Sets the angular size of the sprite, the way a real body is measured - the disc then covers the same angle whatever the field of view.

    Declaration

    Objective-C

    - (void)setAngularSize:(float)degrees;

    Swift

    func setAngularSize(_ degrees: Float)

    Parameters

    degrees

    The angular diameter in degrees.

  • Returns the screen size of the sprite.

    Declaration

    Objective-C

    - (float)getScreenSize;

    Swift

    func getScreenSize() -> Float

    Return Value

    The diameter in pixels, or 0 if the sprite is sized by angle.

  • Sets a fixed on-screen size, in pixels, independent of the field of view. Use this for icons and markers rather than for bodies.

    Declaration

    Objective-C

    - (void)setScreenSize:(float)pixels;

    Swift

    func setScreenSize(_ pixels: Float)

    Parameters

    pixels

    The diameter in pixels.

  • Returns the bitmap of the sprite.

    Declaration

    Objective-C

    - (MSFBitmap *)getBitmap;

    Swift

    func getBitmap() -> MSFBitmap!

    Return Value

    The bitmap, or null if the sprite is drawn as a plain disc.

  • Sets the bitmap of the sprite. Sprites are batched per bitmap, so objects that share one bitmap - a catalogue of thousands, for instance - cost a single draw call.

    Declaration

    Objective-C

    - (void)setBitmap:(MSFBitmap *)bitmap;

    Swift

    func setBitmap(_ bitmap: MSFBitmap!)

    Parameters

    bitmap

    The new bitmap, or null to draw a plain disc.

  • Returns the edge softness of a disc sprite.

    Declaration

    Objective-C

    - (float)getSoftness;

    Swift

    func getSoftness() -> Float

    Return Value

    The softness, 0 for a hard edge and 1 for a fully soft one.

  • Sets the edge softness of a disc sprite. It has no effect on a sprite with a bitmap.

    Declaration

    Objective-C

    - (void)setSoftness:(float)softness;

    Swift

    func setSoftness(_ softness: Float)

    Parameters

    softness

    The softness, 0 for a hard edge and 1 for a fully soft one.

  • Returns the extra radius that responds to a click.

    Declaration

    Objective-C

    - (float)getClickRadius;

    Swift

    func getClickRadius() -> Float

    Return Value

    The extra click radius in degrees.

  • Sets an extra angular radius that responds to a click, added to the sprite’s own size. A sprite half a pixel across is impossible to hit otherwise.

    Declaration

    Objective-C

    - (void)setClickRadius:(float)degrees;

    Swift

    func setClickRadius(_ degrees: Float)

    Parameters

    degrees

    The extra click radius in degrees.

  • Undocumented

    Declaration

    Objective-C

    -(void)dealloc;

    Swift

    func dealloc()