function registerShader(name, definition) {
  var NewShader;
  var proto = {};

  // Format definition object to prototype object.
  Object.keys(definition).forEach(function (key) {
    proto[key] = {
      value: definition[key],
      writable: true
    };
  });
  if (shaders[name]) {
    throw new Error('The shader ' + name + ' has already been registered');
  }
  NewShader = function () {
    Shader.call(this);
  };
  NewShader.prototype = Object.create(Shader.prototype, proto);
  NewShader.prototype.name = name;
  NewShader.prototype.constructor = NewShader;
  shaders[name] = {
    Shader: NewShader,
    schema: (0,_schema_js__WEBPACK_IMPORTED_MODULE_0__.process)(NewShader.prototype.schema)
  };
  shaderNames.push(name);
  return NewShader;
}
Registers a shader to A-Frame.

@param {string} name - shader name.
@param {object} definition - shader property and methods.
@returns {object} Shader.