Light.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. package me.hammerle.supersnuvi.rendering;
  2. public class Light
  3. {
  4. private float red = 0.0f;
  5. private float green = 0.0f;
  6. private float blue = 0.0f;
  7. private float lastX = 0.0f;
  8. private float lastY = 0.0f;
  9. private float x = 0.0f;
  10. private float y = 0.0f;
  11. private float strength = 0.0f;
  12. private boolean dirty = false;
  13. public void setColor(float r, float g, float b)
  14. {
  15. markDirty();
  16. red = r;
  17. green = g;
  18. blue = b;
  19. }
  20. public void setPosition(float x, float y)
  21. {
  22. markDirty();
  23. this.x = x;
  24. this.y = y;
  25. lastX = x;
  26. lastY = y;
  27. }
  28. public void setPositionSmooth(float x, float y)
  29. {
  30. markDirty();
  31. lastX = this.x;
  32. lastY = this.y;
  33. this.x = x;
  34. this.y = y;
  35. }
  36. public void setStrength(float f)
  37. {
  38. markDirty();
  39. strength = f;
  40. }
  41. public float getRed()
  42. {
  43. return red;
  44. }
  45. public float getGreen()
  46. {
  47. return green;
  48. }
  49. public float getBlue()
  50. {
  51. return blue;
  52. }
  53. public float getX()
  54. {
  55. return x;
  56. }
  57. public float getY()
  58. {
  59. return y;
  60. }
  61. public float getLastX()
  62. {
  63. return lastX;
  64. }
  65. public float getLastY()
  66. {
  67. return lastY;
  68. }
  69. public float getStrength()
  70. {
  71. return strength;
  72. }
  73. public boolean isDirty()
  74. {
  75. return dirty;
  76. }
  77. public void markDirty()
  78. {
  79. dirty = true;
  80. }
  81. public void clearDirtyFlag()
  82. {
  83. dirty = false;
  84. }
  85. public void reset()
  86. {
  87. markDirty();
  88. setColor(0.0f, 0.0f, 0.0f);
  89. setPosition(0.0f, 0.0f);
  90. setStrength(0.0f);
  91. }
  92. }