123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 |
- var __extends = this.__extends || function (d, b) {
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
- function __() { this.constructor = d; }
- __.prototype = b.prototype;
- d.prototype = new __();
- };
- var BABYLON;
- (function (BABYLON) {
- var WoodProceduralTexture = (function (_super) {
- __extends(WoodProceduralTexture, _super);
- function WoodProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
- _super.call(this, name, size, "wood", scene, fallbackTexture, generateMipMaps);
- this._ampScale = 100.0;
- this._woodColor = new BABYLON.Color3(0.32, 0.17, 0.09);
- this.updateShaderUniforms();
- // Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
- this.refreshRate = 0;
- }
- WoodProceduralTexture.prototype.updateShaderUniforms = function () {
- this.setFloat("ampScale", this._ampScale);
- this.setColor3("woodColor", this._woodColor);
- };
- Object.defineProperty(WoodProceduralTexture.prototype, "ampScale", {
- get: function () {
- return this._ampScale;
- },
- set: function (value) {
- this._ampScale = value;
- this.updateShaderUniforms();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(WoodProceduralTexture.prototype, "woodColor", {
- get: function () {
- return this._woodColor;
- },
- set: function (value) {
- this._woodColor = value;
- this.updateShaderUniforms();
- },
- enumerable: true,
- configurable: true
- });
- return WoodProceduralTexture;
- })(BABYLON.ProceduralTexture);
- BABYLON.WoodProceduralTexture = WoodProceduralTexture;
- var FireProceduralTexture = (function (_super) {
- __extends(FireProceduralTexture, _super);
- function FireProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
- _super.call(this, name, size, "fire", scene, fallbackTexture, generateMipMaps);
- this._time = 0.0;
- this._speed = new BABYLON.Vector2(0.5, 0.3);
- this._shift = 1.6;
- this._alpha = 1.0;
- this._autoGenerateTime = true;
- this._fireColors = FireProceduralTexture.RedFireColors;
- this.updateShaderUniforms();
- // Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
- this.refreshRate = 1;
- }
- FireProceduralTexture.prototype.updateShaderUniforms = function () {
- this.setFloat("iGlobalTime", this._time);
- this.setVector2("speed", this._speed);
- this.setFloat("shift", this._shift);
- this.setFloat("alpha", this._alpha);
- this.setColor3("c1", new BABYLON.Color3(this._fireColors[0][0], this._fireColors[0][1], this._fireColors[0][2]));
- this.setColor3("c2", new BABYLON.Color3(this._fireColors[1][0], this._fireColors[1][1], this._fireColors[1][2]));
- this.setColor3("c3", new BABYLON.Color3(this._fireColors[2][0], this._fireColors[2][1], this._fireColors[2][2]));
- this.setColor3("c4", new BABYLON.Color3(this._fireColors[3][0], this._fireColors[3][1], this._fireColors[3][2]));
- this.setColor3("c5", new BABYLON.Color3(this._fireColors[4][0], this._fireColors[4][1], this._fireColors[4][2]));
- this.setColor3("c6", new BABYLON.Color3(this._fireColors[5][0], this._fireColors[5][1], this._fireColors[5][2]));
- };
- FireProceduralTexture.prototype.render = function (useCameraPostProcess) {
- if (this._autoGenerateTime) {
- this._time += this.getScene().getAnimationRatio() * 0.03;
- this.updateShaderUniforms();
- }
- _super.prototype.render.call(this, useCameraPostProcess);
- };
- Object.defineProperty(FireProceduralTexture, "PurpleFireColors", {
- get: function () {
- return [
- [0.5, 0.0, 1.0],
- [0.9, 0.0, 1.0],
- [0.2, 0.0, 1.0],
- [1.0, 0.9, 1.0],
- [0.1, 0.1, 1.0],
- [0.9, 0.9, 1.0]
- ];
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(FireProceduralTexture, "GreenFireColors", {
- get: function () {
- return [
- [0.5, 1.0, 0.0],
- [0.5, 1.0, 0.0],
- [0.3, 0.4, 0.0],
- [0.5, 1.0, 0.0],
- [0.2, 0.0, 0.0],
- [0.5, 1.0, 0.0]
- ];
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(FireProceduralTexture, "RedFireColors", {
- get: function () {
- return [
- [0.5, 0.0, 0.1],
- [0.9, 0.0, 0.0],
- [0.2, 0.0, 0.0],
- [1.0, 0.9, 0.0],
- [0.1, 0.1, 0.1],
- [0.9, 0.9, 0.9]
- ];
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(FireProceduralTexture, "BlueFireColors", {
- get: function () {
- return [
- [0.1, 0.0, 0.5],
- [0.0, 0.0, 0.5],
- [0.1, 0.0, 0.2],
- [0.0, 0.0, 1.0],
- [0.1, 0.2, 0.3],
- [0.0, 0.2, 0.9]
- ];
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(FireProceduralTexture.prototype, "fireColors", {
- get: function () {
- return this._fireColors;
- },
- set: function (value) {
- this._fireColors = value;
- this.updateShaderUniforms();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(FireProceduralTexture.prototype, "time", {
- get: function () {
- return this._time;
- },
- set: function (value) {
- this._time = value;
- this.updateShaderUniforms();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(FireProceduralTexture.prototype, "speed", {
- get: function () {
- return this._speed;
- },
- set: function (value) {
- this._speed = value;
- this.updateShaderUniforms();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(FireProceduralTexture.prototype, "shift", {
- get: function () {
- return this._shift;
- },
- set: function (value) {
- this._shift = value;
- this.updateShaderUniforms();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(FireProceduralTexture.prototype, "alpha", {
- get: function () {
- return this._alpha;
- },
- set: function (value) {
- this._alpha = value;
- this.updateShaderUniforms();
- },
- enumerable: true,
- configurable: true
- });
- return FireProceduralTexture;
- })(BABYLON.ProceduralTexture);
- BABYLON.FireProceduralTexture = FireProceduralTexture;
- var CloudProceduralTexture = (function (_super) {
- __extends(CloudProceduralTexture, _super);
- function CloudProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
- _super.call(this, name, size, "cloud", scene, fallbackTexture, generateMipMaps);
- this._skyColor = new BABYLON.Color3(0.15, 0.68, 1.0);
- this._cloudColor = new BABYLON.Color3(1, 1, 1);
- this.updateShaderUniforms();
- // Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
- this.refreshRate = 0;
- // https://www.shadertoy.com/view/XsjSRt
- }
- CloudProceduralTexture.prototype.updateShaderUniforms = function () {
- this.setColor3("skyColor", this._skyColor);
- this.setColor3("cloudColor", this._cloudColor);
- };
- Object.defineProperty(CloudProceduralTexture.prototype, "skyColor", {
- get: function () {
- return this._skyColor;
- },
- set: function (value) {
- this._skyColor = value;
- this.updateShaderUniforms();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(CloudProceduralTexture.prototype, "cloudColor", {
- get: function () {
- return this._cloudColor;
- },
- set: function (value) {
- this._cloudColor = value;
- this.updateShaderUniforms();
- },
- enumerable: true,
- configurable: true
- });
- return CloudProceduralTexture;
- })(BABYLON.ProceduralTexture);
- BABYLON.CloudProceduralTexture = CloudProceduralTexture;
- var GrassProceduralTexture = (function (_super) {
- __extends(GrassProceduralTexture, _super);
- function GrassProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
- _super.call(this, name, size, "grass", scene, fallbackTexture, generateMipMaps);
- // Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
- this.refreshRate = 0;
- }
- return GrassProceduralTexture;
- })(BABYLON.ProceduralTexture);
- BABYLON.GrassProceduralTexture = GrassProceduralTexture;
- var RockProceduralTexture = (function (_super) {
- __extends(RockProceduralTexture, _super);
- function RockProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
- _super.call(this, name, size, "rock", scene, fallbackTexture, generateMipMaps);
- // Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
- this.refreshRate = 0;
- }
- return RockProceduralTexture;
- })(BABYLON.ProceduralTexture);
- BABYLON.RockProceduralTexture = RockProceduralTexture;
- var RoadProceduralTexture = (function (_super) {
- __extends(RoadProceduralTexture, _super);
- function RoadProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
- _super.call(this, name, size, "road", scene, fallbackTexture, generateMipMaps);
- // Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
- this.refreshRate = 0;
- }
- return RoadProceduralTexture;
- })(BABYLON.ProceduralTexture);
- BABYLON.RoadProceduralTexture = RoadProceduralTexture;
- var BrickProceduralTexture = (function (_super) {
- __extends(BrickProceduralTexture, _super);
- function BrickProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
- _super.call(this, name, size, "brick", scene, fallbackTexture, generateMipMaps);
- this._numberOfBricksHeight = 15;
- this._numberOfBricksWidth = 5;
- this.updateShaderUniforms();
- // Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
- this.refreshRate = 0;
- }
- BrickProceduralTexture.prototype.updateShaderUniforms = function () {
- this.setFloat("numberOfBricksHeight", this._numberOfBricksHeight);
- this.setFloat("numberOfBricksWidth", this._numberOfBricksWidth);
- };
- Object.defineProperty(BrickProceduralTexture.prototype, "numberOfBricksHeight", {
- get: function () {
- return this._numberOfBricksHeight;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BrickProceduralTexture.prototype, "cloudColor", {
- set: function (value) {
- this._numberOfBricksHeight = value;
- this.updateShaderUniforms();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BrickProceduralTexture.prototype, "numberOfBricksWidth", {
- get: function () {
- return this._numberOfBricksWidth;
- },
- set: function (value) {
- this._numberOfBricksHeight = value;
- this.updateShaderUniforms();
- },
- enumerable: true,
- configurable: true
- });
- return BrickProceduralTexture;
- })(BABYLON.ProceduralTexture);
- BABYLON.BrickProceduralTexture = BrickProceduralTexture;
- var MarbleProceduralTexture = (function (_super) {
- __extends(MarbleProceduralTexture, _super);
- function MarbleProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
- _super.call(this, name, size, "marble", scene, fallbackTexture, generateMipMaps);
- this._numberOfBricksHeight = 3;
- this._numberOfBricksWidth = 3;
- this.updateShaderUniforms();
- // Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
- this.refreshRate = 0;
- }
- MarbleProceduralTexture.prototype.updateShaderUniforms = function () {
- this.setFloat("numberOfBricksHeight", this._numberOfBricksHeight);
- this.setFloat("numberOfBricksWidth", this._numberOfBricksWidth);
- };
- Object.defineProperty(MarbleProceduralTexture.prototype, "numberOfBricksHeight", {
- get: function () {
- return this._numberOfBricksHeight;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MarbleProceduralTexture.prototype, "cloudColor", {
- set: function (value) {
- this._numberOfBricksHeight = value;
- this.updateShaderUniforms();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MarbleProceduralTexture.prototype, "numberOfBricksWidth", {
- get: function () {
- return this._numberOfBricksWidth;
- },
- set: function (value) {
- this._numberOfBricksHeight = value;
- this.updateShaderUniforms();
- },
- enumerable: true,
- configurable: true
- });
- return MarbleProceduralTexture;
- })(BABYLON.ProceduralTexture);
- BABYLON.MarbleProceduralTexture = MarbleProceduralTexture;
- })(BABYLON || (BABYLON = {}));
- //# sourceMappingURL=babylon.standardProceduralTexture.js.map
|