Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_setShaderOptions: function(shaderName) {
var options = require('mage-engine').engine.fx.shadersEngine.get(shaderName).options,
container = document.querySelector('#shaderOptions');
if (options) {
// now creating form for shader option
for (var k in options) {
var input = app.interface.sidebarHelper.createFormInput(k, options[k]);
container.appendChild(input);
}
container.appendChild(app.interface.sidebarHelper.createButton('update', app.interface.rightSidebar.meshListener.changeShaderOption))
} else {
console.warn('Selected shader doesn\'t have options.');
}
},
_setShaderSelector: function() {
var engine = require('mage-engine').engine,
shaders = engine.fx.shadersEngine.SHADERS;
for (var i in shaders) {
var li = document.createElement('li');
li.role = 'presentation';
var a = document.createElement('a');
a.role = 'menuitem';
a.tabindex = '-1';
a.dataset['name'] = shaders[i];
a.onclick = function() {
app.interface.rightSidebar.meshListener.changeShader(this.dataset['name']);
app.interface.rightSidebar._setShaderOptions(this.dataset['name']);
}
a.innerText = shaders[i];
li.appendChild(a);
$('#shaderSelector').append(li);