Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Max Henstell
committed
May 30, 2012
1 parent
75ba868
commit 0e64507
Showing
3 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Sign | ||
{ | ||
|
||
Pixel[][] pixels; | ||
|
||
void setup() { | ||
|
||
|
||
} | ||
|
||
|
||
void draw() { | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
|
||
|
||
|
||
} | ||
|
||
|