babylonjs.materials.d.ts 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009
  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. private _needAlphaBlending;
  563. constructor(name: string, scene: BABYLON.Scene);
  564. shadowColor: BABYLON.Color3;
  565. needAlphaBlending(): boolean;
  566. needAlphaTesting(): boolean;
  567. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  568. get activeLight(): BABYLON.IShadowLight;
  569. set activeLight(light: BABYLON.IShadowLight);
  570. private _getFirstShadowLightForMesh;
  571. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  572. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  573. clone(name: string): ShadowOnlyMaterial;
  574. serialize(): any;
  575. getClassName(): string;
  576. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): ShadowOnlyMaterial;
  577. }
  578. }
  579. declare module BABYLON {
  580. /** @hidden */
  581. export var simplePixelShader: {
  582. name: string;
  583. shader: string;
  584. };
  585. }
  586. declare module BABYLON {
  587. /** @hidden */
  588. export var simpleVertexShader: {
  589. name: string;
  590. shader: string;
  591. };
  592. }
  593. declare module BABYLON {
  594. export class SimpleMaterial extends BABYLON.PushMaterial {
  595. private _diffuseTexture;
  596. diffuseTexture: BABYLON.BaseTexture;
  597. diffuseColor: BABYLON.Color3;
  598. private _disableLighting;
  599. disableLighting: boolean;
  600. private _maxSimultaneousLights;
  601. maxSimultaneousLights: number;
  602. constructor(name: string, scene: BABYLON.Scene);
  603. needAlphaBlending(): boolean;
  604. needAlphaTesting(): boolean;
  605. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  606. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  607. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  608. getAnimatables(): BABYLON.IAnimatable[];
  609. getActiveTextures(): BABYLON.BaseTexture[];
  610. hasTexture(texture: BABYLON.BaseTexture): boolean;
  611. dispose(forceDisposeEffect?: boolean): void;
  612. clone(name: string): SimpleMaterial;
  613. serialize(): any;
  614. getClassName(): string;
  615. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): SimpleMaterial;
  616. }
  617. }
  618. declare module BABYLON {
  619. /** @hidden */
  620. export var skyPixelShader: {
  621. name: string;
  622. shader: string;
  623. };
  624. }
  625. declare module BABYLON {
  626. /** @hidden */
  627. export var skyVertexShader: {
  628. name: string;
  629. shader: string;
  630. };
  631. }
  632. declare module BABYLON {
  633. /**
  634. * This is the sky material which allows to create dynamic and texture free effects for skyboxes.
  635. * @see https://doc.babylonjs.com/extensions/sky
  636. */
  637. export class SkyMaterial extends BABYLON.PushMaterial {
  638. /**
  639. * Defines the overall luminance of sky in interval ]0, 1[.
  640. */
  641. luminance: number;
  642. /**
  643. * Defines the amount (scattering) of haze as opposed to molecules in atmosphere.
  644. */
  645. turbidity: number;
  646. /**
  647. * Defines the sky appearance (light intensity).
  648. */
  649. rayleigh: number;
  650. /**
  651. * Defines the mieCoefficient in interval [0, 0.1] which affects the property .mieDirectionalG.
  652. */
  653. mieCoefficient: number;
  654. /**
  655. * Defines the amount of haze particles following the Mie scattering theory.
  656. */
  657. mieDirectionalG: number;
  658. /**
  659. * Defines the distance of the sun according to the active scene camera.
  660. */
  661. distance: number;
  662. /**
  663. * Defines the sun inclination, in interval [-0.5, 0.5]. When the inclination is not 0, the sun is said
  664. * "inclined".
  665. */
  666. inclination: number;
  667. /**
  668. * Defines the solar azimuth in interval [0, 1]. The azimuth is the angle in the horizontal plan between
  669. * an object direction and a reference direction.
  670. */
  671. azimuth: number;
  672. /**
  673. * Defines the sun position in the sky on (x,y,z). If the property .useSunPosition is set to false, then
  674. * the property is overriden by the inclination and the azimuth and can be read at any moment.
  675. */
  676. sunPosition: BABYLON.Vector3;
  677. /**
  678. * Defines if the sun position should be computed (inclination and azimuth) according to the given
  679. * .sunPosition property.
  680. */
  681. useSunPosition: boolean;
  682. /**
  683. * Defines an offset vector used to get a horizon offset.
  684. * @example skyMaterial.cameraOffset.y = camera.globalPosition.y // Set horizon relative to 0 on the Y axis
  685. */
  686. cameraOffset: BABYLON.Vector3;
  687. /**
  688. * Defines the vector the skyMaterial should consider as up. (default is BABYLON.Vector3(0, 1, 0) as returned by BABYLON.Vector3.Up())
  689. */
  690. up: BABYLON.Vector3;
  691. private _cameraPosition;
  692. private _skyOrientation;
  693. /**
  694. * Instantiates a new sky material.
  695. * This material allows to create dynamic and texture free
  696. * effects for skyboxes by taking care of the atmosphere state.
  697. * @see https://doc.babylonjs.com/extensions/sky
  698. * @param name Define the name of the material in the scene
  699. * @param scene Define the scene the material belong to
  700. */
  701. constructor(name: string, scene: BABYLON.Scene);
  702. /**
  703. * Specifies if the material will require alpha blending
  704. * @returns a boolean specifying if alpha blending is needed
  705. */
  706. needAlphaBlending(): boolean;
  707. /**
  708. * Specifies if this material should be rendered in alpha test mode
  709. * @returns false as the sky material doesn't need alpha testing.
  710. */
  711. needAlphaTesting(): boolean;
  712. /**
  713. * Get the texture used for alpha test purpose.
  714. * @returns null as the sky material has no texture.
  715. */
  716. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  717. /**
  718. * Get if the submesh is ready to be used and all its information available.
  719. * Child classes can use it to update shaders
  720. * @param mesh defines the mesh to check
  721. * @param subMesh defines which submesh to check
  722. * @param useInstances specifies that instances should be used
  723. * @returns a boolean indicating that the submesh is ready or not
  724. */
  725. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  726. /**
  727. * Binds the submesh to this material by preparing the effect and shader to draw
  728. * @param world defines the world transformation matrix
  729. * @param mesh defines the mesh containing the submesh
  730. * @param subMesh defines the submesh to bind the material to
  731. */
  732. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  733. /**
  734. * Get the list of animatables in the material.
  735. * @returns the list of animatables object used in the material
  736. */
  737. getAnimatables(): BABYLON.IAnimatable[];
  738. /**
  739. * Disposes the material
  740. * @param forceDisposeEffect specifies if effects should be forcefully disposed
  741. */
  742. dispose(forceDisposeEffect?: boolean): void;
  743. /**
  744. * Makes a duplicate of the material, and gives it a new name
  745. * @param name defines the new name for the duplicated material
  746. * @returns the cloned material
  747. */
  748. clone(name: string): SkyMaterial;
  749. /**
  750. * Serializes this material in a JSON representation
  751. * @returns the serialized material object
  752. */
  753. serialize(): any;
  754. /**
  755. * Gets the current class name of the material e.g. "SkyMaterial"
  756. * Mainly use in serialization.
  757. * @returns the class name
  758. */
  759. getClassName(): string;
  760. /**
  761. * Creates a sky material from parsed material data
  762. * @param source defines the JSON representation of the material
  763. * @param scene defines the hosting scene
  764. * @param rootUrl defines the root URL to use to load textures and relative dependencies
  765. * @returns a new sky material
  766. */
  767. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): SkyMaterial;
  768. }
  769. }
  770. declare module BABYLON {
  771. /** @hidden */
  772. export var terrainPixelShader: {
  773. name: string;
  774. shader: string;
  775. };
  776. }
  777. declare module BABYLON {
  778. /** @hidden */
  779. export var terrainVertexShader: {
  780. name: string;
  781. shader: string;
  782. };
  783. }
  784. declare module BABYLON {
  785. export class TerrainMaterial extends BABYLON.PushMaterial {
  786. private _mixTexture;
  787. mixTexture: BABYLON.BaseTexture;
  788. private _diffuseTexture1;
  789. diffuseTexture1: BABYLON.Texture;
  790. private _diffuseTexture2;
  791. diffuseTexture2: BABYLON.Texture;
  792. private _diffuseTexture3;
  793. diffuseTexture3: BABYLON.Texture;
  794. private _bumpTexture1;
  795. bumpTexture1: BABYLON.Texture;
  796. private _bumpTexture2;
  797. bumpTexture2: BABYLON.Texture;
  798. private _bumpTexture3;
  799. bumpTexture3: BABYLON.Texture;
  800. diffuseColor: BABYLON.Color3;
  801. specularColor: BABYLON.Color3;
  802. specularPower: number;
  803. private _disableLighting;
  804. disableLighting: boolean;
  805. private _maxSimultaneousLights;
  806. maxSimultaneousLights: number;
  807. constructor(name: string, scene: BABYLON.Scene);
  808. needAlphaBlending(): boolean;
  809. needAlphaTesting(): boolean;
  810. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  811. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  812. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  813. getAnimatables(): BABYLON.IAnimatable[];
  814. getActiveTextures(): BABYLON.BaseTexture[];
  815. hasTexture(texture: BABYLON.BaseTexture): boolean;
  816. dispose(forceDisposeEffect?: boolean): void;
  817. clone(name: string): TerrainMaterial;
  818. serialize(): any;
  819. getClassName(): string;
  820. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): TerrainMaterial;
  821. }
  822. }
  823. declare module BABYLON {
  824. /** @hidden */
  825. export var triplanarPixelShader: {
  826. name: string;
  827. shader: string;
  828. };
  829. }
  830. declare module BABYLON {
  831. /** @hidden */
  832. export var triplanarVertexShader: {
  833. name: string;
  834. shader: string;
  835. };
  836. }
  837. declare module BABYLON {
  838. export class TriPlanarMaterial extends BABYLON.PushMaterial {
  839. mixTexture: BABYLON.BaseTexture;
  840. private _diffuseTextureX;
  841. diffuseTextureX: BABYLON.BaseTexture;
  842. private _diffuseTextureY;
  843. diffuseTextureY: BABYLON.BaseTexture;
  844. private _diffuseTextureZ;
  845. diffuseTextureZ: BABYLON.BaseTexture;
  846. private _normalTextureX;
  847. normalTextureX: BABYLON.BaseTexture;
  848. private _normalTextureY;
  849. normalTextureY: BABYLON.BaseTexture;
  850. private _normalTextureZ;
  851. normalTextureZ: BABYLON.BaseTexture;
  852. tileSize: number;
  853. diffuseColor: BABYLON.Color3;
  854. specularColor: BABYLON.Color3;
  855. specularPower: number;
  856. private _disableLighting;
  857. disableLighting: boolean;
  858. private _maxSimultaneousLights;
  859. maxSimultaneousLights: number;
  860. constructor(name: string, scene: BABYLON.Scene);
  861. needAlphaBlending(): boolean;
  862. needAlphaTesting(): boolean;
  863. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  864. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  865. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  866. getAnimatables(): BABYLON.IAnimatable[];
  867. getActiveTextures(): BABYLON.BaseTexture[];
  868. hasTexture(texture: BABYLON.BaseTexture): boolean;
  869. dispose(forceDisposeEffect?: boolean): void;
  870. clone(name: string): TriPlanarMaterial;
  871. serialize(): any;
  872. getClassName(): string;
  873. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): TriPlanarMaterial;
  874. }
  875. }
  876. declare module BABYLON {
  877. /** @hidden */
  878. export var waterPixelShader: {
  879. name: string;
  880. shader: string;
  881. };
  882. }
  883. declare module BABYLON {
  884. /** @hidden */
  885. export var waterVertexShader: {
  886. name: string;
  887. shader: string;
  888. };
  889. }
  890. declare module BABYLON {
  891. export class WaterMaterial extends BABYLON.PushMaterial {
  892. renderTargetSize: BABYLON.Vector2;
  893. private _bumpTexture;
  894. bumpTexture: BABYLON.BaseTexture;
  895. diffuseColor: BABYLON.Color3;
  896. specularColor: BABYLON.Color3;
  897. specularPower: number;
  898. private _disableLighting;
  899. disableLighting: boolean;
  900. private _maxSimultaneousLights;
  901. maxSimultaneousLights: number;
  902. /**
  903. * Defines the wind force.
  904. */
  905. windForce: number;
  906. /**
  907. * Defines the direction of the wind in the plane (X, Z).
  908. */
  909. windDirection: BABYLON.Vector2;
  910. /**
  911. * Defines the height of the waves.
  912. */
  913. waveHeight: number;
  914. /**
  915. * Defines the bump height related to the bump map.
  916. */
  917. bumpHeight: number;
  918. /**
  919. * Defines wether or not: to add a smaller moving bump to less steady waves.
  920. */
  921. private _bumpSuperimpose;
  922. bumpSuperimpose: boolean;
  923. /**
  924. * Defines wether or not color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.
  925. */
  926. private _fresnelSeparate;
  927. fresnelSeparate: boolean;
  928. /**
  929. * Defines wether or not bump Wwves modify the reflection.
  930. */
  931. private _bumpAffectsReflection;
  932. bumpAffectsReflection: boolean;
  933. /**
  934. * Defines the water color blended with the refraction (near).
  935. */
  936. waterColor: BABYLON.Color3;
  937. /**
  938. * Defines the blend factor related to the water color.
  939. */
  940. colorBlendFactor: number;
  941. /**
  942. * Defines the water color blended with the reflection (far).
  943. */
  944. waterColor2: BABYLON.Color3;
  945. /**
  946. * Defines the blend factor related to the water color (reflection, far).
  947. */
  948. colorBlendFactor2: number;
  949. /**
  950. * Defines the maximum length of a wave.
  951. */
  952. waveLength: number;
  953. /**
  954. * Defines the waves speed.
  955. */
  956. waveSpeed: number;
  957. /**
  958. * Defines the number of times waves are repeated. This is typically used to adjust waves count according to the ground's size where the material is applied on.
  959. */
  960. waveCount: number;
  961. /**
  962. * Sets or gets whether or not automatic clipping should be enabled or not. Setting to true will save performances and
  963. * will avoid calculating useless pixels in the pixel shader of the water material.
  964. */
  965. disableClipPlane: boolean;
  966. protected _renderTargets: BABYLON.SmartArray<BABYLON.RenderTargetTexture>;
  967. private _mesh;
  968. private _refractionRTT;
  969. private _reflectionRTT;
  970. private _reflectionTransform;
  971. private _lastTime;
  972. private _lastDeltaTime;
  973. private _useLogarithmicDepth;
  974. private _waitingRenderList;
  975. private _imageProcessingConfiguration;
  976. private _imageProcessingObserver;
  977. /**
  978. * Gets a boolean indicating that current material needs to register RTT
  979. */
  980. get hasRenderTargetTextures(): boolean;
  981. /**
  982. * Constructor
  983. */
  984. constructor(name: string, scene: BABYLON.Scene, renderTargetSize?: BABYLON.Vector2);
  985. get useLogarithmicDepth(): boolean;
  986. set useLogarithmicDepth(value: boolean);
  987. get refractionTexture(): BABYLON.Nullable<BABYLON.RenderTargetTexture>;
  988. get reflectionTexture(): BABYLON.Nullable<BABYLON.RenderTargetTexture>;
  989. addToRenderList(node: any): void;
  990. enableRenderTargets(enable: boolean): void;
  991. getRenderList(): BABYLON.Nullable<BABYLON.AbstractMesh[]>;
  992. get renderTargetsEnabled(): boolean;
  993. needAlphaBlending(): boolean;
  994. needAlphaTesting(): boolean;
  995. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  996. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  997. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  998. private _createRenderTargets;
  999. getAnimatables(): BABYLON.IAnimatable[];
  1000. getActiveTextures(): BABYLON.BaseTexture[];
  1001. hasTexture(texture: BABYLON.BaseTexture): boolean;
  1002. dispose(forceDisposeEffect?: boolean): void;
  1003. clone(name: string): WaterMaterial;
  1004. serialize(): any;
  1005. getClassName(): string;
  1006. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): WaterMaterial;
  1007. static CreateDefaultMesh(name: string, scene: BABYLON.Scene): BABYLON.Mesh;
  1008. }
  1009. }