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 | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/effects/BlurNode.js | @@ -27,36 +27,36 @@ function BlurNode( value, uv, radius, size ) {
BlurNode.Nodes = ( function () {
var blurX = new FunctionNode( [
- "vec4 blurX( sampler2D tex, vec2 uv, float s ) {",
- " vec4 sum = vec4( 0.0 );",
- " sum += texture2D( tex, vec2( uv.x - 4.0 * s, uv.y ) ) * 0.051;",
- " sum += texture2D( tex, vec2( uv.x - 3.0 * s, uv.y ) ) * 0.0918;",
- " sum += texture2D( tex, vec2( uv.x - 2.0 * s, uv.y ) ) * 0.12245;",
- " sum += texture2D( tex, vec2( uv.x - 1.0 * s, uv.y ) ) * 0.1531;",
- " sum += texture2D( tex, vec2( uv.x, uv.y ) ) * 0.1633;",
- " sum += texture2D( tex, vec2( uv.x + 1.0 * s, uv.y ) ) * 0.1531;",
- " sum += texture2D( tex, vec2( uv.x + 2.0 * s, uv.y ) ) * 0.12245;",
- " sum += texture2D( tex, vec2( uv.x + 3.0 * s, uv.y ) ) * 0.0918;",
- " sum += texture2D( tex, vec2( uv.x + 4.0 * s, uv.y ) ) * 0.051;",
- " return sum * .667;",
- "}"
- ].join( "\n" ) );
+ 'vec4 blurX( sampler2D tex, vec2 uv, float s ) {',
+ ' vec4 sum = vec4( 0.0 );',
+ ' sum += texture2D( tex, vec2( uv.x - 4.0 * s, uv.y ) ) * 0.051;',
+ ' sum += texture2D( tex, vec2( uv.x - 3.0 * s, uv.y ) ) * 0.0918;',
+ ' sum += texture2D( tex, vec2( uv.x - 2.0 * s, uv.y ) ) * 0.12245;',
+ ' sum += texture2D( tex, vec2( uv.x - 1.0 * s, uv.y ) ) * 0.1531;',
+ ' sum += texture2D( tex, vec2( uv.x, uv.y ) ) * 0.1633;',
+ ' sum += texture2D( tex, vec2( uv.x + 1.0 * s, uv.y ) ) * 0.1531;',
+ ' sum += texture2D( tex, vec2( uv.x + 2.0 * s, uv.y ) ) * 0.12245;',
+ ' sum += texture2D( tex, vec2( uv.x + 3.0 * s, uv.y ) ) * 0.0918;',
+ ' sum += texture2D( tex, vec2( uv.x + 4.0 * s, uv.y ) ) * 0.051;',
+ ' return sum * .667;',
+ '}'
+ ].join( '\n' ) );
var blurY = new FunctionNode( [
- "vec4 blurY( sampler2D tex, vec2 uv, float s ) {",
- " vec4 sum = vec4( 0.0 );",
- " sum += texture2D( tex, vec2( uv.x, uv.y - 4.0 * s ) ) * 0.051;",
- " sum += texture2D( tex, vec2( uv.x, uv.y - 3.0 * s ) ) * 0.0918;",
- " sum += texture2D( tex, vec2( uv.x, uv.y - 2.0 * s ) ) * 0.12245;",
- " sum += texture2D( tex, vec2( uv.x, uv.y - 1.0 * s ) ) * 0.1531;",
- " sum += texture2D( tex, vec2( uv.x, uv.y ) ) * 0.1633;",
- " sum += texture2D( tex, vec2( uv.x, uv.y + 1.0 * s ) ) * 0.1531;",
- " sum += texture2D( tex, vec2( uv.x, uv.y + 2.0 * s ) ) * 0.12245;",
- " sum += texture2D( tex, vec2( uv.x, uv.y + 3.0 * s ) ) * 0.0918;",
- " sum += texture2D( tex, vec2( uv.x, uv.y + 4.0 * s ) ) * 0.051;",
- " return sum * .667;",
- "}"
- ].join( "\n" ) );
+ 'vec4 blurY( sampler2D tex, vec2 uv, float s ) {',
+ ' vec4 sum = vec4( 0.0 );',
+ ' sum += texture2D( tex, vec2( uv.x, uv.y - 4.0 * s ) ) * 0.051;',
+ ' sum += texture2D( tex, vec2( uv.x, uv.y - 3.0 * s ) ) * 0.0918;',
+ ' sum += texture2D( tex, vec2( uv.x, uv.y - 2.0 * s ) ) * 0.12245;',
+ ' sum += texture2D( tex, vec2( uv.x, uv.y - 1.0 * s ) ) * 0.1531;',
+ ' sum += texture2D( tex, vec2( uv.x, uv.y ) ) * 0.1633;',
+ ' sum += texture2D( tex, vec2( uv.x, uv.y + 1.0 * s ) ) * 0.1531;',
+ ' sum += texture2D( tex, vec2( uv.x, uv.y + 2.0 * s ) ) * 0.12245;',
+ ' sum += texture2D( tex, vec2( uv.x, uv.y + 3.0 * s ) ) * 0.0918;',
+ ' sum += texture2D( tex, vec2( uv.x, uv.y + 4.0 * s ) ) * 0.051;',
+ ' return sum * .667;',
+ '}'
+ ].join( '\n' ) );
return {
blurX: blurX,
@@ -68,8 +68,8 @@ BlurNode.Nodes = ( function () {
BlurNode.prototype = Object.create( TempNode.prototype );
BlurNode.prototype.constructor = BlurNode;
-BlurNode.prototype.nodeType = "Blur";
-BlurNode.prototype.hashProperties = [ "blurX", "blurY" ];
+BlurNode.prototype.nodeType = 'Blur';
+BlurNode.prototype.hashProperties = [ 'blurX', 'blurY' ];
BlurNode.prototype.updateFrame = function ( /* frame */ ) {
@@ -118,7 +118,7 @@ BlurNode.prototype.generate = function ( builder, output ) {
} else {
- console.warn( "THREE.BlurNode is not compatible with " + builder.shader + " shader." );
+ console.warn( 'THREE.BlurNode is not compatible with ' + builder.shader + ' shader.' );
return builder.format( 'vec4( 0.0 )', this.getType( builder ), output );
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/effects/ColorAdjustmentNode.js | @@ -16,45 +16,45 @@ function ColorAdjustmentNode( rgb, adjustment, method ) {
ColorAdjustmentNode.Nodes = ( function () {
var hue = new FunctionNode( [
- "vec3 hue(vec3 rgb, float adjustment) {",
+ 'vec3 hue(vec3 rgb, float adjustment) {',
- " const mat3 RGBtoYIQ = mat3(0.299, 0.587, 0.114, 0.595716, -0.274453, -0.321263, 0.211456, -0.522591, 0.311135);",
- " const mat3 YIQtoRGB = mat3(1.0, 0.9563, 0.6210, 1.0, -0.2721, -0.6474, 1.0, -1.107, 1.7046);",
+ ' const mat3 RGBtoYIQ = mat3(0.299, 0.587, 0.114, 0.595716, -0.274453, -0.321263, 0.211456, -0.522591, 0.311135);',
+ ' const mat3 YIQtoRGB = mat3(1.0, 0.9563, 0.6210, 1.0, -0.2721, -0.6474, 1.0, -1.107, 1.7046);',
- " vec3 yiq = RGBtoYIQ * rgb;",
+ ' vec3 yiq = RGBtoYIQ * rgb;',
- " float hue = atan(yiq.z, yiq.y) + adjustment;",
- " float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);",
+ ' float hue = atan(yiq.z, yiq.y) + adjustment;',
+ ' float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);',
- " return YIQtoRGB * vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));",
+ ' return YIQtoRGB * vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
var saturation = new FunctionNode( [
// Algorithm from Chapter 16 of OpenGL Shading Language
- "vec3 saturation(vec3 rgb, float adjustment) {",
+ 'vec3 saturation(vec3 rgb, float adjustment) {',
- " vec3 intensity = vec3( luminance( rgb ) );",
+ ' vec3 intensity = vec3( luminance( rgb ) );',
- " return mix( intensity, rgb, adjustment );",
+ ' return mix( intensity, rgb, adjustment );',
- "}"
- ].join( "\n" ), [ LuminanceNode.Nodes.luminance ] ); // include LuminanceNode function
+ '}'
+ ].join( '\n' ), [ LuminanceNode.Nodes.luminance ] ); // include LuminanceNode function
var vibrance = new FunctionNode( [
// Shader by Evan Wallace adapted by @lo-th
- "vec3 vibrance(vec3 rgb, float adjustment) {",
+ 'vec3 vibrance(vec3 rgb, float adjustment) {',
- " float average = (rgb.r + rgb.g + rgb.b) / 3.0;",
+ ' float average = (rgb.r + rgb.g + rgb.b) / 3.0;',
- " float mx = max(rgb.r, max(rgb.g, rgb.b));",
- " float amt = (mx - average) * (-3.0 * adjustment);",
+ ' float mx = max(rgb.r, max(rgb.g, rgb.b));',
+ ' float amt = (mx - average) * (-3.0 * adjustment);',
- " return mix(rgb.rgb, vec3(mx), amt);",
+ ' return mix(rgb.rgb, vec3(mx), amt);',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
return {
hue: hue,
@@ -72,8 +72,8 @@ ColorAdjustmentNode.CONTRAST = 'contrast';
ColorAdjustmentNode.prototype = Object.create( TempNode.prototype );
ColorAdjustmentNode.prototype.constructor = ColorAdjustmentNode;
-ColorAdjustmentNode.prototype.nodeType = "ColorAdjustment";
-ColorAdjustmentNode.prototype.hashProperties = [ "method" ];
+ColorAdjustmentNode.prototype.nodeType = 'ColorAdjustment';
+ColorAdjustmentNode.prototype.hashProperties = [ 'method' ];
ColorAdjustmentNode.prototype.generate = function ( builder, output ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/effects/LuminanceNode.js | @@ -12,16 +12,16 @@ function LuminanceNode( rgb ) {
LuminanceNode.Nodes = ( function () {
- var LUMA = new ConstNode( "vec3 LUMA vec3( 0.2125, 0.7154, 0.0721 )" );
+ var LUMA = new ConstNode( 'vec3 LUMA vec3( 0.2125, 0.7154, 0.0721 )' );
var luminance = new FunctionNode( [
// Algorithm from Chapter 10 of Graphics Shaders
- "float luminance( vec3 rgb ) {",
+ 'float luminance( vec3 rgb ) {',
- " return dot( rgb, LUMA );",
+ ' return dot( rgb, LUMA );',
- "}"
- ].join( "\n" ), [ LUMA ] );
+ '}'
+ ].join( '\n' ), [ LUMA ] );
return {
LUMA: LUMA,
@@ -32,7 +32,7 @@ LuminanceNode.Nodes = ( function () {
LuminanceNode.prototype = Object.create( TempNode.prototype );
LuminanceNode.prototype.constructor = LuminanceNode;
-LuminanceNode.prototype.nodeType = "Luminance";
+LuminanceNode.prototype.nodeType = 'Luminance';
LuminanceNode.prototype.generate = function ( builder, output ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/BoolNode.js | @@ -10,7 +10,7 @@ function BoolNode( value ) {
BoolNode.prototype = Object.create( InputNode.prototype );
BoolNode.prototype.constructor = BoolNode;
-BoolNode.prototype.nodeType = "Bool";
+BoolNode.prototype.nodeType = 'Bool';
BoolNode.prototype.generateReadonly = function ( builder, output, uuid, type/*, ns, needsUpdate */ ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/ColorNode.js | @@ -13,13 +13,13 @@ function ColorNode( color, g, b ) {
ColorNode.prototype = Object.create( InputNode.prototype );
ColorNode.prototype.constructor = ColorNode;
-ColorNode.prototype.nodeType = "Color";
+ColorNode.prototype.nodeType = 'Color';
NodeUtils.addShortcuts( ColorNode.prototype, 'value', [ 'r', 'g', 'b' ] );
ColorNode.prototype.generateReadonly = function ( builder, output, uuid, type/*, ns, needsUpdate */ ) {
- return builder.format( "vec3( " + this.r + ", " + this.g + ", " + this.b + " )", type, output );
+ return builder.format( 'vec3( ' + this.r + ', ' + this.g + ', ' + this.b + ' )', type, output );
};
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/CubeTextureNode.js | @@ -15,7 +15,7 @@ function CubeTextureNode( value, uv, bias ) {
CubeTextureNode.prototype = Object.create( InputNode.prototype );
CubeTextureNode.prototype.constructor = CubeTextureNode;
-CubeTextureNode.prototype.nodeType = "CubeTexture";
+CubeTextureNode.prototype.nodeType = 'CubeTexture';
CubeTextureNode.prototype.getTexture = function ( builder, output ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/FloatNode.js | @@ -10,7 +10,7 @@ function FloatNode( value ) {
FloatNode.prototype = Object.create( InputNode.prototype );
FloatNode.prototype.constructor = FloatNode;
-FloatNode.prototype.nodeType = "Float";
+FloatNode.prototype.nodeType = 'Float';
FloatNode.prototype.generateReadonly = function ( builder, output, uuid, type/*, ns, needsUpdate */ ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/IntNode.js | @@ -10,7 +10,7 @@ function IntNode( value ) {
IntNode.prototype = Object.create( InputNode.prototype );
IntNode.prototype.constructor = IntNode;
-IntNode.prototype.nodeType = "Int";
+IntNode.prototype.nodeType = 'Int';
IntNode.prototype.generateReadonly = function ( builder, output, uuid, type/*, ns, needsUpdate */ ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/Matrix3Node.js | @@ -12,7 +12,7 @@ function Matrix3Node( matrix ) {
Matrix3Node.prototype = Object.create( InputNode.prototype );
Matrix3Node.prototype.constructor = Matrix3Node;
-Matrix3Node.prototype.nodeType = "Matrix3";
+Matrix3Node.prototype.nodeType = 'Matrix3';
Object.defineProperties( Matrix3Node.prototype, {
@@ -36,7 +36,7 @@ Object.defineProperties( Matrix3Node.prototype, {
Matrix3Node.prototype.generateReadonly = function ( builder, output, uuid, type/*, ns, needsUpdate */ ) {
- return builder.format( "mat3( " + this.value.elements.join( ", " ) + " )", type, output );
+ return builder.format( 'mat3( ' + this.value.elements.join( ', ' ) + ' )', type, output );
};
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/Matrix4Node.js | @@ -12,7 +12,7 @@ function Matrix4Node( matrix ) {
Matrix4Node.prototype = Object.create( InputNode.prototype );
Matrix4Node.prototype.constructor = Matrix4Node;
-Matrix4Node.prototype.nodeType = "Matrix4";
+Matrix4Node.prototype.nodeType = 'Matrix4';
Object.defineProperties( Matrix4Node.prototype, {
@@ -36,7 +36,7 @@ Object.defineProperties( Matrix4Node.prototype, {
Matrix4Node.prototype.generateReadonly = function ( builder, output, uuid, type /*, ns, needsUpdate */ ) {
- return builder.format( "mat4( " + this.value.elements.join( ", " ) + " )", type, output );
+ return builder.format( 'mat4( ' + this.value.elements.join( ', ' ) + ' )', type, output );
};
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/PropertyNode.js | @@ -11,7 +11,7 @@ function PropertyNode( object, property, type ) {
PropertyNode.prototype = Object.create( InputNode.prototype );
PropertyNode.prototype.constructor = PropertyNode;
-PropertyNode.prototype.nodeType = "Property";
+PropertyNode.prototype.nodeType = 'Property';
Object.defineProperties( PropertyNode.prototype, {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/RTTNode.js | @@ -37,7 +37,7 @@ function RTTNode( width, height, input, options ) {
RTTNode.prototype = Object.create( TextureNode.prototype );
RTTNode.prototype.constructor = RTTNode;
-RTTNode.prototype.nodeType = "RTT";
+RTTNode.prototype.nodeType = 'RTT';
RTTNode.prototype.build = function ( builder, output, uuid ) {
@@ -119,7 +119,7 @@ RTTNode.prototype.updateFrame = function ( frame ) {
} else {
- console.warn( "RTTNode need a renderer in NodeFrame" );
+ console.warn( 'RTTNode need a renderer in NodeFrame' );
}
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/ReflectorNode.js | @@ -15,7 +15,7 @@ function ReflectorNode( mirror ) {
ReflectorNode.prototype = Object.create( TempNode.prototype );
ReflectorNode.prototype.constructor = ReflectorNode;
-ReflectorNode.prototype.nodeType = "Reflector";
+ReflectorNode.prototype.nodeType = 'Reflector';
ReflectorNode.prototype.setMirror = function ( mirror ) {
@@ -49,7 +49,7 @@ ReflectorNode.prototype.generate = function ( builder, output ) {
} else {
- console.warn( "THREE.ReflectorNode is not compatible with " + builder.shader + " shader." );
+ console.warn( 'THREE.ReflectorNode is not compatible with ' + builder.shader + ' shader.' );
return builder.format( 'vec4( 0.0 )', this.type, output );
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/ScreenNode.js | @@ -9,7 +9,7 @@ function ScreenNode( uv ) {
ScreenNode.prototype = Object.create( TextureNode.prototype );
ScreenNode.prototype.constructor = ScreenNode;
-ScreenNode.prototype.nodeType = "Screen";
+ScreenNode.prototype.nodeType = 'Screen';
ScreenNode.prototype.getUnique = function () {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/TextureNode.js | @@ -16,7 +16,7 @@ function TextureNode( value, uv, bias, project ) {
TextureNode.prototype = Object.create( InputNode.prototype );
TextureNode.prototype.constructor = TextureNode;
-TextureNode.prototype.nodeType = "Texture";
+TextureNode.prototype.nodeType = 'Texture';
TextureNode.prototype.getTexture = function ( builder, output ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/Vector2Node.js | @@ -13,13 +13,13 @@ function Vector2Node( x, y ) {
Vector2Node.prototype = Object.create( InputNode.prototype );
Vector2Node.prototype.constructor = Vector2Node;
-Vector2Node.prototype.nodeType = "Vector2";
+Vector2Node.prototype.nodeType = 'Vector2';
NodeUtils.addShortcuts( Vector2Node.prototype, 'value', [ 'x', 'y' ] );
Vector2Node.prototype.generateReadonly = function ( builder, output, uuid, type/*, ns, needsUpdate*/ ) {
- return builder.format( "vec2( " + this.x + ", " + this.y + " )", type, output );
+ return builder.format( 'vec2( ' + this.x + ', ' + this.y + ' )', type, output );
};
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/Vector3Node.js | @@ -13,13 +13,13 @@ function Vector3Node( x, y, z ) {
Vector3Node.prototype = Object.create( InputNode.prototype );
Vector3Node.prototype.constructor = Vector3Node;
-Vector3Node.prototype.nodeType = "Vector3";
+Vector3Node.prototype.nodeType = 'Vector3';
NodeUtils.addShortcuts( Vector3Node.prototype, 'value', [ 'x', 'y', 'z' ] );
Vector3Node.prototype.generateReadonly = function ( builder, output, uuid, type/*, ns, needsUpdate*/ ) {
- return builder.format( "vec3( " + this.x + ", " + this.y + ", " + this.z + " )", type, output );
+ return builder.format( 'vec3( ' + this.x + ', ' + this.y + ', ' + this.z + ' )', type, output );
};
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/inputs/Vector4Node.js | @@ -13,13 +13,13 @@ function Vector4Node( x, y, z, w ) {
Vector4Node.prototype = Object.create( InputNode.prototype );
Vector4Node.prototype.constructor = Vector4Node;
-Vector4Node.prototype.nodeType = "Vector4";
+Vector4Node.prototype.nodeType = 'Vector4';
NodeUtils.addShortcuts( Vector4Node.prototype, 'value', [ 'x', 'y', 'z', 'w' ] );
Vector4Node.prototype.generateReadonly = function ( builder, output, uuid, type/*, ns, needsUpdate*/ ) {
- return builder.format( "vec4( " + this.x + ", " + this.y + ", " + this.z + ", " + this.w + " )", type, output );
+ return builder.format( 'vec4( ' + this.x + ', ' + this.y + ', ' + this.z + ', ' + this.w + ' )', type, output );
};
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/materials/BasicNodeMaterial.js | @@ -8,7 +8,7 @@ function BasicNodeMaterial() {
NodeMaterial.call( this, node, node );
- this.type = "BasicNodeMaterial";
+ this.type = 'BasicNodeMaterial';
}
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/materials/MeshStandardNodeMaterial.js | @@ -8,23 +8,23 @@ function MeshStandardNodeMaterial() {
NodeMaterial.call( this, node, node );
- this.type = "MeshStandardNodeMaterial";
+ this.type = 'MeshStandardNodeMaterial';
}
MeshStandardNodeMaterial.prototype = Object.create( NodeMaterial.prototype );
MeshStandardNodeMaterial.prototype.constructor = MeshStandardNodeMaterial;
NodeUtils.addShortcuts( MeshStandardNodeMaterial.prototype, 'properties', [
- "color",
- "roughness",
- "metalness",
- "map",
- "normalMap",
- "normalScale",
- "metalnessMap",
- "roughnessMap",
- "envMap"
+ 'color',
+ 'roughness',
+ 'metalness',
+ 'map',
+ 'normalMap',
+ 'normalScale',
+ 'metalnessMap',
+ 'roughnessMap',
+ 'envMap'
] );
export { MeshStandardNodeMaterial }; | true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/materials/NodeMaterial.js | @@ -24,7 +24,7 @@ function NodeMaterial( vertex, fragment ) {
NodeMaterial.prototype = Object.create( ShaderMaterial.prototype );
NodeMaterial.prototype.constructor = NodeMaterial;
-NodeMaterial.prototype.type = "NodeMaterial";
+NodeMaterial.prototype.type = 'NodeMaterial';
NodeMaterial.prototype.isNodeMaterial = true;
@@ -177,7 +177,7 @@ NodeMaterial.prototype.toJSON = function ( meta ) {
meta.materials[ data.uuid ] = data;
- if ( this.name !== "" ) data.name = this.name;
+ if ( this.name !== '' ) data.name = this.name;
if ( this.size !== undefined ) data.size = this.size;
if ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation; | true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/materials/PhongNodeMaterial.js | @@ -8,7 +8,7 @@ function PhongNodeMaterial() {
NodeMaterial.call( this, node, node );
- this.type = "PhongNodeMaterial";
+ this.type = 'PhongNodeMaterial';
}
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/materials/SpriteNodeMaterial.js | @@ -8,7 +8,7 @@ function SpriteNodeMaterial() {
NodeMaterial.call( this, node, node );
- this.type = "SpriteNodeMaterial";
+ this.type = 'SpriteNodeMaterial';
}
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/materials/StandardNodeMaterial.js | @@ -8,7 +8,7 @@ function StandardNodeMaterial() {
NodeMaterial.call( this, node, node );
- this.type = "StandardNodeMaterial";
+ this.type = 'StandardNodeMaterial';
}
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/materials/nodes/BasicNode.js | @@ -11,7 +11,7 @@ function BasicNode() {
BasicNode.prototype = Object.create( Node.prototype );
BasicNode.prototype.constructor = BasicNode;
-BasicNode.prototype.nodeType = "Basic";
+BasicNode.prototype.nodeType = 'Basic';
BasicNode.prototype.generate = function ( builder ) {
@@ -22,52 +22,52 @@ BasicNode.prototype.generate = function ( builder ) {
var position = this.position ? this.position.analyzeAndFlow( builder, 'v3', { cache: 'position' } ) : undefined;
builder.addParsCode( [
- "varying vec3 vViewPosition;",
+ 'varying vec3 vViewPosition;',
- "#ifndef FLAT_SHADED",
+ '#ifndef FLAT_SHADED',
- " varying vec3 vNormal;",
+ ' varying vec3 vNormal;',
- "#endif",
- ].join( "\n" ) );
+ '#endif',
+ ].join( '\n' ) );
var output = [
- "#include <beginnormal_vertex>",
- "#include <defaultnormal_vertex>",
+ '#include <beginnormal_vertex>',
+ '#include <defaultnormal_vertex>',
- "#ifndef FLAT_SHADED", // Normal computed with derivatives when FLAT_SHADED
+ '#ifndef FLAT_SHADED', // Normal computed with derivatives when FLAT_SHADED
- " vNormal = normalize( transformedNormal );",
+ ' vNormal = normalize( transformedNormal );',
- "#endif",
+ '#endif',
- "#include <begin_vertex>",
+ '#include <begin_vertex>',
];
if ( position ) {
output.push(
position.code,
- position.result ? "transformed = " + position.result + ";" : ''
+ position.result ? 'transformed = ' + position.result + ';' : ''
);
}
output.push(
- "#include <morphtarget_vertex>",
- "#include <skinning_vertex>",
- "#include <project_vertex>",
- "#include <fog_vertex>",
- "#include <logdepthbuf_vertex>",
- "#include <clipping_planes_vertex>",
+ '#include <morphtarget_vertex>',
+ '#include <skinning_vertex>',
+ '#include <project_vertex>',
+ '#include <fog_vertex>',
+ '#include <logdepthbuf_vertex>',
+ '#include <clipping_planes_vertex>',
- " vViewPosition = - mvPosition.xyz;",
+ ' vViewPosition = - mvPosition.xyz;',
- "#include <worldpos_vertex>",
- "#include <shadowmap_vertex>"
+ '#include <worldpos_vertex>',
+ '#include <shadowmap_vertex>'
);
- code = output.join( "\n" );
+ code = output.join( '\n' );
} else {
@@ -85,18 +85,18 @@ BasicNode.prototype.generate = function ( builder ) {
builder.requires.transparent = alpha !== undefined;
builder.addParsCode( [
- "varying vec3 vViewPosition;",
+ 'varying vec3 vViewPosition;',
- "#ifndef FLAT_SHADED",
+ '#ifndef FLAT_SHADED',
- " varying vec3 vNormal;",
+ ' varying vec3 vNormal;',
- "#endif",
- ].join( "\n" ) );
+ '#endif',
+ ].join( '\n' ) );
var output = [
// add before: prevent undeclared normal
- "#include <normal_fragment_begin>",
+ '#include <normal_fragment_begin>',
color.code,
];
@@ -125,15 +125,15 @@ BasicNode.prototype.generate = function ( builder ) {
if ( alpha ) {
- output.push( "gl_FragColor = vec4(" + color.result + ", " + alpha.result + " );" );
+ output.push( 'gl_FragColor = vec4(' + color.result + ', ' + alpha.result + ' );' );
} else {
- output.push( "gl_FragColor = vec4(" + color.result + ", 1.0 );" );
+ output.push( 'gl_FragColor = vec4(' + color.result + ', 1.0 );' );
}
- code = output.join( "\n" );
+ code = output.join( '\n' );
}
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/materials/nodes/MeshStandardNode.js | @@ -31,7 +31,7 @@ function MeshStandardNode() {
MeshStandardNode.prototype = Object.create( StandardNode.prototype );
MeshStandardNode.prototype.constructor = MeshStandardNode;
-MeshStandardNode.prototype.nodeType = "MeshStandard";
+MeshStandardNode.prototype.nodeType = 'MeshStandard';
MeshStandardNode.prototype.build = function ( builder ) {
@@ -56,7 +56,7 @@ MeshStandardNode.prototype.build = function ( builder ) {
var roughness = builder.findNode( props.roughness, inputs.roughness ),
roughnessMap = builder.resolve( props.roughnessMap );
- this.roughness = roughnessMap ? new OperatorNode( roughness, new SwitchNode( roughnessMap, "g" ), OperatorNode.MUL ) : roughness;
+ this.roughness = roughnessMap ? new OperatorNode( roughness, new SwitchNode( roughnessMap, 'g' ), OperatorNode.MUL ) : roughness;
// slots
// * metalness
@@ -65,7 +65,7 @@ MeshStandardNode.prototype.build = function ( builder ) {
var metalness = builder.findNode( props.metalness, inputs.metalness ),
metalnessMap = builder.resolve( props.metalnessMap );
- this.metalness = metalnessMap ? new OperatorNode( metalness, new SwitchNode( metalnessMap, "b" ), OperatorNode.MUL ) : metalness;
+ this.metalness = metalnessMap ? new OperatorNode( metalness, new SwitchNode( metalnessMap, 'b' ), OperatorNode.MUL ) : metalness;
// slots
// * normalMap
@@ -103,7 +103,7 @@ MeshStandardNode.prototype.toJSON = function ( meta ) {
data = this.createJSONNode( meta );
- console.warn( ".toJSON not implemented in", this );
+ console.warn( '.toJSON not implemented in', this );
}
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/materials/nodes/PhongNode.js | @@ -19,7 +19,7 @@ function PhongNode() {
PhongNode.prototype = Object.create( Node.prototype );
PhongNode.prototype.constructor = PhongNode;
-PhongNode.prototype.nodeType = "Phong";
+PhongNode.prototype.nodeType = 'Phong';
PhongNode.prototype.build = function ( builder ) {
@@ -41,64 +41,64 @@ PhongNode.prototype.build = function ( builder ) {
] ) );
builder.addParsCode( [
- "varying vec3 vViewPosition;",
+ 'varying vec3 vViewPosition;',
- "#ifndef FLAT_SHADED",
+ '#ifndef FLAT_SHADED',
- " varying vec3 vNormal;",
+ ' varying vec3 vNormal;',
- "#endif",
+ '#endif',
//"#include <encodings_pars_fragment>", // encoding functions
- "#include <fog_pars_vertex>",
- "#include <morphtarget_pars_vertex>",
- "#include <skinning_pars_vertex>",
- "#include <shadowmap_pars_vertex>",
- "#include <logdepthbuf_pars_vertex>",
- "#include <clipping_planes_pars_vertex>"
- ].join( "\n" ) );
+ '#include <fog_pars_vertex>',
+ '#include <morphtarget_pars_vertex>',
+ '#include <skinning_pars_vertex>',
+ '#include <shadowmap_pars_vertex>',
+ '#include <logdepthbuf_pars_vertex>',
+ '#include <clipping_planes_pars_vertex>'
+ ].join( '\n' ) );
var output = [
- "#include <beginnormal_vertex>",
- "#include <morphnormal_vertex>",
- "#include <skinbase_vertex>",
- "#include <skinnormal_vertex>",
- "#include <defaultnormal_vertex>",
+ '#include <beginnormal_vertex>',
+ '#include <morphnormal_vertex>',
+ '#include <skinbase_vertex>',
+ '#include <skinnormal_vertex>',
+ '#include <defaultnormal_vertex>',
- "#ifndef FLAT_SHADED", // normal computed with derivatives when FLAT_SHADED
+ '#ifndef FLAT_SHADED', // normal computed with derivatives when FLAT_SHADED
- " vNormal = normalize( transformedNormal );",
+ ' vNormal = normalize( transformedNormal );',
- "#endif",
+ '#endif',
- "#include <begin_vertex>"
+ '#include <begin_vertex>'
];
if ( position ) {
output.push(
position.code,
- position.result ? "transformed = " + position.result + ";" : ''
+ position.result ? 'transformed = ' + position.result + ';' : ''
);
}
output.push(
- " #include <morphtarget_vertex>",
- " #include <skinning_vertex>",
- " #include <project_vertex>",
- " #include <fog_vertex>",
- " #include <logdepthbuf_vertex>",
- " #include <clipping_planes_vertex>",
-
- " vViewPosition = - mvPosition.xyz;",
-
- " #include <worldpos_vertex>",
- " #include <shadowmap_vertex>",
- " #include <fog_vertex>"
+ ' #include <morphtarget_vertex>',
+ ' #include <skinning_vertex>',
+ ' #include <project_vertex>',
+ ' #include <fog_vertex>',
+ ' #include <logdepthbuf_vertex>',
+ ' #include <clipping_planes_vertex>',
+
+ ' vViewPosition = - mvPosition.xyz;',
+
+ ' #include <worldpos_vertex>',
+ ' #include <shadowmap_vertex>',
+ ' #include <fog_vertex>'
);
- code = output.join( "\n" );
+ code = output.join( '\n' );
} else {
@@ -149,20 +149,20 @@ PhongNode.prototype.build = function ( builder ) {
builder.requires.transparent = alpha !== undefined;
builder.addParsCode( [
- "#include <fog_pars_fragment>",
- "#include <bsdfs>",
- "#include <lights_pars_begin>",
- "#include <lights_phong_pars_fragment>",
- "#include <shadowmap_pars_fragment>",
- "#include <logdepthbuf_pars_fragment>"
- ].join( "\n" ) );
+ '#include <fog_pars_fragment>',
+ '#include <bsdfs>',
+ '#include <lights_pars_begin>',
+ '#include <lights_phong_pars_fragment>',
+ '#include <shadowmap_pars_fragment>',
+ '#include <logdepthbuf_pars_fragment>'
+ ].join( '\n' ) );
var output = [
// prevent undeclared normal
- "#include <normal_fragment_begin>",
+ '#include <normal_fragment_begin>',
// prevent undeclared material
- " BlinnPhongMaterial material;"
+ ' BlinnPhongMaterial material;'
];
if ( mask ) {
@@ -176,18 +176,18 @@ PhongNode.prototype.build = function ( builder ) {
output.push(
color.code,
- " vec3 diffuseColor = " + color.result + ";",
- " ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",
+ ' vec3 diffuseColor = ' + color.result + ';',
+ ' ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );',
- "#include <logdepthbuf_fragment>",
+ '#include <logdepthbuf_fragment>',
specular.code,
- " vec3 specular = " + specular.result + ";",
+ ' vec3 specular = ' + specular.result + ';',
shininess.code,
- " float shininess = max( 0.0001, " + shininess.result + " );",
+ ' float shininess = max( 0.0001, ' + shininess.result + ' );',
- " float specularStrength = 1.0;" // Ignored in MaterialNode ( replace to specular )
+ ' float specularStrength = 1.0;' // Ignored in MaterialNode ( replace to specular )
);
if ( alpha ) {
@@ -222,22 +222,22 @@ PhongNode.prototype.build = function ( builder ) {
'material.specularShininess = shininess;',
'material.specularStrength = specularStrength;',
- "#include <lights_fragment_begin>",
- "#include <lights_fragment_end>"
+ '#include <lights_fragment_begin>',
+ '#include <lights_fragment_end>'
);
if ( light ) {
output.push(
light.code,
- "reflectedLight.directDiffuse = " + light.result + ";"
+ 'reflectedLight.directDiffuse = ' + light.result + ';'
);
// apply color
output.push(
- "reflectedLight.directDiffuse *= diffuseColor;",
- "reflectedLight.indirectDiffuse *= diffuseColor;"
+ 'reflectedLight.directDiffuse *= diffuseColor;',
+ 'reflectedLight.indirectDiffuse *= diffuseColor;'
);
}
@@ -246,7 +246,7 @@ PhongNode.prototype.build = function ( builder ) {
output.push(
ao.code,
- "reflectedLight.indirectDiffuse *= " + ao.result + ";"
+ 'reflectedLight.indirectDiffuse *= ' + ao.result + ';'
);
}
@@ -255,7 +255,7 @@ PhongNode.prototype.build = function ( builder ) {
output.push(
ambient.code,
- "reflectedLight.indirectDiffuse += " + ambient.result + ";"
+ 'reflectedLight.indirectDiffuse += ' + ambient.result + ';'
);
}
@@ -264,8 +264,8 @@ PhongNode.prototype.build = function ( builder ) {
output.push(
shadow.code,
- "reflectedLight.directDiffuse *= " + shadow.result + ";",
- "reflectedLight.directSpecular *= " + shadow.result + ";"
+ 'reflectedLight.directDiffuse *= ' + shadow.result + ';',
+ 'reflectedLight.directSpecular *= ' + shadow.result + ';'
);
}
@@ -274,12 +274,12 @@ PhongNode.prototype.build = function ( builder ) {
output.push(
emissive.code,
- "reflectedLight.directDiffuse += " + emissive.result + ";"
+ 'reflectedLight.directDiffuse += ' + emissive.result + ';'
);
}
- output.push( "vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular;" );
+ output.push( 'vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular;' );
if ( environment ) {
@@ -289,12 +289,12 @@ PhongNode.prototype.build = function ( builder ) {
output.push(
environmentAlpha.code,
- "outgoingLight = mix( outgoingLight, " + environment.result + ", " + environmentAlpha.result + " );"
+ 'outgoingLight = mix( outgoingLight, ' + environment.result + ', ' + environmentAlpha.result + ' );'
);
} else {
- output.push( "outgoingLight = " + environment.result + ";" );
+ output.push( 'outgoingLight = ' + environment.result + ';' );
}
@@ -315,22 +315,22 @@ PhongNode.prototype.build = function ( builder ) {
if ( alpha ) {
- output.push( "gl_FragColor = vec4( outgoingLight, " + alpha.result + " );" );
+ output.push( 'gl_FragColor = vec4( outgoingLight, ' + alpha.result + ' );' );
} else {
- output.push( "gl_FragColor = vec4( outgoingLight, 1.0 );" );
+ output.push( 'gl_FragColor = vec4( outgoingLight, 1.0 );' );
}
output.push(
- "#include <tonemapping_fragment>",
- "#include <encodings_fragment>",
- "#include <fog_fragment>",
- "#include <premultiplied_alpha_fragment>"
+ '#include <tonemapping_fragment>',
+ '#include <encodings_fragment>',
+ '#include <fog_fragment>',
+ '#include <premultiplied_alpha_fragment>'
);
- code = output.join( "\n" );
+ code = output.join( '\n' );
}
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/materials/nodes/RawNode.js | @@ -10,7 +10,7 @@ function RawNode( value ) {
RawNode.prototype = Object.create( Node.prototype );
RawNode.prototype.constructor = RawNode;
-RawNode.prototype.nodeType = "Raw";
+RawNode.prototype.nodeType = 'Raw';
RawNode.prototype.generate = function ( builder ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/materials/nodes/SpriteNode.js | @@ -17,7 +17,7 @@ function SpriteNode() {
SpriteNode.prototype = Object.create( Node.prototype );
SpriteNode.prototype.constructor = SpriteNode;
-SpriteNode.prototype.nodeType = "Sprite";
+SpriteNode.prototype.nodeType = 'Sprite';
SpriteNode.prototype.build = function ( builder ) {
@@ -37,28 +37,28 @@ SpriteNode.prototype.build = function ( builder ) {
] ) );
builder.addParsCode( [
- "#include <fog_pars_vertex>",
- "#include <logdepthbuf_pars_vertex>",
- "#include <clipping_planes_pars_vertex>"
- ].join( "\n" ) );
+ '#include <fog_pars_vertex>',
+ '#include <logdepthbuf_pars_vertex>',
+ '#include <clipping_planes_pars_vertex>'
+ ].join( '\n' ) );
output = [
- "#include <clipping_planes_fragment>",
- "#include <begin_vertex>"
+ '#include <clipping_planes_fragment>',
+ '#include <begin_vertex>'
];
if ( position ) {
output.push(
position.code,
- position.result ? "transformed = " + position.result + ";" : ''
+ position.result ? 'transformed = ' + position.result + ';' : ''
);
}
output.push(
- "#include <project_vertex>",
- "#include <fog_vertex>",
+ '#include <project_vertex>',
+ '#include <fog_vertex>',
'mat4 modelViewMtx = modelViewMatrix;',
'mat4 modelMtx = modelMatrix;',
@@ -102,25 +102,25 @@ SpriteNode.prototype.build = function ( builder ) {
'modelViewMtx[2][1] = 0.0;',
'modelViewMtx[2][2] = 1.0;',
- "gl_Position = projectionMatrix * modelViewMtx * modelMtx * vec4( transformed, 1.0 );",
+ 'gl_Position = projectionMatrix * modelViewMtx * modelMtx * vec4( transformed, 1.0 );',
- "#include <logdepthbuf_vertex>",
- "#include <clipping_planes_vertex>",
- "#include <fog_vertex>"
+ '#include <logdepthbuf_vertex>',
+ '#include <clipping_planes_vertex>',
+ '#include <fog_vertex>'
);
} else {
builder.addParsCode( [
- "#include <fog_pars_fragment>",
- "#include <logdepthbuf_pars_fragment>",
- "#include <clipping_planes_pars_fragment>"
- ].join( "\n" ) );
+ '#include <fog_pars_fragment>',
+ '#include <logdepthbuf_pars_fragment>',
+ '#include <clipping_planes_pars_fragment>'
+ ].join( '\n' ) );
builder.addCode( [
- "#include <clipping_planes_fragment>",
- "#include <logdepthbuf_fragment>"
- ].join( "\n" ) );
+ '#include <clipping_planes_fragment>',
+ '#include <logdepthbuf_fragment>'
+ ].join( '\n' ) );
// analyze all nodes to reuse generate codes
@@ -156,27 +156,27 @@ SpriteNode.prototype.build = function ( builder ) {
'#endif',
color.code,
- "gl_FragColor = vec4( " + color.result + ", " + alpha.result + " );"
+ 'gl_FragColor = vec4( ' + color.result + ', ' + alpha.result + ' );'
);
} else {
output.push(
color.code,
- "gl_FragColor = vec4( " + color.result + ", 1.0 );"
+ 'gl_FragColor = vec4( ' + color.result + ', 1.0 );'
);
}
output.push(
- "#include <tonemapping_fragment>",
- "#include <encodings_fragment>",
- "#include <fog_fragment>"
+ '#include <tonemapping_fragment>',
+ '#include <encodings_fragment>',
+ '#include <fog_fragment>'
);
}
- return output.join( "\n" );
+ return output.join( '\n' );
};
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/materials/nodes/StandardNode.js | @@ -21,7 +21,7 @@ function StandardNode() {
StandardNode.prototype = Object.create( Node.prototype );
StandardNode.prototype.constructor = StandardNode;
-StandardNode.prototype.nodeType = "Standard";
+StandardNode.prototype.nodeType = 'Standard';
StandardNode.prototype.build = function ( builder ) {
@@ -63,64 +63,64 @@ StandardNode.prototype.build = function ( builder ) {
}
builder.addParsCode( [
- "varying vec3 vViewPosition;",
+ 'varying vec3 vViewPosition;',
- "#ifndef FLAT_SHADED",
+ '#ifndef FLAT_SHADED',
- " varying vec3 vNormal;",
+ ' varying vec3 vNormal;',
- "#endif",
+ '#endif',
//"#include <encodings_pars_fragment>", // encoding functions
- "#include <fog_pars_vertex>",
- "#include <morphtarget_pars_vertex>",
- "#include <skinning_pars_vertex>",
- "#include <shadowmap_pars_vertex>",
- "#include <logdepthbuf_pars_vertex>",
- "#include <clipping_planes_pars_vertex>"
+ '#include <fog_pars_vertex>',
+ '#include <morphtarget_pars_vertex>',
+ '#include <skinning_pars_vertex>',
+ '#include <shadowmap_pars_vertex>',
+ '#include <logdepthbuf_pars_vertex>',
+ '#include <clipping_planes_pars_vertex>'
- ].join( "\n" ) );
+ ].join( '\n' ) );
var output = [
- "#include <beginnormal_vertex>",
- "#include <morphnormal_vertex>",
- "#include <skinbase_vertex>",
- "#include <skinnormal_vertex>",
- "#include <defaultnormal_vertex>",
+ '#include <beginnormal_vertex>',
+ '#include <morphnormal_vertex>',
+ '#include <skinbase_vertex>',
+ '#include <skinnormal_vertex>',
+ '#include <defaultnormal_vertex>',
- "#ifndef FLAT_SHADED", // Normal computed with derivatives when FLAT_SHADED
+ '#ifndef FLAT_SHADED', // Normal computed with derivatives when FLAT_SHADED
- " vNormal = normalize( transformedNormal );",
+ ' vNormal = normalize( transformedNormal );',
- "#endif",
+ '#endif',
- "#include <begin_vertex>"
+ '#include <begin_vertex>'
];
if ( position ) {
output.push(
position.code,
- position.result ? "transformed = " + position.result + ";" : ''
+ position.result ? 'transformed = ' + position.result + ';' : ''
);
}
output.push(
- "#include <morphtarget_vertex>",
- "#include <skinning_vertex>",
- "#include <project_vertex>",
- "#include <fog_vertex>",
- "#include <logdepthbuf_vertex>",
- "#include <clipping_planes_vertex>",
+ '#include <morphtarget_vertex>',
+ '#include <skinning_vertex>',
+ '#include <project_vertex>',
+ '#include <fog_vertex>',
+ '#include <logdepthbuf_vertex>',
+ '#include <clipping_planes_vertex>',
- " vViewPosition = - mvPosition.xyz;",
+ ' vViewPosition = - mvPosition.xyz;',
- "#include <worldpos_vertex>",
- "#include <shadowmap_vertex>"
+ '#include <worldpos_vertex>',
+ '#include <shadowmap_vertex>'
);
- code = output.join( "\n" );
+ code = output.join( '\n' );
} else {
@@ -237,33 +237,33 @@ StandardNode.prototype.build = function ( builder ) {
builder.requires.transparent = alpha !== undefined;
builder.addParsCode( [
- "varying vec3 vViewPosition;",
+ 'varying vec3 vViewPosition;',
- "#ifndef FLAT_SHADED",
+ '#ifndef FLAT_SHADED',
- " varying vec3 vNormal;",
+ ' varying vec3 vNormal;',
- "#endif",
+ '#endif',
- "#include <dithering_pars_fragment>",
- "#include <fog_pars_fragment>",
- "#include <bsdfs>",
- "#include <lights_pars_begin>",
- "#include <lights_physical_pars_fragment>",
- "#include <shadowmap_pars_fragment>",
- "#include <logdepthbuf_pars_fragment>"
- ].join( "\n" ) );
+ '#include <dithering_pars_fragment>',
+ '#include <fog_pars_fragment>',
+ '#include <bsdfs>',
+ '#include <lights_pars_begin>',
+ '#include <lights_physical_pars_fragment>',
+ '#include <shadowmap_pars_fragment>',
+ '#include <logdepthbuf_pars_fragment>'
+ ].join( '\n' ) );
var output = [
- "#include <clipping_planes_fragment>",
+ '#include <clipping_planes_fragment>',
// add before: prevent undeclared normal
- " #include <normal_fragment_begin>",
- " #include <clearcoat_normal_fragment_begin>",
+ ' #include <normal_fragment_begin>',
+ ' #include <clearcoat_normal_fragment_begin>',
// add before: prevent undeclared material
- " PhysicalMaterial material;",
- " material.diffuseColor = vec3( 1.0 );"
+ ' PhysicalMaterial material;',
+ ' material.diffuseColor = vec3( 1.0 );'
];
if ( mask ) {
@@ -277,16 +277,16 @@ StandardNode.prototype.build = function ( builder ) {
output.push(
color.code,
- " vec3 diffuseColor = " + color.result + ";",
- " ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",
+ ' vec3 diffuseColor = ' + color.result + ';',
+ ' ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );',
- "#include <logdepthbuf_fragment>",
+ '#include <logdepthbuf_fragment>',
roughness.code,
- " float roughnessFactor = " + roughness.result + ";",
+ ' float roughnessFactor = ' + roughness.result + ';',
metalness.code,
- " float metalnessFactor = " + metalness.result + ";"
+ ' float metalnessFactor = ' + metalness.result + ';'
);
if ( alpha ) {
@@ -389,23 +389,23 @@ StandardNode.prototype.build = function ( builder ) {
}
output.push(
- "#include <lights_fragment_begin>"
+ '#include <lights_fragment_begin>'
);
if ( light ) {
output.push(
light.code,
- "reflectedLight.directDiffuse = " + light.result + ";"
+ 'reflectedLight.directDiffuse = ' + light.result + ';'
);
// apply color
output.push(
- "diffuseColor *= 1.0 - metalnessFactor;",
+ 'diffuseColor *= 1.0 - metalnessFactor;',
- "reflectedLight.directDiffuse *= diffuseColor;",
- "reflectedLight.indirectDiffuse *= diffuseColor;"
+ 'reflectedLight.directDiffuse *= diffuseColor;',
+ 'reflectedLight.indirectDiffuse *= diffuseColor;'
);
}
@@ -414,9 +414,9 @@ StandardNode.prototype.build = function ( builder ) {
output.push(
ao.code,
- "reflectedLight.indirectDiffuse *= " + ao.result + ";",
- "float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );",
- "reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, " + ao.result + ", material.specularRoughness );"
+ 'reflectedLight.indirectDiffuse *= ' + ao.result + ';',
+ 'float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );',
+ 'reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ' + ao.result + ', material.specularRoughness );'
);
}
@@ -425,7 +425,7 @@ StandardNode.prototype.build = function ( builder ) {
output.push(
ambient.code,
- "reflectedLight.indirectDiffuse += " + ambient.result + ";"
+ 'reflectedLight.indirectDiffuse += ' + ambient.result + ';'
);
}
@@ -434,8 +434,8 @@ StandardNode.prototype.build = function ( builder ) {
output.push(
shadow.code,
- "reflectedLight.directDiffuse *= " + shadow.result + ";",
- "reflectedLight.directSpecular *= " + shadow.result + ";"
+ 'reflectedLight.directDiffuse *= ' + shadow.result + ';',
+ 'reflectedLight.directSpecular *= ' + shadow.result + ';'
);
}
@@ -444,7 +444,7 @@ StandardNode.prototype.build = function ( builder ) {
output.push(
emissive.code,
- "reflectedLight.directDiffuse += " + emissive.result + ";"
+ 'reflectedLight.directDiffuse += ' + emissive.result + ';'
);
}
@@ -463,46 +463,46 @@ StandardNode.prototype.build = function ( builder ) {
output.push(
clearcoatEnv.code,
- "clearcoatRadiance += " + clearcoatEnv.result + ";"
+ 'clearcoatRadiance += ' + clearcoatEnv.result + ';'
);
}
- output.push( "radiance += " + environment.radiance.result + ";" );
+ output.push( 'radiance += ' + environment.radiance.result + ';' );
if ( builder.requires.irradiance ) {
- output.push( "iblIrradiance += PI * " + environment.irradiance.result + ";" );
+ output.push( 'iblIrradiance += PI * ' + environment.irradiance.result + ';' );
}
}
output.push(
- "#include <lights_fragment_end>"
+ '#include <lights_fragment_end>'
);
- output.push( "vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular;" );
+ output.push( 'vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular;' );
if ( alpha ) {
- output.push( "gl_FragColor = vec4( outgoingLight, " + alpha.result + " );" );
+ output.push( 'gl_FragColor = vec4( outgoingLight, ' + alpha.result + ' );' );
} else {
- output.push( "gl_FragColor = vec4( outgoingLight, 1.0 );" );
+ output.push( 'gl_FragColor = vec4( outgoingLight, 1.0 );' );
}
output.push(
- "#include <tonemapping_fragment>",
- "#include <encodings_fragment>",
- "#include <fog_fragment>",
- "#include <premultiplied_alpha_fragment>",
- "#include <dithering_fragment>"
+ '#include <tonemapping_fragment>',
+ '#include <encodings_fragment>',
+ '#include <fog_fragment>',
+ '#include <premultiplied_alpha_fragment>',
+ '#include <dithering_fragment>'
);
- code = output.join( "\n" );
+ code = output.join( '\n' );
}
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/math/CondNode.js | @@ -25,7 +25,7 @@ CondNode.OR = '||';
CondNode.prototype = Object.create( TempNode.prototype );
CondNode.prototype.constructor = CondNode;
-CondNode.prototype.nodeType = "Cond";
+CondNode.prototype.nodeType = 'Cond';
CondNode.prototype.getType = function ( builder ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/math/MathNode.js | @@ -61,8 +61,8 @@ MathNode.FACEFORWARD = 'faceforward';
MathNode.prototype = Object.create( TempNode.prototype );
MathNode.prototype.constructor = MathNode;
-MathNode.prototype.nodeType = "Math";
-MathNode.prototype.hashProperties = [ "method" ];
+MathNode.prototype.nodeType = 'Math';
+MathNode.prototype.hashProperties = [ 'method' ];
MathNode.prototype.getNumInputs = function ( /*builder*/ ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/math/OperatorNode.js | @@ -17,7 +17,7 @@ OperatorNode.DIV = '/';
OperatorNode.prototype = Object.create( TempNode.prototype );
OperatorNode.prototype.constructor = OperatorNode;
-OperatorNode.prototype.nodeType = "Operator";
+OperatorNode.prototype.nodeType = 'Operator';
OperatorNode.prototype.getType = function ( builder ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/misc/BumpMapNode.js | @@ -24,62 +24,62 @@ BumpMapNode.Nodes = ( function () {
// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)
- "vec2 dHdxy_fwd( sampler2D bumpMap, vec2 vUv, float bumpScale ) {",
+ 'vec2 dHdxy_fwd( sampler2D bumpMap, vec2 vUv, float bumpScale ) {',
// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
- " vec2 dSTdx = dFdx( vUv );",
- " vec2 dSTdy = dFdy( vUv );",
+ ' vec2 dSTdx = dFdx( vUv );',
+ ' vec2 dSTdy = dFdy( vUv );',
- " float Hll = bumpScale * texture2D( bumpMap, vUv ).x;",
- " float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;",
- " float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;",
+ ' float Hll = bumpScale * texture2D( bumpMap, vUv ).x;',
+ ' float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;',
+ ' float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;',
- " return vec2( dBx, dBy );",
+ ' return vec2( dBx, dBy );',
- "}"
+ '}'
- ].join( "\n" ), null, { derivatives: true } );
+ ].join( '\n' ), null, { derivatives: true } );
var perturbNormalArb = new FunctionNode( [
- "vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {",
+ 'vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {',
// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
- " vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );",
- " vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );",
- " vec3 vN = surf_norm;", // normalized
+ ' vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );',
+ ' vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );',
+ ' vec3 vN = surf_norm;', // normalized
- " vec3 R1 = cross( vSigmaY, vN );",
- " vec3 R2 = cross( vN, vSigmaX );",
+ ' vec3 R1 = cross( vSigmaY, vN );',
+ ' vec3 R2 = cross( vN, vSigmaX );',
- " float fDet = dot( vSigmaX, R1 );",
+ ' float fDet = dot( vSigmaX, R1 );',
- " fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );",
+ ' fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );',
- " vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );",
+ ' vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );',
- " return normalize( abs( fDet ) * surf_norm - vGrad );",
+ ' return normalize( abs( fDet ) * surf_norm - vGrad );',
- "}"
+ '}'
- ].join( "\n" ), [ dHdxy_fwd ], { derivatives: true } );
+ ].join( '\n' ), [ dHdxy_fwd ], { derivatives: true } );
var bumpToNormal = new FunctionNode( [
- "vec3 bumpToNormal( sampler2D bumpMap, vec2 uv, float scale ) {",
+ 'vec3 bumpToNormal( sampler2D bumpMap, vec2 uv, float scale ) {',
- " vec2 dSTdx = dFdx( uv );",
- " vec2 dSTdy = dFdy( uv );",
+ ' vec2 dSTdx = dFdx( uv );',
+ ' vec2 dSTdy = dFdy( uv );',
- " float Hll = texture2D( bumpMap, uv ).x;",
- " float dBx = texture2D( bumpMap, uv + dSTdx ).x - Hll;",
- " float dBy = texture2D( bumpMap, uv + dSTdy ).x - Hll;",
+ ' float Hll = texture2D( bumpMap, uv ).x;',
+ ' float dBx = texture2D( bumpMap, uv + dSTdx ).x - Hll;',
+ ' float dBy = texture2D( bumpMap, uv + dSTdy ).x - Hll;',
- " return vec3( .5 - ( dBx * scale ), .5 - ( dBy * scale ), 1.0 );",
+ ' return vec3( .5 - ( dBx * scale ), .5 - ( dBy * scale ), 1.0 );',
- "}"
- ].join( "\n" ), null, { derivatives: true } );
+ '}'
+ ].join( '\n' ), null, { derivatives: true } );
return {
dHdxy_fwd: dHdxy_fwd,
@@ -91,8 +91,8 @@ BumpMapNode.Nodes = ( function () {
BumpMapNode.prototype = Object.create( TempNode.prototype );
BumpMapNode.prototype.constructor = BumpMapNode;
-BumpMapNode.prototype.nodeType = "BumpMap";
-BumpMapNode.prototype.hashProperties = [ "toNormalMap" ];
+BumpMapNode.prototype.nodeType = 'BumpMap';
+BumpMapNode.prototype.hashProperties = [ 'toNormalMap' ];
BumpMapNode.prototype.generate = function ( builder, output ) {
@@ -126,7 +126,7 @@ BumpMapNode.prototype.generate = function ( builder, output ) {
} else {
- console.warn( "THREE.BumpMapNode is not compatible with " + builder.shader + " shader." );
+ console.warn( 'THREE.BumpMapNode is not compatible with ' + builder.shader + ' shader.' );
return builder.format( 'vec3( 0.0 )', this.getType( builder ), output );
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/misc/NormalMapNode.js | @@ -69,7 +69,7 @@ NormalMapNode.Nodes = ( function () {
NormalMapNode.prototype = Object.create( TempNode.prototype );
NormalMapNode.prototype.constructor = NormalMapNode;
-NormalMapNode.prototype.nodeType = "NormalMap";
+NormalMapNode.prototype.nodeType = 'NormalMap';
NormalMapNode.prototype.generate = function ( builder, output ) {
@@ -97,7 +97,7 @@ NormalMapNode.prototype.generate = function ( builder, output ) {
} else {
- console.warn( "THREE.NormalMapNode is not compatible with " + builder.shader + " shader." );
+ console.warn( 'THREE.NormalMapNode is not compatible with ' + builder.shader + ' shader.' );
return builder.format( 'vec3( 0.0 )', this.getType( builder ), output );
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/misc/TextureCubeNode.js | @@ -27,7 +27,7 @@ function TextureCubeNode( value, uv, bias ) {
TextureCubeNode.prototype = Object.create( TempNode.prototype );
TextureCubeNode.prototype.constructor = TextureCubeNode;
-TextureCubeNode.prototype.nodeType = "TextureCube";
+TextureCubeNode.prototype.nodeType = 'TextureCube';
TextureCubeNode.prototype.generate = function ( builder, output ) {
@@ -47,7 +47,7 @@ TextureCubeNode.prototype.generate = function ( builder, output ) {
} else {
- console.warn( "THREE.TextureCubeNode is not compatible with " + builder.shader + " shader." );
+ console.warn( 'THREE.TextureCubeNode is not compatible with ' + builder.shader + ' shader.' );
return builder.format( 'vec4( 0.0 )', this.getType( builder ), output );
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/misc/TextureCubeUVNode.js | @@ -30,10 +30,10 @@ TextureCubeUVNode.Nodes = ( function () {
vec2 f;
}` );
- var cubeUV_maxMipLevel = new ConstNode( `float cubeUV_maxMipLevel 8.0`, true );
- var cubeUV_minMipLevel = new ConstNode( `float cubeUV_minMipLevel 4.0`, true );
- var cubeUV_maxTileSize = new ConstNode( `float cubeUV_maxTileSize 256.0`, true );
- var cubeUV_minTileSize = new ConstNode( `float cubeUV_minTileSize 16.0`, true );
+ var cubeUV_maxMipLevel = new ConstNode( 'float cubeUV_maxMipLevel 8.0', true );
+ var cubeUV_minMipLevel = new ConstNode( 'float cubeUV_minMipLevel 4.0', true );
+ var cubeUV_maxTileSize = new ConstNode( 'float cubeUV_maxTileSize 256.0', true );
+ var cubeUV_minTileSize = new ConstNode( 'float cubeUV_minTileSize 16.0', true );
// These shader functions convert between the UV coordinates of a single face of
// a cubemap, the 0-5 integer index of a cube face, and the direction vector for
@@ -117,21 +117,21 @@ TextureCubeUVNode.Nodes = ( function () {
// These defines must match with PMREMGenerator
- var r0 = new ConstNode( `float r0 1.0`, true );
- var v0 = new ConstNode( `float v0 0.339`, true );
- var m0 = new ConstNode( `float m0 -2.0`, true );
- var r1 = new ConstNode( `float r1 0.8`, true );
- var v1 = new ConstNode( `float v1 0.276`, true );
- var m1 = new ConstNode( `float m1 -1.0`, true );
- var r4 = new ConstNode( `float r4 0.4`, true );
- var v4 = new ConstNode( `float v4 0.046`, true );
- var m4 = new ConstNode( `float m4 2.0`, true );
- var r5 = new ConstNode( `float r5 0.305`, true );
- var v5 = new ConstNode( `float v5 0.016`, true );
- var m5 = new ConstNode( `float m5 3.0`, true );
- var r6 = new ConstNode( `float r6 0.21`, true );
- var v6 = new ConstNode( `float v6 0.0038`, true );
- var m6 = new ConstNode( `float m6 4.0`, true );
+ var r0 = new ConstNode( 'float r0 1.0', true );
+ var v0 = new ConstNode( 'float v0 0.339', true );
+ var m0 = new ConstNode( 'float m0 -2.0', true );
+ var r1 = new ConstNode( 'float r1 0.8', true );
+ var v1 = new ConstNode( 'float v1 0.276', true );
+ var m1 = new ConstNode( 'float m1 -1.0', true );
+ var r4 = new ConstNode( 'float r4 0.4', true );
+ var v4 = new ConstNode( 'float v4 0.046', true );
+ var m4 = new ConstNode( 'float m4 2.0', true );
+ var r5 = new ConstNode( 'float r5 0.305', true );
+ var v5 = new ConstNode( 'float v5 0.016', true );
+ var m5 = new ConstNode( 'float m5 3.0', true );
+ var r6 = new ConstNode( 'float r6 0.21', true );
+ var v6 = new ConstNode( 'float v6 0.0038', true );
+ var m6 = new ConstNode( 'float m6 4.0', true );
var defines = [ r0, v0, m0, r1, v1, m1, r4, v4, m4, r5, v5, m5, r6, v6, m6 ];
@@ -163,7 +163,7 @@ TextureCubeUVNode.Nodes = ( function () {
TextureCubeUVNode.prototype = Object.create( TempNode.prototype );
TextureCubeUVNode.prototype.constructor = TextureCubeUVNode;
-TextureCubeUVNode.prototype.nodeType = "TextureCubeUV";
+TextureCubeUVNode.prototype.nodeType = 'TextureCubeUV';
TextureCubeUVNode.prototype.bilinearCubeUV = function ( builder, texture, uv, mipInt ) {
@@ -205,7 +205,7 @@ TextureCubeUVNode.prototype.bilinearCubeUV = function ( builder, texture, uv, mi
// --
- var output = new ExpressionNode( `mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )`, 'v4' );
+ var output = new ExpressionNode( 'mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )', 'v4' );
output.keywords[ 'cubeUV_TL' ] = this.colorSpaceTLExp;
output.keywords[ 'cubeUV_TR' ] = this.colorSpaceTRExp;
output.keywords[ 'cubeUV_BL' ] = this.colorSpaceBLExp;
@@ -252,7 +252,7 @@ TextureCubeUVNode.prototype.generate = function ( builder, output ) {
} else {
- console.warn( "THREE.TextureCubeUVNode is not compatible with " + builder.shader + " shader." );
+ console.warn( 'THREE.TextureCubeUVNode is not compatible with ' + builder.shader + ' shader.' );
return builder.format( 'vec4( 0.0 )', this.getType( builder ), output );
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/postprocessing/NodePass.js | @@ -8,7 +8,7 @@ function NodePass() {
ShaderPass.call( this );
- this.name = "";
+ this.name = '';
this.uuid = MathUtils.generateUUID();
this.userData = {};
@@ -71,11 +71,11 @@ NodePass.prototype.toJSON = function ( meta ) {
var data = {};
data.uuid = this.uuid;
- data.type = "NodePass";
+ data.type = 'NodePass';
meta.passes[ this.uuid ] = data;
- if ( this.name !== "" ) data.name = this.name;
+ if ( this.name !== '' ) data.name = this.name;
if ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/postprocessing/NodePostProcessing.js | @@ -127,11 +127,11 @@ NodePostProcessing.prototype = {
var data = {};
data.uuid = this.uuid;
- data.type = "NodePostProcessing";
+ data.type = 'NodePostProcessing';
meta.post[ this.uuid ] = data;
- if ( this.name !== "" ) data.name = this.name;
+ if ( this.name !== '' ) data.name = this.name;
if ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/procedural/CheckerNode.js | @@ -12,23 +12,23 @@ function CheckerNode( uv ) {
CheckerNode.prototype = Object.create( TempNode.prototype );
CheckerNode.prototype.constructor = CheckerNode;
-CheckerNode.prototype.nodeType = "Noise";
+CheckerNode.prototype.nodeType = 'Noise';
CheckerNode.Nodes = ( function () {
// https://github.com/mattdesl/glsl-checker/blob/master/index.glsl
var checker = new FunctionNode( [
- "float checker( vec2 uv ) {",
+ 'float checker( vec2 uv ) {',
- " float cx = floor( uv.x );",
- " float cy = floor( uv.y ); ",
- " float result = mod( cx + cy, 2.0 );",
+ ' float cx = floor( uv.x );',
+ ' float cy = floor( uv.y ); ',
+ ' float result = mod( cx + cy, 2.0 );',
- " return sign( result );",
+ ' return sign( result );',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
return {
checker: checker | true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/procedural/NoiseNode.js | @@ -12,17 +12,17 @@ function NoiseNode( uv ) {
NoiseNode.prototype = Object.create( TempNode.prototype );
NoiseNode.prototype.constructor = NoiseNode;
-NoiseNode.prototype.nodeType = "Noise";
+NoiseNode.prototype.nodeType = 'Noise';
NoiseNode.Nodes = ( function () {
var snoise = new FunctionNode( [
- "float snoise(vec2 co) {",
+ 'float snoise(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 );',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
return {
snoise: snoise | true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/utils/BypassNode.js | @@ -11,7 +11,7 @@ function BypassNode( code, value ) {
BypassNode.prototype = Object.create( Node.prototype );
BypassNode.prototype.constructor = BypassNode;
-BypassNode.prototype.nodeType = "Bypass";
+BypassNode.prototype.nodeType = 'Bypass';
BypassNode.prototype.getType = function ( builder ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/utils/ColorSpaceNode.js | @@ -29,145 +29,145 @@ ColorSpaceNode.Nodes = ( function () {
// For a discussion of what this is, please read this: http://lousodrome.net/blog/light/2013/05/26/gamma-correct-and-hdr-rendering-in-a-32-bits-buffer/
var LinearToLinear = new FunctionNode( [
- "vec4 LinearToLinear( in vec4 value ) {",
+ 'vec4 LinearToLinear( in vec4 value ) {',
- " return value;",
+ ' return value;',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
var GammaToLinear = new FunctionNode( [
- "vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {",
+ 'vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {',
- " return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );",
+ ' return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
var LinearToGamma = new FunctionNode( [
- "vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {",
+ 'vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {',
- " return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );",
+ ' return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
var sRGBToLinear = new FunctionNode( [
- "vec4 sRGBToLinear( in vec4 value ) {",
+ 'vec4 sRGBToLinear( in vec4 value ) {',
- " return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );",
+ ' return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
var LinearTosRGB = new FunctionNode( [
- "vec4 LinearTosRGB( in vec4 value ) {",
+ 'vec4 LinearTosRGB( in vec4 value ) {',
- " return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );",
+ ' return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
var RGBEToLinear = new FunctionNode( [
- "vec4 RGBEToLinear( in vec4 value ) {",
+ 'vec4 RGBEToLinear( in vec4 value ) {',
- " return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );",
+ ' return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
var LinearToRGBE = new FunctionNode( [
- "vec4 LinearToRGBE( in vec4 value ) {",
+ 'vec4 LinearToRGBE( in vec4 value ) {',
- " float maxComponent = max( max( value.r, value.g ), value.b );",
- " float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );",
- " return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );",
+ ' float maxComponent = max( max( value.r, value.g ), value.b );',
+ ' float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );',
+ ' return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );',
// return vec4( value.brg, ( 3.0 + 128.0 ) / 256.0 );
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html
var RGBMToLinear = new FunctionNode( [
- "vec3 RGBMToLinear( in vec4 value, in float maxRange ) {",
+ 'vec3 RGBMToLinear( in vec4 value, in float maxRange ) {',
- " return vec4( value.xyz * value.w * maxRange, 1.0 );",
+ ' return vec4( value.xyz * value.w * maxRange, 1.0 );',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
var LinearToRGBM = new FunctionNode( [
- "vec3 LinearToRGBM( in vec4 value, in float maxRange ) {",
+ 'vec3 LinearToRGBM( in vec4 value, in float maxRange ) {',
- " float maxRGB = max( value.x, max( value.g, value.b ) );",
- " float M = clamp( maxRGB / maxRange, 0.0, 1.0 );",
- " M = ceil( M * 255.0 ) / 255.0;",
- " return vec4( value.rgb / ( M * maxRange ), M );",
+ ' float maxRGB = max( value.x, max( value.g, value.b ) );',
+ ' float M = clamp( maxRGB / maxRange, 0.0, 1.0 );',
+ ' M = ceil( M * 255.0 ) / 255.0;',
+ ' return vec4( value.rgb / ( M * maxRange ), M );',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html
var RGBDToLinear = new FunctionNode( [
- "vec3 RGBDToLinear( in vec4 value, in float maxRange ) {",
+ 'vec3 RGBDToLinear( in vec4 value, in float maxRange ) {',
- " return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );",
+ ' return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
var LinearToRGBD = new FunctionNode( [
- "vec3 LinearToRGBD( in vec4 value, in float maxRange ) {",
+ 'vec3 LinearToRGBD( in vec4 value, in float maxRange ) {',
- " float maxRGB = max( value.x, max( value.g, value.b ) );",
- " float D = max( maxRange / maxRGB, 1.0 );",
- " D = clamp( floor( D ) / 255.0, 0.0, 1.0 );",
- " return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );",
+ ' float maxRGB = max( value.x, max( value.g, value.b ) );',
+ ' float D = max( maxRange / maxRGB, 1.0 );',
+ ' D = clamp( floor( D ) / 255.0, 0.0, 1.0 );',
+ ' return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
// LogLuv reference: http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html
// M matrix, for encoding
- var cLogLuvM = new ConstNode( "const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );" );
+ var cLogLuvM = new ConstNode( 'const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );' );
var LinearToLogLuv = new FunctionNode( [
- "vec4 LinearToLogLuv( in vec4 value ) {",
+ 'vec4 LinearToLogLuv( in vec4 value ) {',
- " vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;",
- " Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));",
- " vec4 vResult;",
- " vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;",
- " float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;",
- " vResult.w = fract(Le);",
- " vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;",
- " return vResult;",
+ ' vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;',
+ ' Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));',
+ ' vec4 vResult;',
+ ' vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;',
+ ' float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;',
+ ' vResult.w = fract(Le);',
+ ' vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;',
+ ' return vResult;',
- "}"
- ].join( "\n" ), [ cLogLuvM ] );
+ '}'
+ ].join( '\n' ), [ cLogLuvM ] );
// Inverse M matrix, for decoding
- var cLogLuvInverseM = new ConstNode( "const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );" );
+ var cLogLuvInverseM = new ConstNode( 'const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );' );
var LogLuvToLinear = new FunctionNode( [
- "vec4 LogLuvToLinear( in vec4 value ) {",
+ 'vec4 LogLuvToLinear( in vec4 value ) {',
- " float Le = value.z * 255.0 + value.w;",
- " vec3 Xp_Y_XYZp;",
- " Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);",
- " Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;",
- " Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;",
- " vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;",
- " return vec4( max(vRGB, 0.0), 1.0 );",
+ ' float Le = value.z * 255.0 + value.w;',
+ ' vec3 Xp_Y_XYZp;',
+ ' Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);',
+ ' Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;',
+ ' Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;',
+ ' vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;',
+ ' return vec4( max(vRGB, 0.0), 1.0 );',
- "}"
- ].join( "\n" ), [ cLogLuvInverseM ] );
+ '}'
+ ].join( '\n' ), [ cLogLuvInverseM ] );
return {
LinearToLinear: LinearToLinear,
@@ -234,8 +234,8 @@ ColorSpaceNode.getEncodingComponents = function ( encoding ) {
ColorSpaceNode.prototype = Object.create( TempNode.prototype );
ColorSpaceNode.prototype.constructor = ColorSpaceNode;
-ColorSpaceNode.prototype.nodeType = "ColorSpace";
-ColorSpaceNode.prototype.hashProperties = [ "method" ];
+ColorSpaceNode.prototype.nodeType = 'ColorSpace';
+ColorSpaceNode.prototype.hashProperties = [ 'method' ];
ColorSpaceNode.prototype.generate = function ( builder, output ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/utils/JoinNode.js | @@ -16,7 +16,7 @@ function JoinNode( x, y, z, w ) {
JoinNode.prototype = Object.create( TempNode.prototype );
JoinNode.prototype.constructor = JoinNode;
-JoinNode.prototype.nodeType = "Join";
+JoinNode.prototype.nodeType = 'Join';
JoinNode.prototype.getNumElements = function () {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/utils/MaxMIPLevelNode.js | @@ -12,7 +12,7 @@ function MaxMIPLevelNode( texture ) {
MaxMIPLevelNode.prototype = Object.create( FloatNode.prototype );
MaxMIPLevelNode.prototype.constructor = MaxMIPLevelNode;
-MaxMIPLevelNode.prototype.nodeType = "MaxMIPLevel";
+MaxMIPLevelNode.prototype.nodeType = 'MaxMIPLevel';
Object.defineProperties( MaxMIPLevelNode.prototype, {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/utils/SpecularMIPLevelNode.js | @@ -17,16 +17,16 @@ SpecularMIPLevelNode.Nodes = ( function () {
var getSpecularMIPLevel = new FunctionNode( [
// taken from here: http://casual-effects.blogspot.ca/2011/08/plausible-environment-lighting-in-two.html
- "float getSpecularMIPLevel( const in float roughness, const in float maxMIPLevelScalar ) {",
+ 'float getSpecularMIPLevel( const in float roughness, const in float maxMIPLevelScalar ) {',
- " float sigma = PI * roughness * roughness / ( 1.0 + roughness );",
- " float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );",
+ ' float sigma = PI * roughness * roughness / ( 1.0 + roughness );',
+ ' float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );',
// clamp to allowable LOD ranges.
- " return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );",
+ ' return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );',
- "}"
- ].join( "\n" ) );
+ '}'
+ ].join( '\n' ) );
return {
getSpecularMIPLevel: getSpecularMIPLevel
@@ -36,7 +36,7 @@ SpecularMIPLevelNode.Nodes = ( function () {
SpecularMIPLevelNode.prototype = Object.create( TempNode.prototype );
SpecularMIPLevelNode.prototype.constructor = SpecularMIPLevelNode;
-SpecularMIPLevelNode.prototype.nodeType = "SpecularMIPLevel";
+SpecularMIPLevelNode.prototype.nodeType = 'SpecularMIPLevel';
SpecularMIPLevelNode.prototype.setTexture = function ( texture ) {
@@ -59,7 +59,7 @@ SpecularMIPLevelNode.prototype.generate = function ( builder, output ) {
} else {
- console.warn( "THREE.SpecularMIPLevelNode is not compatible with " + builder.shader + " shader." );
+ console.warn( 'THREE.SpecularMIPLevelNode is not compatible with ' + builder.shader + ' shader.' );
return builder.format( '0.0', this.type, output );
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/utils/SubSlotNode.js | @@ -10,7 +10,7 @@ function SubSlotNode( slots ) {
SubSlotNode.prototype = Object.create( TempNode.prototype );
SubSlotNode.prototype.constructor = SubSlotNode;
-SubSlotNode.prototype.nodeType = "SubSlot";
+SubSlotNode.prototype.nodeType = 'SubSlot';
SubSlotNode.prototype.getType = function ( builder, output ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/utils/SwitchNode.js | @@ -11,7 +11,7 @@ function SwitchNode( node, components ) {
SwitchNode.prototype = Object.create( Node.prototype );
SwitchNode.prototype.constructor = SwitchNode;
-SwitchNode.prototype.nodeType = "Switch";
+SwitchNode.prototype.nodeType = 'Switch';
SwitchNode.prototype.getType = function ( builder ) {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/utils/TimerNode.js | @@ -18,7 +18,7 @@ TimerNode.DELTA = 'delta';
TimerNode.prototype = Object.create( FloatNode.prototype );
TimerNode.prototype.constructor = TimerNode;
-TimerNode.prototype.nodeType = "Timer";
+TimerNode.prototype.nodeType = 'Timer';
TimerNode.prototype.getReadonly = function () {
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/utils/UVTransformNode.js | @@ -4,7 +4,7 @@ import { UVNode } from '../accessors/UVNode.js';
function UVTransformNode( uv, position ) {
- ExpressionNode.call( this, "( uvTransform * vec3( uvNode, 1 ) ).xy", "vec2" );
+ ExpressionNode.call( this, '( uvTransform * vec3( uvNode, 1 ) ).xy', 'vec2' );
this.uv = uv || new UVNode();
this.position = position || new Matrix3Node();
@@ -13,12 +13,12 @@ function UVTransformNode( uv, position ) {
UVTransformNode.prototype = Object.create( ExpressionNode.prototype );
UVTransformNode.prototype.constructor = UVTransformNode;
-UVTransformNode.prototype.nodeType = "UVTransform";
+UVTransformNode.prototype.nodeType = 'UVTransform';
UVTransformNode.prototype.generate = function ( builder, output ) {
- this.keywords[ "uvNode" ] = this.uv;
- this.keywords[ "uvTransform" ] = this.position;
+ this.keywords[ 'uvNode' ] = this.uv;
+ this.keywords[ 'uvTransform' ] = this.position;
return ExpressionNode.prototype.generate.call( this, builder, output );
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/nodes/utils/VelocityNode.js | @@ -17,7 +17,7 @@ function VelocityNode( target, params ) {
VelocityNode.prototype = Object.create( Vector3Node.prototype );
VelocityNode.prototype.constructor = VelocityNode;
-VelocityNode.prototype.nodeType = "Velocity";
+VelocityNode.prototype.nodeType = 'Velocity';
VelocityNode.prototype.getReadonly = function ( /*builder*/ ) {
@@ -29,7 +29,7 @@ VelocityNode.prototype.setParams = function ( params ) {
switch ( this.params.type ) {
- case "elastic":
+ case 'elastic':
delete this.moment;
@@ -46,7 +46,7 @@ VelocityNode.prototype.setParams = function ( params ) {
switch ( this.params.type ) {
- case "elastic":
+ case 'elastic':
this.moment = new Vector3();
@@ -99,7 +99,7 @@ VelocityNode.prototype.updateFrame = function ( frame ) {
switch ( this.params.type ) {
- case "elastic":
+ case 'elastic':
// convert to real scale: 0 at 1 values
var deltaFps = frame.delta * ( this.params.fps || 60 ); | true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/utils/GeometryCompressionUtils.js | @@ -30,31 +30,31 @@ var GeometryCompressionUtils = {
if ( ! mesh.geometry ) {
- console.error( "Mesh must contain geometry. " );
+ console.error( 'Mesh must contain geometry. ' );
}
const normal = mesh.geometry.attributes.normal;
if ( ! normal ) {
- console.error( "Geometry must contain normal attribute. " );
+ console.error( 'Geometry must contain normal attribute. ' );
}
if ( normal.isPacked ) return;
if ( normal.itemSize != 3 ) {
- console.error( "normal.itemSize is not 3, which cannot be encoded. " );
+ console.error( 'normal.itemSize is not 3, which cannot be encoded. ' );
}
const array = normal.array;
const count = normal.count;
let result;
- if ( encodeMethod == "DEFAULT" ) {
+ if ( encodeMethod == 'DEFAULT' ) {
// TODO: Add 1 byte to the result, making the encoded length to be 4 bytes.
result = new Uint8Array( count * 3 );
@@ -72,7 +72,7 @@ var GeometryCompressionUtils = {
mesh.geometry.setAttribute( 'normal', new BufferAttribute( result, 3, true ) );
mesh.geometry.attributes.normal.bytes = result.length * 1;
- } else if ( encodeMethod == "OCT1Byte" ) {
+ } else if ( encodeMethod == 'OCT1Byte' ) {
/**
* It is not recommended to use 1-byte octahedron normals encoding unless you want to extremely reduce the memory usage
@@ -94,7 +94,7 @@ var GeometryCompressionUtils = {
mesh.geometry.setAttribute( 'normal', new BufferAttribute( result, 2, true ) );
mesh.geometry.attributes.normal.bytes = result.length * 1;
- } else if ( encodeMethod == "OCT2Byte" ) {
+ } else if ( encodeMethod == 'OCT2Byte' ) {
result = new Int16Array( count * 2 );
@@ -110,7 +110,7 @@ var GeometryCompressionUtils = {
mesh.geometry.setAttribute( 'normal', new BufferAttribute( result, 2, true ) );
mesh.geometry.attributes.normal.bytes = result.length * 2;
- } else if ( encodeMethod == "ANGLES" ) {
+ } else if ( encodeMethod == 'ANGLES' ) {
result = new Uint16Array( count * 2 );
@@ -128,7 +128,7 @@ var GeometryCompressionUtils = {
} else {
- console.error( "Unrecognized encoding method, should be `DEFAULT` or `ANGLES` or `OCT`. " );
+ console.error( 'Unrecognized encoding method, should be `DEFAULT` or `ANGLES` or `OCT`. ' );
}
@@ -143,25 +143,25 @@ var GeometryCompressionUtils = {
}
- if ( encodeMethod == "ANGLES" ) {
+ if ( encodeMethod == 'ANGLES' ) {
mesh.material.defines.USE_PACKED_NORMAL = 0;
}
- if ( encodeMethod == "OCT1Byte" ) {
+ if ( encodeMethod == 'OCT1Byte' ) {
mesh.material.defines.USE_PACKED_NORMAL = 1;
}
- if ( encodeMethod == "OCT2Byte" ) {
+ if ( encodeMethod == 'OCT2Byte' ) {
mesh.material.defines.USE_PACKED_NORMAL = 1;
}
- if ( encodeMethod == "DEFAULT" ) {
+ if ( encodeMethod == 'DEFAULT' ) {
mesh.material.defines.USE_PACKED_NORMAL = 2;
@@ -181,23 +181,23 @@ var GeometryCompressionUtils = {
if ( ! mesh.geometry ) {
- console.error( "Mesh must contain geometry. " );
+ console.error( 'Mesh must contain geometry. ' );
}
const position = mesh.geometry.attributes.position;
if ( ! position ) {
- console.error( "Geometry must contain position attribute. " );
+ console.error( 'Geometry must contain position attribute. ' );
}
if ( position.isPacked ) return;
if ( position.itemSize != 3 ) {
- console.error( "position.itemSize is not 3, which cannot be packed. " );
+ console.error( 'position.itemSize is not 3, which cannot be packed. ' );
}
@@ -243,15 +243,15 @@ var GeometryCompressionUtils = {
if ( ! mesh.geometry ) {
- console.error( "Mesh must contain geometry property. " );
+ console.error( 'Mesh must contain geometry property. ' );
}
const uvs = mesh.geometry.attributes.uv;
if ( ! uvs ) {
- console.error( "Geometry must contain uv attribute. " );
+ console.error( 'Geometry must contain uv attribute. ' );
}
@@ -342,7 +342,7 @@ var GeometryCompressionUtils = {
} else {
- console.error( "number of bytes must be 1 or 2" );
+ console.error( 'number of bytes must be 1 or 2' );
}
@@ -368,7 +368,7 @@ var GeometryCompressionUtils = {
} else {
- console.error( "number of bytes must be 1 or 2" );
+ console.error( 'number of bytes must be 1 or 2' );
}
@@ -390,11 +390,11 @@ var GeometryCompressionUtils = {
// Test various combinations of ceil and floor
// to minimize rounding errors
- best = oct = octEncodeVec3( x, y, z, "floor", "floor" );
+ best = oct = octEncodeVec3( x, y, z, 'floor', 'floor' );
dec = octDecodeVec2( oct );
bestCos = dot( x, y, z, dec );
- oct = octEncodeVec3( x, y, z, "ceil", "floor" );
+ oct = octEncodeVec3( x, y, z, 'ceil', 'floor' );
dec = octDecodeVec2( oct );
currentCos = dot( x, y, z, dec );
@@ -405,7 +405,7 @@ var GeometryCompressionUtils = {
}
- oct = octEncodeVec3( x, y, z, "floor", "ceil" );
+ oct = octEncodeVec3( x, y, z, 'floor', 'ceil' );
dec = octDecodeVec2( oct );
currentCos = dot( x, y, z, dec );
@@ -416,7 +416,7 @@ var GeometryCompressionUtils = {
}
- oct = octEncodeVec3( x, y, z, "ceil", "ceil" );
+ oct = octEncodeVec3( x, y, z, 'ceil', 'ceil' );
dec = octDecodeVec2( oct );
currentCos = dot( x, y, z, dec );
@@ -535,7 +535,7 @@ var GeometryCompressionUtils = {
} else {
- console.error( "number of bytes error! " );
+ console.error( 'number of bytes error! ' );
}
@@ -609,7 +609,7 @@ var GeometryCompressionUtils = {
} else {
- console.error( "number of bytes error! " );
+ console.error( 'number of bytes error! ' );
}
@@ -687,13 +687,13 @@ function PackedPhongMaterial( parameters ) {
] );
this.vertexShader = [
- "#define PHONG",
+ '#define PHONG',
- "varying vec3 vViewPosition;",
+ 'varying vec3 vViewPosition;',
- "#ifndef FLAT_SHADED",
- "varying vec3 vNormal;",
- "#endif",
+ '#ifndef FLAT_SHADED',
+ 'varying vec3 vNormal;',
+ '#endif',
ShaderChunk.common,
ShaderChunk.uv_pars_vertex,
@@ -771,7 +771,7 @@ function PackedPhongMaterial( parameters ) {
#endif
#endif`,
- "void main() {",
+ 'void main() {',
ShaderChunk.uv_vertex,
@@ -799,9 +799,9 @@ function PackedPhongMaterial( parameters ) {
ShaderChunk.skinnormal_vertex,
ShaderChunk.defaultnormal_vertex,
- "#ifndef FLAT_SHADED",
- " vNormal = normalize( transformedNormal );",
- "#endif",
+ '#ifndef FLAT_SHADED',
+ ' vNormal = normalize( transformedNormal );',
+ '#endif',
ShaderChunk.begin_vertex,
@@ -818,25 +818,25 @@ function PackedPhongMaterial( parameters ) {
ShaderChunk.logdepthbuf_vertex,
ShaderChunk.clipping_planes_vertex,
- "vViewPosition = - mvPosition.xyz;",
+ 'vViewPosition = - mvPosition.xyz;',
ShaderChunk.worldpos_vertex,
ShaderChunk.envmap_vertex,
ShaderChunk.shadowmap_vertex,
ShaderChunk.fog_vertex,
- "}",
- ].join( "\n" );
+ '}',
+ ].join( '\n' );
// Use the original MeshPhongMaterial's fragmentShader.
this.fragmentShader = [
- "#define PHONG",
+ '#define PHONG',
- "uniform vec3 diffuse;",
- "uniform vec3 emissive;",
- "uniform vec3 specular;",
- "uniform float shininess;",
- "uniform float opacity;",
+ 'uniform vec3 diffuse;',
+ 'uniform vec3 emissive;',
+ 'uniform vec3 specular;',
+ 'uniform float shininess;',
+ 'uniform float opacity;',
ShaderChunk.common,
ShaderChunk.packing,
@@ -863,13 +863,13 @@ function PackedPhongMaterial( parameters ) {
ShaderChunk.logdepthbuf_pars_fragment,
ShaderChunk.clipping_planes_pars_fragment,
- "void main() {",
+ 'void main() {',
ShaderChunk.clipping_planes_fragment,
- "vec4 diffuseColor = vec4( diffuse, opacity );",
- "ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",
- "vec3 totalEmissiveRadiance = emissive;",
+ 'vec4 diffuseColor = vec4( diffuse, opacity );',
+ 'ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );',
+ 'vec3 totalEmissiveRadiance = emissive;',
ShaderChunk.logdepthbuf_fragment,
ShaderChunk.map_fragment,
@@ -890,19 +890,19 @@ function PackedPhongMaterial( parameters ) {
// modulation
ShaderChunk.aomap_fragment,
- "vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;",
+ 'vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;',
ShaderChunk.envmap_fragment,
- "gl_FragColor = vec4( outgoingLight, diffuseColor.a );",
+ 'gl_FragColor = vec4( outgoingLight, diffuseColor.a );',
ShaderChunk.tonemapping_fragment,
ShaderChunk.encodings_fragment,
ShaderChunk.fog_fragment,
ShaderChunk.premultiplied_alpha_fragment,
ShaderChunk.dithering_fragment,
- "}",
- ].join( "\n" );
+ '}',
+ ].join( '\n' );
this.setValues( parameters );
| true |
Other | mrdoob | three.js | 9f07bafb9b8410f55879e96be3d336e094e85cf9.json | Run lint fix on js and jsm files | examples/jsm/webxr/XRControllerModelFactory.js | @@ -259,7 +259,7 @@ var XRControllerModelFactory = ( function () {
if ( ! this.gltfLoader ) {
- throw new Error( `GLTFLoader not set.` );
+ throw new Error( 'GLTFLoader not set.' );
}
| true |
Other | mrdoob | three.js | eeb8c94963a7dd2d58d2691a097980652928d300.json | Fix accented chars. Update jsm | examples/js/loaders/SVGLoader.js | @@ -665,13 +665,13 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
rx = Math.abs( rx );
ry = Math.abs( ry );
- // Compute (x1â², y1â²)
+ // Compute (x1', y1')
var dx2 = ( start.x - end.x ) / 2.0;
var dy2 = ( start.y - end.y ) / 2.0;
var x1p = Math.cos( x_axis_rotation ) * dx2 + Math.sin( x_axis_rotation ) * dy2;
var y1p = - Math.sin( x_axis_rotation ) * dx2 + Math.cos( x_axis_rotation ) * dy2;
- // Compute (cxâ², cyâ²)
+ // Compute (cx', cy')
var rxs = rx * rx;
var rys = ry * ry;
var x1ps = x1p * x1p; | true |
Other | mrdoob | three.js | eeb8c94963a7dd2d58d2691a097980652928d300.json | Fix accented chars. Update jsm | examples/jsm/loaders/SVGLoader.js | @@ -69,6 +69,8 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
var transform = getNodeTransform( node );
+ var traverseChildNodes = true;
+
var path = null;
switch ( node.nodeName ) {
@@ -119,6 +121,24 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
path = parseLineNode( node );
break;
+ case 'defs':
+ traverseChildNodes = false;
+ break;
+
+ case 'use':
+ style = parseStyle( node, style );
+ var usedNodeId = node.href.baseVal.substring( 1 );
+ var usedNode = node.viewportElement.getElementById( usedNodeId );
+ if ( usedNode ) {
+
+ parseNode( usedNode, style );
+
+ }
+ else console.warn( "SVGLoader: 'use node' references non-existent node id: " + usedNodeId );
+ break;
+
+ break;
+
default:
// console.log( node );
@@ -140,11 +160,15 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
}
- var nodes = node.childNodes;
+ if ( traverseChildNodes ) {
+
+ var nodes = node.childNodes;
- for ( var i = 0; i < nodes.length; i ++ ) {
+ for ( var i = 0; i < nodes.length; i ++ ) {
- parseNode( nodes[ i ], style );
+ parseNode( nodes[ i ], style );
+
+ }
}
@@ -651,13 +675,13 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
rx = Math.abs( rx );
ry = Math.abs( ry );
- // Compute (x1′, y1′)
+ // Compute (x1', y1')
var dx2 = ( start.x - end.x ) / 2.0;
var dy2 = ( start.y - end.y ) / 2.0;
var x1p = Math.cos( x_axis_rotation ) * dx2 + Math.sin( x_axis_rotation ) * dy2;
var y1p = - Math.sin( x_axis_rotation ) * dx2 + Math.cos( x_axis_rotation ) * dy2;
- // Compute (cx′, cy′)
+ // Compute (cx', cy')
var rxs = rx * rx;
var rys = ry * ry;
var x1ps = x1p * x1p;
@@ -684,11 +708,11 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
var cxp = q * rx * y1p / ry;
var cyp = - q * ry * x1p / rx;
- // Step 3: Compute (cx, cy) from (cx′, cy′)
+ // Step 3: Compute (cx, cy) from (cxâ², cyâ²)
var cx = Math.cos( x_axis_rotation ) * cxp - Math.sin( x_axis_rotation ) * cyp + ( start.x + end.x ) / 2;
var cy = Math.sin( x_axis_rotation ) * cxp + Math.cos( x_axis_rotation ) * cyp + ( start.y + end.y ) / 2;
- // Step 4: Compute θ1 and Δθ
+ // Step 4: Compute θ1 and Îθ
var theta = svgAngle( 1, 0, ( x1p - cxp ) / rx, ( y1p - cyp ) / ry );
var delta = svgAngle( ( x1p - cxp ) / rx, ( y1p - cyp ) / ry, ( - x1p - cxp ) / rx, ( - y1p - cyp ) / ry ) % ( Math.PI * 2 );
@@ -1079,7 +1103,7 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
function getNodeTransform( node ) {
- if ( ! node.hasAttribute( 'transform' ) ) {
+ if ( ! ( node.hasAttribute( 'transform' ) || ( node.nodeName === 'use' && ( node.hasAttribute( 'x' ) || node.hasAttribute( 'y' ) ) ) ) ) {
return null;
@@ -1104,142 +1128,156 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
var transform = new Matrix3();
var currentTransform = tempTransform0;
- var transformsTexts = node.getAttribute( 'transform' ).split( ')' );
- for ( var tIndex = transformsTexts.length - 1; tIndex >= 0; tIndex -- ) {
+ if ( node.nodeName === 'use' && ( node.hasAttribute( 'x' ) || node.hasAttribute( 'y' ) ) ) {
- var transformText = transformsTexts[ tIndex ].trim();
+ var tx = parseFloatWithUnits( node.getAttribute( 'x' ) );
+ var ty = parseFloatWithUnits( node.getAttribute( 'y' ) );
- if ( transformText === '' ) continue;
+ transform.translate( tx, ty );
- var openParPos = transformText.indexOf( '(' );
- var closeParPos = transformText.length;
+ }
- if ( openParPos > 0 && openParPos < closeParPos ) {
+ if ( node.hasAttribute( 'transform' ) ) {
- var transformType = transformText.substr( 0, openParPos );
+ var transformsTexts = node.getAttribute( 'transform' ).split( ')' );
- var array = parseFloats( transformText.substr( openParPos + 1, closeParPos - openParPos - 1 ) );
+ for ( var tIndex = transformsTexts.length - 1; tIndex >= 0; tIndex -- ) {
- currentTransform.identity();
+ var transformText = transformsTexts[ tIndex ].trim();
+
+ if ( transformText === '' ) continue;
+
+ var openParPos = transformText.indexOf( '(' );
+ var closeParPos = transformText.length;
+
+ if ( openParPos > 0 && openParPos < closeParPos ) {
- switch ( transformType ) {
+ var transformType = transformText.substr( 0, openParPos );
- case "translate":
+ var array = parseFloats( transformText.substr( openParPos + 1, closeParPos - openParPos - 1 ) );
- if ( array.length >= 1 ) {
+ currentTransform.identity();
- var tx = array[ 0 ];
- var ty = tx;
+ switch ( transformType ) {
- if ( array.length >= 2 ) {
+ case "translate":
- ty = array[ 1 ];
+ if ( array.length >= 1 ) {
+
+ var tx = array[ 0 ];
+ var ty = tx;
+
+ if ( array.length >= 2 ) {
+
+ ty = array[ 1 ];
+
+ }
+
+ currentTransform.translate( tx, ty );
}
- currentTransform.translate( tx, ty );
+ break;
- }
+ case "rotate":
- break;
+ if ( array.length >= 1 ) {
- case "rotate":
+ var angle = 0;
+ var cx = 0;
+ var cy = 0;
- if ( array.length >= 1 ) {
+ // Angle
+ angle = - array[ 0 ] * Math.PI / 180;
- var angle = 0;
- var cx = 0;
- var cy = 0;
+ if ( array.length >= 3 ) {
- // Angle
- angle = - array[ 0 ] * Math.PI / 180;
+ // Center x, y
+ cx = array[ 1 ];
+ cy = array[ 2 ];
- if ( array.length >= 3 ) {
+ }
- // Center x, y
- cx = array[ 1 ];
- cy = array[ 2 ];
+ // Rotate around center (cx, cy)
+ tempTransform1.identity().translate( - cx, - cy );
+ tempTransform2.identity().rotate( angle );
+ tempTransform3.multiplyMatrices( tempTransform2, tempTransform1 );
+ tempTransform1.identity().translate( cx, cy );
+ currentTransform.multiplyMatrices( tempTransform1, tempTransform3 );
}
- // Rotate around center (cx, cy)
- tempTransform1.identity().translate( - cx, - cy );
- tempTransform2.identity().rotate( angle );
- tempTransform3.multiplyMatrices( tempTransform2, tempTransform1 );
- tempTransform1.identity().translate( cx, cy );
- currentTransform.multiplyMatrices( tempTransform1, tempTransform3 );
+ break;
- }
+ case "scale":
- break;
+ if ( array.length >= 1 ) {
- case "scale":
+ var scaleX = array[ 0 ];
+ var scaleY = scaleX;
- if ( array.length >= 1 ) {
+ if ( array.length >= 2 ) {
- var scaleX = array[ 0 ];
- var scaleY = scaleX;
+ scaleY = array[ 1 ];
- if ( array.length >= 2 ) {
+ }
- scaleY = array[ 1 ];
+ currentTransform.scale( scaleX, scaleY );
}
- currentTransform.scale( scaleX, scaleY );
+ break;
- }
+ case "skewX":
- break;
+ if ( array.length === 1 ) {
- case "skewX":
+ currentTransform.set(
+ 1, Math.tan( array[ 0 ] * Math.PI / 180 ), 0,
+ 0, 1, 0,
+ 0, 0, 1
+ );
- if ( array.length === 1 ) {
-
- currentTransform.set(
- 1, Math.tan( array[ 0 ] * Math.PI / 180 ), 0,
- 0, 1, 0,
- 0, 0, 1
- );
+ }
- }
+ break;
- break;
+ case "skewY":
- case "skewY":
+ if ( array.length === 1 ) {
- if ( array.length === 1 ) {
+ currentTransform.set(
+ 1, 0, 0,
+ Math.tan( array[ 0 ] * Math.PI / 180 ), 1, 0,
+ 0, 0, 1
+ );
- currentTransform.set(
- 1, 0, 0,
- Math.tan( array[ 0 ] * Math.PI / 180 ), 1, 0,
- 0, 0, 1
- );
+ }
- }
+ break;
- break;
+ case "matrix":
- case "matrix":
+ if ( array.length === 6 ) {
- if ( array.length === 6 ) {
+ currentTransform.set(
+ array[ 0 ], array[ 2 ], array[ 4 ],
+ array[ 1 ], array[ 3 ], array[ 5 ],
+ 0, 0, 1
+ );
- currentTransform.set(
- array[ 0 ], array[ 2 ], array[ 4 ],
- array[ 1 ], array[ 3 ], array[ 5 ],
- 0, 0, 1
- );
+ }
- }
+ break;
- break;
+ }
}
- }
+ transform.premultiply( currentTransform );
- transform.premultiply( currentTransform );
+ }
}
| true |
Other | mrdoob | three.js | bfdf0c9590d239adf20bfb771f7bcddd1429f0bb.json | Fix == to === | examples/js/loaders/SVGLoader.js | @@ -1093,7 +1093,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
function getNodeTransform( node ) {
- if ( ! ( node.hasAttribute( 'transform' ) || ( node.nodeName == 'use' && ( node.hasAttribute( 'x' ) || node.hasAttribute( 'y' ) ) ) ) ) {
+ if ( ! ( node.hasAttribute( 'transform' ) || ( node.nodeName === 'use' && ( node.hasAttribute( 'x' ) || node.hasAttribute( 'y' ) ) ) ) ) {
return null;
@@ -1119,7 +1119,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
var transform = new Matrix3();
var currentTransform = tempTransform0;
- if ( node.nodeName == 'use' && ( node.hasAttribute( 'x' ) || node.hasAttribute( 'y' ) ) ) {
+ if ( node.nodeName === 'use' && ( node.hasAttribute( 'x' ) || node.hasAttribute( 'y' ) ) ) {
var tx = parseFloatWithUnits( node.getAttribute( 'x' ) );
var ty = parseFloatWithUnits( node.getAttribute( 'y' ) ); | false |
Other | mrdoob | three.js | 10ba26e9fa3b060b132c7e0c3cc17a4188e734d9.json | Implement defs and use nodes. First test. | examples/jsm/loaders/SVGLoader.js | @@ -69,6 +69,8 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
var transform = getNodeTransform( node );
+ var traverseChildNodes = true;
+
var path = null;
switch ( node.nodeName ) {
@@ -119,6 +121,17 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
path = parseLineNode( node );
break;
+ case 'defs':
+ traverseChildNodes = false;
+ break;
+
+ case 'use':
+ var usedNode = node.viewportElement.getElementById( node.href.baseVal.substring( 1 ) );
+ parseNode( usedNode, style );
+ break;
+
+ break;
+
default:
// console.log( node );
@@ -140,11 +153,15 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
}
- var nodes = node.childNodes;
+ if ( traverseChildNodes ) {
+
+ var nodes = node.childNodes;
- for ( var i = 0; i < nodes.length; i ++ ) {
+ for ( var i = 0; i < nodes.length; i ++ ) {
- parseNode( nodes[ i ], style );
+ parseNode( nodes[ i ], style );
+
+ }
}
@@ -1079,7 +1096,7 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
function getNodeTransform( node ) {
- if ( ! node.hasAttribute( 'transform' ) ) {
+ if ( ! ( node.hasAttribute( 'transform' ) || node.nodeName === 'use' ) ) {
return null;
@@ -1104,142 +1121,155 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
var transform = new Matrix3();
var currentTransform = tempTransform0;
- var transformsTexts = node.getAttribute( 'transform' ).split( ')' );
- for ( var tIndex = transformsTexts.length - 1; tIndex >= 0; tIndex -- ) {
+ if ( node.nodeName === 'use' ) {
+
+ var tx = parseFloatWithUnits( node.getAttribute( 'x' ) );
+ var ty = parseFloatWithUnits( node.getAttribute( 'y' ) );
- var transformText = transformsTexts[ tIndex ].trim();
+ transform.translate( tx, ty );
- if ( transformText === '' ) continue;
+ }
+ else {
- var openParPos = transformText.indexOf( '(' );
- var closeParPos = transformText.length;
+ var transformsTexts = node.getAttribute( 'transform' ).split( ')' );
- if ( openParPos > 0 && openParPos < closeParPos ) {
+ for ( var tIndex = transformsTexts.length - 1; tIndex >= 0; tIndex -- ) {
- var transformType = transformText.substr( 0, openParPos );
+ var transformText = transformsTexts[ tIndex ].trim();
- var array = parseFloats( transformText.substr( openParPos + 1, closeParPos - openParPos - 1 ) );
+ if ( transformText === '' ) continue;
- currentTransform.identity();
+ var openParPos = transformText.indexOf( '(' );
+ var closeParPos = transformText.length;
+
+ if ( openParPos > 0 && openParPos < closeParPos ) {
+
+ var transformType = transformText.substr( 0, openParPos );
+
+ var array = parseFloats( transformText.substr( openParPos + 1, closeParPos - openParPos - 1 ) );
- switch ( transformType ) {
+ currentTransform.identity();
- case "translate":
+ switch ( transformType ) {
- if ( array.length >= 1 ) {
+ case "translate":
- var tx = array[ 0 ];
- var ty = tx;
+ if ( array.length >= 1 ) {
- if ( array.length >= 2 ) {
+ var tx = array[ 0 ];
+ var ty = tx;
- ty = array[ 1 ];
+ if ( array.length >= 2 ) {
+
+ ty = array[ 1 ];
+
+ }
+
+ currentTransform.translate( tx, ty );
}
- currentTransform.translate( tx, ty );
+ break;
- }
+ case "rotate":
- break;
+ if ( array.length >= 1 ) {
- case "rotate":
+ var angle = 0;
+ var cx = 0;
+ var cy = 0;
- if ( array.length >= 1 ) {
+ // Angle
+ angle = - array[ 0 ] * Math.PI / 180;
- var angle = 0;
- var cx = 0;
- var cy = 0;
+ if ( array.length >= 3 ) {
- // Angle
- angle = - array[ 0 ] * Math.PI / 180;
+ // Center x, y
+ cx = array[ 1 ];
+ cy = array[ 2 ];
- if ( array.length >= 3 ) {
+ }
- // Center x, y
- cx = array[ 1 ];
- cy = array[ 2 ];
+ // Rotate around center (cx, cy)
+ tempTransform1.identity().translate( - cx, - cy );
+ tempTransform2.identity().rotate( angle );
+ tempTransform3.multiplyMatrices( tempTransform2, tempTransform1 );
+ tempTransform1.identity().translate( cx, cy );
+ currentTransform.multiplyMatrices( tempTransform1, tempTransform3 );
}
- // Rotate around center (cx, cy)
- tempTransform1.identity().translate( - cx, - cy );
- tempTransform2.identity().rotate( angle );
- tempTransform3.multiplyMatrices( tempTransform2, tempTransform1 );
- tempTransform1.identity().translate( cx, cy );
- currentTransform.multiplyMatrices( tempTransform1, tempTransform3 );
+ break;
- }
+ case "scale":
- break;
+ if ( array.length >= 1 ) {
- case "scale":
+ var scaleX = array[ 0 ];
+ var scaleY = scaleX;
- if ( array.length >= 1 ) {
+ if ( array.length >= 2 ) {
- var scaleX = array[ 0 ];
- var scaleY = scaleX;
+ scaleY = array[ 1 ];
- if ( array.length >= 2 ) {
+ }
- scaleY = array[ 1 ];
+ currentTransform.scale( scaleX, scaleY );
}
- currentTransform.scale( scaleX, scaleY );
+ break;
- }
-
- break;
+ case "skewX":
- case "skewX":
+ if ( array.length === 1 ) {
- if ( array.length === 1 ) {
+ currentTransform.set(
+ 1, Math.tan( array[ 0 ] * Math.PI / 180 ), 0,
+ 0, 1, 0,
+ 0, 0, 1
+ );
- currentTransform.set(
- 1, Math.tan( array[ 0 ] * Math.PI / 180 ), 0,
- 0, 1, 0,
- 0, 0, 1
- );
+ }
- }
+ break;
- break;
+ case "skewY":
- case "skewY":
+ if ( array.length === 1 ) {
- if ( array.length === 1 ) {
+ currentTransform.set(
+ 1, 0, 0,
+ Math.tan( array[ 0 ] * Math.PI / 180 ), 1, 0,
+ 0, 0, 1
+ );
- currentTransform.set(
- 1, 0, 0,
- Math.tan( array[ 0 ] * Math.PI / 180 ), 1, 0,
- 0, 0, 1
- );
+ }
- }
+ break;
- break;
+ case "matrix":
- case "matrix":
+ if ( array.length === 6 ) {
- if ( array.length === 6 ) {
+ currentTransform.set(
+ array[ 0 ], array[ 2 ], array[ 4 ],
+ array[ 1 ], array[ 3 ], array[ 5 ],
+ 0, 0, 1
+ );
- currentTransform.set(
- array[ 0 ], array[ 2 ], array[ 4 ],
- array[ 1 ], array[ 3 ], array[ 5 ],
- 0, 0, 1
- );
+ }
- }
+ break;
- break;
+ }
}
- }
+ transform.premultiply( currentTransform );
- transform.premultiply( currentTransform );
+ }
}
| false |
Other | mrdoob | three.js | a532b006a10b9efd47b76498eb17746bf0998945.json | remove redundant code | examples/jsm/loaders/3DMLoader.js | @@ -272,12 +272,6 @@ Rhino3dmLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
var _object = this._createObject( obj, material );
- if ( ! this.materials.includes( material ) ) {
-
- this.materials.push( material );
-
- }
-
if ( _object === undefined ) {
continue; | false |
Other | mrdoob | three.js | e9297a470c147b463e4e80a87e1471c1bd2ecad8.json | set AmbientLight.castshadow to `false`
set to `false` instead of `undefined` | src/lights/AmbientLight.js | @@ -6,7 +6,7 @@ function AmbientLight( color, intensity ) {
this.type = 'AmbientLight';
- this.castShadow = undefined;
+ this.castShadow = false;
}
| false |
Other | mrdoob | three.js | 8a308ca879a1074e421b80c1bfc32ae633d360f0.json | convert EdgesGeometry to use BufferGeometry | src/geometries/EdgesGeometry.js | @@ -1,7 +1,13 @@
import { BufferGeometry } from '../core/BufferGeometry.js';
import { Float32BufferAttribute } from '../core/BufferAttribute.js';
-import { Geometry } from '../core/Geometry.js';
import { MathUtils } from '../math/MathUtils.js';
+import { Triangle } from '../math/Triangle.js';
+import { Vector3 } from '../math/Vector3.js';
+
+const _v0 = new Vector3();
+const _v1 = new Vector3();
+const _normal = new Vector3();
+const _triangle = new Triangle();
class EdgesGeometry extends BufferGeometry {
@@ -17,94 +23,93 @@ class EdgesGeometry extends BufferGeometry {
thresholdAngle = ( thresholdAngle !== undefined ) ? thresholdAngle : 1;
- // buffer
+ const indexAttr = geometry.getIndex();
+ const positionAttr = geometry.getAttribute( 'position' );
+ const indexCount = indexAttr ? indexAttr.count : positionAttr.count / 3;
- const vertices = [];
+ const indexArr = [ 0, 0, 0 ];
+ const vertKeys = [ 'a', 'b', 'c' ];
- // helper variables
+ const edgeData = {};
+ const precisionPoints = 4;
+ const precision = Math.pow( 10, precisionPoints );
const thresholdDot = Math.cos( MathUtils.DEG2RAD * thresholdAngle );
- const edge = [ 0, 0 ], edges = {};
- let edge1, edge2, key;
- const keys = [ 'a', 'b', 'c' ];
+ const vertices = [];
+ for ( let i = 0; i < indexCount; i += 3 ) {
- // prepare source geometry
+ if ( indexAttr ) {
- let geometry2;
+ indexArr[ 0 ] = indexAttr.getX( i );
+ indexArr[ 1 ] = indexAttr.getX( i + 1 );
+ indexArr[ 2 ] = indexAttr.getX( i + 2 );
- if ( geometry.isBufferGeometry ) {
+ } else {
- geometry2 = new Geometry();
- geometry2.fromBufferGeometry( geometry );
+ indexArr[ 0 ] = i;
+ indexArr[ 1 ] = i + 1;
+ indexArr[ 2 ] = i + 2;
- } else {
+ }
- geometry2 = geometry.clone();
+ _triangle.a.fromBufferAttribute( positionAttr, indexArr[ 0 ] );
+ _triangle.b.fromBufferAttribute( positionAttr, indexArr[ 1 ] );
+ _triangle.c.fromBufferAttribute( positionAttr, indexArr[ 2 ] );
+ _triangle.getNormal( _normal );
- }
-
- geometry2.mergeVertices();
- geometry2.computeFaceNormals();
+ for ( let j = 0; j < 3; j ++ ) {
- const sourceVertices = geometry2.vertices;
- const faces = geometry2.faces;
+ const jNext = ( j + 1 ) % 3;
+ const v0 = _triangle[ vertKeys[ j ] ];
+ const v1 = _triangle[ vertKeys[ jNext ] ];
- // now create a data structure where each entry represents an edge with its adjoining faces
+ const vecHash0 = `${ Math.round( v0.x * precision ) },${ Math.round( v0.y * precision ) },${ Math.round( v0.y * precision ) }`;
+ const vecHash1 = `${ Math.round( v1.x * precision ) },${ Math.round( v1.y * precision ) },${ Math.round( v1.y * precision ) }`;
+ const hash = `${ vecHash0 }_${ vecHash1 }`;
+ const reverseHash = `${ vecHash1 }_${ vecHash0 }`;
- for ( let i = 0, l = faces.length; i < l; i ++ ) {
+ if ( reverseHash in edgeData ) {
- const face = faces[ i ];
+ if ( _normal.dot( edgeData[ reverseHash ].normal ) <= thresholdDot ) {
- for ( let j = 0; j < 3; j ++ ) {
+ vertices.push( v0.x, v0.y, v0.z );
+ vertices.push( v1.x, v1.y, v1.z );
- edge1 = face[ keys[ j ] ];
- edge2 = face[ keys[ ( j + 1 ) % 3 ] ];
- edge[ 0 ] = Math.min( edge1, edge2 );
- edge[ 1 ] = Math.max( edge1, edge2 );
+ }
- key = edge[ 0 ] + ',' + edge[ 1 ];
+ delete edgeData[ reverseHash ];
- if ( edges[ key ] === undefined ) {
+ } else {
- edges[ key ] = { index1: edge[ 0 ], index2: edge[ 1 ], face1: i, face2: undefined };
+ edgeData[ hash ] = {
- } else {
+ index0: indexArr[ j ],
+ index1: indexArr[ jNext ],
+ normal: _normal.clone(),
- edges[ key ].face2 = i;
+ };
}
}
}
- // generate vertices
-
- for ( key in edges ) {
-
- const e = edges[ key ];
-
- // an edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value. default = 1 degree.
-
- if ( e.face2 === undefined || faces[ e.face1 ].normal.dot( faces[ e.face2 ].normal ) <= thresholdDot ) {
+ for ( const key in edgeData ) {
- let vertex = sourceVertices[ e.index1 ];
- vertices.push( vertex.x, vertex.y, vertex.z );
+ const { index0, index1 } = edgeData[ key ];
+ _v0.fromBufferAttribute( positionAttr, index0 );
+ _v1.fromBufferAttribute( positionAttr, index1 );
- vertex = sourceVertices[ e.index2 ];
- vertices.push( vertex.x, vertex.y, vertex.z );
-
- }
+ vertices.push( _v0.x, _v0.y, _v0.z );
+ vertices.push( _v1.x, _v1.y, _v1.z );
}
- // build geometry
-
this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
}
}
-
export { EdgesGeometry }; | false |
Other | mrdoob | three.js | 0ebb935ab54f79f8a45e7e86e67e041654557b0b.json | remove line about array index notation | docs/api/en/materials/ShaderMaterial.html | @@ -54,9 +54,6 @@ <h1>[name]</h1>
<li>
The loop variable has to be *i*.
</li>
- <li>
- Array accesses within the loop must include spaces around the index: <b>array[ i ]</b>.
- </li>
<li>
The value *UNROLLED_LOOP_INDEX* will be replaced with the explicity value of *i* for the given iteration and can be used in preprocessor statements.
</li> | true |
Other | mrdoob | three.js | 0ebb935ab54f79f8a45e7e86e67e041654557b0b.json | remove line about array index notation | docs/api/zh/materials/ShaderMaterial.html | @@ -43,9 +43,6 @@ <h1>着色器材质([name])</h1>
<li>
循环变量必须是*i*。
</li>
- <li>
- Array accesses within the loop must include spaces around the index: <b>array[ i ]</b>.
- </li>
<li>
The value *UNROLLED_LOOP_INDEX* will be replaced with the explicity value of *i* for the given iteration and can be used in preprocessor statements.
</li> | true |
Other | mrdoob | three.js | aa9270b79956874c49ca7780bd6b92a6c8fab37a.json | update chinese docs | docs/api/zh/materials/ShaderMaterial.html | @@ -43,6 +43,12 @@ <h1>着色器材质([name])</h1>
<li>
循环变量必须是*i*。
</li>
+ <li>
+ Array accesses within the loop must include spaces around the index: <b>array[ i ]</b>.
+ </li>
+ <li>
+ The value *UNROLL_LOOP_INDEX* will be replaced with the explicity value of *i* for the given iteration and can be used in preprocessor statements.
+ </li>
</ul>
<code>
#pragma unroll_loop_start | false |
Other | mrdoob | three.js | 56146c57d9ec136339f9f83dbf66d059d07dfca3.json | Add instanceMatrix to shader documentation
This change documents some speed bumps I ran into while trying to write a shader for instanced objects. There are enough levels of indirection in reading ShaderChunks from source that figuring out how instanceMatrix is used there was too difficult for me.
Thankfully someone wrote [a medium article](https://medium.com/@pailhead011/instancing-with-three-js-36b4b62bc127) on the topic, but it took a lot of searching after bouncing off the official documentation.
As someone who has not done much work in shaders before, an explanation of what the instanceMatrix maps between and how it is typically consumed was also helpful, so I included that as well. | docs/api/en/renderers/webgl/WebGLProgram.html | @@ -92,6 +92,16 @@ <h3>Vertex shader (conditional):</h3>
attribute vec4 skinWeight;
#endif
</code>
+ <code>
+ #ifdef USE_INSTANCING
+ // Note that modelViewMatrix is not set when rendering an instanced model,
+ // but can be calculated from viewMatrix * modelMatrix.
+ //
+ // Basic Usage:
+ // gl_Position = projectionMatrix * viewMatrix * modelMatrix * instanceMatrix * vec4(position, 1.0);
+ attribute mat4 instanceMatrix;
+ #endif
+ </code>
</div>
<h3>Fragment shader:</h3> | false |
Other | mrdoob | three.js | a31539c59f4e26b89a8add347ecde70d3a527e86.json | Use setter function | examples/jsm/math/MeshSurfaceSampler.js | @@ -35,6 +35,7 @@ var MeshSurfaceSampler = ( function () {
}
this.geometry = geometry;
+ this.randomFunction = Math.random;
this.positionAttribute = this.geometry.getAttribute( 'position' );
this.weightAttribute = null;
@@ -104,17 +105,18 @@ var MeshSurfaceSampler = ( function () {
},
- getRandomNumber: function () {
+ setRandomFunction: function ( randomFunction ) {
- return Math.random();
+ this.randomFunction = randomFunction;
+ return this;
},
sample: function ( targetPosition, targetNormal ) {
var cumulativeTotal = this.distribution[ this.distribution.length - 1 ];
- var faceIndex = this.binarySearch( this.getRandomNumber() * cumulativeTotal );
+ var faceIndex = this.binarySearch( this.randomFunction() * cumulativeTotal );
return this.sampleFace( faceIndex, targetPosition, targetNormal );
@@ -156,8 +158,8 @@ var MeshSurfaceSampler = ( function () {
sampleFace: function ( faceIndex, targetPosition, targetNormal ) {
- var u = this.getRandomNumber();
- var v = this.getRandomNumber();
+ var u = this.randomFunction();
+ var v = this.randomFunction();
if ( u + v > 1 ) {
| false |
Other | mrdoob | three.js | 02bcf34c04c3f817b87e37602e0050375342523d.json | fix space error | src/animation/AnimationClip.d.ts | @@ -45,6 +45,6 @@ export class AnimationClip {
animation: any,
bones: Bone[]
): AnimationClip;
- static toJSON( json: any): any;
+ static toJSON( json: any ): any;
} | false |
Other | mrdoob | three.js | d8c856bae45c76b0efde8677f27a84925374b097.json | Adjust box material in instanced demo | examples/webgl_modifier_curve_instanced.html | @@ -51,7 +51,7 @@
camera.lookAt( scene.position );
const boxGeometry = new THREE.BoxBufferGeometry( 0.1, 0.1, 0.1 );
- const boxMaterial = new THREE.MeshBasicMaterial( 0x99ff99 );
+ const boxMaterial = new THREE.MeshBasicMaterial();
const curves = [[
{ x: 1, y: - 0.5, z: - 1 }, | false |
Other | mrdoob | three.js | 11597dc6e407129d66f843713061011d45200a76.json | Add missing vertex projection | examples/jsm/modifiers/CurveModifier.js | @@ -180,7 +180,13 @@ vec3 transformed = basis
+ spinePos;
vec3 transformedNormal = normalMatrix * (basis * objectNormal);
-`);
+`).replace(
+ '#include <project_vertex>',
+`
+vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );
+gl_Position = projectionMatrix * mvPosition;
+`
+);
shader.vertexShader = vertexShader;
| true |
Other | mrdoob | three.js | 11597dc6e407129d66f843713061011d45200a76.json | Add missing vertex projection | examples/webgl_modifier_curve.html | @@ -58,7 +58,7 @@
];
const boxGeometry = new THREE.BoxBufferGeometry( 0.1, 0.1, 0.1 );
- const boxMaterial = new THREE.MeshBasicMaterial( { color: 0x99ff99 } );
+ const boxMaterial = new THREE.MeshBasicMaterial();
for ( const handlePos of initialPoints ) {
@@ -116,7 +116,9 @@
geometry.rotateX( Math.PI );
- const material = new THREE.MeshNormalMaterial();
+ const material = new THREE.MeshStandardMaterial( {
+ color: 0x99ffff
+ } );
const objectToCurve = new THREE.Mesh( geometry, material );
| true |
Other | mrdoob | three.js | 6419e92e139861c0d8c1dc633003b226f96dd26a.json | assure a minimum pointCount of 2 | examples/jsm/loaders/3DMLoader.js | @@ -1303,7 +1303,7 @@ Rhino3dmLoader.Rhino3dmWorker = function () {
if ( curve instanceof rhino.ArcCurve ) {
pointCount = Math.floor( curve.angleDegrees / 5 );
- pointCount = pointCount < 1 ? 2 : pointCount;
+ pointCount = pointCount < 2 ? 2 : pointCount;
// alternative to this hardcoded version: https://stackoverflow.com/a/18499923/2179399
} | false |
Other | mrdoob | three.js | f6f8d939c351d31454068b7ac26a4b8cc2e350e9.json | remove displaced character | examples/jsm/loaders/3DMLoader.js | @@ -494,7 +494,7 @@ Rhino3dmLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
brepObject.userData[ 'attributes' ] = attributes;
brepObject.userData[ 'objectType' ] = obj.objectType;
-< if( attributes.name ) {
+ if( attributes.name ) {
brepObject.name = attributes.name;
}
| false |
Other | mrdoob | three.js | 77fc77918ca1507da0eb1f9956b624017cad851f.json | Read object name from .3dm file | examples/jsm/loaders/3DMLoader.js | @@ -442,6 +442,9 @@ Rhino3dmLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
var points = new Points( geometry, material );
points.userData[ 'attributes' ] = attributes;
points.userData[ 'objectType' ] = obj.objectType;
+ if( attributes.name ) {
+ points.name = attributes.name;
+ }
return points;
case 'Mesh':
@@ -468,6 +471,9 @@ Rhino3dmLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
mesh.receiveShadow = attributes.receivesShadows;
mesh.userData[ 'attributes' ] = attributes;
mesh.userData[ 'objectType' ] = obj.objectType;
+ if( attributes.name ) {
+ mesh.name = attributes.name;
+ }
return mesh;
@@ -488,6 +494,9 @@ Rhino3dmLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
brepObject.userData[ 'attributes' ] = attributes;
brepObject.userData[ 'objectType' ] = obj.objectType;
+< if( attributes.name ) {
+ brepObject.name = attributes.name;
+ }
return brepObject;
@@ -504,6 +513,9 @@ Rhino3dmLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
var lines = new Line( geometry, material );
lines.userData[ 'attributes' ] = attributes;
lines.userData[ 'objectType' ] = obj.objectType;
+ if( attributes.name ) {
+ lines.name = attributes.name;
+ }
return lines;
@@ -546,6 +558,9 @@ Rhino3dmLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
sprite.userData[ 'attributes' ] = attributes;
sprite.userData[ 'objectType' ] = obj.objectType;
+ if( attributes.name ) {
+ sprite.name = attributes.name;
+ }
return sprite;
| false |
Other | mrdoob | three.js | 75818b124dd31734d79bf2caf8c40f98af3d1216.json | remove vertical offset | examples/webgl_shadow_contact.html | @@ -137,7 +137,6 @@
} );
fillPlane = new THREE.Mesh( planeGeometry, fillPlaneMaterial );
fillPlane.rotateX( Math.PI );
- fillPlane.position.y -= 0.00001;
shadowGroup.add( fillPlane );
// the camera to render the depth material from | false |
Other | mrdoob | three.js | e4702c1b0f2bcab36ffcd3585ba3e77bbe3fce83.json | Add Color import | src/renderers/WebGLRenderer.js | @@ -38,6 +38,7 @@ import { WebGLUniforms } from './webgl/WebGLUniforms.js';
import { WebGLUtils } from './webgl/WebGLUtils.js';
import { WebXRManager } from './webxr/WebXRManager.js';
import { WebGLMaterials } from "./webgl/WebGLMaterials.js";
+import { Color } from '../math/Color.js';
function createCanvasElement() {
| false |
Other | mrdoob | three.js | e3b7148455ade60b594547478d1aff5a8ee1cf4a.json | update js examples | examples/js/postprocessing/ClearPass.js | @@ -6,6 +6,7 @@ THREE.ClearPass = function ( clearColor, clearAlpha ) {
this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000;
this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
+ this.oldClearColor = new THREE.Color();
};
@@ -15,11 +16,11 @@ THREE.ClearPass.prototype = Object.assign( Object.create( THREE.Pass.prototype )
render: function ( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
- var oldClearColor, oldClearAlpha;
+ var oldClearAlpha;
if ( this.clearColor ) {
- oldClearColor = renderer.getClearColor().getHex();
+ renderer.getClearColor( this.oldClearColor );
oldClearAlpha = renderer.getClearAlpha();
renderer.setClearColor( this.clearColor, this.clearAlpha );
@@ -31,7 +32,7 @@ THREE.ClearPass.prototype = Object.assign( Object.create( THREE.Pass.prototype )
if ( this.clearColor ) {
- renderer.setClearColor( oldClearColor, oldClearAlpha );
+ renderer.setClearColor( this.oldClearColor, oldClearAlpha );
}
| true |
Other | mrdoob | three.js | e3b7148455ade60b594547478d1aff5a8ee1cf4a.json | update js examples | examples/js/postprocessing/RenderPass.js | @@ -13,6 +13,7 @@ THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clear
this.clear = true;
this.clearDepth = false;
this.needsSwap = false;
+ this.oldClearColor = new THREE.Color();
};
@@ -25,7 +26,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
var oldAutoClear = renderer.autoClear;
renderer.autoClear = false;
- var oldClearColor, oldClearAlpha, oldOverrideMaterial;
+ var oldClearAlpha, oldOverrideMaterial;
if ( this.overrideMaterial !== undefined ) {
@@ -37,7 +38,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
if ( this.clearColor ) {
- oldClearColor = renderer.getClearColor().getHex();
+ renderer.getClearColor( this.oldClearColor );
oldClearAlpha = renderer.getClearAlpha();
renderer.setClearColor( this.clearColor, this.clearAlpha );
@@ -58,7 +59,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
if ( this.clearColor ) {
- renderer.setClearColor( oldClearColor, oldClearAlpha );
+ renderer.setClearColor( this.oldClearColor, oldClearAlpha );
}
| true |
Other | mrdoob | three.js | e3b7148455ade60b594547478d1aff5a8ee1cf4a.json | update js examples | examples/js/postprocessing/SSAARenderPass.js | @@ -21,6 +21,7 @@ THREE.SSAARenderPass = function ( scene, camera, clearColor, clearAlpha ) {
// as we need to clear the buffer in this pass, clearColor must be set to something, defaults to black.
this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000;
this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
+ this.oldClearColor = new THREE.Color();
if ( THREE.CopyShader === undefined ) console.error( "THREE.SSAARenderPass relies on THREE.CopyShader" );
@@ -77,7 +78,7 @@ THREE.SSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.protot
var autoClear = renderer.autoClear;
renderer.autoClear = false;
- var oldClearColor = renderer.getClearColor().getHex();
+ renderer.getClearColor( this.oldClearColor );
var oldClearAlpha = renderer.getClearAlpha();
var baseSampleWeight = 1.0 / jitterOffsets.length;
@@ -134,7 +135,7 @@ THREE.SSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.protot
if ( this.camera.clearViewOffset ) this.camera.clearViewOffset();
renderer.autoClear = autoClear;
- renderer.setClearColor( oldClearColor, oldClearAlpha );
+ renderer.setClearColor( this.oldClearColor, oldClearAlpha );
}
| true |
Other | mrdoob | three.js | 380067c434f2afcbce6a2f33e72b711039d2b955.json | Add target to getClearColor | src/renderers/WebGLRenderer.js | @@ -532,9 +532,17 @@ function WebGLRenderer( parameters ) {
// Clearing
- this.getClearColor = function () {
+ this.getClearColor = function ( target ) {
- return background.getClearColor();
+ if ( target === undefined ) {
+
+ console.warn( 'WebGLRenderer: .getClearColor() now requires a Color as an argument' );
+
+ target = new Color();
+
+ }
+
+ return target.copy( background.getClearColor() );
};
| false |
Other | mrdoob | three.js | 2a6c961acef8052ca2cd28ed601e672596aeecbd.json | Fix UASTC to BC7 target format selection | examples/jsm/loaders/KTX2Loader.js | @@ -467,7 +467,7 @@ class KTX2Container {
} else if ( config.bptcSupported && texFormat === TextureFormat.UASTC4x4 ) {
- targetFormat = hasAlpha ? TranscodeTarget.BC7_M5_RGBA : BC7_M6_RGB;
+ targetFormat = TranscodeTarget.BC7_M5_RGBA;
this.transcodedFormat = RGBA_BPTC_Format;
} else if ( config.dxtSupported ) { | false |
Other | mrdoob | three.js | db511ff51ad7d583b6f688779d7b67317cf8c1db.json | add LUT tag | examples/tags.json | @@ -86,6 +86,7 @@
"webgl_postprocessing_ssao": [ "ambient occlusion" ],
"webgl_postprocessing_unreal_bloom": [ "glow" ],
"webgl_postprocessing_unreal_bloom_selective": [ "glow" ],
+ "webgl_postprocessing_3dlut": [ "color grading" ],
"webgl_materials_modified": [ "onBeforeCompile" ],
"webgl_shadowmap_csm": [ "cascade" ],
"webgl_shadowmap_pcss": [ "soft" ], | false |
Other | mrdoob | three.js | 911722fa6eb9f2e503e8f564406adb9634bc4fc0.json | update node snippets | examples/jsm/renderers/webgpu/ShaderLib.js | @@ -30,12 +30,36 @@ const ShaderLib = {
layout(set = 0, binding = 3) uniform sampler mySampler;
layout(set = 0, binding = 4) uniform texture2D myTexture;
+ #ifdef NODE_UNIFORMS
+
+ layout(set = 0, binding = 5) uniform NodeUniforms {
+ NODE_UNIFORMS
+ } nodeUniforms;
+
+ #endif
+
layout(location = 0) in vec2 vUv;
layout(location = 0) out vec4 outColor;
void main() {
+
outColor = texture( sampler2D( myTexture, mySampler ), vUv );
+
+ #ifdef NODE_COLOR
+
+ /* NODE_COLOR_CODE ignore (node code group) for now */
+ outColor.rgb *= NODE_COLOR;
+
+ #endif
+
+ #ifdef NODE_OPACITY
+
+ outColor.a *= NODE_OPACITY;
+
+ #endif
+
outColor.a *= opacityUniforms.opacity;
+
}`
},
pointsBasic: {
@@ -60,8 +84,30 @@ const ShaderLib = {
layout(location = 0) out vec4 outColor;
+ #ifdef NODE_UNIFORMS
+
+ layout(set = 0, binding = 2) uniform NodeUniforms {
+ NODE_UNIFORMS
+ } nodeUniforms;
+
+ #endif
+
void main() {
+
outColor = vec4( 1.0, 0.0, 0.0, 1.0 );
+
+ #ifdef NODE_COLOR
+
+ outColor.rgb = NODE_COLOR;
+
+ #endif
+
+ #ifdef NODE_OPACITY
+
+ outColor.a *= NODE_OPACITY;
+
+ #endif
+
}`
},
lineBasic: { | false |
Other | mrdoob | three.js | 60defe3864a5bb62858b9f6bc7745b1697abb118.json | Remove manual render state setting
Nested render calls now automatically restore the correct render state from the stack.
getRenderState/setRenderState are not part of the public API so they can be safely removed from WebGLRenderer. | src/renderers/WebGLRenderer.js | @@ -1768,18 +1768,6 @@ function WebGLRenderer( parameters ) {
};
- this.getRenderState = function () {
-
- return currentRenderState;
-
- };
-
- this.setRenderState = function ( renderState ) {
-
- currentRenderState = renderState;
-
- };
-
this.getRenderTarget = function () {
return _currentRenderTarget; | true |
Other | mrdoob | three.js | 60defe3864a5bb62858b9f6bc7745b1697abb118.json | Remove manual render state setting
Nested render calls now automatically restore the correct render state from the stack.
getRenderState/setRenderState are not part of the public API so they can be safely removed from WebGLRenderer. | src/renderers/webgl/WebGLCubeMaps.js | @@ -42,15 +42,13 @@ function WebGLCubeMaps( renderer ) {
const currentRenderList = renderer.getRenderList();
const currentRenderTarget = renderer.getRenderTarget();
- const currentRenderState = renderer.getRenderState();
const renderTarget = new WebGLCubeRenderTarget( image.height / 2 );
renderTarget.fromEquirectangularTexture( renderer, texture );
cubemaps.set( texture, renderTarget );
renderer.setRenderTarget( currentRenderTarget );
renderer.setRenderList( currentRenderList );
- renderer.setRenderState( currentRenderState );
texture.addEventListener( 'dispose', onTextureDispose );
| true |
Other | mrdoob | three.js | 8ef5d5fcf91edba4c48e1d9f29f4649d145018e7.json | Remove regenerator-runtime (#21448)
* Remove regenerator-runtime
* Remove unnecessary nodeResolve as well | package-lock.json | @@ -18,7 +18,6 @@
"eslint": "^7.21.0",
"eslint-config-mdcs": "^5.0.0",
"eslint-plugin-html": "^6.1.1",
- "regenerator-runtime": "^0.13.7",
"rollup": "^2.40.0",
"rollup-plugin-filesize": "^9.1.1",
"rollup-plugin-terser": "^7.0.2", | true |
Other | mrdoob | three.js | 8ef5d5fcf91edba4c48e1d9f29f4649d145018e7.json | Remove regenerator-runtime (#21448)
* Remove regenerator-runtime
* Remove unnecessary nodeResolve as well | package.json | @@ -93,7 +93,6 @@
"eslint": "^7.21.0",
"eslint-config-mdcs": "^5.0.0",
"eslint-plugin-html": "^6.1.1",
- "regenerator-runtime": "^0.13.7",
"rollup": "^2.40.0",
"rollup-plugin-filesize": "^9.1.1",
"rollup-plugin-terser": "^7.0.2", | true |
Other | mrdoob | three.js | 8ef5d5fcf91edba4c48e1d9f29f4649d145018e7.json | Remove regenerator-runtime (#21448)
* Remove regenerator-runtime
* Remove unnecessary nodeResolve as well | utils/build/rollup.config.js | @@ -1,5 +1,4 @@
import babel from '@rollup/plugin-babel';
-import { nodeResolve } from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
function glconstants() {
@@ -272,29 +271,6 @@ ${ code }`;
}
-function polyfills() {
-
- return {
-
- transform( code, filePath ) {
-
- if ( filePath.endsWith( 'src/Three.js' ) || filePath.endsWith( 'src\\Three.js' ) ) {
-
- code = 'import \'regenerator-runtime\';\n' + code;
-
- }
-
- return {
- code: code,
- map: null
- };
-
- }
-
- };
-
-}
-
const babelrc = {
presets: [
[
@@ -313,8 +289,6 @@ export default [
{
input: 'src/Three.js',
plugins: [
- polyfills(),
- nodeResolve(),
addons(),
glconstants(),
glsl(),
@@ -339,8 +313,6 @@ export default [
{
input: 'src/Three.js',
plugins: [
- polyfills(),
- nodeResolve(),
addons(),
glconstants(),
glsl(), | true |
Other | mrdoob | three.js | 976404aa285c092cdf5dd3d2bd282b4d9b3be94a.json | Fix resize issue in OutlinePass (#21436) | examples/js/postprocessing/OutlinePass.js | @@ -134,6 +134,7 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype
setSize: function ( width, height ) {
this.renderTargetMaskBuffer.setSize( width, height );
+ this.renderTargetDepthBuffer.setSize( width, height );
var resx = Math.round( width / this.downSampleRatio );
var resy = Math.round( height / this.downSampleRatio ); | true |
Other | mrdoob | three.js | 976404aa285c092cdf5dd3d2bd282b4d9b3be94a.json | Fix resize issue in OutlinePass (#21436) | examples/jsm/postprocessing/OutlinePass.js | @@ -154,6 +154,7 @@ OutlinePass.prototype = Object.assign( Object.create( Pass.prototype ), {
setSize: function ( width, height ) {
this.renderTargetMaskBuffer.setSize( width, height );
+ this.renderTargetDepthBuffer.setSize( width, height );
var resx = Math.round( width / this.downSampleRatio );
var resy = Math.round( height / this.downSampleRatio ); | true |
Other | mrdoob | three.js | 6f86fda4d312996e3f4281ceccc02f0419e55c0d.json | Fix MMDAnimationHelper lint errors (#21398) | examples/js/animation/MMDAnimationHelper.js | @@ -220,7 +220,7 @@ THREE.MMDAnimationHelper = ( function () {
mesh.updateMatrixWorld( true );
// PMX animation system special path
- if ( this.configuration.pmxAnimation &&
+ if ( this.configuration.pmxAnimation &&
mesh.geometry.userData.MMD && mesh.geometry.userData.MMD.format === 'pmx' ) {
var sortedBonesData = this._sortBoneDataArray( mesh.geometry.userData.MMD.bones.slice() );
@@ -660,7 +660,7 @@ THREE.MMDAnimationHelper = ( function () {
grantResultMap.set( boneIndex, quaternion.copy( bone.quaternion ) );
// @TODO: Support global grant and grant position
- if ( grantSolver && boneData.grant &&
+ if ( grantSolver && boneData.grant &&
! boneData.grant.isLocal && boneData.grant.affectRotation ) {
var parentIndex = boneData.grant.parentIndex;
@@ -679,7 +679,7 @@ THREE.MMDAnimationHelper = ( function () {
if ( ikSolver && boneData.ik ) {
// @TODO: Updating world matrices every time solving an IK bone is
- // costly. Optimize if possible.
+ // costly. Optimize if possible.
mesh.updateMatrixWorld( true );
ikSolver.updateOne( boneData.ik );
@@ -1209,7 +1209,7 @@ THREE.MMDAnimationHelper = ( function () {
addGrantRotation: function () {
- var quaternion = new Quaternion();
+ var quaternion = new THREE.Quaternion();
return function ( bone, q, ratio ) {
| true |
Other | mrdoob | three.js | 6f86fda4d312996e3f4281ceccc02f0419e55c0d.json | Fix MMDAnimationHelper lint errors (#21398) | examples/jsm/animation/MMDAnimationHelper.js | @@ -229,7 +229,7 @@ var MMDAnimationHelper = ( function () {
mesh.updateMatrixWorld( true );
// PMX animation system special path
- if ( this.configuration.pmxAnimation &&
+ if ( this.configuration.pmxAnimation &&
mesh.geometry.userData.MMD && mesh.geometry.userData.MMD.format === 'pmx' ) {
var sortedBonesData = this._sortBoneDataArray( mesh.geometry.userData.MMD.bones.slice() );
@@ -669,7 +669,7 @@ var MMDAnimationHelper = ( function () {
grantResultMap.set( boneIndex, quaternion.copy( bone.quaternion ) );
// @TODO: Support global grant and grant position
- if ( grantSolver && boneData.grant &&
+ if ( grantSolver && boneData.grant &&
! boneData.grant.isLocal && boneData.grant.affectRotation ) {
var parentIndex = boneData.grant.parentIndex;
@@ -688,7 +688,7 @@ var MMDAnimationHelper = ( function () {
if ( ikSolver && boneData.ik ) {
// @TODO: Updating world matrices every time solving an IK bone is
- // costly. Optimize if possible.
+ // costly. Optimize if possible.
mesh.updateMatrixWorld( true );
ikSolver.updateOne( boneData.ik );
| true |
Other | mrdoob | three.js | fa43b759e76cc81aeebbe6e9e7df743e50773c1f.json | use DataTextureLoader and custom onLoad | examples/js/loaders/TGALoader.js | @@ -1,43 +1,28 @@
THREE.TGALoader = function ( manager ) {
- THREE.Loader.call( this, manager );
+ THREE.DataTextureLoader.call( this, manager );
};
-THREE.TGALoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
+THREE.TGALoader.prototype = Object.assign( Object.create( THREE.DataTextureLoader.prototype ), {
constructor: THREE.TGALoader,
load: function ( url, onLoad, onProgress, onError ) {
- var scope = this;
+ function onDataTextureLoad( texture, texData ) {
- var texture = new THREE.DataTexture();
- texture.flipY = true;
- texture.generateMipmaps = true;
- texture.unpackAlignment = 4;
- texture.magFilter = THREE.LinearFilter;
- texture.minFilter = THREE.LinearMipmapLinearFilter;
+ texture.flipY = true;
+ texture.generateMipmaps = true;
+ texture.unpackAlignment = 4;
+ texture.magFilter = THREE.LinearFilter;
+ texture.minFilter = THREE.LinearMipmapLinearFilter;
- var loader = new THREE.FileLoader( this.manager );
- loader.setResponseType( 'arraybuffer' );
- loader.setPath( this.path );
- loader.setWithCredentials( this.withCredentials );
+ if ( onLoad ) onLoad( texture, texData );
- loader.load( url, function ( buffer ) {
-
- texture.image = scope.parse( buffer );
- texture.needsUpdate = true;
-
- if ( onLoad !== undefined ) {
-
- onLoad( texture );
-
- }
-
- }, onProgress, onError );
+ }
- return texture;
+ return THREE.DataTextureLoader.prototype.load.call( this, url, onDataTextureLoad, onProgress, onError );
},
| true |
Other | mrdoob | three.js | fa43b759e76cc81aeebbe6e9e7df743e50773c1f.json | use DataTextureLoader and custom onLoad | examples/jsm/loaders/TGALoader.js | @@ -1,51 +1,34 @@
import {
- DataTexture,
- FileLoader,
+ DataTextureLoader,
LinearFilter,
- LinearMipmapLinearFilter,
- Loader
+ LinearMipmapLinearFilter
} from '../../../build/three.module.js';
var TGALoader = function ( manager ) {
- Loader.call( this, manager );
+ DataTextureLoader.call( this, manager );
};
-TGALoader.prototype = Object.assign( Object.create( Loader.prototype ), {
+TGALoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype ), {
constructor: TGALoader,
load: function ( url, onLoad, onProgress, onError ) {
- var scope = this;
+ function onDataTextureLoad( texture, texData ) {
- var texture = new DataTexture();
- texture.flipY = true;
- texture.generateMipmaps = true;
- texture.unpackAlignment = 4;
- texture.minFilter = LinearMipmapLinearFilter;
- texture.magFilter = LinearFilter;
+ texture.flipY = true;
+ texture.generateMipmaps = true;
+ texture.unpackAlignment = 4;
+ texture.magFilter = LinearFilter;
+ texture.minFilter = LinearMipmapLinearFilter;
- var loader = new FileLoader( this.manager );
- loader.setResponseType( 'arraybuffer' );
- loader.setPath( this.path );
- loader.setWithCredentials( this.withCredentials );
+ if ( onLoad ) onLoad( texture, texData );
- loader.load( url, function ( buffer ) {
-
- texture.image = scope.parse( buffer );
- texture.needsUpdate = true;
-
- if ( onLoad !== undefined ) {
-
- onLoad( texture );
-
- }
-
- }, onProgress, onError );
+ }
- return texture;
+ return DataTextureLoader.prototype.load.call( this, url, onDataTextureLoad, onProgress, onError );
},
| true |
Other | mrdoob | three.js | 16ffe39a867ee15723a7ffb2c97e773f3920cd29.json | use modularize.js to generate jsm | examples/js/loaders/TGALoader.js | @@ -1,41 +1,13 @@
THREE.TGALoader = function ( manager ) {
- THREE.Loader.call( this, manager );
+ THREE.DataTextureLoader.call( this, manager );
};
-THREE.TGALoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
+THREE.TGALoader.prototype = Object.assign( Object.create( THREE.DataTextureLoader.prototype ), {
constructor: THREE.TGALoader,
- load: function ( url, onLoad, onProgress, onError ) {
-
- var scope = this;
-
- var texture = new THREE.Texture();
-
- var loader = new THREE.FileLoader( this.manager );
- loader.setResponseType( 'arraybuffer' );
- loader.setPath( this.path );
- loader.setWithCredentials( this.withCredentials );
-
- loader.load( url, function ( buffer ) {
-
- texture.image = scope.parse( buffer );
- texture.needsUpdate = true;
-
- if ( onLoad !== undefined ) {
-
- onLoad( texture );
-
- }
-
- }, onProgress, onError );
-
- return texture;
-
- },
-
parse: function ( buffer ) {
// reference from vthibault, https://github.com/vthibault/roBrowser/blob/master/src/Loaders/Targa.js
@@ -521,21 +493,17 @@ THREE.TGALoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
//
- var useOffscreen = typeof OffscreenCanvas !== 'undefined';
-
- var canvas = useOffscreen ? new OffscreenCanvas( header.width, header.height ) : document.createElement( 'canvas' );
- canvas.width = header.width;
- canvas.height = header.height;
-
- var context = canvas.getContext( '2d' );
- var imageData = context.createImageData( header.width, header.height );
-
+ var imageData = new Uint8Array( header.width * header.height * 4 );
var result = tgaParse( use_rle, use_pal, header, offset, content );
- getTgaRGBA( imageData.data, header.width, header.height, result.pixel_data, result.palettes );
+ getTgaRGBA( imageData, header.width, header.height, result.pixel_data, result.palettes );
+
+ return {
- context.putImageData( imageData, 0, 0 );
+ data: imageData,
+ width: header.width,
+ height: header.height,
- return canvas;
+ };
}
| true |
Other | mrdoob | three.js | 16ffe39a867ee15723a7ffb2c97e773f3920cd29.json | use modularize.js to generate jsm | examples/jsm/loaders/TGALoader.js | @@ -1,5 +1,5 @@
import {
- DataTextureLoader,
+ DataTextureLoader
} from '../../../build/three.module.js';
var TGALoader = function ( manager ) { | true |
Other | mrdoob | three.js | f1048891d978beb69b81a34c604641cf4caa2f47.json | translate curve.html to chinese (#22599) | docs/api/zh/extras/core/Curve.html | @@ -10,111 +10,102 @@
<h1>[name]</h1>
<p class="desc">
- An abstract base class for creating a [name] object that contains methods for interpolation.
- For an array of [name]s see [page:CurvePath].
+ 用于创建包含插值方法的[name]对象的抽象基类。
+ 有关[name]的数组,请参见[page:CurvePath]。
</p>
<h2>Constructor</h2>
<h3>[name]()</h3>
<p>
- This constructor creates a new [name].
+ 创建一个 [name].
</p>
- <h2>Properties</h2>
+ <h2>属性</h2>
<h3>[property:Integer arcLengthDivisions]</h3>
- <p>This value determines the amount of divisions when calculating the cumulative segment lengths of a curve via [page:.getLengths].
- To ensure precision when using methods like [page:.getSpacedPoints], it is recommended to increase [page:.arcLengthDivisions] if the curve is very large. Default is 200.</p>
+ <p>确定[page:.GetLength]计算曲线的累积分段长度时的分段量。
+ 为确保[page:.getSpacedPoints]等方法时的精度,如果曲线非常大,建议增加[page:.arcLengthDivisions]。默认值为200</p>
- <h2>Methods</h2>
+ <h2>方法</h2>
<h3>[method:Vector getPoint]( [param:Float t], [param:Vector optionalTarget] )</h3>
<p>
- [page:Float t] - A position on the curve. Must be in the range [ 0, 1 ]. <br>
- [page:Vector optionalTarget] — (optional) If specified, the result will be copied into this Vector,
- otherwise a new Vector will be created. <br /><br />
+ [page:Float t] - 曲线上的位置。必须在[0,1]范围内 <br>
+ [page:Vector optionalTarget] — (可选) 如果需要, 结果将复制到此向量中,否则将创建一个新向量。 <br /><br />
- Returns a vector for a given position on the curve.
+ 返回曲线上给定位置的点。
</p>
<h3>[method:Vector getPointAt]( [param:Float u], [param:Vector optionalTarget] )</h3>
<p>
- [page:Float u] - A position on the curve according to the arc length. Must be in the range [ 0, 1 ]. <br>
- [page:Vector optionalTarget] — (optional) If specified, the result will be copied into this Vector,
- otherwise a new Vector will be created. <br /><br />
+ [page:Float u] - 根据弧长在曲线上的位置。必须在范围[0,1]内。 <br>
+ [page:Vector optionalTarget] — (可选) 如果需要, (可选) 如果需要, 结果将复制到此向量中,否则将创建一个新向量。 <br /><br />
- Returns a vector for a given position on the curve according to the arc length.
+ 根据弧长返回曲线上给定位置的点。
</p>
<h3>[method:Array getPoints]( [param:Integer divisions] )</h3>
<p>
- divisions -- number of pieces to divide the curve into. Default is *5*.<br /><br />
-
- Returns a set of divisions + 1 points using getPoint( t ).
+ divisions -- 要将曲线划分为的分段数。默认是 *5*.<br /><br />
+ 使用getPoint(t)返回一组divisions+1的点
</p>
<h3>[method:Array getSpacedPoints]( [param:Integer divisions] )</h3>
<p>
- divisions -- number of pieces to divide the curve into. Default is *5*.<br /><br />
+ divisions -- 要将曲线划分为的分段数。默认是 *5*.<br /><br />
- Returns a set of divisions + 1 equi-spaced points using getPointAt( u ).
+ 使用getPointAt(u)返回一个分段+1的等距点的数组。
</p>
<h3>[method:Float getLength]()</h3>
- <p>Get total curve arc length.</p>
+ <p>获取总曲线弧长。</p>
<h3>[method:Array getLengths]( [param:Integer divisions] )</h3>
- <p>Get list of cumulative segment lengths.</p>
+ <p>获取累积段长度的列表。</p>
<h3>[method:null updateArcLengths]()</h3>
- <p>Update the cumlative segment distance cache.</p>
+ <p>更新累积段距离缓存。</p>
<h3>[method:Float getUtoTmapping]( [param:Float u], [param:Float distance] )</h3>
<p>
- Given u in the range ( 0 .. 1 ), returns [page:Float t] also in the range ( 0 .. 1 ).
- u and t can then be used to give you points which are equidistant from the ends of the curve,
- using [page:.getPoint].
+ 给定范围(0..1)内的u,返回范围(0..1)内的[page:Float t],
+ 然后可以用t来使用 [page:.getPoint]给出与曲线末端等距的点。
</p>
<h3>[method:Vector getTangent]( [param:Float t], [param:Vector optionalTarget] )</h3>
<p>
- [page:Float t] - A position on the curve. Must be in the range [ 0, 1 ]. <br>
- [page:Vector optionalTarget] — (optional) If specified, the result will be copied into this Vector,
- otherwise a new Vector will be created. <br /><br />
+ [page:Float t] -在曲线上的点,必须在范围 [ 0, 1 ]. <br>
+ [page:Vector optionalTarget] — (可选) 如果需要, (可选) 如果需要, 结果将复制到此向量中,否则将创建一个新向量。 <br /><br />
- Returns a unit vector tangent at t. If the derived curve does not implement its
- tangent derivation, two points a small delta apart will be used to find its gradient
- which seems to give a reasonable approximation.
+ 返回t处的单位向量切线。如果派生曲线未实现其
+ 切线求导,将使用相距一个小三角形的两个点来求与其实际梯度的近似值
</p>
<h3>[method:Vector getTangentAt]( [param:Float u], [param:Vector optionalTarget] )</h3>
<p>
- [page:Float u] - A position on the curve according to the arc length. Must be in the range [ 0, 1 ]. <br>
- [page:Vector optionalTarget] — (optional) If specified, the result will be copied into this Vector,
- otherwise a new Vector will be created. <br /><br />
-
- Returns tangent at a point which is equidistant to the ends of the curve from the
- point given in [page:.getTangent].
+ [page:Float u] - 根据弧长在曲线上的位置,必须在范围[ 0, 1 ]。 <br>
+ [page:Vector optionalTarget] —(可选) 如果需要, (可选) 如果需要, 结果将复制到此向量中,否则将创建一个新向量。 <br /><br />
+ 返回一个点处的切线,该点与 [page:.getTangent]中给定的曲线的端点距离相等
</p>
<h3>[method:Object computeFrenetFrames]( [param:Integer segments], [param:Boolean closed] )</h3>
<p>
- Generates the Frenet Frames. Requires a curve definition in 3D space. Used in geometries like [page:TubeGeometry] or [page:ExtrudeGeometry].
+ 生成Frenet帧。需要三维空间中的曲线定义。用于[page:TubeGeometry]或[page:ExtradeGeometry]等几何图形。
</p>
<h3>[method:Curve clone]()</h3>
- <p>Creates a clone of this instance.</p>
+ <p>创建此实例的克隆。</p>
<h3>[method:Curve copy]( [param:Curve source] )</h3>
- <p>Copies another [name] object to this instance.</p>
+ <p>将另一个[name]对象复制到此实例。</p>
<h3>[method:Object toJSON]()</h3>
- <p>Returns a JSON object representation of this instance.</p>
+ <p>返回此实例的JSON对象表示形式。</p>
<h3>[method:Curve fromJSON]( [param:Object json] )</h3>
- <p>Copies the data from the given JSON object to this instance.</p>
+ <p>将给定的JSON数据复制到此实例。</p>
<h2>Source</h2>
| false |
Other | mrdoob | three.js | 7de6e2976bf4fb5ab2c7f172d6aa65fa0f52353e.json | Restore missing fill-rule (#22511) (#22597) | examples/jsm/loaders/SVGLoader.js | @@ -1007,6 +1007,7 @@ class SVGLoader extends Loader {
addStyle( 'fill', 'fill' );
addStyle( 'fill-opacity', 'fillOpacity', clamp );
+ addStyle( 'fill-rule', 'fillRule' );
addStyle( 'opacity', 'opacity', clamp );
addStyle( 'stroke', 'stroke' );
addStyle( 'stroke-opacity', 'strokeOpacity', clamp ); | false |
Other | mrdoob | three.js | 78a12767f0223cf429df04099353b7c0437915c0.json | fix rgb output | examples/jsm/exporters/USDZExporter.js | @@ -381,7 +381,7 @@ function buildMaterial( material, textures ) {
float outputs:g
float outputs:b
float outputs:a
- float3 outputs:rgba
+ float3 outputs:rgb
}`;
} | false |
Other | mrdoob | three.js | 5b654654adc27595f917c07066cb4d5cfbd9de21.json | add CheckerNode (#22592) | examples/jsm/renderers/nodes/Nodes.js | @@ -68,6 +68,9 @@ import SplitNode from './utils/SplitNode.js';
import SpriteSheetUVNode from './utils/SpriteSheetUVNode.js';
import TimerNode from './utils/TimerNode.js';
+// procedural
+import CheckerNode from './procedural/CheckerNode.js';
+
// core
export * from './core/constants.js';
@@ -151,6 +154,9 @@ export {
JoinNode,
SplitNode,
SpriteSheetUVNode,
- TimerNode
+ TimerNode,
+
+ // procedural
+ CheckerNode
};
| true |
Other | mrdoob | three.js | 5b654654adc27595f917c07066cb4d5cfbd9de21.json | add CheckerNode (#22592) | examples/jsm/renderers/nodes/procedural/CheckerNode.js | @@ -0,0 +1,36 @@
+import FunctionNode from '../core/FunctionNode.js';
+import Node from '../core/Node.js';
+import UVNode from '../accessors/UVNode.js';
+
+const checker = new FunctionNode( `
+float ( vec2 uv ) {
+
+ uv *= 2.0;
+
+ float cx = floor( uv.x );
+ float cy = floor( uv.y );
+ float result = mod( cx + cy, 2.0 );
+
+ return sign( result );
+
+}` );
+
+class CheckerNode extends Node {
+
+ constructor( uv = new UVNode() ) {
+
+ super( 'float' );
+
+ this.uv = uv;
+
+ }
+
+ generate( builder, output ) {
+
+ return checker.call( { uv: this.uv } ).build( builder, output );
+
+ }
+
+}
+
+export default CheckerNode; | true |
Other | mrdoob | three.js | 061ac286ba1f92bc01ff95a4f6f99edc95ff5c8a.json | Update USDZExporter.js (#22591) | examples/jsm/exporters/USDZExporter.js | @@ -380,7 +380,8 @@ function buildMaterial( material, textures ) {
float outputs:r
float outputs:g
float outputs:b
- float3 outputs:rgb
+ float outputs:a
+ float3 outputs:rgba
}`;
}
@@ -449,7 +450,23 @@ function buildMaterial( material, textures ) {
}
- inputs.push( `${ pad }float inputs:opacity = ${ material.opacity }` );
+ if ( material.alphaMap !== null ) {
+
+ inputs.push( `${pad}float inputs:opacity.connect = </Materials/Material_${material.id}/Texture_${material.alphaMap.id}_opacity.outputs:r>` );
+ inputs.push( `${pad}float inputs:opacityThreshold = 0.0001` );
+
+ samplers.push( buildTexture( material.alphaMap, 'opacity' ) );
+
+ } else if ( material.map !== null && material.map.format === 1023 ) {
+
+ inputs.push( `${pad}float inputs:opacity.connect = </Materials/Material_${material.id}/Texture_${material.map.id}_diffuse.outputs:a>` );
+ inputs.push( `${pad}float inputs:opacityThreshold = 0.0001` );
+
+ } else {
+
+ inputs.push( `${pad}float inputs:opacity = ${material.opacity}` );
+
+ }
if ( material.isMeshPhysicalMaterial ) {
| false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.