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 | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/objects/LOD.js | @@ -1,5 +1,5 @@
-import { Vector3 } from '../math/Vector3';
-import { Object3D } from '../core/Object3D';
+import { Vector3 } from '../math/Vector3.js';
+import { Object3D } from '../core/Object3D.js';
/**
* @author mikael emtinger / http://gomo.se/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/objects/LensFlare.js | @@ -1,7 +1,7 @@
-import { Object3D } from '../core/Object3D';
-import { NormalBlending } from '../constants';
-import { Color } from '../math/Color';
-import { Vector3 } from '../math/Vector3';
+import { Object3D } from '../core/Object3D.js';
+import { NormalBlending } from '../constants.js';
+import { Color } from '../math/Color.js';
+import { Vector3 } from '../math/Vector3.js';
/**
* @author mikael emtinger / http://gomo.se/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/objects/Line.js | @@ -1,11 +1,11 @@
-import { Sphere } from '../math/Sphere';
-import { Ray } from '../math/Ray';
-import { Matrix4 } from '../math/Matrix4';
-import { Object3D } from '../core/Object3D';
-import { Vector3 } from '../math/Vector3';
-import { LineBasicMaterial } from '../materials/LineBasicMaterial';
-import { BufferGeometry } from '../core/BufferGeometry';
-import { LineSegments } from './LineSegments';
+import { Sphere } from '../math/Sphere.js';
+import { Ray } from '../math/Ray.js';
+import { Matrix4 } from '../math/Matrix4.js';
+import { Object3D } from '../core/Object3D.js';
+import { Vector3 } from '../math/Vector3.js';
+import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
+import { BufferGeometry } from '../core/BufferGeometry.js';
+import { LineSegments } from './LineSegments.js';
/**
* @author mrdoob / http://mrdoob.com/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/objects/LineLoop.js | @@ -1,4 +1,4 @@
-import { Line } from './Line';
+import { Line } from './Line.js';
/**
* @author mgreter / http://github.com/mgreter | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/objects/LineSegments.js | @@ -1,4 +1,4 @@
-import { Line } from './Line';
+import { Line } from './Line.js';
/**
* @author mrdoob / http://mrdoob.com/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/objects/Mesh.js | @@ -1,14 +1,14 @@
-import { Vector3 } from '../math/Vector3';
-import { Vector2 } from '../math/Vector2';
-import { Sphere } from '../math/Sphere';
-import { Ray } from '../math/Ray';
-import { Matrix4 } from '../math/Matrix4';
-import { Object3D } from '../core/Object3D';
-import { Triangle } from '../math/Triangle';
-import { Face3 } from '../core/Face3';
-import { DoubleSide, BackSide, TrianglesDrawMode } from '../constants';
-import { MeshBasicMaterial } from '../materials/MeshBasicMaterial';
-import { BufferGeometry } from '../core/BufferGeometry';
+import { Vector3 } from '../math/Vector3.js';
+import { Vector2 } from '../math/Vector2.js';
+import { Sphere } from '../math/Sphere.js';
+import { Ray } from '../math/Ray.js';
+import { Matrix4 } from '../math/Matrix4.js';
+import { Object3D } from '../core/Object3D.js';
+import { Triangle } from '../math/Triangle.js';
+import { Face3 } from '../core/Face3.js';
+import { DoubleSide, BackSide, TrianglesDrawMode } from '../constants.js';
+import { MeshBasicMaterial } from '../materials/MeshBasicMaterial.js';
+import { BufferGeometry } from '../core/BufferGeometry.js';
/**
* @author mrdoob / http://mrdoob.com/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/objects/Points.js | @@ -1,10 +1,10 @@
-import { Sphere } from '../math/Sphere';
-import { Ray } from '../math/Ray';
-import { Matrix4 } from '../math/Matrix4';
-import { Object3D } from '../core/Object3D';
-import { Vector3 } from '../math/Vector3';
-import { PointsMaterial } from '../materials/PointsMaterial';
-import { BufferGeometry } from '../core/BufferGeometry';
+import { Sphere } from '../math/Sphere.js';
+import { Ray } from '../math/Ray.js';
+import { Matrix4 } from '../math/Matrix4.js';
+import { Object3D } from '../core/Object3D.js';
+import { Vector3 } from '../math/Vector3.js';
+import { PointsMaterial } from '../materials/PointsMaterial.js';
+import { BufferGeometry } from '../core/BufferGeometry.js';
/**
* @author alteredq / http://alteredqualia.com/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/objects/Skeleton.js | @@ -1,4 +1,4 @@
-import { Matrix4 } from '../math/Matrix4';
+import { Matrix4 } from '../math/Matrix4.js';
/**
* @author mikael emtinger / http://gomo.se/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/objects/SkinnedMesh.js | @@ -1,8 +1,8 @@
-import { Mesh } from './Mesh';
-import { Vector4 } from '../math/Vector4';
-import { Skeleton } from './Skeleton';
-import { Bone } from './Bone';
-import { Matrix4 } from '../math/Matrix4';
+import { Mesh } from './Mesh.js';
+import { Vector4 } from '../math/Vector4.js';
+import { Skeleton } from './Skeleton.js';
+import { Bone } from './Bone.js';
+import { Matrix4 } from '../math/Matrix4.js';
/**
* @author mikael emtinger / http://gomo.se/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/objects/Sprite.js | @@ -1,6 +1,6 @@
-import { Vector3 } from '../math/Vector3';
-import { Object3D } from '../core/Object3D';
-import { SpriteMaterial } from '../materials/SpriteMaterial';
+import { Vector3 } from '../math/Vector3.js';
+import { Object3D } from '../core/Object3D.js';
+import { SpriteMaterial } from '../materials/SpriteMaterial.js';
/**
* @author mikael emtinger / http://gomo.se/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/WebGL2Renderer.js | @@ -2,11 +2,11 @@
* @author mrdoob / http://mrdoob.com/
*/
-import { REVISION } from '../constants';
-import { WebGLExtensions } from './webgl/WebGLExtensions';
-import { WebGLState } from './webgl/WebGLState';
-import { Color } from '../math/Color';
-import { Vector4 } from '../math/Vector4';
+import { REVISION } from '../constants.js';
+import { WebGLExtensions } from './webgl/WebGLExtensions.js';
+import { WebGLState } from './webgl/WebGLState.js';
+import { Color } from '../math/Color.js';
+import { Vector4 } from '../math/Vector4.js';
function WebGL2Renderer( parameters ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/WebGLRenderTarget.js | @@ -1,8 +1,8 @@
-import { EventDispatcher } from '../core/EventDispatcher';
-import { Texture } from '../textures/Texture';
-import { LinearFilter } from '../constants';
-import { Vector4 } from '../math/Vector4';
-import { _Math } from '../math/Math';
+import { EventDispatcher } from '../core/EventDispatcher.js';
+import { Texture } from '../textures/Texture.js';
+import { LinearFilter } from '../constants.js';
+import { Vector4 } from '../math/Vector4.js';
+import { _Math } from '../math/Math.js';
/**
* @author szimek / https://github.com/szimek/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/WebGLRenderTargetCube.js | @@ -1,4 +1,4 @@
-import { WebGLRenderTarget } from './WebGLRenderTarget';
+import { WebGLRenderTarget } from './WebGLRenderTarget.js';
/**
* @author alteredq / http://alteredqualia.com | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/WebGLRenderer.js | @@ -1,37 +1,37 @@
-import { REVISION, RGBAFormat, HalfFloatType, FloatType, ByteType, UnsignedByteType, FrontFaceDirectionCW, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, NoColors, LinearToneMapping } from '../constants';
-import { _Math } from '../math/Math';
-import { Matrix4 } from '../math/Matrix4';
-import { DataTexture } from '../textures/DataTexture';
-import { WebGLUniforms } from './webgl/WebGLUniforms';
-import { UniformsLib } from './shaders/UniformsLib';
-import { UniformsUtils } from './shaders/UniformsUtils';
-import { ShaderLib } from './shaders/ShaderLib';
-import { WebGLFlareRenderer } from './webgl/WebGLFlareRenderer';
-import { WebGLSpriteRenderer } from './webgl/WebGLSpriteRenderer';
-import { WebGLShadowMap } from './webgl/WebGLShadowMap';
-import { WebGLAttributes } from './webgl/WebGLAttributes';
-import { WebGLBackground } from './webgl/WebGLBackground';
-import { WebGLRenderLists } from './webgl/WebGLRenderLists';
-import { WebGLMorphtargets } from './webgl/WebGLMorphtargets';
-import { WebGLIndexedBufferRenderer } from './webgl/WebGLIndexedBufferRenderer';
-import { WebGLBufferRenderer } from './webgl/WebGLBufferRenderer';
-import { WebGLGeometries } from './webgl/WebGLGeometries';
-import { WebGLLights } from './webgl/WebGLLights';
-import { WebGLObjects } from './webgl/WebGLObjects';
-import { WebGLPrograms } from './webgl/WebGLPrograms';
-import { WebGLTextures } from './webgl/WebGLTextures';
-import { WebGLProperties } from './webgl/WebGLProperties';
-import { WebGLState } from './webgl/WebGLState';
-import { WebGLCapabilities } from './webgl/WebGLCapabilities';
-import { WebVRManager } from './webvr/WebVRManager';
-import { BufferGeometry } from '../core/BufferGeometry';
-import { WebGLExtensions } from './webgl/WebGLExtensions';
-import { Vector3 } from '../math/Vector3';
-// import { Sphere } from '../math/Sphere';
-import { WebGLClipping } from './webgl/WebGLClipping';
-import { Frustum } from '../math/Frustum';
-import { Vector4 } from '../math/Vector4';
-import { WebGLUtils } from './webgl/WebGLUtils';
+import { REVISION, RGBAFormat, HalfFloatType, FloatType, ByteType, UnsignedByteType, FrontFaceDirectionCW, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, NoColors, LinearToneMapping } from '../constants.js';
+import { _Math } from '../math/Math.js';
+import { Matrix4 } from '../math/Matrix4.js';
+import { DataTexture } from '../textures/DataTexture.js';
+import { WebGLUniforms } from './webgl/WebGLUniforms.js';
+import { UniformsLib } from './shaders/UniformsLib.js';
+import { UniformsUtils } from './shaders/UniformsUtils.js';
+import { ShaderLib } from './shaders/ShaderLib.js';
+import { WebGLFlareRenderer } from './webgl/WebGLFlareRenderer.js';
+import { WebGLSpriteRenderer } from './webgl/WebGLSpriteRenderer.js';
+import { WebGLShadowMap } from './webgl/WebGLShadowMap.js';
+import { WebGLAttributes } from './webgl/WebGLAttributes.js';
+import { WebGLBackground } from './webgl/WebGLBackground.js';
+import { WebGLRenderLists } from './webgl/WebGLRenderLists.js';
+import { WebGLMorphtargets } from './webgl/WebGLMorphtargets.js';
+import { WebGLIndexedBufferRenderer } from './webgl/WebGLIndexedBufferRenderer.js';
+import { WebGLBufferRenderer } from './webgl/WebGLBufferRenderer.js';
+import { WebGLGeometries } from './webgl/WebGLGeometries.js';
+import { WebGLLights } from './webgl/WebGLLights.js';
+import { WebGLObjects } from './webgl/WebGLObjects.js';
+import { WebGLPrograms } from './webgl/WebGLPrograms.js';
+import { WebGLTextures } from './webgl/WebGLTextures.js';
+import { WebGLProperties } from './webgl/WebGLProperties.js';
+import { WebGLState } from './webgl/WebGLState.js';
+import { WebGLCapabilities } from './webgl/WebGLCapabilities.js';
+import { WebVRManager } from './webvr/WebVRManager.js';
+import { BufferGeometry } from '../core/BufferGeometry.js';
+import { WebGLExtensions } from './webgl/WebGLExtensions.js';
+import { Vector3 } from '../math/Vector3.js';
+// import { Sphere } from '../math/Sphere.js';
+import { WebGLClipping } from './webgl/WebGLClipping.js';
+import { Frustum } from '../math/Frustum.js';
+import { Vector4 } from '../math/Vector4.js';
+import { WebGLUtils } from './webgl/WebGLUtils.js';
/**
* @author supereggbert / http://www.paulbrunt.co.uk/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/shaders/ShaderLib.js | @@ -1,8 +1,8 @@
-import { ShaderChunk } from './ShaderChunk';
-import { UniformsUtils } from './UniformsUtils';
-import { Vector3 } from '../../math/Vector3';
-import { UniformsLib } from './UniformsLib';
-import { Color } from '../../math/Color';
+import { ShaderChunk } from './ShaderChunk.js';
+import { UniformsUtils } from './UniformsUtils.js';
+import { Vector3 } from '../../math/Vector3.js';
+import { UniformsLib } from './UniformsLib.js';
+import { Color } from '../../math/Color.js';
/**
* @author alteredq / http://alteredqualia.com/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/shaders/UniformsLib.js | @@ -1,8 +1,8 @@
-import { Vector4 } from '../../math/Vector4';
-import { Color } from '../../math/Color';
-import { Vector2 } from '../../math/Vector2';
-import { Matrix3 } from '../../math/Matrix3';
-import { DataTexture } from '../../textures/DataTexture';
+import { Vector4 } from '../../math/Vector4.js';
+import { Color } from '../../math/Color.js';
+import { Vector2 } from '../../math/Vector2.js';
+import { Matrix3 } from '../../math/Matrix3.js';
+import { DataTexture } from '../../textures/DataTexture.js';
/**
* Uniforms library for shared webgl shaders | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webgl/WebGLBackground.js | @@ -2,16 +2,16 @@
* @author mrdoob / http://mrdoob.com/
*/
-import { BackSide } from '../../constants';
-import { OrthographicCamera } from '../../cameras/OrthographicCamera';
-import { PerspectiveCamera } from '../../cameras/PerspectiveCamera';
-import { BoxBufferGeometry } from '../../geometries/BoxGeometry';
-import { PlaneBufferGeometry } from '../../geometries/PlaneGeometry';
-import { MeshBasicMaterial } from '../../materials/MeshBasicMaterial';
-import { ShaderMaterial } from '../../materials/ShaderMaterial';
-import { Color } from '../../math/Color';
-import { Mesh } from '../../objects/Mesh';
-import { ShaderLib } from '../shaders/ShaderLib';
+import { BackSide } from '../../constants.js';
+import { OrthographicCamera } from '../../cameras/OrthographicCamera.js';
+import { PerspectiveCamera } from '../../cameras/PerspectiveCamera.js';
+import { BoxBufferGeometry } from '../../geometries/BoxGeometry.js';
+import { PlaneBufferGeometry } from '../../geometries/PlaneGeometry.js';
+import { MeshBasicMaterial } from '../../materials/MeshBasicMaterial.js';
+import { ShaderMaterial } from '../../materials/ShaderMaterial.js';
+import { Color } from '../../math/Color.js';
+import { Mesh } from '../../objects/Mesh.js';
+import { ShaderLib } from '../shaders/ShaderLib.js';
function WebGLBackground( renderer, state, geometries, premultipliedAlpha ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webgl/WebGLClipping.js | @@ -2,8 +2,8 @@
* @author tschw
*/
-import { Matrix3 } from '../../math/Matrix3';
-import { Plane } from '../../math/Plane';
+import { Matrix3 } from '../../math/Matrix3.js';
+import { Plane } from '../../math/Plane.js';
function WebGLClipping() {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webgl/WebGLFlareRenderer.js | @@ -3,9 +3,9 @@
* @author alteredq / http://alteredqualia.com/
*/
-import { Box2 } from '../../math/Box2';
-import { Vector2 } from '../../math/Vector2';
-import { Vector3 } from '../../math/Vector3';
+import { Box2 } from '../../math/Box2.js';
+import { Vector2 } from '../../math/Vector2.js';
+import { Vector3 } from '../../math/Vector3.js';
function WebGLFlareRenderer( renderer, gl, state, textures, capabilities ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webgl/WebGLGeometries.js | @@ -2,9 +2,9 @@
* @author mrdoob / http://mrdoob.com/
*/
-import { Uint16BufferAttribute, Uint32BufferAttribute } from '../../core/BufferAttribute';
-import { BufferGeometry } from '../../core/BufferGeometry';
-import { arrayMax } from '../../utils';
+import { Uint16BufferAttribute, Uint32BufferAttribute } from '../../core/BufferAttribute.js';
+import { BufferGeometry } from '../../core/BufferGeometry.js';
+import { arrayMax } from '../../utils.js';
function WebGLGeometries( gl, attributes, infoMemory ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webgl/WebGLLights.js | @@ -2,10 +2,10 @@
* @author mrdoob / http://mrdoob.com/
*/
-import { Color } from '../../math/Color';
-import { Matrix4 } from '../../math/Matrix4';
-import { Vector2 } from '../../math/Vector2';
-import { Vector3 } from '../../math/Vector3';
+import { Color } from '../../math/Color.js';
+import { Matrix4 } from '../../math/Matrix4.js';
+import { Vector2 } from '../../math/Vector2.js';
+import { Vector3 } from '../../math/Vector3.js';
function UniformsCache() {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webgl/WebGLProgram.js | @@ -2,10 +2,10 @@
* @author mrdoob / http://mrdoob.com/
*/
-import { WebGLUniforms } from './WebGLUniforms';
-import { WebGLShader } from './WebGLShader';
-import { ShaderChunk } from '../shaders/ShaderChunk';
-import { NoToneMapping, AddOperation, MixOperation, MultiplyOperation, EquirectangularRefractionMapping, CubeRefractionMapping, SphericalReflectionMapping, EquirectangularReflectionMapping, CubeUVRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, CineonToneMapping, Uncharted2ToneMapping, ReinhardToneMapping, LinearToneMapping, GammaEncoding, RGBDEncoding, RGBM16Encoding, RGBM7Encoding, RGBEEncoding, sRGBEncoding, LinearEncoding } from '../../constants';
+import { WebGLUniforms } from './WebGLUniforms.js';
+import { WebGLShader } from './WebGLShader.js';
+import { ShaderChunk } from '../shaders/ShaderChunk.js';
+import { NoToneMapping, AddOperation, MixOperation, MultiplyOperation, EquirectangularRefractionMapping, CubeRefractionMapping, SphericalReflectionMapping, EquirectangularReflectionMapping, CubeUVRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, CineonToneMapping, Uncharted2ToneMapping, ReinhardToneMapping, LinearToneMapping, GammaEncoding, RGBDEncoding, RGBM16Encoding, RGBM7Encoding, RGBEEncoding, sRGBEncoding, LinearEncoding } from '../../constants.js';
var programIdCount = 0;
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webgl/WebGLPrograms.js | @@ -2,8 +2,8 @@
* @author mrdoob / http://mrdoob.com/
*/
-import { BackSide, DoubleSide, CubeUVRefractionMapping, CubeUVReflectionMapping, GammaEncoding, LinearEncoding } from '../../constants';
-import { WebGLProgram } from './WebGLProgram';
+import { BackSide, DoubleSide, CubeUVRefractionMapping, CubeUVReflectionMapping, GammaEncoding, LinearEncoding } from '../../constants.js';
+import { WebGLProgram } from './WebGLProgram.js';
function WebGLPrograms( renderer, extensions, capabilities ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webgl/WebGLShadowMap.js | @@ -3,18 +3,18 @@
* @author mrdoob / http://mrdoob.com/
*/
-import { FrontSide, BackSide, DoubleSide, RGBAFormat, NearestFilter, PCFShadowMap, RGBADepthPacking } from '../../constants';
-import { WebGLRenderTarget } from '../WebGLRenderTarget';
-import { ShaderMaterial } from '../../materials/ShaderMaterial';
-import { UniformsUtils } from '../shaders/UniformsUtils';
-import { ShaderLib } from '../shaders/ShaderLib';
-import { MeshDepthMaterial } from '../../materials/MeshDepthMaterial';
-import { MeshDistanceMaterial } from '../../materials/MeshDistanceMaterial';
-import { Vector4 } from '../../math/Vector4';
-import { Vector3 } from '../../math/Vector3';
-import { Vector2 } from '../../math/Vector2';
-import { Matrix4 } from '../../math/Matrix4';
-import { Frustum } from '../../math/Frustum';
+import { FrontSide, BackSide, DoubleSide, RGBAFormat, NearestFilter, PCFShadowMap, RGBADepthPacking } from '../../constants.js';
+import { WebGLRenderTarget } from '../WebGLRenderTarget.js';
+import { ShaderMaterial } from '../../materials/ShaderMaterial.js';
+import { UniformsUtils } from '../shaders/UniformsUtils.js';
+import { ShaderLib } from '../shaders/ShaderLib.js';
+import { MeshDepthMaterial } from '../../materials/MeshDepthMaterial.js';
+import { MeshDistanceMaterial } from '../../materials/MeshDistanceMaterial.js';
+import { Vector4 } from '../../math/Vector4.js';
+import { Vector3 } from '../../math/Vector3.js';
+import { Vector2 } from '../../math/Vector2.js';
+import { Matrix4 } from '../../math/Matrix4.js';
+import { Frustum } from '../../math/Frustum.js';
function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webgl/WebGLSpriteRenderer.js | @@ -3,9 +3,9 @@
* @author alteredq / http://alteredqualia.com/
*/
-import { CanvasTexture } from '../../textures/CanvasTexture';
-import { Vector3 } from '../../math/Vector3';
-import { Quaternion } from '../../math/Quaternion';
+import { CanvasTexture } from '../../textures/CanvasTexture.js';
+import { Vector3 } from '../../math/Vector3.js';
+import { Quaternion } from '../../math/Quaternion.js';
function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webgl/WebGLState.js | @@ -2,8 +2,8 @@
* @author mrdoob / http://mrdoob.com/
*/
-import { NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessEqualDepth, LessDepth, AlwaysDepth, NeverDepth, CullFaceFront, CullFaceBack, CullFaceNone, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, NoBlending, NormalBlending, DoubleSide, BackSide } from '../../constants';
-import { Vector4 } from '../../math/Vector4';
+import { NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessEqualDepth, LessDepth, AlwaysDepth, NeverDepth, CullFaceFront, CullFaceBack, CullFaceNone, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, NoBlending, NormalBlending, DoubleSide, BackSide } from '../../constants.js';
+import { Vector4 } from '../../math/Vector4.js';
function WebGLState( gl, extensions, utils ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webgl/WebGLTextures.js | @@ -2,8 +2,8 @@
* @author mrdoob / http://mrdoob.com/
*/
-import { LinearFilter, NearestFilter, RGBFormat, RGBAFormat, DepthFormat, DepthStencilFormat, UnsignedShortType, UnsignedIntType, UnsignedInt248Type, FloatType, HalfFloatType, ClampToEdgeWrapping, NearestMipMapLinearFilter, NearestMipMapNearestFilter } from '../../constants';
-import { _Math } from '../../math/Math';
+import { LinearFilter, NearestFilter, RGBFormat, RGBAFormat, DepthFormat, DepthStencilFormat, UnsignedShortType, UnsignedIntType, UnsignedInt248Type, FloatType, HalfFloatType, ClampToEdgeWrapping, NearestMipMapLinearFilter, NearestMipMapNearestFilter } from '../../constants.js';
+import { _Math } from '../../math/Math.js';
function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, infoMemory ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webgl/WebGLUniforms.js | @@ -47,8 +47,8 @@
*
*/
-import { CubeTexture } from '../../textures/CubeTexture';
-import { Texture } from '../../textures/Texture';
+import { CubeTexture } from '../../textures/CubeTexture.js';
+import { Texture } from '../../textures/Texture.js';
var emptyTexture = new Texture();
var emptyCubeTexture = new CubeTexture(); | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webgl/WebGLUtils.js | @@ -2,7 +2,7 @@
* @author thespite / http://www.twitter.com/thespite
*/
-import { MaxEquation, MinEquation, RGB_ETC1_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, SrcAlphaSaturateFactor, OneMinusDstColorFactor, DstColorFactor, OneMinusDstAlphaFactor, DstAlphaFactor, OneMinusSrcAlphaFactor, SrcAlphaFactor, OneMinusSrcColorFactor, SrcColorFactor, OneFactor, ZeroFactor, ReverseSubtractEquation, SubtractEquation, AddEquation, DepthFormat, DepthStencilFormat, LuminanceAlphaFormat, LuminanceFormat, RGBAFormat, RGBFormat, AlphaFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort565Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestFilter, MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping } from '../../constants';
+import { MaxEquation, MinEquation, RGB_ETC1_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, SrcAlphaSaturateFactor, OneMinusDstColorFactor, DstColorFactor, OneMinusDstAlphaFactor, DstAlphaFactor, OneMinusSrcAlphaFactor, SrcAlphaFactor, OneMinusSrcColorFactor, SrcColorFactor, OneFactor, ZeroFactor, ReverseSubtractEquation, SubtractEquation, AddEquation, DepthFormat, DepthStencilFormat, LuminanceAlphaFormat, LuminanceFormat, RGBAFormat, RGBFormat, AlphaFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort565Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestFilter, MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping } from '../../constants.js';
function WebGLUtils ( gl, extensions ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/renderers/webvr/WebVRManager.js | @@ -2,10 +2,10 @@
* @author mrdoob / http://mrdoob.com/
*/
-import { Matrix4 } from '../../math/Matrix4';
-import { Vector4 } from '../../math/Vector4';
-import { ArrayCamera } from '../../cameras/ArrayCamera';
-import { PerspectiveCamera } from '../../cameras/PerspectiveCamera';
+import { Matrix4 } from '../../math/Matrix4.js';
+import { Vector4 } from '../../math/Vector4.js';
+import { ArrayCamera } from '../../cameras/ArrayCamera.js';
+import { PerspectiveCamera } from '../../cameras/PerspectiveCamera.js';
function WebVRManager( renderer ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/scenes/Fog.js | @@ -1,4 +1,4 @@
-import { Color } from '../math/Color';
+import { Color } from '../math/Color.js';
/**
* @author mrdoob / http://mrdoob.com/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/scenes/FogExp2.js | @@ -1,4 +1,4 @@
-import { Color } from '../math/Color';
+import { Color } from '../math/Color.js';
/**
* @author mrdoob / http://mrdoob.com/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/scenes/Scene.js | @@ -1,4 +1,4 @@
-import { Object3D } from '../core/Object3D';
+import { Object3D } from '../core/Object3D.js';
/**
* @author mrdoob / http://mrdoob.com/ | true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/textures/CanvasTexture.js | @@ -2,7 +2,7 @@
* @author mrdoob / http://mrdoob.com/
*/
-import { Texture } from './Texture';
+import { Texture } from './Texture.js';
function CanvasTexture( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/textures/CompressedTexture.js | @@ -2,7 +2,7 @@
* @author alteredq / http://alteredqualia.com/
*/
-import { Texture } from './Texture';
+import { Texture } from './Texture.js';
function CompressedTexture( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/textures/CubeTexture.js | @@ -2,8 +2,8 @@
* @author mrdoob / http://mrdoob.com/
*/
-import { Texture } from './Texture';
-import { CubeReflectionMapping } from '../constants';
+import { Texture } from './Texture.js';
+import { CubeReflectionMapping } from '../constants.js';
function CubeTexture( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/textures/DataTexture.js | @@ -2,8 +2,8 @@
* @author alteredq / http://alteredqualia.com/
*/
-import { Texture } from './Texture';
-import { NearestFilter } from '../constants';
+import { Texture } from './Texture.js';
+import { NearestFilter } from '../constants.js';
function DataTexture( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/textures/DepthTexture.js | @@ -3,8 +3,8 @@
* @author atix / arthursilber.de
*/
-import { Texture } from './Texture';
-import { NearestFilter, UnsignedShortType, UnsignedInt248Type, DepthFormat, DepthStencilFormat } from '../constants';
+import { Texture } from './Texture.js';
+import { NearestFilter, UnsignedShortType, UnsignedInt248Type, DepthFormat, DepthStencilFormat } from '../constants.js';
function DepthTexture( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/textures/Texture.js | @@ -4,12 +4,12 @@
* @author szimek / https://github.com/szimek/
*/
-import { EventDispatcher } from '../core/EventDispatcher';
-import { UVMapping } from '../constants';
-import { MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping, LinearEncoding, UnsignedByteType, RGBAFormat, LinearMipMapLinearFilter, LinearFilter } from '../constants';
-import { _Math } from '../math/Math';
-import { Vector2 } from '../math/Vector2';
-import { Matrix3 } from '../math/Matrix3';
+import { EventDispatcher } from '../core/EventDispatcher.js';
+import { UVMapping } from '../constants.js';
+import { MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping, LinearEncoding, UnsignedByteType, RGBAFormat, LinearMipMapLinearFilter, LinearFilter } from '../constants.js';
+import { _Math } from '../math/Math.js';
+import { Vector2 } from '../math/Vector2.js';
+import { Matrix3 } from '../math/Matrix3.js';
var textureId = 0;
| true |
Other | mrdoob | three.js | 680f499d6b227eae8764dcd7504ffa8d59a30173.json | Add file extension to import paths | src/textures/VideoTexture.js | @@ -2,7 +2,7 @@
* @author mrdoob / http://mrdoob.com/
*/
-import { Texture } from './Texture';
+import { Texture } from './Texture.js';
function VideoTexture( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
| true |
Other | mrdoob | three.js | 62fd979644518d620f40f37882cb98dbf03cb6aa.json | Fix lgtm errors | examples/js/exporters/GLTFExporter.js | @@ -997,7 +997,7 @@ THREE.GLTFExporter.prototype = {
if ( outputJSON.buffers && outputJSON.buffers.length > 0 ) {
outputJSON.buffers[ 0 ].byteLength = blob.size;
- objectURL = URL.createObjectURL( blob );
+ var objectURL = URL.createObjectURL( blob );
var reader = new window.FileReader();
reader.readAsDataURL( blob ); | true |
Other | mrdoob | three.js | 62fd979644518d620f40f37882cb98dbf03cb6aa.json | Fix lgtm errors | examples/misc_exporter_gltf.html | @@ -263,16 +263,16 @@
// ---------------------------------------------------------------------
// Groups
// ---------------------------------------------------------------------
- group1 = new THREE.Group();
+ var group1 = new THREE.Group();
group1.name = "Group";
scene1.add( group1 );
- group2 = new THREE.Group();
+ var group2 = new THREE.Group();
group2.name = "subGroup";
group2.position.set( 0, 50, 0);
group1.add( group2 );
- object2 = new THREE.Mesh( new THREE.BoxBufferGeometry( 30, 30, 30 ), material );
+ var object2 = new THREE.Mesh( new THREE.BoxBufferGeometry( 30, 30, 30 ), material );
object2.name = "Cube in group";
object2.position.set( 0, 0, 400 );
group2.add( object2 );
@@ -399,7 +399,7 @@
pointsArray[ 3 * i + 2 ] = -50 + Math.random() * 100;
}
- pointsGeo = new THREE.BufferGeometry();
+ var pointsGeo = new THREE.BufferGeometry();
pointsGeo.addAttribute( 'position', new THREE.BufferAttribute( pointsArray, 3 ) );
var pointsMaterial = new THREE.PointsMaterial( { color: 0xffff00, size: 5 } ); | true |
Other | mrdoob | three.js | 3f4b554bb4a3fd854c9d6fa5aad551719c7fa622.json | Improve compatibility in SVGRenderer
The opacity attribute for an object was encoded as rgba (only if the
opacity was not 0 or 1). This worked OK if the SVG document was rendered
in a browser, but not when rendered using Inkscape or Illustrator. In
those programs a transparent object would be rendered as black since the
rgba attribute is not recognized.Using fill-opacity, like in previous
versions of SVGRenderer, makes the transparent objects render as
expected. | examples/js/renderers/SVGRenderer.js | @@ -131,7 +131,7 @@ THREE.SVGRenderer = function () {
if ( opacity === undefined || opacity === 1 ) return 'rgb(' + arg + ')';
- return 'rgba(' + arg + ',' + opacity + ')';
+ return 'rgb(' + arg + '); fill-opacity: ' + opacity;
}
| false |
Other | mrdoob | three.js | c318c586881d8ece16fe26de55bd0090e2df53ad.json | Fix additional offset | src/renderers/WebGLRenderer.js | @@ -1995,7 +1995,7 @@ function WebGLRenderer( parameters ) {
var offset = uvScaleMap.offset;
var repeat = uvScaleMap.repeat;
var rotation = uvScaleMap.rotation;
- uvScaleMap.matrix.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, rotation, 0.5, 0.5 );
+ uvScaleMap.matrix.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, rotation, 0.0, 0.0 );
}
@@ -2036,7 +2036,7 @@ function WebGLRenderer( parameters ) {
var offset = material.map.offset;
var repeat = material.map.repeat;
var rotation = material.map.rotation;
- material.map.matrix.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, rotation, 0.5, 0.5 );
+ material.map.matrix.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, rotation, 0.0, 0.0 );
}
| false |
Other | mrdoob | three.js | eb70fbc5547b9894ce997ab64e78c6cda6e73d5d.json | Add setPath method to FontLoader | src/loaders/FontLoader.js | @@ -19,6 +19,7 @@ Object.assign( FontLoader.prototype, {
var scope = this;
var loader = new FileLoader( this.manager );
+ loader.setPath( this.path );
loader.load( url, function ( text ) {
var json;
@@ -46,6 +47,13 @@ Object.assign( FontLoader.prototype, {
return new Font( json );
+ },
+
+ setPath: function ( value ) {
+
+ this.path = value;
+ return this;
+
}
} ); | false |
Other | mrdoob | three.js | cebc2aca2c57df591bb86f055c52d52c725e6079.json | Update TrackballControls tab consistency
There were spaces instead of tab which breaks the consistency and throws off alignment in my text editor | examples/js/controls/TrackballControls.js | @@ -475,13 +475,13 @@ THREE.TrackballControls = function ( object, domElement ) {
switch ( event.deltaMode ) {
- case 2:
- // Zoom in pages
- _zoomStart.y -= event.deltaY * 0.025;
- break;
+ case 2:
+ // Zoom in pages
+ _zoomStart.y -= event.deltaY * 0.025;
+ break;
case 1:
- // Zoom in lines
+ // Zoom in lines
_zoomStart.y -= event.deltaY * 0.01;
break;
| false |
Other | mrdoob | three.js | b7e4d7b430540e2afe372b1a29d662af2ceaf262.json | improve camera position | examples/webgl_effects_parallaxbarrier.html | @@ -58,13 +58,14 @@
document.body.appendChild( container );
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
- camera.position.set( 200, 100, 200 );
+ camera.position.set( 175, 100, 150 );
controls = new THREE.OrbitControls( camera );
- // controls.target.set( 0, 100, 0 );
controls.maxPolarAngle = Math.PI / 2.25;
+ controls.target.set( -50, 0, 0 );
controls.minDistance = 100;
controls.maxDistance = 500;
+ controls.update();
var textureCube = new THREE.CubeTextureLoader()
.setPath( 'textures/cube/Bridge2/')
@@ -105,13 +106,9 @@
if ( child.isMesh ) {
child.material.envMap = textureCube;
- child.material.envMapIntensity = 1;
child.material.metalness = 0.6;
child.material.roughness = 0.1;
- child.material.needsUpdate = true;
-
-
}
} ); | false |
Other | mrdoob | three.js | 38aea0e4fa676a986adf95dea369658e5b9c857f.json | Fix conjugate method. see #13023. | src/math/Quaternion.js | @@ -395,7 +395,9 @@ Object.assign( Quaternion.prototype, {
inverse: function () {
- return this.conjugate().normalize();
+ // quaternion is assumed to have unit length
+
+ return this.conjugate();
},
| false |
Other | mrdoob | three.js | ad9093801bbb48c919b82e8514a175d8c26c537d.json | add invertTrProperty option to MTLLoader | docs/examples/loaders/MTLLoader.html | @@ -13,7 +13,7 @@ <h1>[name]</h1>
<div class="desc">A loader for loading an <em>.mtl</em> resource, used internaly by [page:OBJMTLLoader] and [page:UTF8Loader].<br />
The Material Template Library format (MTL) or .MTL File Format is a companion file format to .OBJ that describes surface shading
- (material) properties of objects within one or more .OBJ files.
+ (material) properties of objects within one or more .OBJ files.
</div>
<h2>Constructor</h2>
@@ -69,7 +69,7 @@ <h3>[method:null setCrossOrigin]( [page:boolean useCrossOrigin] )</h3>
<div>
Set to true if you need to load textures from a different origin.
</div>
-
+
<h3>[method:null setMaterialOptions]( [page:Object options] )</h3>
<div>
@@ -79,12 +79,13 @@ <h3>[method:null setMaterialOptions]( [page:Object options] )</h3>
<li>wrap: What type of wrapping to apply for textures. THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping</li>
<li>normalizeRGB: RGBs need to be normalized to 0-1 from 0-255. Default: false, assumed to be already normalized</li>
<li>ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's. Default: false</li>
+ <li>invertTrProperty: Use values 1 of Tr field for fully opaque. This option is useful for obj exported from 3ds MAX, vcglib or meshlab. Default: false</li>
</ul>
</div>
<div>
Set of options on how to construct the materials
</div>
-
+
<h3>[method:MTLLoaderMaterialCreator parse]( [page:String text] )</h3>
<div>
@@ -93,7 +94,7 @@ <h3>[method:MTLLoaderMaterialCreator parse]( [page:String text] )</h3>
<div>
Parse a <em>mtl</em> text structure and return a [page:MTLLoaderMaterialCreator] instance.<br />
</div>
-
+
<h2>Source</h2>
| true |
Other | mrdoob | three.js | ad9093801bbb48c919b82e8514a175d8c26c537d.json | add invertTrProperty option to MTLLoader | examples/js/loaders/MTLLoader.js | @@ -462,9 +462,11 @@ THREE.MTLLoader.MaterialCreator.prototype = {
case 'tr':
n = parseFloat( value );
- if ( n > 0 ) {
+ if ( this.options && this.options.invertTrProperty ) n = 1 - n;
- params.opacity = 1 - n;
+ if ( n < 1 ) {
+
+ params.opacity = n;
params.transparent = true;
} | true |
Other | mrdoob | three.js | 07d757661ebd729eb38a18ab2f0394dd3fa61d9b.json | Fix links to Frostbite PBR document. | src/lights/PointLight.js | @@ -17,14 +17,14 @@ function PointLight( color, intensity, distance, decay ) {
get: function () {
// intensity = power per solid angle.
- // ref: equation (15) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+ // ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
return this.intensity * 4 * Math.PI;
},
set: function ( power ) {
// intensity = power per solid angle.
- // ref: equation (15) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+ // ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
this.intensity = power / ( 4 * Math.PI );
} | true |
Other | mrdoob | three.js | 07d757661ebd729eb38a18ab2f0394dd3fa61d9b.json | Fix links to Frostbite PBR document. | src/lights/SpotLight.js | @@ -21,14 +21,14 @@ function SpotLight( color, intensity, distance, angle, penumbra, decay ) {
get: function () {
// intensity = power per solid angle.
- // ref: equation (17) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+ // ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
return this.intensity * Math.PI;
},
set: function ( power ) {
// intensity = power per solid angle.
- // ref: equation (17) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+ // ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
this.intensity = power / Math.PI;
} | true |
Other | mrdoob | three.js | 87fb3a6477e4d99e6168881e62f9f3586ff70403.json | Ignore unused materials in FBXLoader | examples/js/loaders/FBXLoader.js | @@ -401,7 +401,7 @@
for ( var nodeID in materialNodes ) {
var material = parseMaterial( materialNodes[ nodeID ], textureMap, connections );
- materialMap.set( parseInt( nodeID ), material );
+ if ( material !== null ) materialMap.set( parseInt( nodeID ), material );
}
@@ -431,6 +431,10 @@
}
+ // Seems like FBX can include unused materials which don't have any connections.
+ // Ignores them so far.
+ if ( ! connections.has( FBX_ID ) ) return null;
+
var children = connections.get( FBX_ID ).children;
var parameters = parseParameters( materialNode.properties, textureMap, children ); | false |
Other | mrdoob | three.js | 856b01d8e398e89f066e67b6de2ba7a580a12f1c.json | Fix logarithmicDepthBuffer bug | src/renderers/webgl/WebGLCapabilities.js | @@ -66,7 +66,7 @@ function WebGLCapabilities( gl, extensions, parameters ) {
}
- var logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true && !! extensions.get( 'EXT_frag_depth' );
+ var logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
var maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
var maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS ); | false |
Other | mrdoob | three.js | d01d6e04a1ef18297d0e080e3df398cffc1027c3.json | Limit zooming to remove distortion | examples/webgl_video_panorama_equirectangular.html | @@ -43,7 +43,7 @@
lon = 0, onMouseDownLon = 0,
lat = 0, onMouseDownLat = 0,
phi = 0, theta = 0,
- distance = 500,
+ distance = 50,
onPointerDownPointerX = 0,
onPointerDownPointerY = 0,
onPointerDownLon = 0,
@@ -146,7 +146,7 @@
distance += event.deltaY * 0.05;
- distance = THREE.Math.clamp( distance, 400, 500 );
+ distance = THREE.Math.clamp( distance, 1, 50 );
}
@@ -169,11 +169,6 @@
camera.lookAt( camera.target );
- /*
- // distortion
- camera.position.copy( camera.target ).negate();
- */
-
renderer.render( scene, camera );
} | false |
Other | mrdoob | three.js | 32c143f7d678af9f32678222b3538f94f86a2b3d.json | Pass geometry and material into super constructor | examples/js/lines/Line2.js | @@ -2,7 +2,7 @@ console.warn( "THREE.Line2: As part of the transition to ES6 Modules, the files
THREE.Line2 = function ( geometry, material ) {
- THREE.LineSegments2.call( this );
+ THREE.LineSegments2.call( this, geometry, material );
this.type = 'Line2';
| true |
Other | mrdoob | three.js | 32c143f7d678af9f32678222b3538f94f86a2b3d.json | Pass geometry and material into super constructor | examples/js/lines/LineSegments2.js | @@ -2,7 +2,7 @@ console.warn( "THREE.LineSegments2: As part of the transition to ES6 Modules, th
THREE.LineSegments2 = function ( geometry, material ) {
- THREE.Mesh.call( this );
+ THREE.Mesh.call( this, geometry, material );
this.type = 'LineSegments2';
| true |
Other | mrdoob | three.js | 32c143f7d678af9f32678222b3538f94f86a2b3d.json | Pass geometry and material into super constructor | examples/jsm/lines/Line2.js | @@ -5,7 +5,7 @@ import { LineMaterial } from "../lines/LineMaterial.js";
var Line2 = function ( geometry, material ) {
- LineSegments2.call( this );
+ LineSegments2.call( this, geometry, material );
this.type = 'Line2';
| true |
Other | mrdoob | three.js | 32c143f7d678af9f32678222b3538f94f86a2b3d.json | Pass geometry and material into super constructor | examples/jsm/lines/LineSegments2.js | @@ -13,7 +13,7 @@ import { LineMaterial } from "../lines/LineMaterial.js";
var LineSegments2 = function ( geometry, material ) {
- Mesh.call( this );
+ Mesh.call( this, geometry, material );
this.type = 'LineSegments2';
| true |
Other | mrdoob | three.js | 0d67dea6b1a0fbf3eb26c432c41a680c1124f85e.json | Fix greek characters | examples/js/loaders/SVGLoader.js | @@ -698,11 +698,11 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
var cxp = q * rx * y1p / ry;
var cyp = - q * ry * x1p / rx;
- // Step 3: Compute (cx, cy) from (cxâ², cyâ²)
+ // Step 3: Compute (cx, cy) from (cx', cy')
var cx = Math.cos( x_axis_rotation ) * cxp - Math.sin( x_axis_rotation ) * cyp + ( start.x + end.x ) / 2;
var cy = Math.sin( x_axis_rotation ) * cxp + Math.cos( x_axis_rotation ) * cyp + ( start.y + end.y ) / 2;
- // Step 4: Compute θ1 and Îθ
+ // Step 4: Compute θ1 and Δθ
var theta = svgAngle( 1, 0, ( x1p - cxp ) / rx, ( y1p - cyp ) / ry );
var delta = svgAngle( ( x1p - cxp ) / rx, ( y1p - cyp ) / ry, ( - x1p - cxp ) / rx, ( - y1p - cyp ) / ry ) % ( Math.PI * 2 );
| false |
Other | mrdoob | three.js | f8c1beeb094c58528a8b5847facf8bdc5c9232c6.json | use WeakMap in WebGL(Properties|Attributes) | src/renderers/webgl/WebGLAttributes.js | @@ -4,7 +4,7 @@
function WebGLAttributes( gl ) {
- var buffers = {};
+ var buffers = new WeakMap();
function createBuffer( attribute, bufferType ) {
@@ -101,21 +101,21 @@ function WebGLAttributes( gl ) {
if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;
- return buffers[ attribute.uuid ];
+ return buffers.get( attribute );
}
function remove( attribute ) {
if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;
- var data = buffers[ attribute.uuid ];
+ var data = buffers.get( attribute );
if ( data ) {
gl.deleteBuffer( data.buffer );
- delete buffers[ attribute.uuid ];
+ buffers.delete( attribute );
}
@@ -125,11 +125,11 @@ function WebGLAttributes( gl ) {
if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;
- var data = buffers[ attribute.uuid ];
+ var data = buffers.get( attribute );
if ( data === undefined ) {
- buffers[ attribute.uuid ] = createBuffer( attribute, bufferType );
+ buffers.set( attribute, createBuffer( attribute, bufferType ) );
} else if ( data.version < attribute.version ) {
| true |
Other | mrdoob | three.js | f8c1beeb094c58528a8b5847facf8bdc5c9232c6.json | use WeakMap in WebGL(Properties|Attributes) | src/renderers/webgl/WebGLProperties.js | @@ -4,17 +4,16 @@
function WebGLProperties() {
- var properties = {};
+ var properties = new WeakMap();
function get( object ) {
- var uuid = object.uuid;
- var map = properties[ uuid ];
+ var map = properties.get( object );
if ( map === undefined ) {
map = {};
- properties[ uuid ] = map;
+ properties.set( object, map);
}
@@ -24,13 +23,13 @@ function WebGLProperties() {
function remove( object ) {
- delete properties[ object.uuid ];
+ properties.delete( object );
}
function dispose() {
- properties = {};
+ properties = new WeakMap();
}
| true |
Other | mrdoob | three.js | 6ab03f44db9b492444e55b9481543165dee1da36.json | fix the order of events in onMouseWheel | examples/js/controls/OrbitControls.js | @@ -765,9 +765,10 @@ THREE.OrbitControls = function ( object, domElement ) {
event.preventDefault();
event.stopPropagation();
+ scope.dispatchEvent( startEvent );
+
handleMouseWheel( event );
- scope.dispatchEvent( startEvent ); // not sure why these are here...
scope.dispatchEvent( endEvent );
} | false |
Other | mrdoob | three.js | 5f4b4925d8ebbc91b8b81e5e2f7074f02ded3ad3.json | add Matrix3Node and optimize UVTransformNode | examples/js/loaders/NodeMaterialLoader.js | @@ -214,6 +214,7 @@ Object.assign( THREE.NodeMaterialLoader.prototype, {
break;
+ case "Matrix3Node":
case "Matrix4Node":
object.value.fromArray( node.elements );
@@ -321,7 +322,7 @@ Object.assign( THREE.NodeMaterialLoader.prototype, {
case "UVTransformNode":
object.uv = this.getNode( node.uv );
- object.transform.value.fromArray( node.elements );
+ object.transform = this.getNode( node.transform );
break;
| true |
Other | mrdoob | three.js | 5f4b4925d8ebbc91b8b81e5e2f7074f02ded3ad3.json | add Matrix3Node and optimize UVTransformNode | examples/js/nodes/NodeMaterial.js | @@ -21,6 +21,7 @@ THREE.NodeMaterial.types = {
v2: 'vec2',
v3: 'vec3',
v4: 'vec4',
+ m3: 'mat3',
m4: 'mat4'
};
| true |
Other | mrdoob | three.js | 5f4b4925d8ebbc91b8b81e5e2f7074f02ded3ad3.json | add Matrix3Node and optimize UVTransformNode | examples/js/nodes/inputs/Matrix3Node.js | @@ -0,0 +1,31 @@
+/**
+ * @author sunag / http://www.sunag.com.br/
+ */
+
+THREE.Matrix3Node = function ( matrix ) {
+
+ THREE.InputNode.call( this, 'm3' );
+
+ this.value = matrix || new THREE.Matrix3();
+
+};
+
+THREE.Matrix3Node.prototype = Object.create( THREE.InputNode.prototype );
+THREE.Matrix3Node.prototype.constructor = THREE.Matrix3Node;
+THREE.Matrix3Node.prototype.nodeType = "Matrix3";
+
+THREE.Matrix3Node.prototype.toJSON = function ( meta ) {
+
+ var data = this.getJSONNode( meta );
+
+ if ( ! data ) {
+
+ data = this.createJSONNode( meta );
+
+ data.elements = this.value.elements.concat();
+
+ }
+
+ return data;
+
+}; | true |
Other | mrdoob | three.js | 5f4b4925d8ebbc91b8b81e5e2f7074f02ded3ad3.json | add Matrix3Node and optimize UVTransformNode | examples/js/nodes/utils/UVTransformNode.js | @@ -4,10 +4,10 @@
THREE.UVTransformNode = function () {
- THREE.FunctionNode.call( this, "( uvTransform * vec4( uvNode, 0, 1 ) ).xy", "vec2" );
+ THREE.FunctionNode.call( this, "( uvTransform * vec3( uvNode, 1 ) ).xy", "vec2" );
this.uv = new THREE.UVNode();
- this.transform = new THREE.Matrix4Node();
+ this.transform = new THREE.Matrix3Node();
};
@@ -26,21 +26,13 @@ THREE.UVTransformNode.prototype.generate = function ( builder, output ) {
THREE.UVTransformNode.prototype.compose = function () {
- var defaultPivot = new THREE.Vector2( .5, .5 ),
- tempVector = new THREE.Vector3(),
- tempMatrix = new THREE.Matrix4();
+ var defaultPivot = new THREE.Vector2( .5, .5 );
- return function compose( translate, rotate, scale, optionalCenter ) {
+ return function compose( translate, scale, rotate, optionalCenter ) {
optionalCenter = optionalCenter !== undefined ? optionalCenter : defaultPivot;
- var matrix = this.transform.value;
-
- matrix.identity()
- .setPosition( tempVector.set( - optionalCenter.x, - optionalCenter.y, 0 ) )
- .premultiply( tempMatrix.makeRotationZ( rotate ) )
- .multiply( tempMatrix.makeScale( scale.x, scale.y, 0 ) )
- .multiply( tempMatrix.makeTranslation( translate.x, translate.y, 0 ) );
+ this.transform.value.setUvTransform( translate.x, translate.y, scale.x, scale.y, rotate, optionalCenter.x, optionalCenter.y );
return this;
@@ -57,7 +49,7 @@ THREE.UVTransformNode.prototype.toJSON = function ( meta ) {
data = this.createJSONNode( meta );
data.uv = this.uv.toJSON( meta ).uuid;
- data.elements = this.transform.value.elements.concat();
+ data.transform = this.transform.toJSON( meta ).uuid;
}
| true |
Other | mrdoob | three.js | 5f4b4925d8ebbc91b8b81e5e2f7074f02ded3ad3.json | add Matrix3Node and optimize UVTransformNode | examples/webgl_materials_nodes.html | @@ -72,6 +72,7 @@
<script src="js/nodes/inputs/Vector3Node.js"></script>
<script src="js/nodes/inputs/Vector4Node.js"></script>
<script src="js/nodes/inputs/TextureNode.js"></script>
+ <script src="js/nodes/inputs/Matrix3Node.js"></script>
<script src="js/nodes/inputs/Matrix4Node.js"></script>
<script src="js/nodes/inputs/CubeTextureNode.js"></script>
@@ -860,7 +861,7 @@
function updateUVTransform() {
- texture.coord.compose( translate, THREE.Math.degToRad( rotate ), scale );
+ texture.coord.compose( translate, scale, THREE.Math.degToRad( rotate ) );
}
| true |
Other | mrdoob | three.js | b67e37fa726a625b3ea0a5dc209e5d5019245d08.json | Add support for dashed lines | examples/js/lines/LineMaterial.js | @@ -4,14 +4,21 @@
* parameters = {
* color: <hex>,
* linewidth: <float>,
+ * dashed: <boolean>,
+ * dashScale: <float>,
+ * dashSize: <float>,
+ * gapSize: <float>,
* resolution: <Vector2>, // to be set by renderer
* }
*/
THREE.UniformsLib.line = {
linewidth: { value: 1 },
- resolution: { value: new THREE.Vector2( 1, 1 ) }
+ resolution: { value: new THREE.Vector2( 1, 1 ) },
+ dashScale: { value: 1 },
+ dashSize: { value: 1 },
+ gapSize: { value: 1 } // todo FIX - maybe change to totalSize
};
@@ -42,6 +49,15 @@ THREE.ShaderLib[ 'line' ] = {
varying vec2 vUv;
+ #ifdef USE_DASH
+
+ uniform float dashScale;
+ attribute float instanceDistanceStart;
+ attribute float instanceDistanceEnd;
+ varying float vLineDistance;
+
+ #endif
+
void trimSegment( const in vec4 start, inout vec4 end ) {
// trim end segment so it terminates between the camera plane and the near plane
@@ -60,7 +76,15 @@ THREE.ShaderLib[ 'line' ] = {
void main() {
#ifdef USE_COLOR
+
vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
+
+ #endif
+
+ #ifdef USE_DASH
+
+ vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
+
#endif
float aspect = resolution.x / resolution.y;
@@ -158,18 +182,35 @@ THREE.ShaderLib[ 'line' ] = {
uniform vec3 diffuse;
uniform float opacity;
+ #ifdef USE_DASH
+
+ uniform float dashSize;
+ uniform float gapSize;
+
+ #endif
+
+ varying float vLineDistance;
+
#include <common>
#include <color_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
- varying vec2 vUv;
+ varying vec2 vUv;
void main() {
#include <clipping_planes_fragment>
+ #ifdef USE_DASH
+
+ if ( vUv.y < 0.5 || vUv.y > 0.5 ) discard; // discard endcaps
+
+ if ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
+
+ #endif
+
if ( vUv.y < 0.5 || vUv.y > 0.5 ) {
float a = vUv.x - 0.5;
@@ -209,6 +250,8 @@ THREE.LineMaterial = function ( parameters ) {
} );
+ this.dashed = false;
+
Object.defineProperties( this, {
color: {
@@ -247,6 +290,60 @@ THREE.LineMaterial = function ( parameters ) {
},
+ dashScale: {
+
+ enumerable: true,
+
+ get: function () {
+
+ return this.uniforms.dashScale.value;
+
+ },
+
+ set: function ( value ) {
+
+ this.uniforms.dashScale.value = value;
+
+ }
+
+ },
+
+ dashSize: {
+
+ enumerable: true,
+
+ get: function () {
+
+ return this.uniforms.dashSize.value;
+
+ },
+
+ set: function ( value ) {
+
+ this.uniforms.dashSize.value = value;
+
+ }
+
+ },
+
+ gapSize: {
+
+ enumerable: true,
+
+ get: function () {
+
+ return this.uniforms.gapSize.value;
+
+ },
+
+ set: function ( value ) {
+
+ this.uniforms.gapSize.value = value;
+
+ }
+
+ },
+
resolution: {
enumerable: true, | true |
Other | mrdoob | three.js | b67e37fa726a625b3ea0a5dc209e5d5019245d08.json | Add support for dashed lines | examples/js/lines/LineSegments2.js | @@ -20,6 +20,40 @@ THREE.LineSegments2.prototype = Object.assign( Object.create( THREE.Mesh.prototy
isLineSegments2: true,
+ computeLineDistances: ( function () { // for backwards-compatability, but could be a method of LineSegmentsGeometry...
+
+ var start = new THREE.Vector3();
+ var end = new THREE.Vector3();
+
+ return function computeLineDistances() {
+
+ var geometry = this.geometry;
+
+ var instanceStart = geometry.attributes.instanceStart;
+ var instanceEnd = geometry.attributes.instanceEnd;
+ var lineDistances = new Float32Array( 2 * instanceStart.data.count );
+
+ for ( var i = 0, j = 0, l = instanceStart.data.count; i < l; i ++, j += 2 ) {
+
+ start.fromBufferAttribute( instanceStart, i );
+ end.fromBufferAttribute( instanceEnd, i );
+
+ lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ];
+ lineDistances[ j + 1 ] = lineDistances[ j ] + start.distanceTo( end );
+
+ }
+
+ var instanceDistanceBuffer = new THREE.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
+
+ geometry.addAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
+ geometry.addAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
+
+ return this;
+
+ };
+
+ }() ),
+
copy: function ( source ) {
// todo | true |
Other | mrdoob | three.js | b67e37fa726a625b3ea0a5dc209e5d5019245d08.json | Add support for dashed lines | examples/js/lines/Wireframe.js | @@ -20,6 +20,40 @@ THREE.Wireframe.prototype = Object.assign( Object.create( THREE.Mesh.prototype )
isWireframe: true,
+ computeLineDistances: ( function () { // for backwards-compatability, but could be a method of LineSegmentsGeometry...
+
+ var start = new THREE.Vector3();
+ var end = new THREE.Vector3();
+
+ return function computeLineDistances() {
+
+ var geometry = this.geometry;
+
+ var instanceStart = geometry.attributes.instanceStart;
+ var instanceEnd = geometry.attributes.instanceEnd;
+ var lineDistances = new Float32Array( 2 * instanceStart.data.count );
+
+ for ( var i = 0, j = 0, l = instanceStart.data.count; i < l; i ++, j += 2 ) {
+
+ start.fromBufferAttribute( instanceStart, i );
+ end.fromBufferAttribute( instanceEnd, i );
+
+ lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ];
+ lineDistances[ j + 1 ] = lineDistances[ j ] + start.distanceTo( end );
+
+ }
+
+ var instanceDistanceBuffer = new THREE.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
+
+ geometry.addAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
+ geometry.addAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
+
+ return this;
+
+ };
+
+ }() ),
+
copy: function ( source ) {
// todo | true |
Other | mrdoob | three.js | b67e37fa726a625b3ea0a5dc209e5d5019245d08.json | Add support for dashed lines | examples/webgl_lines_fat.html | @@ -57,8 +57,9 @@
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
- var line, wireframe, renderer, scene, camera, controls;
- var line1, wireframe1;
+ var line, renderer, scene, camera, controls;
+ var line1;
+ var matLine, matLineBasic, matLineDashed;
var stats;
var gui;
@@ -80,7 +81,7 @@
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 1000 );
- camera.position.set( -40, 0, 60 );
+ camera.position.set( - 40, 0, 60 );
controls = new THREE.OrbitControls( camera, renderer.domElement );
controls.minDistance = 10;
@@ -115,16 +116,18 @@
geometry.setPositions( positions );
geometry.setColors( colors );
- var material = new THREE.LineMaterial( {
+ matLine = new THREE.LineMaterial( {
color: 0xffffff,
- linewidth: 10, // in pixels
+ linewidth: 5, // in pixels
vertexColors: THREE.VertexColors,
//resolution: // to be set by renderer, eventually
+ dashed: false
} );
- line = new THREE.Line2( geometry, material );
+ line = new THREE.Line2( geometry, matLine );
+ line.computeLineDistances();
line.scale.set( 1, 1, 1 );
scene.add( line );
@@ -135,44 +138,14 @@
geo.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
geo.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
- var mat = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } );
+ matLineBasic = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } );
+ matLineDashed = new THREE.LineDashedMaterial( { vertexColors: THREE.VertexColors, scale: 2, dashSize: 1, gapSize: 1 } );
- line1 = new THREE.Line( geo, mat );
+ line1 = new THREE.Line( geo, matLineBasic );
+ line1.computeLineDistances();
line1.visible = false;
scene.add( line1 );
-
- // THREE.Wireframe ( WireframeGeometry2, LineMaterial )
-
- //var geo = new THREE.BoxBufferGeometry( 16, 16, 4, 2, 2, 1 );
- //var geo = new THREE.IcosahedronBufferGeometry( 8, 0 );
- var geo = new THREE.PlaneBufferGeometry( 16, 16, 2, 2 );
-
- var geometry = new THREE.WireframeGeometry2( geo );
-
- var material = new THREE.LineMaterial( {
-
- color: 0x4080ff,
- linewidth: 10, // in pixels
- //resolution: // to be set by renderer, eventually
-
- } );
-
- wireframe = new THREE.Wireframe( geometry, material );
- wireframe.scale.set( 1, 1, 1 );
- scene.add( wireframe );
-
-
- // THREE.Line ( WireframeGeometry, LineBasicMaterial ) - rendered with gl.LINE
-
- geo = new THREE.WireframeGeometry( geo );
-
- var mat = new THREE.LineBasicMaterial( { color: 0x4080ff } );
-
- wireframe1 = new THREE.LineSegments( geo, mat );
- wireframe1.visible = false;
- scene.add( wireframe1 );
-
//
window.addEventListener( 'resize', onWindowResize, false );
@@ -203,13 +176,10 @@
stats.update();
- wireframe.geometry.maxInstancedCount = Math.floor( Date.now() / 1000 ) % wireframe.geometry.index.count - 1; // why - 1 needed ?
-
// main scene
// renderer will set this eventually
- line.material.resolution.set( window.innerWidth, window.innerHeight );
- wireframe.material.resolution.set( window.innerWidth, window.innerHeight );
+ matLine.resolution.set( window.innerWidth, window.innerHeight );
renderer.setViewport( 0, 0, window.innerWidth, window.innerHeight );
@@ -218,8 +188,7 @@
// inset scene
// renderer will set this eventually
- //line.material.resolution.set( insetWidth, insetHeight );
- //wireframe.material.resolution.set( insetWidth, insetHeight );
+ //matLine.resolution.set( insetWidth, insetHeight ); // not sure what behavior we want here...
renderer.clearDepth(); // important!
@@ -243,7 +212,10 @@
var param = {
'line type': 0,
- 'line width': 10
+ 'width (px)': 5,
+ 'dashed': false,
+ 'dash scale': 1,
+ 'dash / gap': 1
};
@@ -253,30 +225,81 @@
case '0':
line.visible = true;
- wireframe.visible = true;
line1.visible = false;
- wireframe1.visible = false;
break;
case '1':
line.visible = false;
- wireframe.visible = false;
line1.visible = true;
- wireframe1.visible = true;
break;
}
} );
- gui.add( param, 'line width', 1, 40, 1 ).onChange( function ( val ) {
+ gui.add( param, 'width (px)', 1, 10, 1 ).onChange( function ( val ) {
+
+ matLine.linewidth = val;
+
+ } );
+
+ gui.add( param, 'dashed' ).onChange( function ( val ) {
+
+ matLine.dashed = val;
- line.material.linewidth = val;
- wireframe.material.linewidth = val;
+ // dashed is implemented as a defines -- not as a uniform. this could be changed.
+ // ... or LineDashedMaterial could be implemented as a separate material
+ // temporary hack - renderer should do this eventually
+ if ( val ) matLine.defines.USE_DASH = ""; else delete matLine.defines.USE_DASH;
+ matLine.needsUpdate = true;
+
+ line1.material = val ? matLineDashed : matLineBasic;
+
+ } );
+
+ gui.add( param, 'dash scale', 0.5, 2, 0.1 ).onChange( function ( val ) {
+
+ matLine.dashScale = val;
+ matLineDashed.scale = val;
+
+ } );
+
+ gui.add( param, 'dash / gap', { '2 : 1': 0, '1 : 1': 1, '1 : 2': 2 } ).onChange( function ( val ) {
+
+ switch ( val ) {
+
+ case '0':
+ matLine.dashSize = 2;
+ matLine.gapSize = 1;
+
+ matLineDashed.dashSize = 2;
+ matLineDashed.gapSize = 1;
+
+ break;
+
+ case '1':
+ matLine.dashSize = 1;
+ matLine.gapSize = 1;
+
+ matLineDashed.dashSize = 1;
+ matLineDashed.gapSize = 1;
+
+ break;
+
+ case '2':
+ matLine.dashSize = 1;
+ matLine.gapSize = 2;
+
+ matLineDashed.dashSize = 1;
+ matLineDashed.gapSize = 2;
+
+ break;
+
+ }
} );
| true |
Other | mrdoob | three.js | 305938905e938196036840fb10670517c6020410.json | replace spaces with tabs | examples/webgl_lines_colorsplines.html | @@ -87,8 +87,8 @@
// Colors with BufferGeometry
var buffGeometry0 = new THREE.BufferGeometry(),
- buffGeometry1 = new THREE.BufferGeometry(),
- buffGeometry2 = new THREE.BufferGeometry();
+ buffGeometry1 = new THREE.BufferGeometry(),
+ buffGeometry2 = new THREE.BufferGeometry();
var subdivisions = 6;
@@ -120,71 +120,71 @@
}
- buffGeometry0.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
- buffGeometry1.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
- buffGeometry2.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
+ buffGeometry0.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
+ buffGeometry1.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
+ buffGeometry2.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
- buffGeometry0.addAttribute( 'color', new THREE.Float32BufferAttribute( colorArray0, 3 ) );
- buffGeometry1.addAttribute( 'color', new THREE.Float32BufferAttribute( colorArray1, 3 ) );
- buffGeometry2.addAttribute( 'color', new THREE.Float32BufferAttribute( colorArray2, 3 ) );
+ buffGeometry0.addAttribute( 'color', new THREE.Float32BufferAttribute( colorArray0, 3 ) );
+ buffGeometry1.addAttribute( 'color', new THREE.Float32BufferAttribute( colorArray1, 3 ) );
+ buffGeometry2.addAttribute( 'color', new THREE.Float32BufferAttribute( colorArray2, 3 ) );
// Colors with Geometry
- var geometry0 = new THREE.Geometry(),
- geometry2 = new THREE.Geometry(),
- geometry3 = new THREE.Geometry();
+ var geometry0 = new THREE.Geometry(),
+ geometry2 = new THREE.Geometry(),
+ geometry3 = new THREE.Geometry();
- var colors0 = [],
- colors1 = [],
- colors2 = [];
+ var colors0 = [],
+ colors1 = [],
+ colors2 = [];
- for ( i = 0; i < hilbertPoints.length; i++ ) {
+ for ( i = 0; i < hilbertPoints.length; i++ ) {
- geometry0.vertices.push( hilbertPoints[ i ] );
+ geometry0.vertices.push( hilbertPoints[ i ] );
- colors0[ i ] = new THREE.Color( 0xffffff );
- colors0[ i ].setHSL( 0.6, 1.0, Math.max( 0, ( 200 - hilbertPoints[ i ].x ) / 400 ) * 0.5 + 0.5 );
+ colors0[ i ] = new THREE.Color( 0xffffff );
+ colors0[ i ].setHSL( 0.6, 1.0, Math.max( 0, ( 200 - hilbertPoints[ i ].x ) / 400 ) * 0.5 + 0.5 );
- colors1[ i ] = new THREE.Color( 0xffffff );
- colors1[ i ].setHSL( 0.3, 1.0, Math.max( 0, ( 200 + hilbertPoints[ i ].x ) / 400 ) * 0.5 );
+ colors1[ i ] = new THREE.Color( 0xffffff );
+ colors1[ i ].setHSL( 0.3, 1.0, Math.max( 0, ( 200 + hilbertPoints[ i ].x ) / 400 ) * 0.5 );
- colors2[ i ] = new THREE.Color( 0xffffff );
- colors2[ i ].setHSL( i / hilbertPoints.length, 1.0, 0.5 );
+ colors2[ i ] = new THREE.Color( 0xffffff );
+ colors2[ i ].setHSL( i / hilbertPoints.length, 1.0, 0.5 );
- }
+ }
- geometry2.vertices = geometry3.vertices = geometry0.vertices;
+ geometry2.vertices = geometry3.vertices = geometry0.vertices;
- geometry0.colors = colors0;
- geometry2.colors = colors1;
- geometry3.colors = colors2;
+ geometry0.colors = colors0;
+ geometry2.colors = colors1;
+ geometry3.colors = colors2;
- // Create lines and add to scene
+ // Create lines and add to scene
- material = new THREE.LineBasicMaterial( { color: 0xffffff, opacity: 1, linewidth: 3, vertexColors: THREE.VertexColors } );
+ material = new THREE.LineBasicMaterial( { color: 0xffffff, opacity: 1, linewidth: 3, vertexColors: THREE.VertexColors } );
- var line, p, scale = 0.3, d = 225;
- var parameters = [
- [ material, scale * 1.5, [ - d, - d / 2, 0 ], buffGeometry0 ],
- [ material, scale * 1.5, [ 0, - d / 2, 0 ], buffGeometry1 ],
- [ material, scale * 1.5, [ d, - d / 2, 0 ], buffGeometry2 ],
+ var line, p, scale = 0.3, d = 225;
+ var parameters = [
+ [ material, scale * 1.5, [ - d, - d / 2, 0 ], buffGeometry0 ],
+ [ material, scale * 1.5, [ 0, - d / 2, 0 ], buffGeometry1 ],
+ [ material, scale * 1.5, [ d, - d / 2, 0 ], buffGeometry2 ],
- [ material, scale * 1.5, [ - d, d / 2, 0 ], geometry0 ],
- [ material, scale * 1.5, [ 0, d / 2, 0 ], geometry2 ],
- [ material, scale * 1.5, [ d, d / 2, 0 ], geometry3 ],
- ];
+ [ material, scale * 1.5, [ - d, d / 2, 0 ], geometry0 ],
+ [ material, scale * 1.5, [ 0, d / 2, 0 ], geometry2 ],
+ [ material, scale * 1.5, [ d, d / 2, 0 ], geometry3 ],
+ ];
- for ( i = 0; i < parameters.length; i++ ) {
+ for ( i = 0; i < parameters.length; i++ ) {
- p = parameters[ i ];
- line = new THREE.Line( p[ 3 ], p[ 0 ] );
- line.scale.x = line.scale.y = line.scale.z = p[ 1 ];
- line.position.x = p[ 2 ][ 0 ];
- line.position.y = p[ 2 ][ 1 ];
- line.position.z = p[ 2 ][ 2 ];
- scene.add( line );
+ p = parameters[ i ];
+ line = new THREE.Line( p[ 3 ], p[ 0 ] );
+ line.scale.x = line.scale.y = line.scale.z = p[ 1 ];
+ line.position.x = p[ 2 ][ 0 ];
+ line.position.y = p[ 2 ][ 1 ];
+ line.position.z = p[ 2 ][ 2 ];
+ scene.add( line );
- }
+ }
// Input Event Listeners
| false |
Other | mrdoob | three.js | 907c5fd33342b82466819f8bd67f604ada5de205.json | Remove modifications webvr sandbox | examples/webvr_sandbox.html | @@ -24,7 +24,7 @@
<script>
- var box, camera, scene, renderer, poseTarget;
+ var camera, scene, renderer;
var reflector;
@@ -123,15 +123,6 @@
mesh.receiveShadow = true;
reflector.add( mesh );
-
- box = new THREE.Mesh(new THREE.BoxGeometry());
- var boxPivot = new THREE.Object3D();
- boxPivot.add(box);
- boxPivot.position.z = -3;
- scene.add(boxPivot);
-
- poseTarget = new THREE.Object3D();
-
//
renderer = new THREE.WebGLRenderer( { antialias: true } );
@@ -140,14 +131,14 @@
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.shadowMap.enabled = true;
renderer.vr.enabled = true;
- renderer.vr.setPoseTarget(poseTarget);
document.body.appendChild( renderer.domElement );
document.body.appendChild( WEBVR.createButton( renderer ) );
//
window.addEventListener( 'resize', onWindowResize, false );
+
}
function onWindowResize() {
@@ -172,9 +163,6 @@
mesh.rotation.x = time * 2;
mesh.rotation.y = time * 5;
- box.position.setFromMatrixPosition(poseTarget.matrixWorld);
- box.quaternion.setFromRotationMatrix(poseTarget.matrixWorld);
-
renderer.render( scene, camera );
} | false |
Other | mrdoob | three.js | 208d643b11b38906c4cc22c6841bc5c291a82a46.json | Add missing line | src/renderers/webvr/WebVRManager.js | @@ -132,6 +132,7 @@ function WebVRManager( renderer ) {
standingMatrix.makeTranslation(0, scope.userHeight, 0);
}
+ standingMatrixInverse.getInverse( standingMatrix );
poseObject.position.applyMatrix4( standingMatrix );
poseObject.updateMatrixWorld();
| false |
Other | mrdoob | three.js | 59c50e7bac2c71463a95a57960118680d1c16d60.json | Fix poseObject transform (#2)
* fix standing matrix application
* demonstrate setPoseTarget
* update build | examples/webvr_sandbox.html | @@ -24,7 +24,7 @@
<script>
- var camera, scene, renderer;
+ var box, camera, scene, renderer, poseTarget;
var reflector;
@@ -123,6 +123,15 @@
mesh.receiveShadow = true;
reflector.add( mesh );
+
+ box = new THREE.Mesh(new THREE.BoxGeometry());
+ var boxPivot = new THREE.Object3D();
+ boxPivot.add(box);
+ boxPivot.position.z = -3;
+ scene.add(boxPivot);
+
+ poseTarget = new THREE.Object3D();
+
//
renderer = new THREE.WebGLRenderer( { antialias: true } );
@@ -131,14 +140,14 @@
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.shadowMap.enabled = true;
renderer.vr.enabled = true;
+ renderer.vr.setPoseTarget(poseTarget);
document.body.appendChild( renderer.domElement );
document.body.appendChild( WEBVR.createButton( renderer ) );
//
window.addEventListener( 'resize', onWindowResize, false );
-
}
function onWindowResize() {
@@ -163,6 +172,9 @@
mesh.rotation.x = time * 2;
mesh.rotation.y = time * 5;
+ box.position.setFromMatrixPosition(poseTarget.matrixWorld);
+ box.quaternion.setFromRotationMatrix(poseTarget.matrixWorld);
+
renderer.render( scene, camera );
} | true |
Other | mrdoob | three.js | 59c50e7bac2c71463a95a57960118680d1c16d60.json | Fix poseObject transform (#2)
* fix standing matrix application
* demonstrate setPoseTarget
* update build | src/renderers/webvr/WebVRManager.js | @@ -112,26 +112,25 @@ function WebVRManager( renderer ) {
poseObject.position.fromArray( pose.position );
- }
+ }
if ( pose.orientation !== null ) {
poseObject.quaternion.fromArray( pose.orientation );
}
- poseObject.updateMatrixWorld();
-
var stageParameters = device.stageParameters;
-
+
if (stageParameters) {
standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
} else {
standingMatrix.makeTranslation(0, scope.userHeight, 0);
}
standingMatrixInverse.getInverse( standingMatrix );
- poseObject.matrixWorld.multiply( standingMatrix );
+ poseObject.position.applyMatrix4( standingMatrix );
+ poseObject.updateMatrixWorld();
camera.matrixWorldInverse.multiply( standingMatrixInverse );
if ( device.isPresenting === false ) return camera; | true |
Other | mrdoob | three.js | f19cfa30688ec4bf0df96728e80eed0a7bdc5747.json | Remove redundant userHeight | examples/js/vr/ViveController.js | @@ -72,7 +72,7 @@ THREE.ViveController = function ( id ) {
if ( pose.position !== null ) scope.position.fromArray( pose.position );
if ( pose.orientation !== null ) scope.quaternion.fromArray( pose.orientation );
scope.matrix.compose( scope.position, scope.quaternion, scope.scale );
- scope.matrix.multiplyMatrices( scope.standingMatrix, scope.matrix );
+ scope.matrix.premultiply( scope.standingMatrix );
scope.matrixWorldNeedsUpdate = true;
scope.visible = true;
| true |
Other | mrdoob | three.js | f19cfa30688ec4bf0df96728e80eed0a7bdc5747.json | Remove redundant userHeight | src/renderers/webvr/WebVRManager.js | @@ -112,11 +112,7 @@ function WebVRManager( renderer ) {
poseObject.position.fromArray( pose.position );
- } else {
-
- poseObject.position.set( 0, scope.userHeight, 0 );
-
- }
+ }
if ( pose.orientation !== null ) {
| true |
Other | mrdoob | three.js | cfd22c2c4f4621d770f3a5af68b0533e69af5959.json | Reintroduce standing matrix | examples/js/vr/ViveController.js | @@ -40,6 +40,7 @@ THREE.ViveController = function ( id ) {
}
this.matrixAutoUpdate = false;
+ this.standingMatrix = new THREE.Matrix4();
this.getGamepad = function () {
@@ -71,6 +72,7 @@ THREE.ViveController = function ( id ) {
if ( pose.position !== null ) scope.position.fromArray( pose.position );
if ( pose.orientation !== null ) scope.quaternion.fromArray( pose.orientation );
scope.matrix.compose( scope.position, scope.quaternion, scope.scale );
+ scope.matrix.multiplyMatrices( scope.standingMatrix, scope.matrix );
scope.matrixWorldNeedsUpdate = true;
scope.visible = true;
| true |
Other | mrdoob | three.js | cfd22c2c4f4621d770f3a5af68b0533e69af5959.json | Reintroduce standing matrix | examples/webvr_vive.html | @@ -58,7 +58,6 @@
scene.background = new THREE.Color( 0x505050 );
var user = new THREE.Group();
- user.position.set( 0, 1.6, 0 );
scene.add( user );
camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.1, 10 );
@@ -165,9 +164,11 @@
// controllers
controller1 = new THREE.ViveController( 0 );
+ controller1.standingMatrix = renderer.vr.getStandingMatrix();
user.add( controller1 );
controller2 = new THREE.ViveController( 1 );
+ controller2.standingMatrix = renderer.vr.getStandingMatrix();
user.add( controller2 );
var loader = new THREE.OBJLoader(); | true |
Other | mrdoob | three.js | cfd22c2c4f4621d770f3a5af68b0533e69af5959.json | Reintroduce standing matrix | examples/webvr_vive_dragging.html | @@ -59,7 +59,6 @@
scene.background = new THREE.Color( 0x808080 );
var user = new THREE.Group();
- user.position.set( 0, 1.6, 0 );
scene.add( user );
camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.1, 10 );
@@ -143,11 +142,13 @@
// controllers
controller1 = new THREE.ViveController( 0 );
+ controller1.standingMatrix = renderer.vr.getStandingMatrix();
controller1.addEventListener( 'triggerdown', onTriggerDown );
controller1.addEventListener( 'triggerup', onTriggerUp );
user.add( controller1 );
controller2 = new THREE.ViveController( 1 );
+ controller2.standingMatrix = renderer.vr.getStandingMatrix();
controller2.addEventListener( 'triggerdown', onTriggerDown );
controller2.addEventListener( 'triggerup', onTriggerUp );
user.add( controller2 ); | true |
Other | mrdoob | three.js | cfd22c2c4f4621d770f3a5af68b0533e69af5959.json | Reintroduce standing matrix | examples/webvr_vive_paint.html | @@ -70,7 +70,6 @@
scene.background = new THREE.Color( 0x222222 );
var user = new THREE.Group();
- user.position.set( 0, 1.6, 0 );
scene.add( user );
camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.01, 50 );
@@ -142,11 +141,13 @@
// controllers
controller1 = new THREE.PaintViveController( 0 );
+ controller1.standingMatrix = renderer.vr.getStandingMatrix();
controller1.userData.points = [ new THREE.Vector3(), new THREE.Vector3() ];
controller1.userData.matrices = [ new THREE.Matrix4(), new THREE.Matrix4() ];
user.add( controller1 );
controller2 = new THREE.PaintViveController( 1 );
+ controller2.standingMatrix = renderer.vr.getStandingMatrix();
controller2.userData.points = [ new THREE.Vector3(), new THREE.Vector3() ];
controller2.userData.matrices = [ new THREE.Matrix4(), new THREE.Matrix4() ];
user.add( controller2 ); | true |
Other | mrdoob | three.js | cfd22c2c4f4621d770f3a5af68b0533e69af5959.json | Reintroduce standing matrix | examples/webvr_vive_sculpt.html | @@ -60,7 +60,6 @@
scene.background = new THREE.Color( 0x222222 );
var user = new THREE.Group();
- user.position.set( 0, 1.6, 0 );
scene.add( user );
camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.01, 50 );
@@ -124,9 +123,11 @@
// controllers
controller1 = new THREE.ViveController( 0 );
+ controller1.standingMatrix = renderer.vr.getStandingMatrix();
user.add( controller1 );
controller2 = new THREE.ViveController( 1 );
+ controller2.standingMatrix = renderer.vr.getStandingMatrix();
user.add( controller2 );
var loader = new THREE.OBJLoader(); | true |
Other | mrdoob | three.js | cfd22c2c4f4621d770f3a5af68b0533e69af5959.json | Reintroduce standing matrix | src/Three.Legacy.js | @@ -1587,16 +1587,6 @@ Object.defineProperties( WebGLRenderTarget.prototype, {
//
-Object.assign( WebVRManager.prototype, {
-
- getStandingMatrix: function () {
-
- console.warn( 'THREE.WebVRManager: .getStandingMatrix() has been removed.' );
-
- }
-
-} );
-
Object.defineProperties( WebVRManager.prototype, {
standing: { | true |
Other | mrdoob | three.js | cfd22c2c4f4621d770f3a5af68b0533e69af5959.json | Reintroduce standing matrix | src/renderers/webvr/WebVRManager.js | @@ -16,6 +16,11 @@ function WebVRManager( renderer ) {
var poseTarget = null;
+ var standingMatrix = new Matrix4();
+ var standingMatrixInverse = new Matrix4();
+
+ scope.userHeight = 1.6;
+
if ( typeof window !== 'undefined' && 'VRFrameData' in window ) {
frameData = new window.VRFrameData();
@@ -109,7 +114,7 @@ function WebVRManager( renderer ) {
} else {
- poseObject.position.set( 0, 0, 0 );
+ poseObject.position.set( 0, scope.userHeight, 0 );
}
@@ -121,6 +126,18 @@ function WebVRManager( renderer ) {
poseObject.updateMatrixWorld();
+ var stageParameters = device.stageParameters;
+
+ if (stageParameters) {
+ standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
+ } else {
+ standingMatrix.makeTranslation(0, scope.userHeight, 0);
+ }
+
+ standingMatrixInverse.getInverse( standingMatrix );
+ poseObject.matrixWorld.multiply( standingMatrix );
+ camera.matrixWorldInverse.multiply( standingMatrixInverse );
+
if ( device.isPresenting === false ) return camera;
//
@@ -137,6 +154,9 @@ function WebVRManager( renderer ) {
cameraL.matrixWorldInverse.fromArray( frameData.leftViewMatrix );
cameraR.matrixWorldInverse.fromArray( frameData.rightViewMatrix );
+ cameraL.matrixWorldInverse.multiply( standingMatrixInverse );
+ cameraR.matrixWorldInverse.multiply( standingMatrixInverse );
+
var parent = poseObject.parent;
if ( parent !== null ) {
@@ -187,6 +207,12 @@ function WebVRManager( renderer ) {
};
+ this.getStandingMatrix = function () {
+
+ return standingMatrix;
+
+ };
+
this.submitFrame = function () {
if ( device && device.isPresenting ) device.submitFrame(); | true |
Other | mrdoob | three.js | 3ee08f5c14e67670a2d4ab10174f44d62a1cca38.json | Update DirectionalLightShadow.html (#23952)
* Update DirectionalLightShadow.html
DirectionalLight only takes two arguments in it's constructor now.
* Update DirectionalLightShadow.html
Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org> | docs/api/en/lights/shadows/DirectionalLightShadow.html | @@ -28,7 +28,7 @@ <h2>Code Example</h2>
renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
//Create a DirectionalLight and turn on shadows for the light
- const light = new THREE.DirectionalLight( 0xffffff, 1, 100 );
+ const light = new THREE.DirectionalLight( 0xffffff, 1 );
light.position.set( 0, 1, 0 ); //default; light shining from top
light.castShadow = true; // default false
scene.add( light ); | true |
Other | mrdoob | three.js | 3ee08f5c14e67670a2d4ab10174f44d62a1cca38.json | Update DirectionalLightShadow.html (#23952)
* Update DirectionalLightShadow.html
DirectionalLight only takes two arguments in it's constructor now.
* Update DirectionalLightShadow.html
Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org> | docs/api/zh/lights/shadows/DirectionalLightShadow.html | @@ -25,7 +25,7 @@ <h2>代码示例</h2>
renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
//Create a DirectionalLight and turn on shadows for the light
- const light = new THREE.DirectionalLight( 0xffffff, 1, 100 );
+ const light = new THREE.DirectionalLight( 0xffffff, 1 );
light.position.set( 0, 1, 0 ); //default; light shining from top
light.castShadow = true; // default false
scene.add( light ); | true |
Other | mrdoob | three.js | 6857d8de673a529ca75b2cd3dcaa8c89b5683a46.json | make DOF work again. | examples/js/postprocessing/BokehPass.js | @@ -33,6 +33,8 @@ THREE.BokehPass = function ( scene, camera, params ) {
// depth material
this.materialDepth = new THREE.MeshDepthMaterial();
+ this.materialDepth.depthPacking = THREE.RGBADepthPacking;
+ this.materialDepth.blending = THREE.NoBlending;
// bokeh material
@@ -51,8 +53,11 @@ THREE.BokehPass = function ( scene, camera, params ) {
bokehUniforms[ "aspect" ].value = aspect;
bokehUniforms[ "aperture" ].value = aperture;
bokehUniforms[ "maxblur" ].value = maxblur;
+ bokehUniforms[ "nearClip" ].value = camera.near;
+ bokehUniforms[ "farClip" ].value = camera.far;
this.materialBokeh = new THREE.ShaderMaterial( {
+ defines: bokehShader.defines,
uniforms: bokehUniforms,
vertexShader: bokehShader.vertexShader,
fragmentShader: bokehShader.fragmentShader
@@ -68,6 +73,9 @@ THREE.BokehPass = function ( scene, camera, params ) {
this.quad2.frustumCulled = false; // Avoid getting clipped
this.scene2.add( this.quad2 );
+ this.oldClearColor = new THREE.Color();
+ this.oldClearAlpha = 1;
+
};
THREE.BokehPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), {
@@ -82,11 +90,20 @@ THREE.BokehPass.prototype = Object.assign( Object.create( THREE.Pass.prototype )
this.scene.overrideMaterial = this.materialDepth;
+ this.oldClearColor.copy( renderer.getClearColor() );
+ this.oldClearAlpha = renderer.getClearAlpha();
+ var oldAutoClear = renderer.autoClear;
+ renderer.autoClear = false;
+
+ renderer.setClearColor( 0xffffff );
+ renderer.setClearAlpha( 1.0 );
renderer.render( this.scene, this.camera, this.renderTargetDepth, true );
// Render bokeh composite
this.uniforms[ "tColor" ].value = readBuffer.texture;
+ this.uniforms[ "nearClip" ].value = this.camera.near;
+ this.uniforms[ "farClip" ].value = this.camera.far;
if ( this.renderToScreen ) {
@@ -99,7 +116,10 @@ THREE.BokehPass.prototype = Object.assign( Object.create( THREE.Pass.prototype )
}
this.scene.overrideMaterial = null;
-
+ renderer.setClearColor( this.oldClearColor );
+ renderer.setClearAlpha( this.oldClearAlpha );
+ renderer.autoClear = this.oldAutoClear;
+
}
} ); | true |
Other | mrdoob | three.js | 6857d8de673a529ca75b2cd3dcaa8c89b5683a46.json | make DOF work again. | examples/js/shaders/BokehShader.js | @@ -8,14 +8,21 @@
THREE.BokehShader = {
+ defines: {
+ "DEPTH_PACKING": 1,
+ "PERSPECTIVE_CAMERA": 1,
+ },
+
uniforms: {
"tColor": { value: null },
"tDepth": { value: null },
"focus": { value: 1.0 },
"aspect": { value: 1.0 },
"aperture": { value: 0.025 },
- "maxblur": { value: 1.0 }
+ "maxblur": { value: 1.0 },
+ "nearClip": { value: 1.0 },
+ "farClip": { value: 1000.0 },
},
@@ -33,6 +40,7 @@ THREE.BokehShader = {
].join( "\n" ),
fragmentShader: [
+ "#include <common>",
"varying vec2 vUv;",
@@ -42,16 +50,38 @@ THREE.BokehShader = {
"uniform float maxblur;", // max blur amount
"uniform float aperture;", // aperture - bigger values for shallower depth of field
+ "uniform float nearClip;",
+ "uniform float farClip;",
+
"uniform float focus;",
"uniform float aspect;",
+ "#include <packing>",
+
+ "float getDepth( const in vec2 screenPosition ) {",
+ " #if DEPTH_PACKING == 1",
+ " return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );",
+ " #else",
+ " return texture2D( tDepth, screenPosition ).x;",
+ " #endif",
+ "}",
+
+ "float getViewZ( const in float depth ) {",
+ " #if PERSPECTIVE_CAMERA == 1",
+ " return perspectiveDepthToViewZ( depth, nearClip, farClip );",
+ " #else",
+ " return orthoDepthToViewZ( depth, nearClip, farClip );",
+ " #endif",
+ "}",
+
+
"void main() {",
"vec2 aspectcorrect = vec2( 1.0, aspect );",
+
+ "float viewZ = getViewZ( getDepth( vUv ) );",
- "vec4 depth1 = texture2D( tDepth, vUv );",
-
- "float factor = depth1.x - focus;",
+ "float factor = ( focus + viewZ );", // viewZ is <= 0, so this is a difference equation
"vec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );",
| true |
Other | mrdoob | three.js | 6857d8de673a529ca75b2cd3dcaa8c89b5683a46.json | make DOF work again. | examples/webgl_postprocessing_dof.html | @@ -176,26 +176,27 @@
var effectController = {
- focus: 1.0,
- aperture: 0.025,
+ focus: 500.0,
+ aperture: 5,
maxblur: 1.0
};
var matChanger = function( ) {
postprocessing.bokeh.uniforms[ "focus" ].value = effectController.focus;
- postprocessing.bokeh.uniforms[ "aperture" ].value = effectController.aperture;
+ postprocessing.bokeh.uniforms[ "aperture" ].value = effectController.aperture * 0.00001;
postprocessing.bokeh.uniforms[ "maxblur" ].value = effectController.maxblur;
};
var gui = new dat.GUI();
- gui.add( effectController, "focus", 0.0, 3.0, 0.025 ).onChange( matChanger );
- gui.add( effectController, "aperture", 0.001, 0.2, 0.001 ).onChange( matChanger );
+ gui.add( effectController, "focus", 10.0, 3000.0, 10 ).onChange( matChanger );
+ gui.add( effectController, "aperture", 0, 10, 0.1 ).onChange( matChanger );
gui.add( effectController, "maxblur", 0.0, 3.0, 0.025 ).onChange( matChanger );
gui.close();
+ matChanger();
}
function onDocumentMouseMove( event ) { | true |
Other | mrdoob | three.js | 8d208786312da8ca3000a6b584948c0b6cb70ec1.json | Fix camera in x-loader example | examples/webgl_loader_x.html | @@ -215,13 +215,13 @@
renderer.setSize(window.innerWidth, window.innerHeight);
container.appendChild(renderer.domElement);
+ camera.position.set(2, 18, 28);
+ camera.up.set(0, 1, 0);
+
controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.target.set(0, 12, 0);
controls.update();
- camera.position.set(2, 18, 28);
- camera.up.set(0, 1, 0);
-
var light = new THREE.DirectionalLight(0xeeeeff, 2);
light.position.set(10, 100, 1).normalize();
scene.add(light); | false |
Other | mrdoob | three.js | 5e64b96df5b674a9d83ba1bb76d6cf35329c0e08.json | Remove accidental white space | src/math/Sphere.js | @@ -104,14 +104,13 @@ Object.assign( Sphere.prototype, {
return box.intersectsSphere( this );
},
-
+
intersectsPlane: function ( plane ) {
return Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;
},
-
clampPoint: function ( point, optionalTarget ) {
var deltaLengthSq = this.center.distanceToSquared( point ); | false |
Other | mrdoob | three.js | 5806d75e8cbca6e5e5bdccc16bc2b5f3424367f7.json | Fix distance of sphere center to plane
As per issue #11818, use Hessian Normal Form for calculating distance of sphere center to plane when determining if the sphere intersects a plane. | src/math/Sphere.js | @@ -104,21 +104,14 @@ Object.assign( Sphere.prototype, {
return box.intersectsSphere( this );
},
-
+
intersectsPlane: function ( plane ) {
- // We use the following equation to compute the signed distance from
- // the center of the sphere to the plane.
- //
- // distance = q * n - d
- //
- // If this distance is greater than the radius of the sphere,
- // then there is no intersection.
-
- return Math.abs( this.center.dot( plane.normal ) - plane.constant ) <= this.radius;
+ return Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;
},
+
clampPoint: function ( point, optionalTarget ) {
var deltaLengthSq = this.center.distanceToSquared( point ); | false |
Other | mrdoob | three.js | 4f29dbb180772ae44d8d97544113709e226eeb87.json | Fix export for multiple materials per mesh. | utils/exporters/blender/addons/io_three/exporter/api/object.py | @@ -98,11 +98,12 @@ def cast_shadow(obj):
ret = None
return ret
elif obj.type == MESH:
- mat = material(obj)
- if mat:
- return data.materials[mat].use_cast_shadows
- else:
- return False
+ mats = material(obj)
+ if mats:
+ for m in mats:
+ if data.materials[m].use_cast_shadows:
+ return True
+ return False
@_object
@@ -127,8 +128,10 @@ def material(obj):
"""
logger.debug('object.material(%s)', obj)
+
try:
- return obj.material_slots[0].name
+ matName = obj.material_slots[0].name # manthrax: Make this throw an error on an empty material array, resulting in non-material
+ return [o.name for o in obj.material_slots]
except IndexError:
pass
@@ -361,13 +364,15 @@ def receive_shadow(obj):
"""
if obj.type == MESH:
- mat = material(obj)
- if mat:
- return data.materials[mat].use_shadows
- else:
- return False
+ mats = material(obj)
+ if mats:
+ for m in mats:
+ if data.materials[m].use_shadows:
+ return True
+ return False
-AXIS_CONVERSION = axis_conversion(to_forward='Z', to_up='Y').to_4x4()
+# manthrax: TODO: Would like to evaluate wether this axis conversion stuff is still neccesary AXIS_CONVERSION = mathutils.Matrix()
+AXIS_CONVERSION = axis_conversion(to_forward='Z', to_up='Y').to_4x4()
@_object
def matrix(obj, options): | true |
Other | mrdoob | three.js | 4f29dbb180772ae44d8d97544113709e226eeb87.json | Fix export for multiple materials per mesh. | utils/exporters/blender/addons/io_three/exporter/object.py | @@ -90,13 +90,21 @@ def _node_setup(self):
if self.options.get(constants.MATERIALS):
logger.info("Parsing materials for %s", self.node)
- material_name = api.object.material(self.node)
- if material_name:
- logger.info("Material found %s", material_name)
- material_inst = self.scene.material(material_name)
- self[constants.MATERIAL] = material_inst[constants.UUID]
+
+
+ material_names = api.object.material(self.node) #manthrax: changes for multimaterial start here
+ if material_names:
+ logger.info("Got material names for this object:",material_names);
+ materialArray = [self.scene.material(objname)[constants.UUID] for objname in material_names]
+ if len(materialArray) == 0: # If no materials.. dont export a material entry
+ materialArray = None
+ elif len(materialArray) == 1: # If only one material, export material UUID singly, not as array
+ materialArray = materialArray[0]
+ # else export array of material uuids
+ self[constants.MATERIAL] = materialArray
+ logger.info("materials:",self[constants.MATERIAL]);
else:
- logger.info("%s has no materials", self.node)
+ logger.info("%s has no materials", self.node) #manthrax: end multimaterial
# TODO (abelnation): handle Area lights
casts_shadow = (constants.MESH, | true |
Other | mrdoob | three.js | c24eed3903ba6841eedb1ac3976e2ed21cc26297.json | Remove THREE. prefix from Vector3 | src/materials/MeshDistanceMaterial.js | @@ -1,4 +1,5 @@
import { Material } from './Material';
+import { Vector3 } from '../math/Vector3.js';
/**
* @author WestLangley / http://github.com/WestLangley
@@ -29,7 +30,7 @@ function MeshDistanceMaterial( parameters ) {
this.type = 'MeshDistanceMaterial';
- this.referencePosition = new THREE.Vector3();
+ this.referencePosition = new Vector3();
this.nearDistance = 1;
this.farDistance = 1000;
| false |
Other | mrdoob | three.js | 5740f920b35a8771be6bc7aede740e906de7a417.json | WebGLShadowMap minor clean up. | src/renderers/WebGLRenderer.js | @@ -309,7 +309,7 @@ function WebGLRenderer( parameters ) {
// shadow map
- var shadowMap = new WebGLShadowMap( this, shadowsArray, objects, capabilities );
+ var shadowMap = new WebGLShadowMap( _this, shadowsArray, objects, capabilities.maxTextureSize );
this.shadowMap = shadowMap;
| true |
Other | mrdoob | three.js | 5740f920b35a8771be6bc7aede740e906de7a417.json | WebGLShadowMap minor clean up. | src/renderers/webgl/WebGLShadowMap.js | @@ -15,15 +15,15 @@ import { Vector2 } from '../../math/Vector2';
import { Matrix4 } from '../../math/Matrix4';
import { Frustum } from '../../math/Frustum';
-function WebGLShadowMap( _renderer, _shadows, _objects, capabilities ) {
+function WebGLShadowMap( _renderer, _shadows, _objects, maxTextureSize ) {
var _gl = _renderer.context,
_state = _renderer.state,
_frustum = new Frustum(),
_projScreenMatrix = new Matrix4(),
_shadowMapSize = new Vector2(),
- _maxShadowMapSize = new Vector2( capabilities.maxTextureSize, capabilities.maxTextureSize ),
+ _maxShadowMapSize = new Vector2( maxTextureSize, maxTextureSize ),
_lookTarget = new Vector3(),
_lightPositionWorld = new Vector3(), | true |
Other | mrdoob | three.js | efccbfee0d27bf44503454d3d9f292b76a243f3e.json | Correct some inaccuracies and clean up | docs/api/math/Plane.html | @@ -11,9 +11,8 @@
<h1>[name]</h1>
<div class="desc">
- A two dimensional surface that extends infinitely in 3d space, defined by
- a [link:https://en.wikipedia.org/wiki/Normal_(geometry) normal vector], and a
- distance from the origin along the normal.
+ A two dimensional surface that extends infinitely in 3d space, represented in [link:http://mathworld.wolfram.com/HessianNormalForm.html Hessian normal form]
+ by a normal vector and a constant.
</div>
@@ -22,10 +21,8 @@ <h2>Constructor</h2>
<h3>[name]( [page:Vector3 normal], [page:Float constant] )</h3>
<div>
- [page:Vector3 normal] - (optional) a [page:Vector3] defining the direction of the
- plane. Default is *(1, 0, 0)*.<br />
- [page:Float constant] - (optional) the negative distance from the origin to the plane along
- the [page:Vector3 normal] vector. Default is *0*.
+ [page:Vector3 normal] - (optional) a [page:Vector3] defining the normal of the plane. Default is *(1, 0, 0)*.<br />
+ [page:Float constant] - (optional) the signed distance from the origin to the plane. Default is *0*.
</div>
@@ -68,10 +65,10 @@ <h3>[method:Plane copy]( [page:Plane plane] )</h3>
</div>
<h3>[method:Float distanceToPoint]( [page:Vector3 point] )</h3>
- <div>Returns the smallest distance from the [page:Vector3 point] to the plane.</div>
+ <div>Returns the signed distance from the [page:Vector3 point] to the plane.</div>
<h3>[method:Float distanceToSphere]( [page:Sphere sphere] )</h3>
- <div>Returns the smallest distance from the [page:Sphere sphere] to the plane.</div>
+ <div>Returns the signed distance from the [page:Sphere sphere] to the plane.</div>
<h3>[method:Boolean equals]( [page:Plane plane] )</h3>
<div>
@@ -113,8 +110,7 @@ <h3>[method:Boolean intersectsSphere]( [page:Sphere sphere] )</h3>
<h3>[method:Plane negate]()</h3>
<div>
- Negates both the normal vector and constant, effectively mirroring the plane across
- the origin.
+ Negates both the normal vector and the constant.
</div>
<h3>[method:Plane normalize]()</h3>
@@ -123,32 +119,19 @@ <h3>[method:Plane normalize]()</h3>
value accordingly.
</div>
- <h3>[method:Vector3 orthoPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
- <div>
- [page:Vector3 point] - [page:Vector3] <br />
- [page:Vector3 optionalTarget] - (optional) if specified, the result will be copied
- into this [page:Vector3], otherwise a new [page:Vector3] will be created.<br /><br />
-
- Returns a vector in the same direction as the Plane's normal, but with magnitude
- equal to the passed point's original distance to the plane.
- </div>
-
<h3>[method:Vector3 projectPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
<div>
[page:Vector3 point] - the [page:Vector3] to project onto the plane.<br />
[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3],
otherwise a new [page:Vector3] will be created.<br /><br />
- Projects a [page:Vector3 point] onto the plane. The projected point is the closest
- point on the plane to the passed point, so a line drawn from the projected point
- and the passed point would be orthogonal to the plane.
+ Projects a [page:Vector3 point] onto the plane.
</div>
<h3>[method:Plane set]( [page:Vector3 normal], [page:Float constant] )</h3>
<div>
- [page:Vector3 normal] - a [page:Vector3] defining the direction of the plane.<br />
- [page:Float constant] - (optional) the negative distance from the origin to the plane along
- the [page:Vector3 normal] vector. Default is *0*.<br /><br />
+ [page:Vector3 normal] - a [page:Vector3] defining the normal of the plane.<br />
+ [page:Float constant] - the signed distance from the origin to the plane. Default is *0*.<br /><br />
Sets the plane's [page:.normal normal] and [page:.constant constant] properties.
</div>
@@ -160,7 +143,7 @@ <h3>[method:Plane setComponents]( [page:Float x], [page:Float y], [page:Float z]
[page:Float z] - z value of the normal vector.<br />
[page:Float w] - the value of the plane's [page:.constant constant] property.<br /><br />
- Set the individual components that make up the plane.
+ Set the individual components that define the plane.
</div>
<h3>[method:Plane setFromCoplanarPoints]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c] )</h3>
@@ -170,12 +153,12 @@ <h3>[method:Plane setFromCoplanarPoints]( [page:Vector3 a], [page:Vector3 b], [p
[page:Vector3 a] - third point on the plane.<br /><br />
Defines the plane based on the 3 provided points. The winding order is counter
- clockwise, and determines which direction the [page:.normal normal] will point.
+ clockwise, and determines the direction the [page:.normal normal].
</div>
<h3>[method:Plane setFromNormalAndCoplanarPoint]( [page:Vector3 normal], [page:Vector3 point] ) [page:Vector3 this]</h3>
<div>
- [page:Vector3 normal] - a [page:Vector3] defining the direction of the plane.<br />
+ [page:Vector3 normal] - a [page:Vector3] defining the normal of the plane.<br />
[page:Vector3 point] - [page:Vector3]<br /><br />
Sets the plane's properties as defined by a [page:Vector3 normal] and an arbitrary coplanar [page:Vector3 point].
@@ -185,9 +168,8 @@ <h3>[method:Plane translate]( [page:Vector3 offset] )</h3>
<div>
[page:Vector3 offset] - the amount to move the plane by.<br /><br />
- Translates the plane the distance defined by the [page:Vector3 offset] vector.
- Note that this only affects the constant (distance from origin) and will not affect
- the normal vector.
+ Translates the plane by the distance defined by the [page:Vector3 offset] vector.
+ Note that this only affects the plane constant and will not affect the normal vector.
</div>
<h2>Source</h2> | false |