@shaderfrog/core 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/graph/base-node.d.ts +6 -0
- package/graph/data-nodes.d.ts +1 -0
- package/graph/data-nodes.js +16 -2
- package/package.json +2 -2
- package/plugins/three/threngine.js +15 -0
package/graph/base-node.d.ts
CHANGED
|
@@ -25,6 +25,11 @@ export type NodePosition = {
|
|
|
25
25
|
x: number;
|
|
26
26
|
y: number;
|
|
27
27
|
};
|
|
28
|
+
export type NodeInputSectionVisibility = 'visible' | 'hidden';
|
|
29
|
+
export type NodeInputSection = 'Properties' | 'Uniforms' | 'Code';
|
|
30
|
+
export type NodeDisplay = {
|
|
31
|
+
visibilities: Partial<Record<NodeInputSection, NodeInputSectionVisibility>>;
|
|
32
|
+
};
|
|
28
33
|
export interface BaseNode {
|
|
29
34
|
id: string;
|
|
30
35
|
parentId?: string;
|
|
@@ -33,4 +38,5 @@ export interface BaseNode {
|
|
|
33
38
|
inputs: NodeInput[];
|
|
34
39
|
outputs: NodeOutput[];
|
|
35
40
|
position: NodePosition;
|
|
41
|
+
display?: NodeDisplay;
|
|
36
42
|
}
|
package/graph/data-nodes.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ type Vector = 'vector2' | 'vector3' | 'vector4';
|
|
|
4
4
|
type Color = 'rgb' | 'rgba';
|
|
5
5
|
type Mat = 'mat2' | 'mat3' | 'mat4' | 'mat2x2' | 'mat2x3' | 'mat2x4' | 'mat3x2' | 'mat3x3' | 'mat3x4' | 'mat4x2' | 'mat4x3' | 'mat4x4';
|
|
6
6
|
export type GraphDataType = Vector | Color | Mat | 'texture' | 'samplerCube' | 'number' | ArrayType;
|
|
7
|
+
export declare const canMapType: (fromType: GraphDataType | undefined, toType: GraphDataType | undefined) => boolean;
|
|
7
8
|
export interface NumberNode extends BaseNode {
|
|
8
9
|
type: 'number';
|
|
9
10
|
value: string;
|
package/graph/data-nodes.js
CHANGED
|
@@ -9,6 +9,20 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var TypeCompatibility = [
|
|
13
|
+
new Set(['vector4', 'rgba']),
|
|
14
|
+
new Set(['vector3', 'rgb']),
|
|
15
|
+
// Note vector4 is wrong here - you can't plug a *data* vector4 into a
|
|
16
|
+
// texture. But the output of a shader node is a *bakeable* vector4. This
|
|
17
|
+
// allows that. Needs updating to take into account data vs code
|
|
18
|
+
new Set(['texture', 'samplerCube', 'vector4']),
|
|
19
|
+
];
|
|
20
|
+
export var canMapType = function (fromType, toType) {
|
|
21
|
+
if (fromType === toType || !fromType || !toType) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return TypeCompatibility.some(function (compatibility) { return compatibility.has(fromType) && compatibility.has(toType); });
|
|
25
|
+
};
|
|
12
26
|
export var numberNode = function (id, name, position, value, optionals) { return ({
|
|
13
27
|
type: 'number',
|
|
14
28
|
id: id,
|
|
@@ -46,7 +60,7 @@ export var textureNode = function (id, name, position, value) { return ({
|
|
|
46
60
|
{
|
|
47
61
|
name: 'texture',
|
|
48
62
|
id: '1',
|
|
49
|
-
dataType: '
|
|
63
|
+
dataType: 'texture',
|
|
50
64
|
category: 'data',
|
|
51
65
|
},
|
|
52
66
|
],
|
|
@@ -63,7 +77,7 @@ export var samplerCubeNode = function (id, name, position, value) { return ({
|
|
|
63
77
|
{
|
|
64
78
|
name: 'samplerCube',
|
|
65
79
|
id: '1',
|
|
66
|
-
dataType: '
|
|
80
|
+
dataType: 'samplerCube',
|
|
67
81
|
category: 'data',
|
|
68
82
|
},
|
|
69
83
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shaderfrog/core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Shaderfrog core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@shaderfrog/glsl-parser": "^6.0.0-beta.7",
|
|
52
52
|
"babylonjs": ">=4",
|
|
53
|
-
"playcanvas": "
|
|
53
|
+
"playcanvas": ">=1.65.3",
|
|
54
54
|
"three": ">=0.50"
|
|
55
55
|
},
|
|
56
56
|
"peerDependenciesMeta": {
|
|
@@ -129,6 +129,11 @@ export var phongNode = function (id, name, position, uniforms, stage) {
|
|
|
129
129
|
: namedAttributeStrategy('position'),
|
|
130
130
|
],
|
|
131
131
|
},
|
|
132
|
+
display: {
|
|
133
|
+
visibilities: {
|
|
134
|
+
Uniforms: 'hidden',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
132
137
|
inputs: [],
|
|
133
138
|
outputs: [
|
|
134
139
|
{
|
|
@@ -196,6 +201,11 @@ export var physicalNode = function (id, name, position, uniforms, stage) {
|
|
|
196
201
|
: namedAttributeStrategy('position'),
|
|
197
202
|
],
|
|
198
203
|
},
|
|
204
|
+
display: {
|
|
205
|
+
visibilities: {
|
|
206
|
+
Uniforms: 'hidden',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
199
209
|
inputs: [],
|
|
200
210
|
outputs: [
|
|
201
211
|
{
|
|
@@ -421,6 +431,11 @@ export var toonNode = function (id, name, position, uniforms, stage) {
|
|
|
421
431
|
: namedAttributeStrategy('position'),
|
|
422
432
|
],
|
|
423
433
|
},
|
|
434
|
+
display: {
|
|
435
|
+
visibilities: {
|
|
436
|
+
Uniforms: 'hidden',
|
|
437
|
+
},
|
|
438
|
+
},
|
|
424
439
|
inputs: [],
|
|
425
440
|
outputs: [
|
|
426
441
|
{
|