Permalink
Please sign in to comment.
Showing
with
2 additions
and 403 deletions.
- +1 −1 .gitignore
- +1 −0 CHANGELOG.md
- +0 −6 src/GUI/AddGUI.js
- +0 −6 src/GUI/addGUI.js
- +0 −130 src/Light/AddLight.js
- +0 −130 src/Light/addLight.js
- +0 −65 src/Skybox/AddSkybox.js
- +0 −65 src/Skybox/addSkybox.js
2
.gitignore
1
CHANGELOG.md
6
src/GUI/AddGUI.js
| @@ -1,6 +0,0 @@ | ||
| -/** | ||
| - * © Alexander Buzin, 2014-2015 | ||
| - * Site: http://alexbuzin.me/ | ||
| - * Email: alexbuzin88@gmail.com | ||
| -*/ | ||
| - |
6
src/GUI/addGUI.js
| @@ -1,6 +0,0 @@ | ||
| -/** | ||
| - * © Alexander Buzin, 2014-2015 | ||
| - * Site: http://alexbuzin.me/ | ||
| - * Email: alexbuzin88@gmail.com | ||
| -*/ | ||
| - |
130
src/Light/AddLight.js
| @@ -1,130 +0,0 @@ | ||
| -/** | ||
| - * © Alexander Buzin, 2014-2015 | ||
| - * Site: http://alexbuzin.me/ | ||
| - * Email: alexbuzin88@gmail.com | ||
| -*/ | ||
| - | ||
| -/** | ||
| - * Light. | ||
| - * | ||
| - * @param {String} type Light type. (REQUIRED) | ||
| - * @param {Object} opts Parameters of light dot. (OPTIONAL) | ||
| - * @param {Object} pos Position of light dot. (OPTIONAL) | ||
| - * @param {Object} target Target of light dot. (OPTIONAL) | ||
| - * @return {Object} Scope. | ||
| - */ | ||
| -WHS.init.prototype.addLight = function(type, opts) { | ||
| - | ||
| - 'use strict'; | ||
| - | ||
| - var scope = new WHS.Shape(this, opts, type); | ||
| - | ||
| - //Do not need the option variable, opts is by this statement, gained default values | ||
| - api.extend(opts, { | ||
| - color: 0xffffff, | ||
| - skyColor: 0xffffff, | ||
| - groundColor: 0xffffff, | ||
| - | ||
| - intensity: 1, | ||
| - distance: 100, | ||
| - angle: Math.PI/3, | ||
| - | ||
| - shadowmap: { | ||
| - cast: true, | ||
| - | ||
| - bias: 0.0001, | ||
| - | ||
| - width: 1024, | ||
| - height: 1024, | ||
| - | ||
| - near: true, | ||
| - far: 400, | ||
| - fov: 60, | ||
| - darkness: 0.3, | ||
| - | ||
| - top: 200, | ||
| - bottom: -200, | ||
| - left: -200, | ||
| - right: 200 | ||
| - } | ||
| - }); | ||
| - | ||
| - switch (type) { | ||
| - case "ambient": | ||
| - scope.mesh = new THREE.AmbientLight(0xffffff); | ||
| - break; | ||
| - | ||
| - case "directional": | ||
| - scope.mesh = new THREE.DirectionalLight( | ||
| - opts.color, | ||
| - opts.intensity | ||
| - ); | ||
| - | ||
| - break; | ||
| - | ||
| - case "hemisphere": | ||
| - scope.mesh = new THREE.HemisphereLight( | ||
| - opts.skyColor, | ||
| - opts.groundColor, | ||
| - opts.intensity | ||
| - ); | ||
| - | ||
| - break; | ||
| - | ||
| - case "light": | ||
| - scope.mesh = new THREE.Light(opts.color); | ||
| - | ||
| - break; | ||
| - | ||
| - case "point": | ||
| - scope.mesh = new THREE.PointLight( | ||
| - opts.color, | ||
| - opts.intensity, | ||
| - opts.distance | ||
| - ); | ||
| - | ||
| - break; | ||
| - | ||
| - case "spot": | ||
| - scope.mesh = new THREE.SpotLight( | ||
| - opts.color, | ||
| - opts.intensity, | ||
| - opts.distance, | ||
| - opts.angle | ||
| - ); | ||
| - | ||
| - break; | ||
| - } | ||
| - | ||
| - //scope.mesh.shadowCameraVisible = true; | ||
| - | ||
| - scope.mesh.castShadow = opts.shadowmap.cast; | ||
| - | ||
| - // #FIXME:20 Shadow default parameters. | ||
| - scope.mesh.shadowMapWidth = opts.shadowmap.width; | ||
| - scope.mesh.shadowMapHeight = opts.shadowmap.height; | ||
| - scope.mesh.shadowBias = opts.shadowmap.bias; | ||
| - | ||
| - scope.mesh.shadowCameraNear = opts.shadowmap.near; | ||
| - scope.mesh.shadowCameraFar = opts.shadowmap.far; | ||
| - scope.mesh.shadowCameraFov = opts.shadowmap.fov; | ||
| - scope.mesh.shadowDarkness = opts.shadowmap.darkness; | ||
| - | ||
| - scope.mesh.shadowCameraLeft = opts.shadowmap.left; | ||
| - scope.mesh.shadowCameraRight = opts.shadowmap.right; | ||
| - scope.mesh.shadowCameraTop = opts.shadowmap.top; | ||
| - scope.mesh.shadowCameraBottom = opts.shadowmap.bottom; | ||
| - | ||
| - | ||
| - if (scope.mesh.target) | ||
| - scope.mesh.target.position.set( | ||
| - scope._target.x, | ||
| - scope._target.y, | ||
| - scope._target.z | ||
| - ); | ||
| - | ||
| - scope.build().wrap(); | ||
| - | ||
| - return scope; | ||
| - | ||
| -}; |
130
src/Light/addLight.js
| @@ -1,130 +0,0 @@ | ||
| -/** | ||
| - * © Alexander Buzin, 2014-2015 | ||
| - * Site: http://alexbuzin.me/ | ||
| - * Email: alexbuzin88@gmail.com | ||
| -*/ | ||
| - | ||
| -/** | ||
| - * Light. | ||
| - * | ||
| - * @param {String} type Light type. (REQUIRED) | ||
| - * @param {Object} opts Parameters of light dot. (OPTIONAL) | ||
| - * @param {Object} pos Position of light dot. (OPTIONAL) | ||
| - * @param {Object} target Target of light dot. (OPTIONAL) | ||
| - * @return {Object} Scope. | ||
| - */ | ||
| -WHS.init.prototype.addLight = function(type, opts) { | ||
| - | ||
| - 'use strict'; | ||
| - | ||
| - var scope = new WHS.Shape(this, opts, type); | ||
| - | ||
| - //Do not need the option variable, opts is by this statement, gained default values | ||
| - api.extend(opts, { | ||
| - color: 0xffffff, | ||
| - skyColor: 0xffffff, | ||
| - groundColor: 0xffffff, | ||
| - | ||
| - intensity: 1, | ||
| - distance: 100, | ||
| - angle: Math.PI/3, | ||
| - | ||
| - shadowmap: { | ||
| - cast: true, | ||
| - | ||
| - bias: 0.0001, | ||
| - | ||
| - width: 1024, | ||
| - height: 1024, | ||
| - | ||
| - near: true, | ||
| - far: 400, | ||
| - fov: 60, | ||
| - darkness: 0.3, | ||
| - | ||
| - top: 200, | ||
| - bottom: -200, | ||
| - left: -200, | ||
| - right: 200 | ||
| - } | ||
| - }); | ||
| - | ||
| - switch (type) { | ||
| - case "ambient": | ||
| - scope.mesh = new THREE.AmbientLight(0xffffff); | ||
| - break; | ||
| - | ||
| - case "directional": | ||
| - scope.mesh = new THREE.DirectionalLight( | ||
| - opts.color, | ||
| - opts.intensity | ||
| - ); | ||
| - | ||
| - break; | ||
| - | ||
| - case "hemisphere": | ||
| - scope.mesh = new THREE.HemisphereLight( | ||
| - opts.skyColor, | ||
| - opts.groundColor, | ||
| - opts.intensity | ||
| - ); | ||
| - | ||
| - break; | ||
| - | ||
| - case "light": | ||
| - scope.mesh = new THREE.Light(opts.color); | ||
| - | ||
| - break; | ||
| - | ||
| - case "point": | ||
| - scope.mesh = new THREE.PointLight( | ||
| - opts.color, | ||
| - opts.intensity, | ||
| - opts.distance | ||
| - ); | ||
| - | ||
| - break; | ||
| - | ||
| - case "spot": | ||
| - scope.mesh = new THREE.SpotLight( | ||
| - opts.color, | ||
| - opts.intensity, | ||
| - opts.distance, | ||
| - opts.angle | ||
| - ); | ||
| - | ||
| - break; | ||
| - } | ||
| - | ||
| - //scope.mesh.shadowCameraVisible = true; | ||
| - | ||
| - scope.mesh.castShadow = opts.shadowmap.cast; | ||
| - | ||
| - // #FIXME:20 Shadow default parameters. | ||
| - scope.mesh.shadowMapWidth = opts.shadowmap.width; | ||
| - scope.mesh.shadowMapHeight = opts.shadowmap.height; | ||
| - scope.mesh.shadowBias = opts.shadowmap.bias; | ||
| - | ||
| - scope.mesh.shadowCameraNear = opts.shadowmap.near; | ||
| - scope.mesh.shadowCameraFar = opts.shadowmap.far; | ||
| - scope.mesh.shadowCameraFov = opts.shadowmap.fov; | ||
| - scope.mesh.shadowDarkness = opts.shadowmap.darkness; | ||
| - | ||
| - scope.mesh.shadowCameraLeft = opts.shadowmap.left; | ||
| - scope.mesh.shadowCameraRight = opts.shadowmap.right; | ||
| - scope.mesh.shadowCameraTop = opts.shadowmap.top; | ||
| - scope.mesh.shadowCameraBottom = opts.shadowmap.bottom; | ||
| - | ||
| - | ||
| - if (scope.mesh.target) | ||
| - scope.mesh.target.position.set( | ||
| - scope._target.x, | ||
| - scope._target.y, | ||
| - scope._target.z | ||
| - ); | ||
| - | ||
| - scope.build().wrap(); | ||
| - | ||
| - return scope; | ||
| - | ||
| -}; |
65
src/Skybox/AddSkybox.js
| @@ -1,65 +0,0 @@ | ||
| -/** | ||
| - * © Alexander Buzin, 2014-2015 | ||
| - * Site: http://alexbuzin.me/ | ||
| - * Email: alexbuzin88@gmail.com | ||
| - */ | ||
| - | ||
| -/** | ||
| - * Adds a skybox to the WhitestormJS scene. | ||
| - * @param {Object} options - Skybox options. | ||
| - * @param {String} options.src - Skybox image source. | ||
| - * @param {String} options.imgSuffix - Skybox image suffix (.png, .jpg, etc.) | ||
| - * @param {String} options.skyType - Type of sky. Either box or sphere. | ||
| - * @returns {Object} scope - Scope. | ||
| - */ | ||
| -WHS.init.prototype.addSkybox = function( options ) { | ||
| - | ||
| - 'use strict'; | ||
| - | ||
| - options.skyType = options.skyType || "box"; | ||
| - | ||
| - options.imgSuffix = options.skyType == "box" ? options.imgSuffix || ".png" : options.imgSuffix || ""; | ||
| - | ||
| - var scope = new WHS.Shape( this, options, "skybox" ); | ||
| - scope.skip = true; | ||
| - | ||
| - var skyGeometry, skyMat; | ||
| - | ||
| - switch ( options.skyType ) { | ||
| - case "box": | ||
| - var directions = [ "xpos", "xneg", "ypos", "yneg", "zpos", "zneg" ]; | ||
| - skyGeometry = new THREE.CubeGeometry( this._camera.far, this._camera.far, this._camera.far ); | ||
| - var matArray = []; | ||
| - | ||
| - for ( var i = 0; i < 6; i ++ ) { | ||
| - | ||
| - matArray.push( new THREE.MeshBasicMaterial( { | ||
| - map: THREE.ImageUtils.loadTexture( options.src + directions[ i ] + options.imgSuffix ), | ||
| - side: THREE.BackSide | ||
| - } ) ); | ||
| - | ||
| - } | ||
| - | ||
| - skyMat = new THREE.MeshFaceMaterial( matArray ); | ||
| - | ||
| - break; | ||
| - case "sphere": | ||
| - | ||
| - skyGeometry = new THREE.SphereGeometry( this._camera.far / 2, 60, 40 ); | ||
| - | ||
| - skyMat = new THREE.MeshBasicMaterial( { | ||
| - map: THREE.ImageUtils.loadTexture( options.src + options.imgSuffix ), | ||
| - side: THREE.BackSide | ||
| - } ); | ||
| - | ||
| - break; | ||
| - } | ||
| - | ||
| - scope.mesh = new THREE.Mesh( skyGeometry, skyMat ); | ||
| - scope.mesh.renderDepth = 1000.0; | ||
| - | ||
| - scope.build().wrap(); | ||
| - | ||
| - return scope; | ||
| - | ||
| - }; |
65
src/Skybox/addSkybox.js
| @@ -1,65 +0,0 @@ | ||
| -/** | ||
| - * © Alexander Buzin, 2014-2015 | ||
| - * Site: http://alexbuzin.me/ | ||
| - * Email: alexbuzin88@gmail.com | ||
| - */ | ||
| - | ||
| -/** | ||
| - * Adds a skybox to the WhitestormJS scene. | ||
| - * @param {Object} options - Skybox options. | ||
| - * @param {String} options.src - Skybox image source. | ||
| - * @param {String} options.imgSuffix - Skybox image suffix (.png, .jpg, etc.) | ||
| - * @param {String} options.skyType - Type of sky. Either box or sphere. | ||
| - * @returns {Object} scope - Scope. | ||
| - */ | ||
| -WHS.init.prototype.addSkybox = function( options ) { | ||
| - | ||
| - 'use strict'; | ||
| - | ||
| - options.skyType = options.skyType || "box"; | ||
| - | ||
| - options.imgSuffix = options.skyType == "box" ? options.imgSuffix || ".png" : options.imgSuffix || ""; | ||
| - | ||
| - var scope = new WHS.Shape( this, options, "skybox" ); | ||
| - scope.skip = true; | ||
| - | ||
| - var skyGeometry, skyMat; | ||
| - | ||
| - switch ( options.skyType ) { | ||
| - case "box": | ||
| - var directions = [ "xpos", "xneg", "ypos", "yneg", "zpos", "zneg" ]; | ||
| - skyGeometry = new THREE.CubeGeometry( this._camera.far, this._camera.far, this._camera.far ); | ||
| - var matArray = []; | ||
| - | ||
| - for ( var i = 0; i < 6; i ++ ) { | ||
| - | ||
| - matArray.push( new THREE.MeshBasicMaterial( { | ||
| - map: THREE.ImageUtils.loadTexture( options.src + directions[ i ] + options.imgSuffix ), | ||
| - side: THREE.BackSide | ||
| - } ) ); | ||
| - | ||
| - } | ||
| - | ||
| - skyMat = new THREE.MeshFaceMaterial( matArray ); | ||
| - | ||
| - break; | ||
| - case "sphere": | ||
| - | ||
| - skyGeometry = new THREE.SphereGeometry( this._camera.far / 2, 60, 40 ); | ||
| - | ||
| - skyMat = new THREE.MeshBasicMaterial( { | ||
| - map: THREE.ImageUtils.loadTexture( options.src + options.imgSuffix ), | ||
| - side: THREE.BackSide | ||
| - } ); | ||
| - | ||
| - break; | ||
| - } | ||
| - | ||
| - scope.mesh = new THREE.Mesh( skyGeometry, skyMat ); | ||
| - scope.mesh.renderDepth = 1000.0; | ||
| - | ||
| - scope.build().wrap(); | ||
| - | ||
| - return scope; | ||
| - | ||
| - }; |
0 comments on commit
41032e3