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 | a37b30695a59e28adeaa4e56bbce3ff7156a07d0.json | Fix LensFlarePlugin example on Firefox
On Firefox (windows), the LensFlare example does not show any lens flare since at least r71. Chrome and IE are okay.
The plugin can be fixed by unbinding a texture slot. | src/renderers/webgl/plugins/LensFlarePlugin.js | @@ -346,6 +346,8 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
// save current RGB to temp texture
+ renderer.state.activeTexture( gl.TEXTURE0 );
+ renderer.state.bindTexture( gl.TEXTURE_2D, null );
renderer.state.activeTexture( gl.TEXTURE1 );
renderer.state.bindTexture( gl.TEXTURE... | false |
Other | mrdoob | three.js | c24062abdc971921d6eb37fd451da9f825f4d65f.json | Convert space indentation to tab indentation. | examples/webgl_postprocessing_ssao.html | @@ -7,216 +7,216 @@
Spiral sampling http://web.archive.org/web/20120421191837/http://www.cgafaq.info/wiki/Evenly_distributed_points_on_sphere-->
<html lang="en">
- <head>
- <title>three.js webgl - postprocessing - Screen Space Ambient Occlusion</title>
- <meta charset="utf-8">
- <meta name="... | false |
Other | mrdoob | three.js | 2bfb1f557b7e39bda0656a5a65a4658fcfc7d50f.json | Solve the spaces vs tabs indentation issues. | examples/js/renderers/SoftwareRenderer.js | @@ -207,20 +207,20 @@ THREE.SoftwareRenderer = function ( parameters ) {
}
} else if ( element instanceof THREE.RenderableLine ) {
-
- var shader = getMaterialShader( material );
-
- drawLine(
- element.v1.positionScreen,
- ... | false |
Other | mrdoob | three.js | d72df15ca3528e80091d7c30e8815ee07efc440f.json | Add SSAO demo and give config GUI. | examples/webgl_postprocessing_ssao.html | @@ -0,0 +1,226 @@
+<!DOCTYPE html>
+
+<!--Reference:
+SSAO algo: http://devlog-martinsh.blogspot.tw/2011/12/ssao-shader-update-v12.html?showComment=1398158188712#c1563204765906693531
+log depth http://outerra.blogspot.tw/2013/07/logarithmic-depth-buffer-optimizations.html
+convert the exponential depth to a linear val... | false |
Other | mrdoob | three.js | d27c2aa3d2f9e61470e14268ee829f9474f76326.json | Fix 404 to CompressedTextureLoader.js
CompressedTextureLoader is part of the main library since 6f06aa6 (r69).
Fixes PVRTC example #5807. This example is only supported on iOS. | examples/webgl_materials_texture_pvrtc.html | @@ -37,7 +37,6 @@
</div>
<script src="../build/three.min.js"></script>
- <script src="js/loaders/CompressedTextureLoader.js"></script>
<script src="js/loaders/PVRLoader.js"></script>
<script src="js/Detector.js"></script> | false |
Other | mrdoob | three.js | 1736aa73baaeae99e778fcf2d44de3d1f1ab8959.json | Fix parallaxmap shader crash
Fixes #5813. | examples/js/shaders/ParallaxShader.js | @@ -82,7 +82,9 @@ THREE.ParallaxShader = {
"float heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
// while ( heightFromTexture > currentLayerHeight )
- "for ( int i = 0; i == 0; i += 0 ) {",
+ // Infinite loops are not well supported. Do a "large" finite
+ // loop, but not too l... | false |
Other | mrdoob | three.js | dfaea63385328a89bc56f4f1f28e4dcaefdffbfe.json | delete all webglProperties on loss of context | src/renderers/WebGLRenderer.js | @@ -184,6 +184,8 @@ THREE.WebGLRenderer = function ( parameters ) {
setDefaultGLState();
objects.objects = {};
+ objects.webGLProps.deleteAll();
+ webGLProps.deleteAll();
}, false);
| true |
Other | mrdoob | three.js | dfaea63385328a89bc56f4f1f28e4dcaefdffbfe.json | delete all webglProperties on loss of context | src/renderers/webgl/WebGLObjects.js | @@ -67,6 +67,7 @@ THREE.WebGLObjects = function ( gl, info ) {
this.objects = objects;
this.objectsImmediate = objectsImmediate;
+ this.webGLProps = webGLProps;
this.geometries = geometries;
| true |
Other | mrdoob | three.js | dfaea63385328a89bc56f4f1f28e4dcaefdffbfe.json | delete all webglProperties on loss of context | src/renderers/webgl/WebGLProperties.js | @@ -6,6 +6,12 @@ THREE.WebGLProperties = function () {
var properties = {};
+ this.deleteAll = function () {
+
+ properties = {};
+
+ }
+
this.delete = function ( object ) {
delete properties[ object.uuid ]; | true |
Other | mrdoob | three.js | 28ba50e8c9f146e54facc40147f2f75556528652.json | Initialize LensFlares rotation at 0
Probably a copy-paste error - it doesn't make sense to initialize rotation to 1.0 radians. Fixes #1124. | src/objects/LensFlare.js | @@ -39,15 +39,15 @@ THREE.LensFlare.prototype.add = function ( texture, size, distance, blending, co
distance = Math.min( distance, Math.max( 0, distance ) );
this.lensFlares.push( {
- texture: texture, // THREE.Texture
- size: size, // size in pixels (-1 = use texture.width)
- distance: distance, // ... | false |
Other | mrdoob | three.js | 82a5a52b164137637908dd4a4eede6e7e7d703f7.json | return http request on load #6641 | src/loaders/XHRLoader.js | @@ -65,6 +65,8 @@ THREE.XHRLoader.prototype = {
scope.manager.itemStart( url );
+ return request;
+
},
setResponseType: function ( value ) { | false |
Other | mrdoob | three.js | 3b55a8f4b84ef7edc0f80ab9d51e516c50b0c324.json | Add Multiple Elements example
shows a solution to trying to draw lots of different HTML elements
each with a different scene | examples/webgl_multiple_elements.html | @@ -0,0 +1,255 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <title>three.js webgl - multiple elements</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+ <style>
+ * {
+ box-sizing: border-box;
+ -moz-box-sizing... | false |
Other | mrdoob | three.js | 8ec4c81295e55477e22e57ed904c9e1e9a0faa78.json | Add default up direction | docs/api/core/Object3D.html | @@ -66,7 +66,7 @@ <h3>[property:Vector3 scale]</h3>
<h3>[property:Vector3 up]</h3>
<div>
- Up direction.
+ Up direction. Default is THREE.Vector3( 0, 1, 0 ).
</div>
<h3>[property:Matrix4 matrix]</h3> | false |
Other | mrdoob | three.js | c49dcddcdbde8c6fe5ead6ae19dd70c7bb6ce6b1.json | Copy BufferGeo to self or InstancedGeo | src/core/BufferGeometry.js | @@ -1209,6 +1209,33 @@ THREE.BufferGeometry.prototype = {
return geometry;
},
+
+ copy: function ( geometry ) {
+
+ for ( var attr in geometry.attributes ) {
+
+ var sourceAttr = geometry.attributes[attr];
+ this.addAttribute( attr, sourceAttr.clone() );
+
+ }
+
+ for ( var i = 0, il = geometry.offsets... | false |
Other | mrdoob | three.js | dd538fe64944d8df18f970b7a23a55ca88848129.json | Add missing ; | src/extras/FontUtils.js | @@ -466,8 +466,8 @@ THREE.FontUtils.generateShapes = function ( text, parameters ) {
// To use the typeface.js face files, hook up the API
var typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace };
if ( typeof self !== 'undefined' ){
- self._typeface_js = typeface_js
+ self._typeface_js ... | false |
Other | mrdoob | three.js | 99d4757bd40d5ceb54aed67c64d87405cddb4d5c.json | Add NPM support | .npmignore | @@ -0,0 +1,6 @@
+examples/
+src/
+test/
+utils/
+docs/
+editor/ | true |
Other | mrdoob | three.js | 99d4757bd40d5ceb54aed67c64d87405cddb4d5c.json | Add NPM support | package.json | @@ -0,0 +1,30 @@
+{
+ "name": "three.js",
+ "version": "0.71.0",
+ "description": "JavaScript 3D library",
+ "main": "build/three.js",
+ "directories": {
+ "doc": "docs",
+ "example": "examples",
+ "test": "test"
+ },
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "re... | true |
Other | mrdoob | three.js | e80b396b90af872ff91e6f609b7c340dea111f97.json | Update skeleton in existing loop | src/renderers/WebGLRenderer.js | @@ -1635,18 +1635,6 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( camera.parent === undefined ) camera.updateMatrixWorld();
- // update Skeleton objects
-
- scene.traverse( function ( object ) {
-
- if ( object instanceof THREE.SkinnedMesh ) {
-
- object.skeleton.update();
-
- }
-
- } );
-
... | false |
Other | mrdoob | three.js | b46f98d52634bc234380fd654c633f3afda5eabb.json | Remove additional update | src/renderers/WebGLRenderer.js | @@ -987,8 +987,6 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( material.visible === false ) return;
- objects.update( object );
-
var program = setProgram( camera, lights, fog, material, object );
var updateBuffers = false, | false |
Other | mrdoob | three.js | 77c7364298361a55deae254e185f1a083e7826be.json | Remove redundant texture binds
Cache currently bound and active textures and move texture binds to WebGLState | src/renderers/WebGLRenderer.js | @@ -3351,8 +3351,8 @@ THREE.WebGLRenderer = function ( parameters ) {
}
- _gl.activeTexture( _gl.TEXTURE0 + slot );
- _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture );
+ state.activeTexture( _gl.TEXTURE0 + slot );
+ state.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture );
_gl.pixelStorei( _... | true |
Other | mrdoob | three.js | 77c7364298361a55deae254e185f1a083e7826be.json | Remove redundant texture binds
Cache currently bound and active textures and move texture binds to WebGLState | src/renderers/webgl/WebGLState.js | @@ -4,6 +4,8 @@
THREE.WebGLState = function ( gl, paramThreeToGL ) {
+ var _this = this;
+
var newAttributes = new Uint8Array( 16 );
var enabledAttributes = new Uint8Array( 16 );
@@ -30,6 +32,11 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) {
var currentPolygonOffsetFactor = null;
var currentPoly... | true |
Other | mrdoob | three.js | 77c7364298361a55deae254e185f1a083e7826be.json | Remove redundant texture binds
Cache currently bound and active textures and move texture binds to WebGLState | src/renderers/webgl/plugins/LensFlarePlugin.js | @@ -43,14 +43,14 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
tempTexture = gl.createTexture();
occlusionTexture = gl.createTexture();
- gl.bindTexture( gl.TEXTURE_2D, tempTexture );
+ renderer.state.bindTexture( gl.TEXTURE_2D, tempTexture );
gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGB, 16, ... | true |
Other | mrdoob | three.js | 77c7364298361a55deae254e185f1a083e7826be.json | Remove redundant texture binds
Cache currently bound and active textures and move texture binds to WebGLState | src/renderers/webgl/plugins/SpritePlugin.js | @@ -114,7 +114,7 @@ THREE.SpritePlugin = function ( renderer, sprites ) {
gl.uniformMatrix4fv( uniforms.projectionMatrix, false, camera.projectionMatrix.elements );
- gl.activeTexture( gl.TEXTURE0 );
+ renderer.state.activeTexture( gl.TEXTURE0 );
gl.uniform1i( uniforms.map, 0 );
var oldFogType = 0; | true |
Other | mrdoob | three.js | 1998ee5fc09bbfffceb15794665e2da31cde0ba6.json | add support for texture folder | utils/exporters/blender/addons/io_three/__init__.py | @@ -42,7 +42,7 @@
bl_info = {
'name': "Three.js Format",
'author': "repsac, mrdoob, yomotsu, mpk, jpweeks",
- 'version': (1, 2, 2),
+ 'version': (1, 2, 3),
'blender': (2, 7, 3),
'location': "File > Export",
'description': "Export Three.js formatted JSON files.",
@@ -702,6 +702,7 @@ def e... | true |
Other | mrdoob | three.js | 1998ee5fc09bbfffceb15794665e2da31cde0ba6.json | add support for texture folder | utils/exporters/blender/addons/io_three/exporter/__init__.py | @@ -1,15 +1,18 @@
import os
import sys
import traceback
-from .. import constants, logger, exceptions
+from .. import constants, logger, exceptions, dialogs
from . import scene, geometry, api, base_classes
def _error_handler(func):
def inner(filepath, options, *args, **kwargs):
level = opti... | true |
Other | mrdoob | three.js | 1998ee5fc09bbfffceb15794665e2da31cde0ba6.json | add support for texture folder | utils/exporters/blender/addons/io_three/exporter/api/__init__.py | @@ -13,6 +13,16 @@ def active_object():
return bpy.context.scene.objects.active
+def batch_mode():
+ """
+
+ :return: Whether or not the session is interactive
+ :rtype: bool
+
+ """
+ return bpy.context.area is None
+
+
def init():
"""Initializing the api module. Required fir... | true |
Other | mrdoob | three.js | 932ee2d443e2661103629d82dac4ab936796275d.json | add support for texture folder | utils/exporters/blender/addons/io_three/__init__.py | @@ -26,7 +26,8 @@
EnumProperty,
BoolProperty,
FloatProperty,
- IntProperty
+ IntProperty,
+ StringProperty
)
from . import constants
@@ -41,7 +42,7 @@
bl_info = {
'name': "Three.js Format",
'author': "repsac, mrdoob, yomotsu, mpk, jpweeks",
- 'version': (1, 2, 3),
+ 'version... | true |
Other | mrdoob | three.js | 932ee2d443e2661103629d82dac4ab936796275d.json | add support for texture folder | utils/exporters/blender/addons/io_three/constants.py | @@ -63,6 +63,7 @@
FACE_MATERIALS = 'faceMaterials'
SKINNING = 'skinning'
COPY_TEXTURES = 'copyTextures'
+TEXTURE_FOLDER = "texture_folder"
ENABLE_PRECISION = 'enablePrecision'
PRECISION = 'precision'
DEFAULT_PRECISION = 6
@@ -91,25 +92,26 @@
EXPORT_OPTIONS = {
FACES: True,
VERTICES: True,
- NORMALS:... | true |
Other | mrdoob | three.js | 932ee2d443e2661103629d82dac4ab936796275d.json | add support for texture folder | utils/exporters/blender/addons/io_three/exporter/__init__.py | @@ -1,18 +1,15 @@
import os
import sys
import traceback
-from .. import constants, logger, exceptions, dialogs
+from .. import constants, logger, exceptions
from . import scene, geometry, api, base_classes
def _error_handler(func):
def inner(filepath, options, *args, **kwargs):
level = opti... | true |
Other | mrdoob | three.js | 932ee2d443e2661103629d82dac4ab936796275d.json | add support for texture folder | utils/exporters/blender/addons/io_three/exporter/api/__init__.py | @@ -13,16 +13,6 @@ def active_object():
return bpy.context.scene.objects.active
-def batch_mode():
- """
-
- :return: Whether or not the session is interactive
- :rtype: bool
-
- """
- return bpy.context.area is None
-
-
def init():
"""Initializing the api module. Required first step befor... | true |
Other | mrdoob | three.js | 932ee2d443e2661103629d82dac4ab936796275d.json | add support for texture folder | utils/exporters/blender/addons/io_three/exporter/api/material.py | @@ -380,7 +380,7 @@ def _valid_textures(material):
for texture in material.texture_slots:
if not texture:
continue
- if texture.texture.type != IMAGE:
+ if texture.texture.type != IMAGE or not texture.use:
continue
logger.debug("Valid texture found %s", tex... | true |
Other | mrdoob | three.js | 932ee2d443e2661103629d82dac4ab936796275d.json | add support for texture folder | utils/exporters/blender/addons/io_three/exporter/api/texture.py | @@ -170,6 +170,9 @@ def textures():
"""
logger.debug("texture.textures()")
- for texture in data.textures:
- if texture.type == IMAGE:
- yield texture.name
+ for mat in data.materials:
+ if mat.users == 0:
+ continue
+ for slot in mat.texture_slots:
+ ... | true |
Other | mrdoob | three.js | 932ee2d443e2661103629d82dac4ab936796275d.json | add support for texture folder | utils/exporters/blender/addons/io_three/exporter/geometry.py | @@ -135,15 +135,15 @@ def copy(self, scene=True):
return data
- def copy_textures(self):
+ def copy_textures(self, texture_folder=""):
"""Copy the textures to the destination directory."""
logger.debug("Geometry().copy_textures()")
if self.options.get(constants.COPY_TEXTURE... | true |
Other | mrdoob | three.js | 932ee2d443e2661103629d82dac4ab936796275d.json | add support for texture folder | utils/exporters/blender/addons/io_three/exporter/image.py | @@ -11,7 +11,8 @@ def __init__(self, node, parent):
logger.debug("Image().__init__(%s)", node)
base_classes.BaseNode.__init__(self, node, parent, constants.IMAGE)
- self[constants.URL] = api.image.file_name(self.node)
+ texture_folder = self.scene.options.get(constants.TEXTURE_FOLDER, ... | true |
Other | mrdoob | three.js | 932ee2d443e2661103629d82dac4ab936796275d.json | add support for texture folder | utils/exporters/blender/addons/io_three/exporter/io.py | @@ -14,6 +14,7 @@ def copy_registered_textures(dest, registration):
"""
logger.debug("io.copy_registered_textures(%s, %s)", dest, registration)
+ os.makedirs(dest, exist_ok=True)
for value in registration.values():
copy(value['file_path'], dest)
| true |
Other | mrdoob | three.js | 932ee2d443e2661103629d82dac4ab936796275d.json | add support for texture folder | utils/exporters/blender/addons/io_three/exporter/scene.py | @@ -159,9 +159,10 @@ def write(self):
io.dump(self.filepath, data, options=self.options)
if self.options.get(constants.COPY_TEXTURES):
+ texture_folder = self.options.get(constants.TEXTURE_FOLDER)
for geo in self[constants.GEOMETRIES]:
logger.info("Copying te... | true |
Other | mrdoob | three.js | 43c5354f94492ad7a8a4379b449a63215267822d.json | add support for normal/bump scale | src/loaders/ObjectLoader.js | @@ -5,6 +5,7 @@
THREE.ObjectLoader = function ( manager ) {
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+ this.texturePath = '';
};
@@ -14,7 +15,7 @@ THREE.ObjectLoader.prototype = {
load: function ( url, onLoad, onProgress, onError ) {
- if ( this.texturePath === ... | false |
Other | mrdoob | three.js | e5cc53358c619c8aa7c9c26de137236d00b1fbf0.json | Fix 'Math.sign' polyfill to match ES6 specs | src/Three.js | @@ -16,9 +16,11 @@ if ( typeof module === 'object' ) {
if ( Math.sign === undefined ) {
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign
+
Math.sign = function ( x ) {
- return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : 0;
+ return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : +x;
... | true |
Other | mrdoob | three.js | e5cc53358c619c8aa7c9c26de137236d00b1fbf0.json | Fix 'Math.sign' polyfill to match ES6 specs | test/unit/math/Math.js | @@ -0,0 +1,35 @@
+/**
+ * @author humbletim / https://github.com/humbletim
+ */
+
+module( "Math" );
+
+//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign
+//http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.sign
+/*
+20.2.2.29 Math.sign(x)
+
+Returns the sign of t... | true |
Other | mrdoob | three.js | e5cc53358c619c8aa7c9c26de137236d00b1fbf0.json | Fix 'Math.sign' polyfill to match ES6 specs | test/unit/unittests_sources.html | @@ -45,6 +45,7 @@
<script src="math/Euler.js"></script>
<script src="math/Line3.js"></script>
<script src="math/Quaternion.js"></script>
+ <script src="math/Math.js"></script>
<script src="math/Matrix3.js"></script>
<script src="math/Matrix4.js"></script>
<script src="math/Frustum.js"></script> | true |
Other | mrdoob | three.js | e5cc53358c619c8aa7c9c26de137236d00b1fbf0.json | Fix 'Math.sign' polyfill to match ES6 specs | test/unit/unittests_three-math.html | @@ -28,6 +28,7 @@
<script src="math/Euler.js"></script>
<script src="math/Line3.js"></script>
<script src="math/Quaternion.js"></script>
+ <script src="math/Math.js"></script>
<script src="math/Matrix3.js"></script>
<script src="math/Matrix4.js"></script>
<script src="math/Frustum.js"></script> | true |
Other | mrdoob | three.js | e5cc53358c619c8aa7c9c26de137236d00b1fbf0.json | Fix 'Math.sign' polyfill to match ES6 specs | test/unit/unittests_three.html | @@ -28,6 +28,7 @@
<script src="math/Euler.js"></script>
<script src="math/Line3.js"></script>
<script src="math/Quaternion.js"></script>
+ <script src="math/Math.js"></script>
<script src="math/Matrix3.js"></script>
<script src="math/Matrix4.js"></script>
<script src="math/Frustum.js"></script> | true |
Other | mrdoob | three.js | e5cc53358c619c8aa7c9c26de137236d00b1fbf0.json | Fix 'Math.sign' polyfill to match ES6 specs | test/unit/unittests_three.min.html | @@ -28,6 +28,7 @@
<script src="math/Euler.js"></script>
<script src="math/Line3.js"></script>
<script src="math/Quaternion.js"></script>
+ <script src="math/Math.js"></script>
<script src="math/Matrix3.js"></script>
<script src="math/Matrix4.js"></script>
<script src="math/Frustum.js"></script> | true |
Other | mrdoob | three.js | 8101efea28e683237efd01daedd6b4c9a2bcc611.json | Fix EffectComposer reference to renderer.
should be `this.renderer` | examples/js/postprocessing/EffectComposer.js | @@ -110,7 +110,7 @@ THREE.EffectComposer.prototype = {
renderTarget = this.renderTarget1.clone();
- var pixelRatio = renderer.getPixelRatio();
+ var pixelRatio = this.renderer.getPixelRatio();
renderTarget.width = Math.floor( this.renderer.context.canvas.width / pixelRatio );
renderTarget.height... | false |
Other | mrdoob | three.js | 8019d61f78c52719ef7de49c318067b18edcf6aa.json | fix bug in merge - need to use outgoingColor here. | src/renderers/shaders/ShaderChunk/linear_to_gamma_fragment.glsl | @@ -1 +1 @@
- gl_FragColor.xyz = linearToOutput( gl_FragColor.xyz );
\ No newline at end of file
+ outgoingLight.xyz = linearToOutput( outgoingLight.xyz );
\ No newline at end of file | false |
Other | mrdoob | three.js | cdd6d71522cc4e353426f1a15e6ad7021414d279.json | reduce greeness of light in morph example. | examples/webgl_animation_skinning_morph.html | @@ -127,7 +127,7 @@
//
- var light = new THREE.DirectionalLight( 0x497f13, 1 );
+ var light = new THREE.DirectionalLight( 0x493f13, 1 );
light.position.set( 0, -1, 0 );
scene.add( light );
| false |
Other | mrdoob | three.js | 28b633b93a8459de0d7a792ee4a162bc7aac0398.json | Fix typo in comment: mirorr -> mirror | examples/webgl_mirror.html | @@ -86,7 +86,7 @@
var planeGeo = new THREE.PlaneBufferGeometry( 100.1, 100.1 );
- // MIRORR planes
+ // MIRROR planes
groundMirror = new THREE.Mirror( renderer, camera, { clipBias: 0.003, textureWidth: WIDTH, textureHeight: HEIGHT, color: 0x777777 } );
var mirrorMesh = new THREE.Mesh(... | false |
Other | mrdoob | three.js | 5f6b04a5848e5cb0f2392a7b407bde6dd26137bc.json | Add position tracking to VRControls | examples/js/controls/VRControls.js | @@ -44,11 +44,17 @@ THREE.VRControls = function ( object, callback ) {
if ( vrInput === undefined ) return;
- var orientation = vrInput.getState().orientation;
+ var state = vrInput.getState();
- if ( orientation !== null ) {
+ if ( state.orientation !== null ) {
- object.quaternion.set( orientation.x,... | false |
Other | mrdoob | three.js | de92b6e71d7de887da53c05fc1c902201cc4bee9.json | fix wrong Integer type | docs/api/loaders/OBJMTLLoader.html | @@ -33,7 +33,7 @@ <h3>[method:null load]( [page:String objUrl], [page:String mtlUrl], [page:Functi
[page:String objUrl] — required. URL to the <em>.obj</em> resource<br />
[page:String mtlUrl] — required. URL to the <em>.mtl</em> resource<br />
[page:Function onLoad] — Will be called when both resources load c... | true |
Other | mrdoob | three.js | de92b6e71d7de887da53c05fc1c902201cc4bee9.json | fix wrong Integer type | docs/api/loaders/ObjectLoader.html | @@ -32,7 +32,7 @@ <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Functio
<div>
[page:String url] — required<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Object3D object].<br />
- [page:Function onProgress] — Will be called w... | true |
Other | mrdoob | three.js | de92b6e71d7de887da53c05fc1c902201cc4bee9.json | fix wrong Integer type | docs/api/loaders/SVGLoader.html | @@ -32,7 +32,7 @@ <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Functio
<div>
[page:String url] — required<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:SVGDocument].<br />
- [page:Function onProgress] — Will be called while... | true |
Other | mrdoob | three.js | de92b6e71d7de887da53c05fc1c902201cc4bee9.json | fix wrong Integer type | docs/api/loaders/SceneLoader.html | @@ -32,7 +32,7 @@ <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Functio
<div>
[page:String url] — required<br />
[page:Function onLoad] — Will be called when load completes. The argument will be an [page:Object] containing the loaded components.<br />
- [page:Function onProgress] — ... | true |
Other | mrdoob | three.js | 040d1621777d1bc3b8a138c0f017e7a9c67403a8.json | add missing LoadingManager | examples/js/loaders/SVGLoader.js | @@ -15,9 +15,11 @@ THREE.SVGLoader.prototype = {
load: function ( url, onLoad, onProgress, onError ) {
+ var scope = this;
+
var parser = new DOMParser();
- var loader = new THREE.XHRLoader();
+ var loader = new THREE.XHRLoader( scope.manager );
loader.setCrossOrigin( this.crossOrigin );
l... | false |
Other | mrdoob | three.js | bbf4c70823288f2253de1a66ac503eb2affac5c6.json | Pass texture in onUpdate
So generic onupdate function can be used, pass in texture as parameter | src/renderers/WebGLRenderer.js | @@ -5588,7 +5588,7 @@ THREE.WebGLRenderer = function ( parameters ) {
texture.needsUpdate = false;
- if ( texture.onUpdate ) texture.onUpdate();
+ if ( texture.onUpdate ) texture.onUpdate( texture );
};
@@ -5735,7 +5735,7 @@ THREE.WebGLRenderer = function ( parameters ) {
texture.needsUpdate = fal... | false |
Other | mrdoob | three.js | 54f62cb593e99fac6e52b8fba57329ba3c1098cd.json | load lightMapScale in ObjectLoader. | src/loaders/ObjectLoader.js | @@ -278,6 +278,10 @@ THREE.ObjectLoader.prototype = {
material.lightMap = getTexture( data.lightMap );
+ if ( data.lightMapScale !== undefined ) {
+ material.lightMapScale = data.lightMapScale;
+ }
+
}
if ( data.aoMap !== undefined ) { | false |
Other | mrdoob | three.js | c547d98f085c1e202300e2b81494abe424852e45.json | Fix Chrome from 'Multiply' to 'MultiplyOperation' | examples/webgl_materials_cars.html | @@ -250,7 +250,7 @@
"Carmine": new THREE.MeshPhongMaterial( { color: 0x770000, specular:0xffaaaa, envMap: textureCube, combine: THREE.MultiplyOperation } ),
"Gold": new THREE.MeshPhongMaterial( { color: 0xaa9944, specular:0xbbaa99, shininess:50, envMap: textureCube, combine: THREE.MultiplyOperation } ),
... | false |
Other | mrdoob | three.js | 9b781b1542ac5376d4f58f92c38b5f191bc0d6d7.json | Add comments to describe the modification | examples/js/loaders/STLLoader.js | @@ -68,8 +68,9 @@ THREE.STLLoader.prototype = {
}
+ // some binary files will have different size from expected,
+ // checking characters higher than ASCII to confirm is binary
var fileLength = reader.byteLength;
-
for ( var index = 0; index < fileLength; index ++ ) {
if ( reader.getUint8... | false |
Other | mrdoob | three.js | bb64625533a4d74fd0e4fc8bb8ed36abf2a8a2fe.json | Improve ability to detect the format of a STL file
For some reason, few binary STL files will have larger size than the value calculated based on metadata, causing them to be recognized as ASCII ones. To detect those files, a byte-by-byte check loop is added, it tries to find a non-ASCII character byte, if any is foun... | examples/js/loaders/STLLoader.js | @@ -61,7 +61,26 @@ THREE.STLLoader.prototype = {
face_size = (32 / 8 * 3) + ((32 / 8 * 3) * 3) + (16 / 8);
n_faces = reader.getUint32(80,true);
expect = 80 + (32 / 8) + (n_faces * face_size);
- return expect === reader.byteLength;
+
+ if ( expect === reader.byteLength ) {
+
+ return true;
+ ... | false |
Other | mrdoob | three.js | 0479681978b3f0e599e43285525b25100ca3783b.json | fix bug in ENVMAP_TYPE_SPHERE mapping. | src/renderers/shaders/ShaderChunk/envmap_fragment.glsl | @@ -39,7 +39,7 @@
vec4 envColor = texture2D( envMap, sampleUV );
#elif defined( ENVMAP_TYPE_SPHERE )
- vec3 reflectView = flipNormal * ( transformDirection( reflectVec, viewMatrix ) + vec3(0.0,0.0,1.0) );
+ vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.... | false |
Other | mrdoob | three.js | c222310930338f978d958857db0a99bd437d18c3.json | Optimize TessellateModifier.js slightly
`.distanceTo()` -> `distanceToSquared()` | examples/js/modifiers/TessellateModifier.js | @@ -17,7 +17,7 @@ THREE.TessellateModifier.prototype.modify = function ( geometry ) {
var faces = [];
var faceVertexUvs = [];
- var maxEdgeLength = this.maxEdgeLength;
+ var maxEdgeLengthSquared = this.maxEdgeLength * this.maxEdgeLength;
for ( var i = 0, il = geometry.faceVertexUvs.length; i < il; i ++ ) {
... | false |
Other | mrdoob | three.js | 4fd2c9627ff17a47573dda2059d830cb5933118f.json | remove stray gamma correction from ToneMapShader. | examples/js/shaders/ToneMapShader.js | @@ -67,8 +67,6 @@ THREE.ToneMapShader = {
"vec4 texel = texture2D( tDiffuse, vUv );",
"gl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );",
- //Gamma 2.0
- "gl_FragColor.xyz = sqrt( gl_FragColor.xyz );",
"}"
| false |
Other | mrdoob | three.js | 0bf4bb001020fbb2d6b447d6b1abe7bbe830454e.json | Add function for setting volume | src/extras/audio/Audio.js | @@ -64,6 +64,12 @@ THREE.Audio.prototype.setRolloffFactor = function ( value ) {
};
+THREE.Audio.prototype.setVolume = function ( value ) {
+
+ this.gain.gain.value = value;
+
+};
+
THREE.Audio.prototype.updateMatrixWorld = ( function () {
var position = new THREE.Vector3(); | false |
Other | mrdoob | three.js | e5ae7d153be11a97618259bbb787290bea94e590.json | Update ObjectLoader.js to load different maps
Simple extension to the PR submitted by @denzp https://github.com/mrdoob/three.js/pull/5502 to allow for other map types. Tested here with map, bumpMap, and alphaMap: http://datable.net/WebGL/Test299/ | src/loaders/ObjectLoader.js | @@ -229,11 +229,83 @@ THREE.ObjectLoader.prototype = {
console.warn( 'THREE.ObjectLoader: Undefined texture', data.map );
- }
+ }
material.map = textures[ data.map ];
}
+
+ if ( data.bumpMap ) {
+
+ if ( !textures[data.bumpMap] ) {
+
+ console.warn( 'THREE.Obje... | false |
Other | mrdoob | three.js | 39289c9dece88d87638344da5616c8df0ef4a05c.json | Remove unused variable | src/extras/geometries/ParametricGeometry.js | @@ -23,7 +23,7 @@ THREE.ParametricGeometry = function ( func, slices, stacks ) {
var faces = this.faces;
var uvs = this.faceVertexUvs[ 0 ];
- var i, il, j, p;
+ var i, j, p;
var u, v;
var stackCount = stacks + 1; | false |
Other | mrdoob | three.js | bd9c4662e07e554ccb2c7595bf6f0f4c147011b7.json | Update EdgesHelper.js to support BufferGeometry | src/extras/helpers/EdgesHelper.js | @@ -12,7 +12,17 @@ THREE.EdgesHelper = function ( object, hex ) {
var keys = [ 'a', 'b', 'c' ];
var geometry = new THREE.BufferGeometry();
- var geometry2 = object.geometry.clone();
+ var geometry2;
+ if ( object.geometry instanceof THREE.BufferGeometry ) {
+
+ geometry2 = new THREE.Geometry();
+ geometry2.from... | false |
Other | mrdoob | three.js | 4c9a7f6fd114ad0095cdafe0305c3f3dff8bb972.json | Add a button to show/hide the grid. | editor/js/Editor.js | @@ -36,7 +36,9 @@ var Editor = function () {
fogTypeChanged: new SIGNALS.Signal(),
fogColorChanged: new SIGNALS.Signal(),
fogParametersChanged: new SIGNALS.Signal(),
- windowResize: new SIGNALS.Signal()
+ windowResize: new SIGNALS.Signal(),
+
+ showGridChanged: new SIGNALS.Signal()
};
| true |
Other | mrdoob | three.js | 4c9a7f6fd114ad0095cdafe0305c3f3dff8bb972.json | Add a button to show/hide the grid. | editor/js/Toolbar.js | @@ -45,10 +45,15 @@ var Toolbar = function ( editor ) {
buttons.add( local );
buttons.add( new UI.Text( 'local' ) );
+ var showGrid = new UI.Checkbox().onChange( update ).setValue( true );
+ buttons.add( showGrid );
+ buttons.add( new UI.Text( 'show' ) );
+
function update() {
signals.snapChanged.dispatch(... | true |
Other | mrdoob | three.js | 4c9a7f6fd114ad0095cdafe0305c3f3dff8bb972.json | Add a button to show/hide the grid. | editor/js/Viewport.js | @@ -430,6 +430,13 @@ var Viewport = function ( editor ) {
} );
+ signals.showGridChanged.add( function ( showGrid ) {
+
+ grid.visible = showGrid;
+ render();
+
+ } );
+
var animations = [];
signals.playAnimation.add( function ( animation ) { | true |
Other | mrdoob | three.js | b2dd2418e298020903fd30c78227aa5ee21abeea.json | Fix coding style #2 | src/math/Quaternion.js | @@ -399,9 +399,9 @@ THREE.Quaternion.prototype = {
slerp: function ( qb, t ) {
- if (t === 0) return this;
+ if ( t === 0 ) return this;
- if (t === 1) return this.copy( qb );
+ if ( t === 1 ) return this.copy( qb );
var x = this._x, y = this._y, z = this._z, w = this._w;
| false |
Other | mrdoob | three.js | 99b7e5311a04583e67c0e9daab5a9595a5157cdc.json | Fix coding style | src/math/Quaternion.js | @@ -399,17 +399,9 @@ THREE.Quaternion.prototype = {
slerp: function ( qb, t ) {
- if (t === 0) {
+ if (t === 0) return this;
- return this;
-
- }
-
- else if (t === 1) {
-
- return this.copy( qb );
-
- }
+ if (t === 1) return this.copy( qb );
var x = this._x, y = this._y, z = this._z, w = this._w... | true |
Other | mrdoob | three.js | 99b7e5311a04583e67c0e9daab5a9595a5157cdc.json | Fix coding style | test/unit/math/Quaternion.js | @@ -214,6 +214,6 @@ test( "slerp", function() {
var a = new THREE.Quaternion( 0.675341, 0.408783, 0.328567, 0.518512 );
var b = new THREE.Quaternion( 0.660279, 0.436474, 0.35119, 0.500187 );
- ok( a.slerp(b, 0).equals(a), "Passed!" );
- ok( a.slerp(b, 1).equals(b), "Passed!" );
+ ok( a.slerp( b, 0 ).equals( a ), ... | true |
Other | mrdoob | three.js | 3c1c8318005efeea385ef641424c2e5cd6f4f6b7.json | add uploadTexture to WebGLRenderer
There should be no change in setTexture behavior. | src/renderers/WebGLRenderer.js | @@ -5610,108 +5610,114 @@ THREE.WebGLRenderer = function ( parameters ) {
};
- this.setTexture = function ( texture, slot ) {
+ this.uploadTexture = function ( texture ) {
- if ( texture.needsUpdate ) {
+ if ( ! texture.__webglInit ) {
- if ( ! texture.__webglInit ) {
+ texture.__webglInit = true;
- ... | false |
Other | mrdoob | three.js | 1965a19f3d62f01d54767f94b64612d265991833.json | Fix Quaternion.slerp for special case t=0 and t=1
returned value was not exactly source or target quaternion thus was
preventing testing using equal | src/math/Quaternion.js | @@ -399,6 +399,18 @@ THREE.Quaternion.prototype = {
slerp: function ( qb, t ) {
+ if (t === 0) {
+
+ return this;
+
+ }
+
+ else if (t === 1) {
+
+ return this.copy( qb );
+
+ }
+
var x = this._x, y = this._y, z = this._z, w = this._w;
// http://www.euclideanspace.com/maths/algebra/realNormedAlgeb... | true |
Other | mrdoob | three.js | 1965a19f3d62f01d54767f94b64612d265991833.json | Fix Quaternion.slerp for special case t=0 and t=1
returned value was not exactly source or target quaternion thus was
preventing testing using equal | test/unit/math/Quaternion.js | @@ -209,3 +209,11 @@ test( "equals", function() {
ok( a.equals( b ), "Passed!" );
ok( b.equals( a ), "Passed!" );
});
+
+test( "slerp", function() {
+ var a = new THREE.Quaternion( 0.675341, 0.408783, 0.328567, 0.518512 );
+ var b = new THREE.Quaternion( 0.660279, 0.436474, 0.35119, 0.500187 );
+
+ ok( a.slerp(b, ... | true |
Other | mrdoob | three.js | 3dd811eebcfcf244bd916f8b5684adbc144c2f3a.json | reverse animation with negative timeScale | src/extras/animation/Animation.js | @@ -160,15 +160,23 @@ THREE.Animation.prototype.update = (function(){
var duration = this.data.length;
- if ( this.loop === true && this.currentTime > duration ) {
+ if ( this.currentTime > duration || this.currentTime < 0 ) {
- this.currentTime %= duration;
- this.reset();
+ if ( this.loop ) {
- } ... | false |
Other | mrdoob | three.js | 93517e66c7aef4efdce05d5cd2d222831eb33bff.json | fix bug related to semi-transparent maps. | src/renderers/shaders/ShaderChunk/map_fragment.glsl | @@ -8,6 +8,6 @@
#endif
- diffuseColor.rgb *= texelColor.rgb;
+ diffuseColor *= texelColor;
#endif
\ No newline at end of file | false |
Other | mrdoob | three.js | f31bdfe4ef91082f00d08cf0be16987f63523cba.json | use correct indenting | editor/index.html | @@ -81,7 +81,7 @@
<script src="js/Toolbar.js"></script>
<script src="js/Viewport.js"></script>
<script src="js/Viewport.Info.js"></script>
- <script src="js/Fullscreen.js"></script>
+ <script src="js/Fullscreen.js"></script>
<script>
| true |
Other | mrdoob | three.js | f31bdfe4ef91082f00d08cf0be16987f63523cba.json | use correct indenting | editor/js/Fullscreen.js | @@ -1,11 +1,13 @@
-function launchIntoFullscreen(element) {
- if(element.requestFullscreen) {
- element.requestFullscreen();
- } else if(element.mozRequestFullScreen) {
- element.mozRequestFullScreen();
- } else if(element.webkitRequestFullscreen) {
- element.webkitRequestFullscreen();
- } else if(element.... | true |
Other | mrdoob | three.js | f31bdfe4ef91082f00d08cf0be16987f63523cba.json | use correct indenting | editor/js/Menubar.View.js | @@ -42,20 +42,20 @@ Menubar.View = function ( editor ) {
} );
options.add( option );
- //
+ //
- options.add( new UI.HorizontalRule() );
+ options.add( new UI.HorizontalRule() );
- // fullscreen
- var option = new UI.Panel();
- option.setClass( 'option' );
- option.setTextContent( 'Fullscree... | true |
Other | mrdoob | three.js | 0eabadc4e0d84f3ef706b7bb65f1af14a838ede1.json | add fullscreen mode (from view menu) | editor/css/dark.css | @@ -52,6 +52,8 @@ input.Number {
background: #111;
padding: 0px;
margin: 0px;
+ right: 0px;
+ top: 0px;
}
#menubar .menu { | true |
Other | mrdoob | three.js | 0eabadc4e0d84f3ef706b7bb65f1af14a838ede1.json | add fullscreen mode (from view menu) | editor/css/light.css | @@ -53,6 +53,8 @@ input.Number {
background: #eee;
padding: 0px;
margin: 0px;
+ right: 0px;
+ top: 0px;
}
#menubar .menu { | true |
Other | mrdoob | three.js | 0eabadc4e0d84f3ef706b7bb65f1af14a838ede1.json | add fullscreen mode (from view menu) | editor/index.html | @@ -81,6 +81,7 @@
<script src="js/Toolbar.js"></script>
<script src="js/Viewport.js"></script>
<script src="js/Viewport.Info.js"></script>
+ <script src="js/Fullscreen.js"></script>
<script>
| true |
Other | mrdoob | three.js | 0eabadc4e0d84f3ef706b7bb65f1af14a838ede1.json | add fullscreen mode (from view menu) | editor/js/Fullscreen.js | @@ -0,0 +1,11 @@
+function launchIntoFullscreen(element) {
+ if(element.requestFullscreen) {
+ element.requestFullscreen();
+ } else if(element.mozRequestFullScreen) {
+ element.mozRequestFullScreen();
+ } else if(element.webkitRequestFullscreen) {
+ element.webkitRequestFullscreen();
+ } else if(element.m... | true |
Other | mrdoob | three.js | 0eabadc4e0d84f3ef706b7bb65f1af14a838ede1.json | add fullscreen mode (from view menu) | editor/js/Menubar.View.js | @@ -42,6 +42,21 @@ Menubar.View = function ( editor ) {
} );
options.add( option );
+ //
+
+ options.add( new UI.HorizontalRule() );
+
+ // fullscreen
+ var option = new UI.Panel();
+ option.setClass( 'option' );
+ option.setTextContent( 'Fullscreen' );
+ option.onClick( function () {
+
+ ... | true |
Other | mrdoob | three.js | 7f656a89ac59b78543cc754cb9a1104e8b8a6426.json | make use of optionalData on THREE.error. | src/renderers/webgl/WebGLProgram.js | @@ -334,17 +334,20 @@ THREE.WebGLProgram = ( function () {
_gl.linkProgram( program );
+ var programLogInfo = _gl.getProgramInfoLog( program );
+
if ( _gl.getProgramParameter( program, _gl.LINK_STATUS ) === false ) {
- THREE.error( 'THREE.WebGLProgram: Could not initialise shader.' );
- THREE.error( 'g... | false |
Other | mrdoob | three.js | 7af872306ab5e24d63563bfce046efa3207f8c65.json | add Euler.setFromVector helper. | src/math/Euler.js | @@ -242,6 +242,12 @@ THREE.Euler.prototype = {
}(),
+ setFromVector: function ( v, order ) {
+
+ return this.set( v.x, v.y, v.z, order || this._order );
+
+ },
+
reorder: function () {
// WARNING: this discards revolution information -bhouston | false |
Other | mrdoob | three.js | ea188856bf35610a2e968a79c9e4ea5136fd3397.json | fix bug when applying common.glsl | src/renderers/shaders/ShaderLib.js | @@ -1236,7 +1236,7 @@ THREE.ShaderLib = {
"void main() {",
- " vec4 worldPosition = transformNormal( position, modelMatrix );",
+ " vWorldPosition = transformNormal( position, modelMatrix );",
" gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
@@ -1286,7 +1286,7 @@ THREE.S... | false |
Other | mrdoob | three.js | f6c07e8972d8446b58fe5f677883b22c4a88412a.json | Ignore intersections with crosshair | examples/vr_cubes.html | @@ -58,6 +58,7 @@
var vrEffect;
var vrControls;
+ var cubes = [];
var INTERSECTED;
var radius = 100, theta = 0;
var crosshair;
@@ -115,6 +116,7 @@
object.scale.z = Math.random() + 0.5;
scene.add( object );
+ cubes.push( object );
}
@@ -188,7 +190,7 @@
raycaster.... | false |
Other | mrdoob | three.js | 764e9fa39b47a30f82e285b6893f7494a5dc1d30.json | Reset GL state before rendering sprites and lens | src/renderers/WebGLRenderer.js | @@ -1726,6 +1726,7 @@ THREE.WebGLRenderer = function ( parameters ) {
// custom render plugins (post pass)
+ this.resetGLState();
spritePlugin.render( scene, camera );
lensFlarePlugin.render( scene, camera, _currentWidth, _currentHeight );
| true |
Other | mrdoob | three.js | 764e9fa39b47a30f82e285b6893f7494a5dc1d30.json | Reset GL state before rendering sprites and lens | src/renderers/webgl/plugins/LensFlarePlugin.js | @@ -295,8 +295,9 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
gl.useProgram( program );
- gl.enableVertexAttribArray( attributes.vertex );
- gl.enableVertexAttribArray( attributes.uv );
+ renderer.state.disableUnusedAttributes();
+ renderer.state.enableAttribute( attributes.vertex );
+ rendere... | true |
Other | mrdoob | three.js | 764e9fa39b47a30f82e285b6893f7494a5dc1d30.json | Reset GL state before rendering sprites and lens | src/renderers/webgl/plugins/SpritePlugin.js | @@ -98,8 +98,9 @@ THREE.SpritePlugin = function ( renderer, sprites ) {
gl.useProgram( program );
- gl.enableVertexAttribArray( attributes.position );
- gl.enableVertexAttribArray( attributes.uv );
+ renderer.state.disableUnusedAttributes();
+ renderer.state.enableAttribute( attributes.position );
+ rendere... | true |
Other | mrdoob | three.js | 1d163773f4910723d46378529eecc81d39dbe938.json | Add defines for favoured glsl functions | src/renderers/shaders/ShaderChunk/common.glsl | @@ -4,6 +4,10 @@
#define LOG2 1.442695
#define EPSILON 1e-6
+#define square(a) a * a
+#define saturate(a) clamp( a, 0.0, 1.0 )
+#define whiteCompliment(a) 1.0 - saturate( a )
+
vec3 transformDirection( in vec3 normal, in mat4 matrix ) {
return normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );
@@ -41,7 +45,7 @... | true |
Other | mrdoob | three.js | 1d163773f4910723d46378529eecc81d39dbe938.json | Add defines for favoured glsl functions | src/renderers/shaders/ShaderChunk/envmap_fragment.glsl | @@ -34,7 +34,7 @@
#elif defined( ENVMAP_TYPE_EQUIREC )
vec2 sampleUV;
- sampleUV.y = clamp( flipNormal * reflectVec.y * 0.5 + 0.5, 0.0, 1.0 );
+ sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );
sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
... | true |
Other | mrdoob | three.js | 1d163773f4910723d46378529eecc81d39dbe938.json | Add defines for favoured glsl functions | src/renderers/shaders/ShaderChunk/fog_fragment.glsl | @@ -12,7 +12,7 @@
#ifdef FOG_EXP2
- float fogFactor = 1.0 - clamp( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ), 0.0, 1.0 );
+ float fogFactor = whiteCompliment( exp2( - square( fogDensity ) * square( depth ) * LOG2 ) );
#else
| true |
Other | mrdoob | three.js | 1d163773f4910723d46378529eecc81d39dbe938.json | Add defines for favoured glsl functions | src/renderers/shaders/ShaderChunk/helper_funcs.glsl | @@ -1,16 +0,0 @@
-float square( in float a ) { return a * a; }
-vec2 square( in vec2 a ) { return a * a; }
-vec3 square( in vec3 a ) { return a * a; }
-vec4 square( in vec4 a ) { return a * a; }
-float saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }
-vec2 saturate( in vec2 a ) { return clamp( a, 0.0, 1... | true |
Other | mrdoob | three.js | 1d163773f4910723d46378529eecc81d39dbe938.json | Add defines for favoured glsl functions | src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl | @@ -78,7 +78,7 @@ vec3 totalSpecularLight = vec3( 0.0 );
if ( spotEffect > spotLightAngleCos[ i ] ) {
- spotEffect = clamp( pow( clamp( spotEffect, 0.0, 1.0 ), spotLightExponent[ i ] ), 0.0, 1.0 );
+ spotEffect = saturate( pow( saturate( spotEffect ), spotLightExponent[ i ] ) );
// attenuation
| true |
Other | mrdoob | three.js | 1d163773f4910723d46378529eecc81d39dbe938.json | Add defines for favoured glsl functions | src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl | @@ -59,13 +59,11 @@ varying vec3 vViewPosition;
vec3 calcCosineTerm( in vec3 normal, in vec3 lightDir ) {
- float dotProduct = dot( normal, lightDir );
-
- vec3 cosineTerm = vec3( clamp( dotProduct, 0.0, 1.0 ) );
+ vec3 cosineTerm = vec3( saturate( dot( normal, lightDir ) ) );
#ifdef WRAP_AROUND
- vec3 cosi... | true |
Other | mrdoob | three.js | 1d163773f4910723d46378529eecc81d39dbe938.json | Add defines for favoured glsl functions | src/renderers/shaders/ShaderLib.js | @@ -737,7 +737,7 @@ THREE.ShaderLib = {
// " gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",
"vec3 direction = normalize( vWorldPosition );",
"vec2 sampleUV;",
- "sampleUV.y = clamp( tFlip * direction.y * -0.5 + 0.5, 0.0, 1.0 );",
+ "sampleUV.y = saturate... | true |
Other | mrdoob | three.js | 1d163773f4910723d46378529eecc81d39dbe938.json | Add defines for favoured glsl functions | utils/build/includes/common.json | @@ -108,7 +108,6 @@
"src/renderers/shaders/ShaderChunk/envmap_vertex.glsl",
"src/renderers/shaders/ShaderChunk/fog_fragment.glsl",
"src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl",
- "src/renderers/shaders/ShaderChunk/helper_funcs.glsl",
"src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl",
"s... | true |
Other | mrdoob | three.js | b0f0c3bd1ad3adf88cf333ecc610282682f52be5.json | Remove unnecessary semicolons | examples/js/Car.js | @@ -246,7 +246,7 @@ THREE.Car = function () {
createCar();
- };
+ }
function createWheels ( geometry, materials ) {
@@ -255,7 +255,7 @@ THREE.Car = function () {
createCar();
- };
+ }
function createCar () {
@@ -360,7 +360,7 @@ THREE.Car = function () {
}
- };
+ }
function quadratic... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.