MaplyVertexAttribute

Objective-C

@interface MaplyVertexAttribute : NSObject

Swift

class MaplyVertexAttribute

Vertex Attributes are passed all the way though on objects to shaders.

If you have your own custom shader, you often need a way to feed it data. The toolkit will set up the standard data, like vertices, texture coordinates and normals, but sometimes you need something custom.

Vertex attributes are the mechanism you use to pass that custom data all the way down to the shader.

How the vertex attributes are used depends on the data type, so consult the appropriate object.

  • Construct a vertex attribute as a single float

    Declaration

    Objective-C

    - (nonnull instancetype)initWithName:(NSString *_Nonnull)name
                                    slot:(int)slot
                                   float:(float)val;

    Swift

    init(name: Any!, slot: Int32, float val: Float)
  • Construct a vertex attribute as two floats

    Declaration

    Objective-C

    - (nonnull instancetype)initWithName:(NSString *_Nonnull)name
                                    slot:(int)slot
                                  floatX:(float)x
                                       y:(float)y;

    Swift

    init(name: Any!, slot: Int32, floatX x: Float, y: Float)
  • Construct a vertex attribute as three flaots

    Declaration

    Objective-C

    - (nonnull instancetype)initWithName:(NSString *_Nonnull)name
                                    slot:(int)slot
                                  floatX:(float)x
                                       y:(float)y
                                       z:(float)z;

    Swift

    init(name: Any!, slot: Int32, floatX x: Float, y: Float, z: Float)
  • Construct a vertex attribute as an RGBA value

    Declaration

    Objective-C

    - (nonnull instancetype)initWithName:(NSString *_Nonnull)name
                                    slot:(int)slot
                                   color:(id)color;

    Swift

    init(name: Any!, slot: Int32, color: Any!)
  • Construct a vertex attribute as an int

    Declaration

    Objective-C

    - (nonnull instancetype)initWithName:(NSString *_Nonnull)name
                                    slot:(int)slot
                                     int:(int)val;

    Swift

    init(name: Any!, slot: Int32, int val: Int32)