glod.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /******************************************************************************
  2. * Copyright 2003 Jonathan Cohen, Nat Duca, David Luebke, Brenden Schubert *
  3. * Johns Hopkins University and University of Virginia *
  4. ******************************************************************************
  5. * This file is distributed as part of the GLOD library, and as such, falls *
  6. * under the terms of the GLOD public license. GLOD is distributed without *
  7. * any warranty, implied or otherwise. See the GLOD license for more details. *
  8. * *
  9. * You should have recieved a copy of the GLOD Open-Source License with this *
  10. * copy of GLOD; if not, please visit the GLOD web page, *
  11. * http://www.cs.jhu.edu/~graphics/GLOD/license for more information *
  12. ******************************************************************************/
  13. /* This is the exportable header file for the use of GLOD with GL
  14. ****************************************************************************/
  15. #ifndef GLODAPI_H
  16. #define GLODAPI_H
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #ifdef _WIN32
  21. #ifdef GLOD
  22. #define GLOD_APIENTRY __declspec(dllexport)
  23. #else
  24. #define GLOD_APIENTRY __declspec(dllimport)
  25. #endif
  26. #else
  27. #define GLOD_APIENTRY
  28. #endif
  29. /* GLOD Errors
  30. ***************************************************************************/
  31. #define GLOD_NO_ERROR 0x000
  32. #define GLOD_INVALID_NAME 0x001
  33. #define GLOD_INVALID_DATA_FORMAT 0x002
  34. #define GLOD_INVALID_STATE 0x003
  35. #define GLOD_INVALID_PATCH 0x004
  36. #define GLOD_UNKNOWN_PROPERTY 0x005
  37. #define GLOD_UNSUPPORTED_PROPERTY 0x006
  38. #define GLOD_INVALID_PARAM 0x007
  39. #define GLOD_BAD_HIERARCHY 0x020
  40. #define GLOD_BAD_MAGIC 0x050
  41. #define GLOD_CORRUPT_BUFFER 0x051
  42. /* NewObject Formats
  43. ***************************************************************************/
  44. /// reserved for glod_core.h::GLOD_FORMAT_UNKNOWN
  45. #define GLOD_RESERVED 0x0000
  46. #ifdef GLOD_COREPROFILE_FIXED
  47. #define GLOD_CONTINUOUS 0x0001
  48. #endif
  49. #define GLOD_DISCRETE 0x0002
  50. #define GLOD_DISCRETE_MANUAL 0x0003
  51. #define GLOD_DISCRETE_PATCH 0x0004
  52. #ifdef GLOD_COREPROFILE_FIXED
  53. #define GLOD_VDS 0x0001
  54. #endif
  55. /* Object Param Names
  56. ***************************************************************************/
  57. #define GLOD_READBACK_SIZE 0x01
  58. #define GLOD_NUM_PATCHES 0x02
  59. #define GLOD_PATCH_NAMES 0x03
  60. #define GLOD_PATCH_SIZES 0x04
  61. #define GLOD_XFORM_MATRIX 0x05
  62. #define GLOD_BUILD_OPERATOR 0x20
  63. #define GLOD_BUILD_QUEUE_MODE 0x21
  64. #define GLOD_BUILD_ERROR_METRIC 0x22
  65. #define GLOD_BUILD_SHARE_TOLERANCE 0x23
  66. #define GLOD_BUILD_BORDER_MODE 0x24
  67. #define GLOD_BUILD_SNAPSHOT_MODE 0x25
  68. #define GLOD_BUILD_PERCENT_REDUCTION_FACTOR 0x26
  69. #define GLOD_BUILD_TRI_SPECS 0x27
  70. #define GLOD_BUILD_ERROR_SPECS 0x28
  71. #define GLOD_BUILD_PERMISSION_GRID_PRECISION 0x29
  72. #define GLOD_QUADRIC_MULTIPLIER 0x2a
  73. #define GLOD_XFORM 0x41
  74. #define GLOD_APPLY_OBJECT_XFORM 0x42
  75. #define GLOD_IMPORTANCE 0x50
  76. /* Object::Possible Param Values
  77. ***************************************************************************/
  78. #define GLOD_OPERATOR_MANUAL 0x00
  79. #define GLOD_OPERATOR_HALF_EDGE_COLLAPSE 0x01
  80. #define GLOD_OPERATOR_EDGE_COLLAPSE 0x02
  81. #define GLOD_OPERATOR_VERTEX_PAIR 0x03
  82. #define GLOD_OPERATOR_VERTEX_CLUSTER 0x04
  83. #define GLOD_QUEUE_GREEDY 0x01
  84. #define GLOD_QUEUE_LAZY 0x02
  85. #define GLOD_QUEUE_INDEPENDENT 0x03
  86. #define GLOD_QUEUE_RANDOMIZED 0x04
  87. #define GLOD_METRIC_SPHERES 0x01
  88. #define GLOD_METRIC_QUADRICS 0x02
  89. #define GLOD_METRIC_PERMISSION_GRID 0x03
  90. #define GLOD_BORDER_UNLOCK 0x01
  91. #define GLOD_BORDER_LOCK 0x02
  92. #define GLOD_SNAPSHOT_PERCENT_REDUCTION 0x01
  93. #define GLOD_SNAPSHOT_TRI_SPEC 0x02
  94. #define GLOD_SNAPSHOT_ERROR_SPEC 0x03
  95. /* GLOD Group Params
  96. ***************************************************************************/
  97. #define GLOD_ADAPT_MODE 0x01
  98. #define GLOD_ERROR_MODE 0x02
  99. #define GLOD_OBJECT_SPACE_ERROR_THRESHOLD 0x03
  100. #define GLOD_SCREEN_SPACE_ERROR_THRESHOLD 0x04
  101. #define GLOD_MAX_TRIANGLES 0x05
  102. /* Group::Possible Param Values
  103. ***************************************************************************/
  104. #define GLOD_ERROR_THRESHOLD 0x01
  105. #define GLOD_TRIANGLE_BUDGET 0x02
  106. #define GLOD_OBJECT_SPACE_ERROR 0x03
  107. #define GLOD_SCREEN_SPACE_ERROR 0x04
  108. struct glodVBO
  109. {
  110. struct VertexArray
  111. {
  112. void* p; GLint size; GLenum type; GLsizei stride;
  113. } mV;
  114. struct NormalArray
  115. {
  116. void* p; GLenum type; GLsizei stride;
  117. } mN;
  118. struct TextureArray
  119. {
  120. void* p; GLint size; GLenum type; GLsizei stride;
  121. } mT;
  122. struct ColorArray
  123. {
  124. void* p; GLint size; GLenum type; GLsizei stride;
  125. } mC;
  126. };
  127. GLOD_APIENTRY GLuint glodInit( );
  128. GLOD_APIENTRY void glodShutdown( );
  129. GLOD_APIENTRY GLuint glodGetError( void );
  130. GLOD_APIENTRY void glodLoadObject( GLuint name, GLuint groupname,
  131. const GLvoid *data );
  132. GLOD_APIENTRY void glodReadbackObject( GLuint name, GLvoid *data );
  133. GLOD_APIENTRY void glodFillArrays( GLuint object_name, GLuint patch_name, glodVBO *pVBO );
  134. GLOD_APIENTRY void glodFillElements( GLuint object_name, GLuint patch_name, GLenum type, GLvoid* out_elements, glodVBO *pVBO );
  135. GLOD_APIENTRY void glodInsertArrays( GLuint name, GLuint patchname,
  136. GLenum mode, GLint first, GLsizei count,
  137. GLuint level, GLfloat geometric_error, glodVBO *pVBO );
  138. GLOD_APIENTRY void glodInsertElements( GLuint name, GLuint patchname,
  139. GLenum mode, GLuint count, GLenum type, GLvoid *indices,
  140. GLuint level, GLfloat geometric_error, glodVBO *pVBO );
  141. GLOD_APIENTRY void glodInstanceObject( GLuint name, GLuint instancename,
  142. GLuint groupname );
  143. GLOD_APIENTRY void glodNewObject( GLuint name, GLuint groupname,
  144. GLenum format );
  145. GLOD_APIENTRY void glodBuildObject( GLuint name );
  146. GLOD_APIENTRY void glodDeleteObject( GLuint name );
  147. GLOD_APIENTRY void glodDrawPatch( GLuint name, GLuint patchname );
  148. GLOD_APIENTRY void glodSetLayout(int rows, int cols);
  149. GLOD_APIENTRY void glodNewGroup( GLuint groupname );
  150. GLOD_APIENTRY void glodAdaptGroup( GLuint groupname );
  151. GLOD_APIENTRY void glodObjectXform( GLuint object_name, float m1[16],
  152. float m2[16], float m3[16] );
  153. GLOD_APIENTRY void glodDeleteGroup( GLuint groupname );
  154. GLOD_APIENTRY void glodObjectParameterf( GLuint name, GLenum pname,
  155. GLfloat param );
  156. GLOD_APIENTRY void glodObjectParameteri( GLuint name, GLenum pname,
  157. GLint param );
  158. GLOD_APIENTRY void glodObjectParameteriv( GLuint name, GLenum pname,
  159. GLint count, GLint *param );
  160. GLOD_APIENTRY void glodObjectParameterfv( GLuint name, GLenum pname,
  161. GLint count, GLfloat *param );
  162. GLOD_APIENTRY void glodPatchParameterf( GLuint name, GLuint patch_name,
  163. GLenum pname, GLfloat param );
  164. GLOD_APIENTRY void glodPatchParameteri( GLuint name, GLuint patch_name,
  165. GLenum pname, GLint param );
  166. GLOD_APIENTRY void glodGetGroupParameterfv( GLuint groupname, GLenum pname,
  167. GLfloat *param );
  168. GLOD_APIENTRY void glodGetGroupParameteriv( GLuint groupname, GLenum pname,
  169. GLint *param );
  170. GLOD_APIENTRY void glodGetObjectParameterfv( GLuint groupname, GLenum pname,
  171. GLfloat *param );
  172. GLOD_APIENTRY void glodGetObjectParameteriv( GLuint groupname, GLenum pname,
  173. GLint *param );
  174. GLOD_APIENTRY void glodGetPatchParameterfv( GLuint name, GLuint patch_name,
  175. GLenum pname, GLfloat*param );
  176. GLOD_APIENTRY void glodGetPatchParameteriv( GLuint name, GLuint patch_name,
  177. GLenum pname, GLint*param );
  178. GLOD_APIENTRY void glodGroupParameterf( GLuint groupname, GLenum pname,
  179. GLfloat param );
  180. GLOD_APIENTRY void glodGroupParameteri( GLuint groupname, GLenum pname,
  181. GLint param );
  182. GLOD_APIENTRY void glodDebugDrawObject( GLuint name ); /* debugging only */
  183. #ifdef __cplusplus
  184. } /* extern c */
  185. #endif
  186. #endif /* GLODAPI_H */