00001 00002 #ifndef _LODESTONE_H_ 00003 #define _LODESTONE_H_ 00004 00005 /* gl.h has to be loaded before this header. As many systems have different 00006 conventions how to do that, it is not done here */ 00007 00008 #ifdef __cplusplus 00009 extern "C" { 00010 #endif 00011 00012 /* Types */ 00013 00014 typedef void *lsNode; 00015 typedef void *lsGroup; 00016 typedef void *lsGeometry; 00017 typedef void *lsStateSet; 00018 typedef void *lsTexture; 00019 typedef void *lsLightSource; 00020 typedef void *lsTransformation; 00021 00022 /* Version Info */ 00023 00024 #define LS_MAJOR_VERSION 0 00025 #define LS_MINOR_VERSION 1 00026 00027 /* Interface Structure */ 00028 00029 typedef struct lsInterface 00030 { 00031 /* General Interface Access */ 00032 00033 int (*getMajorVersion)(void); 00034 int (*getMinorVersion)(void); 00035 00036 int (*hasExtension)(const char *name); 00037 void *(*getExtensionFunction)(const char *name); 00038 00039 00040 /* File Handling */ 00041 00042 char *(*findFile)(const char *name); 00043 00044 00045 /* General Node Functions */ 00046 00047 void (*setName)(lsNode node, const char *name); 00048 00049 00050 /* Group Functions */ 00051 00052 lsGroup (*createGroup)(void); 00053 void (*addChild)(lsGroup group, lsNode node); 00054 00055 00056 /* Geometry Functions */ 00057 00058 lsGeometry (*createGeometry)(void); 00059 00060 void (*setVertexCount)(lsGeometry geo, int n); 00061 void (*setVertices)(lsGeometry geo, GLfloat *v); 00062 void (*addVertex)(lsGeometry geo, GLfloat *v); 00063 00064 void (*setNormalCount)(lsGeometry geo, int n); 00065 void (*setNormals)(lsGeometry geo, GLfloat *v); 00066 void (*addNormal)(lsGeometry geo, GLfloat *v); 00067 00068 void (*setColorCount)(lsGeometry geo, int n); 00069 void (*setColors)(lsGeometry geo, GLfloat *v); 00070 void (*addColor)(lsGeometry geo, GLfloat *v); 00071 00072 void (*setTexCoordCount)(lsGeometry geo, int n); 00073 void (*setTexCoords)(lsGeometry geo, GLfloat *); 00074 void (*addTexCoord)(lsGeometry geo, GLfloat *v); 00075 00076 void (*addFace)(lsGeometry geo, GLenum type, int n, GLuint *indices); 00077 00078 void (*closeGeometry)(lsStateSet set); 00079 00080 00081 /* State Set Functions */ 00082 00083 lsStateSet (*createStateSet)(void); 00084 00085 void (*openStateSet)(lsStateSet set); 00086 00087 void (*stateEnable)(lsStateSet set, GLenum value); 00088 void (*stateMaterialfv)(lsStateSet set, GLenum face, GLenum pname, 00089 GLfloat *values); 00090 void (*stateMaterialf)(lsStateSet set, GLenum face, GLenum pname, 00091 GLfloat value); 00092 void (*stateColorMaterial)(lsStateSet set, GLenum face, GLenum value); 00093 void (*statePolygonOffset)(lsStateSet set, GLfloat factor, GLfloat bias); 00094 void (*statePolygonMode)(lsStateSet set, GLenum face, GLenum value); 00095 void (*stateCullFace)(lsStateSet set, GLenum face); 00096 void (*stateSetTexture)(lsStateSet set, lsTexture tex); 00097 00098 void (*closeStateSet)(lsStateSet set); 00099 00100 void (*activateStateSet)(lsStateSet set); 00101 00102 00103 /* Texture Functions */ 00104 00105 lsTexture (*createTexture)(void); 00106 00107 void (*texSetImage)(lsTexture tex, const char *filename); 00108 void (*texParameterf)(lsTexture tex, GLenum pname, GLfloat value); 00109 void (*texEnvf)(lsTexture tex, GLenum pname, GLfloat value); 00110 void (*texEnvfv)(lsTexture tex, GLenum pname, GLfloat *values); 00111 void (*texGenf)(lsTexture tex, GLenum coord, GLenum pname, GLfloat value); 00112 void (*texGenfv)(lsTexture tex, GLenum coord, GLenum pname, GLfloat *values); 00113 00114 void (*closeTexture)(lsTexture tex); 00115 00116 00117 /* Transformation Functions */ 00118 00119 lsTransformation (*createTransformation)(void); 00120 00121 void (*setTransformation)(lsTransformation trans, GLdouble *matrix); 00122 00123 00124 /* Light Source Functions */ 00125 00126 lsLightSource (*createLightSource)(void); 00127 00128 void (*lightfv)(lsLightSource source, GLenum pname, GLfloat *values); 00129 void (*lightf) (lsLightSource source, GLenum pname, GLfloat value); 00130 00131 void (*closeLightSource)(lsLightSource source); 00132 00133 00134 } lsInterface; 00135 00136 /* get the interface */ 00137 00138 lsInterface *lsGetInterface(void); 00139 00140 00141 #ifdef __cplusplus 00142 } 00143 #endif 00144 00145 #endif /* _LODESTONE_H_ */