1 /*
2 * This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>.
3 * It is copyright by its individual contributors, as recorded in the
4 * project's Git history. See COPYING.txt at the top level for license
5 * terms and a link to the Git history.
6 */
7 #pragma once
8 /*
9 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
10 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
11 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
12 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
13 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
14 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
15 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
16 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
17 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
18 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
19 */
20
21 /*
22 *
23 * Local include file for texture mapper library -- NOT to be included by users.
24 *
25 */
26
27 // Local include file for texture map library.
28
29 #include "maths.h"
30 #include "pstypes.h"
31
32 #ifdef __cplusplus
33 #include <cstddef>
34 #include "dxxsconf.h"
35 #include "dsx-ns.h"
36 #include <array>
37
38 namespace dcx {
39
40 #if !DXX_USE_OGL
41 struct g3ds_tmap;
42
43 extern int prevmod(int val,int modulus);
44 extern int succmod(int val,int modulus);
45
46 fix compute_dx_dy(const g3ds_tmap &t, int top_vertex,int bottom_vertex, fix recip_dy);
47 void compute_y_bounds(const g3ds_tmap &t, int &vlt, int &vlb, int &vrt, int &vrb,int &bottom_y_ind);
48
49 extern int fx_y,fx_xleft,fx_xright;
50 extern const color_palette_index *pixptr;
51 // texture mapper scanline renderers
52 // Interface variables to assembler code
53 extern fix fx_u,fx_v,fx_z,fx_du_dx,fx_dv_dx,fx_dz_dx;
54 extern fix fx_dl_dx,fx_l;
55 extern int bytes_per_row;
56 extern unsigned char *write_buffer;
57
58 extern uint8_t tmap_flat_color;
59
60 constexpr std::integral_constant<std::size_t, 641> FIX_RECIP_TABLE_SIZE{}; //increased from 321 to 641, since this res is now quite achievable.. slight fps boost -MM
61 extern const std::array<fix, FIX_RECIP_TABLE_SIZE> fix_recip_table;
fix_recip(unsigned i)62 static inline fix fix_recip(unsigned i)
63 {
64 if (i < fix_recip_table.size())
65 return fix_recip_table[i];
66 else
67 return F1_0 / i;
68 }
69 #endif
70
71 }
72
73 #endif
74
75