picrate 0.0.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +47 -0
- data/.mvn/extensions.xml +9 -0
- data/.mvn/wrapper/maven-wrapper.properties +1 -0
- data/.travis.yml +10 -0
- data/CHANGELOG.md +4 -0
- data/LICENSE.md +165 -0
- data/README.md +51 -0
- data/Rakefile +59 -0
- data/bin/picrate +8 -0
- data/docs/.gitignore +6 -0
- data/docs/_config.yml +30 -0
- data/docs/_includes/footer.html +38 -0
- data/docs/_includes/head.html +16 -0
- data/docs/_includes/header.html +27 -0
- data/docs/_includes/icon-github.html +1 -0
- data/docs/_includes/icon-github.svg +1 -0
- data/docs/_includes/icon-twitter.html +1 -0
- data/docs/_includes/icon-twitter.svg +1 -0
- data/docs/_includes/navigation.html +24 -0
- data/docs/_layouts/default.html +20 -0
- data/docs/_layouts/page.html +14 -0
- data/docs/_layouts/post.html +15 -0
- data/docs/_posts/2018-05-06-getting_started.md +8 -0
- data/docs/_posts/2018-05-06-install_jruby.md +35 -0
- data/docs/_sass/_base.scss +206 -0
- data/docs/_sass/_layout.scss +242 -0
- data/docs/_sass/_syntax-highlighting.scss +71 -0
- data/docs/about.md +10 -0
- data/docs/css/main.scss +38 -0
- data/docs/favicon.ico +0 -0
- data/docs/feed.xml +30 -0
- data/docs/index.html +38 -0
- data/lib/picrate.rb +10 -0
- data/lib/picrate/app.rb +187 -0
- data/lib/picrate/creators/sketch_class.rb +57 -0
- data/lib/picrate/creators/sketch_factory.rb +12 -0
- data/lib/picrate/creators/sketch_writer.rb +21 -0
- data/lib/picrate/helper_methods.rb +214 -0
- data/lib/picrate/helpers/numeric.rb +9 -0
- data/lib/picrate/library.rb +69 -0
- data/lib/picrate/library_loader.rb +53 -0
- data/lib/picrate/native_folder.rb +35 -0
- data/lib/picrate/native_loader.rb +27 -0
- data/lib/picrate/runner.rb +81 -0
- data/lib/picrate/version.rb +4 -0
- data/library/boids/boids.rb +209 -0
- data/library/chooser/chooser.rb +19 -0
- data/library/control_panel/control_panel.rb +182 -0
- data/library/library_proxy/README.md +99 -0
- data/library/library_proxy/library_proxy.rb +14 -0
- data/library/slider/slider.rb +42 -0
- data/library/vector_utils/vector_utils.rb +69 -0
- data/library/video_event/video_event.rb +3 -0
- data/license.txt +508 -0
- data/picrate.gemspec +35 -0
- data/pom.rb +122 -0
- data/pom.xml +214 -0
- data/src/main/java/japplemenubar/JAppleMenuBar.java +88 -0
- data/src/main/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
- data/src/main/java/monkstone/ColorUtil.java +115 -0
- data/src/main/java/monkstone/MathToolModule.java +236 -0
- data/src/main/java/monkstone/PicrateLibrary.java +47 -0
- data/src/main/java/monkstone/core/LibraryProxy.java +127 -0
- data/src/main/java/monkstone/fastmath/Deglut.java +122 -0
- data/src/main/java/monkstone/fastmath/package-info.java +6 -0
- data/src/main/java/monkstone/filechooser/Chooser.java +48 -0
- data/src/main/java/monkstone/noise/SimplexNoise.java +465 -0
- data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +168 -0
- data/src/main/java/monkstone/slider/CustomVerticalSlider.java +182 -0
- data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +149 -0
- data/src/main/java/monkstone/slider/SimpleSlider.java +196 -0
- data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +163 -0
- data/src/main/java/monkstone/slider/Slider.java +67 -0
- data/src/main/java/monkstone/slider/SliderBar.java +277 -0
- data/src/main/java/monkstone/slider/SliderGroup.java +78 -0
- data/src/main/java/monkstone/slider/WheelHandler.java +35 -0
- data/src/main/java/monkstone/vecmath/AppRender.java +87 -0
- data/src/main/java/monkstone/vecmath/JRender.java +56 -0
- data/src/main/java/monkstone/vecmath/ShapeRender.java +87 -0
- data/src/main/java/monkstone/vecmath/package-info.java +20 -0
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +757 -0
- data/src/main/java/monkstone/vecmath/vec2/package-info.java +6 -0
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +727 -0
- data/src/main/java/monkstone/vecmath/vec3/package-info.java +6 -0
- data/src/main/java/monkstone/videoevent/VideoInterface.java +42 -0
- data/src/main/java/monkstone/videoevent/package-info.java +20 -0
- data/src/main/java/processing/awt/PGraphicsJava2D.java +3098 -0
- data/src/main/java/processing/awt/PShapeJava2D.java +401 -0
- data/src/main/java/processing/awt/PSurfaceAWT.java +1660 -0
- data/src/main/java/processing/core/PApplet.java +17647 -0
- data/src/main/java/processing/core/PConstants.java +1033 -0
- data/src/main/java/processing/core/PFont.java +1250 -0
- data/src/main/java/processing/core/PGraphics.java +9614 -0
- data/src/main/java/processing/core/PImage.java +3608 -0
- data/src/main/java/processing/core/PMatrix.java +347 -0
- data/src/main/java/processing/core/PMatrix2D.java +694 -0
- data/src/main/java/processing/core/PMatrix3D.java +1153 -0
- data/src/main/java/processing/core/PShape.java +4332 -0
- data/src/main/java/processing/core/PShapeOBJ.java +544 -0
- data/src/main/java/processing/core/PShapeSVG.java +1987 -0
- data/src/main/java/processing/core/PStyle.java +208 -0
- data/src/main/java/processing/core/PSurface.java +242 -0
- data/src/main/java/processing/core/PSurfaceNone.java +479 -0
- data/src/main/java/processing/core/PVector.java +1140 -0
- data/src/main/java/processing/data/FloatDict.java +829 -0
- data/src/main/java/processing/data/FloatList.java +912 -0
- data/src/main/java/processing/data/IntDict.java +796 -0
- data/src/main/java/processing/data/IntList.java +913 -0
- data/src/main/java/processing/data/JSONArray.java +1260 -0
- data/src/main/java/processing/data/JSONObject.java +2282 -0
- data/src/main/java/processing/data/JSONTokener.java +435 -0
- data/src/main/java/processing/data/Sort.java +46 -0
- data/src/main/java/processing/data/StringDict.java +601 -0
- data/src/main/java/processing/data/StringList.java +775 -0
- data/src/main/java/processing/data/Table.java +4923 -0
- data/src/main/java/processing/data/TableRow.java +198 -0
- data/src/main/java/processing/data/XML.java +1149 -0
- data/src/main/java/processing/event/Event.java +108 -0
- data/src/main/java/processing/event/KeyEvent.java +70 -0
- data/src/main/java/processing/event/MouseEvent.java +149 -0
- data/src/main/java/processing/event/TouchEvent.java +57 -0
- data/src/main/java/processing/javafx/PGraphicsFX2D.java +354 -0
- data/src/main/java/processing/opengl/FontTexture.java +379 -0
- data/src/main/java/processing/opengl/FrameBuffer.java +503 -0
- data/src/main/java/processing/opengl/LinePath.java +623 -0
- data/src/main/java/processing/opengl/LineStroker.java +685 -0
- data/src/main/java/processing/opengl/PGL.java +3366 -0
- data/src/main/java/processing/opengl/PGraphics2D.java +615 -0
- data/src/main/java/processing/opengl/PGraphics3D.java +281 -0
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +13634 -0
- data/src/main/java/processing/opengl/PJOGL.java +1966 -0
- data/src/main/java/processing/opengl/PShader.java +1478 -0
- data/src/main/java/processing/opengl/PShapeOpenGL.java +5234 -0
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +1315 -0
- data/src/main/java/processing/opengl/Texture.java +1670 -0
- data/src/main/java/processing/opengl/VertexBuffer.java +88 -0
- data/src/main/java/processing/opengl/cursors/arrow.png +0 -0
- data/src/main/java/processing/opengl/cursors/cross.png +0 -0
- data/src/main/java/processing/opengl/cursors/hand.png +0 -0
- data/src/main/java/processing/opengl/cursors/license.txt +27 -0
- data/src/main/java/processing/opengl/cursors/move.png +0 -0
- data/src/main/java/processing/opengl/cursors/text.png +0 -0
- data/src/main/java/processing/opengl/cursors/wait.png +0 -0
- data/src/main/java/processing/opengl/shaders/ColorFrag.glsl +32 -0
- data/src/main/java/processing/opengl/shaders/ColorVert.glsl +34 -0
- data/src/main/java/processing/opengl/shaders/LightFrag.glsl +33 -0
- data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +154 -0
- data/src/main/java/processing/opengl/shaders/LightVert.glsl +151 -0
- data/src/main/java/processing/opengl/shaders/LineFrag.glsl +32 -0
- data/src/main/java/processing/opengl/shaders/LineVert.glsl +100 -0
- data/src/main/java/processing/opengl/shaders/MaskFrag.glsl +40 -0
- data/src/main/java/processing/opengl/shaders/PointFrag.glsl +32 -0
- data/src/main/java/processing/opengl/shaders/PointVert.glsl +56 -0
- data/src/main/java/processing/opengl/shaders/TexFrag.glsl +37 -0
- data/src/main/java/processing/opengl/shaders/TexLightFrag.glsl +37 -0
- data/src/main/java/processing/opengl/shaders/TexLightVert-vc4.glsl +160 -0
- data/src/main/java/processing/opengl/shaders/TexLightVert.glsl +157 -0
- data/src/main/java/processing/opengl/shaders/TexVert.glsl +38 -0
- data/src/main/resources/icon/icon-1024.png +0 -0
- data/src/main/resources/icon/icon-128.png +0 -0
- data/src/main/resources/icon/icon-16.png +0 -0
- data/src/main/resources/icon/icon-256.png +0 -0
- data/src/main/resources/icon/icon-32.png +0 -0
- data/src/main/resources/icon/icon-48.png +0 -0
- data/src/main/resources/icon/icon-512.png +0 -0
- data/src/main/resources/icon/icon-64.png +0 -0
- data/src/main/resources/license.txt +508 -0
- data/test/create_test.rb +68 -0
- data/test/deglut_spec_test.rb +24 -0
- data/test/helper_methods_test.rb +58 -0
- data/test/math_tool_test.rb +75 -0
- data/test/respond_to_test.rb +215 -0
- data/test/sketches/key_event.rb +37 -0
- data/test/sketches/library/my_library/my_library.rb +32 -0
- data/test/test_helper.rb +3 -0
- data/test/vecmath_spec_test.rb +522 -0
- data/vendors/Rakefile +127 -0
- metadata +289 -0
@@ -0,0 +1,615 @@
|
|
1
|
+
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
2
|
+
|
3
|
+
/*
|
4
|
+
Part of the Processing project - http://processing.org
|
5
|
+
|
6
|
+
Copyright (c) 2012-15 The Processing Foundation
|
7
|
+
Copyright (c) 2004-12 Ben Fry and Casey Reas
|
8
|
+
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
9
|
+
|
10
|
+
This library is free software; you can redistribute it and/or
|
11
|
+
modify it under the terms of the GNU Lesser General Public
|
12
|
+
License as published by the Free Software Foundation, version 2.1.
|
13
|
+
|
14
|
+
This library is distributed in the hope that it will be useful,
|
15
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
+
Lesser General Public License for more details.
|
18
|
+
|
19
|
+
You should have received a copy of the GNU Lesser General
|
20
|
+
Public License along with this library; if not, write to the
|
21
|
+
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
22
|
+
Boston, MA 02111-1307 USA
|
23
|
+
*/
|
24
|
+
|
25
|
+
package processing.opengl;
|
26
|
+
|
27
|
+
import processing.core.PGraphics;
|
28
|
+
import processing.core.PMatrix3D;
|
29
|
+
import processing.core.PShape;
|
30
|
+
import processing.core.PShapeSVG;
|
31
|
+
|
32
|
+
|
33
|
+
public class PGraphics2D extends PGraphicsOpenGL {
|
34
|
+
|
35
|
+
public PGraphics2D() {
|
36
|
+
super();
|
37
|
+
}
|
38
|
+
|
39
|
+
|
40
|
+
//////////////////////////////////////////////////////////////
|
41
|
+
|
42
|
+
// RENDERER SUPPORT QUERIES
|
43
|
+
|
44
|
+
|
45
|
+
@Override
|
46
|
+
public boolean is2D() {
|
47
|
+
return true;
|
48
|
+
}
|
49
|
+
|
50
|
+
|
51
|
+
@Override
|
52
|
+
public boolean is3D() {
|
53
|
+
return false;
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
//////////////////////////////////////////////////////////////
|
58
|
+
|
59
|
+
// HINTS
|
60
|
+
|
61
|
+
|
62
|
+
@Override
|
63
|
+
public void hint(int which) {
|
64
|
+
if (which == ENABLE_STROKE_PERSPECTIVE) {
|
65
|
+
showWarning("Strokes cannot be perspective-corrected in 2D.");
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
super.hint(which);
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
//////////////////////////////////////////////////////////////
|
73
|
+
|
74
|
+
// PROJECTION
|
75
|
+
|
76
|
+
|
77
|
+
@Override
|
78
|
+
public void ortho() {
|
79
|
+
showMethodWarning("ortho");
|
80
|
+
}
|
81
|
+
|
82
|
+
|
83
|
+
@Override
|
84
|
+
public void ortho(float left, float right,
|
85
|
+
float bottom, float top) {
|
86
|
+
showMethodWarning("ortho");
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
@Override
|
91
|
+
public void ortho(float left, float right,
|
92
|
+
float bottom, float top,
|
93
|
+
float near, float far) {
|
94
|
+
showMethodWarning("ortho");
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
@Override
|
99
|
+
public void perspective() {
|
100
|
+
showMethodWarning("perspective");
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
@Override
|
105
|
+
public void perspective(float fov, float aspect, float zNear, float zFar) {
|
106
|
+
showMethodWarning("perspective");
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
@Override
|
111
|
+
public void frustum(float left, float right, float bottom, float top,
|
112
|
+
float znear, float zfar) {
|
113
|
+
showMethodWarning("frustum");
|
114
|
+
}
|
115
|
+
|
116
|
+
|
117
|
+
@Override
|
118
|
+
protected void defaultPerspective() {
|
119
|
+
super.ortho(0, width, -height, 0, -1, +1);
|
120
|
+
}
|
121
|
+
|
122
|
+
|
123
|
+
//////////////////////////////////////////////////////////////
|
124
|
+
|
125
|
+
// CAMERA
|
126
|
+
|
127
|
+
|
128
|
+
@Override
|
129
|
+
public void beginCamera() {
|
130
|
+
showMethodWarning("beginCamera");
|
131
|
+
}
|
132
|
+
|
133
|
+
|
134
|
+
@Override
|
135
|
+
public void endCamera() {
|
136
|
+
showMethodWarning("endCamera");
|
137
|
+
}
|
138
|
+
|
139
|
+
|
140
|
+
@Override
|
141
|
+
public void camera() {
|
142
|
+
showMethodWarning("camera");
|
143
|
+
}
|
144
|
+
|
145
|
+
|
146
|
+
@Override
|
147
|
+
public void camera(float eyeX, float eyeY, float eyeZ,
|
148
|
+
float centerX, float centerY, float centerZ,
|
149
|
+
float upX, float upY, float upZ) {
|
150
|
+
showMethodWarning("camera");
|
151
|
+
}
|
152
|
+
|
153
|
+
|
154
|
+
@Override
|
155
|
+
protected void defaultCamera() {
|
156
|
+
eyeDist = 1;
|
157
|
+
resetMatrix();
|
158
|
+
}
|
159
|
+
|
160
|
+
|
161
|
+
//////////////////////////////////////////////////////////////
|
162
|
+
|
163
|
+
// MATRIX MORE!
|
164
|
+
|
165
|
+
|
166
|
+
@Override
|
167
|
+
protected void begin2D() {
|
168
|
+
pushProjection();
|
169
|
+
defaultPerspective();
|
170
|
+
pushMatrix();
|
171
|
+
defaultCamera();
|
172
|
+
}
|
173
|
+
|
174
|
+
|
175
|
+
@Override
|
176
|
+
protected void end2D() {
|
177
|
+
popMatrix();
|
178
|
+
popProjection();
|
179
|
+
}
|
180
|
+
|
181
|
+
|
182
|
+
//////////////////////////////////////////////////////////////
|
183
|
+
|
184
|
+
// SHAPE
|
185
|
+
|
186
|
+
|
187
|
+
@Override
|
188
|
+
public void shape(PShape shape) {
|
189
|
+
if (shape.is2D()) {
|
190
|
+
super.shape(shape);
|
191
|
+
} else {
|
192
|
+
showWarning("The shape object is not 2D, cannot be displayed with " +
|
193
|
+
"this renderer");
|
194
|
+
}
|
195
|
+
}
|
196
|
+
|
197
|
+
|
198
|
+
@Override
|
199
|
+
public void shape(PShape shape, float x, float y) {
|
200
|
+
if (shape.is2D()) {
|
201
|
+
super.shape(shape, x, y);
|
202
|
+
} else {
|
203
|
+
showWarning("The shape object is not 2D, cannot be displayed with " +
|
204
|
+
"this renderer");
|
205
|
+
}
|
206
|
+
}
|
207
|
+
|
208
|
+
|
209
|
+
@Override
|
210
|
+
public void shape(PShape shape, float a, float b, float c, float d) {
|
211
|
+
if (shape.is2D()) {
|
212
|
+
super.shape(shape, a, b, c, d);
|
213
|
+
} else {
|
214
|
+
showWarning("The shape object is not 2D, cannot be displayed with " +
|
215
|
+
"this renderer");
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
|
220
|
+
@Override
|
221
|
+
public void shape(PShape shape, float x, float y, float z) {
|
222
|
+
showDepthWarningXYZ("shape");
|
223
|
+
}
|
224
|
+
|
225
|
+
|
226
|
+
@Override
|
227
|
+
public void shape(PShape shape, float x, float y, float z,
|
228
|
+
float c, float d, float e) {
|
229
|
+
showDepthWarningXYZ("shape");
|
230
|
+
}
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
//////////////////////////////////////////////////////////////
|
235
|
+
|
236
|
+
// SHAPE I/O
|
237
|
+
|
238
|
+
|
239
|
+
static protected boolean isSupportedExtension(String extension) {
|
240
|
+
return extension.equals("svg") || extension.equals("svgz");
|
241
|
+
}
|
242
|
+
|
243
|
+
|
244
|
+
static protected PShape loadShapeImpl(PGraphics pg,
|
245
|
+
String filename, String extension) {
|
246
|
+
if (extension.equals("svg") || extension.equals("svgz")) {
|
247
|
+
PShapeSVG svg = new PShapeSVG(pg.parent.loadXML(filename));
|
248
|
+
return PShapeOpenGL.createShape((PGraphicsOpenGL) pg, svg);
|
249
|
+
}
|
250
|
+
return null;
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
//////////////////////////////////////////////////////////////
|
255
|
+
|
256
|
+
// SCREEN TRANSFORMS
|
257
|
+
|
258
|
+
|
259
|
+
@Override
|
260
|
+
public float modelX(float x, float y, float z) {
|
261
|
+
showDepthWarning("modelX");
|
262
|
+
return 0;
|
263
|
+
}
|
264
|
+
|
265
|
+
|
266
|
+
@Override
|
267
|
+
public float modelY(float x, float y, float z) {
|
268
|
+
showDepthWarning("modelY");
|
269
|
+
return 0;
|
270
|
+
}
|
271
|
+
|
272
|
+
|
273
|
+
@Override
|
274
|
+
public float modelZ(float x, float y, float z) {
|
275
|
+
showDepthWarning("modelZ");
|
276
|
+
return 0;
|
277
|
+
}
|
278
|
+
|
279
|
+
|
280
|
+
//////////////////////////////////////////////////////////////
|
281
|
+
|
282
|
+
// SHAPE CREATION
|
283
|
+
|
284
|
+
|
285
|
+
// @Override
|
286
|
+
// protected PShape createShapeFamily(int type) {
|
287
|
+
// return new PShapeOpenGL(this, type);
|
288
|
+
// }
|
289
|
+
//
|
290
|
+
//
|
291
|
+
// @Override
|
292
|
+
// protected PShape createShapePrimitive(int kind, float... p) {
|
293
|
+
// return new PShapeOpenGL(this, kind, p);
|
294
|
+
// }
|
295
|
+
|
296
|
+
|
297
|
+
/*
|
298
|
+
@Override
|
299
|
+
public PShape createShape(PShape source) {
|
300
|
+
return PShapeOpenGL.createShape2D(this, source);
|
301
|
+
}
|
302
|
+
|
303
|
+
|
304
|
+
@Override
|
305
|
+
public PShape createShape() {
|
306
|
+
return createShape(PShape.GEOMETRY);
|
307
|
+
}
|
308
|
+
|
309
|
+
|
310
|
+
@Override
|
311
|
+
public PShape createShape(int type) {
|
312
|
+
return createShapeImpl(this, type);
|
313
|
+
}
|
314
|
+
|
315
|
+
|
316
|
+
@Override
|
317
|
+
public PShape createShape(int kind, float... p) {
|
318
|
+
return createShapeImpl(this, kind, p);
|
319
|
+
}
|
320
|
+
|
321
|
+
|
322
|
+
static protected PShapeOpenGL createShapeImpl(PGraphicsOpenGL pg, int type) {
|
323
|
+
PShapeOpenGL shape = null;
|
324
|
+
if (type == PConstants.GROUP) {
|
325
|
+
shape = new PShapeOpenGL(pg, PConstants.GROUP);
|
326
|
+
} else if (type == PShape.PATH) {
|
327
|
+
shape = new PShapeOpenGL(pg, PShape.PATH);
|
328
|
+
} else if (type == PShape.GEOMETRY) {
|
329
|
+
shape = new PShapeOpenGL(pg, PShape.GEOMETRY);
|
330
|
+
}
|
331
|
+
shape.set3D(false);
|
332
|
+
return shape;
|
333
|
+
}
|
334
|
+
|
335
|
+
|
336
|
+
static protected PShapeOpenGL createShapeImpl(PGraphicsOpenGL pg,
|
337
|
+
int kind, float... p) {
|
338
|
+
PShapeOpenGL shape = null;
|
339
|
+
int len = p.length;
|
340
|
+
|
341
|
+
if (kind == POINT) {
|
342
|
+
if (len != 2) {
|
343
|
+
showWarning("Wrong number of parameters");
|
344
|
+
return null;
|
345
|
+
}
|
346
|
+
shape = new PShapeOpenGL(pg, PShape.PRIMITIVE);
|
347
|
+
shape.setKind(POINT);
|
348
|
+
} else if (kind == LINE) {
|
349
|
+
if (len != 4) {
|
350
|
+
showWarning("Wrong number of parameters");
|
351
|
+
return null;
|
352
|
+
}
|
353
|
+
shape = new PShapeOpenGL(pg, PShape.PRIMITIVE);
|
354
|
+
shape.setKind(LINE);
|
355
|
+
} else if (kind == TRIANGLE) {
|
356
|
+
if (len != 6) {
|
357
|
+
showWarning("Wrong number of parameters");
|
358
|
+
return null;
|
359
|
+
}
|
360
|
+
shape = new PShapeOpenGL(pg, PShape.PRIMITIVE);
|
361
|
+
shape.setKind(TRIANGLE);
|
362
|
+
} else if (kind == QUAD) {
|
363
|
+
if (len != 8) {
|
364
|
+
showWarning("Wrong number of parameters");
|
365
|
+
return null;
|
366
|
+
}
|
367
|
+
shape = new PShapeOpenGL(pg, PShape.PRIMITIVE);
|
368
|
+
shape.setKind(QUAD);
|
369
|
+
} else if (kind == RECT) {
|
370
|
+
if (len != 4 && len != 5 && len != 8 && len != 9) {
|
371
|
+
showWarning("Wrong number of parameters");
|
372
|
+
return null;
|
373
|
+
}
|
374
|
+
shape = new PShapeOpenGL(pg, PShape.PRIMITIVE);
|
375
|
+
shape.setKind(RECT);
|
376
|
+
} else if (kind == ELLIPSE) {
|
377
|
+
if (len != 4 && len != 5) {
|
378
|
+
showWarning("Wrong number of parameters");
|
379
|
+
return null;
|
380
|
+
}
|
381
|
+
shape = new PShapeOpenGL(pg, PShape.PRIMITIVE);
|
382
|
+
shape.setKind(ELLIPSE);
|
383
|
+
} else if (kind == ARC) {
|
384
|
+
if (len != 6 && len != 7) {
|
385
|
+
showWarning("Wrong number of parameters");
|
386
|
+
return null;
|
387
|
+
}
|
388
|
+
shape = new PShapeOpenGL(pg, PShape.PRIMITIVE);
|
389
|
+
shape.setKind(ARC);
|
390
|
+
} else if (kind == BOX) {
|
391
|
+
showWarning("Primitive not supported in 2D");
|
392
|
+
} else if (kind == SPHERE) {
|
393
|
+
showWarning("Primitive not supported in 2D");
|
394
|
+
} else {
|
395
|
+
showWarning("Unrecognized primitive type");
|
396
|
+
}
|
397
|
+
|
398
|
+
if (shape != null) {
|
399
|
+
shape.setParams(p);
|
400
|
+
}
|
401
|
+
|
402
|
+
shape.set3D(false);
|
403
|
+
return shape;
|
404
|
+
}
|
405
|
+
*/
|
406
|
+
|
407
|
+
|
408
|
+
//////////////////////////////////////////////////////////////
|
409
|
+
|
410
|
+
// BEZIER VERTICES
|
411
|
+
|
412
|
+
|
413
|
+
@Override
|
414
|
+
public void bezierVertex(float x2, float y2, float z2,
|
415
|
+
float x3, float y3, float z3,
|
416
|
+
float x4, float y4, float z4) {
|
417
|
+
showDepthWarningXYZ("bezierVertex");
|
418
|
+
}
|
419
|
+
|
420
|
+
|
421
|
+
//////////////////////////////////////////////////////////////
|
422
|
+
|
423
|
+
// QUADRATIC BEZIER VERTICES
|
424
|
+
|
425
|
+
|
426
|
+
@Override
|
427
|
+
public void quadraticVertex(float x2, float y2, float z2,
|
428
|
+
float x4, float y4, float z4) {
|
429
|
+
showDepthWarningXYZ("quadVertex");
|
430
|
+
}
|
431
|
+
|
432
|
+
|
433
|
+
//////////////////////////////////////////////////////////////
|
434
|
+
|
435
|
+
// CURVE VERTICES
|
436
|
+
|
437
|
+
|
438
|
+
@Override
|
439
|
+
public void curveVertex(float x, float y, float z) {
|
440
|
+
showDepthWarningXYZ("curveVertex");
|
441
|
+
}
|
442
|
+
|
443
|
+
|
444
|
+
//////////////////////////////////////////////////////////////
|
445
|
+
|
446
|
+
// BOX
|
447
|
+
|
448
|
+
|
449
|
+
@Override
|
450
|
+
public void box(float w, float h, float d) {
|
451
|
+
showMethodWarning("box");
|
452
|
+
}
|
453
|
+
|
454
|
+
|
455
|
+
//////////////////////////////////////////////////////////////
|
456
|
+
|
457
|
+
// SPHERE
|
458
|
+
|
459
|
+
|
460
|
+
@Override
|
461
|
+
public void sphere(float r) {
|
462
|
+
showMethodWarning("sphere");
|
463
|
+
}
|
464
|
+
|
465
|
+
|
466
|
+
//////////////////////////////////////////////////////////////
|
467
|
+
|
468
|
+
// VERTEX SHAPES
|
469
|
+
|
470
|
+
|
471
|
+
@Override
|
472
|
+
public void vertex(float x, float y, float z) {
|
473
|
+
showDepthWarningXYZ("vertex");
|
474
|
+
}
|
475
|
+
|
476
|
+
@Override
|
477
|
+
public void vertex(float x, float y, float z, float u, float v) {
|
478
|
+
showDepthWarningXYZ("vertex");
|
479
|
+
}
|
480
|
+
|
481
|
+
//////////////////////////////////////////////////////////////
|
482
|
+
|
483
|
+
// MATRIX TRANSFORMATIONS
|
484
|
+
|
485
|
+
@Override
|
486
|
+
public void translate(float tx, float ty, float tz) {
|
487
|
+
showDepthWarningXYZ("translate");
|
488
|
+
}
|
489
|
+
|
490
|
+
@Override
|
491
|
+
public void rotateX(float angle) {
|
492
|
+
showDepthWarning("rotateX");
|
493
|
+
}
|
494
|
+
|
495
|
+
@Override
|
496
|
+
public void rotateY(float angle) {
|
497
|
+
showDepthWarning("rotateY");
|
498
|
+
}
|
499
|
+
|
500
|
+
@Override
|
501
|
+
public void rotateZ(float angle) {
|
502
|
+
showDepthWarning("rotateZ");
|
503
|
+
}
|
504
|
+
|
505
|
+
@Override
|
506
|
+
public void rotate(float angle, float vx, float vy, float vz) {
|
507
|
+
showVariationWarning("rotate");
|
508
|
+
}
|
509
|
+
|
510
|
+
@Override
|
511
|
+
public void applyMatrix(PMatrix3D source) {
|
512
|
+
showVariationWarning("applyMatrix");
|
513
|
+
}
|
514
|
+
|
515
|
+
@Override
|
516
|
+
public void applyMatrix(float n00, float n01, float n02, float n03,
|
517
|
+
float n10, float n11, float n12, float n13,
|
518
|
+
float n20, float n21, float n22, float n23,
|
519
|
+
float n30, float n31, float n32, float n33) {
|
520
|
+
showVariationWarning("applyMatrix");
|
521
|
+
}
|
522
|
+
|
523
|
+
@Override
|
524
|
+
public void scale(float sx, float sy, float sz) {
|
525
|
+
showDepthWarningXYZ("scale");
|
526
|
+
}
|
527
|
+
|
528
|
+
//////////////////////////////////////////////////////////////
|
529
|
+
|
530
|
+
// SCREEN AND MODEL COORDS
|
531
|
+
|
532
|
+
@Override
|
533
|
+
public float screenX(float x, float y, float z) {
|
534
|
+
showDepthWarningXYZ("screenX");
|
535
|
+
return 0;
|
536
|
+
}
|
537
|
+
|
538
|
+
@Override
|
539
|
+
public float screenY(float x, float y, float z) {
|
540
|
+
showDepthWarningXYZ("screenY");
|
541
|
+
return 0;
|
542
|
+
}
|
543
|
+
|
544
|
+
@Override
|
545
|
+
public float screenZ(float x, float y, float z) {
|
546
|
+
showDepthWarningXYZ("screenZ");
|
547
|
+
return 0;
|
548
|
+
}
|
549
|
+
|
550
|
+
@Override
|
551
|
+
public PMatrix3D getMatrix(PMatrix3D target) {
|
552
|
+
showVariationWarning("getMatrix");
|
553
|
+
return target;
|
554
|
+
}
|
555
|
+
|
556
|
+
@Override
|
557
|
+
public void setMatrix(PMatrix3D source) {
|
558
|
+
showVariationWarning("setMatrix");
|
559
|
+
}
|
560
|
+
|
561
|
+
//////////////////////////////////////////////////////////////
|
562
|
+
|
563
|
+
// LIGHTS
|
564
|
+
|
565
|
+
@Override
|
566
|
+
public void lights() {
|
567
|
+
showMethodWarning("lights");
|
568
|
+
}
|
569
|
+
|
570
|
+
@Override
|
571
|
+
public void noLights() {
|
572
|
+
showMethodWarning("noLights");
|
573
|
+
}
|
574
|
+
|
575
|
+
@Override
|
576
|
+
public void ambientLight(float red, float green, float blue) {
|
577
|
+
showMethodWarning("ambientLight");
|
578
|
+
}
|
579
|
+
|
580
|
+
@Override
|
581
|
+
public void ambientLight(float red, float green, float blue,
|
582
|
+
float x, float y, float z) {
|
583
|
+
showMethodWarning("ambientLight");
|
584
|
+
}
|
585
|
+
|
586
|
+
@Override
|
587
|
+
public void directionalLight(float red, float green, float blue,
|
588
|
+
float nx, float ny, float nz) {
|
589
|
+
showMethodWarning("directionalLight");
|
590
|
+
}
|
591
|
+
|
592
|
+
@Override
|
593
|
+
public void pointLight(float red, float green, float blue,
|
594
|
+
float x, float y, float z) {
|
595
|
+
showMethodWarning("pointLight");
|
596
|
+
}
|
597
|
+
|
598
|
+
@Override
|
599
|
+
public void spotLight(float red, float green, float blue,
|
600
|
+
float x, float y, float z,
|
601
|
+
float nx, float ny, float nz,
|
602
|
+
float angle, float concentration) {
|
603
|
+
showMethodWarning("spotLight");
|
604
|
+
}
|
605
|
+
|
606
|
+
@Override
|
607
|
+
public void lightFalloff(float constant, float linear, float quadratic) {
|
608
|
+
showMethodWarning("lightFalloff");
|
609
|
+
}
|
610
|
+
|
611
|
+
@Override
|
612
|
+
public void lightSpecular(float v1, float v2, float v3) {
|
613
|
+
showMethodWarning("lightSpecular");
|
614
|
+
}
|
615
|
+
}
|