Jo Engine  2020.06.22
Jo Sega Saturn Engine
mode7.h
Go to the documentation of this file.
1 /*
2 ** Jo Sega Saturn Engine
3 ** Copyright (c) 2012-2020, Johannes Fetz (johannesfetz@gmail.com)
4 ** All rights reserved.
5 **
6 ** Redistribution and use in source and binary forms, with or without
7 ** modification, are permitted provided that the following conditions are met:
8 ** * Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** * Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** * Neither the name of the Johannes Fetz nor the
14 ** names of its contributors may be used to endorse or promote products
15 ** derived from this software without specific prior written permission.
16 **
17 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 ** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21 ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
35 #ifndef __JO_MODE7_H__
36 # define __JO_MODE7_H__
37 
38 #ifdef JO_COMPILE_WITH_PSEUDO_MODE7_SUPPORT
39 
41 typedef struct
42 {
44  unsigned short output_width;
45  unsigned short output_width_sizeof;
46  unsigned short output_line_width;
47  unsigned short output_height;
48  unsigned short output_width_div2;
51  int *distance;
52  int *line_dy;
55 
57 typedef struct
58 {
59  unsigned short output_top;
60  unsigned short output_left;
61  int space_z;
62  int horizon;
63  int scale_x;
64  int scale_y;
66 } jo_mode7;
67 
74 bool jo_init_mode7_for_screen_output(jo_mode7 * const params, const unsigned short tile_width, const unsigned short tile_height);
75 
80 
88 bool jo_init_mode7_for_image_output(jo_mode7 *params, const unsigned short tile_width, const unsigned short tile_height, jo_img * const output_image);
89 
93 void jo_free_mode7(jo_mode7 * const params);
94 
101 void jo_do_mode7_floor(const jo_img * const tile, const int cam_x, const int cam_y, const jo_mode7 * const params);
102 
103 #endif /* !JO_COMPILE_WITH_PSEUDO_MODE7_SUPPORT */
104 
105 #endif /* !__JO_MODE7_H__ */
106 
107 /*
108 ** END OF FILE
109 */
jo_mode7::scale_x
int scale_x
Definition: mode7.h:63
jo_mode7_computation_cache::output_width
unsigned short output_width
Definition: mode7.h:44
jo_mode7::scale_y
int scale_y
Definition: mode7.h:64
jo_init_mode7_for_screen_output
bool jo_init_mode7_for_screen_output(jo_mode7 *const params, const unsigned short tile_width, const unsigned short tile_height)
Initialize mode 7 effect for direct screen output and pre compute projection.
jo_mode7_computation_cache::distance
int * distance
Definition: mode7.h:51
jo_mode7_computation_cache::output_width_sizeof
unsigned short output_width_sizeof
Definition: mode7.h:45
jo_mode7_computation_cache::tile_mask_x
int tile_mask_x
Definition: mode7.h:49
jo_mode7::__cache
jo_mode7_computation_cache __cache
Definition: mode7.h:65
jo_color
unsigned short jo_color
15 bits color type
Definition: types.h:39
jo_mode7_computation_cache
mode7 internal computation cache struct
Definition: mode7.h:42
jo_mode7_computation_cache::output_y_start
int output_y_start
Definition: mode7.h:53
jo_mode7::space_z
int space_z
Definition: mode7.h:61
jo_free_mode7
void jo_free_mode7(jo_mode7 *const params)
Free mode 7 computation.
jo_mode7_computation_cache::output_width_div2
unsigned short output_width_div2
Definition: mode7.h:48
jo_init_mode7_for_image_output
bool jo_init_mode7_for_image_output(jo_mode7 *params, const unsigned short tile_width, const unsigned short tile_height, jo_img *const output_image)
Initialize mode 7 effect for image output and pre compute projection.
jo_mode7::output_left
unsigned short output_left
Definition: mode7.h:60
jo_mode7_computation_cache::line_dy
int * line_dy
Definition: mode7.h:52
jo_do_mode7_floor
void jo_do_mode7_floor(const jo_img *const tile, const int cam_x, const int cam_y, const jo_mode7 *const params)
Draw projection according to the initialized output.
jo_mode7::horizon
int horizon
Definition: mode7.h:62
jo_mode7_computation_cache::output_height
unsigned short output_height
Definition: mode7.h:47
jo_mode7_computation_cache::tile_mask_y
int tile_mask_y
Definition: mode7.h:50
jo_mode7
mode7 struct
Definition: mode7.h:58
jo_update_screen_output_coord_for_mode7
void jo_update_screen_output_coord_for_mode7(jo_mode7 *const params)
Update mode 7 computation if output_left or output_right params changed.
jo_mode7_computation_cache::output_line_width
unsigned short output_line_width
Definition: mode7.h:46
jo_mode7_computation_cache::output
jo_color * output
Definition: mode7.h:43
jo_mode7::output_top
unsigned short output_top
Definition: mode7.h:59
jo_img
15 bits image struct
Definition: types.h:207