babylon.backgroundMaterial.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. /// <reference path="../../../dist/preview release/babylon.d.ts"/>
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = Object.setPrototypeOf ||
  4. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6. return function (d, b) {
  7. extendStatics(d, b);
  8. function __() { this.constructor = d; }
  9. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10. };
  11. })();
  12. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  13. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  14. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  15. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  16. return c > 3 && r && Object.defineProperty(target, key, r), r;
  17. };
  18. var BABYLON;
  19. (function (BABYLON) {
  20. /**
  21. * Background material defines definition.
  22. */
  23. var BackgroundMaterialDefines = (function (_super) {
  24. __extends(BackgroundMaterialDefines, _super);
  25. /**
  26. * Constructor of the defines.
  27. */
  28. function BackgroundMaterialDefines() {
  29. var _this = _super.call(this) || this;
  30. /**
  31. * True if the opacity texture is in use.
  32. */
  33. _this.OPACITY = false;
  34. /**
  35. * The direct UV channel to use.
  36. */
  37. _this.OPACITYDIRECTUV = 0;
  38. /**
  39. * True if the opacity texture is used in gray scale.
  40. */
  41. _this.OPACITYRGB = false;
  42. /**
  43. * True if the environment texture is in use.
  44. */
  45. _this.ENVIRONMENT = false;
  46. /**
  47. * True if the environment is defined in gamma space.
  48. */
  49. _this.GAMMAENVIRONMENT = false;
  50. /**
  51. * True if the environment texture does not contain background dedicated data.
  52. * The material will fallback to use the luminance of the background.
  53. */
  54. _this.RGBENVIRONMENT = false;
  55. /**
  56. * True if an extra blur needs to be added in the environment.
  57. */
  58. _this.ENVIRONMENTBLUR = false;
  59. /**
  60. * False if the current Webgl implementation does not support the texture lod extension.
  61. */
  62. _this.TEXTURELODSUPPORT = false;
  63. /**
  64. * True if you want the material to fade to the environment color at grazing angle.
  65. */
  66. _this.OPACITYFRESNEL = false;
  67. /**
  68. * True if you want the shadow being generated from the diffuse color of the light.
  69. * It is actually using 1 - diffuse to adpat the color to the color not reflected
  70. * by the target.
  71. */
  72. _this.SHADOWFROMLIGHTCOLOR = false;
  73. // Image Processing Configuration.
  74. _this.IMAGEPROCESSING = false;
  75. _this.VIGNETTE = false;
  76. _this.VIGNETTEBLENDMODEMULTIPLY = false;
  77. _this.VIGNETTEBLENDMODEOPAQUE = false;
  78. _this.TONEMAPPING = false;
  79. _this.CONTRAST = false;
  80. _this.COLORCURVES = false;
  81. _this.COLORGRADING = false;
  82. _this.COLORGRADING3D = false;
  83. _this.SAMPLER3DGREENDEPTH = false;
  84. _this.SAMPLER3DBGRMAP = false;
  85. _this.IMAGEPROCESSINGPOSTPROCESS = false;
  86. _this.EXPOSURE = false;
  87. // Default BJS.
  88. _this.MAINUV1 = false;
  89. _this.MAINUV2 = false;
  90. _this.UV1 = false;
  91. _this.UV2 = false;
  92. _this.CLIPPLANE = false;
  93. _this.POINTSIZE = false;
  94. _this.FOG = false;
  95. _this.NORMAL = false;
  96. _this.NUM_BONE_INFLUENCERS = 0;
  97. _this.BonesPerMesh = 0;
  98. _this.INSTANCES = false;
  99. _this.SHADOWFLOAT = false;
  100. _this.rebuild();
  101. return _this;
  102. }
  103. return BackgroundMaterialDefines;
  104. }(BABYLON.MaterialDefines));
  105. /**
  106. * Background material
  107. */
  108. var BackgroundMaterial = (function (_super) {
  109. __extends(BackgroundMaterial, _super);
  110. /**
  111. * constructor
  112. * @param name The name of the material
  113. * @param scene The scene to add the material to
  114. */
  115. function BackgroundMaterial(name, scene) {
  116. var _this = _super.call(this, name, scene) || this;
  117. _this.primaryColor = BABYLON.Color3.White();
  118. _this.primaryLevel = 1;
  119. _this.secondaryColor = BABYLON.Color3.Gray();
  120. _this.secondaryLevel = 1;
  121. _this.thirdColor = BABYLON.Color3.Black();
  122. _this.thirdLevel = 1;
  123. _this.environmentTexture = null;
  124. _this.opacityTexture = null;
  125. _this.environmentBlur = 0;
  126. _this.lightChannelsInTexture = false;
  127. /**
  128. * Specify the list of lights casting shadow on the material.
  129. * All scene shadow lights will be included if null.
  130. */
  131. _this._shadowLights = null;
  132. _this.shadowLights = null;
  133. _this.shadowBlurScale = 1;
  134. _this.shadowLevel = 0;
  135. _this.opacityFresnel = true;
  136. /**
  137. * Keep track of the image processing observer to allow dispose and replace.
  138. */
  139. _this._imageProcessingObserver = null;
  140. /**
  141. * Number of Simultaneous lights allowed on the material.
  142. */
  143. _this._maxSimultaneousLights = 4;
  144. // Temp values kept as cache in the material.
  145. _this._renderTargets = new BABYLON.SmartArray(16);
  146. // Setup the default processing configuration to the scene.
  147. _this._attachImageProcessingConfiguration(null);
  148. _this.getRenderTargetTextures = function () {
  149. _this._renderTargets.reset();
  150. if (_this._opacityTexture && _this._opacityTexture.isRenderTarget) {
  151. _this._renderTargets.push(_this._opacityTexture);
  152. }
  153. if (_this._environmentTexture && _this._environmentTexture.isRenderTarget) {
  154. _this._renderTargets.push(_this._environmentTexture);
  155. }
  156. return _this._renderTargets;
  157. };
  158. return _this;
  159. }
  160. /**
  161. * Attaches a new image processing configuration to the PBR Material.
  162. * @param configuration (if null the scene configuration will be use)
  163. */
  164. BackgroundMaterial.prototype._attachImageProcessingConfiguration = function (configuration) {
  165. var _this = this;
  166. if (configuration === this._imageProcessingConfiguration) {
  167. return;
  168. }
  169. // Detaches observer.
  170. if (this._imageProcessingConfiguration && this._imageProcessingObserver) {
  171. this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);
  172. }
  173. // Pick the scene configuration if needed.
  174. if (!configuration) {
  175. this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;
  176. }
  177. else {
  178. this._imageProcessingConfiguration = configuration;
  179. }
  180. // Attaches observer.
  181. this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function (conf) {
  182. _this._markAllSubMeshesAsImageProcessingDirty();
  183. });
  184. };
  185. Object.defineProperty(BackgroundMaterial.prototype, "imageProcessingConfiguration", {
  186. /**
  187. * Gets the image processing configuration used either in this material.
  188. */
  189. get: function () {
  190. return this._imageProcessingConfiguration;
  191. },
  192. /**
  193. * Sets the Default image processing configuration used either in the this material.
  194. *
  195. * If sets to null, the scene one is in use.
  196. */
  197. set: function (value) {
  198. this._attachImageProcessingConfiguration(value);
  199. // Ensure the effect will be rebuilt.
  200. this._markAllSubMeshesAsTexturesDirty();
  201. },
  202. enumerable: true,
  203. configurable: true
  204. });
  205. Object.defineProperty(BackgroundMaterial.prototype, "cameraColorCurvesEnabled", {
  206. /**
  207. * Gets wether the color curves effect is enabled.
  208. */
  209. get: function () {
  210. return this.imageProcessingConfiguration.colorCurvesEnabled;
  211. },
  212. /**
  213. * Sets wether the color curves effect is enabled.
  214. */
  215. set: function (value) {
  216. this.imageProcessingConfiguration.colorCurvesEnabled = value;
  217. },
  218. enumerable: true,
  219. configurable: true
  220. });
  221. Object.defineProperty(BackgroundMaterial.prototype, "cameraColorGradingEnabled", {
  222. /**
  223. * Gets wether the color grading effect is enabled.
  224. */
  225. get: function () {
  226. return this.imageProcessingConfiguration.colorGradingEnabled;
  227. },
  228. /**
  229. * Gets wether the color grading effect is enabled.
  230. */
  231. set: function (value) {
  232. this.imageProcessingConfiguration.colorGradingEnabled = value;
  233. },
  234. enumerable: true,
  235. configurable: true
  236. });
  237. Object.defineProperty(BackgroundMaterial.prototype, "cameraToneMappingEnabled", {
  238. /**
  239. * Gets wether tonemapping is enabled or not.
  240. */
  241. get: function () {
  242. return this._imageProcessingConfiguration.toneMappingEnabled;
  243. },
  244. /**
  245. * Sets wether tonemapping is enabled or not
  246. */
  247. set: function (value) {
  248. this._imageProcessingConfiguration.toneMappingEnabled = value;
  249. },
  250. enumerable: true,
  251. configurable: true
  252. });
  253. ;
  254. ;
  255. Object.defineProperty(BackgroundMaterial.prototype, "cameraExposure", {
  256. /**
  257. * The camera exposure used on this material.
  258. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  259. * This corresponds to a photographic exposure.
  260. */
  261. get: function () {
  262. return this._imageProcessingConfiguration.exposure;
  263. },
  264. /**
  265. * The camera exposure used on this material.
  266. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  267. * This corresponds to a photographic exposure.
  268. */
  269. set: function (value) {
  270. this._imageProcessingConfiguration.exposure = value;
  271. },
  272. enumerable: true,
  273. configurable: true
  274. });
  275. ;
  276. ;
  277. Object.defineProperty(BackgroundMaterial.prototype, "cameraContrast", {
  278. /**
  279. * Gets The camera contrast used on this material.
  280. */
  281. get: function () {
  282. return this._imageProcessingConfiguration.contrast;
  283. },
  284. /**
  285. * Sets The camera contrast used on this material.
  286. */
  287. set: function (value) {
  288. this._imageProcessingConfiguration.contrast = value;
  289. },
  290. enumerable: true,
  291. configurable: true
  292. });
  293. Object.defineProperty(BackgroundMaterial.prototype, "cameraColorGradingTexture", {
  294. /**
  295. * Gets the Color Grading 2D Lookup Texture.
  296. */
  297. get: function () {
  298. return this._imageProcessingConfiguration.colorGradingTexture;
  299. },
  300. /**
  301. * Sets the Color Grading 2D Lookup Texture.
  302. */
  303. set: function (value) {
  304. this.imageProcessingConfiguration.colorGradingTexture = value;
  305. },
  306. enumerable: true,
  307. configurable: true
  308. });
  309. Object.defineProperty(BackgroundMaterial.prototype, "cameraColorCurves", {
  310. /**
  311. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  312. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  313. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  314. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  315. */
  316. get: function () {
  317. return this.imageProcessingConfiguration.colorCurves;
  318. },
  319. /**
  320. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  321. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  322. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  323. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  324. */
  325. set: function (value) {
  326. this.imageProcessingConfiguration.colorCurves = value;
  327. },
  328. enumerable: true,
  329. configurable: true
  330. });
  331. /**
  332. * The entire material has been created in order to prevent overdraw.
  333. * @returns false
  334. */
  335. BackgroundMaterial.prototype.needAlphaTesting = function () {
  336. return false;
  337. };
  338. /**
  339. * The entire material has been created in order to prevent overdraw.
  340. * @returns false
  341. */
  342. BackgroundMaterial.prototype.needAlphaBlending = function () {
  343. return false;
  344. };
  345. /**
  346. * Gets the environment texture to use in the material.
  347. * @returns the texture
  348. */
  349. BackgroundMaterial.prototype._getEnvironmentTexture = function () {
  350. if (this._environmentTexture) {
  351. return this._environmentTexture;
  352. }
  353. return this.getScene().environmentTexture;
  354. };
  355. /**
  356. * Checks wether the material is ready to be rendered for a given mesh.
  357. * @param mesh The mesh to render
  358. * @param subMesh The submesh to check against
  359. * @param useInstances Specify wether or not the material is used with instances
  360. */
  361. BackgroundMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {
  362. var _this = this;
  363. if (useInstances === void 0) { useInstances = false; }
  364. if (subMesh.effect && this.isFrozen) {
  365. if (this._wasPreviouslyReady) {
  366. return true;
  367. }
  368. }
  369. if (!subMesh._materialDefines) {
  370. subMesh._materialDefines = new BackgroundMaterialDefines();
  371. }
  372. var scene = this.getScene();
  373. var defines = subMesh._materialDefines;
  374. if (!this.checkReadyOnEveryCall && subMesh.effect) {
  375. if (defines._renderId === scene.getRenderId()) {
  376. return true;
  377. }
  378. }
  379. var engine = scene.getEngine();
  380. // Lights
  381. BABYLON.MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights);
  382. defines._needNormals = true;
  383. // Textures
  384. if (defines._areTexturesDirty) {
  385. defines._needUVs = false;
  386. if (scene.texturesEnabled) {
  387. if (scene.getEngine().getCaps().textureLOD) {
  388. defines.TEXTURELODSUPPORT = true;
  389. }
  390. if (this._opacityTexture && BABYLON.StandardMaterial.OpacityTextureEnabled) {
  391. if (!this._opacityTexture.isReadyOrNotBlocking()) {
  392. return false;
  393. }
  394. BABYLON.MaterialHelper.PrepareDefinesForMergedUV(this._opacityTexture, defines, "OPACITY");
  395. defines.OPACITYRGB = this._opacityTexture.getAlphaFromRGB;
  396. defines.OPACITYFRESNEL = this._opacityFresnel;
  397. }
  398. else {
  399. defines.OPACITY = false;
  400. defines.OPACITYRGB = false;
  401. defines.OPACITYFRESNEL = false;
  402. }
  403. var environmentTexture = this._getEnvironmentTexture();
  404. if (environmentTexture && BABYLON.StandardMaterial.ReflectionTextureEnabled) {
  405. if (!environmentTexture.isReadyOrNotBlocking()) {
  406. return false;
  407. }
  408. BABYLON.MaterialHelper.PrepareDefinesForMergedUV(environmentTexture, defines, "ENVIRONMENT");
  409. defines.GAMMAENVIRONMENT = environmentTexture.gammaSpace;
  410. defines.ENVIRONMENTBLUR = this._environmentBlur > 0;
  411. defines.RGBENVIRONMENT = !this.lightChannelsInTexture;
  412. }
  413. else {
  414. defines.ENVIRONMENT = false;
  415. defines.GAMMAENVIRONMENT = false;
  416. defines.RGBENVIRONMENT = false;
  417. }
  418. }
  419. }
  420. if (defines._areImageProcessingDirty) {
  421. if (!this._imageProcessingConfiguration.isReady()) {
  422. return false;
  423. }
  424. this._imageProcessingConfiguration.prepareDefines(defines);
  425. }
  426. // Misc.
  427. BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, defines);
  428. // Values that need to be evaluated on every frame
  429. BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances, false);
  430. // Attribs
  431. if (BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, false, true, false)) {
  432. if (mesh) {
  433. if (!scene.getEngine().getCaps().standardDerivatives && !mesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
  434. mesh.createNormals(true);
  435. BABYLON.Tools.Warn("BackgroundMaterial: Normals have been created for the mesh: " + mesh.name);
  436. }
  437. }
  438. }
  439. // Get correct effect
  440. if (defines.isDirty) {
  441. defines.markAsProcessed();
  442. scene.resetCachedMaterial();
  443. // Fallbacks
  444. var fallbacks = new BABYLON.EffectFallbacks();
  445. if (defines.FOG) {
  446. fallbacks.addFallback(0, "FOG");
  447. }
  448. if (defines.POINTSIZE) {
  449. fallbacks.addFallback(1, "POINTSIZE");
  450. }
  451. BABYLON.MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this._maxSimultaneousLights);
  452. if (defines.NUM_BONE_INFLUENCERS > 0) {
  453. fallbacks.addCPUSkinningFallback(0, mesh);
  454. }
  455. //Attributes
  456. var attribs = [BABYLON.VertexBuffer.PositionKind];
  457. if (defines.NORMAL) {
  458. attribs.push(BABYLON.VertexBuffer.NormalKind);
  459. }
  460. if (defines.UV1) {
  461. attribs.push(BABYLON.VertexBuffer.UVKind);
  462. }
  463. if (defines.UV2) {
  464. attribs.push(BABYLON.VertexBuffer.UV2Kind);
  465. }
  466. BABYLON.MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
  467. BABYLON.MaterialHelper.PrepareAttributesForInstances(attribs, defines);
  468. var uniforms = ["world", "view", "viewProjection", "vEyePosition", "vLightsType",
  469. "vFogInfos", "vFogColor", "pointSize",
  470. "vClipPlane", "mBones",
  471. "vPrimaryColor", "vSecondaryColor", "vThirdColor",
  472. "vEnvironmentInfo", "environmentMatrix", "vEnvironmentMicrosurfaceInfos",
  473. "shadowLevel",
  474. "vOpacityInfo", "opacityMatrix",
  475. ];
  476. var samplers = ["opacitySampler", "environmentSampler", "environmentSamplerLow", "environmentSamplerHigh"];
  477. var uniformBuffers = ["Material", "Scene"];
  478. BABYLON.ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);
  479. BABYLON.ImageProcessingConfiguration.PrepareSamplers(samplers, defines);
  480. BABYLON.MaterialHelper.PrepareUniformsAndSamplersList({
  481. uniformsNames: uniforms,
  482. uniformBuffersNames: uniformBuffers,
  483. samplers: samplers,
  484. defines: defines,
  485. maxSimultaneousLights: this._maxSimultaneousLights
  486. });
  487. var onCompiled = function (effect) {
  488. if (_this.onCompiled) {
  489. _this.onCompiled(effect);
  490. }
  491. _this.bindSceneUniformBuffer(effect, scene.getSceneUniformBuffer());
  492. };
  493. var join = defines.toString();
  494. subMesh.setEffect(scene.getEngine().createEffect("background", {
  495. attributes: attribs,
  496. uniformsNames: uniforms,
  497. uniformBuffersNames: uniformBuffers,
  498. samplers: samplers,
  499. defines: join,
  500. fallbacks: fallbacks,
  501. onCompiled: onCompiled,
  502. onError: this.onError,
  503. indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights }
  504. }, engine), defines);
  505. this.buildUniformLayout();
  506. }
  507. if (!subMesh.effect || !subMesh.effect.isReady()) {
  508. return false;
  509. }
  510. defines._renderId = scene.getRenderId();
  511. this._wasPreviouslyReady = true;
  512. return true;
  513. };
  514. /**
  515. * Build the uniform buffer used in the material.
  516. */
  517. BackgroundMaterial.prototype.buildUniformLayout = function () {
  518. // Order is important !
  519. this._uniformBuffer.addUniform("vPrimaryColor", 4);
  520. this._uniformBuffer.addUniform("vSecondaryColor", 4);
  521. this._uniformBuffer.addUniform("vThirdColor", 4);
  522. this._uniformBuffer.addUniform("vOpacityInfo", 2);
  523. this._uniformBuffer.addUniform("vEnvironmentInfo", 2);
  524. this._uniformBuffer.addUniform("opacityMatrix", 16);
  525. this._uniformBuffer.addUniform("environmentMatrix", 16);
  526. this._uniformBuffer.addUniform("vEnvironmentMicrosurfaceInfos", 3);
  527. this._uniformBuffer.addUniform("pointSize", 1);
  528. this._uniformBuffer.addUniform("shadowLevel", 1);
  529. this._uniformBuffer.create();
  530. };
  531. /**
  532. * Unbind the material.
  533. */
  534. BackgroundMaterial.prototype.unbind = function () {
  535. if (this._opacityTexture && this._opacityTexture.isRenderTarget) {
  536. this._uniformBuffer.setTexture("opacitySampler", null);
  537. }
  538. if (this._environmentTexture && this._environmentTexture.isRenderTarget) {
  539. this._uniformBuffer.setTexture("environmentSampler", null);
  540. }
  541. _super.prototype.unbind.call(this);
  542. };
  543. /**
  544. * Bind only the world matrix to the material.
  545. * @param world The world matrix to bind.
  546. */
  547. BackgroundMaterial.prototype.bindOnlyWorldMatrix = function (world) {
  548. this._activeEffect.setMatrix("world", world);
  549. };
  550. /**
  551. * Bind the material for a dedicated submeh (every used meshes will be considered opaque).
  552. * @param world The world matrix to bind.
  553. * @param subMesh The submesh to bind for.
  554. */
  555. BackgroundMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {
  556. var scene = this.getScene();
  557. var defines = subMesh._materialDefines;
  558. if (!defines) {
  559. return;
  560. }
  561. var effect = subMesh.effect;
  562. if (!effect) {
  563. return;
  564. }
  565. this._activeEffect = effect;
  566. // Matrices
  567. this.bindOnlyWorldMatrix(world);
  568. // Bones
  569. BABYLON.MaterialHelper.BindBonesParameters(mesh, this._activeEffect);
  570. var mustRebind = this._mustRebind(scene, effect, mesh.visibility);
  571. if (mustRebind) {
  572. this._uniformBuffer.bindToEffect(effect, "Material");
  573. this.bindViewProjection(effect);
  574. var environmentTexture = this._getEnvironmentTexture();
  575. if (!this._uniformBuffer.useUbo || !this.isFrozen || !this._uniformBuffer.isSync) {
  576. // Texture uniforms
  577. if (scene.texturesEnabled) {
  578. if (this._opacityTexture && BABYLON.StandardMaterial.OpacityTextureEnabled) {
  579. this._uniformBuffer.updateFloat2("vOpacityInfo", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);
  580. BABYLON.MaterialHelper.BindTextureMatrix(this._opacityTexture, this._uniformBuffer, "opacity");
  581. }
  582. if (environmentTexture && BABYLON.StandardMaterial.ReflectionTextureEnabled) {
  583. this._uniformBuffer.updateMatrix("environmentMatrix", environmentTexture.getReflectionTextureMatrix());
  584. this._uniformBuffer.updateFloat2("vEnvironmentInfo", environmentTexture.level, this._environmentBlur);
  585. this._uniformBuffer.updateFloat3("vEnvironmentMicrosurfaceInfos", environmentTexture.getSize().width, environmentTexture.lodGenerationScale, environmentTexture.lodGenerationOffset);
  586. }
  587. }
  588. if (this.shadowLevel > 0) {
  589. this._uniformBuffer.updateFloat("shadowLevel", this.shadowLevel);
  590. }
  591. // Point size
  592. if (this.pointsCloud) {
  593. this._uniformBuffer.updateFloat("pointSize", this.pointSize);
  594. }
  595. this._uniformBuffer.updateColor4("vPrimaryColor", this._primaryColor, this._primaryLevel);
  596. this._uniformBuffer.updateColor4("vSecondaryColor", this._secondaryColor, this._secondaryLevel);
  597. this._uniformBuffer.updateColor4("vThirdColor", this._thirdColor, this._thirdLevel);
  598. }
  599. // Textures
  600. if (scene.texturesEnabled) {
  601. if (this._opacityTexture && BABYLON.StandardMaterial.OpacityTextureEnabled) {
  602. this._uniformBuffer.setTexture("opacitySampler", this._opacityTexture);
  603. }
  604. if (environmentTexture && BABYLON.StandardMaterial.ReflectionTextureEnabled) {
  605. if (defines.ENVIRONMENTBLUR && defines.TEXTURELODSUPPORT) {
  606. this._uniformBuffer.setTexture("environmentSampler", environmentTexture);
  607. }
  608. else if (!defines.ENVIRONMENTBLUR) {
  609. this._uniformBuffer.setTexture("environmentSampler", environmentTexture);
  610. }
  611. else {
  612. this._uniformBuffer.setTexture("environmentSampler", environmentTexture._lodTextureMid || environmentTexture);
  613. this._uniformBuffer.setTexture("environmentSamplerLow", environmentTexture._lodTextureLow || environmentTexture);
  614. this._uniformBuffer.setTexture("environmentSamplerHigh", environmentTexture._lodTextureHigh || environmentTexture);
  615. }
  616. }
  617. }
  618. // Clip plane
  619. BABYLON.MaterialHelper.BindClipPlane(this._activeEffect, scene);
  620. var eyePosition = scene._mirroredCameraPosition ? scene._mirroredCameraPosition : scene.activeCamera.globalPosition;
  621. // var invertNormal = (scene.useRightHandedSystem === (scene._mirroredCameraPosition != null));
  622. effect.setFloat3("vEyePosition", eyePosition.x, eyePosition.y, eyePosition.z);
  623. }
  624. if (mustRebind || !this.isFrozen) {
  625. if (scene.lightsEnabled) {
  626. BABYLON.MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights, false);
  627. }
  628. // View
  629. this.bindView(effect);
  630. // Fog
  631. BABYLON.MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);
  632. // image processing
  633. this._imageProcessingConfiguration.bind(this._activeEffect);
  634. }
  635. this._uniformBuffer.update();
  636. this._afterBind(mesh);
  637. };
  638. /**
  639. * Dispose the material.
  640. * @forceDisposeEffect Force disposal of the associated effect.
  641. * @forceDisposeTextures Force disposal of the associated textures.
  642. */
  643. BackgroundMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
  644. if (forceDisposeEffect === void 0) { forceDisposeEffect = false; }
  645. if (forceDisposeTextures === void 0) { forceDisposeTextures = false; }
  646. if (forceDisposeTextures) {
  647. if (this.opacityTexture) {
  648. this.opacityTexture.dispose();
  649. }
  650. if (this.environmentTexture) {
  651. this.environmentTexture.dispose();
  652. }
  653. }
  654. this._renderTargets.dispose();
  655. if (this._imageProcessingConfiguration && this._imageProcessingObserver) {
  656. this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);
  657. }
  658. _super.prototype.dispose.call(this, forceDisposeEffect);
  659. };
  660. /**
  661. * Clones the material.
  662. * @name The cloned name.
  663. * @returns The cloned material.
  664. */
  665. BackgroundMaterial.prototype.clone = function (name) {
  666. var _this = this;
  667. return BABYLON.SerializationHelper.Clone(function () { return new BackgroundMaterial(name, _this.getScene()); }, this);
  668. };
  669. /**
  670. * Serializes the current material to its JSON representation.
  671. * @returns The JSON representation.
  672. */
  673. BackgroundMaterial.prototype.serialize = function () {
  674. var serializationObject = BABYLON.SerializationHelper.Serialize(this);
  675. serializationObject.customType = "BABYLON.BackgroundMaterial";
  676. return serializationObject;
  677. };
  678. /**
  679. * Gets the class name of the material
  680. * @returns "BackgroundMaterial"
  681. */
  682. BackgroundMaterial.prototype.getClassName = function () {
  683. return "BackgroundMaterial";
  684. };
  685. /**
  686. * Parse a JSON input to create back a background material.
  687. * @param source
  688. * @param scene
  689. * @param rootUrl
  690. * @returns the instantiated BackgroundMaterial.
  691. */
  692. BackgroundMaterial.Parse = function (source, scene, rootUrl) {
  693. return BABYLON.SerializationHelper.Parse(function () { return new BackgroundMaterial(source.name, scene); }, source, scene, rootUrl);
  694. };
  695. __decorate([
  696. BABYLON.serializeAsColor3()
  697. ], BackgroundMaterial.prototype, "_primaryColor", void 0);
  698. __decorate([
  699. BABYLON.expandToProperty("_markAllSubMeshesAsLightsDirty")
  700. ], BackgroundMaterial.prototype, "primaryColor", void 0);
  701. __decorate([
  702. BABYLON.serialize()
  703. ], BackgroundMaterial.prototype, "_primaryLevel", void 0);
  704. __decorate([
  705. BABYLON.expandToProperty("_markAllSubMeshesAsLightsDirty")
  706. ], BackgroundMaterial.prototype, "primaryLevel", void 0);
  707. __decorate([
  708. BABYLON.serializeAsColor3()
  709. ], BackgroundMaterial.prototype, "_secondaryColor", void 0);
  710. __decorate([
  711. BABYLON.expandToProperty("_markAllSubMeshesAsLightsDirty")
  712. ], BackgroundMaterial.prototype, "secondaryColor", void 0);
  713. __decorate([
  714. BABYLON.serialize()
  715. ], BackgroundMaterial.prototype, "_secondaryLevel", void 0);
  716. __decorate([
  717. BABYLON.expandToProperty("_markAllSubMeshesAsLightsDirty")
  718. ], BackgroundMaterial.prototype, "secondaryLevel", void 0);
  719. __decorate([
  720. BABYLON.serializeAsColor3()
  721. ], BackgroundMaterial.prototype, "_thirdColor", void 0);
  722. __decorate([
  723. BABYLON.expandToProperty("_markAllSubMeshesAsLightsDirty")
  724. ], BackgroundMaterial.prototype, "thirdColor", void 0);
  725. __decorate([
  726. BABYLON.serialize()
  727. ], BackgroundMaterial.prototype, "_thirdLevel", void 0);
  728. __decorate([
  729. BABYLON.expandToProperty("_markAllSubMeshesAsLightsDirty")
  730. ], BackgroundMaterial.prototype, "thirdLevel", void 0);
  731. __decorate([
  732. BABYLON.serializeAsTexture()
  733. ], BackgroundMaterial.prototype, "_environmentTexture", void 0);
  734. __decorate([
  735. BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
  736. ], BackgroundMaterial.prototype, "environmentTexture", void 0);
  737. __decorate([
  738. BABYLON.serializeAsTexture()
  739. ], BackgroundMaterial.prototype, "_opacityTexture", void 0);
  740. __decorate([
  741. BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
  742. ], BackgroundMaterial.prototype, "opacityTexture", void 0);
  743. __decorate([
  744. BABYLON.serialize()
  745. ], BackgroundMaterial.prototype, "_environmentBlur", void 0);
  746. __decorate([
  747. BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
  748. ], BackgroundMaterial.prototype, "environmentBlur", void 0);
  749. __decorate([
  750. BABYLON.serialize()
  751. ], BackgroundMaterial.prototype, "_lightChannelsInTexture", void 0);
  752. __decorate([
  753. BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
  754. ], BackgroundMaterial.prototype, "lightChannelsInTexture", void 0);
  755. __decorate([
  756. BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
  757. ], BackgroundMaterial.prototype, "shadowLights", void 0);
  758. __decorate([
  759. BABYLON.serialize()
  760. ], BackgroundMaterial.prototype, "_shadowBlurScale", void 0);
  761. __decorate([
  762. BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
  763. ], BackgroundMaterial.prototype, "shadowBlurScale", void 0);
  764. __decorate([
  765. BABYLON.serialize()
  766. ], BackgroundMaterial.prototype, "_shadowLevel", void 0);
  767. __decorate([
  768. BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
  769. ], BackgroundMaterial.prototype, "shadowLevel", void 0);
  770. __decorate([
  771. BABYLON.serialize()
  772. ], BackgroundMaterial.prototype, "_opacityFresnel", void 0);
  773. __decorate([
  774. BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
  775. ], BackgroundMaterial.prototype, "opacityFresnel", void 0);
  776. __decorate([
  777. BABYLON.serializeAsImageProcessingConfiguration()
  778. ], BackgroundMaterial.prototype, "_imageProcessingConfiguration", void 0);
  779. return BackgroundMaterial;
  780. }(BABYLON.PushMaterial));
  781. BABYLON.BackgroundMaterial = BackgroundMaterial;
  782. })(BABYLON || (BABYLON = {}));
  783. //# sourceMappingURL=babylon.backgroundMaterial.js.map
  784. BABYLON.Effect.ShadersStore['backgroundVertexShader'] = "precision highp float;\n#include<__decl__backgroundVertex>\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2; \n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nvarying vec2 vOpacityUV;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normal);\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif \n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0 \nif (vOpacityInfo.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";
  785. BABYLON.Effect.ShadersStore['backgroundPixelShader'] = "#ifdef TEXTURELODSUPPORT\n#extension GL_EXT_shader_texture_lod : enable\n#endif\nprecision highp float;\n#include<__decl__backgroundFragment>\n\nuniform vec3 vEyePosition;\n\nvarying vec3 vPositionW;\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif \n#ifdef MAINUV2 \nvarying vec2 vMainUV2; \n#endif \n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef OPACITY\n#if OPACITYDIRECTUV == 1\n#define vOpacityUV vMainUV1\n#elif OPACITYDIRECTUV == 2\n#define vOpacityUV vMainUV2\n#else\nvarying vec2 vOpacityUV;\n#endif\nuniform sampler2D opacitySampler;\n#endif\n\n#ifdef ENVIRONMENT\n#define sampleEnvironment(s,c) textureCube(s,c)\nuniform samplerCube environmentSampler;\n#ifdef ENVIRONMENTBLUR\n#ifdef TEXTURELODSUPPORT\n#define sampleEnvironmentLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube environmentSamplerLow;\nuniform samplerCube environmentSamplerHigh;\n#endif\n#endif\n#endif\n\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE;\n#endif\n\n#ifndef SHADOWONLY\n#define SHADOWONLY;\n#endif\n#include<imageProcessingDeclaration>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<helperFunctions>\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<imageProcessingFunctions>\n#include<clipPlaneFragmentDeclaration>\n\n#include<fogFragmentDeclaration>\nvoid main(void) {\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(0.0,1.0,0.0);\n#endif\n\nfloat shadow=1.;\n#include<lightFragment>[0..maxSimultaneousLights]\n\n#ifdef ENVIRONMENT\nvec3 environmentColor=vec3(0.,0.,0.);\n\nvec3 environmentCoords=(vPositionW.xyz-vEyePosition.xyz);\n#ifdef INVERTCUBICMAP\nenvironmentCoords.y=1.0-environmentCoords.y;\n#endif\n\nenvironmentCoords=vec3(environmentMatrix*vec4(environmentCoords,0));\n#ifdef ENVIRONMENTBLUR\nfloat environmentLOD=vEnvironmentInfo.y;\n#ifdef TEXTURELODSUPPORT\n\nenvironmentLOD=environmentLOD*log2(vEnvironmentMicrosurfaceInfos.x)*vEnvironmentMicrosurfaceInfos.y+vEnvironmentMicrosurfaceInfos.z;\nenvironmentColor=sampleEnvironmentLod(environmentSampler,environmentCoords,environmentLOD).rgb;\n#else\nfloat lodEnvironmentNormalized=clamp(environmentLOD,0.,1.);\nfloat lodEnvironmentNormalizedDoubled=lodEnvironmentNormalized*2.0;\nvec3 environmentSpecularMid=sampleEnvironment(environmentSampler,environmentCoords).rgb;\nif(lodEnvironmentNormalizedDoubled<1.0){\nenvironmentColor=mix(\nsampleEnvironment(environmentSamplerHigh,environmentCoords).rgb,\nenvironmentSpecularMid,\nlodEnvironmentNormalizedDoubled\n);\n} else {\nenvironmentColor=mix(\nenvironmentSpecularMid,\nsampleEnvironment(environmentSamplerLow,environmentCoords).rgb,\nlodEnvironmentNormalizedDoubled-1.0\n);\n}\n#endif\n#else\nenvironmentColor=sampleEnvironment(environmentSampler,environmentCoords).rgb;\n#endif\n#ifdef GAMMAENVIRONMENT\nenvironmentColor=toLinearSpace(environmentColor.rgb);\n#endif\n\nenvironmentColor*=vEnvironmentInfo.x;\n\n#ifdef OPACITY\nvec3 reflectEnvironmentColor=vec3(0.,0.,0.);\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV);\n#ifdef OPACITYRGB\nfloat environmentMix=getLuminance(opacityMap.rgb);\n#else\nfloat environmentMix=opacityMap.a;\n#endif\nenvironmentMix*=vOpacityInfo.y;\n#ifdef OPACITYFRESNEL\n\nfloat viewAngleToFloor=dot(normalW,normalize(vEyePosition));\n\nconst float startAngle=0.1;\nfloat fadeFactor=clamp(viewAngleToFloor/startAngle,0.0,1.0);\nenvironmentMix*=fadeFactor*fadeFactor;\nshadow=mix(1.,shadow,environmentMix);\n#endif\n\nvec3 viewDir=vPositionW.xyz-vEyePosition.xyz;\nvec3 reflectEnvironmentCoords=reflect(viewDir,normalW);\n#ifdef INVERTCUBICMAP\nreflectEnvironmentCoords.y=1.0-reflectEnvironmentCoords.y;\n#endif\n\nreflectEnvironmentCoords=vec3(environmentMatrix*vec4(reflectEnvironmentCoords,0));\n#ifdef ENVIRONMENTBLUR\n#ifdef TEXTURELODSUPPORT\n\nreflectEnvironmentColor=sampleEnvironmentLod(environmentSampler,reflectEnvironmentCoords,environmentLOD).rgb;\n#else\nvec3 reflectEnvironmentSpecularMid=sampleEnvironment(environmentSampler,reflectEnvironmentCoords).rgb;\nif(lodEnvironmentNormalizedDoubled<1.0){\nreflectEnvironmentColor=mix(\nsampleEnvironment(environmentSamplerHigh,reflectEnvironmentCoords).rgb,\nenvironmentSpecularMid,\nlodEnvironmentNormalizedDoubled\n);\n} else {\nreflectEnvironmentColor=mix(\nenvironmentSpecularMid,\nsampleEnvironment(environmentSamplerLow,reflectEnvironmentCoords).rgb,\nlodEnvironmentNormalizedDoubled-1.0\n);\n}\n#endif\n#else\nreflectEnvironmentColor=sampleEnvironment(environmentSampler,reflectEnvironmentCoords).rgb;\n#endif\n#ifdef GAMMAENVIRONMENT\nreflectEnvironmentColor=toLinearSpace(reflectEnvironmentColor.rgb);\n#endif\n\nreflectEnvironmentColor*=vEnvironmentInfo.x;\n\nenvironmentColor=mix(environmentColor,reflectEnvironmentColor,environmentMix);\n#endif\n#else\nvec3 environmentColor=vec3(1.,1.,1.);\n#endif\n\n#ifdef RGBENVIRONMENT\nenvironmentColor=vec3(1.,1.,1.)*getLuminance(environmentColor);\n#endif\n\nvec3 colorBase=environmentColor.r*vPrimaryColor.rgb*vPrimaryColor.a;\ncolorBase+=environmentColor.g*vSecondaryColor.rgb*vSecondaryColor.a;\ncolorBase+=environmentColor.b*vThirdColor.rgb*vThirdColor.a;\ncolorBase=mix(colorBase*shadowLevel,colorBase,shadow);\nvec4 color=vec4(colorBase,1.0);\n#include<fogFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\n\n\ncolor.rgb=clamp(color.rgb,0.,30.0);\n#else\n\ncolor=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n}";
  786. BABYLON.Effect.IncludesShadersStore['backgroundFragmentDeclaration'] = " uniform vec4 vPrimaryColor;\nuniform vec4 vSecondaryColor;\nuniform vec4 vThirdColor;\nuniform float shadowLevel;\n#ifdef OPACITY\nuniform vec2 vOpacityInfo;\n#endif\n#ifdef ENVIRONMENT\nuniform vec2 vEnvironmentInfo;\nuniform mat4 environmentMatrix;\nuniform vec3 vEnvironmentMicrosurfaceInfos;\n#endif";
  787. BABYLON.Effect.IncludesShadersStore['backgroundUboDeclaration'] = "layout(std140,column_major) uniform;\nuniform Material\n{\nuniform vec4 vPrimaryColor;\nuniform vec4 vSecondaryColor;\nuniform vec4 vThirdColor;\nuniform vec2 vOpacityInfo;\nuniform vec2 vEnvironmentInfo;\nuniform mat4 opacityMatrix;\nuniform mat4 environmentMatrix;\nuniform vec3 vEnvironmentMicrosurfaceInfos;\nuniform float pointSize;\nuniform float shadowLevel;\n};\nuniform Scene {\nmat4 viewProjection;\nmat4 view;\n};";
  788. BABYLON.Effect.IncludesShadersStore['backgroundVertexDeclaration'] = "uniform mat4 view;\nuniform mat4 viewProjection;\nuniform float shadowLevel;\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfo;\n#endif\n#ifdef ENVIRONMENT\nuniform vec2 vEnvironmentInfo;\nuniform mat4 environmentMatrix;\nuniform vec3 vEnvionmentMicrosurfaceInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif";