⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 extrusiongl.pde

📁 This is processing for java examples.
💻 PDE
字号:
/** * Extrusion.  *  * Converts a flat image into spatial data points and rotates the points * around the center. */import processing.opengl.*;PImage a;boolean onetime = true;int[][] aPixels;int[][] values;float angle;void setup() {  size(1024, 768, OPENGL);    aPixels = new int[width][height];  values = new int[width][height];  noFill();  // Load the image into a new array  // Extract the values and store in an array  a = loadImage("ystone08.jpg");  a.loadPixels();  for (int i = 0; i < a.height; i++) {    for (int j = 0; j < a.width; j++) {      aPixels[j][i] = a.pixels[i*a.width + j];      values[j][i] = int(blue(aPixels[j][i]));    }  }}void draw() {  background(255);  translate(width/2, height/2, 0);  scale(2.0);    // Update and constrain the angle  angle += 0.005;  rotateY(angle);      // Display the image mass  for (int i = 0; i < a.height; i += 2) {    for (int j = 0; j < a.width; j += 2) {      stroke(values[j][i], 153);      line(j-a.width/2, i-a.height/2, -values[j][i], j-a.width/2, i-a.height/2, -values[j][i]-10);    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -