A demo program for DOGL-128 LCD module. Based on Mike Sheldon's 3D Tie Fighter demo.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
igorsk
Date:
Thu Jan 14 00:49:39 2010 +0000
Commit message:

Changed in this revision

Graphics/Cuboid.cpp Show annotated file Show diff for this revision Revisions of this file
Graphics/Cuboid.h Show annotated file Show diff for this revision Revisions of this file
Graphics/Graphics.cpp Show annotated file Show diff for this revision Revisions of this file
Graphics/Graphics.h Show annotated file Show diff for this revision Revisions of this file
Graphics/Object3D.cpp Show annotated file Show diff for this revision Revisions of this file
Graphics/Object3D.h Show annotated file Show diff for this revision Revisions of this file
Graphics/TrimeshObject.cpp Show annotated file Show diff for this revision Revisions of this file
Graphics/TrimeshObject.h Show annotated file Show diff for this revision Revisions of this file
LCD/AbstractLCD.h Show annotated file Show diff for this revision Revisions of this file
LCD/DogLCD.cpp Show annotated file Show diff for this revision Revisions of this file
LCD/DogLCD.h Show annotated file Show diff for this revision Revisions of this file
TieFighter.h Show annotated file Show diff for this revision Revisions of this file
hellombed.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Graphics/Cuboid.cpp	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,100 @@
+/* 
+ * libmbed-graphics 2D and wireframe 3D graphics library for the MBED
+ * microcontroller platform
+ * Copyright (C) <2009> Michael Sheldon <mike@mikeasoft.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "Cuboid.h"
+
+// six sides, four vertices in each
+int _cube[6][4][3]={
+    {
+        {-10,-10,-10},
+        { 10,-10,-10},
+        { 10, 10,-10},
+        {-10, 10,-10}
+    },{
+        {-10,-10, 10},
+        { 10,-10, 10},
+        { 10, 10, 10},
+        {-10, 10, 10}
+    },{
+        {-10,-10,-10},
+        { 10,-10,-10},
+        { 10,-10, 10},
+        {-10,-10, 10}
+    },{
+        {-10, 10,-10},
+        { 10, 10,-10},
+        { 10, 10, 10},
+        {-10, 10, 10}
+    },{
+        {-10,-10,-10},
+        {-10, 10,-10},
+        {-10, 10, 10},
+        {-10,-10, 10}
+    },{
+        { 10,-10,-10},
+        { 10, 10,-10},
+        { 10, 10, 10},
+        { 10,-10, 10}
+    }
+};
+
+
+Cuboid::Cuboid()
+        : Object3D::Object3D()  {
+
+}
+
+void Cuboid::render(Graphics &g)
+{
+    int side, v;
+    int x[4], y[4], z[4];
+    
+    for (side = 0; side < 6; side++)
+    {
+        for (v = 0; v < 4; v++)
+        {
+            x[v] = _cube[side][v][0];
+            y[v] = _cube[side][v][1];
+            z[v] = _cube[side][v][2];
+        }
+        rotate3d(x, y, z, _rx, _ry, _rz, 4);
+        for (v = 0; v < 4; v++)
+        {
+            x[v] += _x;
+            y[v] += _y;
+            z[v] += _z;
+        }
+        for (v = 0; v < 4; v++)
+        {
+            g.line3d(x[v], y[v], z[v], x[(v+1)%4], y[(v+1)%4], z[(v+1)%4], _colour);
+        }
+    }
+
+    /*x0 = _cube[1][0][0];
+    y0 = _cube[1][0][1];
+    z0 = _cube[1][0][2];
+    rotate3d(&x0, &y0, &z0, _rx, _ry, _rz);
+    x1 = _cube[0][0][0];
+    y1 = _cube[0][0][1];
+    z1 = _cube[0][0][2];
+    rotate3d(&x1, &y1, &z1, _rx, _ry, _rz);
+    g.line3d(x0 + _x, y0 + _y, z0 + _z, x1 + _x, y1 + _y, z1 + _z, _colour);*/
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Graphics/Cuboid.h	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,44 @@
+/* 
+ * libmbed-graphics 2D and wireframe 3D graphics library for the MBED
+ * microcontroller platform
+ * Copyright (C) <2009> Michael Sheldon <mike@mikeasoft.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+ 
+#ifndef MBED_CUBOID_H
+#define MBED_CUBOID_H
+
+#include "Object3D.h"
+
+/* Class: Cuboid
+ * Displays a 3D wireframe cuboid.
+ */
+class Cuboid : public Object3D {
+
+    public:
+        Cuboid();
+        
+        /* Function: render
+         * Draws the cuboid to the specified graphical context.
+         *
+         * Parameters:
+         * g - The graphical context to which this cuboid should be rendered.
+         */
+        virtual void render(Graphics &g);
+        
+};
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Graphics/Graphics.cpp	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,117 @@
+/* 
+ * libmbed-graphics 2D and wireframe 3D graphics library for the MBED
+ * microcontroller platform
+ * Copyright (C) <2009> Michael Sheldon <mike@mikeasoft.com>
+ * Optimized and adapted for AbstractLCD interface
+ * Copyright (C) <2010> Igor Skochinsky <skochinsky@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "Graphics.h"
+
+// swap two values
+#define SWAP(a, b) (((a) == (b)) || (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b))))
+
+Graphics::Graphics(AbstractLCD *lcd)
+    : _lcd(lcd) { 
+    _cx3d = _lcd->width() / 2;
+    _cy3d = _lcd->height() / 2;
+    _cz3d = 150;
+}
+
+void Graphics::line(int x0, int y0, int x1, int y1, int colour) {
+    // Bresenham
+    //printf("line(%d, %d, %d, %d, %d)\n", x0, y0, x1, y1, colour);
+    bool steep = abs(y1 - y0) > abs(x1 - x0);
+    int temp, deltax, deltay, error, ystep, y, x;
+    if (steep) {
+        temp = y0;
+        y0 = x0;
+        x0 = temp;
+        temp = y1;
+        y1 = x1;
+        x1 = temp;
+    }
+    if (x0 > x1) {
+        temp = x1;
+        x1 = x0;
+        x0 = temp;
+        temp = y1;
+        y1 = y0;
+        y0 = temp;
+    }
+    deltax = x1 - x0;
+    deltay = abs(y1 - y0);
+    error = deltax / 2;
+    y = y0;
+    if (y0 < y1) {
+        ystep = 1;
+    } else {
+        ystep = -1;
+    }
+    for (x=x0; x<=x1; x++) {
+        if (steep) {
+            _lcd->pixel(y, x, colour);
+        } else {
+            _lcd->pixel(x, y, colour);
+        }
+        error = error - deltay;
+        if (error < 0) {
+            y = y + ystep;
+            error = error + deltax;
+        }
+    }
+}
+
+void Graphics::line3d(int x0, int y0, int z0, int x1, int y1, int z1, int colour) {
+    if (z0 + _cz3d <= 0 || z1 + _cz3d <= 0) {
+        // Behind the camera
+        return;
+    }
+    
+    int u0 = _cx3d + x0 * _cz3d / (z0 + _cz3d);
+    int v0 = _cy3d + y0 * _cz3d / (z0 + _cz3d);
+    int u1 = _cx3d + x1 * _cz3d / (z1 + _cz3d);
+    int v1 = _cy3d + y1 * _cz3d / (z1 + _cz3d);
+    line(u0, v0, u1, v1, colour);
+}
+
+void Graphics::circle(int cx, int cy, int radius, int colour) {
+    int x = 0;
+    int y = radius;
+    int d = 3 - (2 * radius);
+
+    while (x <= y) {
+        _lcd->pixel(cx + x, cy + y, colour);
+        _lcd->pixel(cx + y, cy + x, colour);
+        _lcd->pixel(cx - x, cy + y, colour);
+        _lcd->pixel(cx + y, cy - x, colour);
+        _lcd->pixel(cx - x, cy - y, colour);
+        _lcd->pixel(cx - y, cy - x, colour);
+        _lcd->pixel(cx + x, cy - y, colour);
+        _lcd->pixel(cx - y, cy + x, colour);
+
+        if (d<0)
+            d += (4 * x) + 6;
+        else
+        {
+            d += (4 * (x - y)) + 10;
+            y--;
+        }
+        x++;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Graphics/Graphics.h	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,90 @@
+/* 
+ * libmbed-graphics 2D and wireframe 3D graphics library for the MBED
+ * microcontroller platform
+ * Copyright (C) <2009> Michael Sheldon <mike@mikeasoft.com>
+ * Optimized and adapted for AbstractLCD interface
+ * Copyright (C) <2010> Igor Skochinsky <skochinsky@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MBED_GRAPHICS_H
+#define MBED_GRAPHICS_H
+
+#include "mbed.h"
+#include "AbstractLCD.h"
+
+/* Class: Graphics
+ * A general purpose graphics library providing 2D and wireframe 3D functionality. 
+ * Needs an implementation of AbstractLCD interface to work.
+ */
+class Graphics 
+{
+
+    public:
+        /* Constructor: Graphics
+         * Instantiate the graphics library.
+         *
+         * Parameters:
+         *  lcd - an implementation of LCD device
+         */
+        Graphics(AbstractLCD *lcd);
+        
+        /* Function: line
+         * Draw a coloured line between two points.
+         *
+         * Parameters:
+         *  x0 - X co-ordinate of the start of the line.
+         *  y0 - Y co-ordinate of the start of the line.
+         *  x1 - X co-ordinate of the end of the line.
+         *  y1 - Y co-ordinate of the end of the line.
+         *  colour - The colour of the line.
+         */
+        void line(int x0, int y0, int x1, int y1, int colour);
+        
+        /* Function: line3d
+         * Draws a coloured line in 3D space. The 3D origin point is in
+         * the centre of the screen.
+         *
+         * Parameters:
+         * x0 - X co-ordinate of the start of the line.
+         * y0 - Y co-ordinate of the start of the line.
+         * z0 - Z (depth) co-ordinate of the start of the line.
+         * x1 - X co-ordinate of the end of the line.
+         * y1 - Y co-ordinate of the end of the line.
+         * z1 - Z co-ordinate of the end of the line.
+         * colour - The colour of the line.
+         */
+        void line3d(int x0, int y0, int z0, int x1, int y1, int z0, int colour);        
+        
+        /* Function: circle
+         * Draw a coloured circle.
+         *
+         * Parameters:
+         * cx - X co-ordinate of the centre of the circle.
+         * cy - Y co-ordinate of the centre of the circle.
+         * radius - The radius of the circle.
+         * colour - The colour of the circle.
+         */
+        void circle(int cx, int cy, int radius, int colour);
+        
+    protected:
+        int _cx3d, _cy3d, _cz3d; // 3D focal point
+        AbstractLCD *_lcd;
+        
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Graphics/Object3D.cpp	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,156 @@
+/* 
+ * libmbed-graphics 2D and wireframe 3D graphics library for the MBED
+ * microcontroller platform
+ * Copyright (C) <2009> Michael Sheldon <mike@mikeasoft.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+ 
+#include "Object3D.h"
+
+Object3D::Object3D() {
+    _x = 0;
+    _y = 0;
+    _z = 0;
+    _rx = 0;
+    _ry = 0;
+    _rz = 0;
+    _sx = 1;
+    _sy = 1;
+    _sz = 1;
+    _colour = 0xffffff;
+}
+
+void Object3D::position(int x, int y, int z) {
+    _x = x;
+    _y = y;
+    _z = z;
+}
+
+void Object3D::rotate(float rx, float ry, float rz) {
+    _rx = rx;
+    _ry = ry;
+    _rz = rz;
+}
+
+void Object3D::scale(float sx, float sy, float sz) {
+    _sx = sx;
+    _sy = sy;
+    _sz = sz;
+}
+
+void Object3D::colour(int colour) {
+    _colour = colour;
+}
+
+#define FASTSINCOS
+
+#ifdef FASTSINCOS
+
+// http://www.dspguru.com/dsp/tricks/parabolic-approximation-of-sin-and-cos
+
+#define M_PI       3.14159265358979323846
+#define M_PI_2     1.57079632679489661923
+#define M_PI_4     0.785398163397448309616
+#define M_C        0.71256755058
+
+void sincosf(float angle, float *sinx, float *cosx)
+{
+    int quarter = int(floor(angle/M_PI_2));
+    
+    float modphase = angle - quarter*M_PI_2;
+    if ( modphase < 0 )
+        modphase += M_PI_2;
+    
+    quarter %= 4;
+    if ( quarter < 0 )
+        quarter += 4;
+    
+    modphase = modphase/M_PI_2;
+
+    //printf("Angle: %f, q: %d, mod: %f\n", angle, quarter, modphase);
+    float x, temp;
+    switch (quarter)
+    { 
+    case 0:
+        // First quarter, angle = 0 .. pi/2
+        x = modphase - 0.5f;      // 1 sub
+        temp = (2 - 4*M_C)*x*x + M_C; // 2 mul, 1 add
+        *sinx = temp + x;              // 1 add
+        *cosx = temp - x;              // 1 sub
+        break;
+    case 1:
+        // Second quarter, angle = pi/2 .. pi
+        x = 0.5f - modphase;      // 1 sub
+        temp = (2 - 4*M_C)*x*x + M_C; // 2 mul, 1 add
+        *sinx = x + temp;              // 1 add
+        *cosx = x - temp;              // 1 sub
+        break;
+    case 2:
+        // Third quarter, angle = pi .. 1.5pi
+        x = modphase - 0.5f;      // 1 sub
+        temp = (4*M_C - 2)*x*x - M_C; // 2 mul, 1 sub
+        *sinx = temp - x;              // 1 sub
+        *cosx = temp + x;              // 1 add
+        break;
+    case 3:
+        // Fourth quarter, angle = 1.5pi..2pi
+        x = modphase - 0.5f;      // 1 sub
+        temp = (2 - 4*M_C)*x*x + M_C; // 2 mul, 1 add
+        *sinx = x - temp;              // 1 sub
+        *cosx = x + temp;              // 1 add
+        break;
+    }
+}
+
+#else // FASTSINCOS
+
+void sincosf(float angle, float *sinx, float *cosx)
+{
+  *sinx = sin(angle);
+  *cosx = cos(angle);
+}
+
+#endif // FASTSINCOS
+
+
+void rotate3d(int *x, int *y, int *z, float anglex, float angley, float anglez, int count)
+{    
+    float sinx, cosx, siny, cosy, sinz, cosz;
+    sincosf(anglex, &sinx, &cosx);    
+    sincosf(angley, &siny, &cosy);
+    sincosf(anglez, &sinz, &cosz);
+    
+    for ( int i=0; i < count; i++)
+    {
+        int x1 = x[i];
+        int y1 = y[i];
+        int z1 = z[i];
+        
+        int y2 = cosx * y1 - sinx * z1;
+        int z2 = sinx * y1 + cosx * z1;
+    
+        int x2 = cosy * x1 + siny * z2;
+        int z3 = -siny * x1 + cosy * z2;
+        
+        int x3 = cosz * x2 - sinz * y2;
+        int y3 = sinz * x2 + cosz * y2;
+        
+        x[i] = x3;
+        y[i] = y3;
+        z[i] = z3;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Graphics/Object3D.h	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,104 @@
+/* 
+ * libmbed-graphics 2D and wireframe 3D graphics library for the MBED
+ * microcontroller platform
+ * Copyright (C) <2009> Michael Sheldon <mike@mikeasoft.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MBED_OBJECT3D_H
+#define MBED_OBJECT3D_H
+
+#include "Graphics.h"
+
+/* Class: Object3D
+ * General purpose 3D base object, new 3D objects should inherit
+ * from this class.
+ */
+class Object3D {
+
+    public:
+        Object3D();
+        
+        /* Function: position
+         * Specify the position of the object in 3D space.
+         *
+         * Parameters:
+         * x - X co-ordinate of the point that the centre of the object should be placed at.
+         * y - Y co-ordinate of the point that the centre of the object should be placed at.
+         * z - Z co-ordinate of the point that the centre of the object should be placed at.
+         */
+        void position(int x, int y, int z);
+        
+        /* Function: rotate
+         * Rotate the object about it's centre point.
+         *
+         * Parameters:
+         * rx - Component of the rotation along the x-axis in radians.
+         * ry - Component of the rotation along the y-axis in radians.
+         * rz - Component of the rotation along the z-axis in radians.
+         */
+        void rotate(float rx, float ry, float rz);
+        
+        /* Function: scale
+         * Modify the size of the object.
+         *
+         * Parameters:
+         * sx - Proportion to change the object's size by along the x axis.
+         * sy - Proportion to change the object's size by along the y axis.
+         * sz - Proportion to change the object's size by along the z axis.
+         */
+        void scale(float sx, float sy, float sz);
+        
+        /* Function: colour
+         * Sets the colour of the object.
+         *
+         * Parameters:
+         * colour - The colour of the object.
+         */
+        void colour(int colour);
+        
+        /* Function: render
+         * Draws the object on the specified graphical context.
+         *
+         * Parameters:
+         * g - The graphical context to which the object should be rendered.
+         */
+        virtual void render(Graphics &g) = 0;
+        
+    protected:
+        int _x, _y, _z;
+        float _rx, _ry, _rz;
+        float _sx, _sy, _sz;
+        int _colour;        
+};
+
+        
+/* Function: rotate3d
+ * Rotates point(s) in 3D space about origin (0,0,0)
+ *
+ * Parameters:
+ * x - Pointer to the x co-ordinate(s) of the point(s) to be rotated.
+ * y - Pointer to the y co-ordinate(s) of the point(s) to be rotated.
+ * z - Pointer to the z co-ordinate(s) of the point(s) to be rotated.
+ * anglex - The angle to rotate the point by around axis x in radians.
+ * angley - The angle to rotate the point by around axis y in radians.
+ * anglez - The angle to rotate the point by around axis z in radians.
+ * count  - count of coordinates pointed to by x, y and z
+ */
+void rotate3d(int *x, int *y, int *z, float anglex, float angley, float anglez, int count = 1);
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Graphics/TrimeshObject.cpp	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,59 @@
+/* 
+ * libmbed-graphics 2D and wireframe 3D graphics library for the MBED
+ * microcontroller platform
+ * Copyright (C) <2009> Michael Sheldon <mike@mikeasoft.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+ 
+#include "TrimeshObject.h"
+ 
+TrimeshObject::TrimeshObject(int vertices[][3], int faces[][3], int num_faces)
+    : Object3D::Object3D() {
+     _vertices = vertices;
+     _faces = faces;
+     _num_faces = num_faces;
+}
+
+void TrimeshObject::render(Graphics &g) {
+    int face, fv0, fv1, fv2;
+    int *v0, *v1, *v2;
+    int x[3], y[3], z[3];
+    for (face = 0; face < _num_faces; face++) {
+        fv0 = _faces[face][0];
+        fv1 = _faces[face][1];
+        fv2 = _faces[face][2];
+        v0 = _vertices[fv0];
+        v1 = _vertices[fv1];
+        v2 = _vertices[fv2];
+
+        x[0] = v0[0];    x[1] = v1[0];    x[2] = v2[0];
+        y[0] = v0[1];    y[1] = v1[1];    y[2] = v2[1];
+        z[0] = v0[2];    z[1] = v1[2];    z[2] = v2[2];
+        rotate3d(x, y, z, _rx, _ry, _rz, 3);
+        
+        for ( int i=0; i < 3; i++ )
+        {
+            x[i] += _x;
+            y[i] += _y;
+            z[i] += _z;
+        }
+        
+        g.line3d(x[0], y[0], z[0], x[1], y[1], z[1], _colour);
+        g.line3d(x[1], y[1], z[1], x[2], y[2], z[2], _colour);
+        g.line3d(x[2], y[2], z[2], x[0], y[0], z[0], _colour);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Graphics/TrimeshObject.h	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,59 @@
+/* 
+ * libmbed-graphics 2D and wireframe 3D graphics library for the MBED
+ * microcontroller platform
+ * Copyright (C) <2009> Michael Sheldon <mike@mikeasoft.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MBED_TRIMESHOBJECT_H
+#define MBED_TRIMESHOBJECT_H
+
+#include "Object3D.h"
+
+/* Class: TrimeshObject
+ * Constructs 3D objects from triangle meshes specified by lists of
+ * vertices and faces.
+ */
+class TrimeshObject : public Object3D {
+
+    public:
+        /* Constructor: TrimeshObject
+         * Instantiate a trimesh object.
+         *
+         * Parameters:
+         * vertices - A multidimensional array containing a list of vertices.
+         * faces - A multidimensional array containing a list of faces, connecting vertices together to form triangles.
+         * num_faces - The number of faces in the "faces" array.
+         */
+        TrimeshObject(int vertices[][3], int faces[][3], int num_faces);
+        
+        /* Function: render
+         * Draws the trimesh object to the specified graphical context.
+         *
+         * Parameters:
+         * g - The graphical context to which the trimesh object should be rendered.
+         */
+        virtual void render(Graphics &g);
+        
+    protected:
+        int (*_vertices)[3];
+        int (*_faces)[3];
+        int _num_faces;
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD/AbstractLCD.h	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,30 @@
+#ifndef MBED_ABSTRACTLCD_H
+#define MBED_ABSTRACTLCD_H
+ 
+#include "mbed.h"
+
+/* Class: AbstractLCD
+ *
+ */
+
+class AbstractLCD
+{
+public:
+    virtual ~AbstractLCD() {};
+    // return LDC width
+    virtual int width() = 0;
+    // return LDC height
+    virtual int height() = 0;
+    // put a pixel on the screen
+    virtual void pixel(int x, int y, int colour) = 0;
+    // fill a rectangular area
+    virtual void fill(int x, int y, int width, int height, int colour) = 0;
+    // begin an update sequence: 
+    // remember drawing operations but do not update the display
+    virtual void beginupdate() = 0;
+    // end an update sequence
+    // update display to reflect all queued operations
+    virtual void endupdate() = 0;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD/DogLCD.cpp	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,207 @@
+#include "DogLCD.h"
+
+// macro to make sure x falls into range from low to high (inclusive)
+#define CLAMP(x, low, high) { if ( (x) < (low) ) x = (low); if ( (x) > (high) ) x = (high); } while (0);
+
+void DogLCD::_send_commands(const unsigned char* buf, size_t size)
+{
+    // for commands, A0 is low
+    _spi.format(8,0);
+    _spi.frequency(10000000);
+    _cs = 0;
+    _a0 = 0;
+    while ( size-- > 0 )
+        _spi.write(*buf++);
+    _cs = 1;
+}
+
+void DogLCD::_send_data(const unsigned char* buf, size_t size)
+{
+    // for data, A0 is high
+    _spi.format(8,0);
+    _spi.frequency(10000000);
+    _cs = 0;
+    _a0 = 1;
+    while ( size-- > 0 )
+        _spi.write(*buf++);
+    _cs = 1;
+    _a0 = 0;
+}
+
+// set column and page number
+void DogLCD::_set_xy(int x, int y)
+{
+    //printf("_set_xy(%d,%d)\n", x, y);
+    CLAMP(x, 0, LCDWIDTH-1);
+    CLAMP(y, 0, LCDPAGES-1);
+    unsigned char cmd[3];
+    cmd[0] = 0xB0 | (y&0xF);
+    cmd[1] = 0x10 | (x&0xF);
+    cmd[2] = (x>>4)&0xF;
+    _send_commands(cmd, 3);        
+}
+
+// initialize and turn on the display
+void DogLCD::init()
+{
+    const unsigned char init_seq[] = {
+        0x40,    //Display start line 0
+        0xa1,    //ADC reverse
+        0xc0,    //Normal COM0...COM63
+        0xa6,    //Display normal
+        0xa2,    //Set Bias 1/9 (Duty 1/65)
+        0x2f,    //Booster, Regulator and Follower On
+        0xf8,    //Set internal Booster to 4x
+        0x00,
+        0x27,    //Contrast set
+        0x81,
+        0x16,
+        0xac,    //No indicator
+        0x00,
+        0xaf,    //Display on
+    };        
+    //printf("Reset=L\n");
+    _reset = 0;
+    //printf("Power=H\n");
+    _power = 1;
+    //wait_ms(1);
+    //printf("Reset=H\n");
+    _reset = 1;
+    //wait(5);
+    //printf("Sending init commands\n");
+    _send_commands(init_seq, sizeof(init_seq));
+}
+
+void DogLCD::send_pic(const unsigned char* data)
+{
+    //printf("Sending picture\n");
+    for (int i=0; i<LCDPAGES; i++)
+    {
+        _set_xy(0, i);
+        _send_data(data + i*LCDWIDTH, LCDWIDTH);
+    }
+}
+
+void DogLCD::clear_screen()
+{
+    //printf("Clear screen\n");
+    memset(_framebuffer, 0, sizeof(_framebuffer));
+    if ( _updating == 0 )
+    {
+        send_pic(_framebuffer);
+    }
+}
+
+void DogLCD::all_on(bool on)
+{
+    //printf("Sending all on %d\n", on);
+    unsigned char cmd = 0xA4 | (on ? 1 : 0);
+    _send_commands(&cmd, 1);
+}
+
+void DogLCD::pixel(int x, int y, int colour)
+{
+    CLAMP(x, 0, LCDWIDTH-1);
+    CLAMP(y, 0, LCDHEIGHT-1);
+    int page = y / 8;
+    unsigned char mask = 1<<(y%8);
+    unsigned char *byte = &_framebuffer[page*LCDWIDTH + x];
+    if ( colour == 0 )
+        *byte &= ~mask; // clear pixel
+    else
+        *byte |= mask; // set pixel
+    if ( !_updating )
+    {
+        _set_xy(x, page);
+        _send_data(byte, 1);
+    }
+}
+
+void DogLCD::fill(int x, int y, int width, int height, int colour)
+{
+    /*
+      If we need to fill partial pages at the top:
+      
+      ......+---+---+.....
+       ^    | = | = |     = : don't touch
+       |    | = | = |     * : update 
+      y%8   | = | = |      
+       |    | = | = |      
+       v    | = | = |      
+    y---->  | * | * |      
+            | * | * |      
+            | * | * |
+            +---+---+      
+    */
+    //printf("fill(x=%d, y=%d, width=%d, height=%d, colour=%x)\n",  x, y, width, height, colour);
+    CLAMP(x, 0, LCDWIDTH-1);
+    CLAMP(y, 0, LCDHEIGHT-1);
+    CLAMP(width, 0, LCDWIDTH - x);
+    CLAMP(height, 0, LCDHEIGHT - y);
+    int page = y/8;
+    int firstpage = page;
+    int partpage = y%8;
+    if ( partpage != 0 )
+    {
+        // we need to process partial bytes in the top page
+        unsigned char mask = (1<<partpage) - 1; // this mask has 1s for bits we need to leave
+        unsigned char *bytes = &_framebuffer[page*LCDWIDTH + x];
+        for ( int i = 0; i < width; i++, bytes++ )
+        {
+          // clear "our" bits
+          *bytes &= mask;
+          if ( colour != 0 )
+            *bytes |= ~mask; // set our bits
+        }
+        height -= partpage;
+        page++;
+    }
+    while ( height >= 8 )
+    {
+        memset(&_framebuffer[page*LCDWIDTH + x], colour == 0 ? 0 : 0xFF, width);
+        page++;
+        height -= 8; 
+    } 
+    if ( height != 0 )
+    {
+        // we need to process partial bytes in the bottom page
+        unsigned char mask = ~((1<<partpage) - 1); // this mask has 1s for bits we need to leave
+        unsigned char *bytes = &_framebuffer[page*LCDWIDTH + x];
+        for ( int i = 0; i < width; i++, bytes++ )
+        {
+          // clear "our" bits
+          *bytes &= mask;
+          if ( colour != 0 )
+            *bytes |= ~mask; // set our bits
+        }
+        page++;
+    }
+    //printf("_updating=%d\n", _updating);
+    if ( !_updating )
+    {
+        int laststpage = page;
+        for ( page = firstpage; page < laststpage; page++)
+        {
+            //printf("setting x=%d, page=%d\n", x, page);
+            _set_xy(x, page);
+            //printf("sending %d bytes at offset %x\n", width, page*LCDWIDTH + x);
+            _send_data(&_framebuffer[page*LCDWIDTH + x], width);
+        }
+    }
+}     
+
+void DogLCD::beginupdate()
+{
+    _updating++;
+    //printf("beginupdate: %d\n", _updating);
+}
+
+void DogLCD::endupdate()
+{    
+    _updating--;
+    //printf("endupdate: %d\n", _updating);
+    if ( _updating == 0 )
+    {
+        send_pic(_framebuffer);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD/DogLCD.h	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,71 @@
+#ifndef MBED_DOGLCD_H
+#define MBED_DOGLCD_H
+
+#include "AbstractLCD.h"
+
+/***********
+ * Module for Electronic Assembly's DOGL128-6 display module
+ * Should be compatible with other modules using ST7565 controller
+ ***********/
+ 
+#define LCDWIDTH 128
+#define LCDHEIGHT 64
+#define LCDPAGES  (LCDHEIGHT+7)/8
+
+/*
+
+ Each page is 8 lines, one byte per column
+ 
+         Col0
+        +---+--
+        | 0 |
+Page 0  | 1 |
+        | 2 |
+        | 3 |
+        | 4 |
+        | 5 |
+        | 6 |
+        | 7 |
+        +---+--
+*/
+
+/*
+  LCD interface class.
+  Usage: 
+    DogLCD dog(spi, pin_power, pin_cs, pin_a0, pin_reset);
+    where spi is an instance of SPI class
+*/
+
+class DogLCD: public AbstractLCD
+{
+    SPI& _spi;
+    DigitalOut _cs, _a0, _reset, _power;
+    int _updating;
+    void _send_commands(const unsigned char* buf, size_t size);
+    void _send_data(const unsigned char* buf, size_t size);
+    void _set_xy(int x, int y);
+    unsigned char _framebuffer[LCDWIDTH*LCDPAGES];
+public:
+    DogLCD(SPI& spi, PinName power, PinName cs, PinName a0, PinName reset):
+    _spi(spi), _cs(cs), _a0(a0), _reset(reset), _power(power), _updating(0)
+    {
+    }
+    // initialize and turn on the display
+    void init();
+    // send a 128x64 picture for the whole screen
+    void send_pic(const unsigned char* data);
+    // clear screen
+    void clear_screen();
+    // turn all pixels on
+    void all_on(bool on = true);
+    
+    // AbstractLCD methods
+    virtual int width()  {return LCDWIDTH;};
+    virtual int height() {return LCDHEIGHT;};
+    virtual void pixel(int x, int y, int colour);
+    virtual void fill(int x, int y, int width, int height, int colour);
+    virtual void beginupdate();
+    virtual void endupdate();
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TieFighter.h	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,134 @@
+#ifndef MBED_TIEFIGHTER_H
+#define MBED_TIEFIGHTER_H
+
+
+
+int tie_fighter_vertices[48][3] = {
+    // Left wing - v0
+    {0, 0, 17},
+    {10, -15, 15},
+    {-10, -15, 15},
+    {-15, 0, 15},
+    {-10, 15, 15},
+    {-10, 15, 15},
+    {10, 15, 15},
+    {15, 0, 15},
+
+    // Left inner wing connector - v8
+    {0, 0, 17},
+    {4, -4, 15},
+    {-4, -4, 15},
+    {-4, 0, 15},
+    {-4, 4, 15},
+    {-4, 4, 15},
+    {4, 4, 15},
+    {4, 0, 15},
+    
+    // Right wing - v16
+    {0, 0, -17},
+    {10, -15, -15},
+    {-10, -15, -15},
+    {-15, 0, -15},
+    {-10, 15, -15},
+    {-10, 15, -15},
+    {10, 15, -15},
+    {15, 0, -15},
+    
+    // Right inner wing connector - v24
+    {0, 0, -17},
+    {4, -4, -15},
+    {-4, -4, -15},
+    {-4, 0, -15},
+    {-4, 4, -15},
+    {-4, 4, -15},
+    {4, 4, -15},
+    {4, 0, -15},
+    
+    // Body - v32
+    {8, 8, -8},
+    {-8, 8, -8},
+    {8, 8, 8},
+    {-8, 8, 8},
+    
+    {8, -8, -8},
+    {-8, -8, -8},
+    {8, -8, 8},
+    {-8, -8, 8},
+
+    // Left wing <-> body connection
+    {-2, -2, 15},
+    {-2, -2, 8},
+    {2, 2, 15},
+    {2, 2, 8},
+    
+    // Right wing <-> body connection
+    {-2, -2, -15},
+    {-2, -2, -8},
+    {2, 2, -15},
+    {2, 2, -8},
+};
+
+#define TIE_FIGHTER_NUM_FACES 32
+int tie_fighter_faces[TIE_FIGHTER_NUM_FACES][3] = {
+    // Left wing
+    {0, 1, 2},
+    {0, 2, 3},
+    {0, 3, 4},
+    {0, 4, 5},
+    {0, 5, 6},
+    {0, 6, 7},
+    {0, 7, 1},
+
+    // Left inner wing connector
+/*    {8, 9, 10},
+    {8, 10, 11},
+    {8, 11, 12},
+    {8, 12, 13},
+    {8, 13, 14},
+    {8, 14, 15},
+    {8, 15, 9}, */
+    
+    // Right wing
+    {16, 17, 18},
+    {16, 18, 19},
+    {16, 19, 20},
+    {16, 20, 21},
+    {16, 21, 22},
+    {16, 22, 23},
+    {16, 23, 17},
+    
+    // Right inner wing connector
+/*    {24, 25, 26},
+    {24, 26, 27},
+    {24, 27, 28},
+    {24, 28, 29},
+    {24, 29, 30},
+    {24, 30, 31},
+    {24, 31, 25},   */
+    
+    // Body
+    {32, 33, 33}, // Hack to just draw some straight lines so the body doesn't look too cluttered with triangles
+    {33, 35, 35},
+    {35, 34, 34},
+    {32, 34, 34},
+    
+    {36, 37, 37},
+    {37, 39, 39},
+    {39, 38, 38},
+    {36, 38, 38},
+    
+    {36, 32, 32},
+    {37, 33, 33},
+    {39, 35, 35},
+    {38, 34, 34},
+    
+    // Left wing <-> body connection
+    {40, 41, 41},
+    {42, 43, 43},
+
+    // Right wing <-> body connection
+    {44, 45, 45},
+    {46, 47, 47},    
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hellombed.h	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,67 @@
+unsigned char pic_hellombed [] = 
+{
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0x60, 0x60, 0x60, 0x60, 0xC0, 0xC0, 0x00, 0x00, 0x00,
+0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0,
+0x60, 0x60, 0x60, 0x60, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0xE0, 0xE0, 0xC0, 0xC0, 0x60, 0x60, 0x60, 0xE0, 0xC0, 0x80, 0xC0, 0xC0, 0x60, 0x60, 0x60,
+0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xC0, 0xC0, 0x60, 0x60, 0x60, 0x60, 0xC0,
+0xC0, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0x60, 0x60, 0x60, 0x60, 0xC0, 0xC0, 0x00, 0x00,
+0x00, 0x00, 0x80, 0xC0, 0xE0, 0x60, 0x60, 0x60, 0xC0, 0xC0, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xFF, 0xFF, 0x00,
+0x00, 0x00, 0x00, 0x7E, 0xFF, 0xCC, 0x8C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x8F, 0x8F, 0x00, 0x00,
+0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x7E, 0xFF, 0xC1, 0x80,
+0x00, 0x00, 0x00, 0x00, 0x80, 0xC1, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00,
+0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xC1, 0x80, 0x00, 0x00, 0x00, 0x80, 0xC1,
+0xFF, 0x7F, 0x00, 0x00, 0x7E, 0xFF, 0xCC, 0x8C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x8F, 0x8F, 0x00,
+0x00, 0x7F, 0xFF, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC1, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x00, 0x00,
+0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03,
+0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x00,
+0x00, 0x00, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,73 @@
+#include "mbed.h"
+#include "Graphics.h"
+#include "Cuboid.h"
+#include "TrimeshObject.h"
+#include "TieFighter.h"
+#include "DogLCD.h"
+#include "hellombed.h"
+
+SPI spi(p5, NC, p7);
+DogLCD dog(spi, p17, p18, p20, p19); //  spi, power, cs, a0, reset
+Graphics g(&dog);
+TrimeshObject tf(tie_fighter_vertices, tie_fighter_faces, TIE_FIGHTER_NUM_FACES);
+Cuboid cube;
+
+int main()
+{
+    dog.init();
+    // draw "hello mbed"
+    dog.send_pic(pic_hellombed);
+    wait(5);
+    // draw rectangle around the screen
+    g.line(0, 0, dog.width()-1, 0, 0xFFFFFF);
+    wait(2);
+    g.line(dog.width()-1, 0, dog.width()-1, dog.height()-1, 0xFFFFFF);
+    wait(2);
+    g.line(dog.width()-1, dog.height()-1, 0, dog.height()-1, 0xFFFFFF);
+    wait(2);
+    g.line(0, dog.height()-1, 0, 0, 0xFFFFFF);
+    wait(5);
+    
+    dog.clear_screen();
+    float rotx = 0, roty = 0, rotz = 0;
+    
+    Timer timer;
+    timer.start();
+    int frameno = 0;
+    const int pollcount = 10;
+    // shift 1/4th of screen to the left
+    tf.position(-dog.width() / 4, 0, 0);
+    tf.colour(0xffffff);
+    // shift 1/4th of screen to the right
+    cube.position(+dog.width() / 4, 0, 0);
+    cube.colour(0xffffff);
+    while (1)
+    {
+        rotx += 0.1;
+        roty += 0.08;
+        rotz += 0.05;
+        
+        // set rotation angles
+        tf.rotate(rotx, roty, rotz);
+        cube.rotate(rotx, roty, rotz);
+        // lock update
+        dog.beginupdate();
+            dog.clear_screen();
+            // render TieFighter
+            tf.render(g);
+            // and the cube
+            cube.render(g);
+        // unlock update (and draw framebuffer)    
+        dog.endupdate();
+        if ( ++frameno == pollcount )
+        {
+            // output fps to serial
+            int end = timer.read_ms();
+            float fps = pollcount*1000.0/end;
+            printf("\r%d frames, %d ms, FPS: %f", pollcount, end, fps);
+            frameno = 0;
+            timer.reset();
+        }
+        //dog.fill(40, 40, 52, 52, 0x000000);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jan 14 00:49:39 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0