@@ -7,7 +7,35 @@ def add(self, child):
77 ob = self ._object
88 JS ('ob.add(child)' )
99
10- class _PerspectiveCamera ( _ObjectBase ):
10+ class _Camera ( _ObjectBase ):
11+
12+ def updateProjectionMatrix (self ):
13+ ob = self ._object
14+ JS ('ob.updateProjectionMatrix()' )
15+
16+ class _OrthographicCamera ( _Camera ):
17+ def __init__ (self , left , right , top , bottom , near , far ):
18+ self ._object = JS ('new THREE.OrthographicCamera(left, right, top, bottom, near, far)' )
19+
20+ class _PerspectiveCamera ( _Camera ):
21+ def __init__ (self , fov , aspect , near , far ):
22+ self ._object = JS ('new THREE.PerspectiveCamera(fov, aspect, near, far)' )
23+
24+ def setLens (self , focalLength , frameSize ):
25+ '''Uses Focal Length (in mm) to estimate and set FOV
26+ * 35mm (fullframe) camera is used if frame size is not specified;
27+ * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html
28+ '''
29+ ob = self ._object
30+ JS ('ob.setLens(focalLength, frameSize)' )
31+
32+ def setViewOffset (self , fullWidth , fullHeight , x , y , width , height ):
33+ '''
34+ Sets an offset in a larger frustum. This is useful for multi-window or
35+ multi-monitor/multi-machine setups.
36+ '''
37+ ob = self ._object
38+ JS ('ob.setViewOffset(fullWidth, fullHeight, x, y, width, height)' )
1139
1240
1341class _Scene :
@@ -64,6 +92,10 @@ def CSS3DRenderer(self):
6492 def WebGLRenderer (self ):
6593 return _WebGLRenderer ()
6694
95+ def PerspectiveCamera (self , fov , aspect , near , far ):
96+ return _PerspectiveCamera (fov , aspect , near , far )
6797
98+ def OrthographicCamera (left , right , top , bottom , near , far ):
99+ return _OrthographicCamera (left , right , top , bottom , near , far )
68100
69101Three = _Three ()
0 commit comments