Skip to content

Commit 01e6ad7

Browse files
author
Jonathan Feinberg
committed
Fix standalone.
1 parent d5f3bae commit 01e6ad7

File tree

5 files changed

+99
-88
lines changed

5 files changed

+99
-88
lines changed

build.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,6 @@
424424
includes="*.txt,*.jar,${platform}/**,${platform}64/**"/>
425425
</copy>
426426
<copy-processing-library dir="${cache}" library="dxf"/>
427-
<copy-processing-library dir="${cache}" library="lwjgl"/>
428427
<copy-processing-library dir="${cache}" library="net"/>
429428
<copy-processing-library dir="${cache}" library="pdf"/>
430429
<copy-processing-library dir="${cache}" library="serial"/>
@@ -439,8 +438,10 @@
439438
<fileset file="LICENSE.txt"/>
440439
<fileset dir="." includes="workspace/**"/>
441440
<fileset dir="." includes="libraries/**"/>
442-
<fileset dir="." includes="*.sh,*.bat,processing-py.app/**"/>
441+
<fileset dir="." includes="processing-py.app/**"/>
443442
</copy>
443+
<copy todir="${dist.dir}" file="processing-py.sh" />
444+
<copy todir="${dist.dir}" file="processing-py.bat" />
444445
<chmod file="${dist.dir}/processing-py.sh" perm="755"/>
445446
<chmod file="${dist.dir}/processing-py.bat" perm="755"/>
446447
<chmod file="${dist.dir}/processing-py.app/Contents/Resources/script" perm="755"/>

examples.py/3D/Image/Explode.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
"""
22
Explode
33
by Daniel Shiffman.
4-
(Rewritten in Python by Jonathan Feinberg.)
54
65
Mouse horizontal location controls breaking apart of image and
76
Maps pixels from a 2D image into 3D space. Pixel brightness controls
87
translation along z axis.
98
"""
10-
11-
cellsize = 2 # Dimensions of each cell in the grid
12-
img = loadImage("eames.jpg")
13-
columns = img.width / cellsize # Calculate # of columns
14-
rows = img.height / cellsize # Calculate # of rows
9+
10+
cellsize = 2 # Dimensions of each cell in the grid
11+
12+
1513
def setup():
16-
size(640, 360, P3D)
14+
size(640, 360, P3D)
15+
global img, columns, rows
16+
img = loadImage("eames.jpg")
17+
columns = img.width / cellsize # Calculate # of columns
18+
rows = img.height / cellsize # Calculate # of rows
19+
1720

18-
def draw():
21+
def draw():
1922
background(0)
2023
for row in range(rows):
2124
for col in range(columns):
2225
x = cellsize * col + cellsize / 2
2326
y = cellsize * row + cellsize / 2
2427
loc = x + y * img.width # Pixel array location
2528
c = img.pixels[loc] # Grab the color
26-
# Calculate a z position as a function of mouseX and pixel brightness
29+
# Calculate a z position as a function of mouseX and pixel
30+
# brightness
2731
z = (mouseX / float(width)) * brightness(img.pixels[loc]) - 20.0
2832
# Translate to the location, set fill and stroke, and draw the rect
2933
pushMatrix()
+80-75
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,80 @@
1-
"""
2-
* TexturedCube
3-
* based on pde example by Dave Bollinger.
4-
*
5-
* Drag mouse to rotate cube. Demonstrates use of u/v coords in
6-
* vertex() and effect on texture().
7-
"""
8-
tex = loadImage("data/berlin-1.jpg")
9-
rotx = PI / 4
10-
roty = PI / 4
11-
rate = 0.01
12-
13-
def setup():
14-
size(640, 360, OPENGL)
15-
textureMode(NORMAL)
16-
fill(255)
17-
stroke(color(44, 48, 32))
18-
19-
def draw():
20-
background(0)
21-
noStroke()
22-
translate(width / 2.0, height / 2.0, -100)
23-
rotateX(rotx)
24-
rotateY(roty)
25-
scale(90)
26-
TexturedCube()
27-
28-
def TexturedCube():
29-
beginShape(QUADS)
30-
texture(tex)
31-
# Given one texture and six faces, we can easily set up the uv coordinates
32-
# such that four of the faces tile "perfectly" along either u or v, but the other
33-
# two faces cannot be so aligned. This code tiles "along" u, "around" the X / Z faces
34-
# and fudges the Y faces - the Y faces are arbitrarily aligned such that a
35-
# rotation along the X axis will put the "top" of either texture at the "top"
36-
# of the screen, but is not otherwised aligned with the X / Z faces. (This
37-
# just affects what type of symmetry is required if you need seamless
38-
# tiling all the way around the cube)
39-
40-
# +Z "front" face
41-
vertex(-1, -1, 1, 0, 0)
42-
vertex(1, -1, 1, 1, 0)
43-
vertex(1, 1, 1, 1, 1)
44-
vertex(-1, 1, 1, 0, 1)
45-
# -Z "back" face
46-
vertex(1, -1, -1, 0, 0)
47-
vertex(-1, -1, -1, 1, 0)
48-
vertex(-1, 1, -1, 1, 1)
49-
vertex(1, 1, -1, 0, 1)
50-
# +Y "bottom" face
51-
vertex(-1, 1, 1, 0, 0)
52-
vertex(1, 1, 1, 1, 0)
53-
vertex(1, 1, -1, 1, 1)
54-
vertex(-1, 1, -1, 0, 1)
55-
# -Y "top" face
56-
vertex(-1, -1, -1, 0, 0)
57-
vertex(1, -1, -1, 1, 0)
58-
vertex(1, -1, 1, 1, 1)
59-
vertex(-1, -1, 1, 0, 1)
60-
# +X "right" face
61-
vertex(1, -1, 1, 0, 0)
62-
vertex(1, -1, -1, 1, 0)
63-
vertex(1, 1, -1, 1, 1)
64-
vertex(1, 1, 1, 0, 1)
65-
# -X "left" face
66-
vertex(-1, -1, -1, 0, 0)
67-
vertex(-1, -1, 1, 1, 0)
68-
vertex(-1, 1, 1, 1, 1)
69-
vertex(-1, 1, -1, 0, 1)
70-
endShape()
71-
72-
def mouseDragged():
73-
global rotx, roty
74-
rotx += (pmouseY - mouseY) * rate
75-
roty += (mouseX - pmouseX) * rate
1+
"""
2+
* TexturedCube
3+
* based on pde example by Dave Bollinger.
4+
*
5+
* Drag mouse to rotate cube. Demonstrates use of u/v coords in
6+
* vertex() and effect on texture().
7+
"""
8+
rotx = PI / 4
9+
roty = PI / 4
10+
rate = 0.01
11+
12+
13+
def setup():
14+
size(640, 360, OPENGL)
15+
textureMode(NORMAL)
16+
fill(255)
17+
stroke(color(44, 48, 32))
18+
global tex
19+
tex = loadImage("data/berlin-1.jpg")
20+
21+
22+
def draw():
23+
background(0)
24+
noStroke()
25+
translate(width / 2.0, height / 2.0, -100)
26+
rotateX(rotx)
27+
rotateY(roty)
28+
scale(90)
29+
TexturedCube()
30+
31+
32+
def TexturedCube():
33+
beginShape(QUADS)
34+
texture(tex)
35+
# Given one texture and six faces, we can easily set up the uv coordinates
36+
# such that four of the faces tile "perfectly" along either u or v, but the other
37+
# two faces cannot be so aligned. This code tiles "along" u, "around" the X / Z faces
38+
# and fudges the Y faces - the Y faces are arbitrarily aligned such that a
39+
# rotation along the X axis will put the "top" of either texture at the "top"
40+
# of the screen, but is not otherwised aligned with the X / Z faces. (This
41+
# just affects what type of symmetry is required if you need seamless
42+
# tiling all the way around the cube)
43+
44+
# +Z "front" face
45+
vertex(-1, -1, 1, 0, 0)
46+
vertex(1, -1, 1, 1, 0)
47+
vertex(1, 1, 1, 1, 1)
48+
vertex(-1, 1, 1, 0, 1)
49+
# -Z "back" face
50+
vertex(1, -1, -1, 0, 0)
51+
vertex(-1, -1, -1, 1, 0)
52+
vertex(-1, 1, -1, 1, 1)
53+
vertex(1, 1, -1, 0, 1)
54+
# +Y "bottom" face
55+
vertex(-1, 1, 1, 0, 0)
56+
vertex(1, 1, 1, 1, 0)
57+
vertex(1, 1, -1, 1, 1)
58+
vertex(-1, 1, -1, 0, 1)
59+
# -Y "top" face
60+
vertex(-1, -1, -1, 0, 0)
61+
vertex(1, -1, -1, 1, 0)
62+
vertex(1, -1, 1, 1, 1)
63+
vertex(-1, -1, 1, 0, 1)
64+
# +X "right" face
65+
vertex(1, -1, 1, 0, 0)
66+
vertex(1, -1, -1, 1, 0)
67+
vertex(1, 1, -1, 1, 1)
68+
vertex(1, 1, 1, 0, 1)
69+
# -X "left" face
70+
vertex(-1, -1, -1, 0, 0)
71+
vertex(-1, -1, 1, 1, 0)
72+
vertex(-1, 1, 1, 1, 1)
73+
vertex(-1, 1, -1, 0, 1)
74+
endShape()
75+
76+
77+
def mouseDragged():
78+
global rotx, roty
79+
rotx += (pmouseY - mouseY) * rate
80+
roty += (mouseX - pmouseX) * rate

examples.py/Python/colornames/colorsketch.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
"""
55
from namethatcolor import NameThatColor
66

7-
flag = loadImage("flag.jpg")
87
namer = NameThatColor()
98

109
def setup():
1110
size(200, 200)
11+
global flag
12+
flag = loadImage("flag.jpg")
1213

1314
def draw():
1415
background(0)

libraries/README.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Extract any Processing 2.0 plug-in into this directory, or any subdirectory
1+
Extract any Processing 3 plug-in into this directory, or any subdirectory
22
of this directory.

0 commit comments

Comments
 (0)