问题描述
问题
注意:我不能使用 Box()
我正在尝试从仅 4 个处理点生成 3D 形状。我遇到的问题是,当我使用 createShape() 时,Processing 会用 2D 平面填充形状,但无论如何我都找不到“加厚”它:
我的尝试
作为一种解决方法,我使用线条而不是 createShape() 来“加厚”形状。结果如下:
唯一的问题是光照不再起作用,因为笔划不会根据光照而改变,因此您无法感知形状的深度。
无论如何都可以产生所需的结果并保持照明?
import peasy.*;
PeasyCam camera;
void setup() {
size(800,800,P3D);
camera = new PeasyCam(this,50,100);
camera.reset();
}
void draw() {
background(0);
lights();
//createShapeMethod();
//lineMethod();
stroke(255);
strokeWeight(1);
plotPoint(0,0);
plotPoint(100,-100);
plotPoint(0,-100);
}
void beginShapeMethod() {
stroke(255);
fill(color(255,0));
beginShape();
vertex(0,0);
vertex(100,-100);
vertex(0,-100);
endShape(CLOSE);
}
void lineMethod() {
strokeWeight(40);
stroke(color(255,0));
int f = 100;
for (int i = 0; i < f; i++) {
line(
i,i,-100
);
}
}
void plotPoint(int x,int y,int z) {
translate(x,y,z);
sphere(5);
translate(-x,-y,-z);
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)