babylon.starfieldProceduralTexture.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /// <reference path="../../../dist/preview release/babylon.d.ts"/>
  2. module BABYLON {
  3. export class StarfieldProceduralTexture extends ProceduralTexture {
  4. private _time = 1;
  5. private _alpha = 0.5;
  6. private _beta = 0.8;
  7. private _zoom = 0.8;
  8. constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean) {
  9. super(name, size, "starfieldProceduralTexture", scene, fallbackTexture, generateMipMaps);
  10. this.updateShaderUniforms();
  11. }
  12. public updateShaderUniforms() {
  13. this.setFloat("time", this._time);
  14. this.setFloat("alpha", this._alpha);
  15. this.setFloat("beta", this._beta);
  16. this.setFloat("zoom", this._zoom);
  17. }
  18. public get time(): number {
  19. return this._time;
  20. }
  21. public set time(value: number) {
  22. this._time = value;
  23. this.updateShaderUniforms();
  24. }
  25. public get alpha(): number {
  26. return this._alpha;
  27. }
  28. public set alpha(value: number) {
  29. this._alpha = value;
  30. this.updateShaderUniforms();
  31. }
  32. public get beta(): number {
  33. return this._beta;
  34. }
  35. public set beta(value: number) {
  36. this._beta = value;
  37. this.updateShaderUniforms();
  38. }
  39. public get zoom(): number {
  40. return this._zoom;
  41. }
  42. public set zoom(value: number) {
  43. this._zoom = value;
  44. this.updateShaderUniforms();
  45. }
  46. }
  47. }