Light.pkg 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. $#include "Graphics/Light.h"
  2. enum LightType
  3. {
  4. LIGHT_DIRECTIONAL = 0,
  5. LIGHT_SPOT,
  6. LIGHT_POINT
  7. };
  8. struct BiasParameters
  9. {
  10. BiasParameters();
  11. BiasParameters(float constantBias, float slopeScaledBias, float normalOffset = 0.0f);
  12. ~BiasParameters();
  13. float constantBias_ @ constantBias;
  14. float slopeScaledBias_ @ slopeScaledBias;
  15. float normalOffset_ @ normalOffset;
  16. };
  17. struct CascadeParameters
  18. {
  19. CascadeParameters();
  20. CascadeParameters(float split1, float split2, float split3, float split4, float fadeStart, float biasAutoAdjust = 1.0f);
  21. ~CascadeParameters();
  22. float fadeStart_ @ fadeStart;
  23. float biasAutoAdjust_ @ biasAutoAdjust;
  24. };
  25. struct FocusParameters
  26. {
  27. FocusParameters();
  28. FocusParameters(bool focus, bool nonUniform, bool autoSize, float quantize, float minView);
  29. ~FocusParameters();
  30. bool focus_ @ focus;
  31. bool nonUniform_ @ nonUniform;
  32. bool autoSize_ @ autoSize;
  33. float quantize_ @ quantize;
  34. float minView_ @ minView;
  35. };
  36. class Light : public Drawable
  37. {
  38. void SetLightType(LightType type);
  39. void SetPerVertex(bool enable);
  40. void SetColor(const Color& color);
  41. void SetSpecularIntensity(float intensity);
  42. void SetBrightness(float brightness);
  43. void SetRange(float range);
  44. void SetFov(float fov);
  45. void SetAspectRatio(float aspectRatio);
  46. void SetFadeDistance(float distance);
  47. void SetShadowFadeDistance(float distance);
  48. void SetShadowBias(const BiasParameters& parameters);
  49. void SetShadowCascade(const CascadeParameters& parameters);
  50. void SetShadowFocus(const FocusParameters& parameters);
  51. void SetShadowIntensity(float intensity);
  52. void SetShadowResolution(float resolution);
  53. void SetShadowNearFarRatio(float nearFarRatio);
  54. void SetRampTexture(Texture* texture);
  55. void SetShapeTexture(Texture* texture);
  56. LightType GetLightType() const;
  57. bool GetPerVertex() const;
  58. const Color& GetColor() const;
  59. float GetSpecularIntensity() const;
  60. float GetBrightness() const;
  61. Color GetEffectiveColor() const;
  62. float GetEffectiveSpecularIntensity() const;
  63. float GetRange() const;
  64. float GetFov() const;
  65. float GetAspectRatio() const;
  66. float GetFadeDistance() const;
  67. float GetShadowFadeDistance() const;
  68. const BiasParameters& GetShadowBias() const;
  69. const CascadeParameters& GetShadowCascade() const;
  70. const FocusParameters& GetShadowFocus() const;
  71. float GetShadowIntensity() const;
  72. float GetShadowResolution() const;
  73. float GetShadowNearFarRatio() const;
  74. Texture* GetRampTexture() const;
  75. Texture* GetShapeTexture() const;
  76. Frustum GetFrustum() const;
  77. int GetNumShadowSplits() const;
  78. bool IsNegative() const;
  79. tolua_property__get_set LightType lightType;
  80. tolua_property__get_set bool perVertex;
  81. tolua_property__get_set Color& color;
  82. tolua_property__get_set float specularIntensity;
  83. tolua_property__get_set float brightness;
  84. tolua_property__get_set float range;
  85. tolua_property__get_set float fov;
  86. tolua_property__get_set float aspectRatio;
  87. tolua_property__get_set float fadeDistance;
  88. tolua_property__get_set float shadowFadeDistance;
  89. tolua_property__get_set BiasParameters& shadowBias;
  90. tolua_property__get_set CascadeParameters& shadowCascade;
  91. tolua_property__get_set FocusParameters& shadowFocus;
  92. tolua_property__get_set float shadowIntensity;
  93. tolua_property__get_set float shadowResolution;
  94. tolua_property__get_set float shadowNearFarRatio;
  95. tolua_property__get_set Texture* rampTexture;
  96. tolua_property__get_set Texture* shapeTexture;
  97. tolua_readonly tolua_property__get_set Frustum frustum;
  98. tolua_readonly tolua_property__get_set int numShadowSplits;
  99. tolua_readonly tolua_property__is_set bool negative;
  100. tolua_readonly tolua_property__get_set Color effectiveColor;
  101. tolua_readonly tolua_property__get_set float effectiveSpecularIntensity;
  102. };