ami-cjs.js
Version:
<p align="center"> <img src="https://cloud.githubusercontent.com/assets/214063/23213764/78ade038-f90c-11e6-8208-4fcade5f3832.png" width="60%"> </p>
79 lines (63 loc) • 3.64 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* Helpers material mixin.
*
* @module helpers/material/mixin
*/
var HerlpersMaterialMixin = function HerlpersMaterialMixin(superclass) {
return function (_superclass) {
_inherits(_class, _superclass);
function _class() {
_classCallCheck(this, _class);
return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
}
_createClass(_class, [{
key: "_createMaterial",
value: function _createMaterial(extraOptions) {
// generate shaders on-demand!
var fs = new this._shadersFragment(this._uniforms);
var vs = new this._shadersVertex();
// material
var globalOptions = {
uniforms: this._uniforms,
vertexShader: vs.compute(),
fragmentShader: fs.compute()
};
var options = Object.assign(extraOptions, globalOptions);
this._material = new THREE.ShaderMaterial(options);
this._material.needsUpdate = true;
}
}, {
key: "_updateMaterial",
value: function _updateMaterial() {
// generate shaders on-demand!
var fs = new this._shadersFragment(this._uniforms);
var vs = new this._shadersVertex();
this._material.vertexShader = vs.compute();
this._material.fragmentShader = fs.compute();
this._material.needsUpdate = true;
}
}, {
key: "_prepareTexture",
value: function _prepareTexture() {
this._textures = [];
for (var m = 0; m < this._stack._rawData.length; m++) {
var tex = new THREE.DataTexture(this._stack.rawData[m], this._stack.textureSize, this._stack.textureSize, this._stack.textureType, THREE.UnsignedByteType, THREE.UVMapping, THREE.ClampToEdgeWrapping, THREE.ClampToEdgeWrapping, THREE.NearestFilter, THREE.NearestFilter);
tex.needsUpdate = true;
tex.flipY = true;
this._textures.push(tex);
}
}
}]);
return _class;
}(superclass);
};
exports.default = HerlpersMaterialMixin;
module.exports = exports["default"];