├── .gitattributes ├── .gitignore ├── README.md ├── commander.php ├── comms.php ├── css ├── edpanel.css ├── styles.css └── ttf │ ├── Eurostile.ttf │ └── EurostileBold.ttf ├── data ├── milkyway.json └── spectral-colors.json ├── explorationdata.php ├── fuel.php ├── func.php ├── img ├── galaxyBackgroundV3.png ├── galaxyBackgroundV4.png ├── pipDividers.png └── pipDividers_pi.png ├── inc.php ├── index.php ├── js ├── components │ ├── action.class.js │ ├── galaxy.class.js │ ├── grid.class.js │ ├── hud.class.js │ ├── icon.class.js │ ├── route.class.js │ └── system.class.js ├── ed3dmap.js └── ed3dmap.min.js ├── location.php ├── nextjump.php ├── panel.php ├── pi.php ├── pips.php ├── schemas ├── ed3d-full.json └── ed3d-simple.json ├── ship_name_id.php ├── textures ├── heightmap2.jpg ├── heightmap7.jpg └── lensflare │ ├── flare.png │ ├── flare2.png │ ├── flare3.png │ ├── lensflare0.png │ ├── lensflare1.png │ ├── lensflare2.png │ ├── lensflare3.png │ ├── lensflare_white.png │ ├── lensflare_white2.png │ ├── star_grey.png │ ├── star_grey2.png │ └── star_yellow.png └── vendor ├── renderstats ├── README.md └── threex.rendererstats.js ├── three-js ├── CSS3DRenderer.js ├── FontUtils.js ├── OrbitControls.js ├── Projector.js ├── RaytracingRenderer.js ├── ShaderMaterial.js ├── TextGeometry.js ├── helvetiker_regular.typeface.js ├── postprocessing │ ├── AdaptiveToneMappingPass.js │ ├── BloomPass.js │ ├── BokehPass.js │ ├── EffectComposer.js │ ├── MaskPass.js │ ├── RenderPass.js │ └── ShaderPass.js └── shaders │ ├── BokehShader.js │ ├── ConvolutionShader.js │ └── CopyShader.js └── tween-js └── Tween.js /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | data/edsm.json 3 | data/data.json 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EDStatusPanel 2 | A status monitor for Elite Dangerous, written in PHP. Designed for 1080p screens in the four-panel-view in panel.php, and for 7 inch screens with a resolution of 1024x600 connected to a Raspberry Pi. 3 | 4 | ## HORIZONS / ODYSSEY COMPATIBILITY 5 | I have tested the panels in Odyssey and they work as they would in Horizons. Frontier added a second Status Flags section (Flags2) which mostly contains information about on-foot events. The ship and SRV info remained the same, hence no compatibility issues. 6 | 7 | ## QUICK START GUIDE 8 | If you want to hit the ground running: 9 | - Install XAMPP (Apache Friends) on the computer you are running Elite Dangerous on 10 | - Download this repository as zip file (click the green "Code" button and Download Zip) 11 | - Place the content in the the htdocs folder of where you installed XAMPP - for example, C:\xampp\htdocs 12 | - Rename the folder from "EDStatusPanel-main" to something nicer, say, "ed" or "panel" 13 | - Open the file "inc.php" in a text editor and adjust the resolution to your screen, also adjust the folder to where your Elite Dangerous Journal files are stored 14 | - Open the XAMPP control panel through the Start Menu on Windows 15 | - At the Apache entry, click the "Start" button 16 | - RUN THE GAME and enter it in any mode you like (doesn't matter if Solo or Open) 17 | - Open a web browser on any machine (Raspberry Pi, laptop, doesn't matter) and navigate to the IP address of your computer, and the path to the panels, for example: http://192.168.1.46/panel/ 18 | - Select what you want! 19 | - You can find the IP address of your computer by opening a Command Prompt in Windows and typing "ipconfig" 20 | - If everything went well, you should now see a live-updating panel. Congrats! 21 | 22 | ## IMPORTANT 23 | Make sure that the path stated in inc.php is accessible by the web server you are putting these files on. Otherwise the monitor won't work. 24 | 25 | The file panel.php is the main file to open the status monitor. 26 | 27 | Put the browser that displays the panel to full screen mode so that everything aligns perfectly on a 1080p screen. 28 | 29 | Obviously, the game needs to run for this to work. 30 | 31 | ## Panels 32 | The top left shows your current location info, including the info for your next jump and if it is a fuel-scoopable star. It includes a galaxy graphic showing Sol's position in blue and your position in red. Further you see your current absolute coordinates. Additionally, the distance to SOL in light years (simple distance formula for 3D vectors). 33 | 34 | The top right shows the current state of events. There are 32 labelled indicators, which have been assigned different colors for their purpose. You can change those in the CSS file. I convert the flags of the Status.json and evaluate the state of each byte to make them light up. Further you see your current fuel as well as the distribution of your Pips. 35 | 36 | The bottom left is simply a collection of received chat messages, with the latest message on top. 37 | 38 | The bottom right is an exploration log of the current session. It shows quite a number of things, such as FSS results, details of scanned orbital bodies... etc. It also shows if a planet has been discovered previously (D), if it has been mapped with the DSS (M) and if it is landable (L). In addition it highlights if a system scan is completed. Further, it lets you know if POI's have been found on the planet, and if so, how many, plus, their names with distance. 39 | 40 | ## Web server 41 | My local installation uses PHP 8.0, may work with 7.x also. I have been told that sometimes there could be a permissions issue on the folder and/or files in the web server, should you see a black page when opening panel.php . 42 | 43 | To be more precise, I am running an XAMPP installation on the machine that runs Elite Dangerous. 44 | 45 | ## Raspberry Pi (display only!) 46 | If have added a new file: pi.php . This file can display all parts of the above mentioned panels, however it is split up into the four parts. Please note that this is designed to run on full screen 7-inch-displays with dimensions of 1024 x 600 pixels. This allows for panels to be mounted to your desk for example. 47 | 48 | Fuel bars and pips have been adjusted accordingly. The galaxy map has seen a complete refit compared to the four-panel-layout in panel.php . I will eventually merge that code into the normal panel too. 49 | 50 | Also, all panels update every two seconds - except the location panel. In order to decrease CPU load, there is a timer in the code which checks every three seconds if you jumped to another system. If so, the map is reloaded. 51 | 52 | Every system you visit is recorded in the data/data.json file. So in time, it becomes your own out-of-game journal of systems you have visited, and/or planned to visit. 53 | 54 | If you have a route set, it will automatically be displayed in the galaxy map. 55 | 56 | While the Location panel only can only display this one page, the other three have links on top to switch between them. The following switches are implemented: 57 | 58 | - pi.php?panel=location - Shows the location panel 59 | - pi.php?panel=status - The status panel with indicators, fuel, and pips (links on top) 60 | - pi.php?panel=comms - Chat messages of the session (links on top) 61 | - pi.php?panel=exp - Exploration data of the session (links on top) 62 | 63 | Just to get the obvious out of the way: the Pi needs to have a graphical desktop environment and a browser, such as Firefox (recommended), Chromium, etc. Navigate to the local IP and pi.php with the corresponding switch to see the panel you want. 64 | 65 | In my case, I have two identical 7 inch displays connected to the Pi so that I can display the location on the left, and the other panels on the right. 66 | 67 | ## 3D galaxy map 68 | For the 3D map to work (which I will implement in the four-view-panel too), I needed to merge nearly everything from another project into this one. 69 | 70 | I have made a few changes to the minified JS script in order to ease the CPU usage on the Pi as follows: 71 | - Instead of 10,000 random star sprites being generated, this number is reduced to 3,500. 72 | - The scale factor (as it is called in the code) at which the view switches to an empty black view with only a grid has been significantly reduced so that it almost never switches into that view. This is done so that the map basically looks cooler and retains the fog and star effect when zoomed in to a local area 73 | 74 | Source of 3D map: https://github.com/gbiobob/ED3D-Galaxy-Map -------------------------------------------------------------------------------- /commander.php: -------------------------------------------------------------------------------- 1 | 13 | -------------------------------------------------------------------------------- /comms.php: -------------------------------------------------------------------------------- 1 | 0; $i--) 11 | { 12 | if ($data[$i]["event"] == $events[0]) 13 | { 14 | if ($data[$i]["Message_Localised"] != "") 15 | { 16 | if ($data[$i]["From_Localised"] != "") 17 | { echo "[ ".$data[$i]["From_Localised"]." ] ".$data[$i]["Message_Localised"]."
"; } 18 | else 19 | { echo "[ ".$data[$i]["From"]." ] ".$data[$i]["Message_Localised"]."
"; } 20 | } 21 | else 22 | { echo "[ ".$data[$i]["From"]." ] : ".$data[$i]["Message"]."
"; } 23 | } 24 | } 25 | } 26 | 27 | ?> 28 | -------------------------------------------------------------------------------- /css/edpanel.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Eurostile'; /*a name to be used later*/ 3 | src: url('ttf/Eurostile.ttf'); /*URL to font*/ 4 | } 5 | 6 | @font-face { 7 | font-family: 'EurostileBold'; /*a name to be used later*/ 8 | src: url('ttf/EurostileBold.ttf'); /*URL to font*/ 9 | } 10 | 11 | body { margin: 0px; background-color: #040404; overflow: hidden; } 12 | 13 | a 14 | { 15 | color: #fdb100; 16 | font-size: 20px; 17 | font-family: "Eurostile"; 18 | } 19 | a:visited 20 | { 21 | color: #fdb100; 22 | font-size: 20px; 23 | font-family: "Eurostile"; 24 | } 25 | 26 | .ed_header 27 | { 28 | height: 70px; 29 | width: 100%; 30 | font-family: "Eurostile"; 31 | color: #FEFEFE; 32 | } 33 | 34 | .ed_section_header 35 | { 36 | font-family: "EurostileBold"; 37 | color: #fdb100; 38 | font-size: 30px; 39 | } 40 | 41 | .ed_section_text 42 | { 43 | font-family: "Eurostile"; 44 | color: #FEFEFE; 45 | font-size: 30px; 46 | } 47 | 48 | .ed_shield_text 49 | { 50 | font-family: "EurostileBold"; 51 | font-size: 30px; 52 | border: 5px; 53 | border-style: solid; 54 | border-spacing: 15px; 55 | } 56 | 57 | .ed_section_text_small 58 | { 59 | font-family: "Eurostile"; 60 | color: #FEFEFE; 61 | font-size: 18px; 62 | } 63 | 64 | .ed_galmap_pointer 65 | { 66 | position: absolute; 67 | width: 10px; 68 | height: 10px; 69 | background-color: #FE0000; 70 | border-radius: 5px; 71 | z-index: 99; 72 | } 73 | 74 | .ed_sol_pointer 75 | { 76 | position: absolute; 77 | width: 6px; 78 | height: 6px; 79 | background-color: #0099FE; 80 | border-radius: 3px; 81 | top: 335px; 82 | left: 200px; 83 | z-index: 99; 84 | } 85 | 86 | .ed_exploration_data 87 | { 88 | font-family: "Eurostile"; 89 | color: #FEFEFE; 90 | font-size: 18px; 91 | overflow-y: scroll; 92 | width: 100%; 93 | padding-left: 10px; 94 | height: 390px; 95 | } 96 | 97 | .ed_exploration_data_pi 98 | { 99 | font-family: "Eurostile"; 100 | color: #FEFEFE; 101 | font-size: 21px; 102 | overflow-y: scroll; 103 | width: 100%; 104 | padding-left: 10px; 105 | height: 550px; 106 | } 107 | 108 | 109 | .ed_statusbox_red 110 | { 111 | width: 100%; 112 | height: 100%; 113 | background-color: #cd0000; 114 | box-shadow: 0 0 10px #cd0000; 115 | font-family: "EurostileBold"; 116 | font-size: 15px; 117 | color: #FFFFFF; 118 | display: flex; 119 | justify-content: center; 120 | align-items: center; 121 | border-radius: 10px; 122 | } 123 | .ed_statusbox_green 124 | { 125 | width: 100%; 126 | height: 100%; 127 | background-color: #00BB00; 128 | box-shadow: 0 0 10px #00BB00; 129 | font-family: "EurostileBold"; 130 | font-size: 15px; 131 | color: #FFFFFF; 132 | display: flex; 133 | justify-content: center; 134 | align-items: center; 135 | border-radius: 10px; 136 | } 137 | .ed_statusbox_yellow 138 | { 139 | width: 100%; 140 | height: 100%; 141 | background-color: #d28e10; 142 | box-shadow: 0 0 10px #d28e10; 143 | font-family: "EurostileBold"; 144 | font-size: 15px; 145 | color: #FFFFFF; 146 | display: flex; 147 | justify-content: center; 148 | align-items: center; 149 | border-radius: 10px; 150 | } 151 | .ed_statusbox_off 152 | { 153 | width: 100%; 154 | height: 100%; 155 | font-family: "EurostileBold"; 156 | font-size: 15px; 157 | color: #BCBCBC; 158 | display: flex; 159 | justify-content: center; 160 | align-items: center; 161 | border-radius: 10px; 162 | background-color: #040404; 163 | } 164 | 165 | -------------------------------------------------------------------------------- /css/styles.css: -------------------------------------------------------------------------------- 1 | 2 | 3 | body { 4 | background-color: #0a0a0a; 5 | margin: 0; 6 | } 7 | 8 | 9 | /* -------------------------------------------------------------------------- */ 10 | /* HUD */ 11 | /* -------------------------------------------------------------------------- */ 12 | 13 | 14 | #ed3dmap { 15 | font-family: Helvetica, Sans-serif; 16 | position: relative; 17 | width: 100%; 18 | height: 100%; 19 | margin: 0 auto; 20 | overflow: hidden; 21 | } 22 | 23 | #threedmap { 24 | width: 100%; 25 | height: 800px; 26 | } 27 | 28 | #hud, 29 | #systemDetails { 30 | font-weight: normal; 31 | font-size: 0.9rem; 32 | position: absolute; 33 | top: 0; 34 | left: 0; 35 | width: 250px; 36 | height: 100%; 37 | background: red; 38 | padding: 15px; 39 | color: #fff; 40 | z-index: 999; 41 | 42 | /*border: solid 3px rgba(255, 140, 13, 0.8);*/ 43 | background: rgba(3, 3, 6,0.8); 44 | border-right: solid 1px #111; 45 | 46 | box-sizing: border-box; 47 | -webkit-box-sizing: border-box; 48 | } 49 | 50 | #hud > div { 51 | margin-bottom: 20px; 52 | clear: both; 53 | } 54 | #hud h2 { 55 | font-weight: bold; 56 | color: #eee; 57 | font-size: 1rem; 58 | border-bottom: 1px solid #eee; 59 | margin: 0 0 5px; 60 | text-shadow: 1px 1px 2px rgb(0,0,0); 61 | } 62 | #hud p { 63 | margin: 0 0 3px; 64 | } 65 | #hud input { 66 | box-sizing: border-box; 67 | -webkit-box-sizing: border-box; 68 | } 69 | #hud input[type=text] { 70 | border: solid 1px #fff; 71 | padding: 4px; 72 | width: 100%; 73 | background: rgba(0,0,0,0.5); 74 | color: #fff; 75 | } 76 | #hud input[type=range] { 77 | margin: 3px 0; 78 | padding: 0; 79 | width: 100%; 80 | } 81 | 82 | .check { 83 | display: inline-block; 84 | width: 14px; 85 | height: 14px; 86 | line-height: 1; 87 | float: right; 88 | text-align: center; 89 | } 90 | .check:after { 91 | content: ' '; 92 | display: block; 93 | width: 10px; 94 | height: 10px; 95 | margin: 2px; 96 | background: rgba(0,0,0,0.5); 97 | } 98 | .coords { 99 | padding-bottom: 5px; 100 | margin-bottom: 10px; 101 | border-bottom: solid 1px #444; 102 | font-family: "Courier New"; 103 | } 104 | .coords > span { 105 | display: block; 106 | font-size: 1rem; 107 | float: left; 108 | width: 33%; 109 | text-align: center; 110 | background: rgba(30,30,30,0.5); 111 | padding: 5px 0; 112 | line-height: 100%; 113 | border: solid 3px #000; 114 | box-shadow: 2px 2px 5px #000; 115 | box-sizing: border-box; 116 | -webkit-box-sizing: border-box; 117 | } 118 | .coords:after { 119 | content: ' '; 120 | display: block; 121 | clear: both; 122 | } 123 | 124 | .map_filter, 125 | .map_link { 126 | display: block; 127 | margin: 0 0 3px; 128 | cursor: pointer; 129 | } 130 | .map_filter:hover, 131 | .map_link:hover { 132 | color: #FF7207; 133 | } 134 | 135 | .map_filter.disabled .check { 136 | background: #333 !important; 137 | } 138 | 139 | /* -------------------------------------------------------------------------- */ 140 | /* HUD system details */ 141 | /* -------------------------------------------------------------------------- */ 142 | /*#hud, 143 | #systemDetails { 144 | color: #fff; 145 | font-size: 1rem; 146 | width: 25%; 147 | height: 100%; 148 | min-width: 250px; 149 | max-width: 350px; 150 | padding: 20px; 151 | position: absolute; 152 | left: 0; 153 | top: 0; 154 | box-sizing: border-box; 155 | -webkit-box-sizing: border-box; 156 | }*/ 157 | #systemDetails img { 158 | max-width: 100%; 159 | } 160 | 161 | #nav { 162 | position: absolute; 163 | bottom: 10px; 164 | right: 0; 165 | width: 100%; 166 | text-align: center; 167 | } 168 | #nav > a { 169 | cursor: pointer; 170 | display: inline-block; 171 | width: 22%; 172 | margin: 2%; 173 | padding: 10px; 174 | border: solid 1px #222; 175 | background: rgb(10,10,10); 176 | background: rgba(10,10,10,0.8); 177 | box-shadow: 1px 1px 3px #000; 178 | font-weight: bold; 179 | font-size: 1.2rem; 180 | text-align: center; 181 | box-sizing: border-box; 182 | -webkit-box-sizing: border-box; 183 | } 184 | 185 | #systemDetails > div { 186 | max-height: 70%; 187 | overflow-y: auto; 188 | } 189 | 190 | /* -------------------------------------------------------------------------- */ 191 | /* controls */ 192 | /* -------------------------------------------------------------------------- */ 193 | #controls { 194 | position: absolute; 195 | top: 10px; 196 | right: 10px; 197 | z-index: 999; 198 | text-align: right; 199 | } 200 | #controls a { 201 | cursor: pointer; 202 | } 203 | #controls > a { 204 | display: inline-block; 205 | width: 26px; 206 | height: 26px; 207 | margin: 4px; 208 | font-size: 14px; 209 | line-height: 26px; 210 | text-align: center; 211 | color: #ddd; 212 | color: rgba(255,255,255,0.8); 213 | background: rgba(100,100,100,0.2); 214 | border: solid 1px #ddd; 215 | border-color: rgba(255,255,255,0.2); 216 | cursor: pointer; 217 | border-radius: 4px; 218 | text-decoration: none; 219 | } 220 | #controls > a.selected { 221 | color: #fff; 222 | border-color: rgba(255,255,255,0.6); 223 | } 224 | 225 | #options { 226 | clear: both; 227 | background: rgb(0,0,0); 228 | background: rgba(0,0,0,0.6); 229 | border-color: rgba(50,50,50,0.6); 230 | padding: 10px 15px; 231 | margin: 10px 0 0; 232 | } 233 | #options a { 234 | display: block; 235 | text-align: left; 236 | margin: 7px 0; 237 | color: #555; 238 | font-size: 0.9rem; 239 | } 240 | #options a.active { 241 | color: #eee; 242 | } 243 | #options a:before { 244 | content: '-'; 245 | display: inline-block; 246 | width: 16px; 247 | height: 16px; 248 | font-size: 14px; 249 | line-height: 1.1; 250 | text-align: center; 251 | margin-right: 5px; 252 | border: solid 1px #555; 253 | } 254 | #options a.active:before { 255 | content: 'X'; 256 | border-color: #eee; 257 | } 258 | 259 | /* -------------------------------------------------------------------------- */ 260 | /* HUD system infos */ 261 | /* -------------------------------------------------------------------------- */ 262 | /*#infos { 263 | background: rgba(20, 20, 20, 0.6) none repeat scroll 0 0; 264 | font-size: 1rem; 265 | min-height: 50px; 266 | padding: 20px; 267 | position: fixed; 268 | left: 55%; 269 | top: 50%; 270 | }*/ 271 | /*#infos { 272 | background: rgba(20, 20, 20, 0.8) none repeat scroll 0 0; 273 | font-size: 1rem; 274 | min-height: 50px; 275 | padding: 20px; 276 | position: fixed; 277 | left: 210px; 278 | top: 0; 279 | width: 10%; 280 | height: 100%; 281 | }*/ 282 | 283 | /* -------------------------------------------------------------------------- */ 284 | /* SVG loader */ 285 | /* -------------------------------------------------------------------------- */ 286 | 287 | #loader { 288 | width: 100%; 289 | height: 100%; 290 | padding: 75px 0; 291 | text-align: center; 292 | position: fixed; 293 | top: 0; 294 | right: 0; 295 | z-index: 1000; 296 | background-color: #111; 297 | background-color: rgba(30,30,30,0.9); 298 | } 299 | #loader svg { 300 | margin: 150px auto; 301 | width: 200px; 302 | height: 200px; 303 | } 304 | #loader path { 305 | fill: #FF8C0D; 306 | stroke: #000; 307 | stroke-width: 0; 308 | opacity: 0; 309 | } 310 | @keyframes hideshow { 311 | 0% { 312 | opacity: 0; 313 | } 314 | 10% { 315 | opacity: 1; 316 | } 317 | 100% { 318 | opacity: 0; 319 | } 320 | } 321 | @keyframes inner { 322 | 0% { 323 | opacity: 0; 324 | } 325 | 10% { 326 | opacity: 1; 327 | } 328 | 100% { 329 | opacity: 0; 330 | } 331 | } 332 | .l1 { 333 | animation: hideshow 750ms linear infinite; 334 | } 335 | .l2 { 336 | animation: inner 750ms linear infinite; 337 | } 338 | .d19 { 339 | animation-delay: 750ms; 340 | } 341 | .d18 { 342 | animation-delay: 710.52631579ms; 343 | } 344 | .d17 { 345 | animation-delay: 671.05263158ms; 346 | } 347 | .d16 { 348 | animation-delay: 631.57894737ms; 349 | } 350 | .d15 { 351 | animation-delay: 592.10526316ms; 352 | } 353 | .d14 { 354 | animation-delay: 552.63157895ms; 355 | } 356 | .d13 { 357 | animation-delay: 513.15789474ms; 358 | } 359 | .d12 { 360 | animation-delay: 473.68421053ms; 361 | } 362 | .d11 { 363 | animation-delay: 434.21052632ms; 364 | } 365 | .d10 { 366 | animation-delay: 394.73684211ms; 367 | } 368 | .d9 { 369 | animation-delay: 355.26315789ms; 370 | } 371 | .d8 { 372 | animation-delay: 315.78947368ms; 373 | } 374 | .d7 { 375 | animation-delay: 276.31578947ms; 376 | } 377 | .d6 { 378 | animation-delay: 236.84210526ms; 379 | } 380 | .d5 { 381 | animation-delay: 197.36842105ms; 382 | } 383 | .d4 { 384 | animation-delay: 157.89473684ms; 385 | } 386 | .d3 { 387 | animation-delay: 118.42105263ms; 388 | } 389 | .d2 { 390 | animation-delay: 78.94736842ms; 391 | } 392 | .d1 { 393 | animation-delay: 39.47368421ms; 394 | } -------------------------------------------------------------------------------- /css/ttf/Eurostile.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/css/ttf/Eurostile.ttf -------------------------------------------------------------------------------- /css/ttf/EurostileBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/css/ttf/EurostileBold.ttf -------------------------------------------------------------------------------- /data/milkyway.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "quadrants" : { 4 | "The Orion Spur" : { 5 | "x":0, "z":0, "rotate":0 6 | }, 7 | "Galactic Core Region" : { 8 | "x":974, "z":27333, "rotate":0 9 | }, 10 | "Upper 2nd quadrant" : { 11 | "x":-10000, "z":-2000, "rotate":0 12 | }, 13 | "Upper 3rd quadrant" : { 14 | "x":10000, "z":-2000, "rotate":0 15 | }, 16 | "Lower 3rd quadrant" : { 17 | "x":20000, "z":-12000, "rotate":0 18 | }, 19 | "Lower 1st quadrant" : { 20 | "x":-15000, "z":5000, "rotate":0 21 | }, 22 | "Intermediate 1st quadrant" : { 23 | "x":-20000, "z":24000, "rotate":0 24 | }, 25 | "Upper 1st quadrant" : { 26 | "x":-15000, "z":43000, "rotate":0 27 | }, 28 | "Lower 4th quadrant" : { 29 | "x":15000, "z":5000, "rotate":0 30 | }, 31 | "Intermediate 4th quadrant" : { 32 | "x":20000, "z":24000, "rotate":0 33 | }, 34 | "Upper 4th quadrant" : { 35 | "x":15000, "z":43000, "rotate":0 36 | }, 37 | "The 4th quadrant Tenebris" : { 38 | "x":28492, "z":6298, "rotate":45 39 | } 40 | }, 41 | 42 | "arms" : { 43 | "The Orion Spur" : [ 44 | {"x":-16284, "z":16823, "rotate":90}, 45 | {"x":-7265, "z":4226, "rotate":-35}, 46 | {"x":6858, "z":-576, "rotate":0} 47 | ], 48 | "The outer Arm vacuus" : [ 49 | {"x":10, "z":-14500, "rotate":0} 50 | ], 51 | "The Sagittarius Arm" : [ 52 | {"x":5379, "z":4768, "rotate":0} 53 | ], 54 | "The Carina-Sagittarius Arm" : [ 55 | {"x":22458, "z":10237, "rotate":45}, 56 | {"x":29632, "z":25285, "rotate":82}, 57 | {"x":28962, "z":40634, "rotate":105}, 58 | {"x":17446, "z":58185, "rotate":-40} 59 | ], 60 | "The new outer Arm" : [ 61 | {"x":-31158, "z":16529, "rotate":90}, 62 | {"x":-28281, "z":3070, "rotate":112}, 63 | {"x":-18972, "z":-8546, "rotate":-35} 64 | 65 | ], 66 | "The Perseus Arm" : [ 67 | {"x":-19961, "z":30870, "rotate":60 }, 68 | {"x":-22778, "z":10633, "rotate":110 }, 69 | {"x":-7525, "z":-3597, "rotate":-25 }, 70 | {"x":8039, "z":-7019, "rotate":0 }, 71 | {"x":32905, "z":4565, "rotate":45 } 72 | ], 73 | "The Norma Arm" : [ 74 | {"x":7944, "z":17960, "rotate":40 }, 75 | {"x":13524, "z":29918, "rotate":90 }, 76 | {"x":7498, "z":40348, "rotate":-35 } 77 | ], 78 | "The Cygnus Arm" : [ 79 | {"x":-7724, "z":43523, "rotate":0 }, 80 | {"x":-22353, "z":37643, "rotate":38 } 81 | ], 82 | "The Scutum-Centaurus Arm" : [ 83 | {"x":-33364, "z":46016, "rotate":45 }, 84 | {"x":-15742, "z":54759, "rotate":0 }, 85 | {"x":-334, "z":53331, "rotate":-14 }, 86 | {"x":14300, "z":46140, "rotate":-38 }, 87 | {"x":19815, "z":31418, "rotate":90 }, 88 | {"x":16637, "z":17458, "rotate":48 } 89 | ], 90 | "The near 3 KPC Arm" : [ 91 | {"x":5765, "z":22639, "rotate":45 } 92 | ], 93 | "The far 3 KPC Arm" : [ 94 | {"x":-4906 ,"z":28535, "rotate":45 } 95 | ] 96 | }, 97 | 98 | "gaps" : { 99 | "The Sagittarius gap" : [ 100 | {"x":4794 , "z":1917, "rotate":0}, 101 | {"x":14702 , "z":2381, "rotate":8} 102 | ], 103 | "The Perseus gap" : [ 104 | {"x":-18665 , "z":16893, "rotate":90}, 105 | {"x":-15402 , "z":8394, "rotate":-52}, 106 | {"x":-8836 , "z":1370, "rotate":-36}, 107 | {"x":8574 , "z":-3518, "rotate":0} 108 | ], 109 | "The Orio-Persean gap" : [ 110 | {"x":-673 , "z":-2609, "rotate":-15} 111 | ], 112 | "The Formidine rift" : [ 113 | {"x":-11342 , "z":-6189, "rotate":-35} 114 | ], 115 | "Tenebris" : [ 116 | {"x":31522 , "z":11890, "rotate":50} 117 | ], 118 | "The Carina-Scutum gap" : [ 119 | {"x":14535 , "z":54942, "rotate":-35}, 120 | {"x":22140 , "z":45532, "rotate":-60} 121 | ] 122 | 123 | }, 124 | 125 | "others" : { 126 | "Sagittarius A*" : [ 127 | {"x":25 , "z":25900, "rotate":0} 128 | ], 129 | "The western neutron fields" : [ 130 | {"x":-3669 , "z":25478, "rotate":45} 131 | ], 132 | "The eastern neutron fields" : [ 133 | {"x":3263 , "z":25727, "rotate":45} 134 | ] 135 | 136 | } 137 | } -------------------------------------------------------------------------------- /data/spectral-colors.json: -------------------------------------------------------------------------------- 1 | { 2 | "D":"9bb2fe", 3 | "O":"98b4fe", 4 | "B":"a0bfff", 5 | "A":"d0dafe", 6 | "F":"f5f3ff", 7 | "G":"fef3ef", 8 | "K":"ffe4cf", 9 | "M":"ffd1a3", 10 | "R":"ffb36b", 11 | "N":"ff8913", 12 | "L":"f6392b", 13 | "T":"aa2c51", 14 | "Y":"5d347e", 15 | "HERBIG Ae/Be":"9fadb6", 16 | "WR":"Ca594b,d3dceb", 17 | "S":"cd6136", 18 | "C":"cd6136" 19 | } -------------------------------------------------------------------------------- /explorationdata.php: -------------------------------------------------------------------------------- 1 | 0; $i--) 11 | { 12 | 13 | if ($data[$i]["event"] == $events[0]) 14 | { 15 | echo "FSS RESULT FOR: " . $data[$i]["SystemName"] . ", Bodies - " . $data[$i]["BodyCount"] . ", Non bodies - " . $data[$i]["NonBodyCount"] . "
"; 16 | } 17 | 18 | if ($data[$i]["event"] == $events[1]) 19 | { 20 | if ($data[$i]["SignalName_Localised"] != "") 21 | { echo "SIGNAL DISCOVERED: " . $data[$i]["SignalName_Localised"] . " "; } 22 | else 23 | { echo "SIGNAL DISCOVERED: " . $data[$i]["SignalName"] . " "; } 24 | if ($data[$i]["IsStation"] == true) { echo "[S] "; } 25 | echo "
"; 26 | } 27 | 28 | if ($data[$i]["event"] == $events[2]) 29 | { 30 | echo "[SYSTEM SCAN COMPLETE]: " . $data[$i]["SystemName"] . " - " . $data[$i]["Count"] . "
"; 31 | } 32 | 33 | if ($data[$i]["event"] == $events[3]) 34 | { 35 | echo "DISCOVERY SCAN: " . $data[$i]["Bodies"] . "
"; 36 | } 37 | 38 | if ($data[$i]["event"] == $events[4]) 39 | { 40 | echo "SCAN RESULT: " . $data[$i]["BodyName"] . " - Distance: " . round($data[$i]["DistanceFromArrivalLS"], 2) . " LS - "; 41 | echo $data[$i]["PlanetClass"] . " - "; 42 | if ($data[$i]["WasDiscovered"] == false) 43 | { echo "[D] "; } else { echo "[D] "; } 44 | echo " "; 45 | if ($data[$i]["WasMapped"] == false) 46 | { echo "[M] "; } else { echo "[M] "; } 47 | if ($data[$i]["Landable"] == true) 48 | { echo "[L] "; } 49 | echo "
"; 50 | } 51 | 52 | if ($data[$i]["event"] == $events[5]) 53 | { 54 | for ($j=0; $jPOI FOUND: " . $data[$i]["BodyName"] . " - " . $data[$i]["Signals"][$j]["Type_Localised"] . " - Count: " . $data[$i]["Signals"][$j]["Count"] . "
"; 57 | } 58 | } 59 | } 60 | } 61 | 62 | ?> 63 | -------------------------------------------------------------------------------- /fuel.php: -------------------------------------------------------------------------------- 1 | "; 18 | } 19 | 20 | function ED_displayFuel_pi() 21 | { 22 | $fuelcap = ED_getContentFromEvent("Loadout", "FuelCapacity"); 23 | $statuscontent = file_get_contents($GLOBALS["ed_journal_folder"]."\Status.json"); 24 | $status = json_decode($statuscontent, true); 25 | $fuel = $status["Fuel"]["FuelMain"]; 26 | $value = $fuel / $fuelcap["Main"]; 27 | 28 | $v = 473; 29 | $hght = $v - ($v*$value); 30 | 31 | echo "
"; 32 | } 33 | 34 | ?> 35 | -------------------------------------------------------------------------------- /func.php: -------------------------------------------------------------------------------- 1 | ".$text.""; 83 | } 84 | 85 | function ED_populateStatusPanel() 86 | { 87 | $statuscontent = file_get_contents($GLOBALS["ed_journal_folder"]."\Status.json"); 88 | $status = json_decode($statuscontent, true); 89 | $bin = decbin($status["Flags"]); 90 | $fullbin = ""; 91 | 92 | if (strlen($bin) < 32) 93 | { $diff = 32-strlen($bin); for ($i=0; $i<$diff; $i++) { $fullbin = $fullbin . "0"; } $fullbin = $fullbin.$bin; } 94 | 95 | $texts = array( 96 | "SRV HIGHB", 97 | "JUMPING", 98 | "ALTITUDE", 99 | "NIGHT VSN", 100 | 101 | "ANALYSIS", 102 | "IN SRV", 103 | "IN FGHT", 104 | "IN SHIP", 105 | 106 | "INTERDCTN", 107 | "DANGER", 108 | "AT PLANET", 109 | "OVERHEAT", 110 | 111 | "LOW FL", 112 | "FSD CLD", 113 | "FSD CHRG", 114 | "MASS LOCK", 115 | 116 | "SRV D.A.", 117 | "SRV TRT D", 118 | "SRV TRRT", 119 | "SRV HNDB", 120 | 121 | "FUEL SCP", 122 | "SILENT", 123 | "CARGO SCP", 124 | "LIGHTS", 125 | 126 | "WING", 127 | "HARD PTS.", 128 | "FLT AST", 129 | "SUPERCRS", 130 | 131 | "SHIELDS", 132 | "LND GEAR", 133 | "LANDED", 134 | "DOCKED" 135 | ); 136 | 137 | $c = ""; 138 | 139 | $n = 31; 140 | echo " 141 | 142 | 143 | "; 146 | $n = $n-1; 147 | echo ""; 150 | $n = $n-1; 151 | echo ""; 154 | $n = $n-1; 155 | echo ""; 158 | 159 | echo ""; 160 | 161 | $n = $n-1; 162 | echo ""; 165 | $n = $n-1; 166 | echo ""; 169 | $n = $n-1; 170 | echo ""; 173 | $n = $n-1; 174 | echo ""; 177 | 178 | echo ""; 179 | 180 | $n = $n-1; 181 | echo ""; 184 | $n = $n-1; 185 | echo ""; 188 | $n = $n-1; 189 | echo ""; 192 | $n = $n-1; 193 | echo ""; 196 | 197 | echo ""; 198 | 199 | $n = $n-1; 200 | echo ""; 203 | $n = $n-1; 204 | echo ""; 207 | $n = $n-1; 208 | echo ""; 211 | $n = $n-1; 212 | echo ""; 215 | 216 | echo ""; 217 | 218 | $n = $n-1; 219 | echo ""; 222 | $n = $n-1; 223 | echo ""; 226 | $n = $n-1; 227 | echo ""; 230 | $n = $n-1; 231 | echo ""; 234 | 235 | echo ""; 236 | 237 | $n = $n-1; 238 | echo ""; 241 | $n = $n-1; 242 | echo ""; 245 | $n = $n-1; 246 | echo ""; 249 | $n = $n-1; 250 | echo ""; 253 | 254 | echo ""; 255 | 256 | $n = $n-1; 257 | echo ""; 260 | $n = $n-1; 261 | echo ""; 264 | $n = $n-1; 265 | echo ""; 268 | $n = $n-1; 269 | echo ""; 272 | 273 | echo ""; 274 | 275 | $n = $n-1; 276 | echo ""; 279 | $n = $n-1; 280 | echo ""; 283 | $n = $n-1; 284 | echo ""; 287 | $n = $n-1; 288 | echo ""; 291 | 292 | echo "
"; 144 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 145 | echo ""; 148 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 149 | echo ""; 152 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_red"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 153 | echo ""; 156 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 157 | echo "
"; 163 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_yellow"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 164 | echo ""; 167 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 168 | echo ""; 171 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 172 | echo ""; 175 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 176 | echo "
"; 182 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 183 | echo ""; 186 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 187 | echo ""; 190 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_red"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 191 | echo ""; 194 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_yellow"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 195 | echo "
"; 201 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_red"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 202 | echo ""; 205 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 206 | echo ""; 209 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_red"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 210 | echo ""; 213 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 214 | echo "
"; 220 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_red"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 221 | echo ""; 224 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_yellow"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 225 | echo ""; 228 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_yellow"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 229 | echo ""; 232 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_red"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 233 | echo "
"; 239 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_red"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 240 | echo ""; 243 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_yellow"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 244 | echo ""; 247 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_red"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 248 | echo ""; 251 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_red"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 252 | echo "
"; 258 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 259 | echo ""; 262 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 263 | echo ""; 266 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 267 | echo ""; 270 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 271 | echo "
"; 277 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 278 | echo ""; 281 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_red"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 282 | echo ""; 285 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_green"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 286 | echo ""; 289 | if ($fullbin[$n] == 1) { ED_displayStatusBox($texts[$n], "ed_statusbox_red"); } else { ED_displayStatusBox($texts[$n], "ed_statusbox_off"); } 290 | echo "
"; 293 | 294 | } 295 | 296 | ?> 297 | -------------------------------------------------------------------------------- /img/galaxyBackgroundV3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/img/galaxyBackgroundV3.png -------------------------------------------------------------------------------- /img/galaxyBackgroundV4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/img/galaxyBackgroundV4.png -------------------------------------------------------------------------------- /img/pipDividers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/img/pipDividers.png -------------------------------------------------------------------------------- /img/pipDividers_pi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/img/pipDividers_pi.png -------------------------------------------------------------------------------- /inc.php: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |
11 |
12 |
13 |
14 |
15 | 16 | LOCATION PANEL (3D)

17 | STATUS PANEL

18 | FOUR PANEL VIEW (HD SCREEN) 19 | 20 |
21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /js/components/action.class.js: -------------------------------------------------------------------------------- 1 | 2 | var Action = { 3 | 4 | 'cursorSel' : null, 5 | 'mouseVector' : null, 6 | 'raycaster' : null, 7 | 'oldSel' : null, 8 | 'objHover' : null, 9 | 'mouseUpDownTimer' : null, 10 | 'animPosition' : null, 11 | 12 | 'prevScale' : null, 13 | 14 | /** 15 | * Init Raycaster for events on Systems 16 | */ 17 | 18 | 'init' : function() { 19 | 20 | this.mouseVector = new THREE.Vector3(); 21 | this.raycaster = new THREE.Raycaster(); 22 | 23 | container.addEventListener('mousedown', this.onMouseDown, false); 24 | container.addEventListener('mouseup', this.onMouseUp, false); 25 | 26 | container.addEventListener( 'mousewheel', this.stopWinScroll, false ); 27 | container.addEventListener( 'DOMMouseScroll', this.stopWinScroll, false ); // FF 28 | //container.addEventListener('mousemove', this.onMouseHover, false); 29 | }, 30 | 31 | /** 32 | * Stop window scroll when mouse on scene 33 | */ 34 | 35 | 'stopWinScroll' : function (event) { 36 | event.preventDefault(); 37 | event.stopPropagation(); 38 | }, 39 | 40 | 41 | /** 42 | * Update particle size on zoom in/out 43 | */ 44 | 45 | 'sizeOnScroll' : function (scale) { 46 | 47 | if(System.particle == undefined || scale<=0) return; 48 | 49 | var minScale = Ed3d.effectScaleSystem[0]; 50 | var maxScale = Ed3d.effectScaleSystem[1]; 51 | var newScale = scale*20; 52 | 53 | if(this.prevScale == newScale) return; 54 | this.prevScale = newScale; 55 | 56 | 57 | if(newScale>maxScale) newScale = maxScale; 58 | if(newScale 0) { 86 | 87 | for( var i = 0; i < intersects.length; i++ ) { 88 | var intersection = intersects[ i ]; 89 | if(intersection.object.clickable) { 90 | 91 | var indexPoint = intersection.index; 92 | 93 | Action.hoverOnObj(indexPoint); 94 | } 95 | } 96 | 97 | 98 | 99 | } else { 100 | Action.outOnObj(); 101 | } 102 | 103 | }, 104 | 105 | 'hoverOnObj' : function (indexPoint) { 106 | 107 | if(this.objHover == indexPoint) return; 108 | this.outOnObj(); 109 | 110 | System.particleGeo.colors[indexPoint] = new THREE.Color('#00ff00'); 111 | System.particleGeo.colorsNeedUpdate = true; 112 | 113 | this.objHover = indexPoint; 114 | 115 | }, 116 | 117 | 'outOnObj' : function () { 118 | 119 | if(this.objHover === null || System.particleGeo.vertices[this.objHover] == undefined) 120 | return; 121 | 122 | obj = System.particleGeo.vertices[this.objHover]; 123 | 124 | System.particleGeo.colors[this.objHover] = obj.color; 125 | System.particleGeo.colorsNeedUpdate = true; 126 | 127 | this.objHover = null; 128 | 129 | }, 130 | 131 | /** 132 | * On system click 133 | */ 134 | 135 | 'onMouseDown' : function (e) { 136 | 137 | this.mouseUpDownTimer = Date.now(); 138 | 139 | }, 140 | 141 | 142 | /** 143 | * On system click 144 | */ 145 | 146 | 'onMouseUp' : function (e) { 147 | 148 | e.preventDefault(); 149 | 150 | //-- If long clic down, don't do anything 151 | var difference = (Date.now()-this.mouseUpDownTimer)/1000; 152 | if (difference > 0.2) { 153 | this.mouseUpDownTimer = null; 154 | return; 155 | } 156 | this.mouseUpDownTimer = null; 157 | 158 | //-- Raycast object 159 | 160 | var position = $('#ed3dmap').offset(); 161 | 162 | this.mouseVector = new THREE.Vector3( 163 | ( ( e.clientX - position.left ) / renderer.domElement.width ) * 2 - 1, 164 | - ( ( e.clientY - position.top ) / renderer.domElement.height ) * 2 + 1, 165 | 1); 166 | 167 | this.mouseVector.unproject(camera); 168 | this.raycaster = new THREE.Raycaster(camera.position, this.mouseVector.sub(camera.position).normalize()); 169 | this.raycaster.params.Points.threshold = 2; 170 | 171 | 172 | // create an array containing all objects in the scene with which the ray intersects 173 | var intersects = this.raycaster.intersectObjects(scene.children); 174 | if (intersects.length > 0) { 175 | 176 | for( var i = 0; i < intersects.length; i++ ) { 177 | var intersection = intersects[ i ]; 178 | if(intersection.object.clickable) { 179 | 180 | var indexPoint = intersection.index; 181 | var selPoint = intersection.object.geometry.vertices[indexPoint]; 182 | 183 | if(selPoint.visible) { 184 | $('#hud #infos').html( 185 | "

"+selPoint.name+"

" 186 | ); 187 | 188 | var isMove = Action.moveToObj(indexPoint, selPoint); 189 | 190 | if(isMove) return; 191 | } 192 | 193 | } 194 | 195 | if(intersection.object.showCoord) { 196 | 197 | $('#debug').html(Math.round(intersection.point.x)+' , '+Math.round(-intersection.point.z)); 198 | 199 | Route.addPoint(Math.round(intersection.point.x),0,Math.round(-intersection.point.z)); 200 | 201 | } 202 | } 203 | 204 | } 205 | 206 | }, 207 | 208 | /** 209 | * Move to the next visible system 210 | * 211 | * @param {int} indexPoint 212 | */ 213 | 214 | 'moveNextPrev' : function (indexPoint, increment) { 215 | 216 | var find = false; 217 | while(!find) { 218 | 219 | //-- If next|previous is undefined, loop to the first|last 220 | if (indexPoint < 0) indexPoint = System.particleGeo.vertices.length-1; 221 | else if (System.particleGeo.vertices[indexPoint] == undefined) indexPoint = 0; 222 | 223 | if(System.particleGeo.vertices[indexPoint].visible == true) { 224 | find = true; 225 | } else { 226 | indexPoint += increment 227 | } 228 | } 229 | 230 | 231 | //-- Move to 232 | var selPoint = System.particleGeo.vertices[indexPoint]; 233 | Action.moveToObj(indexPoint, selPoint); 234 | 235 | }, 236 | 237 | /** 238 | * Disable current selection 239 | */ 240 | 241 | 'disableSelection' : function () { 242 | 243 | if(this.cursorSel == null) return; 244 | 245 | this.oldSel = null; 246 | this.cursorSel.visible = false; 247 | 248 | $('#hud #infos').html(''); 249 | 250 | }, 251 | 252 | /** 253 | * Move to inital position without animation 254 | */ 255 | 'moveInitalPositionNoAnim' : function (timer) { 256 | 257 | var cam = [Ed3d.playerPos[0], Ed3d.playerPos[1]+500, Ed3d.playerPos[2]+500] 258 | if(Ed3d.cameraPos != null) { 259 | cam = [Ed3d.cameraPos[0], Ed3d.cameraPos[1], -Ed3d.cameraPos[2]]; 260 | } 261 | 262 | var moveTo = { 263 | x: cam[0], y: cam[1], z: cam[2], 264 | mx: Ed3d.playerPos[0], my: Ed3d.playerPos[1] , mz: -Ed3d.playerPos[2] 265 | }; 266 | camera.position.set(moveTo.x, moveTo.y, moveTo.z); 267 | controls.target.set(moveTo.mx, moveTo.my, moveTo.mz); 268 | 269 | }, 270 | 271 | /** 272 | * Move to inital position 273 | */ 274 | 'moveInitalPosition' : function (timer) { 275 | 276 | if(timer == undefined) timer = 800; 277 | 278 | this.disableSelection(); 279 | 280 | //-- Move camera to initial position 281 | 282 | var moveFrom = { 283 | x: camera.position.x, y: camera.position.y , z: camera.position.z, 284 | mx: controls.target.x, my: controls.target.y , mz: controls.target.z 285 | }; 286 | 287 | //-- Move to player position if defined, else move to Sol 288 | var cam = [Ed3d.playerPos[0], Ed3d.playerPos[1]+500, Ed3d.playerPos[2]+500] 289 | if(Ed3d.cameraPos != null) { 290 | cam = [Ed3d.cameraPos[0], Ed3d.cameraPos[1], -Ed3d.cameraPos[2]]; 291 | } 292 | 293 | var moveCoords = { 294 | x: cam[0], y: cam[1], z: cam[2], 295 | mx: Ed3d.playerPos[0], my: Ed3d.playerPos[1] , mz: -Ed3d.playerPos[2] 296 | }; 297 | 298 | controls.enabled = false; 299 | 300 | //-- Remove previous anim 301 | if(Ed3d.tween != null) { 302 | TWEEN.removeAll(); 303 | } 304 | 305 | //-- Launch anim 306 | Ed3d.tween = new TWEEN.Tween(moveFrom, {override:true}).to(moveCoords, timer) 307 | .start() 308 | .onUpdate(function () { 309 | camera.position.set(moveFrom.x, moveFrom.y, moveFrom.z); 310 | controls.target.set(moveFrom.mx, moveFrom.my, moveFrom.mz); 311 | }) 312 | .onComplete(function () { 313 | controls.enabled = true; 314 | controls.update(); 315 | }); 316 | 317 | }, 318 | 319 | 320 | /** 321 | * Move camera to a system 322 | * 323 | * @param {int} index - The system index 324 | * @param {object} obj - System datas 325 | */ 326 | 327 | 'moveToObj' : function (index, obj) { 328 | 329 | if (this.oldSel !== null && this.oldSel == index) return false; 330 | 331 | controls.enabled = false; 332 | 333 | HUD.setInfoPanel(index, obj); 334 | HUD.openHudDetails(); 335 | 336 | this.oldSel = index; 337 | var goX = obj.x; 338 | var goY = obj.y; 339 | var goZ = obj.z; 340 | 341 | //-- If in far view reset to classic view 342 | disableFarView(25, false); 343 | 344 | //-- Move grid to object 345 | this.moveGridTo(goX, goY, goZ); 346 | 347 | //-- Move camera to target (Smooth move using Tween) 348 | 349 | var moveFrom = { 350 | x: camera.position.x, y: camera.position.y , z: camera.position.z, 351 | mx: controls.target.x, my: controls.target.y , mz: controls.target.z 352 | }; 353 | var moveCoords = { 354 | x: goX, y: goY + 15, z: goZ + 15, 355 | mx: goX, my: goY , mz: goZ 356 | }; 357 | 358 | Ed3d.tween = new TWEEN.Tween(moveFrom, {override:true}).to(moveCoords, 800) 359 | .start() 360 | .onUpdate(function () { 361 | camera.position.set(moveFrom.x, moveFrom.y, moveFrom.z); 362 | controls.target.set(moveFrom.mx, moveFrom.my, moveFrom.mz); 363 | }) 364 | .onComplete(function () { 365 | controls.update(); 366 | }); 367 | 368 | //-- 3D Cursor on selected object 369 | 370 | obj.material = Ed3d.material.selected; 371 | 372 | this.addCusorOnSelect(goX, goY, goZ); 373 | 374 | //-- Add text 375 | var textAdd = obj.name; 376 | var textAddC = Math.round(goX) + ', ' + Math.round(goY) + ', ' + Math.round(-goZ); 377 | 378 | HUD.addText('system', textAdd, 8, 20, 0, 6, this.cursorSel); 379 | HUD.addText('coords', textAddC, 8, 15, 0, 3, this.cursorSel); 380 | 381 | controls.enabled = true; 382 | 383 | return true; 384 | 385 | }, 386 | 387 | /** 388 | * Create a cusros on selected system 389 | * 390 | * @param {number} x 391 | * @param {number} y 392 | * @param {number} z 393 | */ 394 | 395 | 'addCusorOnSelect' : function (x, y, z) { 396 | 397 | if(this.cursorSel == null) { 398 | this.cursorSel = new THREE.Object3D(); 399 | 400 | //-- Ring around the system 401 | var geometryL = new THREE.TorusGeometry( 12, 0.4, 3, 30 ); 402 | 403 | var selection = new THREE.Mesh(geometryL, Ed3d.material.selected); 404 | //selection.position.set(x, y, z); 405 | selection.rotation.x = Math.PI / 2; 406 | 407 | this.cursorSel.add(selection); 408 | 409 | //-- Create a cone on the selection 410 | var geometryCone = new THREE.CylinderGeometry(0, 5, 16, 4, 1, false); 411 | var cone = new THREE.Mesh(geometryCone, Ed3d.material.selected); 412 | cone.position.set(0, 20, 0); 413 | cone.rotation.x = Math.PI; 414 | this.cursorSel.add(cone); 415 | 416 | //-- Inner cone 417 | var geometryConeInner = new THREE.CylinderGeometry(0, 3.6, 16, 4, 1, false); 418 | var coneInner = new THREE.Mesh(geometryConeInner, Ed3d.material.black); 419 | coneInner.position.set(0, 20.2, 0); 420 | coneInner.rotation.x = Math.PI; 421 | this.cursorSel.add(coneInner); 422 | 423 | 424 | 425 | scene.add(this.cursorSel); 426 | } 427 | 428 | this.cursorSel.visible = true; 429 | this.cursorSel.position.set(x, y, z); 430 | this.cursorSel.scale.set(1, 1, 1); 431 | 432 | }, 433 | 434 | /** 435 | * Move grid to selection 436 | * 437 | * @param {number} goX 438 | * @param {number} goY 439 | * @param {number} goZ 440 | */ 441 | 442 | 'moveGridTo' : function (goX, goY, goZ) { 443 | var posX = Math.floor(goX/1000)*1000; 444 | var posY = Math.floor(goY); 445 | var posZ = Math.floor(goZ/1000)*1000; 446 | 447 | if(!Ed3d.grid1H.fixed) Ed3d.grid1H.obj.position.set(posX, posY, posZ); 448 | if(!Ed3d.grid1K.fixed) Ed3d.grid1K.obj.position.set(posX, posY, posZ); 449 | if(!Ed3d.grid1XL.fixed) Ed3d.grid1XL.obj.position.set(posX, posY, posZ); 450 | 451 | } 452 | 453 | 454 | 455 | } -------------------------------------------------------------------------------- /js/components/galaxy.class.js: -------------------------------------------------------------------------------- 1 | 2 | var Galaxy = { 3 | 4 | 5 | 'obj' : null, 6 | 'infos' : null, 7 | 'milkyway' : [], 8 | 'milkyway2D' : null, 9 | 'backActive' : true, 10 | 'colors' : [], 11 | 12 | 'x' : 25, 13 | 'y' : -21, 14 | 'z' : 25900, 15 | 16 | 17 | 'addGalaxyCenter' : function () { 18 | 19 | var objVal = new Object; 20 | objVal.name = 'Sagittarius A*'; 21 | objVal.coords = {'x':this.y,'y':this.y,'z':this.z}; 22 | objVal.cat = []; 23 | 24 | this.obj = System.create(objVal, true); 25 | 26 | 27 | var sprite = new THREE.Sprite( Ed3d.material.glow_2 ); 28 | sprite.scale.set(50, 40, 2.0); 29 | this.obj.add(sprite); /// this centers the glow at the mesh 30 | 31 | this.createParticles(); 32 | this.add2DPlane(); 33 | 34 | 35 | }, 36 | 37 | 'createParticles' : function () { 38 | 39 | var img = new Image(); 40 | img.onload = function () { 41 | 42 | //get height data from img 43 | Galaxy.getHeightData(img); 44 | 45 | 46 | //-- If using start animation: launch it 47 | if(Ed3d.startAnim) { 48 | camera.position.set(-10000, 40000, 50000); 49 | Action.moveInitalPosition(4000); 50 | } else { 51 | Action.moveInitalPositionNoAnim(); 52 | } 53 | 54 | }; 55 | 56 | //-- load img source 57 | img.src = Ed3d.basePath + "textures/heightmap7.jpg"; 58 | 59 | //-- Add optional infos 60 | this.showGalaxyInfos(); 61 | 62 | }, 63 | 64 | /** 65 | * Add 2D image plane 66 | */ 67 | 68 | 'showGalaxyInfos' : function() { 69 | 70 | if(!Ed3d.showGalaxyInfos) return; 71 | 72 | this.infos = new THREE.Object3D(); 73 | 74 | $.getJSON(Ed3d.basePath + "data/milkyway.json", function(data) { 75 | 76 | $.each(data.quadrants, function(key, val) { 77 | 78 | Galaxy.addText(key,val.x,-100,val.z,val.rotate); 79 | 80 | }); 81 | 82 | $.each(data.arms, function(key, val) { 83 | 84 | $.each(val, function(keyCh, valCh) { 85 | Galaxy.addText(key,valCh.x,0,valCh.z,valCh.rotate,300,true); 86 | }); 87 | 88 | }); 89 | 90 | $.each(data.gaps, function(key, val) { 91 | 92 | $.each(val, function(keyCh, valCh) { 93 | Galaxy.addText(key,valCh.x,0,valCh.z,valCh.rotate,160,true); 94 | }); 95 | 96 | }); 97 | 98 | $.each(data.others, function(key, val) { 99 | 100 | $.each(val, function(keyCh, valCh) { 101 | Galaxy.addText(key,valCh.x,0,valCh.z,valCh.rotate,160,true); 102 | }); 103 | 104 | }); 105 | 106 | 107 | }).done(function() { 108 | 109 | scene.add(Galaxy.infos); 110 | 111 | }); 112 | 113 | }, 114 | 115 | /** 116 | * Show additional galaxy infos 117 | */ 118 | 'infosShow' : function() { 119 | if(Galaxy.infos == null) this.showGalaxyInfos(); 120 | if(Galaxy.infos !== null) Galaxy.infos.visible = Ed3d.showGalaxyInfos; 121 | }, 122 | 123 | /** 124 | * Show additional galaxy infos 125 | */ 126 | 'infosHide' : function() { 127 | if(Galaxy.infos !== null) Galaxy.infos.visible = false; 128 | }, 129 | 130 | /** 131 | * Appli opacity for Milky Way info based on distance 132 | */ 133 | 134 | 'infosUpdateCallback' : function(scale) { 135 | 136 | if(!Ed3d.showGalaxyInfos || this.infos == null) return; 137 | 138 | scale -= 70; 139 | 140 | var opacity = Math.round(scale/10)/10; 141 | if(opacity<0) opacity = 0; 142 | if(opacity>0.8) opacity = 0.8; 143 | if(Galaxy.infos.previousOpacity == opacity) return; 144 | 145 | var opacityMiddle = 1.1-opacity; 146 | if(opacityMiddle<=0.4) opacityMiddle = 0.2; 147 | 148 | for( var i = 0; i < Galaxy.infos.children.length; i++ ) { 149 | var txt = Galaxy.infos.children[ i ]; 150 | txt.material.opacity = (!txt.revert) ? opacity : opacityMiddle; 151 | } 152 | 153 | Galaxy.infos.previousOpacity = opacity; 154 | 155 | }, 156 | 157 | /** 158 | * Add 2D image plane 159 | */ 160 | 161 | 'add2DPlane' : function() { 162 | 163 | var texloader = new THREE.TextureLoader(); 164 | 165 | //-- Load textures 166 | var back2D = texloader.load(Ed3d.basePath + "textures/heightmap7.jpg"); 167 | 168 | 169 | var floorMaterial = new THREE.MeshBasicMaterial( { 170 | map: back2D, 171 | transparent: true, 172 | opacity: 0.4, 173 | blending: THREE.AdditiveBlending, 174 | depthWrite: false, 175 | side: THREE.DoubleSide 176 | } ); 177 | 178 | var floorGeometry = new THREE.PlaneGeometry(104000, 104000, 1, 1); 179 | this.milkyway2D = new THREE.Mesh(floorGeometry, floorMaterial); 180 | this.milkyway2D.position.set(this.x, this.y, -this.z); 181 | this.milkyway2D.rotation.x = -Math.PI / 2; 182 | this.milkyway2D.showCoord = true; 183 | 184 | scene.add(this.milkyway2D); 185 | 186 | }, 187 | 188 | /** 189 | * Add Shape text 190 | */ 191 | 192 | 'addText' : function(textShow, x, y, z, rot, size, revert) { 193 | 194 | if(revert==undefined) revert = false; 195 | if(size==undefined) size = 450; 196 | textShow = textShow.toUpperCase(); 197 | 198 | var textShapes = THREE.FontUtils.generateShapes(textShow, { 199 | 'font': 'helvetiker', 200 | 'weight': 'normal', 201 | 'style': 'normal', 202 | 'size': size, 203 | 'curveSegments': 12 204 | }); 205 | 206 | var textGeo = new THREE.ShapeGeometry(textShapes); 207 | 208 | var textMesh = new THREE.Mesh(textGeo, new THREE.MeshBasicMaterial({ 209 | color: 0x999999, 210 | transparent: true, 211 | opacity: 0.7, 212 | blending: THREE.AdditiveBlending, 213 | depthWrite: false 214 | })); 215 | 216 | textMesh.geometry = textGeo; 217 | textMesh.geometry.needsUpdate = true; 218 | 219 | //x -= Math.round(textShow.length*400/2); 220 | var middleTxt = Math.round(size/2); 221 | z -= middleTxt; 222 | 223 | textMesh.rotation.x = -Math.PI / 2; 224 | textMesh.geometry.applyMatrix( new THREE.Matrix4().makeTranslation(-Math.round(textShow.length*size/2), 0, -middleTxt) ); 225 | if(rot != 0) { 226 | textMesh.rotateOnAxis (new THREE.Vector3( 0, 0, 1 ), Math.PI * (rot) / 180); 227 | } 228 | textMesh.position.set(x, y, -z); 229 | 230 | textMesh.revert = revert; 231 | 232 | Galaxy.infos.add(textMesh); 233 | 234 | }, 235 | 236 | /** 237 | * Create a particle cloud milkyway from an image 238 | * 239 | * @param {Image} img - Image object 240 | */ 241 | 242 | 'getHeightData' : function(img) { 243 | 244 | var particles = new THREE.Geometry; 245 | var particlesBig = new THREE.Geometry; 246 | 247 | //-- Get pixels from milkyway image 248 | 249 | var canvas = document.createElement( 'canvas' ); 250 | canvas.width = img.width; 251 | canvas.height = img.height; 252 | var context = canvas.getContext( '2d' ); 253 | 254 | var size = img.width * img.height; 255 | 256 | context.drawImage(img,0,0); 257 | 258 | var imgd = context.getImageData(0, 0, img.width, img.height); 259 | var pix = imgd.data; 260 | 261 | //-- Build galaxy from image data 262 | 263 | var j=0; 264 | var min = 8; 265 | var nb = 0; 266 | var maxDensity = 15; 267 | 268 | //var scaleImg = 16.4; 269 | var scaleImg = 21; 270 | 271 | var colorsBig = []; 272 | var nbBig = 0; 273 | 274 | for (var i = 0; i 0.5) i += 8; 277 | 278 | 279 | var all = pix[i]+pix[i+1]+pix[i+2]; 280 | 281 | var avg = Math.round((pix[i]+pix[i+1]+pix[i+2])/3); 282 | 283 | if(avg>min) { 284 | 285 | var x = scaleImg*((i / 4) % img.width); 286 | var z = scaleImg*(Math.floor((i / 4) / img.height)); 287 | 288 | var density = Math.floor((pix[i]-min)/10); 289 | if(density>maxDensity) density = maxDensity; 290 | 291 | var add = Math.ceil(density/maxDensity*2); 292 | for (var y = -density; y < density; y = y+add) { 293 | 294 | var particle = new THREE.Vector3( 295 | x+((Math.random()-0.5) * 25), 296 | (y*10)+((Math.random()-0.5) * 50), 297 | z+((Math.random()-0.5) * 25) 298 | ); 299 | 300 | //-- Particle color from pixel 301 | 302 | var r = Math.round(pix[i]); 303 | var g = Math.round(pix[i+1]); 304 | var b = Math.round(pix[i+2]); 305 | 306 | 307 | //-- Big particle 308 | 309 | if(density>=2 && Math.abs(y)-1==0 && Math.random() * 1000 < 200) { 310 | particlesBig.vertices.push(particle); 311 | colorsBig[nbBig] = new THREE.Color("rgb("+r+", "+g+", "+b+")"); 312 | nbBig++; 313 | 314 | //-- Small particle 315 | 316 | } else if(density<4 || (Math.random() * 1000 < 400-(density*2))) { 317 | particles.vertices.push(particle); 318 | this.colors[nb] = new THREE.Color("rgb("+r+", "+g+", "+b+")"); 319 | nb++; 320 | } 321 | }; 322 | } 323 | } 324 | 325 | //-- Create small particles milkyway 326 | 327 | particles.colors = this.colors; 328 | 329 | var particleMaterial = new THREE.PointsMaterial({ 330 | map: Ed3d.textures.flare_yellow, 331 | transparent: true, 332 | size: 64, 333 | vertexColors: THREE.VertexColors, 334 | blending: THREE.AdditiveBlending, 335 | depthTest: true, 336 | depthWrite: false 337 | }); 338 | 339 | var points = new THREE.Points(particles, particleMaterial); 340 | points.sortParticles = true; 341 | particles.center(); 342 | 343 | this.milkyway[0] = points; 344 | this.milkyway[0].scale.set(20,20,20); 345 | 346 | this.obj.add(points); 347 | 348 | 349 | //-- Create big particles milkyway 350 | 351 | particlesBig.colors = colorsBig; 352 | 353 | var particleMaterialBig = new THREE.PointsMaterial({ 354 | map: Ed3d.textures.flare_yellow, 355 | transparent: true, 356 | vertexColors: THREE.VertexColors, 357 | size: 16, 358 | blending: THREE.AdditiveBlending, 359 | depthTest: true, 360 | depthWrite: false 361 | }); 362 | 363 | var pointsBig = new THREE.Points(particlesBig, particleMaterialBig); 364 | pointsBig.sortParticles = true; 365 | particlesBig.center(); 366 | 367 | this.milkyway[1] = pointsBig; 368 | this.milkyway[1].scale.set(20,20,20); 369 | 370 | this.obj.add(pointsBig); 371 | } 372 | 373 | } 374 | -------------------------------------------------------------------------------- /js/components/grid.class.js: -------------------------------------------------------------------------------- 1 | 2 | var Grid = { 3 | 4 | 'obj' : null, 5 | 'size' : null, 6 | 7 | 'textShapes' : null, 8 | 'textGeo' : null, 9 | 10 | 'coordTxt' : null, 11 | 12 | 'minDistView' : null, 13 | 14 | 'visible' : true, 15 | 16 | 'fixed' : false, 17 | 18 | /** 19 | * Create 2 base grid scaled on Elite: Dangerous grid 20 | */ 21 | 22 | 'init' : function(size, color, minDistView) { 23 | 24 | this.size = size; 25 | 26 | this.obj = new THREE.GridHelper(1000000, size); 27 | this.obj.setColors(color, color); 28 | this.obj.minDistView = minDistView; 29 | 30 | scene.add(this.obj); 31 | 32 | this.obj.customUpdateCallback = this.addCoords; 33 | 34 | 35 | return this; 36 | }, 37 | 38 | /** 39 | * Create 2 base grid scaled on Elite: Dangerous grid 40 | */ 41 | 42 | 'infos' : function(step, color, minDistView) { 43 | 44 | var size = 50000; 45 | if(step== undefined) step = 10000; 46 | this.fixed = true; 47 | 48 | //-- Add global grid 49 | 50 | var geometry = new THREE.Geometry(); 51 | var material = new THREE.LineBasicMaterial( { 52 | color: 0x555555, 53 | transparent: true, 54 | opacity: 0.2, 55 | blending: THREE.AdditiveBlending, 56 | depthWrite: false 57 | } ); 58 | 59 | for ( var i = - size; i <= size; i += step ) { 60 | 61 | geometry.vertices.push( new THREE.Vector3( - size, 0, i ) ); 62 | geometry.vertices.push( new THREE.Vector3( size, 0, i ) ); 63 | 64 | geometry.vertices.push( new THREE.Vector3( i, 0, - size ) ); 65 | geometry.vertices.push( new THREE.Vector3( i, 0, size ) ); 66 | 67 | } 68 | 69 | this.obj = new THREE.LineSegments( geometry, material ); 70 | this.obj.position.set(0,0,-20000); 71 | 72 | //-- Add quadrant 73 | 74 | var quadrant = new THREE.Geometry(); 75 | var material = new THREE.LineBasicMaterial( { 76 | color: 0x888888, 77 | transparent: true, 78 | opacity: 0.5, 79 | blending: THREE.AdditiveBlending, 80 | depthWrite: false 81 | } ); 82 | 83 | quadrant.vertices.push( new THREE.Vector3( - size, 0, 20000 ) ); 84 | quadrant.vertices.push( new THREE.Vector3( size, 0, 20000 ) ); 85 | 86 | quadrant.vertices.push( new THREE.Vector3( 0, 0, - size ) ); 87 | quadrant.vertices.push( new THREE.Vector3( 0, 0, size ) ); 88 | var quadrantL = new THREE.LineSegments( quadrant, material ); 89 | 90 | 91 | this.obj.add(quadrantL); 92 | 93 | 94 | //-- Add grid to the scene 95 | 96 | scene.add(this.obj); 97 | 98 | return this; 99 | }, 100 | 101 | 'addCoords' : function() { 102 | 103 | var textShow = '0 : 0 : 0'; 104 | var options = { 105 | 'font': 'helvetiker', 106 | 'weight': 'normal', 107 | 'style': 'normal', 108 | 'size': this.size/20, 109 | 'curveSegments': 10 110 | }; 111 | 112 | if(this.coordGrid != null) { 113 | 114 | if( 115 | Math.abs(camera.position.y-this.obj.position.y)>this.size*10 116 | || Math.abs(camera.position.y-this.obj.position.y) < this.obj.minDistView 117 | ) { 118 | this.coordGrid.visible = false; 119 | return; 120 | } 121 | this.coordGrid.visible = true; 122 | 123 | var posX = Math.ceil(controls.target.x/this.size)*this.size; 124 | var posZ = Math.ceil(controls.target.z/this.size)*this.size; 125 | 126 | var textCoords = posX+' : '+this.obj.position.y+' : '+(-posZ); 127 | 128 | //-- If same coords as previously, return. 129 | if(this.coordTxt == textCoords) return; 130 | this.coordTxt = textCoords; 131 | 132 | //-- Generate a new text shape 133 | 134 | this.textShapes = THREE.FontUtils.generateShapes( this.coordTxt, options ); 135 | this.textGeo.dispose(); 136 | this.textGeo = new THREE.ShapeGeometry(this.textShapes); 137 | 138 | var center = this.textGeo.center(); 139 | this.coordGrid.position.set(center.x+posX-(this.size/100), this.obj.position.y, center.z+posZ+(this.size/30)); 140 | 141 | 142 | this.coordGrid.geometry = this.textGeo; 143 | this.coordGrid.geometry.needsUpdate = true; 144 | 145 | } else { 146 | 147 | this.textShapes = THREE.FontUtils.generateShapes(textShow, options); 148 | this.textGeo = new THREE.ShapeGeometry(this.textShapes); 149 | this.coordGrid = new THREE.Mesh(this.textGeo, Ed3d.material.darkblue); 150 | this.coordGrid.position.set(this.obj.position.x, this.obj.position.y, this.obj.position.z); 151 | this.coordGrid.rotation.x = -Math.PI / 2; 152 | 153 | scene.add(this.coordGrid); 154 | 155 | } 156 | 157 | }, 158 | 159 | /** 160 | * Toggle grid view 161 | */ 162 | 'toggleGrid' : function() { 163 | 164 | this.visible = !this.visible; 165 | 166 | if(this.size < 10000 && isFarView) return; 167 | this.obj.visible = this.visible; 168 | 169 | }, 170 | 171 | /** 172 | * Show grid 173 | */ 174 | 'show' : function() { 175 | 176 | if(!this.visible) return; 177 | 178 | this.obj.visible = true; 179 | 180 | }, 181 | 182 | /** 183 | * Hide grid 184 | */ 185 | 'hide' : function() { 186 | 187 | this.obj.visible = false; 188 | 189 | } 190 | 191 | } 192 | 193 | -------------------------------------------------------------------------------- /js/components/hud.class.js: -------------------------------------------------------------------------------- 1 | 2 | var HUD = { 3 | 4 | 'container' : null, 5 | 6 | /** 7 | * 8 | */ 9 | 'init' : function() { 10 | 11 | Loader.update('Init HUD'); 12 | this.initHudAction(); 13 | this.initControls(); 14 | 15 | }, 16 | 17 | /** 18 | * 19 | */ 20 | 'create' : function(container) { 21 | 22 | this.container = container; 23 | 24 | if(!$('#'+this.container+' #controls').length) { 25 | 26 | $('#'+this.container).append( 27 | '
'+ 28 | ' 3D'+ 29 | ' 2D'+ 30 | ' i'+ 31 | ' '+Ico.cog+''+ 32 | ' '+ 33 | '
' 34 | ); 35 | this.createSubOptions(); 36 | 37 | } 38 | 39 | if(!Ed3d.withHudPanel) return; 40 | 41 | $('#'+this.container).append('
'); 42 | $('#hud').append( 43 | '
'+ 44 | '

Infos

'+ 45 | ' Dist. Sol '+ 46 | '
'+ 47 | '
'+ 48 | '

'+ 49 | '
'+ 50 | /*' '+*/ 54 | '
'+ 55 | '
'+ 56 | '' 57 | ); 58 | $('#'+this.container).append(''); 59 | 60 | }, 61 | 62 | /** 63 | * Create option panel 64 | */ 65 | 'createSubOptions' : function() { 66 | 67 | //-- Toggle milky way 68 | $( "" ) 69 | .addClass( "sub-opt active" ) 70 | .html('Toggle Milky Way') 71 | .click(function() { 72 | var state = Galaxy.milkyway[0].visible; 73 | Galaxy.milkyway[0].visible = !state; 74 | Galaxy.milkyway[1].visible = !state; 75 | Galaxy.milkyway2D.visible = !state; 76 | $(this).toggleClass('active'); 77 | }) 78 | .appendTo( "#options" ); 79 | 80 | //-- Toggle Grid 81 | $( "" ) 82 | .addClass( "sub-opt active" ) 83 | .html('Toggle grid') 84 | .click(function() { 85 | Ed3d.grid1H.toggleGrid(); 86 | Ed3d.grid1K.toggleGrid(); 87 | Ed3d.grid1XL.toggleGrid(); 88 | $(this).toggleClass('active'); 89 | }) 90 | .appendTo( "#options" ); 91 | 92 | }, 93 | 94 | /** 95 | * Controls init for camera views 96 | */ 97 | 'initControls' : function() { 98 | 99 | $('#controls a').click(function(e) { 100 | 101 | if($(this).hasClass('view')) { 102 | $('#controls a.view').removeClass('selected') 103 | $(this).addClass('selected'); 104 | } 105 | 106 | var view = $(this).data('view'); 107 | 108 | 109 | switch(view) { 110 | 111 | case 'top': 112 | Ed3d.isTopView = true; 113 | var moveFrom = {x: camera.position.x, y: camera.position.y , z: camera.position.z}; 114 | var moveCoords = {x: controls.target.x, y: controls.target.y+500, z: controls.target.z}; 115 | HUD.moveCamera(moveFrom,moveCoords); 116 | break; 117 | 118 | case '3d': 119 | Ed3d.isTopView = false; 120 | var moveFrom = {x: camera.position.x, y: camera.position.y , z: camera.position.z}; 121 | var moveCoords = {x: controls.target.x-100, y: controls.target.y+500, z: controls.target.z+500}; 122 | HUD.moveCamera(moveFrom,moveCoords); 123 | break; 124 | 125 | case 'infos': 126 | if(!Ed3d.showGalaxyInfos) { 127 | Ed3d.showGalaxyInfos = true; 128 | Galaxy.infosShow(); 129 | } else { 130 | Ed3d.showGalaxyInfos = false; 131 | Galaxy.infosHide(); 132 | } 133 | $(this).toggleClass('selected'); 134 | break; 135 | 136 | case 'options': 137 | $('#options').toggle(); 138 | break; 139 | 140 | } 141 | 142 | 143 | 144 | 145 | }); 146 | 147 | }, 148 | 149 | /** 150 | * Move camera to a target 151 | */ 152 | 'moveCamera' : function(from, to) { 153 | 154 | Ed3d.tween = new TWEEN.Tween(from, {override:true}).to(to, 800) 155 | .start() 156 | .onUpdate(function () { 157 | camera.position.set(from.x, from.y, from.z); 158 | }) 159 | .onComplete(function () { 160 | controls.update(); 161 | }); 162 | 163 | }, 164 | 165 | /** 166 | * 167 | */ 168 | 'initHudAction' : function() { 169 | 170 | //-- Disable 3D controls when mouse hover the Hud 171 | $( "canvas" ).hover( 172 | function() { 173 | controls.enabled = true; 174 | }, function() { 175 | controls.enabled = false; 176 | } 177 | ); 178 | 179 | //-- Disable 3D controls when mouse hover the Hud 180 | $( "#hud" ).hover( 181 | function() { 182 | controls.enabled = false; 183 | }, function() { 184 | controls.enabled = true; 185 | } 186 | ); 187 | $( "#systemDetails" ).hide(); 188 | 189 | //-- Add Count filters 190 | $('.map_filter').each(function(e) { 191 | var idCat = $(this).data('filter'); 192 | var count = Ed3d.catObjs[idCat].length; 193 | if(count>1) $(this).append(' ('+count+')'); 194 | }); 195 | 196 | //-- Add map filters 197 | $('.map_filter').click(function(e) { 198 | e.preventDefault(); 199 | var idCat = $(this).data('filter'); 200 | var active = $(this).data('active'); 201 | active = (Math.abs(active-1)); 202 | 203 | if(!Ed3d.hudMultipleSelect) { 204 | 205 | $('.map_filter').addClass('disabled'); 206 | 207 | $(System.particleGeo.vertices).each(function(index, point) { 208 | point.visible = 0; 209 | point.filtered = 0; 210 | System.particleGeo.colors[index] = new THREE.Color('#111111'); 211 | active = 1; 212 | }); 213 | 214 | } 215 | 216 | 217 | var center = null; 218 | var nbPoint = 0; 219 | var pointFar = null; 220 | $(Ed3d.catObjs[idCat]).each(function(key, indexPoint) { 221 | 222 | obj = System.particleGeo.vertices[indexPoint]; 223 | 224 | System.particleGeo.colors[indexPoint] = (active==1) 225 | ? obj.color 226 | : new THREE.Color('#111111'); 227 | 228 | obj.visible = (active==1); 229 | obj.filtered = (active==1); 230 | 231 | System.particleGeo.colorsNeedUpdate = true; 232 | 233 | //-- Sum coords to detect the center & detect the most far point 234 | if(center == null) { 235 | center = new THREE.Vector3(obj.x, obj.y, obj.z); 236 | pointFar = new THREE.Vector3(obj.x, obj.y, obj.z); 237 | } else { 238 | center.set( 239 | (center.x + obj.x), 240 | (center.y + obj.y), 241 | (center.z + obj.z) 242 | ); 243 | if( 244 | (Math.abs(pointFar.x) - Math.abs(obj.x))+ 245 | (Math.abs(pointFar.y) - Math.abs(obj.y))+ 246 | (Math.abs(pointFar.z) - Math.abs(obj.z)) < 0 247 | ) { 248 | pointFar.set(obj.x, obj.y, obj.z); 249 | } 250 | } 251 | nbPoint++; 252 | 253 | }); 254 | 255 | //-- Calc center of all selected points 256 | center.set( 257 | Math.round(center.x/nbPoint), 258 | Math.round(center.y/nbPoint), 259 | -Math.round(center.z/nbPoint) 260 | ); 261 | console.log(center); 262 | 263 | $(this).data('active',active); 264 | $(this).toggleClass('disabled'); 265 | 266 | //-- If current selection is no more visible, disable active selection 267 | if(Action.oldSel != null && !Action.oldSel.visible) Action.disableSelection(); 268 | 269 | //-- Calc max distance from center of selection 270 | var distance = pointFar.distanceTo( center )+200; 271 | console.log(distance); 272 | 273 | //-- Set new camera & target position 274 | Ed3d.playerPos = [center.x,center.y,center.z]; 275 | Ed3d.cameraPos = [ 276 | center.x + (Math.floor((Math.random() * 100) + 1)-50), //-- Add a small rotation effect 277 | center.y + distance, 278 | center.z - distance 279 | ]; 280 | 281 | Action.moveInitalPosition(); 282 | }); 283 | 284 | 285 | //-- Add map link 286 | $('.map_link').click(function(e) { 287 | 288 | e.preventDefault(); 289 | var elId = $(this).data('route'); 290 | Action.moveToObj(routes[elId]); 291 | }); 292 | 293 | $('.map_link span').click(function(e) { 294 | 295 | e.preventDefault(); 296 | 297 | var elId = $(this).parent().data('route'); 298 | routes[elId].visible = !routes[elId].visible; 299 | }); 300 | 301 | }, 302 | 303 | 'initFilters' : function(categories) { 304 | 305 | Loader.update('HUD Filter...'); 306 | 307 | var grpNb = 1; 308 | $.each(categories, function(typeFilter, values) { 309 | 310 | if(typeof values === "object" ) { 311 | var groupId = 'group_'+grpNb; 312 | 313 | $('#filters').append('

'+typeFilter+'

'); 314 | $('#filters').append('
'); 315 | 316 | $.each(values, function(key, val) { 317 | HUD.addFilter(groupId, key, val); 318 | Ed3d.catObjs[key] = [] 319 | }); 320 | grpNb++; 321 | } 322 | 323 | }); 324 | 325 | 326 | }, 327 | 328 | /** 329 | * Remove filters list 330 | */ 331 | 332 | 'removeFilters' : function() { 333 | 334 | $('#hud #filters').html(''); 335 | 336 | }, 337 | 338 | 339 | /** 340 | * 341 | */ 342 | 'addFilter' : function(groupId, idCat, val) { 343 | 344 | //-- Add material, if custom color defined, use it 345 | var back = '#fff'; 346 | if(val.color != undefined) { 347 | Ed3d.addCustomMaterial(idCat, val.color); 348 | back = '#'+val.color; 349 | } 350 | 351 | //-- Add html link 352 | $('#'+groupId).append( 353 | ''+ 354 | ' ' + val.name + '' 355 | ); 356 | }, 357 | 358 | /** 359 | * 360 | */ 361 | 'openHudDetails' : function() { 362 | $('#hud').hide(); 363 | $('#systemDetails').show().hover( 364 | function() { 365 | controls.enabled = false; 366 | }, function() { 367 | controls.enabled = true; 368 | } 369 | ); 370 | }, 371 | /** 372 | * 373 | */ 374 | 'closeHudDetails' : function() { 375 | $('#hud').show(); 376 | $('#systemDetails').hide(); 377 | }, 378 | 379 | /** 380 | * Create a Line route 381 | */ 382 | 'setRoute' : function(idRoute, nameR) { 383 | $('#routes').append(' ' + nameR + ''); 384 | }, 385 | 386 | 387 | 388 | /** 389 | * 390 | */ 391 | 392 | 'setInfoPanel' : function(index, point) { 393 | 394 | $('#systemDetails').html( 395 | '

'+point.name+'

'+ 396 | '
'+ 397 | ' '+point.x+''+point.y+''+(-point.z)+'
'+ 398 | '

'+ 399 | ''+ 400 | (point.infos != undefined ? '
'+point.infos+'
' : '')+ 401 | '' 403 | ); 404 | 405 | //-- Add navigation 406 | 407 | $('', {'html': '<'}) 408 | .click(function(){Action.moveNextPrev(index-1, -1);}) 409 | .appendTo("#nav"); 410 | 411 | $('', {'html': 'X'}) 412 | .click(function(){HUD.closeHudDetails();}) 413 | .appendTo("#nav"); 414 | 415 | $('', {'html': '>'}) 416 | .click(function(){Action.moveNextPrev(index+1, 1);}) 417 | .appendTo("#nav"); 418 | 419 | }, 420 | 421 | 422 | /** 423 | * Add Shape text 424 | */ 425 | 426 | 'addText' : function(id, textShow, x, y, z, size, addToObj) { 427 | 428 | if(addToObj == undefined) addToObj = scene; 429 | 430 | var textShapes = THREE.FontUtils.generateShapes(textShow, { 431 | 'font': 'helvetiker', 432 | 'weight': 'normal', 433 | 'style': 'normal', 434 | 'size': size, 435 | 'curveSegments': 100 436 | }); 437 | 438 | var textGeo = new THREE.ShapeGeometry(textShapes); 439 | 440 | if(Ed3d.textSel[id] == undefined) { 441 | var textMesh = new THREE.Mesh(textGeo, new THREE.MeshBasicMaterial({ 442 | color: 0xffffff 443 | })); 444 | } else { 445 | var textMesh = Ed3d.textSel[id]; 446 | } 447 | 448 | textMesh.geometry = textGeo; 449 | textMesh.geometry.needsUpdate = true; 450 | 451 | textMesh.position.set(x, y, z); 452 | 453 | Ed3d.textSel[id] = textMesh; 454 | addToObj.add(textMesh); 455 | 456 | 457 | } 458 | 459 | } 460 | -------------------------------------------------------------------------------- /js/components/icon.class.js: -------------------------------------------------------------------------------- 1 | 2 | var Ico = { 3 | 4 | 'cog' : ' ' 5 | 6 | } -------------------------------------------------------------------------------- /js/components/route.class.js: -------------------------------------------------------------------------------- 1 | 2 | var Route = { 3 | 4 | //-- Var to enable routes 5 | 'active' : false, 6 | 7 | //-- Init list coords 8 | 'systems' : [], 9 | 10 | //-- Route list 11 | 'list' : [], 12 | 13 | /** 14 | * Initialize the systems list for coordinates check 15 | * 16 | * @param {Int} Unique ID for the route 17 | * @param {JSON} A JSon list of points 18 | */ 19 | 20 | 'initRoute' : function(idRoute, route) { 21 | 22 | Route.active = true; 23 | 24 | $.each(route.points, function(key, val) { 25 | Route.systems[val.s] = false; 26 | }); 27 | 28 | }, 29 | 30 | /** 31 | * Create a Line route 32 | * 33 | * @param {Int} Unique ID for the route 34 | * @param {JSON} A JSon list of points 35 | */ 36 | 37 | 'createRoute' : function(idRoute, route) { 38 | 39 | var geometryL = new THREE.Geometry(); 40 | var nameR = ''; 41 | var first = null; 42 | var last = null; 43 | 44 | $.each(route.points, function(key2, val) { 45 | 46 | if(Route.systems[val.s] !== false) { 47 | 48 | var c = Route.systems[val.s]; 49 | 50 | if(first==null) first = [c[0], c[1], c[2]]; 51 | last = [c[0], c[1], c[2]]; 52 | 53 | //-- Add line point 54 | geometryL.vertices.push( 55 | new THREE.Vector3(c[0], c[1], c[2]) 56 | ); 57 | Route.addPoint(c[0], c[1], c[2]); 58 | 59 | /*var geometry = new THREE.SphereGeometry(3, 10, 10); 60 | var sphere = new THREE.Mesh(geometry, Ed3d.material.white); 61 | sphere.position.set(x, y, z); 62 | scene.add(sphere);*/ 63 | 64 | } else { 65 | 66 | console.log("Missing point: "+val.s); 67 | } 68 | 69 | }); 70 | 71 | //-- Add lines to scene 72 | routes[idRoute] = new THREE.Line(geometryL, Ed3d.material.line); 73 | 74 | //-- Add object for start & end 75 | if(first!==null) routes[idRoute].add(this.addCircle(first)); 76 | if(last!==null) routes[idRoute].add(this.addCircle(last)); 77 | 78 | scene.add(routes[idRoute]); 79 | 80 | }, 81 | 82 | 'addCircle' : function(point) { 83 | var cursor = new THREE.Object3D; 84 | 85 | //-- Ring around the system 86 | var geometryL = new THREE.TorusGeometry( 12, 0.4, 3, 30 ); 87 | 88 | var selection = new THREE.Mesh(geometryL, Ed3d.material.orange); 89 | selection.rotation.x = Math.PI / 2; 90 | 91 | cursor.add(selection); 92 | 93 | cursor.position.set(point[0], point[1], point[2]); 94 | 95 | cursor.scale.set(15,15,15); 96 | 97 | scene.add(cursor); 98 | }, 99 | 100 | 'addPoint' : function(x, y, z) { 101 | 102 | /*console.log('Add point route');*/ 103 | 104 | /*var cursor = new THREE.Object3D; 105 | 106 | //-- Ring around the system 107 | var geometryL = new THREE.TorusGeometry( 12, 0.4, 3, 30 ); 108 | 109 | var selection = new THREE.Mesh(geometryL, Ed3d.material.selected); 110 | selection.rotation.x = Math.PI / 2; 111 | 112 | cursor.add(selection); 113 | 114 | //-- Create a cone on the selection 115 | var geometryCone = new THREE.CylinderGeometry(0, 5, 16, 4, 1, false); 116 | var cone = new THREE.Mesh(geometryCone, Ed3d.material.selected); 117 | cone.position.set(0, 20, 0); 118 | cone.rotation.x = Math.PI; 119 | cursor.add(cone); 120 | 121 | //-- Inner cone 122 | var geometryConeInner = new THREE.CylinderGeometry(0, 3.6, 16, 4, 1, false); 123 | var coneInner = new THREE.Mesh(geometryConeInner, Ed3d.material.black); 124 | coneInner.position.set(0, 20.2, 0); 125 | coneInner.rotation.x = Math.PI; 126 | cursor.add(coneInner); 127 | 128 | 129 | cursor.position.set(x, y, -z); 130 | 131 | cursor.scale.set(30,30,30); 132 | 133 | scene.add(cursor);*/ 134 | } 135 | 136 | 137 | } 138 | -------------------------------------------------------------------------------- /js/components/system.class.js: -------------------------------------------------------------------------------- 1 | 2 | var System = { 3 | 4 | 'particle' : null, 5 | 'particleGeo' : null, 6 | 'particleColor' : [], 7 | 'particleInfos' : [], 8 | 'count' : 0, 9 | 'scaleSize' : 64, 10 | 11 | /** 12 | * Add a system in galaxy 13 | * 14 | * @param {object} val System properties (x, y, z, name are mandatory) 15 | * @param {string} withSolid Add a solid sphere (default: false) 16 | */ 17 | 18 | 'create' : function(val, withSolid) { 19 | 20 | if(withSolid==undefined) withSolid = false; 21 | 22 | if(val.coords==undefined) return false; 23 | 24 | var x = parseInt(val.coords.x); 25 | var y = parseInt(val.coords.y); 26 | var z = -parseInt(val.coords.z); //-- Revert Z coord 27 | 28 | //-------------------------------------------------------------------------- 29 | //-- Particle for near and far view 30 | 31 | var colors = []; 32 | if(this.particleGeo !== null) { 33 | 34 | //-- If system with info already registered, concat datas 35 | var idSys = x+'_'+y+'_'+z; 36 | if(val.infos != undefined && this.particleInfos[idSys]) { 37 | var indexParticle = this.particleInfos[idSys]; 38 | this.particleGeo.vertices[indexParticle].infos += val.infos; 39 | if(val.cat != undefined) Ed3d.addObjToCategories(indexParticle,val.cat); 40 | return; 41 | } 42 | 43 | var particle = new THREE.Vector3(x, y, z); 44 | 45 | //-- Get point color 46 | 47 | if(val.cat != undefined && val.cat[0] != undefined && Ed3d.colors[val.cat[0]] != undefined) { 48 | this.particleColor[this.count] = Ed3d.colors[val.cat[0]]; 49 | } else { 50 | this.particleColor[this.count] = new THREE.Color(Ed3d.systemColor); 51 | } 52 | 53 | //-- If system got some categories, add it to cat list and save his main color 54 | 55 | if(val.cat != undefined) { 56 | Ed3d.addObjToCategories(this.count,val.cat); 57 | particle.color = this.particleColor[this.count]; 58 | } 59 | 60 | //-- Attach name and set point as clickable 61 | 62 | particle.clickable = true; 63 | particle.visible = true; 64 | particle.name = val.name; 65 | if(val.infos != undefined) { 66 | particle.infos = val.infos; 67 | this.particleInfos[idSys] = this.count; 68 | } 69 | 70 | this.particleGeo.vertices.push(particle); 71 | 72 | this.count++; 73 | } 74 | 75 | //-------------------------------------------------------------------------- 76 | //-- Check if we have to add coords for a route 77 | 78 | if(Route.active == true) { 79 | 80 | if(Route.systems[val.name] != undefined) { 81 | Route.systems[val.name] = [x,y,z] 82 | } 83 | 84 | } 85 | 86 | //-------------------------------------------------------------------------- 87 | //-- Build a sphere if needed 88 | 89 | if(withSolid) { 90 | 91 | //-- Add glow sprite from first cat color if defined, else take white glow 92 | 93 | var mat = Ed3d.material.glow_1; 94 | 95 | var sprite = new THREE.Sprite( mat ); 96 | sprite.position.set(x, y, z); 97 | sprite.scale.set(50, 50, 1.0); 98 | scene.add(sprite); // this centers the glow at the mesh 99 | 100 | //-- Sphere 101 | 102 | var geometry = new THREE.SphereGeometry(2, 10, 10); 103 | 104 | var sphere = new THREE.Mesh(geometry, Ed3d.material.white); 105 | 106 | sphere.position.set(x, y, z); 107 | 108 | sphere.name = val.name; 109 | 110 | sphere.clickable = true; 111 | sphere.idsprite = sprite.id; 112 | scene.add(sphere); 113 | 114 | return sphere; 115 | } 116 | 117 | }, 118 | 119 | 120 | /** 121 | * Init the galaxy particle geometry 122 | */ 123 | 124 | 'initParticleSystem' : function () { 125 | this.particleGeo = new THREE.Geometry; 126 | }, 127 | 128 | /** 129 | * Create the particle system 130 | */ 131 | 132 | 'endParticleSystem' : function () { 133 | 134 | if(this.particleGeo == null) return; 135 | 136 | this.particleGeo.colors = this.particleColor; 137 | 138 | var particleMaterial = new THREE.PointsMaterial({ 139 | map: Ed3d.textures.flare_yellow, 140 | vertexColors: THREE.VertexColors, 141 | size: this.scaleSize, 142 | fog: false, 143 | blending: THREE.AdditiveBlending, 144 | transparent: true, 145 | depthTest: true, 146 | depthWrite: false 147 | }); 148 | 149 | this.particle = new THREE.Points(this.particleGeo, particleMaterial); 150 | 151 | this.particle.sortParticles = true; 152 | this.particle.clickable = true; 153 | 154 | scene.add(this.particle); 155 | }, 156 | 157 | 158 | /** 159 | * Remove systems list 160 | */ 161 | 162 | 'remove' : function() { 163 | 164 | this.particleColor = []; 165 | this.particleGeo = null; 166 | this.count = 0; 167 | scene.remove(this.particle); 168 | 169 | }, 170 | 171 | /** 172 | * Load Spectral system color 173 | */ 174 | 175 | 'loadSpectral' : function(val) { 176 | 177 | } 178 | 179 | } 180 | -------------------------------------------------------------------------------- /location.php: -------------------------------------------------------------------------------- 1 | 114 | -------------------------------------------------------------------------------- /nextjump.php: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 36 | 37 |
23 | 24 | 0) 27 | { 28 | $s = ""; 29 | if ($j[1] == "O" || $j[1] == "B" || $j[1] == "A" || $j[1] == "F" || $j[1] == "G" || $j[1] == "K" || $j[1] == "M") 30 | { $s = "[".$j[1]."]"; } else { $s = "[".$j[1]."]"; } 31 | echo "Next: ".$j[0]." - ".$s; 32 | } 33 | ?> 34 | 35 |
38 | -------------------------------------------------------------------------------- /panel.php: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | ".$id[0] . " [" . $id[1]. "]"; 32 | ?> 33 |
34 | CMDR. - 35 |
36 |
37 | 38 |

39 | 40 | 41 | 80 | 81 | 136 | 137 | 138 | 139 | 140 | 148 | 156 | 157 | 158 |
42 | 43 |
44 | 45 | 46 | 67 | 75 | 76 |
47 |
48 |
CURRENT LOCATION

49 |
50 | 51 | "; 53 | $j = ED_getNextJump(); 54 | if (count($j) > 0) 55 | { 56 | $s = ""; 57 | if ($j[1] == "O" || $j[1] == "B" || $j[1] == "A" || $j[1] == "F" || $j[1] == "G" || $j[1] == "K" || $j[1] == "M") 58 | { $s = "[".$j[1]."]"; } else { $s = "[".$j[1]."]"; } 59 | echo "Next: ".$j[0]." ".$s; 60 | } 61 | ?>

62 | COORDINATES


63 | LAST JUMP DISTANCE
LY


64 | DISTANCE TO SOL:
LY


65 |
66 |
68 |
69 |
70 |
71 | 72 |
73 |
74 |
77 |
78 | 79 |
82 |
83 |
STATUS
84 | 85 | 86 | 87 | 88 | 95 | 96 | 104 | 105 | 113 | 114 | 122 | 123 | 131 | 132 | 133 |
89 | 90 |
91 | 92 |
93 | 94 |
97 |
98 |
FUEL
99 |
100 |
101 |
102 | 103 |
106 |
107 |
SYS
108 |
109 |
110 |
111 | 112 |
115 |
116 |
ENG
117 |
118 |
119 |
120 | 121 |
124 |
125 |
WEP
126 |
127 |
128 |
129 | 130 |
134 | 135 |

141 |
COMMS 142 |
143 |

144 | 145 |

146 |
147 |

149 |
EXPLORATION 150 |
151 |

152 | 153 |

154 |
155 |
159 | 160 | 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /pi.php: -------------------------------------------------------------------------------- 1 | 0) 26 | { 27 | $s = ""; 28 | if ($j[1] == "O" || $j[1] == "B" || $j[1] == "A" || $j[1] == "F" || $j[1] == "G" || $j[1] == "K" || $j[1] == "M") 29 | { $s = "[".$j[1]."]"; } else { $s = "[".$j[1]."]"; } 30 | echo "Next: ".$j[0]." - ".$s; 31 | } 32 | exit(0); 33 | } 34 | 35 | 36 | if ($_GET["panel"] != "location") 37 | { header( "refresh:2;url=pi.php?panel=".$_GET["panel"] ); } 38 | 39 | ?> 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | height= cellspacing=0 cellpadding=0> 51 | 52 | 394 | 395 |
53 | 54 | 0) 80 | { 81 | for ($i=0; $i $p[0] ); 100 | $v["points"][] = $t; 101 | $systems["routes"][] = $v; 102 | } 103 | if (count($j) > 0) 104 | { 105 | $a = ED_getAllJumps(); 106 | $v = array(); 107 | $v["title"] = "TravelRoute"; 108 | $v["points"] = array(); 109 | $t = array( "s" => $p[0] ); 110 | $v["points"][] = $t; 111 | 112 | for ($x=0; $x $a[0] ); 115 | $v["points"][] = $u; 116 | } 117 | 118 | $systems["routes"][] = $v; 119 | } 120 | 121 | $fp = fopen('data/data.json', 'w'); 122 | fwrite($fp, json_encode($systems)); 123 | fclose($fp); 124 | } 125 | else 126 | { 127 | $content = file_get_contents("data/data.json"); 128 | $systems = json_decode($content, true); 129 | 130 | $exist = false; 131 | for ($i=0; $i 0) 145 | { 146 | for ($i=0; $i $p[0] ); 171 | $v["points"][] = $t; 172 | $systems["routes"][] = $v; 173 | } 174 | if (count($j) > 0) 175 | { 176 | $a = ED_getAllJumps(); 177 | $v = array(); 178 | $v["title"] = "TravelRoute"; 179 | $v["points"] = array(); 180 | $t = array( "s" => $p[0] ); 181 | $v["points"][] = $t; 182 | 183 | for ($x=0; $x $a[0][0] ); 186 | $v["points"][] = $u; 187 | } 188 | 189 | $systems["routes"][] = $v; 190 | } 191 | 192 | unlink("data/data.json"); 193 | $fp = fopen('data/data.json', 'w'); 194 | fwrite($fp, json_encode($systems)); 195 | fclose($fp); 196 | } 197 | 198 | $docked = ED_getDockedStation(); 199 | echo ' 200 | 201 | 202 | 221 | 222 | 223 | 226 | 227 | 228 | 242 | 243 |
203 | 204 | 205 | 206 | 210 | '; 211 | $id = ED_getShipNameID(); 212 | $cmdr = ED_getCommanderName(); 213 | echo ' 217 | 218 |
207 | '.strtoupper($p[0]).'
208 | '.$docked.' 209 |
214 | '.$id[0].' [' . $id[1]. ']
215 | CMDR. '.$cmdr.' - ' . $id[2]. '
216 |
219 | 220 |
224 |
225 |
229 | 230 | 231 | 232 | 235 | 238 | 239 |
233 | 234 | 236 | Sol: '.round( ED_DistToSol() , 2).' LY 237 |
240 | 241 |
244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 268 | 269 | 303 | '; 304 | } 305 | 306 | 307 | 308 | if ($_GET["panel"] == "status") // DISPLAY THE STATUS PANEL WITH PIPS AND FUEL 309 | { 310 | echo ' 311 |
STATUS    COMMS    EXPLORATION


312 | 313 | 314 | 315 | 316 | 323 | 324 | 332 | 333 | 341 | 342 | 350 | 351 | 359 | 360 | 361 |
317 | 318 |
319 | '; ED_populateStatusPanel(); echo ' 320 |
321 | 322 |
325 |
326 |
FUEL
327 |
328 |
'; ED_displayFuel_pi(); echo '
329 |
330 | 331 |
334 |
335 |
SYS
336 |
337 |
'; ED_pip1_pi(); echo '
338 |
339 | 340 |
343 |
344 |
ENG
345 |
346 |
'; ED_pip2_pi(); echo '
347 |
348 | 349 |
352 |
353 |
WEP
354 |
355 |
'; ED_pip3_pi(); echo '
356 |
357 | 358 |
362 | '; 363 | } 364 | 365 | 366 | if ($_GET["panel"] == "comms") 367 | { 368 | echo ' 369 |
STATUS    COMMS    EXPLORATION
370 |
371 |

372 | '; ED_getComms(); echo ' 373 |

374 |
375 | '; 376 | } 377 | 378 | 379 | if ($_GET["panel"] == "exp") 380 | { 381 | echo ' 382 |
STATUS    COMMS    EXPLORATION
383 |
384 |

385 | '; ED_getExplorationData(); echo ' 386 |

387 |
388 | '; 389 | } 390 | 391 | ?> 392 | 393 |
396 | 397 | 398 | 399 | 400 | 401 | -------------------------------------------------------------------------------- /pips.php: -------------------------------------------------------------------------------- 1 | "; 14 | echo "
"; 15 | } 16 | 17 | function ED_pip1_pi() 18 | { 19 | $statuscontent = file_get_contents($GLOBALS["ed_journal_folder"]."\Status.json"); 20 | $status = json_decode($statuscontent, true); 21 | $pips = $status["Pips"]; 22 | $value = $pips[0] / 8.0; 23 | $v = 473; 24 | $hght = $v - ($v*$value); 25 | echo "
"; 26 | echo "
"; 27 | } 28 | 29 | function ED_pip2() 30 | { 31 | $statuscontent = file_get_contents($GLOBALS["ed_journal_folder"]."\Status.json"); 32 | $status = json_decode($statuscontent, true); 33 | $pips = $status["Pips"]; 34 | $value = $pips[1] / 8.0; 35 | $hght = 312 - (312*$value); 36 | echo "
"; 37 | echo "
"; 38 | } 39 | 40 | function ED_pip2_pi() 41 | { 42 | $statuscontent = file_get_contents($GLOBALS["ed_journal_folder"]."\Status.json"); 43 | $status = json_decode($statuscontent, true); 44 | $pips = $status["Pips"]; 45 | $value = $pips[1] / 8.0; 46 | $v = 473; 47 | $hght = $v - ($v*$value); 48 | echo "
"; 49 | echo "
"; 50 | } 51 | 52 | function ED_pip3() 53 | { 54 | $statuscontent = file_get_contents($GLOBALS["ed_journal_folder"]."\Status.json"); 55 | $status = json_decode($statuscontent, true); 56 | $pips = $status["Pips"]; 57 | $value = $pips[2] / 8.0; 58 | $hght = 312 - (312*$value); 59 | echo "
"; 60 | echo "
"; 61 | } 62 | 63 | function ED_pip3_pi() 64 | { 65 | $statuscontent = file_get_contents($GLOBALS["ed_journal_folder"]."\Status.json"); 66 | $status = json_decode($statuscontent, true); 67 | $pips = $status["Pips"]; 68 | $value = $pips[2] / 8.0; 69 | $v = 473; 70 | $hght = $v - ($v*$value); 71 | echo "
"; 72 | echo "
"; 73 | } 74 | 75 | ?> 76 | -------------------------------------------------------------------------------- /schemas/ed3d-full.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "title": "ED3D systems and filters list", 4 | "type": "object", 5 | "categories": { 6 | "title": "Categories list to classify systems", 7 | "type": "object", 8 | "items": { 9 | "category": { 10 | "title": "Category", 11 | "type": "object", 12 | "properties": { 13 | "id": { 14 | "description": "The category ID", 15 | "type": "integer" 16 | }, 17 | "name": { 18 | "description": "The category title", 19 | "type": "string" 20 | }, 21 | "color": { 22 | "type": "string" 23 | }, 24 | "required": ["id", "name"] 25 | } 26 | } 27 | } 28 | }, 29 | "systems": { 30 | "title": "Systems list", 31 | "type": "array", 32 | "items": { 33 | "title": "System", 34 | "type": "object", 35 | "properties": { 36 | "name": { 37 | "description": "System name", 38 | "type": "string" 39 | }, 40 | "coords": { 41 | "description": "System coordinates", 42 | "type": "object", 43 | "properties": { 44 | "x": { 45 | "description": "X coord", 46 | "type": "integer" 47 | }, 48 | "y": { 49 | "description": "Y coord", 50 | "type": "integer" 51 | }, 52 | "z": { 53 | "description": "Z coord", 54 | "type": "integer" 55 | } 56 | }, 57 | "required": ["x", "y", "z"] 58 | }, 59 | "type": { 60 | "description": "The stellar type: A, B, O...", 61 | "type": "integer" 62 | }, 63 | "infos": { 64 | "description": "A custom description for the system", 65 | "type": "string" 66 | }, 67 | "cat": { 68 | "description": "A list of categories for the system", 69 | "type": "array", 70 | "items": { 71 | "id": { 72 | "description": "A category ID", 73 | "type": "integer" 74 | } 75 | } 76 | } 77 | }, 78 | "required": ["name", "coords"] 79 | } 80 | }, 81 | "required": ["systems"] 82 | } -------------------------------------------------------------------------------- /schemas/ed3d-simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "title": "Systems list", 4 | "type": "array", 5 | "items": { 6 | "title": "System", 7 | "type": "object", 8 | "properties": { 9 | "name": { 10 | "description": "System name", 11 | "type": "string" 12 | }, 13 | "coords": { 14 | "description": "System coordinates", 15 | "type": "object", 16 | "properties": { 17 | "x": { 18 | "description": "X coord", 19 | "type": "integer" 20 | }, 21 | "y": { 22 | "description": "Y coord", 23 | "type": "integer" 24 | }, 25 | "z": { 26 | "description": "Z coord", 27 | "type": "integer" 28 | } 29 | }, 30 | "required": ["x", "y", "z"] 31 | }, 32 | "type": { 33 | "description": "The stellar type: A, B, O...", 34 | "type": "integer" 35 | }, 36 | "infos": { 37 | "description": "A custom description for the system", 38 | "type": "string" 39 | }, 40 | "cat": { 41 | "description": "A list of categories for the system", 42 | "type": "array", 43 | "items": { 44 | "id": { 45 | "description": "A category ID", 46 | "type": "integer" 47 | } 48 | } 49 | } 50 | }, 51 | "required": ["name", "coords"] 52 | } 53 | } -------------------------------------------------------------------------------- /ship_name_id.php: -------------------------------------------------------------------------------- 1 | 23 | -------------------------------------------------------------------------------- /textures/heightmap2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/heightmap2.jpg -------------------------------------------------------------------------------- /textures/heightmap7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/heightmap7.jpg -------------------------------------------------------------------------------- /textures/lensflare/flare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/lensflare/flare.png -------------------------------------------------------------------------------- /textures/lensflare/flare2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/lensflare/flare2.png -------------------------------------------------------------------------------- /textures/lensflare/flare3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/lensflare/flare3.png -------------------------------------------------------------------------------- /textures/lensflare/lensflare0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/lensflare/lensflare0.png -------------------------------------------------------------------------------- /textures/lensflare/lensflare1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/lensflare/lensflare1.png -------------------------------------------------------------------------------- /textures/lensflare/lensflare2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/lensflare/lensflare2.png -------------------------------------------------------------------------------- /textures/lensflare/lensflare3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/lensflare/lensflare3.png -------------------------------------------------------------------------------- /textures/lensflare/lensflare_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/lensflare/lensflare_white.png -------------------------------------------------------------------------------- /textures/lensflare/lensflare_white2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/lensflare/lensflare_white2.png -------------------------------------------------------------------------------- /textures/lensflare/star_grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/lensflare/star_grey.png -------------------------------------------------------------------------------- /textures/lensflare/star_grey2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/lensflare/star_grey2.png -------------------------------------------------------------------------------- /textures/lensflare/star_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusscomputer/EDStatusPanel/0d9877546f562e44a15144393afbcf0f5116b62b/textures/lensflare/star_yellow.png -------------------------------------------------------------------------------- /vendor/renderstats/README.md: -------------------------------------------------------------------------------- 1 | threex.rendererstats 2 | ==================== 3 | 4 | It is a three.js extension to display realtime informations about ```THREE.WebGLRenderer```. 5 | Here is a [basic example](http://jeromeetienne.github.io/threex.rendererstats/examples/basic.html). It is widely inpired from @mrdoob [stats.js](https://github.com/mrdoob/stats.js/). 6 | It is released under MIT license. 7 | 8 | ## How To install it 9 | 10 | You can install it manually or with 11 | [bower](http://bower.io/). 12 | for the manual version, first include ```threex.rendererstats.js``` with the usual 13 | 14 | ```html 15 | 16 | ``` 17 | 18 | or with 19 | [bower](http://bower.io/) 20 | you type the following to install the package. 21 | 22 | ```bash 23 | bower install -s threex.rendererstats=https://github.com/jeromeetienne/threex.rendererstats/archive/master.zip 24 | ``` 25 | 26 | then you add that in your html 27 | 28 | ```html 29 | 30 | ``` 31 | 32 | ## How To Use It 33 | 34 | ``` 35 | var rendererStats = new THREEx.RendererStats() 36 | ``` 37 | 38 | position it on the page with css with something along this line 39 | 40 | ``` 41 | rendererStats.domElement.style.position = 'absolute' 42 | rendererStats.domElement.style.left = '0px' 43 | rendererStats.domElement.style.bottom = '0px' 44 | document.body.appendChild( rendererStats.domElement ) 45 | ``` 46 | 47 | finally update it at every frame 48 | 49 | ``` 50 | rendererStats.update(renderer); 51 | ``` -------------------------------------------------------------------------------- /vendor/renderstats/threex.rendererstats.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com/ 3 | * @author jetienne / http://jetienne.com/ 4 | */ 5 | /** @namespace */ 6 | var THREEx = THREEx || {} 7 | 8 | /** 9 | * provide info on THREE.WebGLRenderer 10 | * 11 | * @param {Object} renderer the renderer to update 12 | * @param {Object} Camera the camera to update 13 | */ 14 | THREEx.RendererStats = function (){ 15 | 16 | var msMin = 100; 17 | var msMax = 0; 18 | 19 | var container = document.createElement( 'div' ); 20 | container.style.cssText = 'width:80px;opacity:0.9;cursor:pointer'; 21 | 22 | var msDiv = document.createElement( 'div' ); 23 | msDiv.style.cssText = 'padding:0 0 3px 3px;text-align:left;background-color:#200;'; 24 | container.appendChild( msDiv ); 25 | 26 | var msText = document.createElement( 'div' ); 27 | msText.style.cssText = 'color:#f00;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px'; 28 | msText.innerHTML= 'WebGLRenderer'; 29 | msDiv.appendChild( msText ); 30 | 31 | var msTexts = []; 32 | var nLines = 9; 33 | for(var i = 0; i < nLines; i++){ 34 | msTexts[i] = document.createElement( 'div' ); 35 | msTexts[i].style.cssText = 'color:#f00;background-color:#311;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px'; 36 | msDiv.appendChild( msTexts[i] ); 37 | msTexts[i].innerHTML= '-'; 38 | } 39 | 40 | 41 | var lastTime = Date.now(); 42 | return { 43 | domElement: container, 44 | 45 | update: function(webGLRenderer){ 46 | // sanity check 47 | console.assert(webGLRenderer instanceof THREE.WebGLRenderer) 48 | 49 | // refresh only 30time per second 50 | if( Date.now() - lastTime < 1000/30 ) return; 51 | lastTime = Date.now() 52 | 53 | var i = 0; 54 | msTexts[i++].textContent = "== Memory ====="; 55 | msTexts[i++].textContent = "Programs: " + webGLRenderer.info.memory.programs; 56 | msTexts[i++].textContent = "Geometries: "+webGLRenderer.info.memory.geometries; 57 | msTexts[i++].textContent = "Textures: " + webGLRenderer.info.memory.textures; 58 | 59 | msTexts[i++].textContent = "== Render ====="; 60 | msTexts[i++].textContent = "Calls: " + webGLRenderer.info.render.calls; 61 | msTexts[i++].textContent = "Vertices: " + webGLRenderer.info.render.vertices; 62 | msTexts[i++].textContent = "Faces: " + webGLRenderer.info.render.faces; 63 | msTexts[i++].textContent = "Points: " + webGLRenderer.info.render.points; 64 | } 65 | } 66 | }; -------------------------------------------------------------------------------- /vendor/three-js/CSS3DRenderer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs 3 | * @author mrdoob / http://mrdoob.com/ 4 | */ 5 | 6 | THREE.CSS3DObject = function ( element ) { 7 | 8 | THREE.Object3D.call( this ); 9 | 10 | this.element = element; 11 | this.element.style.position = 'absolute'; 12 | 13 | this.addEventListener( 'removed', function ( event ) { 14 | 15 | if ( this.element.parentNode !== null ) { 16 | 17 | this.element.parentNode.removeChild( this.element ); 18 | 19 | } 20 | 21 | } ); 22 | 23 | }; 24 | 25 | THREE.CSS3DObject.prototype = Object.create( THREE.Object3D.prototype ); 26 | THREE.CSS3DObject.prototype.constructor = THREE.CSS3DObject; 27 | 28 | THREE.CSS3DSprite = function ( element ) { 29 | 30 | THREE.CSS3DObject.call( this, element ); 31 | 32 | }; 33 | 34 | THREE.CSS3DSprite.prototype = Object.create( THREE.CSS3DObject.prototype ); 35 | THREE.CSS3DSprite.prototype.constructor = THREE.CSS3DSprite; 36 | 37 | // 38 | 39 | THREE.CSS3DRenderer = function () { 40 | 41 | console.log( 'THREE.CSS3DRenderer', THREE.REVISION ); 42 | 43 | var _width, _height; 44 | var _widthHalf, _heightHalf; 45 | 46 | var matrix = new THREE.Matrix4(); 47 | 48 | var cache = { 49 | camera: { fov: 0, style: '' }, 50 | objects: {} 51 | }; 52 | 53 | var domElement = document.createElement( 'div' ); 54 | domElement.style.overflow = 'hidden'; 55 | 56 | domElement.style.WebkitTransformStyle = 'preserve-3d'; 57 | domElement.style.MozTransformStyle = 'preserve-3d'; 58 | domElement.style.oTransformStyle = 'preserve-3d'; 59 | domElement.style.transformStyle = 'preserve-3d'; 60 | 61 | this.domElement = domElement; 62 | 63 | var cameraElement = document.createElement( 'div' ); 64 | 65 | cameraElement.style.WebkitTransformStyle = 'preserve-3d'; 66 | cameraElement.style.MozTransformStyle = 'preserve-3d'; 67 | cameraElement.style.oTransformStyle = 'preserve-3d'; 68 | cameraElement.style.transformStyle = 'preserve-3d'; 69 | 70 | domElement.appendChild( cameraElement ); 71 | 72 | this.setClearColor = function () {}; 73 | 74 | this.getSize = function() { 75 | 76 | return { 77 | width: _width, 78 | height: _height 79 | }; 80 | 81 | }; 82 | 83 | this.setSize = function ( width, height ) { 84 | 85 | _width = width; 86 | _height = height; 87 | 88 | _widthHalf = _width / 2; 89 | _heightHalf = _height / 2; 90 | 91 | domElement.style.width = width + 'px'; 92 | domElement.style.height = height + 'px'; 93 | 94 | cameraElement.style.width = width + 'px'; 95 | cameraElement.style.height = height + 'px'; 96 | 97 | }; 98 | 99 | var epsilon = function ( value ) { 100 | 101 | return Math.abs( value ) < Number.EPSILON ? 0 : value; 102 | 103 | }; 104 | 105 | var getCameraCSSMatrix = function ( matrix ) { 106 | 107 | var elements = matrix.elements; 108 | 109 | return 'matrix3d(' + 110 | epsilon( elements[ 0 ] ) + ',' + 111 | epsilon( - elements[ 1 ] ) + ',' + 112 | epsilon( elements[ 2 ] ) + ',' + 113 | epsilon( elements[ 3 ] ) + ',' + 114 | epsilon( elements[ 4 ] ) + ',' + 115 | epsilon( - elements[ 5 ] ) + ',' + 116 | epsilon( elements[ 6 ] ) + ',' + 117 | epsilon( elements[ 7 ] ) + ',' + 118 | epsilon( elements[ 8 ] ) + ',' + 119 | epsilon( - elements[ 9 ] ) + ',' + 120 | epsilon( elements[ 10 ] ) + ',' + 121 | epsilon( elements[ 11 ] ) + ',' + 122 | epsilon( elements[ 12 ] ) + ',' + 123 | epsilon( - elements[ 13 ] ) + ',' + 124 | epsilon( elements[ 14 ] ) + ',' + 125 | epsilon( elements[ 15 ] ) + 126 | ')'; 127 | 128 | }; 129 | 130 | var getObjectCSSMatrix = function ( matrix ) { 131 | 132 | var elements = matrix.elements; 133 | 134 | return 'translate3d(-50%,-50%,0) matrix3d(' + 135 | epsilon( elements[ 0 ] ) + ',' + 136 | epsilon( elements[ 1 ] ) + ',' + 137 | epsilon( elements[ 2 ] ) + ',' + 138 | epsilon( elements[ 3 ] ) + ',' + 139 | epsilon( - elements[ 4 ] ) + ',' + 140 | epsilon( - elements[ 5 ] ) + ',' + 141 | epsilon( - elements[ 6 ] ) + ',' + 142 | epsilon( - elements[ 7 ] ) + ',' + 143 | epsilon( elements[ 8 ] ) + ',' + 144 | epsilon( elements[ 9 ] ) + ',' + 145 | epsilon( elements[ 10 ] ) + ',' + 146 | epsilon( elements[ 11 ] ) + ',' + 147 | epsilon( elements[ 12 ] ) + ',' + 148 | epsilon( elements[ 13 ] ) + ',' + 149 | epsilon( elements[ 14 ] ) + ',' + 150 | epsilon( elements[ 15 ] ) + 151 | ')'; 152 | 153 | }; 154 | 155 | var renderObject = function ( object, camera ) { 156 | 157 | if ( object instanceof THREE.CSS3DObject ) { 158 | 159 | var style; 160 | 161 | if ( object instanceof THREE.CSS3DSprite ) { 162 | 163 | // http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/ 164 | 165 | matrix.copy( camera.matrixWorldInverse ); 166 | matrix.transpose(); 167 | matrix.copyPosition( object.matrixWorld ); 168 | matrix.scale( object.scale ); 169 | 170 | matrix.elements[ 3 ] = 0; 171 | matrix.elements[ 7 ] = 0; 172 | matrix.elements[ 11 ] = 0; 173 | matrix.elements[ 15 ] = 1; 174 | 175 | style = getObjectCSSMatrix( matrix ); 176 | 177 | } else { 178 | 179 | style = getObjectCSSMatrix( object.matrixWorld ); 180 | 181 | } 182 | 183 | var element = object.element; 184 | var cachedStyle = cache.objects[ object.id ]; 185 | 186 | if ( cachedStyle === undefined || cachedStyle !== style ) { 187 | 188 | element.style.WebkitTransform = style; 189 | element.style.MozTransform = style; 190 | element.style.oTransform = style; 191 | element.style.transform = style; 192 | 193 | cache.objects[ object.id ] = style; 194 | 195 | } 196 | 197 | if ( element.parentNode !== cameraElement ) { 198 | 199 | cameraElement.appendChild( element ); 200 | 201 | } 202 | 203 | } 204 | 205 | for ( var i = 0, l = object.children.length; i < l; i ++ ) { 206 | 207 | renderObject( object.children[ i ], camera ); 208 | 209 | } 210 | 211 | }; 212 | 213 | this.render = function ( scene, camera ) { 214 | 215 | var fov = 0.5 / Math.tan( THREE.Math.degToRad( camera.fov * 0.5 ) ) * _height; 216 | 217 | if ( cache.camera.fov !== fov ) { 218 | 219 | domElement.style.WebkitPerspective = fov + "px"; 220 | domElement.style.MozPerspective = fov + "px"; 221 | domElement.style.oPerspective = fov + "px"; 222 | domElement.style.perspective = fov + "px"; 223 | 224 | cache.camera.fov = fov; 225 | 226 | } 227 | 228 | scene.updateMatrixWorld(); 229 | 230 | if ( camera.parent === null ) camera.updateMatrixWorld(); 231 | 232 | camera.matrixWorldInverse.getInverse( camera.matrixWorld ); 233 | 234 | var style = "translate3d(0,0," + fov + "px)" + getCameraCSSMatrix( camera.matrixWorldInverse ) + 235 | " translate3d(" + _widthHalf + "px," + _heightHalf + "px, 0)"; 236 | 237 | if ( cache.camera.style !== style ) { 238 | 239 | cameraElement.style.WebkitTransform = style; 240 | cameraElement.style.MozTransform = style; 241 | cameraElement.style.oTransform = style; 242 | cameraElement.style.transform = style; 243 | 244 | cache.camera.style = style; 245 | 246 | } 247 | 248 | renderObject( scene, camera ); 249 | 250 | }; 251 | 252 | }; 253 | -------------------------------------------------------------------------------- /vendor/three-js/FontUtils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author zz85 / http://www.lab4games.net/zz85/blog 3 | * @author alteredq / http://alteredqualia.com/ 4 | * 5 | * For Text operations in three.js (See TextGeometry) 6 | * 7 | * It uses techniques used in: 8 | * 9 | * Triangulation ported from AS3 10 | * Simple Polygon Triangulation 11 | * http://actionsnippet.com/?p=1462 12 | * 13 | * A Method to triangulate shapes with holes 14 | * http://www.sakri.net/blog/2009/06/12/an-approach-to-triangulating-polygons-with-holes/ 15 | * 16 | */ 17 | 18 | THREE.FontUtils = { 19 | 20 | faces: {}, 21 | 22 | // Just for now. face[weight][style] 23 | 24 | face: 'helvetiker', 25 | weight: 'normal', 26 | style: 'normal', 27 | size: 150, 28 | divisions: 10, 29 | 30 | getFace: function () { 31 | 32 | try { 33 | 34 | return this.faces[ this.face.toLowerCase() ][ this.weight ][ this.style ]; 35 | 36 | } catch ( e ) { 37 | 38 | throw "The font " + this.face + " with " + this.weight + " weight and " + this.style + " style is missing." 39 | 40 | } 41 | 42 | }, 43 | 44 | loadFace: function ( data ) { 45 | 46 | var family = data.familyName.toLowerCase(); 47 | 48 | var ThreeFont = this; 49 | 50 | ThreeFont.faces[ family ] = ThreeFont.faces[ family ] || {}; 51 | 52 | ThreeFont.faces[ family ][ data.cssFontWeight ] = ThreeFont.faces[ family ][ data.cssFontWeight ] || {}; 53 | ThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data; 54 | 55 | ThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data; 56 | 57 | return data; 58 | 59 | }, 60 | 61 | drawText: function ( text ) { 62 | 63 | // RenderText 64 | 65 | var i, 66 | face = this.getFace(), 67 | scale = this.size / face.resolution, 68 | offset = 0, 69 | chars = String( text ).split( '' ), 70 | length = chars.length; 71 | 72 | var fontPaths = []; 73 | 74 | for ( i = 0; i < length; i ++ ) { 75 | 76 | var path = new THREE.Path(); 77 | 78 | var ret = this.extractGlyphPoints( chars[ i ], face, scale, offset, path ); 79 | offset += ret.offset; 80 | 81 | fontPaths.push( ret.path ); 82 | 83 | } 84 | 85 | // get the width 86 | 87 | var width = offset / 2; 88 | // 89 | // for ( p = 0; p < allPts.length; p++ ) { 90 | // 91 | // allPts[ p ].x -= width; 92 | // 93 | // } 94 | 95 | //var extract = this.extractPoints( allPts, characterPts ); 96 | //extract.contour = allPts; 97 | 98 | //extract.paths = fontPaths; 99 | //extract.offset = width; 100 | 101 | return { paths: fontPaths, offset: width }; 102 | 103 | }, 104 | 105 | 106 | 107 | 108 | extractGlyphPoints: function ( c, face, scale, offset, path ) { 109 | 110 | var pts = []; 111 | 112 | var b2 = THREE.ShapeUtils.b2; 113 | var b3 = THREE.ShapeUtils.b3; 114 | 115 | var i, i2, divisions, 116 | outline, action, length, 117 | scaleX, scaleY, 118 | x, y, cpx, cpy, cpx0, cpy0, cpx1, cpy1, cpx2, cpy2, 119 | laste, 120 | glyph = face.glyphs[ c ] || face.glyphs[ '?' ]; 121 | 122 | if ( ! glyph ) return; 123 | 124 | if ( glyph.o ) { 125 | 126 | outline = glyph._cachedOutline || ( glyph._cachedOutline = glyph.o.split( ' ' ) ); 127 | length = outline.length; 128 | 129 | scaleX = scale; 130 | scaleY = scale; 131 | 132 | for ( i = 0; i < length; ) { 133 | 134 | action = outline[ i ++ ]; 135 | 136 | //console.log( action ); 137 | 138 | switch ( action ) { 139 | 140 | case 'm': 141 | 142 | // Move To 143 | 144 | x = outline[ i ++ ] * scaleX + offset; 145 | y = outline[ i ++ ] * scaleY; 146 | 147 | path.moveTo( x, y ); 148 | break; 149 | 150 | case 'l': 151 | 152 | // Line To 153 | 154 | x = outline[ i ++ ] * scaleX + offset; 155 | y = outline[ i ++ ] * scaleY; 156 | path.lineTo( x, y ); 157 | break; 158 | 159 | case 'q': 160 | 161 | // QuadraticCurveTo 162 | 163 | cpx = outline[ i ++ ] * scaleX + offset; 164 | cpy = outline[ i ++ ] * scaleY; 165 | cpx1 = outline[ i ++ ] * scaleX + offset; 166 | cpy1 = outline[ i ++ ] * scaleY; 167 | 168 | path.quadraticCurveTo( cpx1, cpy1, cpx, cpy ); 169 | 170 | laste = pts[ pts.length - 1 ]; 171 | 172 | if ( laste ) { 173 | 174 | cpx0 = laste.x; 175 | cpy0 = laste.y; 176 | 177 | for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) { 178 | 179 | var t = i2 / divisions; 180 | b2( t, cpx0, cpx1, cpx ); 181 | b2( t, cpy0, cpy1, cpy ); 182 | 183 | } 184 | 185 | } 186 | 187 | break; 188 | 189 | case 'b': 190 | 191 | // Cubic Bezier Curve 192 | 193 | cpx = outline[ i ++ ] * scaleX + offset; 194 | cpy = outline[ i ++ ] * scaleY; 195 | cpx1 = outline[ i ++ ] * scaleX + offset; 196 | cpy1 = outline[ i ++ ] * scaleY; 197 | cpx2 = outline[ i ++ ] * scaleX + offset; 198 | cpy2 = outline[ i ++ ] * scaleY; 199 | 200 | path.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy ); 201 | 202 | laste = pts[ pts.length - 1 ]; 203 | 204 | if ( laste ) { 205 | 206 | cpx0 = laste.x; 207 | cpy0 = laste.y; 208 | 209 | for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) { 210 | 211 | var t = i2 / divisions; 212 | b3( t, cpx0, cpx1, cpx2, cpx ); 213 | b3( t, cpy0, cpy1, cpy2, cpy ); 214 | 215 | } 216 | 217 | } 218 | 219 | break; 220 | 221 | } 222 | 223 | } 224 | 225 | } 226 | 227 | 228 | 229 | return { offset: glyph.ha * scale, path: path }; 230 | 231 | } 232 | 233 | }; 234 | 235 | 236 | THREE.FontUtils.generateShapes = function ( text, parameters ) { 237 | 238 | // Parameters 239 | 240 | parameters = parameters || {}; 241 | 242 | var size = parameters.size !== undefined ? parameters.size : 100; 243 | var curveSegments = parameters.curveSegments !== undefined ? parameters.curveSegments : 4; 244 | 245 | var font = parameters.font !== undefined ? parameters.font : 'helvetiker'; 246 | var weight = parameters.weight !== undefined ? parameters.weight : 'normal'; 247 | var style = parameters.style !== undefined ? parameters.style : 'normal'; 248 | 249 | THREE.FontUtils.size = size; 250 | THREE.FontUtils.divisions = curveSegments; 251 | 252 | THREE.FontUtils.face = font; 253 | THREE.FontUtils.weight = weight; 254 | THREE.FontUtils.style = style; 255 | 256 | // Get a Font data json object 257 | 258 | var data = THREE.FontUtils.drawText( text ); 259 | 260 | var paths = data.paths; 261 | var shapes = []; 262 | 263 | for ( var p = 0, pl = paths.length; p < pl; p ++ ) { 264 | 265 | Array.prototype.push.apply( shapes, paths[ p ].toShapes() ); 266 | 267 | } 268 | 269 | return shapes; 270 | 271 | }; 272 | 273 | // To use the typeface.js face files, hook up the API 274 | 275 | THREE.typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace }; 276 | if ( typeof self !== 'undefined' ) self._typeface_js = THREE.typeface_js; 277 | -------------------------------------------------------------------------------- /vendor/three-js/RaytracingRenderer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * RaytracingRenderer renders by raytracing it's scene. However, it does not 3 | * compute the pixels itself but it hands off and coordinates the taks for workers. 4 | * The workers compute the pixel values and this renderer simply paints it to the Canvas. 5 | * 6 | * @author zz85 / http://github.com/zz85 7 | */ 8 | 9 | THREE.RaytracingRenderer = function ( parameters ) { 10 | 11 | console.log( 'THREE.RaytracingRenderer', THREE.REVISION ); 12 | 13 | parameters = parameters || {}; 14 | 15 | var scope = this; 16 | var pool = []; 17 | var renderering = false; 18 | 19 | var canvas = document.createElement( 'canvas' ); 20 | var context = canvas.getContext( '2d', { 21 | alpha: parameters.alpha === true 22 | } ); 23 | 24 | var maxRecursionDepth = 3; 25 | 26 | var canvasWidth, canvasHeight; 27 | var canvasWidthHalf, canvasHeightHalf; 28 | 29 | var clearColor = new THREE.Color( 0x000000 ); 30 | 31 | this.domElement = canvas; 32 | 33 | this.autoClear = true; 34 | 35 | var workers = parameters.workers; 36 | var blockSize = parameters.blockSize || 64; 37 | this.randomize = parameters.randomize; 38 | 39 | var toRender = [], workerId = 0, sceneId = 0; 40 | 41 | console.log( '%cSpinning off ' + workers + ' Workers ', 'font-size: 20px; background: black; color: white; font-family: monospace;' ); 42 | 43 | this.setWorkers = function( w ) { 44 | 45 | workers = w || navigator.hardwareConcurrency || 4; 46 | 47 | while ( pool.length < workers ) { 48 | var worker = new Worker( parameters.workerPath ); 49 | worker.id = workerId++; 50 | 51 | worker.onmessage = function( e ) { 52 | 53 | var data = e.data; 54 | 55 | if ( ! data ) return; 56 | 57 | if ( data.blockSize && sceneId == data.sceneId ) { // we match sceneId here to be sure 58 | 59 | var imagedata = new ImageData( new Uint8ClampedArray( data.data ), data.blockSize, data.blockSize ); 60 | context.putImageData( imagedata, data.blockX, data.blockY ); 61 | 62 | // completed 63 | 64 | console.log( 'Worker ' + this.id, data.time / 1000, ( Date.now() - reallyThen ) / 1000 + ' s' ); 65 | 66 | if ( pool.length > workers ) { 67 | 68 | pool.splice( pool.indexOf( this ), 1 ); 69 | return this.terminate(); 70 | 71 | } 72 | 73 | renderNext( this ); 74 | 75 | } 76 | 77 | } 78 | 79 | worker.color = new THREE.Color().setHSL( Math.random() , 0.8, 0.8 ).getHexString(); 80 | pool.push( worker ); 81 | 82 | if ( renderering ) { 83 | 84 | updateSettings( worker ); 85 | 86 | worker.postMessage( { 87 | scene: sceneJSON, 88 | camera: cameraJSON, 89 | annex: materials, 90 | sceneId: sceneId 91 | } ); 92 | 93 | renderNext( worker ); 94 | 95 | } 96 | 97 | } 98 | 99 | if ( ! renderering ) { 100 | 101 | while ( pool.length > workers ) { 102 | 103 | pool.pop().terminate(); 104 | 105 | } 106 | 107 | } 108 | 109 | }; 110 | 111 | this.setWorkers( workers ); 112 | 113 | this.setClearColor = function ( color, alpha ) { 114 | 115 | clearColor.set( color ); 116 | 117 | }; 118 | 119 | this.setPixelRatio = function () {}; 120 | 121 | this.setSize = function ( width, height ) { 122 | 123 | canvas.width = width; 124 | canvas.height = height; 125 | 126 | canvasWidth = canvas.width; 127 | canvasHeight = canvas.height; 128 | 129 | canvasWidthHalf = Math.floor( canvasWidth / 2 ); 130 | canvasHeightHalf = Math.floor( canvasHeight / 2 ); 131 | 132 | context.fillStyle = 'white'; 133 | 134 | pool.forEach( updateSettings ); 135 | 136 | }; 137 | 138 | this.setSize( canvas.width, canvas.height ); 139 | 140 | this.clear = function () { 141 | 142 | }; 143 | 144 | // 145 | 146 | var totalBlocks, xblocks, yblocks; 147 | 148 | function updateSettings( worker ) { 149 | 150 | worker.postMessage( { 151 | 152 | init: [ canvasWidth, canvasHeight ], 153 | worker: worker.id, 154 | // workers: pool.length, 155 | blockSize: blockSize 156 | 157 | } ); 158 | 159 | } 160 | 161 | function renderNext( worker ) { 162 | if ( ! toRender.length ) { 163 | 164 | renderering = false; 165 | return scope.dispatchEvent( { type: "complete" } ); 166 | 167 | } 168 | 169 | var current = toRender.pop(); 170 | 171 | var blockX = ( current % xblocks ) * blockSize; 172 | var blockY = ( current / xblocks | 0 ) * blockSize; 173 | 174 | worker.postMessage( { 175 | render: true, 176 | x: blockX, 177 | y: blockY, 178 | sceneId: sceneId 179 | } ); 180 | 181 | context.fillStyle = '#' + worker.color; 182 | 183 | context.fillRect( blockX, blockY, blockSize, blockSize ); 184 | 185 | } 186 | 187 | var materials = {}; 188 | 189 | var sceneJSON, cameraJSON, reallyThen; 190 | 191 | // additional properties that were not serialize automatically 192 | 193 | var _annex = { 194 | 195 | mirror: 1, 196 | reflectivity: 1, 197 | refractionRatio: 1, 198 | glass: 1, 199 | 200 | }; 201 | 202 | function serializeObject( o ) { 203 | 204 | var mat = o.material; 205 | 206 | if ( ! mat || mat.uuid in materials ) return; 207 | 208 | var props = {}; 209 | for ( var m in _annex ) { 210 | 211 | if ( mat[ m ] !== undefined ) { 212 | 213 | props[ m ] = mat[ m ]; 214 | 215 | } 216 | 217 | } 218 | 219 | materials[ mat.uuid ] = props; 220 | } 221 | 222 | this.render = function ( scene, camera ) { 223 | 224 | renderering = true; 225 | 226 | // update scene graph 227 | 228 | if ( scene.autoUpdate === true ) scene.updateMatrixWorld(); 229 | 230 | // update camera matrices 231 | 232 | if ( camera.parent === null ) camera.updateMatrixWorld(); 233 | 234 | 235 | sceneJSON = scene.toJSON(); 236 | cameraJSON = camera.toJSON(); 237 | ++ sceneId; 238 | 239 | scene.traverse( serializeObject ); 240 | 241 | pool.forEach( function( worker ) { 242 | 243 | worker.postMessage( { 244 | scene: sceneJSON, 245 | camera: cameraJSON, 246 | annex: materials, 247 | sceneId: sceneId 248 | } ); 249 | } ); 250 | 251 | context.clearRect( 0, 0, canvasWidth, canvasHeight ); 252 | reallyThen = Date.now(); 253 | 254 | xblocks = Math.ceil( canvasWidth / blockSize ); 255 | yblocks = Math.ceil( canvasHeight / blockSize ); 256 | totalBlocks = xblocks * yblocks; 257 | 258 | toRender = []; 259 | 260 | for ( var i = 0; i < totalBlocks; i ++ ) { 261 | 262 | toRender.push( i ); 263 | 264 | } 265 | 266 | 267 | // Randomize painting :) 268 | 269 | if ( scope.randomize ) { 270 | 271 | for ( var i = 0; i < totalBlocks; i ++ ) { 272 | 273 | var swap = Math.random() * totalBlocks | 0; 274 | var tmp = toRender[ swap ]; 275 | toRender[ swap ] = toRender[ i ]; 276 | toRender[ i ] = tmp; 277 | 278 | } 279 | 280 | } 281 | 282 | 283 | pool.forEach( renderNext ); 284 | 285 | }; 286 | 287 | }; 288 | 289 | THREE.EventDispatcher.prototype.apply( THREE.RaytracingRenderer.prototype ); 290 | -------------------------------------------------------------------------------- /vendor/three-js/ShaderMaterial.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * parameters = { 5 | * defines: { "label" : "value" }, 6 | * uniforms: { "parameter1": { type: "f", value: 1.0 }, "parameter2": { type: "i" value2: 2 } }, 7 | * 8 | * fragmentShader: , 9 | * vertexShader: , 10 | * 11 | * shading: THREE.SmoothShading, 12 | * blending: THREE.NormalBlending, 13 | * depthTest: , 14 | * depthWrite: , 15 | * 16 | * wireframe: , 17 | * wireframeLinewidth: , 18 | * 19 | * lights: , 20 | * 21 | * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors, 22 | * 23 | * skinning: , 24 | * morphTargets: , 25 | * morphNormals: , 26 | * 27 | * fog: 28 | * } 29 | */ 30 | 31 | THREE.ShaderMaterial = function ( parameters ) { 32 | 33 | THREE.Material.call( this ); 34 | 35 | this.type = 'ShaderMaterial'; 36 | 37 | this.defines = {}; 38 | this.uniforms = {}; 39 | 40 | this.vertexShader = 'void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}'; 41 | this.fragmentShader = 'void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}'; 42 | 43 | this.shading = THREE.SmoothShading; 44 | 45 | this.linewidth = 1; 46 | 47 | this.wireframe = false; 48 | this.wireframeLinewidth = 1; 49 | 50 | this.fog = false; // set to use scene fog 51 | 52 | this.lights = false; // set to use scene lights 53 | 54 | this.vertexColors = THREE.NoColors; // set to use "color" attribute stream 55 | 56 | this.skinning = false; // set to use skinning attribute streams 57 | 58 | this.morphTargets = false; // set to use morph targets 59 | this.morphNormals = false; // set to use morph normals 60 | 61 | this.derivatives = false; // set to use derivatives 62 | 63 | // When rendered geometry doesn't include these attributes but the material does, 64 | // use these default values in WebGL. This avoids errors when buffer data is missing. 65 | this.defaultAttributeValues = { 66 | 'color': [ 1, 1, 1 ], 67 | 'uv': [ 0, 0 ], 68 | 'uv2': [ 0, 0 ] 69 | }; 70 | 71 | this.index0AttributeName = undefined; 72 | 73 | if ( parameters !== undefined ) { 74 | 75 | if ( parameters.attributes !== undefined ) { 76 | 77 | console.error( 'THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.' ); 78 | 79 | } 80 | 81 | this.setValues( parameters ); 82 | 83 | } 84 | 85 | }; 86 | 87 | THREE.ShaderMaterial.prototype = Object.create( THREE.Material.prototype ); 88 | THREE.ShaderMaterial.prototype.constructor = THREE.ShaderMaterial; 89 | 90 | THREE.ShaderMaterial.prototype.copy = function ( source ) { 91 | 92 | THREE.Material.prototype.copy.call( this, source ); 93 | 94 | this.fragmentShader = source.fragmentShader; 95 | this.vertexShader = source.vertexShader; 96 | 97 | this.uniforms = THREE.UniformsUtils.clone( source.uniforms ); 98 | 99 | this.attributes = source.attributes; 100 | this.defines = source.defines; 101 | 102 | this.shading = source.shading; 103 | 104 | this.wireframe = source.wireframe; 105 | this.wireframeLinewidth = source.wireframeLinewidth; 106 | 107 | this.fog = source.fog; 108 | 109 | this.lights = source.lights; 110 | 111 | this.vertexColors = source.vertexColors; 112 | 113 | this.skinning = source.skinning; 114 | 115 | this.morphTargets = source.morphTargets; 116 | this.morphNormals = source.morphNormals; 117 | 118 | this.derivatives = source.derivatives; 119 | 120 | return this; 121 | 122 | }; 123 | 124 | THREE.ShaderMaterial.prototype.toJSON = function ( meta ) { 125 | 126 | var data = THREE.Material.prototype.toJSON.call( this, meta ); 127 | 128 | data.uniforms = this.uniforms; 129 | data.attributes = this.attributes; 130 | data.vertexShader = this.vertexShader; 131 | data.fragmentShader = this.fragmentShader; 132 | 133 | return data; 134 | 135 | }; 136 | -------------------------------------------------------------------------------- /vendor/three-js/TextGeometry.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author zz85 / http://www.lab4games.net/zz85/blog 3 | * @author alteredq / http://alteredqualia.com/ 4 | * 5 | * For creating 3D text geometry in three.js 6 | * 7 | * Text = 3D Text 8 | * 9 | * parameters = { 10 | * size: , // size of the text 11 | * height: , // thickness to extrude text 12 | * curveSegments: , // number of points on the curves 13 | * 14 | * font: , // font name 15 | * weight: , // font weight (normal, bold) 16 | * style: , // font style (normal, italics) 17 | * 18 | * bevelEnabled: , // turn on bevel 19 | * bevelThickness: , // how deep into text bevel goes 20 | * bevelSize: , // how far from text outline is bevel 21 | * } 22 | * 23 | */ 24 | 25 | /* Usage Examples 26 | 27 | // TextGeometry wrapper 28 | 29 | var text3d = new TextGeometry( text, options ); 30 | 31 | // Complete manner 32 | 33 | var textShapes = THREE.FontUtils.generateShapes( text, options ); 34 | var text3d = new ExtrudeGeometry( textShapes, options ); 35 | 36 | */ 37 | 38 | 39 | THREE.TextGeometry = function ( text, parameters ) { 40 | 41 | parameters = parameters || {}; 42 | 43 | var textShapes = THREE.FontUtils.generateShapes( text, parameters ); 44 | 45 | // translate parameters to ExtrudeGeometry API 46 | 47 | parameters.amount = parameters.height !== undefined ? parameters.height : 50; 48 | 49 | // defaults 50 | 51 | if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10; 52 | if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8; 53 | if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false; 54 | 55 | THREE.ExtrudeGeometry.call( this, textShapes, parameters ); 56 | 57 | this.type = 'TextGeometry'; 58 | 59 | }; 60 | 61 | THREE.TextGeometry.prototype = Object.create( THREE.ExtrudeGeometry.prototype ); 62 | THREE.TextGeometry.prototype.constructor = THREE.TextGeometry; 63 | -------------------------------------------------------------------------------- /vendor/three-js/postprocessing/AdaptiveToneMappingPass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author miibond 3 | * Generate a texture that represents the luminosity of the current scene, adapted over time 4 | * to simulate the optic nerve responding to the amount of light it is receiving. 5 | * Based on a GDC2007 presentation by Wolfgang Engel titled "Post-Processing Pipeline" 6 | * 7 | * Full-screen tone-mapping shader based on http://www.graphics.cornell.edu/~jaf/publications/sig02_paper.pdf 8 | */ 9 | 10 | THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) { 11 | 12 | this.resolution = ( resolution !== undefined ) ? resolution : 256; 13 | this.needsInit = true; 14 | this.adaptive = adaptive !== undefined ? !! adaptive : true; 15 | 16 | this.luminanceRT = null; 17 | this.previousLuminanceRT = null; 18 | this.currentLuminanceRT = null; 19 | 20 | if ( THREE.CopyShader === undefined ) 21 | console.error( "THREE.AdaptiveToneMappingPass relies on THREE.CopyShader" ); 22 | 23 | var copyShader = THREE.CopyShader; 24 | 25 | this.copyUniforms = THREE.UniformsUtils.clone( copyShader.uniforms ); 26 | 27 | this.materialCopy = new THREE.ShaderMaterial( { 28 | 29 | uniforms: this.copyUniforms, 30 | vertexShader: copyShader.vertexShader, 31 | fragmentShader: copyShader.fragmentShader, 32 | blending: THREE.NoBlending, 33 | depthTest: false 34 | 35 | } ); 36 | 37 | if ( THREE.LuminosityShader === undefined ) 38 | console.error( "THREE.AdaptiveToneMappingPass relies on THREE.LuminosityShader" ); 39 | 40 | this.materialLuminance = new THREE.ShaderMaterial( { 41 | 42 | uniforms: THREE.UniformsUtils.clone( THREE.LuminosityShader.uniforms ), 43 | vertexShader: THREE.LuminosityShader.vertexShader, 44 | fragmentShader: THREE.LuminosityShader.fragmentShader, 45 | blending: THREE.NoBlending, 46 | } ); 47 | 48 | this.adaptLuminanceShader = { 49 | defines: { 50 | "MIP_LEVEL_1X1" : ( Math.log( this.resolution ) / Math.log( 2.0 ) ).toFixed( 1 ), 51 | }, 52 | uniforms: { 53 | "lastLum": { type: "t", value: null }, 54 | "currentLum": { type: "t", value: null }, 55 | "delta": { type: 'f', value: 0.016 }, 56 | "tau": { type: 'f', value: 1.0 } 57 | }, 58 | vertexShader: [ 59 | "varying vec2 vUv;", 60 | 61 | "void main() {", 62 | 63 | "vUv = uv;", 64 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 65 | 66 | "}" 67 | ].join( '\n' ), 68 | fragmentShader: [ 69 | "varying vec2 vUv;", 70 | 71 | "uniform sampler2D lastLum;", 72 | "uniform sampler2D currentLum;", 73 | "uniform float delta;", 74 | "uniform float tau;", 75 | 76 | "void main() {", 77 | 78 | "vec4 lastLum = texture2D( lastLum, vUv, MIP_LEVEL_1X1 );", 79 | "vec4 currentLum = texture2D( currentLum, vUv, MIP_LEVEL_1X1 );", 80 | 81 | "float fLastLum = lastLum.r;", 82 | "float fCurrentLum = currentLum.r;", 83 | 84 | //The adaption seems to work better in extreme lighting differences 85 | //if the input luminance is squared. 86 | "fCurrentLum *= fCurrentLum;", 87 | 88 | // Adapt the luminance using Pattanaik's technique 89 | "float fAdaptedLum = fLastLum + (fCurrentLum - fLastLum) * (1.0 - exp(-delta * tau));", 90 | // "fAdaptedLum = sqrt(fAdaptedLum);", 91 | "gl_FragColor = vec4( vec3( fAdaptedLum ), 1.0 );", 92 | "}", 93 | ].join( '\n' ) 94 | }; 95 | 96 | this.materialAdaptiveLum = new THREE.ShaderMaterial( { 97 | 98 | uniforms: THREE.UniformsUtils.clone( this.adaptLuminanceShader.uniforms ), 99 | vertexShader: this.adaptLuminanceShader.vertexShader, 100 | fragmentShader: this.adaptLuminanceShader.fragmentShader, 101 | defines: this.adaptLuminanceShader.defines, 102 | blending: THREE.NoBlending 103 | } ); 104 | 105 | if ( THREE.ToneMapShader === undefined ) 106 | console.error( "THREE.AdaptiveToneMappingPass relies on THREE.ToneMapShader" ); 107 | 108 | this.materialToneMap = new THREE.ShaderMaterial( { 109 | 110 | uniforms: THREE.UniformsUtils.clone( THREE.ToneMapShader.uniforms ), 111 | vertexShader: THREE.ToneMapShader.vertexShader, 112 | fragmentShader: THREE.ToneMapShader.fragmentShader, 113 | blending: THREE.NoBlending 114 | } ); 115 | 116 | this.enabled = true; 117 | this.needsSwap = true; 118 | this.clear = false; 119 | 120 | this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); 121 | this.scene = new THREE.Scene(); 122 | 123 | this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null ); 124 | this.scene.add( this.quad ); 125 | 126 | }; 127 | 128 | THREE.AdaptiveToneMappingPass.prototype = { 129 | 130 | render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) { 131 | 132 | if ( this.needsInit ) { 133 | 134 | this.reset( renderer ); 135 | this.luminanceRT.type = readBuffer.type; 136 | this.previousLuminanceRT.type = readBuffer.type; 137 | this.currentLuminanceRT.type = readBuffer.type; 138 | this.needsInit = false; 139 | 140 | } 141 | 142 | if ( this.adaptive ) { 143 | 144 | //Render the luminance of the current scene into a render target with mipmapping enabled 145 | this.quad.material = this.materialLuminance; 146 | this.materialLuminance.uniforms.tDiffuse.value = readBuffer; 147 | renderer.render( this.scene, this.camera, this.currentLuminanceRT ); 148 | 149 | //Use the new luminance values, the previous luminance and the frame delta to 150 | //adapt the luminance over time. 151 | this.quad.material = this.materialAdaptiveLum; 152 | this.materialAdaptiveLum.uniforms.delta.value = delta; 153 | this.materialAdaptiveLum.uniforms.lastLum.value = this.previousLuminanceRT; 154 | this.materialAdaptiveLum.uniforms.currentLum.value = this.currentLuminanceRT; 155 | renderer.render( this.scene, this.camera, this.luminanceRT ); 156 | 157 | //Copy the new adapted luminance value so that it can be used by the next frame. 158 | this.quad.material = this.materialCopy; 159 | this.copyUniforms.tDiffuse.value = this.luminanceRT; 160 | renderer.render( this.scene, this.camera, this.previousLuminanceRT ); 161 | 162 | } 163 | 164 | this.quad.material = this.materialToneMap; 165 | this.materialToneMap.uniforms.tDiffuse.value = readBuffer; 166 | renderer.render( this.scene, this.camera, writeBuffer, this.clear ); 167 | 168 | }, 169 | 170 | reset: function( renderer ) { 171 | 172 | // render targets 173 | if ( this.luminanceRT ) { 174 | 175 | this.luminanceRT.dispose(); 176 | 177 | } 178 | if ( this.currentLuminanceRT ) { 179 | 180 | this.currentLuminanceRT.dispose(); 181 | 182 | } 183 | if ( this.previousLuminanceRT ) { 184 | 185 | this.previousLuminanceRT.dispose(); 186 | 187 | } 188 | var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat }; 189 | 190 | this.luminanceRT = new THREE.WebGLRenderTarget( this.resolution, this.resolution, pars ); 191 | this.luminanceRT.generateMipmaps = false; 192 | this.previousLuminanceRT = new THREE.WebGLRenderTarget( this.resolution, this.resolution, pars ); 193 | this.previousLuminanceRT.generateMipmaps = false; 194 | 195 | //We only need mipmapping for the current luminosity because we want a down-sampled version to sample in our adaptive shader 196 | pars.minFilter = THREE.LinearMipMapLinearFilter; 197 | this.currentLuminanceRT = new THREE.WebGLRenderTarget( this.resolution, this.resolution, pars ); 198 | 199 | if ( this.adaptive ) { 200 | 201 | this.materialToneMap.defines[ "ADAPTED_LUMINANCE" ] = ""; 202 | this.materialToneMap.uniforms.luminanceMap.value = this.luminanceRT; 203 | 204 | } 205 | //Put something in the adaptive luminance texture so that the scene can render initially 206 | this.quad.material = new THREE.MeshBasicMaterial( { color: 0x777777 } ); 207 | this.materialLuminance.needsUpdate = true; 208 | this.materialAdaptiveLum.needsUpdate = true; 209 | this.materialToneMap.needsUpdate = true; 210 | // renderer.render( this.scene, this.camera, this.luminanceRT ); 211 | // renderer.render( this.scene, this.camera, this.previousLuminanceRT ); 212 | // renderer.render( this.scene, this.camera, this.currentLuminanceRT ); 213 | 214 | }, 215 | 216 | setAdaptive: function( adaptive ) { 217 | 218 | if ( adaptive ) { 219 | 220 | this.adaptive = true; 221 | this.materialToneMap.defines[ "ADAPTED_LUMINANCE" ] = ""; 222 | this.materialToneMap.uniforms.luminanceMap.value = this.luminanceRT; 223 | 224 | } else { 225 | 226 | this.adaptive = false; 227 | delete this.materialToneMap.defines[ "ADAPTED_LUMINANCE" ]; 228 | this.materialToneMap.uniforms.luminanceMap.value = undefined; 229 | 230 | } 231 | this.materialToneMap.needsUpdate = true; 232 | 233 | }, 234 | 235 | setAdaptionRate: function( rate ) { 236 | 237 | if ( rate ) { 238 | 239 | this.materialAdaptiveLum.uniforms.tau.value = Math.abs( rate ); 240 | 241 | } 242 | 243 | }, 244 | 245 | setMaxLuminance: function( maxLum ) { 246 | 247 | if ( maxLum ) { 248 | 249 | this.materialToneMap.uniforms.maxLuminance.value = maxLum; 250 | 251 | } 252 | 253 | }, 254 | 255 | setAverageLuminance: function( avgLum ) { 256 | 257 | if ( avgLum ) { 258 | 259 | this.materialToneMap.uniforms.averageLuminance.value = avgLum; 260 | 261 | } 262 | 263 | }, 264 | 265 | setMiddleGrey: function( middleGrey ) { 266 | 267 | if ( middleGrey ) { 268 | 269 | this.materialToneMap.uniforms.middleGrey.value = middleGrey; 270 | 271 | } 272 | 273 | }, 274 | 275 | dispose: function() { 276 | 277 | if ( this.luminanceRT ) { 278 | 279 | this.luminanceRT.dispose(); 280 | 281 | } 282 | if ( this.previousLuminanceRT ) { 283 | 284 | this.previousLuminanceRT.dispose(); 285 | 286 | } 287 | if ( this.currentLuminanceRT ) { 288 | 289 | this.currentLuminanceRT.dispose(); 290 | 291 | } 292 | if ( this.materialLuminance ) { 293 | 294 | this.materialLuminance.dispose(); 295 | 296 | } 297 | if ( this.materialAdaptiveLum ) { 298 | 299 | this.materialAdaptiveLum.dispose(); 300 | 301 | } 302 | if ( this.materialCopy ) { 303 | 304 | this.materialCopy.dispose(); 305 | 306 | } 307 | if ( this.materialToneMap ) { 308 | 309 | this.materialToneMap.dispose(); 310 | 311 | } 312 | 313 | } 314 | 315 | }; 316 | -------------------------------------------------------------------------------- /vendor/three-js/postprocessing/BloomPass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) { 6 | 7 | strength = ( strength !== undefined ) ? strength : 1; 8 | kernelSize = ( kernelSize !== undefined ) ? kernelSize : 25; 9 | sigma = ( sigma !== undefined ) ? sigma : 4.0; 10 | resolution = ( resolution !== undefined ) ? resolution : 256; 11 | 12 | // render targets 13 | 14 | var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat }; 15 | 16 | this.renderTargetX = new THREE.WebGLRenderTarget( resolution, resolution, pars ); 17 | this.renderTargetY = new THREE.WebGLRenderTarget( resolution, resolution, pars ); 18 | 19 | // copy material 20 | 21 | if ( THREE.CopyShader === undefined ) 22 | console.error( "THREE.BloomPass relies on THREE.CopyShader" ); 23 | 24 | var copyShader = THREE.CopyShader; 25 | 26 | this.copyUniforms = THREE.UniformsUtils.clone( copyShader.uniforms ); 27 | 28 | this.copyUniforms[ "opacity" ].value = strength; 29 | 30 | this.materialCopy = new THREE.ShaderMaterial( { 31 | 32 | uniforms: this.copyUniforms, 33 | vertexShader: copyShader.vertexShader, 34 | fragmentShader: copyShader.fragmentShader, 35 | blending: THREE.AdditiveBlending, 36 | transparent: true 37 | 38 | } ); 39 | 40 | // convolution material 41 | 42 | if ( THREE.ConvolutionShader === undefined ) 43 | console.error( "THREE.BloomPass relies on THREE.ConvolutionShader" ); 44 | 45 | var convolutionShader = THREE.ConvolutionShader; 46 | 47 | this.convolutionUniforms = THREE.UniformsUtils.clone( convolutionShader.uniforms ); 48 | 49 | this.convolutionUniforms[ "uImageIncrement" ].value = THREE.BloomPass.blurX; 50 | this.convolutionUniforms[ "cKernel" ].value = THREE.ConvolutionShader.buildKernel( sigma ); 51 | 52 | this.materialConvolution = new THREE.ShaderMaterial( { 53 | 54 | uniforms: this.convolutionUniforms, 55 | vertexShader: convolutionShader.vertexShader, 56 | fragmentShader: convolutionShader.fragmentShader, 57 | defines: { 58 | "KERNEL_SIZE_FLOAT": kernelSize.toFixed( 1 ), 59 | "KERNEL_SIZE_INT": kernelSize.toFixed( 0 ) 60 | } 61 | 62 | } ); 63 | 64 | this.enabled = true; 65 | this.needsSwap = false; 66 | this.clear = false; 67 | 68 | 69 | this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); 70 | this.scene = new THREE.Scene(); 71 | 72 | this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null ); 73 | this.scene.add( this.quad ); 74 | 75 | }; 76 | 77 | THREE.BloomPass.prototype = { 78 | 79 | render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) { 80 | 81 | if ( maskActive ) renderer.context.disable( renderer.context.STENCIL_TEST ); 82 | 83 | // Render quad with blured scene into texture (convolution pass 1) 84 | 85 | this.quad.material = this.materialConvolution; 86 | 87 | this.convolutionUniforms[ "tDiffuse" ].value = readBuffer; 88 | this.convolutionUniforms[ "uImageIncrement" ].value = THREE.BloomPass.blurX; 89 | 90 | renderer.render( this.scene, this.camera, this.renderTargetX, true ); 91 | 92 | 93 | // Render quad with blured scene into texture (convolution pass 2) 94 | 95 | this.convolutionUniforms[ "tDiffuse" ].value = this.renderTargetX; 96 | this.convolutionUniforms[ "uImageIncrement" ].value = THREE.BloomPass.blurY; 97 | 98 | renderer.render( this.scene, this.camera, this.renderTargetY, true ); 99 | 100 | // Render original scene with superimposed blur to texture 101 | 102 | this.quad.material = this.materialCopy; 103 | 104 | this.copyUniforms[ "tDiffuse" ].value = this.renderTargetY; 105 | 106 | if ( maskActive ) renderer.context.enable( renderer.context.STENCIL_TEST ); 107 | 108 | renderer.render( this.scene, this.camera, readBuffer, this.clear ); 109 | 110 | } 111 | 112 | }; 113 | 114 | THREE.BloomPass.blurX = new THREE.Vector2( 0.001953125, 0.0 ); 115 | THREE.BloomPass.blurY = new THREE.Vector2( 0.0, 0.001953125 ); 116 | -------------------------------------------------------------------------------- /vendor/three-js/postprocessing/BokehPass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Depth-of-field post-process with bokeh shader 3 | */ 4 | 5 | 6 | THREE.BokehPass = function ( scene, camera, params ) { 7 | 8 | this.scene = scene; 9 | this.camera = camera; 10 | 11 | var focus = ( params.focus !== undefined ) ? params.focus : 1.0; 12 | var aspect = ( params.aspect !== undefined ) ? params.aspect : camera.aspect; 13 | var aperture = ( params.aperture !== undefined ) ? params.aperture : 0.025; 14 | var maxblur = ( params.maxblur !== undefined ) ? params.maxblur : 1.0; 15 | 16 | // render targets 17 | 18 | var width = params.width || window.innerWidth || 1; 19 | var height = params.height || window.innerHeight || 1; 20 | 21 | this.renderTargetColor = new THREE.WebGLRenderTarget( width, height, { 22 | minFilter: THREE.LinearFilter, 23 | magFilter: THREE.LinearFilter, 24 | format: THREE.RGBFormat 25 | } ); 26 | 27 | this.renderTargetDepth = this.renderTargetColor.clone(); 28 | 29 | // depth material 30 | 31 | this.materialDepth = new THREE.MeshDepthMaterial(); 32 | 33 | // bokeh material 34 | 35 | if ( THREE.BokehShader === undefined ) { 36 | 37 | console.error( "THREE.BokehPass relies on THREE.BokehShader" ); 38 | 39 | } 40 | 41 | var bokehShader = THREE.BokehShader; 42 | var bokehUniforms = THREE.UniformsUtils.clone( bokehShader.uniforms ); 43 | 44 | bokehUniforms[ "tDepth" ].value = this.renderTargetDepth; 45 | 46 | bokehUniforms[ "focus" ].value = focus; 47 | bokehUniforms[ "aspect" ].value = aspect; 48 | bokehUniforms[ "aperture" ].value = aperture; 49 | bokehUniforms[ "maxblur" ].value = maxblur; 50 | 51 | this.materialBokeh = new THREE.ShaderMaterial( { 52 | uniforms: bokehUniforms, 53 | vertexShader: bokehShader.vertexShader, 54 | fragmentShader: bokehShader.fragmentShader 55 | } ); 56 | 57 | this.uniforms = bokehUniforms; 58 | this.enabled = true; 59 | this.needsSwap = false; 60 | this.renderToScreen = false; 61 | this.clear = false; 62 | 63 | this.camera2 = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); 64 | this.scene2 = new THREE.Scene(); 65 | 66 | this.quad2 = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null ); 67 | this.scene2.add( this.quad2 ); 68 | 69 | }; 70 | 71 | THREE.BokehPass.prototype = { 72 | 73 | render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) { 74 | 75 | this.quad2.material = this.materialBokeh; 76 | 77 | // Render depth into texture 78 | 79 | this.scene.overrideMaterial = this.materialDepth; 80 | 81 | renderer.render( this.scene, this.camera, this.renderTargetDepth, true ); 82 | 83 | // Render bokeh composite 84 | 85 | this.uniforms[ "tColor" ].value = readBuffer; 86 | 87 | if ( this.renderToScreen ) { 88 | 89 | renderer.render( this.scene2, this.camera2 ); 90 | 91 | } else { 92 | 93 | renderer.render( this.scene2, this.camera2, writeBuffer, this.clear ); 94 | 95 | } 96 | 97 | this.scene.overrideMaterial = null; 98 | 99 | } 100 | 101 | }; 102 | 103 | -------------------------------------------------------------------------------- /vendor/three-js/postprocessing/EffectComposer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.EffectComposer = function ( renderer, renderTarget ) { 6 | 7 | this.renderer = renderer; 8 | 9 | if ( renderTarget === undefined ) { 10 | 11 | var pixelRatio = renderer.getPixelRatio(); 12 | 13 | var width = Math.floor( renderer.context.canvas.width / pixelRatio ) || 1; 14 | var height = Math.floor( renderer.context.canvas.height / pixelRatio ) || 1; 15 | var parameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat, stencilBuffer: false }; 16 | 17 | renderTarget = new THREE.WebGLRenderTarget( width, height, parameters ); 18 | 19 | } 20 | 21 | this.renderTarget1 = renderTarget; 22 | this.renderTarget2 = renderTarget.clone(); 23 | 24 | this.writeBuffer = this.renderTarget1; 25 | this.readBuffer = this.renderTarget2; 26 | 27 | this.passes = []; 28 | 29 | if ( THREE.CopyShader === undefined ) 30 | console.error( "THREE.EffectComposer relies on THREE.CopyShader" ); 31 | 32 | this.copyPass = new THREE.ShaderPass( THREE.CopyShader ); 33 | 34 | }; 35 | 36 | THREE.EffectComposer.prototype = { 37 | 38 | swapBuffers: function() { 39 | 40 | var tmp = this.readBuffer; 41 | this.readBuffer = this.writeBuffer; 42 | this.writeBuffer = tmp; 43 | 44 | }, 45 | 46 | addPass: function ( pass ) { 47 | 48 | this.passes.push( pass ); 49 | 50 | }, 51 | 52 | insertPass: function ( pass, index ) { 53 | 54 | this.passes.splice( index, 0, pass ); 55 | 56 | }, 57 | 58 | render: function ( delta ) { 59 | 60 | this.writeBuffer = this.renderTarget1; 61 | this.readBuffer = this.renderTarget2; 62 | 63 | var maskActive = false; 64 | 65 | var pass, i, il = this.passes.length; 66 | 67 | for ( i = 0; i < il; i ++ ) { 68 | 69 | pass = this.passes[ i ]; 70 | 71 | if ( ! pass.enabled ) continue; 72 | 73 | pass.render( this.renderer, this.writeBuffer, this.readBuffer, delta, maskActive ); 74 | 75 | if ( pass.needsSwap ) { 76 | 77 | if ( maskActive ) { 78 | 79 | var context = this.renderer.context; 80 | 81 | context.stencilFunc( context.NOTEQUAL, 1, 0xffffffff ); 82 | 83 | this.copyPass.render( this.renderer, this.writeBuffer, this.readBuffer, delta ); 84 | 85 | context.stencilFunc( context.EQUAL, 1, 0xffffffff ); 86 | 87 | } 88 | 89 | this.swapBuffers(); 90 | 91 | } 92 | 93 | if ( pass instanceof THREE.MaskPass ) { 94 | 95 | maskActive = true; 96 | 97 | } else if ( pass instanceof THREE.ClearMaskPass ) { 98 | 99 | maskActive = false; 100 | 101 | } 102 | 103 | } 104 | 105 | }, 106 | 107 | reset: function ( renderTarget ) { 108 | 109 | if ( renderTarget === undefined ) { 110 | 111 | renderTarget = this.renderTarget1.clone(); 112 | 113 | var pixelRatio = this.renderer.getPixelRatio(); 114 | 115 | renderTarget.width = Math.floor( this.renderer.context.canvas.width / pixelRatio ); 116 | renderTarget.height = Math.floor( this.renderer.context.canvas.height / pixelRatio ); 117 | 118 | } 119 | 120 | this.renderTarget1.dispose(); 121 | this.renderTarget1 = renderTarget; 122 | this.renderTarget2.dispose(); 123 | this.renderTarget2 = renderTarget.clone(); 124 | 125 | this.writeBuffer = this.renderTarget1; 126 | this.readBuffer = this.renderTarget2; 127 | 128 | }, 129 | 130 | setSize: function ( width, height ) { 131 | 132 | this.renderTarget1.setSize( width, height ); 133 | this.renderTarget2.setSize( width, height ); 134 | 135 | } 136 | 137 | }; 138 | -------------------------------------------------------------------------------- /vendor/three-js/postprocessing/MaskPass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.MaskPass = function ( scene, camera ) { 6 | 7 | this.scene = scene; 8 | this.camera = camera; 9 | 10 | this.enabled = true; 11 | this.clear = true; 12 | this.needsSwap = false; 13 | 14 | this.inverse = false; 15 | 16 | }; 17 | 18 | THREE.MaskPass.prototype = { 19 | 20 | render: function ( renderer, writeBuffer, readBuffer, delta ) { 21 | 22 | var context = renderer.context; 23 | 24 | // don't update color or depth 25 | 26 | context.colorMask( false, false, false, false ); 27 | context.depthMask( false ); 28 | 29 | // set up stencil 30 | 31 | var writeValue, clearValue; 32 | 33 | if ( this.inverse ) { 34 | 35 | writeValue = 0; 36 | clearValue = 1; 37 | 38 | } else { 39 | 40 | writeValue = 1; 41 | clearValue = 0; 42 | 43 | } 44 | 45 | context.enable( context.STENCIL_TEST ); 46 | context.stencilOp( context.REPLACE, context.REPLACE, context.REPLACE ); 47 | context.stencilFunc( context.ALWAYS, writeValue, 0xffffffff ); 48 | context.clearStencil( clearValue ); 49 | 50 | // draw into the stencil buffer 51 | 52 | renderer.render( this.scene, this.camera, readBuffer, this.clear ); 53 | renderer.render( this.scene, this.camera, writeBuffer, this.clear ); 54 | 55 | // re-enable update of color and depth 56 | 57 | context.colorMask( true, true, true, true ); 58 | context.depthMask( true ); 59 | 60 | // only render where stencil is set to 1 61 | 62 | context.stencilFunc( context.EQUAL, 1, 0xffffffff ); // draw if == 1 63 | context.stencilOp( context.KEEP, context.KEEP, context.KEEP ); 64 | 65 | } 66 | 67 | }; 68 | 69 | 70 | THREE.ClearMaskPass = function () { 71 | 72 | this.enabled = true; 73 | 74 | }; 75 | 76 | THREE.ClearMaskPass.prototype = { 77 | 78 | render: function ( renderer, writeBuffer, readBuffer, delta ) { 79 | 80 | var context = renderer.context; 81 | 82 | context.disable( context.STENCIL_TEST ); 83 | 84 | } 85 | 86 | }; 87 | -------------------------------------------------------------------------------- /vendor/three-js/postprocessing/RenderPass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clearAlpha ) { 6 | 7 | this.scene = scene; 8 | this.camera = camera; 9 | 10 | this.overrideMaterial = overrideMaterial; 11 | 12 | this.clearColor = clearColor; 13 | this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 1; 14 | 15 | this.oldClearColor = new THREE.Color(); 16 | this.oldClearAlpha = 1; 17 | 18 | this.enabled = true; 19 | this.clear = true; 20 | this.needsSwap = false; 21 | 22 | }; 23 | 24 | THREE.RenderPass.prototype = { 25 | 26 | render: function ( renderer, writeBuffer, readBuffer, delta ) { 27 | 28 | this.scene.overrideMaterial = this.overrideMaterial; 29 | 30 | if ( this.clearColor ) { 31 | 32 | this.oldClearColor.copy( renderer.getClearColor() ); 33 | this.oldClearAlpha = renderer.getClearAlpha(); 34 | 35 | renderer.setClearColor( this.clearColor, this.clearAlpha ); 36 | 37 | } 38 | 39 | renderer.render( this.scene, this.camera, readBuffer, this.clear ); 40 | 41 | if ( this.clearColor ) { 42 | 43 | renderer.setClearColor( this.oldClearColor, this.oldClearAlpha ); 44 | 45 | } 46 | 47 | this.scene.overrideMaterial = null; 48 | 49 | } 50 | 51 | }; 52 | -------------------------------------------------------------------------------- /vendor/three-js/postprocessing/ShaderPass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.ShaderPass = function ( shader, textureID ) { 6 | 7 | this.textureID = ( textureID !== undefined ) ? textureID : "tDiffuse"; 8 | 9 | this.uniforms = THREE.UniformsUtils.clone( shader.uniforms ); 10 | 11 | this.material = new THREE.ShaderMaterial( { 12 | 13 | defines: shader.defines || {}, 14 | uniforms: this.uniforms, 15 | vertexShader: shader.vertexShader, 16 | fragmentShader: shader.fragmentShader 17 | 18 | } ); 19 | 20 | this.renderToScreen = false; 21 | 22 | this.enabled = true; 23 | this.needsSwap = true; 24 | this.clear = false; 25 | 26 | 27 | this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); 28 | this.scene = new THREE.Scene(); 29 | 30 | this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null ); 31 | this.scene.add( this.quad ); 32 | 33 | }; 34 | 35 | THREE.ShaderPass.prototype = { 36 | 37 | render: function ( renderer, writeBuffer, readBuffer, delta ) { 38 | 39 | if ( this.uniforms[ this.textureID ] ) { 40 | 41 | this.uniforms[ this.textureID ].value = readBuffer; 42 | 43 | } 44 | 45 | this.quad.material = this.material; 46 | 47 | if ( this.renderToScreen ) { 48 | 49 | renderer.render( this.scene, this.camera ); 50 | 51 | } else { 52 | 53 | renderer.render( this.scene, this.camera, writeBuffer, this.clear ); 54 | 55 | } 56 | 57 | } 58 | 59 | }; 60 | -------------------------------------------------------------------------------- /vendor/three-js/shaders/BokehShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Depth-of-field shader with bokeh 5 | * ported from GLSL shader by Martins Upitis 6 | * http://artmartinsh.blogspot.com/2010/02/glsl-lens-blur-filter-with-bokeh.html 7 | */ 8 | 9 | THREE.BokehShader = { 10 | 11 | uniforms: { 12 | 13 | "tColor": { type: "t", value: null }, 14 | "tDepth": { type: "t", value: null }, 15 | "focus": { type: "f", value: 1.0 }, 16 | "aspect": { type: "f", value: 1.0 }, 17 | "aperture": { type: "f", value: 0.025 }, 18 | "maxblur": { type: "f", value: 1.0 } 19 | 20 | }, 21 | 22 | vertexShader: [ 23 | 24 | "varying vec2 vUv;", 25 | 26 | "void main() {", 27 | 28 | "vUv = uv;", 29 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 30 | 31 | "}" 32 | 33 | ].join( "\n" ), 34 | 35 | fragmentShader: [ 36 | 37 | "varying vec2 vUv;", 38 | 39 | "uniform sampler2D tColor;", 40 | "uniform sampler2D tDepth;", 41 | 42 | "uniform float maxblur;", // max blur amount 43 | "uniform float aperture;", // aperture - bigger values for shallower depth of field 44 | 45 | "uniform float focus;", 46 | "uniform float aspect;", 47 | 48 | "void main() {", 49 | 50 | "vec2 aspectcorrect = vec2( 1.0, aspect );", 51 | 52 | "vec4 depth1 = texture2D( tDepth, vUv );", 53 | 54 | "float factor = depth1.x - focus;", 55 | 56 | "vec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );", 57 | 58 | "vec2 dofblur9 = dofblur * 0.9;", 59 | "vec2 dofblur7 = dofblur * 0.7;", 60 | "vec2 dofblur4 = dofblur * 0.4;", 61 | 62 | "vec4 col = vec4( 0.0 );", 63 | 64 | "col += texture2D( tColor, vUv.xy );", 65 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );", 66 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );", 67 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );", 68 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );", 69 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );", 70 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );", 71 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );", 72 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );", 73 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );", 74 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );", 75 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );", 76 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );", 77 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );", 78 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );", 79 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );", 80 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );", 81 | 82 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );", 83 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );", 84 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );", 85 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );", 86 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );", 87 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );", 88 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );", 89 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );", 90 | 91 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );", 92 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );", 93 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );", 94 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );", 95 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );", 96 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );", 97 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );", 98 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );", 99 | 100 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );", 101 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );", 102 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );", 103 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );", 104 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );", 105 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );", 106 | "col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );", 107 | "col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );", 108 | 109 | "gl_FragColor = col / 41.0;", 110 | "gl_FragColor.a = 1.0;", 111 | 112 | "}" 113 | 114 | ].join( "\n" ) 115 | 116 | }; 117 | -------------------------------------------------------------------------------- /vendor/three-js/shaders/ConvolutionShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Convolution shader 5 | * ported from o3d sample to WebGL / GLSL 6 | * http://o3d.googlecode.com/svn/trunk/samples/convolution.html 7 | */ 8 | 9 | THREE.ConvolutionShader = { 10 | 11 | defines: { 12 | 13 | "KERNEL_SIZE_FLOAT": "25.0", 14 | "KERNEL_SIZE_INT": "25", 15 | 16 | }, 17 | 18 | uniforms: { 19 | 20 | "tDiffuse": { type: "t", value: null }, 21 | "uImageIncrement": { type: "v2", value: new THREE.Vector2( 0.001953125, 0.0 ) }, 22 | "cKernel": { type: "fv1", value: [] } 23 | 24 | }, 25 | 26 | vertexShader: [ 27 | 28 | "uniform vec2 uImageIncrement;", 29 | 30 | "varying vec2 vUv;", 31 | 32 | "void main() {", 33 | 34 | "vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;", 35 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 36 | 37 | "}" 38 | 39 | ].join( "\n" ), 40 | 41 | fragmentShader: [ 42 | 43 | "uniform float cKernel[ KERNEL_SIZE_INT ];", 44 | 45 | "uniform sampler2D tDiffuse;", 46 | "uniform vec2 uImageIncrement;", 47 | 48 | "varying vec2 vUv;", 49 | 50 | "void main() {", 51 | 52 | "vec2 imageCoord = vUv;", 53 | "vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );", 54 | 55 | "for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {", 56 | 57 | "sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];", 58 | "imageCoord += uImageIncrement;", 59 | 60 | "}", 61 | 62 | "gl_FragColor = sum;", 63 | 64 | "}" 65 | 66 | 67 | ].join( "\n" ), 68 | 69 | buildKernel: function ( sigma ) { 70 | 71 | // We lop off the sqrt(2 * pi) * sigma term, since we're going to normalize anyway. 72 | 73 | function gauss( x, sigma ) { 74 | 75 | return Math.exp( - ( x * x ) / ( 2.0 * sigma * sigma ) ); 76 | 77 | } 78 | 79 | var i, values, sum, halfWidth, kMaxKernelSize = 25, kernelSize = 2 * Math.ceil( sigma * 3.0 ) + 1; 80 | 81 | if ( kernelSize > kMaxKernelSize ) kernelSize = kMaxKernelSize; 82 | halfWidth = ( kernelSize - 1 ) * 0.5; 83 | 84 | values = new Array( kernelSize ); 85 | sum = 0.0; 86 | for ( i = 0; i < kernelSize; ++ i ) { 87 | 88 | values[ i ] = gauss( i - halfWidth, sigma ); 89 | sum += values[ i ]; 90 | 91 | } 92 | 93 | // normalize the kernel 94 | 95 | for ( i = 0; i < kernelSize; ++ i ) values[ i ] /= sum; 96 | 97 | return values; 98 | 99 | } 100 | 101 | }; 102 | -------------------------------------------------------------------------------- /vendor/three-js/shaders/CopyShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Full-screen textured quad shader 5 | */ 6 | 7 | THREE.CopyShader = { 8 | 9 | uniforms: { 10 | 11 | "tDiffuse": { type: "t", value: null }, 12 | "opacity": { type: "f", value: 1.0 } 13 | 14 | }, 15 | 16 | vertexShader: [ 17 | 18 | "varying vec2 vUv;", 19 | 20 | "void main() {", 21 | 22 | "vUv = uv;", 23 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 24 | 25 | "}" 26 | 27 | ].join( "\n" ), 28 | 29 | fragmentShader: [ 30 | 31 | "uniform float opacity;", 32 | 33 | "uniform sampler2D tDiffuse;", 34 | 35 | "varying vec2 vUv;", 36 | 37 | "void main() {", 38 | 39 | "vec4 texel = texture2D( tDiffuse, vUv );", 40 | "gl_FragColor = opacity * texel;", 41 | 42 | "}" 43 | 44 | ].join( "\n" ) 45 | 46 | }; 47 | -------------------------------------------------------------------------------- /vendor/tween-js/Tween.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tween.js - Licensed under the MIT license 3 | * https://github.com/tweenjs/tween.js 4 | * ---------------------------------------------- 5 | * 6 | * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors. 7 | * Thank you all, you're awesome! 8 | */ 9 | 10 | // Include a performance.now polyfill 11 | (function () { 12 | 13 | if ('performance' in window === false) { 14 | window.performance = {}; 15 | } 16 | 17 | // IE 8 18 | Date.now = (Date.now || function () { 19 | return new Date().getTime(); 20 | }); 21 | 22 | if ('now' in window.performance === false) { 23 | var offset = window.performance.timing && window.performance.timing.navigationStart ? window.performance.timing.navigationStart 24 | : Date.now(); 25 | 26 | window.performance.now = function () { 27 | return Date.now() - offset; 28 | }; 29 | } 30 | 31 | })(); 32 | 33 | var TWEEN = TWEEN || (function () { 34 | 35 | var _tweens = []; 36 | 37 | return { 38 | 39 | getAll: function () { 40 | 41 | return _tweens; 42 | 43 | }, 44 | 45 | removeAll: function () { 46 | 47 | _tweens = []; 48 | 49 | }, 50 | 51 | add: function (tween) { 52 | 53 | _tweens.push(tween); 54 | 55 | }, 56 | 57 | remove: function (tween) { 58 | 59 | var i = _tweens.indexOf(tween); 60 | 61 | if (i !== -1) { 62 | _tweens.splice(i, 1); 63 | } 64 | 65 | }, 66 | 67 | update: function (time) { 68 | 69 | if (_tweens.length === 0) { 70 | return false; 71 | } 72 | 73 | var i = 0; 74 | 75 | time = time !== undefined ? time : window.performance.now(); 76 | 77 | while (i < _tweens.length) { 78 | 79 | if (_tweens[i].update(time)) { 80 | i++; 81 | } else { 82 | _tweens.splice(i, 1); 83 | } 84 | 85 | } 86 | 87 | return true; 88 | 89 | } 90 | }; 91 | 92 | })(); 93 | 94 | TWEEN.Tween = function (object) { 95 | 96 | var _object = object; 97 | var _valuesStart = {}; 98 | var _valuesEnd = {}; 99 | var _valuesStartRepeat = {}; 100 | var _duration = 1000; 101 | var _repeat = 0; 102 | var _yoyo = false; 103 | var _isPlaying = false; 104 | var _reversed = false; 105 | var _delayTime = 0; 106 | var _startTime = null; 107 | var _easingFunction = TWEEN.Easing.Linear.None; 108 | var _interpolationFunction = TWEEN.Interpolation.Linear; 109 | var _chainedTweens = []; 110 | var _onStartCallback = null; 111 | var _onStartCallbackFired = false; 112 | var _onUpdateCallback = null; 113 | var _onCompleteCallback = null; 114 | var _onStopCallback = null; 115 | 116 | // Set all starting values present on the target object 117 | for (var field in object) { 118 | _valuesStart[field] = parseFloat(object[field], 10); 119 | } 120 | 121 | this.to = function (properties, duration) { 122 | 123 | if (duration !== undefined) { 124 | _duration = duration; 125 | } 126 | 127 | _valuesEnd = properties; 128 | 129 | return this; 130 | 131 | }; 132 | 133 | this.start = function (time) { 134 | 135 | TWEEN.add(this); 136 | 137 | _isPlaying = true; 138 | 139 | _onStartCallbackFired = false; 140 | 141 | _startTime = time !== undefined ? time : window.performance.now(); 142 | _startTime += _delayTime; 143 | 144 | for (var property in _valuesEnd) { 145 | 146 | // Check if an Array was provided as property value 147 | if (_valuesEnd[property] instanceof Array) { 148 | 149 | if (_valuesEnd[property].length === 0) { 150 | continue; 151 | } 152 | 153 | // Create a local copy of the Array with the start value at the front 154 | _valuesEnd[property] = [_object[property]].concat(_valuesEnd[property]); 155 | 156 | } 157 | 158 | _valuesStart[property] = _object[property]; 159 | 160 | if ((_valuesStart[property] instanceof Array) === false) { 161 | _valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings 162 | } 163 | 164 | _valuesStartRepeat[property] = _valuesStart[property] || 0; 165 | 166 | } 167 | 168 | return this; 169 | 170 | }; 171 | 172 | this.stop = function () { 173 | 174 | if (!_isPlaying) { 175 | return this; 176 | } 177 | 178 | TWEEN.remove(this); 179 | _isPlaying = false; 180 | 181 | if (_onStopCallback !== null) { 182 | _onStopCallback.call(_object); 183 | } 184 | 185 | this.stopChainedTweens(); 186 | return this; 187 | 188 | }; 189 | 190 | this.stopChainedTweens = function () { 191 | 192 | for (var i = 0, numChainedTweens = _chainedTweens.length; i < numChainedTweens; i++) { 193 | _chainedTweens[i].stop(); 194 | } 195 | 196 | }; 197 | 198 | this.delay = function (amount) { 199 | 200 | _delayTime = amount; 201 | return this; 202 | 203 | }; 204 | 205 | this.repeat = function (times) { 206 | 207 | _repeat = times; 208 | return this; 209 | 210 | }; 211 | 212 | this.yoyo = function (yoyo) { 213 | 214 | _yoyo = yoyo; 215 | return this; 216 | 217 | }; 218 | 219 | 220 | this.easing = function (easing) { 221 | 222 | _easingFunction = easing; 223 | return this; 224 | 225 | }; 226 | 227 | this.interpolation = function (interpolation) { 228 | 229 | _interpolationFunction = interpolation; 230 | return this; 231 | 232 | }; 233 | 234 | this.chain = function () { 235 | 236 | _chainedTweens = arguments; 237 | return this; 238 | 239 | }; 240 | 241 | this.onStart = function (callback) { 242 | 243 | _onStartCallback = callback; 244 | return this; 245 | 246 | }; 247 | 248 | this.onUpdate = function (callback) { 249 | 250 | _onUpdateCallback = callback; 251 | return this; 252 | 253 | }; 254 | 255 | this.onComplete = function (callback) { 256 | 257 | _onCompleteCallback = callback; 258 | return this; 259 | 260 | }; 261 | 262 | this.onStop = function (callback) { 263 | 264 | _onStopCallback = callback; 265 | return this; 266 | 267 | }; 268 | 269 | this.update = function (time) { 270 | 271 | var property; 272 | var elapsed; 273 | var value; 274 | 275 | if (time < _startTime) { 276 | return true; 277 | } 278 | 279 | if (_onStartCallbackFired === false) { 280 | 281 | if (_onStartCallback !== null) { 282 | _onStartCallback.call(_object); 283 | } 284 | 285 | _onStartCallbackFired = true; 286 | 287 | } 288 | 289 | elapsed = (time - _startTime) / _duration; 290 | elapsed = elapsed > 1 ? 1 : elapsed; 291 | 292 | value = _easingFunction(elapsed); 293 | 294 | for (property in _valuesEnd) { 295 | 296 | var start = _valuesStart[property] || 0; 297 | var end = _valuesEnd[property]; 298 | 299 | if (end instanceof Array) { 300 | 301 | _object[property] = _interpolationFunction(end, value); 302 | 303 | } else { 304 | 305 | // Parses relative end values with start as base (e.g.: +10, -3) 306 | if (typeof (end) === 'string') { 307 | end = start + parseFloat(end, 10); 308 | } 309 | 310 | // Protect against non numeric properties. 311 | if (typeof (end) === 'number') { 312 | _object[property] = start + (end - start) * value; 313 | } 314 | 315 | } 316 | 317 | } 318 | 319 | if (_onUpdateCallback !== null) { 320 | _onUpdateCallback.call(_object, value); 321 | } 322 | 323 | if (elapsed === 1) { 324 | 325 | if (_repeat > 0) { 326 | 327 | if (isFinite(_repeat)) { 328 | _repeat--; 329 | } 330 | 331 | // Reassign starting values, restart by making startTime = now 332 | for (property in _valuesStartRepeat) { 333 | 334 | if (typeof (_valuesEnd[property]) === 'string') { 335 | _valuesStartRepeat[property] = _valuesStartRepeat[property] + parseFloat(_valuesEnd[property], 10); 336 | } 337 | 338 | if (_yoyo) { 339 | var tmp = _valuesStartRepeat[property]; 340 | 341 | _valuesStartRepeat[property] = _valuesEnd[property]; 342 | _valuesEnd[property] = tmp; 343 | } 344 | 345 | _valuesStart[property] = _valuesStartRepeat[property]; 346 | 347 | } 348 | 349 | if (_yoyo) { 350 | _reversed = !_reversed; 351 | } 352 | 353 | _startTime = time + _delayTime; 354 | 355 | return true; 356 | 357 | } else { 358 | 359 | if (_onCompleteCallback !== null) { 360 | _onCompleteCallback.call(_object); 361 | } 362 | 363 | for (var i = 0, numChainedTweens = _chainedTweens.length; i < numChainedTweens; i++) { 364 | // Make the chained tweens start exactly at the time they should, 365 | // even if the `update()` method was called way past the duration of the tween 366 | _chainedTweens[i].start(_startTime + _duration); 367 | } 368 | 369 | return false; 370 | 371 | } 372 | 373 | } 374 | 375 | return true; 376 | 377 | }; 378 | 379 | }; 380 | 381 | 382 | TWEEN.Easing = { 383 | 384 | Linear: { 385 | 386 | None: function (k) { 387 | 388 | return k; 389 | 390 | } 391 | 392 | }, 393 | 394 | Quadratic: { 395 | 396 | In: function (k) { 397 | 398 | return k * k; 399 | 400 | }, 401 | 402 | Out: function (k) { 403 | 404 | return k * (2 - k); 405 | 406 | }, 407 | 408 | InOut: function (k) { 409 | 410 | if ((k *= 2) < 1) { 411 | return 0.5 * k * k; 412 | } 413 | 414 | return - 0.5 * (--k * (k - 2) - 1); 415 | 416 | } 417 | 418 | }, 419 | 420 | Cubic: { 421 | 422 | In: function (k) { 423 | 424 | return k * k * k; 425 | 426 | }, 427 | 428 | Out: function (k) { 429 | 430 | return --k * k * k + 1; 431 | 432 | }, 433 | 434 | InOut: function (k) { 435 | 436 | if ((k *= 2) < 1) { 437 | return 0.5 * k * k * k; 438 | } 439 | 440 | return 0.5 * ((k -= 2) * k * k + 2); 441 | 442 | } 443 | 444 | }, 445 | 446 | Quartic: { 447 | 448 | In: function (k) { 449 | 450 | return k * k * k * k; 451 | 452 | }, 453 | 454 | Out: function (k) { 455 | 456 | return 1 - (--k * k * k * k); 457 | 458 | }, 459 | 460 | InOut: function (k) { 461 | 462 | if ((k *= 2) < 1) { 463 | return 0.5 * k * k * k * k; 464 | } 465 | 466 | return - 0.5 * ((k -= 2) * k * k * k - 2); 467 | 468 | } 469 | 470 | }, 471 | 472 | Quintic: { 473 | 474 | In: function (k) { 475 | 476 | return k * k * k * k * k; 477 | 478 | }, 479 | 480 | Out: function (k) { 481 | 482 | return --k * k * k * k * k + 1; 483 | 484 | }, 485 | 486 | InOut: function (k) { 487 | 488 | if ((k *= 2) < 1) { 489 | return 0.5 * k * k * k * k * k; 490 | } 491 | 492 | return 0.5 * ((k -= 2) * k * k * k * k + 2); 493 | 494 | } 495 | 496 | }, 497 | 498 | Sinusoidal: { 499 | 500 | In: function (k) { 501 | 502 | return 1 - Math.cos(k * Math.PI / 2); 503 | 504 | }, 505 | 506 | Out: function (k) { 507 | 508 | return Math.sin(k * Math.PI / 2); 509 | 510 | }, 511 | 512 | InOut: function (k) { 513 | 514 | return 0.5 * (1 - Math.cos(Math.PI * k)); 515 | 516 | } 517 | 518 | }, 519 | 520 | Exponential: { 521 | 522 | In: function (k) { 523 | 524 | return k === 0 ? 0 : Math.pow(1024, k - 1); 525 | 526 | }, 527 | 528 | Out: function (k) { 529 | 530 | return k === 1 ? 1 : 1 - Math.pow(2, - 10 * k); 531 | 532 | }, 533 | 534 | InOut: function (k) { 535 | 536 | if (k === 0) { 537 | return 0; 538 | } 539 | 540 | if (k === 1) { 541 | return 1; 542 | } 543 | 544 | if ((k *= 2) < 1) { 545 | return 0.5 * Math.pow(1024, k - 1); 546 | } 547 | 548 | return 0.5 * (- Math.pow(2, - 10 * (k - 1)) + 2); 549 | 550 | } 551 | 552 | }, 553 | 554 | Circular: { 555 | 556 | In: function (k) { 557 | 558 | return 1 - Math.sqrt(1 - k * k); 559 | 560 | }, 561 | 562 | Out: function (k) { 563 | 564 | return Math.sqrt(1 - (--k * k)); 565 | 566 | }, 567 | 568 | InOut: function (k) { 569 | 570 | if ((k *= 2) < 1) { 571 | return - 0.5 * (Math.sqrt(1 - k * k) - 1); 572 | } 573 | 574 | return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1); 575 | 576 | } 577 | 578 | }, 579 | 580 | Elastic: { 581 | 582 | In: function (k) { 583 | 584 | var s; 585 | var a = 0.1; 586 | var p = 0.4; 587 | 588 | if (k === 0) { 589 | return 0; 590 | } 591 | 592 | if (k === 1) { 593 | return 1; 594 | } 595 | 596 | if (!a || a < 1) { 597 | a = 1; 598 | s = p / 4; 599 | } else { 600 | s = p * Math.asin(1 / a) / (2 * Math.PI); 601 | } 602 | 603 | return - (a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p)); 604 | 605 | }, 606 | 607 | Out: function (k) { 608 | 609 | var s; 610 | var a = 0.1; 611 | var p = 0.4; 612 | 613 | if (k === 0) { 614 | return 0; 615 | } 616 | 617 | if (k === 1) { 618 | return 1; 619 | } 620 | 621 | if (!a || a < 1) { 622 | a = 1; 623 | s = p / 4; 624 | } else { 625 | s = p * Math.asin(1 / a) / (2 * Math.PI); 626 | } 627 | 628 | return (a * Math.pow(2, - 10 * k) * Math.sin((k - s) * (2 * Math.PI) / p) + 1); 629 | 630 | }, 631 | 632 | InOut: function (k) { 633 | 634 | var s; 635 | var a = 0.1; 636 | var p = 0.4; 637 | 638 | if (k === 0) { 639 | return 0; 640 | } 641 | 642 | if (k === 1) { 643 | return 1; 644 | } 645 | 646 | if (!a || a < 1) { 647 | a = 1; 648 | s = p / 4; 649 | } else { 650 | s = p * Math.asin(1 / a) / (2 * Math.PI); 651 | } 652 | 653 | if ((k *= 2) < 1) { 654 | return - 0.5 * (a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p)); 655 | } 656 | 657 | return a * Math.pow(2, -10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1; 658 | 659 | } 660 | 661 | }, 662 | 663 | Back: { 664 | 665 | In: function (k) { 666 | 667 | var s = 1.70158; 668 | 669 | return k * k * ((s + 1) * k - s); 670 | 671 | }, 672 | 673 | Out: function (k) { 674 | 675 | var s = 1.70158; 676 | 677 | return --k * k * ((s + 1) * k + s) + 1; 678 | 679 | }, 680 | 681 | InOut: function (k) { 682 | 683 | var s = 1.70158 * 1.525; 684 | 685 | if ((k *= 2) < 1) { 686 | return 0.5 * (k * k * ((s + 1) * k - s)); 687 | } 688 | 689 | return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2); 690 | 691 | } 692 | 693 | }, 694 | 695 | Bounce: { 696 | 697 | In: function (k) { 698 | 699 | return 1 - TWEEN.Easing.Bounce.Out(1 - k); 700 | 701 | }, 702 | 703 | Out: function (k) { 704 | 705 | if (k < (1 / 2.75)) { 706 | return 7.5625 * k * k; 707 | } else if (k < (2 / 2.75)) { 708 | return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75; 709 | } else if (k < (2.5 / 2.75)) { 710 | return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375; 711 | } else { 712 | return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375; 713 | } 714 | 715 | }, 716 | 717 | InOut: function (k) { 718 | 719 | if (k < 0.5) { 720 | return TWEEN.Easing.Bounce.In(k * 2) * 0.5; 721 | } 722 | 723 | return TWEEN.Easing.Bounce.Out(k * 2 - 1) * 0.5 + 0.5; 724 | 725 | } 726 | 727 | } 728 | 729 | }; 730 | 731 | TWEEN.Interpolation = { 732 | 733 | Linear: function (v, k) { 734 | 735 | var m = v.length - 1; 736 | var f = m * k; 737 | var i = Math.floor(f); 738 | var fn = TWEEN.Interpolation.Utils.Linear; 739 | 740 | if (k < 0) { 741 | return fn(v[0], v[1], f); 742 | } 743 | 744 | if (k > 1) { 745 | return fn(v[m], v[m - 1], m - f); 746 | } 747 | 748 | return fn(v[i], v[i + 1 > m ? m : i + 1], f - i); 749 | 750 | }, 751 | 752 | Bezier: function (v, k) { 753 | 754 | var b = 0; 755 | var n = v.length - 1; 756 | var pw = Math.pow; 757 | var bn = TWEEN.Interpolation.Utils.Bernstein; 758 | 759 | for (var i = 0; i <= n; i++) { 760 | b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i); 761 | } 762 | 763 | return b; 764 | 765 | }, 766 | 767 | CatmullRom: function (v, k) { 768 | 769 | var m = v.length - 1; 770 | var f = m * k; 771 | var i = Math.floor(f); 772 | var fn = TWEEN.Interpolation.Utils.CatmullRom; 773 | 774 | if (v[0] === v[m]) { 775 | 776 | if (k < 0) { 777 | i = Math.floor(f = m * (1 + k)); 778 | } 779 | 780 | return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i); 781 | 782 | } else { 783 | 784 | if (k < 0) { 785 | return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]); 786 | } 787 | 788 | if (k > 1) { 789 | return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]); 790 | } 791 | 792 | return fn(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i); 793 | 794 | } 795 | 796 | }, 797 | 798 | Utils: { 799 | 800 | Linear: function (p0, p1, t) { 801 | 802 | return (p1 - p0) * t + p0; 803 | 804 | }, 805 | 806 | Bernstein: function (n, i) { 807 | 808 | var fc = TWEEN.Interpolation.Utils.Factorial; 809 | 810 | return fc(n) / fc(i) / fc(n - i); 811 | 812 | }, 813 | 814 | Factorial: (function () { 815 | 816 | var a = [1]; 817 | 818 | return function (n) { 819 | 820 | var s = 1; 821 | 822 | if (a[n]) { 823 | return a[n]; 824 | } 825 | 826 | for (var i = n; i > 1; i--) { 827 | s *= i; 828 | } 829 | 830 | a[n] = s; 831 | return s; 832 | 833 | }; 834 | 835 | })(), 836 | 837 | CatmullRom: function (p0, p1, p2, p3, t) { 838 | 839 | var v0 = (p2 - p0) * 0.5; 840 | var v1 = (p3 - p1) * 0.5; 841 | var t2 = t * t; 842 | var t3 = t * t2; 843 | 844 | return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (- 3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; 845 | 846 | } 847 | 848 | } 849 | 850 | }; 851 | 852 | // UMD (Universal Module Definition) 853 | (function (root) { 854 | 855 | if (typeof define === 'function' && define.amd) { 856 | 857 | // AMD 858 | define([], function () { 859 | return TWEEN; 860 | }); 861 | 862 | } else if (typeof exports === 'object') { 863 | 864 | // Node.js 865 | module.exports = TWEEN; 866 | 867 | } else { 868 | 869 | // Global variable 870 | root.TWEEN = TWEEN; 871 | 872 | } 873 | 874 | })(this); 875 | --------------------------------------------------------------------------------