Skip to content

Commit 3d4f342

Browse files
committed
update TEMP engine build
1 parent f7a0e93 commit 3d4f342

File tree

2 files changed

+53
-9
lines changed

2 files changed

+53
-9
lines changed

build/playcanvas-extras.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* PlayCanvas Engine v1.34.0-dev revision 7397d249
3+
* PlayCanvas Engine v1.34.0-dev revision 8f01a724
44
* Copyright 2011-2020 PlayCanvas Ltd. All rights reserved.
55
*/
66
(function (global, factory) {

build/playcanvas.js

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* PlayCanvas Engine v1.34.0-dev revision 7397d249
3+
* PlayCanvas Engine v1.34.0-dev revision 8f01a724
44
* Copyright 2011-2020 PlayCanvas Ltd. All rights reserved.
55
*/
66
(function (global, factory) {
@@ -447,7 +447,7 @@
447447
return result;
448448
}();
449449
var version = "1.34.0-dev";
450-
var revision = "7397d249";
450+
var revision = "8f01a724";
451451
var config = { };
452452
var common = { };
453453
var apps = { };
@@ -23899,7 +23899,7 @@
2389923899
} else if (typeof(value) === 'number') {
2390023900
graphVar = { type: type, name: name, valueX: value };
2390123901
} else {
23902-
graphVar = { type: type, name: name};
23902+
graphVar = { type: type, name: name };
2390323903
}
2390423904
this.graphData.graphVars.push(graphVar);
2390523905
return graphVar;
@@ -24161,6 +24161,8 @@
2416124161
} else {
2416224162
if (con.srcIndex >= 0) {
2416324163
graphOutputVarTmpVarMap[con.dstVarName] = srcTmpVarMap[con.srcIndex][con.srcVarName];
24164+
} else {
24165+
graphOutputVarTmpVarMap[con.dstVarName] = con.srcVarName;
2416424166
}
2416524167
}
2416624168
}
@@ -24225,7 +24227,35 @@
2422524227
}
2422624228
return this.nodeRegistry[name];
2422724229
};
24228-
shadergraph.start = function () {
24230+
shadergraph._addCoreFunction = function (coreName, coreNode) {
24231+
this[coreName] = function (...args) {
24232+
var sgIndex = this.graph.addSubGraph(this._getNode(coreName));
24233+
var sgInputs = coreNode.graphData.graphVars.filter(function (graphVar) {
24234+
return graphVar.name.startsWith('IN_');
24235+
});
24236+
if (sgInputs.length === args.length) {
24237+
args.forEach((arg, argIndex) => {
24238+
if (typeof(arg) === 'number') {
24239+
var argNodeIndex = arg;
24240+
this.graph.connect(argNodeIndex, 'OUT_ret', sgIndex, sgInputs[argIndex].name);
24241+
} else if (arg.type) {
24242+
this.graph.connect(-1, arg.name, sgIndex, sgInputs[argIndex].name);
24243+
} else {
24244+
this.graph.connect(arg.node, arg.port, sgIndex, sgInputs[argIndex].name);
24245+
}
24246+
});
24247+
} else {
24248+
console.log("arguments do not match core node function");
24249+
}
24250+
return sgIndex;
24251+
};
24252+
};
24253+
shadergraph.start = function (coreNodesJSON) {
24254+
const coreNodeList = JSON.parse(coreNodesJSON);
24255+
Object.keys(coreNodeList).forEach((key) => {
24256+
var coreNode = this._getNode(key, coreNodeList[key].code);
24257+
this._addCoreFunction(key, coreNode);
24258+
});
2422924259
shadergraph.graph = this._getNode('graphRoot_' + shadergraph.graphCounter);
2423024260
shadergraph.graph.name = 'graphRoot_' + shadergraph.graphCounter;
2423124261
};
@@ -24280,13 +24310,27 @@
2428024310
var graphVar = this.graph.addInput(type, name, value);
2428124311
return graphVar;
2428224312
};
24283-
shadergraph.connectFragOut = function (nodeIndex, name) {
24313+
shadergraph.connectFragOut = function (arg) {
2428424314
var graphVar = this.graph.addOutput('vec4', 'fragOut', new Vec4(0, 0, 0, 1));
24285-
this.graph.connect(nodeIndex, (name) ? 'OUT_' + name : 'OUT_ret', -1, graphVar.name);
24315+
if (typeof(arg) === 'number') {
24316+
var argNodeIndex = arg;
24317+
this.graph.connect(argNodeIndex, 'OUT_ret', -1, graphVar.name);
24318+
} else if (arg.type) {
24319+
this.graph.connect(-1, arg.name, -1, graphVar.name);
24320+
} else {
24321+
this.graph.connect(arg.node, arg.port, -1, graphVar.name);
24322+
}
2428624323
};
24287-
shadergraph.connectVertexOffset = function (nodeIndex, name) {
24324+
shadergraph.connectVertexOffset = function (arg) {
2428824325
var graphVar = this.graph.addOutput('vec3', 'vertOff', new Vec3(0, 0, 0));
24289-
this.graph.connect(nodeIndex, (name) ? 'OUT_' + name : 'OUT_ret', -1, graphVar.name);
24326+
if (typeof(arg) === 'number') {
24327+
var argNodeIndex = arg;
24328+
this.graph.connect(argNodeIndex, 'OUT_ret', -1, graphVar.name);
24329+
} else if (arg.type) {
24330+
this.graph.connect(-1, arg.name, -1, graphVar.name);
24331+
} else {
24332+
this.graph.connect(arg.node, arg.port, -1, graphVar.name);
24333+
}
2429024334
};
2429124335
shadergraph.connectCustom = function (destNodeIndex, destName, nodeIndex_or_param, name) {
2429224336
if (typeof(nodeIndex_or_param) === 'number') {

0 commit comments

Comments
 (0)