ikadzuchiさんの情報により追記
こう?
Processing
1void setup() {
2 size(800, 600, P3D);
3 noFill();
4}
5
6void draw() {
7 background(204);
8
9 //perspective(); // reset
10 //if (mousePressed) {
11 // offset(-170, 0);
12 //}
13 offset(mouseX - width/2, mouseY - height/2);
14
15 translate(300, 200);
16 box(150);
17 translate(200, 200);
18 box(150);
19 translate(0, -200, -600);
20 box(150);
21 translate(-200, 200);
22 box(150);
23
24 //copy(0, 0, 800, 600, -170, 0, 800, 600);
25}
26
27void offset(float x, float y) {
28 float fov = PI / 3;
29 float cameraZ = height / 2f / tan(fov / 2);
30 float aspect = width / float(height);
31 float ymax = cameraZ / 10 * tan(fov / 2);
32 float ymin = -ymax;
33 float xmin = ymin * aspect;
34 float xmax = ymax * aspect;
35 x /= 10;
36 y /= 10;
37 frustum(-x + xmin, -x + xmax, y + ymin, y + ymax, cameraZ / 10, cameraZ * 10);
38}
Frustum doc doesn't tell default values · Issue #1450 · processing/processing
カメラはそういうものだと思うので、camera
でどうこうするのは無理じゃないですかね?
やるとしたらcopy
でずらすか、
copy() / Reference / Processing.org
Processing
1size(800, 600, P3D);
2noFill();
3
4translate(300, 200);
5box(150);
6translate(200, 200);
7box(150);
8translate(0, -200, -600);
9box(150);
10translate(-200, 200);
11box(150);
12
13//copy(170, 0, 800, 600, 0, 0, 800, 600);
14copy(0, 0, 800, 600, -170, 0, 800, 600);
PGraphics
に描いてずらすかですかね?
Processing
1size(800, 600, P3D);
2
3PGraphics pg = createGraphics(800, 600, P3D);
4pg.beginDraw();
5pg.noFill();
6pg.background(204);
7
8pg.translate(300, 200);
9pg.box(150);
10pg.translate(200, 200);
11pg.box(150);
12pg.translate(0, -200, -600);
13pg.box(150);
14pg.translate(-200, 200);
15pg.box(150);
16pg.endDraw();
17
18image(pg, -170, 0);
ビュー?を複数持つつもりなら、peasycam
を使うと楽かもしれません。
peasycam/MultiView_Offscreen.pde at master · jdf/peasycam
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/09/11 13:31
2022/09/11 15:28
2022/09/18 16:24