babylon.customMaterial.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /// <reference path="../../../dist/preview release/babylon.d.ts"/>
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = Object.setPrototypeOf ||
  4. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6. return function (d, b) {
  7. extendStatics(d, b);
  8. function __() { this.constructor = d; }
  9. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10. };
  11. })();
  12. var BABYLON;
  13. (function (BABYLON) {
  14. var CustomShaderHelper = (function () {
  15. function CustomShaderHelper() {
  16. }
  17. return CustomShaderHelper;
  18. }());
  19. BABYLON.CustomShaderHelper = CustomShaderHelper;
  20. var CustomMaterial = (function (_super) {
  21. __extends(CustomMaterial, _super);
  22. function CustomMaterial(name, builder, scene) {
  23. var _this = _super.call(this, name, scene) || this;
  24. _this._mainPart = 'void main(void) {';
  25. _this._diffusePart = 'vec3 diffuseColor=vDiffuseColor.rgb;';
  26. _this._vertexPositionPart = 'gl_Position=viewProjection*finalWorld*vec4(position,1.0);';
  27. _this.builder = builder;
  28. _this.customShaderNameResolve = function (shaderName) {
  29. return _this.builder(new CustomShaderHelper(), shaderName, _this._mainPart, _this._diffusePart, _this._vertexPositionPart);
  30. };
  31. return _this;
  32. }
  33. return CustomMaterial;
  34. }(BABYLON.StandardMaterial));
  35. BABYLON.CustomMaterial = CustomMaterial;
  36. })(BABYLON || (BABYLON = {}));
  37. //# sourceMappingURL=babylon.customMaterial.js.map