Created
October 23, 2021 23:00
-
-
Save tatmos/086ea7d6f079f9f541c729eba722435a to your computer and use it in GitHub Desktop.
箱12個processingからobj出力
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 = 100; | |
int llength = 120; | |
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); | |
box(ssize,ssize,ssize); | |
popMatrix(); | |
popMatrix(); | |
pushMatrix(); | |
rotateX(-radians(angle)); | |
pushMatrix(); | |
translate(0,llength,0); | |
box(ssize,ssize,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