three-stdlib 2.8.7 → 2.8.10
Sign up to get free protection for your applications and to get access to all the features.
- package/Nodes-607e9ed8.js +471 -0
- package/Nodes-627a8bdf.js +1 -0
- package/index.cjs.js +1 -1
- package/index.d.ts +0 -75
- package/index.js +70 -76
- package/loaders/NodeMaterialLoader.cjs.js +1 -1
- package/loaders/NodeMaterialLoader.js +2 -136
- package/loaders/RGBELoader.cjs.js +1 -1
- package/loaders/RGBELoader.js +3 -3
- package/loaders/RGBMLoader.cjs.js +1 -1
- package/loaders/RGBMLoader.js +190 -268
- package/nodes/Nodes.cjs.js +1 -1
- package/nodes/Nodes.js +203 -76
- package/nodes/ShaderNode.cjs.js +1 -0
- package/nodes/ShaderNode.js +308 -0
- package/nodes/accessors/BufferNode.cjs.js +1 -0
- package/nodes/accessors/BufferNode.js +18 -0
- package/nodes/accessors/CameraNode.cjs.js +1 -1
- package/nodes/accessors/CameraNode.js +32 -138
- package/nodes/accessors/CubeTextureNode.cjs.js +1 -0
- package/nodes/accessors/CubeTextureNode.js +53 -0
- package/nodes/accessors/MaterialNode.cjs.js +1 -0
- package/nodes/accessors/MaterialNode.js +80 -0
- package/nodes/accessors/MaterialReferenceNode.cjs.js +1 -0
- package/nodes/accessors/MaterialReferenceNode.js +16 -0
- package/nodes/accessors/ModelNode.cjs.js +1 -0
- package/nodes/accessors/ModelNode.js +10 -0
- package/nodes/accessors/ModelViewProjectionNode.cjs.js +1 -0
- package/nodes/accessors/ModelViewProjectionNode.js +22 -0
- package/nodes/accessors/NormalNode.cjs.js +1 -1
- package/nodes/accessors/NormalNode.js +48 -78
- package/nodes/accessors/Object3DNode.cjs.js +1 -0
- package/nodes/accessors/Object3DNode.js +85 -0
- package/nodes/accessors/PointUVNode.cjs.js +1 -0
- package/nodes/accessors/PointUVNode.js +16 -0
- package/nodes/accessors/PositionNode.cjs.js +1 -1
- package/nodes/accessors/PositionNode.js +49 -87
- package/nodes/accessors/ReferenceNode.cjs.js +1 -0
- package/nodes/accessors/ReferenceNode.js +43 -0
- package/nodes/accessors/ReflectNode.cjs.js +1 -1
- package/nodes/accessors/ReflectNode.js +35 -98
- package/nodes/accessors/SkinningNode.cjs.js +1 -0
- package/nodes/accessors/SkinningNode.js +59 -0
- package/nodes/accessors/TextureNode.cjs.js +1 -0
- package/nodes/accessors/TextureNode.js +68 -0
- package/nodes/accessors/UVNode.cjs.js +1 -1
- package/nodes/accessors/UVNode.js +20 -38
- package/nodes/core/ArrayUniformNode.cjs.js +1 -0
- package/nodes/core/ArrayUniformNode.js +17 -0
- package/nodes/core/AttributeNode.cjs.js +1 -1
- package/nodes/core/AttributeNode.js +31 -40
- package/nodes/core/BypassNode.cjs.js +1 -0
- package/nodes/core/BypassNode.js +28 -0
- package/nodes/core/CodeNode.cjs.js +1 -0
- package/nodes/core/CodeNode.js +35 -0
- package/nodes/core/ConstNode.cjs.js +1 -1
- package/nodes/core/ConstNode.js +10 -78
- package/nodes/core/ContextNode.cjs.js +1 -0
- package/nodes/core/ContextNode.js +26 -0
- package/nodes/core/ExpressionNode.cjs.js +1 -1
- package/nodes/core/ExpressionNode.js +19 -8
- package/nodes/core/FunctionCallNode.cjs.js +1 -1
- package/nodes/core/FunctionCallNode.js +31 -60
- package/nodes/core/FunctionNode.cjs.js +1 -1
- package/nodes/core/FunctionNode.js +45 -166
- package/nodes/core/InputNode.cjs.js +1 -1
- package/nodes/core/InputNode.js +43 -57
- package/nodes/core/Node.cjs.js +1 -1
- package/nodes/core/Node.js +155 -113
- package/nodes/core/NodeAttribute.cjs.js +1 -0
- package/nodes/core/NodeAttribute.js +11 -0
- package/nodes/core/NodeBuilder.cjs.js +1 -1
- package/nodes/core/NodeBuilder.js +422 -548
- package/nodes/core/NodeCode.cjs.js +1 -0
- package/nodes/core/NodeCode.js +13 -0
- package/nodes/core/NodeFrame.cjs.js +1 -1
- package/nodes/core/NodeFrame.js +34 -27
- package/nodes/core/NodeFunction.cjs.js +1 -0
- package/nodes/core/NodeFunction.js +17 -0
- package/nodes/core/NodeFunctionInput.cjs.js +1 -0
- package/nodes/core/NodeFunctionInput.js +14 -0
- package/nodes/core/NodeKeywords.cjs.js +1 -0
- package/nodes/core/NodeKeywords.js +54 -0
- package/nodes/core/NodeParser.cjs.js +1 -0
- package/nodes/core/NodeParser.js +8 -0
- package/nodes/core/NodeUniform.cjs.js +1 -1
- package/nodes/core/NodeUniform.js +18 -17
- package/nodes/core/NodeUtils.cjs.js +1 -1
- package/nodes/core/NodeUtils.js +55 -35
- package/nodes/core/NodeVar.cjs.js +1 -0
- package/nodes/core/NodeVar.js +11 -0
- package/nodes/core/NodeVary.cjs.js +1 -0
- package/nodes/core/NodeVary.js +11 -0
- package/nodes/core/PropertyNode.cjs.js +1 -0
- package/nodes/core/PropertyNode.js +26 -0
- package/nodes/core/TempNode.cjs.js +1 -1
- package/nodes/core/TempNode.js +21 -88
- package/nodes/core/UniformNode.cjs.js +1 -0
- package/nodes/core/UniformNode.js +28 -0
- package/nodes/core/VarNode.cjs.js +1 -1
- package/nodes/core/VarNode.js +28 -35
- package/nodes/core/VaryNode.cjs.js +1 -0
- package/nodes/core/VaryNode.js +38 -0
- package/nodes/core/constants.cjs.js +1 -0
- package/nodes/core/constants.js +11 -0
- package/nodes/display/ColorSpaceNode.cjs.js +1 -0
- package/nodes/display/ColorSpaceNode.js +67 -0
- package/nodes/display/NormalMapNode.cjs.js +1 -0
- package/nodes/display/NormalMapNode.js +71 -0
- package/nodes/fog/FogNode.cjs.js +1 -0
- package/nodes/fog/FogNode.js +18 -0
- package/nodes/fog/FogRangeNode.cjs.js +1 -0
- package/nodes/fog/FogRangeNode.js +20 -0
- package/nodes/functions/BSDFs.cjs.js +1 -0
- package/nodes/functions/BSDFs.js +121 -0
- package/nodes/functions/PhysicalMaterialFunctions.cjs.js +1 -0
- package/nodes/functions/PhysicalMaterialFunctions.js +57 -0
- package/nodes/lights/LightContextNode.cjs.js +1 -0
- package/nodes/lights/LightContextNode.js +43 -0
- package/nodes/lights/LightNode.cjs.js +1 -0
- package/nodes/lights/LightNode.js +61 -0
- package/nodes/lights/LightsNode.cjs.js +1 -0
- package/nodes/lights/LightsNode.js +77 -0
- package/nodes/loaders/NodeLoader.cjs.js +1 -0
- package/nodes/loaders/NodeLoader.js +80 -0
- package/nodes/loaders/NodeMaterialLoader.cjs.js +1 -0
- package/nodes/loaders/NodeMaterialLoader.js +29 -0
- package/nodes/loaders/NodeObjectLoader.cjs.js +1 -0
- package/nodes/loaders/NodeObjectLoader.js +49 -0
- package/nodes/materials/LineBasicNodeMaterial.cjs.js +1 -0
- package/nodes/materials/LineBasicNodeMaterial.js +31 -0
- package/nodes/materials/Materials.cjs.js +1 -0
- package/nodes/materials/Materials.js +27 -0
- package/nodes/materials/MeshBasicNodeMaterial.cjs.js +1 -0
- package/nodes/materials/MeshBasicNodeMaterial.js +32 -0
- package/nodes/materials/MeshStandardNodeMaterial.cjs.js +1 -1
- package/nodes/materials/MeshStandardNodeMaterial.js +41 -13
- package/nodes/materials/NodeMaterial.cjs.js +1 -1
- package/nodes/materials/NodeMaterial.js +67 -140
- package/nodes/materials/PointsNodeMaterial.cjs.js +1 -0
- package/nodes/materials/PointsNodeMaterial.js +34 -0
- package/nodes/math/CondNode.cjs.js +1 -1
- package/nodes/math/CondNode.js +33 -74
- package/nodes/math/MathNode.cjs.js +1 -1
- package/nodes/math/MathNode.js +193 -193
- package/nodes/math/OperatorNode.cjs.js +1 -1
- package/nodes/math/OperatorNode.js +116 -52
- package/nodes/parsers/GLSLNodeFunction.cjs.js +1 -0
- package/nodes/parsers/GLSLNodeFunction.js +101 -0
- package/nodes/parsers/GLSLNodeParser.cjs.js +1 -0
- package/nodes/parsers/GLSLNodeParser.js +13 -0
- package/nodes/parsers/WGSLNodeFunction.cjs.js +1 -0
- package/nodes/parsers/WGSLNodeFunction.js +71 -0
- package/nodes/parsers/WGSLNodeParser.cjs.js +1 -0
- package/nodes/parsers/WGSLNodeParser.js +13 -0
- package/nodes/procedural/CheckerNode.cjs.js +1 -1
- package/nodes/procedural/CheckerNode.js +22 -40
- package/nodes/utils/ArrayElementNode.cjs.js +1 -0
- package/nodes/utils/ArrayElementNode.js +22 -0
- package/nodes/utils/ConvertNode.cjs.js +1 -0
- package/nodes/utils/ConvertNode.js +29 -0
- package/nodes/utils/JoinNode.cjs.js +1 -1
- package/nodes/utils/JoinNode.js +19 -69
- package/nodes/utils/MatcapUVNode.cjs.js +1 -0
- package/nodes/utils/MatcapUVNode.js +18 -0
- package/nodes/utils/OscNode.cjs.js +1 -0
- package/nodes/utils/OscNode.js +55 -0
- package/nodes/utils/SplitNode.cjs.js +1 -0
- package/nodes/utils/SplitNode.js +58 -0
- package/nodes/utils/SpriteSheetUVNode.cjs.js +1 -0
- package/nodes/utils/SpriteSheetUVNode.js +39 -0
- package/nodes/utils/TimerNode.cjs.js +1 -1
- package/nodes/utils/TimerNode.js +38 -56
- package/package.json +2 -2
- package/Nodes-894ac9dc.js +0 -1
- package/Nodes-af575af7.js +0 -157
- package/nodes/accessors/ColorsNode.cjs.js +0 -1
- package/nodes/accessors/ColorsNode.d.ts +0 -10
- package/nodes/accessors/ColorsNode.js +0 -40
- package/nodes/accessors/LightNode.cjs.js +0 -1
- package/nodes/accessors/LightNode.d.ts +0 -12
- package/nodes/accessors/LightNode.js +0 -41
- package/nodes/accessors/ResolutionNode.cjs.js +0 -1
- package/nodes/accessors/ResolutionNode.d.ts +0 -14
- package/nodes/accessors/ResolutionNode.js +0 -41
- package/nodes/accessors/ScreenUVNode.cjs.js +0 -1
- package/nodes/accessors/ScreenUVNode.d.ts +0 -11
- package/nodes/accessors/ScreenUVNode.js +0 -43
- package/nodes/core/NodeLib.cjs.js +0 -1
- package/nodes/core/NodeLib.d.ts +0 -22
- package/nodes/core/NodeLib.js +0 -37
- package/nodes/core/StructNode.cjs.js +0 -1
- package/nodes/core/StructNode.d.ts +0 -19
- package/nodes/core/StructNode.js +0 -72
- package/nodes/effects/BlurNode.cjs.js +0 -1
- package/nodes/effects/BlurNode.d.ts +0 -31
- package/nodes/effects/BlurNode.js +0 -100
- package/nodes/effects/ColorAdjustmentNode.cjs.js +0 -1
- package/nodes/effects/ColorAdjustmentNode.d.ts +0 -27
- package/nodes/effects/ColorAdjustmentNode.js +0 -73
- package/nodes/effects/LuminanceNode.cjs.js +0 -1
- package/nodes/effects/LuminanceNode.d.ts +0 -18
- package/nodes/effects/LuminanceNode.js +0 -46
- package/nodes/inputs/BoolNode.cjs.js +0 -1
- package/nodes/inputs/BoolNode.d.ts +0 -19
- package/nodes/inputs/BoolNode.js +0 -36
- package/nodes/inputs/ColorNode.cjs.js +0 -1
- package/nodes/inputs/ColorNode.d.ts +0 -21
- package/nodes/inputs/ColorNode.js +0 -41
- package/nodes/inputs/CubeTextureNode.cjs.js +0 -1
- package/nodes/inputs/CubeTextureNode.d.ts +0 -17
- package/nodes/inputs/CubeTextureNode.js +0 -79
- package/nodes/inputs/FloatNode.cjs.js +0 -1
- package/nodes/inputs/FloatNode.d.ts +0 -19
- package/nodes/inputs/FloatNode.js +0 -36
- package/nodes/inputs/IntNode.cjs.js +0 -1
- package/nodes/inputs/IntNode.d.ts +0 -19
- package/nodes/inputs/IntNode.js +0 -36
- package/nodes/inputs/Matrix3Node.cjs.js +0 -1
- package/nodes/inputs/Matrix3Node.d.ts +0 -22
- package/nodes/inputs/Matrix3Node.js +0 -46
- package/nodes/inputs/Matrix4Node.cjs.js +0 -1
- package/nodes/inputs/Matrix4Node.d.ts +0 -22
- package/nodes/inputs/Matrix4Node.js +0 -46
- package/nodes/inputs/PropertyNode.cjs.js +0 -1
- package/nodes/inputs/PropertyNode.d.ts +0 -10
- package/nodes/inputs/PropertyNode.js +0 -35
- package/nodes/inputs/RTTNode.cjs.js +0 -1
- package/nodes/inputs/RTTNode.d.ts +0 -27
- package/nodes/inputs/RTTNode.js +0 -103
- package/nodes/inputs/ReflectorNode.cjs.js +0 -1
- package/nodes/inputs/ReflectorNode.d.ts +0 -21
- package/nodes/inputs/ReflectorNode.js +0 -60
- package/nodes/inputs/ScreenNode.cjs.js +0 -1
- package/nodes/inputs/ScreenNode.d.ts +0 -11
- package/nodes/inputs/ScreenNode.js +0 -20
- package/nodes/inputs/TextureNode.cjs.js +0 -1
- package/nodes/inputs/TextureNode.d.ts +0 -20
- package/nodes/inputs/TextureNode.js +0 -83
- package/nodes/inputs/Vector2Node.cjs.js +0 -1
- package/nodes/inputs/Vector2Node.d.ts +0 -21
- package/nodes/inputs/Vector2Node.js +0 -40
- package/nodes/inputs/Vector3Node.cjs.js +0 -1
- package/nodes/inputs/Vector3Node.d.ts +0 -21
- package/nodes/inputs/Vector3Node.js +0 -41
- package/nodes/inputs/Vector4Node.cjs.js +0 -1
- package/nodes/inputs/Vector4Node.d.ts +0 -21
- package/nodes/inputs/Vector4Node.js +0 -42
- package/nodes/materials/BasicNodeMaterial.cjs.js +0 -1
- package/nodes/materials/BasicNodeMaterial.d.ts +0 -11
- package/nodes/materials/BasicNodeMaterial.js +0 -15
- package/nodes/materials/PhongNodeMaterial.cjs.js +0 -1
- package/nodes/materials/PhongNodeMaterial.d.ts +0 -21
- package/nodes/materials/PhongNodeMaterial.js +0 -15
- package/nodes/materials/SpriteNodeMaterial.cjs.js +0 -1
- package/nodes/materials/SpriteNodeMaterial.d.ts +0 -12
- package/nodes/materials/SpriteNodeMaterial.js +0 -15
- package/nodes/materials/StandardNodeMaterial.cjs.js +0 -1
- package/nodes/materials/StandardNodeMaterial.d.ts +0 -25
- package/nodes/materials/StandardNodeMaterial.js +0 -15
- package/nodes/materials/nodes/BasicNode.cjs.js +0 -1
- package/nodes/materials/nodes/BasicNode.d.ts +0 -15
- package/nodes/materials/nodes/BasicNode.js +0 -91
- package/nodes/materials/nodes/MeshStandardNode.cjs.js +0 -1
- package/nodes/materials/nodes/MeshStandardNode.d.ts +0 -25
- package/nodes/materials/nodes/MeshStandardNode.js +0 -81
- package/nodes/materials/nodes/PhongNode.cjs.js +0 -1
- package/nodes/materials/nodes/PhongNode.d.ts +0 -14
- package/nodes/materials/nodes/PhongNode.js +0 -212
- package/nodes/materials/nodes/RawNode.cjs.js +0 -1
- package/nodes/materials/nodes/RawNode.d.ts +0 -10
- package/nodes/materials/nodes/RawNode.js +0 -42
- package/nodes/materials/nodes/SpriteNode.cjs.js +0 -1
- package/nodes/materials/nodes/SpriteNode.d.ts +0 -13
- package/nodes/materials/nodes/SpriteNode.js +0 -113
- package/nodes/materials/nodes/StandardNode.cjs.js +0 -1
- package/nodes/materials/nodes/StandardNode.d.ts +0 -15
- package/nodes/materials/nodes/StandardNode.js +0 -336
- package/nodes/misc/BumpMapNode.cjs.js +0 -1
- package/nodes/misc/BumpMapNode.d.ts +0 -21
- package/nodes/misc/BumpMapNode.js +0 -80
- package/nodes/misc/NormalMapNode.cjs.js +0 -1
- package/nodes/misc/NormalMapNode.d.ts +0 -19
- package/nodes/misc/NormalMapNode.js +0 -102
- package/nodes/misc/TextureCubeNode.cjs.js +0 -1
- package/nodes/misc/TextureCubeNode.d.ts +0 -21
- package/nodes/misc/TextureCubeNode.js +0 -52
- package/nodes/misc/TextureCubeUVNode.cjs.js +0 -1
- package/nodes/misc/TextureCubeUVNode.d.ts +0 -18
- package/nodes/misc/TextureCubeUVNode.js +0 -229
- package/nodes/postprocessing/NodePass.cjs.js +0 -1
- package/nodes/postprocessing/NodePass.d.ts +0 -15
- package/nodes/postprocessing/NodePass.js +0 -61
- package/nodes/postprocessing/NodePostProcessing.cjs.js +0 -1
- package/nodes/postprocessing/NodePostProcessing.d.ts +0 -26
- package/nodes/postprocessing/NodePostProcessing.js +0 -91
- package/nodes/procedural/NoiseNode.cjs.js +0 -1
- package/nodes/procedural/NoiseNode.d.ts +0 -17
- package/nodes/procedural/NoiseNode.js +0 -43
- package/nodes/utils/BypassNode.cjs.js +0 -1
- package/nodes/utils/BypassNode.d.ts +0 -11
- package/nodes/utils/BypassNode.js +0 -55
- package/nodes/utils/ColorSpaceNode.cjs.js +0 -1
- package/nodes/utils/ColorSpaceNode.d.ts +0 -55
- package/nodes/utils/ColorSpaceNode.js +0 -106
- package/nodes/utils/MaxMIPLevelNode.cjs.js +0 -1
- package/nodes/utils/MaxMIPLevelNode.d.ts +0 -11
- package/nodes/utils/MaxMIPLevelNode.js +0 -38
- package/nodes/utils/SpecularMIPLevelNode.cjs.js +0 -1
- package/nodes/utils/SpecularMIPLevelNode.d.ts +0 -17
- package/nodes/utils/SpecularMIPLevelNode.js +0 -61
- package/nodes/utils/SubSlotNode.cjs.js +0 -1
- package/nodes/utils/SubSlotNode.js +0 -53
- package/nodes/utils/SwitchNode.cjs.js +0 -1
- package/nodes/utils/SwitchNode.d.ts +0 -11
- package/nodes/utils/SwitchNode.js +0 -69
- package/nodes/utils/UVTransformNode.cjs.js +0 -1
- package/nodes/utils/UVTransformNode.d.ts +0 -15
- package/nodes/utils/UVTransformNode.js +0 -46
- package/nodes/utils/VelocityNode.cjs.js +0 -1
- package/nodes/utils/VelocityNode.d.ts +0 -28
- package/nodes/utils/VelocityNode.js +0 -115
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./TempNode.cjs.js");require("three"),require("./Node.cjs.js");var e=/^struct\s*([a-z_0-9]+)\s*{\s*((.|\n)*?)}/gim,r=/\s*(\w*?)\s*(\w*?)(\=|\;)/gim;function s(e){t.TempNode.call(this),this.parse(e)}s.prototype=Object.create(t.TempNode.prototype),s.prototype.constructor=s,s.prototype.nodeType="Struct",s.prototype.getType=function(t){return t.getTypeByFormat(this.name)},s.prototype.getInputByName=function(t){for(var e=this.inputs.length;e--;)if(this.inputs[e].name===t)return this.inputs[e]},s.prototype.generate=function(t,e){return"source"===e?this.src+";":t.format("( "+this.src+" )",this.getType(t),e)},s.prototype.parse=function(t){this.src=t||"",this.inputs=[];var s=e.exec(this.src);if(s){for(var o,i=s[2];o=r.exec(i);)this.inputs.push({type:o[1],name:o[2]});this.name=s[1]}else this.name="";this.type=this.name},s.prototype.toJSON=function(t){var e=this.getJSONNode(t);return e||((e=this.createJSONNode(t)).src=this.src),e},exports.StructNode=s;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { TempNode } from './TempNode';
|
2
|
-
import { NodeBuilder } from './NodeBuilder';
|
3
|
-
|
4
|
-
export interface StructNodeInput {
|
5
|
-
type: string;
|
6
|
-
name: string;
|
7
|
-
}
|
8
|
-
|
9
|
-
export class StructNode extends TempNode {
|
10
|
-
constructor(src?: string);
|
11
|
-
|
12
|
-
inputs: StructNodeInput[];
|
13
|
-
src: string;
|
14
|
-
nodeType: string;
|
15
|
-
|
16
|
-
getType(builder: NodeBuilder): string;
|
17
|
-
getInputByName(name: string): StructNodeInput;
|
18
|
-
parse(src: string): void;
|
19
|
-
}
|
package/nodes/core/StructNode.js
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
import { TempNode } from './TempNode.js';
|
2
|
-
|
3
|
-
var declarationRegexp = /^struct\s*([a-z_0-9]+)\s*{\s*((.|\n)*?)}/gim,
|
4
|
-
propertiesRegexp = /\s*(\w*?)\s*(\w*?)(\=|\;)/gim;
|
5
|
-
|
6
|
-
function StructNode(src) {
|
7
|
-
TempNode.call(this);
|
8
|
-
this.parse(src);
|
9
|
-
}
|
10
|
-
|
11
|
-
StructNode.prototype = Object.create(TempNode.prototype);
|
12
|
-
StructNode.prototype.constructor = StructNode;
|
13
|
-
StructNode.prototype.nodeType = 'Struct';
|
14
|
-
|
15
|
-
StructNode.prototype.getType = function (builder) {
|
16
|
-
return builder.getTypeByFormat(this.name);
|
17
|
-
};
|
18
|
-
|
19
|
-
StructNode.prototype.getInputByName = function (name) {
|
20
|
-
var i = this.inputs.length;
|
21
|
-
|
22
|
-
while (i--) {
|
23
|
-
if (this.inputs[i].name === name) {
|
24
|
-
return this.inputs[i];
|
25
|
-
}
|
26
|
-
}
|
27
|
-
};
|
28
|
-
|
29
|
-
StructNode.prototype.generate = function (builder, output) {
|
30
|
-
if (output === 'source') {
|
31
|
-
return this.src + ';';
|
32
|
-
} else {
|
33
|
-
return builder.format('( ' + this.src + ' )', this.getType(builder), output);
|
34
|
-
}
|
35
|
-
};
|
36
|
-
|
37
|
-
StructNode.prototype.parse = function (src) {
|
38
|
-
this.src = src || '';
|
39
|
-
this.inputs = [];
|
40
|
-
var declaration = declarationRegexp.exec(this.src);
|
41
|
-
|
42
|
-
if (declaration) {
|
43
|
-
var properties = declaration[2],
|
44
|
-
match;
|
45
|
-
|
46
|
-
while (match = propertiesRegexp.exec(properties)) {
|
47
|
-
this.inputs.push({
|
48
|
-
type: match[1],
|
49
|
-
name: match[2]
|
50
|
-
});
|
51
|
-
}
|
52
|
-
|
53
|
-
this.name = declaration[1];
|
54
|
-
} else {
|
55
|
-
this.name = '';
|
56
|
-
}
|
57
|
-
|
58
|
-
this.type = this.name;
|
59
|
-
};
|
60
|
-
|
61
|
-
StructNode.prototype.toJSON = function (meta) {
|
62
|
-
var data = this.getJSONNode(meta);
|
63
|
-
|
64
|
-
if (!data) {
|
65
|
-
data = this.createJSONNode(meta);
|
66
|
-
data.src = this.src;
|
67
|
-
}
|
68
|
-
|
69
|
-
return data;
|
70
|
-
};
|
71
|
-
|
72
|
-
export { StructNode };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),t=require("../core/TempNode.cjs.js"),u=require("../core/FunctionNode.cjs.js"),s=require("../inputs/FloatNode.cjs.js"),r=require("../inputs/Vector2Node.cjs.js"),i=require("../accessors/UVNode.cjs.js");function v(e,u,v,o){t.TempNode.call(this,"v4"),this.value=e,this.uv=u||new i.UVNode,this.radius=v||new r.Vector2Node(1,1),this.size=o,this.blurX=!0,this.blurY=!0,this.horizontal=new s.FloatNode(1/64),this.vertical=new s.FloatNode(1/64)}require("../core/Node.cjs.js"),require("../core/NodeLib.cjs.js"),require("../core/InputNode.cjs.js"),require("../core/NodeUtils.cjs.js"),v.Nodes={blurX:new u.FunctionNode(["vec4 blurX( sampler2D tex, vec2 uv, float s ) {","\tvec4 sum = vec4( 0.0 );","\tsum += texture2D( tex, vec2( uv.x - 4.0 * s, uv.y ) ) * 0.051;","\tsum += texture2D( tex, vec2( uv.x - 3.0 * s, uv.y ) ) * 0.0918;","\tsum += texture2D( tex, vec2( uv.x - 2.0 * s, uv.y ) ) * 0.12245;","\tsum += texture2D( tex, vec2( uv.x - 1.0 * s, uv.y ) ) * 0.1531;","\tsum += texture2D( tex, vec2( uv.x, uv.y ) ) * 0.1633;","\tsum += texture2D( tex, vec2( uv.x + 1.0 * s, uv.y ) ) * 0.1531;","\tsum += texture2D( tex, vec2( uv.x + 2.0 * s, uv.y ) ) * 0.12245;","\tsum += texture2D( tex, vec2( uv.x + 3.0 * s, uv.y ) ) * 0.0918;","\tsum += texture2D( tex, vec2( uv.x + 4.0 * s, uv.y ) ) * 0.051;","\treturn sum * .667;","}"].join("\n")),blurY:new u.FunctionNode(["vec4 blurY( sampler2D tex, vec2 uv, float s ) {","\tvec4 sum = vec4( 0.0 );","\tsum += texture2D( tex, vec2( uv.x, uv.y - 4.0 * s ) ) * 0.051;","\tsum += texture2D( tex, vec2( uv.x, uv.y - 3.0 * s ) ) * 0.0918;","\tsum += texture2D( tex, vec2( uv.x, uv.y - 2.0 * s ) ) * 0.12245;","\tsum += texture2D( tex, vec2( uv.x, uv.y - 1.0 * s ) ) * 0.1531;","\tsum += texture2D( tex, vec2( uv.x, uv.y ) ) * 0.1633;","\tsum += texture2D( tex, vec2( uv.x, uv.y + 1.0 * s ) ) * 0.1531;","\tsum += texture2D( tex, vec2( uv.x, uv.y + 2.0 * s ) ) * 0.12245;","\tsum += texture2D( tex, vec2( uv.x, uv.y + 3.0 * s ) ) * 0.0918;","\tsum += texture2D( tex, vec2( uv.x, uv.y + 4.0 * s ) ) * 0.051;","\treturn sum * .667;","}"].join("\n"))},v.prototype=Object.create(t.TempNode.prototype),v.prototype.constructor=v,v.prototype.nodeType="Blur",v.prototype.hashProperties=["blurX","blurY"],v.prototype.updateFrame=function(){if(this.size)this.horizontal.value=this.radius.x/this.size.x,this.vertical.value=this.radius.y/this.size.y;else if(this.value.value&&this.value.value.image){var e=this.value.value.image;this.horizontal.value=this.radius.x/e.width,this.vertical.value=this.radius.y/e.height}},v.prototype.generate=function(e,t){if(e.isShader("fragment")){var u,s=[],r=e.include(v.Nodes.blurX),i=e.include(v.Nodes.blurY);return this.blurX&&s.push(r+"( "+this.value.build(e,"sampler2D")+", "+this.uv.build(e,"v2")+", "+this.horizontal.build(e,"f")+" )"),this.blurY&&s.push(i+"( "+this.value.build(e,"sampler2D")+", "+this.uv.build(e,"v2")+", "+this.vertical.build(e,"f")+" )"),u=2==s.length?"( "+s.join(" + ")+" / 2.0 )":s.length?"( "+s[0]+" )":"vec4( 0.0 )",e.format(u,this.getType(e),t)}return console.warn("THREE.BlurNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t)},v.prototype.copy=function(u){return t.TempNode.prototype.copy.call(this,u),this.value=u.value,this.uv=u.uv,this.radius=u.radius,void 0!==u.size&&(this.size=new e.Vector2(u.size.x,u.size.y)),this.blurX=u.blurX,this.blurY=u.blurY,this},v.prototype.toJSON=function(e){var t=this.getJSONNode(e);return t||((t=this.createJSONNode(e)).value=this.value.toJSON(e).uuid,t.uv=this.uv.toJSON(e).uuid,t.radius=this.radius.toJSON(e).uuid,this.size&&(t.size={x:this.size.x,y:this.size.y}),t.blurX=this.blurX,t.blurY=this.blurY),t},exports.BlurNode=v;
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { Vector2 } from 'three';
|
2
|
-
|
3
|
-
import { TempNode } from '../core/TempNode';
|
4
|
-
import { NodeFrame } from '../core/NodeFrame';
|
5
|
-
import { UVNode } from '../accessors/UVNode';
|
6
|
-
import { Vector2Node } from '../inputs/Vector2Node';
|
7
|
-
import { FloatNode } from '../inputs/FloatNode';
|
8
|
-
import { FunctionNode } from '../core/FunctionNode';
|
9
|
-
import { TextureNode } from '../inputs/TextureNode';
|
10
|
-
|
11
|
-
export class BlurNode extends TempNode {
|
12
|
-
constructor(value: TextureNode, uv?: UVNode, radius?: number, size?: Vector2);
|
13
|
-
|
14
|
-
value: TextureNode;
|
15
|
-
uv: UVNode;
|
16
|
-
radius: Vector2Node;
|
17
|
-
size: Vector2;
|
18
|
-
blurX: boolean;
|
19
|
-
blurY: boolean;
|
20
|
-
horizontal: FloatNode;
|
21
|
-
vertical: FloatNode;
|
22
|
-
nodeType: string;
|
23
|
-
|
24
|
-
updateFrame(frame: NodeFrame): void;
|
25
|
-
copy(source: BlurNode): this;
|
26
|
-
|
27
|
-
static Nodes: {
|
28
|
-
blurX: FunctionNode;
|
29
|
-
blurY: FunctionNode;
|
30
|
-
};
|
31
|
-
}
|
@@ -1,100 +0,0 @@
|
|
1
|
-
import { Vector2 } from 'three';
|
2
|
-
import { TempNode } from '../core/TempNode.js';
|
3
|
-
import { FunctionNode } from '../core/FunctionNode.js';
|
4
|
-
import { FloatNode } from '../inputs/FloatNode.js';
|
5
|
-
import { Vector2Node } from '../inputs/Vector2Node.js';
|
6
|
-
import { UVNode } from '../accessors/UVNode.js';
|
7
|
-
|
8
|
-
function BlurNode(value, uv, radius, size) {
|
9
|
-
TempNode.call(this, 'v4');
|
10
|
-
this.value = value;
|
11
|
-
this.uv = uv || new UVNode();
|
12
|
-
this.radius = radius || new Vector2Node(1, 1);
|
13
|
-
this.size = size;
|
14
|
-
this.blurX = true;
|
15
|
-
this.blurY = true;
|
16
|
-
this.horizontal = new FloatNode(1 / 64);
|
17
|
-
this.vertical = new FloatNode(1 / 64);
|
18
|
-
}
|
19
|
-
|
20
|
-
BlurNode.Nodes = function () {
|
21
|
-
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'));
|
22
|
-
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'));
|
23
|
-
return {
|
24
|
-
blurX: blurX,
|
25
|
-
blurY: blurY
|
26
|
-
};
|
27
|
-
}();
|
28
|
-
|
29
|
-
BlurNode.prototype = Object.create(TempNode.prototype);
|
30
|
-
BlurNode.prototype.constructor = BlurNode;
|
31
|
-
BlurNode.prototype.nodeType = 'Blur';
|
32
|
-
BlurNode.prototype.hashProperties = ['blurX', 'blurY'];
|
33
|
-
|
34
|
-
BlurNode.prototype.updateFrame = function
|
35
|
-
/* frame */
|
36
|
-
() {
|
37
|
-
if (this.size) {
|
38
|
-
this.horizontal.value = this.radius.x / this.size.x;
|
39
|
-
this.vertical.value = this.radius.y / this.size.y;
|
40
|
-
} else if (this.value.value && this.value.value.image) {
|
41
|
-
var image = this.value.value.image;
|
42
|
-
this.horizontal.value = this.radius.x / image.width;
|
43
|
-
this.vertical.value = this.radius.y / image.height;
|
44
|
-
}
|
45
|
-
};
|
46
|
-
|
47
|
-
BlurNode.prototype.generate = function (builder, output) {
|
48
|
-
if (builder.isShader('fragment')) {
|
49
|
-
var blurCode = [],
|
50
|
-
code;
|
51
|
-
var blurX = builder.include(BlurNode.Nodes.blurX),
|
52
|
-
blurY = builder.include(BlurNode.Nodes.blurY);
|
53
|
-
|
54
|
-
if (this.blurX) {
|
55
|
-
blurCode.push(blurX + '( ' + this.value.build(builder, 'sampler2D') + ', ' + this.uv.build(builder, 'v2') + ', ' + this.horizontal.build(builder, 'f') + ' )');
|
56
|
-
}
|
57
|
-
|
58
|
-
if (this.blurY) {
|
59
|
-
blurCode.push(blurY + '( ' + this.value.build(builder, 'sampler2D') + ', ' + this.uv.build(builder, 'v2') + ', ' + this.vertical.build(builder, 'f') + ' )');
|
60
|
-
}
|
61
|
-
|
62
|
-
if (blurCode.length == 2) code = '( ' + blurCode.join(' + ') + ' / 2.0 )';else if (blurCode.length) code = '( ' + blurCode[0] + ' )';else code = 'vec4( 0.0 )';
|
63
|
-
return builder.format(code, this.getType(builder), output);
|
64
|
-
} else {
|
65
|
-
console.warn('THREE.BlurNode is not compatible with ' + builder.shader + ' shader.');
|
66
|
-
return builder.format('vec4( 0.0 )', this.getType(builder), output);
|
67
|
-
}
|
68
|
-
};
|
69
|
-
|
70
|
-
BlurNode.prototype.copy = function (source) {
|
71
|
-
TempNode.prototype.copy.call(this, source);
|
72
|
-
this.value = source.value;
|
73
|
-
this.uv = source.uv;
|
74
|
-
this.radius = source.radius;
|
75
|
-
if (source.size !== undefined) this.size = new Vector2(source.size.x, source.size.y);
|
76
|
-
this.blurX = source.blurX;
|
77
|
-
this.blurY = source.blurY;
|
78
|
-
return this;
|
79
|
-
};
|
80
|
-
|
81
|
-
BlurNode.prototype.toJSON = function (meta) {
|
82
|
-
var data = this.getJSONNode(meta);
|
83
|
-
|
84
|
-
if (!data) {
|
85
|
-
data = this.createJSONNode(meta);
|
86
|
-
data.value = this.value.toJSON(meta).uuid;
|
87
|
-
data.uv = this.uv.toJSON(meta).uuid;
|
88
|
-
data.radius = this.radius.toJSON(meta).uuid;
|
89
|
-
if (this.size) data.size = {
|
90
|
-
x: this.size.x,
|
91
|
-
y: this.size.y
|
92
|
-
};
|
93
|
-
data.blurX = this.blurX;
|
94
|
-
data.blurY = this.blurY;
|
95
|
-
}
|
96
|
-
|
97
|
-
return data;
|
98
|
-
};
|
99
|
-
|
100
|
-
export { BlurNode };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../core/TempNode.cjs.js"),e=require("../core/FunctionNode.cjs.js"),o=require("./LuminanceNode.cjs.js");function r(e,o,n){t.TempNode.call(this,"v3"),this.rgb=e,this.adjustment=o,this.method=n||r.SATURATION}require("three"),require("../core/Node.cjs.js"),require("../core/NodeLib.cjs.js"),require("../core/ConstNode.cjs.js"),r.Nodes={hue:new e.FunctionNode(["vec3 hue(vec3 rgb, float adjustment) {","\tconst mat3 RGBtoYIQ = mat3(0.299, 0.587, 0.114, 0.595716, -0.274453, -0.321263, 0.211456, -0.522591, 0.311135);","\tconst mat3 YIQtoRGB = mat3(1.0, 0.9563, 0.6210, 1.0, -0.2721, -0.6474, 1.0, -1.107, 1.7046);","\tvec3 yiq = RGBtoYIQ * rgb;","\tfloat hue = atan(yiq.z, yiq.y) + adjustment;","\tfloat chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);","\treturn YIQtoRGB * vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));","}"].join("\n")),saturation:new e.FunctionNode(["vec3 saturation(vec3 rgb, float adjustment) {","\tvec3 intensity = vec3( luminance( rgb ) );","\treturn mix( intensity, rgb, adjustment );","}"].join("\n"),[o.LuminanceNode.Nodes.luminance]),vibrance:new e.FunctionNode(["vec3 vibrance(vec3 rgb, float adjustment) {","\tfloat average = (rgb.r + rgb.g + rgb.b) / 3.0;","\tfloat mx = max(rgb.r, max(rgb.g, rgb.b));","\tfloat amt = (mx - average) * (-3.0 * adjustment);","\treturn mix(rgb.rgb, vec3(mx), amt);","}"].join("\n"))},r.SATURATION="saturation",r.HUE="hue",r.VIBRANCE="vibrance",r.BRIGHTNESS="brightness",r.CONTRAST="contrast",r.prototype=Object.create(t.TempNode.prototype),r.prototype.constructor=r,r.prototype.nodeType="ColorAdjustment",r.prototype.hashProperties=["method"],r.prototype.generate=function(t,e){var o=this.rgb.build(t,"v3"),n=this.adjustment.build(t,"f");switch(this.method){case r.BRIGHTNESS:return t.format("( "+o+" + "+n+" )",this.getType(t),e);case r.CONTRAST:return t.format("( "+o+" * "+n+" )",this.getType(t),e)}var i=t.include(r.Nodes[this.method]);return t.format(i+"( "+o+", "+n+" )",this.getType(t),e)},r.prototype.copy=function(e){return t.TempNode.prototype.copy.call(this,e),this.rgb=e.rgb,this.adjustment=e.adjustment,this.method=e.method,this},r.prototype.toJSON=function(t){var e=this.getJSONNode(t);return e||((e=this.createJSONNode(t)).rgb=this.rgb.toJSON(t).uuid,e.adjustment=this.adjustment.toJSON(t).uuid,e.method=this.method),e},exports.ColorAdjustmentNode=r;
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { TempNode } from '../core/TempNode';
|
2
|
-
import { FloatNode } from '../inputs/FloatNode';
|
3
|
-
import { FunctionNode } from '../core/FunctionNode';
|
4
|
-
import { Node } from '../core/Node';
|
5
|
-
|
6
|
-
export class ColorAdjustmentNode extends TempNode {
|
7
|
-
constructor(rgb: Node, adjustment?: FloatNode, method?: string);
|
8
|
-
|
9
|
-
rgb: Node;
|
10
|
-
adjustment: FloatNode | undefined;
|
11
|
-
method: string;
|
12
|
-
nodeType: string;
|
13
|
-
|
14
|
-
copy(source: ColorAdjustmentNode): this;
|
15
|
-
|
16
|
-
static Nodes: {
|
17
|
-
hue: FunctionNode;
|
18
|
-
saturation: FunctionNode;
|
19
|
-
vibrance: FunctionNode;
|
20
|
-
};
|
21
|
-
|
22
|
-
static SATURATION: string;
|
23
|
-
static HUE: string;
|
24
|
-
static VIBRANCE: string;
|
25
|
-
static BRIGHTNESS: string;
|
26
|
-
static CONTRAST: string;
|
27
|
-
}
|
@@ -1,73 +0,0 @@
|
|
1
|
-
import { TempNode } from '../core/TempNode.js';
|
2
|
-
import { FunctionNode } from '../core/FunctionNode.js';
|
3
|
-
import { LuminanceNode } from './LuminanceNode.js';
|
4
|
-
|
5
|
-
function ColorAdjustmentNode(rgb, adjustment, method) {
|
6
|
-
TempNode.call(this, 'v3');
|
7
|
-
this.rgb = rgb;
|
8
|
-
this.adjustment = adjustment;
|
9
|
-
this.method = method || ColorAdjustmentNode.SATURATION;
|
10
|
-
}
|
11
|
-
|
12
|
-
ColorAdjustmentNode.Nodes = function () {
|
13
|
-
var hue = new FunctionNode(['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);', ' vec3 yiq = RGBtoYIQ * rgb;', ' 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));', '}'].join('\n'));
|
14
|
-
var saturation = new FunctionNode([// Algorithm from Chapter 16 of OpenGL Shading Language
|
15
|
-
'vec3 saturation(vec3 rgb, float adjustment) {', ' vec3 intensity = vec3( luminance( rgb ) );', ' return mix( intensity, rgb, adjustment );', '}'].join('\n'), [LuminanceNode.Nodes.luminance]); // include LuminanceNode function
|
16
|
-
|
17
|
-
var vibrance = new FunctionNode([// Shader by Evan Wallace adapted by @lo-th
|
18
|
-
'vec3 vibrance(vec3 rgb, float adjustment) {', ' 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);', ' return mix(rgb.rgb, vec3(mx), amt);', '}'].join('\n'));
|
19
|
-
return {
|
20
|
-
hue: hue,
|
21
|
-
saturation: saturation,
|
22
|
-
vibrance: vibrance
|
23
|
-
};
|
24
|
-
}();
|
25
|
-
|
26
|
-
ColorAdjustmentNode.SATURATION = 'saturation';
|
27
|
-
ColorAdjustmentNode.HUE = 'hue';
|
28
|
-
ColorAdjustmentNode.VIBRANCE = 'vibrance';
|
29
|
-
ColorAdjustmentNode.BRIGHTNESS = 'brightness';
|
30
|
-
ColorAdjustmentNode.CONTRAST = 'contrast';
|
31
|
-
ColorAdjustmentNode.prototype = Object.create(TempNode.prototype);
|
32
|
-
ColorAdjustmentNode.prototype.constructor = ColorAdjustmentNode;
|
33
|
-
ColorAdjustmentNode.prototype.nodeType = 'ColorAdjustment';
|
34
|
-
ColorAdjustmentNode.prototype.hashProperties = ['method'];
|
35
|
-
|
36
|
-
ColorAdjustmentNode.prototype.generate = function (builder, output) {
|
37
|
-
var rgb = this.rgb.build(builder, 'v3'),
|
38
|
-
adjustment = this.adjustment.build(builder, 'f');
|
39
|
-
|
40
|
-
switch (this.method) {
|
41
|
-
case ColorAdjustmentNode.BRIGHTNESS:
|
42
|
-
return builder.format('( ' + rgb + ' + ' + adjustment + ' )', this.getType(builder), output);
|
43
|
-
|
44
|
-
case ColorAdjustmentNode.CONTRAST:
|
45
|
-
return builder.format('( ' + rgb + ' * ' + adjustment + ' )', this.getType(builder), output);
|
46
|
-
}
|
47
|
-
|
48
|
-
var method = builder.include(ColorAdjustmentNode.Nodes[this.method]);
|
49
|
-
return builder.format(method + '( ' + rgb + ', ' + adjustment + ' )', this.getType(builder), output);
|
50
|
-
};
|
51
|
-
|
52
|
-
ColorAdjustmentNode.prototype.copy = function (source) {
|
53
|
-
TempNode.prototype.copy.call(this, source);
|
54
|
-
this.rgb = source.rgb;
|
55
|
-
this.adjustment = source.adjustment;
|
56
|
-
this.method = source.method;
|
57
|
-
return this;
|
58
|
-
};
|
59
|
-
|
60
|
-
ColorAdjustmentNode.prototype.toJSON = function (meta) {
|
61
|
-
var data = this.getJSONNode(meta);
|
62
|
-
|
63
|
-
if (!data) {
|
64
|
-
data = this.createJSONNode(meta);
|
65
|
-
data.rgb = this.rgb.toJSON(meta).uuid;
|
66
|
-
data.adjustment = this.adjustment.toJSON(meta).uuid;
|
67
|
-
data.method = this.method;
|
68
|
-
}
|
69
|
-
|
70
|
-
return data;
|
71
|
-
};
|
72
|
-
|
73
|
-
export { ColorAdjustmentNode };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,o=require("../core/TempNode.cjs.js"),t=require("../core/ConstNode.cjs.js"),r=require("../core/FunctionNode.cjs.js");function n(e){o.TempNode.call(this,"f"),this.rgb=e}require("three"),require("../core/Node.cjs.js"),require("../core/NodeLib.cjs.js"),n.Nodes={LUMA:e=new t.ConstNode("vec3 LUMA vec3( 0.2125, 0.7154, 0.0721 )"),luminance:new r.FunctionNode(["float luminance( vec3 rgb ) {","\treturn dot( rgb, LUMA );","}"].join("\n"),[e])},n.prototype=Object.create(o.TempNode.prototype),n.prototype.constructor=n,n.prototype.nodeType="Luminance",n.prototype.generate=function(e,o){var t=e.include(n.Nodes.luminance);return e.format(t+"( "+this.rgb.build(e,"v3")+" )",this.getType(e),o)},n.prototype.copy=function(e){return o.TempNode.prototype.copy.call(this,e),this.rgb=e.rgb,this},n.prototype.toJSON=function(e){var o=this.getJSONNode(e);return o||((o=this.createJSONNode(e)).rgb=this.rgb.toJSON(e).uuid),o},exports.LuminanceNode=n;
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { TempNode } from '../core/TempNode';
|
2
|
-
import { FunctionNode } from '../core/FunctionNode';
|
3
|
-
import { ConstNode } from '../core/ConstNode';
|
4
|
-
import { Node } from '../core/Node';
|
5
|
-
|
6
|
-
export class LuminanceNode extends TempNode {
|
7
|
-
constructor(rgb: Node);
|
8
|
-
|
9
|
-
rgb: Node;
|
10
|
-
nodeType: string;
|
11
|
-
|
12
|
-
copy(source: LuminanceNode): this;
|
13
|
-
|
14
|
-
static Nodes: {
|
15
|
-
LUMA: ConstNode;
|
16
|
-
luminance: FunctionNode;
|
17
|
-
};
|
18
|
-
}
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import { TempNode } from '../core/TempNode.js';
|
2
|
-
import { ConstNode } from '../core/ConstNode.js';
|
3
|
-
import { FunctionNode } from '../core/FunctionNode.js';
|
4
|
-
|
5
|
-
function LuminanceNode(rgb) {
|
6
|
-
TempNode.call(this, 'f');
|
7
|
-
this.rgb = rgb;
|
8
|
-
}
|
9
|
-
|
10
|
-
LuminanceNode.Nodes = function () {
|
11
|
-
var LUMA = new ConstNode('vec3 LUMA vec3( 0.2125, 0.7154, 0.0721 )');
|
12
|
-
var luminance = new FunctionNode([// Algorithm from Chapter 10 of Graphics Shaders
|
13
|
-
'float luminance( vec3 rgb ) {', ' return dot( rgb, LUMA );', '}'].join('\n'), [LUMA]);
|
14
|
-
return {
|
15
|
-
LUMA: LUMA,
|
16
|
-
luminance: luminance
|
17
|
-
};
|
18
|
-
}();
|
19
|
-
|
20
|
-
LuminanceNode.prototype = Object.create(TempNode.prototype);
|
21
|
-
LuminanceNode.prototype.constructor = LuminanceNode;
|
22
|
-
LuminanceNode.prototype.nodeType = 'Luminance';
|
23
|
-
|
24
|
-
LuminanceNode.prototype.generate = function (builder, output) {
|
25
|
-
var luminance = builder.include(LuminanceNode.Nodes.luminance);
|
26
|
-
return builder.format(luminance + '( ' + this.rgb.build(builder, 'v3') + ' )', this.getType(builder), output);
|
27
|
-
};
|
28
|
-
|
29
|
-
LuminanceNode.prototype.copy = function (source) {
|
30
|
-
TempNode.prototype.copy.call(this, source);
|
31
|
-
this.rgb = source.rgb;
|
32
|
-
return this;
|
33
|
-
};
|
34
|
-
|
35
|
-
LuminanceNode.prototype.toJSON = function (meta) {
|
36
|
-
var data = this.getJSONNode(meta);
|
37
|
-
|
38
|
-
if (!data) {
|
39
|
-
data = this.createJSONNode(meta);
|
40
|
-
data.rgb = this.rgb.toJSON(meta).uuid;
|
41
|
-
}
|
42
|
-
|
43
|
-
return data;
|
44
|
-
};
|
45
|
-
|
46
|
-
export { LuminanceNode };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../core/InputNode.cjs.js");function t(t){e.InputNode.call(this,"b"),this.value=Boolean(t)}require("../core/TempNode.cjs.js"),require("three"),require("../core/Node.cjs.js"),t.prototype=Object.create(e.InputNode.prototype),t.prototype.constructor=t,t.prototype.nodeType="Bool",t.prototype.generateReadonly=function(e,t,o,r){return e.format(this.value,r,t)},t.prototype.copy=function(t){return e.InputNode.prototype.copy.call(this,t),this.value=t.value,this},t.prototype.toJSON=function(e){var t=this.getJSONNode(e);return t||((t=this.createJSONNode(e)).value=this.value,!0===this.readonly&&(t.readonly=!0)),t},exports.BoolNode=t;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { InputNode } from '../core/InputNode';
|
2
|
-
import { NodeBuilder } from '../core/NodeBuilder';
|
3
|
-
|
4
|
-
export class BoolNode extends InputNode {
|
5
|
-
constructor(value?: boolean);
|
6
|
-
|
7
|
-
value: boolean;
|
8
|
-
nodeType: string;
|
9
|
-
|
10
|
-
generateReadonly(
|
11
|
-
builder: NodeBuilder,
|
12
|
-
output: string,
|
13
|
-
uuid?: string,
|
14
|
-
type?: string,
|
15
|
-
ns?: string,
|
16
|
-
needsUpdate?: boolean,
|
17
|
-
): string;
|
18
|
-
copy(source: BoolNode): this;
|
19
|
-
}
|
package/nodes/inputs/BoolNode.js
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
import { InputNode } from '../core/InputNode.js';
|
2
|
-
|
3
|
-
function BoolNode(value) {
|
4
|
-
InputNode.call(this, 'b');
|
5
|
-
this.value = Boolean(value);
|
6
|
-
}
|
7
|
-
|
8
|
-
BoolNode.prototype = Object.create(InputNode.prototype);
|
9
|
-
BoolNode.prototype.constructor = BoolNode;
|
10
|
-
BoolNode.prototype.nodeType = 'Bool';
|
11
|
-
|
12
|
-
BoolNode.prototype.generateReadonly = function (builder, output, uuid, type
|
13
|
-
/*, ns, needsUpdate */
|
14
|
-
) {
|
15
|
-
return builder.format(this.value, type, output);
|
16
|
-
};
|
17
|
-
|
18
|
-
BoolNode.prototype.copy = function (source) {
|
19
|
-
InputNode.prototype.copy.call(this, source);
|
20
|
-
this.value = source.value;
|
21
|
-
return this;
|
22
|
-
};
|
23
|
-
|
24
|
-
BoolNode.prototype.toJSON = function (meta) {
|
25
|
-
var data = this.getJSONNode(meta);
|
26
|
-
|
27
|
-
if (!data) {
|
28
|
-
data = this.createJSONNode(meta);
|
29
|
-
data.value = this.value;
|
30
|
-
if (this.readonly === true) data.readonly = true;
|
31
|
-
}
|
32
|
-
|
33
|
-
return data;
|
34
|
-
};
|
35
|
-
|
36
|
-
export { BoolNode };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),t=require("../core/InputNode.cjs.js"),o=require("../core/NodeUtils.cjs.js");function r(o,r,s){t.InputNode.call(this,"c"),this.value=o instanceof e.Color?o:new e.Color(o||0,r,s)}require("../core/TempNode.cjs.js"),require("../core/Node.cjs.js"),r.prototype=Object.create(t.InputNode.prototype),r.prototype.constructor=r,r.prototype.nodeType="Color",o.NodeUtils.addShortcuts(r.prototype,"value",["r","g","b"]),r.prototype.generateReadonly=function(e,t,o,r){return e.format("vec3( "+this.r+", "+this.g+", "+this.b+" )",r,t)},r.prototype.copy=function(e){return t.InputNode.prototype.copy.call(this,e),this.value.copy(e),this},r.prototype.toJSON=function(e){var t=this.getJSONNode(e);return t||((t=this.createJSONNode(e)).r=this.r,t.g=this.g,t.b=this.b,!0===this.readonly&&(t.readonly=!0)),t},exports.ColorNode=r;
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { Color, ColorRepresentation } from 'three';
|
2
|
-
|
3
|
-
import { InputNode } from '../core/InputNode';
|
4
|
-
import { NodeBuilder } from '../core/NodeBuilder';
|
5
|
-
|
6
|
-
export class ColorNode extends InputNode {
|
7
|
-
constructor(color: ColorRepresentation, g?: number, b?: number);
|
8
|
-
|
9
|
-
value: Color;
|
10
|
-
nodeType: string;
|
11
|
-
|
12
|
-
generateReadonly(
|
13
|
-
builder: NodeBuilder,
|
14
|
-
output: string,
|
15
|
-
uuid?: string,
|
16
|
-
type?: string,
|
17
|
-
ns?: string,
|
18
|
-
needsUpdate?: boolean,
|
19
|
-
): string;
|
20
|
-
copy(source: ColorNode): this;
|
21
|
-
}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
import { Color } from 'three';
|
2
|
-
import { InputNode } from '../core/InputNode.js';
|
3
|
-
import { NodeUtils } from '../core/NodeUtils.js';
|
4
|
-
|
5
|
-
function ColorNode(color, g, b) {
|
6
|
-
InputNode.call(this, 'c');
|
7
|
-
this.value = color instanceof Color ? color : new Color(color || 0, g, b);
|
8
|
-
}
|
9
|
-
|
10
|
-
ColorNode.prototype = Object.create(InputNode.prototype);
|
11
|
-
ColorNode.prototype.constructor = ColorNode;
|
12
|
-
ColorNode.prototype.nodeType = 'Color';
|
13
|
-
NodeUtils.addShortcuts(ColorNode.prototype, 'value', ['r', 'g', 'b']);
|
14
|
-
|
15
|
-
ColorNode.prototype.generateReadonly = function (builder, output, uuid, type
|
16
|
-
/*, ns, needsUpdate */
|
17
|
-
) {
|
18
|
-
return builder.format('vec3( ' + this.r + ', ' + this.g + ', ' + this.b + ' )', type, output);
|
19
|
-
};
|
20
|
-
|
21
|
-
ColorNode.prototype.copy = function (source) {
|
22
|
-
InputNode.prototype.copy.call(this, source);
|
23
|
-
this.value.copy(source);
|
24
|
-
return this;
|
25
|
-
};
|
26
|
-
|
27
|
-
ColorNode.prototype.toJSON = function (meta) {
|
28
|
-
var data = this.getJSONNode(meta);
|
29
|
-
|
30
|
-
if (!data) {
|
31
|
-
data = this.createJSONNode(meta);
|
32
|
-
data.r = this.r;
|
33
|
-
data.g = this.g;
|
34
|
-
data.b = this.b;
|
35
|
-
if (this.readonly === true) data.readonly = true;
|
36
|
-
}
|
37
|
-
|
38
|
-
return data;
|
39
|
-
};
|
40
|
-
|
41
|
-
export { ColorNode };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../core/InputNode.cjs.js"),t=require("../accessors/ReflectNode.cjs.js"),o=require("../utils/ColorSpaceNode.cjs.js"),r=require("../core/ExpressionNode.cjs.js");function s(o,r,s){e.InputNode.call(this,"v4",{shared:!0}),this.value=o,this.uv=r||new t.ReflectNode,this.bias=s}require("../core/TempNode.cjs.js"),require("three"),require("../core/Node.cjs.js"),require("../accessors/PositionNode.cjs.js"),require("../core/NodeLib.cjs.js"),require("../accessors/NormalNode.cjs.js"),require("../core/ConstNode.cjs.js"),require("../core/FunctionNode.cjs.js"),s.prototype=Object.create(e.InputNode.prototype),s.prototype.constructor=s,s.prototype.nodeType="CubeTexture",s.prototype.getTexture=function(t,o){return e.InputNode.prototype.generate.call(this,t,o,this.value.uuid,"tc")},s.prototype.generate=function(e,t){if("samplerCube"===t)return this.getTexture(e,t);var s,i=this.getTexture(e,t),u=this.uv.build(e,"v3"),c=this.bias?this.bias.build(e,"f"):void 0;void 0===c&&e.context.bias&&(c=e.context.bias.setTexture(this).build(e,"f")),s=c?"texCubeBias( "+i+", "+u+", "+c+" )":"texCube( "+i+", "+u+" )";var a={include:e.isShader("vertex"),ignoreCache:!0},p=this.getType(e);return e.addContext(a),this.colorSpace=this.colorSpace||new o.ColorSpaceNode(new r.ExpressionNode("",p)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(s),s=this.colorSpace.build(e,p),e.removeContext(),e.format(s,p,t)},s.prototype.copy=function(t){return e.InputNode.prototype.copy.call(this,t),t.value&&(this.value=t.value),this.uv=t.uv,t.bias&&(this.bias=t.bias),this},s.prototype.toJSON=function(e){var t=this.getJSONNode(e);return t||((t=this.createJSONNode(e)).value=this.value.uuid,t.uv=this.uv.toJSON(e).uuid,this.bias&&(t.bias=this.bias.toJSON(e).uuid)),t},exports.CubeTextureNode=s;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { CubeTexture } from 'three';
|
2
|
-
|
3
|
-
import { InputNode } from '../core/InputNode';
|
4
|
-
import { Node } from '../core/Node';
|
5
|
-
import { NodeBuilder } from '../core/NodeBuilder';
|
6
|
-
|
7
|
-
export class CubeTextureNode extends InputNode {
|
8
|
-
constructor(value: CubeTexture, uv?: Node, bias?: Node);
|
9
|
-
|
10
|
-
value: CubeTexture;
|
11
|
-
uv: Node | undefined;
|
12
|
-
bias: Node | undefined;
|
13
|
-
nodeType: string;
|
14
|
-
|
15
|
-
getTexture(builder: NodeBuilder, output: string): string;
|
16
|
-
copy(source: CubeTextureNode): this;
|
17
|
-
}
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import { InputNode } from '../core/InputNode.js';
|
2
|
-
import { ReflectNode } from '../accessors/ReflectNode.js';
|
3
|
-
import { ColorSpaceNode } from '../utils/ColorSpaceNode.js';
|
4
|
-
import { ExpressionNode } from '../core/ExpressionNode.js';
|
5
|
-
|
6
|
-
function CubeTextureNode(value, uv, bias) {
|
7
|
-
InputNode.call(this, 'v4', {
|
8
|
-
shared: true
|
9
|
-
});
|
10
|
-
this.value = value;
|
11
|
-
this.uv = uv || new ReflectNode();
|
12
|
-
this.bias = bias;
|
13
|
-
}
|
14
|
-
|
15
|
-
CubeTextureNode.prototype = Object.create(InputNode.prototype);
|
16
|
-
CubeTextureNode.prototype.constructor = CubeTextureNode;
|
17
|
-
CubeTextureNode.prototype.nodeType = 'CubeTexture';
|
18
|
-
|
19
|
-
CubeTextureNode.prototype.getTexture = function (builder, output) {
|
20
|
-
return InputNode.prototype.generate.call(this, builder, output, this.value.uuid, 'tc');
|
21
|
-
};
|
22
|
-
|
23
|
-
CubeTextureNode.prototype.generate = function (builder, output) {
|
24
|
-
if (output === 'samplerCube') {
|
25
|
-
return this.getTexture(builder, output);
|
26
|
-
}
|
27
|
-
|
28
|
-
var cubetex = this.getTexture(builder, output);
|
29
|
-
var uv = this.uv.build(builder, 'v3');
|
30
|
-
var bias = this.bias ? this.bias.build(builder, 'f') : undefined;
|
31
|
-
|
32
|
-
if (bias === undefined && builder.context.bias) {
|
33
|
-
bias = builder.context.bias.setTexture(this).build(builder, 'f');
|
34
|
-
}
|
35
|
-
|
36
|
-
var code;
|
37
|
-
if (bias) code = 'texCubeBias( ' + cubetex + ', ' + uv + ', ' + bias + ' )';else code = 'texCube( ' + cubetex + ', ' + uv + ' )'; // add a custom context for fix incompatibility with the core
|
38
|
-
// include ColorSpace function only for vertex shader (in fragment shader color space functions is added automatically by core)
|
39
|
-
// this should be removed in the future
|
40
|
-
// context.include =: is used to include or not functions if used FunctionNode
|
41
|
-
// context.ignoreCache =: not create variables temp nodeT0..9 to optimize the code
|
42
|
-
|
43
|
-
var context = {
|
44
|
-
include: builder.isShader('vertex'),
|
45
|
-
ignoreCache: true
|
46
|
-
};
|
47
|
-
var outputType = this.getType(builder);
|
48
|
-
builder.addContext(context);
|
49
|
-
this.colorSpace = this.colorSpace || new ColorSpaceNode(new ExpressionNode('', outputType));
|
50
|
-
this.colorSpace.fromDecoding(builder.getTextureEncodingFromMap(this.value));
|
51
|
-
this.colorSpace.input.parse(code);
|
52
|
-
code = this.colorSpace.build(builder, outputType); // end custom context
|
53
|
-
|
54
|
-
builder.removeContext();
|
55
|
-
return builder.format(code, outputType, output);
|
56
|
-
};
|
57
|
-
|
58
|
-
CubeTextureNode.prototype.copy = function (source) {
|
59
|
-
InputNode.prototype.copy.call(this, source);
|
60
|
-
if (source.value) this.value = source.value;
|
61
|
-
this.uv = source.uv;
|
62
|
-
if (source.bias) this.bias = source.bias;
|
63
|
-
return this;
|
64
|
-
};
|
65
|
-
|
66
|
-
CubeTextureNode.prototype.toJSON = function (meta) {
|
67
|
-
var data = this.getJSONNode(meta);
|
68
|
-
|
69
|
-
if (!data) {
|
70
|
-
data = this.createJSONNode(meta);
|
71
|
-
data.value = this.value.uuid;
|
72
|
-
data.uv = this.uv.toJSON(meta).uuid;
|
73
|
-
if (this.bias) data.bias = this.bias.toJSON(meta).uuid;
|
74
|
-
}
|
75
|
-
|
76
|
-
return data;
|
77
|
-
};
|
78
|
-
|
79
|
-
export { CubeTextureNode };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../core/InputNode.cjs.js");function t(t){e.InputNode.call(this,"f"),this.value=t||0}require("../core/TempNode.cjs.js"),require("three"),require("../core/Node.cjs.js"),t.prototype=Object.create(e.InputNode.prototype),t.prototype.constructor=t,t.prototype.nodeType="Float",t.prototype.generateReadonly=function(e,t,o,r){return e.format(this.value+(this.value%1?"":".0"),r,t)},t.prototype.copy=function(t){return e.InputNode.prototype.copy.call(this,t),this.value=t.value,this},t.prototype.toJSON=function(e){var t=this.getJSONNode(e);return t||((t=this.createJSONNode(e)).value=this.value,!0===this.readonly&&(t.readonly=!0)),t},exports.FloatNode=t;
|