language
stringclasses 1
value | owner
stringlengths 2
15
| repo
stringlengths 2
21
| sha
stringlengths 45
45
| message
stringlengths 7
36.3k
| path
stringlengths 1
199
| patch
stringlengths 15
102k
| is_multipart
bool 2
classes |
---|---|---|---|---|---|---|---|
Other | mrdoob | three.js | ddff0f642acbf650b53d1ddffe544900569ab983.json | Add comments to FF RGB format fix | examples/js/SimulationRenderer.js | @@ -226,7 +226,7 @@ function SimulationRenderer( WIDTH, renderer ) {
}
- var texture = new THREE.DataTexture( a, WIDTH, WIDTH, THREE.RGBAFormat, THREE.FloatType );
+ var texture = new THREE.DataTexture( a, WIDTH, WIDTH, THREE.RGBAFormat, THREE.FloatType ); // was RGB format. changed to RGBA format. see discussion in #8415 / #8450
texture.needsUpdate = true;
return texture; | true |
Other | mrdoob | three.js | ddff0f642acbf650b53d1ddffe544900569ab983.json | Add comments to FF RGB format fix | examples/js/postprocessing/AdaptiveToneMappingPass.js | @@ -186,7 +186,8 @@ THREE.AdaptiveToneMappingPass.prototype = {
this.previousLuminanceRT.dispose();
}
- var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat };
+
+ var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat }; // was RGB format. changed to RGBA format. see discussion in #8415 / #8450
this.luminanceRT = new THREE.WebGLRenderTarget( this.resolution, this.resolution, pars );
this.luminanceRT.texture.generateMipmaps = false; | true |
Other | mrdoob | three.js | f1bb83627ee8303e8e7495d3ac60cb4bde58b88a.json | Remove example variations_standard2
because now its basically the same as the other without metalness. | examples/webgl_materials_variations_standard2.html | @@ -1,242 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <title>three.js webgl - materials</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <style>
- body {
- color: #fff;
- font-family:Monospace;
- font-size:13px;
- text-align:center;
-
- background-color: #000;
- margin: 0px;
- overflow: hidden;
- }
-
- #info {
- position: absolute;
- top: 0px; width: 100%;
- padding: 5px;
- }
- </style>
- </head>
- <body>
-
- <div id="container"></div>
- <div id="info"><a href="http://threejs.org" target="_blank">three.js</a> - Standard Material Variations v2 by <a href="http://clara.io/" target="_blank">Ben Houston</a>.</div>
-
- <script src="../build/three.min.js"></script>
- <script src="js/controls/OrbitControls.js"></script>
-
- <script src="js/Detector.js"></script>
- <script src="js/libs/stats.min.js"></script>
-
- <script>
-
- if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
-
- var container, stats;
-
- var camera, scene, renderer, controls, objects = [];
- var particleLight;
-
- var loader = new THREE.FontLoader();
- loader.load( 'fonts/gentilis_regular.typeface.js', function ( font ) {
-
- init( font );
- animate();
-
- } );
-
- function init( font ) {
-
- container = document.createElement( 'div' );
- document.body.appendChild( container );
-
- camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 2000 );
- camera.position.set( 0.0, 400, 400 * 3.5 );
-
- scene = new THREE.Scene();
-
- // Materials
-
- var imgTexture = new THREE.TextureLoader().load( "textures/planets/moon_1024.jpg" );
- imgTexture.wrapS = imgTexture.wrapT = THREE.RepeatWrapping;
- imgTexture.anisotropy = 16;
- imgTexture = null;
-
- var shininess = 50, specular = 0x333333, bumpScale = 1, shading = THREE.SmoothShading;
-
- var materials = [];
-
- 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 );
- reflectionCube.format = THREE.RGBFormat;
-
- var cubeWidth = 400;
- var numberOfSphersPerSide = 5;
- var sphereRadius = ( cubeWidth / numberOfSphersPerSide ) * 0.8 * 0.5;
- var stepSize = 1.0 / numberOfSphersPerSide;
-
- var geometry = new THREE.SphereBufferGeometry( sphereRadius, 32, 16 );
-
- var localReflectionCube;
-
- for( var alpha = 0, alphaIndex = 0; alpha <= 1.0; alpha += stepSize, alphaIndex ++ ) {
-
- var roughness = 1.0 - alpha;
-
- if( alphaIndex % 2 === 0 ) {
- localReflectionCube = null;
- }
- else {
- localReflectionCube = reflectionCube;
- }
-
- for( var beta = 0; beta <= 1.0; beta += stepSize ) {
-
- for( var gamma = 0; gamma <= 1.0; gamma += stepSize ) {
-
- // basic monochromatic energy preservation
- var diffuseColor = new THREE.Color( gamma, 0, 0 ).multiplyScalar( 1 - 0.08 );
-
- var material = new THREE.MeshStandardMaterial( { map: imgTexture, bumpMap: imgTexture, bumpScale: bumpScale, color: diffuseColor, roughness: roughness, shading: THREE.SmoothShading, envMap: localReflectionCube } )
-
- var mesh = new THREE.Mesh( geometry, material );
-
- mesh.position.x = alpha * 400 - 200;
- mesh.position.y = beta * 400 - 200;
- mesh.position.z = gamma * 400 - 200;
-
- objects.push( mesh );
-
- scene.add( mesh );
- }
- }
- }
-
- function addLabel( name, location ) {
- var textGeo = new THREE.TextGeometry( name, {
-
- font: font,
-
- size: 20,
- height: 1,
- curveSegments: 1
-
- });
-
- var textMaterial = new THREE.MeshBasicMaterial( { color: 0xffffff } );
- var textMesh = new THREE.Mesh( textGeo, textMaterial );
- textMesh.position.copy( location );
- scene.add( textMesh );
- }
-
- addLabel( "+roughness", new THREE.Vector3( -350, 0, 0 ) );
- addLabel( "-roughness", new THREE.Vector3( 350, 0, 0 ) );
-
- addLabel( "-diffuse", new THREE.Vector3( 0, 0, -300 ) );
- addLabel( "+diffuse", new THREE.Vector3( 0, 0, 300 ) );
-
- particleLight = new THREE.Mesh( new THREE.SphereBufferGeometry( 4, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) );
- scene.add( particleLight );
-
- // Lights
-
- //scene.add( new THREE.AmbientLight( 0x222222 ) );
-
- //var directionalLight = new THREE.DirectionalLight( 0xffffff, 1 );
- //directionalLight.position.set( 1, 1, 1 ).normalize();
- //scene.add( directionalLight );
-
- var pointLight = new THREE.PointLight( 0xffffff, 2, 800 );
- particleLight.add( pointLight );
-
- //
-
- renderer = new THREE.WebGLRenderer( { antialias: true } );
- renderer.setClearColor( 0x0a0a0a );
- renderer.setPixelRatio( window.devicePixelRatio );
- renderer.setSize( window.innerWidth, window.innerHeight );
- renderer.sortObjects = true;
-
- container.appendChild( renderer.domElement );
-
- renderer.gammaInput = true;
- renderer.gammaOutput = true;
-
- //
-
- stats = new Stats();
- stats.domElement.style.position = 'absolute';
- stats.domElement.style.top = '0px';
-
- container.appendChild( stats.domElement );
-
- controls = new THREE.OrbitControls( camera );
- controls.target.set( 0, 0, 0 );
- controls.update();
-
- window.addEventListener( 'resize', onWindowResize, false );
-
- }
-
- function onWindowResize() {
-
- camera.aspect = window.innerWidth / window.innerHeight;
- camera.updateProjectionMatrix();
-
- renderer.setSize( window.innerWidth, window.innerHeight );
-
- }
-
- //
-
- function animate() {
-
- requestAnimationFrame( animate );
-
- render();
- stats.update();
-
- }
-
- function render() {
-
- var timer = Date.now() * 0.00025;
-
- //camera.position.x = Math.cos( timer ) * 800;
- //camera.position.z = Math.sin( timer ) * 800;
-
- camera.lookAt( scene.position );
-
- for ( var i = 0, l = objects.length; i < l; i ++ ) {
-
- var object = objects[ i ];
-
- object.rotation.y += 0.005;
-
- }
-
- particleLight.position.x = Math.sin( timer * 7 ) * 300;
- particleLight.position.y = Math.cos( timer * 5 ) * 400;
- particleLight.position.z = Math.cos( timer * 3 ) * 300;
-
- renderer.render( scene, camera );
-
- }
-
- </script>
-
- </body>
-</html> | false |
Other | mrdoob | three.js | 4895e177aa5cdb2f41eb5d63a30be609fa60ffe5.json | remove reflectivity from example
'reflectivity' is not a property of mesh standard material | examples/webgl_materials_variations_standard2.html | @@ -105,14 +105,12 @@
for( var beta = 0; beta <= 1.0; beta += stepSize ) {
- var reflectivity = beta;
-
for( var gamma = 0; gamma <= 1.0; gamma += stepSize ) {
// basic monochromatic energy preservation
var diffuseColor = new THREE.Color( gamma, 0, 0 ).multiplyScalar( 1 - 0.08 );
- var material = new THREE.MeshStandardMaterial( { map: imgTexture, bumpMap: imgTexture, bumpScale: bumpScale, color: diffuseColor, reflectivity: reflectivity, roughness: roughness, shading: THREE.SmoothShading, envMap: localReflectionCube } )
+ var material = new THREE.MeshStandardMaterial( { map: imgTexture, bumpMap: imgTexture, bumpScale: bumpScale, color: diffuseColor, roughness: roughness, shading: THREE.SmoothShading, envMap: localReflectionCube } )
var mesh = new THREE.Mesh( geometry, material );
@@ -147,9 +145,6 @@
addLabel( "+roughness", new THREE.Vector3( -350, 0, 0 ) );
addLabel( "-roughness", new THREE.Vector3( 350, 0, 0 ) );
- addLabel( "-reflectivity", new THREE.Vector3( 0, -300, 0 ) );
- addLabel( "+reflectivity", new THREE.Vector3( 0, 300, 0 ) );
-
addLabel( "-diffuse", new THREE.Vector3( 0, 0, -300 ) );
addLabel( "+diffuse", new THREE.Vector3( 0, 0, 300 ) );
| false |
Other | mrdoob | three.js | 807a8ec729c715f6e4008c48c0cd49b0d4e66dbd.json | add error checking to include parser. | src/renderers/webgl/WebGLProgram.js | @@ -197,7 +197,9 @@ THREE.WebGLProgram = ( function () {
var pattern = /#include[ \t]+<([\w\d.]+)>/g;
function replace( match, include ) {
- return parseIncludes( THREE.ShaderChunk[ include ] );
+ var replace = THREE.ShaderChunk[ include ];
+ if( ! replace ) throw new Error( "can not resolve #include <"+include+">");
+ return parseIncludes( replace );
}
| false |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib.js | @@ -19,100 +19,8 @@ THREE.ShaderLib = {
] ),
- vertexShader: [
-
- '#include <common>',
- '#include <uv_pars_vertex>',
- '#include <uv2_pars_vertex>',
- '#include <envmap_pars_vertex>',
- '#include <color_pars_vertex>',
- '#include <morphtarget_pars_vertex>',
- '#include <skinning_pars_vertex>',
- '#include <logdepthbuf_pars_vertex>',
-
- "void main() {",
-
- '#include <uv_vertex>',
- '#include <uv2_vertex>',
- '#include <color_vertex>',
- '#include <skinbase_vertex>',
-
- " #ifdef USE_ENVMAP",
-
- '#include <beginnormal_vertex>',
- '#include <morphnormal_vertex>',
- '#include <skinnormal_vertex>',
- '#include <defaultnormal_vertex>',
-
- " #endif",
-
- '#include <begin_vertex>',
- '#include <morphtarget_vertex>',
- '#include <skinning_vertex>',
- '#include <project_vertex>',
- '#include <logdepthbuf_vertex>',
-
- '#include <worldpos_vertex>',
- '#include <envmap_vertex>',
-
- "}"
-
- ].join( "\n" ),
-
- fragmentShader: [
-
- "uniform vec3 diffuse;",
- "uniform float opacity;",
-
- "#ifndef FLAT_SHADED",
-
- " varying vec3 vNormal;",
-
- "#endif",
-
- '#include <common>',
- '#include <encodings>',
- '#include <color_pars_fragment>',
- '#include <uv_pars_fragment>',
- '#include <uv2_pars_fragment>',
- '#include <map_pars_fragment>',
- '#include <alphamap_pars_fragment>',
- '#include <aomap_pars_fragment>',
- '#include <envmap_pars_fragment>',
- '#include <fog_pars_fragment>',
- '#include <specularmap_pars_fragment>',
- '#include <logdepthbuf_pars_fragment>',
-
- "void main() {",
-
- " vec4 diffuseColor = vec4( diffuse, opacity );",
-
- '#include <logdepthbuf_fragment>',
- '#include <map_fragment>',
- '#include <color_fragment>',
- '#include <alphamap_fragment>',
- '#include <alphatest_fragment>',
- '#include <specularmap_fragment>',
-
- " ReflectedLight reflectedLight;",
- " reflectedLight.directDiffuse = vec3( 0.0 );",
- " reflectedLight.directSpecular = vec3( 0.0 );",
- " reflectedLight.indirectDiffuse = diffuseColor.rgb;",
- " reflectedLight.indirectSpecular = vec3( 0.0 );",
-
- '#include <aomap_fragment>',
-
- " vec3 outgoingLight = reflectedLight.indirectDiffuse;",
-
- '#include <envmap_fragment>',
- '#include <linear_to_gamma_fragment>',
- '#include <fog_fragment>',
-
- " gl_FragColor = vec4( outgoingLight, diffuseColor.a );",
-
- "}"
-
- ].join( "\n" )
+ vertexShader: THREE.ShaderChunk['meshbasic_vert'],
+ fragmentShader: THREE.ShaderChunk['meshbasic_frag']
},
@@ -134,140 +42,8 @@ THREE.ShaderLib = {
] ),
- vertexShader: [
-
- "#define LAMBERT",
-
- "varying vec3 vLightFront;",
-
- "#ifdef DOUBLE_SIDED",
-
- " varying vec3 vLightBack;",
-
- "#endif",
-
- '#include <common>',
- '#include <uv_pars_vertex>',
- '#include <uv2_pars_vertex>',
- '#include <envmap_pars_vertex>',
- '#include <bsdfs>',
- '#include <lights_pars>',
- '#include <color_pars_vertex>',
- '#include <morphtarget_pars_vertex>',
- '#include <skinning_pars_vertex>',
- '#include <shadowmap_pars_vertex>',
- '#include <logdepthbuf_pars_vertex>',
-
- "void main() {",
-
- '#include <uv_vertex>',
- '#include <uv2_vertex>',
- '#include <color_vertex>',
-
- '#include <beginnormal_vertex>',
- '#include <morphnormal_vertex>',
- '#include <skinbase_vertex>',
- '#include <skinnormal_vertex>',
- '#include <defaultnormal_vertex>',
-
- '#include <begin_vertex>',
- '#include <morphtarget_vertex>',
- '#include <skinning_vertex>',
- '#include <project_vertex>',
- '#include <logdepthbuf_vertex>',
-
- '#include <worldpos_vertex>',
- '#include <envmap_vertex>',
- '#include <lights_lambert_vertex>',
- '#include <shadowmap_vertex>',
-
- "}"
-
- ].join( "\n" ),
-
- fragmentShader: [
-
- "uniform vec3 diffuse;",
- "uniform vec3 emissive;",
- "uniform float opacity;",
-
- "varying vec3 vLightFront;",
-
- "#ifdef DOUBLE_SIDED",
-
- " varying vec3 vLightBack;",
-
- "#endif",
-
- '#include <common>',
- '#include <encodings>',
- '#include <color_pars_fragment>',
- '#include <uv_pars_fragment>',
- '#include <uv2_pars_fragment>',
- '#include <map_pars_fragment>',
- '#include <alphamap_pars_fragment>',
- '#include <aomap_pars_fragment>',
- '#include <lightmap_pars_fragment>',
- '#include <emissivemap_pars_fragment>',
- '#include <envmap_pars_fragment>',
- '#include <bsdfs>',
- '#include <ambient_pars>',
- '#include <lights_pars>',
- '#include <fog_pars_fragment>',
- '#include <shadowmap_pars_fragment>',
- '#include <shadowmask_pars_fragment>',
- '#include <specularmap_pars_fragment>',
- '#include <logdepthbuf_pars_fragment>',
-
- "void main() {",
-
- " vec4 diffuseColor = vec4( diffuse, opacity );",
- " ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",
- " vec3 totalEmissiveLight = emissive;",
-
- '#include <logdepthbuf_fragment>',
- '#include <map_fragment>',
- '#include <color_fragment>',
- '#include <alphamap_fragment>',
- '#include <alphatest_fragment>',
- '#include <specularmap_fragment>',
- '#include <emissivemap_fragment>',
-
- // accumulation
- " reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );",
-
- '#include <lightmap_fragment>',
-
- " reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );",
-
- " #ifdef DOUBLE_SIDED",
-
- " reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;",
-
- " #else",
-
- " reflectedLight.directDiffuse = vLightFront;",
-
- " #endif",
-
- " reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();",
-
- // modulation
- '#include <aomap_fragment>',
-
- " vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveLight;",
-
- '#include <envmap_fragment>',
-
- '#include <linear_to_gamma_fragment>',
-
- '#include <fog_fragment>',
-
- " gl_FragColor = vec4( outgoingLight, diffuseColor.a );",
-
- "}"
-
- ].join( "\n" )
+ vertexShader: THREE.ShaderChunk['meshlambert_vert'],
+ fragmentShader: THREE.ShaderChunk['meshlambert_frag']
},
@@ -294,132 +70,8 @@ THREE.ShaderLib = {
] ),
- vertexShader: [
-
- "#define PHONG",
-
- "varying vec3 vViewPosition;",
-
- "#ifndef FLAT_SHADED",
-
- " varying vec3 vNormal;",
-
- "#endif",
-
- '#include <common>',
- '#include <uv_pars_vertex>',
- '#include <uv2_pars_vertex>',
- '#include <displacementmap_pars_vertex>',
- '#include <envmap_pars_vertex>',
- '#include <lights_phong_pars_vertex>',
- '#include <color_pars_vertex>',
- '#include <morphtarget_pars_vertex>',
- '#include <skinning_pars_vertex>',
- '#include <shadowmap_pars_vertex>',
- '#include <logdepthbuf_pars_vertex>',
-
- "void main() {",
-
- '#include <uv_vertex>',
- '#include <uv2_vertex>',
- '#include <color_vertex>',
-
- '#include <beginnormal_vertex>',
- '#include <morphnormal_vertex>',
- '#include <skinbase_vertex>',
- '#include <skinnormal_vertex>',
- '#include <defaultnormal_vertex>',
-
- "#ifndef FLAT_SHADED", // Normal computed with derivatives when FLAT_SHADED
-
- " vNormal = normalize( transformedNormal );",
-
- "#endif",
-
- '#include <begin_vertex>',
- '#include <displacementmap_vertex>',
- '#include <morphtarget_vertex>',
- '#include <skinning_vertex>',
- '#include <project_vertex>',
- '#include <logdepthbuf_vertex>',
-
- " vViewPosition = - mvPosition.xyz;",
-
- '#include <worldpos_vertex>',
- '#include <envmap_vertex>',
- '#include <lights_phong_vertex>',
- '#include <shadowmap_vertex>',
-
- "}"
-
- ].join( "\n" ),
-
- fragmentShader: [
-
- "#define PHONG",
-
- "uniform vec3 diffuse;",
- "uniform vec3 emissive;",
- "uniform vec3 specular;",
- "uniform float shininess;",
- "uniform float opacity;",
-
- '#include <common>',
- '#include <encodings>',
- '#include <color_pars_fragment>',
- '#include <uv_pars_fragment>',
- '#include <uv2_pars_fragment>',
- '#include <map_pars_fragment>',
- '#include <alphamap_pars_fragment>',
- '#include <aomap_pars_fragment>',
- '#include <lightmap_pars_fragment>',
- '#include <emissivemap_pars_fragment>',
- '#include <envmap_pars_fragment>',
- '#include <fog_pars_fragment>',
- '#include <bsdfs>',
- '#include <ambient_pars>',
- '#include <lights_pars>',
- '#include <lights_phong_pars_fragment>',
- '#include <shadowmap_pars_fragment>',
- '#include <bumpmap_pars_fragment>',
- '#include <normalmap_pars_fragment>',
- '#include <specularmap_pars_fragment>',
- '#include <logdepthbuf_pars_fragment>',
-
- "void main() {",
-
- " vec4 diffuseColor = vec4( diffuse, opacity );",
- " ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",
- " vec3 totalEmissiveLight = emissive;",
-
- '#include <logdepthbuf_fragment>',
- '#include <map_fragment>',
- '#include <color_fragment>',
- '#include <alphamap_fragment>',
- '#include <alphatest_fragment>',
- '#include <specularmap_fragment>',
- '#include <normal_fragment>',
- '#include <emissivemap_fragment>',
-
- // accumulation
- '#include <lights_phong_fragment>',
- '#include <lights_template>',
-
- // modulation
- '#include <aomap_fragment>',
-
- "vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",
-
- '#include <envmap_fragment>',
- '#include <linear_to_gamma_fragment>',
-
- '#include <fog_fragment>',
-
- " gl_FragColor = vec4( outgoingLight, diffuseColor.a );",
-
- "}"
-
- ].join( "\n" )
+ vertexShader: THREE.ShaderChunk['meshphong_vert'],
+ fragmentShader: THREE.ShaderChunk['meshphong_frag']
},
@@ -449,17 +101,8 @@ THREE.ShaderLib = {
] ),
- vertexShader: [
-
- "#include <meshstandard_vert>"
-
- ].join( "\n" ),
-
- fragmentShader: [
-
- "#include <meshstandard_frag>"
-
- ].join( "\n" )
+ vertexShader: THREE.ShaderChunk['meshstandard_vert'],
+ fragmentShader: THREE.ShaderChunk['meshstandard_frag']
},
@@ -472,68 +115,8 @@ THREE.ShaderLib = {
] ),
- vertexShader: [
-
- "uniform float size;",
- "uniform float scale;",
-
- '#include <common>',
- '#include <color_pars_vertex>',
- '#include <shadowmap_pars_vertex>',
- '#include <logdepthbuf_pars_vertex>',
-
- "void main() {",
-
- '#include <color_vertex>',
- '#include <begin_vertex>',
- '#include <project_vertex>',
-
- " #ifdef USE_SIZEATTENUATION",
- " gl_PointSize = size * ( scale / - mvPosition.z );",
- " #else",
- " gl_PointSize = size;",
- " #endif",
-
- '#include <logdepthbuf_vertex>',
- '#include <worldpos_vertex>',
- '#include <shadowmap_vertex>',
-
- "}"
-
- ].join( "\n" ),
-
- fragmentShader: [
-
- "uniform vec3 diffuse;",
- "uniform float opacity;",
-
- '#include <common>',
- '#include <encodings>',
- '#include <color_pars_fragment>',
- '#include <map_particle_pars_fragment>',
- '#include <fog_pars_fragment>',
- '#include <shadowmap_pars_fragment>',
- '#include <logdepthbuf_pars_fragment>',
-
- "void main() {",
-
- " vec3 outgoingLight = vec3( 0.0 );",
- " vec4 diffuseColor = vec4( diffuse, opacity );",
-
- '#include <logdepthbuf_fragment>',
- '#include <map_particle_fragment>',
- '#include <color_fragment>',
- '#include <alphatest_fragment>',
-
- " outgoingLight = diffuseColor.rgb;",
-
- '#include <fog_fragment>',
-
- " gl_FragColor = vec4( outgoingLight, diffuseColor.a );",
-
- "}"
-
- ].join( "\n" )
+ vertexShader: THREE.ShaderChunk['points_vert'],
+ fragmentShader: THREE.ShaderChunk['points_frag']
},
@@ -552,70 +135,8 @@ THREE.ShaderLib = {
] ),
- vertexShader: [
-
- "uniform float scale;",
- "attribute float lineDistance;",
-
- "varying float vLineDistance;",
-
- '#include <common>',
- '#include <color_pars_vertex>',
- '#include <logdepthbuf_pars_vertex>',
-
- "void main() {",
-
- '#include <color_vertex>',
-
- " vLineDistance = scale * lineDistance;",
-
- " vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
- " gl_Position = projectionMatrix * mvPosition;",
-
- '#include <logdepthbuf_vertex>',
-
- "}"
-
- ].join( "\n" ),
-
- fragmentShader: [
-
- "uniform vec3 diffuse;",
- "uniform float opacity;",
-
- "uniform float dashSize;",
- "uniform float totalSize;",
-
- "varying float vLineDistance;",
-
- '#include <common>',
- '#include <color_pars_fragment>',
- '#include <fog_pars_fragment>',
- '#include <logdepthbuf_pars_fragment>',
-
- "void main() {",
-
- " if ( mod( vLineDistance, totalSize ) > dashSize ) {",
-
- " discard;",
-
- " }",
-
- " vec3 outgoingLight = vec3( 0.0 );",
- " vec4 diffuseColor = vec4( diffuse, opacity );",
-
- '#include <logdepthbuf_fragment>',
- '#include <color_fragment>',
-
- " outgoingLight = diffuseColor.rgb;", // simple shader
-
- '#include <fog_fragment>',
-
- " gl_FragColor = vec4( outgoingLight, diffuseColor.a );",
-
- "}"
-
- ].join( "\n" )
+ vertexShader: THREE.ShaderChunk['linedashed_vert'],
+ fragmentShader: THREE.ShaderChunk['linedashed_frag']
},
@@ -629,52 +150,8 @@ THREE.ShaderLib = {
},
- vertexShader: [
-
- '#include <common>',
- '#include <morphtarget_pars_vertex>',
- '#include <logdepthbuf_pars_vertex>',
-
- "void main() {",
-
- '#include <begin_vertex>',
- '#include <morphtarget_vertex>',
- '#include <project_vertex>',
- '#include <logdepthbuf_vertex>',
-
- "}"
-
- ].join( "\n" ),
-
- fragmentShader: [
-
- "uniform float mNear;",
- "uniform float mFar;",
- "uniform float opacity;",
-
- '#include <common>',
- '#include <logdepthbuf_pars_fragment>',
-
- "void main() {",
-
- '#include <logdepthbuf_fragment>',
-
- " #ifdef USE_LOGDEPTHBUF_EXT",
-
- " float depth = gl_FragDepthEXT / gl_FragCoord.w;",
-
- " #else",
-
- " float depth = gl_FragCoord.z / gl_FragCoord.w;",
-
- " #endif",
-
- " float color = 1.0 - smoothstep( mNear, mFar, depth );",
- " gl_FragColor = vec4( vec3( color ), opacity );",
-
- "}"
-
- ].join( "\n" )
+ vertexShader: THREE.ShaderChunk['depth_vert'],
+ fragmentShader: THREE.ShaderChunk['depth_frag']
},
@@ -686,44 +163,8 @@ THREE.ShaderLib = {
},
- vertexShader: [
-
- "varying vec3 vNormal;",
-
- '#include <common>',
- '#include <morphtarget_pars_vertex>',
- '#include <logdepthbuf_pars_vertex>',
-
- "void main() {",
-
- " vNormal = normalize( normalMatrix * normal );",
-
- '#include <begin_vertex>',
- '#include <morphtarget_vertex>',
- '#include <project_vertex>',
- '#include <logdepthbuf_vertex>',
-
- "}"
-
- ].join( "\n" ),
-
- fragmentShader: [
-
- "uniform float opacity;",
- "varying vec3 vNormal;",
-
- '#include <common>',
- '#include <logdepthbuf_pars_fragment>',
-
- "void main() {",
-
- " gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",
-
- '#include <logdepthbuf_fragment>',
-
- "}"
-
- ].join( "\n" )
+ vertexShader: THREE.ShaderChunk['normal_vert'],
+ fragmentShader: THREE.ShaderChunk['normal_frag']
},
@@ -738,44 +179,8 @@ THREE.ShaderLib = {
"tFlip": { type: "f", value: - 1 }
},
- vertexShader: [
-
- "varying vec3 vWorldPosition;",
-
- '#include <common>',
- '#include <logdepthbuf_pars_vertex>',
-
- "void main() {",
-
- " vWorldPosition = transformDirection( position, modelMatrix );",
-
- " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
- '#include <logdepthbuf_vertex>',
-
- "}"
-
- ].join( "\n" ),
-
- fragmentShader: [
-
- "uniform samplerCube tCube;",
- "uniform float tFlip;",
-
- "varying vec3 vWorldPosition;",
-
- '#include <common>',
- '#include <logdepthbuf_pars_fragment>',
-
- "void main() {",
-
- " gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",
-
- '#include <logdepthbuf_fragment>',
-
- "}"
-
- ].join( "\n" )
+ vertexShader: THREE.ShaderChunk['cube_vert'],
+ fragmentShader: THREE.ShaderChunk['cube_frag']
},
@@ -790,49 +195,8 @@ THREE.ShaderLib = {
"tFlip": { type: "f", value: - 1 }
},
- vertexShader: [
-
- "varying vec3 vWorldPosition;",
-
- '#include <common>',
- '#include <logdepthbuf_pars_vertex>',
-
- "void main() {",
-
- " vWorldPosition = transformDirection( position, modelMatrix );",
-
- " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
- '#include <logdepthbuf_vertex>',
-
- "}"
-
- ].join( "\n" ),
-
- fragmentShader: [
-
- "uniform sampler2D tEquirect;",
- "uniform float tFlip;",
-
- "varying vec3 vWorldPosition;",
-
- '#include <common>',
- '#include <logdepthbuf_pars_fragment>',
-
- "void main() {",
-
- // " gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",
- "vec3 direction = normalize( vWorldPosition );",
- "vec2 sampleUV;",
- "sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );",
- "sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;",
- "gl_FragColor = texture2D( tEquirect, sampleUV );",
-
- '#include <logdepthbuf_fragment>',
-
- "}"
-
- ].join( "\n" )
+ vertexShader: THREE.ShaderChunk['equirect_vert'],
+ fragmentShader: THREE.ShaderChunk['equirect_frag']
},
@@ -852,64 +216,8 @@ THREE.ShaderLib = {
uniforms: {},
- vertexShader: [
-
- '#include <common>',
- '#include <morphtarget_pars_vertex>',
- '#include <skinning_pars_vertex>',
- '#include <logdepthbuf_pars_vertex>',
-
- "void main() {",
-
- '#include <skinbase_vertex>',
-
- '#include <begin_vertex>',
- '#include <morphtarget_vertex>',
- '#include <skinning_vertex>',
- '#include <project_vertex>',
- '#include <logdepthbuf_vertex>',
-
- "}"
-
- ].join( "\n" ),
-
- fragmentShader: [
-
- '#include <common>',
- '#include <logdepthbuf_pars_fragment>',
-
- "vec4 pack_depth( const in float depth ) {",
-
- " const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );",
- " const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );",
- " vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );",
- " res -= res.xxyz * bit_mask;",
- " return res;",
-
- "}",
-
- "void main() {",
-
- '#include <logdepthbuf_fragment>',
-
- " #ifdef USE_LOGDEPTHBUF_EXT",
-
- " gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );",
-
- " #else",
-
- " gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );",
-
- " #endif",
-
- //"gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z / gl_FragCoord.w );",
- //"float z = ( ( gl_FragCoord.z / gl_FragCoord.w ) - 3.0 ) / ( 4000.0 - 3.0 );",
- //"gl_FragData[ 0 ] = pack_depth( z );",
- //"gl_FragData[ 0 ] = vec4( z, z, z, 1.0 );",
-
- "}"
-
- ].join( "\n" )
+ vertexShader: THREE.ShaderChunk['depthRGBA_vert'],
+ fragmentShader: THREE.ShaderChunk['depthRGBA_frag']
},
@@ -922,61 +230,8 @@ THREE.ShaderLib = {
},
- vertexShader: [
-
- "varying vec4 vWorldPosition;",
-
- '#include <common>',
- '#include <morphtarget_pars_vertex>',
- '#include <skinning_pars_vertex>',
-
- "void main() {",
-
- '#include <skinbase_vertex>',
- '#include <begin_vertex>',
- '#include <morphtarget_vertex>',
- '#include <skinning_vertex>',
- '#include <project_vertex>',
- '#include <worldpos_vertex>',
-
- "vWorldPosition = worldPosition;",
-
- "}"
-
- ].join( "\n" ),
-
- fragmentShader: [
-
- "uniform vec3 lightPos;",
- "varying vec4 vWorldPosition;",
-
- '#include <common>',
-
- "vec4 pack1K ( float depth ) {",
-
- " depth /= 1000.0;",
- " const vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );",
- " const vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );",
- " vec4 res = mod( depth * bitSh * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );",
- " res -= res.xxyz * bitMsk;",
- " return res; ",
-
- "}",
-
- "float unpack1K ( vec4 color ) {",
-
- " const vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );",
- " return dot( color, bitSh ) * 1000.0;",
-
- "}",
-
- "void main () {",
-
- " gl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );",
-
- "}"
-
- ].join( "\n" )
+ vertexShader: THREE.ShaderChunk['distanceRGBA_vert'],
+ fragmentShader: THREE.ShaderChunk['distanceRGBA_frag']
}
| true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/cube_frag.glsl | @@ -0,0 +1,15 @@
+uniform samplerCube tCube;
+uniform float tFlip;
+
+varying vec3 vWorldPosition;
+
+#include <common>
+#include <logdepthbuf_pars_fragment>
+
+void main() {
+
+ gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );
+
+ #include <logdepthbuf_fragment>
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/cube_vert.glsl | @@ -0,0 +1,14 @@
+varying vec3 vWorldPosition;
+
+#include <common>
+#include <logdepthbuf_pars_vertex>
+
+void main() {
+
+ vWorldPosition = transformDirection( position, modelMatrix );
+
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
+
+ #include <logdepthbuf_vertex>
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/depthRGBA_frag.glsl | @@ -0,0 +1,33 @@
+#include <common>
+#include <logdepthbuf_pars_fragment>
+
+vec4 pack_depth( const in float depth ) {
+
+ const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );
+ const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );
+ vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );
+ res -= res.xxyz * bit_mask;
+ return res;
+
+}
+
+void main() {
+
+ #include <logdepthbuf_fragment>
+
+ #ifdef USE_LOGDEPTHBUF_EXT
+
+ gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );
+
+ #else
+
+ gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );
+
+ #endif
+
+ //gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z / gl_FragCoord.w );
+ //float z = ( ( gl_FragCoord.z / gl_FragCoord.w ) - 3.0 ) / ( 4000.0 - 3.0 );
+ //gl_FragData[ 0 ] = pack_depth( z );
+ //gl_FragData[ 0 ] = vec4( z, z, z, 1.0 );
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/depthRGBA_vert.glsl | @@ -0,0 +1,16 @@
+#include <common>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+
+void main() {
+
+ #include <skinbase_vertex>
+
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/depth_frag.glsl | @@ -0,0 +1,25 @@
+uniform float mNear;
+uniform float mFar;
+uniform float opacity;
+
+#include <common>
+#include <logdepthbuf_pars_fragment>
+
+void main() {
+
+ #include <logdepthbuf_fragment>
+
+ #ifdef USE_LOGDEPTHBUF_EXT
+
+ float depth = gl_FragDepthEXT / gl_FragCoord.w;
+
+ #else
+
+ float depth = gl_FragCoord.z / gl_FragCoord.w;
+
+ #endif
+
+ float color = 1.0 - smoothstep( mNear, mFar, depth );
+ gl_FragColor = vec4( vec3( color ), opacity );
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/depth_vert.glsl | @@ -0,0 +1,12 @@
+#include <common>
+#include <morphtarget_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+
+void main() {
+
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/distanceRGBA_frag.glsl | @@ -0,0 +1,26 @@
+uniform vec3 lightPos;
+varying vec4 vWorldPosition;
+
+#include <common>
+
+vec4 pack1K ( float depth ) {
+
+ depth /= 1000.0;
+ const vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );
+ const vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );
+ vec4 res = mod( depth * bitSh * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );
+ res -= res.xxyz * bitMsk;
+ return res;
+
+}
+
+float unpack1K ( vec4 color ) {
+
+ const vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );
+ return dot( color, bitSh ) * 1000.0;
+
+}
+
+void main () {
+
+ gl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) ); | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/distanceRGBA_vert.glsl | @@ -0,0 +1,18 @@
+varying vec4 vWorldPosition;
+
+#include <common>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+
+void main() {
+
+ #include <skinbase_vertex>
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <project_vertex>
+ #include <worldpos_vertex>
+
+ vWorldPosition = worldPosition;
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/equirect_frag.glsl | @@ -0,0 +1,20 @@
+uniform sampler2D tEquirect;
+uniform float tFlip;
+
+varying vec3 vWorldPosition;
+
+#include <common>
+#include <logdepthbuf_pars_fragment>
+
+void main() {
+
+ // gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );
+ vec3 direction = normalize( vWorldPosition );
+ vec2 sampleUV;
+ sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );
+ sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;
+ gl_FragColor = texture2D( tEquirect, sampleUV );
+
+ #include <logdepthbuf_fragment>
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/equirect_vert.glsl | @@ -0,0 +1,14 @@
+varying vec3 vWorldPosition;
+
+#include <common>
+#include <logdepthbuf_pars_vertex>
+
+void main() {
+
+ vWorldPosition = transformDirection( position, modelMatrix );
+
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
+
+ #include <logdepthbuf_vertex>
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/linedashed_frag.glsl | @@ -0,0 +1,34 @@
+uniform vec3 diffuse;
+uniform float opacity;
+
+uniform float dashSize;
+uniform float totalSize;
+
+varying float vLineDistance;
+
+#include <common>
+#include <color_pars_fragment>
+#include <fog_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+
+void main() {
+
+ if ( mod( vLineDistance, totalSize ) > dashSize ) {
+
+ discard;
+
+ }
+
+ vec3 outgoingLight = vec3( 0.0 );
+ vec4 diffuseColor = vec4( diffuse, opacity );
+
+ #include <logdepthbuf_fragment>
+ #include <color_fragment>
+
+ outgoingLight = diffuseColor.rgb; // simple shader
+
+ #include <fog_fragment>
+
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/linedashed_vert.glsl | @@ -0,0 +1,21 @@
+uniform float scale;
+attribute float lineDistance;
+
+varying float vLineDistance;
+
+#include <common>
+#include <color_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+
+void main() {
+
+ #include <color_vertex>
+
+ vLineDistance = scale * lineDistance;
+
+ vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
+ gl_Position = projectionMatrix * mvPosition;
+
+ #include <logdepthbuf_vertex>
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/meshbasic_frag.glsl | @@ -0,0 +1,49 @@
+uniform vec3 diffuse;
+uniform float opacity;
+
+#ifndef FLAT_SHADED
+
+ varying vec3 vNormal;
+
+#endif
+
+#include <common>
+#include <color_pars_fragment>
+#include <uv_pars_fragment>
+#include <uv2_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <aomap_pars_fragment>
+#include <envmap_pars_fragment>
+#include <fog_pars_fragment>
+#include <specularmap_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+
+void main() {
+
+ vec4 diffuseColor = vec4( diffuse, opacity );
+
+ #include <logdepthbuf_fragment>
+ #include <map_fragment>
+ #include <color_fragment>
+ #include <alphamap_fragment>
+ #include <alphatest_fragment>
+ #include <specularmap_fragment>
+
+ ReflectedLight reflectedLight;
+ reflectedLight.directDiffuse = vec3( 0.0 );
+ reflectedLight.directSpecular = vec3( 0.0 );
+ reflectedLight.indirectDiffuse = diffuseColor.rgb;
+ reflectedLight.indirectSpecular = vec3( 0.0 );
+
+ #include <aomap_fragment>
+
+ vec3 outgoingLight = reflectedLight.indirectDiffuse;
+
+ #include <envmap_fragment>
+ #include <linear_to_gamma_fragment>
+ #include <fog_fragment>
+
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/meshbasic_vert.glsl | @@ -0,0 +1,35 @@
+#include <common>
+#include <uv_pars_vertex>
+#include <uv2_pars_vertex>
+#include <envmap_pars_vertex>
+#include <color_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+
+void main() {
+
+ #include <uv_vertex>
+ #include <uv2_vertex>
+ #include <color_vertex>
+ #include <skinbase_vertex>
+
+ #ifdef USE_ENVMAP
+
+ #include <beginnormal_vertex>
+ #include <morphnormal_vertex>
+ #include <skinnormal_vertex>
+ #include <defaultnormal_vertex>
+
+ #endif
+
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+
+ #include <worldpos_vertex>
+ #include <envmap_vertex>
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/meshlambert_frag.glsl | @@ -0,0 +1,78 @@
+uniform vec3 diffuse;
+uniform vec3 emissive;
+uniform float opacity;
+
+varying vec3 vLightFront;
+
+#ifdef DOUBLE_SIDED
+
+ varying vec3 vLightBack;
+
+#endif
+
+#include <common>
+#include <color_pars_fragment>
+#include <uv_pars_fragment>
+#include <uv2_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <aomap_pars_fragment>
+#include <lightmap_pars_fragment>
+#include <emissivemap_pars_fragment>
+#include <envmap_pars_fragment>
+#include <bsdfs>
+#include <ambient_pars>
+#include <lights_pars>
+#include <fog_pars_fragment>
+#include <shadowmap_pars_fragment>
+#include <shadowmask_pars_fragment>
+#include <specularmap_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+
+void main() {
+
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
+ vec3 totalEmissiveLight = emissive;
+
+ #include <logdepthbuf_fragment>
+ #include <map_fragment>
+ #include <color_fragment>
+ #include <alphamap_fragment>
+ #include <alphatest_fragment>
+ #include <specularmap_fragment>
+ #include <emissivemap_fragment>
+
+ // accumulation
+ reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );
+
+ #include <lightmap_fragment>
+
+ reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
+
+ #ifdef DOUBLE_SIDED
+
+ reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
+
+ #else
+
+ reflectedLight.directDiffuse = vLightFront;
+
+ #endif
+
+ reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();
+
+ // modulation
+ #include <aomap_fragment>
+
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveLight;
+
+ #include <envmap_fragment>
+
+ #include <linear_to_gamma_fragment>
+
+ #include <fog_fragment>
+
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/meshlambert_vert.glsl | @@ -0,0 +1,46 @@
+#define LAMBERT
+
+varying vec3 vLightFront;
+
+#ifdef DOUBLE_SIDED
+
+ varying vec3 vLightBack;
+
+#endif
+
+#include <common>
+#include <uv_pars_vertex>
+#include <uv2_pars_vertex>
+#include <envmap_pars_vertex>
+#include <bsdfs>
+#include <lights_pars>
+#include <color_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <shadowmap_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+
+void main() {
+
+ #include <uv_vertex>
+ #include <uv2_vertex>
+ #include <color_vertex>
+
+ #include <beginnormal_vertex>
+ #include <morphnormal_vertex>
+ #include <skinbase_vertex>
+ #include <skinnormal_vertex>
+ #include <defaultnormal_vertex>
+
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+
+ #include <worldpos_vertex>
+ #include <envmap_vertex>
+ #include <lights_lambert_vertex>
+ #include <shadowmap_vertex>
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/meshphong_frag.glsl | @@ -0,0 +1,61 @@
+#define PHONG
+
+uniform vec3 diffuse;
+uniform vec3 emissive;
+uniform vec3 specular;
+uniform float shininess;
+uniform float opacity;
+
+#include <common>
+#include <color_pars_fragment>
+#include <uv_pars_fragment>
+#include <uv2_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <aomap_pars_fragment>
+#include <lightmap_pars_fragment>
+#include <emissivemap_pars_fragment>
+#include <envmap_pars_fragment>
+#include <fog_pars_fragment>
+#include <bsdfs>
+#include <ambient_pars>
+#include <lights_pars>
+#include <lights_phong_pars_fragment>
+#include <shadowmap_pars_fragment>
+#include <bumpmap_pars_fragment>
+#include <normalmap_pars_fragment>
+#include <specularmap_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+
+void main() {
+
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
+ vec3 totalEmissiveLight = emissive;
+
+ #include <logdepthbuf_fragment>
+ #include <map_fragment>
+ #include <color_fragment>
+ #include <alphamap_fragment>
+ #include <alphatest_fragment>
+ #include <specularmap_fragment>
+ #include <normal_fragment>
+ #include <emissivemap_fragment>
+
+ // accumulation
+ #include <lights_phong_fragment>
+ #include <lights_template>
+
+ // modulation
+ #include <aomap_fragment>
+
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;
+
+ #include <envmap_fragment>
+ #include <linear_to_gamma_fragment>
+
+ #include <fog_fragment>
+
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/meshphong_vert.glsl | @@ -0,0 +1,55 @@
+#define PHONG
+
+varying vec3 vViewPosition;
+
+#ifndef FLAT_SHADED
+
+ varying vec3 vNormal;
+
+#endif
+
+#include <common>
+#include <uv_pars_vertex>
+#include <uv2_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <envmap_pars_vertex>
+#include <lights_phong_pars_vertex>
+#include <color_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <shadowmap_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+
+void main() {
+
+ #include <uv_vertex>
+ #include <uv2_vertex>
+ #include <color_vertex>
+
+ #include <beginnormal_vertex>
+ #include <morphnormal_vertex>
+ #include <skinbase_vertex>
+ #include <skinnormal_vertex>
+ #include <defaultnormal_vertex>
+
+#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED
+
+ vNormal = normalize( transformedNormal );
+
+#endif
+
+ #include <begin_vertex>
+ #include <displacementmap_vertex>
+ #include <morphtarget_vertex>
+ #include <skinning_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+
+ vViewPosition = - mvPosition.xyz;
+
+ #include <worldpos_vertex>
+ #include <envmap_vertex>
+ #include <lights_phong_vertex>
+ #include <shadowmap_vertex>
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/normal_frag.glsl | @@ -0,0 +1,13 @@
+uniform float opacity;
+varying vec3 vNormal;
+
+#include <common>
+#include <logdepthbuf_pars_fragment>
+
+void main() {
+
+ gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );
+
+ #include <logdepthbuf_fragment>
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/normal_vert.glsl | @@ -0,0 +1,16 @@
+varying vec3 vNormal;
+
+#include <common>
+#include <morphtarget_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+
+void main() {
+
+ vNormal = normalize( normalMatrix * normal );
+
+ #include <begin_vertex>
+ #include <morphtarget_vertex>
+ #include <project_vertex>
+ #include <logdepthbuf_vertex>
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/points_frag.glsl | @@ -0,0 +1,27 @@
+uniform vec3 diffuse;
+uniform float opacity;
+
+#include <common>
+#include <color_pars_fragment>
+#include <map_particle_pars_fragment>
+#include <fog_pars_fragment>
+#include <shadowmap_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+
+void main() {
+
+ vec3 outgoingLight = vec3( 0.0 );
+ vec4 diffuseColor = vec4( diffuse, opacity );
+
+ #include <logdepthbuf_fragment>
+ #include <map_particle_fragment>
+ #include <color_fragment>
+ #include <alphatest_fragment>
+
+ outgoingLight = diffuseColor.rgb;
+
+ #include <fog_fragment>
+
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/shaders/ShaderLib/points_vert.glsl | @@ -0,0 +1,25 @@
+uniform float size;
+uniform float scale;
+
+#include <common>
+#include <color_pars_vertex>
+#include <shadowmap_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+
+void main() {
+
+ #include <color_vertex>
+ #include <begin_vertex>
+ #include <project_vertex>
+
+ #ifdef USE_SIZEATTENUATION
+ gl_PointSize = size * ( scale / - mvPosition.z );
+ #else
+ gl_PointSize = size;
+ #endif
+
+ #include <logdepthbuf_vertex>
+ #include <worldpos_vertex>
+ #include <shadowmap_vertex>
+
+} | true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | src/renderers/webgl/WebGLProgram.js | @@ -194,11 +194,10 @@ THREE.WebGLProgram = ( function () {
function parseIncludes( string ) {
- var pattern = /#include +<([\w\d.]+)>/g;
+ var pattern = /#include[ \t]+<([\w\d.]+)>/g;
function replace( match, include ) {
-
- return THREE.ShaderChunk[ include ];
+ return parseIncludes( THREE.ShaderChunk[ include ] );
}
| true |
Other | mrdoob | three.js | 8350e0e49b512b1e437a3b8877aad044fee311f9.json | use glsl files for material vert/frag sahders. | utils/build/includes/common.json | @@ -193,8 +193,30 @@
"src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl",
"src/renderers/shaders/UniformsUtils.js",
"src/renderers/shaders/UniformsLib.js",
- "src/renderers/shaders/ShaderLib/meshstandard_vert.glsl",
+ "src/renderers/shaders/ShaderLib/cube_frag.glsl",
+ "src/renderers/shaders/ShaderLib/cube_vert.glsl",
+ "src/renderers/shaders/ShaderLib/depth_frag.glsl",
+ "src/renderers/shaders/ShaderLib/depth_vert.glsl",
+ "src/renderers/shaders/ShaderLib/depthRGBA_frag.glsl",
+ "src/renderers/shaders/ShaderLib/depthRGBA_vert.glsl",
+ "src/renderers/shaders/ShaderLib/distanceRGBA_frag.glsl",
+ "src/renderers/shaders/ShaderLib/distanceRGBA_vert.glsl",
+ "src/renderers/shaders/ShaderLib/equirect_frag.glsl",
+ "src/renderers/shaders/ShaderLib/equirect_vert.glsl",
+ "src/renderers/shaders/ShaderLib/linedashed_frag.glsl",
+ "src/renderers/shaders/ShaderLib/linedashed_vert.glsl",
+ "src/renderers/shaders/ShaderLib/meshbasic_frag.glsl",
+ "src/renderers/shaders/ShaderLib/meshbasic_vert.glsl",
+ "src/renderers/shaders/ShaderLib/meshlambert_frag.glsl",
+ "src/renderers/shaders/ShaderLib/meshlambert_vert.glsl",
+ "src/renderers/shaders/ShaderLib/meshphong_frag.glsl",
+ "src/renderers/shaders/ShaderLib/meshphong_vert.glsl",
"src/renderers/shaders/ShaderLib/meshstandard_frag.glsl",
+ "src/renderers/shaders/ShaderLib/meshstandard_vert.glsl",
+ "src/renderers/shaders/ShaderLib/normal_frag.glsl",
+ "src/renderers/shaders/ShaderLib/normal_vert.glsl",
+ "src/renderers/shaders/ShaderLib/points_frag.glsl",
+ "src/renderers/shaders/ShaderLib/points_vert.glsl",
"src/renderers/shaders/ShaderLib.js",
"src/renderers/WebGLRenderer.js",
"src/renderers/WebGLRenderTarget.js", | true |
Other | mrdoob | three.js | 7fb2830beb15f6d52b81f37a512f7b4276b5f2f4.json | remove envMap encoding macro. | src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl | @@ -11,12 +11,6 @@
#endif
uniform float flipEnvMap;
- vec4 envMapTexelToLinear( vec4 value ) {
- #define MACRO_DECODE ENVMAP_ENCODING
- #include <encoding_template>
- #undef MACRO_DECODE
- }
-
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( STANDARD )
uniform float refractionRatio; | false |
Other | mrdoob | three.js | fbf78109160127c66a124e829b59ca702f73fecf.json | fix skin+morph and timeScale (#9156) | examples/js/loaders/sea3d/SEA3DLoader.js | @@ -569,7 +569,7 @@ THREE.SEA3D.Animator.prototype.getTimeScale = function() {
THREE.SEA3D.Animator.prototype.updateTimeScale = function() {
- this.currentAnimationAction.setEffectiveTimeScale( this.timeScale * ( this.currentAnimation ? this.currentAnimation.timeScale : 1 ) );
+ this.mixer.timeScale = this.timeScale * ( this.currentAnimation ? this.currentAnimation.timeScale : 1 );
};
@@ -580,7 +580,7 @@ THREE.SEA3D.Animator.prototype.play = function( name, crossfade, offset, weight
if ( animation == this.currentAnimation ) {
if ( offset !== undefined || ! animation.loop ) this.currentAnimationAction.time = offset !== undefined ? offset :
- ( this.currentAnimationAction.timeScale >= 0 ? 0 : this.currentAnimation.duration );
+ ( this.mixer.timeScale >= 0 ? 0 : this.currentAnimation.duration );
this.currentAnimationAction.setEffectiveWeight( weight !== undefined ? weight : 1 );
this.currentAnimationAction.paused = false;
@@ -605,7 +605,7 @@ THREE.SEA3D.Animator.prototype.play = function( name, crossfade, offset, weight
this.updateTimeScale();
if ( offset !== undefined || ! animation.loop ) this.currentAnimationAction.time = offset !== undefined ? offset :
- ( this.currentAnimationAction.timeScale >= 0 ? 0 : this.currentAnimation.duration );
+ ( this.mixer.timeScale >= 0 ? 0 : this.currentAnimation.duration );
this.currentAnimationAction.setEffectiveWeight( weight !== undefined ? weight : 1 );
@@ -928,9 +928,7 @@ THREE.SEA3D.SkinnedMesh = function( geometry, material, useVertexTexture ) {
THREE.SEA3D.SkinnedMesh.prototype = Object.create( THREE.SkinnedMesh.prototype );
THREE.SEA3D.SkinnedMesh.prototype.constructor = THREE.SEA3D.SkinnedMesh;
-Object.assign( THREE.SEA3D.SkinnedMesh.prototype, THREE.SEA3D.Object3D.prototype );
-
-Object.assign( THREE.SEA3D.SkinnedMesh.prototype, THREE.SEA3D.Animator.prototype );
+Object.assign( THREE.SEA3D.SkinnedMesh.prototype, THREE.SEA3D.Mesh.prototype, THREE.SEA3D.Animator.prototype );
THREE.SEA3D.SkinnedMesh.prototype.boneByName = function( name ) {
@@ -975,9 +973,7 @@ THREE.SEA3D.VertexAnimationMesh = function( geometry, material ) {
THREE.SEA3D.VertexAnimationMesh.prototype = Object.create( THREE.Mesh.prototype );
THREE.SEA3D.VertexAnimationMesh.prototype.constructor = THREE.SEA3D.VertexAnimationMesh;
-Object.assign( THREE.SEA3D.VertexAnimationMesh.prototype, THREE.SEA3D.Object3D.prototype );
-
-Object.assign( THREE.SEA3D.VertexAnimationMesh.prototype, THREE.SEA3D.Animator.prototype );
+Object.assign( THREE.SEA3D.VertexAnimationMesh.prototype, THREE.SEA3D.Mesh.prototype, THREE.SEA3D.Animator.prototype );
THREE.SEA3D.VertexAnimationMesh.prototype.copy = function( source ) {
| false |
Other | mrdoob | three.js | e62a212bcd32fa063bd6a03746ba9a3b7213a9a7.json | Fix Sky Shader on Android/S6 (#8382) (#8614)
* Fix Sky Shader on Android/S6 (#8382)
`exp(n)` does not return the correct value, so I replaced it with `pow(e, n)`.
* Editor: Include VRControls/VREffect when needed.
* Editor: Workaround for Storage not being ready in time.
* Editor: Fixed edit button.
* Added comment explaining change in shader function #8382, #8614 | examples/js/SkyShader.js | @@ -126,7 +126,10 @@ THREE.ShaderLib[ 'sky' ] = {
"float sunIntensity(float zenithAngleCos)",
"{",
- "return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));",
+ // This function originally used `exp(n)`, but it returns an incorrect value
+ // on Samsung S6 phones. So it has been replaced with the equivalent `pow(e, n)`.
+ // See https://github.com/mrdoob/three.js/issues/8382
+ "return EE * max(0.0, 1.0 - pow(e, -((cutoffAngle - acos(zenithAngleCos))/steepness)));",
"}",
"// float logLuminance(vec3 c)", | false |
Other | mrdoob | three.js | a889569d4fce1ce6a49d7b1f40502168f6f9139a.json | support texture coordinates in ply parser (#9121) | examples/js/loaders/PLYLoader.js | @@ -346,20 +346,41 @@ THREE.PLYLoader.prototype = {
} else if ( elementName === "face" ) {
var vertex_indices = element.vertex_indices;
+ var texcoord = element.texcoord;
if ( vertex_indices.length === 3 ) {
geometry.faces.push(
new THREE.Face3( vertex_indices[ 0 ], vertex_indices[ 1 ], vertex_indices[ 2 ] )
);
+ if ( texcoord ) {
+ geometry.faceVertexUvs[ 0 ].push( [
+ new THREE.Vector2( texcoord[ 0 ], texcoord[ 1 ]),
+ new THREE.Vector2( texcoord[ 2 ], texcoord[ 3 ]),
+ new THREE.Vector2( texcoord[ 4 ], texcoord[ 5 ])
+ ] );
+ }
+
} else if ( vertex_indices.length === 4 ) {
geometry.faces.push(
new THREE.Face3( vertex_indices[ 0 ], vertex_indices[ 1 ], vertex_indices[ 3 ] ),
new THREE.Face3( vertex_indices[ 1 ], vertex_indices[ 2 ], vertex_indices[ 3 ] )
);
+ if ( texcoord ) {
+ geometry.faceVertexUvs[ 0 ].push( [
+ new THREE.Vector2( texcoord[ 0 ], texcoord[ 1 ]),
+ new THREE.Vector2( texcoord[ 2 ], texcoord[ 3 ]),
+ new THREE.Vector2( texcoord[ 6 ], texcoord[ 7 ])
+ ], [
+ new THREE.Vector2( texcoord[ 2 ], texcoord[ 3 ]),
+ new THREE.Vector2( texcoord[ 4 ], texcoord[ 5 ]),
+ new THREE.Vector2( texcoord[ 6 ], texcoord[ 7 ])
+ ] );
+ }
+
}
} | false |
Other | mrdoob | three.js | 5059d33b6fd73d6af9840aec93b4bdf0104d9db9.json | add stencil properties to material | src/loaders/Loader.js | @@ -229,6 +229,8 @@ THREE.Loader.prototype = {
break;
case 'depthTest':
case 'depthWrite':
+ case 'stencilTest':
+ case 'stencilWrite':
case 'colorWrite':
case 'opacity':
case 'reflectivity': | true |
Other | mrdoob | three.js | 5059d33b6fd73d6af9840aec93b4bdf0104d9db9.json | add stencil properties to material | src/loaders/MaterialLoader.js | @@ -70,6 +70,8 @@ THREE.MaterialLoader.prototype = {
if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;
if ( json.depthTest !== undefined ) material.depthTest = json.depthTest;
if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
+ if ( json.stencilTest !== undefined ) material.stencilTest = json.stencilTest;
+ if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;
if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;
if ( json.wireframe !== undefined ) material.wireframe = json.wireframe;
if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth; | true |
Other | mrdoob | three.js | 5059d33b6fd73d6af9840aec93b4bdf0104d9db9.json | add stencil properties to material | src/materials/Material.js | @@ -30,6 +30,9 @@ THREE.Material = function () {
this.depthTest = true;
this.depthWrite = true;
+ this.stencilTest = false;
+ this.stencilWrite = false;
+
this.colorWrite = true;
this.precision = null; // override the renderer's default precision for this material
@@ -257,6 +260,9 @@ THREE.Material.prototype = {
this.depthTest = source.depthTest;
this.depthWrite = source.depthWrite;
+ this.stencilTest = source.stencilTest;
+ this.stencilWrite = source.stencilWrite;
+
this.colorWrite = source.colorWrite;
this.precision = source.precision; | true |
Other | mrdoob | three.js | 5059d33b6fd73d6af9840aec93b4bdf0104d9db9.json | add stencil properties to material | src/renderers/WebGLRenderer.js | @@ -1191,10 +1191,12 @@ THREE.WebGLRenderer = function ( parameters ) {
}
- // Ensure depth buffer writing is enabled so it can be cleared on next render
+ // Ensure buffer writing is enabled so they can be cleared on next render
state.setDepthTest( true );
state.setDepthWrite( true );
+ state.setStencilTest( true );
+ state.setStencilWrite( true );
state.setColorWrite( true );
// _gl.finish();
@@ -1557,6 +1559,8 @@ THREE.WebGLRenderer = function ( parameters ) {
state.setDepthFunc( material.depthFunc );
state.setDepthTest( material.depthTest );
state.setDepthWrite( material.depthWrite );
+ state.setStencilTest( material.stencilTest );
+ state.setStencilWrite( material.stencilWrite );
state.setColorWrite( material.colorWrite );
state.setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );
| true |
Other | mrdoob | three.js | 5059d33b6fd73d6af9840aec93b4bdf0104d9db9.json | add stencil properties to material | src/renderers/webgl/WebGLState.js | @@ -627,6 +627,7 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
currentBlending = null;
currentDepthWrite = null;
+ currentStencilWrite = null;
currentColorWrite = null;
currentFlipSided = null; | true |
Other | mrdoob | three.js | 40a7b6fbe489bd131b3955779afb5500f0aae01f.json | add colorWrite support to loaders | src/loaders/Loader.js | @@ -229,6 +229,7 @@ THREE.Loader.prototype = {
break;
case 'depthTest':
case 'depthWrite':
+ case 'colorWrite':
case 'opacity':
case 'reflectivity':
case 'transparent': | true |
Other | mrdoob | three.js | 40a7b6fbe489bd131b3955779afb5500f0aae01f.json | add colorWrite support to loaders | src/loaders/MaterialLoader.js | @@ -70,6 +70,7 @@ THREE.MaterialLoader.prototype = {
if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;
if ( json.depthTest !== undefined ) material.depthTest = json.depthTest;
if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
+ if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;
if ( json.wireframe !== undefined ) material.wireframe = json.wireframe;
if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;
| true |
Other | mrdoob | three.js | 4847d475f77e3435e9ca95c1ce2a122d6d6c5355.json | add colorWrite to material copy method | src/materials/Material.js | @@ -257,6 +257,8 @@ THREE.Material.prototype = {
this.depthTest = source.depthTest;
this.depthWrite = source.depthWrite;
+ this.colorWrite = source.colorWrite;
+
this.precision = source.precision;
this.polygonOffset = source.polygonOffset; | false |
Other | mrdoob | three.js | 501f2da27291d3244e184bc837953c03e18bf111.json | Optimize Outline rendering of MMD (#9472)
* Optimize Outline rendering of MMD
* Use Layers instead of visible for MMDHelper.renderOutline() optimization | examples/js/loaders/MMDLoader.js | @@ -4034,6 +4034,12 @@ THREE.MMDHelper.prototype = {
add: function ( mesh ) {
+ if ( ! ( mesh instanceof THREE.SkinnedMesh ) ) {
+
+ throw new Error( 'THREE.MMDHelper.add() accepts only THREE.SkinnedMesh instance.' );
+
+ }
+
mesh.mixer = null;
mesh.ikSolver = null;
mesh.grantSolver = null;
@@ -4378,17 +4384,78 @@ THREE.MMDHelper.prototype = {
},
- renderOutline: function ( scene, camera ) {
+ renderOutline: function () {
- var tmpEnabled = this.renderer.shadowMap.enabled;
- this.renderer.shadowMap.enabled = false;
+ var invisibledObjects = [];
+ var setInvisible;
+ var restoreVisible;
- this.setupOutlineRendering();
- this.callRender( scene, camera );
+ return function renderOutline( scene, camera ) {
- this.renderer.shadowMap.enabled = tmpEnabled;
+ var self = this;
- },
+ if ( setInvisible === undefined ) {
+
+ setInvisible = function ( object ) {
+
+ if ( ! object.visible || ! object.layers.test( camera.layers ) ) return;
+
+ // any types else to skip?
+ if ( object instanceof THREE.Scene ||
+ object instanceof THREE.Bone ||
+ object instanceof THREE.Light ||
+ object instanceof THREE.Camera ||
+ object instanceof THREE.Audio ||
+ object instanceof THREE.AudioListener ) return;
+
+ if ( object instanceof THREE.SkinnedMesh ) {
+
+ for ( var i = 0, il = self.meshes.length; i < il; i ++ ) {
+
+ if ( self.meshes[ i ] === object ) return;
+
+ }
+
+ }
+
+ object.layers.mask &= ~ camera.layers.mask;
+ invisibledObjects.push( object );
+
+ };
+
+ }
+
+ if ( restoreVisible === undefined ) {
+
+ restoreVisible = function () {
+
+ for ( var i = 0, il = invisibledObjects.length; i < il; i ++ ) {
+
+ invisibledObjects[ i ].layers.mask |= camera.layers.mask;
+
+ }
+
+ invisibledObjects.length = 0;
+
+ };
+
+ }
+
+ scene.traverse( setInvisible );
+
+ var tmpEnabled = this.renderer.shadowMap.enabled;
+ this.renderer.shadowMap.enabled = false;
+
+ this.setupOutlineRendering();
+ this.callRender( scene, camera );
+
+ this.renderer.shadowMap.enabled = tmpEnabled;
+
+ restoreVisible();
+
+ };
+
+ }(),
callRender: function ( scene, camera ) {
| false |
Other | mrdoob | three.js | 9889425cf33bf29796e9ffd1f80a1b8a7cc43304.json | Change Line for LineSegments in ObjLoader (#9533) | examples/js/loaders/OBJLoader.js | @@ -696,11 +696,11 @@ THREE.OBJLoader.prototype = {
}
var multiMaterial = new THREE.MultiMaterial( createdMaterials );
- mesh = ( ! isLine ? new THREE.Mesh( buffergeometry, multiMaterial ) : new THREE.Line( buffergeometry, multiMaterial ) );
+ mesh = ( ! isLine ? new THREE.Mesh( buffergeometry, multiMaterial ) : new THREE.LineSegments( buffergeometry, multiMaterial ) );
} else {
- mesh = ( ! isLine ? new THREE.Mesh( buffergeometry, createdMaterials[ 0 ] ) : new THREE.Line( buffergeometry, createdMaterials[ 0 ] ) );
+ mesh = ( ! isLine ? new THREE.Mesh( buffergeometry, createdMaterials[ 0 ] ) : new THREE.LineSegments( buffergeometry, createdMaterials[ 0 ] ) );
}
mesh.name = object.name; | false |
Other | mrdoob | three.js | 4f2f70ece3cbc2e4286a0cd57674513332a99137.json | reduce code bulk, still the darkening bug. | examples/js/postprocessing/MSAAPass.js | @@ -7,15 +7,6 @@ THREE.MSAAPass = function ( scene, camera, params, clearColor, clearAlpha ) {
this.scene = scene;
this.camera = camera;
- // any set of samples in equal area weighting pattern is fine (3 or +4 samples would also work as well)
- this.sampleOffsets = [];
- this.sampleOffsets[0] = null;
- this.sampleOffsets[1] = this.standardDirctX11_MSAA2();
- this.sampleOffsets[2] = this.standardDirctX11_MSAA4();
- this.sampleOffsets[3] = this.standardDirctX11_MSAA8();
- this.sampleOffsets[4] = this.standardDirctX11_MSAA16();
- this.sampleOffsets[5] = this.standardDirctX11_MSAA32();
-
this.currentSampleLevel = 4;
this.params = params || { minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat };
@@ -83,7 +74,7 @@ THREE.MSAAPass.prototype = {
var camera = ( this.camera || this.scene.camera );
- var currentSampleOffsets = this.sampleOffsets[ Math.max( 0, Math.min( this.currentSampleLevel, 5 ) ) ];
+ var currentSampleOffsets = THREE.MSAAPass.JitterVectors[ Math.max( 0, Math.min( this.currentSampleLevel, 5 ) ) ];
if( ! currentSampleOffsets ) {
@@ -144,138 +135,105 @@ THREE.MSAAPass.prototype = {
renderer.setClearColor( this.oldClearColor, this.oldClearAlpha );
- },
-
- // DirectX 11 standard MSAA sample pattern
- standardDirctX11_MSAA2: function() {
- var vectors = [
- new THREE.Vector3( 4, 4, 0 ),
- new THREE.Vector3( -4, -4, 0 )
- ];
- var xfrm = new THREE.Matrix4().makeScale( 1 / 16.0, 1/ 16.0, 0 );
- var vectors2 = [];
- for( var i = 0; i < vectors.length; i ++ ) {
- vectors2.push( vectors[i].clone().applyMatrix4( xfrm ) );
- }
- return vectors2;
- },
-
- // DirectX 11 standard MSAA sample pattern
- standardDirctX11_MSAA4: function() {
- var vectors = [
- new THREE.Vector3( -2, -6, 0 ),
- new THREE.Vector3( 6, -2, 0 ),
- new THREE.Vector3( -6, 2, 0 ),
- new THREE.Vector3( 2, 6, 0 )
- ];
- var xfrm = new THREE.Matrix4().makeScale( 1 / 16.0, 1/ 16.0, 0 );
- var vectors2 = [];
- for( var i = 0; i < vectors.length; i ++ ) {
- vectors2.push( vectors[i].clone().applyMatrix4( xfrm ) );
- }
- return vectors2;
- },
-
- // DirectX 11 standard MSAA sample pattern
- standardDirctX11_MSAA8: function() {
- var vectors = [
- new THREE.Vector3( 1, -3, 0 ),
- new THREE.Vector3( -1, 3, 0 ),
- new THREE.Vector3( 5, 1, 0 ),
- new THREE.Vector3( -3, -5, 0 ),
- new THREE.Vector3( -5, 5, 0 ),
- new THREE.Vector3( -7, -1, 0 ),
- new THREE.Vector3( 3, 7, 0 ),
- new THREE.Vector3( 7, -7, 0 ),
- ];
- var xfrm = new THREE.Matrix4().makeScale( 1 / 16.0, 1/ 16.0, 0 );
- var vectors2 = [];
- for( var i = 0; i < vectors.length; i ++ ) {
- vectors2.push( vectors[i].clone().applyMatrix4( xfrm ) );
- }
- return vectors2;
- },
+ }
+};
- // DirectX 11 standard MSAA sample pattern
- standardDirctX11_MSAA16: function() {
- var vectors = [
- new THREE.Vector3( 1, 1, 0 ),
- new THREE.Vector3( -1, -3, 0 ),
- new THREE.Vector3( -3, 2, 0 ),
- new THREE.Vector3( 4, -1, 0 ),
-
- new THREE.Vector3( -5, -2, 0 ),
- new THREE.Vector3( 2, 5, 0 ),
- new THREE.Vector3( 5, 3, 0 ),
- new THREE.Vector3( 3, -5, 0 ),
-
- new THREE.Vector3( -2, 6, 0 ),
- new THREE.Vector3( 0, -7, 0 ),
- new THREE.Vector3( -4, -6, 0 ),
- new THREE.Vector3( -6, 4, 0 ),
-
- new THREE.Vector3( -8, 0, 0 ),
- new THREE.Vector3( 7, -4, 0 ),
- new THREE.Vector3( 6, 7, 0 ),
- new THREE.Vector3( -7, -8, 0 ),
- ];
- var xfrm = new THREE.Matrix4().makeScale( 1 / 16.0, 1/ 16.0, 0 );
- var vectors2 = [];
- for( var i = 0; i < vectors.length; i ++ ) {
- vectors2.push( vectors[i].clone().applyMatrix4( xfrm ) );
- }
- return vectors2;
- },
+THREE.MSAAPass.normalizedJitterVectors = function() {
+ var xfrm = new THREE.Matrix4().makeScale( 1 / 16.0, 1/ 16.0, 0 );
- // based on this: http://images.anandtech.com/reviews/video/NVIDIA/GF100/CSAA.png
- standardDirctX11_MSAA32: function() {
- var vectors = [
- new THREE.Vector3( -4, -7, 0 ),
- new THREE.Vector3( -7, -5, 0 ),
- new THREE.Vector3( -3, -5, 0 ),
- new THREE.Vector3( -5, -4, 0 ),
-
- new THREE.Vector3( -1, -4, 0 ),
- new THREE.Vector3( -2, -2, 0 ),
- new THREE.Vector3( -6, -1, 0 ),
- new THREE.Vector3( -4, 0, 0 ),
-
- new THREE.Vector3( -7, 1, 0 ),
- new THREE.Vector3( -1, 2, 0 ),
- new THREE.Vector3( -6, 3, 0 ),
- new THREE.Vector3( -3, 3, 0 ),
-
- new THREE.Vector3( -7, 6, 0 ),
- new THREE.Vector3( -3, 6, 0 ),
- new THREE.Vector3( -5, 7, 0 ),
- new THREE.Vector3( -1, 7, 0 ),
-
- new THREE.Vector3( 5, -7, 0 ),
- new THREE.Vector3( 1, -6, 0 ),
- new THREE.Vector3( 6, -5, 0 ),
- new THREE.Vector3( 4, -4, 0 ),
-
- new THREE.Vector3( 2, -3, 0 ),
- new THREE.Vector3( 7, -2, 0 ),
- new THREE.Vector3( 1, -1, 0 ),
- new THREE.Vector3( 4, -1, 0 ),
-
- new THREE.Vector3( 2, 1, 0 ),
- new THREE.Vector3( 6, 2, 0 ),
- new THREE.Vector3( 0, 4, 0 ),
- new THREE.Vector3( 4, 4, 0 ),
-
- new THREE.Vector3( 2, 5, 0 ),
- new THREE.Vector3( 7, 5, 0 ),
- new THREE.Vector3( 5, 6, 0 ),
- new THREE.Vector3( 3, 7, 0 ),
- ];
- var xfrm = new THREE.Matrix4().makeScale( 1 / 16.0, 1/ 16.0, 0 );
+ return function( jitterVectors ) {
var vectors2 = [];
- for( var i = 0; i < vectors.length; i ++ ) {
- vectors2.push( vectors[i].clone().applyMatrix4( xfrm ) );
+ for( var i = 0; i < jitterVectors.length; i ++ ) {
+ vectors2.push( new THREE.Vector3( jitterVectors[i][0], jitterVectors[i][0] ).applyMatrix4( xfrm ) );
}
return vectors2;
}
-
-};
+}(),
+
+THREE.MSAAPass.JitterVectors = [
+ THREE.MSAAPass.normalizedJitterVectors( [
+ [ 0, 0 ]
+ ] ),
+ THREE.MSAAPass.normalizedJitterVectors( [
+ [ 4, 4 ],
+ [ -4, -4 ]
+ ] ),
+ THREE.MSAAPass.normalizedJitterVectors( [
+ [ -2, -6 ],
+ [ 6, -2 ],
+ [ -6, 2 ],
+ [ 2, 6 ]
+ ] ),
+ THREE.MSAAPass.normalizedJitterVectors( [
+ [ 1, -3 ],
+ [ -1, 3 ],
+ [ 5, 1 ],
+ [ -3, -5 ],
+ [ -5, 5 ],
+ [ -7, -1 ],
+ [ 3, 7 ],
+ [ 7, -7 ]
+ ] ),
+ THREE.MSAAPass.normalizedJitterVectors( [
+ [ 1, 1 ],
+ [ -1, -3 ],
+ [ -3, 2 ],
+ [ 4, -1 ],
+
+ [ -5, -2 ],
+ [ 2, 5 ],
+ [ 5, 3 ],
+ [ 3, -5 ],
+
+ [ -2, 6 ],
+ [ 0, -7 ],
+ [ -4, -6 ],
+ [ -6, 4 ],
+
+ [ -8, 0 ],
+ [ 7, -4 ],
+ [ 6, 7 ],
+ [ -7, -8 ]
+ ] ),
+ THREE.MSAAPass.normalizedJitterVectors( [
+ [ -4, -7 ],
+ [ -7, -5 ],
+ [ -3, -5 ],
+ [ -5, -4 ],
+
+ [ -1, -4 ],
+ [ -2, -2 ],
+ [ -6, -1 ],
+ [ -4, 0 ],
+
+ [ -7, 1 ],
+ [ -1, 2 ],
+ [ -6, 3 ],
+ [ -3, 3 ],
+
+ [ -7, 6 ],
+ [ -3, 6 ],
+ [ -5, 7 ],
+ [ -1, 7 ],
+
+ [ 5, -7 ],
+ [ 1, -6 ],
+ [ 6, -5 ],
+ [ 4, -4 ],
+
+ [ 2, -3 ],
+ [ 7, -2 ],
+ [ 1, -1 ],
+ [ 4, -1 ],
+
+ [ 2, 1 ],
+ [ 6, 2 ],
+ [ 0, 4 ],
+ [ 4, 4 ],
+
+ [ 2, 5 ],
+ [ 7, 5 ],
+ [ 5, 6 ],
+ [ 3, 7 ]
+ ] )
+]; | true |
Other | mrdoob | three.js | 4f2f70ece3cbc2e4286a0cd57674513332a99137.json | reduce code bulk, still the darkening bug. | examples/webgl_postprocessing_msaa.html | @@ -48,8 +48,6 @@
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
- //
-
camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 );
camera.position.z = 400;
@@ -66,10 +64,9 @@
// postprocessing
composer = new THREE.EffectComposer( renderer );
- //composer.addPass( new THREE.RenderPass( scene, camera ) );
var massPass = new THREE.MSAAPass( scene, camera, new THREE.Color( 1.0, 1.0, 1.0 ), 1.0 );
- massPass.currentSampleLevel = 1;
+ massPass.currentSampleLevel = 4;
composer.addPass( massPass );
var copyPass = new THREE.ShaderPass(THREE.CopyShader); | true |
Other | mrdoob | three.js | 1b5eeee7ec2b3ada3783ef3977cb8a5a50638809.json | add links to helpful websites. | src/renderers/shaders/ShaderChunk/encodings.glsl | @@ -1,3 +1,5 @@
+// For a discussion of what this is, please read this: http://lousodrome.net/blog/light/2013/05/26/gamma-correct-and-hdr-rendering-in-a-32-bits-buffer/
+
// These encodings should have the same integer values as THREE.Linear, THREE.sRGB, etc...
#define ENCODING_Linear 3000
#define ENCODING_sRGB 3001
@@ -23,7 +25,7 @@ vec4 texelDecode( in vec4 encodedTexel, in int encoding ) {
return vec4( encodedTexel.xyz * exp2( encodedTexel.w*256.0 - 128.0 ), 1.0 );
}
- // TODO
+ // TODO, see here http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html
//if( encoding == ENCODING_LogLuv ) {
//}
@@ -63,7 +65,7 @@ vec4 texelEncode( in vec4 linearRgba, in int encoding )
return vec4( linearRgba.rgb / exp2(fExp), (fExp + 128.0) / 255.0 );
}
- // TODO
+ // TODO, see here http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html
//if( encoding == ENCODING_LogLuv ) {
//}
| false |
Other | mrdoob | three.js | 86c290a276d22f6dc4ec03b0e5a8c13e2e36ae74.json | fix resize window | examples/webgl_postprocessing.html | @@ -97,6 +97,7 @@
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
+ composer.setSize( window.innerWidth, window.innerHeight );
}
| true |
Other | mrdoob | three.js | 86c290a276d22f6dc4ec03b0e5a8c13e2e36ae74.json | fix resize window | examples/webgl_postprocessing_glitch.html | @@ -120,6 +120,7 @@
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
+ composer.setSize( window.innerWidth, window.innerHeight );
} | true |
Other | mrdoob | three.js | cb908242866321e223ccd473d38657382a8e2909.json | add implicit declaration | examples/js/postprocessing/ShaderPass.js | @@ -2,20 +2,31 @@
* @author alteredq / http://alteredqualia.com/
*/
-THREE.ShaderPass = function ( shader, textureID ) {
+THREE.ShaderPass = function( shader, textureID ) {
this.textureID = ( textureID !== undefined ) ? textureID : "tDiffuse";
- this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
+ if ( shader instanceof THREE.ShaderMaterial ) {
- this.material = new THREE.ShaderMaterial( {
+ this.uniforms = shader.uniforms;
- defines: shader.defines || {},
- uniforms: this.uniforms,
- vertexShader: shader.vertexShader,
- fragmentShader: shader.fragmentShader
+ this.material = shader;
- } );
+ }
+ else if ( shader ) {
+
+ this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
+
+ this.material = new THREE.ShaderMaterial( {
+
+ defines: shader.defines || {},
+ uniforms: this.uniforms,
+ vertexShader: shader.vertexShader,
+ fragmentShader: shader.fragmentShader
+
+ } );
+
+ }
this.renderToScreen = false;
@@ -25,7 +36,7 @@ THREE.ShaderPass = function ( shader, textureID ) {
this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
- this.scene = new THREE.Scene();
+ this.scene = new THREE.Scene();
this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
this.scene.add( this.quad );
@@ -34,7 +45,7 @@ THREE.ShaderPass = function ( shader, textureID ) {
THREE.ShaderPass.prototype = {
- render: function ( renderer, writeBuffer, readBuffer, delta ) {
+ render: function( renderer, writeBuffer, readBuffer, delta ) {
if ( this.uniforms[ this.textureID ] ) {
| false |
Other | mrdoob | three.js | 42a9faa1242f5440c71c34570e6437c8c6d92028.json | add time scale | examples/js/materials/nodes/utils/TimeNode.js | @@ -7,6 +7,7 @@ THREE.TimeNode = function( value ) {
THREE.FloatNode.call( this, value );
this.requestUpdate = true;
+ this.scale = 1;
};
@@ -15,6 +16,6 @@ THREE.TimeNode.prototype.constructor = THREE.TimeNode;
THREE.TimeNode.prototype.updateAnimation = function( delta ) {
- this.number += delta;
+ this.number += delta * this.scale;
}; | false |
Other | mrdoob | three.js | 02ee56a8174ff65b777209cf3135123b05646441.json | fix caustic projection | examples/webgl_materials_nodes.html | @@ -1025,10 +1025,9 @@
var worldPos = new THREE.PositionNode( THREE.PositionNode.WORLD );
var worldPosTop = new THREE.SwitchNode( worldPos, 'xz' );
- var pos = new THREE.PositionNode( THREE.PositionNode.WORLD );
- var posNorm = new THREE.Math1Node( pos, THREE.Math1Node.NORMALIZE );
+ var worldNormal = new THREE.NormalNode( THREE.NormalNode.WORLD );
- var mask = new THREE.SwitchNode( posNorm, 'y' );
+ var mask = new THREE.SwitchNode( worldNormal, 'y' );
// clamp0at1
mask = new THREE.Math1Node( mask, THREE.Math1Node.SAT ); | false |
Other | mrdoob | three.js | 7b8aad6fded9cbb716b7225b024e26ab612f0251.json | allow redefine nodes dynamically | examples/js/materials/nodes/ConstNode.js | @@ -4,12 +4,28 @@
THREE.ConstNode = function( name, useDefine ) {
- name = name || THREE.ConstNode.PI;
+ THREE.TempNode.call( this );
- var rDeclaration = /^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=(.*?)\;/i;
- var type = 'fv1';
+ this.parse( name || THREE.ConstNode.PI, useDefine );
+
+};
+
+THREE.ConstNode.prototype = Object.create( THREE.TempNode.prototype );
+THREE.ConstNode.prototype.constructor = THREE.ConstNode;
+
+THREE.ConstNode.PI = 'PI';
+THREE.ConstNode.PI2 = 'PI2';
+THREE.ConstNode.RECIPROCAL_PI = 'RECIPROCAL_PI';
+THREE.ConstNode.RECIPROCAL_PI2 = 'RECIPROCAL_PI2';
+THREE.ConstNode.LOG2 = 'LOG2';
+THREE.ConstNode.EPSILON = 'EPSILON';
+
+THREE.ConstNode.prototype.parse = function( src, useDefine ) {
+
+ var name, type;
- var match = name.match( rDeclaration );
+ var rDeclaration = /^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=(.*?)\;/i;
+ var match = src.match( rDeclaration );
if ( match && match.length > 1 ) {
@@ -28,22 +44,17 @@ THREE.ConstNode = function( name, useDefine ) {
}
}
+ else {
- this.name = name;
-
- THREE.TempNode.call( this, type );
+ name = src;
+ type = 'fv1';
-};
+ }
-THREE.ConstNode.prototype = Object.create( THREE.TempNode.prototype );
-THREE.ConstNode.prototype.constructor = THREE.ConstNode;
+ this.name = name;
+ this.type = type;
-THREE.ConstNode.PI = 'PI';
-THREE.ConstNode.PI2 = 'PI2';
-THREE.ConstNode.RECIPROCAL_PI = 'RECIPROCAL_PI';
-THREE.ConstNode.RECIPROCAL_PI2 = 'RECIPROCAL_PI2';
-THREE.ConstNode.LOG2 = 'LOG2';
-THREE.ConstNode.EPSILON = 'EPSILON';
+};
THREE.ConstNode.prototype.generate = function( builder, output ) {
| true |
Other | mrdoob | three.js | 7b8aad6fded9cbb716b7225b024e26ab612f0251.json | allow redefine nodes dynamically | examples/js/materials/nodes/accessors/CameraNode.js | @@ -6,9 +6,34 @@ THREE.CameraNode = function( scope, camera ) {
THREE.TempNode.call( this, 'v3' );
- this.scope = scope || THREE.CameraNode.POSITION;
+ this.setScope( scope || THREE.CameraNode.POSITION );
this.camera = camera;
+ this.requestUpdate = this.camera !== undefined;
+
+};
+
+THREE.CameraNode.prototype = Object.create( THREE.TempNode.prototype );
+THREE.CameraNode.prototype.constructor = THREE.CameraNode;
+
+THREE.CameraNode.POSITION = 'position';
+THREE.CameraNode.DEPTH = 'depth';
+
+THREE.CameraNode.prototype.setScope = function( scope ) {
+
+ switch ( this.scope ) {
+
+ case THREE.CameraNode.DEPTH:
+
+ delete this.near;
+ delete this.far;
+
+ break;
+
+ }
+
+ this.scope = scope;
+
switch ( scope ) {
case THREE.CameraNode.DEPTH:
@@ -20,16 +45,8 @@ THREE.CameraNode = function( scope, camera ) {
}
- this.requestUpdate = this.camera !== undefined;
-
};
-THREE.CameraNode.prototype = Object.create( THREE.TempNode.prototype );
-THREE.CameraNode.prototype.constructor = THREE.CameraNode;
-
-THREE.CameraNode.POSITION = 'position';
-THREE.CameraNode.DEPTH = 'depth';
-
THREE.CameraNode.prototype.getType = function( builder ) {
switch ( this.scope ) { | true |
Other | mrdoob | three.js | a1f61d30070ea13ff7b4446765ad0f46b2069b9a.json | add comment for texture transparency detection | examples/js/loaders/MMDLoader.js | @@ -2200,6 +2200,7 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
if ( m.map !== null ) {
+ // Check if this part of the texture image the material uses requires transparency
function checkTextureTransparency ( m ) {
m.map.readyCallbacks.push( function ( t ) { | false |
Other | mrdoob | three.js | bbb6c648ee73c8d36f00d2838f82b5041f49ca4c.json | remove unused shareDepthFrom | docs/api/renderers/WebGLRenderTarget.html | @@ -88,11 +88,6 @@ <h3>[property:boolean generateMipmaps]</h3>
Whether to generate mipmaps (if possible) for a texture. True by default.
</div>
- <h3>[property:WebGLRenderTarget shareDepthFrom]</h3>
- <div>
- Shares the depth from another WebGLRenderTarget. Default is null.
- </div>
-
<h2>Methods</h2>
| true |
Other | mrdoob | three.js | bbb6c648ee73c8d36f00d2838f82b5041f49ca4c.json | remove unused shareDepthFrom | editor/js/libs/tern-threejs/threejs.js | @@ -5292,10 +5292,6 @@
"!type": "boolean",
"!doc": "Whether to generate mipmaps (if possible) for a texture. True by default."
},
- "shareDepthFrom": {
- "!type": "+THREE.WebGLRenderTarget",
- "!doc": "Shares the depth from another WebGLRenderTarget. Default is null."
- },
"setSize": {
"!type": "fn(width: number, height: number)",
"!doc": "Sets the size of the renderTarget." | true |
Other | mrdoob | three.js | bbb6c648ee73c8d36f00d2838f82b5041f49ca4c.json | remove unused shareDepthFrom | src/renderers/WebGLRenderTarget.js | @@ -70,8 +70,6 @@ THREE.WebGLRenderTarget.prototype = {
this.depthBuffer = source.depthBuffer;
this.stencilBuffer = source.stencilBuffer;
- this.shareDepthFrom = source.shareDepthFrom;
-
return this;
}, | true |
Other | mrdoob | three.js | 48566c27fe5365ced395499412f24a0e6ad8d110.json | add PMREM to materials_standard. | examples/webgl_materials_standard.html | @@ -51,6 +51,12 @@
<script src="js/controls/TrackballControls.js"></script>
<script src="js/loaders/OBJLoader.js"></script>
+ <script src="js/loaders/RGBELoader.js"></script>
+ <script src="js/loaders/HDRCubeTextureLoader.js"></script>
+ <script src="js/Half.js"></script>
+ <script src="js/Encodings.js"></script>
+ <script src="js/pmrem/PMREMGenerator.js"></script>
+ <script src="js/pmrem/PMREMCubeUVPacker.js"></script>
<script src="js/Detector.js"></script>
<script src="js/libs/stats.min.js"></script>
@@ -87,6 +93,21 @@
controls = new THREE.TrackballControls( camera );
+ //
+
+ renderer = new THREE.WebGLRenderer( { antialias: true } );
+ renderer.setClearColor( 0x202020 );
+ renderer.setPixelRatio( window.devicePixelRatio );
+ renderer.setSize( window.innerWidth, window.innerHeight );
+ container.appendChild( renderer.domElement );
+
+ renderer.autoClear = false;
+ renderer.gammaInput = true;
+ renderer.gammaOutput = true;
+ renderer.toneMapping = THREE.ReinhardToneMapping;
+ renderer.toneMappingExposure = 3;
+
+
scene = new THREE.Scene();
sceneCube = new THREE.Scene();
@@ -111,7 +132,7 @@
var shader = THREE.ShaderLib[ "cube" ];
shader.uniforms[ "tCube" ].value = textureCube;
- var material = new THREE.ShaderMaterial( {
+ var materialBG = new THREE.ShaderMaterial( {
fragmentShader: shader.fragmentShader,
vertexShader: shader.vertexShader,
@@ -121,18 +142,18 @@
} ),
- mesh = new THREE.Mesh( new THREE.BoxGeometry( 100, 100, 100 ), material );
+ mesh = new THREE.Mesh( new THREE.BoxGeometry( 100, 100, 100 ), materialBG );
sceneCube.add( mesh );
//
var path = 'models/obj/cerberus/';
var loader = new THREE.OBJLoader();
+ var material = new THREE.MeshStandardMaterial();
loader.load( path + 'Cerberus.obj', function ( group ) {
// var material = new THREE.MeshBasicMaterial( { wireframe: true } );
- var material = new THREE.MeshStandardMaterial();
var loader = new THREE.TextureLoader();
@@ -143,7 +164,6 @@
material.roughnessMap = loader.load( path + 'Cerberus_R.jpg' );
material.metalnessMap = loader.load( path + 'Cerberus_M.jpg' );
material.normalMap = loader.load( path + 'Cerberus_N.jpg' );
- material.envMap = textureCube;
material.map.wrapS = THREE.RepeatWrapping;
material.roughnessMap.wrapS = THREE.RepeatWrapping;
@@ -166,17 +186,28 @@
} );
- //
+ var genCubeUrls = function( prefix, postfix ) {
+ return [
+ prefix + 'px' + postfix, prefix + 'nx' + postfix,
+ prefix + 'py' + postfix, prefix + 'ny' + postfix,
+ prefix + 'pz' + postfix, prefix + 'nz' + postfix
+ ];
+ };
- renderer = new THREE.WebGLRenderer( { antialias: true } );
- renderer.setClearColor( 0x202020 );
- renderer.setPixelRatio( window.devicePixelRatio );
- renderer.setSize( window.innerWidth, window.innerHeight );
- container.appendChild( renderer.domElement );
+ var hdrUrls = genCubeUrls( "./textures/cube/pisaHDR/", ".hdr" );
+ new THREE.HDRCubeTextureLoader().load( THREE.UnsignedByteType, hdrUrls, function ( hdrCubeMap ) {
- renderer.autoClear = false;
- renderer.gammaInput = true;
- renderer.gammaOutput = true;
+ var pmremGenerator = new THREE.PMREMGenerator( hdrCubeMap );
+ pmremGenerator.update( renderer );
+
+ var pmremCubeUVPacker = new THREE.PMREMCubeUVPacker( pmremGenerator.cubeLods );
+ pmremCubeUVPacker.update( renderer );
+
+ hdrCubeRenderTarget = pmremCubeUVPacker.CubeUVRenderTarget;
+
+ material.envMap = hdrCubeRenderTarget;
+ material.needsUpdate = true;
+ } );
//
| false |
Other | mrdoob | three.js | 6af12202b1c42ed71ba5071db64d8fdcfa40e207.json | add max(... EPSILON) to new G_GGX_SmithCorrelated | src/renderers/shaders/ShaderChunk/bsdfs.glsl | @@ -75,7 +75,7 @@ float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const i
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
- return 0.5 / ( gv + gl );
+ return 0.5 / max( gv + gl, EPSILON );
}
| false |
Other | mrdoob | three.js | 2c1a73cee6883b8a99033a84ce6cb36dde630a6a.json | add comment based on WestLangley's suggestion. | src/renderers/shaders/ShaderChunk/bsdfs.glsl | @@ -71,6 +71,7 @@ float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const i
float a2 = pow2( alpha );
+ // dotNL and dotNV are explicitly swapped. This is not a mistake.
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
| false |
Other | mrdoob | three.js | de61a95cefa648f74bdc807b593149d4cb9bdde4.json | Reset texture state | src/renderers/webgl/WebGLState.js | @@ -668,6 +668,9 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
compressedTextureFormats = null;
+ currentTextureSlot = undefined;
+ currentBoundTextures = {};
+
currentBlending = null;
currentColorWrite = null; | false |
Other | mrdoob | three.js | b2e731425307118723462af04c3c09a5657f77ba.json | fix sRGB encoding, missing constant. | src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl | @@ -15,7 +15,7 @@ vec4 sRGBToLinear( in vec4 value ) {
return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );
}
vec4 LinearTosRGB( in vec4 value ) {
- return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );
+ return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );
}
vec4 RGBEToLinear( in vec4 value ) { | false |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/canvas_ascii_effect.html | @@ -116,8 +116,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/canvas_camera_orthographic.html | @@ -145,8 +145,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/canvas_camera_orthographic2.html | @@ -208,8 +208,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/canvas_geometry_birds.html | @@ -420,8 +420,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/canvas_geometry_cube.html | @@ -193,8 +193,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_animation_skinning_blending.html | @@ -235,6 +235,8 @@
requestAnimationFrame( animate, renderer.domElement );
+ stats.begin();
+
// step forward in time based on whether we're stepping and scale
var scale = gui.getTimeScale();
@@ -248,7 +250,7 @@
gui.update( blendMesh.mixer.time );
renderer.render( scene, camera );
- stats.update();
+ stats.end();
// if we are stepping, consume time
// ( will equal step size next time a single step is desired ) | true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_animation_skinning_morph.html | @@ -635,8 +635,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
if ( showMemInfo ) {
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_materials_displacementmap.html | @@ -284,9 +284,9 @@
controls.update();
+ stats.begin();
render();
-
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_materials_envmaps_hdr.html | @@ -257,8 +257,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_materials_texture_manualmipmap.html | @@ -240,8 +240,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_materials_transparency.html | @@ -214,8 +214,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_materials_variations_phong.html | @@ -215,8 +215,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_postprocessing_advanced.html | @@ -359,8 +359,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_postprocessing_dof.html | @@ -278,8 +278,9 @@
requestAnimationFrame( animate, renderer.domElement );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_postprocessing_godrays.html | @@ -255,8 +255,9 @@
requestAnimationFrame( animate, renderer.domElement );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_postprocessing_msaa.html | @@ -164,6 +164,8 @@
requestAnimationFrame( animate );
+ stats.begin();
+
for ( var i = 0; i < scene.children.length; i ++ ) {
var child = scene.children[ i ];
@@ -174,8 +176,7 @@
}
composer.render();
-
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_postprocessing_smaa.html | @@ -108,6 +108,8 @@
requestAnimationFrame( animate );
+ stats.begin();
+
for ( var i = 0; i < scene.children.length; i ++ ) {
var child = scene.children[ i ];
@@ -119,7 +121,7 @@
composer.render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_postprocessing_ssao.html | @@ -191,8 +191,9 @@
function animate() {
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
function render() { | true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_shading_physical.html | @@ -429,8 +429,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_shadowmap_performance.html | @@ -369,8 +369,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | dfd876dff214710fedd3ccc4147cf56cd13c9f32.json | finer grain timing. | examples/webgl_tonemapping.html | @@ -252,8 +252,9 @@
requestAnimationFrame( animate );
+ stats.begin();
render();
- stats.update();
+ stats.end();
}
| true |
Other | mrdoob | three.js | f053a9268ce175aeccdbb67d9fe0dbc4a864597a.json | add comments to PMREM generator and packer. | examples/js/pmrem/PMREMCubeUVPacker.js | @@ -1,6 +1,16 @@
/**
* @author Prashant Sharma / spidersharma03
* @author Ben Houston / bhouston, https://clara.io
+ *
+ * This class takes the cube lods(corresponding to different roughness values), and creates a single cubeUV
+ * Texture. The format for a given roughness set of faces is simply::
+ * +X+Y+Z
+ * -X-Y-Z
+ * For every roughness a mip map chain is also saved, which is essential to remove the texture artifacts due to
+ * minification.
+ * Right now for every face a PlaneMesh is drawn, which leads to a lot of geometry draw calls, but can be replaced
+ * later by drawing a single buffer and by sending the appropriate faceIndex via vertex attributes.
+ * The arrangement of the faces is fixed, as assuming this arrangement, the sampling function has been written.
*/
| true |
Other | mrdoob | three.js | f053a9268ce175aeccdbb67d9fe0dbc4a864597a.json | add comments to PMREM generator and packer. | examples/js/pmrem/PMREMGenerator.js | @@ -1,6 +1,14 @@
/**
* @author Prashant Sharma / spidersharma03
* @author Ben Houston / bhouston, https://clara.io
+ *
+ * To avoid cube map seams, I create an extra pixel around each face. This way when the cube map is
+ * sampled by an application later(with a little care by sampling the centre of the texel), the extra 1 border
+ * of pixels makes sure that there is no seams artifacts present. This works perfectly for cubeUV format as
+ * well where the 6 faces can be arranged in any manner whatsoever.
+ * Code in the beginning of fragment shader's main function does this job for a given resolution.
+ * Run Scene_PMREM_Test.html in the examples directory to see the sampling from the cube lods generated
+ * by this class.
*/
THREE.PMREMGenerator = function( sourceTexture ) {
@@ -37,6 +45,7 @@
var size = this.resolution;
var params = { format: this.sourceTexture.format, magFilter: this.sourceTexture.magFilter, minFilter: this.sourceTexture.minFilter, type: this.sourceTexture.type };
+ // how many LODs fit in the given CubeUV Texture.
this.numLods = Math.log2( size ) - 2;
for ( var i = 0; i < this.numLods; i ++ ) {
var renderTarget = new THREE.WebGLRenderTargetCube( size, size, params );
@@ -66,6 +75,19 @@ THREE.PMREMGenerator.prototype = {
constructor : THREE.PMREMGenerator,
+ /*
+ * Prashant Sharma / spidersharma03: More thought and work is needed here.
+ * Right now it's a kind of a hack to use the previously convolved map to convolve the current one.
+ * I tried to use the original map to convolve all the lods, but for many textures(specially the high frequency)
+ * even a high number of samples(1024) dosen't lead to satisfactory results.
+ * By using the previous convolved maps, a lower number of samples are generally sufficient(right now 32, which
+ * gives okay results unless we see the reflection very carefully, or zoom in too much), however the math
+ * goes wrong as the distribution function tries to sample a larger area than what it should be. So I simply scaled
+ * the roughness by 0.9(totally empirical) to try to visually match the original result.
+ * The condition "if(i <5)" is also an attemt to make the result match the original result.
+ * This method requires the most amount of thinking I guess. Here is a paper which we could try to implement in future::
+ * http://http.developer.nvidia.com/GPUGems3/gpugems3_ch20.html
+ */
update: function( renderer ) {
this.shader.uniforms[ "envMap" ].value = this.sourceTexture;
@@ -78,7 +100,7 @@ THREE.PMREMGenerator.prototype = {
for ( var i = 0; i < this.numLods; i ++ ) {
var r = i / ( this.numLods - 1 );
- this.shader.uniforms[ "roughness" ].value = r * 0.9;
+ this.shader.uniforms[ "roughness" ].value = r * 0.9; // see comment above, pragmatic choice
var size = this.cubeLods[ i ].width;
this.shader.uniforms[ "mapSize" ].value = size;
this.renderToCubeMapTarget( renderer, this.cubeLods[ i ] ); | true |
Other | mrdoob | three.js | 8d5203fd2f43235c23e0d059b802e207cce69fa8.json | prevent NaN values in .normalizeNormals | src/core/BufferGeometry.js | @@ -818,9 +818,13 @@ THREE.BufferGeometry.prototype = {
n = 1.0 / Math.sqrt( x * x + y * y + z * z );
- normals[ i ] *= n;
- normals[ i + 1 ] *= n;
- normals[ i + 2 ] *= n;
+ if( isFinite( n ) ) {
+
+ normals[ i ] *= n;
+ normals[ i + 1 ] *= n;
+ normals[ i + 2 ] *= n;
+
+ }
}
| false |
Other | mrdoob | three.js | b1c0f302710766d0ac7610891c6809e80cddbc24.json | adopt setFromMatrixColumn in orbit controls. | examples/js/controls/OrbitControls.js | @@ -295,11 +295,7 @@ THREE.OrbitControls = function ( object, domElement ) {
return function panLeft( distance, objectMatrix ) {
- var te = objectMatrix.elements;
-
- // get X column of objectMatrix
- v.set( te[ 0 ], te[ 1 ], te[ 2 ] );
-
+ v.setFromMatrixColumn( 0, objectMatrix ); // get X column of objectMatrix
v.multiplyScalar( - distance );
panOffset.add( v );
@@ -314,11 +310,7 @@ THREE.OrbitControls = function ( object, domElement ) {
return function panUp( distance, objectMatrix ) {
- var te = objectMatrix.elements;
-
- // get Y column of objectMatrix
- v.set( te[ 4 ], te[ 5 ], te[ 6 ] );
-
+ v.setFromMatrixColumn( 1, objectMatrix ); // get Y column of objectMatrix
v.multiplyScalar( distance );
panOffset.add( v ); | false |
Other | mrdoob | three.js | 89b3d0babe1ce013d2cec1b12f2f6e2ec890e96d.json | Normalize all line endings in an OBJ file (#9633)
`String.prototype.replace` only targets and replaces the first occurrence of a string. By using a regex with the global flag, all instances of a pattern are replaced. | examples/js/loaders/OBJLoader.js | @@ -412,7 +412,7 @@ THREE.OBJLoader.prototype = {
if ( text.indexOf( '\r\n' ) !== - 1 ) {
// This is faster than String.split with regex that splits on both
- text = text.replace( '\r\n', '\n' );
+ text = text.replace( /\r\n/g, '\n' );
}
| false |
Other | mrdoob | three.js | 10adc957a6c52fa6e49495d31f7fcddf0f25e9b9.json | Add rollup-watch to dev dependencies (#9404)
* Add rollup-watch to dev dependencies
* Remove chokidar-cli from devDependencies
- fixes #9598 | package.json | @@ -21,7 +21,7 @@
},
"scripts": {
"build": "rollup -c",
- "build-uglify": "rollup -c && uglifyjs build/three.js -cm --preamble \"\/\/ threejs.org\/license\" > build/three.min.js",
+ "build-uglify": "rollup -c && uglifyjs build/three.js -cm --preamble \"// threejs.org/license\" > build/three.min.js",
"build-closure": "rollup -c && java -jar utils/build/compiler/closure-compiler-v20160713.jar --warning_level=VERBOSE --jscomp_off=globalThis --jscomp_off=checkTypes --externs utils/build/externs.js --language_in=ECMASCRIPT5_STRICT --js build/three.js --js_output_file build/three.min.js",
"dev": "rollup -c -w",
"test": "echo \"Error: no test specified\" && exit 1"
@@ -44,9 +44,9 @@
"homepage": "http://threejs.org/",
"devDependencies": {
"argparse": "^1.0.3",
- "chokidar-cli": "1.2.0",
"jscs": "^1.13.1",
"rollup": "^0.34.8",
+ "rollup-watch": "^2.5.0",
"uglify-js": "^2.6.0"
}
} | false |
Other | mrdoob | three.js | e82196998409070d137fb978a5670661e53ac21b.json | Update Mesh.html (#9601)
morphTargetForcedOrder has removed in r80 version | docs/api/objects/Mesh.html | @@ -80,7 +80,6 @@ <h3>[method:Integer getMorphTargetIndexByName]( [page:String name] )</h3>
<h3>[method:null updateMorphTargets]()</h3>
<div>
Updates the morphtargets to have no influence on the object. Resets the
- [page:Mesh.morphTargetForcedOrder morphTargetForcedOrder],
[page:Mesh.morphTargetInfluences morphTargetInfluences],
[page:Mesh.morphTargetDictionary morphTargetDictionary], and
[page:Mesh.morphTargetBase morphTargetBase] properties. | false |
Other | mrdoob | three.js | 7714fe8f6dec8fd3ecfa0266c2c4a8ef0e9f61c7.json | Avoid implicit keyframe trimming. (#9595) | src/animation/AnimationClip.js | @@ -28,9 +28,6 @@ function AnimationClip( name, duration, tracks ) {
}
- // maybe only do these on demand, as doing them here could potentially slow down loading
- // but leaving these here during development as this ensures a lot of testing of these functions
- this.trim();
this.optimize();
} | false |
Other | mrdoob | three.js | aaaa526bc49351794e20da2940f48825d2f0c053.json | add standard define (#9596) | examples/js/nodes/materials/StandardNode.js | @@ -20,6 +20,7 @@ THREE.StandardNode.prototype.build = function( builder ) {
var material = builder.material;
var code;
+ material.define( 'STANDARD' );
material.define( 'PHYSICAL' );
material.define( 'ALPHATEST', '0.0' );
| false |
Other | mrdoob | three.js | 61bbbfa3d1165b17a40167f57c0ea9c9e4b36a70.json | Avoid accidental removal of last keyframe. (#9592)
Fixes #9056. | src/animation/KeyframeTrackPrototype.js | @@ -269,9 +269,12 @@ KeyframeTrackPrototype = {
values = this.values,
stride = this.getValueSize(),
- writeIndex = 1;
+ smoothInterpolation = this.getInterpolation() === InterpolateSmooth,
- for( var i = 1, n = times.length - 1; i <= n; ++ i ) {
+ writeIndex = 1,
+ lastIndex = times.length - 1;
+
+ for( var i = 1; i < lastIndex; ++ i ) {
var keep = false;
@@ -282,24 +285,29 @@ KeyframeTrackPrototype = {
if ( time !== timeNext && ( i !== 1 || time !== time[ 0 ] ) ) {
- // remove unnecessary keyframes same as their neighbors
- var offset = i * stride,
- offsetP = offset - stride,
- offsetN = offset + stride;
+ if ( ! smoothInterpolation ) {
+
+ // remove unnecessary keyframes same as their neighbors
- for ( var j = 0; j !== stride; ++ j ) {
+ var offset = i * stride,
+ offsetP = offset - stride,
+ offsetN = offset + stride;
- var value = values[ offset + j ];
+ for ( var j = 0; j !== stride; ++ j ) {
- if ( value !== values[ offsetP + j ] ||
- value !== values[ offsetN + j ] ) {
+ var value = values[ offset + j ];
- keep = true;
- break;
+ if ( value !== values[ offsetP + j ] ||
+ value !== values[ offsetN + j ] ) {
+
+ keep = true;
+ break;
+
+ }
}
- }
+ } else keep = true;
}
@@ -314,13 +322,10 @@ KeyframeTrackPrototype = {
var readOffset = i * stride,
writeOffset = writeIndex * stride;
- for ( var j = 0; j !== stride; ++ j ) {
+ for ( var j = 0; j !== stride; ++ j )
values[ writeOffset + j ] = values[ readOffset + j ];
- }
-
-
}
++ writeIndex;
@@ -329,6 +334,15 @@ KeyframeTrackPrototype = {
}
+ // flush last keyframe (compaction looks ahead)
+
+ times[ writeIndex ++ ] = times[ lastIndex ];
+
+ for ( var readOffset = lastIndex * stride, j = 0; j !== stride; ++ j )
+
+ values[ writeOffset + j ] = values[ readOffset + j ];
+
+
if ( writeIndex !== times.length ) {
this.times = AnimationUtils.arraySlice( times, 0, writeIndex );
@@ -342,4 +356,4 @@ KeyframeTrackPrototype = {
}
-export { KeyframeTrackPrototype };
\ No newline at end of file
+export { KeyframeTrackPrototype }; | false |
Other | mrdoob | three.js | 7e668e1cb853a528c2bb2559fba18d06c996de37.json | Add files via upload (#9588) | editor/js/Menubar.View.js | @@ -29,7 +29,7 @@ Menubar.View = function ( editor ) {
} else {
- alert( 'WebVR nor available' );
+ alert( 'WebVR not available' );
}
| false |
Other | mrdoob | three.js | 272607c803e635558fc02e42ca298473a415540f.json | Update dat.gui (#9639)
dat.gui had an issue where if you call .listen() on dropdown
controls they don't work in Chrome on OSX
You can see an example here
http://threejs.org/examples/webgl_postprocessing_ssao.html
On Chrome OSX try to change the renderMode
There are 2 fixes. One is to remove the call to `listen`.
The problem with this solution is that since things
work on say, Windows someone using dat.gui has no idea
their stuff doesn't work else where.
The other is to get a version of dat.gui that doesn't
have the issue as it was [recently fixed](https://github.com/dataarts/dat.gui/issues/101) | examples/js/libs/dat.gui.min.js | @@ -10,85 +10,5 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
-var dat=dat||{};dat.gui=dat.gui||{};dat.utils=dat.utils||{};dat.controllers=dat.controllers||{};dat.dom=dat.dom||{};dat.color=dat.color||{};dat.utils.css=function(){return{load:function(e,a){var a=a||document,c=a.createElement("link");c.type="text/css";c.rel="stylesheet";c.href=e;a.getElementsByTagName("head")[0].appendChild(c)},inject:function(e,a){var a=a||document,c=document.createElement("style");c.type="text/css";c.innerHTML=e;a.getElementsByTagName("head")[0].appendChild(c)}}}();
-dat.utils.common=function(){var e=Array.prototype.forEach,a=Array.prototype.slice;return{BREAK:{},extend:function(c){this.each(a.call(arguments,1),function(a){for(var f in a)this.isUndefined(a[f])||(c[f]=a[f])},this);return c},defaults:function(c){this.each(a.call(arguments,1),function(a){for(var f in a)this.isUndefined(c[f])&&(c[f]=a[f])},this);return c},compose:function(){var c=a.call(arguments);return function(){for(var d=a.call(arguments),f=c.length-1;f>=0;f--)d=[c[f].apply(this,d)];return d[0]}},
-each:function(a,d,f){if(e&&a.forEach===e)a.forEach(d,f);else if(a.length===a.length+0)for(var b=0,n=a.length;b<n;b++){if(b in a&&d.call(f,a[b],b)===this.BREAK)break}else for(b in a)if(d.call(f,a[b],b)===this.BREAK)break},defer:function(a){setTimeout(a,0)},toArray:function(c){return c.toArray?c.toArray():a.call(c)},isUndefined:function(a){return a===void 0},isNull:function(a){return a===null},isNaN:function(a){return a!==a},isArray:Array.isArray||function(a){return a.constructor===Array},isObject:function(a){return a===
-Object(a)},isNumber:function(a){return a===a+0},isString:function(a){return a===a+""},isBoolean:function(a){return a===false||a===true},isFunction:function(a){return Object.prototype.toString.call(a)==="[object Function]"}}}();
-dat.controllers.Controller=function(e){var a=function(a,d){this.initialValue=a[d];this.domElement=document.createElement("div");this.object=a;this.property=d;this.__onFinishChange=this.__onChange=void 0};e.extend(a.prototype,{onChange:function(a){this.__onChange=a;return this},onFinishChange:function(a){this.__onFinishChange=a;return this},setValue:function(a){this.object[this.property]=a;this.__onChange&&this.__onChange.call(this,a);this.updateDisplay();return this},getValue:function(){return this.object[this.property]},
-updateDisplay:function(){return this},isModified:function(){return this.initialValue!==this.getValue()}});return a}(dat.utils.common);
-dat.dom.dom=function(e){function a(b){if(b==="0"||e.isUndefined(b))return 0;b=b.match(d);return!e.isNull(b)?parseFloat(b[1]):0}var c={};e.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},function(b,a){e.each(b,function(b){c[b]=a})});var d=/(\d+(\.\d+)?)px/,f={makeSelectable:function(b,a){if(!(b===void 0||b.style===void 0))b.onselectstart=a?function(){return false}:function(){},b.style.MozUserSelect=a?"auto":"none",b.style.KhtmlUserSelect=
-a?"auto":"none",b.unselectable=a?"on":"off"},makeFullscreen:function(b,a,d){e.isUndefined(a)&&(a=true);e.isUndefined(d)&&(d=true);b.style.position="absolute";if(a)b.style.left=0,b.style.right=0;if(d)b.style.top=0,b.style.bottom=0},fakeEvent:function(b,a,d,f){var d=d||{},m=c[a];if(!m)throw Error("Event type "+a+" not supported.");var l=document.createEvent(m);switch(m){case "MouseEvents":l.initMouseEvent(a,d.bubbles||false,d.cancelable||true,window,d.clickCount||1,0,0,d.x||d.clientX||0,d.y||d.clientY||
-0,false,false,false,false,0,null);break;case "KeyboardEvents":m=l.initKeyboardEvent||l.initKeyEvent;e.defaults(d,{cancelable:true,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false,keyCode:void 0,charCode:void 0});m(a,d.bubbles||false,d.cancelable,window,d.ctrlKey,d.altKey,d.shiftKey,d.metaKey,d.keyCode,d.charCode);break;default:l.initEvent(a,d.bubbles||false,d.cancelable||true)}e.defaults(l,f);b.dispatchEvent(l)},bind:function(b,a,d,c){b.addEventListener?b.addEventListener(a,d,c||false):b.attachEvent&&
-b.attachEvent("on"+a,d);return f},unbind:function(b,a,d,c){b.removeEventListener?b.removeEventListener(a,d,c||false):b.detachEvent&&b.detachEvent("on"+a,d);return f},addClass:function(b,a){if(b.className===void 0)b.className=a;else if(b.className!==a){var d=b.className.split(/ +/);if(d.indexOf(a)==-1)d.push(a),b.className=d.join(" ").replace(/^\s+/,"").replace(/\s+$/,"")}return f},removeClass:function(b,a){if(a){if(b.className!==void 0)if(b.className===a)b.removeAttribute("class");else{var d=b.className.split(/ +/),
-c=d.indexOf(a);if(c!=-1)d.splice(c,1),b.className=d.join(" ")}}else b.className=void 0;return f},hasClass:function(a,d){return RegExp("(?:^|\\s+)"+d+"(?:\\s+|$)").test(a.className)||false},getWidth:function(b){b=getComputedStyle(b);return a(b["border-left-width"])+a(b["border-right-width"])+a(b["padding-left"])+a(b["padding-right"])+a(b.width)},getHeight:function(b){b=getComputedStyle(b);return a(b["border-top-width"])+a(b["border-bottom-width"])+a(b["padding-top"])+a(b["padding-bottom"])+a(b.height)},
-getOffset:function(a){var d={left:0,top:0};if(a.offsetParent){do d.left+=a.offsetLeft,d.top+=a.offsetTop;while(a=a.offsetParent)}return d},isActive:function(a){return a===document.activeElement&&(a.type||a.href)}};return f}(dat.utils.common);
-dat.controllers.OptionController=function(e,a,c){var d=function(f,b,e){d.superclass.call(this,f,b);var h=this;this.__select=document.createElement("select");if(c.isArray(e)){var j={};c.each(e,function(a){j[a]=a});e=j}c.each(e,function(a,b){var d=document.createElement("option");d.innerHTML=b;d.setAttribute("value",a);h.__select.appendChild(d)});this.updateDisplay();a.bind(this.__select,"change",function(){h.setValue(this.options[this.selectedIndex].value)});this.domElement.appendChild(this.__select)};
-d.superclass=e;c.extend(d.prototype,e.prototype,{setValue:function(a){a=d.superclass.prototype.setValue.call(this,a);this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue());return a},updateDisplay:function(){this.__select.value=this.getValue();return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common);
-dat.controllers.NumberController=function(e,a){var c=function(d,f,b){c.superclass.call(this,d,f);b=b||{};this.__min=b.min;this.__max=b.max;this.__step=b.step;d=this.__impliedStep=a.isUndefined(this.__step)?this.initialValue==0?1:Math.pow(10,Math.floor(Math.log(this.initialValue)/Math.LN10))/10:this.__step;d=d.toString();this.__precision=d.indexOf(".")>-1?d.length-d.indexOf(".")-1:0};c.superclass=e;a.extend(c.prototype,e.prototype,{setValue:function(a){if(this.__min!==void 0&&a<this.__min)a=this.__min;
-else if(this.__max!==void 0&&a>this.__max)a=this.__max;this.__step!==void 0&&a%this.__step!=0&&(a=Math.round(a/this.__step)*this.__step);return c.superclass.prototype.setValue.call(this,a)},min:function(a){this.__min=a;return this},max:function(a){this.__max=a;return this},step:function(a){this.__step=a;return this}});return c}(dat.controllers.Controller,dat.utils.common);
-dat.controllers.NumberControllerBox=function(e,a,c){var d=function(f,b,e){function h(){var a=parseFloat(l.__input.value);c.isNaN(a)||l.setValue(a)}function j(a){var b=o-a.clientY;l.setValue(l.getValue()+b*l.__impliedStep);o=a.clientY}function m(){a.unbind(window,"mousemove",j);a.unbind(window,"mouseup",m)}this.__truncationSuspended=false;d.superclass.call(this,f,b,e);var l=this,o;this.__input=document.createElement("input");this.__input.setAttribute("type","text");a.bind(this.__input,"change",h);
-a.bind(this.__input,"blur",function(){h();l.__onFinishChange&&l.__onFinishChange.call(l,l.getValue())});a.bind(this.__input,"mousedown",function(b){a.bind(window,"mousemove",j);a.bind(window,"mouseup",m);o=b.clientY});a.bind(this.__input,"keydown",function(a){if(a.keyCode===13)l.__truncationSuspended=true,this.blur(),l.__truncationSuspended=false});this.updateDisplay();this.domElement.appendChild(this.__input)};d.superclass=e;c.extend(d.prototype,e.prototype,{updateDisplay:function(){var a=this.__input,
-b;if(this.__truncationSuspended)b=this.getValue();else{b=this.getValue();var c=Math.pow(10,this.__precision);b=Math.round(b*c)/c}a.value=b;return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.NumberController,dat.dom.dom,dat.utils.common);
-dat.controllers.NumberControllerSlider=function(e,a,c,d,f){var b=function(d,c,f,e,l){function o(b){b.preventDefault();var d=a.getOffset(g.__background),c=a.getWidth(g.__background);g.setValue(g.__min+(g.__max-g.__min)*((b.clientX-d.left)/(d.left+c-d.left)));return false}function y(){a.unbind(window,"mousemove",o);a.unbind(window,"mouseup",y);g.__onFinishChange&&g.__onFinishChange.call(g,g.getValue())}b.superclass.call(this,d,c,{min:f,max:e,step:l});var g=this;this.__background=document.createElement("div");
-this.__foreground=document.createElement("div");a.bind(this.__background,"mousedown",function(b){a.bind(window,"mousemove",o);a.bind(window,"mouseup",y);o(b)});a.addClass(this.__background,"slider");a.addClass(this.__foreground,"slider-fg");this.updateDisplay();this.__background.appendChild(this.__foreground);this.domElement.appendChild(this.__background)};b.superclass=e;b.useDefaultStyles=function(){c.inject(f)};d.extend(b.prototype,e.prototype,{updateDisplay:function(){this.__foreground.style.width=
-(this.getValue()-this.__min)/(this.__max-this.__min)*100+"%";return b.superclass.prototype.updateDisplay.call(this)}});return b}(dat.controllers.NumberController,dat.dom.dom,dat.utils.css,dat.utils.common,".slider {\n box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);\n height: 1em;\n border-radius: 1em;\n background-color: #eee;\n padding: 0 0.5em;\n overflow: hidden;\n}\n\n.slider-fg {\n padding: 1px 0 2px 0;\n background-color: #aaa;\n height: 1em;\n margin-left: -0.5em;\n padding-right: 0.5em;\n border-radius: 1em 0 0 1em;\n}\n\n.slider-fg:after {\n display: inline-block;\n border-radius: 1em;\n background-color: #fff;\n border: 1px solid #aaa;\n content: '';\n float: right;\n margin-right: -1em;\n margin-top: -1px;\n height: 0.9em;\n width: 0.9em;\n}");
-dat.controllers.FunctionController=function(e,a,c){var d=function(c,b,e){d.superclass.call(this,c,b);var h=this;this.__button=document.createElement("div");this.__button.innerHTML=e===void 0?"Fire":e;a.bind(this.__button,"click",function(a){a.preventDefault();h.fire();return false});a.addClass(this.__button,"button");this.domElement.appendChild(this.__button)};d.superclass=e;c.extend(d.prototype,e.prototype,{fire:function(){this.__onChange&&this.__onChange.call(this);this.__onFinishChange&&this.__onFinishChange.call(this,
-this.getValue());this.getValue().call(this.object)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common);
-dat.controllers.BooleanController=function(e,a,c){var d=function(c,b){d.superclass.call(this,c,b);var e=this;this.__prev=this.getValue();this.__checkbox=document.createElement("input");this.__checkbox.setAttribute("type","checkbox");a.bind(this.__checkbox,"change",function(){e.setValue(!e.__prev)},false);this.domElement.appendChild(this.__checkbox);this.updateDisplay()};d.superclass=e;c.extend(d.prototype,e.prototype,{setValue:function(a){a=d.superclass.prototype.setValue.call(this,a);this.__onFinishChange&&
-this.__onFinishChange.call(this,this.getValue());this.__prev=this.getValue();return a},updateDisplay:function(){this.getValue()===true?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=true):this.__checkbox.checked=false;return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common);
-dat.color.toString=function(e){return function(a){if(a.a==1||e.isUndefined(a.a)){for(a=a.hex.toString(16);a.length<6;)a="0"+a;return"#"+a}else return"rgba("+Math.round(a.r)+","+Math.round(a.g)+","+Math.round(a.b)+","+a.a+")"}}(dat.utils.common);
-dat.color.interpret=function(e,a){var c,d,f=[{litmus:a.isString,conversions:{THREE_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return a===null?false:{space:"HEX",hex:parseInt("0x"+a[1].toString()+a[1].toString()+a[2].toString()+a[2].toString()+a[3].toString()+a[3].toString())}},write:e},SIX_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9]{6})$/i);return a===null?false:{space:"HEX",hex:parseInt("0x"+a[1].toString())}},write:e},CSS_RGB:{read:function(a){a=a.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);
-return a===null?false:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3])}},write:e},CSS_RGBA:{read:function(a){a=a.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/);return a===null?false:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3]),a:parseFloat(a[4])}},write:e}}},{litmus:a.isNumber,conversions:{HEX:{read:function(a){return{space:"HEX",hex:a,conversionName:"HEX"}},write:function(a){return a.hex}}}},{litmus:a.isArray,conversions:{RGB_ARRAY:{read:function(a){return a.length!=
-3?false:{space:"RGB",r:a[0],g:a[1],b:a[2]}},write:function(a){return[a.r,a.g,a.b]}},RGBA_ARRAY:{read:function(a){return a.length!=4?false:{space:"RGB",r:a[0],g:a[1],b:a[2],a:a[3]}},write:function(a){return[a.r,a.g,a.b,a.a]}}}},{litmus:a.isObject,conversions:{RGBA_OBJ:{read:function(b){return a.isNumber(b.r)&&a.isNumber(b.g)&&a.isNumber(b.b)&&a.isNumber(b.a)?{space:"RGB",r:b.r,g:b.g,b:b.b,a:b.a}:false},write:function(a){return{r:a.r,g:a.g,b:a.b,a:a.a}}},RGB_OBJ:{read:function(b){return a.isNumber(b.r)&&
-a.isNumber(b.g)&&a.isNumber(b.b)?{space:"RGB",r:b.r,g:b.g,b:b.b}:false},write:function(a){return{r:a.r,g:a.g,b:a.b}}},HSVA_OBJ:{read:function(b){return a.isNumber(b.h)&&a.isNumber(b.s)&&a.isNumber(b.v)&&a.isNumber(b.a)?{space:"HSV",h:b.h,s:b.s,v:b.v,a:b.a}:false},write:function(a){return{h:a.h,s:a.s,v:a.v,a:a.a}}},HSV_OBJ:{read:function(b){return a.isNumber(b.h)&&a.isNumber(b.s)&&a.isNumber(b.v)?{space:"HSV",h:b.h,s:b.s,v:b.v}:false},write:function(a){return{h:a.h,s:a.s,v:a.v}}}}}];return function(){d=
-false;var b=arguments.length>1?a.toArray(arguments):arguments[0];a.each(f,function(e){if(e.litmus(b))return a.each(e.conversions,function(e,f){c=e.read(b);if(d===false&&c!==false)return d=c,c.conversionName=f,c.conversion=e,a.BREAK}),a.BREAK});return d}}(dat.color.toString,dat.utils.common);
-dat.GUI=dat.gui.GUI=function(e,a,c,d,f,b,n,h,j,m,l,o,y,g,i){function q(a,b,r,c){if(b[r]===void 0)throw Error("Object "+b+' has no property "'+r+'"');c.color?b=new l(b,r):(b=[b,r].concat(c.factoryArgs),b=d.apply(a,b));if(c.before instanceof f)c.before=c.before.__li;t(a,b);g.addClass(b.domElement,"c");r=document.createElement("span");g.addClass(r,"property-name");r.innerHTML=b.property;var e=document.createElement("div");e.appendChild(r);e.appendChild(b.domElement);c=s(a,e,c.before);g.addClass(c,k.CLASS_CONTROLLER_ROW);
-g.addClass(c,typeof b.getValue());p(a,c,b);a.__controllers.push(b);return b}function s(a,b,d){var c=document.createElement("li");b&&c.appendChild(b);d?a.__ul.insertBefore(c,params.before):a.__ul.appendChild(c);a.onResize();return c}function p(a,d,c){c.__li=d;c.__gui=a;i.extend(c,{options:function(b){if(arguments.length>1)return c.remove(),q(a,c.object,c.property,{before:c.__li.nextElementSibling,factoryArgs:[i.toArray(arguments)]});if(i.isArray(b)||i.isObject(b))return c.remove(),q(a,c.object,c.property,
-{before:c.__li.nextElementSibling,factoryArgs:[b]})},name:function(a){c.__li.firstElementChild.firstElementChild.innerHTML=a;return c},listen:function(){c.__gui.listen(c);return c},remove:function(){c.__gui.remove(c);return c}});if(c instanceof j){var e=new h(c.object,c.property,{min:c.__min,max:c.__max,step:c.__step});i.each(["updateDisplay","onChange","onFinishChange"],function(a){var b=c[a],H=e[a];c[a]=e[a]=function(){var a=Array.prototype.slice.call(arguments);b.apply(c,a);return H.apply(e,a)}});
-g.addClass(d,"has-slider");c.domElement.insertBefore(e.domElement,c.domElement.firstElementChild)}else if(c instanceof h){var f=function(b){return i.isNumber(c.__min)&&i.isNumber(c.__max)?(c.remove(),q(a,c.object,c.property,{before:c.__li.nextElementSibling,factoryArgs:[c.__min,c.__max,c.__step]})):b};c.min=i.compose(f,c.min);c.max=i.compose(f,c.max)}else if(c instanceof b)g.bind(d,"click",function(){g.fakeEvent(c.__checkbox,"click")}),g.bind(c.__checkbox,"click",function(a){a.stopPropagation()});
-else if(c instanceof n)g.bind(d,"click",function(){g.fakeEvent(c.__button,"click")}),g.bind(d,"mouseover",function(){g.addClass(c.__button,"hover")}),g.bind(d,"mouseout",function(){g.removeClass(c.__button,"hover")});else if(c instanceof l)g.addClass(d,"color"),c.updateDisplay=i.compose(function(a){d.style.borderLeftColor=c.__color.toString();return a},c.updateDisplay),c.updateDisplay();c.setValue=i.compose(function(b){a.getRoot().__preset_select&&c.isModified()&&B(a.getRoot(),true);return b},c.setValue)}
-function t(a,b){var c=a.getRoot(),d=c.__rememberedObjects.indexOf(b.object);if(d!=-1){var e=c.__rememberedObjectIndecesToControllers[d];e===void 0&&(e={},c.__rememberedObjectIndecesToControllers[d]=e);e[b.property]=b;if(c.load&&c.load.remembered){c=c.load.remembered;if(c[a.preset])c=c[a.preset];else if(c[w])c=c[w];else return;if(c[d]&&c[d][b.property]!==void 0)d=c[d][b.property],b.initialValue=d,b.setValue(d)}}}function I(a){var b=a.__save_row=document.createElement("li");g.addClass(a.domElement,
-"has-save");a.__ul.insertBefore(b,a.__ul.firstChild);g.addClass(b,"save-row");var c=document.createElement("span");c.innerHTML=" ";g.addClass(c,"button gears");var d=document.createElement("span");d.innerHTML="Save";g.addClass(d,"button");g.addClass(d,"save");var e=document.createElement("span");e.innerHTML="New";g.addClass(e,"button");g.addClass(e,"save-as");var f=document.createElement("span");f.innerHTML="Revert";g.addClass(f,"button");g.addClass(f,"revert");var m=a.__preset_select=document.createElement("select");
-a.load&&a.load.remembered?i.each(a.load.remembered,function(b,c){C(a,c,c==a.preset)}):C(a,w,false);g.bind(m,"change",function(){for(var b=0;b<a.__preset_select.length;b++)a.__preset_select[b].innerHTML=a.__preset_select[b].value;a.preset=this.value});b.appendChild(m);b.appendChild(c);b.appendChild(d);b.appendChild(e);b.appendChild(f);if(u){var b=document.getElementById("dg-save-locally"),l=document.getElementById("dg-local-explain");b.style.display="block";b=document.getElementById("dg-local-storage");
-localStorage.getItem(document.location.href+".isLocal")==="true"&&b.setAttribute("checked","checked");var o=function(){l.style.display=a.useLocalStorage?"block":"none"};o();g.bind(b,"change",function(){a.useLocalStorage=!a.useLocalStorage;o()})}var h=document.getElementById("dg-new-constructor");g.bind(h,"keydown",function(a){a.metaKey&&(a.which===67||a.keyCode==67)&&x.hide()});g.bind(c,"click",function(){h.innerHTML=JSON.stringify(a.getSaveObject(),void 0,2);x.show();h.focus();h.select()});g.bind(d,
-"click",function(){a.save()});g.bind(e,"click",function(){var b=prompt("Enter a new preset name.");b&&a.saveAs(b)});g.bind(f,"click",function(){a.revert()})}function J(a){function b(f){f.preventDefault();e=f.clientX;g.addClass(a.__closeButton,k.CLASS_DRAG);g.bind(window,"mousemove",c);g.bind(window,"mouseup",d);return false}function c(b){b.preventDefault();a.width+=e-b.clientX;a.onResize();e=b.clientX;return false}function d(){g.removeClass(a.__closeButton,k.CLASS_DRAG);g.unbind(window,"mousemove",
-c);g.unbind(window,"mouseup",d)}a.__resize_handle=document.createElement("div");i.extend(a.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"});var e;g.bind(a.__resize_handle,"mousedown",b);g.bind(a.__closeButton,"mousedown",b);a.domElement.insertBefore(a.__resize_handle,a.domElement.firstElementChild)}function D(a,b){a.domElement.style.width=b+"px";if(a.__save_row&&a.autoPlace)a.__save_row.style.width=b+"px";if(a.__closeButton)a.__closeButton.style.width=
-b+"px"}function z(a,b){var c={};i.each(a.__rememberedObjects,function(d,e){var f={};i.each(a.__rememberedObjectIndecesToControllers[e],function(a,c){f[c]=b?a.initialValue:a.getValue()});c[e]=f});return c}function C(a,b,c){var d=document.createElement("option");d.innerHTML=b;d.value=b;a.__preset_select.appendChild(d);if(c)a.__preset_select.selectedIndex=a.__preset_select.length-1}function B(a,b){var c=a.__preset_select[a.__preset_select.selectedIndex];c.innerHTML=b?c.value+"*":c.value}function E(a){a.length!=
-0&&o(function(){E(a)});i.each(a,function(a){a.updateDisplay()})}e.inject(c);var w="Default",u;try{u="localStorage"in window&&window.localStorage!==null}catch(K){u=false}var x,F=true,v,A=false,G=[],k=function(a){function b(){localStorage.setItem(document.location.href+".gui",JSON.stringify(d.getSaveObject()))}function c(){var a=d.getRoot();a.width+=1;i.defer(function(){a.width-=1})}var d=this;this.domElement=document.createElement("div");this.__ul=document.createElement("ul");this.domElement.appendChild(this.__ul);
-g.addClass(this.domElement,"dg");this.__folders={};this.__controllers=[];this.__rememberedObjects=[];this.__rememberedObjectIndecesToControllers=[];this.__listening=[];a=a||{};a=i.defaults(a,{autoPlace:true,width:k.DEFAULT_WIDTH});a=i.defaults(a,{resizable:a.autoPlace,hideable:a.autoPlace});if(i.isUndefined(a.load))a.load={preset:w};else if(a.preset)a.load.preset=a.preset;i.isUndefined(a.parent)&&a.hideable&&G.push(this);a.resizable=i.isUndefined(a.parent)&&a.resizable;if(a.autoPlace&&i.isUndefined(a.scrollable))a.scrollable=
-true;var e=u&&localStorage.getItem(document.location.href+".isLocal")==="true";Object.defineProperties(this,{parent:{get:function(){return a.parent}},scrollable:{get:function(){return a.scrollable}},autoPlace:{get:function(){return a.autoPlace}},preset:{get:function(){return d.parent?d.getRoot().preset:a.load.preset},set:function(b){d.parent?d.getRoot().preset=b:a.load.preset=b;for(b=0;b<this.__preset_select.length;b++)if(this.__preset_select[b].value==this.preset)this.__preset_select.selectedIndex=
-b;d.revert()}},width:{get:function(){return a.width},set:function(b){a.width=b;D(d,b)}},name:{get:function(){return a.name},set:function(b){a.name=b;if(m)m.innerHTML=a.name}},closed:{get:function(){return a.closed},set:function(b){a.closed=b;a.closed?g.addClass(d.__ul,k.CLASS_CLOSED):g.removeClass(d.__ul,k.CLASS_CLOSED);this.onResize();if(d.__closeButton)d.__closeButton.innerHTML=b?k.TEXT_OPEN:k.TEXT_CLOSED}},load:{get:function(){return a.load}},useLocalStorage:{get:function(){return e},set:function(a){u&&
-((e=a)?g.bind(window,"unload",b):g.unbind(window,"unload",b),localStorage.setItem(document.location.href+".isLocal",a))}}});if(i.isUndefined(a.parent)){a.closed=false;g.addClass(this.domElement,k.CLASS_MAIN);g.makeSelectable(this.domElement,false);if(u&&e){d.useLocalStorage=true;var f=localStorage.getItem(document.location.href+".gui");if(f)a.load=JSON.parse(f)}this.__closeButton=document.createElement("div");this.__closeButton.innerHTML=k.TEXT_CLOSED;g.addClass(this.__closeButton,k.CLASS_CLOSE_BUTTON);
-this.domElement.appendChild(this.__closeButton);g.bind(this.__closeButton,"click",function(){d.closed=!d.closed})}else{if(a.closed===void 0)a.closed=true;var m=document.createTextNode(a.name);g.addClass(m,"controller-name");f=s(d,m);g.addClass(this.__ul,k.CLASS_CLOSED);g.addClass(f,"title");g.bind(f,"click",function(a){a.preventDefault();d.closed=!d.closed;return false});if(!a.closed)this.closed=false}a.autoPlace&&(i.isUndefined(a.parent)&&(F&&(v=document.createElement("div"),g.addClass(v,"dg"),g.addClass(v,
-k.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(v),F=false),v.appendChild(this.domElement),g.addClass(this.domElement,k.CLASS_AUTO_PLACE)),this.parent||D(d,a.width));g.bind(window,"resize",function(){d.onResize()});g.bind(this.__ul,"webkitTransitionEnd",function(){d.onResize()});g.bind(this.__ul,"transitionend",function(){d.onResize()});g.bind(this.__ul,"oTransitionEnd",function(){d.onResize()});this.onResize();a.resizable&&J(this);d.getRoot();a.parent||c()};k.toggleHide=function(){A=!A;i.each(G,
-function(a){a.domElement.style.zIndex=A?-999:999;a.domElement.style.opacity=A?0:1})};k.CLASS_AUTO_PLACE="a";k.CLASS_AUTO_PLACE_CONTAINER="ac";k.CLASS_MAIN="main";k.CLASS_CONTROLLER_ROW="cr";k.CLASS_TOO_TALL="taller-than-window";k.CLASS_CLOSED="closed";k.CLASS_CLOSE_BUTTON="close-button";k.CLASS_DRAG="drag";k.DEFAULT_WIDTH=245;k.TEXT_CLOSED="Close Controls";k.TEXT_OPEN="Open Controls";g.bind(window,"keydown",function(a){document.activeElement.type!=="text"&&(a.which===72||a.keyCode==72)&&k.toggleHide()},
-false);i.extend(k.prototype,{add:function(a,b){return q(this,a,b,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(a,b){return q(this,a,b,{color:true})},remove:function(a){this.__ul.removeChild(a.__li);this.__controllers.slice(this.__controllers.indexOf(a),1);var b=this;i.defer(function(){b.onResize()})},destroy:function(){this.autoPlace&&v.removeChild(this.domElement)},addFolder:function(a){if(this.__folders[a]!==void 0)throw Error('You already have a folder in this GUI by the name "'+
-a+'"');var b={name:a,parent:this};b.autoPlace=this.autoPlace;if(this.load&&this.load.folders&&this.load.folders[a])b.closed=this.load.folders[a].closed,b.load=this.load.folders[a];b=new k(b);this.__folders[a]=b;a=s(this,b.domElement);g.addClass(a,"folder");return b},open:function(){this.closed=false},close:function(){this.closed=true},onResize:function(){var a=this.getRoot();if(a.scrollable){var b=g.getOffset(a.__ul).top,c=0;i.each(a.__ul.childNodes,function(b){a.autoPlace&&b===a.__save_row||(c+=
-g.getHeight(b))});window.innerHeight-b-20<c?(g.addClass(a.domElement,k.CLASS_TOO_TALL),a.__ul.style.height=window.innerHeight-b-20+"px"):(g.removeClass(a.domElement,k.CLASS_TOO_TALL),a.__ul.style.height="auto")}a.__resize_handle&&i.defer(function(){a.__resize_handle.style.height=a.__ul.offsetHeight+"px"});if(a.__closeButton)a.__closeButton.style.width=a.width+"px"},remember:function(){if(i.isUndefined(x))x=new y,x.domElement.innerHTML=a;if(this.parent)throw Error("You can only call remember on a top level GUI.");
-var b=this;i.each(Array.prototype.slice.call(arguments),function(a){b.__rememberedObjects.length==0&&I(b);b.__rememberedObjects.indexOf(a)==-1&&b.__rememberedObjects.push(a)});this.autoPlace&&D(this,this.width)},getRoot:function(){for(var a=this;a.parent;)a=a.parent;return a},getSaveObject:function(){var a=this.load;a.closed=this.closed;if(this.__rememberedObjects.length>0){a.preset=this.preset;if(!a.remembered)a.remembered={};a.remembered[this.preset]=z(this)}a.folders={};i.each(this.__folders,function(b,
-c){a.folders[c]=b.getSaveObject()});return a},save:function(){if(!this.load.remembered)this.load.remembered={};this.load.remembered[this.preset]=z(this);B(this,false)},saveAs:function(a){if(!this.load.remembered)this.load.remembered={},this.load.remembered[w]=z(this,true);this.load.remembered[a]=z(this);this.preset=a;C(this,a,true)},revert:function(a){i.each(this.__controllers,function(b){this.getRoot().load.remembered?t(a||this.getRoot(),b):b.setValue(b.initialValue)},this);i.each(this.__folders,
-function(a){a.revert(a)});a||B(this.getRoot(),false)},listen:function(a){var b=this.__listening.length==0;this.__listening.push(a);b&&E(this.__listening)}});return k}(dat.utils.css,'<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n \n </div>\n \n </div>\n\n</div>',
-".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear;border:0;position:absolute;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-x:hidden}.dg.a.has-save ul{margin-top:27px}.dg.a.has-save ul.closed{margin-top:0}.dg.a .save-row{position:fixed;top:0;z-index:1002}.dg li{-webkit-transition:height 0.1s ease-out;-o-transition:height 0.1s ease-out;-moz-transition:height 0.1s ease-out;transition:height 0.1s ease-out}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;overflow:hidden;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li > *{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:9px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2fa1d6}.dg .cr.number input[type=text]{color:#2fa1d6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2fa1d6}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n",
-dat.controllers.factory=function(e,a,c,d,f,b,n){return function(h,j,m,l){var o=h[j];if(n.isArray(m)||n.isObject(m))return new e(h,j,m);if(n.isNumber(o))return n.isNumber(m)&&n.isNumber(l)?new c(h,j,m,l):new a(h,j,{min:m,max:l});if(n.isString(o))return new d(h,j);if(n.isFunction(o))return new f(h,j,"");if(n.isBoolean(o))return new b(h,j)}}(dat.controllers.OptionController,dat.controllers.NumberControllerBox,dat.controllers.NumberControllerSlider,dat.controllers.StringController=function(e,a,c){var d=
-function(c,b){function e(){h.setValue(h.__input.value)}d.superclass.call(this,c,b);var h=this;this.__input=document.createElement("input");this.__input.setAttribute("type","text");a.bind(this.__input,"keyup",e);a.bind(this.__input,"change",e);a.bind(this.__input,"blur",function(){h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())});a.bind(this.__input,"keydown",function(a){a.keyCode===13&&this.blur()});this.updateDisplay();this.domElement.appendChild(this.__input)};d.superclass=e;c.extend(d.prototype,
-e.prototype,{updateDisplay:function(){if(!a.isActive(this.__input))this.__input.value=this.getValue();return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common),dat.controllers.FunctionController,dat.controllers.BooleanController,dat.utils.common),dat.controllers.Controller,dat.controllers.BooleanController,dat.controllers.FunctionController,dat.controllers.NumberControllerBox,dat.controllers.NumberControllerSlider,dat.controllers.OptionController,
-dat.controllers.ColorController=function(e,a,c,d,f){function b(a,b,c,d){a.style.background="";f.each(j,function(e){a.style.cssText+="background: "+e+"linear-gradient("+b+", "+c+" 0%, "+d+" 100%); "})}function n(a){a.style.background="";a.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);";a.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
-a.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";a.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";a.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var h=function(e,l){function o(b){q(b);a.bind(window,"mousemove",q);a.bind(window,
-"mouseup",j)}function j(){a.unbind(window,"mousemove",q);a.unbind(window,"mouseup",j)}function g(){var a=d(this.value);a!==false?(p.__color.__state=a,p.setValue(p.__color.toOriginal())):this.value=p.__color.toString()}function i(){a.unbind(window,"mousemove",s);a.unbind(window,"mouseup",i)}function q(b){b.preventDefault();var c=a.getWidth(p.__saturation_field),d=a.getOffset(p.__saturation_field),e=(b.clientX-d.left+document.body.scrollLeft)/c,b=1-(b.clientY-d.top+document.body.scrollTop)/c;b>1?b=
-1:b<0&&(b=0);e>1?e=1:e<0&&(e=0);p.__color.v=b;p.__color.s=e;p.setValue(p.__color.toOriginal());return false}function s(b){b.preventDefault();var c=a.getHeight(p.__hue_field),d=a.getOffset(p.__hue_field),b=1-(b.clientY-d.top+document.body.scrollTop)/c;b>1?b=1:b<0&&(b=0);p.__color.h=b*360;p.setValue(p.__color.toOriginal());return false}h.superclass.call(this,e,l);this.__color=new c(this.getValue());this.__temp=new c(0);var p=this;this.domElement=document.createElement("div");a.makeSelectable(this.domElement,
-false);this.__selector=document.createElement("div");this.__selector.className="selector";this.__saturation_field=document.createElement("div");this.__saturation_field.className="saturation-field";this.__field_knob=document.createElement("div");this.__field_knob.className="field-knob";this.__field_knob_border="2px solid ";this.__hue_knob=document.createElement("div");this.__hue_knob.className="hue-knob";this.__hue_field=document.createElement("div");this.__hue_field.className="hue-field";this.__input=
-document.createElement("input");this.__input.type="text";this.__input_textShadow="0 1px 1px ";a.bind(this.__input,"keydown",function(a){a.keyCode===13&&g.call(this)});a.bind(this.__input,"blur",g);a.bind(this.__selector,"mousedown",function(){a.addClass(this,"drag").bind(window,"mouseup",function(){a.removeClass(p.__selector,"drag")})});var t=document.createElement("div");f.extend(this.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"});
-f.extend(this.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:this.__field_knob_border+(this.__color.v<0.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1});f.extend(this.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1});f.extend(this.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"});f.extend(t.style,
-{width:"100%",height:"100%",background:"none"});b(t,"top","rgba(0,0,0,0)","#000");f.extend(this.__hue_field.style,{width:"15px",height:"100px",display:"inline-block",border:"1px solid #555",cursor:"ns-resize"});n(this.__hue_field);f.extend(this.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:this.__input_textShadow+"rgba(0,0,0,0.7)"});a.bind(this.__saturation_field,"mousedown",o);a.bind(this.__field_knob,"mousedown",o);a.bind(this.__hue_field,"mousedown",
-function(b){s(b);a.bind(window,"mousemove",s);a.bind(window,"mouseup",i)});this.__saturation_field.appendChild(t);this.__selector.appendChild(this.__field_knob);this.__selector.appendChild(this.__saturation_field);this.__selector.appendChild(this.__hue_field);this.__hue_field.appendChild(this.__hue_knob);this.domElement.appendChild(this.__input);this.domElement.appendChild(this.__selector);this.updateDisplay()};h.superclass=e;f.extend(h.prototype,e.prototype,{updateDisplay:function(){var a=d(this.getValue());
-if(a!==false){var e=false;f.each(c.COMPONENTS,function(b){if(!f.isUndefined(a[b])&&!f.isUndefined(this.__color.__state[b])&&a[b]!==this.__color.__state[b])return e=true,{}},this);e&&f.extend(this.__color.__state,a)}f.extend(this.__temp.__state,this.__color.__state);this.__temp.a=1;var h=this.__color.v<0.5||this.__color.s>0.5?255:0,j=255-h;f.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toString(),border:this.__field_knob_border+
-"rgb("+h+","+h+","+h+")"});this.__hue_knob.style.marginTop=(1-this.__color.h/360)*100+"px";this.__temp.s=1;this.__temp.v=1;b(this.__saturation_field,"left","#fff",this.__temp.toString());f.extend(this.__input.style,{backgroundColor:this.__input.value=this.__color.toString(),color:"rgb("+h+","+h+","+h+")",textShadow:this.__input_textShadow+"rgba("+j+","+j+","+j+",.7)"})}});var j=["-moz-","-o-","-webkit-","-ms-",""];return h}(dat.controllers.Controller,dat.dom.dom,dat.color.Color=function(e,a,c,d){function f(a,
-b,c){Object.defineProperty(a,b,{get:function(){if(this.__state.space==="RGB")return this.__state[b];n(this,b,c);return this.__state[b]},set:function(a){if(this.__state.space!=="RGB")n(this,b,c),this.__state.space="RGB";this.__state[b]=a}})}function b(a,b){Object.defineProperty(a,b,{get:function(){if(this.__state.space==="HSV")return this.__state[b];h(this);return this.__state[b]},set:function(a){if(this.__state.space!=="HSV")h(this),this.__state.space="HSV";this.__state[b]=a}})}function n(b,c,e){if(b.__state.space===
-"HEX")b.__state[c]=a.component_from_hex(b.__state.hex,e);else if(b.__state.space==="HSV")d.extend(b.__state,a.hsv_to_rgb(b.__state.h,b.__state.s,b.__state.v));else throw"Corrupted color state";}function h(b){var c=a.rgb_to_hsv(b.r,b.g,b.b);d.extend(b.__state,{s:c.s,v:c.v});if(d.isNaN(c.h)){if(d.isUndefined(b.__state.h))b.__state.h=0}else b.__state.h=c.h}var j=function(){this.__state=e.apply(this,arguments);if(this.__state===false)throw"Failed to interpret color arguments";this.__state.a=this.__state.a||
-1};j.COMPONENTS="r,g,b,h,s,v,hex,a".split(",");d.extend(j.prototype,{toString:function(){return c(this)},toOriginal:function(){return this.__state.conversion.write(this)}});f(j.prototype,"r",2);f(j.prototype,"g",1);f(j.prototype,"b",0);b(j.prototype,"h");b(j.prototype,"s");b(j.prototype,"v");Object.defineProperty(j.prototype,"a",{get:function(){return this.__state.a},set:function(a){this.__state.a=a}});Object.defineProperty(j.prototype,"hex",{get:function(){if(!this.__state.space!=="HEX")this.__state.hex=
-a.rgb_to_hex(this.r,this.g,this.b);return this.__state.hex},set:function(a){this.__state.space="HEX";this.__state.hex=a}});return j}(dat.color.interpret,dat.color.math=function(){var e;return{hsv_to_rgb:function(a,c,d){var e=a/60-Math.floor(a/60),b=d*(1-c),n=d*(1-e*c),c=d*(1-(1-e)*c),a=[[d,c,b],[n,d,b],[b,d,c],[b,n,d],[c,b,d],[d,b,n]][Math.floor(a/60)%6];return{r:a[0]*255,g:a[1]*255,b:a[2]*255}},rgb_to_hsv:function(a,c,d){var e=Math.min(a,c,d),b=Math.max(a,c,d),e=b-e;if(b==0)return{h:NaN,s:0,v:0};
-a=a==b?(c-d)/e:c==b?2+(d-a)/e:4+(a-c)/e;a/=6;a<0&&(a+=1);return{h:a*360,s:e/b,v:b/255}},rgb_to_hex:function(a,c,d){a=this.hex_with_component(0,2,a);a=this.hex_with_component(a,1,c);return a=this.hex_with_component(a,0,d)},component_from_hex:function(a,c){return a>>c*8&255},hex_with_component:function(a,c,d){return d<<(e=c*8)|a&~(255<<e)}}}(),dat.color.toString,dat.utils.common),dat.color.interpret,dat.utils.common),dat.utils.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||
-window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1E3/60)}}(),dat.dom.CenteredDiv=function(e,a){var c=function(){this.backgroundElement=document.createElement("div");a.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear"});e.makeFullscreen(this.backgroundElement);this.backgroundElement.style.position="fixed";this.domElement=
-document.createElement("div");a.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear"});document.body.appendChild(this.backgroundElement);document.body.appendChild(this.domElement);var c=this;e.bind(this.backgroundElement,"click",function(){c.hide()})};c.prototype.show=function(){var c=this;this.backgroundElement.style.display="block";this.domElement.style.display="block";this.domElement.style.opacity=
-0;this.domElement.style.webkitTransform="scale(1.1)";this.layout();a.defer(function(){c.backgroundElement.style.opacity=1;c.domElement.style.opacity=1;c.domElement.style.webkitTransform="scale(1)"})};c.prototype.hide=function(){var a=this,c=function(){a.domElement.style.display="none";a.backgroundElement.style.display="none";e.unbind(a.domElement,"webkitTransitionEnd",c);e.unbind(a.domElement,"transitionend",c);e.unbind(a.domElement,"oTransitionEnd",c)};e.bind(this.domElement,"webkitTransitionEnd",
-c);e.bind(this.domElement,"transitionend",c);e.bind(this.domElement,"oTransitionEnd",c);this.backgroundElement.style.opacity=0;this.domElement.style.opacity=0;this.domElement.style.webkitTransform="scale(1.1)"};c.prototype.layout=function(){this.domElement.style.left=window.innerWidth/2-e.getWidth(this.domElement)/2+"px";this.domElement.style.top=window.innerHeight/2-e.getHeight(this.domElement)/2+"px"};return c}(dat.dom.dom,dat.utils.common),dat.dom.dom,dat.utils.common);
\ No newline at end of file
+!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dat=t():e.dat=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";t.__esModule=!0,t["default"]=n(1),e.exports=t["default"]},function(e,t,n){"use strict";t.__esModule=!0,t["default"]={color:{Color:n(2),math:n(6),interpret:n(3)},controllers:{Controller:n(7),BooleanController:n(8),OptionController:n(10),StringController:n(11),NumberController:n(12),NumberControllerBox:n(13),NumberControllerSlider:n(14),FunctionController:n(15),ColorController:n(16)},dom:{dom:n(9)},gui:{GUI:n(17)},GUI:n(17)},e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space?this.__state[t]:(p.recalculateRGB(this,t,n),this.__state[t])},set:function(e){"RGB"!==this.__state.space&&(p.recalculateRGB(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function r(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space?this.__state[t]:(p.recalculateHSV(this),this.__state[t])},set:function(e){"HSV"!==this.__state.space&&(p.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}t.__esModule=!0;var s=n(3),l=o(s),d=n(6),u=o(d),c=n(4),f=o(c),h=n(5),_=o(h),p=function(){function e(){if(i(this,e),this.__state=l["default"].apply(this,arguments),this.__state===!1)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return e.prototype.toString=function(){return f["default"](this)},e.prototype.toOriginal=function(){return this.__state.conversion.write(this)},e}();p.recalculateRGB=function(e,t,n){if("HEX"===e.__state.space)e.__state[t]=u["default"].component_from_hex(e.__state.hex,n);else{if("HSV"!==e.__state.space)throw new Error("Corrupted color state");_["default"].extend(e.__state,u["default"].hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}},p.recalculateHSV=function(e){var t=u["default"].rgb_to_hsv(e.r,e.g,e.b);_["default"].extend(e.__state,{s:t.s,v:t.v}),_["default"].isNaN(t.h)?_["default"].isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=t.h},p.COMPONENTS=["r","g","b","h","s","v","hex","a"],a(p.prototype,"r",2),a(p.prototype,"g",1),a(p.prototype,"b",0),r(p.prototype,"h"),r(p.prototype,"s"),r(p.prototype,"v"),Object.defineProperty(p.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(p.prototype,"hex",{get:function(){return"HEX"!==!this.__state.space&&(this.__state.hex=u["default"].rgb_to_hex(this.r,this.g,this.b)),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}}),t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(4),a=o(i),r=n(5),s=o(r),l=[{litmus:s["default"].isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:a["default"]},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:a["default"]},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:a["default"]},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:a["default"]}}},{litmus:s["default"].isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:s["default"].isArray,conversions:{RGB_ARRAY:{read:function(e){return 3===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return 4===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:s["default"].isObject,conversions:{RGBA_OBJ:{read:function(e){return!!(s["default"].isNumber(e.r)&&s["default"].isNumber(e.g)&&s["default"].isNumber(e.b)&&s["default"].isNumber(e.a))&&{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return!!(s["default"].isNumber(e.r)&&s["default"].isNumber(e.g)&&s["default"].isNumber(e.b))&&{space:"RGB",r:e.r,g:e.g,b:e.b}},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return!!(s["default"].isNumber(e.h)&&s["default"].isNumber(e.s)&&s["default"].isNumber(e.v)&&s["default"].isNumber(e.a))&&{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return!!(s["default"].isNumber(e.h)&&s["default"].isNumber(e.s)&&s["default"].isNumber(e.v))&&{space:"HSV",h:e.h,s:e.s,v:e.v}},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}],d=void 0,u=void 0,c=function(){u=!1;var e=arguments.length>1?s["default"].toArray(arguments):arguments[0];return s["default"].each(l,function(t){if(t.litmus(e))return s["default"].each(t.conversions,function(t,n){if(d=t.read(e),u===!1&&d!==!1)return u=d,d.conversionName=n,d.conversion=t,s["default"].BREAK}),s["default"].BREAK}),u};t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(5),a=o(i);t["default"]=function(e){if(1===e.a||a["default"].isUndefined(e.a)){for(var t=e.hex.toString(16);t.length<6;)t="0"+t;return"#"+t}return"rgba("+Math.round(e.r)+","+Math.round(e.g)+","+Math.round(e.b)+","+e.a+")"},e.exports=t["default"]},function(e,t){"use strict";t.__esModule=!0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){if(!this.isUndefined(t)){var n=Object.keys(t);n.forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))}},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){if(!this.isUndefined(t)){var n=Object.keys(t);n.forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))}},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i=void 0,a=void 0;for(i=0,a=e.length;i<a;i++)if(i in e&&t.call(o,e[i],i)===this.BREAK)return}else{if(this.isUndefined(e))return;var r=Object.keys(e);r.forEach(function(n){t.call(o,e[n],n)===this.BREAK}.bind(this))}},defer:function(e){setTimeout(e,0)},debounce:function(e,t){var n=void 0;return function(){function o(){n=null}var i=this,a=arguments,r=!n;clearTimeout(n),n=setTimeout(o,t),r&&e.apply(i,a)}},toArray:function(e){return e.toArray?e.toArray():o.call(e)},isUndefined:function(e){return void 0===e},isNull:function(e){return null===e},isNaN:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){return isNaN(e)}),isArray:Array.isArray||function(e){return e.constructor===Array},isObject:function(e){return e===Object(e)},isNumber:function(e){return e===e+0},isString:function(e){return e===e+""},isBoolean:function(e){return e===!1||e===!0},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)}};t["default"]=i,e.exports=t["default"]},function(e,t){"use strict";t.__esModule=!0;var n=void 0,o={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),a=n*(1-t),r=n*(1-i*t),s=n*(1-(1-i)*t),l=[[n,s,a],[r,n,a],[a,n,s],[a,r,n],[s,a,n],[n,a,r]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),a=i-o,r=void 0,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=a/i,r=e===i?(t-n)/a:t===i?2+(n-e)/a:4+(e-t)/a,r/=6,r<0&&(r+=1),{h:360*r,s:s,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,o){return o<<(n=8*t)|e&~(255<<n)}};t["default"]=o,e.exports=t["default"]},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=function(){function e(t,o){n(this,e),this.initialValue=t[o],this.domElement=document.createElement("div"),this.object=t,this.property=o,this.__onChange=void 0,this.__onFinishChange=void 0}return e.prototype.onChange=function(e){return this.__onChange=e,this},e.prototype.onFinishChange=function(e){return this.__onFinishChange=e,this},e.prototype.setValue=function(e){return this.object[this.property]=e,this.__onChange&&this.__onChange.call(this,e),this.updateDisplay(),this},e.prototype.getValue=function(){return this.object[this.property]},e.prototype.updateDisplay=function(){return this},e.prototype.isModified=function(){return this.initialValue!==this.getValue()},e}();t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var r=n(7),s=o(r),l=n(9),d=o(l),u=function(e){function t(n,o){function a(){r.setValue(!r.__prev)}i(this,t),e.call(this,n,o);var r=this;this.__prev=this.getValue(),this.__checkbox=document.createElement("input"),this.__checkbox.setAttribute("type","checkbox"),d["default"].bind(this.__checkbox,"change",a,!1),this.domElement.appendChild(this.__checkbox),this.updateDisplay()}return a(t,e),t.prototype.setValue=function(t){var n=e.prototype.setValue.call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n},t.prototype.updateDisplay=function(){return this.getValue()===!0?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0):this.__checkbox.checked=!1,e.prototype.updateDisplay.call(this)},t}(s["default"]);t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e){if("0"===e||r["default"].isUndefined(e))return 0;var t=e.match(d);return r["default"].isNull(t)?0:parseFloat(t[1])}t.__esModule=!0;var a=n(5),r=o(a),s={HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},l={};r["default"].each(s,function(e,t){r["default"].each(e,function(e){l[e]=t})});var d=/(\d+(\.\d+)?)px/,u={makeSelectable:function(e,t){void 0!==e&&void 0!==e.style&&(e.onselectstart=t?function(){return!1}:function(){},e.style.MozUserSelect=t?"auto":"none",e.style.KhtmlUserSelect=t?"auto":"none",e.unselectable=t?"on":"off")},makeFullscreen:function(e,t,n){var o=n,i=t;r["default"].isUndefined(i)&&(i=!0),r["default"].isUndefined(o)&&(o=!0),e.style.position="absolute",i&&(e.style.left=0,e.style.right=0),o&&(e.style.top=0,e.style.bottom=0)},fakeEvent:function(e,t,n,o){var i=n||{},a=l[t];if(!a)throw new Error("Event type "+t+" not supported.");var s=document.createEvent(a);switch(a){case"MouseEvents":var d=i.x||i.clientX||0,u=i.y||i.clientY||0;s.initMouseEvent(t,i.bubbles||!1,i.cancelable||!0,window,i.clickCount||1,0,0,d,u,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var c=s.initKeyboardEvent||s.initKeyEvent;r["default"].defaults(i,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),c(t,i.bubbles||!1,i.cancelable,window,i.ctrlKey,i.altKey,i.shiftKey,i.metaKey,i.keyCode,i.charCode);break;default:s.initEvent(t,i.bubbles||!1,i.cancelable||!0)}r["default"].defaults(s,o),e.dispatchEvent(s)},bind:function(e,t,n,o){var i=o||!1;return e.addEventListener?e.addEventListener(t,n,i):e.attachEvent&&e.attachEvent("on"+t,n),u},unbind:function(e,t,n,o){var i=o||!1;return e.removeEventListener?e.removeEventListener(t,n,i):e.detachEvent&&e.detachEvent("on"+t,n),u},addClass:function(e,t){if(void 0===e.className)e.className=t;else if(e.className!==t){var n=e.className.split(/ +/);n.indexOf(t)===-1&&(n.push(t),e.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return u},removeClass:function(e,t){if(t)if(e.className===t)e.removeAttribute("class");else{var n=e.className.split(/ +/),o=n.indexOf(t);o!==-1&&(n.splice(o,1),e.className=n.join(" "))}else e.className=void 0;return u},hasClass:function(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){var t=getComputedStyle(e);return i(t["border-left-width"])+i(t["border-right-width"])+i(t["padding-left"])+i(t["padding-right"])+i(t.width)},getHeight:function(e){var t=getComputedStyle(e);return i(t["border-top-width"])+i(t["border-bottom-width"])+i(t["padding-top"])+i(t["padding-bottom"])+i(t.height)},getOffset:function(e){var t=e,n={left:0,top:0};if(t.offsetParent)do n.left+=t.offsetLeft,n.top+=t.offsetTop,t=t.offsetParent;while(t);return n},isActive:function(e){return e===document.activeElement&&(e.type||e.href)}};t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var r=n(7),s=o(r),l=n(9),d=o(l),u=n(5),c=o(u),f=function(e){function t(n,o,a){i(this,t),e.call(this,n,o);var r=a,s=this;this.__select=document.createElement("select"),c["default"].isArray(r)&&!function(){var e={};c["default"].each(r,function(t){e[t]=t}),r=e}(),c["default"].each(r,function(e,t){var n=document.createElement("option");n.innerHTML=t,n.setAttribute("value",e),s.__select.appendChild(n)}),this.updateDisplay(),d["default"].bind(this.__select,"change",function(){var e=this.options[this.selectedIndex].value;s.setValue(e)}),this.domElement.appendChild(this.__select)}return a(t,e),t.prototype.setValue=function(t){var n=e.prototype.setValue.call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n},t.prototype.updateDisplay=function(){return d["default"].isActive(this.__select)?this:(this.__select.value=this.getValue(),e.prototype.updateDisplay.call(this))},t}(s["default"]);t["default"]=f,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var r=n(7),s=o(r),l=n(9),d=o(l),u=function(e){function t(n,o){function a(){s.setValue(s.__input.value)}function r(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}i(this,t),e.call(this,n,o);var s=this;this.__input=document.createElement("input"),this.__input.setAttribute("type","text"),d["default"].bind(this.__input,"keyup",a),d["default"].bind(this.__input,"change",a),d["default"].bind(this.__input,"blur",r),d["default"].bind(this.__input,"keydown",function(e){13===e.keyCode&&this.blur()}),this.updateDisplay(),this.domElement.appendChild(this.__input)}return a(t,e),t.prototype.updateDisplay=function(){return d["default"].isActive(this.__input)||(this.__input.value=this.getValue()),e.prototype.updateDisplay.call(this)},t}(s["default"]);t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function r(e){var t=e.toString();return t.indexOf(".")>-1?t.length-t.indexOf(".")-1:0}t.__esModule=!0;var s=n(7),l=o(s),d=n(5),u=o(d),c=function(e){function t(n,o,a){i(this,t),e.call(this,n,o);var s=a||{};this.__min=s.min,this.__max=s.max,this.__step=s.step,u["default"].isUndefined(this.__step)?0===this.initialValue?this.__impliedStep=1:this.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(this.initialValue))/Math.LN10))/10:this.__impliedStep=this.__step,this.__precision=r(this.__impliedStep)}return a(t,e),t.prototype.setValue=function(t){var n=t;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!==0&&(n=Math.round(n/this.__step)*this.__step),e.prototype.setValue.call(this,n)},t.prototype.min=function(e){return this.__min=e,this},t.prototype.max=function(e){return this.__max=e,this},t.prototype.step=function(e){return this.__step=e,this.__impliedStep=e,this.__precision=r(e),this},t}(l["default"]);t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function r(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}t.__esModule=!0;var s=n(12),l=o(s),d=n(9),u=o(d),c=n(5),f=o(c),h=function(e){function t(n,o,a){function r(){var e=parseFloat(h.__input.value);f["default"].isNaN(e)||h.setValue(e)}function s(){r(),h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())}function l(e){document.activeElement.blur();var t=_-e.clientY;h.setValue(h.getValue()+t*h.__impliedStep),_=e.clientY}function d(){u["default"].unbind(window,"mousemove",l),u["default"].unbind(window,"mouseup",d)}function c(e){u["default"].bind(window,"mousemove",l),u["default"].bind(window,"mouseup",d),_=e.clientY}i(this,t),e.call(this,n,o,a),this.__truncationSuspended=!1;var h=this,_=void 0;this.__input=document.createElement("input"),this.__input.setAttribute("type","text"),u["default"].bind(this.__input,"change",r),u["default"].bind(this.__input,"blur",s),u["default"].bind(this.__input,"mousedown",c),u["default"].bind(this.__input,"keydown",function(e){13===e.keyCode&&(h.__truncationSuspended=!0,this.blur(),h.__truncationSuspended=!1)}),this.updateDisplay(),this.domElement.appendChild(this.__input)}return a(t,e),t.prototype.updateDisplay=function(){return u["default"].isActive(this.__input)?this:(this.__input.value=this.__truncationSuspended?this.getValue():r(this.getValue(),this.__precision),e.prototype.updateDisplay.call(this))},t}(l["default"]);t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function r(e,t,n,o,i){return o+(i-o)*((e-t)/(n-t))}t.__esModule=!0;var s=n(12),l=o(s),d=n(9),u=o(d),c=function(e){function t(n,o,a,s,l){function d(e){document.activeElement.blur(),u["default"].bind(window,"mousemove",c),u["default"].bind(window,"mouseup",f),c(e)}function c(e){e.preventDefault();var t=u["default"].getOffset(h.__background),n=u["default"].getWidth(h.__background);return h.setValue(r(e.clientX,t.left,t.left+n,h.__min,h.__max)),!1}function f(){u["default"].unbind(window,"mousemove",c),u["default"].unbind(window,"mouseup",f),h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())}i(this,t),e.call(this,n,o,{min:a,max:s,step:l});var h=this;this.__background=document.createElement("div"),this.__foreground=document.createElement("div"),u["default"].bind(this.__background,"mousedown",d),u["default"].addClass(this.__background,"slider"),u["default"].addClass(this.__foreground,"slider-fg"),this.updateDisplay(),this.__background.appendChild(this.__foreground),this.domElement.appendChild(this.__background)}return a(t,e),t.prototype.updateDisplay=function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",e.prototype.updateDisplay.call(this)},t}(l["default"]);t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var r=n(7),s=o(r),l=n(9),d=o(l),u=function(e){function t(n,o,a){i(this,t),e.call(this,n,o);var r=this;this.__button=document.createElement("div"),this.__button.innerHTML=void 0===a?"Fire":a,d["default"].bind(this.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),d["default"].addClass(this.__button,"button"),this.domElement.appendChild(this.__button)}return a(t,e),t.prototype.fire=function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())},t}(s["default"]);t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function r(e,t,n,o){e.style.background="",b["default"].each(v,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function s(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}t.__esModule=!0;var l=n(7),d=o(l),u=n(9),c=o(u),f=n(2),h=o(f),_=n(3),p=o(_),m=n(5),b=o(m),g=function(e){function t(n,o){function a(e){_(e),c["default"].bind(window,"mousemove",_),c["default"].bind(window,"mouseup",l)}function l(){c["default"].unbind(window,"mousemove",_),c["default"].unbind(window,"mouseup",l),f()}function d(){var e=p["default"](this.value);e!==!1?(g.__color.__state=e,g.setValue(g.__color.toOriginal())):this.value=g.__color.toString()}function u(){c["default"].unbind(window,"mousemove",m),c["default"].unbind(window,"mouseup",u),f()}function f(){g.__onFinishChange&&g.__onFinishChange.call(g,g.__color.toString())}function _(e){e.preventDefault();var t=c["default"].getWidth(g.__saturation_field),n=c["default"].getOffset(g.__saturation_field),o=(e.clientX-n.left+document.body.scrollLeft)/t,i=1-(e.clientY-n.top+document.body.scrollTop)/t;return i>1?i=1:i<0&&(i=0),o>1?o=1:o<0&&(o=0),g.__color.v=i,g.__color.s=o,g.setValue(g.__color.toOriginal()),!1}function m(e){e.preventDefault();var t=c["default"].getHeight(g.__hue_field),n=c["default"].getOffset(g.__hue_field),o=1-(e.clientY-n.top+document.body.scrollTop)/t;return o>1?o=1:o<0&&(o=0),g.__color.h=360*o,g.setValue(g.__color.toOriginal()),!1}i(this,t),e.call(this,n,o),this.__color=new h["default"](this.getValue()),this.__temp=new h["default"](0);var g=this;this.domElement=document.createElement("div"),c["default"].makeSelectable(this.domElement,!1),this.__selector=document.createElement("div"),this.__selector.className="selector",this.__saturation_field=document.createElement("div"),this.__saturation_field.className="saturation-field",this.__field_knob=document.createElement("div"),this.__field_knob.className="field-knob",this.__field_knob_border="2px solid ",this.__hue_knob=document.createElement("div"),this.__hue_knob.className="hue-knob",this.__hue_field=document.createElement("div"),this.__hue_field.className="hue-field",this.__input=document.createElement("input"),this.__input.type="text",this.__input_textShadow="0 1px 1px ",c["default"].bind(this.__input,"keydown",function(e){13===e.keyCode&&d.call(this)}),c["default"].bind(this.__input,"blur",d),c["default"].bind(this.__selector,"mousedown",function(){c["default"].addClass(this,"drag").bind(window,"mouseup",function(){c["default"].removeClass(g.__selector,"drag")})});var v=document.createElement("div");b["default"].extend(this.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),b["default"].extend(this.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:this.__field_knob_border+(this.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),b["default"].extend(this.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),b["default"].extend(this.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),b["default"].extend(v.style,{width:"100%",height:"100%",background:"none"}),r(v,"top","rgba(0,0,0,0)","#000"),b["default"].extend(this.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),s(this.__hue_field),b["default"].extend(this.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:this.__input_textShadow+"rgba(0,0,0,0.7)"}),c["default"].bind(this.__saturation_field,"mousedown",a),c["default"].bind(this.__field_knob,"mousedown",a),c["default"].bind(this.__hue_field,"mousedown",function(e){m(e),c["default"].bind(window,"mousemove",m),c["default"].bind(window,"mouseup",u)}),this.__saturation_field.appendChild(v),this.__selector.appendChild(this.__field_knob),this.__selector.appendChild(this.__saturation_field),this.__selector.appendChild(this.__hue_field),this.__hue_field.appendChild(this.__hue_knob),this.domElement.appendChild(this.__input),this.domElement.appendChild(this.__selector),this.updateDisplay()}return a(t,e),t.prototype.updateDisplay=function(){var e=p["default"](this.getValue());if(e!==!1){var t=!1;b["default"].each(h["default"].COMPONENTS,function(n){if(!b["default"].isUndefined(e[n])&&!b["default"].isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&b["default"].extend(this.__color.__state,e)}b["default"].extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;b["default"].extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,r(this.__saturation_field,"left","#fff",this.__temp.toString()),b["default"].extend(this.__input.style,{backgroundColor:this.__input.value=this.__color.toString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})},t}(d["default"]),v=["-moz-","-o-","-webkit-","-ms-",""];t["default"]=g,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function a(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];t?n.innerHTML=n.value+"*":n.innerHTML=n.value}function r(e,t,n){if(n.__li=t,n.__gui=e,U["default"].extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),l(e,n.object,n.property,{before:o,factoryArgs:[U["default"].toArray(arguments)]})}if(U["default"].isArray(t)||U["default"].isObject(t)){var o=n.__li.nextElementSibling;return n.remove(),l(e,n.object,n.property,{before:o,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof R["default"])!function(){var e=new N["default"](n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});U["default"].each(["updateDisplay","onChange","onFinishChange","step"],function(t){var o=n[t],i=e[t];n[t]=e[t]=function(){var t=Array.prototype.slice.call(arguments);return i.apply(e,t),o.apply(n,t)}}),I["default"].addClass(t,"has-slider"),n.domElement.insertBefore(e.domElement,n.domElement.firstElementChild)}();else if(n instanceof N["default"]){var o=function(t){return U["default"].isNumber(n.__min)&&U["default"].isNumber(n.__max)?(n.remove(),l(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]})):t};n.min=U["default"].compose(o,n.min),n.max=U["default"].compose(o,n.max)}else n instanceof S["default"]?(I["default"].bind(t,"click",function(){I["default"].fakeEvent(n.__checkbox,"click")}),I["default"].bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof T["default"]?(I["default"].bind(t,"click",function(){I["default"].fakeEvent(n.__button,"click")}),I["default"].bind(t,"mouseover",function(){I["default"].addClass(n.__button,"hover")}),I["default"].bind(t,"mouseout",function(){I["default"].removeClass(n.__button,"hover")})):n instanceof j["default"]&&(I["default"].addClass(t,"color"),n.updateDisplay=U["default"].compose(function(e){return t.style.borderLeftColor=n.__color.toString(),
+e},n.updateDisplay),n.updateDisplay());n.setValue=U["default"].compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&a(e.getRoot(),!0),t},n.setValue)}function s(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(o!==-1){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var a=n.load.remembered,r=void 0;if(a[e.preset])r=a[e.preset];else{if(!a[Q])return;r=a[Q]}if(r[o]&&void 0!==r[o][t.property]){var s=r[o][t.property];t.initialValue=s,t.setValue(s)}}}}function l(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var a=void 0;if(o.color)a=new j["default"](t,n);else{var l=[t,n].concat(o.factoryArgs);a=E["default"].apply(e,l)}o.before instanceof A["default"]&&(o.before=o.before.__li),s(e,a),I["default"].addClass(a.domElement,"c");var d=document.createElement("span");I["default"].addClass(d,"property-name"),d.innerHTML=a.property;var u=document.createElement("div");u.appendChild(d),u.appendChild(a.domElement);var c=i(e,u,o.before);return I["default"].addClass(c,ne.CLASS_CONTROLLER_ROW),a instanceof j["default"]?I["default"].addClass(c,"color"):I["default"].addClass(c,typeof a.getValue()),r(e,c,a),e.__controllers.push(a),a}function d(e,t){return document.location.href+"."+t}function u(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function c(e,t){t.style.display=e.useLocalStorage?"block":"none"}function f(e){var t=e.__save_row=document.createElement("li");I["default"].addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),I["default"].addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",I["default"].addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",I["default"].addClass(o,"button"),I["default"].addClass(o,"save");var i=document.createElement("span");i.innerHTML="New",I["default"].addClass(i,"button"),I["default"].addClass(i,"save-as");var a=document.createElement("span");a.innerHTML="Revert",I["default"].addClass(a,"button"),I["default"].addClass(a,"revert");var r=e.__preset_select=document.createElement("select");e.load&&e.load.remembered?U["default"].each(e.load.remembered,function(t,n){u(e,n,n===e.preset)}):u(e,Q,!1),I["default"].bind(r,"change",function(){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].innerHTML=e.__preset_select[t].value;e.preset=this.value}),t.appendChild(r),t.appendChild(n),t.appendChild(o),t.appendChild(i),t.appendChild(a),J&&!function(){var t=document.getElementById("dg-local-explain"),n=document.getElementById("dg-local-storage"),o=document.getElementById("dg-save-locally");o.style.display="block","true"===localStorage.getItem(d(e,"isLocal"))&&n.setAttribute("checked","checked"),c(e,t),I["default"].bind(n,"change",function(){e.useLocalStorage=!e.useLocalStorage,c(e,t)})}();var s=document.getElementById("dg-new-constructor");I["default"].bind(s,"keydown",function(e){!e.metaKey||67!==e.which&&67!==e.keyCode||q.hide()}),I["default"].bind(n,"click",function(){s.innerHTML=JSON.stringify(e.getSaveObject(),void 0,2),q.show(),s.focus(),s.select()}),I["default"].bind(o,"click",function(){e.save()}),I["default"].bind(i,"click",function(){var t=prompt("Enter a new preset name.");t&&e.saveAs(t)}),I["default"].bind(a,"click",function(){e.revert()})}function h(e){function t(t){return t.preventDefault(),e.width+=i-t.clientX,e.onResize(),i=t.clientX,!1}function n(){I["default"].removeClass(e.__closeButton,ne.CLASS_DRAG),I["default"].unbind(window,"mousemove",t),I["default"].unbind(window,"mouseup",n)}function o(o){return o.preventDefault(),i=o.clientX,I["default"].addClass(e.__closeButton,ne.CLASS_DRAG),I["default"].bind(window,"mousemove",t),I["default"].bind(window,"mouseup",n),!1}var i=void 0;e.__resize_handle=document.createElement("div"),U["default"].extend(e.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),I["default"].bind(e.__resize_handle,"mousedown",o),I["default"].bind(e.__closeButton,"mousedown",o),e.domElement.insertBefore(e.__resize_handle,e.domElement.firstElementChild)}function _(e,t){e.domElement.style.width=t+"px",e.__save_row&&e.autoPlace&&(e.__save_row.style.width=t+"px"),e.__closeButton&&(e.__closeButton.style.width=t+"px")}function p(e,t){var n={};return U["default"].each(e.__rememberedObjects,function(o,i){var a={},r=e.__rememberedObjectIndecesToControllers[i];U["default"].each(r,function(e,n){a[n]=t?e.initialValue:e.getValue()}),n[i]=a}),n}function m(e){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].value===e.preset&&(e.__preset_select.selectedIndex=t)}function b(e){0!==e.length&&P["default"].call(window,function(){b(e)}),U["default"].each(e,function(e){e.updateDisplay()})}var g=n(18),v=o(g),y=n(19),w=o(y),x=n(20),E=o(x),C=n(7),A=o(C),k=n(8),S=o(k),O=n(15),T=o(O),L=n(13),N=o(L),M=n(14),R=o(M),B=n(16),j=o(B),H=n(21),P=o(H),D=n(22),V=o(D),F=n(9),I=o(F),z=n(5),U=o(z),G=n(23),X=o(G);v["default"].inject(X["default"]);var K="dg",W=72,Y=20,Q="Default",J=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}(),q=void 0,Z=!0,$=void 0,ee=!1,te=[],ne=function oe(e){function t(){var e=n.getRoot();e.width+=1,U["default"].defer(function(){e.width-=1})}var n=this,o=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),I["default"].addClass(this.domElement,K),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=U["default"].defaults(o,{autoPlace:!0,width:oe.DEFAULT_WIDTH}),o=U["default"].defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),U["default"].isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),U["default"].isUndefined(o.parent)&&o.hideable&&te.push(this),o.resizable=U["default"].isUndefined(o.parent)&&o.resizable,o.autoPlace&&U["default"].isUndefined(o.scrollable)&&(o.scrollable=!0);var a=J&&"true"===localStorage.getItem(d(this,"isLocal")),r=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,m(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,_(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,titleRowName&&(titleRowName.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(e){o.closed=e,o.closed?I["default"].addClass(n.__ul,oe.CLASS_CLOSED):I["default"].removeClass(n.__ul,oe.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=e?oe.TEXT_OPEN:oe.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return a},set:function(e){J&&(a=e,e?I["default"].bind(window,"unload",r):I["default"].unbind(window,"unload",r),localStorage.setItem(d(n,"isLocal"),e))}}}),U["default"].isUndefined(o.parent)){if(o.closed=!1,I["default"].addClass(this.domElement,oe.CLASS_MAIN),I["default"].makeSelectable(this.domElement,!1),J&&a){n.useLocalStorage=!0;var s=localStorage.getItem(d(this,"gui"));s&&(o.load=JSON.parse(s))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=oe.TEXT_CLOSED,I["default"].addClass(this.__closeButton,oe.CLASS_CLOSE_BUTTON),this.domElement.appendChild(this.__closeButton),I["default"].bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var l=document.createTextNode(o.name);I["default"].addClass(l,"controller-name");var u=i(n,l),c=function(e){return e.preventDefault(),n.closed=!n.closed,!1};I["default"].addClass(this.__ul,oe.CLASS_CLOSED),I["default"].addClass(u,"title"),I["default"].bind(u,"click",c),o.closed||(this.closed=!1)}o.autoPlace&&(U["default"].isUndefined(o.parent)&&(Z&&($=document.createElement("div"),I["default"].addClass($,K),I["default"].addClass($,oe.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild($),Z=!1),$.appendChild(this.domElement),I["default"].addClass(this.domElement,oe.CLASS_AUTO_PLACE)),this.parent||_(n,o.width)),this.__resizeHandler=function(){n.onResize()},I["default"].bind(window,"resize",this.__resizeHandler),I["default"].bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),I["default"].bind(this.__ul,"transitionend",this.__resizeHandler),I["default"].bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&h(this),r=function(){J&&"true"===localStorage.getItem(d(n,"isLocal"))&&localStorage.setItem(d(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=r,o.parent||t()};ne.toggleHide=function(){ee=!ee,U["default"].each(te,function(e){e.domElement.style.display=ee?"none":""})},ne.CLASS_AUTO_PLACE="a",ne.CLASS_AUTO_PLACE_CONTAINER="ac",ne.CLASS_MAIN="main",ne.CLASS_CONTROLLER_ROW="cr",ne.CLASS_TOO_TALL="taller-than-window",ne.CLASS_CLOSED="closed",ne.CLASS_CLOSE_BUTTON="close-button",ne.CLASS_DRAG="drag",ne.DEFAULT_WIDTH=245,ne.TEXT_CLOSED="Close Controls",ne.TEXT_OPEN="Open Controls",ne._keydownHandler=function(e){"text"===document.activeElement.type||e.which!==W&&e.keyCode!==W||ne.toggleHide()},I["default"].bind(window,"keydown",ne._keydownHandler,!1),U["default"].extend(ne.prototype,{add:function(e,t){return l(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return l(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;U["default"].defer(function(){t.onResize()})},destroy:function(){this.autoPlace&&$.removeChild(this.domElement),I["default"].unbind(window,"keydown",ne._keydownHandler,!1),I["default"].unbind(window,"resize",this.__resizeHandler),this.saveToLocalStorageIfPossible&&I["default"].unbind(window,"unload",this.saveToLocalStorageIfPossible)},addFolder:function(e){if(void 0!==this.__folders[e])throw new Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var n=new ne(t);this.__folders[e]=n;var o=i(this,n.domElement);return I["default"].addClass(o,"folder"),n},open:function(){this.closed=!1},close:function(){this.closed=!0},onResize:U["default"].debounce(function(){var e=this.getRoot();if(e.scrollable){var t=I["default"].getOffset(e.__ul).top,n=0;U["default"].each(e.__ul.childNodes,function(t){e.autoPlace&&t===e.__save_row||(n+=I["default"].getHeight(t))}),window.innerHeight-t-Y<n?(I["default"].addClass(e.domElement,ne.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-Y+"px"):(I["default"].removeClass(e.domElement,ne.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&U["default"].defer(function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"}),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},200),remember:function(){if(U["default"].isUndefined(q)&&(q=new V["default"],q.domElement.innerHTML=w["default"]),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;U["default"].each(Array.prototype.slice.call(arguments),function(t){0===e.__rememberedObjects.length&&f(e),e.__rememberedObjects.indexOf(t)===-1&&e.__rememberedObjects.push(t)}),this.autoPlace&&_(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=p(this)),e.folders={},U["default"].each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=p(this),a(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=p(this,!0)),this.load.remembered[e]=p(this),this.preset=e,u(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){U["default"].each(this.__controllers,function(t){this.getRoot().load.remembered?s(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),U["default"].each(this.__folders,function(e){e.revert(e)}),e||a(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&b(this.__listening)},updateDisplay:function(){U["default"].each(this.__controllers,function(e){e.updateDisplay()}),U["default"].each(this.__folders,function(e){e.updateDisplay()})}}),e.exports=ne},function(e,t){"use strict";e.exports={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(a){}}}},function(e,t){e.exports='<div id=dg-save class="dg dialogue">Here\'s the new load parameter for your <code>GUI</code>\'s constructor:<textarea id=dg-new-constructor></textarea><div id=dg-save-locally><input id=dg-local-storage type="checkbox"> Automatically save values to <code>localStorage</code> on exit.<div id=dg-local-explain>The values saved to <code>localStorage</code> will override those passed to <code>dat.GUI</code>\'s constructor. This makes it easier to work incrementally, but <code>localStorage</code> is fragile, and your friends may not see the same values you do.</div></div></div>'},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(10),a=o(i),r=n(13),s=o(r),l=n(14),d=o(l),u=n(11),c=o(u),f=n(15),h=o(f),_=n(8),p=o(_),m=n(5),b=o(m),g=function(e,t){var n=e[t];return b["default"].isArray(arguments[2])||b["default"].isObject(arguments[2])?new a["default"](e,t,arguments[2]):b["default"].isNumber(n)?b["default"].isNumber(arguments[2])&&b["default"].isNumber(arguments[3])?b["default"].isNumber(arguments[4])?new d["default"](e,t,arguments[2],arguments[3],arguments[4]):new d["default"](e,t,arguments[2],arguments[3]):b["default"].isNumber(arguments[4])?new s["default"](e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new s["default"](e,t,{min:arguments[2],max:arguments[3]}):b["default"].isString(n)?new c["default"](e,t):b["default"].isFunction(n)?new h["default"](e,t,""):b["default"].isBoolean(n)?new p["default"](e,t):null};t["default"]=g,e.exports=t["default"]},function(e,t){"use strict";function n(e){setTimeout(e,1e3/60)}t.__esModule=!0,t["default"]=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||n,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var a=n(9),r=o(a),s=n(5),l=o(s),d=function(){function e(){i(this,e),this.backgroundElement=document.createElement("div"),l["default"].extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),r["default"].makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),l["default"].extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;r["default"].bind(this.backgroundElement,"click",function(){t.hide()})}return e.prototype.show=function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),l["default"].defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})},e.prototype.hide=function t(){var e=this,t=function n(){e.domElement.style.display="none",e.backgroundElement.style.display="none",r["default"].unbind(e.domElement,"webkitTransitionEnd",n),r["default"].unbind(e.domElement,"transitionend",n),r["default"].unbind(e.domElement,"oTransitionEnd",n)};r["default"].bind(this.domElement,"webkitTransitionEnd",t),r["default"].bind(this.domElement,"transitionend",t),r["default"].bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"},e.prototype.layout=function(){this.domElement.style.left=window.innerWidth/2-r["default"].getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-r["default"].getHeight(this.domElement)/2+"px"},e}();t["default"]=d,e.exports=t["default"]},function(e,t,n){t=e.exports=n(24)(),t.push([e.id,".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1!important}.dg.main .close-button.drag,.dg.main:hover .close-button{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;transition:opacity .1s linear;border:0;position:absolute;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-x:hidden}.dg.a.has-save>ul{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{position:fixed;top:0;z-index:1002}.dg li{-webkit-transition:height .1s ease-out;transition:height .1s ease-out}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;overflow:hidden;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid transparent}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:9px}.dg .c select{margin-top:5px}.dg .cr.boolean,.dg .cr.boolean *,.dg .cr.function,.dg .cr.function *,.dg .cr.function .property-name{cursor:pointer}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco,monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:9pt 0;display:block;width:440px;overflow-y:scroll;height:75pt;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande',sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:81pt}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:1pc;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid hsla(0,0%,100%,.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2fa1d6}.dg .cr.number input[type=text]{color:#2fa1d6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.boolean:hover,.dg .cr.function:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:0}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2fa1d6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}",""])},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},i=0;i<this.length;i++){var a=this[i][0];"number"==typeof a&&(o[a]=!0)}for(i=0;i<t.length;i++){var r=t[i];"number"==typeof r[0]&&o[r[0]]||(n&&!r[2]?r[2]=n:n&&(r[2]="("+r[2]+") and ("+n+")"),e.push(r))}},e}}])});
\ No newline at end of file | false |
Other | mrdoob | three.js | 448423a55b60603db63acee0701062a81958d60e.json | view source support (#9225)
Revive "view-source" support and add a catch and try statement if "view-source" is not available. Note: the relative path on view-source is not working, it has to be a full url for it to work... | examples/index.html | @@ -284,9 +284,14 @@ <h1><a href="http://threejs.org">three.js</a> / examples</h1>
button.id = 'button';
button.textContent = 'View source';
button.addEventListener( 'click', function ( event ) {
-
- window.open( 'https://github.com/mrdoob/three.js/blob/master/examples/' + selected + '.html' );
-
+ try{
+ var array = location.href.split('/');
+ array.pop();
+ window.open( 'view-source:'+ array.join('/')+ '/' + selected + '.html' );
+ }catch(err){
+ window.open( 'https://github.com/mrdoob/three.js/blob/master/examples/' + selected + '.html' );
+ console.log(err);
+ }
}, false );
button.style.display = 'none';
document.body.appendChild( button ); | false |
Other | mrdoob | three.js | 7f0e131d963298b1bd60a7d49fd9287e5e7e7139.json | Improve example (#9223) | examples/webgl_geometry_convex.html | @@ -11,11 +11,25 @@
margin: 0px;
overflow: hidden;
}
+ #info {
+ position: absolute;
+ color: #fff;
+ top: 0px;
+ width: 100%;
+ padding: 5px;
+ text-align:center;
+ }
+ a {
+ color: #fff;
+ }
</style>
</head>
<body>
+ <div id="info"><a href="http://threejs.org" target="_blank">three.js</a> - ConvexGeometry</div>
+
<script src="../build/three.js"></script>
+ <script src="js/controls/OrbitControls.js"></script>
<script src="js/geometries/ConvexGeometry.js"></script>
<script src="js/Detector.js"></script>
<script src="js/libs/stats.min.js"></script>
@@ -24,154 +38,121 @@
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
- var container, stats;
-
- var camera, scene, renderer;
+ var group, camera, scene, renderer;
init();
animate();
function init() {
- container = document.createElement( 'div' );
- document.body.appendChild( container );
-
- camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
- camera.position.y = 400;
-
scene = new THREE.Scene();
- var light, object, materials;
+ renderer = new THREE.WebGLRenderer( { antialias: true } );
+ renderer.setPixelRatio( window.devicePixelRatio );
+ renderer.setSize( window.innerWidth, window.innerHeight );
+ document.body.appendChild( renderer.domElement );
- scene.add( new THREE.AmbientLight( 0x404040 ) );
+ // camera
+ camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 1000 );
+ camera.position.set( 15, 20, 30 );
+ scene.add( camera );
- light = new THREE.DirectionalLight( 0xffffff );
- light.position.set( 0, 1, 0 );
- scene.add( light );
+ // controls
+ controls = new THREE.OrbitControls( camera, renderer.domElement );
+ controls.minDistance = 20;
+ controls.maxDistance = 50;
+ controls.maxPolarAngle = Math.PI / 2;
- var map = new THREE.TextureLoader().load( 'textures/UV_Grid_Sm.jpg' );
- map.wrapS = map.wrapT = THREE.RepeatWrapping;
- map.anisotropy = 16;
+ scene.add( new THREE.AmbientLight( 0x222222 ) );
- materials = [
- new THREE.MeshLambertMaterial( { map: map } ),
- new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true, transparent: true, opacity: 0.1 } )
- ];
+ var light = new THREE.PointLight( 0xffffff, 1 );
+ camera.add( light );
+ scene.add( new THREE.AxisHelper( 20 ) );
- // tetrahedron
+ //
- var points = [
- new THREE.Vector3( 100, 0, 0 ),
- new THREE.Vector3( 0, 100, 0 ),
- new THREE.Vector3( 0, 0, 100 ),
- new THREE.Vector3( 0, 0, 0 )
- ];
+ var loader = new THREE.TextureLoader();
+ var texture = loader.load( 'textures/sprites/disc.png' );
- object = THREE.SceneUtils.createMultiMaterialObject( new THREE.ConvexGeometry( points ), materials );
- object.position.set( 0, 0, 0 );
- scene.add( object );
+ group = new THREE.Group();
+ scene.add( group );
- // cube
+ // points
- var points = [
- new THREE.Vector3( 50, 50, 50 ),
- new THREE.Vector3( 50, 50, -50 ),
- new THREE.Vector3( -50, 50, -50 ),
- new THREE.Vector3( -50, 50, 50 ),
- new THREE.Vector3( 50, -50, 50 ),
- new THREE.Vector3( 50, -50, -50 ),
- new THREE.Vector3( -50, -50, -50 ),
- new THREE.Vector3( -50, -50, 50 ),
- ];
+ var pointsGeometry = new THREE.DodecahedronGeometry( 10 );
- object = THREE.SceneUtils.createMultiMaterialObject( new THREE.ConvexGeometry( points ), materials );
- object.position.set( -200, 0, -200 );
- scene.add( object );
+ for ( var i = 0; i < pointsGeometry.vertices.length; i ++ ) {
- // random convex
+ //pointsGeometry.vertices[ i ].add( randomPoint().multiplyScalar( 2 ) ); // wiggle the points
- points = [];
- for ( var i = 0; i < 30; i ++ ) {
+ }
- points.push( randomPointInSphere( 50 ) );
+ var pointsMaterial = new THREE.PointsMaterial( {
- }
+ color: 0x0080ff,
+ map: texture,
+ size: 1,
+ alphaTest: 0.5
- object = THREE.SceneUtils.createMultiMaterialObject( new THREE.ConvexGeometry( points ), materials );
- object.position.set( -200, 0, 200 );
- scene.add( object );
+ } );
+ var points = new THREE.Points( pointsGeometry, pointsMaterial );
+ group.add( points );
- object = new THREE.AxisHelper( 50 );
- object.position.set( 200, 0, -200 );
- scene.add( object );
+ // convex hull
- object = new THREE.ArrowHelper( new THREE.Vector3( 0, 1, 0 ), new THREE.Vector3( 0, 0, 0 ), 50 );
- object.position.set( 200, 0, 400 );
- scene.add( object );
+ var meshMaterial = new THREE.MeshLambertMaterial( {
+ color: 0xffffff,
+ opacity: 0.5,
+ transparent: true
+ } );
- renderer = new THREE.WebGLRenderer( { antialias: true } );
- renderer.setPixelRatio( window.devicePixelRatio );
- renderer.setSize( window.innerWidth, window.innerHeight );
- container.appendChild( renderer.domElement );
+ var meshGeometry = new THREE.ConvexGeometry( pointsGeometry.vertices );
- stats = new Stats();
- container.appendChild( stats.dom );
+ mesh = new THREE.Mesh( meshGeometry, meshMaterial );
+ mesh.material.side = THREE.BackSide; // back faces
+ mesh.renderOrder = 0;
+ group.add( mesh );
+
+ mesh = new THREE.Mesh( meshGeometry, meshMaterial.clone() );
+ mesh.material.side = THREE.FrontSide; // front faces
+ mesh.renderOrder = 1;
+ group.add( mesh );
//
window.addEventListener( 'resize', onWindowResize, false );
}
- function onWindowResize() {
-
- camera.aspect = window.innerWidth / window.innerHeight;
- camera.updateProjectionMatrix();
+ function randomPoint() {
- renderer.setSize( window.innerWidth, window.innerHeight );
+ return new THREE.Vector3( THREE.Math.randFloat( - 1, 1 ), THREE.Math.randFloat( - 1, 1 ), THREE.Math.randFloat( - 1, 1 ) );
}
+ function onWindowResize() {
- function randomPointInSphere( radius ) {
+ camera.aspect = window.innerWidth / window.innerHeight;
+ camera.updateProjectionMatrix();
- return new THREE.Vector3(
- ( Math.random() - 0.5 ) * 2 * radius,
- ( Math.random() - 0.5 ) * 2 * radius,
- ( Math.random() - 0.5 ) * 2 * radius
- );
+ renderer.setSize( window.innerWidth, window.innerHeight );
}
function animate() {
requestAnimationFrame( animate );
+ group.rotation.y += 0.005;
+
render();
- stats.update();
}
function render() {
- var timer = Date.now() * 0.0001;
-
- camera.position.x = Math.cos( timer ) * 800;
- camera.position.z = Math.sin( timer ) * 800;
-
- camera.lookAt( scene.position );
-
- for ( var i = 0, l = scene.children.length; i < l; i ++ ) {
-
- var object = scene.children[ i ];
-
- object.rotation.x = timer * 5;
- object.rotation.y = timer * 2.5;
-
- }
-
renderer.render( scene, camera );
} | false |
Other | mrdoob | three.js | a350f91896fad35ec3d1491773a3c0adb4b47734.json | Use flat vertex normals (#9221) | examples/js/geometries/ConvexGeometry.js | @@ -194,7 +194,18 @@ THREE.ConvexGeometry = function( vertices ) {
}
this.computeFaceNormals();
- this.computeVertexNormals();
+
+ // Compute flat vertex normals
+ for ( var i = 0; i < this.faces.length; i ++ ) {
+
+ var face = this.faces[ i ];
+ var normal = face.normal;
+
+ face.vertexNormals[ 0 ] = normal.clone();
+ face.vertexNormals[ 1 ] = normal.clone();
+ face.vertexNormals[ 2 ] = normal.clone();
+
+ }
};
| false |
Other | mrdoob | three.js | 777f18eb6897657daabdd680c2967720b99bc0f4.json | Update Vector3.html like a grammer natzi (#9183)
GitHub makes everything so easy these days! | docs/api/math/Vector3.html | @@ -146,7 +146,7 @@ <h3>[method:Float lengthManhattan]() [page:Vector3 this]</h3>
<h3>[method:Vector3 normalize]() [page:Vector3 this]</h3>
<div>
- Normalizes this vector. Transforms this Vector into a Unit vector by dividing the vector by it's length.
+ Normalizes this vector. Transforms this Vector into a Unit vector by dividing the vector by its length.
</div>
<h3>[method:Float distanceTo]( [page:Vector3 v] ) [page:Vector3 this]</h3> | false |