MaplyPoints

Objective-C

@interface MaplyPoints : NSObject

Swift

class MaplyPoints : NSObject

The Maply Points object is used to add a large number of static points to the scene.

Rather than add a single 3D point we assume you want to add a lot of them all at once. This object lets you do that and lets you assign the various data values to input attributes in your custom shader.

All the cool kids have custom shaders.

  • Initialie with a hint as to the number of points you’ll be adding (not required).

    Declaration

    Objective-C

    - (id _Nonnull)initWithNumPoints:(int)numPoints;

    Swift

    init(numPoints: Int32)
  • Transform to apply to the point locations. A center is good.

    Declaration

    Objective-C

    @property (nonatomic, strong) MaplyMatrix *_Nullable transform;

    Swift

    var transform: MaplyMatrix? { get set }
  • Add a geocoordinate in lon/lat and Z (meters).

    Declaration

    Objective-C

    - (void)addGeoCoordLon:(float)x lat:(float)y z:(float)z;

    Swift

    func addGeoCoordLon(_ x: Float, lat y: Float, z: Float)
  • Directly add a coordinate in display space. Remember the globe is a sphere with radius = 1.0.

    Declaration

    Objective-C

    - (void)addDispCoordX:(float)x y:(float)y z:(float)z;

    Swift

    func addDispCoordX(_ x: Float, y: Float, z: Float)
  • Add a display space coordinate, but use doubles for precision.

    Declaration

    Objective-C

    - (void)addDispCoordDoubleX:(double)x y:(double)y z:(double)z;

    Swift

    func addDispCoordDoubleX(_ x: Double, y: Double, z: Double)
  • Add a color, which will be converted to 8 bits before going to the shader.

    Declaration

    Objective-C

    - (void)addColorR:(float)r g:(float)g b:(float)b a:(float)a;

    Swift

    func addColorR(_ r: Float, g: Float, b: Float, a: Float)
  • Add a new attribute array of the given type.

    If you have a custom shader, this is a convenient way to pass a large array of attributes to it. Just specify the name (attribute name in the shader) and the type and then add the appropriate values. The data will be handed down to the shader at render time.

    Declaration

    Objective-C

    - (int)addAttributeType:(NSString *_Nonnull)attrName
                       type:(MaplyShaderAttrType)type;

    Swift

    func addAttributeType(_ attrName: String, type: MaplyShaderAttrType) -> Int32

    Parameters

    attrName

    The name of the attribute as used by the shader.

    type

    The data type of the attribute.

    Return Value

    An index (or -1 if invalid) for the attribute. Use this in the addAttribute calls.

  • Add an integer attribute.

    Declaration

    Objective-C

    - (void)addAttribute:(int)whichAttr iVal:(int)val;

    Swift

    func addAttribute(_ whichAttr: Int32, iVal val: Int32)
  • Add a float attribute.

    Declaration

    Objective-C

    - (void)addAttribute:(int)whichAttr fVal:(float)val;

    Swift

    func addAttribute(_ whichAttr: Int32, fVal val: Float)
  • Add a two component float attribute.

    Declaration

    Objective-C

    - (void)addAttribute:(int)whichAttr fValX:(float)valX fValY:(float)valY;

    Swift

    func addAttribute(_ whichAttr: Int32, fValX valX: Float, fValY valY: Float)
  • Add a three component float attribute.

    Declaration

    Objective-C

    - (void)addAttribute:(int)whichAttr
                   fValX:(float)fValX
                   fValY:(float)valY
                   fValZ:(float)valZ;

    Swift

    func addAttribute(_ whichAttr: Int32, fValX: Float, fValY valY: Float, fValZ valZ: Float)
  • Add a three component float attribute, but we’ll store it at doubles until it gets to the shader.

    Declaration

    Objective-C

    - (void)addAttribute:(int)whichAttr
                    valX:(double)valX
                    valY:(double)valY
                    valZ:(double)valZ;

    Swift

    func addAttribute(_ whichAttr: Int32, valX: Double, valY: Double, valZ: Double)
  • Add a four commponent float attribute.

    Declaration

    Objective-C

    - (void)addAttribute:(int)whichAttr
                   fValX:(float)valX
                   fValY:(float)valY
                   fValZ:(float)valZ
                   fValW:(float)valW;

    Swift

    func addAttribute(_ whichAttr: Int32, fValX valX: Float, fValY valY: Float, fValZ valZ: Float, fValW valW: Float)