Convert GLKMatrix4 and CATransform3D

前端 未结 2 521
遇见更好的自我
遇见更好的自我 2021-01-06 03:03

Is there a way to cast from CATransform3D to GLKMatrix4, or do I always need to manually convert them from value to value? I guess casting would be faster.

2条回答
  •  梦毁少年i
    2021-01-06 03:36

    Something like this should work:

    CATransform3D t;
    GLKMatrix4 t2 = *((GLKMatrix4 *)&t);
    t = *((CATransform3D *)&t2);
    

    Assuming CATransform3d and GLKMatrix4 have the same column/row setup. (I think so)

提交回复
热议问题