addlava.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. window.prepareLava = function() {
  2. var lava = new BABYLON.LavaMaterial("lava", scene);
  3. lava.diffuseTexture = new BABYLON.Texture("/Playground/textures/lava/lavatile.jpg", scene);
  4. lava.diffuseTexture.uScale = 0.5;
  5. lava.diffuseTexture.vScale = 0.5;
  6. lava.noiseTexture = new BABYLON.Texture("/Playground/textures/lava/cloud.png", scene);
  7. lava.fogColor = BABYLON.Color3.Black();
  8. lava.speed = 2.5;
  9. // Fog color
  10. registerColorPicker("lava", "fogColor", "#ff0000", function(value) {
  11. lava.fogColor = BABYLON.Color3.FromHexString(value);
  12. }, function() {
  13. return lava.fogColor.toHexString();
  14. });
  15. // fog density
  16. registerRangeUI("lava", "fogDensity", 0, 1, function(value) {
  17. lava.fogDensity = value;
  18. }, function() {
  19. return lava.fogDensity;
  20. });
  21. // Speed
  22. registerRangeUI("lava", "speed", 0, 10, function(value) {
  23. lava.speed = value;
  24. }, function() {
  25. return lava.speed;
  26. });
  27. // low frequency speed
  28. registerRangeUI("lava", "lowFrequencySpeed", 0, 10, function(value) {
  29. lava.lowFrequencySpeed = value;
  30. }, function() {
  31. return lava.lowFrequencySpeed;
  32. });
  33. // moving speed
  34. registerRangeUI("lava", "movingSpeed", 0, 100, function(value) {
  35. lava.movingSpeed = value;
  36. }, function() {
  37. return lava.movingSpeed;
  38. });
  39. return lava;
  40. };