2025年5月15日 星期四

12751054 翁晟泰 week13

 //week13_1_processing_video

//Sketch - Library - Mange Libraries... 安裝 video

// 教學在 https://processing.org/tutorials/video

import processing.video.*; // Java 使用外掛的匯入

// 有視訊鏡頭的, 用這個版本

Capture video;

Movie movie;

void setup(){

  size(640, 480);

  //video = new Capture(this, 640, 480);

  //video.start();

  movie = new Movie(this, "processing.video.. mov");

}

void draw(){

  //if(video.available()) video.read();

  image(video, 0, 480);

  if(movie.available()) movie.read();

  image(movie, 0, 0);

}

//week13_2_camera_movie_eye_center_up
// 電腦圖學繪圖時, 會設定 camera 的相關係數
import processing.video.*;
Movie movie;
void setup(){
  size(600, 400, P3D);
  movie = new Movie(this, "street.mov");
  movie.loop();
}
void draw(){
  background(128);
  // https://processing.org/reference/camera_.html
  camera(mouseX, mouseY, 120, 300, 200, 0,  0,1,0); 
  // eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ
  
  if(movie.available())movie.read();
  image(movie, 0, 0);
}
//week13_3_texture_textureMode_beginShape_vertex_endShape
//再把貼圖加進去
PImage img;
void setup(){
  size(400, 400, P3D);
  img = loadImage("chessboard.png");
  textureMode(NORMAL);
}
void draw(){// 攝影機往前方看 左右
  camera(mouseX, 0, mouseY, mouseX, 0, mouseY-10, 0, 1, 0);
  background(128);
  beginShape();
  texture(img);
  vertex(0, 0,0, 0, 0);
  vertex(400,0, 0, 1, 0);
  vertex(400, 400,0, 1, 0);
  vertex(0, 400, 0, 0,1);
  endShape();
  beginShape();
  texture(img);
  vertex(0, 0, 0,0, 0);
  vertex(0,400, 0, 1, 0);
  vertex(0,400,400, 1, 1);
  vertex(0, 0, 400, 0,1);
}
//week13_4_texture_textureMode_beginShape_vertex_endShape
//再把貼圖加進去
PImage img;
void setup(){
  size(400, 400, P3D);
  img = loadImage("chessboard.png");
  textureMode(NORMAL);
}
void draw(){// 攝影機往前方看 左右
  camera(mouseX, 0, mouseY, mouseX, 0, mouseY-10, 0, 1, 0);
  background(128);
  beginShape();
  texture(img);
  vertex(0, 0,0, 0, 0);
  vertex(400,0, 0, 1, 0);
  vertex(400, 400,0, 1, 0);
  vertex(0, 400, 0, 0,1);
  endShape();
  beginShape();
  texture(img);
  vertex(0, 0, 0,0, 0);
  vertex(0,400, 0, 1, 0);
  vertex(0,400,400, 1, 1);
  vertex(0, 0, 400, 0,1);
}

//week13_5
//修改week13_4_texture_textureMode_beginShape_vertex_endShape
//再把貼圖加進去
PImage img;
void setup(){
  size(400, 400, P3D);
  img = loadImage("chessboard.png");
  textureMode(NORMAL);
}
float x = 200, y = 200, z = 200, angle = 180;
void keyPressed(){
  if(keyCode==LEFT)angle++;
  if(keyCode==RIGHT)angle--;
  if(keyCode==UP) {
    x += cos(radians(angle));
    z += sin(radians(angle));
  }
  if(keyCode==DOWN){
    x -= cos(radians(angle));
    z -= sin(radians(angle));
  }
}
void draw(){// 攝影機往前方看 左右
  if(keyPressed)keyPressed();
  //camera(mouseX, 0, mouseY, mouseX, 0, mouseY-10, 0, 1, 0);
  camera(x, y, z, x+cos(radians(angle)), y, z - sin(radians(angle)), 0, 1, 0);
  background(128);
  beginShape();
  texture(img);
  vertex(0, 0,0, 0, 0);
  vertex(400,0, 0, 1, 0);
  vertex(400, 400,0, 1, 0);
  vertex(0, 400, 0, 0,1);
  endShape();
  beginShape();
  texture(img);
  vertex(0, 0, 0,0, 0);
  vertex(0,400, 0, 1, 0);
  vertex(0,400,400, 1, 1);
  vertex(0, 0, 400, 0,1);
}
//week13_6_
import processing.video. *;
Movie movie;
Plmage img;
  void setup(){
    size(400, 400, P3D);
    movie = new Movvie(this, "street .mov");
    movue.loop();
    omg  = loadImage("chessboard.png");
    textureMode(NORMAL);
  }
  void draw()
  if(movie.available()) movue.read();
    vertex(0, 0,0, 0, 0);
  vertex(400,0, 0, 1, 0);
  vertex(400, 400,0, 1, 0);
  vertex(0, 400, 0, 0,1);
  endShape();
    image(movie 0, 0, 360 540_;














  





沒有留言:

張貼留言