Created
October 23, 2021 22:42
-
-
Save tatmos/2cebad41c2f7a13fe4bc25f07644b9de to your computer and use it in GitHub Desktop.
ビーズ12個のobj出力用processingファイル
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
import nervoussystem.obj.*; | |
boolean record = false; | |
int ssize = 50; | |
int llength = 80; | |
void setup() { | |
size(400, 400,P3D); | |
} | |
void draw() { | |
background(0); | |
if (record) { | |
beginRecord("nervoussystem.obj.OBJExport", "filename.obj"); | |
} | |
translate(width/2,height/2,0); | |
//rotateY(45); | |
rotateY(radians(mouseX)); | |
//sphere(ssize); | |
pushMatrix(); | |
DrawP2(); | |
popMatrix(); | |
pushMatrix(); | |
rotateY(radians(90)); | |
rotateX(radians(90)); | |
DrawP2(); | |
popMatrix(); | |
pushMatrix(); | |
rotateY(radians(90)); | |
rotateX(radians(90)); | |
rotateY(radians(90)); | |
rotateX(radians(90)); | |
DrawP2(); | |
popMatrix(); | |
if (record) { | |
endRecord(); | |
record = false; | |
} | |
} | |
void DrawP2() | |
{ | |
pushMatrix(); | |
DrawP(mouseY); | |
popMatrix(); | |
pushMatrix(); | |
rotateZ(radians(180)); | |
DrawP(mouseY); | |
popMatrix(); | |
} | |
void DrawP(float angle) | |
{ | |
pushMatrix(); | |
rotateX(radians(angle)); | |
pushMatrix(); | |
translate(0,llength,0); | |
sphere(ssize); | |
popMatrix(); | |
popMatrix(); | |
pushMatrix(); | |
rotateX(-radians(angle)); | |
pushMatrix(); | |
translate(0,llength,0); | |
sphere(ssize); | |
popMatrix(); | |
popMatrix(); | |
} | |
void mousePressed() { | |
record = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment