├── Activity ├── .DS_Store └── Main.js ├── Application.js ├── Assets ├── .DS_Store ├── abstraction.png ├── logo_mobile.png ├── logo_mobile.xcf └── save_time.png ├── Component ├── .DS_Store ├── GLScreen.js ├── LoginScreen.js ├── MainScreen.js ├── Web │ └── Init.js └── WebGL │ ├── Cube.js │ ├── Init.js │ ├── Lines.js │ ├── ParticlesWave.js │ └── orsotheysay │ ├── .DS_Store │ ├── LICENSE │ ├── README │ ├── Start.js │ ├── files │ ├── .DS_Store │ ├── supersole-dream-of-sorts.mp3 │ ├── textures │ │ ├── asteroid.png │ │ ├── atmosphere.png │ │ ├── atmosphere2.png │ │ ├── earth.jpg │ │ ├── galaxy.jpg │ │ ├── galaxy32.png │ │ ├── line_planet.png │ │ ├── nebula.png │ │ ├── nova.png │ │ ├── nova_particle.png │ │ ├── sun.png │ │ └── sun2.png │ └── textures_ │ │ ├── asteroid.png │ │ ├── atmosphere.png │ │ ├── atmosphere2.png │ │ ├── earth.jpg │ │ ├── galaxy.jpg │ │ ├── galaxy32.png │ │ ├── line_planet.png │ │ ├── nebula.png │ │ ├── nova.png │ │ ├── nova_particle.png │ │ ├── sun.png │ │ └── sun2.png │ ├── index.html │ └── js │ ├── Sequencer.js │ ├── Stats.js │ ├── Three.js │ ├── effects │ ├── Effect.js │ ├── Part1Effect.js │ ├── Part2Effect.js │ ├── Part3Effect.js │ ├── Part4Effect.js │ ├── Part5Effect.js │ ├── Part6Effect.js │ ├── Part7Effect.js │ ├── Part8Effect.js │ ├── Part9Effect.js │ └── Vector3TravelEffect.js │ └── geometry │ ├── Asteroid.js │ ├── Cube.js │ ├── Plane.js │ └── Sphere.js ├── DirectProvider └── 1.0.js ├── Extanium ├── .DS_Store ├── Activity.js ├── Ajax.js ├── Application.js ├── Component.js ├── Component │ └── WebGL │ │ ├── Stats.js │ │ ├── cameras │ │ └── FreeCamera.js │ │ └── geometry │ │ ├── Bird.js │ │ ├── Qrcode.js │ │ └── primitives │ │ ├── ClickCube.js │ │ ├── Cube.js │ │ ├── Cylinder.js │ │ ├── Plane.js │ │ └── Sphere.js ├── Direct.js ├── Ext.js ├── Extanium.js ├── Global.js ├── Loader.js ├── MetricsMgr.js ├── OfflineAjax.js ├── Registry.js ├── WebView.js ├── WebViewBootstrap.html ├── WebViewBootstrap.js └── thirdparty │ ├── .DS_Store │ ├── extcore │ ├── .DS_Store │ └── ext-core.js │ └── threejs │ ├── .DS_Store │ ├── Three.js │ ├── build │ ├── Three.js │ └── ThreeDebug.js │ ├── cameras │ └── Camera.js │ ├── core │ ├── Color.js │ ├── Face3.js │ ├── Face4.js │ ├── Geometry.js │ ├── Matrix4.js │ ├── Rectangle.js │ ├── UV.js │ ├── Vector2.js │ ├── Vector3.js │ ├── Vector4.js │ └── Vertex.js │ ├── hci │ ├── ClickResolver.js │ ├── SelectableFace3.js │ └── SelectableFace4.js │ ├── lights │ ├── AmbientLight.js │ ├── DirectionalLight.js │ ├── Light.js │ └── PointLight.js │ ├── materials │ ├── LineColorMaterial.js │ ├── MeshBitmapUVMappingMaterial.js │ ├── MeshColorFillMaterial.js │ ├── MeshColorStrokeMaterial.js │ ├── MeshFaceColorFillMaterial.js │ ├── MeshFaceColorStrokeMaterial.js │ ├── ParticleBitmapMaterial.js │ ├── ParticleCircleMaterial.js │ └── ParticleDOMMaterial.js │ ├── objects │ ├── Line.js │ ├── Mesh.js │ ├── Object3D.js │ └── Particle.js │ ├── renderers │ ├── CanvasRenderer.js │ ├── DOMRenderer.js │ ├── Projector.js │ ├── SVGRenderer.js │ ├── WebGLRenderer.js │ └── renderables │ │ ├── RenderableFace3.js │ │ ├── RenderableFace4.js │ │ ├── RenderableLine.js │ │ └── RenderableParticle.js │ └── scenes │ └── Scene.js ├── Localization ├── de.js └── en.js ├── Preferences.js ├── android ├── appicon.png └── default.png ├── app.js └── iphone ├── Default.png └── appicon.png /Activity/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Activity/.DS_Store -------------------------------------------------------------------------------- /Activity/Main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class Main 3 | * 4 | * Implements the Main activity. 5 | */ 6 | Ext.createActivity('Main', { 7 | 8 | // Instance storage 9 | mainScreen: null, 10 | loginScreen: null, 11 | 12 | 13 | /** 14 | * Code to call on activity init 15 | * @return {void} 16 | */ 17 | start: function() { 18 | 19 | // Show the main screen 20 | this.showMainScreen(); 21 | }, 22 | 23 | 24 | /** 25 | * Shows the login screen 26 | * @return {void} 27 | */ 28 | showLoginScreen: function() { 29 | this.loginScreen = Ext.initCmp("LoginScreen"); 30 | this.loginScreen.show(); 31 | }, 32 | 33 | 34 | /** 35 | * Shows the main screen 36 | * @return {void} 37 | */ 38 | showMainScreen: function() { 39 | 40 | // Main screen 41 | this.mainScreen = Ext.initCmp("MainScreen"); 42 | this.mainScreen.show(); 43 | }, 44 | 45 | 46 | /** 47 | * Shows the GL screen 48 | * @return {void} 49 | */ 50 | showGLScreen: function() { 51 | 52 | // GL screen 53 | var GLScreen = Ext.initCmp('GLScreen'); 54 | GLScreen.show(); 55 | }, 56 | 57 | 58 | /** 59 | * Stops the activity 60 | * @return {void} 61 | */ 62 | stop: function() { 63 | 64 | // Close and delete main screen instance 65 | if (this.mainScreen != null) { 66 | this.mainScreen.hide(); 67 | delete this.mainScreen; 68 | } 69 | } 70 | }); -------------------------------------------------------------------------------- /Application.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class App 3 | * @singleton 4 | * @extends Ext.Application 5 | * 6 | * Base singleton App class to manage the high-level 7 | * app code initialization. For example introducing the 8 | * fist activities based on the Ext.isFirstRun-attribute. 9 | */ 10 | App = Ext.extend(Ext.Application, { 11 | 12 | /** 13 | * Indicates if the application is logged in 14 | * @type {Boolean} 15 | */ 16 | isLoggedIn: false, 17 | 18 | 19 | /** 20 | * Starts the application runtime. 21 | * @return {void} 22 | */ 23 | start: function() { 24 | 25 | // Enter Main activity 26 | Ext.startActivity("Main"); 27 | } 28 | }); 29 | 30 | -------------------------------------------------------------------------------- /Assets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Assets/.DS_Store -------------------------------------------------------------------------------- /Assets/abstraction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Assets/abstraction.png -------------------------------------------------------------------------------- /Assets/logo_mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Assets/logo_mobile.png -------------------------------------------------------------------------------- /Assets/logo_mobile.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Assets/logo_mobile.xcf -------------------------------------------------------------------------------- /Assets/save_time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Assets/save_time.png -------------------------------------------------------------------------------- /Component/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/.DS_Store -------------------------------------------------------------------------------- /Component/GLScreen.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class Ext.Components.GLScreen 3 | * 4 | * Implements the example of a GL window. 5 | */ 6 | Ext.createCmp('GLScreen', { 7 | 8 | 9 | // Configuration 10 | xtype: 'window', 11 | modal: true, 12 | navBarHidden: true, 13 | 14 | /** 15 | * Renders the 3D area 16 | * @return {void} 17 | */ 18 | render: function() { 19 | 20 | // Test GLView 21 | var glview = new Ext.WebView({ 22 | jsUrl: 'Component/WebGL/Init.js', 23 | initParams: { 24 | name: 'Aron!' 25 | }, 26 | onReady: function() { 27 | 28 | //Ext.debug("onReady"); 29 | 30 | // Send data 31 | //this.sendData({name: 'Aron'}); 32 | }, 33 | receivedData: function(data) { 34 | 35 | //Ext.debug("Ext received data from WebView context"); 36 | 37 | //for (name in data) { 38 | // Ext.debug(name + " : " + data[name]); 39 | //} 40 | } 41 | }); 42 | 43 | glview.getView().width = '100%'; 44 | glview.getView().height = '100%'; 45 | 46 | this.cmp.add(glview.getView()); 47 | } 48 | }); -------------------------------------------------------------------------------- /Component/MainScreen.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class Ext.Components.MainScreen 3 | * 4 | * Implements the main windows in tab groups. 5 | */ 6 | Ext.createCmp('MainScreen', { 7 | 8 | 9 | // Local reference storage 10 | tabGroup: null, 11 | saveTimeWindow: null, 12 | abstractionWindow: null, 13 | 14 | 15 | // Translation strings 16 | trSaveTime: 'Save time', 17 | trAbstraction: 'Abstraction', 18 | tr3D: '3D Corner!', 19 | 20 | 21 | create3DBtn: function() { 22 | 23 | var threeDBtn = C(Ti.UI.createButton({ 24 | title: this.tr3D 25 | })); 26 | 27 | // 3D context 28 | threeDBtn.addEventListener('click', function() { 29 | 30 | // Show GL Screen 31 | Ext.Activities.Main.showGLScreen(); 32 | 33 | }.createDelegate(this)); 34 | 35 | return threeDBtn; 36 | }, 37 | 38 | 39 | /** 40 | * Renders the save time window 41 | * @return {void} 42 | */ 43 | renderSaveTimeWindow: function() { 44 | 45 | // Save time window 46 | this.saveTimeWindow = W(Ti.UI.createWindow({ 47 | title: "", 48 | backgroundColor: '#fff', 49 | barImage: 'Assets/logo_mobile.png', 50 | rightNavButton: this.create3DBtn() 51 | })); 52 | 53 | 54 | // Login screen demo 55 | var openLoginScreenBtn = C(Ti.UI.createButton({ 56 | title: 'Login Screen demo', 57 | left: 35, 58 | top: 30, 59 | width: 250, 60 | height: 35 61 | })); 62 | 63 | // Click listener 64 | openLoginScreenBtn.addEventListener('click', function() { 65 | 66 | // Show login screen 67 | Ext.Activities.Main.showLoginScreen(); 68 | 69 | }.createDelegate(this)); 70 | 71 | this.saveTimeWindow.add(openLoginScreenBtn); 72 | 73 | 74 | // Ext.Ajax demo 75 | var ajaxButton = C(Ti.UI.createButton({ 76 | title: 'Ext.Ajax demo', 77 | left: 35, 78 | top: 75, 79 | width: 250, 80 | height: 35 81 | })); 82 | 83 | // Click listener 84 | ajaxButton.addEventListener('click', function() { 85 | 86 | new Ext.Ajax().request({ 87 | 88 | url: 'http://localhost/demo.php', 89 | params: [{name: 'username', value: 'Aron'}, 90 | {name: 'password', value: 'ABC'}], 91 | success: function() { 92 | 93 | Ext.debug("AJAX success"); 94 | Ext.debug(arguments); 95 | }, 96 | failure: function() { 97 | Ext.debug("AJAX error, may change code to set url!"); 98 | Ext.debug(arguments); 99 | } 100 | }); 101 | 102 | }.createDelegate(this)); 103 | 104 | this.saveTimeWindow.add(ajaxButton); 105 | 106 | 107 | // Ext.Direct demo 108 | var directButton = C(Ti.UI.createButton({ 109 | title: 'Ext.Direct demo (free impl)', 110 | left: 35, 111 | top: 75, 112 | width: 250, 113 | height: 35 114 | })); 115 | 116 | // Click listener 117 | directButton.addEventListener('click', function() { 118 | 119 | // Read more about Ext.Direct on ExtJS.com 120 | 121 | // Set base URL & Provider 122 | Ext.Direct.baseUrl = "http://localhost:80"; 123 | Ext.Direct.loadProvider('1.0.js'); 124 | 125 | // Call with Server API 126 | OTTRemote.login("aron", "testpw", function(result) { 127 | Ext.debug("Result: " + result); 128 | }); 129 | 130 | 131 | }.createDelegate(this)); 132 | 133 | this.saveTimeWindow.add(directButton); 134 | 135 | 136 | // Debug demo 137 | var debugButton = C(Ti.UI.createButton({ 138 | title: 'Some debugs', 139 | left: 35, 140 | top: 120, 141 | width: 250, 142 | height: 35 143 | })); 144 | 145 | // Click listener 146 | debugButton.addEventListener('click', function() { 147 | 148 | // Only visual 149 | Ext.alert("Alert title", "Ext.alert(...)"); 150 | 151 | // Warn log lebel 152 | Ext.debug("Ext.warn(...)"); 153 | 154 | // Debug log lebel 155 | Ext.debug("Ext.debug(...)"); 156 | 157 | // Info log lebel 158 | Ext.log("Ext.log(...)"); 159 | 160 | }.createDelegate(this)); 161 | 162 | this.saveTimeWindow.add(debugButton); 163 | 164 | }, 165 | 166 | 167 | /** 168 | * Renders the abstraction window 169 | * @return {void} 170 | */ 171 | renderAbstractionWindow: function() { 172 | 173 | // Abstraction window 174 | this.abstractionWindow = W(Ti.UI.createWindow({ 175 | title: "", 176 | backgroundColor: '#fff', 177 | barImage: 'Assets/logo_mobile.png', 178 | rightNavButton: this.create3DBtn() 179 | })); 180 | }, 181 | 182 | 183 | /** 184 | * Renders the tab group 185 | * @return {void} 186 | */ 187 | renderTabGroup: function() { 188 | 189 | // Tab group 190 | this.tabGroup = Ti.UI.createTabGroup(); 191 | 192 | // Save Time tab 193 | this.saveTimeTab = Ti.UI.createTab({ 194 | icon: 'Assets/save_time.png', 195 | title: this.trSaveTime, 196 | window: this.saveTimeWindow 197 | }); 198 | 199 | // Abstraction tab 200 | this.abstractionTab = Ti.UI.createTab({ 201 | icon: 'Assets/abstraction.png', 202 | title: this.trAbstraction, 203 | window: this.abstractionWindow 204 | }); 205 | 206 | // Add tabs 207 | this.tabGroup.addTab(this.saveTimeTab); 208 | this.tabGroup.addTab(this.abstractionTab); 209 | 210 | // Open tab group 211 | this.tabGroup.open(); 212 | }, 213 | 214 | 215 | /** 216 | * Renders the whole Main Screen UI 217 | * @return {void} 218 | */ 219 | render: function() { 220 | 221 | // Render save time window 222 | this.renderSaveTimeWindow(); 223 | 224 | // Render abstraction window 225 | this.renderAbstractionWindow(); 226 | 227 | // Render tab group and tabs 228 | this.renderTabGroup(); 229 | } 230 | }); -------------------------------------------------------------------------------- /Component/Web/Init.js: -------------------------------------------------------------------------------- 1 | // BEWARE: GL-Code is executed in WebView scope! 2 | // BEWARE 2: ONLY ADD CODE INSIDE OF initGL()! 3 | // There are timing reasons, the app will crash 4 | // when API-calls are added somewhere else. 5 | 6 | // Web init 7 | var Web = Web || {}; 8 | 9 | /** 10 | * Initializing function for the WebView canvas. 11 | * Will be called when WebView and bootstrapping is ready. 12 | * 13 | * @param {Object} params Parameters set by initParams config 14 | * @return {void} 15 | */ 16 | Web.init = function(params) { 17 | 18 | // Start your WebView journey here. 19 | 20 | // Include ThreeJS library 21 | Web.include('Extanium/thirdparty/extcore/ext-core.js', 'extReady'); 22 | 23 | // new Ext.WebView({initParams: {...}}) results in 24 | //for (name in params) { 25 | // alert(name + " : " + params[name]); 26 | //} 27 | 28 | // Send some data back 29 | //Web.sendData({name: 'Aron'}); 30 | 31 | // Wait for include flags to be declared 32 | Web.onMultiReady('extReady', function() { 33 | 34 | // Finally wait for JS real declares - timing matters ;-) 35 | Web.when(window['Ext'], function() { 36 | 37 | alert("Ext Core is here!"); 38 | alert(Ext); 39 | }); 40 | 41 | }); 42 | } 43 | 44 | 45 | /** 46 | * Will be called if you call Ext.WebView.sendData(data) 47 | * 48 | * @param {Object} data Data of the sendData(data) param 49 | * @return {void} 50 | */ 51 | Web.receivedData = function(data) { 52 | 53 | //alert("Received data from Ext.WebView context:"); 54 | 55 | // webviewInst.sendData({name: 'Aron'}) end here: 56 | //for (name in data) { 57 | // alert(name + " : " + data[name]); 58 | //} 59 | } -------------------------------------------------------------------------------- /Component/WebGL/Cube.js: -------------------------------------------------------------------------------- 1 | function render() { 2 | 3 | try { 4 | 5 | var SCREEN_WIDTH = window.innerWidth; 6 | var SCREEN_HEIGHT = window.innerHeight; 7 | 8 | var container; 9 | var stats; 10 | 11 | var camera; 12 | var scene; 13 | var renderer; 14 | 15 | var cube, plane; 16 | 17 | var targetRotation = 0; 18 | var targetRotationOnMouseDown = 0; 19 | 20 | var mouseX = 0; 21 | var mouseXOnMouseDown = 0; 22 | 23 | var windowHalfX = window.innerWidth / 2; 24 | var windowHalfY = window.innerHeight / 2; 25 | 26 | init(); 27 | setInterval(loop, 1000/60); 28 | 29 | function init() { 30 | 31 | container = document.createElement('div'); 32 | document.body.appendChild(container); 33 | 34 | var info = document.createElement('div'); 35 | info.style.position = 'absolute'; 36 | info.style.top = '10px'; 37 | info.style.width = '100%'; 38 | info.style.textAlign = 'center'; 39 | info.style.fontFamily = 'Arial,Verdana'; 40 | info.style.color = '#fff'; 41 | info.innerHTML = 'Drag to spin the cube'; 42 | container.appendChild(info); 43 | 44 | camera = new THREE.Camera( 70, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 10000 ); 45 | camera.position.y = 150; 46 | camera.position.z = 500; 47 | camera.target.position.y = 150; 48 | 49 | scene = new THREE.Scene(); 50 | 51 | // Cube 52 | 53 | geometry = new Cube( 200, 200, 200 ); 54 | 55 | for (var i = 0; i < geometry.faces.length; i++) { 56 | 57 | geometry.faces[i].color.setRGBA( Math.random() * 0.5, Math.random() * 0.5 + 0.5, Math.random() * 0.5 + 0.5, 1 ); 58 | } 59 | 60 | cube = new THREE.Mesh(geometry, new THREE.MeshFaceColorFillMaterial() ); 61 | cube.position.y = 150; 62 | scene.addObject( cube ); 63 | 64 | // Plane 65 | 66 | plane = new THREE.Mesh( new Plane( 200, 200 ), new THREE.MeshColorFillMaterial( 0xe0e0e0 ) ); 67 | plane.rotation.x = -90 * ( Math.PI / 180 ); 68 | scene.addObject( plane ); 69 | 70 | renderer = new THREE.CanvasRenderer(); 71 | renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT ); 72 | 73 | container.appendChild( renderer.domElement ); 74 | 75 | stats = new Stats(); 76 | stats.domElement.style.position = 'absolute'; 77 | stats.domElement.style.top = '0px'; 78 | container.appendChild( stats.domElement ); 79 | 80 | document.addEventListener( 'mousedown', onDocumentMouseDown, false ); 81 | document.addEventListener( 'touchstart', onDocumentTouchStart, false ); 82 | document.addEventListener( 'touchmove', onDocumentTouchMove, false ); 83 | } 84 | 85 | // 86 | 87 | function onDocumentMouseDown( event ) { 88 | 89 | event.preventDefault(); 90 | 91 | document.addEventListener( 'mousemove', onDocumentMouseMove, false ); 92 | document.addEventListener( 'mouseup', onDocumentMouseUp, false ); 93 | document.addEventListener( 'mouseout', onDocumentMouseOut, false ); 94 | 95 | mouseXOnMouseDown = event.clientX - windowHalfX; 96 | targetRotationOnMouseDown = targetRotation; 97 | } 98 | 99 | function onDocumentMouseMove( event ) { 100 | 101 | mouseX = event.clientX - windowHalfX; 102 | 103 | targetRotation = targetRotationOnMouseDown + ( mouseX - mouseXOnMouseDown ) * 0.02; 104 | } 105 | 106 | function onDocumentMouseUp( event ) { 107 | 108 | document.removeEventListener( 'mousemove', onDocumentMouseMove, false ); 109 | document.removeEventListener( 'mouseup', onDocumentMouseUp, false ); 110 | document.removeEventListener( 'mouseout', onDocumentMouseOut, false ); 111 | } 112 | 113 | function onDocumentMouseOut( event ) { 114 | 115 | document.removeEventListener( 'mousemove', onDocumentMouseMove, false ); 116 | document.removeEventListener( 'mouseup', onDocumentMouseUp, false ); 117 | document.removeEventListener( 'mouseout', onDocumentMouseOut, false ); 118 | } 119 | 120 | function onDocumentTouchStart( event ) { 121 | 122 | if ( event.touches.length == 1 ) { 123 | 124 | event.preventDefault(); 125 | 126 | mouseXOnMouseDown = event.touches[ 0 ].pageX - windowHalfX; 127 | targetRotationOnMouseDown = targetRotation; 128 | 129 | } 130 | } 131 | 132 | function onDocumentTouchMove( event ) { 133 | 134 | if ( event.touches.length == 1 ) { 135 | 136 | event.preventDefault(); 137 | 138 | mouseX = event.touches[ 0 ].pageX - windowHalfX; 139 | targetRotation = targetRotationOnMouseDown + ( mouseX - mouseXOnMouseDown ) * 0.05; 140 | 141 | } 142 | } 143 | 144 | // 145 | 146 | function loop() { 147 | 148 | plane.rotation.z = cube.rotation.y += ( targetRotation - cube.rotation.y ) * 0.05; 149 | 150 | renderer.render(scene, camera); 151 | stats.update(); 152 | } 153 | 154 | } catch (e) { 155 | 156 | alert("Error executing 3D script @ Cube.js:"); 157 | alert(e); 158 | } 159 | }; 160 | 161 | // Pre-includes 162 | Web.include('Extanium/Component/WebGL/geometry/primitives/Cube.js', 'cubeReady'); 163 | Web.include('Extanium/Component/WebGL/geometry/primitives/Plane.js', 'planeReady'); 164 | 165 | // Render on includes are ready 166 | Web.onMultiReady('cubeReady', 'planeReady', render); -------------------------------------------------------------------------------- /Component/WebGL/Init.js: -------------------------------------------------------------------------------- 1 | // BEWARE: GL-Code is executed in WebView scope! 2 | // BEWARE 2: ONLY ADD CODE INSIDE OF initGL()! 3 | // There are timing reasons, the app will crash 4 | // when API-calls are added somewhere else. 5 | 6 | // Web init 7 | var Web = Web || {}; 8 | 9 | /** 10 | * Initializing function for the WebView canvas. 11 | * Will be called when WebView and bootstrapping is ready. 12 | * 13 | * @param {Object} params Parameters set by initParams config 14 | * @return {void} 15 | */ 16 | Web.init = function(params) { 17 | 18 | // Start your WebView journey here. 19 | 20 | // Include ThreeJS library 21 | Web.include('Extanium/thirdparty/threejs/build/Three.js', 'threeJSReady'); 22 | Web.include('Extanium/Component/WebGL/Stats.js', 'statsReady'); 23 | 24 | // new Ext.WebView({initParams: {...}}) results in 25 | //for (name in params) { 26 | // alert(name + " : " + params[name]); 27 | //} 28 | 29 | // Send some data back 30 | //Web.sendData({name: 'Aron'}); 31 | 32 | // You may also try: 33 | 34 | // Wait for include flags to be declared 35 | Web.onMultiReady('threeJSReady', 'statsReady', function() { 36 | 37 | // Finally wait for JS real declares - timing matters ;-) 38 | Web.when(this['THREE'], this['Stats'], function() { 39 | 40 | // Start the impressive Demo Scene! 41 | //Web.include('Component/WebGL/orsotheysay/Start.js'); 42 | 43 | Web.include('Component/WebGL/Cube.js'); 44 | //Web.include('Component/WebGL/Lines.js'); 45 | //Web.include('Component/WebGL/ParticlesWave.js'); 46 | }); 47 | 48 | }); 49 | } 50 | 51 | 52 | /** 53 | * Will be called if you call Ext.WebView.sendData(data) 54 | * 55 | * @param {Object} data Data of the sendData(data) param 56 | * @return {void} 57 | */ 58 | Web.receivedData = function(data) { 59 | 60 | //alert("Received data from Ext.WebView context:"); 61 | 62 | // webviewInst.sendData({name: 'Aron'}) end here: 63 | //for (name in data) { 64 | // alert(name + " : " + data[name]); 65 | //} 66 | } -------------------------------------------------------------------------------- /Component/WebGL/Lines.js: -------------------------------------------------------------------------------- 1 | function render() { 2 | try { 3 | 4 | var SCREEN_WIDTH = window.innerWidth, 5 | SCREEN_HEIGHT = window.innerHeight, 6 | 7 | mouseX = 0, mouseY = 0, 8 | 9 | windowHalfX = window.innerWidth / 2, 10 | windowHalfY = window.innerHeight / 2, 11 | 12 | SEPARATION = 80, 13 | AMOUNTX = 15, 14 | AMOUNTY = 15, 15 | 16 | camera, scene, renderer, 17 | 18 | stats; 19 | 20 | init(); 21 | setInterval(loop, 100 / 60); 22 | 23 | function init() { 24 | 25 | var container, separation = 100, amountX = 1, amountY = 1, 26 | particles, particle, material; 27 | 28 | container = document.createElement('div'); 29 | document.body.appendChild(container); 30 | 31 | 32 | camera = new THREE.Camera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 10000 ); 33 | camera.position.z = 1300; 34 | 35 | scene = new THREE.Scene(); 36 | 37 | renderer = new THREE.CanvasRenderer(); 38 | renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); 39 | container.appendChild(renderer.domElement); 40 | 41 | // particles 42 | 43 | material = new THREE.ParticleCircleMaterial( 0xffffff, 1 ); 44 | var geometry = new THREE.Geometry(); 45 | 46 | for (var i = 0; i < 30; i++) { 47 | 48 | particle = new THREE.Particle( material ); 49 | particle.position.x = Math.random() * 2 - 1; 50 | particle.position.y = Math.random() * 2 - 1; 51 | particle.position.z = Math.random() * 2 - 1; 52 | particle.position.normalize(); 53 | particle.position.multiplyScalar(Math.random() * 10 + 450); 54 | particle.scale.x = particle.scale.y = 6; 55 | scene.add( particle ); 56 | 57 | geometry.vertices.push( new THREE.Vertex( particle.position ) ); 58 | 59 | } 60 | 61 | // lines 62 | 63 | var line = new THREE.Line( geometry, new THREE.LineColorMaterial( 0xcc0000, Math.random(), 2 ) ); 64 | scene.add(line); 65 | 66 | 67 | stats = new Stats(); 68 | stats.domElement.style.position = 'absolute'; 69 | stats.domElement.style.top = '0px'; 70 | container.appendChild(stats.domElement); 71 | 72 | 73 | document.addEventListener('mousemove', onDocumentMouseMove, false); 74 | document.addEventListener('touchstart', onDocumentTouchStart, false); 75 | document.addEventListener('touchmove', onDocumentTouchMove, false); 76 | } 77 | 78 | // 79 | 80 | function onDocumentMouseMove(event) { 81 | 82 | mouseX = event.clientX - windowHalfX; 83 | mouseY = event.clientY - windowHalfY; 84 | } 85 | 86 | function onDocumentTouchStart( event ) { 87 | 88 | if(event.touches.length > 1) { 89 | 90 | event.preventDefault(); 91 | 92 | mouseX = event.touches[0].pageX - windowHalfX; 93 | mouseY = event.touches[0].pageY - windowHalfY; 94 | } 95 | } 96 | 97 | function onDocumentTouchMove( event ) { 98 | 99 | if(event.touches.length == 1) { 100 | 101 | event.preventDefault(); 102 | 103 | mouseX = event.touches[0].pageX - windowHalfX; 104 | mouseY = event.touches[0].pageY - windowHalfY; 105 | } 106 | } 107 | 108 | // 109 | 110 | function loop() { 111 | 112 | camera.position.x += (mouseX - camera.position.x) * .05; 113 | camera.position.y += (-mouseY + 200 - camera.position.y) * .05; 114 | camera.updateMatrix(); 115 | 116 | renderer.render(scene, camera); 117 | 118 | stats.update(); 119 | } 120 | 121 | } catch (e) { 122 | 123 | alert("Error executing 3D script @ Lines.js:"); 124 | alert(e); 125 | } 126 | } 127 | render(); 128 | -------------------------------------------------------------------------------- /Component/WebGL/ParticlesWave.js: -------------------------------------------------------------------------------- 1 | function render() { 2 | try { 3 | 4 | var SCREEN_WIDTH = window.innerWidth; 5 | var SCREEN_HEIGHT = window.innerHeight; 6 | 7 | var SEPARATION = 100; 8 | var AMOUNTX = 5; 9 | var AMOUNTY = 5; 10 | 11 | var stats; 12 | var container; 13 | 14 | var particles, particle; 15 | var count; 16 | 17 | var camera; 18 | var scene; 19 | var renderer; 20 | 21 | var mouseX = 0; 22 | var mouseY = 0; 23 | 24 | var windowHalfX = window.innerWidth / 2; 25 | var windowHalfY = window.innerHeight / 2; 26 | 27 | init(); 28 | setInterval(loop, 500 / 60); 29 | 30 | function init() { 31 | 32 | container = document.createElement( 'div' ); 33 | document.body.appendChild( container ); 34 | 35 | camera = new THREE.Camera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 10000 ); 36 | camera.position.z = 400; 37 | 38 | scene = new THREE.Scene(); 39 | 40 | renderer = new THREE.CanvasRenderer(); 41 | renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT ); 42 | 43 | particles = new Array(); 44 | 45 | var i = 0; 46 | var material = new THREE.ParticleCircleMaterial( 0xffffff, 1 ); 47 | 48 | for ( var ix = 0; ix < AMOUNTX; ix ++ ) { 49 | 50 | for ( var iy = 0; iy < AMOUNTY; iy ++ ) { 51 | 52 | particle = particles[ i ++ ] = new THREE.Particle( material ); 53 | particle.position.x = ix * SEPARATION - ( ( AMOUNTX * SEPARATION ) / 2 ); 54 | particle.position.z = iy * SEPARATION - ( ( AMOUNTY * SEPARATION ) / 2 ); 55 | scene.add( particle ); 56 | } 57 | } 58 | 59 | count = 0; 60 | 61 | container.appendChild( renderer.domElement ); 62 | 63 | stats = new Stats(); 64 | stats.domElement.style.position = 'absolute'; 65 | stats.domElement.style.top = '0px'; 66 | container.appendChild( stats.domElement ); 67 | 68 | document.addEventListener( 'mousemove', onDocumentMouseMove, false ); 69 | document.addEventListener( 'touchstart', onDocumentTouchStart, false ); 70 | document.addEventListener( 'touchmove', onDocumentTouchMove, false ); 71 | } 72 | 73 | // 74 | 75 | function onDocumentMouseMove( event ) { 76 | 77 | mouseX = event.clientX - windowHalfX; 78 | mouseY = event.clientY - windowHalfY; 79 | 80 | } 81 | 82 | function onDocumentTouchStart( event ) { 83 | 84 | if ( event.touches.length == 1 ) { 85 | 86 | event.preventDefault(); 87 | 88 | mouseX = event.touches[ 0 ].pageX - windowHalfX; 89 | mouseY = event.touches[ 0 ].pageY - windowHalfY; 90 | 91 | } 92 | } 93 | 94 | function onDocumentTouchMove( event ) { 95 | 96 | if ( event.touches.length == 1 ) { 97 | 98 | event.preventDefault(); 99 | 100 | mouseX = event.touches[ 0 ].pageX - windowHalfX; 101 | mouseY = event.touches[ 0 ].pageY - windowHalfY; 102 | 103 | } 104 | } 105 | 106 | // 107 | 108 | function loop() { 109 | 110 | camera.position.x += ( mouseX - camera.position.x ) * .05; 111 | camera.position.y += ( - mouseY - camera.position.y ) * .05; 112 | 113 | var i = 0; 114 | 115 | for ( var ix = 0; ix < AMOUNTX; ix ++ ) { 116 | 117 | for ( var iy = 0; iy < AMOUNTY; iy ++ ) { 118 | 119 | particle = particles[ i++ ]; 120 | particle.position.y = ( Math.sin( ( ix + count ) * 0.3 ) * 50 ) + ( Math.sin( ( iy + count ) * 0.5 ) * 50 ); 121 | particle.scale.x = particle.scale.y = ( Math.sin( ( ix + count ) * 0.3 ) + 1 ) * 2 + ( Math.sin( ( iy + count ) * 0.5 ) + 1 ) * 2; 122 | 123 | } 124 | } 125 | 126 | renderer.render( scene, camera ); 127 | 128 | stats.update(); 129 | 130 | count += 0.1; 131 | } 132 | 133 | } catch (e) { 134 | 135 | alert("Error executing 3D script @ ParticlesWave.js:"); 136 | alert(e); 137 | } 138 | } 139 | render(); -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/.DS_Store -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2010 xplsv 2 | 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/README: -------------------------------------------------------------------------------- 1 | 2 | ..________ 3 | ..__ _______\ \ ________ _____.. 4 | -- \ \_____ \ \ \ _\..___ ____ / / - 5 | -- / / _/_ \ \ \ \ \ / -- 6 | - /____/\ \ \_______\ \__..__\ \____\ / --- 7 | \____\____ \ \ \_ \_________\/______/ 8 | .. .. \_______../ ++ xplsv 9 | 10 | 11 | --- --- 12 | Or so they say... by xplsv 13 | --- --- 14 | --- --- 15 | 16 | code.mrdoob 17 | direction.trace 18 | music.supersole 19 | 20 | --- --- 21 | --- --- 22 | Blah blah blah... 23 | --- --- 24 | --- --- 25 | 26 | Long time not doing a "proper" demo... 27 | I have always found unfair that browser 28 | demos had to be put in a special category or 29 | mixed with other works that weren't even 30 | realtime. 31 | 32 | However, this year, Euskal was including 33 | browser demos in the main demo competition. 34 | So I was somehow forced to contribute :) 35 | 36 | On top of that, I've been slowly working on 37 | a 3d engine and a sequencer for the past few 38 | months and they seemed advanced enough to 39 | give it a try. 40 | 41 | But, of course, I wasn't able to start 42 | before it was already one day before the 43 | deadline. Yesterday night I was struggling 44 | about what the demo should be about. In the 45 | end, I decided to just start coding whatever 46 | and improvise. I started around midnight and 47 | I'm considering it done 12 hours later :O 48 | 49 | It's all software rendering (no WebGL), 50 | so don't expect much performance. It's 51 | running at 20-30fps on my Mac Mini Core 2 52 | Duo @ 2.53Ghz with Ubuntu/Linux. If you are 53 | running MacOS. I'm sorry to say that it 54 | won't run faster than 1fps... For some 55 | reason Chrome team decided to use 56 | CoreGraphics instead of Skia. 57 | 58 | This version doesn't have any loading stuff, 59 | but I guess, eventually, I'll end up 60 | implementing it... while I'm at it I'll 61 | probably do a WebGL version too :) 62 | 63 | Requirements: 64 | 65 | For better results (at this point) 66 | Chrome Windows/Linux. 67 | 68 | Software used: 69 | 70 | Ubuntu, Gedit, Chrome, Gimp, Blender 71 | 72 | - mrdoob & trace.xplsv 73 | 74 | --- --- 75 | --- --- 76 | 77 | More info? 78 | 79 | --- --- 80 | 81 | mrdoob: http://mrdoob.com 82 | trace: http://trace.xplsv.com 83 | supersole: http://supersole.net 84 | 85 | --- --- 86 | --- --- 87 | xplsv.com 2010 88 | --- --- 89 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/.DS_Store -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/supersole-dream-of-sorts.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/supersole-dream-of-sorts.mp3 -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures/asteroid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures/asteroid.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures/atmosphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures/atmosphere.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures/atmosphere2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures/atmosphere2.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures/earth.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures/earth.jpg -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures/galaxy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures/galaxy.jpg -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures/galaxy32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures/galaxy32.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures/line_planet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures/line_planet.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures/nebula.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures/nebula.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures/nova.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures/nova.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures/nova_particle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures/nova_particle.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures/sun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures/sun.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures/sun2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures/sun2.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures_/asteroid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures_/asteroid.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures_/atmosphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures_/atmosphere.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures_/atmosphere2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures_/atmosphere2.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures_/earth.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures_/earth.jpg -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures_/galaxy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures_/galaxy.jpg -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures_/galaxy32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures_/galaxy32.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures_/line_planet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures_/line_planet.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures_/nebula.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures_/nebula.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures_/nova.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures_/nova.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures_/nova_particle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures_/nova_particle.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures_/sun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures_/sun.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/files/textures_/sun2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Component/WebGL/orsotheysay/files/textures_/sun2.png -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | "Or so they say..." by xplsv 6 | 31 | 32 | 33 | 34 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 207 | 208 |
209 | 210 | "Or so they say..." by xplsv
211 | 212 | fastmade javascript demo

213 | 214 | code: mr.doob
215 | direction: trace
216 | music: supersole

217 | 218 | readme, blog post, source code, video




219 | 220 | START 221 |

222 | PART 1
223 | PART 2
224 | PART 3
225 | PART 4
226 | PART 5
227 | PART 6
228 | PART 7
229 | PART 8
230 |
231 | 232 | 233 | 234 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/Sequencer.js: -------------------------------------------------------------------------------- 1 | var Sequencer = function () { 2 | 3 | var _effect, 4 | _effects = [], 5 | _effectsActive = [], 6 | _effectsToRemove = [], 7 | 8 | _nextEffect = 0, 9 | _nextEffectToRemove = 0, 10 | _time = 0; 11 | 12 | this.add = function ( effect, start_time, end_time ) { 13 | 14 | effect.__active = false; 15 | effect.__start_time = start_time; 16 | effect.__duration = end_time - start_time; 17 | effect.__end_time = end_time; 18 | 19 | _effects.push( effect ); 20 | _effects.sort( function ( a, b ) { return a.__start_time - b.__start_time; } ); 21 | 22 | _effectsToRemove.push( effect ); 23 | _effectsToRemove.sort( function ( a, b ) { return a.__end_time - b.__end_time; } ); 24 | 25 | }; 26 | 27 | this.update = function ( time ) { 28 | var effect; 29 | 30 | 31 | if ( time < _time ) { 32 | 33 | this.clear(); 34 | 35 | } 36 | 37 | while ( _effects[ _nextEffect ] ) { 38 | 39 | effect = _effects[ _nextEffect ]; 40 | 41 | if ( effect.__start_time > time ) { 42 | 43 | break; 44 | 45 | } 46 | 47 | if ( !effect.__active && effect.__end_time > time ) { 48 | 49 | // console.log( "Adding effect: " + effect ); 50 | 51 | effect.show(); 52 | effect.__active = true; 53 | 54 | _effectsActive.push( effect ); 55 | 56 | } 57 | 58 | _nextEffect += 1; 59 | 60 | } 61 | 62 | while ( _effectsToRemove[ _nextEffectToRemove ] ) { 63 | 64 | effect = _effectsToRemove[ _nextEffectToRemove ]; 65 | 66 | if ( effect.__end_time > time ) { 67 | 68 | break; 69 | 70 | } 71 | 72 | if ( effect.__active ) { 73 | 74 | // console.log( "Removing effect: " + effect ); 75 | 76 | effect.__active = false; 77 | effect.hide(); 78 | 79 | for ( var i = 0, l = _effectsActive.length; i < l; i++ ) { 80 | 81 | if ( effect == _effectsActive[ i ] ) { 82 | 83 | _effectsActive.splice(i, 1); 84 | } 85 | } 86 | 87 | } 88 | 89 | _nextEffectToRemove += 1; 90 | 91 | } 92 | 93 | for ( var i = 0; i < _effectsActive.length; i ++ ) { 94 | 95 | _effect = _effectsActive[ i ]; 96 | 97 | 98 | _effect.update( ( time - _effect.__start_time ) / _effect.__duration ); 99 | 100 | } 101 | 102 | 103 | _time = time; 104 | 105 | }; 106 | 107 | this.clear = function () { 108 | 109 | _nextEffect = 0; 110 | _nextEffectToRemove = 0; 111 | 112 | while ( _effectsActive.length ) { 113 | 114 | _effect = _effectsActive[ 0 ]; 115 | _effect.__active = false; 116 | _effect.hide(); 117 | _effectsActive.splice(0, 1); 118 | 119 | } 120 | 121 | }; 122 | 123 | }; 124 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/Stats.js: -------------------------------------------------------------------------------- 1 | // stats.js r4 - http://github.com/mrdoob/stats.js 2 | var Stats=function(){var m,g="fps",q=0,s=new Date().getTime(),o=s,e=s,j=0,d=1000,f=0,l,b,c,p,h=0,t=1000,a=0,n,k,r,i;m=document.createElement("div");m.style.fontFamily="Helvetica, Arial, sans-serif";m.style.fontSize="9px";m.style.backgroundColor="#000020";m.style.opacity="0.9";m.style.width="80px";m.style.paddingTop="2px";m.style.cursor="pointer";m.addEventListener("click",u,false);l=document.createElement("div");l.innerHTML="FPS";l.style.color="#00ffff";l.style.marginLeft="3px";l.style.marginBottom="3px";m.appendChild(l);b=document.createElement("canvas");b.width=74;b.height=30;b.style.display="block";b.style.marginLeft="3px";b.style.marginBottom="3px";m.appendChild(b);c=b.getContext("2d");c.fillStyle="#101030";c.fillRect(0,0,b.width,b.height);p=c.getImageData(0,0,b.width,b.height);n=document.createElement("div");n.innerHTML="MS";n.style.color="#00ffff";n.style.marginLeft="3px";n.style.marginBottom="3px";n.style.display="none";m.appendChild(n);k=document.createElement("canvas");k.width=74;k.height=30;k.style.display="block";k.style.marginLeft="3px";k.style.marginBottom="3px";k.style.display="none";m.appendChild(k);r=k.getContext("2d");r.fillStyle="#101030";r.fillRect(0,0,k.width,k.height);i=r.getImageData(0,0,k.width,k.height);function v(B,A){var w,C,z;for(C=0;C<30;C++){for(w=0;w<73;w++){z=(w+C*74)*4;B[z]=B[z+4];B[z+1]=B[z+5];B[z+2]=B[z+6]}}for(C=0;C<30;C++){z=(73+C*74)*4;if(C"+h+" MS ("+t+"-"+a+")";r.putImageData(i,0,0);o=s;if(s>e+1000){j=Math.round((q*1000)/(s-e));d=Math.min(d,j);f=Math.max(f,j);v(p.data,Math.min(30,30-(j/100)*30));l.innerHTML=""+j+" FPS ("+d+"-"+f+")";c.putImageData(p,0,0);e=s;q=0}}}}; 3 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/effects/Effect.js: -------------------------------------------------------------------------------- 1 | var Effect = function () { 2 | 3 | this.load = function () { 4 | 5 | }; 6 | 7 | this.show = function () { 8 | 9 | }; 10 | 11 | this.hide = function () { 12 | 13 | }; 14 | 15 | this.update = function ( time ) { 16 | 17 | }; 18 | 19 | }; 20 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/effects/Part1Effect.js: -------------------------------------------------------------------------------- 1 | var Part1Effect = function ( camera, renderer ) { 2 | 3 | 4 | Effect.call( this ); 5 | 6 | // Init 7 | 8 | var vector, particles, particle, material, scene; 9 | 10 | vector = new THREE.Vector3(); 11 | 12 | scene = new THREE.Scene(); 13 | material = loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/nova_particle.png' ); 14 | 15 | particles = []; 16 | 17 | for (var i = 0; i < 128; i++) { 18 | 19 | particles[ i ] = particle = new THREE.Particle( material ); 20 | particle.position.x = Math.random() - 0.5; 21 | particle.position.y = Math.random() - 0.5; 22 | particle.position.z = Math.random() - 0.5; 23 | particle.position.normalize(); 24 | particle.position.multiplyScalar( Math.random() * 1000 + 100 ); 25 | particle.scale.x = particle.scale.y = Math.random() * 0.5; 26 | scene.addObject( particle ); 27 | } 28 | 29 | function loadImage( material, path ) { 30 | 31 | var image = new Image(); 32 | 33 | image.onload = function () { 34 | 35 | material.bitmap = this; 36 | 37 | }; 38 | 39 | image.src = path; 40 | material.bitmap = image; 41 | 42 | return material; 43 | 44 | } 45 | 46 | // 47 | 48 | this.show = function () { 49 | 50 | renderer.domElement.getContext( '2d' ).globalCompositeOperation = 'lighter'; 51 | 52 | }; 53 | 54 | this.update = function ( time ) { 55 | renderer.clear(); 56 | renderer.render( scene, camera ); 57 | }; 58 | 59 | }; 60 | 61 | 62 | Part1Effect.prototype = new Effect(); 63 | Part1Effect.prototype.constructor = Part1Effect; 64 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/effects/Part2Effect.js: -------------------------------------------------------------------------------- 1 | var Part2Effect = function ( camera, renderer ) { 2 | 3 | Effect.call( this ); 4 | 5 | // Init 6 | 7 | var vector, particles, particle, material, scene; 8 | 9 | vector = new THREE.Vector3(); 10 | scene = new THREE.Scene(); 11 | 12 | particle = new THREE.Particle( loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/nebula.png' ) ); 13 | particle.position.z = - 2000; 14 | particle.scale.x = particle.scale.y = 16; 15 | scene.addObject( particle ); 16 | 17 | particle = new THREE.Particle( loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/nova.png' ) ); 18 | scene.addObject( particle ); 19 | 20 | material = loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/nova_particle.png' ); 21 | 22 | particles = []; 23 | 24 | for ( var i = 0; i < 64; i++ ) { 25 | 26 | particle = particles[ i ] = new THREE.Particle( material ); 27 | particle.position.x = Math.random() - 0.5; 28 | particle.position.y = Math.random() - 0.5; 29 | particle.position.z = Math.random() - 0.5; 30 | particle.position.normalize(); 31 | particle.position.multiplyScalar( Math.random() * Math.random() * Math.random() * 200 + 50 ); 32 | 33 | particle.data = { start: new THREE.Vector3(), change: new THREE.Vector3() }; 34 | particle.data.start.copy( particle.position ) ; 35 | 36 | particle.data.change.copy( particle.position ); 37 | particle.data.change.normalize(); 38 | particle.data.change.multiplyScalar( Math.random() * 600 ); 39 | particle.data.change.subSelf( particle.position ); 40 | 41 | particle.scale.x = particle.scale.y = Math.random() * 0.4; 42 | scene.addObject( particle ); 43 | } 44 | 45 | // 46 | 47 | function loadImage( material, path ) { 48 | 49 | var image = new Image(); 50 | 51 | image.onload = function () { 52 | 53 | material.bitmap = this; 54 | 55 | }; 56 | 57 | image.src = path; 58 | material.bitmap = image; 59 | 60 | 61 | return material; 62 | 63 | } 64 | 65 | // 66 | 67 | this.show = function () { 68 | 69 | renderer.domElement.getContext( '2d' ).globalCompositeOperation = 'lighter'; 70 | 71 | }; 72 | 73 | this.update = function ( time ) { 74 | 75 | for ( var i = 0, l = particles.length; i < l; i++ ) { 76 | 77 | particle = particles[ i ]; 78 | 79 | vector.copy( particle.data.change ); 80 | vector.multiplyScalar( time ); 81 | 82 | particle.position.add( particle.data.start, vector ); 83 | 84 | } 85 | 86 | renderer.clear(); 87 | renderer.render( scene, camera ); 88 | 89 | }; 90 | 91 | }; 92 | 93 | 94 | Part2Effect.prototype = new Effect(); 95 | Part2Effect.prototype.constructor = Part2Effect; 96 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/effects/Part3Effect.js: -------------------------------------------------------------------------------- 1 | var Part3Effect = function ( camera, renderer ) { 2 | 3 | Effect.call( this ); 4 | 5 | // Init 6 | 7 | var vector, particles, particle, material, material2, scene; 8 | 9 | vector = new THREE.Vector3(); 10 | scene = new THREE.Scene(); 11 | 12 | particle = new THREE.Particle( loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/nova.png' ) ); 13 | scene.addObject( particle ); 14 | 15 | material = loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/nova_particle.png' ); 16 | material2 = loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/galaxy32.png' ); 17 | 18 | particles = []; 19 | 20 | for ( var i = 0; i < 64; i++ ) { 21 | 22 | var galaxy = Math.random() > 0.9; 23 | 24 | particle = particles[ i ] = new THREE.Particle( galaxy ? material2 : material ); 25 | particle.position.x = Math.random() - 0.5; 26 | particle.position.y = Math.random() - 0.5; 27 | particle.position.z = Math.random() - 0.5; 28 | particle.position.normalize(); 29 | particle.position.multiplyScalar( Math.random() * Math.random() * Math.random() * 200 + 50 ); 30 | 31 | particle.data = { start: new THREE.Vector3(), change: new THREE.Vector3() }; 32 | particle.data.start.copy( particle.position ) ; 33 | 34 | particle.data.change.copy( particle.position ); 35 | particle.data.change.normalize(); 36 | particle.data.change.multiplyScalar( Math.random() * 400 ); 37 | particle.data.change.addSelf( particle.position ); 38 | 39 | if ( galaxy ) { 40 | 41 | particle.scale.x = Math.random() * 0.1 + 0.05; 42 | particle.scale.y = Math.random() * 0.1 + 0.05; 43 | particle.rotation.z = Math.random() * Math.PI; 44 | 45 | } else { 46 | 47 | particle.scale.x = particle.scale.y = Math.random() * 0.2; 48 | 49 | } 50 | 51 | scene.addObject( particle ); 52 | } 53 | 54 | // 55 | 56 | function loadImage( material, path ) { 57 | 58 | var image = new Image(); 59 | 60 | image.onload = function () { 61 | 62 | material.bitmap = this; 63 | 64 | }; 65 | 66 | image.src = path; 67 | material.bitmap = image; 68 | 69 | return material; 70 | 71 | } 72 | 73 | // 74 | 75 | this.show = function () { 76 | 77 | renderer.domElement.getContext( '2d' ).globalCompositeOperation = 'lighter'; 78 | 79 | }; 80 | 81 | this.update = function ( time ) { 82 | 83 | for ( var i = 0, l = particles.length; i < l; i++ ) { 84 | 85 | particle = particles[ i ]; 86 | 87 | vector.copy( particle.data.change ); 88 | vector.multiplyScalar( time ); 89 | 90 | particle.position.add( particle.data.start, vector ); 91 | 92 | } 93 | 94 | renderer.clear(); 95 | renderer.render( scene, camera ); 96 | 97 | }; 98 | 99 | }; 100 | 101 | 102 | Part3Effect.prototype = new Effect(); 103 | Part3Effect.prototype.constructor = Part3Effect; 104 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/effects/Part4Effect.js: -------------------------------------------------------------------------------- 1 | var Part4Effect = function ( camera, renderer ) { 2 | 3 | Effect.call( this ); 4 | 5 | // Init 6 | 7 | var scene, cube, particle, galaxies, mesh, material, material2; 8 | 9 | scene = new THREE.Scene(); 10 | 11 | material = loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/nova_particle.png' ); 12 | 13 | for (var i = 0; i < 80; i++) { 14 | 15 | particle = new THREE.Particle( material ); 16 | particle.position.x = Math.random() * 10000 - 5000; 17 | particle.position.y = Math.random() * 10000 - 5000; 18 | particle.position.z = Math.random() * 10000 - 8000; 19 | particle.scale.x = particle.scale.y = Math.random() * 1.5 + 0.5; 20 | scene.addObject( particle ); 21 | } 22 | 23 | material = loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/nova.png' ); 24 | material2 = loadImage( new THREE.MeshBitmapUVMappingMaterial(), '../Component/WebGL/orsotheysay/files/textures/galaxy.jpg' ); 25 | 26 | galaxies = []; 27 | 28 | for ( var i = 0; i < 15; i ++ ) { 29 | 30 | particle = new THREE.Particle( material ); 31 | particle.position.x = Math.random() * 10000 - 5000; 32 | particle.position.y = Math.random() * 10000 - 5000; 33 | particle.position.z = Math.random() * 10000 - 8000; 34 | scene.addObject( particle ); 35 | 36 | galaxies[ i ] = mesh = new THREE.Mesh( new Plane( 400, 400, 2, 2 ), material2 ); 37 | mesh.position.x = particle.position.x; 38 | mesh.position.y = particle.position.y; 39 | mesh.position.z = particle.position.z; 40 | mesh.rotation.x = - 90 * Math.PI / 180; 41 | mesh.rotation.y = Math.random() * Math.PI; 42 | mesh.doubleSided = true; 43 | scene.addObject( mesh ); 44 | 45 | } 46 | 47 | // 48 | 49 | function loadImage( material, path ) { 50 | 51 | var image = new Image(); 52 | 53 | image.onload = function () { 54 | 55 | material.bitmap = this; 56 | 57 | }; 58 | 59 | image.src = path; 60 | material.bitmap = image; 61 | 62 | return material; 63 | 64 | } 65 | 66 | // 67 | 68 | this.show = function () { 69 | 70 | renderer.domElement.getContext( '2d' ).globalCompositeOperation = 'lighter'; 71 | 72 | }; 73 | 74 | this.update = function ( time ) { 75 | 76 | for ( var i = 0; i < 15; i ++ ) { 77 | 78 | mesh = galaxies[ i ]; 79 | mesh.rotation.z = - time * 2; 80 | 81 | } 82 | 83 | renderer.clear(); 84 | renderer.render( scene, camera ); 85 | 86 | }; 87 | 88 | }; 89 | 90 | 91 | Part4Effect.prototype = new Effect(); 92 | Part4Effect.prototype.constructor = Part4Effect; 93 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/effects/Part5Effect.js: -------------------------------------------------------------------------------- 1 | var Part5Effect = function ( camera, renderer ) { 2 | 3 | Effect.call( this ); 4 | 5 | // Init 6 | 7 | var scene, cube, particle, galaxies, mesh, material, material2; 8 | 9 | scene = new THREE.Scene(); 10 | 11 | material = loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/nova_particle.png' ); 12 | 13 | for (var i = 0; i < 64; i++) { 14 | 15 | particle = new THREE.Particle( material ); 16 | particle.position.x = Math.random() * 10000 - 5000; 17 | particle.position.y = Math.random() * 10000 - 5000; 18 | particle.position.z = Math.random() * 10000 - 8000; 19 | particle.scale.x = particle.scale.y = Math.random() * 1 + 0.5; 20 | scene.addObject( particle ); 21 | } 22 | 23 | material = loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/nova.png' ); 24 | material2 = loadImage( new THREE.MeshBitmapUVMappingMaterial(), '../Component/WebGL/orsotheysay/files/textures/galaxy.jpg' ); 25 | 26 | galaxies = []; 27 | 28 | particle = new THREE.Particle( material ); 29 | scene.addObject( particle ); 30 | 31 | mesh = galaxies[ 0 ] = new THREE.Mesh( new Plane( 300, 300, 4, 4 ), material2 ); 32 | mesh.rotation.x = - 90 * Math.PI / 180; 33 | mesh.doubleSided = true; 34 | scene.addObject( mesh ); 35 | 36 | for ( var i = 1; i < 15; i ++ ) { 37 | 38 | particle = new THREE.Particle( material ); 39 | particle.position.x = Math.random() * 12000 - 6000; 40 | particle.position.y = Math.random() * 12000 - 6000; 41 | particle.position.z = Math.random() * 10000 - 8000; 42 | scene.addObject( particle ); 43 | 44 | mesh = galaxies[ i ] = new THREE.Mesh( new Plane( 400, 400, 2, 2 ), material2 ); 45 | mesh.position.x = particle.position.x; 46 | mesh.position.y = particle.position.y; 47 | mesh.position.z = particle.position.z; 48 | mesh.rotation.x = - 90 * Math.PI / 180; 49 | mesh.rotation.y = Math.random() * Math.PI; 50 | mesh.rotation.z = Math.random() * Math.PI; 51 | mesh.doubleSided = true; 52 | scene.addObject( mesh ); 53 | 54 | } 55 | 56 | // 57 | 58 | function loadImage( material, path ) { 59 | 60 | var image = new Image(); 61 | 62 | image.onload = function () { 63 | 64 | material.bitmap = this; 65 | 66 | }; 67 | 68 | image.src = path; 69 | material.bitmap = image; 70 | 71 | return material; 72 | 73 | } 74 | 75 | // 76 | 77 | this.show = function () { 78 | 79 | renderer.domElement.getContext( '2d' ).globalCompositeOperation = 'lighter'; 80 | 81 | }; 82 | 83 | this.update = function ( time ) { 84 | 85 | for ( var i = 0; i < 15; i ++ ) { 86 | 87 | mesh = galaxies[ i ]; 88 | mesh.rotation.z = - time * 2; 89 | 90 | } 91 | 92 | renderer.clear(); 93 | renderer.render( scene, camera ); 94 | 95 | }; 96 | 97 | }; 98 | 99 | 100 | Part5Effect.prototype = new Effect(); 101 | Part5Effect.prototype.constructor = Part5Effect; 102 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/effects/Part6Effect.js: -------------------------------------------------------------------------------- 1 | var Part6Effect = function ( camera, renderer ) { 2 | 3 | Effect.call( this ); 4 | 5 | // Init 6 | 7 | var particle, line, material, material2, scene, greetings; 8 | 9 | greetings = ["Ate Bit", "ASD", "CNCD", "DNA", "Evoflash", "Fairlight", "Farbrausch", "Orange"]; 10 | 11 | 12 | scene = new THREE.Scene(); 13 | 14 | material = loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/nova_particle.png' ); 15 | 16 | for (var i = 0; i < 64; i++) { 17 | 18 | particle = new THREE.Particle( material ); 19 | particle.position.x = Math.random() * 4000 - 2000; 20 | particle.position.y = Math.random() * 4000 - 2000; 21 | particle.position.z = Math.random() * 4000 - 2000; 22 | particle.scale.x = particle.scale.y = Math.random() * Math.random() * 1; 23 | scene.addObject( particle ); 24 | } 25 | 26 | particle = new THREE.Particle( loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/sun.png' ) ); 27 | scene.addObject( particle ); 28 | 29 | material = new THREE.LineColorMaterial( 0x008080, 1 ); 30 | material2 = loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/line_planet.png' ); 31 | 32 | for ( var j = 0; j < greetings.length; j ++ ) { 33 | 34 | var resolution = 60; 35 | var amplitude = 100 + ( j * ( Math.random() * 20 + 10 ) ); 36 | var size = 360 / resolution; 37 | 38 | geometry = new THREE.Geometry(); 39 | 40 | for ( var i = 0; i <= resolution; i ++ ) { 41 | 42 | segment = ( i * size ) * Math.PI / 180; 43 | geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( Math.cos( segment ) * amplitude, 0, Math.sin( segment ) * amplitude ) ) ); 44 | 45 | } 46 | 47 | line = new THREE.Line( geometry, material ); 48 | scene.addObject( line ); 49 | 50 | var rand = Math.random() * Math.PI * 2; 51 | 52 | particle = new THREE.Particle( material2 ); 53 | particle.position.x = Math.cos( rand ) * amplitude; 54 | particle.position.z = Math.sin( rand ) * amplitude; 55 | particle.scale.x = particle.scale.y = 0.3; 56 | scene.addObject( particle ); 57 | 58 | var textMaterial = new THREE.ParticleBitmapMaterial( createTextImage( greetings[ j ] ) ); 59 | textMaterial.offset.y = 35; 60 | 61 | particle = new THREE.Particle( textMaterial ); 62 | particle.position.x = Math.cos( rand ) * amplitude; 63 | // particle.position.y = 20; 64 | particle.position.z = Math.sin( rand ) * amplitude; 65 | particle.scale.x = particle.scale.y = 0.3; 66 | scene.addObject( particle ); 67 | 68 | } 69 | 70 | // 71 | 72 | function createTextImage( string ) { 73 | 74 | var canvas = document.createElement( 'canvas' ); 75 | canvas.width = 150; 76 | canvas.height = 35; 77 | 78 | var context = canvas.getContext( '2d' ); 79 | context.font = "30px Georgia"; 80 | context.fillStyle = "rgb(0, 255, 255)"; 81 | context.textAlign = "center"; 82 | context.fillText( string, canvas.width / 2, 25 ); 83 | 84 | return canvas; 85 | } 86 | 87 | function loadImage( material, path ) { 88 | 89 | var image = new Image(); 90 | 91 | image.onload = function () { 92 | 93 | material.bitmap = this; 94 | 95 | }; 96 | 97 | image.src = path; 98 | material.bitmap = image; 99 | 100 | return material; 101 | 102 | } 103 | 104 | // 105 | 106 | this.show = function () { 107 | 108 | renderer.domElement.getContext( '2d' ).globalCompositeOperation = 'lighter'; 109 | 110 | }; 111 | 112 | this.update = function ( time ) { 113 | 114 | renderer.clear(); 115 | renderer.render( scene, camera ); 116 | 117 | }; 118 | 119 | }; 120 | 121 | 122 | Part6Effect.prototype = new Effect(); 123 | Part6Effect.prototype.constructor = Part6Effect; 124 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/effects/Part7Effect.js: -------------------------------------------------------------------------------- 1 | var Part7Effect = function ( camera, renderer ) { 2 | 3 | Effect.call( this ); 4 | 5 | // Init 6 | 7 | var context, asteroids, particle, geometry, mesh, material, scene1, scene2; 8 | 9 | scene1 = new THREE.Scene(); 10 | scene2 = new THREE.Scene(); 11 | scene3 = new THREE.Scene(); 12 | 13 | particle = new THREE.Particle( loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/sun.png' ) ); 14 | particle.scale.x = particle.scale.y = 6; 15 | scene1.addObject( particle ); 16 | 17 | particle = new THREE.Particle( loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/Components/WebGL/orsotheysay/files/textures/sun2.png' ) ); 18 | particle.scale.x = particle.scale.y = 5; 19 | scene3.addObject( particle ); 20 | 21 | material = loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/nova_particle.png' ); 22 | 23 | for (var i = 0; i < 64; i++) { 24 | 25 | particle = new THREE.Particle( material ); 26 | particle.position.x = Math.random() * 4000 - 2000; 27 | particle.position.y = Math.random() * 4000 - 2000; 28 | particle.position.z = Math.random() * 4000 - 2000; 29 | particle.scale.x = particle.scale.y = Math.random() * Math.random(); 30 | scene1.addObject( particle ); 31 | } 32 | 33 | material = loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/asteroid.png' ); 34 | 35 | for (var i = 0; i < 40; i++) { 36 | 37 | particle = new THREE.Particle( material ); 38 | particle.position.x = Math.random() - 0.5; 39 | particle.position.y = Math.random() - 0.5; 40 | particle.position.normalize(); 41 | particle.position.multiplyScalar( Math.random() * 150 + 60 ); 42 | particle.position.z = Math.random() * 800 + 400; 43 | particle.rotation.z = Math.random() * Math.PI; 44 | particle.scale.x = particle.scale.y = 0.0001 + Math.random() * Math.random(); 45 | scene2.addObject( particle ); 46 | } 47 | 48 | 49 | asteroids = []; 50 | 51 | geometry = new Asteroid(); 52 | material = new THREE.MeshColorFillMaterial( 0x000000 ); 53 | 54 | for (var i = 0; i < 5; i++) { 55 | 56 | asteroids[ i ] = mesh = new THREE.Mesh( geometry, material ); 57 | mesh.position.x = Math.random() - 0.5; 58 | mesh.position.y = Math.random() - 0.5; 59 | mesh.position.normalize(); 60 | mesh.position.multiplyScalar( Math.random() * 60 + 20 ); 61 | mesh.position.z = Math.random() * 800 + 400; 62 | mesh.rotation.x = Math.random() * Math.PI; 63 | mesh.rotation.y = Math.random() * Math.PI; 64 | mesh.rotation.z = Math.random() * Math.PI; 65 | mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 5 + 1; 66 | mesh.overdraw = true; 67 | scene2.addObject( mesh ); 68 | 69 | } 70 | 71 | // 72 | 73 | function loadImage( material, path ) { 74 | 75 | var image = new Image(); 76 | 77 | image.onload = function () { 78 | 79 | material.bitmap = this; 80 | 81 | }; 82 | 83 | image.src = path; 84 | material.bitmap = image; 85 | 86 | return material; 87 | 88 | } 89 | 90 | // 91 | 92 | this.show = function () { 93 | 94 | renderer.domElement.getContext( '2d' ).globalCompositeOperation = 'lighter'; 95 | 96 | }; 97 | 98 | this.update = function ( time ) { 99 | 100 | for ( var i = 0, l = asteroids.length; i < l; i ++ ) { 101 | 102 | mesh = asteroids[ i ]; 103 | mesh.rotation.x = i + time * 2; 104 | mesh.rotation.y = i - time * 2; 105 | mesh.rotation.z = i + time * 2; 106 | 107 | } 108 | 109 | renderer.clear(); 110 | 111 | renderer.domElement.getContext( '2d' ).globalCompositeOperation = 'lighter'; 112 | renderer.render( scene1, camera ); 113 | 114 | renderer.domElement.getContext( '2d' ).globalCompositeOperation = 'source-over'; 115 | renderer.render( scene2, camera ); 116 | renderer.render( scene3, camera ); 117 | }; 118 | 119 | }; 120 | 121 | 122 | Part7Effect.prototype = new Effect(); 123 | Part7Effect.prototype.constructor = Part7Effect; 124 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/effects/Part8Effect.js: -------------------------------------------------------------------------------- 1 | var Part8Effect = function ( camera, renderer ) { 2 | 3 | Effect.call( this ); 4 | 5 | // Init 6 | 7 | var scene1, scene2, scene3, 8 | particle, mesh, material; 9 | 10 | scene1 = new THREE.Scene(); 11 | scene2 = new THREE.Scene(); 12 | //scene3 = new THREE.Scene(); 13 | 14 | particle = new THREE.Particle( loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/nebula.png' ) ); 15 | particle.position.x = - 400; 16 | particle.position.z = - 800; 17 | particle.scale.x = particle.scale.y = 6; 18 | scene1.addObject( particle ); 19 | 20 | //particle = new THREE.Particle( loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/atmosphere.png' ) ); 21 | //particle.scale.x = particle.scale.y = 0.52; 22 | //scene1.addObject( particle ); 23 | 24 | for (var i = 0; i < 1024; i++) { 25 | 26 | particle = new THREE.Particle( new THREE.ParticleCircleMaterial( 0xffffff, Math.random() * 0.5 + 0.5 ) ); 27 | particle.position.x = Math.random() * 4000 - 2000; 28 | particle.position.y = Math.random() * 4000 - 2000; 29 | particle.position.z = Math.random() * 4000 - 2000; 30 | particle.scale.x = particle.scale.y = Math.random() + 2; 31 | scene2.addObject( particle ); 32 | } 33 | 34 | 35 | //mesh = new THREE.Mesh( new Sphere( 200, 20, 20 ), loadImage( new THREE.MeshBitmapUVMappingMaterial(), '../Component/WebGL/orsotheysay/files/textures/earth.jpg' ) ); 36 | //scene2.addObject( mesh ); 37 | 38 | //mesh.scale.x = mesh.scale.x * 0.25; 39 | //mesh.scale.y = mesh.scale.y * 0.25; 40 | 41 | //particle = new THREE.Particle( loadImage( new THREE.ParticleBitmapMaterial(), '../Component/WebGL/orsotheysay/files/textures/atmosphere2.png' ) ); 42 | //particle.scale.x = particle.scale.y = 0.57; 43 | //scene3.addObject( particle ); 44 | 45 | // 46 | 47 | function loadImage( material, path ) { 48 | 49 | var image = new Image(); 50 | 51 | image.onload = function () { 52 | 53 | material.bitmap = this; 54 | 55 | }; 56 | 57 | image.src = path; 58 | material.bitmap = image; 59 | 60 | return material; 61 | 62 | } 63 | 64 | // 65 | 66 | this.show = function () { 67 | 68 | 69 | 70 | }; 71 | 72 | this.update = function ( time ) { 73 | 74 | //mesh.rotation.y = time * 0.5 + 2; 75 | 76 | renderer.clear(); 77 | renderer.domElement.getContext( '2d' ).globalCompositeOperation = 'lighter'; 78 | renderer.render( scene1, camera ); 79 | 80 | renderer.domElement.getContext( '2d' ).globalCompositeOperation = 'source-over'; 81 | renderer.render( scene2, camera ); 82 | 83 | /* 84 | renderer.domElement.getContext( '2d' ).globalCompositeOperation = 'lighter'; 85 | renderer.render( scene3, camera );*/ 86 | }; 87 | 88 | }; 89 | 90 | 91 | Part8Effect.prototype = new Effect(); 92 | Part8Effect.prototype.constructor = Part8Effect; 93 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/effects/Part9Effect.js: -------------------------------------------------------------------------------- 1 | var Part9Effect = function ( camera, renderer ) { 2 | 3 | Effect.call( this ); 4 | 5 | // Init 6 | 7 | this.show = function () { 8 | 9 | renderer.domElement.getContext( '2d' ).globalCompositeOperation = 'source-over'; 10 | 11 | }; 12 | 13 | this.update = function ( time ) { 14 | 15 | renderer.clear(); 16 | 17 | }; 18 | 19 | }; 20 | 21 | 22 | Part9Effect.prototype = new Effect(); 23 | Part9Effect.prototype.constructor = Part9Effect; 24 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/effects/Vector3TravelEffect.js: -------------------------------------------------------------------------------- 1 | var Vector3TravelEffect = function ( vector, start, end ) { 2 | 3 | Effect.call( this ); 4 | 5 | // Init 6 | 7 | var current, change, 8 | 9 | current = new THREE.Vector3(); 10 | change = new THREE.Vector3(); 11 | change.sub( end, start ); 12 | 13 | // Update 14 | 15 | this.update = function ( time ) { 16 | 17 | 18 | current.copy( change ); 19 | current.multiplyScalar( time ); 20 | current.addSelf( start ); 21 | vector.copy( current ); 22 | 23 | }; 24 | 25 | }; 26 | 27 | 28 | Vector3TravelEffect.prototype = new Effect(); 29 | Vector3TravelEffect.prototype.constructor = Vector3TravelEffect; 30 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/geometry/Asteroid.js: -------------------------------------------------------------------------------- 1 | var Asteroid = function () { 2 | 3 | var scope = this; 4 | 5 | THREE.Geometry.call(this); 6 | 7 | v( 0.000000, -3.052641, -0.000000 ); 8 | v( 1.850741, -1.143798, 1.344620 ); 9 | v( -0.817794, -1.323238, 2.517015 ); 10 | v( -2.681293, -1.340618, -0.000000 ); 11 | v( -0.773475, -1.251528, -2.380608 ); 12 | v( 1.489772, -0.920716, -1.082366 ); 13 | v( 0.826076, 1.336639, 2.542506 ); 14 | v( -1.684726, 1.041200, 1.224006 ); 15 | v( -2.252599, 1.392151, -1.636582 ); 16 | v( 0.681951, 1.103438, -2.098911 ); 17 | v( 2.429628, 1.214790, -0.000000 ); 18 | v( 0.000000, 2.496397, -0.000000 ); 19 | v( 1.516179, -3.032445, 1.101557 ); 20 | v( -0.508322, -2.661726, 1.564495 ); 21 | v( 0.704862, -1.409724, 2.169323 ); 22 | v( 1.354961, -2.709997, -0.984427 ); 23 | v( 2.395859, -1.480703, -0.000000 ); 24 | v( -1.527540, -2.471658, -0.000000 ); 25 | v( -1.800951, -1.375815, 1.308475 ); 26 | v( -0.407829, -2.135509, -1.255199 ); 27 | v( -1.799939, -1.375042, -1.307740 ); 28 | v( 0.862232, -1.724464, -2.653655 ); 29 | v( 2.859891, 0.000000, -0.929201 ); 30 | v( 2.197126, 0.000000, 0.713866 ); 31 | v( 1.901153, 0.000000, 2.616798 ); 32 | v( 0.000000, 0.000000, 2.296487 ); 33 | v( -1.228733, 0.000000, 1.691247 ); 34 | v( -2.553582, 0.000000, 0.829680 ); 35 | v( -2.091797, 0.000000, -0.679644 ); 36 | v( -1.601469, 0.000000, -2.204299 ); 37 | v( 0.000000, 0.000000, -2.753347 ); 38 | v( 1.819670, 0.000000, -2.504641 ); 39 | v( 1.852761, 1.415394, 1.346117 ); 40 | v( -0.634039, 1.268077, 1.951351 ); 41 | v( -3.131778, 1.935514, -0.000000 ); 42 | v( -0.717131, 1.434261, -2.207081 ); 43 | v( 1.735726, 1.325988, -1.261086 ); 44 | v( 1.250626, 2.023589, -0.000000 ); 45 | v( 0.601079, 3.147430, 1.849978 ); 46 | v( -1.448289, 2.896660, 1.052233 ); 47 | v( -0.755228, 1.510489, -0.548699 ); 48 | v( 0.445911, 2.334923, -1.372408 ); 49 | 50 | f3( 14, 12, 1 ); 51 | f3( 12, 14, 13 ); 52 | f3( 2, 13, 14 ); 53 | f3( 13, 0, 12 ); 54 | f3( 16, 1, 12 ); 55 | f3( 12, 15, 16 ); 56 | f3( 5, 16, 15 ); 57 | f3( 12, 0, 15 ); 58 | f3( 18, 13, 2 ); 59 | f3( 13, 18, 17 ); 60 | f3( 3, 17, 18 ); 61 | f3( 17, 0, 13 ); 62 | f3( 20, 17, 3 ); 63 | f3( 17, 20, 19 ); 64 | f3( 4, 19, 20 ); 65 | f3( 19, 0, 17 ); 66 | f3( 21, 19, 4 ); 67 | f3( 19, 21, 15 ); 68 | f3( 5, 15, 21 ); 69 | f3( 15, 0, 19 ); 70 | f3( 23, 1, 16 ); 71 | f3( 16, 22, 23 ); 72 | f3( 10, 23, 22 ); 73 | f3( 22, 16, 5 ); 74 | f3( 25, 2, 14 ); 75 | f3( 14, 24, 25 ); 76 | f3( 6, 25, 24 ); 77 | f3( 24, 14, 1 ); 78 | f3( 27, 3, 18 ); 79 | f3( 18, 26, 27 ); 80 | f3( 7, 27, 26 ); 81 | f3( 26, 18, 2 ); 82 | f3( 29, 4, 20 ); 83 | f3( 20, 28, 29 ); 84 | f3( 8, 29, 28 ); 85 | f3( 28, 20, 3 ); 86 | f3( 31, 5, 21 ); 87 | f3( 21, 30, 31 ); 88 | f3( 9, 31, 30 ); 89 | f3( 30, 21, 4 ); 90 | f3( 32, 23, 10 ); 91 | f3( 23, 32, 24 ); 92 | f3( 6, 24, 32 ); 93 | f3( 24, 1, 23 ); 94 | f3( 33, 25, 6 ); 95 | f3( 25, 33, 26 ); 96 | f3( 7, 26, 33 ); 97 | f3( 26, 2, 25 ); 98 | f3( 34, 27, 7 ); 99 | f3( 27, 34, 28 ); 100 | f3( 8, 28, 34 ); 101 | f3( 28, 3, 27 ); 102 | f3( 35, 29, 8 ); 103 | f3( 29, 35, 30 ); 104 | f3( 9, 30, 35 ); 105 | f3( 30, 4, 29 ); 106 | f3( 36, 31, 9 ); 107 | f3( 31, 36, 22 ); 108 | f3( 10, 22, 36 ); 109 | f3( 22, 5, 31 ); 110 | f3( 38, 6, 32 ); 111 | f3( 32, 37, 38 ); 112 | f3( 11, 38, 37 ); 113 | f3( 37, 32, 10 ); 114 | f3( 39, 7, 33 ); 115 | f3( 33, 38, 39 ); 116 | f3( 11, 39, 38 ); 117 | f3( 38, 33, 6 ); 118 | f3( 40, 8, 34 ); 119 | f3( 34, 39, 40 ); 120 | f3( 11, 40, 39 ); 121 | f3( 39, 34, 7 ); 122 | f3( 41, 9, 35 ); 123 | f3( 35, 40, 41 ); 124 | f3( 11, 41, 40 ); 125 | f3( 40, 35, 8 ); 126 | f3( 37, 10, 36 ); 127 | f3( 36, 41, 37 ); 128 | f3( 11, 37, 41 ); 129 | f3( 41, 36, 9 ); 130 | 131 | function v( x, y, z ) { 132 | 133 | scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) ); 134 | 135 | } 136 | 137 | function f3( a, b, c, nx, ny, nz ) { 138 | 139 | scope.faces.push( new THREE.Face3( a, b, c, nx && ny && nz ? new THREE.Vector3( nx, ny, nz ) : null ) ); 140 | 141 | } 142 | 143 | function f4( a, b, c, d, nx, ny, nz ) { 144 | 145 | scope.faces.push( new THREE.Face4( a, b, c, d, nx && ny && nz ? new THREE.Vector3( nx, ny, nz ) : null ) ); 146 | 147 | } 148 | 149 | function uv( u1, v1, u2, v2, u3, v3, u4, v4 ) { 150 | 151 | var uv = []; 152 | uv.push( new THREE.UV( u1, v1 ) ); 153 | uv.push( new THREE.UV( u2, v2 ) ); 154 | uv.push( new THREE.UV( u3, v3 ) ); 155 | if ( u4 && v4 ) uv.push( new THREE.UV( u4, v4 ) ); 156 | scope.uvs.push( uv ); 157 | } 158 | 159 | } 160 | 161 | Asteroid.prototype = new THREE.Geometry(); 162 | Asteroid.prototype.constructor = Asteroid; -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/geometry/Cube.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | var Cube = function (width, height, depth) { 6 | 7 | THREE.Geometry.call(this); 8 | 9 | var scope = this, 10 | width_half = width / 2, 11 | height_half = height / 2, 12 | depth_half = depth / 2; 13 | 14 | v( width_half, height_half, -depth_half ); 15 | v( width_half, -height_half, -depth_half ); 16 | v( -width_half, -height_half, -depth_half ); 17 | v( -width_half, height_half, -depth_half ); 18 | v( width_half, height_half, depth_half ); 19 | v( width_half, -height_half, depth_half ); 20 | v( -width_half, -height_half, depth_half ); 21 | v( -width_half, height_half, depth_half ); 22 | 23 | f4( 0, 1, 2, 3 ); 24 | f4( 4, 7, 6, 5 ); 25 | f4( 0, 4, 5, 1 ); 26 | f4( 1, 5, 6, 2 ); 27 | f4( 2, 6, 7, 3 ); 28 | f4( 4, 0, 3, 7 ); 29 | 30 | function v(x, y, z) { 31 | 32 | scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) ); 33 | } 34 | 35 | function f4(a, b, c, d) { 36 | 37 | scope.faces.push( new THREE.Face4( a, b, c, d ) ); 38 | } 39 | 40 | this.computeNormals(); 41 | 42 | } 43 | 44 | Cube.prototype = new THREE.Geometry(); 45 | Cube.prototype.constructor = Cube; 46 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/geometry/Plane.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as 4 | */ 5 | 6 | var Plane = function ( width, height, segments_width, segments_height ) { 7 | 8 | THREE.Geometry.call( this ); 9 | 10 | var ix, iy, 11 | width_half = width / 2, 12 | height_half = height / 2, 13 | gridX = segments_width || 1, 14 | gridY = segments_height || 1, 15 | gridX1 = gridX + 1, 16 | gridY1 = gridY + 1, 17 | segment_width = width / gridX, 18 | segment_height = height / gridY; 19 | 20 | 21 | for( iy = 0; iy < gridY1; iy++ ) { 22 | 23 | for( ix = 0; ix < gridX1; ix++ ) { 24 | 25 | var x = ix * segment_width - width_half; 26 | var y = iy * segment_height - height_half; 27 | 28 | this.vertices.push( new THREE.Vertex( new THREE.Vector3( x, - y, 0 ) ) ); 29 | 30 | } 31 | 32 | } 33 | 34 | for( iy = 0; iy < gridY; iy++ ) { 35 | 36 | for( ix = 0; ix < gridX; ix++ ) { 37 | 38 | var a = ix + gridX1 * iy; 39 | var b = ix + gridX1 * ( iy + 1 ); 40 | var c = ( ix + 1 ) + gridX1 * ( iy + 1 ); 41 | var d = ( ix + 1 ) + gridX1 * iy; 42 | 43 | this.faces.push( new THREE.Face4( a, b, c, d ) ); 44 | this.uvs.push( [ 45 | new THREE.UV( ix / gridX, iy / gridY ), 46 | new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ), 47 | new THREE.UV( ( ix + 1 ) / gridX, ( iy + 1 ) / gridY ), 48 | new THREE.UV( ( ix + 1 ) / gridX, iy / gridY ) 49 | ] ); 50 | 51 | } 52 | 53 | } 54 | 55 | this.computeNormals(); 56 | 57 | } 58 | 59 | Plane.prototype = new THREE.Geometry(); 60 | Plane.prototype.constructor = Plane; 61 | -------------------------------------------------------------------------------- /Component/WebGL/orsotheysay/js/geometry/Sphere.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Sphere.as 4 | */ 5 | 6 | var Sphere = function ( radius, segments_width, segments_height ) { 7 | 8 | THREE.Geometry.call( this ); 9 | 10 | var gridX = segments_width || 8, 11 | gridY = segments_height || 6; 12 | 13 | var i, j; 14 | var iHor = Math.max( 3, gridX ); 15 | var iVer = Math.max( 2, gridY ); 16 | var aVtc = []; 17 | 18 | for ( j = 0; j < ( iVer + 1 ) ; j++ ) { 19 | 20 | var fRad1 = j / iVer; 21 | var fZ = radius * Math.cos( fRad1 * Math.PI ); 22 | var fRds = radius * Math.sin( fRad1 * Math.PI ); 23 | var aRow = []; 24 | var oVtx = 0; 25 | 26 | for ( i = 0; i < iHor; i++ ) { 27 | 28 | var fRad2 = 2 * i / iHor; 29 | var fX = fRds * Math.sin( fRad2 * Math.PI ); 30 | var fY = fRds * Math.cos( fRad2 * Math.PI ); 31 | 32 | if ( !( ( j == 0 || j == iVer ) && i > 0 ) ) { 33 | 34 | oVtx = this.vertices.push( new THREE.Vertex( new THREE.Vector3( fY, fZ, fX ) ) ) - 1; 35 | 36 | } 37 | 38 | aRow.push( oVtx ); 39 | 40 | } 41 | 42 | aVtc.push( aRow ); 43 | 44 | } 45 | 46 | var iVerNum = aVtc.length; 47 | 48 | for ( j = 0; j < iVerNum; j++ ) { 49 | 50 | var iHorNum = aVtc[ j ].length; 51 | 52 | if ( j > 0 ) { 53 | 54 | for ( i = 0; i < iHorNum; i++ ) { 55 | 56 | var bEnd = i == ( iHorNum - 1 ); 57 | var aP1 = aVtc[ j ][ bEnd ? 0 : i + 1 ]; 58 | var aP2 = aVtc[ j ][ ( bEnd ? iHorNum - 1 : i ) ]; 59 | var aP3 = aVtc[ j - 1 ][ ( bEnd ? iHorNum - 1 : i ) ]; 60 | var aP4 = aVtc[ j - 1 ][ bEnd ? 0 : i + 1 ]; 61 | 62 | var fJ0 = j / ( iVerNum - 1 ); 63 | var fJ1 = ( j - 1 ) / ( iVerNum - 1 ); 64 | var fI0 = ( i + 1 ) / iHorNum; 65 | var fI1 = i / iHorNum; 66 | 67 | var aP1uv = new THREE.UV( 1 - fI0, fJ0 ); 68 | var aP2uv = new THREE.UV( 1 - fI1, fJ0 ); 69 | var aP3uv = new THREE.UV( 1 - fI1, fJ1 ); 70 | var aP4uv = new THREE.UV( 1 - fI0, fJ1 ); 71 | 72 | if ( j < ( aVtc.length - 1 ) ) { 73 | 74 | this.faces.push( new THREE.Face3( aP1, aP2, aP3 ) ); 75 | this.uvs.push( [ aP1uv, aP2uv, aP3uv ] ); 76 | 77 | } 78 | 79 | if ( j > 1 ) { 80 | 81 | this.faces.push( new THREE.Face3( aP1, aP3, aP4 ) ); 82 | this.uvs.push( [ aP1uv, aP3uv, aP4uv ] ); 83 | 84 | } 85 | 86 | } 87 | } 88 | } 89 | } 90 | 91 | Sphere.prototype = new THREE.Geometry(); 92 | Sphere.prototype.constructor = Sphere; 93 | -------------------------------------------------------------------------------- /DirectProvider/1.0.js: -------------------------------------------------------------------------------- 1 | Ext.namespace( 'Ext.php' ); 2 | Ext.php.REMOTING_API = {"url":"\/direct.php","type":"remoting","namespace":"Ext.php","descriptor":"Ext.php.REMOTING_API","actions":{"OTTRemote":[{"name":"login","len":2}]}}; 3 | Ext.Direct.addProvider( Ext.php.REMOTING_API ); -------------------------------------------------------------------------------- /Extanium/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/Extanium/.DS_Store -------------------------------------------------------------------------------- /Extanium/Activity.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class Ext.Activity 3 | * @extends Object 4 | * 5 | *

6 | * Constructs the activity which is wrapped inside 7 | * an abstract class to provide further abstraction. 8 | *

9 | * 10 | *

11 | * You may extend this class by calling Ext.createActivity(): 12 | *

13 | * 14 | *

15 | *

 16 |  * Ext.createActivity('Main', {
 17 |  *
 18 |  *   
 19 |  *   // Instance storage
 20 |  *   mainScreen: null,
 21 |  *
 22 |  *   start: function() {
 23 |  *   
 24 |  *       // Main screen
 25 |  *       this.mainScreen = Ext.initCmp("MainScreen");
 26 |  *       this.mainScreen.show();
 27 |  *   },
 28 |  *   
 29 |  *   stop: function() {
 30 |  *   
 31 |  *       // Close and delete main screen instance
 32 |  *       this.mainScreen.hide();
 33 |  *       delete this.mainScreen;
 34 |  *   }
 35 |  * });
 36 |  *
 37 |  * 
38 | *

39 | * 40 | *

41 | * Save this class in a new file in folder /Activities 42 | * with the same name as the Activity (Main.js). 43 | *

44 | * 45 | *

46 | * You can start the Activity by calling Ext.startActivity('Main'); 47 | * You can also implement special start methods for different device types: 48 | *

49 | * 50 | *

51 | * startiPhone(), startiPad(), startAndroid() will be started if defined 52 | * rather than start() which is a general purpose start method. 53 | *

54 | */ 55 | Ext.Activity = Ext.extend(Object, { 56 | 57 | 58 | constructor: function(cfg) { 59 | 60 | // Overlay prototype by instance config 61 | Ext.applyIf(this, cfg); 62 | 63 | // Call the init method 64 | this.init(); 65 | 66 | // For switched startup 67 | if (Ext.isAndroid) { 68 | 69 | // Start on Android 70 | this.startAndroid(); 71 | } 72 | 73 | if (Ext.isiPhone) { 74 | 75 | // Start on iPhone 76 | this.startiPhone(); 77 | } 78 | 79 | 80 | if (Ext.isiPad) { 81 | 82 | // Start on iPad 83 | this.startiPad(); 84 | } 85 | }, 86 | 87 | 88 | /** 89 | * Initializes an Activity 90 | * @return {void} 91 | */ 92 | init: function() { 93 | Ext.log("You may override the init() method while implementing an Activity!"); 94 | }, 95 | 96 | 97 | /** 98 | * The general activity starting method. 99 | * Should be overridden, if needed. 100 | * 101 | * @return {void} 102 | */ 103 | start: function() { 104 | Ext.log("You may override the start() method while implementing an Activity!"); 105 | }, 106 | 107 | 108 | /** 109 | * Starts on ANDROID devices ONLY. 110 | * Override this method to implement a startup, 111 | * specially for Android devices. 112 | * 113 | * @return {void} 114 | */ 115 | startAndroid: function() { 116 | this.start(); 117 | }, 118 | 119 | 120 | /** 121 | * Starts on IPHONE devices ONLY. 122 | * Override this method to implement a startup, 123 | * specially for iPhone devices. 124 | * 125 | * @return {void} 126 | */ 127 | startiPhone: function() { 128 | this.start(); 129 | }, 130 | 131 | 132 | /** 133 | * Starts on IPAD devices ONLY. 134 | * Override this method to implement a startup, 135 | * specially for iPad devices. 136 | * 137 | * @return {void} 138 | */ 139 | startiPad: function() { 140 | this.start(); 141 | }, 142 | 143 | 144 | 145 | /** 146 | * Stops the activity 147 | * 148 | * @return {void} 149 | */ 150 | stop: function() { 151 | Ext.log("You may override the stop() method while implementing an Activity!"); 152 | } 153 | }); -------------------------------------------------------------------------------- /Extanium/Ajax.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class Ext.Ajax 3 | * 4 | *

5 | * The Ajax class implements a lazy configurable AJAX wrapper in style
6 | * of the ExtJS framework. 7 | *

8 | * 9 | *

10 | * By calling new Ext.Ajax().request(cfg) or the global function AjaxRequest(cfg)
11 | * you can specify all needed parameters. By assigning the success() or failure()
12 | * methods you get the results. 13 | *

14 | * 15 | *

16 | * Possible configuration: 17 | *

18 | * 19 | *

20 | *

 21 |  * new Ext.Ajax().request({
 22 |  *     url: '',
 23 |  *     success: function(result) {},
 24 |  *     failure: function() {},
 25 |  *     headers: { // Special HTTP request headers like X-*
 26 |  *         X-Requested-With: 'Extanium'
 27 |  *     },
 28 |  *     params: { // HTTP POST parameters
 29 |  *         user: 'foo',
 30 |  *         password: 'bar'
 31 |  *     }, // OR INSTEAD OF params!! data: 'ABC' for plain data sending
 32 |  *     timeout: 5, // In seconds
 33 |  *     method: 'POST', // Which HTTP method to use?
 34 |  *     json: true, // Parse incomming text-result automatically and provide result.json object
 35 |  *     async: true, 
 36 |  *     secure: false // HTTPS cert checking
 37 |  * });
 38 |  * 
39 | *

40 | * 41 | *

42 | * The example above shows the default conifugration. 43 | *

44 | * 45 | *

46 | *

 47 |  * success: function(result) {
 48 |  *     Ext.debug(result.data);
 49 |  *     Ext.debug(result.xml);
 50 |  *     Ext.debug(result.text);
 51 |  *     Ext.debug(result.json); // Only if json: true is defined (provides auto-deserialization)
 52 |  * } 
 53 |  * 
54 | *

55 | */ 56 | Ext.Ajax = Ext.extend(Object, { 57 | 58 | 59 | // HTTP client instance 60 | httpClient: null, 61 | 62 | 63 | // Was the request already dispatched? 64 | alreadyDispatched: false, 65 | 66 | 67 | // Request configuration 68 | cfg: null, 69 | 70 | 71 | /** 72 | *

73 | * Configures and starts a HTTP AJAX-request 74 | *

75 | * 76 | *

77 | * A request configuration object may contain: 78 | *

79 | * 80 | *

81 | *

 82 |      * new Ext.Ajax().request({
 83 |      *     url: '',
 84 |      *     success: function(result) {},
 85 |      *     failure: function() {},
 86 |      *     headers: { // Special HTTP request headers like X-*
 87 |      *         X-Requested-With: 'Extanium'
 88 |      *     },
 89 |      *     params: { // HTTP POST parameters
 90 |      *         user: 'foo',
 91 |      *         password: 'bar'
 92 |      *     }, // OR INSTEAD OF params!! data: 'ABC' for plain data sending
 93 |      *     timeout: 5, // In seconds
 94 |      *     method: 'POST', // Which HTTP method to use?
 95 |      *     json: true, // Parse incomming text-result automatically and provide result.json object
 96 |      *     async: true, 
 97 |      *     secure: false // HTTPS cert checking
 98 |      * });
 99 |      * 
100 | *

101 | * 102 | * @param {Object} cfg Configuration of a request 103 | * @return {Ti.Network.HttpClient|Boolean} HTTP client instance or false 104 | */ 105 | request: function(cfg) { 106 | 107 | // Return false if device is offline 108 | if (!Titanium.Network.online) { 109 | return false; 110 | } 111 | 112 | // Create HTTP client instance 113 | this.httpClient = Ti.Network.createHTTPClient(); 114 | 115 | // Evaluate JSON request configuration 116 | var isJsonRequest = false; 117 | if (Ext.isDefined(cfg.json) && cfg.json === true) { 118 | isJsonRequest = true; 119 | } 120 | 121 | // Evaluates SSL cert checking 122 | if (Ext.isDefined(cfg.secure) && cfg.secure === true) { 123 | this.httpClient.validatesSecureCertificate = true; 124 | } 125 | 126 | // Success method override 127 | if (Ext.isDefined(cfg.success) && Ext.isFunction(cfg.success)) { 128 | this.success = cfg.success; 129 | } 130 | 131 | // Failure method override 132 | if (Ext.isDefined(cfg.failure) && Ext.isFunction(cfg.failure)) { 133 | this.failure = cfg.failure; 134 | 135 | // Add error handler 136 | var thiz = this; 137 | this.httpClient.onerror = function() { 138 | 139 | // Only add to OfflineAjax-Stack if network is not available 140 | if (!Titanium.Network.online) { 141 | Ext.OfflineAjax.register(thiz.cfg); 142 | } 143 | thiz.failure(arguments); 144 | }; 145 | } 146 | 147 | // Evaluate headers to setRequestHeader() 148 | var headers = {}; 149 | if (Ext.isDefined(cfg.headers) && Ext.isObject(cfg.headers)) { 150 | headers = cfg.headers; 151 | 152 | // Set request headers 153 | this.httpClient.setRequestHeader(headers); 154 | } 155 | 156 | // Evaluate data to send() 157 | var sendData = null; 158 | if (Ext.isDefined(cfg.params)) { 159 | sendData = cfg.params; 160 | } 161 | 162 | // Evaluate timeout (Default: 10 seconds) 163 | var timeout = 10000; 164 | if (Ext.isDefined(cfg.timeout) && Ext.isNumber(cfg.timeout)) { 165 | timeout = cfg.timeout; 166 | 167 | // Set timeout 168 | this.httpClient.setTimeout(timeout); 169 | } 170 | 171 | // Evaluate synchronous or asynchronous calling 172 | var async = false; 173 | if (Ext.isDefined(cfg.async) && Ext.isBoolean(cfg.async)) { 174 | async = cfg.async; 175 | } 176 | 177 | // Evaluate the HTTP method 178 | var method = 'GET'; 179 | if (Ext.isDefined(cfg.method) && Ext.isString(cfg.method)) { 180 | method = cfg.method; 181 | } 182 | 183 | // Evaluate the url 184 | var url = ''; 185 | if (Ext.isDefined(cfg.url) && Ext.isString(cfg.url)) { 186 | url = cfg.url; 187 | } 188 | 189 | // Fatal error if URL is not set! 190 | if (url === '') { 191 | throw Exception('You should at least set an url if you want to do AJAX requests!'); 192 | } 193 | 194 | // Add ready state handler 195 | var thiz = this; 196 | this.httpClient.onreadystatechange = function() { 197 | 198 | // LOAD && 200 OK 199 | if (thiz.httpClient.readyState == 4 && thiz.httpClient.status == 200 200 | && thiz.alreadyDispatched != true) { 201 | 202 | if (Ext.isDefined(thiz.httpClient.responseText) && 203 | thiz.httpClient.responseText.length > 0) { 204 | 205 | var data = { 206 | text: thiz.httpClient.responseText, 207 | data: thiz.httpClient.responseData, 208 | xml: thiz.httpClient.responseXml 209 | }; 210 | 211 | // JSON hook 212 | if (isJsonRequest) { 213 | data.json = JSON.parse(data.text); 214 | } 215 | 216 | // Call the success method with data 217 | thiz.success(data); 218 | 219 | // Set dispatch flag 220 | thiz.alreadyDispatched = true; 221 | } 222 | } 223 | }; 224 | 225 | 226 | // Open request 227 | this.httpClient.open(method, url, async); 228 | 229 | // Send request 230 | if (sendData == null) { 231 | sendData = cfg.data; 232 | } 233 | this.httpClient.send(sendData); 234 | 235 | }, 236 | 237 | 238 | /* 239 | * This method will be called when a AJAX request successes.
240 | * You may override this method by success: function() {} config. 241 | * 242 | * @param {Object} data Data object holding the attributes text, data, xml and json if json: true was configured! 243 | * @return {void} 244 | */ 245 | success: function(data) { 246 | Ext.log('You may override the success() method by configuration.', Ext.LOGLEVEL_DEBUG); 247 | }, 248 | 249 | 250 | /** 251 | * This method will be called when a AJAX request fails.
252 | * You may override this method by failure: function() {} config. 253 | * 254 | * @return {void} 255 | */ 256 | failure: function() { 257 | 258 | Ext.log('You may override the failure() method by configuration.'); 259 | Ext.log('An AJAX-Error occurted.', Ext.LOGLEVEL_DEBUG); 260 | }, 261 | 262 | 263 | /** 264 | * Aborts a request if sent 265 | * @return {void} 266 | */ 267 | abort: function() { 268 | if (this.httpClient != null) { 269 | this.httpClient.abort(); 270 | } 271 | } 272 | }); 273 | 274 | /** 275 | * Function to call servers by Ajax/HTTP 276 | * 277 | * @param {Object} cfg Ajax instance configuration 278 | * @return {Ext.Ajax} Ajax object instance 279 | */ 280 | var AjaxRequest = function(cfg) { 281 | var ajax = new Ext.Ajax(); 282 | ajax.request(cfg); 283 | return ajax; 284 | } 285 | -------------------------------------------------------------------------------- /Extanium/Application.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class Ext.Application 3 | * @extends Object 4 | *

5 | * This class introduces the App class prototype for inheritance. 6 | * Normally this class in only used in /Application.js to define an 7 | * global application class. 8 | *

9 | * 10 | *

11 | * By default an instance of that class will be created in the app.js 12 | * and the start() method will be called automatically with that operation 13 | * since the onstructor calls it. 14 | *

15 | * 16 | *

17 | * So if you see some new App() in app.js the start() method of the Application.js will be called. 18 | *

19 | */ 20 | Ext.Application = Ext.extend(Object, { 21 | 22 | 23 | constructor: function() { 24 | 25 | // Sets up the runtime 26 | Ext.setupRuntime(); 27 | 28 | // Starts the app 29 | this.start(); 30 | }, 31 | 32 | 33 | /** 34 | * Starts the application 35 | * @return {void} 36 | */ 37 | start: function() { 38 | Ext.log("The start() method of the Application should be overridden."); 39 | } 40 | }); -------------------------------------------------------------------------------- /Extanium/Component/WebGL/Stats.js: -------------------------------------------------------------------------------- 1 | try { 2 | 3 | // stats.js r5 - http://github.com/mrdoob/stats.js 4 | var Stats=function(){var j=0,u=2,r,C=0,E=new Date().getTime(),w=E,f=E,m=0,e=1000,i=0,F,q,c,d,B,k=0,G=1000,a=0,A,t,p,D,l,v=0,o=1000,s=0,h,n,z,g,b,y={fps:{bg:{r:16,g:16,b:48},fg:{r:0,g:255,b:255}},ms:{bg:{r:16,g:48,b:16},fg:{r:0,g:255,b:0}},mem:{bg:{r:48,g:16,b:26},fg:{r:255,g:0,b:128}}};r=document.createElement("div");r.style.fontFamily="Helvetica, Arial, sans-serif";r.style.textAlign="left";r.style.fontSize="9px";r.style.opacity="0.9";r.style.width="80px";r.style.cursor="pointer";r.addEventListener("click",H,false);F=document.createElement("div");F.style.backgroundColor="rgb("+Math.floor(y.fps.bg.r/2)+","+Math.floor(y.fps.bg.g/2)+","+Math.floor(y.fps.bg.b/2)+")";F.style.padding="2px 0px 3px 0px";r.appendChild(F);q=document.createElement("div");q.innerHTML="FPS";q.style.color="rgb("+y.fps.fg.r+","+y.fps.fg.g+","+y.fps.fg.b+")";q.style.margin="0px 0px 1px 3px";F.appendChild(q);c=document.createElement("canvas");c.width=74;c.height=30;c.style.display="block";c.style.marginLeft="3px";F.appendChild(c);d=c.getContext("2d");d.fillStyle="rgb("+y.fps.bg.r+","+y.fps.bg.g+","+y.fps.bg.b+")";d.fillRect(0,0,c.width,c.height);B=d.getImageData(0,0,c.width,c.height);A=document.createElement("div");A.style.backgroundColor="rgb("+Math.floor(y.ms.bg.r/2)+","+Math.floor(y.ms.bg.g/2)+","+Math.floor(y.ms.bg.b/2)+")";A.style.padding="2px 0px 3px 0px";A.style.display="none";r.appendChild(A);t=document.createElement("div");t.innerHTML="MS";t.style.color="rgb("+y.ms.fg.r+","+y.ms.fg.g+","+y.ms.fg.b+")";t.style.margin="0px 0px 1px 3px";A.appendChild(t);p=document.createElement("canvas");p.width=74;p.height=30;p.style.display="block";p.style.marginLeft="3px";A.appendChild(p);D=p.getContext("2d");D.fillStyle="rgb("+y.ms.bg.r+","+y.ms.bg.g+","+y.ms.bg.b+")";D.fillRect(0,0,p.width,p.height);l=D.getImageData(0,0,p.width,p.height);try{if(webkitPerformance&&webkitPerformance.memory.totalJSHeapSize){u=3}}catch(x){}h=document.createElement("div");h.style.backgroundColor="rgb("+Math.floor(y.mem.bg.r/2)+","+Math.floor(y.mem.bg.g/2)+","+Math.floor(y.mem.bg.b/2)+")";h.style.padding="2px 0px 3px 0px";h.style.display="none";r.appendChild(h);n=document.createElement("div");n.innerHTML="MEM";n.style.color="rgb("+y.mem.fg.r+","+y.mem.fg.g+","+y.mem.fg.b+")";n.style.margin="0px 0px 1px 3px";h.appendChild(n);z=document.createElement("canvas");z.width=74;z.height=30;z.style.display="block";z.style.marginLeft="3px";h.appendChild(z);g=z.getContext("2d");g.fillStyle="#301010";g.fillRect(0,0,z.width,z.height);b=g.getImageData(0,0,z.width,z.height);function I(N,M,K){var J,O,L;for(O=0;O<30;O++){for(J=0;J<73;J++){L=(J+O*74)*4;N[L]=N[L+4];N[L+1]=N[L+5];N[L+2]=N[L+6]}}for(O=0;O<30;O++){L=(73+O*74)*4;if(O"+k+" MS ("+G+"-"+a+")";D.putImageData(l,0,0);w=E;if(E>f+1000){m=Math.round((C*1000)/(E-f));e=Math.min(e,m);i=Math.max(i,m);I(B.data,Math.min(30,30-(m/100)*30),"fps");q.innerHTML=""+m+" FPS ("+e+"-"+i+")";d.putImageData(B,0,0);if(u==3){v=webkitPerformance.memory.usedJSHeapSize*9.54e-7;o=Math.min(o,v);s=Math.max(s,v);I(b.data,Math.min(30,30-(v/2)),"mem");n.innerHTML=""+Math.round(v)+" MEM ("+Math.round(o)+"-"+Math.round(s)+")";g.putImageData(b,0,0)}f=E;C=0}}}}; 5 | 6 | } catch (e) { 7 | alert("Error executing 3D script @ Stats.js:"); 8 | alert(e); 9 | } 10 | -------------------------------------------------------------------------------- /Extanium/Component/WebGL/cameras/FreeCamera.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.FreeCamera = function ( x, y, z ) { 6 | 7 | THREE.Camera.call( this, x, y, z ); 8 | 9 | this.rotation = new THREE.Vector3( 0, 0, 0 ); 10 | 11 | this.moveZ = function ( amount ) { 12 | 13 | direction.set( this.matrix.n11, this.target.position, this.position ); 14 | depth = direction.length(); 15 | 16 | direction.normalize(); 17 | 18 | vector.copy( direction ); 19 | vector.multiplyScalar( amount ); 20 | 21 | direction.multiplyScalar( depth ); 22 | 23 | this.position.addSelf( vector ); 24 | this.target.position.add( this.position, direction ); 25 | 26 | }; 27 | 28 | this.updateMatrix = function () { 29 | 30 | this.matrix.identity(); 31 | 32 | this.matrix.multiplySelf( THREE.Matrix4.translationMatrix( this.position.x, this.position.y, this.position.z ) ); 33 | this.matrix.multiplySelf( THREE.Matrix4.rotationXMatrix( this.rotation.x ) ); 34 | this.matrix.multiplySelf( THREE.Matrix4.rotationYMatrix( this.rotation.y ) ); 35 | this.matrix.multiplySelf( THREE.Matrix4.rotationZMatrix( this.rotation.z ) ); 36 | }; 37 | 38 | /* 39 | var depth = 0; 40 | var vector = new THREE.Vector3(); 41 | var direction = new THREE.Vector3(); 42 | 43 | this.moveX = function ( amount ) { 44 | 45 | direction.sub( this.target.position, this.position ); 46 | depth = direction.length(); 47 | 48 | direction.normalize(); 49 | 50 | vector.copy( this.up ); 51 | vector.crossSelf( direction ); 52 | vector.multiplyScalar( amount ); 53 | 54 | direction.multiplyScalar( depth ); 55 | 56 | this.position.subSelf( vector ); 57 | this.target.position.add( this.position, direction ); 58 | 59 | }; 60 | 61 | this.moveZ = function ( amount ) { 62 | 63 | direction.sub( this.target.position, this.position ); 64 | depth = direction.length(); 65 | 66 | direction.normalize(); 67 | 68 | vector.copy( direction ); 69 | vector.multiplyScalar( amount ); 70 | 71 | direction.multiplyScalar( depth ); 72 | 73 | this.position.addSelf( vector ); 74 | this.target.position.add( this.position, direction ); 75 | 76 | }; 77 | 78 | this.rotateX = function( amount ) { // pitch 79 | 80 | amount *= Math.PI / 180; 81 | 82 | vector.x = direction.x; 83 | vector.y = ( direction.y * Math.cos( amount ) ) - ( direction.z * Math.sin( amount ) ); 84 | vector.z = ( direction.y * Math.sin( amount ) ) + ( direction.z * Math.cos( amount ) ); 85 | 86 | direction.copy( vector ); 87 | 88 | vector.set( direction.x, direction.y, direction.z ); 89 | vector.multiplyScalar( 400 ); 90 | 91 | this.target.position.copy( this.position ); 92 | this.target.position.addSelf( vector ); 93 | 94 | }; 95 | 96 | this.rotateY = function( amount ) { // yaw 97 | 98 | amount *= Math.PI / 180; 99 | 100 | direction.sub( this.position, this.target.position ); 101 | depth = direction.length(); 102 | 103 | direction.normalize(); 104 | 105 | vector.x = ( direction.z * Math.sin( amount ) ) + ( direction.x * Math.cos( amount ) ); 106 | vector.y = direction.y; 107 | vector.z = ( direction.z * Math.cos( amount ) ) - ( direction.x * Math.sin( amount ) ); 108 | 109 | direction.copy( vector ); 110 | direction.multiplyScalar( depth ); 111 | 112 | this.target.position.sub( this.position, direction ); 113 | 114 | }; 115 | 116 | this.rotateZ = function( amount ) { // roll 117 | 118 | amount *= Math.PI / 180; 119 | 120 | vector.x = ( this.up.x * Math.cos( amount ) ) - ( this.up.y * Math.sin( amount ) ); 121 | vector.y = ( this.up.x * Math.sin( amount ) ) + ( this.up.y * Math.cos( amount ) ); 122 | vector.z = this.up.z; 123 | 124 | this.up.copy( vector ); 125 | 126 | }; 127 | */ 128 | }; 129 | 130 | THREE.FreeCamera.prototype = new THREE.Camera(); 131 | THREE.FreeCamera.prototype.constructor = THREE.FreeCamera; 132 | -------------------------------------------------------------------------------- /Extanium/Component/WebGL/geometry/Bird.js: -------------------------------------------------------------------------------- 1 | var Bird = function () { 2 | 3 | var scope = this; 4 | 5 | THREE.Geometry.call(this); 6 | 7 | v( 5, 0, 0 ); 8 | v( - 5, - 2, 1 ); 9 | v( - 5, 0, 0 ); 10 | v( - 5, - 2, - 1 ); 11 | 12 | v( 0, 2, - 6 ); 13 | v( 0, 2, 6 ); 14 | v( 2, 0, 0 ); 15 | v( - 3, 0, 0 ); 16 | 17 | f3( 0, 2, 1 ); 18 | // f3( 0, 3, 2 ); 19 | 20 | f3( 4, 7, 6 ); 21 | f3( 5, 6, 7 ); 22 | 23 | function v( x, y, z ) { 24 | 25 | scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) ); 26 | 27 | } 28 | 29 | function f3( a, b, c ) { 30 | 31 | scope.faces.push( new THREE.Face3( a, b, c ) ); 32 | 33 | } 34 | 35 | } 36 | 37 | Bird.prototype = new THREE.Geometry(); 38 | Bird.prototype.constructor = Bird; 39 | -------------------------------------------------------------------------------- /Extanium/Component/WebGL/geometry/primitives/ClickCube.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | var ClickCube = function (width, height, depth, onSelect) { 6 | 7 | THREE.Geometry.call(this); 8 | 9 | var scope = this, 10 | width_half = width / 2, 11 | height_half = height / 2, 12 | depth_half = depth / 2; 13 | 14 | v( width_half, height_half, -depth_half ); 15 | v( width_half, -height_half, -depth_half ); 16 | v( -width_half, -height_half, -depth_half ); 17 | v( -width_half, height_half, -depth_half ); 18 | v( width_half, height_half, depth_half ); 19 | v( width_half, -height_half, depth_half ); 20 | v( -width_half, -height_half, depth_half ); 21 | v( -width_half, height_half, depth_half ); 22 | 23 | f4( 0, 1, 2, 3 ); 24 | 25 | f4( 4, 7, 6, 5 ); 26 | f4( 0, 4, 5, 1 ); 27 | f4( 2, 6, 7, 3 ); 28 | f4( 1, 5, 6, 2 ); 29 | f4( 4, 0, 3, 7 ); 30 | 31 | function v(x, y, z) { 32 | 33 | scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) ); 34 | } 35 | 36 | function f4(a, b, c, d) { 37 | var f = new THREE.SelectableFace4( a, b, c, d, onSelect ); 38 | scope.faces.push(f); 39 | } 40 | 41 | this.computeCentroids(); 42 | this.computeNormals(); 43 | 44 | }; 45 | 46 | ClickCube.prototype = new THREE.Geometry(); 47 | ClickCube.prototype.constructor = ClickCube; 48 | -------------------------------------------------------------------------------- /Extanium/Component/WebGL/geometry/primitives/Cube.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | var Cube = function (width, height, depth) { 6 | 7 | THREE.Geometry.call(this); 8 | 9 | var scope = this, 10 | width_half = width / 2, 11 | height_half = height / 2, 12 | depth_half = depth / 2; 13 | 14 | v( width_half, height_half, -depth_half ); 15 | v( width_half, -height_half, -depth_half ); 16 | v( -width_half, -height_half, -depth_half ); 17 | v( -width_half, height_half, -depth_half ); 18 | v( width_half, height_half, depth_half ); 19 | v( width_half, -height_half, depth_half ); 20 | v( -width_half, -height_half, depth_half ); 21 | v( -width_half, height_half, depth_half ); 22 | 23 | f4( 0, 1, 2, 3 ); 24 | f4( 4, 7, 6, 5 ); 25 | f4( 0, 4, 5, 1 ); 26 | f4( 1, 5, 6, 2 ); 27 | f4( 2, 6, 7, 3 ); 28 | f4( 4, 0, 3, 7 ); 29 | 30 | function v(x, y, z) { 31 | 32 | scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) ); 33 | } 34 | 35 | function f4(a, b, c, d) { 36 | 37 | scope.faces.push( new THREE.Face4( a, b, c, d ) ); 38 | } 39 | 40 | this.computeCentroids(); 41 | this.computeNormals(); 42 | 43 | } 44 | 45 | Cube.prototype = new THREE.Geometry(); 46 | Cube.prototype.constructor = Cube; 47 | -------------------------------------------------------------------------------- /Extanium/Component/WebGL/geometry/primitives/Cylinder.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author kile / http://kile.stravaganza.org/ 3 | */ 4 | 5 | var Cylinder = function (numSegs, topRad, botRad, height, topOffset, botOffset) { 6 | 7 | THREE.Geometry.call(this); 8 | 9 | var scope = this, i; 10 | 11 | // VERTICES 12 | 13 | // Top circle vertices 14 | for (i = 0; i < numSegs; i++) { 15 | 16 | v( 17 | Math.sin(2 * 3.1415 * i / numSegs)*topRad, 18 | Math.cos(2 * 3.1415 * i / numSegs)*topRad, 19 | 0); 20 | } 21 | 22 | // Bottom circle vertices 23 | for (i = 0; i < numSegs; i++) { 24 | 25 | v( 26 | Math.sin(2 * 3.1415 * i / numSegs)*botRad, 27 | Math.cos(2 * 3.1415 * i / numSegs)*botRad, 28 | height); 29 | } 30 | 31 | 32 | // FACES 33 | 34 | // Body 35 | for (i = 0; i < numSegs; i++) { 36 | 37 | f4(i, i + numSegs, numSegs + (i + 1) % numSegs, (i + 1) % numSegs, '#ff0000'); 38 | } 39 | 40 | // Bottom circle 41 | if (botRad != 0) { 42 | 43 | v(0, 0, -topOffset); 44 | 45 | for (i = numSegs; i < numSegs + (numSegs / 2); i++) { 46 | 47 | f4(2 * numSegs, 48 | (2 * i - 2 * numSegs) % numSegs, 49 | (2 * i - 2 * numSegs + 1) % numSegs, 50 | (2 * i - 2 * numSegs + 2) % numSegs); 51 | } 52 | } 53 | 54 | // Top circle 55 | if (topRad != 0) { 56 | 57 | v(0, 0, height + topOffset); 58 | 59 | for (i = numSegs + (numSegs / 2); i < 2 * numSegs; i++) { 60 | 61 | f4( (2 * i - 2 * numSegs + 2) % numSegs + numSegs, 62 | (2 * i - 2 * numSegs + 1) % numSegs + numSegs, 63 | (2 * i - 2 * numSegs) % numSegs+numSegs, 64 | 2 * numSegs + 1); 65 | } 66 | } 67 | 68 | this.computeCentroids(); 69 | this.computeNormals(); 70 | 71 | function v(x, y, z) { 72 | 73 | scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) ); 74 | } 75 | 76 | function f4(a, b, c, d) { 77 | 78 | scope.faces.push( new THREE.Face4( a, b, c, d ) ); 79 | } 80 | } 81 | 82 | Cylinder.prototype = new THREE.Geometry(); 83 | Cylinder.prototype.constructor = Cylinder; 84 | -------------------------------------------------------------------------------- /Extanium/Component/WebGL/geometry/primitives/Plane.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as 4 | */ 5 | 6 | var Plane = function ( width, height, segments_width, segments_height ) { 7 | 8 | THREE.Geometry.call( this ); 9 | 10 | var ix, iy, 11 | width_half = width / 2, 12 | height_half = height / 2, 13 | gridX = segments_width || 1, 14 | gridY = segments_height || 1, 15 | gridX1 = gridX + 1, 16 | gridY1 = gridY + 1, 17 | segment_width = width / gridX, 18 | segment_height = height / gridY; 19 | 20 | 21 | for( iy = 0; iy < gridY1; iy++ ) { 22 | 23 | for( ix = 0; ix < gridX1; ix++ ) { 24 | 25 | var x = ix * segment_width - width_half; 26 | var y = iy * segment_height - height_half; 27 | 28 | this.vertices.push( new THREE.Vertex( new THREE.Vector3( x, - y, 0 ) ) ); 29 | 30 | } 31 | 32 | } 33 | 34 | for( iy = 0; iy < gridY; iy++ ) { 35 | 36 | for( ix = 0; ix < gridX; ix++ ) { 37 | 38 | var a = ix + gridX1 * iy; 39 | var b = ix + gridX1 * ( iy + 1 ); 40 | var c = ( ix + 1 ) + gridX1 * ( iy + 1 ); 41 | var d = ( ix + 1 ) + gridX1 * iy; 42 | 43 | this.faces.push( new THREE.Face4( a, b, c, d ) ); 44 | this.uvs.push( [ 45 | new THREE.UV( ix / gridX, iy / gridY ), 46 | new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ), 47 | new THREE.UV( ( ix + 1 ) / gridX, ( iy + 1 ) / gridY ), 48 | new THREE.UV( ( ix + 1 ) / gridX, iy / gridY ) 49 | ] ); 50 | 51 | } 52 | 53 | } 54 | 55 | this.computeCentroids(); 56 | this.computeNormals(); 57 | 58 | } 59 | 60 | Plane.prototype = new THREE.Geometry(); 61 | Plane.prototype.constructor = Plane; 62 | -------------------------------------------------------------------------------- /Extanium/Component/WebGL/geometry/primitives/Sphere.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Sphere.as 4 | */ 5 | 6 | var Sphere = function ( radius, segments_width, segments_height ) { 7 | 8 | THREE.Geometry.call( this ); 9 | 10 | var gridX = segments_width || 8, 11 | gridY = segments_height || 6; 12 | 13 | var i, j; 14 | var iHor = Math.max( 3, gridX ); 15 | var iVer = Math.max( 2, gridY ); 16 | var aVtc = []; 17 | 18 | for ( j = 0; j < ( iVer + 1 ) ; j++ ) { 19 | 20 | var fRad1 = j / iVer; 21 | var fZ = radius * Math.cos( fRad1 * Math.PI ); 22 | var fRds = radius * Math.sin( fRad1 * Math.PI ); 23 | var aRow = []; 24 | var oVtx = 0; 25 | 26 | for ( i = 0; i < iHor; i++ ) { 27 | 28 | var fRad2 = 2 * i / iHor; 29 | var fX = fRds * Math.sin( fRad2 * Math.PI ); 30 | var fY = fRds * Math.cos( fRad2 * Math.PI ); 31 | 32 | if ( !( ( j == 0 || j == iVer ) && i > 0 ) ) { 33 | 34 | oVtx = this.vertices.push( new THREE.Vertex( new THREE.Vector3( fY, fZ, fX ) ) ) - 1; 35 | 36 | } 37 | 38 | aRow.push( oVtx ); 39 | 40 | } 41 | 42 | aVtc.push( aRow ); 43 | 44 | } 45 | 46 | var iVerNum = aVtc.length; 47 | 48 | for ( j = 0; j < iVerNum; j++ ) { 49 | 50 | var iHorNum = aVtc[ j ].length; 51 | 52 | if ( j > 0 ) { 53 | 54 | for ( i = 0; i < iHorNum; i++ ) { 55 | 56 | var bEnd = i == ( iHorNum - 1 ); 57 | var aP1 = aVtc[ j ][ bEnd ? 0 : i + 1 ]; 58 | var aP2 = aVtc[ j ][ ( bEnd ? iHorNum - 1 : i ) ]; 59 | var aP3 = aVtc[ j - 1 ][ ( bEnd ? iHorNum - 1 : i ) ]; 60 | var aP4 = aVtc[ j - 1 ][ bEnd ? 0 : i + 1 ]; 61 | 62 | var fJ0 = j / ( iVerNum - 1 ); 63 | var fJ1 = ( j - 1 ) / ( iVerNum - 1 ); 64 | var fI0 = ( i + 1 ) / iHorNum; 65 | var fI1 = i / iHorNum; 66 | 67 | var aP1uv = new THREE.UV( 1 - fI0, fJ0 ); 68 | var aP2uv = new THREE.UV( 1 - fI1, fJ0 ); 69 | var aP3uv = new THREE.UV( 1 - fI1, fJ1 ); 70 | var aP4uv = new THREE.UV( 1 - fI0, fJ1 ); 71 | 72 | if ( j < ( aVtc.length - 1 ) ) { 73 | 74 | this.faces.push( new THREE.Face3( aP1, aP2, aP3 ) ); 75 | this.uvs.push( [ aP1uv, aP2uv, aP3uv ] ); 76 | 77 | } 78 | 79 | if ( j > 1 ) { 80 | 81 | this.faces.push( new THREE.Face3( aP1, aP3, aP4 ) ); 82 | this.uvs.push( [ aP1uv, aP3uv, aP4uv ] ); 83 | 84 | } 85 | 86 | } 87 | } 88 | } 89 | 90 | this.computeCentroids(); 91 | this.computeNormals(); 92 | } 93 | 94 | Sphere.prototype = new THREE.Geometry(); 95 | Sphere.prototype.constructor = Sphere; 96 | -------------------------------------------------------------------------------- /Extanium/Direct.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class Ext.Direct 3 | * @singleton 4 | * 5 | * A free reimplementation of the ExtJS's Ext.Direct JSON-RPC protocol.
6 | * It generates a "native" javascript API based on the server's API.
7 | *
8 | *
9 | * For example a server API may look like this: (Pseudo code) 10 | *

11 | *
 12 |  * class Car {
 13 |  * 
 14 |  *     public open(Boolean withKey) {
 15 |  *         return "Yeeha!";
 16 |  *     }
 17 |  * }
 18 |  * 
19 | *

20 | * You may be a lucky man if you simply could call: 21 | *

22 | *
 23 |  * Car.open(true, function(result) {
 24 |  *     Ext.debug(result); // Yeeha!
 25 |  * });
 26 |  * 
27 | *

28 | * Well, with Ext.Direct, you can. ;-) 29 | *

30 | * For that you need an Ext.Direct server stack to be integrated in your server code.
31 | * See http://www.sencha.com/forum/showthread.php?67992-Ext.Direct-Server-side-Stacks for the server stacks.
32 | *
33 | * To understand the magical seamless communication, imagine there is a JSON-RPC protocol.
34 | * A server stack of choice generates an JSON-RPC descriptor. Called, the "Provider Description".
35 | * This code is simply JSON and reflects your server API in an abstract manner. It may look like the
36 | * demo Provider code you will find in DirectProvider/1.0.js.
37 | *
38 | * This code needs to be loaded by Ext.Direct. This happens using Ext.Direct.loadProvider(RPC-Provider-Description);
39 | * You may also load the full description via AJAX from a remote host using Ext.Direct.fetchProvider({ajax-request-config, see Ext.Ajax});
40 | *
41 | * All in all, an example may look like this:
42 | *
43 | *
 44 |  * Ext.Direct.baseUrl = "http://localhost/CarProject";
 45 |  * Ext.Direct.fetchProvider({url: 'http://localhost/CarProject/direct.php?javascript'});
 46 |  *
 47 |  * // Call with Server API
 48 |  * Car.open(true, function(result) {
 49 |  *     Ext.debug("Result: " + result);
 50 |  * });
 51 |  * 
52 | */ 53 | Ext.Direct = { 54 | 55 | 56 | /** 57 | * Base url to prefix to the Ext.Direct-Ajax calls 58 | * @type {String} baseUrl URL to prefix to the requests 59 | */ 60 | baseUrl: 'http://localhost', 61 | 62 | 63 | /** 64 | * Direct provider url provided by the provider definition 65 | * and added as prefix to the baseUrl 66 | * @type {String} providerUrl Direct provider URL 67 | */ 68 | providerUrl: '', 69 | 70 | 71 | /** 72 | * Current transaction id 73 | * @type {Number} tid Transaction number 74 | */ 75 | tid: 1, 76 | 77 | 78 | /** 79 | * Method to fetch a provider definition from a remote host (HTTP) 80 | * 81 | * @param {String} url URL to fetch the provider JSON-RPC definition from 82 | * @return {void} 83 | */ 84 | fetchProvider: function(ajaxConfig) { 85 | 86 | // Overlay the configuration 87 | Ext.apply(ajaxConfig, { 88 | json: false, 89 | success: function(result) { 90 | eval(result.text); 91 | } 92 | }); 93 | 94 | // Do request 95 | new Ext.Ajax().request(ajaxConfig); 96 | }, 97 | 98 | 99 | /** 100 | * Loads the provider definition locally 101 | * 102 | * @param {String} apiFileName Name of the API javascript file name 103 | * @param {void} 104 | */ 105 | loadProvider: function(apiFileName) { 106 | Ext.include('/DirectProvider/' + apiFileName); 107 | }, 108 | 109 | 110 | /** 111 | * Adds a provider to use in Ext.Direct 112 | * 113 | * @param {Object} pr A provider object definition reference 114 | * @return {void} 115 | */ 116 | addProvider: function(pr) { 117 | 118 | // Declare the working namespace 119 | var scope = Ext.ns(pr.namespace); 120 | Ext.Direct.providerUrl = pr.url; 121 | 122 | for (className in pr.actions) { 123 | 124 | // Define class scope if not already defined 125 | if (!Ext.isDefined(scope[className])) { 126 | scope[className] = {}; 127 | } 128 | 129 | // Walk each method and declare as function 130 | for (var i=0; i 151 | * via AJAX and reuse the resulting response to a connected handler function. 152 | * 153 | * @param {String} className Name of the class to call 154 | * @param {methodName} methodName Name of the method to call 155 | * @param {Number} argc Number of the arguments available 156 | * @param {Object} args Arguments set at call time 157 | * @return {void} 158 | */ 159 | callRemote: function(className, methodName, argc, args) { 160 | 161 | // Evaluate the function to call at result arrival time 162 | var resultHandleFunc = function() {}; 163 | if (Ext.isDefined(args[argc]) && Ext.isFunction(args[argc])) { 164 | resultHandleFunc = args[argc]; 165 | } 166 | 167 | // Implement RPC-calling 168 | //Ext.debug("Calling remote to use class: " + className + " method: " + methodName + " with " + argc + " args."); 169 | //Ext.debug(args[0]); 170 | 171 | var data = []; 172 | for (var i=0; i 6 | * Class that enables a global variable store. 7 | * The stored values are NOT SESSION PERSISTENT. 8 | *

9 | */ 10 | Ext.Global = { 11 | 12 | 13 | /** 14 | * Sets a value identified by name 15 | * 16 | * @param {String} name Name identifier 17 | * @param {Mixed} value Value to set 18 | * @return {void} 19 | */ 20 | set: function(name, value) { 21 | Ext.Global[name] = value; 22 | }, 23 | 24 | 25 | /** 26 | * Returns value by name 27 | * 28 | * @return {Mixed} Value 29 | */ 30 | get: function(name) { 31 | return Ext.Global[name]; 32 | } 33 | }; -------------------------------------------------------------------------------- /Extanium/Loader.js: -------------------------------------------------------------------------------- 1 | // --- ADAPTER INCLUDES (EXT CORE) 2 | 3 | // Include the loader which loads the rest of the 4 | // Ext Core files required in this project. 5 | 6 | 7 | 8 | // --- LIBRARY INCLUDES 9 | 10 | // Application global variable store 11 | Ext.include('/Extanium/Global.js'); 12 | 13 | // Application property storage wrapper 14 | Ext.include('/Extanium/Registry.js'); 15 | 16 | // Abstract Activity class 17 | Ext.include('/Extanium/Activity.js'); 18 | 19 | // Abstract OOP window for manager integration 20 | Ext.include('/Extanium/Component.js'); 21 | 22 | // Abstract class for metrics calculation 23 | Ext.include('/Extanium/MetricsMgr.js'); 24 | 25 | // Class for abstract AJAX communication 26 | Ext.include('/Extanium/Ajax.js'); 27 | 28 | // Class for stacked AJAX communication in offline mode 29 | Ext.include('/Extanium/OfflineAjax.js'); 30 | 31 | // Ext.Direct-mimic free implementation 32 | Ext.include('/Extanium/Direct.js'); 33 | 34 | // Outstanding 3D programming in JavaScript 35 | Ext.include('/Extanium/WebView.js'); 36 | 37 | 38 | 39 | // --- APPLICATION BASE CLASS INCLUDE 40 | 41 | // Include the Application-Class 42 | Ext.include('/Extanium/Application.js'); -------------------------------------------------------------------------------- /Extanium/OfflineAjax.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class Ext.OfflineAjax 3 | * @singleton 4 | * 5 | * Class that implements methods to fully provide support 6 | * to offline mode requests to be dispatched later if the 7 | * app is online again. 8 | */ 9 | Ext.OfflineAjax = { 10 | 11 | 12 | // Temporary virtual Ajax request stack 13 | registry: Ext.Registry.getArray("ajaxstack"), 14 | 15 | 16 | /** 17 | * Offline Ajax in seconds 18 | * @var {Number} 19 | */ 20 | interval: 5, 21 | 22 | 23 | /** 24 | * Registers a request configuration on a persistent stack 25 | * 26 | * @param {Object} cfg Request configuration 27 | * @return {void} 28 | */ 29 | register: function(cfg) { 30 | 31 | // Load current Ajax registry 32 | Ext.OfflineAjax.registry = Ext.Registry.getArray("ajaxstack"); 33 | 34 | if (!Ext.isArray(Ext.OfflineAjax.registry)) { 35 | Ext.OfflineAjax.registry = []; 36 | } 37 | 38 | // Add request to the Ajax request stack 39 | Ext.OfflineAjax.registry.push({ 40 | request: cfg, 41 | isDispatched: false 42 | }); 43 | 44 | // Persist in Registry 45 | Ext.Registry.setArray("ajaxstack", Ext.OfflineAjax.registry); 46 | 47 | // Start the request loop 48 | Ext.OfflineAjax.startRequestLoop(); 49 | }, 50 | 51 | 52 | // Requests with overloaded success method 53 | request: function() { 54 | 55 | // Only request if device is online 56 | if (!Titanium.Network.online) { 57 | return; 58 | } 59 | 60 | // Load current Ajax registry 61 | Ext.OfflineAjax.registry = Ext.Registry.getArray("ajaxstack"); 62 | 63 | if (!Ext.isArray(Ext.OfflineAjax.registry)) { 64 | Ext.OfflineAjax.registry = []; 65 | } 66 | 67 | // Loop every undispatched request 68 | var successFunction = null; 69 | var requestObj = null; 70 | for (var i=0; i 0) { 96 | setInterval(Ext.OfflineAjax.request, Ext.OfflineAjax.interval * 1000); 97 | } 98 | } 99 | }; 100 | Ext.OfflineAjax.startRequestLoop(); -------------------------------------------------------------------------------- /Extanium/Registry.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class Ext.Registry 3 | * @singleton 4 | * 5 | * This class handles Titanium properties in an easier way. 6 | * The values stored via the registry ARE SESSION PERSISTENT. 7 | */ 8 | Ext.Registry = { 9 | 10 | 11 | /** 12 | * Returns a property value as String 13 | * 14 | * @param {String} name Name of the propery 15 | * @return {String} Property value 16 | */ 17 | getString: Titanium.App.Properties.getString, 18 | 19 | 20 | /** 21 | * Returns a property value as Boolean 22 | * 23 | * @param {String} name Name of the propery 24 | * @return {Boolean} Property value 25 | */ 26 | getBoolean: Titanium.App.Properties.getBool, 27 | 28 | 29 | /** 30 | * Returns a property value as Array 31 | * 32 | * @param {String} name Name of the propery 33 | * @return {Array} Property value 34 | */ 35 | getArray: Titanium.App.Properties.getList, 36 | 37 | 38 | /** 39 | * Returns a property value as Number 40 | * 41 | * @param {String} name Name of the propery 42 | * @return {Number} Property value 43 | */ 44 | getNumber: Titanium.App.Properties.getDouble, 45 | 46 | 47 | /** 48 | * Returns a property value as Object 49 | * 50 | * @param {String} name Name of the propery 51 | * @return {Object} Property value 52 | */ 53 | getObject: function(name) { 54 | return JSON.parse(Ext.Registry.getString(name)); 55 | }, 56 | 57 | 58 | /** 59 | * Sets a Boolean value by name 60 | * 61 | * @param {String} name Name of the propery 62 | * @param {Boolean} value Value of the propery 63 | * @return {void} 64 | */ 65 | setBoolean: Titanium.App.Properties.setBool, 66 | 67 | 68 | /** 69 | * Sets a String value by name 70 | * 71 | * @param {String} name Name of the propery 72 | * @param {String} value Value of the propery 73 | * @return {void} 74 | */ 75 | setString: Titanium.App.Properties.setString, 76 | 77 | 78 | /** 79 | * Sets a Number value by name 80 | * 81 | * @param {String} name Name of the propery 82 | * @param {Number} value Value of the propery 83 | * @return {void} 84 | */ 85 | setNumber: Titanium.App.Properties.setDouble, 86 | 87 | 88 | /** 89 | * Sets an Array value by name 90 | * 91 | * @param {String} name Name of the propery 92 | * @param {Array} value Value of the propery 93 | * @return {void} 94 | */ 95 | setArray: Titanium.App.Properties.setList, 96 | 97 | 98 | /** 99 | * Sets an Object value by name 100 | * 101 | * @param {String} name Name of the propery 102 | * @param {Object} value Value of the propery 103 | * @return {void} 104 | */ 105 | setObject: function(name, obj) { 106 | Ext.Registry.setString(name, JSON.stringify(obj)); 107 | }, 108 | 109 | 110 | /** 111 | * Checks if a property is set by name 112 | * 113 | * @param {String} name Name of the propery 114 | * @return {Boolean} True, if set, false if not 115 | */ 116 | has: Titanium.App.Properties.hasProperty 117 | }; 118 | 119 | -------------------------------------------------------------------------------- /Extanium/WebView.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class Ext.WebView 3 | * @singleton 4 | * 5 | *

6 | * This class allows outstanding 3D / GL implementations 7 | * to become reality inside of Titanium by wrapping WebGL 8 | * in an elastic WebView and allowing bidirectional data 9 | * piping. 10 | *

11 | * 12 | *
 13 |  *  var wWnd = W(Ti.UI.createWindow({
 14 |  *           modal: true,
 15 |  *           title: 'GL Window'
 16 |  *       }));
 17 |  *       
 18 |  *       
 19 |  *       // Test WebView
 20 |  *       var wview = new Ext.WebView({
 21 |  *           jsUrl: 'Components/GL/Init.js',
 22 |  *           initParams: {
 23 |  *               name: 'Aron!'
 24 |  *           },
 25 |  *           onReady: function() {
 26 |  *               
 27 |  *               // Send data
 28 |  *               this.sendData({name: 'Aron'});
 29 |  *           },
 30 |  *           receivedData: function(data) {
 31 |  *           
 32 |  *               //Ext.debug("Ext received data from WebGL context");
 33 |  *               
 34 |  *               for (name in data) {
 35 |  *                   //Ext.debug(name + " : " + data[name]);
 36 |  *               }
 37 |  *           }
 38 |  *       });
 39 |  *       wWnd.add(wview.getView());
 40 |  *       wWnd.show();
 41 |  * 
42 | * 43 | * @author Aron Homberg 44 | * @license MIT license 45 | */ 46 | Ext.WebView = Ext.extend(Object, { 47 | 48 | /** 49 | * Specifies the HTML file used for bootstrapping the WebView. 50 | * By default: Extanium/WebViewBootstap.html 51 | * @cfg {String} 52 | */ 53 | bootstrapUrl: 'Extanium/WebViewBootstrap.html', 54 | 55 | 56 | /** 57 | * Specified the javascript to bootstrap the WebView environment. 58 | * By default: Extanium/WebViewBootstrap.js 59 | * @cfg {String} 60 | */ 61 | bootstrapJsUrl: 'Extanium/WebViewBootstrap.js', 62 | 63 | 64 | /** 65 | * The internal managed WebView instance 66 | * @type {Ti.Ui.WebView} 67 | */ 68 | webview: null, 69 | 70 | 71 | // Translations 72 | trErrorIncludeFileNotFound: 'The file to include could not be found', 73 | 74 | 75 | // Constructs the WebView 76 | constructor: function(cfg) { 77 | 78 | // Method overrides 79 | Ext.apply(this, cfg); 80 | 81 | // Prepare WebView's config 82 | var webviewConfig = {}; 83 | for (param in cfg) { 84 | if (Ext.isPrimitive(cfg[param])) { 85 | webviewConfig[param] = cfg[param]; 86 | } 87 | } 88 | 89 | // Overlay bootstrap html 90 | Ext.apply(webviewConfig, { 91 | url: this.bootstrapUrl 92 | }); 93 | 94 | // Create the web view instance 95 | this.webview = C(Ti.UI.createWebView(webviewConfig)); 96 | 97 | // Listen to data received event 98 | Ti.App.addEventListener('wvdataTransmitted', function(data) { 99 | 100 | // Call inner-scope function override 101 | this.receivedData(JSON.parse(data.data)); 102 | 103 | }.createDelegate(this)); 104 | 105 | // Listen to glinclude command event 106 | Ti.App.addEventListener('wvincludeCmd', function(data) { 107 | 108 | // Thru-context script injection 109 | this.include(data.url); 110 | 111 | // Set include load flag 112 | this.eval('window.' + data.toggle + ' = true;'); 113 | 114 | }.createDelegate(this)); 115 | 116 | // On load of the webview, provide configuration 117 | this.webview.addEventListener('load', function() { 118 | 119 | // Include main user script module containing the 120 | // initGL()-function override. 121 | if (Ext.isDefined(cfg.jsUrl)) { 122 | this.include(cfg.jsUrl); 123 | } else { 124 | Ext.debug('You may set the jsUrl attribute in your Ext.WebView config thats points to a javascript file which contains a Web.init function!'); 125 | } 126 | 127 | // Include inner bootstrap 128 | this.include(this.bootstrapJsUrl); 129 | 130 | // Provide initGL()-params if set 131 | if (Ext.isDefined(cfg.initParams)) { 132 | Ext.apply(webviewConfig, {initParams: JSON.stringify(cfg.initParams)}); 133 | } else { 134 | Ext.apply(webviewConfig, {initParams: '{}'}); 135 | } 136 | 137 | // Inject load flag and config 138 | this.eval('window.WebViewConfig = ' + JSON.stringify(webviewConfig) + ';') 139 | this.eval('window.viewReadyLoaded = true;'); 140 | 141 | // Call onready override 142 | this.onReady(); 143 | 144 | }.createDelegate(this)); 145 | 146 | 147 | 148 | return this; 149 | }, 150 | 151 | 152 | /** 153 | * Called if GL context is ready 154 | * You may override this method. 155 | * @return {void} 156 | */ 157 | onReady: function() {}, 158 | 159 | 160 | /** 161 | * Processes data that were received. 162 | * You may override this method. 163 | * 164 | * @param {Object} data Received data 165 | * @return {void} 166 | */ 167 | receivedData: function(data) { 168 | // You may override this method. 169 | }, 170 | 171 | 172 | /** 173 | * Returns the titanium view 174 | * @return {Ti.UI.WebView} Titanium WebView instance 175 | */ 176 | getView: function() { 177 | return this.webview; 178 | }, 179 | 180 | 181 | /** 182 | * Sends data to the webview scope 183 | * 184 | * @param {Object} data Data to transmit 185 | * @return {void} 186 | */ 187 | sendData: function(data) { 188 | 189 | // Fire event 190 | Ti.App.fireEvent('wvdataReceived', {data: JSON.stringify(data)}); 191 | }, 192 | 193 | 194 | 195 | /** 196 | * Evaluates the given code in the webview 197 | * @param {String} code Javascript code 198 | * @return {Mixed} Return value 199 | */ 200 | eval: function(code) { 201 | return this.webview.evalJS(code); 202 | }, 203 | 204 | 205 | /** 206 | * Loads some JS into the WebView 207 | * @param {String} url Javascript url 208 | * @return {void} 209 | */ 210 | include: function(url) { 211 | 212 | try { 213 | var jsCode = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, url).read().text; 214 | } catch (e) { 215 | Ext.debug(this.trErrorIncludeFileNotFound + ': ' + url); 216 | } 217 | this.eval(jsCode); 218 | }, 219 | 220 | 221 | /** 222 | * Shows the inner WebView instance 223 | * @return {void} 224 | */ 225 | show: function() { 226 | this.webview.show(); 227 | }, 228 | 229 | 230 | /** 231 | * Hides the inner WebView instance 232 | * @return {void} 233 | */ 234 | hide: function() { 235 | this.webview.hide(); 236 | } 237 | }); -------------------------------------------------------------------------------- /Extanium/WebViewBootstrap.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Extanium/WebViewBootstrap.js: -------------------------------------------------------------------------------- 1 | // Web init 2 | var Web = Web || {}; 3 | 4 | /** 5 | * Sends data back to the Ext.WebView context 6 | * 7 | * @param {Object} data Data to send 8 | * @return {void} 9 | */ 10 | Web.sendData = function(data) { 11 | Ti.App.fireEvent('wvdataTransmitted', {data: JSON.stringify(data)}); 12 | }; 13 | 14 | 15 | /** 16 | * Calls the WebView-context to load a script given by url. 17 | * The toggleToSet param will be set as boolean variable in window scope. 18 | * The optional fn param may be a function which will be called when the script is included. 19 | * 20 | * @param {String} url URL of the script to include 21 | * @param {String} toggleToSet Name of the toggle to set as load flag 22 | * @param {Function} fn Function to execute when flag is set (Optional) 23 | * @return {void} 24 | */ 25 | Web.include = function(url, toggleToSet, fn) { 26 | Ti.App.fireEvent('wvincludeCmd', {url: url, toggle: toggleToSet}); 27 | if (typeof fn != "undefined" && typeof fn == "function") { 28 | Web.onIncludeReady(toggleToSet, fn); 29 | } 30 | }; 31 | 32 | 33 | /** 34 | * Waits for an include and calls the given function with arguments 35 | * 36 | * @param {String} toggleName Name of the toggle to set 37 | * @param {Function} fn Function to call when include has finished 38 | * @param {Object} arg Object to append as argument to the given function (Optional) 39 | * @return {void} 40 | */ 41 | Web.onIncludeReady = function(toggleName, fn) { 42 | 43 | var waitForToggle = setInterval(function() { 44 | 45 | if (window[toggleName] != "undefined" && 46 | window[toggleName] == true) { 47 | 48 | try { 49 | if (arguments.length == 3) { 50 | fn(arguments[2]); 51 | } else { 52 | fn(); 53 | } 54 | } catch (e) { 55 | alert(e); 56 | } 57 | clearInterval(waitForToggle); 58 | } 59 | }, 50); 60 | }; 61 | 62 | 63 | /** 64 | *

65 | * You can simply put as many toggleName arguments you want 66 | * into this method. The given fn function (the last argument) 67 | * will be called, when all toggles are set. 68 | *

69 | * 70 | *
Web.onMultiReady('cameraReady', 'cubeReady', function() {...});
71 | * 72 | * @param {String...} ... As many string toggle names you want 73 | * @param {Function} fn The function to call when all toggles are set at last 74 | * @return {void} 75 | */ 76 | Web.onMultiReady = function() { 77 | 78 | var fn = function() {}; 79 | 80 | if (typeof arguments[(arguments.length - 1)] == "function") { 81 | fn = arguments[(arguments.length - 1)]; 82 | 83 | } 84 | 85 | var togglesToCheck = []; 86 | for (var i=0; i 116 | * You can simply put as many toggleName arguments you want 117 | * into this method. The given fn function (the last argument) 118 | * will be called, when all toggles are set. 119 | *

120 | * 121 | *
Web.onMultiReady('cameraReady', 'cubeReady', function() {...});
122 | * 123 | * @param {String...} ... As many string toggle names you want 124 | * @param {Function} fn The function to call when all toggles are set at last 125 | * @return {void} 126 | */ 127 | Web.when = function() { 128 | 129 | var fn = function() {}; 130 | 131 | if (typeof arguments[(arguments.length - 1)] == "function") { 132 | fn = arguments[(arguments.length - 1)]; 133 | 134 | } 135 | 136 | // Interval to 137 | var multiCheck = setInterval(function() { 138 | var isReady = true; 139 | 140 | var togglesToCheck = []; 141 | for (var i=0; i> 24 & 255 ) / 255; 83 | this.r = ( this.hex >> 16 & 255 ) / 255; 84 | this.g = ( this.hex >> 8 & 255 ) / 255; 85 | this.b = ( this.hex & 255 ) / 255; 86 | 87 | }, 88 | 89 | updateStyleString: function () { 90 | 91 | this.__styleString = 'rgba(' + Math.floor( this.r * 255 ) + ',' + Math.floor( this.g * 255 ) + ',' + Math.floor( this.b * 255 ) + ',' + this.a + ')'; 92 | 93 | }, 94 | 95 | toString: function () { 96 | 97 | return 'THREE.Color ( r: ' + this.r + ', g: ' + this.g + ', b: ' + this.b + ', a: ' + this.a + ', hex: ' + this.hex + ' )'; 98 | 99 | } 100 | 101 | }; 102 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/core/Face3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.Face3 = function ( a, b, c, normal, color ) { 6 | 7 | this.a = a; 8 | this.b = b; 9 | this.c = c; 10 | 11 | this.centroid = new THREE.Vector3(); 12 | this.normal = normal || new THREE.Vector3(); 13 | 14 | this.color = color || new THREE.Color( 0xff000000 ); 15 | 16 | }; 17 | 18 | THREE.Face3.prototype = { 19 | 20 | // TODO: Dupe? (Geometry/computeCentroid) 21 | 22 | getCenter : function(){ 23 | 24 | return this.a.clone().addSelf( this.b ).addSelf( this.c ).divideScalar( 3 ); 25 | 26 | }, 27 | 28 | toString: function () { 29 | 30 | return 'THREE.Face3 ( ' + this.a + ', ' + this.b + ', ' + this.c + ' )'; 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/core/Face4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.Face4 = function ( a, b, c, d, normal, color ) { 6 | 7 | this.a = a; 8 | this.b = b; 9 | this.c = c; 10 | this.d = d; 11 | 12 | this.centroid = new THREE.Vector3(); 13 | this.normal = normal || new THREE.Vector3(); 14 | 15 | this.color = color || new THREE.Color( 0xff000000 ); 16 | 17 | }; 18 | 19 | THREE.Face4.prototype = { 20 | 21 | // TODO: Dupe? (Geometry/computeCentroid) 22 | 23 | getCenter : function(){ 24 | 25 | return this.a.clone().addSelf( this.b ).addSelf( this.c ).addSelf( this.d ).divideScalar( 4 ); 26 | 27 | }, 28 | 29 | toString: function () { 30 | 31 | return 'THREE.Face4 ( ' + this.a + ', ' + this.b + ', ' + this.c + ' ' + this.d + ' )'; 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/core/Geometry.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | * @author kile / http://kile.stravaganza.org/ 4 | */ 5 | 6 | THREE.Geometry = function () { 7 | 8 | this.vertices = []; 9 | this.faces = []; 10 | this.uvs = []; 11 | 12 | }; 13 | 14 | THREE.Geometry.prototype = { 15 | 16 | computeCentroids: function () { 17 | 18 | var f, fl, face; 19 | 20 | for ( f = 0, fl = this.faces.length; f < fl; f++ ) { 21 | 22 | face = this.faces[ f ]; 23 | face.centroid.set( 0, 0, 0 ); 24 | 25 | if ( face instanceof THREE.Face3 ) { 26 | 27 | face.centroid.addSelf( this.vertices[ face.a ].position ); 28 | face.centroid.addSelf( this.vertices[ face.b ].position ); 29 | face.centroid.addSelf( this.vertices[ face.c ].position ); 30 | face.centroid.divideScalar( 3 ); 31 | 32 | } else if ( face instanceof THREE.Face4 ) { 33 | 34 | face.centroid.addSelf( this.vertices[ face.a ].position ); 35 | face.centroid.addSelf( this.vertices[ face.b ].position ); 36 | face.centroid.addSelf( this.vertices[ face.c ].position ); 37 | face.centroid.addSelf( this.vertices[ face.d ].position ); 38 | face.centroid.divideScalar( 4 ); 39 | 40 | } 41 | 42 | } 43 | 44 | }, 45 | 46 | computeNormals: function () { 47 | 48 | var v, vl, vertex, f, fl, face, vA, vB, vC, cb = new THREE.Vector3(), ab = new THREE.Vector3(); 49 | 50 | for ( v = 0, vl = this.vertices.length; v < vl; v++ ) { 51 | 52 | vertex = this.vertices[ v ]; 53 | vertex.normal.set( 0, 0, 0 ); 54 | 55 | } 56 | 57 | for ( f = 0, fl = this.faces.length; f < fl; f++ ) { 58 | 59 | face = this.faces[ f ]; 60 | 61 | vA = this.vertices[ face.a ]; 62 | vB = this.vertices[ face.b ]; 63 | vC = this.vertices[ face.c ]; 64 | 65 | cb.sub( vC.position, vB.position ); 66 | ab.sub( vA.position, vB.position ); 67 | cb.crossSelf( ab ); 68 | 69 | if ( !cb.isZero() ) { 70 | 71 | cb.normalize(); 72 | 73 | } 74 | 75 | face.normal.copy( cb ); 76 | 77 | } 78 | 79 | }, 80 | 81 | toString: function () { 82 | 83 | return 'THREE.Geometry ( vertices: ' + this.vertices + ', faces: ' + this.faces + ' )'; 84 | 85 | } 86 | 87 | }; 88 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/core/Rectangle.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.Rectangle = function () { 6 | 7 | var _x1, _y1, _x2, _y2, 8 | _width, _height, 9 | _isEmpty = true; 10 | 11 | function resize() { 12 | 13 | _width = _x2 - _x1; 14 | _height = _y2 - _y1; 15 | 16 | } 17 | 18 | this.getX = function () { 19 | 20 | return _x1; 21 | 22 | }; 23 | 24 | this.getY = function () { 25 | 26 | return _y1; 27 | 28 | }; 29 | 30 | this.getWidth = function () { 31 | 32 | return _width; 33 | 34 | }; 35 | 36 | this.getHeight = function () { 37 | 38 | return _height; 39 | 40 | }; 41 | 42 | this.getX1 = function() { 43 | 44 | return _x1; 45 | 46 | }; 47 | 48 | this.getY1 = function() { 49 | 50 | return _y1; 51 | 52 | }; 53 | 54 | this.getX2 = function() { 55 | 56 | return _x2; 57 | 58 | }; 59 | 60 | this.getY2 = function() { 61 | 62 | return _y2; 63 | 64 | }; 65 | 66 | this.set = function ( x1, y1, x2, y2 ) { 67 | 68 | _isEmpty = false; 69 | 70 | _x1 = x1; _y1 = y1; 71 | _x2 = x2; _y2 = y2; 72 | 73 | resize(); 74 | 75 | }; 76 | 77 | this.addPoint = function ( x, y ) { 78 | 79 | if ( _isEmpty ) { 80 | 81 | _isEmpty = false; 82 | _x1 = x; _y1 = y; 83 | _x2 = x; _y2 = y; 84 | 85 | } else { 86 | 87 | _x1 = Math.min( _x1, x ); 88 | _y1 = Math.min( _y1, y ); 89 | _x2 = Math.max( _x2, x ); 90 | _y2 = Math.max( _y2, y ); 91 | 92 | } 93 | 94 | resize(); 95 | 96 | }; 97 | 98 | this.addRectangle = function ( r ) { 99 | 100 | if ( _isEmpty ) { 101 | 102 | _isEmpty = false; 103 | _x1 = r.getX1(); _y1 = r.getY1(); 104 | _x2 = r.getX2(); _y2 = r.getY2(); 105 | 106 | } else { 107 | 108 | _x1 = Math.min(_x1, r.getX1()); 109 | _y1 = Math.min(_y1, r.getY1()); 110 | _x2 = Math.max(_x2, r.getX2()); 111 | _y2 = Math.max(_y2, r.getY2()); 112 | 113 | } 114 | 115 | resize(); 116 | 117 | }; 118 | 119 | this.inflate = function ( v ) { 120 | 121 | _x1 -= v; _y1 -= v; 122 | _x2 += v; _y2 += v; 123 | 124 | resize(); 125 | 126 | }; 127 | 128 | this.minSelf = function( r ) { 129 | 130 | _x1 = Math.max( _x1, r.getX1() ); 131 | _y1 = Math.max( _y1, r.getY1() ); 132 | _x2 = Math.min( _x2, r.getX2() ); 133 | _y2 = Math.min( _y2, r.getY2() ); 134 | 135 | resize(); 136 | 137 | }; 138 | 139 | /* 140 | this.containsPoint = function (x, y) { 141 | 142 | return x > _x1 && x < _x2 && y > _y1 && y < _y2; 143 | 144 | } 145 | */ 146 | 147 | this.instersects = function ( r ) { 148 | 149 | return Math.min( _x2, r.getX2() ) - Math.max( _x1, r.getX1() ) >= 0 && Math.min( _y2, r.getY2() ) - Math.max( _y1, r.getY1() ) >= 0; 150 | 151 | }; 152 | 153 | this.empty = function () { 154 | 155 | _isEmpty = true; 156 | 157 | _x1 = 0; _y1 = 0; 158 | _x2 = 0; _y2 = 0; 159 | 160 | resize(); 161 | 162 | }; 163 | 164 | this.isEmpty = function () { 165 | 166 | return _isEmpty; 167 | 168 | }; 169 | 170 | this.toString = function () { 171 | 172 | return "THREE.Rectangle (x1: " + _x1 + ", y1: " + _y2 + ", x2: " + _x2 + ", y1: " + _y1 + ", width: " + _width + ", height: " + _height + ")"; 173 | 174 | }; 175 | 176 | }; 177 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/core/UV.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.UV = function ( u, v ) { 6 | 7 | this.u = u || 0; 8 | this.v = v || 0; 9 | 10 | }; 11 | 12 | THREE.UV.prototype = { 13 | 14 | copy: function ( uv ) { 15 | 16 | this.u = uv.u; 17 | this.v = uv.v; 18 | 19 | }, 20 | 21 | toString: function () { 22 | 23 | return 'THREE.UV (' + this.u + ', ' + this.v + ')'; 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/core/Vector2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | * @author philogb / http://blog.thejit.org/ 4 | */ 5 | 6 | THREE.Vector2 = function ( x, y ) { 7 | 8 | this.x = x || 0; 9 | this.y = y || 0; 10 | 11 | }; 12 | 13 | THREE.Vector2.prototype = { 14 | 15 | set: function ( x, y ) { 16 | 17 | this.x = x; 18 | this.y = y; 19 | 20 | return this; 21 | 22 | }, 23 | 24 | copy: function ( v ) { 25 | 26 | this.x = v.x; 27 | this.y = v.y; 28 | 29 | return this; 30 | 31 | }, 32 | 33 | addSelf: function ( v ) { 34 | 35 | this.x += v.x; 36 | this.y += v.y; 37 | 38 | return this; 39 | 40 | }, 41 | 42 | add: function ( v1, v2 ) { 43 | 44 | this.x = v1.x + v2.x; 45 | this.y = v1.y + v2.y; 46 | 47 | return this; 48 | 49 | }, 50 | 51 | subSelf: function ( v ) { 52 | 53 | this.x -= v.x; 54 | this.y -= v.y; 55 | 56 | return this; 57 | 58 | }, 59 | 60 | sub: function ( v1, v2 ) { 61 | 62 | this.x = v1.x - v2.x; 63 | this.y = v1.y - v2.y; 64 | 65 | return this; 66 | 67 | }, 68 | 69 | multiplyScalar: function ( s ) { 70 | 71 | this.x *= s; 72 | this.y *= s; 73 | 74 | return this; 75 | 76 | }, 77 | 78 | unit: function () { 79 | 80 | this.multiplyScalar( 1 / this.length() ); 81 | 82 | return this; 83 | 84 | }, 85 | 86 | length: function () { 87 | 88 | return Math.sqrt( this.x * this.x + this.y * this.y ); 89 | 90 | }, 91 | 92 | lengthSq: function () { 93 | 94 | return this.x * this.x + this.y * this.y; 95 | 96 | }, 97 | 98 | negate: function() { 99 | 100 | this.x = - this.x; 101 | this.y = - this.y; 102 | 103 | return this; 104 | 105 | }, 106 | 107 | clone: function () { 108 | 109 | return new THREE.Vector2( this.x, this.y ); 110 | 111 | }, 112 | 113 | toString: function () { 114 | 115 | return 'THREE.Vector2 (' + this.x + ', ' + this.y + ')'; 116 | 117 | } 118 | 119 | }; 120 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/core/Vector3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | * @author kile / http://kile.stravaganza.org/ 4 | * @author philogb / http://blog.thejit.org/ 5 | */ 6 | 7 | THREE.Vector3 = function ( x, y, z ) { 8 | 9 | this.x = x || 0; 10 | this.y = y || 0; 11 | this.z = z || 0; 12 | 13 | }; 14 | 15 | THREE.Vector3.prototype = { 16 | 17 | set: function ( x, y, z ) { 18 | 19 | this.x = x; 20 | this.y = y; 21 | this.z = z; 22 | 23 | return this; 24 | 25 | }, 26 | 27 | copy: function ( v ) { 28 | 29 | this.x = v.x; 30 | this.y = v.y; 31 | this.z = v.z; 32 | 33 | return this; 34 | 35 | }, 36 | 37 | add: function( v1, v2 ) { 38 | 39 | this.x = v1.x + v2.x; 40 | this.y = v1.y + v2.y; 41 | this.z = v1.z + v2.z; 42 | 43 | return this; 44 | 45 | }, 46 | 47 | addSelf: function ( v ) { 48 | 49 | this.x += v.x; 50 | this.y += v.y; 51 | this.z += v.z; 52 | 53 | return this; 54 | 55 | }, 56 | 57 | addScalar: function ( s ) { 58 | 59 | this.x += s; 60 | this.y += s; 61 | this.z += s; 62 | 63 | return this; 64 | 65 | }, 66 | 67 | sub: function( v1, v2 ) { 68 | 69 | this.x = v1.x - v2.x; 70 | this.y = v1.y - v2.y; 71 | this.z = v1.z - v2.z; 72 | 73 | return this; 74 | 75 | }, 76 | 77 | subSelf: function ( v ) { 78 | 79 | this.x -= v.x; 80 | this.y -= v.y; 81 | this.z -= v.z; 82 | 83 | return this; 84 | 85 | }, 86 | 87 | cross: function ( v1, v2 ) { 88 | 89 | this.x = v1.y * v2.z - v1.z * v2.y; 90 | this.y = v1.z * v2.x - v1.x * v2.z; 91 | this.z = v1.x * v2.y - v1.y * v2.x; 92 | 93 | return this; 94 | 95 | }, 96 | 97 | crossSelf: function ( v ) { 98 | 99 | var tx = this.x, ty = this.y, tz = this.z; 100 | 101 | this.x = ty * v.z - tz * v.y; 102 | this.y = tz * v.x - tx * v.z; 103 | this.z = tx * v.y - ty * v.x; 104 | 105 | return this; 106 | 107 | }, 108 | 109 | multiplySelf: function ( v ) { 110 | 111 | this.x *= v.x; 112 | this.y *= v.y; 113 | this.z *= v.z; 114 | 115 | return this; 116 | 117 | }, 118 | 119 | multiplyScalar: function ( s ) { 120 | 121 | this.x *= s; 122 | this.y *= s; 123 | this.z *= s; 124 | 125 | return this; 126 | 127 | }, 128 | 129 | divideScalar: function ( s ) { 130 | 131 | this.x /= s; 132 | this.y /= s; 133 | this.z /= s; 134 | 135 | return this; 136 | 137 | }, 138 | 139 | dot: function ( v ) { 140 | 141 | return this.x * v.x + this.y * v.y + this.z * v.z; 142 | 143 | }, 144 | 145 | distanceTo: function ( v ) { 146 | 147 | return Math.sqrt( this.distanceToSquared( v ) ); 148 | 149 | }, 150 | 151 | distanceToSquared: function ( v ) { 152 | 153 | var dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z; 154 | return dx * dx + dy * dy + dz * dz; 155 | 156 | }, 157 | 158 | length: function () { 159 | 160 | return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); 161 | 162 | }, 163 | 164 | lengthSq: function () { 165 | 166 | return this.x * this.x + this.y * this.y + this.z * this.z; 167 | 168 | }, 169 | 170 | negate: function () { 171 | 172 | this.x = - this.x; 173 | this.y = - this.y; 174 | this.z = - this.z; 175 | 176 | return this; 177 | 178 | }, 179 | 180 | normalize: function () { 181 | 182 | if ( this.length() > 0 ) { 183 | 184 | this.multiplyScalar( 1 / this.length() ); 185 | 186 | } else { 187 | 188 | this.multiplyScalar( 0 ); 189 | 190 | } 191 | 192 | return this; 193 | 194 | }, 195 | 196 | setLength: function( len ) { 197 | 198 | return this.normalize().multiplyScalar( len ); 199 | 200 | }, 201 | 202 | isZero: function () { 203 | 204 | var almostZero = 0.0001; 205 | return ( Math.abs( this.x ) < almostZero ) && ( Math.abs( this.y ) < almostZero ) && ( Math.abs( this.z ) < almostZero ); 206 | 207 | }, 208 | 209 | clone: function () { 210 | 211 | return new THREE.Vector3( this.x, this.y, this.z ); 212 | 213 | }, 214 | 215 | toString: function () { 216 | 217 | return 'THREE.Vector3 ( ' + this.x + ', ' + this.y + ', ' + this.z + ' )'; 218 | 219 | } 220 | 221 | }; 222 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/core/Vector4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author supereggbert / http://www.paulbrunt.co.uk/ 3 | * @author philogb / http://blog.thejit.org/ 4 | */ 5 | 6 | THREE.Vector4 = function ( x, y, z, w ) { 7 | 8 | this.x = x || 0; 9 | this.y = y || 0; 10 | this.z = z || 0; 11 | this.w = w || 1; 12 | 13 | }; 14 | 15 | THREE.Vector4.prototype = { 16 | 17 | set: function ( x, y, z, w ) { 18 | 19 | this.x = x; 20 | this.y = y; 21 | this.z = z; 22 | this.w = w; 23 | 24 | return this; 25 | 26 | }, 27 | 28 | copy: function ( v ) { 29 | 30 | this.x = v.x; 31 | this.y = v.y; 32 | this.z = v.z; 33 | this.w = v.w; 34 | 35 | return this; 36 | 37 | }, 38 | 39 | add: function ( v1, v2 ) { 40 | 41 | this.x = v1.x + v2.x; 42 | this.y = v1.y + v2.y; 43 | this.z = v1.z + v2.z; 44 | this.w = v1.w + v2.w; 45 | 46 | return this; 47 | 48 | }, 49 | 50 | addSelf: function ( v ) { 51 | 52 | this.x += v.x; 53 | this.y += v.y; 54 | this.z += v.z; 55 | this.w += v.w; 56 | 57 | return this; 58 | 59 | }, 60 | 61 | sub: function ( v1, v2 ) { 62 | 63 | this.x = v1.x - v2.x; 64 | this.y = v1.y - v2.y; 65 | this.z = v1.z - v2.z; 66 | this.w = v1.w - v2.w; 67 | 68 | return this; 69 | 70 | }, 71 | 72 | subSelf: function ( v ) { 73 | 74 | this.x -= v.x; 75 | this.y -= v.y; 76 | this.z -= v.z; 77 | this.w -= v.w; 78 | 79 | return this; 80 | 81 | }, 82 | 83 | clone: function () { 84 | 85 | return new THREE.Vector4( this.x, this.y, this.z, this.w ); 86 | 87 | }, 88 | 89 | toString: function () { 90 | 91 | return 'THREE.Vector4 (' + this.x + ', ' + this.y + ', ' + this.z + ', ' + this.w + ')'; 92 | 93 | } 94 | 95 | }; 96 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/core/Vertex.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.Vertex = function ( position, normal ) { 6 | 7 | this.position = position || new THREE.Vector3(); 8 | this.positionWorld = new THREE.Vector3(); 9 | this.positionScreen = new THREE.Vector3(); 10 | 11 | this.normal = normal || new THREE.Vector3(); 12 | this.normalWorld = new THREE.Vector3(); 13 | this.normalScreen = new THREE.Vector3(); 14 | 15 | this.__visible = true; 16 | 17 | } 18 | 19 | THREE.Vertex.prototype = { 20 | 21 | toString: function () { 22 | 23 | return 'THREE.Vertex ( position: ' + this.position + ', normal: ' + this.normal + ' )'; 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/hci/ClickResolver.js: -------------------------------------------------------------------------------- 1 | 2 | THREE.ClickResolver = function( camera, scene ) { 3 | 4 | this.camera = camera; 5 | this.scene = scene; 6 | this._debug = false; 7 | 8 | }; 9 | 10 | THREE.ClickResolver.prototype = { 11 | 12 | findIntersectInScene : function ( xPercent, yPercent ) { 13 | 14 | var objects = this.scene.objects; 15 | var intersects = []; 16 | 17 | var mouseRayStart = this.translateScreenCoordsToZIndex( xPercent, yPercent, 300 ); 18 | var mouseRayEnd = this.translateScreenCoordsToZIndex( xPercent, yPercent, 800 ); 19 | 20 | var mouseRayDir = new THREE.Vector3().sub( mouseRayEnd, mouseRayStart ); 21 | 22 | var closestIntersect = null; 23 | 24 | for ( var i = 0; i < objects.length; i++ ) { 25 | 26 | var o = objects[i]; 27 | var intersect = this.getIntersectingFaces( this.scene, camera, o, mouseRayStart, mouseRayDir ); 28 | 29 | if ( intersect.face != null && 30 | (closestIntersect == null || 31 | closestIntersect.distance > intersect.distance) 32 | ) { 33 | 34 | closestIntersect = intersect; 35 | } 36 | } 37 | 38 | if ( closestIntersect != null && closestIntersect.face.onSelect ) { 39 | 40 | closestIntersect.face.onSelect( scene, camera, o, closestIntersect.face, closestIntersect.point ); 41 | } 42 | }, 43 | 44 | 45 | translateScreenCoordsToZIndex : function ( xPercent, yPercent, targetZIndex ) { 46 | 47 | var maxVisibleXatZIndex, maxVisibleYatZIndex; 48 | var rayToZIndex = new THREE.Vector3(); 49 | var left = new THREE.Vector3(); 50 | var up = new THREE.Vector3(); 51 | var coordAtZIndex = new THREE.Vector3(); 52 | 53 | rayToZIndex.sub( this.camera.target.position, this.camera.position ).setLength( targetZIndex ); 54 | 55 | maxVisibleYatZIndex = rayToZIndex.length() * Math.tan( this.camera.fov * Math.PI / 360 ); 56 | maxVisibleXatZIndex = maxVisibleYatZIndex * this.camera.aspect; 57 | 58 | left.cross( this.camera.up, rayToZIndex ); 59 | up .cross( rayToZIndex, left ); 60 | 61 | return coordAtZIndex.add( this.camera.position, rayToZIndex ). 62 | addSelf( left.setLength( maxVisibleXatZIndex * ( 1 - 2 * xPercent ))). 63 | addSelf( up .setLength( maxVisibleYatZIndex * ( 1 - 2 * yPercent ))); 64 | }, 65 | 66 | 67 | logPoint: function( scene, v, hex ) { 68 | 69 | if ( this._debug ) { 70 | 71 | var vg = new THREE.Geometry(); 72 | 73 | vg.vertices[ 0 ] = new THREE.Vertex( v ); 74 | vg.vertices[ 1 ] = new THREE.Vertex( v ); 75 | 76 | scene.addObject( new THREE.Line( vg, new THREE.LineColorMaterial( hex, 1, 10 ))); 77 | } 78 | }, 79 | 80 | 81 | logLine: function( scene, s, e, hex ) { 82 | 83 | if ( this._debug ) { 84 | 85 | this.logPoint( scene, s.clone(), 0x000000 ); 86 | 87 | var lg = new THREE.Geometry(); 88 | 89 | lg.vertices[0] = new THREE.Vertex( s.clone() ); 90 | lg.vertices[1] = new THREE.Vertex( e.clone() ); 91 | 92 | scene.addObject(new THREE.Line( lg, new THREE.LineColorMaterial( hex, 1, 4 ) )); 93 | } 94 | 95 | }, 96 | 97 | 98 | getIntersectingFaces: function( scene, camera, object3d, linePoint, lineDir ) { 99 | 100 | var intersect = { 101 | face : null, 102 | point : null, 103 | distance : Number.MAX_VALUE 104 | }; 105 | 106 | var geo = object3d.geometry; 107 | var matrix = object3d.matrix; 108 | 109 | for ( f = 0; f < geo.faces.length; f++ ) { 110 | 111 | var face = geo.faces[ f ]; 112 | 113 | if ( !face.selectable ) continue; 114 | 115 | var a = matrix.transform( geo.vertices[ face.a ].position.clone() ); 116 | var b = matrix.transform( geo.vertices[ face.b ].position.clone() ); 117 | var c = matrix.transform( geo.vertices[ face.c ].position.clone() ); 118 | var d = null; 119 | 120 | if ( face.d ) { 121 | 122 | d = matrix.transform( geo.vertices[ face.d ].position.clone() ); 123 | } 124 | 125 | var lineStart = linePoint.clone(); 126 | var lineDirection = lineDir.clone(); 127 | var dot = face.normal.dot( lineDirection ); 128 | 129 | if ( this._debug ) { 130 | 131 | this.logLine( scene, a, new THREE.Vector3().add( a, new THREE.Vector3().addSelf( face.normal ).multiplyScalar( 100 )), 0x0000FF ); 132 | this.logLine( scene, lineStart, lineStart.clone().addSelf(lineDirection), 0x55FF88 ); 133 | this.logPoint( scene, a, 0xFF0000 ); // r 134 | this.logPoint( scene, b, 0x00FF00 ); // g 135 | this.logPoint( scene, c, 0x0000FF ); // b 136 | this.logPoint( scene, d, 0xFFFF00 ); // y 137 | } 138 | 139 | if ( Math.abs(dot) > .0001 ) { 140 | 141 | var s = face.normal.dot( new THREE.Vector3().sub( a, lineStart ) ) / dot; 142 | var planeIntersect = lineStart.addSelf( lineDirection.multiplyScalar( s ) ); 143 | 144 | if ( this._debug ) this.logPoint( scene, planeIntersect, 0xFFCCAA ); 145 | 146 | if ( d == null ) { 147 | 148 | var ab = isInsideBoundary( planeIntersect, a, b, c ); 149 | var bc = isInsideBoundary( planeIntersect, b, c, a ); 150 | var ca = isInsideBoundary( planeIntersect, c, a, b ); 151 | 152 | if ( ab && bc && ca ) { 153 | 154 | if ( this._debug ) this.logPoint( scene, planeIntersect, 0xFF0000 ); 155 | logIntersect( planeIntersect, face ); 156 | 157 | } 158 | } else { 159 | 160 | var ab = isInsideBoundary( planeIntersect, a, b, c ); 161 | var bc = isInsideBoundary( planeIntersect, b, c, d ); 162 | var cd = isInsideBoundary( planeIntersect, c, d, a ); 163 | var da = isInsideBoundary( planeIntersect, d, a, b ); 164 | 165 | if ( ab && bc && cd && da ) { 166 | 167 | if ( this._debug ) this.logPoint( scene, planeIntersect, 0xFF0000 ); 168 | logIntersect( planeIntersect, face ); 169 | 170 | } 171 | } 172 | } 173 | } 174 | 175 | function logIntersect( planeIntersect, face ) { 176 | 177 | var distance = camera.position.distanceTo( planeIntersect ); 178 | 179 | if ( distance < intersect.distance ) { 180 | 181 | intersect.distance = distance; 182 | intersect.face = face; 183 | intersect.point = planeIntersect; 184 | } 185 | } 186 | 187 | function isInsideBoundary( pointOnPlaneToCheck, pointInside, boundaryPointA, boundaryPointB ) { 188 | 189 | var toB = boundaryPointB.clone().subSelf( boundaryPointA ); 190 | var toI = pointInside.clone().subSelf( boundaryPointA ); 191 | var pointMid = toB.setLength( toI.dot( toB ) ).addSelf( boundaryPointA ); 192 | var pointMirror = pointMid.subSelf( pointInside ).multiplyScalar( 2 ).addSelf( pointInside ); 193 | 194 | return pointOnPlaneToCheck.distanceToSquared( pointInside ) < 195 | pointOnPlaneToCheck.distanceToSquared( pointMirror ); 196 | }; 197 | 198 | return intersect; 199 | } 200 | 201 | 202 | }; 203 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/hci/SelectableFace3.js: -------------------------------------------------------------------------------- 1 | THREE.SelectableFace3 = function ( a, b, c, normal, color, onSelect) { 2 | 3 | THREE.Face3.call( this, a, b, c, normal, color ); 4 | 5 | this.selectable = true; 6 | this.onSelect = onSelect; 7 | }; 8 | 9 | THREE.SelectableFace3.prototype = new THREE.Face3(); 10 | THREE.SelectableFace3.prototype.constructor = THREE.SelectableFace3; -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/hci/SelectableFace4.js: -------------------------------------------------------------------------------- 1 | var SelectableFace4 = function ( a, b, c, d, onSelect, normal, color) { 2 | 3 | THREE.Face4.call( this, a, b, c, d, normal, color ); 4 | 5 | this.selectable = true; 6 | this.onSelect = onSelect; 7 | }; 8 | 9 | SelectableFace4.prototype = new THREE.Face4(); 10 | SelectableFace4.prototype.constructor = SelectableFace4; 11 | THREE.SelectableFace4 = SelectableFace4; -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/lights/AmbientLight.js: -------------------------------------------------------------------------------- 1 | THREE.AmbientLight = function ( hex ) { 2 | 3 | THREE.Light.call( this, hex ); 4 | 5 | }; 6 | 7 | THREE.AmbientLight.prototype = new THREE.Light(); 8 | THREE.AmbientLight.prototype.constructor = THREE.AmbientLight; 9 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/lights/DirectionalLight.js: -------------------------------------------------------------------------------- 1 | THREE.DirectionalLight = function ( hex, intensity ) { 2 | 3 | THREE.Light.call( this, hex ); 4 | 5 | this.position = new THREE.Vector3( 0, 1, 0 ); 6 | this.intensity = intensity || 1; 7 | 8 | }; 9 | 10 | THREE.DirectionalLight.prototype = new THREE.Light(); 11 | THREE.DirectionalLight.prototype.constructor = THREE.DirectionalLight; 12 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/lights/Light.js: -------------------------------------------------------------------------------- 1 | THREE.Light = function ( hex ) { 2 | 3 | this.color = new THREE.Color( 0xff << 24 | hex ); 4 | 5 | }; 6 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/lights/PointLight.js: -------------------------------------------------------------------------------- 1 | THREE.PointLight = function ( hex, intensity ) { 2 | 3 | THREE.Light.call( this, hex ); 4 | 5 | this.position = new THREE.Vector3( 0, 0, 0 ); 6 | this.intensity = intensity || 1; 7 | 8 | }; 9 | 10 | THREE.DirectionalLight.prototype = new THREE.Light(); 11 | THREE.DirectionalLight.prototype.constructor = THREE.PointLight; 12 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/materials/LineColorMaterial.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.LineColorMaterial = function ( hex, opacity, lineWidth ) { 6 | 7 | this.lineWidth = lineWidth || 1; 8 | 9 | this.color = new THREE.Color( ( opacity >= 0 ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex ); 10 | 11 | }; 12 | 13 | THREE.LineColorMaterial.prototype = { 14 | 15 | toString: function () { 16 | 17 | return 'THREE.LineColorMaterial ( color: ' + this.color + ', lineWidth: ' + this.lineWidth + ' )'; 18 | 19 | } 20 | 21 | }; 22 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/materials/MeshBitmapUVMappingMaterial.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.MeshBitmapUVMappingMaterial = function ( bitmap ) { 6 | 7 | this.bitmap = bitmap; 8 | 9 | this.toString = function () { 10 | 11 | return 'THREE.MeshBitmapUVMappingMaterial ( bitmap: ' + this.bitmap + ' )'; 12 | 13 | }; 14 | 15 | }; 16 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/materials/MeshColorFillMaterial.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.MeshColorFillMaterial = function ( hex, opacity ) { 6 | 7 | this.color = new THREE.Color( ( opacity >= 0 ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex ); 8 | 9 | this.toString = function () { 10 | 11 | return 'THREE.MeshColorFillMaterial ( color: ' + this.color + ' )'; 12 | 13 | }; 14 | 15 | }; 16 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/materials/MeshColorStrokeMaterial.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.MeshColorStrokeMaterial = function ( hex, opacity, lineWidth ) { 6 | 7 | this.lineWidth = lineWidth || 1; 8 | 9 | this.color = new THREE.Color( ( opacity >= 0 ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex ); 10 | 11 | this.toString = function () { 12 | 13 | return 'THREE.MeshColorStrokeMaterial ( lineWidth: ' + this.lineWidth + ', color: ' + this.color + ' )'; 14 | 15 | }; 16 | 17 | }; 18 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/materials/MeshFaceColorFillMaterial.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.MeshFaceColorFillMaterial = function () { 6 | 7 | this.toString = function () { 8 | 9 | return 'THREE.MeshFaceColorFillMaterial ( )'; 10 | 11 | }; 12 | 13 | }; 14 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/materials/MeshFaceColorStrokeMaterial.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.MeshFaceColorStrokeMaterial = function ( lineWidth ) { 6 | 7 | this.lineWidth = lineWidth || 1; 8 | 9 | this.toString = function () { 10 | 11 | return 'THREE.MeshFaceColorStrokeMaterial ( lineWidth: ' + this.lineWidth + ' )'; 12 | 13 | }; 14 | 15 | }; 16 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/materials/ParticleBitmapMaterial.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.ParticleBitmapMaterial = function ( bitmap ) { 6 | 7 | this.bitmap = bitmap; 8 | this.offset = new THREE.Vector2(); 9 | 10 | this.toString = function () { 11 | 12 | return 'THREE.ParticleBitmapMaterial ( bitmap: ' + this.bitmap + ' )'; 13 | 14 | }; 15 | 16 | }; 17 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/materials/ParticleCircleMaterial.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.ParticleCircleMaterial = function ( hex, opacity ) { 6 | 7 | this.color = new THREE.Color( ( opacity >= 0 ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex ); 8 | 9 | this.toString = function () { 10 | 11 | return 'THREE.ParticleCircleMaterial ( color: ' + this.color + ' )'; 12 | 13 | }; 14 | 15 | }; 16 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/materials/ParticleDOMMaterial.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.ParticleDOMMaterial = function ( domElement ) { 6 | 7 | this.domElement = domElement; 8 | 9 | this.toString = function () { 10 | 11 | return 'THREE.ParticleDOMMaterial ( domElement: ' + this.domElement + ' )'; 12 | 13 | }; 14 | 15 | }; 16 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/objects/Line.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.Line = function ( geometry, material ) { 6 | 7 | THREE.Object3D.call( this ); 8 | 9 | this.geometry = geometry; 10 | this.material = material instanceof Array ? material : [ material ]; 11 | 12 | }; 13 | 14 | THREE.Line.prototype = new THREE.Object3D(); 15 | THREE.Line.prototype.constructor = THREE.Line; 16 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/objects/Mesh.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.Mesh = function ( geometry, material ) { 6 | 7 | THREE.Object3D.call( this ); 8 | 9 | this.geometry = geometry; 10 | this.material = material instanceof Array ? material : [ material ]; 11 | 12 | this.flipSided = false; 13 | this.doubleSided = false; 14 | 15 | this.overdraw = false; 16 | 17 | }; 18 | 19 | THREE.Mesh.prototype = new THREE.Object3D(); 20 | THREE.Mesh.prototype.constructor = THREE.Mesh; 21 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/objects/Object3D.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.Object3D = function ( material ) { 6 | 7 | this.position = new THREE.Vector3(); 8 | this.rotation = new THREE.Vector3(); 9 | this.scale = new THREE.Vector3( 1, 1, 1 ); 10 | 11 | this.matrix = new THREE.Matrix4(); 12 | this.matrixTranslation = new THREE.Matrix4(); 13 | this.matrixRotation = new THREE.Matrix4(); 14 | this.matrixScale = new THREE.Matrix4(); 15 | 16 | this.screen = new THREE.Vector3(); 17 | 18 | this.autoUpdateMatrix = true; 19 | 20 | this.updateMatrix = function () { 21 | 22 | this.matrixPosition = THREE.Matrix4.translationMatrix( this.position.x, this.position.y, this.position.z ); 23 | 24 | this.matrixRotation = THREE.Matrix4.rotationXMatrix( this.rotation.x ); 25 | this.matrixRotation.multiplySelf( THREE.Matrix4.rotationYMatrix( this.rotation.y ) ); 26 | this.matrixRotation.multiplySelf( THREE.Matrix4.rotationZMatrix( this.rotation.z ) ); 27 | 28 | this.matrixScale = THREE.Matrix4.scaleMatrix( this.scale.x, this.scale.y, this.scale.z ); 29 | 30 | this.matrix.copy( this.matrixPosition ); 31 | this.matrix.multiplySelf( this.matrixRotation ); 32 | this.matrix.multiplySelf( this.matrixScale ); 33 | 34 | }; 35 | 36 | }; 37 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/objects/Particle.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.Particle = function ( material ) { 6 | 7 | THREE.Object3D.call( this ); 8 | 9 | this.material = material instanceof Array ? material : [ material ]; 10 | this.autoUpdateMatrix = false; 11 | 12 | }; 13 | 14 | THREE.Particle.prototype = new THREE.Object3D(); 15 | THREE.Particle.prototype.constructor = THREE.Particle; 16 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/renderers/DOMRenderer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.DOMRenderer = function () { 6 | 7 | THREE.Renderer.call( this ); 8 | 9 | var _renderList = null, 10 | _projector = new THREE.Projector(), 11 | _div = document.createElement( 'div' ), 12 | _width, _height, _widthHalf, _heightHalf; 13 | 14 | this.domElement = _div; 15 | 16 | this.setSize = function ( width, height ) { 17 | 18 | _width = width; _height = height; 19 | _widthHalf = _width / 2; _heightHalf = _height / 2; 20 | 21 | }; 22 | 23 | this.render = function ( scene, camera ) { 24 | 25 | var e, el, m, ml, element, material, dom, v1x, v1y; 26 | 27 | _renderList = _projector.projectScene( scene, camera ); 28 | 29 | for ( e = 0, el = _renderList.length; e < el; e++ ) { 30 | 31 | element = _renderList[ e ]; 32 | 33 | if ( element instanceof THREE.RenderableParticle ) { 34 | 35 | v1x = element.x * _widthHalf + _widthHalf; v1y = element.y * _heightHalf + _heightHalf; 36 | 37 | for ( m = 0, ml = element.material.length; m < ml; m++ ) { 38 | 39 | material = element.material[ m ]; 40 | 41 | if ( material instanceof THREE.ParticleDOMMaterial ) { 42 | 43 | dom = material.domElement; 44 | dom.style.left = v1x + 'px'; 45 | dom.style.top = v1y + 'px'; 46 | 47 | } 48 | 49 | } 50 | 51 | } 52 | 53 | } 54 | 55 | }; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/renderers/Projector.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | * @author supereggbert / http://www.paulbrunt.co.uk/ 4 | */ 5 | 6 | THREE.Projector = function() { 7 | 8 | var _renderList = null, 9 | _face3, _face3Count, _face3Pool = [], 10 | _face4, _face4Count, _face4Pool = [], 11 | _line, _lineCount, _linePool = [], 12 | _particle, _particleCount, _particlePool = [], 13 | 14 | _vector4 = new THREE.Vector4(), 15 | _projScreenMatrix = new THREE.Matrix4(), 16 | _projScreenObjectMatrix = new THREE.Matrix4(); 17 | 18 | this.projectScene = function ( scene, camera ) { 19 | 20 | var o, ol, v, vl, f, fl, objects, object, objectMatrix, 21 | vertices, vertex, vertexPositionScreen, vertex2, 22 | faces, face, v1, v2, v3, v4; 23 | 24 | _renderList = []; 25 | _face3Count = 0, _face4Count = 0, _lineCount = 0, _particleCount = 0; 26 | 27 | if( camera.autoUpdateMatrix ) { 28 | 29 | camera.updateMatrix(); 30 | 31 | } 32 | 33 | _projScreenMatrix.multiply( camera.projectionMatrix, camera.matrix ); 34 | 35 | objects = scene.objects; 36 | 37 | for ( o = 0, ol = objects.length; o < ol; o++ ) { 38 | 39 | object = objects[ o ]; 40 | objectMatrix = object.matrix; 41 | 42 | if( object.autoUpdateMatrix ) { 43 | 44 | object.updateMatrix(); 45 | 46 | } 47 | 48 | if ( object instanceof THREE.Mesh ) { 49 | 50 | _projScreenObjectMatrix.multiply( _projScreenMatrix, objectMatrix ); 51 | 52 | // vertices 53 | 54 | vertices = object.geometry.vertices; 55 | 56 | for ( v = 0, vl = vertices.length; v < vl; v++ ) { 57 | 58 | vertex = vertices[ v ]; 59 | 60 | vertexPositionScreen = vertex.positionScreen; 61 | vertexPositionScreen.copy( vertex.position ); 62 | _projScreenObjectMatrix.transform( vertexPositionScreen ); 63 | 64 | vertex.__visible = vertexPositionScreen.z > 0 && vertexPositionScreen.z < 1; 65 | 66 | } 67 | 68 | // faces 69 | 70 | faces = object.geometry.faces; 71 | 72 | for ( f = 0, fl = faces.length; f < fl; f++ ) { 73 | 74 | face = faces[ f ]; 75 | 76 | if ( face instanceof THREE.Face3 ) { 77 | 78 | v1 = vertices[ face.a ]; v2 = vertices[ face.b ]; v3 = vertices[ face.c ]; 79 | 80 | if ( v1.__visible && v2.__visible && v3.__visible ) { 81 | 82 | if ( ( object.doubleSided || ( object.flipSided != 83 | ( v3.positionScreen.x - v1.positionScreen.x ) * ( v2.positionScreen.y - v1.positionScreen.y ) - 84 | ( v3.positionScreen.y - v1.positionScreen.y ) * ( v2.positionScreen.x - v1.positionScreen.x ) < 0 ) ) ) { 85 | 86 | _face3 = _face3Pool[ _face3Count ] = _face3Pool[ _face3Count ] || new THREE.RenderableFace3(); 87 | _face3.v1.copy( v1.positionScreen ); 88 | _face3.v2.copy( v2.positionScreen ); 89 | _face3.v3.copy( v3.positionScreen ); 90 | 91 | _face3.centroidWorld.copy( face.centroid ); 92 | object.matrix.transform( _face3.centroidWorld ); 93 | 94 | _face3.normalWorld.copy( face.normal ); 95 | object.matrixRotation.transform( _face3.normalWorld ); 96 | 97 | _face3.z = Math.max( v1.positionScreen.z, Math.max( v2.positionScreen.z, v3.positionScreen.z ) ); 98 | 99 | _face3.material = object.material; 100 | _face3.overdraw = object.overdraw; 101 | _face3.uvs = object.geometry.uvs[ f ]; 102 | _face3.color = face.color; 103 | 104 | _renderList.push( _face3 ); 105 | 106 | _face3Count ++; 107 | 108 | } 109 | 110 | } 111 | 112 | } else if ( face instanceof THREE.Face4 ) { 113 | 114 | v1 = vertices[ face.a ]; v2 = vertices[ face.b ]; v3 = vertices[ face.c ]; v4 = vertices[ face.d ]; 115 | 116 | if ( v1.__visible && v2.__visible && v3.__visible && v4.__visible ) { 117 | 118 | if ( ( object.doubleSided || ( object.flipSided != 119 | ( ( v4.positionScreen.x - v1.positionScreen.x ) * ( v2.positionScreen.y - v1.positionScreen.y ) - 120 | ( v4.positionScreen.y - v1.positionScreen.y ) * ( v2.positionScreen.x - v1.positionScreen.x ) < 0 || 121 | ( v2.positionScreen.x - v3.positionScreen.x ) * ( v4.positionScreen.y - v3.positionScreen.y ) - 122 | ( v2.positionScreen.y - v3.positionScreen.y ) * ( v4.positionScreen.x - v3.positionScreen.x ) < 0 ) ) ) ) { 123 | 124 | _face4 = _face4Pool[ _face4Count ] = _face4Pool[ _face4Count ] || new THREE.RenderableFace4(); 125 | _face4.v1.copy( v1.positionScreen ); 126 | _face4.v2.copy( v2.positionScreen ); 127 | _face4.v3.copy( v3.positionScreen ); 128 | _face4.v4.copy( v4.positionScreen ); 129 | 130 | _face4.centroidWorld.copy( face.centroid ); 131 | object.matrix.transform( _face4.centroidWorld ); 132 | 133 | _face4.normalWorld.copy( face.normal ); 134 | object.matrixRotation.transform( _face4.normalWorld ); 135 | 136 | _face4.z = Math.max( v1.positionScreen.z, Math.max( v2.positionScreen.z, Math.max( v3.positionScreen.z, v4.positionScreen.z ) ) ); 137 | 138 | _face4.material = object.material; 139 | _face4.overdraw = object.overdraw; 140 | _face4.uvs = object.geometry.uvs[ f ]; 141 | _face4.color = face.color; 142 | 143 | _renderList.push( _face4 ); 144 | 145 | _face4Count ++; 146 | 147 | } 148 | 149 | } 150 | 151 | } 152 | 153 | } 154 | 155 | } else if ( object instanceof THREE.Line ) { 156 | 157 | _projScreenObjectMatrix.multiply( _projScreenMatrix, objectMatrix ); 158 | 159 | vertices = object.geometry.vertices; 160 | 161 | for ( v = 0, vl = vertices.length; v < vl; v++ ) { 162 | 163 | vertex = vertices[ v ]; 164 | 165 | vertexPositionScreen = vertex.positionScreen; 166 | vertexPositionScreen.copy( vertex.position ); 167 | _projScreenObjectMatrix.transform( vertexPositionScreen ); 168 | 169 | vertex.__visible = vertexPositionScreen.z > 0 && vertexPositionScreen.z < 1; 170 | 171 | if ( v > 0 ) { 172 | 173 | vertex2 = object.geometry.vertices[ v - 1 ]; 174 | 175 | if ( vertex.__visible && vertex2.__visible ) { 176 | 177 | _line = _linePool[ _lineCount ] = _linePool[ _lineCount ] || new THREE.RenderableLine(); 178 | _line.v1.copy( vertex.positionScreen ); 179 | _line.v2.copy( vertex2.positionScreen ); 180 | _line.z = Math.max( vertex.positionScreen.z, vertex2.positionScreen.z ); 181 | _line.material = object.material; 182 | 183 | _renderList.push( _line ); 184 | 185 | _lineCount ++; 186 | 187 | } 188 | } 189 | } 190 | 191 | } else if ( object instanceof THREE.Particle ) { 192 | 193 | _vector4.set( object.position.x, object.position.y, object.position.z, 1 ); 194 | 195 | camera.matrix.transform( _vector4 ); 196 | camera.projectionMatrix.transform( _vector4 ); 197 | 198 | object.screen.set( _vector4.x / _vector4.w, _vector4.y / _vector4.w, _vector4.z / _vector4.w ); 199 | 200 | if ( object.screen.z > 0 && object.screen.z < 1 ) { 201 | 202 | _particle = _particlePool[ _particleCount ] = _particlePool[ _particleCount ] || new THREE.RenderableParticle(); 203 | _particle.x = object.screen.x; 204 | _particle.y = object.screen.y; 205 | _particle.z = object.screen.z; 206 | 207 | _particle.rotation = object.rotation.z; 208 | 209 | _particle.scale.x = object.scale.x * Math.abs( _vector4.x / _vector4.w - ( _vector4.x + camera.projectionMatrix.n11 ) / ( _vector4.w + camera.projectionMatrix.n14 ) ); 210 | _particle.scale.y = object.scale.y * Math.abs( _vector4.y / _vector4.w - ( _vector4.y + camera.projectionMatrix.n22 ) / ( _vector4.w + camera.projectionMatrix.n24 ) ); 211 | _particle.material = object.material; 212 | _particle.color = object.color; 213 | 214 | _renderList.push( _particle ); 215 | 216 | _particleCount ++; 217 | 218 | } 219 | 220 | } 221 | 222 | } 223 | 224 | _renderList.sort( function ( a, b ) { return b.z - a.z; } ); 225 | 226 | return _renderList; 227 | 228 | }; 229 | 230 | }; 231 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/renderers/SVGRenderer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.SVGRenderer = function () { 6 | 7 | var _renderList = null, 8 | _projector = new THREE.Projector(), 9 | _svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'), 10 | _width, _height, _widthHalf, _heightHalf, 11 | _clipRect = new THREE.Rectangle(), 12 | _bboxRect = new THREE.Rectangle(), 13 | 14 | _enableLighting = false, 15 | _color = new THREE.Color( 0xffffffff ), 16 | _light = new THREE.Color( 0xffffffff ), 17 | _ambientLight = new THREE.Color( 0xffffffff ), 18 | 19 | _vector3 = new THREE.Vector3(), // Needed for PointLight 20 | 21 | _svgPathPool = [], _svgCirclePool = [], 22 | _quality = 1; 23 | 24 | this.domElement = _svg; 25 | this.autoClear = true; 26 | 27 | this.setQuality = function( quality ) { 28 | 29 | switch(quality) { 30 | 31 | case "high": _quality = 1; break; 32 | case "low": _quality = 0; break; 33 | 34 | } 35 | 36 | }; 37 | 38 | this.setSize = function ( width, height ) { 39 | 40 | _width = width; _height = height; 41 | _widthHalf = _width / 2; _heightHalf = _height / 2; 42 | 43 | _svg.setAttribute( 'viewBox', ( - _widthHalf ) + ' ' + ( - _heightHalf ) + ' ' + _width + ' ' + _height ); 44 | _svg.setAttribute( 'width', _width ); 45 | _svg.setAttribute( 'height', _height ); 46 | 47 | _clipRect.set( - _widthHalf, - _heightHalf, _widthHalf, _heightHalf ); 48 | 49 | }; 50 | 51 | this.clear = function () { 52 | 53 | while ( _svg.childNodes.length > 0 ) { 54 | 55 | _svg.removeChild( _svg.childNodes[ 0 ] ); 56 | 57 | } 58 | 59 | }; 60 | 61 | this.render = function ( scene, camera ) { 62 | 63 | var e, el, m, ml, element, material, 64 | pathCount = 0, circleCount = 0, svgNode, 65 | v1x, v1y, v2x, v2y, v3x, v3y, v4x, v4y, 66 | size; 67 | 68 | if ( this.autoClear ) { 69 | 70 | this.clear(); 71 | 72 | } 73 | 74 | _renderList = _projector.projectScene( scene, camera ); 75 | 76 | _enableLighting = scene.lights.length > 0; 77 | 78 | if ( _enableLighting ) { 79 | 80 | calculateAmbientLight( scene, _ambientLight ); 81 | 82 | } 83 | 84 | for ( e = 0, el = _renderList.length; e < el; e++ ) { 85 | 86 | element = _renderList[ e ]; 87 | 88 | for ( m = 0, ml = element.material.length; m < ml; m++ ) { 89 | 90 | material = element.material[ m ]; 91 | 92 | _bboxRect.empty(); 93 | 94 | if ( element instanceof THREE.RenderableParticle ) { 95 | 96 | v1x = element.x * _widthHalf; v1y = element.y * -_heightHalf; 97 | size = element.size * _widthHalf; 98 | 99 | _bboxRect.set( v1x - size, v1y - size, v1x + size, v1y + size ); 100 | 101 | if ( !_clipRect.instersects( _bboxRect ) ) { 102 | 103 | continue; 104 | 105 | } 106 | 107 | svgNode = getCircleNode( circleCount++ ); 108 | svgNode.setAttribute( 'cx', v1x ); 109 | svgNode.setAttribute( 'cy', v1y ); 110 | svgNode.setAttribute( 'r', size ); 111 | 112 | } else if ( element instanceof THREE.RenderableFace3 ) { 113 | 114 | v1x = element.v1.x * _widthHalf; v1y = element.v1.y * -_heightHalf; 115 | v2x = element.v2.x * _widthHalf; v2y = element.v2.y * -_heightHalf; 116 | v3x = element.v3.x * _widthHalf; v3y = element.v3.y * -_heightHalf; 117 | 118 | _bboxRect.addPoint( v1x, v1y ); 119 | _bboxRect.addPoint( v2x, v2y ); 120 | _bboxRect.addPoint( v3x, v3y ); 121 | 122 | if ( !_clipRect.instersects( _bboxRect ) ) { 123 | 124 | continue; 125 | 126 | } 127 | 128 | svgNode = getPathNode( pathCount++ ); 129 | svgNode.setAttribute( 'd', 'M ' + v1x + ' ' + v1y + ' L ' + v2x + ' ' + v2y + ' L ' + v3x + ',' + v3y + 'z' ); 130 | 131 | } else if ( element instanceof THREE.RenderableFace4 ) { 132 | 133 | v1x = element.v1.x * _widthHalf; v1y = element.v1.y * -_heightHalf; 134 | v2x = element.v2.x * _widthHalf; v2y = element.v2.y * -_heightHalf; 135 | v3x = element.v3.x * _widthHalf; v3y = element.v3.y * -_heightHalf; 136 | v4x = element.v4.x * _widthHalf; v4y = element.v4.y * -_heightHalf; 137 | 138 | _bboxRect.addPoint( v1x, v1y ); 139 | _bboxRect.addPoint( v2x, v2y ); 140 | _bboxRect.addPoint( v3x, v3y ); 141 | _bboxRect.addPoint( v4x, v4y ); 142 | 143 | if ( !_clipRect.instersects( _bboxRect) ) { 144 | 145 | continue; 146 | 147 | } 148 | 149 | svgNode = getPathNode( pathCount++ ); 150 | svgNode.setAttribute( 'd', 'M ' + v1x + ' ' + v1y + ' L ' + v2x + ' ' + v2y + ' L ' + v3x + ',' + v3y + ' L ' + v4x + ',' + v4y + 'z' ); 151 | 152 | } 153 | 154 | 155 | // TODO: Move out of materials loop 156 | 157 | if ( material instanceof THREE.MeshColorFillMaterial ) { 158 | 159 | if ( _enableLighting ) { 160 | 161 | _light.copyRGB( _ambientLight ); 162 | calculateFaceLight( scene, element, _light ); 163 | 164 | _color.copyRGBA( material.color ); 165 | _color.multiplySelfRGB( _light ); 166 | _color.updateStyleString(); 167 | 168 | } else { 169 | 170 | _color = material.color; 171 | 172 | } 173 | 174 | svgNode.setAttribute( 'style', 'fill: ' + _color.__styleString ); 175 | 176 | } else if ( material instanceof THREE.MeshFaceColorFillMaterial ) { 177 | 178 | if ( _enableLighting ) { 179 | 180 | _light.copyRGB( _ambientLight ); 181 | calculateFaceLight( scene, element, _light ); 182 | 183 | _color.copyRGBA( element.color ); 184 | _color.multiplySelfRGB( _light ); 185 | _color.updateStyleString(); 186 | 187 | } else { 188 | 189 | _color = element.color; 190 | 191 | } 192 | 193 | svgNode.setAttribute( 'style', 'fill: ' + _color.__styleString ); 194 | 195 | } else if ( material instanceof THREE.MeshColorStrokeMaterial ) { 196 | 197 | if ( _enableLighting ) { 198 | 199 | _light.copyRGB( _ambientLight ); 200 | calculateFaceLight( scene, element, _light ); 201 | 202 | _color.copyRGBA( material.color ); 203 | _color.multiplySelfRGB( _light ); 204 | _color.updateStyleString(); 205 | 206 | } else { 207 | 208 | _color = material.color; 209 | 210 | } 211 | 212 | svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.__styleString + '; stroke-width: ' + material.lineWidth + '; stroke-linecap: round; stroke-linejoin: round' ); 213 | 214 | } else if ( material instanceof THREE.MeshFaceColorStrokeMaterial ) { 215 | 216 | if ( _enableLighting ) { 217 | 218 | _light.copyRGB( _ambientLight ); 219 | calculateFaceLight( scene, element, _light ); 220 | 221 | _color.copyRGBA( element.color ); 222 | _color.multiplySelfRGB( _light ); 223 | _color.updateStyleString(); 224 | 225 | } else { 226 | 227 | _color = element.color; 228 | 229 | } 230 | 231 | svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.__styleString + '; stroke-width: ' + material.lineWidth + '; stroke-linecap: round; stroke-linejoin: round' ); 232 | 233 | } 234 | 235 | _svg.appendChild( svgNode ); 236 | 237 | } 238 | 239 | } 240 | 241 | }; 242 | 243 | function calculateAmbientLight( scene, color ) { 244 | 245 | var l, ll, light; 246 | 247 | color.setRGBA( 1, 1, 1, 1 ); 248 | 249 | for ( l = 0, ll = scene.lights.length; l < ll; l++ ) { 250 | 251 | light = scene.lights[ l ]; 252 | 253 | if ( light instanceof THREE.AmbientLight ) { 254 | 255 | color.r *= light.color.r; 256 | color.g *= light.color.g; 257 | color.b *= light.color.b; 258 | 259 | } 260 | 261 | } 262 | 263 | } 264 | 265 | function calculateFaceLight( scene, element, color ) { 266 | 267 | var l, ll, light, amount; 268 | 269 | for ( l = 0, ll = scene.lights.length; l < ll; l++ ) { 270 | 271 | light = scene.lights[ l ]; 272 | 273 | if ( light instanceof THREE.DirectionalLight ) { 274 | 275 | amount = element.normalWorld.dot( light.position ) * light.intensity; 276 | 277 | if ( amount > 0 ) { 278 | 279 | color.r += light.color.r * amount; 280 | color.g += light.color.g * amount; 281 | color.b += light.color.b * amount; 282 | 283 | } 284 | 285 | } else if ( light instanceof THREE.PointLight ) { 286 | 287 | _vector3.sub( light.position, element.centroidWorld ); 288 | _vector3.normalize(); 289 | 290 | amount = element.normalWorld.dot( _vector3 ) * light.intensity; 291 | 292 | if ( amount > 0 ) { 293 | 294 | color.r += light.color.r * amount; 295 | color.g += light.color.g * amount; 296 | color.b += light.color.b * amount; 297 | 298 | } 299 | 300 | } 301 | 302 | } 303 | 304 | } 305 | 306 | function getPathNode( id ) { 307 | 308 | if ( _svgPathPool[ id ] == null ) { 309 | 310 | _svgPathPool[ id ] = document.createElementNS( 'http://www.w3.org/2000/svg', 'path' ); 311 | 312 | if ( _quality == 0 ) { 313 | 314 | _svgPathPool[ id ].setAttribute( 'shape-rendering', 'crispEdges' ); //optimizeSpeed 315 | 316 | } 317 | 318 | return _svgPathPool[ id ]; 319 | 320 | } 321 | 322 | return _svgPathPool[ id ]; 323 | 324 | } 325 | 326 | function getCircleNode( id ) { 327 | 328 | if ( _svgCirclePool[id] == null ) { 329 | 330 | _svgCirclePool[ id ] = document.createElementNS( 'http://www.w3.org/2000/svg', 'circle' ); 331 | 332 | if ( _quality == 0 ) { 333 | 334 | _svgCirclePool[id].setAttribute( 'shape-rendering', 'crispEdges' ); //optimizeSpeed 335 | 336 | } 337 | 338 | return _svgCirclePool[ id ]; 339 | 340 | } 341 | 342 | return _svgCirclePool[ id ]; 343 | 344 | } 345 | 346 | }; 347 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/renderers/renderables/RenderableFace3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.RenderableFace3 = function () { 6 | 7 | this.v1 = new THREE.Vector2(); 8 | this.v2 = new THREE.Vector2(); 9 | this.v3 = new THREE.Vector2(); 10 | 11 | this.centroidWorld = new THREE.Vector3(); 12 | this.normalWorld = new THREE.Vector3(); 13 | 14 | this.z = null; 15 | 16 | this.color = null; 17 | this.material = null; 18 | 19 | }; 20 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/renderers/renderables/RenderableFace4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.RenderableFace4 = function () { 6 | 7 | this.v1 = new THREE.Vector2(); 8 | this.v2 = new THREE.Vector2(); 9 | this.v3 = new THREE.Vector2(); 10 | this.v4 = new THREE.Vector2(); 11 | 12 | this.centroidWorld = new THREE.Vector3(); 13 | this.normalWorld = new THREE.Vector3(); 14 | 15 | this.z = null; 16 | 17 | this.color = null; 18 | this.material = null; 19 | 20 | }; 21 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/renderers/renderables/RenderableLine.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.RenderableLine = function () { 6 | 7 | this.v1 = new THREE.Vector2(); 8 | this.v2 = new THREE.Vector2(); 9 | 10 | this.z = null; 11 | 12 | this.color = null; 13 | this.material = null; 14 | 15 | }; 16 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/renderers/renderables/RenderableParticle.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.RenderableParticle = function () { 6 | 7 | this.x = null; 8 | this.y = null; 9 | this.z = null; 10 | 11 | this.rotation = null; 12 | this.scale = new THREE.Vector2(); 13 | 14 | this.color = null; 15 | this.material = null; 16 | 17 | }; 18 | -------------------------------------------------------------------------------- /Extanium/thirdparty/threejs/scenes/Scene.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mr.doob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.Scene = function () { 6 | 7 | this.objects = []; 8 | this.lights = []; 9 | 10 | this.addObject = function ( object ) { 11 | 12 | this.objects.push(object); 13 | 14 | }; 15 | 16 | this.removeObject = function ( object ) { 17 | 18 | for ( var i = 0, l = this.objects.length; i < l; i++ ) { 19 | 20 | if ( object == this.objects[ i ] ) { 21 | 22 | this.objects.splice( i, 1 ); 23 | return; 24 | 25 | } 26 | } 27 | }; 28 | 29 | this.addLight = function ( light ) { 30 | 31 | this.lights.push(light); 32 | 33 | }; 34 | 35 | this.removeLight = function ( light ) { 36 | 37 | for ( var i = 0, l = this.lights.length; i < l; i++ ) { 38 | 39 | if ( light == this.lights[ i ] ) { 40 | 41 | this.lights.splice( i, 1 ); 42 | return; 43 | 44 | } 45 | } 46 | }; 47 | 48 | // Deprecated 49 | this.add = function ( object ) { 50 | 51 | this.addObject( object ); 52 | 53 | }; 54 | 55 | this.toString = function () { 56 | 57 | return 'THREE.Scene ( ' + this.objects + ' )'; 58 | }; 59 | 60 | }; 61 | -------------------------------------------------------------------------------- /Localization/de.js: -------------------------------------------------------------------------------- 1 | // User components attribute override 2 | Ext.tr(Ext.Components.MainScreen, { 3 | trSaveTime: 'Zeit sparen', 4 | trAbstraction: 'Abstraktion', 5 | tr3D: '3D-Bereich!' 6 | }); 7 | 8 | 9 | Ext.tr(Ext, { 10 | trVisualDebug: 'Meldung', 11 | trClose: 'Schließen' 12 | }); 13 | -------------------------------------------------------------------------------- /Localization/en.js: -------------------------------------------------------------------------------- 1 | // Base text strings should be in english. 2 | // User components attribute override 3 | 4 | Ext.tr(Ext.Components.MainScreen, { 5 | trSaveTime: 'Save time', 6 | trAbstraction: 'Abstraction', 7 | tr3D: '3D Corner!' 8 | }); 9 | 10 | 11 | Ext.tr(Ext, { 12 | trVisualDebug: 'Visual debug', 13 | trClose: 'Close' 14 | }); 15 | 16 | 17 | -------------------------------------------------------------------------------- /Preferences.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Here, you can set some preferences for the runtime 3 | * control of the Extanium framework. 4 | */ 5 | 6 | // General debugging (En- or disables debug output generally 7 | Ext.enableDebugging = true; 8 | 9 | // Visual debugging (Shows alert dialogs on device if activated) 10 | Ext.enableVisualDebugging = true; 11 | 12 | // Debug logging severity 13 | // Possible values: info, debug, warn 14 | Ext.debugLogLevel = Ext.LOGLEVEL_DEBUG; 15 | 16 | // Enable application localization 17 | // Simply add more files to Localization folder with schema $langname.js (e.g. en.js) 18 | Ext.enableLocalization = true; 19 | 20 | // Set a static window orientation (auto-applied to any Ext.MetricsMgr managed window) 21 | // See Extanium/MetricsMgr.js -> Ext.Metrics class for more details. 22 | // Simply add windows by Ext.MetricsMgr.addWindow(wnd); 23 | Ext.MetricsMgr.setStaticOrientation(Ext.Metrics.PORTRAIT); 24 | Ext.Metrics.standardPortrait = true; 25 | 26 | // Set the standard screen resolution width and height, the app was designed for 27 | // Ext.Metrics.standardWidth = 320; 28 | // Ext.Metrics.standardHeight = 480; 29 | 30 | // When autoscaling is activated, all elements managed by Ext.MetricsMgr will 31 | // be scaled on application level(!) dynamically if the screen resolution is 32 | // different on other devices. Simply call Ext.MetricsMgr.add(uiElement) to manage elements. 33 | Ext.Metrics.enableAutoScaling = true; 34 | 35 | // Offline Ajax request try interval in seconds 36 | Ext.OfflineAjax = 10; 37 | 38 | // Load the localization 39 | Ext.loadLocalization(); -------------------------------------------------------------------------------- /android/appicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/android/appicon.png -------------------------------------------------------------------------------- /android/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/android/default.png -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | // Shorten namespace 2 | window = this; 3 | 4 | // Absolute base Ext Core class to introduce OOP 5 | Ti.include('/Extanium/Ext.js'); 6 | 7 | // Include Extanium 8 | Ti.include('/Extanium/Extanium.js'); 9 | 10 | // Sets some app preferences 11 | Ext.include('/Preferences.js'); 12 | 13 | // Loads the application class 14 | Ext.include('/Application.js'); 15 | 16 | // Construct and initialize the app runtime. 17 | App = new App(); -------------------------------------------------------------------------------- /iphone/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/iphone/Default.png -------------------------------------------------------------------------------- /iphone/appicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyr0/Extanium/ceb2d1849cdc15371675ce836c654719daafdf5f/iphone/appicon.png --------------------------------------------------------------------------------