This file contains hidden or 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
const NSUInteger testCount = 1000000; | |
{ | |
GLKMatrix4 m = M; // Initialized from a global to prevent constant folding when inlining. | |
CFAbsoluteTime t = CFAbsoluteTimeGetCurrent(); | |
for (NSUInteger i = 0; i < testCount; i++) { | |
m = GLKMatrix4Multiply(m, m); | |
} | |
NSLog(@"time GLKit: %f", CFAbsoluteTimeGetCurrent() - t); | |
M = m; // Need to save the value of m to avoid it being optimized away |
This file contains hidden or 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
// This is a little annoying: | |
cpVect *hullVerts = (cpVect *)calloc(NUM_VERTS, sizeof(cpVect)); | |
int hullCount = cpConvexHull(NUM_VERTS, verts, hullVerts, NULL, 0.0); | |
cpFloat mass = 1.0; | |
cpFloat moment = cpMomentForPoly(mass, hullCount, hullVerts, cpvzero); | |
body = cpSpaceAddBody(space, cpBodyNew(mass, moment)); | |
shape = cpSpaceAddShape(space, cpPolyShapeNew(body, hullCount, hullVerts, cpvzero)); |