提交 21a9169b 编写于 作者: M Mugen87

Examples: Removemore lgtm.com warnings

上级 a5a1ccba
......@@ -145,8 +145,7 @@
function generateTexture( data, width, height ) {
var canvas, context, image, imageData,
level, diff, vector3, sun, shade;
var canvas, context, image, imageData, vector3, sun, shade;
vector3 = new THREE.Vector3( 0, 0, 0 );
......
......@@ -74,8 +74,6 @@
objects.push( plane );
var material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );
// Lights
var ambientLight = new THREE.AmbientLight( 0x606060 );
......
......@@ -33,10 +33,6 @@
windowHalfX = window.innerWidth / 2,
windowHalfY = window.innerHeight / 2,
SEPARATION = 200,
AMOUNTX = 10,
AMOUNTY = 10,
camera, scene, renderer;
init();
......@@ -44,7 +40,7 @@
function init() {
var container, separation = 100, amountX = 50, amountY = 50, particles, particle;
var container, particle;
container = document.createElement( 'div' );
document.body.appendChild( container );
......
......@@ -12,7 +12,7 @@
* - Ambient occlusion clamp (numeric value).
* - lumInfluence
* - Pixel luminosity influence in AO calculation (numeric value).
*
*
* To output to screen set renderToScreens true
*
* @author alteredq / http://alteredqualia.com/
......@@ -21,7 +21,7 @@
*/
THREE.SSAOPass = function ( scene, camera, width, height ) {
if ( THREE.SSAOShader === undefined) {
if ( THREE.SSAOShader === undefined ) {
console.warn( 'THREE.SSAOPass depends on THREE.SSAOShader' );
return new THREE.ShaderPass();
......@@ -46,7 +46,7 @@ THREE.SSAOPass = function ( scene, camera, width, height ) {
//Depth render target
this.depthRenderTarget = new THREE.WebGLRenderTarget( this.width, this.height, { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter } );
//this.depthRenderTarget.texture.name = 'SSAOShader.rt';
//Shader uniforms
this.uniforms[ 'tDepth' ].value = this.depthRenderTarget.texture;
this.uniforms[ 'size' ].value.set( this.width, this.height );
......@@ -59,37 +59,70 @@ THREE.SSAOPass = function ( scene, camera, width, height ) {
this.uniforms[ 'lumInfluence' ].value = 0.7;
//Setters and getters for uniforms
var self = this;
Object.defineProperties(this, {
Object.defineProperties( this, {
radius: {
get: function() { return this.uniforms[ 'radius' ].value; },
set: function( value ) { this.uniforms[ 'radius' ].value = value; }
get: function () {
return this.uniforms[ 'radius' ].value;
},
set: function ( value ) {
this.uniforms[ 'radius' ].value = value;
}
},
onlyAO: {
get: function() { return this.uniforms[ 'onlyAO' ].value; },
set: function( value ) { this.uniforms[ 'onlyAO' ].value = value; }
get: function () {
return this.uniforms[ 'onlyAO' ].value;
},
set: function ( value ) {
this.uniforms[ 'onlyAO' ].value = value;
}
},
aoClamp: {
get: function() { return this.uniforms[ 'aoClamp' ].value; },
set: function( value ) { this.uniforms[ 'aoClamp' ].value = value; }
get: function () {
return this.uniforms[ 'aoClamp' ].value;
},
set: function ( value ) {
this.uniforms[ 'aoClamp' ].value = value;
}
},
lumInfluence: {
get: function() { return this.uniforms[ 'lumInfluence' ].value; },
set: function( value ) { this.uniforms[ 'lumInfluence' ].value = value; }
get: function () {
return this.uniforms[ 'lumInfluence' ].value;
},
set: function ( value ) {
this.uniforms[ 'lumInfluence' ].value = value;
}
},
});
}
} );
};
THREE.SSAOPass.prototype = Object.create( THREE.ShaderPass.prototype );
/**
* Render using this pass.
*
*
* @method render
* @param {WebGLRenderer} renderer
* @param {WebGLRenderTarget} writeBuffer Buffer to write output.
......@@ -97,13 +130,13 @@ THREE.SSAOPass.prototype = Object.create( THREE.ShaderPass.prototype );
* @param {Number} delta Delta time in milliseconds.
* @param {Boolean} maskActive Not used in this pass.
*/
THREE.SSAOPass.prototype.render = function( renderer, writeBuffer, readBuffer, delta, maskActive ) {
THREE.SSAOPass.prototype.render = function ( renderer, writeBuffer, readBuffer, delta, maskActive ) {
//Render depth into depthRenderTarget
this.scene2.overrideMaterial = this.depthMaterial;
renderer.render( this.scene2, this.camera2, this.depthRenderTarget, true );
this.scene2.overrideMaterial = null;
......@@ -118,8 +151,8 @@ THREE.SSAOPass.prototype.render = function( renderer, writeBuffer, readBuffer, d
* @method setScene
* @param {Scene} scene
*/
THREE.SSAOPass.prototype.setScene = function(scene) {
THREE.SSAOPass.prototype.setScene = function ( scene ) {
this.scene2 = scene;
};
......@@ -130,7 +163,7 @@ THREE.SSAOPass.prototype.setScene = function(scene) {
* @method setCamera
* @param {Camera} camera
*/
THREE.SSAOPass.prototype.setCamera = function( camera ) {
THREE.SSAOPass.prototype.setCamera = function ( camera ) {
this.camera2 = camera;
......@@ -141,12 +174,12 @@ THREE.SSAOPass.prototype.setCamera = function( camera ) {
/**
* Set resolution of this render pass.
*
*
* @method setSize
* @param {Number} width
* @param {Number} height
*/
THREE.SSAOPass.prototype.setSize = function( width, height ) {
THREE.SSAOPass.prototype.setSize = function ( width, height ) {
this.width = width;
this.height = height;
......
......@@ -129,7 +129,6 @@
var vector = new THREE.Vector4();
var triangles = 1;
var instances = 50000;
var positions = [];
......
......@@ -53,7 +53,7 @@
scene = new THREE.Scene();
var light, object;
var object;
var ambientLight = new THREE.AmbientLight( 0xcccccc, 0.4 );
scene.add( ambientLight );
......
......@@ -160,7 +160,6 @@
//
var geometry = new THREE.Geometry();
var dummy = new THREE.Mesh();
for ( var z = 0; z < worldDepth; z ++ ) {
......
......@@ -217,7 +217,7 @@
function render() {
var time = Date.now() * 0.00025;
var z = 20, d = 150;
var d = 150;
light1.position.x = Math.sin( time * 0.7 ) * d;
light1.position.z = Math.cos( time * 0.3 ) * d;
......
......@@ -74,7 +74,7 @@
scene = new THREE.Scene();
var i, line, vertex1, vertex2, material, p,
var i, line, material, p,
parameters = [ [ 0.25, 0xff7700, 1, 2 ], [ 0.5, 0xff9900, 1, 1 ], [ 0.75, 0xffaa00, 0.75, 1 ], [ 1, 0xffaa00, 0.5, 1 ], [ 1.25, 0x000833, 0.8, 1 ],
[ 3.0, 0xaaaaaa, 0.75, 2 ], [ 3.5, 0xffffff, 0.5, 1 ], [ 4.5, 0xffffff, 0.25, 1 ], [ 5.5, 0xffffff, 0.125, 1 ] ];
......
......@@ -338,7 +338,7 @@
topologyFolder.add( params, 'filterConvex' );
topologyFolder.add( params, 'filterConcave' );
topologyFolder.add( params, 'filterBoth' );
topologyFolder.open()
topologyFolder.open();
onWindowResize();
......
......@@ -154,8 +154,6 @@
function initGui() {
var drop;
gui = new dat.GUI();
gui.add( API, 'offsetX', 0.0, 1.0 ).name( 'offset.x' ).onChange( updateUvTransform );
......
......@@ -216,10 +216,6 @@
Math.random() * radiusMax - radiusMaxHalf
);
// record start time
var timeStart = Date.now();
// search octree from search mesh position with search radius
// optional third parameter: boolean, if should sort results by object when using faces in octree
// optional fourth parameter: vector3, direction of search when using ray (assumes radius is distance/far of ray)
......@@ -228,11 +224,7 @@
direction.set( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 ).normalize();
rayCaster.set( origin, direction );
meshesSearch = octree.search( rayCaster.ray.origin, radiusSearch, true, rayCaster.ray.direction );
var intersections = rayCaster.intersectOctreeObjects( meshesSearch );
// record end time
var timeEnd = Date.now();
rayCaster.intersectOctreeObjects( meshesSearch );
// set color of all meshes found in search
......@@ -242,15 +234,6 @@
}
/*
// results to console
console.log( 'OCTREE: ', octree );
console.log( '... searched ', meshes.length, ' and found ', meshesSearch.length, ' with intersections ', intersections.length, ' and took ', ( timeEnd - timeStart ), ' ms ' );
*/
}
function render() {
......
......@@ -132,7 +132,7 @@
var params = {
texture: true
}
};
gui.add( params, 'texture' ).onChange( function( value ) {
......
......@@ -65,7 +65,7 @@
gui = new dat.GUI();
var example = gui.add( param, 'example', {
gui.add( param, 'example', {
'basic / color-adjustment': 'color-adjustment',
'basic / blends': 'blends',
'basic / fade': 'fade',
......@@ -312,7 +312,6 @@
var normal = new THREE.TextureNode( decalNormal );
var normalXY = new THREE.SwitchNode( normal, 'xy' );
var scale = new THREE.FloatNode( .5 );
var flip = new THREE.Vector2Node( - 1, 1 );
var normalXYFlip = new THREE.Math1Node(
normalXY,
......
......@@ -202,11 +202,11 @@
var textureLoader = new THREE.TextureLoader();
var earthDiffuse = textureLoader.load( 'textures/planets/earth_atmos_4096.jpg', function( tex ) {
textureLoader.load( 'textures/planets/earth_atmos_4096.jpg', function( tex ) {
earthMat.map = tex;
earthMat.needsUpdate = true;
} );
var earthSpecular = textureLoader.load( 'textures/planets/earth_specular_2048.jpg', function( tex ) {
textureLoader.load( 'textures/planets/earth_specular_2048.jpg', function( tex ) {
earthMat.specularMap = tex;
earthMat.needsUpdate = true;
} );
......@@ -235,7 +235,7 @@
depthTest: false
} );
var earthClouds = textureLoader.load( 'textures/planets/earth_clouds_2048.png', function( tex ) {
textureLoader.load( 'textures/planets/earth_clouds_2048.png', function( tex ) {
earthCloudsMat.map = tex;
earthCloudsMat.needsUpdate = true;
} );
......
......@@ -112,18 +112,6 @@
textureLava.wrapS = textureLava.wrapT = THREE.RepeatWrapping;
textureLava.format = THREE.RGBFormat;
//
var path = "textures/cube/SwedishRoyalCastle/";
var format = '.jpg';
var urls = [
path + 'px' + format, path + 'nx' + format,
path + 'py' + format, path + 'ny' + format,
path + 'pz' + format, path + 'nz' + format
];
var reflectionCube = new THREE.CubeTextureLoader().load( urls );
// GROUND
var groundMaterial = new THREE.MeshPhongMaterial( {
......
......@@ -466,8 +466,6 @@
if ( terrain.visible ) {
var time = Date.now() * 0.001;
var fLow = 0.1, fHigh = 0.8;
lightVal = THREE.Math.clamp( lightVal + 0.5 * delta * lightDir, fLow, fHigh );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册