將data裡的檔案拉到processing
將gundam.pde裡的程式碼複製進去
PShape gundam;
void setup(){
size(500,500,P3D);
gundam = loadShape("Gundam.obj");
}
void draw(){
shape(gundam);
}
PShape gundam;
void setup(){
size(500,500,P3D);
gundam = loadShape("Gundam.obj");
}
void draw(){
scale(10,10,10); ///scale可調整模型的縮放比例
shape(gundam);
}
PShape gundam;
void setup(){
size(500,500,P3D);
gundam = loadShape("Gundam.obj");
}
void draw(){
translate(250,0,0); ///3D操作translate
scale(10,10,10);
shape(gundam);
}
在3D操作中移動、旋轉、縮放 程式的順序不同,結果會差很多
PShape gundam;
void setup(){
size(500,500,P3D);
gundam = loadShape("Gundam.obj");
}
void draw(){
background(128); ///清背景,才不會有陰影
translate(250,400,0);
scale(10,-10,10); ///放大10倍,但y變成負的
rotateY(radians(frameCount)); ///先對Y軸旋轉
shape(gundam);
}
PImage img;
PShape globe;
void setup(){
size(300,300,P3D); ///原本寬度跟高度為300
img = loadImage("earth.jpg");
globe = createShape(SPHERE,100);
globe.setStroke(false);
globe.setTexture(img);
}
void draw(){
background(128);
noStroke();
translate(width/2,height/2); /// 除2(要移到中間)
rotateY(radians(frameCount));
shape(globe);
}
PImage img;
void setup(){
size(300,300,P3D);
img = loadImage("earth.jpg");
}
void draw(){
image(img,0,0);
}
PImage img;
PShape globe; ///現在變3行,PShae處理
void setup(){
size(300,300,P3D);
img = loadImage("earth.jpg");
globe = createShape(SPHERE,100); ///功能就可以比較強大
}
void draw(){
image(img,0,0);
shape(globe); ///因為它變成可以改變的shape
}
PImage img;
PShape globe;
void setup(){
size(300,300,P3D);
img = loadImage("earth.jpg");
globe = createShape(SPHERE,100);
globe.setTexture(img); ///可以設定貼圖
}
void draw(){
shape(globe); ///變成PShape比較厲害
}
PImage img;
PShape globe;
void setup(){
size(300,300,P3D);
img = loadImage("earth.jpg");
globe = createShape(SPHERE,100);
globe.setTexture(img);
}
void draw(){
translate(300/2,300/2);
shape(globe);
}
PImage img;
PShape globe;
void setup(){
size(300,300,P3D);
img = loadImage("earth.jpg");
globe = createShape(SPHERE,100);
globe.setStroke(false);
globe.setTexture(img);
}
void draw(){
translate(width/2,height/2);
shape(globe);
}









沒有留言:
張貼留言