Skip to content

Commit

Permalink
fix linter errors in webgl M to W
Browse files Browse the repository at this point in the history
  • Loading branch information
looeee committed Oct 10, 2018
1 parent 4894f4e commit a5b45d1
Show file tree
Hide file tree
Showing 120 changed files with 1,704 additions and 1,659 deletions.
113 changes: 54 additions & 59 deletions examples/webgl_marchingcubes.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,16 @@

var camera, scene, renderer;

var mesh, texture, geometry, materials, material, current_material;
var materials, current_material;

var light, pointLight, ambientLight;

var effect, resolution, numBlobs;
var effect, resolution;

var composer, effectFXAA, hblur, vblur;

var effectController;

var controls;

var time = 0;
var clock = new THREE.Clock();

Expand All @@ -119,7 +117,7 @@
// CAMERA

camera = new THREE.PerspectiveCamera( 45, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 10000 );
camera.position.set( -500, 500, 1500 );
camera.position.set( - 500, 500, 1500 );

// SCENE

Expand Down Expand Up @@ -147,7 +145,6 @@
// MARCHING CUBES

resolution = 28;
numBlobs = 10;

effect = new THREE.MarchingCubes( resolution, materials[ current_material ].m, true, true );
effect.position.set( 0, 0, 0 );
Expand Down Expand Up @@ -177,7 +174,7 @@

// CONTROLS

controls = new THREE.OrbitControls( camera, renderer.domElement );
var controls = new THREE.OrbitControls( camera, renderer.domElement );

// STATS

Expand Down Expand Up @@ -231,7 +228,7 @@

//

function onWindowResize( event ) {
function onWindowResize() {

SCREEN_WIDTH = window.innerWidth;
SCREEN_HEIGHT = window.innerHeight - 2 * MARGIN;
Expand Down Expand Up @@ -273,11 +270,11 @@
// toons

var toonMaterial1 = createShaderMaterial( "toon1", light, ambientLight ),
toonMaterial2 = createShaderMaterial( "toon2", light, ambientLight ),
hatchingMaterial = createShaderMaterial( "hatching", light, ambientLight ),
hatchingMaterial2 = createShaderMaterial( "hatching", light, ambientLight ),
dottedMaterial = createShaderMaterial( "dotted", light, ambientLight ),
dottedMaterial2 = createShaderMaterial( "dotted", light, ambientLight );
toonMaterial2 = createShaderMaterial( "toon2", light, ambientLight ),
hatchingMaterial = createShaderMaterial( "hatching", light, ambientLight ),
hatchingMaterial2 = createShaderMaterial( "hatching", light, ambientLight ),
dottedMaterial = createShaderMaterial( "dotted", light, ambientLight ),
dottedMaterial2 = createShaderMaterial( "dotted", light, ambientLight );

hatchingMaterial2.uniforms.uBaseColor.value.setRGB( 0, 0, 0 );
hatchingMaterial2.uniforms.uLineColor1.value.setHSL( 0, 0.8, 0.5 );
Expand All @@ -293,85 +290,85 @@

var materials = {

"chrome" :
"chrome":
{
m: new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: reflectionCube } ),
h: 0, s: 0, l: 1
},

"liquid" :
"liquid":
{
m: new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: refractionCube, refractionRatio: 0.85 } ),
h: 0, s: 0, l: 1
},

"shiny" :
"shiny":
{
m: new THREE.MeshStandardMaterial( { color: 0x550000, envMap: reflectionCube, roughness: 0.1, metalness: 1.0 } ),
h: 0, s: 0.8, l: 0.2
},

"matte" :
"matte":
{
m: new THREE.MeshPhongMaterial( { color: 0x000000, specular: 0x111111, shininess: 1 } ),
h: 0, s: 0, l: 1
},

"flat" :
"flat":
{
m: new THREE.MeshLambertMaterial( { color: 0x000000, flatShading: true } ),
h: 0, s: 0, l: 1
},

"textured" :
"textured":
{
m: new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x111111, shininess: 1, map: texture } ),
h: 0, s: 0, l: 1
},

"colors" :
"colors":
{
m: new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0xffffff, shininess: 2, vertexColors: THREE.VertexColors } ),
h: 0, s: 0, l: 1
},

"plastic" :
"plastic":
{
m: new THREE.MeshPhongMaterial( { color: 0x000000, specular: 0x888888, shininess: 250 } ),
h: 0.6, s: 0.8, l: 0.1
},

"toon1" :
"toon1":
{
m: toonMaterial1,
h: 0.2, s: 1, l: 0.75
},

"toon2" :
"toon2":
{
m: toonMaterial2,
h: 0.4, s: 1, l: 0.75
},

"hatching" :
"hatching":
{
m: hatchingMaterial,
h: 0.2, s: 1, l: 0.9
},

"hatching2" :
"hatching2":
{
m: hatchingMaterial2,
h: 0.0, s: 0.8, l: 0.5
},

"dotted" :
"dotted":
{
m: dottedMaterial,
h: 0.2, s: 1, l: 0.9
},

"dotted2" :
"dotted2":
{
m: dottedMaterial2,
h: 0.1, s: 1, l: 0.5
Expand Down Expand Up @@ -407,9 +404,9 @@

function setupGui() {

var createHandler = function( id ) {
var createHandler = function ( id ) {

return function() {
return function () {

var mat_old = materials[ current_material ];
mat_old.h = m_h.getValue();
Expand All @@ -425,42 +422,41 @@
m_s.setValue( mat.s );
m_l.setValue( mat.l );

effect.enableUvs = (current_material === "textured") ? true : false;
effect.enableColors = (current_material === "colors") ? true : false;
effect.enableUvs = ( current_material === "textured" ) ? true : false;
effect.enableColors = ( current_material === "colors" ) ? true : false;

};

};

effectController = {

material: "shiny",
material: "shiny",

speed: 1.0,
numBlobs: 10,
resolution: 28,
isolation: 80,
speed: 1.0,
numBlobs: 10,
resolution: 28,
isolation: 80,

floor: true,
wallx: false,
wallz: false,
floor: true,
wallx: false,
wallz: false,

hue: 0.0,
saturation: 0.8,
lightness: 0.1,
hue: 0.0,
saturation: 0.8,
lightness: 0.1,

lhue: 0.04,
lsaturation: 1.0,
llightness: 0.5,
lhue: 0.04,
lsaturation: 1.0,
llightness: 0.5,

lx: 0.5,
ly: 0.5,
lz: 1.0,
lx: 0.5,
ly: 0.5,
lz: 1.0,

postprocessing: false,
postprocessing: false,

dummy: function() {
}
dummy: function () {}

};

Expand Down Expand Up @@ -491,17 +487,17 @@

h = gui.addFolder( "Point light color" );

h.add( effectController, "lhue", 0.0, 1.0, 0.025 ).name("hue");
h.add( effectController, "lsaturation", 0.0, 1.0, 0.025 ).name("saturation");
h.add( effectController, "llightness", 0.0, 1.0, 0.025 ).name("lightness");
h.add( effectController, "lhue", 0.0, 1.0, 0.025 ).name( "hue" );
h.add( effectController, "lsaturation", 0.0, 1.0, 0.025 ).name( "saturation" );
h.add( effectController, "llightness", 0.0, 1.0, 0.025 ).name( "lightness" );

// light (directional)

h = gui.addFolder( "Directional light orientation" );

h.add( effectController, "lx", -1.0, 1.0, 0.025 ).name("x");
h.add( effectController, "ly", -1.0, 1.0, 0.025 ).name("y");
h.add( effectController, "lz", -1.0, 1.0, 0.025 ).name("z");
h.add( effectController, "lx", - 1.0, 1.0, 0.025 ).name( "x" );
h.add( effectController, "ly", - 1.0, 1.0, 0.025 ).name( "y" );
h.add( effectController, "lz", - 1.0, 1.0, 0.025 ).name( "z" );

// simulation

Expand Down Expand Up @@ -542,7 +538,7 @@
bally = Math.abs( Math.cos( i + 1.12 * time * Math.cos( 1.22 + 0.1424 * i ) ) ) * 0.77; // dip into the floor
ballz = Math.cos( i + 1.32 * time * 0.1 * Math.sin( ( 0.92 + 0.53 * i ) ) ) * 0.27 + 0.5;

object.addBall(ballx, bally, ballz, strength, subtract);
object.addBall( ballx, bally, ballz, strength, subtract );

}

Expand All @@ -554,7 +550,6 @@

//


function animate() {

requestAnimationFrame( animate );
Expand Down
14 changes: 7 additions & 7 deletions examples/webgl_materials_blending.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}

var camera, scene, renderer;
var mesh, mapBg;
var mapBg;

var textureLoader = new THREE.TextureLoader();

Expand Down Expand Up @@ -73,7 +73,7 @@
var materialBg = new THREE.MeshBasicMaterial( { map: mapBg } );

var meshBg = new THREE.Mesh( new THREE.PlaneBufferGeometry( 4000, 2000 ), materialBg );
meshBg.position.set( 0, 0, -1 );
meshBg.position.set( 0, 0, - 1 );
scene.add( meshBg );

// OBJECTS
Expand All @@ -92,8 +92,8 @@
addImageRow( map0, 300 );
addImageRow( map1, 150 );
addImageRow( map2, 0 );
addImageRow( map3, -150 );
addImageRow( map4, -300 );
addImageRow( map3, - 150 );
addImageRow( map4, - 300 );

function addImageRow( map, y ) {

Expand Down Expand Up @@ -136,7 +136,7 @@

//

function onWindowResize( event ) {
function onWindowResize() {

var SCREEN_WIDTH = window.innerWidth;
var SCREEN_HEIGHT = window.innerHeight;
Expand Down Expand Up @@ -176,8 +176,8 @@
requestAnimationFrame( animate );

var time = Date.now() * 0.00025;
var ox = ( time * -0.01 * mapBg.repeat.x ) % 1;
var oy = ( time * -0.01 * mapBg.repeat.y ) % 1;
var ox = ( time * - 0.01 * mapBg.repeat.x ) % 1;
var oy = ( time * - 0.01 * mapBg.repeat.y ) % 1;

mapBg.offset.set( ox, oy );

Expand Down
Loading

0 comments on commit a5b45d1

Please sign in to comment.