Light.pkg 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 SetTemperature(float temperature);
  42. void SetRadius(float redius);
  43. void SetLength(float length);
  44. void SetUsePhysicalValues(bool enable);
  45. void SetSpecularIntensity(float intensity);
  46. void SetBrightness(float brightness);
  47. void SetRange(float range);
  48. void SetFov(float fov);
  49. void SetAspectRatio(float aspectRatio);
  50. void SetFadeDistance(float distance);
  51. void SetShadowFadeDistance(float distance);
  52. void SetShadowBias(const BiasParameters& parameters);
  53. void SetShadowCascade(const CascadeParameters& parameters);
  54. void SetShadowFocus(const FocusParameters& parameters);
  55. void SetShadowIntensity(float intensity);
  56. void SetShadowResolution(float resolution);
  57. void SetShadowNearFarRatio(float nearFarRatio);
  58. void SetShadowMaxExtrusion(float extrusion);
  59. void SetRampTexture(Texture* texture);
  60. void SetShapeTexture(Texture* texture);
  61. LightType GetLightType() const;
  62. bool GetPerVertex() const;
  63. const Color& GetColor() const;
  64. float GetTemperature() const;
  65. float GetRadius() const;
  66. float GetLength() const;
  67. float GetSpecularIntensity() const;
  68. float GetBrightness() const;
  69. Color GetEffectiveColor() const;
  70. Color GetColorFromTemperature() const;
  71. bool GetUsePhysicalValues() const;
  72. float GetEffectiveSpecularIntensity() const;
  73. float GetRange() const;
  74. float GetFov() const;
  75. float GetAspectRatio() const;
  76. float GetFadeDistance() const;
  77. float GetShadowFadeDistance() const;
  78. const BiasParameters& GetShadowBias() const;
  79. const CascadeParameters& GetShadowCascade() const;
  80. const FocusParameters& GetShadowFocus() const;
  81. float GetShadowIntensity() const;
  82. float GetShadowResolution() const;
  83. float GetShadowNearFarRatio() const;
  84. float GetShadowMaxExtrusion() const;
  85. Texture* GetRampTexture() const;
  86. Texture* GetShapeTexture() const;
  87. Frustum GetFrustum() const;
  88. int GetNumShadowSplits() const;
  89. bool IsNegative() const;
  90. tolua_property__get_set LightType lightType;
  91. tolua_property__get_set bool perVertex;
  92. tolua_property__get_set Color& color;
  93. tolua_property__get_set float temperature;
  94. tolua_property__get_set float radius;
  95. tolua_property__get_set float length;
  96. tolua_property__get_set bool usePhysicalValues;
  97. tolua_property__get_set float specularIntensity;
  98. tolua_property__get_set float brightness;
  99. tolua_property__get_set float range;
  100. tolua_property__get_set float fov;
  101. tolua_property__get_set float aspectRatio;
  102. tolua_property__get_set float fadeDistance;
  103. tolua_property__get_set float shadowFadeDistance;
  104. tolua_property__get_set BiasParameters& shadowBias;
  105. tolua_property__get_set CascadeParameters& shadowCascade;
  106. tolua_property__get_set FocusParameters& shadowFocus;
  107. tolua_property__get_set float shadowIntensity;
  108. tolua_property__get_set float shadowResolution;
  109. tolua_property__get_set float shadowNearFarRatio;
  110. tolua_property__get_set float shadowMaxExtrusion;
  111. tolua_property__get_set Texture* rampTexture;
  112. tolua_property__get_set Texture* shapeTexture;
  113. tolua_readonly tolua_property__get_set Frustum frustum;
  114. tolua_readonly tolua_property__get_set int numShadowSplits;
  115. tolua_readonly tolua_property__is_set bool negative;
  116. tolua_readonly tolua_property__get_set Color effectiveColor;
  117. tolua_readonly tolua_property__get_set float effectiveSpecularIntensity;
  118. };