Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Henstell committed May 30, 2012
1 parent 75ba868 commit 0e64507
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 0 deletions.
78 changes: 78 additions & 0 deletions Pixel.pde
@@ -0,0 +1,78 @@
class Pixel
{
float x;
float y;
float z;
float w;
float h;
int sides;

Pixel(float x_, float y_, float z_, float w_, float h_, int sides_) {
x = x_;
y = y_;
z = z_;
w = w_;
h = h_;
sides = sides_;
}

void draw() {

pushMatrix();
translate(x, y, z);
cylinder(w, h, sides);
popMatrix();

}

/**
cylinder taken from http://wiki.processing.org/index.php/Cylinder
@author matt ditton
*/

void cylinder(float w, float h, int sides)
{
float angle;
float[] x = new float[sides+1];
float[] z = new float[sides+1];

//get the x and z position on a circle for all the sides
for(int i=0; i < x.length; i++){
angle = TWO_PI / (sides) * i;
x[i] = sin(angle) * w;
z[i] = cos(angle) * w;
}

//draw the top of the cylinder
beginShape(TRIANGLE_FAN);

vertex(0, -h/2, 0);

for(int i=0; i < x.length; i++){
vertex(x[i], -h/2, z[i]);
}

endShape();

//draw the center of the cylinder
beginShape(QUAD_STRIP);

for(int i=0; i < x.length; i++){
vertex(x[i], -h/2, z[i]);
vertex(x[i], h/2, z[i]);
}

endShape();

//draw the bottom of the cylinder
beginShape(TRIANGLE_FAN);

vertex(0, h/2, 0);

for(int i=0; i < x.length; i++){
vertex(x[i], h/2, z[i]);
}

endShape();
}
}
17 changes: 17 additions & 0 deletions Sign.pde
@@ -0,0 +1,17 @@
class Sign
{

Pixel[][] pixels;

void setup() {


}


void draw() {

}


}
42 changes: 42 additions & 0 deletions elsignSimulator.pde
@@ -0,0 +1,42 @@
import peasy.org.apache.commons.math.*;
import peasy.*;
import peasy.org.apache.commons.math.geometry.*;
import processing.opengl.*;
import javax.media.opengl.GL;

PeasyCam pCamera;



void setup() {
size(1024, 850, OPENGL);
colorMode(RGB,255);
frameRate(60);

// Turn on vsync to prevent tearing
PGraphicsOpenGL pgl = (PGraphicsOpenGL) g; //processing graphics object
GL gl = pgl.beginGL(); //begin opengl
gl.setSwapInterval(2); //set vertical sync on
pgl.endGL(); //end opengl

//size(1680, 1000, OPENGL);
pCamera = new PeasyCam(this, 0, 0, 0, 200);
pCamera.setMinimumDistance(.2);
pCamera.setMaximumDistance(150*10);
pCamera.setSuppressRollRotationMode();
pCamera.rotateX(.6);

pCamera.setWheelScale(0.05);

}

void draw() {
background(0);
lights();
noStroke();



}


0 comments on commit 0e64507

Please sign in to comment.