回答編集履歴
5
見直しキャンペーン中
test
CHANGED
@@ -1,4 +1,51 @@
|
|
1
|
+
ikadzuchiさんの情報により追記
|
2
|
+
こう?
|
3
|
+
```Processing
|
4
|
+
void setup() {
|
5
|
+
size(800, 600, P3D);
|
6
|
+
noFill();
|
7
|
+
}
|
8
|
+
|
9
|
+
void draw() {
|
10
|
+
background(204);
|
11
|
+
|
12
|
+
//perspective(); // reset
|
13
|
+
//if (mousePressed) {
|
14
|
+
// offset(-170, 0);
|
15
|
+
//}
|
16
|
+
offset(mouseX - width/2, mouseY - height/2);
|
17
|
+
|
18
|
+
translate(300, 200);
|
19
|
+
box(150);
|
20
|
+
translate(200, 200);
|
21
|
+
box(150);
|
22
|
+
translate(0, -200, -600);
|
23
|
+
box(150);
|
24
|
+
translate(-200, 200);
|
25
|
+
box(150);
|
26
|
+
|
27
|
+
//copy(0, 0, 800, 600, -170, 0, 800, 600);
|
28
|
+
}
|
29
|
+
|
30
|
+
void offset(float x, float y) {
|
31
|
+
float fov = PI / 3;
|
32
|
+
float cameraZ = height / 2f / tan(fov / 2);
|
33
|
+
float aspect = width / float(height);
|
34
|
+
float ymax = cameraZ / 10 * tan(fov / 2);
|
35
|
+
float ymin = -ymax;
|
36
|
+
float xmin = ymin * aspect;
|
37
|
+
float xmax = ymax * aspect;
|
38
|
+
x /= 10;
|
39
|
+
y /= 10;
|
40
|
+
frustum(-x + xmin, -x + xmax, y + ymin, y + ymax, cameraZ / 10, cameraZ * 10);
|
41
|
+
}
|
42
|
+
```
|
43
|
+
[Frustum doc doesn't tell default values · Issue #1450 · processing/processing](https://github.com/processing/processing/issues/1450)
|
44
|
+
![アプリ動画](https://ddjkaamml8q8x.cloudfront.net/questions/2023-08-16/2c23a19f-4f3d-4654-a539-1c1528acb82e.gif)
|
45
|
+
|
46
|
+
---
|
47
|
+
|
1
|
-
~~カメラはそういうものだと思うので、`camera`でどうこうするのは無理じゃないですかね?~~
|
48
|
+
~~カメラはそういうものだと思うので、`camera`でどうこうするのは無理じゃないですかね?~~
|
2
49
|
|
3
50
|
やるとしたら`copy`でずらすか、
|
4
51
|
[copy() / Reference / Processing.org](https://processing.org/reference/copy_.html)
|
@@ -45,49 +92,3 @@
|
|
45
92
|
|
46
93
|
ビュー?を複数持つつもりなら、`peasycam`を使うと楽かもしれません。
|
47
94
|
[peasycam/MultiView_Offscreen.pde at master · jdf/peasycam](https://github.com/jdf/peasycam/blob/master/examples/MultiView_Offscreen/MultiView_Offscreen.pde)
|
48
|
-
|
49
|
-
---
|
50
|
-
|
51
|
-
ikadzuchiさんの情報により追記
|
52
|
-
|
53
|
-
こう?
|
54
|
-
```Processing
|
55
|
-
void setup() {
|
56
|
-
size(800, 600, P3D);
|
57
|
-
noFill();
|
58
|
-
}
|
59
|
-
|
60
|
-
void draw() {
|
61
|
-
background(204);
|
62
|
-
|
63
|
-
perspective(); // reset
|
64
|
-
if (mousePressed) {
|
65
|
-
offset(-170, 0);
|
66
|
-
}
|
67
|
-
|
68
|
-
translate(300, 200);
|
69
|
-
box(150);
|
70
|
-
translate(200, 200);
|
71
|
-
box(150);
|
72
|
-
translate(0, -200, -600);
|
73
|
-
box(150);
|
74
|
-
translate(-200, 200);
|
75
|
-
box(150);
|
76
|
-
|
77
|
-
//copy(0, 0, 800, 600, -170, 0, 800, 600);
|
78
|
-
}
|
79
|
-
|
80
|
-
void offset(float x, float y) {
|
81
|
-
float fov = PI / 3;
|
82
|
-
float cameraZ = height / 2f / tan(fov / 2);
|
83
|
-
float aspect = width / float(height);
|
84
|
-
float ymax = cameraZ / 10 * tan(fov / 2);
|
85
|
-
float ymin = -ymax;
|
86
|
-
float xmin = ymin * aspect;
|
87
|
-
float xmax = ymax * aspect;
|
88
|
-
x /= 10;
|
89
|
-
y /= 10;
|
90
|
-
frustum(-x + xmin, -x + xmax, y + ymin, y + ymax, cameraZ / 10, cameraZ * 10);
|
91
|
-
}
|
92
|
-
```
|
93
|
-
[Frustum doc doesn't tell default values · Issue #1450 · processing/processing](https://github.com/processing/processing/issues/1450)
|
4
追記参照
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
~~カメラはそういうものだと思うので、
|
1
|
+
~~カメラはそういうものだと思うので、`camera`でどうこうするのは無理じゃないですかね?~~(追記参照)
|
2
2
|
|
3
3
|
やるとしたら`copy`でずらすか、
|
4
4
|
[copy() / Reference / Processing.org](https://processing.org/reference/copy_.html)
|
3
嘘
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
カメラはそういうものだと思うので、`camera`でどうこうするのは無理じゃないですかね?
|
1
|
+
~~カメラはそういうものだと思うので、~~`camera`でどうこうするのは無理じゃないですかね?
|
2
2
|
|
3
3
|
やるとしたら`copy`でずらすか、
|
4
4
|
[copy() / Reference / Processing.org](https://processing.org/reference/copy_.html)
|
2
frustum
test
CHANGED
@@ -45,3 +45,49 @@
|
|
45
45
|
|
46
46
|
ビュー?を複数持つつもりなら、`peasycam`を使うと楽かもしれません。
|
47
47
|
[peasycam/MultiView_Offscreen.pde at master · jdf/peasycam](https://github.com/jdf/peasycam/blob/master/examples/MultiView_Offscreen/MultiView_Offscreen.pde)
|
48
|
+
|
49
|
+
---
|
50
|
+
|
51
|
+
ikadzuchiさんの情報により追記
|
52
|
+
|
53
|
+
こう?
|
54
|
+
```Processing
|
55
|
+
void setup() {
|
56
|
+
size(800, 600, P3D);
|
57
|
+
noFill();
|
58
|
+
}
|
59
|
+
|
60
|
+
void draw() {
|
61
|
+
background(204);
|
62
|
+
|
63
|
+
perspective(); // reset
|
64
|
+
if (mousePressed) {
|
65
|
+
offset(-170, 0);
|
66
|
+
}
|
67
|
+
|
68
|
+
translate(300, 200);
|
69
|
+
box(150);
|
70
|
+
translate(200, 200);
|
71
|
+
box(150);
|
72
|
+
translate(0, -200, -600);
|
73
|
+
box(150);
|
74
|
+
translate(-200, 200);
|
75
|
+
box(150);
|
76
|
+
|
77
|
+
//copy(0, 0, 800, 600, -170, 0, 800, 600);
|
78
|
+
}
|
79
|
+
|
80
|
+
void offset(float x, float y) {
|
81
|
+
float fov = PI / 3;
|
82
|
+
float cameraZ = height / 2f / tan(fov / 2);
|
83
|
+
float aspect = width / float(height);
|
84
|
+
float ymax = cameraZ / 10 * tan(fov / 2);
|
85
|
+
float ymin = -ymax;
|
86
|
+
float xmin = ymin * aspect;
|
87
|
+
float xmax = ymax * aspect;
|
88
|
+
x /= 10;
|
89
|
+
y /= 10;
|
90
|
+
frustum(-x + xmin, -x + xmax, y + ymin, y + ymax, cameraZ / 10, cameraZ * 10);
|
91
|
+
}
|
92
|
+
```
|
93
|
+
[Frustum doc doesn't tell default values · Issue #1450 · processing/processing](https://github.com/processing/processing/issues/1450)
|
1
シンタックスハイライト忘れ
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
やるとしたら`copy`でずらすか、
|
4
4
|
[copy() / Reference / Processing.org](https://processing.org/reference/copy_.html)
|
5
|
-
```
|
5
|
+
```Processing
|
6
6
|
size(800, 600, P3D);
|
7
7
|
noFill();
|
8
8
|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
```
|
21
21
|
|
22
22
|
`PGraphics`に描いてずらすかですかね?
|
23
|
-
```
|
23
|
+
```Processing
|
24
24
|
size(800, 600, P3D);
|
25
25
|
|
26
26
|
PGraphics pg = createGraphics(800, 600, P3D);
|