|
@@ -1,7 +1,7 @@
|
|
|
module BABYLON {
|
|
|
export class WoodProceduralTexture extends ProceduralTexture {
|
|
|
private _ampScale: number = 100.0;
|
|
|
- private _woodColor: BABYLON.Color3 = new BABYLON.Color3(0.32, 0.17, 0.09);
|
|
|
+ private _woodColor: Color3 = new Color3(0.32, 0.17, 0.09);
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
|
super(name, size, "wood", scene, fallbackTexture, generateMipMaps);
|
|
@@ -23,11 +23,11 @@
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
|
|
|
|
- public get woodColor(): BABYLON.Color3 {
|
|
|
+ public get woodColor(): Color3 {
|
|
|
return this._woodColor;
|
|
|
}
|
|
|
|
|
|
- public set woodColor(value: BABYLON.Color3) {
|
|
|
+ public set woodColor(value: Color3) {
|
|
|
this._woodColor = value;
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
@@ -35,11 +35,10 @@
|
|
|
|
|
|
export class FireProceduralTexture extends ProceduralTexture {
|
|
|
private _time: number = 0.0;
|
|
|
- private _speed: BABYLON.Vector2 = new BABYLON.Vector2(0.5, 0.3);
|
|
|
+ private _speed = new Vector2(0.5, 0.3);
|
|
|
private _shift: number = 1.6;
|
|
|
- private _alpha: number = 0.0;
|
|
|
private _autoGenerateTime: boolean = true;
|
|
|
- private _fireColors: BABYLON.Color3[];
|
|
|
+ private _fireColors: Color3[];
|
|
|
private _alphaThreshold: number = 0.5;
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
@@ -50,10 +49,9 @@
|
|
|
}
|
|
|
|
|
|
public updateShaderUniforms() {
|
|
|
- this.setFloat("iGlobalTime", this._time);
|
|
|
+ this.setFloat("time", this._time);
|
|
|
this.setVector2("speed", this._speed);
|
|
|
this.setFloat("shift", this._shift);
|
|
|
- this.setFloat("alpha", this._alpha);
|
|
|
this.setColor3("c1", this._fireColors[0]);
|
|
|
this.setColor3("c2", this._fireColors[1]);
|
|
|
this.setColor3("c3", this._fireColors[2]);
|
|
@@ -71,55 +69,55 @@
|
|
|
super.render(useCameraPostProcess);
|
|
|
}
|
|
|
|
|
|
- public static get PurpleFireColors(): BABYLON.Color3[] {
|
|
|
+ public static get PurpleFireColors(): Color3[] {
|
|
|
return [
|
|
|
- new BABYLON.Color3(0.5, 0.0, 1.0),
|
|
|
- new BABYLON.Color3(0.9, 0.0, 1.0),
|
|
|
- new BABYLON.Color3(0.2, 0.0, 1.0),
|
|
|
- new BABYLON.Color3(1.0, 0.9, 1.0),
|
|
|
- new BABYLON.Color3(0.1, 0.1, 1.0),
|
|
|
- new BABYLON.Color3(0.9, 0.9, 1.0)
|
|
|
+ new Color3(0.5, 0.0, 1.0),
|
|
|
+ new Color3(0.9, 0.0, 1.0),
|
|
|
+ new Color3(0.2, 0.0, 1.0),
|
|
|
+ new Color3(1.0, 0.9, 1.0),
|
|
|
+ new Color3(0.1, 0.1, 1.0),
|
|
|
+ new Color3(0.9, 0.9, 1.0)
|
|
|
];
|
|
|
}
|
|
|
|
|
|
- public static get GreenFireColors(): BABYLON.Color3[] {
|
|
|
+ public static get GreenFireColors(): Color3[] {
|
|
|
return [
|
|
|
- new BABYLON.Color3(0.5, 1.0, 0.0),
|
|
|
- new BABYLON.Color3(0.5, 1.0, 0.0),
|
|
|
- new BABYLON.Color3(0.3, 0.4, 0.0),
|
|
|
- new BABYLON.Color3(0.5, 1.0, 0.0),
|
|
|
- new BABYLON.Color3(0.2, 0.0, 0.0),
|
|
|
- new BABYLON.Color3(0.5, 1.0, 0.0)
|
|
|
+ new Color3(0.5, 1.0, 0.0),
|
|
|
+ new Color3(0.5, 1.0, 0.0),
|
|
|
+ new Color3(0.3, 0.4, 0.0),
|
|
|
+ new Color3(0.5, 1.0, 0.0),
|
|
|
+ new Color3(0.2, 0.0, 0.0),
|
|
|
+ new Color3(0.5, 1.0, 0.0)
|
|
|
];
|
|
|
}
|
|
|
|
|
|
- public static get RedFireColors(): BABYLON.Color3[] {
|
|
|
+ public static get RedFireColors(): Color3[] {
|
|
|
return [
|
|
|
- new BABYLON.Color3(0.5, 0.0, 0.1),
|
|
|
- new BABYLON.Color3(0.9, 0.0, 0.0),
|
|
|
- new BABYLON.Color3(0.2, 0.0, 0.0),
|
|
|
- new BABYLON.Color3(1.0, 0.9, 0.0),
|
|
|
- new BABYLON.Color3(0.1, 0.1, 0.1),
|
|
|
- new BABYLON.Color3(0.9, 0.9, 0.9)
|
|
|
+ new Color3(0.5, 0.0, 0.1),
|
|
|
+ new Color3(0.9, 0.0, 0.0),
|
|
|
+ new Color3(0.2, 0.0, 0.0),
|
|
|
+ new Color3(1.0, 0.9, 0.0),
|
|
|
+ new Color3(0.1, 0.1, 0.1),
|
|
|
+ new Color3(0.9, 0.9, 0.9)
|
|
|
];
|
|
|
}
|
|
|
|
|
|
- public static get BlueFireColors(): BABYLON.Color3[] {
|
|
|
+ public static get BlueFireColors(): Color3[] {
|
|
|
return [
|
|
|
- new BABYLON.Color3(0.1, 0.0, 0.5),
|
|
|
- new BABYLON.Color3(0.0, 0.0, 0.5),
|
|
|
- new BABYLON.Color3(0.1, 0.0, 0.2),
|
|
|
- new BABYLON.Color3(0.0, 0.0, 1.0),
|
|
|
- new BABYLON.Color3(0.1, 0.2, 0.3),
|
|
|
- new BABYLON.Color3(0.0, 0.2, 0.9)
|
|
|
+ new Color3(0.1, 0.0, 0.5),
|
|
|
+ new Color3(0.0, 0.0, 0.5),
|
|
|
+ new Color3(0.1, 0.0, 0.2),
|
|
|
+ new Color3(0.0, 0.0, 1.0),
|
|
|
+ new Color3(0.1, 0.2, 0.3),
|
|
|
+ new Color3(0.0, 0.2, 0.9)
|
|
|
];
|
|
|
}
|
|
|
|
|
|
- public get fireColors(): BABYLON.Color3[] {
|
|
|
+ public get fireColors(): Color3[] {
|
|
|
return this._fireColors;
|
|
|
}
|
|
|
|
|
|
- public set fireColors(value: BABYLON.Color3[]) {
|
|
|
+ public set fireColors(value: Color3[]) {
|
|
|
this._fireColors = value;
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
@@ -133,11 +131,11 @@
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
|
|
|
|
- public get speed(): BABYLON.Vector2 {
|
|
|
+ public get speed(): Vector2 {
|
|
|
return this._speed;
|
|
|
}
|
|
|
|
|
|
- public set speed(value: BABYLON.Vector2) {
|
|
|
+ public set speed(value: Vector2) {
|
|
|
this._speed = value;
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
@@ -151,19 +149,19 @@
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
|
|
|
|
- public get alpha(): number {
|
|
|
- return this._alpha;
|
|
|
+ public get alphaThreshold(): number {
|
|
|
+ return this._alphaThreshold;
|
|
|
}
|
|
|
|
|
|
- public set alpha(value: number) {
|
|
|
- this._alpha = value;
|
|
|
+ public set alphaThreshold(value: number) {
|
|
|
+ this._alphaThreshold = value;
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export class CloudProceduralTexture extends ProceduralTexture {
|
|
|
- private _skyColor: BABYLON.Color3 = new BABYLON.Color3(0.15, 0.68, 1.0);
|
|
|
- private _cloudColor: BABYLON.Color3 = new BABYLON.Color3(1, 1, 1);
|
|
|
+ private _skyColor = new Color3(0.15, 0.68, 1.0);
|
|
|
+ private _cloudColor = new Color3(1, 1, 1);
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
|
super(name, size, "cloud", scene, fallbackTexture, generateMipMaps);
|
|
@@ -176,40 +174,39 @@
|
|
|
this.setColor3("cloudColor", this._cloudColor);
|
|
|
}
|
|
|
|
|
|
- public get skyColor(): BABYLON.Color3 {
|
|
|
+ public get skyColor(): Color3 {
|
|
|
return this._skyColor;
|
|
|
}
|
|
|
|
|
|
- public set skyColor(value: BABYLON.Color3) {
|
|
|
+ public set skyColor(value: Color3) {
|
|
|
this._skyColor = value;
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
|
|
|
|
- public get cloudColor(): BABYLON.Color3 {
|
|
|
+ public get cloudColor(): Color3 {
|
|
|
return this._cloudColor;
|
|
|
}
|
|
|
|
|
|
- public set cloudColor(value: BABYLON.Color3) {
|
|
|
+ public set cloudColor(value: Color3) {
|
|
|
this._cloudColor = value;
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export class GrassProceduralTexture extends ProceduralTexture {
|
|
|
- private _grassColors: BABYLON.Color3[];
|
|
|
- private _herb1: BABYLON.Color3 = new BABYLON.Color3(0.29, 0.38, 0.02);
|
|
|
- private _herb2: BABYLON.Color3 = new BABYLON.Color3(0.36, 0.49, 0.09);
|
|
|
- private _herb3: BABYLON.Color3 = new BABYLON.Color3(0.51, 0.6, 0.28);
|
|
|
- private _dirtColor: BABYLON.Color3 = new BABYLON.Color3(0.6, 0.46, 0.13);
|
|
|
- private _groundColor: BABYLON.Color3 = new BABYLON.Color3(1, 1, 1);
|
|
|
+ private _grassColors: Color3[];
|
|
|
+ private _herb1 = new Color3(0.29, 0.38, 0.02);
|
|
|
+ private _herb2 = new Color3(0.36, 0.49, 0.09);
|
|
|
+ private _herb3 = new Color3(0.51, 0.6, 0.28);
|
|
|
+ private _groundColor = new Color3(1, 1, 1);
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
|
super(name, size, "grass", scene, fallbackTexture, generateMipMaps);
|
|
|
|
|
|
this._grassColors = [
|
|
|
- new BABYLON.Color3(0.29, 0.38, 0.02),
|
|
|
- new BABYLON.Color3(0.36, 0.49, 0.09),
|
|
|
- new BABYLON.Color3(0.51, 0.6, 0.28),
|
|
|
+ new Color3(0.29, 0.38, 0.02),
|
|
|
+ new Color3(0.36, 0.49, 0.09),
|
|
|
+ new Color3(0.51, 0.6, 0.28)
|
|
|
];
|
|
|
|
|
|
this.updateShaderUniforms();
|
|
@@ -217,43 +214,33 @@
|
|
|
}
|
|
|
|
|
|
public updateShaderUniforms() {
|
|
|
- this.setColor3("herb1", this._grassColors[0]);
|
|
|
- this.setColor3("herb2", this._grassColors[1]);
|
|
|
- this.setColor3("herb3", this._grassColors[2]);
|
|
|
- this.setColor3("dirt", this._dirtColor);
|
|
|
- this.setColor3("ground", this._groundColor);
|
|
|
+ this.setColor3("herb1Color", this._grassColors[0]);
|
|
|
+ this.setColor3("herb2Color", this._grassColors[1]);
|
|
|
+ this.setColor3("herb3Color", this._grassColors[2]);
|
|
|
+ this.setColor3("groundColor", this._groundColor);
|
|
|
}
|
|
|
|
|
|
- public get grassColors(): BABYLON.Color3[] {
|
|
|
+ public get grassColors(): Color3[] {
|
|
|
return this._grassColors;
|
|
|
}
|
|
|
|
|
|
- public set grassColors(value: BABYLON.Color3[]) {
|
|
|
+ public set grassColors(value: Color3[]) {
|
|
|
this._grassColors = value;
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
|
|
|
|
- public get dirtColor(): BABYLON.Color3 {
|
|
|
- return this._dirtColor;
|
|
|
- }
|
|
|
-
|
|
|
- public set dirtColor(value: BABYLON.Color3) {
|
|
|
- this._dirtColor = value;
|
|
|
- this.updateShaderUniforms();
|
|
|
- }
|
|
|
-
|
|
|
- public get groundColor(): BABYLON.Color3 {
|
|
|
+ public get groundColor(): Color3 {
|
|
|
return this._groundColor;
|
|
|
}
|
|
|
|
|
|
- public set ground(value: BABYLON.Color3) {
|
|
|
+ public set groundColor(value: Color3) {
|
|
|
this.groundColor = value;
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export class RoadProceduralTexture extends ProceduralTexture {
|
|
|
- private _roadColor: BABYLON.Color3 = new BABYLON.Color3(0.53, 0.53, 0.53);
|
|
|
+ private _roadColor = new Color3(0.53, 0.53, 0.53);
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
|
super(name, size, "road", scene, fallbackTexture, generateMipMaps);
|
|
@@ -265,11 +252,11 @@
|
|
|
this.setColor3("roadColor", this._roadColor);
|
|
|
}
|
|
|
|
|
|
- public get roadColor(): BABYLON.Color3 {
|
|
|
+ public get roadColor(): Color3 {
|
|
|
return this._roadColor;
|
|
|
}
|
|
|
|
|
|
- public set roadColor(value: BABYLON.Color3) {
|
|
|
+ public set roadColor(value: Color3) {
|
|
|
this._roadColor = value;
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
@@ -278,8 +265,8 @@
|
|
|
export class BrickProceduralTexture extends ProceduralTexture {
|
|
|
private _numberOfBricksHeight: number = 15;
|
|
|
private _numberOfBricksWidth: number = 5;
|
|
|
- private _jointColor: BABYLON.Color3 = new BABYLON.Color3(0.72, 0.72, 0.72);
|
|
|
- private _brickColor: BABYLON.Color3 = new BABYLON.Color3(0.77, 0.47, 0.40);
|
|
|
+ private _jointColor = new Color3(0.72, 0.72, 0.72);
|
|
|
+ private _brickColor = new Color3(0.77, 0.47, 0.40);
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
|
super(name, size, "brick", scene, fallbackTexture, generateMipMaps);
|
|
@@ -290,8 +277,8 @@
|
|
|
public updateShaderUniforms() {
|
|
|
this.setFloat("numberOfBricksHeight", this._numberOfBricksHeight);
|
|
|
this.setFloat("numberOfBricksWidth", this._numberOfBricksWidth);
|
|
|
- this.setColor3("brick", this._brickColor);
|
|
|
- this.setColor3("joint", this._jointColor);
|
|
|
+ this.setColor3("brickColor", this._brickColor);
|
|
|
+ this.setColor3("jointColor", this._jointColor);
|
|
|
}
|
|
|
|
|
|
public get numberOfBricksHeight(): number {
|
|
@@ -312,20 +299,20 @@
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
|
|
|
|
- public get jointColor(): BABYLON.Color3 {
|
|
|
+ public get jointColor(): Color3 {
|
|
|
return this._jointColor;
|
|
|
}
|
|
|
|
|
|
- public set jointColor(value: BABYLON.Color3) {
|
|
|
+ public set jointColor(value: Color3) {
|
|
|
this._jointColor = value;
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
|
|
|
|
- public get brickColor(): BABYLON.Color3 {
|
|
|
+ public get brickColor(): Color3 {
|
|
|
return this._brickColor;
|
|
|
}
|
|
|
|
|
|
- public set brickColor(value: BABYLON.Color3) {
|
|
|
+ public set brickColor(value: Color3) {
|
|
|
this._brickColor = value;
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
@@ -335,8 +322,8 @@
|
|
|
private _numberOfTilesHeight: number = 3;
|
|
|
private _numberOfTilesWidth: number = 3;
|
|
|
private _amplitude: number = 9.0;
|
|
|
- private _marbleColor: BABYLON.Color3 = new BABYLON.Color3(0.77, 0.47, 0.40);
|
|
|
- private _jointColor: BABYLON.Color3 = new BABYLON.Color3(0.72, 0.72, 0.72);
|
|
|
+ private _marbleColor = new Color3(0.77, 0.47, 0.40);
|
|
|
+ private _jointColor = new Color3(0.72, 0.72, 0.72);
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
|
super(name, size, "marble", scene, fallbackTexture, generateMipMaps);
|
|
@@ -345,11 +332,11 @@
|
|
|
}
|
|
|
|
|
|
public updateShaderUniforms() {
|
|
|
- this.setFloat("numberOfBricksHeight", this._numberOfTilesHeight);
|
|
|
- this.setFloat("numberOfBricksWidth", this._numberOfTilesWidth);
|
|
|
+ this.setFloat("numberOfTilesHeight", this._numberOfTilesHeight);
|
|
|
+ this.setFloat("numberOfTilesWidth", this._numberOfTilesWidth);
|
|
|
this.setFloat("amplitude", this._amplitude);
|
|
|
- this.setColor3("brick", this._marbleColor);
|
|
|
- this.setColor3("joint", this._jointColor);
|
|
|
+ this.setColor3("marbleColor", this._marbleColor);
|
|
|
+ this.setColor3("jointColor", this._jointColor);
|
|
|
}
|
|
|
|
|
|
public get numberOfTilesHeight(): number {
|
|
@@ -370,20 +357,20 @@
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
|
|
|
|
- public get jointColor(): BABYLON.Color3 {
|
|
|
+ public get jointColor(): Color3 {
|
|
|
return this._jointColor;
|
|
|
}
|
|
|
|
|
|
- public set jointColor(value: BABYLON.Color3) {
|
|
|
+ public set jointColor(value: Color3) {
|
|
|
this._jointColor = value;
|
|
|
this.updateShaderUniforms();
|
|
|
}
|
|
|
|
|
|
- public get marbleColor(): BABYLON.Color3 {
|
|
|
+ public get marbleColor(): Color3 {
|
|
|
return this._marbleColor;
|
|
|
}
|
|
|
|
|
|
- public set marbleColor(value: BABYLON.Color3) {
|
|
|
+ public set marbleColor(value: Color3) {
|
|
|
this._marbleColor = value;
|
|
|
this.updateShaderUniforms();
|
|
|
}
|