=================================
=================================
=================================
출처: https://workshop.chromeexperiments.com/examples/gui/#1--Basic-Usage
1. Basic Usage
With very little code, dat.GUI creates an interface that you can use to modify variables.
<script type="text/javascript" src="dat.gui.js"></script>
<script type="text/javascript">
var FizzyText = function() {
this.message = 'dat.gui';
this.speed = 0.8;
this.displayOutline = false;
this.explode = function() { ... };
// Define render logic ...
};
window.onload = function() {
var text = new FizzyText();
var gui = new dat.GUI();
gui.add(text, 'message');
gui.add(text, 'speed', -5, 5);
gui.add(text, 'displayOutline');
gui.add(text, 'explode');
};
</script>
- The property must be public, i.e. defined by
this.prop = value
- dat.GUI determines controller type based on a property's initial value
- Press H to show/hide all GUI's.
=================================
=================================
=================================
출처: http://www.sw-engineering-candies.com/blog-1/three-simpledatgui-a-simple-user-interface-for-webgl-with-the-look-feel-of-dat-gui
Expected Results
The First Demo of THREE.SimpleDatGui shows the use in an Oculus Rift WebGL Application
- Get the project:
Fork project on GitHub (https://github.com/MarkusSprunck/oculus-rift-sensor-connector.git) and/or download the zip (https://github.com/MarkusSprunck/oculus-rift-sensor-connector). - Connect your Oculus Rift DK2 to your computer:
Use the Oculus Configuration Utility to set the Rift Display Mode to Extended Desktop to the HMD. - Start ./target/OculusRiftSensorConnector.jar:
You may use OculusRiftSensorConnector.cmd on Windows. The compiled version expects Java 8 runtime, but it should work also with elder Java versions (maybe you have to change some lines). - Open ./client/THREE.SimpleDatGuiOculusRiftDemo.html:
Chrome Options for Local Development - The Google Chrome browser will not load local file by default due to security reason. When you fork the project and open from file system, start with the command line option --allow-file-access-from-files to load the textures. See alsohttp://www.chrome-allow-file-access-from-file.com/ - Activate Connection to Oculus Rift:
Oculus Control is not active by default, because most visitors will not have the Oculus Rift hardware connected when opening. In this case you may use the standard trackbar control to move the scene. To connect to Oculus Rift, just open folder Advanced Options and check Oculus Control Active.
- THREE.SimpleDatGui.js and
- Helvetiker_regular.typeface.js - is part of THREE.js distribution, under the path ".\examples\fonts\"
- THREE.OculusRiftMouse - renders two mouse cursors (the mouse icons are in the folder '.\textures\')
- THREE.OculusRiftControls - optional to get sensor data from Oculus Rift
Tested Configurations
THREE.SimpleDatGuiOculusRiftDemo.html has been tested with the following browsers on Windows 7 with Oculus Rift:- Chrome 43 (~60 FPS)
- Firefox 38 (~60 FPS)
- Internet Explorer 11 (~30 FPS, definitely to slow for Oculus Rift mode, but good enough for non Oculus Rift)
- Safari (~50 FPS)
- Chrome (~50 FPS)
Features
Implemented Controls
- Button - executes a callback function
- Text-Input - edit a string
- Value-Input - edit numbers & slider support
- CheckBox - change a boolean value
- ComboBox - select a single value from an array of values
Missing Features
- ColorPicker control
- Save & restore of values
- Copy & paste support in text and value controls
- Slider accepts mouse drag (not only mouse click) [implemented in version 11]
Credits
Equirectangular Pictures
- http://commons.wikimedia.org/wiki/File:Place_Dauphine,_Paris_November_2011.jpg
- http://commons.wikimedia.org/wiki/File:Place_de_la_Concorde,_Paris_March_2007.jpg
- http://commons.wikimedia.org/wiki/File:Parc_de_Belleville,_Paris_June_2007.jpg
- Ricardo Cabello for three.js (see https://github.com/mrdoob)
- Daniel Kwiecinski for hashmap.js
Find Code on GitHub
=================================
=================================
=================================
기타관련링크:
three css 연동
- https://codepen.io/AdamEDGE/pen/RRjEwz
three.js css 텍스트 가져오기
- https://jsfiddle.net/trusktr/jc6j1wmf/
Handling Keyboard Input with JavaScript:
http://blog.mrroa.com/2014/06/05/handling-keyboard-input-with-javascript/
Three, CSS3D Mix TextInput
Three, CSS3D Mix TextInput
https://codepen.io/trusktr/pen/OzJJJN?editors=0010
Three, Html Page Mix
https://github.com/jeromeetienne/threex.htmlmixer
http://jeromeetienne.github.io/threex.htmlmixer/examples/demo.html#default
Three GUI 데모
https://stemkoski.github.io/MathBox/dat-gui-demo.html
캔버스 텍스트 입력 소스 다운로드:
https://goldfirestudios.com/blog/108/CanvasInput-HTML5-Canvas-Text-Input
캔버스 텍스트 입력기:
https://codepen.io/jdnichollsc/pen/waVMdB?editors=001
three dat,gui 예제:
https://codepen.io/webhacck/pen/QyxVpw
three dat.gui 예제:
https://jsfiddle.net/greggman/x41s2qhm/
=================================
=================================
=================================
'WEB > WebGL' 카테고리의 다른 글
[WebGL] Three.js - dat.GUI 사이트, 라이브러리 다운로드 (0) | 2017.12.21 |
---|---|
[WebGL] Three.js - Three 사이트, 라이브러리 다운로드 (0) | 2017.12.21 |
[WebGL] Three.js - 마우스 위치, 이벤트 관련 (0) | 2017.11.14 |
[WebGL] Three.js - 선그리기 자유곡선 관련 (0) | 2017.11.14 |
[WebGL] WebGL FBO(Frame Buffer Object) 관련 (0) | 2017.11.13 |