Skip to content

Commit 43fdb45

Browse files
committed
small mat-ed fixes and adjustments
1 parent 6094d8d commit 43fdb45

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

src/input/element-input.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ Object.assign(ElementInput.prototype, {
801801
if (!a.screen && b.screen)
802802
return 1;
803803
if (!a.screen && !b.screen)
804-
return 0;
804+
return b.drawOrder - a.drawOrder; // this allows drawOrder to work for 3D elements
805805

806806
if (a.screen.screen.screenSpace && !b.screen.screen.screenSpace)
807807
return -1;

src/scene/materials/node-material.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,12 @@ Object.assign(NodeMaterial.prototype, {
331331
if (inOrOutAndTypeAndName[0] === "out") {
332332
this.addOutput(inOrOutAndTypeAndName[1], inOrOutAndTypeAndName[2]);
333333
// this.defineOuputGetter(this.outputName[this.outputName.length - 1], this.outputName.length - 1);
334-
}
335-
if (inOrOutAndTypeAndName[0] === "in") {
334+
} else if (inOrOutAndTypeAndName[0] === "in") {
336335
this.addInput(inOrOutAndTypeAndName[1], inOrOutAndTypeAndName[2]);
337336
// this.defineInputSetter(this.inputName[this.inputName.length - 1], this.inputName.length - 1);
338337
} else {
339338
// unsupported parameter !!! TODO add support for more parameter types?
339+
console.warn('unsupported parameter in shader function!!!');
340340
}
341341
}
342342
},
@@ -347,10 +347,21 @@ Object.assign(NodeMaterial.prototype, {
347347
return ret;
348348
},
349349

350-
connect: function (srcIndex, srcPortName, dstIndex, dstPortName) {
351-
var connection = { srcIndex: srcIndex, srcPortName: srcPortName, dstIndex: dstIndex, dstPortName: dstPortName };
352-
353-
this.graphData.connections.push(connection);
350+
connect: function (srcIndex, srcPortName, dstIndex, dstPortName, conIndex) {
351+
if (conIndex != undefined)
352+
{
353+
this.graphData.connections[conIndex].srcIndex=srcIndex;
354+
this.graphData.connections[conIndex].srcPortName=srcPortName;
355+
this.graphData.connections[conIndex].dstIndex=dstIndex;
356+
this.graphData.connections[conIndex].dstPortName=dstPortName;
357+
}
358+
else
359+
{
360+
var connection = { srcIndex: srcIndex, srcPortName: srcPortName, dstIndex: dstIndex, dstPortName: dstPortName };
361+
conIndex = this.graphData.connections.length;
362+
this.graphData.connections.push(connection);
363+
}
364+
return conIndex;
354365
},
355366

356367
_getIoPortValueString: function (ioPort) {
@@ -678,7 +689,7 @@ Object.assign(NodeMaterial.prototype, {
678689
// it should not be possible for the the number of iterations to exceeds the number of connections - unless there is a cyclic dependency
679690
var whileLoopCount = 0;
680691

681-
while (subGraphList.length < this.graphData.subGraphs.length || whileLoopCount < this.graphData.connections.length) {
692+
while (subGraphList.length < this.graphData.subGraphs.length && whileLoopCount < this.graphData.connections.length) {
682693
whileLoopCount++;
683694

684695
for (i = 0; i < this.graphData.subGraphs.length; i++) {
@@ -767,7 +778,7 @@ Object.assign(NodeMaterial.prototype, {
767778
});
768779

769780
var shadergraph = {};
770-
781+
/*
771782
shadergraph.graphCounter = 0;
772783
773784
shadergraph.nodeRegistry = {};
@@ -872,5 +883,5 @@ shadergraph.connectCustom = function (destNodeIndex, destName, nodeIndex_or_para
872883
this.graph.connect(-1, ioPort.name, destNodeIndex, 'IN_' + destName);
873884
}
874885
};
875-
886+
*/
876887
export { NodeMaterial, shadergraph };

0 commit comments

Comments
 (0)