babylonjs.materials.d.ts 38 KB

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