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