Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /* |
2 | * Portions of this file are copyright Rebirth contributors and licensed as |
||
3 | * described in COPYING.txt. |
||
4 | * Portions of this file are copyright Parallax Software and licensed |
||
5 | * according to the Parallax license below. |
||
6 | * See COPYING.txt for license details. |
||
7 | |||
8 | THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX |
||
9 | SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO |
||
10 | END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A |
||
11 | ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS |
||
12 | IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS |
||
13 | SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE |
||
14 | FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE |
||
15 | CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS |
||
16 | AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. |
||
17 | COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. |
||
18 | */ |
||
19 | |||
20 | /* |
||
21 | * |
||
22 | * Header for rendering-based functions |
||
23 | * |
||
24 | */ |
||
25 | |||
26 | #pragma once |
||
27 | |||
28 | #include "3d.h" |
||
29 | |||
30 | #ifdef __cplusplus |
||
31 | #include <vector> |
||
32 | #include "objnum.h" |
||
33 | #include "fwd-object.h" |
||
34 | #include "fwd-segment.h" |
||
35 | #include "fwd-vclip.h" |
||
36 | #include "lighting.h" |
||
37 | |||
38 | #ifdef dsx |
||
39 | namespace dsx { |
||
40 | |||
41 | struct window_rendered_data |
||
42 | { |
||
43 | #if defined(DXX_BUILD_DESCENT_II) |
||
44 | fix64 time; |
||
45 | const object *viewer; |
||
46 | int rear_view; |
||
47 | #endif |
||
48 | std::vector<objnum_t> rendered_robots; |
||
49 | }; |
||
50 | |||
51 | } |
||
52 | #endif |
||
53 | |||
54 | extern int Render_depth; //how many segments deep to render |
||
55 | constexpr std::integral_constant<unsigned, 8> Max_perspective_depth{}; // Deepest segment at which perspective extern interpolation will be used. |
||
56 | constexpr std::integral_constant<unsigned, 20> Max_linear_depth_objects{}; |
||
57 | constexpr std::integral_constant<unsigned, 50> Simple_model_threshhold_scale{}; // switch to simpler model when the object has depth greater than this value times its radius. |
||
58 | constexpr std::integral_constant<unsigned, 15> Max_debris_objects{}; // How many debris objects to create |
||
59 | |||
60 | #if DXX_USE_OGL |
||
61 | #define DETRIANGULATION 0 |
||
62 | #else |
||
63 | #define DETRIANGULATION 1 |
||
64 | extern unsigned Max_linear_depth; // Deepest segment at which linear extern interpolation will be used. |
||
65 | #endif |
||
66 | |||
67 | extern int Clear_window; // 1 = Clear whole background window, 2 = clear view portals into rest of world, 0 = no clear |
||
68 | |||
69 | // cycle the flashing light for when mine destroyed |
||
70 | #ifdef dsx |
||
71 | namespace dsx { |
||
72 | void flash_frame(); |
||
73 | |||
74 | } |
||
75 | #endif |
||
76 | int find_seg_side_face(short x,short y,segnum_t &seg,objnum_t &obj,int &side,int &face); |
||
77 | |||
78 | // these functions change different rendering parameters |
||
79 | // all return the new value of the parameter |
||
80 | |||
81 | // misc toggles |
||
82 | int toggle_outline_mode(void); |
||
83 | |||
84 | // When any render function needs to know what's looking at it, it |
||
85 | // should access Render_viewer_object members. |
||
86 | extern |
||
87 | #if !DXX_USE_EDITOR && defined(RELEASE) |
||
88 | const |
||
89 | #endif |
||
90 | fix Render_zoom; // the player's zoom factor |
||
91 | |||
92 | #ifdef dsx |
||
93 | namespace dsx { |
||
94 | #if defined(DXX_BUILD_DESCENT_I) |
||
95 | constexpr std::integral_constant<uint8_t, 0> RenderingType{}; |
||
96 | #elif defined(DXX_BUILD_DESCENT_II) |
||
97 | extern uint8_t RenderingType; |
||
98 | #endif |
||
99 | } |
||
100 | #endif |
||
101 | |||
102 | extern fix flash_scale; |
||
103 | |||
104 | #if DXX_USE_EDITOR |
||
105 | extern int Render_only_bottom; |
||
106 | #endif |
||
107 | |||
108 | // |
||
109 | // Routines for conditionally rotating & projecting points |
||
110 | // |
||
111 | |||
112 | // This must be called at the start of the frame if rotate_list() will be used |
||
113 | void render_start_frame(void); |
||
114 | |||
115 | // Given a list of point numbers, rotate any that haven't been rotated |
||
116 | // this frame |
||
117 | g3s_codes rotate_list(fvcvertptr &vcvertptr, std::size_t nv, const unsigned *pointnumlist); |
||
118 | |||
119 | template <std::size_t N> |
||
120 | static inline g3s_codes rotate_list(fvcvertptr &vcvertptr, const std::array<unsigned, N> &a) |
||
121 | { |
||
122 | return rotate_list(vcvertptr, a.size(), &a[0]); |
||
123 | } |
||
124 | |||
125 | #ifdef dsx |
||
126 | namespace dsx { |
||
127 | void render_frame(grs_canvas &, fix eye_offset, window_rendered_data &); //draws the world into the current canvas |
||
128 | void render_mine(grs_canvas &, const vms_vector &, vcsegidx_t start_seg_num, fix eye_offset, window_rendered_data &); |
||
129 | |||
130 | #if defined(DXX_BUILD_DESCENT_II) |
||
131 | void update_rendered_data(window_rendered_data &window, const object &viewer, int rear_view_flag); |
||
132 | #endif |
||
133 | |||
134 | static inline void render_frame(grs_canvas &canvas, fix eye_offset) |
||
135 | { |
||
136 | window_rendered_data window; |
||
137 | render_frame(canvas, eye_offset, window); |
||
138 | } |
||
139 | |||
140 | // Render an object. Calls one of several routines based on type |
||
141 | void render_object(grs_canvas &, const d_level_unique_light_state &LevelUniqueLightState, vmobjptridx_t obj); |
||
142 | |||
143 | // draw an object that is a texture-mapped rod |
||
144 | void draw_object_tmap_rod(grs_canvas &, const d_level_unique_light_state *const LevelUniqueLightState, vcobjptridx_t obj, bitmap_index bitmap); |
||
145 | |||
146 | void draw_hostage(const d_vclip_array &Vclip, grs_canvas &, const d_level_unique_light_state &, vmobjptridx_t obj); |
||
147 | void draw_morph_object(grs_canvas &, const d_level_unique_light_state &LevelUniqueLightState, vmobjptridx_t obj); |
||
148 | } |
||
149 | #endif |
||
150 | |||
151 | #endif |