// week08_1_loadShape_shape
size(400, 400, P3D); // (3) 要有P3D 的 OpenGL 3D 功能
PShape gundam = loadShape("Gundam.obj"); // (1)讀入 3D 模型
translate(width/2, height/2);
pushMatrix(); // 備份矩陣
translate(0, 100); // 下移一點比較好看
scale(10, -10, 10); // (4) 模型放大 shape(10) 上下顛倒
shape(gundam, 0, 0); // (2) 畫出 3D 模型
popMatrix(); // 還原矩陣
// week08_2_PShape_gundam_setup_draw_push_scale_shape_pop
// 轉動它 改成互動模式的程式風格
PShape gundam; // 再把 Gundam.obj 等檔案拉進來
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();
}
// week08_3_another_obj_large_bad_mtl
PShape gundam; // 再把 Gundam.obj 等檔案拉進來
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();
}
沒有留言:
張貼留言