File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,13 @@ var Camera3D = new Class({
3939 this . viewportHeight = 0 ;
4040 } ,
4141
42+ setPosition : function ( x , y , z )
43+ {
44+ this . position . set ( x , y , z ) ;
45+
46+ return this . update ( ) ;
47+ } ,
48+
4249 /**
4350 * Sets the width and height of the viewport. Does not
4451 * update any matrices.
@@ -190,7 +197,48 @@ var Camera3D = new Class({
190197 update : function ( )
191198 {
192199 // Left empty for subclasses
200+ return this ;
201+ } ,
202+
203+ x : {
204+ get : function ( )
205+ {
206+ return this . position . x ;
207+ } ,
208+
209+ set : function ( value )
210+ {
211+ this . position . x = value ;
212+ this . update ( ) ;
213+ }
214+ } ,
215+
216+ y : {
217+ get : function ( )
218+ {
219+ return this . position . y ;
220+ } ,
221+
222+ set : function ( value )
223+ {
224+ this . position . y = value ;
225+ this . update ( ) ;
226+ }
227+ } ,
228+
229+ z : {
230+ get : function ( )
231+ {
232+ return this . position . z ;
233+ } ,
234+
235+ set : function ( value )
236+ {
237+ this . position . z = value ;
238+ this . update ( ) ;
239+ }
193240 }
241+
194242} ) ;
195243
196244Camera3D . FAR_RANGE = 1.0 ;
Original file line number Diff line number Diff line change 1- var Camera = require ( './Camera3D' ) ;
1+ var Camera3D = require ( './Camera3D' ) ;
22var Class = require ( '../utils/Class' ) ;
33var Matrix4 = require ( '../math/Matrix4' ) ;
44var Vector3 = require ( '../math/Vector3' ) ;
@@ -10,14 +10,14 @@ var tmpVec3 = new Vector3();
1010
1111var OrthographicCamera = new Class ( {
1212
13- Extends : Camera ,
13+ Extends : Camera3D ,
1414
1515 initialize : function ( viewportWidth , viewportHeight )
1616 {
1717 if ( viewportWidth === undefined ) { viewportWidth = 0 ; }
1818 if ( viewportHeight === undefined ) { viewportHeight = 0 ; }
1919
20- Camera . call ( this ) ;
20+ Camera3D . call ( this ) ;
2121
2222 this . viewportWidth = viewportWidth ;
2323 this . viewportHeight = viewportHeight ;
@@ -55,7 +55,7 @@ var OrthographicCamera = new Class({
5555 var far = Math . abs ( this . far ) ;
5656 var zoom = this . zoom ;
5757
58- if ( w === 0 || h === 0 )
58+ if ( w === 0 || h === 0 )
5959 {
6060 // What to do here... hmm?
6161 return this ;
@@ -84,14 +84,15 @@ var OrthographicCamera = new Class({
8484
8585 zoom : {
8686
87- set : function ( value )
87+ get : function ( )
8888 {
89- this . _zoom = value ;
89+ return this . _zoom ;
9090 } ,
9191
92- get : function ( )
92+ set : function ( value )
9393 {
94- return this . _zoom ;
94+ this . _zoom = value ;
95+ this . update ( ) ;
9596 }
9697 }
9798
Original file line number Diff line number Diff line change 1- var Camera = require ( './Camera3D' ) ;
1+ var Camera3D = require ( './Camera3D' ) ;
22var Class = require ( '../utils/Class' ) ;
33var Matrix4 = require ( '../math/Matrix4' ) ;
4+ var Vector2 = require ( '../math/Vector2' ) ;
45var Vector3 = require ( '../math/Vector3' ) ;
56var Vector4 = require ( '../math/Vector4' ) ;
67
@@ -13,7 +14,7 @@ var billboardMatrix = new Matrix4();
1314
1415var PerspectiveCamera = new Class ( {
1516
16- Extends : Camera ,
17+ Extends : Camera3D ,
1718
1819 // FOV is converted to radians
1920 initialize : function ( fieldOfView , viewportWidth , viewportHeight )
@@ -22,7 +23,7 @@ var PerspectiveCamera = new Class({
2223 if ( viewportWidth === undefined ) { viewportWidth = 0 ; }
2324 if ( viewportHeight === undefined ) { viewportHeight = 0 ; }
2425
25- Camera . call ( this ) ;
26+ Camera3D . call ( this ) ;
2627
2728 this . viewportWidth = viewportWidth ;
2829 this . viewportHeight = viewportHeight ;
Original file line number Diff line number Diff line change 33module . exports = {
44
55 Camera : require ( './Camera' ) ,
6+ Camera3D : require ( './Camera3D' ) ,
7+ PerspectiveCamera : require ( './PerspectiveCamera' ) ,
8+ OrthographicCamera : require ( './OrthographicCamera' ) ,
9+
610 KeyControl : require ( './KeyControl' ) ,
711 SmoothedKeyControl : require ( './SmoothedKeyControl' )
812
Load diff This file was deleted.
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ var Phaser = {
1919
2020 Create : require ( './create/' ) ,
2121
22- Cameras3D : require ( './camera3d /' ) ,
22+ Cameras : require ( './camera /' ) ,
2323
2424 DOM : require ( './dom/' ) ,
2525
You can’t perform that action at this time.
0 commit comments