babylonjs.materials.d.ts 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998
  1. declare module BABYLON {
  2. /** @hidden */
  3. export var cellPixelShader: {
  4. name: string;
  5. shader: string;
  6. };
  7. }
  8. declare module BABYLON {
  9. /** @hidden */
  10. export var cellVertexShader: {
  11. name: string;
  12. shader: string;
  13. };
  14. }
  15. declare module BABYLON {
  16. export class CellMaterial extends BABYLON.PushMaterial {
  17. private _diffuseTexture;
  18. diffuseTexture: BABYLON.BaseTexture;
  19. diffuseColor: BABYLON.Color3;
  20. _computeHighLevel: boolean;
  21. computeHighLevel: boolean;
  22. private _disableLighting;
  23. disableLighting: boolean;
  24. private _maxSimultaneousLights;
  25. maxSimultaneousLights: number;
  26. constructor(name: string, scene: BABYLON.Scene);
  27. needAlphaBlending(): boolean;
  28. needAlphaTesting(): boolean;
  29. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  30. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  31. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  32. getAnimatables(): BABYLON.IAnimatable[];
  33. getActiveTextures(): BABYLON.BaseTexture[];
  34. hasTexture(texture: BABYLON.BaseTexture): boolean;
  35. dispose(forceDisposeEffect?: boolean): void;
  36. getClassName(): string;
  37. clone(name: string): CellMaterial;
  38. serialize(): any;
  39. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): CellMaterial;
  40. }
  41. }
  42. declare module BABYLON {
  43. export class CustomShaderStructure {
  44. FragmentStore: string;
  45. VertexStore: string;
  46. constructor();
  47. }
  48. export class ShaderSpecialParts {
  49. constructor();
  50. Fragment_Begin: string;
  51. Fragment_Definitions: string;
  52. Fragment_MainBegin: string;
  53. Fragment_Custom_Diffuse: string;
  54. Fragment_Before_Lights: string;
  55. Fragment_Before_Fog: string;
  56. Fragment_Custom_Alpha: string;
  57. Fragment_Before_FragColor: string;
  58. Vertex_Begin: string;
  59. Vertex_Definitions: string;
  60. Vertex_MainBegin: string;
  61. Vertex_Before_PositionUpdated: string;
  62. Vertex_Before_NormalUpdated: string;
  63. Vertex_After_WorldPosComputed: string;
  64. Vertex_MainEnd: string;
  65. }
  66. export class CustomMaterial extends BABYLON.StandardMaterial {
  67. static ShaderIndexer: number;
  68. CustomParts: ShaderSpecialParts;
  69. _isCreatedShader: boolean;
  70. _createdShaderName: string;
  71. _customUniform: string[];
  72. _newUniforms: string[];
  73. _newUniformInstances: {
  74. [name: string]: any;
  75. };
  76. _newSamplerInstances: {
  77. [name: string]: BABYLON.Texture;
  78. };
  79. _customAttributes: string[];
  80. FragmentShader: string;
  81. VertexShader: string;
  82. AttachAfterBind(mesh: BABYLON.Mesh, effect: BABYLON.Effect): void;
  83. ReviewUniform(name: string, arr: string[]): string[];
  84. Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: BABYLON.MaterialDefines | string[], attributes?: string[]): string;
  85. constructor(name: string, scene: BABYLON.Scene);
  86. AddUniform(name: string, kind: string, param: any): CustomMaterial;
  87. AddAttribute(name: string): CustomMaterial;
  88. Fragment_Begin(shaderPart: string): CustomMaterial;
  89. Fragment_Definitions(shaderPart: string): CustomMaterial;
  90. Fragment_MainBegin(shaderPart: string): CustomMaterial;
  91. Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
  92. Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
  93. Fragment_Before_Lights(shaderPart: string): CustomMaterial;
  94. Fragment_Before_Fog(shaderPart: string): CustomMaterial;
  95. Fragment_Before_FragColor(shaderPart: string): CustomMaterial;
  96. Vertex_Begin(shaderPart: string): CustomMaterial;
  97. Vertex_Definitions(shaderPart: string): CustomMaterial;
  98. Vertex_MainBegin(shaderPart: string): CustomMaterial;
  99. Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial;
  100. Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial;
  101. Vertex_After_WorldPosComputed(shaderPart: string): CustomMaterial;
  102. Vertex_MainEnd(shaderPart: string): CustomMaterial;
  103. }
  104. }
  105. declare module BABYLON {
  106. export class ShaderAlebdoParts {
  107. constructor();
  108. Fragment_Begin: string;
  109. Fragment_Definitions: string;
  110. Fragment_MainBegin: string;
  111. Fragment_Custom_Albedo: string;
  112. Fragment_Before_Lights: string;
  113. Fragment_Custom_MetallicRoughness: string;
  114. Fragment_Custom_MicroSurface: string;
  115. Fragment_Before_Fog: string;
  116. Fragment_Custom_Alpha: string;
  117. Fragment_Before_FragColor: string;
  118. Vertex_Begin: string;
  119. Vertex_Definitions: string;
  120. Vertex_MainBegin: string;
  121. Vertex_Before_PositionUpdated: string;
  122. Vertex_Before_NormalUpdated: string;
  123. Vertex_After_WorldPosComputed: string;
  124. Vertex_MainEnd: string;
  125. }
  126. export class PBRCustomMaterial extends BABYLON.PBRMaterial {
  127. static ShaderIndexer: number;
  128. CustomParts: ShaderAlebdoParts;
  129. _isCreatedShader: boolean;
  130. _createdShaderName: string;
  131. _customUniform: string[];
  132. _newUniforms: string[];
  133. _newUniformInstances: {
  134. [name: string]: any;
  135. };
  136. _newSamplerInstances: {
  137. [name: string]: BABYLON.Texture;
  138. };
  139. _customAttributes: string[];
  140. FragmentShader: string;
  141. VertexShader: string;
  142. AttachAfterBind(mesh: BABYLON.Mesh, effect: BABYLON.Effect): void;
  143. ReviewUniform(name: string, arr: string[]): string[];
  144. Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: BABYLON.MaterialDefines | string[], attributes?: string[]): string;
  145. constructor(name: string, scene: BABYLON.Scene);
  146. AddUniform(name: string, kind: string, param: any): PBRCustomMaterial;
  147. AddAttribute(name: string): PBRCustomMaterial;
  148. Fragment_Begin(shaderPart: string): PBRCustomMaterial;
  149. Fragment_Definitions(shaderPart: string): PBRCustomMaterial;
  150. Fragment_MainBegin(shaderPart: string): PBRCustomMaterial;
  151. Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial;
  152. Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial;
  153. Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial;
  154. Fragment_Custom_MetallicRoughness(shaderPart: string): PBRCustomMaterial;
  155. Fragment_Custom_MicroSurface(shaderPart: string): PBRCustomMaterial;
  156. Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial;
  157. Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial;
  158. Vertex_Begin(shaderPart: string): PBRCustomMaterial;
  159. Vertex_Definitions(shaderPart: string): PBRCustomMaterial;
  160. Vertex_MainBegin(shaderPart: string): PBRCustomMaterial;
  161. Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial;
  162. Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial;
  163. Vertex_After_WorldPosComputed(shaderPart: string): PBRCustomMaterial;
  164. Vertex_MainEnd(shaderPart: string): PBRCustomMaterial;
  165. }
  166. }
  167. declare module BABYLON {
  168. /** @hidden */
  169. export var firePixelShader: {
  170. name: string;
  171. shader: string;
  172. };
  173. }
  174. declare module BABYLON {
  175. /** @hidden */
  176. export var fireVertexShader: {
  177. name: string;
  178. shader: string;
  179. };
  180. }
  181. declare module BABYLON {
  182. export class FireMaterial extends BABYLON.PushMaterial {
  183. private _diffuseTexture;
  184. diffuseTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  185. private _distortionTexture;
  186. distortionTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  187. private _opacityTexture;
  188. opacityTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  189. diffuseColor: BABYLON.Color3;
  190. speed: number;
  191. private _scaledDiffuse;
  192. private _lastTime;
  193. constructor(name: string, scene: BABYLON.Scene);
  194. needAlphaBlending(): boolean;
  195. needAlphaTesting(): boolean;
  196. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  197. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  198. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  199. getAnimatables(): BABYLON.IAnimatable[];
  200. getActiveTextures(): BABYLON.BaseTexture[];
  201. hasTexture(texture: BABYLON.BaseTexture): boolean;
  202. getClassName(): string;
  203. dispose(forceDisposeEffect?: boolean): void;
  204. clone(name: string): FireMaterial;
  205. serialize(): any;
  206. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FireMaterial;
  207. }
  208. }
  209. declare module BABYLON {
  210. /** @hidden */
  211. export var furPixelShader: {
  212. name: string;
  213. shader: string;
  214. };
  215. }
  216. declare module BABYLON {
  217. /** @hidden */
  218. export var furVertexShader: {
  219. name: string;
  220. shader: string;
  221. };
  222. }
  223. declare module BABYLON {
  224. export class FurMaterial extends BABYLON.PushMaterial {
  225. private _diffuseTexture;
  226. diffuseTexture: BABYLON.BaseTexture;
  227. private _heightTexture;
  228. heightTexture: BABYLON.BaseTexture;
  229. diffuseColor: BABYLON.Color3;
  230. furLength: number;
  231. furAngle: number;
  232. furColor: BABYLON.Color3;
  233. furOffset: number;
  234. furSpacing: number;
  235. furGravity: BABYLON.Vector3;
  236. furSpeed: number;
  237. furDensity: number;
  238. furOcclusion: number;
  239. furTexture: BABYLON.DynamicTexture;
  240. private _disableLighting;
  241. disableLighting: boolean;
  242. private _maxSimultaneousLights;
  243. maxSimultaneousLights: number;
  244. highLevelFur: boolean;
  245. _meshes: BABYLON.AbstractMesh[];
  246. private _furTime;
  247. constructor(name: string, scene: BABYLON.Scene);
  248. get furTime(): number;
  249. set furTime(furTime: number);
  250. needAlphaBlending(): boolean;
  251. needAlphaTesting(): boolean;
  252. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  253. updateFur(): void;
  254. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  255. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  256. getAnimatables(): BABYLON.IAnimatable[];
  257. getActiveTextures(): BABYLON.BaseTexture[];
  258. hasTexture(texture: BABYLON.BaseTexture): boolean;
  259. dispose(forceDisposeEffect?: boolean): void;
  260. clone(name: string): FurMaterial;
  261. serialize(): any;
  262. getClassName(): string;
  263. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FurMaterial;
  264. static GenerateTexture(name: string, scene: BABYLON.Scene): BABYLON.DynamicTexture;
  265. static FurifyMesh(sourceMesh: BABYLON.Mesh, quality: number): BABYLON.Mesh[];
  266. }
  267. }
  268. declare module BABYLON {
  269. /** @hidden */
  270. export var gradientPixelShader: {
  271. name: string;
  272. shader: string;
  273. };
  274. }
  275. declare module BABYLON {
  276. /** @hidden */
  277. export var gradientVertexShader: {
  278. name: string;
  279. shader: string;
  280. };
  281. }
  282. declare module BABYLON {
  283. export class GradientMaterial extends BABYLON.PushMaterial {
  284. private _maxSimultaneousLights;
  285. maxSimultaneousLights: number;
  286. topColor: BABYLON.Color3;
  287. topColorAlpha: number;
  288. bottomColor: BABYLON.Color3;
  289. bottomColorAlpha: number;
  290. offset: number;
  291. scale: number;
  292. smoothness: number;
  293. private _disableLighting;
  294. disableLighting: boolean;
  295. constructor(name: string, scene: BABYLON.Scene);
  296. needAlphaBlending(): boolean;
  297. needAlphaTesting(): boolean;
  298. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  299. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  300. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  301. getAnimatables(): BABYLON.IAnimatable[];
  302. dispose(forceDisposeEffect?: boolean): void;
  303. clone(name: string): GradientMaterial;
  304. serialize(): any;
  305. getClassName(): string;
  306. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): GradientMaterial;
  307. }
  308. }
  309. declare module BABYLON {
  310. /** @hidden */
  311. export var gridPixelShader: {
  312. name: string;
  313. shader: string;
  314. };
  315. }
  316. declare module BABYLON {
  317. /** @hidden */
  318. export var gridVertexShader: {
  319. name: string;
  320. shader: string;
  321. };
  322. }
  323. declare module BABYLON {
  324. /**
  325. * The grid materials allows you to wrap any shape with a grid.
  326. * Colors are customizable.
  327. */
  328. export class GridMaterial extends BABYLON.PushMaterial {
  329. /**
  330. * Main color of the grid (e.g. between lines)
  331. */
  332. mainColor: BABYLON.Color3;
  333. /**
  334. * Color of the grid lines.
  335. */
  336. lineColor: BABYLON.Color3;
  337. /**
  338. * The scale of the grid compared to unit.
  339. */
  340. gridRatio: number;
  341. /**
  342. * Allows setting an offset for the grid lines.
  343. */
  344. gridOffset: BABYLON.Vector3;
  345. /**
  346. * The frequency of thicker lines.
  347. */
  348. majorUnitFrequency: number;
  349. /**
  350. * The visibility of minor units in the grid.
  351. */
  352. minorUnitVisibility: number;
  353. /**
  354. * The grid opacity outside of the lines.
  355. */
  356. opacity: number;
  357. /**
  358. * Determine RBG output is premultiplied by alpha value.
  359. */
  360. preMultiplyAlpha: boolean;
  361. private _opacityTexture;
  362. opacityTexture: BABYLON.BaseTexture;
  363. private _gridControl;
  364. /**
  365. * constructor
  366. * @param name The name given to the material in order to identify it afterwards.
  367. * @param scene The scene the material is used in.
  368. */
  369. constructor(name: string, scene: BABYLON.Scene);
  370. /**
  371. * Returns wehter or not the grid requires alpha blending.
  372. */
  373. needAlphaBlending(): boolean;
  374. needAlphaBlendingForMesh(mesh: BABYLON.AbstractMesh): boolean;
  375. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  376. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  377. /**
  378. * Dispose the material and its associated resources.
  379. * @param forceDisposeEffect will also dispose the used effect when true
  380. */
  381. dispose(forceDisposeEffect?: boolean): void;
  382. clone(name: string): GridMaterial;
  383. serialize(): any;
  384. getClassName(): string;
  385. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): GridMaterial;
  386. }
  387. }
  388. declare module BABYLON {
  389. /** @hidden */
  390. export var lavaPixelShader: {
  391. name: string;
  392. shader: string;
  393. };
  394. }
  395. declare module BABYLON {
  396. /** @hidden */
  397. export var lavaVertexShader: {
  398. name: string;
  399. shader: string;
  400. };
  401. }
  402. declare module BABYLON {
  403. export class LavaMaterial extends BABYLON.PushMaterial {
  404. private _diffuseTexture;
  405. diffuseTexture: BABYLON.BaseTexture;
  406. noiseTexture: BABYLON.BaseTexture;
  407. fogColor: BABYLON.Color3;
  408. speed: number;
  409. movingSpeed: number;
  410. lowFrequencySpeed: number;
  411. fogDensity: number;
  412. private _lastTime;
  413. diffuseColor: BABYLON.Color3;
  414. private _disableLighting;
  415. disableLighting: boolean;
  416. private _unlit;
  417. unlit: boolean;
  418. private _maxSimultaneousLights;
  419. maxSimultaneousLights: number;
  420. private _scaledDiffuse;
  421. constructor(name: string, scene: BABYLON.Scene);
  422. needAlphaBlending(): boolean;
  423. needAlphaTesting(): boolean;
  424. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  425. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  426. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  427. getAnimatables(): BABYLON.IAnimatable[];
  428. getActiveTextures(): BABYLON.BaseTexture[];
  429. hasTexture(texture: BABYLON.BaseTexture): boolean;
  430. dispose(forceDisposeEffect?: boolean): void;
  431. clone(name: string): LavaMaterial;
  432. serialize(): any;
  433. getClassName(): string;
  434. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): LavaMaterial;
  435. }
  436. }
  437. declare module BABYLON {
  438. /** @hidden */
  439. export var mixPixelShader: {
  440. name: string;
  441. shader: string;
  442. };
  443. }
  444. declare module BABYLON {
  445. /** @hidden */
  446. export var mixVertexShader: {
  447. name: string;
  448. shader: string;
  449. };
  450. }
  451. declare module BABYLON {
  452. export class MixMaterial extends BABYLON.PushMaterial {
  453. /**
  454. * Mix textures
  455. */
  456. private _mixTexture1;
  457. mixTexture1: BABYLON.BaseTexture;
  458. private _mixTexture2;
  459. mixTexture2: BABYLON.BaseTexture;
  460. /**
  461. * Diffuse textures
  462. */
  463. private _diffuseTexture1;
  464. diffuseTexture1: BABYLON.Texture;
  465. private _diffuseTexture2;
  466. diffuseTexture2: BABYLON.Texture;
  467. private _diffuseTexture3;
  468. diffuseTexture3: BABYLON.Texture;
  469. private _diffuseTexture4;
  470. diffuseTexture4: BABYLON.Texture;
  471. private _diffuseTexture5;
  472. diffuseTexture5: BABYLON.Texture;
  473. private _diffuseTexture6;
  474. diffuseTexture6: BABYLON.Texture;
  475. private _diffuseTexture7;
  476. diffuseTexture7: BABYLON.Texture;
  477. private _diffuseTexture8;
  478. diffuseTexture8: BABYLON.Texture;
  479. /**
  480. * Uniforms
  481. */
  482. diffuseColor: BABYLON.Color3;
  483. specularColor: BABYLON.Color3;
  484. specularPower: number;
  485. private _disableLighting;
  486. disableLighting: boolean;
  487. private _maxSimultaneousLights;
  488. maxSimultaneousLights: number;
  489. constructor(name: string, scene: BABYLON.Scene);
  490. needAlphaBlending(): boolean;
  491. needAlphaTesting(): boolean;
  492. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  493. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  494. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  495. getAnimatables(): BABYLON.IAnimatable[];
  496. getActiveTextures(): BABYLON.BaseTexture[];
  497. hasTexture(texture: BABYLON.BaseTexture): boolean;
  498. dispose(forceDisposeEffect?: boolean): void;
  499. clone(name: string): MixMaterial;
  500. serialize(): any;
  501. getClassName(): string;
  502. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): MixMaterial;
  503. }
  504. }
  505. declare module BABYLON {
  506. /** @hidden */
  507. export var normalPixelShader: {
  508. name: string;
  509. shader: string;
  510. };
  511. }
  512. declare module BABYLON {
  513. /** @hidden */
  514. export var normalVertexShader: {
  515. name: string;
  516. shader: string;
  517. };
  518. }
  519. declare module BABYLON {
  520. export class NormalMaterial extends BABYLON.PushMaterial {
  521. private _diffuseTexture;
  522. diffuseTexture: BABYLON.BaseTexture;
  523. diffuseColor: BABYLON.Color3;
  524. private _disableLighting;
  525. disableLighting: boolean;
  526. private _maxSimultaneousLights;
  527. maxSimultaneousLights: number;
  528. constructor(name: string, scene: BABYLON.Scene);
  529. needAlphaBlending(): boolean;
  530. needAlphaBlendingForMesh(mesh: BABYLON.AbstractMesh): boolean;
  531. needAlphaTesting(): boolean;
  532. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  533. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  534. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  535. getAnimatables(): BABYLON.IAnimatable[];
  536. getActiveTextures(): BABYLON.BaseTexture[];
  537. hasTexture(texture: BABYLON.BaseTexture): boolean;
  538. dispose(forceDisposeEffect?: boolean): void;
  539. clone(name: string): NormalMaterial;
  540. serialize(): any;
  541. getClassName(): string;
  542. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): NormalMaterial;
  543. }
  544. }
  545. declare module BABYLON {
  546. /** @hidden */
  547. export var shadowOnlyPixelShader: {
  548. name: string;
  549. shader: string;
  550. };
  551. }
  552. declare module BABYLON {
  553. /** @hidden */
  554. export var shadowOnlyVertexShader: {
  555. name: string;
  556. shader: string;
  557. };
  558. }
  559. declare module BABYLON {
  560. export class ShadowOnlyMaterial extends BABYLON.PushMaterial {
  561. private _activeLight;
  562. constructor(name: string, scene: BABYLON.Scene);
  563. shadowColor: BABYLON.Color3;
  564. needAlphaBlending(): boolean;
  565. needAlphaTesting(): boolean;
  566. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  567. get activeLight(): BABYLON.IShadowLight;
  568. set activeLight(light: BABYLON.IShadowLight);
  569. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  570. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  571. clone(name: string): ShadowOnlyMaterial;
  572. serialize(): any;
  573. getClassName(): string;
  574. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): ShadowOnlyMaterial;
  575. }
  576. }
  577. declare module BABYLON {
  578. /** @hidden */
  579. export var simplePixelShader: {
  580. name: string;
  581. shader: string;
  582. };
  583. }
  584. declare module BABYLON {
  585. /** @hidden */
  586. export var simpleVertexShader: {
  587. name: string;
  588. shader: string;
  589. };
  590. }
  591. declare module BABYLON {
  592. export class SimpleMaterial extends BABYLON.PushMaterial {
  593. private _diffuseTexture;
  594. diffuseTexture: BABYLON.BaseTexture;
  595. diffuseColor: BABYLON.Color3;
  596. private _disableLighting;
  597. disableLighting: boolean;
  598. private _maxSimultaneousLights;
  599. maxSimultaneousLights: number;
  600. constructor(name: string, scene: BABYLON.Scene);
  601. needAlphaBlending(): boolean;
  602. needAlphaTesting(): boolean;
  603. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  604. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  605. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  606. getAnimatables(): BABYLON.IAnimatable[];
  607. getActiveTextures(): BABYLON.BaseTexture[];
  608. hasTexture(texture: BABYLON.BaseTexture): boolean;
  609. dispose(forceDisposeEffect?: boolean): void;
  610. clone(name: string): SimpleMaterial;
  611. serialize(): any;
  612. getClassName(): string;
  613. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): SimpleMaterial;
  614. }
  615. }
  616. declare module BABYLON {
  617. /** @hidden */
  618. export var skyPixelShader: {
  619. name: string;
  620. shader: string;
  621. };
  622. }
  623. declare module BABYLON {
  624. /** @hidden */
  625. export var skyVertexShader: {
  626. name: string;
  627. shader: string;
  628. };
  629. }
  630. declare module BABYLON {
  631. /**
  632. * This is the sky material which allows to create dynamic and texture free effects for skyboxes.
  633. * @see https://doc.babylonjs.com/extensions/sky
  634. */
  635. export class SkyMaterial extends BABYLON.PushMaterial {
  636. /**
  637. * Defines the overall luminance of sky in interval ]0, 1[.
  638. */
  639. luminance: number;
  640. /**
  641. * Defines the amount (scattering) of haze as opposed to molecules in atmosphere.
  642. */
  643. turbidity: number;
  644. /**
  645. * Defines the sky appearance (light intensity).
  646. */
  647. rayleigh: number;
  648. /**
  649. * Defines the mieCoefficient in interval [0, 0.1] which affects the property .mieDirectionalG.
  650. */
  651. mieCoefficient: number;
  652. /**
  653. * Defines the amount of haze particles following the Mie scattering theory.
  654. */
  655. mieDirectionalG: number;
  656. /**
  657. * Defines the distance of the sun according to the active scene camera.
  658. */
  659. distance: number;
  660. /**
  661. * Defines the sun inclination, in interval [-0.5, 0.5]. When the inclination is not 0, the sun is said
  662. * "inclined".
  663. */
  664. inclination: number;
  665. /**
  666. * Defines the solar azimuth in interval [0, 1]. The azimuth is the angle in the horizontal plan between
  667. * an object direction and a reference direction.
  668. */
  669. azimuth: number;
  670. /**
  671. * Defines the sun position in the sky on (x,y,z). If the property .useSunPosition is set to false, then
  672. * the property is overriden by the inclination and the azimuth and can be read at any moment.
  673. */
  674. sunPosition: BABYLON.Vector3;
  675. /**
  676. * Defines if the sun position should be computed (inclination and azimuth) according to the given
  677. * .sunPosition property.
  678. */
  679. useSunPosition: boolean;
  680. /**
  681. * Defines an offset vector used to get a horizon offset.
  682. * @example skyMaterial.cameraOffset.y = camera.globalPosition.y // Set horizon relative to 0 on the Y axis
  683. */
  684. cameraOffset: BABYLON.Vector3;
  685. private _cameraPosition;
  686. /**
  687. * Instantiates a new sky material.
  688. * This material allows to create dynamic and texture free
  689. * effects for skyboxes by taking care of the atmosphere state.
  690. * @see https://doc.babylonjs.com/extensions/sky
  691. * @param name Define the name of the material in the scene
  692. * @param scene Define the scene the material belong to
  693. */
  694. constructor(name: string, scene: BABYLON.Scene);
  695. /**
  696. * Specifies if the material will require alpha blending
  697. * @returns a boolean specifying if alpha blending is needed
  698. */
  699. needAlphaBlending(): boolean;
  700. /**
  701. * Specifies if this material should be rendered in alpha test mode
  702. * @returns false as the sky material doesn't need alpha testing.
  703. */
  704. needAlphaTesting(): boolean;
  705. /**
  706. * Get the texture used for alpha test purpose.
  707. * @returns null as the sky material has no texture.
  708. */
  709. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  710. /**
  711. * Get if the submesh is ready to be used and all its information available.
  712. * Child classes can use it to update shaders
  713. * @param mesh defines the mesh to check
  714. * @param subMesh defines which submesh to check
  715. * @param useInstances specifies that instances should be used
  716. * @returns a boolean indicating that the submesh is ready or not
  717. */
  718. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  719. /**
  720. * Binds the submesh to this material by preparing the effect and shader to draw
  721. * @param world defines the world transformation matrix
  722. * @param mesh defines the mesh containing the submesh
  723. * @param subMesh defines the submesh to bind the material to
  724. */
  725. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  726. /**
  727. * Get the list of animatables in the material.
  728. * @returns the list of animatables object used in the material
  729. */
  730. getAnimatables(): BABYLON.IAnimatable[];
  731. /**
  732. * Disposes the material
  733. * @param forceDisposeEffect specifies if effects should be forcefully disposed
  734. */
  735. dispose(forceDisposeEffect?: boolean): void;
  736. /**
  737. * Makes a duplicate of the material, and gives it a new name
  738. * @param name defines the new name for the duplicated material
  739. * @returns the cloned material
  740. */
  741. clone(name: string): SkyMaterial;
  742. /**
  743. * Serializes this material in a JSON representation
  744. * @returns the serialized material object
  745. */
  746. serialize(): any;
  747. /**
  748. * Gets the current class name of the material e.g. "SkyMaterial"
  749. * Mainly use in serialization.
  750. * @returns the class name
  751. */
  752. getClassName(): string;
  753. /**
  754. * Creates a sky material from parsed material data
  755. * @param source defines the JSON representation of the material
  756. * @param scene defines the hosting scene
  757. * @param rootUrl defines the root URL to use to load textures and relative dependencies
  758. * @returns a new sky material
  759. */
  760. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): SkyMaterial;
  761. }
  762. }
  763. declare module BABYLON {
  764. /** @hidden */
  765. export var terrainPixelShader: {
  766. name: string;
  767. shader: string;
  768. };
  769. }
  770. declare module BABYLON {
  771. /** @hidden */
  772. export var terrainVertexShader: {
  773. name: string;
  774. shader: string;
  775. };
  776. }
  777. declare module BABYLON {
  778. export class TerrainMaterial extends BABYLON.PushMaterial {
  779. private _mixTexture;
  780. mixTexture: BABYLON.BaseTexture;
  781. private _diffuseTexture1;
  782. diffuseTexture1: BABYLON.Texture;
  783. private _diffuseTexture2;
  784. diffuseTexture2: BABYLON.Texture;
  785. private _diffuseTexture3;
  786. diffuseTexture3: BABYLON.Texture;
  787. private _bumpTexture1;
  788. bumpTexture1: BABYLON.Texture;
  789. private _bumpTexture2;
  790. bumpTexture2: BABYLON.Texture;
  791. private _bumpTexture3;
  792. bumpTexture3: BABYLON.Texture;
  793. diffuseColor: BABYLON.Color3;
  794. specularColor: BABYLON.Color3;
  795. specularPower: number;
  796. private _disableLighting;
  797. disableLighting: boolean;
  798. private _maxSimultaneousLights;
  799. maxSimultaneousLights: number;
  800. constructor(name: string, scene: BABYLON.Scene);
  801. needAlphaBlending(): boolean;
  802. needAlphaTesting(): boolean;
  803. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  804. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  805. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  806. getAnimatables(): BABYLON.IAnimatable[];
  807. getActiveTextures(): BABYLON.BaseTexture[];
  808. hasTexture(texture: BABYLON.BaseTexture): boolean;
  809. dispose(forceDisposeEffect?: boolean): void;
  810. clone(name: string): TerrainMaterial;
  811. serialize(): any;
  812. getClassName(): string;
  813. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): TerrainMaterial;
  814. }
  815. }
  816. declare module BABYLON {
  817. /** @hidden */
  818. export var triplanarPixelShader: {
  819. name: string;
  820. shader: string;
  821. };
  822. }
  823. declare module BABYLON {
  824. /** @hidden */
  825. export var triplanarVertexShader: {
  826. name: string;
  827. shader: string;
  828. };
  829. }
  830. declare module BABYLON {
  831. export class TriPlanarMaterial extends BABYLON.PushMaterial {
  832. mixTexture: BABYLON.BaseTexture;
  833. private _diffuseTextureX;
  834. diffuseTextureX: BABYLON.BaseTexture;
  835. private _diffuseTextureY;
  836. diffuseTextureY: BABYLON.BaseTexture;
  837. private _diffuseTextureZ;
  838. diffuseTextureZ: BABYLON.BaseTexture;
  839. private _normalTextureX;
  840. normalTextureX: BABYLON.BaseTexture;
  841. private _normalTextureY;
  842. normalTextureY: BABYLON.BaseTexture;
  843. private _normalTextureZ;
  844. normalTextureZ: BABYLON.BaseTexture;
  845. tileSize: number;
  846. diffuseColor: BABYLON.Color3;
  847. specularColor: BABYLON.Color3;
  848. specularPower: number;
  849. private _disableLighting;
  850. disableLighting: boolean;
  851. private _maxSimultaneousLights;
  852. maxSimultaneousLights: number;
  853. constructor(name: string, scene: BABYLON.Scene);
  854. needAlphaBlending(): boolean;
  855. needAlphaTesting(): boolean;
  856. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  857. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  858. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  859. getAnimatables(): BABYLON.IAnimatable[];
  860. getActiveTextures(): BABYLON.BaseTexture[];
  861. hasTexture(texture: BABYLON.BaseTexture): boolean;
  862. dispose(forceDisposeEffect?: boolean): void;
  863. clone(name: string): TriPlanarMaterial;
  864. serialize(): any;
  865. getClassName(): string;
  866. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): TriPlanarMaterial;
  867. }
  868. }
  869. declare module BABYLON {
  870. /** @hidden */
  871. export var waterPixelShader: {
  872. name: string;
  873. shader: string;
  874. };
  875. }
  876. declare module BABYLON {
  877. /** @hidden */
  878. export var waterVertexShader: {
  879. name: string;
  880. shader: string;
  881. };
  882. }
  883. declare module BABYLON {
  884. export class WaterMaterial extends BABYLON.PushMaterial {
  885. renderTargetSize: BABYLON.Vector2;
  886. private _bumpTexture;
  887. bumpTexture: BABYLON.BaseTexture;
  888. diffuseColor: BABYLON.Color3;
  889. specularColor: BABYLON.Color3;
  890. specularPower: number;
  891. private _disableLighting;
  892. disableLighting: boolean;
  893. private _maxSimultaneousLights;
  894. maxSimultaneousLights: number;
  895. /**
  896. * @param {number}: Represents the wind force
  897. */
  898. windForce: number;
  899. /**
  900. * @param {Vector2}: The direction of the wind in the plane (X, Z)
  901. */
  902. windDirection: BABYLON.Vector2;
  903. /**
  904. * @param {number}: Wave height, represents the height of the waves
  905. */
  906. waveHeight: number;
  907. /**
  908. * @param {number}: Bump height, represents the bump height related to the bump map
  909. */
  910. bumpHeight: number;
  911. /**
  912. * @param {boolean}: Add a smaller moving bump to less steady waves.
  913. */
  914. private _bumpSuperimpose;
  915. bumpSuperimpose: boolean;
  916. /**
  917. * @param {boolean}: Color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.
  918. */
  919. private _fresnelSeparate;
  920. fresnelSeparate: boolean;
  921. /**
  922. * @param {boolean}: bump Waves modify the reflection.
  923. */
  924. private _bumpAffectsReflection;
  925. bumpAffectsReflection: boolean;
  926. /**
  927. * @param {number}: The water color blended with the refraction (near)
  928. */
  929. waterColor: BABYLON.Color3;
  930. /**
  931. * @param {number}: The blend factor related to the water color
  932. */
  933. colorBlendFactor: number;
  934. /**
  935. * @param {number}: The water color blended with the reflection (far)
  936. */
  937. waterColor2: BABYLON.Color3;
  938. /**
  939. * @param {number}: The blend factor related to the water color (reflection, far)
  940. */
  941. colorBlendFactor2: number;
  942. /**
  943. * @param {number}: Represents the maximum length of a wave
  944. */
  945. waveLength: number;
  946. /**
  947. * @param {number}: Defines the waves speed
  948. */
  949. waveSpeed: number;
  950. /**
  951. * Sets or gets whether or not automatic clipping should be enabled or not. Setting to true will save performances and
  952. * will avoid calculating useless pixels in the pixel shader of the water material.
  953. */
  954. disableClipPlane: boolean;
  955. protected _renderTargets: BABYLON.SmartArray<BABYLON.RenderTargetTexture>;
  956. private _mesh;
  957. private _refractionRTT;
  958. private _reflectionRTT;
  959. private _reflectionTransform;
  960. private _lastTime;
  961. private _lastDeltaTime;
  962. private _useLogarithmicDepth;
  963. private _waitingRenderList;
  964. private _imageProcessingConfiguration;
  965. private _imageProcessingObserver;
  966. /**
  967. * Gets a boolean indicating that current material needs to register RTT
  968. */
  969. get hasRenderTargetTextures(): boolean;
  970. /**
  971. * Constructor
  972. */
  973. constructor(name: string, scene: BABYLON.Scene, renderTargetSize?: BABYLON.Vector2);
  974. get useLogarithmicDepth(): boolean;
  975. set useLogarithmicDepth(value: boolean);
  976. get refractionTexture(): BABYLON.Nullable<BABYLON.RenderTargetTexture>;
  977. get reflectionTexture(): BABYLON.Nullable<BABYLON.RenderTargetTexture>;
  978. addToRenderList(node: any): void;
  979. enableRenderTargets(enable: boolean): void;
  980. getRenderList(): BABYLON.Nullable<BABYLON.AbstractMesh[]>;
  981. get renderTargetsEnabled(): boolean;
  982. needAlphaBlending(): boolean;
  983. needAlphaTesting(): boolean;
  984. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  985. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  986. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  987. private _createRenderTargets;
  988. getAnimatables(): BABYLON.IAnimatable[];
  989. getActiveTextures(): BABYLON.BaseTexture[];
  990. hasTexture(texture: BABYLON.BaseTexture): boolean;
  991. dispose(forceDisposeEffect?: boolean): void;
  992. clone(name: string): WaterMaterial;
  993. serialize(): any;
  994. getClassName(): string;
  995. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): WaterMaterial;
  996. static CreateDefaultMesh(name: string, scene: BABYLON.Scene): BABYLON.Mesh;
  997. }
  998. }