mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Updated OrthoVSPerspective example
This commit is contained in:
@@ -27,11 +27,11 @@ void draw()
|
||||
|
||||
if(mousePressed) {
|
||||
float fov = PI/3.0;
|
||||
float cameraZ = (height/2.0) / tan(PI * fov / 360.0);
|
||||
float cameraZ = (height/2.0) / tan(fov/2.0);
|
||||
perspective(fov, float(width)/float(height),
|
||||
cameraZ/2.0, cameraZ*2.0);
|
||||
} else {
|
||||
ortho(-width/2, width/2, -height/2, height/2, -10, 10);
|
||||
ortho(0, width, 0, height);
|
||||
}
|
||||
|
||||
translate(width/2, height/2, 0);
|
||||
|
||||
Reference in New Issue
Block a user