提交 fb210eb8 编写于 作者: G gero3

add new rule disallowNewlineBeforeBlockStatements

上级 92325645
......@@ -1929,8 +1929,7 @@
tmin;
// ray would intersect in reverse direction, i.e. this is behind ray
if ( tmax < 0 )
{
if ( tmax < 0 ) {
return false;
......
......@@ -168,8 +168,7 @@ SimplexNoise.prototype.noise3d = function( xin, yin, zin ) {
var i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords
if ( x0 >= y0 ) {
if ( y0 >= z0 )
{
if ( y0 >= z0 ) {
i1 = 1; j1 = 0; k1 = 0; i2 = 1; j2 = 1; k2 = 0;
......
......@@ -125,8 +125,7 @@ SPARKS.Emitter.prototype = {
// Update activities
len = this._activities.length;
for ( i = 0; i < len; i ++ )
{
for ( i = 0; i < len; i ++ ) {
this._activities[ i ].update( this, time );
......@@ -139,12 +138,10 @@ SPARKS.Emitter.prototype = {
var action;
var len2 = this._particles.length;
for ( j = 0; j < len; j ++ )
{
for ( j = 0; j < len; j ++ ) {
action = this._actions[ j ];
for ( i = 0; i < len2; ++ i )
{
for ( i = 0; i < len2; ++ i ) {
particle = this._particles[ i ];
action.update( this, particle, time );
......@@ -155,12 +152,10 @@ SPARKS.Emitter.prototype = {
// remove dead particles
for ( i = len2; i --; )
{
for ( i = len2; i --; ) {
particle = this._particles[ i ];
if ( particle.isDead )
{
if ( particle.isDead ) {
//particle =
this._particles.splice( i, 1 );
......@@ -389,15 +384,13 @@ SPARKS.Age = function( easing ) {
SPARKS.Age.prototype.update = function ( emitter, particle, time ) {
particle.age += time;
if ( particle.age >= particle.lifetime )
{
if ( particle.age >= particle.lifetime ) {
particle.energy = 0;
particle.isDead = true;
}
else
{
else {
var t = this._easing( particle.age / particle.lifetime );
particle.energy = - 1 * t + 1;
......@@ -971,17 +964,14 @@ SPARKS.Utils = {
},
getPerpendicular: function( v )
{
getPerpendicular: function( v ) {
if ( v.x == 0 )
{
if ( v.x == 0 ) {
return new THREE.Vector3D( 1, 0, 0 );
}
else
{
else {
var temp = new THREE.Vector3( v.y, - v.x, 0 );
return temp.normalize();
......
......@@ -141,8 +141,7 @@ THREE.Water = function ( renderer, camera, scene, options ) {
if ( camera instanceof THREE.PerspectiveCamera )
this.camera = camera;
else
{
else {
this.camera = new THREE.PerspectiveCamera();
console.log( this.name + ': camera is not a Perspective Camera!' )
......@@ -178,8 +177,7 @@ THREE.Water = function ( renderer, camera, scene, options ) {
this.material.uniforms.eye.value = this.eye;
if ( ! THREE.Math.isPowerOfTwo( width ) || ! THREE.Math.isPowerOfTwo( height ) )
{
if ( ! THREE.Math.isPowerOfTwo( width ) || ! THREE.Math.isPowerOfTwo( height ) ) {
this.texture.generateMipmaps = false;
this.texture.minFilter = THREE.LinearFilter;
......
......@@ -38,8 +38,7 @@ function generateGeometry( objectType, numObjects ) {
scale.x = Math.random() * 200 + 100;
if ( objectType == "cube" )
{
if ( objectType == "cube" ) {
geom = new THREE.BoxGeometry( 1, 1, 1 );
scale.y = Math.random() * 200 + 100;
......@@ -47,8 +46,7 @@ function generateGeometry( objectType, numObjects ) {
color.setRGB( 0, 0, Math.random() + 0.1 );
}
else if ( objectType == "sphere" )
{
else if ( objectType == "sphere" ) {
geom = new THREE.IcosahedronGeometry( 1, 1 );
scale.y = scale.z = scale.x;
......
......@@ -120,18 +120,15 @@ function Transition ( sceneA, sceneB ) {
this.render = function( delta ) {
// Transition animation
if ( transitionParams.animateTransition )
{
if ( transitionParams.animateTransition ) {
var t = ( 1 + Math.sin( transitionParams.transitionSpeed * clock.getElapsedTime() / Math.PI ) ) / 2;
transitionParams.transition = THREE.Math.smoothstep( t, 0.3, 0.7 );
// Change the current alpha texture after each transition
if ( transitionParams.loopTexture && ( transitionParams.transition == 0 || transitionParams.transition == 1 ) )
{
if ( transitionParams.loopTexture && ( transitionParams.transition == 0 || transitionParams.transition == 1 ) ) {
if ( this.needChange )
{
if ( this.needChange ) {
transitionParams.texture = ( transitionParams.texture + 1 ) % this.textures.length;
this.quadmaterial.uniforms.tMixTexture.value = this.textures[ transitionParams.texture ];
......
......@@ -55,15 +55,13 @@
AWDProperties = function() {}
AWDProperties.prototype = {
set : function( key, value )
{
set : function( key, value ) {
this[ key ] = value;
},
get : function( key, fallback )
{
get : function( key, fallback ) {
if ( this.hasOwnProperty( key ) )
return this[ key ];
......@@ -548,8 +546,7 @@
mtx_data = this.parseMatrix4();
} else
{
} else {
mtx_data = new THREE.Matrix4();
......
......@@ -37,8 +37,7 @@ THREE.AssimpJSONLoader.prototype = {
// This header is used to disambiguate between
// different JSON-based file formats.
metadata = json.__metadata__;
if ( typeof metadata !== 'undefined' )
{
if ( typeof metadata !== 'undefined' ) {
// Check if assimp2json at all
if ( metadata.format !== 'assimp2json' ) {
......
......@@ -42,15 +42,13 @@ THREE.GlitchPass = function ( dt_size ) {
THREE.GlitchPass.prototype = {
render: function ( renderer, writeBuffer, readBuffer, delta )
{
render: function ( renderer, writeBuffer, readBuffer, delta ) {
this.uniforms[ "tDiffuse" ].value = readBuffer;
this.uniforms[ 'seed' ].value = Math.random();//default seeding
this.uniforms[ 'byp' ].value = 0;
if ( this.curF % this.randX == 0 || this.goWild == true )
{
if ( this.curF % this.randX == 0 || this.goWild == true ) {
this.uniforms[ 'amount' ].value = Math.random() / 30;
this.uniforms[ 'angle' ].value = THREE.Math.randFloat( - Math.PI, Math.PI );
......@@ -62,8 +60,7 @@ THREE.GlitchPass.prototype = {
this.generateTrigger();
}
else if ( this.curF % this.randX < this.randX / 5 )
{
else if ( this.curF % this.randX < this.randX / 5 ) {
this.uniforms[ 'amount' ].value = Math.random() / 90;
this.uniforms[ 'angle' ].value = THREE.Math.randFloat( - Math.PI, Math.PI );
......@@ -73,8 +70,7 @@ THREE.GlitchPass.prototype = {
this.uniforms[ 'seed_y' ].value = THREE.Math.randFloat( - 0.3, 0.3 );
}
else if ( this.goWild == false )
{
else if ( this.goWild == false ) {
this.uniforms[ 'byp' ].value = 1;
......@@ -82,35 +78,30 @@ THREE.GlitchPass.prototype = {
this.curF ++;
this.quad.material = this.material;
if ( this.renderToScreen )
{
if ( this.renderToScreen ) {
renderer.render( this.scene, this.camera );
}
else
{
else {
renderer.render( this.scene, this.camera, writeBuffer, false );
}
},
generateTrigger: function()
{
generateTrigger: function() {
this.randX = THREE.Math.randInt( 120, 240 );
},
generateHeightmap: function( dt_size )
{
generateHeightmap: function( dt_size ) {
var data_arr = new Float32Array( dt_size * dt_size * 3 );
console.log( dt_size );
var length = dt_size * dt_size;
for ( var i = 0; i < length; i ++ )
{
for ( var i = 0; i < length; i ++ ) {
var val = THREE.Math.randFloat( 0, 1 );
data_arr[ i * 3 + 0 ] = val;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册