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 | 43cd006f03b87fe479110e1f0bbc1edb24623538.json | Eliminate redundant object creation
Instead of creating a new GC'ed object for each object we traverse,
pre-create the _box similarly to other globals. This is slightly awkward
since this needs to be done after we define the ctor. | src/math/Box3.js | @@ -41,6 +41,8 @@ function Box3( min, max ) {
}
+var _box = new Box3();
+
Object.assign( Box3.prototype, {
isBox3: true,
@@ -257,13 +259,11 @@ Object.assign( Box3.prototype, {
}
- var box = new Box3();
-
- box.copy( geometry.boundingBox );
- box.applyMatrix4( object.matrixWorld );
+ _box.copy( geometry.boundingBox );
+ _box.applyMatrix4( object.matrixWorld );
- this.expandByPoint( box.min );
- this.expandByPoint( box.max );
+ this.expandByPoint( _box.min );
+ this.expandByPoint( _box.max );
}
| false |
Other | mrdoob | three.js | d2bb59bdae63702be9d88418c649ce0312dec916.json | fix decode artefacts | src/renderers/shaders/ShaderChunk/packing.glsl.js | @@ -39,6 +39,7 @@ vec4 encodeHalfRGBA ( vec2 v ) {
}
vec2 decodeHalfRGBA( vec4 v ) {
+ v = floor( v * 255.0 + 0.5 ) / 255.0;
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
| false |
Other | mrdoob | three.js | e8bf2d8eb7444d13d648b8a63f6dafe03b71a7cb.json | Implement support for KHR_mesh_quantization
This change implements support for KHR_mesh_quantization by simply
recognizing the extension as supported. It seems that the extension
works otherwise after various quantization fixes submitted previously
(with the most recent fix including correct morph target handling for
deltas that are quantized with a different data type vs baseline
attribute). | examples/js/loaders/GLTFLoader.js | @@ -188,6 +188,10 @@ THREE.GLTFLoader = ( function () {
extensions[ extensionName ] = new GLTFTextureTransformExtension();
break;
+ case EXTENSIONS.KHR_MESH_QUANTIZATION:
+ extensions[ extensionName ] = new GLTFMeshQuantizationExtension();
+ break;
+
default:
if ( extensionsRequired.indexOf( extensionName ) >= 0 ) {
@@ -263,6 +267,7 @@ THREE.GLTFLoader = ( function () {
KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: 'KHR_materials_pbrSpecularGlossiness',
KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',
KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
+ KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
MSFT_TEXTURE_DDS: 'MSFT_texture_dds'
};
@@ -981,6 +986,17 @@ THREE.GLTFLoader = ( function () {
}
+ /**
+ * Mesh Quantization Extension
+ *
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization
+ */
+ function GLTFMeshQuantizationExtension() {
+
+ this.name = EXTENSIONS.KHR_MESH_QUANTIZATION;
+
+ }
+
/*********************************/
/********** INTERPOLATION ********/
/*********************************/ | true |
Other | mrdoob | three.js | e8bf2d8eb7444d13d648b8a63f6dafe03b71a7cb.json | Implement support for KHR_mesh_quantization
This change implements support for KHR_mesh_quantization by simply
recognizing the extension as supported. It seems that the extension
works otherwise after various quantization fixes submitted previously
(with the most recent fix including correct morph target handling for
deltas that are quantized with a different data type vs baseline
attribute). | examples/jsm/loaders/GLTFLoader.js | @@ -252,6 +252,10 @@ var GLTFLoader = ( function () {
extensions[ extensionName ] = new GLTFTextureTransformExtension();
break;
+ case EXTENSIONS.KHR_MESH_QUANTIZATION:
+ extensions[ extensionName ] = new GLTFMeshQuantizationExtension();
+ break;
+
default:
if ( extensionsRequired.indexOf( extensionName ) >= 0 ) {
@@ -327,6 +331,7 @@ var GLTFLoader = ( function () {
KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: 'KHR_materials_pbrSpecularGlossiness',
KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',
KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
+ KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
MSFT_TEXTURE_DDS: 'MSFT_texture_dds'
};
@@ -1045,6 +1050,17 @@ var GLTFLoader = ( function () {
}
+ /**
+ * Mesh Quantization Extension
+ *
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization
+ */
+ function GLTFMeshQuantizationExtension() {
+
+ this.name = EXTENSIONS.KHR_MESH_QUANTIZATION;
+
+ }
+
/*********************************/
/********** INTERPOLATION ********/
/*********************************/ | true |
Other | mrdoob | three.js | e046703f222d960307088052dde2d55904af431a.json | Update example info ℹ | examples/webvr_6dof_panorama.html | @@ -13,7 +13,7 @@
<div id="info">
<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> webvr - 360 6DOF panorama<br />
- Written by <a href="https://orfleisher.com" target="_blank" rel="noopener">@juniorxsound</a>. Panorama from <a href="http://www.meryproject.com/" target="_blank" rel="noopener">reference panoramas</a>.
+ Written by <a href="https://orfleisher.com" target="_blank" rel="noopener">@juniorxsound</a>. Panorama from <a href="https://krpano.com/examples/?depthmap" target="_blank" rel="noopener">krpano</a>.
</div>
<script type="x-shader/x-vertex" id="vertexshader"> | false |
Other | mrdoob | three.js | 3c78098a701094fff84fd70aa2f86a883ec17304.json | Add example to files.js example index 📝 | examples/files.js | @@ -334,7 +334,8 @@ var files = {
"webvr_sculpt",
"webvr_video",
"webvr_vive_paint",
- "webvr_vive_sculpt"
+ "webvr_vive_sculpt",
+ "webvr_6dof_panorama"
],
"physics": [
"webgl_physics_cloth", | false |
Other | mrdoob | three.js | a4a208f5d1903fa898571da631fcc5f2b50836aa.json | Fix lint errors | src/renderers/WebGLRenderer.js | @@ -268,7 +268,7 @@ function WebGLRenderer( parameters ) {
utils = new WebGLUtils( _gl, extensions, capabilities );
- state = new WebGLState( _gl, extensions, capabilities, utils );
+ state = new WebGLState( _gl, extensions, capabilities );
state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );
state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );
| true |
Other | mrdoob | three.js | a4a208f5d1903fa898571da631fcc5f2b50836aa.json | Fix lint errors | src/renderers/webgl/WebGLBindingStates.js | @@ -392,7 +392,7 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
enableAttributeAndDivisor( programAttribute + 2, 1 );
enableAttributeAndDivisor( programAttribute + 3, 1 );
- gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
+ gl.bindBuffer( gl.ARRAY_BUFFER, buffer );
gl.vertexAttribPointer( programAttribute + 0, 4, type, false, 64, 0 );
gl.vertexAttribPointer( programAttribute + 1, 4, type, false, 64, 16 ); | true |
Other | mrdoob | three.js | a4a208f5d1903fa898571da631fcc5f2b50836aa.json | Fix lint errors | src/renderers/webgl/WebGLState.js | @@ -5,7 +5,7 @@
import { NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessEqualDepth, LessDepth, AlwaysDepth, NeverDepth, CullFaceFront, CullFaceBack, CullFaceNone, DoubleSide, BackSide, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, NoBlending, NormalBlending, AddEquation, SubtractEquation, ReverseSubtractEquation, MinEquation, MaxEquation, ZeroFactor, OneFactor, SrcColorFactor, SrcAlphaFactor, SrcAlphaSaturateFactor, DstColorFactor, DstAlphaFactor, OneMinusSrcColorFactor, OneMinusSrcAlphaFactor, OneMinusDstColorFactor, OneMinusDstAlphaFactor } from '../../constants.js';
import { Vector4 } from '../../math/Vector4.js';
-function WebGLState( gl, extensions, capabilities, utils ) {
+function WebGLState( gl, extensions, capabilities ) {
var isWebGL2 = capabilities.isWebGL2;
| true |
Other | mrdoob | three.js | 78398149bf84a21d381b4c14677c17bb6806c7a2.json | fix spelling and remove typeof #2 | docs/api/en/renderers/WebGLRenderer.html | @@ -473,12 +473,12 @@ <h3>[method:null setScissorTest]( [param:Boolean boolean] )</h3>
<h3>[method:null setOpaqueSort]( [param:Function method] )</h3>
<p>
- Sets the costum opaque sort function for the WebGLRenderLists. Pass null to use the default painterSortStable function.
+ Sets the custom opaque sort function for the WebGLRenderLists. Pass null to use the default painterSortStable function.
</p>
<h3>[method:null setTransparentSort]( [param:Function method] )</h3>
<p>
- Sets the costum transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function. In some cases the transparent materials sort may get rendered in the wrong order. This issue may cause materials to rendere behind other materials instead of the front of them and vice versa.
+ Sets the custom transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function. In some cases the transparent materials sort may get rendered in the wrong order. This issue may cause materials to rendere behind other materials instead of the front of them and vice versa.
</p>
<h3>[method:null setSize]( [param:Integer width], [param:Integer height], [param:Boolean updateStyle] )</h3> | true |
Other | mrdoob | three.js | 78398149bf84a21d381b4c14677c17bb6806c7a2.json | fix spelling and remove typeof #2 | src/renderers/WebGLRenderer.d.ts | @@ -259,12 +259,12 @@ export class WebGLRenderer implements Renderer {
setScissorTest( enable: boolean ): void;
/**
- * Sets the costum opaque sort function for the WebGLRenderLists. Pass null to use the default painterSortStable function.
+ * Sets the custom opaque sort function for the WebGLRenderLists. Pass null to use the default painterSortStable function.
*/
setOpaqueSort( method: Function ): void;
/**
- * Sets the costum transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function.
+ * Sets the custom transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function.
*/
setTransparentSort( method: Function ): void;
| true |
Other | mrdoob | three.js | 78398149bf84a21d381b4c14677c17bb6806c7a2.json | fix spelling and remove typeof #2 | src/renderers/WebGLRenderer.js | @@ -162,6 +162,8 @@ function WebGLRenderer( parameters ) {
_height = _canvas.height,
_pixelRatio = 1,
+ _opaqueSort = null,
+ _transparentSort = null,
_viewport = new Vector4( 0, 0, _width, _height ),
_scissor = new Vector4( 0, 0, _width, _height ),
@@ -253,8 +255,6 @@ function WebGLRenderer( parameters ) {
var background, morphtargets, bufferRenderer, indexedBufferRenderer;
- var opaqueSort, transparentSort;
-
var utils;
function initGLContext() {
@@ -509,13 +509,13 @@ function WebGLRenderer( parameters ) {
this.setOpaqueSort = function ( method ) {
- opaqueSort = typeof method === 'function' ? method : null;
+ _opaqueSort = method;
};
this.setTransparentSort = function ( method ) {
- transparentSort = typeof method === 'function' ? method : null;
+ _transparentSort = method;
};
@@ -1168,7 +1168,7 @@ function WebGLRenderer( parameters ) {
if ( _this.sortObjects === true ) {
- currentRenderList.sort( opaqueSort, transparentSort );
+ currentRenderList.sort( _opaqueSort, _transparentSort );
}
| true |
Other | mrdoob | three.js | 78398149bf84a21d381b4c14677c17bb6806c7a2.json | fix spelling and remove typeof #2 | src/renderers/webgl/WebGLRenderLists.js | @@ -130,10 +130,10 @@ function WebGLRenderList() {
}
- function sort( costumOpaqueSort, costumTransparentSort ) {
+ function sort( customOpaqueSort, customTransparentSort ) {
- if ( opaque.length > 1 ) opaque.sort( costumOpaqueSort || painterSortStable );
- if ( transparent.length > 1 ) transparent.sort( costumTransparentSort || reversePainterSortStable );
+ if ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );
+ if ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );
}
| true |
Other | mrdoob | three.js | 5c42600aa4e3dd780071733c2764d87944825b79.json | add more fromArray and toArray function types | src/math/Color.d.ts | @@ -152,8 +152,35 @@ export class Color {
lerp( color: Color, alpha: number ): this;
lerpHSL( color: Color, alpha: number ): this;
equals( color: Color ): boolean;
- fromArray( rgb: number[], offset?: number ): this;
+
+ /**
+ * Sets this color's red, green and blue value from the provided array.
+ * @param array the source array.
+ * @param offset (optional) offset into the array. Default is 0.
+ */
+ fromArray( array: number[], offset?: number ): this;
+
+ /**
+ * Sets this color's red, green and blue value from the provided array-like.
+ * @param array the source array-like.
+ * @param offset (optional) offset into the array-like. Default is 0.
+ */
+ fromArray( array: ArrayLike<number>, offset?: number ): this;
+
+ /**
+ * Returns an array [red, green, blue], or copies red, green and blue into the provided array.
+ * @param array (optional) array to store the color to. If this is not provided, a new array will be created.
+ * @param offset (optional) optional offset into the array.
+ * @return The created or provided array.
+ */
toArray( array?: number[], offset?: number ): number[];
+
+ /**
+ * Copies red, green and blue into the provided array-like.
+ * @param array array-like to store the color to.
+ * @param offset (optional) optional offset into the array-like.
+ * @return The provided array-like.
+ */
toArray( xyz: ArrayLike<number>, offset?: number ): ArrayLike<number>;
} | true |
Other | mrdoob | three.js | 5c42600aa4e3dd780071733c2764d87944825b79.json | add more fromArray and toArray function types | src/math/Matrix3.d.ts | @@ -111,10 +111,36 @@ export class Matrix3 implements Matrix {
equals( matrix: Matrix3 ): boolean;
+ /**
+ * Sets the values of this matrix from the provided array.
+ * @param array the source array.
+ * @param offset (optional) offset into the array. Default is 0.
+ */
fromArray( array: number[], offset?: number ): Matrix3;
+ /**
+ * Sets the values of this matrix from the provided array-like.
+ * @param array the source array-like.
+ * @param offset (optional) offset into the array-like. Default is 0.
+ */
+ fromArray( array: ArrayLike<number>, offset?: number ): Matrix3;
+
+ /**
+ * Returns an array with the values of this matrix, or copies them into the provided array.
+ * @param array (optional) array to store the matrix to. If this is not provided, a new array will be created.
+ * @param offset (optional) optional offset into the array.
+ * @return The created or provided array.
+ */
toArray( array?: number[], offset?: number ): number[];
+ /**
+ * Copies he values of this matrix into the provided array-like.
+ * @param array array-like to store the matrix to.
+ * @param offset (optional) optional offset into the array-like.
+ * @return The provided array-like.
+ */
+ toArray( array?: ArrayLike<number>, offset?: number ): ArrayLike<number>;
+
/**
* Multiplies this matrix by m.
*/ | true |
Other | mrdoob | three.js | 5c42600aa4e3dd780071733c2764d87944825b79.json | add more fromArray and toArray function types | src/math/Matrix4.d.ts | @@ -226,10 +226,37 @@ export class Matrix4 implements Matrix {
far: number
): Matrix4;
equals( matrix: Matrix4 ): boolean;
+
+ /**
+ * Sets the values of this matrix from the provided array.
+ * @param array the source array.
+ * @param offset (optional) offset into the array. Default is 0.
+ */
fromArray( array: number[], offset?: number ): Matrix4;
+ /**
+ * Sets the values of this matrix from the provided array-like.
+ * @param array the source array-like.
+ * @param offset (optional) offset into the array-like. Default is 0.
+ */
+ fromArray( array: ArrayLike<number>, offset?: number ): Matrix4;
+
+ /**
+ * Returns an array with the values of this matrix, or copies them into the provided array.
+ * @param array (optional) array to store the matrix to. If this is not provided, a new array will be created.
+ * @param offset (optional) optional offset into the array.
+ * @return The created or provided array.
+ */
toArray( array?: number[], offset?: number ): number[];
+ /**
+ * Copies he values of this matrix into the provided array-like.
+ * @param array array-like to store the matrix to.
+ * @param offset (optional) optional offset into the array-like.
+ * @return The provided array-like.
+ */
+ toArray( array?: ArrayLike<number>, offset?: number ): ArrayLike<number>;
+
/**
* @deprecated Use {@link Matrix4#copyPosition .copyPosition()} instead.
*/ | true |
Other | mrdoob | three.js | 5c42600aa4e3dd780071733c2764d87944825b79.json | add more fromArray and toArray function types | src/math/Quaternion.d.ts | @@ -94,11 +94,36 @@ export class Quaternion {
slerp( qb: Quaternion, t: number ): Quaternion;
equals( v: Quaternion ): boolean;
- fromArray( n: number[] ): Quaternion;
- toArray(): number[];
- fromArray( xyzw: number[], offset?: number ): Quaternion;
- toArray( xyzw?: number[], offset?: number ): number[];
+ /**
+ * Sets this quaternion's x, y, z and w value from the provided array.
+ * @param array the source array.
+ * @param offset (optional) offset into the array. Default is 0.
+ */
+ fromArray( array: number[], offset?: number ): this;
+
+ /**
+ * Sets this quaternion's x, y, z and w value from the provided array-like.
+ * @param array the source array-like.
+ * @param offset (optional) offset into the array-like. Default is 0.
+ */
+ fromArray( array: ArrayLike<number>, offset?: number ): this;
+
+ /**
+ * Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.
+ * @param array (optional) array to store the quaternion to. If this is not provided, a new array will be created.
+ * @param offset (optional) optional offset into the array.
+ * @return The created or provided array.
+ */
+ toArray( array?: number[], offset?: number ): number[];
+
+ /**
+ * Copies x, y, z and w into the provided array-like.
+ * @param array array-like to store the quaternion to.
+ * @param offset (optional) optional offset into the array.
+ * @return The provided array-like.
+ */
+ toArray( array: ArrayLike<number>, offset?: number ): ArrayLike<number>;
_onChange( callback: Function ): Quaternion;
_onChangeCallback: Function; | true |
Other | mrdoob | three.js | 5c42600aa4e3dd780071733c2764d87944825b79.json | add more fromArray and toArray function types | src/math/SphericalHarmonics3.d.ts | @@ -15,8 +15,36 @@ export class SphericalHarmonics3 {
equals( sh: SphericalHarmonics3 ): boolean;
copy( sh: SphericalHarmonics3 ): SphericalHarmonics3;
clone(): SphericalHarmonics3;
- fromArray( array: number[] ): SphericalHarmonics3;
- toArray(): number[];
+
+ /**
+ * Sets the values of this spherical harmonics from the provided array.
+ * @param array the source array.
+ * @param offset (optional) offset into the array. Default is 0.
+ */
+ fromArray( array: number[], offset?: number ): this;
+
+ /**
+ * Sets the values of this spherical harmonics from the provided array-like.
+ * @param array the source array-like.
+ * @param offset (optional) offset into the array-like. Default is 0.
+ */
+ fromArray( array: ArrayLike<number>, offset?: number ): this;
+
+ /**
+ * Returns an array with the values of this spherical harmonics, or copies them into the provided array.
+ * @param array (optional) array to store the spherical harmonics to. If this is not provided, a new array will be created.
+ * @param offset (optional) optional offset into the array.
+ * @return The created or provided array.
+ */
+ toArray( array?: number[], offset?: number ): number[];
+
+ /**
+ * Returns an array with the values of this spherical harmonics, or copies them into the provided array-like.
+ * @param array array-like to store the spherical harmonics to.
+ * @param offset (optional) optional offset into the array-like.
+ * @return The provided array-like.
+ */
+ toArray( array: ArrayLike<number>, offset?: number ): ArrayLike<number>;
getAt( normal: Vector3, target: Vector3 ) : Vector3;
getIrradianceAt( normal: Vector3, target: Vector3 ) : Vector3; | true |
Other | mrdoob | three.js | 5c42600aa4e3dd780071733c2764d87944825b79.json | add more fromArray and toArray function types | src/math/SphericalHarmonics3.js | @@ -177,28 +177,32 @@ Object.assign( SphericalHarmonics3.prototype, {
},
- fromArray: function ( array ) {
+ fromArray: function ( array, offset ) {
+
+ if ( offset === undefined ) offset = 0;
var coefficients = this.coefficients;
for ( var i = 0; i < 9; i ++ ) {
- coefficients[ i ].fromArray( array, i * 3 );
+ coefficients[ i ].fromArray( array, offset + ( i * 3 ) );
}
return this;
},
- toArray: function () {
+ toArray: function ( array, offset ) {
+
+ if ( array === undefined ) array = [];
+ if ( offset === undefined ) offset = 0;
- var array = [];
var coefficients = this.coefficients;
for ( var i = 0; i < 9; i ++ ) {
- coefficients[ i ].toArray( array, i * 3 );
+ coefficients[ i ].toArray( array, offset + ( i * 3 ) );
}
| true |
Other | mrdoob | three.js | 5c42600aa4e3dd780071733c2764d87944825b79.json | add more fromArray and toArray function types | src/math/Vector3.d.ts | @@ -256,7 +256,7 @@ export class Vector3 implements Vector {
fromArray( array: number[], offset?: number ): this;
/**
- * Sets this vector's x, y and z value from the provided array-lik.
+ * Sets this vector's x, y and z value from the provided array-like.
* @param array the source array-like.
* @param offset (optional) offset into the array-like. Default is 0.
*/
@@ -273,7 +273,7 @@ export class Vector3 implements Vector {
/**
* Copies x, y and z into the provided array-like.
* @param array array-like to store the vector to.
- * @param offset (optional) optional offset into the array.
+ * @param offset (optional) optional offset into the array-like.
* @return The provided array-like.
*/
toArray( array: ArrayLike<number>, offset?: number ): ArrayLike<number>; | true |
Other | mrdoob | three.js | 5c42600aa4e3dd780071733c2764d87944825b79.json | add more fromArray and toArray function types | src/math/Vector4.d.ts | @@ -199,7 +199,7 @@ export class Vector4 implements Vector {
/**
* Copies x, y, z and w into the provided array-like.
* @param array array-like to store the vector to.
- * @param offset (optional) optional offset into the array.
+ * @param offset (optional) optional offset into the array-like.
* @return The provided array-like.
*/
toArray( array: ArrayLike<number>, offset?: number ): ArrayLike<number>; | true |
Other | mrdoob | three.js | 9078d8f56b80a0cc980a85ba950f91ee30f08251.json | Add functions to enable/disable all layers
This reduces the need to access Layers.mask directly when code needs to enable/disable all layers on an object. | docs/api/en/core/Layers.html | @@ -80,6 +80,16 @@ <h3>[method:null toggle]( [param:Integer layer] )</h3>
Toggle membership of *layer*.
</p>
+ <h3>[method:null enableAll]()</h3>
+ <p>
+ Add membership to all layers.
+ </p>
+
+ <h3>[method:null disableAll]()</h3>
+ <p>
+ Remove membership from all layers.
+ </p>
+
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] | true |
Other | mrdoob | three.js | 9078d8f56b80a0cc980a85ba950f91ee30f08251.json | Add functions to enable/disable all layers
This reduces the need to access Layers.mask directly when code needs to enable/disable all layers on an object. | src/core/Layers.d.ts | @@ -10,4 +10,7 @@ export class Layers {
disable( channel: number ): void;
test( layers: Layers ): boolean;
+ enableAll (): void;
+ disableAll (): void;
+
} | true |
Other | mrdoob | three.js | 9078d8f56b80a0cc980a85ba950f91ee30f08251.json | Add functions to enable/disable all layers
This reduces the need to access Layers.mask directly when code needs to enable/disable all layers on an object. | src/core/Layers.js | @@ -38,6 +38,18 @@ Object.assign( Layers.prototype, {
return ( this.mask & layers.mask ) !== 0;
+ },
+
+ enableAll: function () {
+
+ this.mask = 0xffffffff | 0;
+
+ },
+
+ disableAll: function () {
+
+ this.mask = 0;
+
}
} ); | true |
Other | mrdoob | three.js | 709fe8964b13fe3b357142547493c1b9927c92d3.json | remove multiview attribute from renderer | src/renderers/WebGLRenderer.js | @@ -319,8 +319,6 @@ function WebGLRenderer( parameters ) {
var multiview = new WebGLMultiview( _this, _gl );
- this.multiview = multiview;
-
// shadow map
var shadowMap = new WebGLShadowMap( _this, objects, capabilities.maxTextureSize ); | true |
Other | mrdoob | three.js | 709fe8964b13fe3b357142547493c1b9927c92d3.json | remove multiview attribute from renderer | src/renderers/webgl/WebGLMultiview.js | @@ -26,18 +26,6 @@ function WebGLMultiview( renderer, gl ) {
}
- function getNumViews() {
-
- if ( renderTarget && renderer.getRenderTarget() === renderTarget ) {
-
- return renderTarget.numViews;
-
- }
-
- return 0;
-
- }
-
function getCameraArray( camera ) {
if ( camera.isArrayCamera ) return camera.cameras;
@@ -218,7 +206,6 @@ function WebGLMultiview( renderer, gl ) {
this.attachRenderTarget = attachRenderTarget;
this.detachRenderTarget = detachRenderTarget;
- this.getNumViews = getNumViews;
this.updateCameraProjectionMatricesUniform = updateCameraProjectionMatricesUniform;
this.updateCameraViewMatricesUniform = updateCameraViewMatricesUniform;
this.updateObjectMatricesUniforms = updateObjectMatricesUniforms; | true |
Other | mrdoob | three.js | 709fe8964b13fe3b357142547493c1b9927c92d3.json | remove multiview attribute from renderer | src/renderers/webgl/WebGLProgram.js | @@ -5,6 +5,7 @@
import { WebGLUniforms } from './WebGLUniforms.js';
import { WebGLShader } from './WebGLShader.js';
import { ShaderChunk } from '../shaders/ShaderChunk.js';
+import { WebGLMultiviewRenderTarget } from '../WebGLMultiviewRenderTarget.js';
import { NoToneMapping, AddOperation, MixOperation, MultiplyOperation, EquirectangularRefractionMapping, CubeRefractionMapping, SphericalReflectionMapping, EquirectangularReflectionMapping, CubeUVRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, ACESFilmicToneMapping, CineonToneMapping, Uncharted2ToneMapping, ReinhardToneMapping, LinearToneMapping, GammaEncoding, RGBDEncoding, RGBM16Encoding, RGBM7Encoding, RGBEEncoding, sRGBEncoding, LinearEncoding } from '../../constants.js';
var programIdCount = 0;
@@ -329,7 +330,8 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
var prefixVertex, prefixFragment;
- var numMultiviewViews = renderer.multiview.getNumViews();
+ var renderTarget = renderer.getRenderTarget();
+ var numMultiviewViews = renderTarget instanceof WebGLMultiviewRenderTarget ? renderTarget.numViews : 0;
if ( material.isRawShaderMaterial ) {
| true |
Other | mrdoob | three.js | 413ec9280fcc3e1722b579be5aa56f03fe35a6cb.json | Add return type to createButton for WebVR typings.
The function can return either a button or an `<a>` element. `HTMLElement` is a simple generalization in case the implementation changes again. | examples/jsm/vr/WebVR.d.ts | @@ -7,5 +7,5 @@ export interface WEBVROptions {
}
export namespace WEBVR {
- export function createButton( renderer: WebGLRenderer, options?: WEBVROptions );
+ export function createButton( renderer: WebGLRenderer, options?: WEBVROptions ): HTMLElement;
} | false |
Other | mrdoob | three.js | bdba8e2af61494aac0b3c2fae7f15248405732b3.json | Fix loading glTF ZIP files in the editor | editor/js/Loader.js | @@ -605,7 +605,7 @@ var Loader = function ( editor ) {
var scene = result.scene;
editor.addAnimation( scene, result.animations );
- editor.execute( new AddObjectCommand( scene ) );
+ editor.execute( new AddObjectCommand( editor, scene ) );
} );
| false |
Other | mrdoob | three.js | 598a1c5b17beee6e01fb889b5f9977fa68607ae3.json | Fix a type description. | examples/jsm/loaders/MMDLoader.d.ts | @@ -20,11 +20,11 @@ export class MMDLoader extends Loader {
parser: object | null;
load(url: string, onLoad: (mesh: SkinnedMesh) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
- loadAnimation(url: string, onLoad: (object: SkinnedMesh | AnimationClip) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
+ loadAnimation(url: string, object: SkinnedMesh | THREE.Camera, onLoad: (object: SkinnedMesh | AnimationClip) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
loadPMD(url: string, onLoad: (object: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
loadPMX(url: string, onLoad: (object: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
loadVMD(url: string, onLoad: (object: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
- loadVPD(url: string, onLoad: (object: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
+ loadVPD(url: string, isUnicode: boolean, onLoad: (object: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
loadWithAnimation(url: string, vmdUrl: string | string[], onLoad: (object: MMDLoaderAnimationObject) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
setAnimationPath(animationPath: string): this;
} | false |
Other | mrdoob | three.js | 16217d2806980f6be13ebbbac80dfc0312328433.json | add the defintion file of utils | src/utils.d.ts | @@ -0,0 +1,2 @@
+export function arrayMin( array: number[] ): number;
+export function arrayMax( array: number[] ): number;
\ No newline at end of file | false |
Other | mrdoob | three.js | ef78c1b69181c55029ec25be9f4ef87f03a9f0f5.json | Fix minor issues and linter | src/materials/Material.js | @@ -72,7 +72,6 @@ function Material() {
this.toneMapped = true;
this.userData = {};
-
this.needsUpdate = true;
} | true |
Other | mrdoob | three.js | ef78c1b69181c55029ec25be9f4ef87f03a9f0f5.json | Fix minor issues and linter | src/renderers/WebGLRenderer.js | @@ -58,6 +58,7 @@ function WebGLRenderer( parameters ) {
var _canvas = parameters.canvas !== undefined ? parameters.canvas : document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ),
_context = parameters.context !== undefined ? parameters.context : null,
+
_alpha = parameters.alpha !== undefined ? parameters.alpha : false,
_depth = parameters.depth !== undefined ? parameters.depth : true,
_stencil = parameters.stencil !== undefined ? parameters.stencil : true,
@@ -1241,7 +1242,7 @@ function WebGLRenderer( parameters ) {
if ( capabilities.multiview ) {
- multiview.detachRenderTarget( camera );
+ multiview.detachCamera( camera );
}
| true |
Other | mrdoob | three.js | ef78c1b69181c55029ec25be9f4ef87f03a9f0f5.json | Fix minor issues and linter | src/renderers/webgl/WebGLCapabilities.js | @@ -87,7 +87,7 @@ function WebGLCapabilities( gl, extensions, parameters ) {
var maxSamples = isWebGL2 ? gl.getParameter( gl.MAX_SAMPLES ) : 0;
var multiviewExt = extensions.get( 'OVR_multiview2' );
- var multiview = isWebGL2 && ( !! multiviewExt ) && ! gl.getContextAttributes().antialias;
+ var multiview = isWebGL2 && !! multiviewExt && ! gl.getContextAttributes().antialias;
var maxMultiviewViews = multiview ? gl.getParameter( multiviewExt.MAX_VIEWS_OVR ) : 0;
return { | true |
Other | mrdoob | three.js | ef78c1b69181c55029ec25be9f4ef87f03a9f0f5.json | Fix minor issues and linter | src/renderers/webgl/WebGLMultiview.js | @@ -134,7 +134,7 @@ function WebGLMultiview( renderer, gl ) {
}
- function detachRenderTarget( camera ) {
+ function detachCamera( camera ) {
if ( renderTarget !== renderer.getRenderTarget() ) return;
@@ -201,7 +201,7 @@ function WebGLMultiview( renderer, gl ) {
this.attachCamera = attachCamera;
- this.detachRenderTarget = detachRenderTarget;
+ this.detachCamera = detachCamera;
this.updateCameraProjectionMatricesUniform = updateCameraProjectionMatricesUniform;
this.updateCameraViewMatricesUniform = updateCameraViewMatricesUniform;
this.updateObjectMatricesUniforms = updateObjectMatricesUniforms; | true |
Other | mrdoob | three.js | ef78c1b69181c55029ec25be9f4ef87f03a9f0f5.json | Fix minor issues and linter | src/renderers/webgl/WebGLProgram.js | @@ -5,7 +5,6 @@
import { WebGLUniforms } from './WebGLUniforms.js';
import { WebGLShader } from './WebGLShader.js';
import { ShaderChunk } from '../shaders/ShaderChunk.js';
-import { WebGLMultiviewRenderTarget } from '../WebGLMultiviewRenderTarget.js';
import { NoToneMapping, AddOperation, MixOperation, MultiplyOperation, EquirectangularRefractionMapping, CubeRefractionMapping, SphericalReflectionMapping, EquirectangularReflectionMapping, CubeUVRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, VSMShadowMap, ACESFilmicToneMapping, CineonToneMapping, Uncharted2ToneMapping, ReinhardToneMapping, LinearToneMapping, GammaEncoding, RGBDEncoding, RGBM16Encoding, RGBM7Encoding, RGBEEncoding, sRGBEncoding, LinearEncoding, LogLuvEncoding } from '../../constants.js';
var programIdCount = 0; | true |
Other | mrdoob | three.js | d374632473fa476c94acd0c98f769048c28c5cff.json | Remove unused supportMultiview on material | src/materials/Material.js | @@ -71,7 +71,6 @@ function Material() {
this.visible = true;
this.toneMapped = true;
- this.supportsMultiview = true;
this.userData = {};
this.needsUpdate = true; | false |
Other | mrdoob | three.js | 19fb3706a390bd4a5502a27b26c9606407078c1b.json | Fix a type description. | examples/jsm/renderers/WebGLDeferredRenderer.d.ts | @@ -8,9 +8,9 @@ import {
export interface WebGLDeferredRendererParameters {
antialias?: boolean;
cacheKeepAlive?: boolean;
- height?: Vector2;
+ height?: number;
renderer?: WebGLRenderer;
- width?: Vector2;
+ width?: number;
}
export class WebGLDeferredRenderer { | false |
Other | mrdoob | three.js | c52fef3b548ecf7d252850ffaa9a2eaca6b26989.json | parse opacity of material
some model is transparent, so it should parse MAT_TRANSPARENCY, and convert MAT_TRANSPARENCY to material.oapcity | examples/js/loaders/TDSLoader.js | @@ -272,6 +272,12 @@ THREE.TDSLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
material.shininess = shininess;
this.debugMessage( ' Shininess : ' + shininess );
+ } else if ( next === MAT_TRANSPARENCY ) {
+
+ var opacity = this.readWord( data );
+ material.opacity = opacity*0.01;
+ this.debugMessage( ' Opacity : ' + opacity );
+ material.transparent = opacity<100 ? true : false;
} else if ( next === MAT_TEXMAP ) {
this.debugMessage( ' ColorMap' ); | false |
Other | mrdoob | three.js | 30e24e69a852e9efcdbb7c64e8e30d9370d44e70.json | remove unit tests | test/unit/src/core/BufferAttribute.tests.js | @@ -42,28 +42,6 @@ export default QUnit.module( 'Core', () => {
} );
- QUnit.test( "setArray", ( assert ) => {
-
- var f32a = new Float32Array( [ 1, 2, 3, 4 ] );
- var a = new BufferAttribute( f32a, 2, false );
-
- a.setArray( f32a, 2 );
-
- assert.strictEqual( a.count, 2, "Check item count" );
- assert.strictEqual( a.array, f32a, "Check array" );
-
- assert.throws(
- function () {
-
- a.setArray( [ 1, 2, 3, 4 ] );
-
- },
- /array should be a Typed Array/,
- "Calling setArray with a simple array throws Error"
- );
-
- } );
-
QUnit.todo( "setDynamic", ( assert ) => {
assert.ok( false, "everything's gonna be alright" ); | true |
Other | mrdoob | three.js | 30e24e69a852e9efcdbb7c64e8e30d9370d44e70.json | remove unit tests | test/unit/src/core/InterleavedBuffer.tests.js | @@ -49,34 +49,6 @@ export default QUnit.module( 'Core', () => {
} );
- QUnit.test( "setArray", ( assert ) => {
-
- var f32a = new Float32Array( [ 1, 2, 3, 4 ] );
- var f32b = new Float32Array( [] );
- var a = new InterleavedBuffer( f32a, 2, false );
-
- a.setArray( f32a );
-
- assert.strictEqual( a.count, 2, "Check item count for non-empty array" );
- assert.strictEqual( a.array, f32a, "Check array itself" );
-
- a.setArray( f32b );
-
- assert.strictEqual( a.count, 0, "Check item count for empty array" );
- assert.strictEqual( a.array, f32b, "Check array itself" );
-
- assert.throws(
- function () {
-
- a.setArray( [ 1, 2, 3, 4 ] );
-
- },
- /array should be a Typed Array/,
- "Calling setArray with a non-typed array throws Error"
- );
-
- } );
-
QUnit.todo( "setDynamic", ( assert ) => {
assert.ok( false, "everything's gonna be alright" ); | true |
Other | mrdoob | three.js | 5e2f24c8c64d5e861e101ad380ec0ae5390908c4.json | Fix more indents | examples/js/shaders/DOFMipMapShader.js | @@ -23,8 +23,8 @@ THREE.DOFMipMapShader = {
"void main() {",
- "vUv = uv;",
- "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+ " vUv = uv;",
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
"}"
@@ -42,14 +42,14 @@ THREE.DOFMipMapShader = {
"void main() {",
- "vec4 depth = texture2D( tDepth, vUv );",
+ " vec4 depth = texture2D( tDepth, vUv );",
- "float factor = depth.x - focus;",
+ " float factor = depth.x - focus;",
- "vec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );",
+ " vec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );",
- "gl_FragColor = col;",
- "gl_FragColor.a = 1.0;",
+ " gl_FragColor = col;",
+ " gl_FragColor.a = 1.0;",
"}"
| true |
Other | mrdoob | three.js | 5e2f24c8c64d5e861e101ad380ec0ae5390908c4.json | Fix more indents | examples/js/shaders/DotScreenShader.js | @@ -24,8 +24,8 @@ THREE.DotScreenShader = {
"void main() {",
- "vUv = uv;",
- "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+ " vUv = uv;",
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
"}"
@@ -44,22 +44,22 @@ THREE.DotScreenShader = {
"float pattern() {",
- "float s = sin( angle ), c = cos( angle );",
+ " float s = sin( angle ), c = cos( angle );",
- "vec2 tex = vUv * tSize - center;",
- "vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;",
+ " vec2 tex = vUv * tSize - center;",
+ " vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;",
- "return ( sin( point.x ) * sin( point.y ) ) * 4.0;",
+ " return ( sin( point.x ) * sin( point.y ) ) * 4.0;",
"}",
"void main() {",
- "vec4 color = texture2D( tDiffuse, vUv );",
+ " vec4 color = texture2D( tDiffuse, vUv );",
- "float average = ( color.r + color.g + color.b ) / 3.0;",
+ " float average = ( color.r + color.g + color.b ) / 3.0;",
- "gl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );",
+ " gl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );",
"}"
| true |
Other | mrdoob | three.js | 5e2f24c8c64d5e861e101ad380ec0ae5390908c4.json | Fix more indents | examples/js/shaders/FilmShader.js | @@ -39,8 +39,8 @@ THREE.FilmShader = {
"void main() {",
- "vUv = uv;",
- "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+ " vUv = uv;",
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
"}"
@@ -71,31 +71,31 @@ THREE.FilmShader = {
"void main() {",
// sample the source
- "vec4 cTextureScreen = texture2D( tDiffuse, vUv );",
+ " vec4 cTextureScreen = texture2D( tDiffuse, vUv );",
// make some noise
- "float dx = rand( vUv + time );",
+ " float dx = rand( vUv + time );",
// add noise
- "vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );",
+ " vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );",
// get us a sine and cosine
- "vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );",
+ " vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );",
// add scanlines
- "cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;",
+ " cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;",
// interpolate between source and result by intensity
- "cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );",
+ " cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );",
// convert to grayscale if desired
- "if( grayscale ) {",
+ " if( grayscale ) {",
- "cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );",
+ " cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );",
- "}",
+ " }",
- "gl_FragColor = vec4( cResult, cTextureScreen.a );",
+ " gl_FragColor = vec4( cResult, cTextureScreen.a );",
"}"
| true |
Other | mrdoob | three.js | 5e2f24c8c64d5e861e101ad380ec0ae5390908c4.json | Fix more indents | examples/js/shaders/FocusShader.js | @@ -24,8 +24,8 @@ THREE.FocusShader = {
"void main() {",
- "vUv = uv;",
- "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+ " vUv = uv;",
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
"}"
@@ -44,45 +44,45 @@ THREE.FocusShader = {
"void main() {",
- "vec4 color, org, tmp, add;",
- "float sample_dist, f;",
- "vec2 vin;",
- "vec2 uv = vUv;",
+ " vec4 color, org, tmp, add;",
+ " float sample_dist, f;",
+ " vec2 vin;",
+ " vec2 uv = vUv;",
- "add = color = org = texture2D( tDiffuse, uv );",
+ " add = color = org = texture2D( tDiffuse, uv );",
- "vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );",
- "sample_dist = dot( vin, vin ) * 2.0;",
+ " vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );",
+ " sample_dist = dot( vin, vin ) * 2.0;",
- "f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;",
+ " f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;",
- "vec2 sampleSize = vec2( 1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );",
+ " vec2 sampleSize = vec2( 1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );",
- "add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );",
- "if( tmp.b < color.b ) color = tmp;",
+ " add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );",
+ " if( tmp.b < color.b ) color = tmp;",
- "add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );",
- "if( tmp.b < color.b ) color = tmp;",
+ " add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );",
+ " if( tmp.b < color.b ) color = tmp;",
- "add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );",
- "if( tmp.b < color.b ) color = tmp;",
+ " add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );",
+ " if( tmp.b < color.b ) color = tmp;",
- "add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );",
- "if( tmp.b < color.b ) color = tmp;",
+ " add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );",
+ " if( tmp.b < color.b ) color = tmp;",
- "add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );",
- "if( tmp.b < color.b ) color = tmp;",
+ " add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );",
+ " if( tmp.b < color.b ) color = tmp;",
- "add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );",
- "if( tmp.b < color.b ) color = tmp;",
+ " add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );",
+ " if( tmp.b < color.b ) color = tmp;",
- "add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );",
- "if( tmp.b < color.b ) color = tmp;",
+ " add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );",
+ " if( tmp.b < color.b ) color = tmp;",
- "color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );",
- "color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );",
+ " color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );",
+ " color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );",
- "gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );",
+ " gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );",
"}"
| true |
Other | mrdoob | three.js | 5e2f24c8c64d5e861e101ad380ec0ae5390908c4.json | Fix more indents | examples/js/shaders/FreiChenShader.js | @@ -21,8 +21,8 @@ THREE.FreiChenShader = {
"void main() {",
- "vUv = uv;",
- "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+ " vUv = uv;",
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
"}"
@@ -55,38 +55,38 @@ THREE.FreiChenShader = {
"void main(void)",
"{",
- "G[0] = g0,",
- "G[1] = g1,",
- "G[2] = g2,",
- "G[3] = g3,",
- "G[4] = g4,",
- "G[5] = g5,",
- "G[6] = g6,",
- "G[7] = g7,",
- "G[8] = g8;",
-
- "mat3 I;",
- "float cnv[9];",
- "vec3 sample;",
-
- /* fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value */
- "for (float i=0.0; i<3.0; i++) {",
- "for (float j=0.0; j<3.0; j++) {",
- "sample = texture2D(tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;",
- "I[int(i)][int(j)] = length(sample);",
- "}",
- "}",
-
- /* calculate the convolution values for all the masks */
- "for (int i=0; i<9; i++) {",
- "float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);",
- "cnv[i] = dp3 * dp3;",
- "}",
-
- "float M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);",
- "float S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);",
-
- "gl_FragColor = vec4(vec3(sqrt(M/S)), 1.0);",
+ " G[0] = g0,",
+ " G[1] = g1,",
+ " G[2] = g2,",
+ " G[3] = g3,",
+ " G[4] = g4,",
+ " G[5] = g5,",
+ " G[6] = g6,",
+ " G[7] = g7,",
+ " G[8] = g8;",
+
+ " mat3 I;",
+ " float cnv[9];",
+ " vec3 sample;",
+
+ /* fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value */
+ " for (float i=0.0; i<3.0; i++) {",
+ " for (float j=0.0; j<3.0; j++) {",
+ " sample = texture2D(tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;",
+ " I[int(i)][int(j)] = length(sample);",
+ " }",
+ " }",
+
+ /* calculate the convolution values for all the masks */
+ " for (int i=0; i<9; i++) {",
+ " float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);",
+ " cnv[i] = dp3 * dp3;",
+ " }",
+
+ " float M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);",
+ " float S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);",
+
+ " gl_FragColor = vec4(vec3(sqrt(M/S)), 1.0);",
"}"
].join( "\n" ) | true |
Other | mrdoob | three.js | 8bf4f29237cec182f03ddc4f5b9ece5aa864d4e0.json | Fix some indents | examples/js/shaders/BrightnessContrastShader.js | @@ -23,9 +23,9 @@ THREE.BrightnessContrastShader = {
"void main() {",
- "vUv = uv;",
+ " vUv = uv;",
- "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
"}"
@@ -41,15 +41,15 @@ THREE.BrightnessContrastShader = {
"void main() {",
- "gl_FragColor = texture2D( tDiffuse, vUv );",
+ " gl_FragColor = texture2D( tDiffuse, vUv );",
- "gl_FragColor.rgb += brightness;",
+ " gl_FragColor.rgb += brightness;",
- "if (contrast > 0.0) {",
- "gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;",
- "} else {",
- "gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;",
- "}",
+ " if (contrast > 0.0) {",
+ " gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;",
+ " } else {",
+ " gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;",
+ " }",
"}"
| true |
Other | mrdoob | three.js | 8bf4f29237cec182f03ddc4f5b9ece5aa864d4e0.json | Fix some indents | examples/js/shaders/ColorCorrectionShader.js | @@ -21,9 +21,9 @@ THREE.ColorCorrectionShader = {
"void main() {",
- "vUv = uv;",
+ " vUv = uv;",
- "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
"}"
@@ -40,8 +40,8 @@ THREE.ColorCorrectionShader = {
"void main() {",
- "gl_FragColor = texture2D( tDiffuse, vUv );",
- "gl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB );",
+ " gl_FragColor = texture2D( tDiffuse, vUv );",
+ " gl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB );",
"}"
| true |
Other | mrdoob | three.js | 8bf4f29237cec182f03ddc4f5b9ece5aa864d4e0.json | Fix some indents | examples/js/shaders/ColorifyShader.js | @@ -19,8 +19,8 @@ THREE.ColorifyShader = {
"void main() {",
- "vUv = uv;",
- "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+ " vUv = uv;",
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
"}"
@@ -35,12 +35,12 @@ THREE.ColorifyShader = {
"void main() {",
- "vec4 texel = texture2D( tDiffuse, vUv );",
+ " vec4 texel = texture2D( tDiffuse, vUv );",
- "vec3 luma = vec3( 0.299, 0.587, 0.114 );",
- "float v = dot( texel.xyz, luma );",
+ " vec3 luma = vec3( 0.299, 0.587, 0.114 );",
+ " float v = dot( texel.xyz, luma );",
- "gl_FragColor = vec4( v * color, texel.w );",
+ " gl_FragColor = vec4( v * color, texel.w );",
"}"
| true |
Other | mrdoob | three.js | 8bf4f29237cec182f03ddc4f5b9ece5aa864d4e0.json | Fix some indents | examples/js/shaders/ConvolutionShader.js | @@ -31,8 +31,8 @@ THREE.ConvolutionShader = {
"void main() {",
- "vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;",
- "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+ " vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;",
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
"}"
@@ -49,17 +49,17 @@ THREE.ConvolutionShader = {
"void main() {",
- "vec2 imageCoord = vUv;",
- "vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );",
+ " vec2 imageCoord = vUv;",
+ " vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );",
- "for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {",
+ " for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {",
- "sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];",
- "imageCoord += uImageIncrement;",
+ " sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];",
+ " imageCoord += uImageIncrement;",
- "}",
+ " }",
- "gl_FragColor = sum;",
+ " gl_FragColor = sum;",
"}"
| true |
Other | mrdoob | three.js | 8bf4f29237cec182f03ddc4f5b9ece5aa864d4e0.json | Fix some indents | examples/js/shaders/CopyShader.js | @@ -19,8 +19,8 @@ THREE.CopyShader = {
"void main() {",
- "vUv = uv;",
- "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+ " vUv = uv;",
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
"}"
@@ -36,8 +36,8 @@ THREE.CopyShader = {
"void main() {",
- "vec4 texel = texture2D( tDiffuse, vUv );",
- "gl_FragColor = opacity * texel;",
+ " vec4 texel = texture2D( tDiffuse, vUv );",
+ " gl_FragColor = opacity * texel;",
"}"
| true |
Other | mrdoob | three.js | 8bf4f29237cec182f03ddc4f5b9ece5aa864d4e0.json | Fix some indents | examples/js/shaders/DigitalGlitch.js | @@ -31,8 +31,8 @@ THREE.DigitalGlitch = {
"varying vec2 vUv;",
"void main() {",
- "vUv = uv;",
- "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+ " vUv = uv;",
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
"}"
].join( "\n" ),
@@ -55,47 +55,47 @@ THREE.DigitalGlitch = {
"float rand(vec2 co){",
- "return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);",
+ " return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);",
"}",
"void main() {",
- "if(byp<1) {",
- "vec2 p = vUv;",
- "float xs = floor(gl_FragCoord.x / 0.5);",
- "float ys = floor(gl_FragCoord.y / 0.5);",
- //based on staffantans glitch shader for unity https://github.com/staffantan/unityglitch
- "vec4 normal = texture2D (tDisp, p*seed*seed);",
- "if(p.y<distortion_x+col_s && p.y>distortion_x-col_s*seed) {",
- "if(seed_x>0.){",
- "p.y = 1. - (p.y + distortion_y);",
- "}",
- "else {",
- "p.y = distortion_y;",
- "}",
- "}",
- "if(p.x<distortion_y+col_s && p.x>distortion_y-col_s*seed) {",
- "if(seed_y>0.){",
- "p.x=distortion_x;",
- "}",
- "else {",
- "p.x = 1. - (p.x + distortion_x);",
- "}",
- "}",
- "p.x+=normal.x*seed_x*(seed/5.);",
- "p.y+=normal.y*seed_y*(seed/5.);",
- //base from RGB shift shader
- "vec2 offset = amount * vec2( cos(angle), sin(angle));",
- "vec4 cr = texture2D(tDiffuse, p + offset);",
- "vec4 cga = texture2D(tDiffuse, p);",
- "vec4 cb = texture2D(tDiffuse, p - offset);",
- "gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);",
- //add noise
- "vec4 snow = 200.*amount*vec4(rand(vec2(xs * seed,ys * seed*50.))*0.2);",
- "gl_FragColor = gl_FragColor+ snow;",
- "}",
- "else {",
- "gl_FragColor=texture2D (tDiffuse, vUv);",
- "}",
+ " if(byp<1) {",
+ " vec2 p = vUv;",
+ " float xs = floor(gl_FragCoord.x / 0.5);",
+ " float ys = floor(gl_FragCoord.y / 0.5);",
+ //based on staffantans glitch shader for unity https://github.com/staffantan/unityglitch
+ " vec4 normal = texture2D (tDisp, p*seed*seed);",
+ " if(p.y<distortion_x+col_s && p.y>distortion_x-col_s*seed) {",
+ " if(seed_x>0.){",
+ " p.y = 1. - (p.y + distortion_y);",
+ " }",
+ " else {",
+ " p.y = distortion_y;",
+ " }",
+ " }",
+ " if(p.x<distortion_y+col_s && p.x>distortion_y-col_s*seed) {",
+ " if(seed_y>0.){",
+ " p.x=distortion_x;",
+ " }",
+ " else {",
+ " p.x = 1. - (p.x + distortion_x);",
+ " }",
+ " }",
+ " p.x+=normal.x*seed_x*(seed/5.);",
+ " p.y+=normal.y*seed_y*(seed/5.);",
+ //base from RGB shift shader
+ " vec2 offset = amount * vec2( cos(angle), sin(angle));",
+ " vec4 cr = texture2D(tDiffuse, p + offset);",
+ " vec4 cga = texture2D(tDiffuse, p);",
+ " vec4 cb = texture2D(tDiffuse, p - offset);",
+ " gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);",
+ //add noise
+ " vec4 snow = 200.*amount*vec4(rand(vec2(xs * seed,ys * seed*50.))*0.2);",
+ " gl_FragColor = gl_FragColor+ snow;",
+ " }",
+ " else {",
+ " gl_FragColor=texture2D (tDiffuse, vUv);",
+ " }",
"}"
].join( "\n" ) | true |
Other | mrdoob | three.js | 9a2a09ac068d1eae93668c2eba2bca431be4b5b8.json | fix prem roughness | examples/jsm/nodes/misc/TextureCubeNode.js | @@ -84,7 +84,7 @@ TextureCubeNode.prototype.generate = function ( builder, output ) {
if ( builder.context.bias ) {
- builder.context.bias.setTexture( this );
+ builder.context.bias.setTexture( this.value );
}
| true |
Other | mrdoob | three.js | 9a2a09ac068d1eae93668c2eba2bca431be4b5b8.json | fix prem roughness | examples/jsm/nodes/misc/TextureCubeUVNode.js | @@ -171,7 +171,7 @@ TextureCubeUVNode.prototype.generate = function ( builder, output ) {
var textureCubeUV = builder.include( TextureCubeUVNode.Nodes.textureCubeUV );
- var biasNode = this.bias || builder.context.bias;
+ var biasNode = this.bias || builder.context.roughness;
return builder.format( textureCubeUV + '( ' + this.uv.build( builder, 'v3' ) + ', ' +
biasNode.build( builder, 'f' ) + ', ' + | true |
Other | mrdoob | three.js | 9a2a09ac068d1eae93668c2eba2bca431be4b5b8.json | fix prem roughness | examples/jsm/nodes/utils/MaxMIPLevelNode.js | @@ -26,7 +26,9 @@ Object.defineProperties( MaxMIPLevelNode.prototype, {
if ( this.maxMIPLevel === 0 ) {
- var image = this.texture.value.image ? this.texture.value.image[ 0 ] : undefined;
+ var image = this.texture.value.image;
+
+ if ( Array.isArray( image ) ) image = image[ 0 ];
this.maxMIPLevel = image !== undefined ? Math.log( Math.max( image.width, image.height ) ) * Math.LOG2E : 0;
| true |
Other | mrdoob | three.js | e84a71ab6664a43cf508d3056f07faea68dac4bc.json | add indent rule for typescript | package.json | @@ -32,7 +32,14 @@
"@typescript-eslint"
],
"rules": {
- "@typescript-eslint/no-unused-vars": 1
+ "@typescript-eslint/no-unused-vars": 1,
+ "@typescript-eslint/indent": [
+ "error",
+ "tab",
+ {
+ "SwitchCase": 1
+ }
+ ]
}
},
"scripts": { | false |
Other | mrdoob | three.js | 75435b9b08cd7eebb25394ae45b3f888dd001027.json | fix lint error | src/renderers/webgl/WebGLLights.js | @@ -355,7 +355,7 @@ function WebGLLights() {
hash.hemiLength = hemiLength;
hash.shadowsLength = shadows.length;
- hash.value++;
+ hash.value ++;
}
| false |
Other | mrdoob | three.js | d1e8efae1cec770c317015f95319eb227d49db9a.json | use new hash value | src/renderers/WebGLRenderer.js | @@ -1463,20 +1463,10 @@ function WebGLRenderer( parameters ) {
releaseMaterialProgramReference( material );
} else if ( lightsHash.stateID !== lightsStateHash.stateID ||
- lightsHash.directionalLength !== lightsStateHash.directionalLength ||
- lightsHash.pointLength !== lightsStateHash.pointLength ||
- lightsHash.spotLength !== lightsStateHash.spotLength ||
- lightsHash.rectAreaLength !== lightsStateHash.rectAreaLength ||
- lightsHash.hemiLength !== lightsStateHash.hemiLength ||
- lightsHash.shadowsLength !== lightsStateHash.shadowsLength ) {
+ lightsHash.value !== lightsStateHash.directionalLength ) {
lightsHash.stateID = lightsStateHash.stateID;
- lightsHash.directionalLength = lightsStateHash.directionalLength;
- lightsHash.pointLength = lightsStateHash.pointLength;
- lightsHash.spotLength = lightsStateHash.spotLength;
- lightsHash.rectAreaLength = lightsStateHash.rectAreaLength;
- lightsHash.hemiLength = lightsStateHash.hemiLength;
- lightsHash.shadowsLength = lightsStateHash.shadowsLength;
+ lightsHash.value = lightsStateHash.value;
programChange = false;
@@ -1584,12 +1574,7 @@ function WebGLRenderer( parameters ) {
}
lightsHash.stateID = lightsStateHash.stateID;
- lightsHash.directionalLength = lightsStateHash.directionalLength;
- lightsHash.pointLength = lightsStateHash.pointLength;
- lightsHash.spotLength = lightsStateHash.spotLength;
- lightsHash.rectAreaLength = lightsStateHash.rectAreaLength;
- lightsHash.hemiLength = lightsStateHash.hemiLength;
- lightsHash.shadowsLength = lightsStateHash.shadowsLength;
+ lightsHash.value = lightsStateHash.value;
if ( material.lights ) {
@@ -1661,12 +1646,7 @@ function WebGLRenderer( parameters ) {
material.needsUpdate = true;
} else if ( material.lights && ( lightsHash.stateID !== lightsStateHash.stateID ||
- lightsHash.directionalLength !== lightsStateHash.directionalLength ||
- lightsHash.pointLength !== lightsStateHash.pointLength ||
- lightsHash.spotLength !== lightsStateHash.spotLength ||
- lightsHash.rectAreaLength !== lightsStateHash.rectAreaLength ||
- lightsHash.hemiLength !== lightsStateHash.hemiLength ||
- lightsHash.shadowsLength !== lightsStateHash.shadowsLength ) ) {
+ lightsHash.value !== lightsStateHash.value ) ) {
material.needsUpdate = true;
| true |
Other | mrdoob | three.js | d1e8efae1cec770c317015f95319eb227d49db9a.json | use new hash value | src/renderers/webgl/WebGLLights.js | @@ -117,7 +117,8 @@ function WebGLLights() {
spotLength: - 1,
rectAreaLength: - 1,
hemiLength: - 1,
- shadowsLength: - 1
+ shadowsLength: - 1,
+ value: 0
},
ambient: [ 0, 0, 0 ],
@@ -331,19 +332,32 @@ function WebGLLights() {
state.ambient[ 1 ] = g;
state.ambient[ 2 ] = b;
- state.directional.length = directionalLength;
- state.spot.length = spotLength;
- state.rectArea.length = rectAreaLength;
- state.point.length = pointLength;
- state.hemi.length = hemiLength;
-
- state.hash.stateID = state.id;
- state.hash.directionalLength = directionalLength;
- state.hash.pointLength = pointLength;
- state.hash.spotLength = spotLength;
- state.hash.rectAreaLength = rectAreaLength;
- state.hash.hemiLength = hemiLength;
- state.hash.shadowsLength = shadows.length;
+ var hash = state.hash;
+
+ if ( hash.directionalLength !== directionalLength ||
+ hash.pointLength !== pointLength ||
+ hash.spotLength !== spotLength ||
+ hash.rectAreaLength !== rectAreaLength ||
+ hash.hemiLength !== hemiLength ||
+ hash.shadowsLength !== shadows.length ) {
+
+ state.directional.length = directionalLength;
+ state.spot.length = spotLength;
+ state.rectArea.length = rectAreaLength;
+ state.point.length = pointLength;
+ state.hemi.length = hemiLength;
+
+ hash.stateID = state.id;
+ hash.directionalLength = directionalLength;
+ hash.pointLength = pointLength;
+ hash.spotLength = spotLength;
+ hash.rectAreaLength = rectAreaLength;
+ hash.hemiLength = hemiLength;
+ hash.shadowsLength = shadows.length;
+
+ hash.value++;
+
+ }
}
| true |
Other | mrdoob | three.js | e879da10e2ccc9d05200c9f36259638e3b02ac8a.json | fix lgtm error | examples/js/renderers/WebGLDeferredRenderer.js | @@ -606,7 +606,7 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
}
- updateDeferredColorUniforms( renderer, scene, camera, geometry, material, group );
+ updateDeferredColorUniforms( renderer, scene, camera, geometry, material );
material.uniforms.samplerLight.value = _compLight.renderTarget2.texture;
| false |
Other | mrdoob | three.js | 75e66cdfecf52be218a07a055e12be5bcc698618.json | Add setNumViews() to WebGLMultiview | src/renderers/WebGLMultiviewRenderTarget.js | @@ -30,6 +30,19 @@ WebGLMultiviewRenderTarget.prototype = Object.assign( Object.create( WebGLRender
return this;
+ },
+
+ setNumViews: function ( numViews ) {
+
+ if ( this.numViews !== numViews ) {
+
+ this.numViews = numViews;
+ this.dispose();
+
+ }
+
+ return this;
+
}
} ); | true |
Other | mrdoob | three.js | 75e66cdfecf52be218a07a055e12be5bcc698618.json | Add setNumViews() to WebGLMultiview | src/renderers/WebGLRenderer.js | @@ -1242,9 +1242,9 @@ function WebGLRenderer( parameters ) {
state.setPolygonOffset( false );
- if ( this.multiview.isEnabled() ) {
+ if ( multiview.isEnabled() ) {
- this.multiview.detachRenderTarget( camera );
+ multiview.detachRenderTarget( camera );
}
| true |
Other | mrdoob | three.js | 75e66cdfecf52be218a07a055e12be5bcc698618.json | Add setNumViews() to WebGLMultiview | src/renderers/webgl/WebGLMultiview.js | @@ -11,44 +11,42 @@ function WebGLMultiview( renderer, requested, options ) {
options = Object.assign( {}, { debug: false }, options );
+ var DEFAULT_NUMVIEWS = 2;
var gl = renderer.context;
var canvas = renderer.domElement;
var capabilities = renderer.capabilities;
var properties = renderer.properties;
- var numViews = 2;
var renderTarget, currentRenderTarget;
- // Auxiliary matrices to be used when updating arrays of uniforms
- var aux = {
- mat4: [],
- mat3: []
- };
+ this.getMaxViews = function () {
- for ( var i = 0; i < numViews; i ++ ) {
+ return capabilities.maxMultiviewViews;
- aux.mat4[ i ] = new Matrix4();
- aux.mat3[ i ] = new Matrix3();
+ };
- }
+ this.getNumViews = function () {
- //
+ return renderTarget ? renderTarget.numViews : 1;
- this.isAvailable = function () {
+ };
- return capabilities.multiview;
+ // Auxiliary matrices to be used when updating arrays of uniforms
+ var mat4 = [];
+ var mat3 = [];
- };
+ for ( var i = 0; i < this.getMaxViews(); i ++ ) {
- this.getNumViews = function () {
+ mat4[ i ] = new Matrix4();
+ mat3[ i ] = new Matrix3();
- return numViews;
+ }
- };
+ //
- this.getMaxViews = function () {
+ this.isAvailable = function () {
- return capabilities.maxMultiviewViews;
+ return capabilities.multiview;
};
@@ -72,82 +70,88 @@ function WebGLMultiview( renderer, requested, options ) {
}
- this.updateCameraProjectionMatrices = function ( camera, p_uniforms ) {
+ this.updateCameraProjectionMatrices = function ( camera, uniforms ) {
+
+ var numViews = this.getNumViews();
if ( camera.isArrayCamera ) {
for ( var i = 0; i < numViews; i ++ ) {
- aux.mat4[ i ].copy( camera.cameras[ i ].projectionMatrix );
+ mat4[ i ].copy( camera.cameras[ i ].projectionMatrix );
}
} else {
for ( var i = 0; i < numViews; i ++ ) {
- aux.mat4[ i ].copy( camera.projectionMatrix );
+ mat4[ i ].copy( camera.projectionMatrix );
}
}
- p_uniforms.setValue( gl, 'projectionMatrices', aux.mat4 );
+ uniforms.setValue( gl, 'projectionMatrices', mat4 );
};
- this.updateCameraViewMatrices = function ( camera, p_uniforms ) {
+ this.updateCameraViewMatrices = function ( camera, uniforms ) {
+
+ var numViews = this.getNumViews();
if ( camera.isArrayCamera ) {
for ( var i = 0; i < numViews; i ++ ) {
- aux.mat4[ i ].copy( camera.cameras[ i ].matrixWorldInverse );
+ mat4[ i ].copy( camera.cameras[ i ].matrixWorldInverse );
}
} else {
for ( var i = 0; i < numViews; i ++ ) {
- aux.mat4[ i ].copy( camera.matrixWorldInverse );
+ mat4[ i ].copy( camera.matrixWorldInverse );
}
}
- p_uniforms.setValue( gl, 'viewMatrices', aux.mat4 );
+ uniforms.setValue( gl, 'viewMatrices', mat4 );
};
- this.updateObjectMatrices = function ( object, camera, p_uniforms ) {
+ this.updateObjectMatrices = function ( object, camera, uniforms ) {
+
+ var numViews = this.getNumViews();
if ( camera.isArrayCamera ) {
for ( var i = 0; i < numViews; i ++ ) {
- aux.mat4[ i ].multiplyMatrices( camera.cameras[ i ].matrixWorldInverse, object.matrixWorld );
- aux.mat3[ i ].getNormalMatrix( aux.mat4[ i ] );
+ mat4[ i ].multiplyMatrices( camera.cameras[ i ].matrixWorldInverse, object.matrixWorld );
+ mat3[ i ].getNormalMatrix( mat4[ i ] );
}
} else {
// In this case we still need to provide an array of matrices but just the first one will be used
- aux.mat4[ 0 ].multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
- aux.mat3[ 0 ].getNormalMatrix( aux.mat4[ 0 ] );
+ mat4[ 0 ].multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
+ mat3[ 0 ].getNormalMatrix( mat4[ 0 ] );
for ( var i = 1; i < numViews; i ++ ) {
- aux.mat4[ i ].copy( aux.mat4[ 0 ] );
- aux.mat3[ i ].copy( aux.mat3[ 0 ] );
+ mat4[ i ].copy( mat4[ 0 ] );
+ mat3[ i ].copy( mat3[ 0 ] );
}
}
- p_uniforms.setValue( gl, 'modelViewMatrices', aux.mat4 );
- p_uniforms.setValue( gl, 'normalMatrices', aux.mat3 );
+ uniforms.setValue( gl, 'modelViewMatrices', mat4 );
+ uniforms.setValue( gl, 'normalMatrices', mat3 );
};
@@ -167,6 +171,12 @@ function WebGLMultiview( renderer, requested, options ) {
width *= bounds.z;
height *= bounds.w;
+ renderTarget.setNumViews( camera.cameras.length );
+
+ } else {
+
+ renderTarget.setNumViews( DEFAULT_NUMVIEWS );
+
}
renderTarget.setSize( width, height );
@@ -213,7 +223,7 @@ function WebGLMultiview( renderer, requested, options ) {
if ( this.isEnabled() ) {
- renderTarget = new WebGLMultiviewRenderTarget( canvas.width, canvas.height, numViews );
+ renderTarget = new WebGLMultiviewRenderTarget( canvas.width, canvas.height, this.numViews );
}
| true |
Other | mrdoob | three.js | 75e66cdfecf52be218a07a055e12be5bcc698618.json | Add setNumViews() to WebGLMultiview | src/renderers/webgl/WebGLTextures.js | @@ -1024,11 +1024,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
ext.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, depthStencilTexture, 0, 0, numViews );
var viewFramebuffers = new Array( numViews );
- for ( var viewIndex = 0; viewIndex < numViews; ++ viewIndex ) {
+ for ( var i = 0; i < numViews; ++ i ) {
- viewFramebuffers[ viewIndex ] = _gl.createFramebuffer();
- _gl.bindFramebuffer( _gl.FRAMEBUFFER, viewFramebuffers[ viewIndex ] );
- _gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, colorTexture, 0, viewIndex );
+ viewFramebuffers[ i ] = _gl.createFramebuffer();
+ _gl.bindFramebuffer( _gl.FRAMEBUFFER, viewFramebuffers[ i ] );
+ _gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, colorTexture, 0, i );
}
| true |
Other | mrdoob | three.js | ffc4b96b51fa5709d93c7a5bdbef1b80d5e5f720.json | Add WebGL multiple views with multiview example | examples/files.js | @@ -201,6 +201,7 @@ var files = {
"webgl_multiple_renderers",
"webgl_multiple_scenes_comparison",
"webgl_multiple_views",
+ "webvr_multiple_views_multiview",
"webgl_nearestneighbour",
"webgl_panorama_cube",
"webgl_panorama_dualfisheye", | true |
Other | mrdoob | three.js | ffc4b96b51fa5709d93c7a5bdbef1b80d5e5f720.json | Add WebGL multiple views with multiview example | examples/webgl_multiple_views_multiview.html | @@ -0,0 +1,294 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <title>three.js performance - animation</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+ <style>
+ body {
+ font-family: Monospace;
+ background-color: #000;
+ margin: 0px;
+ overflow: hidden;
+ }
+ #info {
+ position: absolute;
+ top: 10px;
+ width: 100%;
+ text-align: center;
+ z-index: 100;
+ display:block;
+ }
+ #info p {
+ max-width: 600px;
+ margin-left: auto;
+ margin-right: auto;
+ padding: 0 2em;
+ }
+ #info a {
+ color: #2fa1d6;
+ font-weight: bold;
+ }
+ .dg.ac {
+ z-index: 999 !important;
+ }
+ </style>
+ </head>
+
+ <body>
+
+ <div id="container"></div>
+ <div id="info">
+ <a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> webgl - multiple views using multiview extension - by <a href="https://twitter.com/fernandojsg">fernandojsg</a><br/>
+ <span id="options"></span>
+ </div>
+
+ <script src="../build/three.js"></script>
+ <script src="js/loaders/GLTFLoader.js"></script>
+ <script src="js/libs/stats.min.js"></script>
+ <script>
+
+ var container, clock, stats;
+ var camera, scene, renderer, panel, balls;
+ var radius = 0.08;
+
+ var mixers = [];
+ var cameras = [];
+
+ init();
+
+ function addNumLink( value ) {
+
+ return `<a href="?num=${ value }">${ value }</a>`;
+
+ }
+
+ function init() {
+
+ const urlParams = new URLSearchParams(window.location.search);
+
+ container = document.getElementById('container');
+
+ var options = document.getElementById('options');
+ options.innerHTML =`Number of balls:
+ ${addNumLink(200)}
+ ${addNumLink(500)}
+ ${addNumLink(1000)}
+ ${addNumLink(2500)}
+ ${addNumLink(5000)}`;
+
+
+ var ASPECT_RATIO = window.innerWidth / window.innerHeight;
+ var AMOUNT = 2;
+ var SIZE = 1 / AMOUNT;
+ var WIDTH = ( window.innerWidth / AMOUNT ) * window.devicePixelRatio;
+ var HEIGHT = ( window.innerHeight / AMOUNT ) * window.devicePixelRatio;
+
+ for ( var y = 0; y < AMOUNT; y ++ ) {
+
+ for ( var x = 0; x < AMOUNT; x ++ ) {
+
+ var subcamera = new THREE.PerspectiveCamera( 40 + (x + y) * 20, ASPECT_RATIO, 0.25, 100 );
+ subcamera.bounds = new THREE.Vector4( x / AMOUNT, y / AMOUNT, SIZE, SIZE );
+
+ subcamera.position.x = ( x / AMOUNT ) * 5 - 0.5;
+ subcamera.position.y = ( y / AMOUNT ) * 5 + 1;
+ subcamera.position.z = 6;
+ subcamera.position.multiplyScalar( 1.5 );
+
+ subcamera.lookAt( 0, 2, 0 );
+ subcamera.updateMatrixWorld();
+ cameras.push( subcamera );
+
+ }
+
+ }
+
+ camera = new THREE.ArrayCamera( cameras );
+
+ // Needed to do the frustum culling
+ camera.fov = 180;
+ camera.position.set(0, 0, 6);
+ camera.aspect = ASPECT_RATIO;
+ camera.updateProjectionMatrix();
+
+ //
+
+ scene = new THREE.Scene();
+ scene.background = new THREE.Color( 0xe0e0e0 );
+ scene.fog = new THREE.Fog( 0xe0e0e0, 20, 100 );
+
+ clock = new THREE.Clock();
+
+ // lights
+
+ var light = new THREE.HemisphereLight( 0xffffff, 0x444444 );
+ light.position.set( 0, 20, 0 );
+ scene.add( light );
+
+ light = new THREE.DirectionalLight( 0xffffff );
+ light.position.set( 0, 20, 10 );
+ scene.add( light );
+
+ // ground
+
+ var mesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2000, 2000 ), new THREE.MeshPhongMaterial( { color: 0x999999, depthWrite: false } ) );
+ mesh.rotation.x = - Math.PI / 2;
+ scene.add( mesh );
+
+ var grid = new THREE.GridHelper( 200, 40, 0x000000, 0x000000 );
+ grid.material.opacity = 0.2;
+ grid.material.transparent = true;
+ scene.add( grid );
+
+ // balls
+ balls = new THREE.Group();
+ scene.add( balls );
+
+ var geometry = new THREE.IcosahedronBufferGeometry( radius, 2 );
+
+ var numObjects = urlParams.get('num') || 1000;
+
+ for ( var i = 0; i < numObjects; i ++ ) {
+
+ var object = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff } ) );
+
+ object.position.x = Math.random() * 20 - 10;
+ object.position.y = Math.random() * 10 + 5;
+ object.position.z = Math.random() * 20 - 10;
+
+ object.userData.velocity = new THREE.Vector3();
+ object.userData.velocity.x = Math.random() * 0.01 - 0.005;
+ object.userData.velocity.y = Math.random() * 0.01 - 0.005;
+ object.userData.velocity.z = Math.random() * 0.01 - 0.005;
+
+ balls.add( object );
+
+ }
+
+
+ // model
+
+ var loader = new THREE.GLTFLoader();
+
+ loader.load( 'models/gltf/RobotExpressive/RobotExpressive.glb', function( gltf ) {
+
+ var model = gltf.scene;
+ var animations = gltf.animations;
+
+ scene.add( model );
+
+ var mixer = new THREE.AnimationMixer( model );
+ mixer.clipAction( animations[ 10 ] ).play();
+ mixers.push( mixer );
+
+ animate();
+
+ }, undefined, function( e ) {
+
+ console.error( e );
+
+ } );
+
+ var canvas = document.createElement( 'canvas' );
+ var context = canvas.getContext( 'webgl2', { antialias: false } );
+ renderer = new THREE.WebGLRenderer( { context: context, canvas: canvas, antialias: true, multiview: true } );
+ renderer.setPixelRatio( window.devicePixelRatio );
+ renderer.setSize( window.innerWidth, window.innerHeight );
+ renderer.gammaOutput = true;
+ renderer.gammaFactor = 2.2;
+ container.appendChild( renderer.domElement );
+
+ //
+
+ stats = new Stats();
+ document.body.appendChild( stats.dom );
+ panel = stats.addPanel( new Stats.Panel( 'renderer.render()', '#ff8', '#221' ) );
+ stats.showPanel( 3 );
+
+ window.addEventListener( 'resize', onWindowResize, false );
+
+ }
+
+ function onWindowResize() {
+
+ camera.aspect = window.innerWidth / window.innerHeight;
+ camera.updateProjectionMatrix();
+
+ for ( var i = 0; i < cameras.length; i ++ ) {
+
+ cameras[ i ].aspect = camera.aspect;
+ cameras[ i ].updateProjectionMatrix();
+
+ }
+
+ renderer.setSize( window.innerWidth, window.innerHeight );
+
+ }
+
+ //
+
+ function animate() {
+
+ requestAnimationFrame( animate );
+
+ var delta = clock.getDelta();
+ var time = clock.getElapsedTime();
+
+ for ( var i = 0, il = mixers.length; i < il; i ++ ) {
+
+ mixers[ i ].update( delta );
+
+ }
+
+ // Update camera animations
+ cameras[ 0 ].position.y += Math.sin( time * 2 ) * 0.02;
+ cameras[ 0 ].updateMatrixWorld();
+
+ cameras[ 1 ].position.z += Math.sin( time ) * 0.1;
+ cameras[ 1 ].updateMatrixWorld();
+
+ cameras[ 3 ].position.x = Math.sin( time ) * Math.PI;
+ cameras[ 3 ].position.z = Math.cos( time ) * Math.PI;
+ cameras[ 3 ].lookAt( 0, 2, 0 );
+ cameras[ 3 ].updateMatrixWorld();
+
+ // delta *=1000;
+
+ delta *= 0.5;
+
+ // Update balls
+ for ( var i = 0; i < balls.children.length; i ++ ) {
+
+ var object = balls.children[ i ];
+
+ object.position.y += object.userData.velocity.y * delta;
+
+ // keep objects inside room
+ if ( object.position.y < radius || object.position.y > 15 ) {
+
+ object.position.y = Math.max( object.position.y, radius );
+
+ object.userData.velocity.y = - object.userData.velocity.y * 0.8;
+
+ }
+
+ object.userData.velocity.y -= 9.8 * delta;
+
+ }
+
+ //
+
+ var t = performance.now();
+ renderer.render( scene, camera );
+
+ panel.update(performance.now() - t, 460);
+
+ stats.update();
+
+ }
+
+ </script>
+
+ </body>
+</html> | true |
Other | mrdoob | three.js | 4093be22f8061f7bcd6c9fd564f83d0ee0eb0846.json | Add modelview and normalview matrices | src/renderers/WebGLRenderer.js | @@ -1461,8 +1461,16 @@ function WebGLRenderer( parameters ) {
object.onBeforeRender( _this, scene, camera, geometry, material, group );
currentRenderState = renderStates.get( scene, _currentArrayCamera || camera );
- object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
- object.normalMatrix.getNormalMatrix( object.modelViewMatrix );
+ if ( multiview.isEnabled() ) {
+
+ multiview.computeObjectMatrices( object, camera );
+
+ } else {
+
+ object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
+ object.normalMatrix.getNormalMatrix( object.modelViewMatrix );
+
+ }
if ( object.isImmediateRenderObject ) {
@@ -2013,8 +2021,18 @@ function WebGLRenderer( parameters ) {
// common matrices
- p_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );
- p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
+ if ( material.supportsMultiview && multiview.isEnabled() ) {
+
+ p_uniforms.setValue( _gl, 'modelViewMatrices', object.modelViewMatrices );
+ p_uniforms.setValue( _gl, 'normalMatrices', object.normalMatrices );
+
+ } else {
+
+ p_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );
+ p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
+
+ }
+
p_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );
return program; | true |
Other | mrdoob | three.js | 4093be22f8061f7bcd6c9fd564f83d0ee0eb0846.json | Add modelview and normalview matrices | src/renderers/webgl/WebGLMultiview.js | @@ -3,6 +3,8 @@
*/
import { WebGLRenderTarget } from '../WebGLRenderTarget.js';
+import { Matrix3 } from '../../math/Matrix3.js';
+import { Matrix4 } from '../../math/Matrix4.js';
function WebGLMultiview( requested, gl, canvas, extensions, capabilities, properties ) {
@@ -24,7 +26,6 @@ function WebGLMultiview( requested, gl, canvas, extensions, capabilities, proper
};
-
if ( requested && ! this.isAvailable() ) {
console.warn( 'WebGLRenderer: Multiview requested but not supported by the browser' );
@@ -46,6 +47,47 @@ function WebGLMultiview( requested, gl, canvas, extensions, capabilities, proper
depthStencil: null
};
+ this.computeObjectMatrices = function ( object, camera ) {
+
+ if ( ! object.modelViewMatrices ) {
+
+ object.modelViewMatrices = new Array( numViews );
+ object.normalMatrices = new Array( numViews );
+
+ for ( var i = 0; i < numViews; i ++ ) {
+
+ object.modelViewMatrices[ i ] = new Matrix4();
+ object.normalMatrices[ i ] = new Matrix3();
+
+ }
+
+ }
+
+ if ( camera.isArrayCamera ) {
+
+ for ( var i = 0; i < numViews; i ++ ) {
+
+ object.modelViewMatrices[ i ].multiplyMatrices( camera.cameras[ i ].matrixWorldInverse, object.matrixWorld );
+ object.normalMatrices[ i ].getNormalMatrix( object.modelViewMatrices[ i ] );
+
+ }
+
+ } else {
+
+ // In this case we still need to provide an array of matrices but just the first one will be used
+ object.modelViewMatrices[ 0 ].multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
+ object.normalMatrices[ 0 ].getNormalMatrix( object.modelViewMatrices[ 0 ] );
+
+ for ( var i = 0; i < numViews; i ++ ) {
+
+ object.modelViewMatrices[ i ].copy( object.modelViewMatrices[ 0 ] );
+ object.normalMatrices[ i ].copy( object.normalMatrices[ 0 ] );
+
+ }
+
+ }
+
+ };
// @todo Get ArrayCamera
this.createMultiviewRenderTargetTexture = function () { | true |
Other | mrdoob | three.js | 4093be22f8061f7bcd6c9fd564f83d0ee0eb0846.json | Add modelview and normalview matrices | src/renderers/webgl/WebGLProgram.js | @@ -431,11 +431,13 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
'uniform vec3 cameraPosition;',
material.supportsMultiview && renderer.multiview.isEnabled() ? [
- 'uniform mat4 modelViewMatrix;',
- 'uniform mat3 normalMatrix;',
+ 'uniform mat4 modelViewMatrices[2];',
+ 'uniform mat3 normalMatrices[2];',
'uniform mat4 viewMatrices[2];',
'uniform mat4 projectionMatrices[2];',
+ '#define modelViewMatrix modelViewMatrices[VIEW_ID]',
+ '#define normalMatrix normalMatrices[VIEW_ID]',
'#define viewMatrix viewMatrices[VIEW_ID]',
'#define projectionMatrix projectionMatrices[VIEW_ID]'
| true |
Other | mrdoob | three.js | b7913214ec2394dde1499cdc7255f494769fcb38.json | Add number of objects parameter on multiview demo | examples/webvr_ballshooter_multiview.html | @@ -112,9 +112,20 @@
}
+ function addNumLink( value ) {
+
+ return `<a href="?num=${ value }&${!multiview ? '' : 'enableMultiview'}">${ value }</a>`;
+
+ }
+
// @todo Change enabled for requested and check renderer.vr.multiview
- info.innerHTML = '<b>OVR_multiview2</b> demo<br/>requested: ' + colorize(multiview) + ` <a href="${multiview ? '?' : '?enableMultiview'}">toggle</a>`
- + `<br/>available: ${ colorize( renderer.multiview.isAvailable() ) }<br/>enabled: ${ colorize( renderer.multiview.isEnabled() ) }<br/><br/>`;
+ info.innerHTML = '<b>OVR_multiview2</b> demo<br/>requested: ' + colorize( multiview ) + ` <a href="?num=${ numObjects }&${ multiview ? '' : 'enableMultiview' }">toggle</a>`
+ + `<br/>available: ${ colorize( renderer.multiview.isAvailable() ) }<br/>enabled: ${ colorize( renderer.multiview.isEnabled() ) }<br/>
+ ${addNumLink(200)}
+ ${addNumLink(500)}
+ ${addNumLink(1000)}
+ ${addNumLink(5000)}
+ <br/>`;
container.appendChild( info );
ms = document.createElement('div');
ms.innerHTML = ''; | false |
Other | mrdoob | three.js | 24302ae5e9613dbe0d5de4a206d655870716dcb5.json | Add multiview status on example | examples/webvr_ballshooter_multiview.html | @@ -44,23 +44,12 @@
animate();
function init() {
- const urlParams = new URLSearchParams(window.location.search);
- const multiview = urlParams.has('enableMultiview');
container = document.createElement( 'div' );
document.body.appendChild( container );
- var info = document.createElement( 'div' );
- info.style.position = 'absolute';
- info.style.top = '10px';
- info.style.width = '100%';
- info.style.textAlign = 'center';
- // @todo Change enabled for requested and check renderer.vr.multiview
- info.innerHTML = 'OVR_multiview2 demo - ' + (multiview ? '<b style="color:#3f3">multiview enabled</b>' : '<b style="color:#f33">multiview not enabled</b>') + ` <a href="${multiview ? '?' : '?enableMultiview'}">toggle</a>`;
- container.appendChild( info );
- ms = document.createElement('div');
- ms.innerHTML = '';
- info.appendChild(ms);
+ const urlParams = new URLSearchParams(window.location.search);
+ const multiview = urlParams.has('enableMultiview');
scene = new THREE.Scene();
scene.background = new THREE.Color( 0x505050 );
@@ -111,6 +100,29 @@
//
+ var info = document.createElement( 'div' );
+ info.style.position = 'absolute';
+ info.style.top = '10px';
+ info.style.width = '100%';
+ info.style.textAlign = 'center';
+
+ function colorize( value ) {
+
+ return value ? '<b style="color:#3f3">true</b>' : '<b style="color:#f33">false</b>';
+
+ }
+
+ // @todo Change enabled for requested and check renderer.vr.multiview
+ info.innerHTML = '<b>OVR_multiview2</b> demo<br/>requested: ' + colorize(multiview) + ` <a href="${multiview ? '?' : '?enableMultiview'}">toggle</a>`
+ + `<br/>available: ${ colorize( renderer.multiview.isAvailable() ) }<br/>enabled: ${ colorize( renderer.multiview.isEnabled() ) }<br/><br/>`;
+ container.appendChild( info );
+ ms = document.createElement('div');
+ ms.innerHTML = '';
+ info.appendChild(ms);
+
+ //+ (multiview ? '<b style="color:#3f3">true</b>' : '<b style="color:#f33">false</b>')
+ //
+
document.body.appendChild( WEBVR.createButton( renderer ) );
// controllers | true |
Other | mrdoob | three.js | 24302ae5e9613dbe0d5de4a206d655870716dcb5.json | Add multiview status on example | src/renderers/WebGLRenderer.js | @@ -59,7 +59,7 @@ function WebGLRenderer( parameters ) {
var _canvas = parameters.canvas !== undefined ? parameters.canvas : document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ),
_context = parameters.context !== undefined ? parameters.context : null,
- _multiview = parameters.multiview !== undefined ? parameters.multiview : false,
+ _multiviewRequested = parameters.multiview !== undefined ? parameters.multiview : false,
_alpha = parameters.alpha !== undefined ? parameters.alpha : false,
_depth = parameters.depth !== undefined ? parameters.depth : true,
@@ -315,8 +315,8 @@ function WebGLRenderer( parameters ) {
this.vr = vr;
- var multiviewObject = new WebGLMultiview(_multiview, _gl, _canvas, extensions, capabilities );
- var multiviewEnabled = this.multiviewEnabled = multiviewObject.isEnabled();
+ var multiview = this.multiview = new WebGLMultiview(_multiviewRequested, _gl, _canvas, extensions, capabilities );
+ var multiviewEnabled = this.multiviewEnabled = multiview.isEnabled();
// shadow map
@@ -1370,7 +1370,7 @@ function WebGLRenderer( parameters ) {
if ( multiviewEnabled ) {
- multiviewObject.bindMultiviewFrameBuffer( camera );
+ multiview.bindMultiviewFrameBuffer( camera );
_gl.disable( _gl.SCISSOR_TEST );
@@ -1403,7 +1403,7 @@ function WebGLRenderer( parameters ) {
}
- multiviewObject.unbindMultiviewFrameBuffer( camera );
+ multiview.unbindMultiviewFrameBuffer( camera );
} else {
| true |
Other | mrdoob | three.js | 24302ae5e9613dbe0d5de4a206d655870716dcb5.json | Add multiview status on example | src/renderers/webgl/WebGLMultiview.js | @@ -1,3 +1,7 @@
+/**
+ * @author fernandojsg / http://fernandojsg.com
+ */
+
function WebGLMultiview( requested, gl, canvas, extensions, capabilities ) {
this.isAvailable = function () { | true |
Other | mrdoob | three.js | 24302ae5e9613dbe0d5de4a206d655870716dcb5.json | Add multiview status on example | src/renderers/webgl/WebGLProgram.js | @@ -432,10 +432,10 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
renderer.multiviewEnabled ? [
'uniform mat4 modelViewMatrix;',
- 'uniform mat4 projectionMatrices[2];',
'uniform mat3 normalMatrix;',
-
'uniform mat4 viewMatrices[2];',
+ 'uniform mat4 projectionMatrices[2];',
+
'#define viewMatrix viewMatrices[VIEW_ID]',
'#define projectionMatrix projectionMatrices[VIEW_ID]'
| true |
Other | mrdoob | three.js | d7a2400097fc9c9698641839e97020d09a8f0134.json | Keep existing properties in object.userData | examples/js/loaders/GLTFLoader.js | @@ -1299,7 +1299,7 @@ THREE.GLTFLoader = ( function () {
if ( typeof gltfDef.extras === 'object' ) {
- object.userData = gltfDef.extras;
+ object.userData = Object.assign(object.userData, gltfDef.extras);
} else {
| false |
Other | mrdoob | three.js | c0beca7103cd7c636af7c5afda1d9e0bd61f3547.json | Fix the inversion | examples/js/loaders/LDrawLoader.js | @@ -1132,6 +1132,20 @@ THREE.LDrawLoader = ( function () {
}
+ // If the scale of the object is negated then the triangle winding order
+ // needs to be flipped.
+ var matrix = currentParseScope.matrix;
+ if (
+ matrix.determinant() < 0 && (
+ scope.separateObjects && isPrimitiveType( type ) ||
+ ! scope.separateObjects
+ ) ) {
+
+ currentParseScope.inverted = ! currentParseScope.inverted;
+
+ }
+
+
triangles = currentParseScope.triangles;
lineSegments = currentParseScope.lineSegments;
optionalSegments = currentParseScope.optionalSegments;
@@ -1301,14 +1315,6 @@ THREE.LDrawLoader = ( function () {
}
- // If the scale of the object is negated then the triangle winding order
- // needs to be flipped.
- if ( matrix.determinant() < 0 ) {
-
- bfcInverted = ! bfcInverted;
-
- }
-
subobjects.push( {
material: material,
matrix: matrix, | false |
Other | mrdoob | three.js | 3e745a8acc4b92f3d93bdcf4ac779e5be3d5f5b5.json | Add example options for hiding and showing lines | examples/webgl_loader_ldraw.html | @@ -109,7 +109,9 @@
guiData = {
modelFileName: modelFileList[ 'Car' ],
envMapActivated: false,
- separateObjects: false
+ separateObjects: false,
+ displayLines: true,
+ optionalLines: false
};
gui = new dat.GUI();
@@ -134,6 +136,17 @@
} );
+ gui.add( guiData, 'displayLines' ).name( 'Display Lines' ).onChange( function ( value ) {
+
+ model.children[ 1 ].visible = value;
+
+ } );
+
+ gui.add( guiData, 'optionalLines' ).name( 'Optional Lines' ).onChange( function ( value ) {
+
+ model.children[ 2 ].visible = value;
+
+ } );
window.addEventListener( 'resize', onWindowResize, false );
progressBarDiv = document.createElement( 'div' );
@@ -218,6 +231,9 @@
}
+ model.children[ 1 ].visible = guiData.displayLines;
+ model.children[ 2 ].visible = guiData.optionalLines;
+
// Adjust camera and light
var bbox = new THREE.Box3().setFromObject( model ); | false |
Other | mrdoob | three.js | f26d0adfc6c433f28525edacd958597a1e49184b.json | Fix separate objects | examples/js/loaders/LDrawLoader.js | @@ -273,6 +273,14 @@ THREE.LDrawLoader = ( function () {
var parentParseScope = scope.getParentParseScope();
+ // Set current matrix
+ if ( subobject ) {
+
+ parseScope.currentMatrix.multiplyMatrices( parentParseScope.currentMatrix, subobject.matrix );
+ parseScope.matrix = subobject.matrix.clone();
+
+ }
+
// Add to cache
var currentFileName = parentParseScope.currentFileName;
if ( currentFileName !== null ) {
@@ -362,6 +370,33 @@ THREE.LDrawLoader = ( function () {
} else {
+ if ( scope.separateObjects ) {
+
+ parseScope.lineSegments.forEach( ls => {
+
+ ls.v0.applyMatrix4( parseScope.matrix );
+ ls.v1.applyMatrix4( parseScope.matrix );
+
+ } );
+
+ parseScope.optionalSegments.forEach( ls => {
+
+ ls.v0.applyMatrix4( parseScope.matrix );
+ ls.v1.applyMatrix4( parseScope.matrix );
+
+ } );
+
+ parseScope.triangles.forEach( ls => {
+
+ ls.v0 = ls.v0.clone().applyMatrix4( parseScope.matrix );
+ ls.v1 = ls.v1.clone().applyMatrix4( parseScope.matrix );
+ ls.v2 = ls.v2.clone().applyMatrix4( parseScope.matrix );
+
+ } );
+
+ }
+
+
// TODO: we need to multiple matrices here
// TODO: First, instead of tracking matrices anywhere else we
// should just multiple everything here.
@@ -388,12 +423,6 @@ THREE.LDrawLoader = ( function () {
parseScope.mainEdgeColourCode = subobject.material.userData.edgeMaterial.userData.code;
parseScope.currentFileName = subobject.originalFileName;
- if ( ! scope.separateObjects ) {
-
- // Set current matrix
- parseScope.currentMatrix.multiplyMatrices( parentParseScope.currentMatrix, subobject.matrix );
-
- }
// If subobject was cached previously, use the cached one
var cached = scope.subobjectCache[ subobject.originalFileName.toLowerCase() ];
@@ -603,6 +632,7 @@ THREE.LDrawLoader = ( function () {
mainColourCode: topParseScope ? topParseScope.mainColourCode : '16',
mainEdgeColourCode: topParseScope ? topParseScope.mainEdgeColourCode : '24',
currentMatrix: new THREE.Matrix4(),
+ matrix: new THREE.Matrix4(),
// If false, it is a root material scope previous to parse
isFromParse: true,
@@ -1016,7 +1046,7 @@ THREE.LDrawLoader = ( function () {
if ( ! scope.separateObjects ) {
- v.applyMatrix4( parentParseScope.currentMatrix );
+ v.applyMatrix4( currentParseScope.currentMatrix );
}
| false |
Other | mrdoob | three.js | 0360f30b550f1b40d6c6e838324b2a18ee972768.json | Update WebGLRenderer docs (build in -> built in)
As stated in title, "build in" appears to be a mistake and should be "built in" | docs/api/en/renderers/WebGLRenderer.html | @@ -425,7 +425,7 @@ <h3>[method:null renderBufferImmediate]( [param:Object3D object], [param:shaderp
<h3>[method:null setAnimationLoop]( [param:Function callback] )</h3>
<p>[page:Function callback] — The function will be called every available frame. If `null` is passed it will stop any already ongoing animation.</p>
- <p>A build in function that can be used instead of [link:https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame requestAnimationFrame]. For WebVR projects this function must be used.</p>
+ <p>A built in function that can be used instead of [link:https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame requestAnimationFrame]. For WebVR projects this function must be used.</p>
<h3>[method:null setClearAlpha]( [param:Float alpha] )</h3>
<p>Sets the clear alpha. Valid input is a float between *0.0* and *1.0*.</p> | false |
Other | mrdoob | three.js | 0874f22ba084ac82f0bf4e9395e714d01cd172a6.json | Add bevelOffset to type definitions. | src/geometries/ExtrudeGeometry.d.ts | @@ -13,6 +13,7 @@ export interface ExtrudeGeometryOptions {
bevelEnabled?: boolean;
bevelThickness?: number;
bevelSize?: number;
+ bevelOffset?: number;
bevelSegments?: number;
extrudePath?: CurvePath<Vector3>;
UVGenerator?: UVGenerator; | true |
Other | mrdoob | three.js | 0874f22ba084ac82f0bf4e9395e714d01cd172a6.json | Add bevelOffset to type definitions. | src/geometries/TextGeometry.d.ts | @@ -10,6 +10,7 @@ export interface TextGeometryParameters {
bevelEnabled?: boolean;
bevelThickness?: number;
bevelSize?: number;
+ bevelOffset?: number;
bevelSegments?: number;
}
@@ -24,6 +25,7 @@ export class TextBufferGeometry extends ExtrudeBufferGeometry {
bevelEnabled: boolean;
bevelThickness: number;
bevelSize: number;
+ bevelOffset: number;
bevelSegments: number;
};
}
@@ -39,6 +41,7 @@ export class TextGeometry extends ExtrudeGeometry {
bevelEnabled: boolean;
bevelThickness: number;
bevelSize: number;
+ bevelOffset: number;
bevelSegments: number;
};
} | true |
Other | mrdoob | three.js | f4fb49e3d5b6d738baf367246f5fc83f86a9828d.json | Remove incorrect comment about lambert material | examples/js/loaders/LDrawLoader.js | @@ -859,7 +859,7 @@ THREE.LDrawLoader = ( function () {
case LDrawLoader.FINISH_TYPE_RUBBER:
- // Rubber is best simulated with Lambert
+ // Rubber finish
material = new THREE.MeshStandardMaterial( { color: colour, roughness: 0.9, metalness: 0 } );
canHaveEnvMap = false;
break; | false |
Other | mrdoob | three.js | 672258ec1dcaf18a809d1b2b52628540f1290ee7.json | Add .toJSON to BufferAttribute | src/core/BufferAttribute.js | @@ -319,6 +319,16 @@ Object.assign( BufferAttribute.prototype, {
return new this.constructor( this.array, this.itemSize ).copy( this );
+ },
+
+ toJSON: function() {
+
+ return {
+ itemSize: this.itemSize,
+ type: this.array.constructor.name,
+ array: Array.prototype.slice.call( this.array ),
+ normalized: this.normalized
+ };
}
} ); | true |
Other | mrdoob | three.js | 672258ec1dcaf18a809d1b2b52628540f1290ee7.json | Add .toJSON to BufferAttribute | src/core/BufferGeometry.js | @@ -1063,12 +1063,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
var attribute = attributes[ key ];
- var attributeData = {
- itemSize: attribute.itemSize,
- type: attribute.array.constructor.name,
- array: Array.prototype.slice.call( attribute.array ),
- normalized: attribute.normalized
- };
+ var attributeData = attribute.toJSON();
if ( attribute.name !== '' ) attributeData.name = attribute.name;
@@ -1089,12 +1084,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
var attribute = attributeArray[ i ];
- var attributeData = {
- itemSize: attribute.itemSize,
- type: attribute.array.constructor.name,
- array: Array.prototype.slice.call( attribute.array ),
- normalized: attribute.normalized
- };
+ var attributeData = attribute.toJSON();
if ( attribute.name !== '' ) attributeData.name = attribute.name;
| true |
Other | mrdoob | three.js | 672258ec1dcaf18a809d1b2b52628540f1290ee7.json | Add .toJSON to BufferAttribute | src/core/InstancedBufferAttribute.js | @@ -36,6 +36,18 @@ InstancedBufferAttribute.prototype = Object.assign( Object.create( BufferAttribu
return this;
+ },
+
+ toJSON: function () {
+
+ var data = BufferAttribute.prototype.toJSON.call( this );
+
+ data.meshPerAttribute = this.meshPerAttribute;
+
+ data.isInstancedBufferAttribute = true;
+
+ return data;
+
}
} ); | true |
Other | mrdoob | three.js | 480fd36a21768b6524e8ff24d6f47c4b41e4398a.json | fix box3 example | docs/api/en/math/Box3.html | @@ -20,25 +20,19 @@ <h2>Example</h2>
<code>
// Creating the object whose bounding box we want to compute
- var sphereGeom = new THREE.SphereGeometry();
var sphereObject = new THREE.Mesh(
- sphereGeom,
+ new THREE.SphereGeometry(),
new THREE.MeshBasicMaterial( 0xff0000 )
);
-
// Creating the actual bounding box with Box3
sphereObject.geometry.computeBoundingBox();
- var BBox = new THREE.Box3(
- sphereObject.geometry.boundingBox.min,
- sphereObject.geometry.boundingBox.max
- );
+ var box = sphereObject.geometry.boundingBox.clone();
- // Moving the sphere
- sphereObject.position.set( 7, 7, 7 );
-
- // Updating the bounding box
- // (to repeat each time the object is moved, rotated or scaled)
- BBox.copy( sphereObject.geometry.boundingBox ).applyMatrix4( sphereObject.matrixWorld );
+ // ...
+
+ // In the animation loop, to keep the bounding box updated after move/rotate/scale operations
+ sphereObject.updateMatrixWorld( true );
+ box.copy( sphereObject.geometry.boundingBox ).applyMatrix4( sphereObject.matrixWorld );
</code>
| false |
Other | mrdoob | three.js | 2af956b1a50cfe66bdd5e324009e1eb5f133f349.json | remove unused code | examples/webgl_materials_compile.html | @@ -58,7 +58,6 @@
var frame = new NodeFrame();
var teapot;
var controls;
- var rtTexture, rtMaterial;
var meshes = [];
document.getElementById( "preload" ).addEventListener( 'click', function () {
@@ -151,20 +150,6 @@
if ( mesh.material ) mesh.material.dispose();
- if ( rtTexture ) {
-
- rtTexture.dispose();
- rtTexture = null;
-
- }
-
- if ( rtMaterial ) {
-
- rtMaterial.dispose();
- rtMaterial = null;
-
- }
-
var mtl = new PhongNodeMaterial();
var time = new TimerNode();
@@ -218,8 +203,6 @@
renderer.setSize( width, height );
- if ( rtTexture ) rtTexture.setSize( width, height );
-
}
function animate() { | false |
Other | mrdoob | three.js | 898020bebbf2c15a2d7734813d0c4aaa05f00f96.json | Avoid unnecessary instantiation of objects | examples/js/postprocessing/OutlinePass.js | @@ -67,10 +67,10 @@ THREE.OutlinePass = function ( resolution, scene, camera, selectedObjects ) {
var MAX_EDGE_GLOW = 4;
this.separableBlurMaterial1 = this.getSeperableBlurMaterial( MAX_EDGE_THICKNESS );
- this.separableBlurMaterial1.uniforms[ "texSize" ].value = new THREE.Vector2( resx, resy );
+ this.separableBlurMaterial1.uniforms[ "texSize" ].value.set( resx, resy );
this.separableBlurMaterial1.uniforms[ "kernelRadius" ].value = 1;
this.separableBlurMaterial2 = this.getSeperableBlurMaterial( MAX_EDGE_GLOW );
- this.separableBlurMaterial2.uniforms[ "texSize" ].value = new THREE.Vector2( Math.round( resx / 2 ), Math.round( resy / 2 ) );
+ this.separableBlurMaterial2.uniforms[ "texSize" ].value.set( Math.round( resx / 2 ), Math.round( resy / 2 ) );
this.separableBlurMaterial2.uniforms[ "kernelRadius" ].value = MAX_EDGE_GLOW;
// Overlay material
@@ -142,15 +142,15 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype
this.renderTargetMaskDownSampleBuffer.setSize( resx, resy );
this.renderTargetBlurBuffer1.setSize( resx, resy );
this.renderTargetEdgeBuffer1.setSize( resx, resy );
- this.separableBlurMaterial1.uniforms[ "texSize" ].value = new THREE.Vector2( resx, resy );
+ this.separableBlurMaterial1.uniforms[ "texSize" ].value.set( resx, resy );
resx = Math.round( resx / 2 );
resy = Math.round( resy / 2 );
this.renderTargetBlurBuffer2.setSize( resx, resy );
this.renderTargetEdgeBuffer2.setSize( resx, resy );
- this.separableBlurMaterial2.uniforms[ "texSize" ].value = new THREE.Vector2( resx, resy );
+ this.separableBlurMaterial2.uniforms[ "texSize" ].value.set( resx, resy );
},
@@ -285,7 +285,7 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype
// Make non selected objects invisible, and draw only the selected objects, by comparing the depth buffer of non selected objects
this.changeVisibilityOfNonSelectedObjects( false );
this.renderScene.overrideMaterial = this.prepareMaskMaterial;
- this.prepareMaskMaterial.uniforms[ "cameraNearFar" ].value = new THREE.Vector2( this.renderCamera.near, this.renderCamera.far );
+ this.prepareMaskMaterial.uniforms[ "cameraNearFar" ].value.set( this.renderCamera.near, this.renderCamera.far );
this.prepareMaskMaterial.uniforms[ "depthTexture" ].value = this.renderTargetDepthBuffer.texture;
this.prepareMaskMaterial.uniforms[ "textureMatrix" ].value = this.textureMatrix;
renderer.setRenderTarget( this.renderTargetMaskBuffer );
@@ -317,7 +317,7 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype
// 3. Apply Edge Detection Pass
this.fsQuad.material = this.edgeDetectionMaterial;
this.edgeDetectionMaterial.uniforms[ "maskTexture" ].value = this.renderTargetMaskDownSampleBuffer.texture;
- this.edgeDetectionMaterial.uniforms[ "texSize" ].value = new THREE.Vector2( this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height );
+ this.edgeDetectionMaterial.uniforms[ "texSize" ].value.set( this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height );
this.edgeDetectionMaterial.uniforms[ "visibleEdgeColor" ].value = this.tempPulseColor1;
this.edgeDetectionMaterial.uniforms[ "hiddenEdgeColor" ].value = this.tempPulseColor2;
renderer.setRenderTarget( this.renderTargetEdgeBuffer1 );
@@ -390,7 +390,7 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype
uniforms: {
"depthTexture": { value: null },
"cameraNearFar": { value: new THREE.Vector2( 0.5, 0.5 ) },
- "textureMatrix": { value: new THREE.Matrix4() }
+ "textureMatrix": { value: null }
},
vertexShader: [ | true |
Other | mrdoob | three.js | 898020bebbf2c15a2d7734813d0c4aaa05f00f96.json | Avoid unnecessary instantiation of objects | examples/jsm/postprocessing/OutlinePass.js | @@ -87,10 +87,10 @@ var OutlinePass = function ( resolution, scene, camera, selectedObjects ) {
var MAX_EDGE_GLOW = 4;
this.separableBlurMaterial1 = this.getSeperableBlurMaterial( MAX_EDGE_THICKNESS );
- this.separableBlurMaterial1.uniforms[ "texSize" ].value = new Vector2( resx, resy );
+ this.separableBlurMaterial1.uniforms[ "texSize" ].value.set( resx, resy );
this.separableBlurMaterial1.uniforms[ "kernelRadius" ].value = 1;
this.separableBlurMaterial2 = this.getSeperableBlurMaterial( MAX_EDGE_GLOW );
- this.separableBlurMaterial2.uniforms[ "texSize" ].value = new Vector2( Math.round( resx / 2 ), Math.round( resy / 2 ) );
+ this.separableBlurMaterial2.uniforms[ "texSize" ].value.set( Math.round( resx / 2 ), Math.round( resy / 2 ) );
this.separableBlurMaterial2.uniforms[ "kernelRadius" ].value = MAX_EDGE_GLOW;
// Overlay material
@@ -162,15 +162,15 @@ OutlinePass.prototype = Object.assign( Object.create( Pass.prototype ), {
this.renderTargetMaskDownSampleBuffer.setSize( resx, resy );
this.renderTargetBlurBuffer1.setSize( resx, resy );
this.renderTargetEdgeBuffer1.setSize( resx, resy );
- this.separableBlurMaterial1.uniforms[ "texSize" ].value = new Vector2( resx, resy );
+ this.separableBlurMaterial1.uniforms[ "texSize" ].value.set( resx, resy );
resx = Math.round( resx / 2 );
resy = Math.round( resy / 2 );
this.renderTargetBlurBuffer2.setSize( resx, resy );
this.renderTargetEdgeBuffer2.setSize( resx, resy );
- this.separableBlurMaterial2.uniforms[ "texSize" ].value = new Vector2( resx, resy );
+ this.separableBlurMaterial2.uniforms[ "texSize" ].value.set( resx, resy );
},
@@ -305,7 +305,7 @@ OutlinePass.prototype = Object.assign( Object.create( Pass.prototype ), {
// Make non selected objects invisible, and draw only the selected objects, by comparing the depth buffer of non selected objects
this.changeVisibilityOfNonSelectedObjects( false );
this.renderScene.overrideMaterial = this.prepareMaskMaterial;
- this.prepareMaskMaterial.uniforms[ "cameraNearFar" ].value = new Vector2( this.renderCamera.near, this.renderCamera.far );
+ this.prepareMaskMaterial.uniforms[ "cameraNearFar" ].value.set( this.renderCamera.near, this.renderCamera.far );
this.prepareMaskMaterial.uniforms[ "depthTexture" ].value = this.renderTargetDepthBuffer.texture;
this.prepareMaskMaterial.uniforms[ "textureMatrix" ].value = this.textureMatrix;
renderer.setRenderTarget( this.renderTargetMaskBuffer );
@@ -337,7 +337,7 @@ OutlinePass.prototype = Object.assign( Object.create( Pass.prototype ), {
// 3. Apply Edge Detection Pass
this.fsQuad.material = this.edgeDetectionMaterial;
this.edgeDetectionMaterial.uniforms[ "maskTexture" ].value = this.renderTargetMaskDownSampleBuffer.texture;
- this.edgeDetectionMaterial.uniforms[ "texSize" ].value = new Vector2( this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height );
+ this.edgeDetectionMaterial.uniforms[ "texSize" ].value.set( this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height );
this.edgeDetectionMaterial.uniforms[ "visibleEdgeColor" ].value = this.tempPulseColor1;
this.edgeDetectionMaterial.uniforms[ "hiddenEdgeColor" ].value = this.tempPulseColor2;
renderer.setRenderTarget( this.renderTargetEdgeBuffer1 );
@@ -410,7 +410,7 @@ OutlinePass.prototype = Object.assign( Object.create( Pass.prototype ), {
uniforms: {
"depthTexture": { value: null },
"cameraNearFar": { value: new Vector2( 0.5, 0.5 ) },
- "textureMatrix": { value: new Matrix4() }
+ "textureMatrix": { value: null }
},
vertexShader: [ | true |
Other | mrdoob | three.js | 90d0d0ed60e1d33fbde0babb28741e6e22ae4f11.json | reduce heap use if WebGL2 partial buffer update. | src/renderers/WebGLRenderer.js | @@ -278,7 +278,7 @@ function WebGLRenderer( parameters ) {
info = new WebGLInfo( _gl );
properties = new WebGLProperties();
textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
- attributes = new WebGLAttributes( _gl );
+ attributes = new WebGLAttributes( _gl, capabilities );
geometries = new WebGLGeometries( _gl, attributes, info );
objects = new WebGLObjects( _gl, geometries, attributes, info );
morphtargets = new WebGLMorphtargets( _gl ); | true |
Other | mrdoob | three.js | 90d0d0ed60e1d33fbde0babb28741e6e22ae4f11.json | reduce heap use if WebGL2 partial buffer update. | src/renderers/webgl/WebGLAttributes.d.ts | @@ -1,9 +1,10 @@
+import { WebGLCapabilities } from "./WebGLCapabilities";
import { BufferAttribute } from "../../core/BufferAttribute";
import { InterleavedBufferAttribute } from "../../core/InterleavedBufferAttribute";
export class WebGLAttributes {
- constructor( gl: WebGLRenderingContext | WebGL2RenderingContext );
+ constructor( gl: WebGLRenderingContext | WebGL2RenderingContext, capabilities: WebGLCapabilities );
get( attribute: BufferAttribute | InterleavedBufferAttribute ): {
buffer: WebGLBuffer, | true |
Other | mrdoob | three.js | 90d0d0ed60e1d33fbde0babb28741e6e22ae4f11.json | reduce heap use if WebGL2 partial buffer update. | src/renderers/webgl/WebGLAttributes.js | @@ -2,7 +2,7 @@
* @author mrdoob / http://mrdoob.com/
*/
-function WebGLAttributes( gl ) {
+function WebGLAttributes( gl, capabilities ) {
var buffers = new WeakMap();
@@ -78,8 +78,17 @@ function WebGLAttributes( gl ) {
} else {
- gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
- array.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );
+ if ( capabilities.isWebGL2 ) {
+
+ gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
+ array, updateRange.offset, updateRange.count );
+
+ } else {
+
+ gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
+ array.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );
+
+ }
updateRange.count = - 1; // reset range
| true |
Other | mrdoob | three.js | 39a1ec8b9e407a942f434037470418db17a748b9.json | Update broken URL in comments. | examples/js/curves/CurveExtras.js | @@ -8,7 +8,7 @@
* http://en.wikipedia.org/wiki/Viviani%27s_curve
* http://mathdl.maa.org/images/upload_library/23/stemkoski/knots/page4.html
* http://www.mi.sanu.ac.rs/vismath/taylorapril2011/Taylor.pdf
- * http://prideout.net/blog/?p=44
+ * https://prideout.net/blog/old/blog/index.html@p=44.html
*/
THREE.Curves = ( function () { | true |
Other | mrdoob | three.js | 39a1ec8b9e407a942f434037470418db17a748b9.json | Update broken URL in comments. | examples/jsm/curves/CurveExtras.js | @@ -8,7 +8,7 @@
* http://en.wikipedia.org/wiki/Viviani%27s_curve
* http://mathdl.maa.org/images/upload_library/23/stemkoski/knots/page4.html
* http://www.mi.sanu.ac.rs/vismath/taylorapril2011/Taylor.pdf
- * http://prideout.net/blog/?p=44
+ * https://prideout.net/blog/old/blog/index.html@p=44.html
*/
import { | true |
Other | mrdoob | three.js | 39a1ec8b9e407a942f434037470418db17a748b9.json | Update broken URL in comments. | src/geometries/ParametricGeometry.js | @@ -3,7 +3,7 @@
* @author Mugen87 / https://github.com/Mugen87
*
* Parametric Surfaces Geometry
- * based on the brilliant article by @prideout http://prideout.net/blog/?p=44
+ * based on the brilliant article by @prideout https://prideout.net/blog/old/blog/index.html@p=44.html
*/
import { Geometry } from '../core/Geometry.js'; | true |
Other | mrdoob | three.js | 14d990849c82b70dcd87dfa828645fae2052ffd1.json | Revert the incorrect fix #18376 | src/renderers/webgl/WebGLProgram.d.ts | @@ -15,8 +15,8 @@ export class WebGLProgram {
cacheKey: string; // unique identifier for this program, used for looking up compiled programs from cache.
usedTimes: number;
program: any;
- vertexShader: string;
- fragmentShader: string;
+ vertexShader: WebGLShader;
+ fragmentShader: WebGLShader;
numMultiviewViews: number;
/**
* @deprecated Use {@link WebGLProgram#getUniforms getUniforms()} instead. | false |
Other | mrdoob | three.js | e7f316c7a7cc0262e1e58ce485d60dc3112cf769.json | Add reference to issue | src/renderers/webgl/WebGLTextures.js | @@ -1133,7 +1133,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );
- _gl.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
+ _gl.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer ); // see #18905
} else {
| false |
Other | mrdoob | three.js | bf1b3f8f1c8cf265c9e47e5d45ef17b2f8c5b502.json | Update jsfiddle with working cdn
RawGit has shut down, and because of this the link in our readme no longer works. This PR migrates the jsfiddle example to use jsDelivr instead. | README.md | @@ -64,7 +64,7 @@ function animate() {
}
```
-If everything went well you should see [this](https://jsfiddle.net/f2Lommf5/).
+If everything went well you should see [this](https://jsfiddle.net/3hkq1L4s/).
### Change log ###
| false |
Other | mrdoob | three.js | 91e2f1108de3a0ffc7671165752e6a6e188d4e8a.json | Fix bug preventing planes from rendering | examples/webgl_clipping_advanced.html | @@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>three.js webgl - clipping planes</title>
+ <title>three.js webgl - clipping planes - advanced</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link type="text/css" rel="stylesheet" href="main.css">
@@ -249,8 +249,10 @@
} );
- volumeVisualization.add(
- new THREE.Mesh( planeGeometry, material ) );
+ var mesh = new THREE.Mesh( planeGeometry, material );
+ mesh.matrixAutoUpdate = false;
+
+ volumeVisualization.add( mesh );
}
| false |
Other | mrdoob | three.js | d64351575ab16ebd4aa86211f1897760d9bf04be.json | Upgrade dev dependencies. | examples/jsm/csm/CSMHelper.js | @@ -83,15 +83,15 @@ class CSMHelper extends Group {
this.scale.copy( camera.scale );
this.updateMatrixWorld( true );
- while( cascadeLines.length > cascades ) {
+ while ( cascadeLines.length > cascades ) {
this.remove( cascadeLines.pop() );
this.remove( cascadePlanes.pop() );
this.remove( shadowLines.pop() );
}
- while( cascadeLines.length < cascades ) {
+ while ( cascadeLines.length < cascades ) {
const cascadeLine = new Box3Helper( new Box3(), 0xffffff );
const planeMat = new MeshBasicMaterial( { transparent: true, opacity: 0.1, depthWrite: false, side: DoubleSide } ); | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.