glsl-transpiler
Advanced tools
Comparing version
@@ -320,11 +320,18 @@ 'use strict' | ||
var argsList = flatten(args.map(function (arg) { | ||
assert.equal(arg.type, 'decl', 'Struct statements should be declarations.') | ||
if (arg.type !== 'decl') throw Error('Struct statements should be declarations.') | ||
var decllist = arg.children[arg.children.length - 1] | ||
assert.equal(decllist.type, 'decllist', 'Struct statement declaration has wrong structure.') | ||
if (decllist.type !== 'decllist') throw Error('Struct statement declaration has wrong structure.') | ||
return decllist.children.map(function (ident) { | ||
assert.equal(ident.type, 'ident', 'Struct statement contains something other than just identifiers.') | ||
return ident.data | ||
return decllist.children.map(function (node) { | ||
// { vec3 direction; } | ||
if (node.type === 'ident') return node.data | ||
// { vec3 data[2]; } | ||
if (node.type === 'quantifier') { | ||
console.log(node) | ||
} | ||
throw Error('Struct statement contains something strange.') | ||
}) | ||
@@ -331,0 +338,0 @@ })) |
@@ -71,3 +71,2 @@ 'use strict' | ||
var vec = right; | ||
var scalar = left; | ||
var l = this.types[outType].length; | ||
@@ -86,5 +85,6 @@ if (/mat/.test(outType)) l *= this.types[this.types[outType].type].length; | ||
var calcStr = this.types[rightType].length == 1 ? calculate('_', 'this', operator) : calculate('this', '_', operator); | ||
var calcStr = calculate(null, '_', operator); | ||
return Descriptor( | ||
`${vec}.map(function (_) {return ${calcStr};}, ${scalar})`, { | ||
`${vec}.map(function (_) {return ${calcStr};})`, | ||
{ | ||
components: operands, | ||
@@ -91,0 +91,0 @@ type: outType, |
{ | ||
"name": "glsl-transpiler", | ||
"version": "1.8.2", | ||
"version": "1.8.3", | ||
"description": "Transpile GLSL to JS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
103785
0.02%3134
0.16%