GlowComponent.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // Copyright (c) 2014-2017 THUNDERBEAST GAMES LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include <AtomicGlow/Common/GlowSettings.h>
  24. #include <AtomicGlow/GlowService/GlowServiceEvents.h>
  25. #include "EditorComponent.h"
  26. using namespace Atomic;
  27. using namespace AtomicGlow;
  28. namespace AtomicEditor
  29. {
  30. // These glow events are here pretty much for editor access
  31. // due to Glow not currently having a scripting module
  32. ATOMIC_EVENT(E_ATOMICGLOWBAKECANCEL, AtomicGlowBakeCancel)
  33. {
  34. }
  35. ATOMIC_EVENT(E_ATOMICGLOWBAKERESULT, AtomicGlowBakeResult)
  36. {
  37. ATOMIC_PARAM(P_SUCCESS, Success); // bool
  38. ATOMIC_PARAM(P_RESULT, Result); // String
  39. }
  40. ATOMIC_EVENT(E_ATOMICGLOWLOGEVENT, AtomicGlowLogEvent)
  41. {
  42. ATOMIC_PARAM(P_LEVEL, Level); // bool
  43. ATOMIC_PARAM(P_MESSAGE, Message); // String
  44. }
  45. class GlowComponent : public EditorComponent
  46. {
  47. ATOMIC_OBJECT(GlowComponent, EditorComponent)
  48. public:
  49. /// Construct.
  50. GlowComponent(Context* context);
  51. /// Destruct.
  52. virtual ~GlowComponent();
  53. bool Bake();
  54. /// Register object factory.
  55. static void RegisterObject(Context* context);
  56. protected:
  57. private:
  58. void HandleAtomicGlowBakeCancel(StringHash eventType, VariantMap& eventData);
  59. void HandleAtomicGlowServiceBakeResult(StringHash eventType, VariantMap& eventData);
  60. void HandleAtomicGlowServiceLogEvent(StringHash eventType, VariantMap& eventData);
  61. void SetFromGlowSettings(const GlowSettings& settings);
  62. void CopyToGlowSettings(GlowSettings& settings) const;
  63. // global scalar
  64. float lexelDensity_;
  65. // global illumination
  66. bool giEnabled_;
  67. int giGranularity_;
  68. int giMaxBounces_;
  69. // ambient occlusion
  70. bool aoEnabled_;
  71. float aoDepth_;
  72. unsigned nsamples_;
  73. float aoMin_;
  74. float aoMultiply_;
  75. };
  76. }