addfur.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. window.prepareFur = function() {
  2. var fur = new BABYLON.FurMaterial("fur", scene);
  3. fur.furLength = 1;
  4. fur.furAngle = 0;
  5. fur.furColor = new BABYLON.Color3(0.44,0.21,0.02);
  6. // fur length
  7. registerRangeUI("fur", "Fur length", 0, 15, function(value) {
  8. fur.furLength = value;
  9. }, function() {
  10. return fur.furLength;
  11. });
  12. // fur angle
  13. registerRangeUI("fur", "Fur angle", 0, Math.PI/2, function(value) {
  14. fur.furAngle = value;
  15. }, function() {
  16. return fur.furAngle;
  17. });
  18. // fur color
  19. registerColorPicker("fur", "Fur color", "#703605", function(value) {
  20. fur.furColor.r = value.r/255;
  21. fur.furColor.g = value.g/255;
  22. fur.furColor.b = value.b/255;
  23. }, function() {
  24. return fur.furColor;
  25. });
  26. var DTON = false;
  27. registerButtonUI("fur", "Tgl Diffuse Tex", function() {
  28. DTON = !DTON;
  29. if(DTON) {
  30. fur.diffuseTexture = new BABYLON.Texture("textures/leopard_fur.jpg", scene);
  31. }
  32. else {
  33. fur.diffuseTexture = null;
  34. }
  35. })
  36. var HTON = false;
  37. registerButtonUI("fur", "Tgl Height Tex", function() {
  38. HTON = !HTON;
  39. if(HTON) {
  40. fur.heightTexture = new BABYLON.Texture("textures/speckles.jpg", scene);
  41. }
  42. else {
  43. fur.heightTexture = null;
  44. }
  45. })
  46. return fur;
  47. };