/opengles/src/Material.h

http://ftk.googlecode.com/ · C Header · 107 lines · 42 code · 27 blank · 38 comment · 0 complexity · ae4c1730aca14c58e5c6d5e8c77c8fbf MD5 · raw file

  1. #ifndef EGL_MATERIAL_H
  2. #define EGL_MATERIAL_H 1
  3. // ==========================================================================
  4. //
  5. // Material.h Material Class for 3D Rendering Library
  6. //
  7. // --------------------------------------------------------------------------
  8. //
  9. // 09-14-2003 Hans-Martin Will initial version
  10. //
  11. // --------------------------------------------------------------------------
  12. //
  13. // Copyright (c) 2004, Hans-Martin Will. All rights reserved.
  14. //
  15. // Redistribution and use in source and binary forms, with or without
  16. // modification, are permitted provided that the following conditions are
  17. // met:
  18. //
  19. // * Redistributions of source code must retain the above copyright
  20. // notice, this list of conditions and the following disclaimer.
  21. // * Redistributions in binary form must reproduce the above copyright
  22. // notice, this list of conditions and the following disclaimer in the
  23. // documentation and/or other materials provided with the distribution.
  24. //
  25. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  26. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28. // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  29. // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
  30. // OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  31. // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  32. // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  33. // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  34. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  35. // THE POSSIBILITY OF SUCH DAMAGE.
  36. //
  37. // ==========================================================================
  38. #include "OGLES.h"
  39. #include "FractionalColor.h"
  40. namespace EGL {
  41. class Material {
  42. public:
  43. Material();
  44. void SetAmbientColor(const FractionalColor & color);
  45. inline const FractionalColor& GetAmbientColor() const;
  46. void SetDiffuseColor(const FractionalColor & color);
  47. inline const FractionalColor& GetDiffuseColor() const;
  48. void SetSpecularColor(const FractionalColor & color);
  49. inline const FractionalColor& GetSpecularColor() const;
  50. void SetEmissiveColor(const FractionalColor & color);
  51. inline const FractionalColor& GetEmissiveColor() const;
  52. void SetSpecularExponent(EGL_Fixed exponent);
  53. inline EGL_Fixed GetSpecularExponent() const;
  54. private:
  55. FractionalColor m_AmbientColor;
  56. FractionalColor m_DiffuseColor;
  57. FractionalColor m_SpecularColor;
  58. FractionalColor m_EmissiveColor;
  59. EGL_Fixed m_SpecularExponent;
  60. };
  61. // --------------------------------------------------------------------------
  62. // Inline Functions
  63. // --------------------------------------------------------------------------
  64. inline const FractionalColor& Material :: GetAmbientColor() const {
  65. return m_AmbientColor;
  66. }
  67. inline const FractionalColor& Material :: GetDiffuseColor() const {
  68. return m_DiffuseColor;
  69. }
  70. inline const FractionalColor& Material :: GetSpecularColor() const {
  71. return m_SpecularColor;
  72. }
  73. inline const FractionalColor& Material :: GetEmissiveColor() const {
  74. return m_EmissiveColor;
  75. }
  76. inline EGL_Fixed Material :: GetSpecularExponent() const {
  77. return m_SpecularExponent;
  78. }
  79. }
  80. #endif //ndef EGL_MATERIAL_H