babylon.customMaterial.d.ts 13 KB

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