[Pkg-wmaker-commits] [wmcube] 01/67: Imported Upstream version 0.98
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Tue Aug 25 03:22:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmcube.
commit 6154868320590f9378e7d723b4672bbc24e1349a
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Sat Jan 10 23:09:23 2015 -0600
Imported Upstream version 0.98
---
3dObjects/2planes-solid.wmc | 23 +
3dObjects/4d.wmc | 59 ++
3dObjects/8star-small.wmc | 40 ++
3dObjects/8star.wmc | 40 ++
3dObjects/CONTRIBUTE | 51 ++
3dObjects/README | 54 ++
3dObjects/ball-solid.wmc | 104 ++++
3dObjects/ball.wmc | 83 +++
3dObjects/celtic.wmc | 71 +++
3dObjects/cross.wmc | 63 ++
3dObjects/cross2-solid.wmc | 80 +++
3dObjects/cross2.wmc | 51 ++
3dObjects/cross3-solid.wmc | 107 ++++
3dObjects/cross3.wmc | 95 +++
3dObjects/cross4-solid.wmc | 107 ++++
3dObjects/crystal.wmc | 108 ++++
3dObjects/cube-solid.wmc | 27 +
3dObjects/cube.wmc | 24 +
3dObjects/diamond.wmc | 66 +++
3dObjects/dice-solid.wmc | 81 +++
3dObjects/e.wmc | 69 +++
3dObjects/e2.wmc | 160 +++++
3dObjects/foo.wmc | 149 +++++
3dObjects/gnustep.wmc | 110 ++++
3dObjects/hyperpyramid.wmc | 54 ++
3dObjects/jeep.wmc | 157 +++++
3dObjects/multicube.wmc | 83 +++
3dObjects/peace.wmc | 155 +++++
3dObjects/pyramid.wmc | 16 +
3dObjects/radioactive.wmc | 185 ++++++
3dObjects/shield.wmc | 197 +++++++
3dObjects/spaceshuttle.wmc | 382 ++++++++++++
3dObjects/spiral.wmc | 49 ++
3dObjects/star.wmc | 95 +++
3dObjects/starcube.wmc | 69 +++
3dObjects/wmlogo.wmc | 59 ++
CHANGES | 34 ++
COPYING | 339 +++++++++++
INSTALL | 37 ++
README | 41 ++
TODO | 8 +
wmcube/Makefile | 39 ++
wmcube/Makefile.FREEBSD | 38 ++
wmcube/Makefile.LINUX | 39 ++
wmcube/Makefile.NETBSD | 36 ++
wmcube/Makefile.OPENBSD | 37 ++
wmcube/Makefile.SOLARIS | 38 ++
wmcube/wmcube.c | 1351 +++++++++++++++++++++++++++++++++++++++++++
wmcube/wmcube.xpm | 142 +++++
wmgeneral/list.c | 169 ++++++
wmgeneral/list.h | 59 ++
wmgeneral/misc.c | 164 ++++++
wmgeneral/misc.h | 9 +
wmgeneral/wmgeneral.c | 481 +++++++++++++++
wmgeneral/wmgeneral.h | 59 ++
55 files changed, 6443 insertions(+)
diff --git a/3dObjects/2planes-solid.wmc b/3dObjects/2planes-solid.wmc
new file mode 100644
index 0000000..b884b35
--- /dev/null
+++ b/3dObjects/2planes-solid.wmc
@@ -0,0 +1,23 @@
+WMCUBE_COORDINATES
+1 -180 -180 180
+2 180 -180 180
+3 180 180 80
+4 -180 180 80
+5 -180 -180 -180
+6 180 -180 -180
+7 180 180 -80
+8 -180 180 -80
+
+WMCUBE_PLANES
+1 2 3
+1 3 4
+2 1 4
+2 4 3
+
+5 6 7
+5 7 8
+6 5 7
+7 5 8
+
+
+
diff --git a/3dObjects/4d.wmc b/3dObjects/4d.wmc
new file mode 100644
index 0000000..21716d1
--- /dev/null
+++ b/3dObjects/4d.wmc
@@ -0,0 +1,59 @@
+WMCUBE_COORDINATES
+ 1 -51 50 0
+ 2 0 50 51
+ 3 51 50 0
+ 4 0 50 -51
+
+ 5 74 0 0
+ 6 37 0 64
+ 7 -37 0 64
+ 8 -74 0 0
+ 9 -37 0 -64
+ 10 37 0 -64
+
+ 11 -51 -50 0
+ 12 0 -50 51
+ 13 51 -50 0
+ 14 0 -50 -51
+
+
+ 15 0 100 0
+ 16 0 -100 0
+
+ WMCUBE_LINES
+
+ 15 1
+ 15 2
+ 15 3
+ 15 4
+
+ 1 5
+ 1 6
+ 1 7
+ 2 5
+ 2 8
+ 2 9
+ 3 6
+ 3 8
+ 3 10
+ 4 7
+ 4 9
+ 4 10
+
+ 5 11
+ 5 12
+ 6 11
+ 6 13
+ 7 12
+ 7 13
+ 8 11
+ 8 14
+ 9 12
+ 9 14
+ 10 13
+ 10 14
+
+ 11 16
+ 12 16
+ 13 16
+ 14 16
diff --git a/3dObjects/8star-small.wmc b/3dObjects/8star-small.wmc
new file mode 100644
index 0000000..35dddf5
--- /dev/null
+++ b/3dObjects/8star-small.wmc
@@ -0,0 +1,40 @@
+WMCUBE_COORDINATES
+ 1 -50 -50 0
+ 2 50 -50 0
+ 3 50 50 0
+ 4 -50 50 0
+ 5 0 0 71
+ 6 0 0 -71
+ 7 0 82 58
+ 8 82 0 58
+ 9 0 -82 58
+ 10 -82 0 58
+ 11 0 82 -58
+ 12 82 0 -58
+ 13 0 -82 -58
+ 14 -82 0 -58
+ WMCUBE_LINES
+ 2 8
+ 2 9
+ 2 12
+ 2 13
+ 4 7
+ 4 10
+ 4 11
+ 4 14
+ 1 9
+ 1 10
+ 1 13
+ 1 14
+ 3 7
+ 3 8
+ 3 11
+ 3 12
+ 5 7
+ 5 8
+ 5 9
+ 5 10
+ 6 11
+ 6 12
+ 6 13
+ 6 14
diff --git a/3dObjects/8star.wmc b/3dObjects/8star.wmc
new file mode 100644
index 0000000..c04e721
--- /dev/null
+++ b/3dObjects/8star.wmc
@@ -0,0 +1,40 @@
+WMCUBE_COORDINATES
+ 1 -10 -10 0
+ 2 10 -10 0
+ 3 10 10 0
+ 4 -10 10 0
+ 5 0 0 21
+ 6 0 0 -21
+ 7 0 82 58
+ 8 82 0 58
+ 9 0 -82 58
+ 10 -82 0 58
+ 11 0 82 -58
+ 12 82 0 -58
+ 13 0 -82 -58
+ 14 -82 0 -58
+ WMCUBE_LINES
+ 2 8
+ 2 9
+ 2 12
+ 2 13
+ 4 7
+ 4 10
+ 4 11
+ 4 14
+ 1 9
+ 1 10
+ 1 13
+ 1 14
+ 3 7
+ 3 8
+ 3 11
+ 3 12
+ 5 7
+ 5 8
+ 5 9
+ 5 10
+ 6 11
+ 6 12
+ 6 13
+ 6 14
diff --git a/3dObjects/CONTRIBUTE b/3dObjects/CONTRIBUTE
new file mode 100644
index 0000000..3743655
--- /dev/null
+++ b/3dObjects/CONTRIBUTE
@@ -0,0 +1,51 @@
+These are the people who have contributed by making objects for wmCube:
+
+FuzzyBear <flung at andrew.cmu.edu>
+
+ - 4d.wmc
+ - crystal.wmc
+ - starcube.wmc
+
+Peter Kokles <kokles at bb.telecom.sk>
+
+ - celtic.wmc
+ - multicube.wmc
+ - peace.wmc
+ - radioactive.wmc
+ - shield.wmc
+
+Jeff Frasca <phaedrus at thereactor.cleptoscastle.com>
+
+ - spiral.wmc
+
+Axel Ahrens <ahrens at ewerk.de>
+
+ - hyperpyramid.wmc
+
+Aaron Benner <benner at mcn.net>
+
+ - 8star.wmc
+ - 8star-small.wmc
+
+Per �kergren <akeper-8 at student.luth.se>
+
+ - e.wmc
+ - e2.wmc
+
+Adam Hapworth <adamh at mint.net>
+
+ - foo.wmc
+ - jeep.wmc
+
+tarzeau <tarzeau at space.ch>
+
+ - spaceshuttle.wmc
+
+Rafael Garcia-Suarez <garcia-suarez at kazibao.net>
+
+ - wmlogo.wmc
+
+Nicolas Mieville <nm at altern.org>
+
+ - diamond.wmc
+ - gnustep.wmc
diff --git a/3dObjects/README b/3dObjects/README
new file mode 100644
index 0000000..a5cad75
--- /dev/null
+++ b/3dObjects/README
@@ -0,0 +1,54 @@
+The object-files to be used with wmCube has the
+following format:
+
+WMCUBE_COORDINATES
+
+1 50 -40 30
+2 -50 50 -30
+3 -20 70 -20
+^ ^ ^ ^
+| | | \__ Z-coordinate relative the center
+| | \______ Y-coordinate relative the center
+| \___________ X-coordinate relative the center
+ \_______________ Coordinate index
+
+
+The indexes must be 1,2,3...n on a object with n coordinates.
+The center of the object is the coordinate the object will
+revolve around (0,0,0);
+
+The next section is either (case sensitive):
+
+* WMCUBE_LINES
+
+1 2
+2 3
+3 1
+
+These are the coordinates wmCube will draw lines
+between.
+
+or
+
+* WMCUBE_PLANES
+
+1 2 3
+2 3 1
+1 3 2
+2 1 3
+
+These are the coordinates wmCube will use as corner-
+coordinates for a plane. The tricky part is that the
+plane will be drawn only if you list the coordinates
+making up the plane in clockwise order. In the example
+above, the first two rows making up planes with coordinates
+1 2 3 and 2 3 1 will NOT be drawn until the object
+has rotated some X degrees but the other two will be
+drawn at once. Its kinda hard to explain, just try and you
+will eventually understand how it works.
+
+
+Done! Save the file with a .wmc suffix (preferably) and try
+running wmCube with the -o option and it will tell you if
+something is wrong with the object. Otherwise enjoy and
+remember to send me all the cool objects you create :-)
diff --git a/3dObjects/ball-solid.wmc b/3dObjects/ball-solid.wmc
new file mode 100644
index 0000000..fa6f2ff
--- /dev/null
+++ b/3dObjects/ball-solid.wmc
@@ -0,0 +1,104 @@
+WMCUBE_COORDINATES
+1 -100 -100 100
+2 100 -100 100
+3 100 100 100
+4 -100 100 100
+5 -100 -100 -100
+6 100 -100 -100
+7 100 100 -100
+8 -100 100 -100
+9 -50 -150 -50
+10 50 -150 -50
+11 150 -50 -50
+12 150 50 -50
+13 50 150 -50
+14 -50 150 -50
+15 -150 50 -50
+16 -150 -50 -50
+17 -150 -50 50
+18 -50 -150 50
+19 50 -150 50
+20 150 -50 50
+21 150 50 50
+22 50 150 50
+23 -50 150 50
+24 -150 50 50
+25 -50 -50 150
+26 50 -50 150
+27 50 50 150
+28 -50 50 150
+29 -50 -50 -150
+30 50 -50 -150
+31 50 50 -150
+32 -50 50 -150
+WMCUBE_PLANES
+1 18 19
+1 19 2
+17 1 24
+24 1 4
+2 20 3
+3 20 21
+4 3 23
+23 3 22
+
+10 9 5
+6 10 5
+8 14 7
+7 14 13
+5 16 15
+5 15 8
+6 7 11
+11 7 12
+
+17 16 5
+17 5 1
+9 18 5
+18 1 5
+
+9 19 18
+9 10 19
+19 10 6
+19 6 2
+
+6 20 2
+6 11 20
+20 11 12
+20 12 21
+
+3 7 13
+3 13 22
+21 12 7
+3 21 7
+
+23 22 14
+22 13 14
+8 4 14
+4 23 14
+
+24 4 8
+24 8 15
+16 17 24
+16 24 15
+
+1 25 28
+1 28 4
+1 2 25
+2 26 25
+26 2 3
+26 3 27
+28 3 4
+28 27 3
+28 25 27
+25 26 27
+
+29 5 8
+29 8 32
+6 30 31
+6 31 7
+29 6 5
+29 30 6
+8 31 32
+8 7 31
+
+29 32 30
+31 30 32
diff --git a/3dObjects/ball.wmc b/3dObjects/ball.wmc
new file mode 100644
index 0000000..5a0d8be
--- /dev/null
+++ b/3dObjects/ball.wmc
@@ -0,0 +1,83 @@
+WMCUBE_COORDINATES
+1 -100 -100 100
+2 100 -100 100
+3 100 100 100
+4 -100 100 100
+5 -100 -100 -100
+6 100 -100 -100
+7 100 100 -100
+8 -100 100 -100
+9 -50 -150 -50
+10 50 -150 -50
+11 150 -50 -50
+12 150 50 -50
+13 50 150 -50
+14 -50 150 -50
+15 -150 50 -50
+16 -150 -50 -50
+17 -150 -50 50
+18 -50 -150 50
+19 50 -150 50
+20 150 -50 50
+21 150 50 50
+22 50 150 50
+23 -50 150 50
+24 -150 50 50
+25 -50 -50 150
+26 50 -50 150
+27 50 50 150
+28 -50 50 150
+29 -50 -50 -150
+30 50 -50 -150
+31 50 50 -150
+32 -50 50 -150
+
+WMCUBE_LINES
+9 10
+10 6
+6 11
+11 12
+12 7
+7 13
+13 14
+14 8
+8 15
+15 16
+16 5
+5 9
+17 1
+1 18
+18 19
+19 2
+2 20
+20 21
+21 3
+3 22
+22 23
+23 4
+4 24
+24 17
+9 18
+10 19
+11 20
+12 21
+13 22
+14 23
+15 24
+16 17
+25 26
+26 27
+27 28
+28 25
+25 1
+26 2
+27 3
+28 4
+29 30
+30 31
+31 32
+32 29
+5 29
+6 30
+7 31
+8 32
diff --git a/3dObjects/celtic.wmc b/3dObjects/celtic.wmc
new file mode 100644
index 0000000..5f45232
--- /dev/null
+++ b/3dObjects/celtic.wmc
@@ -0,0 +1,71 @@
+WMCUBE_COORDINATES
+1 -40 40 40
+2 -40 -40 40
+3 40 -40 40
+4 40 40 40
+5 -60 20 20
+6 -60 -20 20
+7 60 -20 20
+8 60 20 20
+9 -20 60 20
+10 -20 -60 20
+11 20 -60 20
+12 20 60 20
+13 -40 40 -40
+14 -40 -40 -40
+15 40 -40 -40
+16 40 40 -40
+17 -60 20 -20
+18 -60 -20 -20
+19 60 -20 -20
+20 60 20 -20
+21 -20 60 -20
+22 -20 -60 -20
+23 20 -60 -20
+24 20 60 -20
+25 20 20 60
+26 -20 20 60
+27 20 -20 60
+28 -20 -20 60
+29 20 20 -60
+30 -20 20 -60
+31 20 -20 -60
+32 -20 -20 -60
+
+WMCUBE_LINES
+8 18
+20 6
+5 19
+7 17
+8 20
+7 19
+5 17
+6 18
+8 7
+20 19
+5 6
+17 18
+25 26
+26 28
+28 27
+27 25
+29 30
+30 32
+32 31
+31 29
+25 32
+28 29
+26 31
+27 30
+9 23
+11 21
+10 24
+12 22
+24 12
+23 11
+9 21
+10 22
+11 10
+9 12
+23 22
+24 21
diff --git a/3dObjects/cross.wmc b/3dObjects/cross.wmc
new file mode 100644
index 0000000..72e9cf6
--- /dev/null
+++ b/3dObjects/cross.wmc
@@ -0,0 +1,63 @@
+WMCUBE_COORDINATES
+1 -50 -50 50
+2 50 -50 50
+3 50 50 50
+4 -50 50 50
+5 -50 -50 -50
+6 50 -50 -50
+7 50 50 -50
+8 -50 50 -50
+9 -50 -150 -50
+10 50 -150 -50
+11 150 -50 -50
+12 150 50 -50
+13 50 150 -50
+14 -50 150 -50
+15 -150 50 -50
+16 -150 -50 -50
+17 -150 -50 50
+18 -50 -150 50
+19 50 -150 50
+20 150 -50 50
+21 150 50 50
+22 50 150 50
+23 -50 150 50
+24 -150 50 50
+
+WMCUBE_LINES
+1 5
+2 6
+7 3
+8 4
+9 10
+10 6
+6 11
+11 12
+12 7
+7 13
+13 14
+14 8
+8 15
+15 16
+16 5
+5 9
+17 1
+1 18
+18 19
+19 2
+2 20
+20 21
+21 3
+3 22
+22 23
+23 4
+4 24
+24 17
+9 18
+10 19
+11 20
+12 21
+13 22
+14 23
+15 24
+16 17
diff --git a/3dObjects/cross2-solid.wmc b/3dObjects/cross2-solid.wmc
new file mode 100644
index 0000000..4196bec
--- /dev/null
+++ b/3dObjects/cross2-solid.wmc
@@ -0,0 +1,80 @@
+WMCUBE_COORDINATES
+1 -50 -50 50
+2 50 -50 50
+3 50 50 50
+4 -50 50 50
+5 -50 -50 -50
+6 50 -50 -50
+7 50 50 -50
+8 -50 50 -50
+9 -50 -150 -50
+10 50 -150 -50
+11 150 -50 -50
+12 150 50 -50
+13 50 150 -50
+14 -50 150 -50
+15 -150 50 -50
+16 -150 -50 -50
+17 -150 -50 50
+18 -50 -150 50
+19 50 -150 50
+20 150 -50 50
+21 150 50 50
+22 50 150 50
+23 -50 150 50
+24 -150 50 50
+
+WMCUBE_PLANES
+1 18 19
+1 19 2
+17 1 24
+24 1 4
+1 2 4
+2 3 4
+2 20 3
+3 20 21
+4 3 23
+23 3 22
+
+10 9 5
+6 10 5
+8 14 7
+7 14 13
+5 16 15
+5 15 8
+5 8 6
+8 7 6
+6 7 11
+11 7 12
+
+17 16 5
+17 5 1
+9 18 5
+18 1 5
+
+9 19 18
+9 10 19
+19 10 6
+19 6 2
+
+6 20 2
+6 11 20
+20 11 12
+20 12 21
+
+3 7 13
+3 13 22
+21 12 7
+3 21 7
+
+23 22 14
+22 13 14
+8 4 14
+4 23 14
+
+24 4 8
+24 8 15
+16 17 24
+16 24 15
+
+
diff --git a/3dObjects/cross2.wmc b/3dObjects/cross2.wmc
new file mode 100644
index 0000000..61b5a39
--- /dev/null
+++ b/3dObjects/cross2.wmc
@@ -0,0 +1,51 @@
+WMCUBE_COORDINATES
+1 -50 -50 50
+2 50 -50 50
+3 50 50 50
+4 -50 50 50
+5 -50 -50 -50
+6 50 -50 -50
+7 50 50 -50
+8 -50 50 -50
+9 -50 -150 -50
+10 50 -150 -50
+11 150 -50 -50
+12 150 50 -50
+13 50 150 -50
+14 -50 150 -50
+15 -150 50 -50
+16 -150 -50 -50
+17 -150 -50 50
+18 -50 -150 50
+19 50 -150 50
+20 150 -50 50
+21 150 50 50
+22 50 150 50
+23 -50 150 50
+24 -150 50 50
+
+WMCUBE_LINES
+9 10
+10 6
+6 11
+11 12
+12 7
+7 13
+13 14
+14 8
+8 15
+15 16
+16 5
+5 9
+17 1
+1 18
+18 19
+19 2
+2 20
+20 21
+21 3
+3 22
+22 23
+23 4
+4 24
+24 17
diff --git a/3dObjects/cross3-solid.wmc b/3dObjects/cross3-solid.wmc
new file mode 100644
index 0000000..db22467
--- /dev/null
+++ b/3dObjects/cross3-solid.wmc
@@ -0,0 +1,107 @@
+WMCUBE_COORDINATES
+1 -50 -50 50
+2 50 -50 50
+3 50 50 50
+4 -50 50 50
+5 -50 -50 -50
+6 50 -50 -50
+7 50 50 -50
+8 -50 50 -50
+9 -50 -150 -50
+10 50 -150 -50
+11 150 -50 -50
+12 150 50 -50
+13 50 150 -50
+14 -50 150 -50
+15 -150 50 -50
+16 -150 -50 -50
+17 -150 -50 50
+18 -50 -150 50
+19 50 -150 50
+20 150 -50 50
+21 150 50 50
+22 50 150 50
+23 -50 150 50
+24 -150 50 50
+25 -50 -50 150
+26 50 -50 150
+27 50 50 150
+28 -50 50 150
+29 -50 -50 -150
+30 50 -50 -150
+31 50 50 -150
+32 -50 50 -150
+
+WMCUBE_PLANES
+1 18 19
+1 19 2
+17 1 24
+24 1 4
+2 20 3
+3 20 21
+4 3 23
+23 3 22
+
+10 9 5
+6 10 5
+8 14 7
+7 14 13
+5 16 15
+5 15 8
+6 7 11
+11 7 12
+
+17 16 5
+17 5 1
+9 18 5
+18 1 5
+
+9 19 18
+9 10 19
+19 10 6
+19 6 2
+
+6 20 2
+6 11 20
+20 11 12
+20 12 21
+
+3 7 13
+3 13 22
+21 12 7
+3 21 7
+
+23 22 14
+22 13 14
+8 4 14
+4 23 14
+
+24 4 8
+24 8 15
+16 17 24
+16 24 15
+
+1 25 28
+1 28 4
+1 2 25
+2 26 25
+26 2 3
+26 3 27
+28 3 4
+28 27 3
+28 25 27
+25 26 27
+
+29 5 8
+29 8 32
+6 30 31
+6 31 7
+29 6 5
+29 30 6
+8 31 32
+8 7 31
+29 32 30
+32 31 30
+
+
+
diff --git a/3dObjects/cross3.wmc b/3dObjects/cross3.wmc
new file mode 100644
index 0000000..6916934
--- /dev/null
+++ b/3dObjects/cross3.wmc
@@ -0,0 +1,95 @@
+WMCUBE_COORDINATES
+1 -50 -50 50
+2 50 -50 50
+3 50 50 50
+4 -50 50 50
+5 -50 -50 -50
+6 50 -50 -50
+7 50 50 -50
+8 -50 50 -50
+9 -50 -150 -50
+10 50 -150 -50
+11 150 -50 -50
+12 150 50 -50
+13 50 150 -50
+14 -50 150 -50
+15 -150 50 -50
+16 -150 -50 -50
+17 -150 -50 50
+18 -50 -150 50
+19 50 -150 50
+20 150 -50 50
+21 150 50 50
+22 50 150 50
+23 -50 150 50
+24 -150 50 50
+25 -50 -50 150
+26 50 -50 150
+27 50 50 150
+28 -50 50 150
+29 -50 -50 -150
+30 50 -50 -150
+31 50 50 -150
+32 -50 50 -150
+
+WMCUBE_LINES
+1 5
+2 6
+7 3
+8 4
+9 10
+10 6
+6 11
+11 12
+12 7
+7 13
+13 14
+14 8
+8 15
+15 16
+16 5
+5 9
+17 1
+1 18
+18 19
+19 2
+2 20
+20 21
+21 3
+3 22
+22 23
+23 4
+4 24
+24 17
+9 18
+10 19
+11 20
+12 21
+13 22
+14 23
+15 24
+16 17
+25 26
+26 27
+27 28
+28 25
+25 1
+26 2
+27 3
+28 4
+5 6
+6 7
+7 8
+8 5
+29 30
+30 31
+31 32
+32 29
+5 29
+6 30
+7 31
+8 32
+1 2
+2 3
+3 4
+4 1
diff --git a/3dObjects/cross4-solid.wmc b/3dObjects/cross4-solid.wmc
new file mode 100644
index 0000000..371d57e
--- /dev/null
+++ b/3dObjects/cross4-solid.wmc
@@ -0,0 +1,107 @@
+WMCUBE_COORDINATES
+1 -50 -50 50
+2 50 -50 50
+3 50 50 50
+4 -50 50 50
+5 -50 -50 -50
+6 50 -50 -50
+7 50 50 -50
+8 -50 50 -50
+9 -50 -300 -50
+10 50 -300 -50
+11 300 -50 -50
+12 300 50 -50
+13 50 300 -50
+14 -50 300 -50
+15 -300 50 -50
+16 -300 -50 -50
+17 -300 -50 50
+18 -50 -300 50
+19 50 -300 50
+20 300 -50 50
+21 300 50 50
+22 50 300 50
+23 -50 300 50
+24 -300 50 50
+25 -50 -50 300
+26 50 -50 300
+27 50 50 300
+28 -50 50 300
+29 -50 -50 -300
+30 50 -50 -300
+31 50 50 -300
+32 -50 50 -300
+
+WMCUBE_PLANES
+1 18 19
+1 19 2
+17 1 24
+24 1 4
+2 20 3
+3 20 21
+4 3 23
+23 3 22
+
+10 9 5
+6 10 5
+8 14 7
+7 14 13
+5 16 15
+5 15 8
+6 7 11
+11 7 12
+
+17 16 5
+17 5 1
+9 18 5
+18 1 5
+
+9 19 18
+9 10 19
+19 10 6
+19 6 2
+
+6 20 2
+6 11 20
+20 11 12
+20 12 21
+
+3 7 13
+3 13 22
+21 12 7
+3 21 7
+
+23 22 14
+22 13 14
+8 4 14
+4 23 14
+
+24 4 8
+24 8 15
+16 17 24
+16 24 15
+
+1 25 28
+1 28 4
+1 2 25
+2 26 25
+26 2 3
+26 3 27
+28 3 4
+28 27 3
+28 25 27
+25 26 27
+
+29 5 8
+29 8 32
+6 30 31
+6 31 7
+29 6 5
+29 30 6
+8 31 32
+8 7 31
+29 32 30
+32 31 30
+
+
+
diff --git a/3dObjects/crystal.wmc b/3dObjects/crystal.wmc
new file mode 100644
index 0000000..e2341ce
--- /dev/null
+++ b/3dObjects/crystal.wmc
@@ -0,0 +1,108 @@
+WMCUBE_COORDINATES
+ 1 0 0 0
+
+ 2 150 0 0
+ 3 0 150 0
+ 4 0 0 150
+ 5 -150 0 0
+ 6 0 -150 0
+ 7 0 0 -150
+
+ 8 100 -30 -30
+ 9 100 -30 30
+ 10 100 30 30
+ 11 100 30 -30
+
+ 12 30 100 -30
+ 13 30 100 30
+ 14 -30 100 30
+ 15 -30 100 -30
+
+ 16 -100 -30 -30
+ 17 -100 -30 30
+ 18 -100 30 30
+ 19 -100 30 -30
+
+ 20 30 -100 -30
+ 21 30 -100 30
+ 22 -30 -100 30
+ 23 -30 -100 -30
+
+ 24 30 -30 100
+ 25 30 30 100
+ 26 -30 30 100
+ 27 -30 -30 100
+
+ 28 30 -30 -100
+ 29 30 30 -100
+ 30 -30 30 -100
+ 31 -30 -30 -100
+
+ WMCUBE_LINES
+
+ 1 11
+ 1 8
+ 1 9
+ 1 10
+
+ 1 15
+ 1 12
+ 1 13
+ 1 14
+
+ 1 18
+ 1 19
+ 1 16
+ 1 17
+
+ 1 20
+ 1 21
+ 1 22
+ 1 23
+
+ 1 27
+ 1 24
+ 1 25
+ 1 26
+
+ 1 31
+ 1 28
+ 1 29
+ 1 30
+
+ 2 8
+ 2 9
+ 2 10
+ 2 11
+
+ 3 15
+ 3 12
+ 3 13
+ 3 14
+
+ 4 27
+ 4 24
+ 4 25
+ 4 26
+
+ 5 16
+ 5 17
+ 5 18
+ 5 19
+
+ 6 20
+ 6 21
+ 6 22
+ 6 23
+
+ 7 31
+ 7 28
+ 7 29
+ 7 30
+
+ 1 2
+ 1 3
+ 1 4
+ 1 5
+ 1 6
+ 1 7
diff --git a/3dObjects/cube-solid.wmc b/3dObjects/cube-solid.wmc
new file mode 100644
index 0000000..31d6a7b
--- /dev/null
+++ b/3dObjects/cube-solid.wmc
@@ -0,0 +1,27 @@
+WMCUBE_COORDINATES
+1 -180 -180 180
+2 180 -180 180
+3 180 180 180
+4 -180 180 180
+5 -180 -180 -180
+6 180 -180 -180
+7 180 180 -180
+8 -180 180 -180
+
+WMCUBE_PLANES
+1 2 3
+1 3 4
+2 6 7
+2 7 3
+5 1 4
+5 4 8
+5 2 1
+5 6 2
+4 3 8
+3 7 8
+6 5 8
+6 8 7
+
+
+
+
diff --git a/3dObjects/cube.wmc b/3dObjects/cube.wmc
new file mode 100644
index 0000000..a55e975
--- /dev/null
+++ b/3dObjects/cube.wmc
@@ -0,0 +1,24 @@
+WMCUBE_COORDINATES
+1 -180 -180 180
+2 180 -180 180
+3 180 180 180
+4 -180 180 180
+5 -180 -180 -180
+6 180 -180 -180
+7 180 180 -180
+8 -180 180 -180
+
+WMCUBE_LINES
+1 2
+2 3
+3 4
+4 1
+5 6
+6 7
+7 8
+8 5
+1 5
+2 6
+3 7
+4 8
+
diff --git a/3dObjects/diamond.wmc b/3dObjects/diamond.wmc
new file mode 100644
index 0000000..06347f8
--- /dev/null
+++ b/3dObjects/diamond.wmc
@@ -0,0 +1,66 @@
+WMCUBE_COORDINATES
+
+1 -50 0 0
+2 -35 0 35
+3 0 0 50
+4 35 0 35
+5 50 0 0
+6 35 0 -35
+7 0 0 -50
+8 -35 0 -35
+
+9 -32 10 13
+10 -13 10 32
+11 13 10 32
+12 32 10 13
+13 32 10 -13
+14 13 10 -32
+15 -13 10 -32
+16 -32 10 -13
+
+17 0 -60 0
+WMCUBE_LINES
+
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 1
+
+9 10
+10 11
+11 12
+12 13
+13 14
+14 15
+15 16
+16 9
+
+1 9
+1 8
+2 10
+2 9
+3 11
+3 10
+4 12
+4 11
+5 13
+5 12
+6 14
+6 13
+7 15
+7 14
+8 16
+8 15
+
+17 1
+17 2
+17 3
+17 4
+17 5
+17 6
+17 7
+17 8
diff --git a/3dObjects/dice-solid.wmc b/3dObjects/dice-solid.wmc
new file mode 100644
index 0000000..cd561df
--- /dev/null
+++ b/3dObjects/dice-solid.wmc
@@ -0,0 +1,81 @@
+WMCUBE_COORDINATES
+1 -70 -120 120
+2 70 -120 120
+3 120 -70 120
+4 120 70 120
+5 70 120 120
+6 -70 120 120
+7 -120 70 120
+8 -120 -70 120
+9 -70 -120 -120
+10 70 -120 -120
+11 120 -70 -120
+12 120 70 -120
+13 70 120 -120
+14 -70 120 -120
+15 -120 70 -120
+16 -120 -70 -120
+
+17 -120 -120 70
+18 120 -120 70
+19 120 120 70
+20 -120 120 70
+
+21 -120 -120 -70
+22 120 -120 -70
+23 120 120 -70
+24 -120 120 -70
+
+WMCUBE_PLANES
+
+17 1 8
+2 18 3
+7 6 20
+5 4 19
+
+21 16 9
+10 11 22
+12 13 23
+15 24 14
+
+1 2 3
+1 3 4
+1 4 5
+1 5 6
+1 6 7
+1 7 8
+
+18 22 11
+18 11 12
+18 12 23
+18 23 19
+18 19 4
+18 4 3
+
+21 17 8
+21 8 7
+21 7 20
+21 20 24
+21 24 15
+21 15 16
+
+9 10 22
+9 22 18
+9 18 2
+9 2 1
+9 1 17
+9 17 21
+
+6 5 19
+6 19 23
+6 23 13
+6 13 14
+6 14 24
+6 24 20
+
+9 11 10
+9 12 11
+9 13 12
+9 14 13
+9 15 14
+9 16 15
diff --git a/3dObjects/e.wmc b/3dObjects/e.wmc
new file mode 100644
index 0000000..7c78070
--- /dev/null
+++ b/3dObjects/e.wmc
@@ -0,0 +1,69 @@
+WMCUBE_COORDINATES
+1 -60 -120 30
+2 80 -120 30
+3 80 -60 30
+4 0 -60 30
+5 0 -20 30
+6 40 -20 30
+7 40 20 30
+8 0 20 30
+9 0 60 30
+10 80 60 30
+11 80 120 30
+12 -60 120 30
+13 -60 -120 -30
+14 80 -120 -30
+15 80 -60 -30
+16 0 -60 -30
+17 0 -20 -30
+18 40 -20 -30
+19 40 20 -30
+20 0 20 -30
+21 0 60 -30
+22 80 60 -30
+23 80 120 -30
+24 -60 120 -30
+
+
+WMCUBE_LINES
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+10 11
+11 12
+ 1 12
+13 14
+14 15
+15 16
+16 17
+17 18
+18 19
+19 20
+20 21
+21 22
+22 23
+23 24
+13 24
+
+1 13
+2 14
+3 15
+4 16
+5 17
+6 18
+7 19
+8 20
+9 21
+10 22
+11 23
+12 24
+
+
+
+
diff --git a/3dObjects/e2.wmc b/3dObjects/e2.wmc
new file mode 100644
index 0000000..cd80bd6
--- /dev/null
+++ b/3dObjects/e2.wmc
@@ -0,0 +1,160 @@
+WMCUBE_COORDINATES
+1 -60 -120 30
+2 80 -120 30
+3 80 -60 30
+4 0 -60 30
+5 0 -20 30
+6 40 -20 30
+7 40 20 30
+8 0 20 30
+9 0 60 30
+10 80 60 30
+11 80 120 30
+12 -60 120 30
+13 -60 -120 -30
+14 80 -120 -30
+15 80 -60 -30
+16 0 -60 -30
+17 0 -20 -30
+18 40 -20 -30
+19 40 20 -30
+20 0 20 -30
+21 0 60 -30
+22 80 60 -30
+23 80 120 -30
+24 -60 120 -30
+
+25 -60 -10 0
+26 -60 -40 0
+27 -80 -10 0
+28 -80 -40 0
+29 -80 -10 -15
+30 -80 -40 -15
+31 -80 -20 -20
+32 -80 -30 -20
+33 -80 -20 -30
+34 -80 -30 -30
+
+35 -60 -60 0
+36 -60 -90 0
+37 -80 -60 0
+38 -80 -90 0
+39 -80 -60 -15
+40 -80 -90 -15
+41 -80 -70 -20
+42 -80 -80 -20
+43 -80 -70 -30
+44 -80 -80 -30
+
+45 -60 10 0
+46 -60 40 0
+47 -80 10 0
+48 -80 40 0
+49 -80 10 -15
+50 -80 40 -15
+51 -80 20 -20
+52 -80 30 -20
+53 -80 20 -30
+54 -80 30 -30
+
+55 -60 60 0
+56 -60 90 0
+57 -80 60 0
+58 -80 90 0
+59 -80 60 -15
+60 -80 90 -15
+61 -80 70 -20
+62 -80 80 -20
+63 -80 70 -30
+64 -80 80 -30
+WMCUBE_LINES
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+10 11
+11 12
+ 1 12
+13 14
+14 15
+15 16
+16 17
+17 18
+18 19
+19 20
+20 21
+21 22
+22 23
+23 24
+13 24
+1 13
+2 14
+3 15
+4 16
+5 17
+6 18
+7 19
+8 20
+9 21
+10 22
+11 23
+12 24
+
+25 26
+27 28
+25 27
+26 28
+27 29
+28 30
+29 31
+30 32
+31 33
+32 34
+33 34
+
+
+35 36
+37 38
+35 37
+36 38
+37 39
+38 40
+39 41
+40 42
+41 43
+42 44
+43 44
+
+45 46
+47 48
+45 47
+46 48
+47 49
+48 50
+49 51
+50 52
+51 53
+52 54
+53 54
+
+55 56
+57 58
+55 57
+56 58
+57 59
+58 60
+59 61
+60 62
+61 63
+62 64
+63 64
+
+
+
+
+
diff --git a/3dObjects/foo.wmc b/3dObjects/foo.wmc
new file mode 100644
index 0000000..04add8f
--- /dev/null
+++ b/3dObjects/foo.wmc
@@ -0,0 +1,149 @@
+WMCUBE_COORDINATES
+ 1 -190 110 50
+ 2 -190 -90 50
+ 3 -160 -90 50
+ 4 -160 20 50
+ 5 -90 20 50
+ 6 -90 50 50
+ 7 -160 50 50
+ 8 -160 80 50
+ 9 -90 80 50
+ 10 -90 110 50
+
+ 11 -190 110 0
+ 12 -190 -90 0
+ 13 -160 -90 0
+ 14 -160 20 0
+ 15 -90 20 0
+ 16 -90 50 0
+ 17 -160 50 0
+ 18 -160 80 0
+ 19 -90 80 0
+ 20 -90 110 0
+
+
+ 21 -50 110 50
+ 22 60 110 50
+ 23 60 -90 50
+ 24 -50 -90 50
+ 25 -20 -50 50
+ 26 40 -50 50
+ 27 40 70 50
+ 28 -20 70 50
+
+ 29 -50 110 0
+ 30 60 110 0
+ 31 60 -90 0
+ 32 -50 -90 0
+ 33 -20 -50 0
+ 34 20 -50 0
+ 35 20 70 0
+ 36 -20 70 0
+
+
+ 37 110 110 50
+ 38 210 110 50
+ 39 210 -90 50
+ 40 110 -90 50
+ 41 130 -50 50
+ 42 190 -50 50
+ 43 190 70 50
+ 44 130 70 50
+
+ 45 110 110 0
+ 46 210 110 0
+ 47 210 -90 0
+ 48 110 -90 0
+ 49 130 -50 0
+ 50 190 -50 0
+ 51 190 70 0
+ 52 130 70 0
+
+
+ WMCUBE_LINES
+ 1 2
+ 2 3
+ 3 4
+ 4 5
+ 5 6
+ 6 7
+ 7 8
+ 8 9
+ 9 10
+ 10 1
+
+ 11 12
+ 12 13
+ 13 14
+ 14 15
+ 15 16
+ 16 17
+ 17 18
+ 18 19
+ 19 20
+ 20 11
+
+ 1 11
+ 2 12
+ 3 13
+ 4 14
+ 5 15
+ 6 16
+ 7 17
+ 8 18
+ 9 19
+ 10 20
+
+ 21 22
+ 22 23
+ 23 24
+ 24 21
+ 25 26
+ 26 27
+ 27 28
+ 28 25
+
+ 29 30
+ 30 31
+ 31 32
+ 32 29
+ 33 34
+ 34 35
+ 35 36
+ 36 33
+
+ 21 29
+ 22 30
+ 23 31
+ 24 32
+ 25 33
+ 26 34
+ 27 35
+ 28 36
+
+ 37 38
+ 38 39
+ 39 40
+ 40 37
+ 41 42
+ 42 43
+ 43 44
+ 44 41
+
+ 45 46
+ 46 47
+ 47 48
+ 48 45
+ 49 50
+ 50 51
+ 51 52
+ 52 49
+
+ 37 45
+ 38 46
+ 39 47
+ 40 48
+ 41 49
+ 42 50
+ 43 51
+ 44 52
diff --git a/3dObjects/gnustep.wmc b/3dObjects/gnustep.wmc
new file mode 100644
index 0000000..5884a86
--- /dev/null
+++ b/3dObjects/gnustep.wmc
@@ -0,0 +1,110 @@
+WMCUBE_COORDINATES
+
+1 50 0 -10
+2 46 19 -10
+3 35 35 -10
+4 19 46 -10
+5 0 50 -10
+6 -19 46 -10
+7 -35 35 -10
+8 -46 19 -10
+9 -50 0 -10
+10 -46 -19 -10
+11 -35 -35 -10
+12 -19 -46 -10
+13 0 -50 -10
+14 19 -46 -10
+15 35 -35 -10
+16 46 -19 -10
+17 -25 35 -10
+18 -25 0 -10
+19 25 0 -10
+20 25 -35 -10
+
+21 50 0 10
+22 46 19 10
+23 35 35 10
+24 19 46 10
+25 0 50 10
+26 -19 46 10
+27 -35 35 10
+28 -46 19 10
+29 -50 0 10
+30 -46 -19 10
+31 -35 -35 10
+32 -19 -46 10
+33 0 -50 10
+34 19 -46 10
+35 35 -35 10
+36 46 -19 10
+37 -25 35 10
+38 -25 0 10
+39 25 0 10
+40 25 -35 10
+WMCUBE_LINES
+
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+10 11
+11 12
+12 13
+13 14
+14 15
+15 16
+16 1
+7 17
+17 18
+18 19
+19 20
+20 15
+
+21 22
+22 23
+23 24
+24 25
+25 26
+26 27
+27 28
+28 29
+29 30
+30 31
+31 32
+32 33
+33 34
+34 35
+35 36
+36 21
+27 37
+37 38
+38 39
+39 40
+40 35
+
+17 37
+18 38
+19 39
+20 40
+
+1 21
+2 22
+3 23
+4 24
+5 25
+6 26
+7 27
+8 28
+9 29
+10 30
+11 31
+12 32
+13 33
+14 34
+15 35
+16 36
diff --git a/3dObjects/hyperpyramid.wmc b/3dObjects/hyperpyramid.wmc
new file mode 100644
index 0000000..588d802
--- /dev/null
+++ b/3dObjects/hyperpyramid.wmc
@@ -0,0 +1,54 @@
+WMCUBE_COORDINATES
+1 300 0 0
+2 -150 260 0
+3 -150 -260 0
+4 50 87 0
+5 -100 0 0
+6 50 -87 0
+7 0 0 90
+8 50 87 -250
+9 -100 0 -250
+10 50 -87 -250
+11 0 0 -90
+12 100 0 -50
+13 -87 100 -50
+14 -87 -100 -50
+
+WMCUBE_LINES
+1 4
+4 2
+2 5
+5 3
+3 6
+6 1
+1 7
+2 7
+3 7
+4 7
+5 7
+6 7
+4 8
+5 9
+6 10
+8 11
+9 11
+10 11
+1 12
+8 12
+10 12
+4 12
+6 12
+11 12
+4 13
+2 13
+5 13
+8 13
+9 13
+11 13
+5 14
+3 14
+6 14
+11 14
+9 14
+10 14
+
diff --git a/3dObjects/jeep.wmc b/3dObjects/jeep.wmc
new file mode 100644
index 0000000..5fb8f1d
--- /dev/null
+++ b/3dObjects/jeep.wmc
@@ -0,0 +1,157 @@
+WMCUBE_COORDINATES
+ 1 -150 -20 0
+ 2 -150 50 0
+ 3 -40 50 0
+ 4 -40 20 0
+ 5 30 20 0
+ 6 30 60 0
+ 7 20 130 0
+ 8 30 50 0
+ 9 160 50 0
+ 10 160 -20 0
+ 11 140 -20 0
+ 12 130 0 0
+ 13 90 0 0
+ 14 80 -20 0
+ 15 80 -40 0
+ 16 100 -60 0
+ 17 110 -60 0
+ 18 140 -40 0
+ 19 -70 -20 0
+ 20 -70 -40 0
+ 21 -90 -60 0
+ 22 -110 -60 0
+ 23 -130 -40 0
+ 24 -130 -20 0
+ 25 -120 0 0
+ 26 -80 0 0
+ 27 -150 50 0
+ 28 -80 120 0
+ 29 -80 50 0
+ 30 90 40 0
+ 31 170 40 0
+ 32 180 30 0
+ 33 180 10 0
+ 34 160 10 0
+ 35 80 -10 0
+ 36 -80 -10 0
+
+ 37 -150 -20 100
+ 38 -150 50 100
+ 39 -40 50 100
+ 40 -40 20 100
+ 41 30 20 100
+ 42 30 60 100
+ 43 20 130 100
+ 44 30 50 100
+ 45 160 50 100
+ 46 160 -20 100
+ 47 140 -20 100
+ 48 130 0 100
+ 49 90 0 100
+ 50 80 -20 100
+ 51 80 -40 100
+ 52 100 -60 100
+ 53 110 -60 100
+ 54 140 -40 100
+ 55 -70 -20 100
+ 56 -70 -40 100
+ 57 -90 -60 100
+ 58 -110 -60 100
+ 59 -130 -40 100
+ 60 -130 -20 100
+ 61 -120 0 100
+ 62 -80 0 100
+ 63 -150 50 100
+ 64 -80 120 100
+ 65 -80 50 100
+ 66 90 40 100
+ 67 170 40 100
+ 68 180 30 100
+ 69 180 10 100
+ 70 160 10 100
+ 71 80 -10 100
+ 72 -80 -10 100
+
+ WMCUBE_LINES
+ 1 2
+ 2 3
+ 3 4
+ 4 5
+ 5 6
+ 6 7
+ 8 9
+ 9 10
+ 10 11
+ 11 12
+ 12 13
+ 13 14
+ 14 15
+ 15 16
+ 16 17
+ 17 18
+ 35 36
+ 19 20
+ 20 21
+ 21 22
+ 22 23
+ 23 24
+ 24 1
+ 24 25
+ 25 26
+ 27 28
+ 28 29
+ 30 31
+ 31 32
+ 32 33
+ 33 34
+ 18 11
+
+ 37 38
+ 38 39
+ 39 40
+ 40 41
+ 41 42
+ 42 43
+ 44 45
+ 45 46
+ 46 47
+ 47 48
+ 48 49
+ 49 50
+ 50 51
+ 51 52
+ 52 53
+ 53 54
+ 71 72
+ 55 56
+ 56 57
+ 57 58
+ 58 59
+ 59 60
+ 60 37
+ 60 61
+ 61 62
+ 63 64
+ 64 65
+ 66 67
+ 67 68
+ 68 69
+ 69 70
+ 54 47
+
+ 1 37
+ 2 38
+ 3 39
+ 4 40
+ 5 41
+ 6 42
+ 7 43
+ 8 44
+ 9 45
+ 10 46
+ 11 47
+ 35 71
+ 36 72
+ 24 60
+ 28 64
diff --git a/3dObjects/multicube.wmc b/3dObjects/multicube.wmc
new file mode 100644
index 0000000..ba05439
--- /dev/null
+++ b/3dObjects/multicube.wmc
@@ -0,0 +1,83 @@
+WMCUBE_COORDINATES
+1 -40 40 40
+2 -40 -40 40
+3 40 -40 40
+4 40 40 40
+5 -60 20 20
+6 -60 -20 20
+7 60 -20 20
+8 60 20 20
+9 -20 60 20
+10 -20 -60 20
+11 20 -60 20
+12 20 60 20
+13 -40 40 -40
+14 -40 -40 -40
+15 40 -40 -40
+16 40 40 -40
+17 -60 20 -20
+18 -60 -20 -20
+19 60 -20 -20
+20 60 20 -20
+21 -20 60 -20
+22 -20 -60 -20
+23 20 -60 -20
+24 20 60 -20
+25 20 20 60
+26 -20 20 60
+27 20 -20 60
+28 -20 -20 60
+29 20 20 -60
+30 -20 20 -60
+31 20 -20 -60
+32 -20 -20 -60
+
+WMCUBE_LINES
+1 2
+2 3
+3 4
+4 1
+5 6
+6 7
+7 8
+8 5
+9 10
+10 11
+11 12
+12 9
+13 14
+14 15
+15 16
+16 13
+1 13
+2 14
+3 15
+4 16
+17 18
+18 19
+19 20
+20 17
+8 20
+5 17
+6 18
+7 19
+21 22
+22 23
+23 24
+24 21
+12 24
+23 11
+9 21
+10 22
+25 26
+26 28
+27 28
+27 25
+25 29
+26 30
+28 31
+27 32
+29 30
+30 32
+31 32
+31 29
diff --git a/3dObjects/peace.wmc b/3dObjects/peace.wmc
new file mode 100644
index 0000000..22b57cb
--- /dev/null
+++ b/3dObjects/peace.wmc
@@ -0,0 +1,155 @@
+WMCUBE_COORDINATES
+1 0 -120 10
+2 -46 -111 10
+3 -85 -85 10
+4 -111 -46 10
+5 -120 0 10
+6 -111 46 10
+7 -85 85 10
+8 -46 111 10
+9 0 120 10
+10 46 111 10
+11 85 85 10
+12 111 46 10
+13 120 0 10
+14 111 -46 10
+15 85 -85 10
+16 46 -111 10
+17 63 -77 10
+18 38 -92 10
+19 0 -100 10
+20 -38 -92 10
+21 -63 -77 10
+22 -77 -63 10
+23 -92 -38 10
+24 -100 0 10
+25 -92 38 10
+26 -71 71 10
+27 -38 92 10
+28 -10 100 10
+29 10 100 10
+30 38 92 10
+31 71 71 10
+32 92 38 10
+33 100 0 10
+34 92 -38 10
+35 77 -63 10
+36 0 -14 10
+37 -10 4 10
+38 10 4 10
+39 0 -120 -10
+40 -46 -111 -10
+41 -85 -85 -10
+42 -111 -46 -10
+43 -120 0 -10
+44 -111 46 -10
+45 -85 85 -10
+46 -46 111 -10
+47 0 120 -10
+48 46 111 -10
+49 85 85 -10
+50 111 46 -10
+51 120 0 -10
+52 111 -46 -10
+53 85 -85 -10
+54 46 -111 -10
+55 63 -77 -10
+56 38 -92 -10
+57 0 -100 -10
+58 -38 -92 -10
+59 -63 -77 -10
+60 -77 -63 -10
+61 -92 -38 -10
+62 -100 0 -10
+63 -92 38 -10
+64 -71 71 -10
+65 -38 92 -10
+66 -10 100 -10
+67 10 100 -10
+68 38 92 -10
+69 71 71 -10
+70 92 38 -10
+71 100 0 -10
+72 92 -38 -10
+73 77 -63 -10
+74 0 -14 -10
+75 -10 4 -10
+76 10 4 -10
+
+WMCUBE_LINES
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+10 11
+11 12
+12 13
+13 14
+14 15
+15 16
+16 1
+36 17
+17 18
+18 19
+19 20
+20 21
+21 36
+22 23
+23 24
+24 25
+25 26
+26 27
+27 28
+28 37
+37 22
+38 29
+29 30
+30 31
+31 32
+32 33
+33 34
+34 35
+35 38
+39 40
+40 41
+41 42
+42 43
+43 44
+44 45
+45 46
+46 47
+47 48
+48 49
+49 50
+50 51
+51 52
+52 53
+53 54
+54 39
+76 67
+67 68
+68 69
+69 70
+70 71
+71 72
+72 73
+73 76
+74 55
+55 56
+56 57
+57 58
+58 59
+59 74
+75 60
+60 61
+61 62
+62 63
+63 64
+64 65
+65 66
+66 75
diff --git a/3dObjects/pyramid.wmc b/3dObjects/pyramid.wmc
new file mode 100644
index 0000000..99a618c
--- /dev/null
+++ b/3dObjects/pyramid.wmc
@@ -0,0 +1,16 @@
+WMCUBE_COORDINATES
+1 -150 -150 -150
+2 150 -150 -150
+3 150 150 -150
+4 -150 150 -150
+5 0 0 250
+WMCUBE_LINES
+1 2
+2 3
+3 4
+4 1
+1 5
+2 5
+3 5
+4 5
+
diff --git a/3dObjects/radioactive.wmc b/3dObjects/radioactive.wmc
new file mode 100644
index 0000000..675ee08
--- /dev/null
+++ b/3dObjects/radioactive.wmc
@@ -0,0 +1,185 @@
+WMCUBE_COORDINATES
+1 0 0 0
+2 5 -19 0
+3 -5 -19 0
+4 -14 -14 0
+5 -19 -5 0
+6 -19 5 0
+7 -14 14 0
+8 -5 19 0
+9 5 19 0
+10 14 14 0
+11 19 5 0
+12 19 -5 0
+13 14 -14 0
+14 -30 -17 0
+15 -34 -9 0
+16 -35 0 0
+17 -34 9 0
+18 -30 17 0
+19 0 35 0
+20 9 34 0
+21 17 30 0
+22 25 25 0
+23 30 17 0
+24 30 -17 0
+25 25 -25 0
+26 17 -30 0
+27 9 -34 0
+28 0 -35 0
+29 87 -50 0
+30 71 -71 0
+31 50 -87 0
+32 26 -97 0
+33 0 -100 0
+34 -87 -50 0
+35 -97 -26 0
+36 -100 0 0
+37 -97 26 0
+38 -87 50 0
+39 0 100 0
+40 26 97 0
+41 50 87 0
+42 71 71 0
+43 87 50 0
+
+44 5 -19 20
+45 -5 -19 20
+46 -14 -14 20
+47 -19 -5 20
+48 -19 5 20
+49 -14 14 20
+50 -5 19 20
+51 5 19 20
+52 14 14 20
+53 19 5 20
+54 19 -5 20
+55 14 -14 20
+56 -30 -17 20
+57 -34 -9 20
+58 -35 0 20
+59 -34 9 20
+60 -30 17 20
+61 0 35 20
+62 9 34 20
+63 17 30 20
+64 25 25 20
+65 30 17 20
+66 30 -17 20
+67 25 -25 20
+68 17 -30 20
+69 9 -34 20
+70 0 -35 20
+71 87 -50 20
+72 71 -71 20
+73 50 -87 20
+74 26 -97 20
+75 0 -100 20
+76 -87 -50 20
+77 -97 -26 20
+78 -100 0 20
+79 -97 26 20
+80 -87 50 20
+81 0 100 20
+82 26 97 20
+83 50 87 20
+84 71 71 20
+85 87 50 20
+
+WMCUBE_LINES
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+10 11
+11 12
+12 13
+13 2
+24 25
+25 26
+26 27
+27 28
+28 33
+33 32
+32 31
+31 30
+30 29
+29 24
+19 20
+20 21
+21 22
+22 23
+23 43
+43 42
+42 41
+41 40
+40 39
+39 19
+14 15
+15 16
+16 17
+17 18
+18 38
+38 37
+37 36
+36 35
+35 34
+34 14
+44 45
+45 46
+46 47
+47 48
+48 49
+49 50
+50 51
+51 52
+52 53
+53 54
+54 55
+55 44
+76 77
+77 78
+78 79
+79 80
+80 60
+56 76
+56 57
+57 58
+58 59
+59 60
+61 62
+62 63
+63 64
+64 65
+81 82
+82 83
+83 84
+84 85
+85 65
+61 81
+66 67
+67 68
+68 69
+69 70
+71 72
+72 73
+73 74
+74 75
+71 66
+75 70
+75 33
+71 29
+85 43
+81 39
+80 38
+76 34
+66 24
+28 70
+56 14
+60 18
+61 19
+65 23
diff --git a/3dObjects/shield.wmc b/3dObjects/shield.wmc
new file mode 100644
index 0000000..3451f45
--- /dev/null
+++ b/3dObjects/shield.wmc
@@ -0,0 +1,197 @@
+WMCUBE_COORDINATES
+1 -76 112 -10
+2 76 112 -10
+3 -10 99 -10
+4 10 99 -10
+5 10 75 -10
+6 33 75 -10
+7 33 55 -10
+8 10 55 -10
+9 -10 55 -10
+10 -33 55 -10
+11 -33 75 -10
+12 -10 75 -10
+13 -55 20 -10
+14 -10 20 -10
+15 10 20 -10
+16 55 20 -10
+17 55 0 -10
+18 10 0 -10
+19 -10 0 -10
+20 -55 0 -10
+21 -76 0 -10
+22 -72 -29 -10
+23 -59 -56 -10
+24 -34 -79 -10
+25 0 -89 -10
+26 35 -79 -10
+27 59 -56 -10
+28 72 -27 -10
+29 76 0 -10
+30 -53 -48 -10
+31 -45 -42 -10
+32 -36 -40 -10
+33 -26 -42 -10
+34 -19 -35 -10
+35 -10 -32 -10
+36 0 -30 -10
+37 10 -32 -10
+38 19 -35 -10
+39 26 -42 -10
+40 36 -40 -10
+41 45 -42 -10
+42 53 -48 -10
+43 -76 112 20
+44 76 112 20
+45 -10 99 20
+46 10 99 20
+47 10 75 20
+48 33 75 20
+49 33 55 20
+50 10 55 20
+51 -10 55 20
+52 -33 55 20
+53 -33 75 20
+54 10 75 20
+55 -55 20 20
+56 -10 20 20
+57 10 20 20
+58 55 20 20
+59 55 0 20
+60 10 0 20
+61 -10 0 20
+62 -55 0 20
+63 -76 0 20
+64 -72 -29 20
+65 -59 -56 20
+66 -34 -79 20
+67 0 -89 20
+68 35 -79 20
+69 59 -56 20
+70 72 -27 20
+71 76 0 20
+72 -53 -48 20
+73 -45 -42 20
+74 -36 -40 20
+75 -26 -42 20
+76 -19 -35 20
+77 -10 -32 20
+78 0 -30 20
+79 10 -32 20
+80 19 -35 20
+81 26 -42 20
+82 36 -40 20
+83 45 -42 20
+84 53 -48 20
+
+
+WMCUBE_LINES
+1 2
+2 29
+29 28
+28 27
+27 26
+26 25
+25 24
+24 23
+23 22
+22 21
+21 1
+3 4
+4 5
+5 6
+6 7
+7 8
+8 15
+15 16
+16 17
+17 18
+18 37
+35 19
+19 20
+20 13
+13 14
+14 9
+9 10
+10 11
+11 12
+12 3
+23 30
+30 31
+31 32
+32 33
+33 34
+34 35
+35 36
+36 37
+37 38
+38 39
+39 40
+40 41
+41 42
+42 27
+43 44
+44 71
+71 70
+70 69
+69 68
+68 67
+67 66
+66 65
+45 46
+46 47
+47 48
+48 49
+49 50
+50 57
+57 58
+58 59
+59 60
+60 79
+35 61
+61 62
+62 55
+55 56
+56 51
+51 52
+52 53
+53 54
+54 45
+65 72
+72 73
+73 74
+74 75
+75 76
+76 77
+77 78
+78 79
+79 80
+80 81
+81 82
+82 83
+83 84
+84 69
+43 63
+63 64
+64 65
+1 43
+2 44
+3 45
+4 46
+5 47
+6 48
+7 49
+8 50
+15 57
+16 58
+17 59
+18 60
+19 61
+20 62
+13 55
+14 56
+9 51
+10 52
+11 53
+12 54
+67 25
diff --git a/3dObjects/spaceshuttle.wmc b/3dObjects/spaceshuttle.wmc
new file mode 100644
index 0000000..d7b1d1d
--- /dev/null
+++ b/3dObjects/spaceshuttle.wmc
@@ -0,0 +1,382 @@
+WMCUBE_COORDINATES
+1 -44 0 14
+2 55 0 15
+3 60 0 10
+4 83 0 0
+5 86 0 -3
+6 85 0 -6
+7 77 0 -10
+8 45 0 -12
+9 -44 0 14
+10 -45 0 19
+11 -45 0 19
+12 -82 0 52
+13 -92 0 52
+14 -94 0 51
+15 -80 0 22
+16 -70 0 18
+17 -68 -16 -13
+18 -61 -58 -9
+19 -54 -58 -9
+20 -42 -56 -10
+21 -13 -26 -12
+22 47 -13 -10
+23 -68 16 -13
+24 -61 58 -9
+25 -54 58 -9
+26 -42 55 -10
+27 -13 27 -12
+28 47 13 -10
+29 45 -13 -14
+30 45 -13 9
+31 45 -9 13
+32 45 -4 15
+33 45 4 15
+34 45 9 13
+35 45 13 9
+36 45 13 -14
+37 -45 -13 -14
+38 -45 -13 9
+39 -45 -9 13
+40 -45 -4 15
+41 -45 4 15
+42 -45 9 13
+43 -45 13 9
+44 -45 13 -14
+45 45 13 -4
+46 48 13 -4
+47 78 7 -4
+48 85 3 -4
+49 86 0 -4
+50 45 -13 -4
+51 48 -13 -4
+52 78 -7 -4
+53 85 -3 -4
+54 86 0 -4
+55 45 13 -12
+56 -42 13 -15
+57 -72 13 -14
+58 45 -13 -12
+59 -42 -13 -15
+60 -72 -13 -14
+61 45 13 -12
+62 45 -13 -12
+63 -72 13 -14
+64 -72 -13 -14
+65 -72 14 -14
+66 -84 14 -13
+67 -72 14 -12
+68 -72 -14 -14
+69 -84 -14 -13
+70 -72 -14 -12
+71 -84 14 -13
+72 -84 -14 -13
+73 -72 16 -12
+74 -70 14 4
+75 -69 2 16
+76 -69 -2 16
+77 -70 -15 4
+78 -72 -16 -12
+79 -56 57 -9
+80 -56 16 -13
+81 -56 -57 -9
+82 -56 -16 -13
+83 -93 0 48
+84 -87 0 48
+85 -70 0 23
+86 -80 0 23
+87 -69 15 4
+88 -69 18 12
+89 -69 10 20
+90 -69 2 16
+91 -69 -15 4
+92 -69 -19 12
+93 -69 -11 20
+94 -69 -2 16
+95 -69 15 4
+96 -44 13 5
+97 -69 2 16
+98 -44 2 14
+99 -69 18 12
+100 -52 18 13
+101 -69 10 20
+102 -52 10 21
+103 -52 18 13
+104 -52 -10 21
+105 -52 18 13
+106 -44 13 5
+107 -52 10 21
+108 -44 2 14
+109 -69 -15 4
+110 -44 -13 5
+111 -69 -2 16
+112 -44 -2 14
+113 -69 -19 12
+114 -52 -19 13
+115 -69 -11 20
+116 -52 -10 21
+117 -52 -19 13
+118 -52 -10 21
+119 -52 -19 13
+120 -44 -13 5
+121 -52 -10 21
+122 -44 -2 14
+123 -80 0 16
+124 -81 3 14
+125 -82 3 8
+126 -83 0 6
+127 -82 -3 8
+128 -81 -3 14
+129 -80 0 16
+130 -80 0 16
+131 -69 0 12
+132 -83 0 6
+133 -70 0 4
+134 -82 3 11
+135 -69 2 8
+136 -82 -3 11
+137 -69 -2 -8
+138 -69 0 12
+139 -69 2 8
+140 -70 0 4
+141 -69 -2 8
+142 -69 0 12
+143 -83 8 2
+144 -84 13 -1
+145 -85 13 -6
+146 -85 8 -9
+147 -85 3 -6
+148 -84 3 -1
+149 -83 8 2
+150 -83 8 2
+151 -72 7 -2
+152 -85 8 -9
+153 -73 7 -9
+154 -84 13 -3
+155 -73 10 -5
+156 -84 3 -3
+157 -73 4 -5
+158 -72 7 -2
+159 -73 10 -5
+160 -73 7 -9
+161 -73 4 -5
+162 -72 7 -2
+163 -83 -8 2
+164 -84 -13 -1
+165 -85 -13 -6
+166 -85 -8 -9
+167 -85 -4 -6
+168 -84 -4 -1
+169 -83 -8 2
+170 -83 -8 2
+171 -72 -7 -2
+172 -85 -8 -9
+173 -73 -7 -9
+174 -84 -13 -3
+175 -73 -10 -5
+176 -84 -4 -3
+177 -73 -4 -5
+178 -72 -7 -2
+179 -73 -10 -5
+180 -73 -7 -9
+181 -73 -4 -5
+182 -72 -7 -2
+183 61 2 10
+184 60 5 10
+185 57 5 13
+186 58 3 13
+187 61 2 10
+188 61 -2 10
+189 60 -5 10
+190 57 -5 13
+191 58 -3 13
+192 61 -2 10
+193 60 5 10
+194 57 9 8
+195 55 7 12
+196 57 5 13
+197 60 -5 10
+198 57 -9 8
+199 55 -7 12
+200 57 -5 13
+201 57 9 8
+202 53 10 9
+203 53 7 12
+204 55 7 12
+205 57 -9 8
+206 53 -10 9
+207 53 -7 12
+208 55 -7 12
+209 45 13 5
+210 -45 13 4
+211 45 -13 5
+212 -45 -13 4
+213 45 13 -12
+214 48 13 -12
+215 78 6 -9
+216 85 3 -5
+217 86 0 -4
+218 45 -13 -12
+219 48 -13 -12
+220 78 -7 -9
+221 85 -3 -5
+222 86 0 -4
+223 0 0 0
+WMCUBE_LINES
+2 1
+3 2
+4 3
+5 4
+6 5
+7 6
+8 7
+10 9
+12 11
+13 12
+14 13
+15 14
+16 15
+18 17
+19 18
+20 19
+21 20
+22 21
+24 23
+25 24
+26 25
+27 26
+28 27
+30 29
+31 30
+32 31
+33 32
+34 33
+35 34
+36 35
+38 37
+39 38
+40 39
+41 40
+42 41
+43 42
+44 43
+46 45
+47 46
+48 47
+49 48
+51 50
+52 51
+53 52
+54 53
+56 55
+57 56
+59 58
+60 59
+62 61
+64 63
+66 65
+67 66
+69 68
+70 69
+72 71
+74 73
+75 74
+76 75
+77 76
+78 77
+80 79
+82 81
+84 83
+85 84
+86 85
+88 87
+89 88
+90 89
+92 91
+93 92
+94 93
+96 95
+98 97
+100 99
+102 101
+104 103
+106 105
+108 107
+110 109
+112 111
+114 113
+116 115
+118 117
+120 119
+122 121
+124 123
+125 124
+126 125
+127 126
+128 127
+129 128
+131 130
+133 132
+135 134
+137 136
+139 138
+140 139
+141 140
+142 141
+144 143
+145 144
+146 145
+147 146
+148 147
+149 148
+151 150
+153 152
+155 154
+157 156
+159 158
+160 159
+161 160
+162 161
+164 163
+165 164
+166 165
+167 166
+168 167
+169 168
+171 170
+173 172
+175 174
+177 176
+179 178
+180 179
+181 180
+182 181
+184 183
+185 184
+186 185
+187 186
+189 188
+190 189
+191 190
+192 191
+194 193
+195 194
+196 195
+198 197
+199 198
+200 199
+202 201
+203 202
+204 203
+206 205
+207 206
+208 207
+210 209
+212 211
+214 213
+215 214
+216 215
+217 216
+219 218
+220 219
+221 220
\ No newline at end of file
diff --git a/3dObjects/spiral.wmc b/3dObjects/spiral.wmc
new file mode 100644
index 0000000..0af2d4f
--- /dev/null
+++ b/3dObjects/spiral.wmc
@@ -0,0 +1,49 @@
+WMCUBE_COORDINATES
+
+1 80 0 0
+2 0 -90 25
+3 -100 0 50
+4 0 110 75
+5 120 0 100
+6 0 -130 125
+7 -140 0 150
+8 0 150 175
+9 160 0 200
+10 0 70 -25
+11 -60 0 -50
+12 0 -50 -75
+13 40 0 -100
+14 0 30 -125
+15 -20 0 -150
+16 0 -10 -175
+17 0 0 -200
+18 0 -160 200
+19 -160 0 200
+20 0 160 200
+
+WMCUBE_LINES
+
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+1 10
+10 11
+11 12
+12 13
+13 14
+14 15
+15 16
+16 17
+17 9
+17 18
+17 19
+17 20
+9 18
+18 19
+19 20
+20 9
diff --git a/3dObjects/star.wmc b/3dObjects/star.wmc
new file mode 100644
index 0000000..1fd0b24
--- /dev/null
+++ b/3dObjects/star.wmc
@@ -0,0 +1,95 @@
+WMCUBE_COORDINATES
+1 -90 -90 90
+2 90 -90 90
+3 90 90 90
+4 -90 90 90
+5 -90 -90 -90
+6 90 -90 -90
+7 90 90 -90
+8 -90 90 -90
+9 -10 -350 -10
+10 10 -350 -10
+11 350 -10 -10
+12 350 10 -10
+13 10 350 -10
+14 -10 350 -10
+15 -350 10 -10
+16 -350 -10 -10
+17 -350 -10 10
+18 -10 -350 10
+19 10 -350 10
+20 350 -10 10
+21 350 10 10
+22 10 350 10
+23 -10 350 10
+24 -350 10 10
+25 -10 -10 350
+26 10 -10 350
+27 10 10 350
+28 -10 10 350
+29 -10 -10 -350
+30 10 -10 -350
+31 10 10 -350
+32 -10 10 -350
+
+WMCUBE_LINES
+1 5
+2 6
+7 3
+8 4
+9 10
+10 6
+6 11
+11 12
+12 7
+7 13
+13 14
+14 8
+8 15
+15 16
+16 5
+5 9
+17 1
+1 18
+18 19
+19 2
+2 20
+20 21
+21 3
+3 22
+22 23
+23 4
+4 24
+24 17
+9 18
+10 19
+11 20
+12 21
+13 22
+14 23
+15 24
+16 17
+25 26
+26 27
+27 28
+28 25
+25 1
+26 2
+27 3
+28 4
+5 6
+6 7
+7 8
+8 5
+29 30
+30 31
+31 32
+32 29
+5 29
+6 30
+7 31
+8 32
+1 2
+2 3
+3 4
+4 1
diff --git a/3dObjects/starcube.wmc b/3dObjects/starcube.wmc
new file mode 100644
index 0000000..a7bc2df
--- /dev/null
+++ b/3dObjects/starcube.wmc
@@ -0,0 +1,69 @@
+WMCUBE_COORDINATES
+ 1 -100 -100 100
+ 2 100 -100 100
+ 3 100 100 100
+ 4 -100 100 100
+ 5 -100 -100 -100
+ 6 100 -100 -100
+ 7 100 100 -100
+ 8 -100 100 -100
+
+ 9 75 0 0
+ 10 0 75 0
+ 11 0 0 75
+ 12 -75 0 0
+ 13 0 -75 0
+ 14 0 0 -75
+
+ 15 -75 -75 75
+ 16 75 -75 75
+ 17 75 75 75
+ 18 -75 75 75
+ 19 -75 -75 -75
+ 20 75 -75 -75
+ 21 75 75 -75
+ 22 -75 75 -75
+
+ WMCUBE_LINES
+ 1 2
+ 2 3
+ 3 4
+ 4 1
+ 5 6
+ 6 7
+ 7 8
+ 8 5
+ 1 5
+ 2 6
+ 3 7
+ 4 8
+
+ 9 15
+ 9 18
+ 9 19
+ 9 22
+
+ 10 15
+ 10 16
+ 10 19
+ 10 20
+
+ 11 19
+ 11 20
+ 11 21
+ 11 22
+
+ 12 16
+ 12 17
+ 12 20
+ 12 21
+
+ 13 17
+ 13 18
+ 13 21
+ 13 22
+
+ 14 15
+ 14 16
+ 14 17
+ 14 18
diff --git a/3dObjects/wmlogo.wmc b/3dObjects/wmlogo.wmc
new file mode 100644
index 0000000..8051cee
--- /dev/null
+++ b/3dObjects/wmlogo.wmc
@@ -0,0 +1,59 @@
+WMCUBE_COORDINATES
+ 1 30 -30 10
+ 2 -30 -30 10
+ 3 -30 20 10
+ 4 -10 20 10
+ 5 -10 0 10
+ 6 10 0 10
+ 7 10 -20 10
+ 8 30 -20 10
+ 9 30 -30 -10
+ 10 -30 -30 -10
+ 11 -30 20 -10
+ 12 -10 20 -10
+ 13 -10 0 -10
+ 14 10 0 -10
+ 15 10 -20 -10
+ 16 30 -20 -10
+ 17 30 0 0
+ 18 26 -15 0
+ 19 15 -26 0
+ 20 0 -30 0
+ 21 -15 -26 0
+ 22 -26 -15 0
+ 23 -30 0 0
+ 24 -26 15 0
+ 25 -15 26 0
+ 26 0 30 0
+ 27 15 26 0
+ 28 26 15 0
+
+ WMCUBE_LINES
+ 1 2
+ 2 3
+ 3 4
+ 4 5
+ 5 6
+ 6 7
+ 7 8
+ 8 1
+ 9 10
+ 10 11
+ 11 12
+ 12 13
+ 13 14
+ 14 15
+ 15 16
+ 16 9
+ 17 18
+ 18 19
+ 19 20
+ 20 21
+ 21 22
+ 22 23
+ 23 24
+ 24 25
+ 25 26
+ 26 27
+ 27 28
+ 28 17
diff --git a/CHANGES b/CHANGES
new file mode 100644
index 0000000..5b38c4e
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,34 @@
+wmcube 0.98:
+ * Added solid flat-shading to 3d-engine
+ * New tag in object-files (WMCUBE_PLANES) for solid objects
+
+wmCube 0.97:
+ * NetBSD support
+ * New improved automatic scaling of objects
+ * Click cpu-load to hide/reveal usage
+ * More bundled objects
+ * Bugfixes in object-loading
+ * Bugfixes in intro-sequence
+ * Bugfixes in Linux SMP
+ * Removed scanning directory for objects in Solaris (doesnt work)
+
+wmCube 0.96:
+ * Solaris (Sparc/x86) support
+ * OpenBSD support
+ * FreeBSD support
+ * More bundled objects
+ * Possibility to change object at run-time by clicking the app
+ (Scans the specified directory for objects)
+
+wmCube 0.95:
+ * You can now design and use other objects than the default cube
+ * SMP-support: Commandline option to choose which cpu to monitor
+ * Commandline option to leave out "nice" processes when calculating
+ cpu-load (Thanks Thorsten Jens)
+ * Commandline option to invert the relationship between rotation-
+ speed and cpu-load
+ * Commandline option not to display cpu-load
+ * Improvements in the cpu-load calculation (Thanks Jakob Borg)
+
+wmCube 0.90:
+ * Initial release
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..a43ea21
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..8cae7e6
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,37 @@
+Requirements
+--------------------------------------------------------------
+
+- Linux (glibc 2.1) (Tested on various distributions)
+ or Solaris 8 Sparc/x86 (should work on Solaris 2.x and 7)
+ or OpenBSD
+ or FreeBSD 3-stable, 4-stable
+ or NetBSD
+
+- root access
+
+ To be able to install the application system-wide
+ you need root access.
+
+Installation
+--------------------------------------------------------------
+1) % tar -zxvf wmcube-0.98.tar.gz
+
+2) % cd wmcube/wmcube
+
+3) % make (if you are running Linux) or
+ % make -f Makefile.xxx (where xxx is the OS you running)
+
+Optional
+
+4) % su root
+
+5) % make install
+
+6) % wmcube & (or wmcube -h for command line options).
+
+General Notes
+--------------------------------------------------------------
+Note 1: If "make install" fails on your system, please edit
+ the Makefile to set the paths according to your setup.
+ "make install" defaults to /usr/local/bin, $HOME & /etc.
+
diff --git a/README b/README
new file mode 100644
index 0000000..9275d45
--- /dev/null
+++ b/README
@@ -0,0 +1,41 @@
+wmCube 0.98
+--------------------------------------------------------------
+Author: Robert Kling
+ robkli-8 at student.luth.se
+ http://boombox.campus.luth.se
+
+Contributions by:
+ Thorsten Jens (thodi at et-inf.fho-emden.de)
+ Jakob Borg (email-adress goes here)
+ Dan Price (dp at rampant.org)
+ Brian Joseph Czapiga (rys at godsey.net)
+ Tai-hwa Liang (avatar at mmlab.cse.yzu.edu.tw)
+ Jared Smolens (jsmolens+ at andrew.cmu.edu)
+
+Description
+--------------------------------------------------------------
+
+wmCube is a dockapp that displays a realtime rotating 3d-object
+and the current CPU load.
+
+Files
+--------------------------------------------------------------
+3dObjects/ In here you will find bundled object-files.
+README This file.
+INSTALL Installation instructions.
+CHANGES Description of changes.
+TODO Things I've already planned for wmCube
+COPYING GNU General Public License Version 2.
+
+Bugs
+--------------------------------------------------------------
+If you discover any bugs in this software, please send a
+bugreport to robkli-8 at student.luth.se and describe the
+problem as detailed as you can.
+
+Copyright
+--------------------------------------------------------------
+wmCube is Copyright (C) 2000/01 by Robert Kling, Lulea SWEDEN
+
+wmCube is licensed through the GNU General Public License.
+Read the COPYING file for the complete GNU license.
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..01df841
--- /dev/null
+++ b/TODO
@@ -0,0 +1,8 @@
+TODO list for wmCube future versions
+--------------------------------------------------------------
+
+* Ports to more OS's.
+* Goroud shading, texture mapping (hmm.. do I smell overkill?)
+
+If you have any suggestions, ideas, comments of how to make
+this app better please send it to robkli-8 at student.luth.se.
diff --git a/wmcube/Makefile b/wmcube/Makefile
new file mode 100644
index 0000000..1410b29
--- /dev/null
+++ b/wmcube/Makefile
@@ -0,0 +1,39 @@
+CC = gcc
+OS = -DLINUX
+
+LIBDIR = -L/usr/X11R6/lib
+LIBDIR = -L/usr/X11R6/lib
+INCDIR = -I/usr/X11R6/share/include
+
+# Edit OSLIBS as appropriate to include OS specific libraries.
+
+OSLIBS =
+LIBS = -lXpm -lXext -lX11 -lm $(OSLIBS)
+CFLAGS = -Wall -O2 $(OS)
+
+OBJS = wmcube.o \
+ ../wmgeneral/wmgeneral.o \
+ ../wmgeneral/misc.o \
+ ../wmgeneral/list.o
+
+.c.o:
+ $(CC) $(CFLAGS) $(INCDIR) -c $< -o $*.o
+
+wmcube: $(OBJS)
+ $(CC) -o wmcube $^ -lXext $(LIBDIR) $(LIBS)
+
+
+all:: wmcube
+
+clean::
+ for i in $(OBJS) ; do \
+ rm -f $$i ; \
+ done
+ rm -f wmcube
+ rm -f *~
+
+install:: wmcube
+ cp -f wmcube /usr/local/bin/
+ chmod 755 /usr/local/bin/wmcube
+ chown root:root /usr/local/bin/wmcube
+ @echo "wmCube installation finished..."
diff --git a/wmcube/Makefile.FREEBSD b/wmcube/Makefile.FREEBSD
new file mode 100644
index 0000000..815e32d
--- /dev/null
+++ b/wmcube/Makefile.FREEBSD
@@ -0,0 +1,38 @@
+CC = gcc
+OS = -DFREEBSD
+
+LIBDIR = -L/usr/X11R6/lib
+LIBDIR = -L/usr/X11R6/lib
+INCDIR = -I/usr/X11R6/include
+
+# Edit OSLIBS as appropriate to include OS specific libraries.
+
+OSLIBS = -lkvm
+LIBS = -lXpm -lXext -lX11 -lm $(OSLIBS)
+CFLAGS = -Wall -O2 $(OS)
+
+OBJS = wmcube.o \
+ ../wmgeneral/wmgeneral.o \
+ ../wmgeneral/misc.o \
+ ../wmgeneral/list.o
+
+.c.o:
+ $(CC) $(CFLAGS) $(INCDIR) -c $< -o $*.o
+
+wmcube: $(OBJS)
+ $(CC) -o wmcube $(OBJS) -lXext $(LIBDIR) $(LIBS)
+
+all:: wmcube
+
+clean::
+ for i in $(OBJS) ; do \
+ rm -f $$i ; \
+ done
+ rm -f wmcube
+ rm -f *~
+
+install:: wmcube
+ cp -f wmcube /usr/local/bin/
+ chmod g+s /usr/local/bin/wmcube
+ chown root.kmem /usr/local/bin/wmcube
+ @echo "wmCube installation finished..."
diff --git a/wmcube/Makefile.LINUX b/wmcube/Makefile.LINUX
new file mode 100644
index 0000000..1410b29
--- /dev/null
+++ b/wmcube/Makefile.LINUX
@@ -0,0 +1,39 @@
+CC = gcc
+OS = -DLINUX
+
+LIBDIR = -L/usr/X11R6/lib
+LIBDIR = -L/usr/X11R6/lib
+INCDIR = -I/usr/X11R6/share/include
+
+# Edit OSLIBS as appropriate to include OS specific libraries.
+
+OSLIBS =
+LIBS = -lXpm -lXext -lX11 -lm $(OSLIBS)
+CFLAGS = -Wall -O2 $(OS)
+
+OBJS = wmcube.o \
+ ../wmgeneral/wmgeneral.o \
+ ../wmgeneral/misc.o \
+ ../wmgeneral/list.o
+
+.c.o:
+ $(CC) $(CFLAGS) $(INCDIR) -c $< -o $*.o
+
+wmcube: $(OBJS)
+ $(CC) -o wmcube $^ -lXext $(LIBDIR) $(LIBS)
+
+
+all:: wmcube
+
+clean::
+ for i in $(OBJS) ; do \
+ rm -f $$i ; \
+ done
+ rm -f wmcube
+ rm -f *~
+
+install:: wmcube
+ cp -f wmcube /usr/local/bin/
+ chmod 755 /usr/local/bin/wmcube
+ chown root:root /usr/local/bin/wmcube
+ @echo "wmCube installation finished..."
diff --git a/wmcube/Makefile.NETBSD b/wmcube/Makefile.NETBSD
new file mode 100644
index 0000000..7d212aa
--- /dev/null
+++ b/wmcube/Makefile.NETBSD
@@ -0,0 +1,36 @@
+CC = gcc
+OS = -DNETBSD
+
+LIBDIR = -L/usr/X11R6/lib -L./libdocapp/
+
+# Edit OSLIBS as appropriate to include OS specific libraries.
+
+OSLIBS =
+LIBS = -lXpm -lXext -lX11 -lm $(OSLIBS)
+CFLAGS = -Wall -I/usr/X11R6/include -O2 $(OS)
+
+OBJS = wmcube.o \
+ ../wmgeneral/wmgeneral.o \
+ ../wmgeneral/misc.o \
+ ../wmgeneral/list.o
+
+.c.o:
+ $(CC) $(CFLAGS) $(INCDIR) -c $< -o $*.o
+
+wmcube: $(OBJS)
+ $(CC) -o wmcube -lXext $(LIBDIR) $(LIBS) $(OBJS)
+
+all:: wmcube
+
+clean::
+ for i in $(OBJS) ; do \
+ rm -f $$i ; \
+ done
+ rm -f wmcube
+ rm -f *~
+
+install:: wmcube
+ cp -f wmcube /usr/local/bin/
+ chmod 755 /usr/local/bin/wmcube
+ chown root:root /usr/local/bin/wmcube
+ @echo "wmCube installation finished..."
diff --git a/wmcube/Makefile.OPENBSD b/wmcube/Makefile.OPENBSD
new file mode 100644
index 0000000..3cbae90
--- /dev/null
+++ b/wmcube/Makefile.OPENBSD
@@ -0,0 +1,37 @@
+CC = gcc
+OS = -DOPENBSD
+
+LIBDIR = -L/usr/X11R6/lib -L./libdocapp/
+
+# Edit OSLIBS as appropriate to include OS specific libraries.
+
+OSLIBS =
+LIBS = -lXpm -lXext -lX11 -lm $(OSLIBS)
+INCLUDES = -I/usr/X11R6/include
+CFLAGS = -Wall -O2 $(OS) $(INCLUDES)
+
+OBJS = wmcube.o \
+ ../wmgeneral/wmgeneral.o \
+ ../wmgeneral/misc.o \
+ ../wmgeneral/list.o
+
+.c.o:
+ $(CC) $(CFLAGS) $(INCDIR) -c $< -o $*.o
+
+wmcube: $(OBJS)
+ $(CC) -o wmcube $^ -lXext $(LIBDIR) $(LIBS) $>
+
+all:: wmcube
+
+clean::
+ for i in $(OBJS) ; do \
+ rm -f $$i ; \
+ done
+ rm -f wmcube
+ rm -f *~
+
+install:: wmcube
+ cp -f wmcube /usr/local/bin/
+ chmod 755 /usr/local/bin/wmcube
+ chown root:root /usr/local/bin/wmcube
+ @echo "wmCube installation finished..."
diff --git a/wmcube/Makefile.SOLARIS b/wmcube/Makefile.SOLARIS
new file mode 100644
index 0000000..5ebc893
--- /dev/null
+++ b/wmcube/Makefile.SOLARIS
@@ -0,0 +1,38 @@
+CC = gcc
+OS = -DSOLARIS
+
+LIBDIR = -L/usr/X11R6/lib
+LIBDIR = -L/usr/openwin/lib -L/opt/sfw/lib -L/usr/local/lib -R/usr/openwin/lib -R/opt/sfw/lib -R/usr/local/lib
+INCDIR = -I/usr/openwin/include -I/opt/sfw/include -I/usr/local/include
+
+# Edit OSLIBS as appropriate to include OS specific libraries.
+
+OSLIBS = -lkstat
+LIBS = -lXpm -lXext -lX11 -lm $(OSLIBS)
+CFLAGS = -Wall -O2 $(OS)
+
+OBJS = wmcube.o \
+ ../wmgeneral/wmgeneral.o \
+ ../wmgeneral/misc.o \
+ ../wmgeneral/list.o
+
+.c.o:
+ $(CC) $(CFLAGS) $(INCDIR) -c $< -o $*.o
+
+wmcube: $(OBJS)
+ $(CC) -o wmcube $^ -lXext $(LIBDIR) $(LIBS)
+
+all:: wmcube
+
+clean::
+ for i in $(OBJS) ; do \
+ rm -f $$i ; \
+ done
+ rm -f wmcube
+ rm -f *~
+
+install:: wmcube
+ cp -f wmcube /usr/local/bin/
+ chmod 755 /usr/local/bin/wmcube
+ chown root:root /usr/local/bin/wmcube
+ @echo "wmCube installation finished..."
diff --git a/wmcube/wmcube.c b/wmcube/wmcube.c
new file mode 100644
index 0000000..a586b55
--- /dev/null
+++ b/wmcube/wmcube.c
@@ -0,0 +1,1351 @@
+/*
+
+ wmcube.c
+ Version 0.98 (2000-10-20)
+
+ Robert Kling (robkli-8 at student.luth.se)
+ http://boombox.campus.luth.se/projects.php
+
+ Contributions:
+ -n option patch by Thorsten Jens (thodi at et-inf.fho-emden.de) (2000-05-12)
+ Various bugfixes and optimizations by Jakob Borg (2000-05-13)
+ Solaris Port by Dan Price (dp at rampant.org) (2000-07-16)
+ OpenBSD Port by Brian Joseph Czapiga (rys at godsey.net) (2000-07-19)
+ FreeBSD Port by Tai-hwa Liang (avatar at mmlab.cse.yzu.edu.tw) (2000-07-20)
+ NetBSD Port by Jared Smolens <jsmolens+ at andrew.cmu.edu> (2000-09-23)
+
+ This software is licensed through the GNU General Public Licence.
+
+ See http://www.BenSinclair.com/dockapp/ for more wm dock apps.
+
+ If you want to port wmcube to another OS the system specific code is
+ sectioned the bottom of this file. See instructions there.
+
+*/
+
+#define WMCUBE_VERSION "0.98"
+#define REV_DATE "2000-10-23"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <math.h>
+
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+
+#include <utmp.h>
+#include <dirent.h>
+
+#include <X11/Xlib.h>
+#include <X11/xpm.h>
+#include <X11/extensions/shape.h>
+
+#ifdef FREEBSD
+#include <kvm.h>
+#endif
+
+#include "../wmgeneral/wmgeneral.h"
+#include "../wmgeneral/misc.h"
+
+#include "wmcube.xpm"
+char wmcube_mask_bits[64*64];
+int wmcube_mask_width = 64;
+int wmcube_mask_height = 64;
+
+#define CHAR_WIDTH 5
+#define CHAR_HEIGHT 7
+#define PI 3.1415926535
+
+//**** Graphics ***********************************
+
+void putpixel(int x, int y, int c);
+void line(int x1, int y1, int x2, int y2, int c);
+void hline(int x1, int x2, int y, int c);
+void triangle(int x1, int y1, int x2, int y2, int x3, int y3, int c);
+void BlitString(char *name, int x, int y);
+void BlitNum(int num, int x, int y);
+void clearscr();
+void draw();
+void startup_seq();
+
+//**** 3d specific ********************************
+
+void setupobj(char *filename) ;
+void setUpAngles();
+void rotate(int xang, int yang, int zang);
+int normal(float p1[], float p2[], float p3[]);
+int luminate(float p1[], float p2[], float p3[]);
+void sortz(int nofelements);
+
+//**** Application Management, I/O etc. ***********
+
+void print_help();
+int loadobj(char *filename);
+void mem_alloc_error(void *block);
+int scan4objects(char *dir);
+int next_object();
+void die();
+
+//**** System specific functions ******************
+
+int init_calc_cpu();
+int calc_cpu_total();
+
+//**** Global variables ***************************
+
+int xcenter, ycenter, zoff;
+double cost[361], sint[361];
+double acost[100];
+float **matrix;
+float **rmatrix;
+int **planes;
+int *plane_color;
+int *zorder;
+int *cline;
+int nofcoords, noflines, nofplanes;
+char *objects[1000];
+int nof_objects = 0;
+int show_load = 1;
+int use_nice = 1;
+int which_cpu = -1;
+int planesORlines = 1;
+char *pname;
+
+float lum_vector[3] = { 0, 0, 100 }; // Lightsource vector
+
+#ifdef FREEBSD
+static kvm_t *kd;
+static struct nlist nlst[] = { {"_cp_time"}, {0} };
+#endif
+
+int main(int argc, char **argv)
+{
+ int j, i = 0, rot_speed = 0, cpu_usage = 0, rot_step = 1;
+ long screen_speed = 10000; // microseconds between screen updates (approx.)
+ long cpu_update = 490000; // microseconds between cpu update (approx.)
+ int but_stat = -1;
+ int loop = 0;
+ XEvent Event;
+
+ char *rotdiv = {"25"};
+ char *rotstep = {"1"};
+ char *obj_filename = {""};
+ int rot;
+ int cube_color = 1;
+ int c = 0;
+ int invert_speed = 0;
+
+ pname = strrchr(argv[0], '/');
+ if (pname == NULL) pname = argv[0];
+
+ srand((unsigned)time(NULL));
+ opterr = 0;
+
+ while ((c = getopt (argc, argv, "d:nhpbir:o:c:")) != -1) {
+ switch (c)
+ {
+ case 'c':
+ which_cpu = atoi(optarg);
+ break;
+ case 'd':
+ rotstep = optarg;
+ break;
+ case 'h':
+ print_help();
+ return 1;
+ case 'i':
+ invert_speed = 1;
+ break;
+ case 'p':
+ show_load = 0;
+ break;
+ case 'b':
+ cube_color = 2;
+ break;
+ case 'r':
+ rotdiv = optarg;
+ break;
+ case 'o':
+ obj_filename = optarg;
+ break;
+ case 'n':
+ use_nice = 0;
+ break;
+ case '?':
+ print_help();
+ return 1;
+ default:
+ abort();
+ }
+ }
+
+ /*
+ * Validate that wmcube can run on this system given the parameters,
+ * then setup the statistics gathering subsystem.
+ */
+
+ if (init_calc_cpu() != 0) die();
+
+ /*
+ * Scan directory for .wmc files and choose one randomly. If the user
+ * specified a particular file, load that one.
+ */
+
+#ifndef SOLARIS // scan4objects doesnt work on Solaris, load object immediatly
+ scan4objects(obj_filename);
+
+ if (nof_objects != 0)
+ next_object();
+ else
+#endif
+ setupobj(obj_filename);
+
+ /*
+ * Various initializion stuff for the 3d-engine etc.
+ */
+
+ setUpAngles();
+
+ rot = atoi(rotdiv);
+ if ((rot >= 1) && (rot <=100)) ; else rot = 25;
+
+ rot_step = atoi(rotstep);
+ if (rot_step < 0) rot_step = -rot_step;
+
+ if (calc_cpu_total() == -1) die();
+
+ cpu_update /= screen_speed;
+
+ createXBMfromXPM(wmcube_mask_bits, wmcube_xpm, wmcube_mask_width, wmcube_mask_height);
+ openXwindow(argc, argv, wmcube_xpm, wmcube_mask_bits, wmcube_mask_width, wmcube_mask_height);
+
+ startup_seq();
+
+ if (calc_cpu_total() == -1) die();
+
+ // index, left, top, right, bottom
+ AddMouseRegion(1, 45, 45, 58, 58); // + Zoom In
+ AddMouseRegion(5, 5, 45, 20, 58); // - Zoom Out
+ AddMouseRegion(3, 21, 45, 45, 58); // Show cpu-load
+ AddMouseRegion(2, 5, 5, 55, 45); // Everywhere else (almost) to change object
+
+ /*
+ * Main loop begins here
+ */
+
+ while (1)
+ {
+ i = (i+rot_speed+rot_step) % 360;
+
+ clearscr();
+ rotate(i,i,i);
+
+ draw(cube_color);
+
+ if (show_load) {
+ BlitNum(cpu_usage,24,49);
+ BlitString("Z",38,49);
+ }
+
+ RedrawWindow();
+
+ if (loop++ == cpu_update) {
+ loop = 0;
+
+ /*
+ * call calc_cpu_total to update statistics. If some
+ * sort of bad event occurs, calc_cpu_total will return
+ * -1, and we exit.
+ */
+
+ if ((cpu_usage = calc_cpu_total()) == -1) {
+ die();
+ }
+ rot_speed = abs( invert_speed*(100 / rot) - cpu_usage / rot);
+ }
+
+ // X Events
+
+ while (XPending(display))
+ {
+ XNextEvent(display, &Event);
+ switch (Event.type)
+ {
+ case Expose:
+ RedrawWindow();
+ break;
+ case DestroyNotify:
+ XCloseDisplay(display);
+ exit(0);
+ break;
+ case ButtonPress:
+ j = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y);
+ but_stat = j;
+
+ break;
+ case ButtonRelease:
+ j = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y);
+
+ switch(j)
+ {
+ case 1:
+ if (zoff > 750) {
+ BlitString("�",48,48);
+ RedrawWindow();
+ zoff -= 150;
+ }
+ break;
+
+ case 2:
+ next_object();
+ break;
+
+ case 3:
+ if (show_load == 1) show_load = 0; else show_load = 1;
+ ycenter = 15 - 2*show_load;
+ break;
+
+ case 5:
+ BlitString("�",11,49);
+ RedrawWindow();
+ zoff += 150;
+ break;
+ }
+ }
+ break;
+ }
+ usleep(screen_speed);
+ }
+
+ /*
+ * Free up memory used by the object (dirty...)
+ */
+
+ free(matrix);
+ free(rmatrix);
+ free(cline);
+
+ return 1;
+}
+
+
+//**** Graphics ***********************************
+//*************************************************
+
+void startup_seq()
+{
+ char *tmp = malloc(32);
+ int oldzoff = 3600;
+
+ sprintf(tmp,"V%s",WMCUBE_VERSION);
+
+ RedrawWindow();
+ BlitString("WMCUBE",13,22);
+ BlitString(tmp,15,31);
+ RedrawWindow();
+ RedrawWindow();
+ usleep(3000000);
+ RedrawWindow();
+
+ zoff = 1200;
+
+ for (;zoff < oldzoff; zoff += 35)
+ {
+ rotate((zoff-1200)/8,0,0);
+ clearscr();
+ BlitString("WMCUBE",13,22);
+ BlitString(tmp,15,31);
+ draw(1);
+ RedrawWindow();
+ usleep(9000);
+ }
+
+ zoff = 3600;
+}
+
+void draw(int color)
+{
+ int i;
+
+ if (planesORlines) {
+
+ sortz(nofplanes);
+ for (i = 0; i < nofplanes; i++) {
+ if (normal(rmatrix[planes[zorder[i]][0]], rmatrix[planes[zorder[i]][1]], rmatrix[planes[zorder[i]][2]]) > 0) {
+
+ triangle(xcenter+rmatrix[planes[zorder[i]][0]][0], ycenter+rmatrix[planes[zorder[i]][0]][1],
+ xcenter+rmatrix[planes[zorder[i]][1]][0], ycenter+rmatrix[planes[zorder[i]][1]][1],
+ xcenter+rmatrix[planes[zorder[i]][2]][0], ycenter+rmatrix[planes[zorder[i]][2]][1], plane_color[zorder[i]]);
+ }
+ }
+
+ } else {
+ for (i = 0; i < noflines; i += 2)
+ line(xcenter+rmatrix[cline[i ]-1][0], ycenter+rmatrix[cline[i ]-1][1],
+ xcenter+rmatrix[cline[i+1]-1][0], ycenter+rmatrix[cline[i+1]-1][1],color);
+ }
+}
+
+void putpixel(int x, int y,int c)
+{
+ if ((x > 4) && (x < 59) && (y > 4) && (y < 59))
+ copyXPMArea(160-c,0,1,1,x,y);
+}
+
+void hline(int x1, int x2, int y, int c)
+{
+ if ((y > 4) && (y < 59)) {
+ if (x1 <= 4) x1 = 5; else if (x1 > 57) return;
+ if (x2 > 57) x2 = 57; else if (x2 <= 4) return;
+
+ copyXPMArea(105, 56+c + 9*(c/18), x2-x1, 1, x1, y);
+ }
+}
+
+void triangle(int x1, int y1, int x2, int y2, int x3, int y3, int c) // Draws a filled triangle
+{
+ int k,k2,x,x_2,i, tmp1;
+
+ int x1t, x2t;
+
+ if (y3<y2)
+ {
+ tmp1=y2;
+ y2=y3;
+ y3=tmp1;
+ tmp1=x2;
+ x2=x3;
+ x3=tmp1;
+ }
+
+ if (y2<y1)
+ {
+ tmp1=y1;
+ y1=y2;
+ y2=tmp1;
+ tmp1=x1;
+ x1=x2;
+ x2=tmp1;
+ }
+
+ if (y3<y2)
+ {
+ tmp1=y2;
+ y2=y3;
+ y3=tmp1;
+ tmp1=x2;
+ x2=x3;
+ x3=tmp1;
+ }
+
+ if (y1!=y3) k=((x1-x3) << 6) / (y1-y3);
+ else k=(x1-x3) << 6;
+
+ if (y1!=y2) k2=((x1-x2) << 6) / (y1-y2);
+ else k2=(x1-x2) << 6;
+
+ x=x1 << 6;
+ x_2=x;
+ i=y1;
+
+ if (i!=y2)
+ do
+ {
+ x+=k;
+ x_2+=k2;
+ i++;
+
+ if ((x1t = x >> 6) > (x2t = x_2 >> 6))
+ hline(x2t, x1t, i, c);
+ else
+ hline(x1t, x2t, i, c);
+ }
+ while (i!=y2);
+
+ if (i==y3) return;
+
+ if (y2!=y3) k2=((x2-x3) << 6) / (y2-y3);
+ else k2=((x2-x3) << 6);
+
+ x_2=x2 << 6;
+ i=y2;
+ do
+ {
+ x+=k;
+ x_2+=k2;
+ i++;
+
+ if ((x1t = x >> 6) > (x2t = x_2 >> 6))
+ hline(x2t, x1t, i, c);
+ else
+ hline(x1t, x2t, i, c);
+ }
+ while (i!=y3);
+}
+
+void clearscr()
+{
+ copyXPMArea(78,0,56,56,4,4);
+}
+
+// Blits a string at given co-ordinates
+void BlitString(char *name, int x, int y)
+{
+ int i;
+ int c;
+ int k;
+
+ k = x;
+
+ copyXPMArea(73,64,1,8,k-1,y);
+
+ for (i=0; name[i]; i++)
+ {
+ c = toupper(name[i]);
+ //printf("%c",c);
+
+ if (c >= 'A' && c <= 'Z')
+ { // its a letter
+ c -= 'A';
+ if ( k > -2) copyXPMArea(c * 6, 74, 6, 8, k, y);
+ k += 6;
+ } else
+ if (c >= '0' && c<= ':')
+ { // its a number or symbol
+ c -= '0';
+ if ( k > -2) copyXPMArea(c * 6, 64, 6, 8, k, y);
+ k += 6;
+ } else
+ if (c == 246) {
+ if ( k > -2) copyXPMArea(0, 84, 6, 9, k, y);
+ k += 6;
+ } else
+ if (c == 228) {
+ if ( k > -2) copyXPMArea(6, 84, 6, 9, k, y);
+ k += 6;
+ } else
+ if (c == 229) {
+ if ( k > -2) copyXPMArea(12, 84, 6, 9, k, y);
+ k += 6;
+ } else
+ { // its a blank or something else
+ if ( k > -2) copyXPMArea(73,64,6,8,k,y);
+ k += 6;
+ }
+ if (k >= 58) break;
+ }
+ copyXPMArea(73,64,1,8,k,y);
+
+}
+
+// Blits number to given coordinates.. two 0's, right justified
+
+void BlitNum(int num, int x, int y)
+{
+ char buf[1024];
+ int newx=x;
+
+ if (num > 99)
+ {
+ newx -= CHAR_WIDTH;
+ }
+
+ if (num > 999)
+ {
+ newx -= CHAR_WIDTH;
+ }
+
+ sprintf(buf, "%02i", num);
+
+ BlitString(buf, newx, y);
+}
+
+void line(int x1, int y1, int x2, int y2, int c)
+{
+ int i, deltax, deltay, numpixels,
+ d, dinc1, dinc2,
+ x, xinc1, xinc2,
+ y, yinc1, yinc2;
+
+ deltax = abs(x2 - x1);
+ deltay = abs(y2 - y1);
+ if (deltax >= deltay)
+ {
+ numpixels = deltax + 1;
+ d = (deltay << 1) - deltax;
+ dinc1 = deltay << 1;
+ dinc2 = (deltay - deltax) << 1;
+ xinc1 = 1;
+ xinc2 = 1;
+ yinc1 = 0;
+ yinc2 = 1;
+ }
+ else
+ {
+ numpixels = deltay + 1;
+ d = (deltax << 1) - deltay;
+ dinc1 = deltax << 1;
+ dinc2 = (deltax - deltay) << 1;
+ xinc1 = 0;
+ xinc2 = 1;
+ yinc1 = 1;
+ yinc2 = 1;
+ }
+ if (x1 > x2)
+ {
+ xinc1 = - xinc1;
+ xinc2 = - xinc2;
+ }
+ if (y1 > y2)
+ {
+ yinc1 = - yinc1;
+ yinc2 = - yinc2;
+ }
+ x = x1;
+ y = y1;
+ for (i=1; i<numpixels; i++)
+ {
+ putpixel(x, y, c);
+ if (d < 0)
+ {
+ d = d + dinc1;
+ x = x + xinc1;
+ y = y + yinc1;
+ }
+ else
+ {
+ d = d + dinc2;
+ x = x + xinc2;
+ y = y + yinc2;
+ }
+ }
+}
+
+
+//**** 3d specific ********************************
+//*************************************************
+
+void rotate(int xang, int yang, int zang)
+{
+ float tx, ty, tz;
+ int i;
+
+ for (i = 0; i < nofcoords; i++)
+ {
+ tx = cost[yang]*matrix[i][0]-sint[yang]*matrix[i][2];
+ tz = sint[yang]*matrix[i][0]+cost[yang]*matrix[i][2];
+ ty = cost[zang]*matrix[i][1]-sint[zang]*tx;
+
+ rmatrix[i][0] = (cost[zang]*tx+sint[zang]*matrix[i][1]);
+ rmatrix[i][1] = (sint[xang]*tz+cost[xang]*ty);
+ rmatrix[i][2] = (cost[xang]*tz-sint[xang]*ty);
+ }
+
+ if (planesORlines)
+ for (i = 0; i < nofplanes; i++)
+ if (normal(rmatrix[planes[i][0]], rmatrix[planes[i][1]], rmatrix[planes[i][2]]) > 0)
+ plane_color[i] = luminate(rmatrix[planes[i][0]], rmatrix[planes[i][1]], rmatrix[planes[i][2]]);
+
+ for (i = 0; i < nofcoords; i++) {
+ // Perspective correcting lines...
+ rmatrix[i][0] = (rmatrix[i][0] *256) / (2*rmatrix[i][2] - zoff) + xcenter;
+ rmatrix[i][1] = (rmatrix[i][1] *256) / (2*rmatrix[i][2] - zoff) + ycenter;
+ }
+}
+
+void sortz(int nofelements) { // Insertion-sort the planes in increasing z-distance
+
+ int i, j, k;
+ float key;
+ float temparr[nofelements];
+
+ for (i = 0; i < nofelements; i++)
+ {
+ zorder[i] = i;
+ temparr[i] = rmatrix[planes[i][0]][2]+rmatrix[planes[i][1]][2]+rmatrix[planes[i][2]][2];
+ }
+
+ for (j = 1; j < nofelements; j++) {
+
+ key = temparr[j];
+ k = zorder[j];
+ i = j - 1;
+
+ while ((i > -1) && (temparr[i] > key)) {
+ temparr[i+1] = temparr[i];
+ zorder[i+1] = zorder[i--];
+ }
+
+ zorder[i+1] = k;
+ temparr[i+1] = key;
+ }
+}
+
+int normal(float p1[], float p2[], float p3[])
+{
+ return ((p1[0]-p3[0])*(p2[1]-p3[1])-(p2[0]-p3[0])*(p1[1]-p3[1]));
+}
+
+int luminate(float p1[], float p2[], float p3[])
+{
+ double x1 = (float)(p1[0]-p3[0]), y1 = (float)(p1[1]-p3[1]), z1 = (float)(p1[2]-p3[2]);
+ double x2 = (float)(p2[0]-p3[0]), y2 = (float)(p2[1]-p3[1]), z2 = (float)(p2[2]-p3[2]);
+ double nx = y1*z2-y2*z1, ny =-(x1*z2-x2*z1),nz = x1*y2-y1*x2;
+
+ return (int)(53 * (acost[(int)(50 + 50*(nx*lum_vector[0]+ny*lum_vector[1]+nz*lum_vector[2])/
+ (sqrt(nx*nx+ny*ny+nz*nz)*
+ sqrt(lum_vector[0]*lum_vector[0]+lum_vector[1]*lum_vector[1]+
+ lum_vector[2]*lum_vector[2])))] / PI));
+
+ // Do I smell optimization? :-)
+}
+
+void setUpAngles()
+{
+ int i;
+ for (i = 0; i < 361; i++) {
+ cost[i] = cos((double)i*(2*PI/(double)360));
+ sint[i] = sin((double)i*(2*PI/(double)360));
+ }
+
+ for (i = 0; i < 100; i++) acost[i] = acos((double)(-50+i)/50);
+}
+
+void setupobj(char *filename)
+{
+ int i, j = 0;
+ int biggest = 0;
+ float scale = 1;
+
+ xcenter = 16;
+ ycenter = 15 - 2*show_load;
+
+ if (strcmp(filename,"") != 0)
+ loadobj(filename);
+ else
+ {
+ nofcoords = 8;
+ noflines = 24;
+ nofplanes = 12;
+ planesORlines = 1;
+
+ matrix = (float **)malloc(nofcoords*sizeof(float *)); mem_alloc_error(matrix);
+ planes = (int **)malloc(nofplanes*sizeof(int *)); mem_alloc_error(planes);
+ plane_color = (int *)malloc(nofplanes*sizeof(int)); mem_alloc_error(plane_color);
+ zorder = (int *)malloc(nofplanes*sizeof(int)); mem_alloc_error(zorder);
+
+ for (i = 0; i < nofplanes; i++) zorder[i] = i;
+
+ for (i = 0; i < nofcoords; i++) {
+ matrix[i] = (float *)malloc(3*sizeof(float));
+ mem_alloc_error(matrix[i]);
+ }
+
+ for (i = 0; i < nofplanes; i++) {
+ planes[i] = (int *)malloc(3*sizeof(int));
+ mem_alloc_error(planes[i]);
+ }
+
+ cline = (int *)malloc((noflines+1)*sizeof(int)); mem_alloc_error(cline);
+
+ matrix[0][0] = -180; matrix[0][1] = -180; matrix[0][2] = 180; // 0
+ matrix[1][0] = 180; matrix[1][1] = -180; matrix[1][2] = 180; // 1
+ matrix[2][0] = 180; matrix[2][1] = 180; matrix[2][2] = 180; // 2
+ matrix[3][0] = -180; matrix[3][1] = 180; matrix[3][2] = 180; // 3
+ matrix[4][0] = -180; matrix[4][1] = -180; matrix[4][2] = -180; // 4
+ matrix[5][0] = 180; matrix[5][1] = -180; matrix[5][2] = -180; // 5
+ matrix[6][0] = 180; matrix[6][1] = 180; matrix[6][2] = -180; // 6
+ matrix[7][0] = -180; matrix[7][1] = 180; matrix[7][2] = -180; // 7
+
+ cline[0] = 1; cline[1] = 2;
+ cline[2] = 2; cline[3] = 3;
+ cline[4] = 3; cline[5] = 4;
+ cline[6] = 4; cline[7] = 1;
+ cline[8] = 5; cline[9] = 6;
+ cline[10] = 6; cline[11] = 7;
+ cline[12] = 7; cline[13] = 8;
+ cline[14] = 8; cline[15] = 5;
+ cline[16] = 1; cline[17] = 5;
+ cline[18] = 2; cline[19] = 6;
+ cline[20] = 3; cline[21] = 7;
+ cline[22] = 4; cline[23] = 8;
+
+ planes[0][0] = 0; planes[0][1] = 1; planes[0][2] = 3;
+ planes[1][0] = 1; planes[1][1] = 2; planes[1][2] = 3;
+ planes[2][0] = 1; planes[2][1] = 5; planes[2][2] = 6;
+ planes[3][0] = 1; planes[3][1] = 6; planes[3][2] = 2;
+
+ planes[4][0] = 4; planes[4][1] = 0; planes[4][2] = 3;
+ planes[5][0] = 4; planes[5][1] = 3; planes[5][2] = 7;
+ planes[6][0] = 3; planes[6][1] = 2; planes[6][2] = 7;
+ planes[7][0] = 7; planes[7][1] = 2; planes[7][2] = 6;
+
+ planes[8][0] = 4; planes[8][1] = 1; planes[8][2] = 0;
+ planes[9][0] = 4; planes[9][1] = 5; planes[9][2] = 1;
+ planes[10][0] = 5; planes[10][1] = 4; planes[10][2] = 7;
+ planes[11][0] = 5; planes[11][1] = 7; planes[11][2] = 6;
+ }
+
+ rmatrix = (float **)realloc(rmatrix,nofcoords*sizeof(float *)); mem_alloc_error(rmatrix);
+ for (i = 0; i < nofcoords; i++) {
+ rmatrix[i] = (float *)malloc(3*sizeof(float));
+ mem_alloc_error(rmatrix[i]);
+ }
+
+ /*
+ * Find the longest discance between all coordinates relative to the origin
+ */
+
+ for (i = 0; i < nofcoords; i++) {
+ j = (int)sqrt((pow(matrix[i][0],2)+pow(matrix[i][1],2)+pow(matrix[i][2],2)));
+ if (j > biggest) biggest = j;
+ }
+
+ /*
+ * Scale every coordinate using the calculated factor
+ */
+
+ scale = 280 / (float)biggest;
+
+ for (i = 0; i < nofcoords; i++) {
+ matrix[i][0] *= scale;
+ matrix[i][1] *= scale;
+ matrix[i][2] *= scale;
+ }
+}
+
+
+
+
+//**** Application Management, I/O etc. ***********
+//*************************************************
+
+void print_help() {
+ printf("\nwmCube %s (%s)\n\n", WMCUBE_VERSION, REV_DATE);
+
+#ifndef SOLARIS
+ printf(" -o <filename or directory>: load external 3d-object(s).\n\n");
+#else
+ printf(" -o <filename>: load external 3d-object.\n\n");
+#endif
+
+ printf(" -d x: rotate x degrees/step when the cpu is idle. (default 1)\n");
+ printf(" -r x: rotate 1 degree faster every x percent of cpu-usage. (default 25)\n");
+
+#ifdef LINUX
+ printf(" -c x: which cpu (0,1,2..) to monitor. (default average over all)\n");
+ printf(" -n : exclude \"nice\" processes. (default OFF)\n");
+#endif
+
+#ifdef SOLARIS
+ printf(" -c x: which cpu (0,1,2..) to monitor. (default average over all)\n");
+#endif
+
+#ifdef FREEBSD
+ printf(" -n : exclude \"nice\" processes. (default OFF)\n");
+#endif
+
+#ifdef NETBSD
+ printf(" -n : exclude \"nice\" processes. (default OFF)\n");
+#endif
+
+ printf(" -b : draw the cube in a brighter color. (default OFF)\n");
+ printf(" -i : invert cube speed. (default OFF)\n");
+ printf(" -p : do not display cpu-load (default OFF)\n");
+ printf(" -h : display this helptext.\n\n");
+}
+
+void die()
+{
+ fprintf(stderr, "%s: exiting", pname);
+ exit (1);
+}
+
+#ifndef SOLARIS // scan4objects doesnt work on Solaris because of alphasort
+int scan4objects(char *dir)
+{
+ struct dirent **names;
+ int n;
+
+ n = scandir(dir,&names,0,alphasort);
+
+ while (n-- > 0)
+ if (strstr(names[n]->d_name,".wmc") != NULL)
+ {
+ objects[nof_objects] = (char *)malloc(strlen(dir)+strlen(names[n]->d_name)+2);
+ strcpy(objects[nof_objects],dir);
+ if (dir[strlen(dir)] != '/') strcat(objects[nof_objects],"/");
+ strcat(objects[nof_objects++],names[n]->d_name);
+ }
+
+ return nof_objects;
+}
+#endif
+
+int next_object()
+{
+ if (nof_objects == 0) return -1;
+ setupobj(objects[rand() % (nof_objects )]);
+
+ return 0;
+}
+
+
+int loadobj(char *filename) {
+
+ FILE *fp;
+ char tmp[64] = {""};
+ int i = 0, counter = 1;
+
+ //printf("\nLoading file %s...",filename); fflush(stdout);
+
+ if ((fp = fopen(filename,"rt")) == NULL) {
+ printf("\nERROR: wmCube object-file not found (%s).\n\n",filename);
+ exit(0);
+ }
+
+ fscanf(fp,"%s",tmp);
+
+ if (strcmp(tmp,"WMCUBE_COORDINATES") != 0) {
+ printf("\nError in objectfile: it must start with WMCUBE_COORDINATES\n\n");
+ fclose(fp);
+ exit(0);
+ }
+
+ fscanf(fp,"%s",tmp);
+ counter = atoi(tmp);
+
+ while ((strcmp(tmp,"WMCUBE_LINES") != 0) && (strcmp(tmp,"WMCUBE_PLANES") != 0)) {
+
+ matrix = (float **)realloc(matrix,(i+1)*sizeof(float *)); mem_alloc_error(matrix);
+ matrix[i] = (float *)malloc(3*sizeof(float)); mem_alloc_error(matrix[i]);
+ fscanf(fp,"%f %f %f",&matrix[i][0],&matrix[i][1],&matrix[i][2]);
+ //printf("\n%d: %f %f %f",atoi(tmp), matrix[i][0],matrix[i][1],matrix[i][2]);
+
+ if (atoi(tmp) != (++i)) {
+
+ printf("\nError in objectfile (WMCUBE_COORDINATES section):\n"
+ "the coordinates must be listed in order 1..n\n\n");
+ fclose(fp);
+ exit(0);
+ }
+ fscanf(fp,"%s",tmp);
+
+ if (feof(fp)) {
+ printf("\nError in objectfile: you must have a section WMCUBE_LINES or WMCUBE_PLANES\n\n");
+ fclose(fp);
+ exit(0);
+ }
+ }
+
+ nofcoords = i;
+ i = 0;
+
+ if (strcmp(tmp,"WMCUBE_LINES") == 0) {
+
+ planesORlines = 0;
+ while (1) {
+
+ cline = (int *)realloc(cline,(i+2)*sizeof(int)); mem_alloc_error(cline);
+ fscanf(fp,"%d %d",&cline[i++],&cline[i++]);
+ //printf("\n%d %d",cline[i-2],cline[i-1]);
+ if (feof(fp)) break;
+
+ if (cline[i-2] > nofcoords || cline[i-1] > nofcoords) {
+ printf("\nError in objectfile (WMCUBE_LINES section):\n"
+ "coordinates %d or/and %d doesnt exist\n\n",cline[i-2],cline[i-1]);
+ fclose(fp);
+ exit(0);
+ }
+ }
+ noflines = i-2;
+ }
+ else if (strcmp(tmp,"WMCUBE_PLANES") == 0) {
+
+ planesORlines = 1;
+ while (1) {
+ planes = (int **)realloc(planes,(i+1)*sizeof(int *)); mem_alloc_error(planes);
+ planes[i] = (int *)malloc(3*sizeof(int)); mem_alloc_error(planes[i]);
+ fscanf(fp,"%d %d %d",&planes[i][0],&planes[i][1],&planes[i][2]);
+ //printf("\n%d: %d %d %d",i,planes[i][0],planes[i][1],planes[i][2]);
+
+ planes[i][0]--; planes[i][1]--; planes[i][2]--;
+ //printf("\n%d: %d %d %d\n",i,planes[i][0],planes[i][1],planes[i][2]);
+
+ if (feof(fp)) break;
+
+ if (planes[i][0] > nofcoords || planes[i][1] > nofcoords || planes[i][2] > nofcoords) {
+ printf("\nError in objectfile (WMCUBE_PLANES section):\n"
+ "coordinates %d or/and %d or/and %d doesnt exist\n\n",planes[i][0],planes[i][1],planes[i][2]);
+ fclose(fp);
+ exit(0);
+ }
+ i++;
+ }
+ nofplanes = i;
+ plane_color = (int *)malloc(nofplanes*sizeof(int)); mem_alloc_error(plane_color);
+ zorder = (int *)malloc(nofplanes*sizeof(int)); mem_alloc_error(zorder);
+ for (i = 0; i < nofplanes; i++) zorder[i] = i;
+
+ } else {
+ printf("\nError in objectfile: you must have a section WMCUBE_LINES or WMCUBE_PLANES\n\n");
+ fclose(fp);
+ exit(0);
+ }
+
+ fclose(fp);
+ return 1;
+}
+
+void mem_alloc_error(void *block) {
+ if (block == NULL) {
+ printf("\nError allocating memory!\n\n");
+ exit(0);
+ }
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Begin System Specific Code. If you wish to port wmcube to a new platform,
+ * you'll need to implement the following operations:
+ *
+ * int init_calc_cpu();
+ * Perform feature tests to determine whether wmcube can run, and set up
+ * any files/data structures/etc. to gather statistics.
+ *
+ * int calc_cpu_total();
+ * return an integer reflecting the current CPU load
+ */
+
+#if defined LINUX
+
+/*
+ * init_calc_cpu doesn't have much to do on Linux, but it can check to see if
+ * /proc/stat is available; if the user selected to monitor a particular CPU,
+ * it can check it's existence.
+ */
+int init_calc_cpu()
+{
+ FILE *fp;
+ int i;
+ char cpuid[6];
+ char check_cpu[6];
+
+ sprintf(check_cpu, "cpu%d", which_cpu);
+
+ if ((fp = fopen("/proc/stat","rb")) == NULL) {
+ perror("/proc/stat required for this system");
+ return -1;
+ }
+
+ if (which_cpu == -1)
+ return 0;
+
+ for (i = -2; i < which_cpu; i++) {
+ fscanf(fp, "%s", cpuid);
+ }
+
+ if (strcmp(check_cpu,cpuid) != 0) {
+ fprintf(stderr, "ERROR: could not read cpu-load on %s. Are you "
+ "sure you have an SMP system?\n",check_cpu);
+ return -1;
+ }
+ return (0);
+}
+
+int calc_cpu_total() {
+ int total, used, t=0, i;
+ static int previous_total = 0, previous_used = 0;
+ char cpuid[6];
+ int cpu,nice,system,idle;
+ FILE *fp;
+
+ fp = fopen("/proc/stat","rt");
+
+ for (i = -2; i < which_cpu; i++) {
+ fscanf(fp,"%s %d %d %d %d",cpuid,&cpu,&nice,&system,&idle);
+ }
+
+ fclose(fp);
+
+ used = cpu + system + use_nice*nice;
+ total = used + idle + (1-use_nice)*nice;
+
+ t = 100 * (double)(used - previous_used) / (double)(total - previous_total);
+ previous_total = total;
+ previous_used = used;
+
+ return t;
+}
+
+#elif defined SOLARIS
+#include <sys/types.h>
+#include <sys/sysinfo.h>
+#include <kstat.h>
+
+static kstat_ctl_t *kc;
+static kstat_t **cpu_ksp_list;
+static kstat_t *the_cpu;
+static int ncpus;
+
+/*
+ * The biggest subtlety of the Solaris port is that init_calc_cpu can be called
+ * after the initial program setup. This occurs when a 'kstat state change'
+ * occurs. Usually this means that a CPU has been taken on or off-line using
+ * the psradm command. Another possibility is that on server systems, a new
+ * CPU might have been hot-added to a running system.
+ *
+ * As a result, init_calc_cpu frees any resources it might have setup if needed,
+ * and reinitializes everything.
+ */
+int init_calc_cpu()
+{
+ kstat_t *ksp;
+ int i = 0;
+
+ if (kc == NULL) {
+ if ((kc = kstat_open()) == NULL) {
+ fprintf(stderr, "wmcube: can't open /dev/kstat\n");
+ return -1;
+ }
+ }
+
+ if (which_cpu != -1) {
+ /*
+ * User selected to monitor a particlur CPU. find it...
+ */
+ for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) {
+ if ((strcmp(ksp->ks_module, "cpu_stat") == 0) &&
+ (ksp->ks_instance == which_cpu)) {
+ the_cpu = ksp;
+ break;
+ }
+ }
+ if (the_cpu == NULL) {
+ fprintf(stderr, "CPU %d not found\n", which_cpu);
+ return -1;
+ }
+ } else {
+ /*
+ * User selected to monitor all CPUs. First, count them.
+ */
+ for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) {
+ if (strcmp(ksp->ks_module, "cpu_stat") == 0)
+ i++;
+ }
+
+ if (cpu_ksp_list) {
+ free(cpu_ksp_list);
+ }
+ cpu_ksp_list = (kstat_t **) calloc(i * sizeof (kstat_t *), 1);
+ ncpus = i;
+
+ /*
+ * stash the ksp for each CPU.
+ */
+ i = 0;
+ for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) {
+ if (strcmp(ksp->ks_module, "cpu_stat") == 0) {
+ cpu_ksp_list[i] = ksp;
+ i++;
+ }
+ }
+ }
+ return 0;
+}
+
+int calc_cpu_total()
+{
+ int i;
+ cpu_stat_t stat;
+ static int previous_total = 0, previous_used = 0;
+ int used, total, t, user = 0, wait = 0, kern = 0, idle = 0;
+
+ /*
+ * Read each cpu's data. If the kstat chain has changed (a state change
+ * has happened, maybe a new cpu was added to the system or one went
+ * away), then reinitialize everything with init_calc_cpu(). Finally,
+ * recursively call calc_cpu_total.
+ *
+ * We'll need to do a little better than this in the future, since we
+ * could recurse too much in the pathological case here.
+ */
+ if (which_cpu == -1) {
+ for (i = 0; i < ncpus; i++) {
+ if (kstat_read(kc, cpu_ksp_list[i],
+ (void *)&stat) == -1) {
+ if (init_calc_cpu() != 0) {
+ fprintf(stderr, "failed to "
+ "reinitialize following state "
+ "change\n");
+ return (-1);
+ }
+ return (calc_cpu_total());
+ }
+ user += stat.cpu_sysinfo.cpu[CPU_USER]; /* user */
+ wait += stat.cpu_sysinfo.cpu[CPU_WAIT]; /* io wait */
+ kern += stat.cpu_sysinfo.cpu[CPU_KERNEL]; /* sys */
+ idle += stat.cpu_sysinfo.cpu[CPU_IDLE]; /*idle("free")*/
+ }
+ } else {
+ if (kstat_read(kc, the_cpu, (void *)&stat) == -1) {
+ if (init_calc_cpu() != 0) {
+ fprintf(stderr, "failed to reinitialize "
+ "following state change\n");
+ return (-1);
+ }
+ return (calc_cpu_total());
+ }
+ user += stat.cpu_sysinfo.cpu[CPU_USER]; /* user */
+ wait += stat.cpu_sysinfo.cpu[CPU_WAIT]; /* io wait */
+ kern += stat.cpu_sysinfo.cpu[CPU_KERNEL]; /* sys */
+ idle += stat.cpu_sysinfo.cpu[CPU_IDLE]; /* idle("free") */
+ }
+
+ used = user + wait + kern;
+ total = used + idle;
+ t = 100 * (double)(used - previous_used) /
+ (double)(total - previous_total);
+ previous_total = total;
+ previous_used = used;
+ return (t);
+}
+
+#elif defined FREEBSD
+#include <nlist.h>
+#include <fcntl.h>
+#include <sys/dkstat.h>
+
+int init_calc_cpu()
+{
+
+ if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open")) == NULL)
+ {
+ printf("\nError: unable to open kvm\n\n");
+ exit(0);
+ }
+ kvm_nlist(kd, nlst);
+ if (nlst[0].n_type == 0)
+ {
+ printf("\nError: unable to get nlist\n\n");
+ exit(1);
+ }
+
+ return 0;
+}
+
+int calc_cpu_total() {
+ int total, used, t=0;
+ static int previous_total = 0, previous_used = 0;
+ int cpu,nice,system,idle;
+ unsigned long int cpu_time[CPUSTATES];
+
+ if (kvm_read(kd, nlst[0].n_value, &cpu_time, sizeof(cpu_time))
+ != sizeof(cpu_time))
+ {
+ printf("\nError reading kvm\n\n");
+ exit(0);
+ }
+
+ cpu = cpu_time[CP_USER];
+ nice = cpu_time[CP_NICE];
+ system = cpu_time[CP_SYS];
+ idle = cpu_time[CP_IDLE];
+
+ used = cpu + system + use_nice*nice;
+ total = used + idle + (1-use_nice)*nice;
+
+ t = 100 * (double)(used - previous_used) / (double)(total - previous_total);
+ previous_total = total;
+ previous_used = used;
+
+ return t;
+}
+
+#elif defined OPENBSD
+
+int init_calc_cpu()
+{
+ return 0;
+}
+
+int calc_cpu_total() {
+ double avenrun[3];
+
+ (void) getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
+ return(((5.0*avenrun[0] + 0.5) > 50) ? 50 : (5.0*avenrun[0] + 0.5))*2;
+}
+
+
+#elif defined NETBSD /* END OPENBSD */
+#include <sys/sched.h>
+#include <sys/sysctl.h>
+
+int init_calc_cpu ()
+{
+ return 0;
+}
+
+int calc_cpu_total ()
+{
+ static u_int64_t last_cp_time[CPUSTATES] = { 0, 0, 0, 0, 0 };
+ u_int64_t curr_cp_time[CPUSTATES];
+ u_int64_t total_time = 0, idle_time = 0;
+ int mib[2];
+ int i;
+ size_t ssize;
+ const int IDLE_TIME = 4;
+ const int NICE_TIME = 1;
+
+ ssize = sizeof ( curr_cp_time );
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_CP_TIME;
+ if ( sysctl ( mib, 2, curr_cp_time, &ssize, NULL, 0 ) ) {
+ fprintf ( stderr, "wmcube: unable to read CP_TIME from sysctl()\n" );
+ exit ( 0 );
+ }
+ if ( !use_nice )
+ curr_cp_time[NICE_TIME] = 0;
+
+ /* NetBSD gives 5 CPUSTATES -
+ * User, Nice, System, Interrupt, Idle
+ */
+ idle_time = curr_cp_time[IDLE_TIME] - last_cp_time[IDLE_TIME];
+ for ( i = 0; i < CPUSTATES; i++ ) {
+ total_time += ( curr_cp_time[i] - last_cp_time[i] );
+ last_cp_time[i] = curr_cp_time[i];
+ }
+
+ /* Calculate the % CPU usage as the User+Nice+System+Interrupt/Total
+ * for the interval
+ */
+ return ( 100 * (int) ( total_time - idle_time ) / total_time );
+
+}
+
+#else /* END NETBSD */
+
+/*
+ * This is a stub which will compile for platforms other than LINUX or SOLARIS.
+ * Use these to start your port to a new platform.
+ */
+int init_calc_cpu()
+{
+ return 0;
+}
+
+int calc_cpu_total()
+{
+ return 0;
+}
+
+#endif /* OS SPECIFIC CODE */
diff --git a/wmcube/wmcube.xpm b/wmcube/wmcube.xpm
new file mode 100644
index 0000000..f72c004
--- /dev/null
+++ b/wmcube/wmcube.xpm
@@ -0,0 +1,142 @@
+/* XPM */
+static char * wmcube_xpm[] = {
+"160 100 39 1",
+" c blue",
+". c #202020",
+"X c black",
+"o c #C7C3C7",
+"O c #20B2AE",
+"+ c #007D71",
+"@ c #B60418",
+"# c #00EB00",
+"$ c #283C38",
+"% c #F7F3FF",
+"& c #004941",
+"! c #1A8E8A",
+"A c #20AFAB",
+"B c #1FACA9",
+"C c #1EA9A5",
+"D c #1EA5A1",
+"E c #1DA19E",
+"F c #1C9C99",
+"G c #1B9894",
+"H c #1B928F",
+"I c #1A8E8A",
+"J c #198985",
+"K c #178480",
+"L c #177F7B",
+"M c #167A77",
+"N c #157672",
+"P c #14716E",
+"Q c #136C69",
+"R c #136764",
+"S c #116360",
+"T c #115E5A",
+"U c #115D5B",
+"V c #0F5956",
+"W c #0F5351",
+"Y c #0E4E4D",
+"Z c #0E4E4C",
+"1 c #0D4A48",
+"2 c #0C4644",
+"3 c #0C4240",
+" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX O!",
+" .............oX......................................................o ",
+" .............oX......................................................o ",
+" .............oX......................................................o ",
+" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .............oX......................................................o ",
+" .......................................................o .............oX......................................................o ",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX..............................................&&......o..........................",
+" .......................................................o .............oX..............................................&&......o..........................",
+" .......................................................o .............oX.....&&&&&&.................................&&&&&&....o..........................",
+" .......................................................o .............oX.....&&&&&&.................................&&&&&&....o..........................",
+" .......................................................o .............oX..............................................&&......o..........................",
+" .......................................................o .............oX..............................................&&......o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o .............oX......................................................o..........................",
+" .......................................................o oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo..........................",
+" .......................................................o . OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+" .......................................................o . AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
+" .......................................................o . BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
+" oooooooooooooooooooooooooooooooooooooooooooooooooooooooo . CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC",
+" . EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE",
+" . FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
+" . GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG",
+" . HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH",
+"............................................................................... IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII",
+"..OOO.....+..+OOO+.+OOO+.+...+.+OOO+.+OOO+.+OOO+.+OOO+.+OOO+................... JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ",
+".O...O....O......O.....O.O...O.O.....O.........O.O...O.O...O............O...... KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK",
+".O...O....O......O.....O.O...O.O.....O.........O.O...O.O...O............O...... LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL",
+".+...+....+..+OOO+..OOO+.+OOO+.+OOO+.+OOO+.....+.&OOO&.+OOO+...........O....... MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM",
+".O...O....O..O.........O.....O.....O.O...O.....O.O...O.....O...........O....... NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN",
+".O...O....O..O.........O.....O.....O.O...O.....O.O...O.....O...O...O..O.....O.. PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP",
+"..OOO.....O..+OOO+.+OOO+.....+.+OOO+.+OOO+.....+.+OOO+.+OOO+...+...+..O.....+.. QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ",
+"............................................................................... RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR",
+" SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS",
+"................................................................................................................................................................",
+".&OOO&.+OOO..+OOO+.+OOO..+OOO+.+OOO+.+OOO+.+...+...+.......+.+...+.+.....O...O.+OOO..+OOO+.+OOO+.+OOO+.+OOO+.+OOO+.+OOO+.+...+.+...+.+...+.+...+.+...+..........",
+".O...O.O...O.O.....O...O.O.....O.....O.....O...O...O.......O.O...O.O.....OO.OO.O...O.O...O.O...O.O...O.O...O.O.......O...O...O.O...O.O...O.O...O.O...O.O...O....",
+".O...O.O...O.O.....O...O.O.....O.....O.....O...O...O.......O.O..O..O.....O.O.O.O...O.O...O.O...O.O...O.O...O.O.......O...O...O.O...O.O...O..O.O..O...O....O.....",
+".+OOO+.+OOO..+.....+...+.+OOO..+OOO..+.OO+.+OOO+...+.......+.+OO&..+.....+...+.+...+.+...+.+OOO+.+O..+.+OOO..+OOO+...+...+...+.+...+.+...+..&O&..+OOO+...O......",
+".O...O.O...O.O.....O...O.O.....O.....O...O.O...O...O.......O.O..O..O.....O...O.O...O.O...O.O.....O.O.O.O...O.....O...O...O...O.O+.+O.O.O.O..O.O......O..O.......",
+".O...O.O...O.O.....O...O.O.....O.....O...O.O...O...O.......O.O...O.O.....O...O.O...O.O...O.O.....O..OO.O...O.....O...O...O...O..O+O..OO.OO.O...O.....O.O...O....",
+".+...+.+OOO..+OOO+.OOOO..+OOO+.O.....+OOO+.+...+...O...+OOO+.+...+.+OOO&.+...+.O...O.+OOO+.+.....+OOO+.+...+.+OOO+...+...&OOOO...O...O...O.+...O.+OOO+..........",
+"................................................................................................................................................................",
+" TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT",
+"...............O... UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU",
+"...++.............. VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
+"...++........&OOO&. WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW",
+".++++++++++++O...O. YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY",
+".++++++++++++O...O. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ",
+"...++........+OOO+. 11111111111111111111111111111111111111111111111111111111",
+"...++........O...O. 22222222222222222222222222222222222222222222222222222222",
+".............+...+. 33333333333333333333333333333333333333333333333333333333",
+"................... ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" "};
diff --git a/wmgeneral/list.c b/wmgeneral/list.c
new file mode 100644
index 0000000..f804b2c
--- /dev/null
+++ b/wmgeneral/list.c
@@ -0,0 +1,169 @@
+/* Generic single linked list to keep various information
+ Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+
+
+Author: Kresten Krab Thorup
+
+Many modifications by Alfredo K. Kojima
+
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* As a special exception, if you link this library with files compiled with
+ GCC to produce an executable, this does not cause the resulting executable
+ to be covered by the GNU General Public License. This exception does not
+ however invalidate any other reasons why the executable file might be
+ covered by the GNU General Public License. */
+
+#include "list.h"
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#include <stdlib.h>
+
+/* Return a cons cell produced from (head . tail) */
+
+INLINE LinkedList*
+list_cons(void* head, LinkedList* tail)
+{
+ LinkedList* cell;
+
+ cell = (LinkedList*)malloc(sizeof(LinkedList));
+ cell->head = head;
+ cell->tail = tail;
+ return cell;
+}
+
+/* Return the length of a list, list_length(NULL) returns zero */
+
+INLINE int
+list_length(LinkedList* list)
+{
+ int i = 0;
+ while(list)
+ {
+ i += 1;
+ list = list->tail;
+ }
+ return i;
+}
+
+/* Return the Nth element of LIST, where N count from zero. If N
+ larger than the list length, NULL is returned */
+
+INLINE void*
+list_nth(int index, LinkedList* list)
+{
+ while(index-- != 0)
+ {
+ if(list->tail)
+ list = list->tail;
+ else
+ return 0;
+ }
+ return list->head;
+}
+
+/* Remove the element at the head by replacing it by its successor */
+
+INLINE void
+list_remove_head(LinkedList** list)
+{
+ if (!*list) return;
+ if ((*list)->tail)
+ {
+ LinkedList* tail = (*list)->tail; /* fetch next */
+ *(*list) = *tail; /* copy next to list head */
+ free(tail); /* free next */
+ }
+ else /* only one element in list */
+ {
+ free(*list);
+ (*list) = 0;
+ }
+}
+
+
+/* Remove the element with `car' set to ELEMENT */
+/*
+INLINE void
+list_remove_elem(LinkedList** list, void* elem)
+{
+ while (*list)
+ {
+ if ((*list)->head == elem)
+ list_remove_head(list);
+ *list = (*list ? (*list)->tail : NULL);
+ }
+}*/
+
+INLINE LinkedList *
+list_remove_elem(LinkedList* list, void* elem)
+{
+ LinkedList *tmp;
+
+ if (list) {
+ if (list->head == elem) {
+ tmp = list->tail;
+ free(list);
+ return tmp;
+ }
+ list->tail = list_remove_elem(list->tail, elem);
+ return list;
+ }
+ return NULL;
+}
+
+
+/* Return element that has ELEM as car */
+
+INLINE LinkedList*
+list_find(LinkedList* list, void* elem)
+{
+ while(list)
+ {
+ if (list->head == elem)
+ return list;
+ list = list->tail;
+ }
+ return NULL;
+}
+
+/* Free list (backwards recursive) */
+
+INLINE void
+list_free(LinkedList* list)
+{
+ if(list)
+ {
+ list_free(list->tail);
+ free(list);
+ }
+}
+
+/* Map FUNCTION over all elements in LIST */
+
+INLINE void
+list_mapcar(LinkedList* list, void(*function)(void*))
+{
+ while(list)
+ {
+ (*function)(list->head);
+ list = list->tail;
+ }
+}
diff --git a/wmgeneral/list.h b/wmgeneral/list.h
new file mode 100644
index 0000000..af0f22c
--- /dev/null
+++ b/wmgeneral/list.h
@@ -0,0 +1,59 @@
+/* Generic single linked list to keep various information
+ Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+
+Author: Kresten Krab Thorup
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* As a special exception, if you link this library with files compiled with
+ GCC to produce an executable, this does not cause the resulting executable
+ to be covered by the GNU General Public License. This exception does not
+ however invalidate any other reasons why the executable file might be
+ covered by the GNU General Public License. */
+
+#ifndef __LIST_H_
+#define __LIST_H_
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+# define INLINE inline
+#else
+# define INLINE
+#endif
+
+typedef struct LinkedList {
+ void *head;
+ struct LinkedList *tail;
+} LinkedList;
+
+INLINE LinkedList* list_cons(void* head, LinkedList* tail);
+
+INLINE int list_length(LinkedList* list);
+
+INLINE void* list_nth(int index, LinkedList* list);
+
+INLINE void list_remove_head(LinkedList** list);
+
+INLINE LinkedList *list_remove_elem(LinkedList* list, void* elem);
+
+INLINE void list_mapcar(LinkedList* list, void(*function)(void*));
+
+INLINE LinkedList*list_find(LinkedList* list, void* elem);
+
+INLINE void list_free(LinkedList* list);
+
+#endif
diff --git a/wmgeneral/misc.c b/wmgeneral/misc.c
new file mode 100644
index 0000000..34281e2
--- /dev/null
+++ b/wmgeneral/misc.c
@@ -0,0 +1,164 @@
+/* dock.c- built-in Dock module for WindowMaker
+ *
+ * WindowMaker window manager
+ *
+ * Copyright (c) 1997 Alfredo K. Kojima
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "list.h"
+#include "misc.h"
+
+/*
+ *----------------------------------------------------------------------
+ * parse_command--
+ * Divides a command line into a argv/argc pair.
+ *----------------------------------------------------------------------
+ */
+#define PRC_ALPHA 0
+#define PRC_BLANK 1
+#define PRC_ESCAPE 2
+#define PRC_DQUOTE 3
+#define PRC_EOS 4
+#define PRC_SQUOTE 5
+
+typedef struct {
+ short nstate;
+ short output;
+} DFA;
+
+
+static DFA mtable[9][6] = {
+ {{3,1},{0,0},{4,0},{1,0},{8,0},{6,0}},
+ {{1,1},{1,1},{2,0},{3,0},{5,0},{1,1}},
+ {{1,1},{1,1},{1,1},{1,1},{5,0},{1,1}},
+ {{3,1},{5,0},{4,0},{1,0},{5,0},{6,0}},
+ {{3,1},{3,1},{3,1},{3,1},{5,0},{3,1}},
+ {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
+ {{6,1},{6,1},{7,0},{6,1},{5,0},{3,0}},
+ {{6,1},{6,1},{6,1},{6,1},{5,0},{6,1}},
+ {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
+};
+
+char*
+next_token(char *word, char **next)
+{
+ char *ptr;
+ char *ret, *t;
+ int state, ctype;
+
+ t = ret = malloc(strlen(word)+1);
+ ptr = word;
+
+ state = 0;
+ *t = 0;
+ while (1) {
+ if (*ptr==0)
+ ctype = PRC_EOS;
+ else if (*ptr=='\\')
+ ctype = PRC_ESCAPE;
+ else if (*ptr=='"')
+ ctype = PRC_DQUOTE;
+ else if (*ptr=='\'')
+ ctype = PRC_SQUOTE;
+ else if (*ptr==' ' || *ptr=='\t')
+ ctype = PRC_BLANK;
+ else
+ ctype = PRC_ALPHA;
+
+ if (mtable[state][ctype].output) {
+ *t = *ptr; t++;
+ *t = 0;
+ }
+ state = mtable[state][ctype].nstate;
+ ptr++;
+ if (mtable[state][0].output<0) {
+ break;
+ }
+ }
+
+ if (*ret==0)
+ t = NULL;
+ else
+ t = strdup(ret);
+
+ free(ret);
+
+ if (ctype==PRC_EOS)
+ *next = NULL;
+ else
+ *next = ptr;
+
+ return t;
+}
+
+
+extern void
+parse_command(char *command, char ***argv, int *argc)
+{
+ LinkedList *list = NULL;
+ char *token, *line;
+ int count, i;
+
+ line = command;
+ do {
+ token = next_token(line, &line);
+ if (token) {
+ list = list_cons(token, list);
+ }
+ } while (token!=NULL && line!=NULL);
+
+ count = list_length(list);
+ *argv = malloc(sizeof(char*)*count);
+ i = count;
+ while (list!=NULL) {
+ (*argv)[--i] = list->head;
+ list_remove_head(&list);
+ }
+ *argc = count;
+}
+
+extern pid_t
+execCommand(char *command)
+{
+ pid_t pid;
+ char **argv;
+ int argc;
+
+ parse_command(command, &argv, &argc);
+
+ if (argv==NULL) {
+ return 0;
+ }
+
+ if ((pid=fork())==0) {
+ char **args;
+ int i;
+
+ args = malloc(sizeof(char*)*(argc+1));
+ if (!args)
+ exit(10);
+ for (i=0; i<argc; i++) {
+ args[i] = argv[i];
+ }
+ args[argc] = NULL;
+ execvp(argv[0], args);
+ exit(10);
+ }
+ return pid;
+}
diff --git a/wmgeneral/misc.h b/wmgeneral/misc.h
new file mode 100644
index 0000000..602e1b7
--- /dev/null
+++ b/wmgeneral/misc.h
@@ -0,0 +1,9 @@
+#ifndef __MISC_H
+#define __MISC_H
+
+#include <unistd.h>
+
+extern void parse_command(char *, char ***, int *);
+
+extern pid_t execCommand(char *);
+#endif /* __MISC_H */
diff --git a/wmgeneral/wmgeneral.c b/wmgeneral/wmgeneral.c
new file mode 100644
index 0000000..56b7bd6
--- /dev/null
+++ b/wmgeneral/wmgeneral.c
@@ -0,0 +1,481 @@
+/*
+ Best viewed with vim5, using ts=4
+
+ wmgeneral was taken from wmppp.
+
+ It has a lot of routines which most of the wm* programs use.
+
+ ------------------------------------------------------------
+
+ Author: Martijn Pieterse (pieterse at xs4all.nl)
+
+ ---
+ CHANGES:
+ ---
+ 14/09/1998 (Dave Clark, clarkd at skyia.com)
+ * Updated createXBMfromXPM routine
+ * Now supports >256 colors
+ 11/09/1998 (Martijn Pieterse, pieterse at xs4all.nl)
+ * Removed a bug from parse_rcfile. You could
+ not use "start" in a command if a label was
+ also start.
+ * Changed the needed geometry string.
+ We don't use window size, and don't support
+ negative positions.
+ 03/09/1998 (Martijn Pieterse, pieterse at xs4all.nl)
+ * Added parse_rcfile2
+ 02/09/1998 (Martijn Pieterse, pieterse at xs4all.nl)
+ * Added -geometry support (untested)
+ 28/08/1998 (Martijn Pieterse, pieterse at xs4all.nl)
+ * Added createXBMfromXPM routine
+ * Saves a lot of work with changing xpm's.
+ 02/05/1998 (Martijn Pieterse, pieterse at xs4all.nl)
+ * changed the read_rc_file to parse_rcfile, as suggested by Marcelo E. Magallon
+ * debugged the parse_rc file.
+ 30/04/1998 (Martijn Pieterse, pieterse at xs4all.nl)
+ * Ripped similar code from all the wm* programs,
+ and put them in a single file.
+
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <stdarg.h>
+
+#include <X11/Xlib.h>
+#include <X11/xpm.h>
+#include <X11/extensions/shape.h>
+
+#include "wmgeneral.h"
+
+ /*****************/
+ /* X11 Variables */
+/*****************/
+
+Window Root;
+int screen;
+int x_fd;
+int d_depth;
+XSizeHints mysizehints;
+XWMHints mywmhints;
+Pixel back_pix, fore_pix;
+char *Geometry = "";
+Window iconwin, win;
+GC NormalGC;
+XpmIcon wmgen;
+Pixmap pixmask;
+
+ /*****************/
+ /* Mouse Regions */
+/*****************/
+
+typedef struct {
+ int enable;
+ int top;
+ int bottom;
+ int left;
+ int right;
+} MOUSE_REGION;
+
+MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
+
+ /***********************/
+ /* Function Prototypes */
+/***********************/
+
+static void GetXPM(XpmIcon *, char **);
+static Pixel GetColor(char *);
+void RedrawWindow(void);
+void AddMouseRegion(int, int, int, int, int);
+int CheckMouseRegion(int, int);
+
+/*******************************************************************************\
+|* parse_rcfile *|
+\*******************************************************************************/
+
+void parse_rcfile(const char *filename, rckeys *keys) {
+
+ char *p,*q;
+ char temp[128];
+ char *tokens = " :\t\n";
+ FILE *fp;
+ int i,key;
+
+ fp = fopen(filename, "r");
+ if (fp) {
+ while (fgets(temp, 128, fp)) {
+ key = 0;
+ q = strdup(temp);
+ q = strtok(q, tokens);
+ while (key >= 0 && keys[key].label) {
+ if ((!strcmp(q, keys[key].label))) {
+ p = strstr(temp, keys[key].label);
+ p += strlen(keys[key].label);
+ p += strspn(p, tokens);
+ if ((i = strcspn(p, "#\n"))) p[i] = 0;
+ free(*keys[key].var);
+ *keys[key].var = strdup(p);
+ key = -1;
+ } else key++;
+ }
+ free(q);
+ }
+ fclose(fp);
+ }
+}
+
+/*******************************************************************************\
+|* parse_rcfile2 *|
+\*******************************************************************************/
+
+void parse_rcfile2(const char *filename, rckeys2 *keys) {
+
+ char *p;
+ char temp[128];
+ char *tokens = " :\t\n";
+ FILE *fp;
+ int i,key;
+ char *family = NULL;
+
+ fp = fopen(filename, "r");
+ if (fp) {
+ while (fgets(temp, 128, fp)) {
+ key = 0;
+ while (key >= 0 && keys[key].label) {
+ if ((p = strstr(temp, keys[key].label))) {
+ p += strlen(keys[key].label);
+ p += strspn(p, tokens);
+ if ((i = strcspn(p, "#\n"))) p[i] = 0;
+ free(*keys[key].var);
+ *keys[key].var = strdup(p);
+ key = -1;
+ } else key++;
+ }
+ }
+ fclose(fp);
+ }
+ free(family);
+}
+
+
+/*******************************************************************************\
+|* GetXPM *|
+\*******************************************************************************/
+
+static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
+
+ XWindowAttributes attributes;
+ int err;
+
+ /* For the colormap */
+ XGetWindowAttributes(display, Root, &attributes);
+
+ wmgen->attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
+
+ err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap),
+ &(wmgen->mask), &(wmgen->attributes));
+
+ if (err != XpmSuccess) {
+ fprintf(stderr, "Not enough free colorcells.\n");
+ exit(1);
+ }
+}
+
+/*******************************************************************************\
+|* GetColor *|
+\*******************************************************************************/
+
+static Pixel GetColor(char *name) {
+
+ XColor color;
+ XWindowAttributes attributes;
+
+ XGetWindowAttributes(display, Root, &attributes);
+
+ color.pixel = 0;
+ if (!XParseColor(display, attributes.colormap, name, &color)) {
+ fprintf(stderr, "wm.app: can't parse %s.\n", name);
+ } else if (!XAllocColor(display, attributes.colormap, &color)) {
+ fprintf(stderr, "wm.app: can't allocate %s.\n", name);
+ }
+ return color.pixel;
+}
+
+/*******************************************************************************\
+|* flush_expose *|
+\*******************************************************************************/
+
+static int flush_expose(Window w) {
+
+ XEvent dummy;
+ int i=0;
+
+ while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
+ i++;
+
+ return i;
+}
+
+/*******************************************************************************\
+|* RedrawWindow *|
+\*******************************************************************************/
+
+void RedrawWindow(void) {
+
+ flush_expose(iconwin);
+ XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
+ 0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+ flush_expose(win);
+ XCopyArea(display, wmgen.pixmap, win, NormalGC,
+ 0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+}
+
+/*******************************************************************************\
+|* RedrawWindowXY *|
+\*******************************************************************************/
+
+void RedrawWindowXY(int x, int y) {
+
+ flush_expose(iconwin);
+ XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
+ x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+ flush_expose(win);
+ XCopyArea(display, wmgen.pixmap, win, NormalGC,
+ x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+}
+
+/*******************************************************************************\
+|* AddMouseRegion *|
+\*******************************************************************************/
+
+void AddMouseRegion(int index, int left, int top, int right, int bottom) {
+
+ if (index < MAX_MOUSE_REGION) {
+ mouse_region[index].enable = 1;
+ mouse_region[index].top = top;
+ mouse_region[index].left = left;
+ mouse_region[index].bottom = bottom;
+ mouse_region[index].right = right;
+ }
+}
+
+/*******************************************************************************\
+|* CheckMouseRegion *|
+\*******************************************************************************/
+
+int CheckMouseRegion(int x, int y) {
+
+ int i;
+ int found;
+
+ found = 0;
+
+ for (i=0; i<MAX_MOUSE_REGION && !found; i++) {
+ if (mouse_region[i].enable &&
+ x <= mouse_region[i].right &&
+ x >= mouse_region[i].left &&
+ y <= mouse_region[i].bottom &&
+ y >= mouse_region[i].top)
+ found = 1;
+ }
+ if (!found) return -1;
+ return (i-1);
+}
+
+/*******************************************************************************\
+|* createXBMfromXPM *|
+\*******************************************************************************/
+void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
+
+ int i,j,k;
+ int width, height, numcol, depth;
+ int zero=0;
+ unsigned char bwrite;
+ int bcount;
+ int curpixel;
+
+ sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
+
+
+ for (k=0; k!=depth; k++)
+ {
+ zero <<=8;
+ zero |= xpm[1][k];
+ }
+
+ for (i=numcol+1; i < numcol+sy+1; i++) {
+ bcount = 0;
+ bwrite = 0;
+ for (j=0; j<sx*depth; j+=depth) {
+ bwrite >>= 1;
+
+ curpixel=0;
+ for (k=0; k!=depth; k++)
+ {
+ curpixel <<=8;
+ curpixel |= xpm[i][j+k];
+ }
+
+ if ( curpixel != zero ) {
+ bwrite += 128;
+ }
+ bcount++;
+ if (bcount == 8) {
+ *xbm = bwrite;
+ xbm++;
+ bcount = 0;
+ bwrite = 0;
+ }
+ }
+ }
+}
+
+/*******************************************************************************\
+|* copyXPMArea *|
+\*******************************************************************************/
+
+void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
+
+ XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
+
+}
+
+/*******************************************************************************\
+|* copyXBMArea *|
+\*******************************************************************************/
+
+void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
+
+ XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
+}
+
+
+/*******************************************************************************\
+|* setMaskXY *|
+\*******************************************************************************/
+
+void setMaskXY(int x, int y) {
+
+ XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet);
+ XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet);
+}
+
+/*******************************************************************************\
+|* openXwindow *|
+\*******************************************************************************/
+void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height) {
+
+ unsigned int borderwidth = 1;
+ XClassHint classHint;
+ char *display_name = NULL;
+ char *wname = argv[0];
+ XTextProperty name;
+
+ XGCValues gcv;
+ unsigned long gcm;
+
+ char *geometry = NULL;
+
+ int dummy=0;
+ int i, wx, wy;
+
+ for (i=1; argv[i]; i++) {
+ if (!strcmp(argv[i], "-display")) {
+ display_name = argv[i+1];
+ i++;
+ }
+ if (!strcmp(argv[i], "-geometry")) {
+ geometry = argv[i+1];
+ i++;
+ }
+ }
+
+ if (!(display = XOpenDisplay(display_name))) {
+ fprintf(stderr, "%s: can't open display %s\n",
+ wname, XDisplayName(display_name));
+ exit(1);
+ }
+ screen = DefaultScreen(display);
+ Root = RootWindow(display, screen);
+ d_depth = DefaultDepth(display, screen);
+ x_fd = XConnectionNumber(display);
+
+ /* Convert XPM to XImage */
+ GetXPM(&wmgen, pixmap_bytes);
+
+ /* Create a window to hold the stuff */
+ mysizehints.flags = USSize | USPosition;
+ mysizehints.x = 0;
+ mysizehints.y = 0;
+
+ back_pix = GetColor("white");
+ fore_pix = GetColor("black");
+
+ XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
+ &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
+
+ mysizehints.width = 64;
+ mysizehints.height = 64;
+
+ win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
+ mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
+
+ iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
+ mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
+
+ /* Activate hints */
+ XSetWMNormalHints(display, win, &mysizehints);
+ classHint.res_name = wname;
+ classHint.res_class = wname;
+ XSetClassHint(display, win, &classHint);
+
+ XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
+ XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
+
+ if (XStringListToTextProperty(&wname, 1, &name) == 0) {
+ fprintf(stderr, "%s: can't allocate window name\n", wname);
+ exit(1);
+ }
+
+ XSetWMName(display, win, &name);
+
+ /* Create GC for drawing */
+
+ gcm = GCForeground | GCBackground | GCGraphicsExposures;
+ gcv.foreground = fore_pix;
+ gcv.background = back_pix;
+ gcv.graphics_exposures = 0;
+ NormalGC = XCreateGC(display, Root, gcm, &gcv);
+
+ /* ONLYSHAPE ON */
+
+ pixmask = XCreateBitmapFromData(display, win, pixmask_bits, pixmask_width, pixmask_height);
+
+ XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet);
+ XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet);
+
+ /* ONLYSHAPE OFF */
+
+ mywmhints.initial_state = WithdrawnState;
+ mywmhints.icon_window = iconwin;
+ mywmhints.icon_x = mysizehints.x;
+ mywmhints.icon_y = mysizehints.y;
+ mywmhints.window_group = win;
+ mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
+
+ XSetWMHints(display, win, &mywmhints);
+
+ XSetCommand(display, win, argv, argc);
+ XMapWindow(display, win);
+
+ if (geometry) {
+ if (sscanf(geometry, "+%d+%d", &wx, &wy) != 2) {
+ fprintf(stderr, "Bad geometry string.\n");
+ exit(1);
+ }
+ XMoveWindow(display, win, wx, wy);
+ }
+}
diff --git a/wmgeneral/wmgeneral.h b/wmgeneral/wmgeneral.h
new file mode 100644
index 0000000..e9d6ca6
--- /dev/null
+++ b/wmgeneral/wmgeneral.h
@@ -0,0 +1,59 @@
+#ifndef WMGENERAL_H_INCLUDED
+#define WMGENERAL_H_INCLUDED
+
+ /***********/
+ /* Defines */
+/***********/
+
+#define MAX_MOUSE_REGION (16)
+
+ /************/
+ /* Typedefs */
+/************/
+
+typedef struct _rckeys rckeys;
+
+struct _rckeys {
+ const char *label;
+ char **var;
+};
+
+typedef struct _rckeys2 rckeys2;
+
+struct _rckeys2 {
+ const char *family;
+ const char *label;
+ char **var;
+};
+
+typedef struct {
+ Pixmap pixmap;
+ Pixmap mask;
+ XpmAttributes attributes;
+} XpmIcon;
+
+ /*******************/
+ /* Global variable */
+/*******************/
+
+Display *display;
+
+ /***********************/
+ /* Function Prototypes */
+/***********************/
+
+void AddMouseRegion(int index, int left, int top, int right, int bottom);
+int CheckMouseRegion(int x, int y);
+
+void openXwindow(int argc, char *argv[], char **, char *, int, int);
+void RedrawWindow(void);
+void RedrawWindowXY(int x, int y);
+
+void createXBMfromXPM(char *, char **, int, int);
+void copyXPMArea(int, int, int, int, int, int);
+void copyXBMArea(int, int, int, int, int, int);
+void setMaskXY(int, int);
+
+void parse_rcfile(const char *, rckeys *);
+
+#endif
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmcube.git
More information about the Pkg-wmaker-commits
mailing list