@@ -286,6 +286,53 @@ def lower(self):
286286 }
287287 return data
288288
289+ class PerspectiveCamera (SceneElement ):
290+ """
291+ Checkout https://threejs.org/docs/#api/en/cameras/PerspectiveCamera
292+ """
293+ def __init__ (self , fov , aspect , near , far , zoom ):
294+ """
295+ fov : Camera frustum vertical field of view, from bottom to top of view, in degrees. Default is 50.
296+ aspect: Camera frustum aspect ratio, usually the canvas width / canvas height. Default is 1 (square canvas).
297+ near : Camera frustum near plane. Default is 0.1. The valid range is greater than 0 and less than the current
298+ value of the far plane. Note that, unlike for the OrthographicCamera, 0 is not a valid value for a
299+ PerspectiveCamera's near plane.
300+ far : Camera frustum far plane. Default is 2000.
301+ zoom : Gets or sets the zoom factor of the camera. Default is 1.
302+ filmGauge: Film size used for the larger axis. Default is 35 (millimeters). This parameter does not influence
303+ the projection matrix unless .filmOffset is set to a nonzero value.
304+ filmOffset: Horizontal off-center offset in the same unit as .filmGauge. Default is 0.
305+ focus: Object distance used for stereoscopy and depth-of-field effects. This parameter does not influence
306+ the projection matrix unless a StereoCamera is being used. Default is 10.
307+ """
308+ #super(PerspectiveCamera, self).__init__()
309+ SceneElement .__init__ (self )
310+ self .aspect = aspect
311+ self .far = far
312+ self .filmGauge = 35
313+ self .filmOffset = 0
314+ self .focus = 10
315+ self .fov = fov
316+ self .near = near
317+ self .zoom = zoom
318+
319+ def lower (self ):
320+ data = {
321+ u"object" : {
322+ u"uuid" : self .uuid ,
323+ u"type" : u"PerspectiveCamera" ,
324+ u"aspect" : self .aspect ,
325+ u"far" : self .far ,
326+ u"filmGauge" : self .filmGauge ,
327+ u"filmOffset" : self .filmOffset ,
328+ u"focus" : self .focus ,
329+ u"fov" : self .fov ,
330+ u"near" : self .near ,
331+ u"zoom" : self .zoom ,
332+ }
333+ }
334+ return data
335+
289336def item_size (array ):
290337 if array .ndim == 1 :
291338 return 1
0 commit comments