|
@@ -1,17 +1,12 @@
|
|
module BABYLON {
|
|
module BABYLON {
|
|
export class WoodProceduralTexture extends ProceduralTexture {
|
|
export class WoodProceduralTexture extends ProceduralTexture {
|
|
-
|
|
|
|
private _ampScale: number = 100.0;
|
|
private _ampScale: number = 100.0;
|
|
private _woodColor: BABYLON.Color3 = new BABYLON.Color3(0.32, 0.17, 0.09);
|
|
private _woodColor: BABYLON.Color3 = new BABYLON.Color3(0.32, 0.17, 0.09);
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
super(name, size, "wood", scene, fallbackTexture, generateMipMaps);
|
|
super(name, size, "wood", scene, fallbackTexture, generateMipMaps);
|
|
-
|
|
|
|
this.updateShaderUniforms();
|
|
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;
|
|
this.refreshRate = 0;
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public updateShaderUniforms() {
|
|
public updateShaderUniforms() {
|
|
@@ -28,7 +23,6 @@
|
|
this.updateShaderUniforms();
|
|
this.updateShaderUniforms();
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
public get woodColor(): BABYLON.Color3 {
|
|
public get woodColor(): BABYLON.Color3 {
|
|
return this._woodColor;
|
|
return this._woodColor;
|
|
}
|
|
}
|
|
@@ -37,105 +31,95 @@
|
|
this._woodColor = value;
|
|
this._woodColor = value;
|
|
this.updateShaderUniforms();
|
|
this.updateShaderUniforms();
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
export class FireProceduralTexture extends ProceduralTexture {
|
|
export class FireProceduralTexture extends ProceduralTexture {
|
|
-
|
|
|
|
private _time: number = 0.0;
|
|
private _time: number = 0.0;
|
|
private _speed: BABYLON.Vector2 = new BABYLON.Vector2(0.5, 0.3);
|
|
private _speed: BABYLON.Vector2 = new BABYLON.Vector2(0.5, 0.3);
|
|
private _shift: number = 1.6;
|
|
private _shift: number = 1.6;
|
|
- private _alpha: number = 1.0;
|
|
|
|
|
|
+ private _alpha: number = 0.0;
|
|
private _autoGenerateTime: boolean = true;
|
|
private _autoGenerateTime: boolean = true;
|
|
-
|
|
|
|
- private _fireColors: number[][];
|
|
|
|
|
|
+ private _fireColors: BABYLON.Color3[];
|
|
|
|
+ private _alphaThreshold: number = 0.5;
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
super(name, size, "fire", scene, fallbackTexture, generateMipMaps);
|
|
super(name, size, "fire", scene, fallbackTexture, generateMipMaps);
|
|
-
|
|
|
|
this._fireColors = FireProceduralTexture.RedFireColors;
|
|
this._fireColors = FireProceduralTexture.RedFireColors;
|
|
this.updateShaderUniforms();
|
|
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;
|
|
this.refreshRate = 1;
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public updateShaderUniforms() {
|
|
public updateShaderUniforms() {
|
|
-
|
|
|
|
this.setFloat("iGlobalTime", this._time);
|
|
this.setFloat("iGlobalTime", this._time);
|
|
this.setVector2("speed", this._speed);
|
|
this.setVector2("speed", this._speed);
|
|
this.setFloat("shift", this._shift);
|
|
this.setFloat("shift", this._shift);
|
|
this.setFloat("alpha", this._alpha);
|
|
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]));
|
|
|
|
-
|
|
|
|
|
|
+ this.setColor3("c1", this._fireColors[0]);
|
|
|
|
+ this.setColor3("c2", this._fireColors[1]);
|
|
|
|
+ this.setColor3("c3", this._fireColors[2]);
|
|
|
|
+ this.setColor3("c4", this._fireColors[3]);
|
|
|
|
+ this.setColor3("c5", this._fireColors[4]);
|
|
|
|
+ this.setColor3("c6", this._fireColors[5]);
|
|
|
|
+ this.setFloat("alphaThreshold", this._alphaThreshold);
|
|
}
|
|
}
|
|
|
|
|
|
public render(useCameraPostProcess?: boolean) {
|
|
public render(useCameraPostProcess?: boolean) {
|
|
-
|
|
|
|
if (this._autoGenerateTime) {
|
|
if (this._autoGenerateTime) {
|
|
this._time += this.getScene().getAnimationRatio() * 0.03;
|
|
this._time += this.getScene().getAnimationRatio() * 0.03;
|
|
this.updateShaderUniforms();
|
|
this.updateShaderUniforms();
|
|
}
|
|
}
|
|
-
|
|
|
|
super.render(useCameraPostProcess);
|
|
super.render(useCameraPostProcess);
|
|
}
|
|
}
|
|
|
|
|
|
- public static get PurpleFireColors(): number[][] {
|
|
|
|
|
|
+ public static get PurpleFireColors(): BABYLON.Color3[] {
|
|
return [
|
|
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]
|
|
|
|
|
|
+ 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)
|
|
];
|
|
];
|
|
}
|
|
}
|
|
|
|
|
|
- public static get GreenFireColors(): number[][] {
|
|
|
|
|
|
+ public static get GreenFireColors(): BABYLON.Color3[] {
|
|
return [
|
|
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]
|
|
|
|
|
|
+ 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)
|
|
];
|
|
];
|
|
}
|
|
}
|
|
|
|
|
|
- public static get RedFireColors(): number[][] {
|
|
|
|
|
|
+ public static get RedFireColors(): BABYLON.Color3[] {
|
|
return [
|
|
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]
|
|
|
|
|
|
+ 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)
|
|
];
|
|
];
|
|
}
|
|
}
|
|
|
|
|
|
- public static get BlueFireColors(): number[][] {
|
|
|
|
|
|
+ public static get BlueFireColors(): BABYLON.Color3[] {
|
|
return [
|
|
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]
|
|
|
|
|
|
+ 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)
|
|
];
|
|
];
|
|
}
|
|
}
|
|
|
|
|
|
- public get fireColors(): number[][] {
|
|
|
|
|
|
+ public get fireColors(): BABYLON.Color3[] {
|
|
return this._fireColors;
|
|
return this._fireColors;
|
|
}
|
|
}
|
|
|
|
|
|
- public set fireColors(value: number[][]) {
|
|
|
|
|
|
+ public set fireColors(value: BABYLON.Color3[]) {
|
|
this._fireColors = value;
|
|
this._fireColors = value;
|
|
this.updateShaderUniforms();
|
|
this.updateShaderUniforms();
|
|
}
|
|
}
|
|
@@ -175,26 +159,19 @@
|
|
this._alpha = value;
|
|
this._alpha = value;
|
|
this.updateShaderUniforms();
|
|
this.updateShaderUniforms();
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
export class CloudProceduralTexture extends ProceduralTexture {
|
|
export class CloudProceduralTexture extends ProceduralTexture {
|
|
-
|
|
|
|
private _skyColor: BABYLON.Color3 = new BABYLON.Color3(0.15, 0.68, 1.0);
|
|
private _skyColor: BABYLON.Color3 = new BABYLON.Color3(0.15, 0.68, 1.0);
|
|
private _cloudColor: BABYLON.Color3 = new BABYLON.Color3(1, 1, 1);
|
|
private _cloudColor: BABYLON.Color3 = new BABYLON.Color3(1, 1, 1);
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
super(name, size, "cloud", scene, fallbackTexture, generateMipMaps);
|
|
super(name, size, "cloud", scene, fallbackTexture, generateMipMaps);
|
|
-
|
|
|
|
this.updateShaderUniforms();
|
|
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;
|
|
this.refreshRate = 0;
|
|
- // https://www.shadertoy.com/view/XsjSRt
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public updateShaderUniforms() {
|
|
public updateShaderUniforms() {
|
|
-
|
|
|
|
this.setColor3("skyColor", this._skyColor);
|
|
this.setColor3("skyColor", this._skyColor);
|
|
this.setColor3("cloudColor", this._cloudColor);
|
|
this.setColor3("cloudColor", this._cloudColor);
|
|
}
|
|
}
|
|
@@ -219,62 +196,104 @@
|
|
}
|
|
}
|
|
|
|
|
|
export class GrassProceduralTexture extends ProceduralTexture {
|
|
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);
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
super(name, size, "grass", scene, fallbackTexture, generateMipMaps);
|
|
super(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._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),
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ this.updateShaderUniforms();
|
|
this.refreshRate = 0;
|
|
this.refreshRate = 0;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ 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);
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ public get grassColors(): BABYLON.Color3[] {
|
|
|
|
+ return this._grassColors;
|
|
|
|
+ }
|
|
|
|
|
|
- export class RockProceduralTexture extends ProceduralTexture {
|
|
|
|
|
|
+ public set grassColors(value: BABYLON.Color3[]) {
|
|
|
|
+ this._grassColors = value;
|
|
|
|
+ this.updateShaderUniforms();
|
|
|
|
+ }
|
|
|
|
|
|
- constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
|
|
- super(name, size, "rock", scene, fallbackTexture, generateMipMaps);
|
|
|
|
|
|
+ public get dirtColor(): BABYLON.Color3 {
|
|
|
|
+ return this._dirtColor;
|
|
|
|
+ }
|
|
|
|
|
|
- // Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
|
|
|
|
- this.refreshRate = 0;
|
|
|
|
|
|
+ public set dirtColor(value: BABYLON.Color3) {
|
|
|
|
+ this._dirtColor = value;
|
|
|
|
+ this.updateShaderUniforms();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public get groundColor(): BABYLON.Color3 {
|
|
|
|
+ return this._groundColor;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ public set ground(value: BABYLON.Color3) {
|
|
|
|
+ this.groundColor = value;
|
|
|
|
+ this.updateShaderUniforms();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
export class RoadProceduralTexture extends ProceduralTexture {
|
|
export class RoadProceduralTexture extends ProceduralTexture {
|
|
|
|
+ private _roadColor: BABYLON.Color3 = new BABYLON.Color3(0.53, 0.53, 0.53);
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
super(name, size, "road", scene, fallbackTexture, generateMipMaps);
|
|
super(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.updateShaderUniforms();
|
|
this.refreshRate = 0;
|
|
this.refreshRate = 0;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ public updateShaderUniforms() {
|
|
|
|
+ this.setColor3("roadColor", this._roadColor);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public get roadColor(): BABYLON.Color3 {
|
|
|
|
+ return this._roadColor;
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ public set roadColor(value: BABYLON.Color3) {
|
|
|
|
+ this._roadColor = value;
|
|
|
|
+ this.updateShaderUniforms();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
export class BrickProceduralTexture extends ProceduralTexture {
|
|
export class BrickProceduralTexture extends ProceduralTexture {
|
|
-
|
|
|
|
private _numberOfBricksHeight: number = 15;
|
|
private _numberOfBricksHeight: number = 15;
|
|
private _numberOfBricksWidth: number = 5;
|
|
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);
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
super(name, size, "brick", scene, fallbackTexture, generateMipMaps);
|
|
super(name, size, "brick", scene, fallbackTexture, generateMipMaps);
|
|
-
|
|
|
|
this.updateShaderUniforms();
|
|
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;
|
|
this.refreshRate = 0;
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public updateShaderUniforms() {
|
|
public updateShaderUniforms() {
|
|
-
|
|
|
|
this.setFloat("numberOfBricksHeight", this._numberOfBricksHeight);
|
|
this.setFloat("numberOfBricksHeight", this._numberOfBricksHeight);
|
|
this.setFloat("numberOfBricksWidth", this._numberOfBricksWidth);
|
|
this.setFloat("numberOfBricksWidth", this._numberOfBricksWidth);
|
|
|
|
+ this.setColor3("brick", this._brickColor);
|
|
|
|
+ this.setColor3("joint", this._jointColor);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
public get numberOfBricksHeight(): number {
|
|
public get numberOfBricksHeight(): number {
|
|
return this._numberOfBricksHeight;
|
|
return this._numberOfBricksHeight;
|
|
}
|
|
}
|
|
@@ -292,48 +311,81 @@
|
|
this._numberOfBricksHeight = value;
|
|
this._numberOfBricksHeight = value;
|
|
this.updateShaderUniforms();
|
|
this.updateShaderUniforms();
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ public get jointColor(): BABYLON.Color3 {
|
|
|
|
+ return this._jointColor;
|
|
|
|
+ }
|
|
|
|
|
|
- export class MarbleProceduralTexture extends ProceduralTexture {
|
|
|
|
|
|
+ public set jointColor(value: BABYLON.Color3) {
|
|
|
|
+ this._jointColor = value;
|
|
|
|
+ this.updateShaderUniforms();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public get brickColor(): BABYLON.Color3 {
|
|
|
|
+ return this._brickColor;
|
|
|
|
+ }
|
|
|
|
|
|
- private _numberOfBricksHeight: number = 3;
|
|
|
|
- private _numberOfBricksWidth: number = 3;
|
|
|
|
|
|
+ public set brickColor(value: BABYLON.Color3) {
|
|
|
|
+ this._brickColor = value;
|
|
|
|
+ this.updateShaderUniforms();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ export class MarbleProceduralTexture extends ProceduralTexture {
|
|
|
|
+ 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);
|
|
|
|
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
|
|
super(name, size, "marble", scene, fallbackTexture, generateMipMaps);
|
|
super(name, size, "marble", scene, fallbackTexture, generateMipMaps);
|
|
-
|
|
|
|
this.updateShaderUniforms();
|
|
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;
|
|
this.refreshRate = 0;
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public updateShaderUniforms() {
|
|
public updateShaderUniforms() {
|
|
|
|
+ this.setFloat("numberOfBricksHeight", this._numberOfTilesHeight);
|
|
|
|
+ this.setFloat("numberOfBricksWidth", this._numberOfTilesWidth);
|
|
|
|
+ this.setFloat("amplitude", this._amplitude);
|
|
|
|
+ this.setColor3("brick", this._marbleColor);
|
|
|
|
+ this.setColor3("joint", this._jointColor);
|
|
|
|
+ }
|
|
|
|
|
|
- this.setFloat("numberOfBricksHeight", this._numberOfBricksHeight);
|
|
|
|
- this.setFloat("numberOfBricksWidth", this._numberOfBricksWidth);
|
|
|
|
|
|
+ public get numberOfTilesHeight(): number {
|
|
|
|
+ return this._numberOfTilesHeight;
|
|
}
|
|
}
|
|
|
|
|
|
- public get numberOfBricksHeight(): number {
|
|
|
|
- return this._numberOfBricksHeight;
|
|
|
|
|
|
+ public set numberOfTilesHeight(value: number) {
|
|
|
|
+ this._numberOfTilesHeight = value;
|
|
|
|
+ this.updateShaderUniforms();
|
|
}
|
|
}
|
|
|
|
|
|
- public set cloudColor(value: number) {
|
|
|
|
- this._numberOfBricksHeight = value;
|
|
|
|
|
|
+ public get numberOfTilesWidth(): number {
|
|
|
|
+ return this._numberOfTilesWidth;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public set numberOfTilesWidth(value: number) {
|
|
|
|
+ this._numberOfTilesWidth = value;
|
|
this.updateShaderUniforms();
|
|
this.updateShaderUniforms();
|
|
}
|
|
}
|
|
|
|
|
|
- public get numberOfBricksWidth(): number {
|
|
|
|
- return this._numberOfBricksWidth;
|
|
|
|
|
|
+ public get jointColor(): BABYLON.Color3 {
|
|
|
|
+ return this._jointColor;
|
|
}
|
|
}
|
|
|
|
|
|
- public set numberOfBricksWidth(value: number) {
|
|
|
|
- this._numberOfBricksHeight = value;
|
|
|
|
|
|
+ public set jointColor(value: BABYLON.Color3) {
|
|
|
|
+ this._jointColor = value;
|
|
this.updateShaderUniforms();
|
|
this.updateShaderUniforms();
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ public get marbleColor(): BABYLON.Color3 {
|
|
|
|
+ return this._marbleColor;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ public set marbleColor(value: BABYLON.Color3) {
|
|
|
|
+ this._marbleColor = value;
|
|
|
|
+ this.updateShaderUniforms();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|