OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> | 2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
4 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | 4 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
5 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 17 matching lines...) Expand all Loading... |
28 namespace blink { | 28 namespace blink { |
29 | 29 |
30 class PLATFORM_EXPORT SpotLightSource : public LightSource { | 30 class PLATFORM_EXPORT SpotLightSource : public LightSource { |
31 public: | 31 public: |
32 static PassRefPtr<SpotLightSource> create(const FloatPoint3D& position, | 32 static PassRefPtr<SpotLightSource> create(const FloatPoint3D& position, |
33 const FloatPoint3D& direction, float specularExponent, float limitingCon
eAngle) | 33 const FloatPoint3D& direction, float specularExponent, float limitingCon
eAngle) |
34 { | 34 { |
35 return adoptRef(new SpotLightSource(position, direction, specularExponen
t, limitingConeAngle)); | 35 return adoptRef(new SpotLightSource(position, direction, specularExponen
t, limitingConeAngle)); |
36 } | 36 } |
37 | 37 |
38 virtual PassRefPtr<LightSource> create(const FloatPoint3D& scale, const Floa
tSize& offset) const OVERRIDE | 38 virtual PassRefPtr<LightSource> create(const FloatPoint3D& scale, const Floa
tSize& offset) const override |
39 { | 39 { |
40 FloatPoint3D position(m_position.x() * scale.x() - offset.width(), m_pos
ition.y() * scale.y() - offset.height(), m_position.z() * scale.z()); | 40 FloatPoint3D position(m_position.x() * scale.x() - offset.width(), m_pos
ition.y() * scale.y() - offset.height(), m_position.z() * scale.z()); |
41 FloatPoint3D direction(m_direction.x() * scale.x() - offset.width(), m_d
irection.y() * scale.y() - offset.height(), m_direction.z() * scale.z()); | 41 FloatPoint3D direction(m_direction.x() * scale.x() - offset.width(), m_d
irection.y() * scale.y() - offset.height(), m_direction.z() * scale.z()); |
42 return adoptRef(new SpotLightSource(position, direction, m_specularExpon
ent, m_limitingConeAngle)); | 42 return adoptRef(new SpotLightSource(position, direction, m_specularExpon
ent, m_limitingConeAngle)); |
43 } | 43 } |
44 | 44 |
45 const FloatPoint3D& position() const { return m_position; } | 45 const FloatPoint3D& position() const { return m_position; } |
46 const FloatPoint3D& direction() const { return m_direction; } | 46 const FloatPoint3D& direction() const { return m_direction; } |
47 float specularExponent() const { return m_specularExponent; } | 47 float specularExponent() const { return m_specularExponent; } |
48 float limitingConeAngle() const { return m_limitingConeAngle; } | 48 float limitingConeAngle() const { return m_limitingConeAngle; } |
49 | 49 |
50 virtual bool setPosition(const FloatPoint3D&) OVERRIDE; | 50 virtual bool setPosition(const FloatPoint3D&) override; |
51 virtual bool setPointsAt(const FloatPoint3D&) OVERRIDE; | 51 virtual bool setPointsAt(const FloatPoint3D&) override; |
52 | 52 |
53 virtual bool setSpecularExponent(float) OVERRIDE; | 53 virtual bool setSpecularExponent(float) override; |
54 virtual bool setLimitingConeAngle(float) OVERRIDE; | 54 virtual bool setLimitingConeAngle(float) override; |
55 | 55 |
56 virtual void initPaintingData(PaintingData&) const OVERRIDE; | 56 virtual void initPaintingData(PaintingData&) const override; |
57 virtual void updatePaintingData(PaintingData&, int x, int y, float z) const
OVERRIDE; | 57 virtual void updatePaintingData(PaintingData&, int x, int y, float z) const
override; |
58 | 58 |
59 virtual TextStream& externalRepresentation(TextStream&) const OVERRIDE; | 59 virtual TextStream& externalRepresentation(TextStream&) const override; |
60 | 60 |
61 private: | 61 private: |
62 SpotLightSource(const FloatPoint3D& position, const FloatPoint3D& direction, | 62 SpotLightSource(const FloatPoint3D& position, const FloatPoint3D& direction, |
63 float specularExponent, float limitingConeAngle) | 63 float specularExponent, float limitingConeAngle) |
64 : LightSource(LS_SPOT) | 64 : LightSource(LS_SPOT) |
65 , m_position(position) | 65 , m_position(position) |
66 , m_direction(direction) | 66 , m_direction(direction) |
67 , m_specularExponent(std::min(std::max(specularExponent, 1.0f), 128.0f)) | 67 , m_specularExponent(std::min(std::max(specularExponent, 1.0f), 128.0f)) |
68 , m_limitingConeAngle(limitingConeAngle) | 68 , m_limitingConeAngle(limitingConeAngle) |
69 { | 69 { |
70 } | 70 } |
71 | 71 |
72 FloatPoint3D m_position; | 72 FloatPoint3D m_position; |
73 FloatPoint3D m_direction; | 73 FloatPoint3D m_direction; |
74 | 74 |
75 float m_specularExponent; | 75 float m_specularExponent; |
76 float m_limitingConeAngle; | 76 float m_limitingConeAngle; |
77 }; | 77 }; |
78 | 78 |
79 } // namespace blink | 79 } // namespace blink |
80 | 80 |
81 #endif // SpotLightSource_h | 81 #endif // SpotLightSource_h |
OLD | NEW |