mirror of
https://github.com/processing/processing4.git
synced 2026-02-26 08:44:39 +01:00
39 lines
617 B
Plaintext
39 lines
617 B
Plaintext
// my basic Point Of View camera class.
|
|
|
|
class POV{
|
|
float x,y,z;
|
|
|
|
float elevation;
|
|
float azimuth;
|
|
float distance;
|
|
|
|
POV (float sentDistance){
|
|
distance = sentDistance;
|
|
x = xMid;
|
|
y = yMid;
|
|
azimuth = 0;
|
|
elevation = 0;
|
|
}
|
|
|
|
void exist(){
|
|
setPosition();
|
|
setCamera();
|
|
}
|
|
|
|
void setPosition(){
|
|
x -= (x - xMid) * .2;
|
|
y -= (y - yMid) * .2;
|
|
if (outside){
|
|
z -= (z + distance) * .2;
|
|
} else {
|
|
z -= (z - distance) * .2;
|
|
}
|
|
}
|
|
|
|
void setCamera(){
|
|
translate(x, y, z);
|
|
rotateY(elevation);
|
|
rotateZ(-azimuth);
|
|
}
|
|
}
|