2006-03-20 17:12:09 +00:00
/*
2014-06-01 17:55:23 +00:00
* Portions of this file are copyright Rebirth contributors and licensed as
* described in COPYING . txt .
* Portions of this file are copyright Parallax Software and licensed
* according to the Parallax license below .
* See COPYING . txt for license details .
2006-03-20 17:12:09 +00:00
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ( " PARALLAX " ) . PARALLAX , IN DISTRIBUTING THE CODE TO
END - USERS , AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN , GRANTS A
ROYALTY - FREE , PERPETUAL LICENSE TO SUCH END - USERS FOR USE BY SUCH END - USERS
IN USING , DISPLAYING , AND CREATING DERIVATIVE WORKS THEREOF , SO LONG AS
SUCH USE , DISPLAY OR CREATION IS FOR NON - COMMERCIAL , ROYALTY OR REVENUE
FREE PURPOSES . IN NO EVENT SHALL THE END - USER USE THE COMPUTER CODE
CONTAINED HEREIN FOR REVENUE - BEARING PURPOSES . THE END - USER UNDERSTANDS
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE .
COPYRIGHT 1993 - 1999 PARALLAX SOFTWARE CORPORATION . ALL RIGHTS RESERVED .
*/
/*
*
* Header for rendering - based functions
*
*/
2014-12-13 17:47:01 +00:00
# pragma once
2006-03-20 17:12:09 +00:00
# include "3d.h"
2012-11-11 22:12:51 +00:00
# ifdef __cplusplus
2015-01-11 18:10:40 +00:00
# include <vector>
2014-12-13 17:47:01 +00:00
# include "objnum.h"
2015-10-10 03:44:14 +00:00
# include "fwd-object.h"
2016-12-24 18:12:17 +00:00
# include "fwd-segment.h"
2019-04-13 18:00:07 +00:00
# include "fwd-vclip.h"
# include "lighting.h"
2013-12-29 04:28:07 +00:00
2016-01-09 16:38:15 +00:00
# ifdef dsx
2015-12-13 18:00:49 +00:00
namespace dsx {
2015-12-05 22:57:25 +00:00
2014-12-18 04:12:38 +00:00
struct window_rendered_data
{
# if defined(DXX_BUILD_DESCENT_II)
fix64 time ;
2018-09-25 03:44:09 +00:00
const object * viewer ;
2014-12-18 04:12:38 +00:00
int rear_view ;
# endif
std : : vector < objnum_t > rendered_robots ;
} ;
2015-12-05 22:57:25 +00:00
}
2015-11-26 02:56:55 +00:00
# endif
2014-12-13 04:11:04 +00:00
2008-04-06 20:23:28 +00:00
extern int Render_depth ; //how many segments deep to render
2017-10-14 17:10:30 +00:00
constexpr std : : integral_constant < unsigned , 8 > Max_perspective_depth { } ; // Deepest segment at which perspective extern interpolation will be used.
constexpr std : : integral_constant < unsigned , 20 > Max_linear_depth_objects { } ;
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.
constexpr std : : integral_constant < unsigned , 15 > Max_debris_objects { } ; // How many debris objects to create
2008-04-06 20:23:28 +00:00
2016-09-24 18:06:11 +00:00
# if DXX_USE_OGL
2008-04-06 20:23:28 +00:00
# define DETRIANGULATION 0
# else
# define DETRIANGULATION 1
2015-04-22 02:44:29 +00:00
extern unsigned Max_linear_depth ; // Deepest segment at which linear extern interpolation will be used.
2008-04-06 20:23:28 +00:00
# endif
2006-03-20 17:12:09 +00:00
extern int Clear_window ; // 1 = Clear whole background window, 2 = clear view portals into rest of world, 0 = no clear
// cycle the flashing light for when mine destroyed
2016-08-25 04:05:32 +00:00
# ifdef dsx
namespace dsx {
2006-03-20 17:12:09 +00:00
void flash_frame ( ) ;
2016-08-25 04:05:32 +00:00
}
# endif
2017-11-01 02:01:20 +00:00
int find_seg_side_face ( short x , short y , segnum_t & seg , objnum_t & obj , int & side , int & face ) ;
2006-03-20 17:12:09 +00:00
// these functions change different rendering parameters
// all return the new value of the parameter
// misc toggles
int toggle_outline_mode ( void ) ;
// When any render function needs to know what's looking at it, it
// should access Render_viewer_object members.
2017-01-15 00:03:12 +00:00
extern
# if !DXX_USE_EDITOR && defined(RELEASE)
const
# endif
fix Render_zoom ; // the player's zoom factor
2006-03-20 17:12:09 +00:00
2016-01-09 16:38:15 +00:00
# ifdef dsx
2015-12-22 04:18:50 +00:00
namespace dsx {
2012-11-11 00:14:30 +00:00
# if defined(DXX_BUILD_DESCENT_I)
2017-10-14 17:10:30 +00:00
constexpr std : : integral_constant < uint8_t , 0 > RenderingType { } ;
2012-11-11 00:14:30 +00:00
# elif defined(DXX_BUILD_DESCENT_II)
2017-01-15 00:03:12 +00:00
extern uint8_t RenderingType ;
2012-11-11 00:14:30 +00:00
# endif
2015-12-22 04:18:50 +00:00
}
# endif
2012-11-11 00:14:30 +00:00
extern fix flash_scale ;
2006-03-20 17:12:09 +00:00
2016-09-11 18:49:16 +00:00
# if DXX_USE_EDITOR
2006-03-20 17:12:09 +00:00
extern int Render_only_bottom ;
# endif
//
// Routines for conditionally rotating & projecting points
//
// This must be called at the start of the frame if rotate_list() will be used
void render_start_frame ( void ) ;
// Given a list of point numbers, rotate any that haven't been rotated
// this frame
2018-12-30 00:43:57 +00:00
g3s_codes rotate_list ( fvcvertptr & vcvertptr , std : : size_t nv , const unsigned * pointnumlist ) ;
2006-03-20 17:12:09 +00:00
2017-02-19 19:33:37 +00:00
template < std : : size_t N >
2020-05-02 21:18:42 +00:00
static inline g3s_codes rotate_list ( fvcvertptr & vcvertptr , const std : : array < unsigned , N > & a )
2014-08-16 18:14:00 +00:00
{
2018-12-30 00:43:57 +00:00
return rotate_list ( vcvertptr , a . size ( ) , & a [ 0 ] ) ;
2014-08-16 18:14:00 +00:00
}
2006-03-20 17:12:09 +00:00
2016-01-09 16:38:15 +00:00
# ifdef dsx
2015-12-22 04:18:50 +00:00
namespace dsx {
2017-03-10 01:22:27 +00:00
void render_frame ( grs_canvas & , fix eye_offset , window_rendered_data & ) ; //draws the world into the current canvas
2018-12-30 00:43:57 +00:00
void render_mine ( grs_canvas & , const vms_vector & , vcsegidx_t start_seg_num , fix eye_offset , window_rendered_data & ) ;
2006-03-20 17:12:09 +00:00
2013-03-03 01:03:33 +00:00
# if defined(DXX_BUILD_DESCENT_II)
2018-09-25 03:44:09 +00:00
void update_rendered_data ( window_rendered_data & window , const object & viewer , int rear_view_flag ) ;
2013-03-03 01:03:33 +00:00
# endif
2006-03-20 17:12:09 +00:00
2017-03-10 01:22:27 +00:00
static inline void render_frame ( grs_canvas & canvas , fix eye_offset )
2014-12-18 04:12:38 +00:00
{
window_rendered_data window ;
2017-03-10 01:22:27 +00:00
render_frame ( canvas , eye_offset , window ) ;
2014-12-18 04:12:38 +00:00
}
2019-04-13 18:00:07 +00:00
// Render an object. Calls one of several routines based on type
void render_object ( grs_canvas & , const d_level_unique_light_state & LevelUniqueLightState , vmobjptridx_t obj ) ;
// draw an object that is a texture-mapped rod
void draw_object_tmap_rod ( grs_canvas & , const d_level_unique_light_state * const LevelUniqueLightState , vcobjptridx_t obj , bitmap_index bitmap ) ;
void draw_hostage ( const d_vclip_array & Vclip , grs_canvas & , const d_level_unique_light_state & , vmobjptridx_t obj ) ;
void draw_morph_object ( grs_canvas & , const d_level_unique_light_state & LevelUniqueLightState , vmobjptridx_t obj ) ;
2015-12-22 04:18:50 +00:00
}
2015-09-19 23:04:35 +00:00
# endif
2014-12-18 04:12:38 +00:00
2012-11-11 22:12:51 +00:00
# endif