C语言返回值不能直接写数组
#ifndef _VMATH_H #define _VMATH_H #ifdef _cplusplus extern "C" { #endif typedef float Matrix44f[16]; Matrix44f translate(float x, float y, float z); Matrix44f scale(float x, float y, float z); Matrix44f rotateX(float radian); Matrix44f rotateY(float radian); Matrix44f rotateZ(float radian); Matrix44f rotateXYZ(float radian, float x, float y, float z); Matrix44f perspectiveFrustum( float left, float right, float top, float bottom, float near, float far); //透视投影 Matrix44f orthoPerspect( float left, float right, float top, float bottom, float near, float far); //正交投影 #ifdef _cplusplus } #endif #endif
如上写法编译器会报错,可改为指针类型.
float *translate(float x, float y, float z);