Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

132 lines
4.5 KiB

  1. /**************************************************************************
  2. * *
  3. * Copyright (C) 1989, Silicon Graphics, Inc. *
  4. * *
  5. * These coded instructions, statements, and computer programs contain *
  6. * unpublished proprietary information of Silicon Graphics, Inc., and *
  7. * are protected by Federal copyright law. They may not be disclosed *
  8. * to third parties or copied or duplicated in any form, in whole or *
  9. * in part, without the prior written consent of Silicon Graphics, Inc. *
  10. * *
  11. **************************************************************************/
  12. #ifndef MONOTONE_H
  13. #define MONOTONE_H
  14. /* monotone.h */
  15. /* Derrick Burns - 1989 */
  16. #include <assert.h>
  17. #include <setjmp.h>
  18. #include <stdio.h>
  19. #include "triangul.h"
  20. #define INITVERTS 256
  21. #define INITVPSIZE 256
  22. #define VC_BAD 0x01
  23. #define VC_OK 0x02
  24. #define VC_LEFT 0x04
  25. #define VC_RIGHT 0x08
  26. #define VC_TOP 0x10
  27. #define VC_BOTTOM 0x20
  28. #define VC_LONE 0x40
  29. #define VC_ERROR 0x80
  30. enum _Vertclass {
  31. VC_NO_CLASS = 0,
  32. VC_OK_RIGHT = VC_OK | VC_RIGHT,
  33. VC_OK_LEFT = VC_OK | VC_LEFT,
  34. VC_OK_TOP = VC_OK | VC_TOP,
  35. VC_OK_BOTTOM = VC_OK | VC_BOTTOM,
  36. VC_BAD_RIGHT = VC_BAD | VC_RIGHT,
  37. VC_BAD_LEFT = VC_BAD | VC_LEFT,
  38. VC_BAD_LONE = VC_BAD | VC_LONE,
  39. VC_BAD_ERROR = VC_BAD | VC_ERROR
  40. };
  41. typedef enum _Vertclass Vertclass;
  42. typedef struct Vert {
  43. struct Vert *next;
  44. struct Vert *prev;
  45. struct Ray *ray;
  46. Vertclass vclass;
  47. #ifdef ADDED
  48. char added;
  49. #endif
  50. void *myid;
  51. void *nextid;
  52. float s;
  53. float t;
  54. double v[3];
  55. void *data;
  56. } Vert;
  57. typedef struct Ray {
  58. struct Ray *next;
  59. struct Ray *prev;
  60. struct Vert *vertex;
  61. #ifdef LAZYRECALC
  62. struct Vert *end1; /* ray's zNear endpoint */
  63. struct Vert *end2; /* ray's zFar endpoint */
  64. #endif
  65. int orientation;
  66. int mustconnect; /* 1 if mustconnect, 0 otherwise */
  67. float coords[3]; /* ax + by + c. Assume b >= 0. */
  68. } Ray;
  69. extern void __gl_init_verts( GLUtriangulatorObj * );
  70. extern void __gl_free_verts( GLUtriangulatorObj * );
  71. extern Vert *__gl_new_vert( GLUtriangulatorObj * );
  72. extern Vert *__gl_first_vert( Vert * );
  73. extern Vert *__gl_last_vert( Vert * );
  74. extern short __gl_ccw_vert( Vert * );
  75. extern void __gl_reverse_vert( Vert * );
  76. extern void __gl_checkray_vert( GLUtriangulatorObj *, Vert *, Ray *, Ray * );
  77. extern long __gl_orient_vert( Vert *, GLenum );
  78. extern Ray * __gl_new_ray( GLUtriangulatorObj *, int );
  79. extern int __gl_above_ray( Ray *, Vert * );
  80. extern void __gl_recalc_ray( Ray *, Vert *, Vert * );
  81. extern void __gl_init_raylist( GLUtriangulatorObj * );
  82. extern void __gl_add2_raylist( Ray *, Ray *, Ray * );
  83. extern void __gl_remove2_raylist( GLUtriangulatorObj *, Ray * );
  84. extern void __gl_delete_ray( GLUtriangulatorObj *, Ray * );
  85. extern Ray *__gl_findray_raylist( GLUtriangulatorObj *, Vert *v);
  86. extern void __gl_free_raylist( GLUtriangulatorObj * );
  87. extern void __gl_clear_triangulate( GLUtriangulatorObj * );
  88. extern void __gl_triangulate( GLUtriangulatorObj *, Vert *, long );
  89. extern void __gl_checktriangulate( GLUtriangulatorObj *, Vert * );
  90. extern void __gl_init_priorityq( GLUtriangulatorObj *, long );
  91. extern void __gl_add_priorityq( GLUtriangulatorObj *,Vert *v );
  92. extern int __gl_more_priorityq( GLUtriangulatorObj * );
  93. extern void __gl_sort_priorityq( GLUtriangulatorObj * );
  94. extern Vert * __gl_remove_priorityq( GLUtriangulatorObj * );
  95. extern void __gl_free_priorityq( GLUtriangulatorObj * );
  96. extern void __gl_unclassify_all( Vert * );
  97. extern int __gl_classify_all( Vert * );
  98. extern void __gl_monotonize( GLUtriangulatorObj * );
  99. extern void __gl_clear_sort( GLUtriangulatorObj * );
  100. extern void __gl_triangulateloop( GLUtriangulatorObj *, Vert *);
  101. #ifndef NT
  102. #define mymalloc malloc
  103. #define myfree free
  104. #define myrealloc realloc
  105. #else
  106. #include <windows.h>
  107. #define mymalloc(size) LocalAlloc(LMEM_FIXED, (size))
  108. #define myfree(p) LocalFree((p))
  109. #define myrealloc(p, size) LocalReAlloc((p), (size), LMEM_MOVEABLE)
  110. #endif
  111. #endif