This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SimpleGLObject.m | |
// NSMeetupExample | |
// | |
// Created by [email protected] on 8/6/13. | |
// | |
#import "SimpleGLObject.h" | |
#import <GLKit/GLKit.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// FlexiVertexBuffer.h | |
// NSMeetupExample | |
// | |
// Created by [email protected] on 8/6/13. | |
// | |
#import <UIKit/UIKit.h> | |
#import "SimpleGLObject.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// FlexiVertexBuffer.m | |
// NSMeetupExample | |
// | |
// Created by [email protected] on 8/6/13. | |
// | |
#import "FlexiVertexBuffer.h" | |
GLfloat gCubeVertexData[216] = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.m | |
// NSMeetupExample | |
// | |
// Created by [email protected] on 8/6/13. | |
// | |
#import "ViewController.h" | |
#import "SimpleGLObject.h" | |
#import "FlexiVertexBuffer.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Number of samples in each direction | |
static const int LongitudeSample=20,LatitudeSample=10; | |
- (void)addSphereAt:(float *)org sized:(float *)size | |
{ | |
// We'll generate the coordinates and normals ahead of time | |
float coords[3*LongitudeSample*LatitudeSample]; | |
float norms[3*LongitudeSample*LatitudeSample]; | |
float texCoords[2*LongitudeSample*LatitudeSample]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a single sphere, with texture | |
- (void)setupTexturedSphere | |
{ | |
// We need an earth texture | |
NSError *error = nil; | |
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"NaturalEarth" ofType:@"tif"]; | |
texture = [GLKTextureLoader textureWithContentsOfFile:filePath options:nil error:&error]; | |
// A single cube, centered at the origin | |
float origin[3] = {0,0.5,0}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set up the vertex array (note this can only be done on the main thread) | |
- (void)makeVertexArray | |
{ | |
// Create a vertex array object and set up its internal state | |
glGenVertexArraysOES(1, &_vertexArray); | |
glBindVertexArrayOES(_vertexArray); | |
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); | |
// Normally you'd have to do this each time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For elevation mode, we need to do some other stuff | |
if (startupMapType == MaplyGlobeWithElevation) | |
{ | |
// Tilt, so we can see it | |
if (globeViewC) | |
[globeViewC setTiltMinHeight:0.001 maxHeight:0.04 minTilt:1.21771169 maxTilt:0.0]; | |
globeViewC.frameInterval = 2; // 30fps | |
// An elevation source. This one just makes up sine waves to get some data in there | |
elevSource = [[MaplyElevationDatabase alloc] initWithName:@"world_web_mercator"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** The Elevation Source Delegate provides elevation data on demand for | |
a given tile. It returns a MaplyElevationChunk or nil if no data | |
is available. Your delegate may be called on a random thread, act accordingly. | |
*/ | |
@protocol MaplyElevationSourceDelegate | |
/// Coordinate system we're providing the data in (and extents) | |
- (MaplyCoordinateSystem *)getCoordSystem; | |
/// Minimum zoom level (e.g. 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"styles" : | |
[ | |
{ | |
"name": "fire station", | |
"type": "marker", | |
"color": "#FFFFFFFF", | |
"sizeX": 20.0, | |
"sizeY": 20.0, | |
"fade": 0.5, | |
"icon": "fire_station.png" |