課堂作業一
size(400,400,P3D);//P3D OpenGL功能 PShape gundam=loadShape("Gundam.obj"); //1.讀入3D模型 translate(width/2,height/2);//畫面中心 pushMatrix(); translate(0,100); scale(10,-10,10);//4.把模型放大shape(10) 上下要倒過來(-10) shape(gundam,0,0);//2.畫出3D模型 popMatrix();
課堂作業二//轉動他,互動模式的程式風格 PShape gundam; void setup(){ size(400,400,P3D); gundam=loadShape("Gundam.obj"); } void draw(){ background(128); translate(width/2,height/2+100); pushMatrix(); scale(10,-10,10); rotateY(radians(frameCount)); shape(gundam,0,0); popMatrix(); pushMatrix(); translate(100,0,0); scale(10,-10,10); shape(gundam,0,0); popMatrix(); }
課堂作業三
PShape gundam;
void setup(){
size (400,400,P3D);
gundam=loadShape("FinalBaseMesh.obj");
}
void draw(){
background(128);
translate(width/2,height/2+100);
pushMatrix();
scale(10,-10,10);
rotateY(radians(frameCount));
shape(gundam,0,0);
popMatrix();
pushMatrix();
translate(100,0,0);
scale(10,-10,10);
shape(gundam,0,0);
popMatrix();
}
課堂作業四PShape body,head;Add commentMore actionsvoid setup(){size(400,400,P3D);body = loadShape("body.obj");head = loadShape("head.obj");}void draw(){background(255);translate(width/2,height/2+100);sphere(10);scale(10,-10,10);pushMatrix();translate(0.0, +22.5);rotate(radians(x));//translate(x/10, y/10);//println(x/10,y/10);translate(0.0, -22.5);shape(head,0,0);popMatrix();shape(body,0,0);}float x=0,y=0;Add commentMore actionsvoid mouseDragged(){x+= mouseX-pmouseX;y-= mouseY-pmouseY;}
沒有留言:
張貼留言