camera()
Lights Camera / CameraDescription
Sets the position of the camera by defining the eye position, center of the scene, and up direction.
Syntax
void camera()
void camera(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
Parameters
| Name | Type | Description |
|---|---|---|
| eyeX/Y/Z | float | position of the camera eye |
| centerX/Y/Z | float | center of the scene |
| upX/Y/Z | float | up direction vector |
Returns
voidRelated
Under the Hood
From Processing.h:
void camera();
void camera(float ex,float ey,float ez,float cx,float cy,float cz,float ux,float uy,float uz);
Under the Hood
From Processing.cpp:
void PApplet::camera(){
applyDefaultCamera();
}
void PApplet::camera(float ex,float ey,float ez,float cx,float cy,float cz,float ux,float uy,float uz){
float eyeZ = ((float)logicalH/2.0f) / std::tan(PI*60.0f/360.0f);
float near_ = eyeZ/10.0f, far_ = eyeZ*10.0f;
glMatrixMode(GL_PROJECTION); glLoadIdentity();
glScalef(1,-1,1);
_gluPerspective(60.0,(double)logicalW/logicalH,near_,far_);
glMatrixMode(GL_MODELVIEW); glLoadIdentity();
_gluLookAt(ex,ey,ez,cx,cy,cz,ux,uy,uz);
glFrontFace(GL_CW);
glDisable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
}