feat():initial version
This commit is contained in:
159
insDavi2.0/include/lib/InsMatrix.h
Normal file
159
insDavi2.0/include/lib/InsMatrix.h
Normal file
@@ -0,0 +1,159 @@
|
||||
#ifndef INSMATRIX_H_INCLUDED
|
||||
#define INSMATRIX_H_INCLUDED
|
||||
|
||||
#include <InsCfg.h>
|
||||
#include <BaseTypes.h>
|
||||
|
||||
#ifdef COMPILE_IN_WINDOWS
|
||||
|
||||
#include <windows.h>
|
||||
#define GLEW_STATIC
|
||||
#include <GL/glew.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
|
||||
#endif // COMPILE_IN_WINDOWS
|
||||
|
||||
#ifndef LoadIdentityMatrix
|
||||
|
||||
#define LoadIdentityMatrix(mat4x4) do{\
|
||||
mat4x4[ 0] = 1.0f; mat4x4[ 1] = 0.0f; mat4x4[ 2] = 0.0f; mat4x4[ 3] = 0.0f; \
|
||||
mat4x4[ 4] = 0.0f; mat4x4[ 5] = 1.0f; mat4x4[ 6] = 0.0f; mat4x4[ 7] = 0.0f; \
|
||||
mat4x4[ 8] = 0.0f; mat4x4[ 9] = 0.0f; mat4x4[10] = 1.0f; mat4x4[11] = 0.0f; \
|
||||
mat4x4[12] = 0.0f; mat4x4[13] = 0.0f; mat4x4[14] = 0.0f; mat4x4[15] = 1.0f;}while(0)
|
||||
|
||||
#endif // LoadIdentityMatrix
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GLfloat mat[MAX_MATRIX4x4STACK_DEPTH][4*4];
|
||||
GLint idx;
|
||||
} Matrix4x4Stack;
|
||||
|
||||
#define StackMat(stack) ((stack).mat[(stack).idx])
|
||||
|
||||
#define ReSetMatStack(stack) (stack).idx = (0)
|
||||
|
||||
#define PushMatrix4x4Stack(stack) do\
|
||||
{\
|
||||
if((stack).idx+1 < MAX_MATRIX4x4STACK_DEPTH)\
|
||||
{\
|
||||
CopyMatrix4x4((stack).mat[(stack).idx+1], (stack).mat[(stack).idx]);\
|
||||
(stack).idx += 1;\
|
||||
}\
|
||||
}while(0)
|
||||
|
||||
#define PopMatrix4x4Stack(stack) do{if((stack).idx > 0){(stack).idx -= (1);}}while(0)
|
||||
|
||||
GLfloat *MultMatrix4x4
|
||||
(
|
||||
GLfloat *matC,
|
||||
GLfloat *matA,
|
||||
GLfloat *matB
|
||||
);
|
||||
|
||||
GLfloat *MultMatrix4x4Vec4x1
|
||||
(
|
||||
GLfloat *vecB,
|
||||
GLfloat *matA,
|
||||
GLfloat *vecA
|
||||
);
|
||||
|
||||
GLfloat *CopyMatrix4x4
|
||||
(
|
||||
GLfloat *matDes,
|
||||
GLfloat *matSrc
|
||||
);
|
||||
|
||||
Bool InvertMatrix4x4
|
||||
(
|
||||
GLfloat *inverse,
|
||||
GLfloat *src
|
||||
);
|
||||
|
||||
GLfloat *SetRotateMat4x4
|
||||
(
|
||||
GLfloat *mat4x4,
|
||||
Vec3f *axis_nor,
|
||||
GLfloat angle
|
||||
);
|
||||
|
||||
GLfloat *RotateMat4x4
|
||||
(
|
||||
GLfloat *mat4x4,
|
||||
Vec3f *axis_nor,
|
||||
GLfloat angle
|
||||
);
|
||||
|
||||
GLfloat *SetRotateMatrix4x4_X_Axis
|
||||
(
|
||||
GLfloat *mat4x4,
|
||||
GLfloat angle
|
||||
);
|
||||
|
||||
GLfloat *RotateMatrix4x4_X_Axis
|
||||
(
|
||||
GLfloat *mat4x4,
|
||||
GLfloat angle
|
||||
);
|
||||
|
||||
GLfloat *SetRotateMatrix4x4_Y_Axis
|
||||
(
|
||||
GLfloat *mat4x4,
|
||||
GLfloat angle
|
||||
);
|
||||
|
||||
GLfloat *RotateMatrix4x4_Y_Axis
|
||||
(
|
||||
GLfloat *mat4x4,
|
||||
GLfloat angle
|
||||
);
|
||||
|
||||
GLfloat *SetRotateMatrix4x4_Z_Axis
|
||||
(
|
||||
GLfloat *mat4x4,
|
||||
GLfloat angle
|
||||
);
|
||||
|
||||
GLfloat *RotateMatrix4x4_Z_Axis
|
||||
(
|
||||
GLfloat *mat4x4,
|
||||
GLfloat angle
|
||||
);
|
||||
|
||||
GLfloat *SetTranslateMatrix4x4
|
||||
(
|
||||
GLfloat *mat4x4,
|
||||
GLfloat trX,
|
||||
GLfloat trY,
|
||||
GLfloat trZ
|
||||
);
|
||||
|
||||
GLfloat *TranslateMatrix4x4
|
||||
(
|
||||
GLfloat *mat4x4,
|
||||
GLfloat trX,
|
||||
GLfloat trY,
|
||||
GLfloat trZ
|
||||
);
|
||||
|
||||
GLfloat *SetScaleMatrix4x4
|
||||
(
|
||||
GLfloat *mat4x4,
|
||||
GLfloat scaleX,
|
||||
GLfloat scaleY,
|
||||
GLfloat scaleZ
|
||||
);
|
||||
|
||||
GLfloat *ScaleMatrix4x4
|
||||
(
|
||||
GLfloat *mat4x4,
|
||||
GLfloat scaleX,
|
||||
GLfloat scaleY,
|
||||
GLfloat scaleZ
|
||||
);
|
||||
|
||||
#endif // INSMATRIX_H_INCLUDED
|
||||
Reference in New Issue
Block a user