babylon.woodProceduralTexture.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /// <reference path="../../../dist/preview release/babylon.d.ts"/>
  2. module BABYLON {
  3. export class WoodProceduralTexture 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, "woodProceduralTexture", scene, fallbackTexture, generateMipMaps);
  8. this.updateShaderUniforms();
  9. }
  10. public updateShaderUniforms() {
  11. this.setFloat("ampScale", this._ampScale);
  12. this.setColor3("woodColor", this._woodColor);
  13. }
  14. public get ampScale(): number {
  15. return this._ampScale;
  16. }
  17. public set ampScale(value: number) {
  18. this._ampScale = value;
  19. this.updateShaderUniforms();
  20. }
  21. public get woodColor(): Color3 {
  22. return this._woodColor;
  23. }
  24. public set woodColor(value: Color3) {
  25. this._woodColor = value;
  26. this.updateShaderUniforms();
  27. }
  28. }
  29. }