00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _SG_LOWLEVEL_HXX
00028 #define _SG_LOWLEVEL_HXX
00029
00030 #include <stdio.h>
00031 #include <zlib.h>
00032
00033 #include <plib/sg.h>
00034
00035 #include <simgear/compiler.h>
00036 #include <simgear/misc/stdint.hxx>
00037
00038
00039
00040
00041 void sgReadChar ( gzFile fd, char *var ) ;
00042 void sgWriteChar ( gzFile fd, const char var ) ;
00043 void sgReadFloat ( gzFile fd, float *var ) ;
00044 void sgWriteFloat ( gzFile fd, const float var ) ;
00045 void sgReadDouble ( gzFile fd, double *var ) ;
00046 void sgWriteDouble ( gzFile fd, const double var ) ;
00047 void sgReadUInt ( gzFile fd, unsigned int *var ) ;
00048 void sgWriteUInt ( gzFile fd, const unsigned int var ) ;
00049 void sgReadInt ( gzFile fd, int *var ) ;
00050 void sgWriteInt ( gzFile fd, const int var ) ;
00051 void sgReadLong ( gzFile fd, int32_t *var ) ;
00052 void sgWriteLong ( gzFile fd, const int32_t var ) ;
00053 void sgReadLongLong ( gzFile fd, int64_t *var ) ;
00054 void sgWriteLongLong ( gzFile fd, const int64_t var ) ;
00055 void sgReadUShort ( gzFile fd, unsigned short *var ) ;
00056 void sgWriteUShort ( gzFile fd, const unsigned short var ) ;
00057 void sgReadShort ( gzFile fd, short *var ) ;
00058 void sgWriteShort ( gzFile fd, const short var ) ;
00059
00060 void sgReadFloat ( gzFile fd, const unsigned int n, float *var ) ;
00061 void sgWriteFloat ( gzFile fd, const unsigned int n, const float *var ) ;
00062 void sgReadDouble ( gzFile fd, const unsigned int n, double *var ) ;
00063 void sgWriteDouble ( gzFile fd, const unsigned int n, const double *var ) ;
00064 void sgReadUInt ( gzFile fd, const unsigned int n, unsigned int *var ) ;
00065 void sgWriteUInt ( gzFile fd, const unsigned int n, const unsigned int *var ) ;
00066 void sgReadInt ( gzFile fd, const unsigned int n, int *var ) ;
00067 void sgWriteInt ( gzFile fd, const unsigned int n, const int *var ) ;
00068 void sgReadUShort ( gzFile fd, const unsigned int n, unsigned short *var ) ;
00069 void sgWriteUShort ( gzFile fd, const unsigned int n, const unsigned short *var ) ;
00070 void sgReadShort ( gzFile fd, const unsigned int n, short *var ) ;
00071 void sgWriteShort ( gzFile fd, const unsigned int n, const short *var ) ;
00072 void sgReadBytes ( gzFile fd, const unsigned int n, void *var ) ;
00073 void sgWriteBytes ( gzFile fd, const unsigned int n, const void *var ) ;
00074
00075 void sgReadString ( gzFile fd, char **var ) ;
00076 void sgWriteString ( gzFile fd, const char *var ) ;
00077
00078 inline void sgReadVec2 ( gzFile fd, sgVec2 var ) {
00079 sgReadFloat ( fd, 2, var ) ;
00080 }
00081 inline void sgWriteVec2 ( gzFile fd, const sgVec2 var ) {
00082 sgWriteFloat ( fd, 2, var ) ;
00083 }
00084
00085 inline void sgReadVec3 ( gzFile fd, sgVec3 var ) {
00086 sgReadFloat ( fd, 3, var ) ;
00087 }
00088 inline void sgWriteVec3 ( gzFile fd, const sgVec3 var ) {
00089 sgWriteFloat ( fd, 3, var ) ;
00090 }
00091
00092 inline void sgReaddVec3 ( gzFile fd, sgdVec3 var ) {
00093 sgReadDouble ( fd, 3, var ) ;
00094 }
00095 inline void sgWritedVec3 ( gzFile fd, const sgdVec3 var ) {
00096 sgWriteDouble ( fd, 3, var ) ;
00097 }
00098
00099 inline void sgReadVec4 ( gzFile fd, sgVec4 var ) {
00100 sgReadFloat ( fd, 4, var ) ;
00101 }
00102 inline void sgWriteVec4 ( gzFile fd, const sgVec4 var ) {
00103 sgWriteFloat ( fd, 4, var ) ;
00104 }
00105
00106 inline void sgReadMat4 ( gzFile fd, sgMat4 var ) {
00107 sgReadFloat ( fd, 16, (float *)var ) ;
00108 }
00109 inline void sgWriteMat4 ( gzFile fd, const sgMat4 var ) {
00110 sgWriteFloat ( fd, 16, (float *)var ) ;
00111 }
00112
00113 void sgClearReadError();
00114 void sgClearWriteError();
00115 int sgReadError();
00116 int sgWriteError();
00117
00118 #endif // _SG_LOWLEVEL_HXX