diff --git a/README.md b/README.md index 2d46763e..50f1589a 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,17 @@ Examples History --------- +Version 1.2: + +- Support TGA textures +- Camera class rewritten and support added for the mouse wheel +and middle mouse button +- Lines and points supported in OBJ files +- Support loading custom textures from byte arrays +- Add method to create capsule shapes in Meshes class +- Mesh builder (vector3 method) avoids adding degenerate triangles +- Optimizations and bug fixes + Version 1.1: - Add frame.js, a frame counter helper used in some of the demos diff --git a/camera.js b/camera.js index 366ab5b9..14ea0f36 100644 --- a/camera.js +++ b/camera.js @@ -1,3 +1,154 @@ +/** @private */ +function OldCamera(scene, fov, nearZ, farZ){ + this.target=[0,0,0]; // target position + this.distance=Math.max(nearZ,10); // distance from the target in units + this.position=[0,0,this.distance]; + this.angleQuat=GLMath.quatIdentity(); + this.angleX=0; + this.angleY=0; + this.scene=scene; + this.fov=fov; + this.near=nearZ; + this.far=farZ; + if(typeof InputTracker!="undefined"){ + this.input=new InputTracker(scene.getContext().canvas); + } + this.currentAspect=this.scene.getAspect(); + this.scene.setPerspective(this.fov,this.currentAspect,this.near,this.far); + this._updateLookAt(); +} +OldCamera._vec3diff=function(a,b){ + return [a[0]-b[0],a[1]-b[1],a[2]-b[2]]; +} +/** @deprecated */ +OldCamera.prototype.moveAngleHorizontal=function(angleDegrees){ + if(angleDegrees!=0){ + this._angleHorizontal(-angleDegrees); + this._resetPosition(); + } + return this; +} +/** @private */ +OldCamera.prototype._angleHorizontal=function(angleDegrees){ + var change=((angleDegrees>=0 && angleDegrees<360) ? angleDegrees : ((angleDegrees%360)+(angleDegrees<0 ? 360 : 0)))*GLMath.PiDividedBy180; + this.angleY+=change; + this.angleY=((this.angleY>=0 && this.angleY=0 && angleDegrees<360) ? angleDegrees : ((angleDegrees%360)+(angleDegrees<0 ? 360 : 0)))*GLMath.PiDividedBy180; + this.angleX+=change; + this.angleX=((this.angleX>=0 && this.angleX