File: Viewport.Camera.js

package info (click to toggle)
three.js 111%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 15,212 kB
  • sloc: javascript: 133,174; makefile: 24; sh: 1
file content (48 lines) | stat: -rw-r--r-- 767 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
 * @author mrdoob / http://mrdoob.com/
 */

Viewport.Camera = function ( editor ) {

	var signals = editor.signals;

	//

	var cameraSelect = new UI.Select();
	cameraSelect.setPosition( 'absolute' );
	cameraSelect.setRight( '10px' );
	cameraSelect.setTop( '10px' );
	cameraSelect.onChange( function () {

		editor.setViewportCamera( this.getValue() );

	} );

	signals.cameraAdded.add( update );
	signals.cameraRemoved.add( update );

	update();

	//

	function update() {

		var options = {};

		var cameras = editor.cameras;

		for ( var key in cameras ) {

			var camera = cameras[ key ];
			options[ camera.uuid ] = camera.name;

		}

		cameraSelect.setOptions( options );
		cameraSelect.setValue( editor.viewportCamera.uuid );

	}

	return cameraSelect;

};