Debian Codegraph @

engine/core/view/renderitem.h

raw
1 /***************************************************************************
2 * Copyright (C) 2005-2019 by the FIFE team *
3 * http://www.fifengine.net *
4 * This file is part of FIFE. *
5 * *
6 * FIFE is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Lesser General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2.1 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20 ***************************************************************************/
21
22 #ifndef FIFE_VIEW_RENDERITEM_H
23 #define FIFE_VIEW_RENDERITEM_H
24
25 // Standard C++ library includes
26 #include <vector>
27
28 // 3rd party library includes
29
30 // FIFE includes
31 // These includes are split up in two parts, separated by one empty line
32 // First block: files included from the FIFE root src directory
33 // Second block: files included from the same folder
34
35 #include "visual.h"
36
37 namespace FIFE {
38
39 class Instance;
40
41 class OverlayData {
42 public:
43 OverlayData();
44 ~OverlayData();
45
46 // pointer to single color overlay
47 OverlayColors* colorOverlay;
48 // pointer to vector that holds animation overlay images
49 std::vector<ImagePtr>* animationOverlayImages;
50 // pointer to vector that holds color overlays for animation overlay
51 std::vector<OverlayColors*>* animationColorOverlays;
52 };
53
54 class RenderItem {
55 public:
56 RenderItem(Instance* parent);
57 ~RenderItem();
58 Instance* instance;
59
60 /** Returns closest matching static image for given angle
61 * @return id for static image
62 * @see ObjectVisual::getStaticImageIndexByAngle
63 */
64 int32_t getStaticImageIndexByAngle(uint32_t angle, Instance* instance);
65
66 /** Sets AnimationOverlay and if available AnimationOverlayColors.
67 * Note: Ownership of the vectors do change.
68 */
69 void setAnimationOverlay(std::vector<ImagePtr>* ao, std::vector<OverlayColors*>* aco);
70
71 /** Returns pointer to AnimationOverlay vector.
72 * Returns 0 if no OverlayData or AnimationOverlay exists.
73 */
74 std::vector<ImagePtr>* getAnimationOverlay() const;
75
76 /** Returns pointer to AnimationColorOverlay vector.
77 * Returns 0 if no OverlayData or AnimationColorOverlay exists.
78 */
79 std::vector<OverlayColors*>* getAnimationColorOverlay() const;
80
81 /** Sets single ColorOverlay.
82 * Note: Ownership does not change.
83 */
84 void setColorOverlay(OverlayColors* co);
85
86 /** Returns pointer to single ColorOverlay.
87 * Returns 0 if no OverlayData or ColorOverlay exists.
88 */
89 OverlayColors* getColorOverlay() const;
90
91 /** Deletes OverlayData.
92 */
93 void deleteOverlayData();
94
95 /** Resets the important values.
96 */
97 void reset();
98
99 // point where instance was drawn during the previous render
100 DoublePoint3D screenpoint;
101
102 // dimensions of this visual on the virtual screen
103 Rect bbox;
104
105 // dimensions of this visual during the previous render
106 Rect dimensions;
107
108 // z value for sorting or depth buffer rendering
109 float vertexZ;
110
111 // image used during previous render
112 ImagePtr image;
113
114 // current facing angle
115 int32_t facingAngle;
116
117 // current transparency
118 uint8_t transparency;
119
120 // current frame index (e.g. needed for action frame)
121 int32_t currentFrame;
122
123 // pointer to overlay data class
124 OverlayData* m_overlay;
125 private:
126 int32_t m_cachedStaticImgId;
127 int32_t m_cachedStaticImgAngle;
128 };
129
130 typedef std::vector<RenderItem*> RenderList;
131 }
132
133 #endif