babylon.woodProceduralTexture.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /// <reference path="../../../dist/preview release/babylon.d.ts"/>
  2. module BABYLON {
  3. export class WoodProceduralTexture2 extends ProceduralTexture {
  4. private _ampScale: number = 100.0;
  5. private _woodColor: Color3 = new Color3(0.32, 0.17, 0.09);
  6. constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
  7. super(name, size, "woodtexture", scene, fallbackTexture, generateMipMaps);
  8. this.updateShaderUniforms();
  9. this.refreshRate = 0;
  10. }
  11. public updateShaderUniforms() {
  12. this.setFloat("ampScale", this._ampScale);
  13. this.setColor3("woodColor", this._woodColor);
  14. }
  15. public get ampScale(): number {
  16. return this._ampScale;
  17. }
  18. public set ampScale(value: number) {
  19. this._ampScale = value;
  20. this.updateShaderUniforms();
  21. }
  22. public get woodColor(): Color3 {
  23. return this._woodColor;
  24. }
  25. public set woodColor(value: Color3) {
  26. this._woodColor = value;
  27. this.updateShaderUniforms();
  28. }
  29. }
  30. }