00001 #include <clu.h>
00002
00003
00004 #define _CLU_FREAD(ptr, size, nmemb, stream) \
00005 do { \
00006 if ((fread((ptr), (size), (nmemb), (stream)) * (size)) \
00007 < ((nmemb) * (size))) \
00008 return GL_FALSE; \
00009 } while(0)
00010
00011 GLboolean cluReadQuaternion(CLUquaternion* src, FILE* file)
00012 {
00013 if (!src)
00014 return GL_FALSE;
00015
00016 _CLU_FREAD(src, sizeof(CLUquaternion), 1, file);
00017
00018 return GL_TRUE;
00019 }
00020
00021 GLboolean cluReadPlane(CLUplane* src, FILE* file)
00022 {
00023 if (!src)
00024 return GL_FALSE;
00025
00026 _CLU_FREAD(src, sizeof(CLUplane), 1, file);
00027
00028 return GL_TRUE;
00029 }
00030
00031 GLboolean cluReadSphere(CLUsphere* src, FILE* file)
00032 {
00033 if (!src)
00034 return GL_FALSE;
00035
00036 _CLU_FREAD(src, sizeof(CLUsphere), 1, file);
00037
00038 return GL_TRUE;
00039 }
00040
00041 GLboolean cluReadCone(CLUcone* src, FILE* file)
00042 {
00043 if (!src)
00044 return GL_FALSE;
00045
00046 _CLU_FREAD(src, sizeof(CLUcone), 1, file);
00047
00048 return GL_TRUE;
00049 }
00050
00051 GLboolean cluReadRay(CLUray* src, FILE* file)
00052 {
00053 if (!src)
00054 return GL_FALSE;
00055
00056 _CLU_FREAD(src, sizeof(CLUray), 1, file);
00057
00058 return GL_TRUE;
00059 }
00060
00061 GLboolean cluReadAlignedBox(CLUalignedbox* src, FILE* file)
00062 {
00063 if (!src)
00064 return GL_FALSE;
00065
00066 _CLU_FREAD(src, sizeof(CLUalignedbox), 1, file);
00067
00068 return GL_TRUE;
00069 }