babylon.customMaterial.d.ts 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. declare module BABYLON {
  2. class StandardMaterialDefines_OldVer extends MaterialDefines implements IImageProcessingConfigurationDefines {
  3. DIFFUSE: boolean;
  4. AMBIENT: boolean;
  5. OPACITY: boolean;
  6. OPACITYRGB: boolean;
  7. REFLECTION: boolean;
  8. EMISSIVE: boolean;
  9. SPECULAR: boolean;
  10. BUMP: boolean;
  11. PARALLAX: boolean;
  12. PARALLAXOCCLUSION: boolean;
  13. SPECULAROVERALPHA: boolean;
  14. CLIPPLANE: boolean;
  15. ALPHATEST: boolean;
  16. ALPHAFROMDIFFUSE: boolean;
  17. POINTSIZE: boolean;
  18. FOG: boolean;
  19. SPECULARTERM: boolean;
  20. DIFFUSEFRESNEL: boolean;
  21. OPACITYFRESNEL: boolean;
  22. REFLECTIONFRESNEL: boolean;
  23. REFRACTIONFRESNEL: boolean;
  24. EMISSIVEFRESNEL: boolean;
  25. FRESNEL: boolean;
  26. NORMAL: boolean;
  27. UV1: boolean;
  28. UV2: boolean;
  29. VERTEXCOLOR: boolean;
  30. VERTEXALPHA: boolean;
  31. NUM_BONE_INFLUENCERS: number;
  32. BonesPerMesh: number;
  33. INSTANCES: boolean;
  34. GLOSSINESS: boolean;
  35. ROUGHNESS: boolean;
  36. EMISSIVEASILLUMINATION: boolean;
  37. LINKEMISSIVEWITHDIFFUSE: boolean;
  38. REFLECTIONFRESNELFROMSPECULAR: boolean;
  39. LIGHTMAP: boolean;
  40. USELIGHTMAPASSHADOWMAP: boolean;
  41. REFLECTIONMAP_3D: boolean;
  42. REFLECTIONMAP_SPHERICAL: boolean;
  43. REFLECTIONMAP_PLANAR: boolean;
  44. REFLECTIONMAP_CUBIC: boolean;
  45. REFLECTIONMAP_PROJECTION: boolean;
  46. REFLECTIONMAP_SKYBOX: boolean;
  47. REFLECTIONMAP_EXPLICIT: boolean;
  48. REFLECTIONMAP_EQUIRECTANGULAR: boolean;
  49. REFLECTIONMAP_EQUIRECTANGULAR_FIXED: boolean;
  50. REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED: boolean;
  51. INVERTCUBICMAP: boolean;
  52. LOGARITHMICDEPTH: boolean;
  53. REFRACTION: boolean;
  54. REFRACTIONMAP_3D: boolean;
  55. REFLECTIONOVERALPHA: boolean;
  56. INVERTNORMALMAPX: boolean;
  57. INVERTNORMALMAPY: boolean;
  58. TWOSIDEDLIGHTING: boolean;
  59. SHADOWFLOAT: boolean;
  60. MORPHTARGETS: boolean;
  61. MORPHTARGETS_NORMAL: boolean;
  62. MORPHTARGETS_TANGENT: boolean;
  63. NUM_MORPH_INFLUENCERS: number;
  64. USERIGHTHANDEDSYSTEM: boolean;
  65. IMAGEPROCESSING: boolean;
  66. VIGNETTE: boolean;
  67. VIGNETTEBLENDMODEMULTIPLY: boolean;
  68. VIGNETTEBLENDMODEOPAQUE: boolean;
  69. TONEMAPPING: boolean;
  70. CONTRAST: boolean;
  71. COLORCURVES: boolean;
  72. COLORGRADING: boolean;
  73. SAMPLER3DGREENDEPTH: boolean;
  74. SAMPLER3DBGRMAP: boolean;
  75. IMAGEPROCESSINGPOSTPROCESS: boolean;
  76. EXPOSURE: boolean;
  77. constructor();
  78. setReflectionMode(modeToEnable: string): void;
  79. }
  80. class StandardMaterial_OldVer extends PushMaterial {
  81. private _diffuseTexture;
  82. diffuseTexture: BaseTexture;
  83. private _ambientTexture;
  84. ambientTexture: BaseTexture;
  85. private _opacityTexture;
  86. opacityTexture: BaseTexture;
  87. private _reflectionTexture;
  88. reflectionTexture: BaseTexture;
  89. private _emissiveTexture;
  90. emissiveTexture: BaseTexture;
  91. private _specularTexture;
  92. specularTexture: BaseTexture;
  93. private _bumpTexture;
  94. bumpTexture: BaseTexture;
  95. private _lightmapTexture;
  96. lightmapTexture: BaseTexture;
  97. private _refractionTexture;
  98. refractionTexture: BaseTexture;
  99. ambientColor: Color3;
  100. diffuseColor: Color3;
  101. specularColor: Color3;
  102. emissiveColor: Color3;
  103. specularPower: number;
  104. private _useAlphaFromDiffuseTexture;
  105. useAlphaFromDiffuseTexture: boolean;
  106. private _useEmissiveAsIllumination;
  107. useEmissiveAsIllumination: boolean;
  108. private _linkEmissiveWithDiffuse;
  109. linkEmissiveWithDiffuse: boolean;
  110. private _useSpecularOverAlpha;
  111. useSpecularOverAlpha: boolean;
  112. private _useReflectionOverAlpha;
  113. useReflectionOverAlpha: boolean;
  114. private _disableLighting;
  115. disableLighting: boolean;
  116. private _useParallax;
  117. useParallax: boolean;
  118. private _useParallaxOcclusion;
  119. useParallaxOcclusion: boolean;
  120. parallaxScaleBias: number;
  121. private _roughness;
  122. roughness: number;
  123. indexOfRefraction: number;
  124. invertRefractionY: boolean;
  125. private _useLightmapAsShadowmap;
  126. useLightmapAsShadowmap: boolean;
  127. private _diffuseFresnelParameters;
  128. diffuseFresnelParameters: FresnelParameters;
  129. private _opacityFresnelParameters;
  130. opacityFresnelParameters: FresnelParameters;
  131. private _reflectionFresnelParameters;
  132. reflectionFresnelParameters: FresnelParameters;
  133. private _refractionFresnelParameters;
  134. refractionFresnelParameters: FresnelParameters;
  135. private _emissiveFresnelParameters;
  136. emissiveFresnelParameters: FresnelParameters;
  137. private _useReflectionFresnelFromSpecular;
  138. useReflectionFresnelFromSpecular: boolean;
  139. private _useGlossinessFromSpecularMapAlpha;
  140. useGlossinessFromSpecularMapAlpha: boolean;
  141. private _maxSimultaneousLights;
  142. maxSimultaneousLights: number;
  143. /**
  144. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  145. */
  146. private _invertNormalMapX;
  147. invertNormalMapX: boolean;
  148. /**
  149. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  150. */
  151. private _invertNormalMapY;
  152. invertNormalMapY: boolean;
  153. /**
  154. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  155. */
  156. private _twoSidedLighting;
  157. twoSidedLighting: boolean;
  158. /**
  159. * Default configuration related to image processing available in the standard Material.
  160. */
  161. protected _imageProcessingConfiguration: ImageProcessingConfiguration;
  162. /**
  163. * Gets the image processing configuration used either in this material.
  164. */
  165. /**
  166. * Sets the Default image processing configuration used either in the this material.
  167. *
  168. * If sets to null, the scene one is in use.
  169. */
  170. imageProcessingConfiguration: ImageProcessingConfiguration;
  171. /**
  172. * Keep track of the image processing observer to allow dispose and replace.
  173. */
  174. private _imageProcessingObserver;
  175. /**
  176. * Attaches a new image processing configuration to the Standard Material.
  177. * @param configuration
  178. */
  179. protected _attachImageProcessingConfiguration(configuration: ImageProcessingConfiguration): void;
  180. /**
  181. * Gets wether the color curves effect is enabled.
  182. */
  183. /**
  184. * Sets wether the color curves effect is enabled.
  185. */
  186. cameraColorCurvesEnabled: boolean;
  187. /**
  188. * Gets wether the color grading effect is enabled.
  189. */
  190. /**
  191. * Gets wether the color grading effect is enabled.
  192. */
  193. cameraColorGradingEnabled: boolean;
  194. /**
  195. * Gets wether tonemapping is enabled or not.
  196. */
  197. /**
  198. * Sets wether tonemapping is enabled or not
  199. */
  200. cameraToneMappingEnabled: boolean;
  201. /**
  202. * The camera exposure used on this material.
  203. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  204. * This corresponds to a photographic exposure.
  205. */
  206. /**
  207. * The camera exposure used on this material.
  208. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  209. * This corresponds to a photographic exposure.
  210. */
  211. cameraExposure: number;
  212. /**
  213. * Gets The camera contrast used on this material.
  214. */
  215. /**
  216. * Sets The camera contrast used on this material.
  217. */
  218. cameraContrast: number;
  219. /**
  220. * Gets the Color Grading 2D Lookup Texture.
  221. */
  222. /**
  223. * Sets the Color Grading 2D Lookup Texture.
  224. */
  225. cameraColorGradingTexture: BaseTexture;
  226. customShaderNameResolve: (shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines_OldVer) => string;
  227. protected _renderTargets: SmartArray<RenderTargetTexture>;
  228. protected _worldViewProjectionMatrix: Matrix;
  229. protected _globalAmbientColor: Color3;
  230. protected _useLogarithmicDepth: boolean;
  231. constructor(name: string, scene: Scene);
  232. getClassName(): string;
  233. useLogarithmicDepth: boolean;
  234. needAlphaBlending(): boolean;
  235. needAlphaTesting(): boolean;
  236. protected _shouldUseAlphaFromDiffuseTexture(): boolean;
  237. getAlphaTestTexture(): BaseTexture;
  238. /**
  239. * Child classes can use it to update shaders
  240. */
  241. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  242. buildUniformLayout(): void;
  243. unbind(): void;
  244. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  245. getAnimatables(): IAnimatable[];
  246. getActiveTextures(): BaseTexture[];
  247. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  248. clone(name: string): StandardMaterial_OldVer;
  249. serialize(): any;
  250. static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial_OldVer;
  251. static _DiffuseTextureEnabled: boolean;
  252. static DiffuseTextureEnabled: boolean;
  253. static _AmbientTextureEnabled: boolean;
  254. static AmbientTextureEnabled: boolean;
  255. static _OpacityTextureEnabled: boolean;
  256. static OpacityTextureEnabled: boolean;
  257. static _ReflectionTextureEnabled: boolean;
  258. static ReflectionTextureEnabled: boolean;
  259. static _EmissiveTextureEnabled: boolean;
  260. static EmissiveTextureEnabled: boolean;
  261. static _SpecularTextureEnabled: boolean;
  262. static SpecularTextureEnabled: boolean;
  263. static _BumpTextureEnabled: boolean;
  264. static BumpTextureEnabled: boolean;
  265. static _LightmapTextureEnabled: boolean;
  266. static LightmapTextureEnabled: boolean;
  267. static _RefractionTextureEnabled: boolean;
  268. static RefractionTextureEnabled: boolean;
  269. static _ColorGradingTextureEnabled: boolean;
  270. static ColorGradingTextureEnabled: boolean;
  271. static _FresnelEnabled: boolean;
  272. static FresnelEnabled: boolean;
  273. }
  274. class CustomShaderStructure {
  275. FragmentStore: string;
  276. VertexStore: string;
  277. constructor();
  278. }
  279. class ShaderSpecialParts {
  280. constructor();
  281. Fragment_Begin: string;
  282. Fragment_Definitions: string;
  283. Fragment_MainBegin: string;
  284. Fragment_Custom_Diffuse: string;
  285. Fragment_Custom_Alpha: string;
  286. Fragment_Before_FragColor: string;
  287. Vertex_Begin: string;
  288. Vertex_Definitions: string;
  289. Vertex_MainBegin: string;
  290. Vertex_Before_PositionUpdated: string;
  291. Vertex_Before_NormalUpdated: string;
  292. }
  293. class ShaderForVer3_0 extends CustomShaderStructure {
  294. constructor();
  295. }
  296. class StandardShaderVersions {
  297. static Ver3_0: any;
  298. }
  299. class CustomMaterial extends StandardMaterial_OldVer {
  300. static ShaderIndexer: number;
  301. CustomParts: ShaderSpecialParts;
  302. ShaderVersion: CustomShaderStructure;
  303. _isCreatedShader: boolean;
  304. _createdShaderName: string;
  305. _customUniform: string[];
  306. _newUniforms: string[];
  307. _newUniformInstances: any[];
  308. _newSamplerInstances: Texture[];
  309. AttachAfterBind(mesh: Mesh, effect: Effect): void;
  310. ReviewUniform(name: string, arr: string[]): string[];
  311. Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines_OldVer): string;
  312. SelectVersion(ver: string): void;
  313. constructor(name: string, scene: Scene);
  314. AddUniform(name: string, kind: string, param: any): CustomMaterial;
  315. Fragment_Begin(shaderPart: string): CustomMaterial;
  316. Fragment_Definitions(shaderPart: string): CustomMaterial;
  317. Fragment_MainBegin(shaderPart: string): CustomMaterial;
  318. Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
  319. Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
  320. Fragment_Before_FragColor(shaderPart: string): CustomMaterial;
  321. Vertex_Begin(shaderPart: string): CustomMaterial;
  322. Vertex_Definitions(shaderPart: string): CustomMaterial;
  323. Vertex_MainBegin(shaderPart: string): CustomMaterial;
  324. Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial;
  325. Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial;
  326. }
  327. }