22 #ifndef QDENGINE_QDCORE_QD_CAMERA_H 23 #define QDENGINE_QDCORE_QD_CAMERA_H 25 #include "qdengine/qdcore/qd_d3dutils.h" 26 #include "qdengine/qdcore/qd_camera_mode.h" 41 CELL_IMPASSABLE = 0x02,
45 CELL_PERSONAGE_OCCUPIED = 0x08,
47 CELL_PERSONAGE_PATH = 0x10
51 _attributes = CELL_IMPASSABLE;
58 bool is_walkable()
const {
59 return check_attribute(CELL_IMPASSABLE);
61 void make_impassable() {
62 set_attribute(CELL_IMPASSABLE);
64 void make_walkable() {
65 drop_attribute(CELL_IMPASSABLE);
69 set_attribute(CELL_SELECTED);
72 drop_attribute(CELL_SELECTED);
74 void toggle_select() {
75 toggle_attribute(CELL_SELECTED);
77 bool is_selected()
const {
78 return check_attribute(CELL_SELECTED);
81 int16 height()
const {
84 void set_height(int16 h) { }
86 void set_attribute(uint32 attr) {
89 void toggle_attribute(uint32 attr) {
92 void drop_attribute(uint32 attr) {
95 bool check_attribute(uint32 attr)
const {
96 if (_attributes & attr)
return true;
100 uint32 attributes()
const {
103 void set_attributes(uint32 attr) {
116 enum qdCameraRedrawMode {
130 bool set_grid_cell_attributes(
const Vect2s &cell_pos,
int attr);
133 bool set_grid_attributes(
const Vect2s ¢er_pos,
const Vect2s &size,
int attr);
135 bool drop_grid_attributes(
const Vect2s ¢er_pos,
const Vect2s &size,
int attr);
137 bool check_grid_attributes(
const Vect2s ¢er_pos,
const Vect2s &size,
int attr)
const;
139 int cells_num_with_exact_attributes(
const Vect2s ¢er_pos,
const Vect2s &size,
int attr)
const;
142 bool set_grid_line_attributes(
const Vect2s &start_pos,
const Vect2s &end_pos,
const Vect2s &size,
int attr);
144 bool drop_grid_line_attributes(
const Vect2s &start_pos,
const Vect2s &end_pos,
const Vect2s &size,
int attr);
146 bool check_grid_line_attributes(
const Vect2s &start_pos,
const Vect2s &end_pos,
const Vect2s &size,
int attr)
const;
148 bool is_walkable(
const Vect2s ¢er_pos,
const Vect2s &size,
bool ignore_personages =
false)
const;
151 bool set_grid_attributes(
int attr);
153 bool drop_grid_attributes(
int attr);
160 bool restore_grid_cell(
const Vect2s cell_pos);
162 void cycle_coords(
int &x,
int &y)
const;
164 void set_redraw_mode(
int md)
const {
167 int get_redraw_mode()
const {
171 void set_grid_size(
int xs,
int ys);
173 void scale_grid(
int sx,
int sy,
int csx,
int csy);
174 void resize_grid(
int sx,
int sy);
176 int get_grid_sx()
const {
179 int get_grid_sy()
const {
187 int get_cell_sx()
const {
190 int get_cell_sy()
const {
194 void set_cell_size(
int csx,
int csy) {
202 void rotate_and_scale(
float XA,
float YA,
float ZA,
float kX,
float kY,
float kZ);
204 float get_focus()
const {
207 void set_focus(
float focus) {
211 void set_R(
const float r);
212 float get_R()
const {
216 float get_x_angle()
const {
219 float get_y_angle()
const {
222 float get_z_angle()
const {
226 inline void set_scr_size(
int xs,
int ys) {
231 const Vect2i &get_scr_size()
const {
236 int get_scr_sx()
const {
240 int get_scr_sy()
const {
244 void set_scr_center(
int xc,
int yc) {
249 const Vect2i &get_scr_center()
const {
253 int get_scr_center_x()
const {
256 int get_scr_center_y()
const {
260 const Vect2i screen_center_limit_x()
const;
261 const Vect2i screen_center_limit_y()
const;
263 const Vect2i &get_scr_offset()
const {
266 void set_scr_offset(
const Vect2i &offs) {
270 const Vect2i &get_scr_center_initial()
const {
271 return _scrCenterInitial;
273 void set_scr_center_initial(
const Vect2i &v) {
274 _scrCenterInitial = v;
277 void move_scr_center(
int dxc,
int dyc);
279 float scrolling_phase_x()
const;
280 float scrolling_phase_y()
const;
285 const Vect3f scr2plane_camera_coord(
const Vect2s &scrPoint)
const;
286 const Vect3f rscr2plane_camera_coord(
const Vect2s &scrPoint)
const;
290 const Vect3f rscr2camera_coord(
const Vect2s &rScrPoint,
float z)
const;
291 const Vect2s camera_coord2rscr(
const Vect3f &coord)
const;
296 const Vect2s camera_coord2scr(
const Vect3f &coord)
const;
298 const Vect3f scr2global(
const Vect2s &vScrPoint,
float zInCameraCoord)
const;
299 const Vect3f rscr2global(
const Vect2s rScrPoint,
const float zInCameraCoord)
const;
300 const Vect3f global2camera_coord(
const Vect3f &glCoord)
const;
301 const Vect3f camera_coord2global(
const Vect3f &v)
const;
316 float get_scale(
const Vect3f &glCoord)
const;
318 const Vect3f &get_grid_center()
const {
321 void set_grid_center(
const Vect3f &v) {
325 const sGridCell *get_cell(
float X,
float Y)
const;
326 const Vect2s get_cell_index(
float X,
float Y,
bool grid_crop =
true)
const;
327 const Vect2s get_cell_index(
const Vect3f &v,
bool grid_crop =
true)
const;
328 const Vect3f get_cell_coords(
int x_idx,
int y_idx)
const;
331 void reset_all_select();
333 bool select_cell(
int x,
int y);
336 bool deselect_cell(
int x,
int y);
338 void load_script(
const xml::tag *p);
349 bool draw_grid()
const;
350 bool draw_cell(
int x,
int y,
int z,
int penWidth, uint32 color)
const;
358 bool can_change_mode()
const;
366 bool quant(
float dt);
372 bool is_visible(
const Vect2i ¢er_offs =
Vect2i(0, 0))
const;
374 void set_cycle(
bool cx,
bool cy) {
379 void dump_grid(
const char *file_name)
const;
385 void set_scale_pow(
float sp) {
388 float scale_z_offset()
const {
389 return _scale_z_offset;
391 void set_scale_z_offset(
float szo) {
392 _scale_z_offset = szo;
395 bool need_perspective_correction()
const {
396 return (fabs(_scale_pow - 1) > 0.001 || fabs(_scale_z_offset) > 0.001);
401 return _default_mode;
405 _default_mode = mode;
409 return _current_camera;
411 static void set_current_camera(
qdCamera *p) {
415 MATRIX3D const &get_view_matrix()
const {
423 float _xAngle, _yAngle, _zAngle;
431 int _cellSX, _cellSY;
449 mutable int _redraw_mode;
455 float _current_mode_work_time;
456 bool _current_mode_switch;
468 float _scale_z_offset;
472 static const float _NEAR_PLANE;
473 static const float _FAR_PLANE;
482 inline int clip_out_code(
const Vect2s &v)
const {
496 void clip_center_coords(
int &x,
int &y)
const;
500 return Vect3f(v.x, v.y, 0);
505 #endif // QDENGINE_QDCORE_QD_CAMERA_H cell_attribute_t
Атрибуты
Definition: qd_camera.h:37
void set_default_mode(const qdCameraMode &mode)
Установка режима работы камеры по умолчанию.
Definition: qd_camera.h:404
void set_default_object(qdGameObjectAnimated *p)
Установка объекта, за которым камера следит по умолчанию.
Definition: qd_camera.h:361
Definition: qd_camera.h:34
Dynamic object.
Definition: qd_game_object_animated.h:37
const qdCameraMode & default_mode() const
Возвращает режим работы камеры по умолчанию.
Definition: qd_camera.h:400
XML тег.
Definition: xml_tag.h:33
Базовый класс для игровых ресурсов.
Definition: console.h:28
Режим работы камеры.
Definition: qd_camera_mode.h:40
Definition: algorithm.h:29
Definition: qd_d3dutils.h:30
Definition: qd_camera.h:122
float scale_pow() const
Параметры функции масштабирования
Definition: qd_camera.h:382