ScummVM API documentation
zbuffer.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 BLADERUNNER_ZBUFFER_H
23 #define BLADERUNNER_ZBUFFER_H
24 
25 #include "bladerunner/bladerunner.h"
26 
27 #include "common/rect.h"
28 
29 namespace BladeRunner {
30 
31 #define MAX_DIRTY_RECTS 20
32 
34  int _count;
35  Common::Rect _rects[MAX_DIRTY_RECTS];
36 
37 public:
39  _count(0)
40  {}
41 
42  void reset();
43  bool add(Common::Rect rect);
44  void extendExisting();
45  int getCount() const;
46  bool popRect(Common::Rect *rect);
47 };
48 
49 class ZBuffer {
50  int _width;
51  int _height;
52 
53  uint16 *_zbuf1;
54  uint16 *_zbuf2;
55 
56  ZBufferDirtyRects *_dirtyRects;
57 
58  bool _disabled;
59 
60 public:
61  ZBuffer();
62  ~ZBuffer();
63 
64  void init(int width, int height);
65  bool decodeData(const uint8 *data, int size);
66 
67  uint16 *getData() const;
68  uint16 getZValue(int x, int y) const;
69 
70 #if !BLADERUNNER_ORIGINAL_BUGS
71  void setDataZbufExplicit(int x, int y, uint16 overidingVal);
72 #endif // BLADERUNNER_ORIGINAL_BUGS
73 
74 private:
75  void blit(Common::Rect rect);
76 
77 public:
78  void mark(Common::Rect rect);
79  void clean();
80  void resetUpdates();
81 
82  // Only called from Scene::resume which is not yet implemented
83  void disable();
84  void enable();
85 };
86 
87 } // End of namespace BladeRunner
88 
89 #endif
Definition: actor.h:31
Definition: zbuffer.h:49
Definition: rect.h:144
Definition: zbuffer.h:33