Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 11 additions & 6 deletions src/webgl/ShaderGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,24 +521,29 @@ function shadergenerator(p5, fn) {
class FunctionCallNode extends BaseNode {
constructor(name, userArgs, properties, isInternal = false) {
let functionSignature;
const determineFunctionSignature = (props) => {
const determineFunctionSignature = (props, userArgs) => {
let genType;
let similarity = 0;

const valid = userArgs.every((userArg, i) => {
const userType = getType(userArg);
let expectedArgType = props.args[i];

let coercedUserType = userType;
if (expectedArgType === 'genType') {
// We allow conversions from float -> vec if one argument is a vector.
if (genType === undefined || (genType === 'float' && userType.startsWith('vec'))) {
genType = userType
};
if (userType === 'int') coercedUserType = 'float';
if (!validGenTypes.includes(coercedUserType)) return false;

if (genType === undefined) {
genType = coercedUserType;
}

expectedArgType = genType;
}
similarity += (userType === expectedArgType);
return userType === expectedArgType || (userType === 'float' && expectedArgType.startsWith('vec'));
})
console.log('userArgs:', userArgs);
console.log('props.args:', props.args);

return { ...props, valid, similarity, genType }
}
Expand Down
3 changes: 2 additions & 1 deletion test/unit/io/loadTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ suite('loadTable', function() {
// TODO: Current parsing does not handle quoted fields
const table = await mockP5Prototype.loadTable(validFile);
assert.equal(table.getRowCount(), 4);
assert.equal(table.getRow(3).get(0), 'David,\nSr. "the boss"');
const value = table.getRow(3).get(0).replace(/\r\n/g, '\n');
assert.equal(value, 'David,\nSr. "the boss"');
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading