Skip to Main Content
WebGL Insights
book

WebGL Insights

by Patrick Cozzi
August 2015
Intermediate to advanced content levelIntermediate to advanced
416 pages
16h 58m
English
A K Peters/CRC Press
Content preview from WebGL Insights
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning HTML5 Game Programming: Build Online Games with Canvas, SVG, and WebGL

Learning HTML5 Game Programming: Build Online Games with Canvas, SVG, and WebGL

James L. Williams

Publisher Resources

ISBN: 9781498716079