sgdk
|
00001 00016 #ifndef _MATHS3D_H_ 00017 #define _MATHS3D_H_ 00018 00019 00024 typedef struct 00025 { 00026 V2u16 viewport; 00027 fix16 camDist; 00028 V3f16 light; 00029 u16 lightEnabled; 00030 } Context3D; 00031 00036 typedef V3f16 Translation3D; 00037 00042 typedef V3f16 Rotation3D; 00043 00051 typedef struct 00052 { 00053 u16 rebuildMat; 00054 Translation3D* translation; 00055 Rotation3D* rotation; 00056 M3f16 mat; 00057 M3f16 matInv; 00058 V3f16 cameraInv; 00059 V3f16 lightInv; 00060 } Transformation3D; 00061 00066 void M3D_reset(); 00067 00072 void M3D_setLightEnabled(u16 enabled); 00077 u16 M3D_getLightEnabled(); 00078 00088 void M3D_setViewport(u16 w, u16 h); 00096 void M3D_setCamDistance(fix16 value); 00101 void M3D_setLightXYZ(fix16 x, fix16 y, fix16 z); 00106 void M3D_setLight(V3f16* value); 00107 00112 void M3D_resetTransform(Transformation3D* t); 00113 00118 void M3D_setTransform(Transformation3D* tr, Translation3D* t, Rotation3D *r); 00119 00124 void M3D_setTranslation(Transformation3D* t, fix16 x, fix16 y, fix16 z); 00131 void M3D_setRotation(Transformation3D* t, fix16 x, fix16 y, fix16 z); 00132 00145 void M3D_combineTransform(Transformation3D* left, Transformation3D* right, Transformation3D* result); 00158 void M3D_combineTranslationLeft(Translation3D* left, Transformation3D* right, Transformation3D* result); 00171 void M3D_combineTranslationRight(Transformation3D* left, Translation3D* right, Transformation3D* result); 00172 00181 void M3D_buildMat3D(Transformation3D* t); 00190 void M3D_buildMat3DOnly(Transformation3D* t); 00198 void M3D_buildMat3DExtras(Transformation3D* t); 00199 00211 void M3D_translate(Transformation3D* t, V3f16* vertices, u16 numv); 00225 void M3D_rotate(Transformation3D* t, const V3f16* src, V3f16* dest, u16 numv); 00237 void M3D_rotateInv(Transformation3D* t, const V3f16* src, V3f16* dest); 00251 void M3D_transform(Transformation3D* t, const V3f16* src, V3f16* dest, u16 numv); 00252 00264 void M3D_project_f16(const V3f16* src, V2f16* dest, u16 numv); 00276 void M3D_project_s16(const V3f16* src, V2s16* dest, u16 numv); 00277 00278 00279 #endif // _MATHS3D_H_