
37523.5 Designing Cameras for WebGL Apps
set the cached attributes azimuth and elevation in addition to updating the camera
matrix (Listing 23.1).
Listing 23.1 Pseudocode of a responsible camera operation with state-caching.
*
vxlCamera.prototype.rotate = function(azimuth,elevation){
//_getAngle validates the angle passed as parameter
this._relElevation = this._getAngle(elevation);
this._relAzimuth = this._getAngle(azimuth);
var valid =...//if these are valid angles continue
//otherwise veto/ignore the change
if (valid){
this._elevation + = this._relElevation;
this._azimuth + = this._relAzimuth;
this._computeMatrix();//uses the new elevation ...