ruby-opengl 0.40.1 → 0.50.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/doc/build_install.txt +48 -28
- data/doc/extensions.txt +361 -0
- data/doc/history.txt +8 -2
- data/doc/requirements_and_design.txt +0 -13
- data/doc/roadmap.txt +11 -13
- data/doc/supplies/page_template.html +11 -5
- data/doc/thanks.txt +2 -4
- data/doc/tutorial.txt +1 -4
- data/examples/{nehe_lesson02.rb → NeHe/nehe_lesson02.rb} +0 -0
- data/examples/{nehe_lesson03.rb → NeHe/nehe_lesson03.rb} +0 -0
- data/examples/{nehe_lesson04.rb → NeHe/nehe_lesson04.rb} +0 -0
- data/examples/{nehe_lesson05.rb → NeHe/nehe_lesson05.rb} +0 -0
- data/examples/NeHe/nehe_lesson36.rb +303 -0
- data/examples/OrangeBook/3Dlabs-License.txt +33 -0
- data/examples/OrangeBook/brick.frag +36 -0
- data/examples/OrangeBook/brick.rb +388 -0
- data/examples/OrangeBook/brick.vert +41 -0
- data/examples/OrangeBook/particle.frag +17 -0
- data/examples/OrangeBook/particle.rb +424 -0
- data/examples/OrangeBook/particle.vert +38 -0
- data/examples/README +13 -83
- data/examples/RedBook/aaindex.rb +97 -0
- data/examples/RedBook/aapoly.rb +142 -0
- data/examples/RedBook/aargb.rb +119 -0
- data/examples/RedBook/accanti.rb +162 -0
- data/examples/RedBook/accpersp.rb +215 -0
- data/examples/RedBook/alpha.rb +123 -0
- data/examples/RedBook/alpha3D.rb +158 -0
- data/examples/RedBook/bezcurve.rb +105 -0
- data/examples/RedBook/bezmesh.rb +137 -0
- data/examples/RedBook/checker.rb +124 -0
- data/examples/RedBook/clip.rb +95 -0
- data/examples/RedBook/colormat.rb +135 -0
- data/examples/RedBook/cube.rb +69 -0
- data/examples/RedBook/depthcue.rb +99 -0
- data/examples/RedBook/dof.rb +205 -0
- data/examples/{legacy → RedBook}/double.rb +59 -58
- data/examples/{legacy → RedBook}/drawf.rb +47 -54
- data/examples/RedBook/feedback.rb +145 -0
- data/examples/RedBook/fog.rb +167 -0
- data/examples/RedBook/font.rb +151 -0
- data/examples/RedBook/hello.rb +79 -0
- data/examples/RedBook/image.rb +137 -0
- data/examples/{legacy → RedBook}/jitter.rb +60 -62
- data/examples/RedBook/lines.rb +128 -0
- data/examples/RedBook/list.rb +111 -0
- data/examples/RedBook/material.rb +275 -0
- data/examples/RedBook/mipmap.rb +156 -0
- data/examples/{legacy → RedBook}/model.rb +66 -72
- data/examples/{legacy → RedBook}/movelight.rb +67 -75
- data/examples/RedBook/pickdepth.rb +179 -0
- data/examples/{legacy → RedBook}/planet.rb +62 -66
- data/examples/RedBook/quadric.rb +158 -0
- data/examples/RedBook/robot.rb +115 -0
- data/examples/RedBook/select.rb +196 -0
- data/examples/RedBook/smooth.rb +95 -0
- data/examples/RedBook/stencil.rb +163 -0
- data/examples/RedBook/stroke.rb +167 -0
- data/examples/RedBook/surface.rb +166 -0
- data/examples/RedBook/teaambient.rb +132 -0
- data/examples/RedBook/teapots.rb +182 -0
- data/examples/RedBook/tess.rb +183 -0
- data/examples/RedBook/texbind.rb +147 -0
- data/examples/RedBook/texgen.rb +169 -0
- data/examples/RedBook/texturesurf.rb +128 -0
- data/examples/RedBook/varray.rb +159 -0
- data/examples/RedBook/wrap.rb +148 -0
- data/examples/misc/anisotropic.rb +194 -0
- data/examples/misc/font-glut.rb +46 -0
- data/examples/{plane.rb → misc/plane.rb} +0 -0
- data/examples/misc/readpixel.rb +65 -0
- data/examples/{smooth.rb → misc/smooth.rb} +0 -0
- data/examples/{test.rb → misc/test.rb} +0 -0
- data/ext/common/common.h +252 -70
- data/ext/common/gl-enums.h +6102 -7334
- data/ext/common/gl-types.h +47 -0
- data/ext/common/glu-enums.h +469 -0
- data/ext/gl/gl-1.0-1.1.c +842 -2464
- data/ext/gl/gl-1.2.c +217 -281
- data/ext/gl/gl-1.3.c +113 -133
- data/ext/gl/gl-1.4.c +98 -334
- data/ext/gl/gl-1.5.c +28 -34
- data/ext/gl/gl-2.0.c +26 -235
- data/ext/gl/gl-2.1.c +31 -124
- data/ext/gl/gl-enums.c +786 -631
- data/ext/gl/gl-ext-arb.c +66 -0
- data/ext/gl/gl-ext-ext.c +218 -0
- data/ext/gl/gl.c +138 -31
- data/ext/gl/mkrf_conf.rb +1 -0
- data/ext/glu/glu-enums.c +163 -0
- data/ext/glu/glu.c +1003 -1205
- data/ext/glu/mkrf_conf.rb +1 -0
- data/ext/glut/glut.c +1056 -1175
- data/lib/opengl.rb +90 -3
- data/test/tc_common.rb +26 -13
- data/test/tc_ext_arb.rb +73 -0
- data/test/tc_ext_ext.rb +74 -0
- data/test/tc_func_12.rb +8 -8
- data/test/tc_func_13.rb +17 -11
- data/test/tc_func_14.rb +8 -8
- data/test/tc_func_15.rb +190 -2
- data/test/tc_func_20.rb +36 -10
- data/test/tc_func_21.rb +445 -2
- data/test/tc_glu.rb +305 -0
- data/test/tc_misc.rb +1 -0
- metadata +84 -68
- data/doc/screenshots.txt +0 -23
- data/examples/legacy/COPYRIGHT +0 -8
- data/examples/legacy/aaindex.rb +0 -98
- data/examples/legacy/aapoly.rb +0 -153
- data/examples/legacy/aargb.rb +0 -139
- data/examples/legacy/accanti.rb +0 -159
- data/examples/legacy/accpersp.rb +0 -216
- data/examples/legacy/alpha.rb +0 -133
- data/examples/legacy/alpha3D.rb +0 -165
- data/examples/legacy/bezcurve.rb +0 -107
- data/examples/legacy/bezmesh.rb +0 -131
- data/examples/legacy/checker.rb +0 -121
- data/examples/legacy/clip.rb +0 -104
- data/examples/legacy/colormat.rb +0 -145
- data/examples/legacy/cube.rb +0 -73
- data/examples/legacy/depthcue.rb +0 -101
- data/examples/legacy/dof.rb +0 -212
- data/examples/legacy/feedback.rb +0 -152
- data/examples/legacy/fog.rb +0 -172
- data/examples/legacy/font-glut.rb +0 -41
- data/examples/legacy/font.rb +0 -158
- data/examples/legacy/hello.rb +0 -75
- data/examples/legacy/image.rb +0 -145
- data/examples/legacy/lines.rb +0 -135
- data/examples/legacy/list.rb +0 -120
- data/examples/legacy/material.rb +0 -290
- data/examples/legacy/mipmap.rb +0 -159
- data/examples/legacy/pickdepth.rb +0 -180
- data/examples/legacy/quadric.rb +0 -180
- data/examples/legacy/readpixel.rb +0 -59
- data/examples/legacy/robot.rb +0 -120
- data/examples/legacy/select.rb +0 -207
- data/examples/legacy/smooth.rb +0 -41
- data/examples/legacy/stencil.rb +0 -154
- data/examples/legacy/stroke.rb +0 -170
- data/examples/legacy/surface.rb +0 -170
- data/examples/legacy/teaambient.rb +0 -132
- data/examples/legacy/teapots.rb +0 -188
- data/examples/legacy/tess.rb +0 -222
- data/examples/legacy/texbind.rb +0 -157
- data/examples/legacy/texgen.rb +0 -171
- data/examples/legacy/texturesurf.rb +0 -128
- data/examples/legacy/varray.rb +0 -167
- data/examples/legacy/wrap.rb +0 -158
- data/lib/gl_prev.rb +0 -46
- data/lib/glu_prev.rb +0 -46
- data/lib/glut_prev.rb +0 -45
data/ext/gl/mkrf_conf.rb
CHANGED
data/ext/glu/glu-enums.c
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
/* This file was genereated on Mon Jul 23 15:17:36 +0200 2007
|
2
|
+
source: http://oss.sgi.com/cgi-bin/cvsweb.cgi/~checkout~/projects/ogl-sample/main/doc/registry/specs/enumglu.spec
|
3
|
+
*/
|
4
|
+
|
5
|
+
#include "../common/common.h"
|
6
|
+
void glu_init_enums(VALUE module)
|
7
|
+
{
|
8
|
+
rb_define_const(module, "GLU_AUTO_LOAD_MATRIX", INT2NUM(GLU_AUTO_LOAD_MATRIX));
|
9
|
+
rb_define_const(module, "GLU_BEGIN", INT2NUM(GLU_BEGIN));
|
10
|
+
rb_define_const(module, "GLU_CCW", INT2NUM(GLU_CCW));
|
11
|
+
rb_define_const(module, "GLU_CULLING", INT2NUM(GLU_CULLING));
|
12
|
+
rb_define_const(module, "GLU_CW", INT2NUM(GLU_CW));
|
13
|
+
rb_define_const(module, "GLU_DISPLAY_MODE", INT2NUM(GLU_DISPLAY_MODE));
|
14
|
+
rb_define_const(module, "GLU_DOMAIN_DISTANCE", INT2NUM(GLU_DOMAIN_DISTANCE));
|
15
|
+
rb_define_const(module, "GLU_EDGE_FLAG", INT2NUM(GLU_EDGE_FLAG));
|
16
|
+
rb_define_const(module, "GLU_END", INT2NUM(GLU_END));
|
17
|
+
rb_define_const(module, "GLU_ERROR", INT2NUM(GLU_ERROR));
|
18
|
+
rb_define_const(module, "GLU_EXTENSIONS", INT2NUM(GLU_EXTENSIONS));
|
19
|
+
rb_define_const(module, "GLU_EXTERIOR", INT2NUM(GLU_EXTERIOR));
|
20
|
+
rb_define_const(module, "GLU_EXT_nurbs_tessellator", INT2NUM(GLU_EXT_nurbs_tessellator));
|
21
|
+
rb_define_const(module, "GLU_EXT_object_space_tess", INT2NUM(GLU_EXT_object_space_tess));
|
22
|
+
rb_define_const(module, "GLU_FALSE", INT2NUM(GLU_FALSE));
|
23
|
+
rb_define_const(module, "GLU_FILL", INT2NUM(GLU_FILL));
|
24
|
+
rb_define_const(module, "GLU_FLAT", INT2NUM(GLU_FLAT));
|
25
|
+
rb_define_const(module, "GLU_INSIDE", INT2NUM(GLU_INSIDE));
|
26
|
+
rb_define_const(module, "GLU_INTERIOR", INT2NUM(GLU_INTERIOR));
|
27
|
+
rb_define_const(module, "GLU_INVALID_ENUM", INT2NUM(GLU_INVALID_ENUM));
|
28
|
+
rb_define_const(module, "GLU_INVALID_OPERATION", INT2NUM(GLU_INVALID_OPERATION));
|
29
|
+
rb_define_const(module, "GLU_INVALID_VALUE", INT2NUM(GLU_INVALID_VALUE));
|
30
|
+
rb_define_const(module, "GLU_LAGRANGIAN_SGI", INT2NUM(GLU_LAGRANGIAN_SGI));
|
31
|
+
rb_define_const(module, "GLU_LINE", INT2NUM(GLU_LINE));
|
32
|
+
rb_define_const(module, "GLU_MAP1_TRIM_2", INT2NUM(GLU_MAP1_TRIM_2));
|
33
|
+
rb_define_const(module, "GLU_MAP1_TRIM_3", INT2NUM(GLU_MAP1_TRIM_3));
|
34
|
+
rb_define_const(module, "GLU_MITCHELL_NETRAVALI_SGI", INT2NUM(GLU_MITCHELL_NETRAVALI_SGI));
|
35
|
+
rb_define_const(module, "GLU_NONE", INT2NUM(GLU_NONE));
|
36
|
+
rb_define_const(module, "GLU_NURBS_BEGIN", INT2NUM(GLU_NURBS_BEGIN));
|
37
|
+
rb_define_const(module, "GLU_NURBS_BEGIN_DATA", INT2NUM(GLU_NURBS_BEGIN_DATA));
|
38
|
+
rb_define_const(module, "GLU_NURBS_BEGIN_DATA_EXT", INT2NUM(GLU_NURBS_BEGIN_DATA_EXT));
|
39
|
+
rb_define_const(module, "GLU_NURBS_BEGIN_EXT", INT2NUM(GLU_NURBS_BEGIN_EXT));
|
40
|
+
rb_define_const(module, "GLU_NURBS_COLOR", INT2NUM(GLU_NURBS_COLOR));
|
41
|
+
rb_define_const(module, "GLU_NURBS_COLOR_DATA", INT2NUM(GLU_NURBS_COLOR_DATA));
|
42
|
+
rb_define_const(module, "GLU_NURBS_COLOR_DATA_EXT", INT2NUM(GLU_NURBS_COLOR_DATA_EXT));
|
43
|
+
rb_define_const(module, "GLU_NURBS_COLOR_EXT", INT2NUM(GLU_NURBS_COLOR_EXT));
|
44
|
+
rb_define_const(module, "GLU_NURBS_END", INT2NUM(GLU_NURBS_END));
|
45
|
+
rb_define_const(module, "GLU_NURBS_END_DATA", INT2NUM(GLU_NURBS_END_DATA));
|
46
|
+
rb_define_const(module, "GLU_NURBS_END_DATA_EXT", INT2NUM(GLU_NURBS_END_DATA_EXT));
|
47
|
+
rb_define_const(module, "GLU_NURBS_END_EXT", INT2NUM(GLU_NURBS_END_EXT));
|
48
|
+
rb_define_const(module, "GLU_NURBS_ERROR", INT2NUM(GLU_NURBS_ERROR));
|
49
|
+
rb_define_const(module, "GLU_NURBS_ERROR1", INT2NUM(GLU_NURBS_ERROR1));
|
50
|
+
rb_define_const(module, "GLU_NURBS_ERROR10", INT2NUM(GLU_NURBS_ERROR10));
|
51
|
+
rb_define_const(module, "GLU_NURBS_ERROR11", INT2NUM(GLU_NURBS_ERROR11));
|
52
|
+
rb_define_const(module, "GLU_NURBS_ERROR12", INT2NUM(GLU_NURBS_ERROR12));
|
53
|
+
rb_define_const(module, "GLU_NURBS_ERROR13", INT2NUM(GLU_NURBS_ERROR13));
|
54
|
+
rb_define_const(module, "GLU_NURBS_ERROR14", INT2NUM(GLU_NURBS_ERROR14));
|
55
|
+
rb_define_const(module, "GLU_NURBS_ERROR15", INT2NUM(GLU_NURBS_ERROR15));
|
56
|
+
rb_define_const(module, "GLU_NURBS_ERROR16", INT2NUM(GLU_NURBS_ERROR16));
|
57
|
+
rb_define_const(module, "GLU_NURBS_ERROR17", INT2NUM(GLU_NURBS_ERROR17));
|
58
|
+
rb_define_const(module, "GLU_NURBS_ERROR18", INT2NUM(GLU_NURBS_ERROR18));
|
59
|
+
rb_define_const(module, "GLU_NURBS_ERROR19", INT2NUM(GLU_NURBS_ERROR19));
|
60
|
+
rb_define_const(module, "GLU_NURBS_ERROR2", INT2NUM(GLU_NURBS_ERROR2));
|
61
|
+
rb_define_const(module, "GLU_NURBS_ERROR20", INT2NUM(GLU_NURBS_ERROR20));
|
62
|
+
rb_define_const(module, "GLU_NURBS_ERROR21", INT2NUM(GLU_NURBS_ERROR21));
|
63
|
+
rb_define_const(module, "GLU_NURBS_ERROR22", INT2NUM(GLU_NURBS_ERROR22));
|
64
|
+
rb_define_const(module, "GLU_NURBS_ERROR23", INT2NUM(GLU_NURBS_ERROR23));
|
65
|
+
rb_define_const(module, "GLU_NURBS_ERROR24", INT2NUM(GLU_NURBS_ERROR24));
|
66
|
+
rb_define_const(module, "GLU_NURBS_ERROR25", INT2NUM(GLU_NURBS_ERROR25));
|
67
|
+
rb_define_const(module, "GLU_NURBS_ERROR26", INT2NUM(GLU_NURBS_ERROR26));
|
68
|
+
rb_define_const(module, "GLU_NURBS_ERROR27", INT2NUM(GLU_NURBS_ERROR27));
|
69
|
+
rb_define_const(module, "GLU_NURBS_ERROR28", INT2NUM(GLU_NURBS_ERROR28));
|
70
|
+
rb_define_const(module, "GLU_NURBS_ERROR29", INT2NUM(GLU_NURBS_ERROR29));
|
71
|
+
rb_define_const(module, "GLU_NURBS_ERROR3", INT2NUM(GLU_NURBS_ERROR3));
|
72
|
+
rb_define_const(module, "GLU_NURBS_ERROR30", INT2NUM(GLU_NURBS_ERROR30));
|
73
|
+
rb_define_const(module, "GLU_NURBS_ERROR31", INT2NUM(GLU_NURBS_ERROR31));
|
74
|
+
rb_define_const(module, "GLU_NURBS_ERROR32", INT2NUM(GLU_NURBS_ERROR32));
|
75
|
+
rb_define_const(module, "GLU_NURBS_ERROR33", INT2NUM(GLU_NURBS_ERROR33));
|
76
|
+
rb_define_const(module, "GLU_NURBS_ERROR34", INT2NUM(GLU_NURBS_ERROR34));
|
77
|
+
rb_define_const(module, "GLU_NURBS_ERROR35", INT2NUM(GLU_NURBS_ERROR35));
|
78
|
+
rb_define_const(module, "GLU_NURBS_ERROR36", INT2NUM(GLU_NURBS_ERROR36));
|
79
|
+
rb_define_const(module, "GLU_NURBS_ERROR37", INT2NUM(GLU_NURBS_ERROR37));
|
80
|
+
rb_define_const(module, "GLU_NURBS_ERROR4", INT2NUM(GLU_NURBS_ERROR4));
|
81
|
+
rb_define_const(module, "GLU_NURBS_ERROR5", INT2NUM(GLU_NURBS_ERROR5));
|
82
|
+
rb_define_const(module, "GLU_NURBS_ERROR6", INT2NUM(GLU_NURBS_ERROR6));
|
83
|
+
rb_define_const(module, "GLU_NURBS_ERROR7", INT2NUM(GLU_NURBS_ERROR7));
|
84
|
+
rb_define_const(module, "GLU_NURBS_ERROR8", INT2NUM(GLU_NURBS_ERROR8));
|
85
|
+
rb_define_const(module, "GLU_NURBS_ERROR9", INT2NUM(GLU_NURBS_ERROR9));
|
86
|
+
rb_define_const(module, "GLU_NURBS_MODE", INT2NUM(GLU_NURBS_MODE));
|
87
|
+
rb_define_const(module, "GLU_NURBS_MODE_EXT", INT2NUM(GLU_NURBS_MODE_EXT));
|
88
|
+
rb_define_const(module, "GLU_NURBS_NORMAL", INT2NUM(GLU_NURBS_NORMAL));
|
89
|
+
rb_define_const(module, "GLU_NURBS_NORMAL_DATA", INT2NUM(GLU_NURBS_NORMAL_DATA));
|
90
|
+
rb_define_const(module, "GLU_NURBS_NORMAL_DATA_EXT", INT2NUM(GLU_NURBS_NORMAL_DATA_EXT));
|
91
|
+
rb_define_const(module, "GLU_NURBS_NORMAL_EXT", INT2NUM(GLU_NURBS_NORMAL_EXT));
|
92
|
+
rb_define_const(module, "GLU_NURBS_RENDERER", INT2NUM(GLU_NURBS_RENDERER));
|
93
|
+
rb_define_const(module, "GLU_NURBS_RENDERER_EXT", INT2NUM(GLU_NURBS_RENDERER_EXT));
|
94
|
+
rb_define_const(module, "GLU_NURBS_TESSELLATOR", INT2NUM(GLU_NURBS_TESSELLATOR));
|
95
|
+
rb_define_const(module, "GLU_NURBS_TESSELLATOR_EXT", INT2NUM(GLU_NURBS_TESSELLATOR_EXT));
|
96
|
+
rb_define_const(module, "GLU_NURBS_TEXTURE_COORD", INT2NUM(GLU_NURBS_TEXTURE_COORD));
|
97
|
+
rb_define_const(module, "GLU_NURBS_TEXTURE_COORD_DATA", INT2NUM(GLU_NURBS_TEXTURE_COORD_DATA));
|
98
|
+
rb_define_const(module, "GLU_NURBS_TEXTURE_COORD_DATA_EXT", INT2NUM(GLU_NURBS_TEXTURE_COORD_DATA_EXT));
|
99
|
+
rb_define_const(module, "GLU_NURBS_TEXTURE_COORD_EXT", INT2NUM(GLU_NURBS_TEXTURE_COORD_EXT));
|
100
|
+
rb_define_const(module, "GLU_NURBS_VERTEX", INT2NUM(GLU_NURBS_VERTEX));
|
101
|
+
rb_define_const(module, "GLU_NURBS_VERTEX_DATA", INT2NUM(GLU_NURBS_VERTEX_DATA));
|
102
|
+
rb_define_const(module, "GLU_NURBS_VERTEX_DATA_EXT", INT2NUM(GLU_NURBS_VERTEX_DATA_EXT));
|
103
|
+
rb_define_const(module, "GLU_NURBS_VERTEX_EXT", INT2NUM(GLU_NURBS_VERTEX_EXT));
|
104
|
+
rb_define_const(module, "GLU_OBJECT_PARAMETRIC_ERROR", INT2NUM(GLU_OBJECT_PARAMETRIC_ERROR));
|
105
|
+
rb_define_const(module, "GLU_OBJECT_PARAMETRIC_ERROR_EXT", INT2NUM(GLU_OBJECT_PARAMETRIC_ERROR_EXT));
|
106
|
+
rb_define_const(module, "GLU_OBJECT_PATH_LENGTH", INT2NUM(GLU_OBJECT_PATH_LENGTH));
|
107
|
+
rb_define_const(module, "GLU_OBJECT_PATH_LENGTH_EXT", INT2NUM(GLU_OBJECT_PATH_LENGTH_EXT));
|
108
|
+
rb_define_const(module, "GLU_OUTLINE_PATCH", INT2NUM(GLU_OUTLINE_PATCH));
|
109
|
+
rb_define_const(module, "GLU_OUTLINE_POLYGON", INT2NUM(GLU_OUTLINE_POLYGON));
|
110
|
+
rb_define_const(module, "GLU_OUTSIDE", INT2NUM(GLU_OUTSIDE));
|
111
|
+
rb_define_const(module, "GLU_OUT_OF_MEMORY", INT2NUM(GLU_OUT_OF_MEMORY));
|
112
|
+
rb_define_const(module, "GLU_PARAMETRIC_ERROR", INT2NUM(GLU_PARAMETRIC_ERROR));
|
113
|
+
rb_define_const(module, "GLU_PARAMETRIC_TOLERANCE", INT2NUM(GLU_PARAMETRIC_TOLERANCE));
|
114
|
+
rb_define_const(module, "GLU_PATH_LENGTH", INT2NUM(GLU_PATH_LENGTH));
|
115
|
+
rb_define_const(module, "GLU_POINT", INT2NUM(GLU_POINT));
|
116
|
+
rb_define_const(module, "GLU_SAMPLING_METHOD", INT2NUM(GLU_SAMPLING_METHOD));
|
117
|
+
rb_define_const(module, "GLU_SAMPLING_TOLERANCE", INT2NUM(GLU_SAMPLING_TOLERANCE));
|
118
|
+
rb_define_const(module, "GLU_SILHOUETTE", INT2NUM(GLU_SILHOUETTE));
|
119
|
+
rb_define_const(module, "GLU_SMOOTH", INT2NUM(GLU_SMOOTH));
|
120
|
+
rb_define_const(module, "GLU_TESS_BEGIN", INT2NUM(GLU_TESS_BEGIN));
|
121
|
+
rb_define_const(module, "GLU_TESS_BEGIN_DATA", INT2NUM(GLU_TESS_BEGIN_DATA));
|
122
|
+
rb_define_const(module, "GLU_TESS_BOUNDARY_ONLY", INT2NUM(GLU_TESS_BOUNDARY_ONLY));
|
123
|
+
rb_define_const(module, "GLU_TESS_COMBINE", INT2NUM(GLU_TESS_COMBINE));
|
124
|
+
rb_define_const(module, "GLU_TESS_COMBINE_DATA", INT2NUM(GLU_TESS_COMBINE_DATA));
|
125
|
+
rb_define_const(module, "GLU_TESS_COORD_TOO_LARGE", INT2NUM(GLU_TESS_COORD_TOO_LARGE));
|
126
|
+
rb_define_const(module, "GLU_TESS_EDGE_FLAG", INT2NUM(GLU_TESS_EDGE_FLAG));
|
127
|
+
rb_define_const(module, "GLU_TESS_EDGE_FLAG_DATA", INT2NUM(GLU_TESS_EDGE_FLAG_DATA));
|
128
|
+
rb_define_const(module, "GLU_TESS_END", INT2NUM(GLU_TESS_END));
|
129
|
+
rb_define_const(module, "GLU_TESS_END_DATA", INT2NUM(GLU_TESS_END_DATA));
|
130
|
+
rb_define_const(module, "GLU_TESS_ERROR", INT2NUM(GLU_TESS_ERROR));
|
131
|
+
rb_define_const(module, "GLU_TESS_ERROR1", INT2NUM(GLU_TESS_ERROR1));
|
132
|
+
rb_define_const(module, "GLU_TESS_ERROR2", INT2NUM(GLU_TESS_ERROR2));
|
133
|
+
rb_define_const(module, "GLU_TESS_ERROR3", INT2NUM(GLU_TESS_ERROR3));
|
134
|
+
rb_define_const(module, "GLU_TESS_ERROR4", INT2NUM(GLU_TESS_ERROR4));
|
135
|
+
rb_define_const(module, "GLU_TESS_ERROR5", INT2NUM(GLU_TESS_ERROR5));
|
136
|
+
rb_define_const(module, "GLU_TESS_ERROR6", INT2NUM(GLU_TESS_ERROR6));
|
137
|
+
rb_define_const(module, "GLU_TESS_ERROR7", INT2NUM(GLU_TESS_ERROR7));
|
138
|
+
rb_define_const(module, "GLU_TESS_ERROR8", INT2NUM(GLU_TESS_ERROR8));
|
139
|
+
rb_define_const(module, "GLU_TESS_ERROR_DATA", INT2NUM(GLU_TESS_ERROR_DATA));
|
140
|
+
rb_define_const(module, "GLU_TESS_MISSING_BEGIN_CONTOUR", INT2NUM(GLU_TESS_MISSING_BEGIN_CONTOUR));
|
141
|
+
rb_define_const(module, "GLU_TESS_MISSING_BEGIN_POLYGON", INT2NUM(GLU_TESS_MISSING_BEGIN_POLYGON));
|
142
|
+
rb_define_const(module, "GLU_TESS_MISSING_END_CONTOUR", INT2NUM(GLU_TESS_MISSING_END_CONTOUR));
|
143
|
+
rb_define_const(module, "GLU_TESS_MISSING_END_POLYGON", INT2NUM(GLU_TESS_MISSING_END_POLYGON));
|
144
|
+
rb_define_const(module, "GLU_TESS_NEED_COMBINE_CALLBACK", INT2NUM(GLU_TESS_NEED_COMBINE_CALLBACK));
|
145
|
+
rb_define_const(module, "GLU_TESS_TOLERANCE", INT2NUM(GLU_TESS_TOLERANCE));
|
146
|
+
rb_define_const(module, "GLU_TESS_VERTEX", INT2NUM(GLU_TESS_VERTEX));
|
147
|
+
rb_define_const(module, "GLU_TESS_VERTEX_DATA", INT2NUM(GLU_TESS_VERTEX_DATA));
|
148
|
+
rb_define_const(module, "GLU_TESS_WINDING_ABS_GEQ_TWO", INT2NUM(GLU_TESS_WINDING_ABS_GEQ_TWO));
|
149
|
+
rb_define_const(module, "GLU_TESS_WINDING_NEGATIVE", INT2NUM(GLU_TESS_WINDING_NEGATIVE));
|
150
|
+
rb_define_const(module, "GLU_TESS_WINDING_NONZERO", INT2NUM(GLU_TESS_WINDING_NONZERO));
|
151
|
+
rb_define_const(module, "GLU_TESS_WINDING_ODD", INT2NUM(GLU_TESS_WINDING_ODD));
|
152
|
+
rb_define_const(module, "GLU_TESS_WINDING_POSITIVE", INT2NUM(GLU_TESS_WINDING_POSITIVE));
|
153
|
+
rb_define_const(module, "GLU_TESS_WINDING_RULE", INT2NUM(GLU_TESS_WINDING_RULE));
|
154
|
+
rb_define_const(module, "GLU_TRUE", INT2NUM(GLU_TRUE));
|
155
|
+
rb_define_const(module, "GLU_UNKNOWN", INT2NUM(GLU_UNKNOWN));
|
156
|
+
rb_define_const(module, "GLU_U_STEP", INT2NUM(GLU_U_STEP));
|
157
|
+
rb_define_const(module, "GLU_VERSION", INT2NUM(GLU_VERSION));
|
158
|
+
rb_define_const(module, "GLU_VERSION_1_1", INT2NUM(GLU_VERSION_1_1));
|
159
|
+
rb_define_const(module, "GLU_VERSION_1_2", INT2NUM(GLU_VERSION_1_2));
|
160
|
+
rb_define_const(module, "GLU_VERSION_1_3", INT2NUM(GLU_VERSION_1_3));
|
161
|
+
rb_define_const(module, "GLU_VERTEX", INT2NUM(GLU_VERTEX));
|
162
|
+
rb_define_const(module, "GLU_V_STEP", INT2NUM(GLU_V_STEP));
|
163
|
+
}
|
data/ext/glu/glu.c
CHANGED
@@ -17,73 +17,59 @@
|
|
17
17
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
18
18
|
*/
|
19
19
|
|
20
|
-
#ifdef __APPLE__
|
21
|
-
#include <OpenGL/gl.h>
|
22
|
-
#include <OpenGL/glu.h>
|
23
|
-
#elif defined WIN32
|
24
|
-
#include <windows.h>
|
25
|
-
#include <GL/gl.h>
|
26
|
-
#include <GL/glu.h>
|
27
|
-
#else
|
28
|
-
#include <GL/gl.h>
|
29
|
-
#include <GL/glu.h>
|
30
|
-
#endif
|
31
|
-
|
32
|
-
#include <ruby.h>
|
33
20
|
#include "../common/common.h"
|
34
21
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
#else
|
39
|
-
#define DLLEXPORT
|
40
|
-
typedef void (*VOIDFUNC)();
|
41
|
-
#endif
|
22
|
+
static VALUE module;
|
23
|
+
|
24
|
+
void glu_init_enums(VALUE);
|
42
25
|
|
43
|
-
#if defined(GLU_VERSION_1_2)
|
44
26
|
typedef GLUtesselator tesselatorObj;
|
45
|
-
#else /* GLU_VERSION_1_2 */
|
46
|
-
typedef GLUtriangulatorObj tesselatorObj;
|
47
|
-
#endif /* !GLU_VERSION_1_2 */
|
48
27
|
|
49
|
-
|
28
|
+
/* pointers passed to gluNurbsCurve/Surface etc.,
|
29
|
+
- some implementations (Mesa) needs these to be valid
|
30
|
+
at EndCurve/Surface etc. call., so we store them here
|
31
|
+
and free them after that call */
|
32
|
+
|
50
33
|
struct glu_MesaStack {
|
51
|
-
|
52
|
-
|
34
|
+
int len;
|
35
|
+
GLfloat **ptr;
|
53
36
|
};
|
54
37
|
|
55
38
|
static struct glu_MesaStack gms = {0, NULL};
|
56
|
-
#endif
|
57
39
|
|
58
40
|
struct nurbsdata {
|
59
|
-
|
41
|
+
GLUnurbsObj *nobj;
|
42
|
+
VALUE n_ref;
|
60
43
|
};
|
61
44
|
struct tessdata {
|
62
|
-
|
63
|
-
|
45
|
+
tesselatorObj *tobj;
|
46
|
+
VALUE t_ref;
|
64
47
|
};
|
65
48
|
|
66
49
|
struct quaddata {
|
67
|
-
|
50
|
+
GLUquadricObj *qobj;
|
51
|
+
VALUE q_ref;
|
68
52
|
};
|
69
53
|
|
70
54
|
static VALUE cNurbs;
|
71
55
|
static VALUE cTess;
|
72
56
|
static VALUE cQuad;
|
73
57
|
|
58
|
+
#define REF_LAST 15
|
59
|
+
|
74
60
|
#define GetNURBS(obj, ndata) {\
|
75
|
-
|
76
|
-
|
61
|
+
Data_Get_Struct(obj, struct nurbsdata, ndata);\
|
62
|
+
if (ndata->nobj == NULL) rb_raise(rb_eRuntimeError, "Nurbs Object already deleted!");\
|
77
63
|
}
|
78
64
|
|
79
65
|
#define GetTESS(obj, tdata) {\
|
80
|
-
|
81
|
-
|
66
|
+
Data_Get_Struct(obj, struct tessdata, tdata);\
|
67
|
+
if (tdata->tobj == NULL) rb_raise(rb_eRuntimeError, "Triangulator Object already deleted!");\
|
82
68
|
}
|
83
69
|
|
84
70
|
#define GetQUAD(obj, qdata) {\
|
85
|
-
|
86
|
-
|
71
|
+
Data_Get_Struct(obj, struct quaddata, qdata);\
|
72
|
+
if (qdata->qobj == NULL) rb_raise(rb_eRuntimeError, "Quadric Object already deleted!");\
|
87
73
|
}
|
88
74
|
|
89
75
|
static ID callId;
|
@@ -101,119 +87,172 @@ static int
|
|
101
87
|
get_curve_dim(type)
|
102
88
|
GLenum type;
|
103
89
|
{
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
90
|
+
switch(type)
|
91
|
+
{
|
92
|
+
case GL_MAP1_VERTEX_3: return 3;
|
93
|
+
case GL_MAP1_VERTEX_4: return 4;
|
94
|
+
case GL_MAP1_INDEX: return 1;
|
95
|
+
case GL_MAP1_COLOR_4: return 4;
|
96
|
+
case GL_MAP1_NORMAL: return 3;
|
97
|
+
case GL_MAP1_TEXTURE_COORD_1: return 1;
|
98
|
+
case GL_MAP1_TEXTURE_COORD_2: return 2;
|
99
|
+
case GL_MAP1_TEXTURE_COORD_3: return 3;
|
100
|
+
case GL_MAP1_TEXTURE_COORD_4: return 4;
|
101
|
+
default:
|
102
|
+
rb_raise(rb_eArgError,"Unknown curve type '%i'",type);
|
103
|
+
}
|
104
|
+
return 0; /* never gets here */
|
118
105
|
}
|
119
106
|
/* from nurbssrf.c */
|
120
107
|
static int
|
121
108
|
get_surface_dim(GLenum type)
|
122
109
|
{
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
110
|
+
switch(type)
|
111
|
+
{
|
112
|
+
case GL_MAP2_VERTEX_3: return 3;
|
113
|
+
case GL_MAP2_VERTEX_4: return 4;
|
114
|
+
case GL_MAP2_INDEX: return 1;
|
115
|
+
case GL_MAP2_COLOR_4: return 4;
|
116
|
+
case GL_MAP2_NORMAL: return 3;
|
117
|
+
case GL_MAP2_TEXTURE_COORD_1: return 1;
|
118
|
+
case GL_MAP2_TEXTURE_COORD_2: return 2;
|
119
|
+
case GL_MAP2_TEXTURE_COORD_3: return 3;
|
120
|
+
case GL_MAP2_TEXTURE_COORD_4: return 4;
|
121
|
+
default:
|
122
|
+
rb_raise(rb_eArgError,"Unknown surface type '%i'",type);
|
123
|
+
}
|
124
|
+
return 0; /* never gets here */
|
137
125
|
}
|
138
126
|
|
139
127
|
/*
|
140
128
|
* NURBS API
|
141
129
|
*/
|
130
|
+
static VALUE n_current;
|
131
|
+
|
142
132
|
static void
|
143
133
|
free_nurbs(ndata)
|
144
134
|
struct nurbsdata *ndata;
|
145
135
|
{
|
146
|
-
|
147
|
-
|
136
|
+
if (ndata->nobj) gluDeleteNurbsRenderer(ndata->nobj);
|
137
|
+
ndata->nobj = NULL;
|
138
|
+
ndata->n_ref = Qnil;
|
139
|
+
}
|
140
|
+
static void
|
141
|
+
mark_nurbs(ndata)
|
142
|
+
struct nurbsdata* ndata;
|
143
|
+
{
|
144
|
+
if (ndata->nobj)
|
145
|
+
rb_gc_mark(ndata->n_ref);
|
148
146
|
}
|
147
|
+
|
148
|
+
static void CALLBACK
|
149
|
+
n_error(errorno)
|
150
|
+
GLenum errorno;
|
151
|
+
{
|
152
|
+
VALUE nurbs;
|
153
|
+
struct nurbsdata *ndata;
|
154
|
+
nurbs = rb_ary_entry(n_current, -1);
|
155
|
+
if (nurbs == Qnil)
|
156
|
+
return;
|
157
|
+
GetNURBS(nurbs, ndata);
|
158
|
+
rb_funcall(rb_ary_entry(ndata->n_ref, GLU_ERROR), callId, 1, INT2NUM(errorno));
|
159
|
+
}
|
160
|
+
|
161
|
+
static VALUE
|
162
|
+
glu_NurbsCallback(obj, arg1, arg2, arg3)
|
163
|
+
VALUE obj, arg1, arg2, arg3;
|
164
|
+
{
|
165
|
+
struct nurbsdata* ndata;
|
166
|
+
GLenum type;
|
167
|
+
GetNURBS(arg1, ndata);
|
168
|
+
type = (GLenum)NUM2INT(arg2);
|
169
|
+
if (!rb_obj_is_kind_of(arg3,rb_cProc) && !NIL_P(arg3))
|
170
|
+
rb_raise(rb_eTypeError, "gluNurbsCallback needs Proc Object:%s",rb_class2name(CLASS_OF(arg3)));
|
171
|
+
|
172
|
+
if (type!=GLU_ERROR)
|
173
|
+
return Qnil;
|
174
|
+
|
175
|
+
rb_ary_store(ndata->n_ref, type, arg3);
|
176
|
+
if (NIL_P(arg3))
|
177
|
+
gluNurbsCallback(ndata->nobj, type, NULL);
|
178
|
+
else
|
179
|
+
gluNurbsCallback(ndata->nobj, type, n_error);
|
180
|
+
|
181
|
+
return Qnil;
|
182
|
+
}
|
183
|
+
|
184
|
+
|
149
185
|
static VALUE
|
150
186
|
glu_NewNurbsRenderer(obj)
|
151
187
|
VALUE obj;
|
152
188
|
{
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
189
|
+
VALUE ret;
|
190
|
+
struct nurbsdata *ndata;
|
191
|
+
ret = Data_Make_Struct(cNurbs, struct nurbsdata, mark_nurbs, free_nurbs, ndata);
|
192
|
+
ndata->nobj = gluNewNurbsRenderer();
|
193
|
+
ndata->n_ref = rb_ary_new2(REF_LAST);
|
194
|
+
return ret;
|
158
195
|
}
|
159
196
|
static VALUE
|
160
197
|
glu_DeleteNurbsRenderer(obj, arg1)
|
161
198
|
VALUE obj, arg1;
|
162
199
|
{
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
200
|
+
struct nurbsdata *ndata;
|
201
|
+
GetNURBS(arg1, ndata);
|
202
|
+
free_nurbs(ndata);
|
203
|
+
return Qnil;
|
167
204
|
}
|
168
205
|
static VALUE
|
169
206
|
glu_NurbsProperty(obj, arg1, arg2, arg3)
|
170
207
|
VALUE obj, arg1, arg2, arg3;
|
171
208
|
{
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
209
|
+
struct nurbsdata *ndata;
|
210
|
+
GLenum property;
|
211
|
+
GLfloat value;
|
212
|
+
GetNURBS(arg1, ndata);
|
213
|
+
property = (GLenum)NUM2INT(arg2);
|
214
|
+
value = (GLfloat)NUM2DBL(arg3);
|
215
|
+
gluNurbsProperty(ndata->nobj, property, value);
|
216
|
+
return Qnil;
|
180
217
|
}
|
181
218
|
static VALUE
|
182
219
|
glu_GetNurbsProperty(obj, arg1, arg2)
|
183
220
|
VALUE obj, arg1, arg2;
|
184
221
|
{
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
222
|
+
struct nurbsdata *ndata;
|
223
|
+
GLenum property;
|
224
|
+
GLfloat value;
|
225
|
+
GetNURBS(arg1, ndata);
|
226
|
+
property = (GLenum)NUM2INT(arg2);
|
227
|
+
gluGetNurbsProperty(ndata->nobj, property, &value);
|
228
|
+
return rb_float_new(value);
|
192
229
|
}
|
193
230
|
static VALUE
|
194
231
|
glu_BeginCurve(obj, arg1)
|
195
232
|
VALUE obj, arg1;
|
196
233
|
{
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
234
|
+
struct nurbsdata *ndata;
|
235
|
+
GetNURBS(arg1, ndata);
|
236
|
+
rb_ary_push(n_current, arg1);
|
237
|
+
gluBeginCurve(ndata->nobj);
|
238
|
+
return Qnil;
|
201
239
|
}
|
202
240
|
static VALUE
|
203
241
|
glu_EndCurve(obj, arg1)
|
204
242
|
VALUE obj, arg1;
|
205
243
|
{
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
244
|
+
struct nurbsdata *ndata;
|
245
|
+
GetNURBS(arg1, ndata);
|
246
|
+
gluEndCurve(ndata->nobj);
|
247
|
+
|
248
|
+
for (;gms.len>0;gms.len--)
|
249
|
+
free(gms.ptr[gms.len-1]);
|
250
|
+
free(gms.ptr);
|
251
|
+
gms.ptr = NULL;
|
252
|
+
|
253
|
+
rb_ary_pop(n_current);
|
254
|
+
|
255
|
+
return Qnil;
|
217
256
|
}
|
218
257
|
static VALUE
|
219
258
|
glu_NurbsCurve(argc,argv,obj)
|
@@ -221,96 +260,83 @@ int argc;
|
|
221
260
|
VALUE *argv;
|
222
261
|
VALUE obj;
|
223
262
|
{
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
}
|
275
|
-
GetNURBS(args[0], ndata);
|
276
|
-
gluNurbsCurve(ndata->nobj, uknot_count, uknot, u_stride, ctlarray, uorder, type);
|
277
|
-
/* as of Mesa 3.1, Mesa assumes all data that following pointers
|
278
|
-
points to is valid at gluEndCurve. so, free them in
|
279
|
-
glu_EndCurve() */
|
280
|
-
#ifdef MESA
|
281
|
-
gms.ptr = REALLOC_N(gms.ptr, GLfloat*, gms.len+=2);
|
282
|
-
gms.ptr[gms.len - 2] = uknot;
|
283
|
-
gms.ptr[gms.len - 1] = ctlarray;
|
284
|
-
#else
|
285
|
-
free(uknot);
|
286
|
-
free(ctlarray);
|
287
|
-
#endif
|
288
|
-
return Qnil;
|
263
|
+
struct nurbsdata *ndata;
|
264
|
+
GLint uknot_count;
|
265
|
+
GLfloat *uknot;
|
266
|
+
GLint u_stride;
|
267
|
+
GLint uorder;
|
268
|
+
GLfloat *ctlarray;
|
269
|
+
GLenum type;
|
270
|
+
|
271
|
+
VALUE args[7];
|
272
|
+
VALUE ary_ctl1;
|
273
|
+
|
274
|
+
switch (rb_scan_args(argc, argv, "52", &args[0], &args[1], &args[2], &args[3], &args[4], &args[5], &args[6])) {
|
275
|
+
case 5:
|
276
|
+
uknot_count = RARRAY(args[1])->len;
|
277
|
+
uorder = (GLenum)NUM2INT(args[3]);
|
278
|
+
type = (GLenum)NUM2INT(args[4]);
|
279
|
+
u_stride = get_curve_dim(type);
|
280
|
+
|
281
|
+
uknot = ALLOC_N(GLfloat, uknot_count);
|
282
|
+
ary2cflt(args[1], uknot, uknot_count);
|
283
|
+
|
284
|
+
ary_ctl1 = rb_ary_new();
|
285
|
+
mary2ary(args[2], ary_ctl1); /* flatten */
|
286
|
+
break;
|
287
|
+
case 7:
|
288
|
+
uknot_count = (GLint)NUM2INT(args[1]);
|
289
|
+
u_stride = (GLint)NUM2INT(args[3]);
|
290
|
+
uorder = (GLint)NUM2INT(args[5]);
|
291
|
+
type = (GLenum)NUM2INT(args[6]);
|
292
|
+
|
293
|
+
uknot = ALLOC_N(GLfloat, uknot_count);
|
294
|
+
ary2cflt(args[2], uknot, uknot_count);
|
295
|
+
|
296
|
+
ary_ctl1 = rb_ary_new();
|
297
|
+
mary2ary(args[4], ary_ctl1); /* flatten */
|
298
|
+
break;
|
299
|
+
default:
|
300
|
+
rb_raise(rb_eArgError, "gluNurbsCurve needs 5 or 7 arguments",argc);
|
301
|
+
}
|
302
|
+
ctlarray = ALLOC_N(GLfloat, u_stride*(uknot_count-uorder));
|
303
|
+
ary2cflt((VALUE)ary_ctl1, ctlarray, (uknot_count-uorder)*u_stride);
|
304
|
+
|
305
|
+
GetNURBS(args[0], ndata);
|
306
|
+
gluNurbsCurve(ndata->nobj, uknot_count, uknot, u_stride, ctlarray, uorder, type);
|
307
|
+
|
308
|
+
/* store the pointers */
|
309
|
+
gms.ptr = REALLOC_N(gms.ptr, GLfloat*, gms.len+=2);
|
310
|
+
gms.ptr[gms.len - 2] = uknot;
|
311
|
+
gms.ptr[gms.len - 1] = ctlarray;
|
312
|
+
return Qnil;
|
289
313
|
}
|
290
314
|
static VALUE
|
291
315
|
glu_BeginSurface(obj, arg1)
|
292
316
|
VALUE obj, arg1;
|
293
317
|
{
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
318
|
+
struct nurbsdata *ndata;
|
319
|
+
GetNURBS(arg1, ndata);
|
320
|
+
rb_ary_push(n_current, arg1);
|
321
|
+
gluBeginSurface(ndata->nobj);
|
322
|
+
return Qnil;
|
298
323
|
}
|
299
324
|
static VALUE
|
300
325
|
glu_EndSurface(obj, arg1)
|
301
326
|
VALUE obj, arg1;
|
302
327
|
{
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
328
|
+
struct nurbsdata *ndata;
|
329
|
+
GetNURBS(arg1, ndata);
|
330
|
+
gluEndSurface(ndata->nobj);
|
331
|
+
|
332
|
+
for(; gms.len>0; gms.len--)
|
333
|
+
free(gms.ptr[gms.len-1]);
|
334
|
+
free(gms.ptr);
|
335
|
+
gms.ptr = NULL;
|
336
|
+
|
337
|
+
rb_ary_pop(n_current);
|
338
|
+
|
339
|
+
return Qnil;
|
314
340
|
}
|
315
341
|
|
316
342
|
static VALUE
|
@@ -319,107 +345,102 @@ int argc;
|
|
319
345
|
VALUE *argv;
|
320
346
|
VALUE obj;
|
321
347
|
{
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
gms.ptr[gms.len-1] = ctlarray;
|
399
|
-
#else
|
400
|
-
free(sknot);
|
401
|
-
free(tknot);
|
402
|
-
free(ctlarray);
|
403
|
-
#endif
|
404
|
-
return Qnil;
|
348
|
+
struct nurbsdata *ndata;
|
349
|
+
GLint sknot_count;
|
350
|
+
GLfloat *sknot;
|
351
|
+
GLint tknot_count;
|
352
|
+
GLfloat *tknot;
|
353
|
+
GLint s_stride;
|
354
|
+
GLint t_stride;
|
355
|
+
GLfloat *ctlarray;
|
356
|
+
GLint sorder;
|
357
|
+
GLint torder;
|
358
|
+
GLenum type;
|
359
|
+
|
360
|
+
VALUE args[11];
|
361
|
+
VALUE ary_ctl1;
|
362
|
+
int type_len;
|
363
|
+
|
364
|
+
switch (rb_scan_args(argc, argv, "74", &args[0], &args[1], &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], &args[8], &args[9], &args[10])) {
|
365
|
+
case 7:
|
366
|
+
sknot_count = RARRAY(args[1])->len;
|
367
|
+
sknot = ALLOC_N(GLfloat, sknot_count);
|
368
|
+
ary2cflt(args[1], sknot, sknot_count);
|
369
|
+
|
370
|
+
tknot_count = RARRAY(args[2])->len;
|
371
|
+
tknot = ALLOC_N(GLfloat, tknot_count);
|
372
|
+
ary2cflt(args[2], tknot, tknot_count);
|
373
|
+
|
374
|
+
sorder = (GLint)NUM2INT(args[4]);
|
375
|
+
torder = (GLint)NUM2INT(args[5]);
|
376
|
+
type = (GLenum)NUM2INT(args[6]);
|
377
|
+
|
378
|
+
t_stride = get_surface_dim(type);
|
379
|
+
s_stride = t_stride * sorder;
|
380
|
+
|
381
|
+
ctlarray = ALLOC_N(GLfloat, (sknot_count-sorder)*(tknot_count-torder)*t_stride);
|
382
|
+
ary_ctl1 = rb_ary_new();
|
383
|
+
mary2ary(args[3], ary_ctl1); /* flatten */
|
384
|
+
ary2cflt(ary_ctl1, ctlarray, (sknot_count-sorder)*(tknot_count-torder)*t_stride);
|
385
|
+
break;
|
386
|
+
case 11:
|
387
|
+
sknot_count = (GLint)NUM2INT(args[1]);
|
388
|
+
sknot = ALLOC_N(GLfloat, sknot_count);
|
389
|
+
ary2cflt(args[2], sknot, sknot_count);
|
390
|
+
|
391
|
+
tknot_count = (GLint)NUM2INT(args[3]);
|
392
|
+
tknot = ALLOC_N(GLfloat, tknot_count);
|
393
|
+
ary2cflt(args[4], tknot, tknot_count);
|
394
|
+
|
395
|
+
s_stride = (GLint)NUM2INT(args[5]);
|
396
|
+
t_stride = (GLint)NUM2INT(args[6]);
|
397
|
+
sorder = (GLint)NUM2INT(args[8]);
|
398
|
+
torder = (GLint)NUM2INT(args[9]);
|
399
|
+
type = (GLint)NUM2INT(args[10]);
|
400
|
+
type_len = get_surface_dim(type);
|
401
|
+
|
402
|
+
ctlarray = ALLOC_N(GLfloat, (sknot_count-sorder)*(tknot_count-torder)*type_len);
|
403
|
+
|
404
|
+
ary_ctl1 = rb_ary_new();
|
405
|
+
mary2ary(args[7], ary_ctl1); /* flatten */
|
406
|
+
ary2cflt(ary_ctl1, ctlarray, (sknot_count-sorder)*(tknot_count-torder)*type_len);
|
407
|
+
break;
|
408
|
+
default:
|
409
|
+
rb_raise(rb_eArgError, "gluNurbsSurface needs 7 or 11 arguments",argc);
|
410
|
+
return Qnil; /* not reached */
|
411
|
+
}
|
412
|
+
GetNURBS(args[0], ndata);
|
413
|
+
gluNurbsSurface(ndata->nobj, sknot_count, sknot, tknot_count, tknot,
|
414
|
+
s_stride, t_stride, ctlarray, sorder, torder, type);
|
415
|
+
|
416
|
+
/* store the pointers */
|
417
|
+
|
418
|
+
gms.ptr = REALLOC_N(gms.ptr, GLfloat*, gms.len+=3);
|
419
|
+
gms.ptr[gms.len-3] = sknot;
|
420
|
+
gms.ptr[gms.len-2] = tknot;
|
421
|
+
gms.ptr[gms.len-1] = ctlarray;
|
422
|
+
|
423
|
+
return Qnil;
|
405
424
|
}
|
406
425
|
static VALUE
|
407
426
|
glu_BeginTrim(obj, arg1)
|
408
427
|
VALUE obj, arg1;
|
409
428
|
{
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
429
|
+
struct nurbsdata *ndata;
|
430
|
+
GetNURBS(arg1, ndata);
|
431
|
+
rb_ary_push(n_current, arg1);
|
432
|
+
gluBeginTrim(ndata->nobj);
|
433
|
+
return Qnil;
|
414
434
|
}
|
415
435
|
static VALUE
|
416
436
|
glu_EndTrim(obj, arg1)
|
417
437
|
VALUE obj, arg1;
|
418
438
|
{
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
439
|
+
struct nurbsdata *ndata;
|
440
|
+
GetNURBS(arg1, ndata);
|
441
|
+
gluEndTrim(ndata->nobj);
|
442
|
+
rb_ary_pop(n_current);
|
443
|
+
return Qnil;
|
423
444
|
}
|
424
445
|
static VALUE
|
425
446
|
glu_PwlCurve(argc, argv, obj)
|
@@ -427,50 +448,63 @@ int argc;
|
|
427
448
|
VALUE *argv;
|
428
449
|
VALUE obj;
|
429
450
|
{
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
451
|
+
struct nurbsdata *ndata;
|
452
|
+
GLint count;
|
453
|
+
GLfloat *array;
|
454
|
+
GLint stride;
|
455
|
+
GLenum type;
|
456
|
+
|
457
|
+
VALUE args[5];
|
458
|
+
VALUE ary_ctl1;
|
459
|
+
|
460
|
+
switch (rb_scan_args(argc, argv, "32", &args[0], &args[1], &args[2], &args[3], &args[4])) {
|
461
|
+
case 3:
|
462
|
+
count = RARRAY(args[1])->len;
|
463
|
+
type = NUM2INT(args[2]);
|
464
|
+
stride = (type == GLU_MAP1_TRIM_2 ? 2 : 3);
|
465
|
+
|
466
|
+
array = ALLOC_N(GLfloat, count*stride);
|
467
|
+
ary_ctl1 = rb_ary_new();
|
468
|
+
mary2ary(args[1], ary_ctl1); /* flatten */
|
469
|
+
ary2cflt(ary_ctl1, array, count*stride);
|
470
|
+
break;
|
471
|
+
case 5:
|
472
|
+
count = NUM2INT(args[1]);
|
473
|
+
stride = NUM2INT(args[3]);
|
474
|
+
type = NUM2INT(args[4]);
|
475
|
+
|
476
|
+
array = ALLOC_N(GLfloat, count*stride);
|
477
|
+
ary_ctl1 = rb_ary_new();
|
478
|
+
mary2ary(args[2], ary_ctl1); /* flatten */
|
479
|
+
ary2cflt(ary_ctl1, array, count*stride);
|
480
|
+
break;
|
481
|
+
default:
|
482
|
+
rb_raise(rb_eArgError, "gluPwlCurve needs 3 or 5 arguments",argc);
|
483
|
+
return Qnil; /* not reached */
|
484
|
+
}
|
485
|
+
|
486
|
+
GetNURBS(args[0], ndata);
|
487
|
+
gluPwlCurve(ndata->nobj, count, array, stride, type);
|
488
|
+
free(array);
|
489
|
+
return Qnil;
|
490
|
+
}
|
491
|
+
|
492
|
+
static VALUE glu_LoadSamplingMatrices(obj,arg1,arg2,arg3,arg4)
|
493
|
+
VALUE obj, arg1,arg2,arg3,arg4;
|
494
|
+
{
|
495
|
+
struct nurbsdata *ndata;
|
496
|
+
GLfloat mdl_mtx[4*4];
|
497
|
+
GLfloat persp_mtx[4*4];
|
498
|
+
GLint viewport[4];
|
499
|
+
|
500
|
+
GetNURBS(arg1, ndata);
|
501
|
+
ary2cmat4x4flt(arg2,mdl_mtx);
|
502
|
+
ary2cmat4x4flt(arg3,persp_mtx);
|
503
|
+
ary2cint(arg4,viewport,4);
|
504
|
+
|
505
|
+
gluLoadSamplingMatrices(ndata->nobj,mdl_mtx,persp_mtx,viewport);
|
506
|
+
|
507
|
+
return Qnil;
|
474
508
|
}
|
475
509
|
|
476
510
|
/*
|
@@ -482,214 +516,162 @@ static VALUE t_current;
|
|
482
516
|
#define TESS_VERTEX 2
|
483
517
|
#define TESS_END 3
|
484
518
|
#define TESS_ERROR 4
|
485
|
-
#define
|
486
|
-
#
|
487
|
-
#
|
488
|
-
#
|
489
|
-
#
|
490
|
-
#
|
491
|
-
#
|
492
|
-
#
|
493
|
-
#
|
494
|
-
#
|
495
|
-
|
496
|
-
# define REF_LAST 15
|
497
|
-
#else /* !GLU_VERSION_1_2 */
|
498
|
-
# define REF_LAST 6
|
499
|
-
#endif /* GLU_VERSION_1_2 */
|
519
|
+
#define TESS_EDGE_FLAG 5
|
520
|
+
#define TESS_OUTDATA 6
|
521
|
+
#define TESS_COMBINE 7
|
522
|
+
#define TESS_BEGIN_DATA 8
|
523
|
+
#define TESS_VERTEX_DATA 9
|
524
|
+
#define TESS_END_DATA 10
|
525
|
+
#define TESS_ERROR_DATA 11
|
526
|
+
#define TESS_EDGE_FLAG_DATA 12
|
527
|
+
#define TESS_COMBINE_DATA 13
|
528
|
+
#define TESS_USERDATA 14
|
529
|
+
|
500
530
|
static void
|
501
531
|
mark_tess(tdata)
|
502
532
|
struct tessdata* tdata;
|
503
533
|
{
|
504
|
-
|
505
|
-
|
534
|
+
if (tdata->tobj)
|
535
|
+
rb_gc_mark(tdata->t_ref);
|
506
536
|
}
|
507
537
|
static void
|
508
538
|
free_tess(tdata)
|
509
539
|
struct tessdata *tdata;
|
510
540
|
{
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
gluDeleteTess(tdata->tobj);
|
516
|
-
}
|
517
|
-
tdata->t_ref = Qnil;
|
518
|
-
tdata->tobj = NULL;
|
541
|
+
if (tdata->tobj)
|
542
|
+
gluDeleteTess(tdata->tobj);
|
543
|
+
tdata->t_ref = Qnil;
|
544
|
+
tdata->tobj = NULL;
|
519
545
|
}
|
520
546
|
static VALUE
|
521
547
|
glu_NewTess(obj)
|
522
548
|
VALUE obj;
|
523
549
|
{
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
550
|
+
VALUE ret;
|
551
|
+
struct tessdata *tdata;
|
552
|
+
ret = Data_Make_Struct(cTess, struct tessdata, mark_tess, free_tess, tdata);
|
553
|
+
tdata->tobj = gluNewTess();
|
554
|
+
tdata->t_ref = rb_ary_new2(REF_LAST);
|
555
|
+
return ret;
|
530
556
|
}
|
531
557
|
static VALUE
|
532
558
|
glu_DeleteTess(obj, arg1)
|
533
559
|
VALUE obj, arg1;
|
534
560
|
{
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
561
|
+
struct tessdata *tdata;
|
562
|
+
GetTESS(arg1, tdata);
|
563
|
+
free_tess(tdata);
|
564
|
+
return Qnil;
|
539
565
|
}
|
540
|
-
|
566
|
+
|
567
|
+
/* tess* callback function wrappers */
|
568
|
+
#define TESS_CALLBACK_COMMON \
|
569
|
+
VALUE tess; \
|
570
|
+
struct tessdata *tdata; \
|
571
|
+
tess = rb_ary_entry(t_current, -1); \
|
572
|
+
if (tess == Qnil) \
|
573
|
+
return; \
|
574
|
+
GetTESS(tess, tdata);
|
575
|
+
|
576
|
+
static void CALLBACK
|
541
577
|
t_begin(type)
|
542
578
|
GLenum type;
|
543
579
|
{
|
544
|
-
|
545
|
-
|
546
|
-
tess = rb_ary_entry(t_current, -1);
|
547
|
-
if (tess != Qnil) {
|
548
|
-
GetTESS(tess, tdata);
|
549
|
-
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_BEGIN), callId, 1, INT2NUM(type));
|
550
|
-
}
|
580
|
+
TESS_CALLBACK_COMMON
|
581
|
+
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_BEGIN), callId, 1, INT2NUM(type));
|
551
582
|
}
|
552
|
-
static void
|
583
|
+
static void CALLBACK
|
553
584
|
t_edgeFlag(flag)
|
554
585
|
GLboolean flag;
|
555
586
|
{
|
556
|
-
|
557
|
-
|
558
|
-
tess = rb_ary_entry(t_current, -1);
|
559
|
-
if (tess != Qnil) {
|
560
|
-
GetTESS(tess, tdata);
|
561
|
-
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_EDGE), callId, 1, INT2NUM(flag));
|
562
|
-
}
|
587
|
+
TESS_CALLBACK_COMMON
|
588
|
+
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_EDGE_FLAG), callId, 1, INT2NUM(flag));
|
563
589
|
}
|
564
|
-
static void
|
590
|
+
static void CALLBACK
|
565
591
|
t_vertex(data)
|
566
592
|
void* data;
|
567
593
|
{
|
568
|
-
|
569
|
-
|
570
|
-
tess = rb_ary_entry(t_current, -1);
|
571
|
-
if (tess != Qnil) {
|
572
|
-
GetTESS(tess, tdata);
|
573
|
-
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_VERTEX), callId, 1, data);
|
574
|
-
}
|
594
|
+
TESS_CALLBACK_COMMON
|
595
|
+
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_VERTEX), callId, 1, data);
|
575
596
|
}
|
576
|
-
static void
|
597
|
+
static void CALLBACK
|
577
598
|
t_end()
|
578
599
|
{
|
579
|
-
|
580
|
-
|
581
|
-
tess = rb_ary_entry(t_current, -1);
|
582
|
-
if (tess != Qnil) {
|
583
|
-
GetTESS(tess, tdata);
|
584
|
-
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_END), callId, 0);
|
585
|
-
}
|
600
|
+
TESS_CALLBACK_COMMON
|
601
|
+
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_END), callId, 0);
|
586
602
|
}
|
587
|
-
static void
|
603
|
+
static void CALLBACK
|
588
604
|
t_error(errorno)
|
589
605
|
GLenum errorno;
|
590
606
|
{
|
591
|
-
|
592
|
-
|
593
|
-
tess = rb_ary_entry(t_current, -1);
|
594
|
-
if (tess != Qnil) {
|
595
|
-
GetTESS(tess, tdata);
|
596
|
-
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_ERROR), callId, 1, INT2NUM(errorno));
|
597
|
-
}
|
607
|
+
TESS_CALLBACK_COMMON
|
608
|
+
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_ERROR), callId, 1, INT2NUM(errorno));
|
598
609
|
}
|
599
|
-
|
600
|
-
#if defined(GLU_VERSION_1_2)
|
601
|
-
static void
|
610
|
+
static void CALLBACK
|
602
611
|
t_begin_data(type, user_data)
|
603
612
|
GLenum type;
|
604
613
|
void* user_data;
|
605
614
|
{
|
606
|
-
|
607
|
-
|
608
|
-
tess = rb_ary_entry(t_current, -1);
|
609
|
-
if (tess != Qnil) {
|
610
|
-
GetTESS(tess, tdata);
|
611
|
-
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_BEGIN_DATA), callId, 2, INT2NUM(type), user_data);
|
612
|
-
}
|
615
|
+
TESS_CALLBACK_COMMON
|
616
|
+
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_BEGIN_DATA), callId, 2, INT2NUM(type), user_data);
|
613
617
|
}
|
614
|
-
static void
|
618
|
+
static void CALLBACK
|
615
619
|
t_edgeFlag_data(flag, user_data)
|
616
620
|
GLboolean flag;
|
617
621
|
void* user_data;
|
618
622
|
{
|
619
|
-
|
620
|
-
|
621
|
-
tess = rb_ary_entry(t_current, -1);
|
622
|
-
if (tess != Qnil) {
|
623
|
-
GetTESS(tess, tdata);
|
624
|
-
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_EDGE_DATA), callId, 2, INT2NUM(flag), user_data);
|
625
|
-
}
|
623
|
+
TESS_CALLBACK_COMMON
|
624
|
+
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_EDGE_FLAG_DATA), callId, 2, INT2NUM(flag), user_data);
|
626
625
|
}
|
627
|
-
static void
|
626
|
+
static void CALLBACK
|
628
627
|
t_vertex_data(data, user_data)
|
629
628
|
void* data;
|
630
629
|
void* user_data;
|
631
630
|
{
|
632
|
-
|
633
|
-
|
634
|
-
tess = rb_ary_entry(t_current, -1);
|
635
|
-
if (tess != Qnil) {
|
636
|
-
GetTESS(tess, tdata);
|
637
|
-
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_VERTEX_DATA), callId, 2, data, user_data);
|
638
|
-
}
|
631
|
+
TESS_CALLBACK_COMMON
|
632
|
+
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_VERTEX_DATA), callId, 2, data, user_data);
|
639
633
|
}
|
640
|
-
static void
|
634
|
+
static void CALLBACK
|
641
635
|
t_end_data(user_data)
|
642
636
|
void* user_data;
|
643
637
|
{
|
644
|
-
|
645
|
-
|
646
|
-
tess = rb_ary_entry(t_current, -1);
|
647
|
-
if (tess != Qnil) {
|
648
|
-
GetTESS(tess, tdata);
|
649
|
-
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_END_DATA), callId, 1, user_data);
|
650
|
-
}
|
638
|
+
TESS_CALLBACK_COMMON
|
639
|
+
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_END_DATA), callId, 1, user_data);
|
651
640
|
}
|
652
|
-
static void
|
641
|
+
static void CALLBACK
|
653
642
|
t_error_data(errorno, user_data)
|
654
643
|
GLenum errorno;
|
655
644
|
void* user_data;
|
656
645
|
{
|
657
|
-
|
658
|
-
|
659
|
-
tess = rb_ary_entry(t_current, -1);
|
660
|
-
if (tess != Qnil) {
|
661
|
-
GetTESS(tess, tdata);
|
662
|
-
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_ERROR_DATA), callId, 2, INT2NUM(errorno), user_data);
|
663
|
-
}
|
646
|
+
TESS_CALLBACK_COMMON
|
647
|
+
rb_funcall(rb_ary_entry(tdata->t_ref, TESS_ERROR_DATA), callId, 2, INT2NUM(errorno), user_data);
|
664
648
|
}
|
665
|
-
|
649
|
+
|
650
|
+
static void CALLBACK
|
666
651
|
t_combine(coords, vertex_data, weight, outData)
|
667
652
|
GLdouble coords[3];
|
668
653
|
void* vertex_data[4];
|
669
654
|
GLfloat weight[4];
|
670
655
|
void** outData;
|
671
656
|
{
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
rb_ary_store(rb_weight, i, rb_float_new(weight[i]));
|
688
|
-
*outData = (void*)rb_funcall(rb_ary_entry(tdata->t_ref, TESS_COMBINE), callId, 3, rb_coord, rb_vertex_data, rb_weight);
|
689
|
-
rb_ary_push(rb_ary_entry(tdata->t_ref, TESS_OUTDATA), (VALUE)*outData);
|
690
|
-
}
|
657
|
+
VALUE rb_coord, rb_vertex_data, rb_weight;
|
658
|
+
int i;
|
659
|
+
TESS_CALLBACK_COMMON
|
660
|
+
|
661
|
+
rb_coord = rb_ary_new2(3);
|
662
|
+
for (i = 0; i < 3; i++)
|
663
|
+
rb_ary_store(rb_coord, i, rb_float_new(coords[i]));
|
664
|
+
rb_vertex_data = rb_ary_new2(4);
|
665
|
+
for (i = 0; i < 4; i++)
|
666
|
+
rb_ary_store(rb_vertex_data, i, (VALUE)vertex_data[i]);
|
667
|
+
rb_weight = rb_ary_new2(4);
|
668
|
+
for (i = 0; i < 4; i++)
|
669
|
+
rb_ary_store(rb_weight, i, rb_float_new(weight[i]));
|
670
|
+
*outData = (void*)rb_funcall(rb_ary_entry(tdata->t_ref, TESS_COMBINE), callId, 3, rb_coord, rb_vertex_data, rb_weight);
|
671
|
+
rb_ary_push(rb_ary_entry(tdata->t_ref, TESS_OUTDATA), (VALUE)*outData);
|
691
672
|
}
|
692
|
-
|
673
|
+
|
674
|
+
static void CALLBACK
|
693
675
|
t_combine_data(coords, vertex_data, weight, outData, user_data)
|
694
676
|
GLdouble coords[3];
|
695
677
|
void* vertex_data[4];
|
@@ -697,487 +679,460 @@ GLfloat weight[4];
|
|
697
679
|
void** outData;
|
698
680
|
void* user_data;
|
699
681
|
{
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
rb_ary_push(rb_ary_entry(tdata->t_ref, TESS_OUTDATA), (VALUE)*outData);
|
718
|
-
}
|
682
|
+
VALUE rb_coord, rb_vertex_data, rb_weight;
|
683
|
+
int i;
|
684
|
+
TESS_CALLBACK_COMMON
|
685
|
+
|
686
|
+
rb_coord = rb_ary_new2(3);
|
687
|
+
for (i = 0; i < 3; i++)
|
688
|
+
rb_ary_store(rb_coord, i, rb_float_new(coords[i]));
|
689
|
+
rb_vertex_data = rb_ary_new2(4);
|
690
|
+
for (i = 0; i < 4; i++)
|
691
|
+
rb_ary_store(rb_vertex_data, i, (VALUE)vertex_data[i]);
|
692
|
+
rb_weight = rb_ary_new2(4);
|
693
|
+
for (i = 0; i < 4; i++)
|
694
|
+
rb_ary_store(rb_weight, i, rb_float_new(weight[i]));
|
695
|
+
|
696
|
+
*outData = (void*)rb_funcall(rb_ary_entry(tdata->t_ref, TESS_COMBINE_DATA), callId, 4, rb_coord, rb_vertex_data, rb_weight, (VALUE)user_data);
|
697
|
+
|
698
|
+
rb_ary_push(rb_ary_entry(tdata->t_ref, TESS_OUTDATA), (VALUE)*outData);
|
719
699
|
}
|
700
|
+
|
701
|
+
#undef TESS_CALLBACK_COMMON
|
702
|
+
|
720
703
|
static VALUE
|
721
704
|
glu_TessProperty(obj, arg1, arg2, arg3)
|
722
705
|
VALUE obj, arg1, arg2;
|
723
706
|
{
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
707
|
+
struct tessdata* tdata;
|
708
|
+
GLenum property;
|
709
|
+
GLdouble value;
|
710
|
+
GetTESS(arg1, tdata);
|
711
|
+
property = (GLenum)NUM2INT(arg2);
|
712
|
+
value = (GLdouble)NUM2DBL(arg3);
|
713
|
+
gluTessProperty(tdata->tobj, property, value);
|
714
|
+
return Qnil;
|
732
715
|
}
|
733
716
|
static VALUE
|
734
717
|
glu_GetTessProperty(obj, arg1, arg2)
|
735
718
|
VALUE obj, arg1, arg2;
|
736
719
|
{
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
720
|
+
struct tessdata* tdata;
|
721
|
+
GLenum property;
|
722
|
+
GLdouble value;
|
723
|
+
GetTESS(arg1, tdata);
|
724
|
+
property = (GLenum)NUM2INT(arg2);
|
725
|
+
gluGetTessProperty(tdata->tobj, property, &value);
|
726
|
+
return rb_float_new(value);
|
744
727
|
}
|
745
728
|
static VALUE
|
746
729
|
glu_TessNormal(obj, arg1, arg2, arg3, arg4)
|
747
730
|
VALUE obj, arg1, arg2, arg3, arg4;
|
748
731
|
{
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
732
|
+
struct tessdata* tdata;
|
733
|
+
GLdouble x, y, z;
|
734
|
+
GetTESS(arg1, tdata);
|
735
|
+
x = (GLdouble)NUM2DBL(arg2);
|
736
|
+
y = (GLdouble)NUM2DBL(arg3);
|
737
|
+
z = (GLdouble)NUM2DBL(arg4);
|
738
|
+
gluTessNormal(tdata->tobj, x, y, z);
|
739
|
+
return Qnil;
|
757
740
|
}
|
758
741
|
static VALUE
|
759
742
|
glu_TessBeginPolygon(obj, arg1, arg2)
|
760
743
|
VALUE obj, arg1, arg2;
|
761
744
|
{
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
745
|
+
struct tessdata* tdata;
|
746
|
+
GetTESS(arg1, tdata);
|
747
|
+
rb_ary_store(tdata->t_ref, TESS_USERDATA, arg2);
|
748
|
+
rb_ary_store(tdata->t_ref, TESS_OUTDATA, rb_ary_new());
|
749
|
+
rb_ary_store(tdata->t_ref, TESS_DATA, rb_ary_new());
|
750
|
+
rb_ary_push(t_current, arg1);
|
751
|
+
gluTessBeginPolygon(tdata->tobj, (void*)arg2);
|
752
|
+
return Qnil;
|
770
753
|
}
|
771
754
|
static VALUE
|
772
755
|
glu_TessEndPolygon(obj, arg1)
|
773
756
|
VALUE obj, arg1;
|
774
757
|
{
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
758
|
+
struct tessdata* tdata;
|
759
|
+
GetTESS(arg1, tdata);
|
760
|
+
gluTessEndPolygon(tdata->tobj);
|
761
|
+
rb_ary_store(tdata->t_ref, TESS_USERDATA, Qnil);
|
762
|
+
rb_ary_store(tdata->t_ref, TESS_OUTDATA, Qnil);
|
763
|
+
rb_ary_store(tdata->t_ref, TESS_DATA, Qnil);
|
764
|
+
rb_ary_pop(t_current);
|
765
|
+
return Qnil;
|
783
766
|
}
|
784
767
|
static VALUE
|
785
768
|
glu_TessBeginContour(obj, arg1)
|
786
769
|
VALUE obj, arg1;
|
787
770
|
{
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
771
|
+
struct tessdata* tdata;
|
772
|
+
GetTESS(arg1, tdata);
|
773
|
+
gluTessBeginContour(tdata->tobj);
|
774
|
+
return Qnil;
|
792
775
|
}
|
793
776
|
static VALUE
|
794
777
|
glu_TessEndContour(obj, arg1)
|
795
778
|
{
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
779
|
+
struct tessdata* tdata;
|
780
|
+
GetTESS(arg1, tdata);
|
781
|
+
gluTessEndContour(tdata->tobj);
|
782
|
+
return Qnil;
|
800
783
|
}
|
801
|
-
|
784
|
+
|
785
|
+
#define TESS_CALLBACK_CASE(_type_,_function_) \
|
786
|
+
case GLU_##_type_: \
|
787
|
+
rb_ary_store(tdata->t_ref, _type_, arg3); \
|
788
|
+
if (NIL_P(arg3)) \
|
789
|
+
gluTessCallback(tdata->tobj, type, NULL); \
|
790
|
+
else \
|
791
|
+
gluTessCallback(tdata->tobj, type, _function_); \
|
792
|
+
break;
|
802
793
|
|
803
794
|
static VALUE
|
804
795
|
glu_TessCallback(obj, arg1, arg2, arg3)
|
805
796
|
VALUE obj, arg1, arg2, arg3;
|
806
797
|
{
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
#
|
831
|
-
|
832
|
-
#endif
|
833
|
-
rb_ary_store(tdata->t_ref, TESS_EDGE, arg3);
|
834
|
-
if (NIL_P(arg3))
|
835
|
-
gluTessCallback(tdata->tobj, type, NULL);
|
836
|
-
else
|
837
|
-
gluTessCallback(tdata->tobj, type, (VOIDFUNC)t_edgeFlag);
|
838
|
-
break;
|
839
|
-
#if defined(GLU_VERSION_1_2)
|
840
|
-
case GLU_TESS_VERTEX:
|
841
|
-
#else
|
842
|
-
case GLU_VERTEX:
|
843
|
-
#endif
|
844
|
-
rb_ary_store(tdata->t_ref, TESS_VERTEX, arg3);
|
845
|
-
if (NIL_P(arg3))
|
846
|
-
gluTessCallback(tdata->tobj, type, NULL);
|
847
|
-
else
|
848
|
-
gluTessCallback(tdata->tobj, type, (VOIDFUNC)t_vertex);
|
849
|
-
break;
|
850
|
-
#if defined(GLU_VERSION_1_2)
|
851
|
-
case GLU_TESS_END:
|
852
|
-
#else
|
853
|
-
case GLU_END:
|
854
|
-
#endif
|
855
|
-
rb_ary_store(tdata->t_ref, TESS_END, arg3);
|
856
|
-
if (NIL_P(arg3))
|
857
|
-
gluTessCallback(tdata->tobj, type, NULL);
|
858
|
-
else
|
859
|
-
gluTessCallback(tdata->tobj, type, (VOIDFUNC)t_end);
|
860
|
-
break;
|
861
|
-
#if defined(GLU_VERSION_1_2)
|
862
|
-
case GLU_TESS_ERROR:
|
863
|
-
#else
|
864
|
-
case GLU_ERROR:
|
865
|
-
#endif
|
866
|
-
rb_ary_store(tdata->t_ref, TESS_ERROR, arg3);
|
867
|
-
if (NIL_P(arg3))
|
868
|
-
gluTessCallback(tdata->tobj, type, NULL);
|
869
|
-
else
|
870
|
-
gluTessCallback(tdata->tobj, type, (VOIDFUNC)t_error);
|
871
|
-
break;
|
872
|
-
#if defined(GLU_VERSION_1_2)
|
873
|
-
case GLU_TESS_COMBINE:
|
874
|
-
rb_ary_store(tdata->t_ref, TESS_COMBINE, arg3);
|
875
|
-
if (NIL_P(arg3))
|
876
|
-
gluTessCallback(tdata->tobj, type, NULL);
|
877
|
-
else
|
878
|
-
gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_combine));
|
879
|
-
break;
|
880
|
-
case GLU_TESS_BEGIN_DATA:
|
881
|
-
rb_ary_store(tdata->t_ref, TESS_BEGIN_DATA, arg3);
|
882
|
-
if (NIL_P(arg3))
|
883
|
-
gluTessCallback(tdata->tobj, type, NULL);
|
884
|
-
else
|
885
|
-
gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_begin_data));
|
886
|
-
break;
|
887
|
-
case GLU_TESS_VERTEX_DATA:
|
888
|
-
rb_ary_store(tdata->t_ref, TESS_VERTEX_DATA, arg3);
|
889
|
-
if (NIL_P(arg3))
|
890
|
-
gluTessCallback(tdata->tobj, type, NULL);
|
891
|
-
else
|
892
|
-
gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_vertex_data));
|
893
|
-
break;
|
894
|
-
case GLU_TESS_END_DATA:
|
895
|
-
rb_ary_store(tdata->t_ref, TESS_END_DATA, arg3);
|
896
|
-
if (NIL_P(arg3))
|
897
|
-
gluTessCallback(tdata->tobj, type, NULL);
|
898
|
-
else
|
899
|
-
gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_end_data));
|
900
|
-
break;
|
901
|
-
case GLU_TESS_ERROR_DATA:
|
902
|
-
rb_ary_store(tdata->t_ref, TESS_ERROR_DATA, arg3);
|
903
|
-
if (NIL_P(arg3))
|
904
|
-
gluTessCallback(tdata->tobj, type, NULL);
|
905
|
-
else
|
906
|
-
gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_error_data));
|
907
|
-
break;
|
908
|
-
case GLU_TESS_EDGE_FLAG_DATA:
|
909
|
-
rb_ary_store(tdata->t_ref, TESS_EDGE_DATA, arg3);
|
910
|
-
if (NIL_P(arg3))
|
911
|
-
gluTessCallback(tdata->tobj, type, NULL);
|
912
|
-
else
|
913
|
-
gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_edgeFlag_data));
|
914
|
-
break;
|
915
|
-
case GLU_TESS_COMBINE_DATA:
|
916
|
-
rb_ary_store(tdata->t_ref, TESS_COMBINE_DATA, arg3);
|
917
|
-
if (NIL_P(arg3))
|
918
|
-
gluTessCallback(tdata->tobj, type, NULL);
|
919
|
-
else
|
920
|
-
gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_combine_data));
|
921
|
-
break;
|
922
|
-
#endif /* GLU_VERSION_1_2 */
|
923
|
-
}
|
924
|
-
return Qnil;
|
925
|
-
}
|
798
|
+
struct tessdata* tdata;
|
799
|
+
GLenum type;
|
800
|
+
GetTESS(arg1, tdata);
|
801
|
+
type = (GLenum)NUM2INT(arg2);
|
802
|
+
if (!rb_obj_is_kind_of(arg3,rb_cProc) && !NIL_P(arg3))
|
803
|
+
rb_raise(rb_eTypeError, "gluTessCallback needs Proc Object:%s",rb_class2name(CLASS_OF(arg3)));
|
804
|
+
|
805
|
+
switch (type) {
|
806
|
+
TESS_CALLBACK_CASE(TESS_BEGIN,t_begin)
|
807
|
+
TESS_CALLBACK_CASE(TESS_BEGIN_DATA,t_begin_data)
|
808
|
+
TESS_CALLBACK_CASE(TESS_EDGE_FLAG,t_edgeFlag)
|
809
|
+
TESS_CALLBACK_CASE(TESS_EDGE_FLAG_DATA,t_edgeFlag_data)
|
810
|
+
TESS_CALLBACK_CASE(TESS_VERTEX,t_vertex)
|
811
|
+
TESS_CALLBACK_CASE(TESS_VERTEX_DATA,t_vertex_data)
|
812
|
+
TESS_CALLBACK_CASE(TESS_END,t_end)
|
813
|
+
TESS_CALLBACK_CASE(TESS_END_DATA,t_end_data)
|
814
|
+
TESS_CALLBACK_CASE(TESS_ERROR,t_error)
|
815
|
+
TESS_CALLBACK_CASE(TESS_ERROR_DATA,t_error_data)
|
816
|
+
TESS_CALLBACK_CASE(TESS_COMBINE,t_combine)
|
817
|
+
TESS_CALLBACK_CASE(TESS_COMBINE_DATA,t_combine_data)
|
818
|
+
}
|
819
|
+
return Qnil;
|
820
|
+
}
|
821
|
+
#undef TESS_CALLBACK_CASE
|
822
|
+
|
926
823
|
static VALUE
|
927
824
|
glu_BeginPolygon(obj, arg1)
|
928
825
|
VALUE obj, arg1;
|
929
826
|
{
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
827
|
+
struct tessdata* tdata;
|
828
|
+
GetTESS(arg1, tdata);
|
829
|
+
rb_ary_store(tdata->t_ref, TESS_DATA, rb_ary_new());
|
830
|
+
rb_ary_push(t_current, arg1);
|
831
|
+
gluBeginPolygon(tdata->tobj);
|
832
|
+
return Qnil;
|
936
833
|
}
|
937
834
|
static VALUE
|
938
835
|
glu_TessVertex(obj, arg1, arg2, arg3)
|
939
836
|
VALUE obj, arg1, arg2, arg3;
|
940
837
|
{
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
return Qnil;
|
838
|
+
struct tessdata* tdata;
|
839
|
+
GLdouble v[3] = {0.0,0.0,0.0};
|
840
|
+
GetTESS(arg1, tdata);
|
841
|
+
rb_ary_push(rb_ary_entry(tdata->t_ref, TESS_DATA), arg3);
|
842
|
+
Check_Type(arg2,T_ARRAY);
|
843
|
+
ary2cdbl(arg2, v, 3);
|
844
|
+
gluTessVertex(tdata->tobj, v,(void *)arg3);
|
845
|
+
return Qnil;
|
950
846
|
}
|
951
847
|
static VALUE
|
952
848
|
glu_NextContour(obj, arg1, arg2)
|
953
849
|
VALUE obj, arg1, arg2;
|
954
850
|
{
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
851
|
+
struct tessdata* tdata;
|
852
|
+
GLenum type;
|
853
|
+
GetTESS(arg1, tdata);
|
854
|
+
type = (GLenum)NUM2INT(arg2);
|
855
|
+
gluNextContour(tdata->tobj, type);
|
856
|
+
return Qnil;
|
961
857
|
}
|
962
858
|
static VALUE
|
963
859
|
glu_EndPolygon(obj, arg1)
|
964
860
|
VALUE obj, arg1;
|
965
861
|
{
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
862
|
+
struct tessdata* tdata;
|
863
|
+
GetTESS(arg1, tdata);
|
864
|
+
gluEndPolygon(tdata->tobj);
|
865
|
+
rb_ary_store(tdata->t_ref, TESS_DATA, Qnil);
|
866
|
+
rb_ary_pop(t_current);
|
867
|
+
return Qnil;
|
972
868
|
}
|
973
869
|
|
974
870
|
/*
|
975
871
|
* Quadric API
|
976
872
|
*/
|
873
|
+
static VALUE q_current;
|
874
|
+
|
875
|
+
static void CALLBACK
|
876
|
+
q_error(errorno)
|
877
|
+
GLenum errorno;
|
878
|
+
{
|
879
|
+
VALUE quad;
|
880
|
+
struct quaddata *qdata;
|
881
|
+
quad = rb_ary_entry(q_current, -1);
|
882
|
+
if (quad == Qnil)
|
883
|
+
return;
|
884
|
+
GetQUAD(quad, qdata);
|
885
|
+
rb_funcall(rb_ary_entry(qdata->q_ref, GLU_ERROR), callId, 1, INT2NUM(errorno));
|
886
|
+
}
|
887
|
+
|
888
|
+
static VALUE
|
889
|
+
glu_QuadricCallback(obj, arg1, arg2, arg3)
|
890
|
+
VALUE obj, arg1, arg2, arg3;
|
891
|
+
{
|
892
|
+
struct quaddata* qdata;
|
893
|
+
GLenum type;
|
894
|
+
GetQUAD(arg1, qdata);
|
895
|
+
type = (GLenum)NUM2INT(arg2);
|
896
|
+
if (!rb_obj_is_kind_of(arg3,rb_cProc) && !NIL_P(arg3))
|
897
|
+
rb_raise(rb_eTypeError, "gluQuadricCallback needs Proc Object:%s",rb_class2name(CLASS_OF(arg3)));
|
898
|
+
|
899
|
+
if (type!=GLU_ERROR)
|
900
|
+
return Qnil;
|
901
|
+
|
902
|
+
rb_ary_store(qdata->q_ref, type, arg3);
|
903
|
+
if (NIL_P(arg3))
|
904
|
+
gluQuadricCallback(qdata->qobj, type, NULL);
|
905
|
+
else
|
906
|
+
gluQuadricCallback(qdata->qobj, type, q_error);
|
907
|
+
|
908
|
+
return Qnil;
|
909
|
+
}
|
910
|
+
|
977
911
|
static void
|
978
912
|
free_quad(qdata)
|
979
913
|
struct quaddata *qdata;
|
980
914
|
{
|
981
915
|
if (qdata->qobj) gluDeleteQuadric(qdata->qobj);
|
982
916
|
qdata->qobj = NULL;
|
917
|
+
qdata->q_ref = Qnil;
|
918
|
+
}
|
919
|
+
static void
|
920
|
+
mark_quad(qdata)
|
921
|
+
struct quaddata* qdata;
|
922
|
+
{
|
923
|
+
if (qdata->qobj)
|
924
|
+
rb_gc_mark(qdata->q_ref);
|
983
925
|
}
|
984
926
|
static VALUE
|
985
927
|
glu_NewQuadric(obj)
|
986
928
|
VALUE obj;
|
987
929
|
{
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
930
|
+
VALUE ret;
|
931
|
+
struct quaddata *qdata;
|
932
|
+
ret = Data_Make_Struct(cQuad, struct quaddata, mark_quad, free_quad, qdata);
|
933
|
+
qdata->qobj = gluNewQuadric();
|
934
|
+
qdata->q_ref = rb_ary_new2(REF_LAST);
|
935
|
+
return ret;
|
993
936
|
}
|
994
937
|
static VALUE
|
995
938
|
glu_DeleteQuadric(obj, arg1)
|
996
939
|
VALUE obj, arg1;
|
997
940
|
{
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
941
|
+
struct quaddata *qdata;
|
942
|
+
GetQUAD(arg1, qdata);
|
943
|
+
free_quad(qdata);
|
944
|
+
return Qnil;
|
1002
945
|
}
|
1003
946
|
static VALUE
|
1004
947
|
glu_QuadricNormals(obj, arg1, arg2)
|
1005
948
|
VALUE obj, arg1, arg2;
|
1006
949
|
{
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
950
|
+
struct quaddata* qdata;
|
951
|
+
GLenum normals;
|
952
|
+
GetQUAD(arg1, qdata);
|
953
|
+
normals = (GLenum)NUM2INT(arg2);
|
954
|
+
gluQuadricNormals(qdata->qobj, normals);
|
955
|
+
return Qnil;
|
1013
956
|
}
|
1014
957
|
static VALUE
|
1015
958
|
glu_QuadricTexture(obj, arg1, arg2)
|
1016
959
|
VALUE obj, arg1, arg2;
|
1017
960
|
{
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
961
|
+
struct quaddata* qdata;
|
962
|
+
GLboolean textureCoords;
|
963
|
+
GetQUAD(arg1, qdata);
|
964
|
+
textureCoords = (GLboolean)NUM2INT(arg2);
|
965
|
+
gluQuadricTexture(qdata->qobj, textureCoords);
|
966
|
+
return Qnil;
|
1024
967
|
}
|
1025
968
|
static VALUE
|
1026
969
|
glu_QuadricOrientation(obj, arg1, arg2)
|
1027
970
|
VALUE obj, arg1, arg2;
|
1028
971
|
{
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
972
|
+
struct quaddata* qdata;
|
973
|
+
GLenum orientation;
|
974
|
+
GetQUAD(arg1, qdata);
|
975
|
+
orientation = (GLenum)NUM2INT(arg2);
|
976
|
+
gluQuadricOrientation(qdata->qobj, orientation);
|
977
|
+
return Qnil;
|
1035
978
|
}
|
1036
979
|
static VALUE
|
1037
980
|
glu_QuadricDrawStyle(obj, arg1, arg2)
|
1038
981
|
VALUE obj, arg1, arg2;
|
1039
982
|
{
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
983
|
+
struct quaddata* qdata;
|
984
|
+
GLenum drawStyle;
|
985
|
+
GetQUAD(arg1, qdata);
|
986
|
+
drawStyle = (GLenum)NUM2INT(arg2);
|
987
|
+
gluQuadricDrawStyle(qdata->qobj, drawStyle);
|
988
|
+
return Qnil;
|
1046
989
|
}
|
1047
990
|
static VALUE
|
1048
991
|
glu_Cylinder(obj, arg1, arg2, arg3, arg4, arg5, arg6)
|
1049
992
|
VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6;
|
1050
993
|
{
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
994
|
+
struct quaddata* qdata;
|
995
|
+
GLdouble baseRadius;
|
996
|
+
GLdouble topRadius;
|
997
|
+
GLdouble height;
|
998
|
+
GLint slices;
|
999
|
+
GLint stacks;
|
1057
1000
|
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1001
|
+
GetQUAD(arg1, qdata);
|
1002
|
+
baseRadius = (GLdouble)NUM2DBL(arg2);
|
1003
|
+
topRadius = (GLdouble)NUM2DBL(arg3);
|
1004
|
+
height = (GLdouble)NUM2DBL(arg4);
|
1005
|
+
slices = (GLint)NUM2INT(arg5);
|
1006
|
+
stacks = (GLint)NUM2INT(arg6);
|
1064
1007
|
|
1065
|
-
|
1066
|
-
|
1008
|
+
rb_ary_push(q_current, arg1);
|
1009
|
+
gluCylinder(qdata->qobj, baseRadius, topRadius, height, slices, stacks);
|
1010
|
+
rb_ary_pop(q_current);
|
1011
|
+
return Qnil;
|
1067
1012
|
}
|
1068
1013
|
static VALUE
|
1069
1014
|
glu_Disk(obj, arg1, arg2, arg3, arg4, arg5)
|
1070
1015
|
VALUE obj, arg1, arg2, arg3, arg4, arg5;
|
1071
1016
|
{
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1017
|
+
struct quaddata* qdata;
|
1018
|
+
GLdouble innerRadius;
|
1019
|
+
GLdouble outerRadius;
|
1020
|
+
GLint slices;
|
1021
|
+
GLint loops;
|
1022
|
+
|
1023
|
+
GetQUAD(arg1, qdata);
|
1024
|
+
innerRadius = (GLdouble)NUM2DBL(arg2);
|
1025
|
+
outerRadius = (GLdouble)NUM2DBL(arg3);
|
1026
|
+
slices = (GLint)NUM2INT(arg4);
|
1027
|
+
loops = (GLint)NUM2INT(arg5);
|
1077
1028
|
|
1078
|
-
|
1079
|
-
innerRadius = (GLdouble)NUM2DBL(arg2);
|
1080
|
-
outerRadius = (GLdouble)NUM2DBL(arg3);
|
1081
|
-
slices = (GLint)NUM2INT(arg4);
|
1082
|
-
loops = (GLint)NUM2INT(arg5);
|
1029
|
+
rb_ary_push(q_current, arg1);
|
1083
1030
|
|
1084
|
-
|
1085
|
-
|
1031
|
+
gluDisk(qdata->qobj, innerRadius, outerRadius, slices, loops);
|
1032
|
+
rb_ary_pop(q_current);
|
1033
|
+
return Qnil;
|
1086
1034
|
}
|
1087
1035
|
static VALUE
|
1088
1036
|
glu_PartialDisk(obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
|
1089
1037
|
VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7;
|
1090
1038
|
{
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1039
|
+
struct quaddata* qdata;
|
1040
|
+
GLdouble innerRadius;
|
1041
|
+
GLdouble outerRadius;
|
1042
|
+
GLint slices;
|
1043
|
+
GLint loops;
|
1044
|
+
GLdouble startAngle;
|
1045
|
+
GLdouble sweepAngle;
|
1046
|
+
|
1047
|
+
GetQUAD(arg1, qdata);
|
1048
|
+
innerRadius = (GLdouble)NUM2DBL(arg2);
|
1049
|
+
outerRadius = (GLdouble)NUM2DBL(arg3);
|
1050
|
+
slices = (GLint)NUM2INT(arg4);
|
1051
|
+
loops = (GLint)NUM2INT(arg5);
|
1052
|
+
startAngle = (GLdouble)NUM2DBL(arg6);
|
1053
|
+
sweepAngle = (GLdouble)NUM2DBL(arg7);
|
1054
|
+
|
1055
|
+
rb_ary_push(q_current, arg1);
|
1056
|
+
gluPartialDisk(qdata->qobj, innerRadius, outerRadius, slices, loops, startAngle, sweepAngle);
|
1057
|
+
rb_ary_pop(q_current);
|
1058
|
+
return Qnil;
|
1109
1059
|
}
|
1110
1060
|
static VALUE
|
1111
1061
|
glu_Sphere(obj, arg1, arg2, arg3, arg4)
|
1112
1062
|
VALUE obj, arg1, arg2, arg3, arg4;
|
1113
1063
|
{
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1064
|
+
struct quaddata* qdata;
|
1065
|
+
GLdouble radius;
|
1066
|
+
GLint slices;
|
1067
|
+
GLint stacks;
|
1118
1068
|
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1069
|
+
GetQUAD(arg1, qdata);
|
1070
|
+
radius = (GLdouble)NUM2DBL(arg2);
|
1071
|
+
slices = (GLint)NUM2INT(arg3);
|
1072
|
+
stacks = (GLint)NUM2INT(arg4);
|
1123
1073
|
|
1124
|
-
|
1125
|
-
|
1074
|
+
rb_ary_push(q_current, arg1);
|
1075
|
+
gluSphere(qdata->qobj, radius, slices, stacks);
|
1076
|
+
rb_ary_pop(q_current);
|
1077
|
+
return Qnil;
|
1126
1078
|
}
|
1079
|
+
|
1080
|
+
/* */
|
1081
|
+
|
1127
1082
|
static VALUE
|
1128
1083
|
glu_LookAt(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
|
1129
1084
|
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
1130
1085
|
{
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1086
|
+
GLdouble eyex;
|
1087
|
+
GLdouble eyey;
|
1088
|
+
GLdouble eyez;
|
1089
|
+
GLdouble centerx;
|
1090
|
+
GLdouble centery;
|
1091
|
+
GLdouble centerz;
|
1092
|
+
GLdouble upx;
|
1093
|
+
GLdouble upy;
|
1094
|
+
GLdouble upz;
|
1095
|
+
eyex = (GLdouble)NUM2DBL(arg1);
|
1096
|
+
eyey = (GLdouble)NUM2DBL(arg2);
|
1097
|
+
eyez = (GLdouble)NUM2DBL(arg3);
|
1098
|
+
centerx = (GLdouble)NUM2DBL(arg4);
|
1099
|
+
centery = (GLdouble)NUM2DBL(arg5);
|
1100
|
+
centerz = (GLdouble)NUM2DBL(arg6);
|
1101
|
+
upx = (GLdouble)NUM2DBL(arg7);
|
1102
|
+
upy = (GLdouble)NUM2DBL(arg8);
|
1103
|
+
upz = (GLdouble)NUM2DBL(arg9);
|
1104
|
+
gluLookAt( eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz );
|
1105
|
+
return Qnil;
|
1151
1106
|
}
|
1152
1107
|
static VALUE
|
1153
1108
|
glu_Ortho2D(obj,arg1,arg2,arg3,arg4)
|
1154
1109
|
VALUE obj,arg1,arg2,arg3,arg4;
|
1155
1110
|
{
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1111
|
+
GLdouble left;
|
1112
|
+
GLdouble right;
|
1113
|
+
GLdouble bottom;
|
1114
|
+
GLdouble top;
|
1115
|
+
left = (GLdouble)NUM2DBL(arg1);
|
1116
|
+
right = (GLdouble)NUM2DBL(arg2);
|
1117
|
+
bottom = (GLdouble)NUM2DBL(arg3);
|
1118
|
+
top = (GLdouble)NUM2DBL(arg4);
|
1119
|
+
gluOrtho2D(left,right,bottom,top);
|
1120
|
+
return Qnil;
|
1166
1121
|
}
|
1167
1122
|
static VALUE
|
1168
1123
|
glu_Perspective(obj,arg1,arg2,arg3,arg4)
|
1169
1124
|
VALUE obj,arg1,arg2,arg3,arg4;
|
1170
1125
|
{
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1126
|
+
GLdouble fovy;
|
1127
|
+
GLdouble aspect;
|
1128
|
+
GLdouble zNear;
|
1129
|
+
GLdouble zFar;
|
1130
|
+
fovy = (GLdouble)NUM2DBL(arg1);
|
1131
|
+
aspect = (GLdouble)NUM2DBL(arg2);
|
1132
|
+
zNear = (GLdouble)NUM2DBL(arg3);
|
1133
|
+
zFar = (GLdouble)NUM2DBL(arg4);
|
1134
|
+
gluPerspective(fovy,aspect,zNear,zFar);
|
1135
|
+
return Qnil;
|
1181
1136
|
}
|
1182
1137
|
static VALUE
|
1183
1138
|
glu_PickMatrix(argc,argv,obj)
|
@@ -1185,37 +1140,37 @@ int argc;
|
|
1185
1140
|
VALUE* argv;
|
1186
1141
|
VALUE obj;
|
1187
1142
|
{
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1143
|
+
GLdouble x;
|
1144
|
+
GLdouble y;
|
1145
|
+
GLdouble width;
|
1146
|
+
GLdouble height;
|
1147
|
+
GLint viewport[4];
|
1148
|
+
|
1149
|
+
VALUE args[5];
|
1150
|
+
|
1151
|
+
switch (rb_scan_args(argc, argv, "23", &args[0], &args[1], &args[2], &args[3], &args[4])) {
|
1152
|
+
case 2:
|
1153
|
+
width = 5.0f;
|
1154
|
+
height = 5.0f;
|
1155
|
+
glGetIntegerv(GL_VIEWPORT, viewport);
|
1156
|
+
break;
|
1157
|
+
case 4:
|
1158
|
+
width = (GLdouble)NUM2DBL(args[2]);
|
1159
|
+
height = (GLdouble)NUM2DBL(args[3]);
|
1160
|
+
glGetIntegerv(GL_VIEWPORT, viewport);
|
1161
|
+
break;
|
1162
|
+
case 5:
|
1163
|
+
width = (GLdouble)NUM2DBL(args[2]);
|
1164
|
+
height = (GLdouble)NUM2DBL(args[3]);
|
1165
|
+
ary2cint(args[4], viewport, 4);
|
1166
|
+
break;
|
1167
|
+
default:
|
1168
|
+
rb_raise(rb_eArgError, "gluPickMatrix needs 2,4 or 5 parameters",argc);
|
1169
|
+
}
|
1170
|
+
x = (GLdouble)NUM2DBL(args[0]);
|
1171
|
+
y = (GLdouble)NUM2DBL(args[1]);
|
1172
|
+
gluPickMatrix(x, y, width, height, viewport);
|
1173
|
+
return Qnil;
|
1219
1174
|
}
|
1220
1175
|
|
1221
1176
|
static VALUE
|
@@ -1224,44 +1179,40 @@ int argc;
|
|
1224
1179
|
VALUE* argv;
|
1225
1180
|
VALUE obj;
|
1226
1181
|
{
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
return ret;
|
1262
|
-
}
|
1263
|
-
else
|
1264
|
-
return Qnil;
|
1182
|
+
GLdouble ox;
|
1183
|
+
GLdouble oy;
|
1184
|
+
GLdouble oz;
|
1185
|
+
GLdouble mdl_mtx[4*4];
|
1186
|
+
GLdouble prj_mtx[4*4];
|
1187
|
+
GLint vport[4];
|
1188
|
+
GLdouble wx;
|
1189
|
+
GLdouble wy;
|
1190
|
+
GLdouble wz;
|
1191
|
+
|
1192
|
+
VALUE args[6];
|
1193
|
+
|
1194
|
+
switch (rb_scan_args(argc, argv, "33", &args[0], &args[1], &args[2], &args[3], &args[4], &args[5])) {
|
1195
|
+
case 3:
|
1196
|
+
glGetDoublev(GL_MODELVIEW_MATRIX, mdl_mtx);
|
1197
|
+
glGetDoublev(GL_PROJECTION_MATRIX, prj_mtx);
|
1198
|
+
glGetIntegerv(GL_VIEWPORT, vport);
|
1199
|
+
break;
|
1200
|
+
case 6:
|
1201
|
+
ary2cmat4x4dbl(args[3], mdl_mtx);
|
1202
|
+
ary2cmat4x4dbl(args[4], prj_mtx);
|
1203
|
+
ary2cint(args[5], vport, 4);
|
1204
|
+
break;
|
1205
|
+
default:
|
1206
|
+
rb_raise(rb_eArgError, "gluProject needs 3 or 6 parameters");
|
1207
|
+
}
|
1208
|
+
ox = (GLdouble)NUM2DBL(args[0]);
|
1209
|
+
oy = (GLdouble)NUM2DBL(args[1]);
|
1210
|
+
oz = (GLdouble)NUM2DBL(args[2]);
|
1211
|
+
|
1212
|
+
if (gluProject(ox, oy, oz, mdl_mtx, prj_mtx, vport, &wx, &wy, &wz) == GL_TRUE)
|
1213
|
+
return rb_ary_new3(3, rb_float_new(wx), rb_float_new(wy), rb_float_new(wz));
|
1214
|
+
else
|
1215
|
+
return Qnil;
|
1265
1216
|
}
|
1266
1217
|
static VALUE
|
1267
1218
|
glu_UnProject(argc,argv,obj)
|
@@ -1269,369 +1220,216 @@ int argc;
|
|
1269
1220
|
VALUE* argv;
|
1270
1221
|
VALUE obj;
|
1271
1222
|
{
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1223
|
+
GLdouble wx;
|
1224
|
+
GLdouble wy;
|
1225
|
+
GLdouble wz;
|
1226
|
+
GLdouble mdl_mtx[4*4];
|
1227
|
+
GLdouble prj_mtx[4*4];
|
1228
|
+
GLint vport[4];
|
1229
|
+
GLdouble ox;
|
1230
|
+
GLdouble oy;
|
1231
|
+
GLdouble oz;
|
1232
|
+
|
1233
|
+
VALUE args[6];
|
1234
|
+
|
1235
|
+
switch (rb_scan_args(argc, argv, "33", &args[0], &args[1], &args[2], &args[3], &args[4], &args[5])) {
|
1236
|
+
case 3:
|
1237
|
+
glGetDoublev(GL_MODELVIEW_MATRIX, mdl_mtx);
|
1238
|
+
glGetDoublev(GL_PROJECTION_MATRIX, prj_mtx);
|
1239
|
+
glGetIntegerv(GL_VIEWPORT, vport);
|
1240
|
+
break;
|
1241
|
+
case 6:
|
1242
|
+
ary2cmat4x4dbl(args[3], mdl_mtx);
|
1243
|
+
ary2cmat4x4dbl(args[4], prj_mtx);
|
1244
|
+
ary2cint(args[5], vport, 4);
|
1245
|
+
break;
|
1246
|
+
default:
|
1247
|
+
rb_raise(rb_eArgError, "gluUnProject needs 3 or 6 parameters");
|
1248
|
+
}
|
1249
|
+
wx = (GLdouble)NUM2DBL(args[0]);
|
1250
|
+
wy = (GLdouble)NUM2DBL(args[1]);
|
1251
|
+
wz = (GLdouble)NUM2DBL(args[2]);
|
1252
|
+
|
1253
|
+
if (gluUnProject(wx, wy, wz, mdl_mtx, prj_mtx, vport, &ox, &oy, &oz) == GL_TRUE)
|
1254
|
+
return rb_ary_new3(3, rb_float_new(ox), rb_float_new(oy), rb_float_new(oz));
|
1255
|
+
else
|
1256
|
+
return Qnil;
|
1257
|
+
}
|
1258
|
+
|
1259
|
+
static VALUE
|
1260
|
+
glu_Build1DMipmaps(obj, arg1, arg2, arg3, arg4, arg5, arg6)
|
1261
|
+
VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6;
|
1262
|
+
{
|
1263
|
+
GLenum target;
|
1264
|
+
GLint components;
|
1265
|
+
GLint width;
|
1266
|
+
GLenum format;
|
1267
|
+
GLenum type;
|
1268
|
+
|
1269
|
+
target = (GLenum)NUM2INT(arg1);
|
1270
|
+
components = (GLint)NUM2INT(arg2);
|
1271
|
+
width = (GLint)NUM2INT(arg3);
|
1272
|
+
format = (GLenum)NUM2INT(arg4);
|
1273
|
+
type = (GLenum)NUM2INT(arg5);
|
1274
|
+
Check_Type(arg6,T_STRING);
|
1275
|
+
CheckDataSize(type,format,width,arg6);
|
1276
|
+
|
1277
|
+
return INT2NUM(gluBuild1DMipmaps(target, components, width, format, type, RSTRING(arg6)->ptr));
|
1310
1278
|
}
|
1311
1279
|
|
1312
1280
|
static VALUE
|
1313
1281
|
glu_Build2DMipmaps(obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
|
1314
1282
|
VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7;
|
1315
1283
|
{
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
type = (GLenum)NUM2INT(arg6);
|
1334
|
-
if (TYPE(arg7) == T_STRING) {
|
1335
|
-
type_size = gltype_size(type) / 8;
|
1336
|
-
format_size = glformat_size(format);
|
1337
|
-
if (type_size == -1 || format_size == -1)
|
1338
|
-
return Qnil;
|
1339
|
-
size = type_size*format_size*height*width;
|
1340
|
-
if (RSTRING(arg7)->len < size)
|
1341
|
-
rb_raise(rb_eArgError, "string length:%d",RSTRING(arg7)->len);
|
1342
|
-
data = RSTRING(arg7)->ptr;
|
1343
|
-
} else
|
1344
|
-
rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg7));
|
1345
|
-
return INT2NUM(gluBuild2DMipmaps(target, components, width, height, format, type, data));
|
1284
|
+
GLenum target;
|
1285
|
+
GLint components;
|
1286
|
+
GLint width;
|
1287
|
+
GLint height;
|
1288
|
+
GLenum format;
|
1289
|
+
GLenum type;
|
1290
|
+
|
1291
|
+
target = (GLenum)NUM2INT(arg1);
|
1292
|
+
components = (GLint)NUM2INT(arg2);
|
1293
|
+
width = (GLint)NUM2INT(arg3);
|
1294
|
+
height = (GLint)NUM2INT(arg4);
|
1295
|
+
format = (GLenum)NUM2INT(arg5);
|
1296
|
+
type = (GLenum)NUM2INT(arg6);
|
1297
|
+
Check_Type(arg7,T_STRING);
|
1298
|
+
CheckDataSize(type,format,width*height,arg7);
|
1299
|
+
|
1300
|
+
return INT2NUM(gluBuild2DMipmaps(target, components, width, height, format, type, RSTRING(arg7)->ptr));
|
1346
1301
|
}
|
1347
1302
|
|
1348
1303
|
static VALUE
|
1349
1304
|
glu_ScaleImage(obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
|
1350
1305
|
VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8;
|
1351
1306
|
{
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
rb_raise(rb_eArgError, "string length:%d",RSTRING(arg5)->len);
|
1377
|
-
datain = RSTRING(arg5)->ptr;
|
1378
|
-
} else
|
1379
|
-
rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg5));
|
1380
|
-
|
1381
|
-
widthout = (GLint)NUM2INT(arg6);
|
1382
|
-
heightout = (GLint)NUM2INT(arg7);
|
1383
|
-
typeout = (GLenum)NUM2INT(arg8);
|
1384
|
-
type_size = gltype_size(typeout) / 8;
|
1385
|
-
ret = allocate_buffer_with_string(widthout*heightout*format_size*type_size);
|
1386
|
-
gluScaleImage(format, widthin, heightin, typein, datain,
|
1387
|
-
widthout, heightout, typeout, (GLvoid*)RSTRING(ret)->ptr);
|
1388
|
-
return ret;
|
1307
|
+
GLenum format;
|
1308
|
+
GLint widthin;
|
1309
|
+
GLint heightin;
|
1310
|
+
GLenum typein;
|
1311
|
+
void* datain;
|
1312
|
+
GLint widthout;
|
1313
|
+
GLint heightout;
|
1314
|
+
GLenum typeout;
|
1315
|
+
VALUE ret;
|
1316
|
+
|
1317
|
+
format = (GLenum)NUM2INT(arg1);
|
1318
|
+
widthin = (GLint)NUM2INT(arg2);
|
1319
|
+
heightin = (GLint)NUM2INT(arg3);
|
1320
|
+
typein = (GLenum)NUM2INT(arg4);
|
1321
|
+
Check_Type(arg5,T_STRING);
|
1322
|
+
CheckDataSize(typein,format,heightin*widthin,arg5);
|
1323
|
+
datain = RSTRING(arg5)->ptr;
|
1324
|
+
widthout = (GLint)NUM2INT(arg6);
|
1325
|
+
heightout = (GLint)NUM2INT(arg7);
|
1326
|
+
typeout = (GLenum)NUM2INT(arg8);
|
1327
|
+
ret = allocate_buffer_with_string(GetDataSize(typeout,format,widthout*heightout));
|
1328
|
+
gluScaleImage(format, widthin, heightin, typein, datain,
|
1329
|
+
widthout, heightout, typeout, (GLvoid*)RSTRING(ret)->ptr);
|
1330
|
+
return ret;
|
1389
1331
|
}
|
1390
1332
|
|
1391
1333
|
static VALUE
|
1392
1334
|
glu_ErrorString(obj, arg1)
|
1393
1335
|
VALUE obj, arg1;
|
1394
1336
|
{
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1337
|
+
GLenum errorCode;
|
1338
|
+
GLubyte* error;
|
1339
|
+
errorCode = (GLenum)NUM2INT(arg1);
|
1340
|
+
error = (GLubyte*)gluErrorString(errorCode);
|
1341
|
+
if (error)
|
1342
|
+
return rb_str_new2((char *)error);
|
1343
|
+
else
|
1344
|
+
return Qnil;
|
1403
1345
|
}
|
1404
|
-
#if defined(GLU_VERSION_1_1)
|
1405
1346
|
static VALUE
|
1406
1347
|
glu_GetString(obj, arg1)
|
1407
1348
|
VALUE obj, arg1;
|
1408
1349
|
{
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1350
|
+
GLenum name;
|
1351
|
+
GLubyte* str;
|
1352
|
+
name = (GLenum)NUM2INT(arg1);
|
1353
|
+
str = (GLubyte*)gluGetString(name);
|
1354
|
+
if (str)
|
1355
|
+
return rb_str_new2((char *)str);
|
1356
|
+
else
|
1357
|
+
return Qnil;
|
1417
1358
|
}
|
1418
|
-
#endif
|
1419
1359
|
|
1420
1360
|
static VALUE module;
|
1421
1361
|
|
1422
|
-
#ifndef GLU_BEGIN
|
1423
|
-
#define GLU_BEGIN 100100
|
1424
|
-
#endif
|
1425
|
-
#ifndef GLU_VERTEX
|
1426
|
-
#define GLU_VERTEX 100101
|
1427
|
-
#endif
|
1428
|
-
#ifndef GLU_END
|
1429
|
-
#define GLU_END 100102
|
1430
|
-
#endif
|
1431
|
-
#ifndef GLU_EDGE_FLAG
|
1432
|
-
#define GLU_EDGE_FLAG 100104
|
1433
|
-
#endif
|
1434
|
-
#ifndef GLU_CW
|
1435
|
-
#define GLU_CW 100120
|
1436
|
-
#endif
|
1437
|
-
#ifndef GLU_CCW
|
1438
|
-
#define GLU_CCW 100121
|
1439
|
-
#endif
|
1440
|
-
#ifndef GLU_INTERIOR
|
1441
|
-
#define GLU_INTERIOR 100122
|
1442
|
-
#endif
|
1443
|
-
#ifndef GLU_EXTERIOR
|
1444
|
-
#define GLU_EXTERIOR 100123
|
1445
|
-
#endif
|
1446
|
-
#ifndef GLU_UNKNOWN
|
1447
|
-
#define GLU_UNKNOWN 100124
|
1448
|
-
#endif
|
1449
|
-
#ifndef GLU_ERROR
|
1450
|
-
#define GLU_ERROR 100103
|
1451
|
-
#endif
|
1452
|
-
|
1453
1362
|
DLLEXPORT void Init_glu()
|
1454
1363
|
{
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
rb_define_const(module, "GLU_TESS_COMBINE", INT2NUM(GLU_TESS_COMBINE));
|
1527
|
-
|
1528
|
-
rb_define_const(module, "GLU_TESS_BEGIN_DATA", INT2NUM(GLU_TESS_BEGIN_DATA));
|
1529
|
-
rb_define_const(module, "GLU_TESS_VERTEX_DATA", INT2NUM(GLU_TESS_VERTEX_DATA));
|
1530
|
-
rb_define_const(module, "GLU_TESS_END_DATA", INT2NUM(GLU_TESS_END_DATA));
|
1531
|
-
rb_define_const(module, "GLU_TESS_ERROR_DATA", INT2NUM(GLU_TESS_ERROR_DATA));
|
1532
|
-
rb_define_const(module, "GLU_TESS_EDGE_FLAG_DATA", INT2NUM(GLU_TESS_EDGE_FLAG_DATA));
|
1533
|
-
rb_define_const(module, "GLU_TESS_COMBINE_DATA", INT2NUM(GLU_TESS_COMBINE_DATA));
|
1534
|
-
|
1535
|
-
/* Winding rules */
|
1536
|
-
rb_define_const(module, "GLU_TESS_WINDING_ODD", INT2NUM(GLU_TESS_WINDING_ODD));
|
1537
|
-
rb_define_const(module, "GLU_TESS_WINDING_NONZERO", INT2NUM(GLU_TESS_WINDING_NONZERO));
|
1538
|
-
rb_define_const(module, "GLU_TESS_WINDING_POSITIVE", INT2NUM(GLU_TESS_WINDING_POSITIVE));
|
1539
|
-
rb_define_const(module, "GLU_TESS_WINDING_NEGATIVE", INT2NUM(GLU_TESS_WINDING_NEGATIVE));
|
1540
|
-
rb_define_const(module, "GLU_TESS_WINDING_ABS_GEQ_TWO", INT2NUM(GLU_TESS_WINDING_ABS_GEQ_TWO));
|
1541
|
-
|
1542
|
-
/* Tessellation properties */
|
1543
|
-
rb_define_const(module, "GLU_TESS_WINDING_RULE", INT2NUM(GLU_TESS_WINDING_RULE));
|
1544
|
-
rb_define_const(module, "GLU_TESS_BOUNDARY_ONLY", INT2NUM(GLU_TESS_BOUNDARY_ONLY));
|
1545
|
-
rb_define_const(module, "GLU_TESS_TOLERANCE", INT2NUM(GLU_TESS_TOLERANCE));
|
1546
|
-
#endif /* GLU_VERSION_1_2 */
|
1547
|
-
|
1548
|
-
rb_define_const(module, "GLU_BEGIN", INT2NUM(GLU_BEGIN));
|
1549
|
-
rb_define_const(module, "GLU_VERTEX", INT2NUM(GLU_VERTEX));
|
1550
|
-
rb_define_const(module, "GLU_END", INT2NUM(GLU_END));
|
1551
|
-
rb_define_const(module, "GLU_ERROR", INT2NUM(GLU_ERROR));
|
1552
|
-
rb_define_const(module, "GLU_EDGE_FLAG", INT2NUM(GLU_EDGE_FLAG));
|
1553
|
-
rb_define_const(module, "GLU_CW", INT2NUM(GLU_CW));
|
1554
|
-
rb_define_const(module, "GLU_CCW", INT2NUM(GLU_CCW));
|
1555
|
-
rb_define_const(module, "GLU_INTERIOR", INT2NUM(GLU_INTERIOR));
|
1556
|
-
rb_define_const(module, "GLU_EXTERIOR", INT2NUM(GLU_EXTERIOR));
|
1557
|
-
rb_define_const(module, "GLU_UNKNOWN", INT2NUM(GLU_UNKNOWN));
|
1558
|
-
rb_define_const(module, "GLU_TESS_ERROR1", INT2NUM(GLU_TESS_ERROR1));
|
1559
|
-
rb_define_const(module, "GLU_TESS_ERROR2", INT2NUM(GLU_TESS_ERROR2));
|
1560
|
-
rb_define_const(module, "GLU_TESS_ERROR3", INT2NUM(GLU_TESS_ERROR3));
|
1561
|
-
rb_define_const(module, "GLU_TESS_ERROR4", INT2NUM(GLU_TESS_ERROR4));
|
1562
|
-
rb_define_const(module, "GLU_TESS_ERROR5", INT2NUM(GLU_TESS_ERROR5));
|
1563
|
-
rb_define_const(module, "GLU_TESS_ERROR6", INT2NUM(GLU_TESS_ERROR6));
|
1564
|
-
rb_define_const(module, "GLU_TESS_ERROR7", INT2NUM(GLU_TESS_ERROR7));
|
1565
|
-
rb_define_const(module, "GLU_TESS_ERROR8", INT2NUM(GLU_TESS_ERROR8));
|
1566
|
-
#if defined(TESS_ERROR9)
|
1567
|
-
rb_define_const(module, "GLU_TESS_ERROR9", INT2NUM(GLU_TESS_ERROR9));
|
1568
|
-
#endif
|
1569
|
-
#if defined(GLU_VERSION_1_3)
|
1570
|
-
rb_define_const(module, "GLU_AUTO_LOAD_MATRIX", INT2NUM(GLU_AUTO_LOAD_MATRIX));
|
1571
|
-
rb_define_const(module, "GLU_CULLING", INT2NUM(GLU_CULLING));
|
1572
|
-
rb_define_const(module, "GLU_SAMPLING_TOLERANCE", INT2NUM(GLU_SAMPLING_TOLERANCE));
|
1573
|
-
rb_define_const(module, "GLU_DISPLAY_MODE", INT2NUM(GLU_DISPLAY_MODE));
|
1574
|
-
rb_define_const(module, "GLU_SAMPLING_METHOD", INT2NUM(GLU_SAMPLING_METHOD));
|
1575
|
-
rb_define_const(module, "GLU_U_STEP", INT2NUM(GLU_U_STEP));
|
1576
|
-
rb_define_const(module, "GLU_V_STEP", INT2NUM(GLU_V_STEP));
|
1577
|
-
#endif
|
1578
|
-
rb_define_const(module, "GLU_PATH_LENGTH", INT2NUM(GLU_PATH_LENGTH));
|
1579
|
-
rb_define_const(module, "GLU_PARAMETRIC_ERROR", INT2NUM(GLU_PARAMETRIC_ERROR));
|
1580
|
-
rb_define_const(module, "GLU_DOMAIN_DISTANCE", INT2NUM(GLU_DOMAIN_DISTANCE));
|
1581
|
-
rb_define_const(module, "GLU_MAP1_TRIM_2", INT2NUM(GLU_MAP1_TRIM_2));
|
1582
|
-
rb_define_const(module, "GLU_MAP1_TRIM_3", INT2NUM(GLU_MAP1_TRIM_3));
|
1583
|
-
rb_define_const(module, "GLU_OUTLINE_POLYGON", INT2NUM(GLU_OUTLINE_POLYGON));
|
1584
|
-
rb_define_const(module, "GLU_OUTLINE_PATCH", INT2NUM(GLU_OUTLINE_PATCH));
|
1585
|
-
rb_define_const(module, "GLU_NURBS_ERROR1", INT2NUM(GLU_NURBS_ERROR1));
|
1586
|
-
rb_define_const(module, "GLU_NURBS_ERROR2", INT2NUM(GLU_NURBS_ERROR2));
|
1587
|
-
rb_define_const(module, "GLU_NURBS_ERROR3", INT2NUM(GLU_NURBS_ERROR3));
|
1588
|
-
rb_define_const(module, "GLU_NURBS_ERROR4", INT2NUM(GLU_NURBS_ERROR4));
|
1589
|
-
rb_define_const(module, "GLU_NURBS_ERROR5", INT2NUM(GLU_NURBS_ERROR5));
|
1590
|
-
rb_define_const(module, "GLU_NURBS_ERROR6", INT2NUM(GLU_NURBS_ERROR6));
|
1591
|
-
rb_define_const(module, "GLU_NURBS_ERROR7", INT2NUM(GLU_NURBS_ERROR7));
|
1592
|
-
rb_define_const(module, "GLU_NURBS_ERROR8", INT2NUM(GLU_NURBS_ERROR8));
|
1593
|
-
rb_define_const(module, "GLU_NURBS_ERROR9", INT2NUM(GLU_NURBS_ERROR9));
|
1594
|
-
rb_define_const(module, "GLU_NURBS_ERROR10", INT2NUM(GLU_NURBS_ERROR10));
|
1595
|
-
rb_define_const(module, "GLU_NURBS_ERROR11", INT2NUM(GLU_NURBS_ERROR11));
|
1596
|
-
rb_define_const(module, "GLU_NURBS_ERROR12", INT2NUM(GLU_NURBS_ERROR12));
|
1597
|
-
rb_define_const(module, "GLU_NURBS_ERROR13", INT2NUM(GLU_NURBS_ERROR13));
|
1598
|
-
rb_define_const(module, "GLU_NURBS_ERROR14", INT2NUM(GLU_NURBS_ERROR14));
|
1599
|
-
rb_define_const(module, "GLU_NURBS_ERROR15", INT2NUM(GLU_NURBS_ERROR15));
|
1600
|
-
rb_define_const(module, "GLU_NURBS_ERROR16", INT2NUM(GLU_NURBS_ERROR16));
|
1601
|
-
rb_define_const(module, "GLU_NURBS_ERROR17", INT2NUM(GLU_NURBS_ERROR17));
|
1602
|
-
rb_define_const(module, "GLU_NURBS_ERROR18", INT2NUM(GLU_NURBS_ERROR18));
|
1603
|
-
rb_define_const(module, "GLU_NURBS_ERROR19", INT2NUM(GLU_NURBS_ERROR19));
|
1604
|
-
rb_define_const(module, "GLU_NURBS_ERROR20", INT2NUM(GLU_NURBS_ERROR20));
|
1605
|
-
rb_define_const(module, "GLU_NURBS_ERROR21", INT2NUM(GLU_NURBS_ERROR21));
|
1606
|
-
rb_define_const(module, "GLU_NURBS_ERROR22", INT2NUM(GLU_NURBS_ERROR22));
|
1607
|
-
rb_define_const(module, "GLU_NURBS_ERROR23", INT2NUM(GLU_NURBS_ERROR23));
|
1608
|
-
rb_define_const(module, "GLU_NURBS_ERROR24", INT2NUM(GLU_NURBS_ERROR24));
|
1609
|
-
rb_define_const(module, "GLU_NURBS_ERROR25", INT2NUM(GLU_NURBS_ERROR25));
|
1610
|
-
rb_define_const(module, "GLU_NURBS_ERROR26", INT2NUM(GLU_NURBS_ERROR26));
|
1611
|
-
rb_define_const(module, "GLU_NURBS_ERROR27", INT2NUM(GLU_NURBS_ERROR27));
|
1612
|
-
rb_define_const(module, "GLU_NURBS_ERROR28", INT2NUM(GLU_NURBS_ERROR28));
|
1613
|
-
rb_define_const(module, "GLU_NURBS_ERROR29", INT2NUM(GLU_NURBS_ERROR29));
|
1614
|
-
rb_define_const(module, "GLU_NURBS_ERROR30", INT2NUM(GLU_NURBS_ERROR30));
|
1615
|
-
rb_define_const(module, "GLU_NURBS_ERROR31", INT2NUM(GLU_NURBS_ERROR31));
|
1616
|
-
rb_define_const(module, "GLU_NURBS_ERROR32", INT2NUM(GLU_NURBS_ERROR32));
|
1617
|
-
rb_define_const(module, "GLU_NURBS_ERROR33", INT2NUM(GLU_NURBS_ERROR33));
|
1618
|
-
rb_define_const(module, "GLU_NURBS_ERROR34", INT2NUM(GLU_NURBS_ERROR34));
|
1619
|
-
rb_define_const(module, "GLU_NURBS_ERROR35", INT2NUM(GLU_NURBS_ERROR35));
|
1620
|
-
rb_define_const(module, "GLU_NURBS_ERROR36", INT2NUM(GLU_NURBS_ERROR36));
|
1621
|
-
rb_define_const(module, "GLU_NURBS_ERROR37", INT2NUM(GLU_NURBS_ERROR37));
|
1622
|
-
rb_define_const(module, "GLU_INVALID_ENUM", INT2NUM(GLU_INVALID_ENUM));
|
1623
|
-
rb_define_const(module, "GLU_INVALID_VALUE", INT2NUM(GLU_INVALID_VALUE));
|
1624
|
-
rb_define_const(module, "GLU_OUT_OF_MEMORY", INT2NUM(GLU_OUT_OF_MEMORY));
|
1625
|
-
#ifdef GLU_INCOMPATIBLE_GL_VERSION
|
1626
|
-
rb_define_const(module, "GLU_INCOMPATIBLE_GL_VERSION", INT2NUM(GLU_INCOMPATIBLE_GL_VERSION));
|
1627
|
-
#endif
|
1628
|
-
rb_define_const(module, "GLU_VERSION", INT2NUM(GLU_VERSION));
|
1629
|
-
rb_define_const(module, "GLU_EXTENSIONS", INT2NUM(GLU_EXTENSIONS));
|
1630
|
-
|
1631
|
-
cNurbs = rb_define_class("Nurbs", rb_cObject);
|
1632
|
-
cTess = rb_define_class("Tess", rb_cObject);
|
1633
|
-
cQuad = rb_define_class("Quadric", rb_cObject);
|
1634
|
-
|
1635
|
-
rb_global_variable(&t_current);
|
1636
|
-
t_current = rb_ary_new();
|
1364
|
+
callId = rb_intern("call");
|
1365
|
+
refId = rb_intern("[]");
|
1366
|
+
module = rb_define_module("Glu");
|
1367
|
+
|
1368
|
+
glu_init_enums(module);
|
1369
|
+
|
1370
|
+
rb_define_module_function(module, "gluNewNurbsRenderer", glu_NewNurbsRenderer, 0);
|
1371
|
+
rb_define_module_function(module, "gluDeleteNurbsRenderer", glu_DeleteNurbsRenderer, 1);
|
1372
|
+
rb_define_module_function(module, "gluNurbsProperty", glu_NurbsProperty, 3);
|
1373
|
+
rb_define_module_function(module, "gluGetNurbsProperty", glu_GetNurbsProperty, 2);
|
1374
|
+
rb_define_module_function(module, "gluBeginCurve", glu_BeginCurve, 1);
|
1375
|
+
rb_define_module_function(module, "gluEndCurve", glu_EndCurve, 1);
|
1376
|
+
rb_define_module_function(module, "gluNurbsCurve", glu_NurbsCurve, -1);
|
1377
|
+
rb_define_module_function(module, "gluBeginSurface", glu_BeginSurface, 1);
|
1378
|
+
rb_define_module_function(module, "gluEndSurface", glu_EndSurface, 1);
|
1379
|
+
rb_define_module_function(module, "gluNurbsSurface", glu_NurbsSurface, -1);
|
1380
|
+
rb_define_module_function(module, "gluBeginTrim", glu_BeginTrim, 1);
|
1381
|
+
rb_define_module_function(module, "gluEndTrim", glu_EndTrim, 1);
|
1382
|
+
rb_define_module_function(module, "gluPwlCurve", glu_PwlCurve, -1);
|
1383
|
+
rb_define_module_function(module, "gluNewTess", glu_NewTess, 0);
|
1384
|
+
rb_define_module_function(module, "gluDeleteTess", glu_DeleteTess, 1);
|
1385
|
+
rb_define_module_function(module, "gluTessCallback", glu_TessCallback, 3);
|
1386
|
+
rb_define_module_function(module, "gluBeginPolygon", glu_BeginPolygon, 1);
|
1387
|
+
rb_define_module_function(module, "gluTessVertex", glu_TessVertex, 3);
|
1388
|
+
rb_define_module_function(module, "gluNextContour", glu_NextContour, 2);
|
1389
|
+
rb_define_module_function(module, "gluEndPolygon", glu_EndPolygon, 1);
|
1390
|
+
rb_define_module_function(module, "gluTessBeginPolygon", glu_TessBeginPolygon, 2);
|
1391
|
+
rb_define_module_function(module, "gluTessBeginContour", glu_TessBeginContour, 1);
|
1392
|
+
rb_define_module_function(module, "gluTessEndContour", glu_TessEndContour, 1);
|
1393
|
+
rb_define_module_function(module, "gluTessEndPolygon", glu_TessEndPolygon, 1);
|
1394
|
+
rb_define_module_function(module, "gluTessProperty", glu_TessProperty, 3);
|
1395
|
+
rb_define_module_function(module, "gluTessNormal", glu_TessNormal, 4);
|
1396
|
+
rb_define_module_function(module, "gluGetTessProperty", glu_GetTessProperty, 2);
|
1397
|
+
rb_define_module_function(module, "gluNewQuadric", glu_NewQuadric, 0);
|
1398
|
+
rb_define_module_function(module, "gluDeleteQuadric", glu_DeleteQuadric, 1);
|
1399
|
+
rb_define_module_function(module, "gluQuadricNormals", glu_QuadricNormals, 2);
|
1400
|
+
rb_define_module_function(module, "gluQuadricTexture", glu_QuadricTexture, 2);
|
1401
|
+
rb_define_module_function(module, "gluQuadricOrientation", glu_QuadricOrientation, 2);
|
1402
|
+
rb_define_module_function(module, "gluQuadricDrawStyle", glu_QuadricDrawStyle, 2);
|
1403
|
+
rb_define_module_function(module, "gluCylinder", glu_Cylinder, 6);
|
1404
|
+
rb_define_module_function(module, "gluDisk", glu_Disk, 5);
|
1405
|
+
rb_define_module_function(module, "gluPartialDisk", glu_PartialDisk, 7);
|
1406
|
+
rb_define_module_function(module, "gluSphere", glu_Sphere, 4);
|
1407
|
+
|
1408
|
+
rb_define_module_function(module, "gluLookAt", glu_LookAt, 9);
|
1409
|
+
rb_define_module_function(module, "gluOrtho2D", glu_Ortho2D, 4);
|
1410
|
+
rb_define_module_function(module, "gluPerspective", glu_Perspective, 4);
|
1411
|
+
rb_define_module_function(module, "gluPickMatrix", glu_PickMatrix, -1);
|
1412
|
+
rb_define_module_function(module, "gluProject", glu_Project, -1);
|
1413
|
+
rb_define_module_function(module, "gluUnProject", glu_UnProject, -1);
|
1414
|
+
rb_define_module_function(module, "gluBuild1DMipmaps", glu_Build1DMipmaps, 6);
|
1415
|
+
rb_define_module_function(module, "gluBuild2DMipmaps", glu_Build2DMipmaps, 7);
|
1416
|
+
rb_define_module_function(module, "gluScaleImage", glu_ScaleImage, 8);
|
1417
|
+
rb_define_module_function(module, "gluErrorString", glu_ErrorString, 1);
|
1418
|
+
rb_define_module_function(module, "gluGetString", glu_GetString, 1);
|
1419
|
+
|
1420
|
+
rb_define_module_function(module, "gluLoadSamplingMatrices",glu_LoadSamplingMatrices,4);
|
1421
|
+
rb_define_module_function(module, "gluQuadricCallback", glu_QuadricCallback, 3);
|
1422
|
+
rb_define_module_function(module, "gluNurbsCallback", glu_NurbsCallback, 3);
|
1423
|
+
|
1424
|
+
|
1425
|
+
cNurbs = rb_define_class("Nurbs", rb_cObject);
|
1426
|
+
cTess = rb_define_class("Tess", rb_cObject);
|
1427
|
+
cQuad = rb_define_class("Quadric", rb_cObject);
|
1428
|
+
|
1429
|
+
rb_global_variable(&t_current); /* current active tesselator, nurbs and quadric, used for callbacks */
|
1430
|
+
t_current = rb_ary_new();
|
1431
|
+
rb_global_variable(&n_current);
|
1432
|
+
n_current = rb_ary_new();
|
1433
|
+
rb_global_variable(&q_current);
|
1434
|
+
q_current = rb_ary_new();
|
1637
1435
|
}
|