I have a situation where I have two identical storage containers:
SOVector3 is part of a namespace with specialized functions that are generic and intended for multiplatform usage.Code:////////////// multiplatform version union _SOVector3 { struct { float x, y, z; }; struct { float r, g, b; }; float v[3]; }; typedef union _SOVector3 SOVector3; ////////////// GLKit version version union _GLKVector3 { struct { float x, y, z; }; struct { float r, g, b; }; float v[3]; }; typedef union _GLKVector3 GLKVector3;
GLKVector3 is dedicated to the Mac and has its own set of functions.
But what I want to do is freely interchange the storage between these two namespaces. Such as like this:
But I am getting errors when I typecast this. Wonder if any c++ experts might have some advice.Code:start = clock(); SOVector4 myVec4 = SOVector4Make(1.0f, 3.0, 6.0f, 1.0); SOMatrix4 myMat4 = SOMatrix4Identity; for (uint i=0; i<100000; ++i ) { GLKVector4 result = GLKMatrix4MultiplyVector4((GLKVector4)myVec4, (GLKMatrix4)myMat4); } end = clock(); diff = difftime(end, start) / CLOCKS_PER_SEC; printf("GLK time to run: %f\n",diff);


Reply With Quote


Bookmarks