three-stdlib 2.8.8 → 2.8.11
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,55 +0,0 @@
|
|
1
|
-
import { Node } from '../core/Node';
|
2
|
-
import { TempNode } from '../core/TempNode';
|
3
|
-
import { FunctionNode } from '../core/FunctionNode';
|
4
|
-
|
5
|
-
export class ColorSpaceNode extends TempNode {
|
6
|
-
constructor(input: Node, method?: string);
|
7
|
-
|
8
|
-
input: Node;
|
9
|
-
method: string | undefined;
|
10
|
-
nodeType: string;
|
11
|
-
|
12
|
-
fromEncoding(encoding: number): void;
|
13
|
-
fromDecoding(): void;
|
14
|
-
copy(source: ColorSpaceNode): this;
|
15
|
-
|
16
|
-
static Nodes: {
|
17
|
-
LinearToLinear: FunctionNode;
|
18
|
-
GammaToLinear: FunctionNode;
|
19
|
-
LinearToGamma: FunctionNode;
|
20
|
-
sRGBToLinear: FunctionNode;
|
21
|
-
LinearTosRGB: FunctionNode;
|
22
|
-
RGBEToLinear: FunctionNode;
|
23
|
-
LinearToRGBE: FunctionNode;
|
24
|
-
RGBMToLinear: FunctionNode;
|
25
|
-
LinearToRGBM: FunctionNode;
|
26
|
-
RGBDToLinear: FunctionNode;
|
27
|
-
LinearToRGBD: FunctionNode;
|
28
|
-
cLogLuvM: FunctionNode;
|
29
|
-
LinearToLogLuv: FunctionNode;
|
30
|
-
cLogLuvInverseM: FunctionNode;
|
31
|
-
LogLuvToLinear: FunctionNode;
|
32
|
-
};
|
33
|
-
|
34
|
-
static LINEAR_TO_LINEAR: string;
|
35
|
-
|
36
|
-
static GAMMA_TO_LINEAR: string;
|
37
|
-
static LINEAR_TO_GAMMA: string;
|
38
|
-
|
39
|
-
static SRGB_TO_LINEAR: string;
|
40
|
-
static LINEAR_TO_SRGB: string;
|
41
|
-
|
42
|
-
static RGBE_TO_LINEAR: string;
|
43
|
-
static LINEAR_TO_RGBE: string;
|
44
|
-
|
45
|
-
static RGBM_TO_LINEAR: string;
|
46
|
-
static LINEAR_TO_RGBM: string;
|
47
|
-
|
48
|
-
static RGBD_TO_LINEAR: string;
|
49
|
-
static LINEAR_TO_RGBD: string;
|
50
|
-
|
51
|
-
static LINEAR_TO_LOG_LUV: string;
|
52
|
-
static LOG_LUV_TO_LINEAR: string;
|
53
|
-
|
54
|
-
static getEncodingComponents(encoding: number): any[];
|
55
|
-
}
|
@@ -1,106 +0,0 @@
|
|
1
|
-
import { sRGBEncoding, LinearEncoding } from 'three';
|
2
|
-
import { TempNode } from '../core/TempNode.js';
|
3
|
-
import { ConstNode } from '../core/ConstNode.js';
|
4
|
-
import { FunctionNode } from '../core/FunctionNode.js';
|
5
|
-
|
6
|
-
function ColorSpaceNode(input, method) {
|
7
|
-
TempNode.call(this, 'v4');
|
8
|
-
this.input = input;
|
9
|
-
this.method = method || ColorSpaceNode.LINEAR_TO_LINEAR;
|
10
|
-
}
|
11
|
-
|
12
|
-
ColorSpaceNode.Nodes = function () {
|
13
|
-
var LinearToLinear = new FunctionNode(['vec4 LinearToLinear( in vec4 value ) {', ' return value;', '}'].join('\n'));
|
14
|
-
var sRGBToLinear = new FunctionNode(['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 );', '}'].join('\n'));
|
15
|
-
var LinearTosRGB = new FunctionNode(['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 );', '}'].join('\n')); // LogLuv reference: http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html
|
16
|
-
// M matrix, for encoding
|
17
|
-
|
18
|
-
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 );');
|
19
|
-
var LinearToLogLuv = new FunctionNode(['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;', '}'].join('\n'), [cLogLuvM]); // Inverse M matrix, for decoding
|
20
|
-
|
21
|
-
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 );');
|
22
|
-
var LogLuvToLinear = new FunctionNode(['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 );', '}'].join('\n'), [cLogLuvInverseM]);
|
23
|
-
return {
|
24
|
-
LinearToLinear: LinearToLinear,
|
25
|
-
sRGBToLinear: sRGBToLinear,
|
26
|
-
LinearTosRGB: LinearTosRGB,
|
27
|
-
cLogLuvM: cLogLuvM,
|
28
|
-
LinearToLogLuv: LinearToLogLuv,
|
29
|
-
cLogLuvInverseM: cLogLuvInverseM,
|
30
|
-
LogLuvToLinear: LogLuvToLinear
|
31
|
-
};
|
32
|
-
}();
|
33
|
-
|
34
|
-
ColorSpaceNode.LINEAR_TO_LINEAR = 'LinearToLinear';
|
35
|
-
ColorSpaceNode.SRGB_TO_LINEAR = 'sRGBToLinear';
|
36
|
-
ColorSpaceNode.LINEAR_TO_SRGB = 'LinearTosRGB';
|
37
|
-
ColorSpaceNode.RGBE_TO_LINEAR = 'RGBEToLinear';
|
38
|
-
ColorSpaceNode.LINEAR_TO_RGBE = 'LinearToRGBE';
|
39
|
-
ColorSpaceNode.LINEAR_TO_LOG_LUV = 'LinearToLogLuv';
|
40
|
-
ColorSpaceNode.LOG_LUV_TO_LINEAR = 'LogLuvToLinear';
|
41
|
-
|
42
|
-
ColorSpaceNode.getEncodingComponents = function (encoding) {
|
43
|
-
switch (encoding) {
|
44
|
-
case LinearEncoding:
|
45
|
-
return ['Linear'];
|
46
|
-
|
47
|
-
case sRGBEncoding:
|
48
|
-
return ['sRGB'];
|
49
|
-
}
|
50
|
-
};
|
51
|
-
|
52
|
-
ColorSpaceNode.prototype = Object.create(TempNode.prototype);
|
53
|
-
ColorSpaceNode.prototype.constructor = ColorSpaceNode;
|
54
|
-
ColorSpaceNode.prototype.nodeType = 'ColorSpace';
|
55
|
-
ColorSpaceNode.prototype.hashProperties = ['method'];
|
56
|
-
|
57
|
-
ColorSpaceNode.prototype.generate = function (builder, output) {
|
58
|
-
var input = this.input.build(builder, 'v4');
|
59
|
-
var outputType = this.getType(builder);
|
60
|
-
var methodNode = ColorSpaceNode.Nodes[this.method];
|
61
|
-
var method = builder.include(methodNode);
|
62
|
-
|
63
|
-
if (method === ColorSpaceNode.LINEAR_TO_LINEAR) {
|
64
|
-
return builder.format(input, outputType, output);
|
65
|
-
} else {
|
66
|
-
if (methodNode.inputs.length === 2) {
|
67
|
-
var factor = this.factor.build(builder, 'f');
|
68
|
-
return builder.format(method + '( ' + input + ', ' + factor + ' )', outputType, output);
|
69
|
-
} else {
|
70
|
-
return builder.format(method + '( ' + input + ' )', outputType, output);
|
71
|
-
}
|
72
|
-
}
|
73
|
-
};
|
74
|
-
|
75
|
-
ColorSpaceNode.prototype.fromEncoding = function (encoding) {
|
76
|
-
var components = ColorSpaceNode.getEncodingComponents(encoding);
|
77
|
-
this.method = 'LinearTo' + components[0];
|
78
|
-
this.factor = components[1];
|
79
|
-
};
|
80
|
-
|
81
|
-
ColorSpaceNode.prototype.fromDecoding = function (encoding) {
|
82
|
-
var components = ColorSpaceNode.getEncodingComponents(encoding);
|
83
|
-
this.method = components[0] + 'ToLinear';
|
84
|
-
this.factor = components[1];
|
85
|
-
};
|
86
|
-
|
87
|
-
ColorSpaceNode.prototype.copy = function (source) {
|
88
|
-
TempNode.prototype.copy.call(this, source);
|
89
|
-
this.input = source.input;
|
90
|
-
this.method = source.method;
|
91
|
-
return this;
|
92
|
-
};
|
93
|
-
|
94
|
-
ColorSpaceNode.prototype.toJSON = function (meta) {
|
95
|
-
var data = this.getJSONNode(meta);
|
96
|
-
|
97
|
-
if (!data) {
|
98
|
-
data = this.createJSONNode(meta);
|
99
|
-
data.input = this.input.toJSON(meta).uuid;
|
100
|
-
data.method = this.method;
|
101
|
-
}
|
102
|
-
|
103
|
-
return data;
|
104
|
-
};
|
105
|
-
|
106
|
-
export { ColorSpaceNode };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../inputs/FloatNode.cjs.js");function t(t){e.FloatNode.call(this),this.texture=t,this.maxMIPLevel=0}require("../core/InputNode.cjs.js"),require("../core/TempNode.cjs.js"),require("three"),require("../core/Node.cjs.js"),t.prototype=Object.create(e.FloatNode.prototype),t.prototype.constructor=t,t.prototype.nodeType="MaxMIPLevel",Object.defineProperties(t.prototype,{value:{get:function(){if(0===this.maxMIPLevel){var e=this.texture.value.image;Array.isArray(e)&&(e=e[0]),this.maxMIPLevel=void 0!==e?Math.log(Math.max(e.width,e.height))*Math.LOG2E:0}return this.maxMIPLevel},set:function(){}}}),t.prototype.toJSON=function(e){var t=this.getJSONNode(e);return t||((t=this.createJSONNode(e)).texture=this.texture.uuid),t},exports.MaxMIPLevelNode=t;
|
@@ -1,38 +0,0 @@
|
|
1
|
-
import { FloatNode } from '../inputs/FloatNode.js';
|
2
|
-
|
3
|
-
function MaxMIPLevelNode(texture) {
|
4
|
-
FloatNode.call(this);
|
5
|
-
this.texture = texture;
|
6
|
-
this.maxMIPLevel = 0;
|
7
|
-
}
|
8
|
-
|
9
|
-
MaxMIPLevelNode.prototype = Object.create(FloatNode.prototype);
|
10
|
-
MaxMIPLevelNode.prototype.constructor = MaxMIPLevelNode;
|
11
|
-
MaxMIPLevelNode.prototype.nodeType = 'MaxMIPLevel';
|
12
|
-
Object.defineProperties(MaxMIPLevelNode.prototype, {
|
13
|
-
value: {
|
14
|
-
get: function () {
|
15
|
-
if (this.maxMIPLevel === 0) {
|
16
|
-
var image = this.texture.value.image;
|
17
|
-
if (Array.isArray(image)) image = image[0];
|
18
|
-
this.maxMIPLevel = image !== undefined ? Math.log(Math.max(image.width, image.height)) * Math.LOG2E : 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
return this.maxMIPLevel;
|
22
|
-
},
|
23
|
-
set: function () {}
|
24
|
-
}
|
25
|
-
});
|
26
|
-
|
27
|
-
MaxMIPLevelNode.prototype.toJSON = function (meta) {
|
28
|
-
var data = this.getJSONNode(meta);
|
29
|
-
|
30
|
-
if (!data) {
|
31
|
-
data = this.createJSONNode(meta);
|
32
|
-
data.texture = this.texture.uuid;
|
33
|
-
}
|
34
|
-
|
35
|
-
return data;
|
36
|
-
};
|
37
|
-
|
38
|
-
export { MaxMIPLevelNode };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../core/TempNode.cjs.js"),t=require("../core/FunctionNode.cjs.js"),r=require("./MaxMIPLevelNode.cjs.js");function o(t,r){e.TempNode.call(this,"f"),this.roughness=t,this.texture=r,this.maxMIPLevel=void 0}require("three"),require("../core/Node.cjs.js"),require("../core/NodeLib.cjs.js"),require("../inputs/FloatNode.cjs.js"),require("../core/InputNode.cjs.js"),o.Nodes={getSpecularMIPLevel:new t.FunctionNode(["float getSpecularMIPLevel( const in float roughness, const in float maxMIPLevelScalar ) {","\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );","\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );","\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );","}"].join("\n"))},o.prototype=Object.create(e.TempNode.prototype),o.prototype.constructor=o,o.prototype.nodeType="SpecularMIPLevel",o.prototype.setTexture=function(e){return this.texture=e,this},o.prototype.generate=function(e,t){if(e.isShader("fragment")){this.maxMIPLevel=this.maxMIPLevel||new r.MaxMIPLevelNode,this.maxMIPLevel.texture=this.texture;var s=e.include(o.Nodes.getSpecularMIPLevel);return e.format(s+"( "+this.roughness.build(e,"f")+", "+this.maxMIPLevel.build(e,"f")+" )",this.type,t)}return console.warn("THREE.SpecularMIPLevelNode is not compatible with "+e.shader+" shader."),e.format("0.0",this.type,t)},o.prototype.copy=function(t){return e.TempNode.prototype.copy.call(this,t),this.texture=t.texture,this.roughness=t.roughness,this},o.prototype.toJSON=function(e){var t=this.getJSONNode(e);return t||((t=this.createJSONNode(e)).texture=this.texture,t.roughness=this.roughness),t},exports.SpecularMIPLevelNode=o;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { TempNode } from '../core/TempNode';
|
2
|
-
import { MaxMIPLevelNode } from '../utils/MaxMIPLevelNode';
|
3
|
-
import { FunctionNode } from '../core/FunctionNode';
|
4
|
-
|
5
|
-
export class SpecularMIPLevelNode extends TempNode {
|
6
|
-
constructor(texture: Node);
|
7
|
-
|
8
|
-
texture: Node;
|
9
|
-
maxMIPLevel: MaxMIPLevelNode;
|
10
|
-
nodeType: string;
|
11
|
-
|
12
|
-
copy(source: SpecularMIPLevelNode): this;
|
13
|
-
|
14
|
-
static Nodes: {
|
15
|
-
getSpecularMIPLevel: FunctionNode;
|
16
|
-
};
|
17
|
-
}
|
@@ -1,61 +0,0 @@
|
|
1
|
-
import { TempNode } from '../core/TempNode.js';
|
2
|
-
import { FunctionNode } from '../core/FunctionNode.js';
|
3
|
-
import { MaxMIPLevelNode } from './MaxMIPLevelNode.js';
|
4
|
-
|
5
|
-
function SpecularMIPLevelNode(roughness, texture) {
|
6
|
-
TempNode.call(this, 'f');
|
7
|
-
this.roughness = roughness;
|
8
|
-
this.texture = texture;
|
9
|
-
this.maxMIPLevel = undefined;
|
10
|
-
}
|
11
|
-
|
12
|
-
SpecularMIPLevelNode.Nodes = function () {
|
13
|
-
var getSpecularMIPLevel = new FunctionNode([// taken from here: http://casual-effects.blogspot.ca/2011/08/plausible-environment-lighting-in-two.html
|
14
|
-
'float getSpecularMIPLevel( const in float roughness, const in float maxMIPLevelScalar ) {', ' float sigma = PI * roughness * roughness / ( 1.0 + roughness );', ' float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );', // clamp to allowable LOD ranges.
|
15
|
-
' return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );', '}'].join('\n'));
|
16
|
-
return {
|
17
|
-
getSpecularMIPLevel: getSpecularMIPLevel
|
18
|
-
};
|
19
|
-
}();
|
20
|
-
|
21
|
-
SpecularMIPLevelNode.prototype = Object.create(TempNode.prototype);
|
22
|
-
SpecularMIPLevelNode.prototype.constructor = SpecularMIPLevelNode;
|
23
|
-
SpecularMIPLevelNode.prototype.nodeType = 'SpecularMIPLevel';
|
24
|
-
|
25
|
-
SpecularMIPLevelNode.prototype.setTexture = function (texture) {
|
26
|
-
this.texture = texture;
|
27
|
-
return this;
|
28
|
-
};
|
29
|
-
|
30
|
-
SpecularMIPLevelNode.prototype.generate = function (builder, output) {
|
31
|
-
if (builder.isShader('fragment')) {
|
32
|
-
this.maxMIPLevel = this.maxMIPLevel || new MaxMIPLevelNode();
|
33
|
-
this.maxMIPLevel.texture = this.texture;
|
34
|
-
var getSpecularMIPLevel = builder.include(SpecularMIPLevelNode.Nodes.getSpecularMIPLevel);
|
35
|
-
return builder.format(getSpecularMIPLevel + '( ' + this.roughness.build(builder, 'f') + ', ' + this.maxMIPLevel.build(builder, 'f') + ' )', this.type, output);
|
36
|
-
} else {
|
37
|
-
console.warn('THREE.SpecularMIPLevelNode is not compatible with ' + builder.shader + ' shader.');
|
38
|
-
return builder.format('0.0', this.type, output);
|
39
|
-
}
|
40
|
-
};
|
41
|
-
|
42
|
-
SpecularMIPLevelNode.prototype.copy = function (source) {
|
43
|
-
TempNode.prototype.copy.call(this, source);
|
44
|
-
this.texture = source.texture;
|
45
|
-
this.roughness = source.roughness;
|
46
|
-
return this;
|
47
|
-
};
|
48
|
-
|
49
|
-
SpecularMIPLevelNode.prototype.toJSON = function (meta) {
|
50
|
-
var data = this.getJSONNode(meta);
|
51
|
-
|
52
|
-
if (!data) {
|
53
|
-
data = this.createJSONNode(meta);
|
54
|
-
data.texture = this.texture;
|
55
|
-
data.roughness = this.roughness;
|
56
|
-
}
|
57
|
-
|
58
|
-
return data;
|
59
|
-
};
|
60
|
-
|
61
|
-
export { SpecularMIPLevelNode };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../core/TempNode.cjs.js");function o(o){t.TempNode.call(this),this.slots=o||{}}require("three"),require("../core/Node.cjs.js"),o.prototype=Object.create(t.TempNode.prototype),o.prototype.constructor=o,o.prototype.nodeType="SubSlot",o.prototype.getType=function(t,o){return o},o.prototype.generate=function(t,o){return this.slots[t.slot]?this.slots[t.slot].build(t,o):t.format("0.0","f",o)},o.prototype.copy=function(o){t.TempNode.prototype.copy.call(this,o);for(let t in o.slots)this.slots[t]=o.slots[t];return this},o.prototype.toJSON=function(t){var o=this.getJSONNode(t);if(!o){(o=this.createJSONNode(t)).slots={};for(let s in this.slots){var e=this.slots[s];e&&(o.slots[s]=e.toJSON(t).uuid)}}return o},exports.SubSlotNode=o;
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import { TempNode } from '../core/TempNode.js';
|
2
|
-
|
3
|
-
function SubSlotNode(slots) {
|
4
|
-
TempNode.call(this);
|
5
|
-
this.slots = slots || {};
|
6
|
-
}
|
7
|
-
|
8
|
-
SubSlotNode.prototype = Object.create(TempNode.prototype);
|
9
|
-
SubSlotNode.prototype.constructor = SubSlotNode;
|
10
|
-
SubSlotNode.prototype.nodeType = 'SubSlot';
|
11
|
-
|
12
|
-
SubSlotNode.prototype.getType = function (builder, output) {
|
13
|
-
return output;
|
14
|
-
};
|
15
|
-
|
16
|
-
SubSlotNode.prototype.generate = function (builder, output) {
|
17
|
-
if (this.slots[builder.slot]) {
|
18
|
-
return this.slots[builder.slot].build(builder, output);
|
19
|
-
}
|
20
|
-
|
21
|
-
return builder.format('0.0', 'f', output);
|
22
|
-
};
|
23
|
-
|
24
|
-
SubSlotNode.prototype.copy = function (source) {
|
25
|
-
TempNode.prototype.copy.call(this, source);
|
26
|
-
|
27
|
-
for (let prop in source.slots) {
|
28
|
-
this.slots[prop] = source.slots[prop];
|
29
|
-
}
|
30
|
-
|
31
|
-
return this;
|
32
|
-
};
|
33
|
-
|
34
|
-
SubSlotNode.prototype.toJSON = function (meta) {
|
35
|
-
var data = this.getJSONNode(meta);
|
36
|
-
|
37
|
-
if (!data) {
|
38
|
-
data = this.createJSONNode(meta);
|
39
|
-
data.slots = {};
|
40
|
-
|
41
|
-
for (let prop in this.slots) {
|
42
|
-
var slot = this.slots[prop];
|
43
|
-
|
44
|
-
if (slot) {
|
45
|
-
data.slots[prop] = slot.toJSON(meta).uuid;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
return data;
|
51
|
-
};
|
52
|
-
|
53
|
-
export { SubSlotNode };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../core/Node.cjs.js");function t(t,o){e.Node.call(this),this.node=t,this.components=o||"x"}require("three"),t.prototype=Object.create(e.Node.prototype),t.prototype.constructor=t,t.prototype.nodeType="Switch",t.prototype.getType=function(e){return e.getTypeFromLength(this.components.length)},t.prototype.generate=function(e,t){var o=this.node.getType(e),r=this.node.build(e,o),n=e.getTypeLength(o)-1;if(n>0){var p,s=0,c=e.colorToVectorProperties(this.components),i=c.length;for(p=0;p<i;p++)s=Math.max(s,e.getIndexByElement(c.charAt(p)));for(s>n&&(s=n),r+=".",p=0;p<i;p++){var h=e.getIndexByElement(c.charAt(p));h>s&&(h=s),r+=e.getElementByIndex(h)}return e.format(r,this.getType(e),t)}return e.format(r,o,t)},t.prototype.copy=function(t){return e.Node.prototype.copy.call(this,t),this.node=t.node,this.components=t.components,this},t.prototype.toJSON=function(e){var t=this.getJSONNode(e);return t||((t=this.createJSONNode(e)).node=this.node.toJSON(e).uuid,t.components=this.components),t},exports.SwitchNode=t;
|
@@ -1,69 +0,0 @@
|
|
1
|
-
import { Node } from '../core/Node.js';
|
2
|
-
|
3
|
-
function SwitchNode(node, components) {
|
4
|
-
Node.call(this);
|
5
|
-
this.node = node;
|
6
|
-
this.components = components || 'x';
|
7
|
-
}
|
8
|
-
|
9
|
-
SwitchNode.prototype = Object.create(Node.prototype);
|
10
|
-
SwitchNode.prototype.constructor = SwitchNode;
|
11
|
-
SwitchNode.prototype.nodeType = 'Switch';
|
12
|
-
|
13
|
-
SwitchNode.prototype.getType = function (builder) {
|
14
|
-
return builder.getTypeFromLength(this.components.length);
|
15
|
-
};
|
16
|
-
|
17
|
-
SwitchNode.prototype.generate = function (builder, output) {
|
18
|
-
var type = this.node.getType(builder),
|
19
|
-
node = this.node.build(builder, type),
|
20
|
-
inputLength = builder.getTypeLength(type) - 1;
|
21
|
-
|
22
|
-
if (inputLength > 0) {
|
23
|
-
// get max length
|
24
|
-
var outputLength = 0,
|
25
|
-
components = builder.colorToVectorProperties(this.components);
|
26
|
-
var i,
|
27
|
-
len = components.length;
|
28
|
-
|
29
|
-
for (i = 0; i < len; i++) {
|
30
|
-
outputLength = Math.max(outputLength, builder.getIndexByElement(components.charAt(i)));
|
31
|
-
}
|
32
|
-
|
33
|
-
if (outputLength > inputLength) outputLength = inputLength; // split
|
34
|
-
|
35
|
-
node += '.';
|
36
|
-
|
37
|
-
for (i = 0; i < len; i++) {
|
38
|
-
var idx = builder.getIndexByElement(components.charAt(i));
|
39
|
-
if (idx > outputLength) idx = outputLength;
|
40
|
-
node += builder.getElementByIndex(idx);
|
41
|
-
}
|
42
|
-
|
43
|
-
return builder.format(node, this.getType(builder), output);
|
44
|
-
} else {
|
45
|
-
// join
|
46
|
-
return builder.format(node, type, output);
|
47
|
-
}
|
48
|
-
};
|
49
|
-
|
50
|
-
SwitchNode.prototype.copy = function (source) {
|
51
|
-
Node.prototype.copy.call(this, source);
|
52
|
-
this.node = source.node;
|
53
|
-
this.components = source.components;
|
54
|
-
return this;
|
55
|
-
};
|
56
|
-
|
57
|
-
SwitchNode.prototype.toJSON = function (meta) {
|
58
|
-
var data = this.getJSONNode(meta);
|
59
|
-
|
60
|
-
if (!data) {
|
61
|
-
data = this.createJSONNode(meta);
|
62
|
-
data.node = this.node.toJSON(meta).uuid;
|
63
|
-
data.components = this.components;
|
64
|
-
}
|
65
|
-
|
66
|
-
return data;
|
67
|
-
};
|
68
|
-
|
69
|
-
export { SwitchNode };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../core/ExpressionNode.cjs.js"),o=require("../inputs/Matrix3Node.cjs.js"),t=require("../accessors/UVNode.cjs.js");function r(r,s){e.ExpressionNode.call(this,"( uvTransform * vec3( uvNode, 1 ) ).xy","vec2"),this.uv=r||new t.UVNode,this.position=s||new o.Matrix3Node}require("../core/FunctionNode.cjs.js"),require("../core/TempNode.cjs.js"),require("three"),require("../core/Node.cjs.js"),require("../core/NodeLib.cjs.js"),require("../core/InputNode.cjs.js"),r.prototype=Object.create(e.ExpressionNode.prototype),r.prototype.constructor=r,r.prototype.nodeType="UVTransform",r.prototype.generate=function(o,t){return this.keywords.uvNode=this.uv,this.keywords.uvTransform=this.position,e.ExpressionNode.prototype.generate.call(this,o,t)},r.prototype.setUvTransform=function(e,o,t,r,s,i,n){i=void 0!==i?i:.5,n=void 0!==n?n:.5,this.position.value.setUvTransform(e,o,t,r,s,i,n)},r.prototype.copy=function(o){return e.ExpressionNode.prototype.copy.call(this,o),this.uv=o.uv,this.position=o.position,this},r.prototype.toJSON=function(e){var o=this.getJSONNode(e);return o||((o=this.createJSONNode(e)).uv=this.uv.toJSON(e).uuid,o.position=this.position.toJSON(e).uuid),o},exports.UVTransformNode=r;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { ExpressionNode } from '../core/ExpressionNode';
|
2
|
-
import { Matrix3Node } from '../inputs/Matrix3Node';
|
3
|
-
import { UVNode } from '../accessors/UVNode';
|
4
|
-
|
5
|
-
export class UVTransformNode extends ExpressionNode {
|
6
|
-
constructor(uv?: UVNode, position?: Matrix3Node);
|
7
|
-
|
8
|
-
uv: UVNode;
|
9
|
-
position: Matrix3Node;
|
10
|
-
|
11
|
-
nodeType: string;
|
12
|
-
|
13
|
-
setUvTransform(tx: number, ty: number, sx: number, sy: number, rotation: number, cx?: number, cy?: number): void;
|
14
|
-
copy(source: UVTransformNode): this;
|
15
|
-
}
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import { ExpressionNode } from '../core/ExpressionNode.js';
|
2
|
-
import { Matrix3Node } from '../inputs/Matrix3Node.js';
|
3
|
-
import { UVNode } from '../accessors/UVNode.js';
|
4
|
-
|
5
|
-
function UVTransformNode(uv, position) {
|
6
|
-
ExpressionNode.call(this, '( uvTransform * vec3( uvNode, 1 ) ).xy', 'vec2');
|
7
|
-
this.uv = uv || new UVNode();
|
8
|
-
this.position = position || new Matrix3Node();
|
9
|
-
}
|
10
|
-
|
11
|
-
UVTransformNode.prototype = Object.create(ExpressionNode.prototype);
|
12
|
-
UVTransformNode.prototype.constructor = UVTransformNode;
|
13
|
-
UVTransformNode.prototype.nodeType = 'UVTransform';
|
14
|
-
|
15
|
-
UVTransformNode.prototype.generate = function (builder, output) {
|
16
|
-
this.keywords['uvNode'] = this.uv;
|
17
|
-
this.keywords['uvTransform'] = this.position;
|
18
|
-
return ExpressionNode.prototype.generate.call(this, builder, output);
|
19
|
-
};
|
20
|
-
|
21
|
-
UVTransformNode.prototype.setUvTransform = function (tx, ty, sx, sy, rotation, cx, cy) {
|
22
|
-
cx = cx !== undefined ? cx : 0.5;
|
23
|
-
cy = cy !== undefined ? cy : 0.5;
|
24
|
-
this.position.value.setUvTransform(tx, ty, sx, sy, rotation, cx, cy);
|
25
|
-
};
|
26
|
-
|
27
|
-
UVTransformNode.prototype.copy = function (source) {
|
28
|
-
ExpressionNode.prototype.copy.call(this, source);
|
29
|
-
this.uv = source.uv;
|
30
|
-
this.position = source.position;
|
31
|
-
return this;
|
32
|
-
};
|
33
|
-
|
34
|
-
UVTransformNode.prototype.toJSON = function (meta) {
|
35
|
-
var data = this.getJSONNode(meta);
|
36
|
-
|
37
|
-
if (!data) {
|
38
|
-
data = this.createJSONNode(meta);
|
39
|
-
data.uv = this.uv.toJSON(meta).uuid;
|
40
|
-
data.position = this.position.toJSON(meta).uuid;
|
41
|
-
}
|
42
|
-
|
43
|
-
return data;
|
44
|
-
};
|
45
|
-
|
46
|
-
export { UVTransformNode };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("three"),e=require("../inputs/Vector3Node.cjs.js");function i(i,s){e.Vector3Node.call(this),this.params={},this.velocity=new t.Vector3,this.setTarget(i),this.setParams(s)}require("../core/InputNode.cjs.js"),require("../core/TempNode.cjs.js"),require("../core/Node.cjs.js"),require("../core/NodeUtils.cjs.js"),i.prototype=Object.create(e.Vector3Node.prototype),i.prototype.constructor=i,i.prototype.nodeType="Velocity",i.prototype.getReadonly=function(){return!1},i.prototype.setParams=function(e){switch(this.params.type){case"elastic":delete this.moment,delete this.speed,delete this.springVelocity,delete this.lastVelocity}switch(this.params=e||{},this.params.type){case"elastic":this.moment=new t.Vector3,this.speed=new t.Vector3,this.springVelocity=new t.Vector3,this.lastVelocity=new t.Vector3}},i.prototype.setTarget=function(e){this.target&&(delete this.position,delete this.oldPosition),this.target=e,e&&(this.position=e.getWorldPosition(this.position||new t.Vector3),this.oldPosition=this.position.clone())},i.prototype.updateFrameVelocity=function(){this.target&&(this.position=this.target.getWorldPosition(this.position||new t.Vector3),this.velocity.subVectors(this.position,this.oldPosition),this.oldPosition.copy(this.position))},i.prototype.updateFrame=function(t){switch(this.updateFrameVelocity(t),this.params.type){case"elastic":var e=t.delta*(this.params.fps||60),i=Math.pow(this.params.spring,e),s=Math.pow(this.params.damping,e);this.velocity.multiplyScalar(Math.exp(-this.params.damping*e)),this.velocity.add(this.springVelocity),this.velocity.add(this.speed.multiplyScalar(s).multiplyScalar(1-i)),this.speed.subVectors(this.velocity,this.lastVelocity),this.springVelocity.add(this.speed),this.springVelocity.multiplyScalar(i),this.moment.add(this.springVelocity),this.moment.multiplyScalar(s),this.lastVelocity.copy(this.velocity),this.value.copy(this.moment);break;default:this.value.copy(this.velocity)}},i.prototype.copy=function(t){return e.Vector3Node.prototype.copy.call(this,t),t.target&&this.setTarget(t.target),this.setParams(t.params),this},i.prototype.toJSON=function(t){var i=e.Vector3Node.prototype.toJSON.call(this,t);return this.target&&(i.target=this.target.uuid),i.params=JSON.parse(JSON.stringify(this.params)),i},exports.VelocityNode=i;
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import { Object3D, Vector3 } from 'three';
|
2
|
-
|
3
|
-
import { NodeFrame } from '../core/NodeFrame';
|
4
|
-
import { Vector3Node } from '../inputs/Vector3Node';
|
5
|
-
|
6
|
-
export interface VelocityNodeParams {
|
7
|
-
damping: number;
|
8
|
-
spring: number;
|
9
|
-
type: string;
|
10
|
-
}
|
11
|
-
|
12
|
-
export class VelocityNode extends Vector3Node {
|
13
|
-
constructor(target: Object3D, params?: VelocityNodeParams);
|
14
|
-
|
15
|
-
velocity: Vector3;
|
16
|
-
moment: Vector3 | undefined;
|
17
|
-
speed: Vector3 | undefined;
|
18
|
-
springVelocity: Vector3 | undefined;
|
19
|
-
lastVelocity: Vector3 | undefined;
|
20
|
-
|
21
|
-
nodeType: string;
|
22
|
-
|
23
|
-
setParams(params: VelocityNodeParams): void;
|
24
|
-
setTarget(target: Object3D): void;
|
25
|
-
updateFrameVelocity(frame: NodeFrame): void;
|
26
|
-
updateFrame(frame: NodeFrame): void;
|
27
|
-
copy(source: VelocityNode): this;
|
28
|
-
}
|
@@ -1,115 +0,0 @@
|
|
1
|
-
import { Vector3 } from 'three';
|
2
|
-
import { Vector3Node } from '../inputs/Vector3Node.js';
|
3
|
-
|
4
|
-
function VelocityNode(target, params) {
|
5
|
-
Vector3Node.call(this);
|
6
|
-
this.params = {};
|
7
|
-
this.velocity = new Vector3();
|
8
|
-
this.setTarget(target);
|
9
|
-
this.setParams(params);
|
10
|
-
}
|
11
|
-
|
12
|
-
VelocityNode.prototype = Object.create(Vector3Node.prototype);
|
13
|
-
VelocityNode.prototype.constructor = VelocityNode;
|
14
|
-
VelocityNode.prototype.nodeType = 'Velocity';
|
15
|
-
|
16
|
-
VelocityNode.prototype.getReadonly = function
|
17
|
-
/*builder*/
|
18
|
-
() {
|
19
|
-
return false;
|
20
|
-
};
|
21
|
-
|
22
|
-
VelocityNode.prototype.setParams = function (params) {
|
23
|
-
switch (this.params.type) {
|
24
|
-
case 'elastic':
|
25
|
-
delete this.moment;
|
26
|
-
delete this.speed;
|
27
|
-
delete this.springVelocity;
|
28
|
-
delete this.lastVelocity;
|
29
|
-
break;
|
30
|
-
}
|
31
|
-
|
32
|
-
this.params = params || {};
|
33
|
-
|
34
|
-
switch (this.params.type) {
|
35
|
-
case 'elastic':
|
36
|
-
this.moment = new Vector3();
|
37
|
-
this.speed = new Vector3();
|
38
|
-
this.springVelocity = new Vector3();
|
39
|
-
this.lastVelocity = new Vector3();
|
40
|
-
break;
|
41
|
-
}
|
42
|
-
};
|
43
|
-
|
44
|
-
VelocityNode.prototype.setTarget = function (target) {
|
45
|
-
if (this.target) {
|
46
|
-
delete this.position;
|
47
|
-
delete this.oldPosition;
|
48
|
-
}
|
49
|
-
|
50
|
-
this.target = target;
|
51
|
-
|
52
|
-
if (target) {
|
53
|
-
this.position = target.getWorldPosition(this.position || new Vector3());
|
54
|
-
this.oldPosition = this.position.clone();
|
55
|
-
}
|
56
|
-
};
|
57
|
-
|
58
|
-
VelocityNode.prototype.updateFrameVelocity = function
|
59
|
-
/*frame*/
|
60
|
-
() {
|
61
|
-
if (this.target) {
|
62
|
-
this.position = this.target.getWorldPosition(this.position || new Vector3());
|
63
|
-
this.velocity.subVectors(this.position, this.oldPosition);
|
64
|
-
this.oldPosition.copy(this.position);
|
65
|
-
}
|
66
|
-
};
|
67
|
-
|
68
|
-
VelocityNode.prototype.updateFrame = function (frame) {
|
69
|
-
this.updateFrameVelocity(frame);
|
70
|
-
|
71
|
-
switch (this.params.type) {
|
72
|
-
case 'elastic':
|
73
|
-
// convert to real scale: 0 at 1 values
|
74
|
-
var deltaFps = frame.delta * (this.params.fps || 60);
|
75
|
-
var spring = Math.pow(this.params.spring, deltaFps),
|
76
|
-
damping = Math.pow(this.params.damping, deltaFps); // fix relative frame-rate
|
77
|
-
|
78
|
-
this.velocity.multiplyScalar(Math.exp(-this.params.damping * deltaFps)); // elastic
|
79
|
-
|
80
|
-
this.velocity.add(this.springVelocity);
|
81
|
-
this.velocity.add(this.speed.multiplyScalar(damping).multiplyScalar(1 - spring)); // speed
|
82
|
-
|
83
|
-
this.speed.subVectors(this.velocity, this.lastVelocity); // spring velocity
|
84
|
-
|
85
|
-
this.springVelocity.add(this.speed);
|
86
|
-
this.springVelocity.multiplyScalar(spring); // moment
|
87
|
-
|
88
|
-
this.moment.add(this.springVelocity); // damping
|
89
|
-
|
90
|
-
this.moment.multiplyScalar(damping);
|
91
|
-
this.lastVelocity.copy(this.velocity);
|
92
|
-
this.value.copy(this.moment);
|
93
|
-
break;
|
94
|
-
|
95
|
-
default:
|
96
|
-
this.value.copy(this.velocity);
|
97
|
-
}
|
98
|
-
};
|
99
|
-
|
100
|
-
VelocityNode.prototype.copy = function (source) {
|
101
|
-
Vector3Node.prototype.copy.call(this, source);
|
102
|
-
if (source.target) this.setTarget(source.target);
|
103
|
-
this.setParams(source.params);
|
104
|
-
return this;
|
105
|
-
};
|
106
|
-
|
107
|
-
VelocityNode.prototype.toJSON = function (meta) {
|
108
|
-
var data = Vector3Node.prototype.toJSON.call(this, meta);
|
109
|
-
if (this.target) data.target = this.target.uuid; // clone params
|
110
|
-
|
111
|
-
data.params = JSON.parse(JSON.stringify(this.params));
|
112
|
-
return data;
|
113
|
-
};
|
114
|
-
|
115
|
-
export { VelocityNode };
|