Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSL: ScriptableNode #25685

Merged
merged 48 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
818d2ea
CodeNode: Added language and serialize.
sunag Mar 16, 2023
49b4a18
TSL: Renamed inversesqrt -> inverseSqrt, faceforward -> faceForward,
sunag Mar 16, 2023
bb5ba65
TSL: Added saturate
sunag Mar 16, 2023
a136476
TSL: Different params order if method chaining is used.
sunag Mar 16, 2023
9070cca
Nodes: Change mix order and added FogNode.mixAssign()
sunag Mar 16, 2023
c227d8c
Node: Ignore private properties on serialization.
sunag Mar 17, 2023
9300715
Nodes: Added string, arrayBuffer
sunag Mar 17, 2023
8e071a9
Node: Added .getSerializeChildren()
sunag Mar 17, 2023
1e69094
Added ScriptableNode
sunag Mar 17, 2023
a5ea8a7
Added scriptable example and serialization test.
sunag Mar 17, 2023
03bf3cc
update style
sunag Mar 17, 2023
e29da35
cleanup
sunag Mar 17, 2023
531c16d
cleanup
sunag Mar 17, 2023
4eb2a90
Code Based Node moved to /code/
sunag Mar 18, 2023
1b9290e
ScriptableNode: Fix async refresh, added .setLocal(), .getLocal()
sunag Mar 18, 2023
ca23b3d
added async scriptable and serialization test
sunag Mar 18, 2023
673ff8a
optional output
sunag Mar 18, 2023
edf4603
added output example
sunag Mar 18, 2023
29c9645
ScriptableNode: Move editor property to function call if needed.
sunag Mar 19, 2023
2ec0997
ScriptableValueNode: Added support to more CPU nodes.
sunag Mar 19, 2023
d322e38
ShaderNode: Reduces the use of unnecessary conversions.
sunag Mar 19, 2023
be1bdca
webgpu_materials: Added CPU parameter as node.
sunag Mar 19, 2023
32658e2
ScriptableNode: Move THREE, TSL to global environment vars.
sunag Mar 19, 2023
d48ae4d
webgpu_materials: set globals
sunag Mar 19, 2023
0923c2e
cleanup
sunag Mar 19, 2023
baaa14b
fix conflicting
sunag Mar 20, 2023
0cf0695
cleanup
sunag Mar 20, 2023
b982199
Revert "cleanup"
sunag Mar 20, 2023
712d93b
Revert "fix conflicting"
sunag Mar 20, 2023
acf3112
PointerLockControls: Refactor class structure. (#25665)
Mugen87 Mar 13, 2023
0e7e7e1
Bump eslint from 8.35.0 to 8.36.0 (#25666)
dependabot[bot] Mar 13, 2023
6561919
Update webgl_loader_md2.html (#25670)
llzen44 Mar 14, 2023
9add25d
Fix the Chinese translation of MeshToonMaterial (#25672)
newstart0514 Mar 14, 2023
ab9a8f6
Bump puppeteer-core from 19.7.4 to 19.7.5 (#25671)
dependabot[bot] Mar 14, 2023
e836322
Create renovate.json (#25636)
donmccurdy Mar 15, 2023
3cf9d90
Delete dependabot.yml
mrdoob Mar 15, 2023
787e2af
Src: export AnimationAction (#25676)
linbingquan Mar 15, 2023
032ff36
Fix a document translation omission (#25677)
newstart0514 Mar 15, 2023
cd39f69
Delete DataTexture2DArray.html
Mugen87 Mar 15, 2023
f6e811f
CSS2DRenderer: Introduce CSS2DObject.center (#25673)
WestLangley Mar 15, 2023
e419f11
Vector2: Add `angleTo()`. (#25678)
Mugen87 Mar 16, 2023
aab74fc
GLTFLoader: Prevents set data uri in texture.name. (#25682)
sunag Mar 17, 2023
a84b421
Object3D: Honor `up` in `toJSON()` and `ObjectLoader`. (#25687)
Mugen87 Mar 17, 2023
7773fce
WebGLRenderer: Add `onShaderError()`. (#25679)
Mugen87 Mar 17, 2023
418ceac
Updated builds.
Mugen87 Mar 17, 2023
9a4325b
3DMLoader: Clean up (#25423)
LeviPesin Mar 18, 2023
8143243
Examples: Fix webgl_geometry_spline_editor.html (#25690)
puqeko Mar 19, 2023
a2f2871
TSL: Different params order if method chaining is used. (#25683)
sunag Mar 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions examples/jsm/nodes/Nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ export { default as ArrayUniformNode /* @TODO: arrayUniform */ } from './core/Ar
export { default as AttributeNode, attribute } from './core/AttributeNode.js';
export { default as BypassNode, bypass } from './core/BypassNode.js';
export { default as CacheNode, cache } from './core/CacheNode.js';
export { default as CodeNode, code } from './core/CodeNode.js';
export { default as ConstNode } from './core/ConstNode.js';
export { default as ContextNode, context } from './core/ContextNode.js';
export { default as ExpressionNode, expression } from './core/ExpressionNode.js';
export { default as FunctionCallNode, call } from './core/FunctionCallNode.js';
export { default as FunctionNode, func, fn } from './core/FunctionNode.js';
export { default as InstanceIndexNode, instanceIndex } from './core/InstanceIndexNode.js';
export { default as LightingModel, lightingModel } from './core/LightingModel.js';
export { default as Node, addNodeClass, createNodeFromType } from './core/Node.js';
Expand All @@ -35,8 +31,10 @@ export { default as UniformNode, uniform } from './core/UniformNode.js';
export { default as VarNode, label, temp } from './core/VarNode.js';
export { default as VaryingNode, varying } from './core/VaryingNode.js';

export * as NodeUtils from './core/NodeUtils.js';

// math
export { default as MathNode, EPSILON, INFINITY, radians, degrees, exp, exp2, log, log2, sqrt, inversesqrt, floor, ceil, normalize, fract, sin, cos, tan, asin, acos, atan, abs, sign, length, negate, invert, dFdx, dFdy, round, reciprocal, atan2, min, max, mod, step, reflect, distance, difference, dot, cross, pow, pow2, pow3, pow4, transformDirection, mix, clamp, refract, smoothstep, faceforward } from './math/MathNode.js';
export { default as MathNode, EPSILON, INFINITY, radians, degrees, exp, exp2, log, log2, sqrt, inverseSqrt, floor, ceil, normalize, fract, sin, cos, tan, asin, acos, atan, abs, sign, length, negate, invert, dFdx, dFdy, round, reciprocal, atan2, min, max, mod, step, reflect, distance, difference, dot, cross, pow, pow2, pow3, pow4, transformDirection, mix, clamp, saturate, refract, smoothstep, faceForward } from './math/MathNode.js';
export { default as OperatorNode, add, sub, mul, div, remainder, equal, assign, lessThan, greaterThan, lessThanEqual, greaterThanEqual, and, or, xor, bitAnd, bitOr, bitXor, shiftLeft, shiftRight } from './math/OperatorNode.js';
export { default as CondNode, cond } from './math/CondNode.js';

Expand Down Expand Up @@ -95,6 +93,14 @@ export { default as PosterizeNode, posterize } from './display/PosterizeNode.js'
export { default as ToneMappingNode, toneMapping } from './display/ToneMappingNode.js';
export { default as ViewportNode, viewportCoordinate, viewportResolution, viewportTopLeft, viewportBottomLeft, viewportTopRight, viewportBottomRight } from './display/ViewportNode.js';

// code
export { default as ExpressionNode, expression } from './code/ExpressionNode.js';
export { default as CodeNode, code, js } from './code/CodeNode.js';
export { default as FunctionCallNode, call } from './code/FunctionCallNode.js';
export { default as FunctionNode, func, fn } from './code/FunctionNode.js';
export { default as ScriptableNode, scriptable, global } from './code/ScriptableNode.js';
export { default as ScriptableValueNode, scriptableValue } from './code/ScriptableValueNode.js';

// fog
export { default as FogNode, fog } from './fog/FogNode.js';
export { default as FogRangeNode, rangeFog } from './fog/FogRangeNode.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import Node, { addNodeClass } from './Node.js';
import Node, { addNodeClass } from '../core/Node.js';
import { nodeProxy } from '../shadernode/ShaderNode.js';
sunag marked this conversation as resolved.
Show resolved Hide resolved

class CodeNode extends Node {

constructor( code = '', includes = [] ) {
constructor( code = '', includes = [], language = '' ) {

super( 'code' );

this.isCodeNode = true;

this.code = code;
this.language = language;

this._includes = includes;

Expand Down Expand Up @@ -46,10 +47,29 @@ class CodeNode extends Node {

}

serialize( data ) {

super.serialize( data );

data.code = this.code;
data.language = this.language;

}

deserialize( data ) {

super.deserialize( data );

this.code = data.code;
this.language = data.language;

}

}

export default CodeNode;

export const code = nodeProxy( CodeNode );
export const js = ( src, includes ) => code( src, includes, 'js' );

addNodeClass( CodeNode );
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Node, { addNodeClass } from './Node.js';
import Node, { addNodeClass } from '../core/Node.js';
import { nodeProxy } from '../shadernode/ShaderNode.js';

class ExpressionNode extends Node {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TempNode from './TempNode.js';
import { addNodeClass } from './Node.js';
import TempNode from '../core/TempNode.js';
import { addNodeClass } from '../core/Node.js';
import { addNodeElement, nodeArray, nodeObject, nodeObjects } from '../shadernode/ShaderNode.js';

class FunctionCallNode extends TempNode {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CodeNode from './CodeNode.js';
import { addNodeClass } from './Node.js';
import { addNodeClass } from '../core/Node.js';
import { nodeObject } from '../shadernode/ShaderNode.js';

class FunctionNode extends CodeNode {
Expand Down
Loading