| 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 "dxxsconf.h" |
| 29 |
#include "3d.h" |
| 30 |
#include <span> |
| 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 |
#include "d_array.h" |
| 38 |
|
| 39 |
#if DXX_USE_EDITOR |
| 40 |
namespace dcx { |
| 41 |
/* When DXX_USE_EDITOR is enabled, this symbol is needed in editor |
| 42 |
* code. When DXX_USE_EDITOR is disabled, this symbol is only |
| 43 |
* needed in the file where it is defined. Therefore, preprocess |
| 44 |
* out the extern declaration when !DXX_USE_EDITOR. |
| 45 |
*/ |
| 46 |
extern const enumerated_array< |
| 47 |
enumerated_array< |
| 48 |
std::array<segment_relative_vertnum, 2>, |
| 49 |
6, sidenum_t>, |
| 50 |
6, sidenum_t> Two_sides_to_edge; |
| 51 |
} |
| 52 |
#endif |
| 53 |
|
| 54 |
#ifdef DXX_BUILD_DESCENT |
| 55 |
namespace dsx { |
| 56 |
|
| 57 |
struct window_rendered_data |
| 58 |
{ |
| 59 |
window_rendered_data(); |
| 60 |
#if DXX_BUILD_DESCENT == 2 |
| 61 |
const fix64 time; |
| 62 |
#endif |
| 63 |
std::vector<objnum_t> rendered_robots; |
| 64 |
}; |
| 65 |
|
| 66 |
} |
| 67 |
#endif |
| 68 |
|
| 69 |
extern int Render_depth; //how many segments deep to render |
| 70 |
constexpr std::integral_constant<unsigned, 8> Max_perspective_depth{}; // Deepest segment at which perspective extern interpolation will be used. |
| 71 |
constexpr std::integral_constant<unsigned, 20> Max_linear_depth_objects{}; |
| 72 |
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. |
| 73 |
constexpr std::integral_constant<unsigned, 15> Max_debris_objects{}; // How many debris objects to create |
| 74 |
|
| 75 |
#if DXX_USE_OGL |
| 76 |
#define DETRIANGULATION 0 |
| 77 |
#else |
| 78 |
#define DETRIANGULATION 1 |
| 79 |
extern unsigned Max_linear_depth; // Deepest segment at which linear extern interpolation will be used. |
| 80 |
#endif |
| 81 |
|
| 82 |
extern int Clear_window; // 1 = Clear whole background window, 2 = clear view portals into rest of world, 0 = no clear |
| 83 |
|
| 84 |
// cycle the flashing light for when mine destroyed |
| 85 |
#ifdef DXX_BUILD_DESCENT |
| 86 |
namespace dsx { |
| 87 |
void flash_frame(); |
| 88 |
|
| 89 |
} |
| 90 |
#endif |
| 91 |
|
| 92 |
// these functions change different rendering parameters |
| 93 |
// all return the new value of the parameter |
| 94 |
|
| 95 |
// misc toggles |
| 96 |
int toggle_outline_mode(void); |
| 97 |
|
| 98 |
// When any render function needs to know what's looking at it, it |
| 99 |
// should access Render_viewer_object members. |
| 100 |
extern |
| 101 |
#if !DXX_USE_EDITOR && defined(RELEASE) |
| 102 |
const |
| 103 |
#endif |
| 104 |
fix Render_zoom; // the player's zoom factor |
| 105 |
|
| 106 |
#ifdef DXX_BUILD_DESCENT |
| 107 |
namespace dsx { |
| 108 |
#if DXX_BUILD_DESCENT == 1 |
| 109 |
constexpr std::integral_constant<uint8_t, 0> RenderingType{}; |
| 110 |
#elif DXX_BUILD_DESCENT == 2 |
| 111 |
extern uint8_t RenderingType; |
| 112 |
#endif |
| 113 |
} |
| 114 |
#endif |
| 115 |
|
| 116 |
extern fix flash_scale; |
| 117 |
|
| 118 |
#if DXX_USE_EDITOR |
| 119 |
int find_seg_side_face(short x, short y, segnum_t &seg, objnum_t &obj, sidenum_t &side, int &face); |
| 120 |
extern int Render_only_bottom; |
| 121 |
#endif |
| 122 |
|
| 123 |
// |
| 124 |
// Routines for conditionally rotating & projecting points |
| 125 |
// |
| 126 |
|
| 127 |
// This must be called at the start of the frame if rotate_list() will be used |
| 128 |
void render_start_frame(void); |
| 129 |
|
| 130 |
// Given a list of point numbers, rotate any that haven't been rotated |
| 131 |
// this frame |
| 132 |
g3s_codes rotate_list(fvcvertptr &vcvertptr, std::span<const vertnum_t> pointnumlist); |
| 133 |
|
| 134 |
#ifdef DXX_BUILD_DESCENT |
| 135 |
namespace dsx { |
| 136 |
void render_frame(grs_canvas &, fix eye_offset, window_rendered_data &); //draws the world into the current canvas |
| 137 |
void render_mine(grs_canvas &, const vms_vector &, vcsegidx_t start_seg_num, fix eye_offset, window_rendered_data &); |
| 138 |
|
| 139 |
// Render an object. Calls one of several routines based on type |
| 140 |
void render_object(grs_canvas &, const d_level_unique_light_state &LevelUniqueLightState, vmobjptridx_t obj); |
| 141 |
|
| 142 |
// draw an object that is a texture-mapped rod |
| 143 |
void draw_object_tmap_rod(grs_canvas &, const d_level_unique_light_state *const LevelUniqueLightState, vcobjptridx_t obj, bitmap_index bitmap); |
| 144 |
|
| 145 |
void draw_hostage(const d_vclip_array &Vclip, grs_canvas &, const d_level_unique_light_state &, vmobjptridx_t obj); |
| 146 |
void draw_morph_object(grs_canvas &, const d_level_unique_light_state &LevelUniqueLightState, vmobjptridx_t obj); |
| 147 |
} |
| 148 |
#endif |