ScummVM API documentation
renderentry.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef STARK_GFX_RENDER_ENTRY_H
23 #define STARK_GFX_RENDER_ENTRY_H
24 
25 #include "common/array.h"
26 #include "common/rect.h"
27 #include "common/str.h"
28 
29 #include "math/ray.h"
30 #include "math/vector3d.h"
31 
32 namespace Stark {
33 
34 class Visual;
35 class VisualImageXMG;
36 class VisualText;
37 
38 namespace Resources {
39 class ItemVisual;
40 }
41 
42 namespace Gfx {
43 
44 struct LightEntry {
45  enum Type {
46  kAmbient = 0,
47  kPoint = 1,
48  kDirectional = 2,
49  kSpot = 4
50  };
51 
52  Type type;
53  Math::Vector3d color;
54  Math::Vector3d position;
55  Math::Vector3d direction;
56  Math::Angle innerConeAngle;
57  Math::Angle outerConeAngle;
58  float falloffNear;
59  float falloffFar;
60  Math::Vector4d worldPosition;
61  Math::Vector4d eyePosition;
62  Math::Vector3d eyeDirection;
63 };
64 
66 
67 class RenderEntry {
68 public:
70  virtual ~RenderEntry() {}
71 
72  void render(const LightEntryArray &lights = LightEntryArray());
73 
74  void setVisual(Visual *visual);
75  void setPosition(const Common::Point &position);
76  void setPosition3D(const Math::Vector3d &position, float direction);
77  void setSortKey(float sortKey);
78  void setClickable(bool clickable);
79 
81  Common::Point getPosition() const { return _position; }
82 
84  Resources::ItemVisual *getOwner() const { return _owner; }
85 
87  const Common::String &getName() const { return _name; }
88 
90  VisualImageXMG *getImage() const;
91 
93  VisualText *getText() const;
94 
103  bool containsPoint(const Common::Point &position, Common::Point &relativePosition, const Common::Rect &cursorRect) const;
104 
106  bool intersectRay(const Math::Ray &ray) const;
107 
109  static bool compare(const RenderEntry *x, const RenderEntry *y);
110 
115  Common::Rect getBoundingRect() const;
116 
117 protected:
118  Common::String _name;
119  Resources::ItemVisual *_owner;
120 
121  Visual *_visual;
122  Common::Point _position;
123  Math::Vector3d _position3D;
124  float _direction3D;
125  float _sortKey;
126  bool _clickable;
127 };
128 
130 
131 } // End of namespace Gfx
132 } // End of namespace Stark
133 
134 #endif // STARK_GFX_RENDER_ENTRY_H
Definition: str.h:59
Definition: visual.h:29
Definition: array.h:52
Definition: rect.h:144
const Common::String & getName() const
Definition: renderentry.h:87
Definition: item.h:139
Definition: renderentry.h:44
Definition: text.h:44
Definition: console.h:27
Definition: rect.h:45
Common::Point getPosition() const
Definition: renderentry.h:81
Definition: image.h:45
Definition: renderentry.h:67
Resources::ItemVisual * getOwner() const
Definition: renderentry.h:84