mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 23:12:24 +00:00
Split r_main into r_viewport, r_scene and r_light
This commit is contained in:
parent
1b750c1cfd
commit
80e1844d6c
63 changed files with 893 additions and 945 deletions
|
@ -838,7 +838,6 @@ set( NOT_COMPILED_SOURCE_FILES
|
||||||
|
|
||||||
set( FASTMATH_PCH_SOURCES
|
set( FASTMATH_PCH_SOURCES
|
||||||
swrenderer/r_swrenderer.cpp
|
swrenderer/r_swrenderer.cpp
|
||||||
swrenderer/r_main.cpp
|
|
||||||
swrenderer/r_memory.cpp
|
swrenderer/r_memory.cpp
|
||||||
swrenderer/drawers/r_draw.cpp
|
swrenderer/drawers/r_draw.cpp
|
||||||
swrenderer/drawers/r_draw_pal.cpp
|
swrenderer/drawers/r_draw_pal.cpp
|
||||||
|
@ -846,9 +845,12 @@ set( FASTMATH_PCH_SOURCES
|
||||||
swrenderer/drawers/r_drawers.cpp
|
swrenderer/drawers/r_drawers.cpp
|
||||||
swrenderer/drawers/r_thread.cpp
|
swrenderer/drawers/r_thread.cpp
|
||||||
swrenderer/scene/r_3dfloors.cpp
|
swrenderer/scene/r_3dfloors.cpp
|
||||||
|
swrenderer/scene/r_light.cpp
|
||||||
swrenderer/scene/r_opaque_pass.cpp
|
swrenderer/scene/r_opaque_pass.cpp
|
||||||
swrenderer/scene/r_portal.cpp
|
swrenderer/scene/r_portal.cpp
|
||||||
|
swrenderer/scene/r_scene.cpp
|
||||||
swrenderer/scene/r_translucent_pass.cpp
|
swrenderer/scene/r_translucent_pass.cpp
|
||||||
|
swrenderer/scene/r_viewport.cpp
|
||||||
swrenderer/line/r_line.cpp
|
swrenderer/line/r_line.cpp
|
||||||
swrenderer/line/r_walldraw.cpp
|
swrenderer/line/r_walldraw.cpp
|
||||||
swrenderer/line/r_wallsetup.cpp
|
swrenderer/line/r_wallsetup.cpp
|
||||||
|
|
|
@ -57,7 +57,6 @@
|
||||||
#include "v_pfx.h"
|
#include "v_pfx.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "r_data/r_translate.h"
|
#include "r_data/r_translate.h"
|
||||||
#include "f_wipe.h"
|
#include "f_wipe.h"
|
||||||
#include "sbar.h"
|
#include "sbar.h"
|
||||||
|
@ -72,6 +71,8 @@
|
||||||
#include "gl/gl_functions.h"
|
#include "gl/gl_functions.h"
|
||||||
#include "gl_debug.h"
|
#include "gl_debug.h"
|
||||||
|
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
CVAR(Int, gl_showpacks, 0, 0)
|
CVAR(Int, gl_showpacks, 0, 0)
|
||||||
#ifndef WIN32 // Defined in fb_d3d9 for Windows
|
#ifndef WIN32 // Defined in fb_d3d9 for Windows
|
||||||
CVAR(Bool, vid_hwaalines, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
CVAR(Bool, vid_hwaalines, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
#include "v_pfx.h"
|
#include "v_pfx.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "r_data/r_translate.h"
|
#include "r_data/r_translate.h"
|
||||||
#include "f_wipe.h"
|
#include "f_wipe.h"
|
||||||
#include "sbar.h"
|
#include "sbar.h"
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include "v_palette.h"
|
#include "v_palette.h"
|
||||||
#include "r_data/colormaps.h"
|
#include "r_data/colormaps.h"
|
||||||
#include "poly_draw_args.h"
|
#include "poly_draw_args.h"
|
||||||
#include "swrenderer/r_main.h"
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
|
||||||
void PolyDrawArgs::SetClipPlane(float a, float b, float c, float d)
|
void PolyDrawArgs::SetClipPlane(float a, float b, float c, float d)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "r_data/colormaps.h"
|
#include "r_data/colormaps.h"
|
||||||
#include "poly_triangle.h"
|
#include "poly_triangle.h"
|
||||||
#include "swrenderer/drawers/r_draw_rgba.h"
|
#include "swrenderer/drawers/r_draw_rgba.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "screen_triangle.h"
|
#include "screen_triangle.h"
|
||||||
|
|
||||||
CVAR(Bool, r_debug_trisetup, false, 0);
|
CVAR(Bool, r_debug_trisetup, false, 0);
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "r_data/colormaps.h"
|
#include "r_data/colormaps.h"
|
||||||
#include "poly_triangle.h"
|
#include "poly_triangle.h"
|
||||||
#include "swrenderer/drawers/r_draw_rgba.h"
|
#include "swrenderer/drawers/r_draw_rgba.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "screen_triangle.h"
|
#include "screen_triangle.h"
|
||||||
|
|
||||||
void ScreenTriangle::SetupNormal(const TriDrawTriangleArgs *args, WorkerThreadData *thread)
|
void ScreenTriangle::SetupNormal(const TriDrawTriangleArgs *args, WorkerThreadData *thread)
|
||||||
|
|
|
@ -33,10 +33,11 @@
|
||||||
#include "r_data/r_translate.h"
|
#include "r_data/r_translate.h"
|
||||||
#include "v_palette.h"
|
#include "v_palette.h"
|
||||||
#include "r_data/colormaps.h"
|
#include "r_data/colormaps.h"
|
||||||
|
#include "r_utility.h"
|
||||||
#include "tri_matrix.h"
|
#include "tri_matrix.h"
|
||||||
#include "polyrenderer/drawers/poly_triangle.h"
|
#include "polyrenderer/drawers/poly_triangle.h"
|
||||||
#include "swrenderer/drawers/r_draw_rgba.h"
|
#include "swrenderer/drawers/r_draw_rgba.h"
|
||||||
#include "swrenderer/r_main.h"
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
|
||||||
TriMatrix TriMatrix::null()
|
TriMatrix TriMatrix::null()
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include "gl/data/gl_data.h"
|
#include "gl/data/gl_data.h"
|
||||||
#include "d_net.h"
|
#include "d_net.h"
|
||||||
#include "po_man.h"
|
#include "po_man.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Int, screenblocks)
|
EXTERN_CVAR(Int, screenblocks)
|
||||||
void InitGLRMapinfoData();
|
void InitGLRMapinfoData();
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "doomdata.h"
|
#include "doomdata.h"
|
||||||
#include "r_utility.h"
|
#include "r_utility.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "scene/poly_portal.h"
|
#include "scene/poly_portal.h"
|
||||||
#include "scene/poly_playersprite.h"
|
#include "scene/poly_playersprite.h"
|
||||||
#include "scene/poly_sky.h"
|
#include "scene/poly_sky.h"
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#include "poly_decal.h"
|
#include "poly_decal.h"
|
||||||
#include "polyrenderer/poly_renderer.h"
|
#include "polyrenderer/poly_renderer.h"
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
void RenderPolyDecal::RenderWallDecals(const TriMatrix &worldToClip, const Vec4f &clipPlane, const seg_t *line, uint32_t subsectorDepth, uint32_t stencilValue)
|
void RenderPolyDecal::RenderWallDecals(const TriMatrix &worldToClip, const Vec4f &clipPlane, const seg_t *line, uint32_t subsectorDepth, uint32_t stencilValue)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "r_data/r_translate.h"
|
#include "r_data/r_translate.h"
|
||||||
#include "poly_particle.h"
|
#include "poly_particle.h"
|
||||||
#include "polyrenderer/poly_renderer.h"
|
#include "polyrenderer/poly_renderer.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
void RenderPolyParticle::Render(const TriMatrix &worldToClip, const Vec4f &clipPlane, particle_t *particle, subsector_t *sub, uint32_t subsectorDepth, uint32_t stencilValue)
|
void RenderPolyParticle::Render(const TriMatrix &worldToClip, const Vec4f &clipPlane, particle_t *particle, subsector_t *sub, uint32_t subsectorDepth, uint32_t stencilValue)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "poly_portal.h"
|
#include "poly_portal.h"
|
||||||
#include "polyrenderer/poly_renderer.h"
|
#include "polyrenderer/poly_renderer.h"
|
||||||
#include "r_sky.h"
|
#include "r_sky.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Int, r_3dfloors)
|
EXTERN_CVAR(Int, r_3dfloors)
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
#include "r_data/r_translate.h"
|
#include "r_data/r_translate.h"
|
||||||
#include "poly_playersprite.h"
|
#include "poly_playersprite.h"
|
||||||
#include "polyrenderer/poly_renderer.h"
|
#include "polyrenderer/poly_renderer.h"
|
||||||
|
#include "d_player.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_drawplayersprites)
|
EXTERN_CVAR(Bool, r_drawplayersprites)
|
||||||
EXTERN_CVAR(Bool, r_deathcamera)
|
EXTERN_CVAR(Bool, r_deathcamera)
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "r_data/r_translate.h"
|
#include "r_data/r_translate.h"
|
||||||
#include "poly_portal.h"
|
#include "poly_portal.h"
|
||||||
#include "polyrenderer/poly_renderer.h"
|
#include "polyrenderer/poly_renderer.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "gl/data/gl_data.h"
|
#include "gl/data/gl_data.h"
|
||||||
|
|
||||||
extern bool r_showviewer;
|
extern bool r_showviewer;
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "doomdata.h"
|
#include "doomdata.h"
|
||||||
#include "r_utility.h"
|
#include "r_utility.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "polyrenderer/drawers/poly_triangle.h"
|
#include "polyrenderer/drawers/poly_triangle.h"
|
||||||
#include "polyrenderer/math/poly_intersection.h"
|
#include "polyrenderer/math/poly_intersection.h"
|
||||||
#include "poly_wall.h"
|
#include "poly_wall.h"
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "poly_portal.h"
|
#include "poly_portal.h"
|
||||||
#include "r_sky.h" // for skyflatnum
|
#include "r_sky.h" // for skyflatnum
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
PolySkyDome::PolySkyDome()
|
PolySkyDome::PolySkyDome()
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "poly_sprite.h"
|
#include "poly_sprite.h"
|
||||||
#include "polyrenderer/poly_renderer.h"
|
#include "polyrenderer/poly_renderer.h"
|
||||||
#include "polyrenderer/math/poly_intersection.h"
|
#include "polyrenderer/math/poly_intersection.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Float, transsouls)
|
EXTERN_CVAR(Float, transsouls)
|
||||||
EXTERN_CVAR(Int, r_drawfuzz)
|
EXTERN_CVAR(Int, r_drawfuzz)
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "poly_decal.h"
|
#include "poly_decal.h"
|
||||||
#include "polyrenderer/poly_renderer.h"
|
#include "polyrenderer/poly_renderer.h"
|
||||||
#include "r_sky.h"
|
#include "r_sky.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_drawmirrors)
|
EXTERN_CVAR(Bool, r_drawmirrors)
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,6 @@ extern int numgamesubsectors;
|
||||||
extern AActor* camera; // [RH] camera instead of viewplayer
|
extern AActor* camera; // [RH] camera instead of viewplayer
|
||||||
extern sector_t* viewsector; // [RH] keep track of sector viewing from
|
extern sector_t* viewsector; // [RH] keep track of sector viewing from
|
||||||
|
|
||||||
namespace swrenderer { extern angle_t xtoviewangle[MAXWIDTH+1]; }
|
|
||||||
extern DAngle FieldOfView;
|
extern DAngle FieldOfView;
|
||||||
|
|
||||||
int R_FindSkin (const char *name, int pclass); // [RH] Find a skin
|
int R_FindSkin (const char *name, int pclass); // [RH] Find a skin
|
||||||
|
|
|
@ -21,6 +21,11 @@ extern DAngle ViewPitch;
|
||||||
extern DAngle ViewRoll;
|
extern DAngle ViewRoll;
|
||||||
extern DVector3 ViewPath[2];
|
extern DVector3 ViewPath[2];
|
||||||
|
|
||||||
|
extern double ViewCos;
|
||||||
|
extern double ViewSin;
|
||||||
|
extern int viewwindowx;
|
||||||
|
extern int viewwindowy;
|
||||||
|
|
||||||
extern "C" int centerx, centerxwide;
|
extern "C" int centerx, centerxwide;
|
||||||
extern "C" int centery;
|
extern "C" int centery;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
#include "r_draw_rgba.h"
|
#include "r_draw_rgba.h"
|
||||||
#include "r_draw_pal.h"
|
#include "r_draw_pal.h"
|
||||||
#include "r_thread.h"
|
#include "r_thread.h"
|
||||||
#include "swrenderer/r_main.h"
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
CVAR(Bool, r_dynlights, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
CVAR(Bool, r_dynlights, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,10 @@
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "r_defs.h"
|
#include "r_defs.h"
|
||||||
#include "r_draw.h"
|
#include "r_draw.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "r_draw_pal.h"
|
#include "r_draw_pal.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
// [SP] r_blendmethod - false = rgb555 matching (ZDoom classic), true = rgb666 (refactored)
|
// [SP] r_blendmethod - false = rgb555 matching (ZDoom classic), true = rgb666 (refactored)
|
||||||
CVAR(Bool, r_blendmethod, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
CVAR(Bool, r_blendmethod, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "st_stuff.h"
|
#include "st_stuff.h"
|
||||||
|
@ -39,6 +38,8 @@
|
||||||
#include "r_draw_rgba.h"
|
#include "r_draw_rgba.h"
|
||||||
#include "r_drawers.h"
|
#include "r_drawers.h"
|
||||||
#include "gl/data/gl_matrix.h"
|
#include "gl/data/gl_matrix.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
#include "gi.h"
|
#include "gi.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "st_stuff.h"
|
#include "st_stuff.h"
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "r_sky.h"
|
#include "r_sky.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
@ -38,6 +37,7 @@
|
||||||
#include "swrenderer/segments/r_drawsegment.h"
|
#include "swrenderer/segments/r_drawsegment.h"
|
||||||
#include "swrenderer/line/r_fogboundary.h"
|
#include "swrenderer/line/r_fogboundary.h"
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable:4244)
|
#pragma warning(disable:4244)
|
||||||
|
|
|
@ -30,12 +30,15 @@
|
||||||
#include "g_level.h"
|
#include "g_level.h"
|
||||||
#include "r_wallsetup.h"
|
#include "r_wallsetup.h"
|
||||||
#include "v_palette.h"
|
#include "v_palette.h"
|
||||||
|
#include "r_utility.h"
|
||||||
#include "r_data/colormaps.h"
|
#include "r_data/colormaps.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
#include "swrenderer/scene/r_opaque_pass.h"
|
#include "swrenderer/scene/r_opaque_pass.h"
|
||||||
#include "swrenderer/scene/r_3dfloors.h"
|
#include "swrenderer/scene/r_3dfloors.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
#include "swrenderer/line/r_line.h"
|
#include "swrenderer/line/r_line.h"
|
||||||
#include "swrenderer/line/r_walldraw.h"
|
#include "swrenderer/line/r_walldraw.h"
|
||||||
#include "swrenderer/line/r_wallsetup.h"
|
#include "swrenderer/line/r_wallsetup.h"
|
||||||
|
|
|
@ -13,6 +13,14 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "vectors.h"
|
||||||
|
|
||||||
|
struct seg_t;
|
||||||
|
struct subsector_t;
|
||||||
|
struct sector_t;
|
||||||
|
struct side_t;
|
||||||
|
struct line_t;
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
struct visplane_t;
|
struct visplane_t;
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "doomdata.h"
|
#include "doomdata.h"
|
||||||
|
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "r_sky.h"
|
#include "r_sky.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
|
||||||
|
@ -45,6 +44,9 @@
|
||||||
#include "swrenderer/scene/r_opaque_pass.h"
|
#include "swrenderer/scene/r_opaque_pass.h"
|
||||||
#include "swrenderer/scene/r_3dfloors.h"
|
#include "swrenderer/scene/r_3dfloors.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "swrenderer/line/r_walldraw.h"
|
#include "swrenderer/line/r_walldraw.h"
|
||||||
#include "swrenderer/line/r_wallsetup.h"
|
#include "swrenderer/line/r_wallsetup.h"
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
class FTexture;
|
class FTexture;
|
||||||
struct FLightNode;
|
struct FLightNode;
|
||||||
|
struct seg_t;
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,9 +19,11 @@
|
||||||
#include "v_palette.h"
|
#include "v_palette.h"
|
||||||
#include "r_data/colormaps.h"
|
#include "r_data/colormaps.h"
|
||||||
#include "r_walldraw.h"
|
#include "r_walldraw.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
#include "swrenderer/line/r_line.h"
|
#include "swrenderer/line/r_line.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "r_sky.h"
|
#include "r_sky.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
@ -37,6 +36,9 @@
|
||||||
#include "swrenderer/segments/r_clipsegment.h"
|
#include "swrenderer/segments/r_clipsegment.h"
|
||||||
#include "swrenderer/segments/r_drawsegment.h"
|
#include "swrenderer/segments/r_drawsegment.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "swrenderer/plane/r_visibleplane.h"
|
#include "swrenderer/plane/r_visibleplane.h"
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "r_sky.h"
|
#include "r_sky.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
@ -39,6 +38,9 @@
|
||||||
#include "swrenderer/line/r_wallsetup.h"
|
#include "swrenderer/line/r_wallsetup.h"
|
||||||
#include "swrenderer/line/r_walldraw.h"
|
#include "swrenderer/line/r_walldraw.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "r_sky.h"
|
#include "r_sky.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
@ -37,6 +36,9 @@
|
||||||
#include "swrenderer/segments/r_clipsegment.h"
|
#include "swrenderer/segments/r_clipsegment.h"
|
||||||
#include "swrenderer/segments/r_drawsegment.h"
|
#include "swrenderer/segments/r_drawsegment.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
#include "swrenderer/plane/r_visibleplane.h"
|
#include "swrenderer/plane/r_visibleplane.h"
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,11 @@
|
||||||
#include "d_net.h"
|
#include "d_net.h"
|
||||||
#include "g_level.h"
|
#include "g_level.h"
|
||||||
#include "gl/dynlights/gl_dynlight.h"
|
#include "gl/dynlights/gl_dynlight.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
#include "swrenderer/scene/r_opaque_pass.h"
|
#include "swrenderer/scene/r_opaque_pass.h"
|
||||||
#include "swrenderer/scene/r_3dfloors.h"
|
#include "swrenderer/scene/r_3dfloors.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "swrenderer/plane/r_flatplane.h"
|
#include "swrenderer/plane/r_flatplane.h"
|
||||||
#include "swrenderer/plane/r_slopeplane.h"
|
#include "swrenderer/plane/r_slopeplane.h"
|
||||||
#include "swrenderer/plane/r_skyplane.h"
|
#include "swrenderer/plane/r_skyplane.h"
|
||||||
|
|
|
@ -28,11 +28,13 @@
|
||||||
#include "d_net.h"
|
#include "d_net.h"
|
||||||
#include "g_level.h"
|
#include "g_level.h"
|
||||||
#include "gl/dynlights/gl_dynlight.h"
|
#include "gl/dynlights/gl_dynlight.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
#include "swrenderer/scene/r_opaque_pass.h"
|
#include "swrenderer/scene/r_opaque_pass.h"
|
||||||
#include "swrenderer/scene/r_3dfloors.h"
|
#include "swrenderer/scene/r_3dfloors.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "swrenderer/plane/r_flatplane.h"
|
#include "swrenderer/plane/r_flatplane.h"
|
||||||
#include "swrenderer/plane/r_slopeplane.h"
|
#include "swrenderer/plane/r_slopeplane.h"
|
||||||
#include "swrenderer/plane/r_skyplane.h"
|
#include "swrenderer/plane/r_skyplane.h"
|
||||||
|
|
|
@ -1,751 +0,0 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// $Id:$
|
|
||||||
//
|
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
||||||
//
|
|
||||||
// This source is available for distribution and/or modification
|
|
||||||
// only under the terms of the DOOM Source Code License as
|
|
||||||
// published by id Software. All rights reserved.
|
|
||||||
//
|
|
||||||
// The source is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
// $Log:$
|
|
||||||
//
|
|
||||||
// DESCRIPTION:
|
|
||||||
// Rendering main loop and setup functions,
|
|
||||||
// utility functions (BSP, geometry, trigonometry).
|
|
||||||
// See tables.c, too.
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// HEADER FILES ------------------------------------------------------------
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include "templates.h"
|
|
||||||
#include "doomdef.h"
|
|
||||||
#include "d_net.h"
|
|
||||||
#include "doomstat.h"
|
|
||||||
#include "m_random.h"
|
|
||||||
#include "m_bbox.h"
|
|
||||||
#include "r_main.h"
|
|
||||||
#include "drawers/r_draw.h"
|
|
||||||
#include "plane/r_flatplane.h"
|
|
||||||
#include "scene/r_opaque_pass.h"
|
|
||||||
#include "segments/r_drawsegment.h"
|
|
||||||
#include "segments/r_portalsegment.h"
|
|
||||||
#include "segments/r_clipsegment.h"
|
|
||||||
#include "scene/r_3dfloors.h"
|
|
||||||
#include "scene/r_portal.h"
|
|
||||||
#include "scene/r_translucent_pass.h"
|
|
||||||
#include "r_sky.h"
|
|
||||||
#include "drawers/r_draw_rgba.h"
|
|
||||||
#include "st_stuff.h"
|
|
||||||
#include "c_cvars.h"
|
|
||||||
#include "c_dispatch.h"
|
|
||||||
#include "v_video.h"
|
|
||||||
#include "stats.h"
|
|
||||||
#include "i_video.h"
|
|
||||||
#include "i_system.h"
|
|
||||||
#include "a_sharedglobal.h"
|
|
||||||
#include "r_data/r_translate.h"
|
|
||||||
#include "p_3dmidtex.h"
|
|
||||||
#include "r_data/r_interpolate.h"
|
|
||||||
#include "v_palette.h"
|
|
||||||
#include "po_man.h"
|
|
||||||
#include "p_effect.h"
|
|
||||||
#include "st_start.h"
|
|
||||||
#include "v_font.h"
|
|
||||||
#include "r_data/colormaps.h"
|
|
||||||
#include "p_maputl.h"
|
|
||||||
#include "p_setup.h"
|
|
||||||
#include "version.h"
|
|
||||||
#include "c_console.h"
|
|
||||||
#include "r_memory.h"
|
|
||||||
#include "swrenderer/things/r_playersprite.h"
|
|
||||||
#include "swrenderer/plane/r_visibleplanelist.h"
|
|
||||||
|
|
||||||
CVAR (String, r_viewsize, "", CVAR_NOSET)
|
|
||||||
CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE)
|
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
|
|
||||||
|
|
||||||
namespace swrenderer
|
|
||||||
{
|
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define TEST_X 32343794
|
|
||||||
#define TEST_Y 111387517
|
|
||||||
#define TEST_Z 2164524
|
|
||||||
#define TEST_ANGLE 2468347904
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// TYPES -------------------------------------------------------------------
|
|
||||||
|
|
||||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
|
||||||
|
|
||||||
void R_SpanInitData ();
|
|
||||||
|
|
||||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
|
||||||
|
|
||||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
|
||||||
|
|
||||||
static void R_ShutdownRenderer();
|
|
||||||
|
|
||||||
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
|
||||||
|
|
||||||
extern int fuzzviewheight;
|
|
||||||
|
|
||||||
|
|
||||||
// PRIVATE DATA DECLARATIONS -----------------------------------------------
|
|
||||||
|
|
||||||
static double CurrentVisibility = 8.f;
|
|
||||||
static double MaxVisForWall;
|
|
||||||
static double MaxVisForFloor;
|
|
||||||
bool r_dontmaplines;
|
|
||||||
|
|
||||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
|
||||||
|
|
||||||
bool r_swtruecolor;
|
|
||||||
|
|
||||||
double r_BaseVisibility;
|
|
||||||
double r_WallVisibility;
|
|
||||||
double r_FloorVisibility;
|
|
||||||
float r_TiltVisibility;
|
|
||||||
double r_SpriteVisibility;
|
|
||||||
double r_ParticleVisibility;
|
|
||||||
|
|
||||||
double GlobVis;
|
|
||||||
fixed_t viewingrangerecip;
|
|
||||||
double FocalLengthX;
|
|
||||||
double FocalLengthY;
|
|
||||||
FDynamicColormap*basecolormap; // [RH] colormap currently drawing with
|
|
||||||
int fixedlightlev;
|
|
||||||
FSWColormap *fixedcolormap;
|
|
||||||
FSpecialColormap *realfixedcolormap;
|
|
||||||
double WallTMapScale2;
|
|
||||||
|
|
||||||
|
|
||||||
bool bRenderingToCanvas; // [RH] True if rendering to a special canvas
|
|
||||||
double globaluclip, globaldclip;
|
|
||||||
double CenterX, CenterY;
|
|
||||||
double YaspectMul;
|
|
||||||
double BaseYaspectMul; // yaspectmul without a forced aspect ratio
|
|
||||||
double IYaspectMul;
|
|
||||||
double InvZtoScale;
|
|
||||||
|
|
||||||
// just for profiling purposes
|
|
||||||
int linecount;
|
|
||||||
int loopcount;
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// precalculated math tables
|
|
||||||
//
|
|
||||||
|
|
||||||
// The xtoviewangleangle[] table maps a screen pixel
|
|
||||||
// to the lowest viewangle that maps back to x ranges
|
|
||||||
// from clipangle to -clipangle.
|
|
||||||
angle_t xtoviewangle[MAXWIDTH+1];
|
|
||||||
|
|
||||||
bool foggy; // [RH] ignore extralight and fullbright?
|
|
||||||
int r_actualextralight;
|
|
||||||
|
|
||||||
cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
|
||||||
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
|
||||||
|
|
||||||
static int lastcenteryfrac;
|
|
||||||
|
|
||||||
// CODE --------------------------------------------------------------------
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_InitTextureMapping
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void R_InitTextureMapping ()
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
// Calc focallength so FieldOfView angles cover viewwidth.
|
|
||||||
FocalLengthX = CenterX / FocalTangent;
|
|
||||||
FocalLengthY = FocalLengthX * YaspectMul;
|
|
||||||
|
|
||||||
// This is 1/FocalTangent before the widescreen extension of FOV.
|
|
||||||
viewingrangerecip = FLOAT2FIXED(1. / tan(FieldOfView.Radians() / 2));
|
|
||||||
|
|
||||||
|
|
||||||
// Now generate xtoviewangle for sky texture mapping.
|
|
||||||
// [RH] Do not generate viewangletox, because texture mapping is no
|
|
||||||
// longer done with trig, so it's not needed.
|
|
||||||
const double slopestep = FocalTangent / centerx;
|
|
||||||
double slope;
|
|
||||||
|
|
||||||
for (i = centerx, slope = 0; i <= viewwidth; i++, slope += slopestep)
|
|
||||||
{
|
|
||||||
xtoviewangle[i] = angle_t((2 * M_PI - atan(slope)) * (ANGLE_180 / M_PI));
|
|
||||||
}
|
|
||||||
for (i = 0; i < centerx; i++)
|
|
||||||
{
|
|
||||||
xtoviewangle[i] = 0 - xtoviewangle[viewwidth - i - 1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_SetVisibility
|
|
||||||
//
|
|
||||||
// Changes how rapidly things get dark with distance
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void R_SetVisibility(double vis)
|
|
||||||
{
|
|
||||||
// Allow negative visibilities, just for novelty's sake
|
|
||||||
vis = clamp(vis, -204.7, 204.7); // (205 and larger do not work in 5:4 aspect ratio)
|
|
||||||
|
|
||||||
CurrentVisibility = vis;
|
|
||||||
|
|
||||||
if (FocalTangent == 0 || FocalLengthY == 0)
|
|
||||||
{ // If r_visibility is called before the renderer is all set up, don't
|
|
||||||
// divide by zero. This will be called again later, and the proper
|
|
||||||
// values can be initialized then.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
r_BaseVisibility = vis;
|
|
||||||
|
|
||||||
// Prevent overflow on walls
|
|
||||||
if (r_BaseVisibility < 0 && r_BaseVisibility < -MaxVisForWall)
|
|
||||||
r_WallVisibility = -MaxVisForWall;
|
|
||||||
else if (r_BaseVisibility > 0 && r_BaseVisibility > MaxVisForWall)
|
|
||||||
r_WallVisibility = MaxVisForWall;
|
|
||||||
else
|
|
||||||
r_WallVisibility = r_BaseVisibility;
|
|
||||||
|
|
||||||
r_WallVisibility = (InvZtoScale * SCREENWIDTH*AspectBaseHeight(WidescreenRatio) /
|
|
||||||
(viewwidth*SCREENHEIGHT*3)) * (r_WallVisibility * FocalTangent);
|
|
||||||
|
|
||||||
// Prevent overflow on floors/ceilings. Note that the calculation of
|
|
||||||
// MaxVisForFloor means that planes less than two units from the player's
|
|
||||||
// view could still overflow, but there is no way to totally eliminate
|
|
||||||
// that while still using fixed point math.
|
|
||||||
if (r_BaseVisibility < 0 && r_BaseVisibility < -MaxVisForFloor)
|
|
||||||
r_FloorVisibility = -MaxVisForFloor;
|
|
||||||
else if (r_BaseVisibility > 0 && r_BaseVisibility > MaxVisForFloor)
|
|
||||||
r_FloorVisibility = MaxVisForFloor;
|
|
||||||
else
|
|
||||||
r_FloorVisibility = r_BaseVisibility;
|
|
||||||
|
|
||||||
r_FloorVisibility = 160.0 * r_FloorVisibility / FocalLengthY;
|
|
||||||
|
|
||||||
r_TiltVisibility = float(vis * FocalTangent * (16.f * 320.f) / viewwidth);
|
|
||||||
r_SpriteVisibility = r_WallVisibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_GetVisibility
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
double R_GetVisibility()
|
|
||||||
{
|
|
||||||
return CurrentVisibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// CCMD r_visibility
|
|
||||||
//
|
|
||||||
// Controls how quickly light ramps across a 1/z range. Set this, and it
|
|
||||||
// sets all the r_*Visibility variables (except r_SkyVisibilily, which is
|
|
||||||
// currently unused).
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
CCMD (r_visibility)
|
|
||||||
{
|
|
||||||
if (argv.argc() < 2)
|
|
||||||
{
|
|
||||||
Printf ("Visibility is %g\n", R_GetVisibility());
|
|
||||||
}
|
|
||||||
else if (!netgame)
|
|
||||||
{
|
|
||||||
R_SetVisibility(atof(argv[1]));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Printf ("Visibility cannot be changed in net games.\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_SetWindow
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio)
|
|
||||||
{
|
|
||||||
int virtheight, virtwidth, virtwidth2, virtheight2;
|
|
||||||
|
|
||||||
if (!bRenderingToCanvas)
|
|
||||||
{ // Set r_viewsize cvar to reflect the current view size
|
|
||||||
UCVarValue value;
|
|
||||||
char temp[16];
|
|
||||||
|
|
||||||
mysnprintf (temp, countof(temp), "%d x %d", viewwidth, viewheight);
|
|
||||||
value.String = temp;
|
|
||||||
r_viewsize.ForceSet (value, CVAR_String);
|
|
||||||
}
|
|
||||||
|
|
||||||
fuzzviewheight = viewheight - 2; // Maximum row the fuzzer can draw to
|
|
||||||
|
|
||||||
lastcenteryfrac = 1<<30;
|
|
||||||
CenterX = centerx;
|
|
||||||
CenterY = centery;
|
|
||||||
|
|
||||||
virtwidth = virtwidth2 = fullWidth;
|
|
||||||
virtheight = virtheight2 = fullHeight;
|
|
||||||
|
|
||||||
if (AspectTallerThanWide(trueratio))
|
|
||||||
{
|
|
||||||
virtheight2 = virtheight2 * AspectMultiplier(trueratio) / 48;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
virtwidth2 = virtwidth2 * AspectMultiplier(trueratio) / 48;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AspectTallerThanWide(WidescreenRatio))
|
|
||||||
{
|
|
||||||
virtheight = virtheight * AspectMultiplier(WidescreenRatio) / 48;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
virtwidth = virtwidth * AspectMultiplier(WidescreenRatio) / 48;
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseYaspectMul = 320.0 * virtheight2 / (r_Yaspect * virtwidth2);
|
|
||||||
YaspectMul = 320.0 * virtheight / (r_Yaspect * virtwidth);
|
|
||||||
IYaspectMul = (double)virtwidth * r_Yaspect / 320.0 / virtheight;
|
|
||||||
InvZtoScale = YaspectMul * CenterX;
|
|
||||||
|
|
||||||
WallTMapScale2 = IYaspectMul / CenterX;
|
|
||||||
|
|
||||||
// psprite scales
|
|
||||||
RenderPlayerSprite::SetupSpriteScale();
|
|
||||||
|
|
||||||
// thing clipping
|
|
||||||
fillshort (screenheightarray, viewwidth, (short)viewheight);
|
|
||||||
|
|
||||||
R_InitTextureMapping ();
|
|
||||||
|
|
||||||
MaxVisForWall = (InvZtoScale * (SCREENWIDTH*r_Yaspect) /
|
|
||||||
(viewwidth*SCREENHEIGHT * FocalTangent));
|
|
||||||
MaxVisForWall = 32767.0 / MaxVisForWall;
|
|
||||||
MaxVisForFloor = 32767.0 / (viewheight >> 2) * FocalLengthY / 160;
|
|
||||||
|
|
||||||
// Reset r_*Visibility vars
|
|
||||||
R_SetVisibility(R_GetVisibility());
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_Init
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void R_InitRenderer()
|
|
||||||
{
|
|
||||||
atterm(R_ShutdownRenderer);
|
|
||||||
// viewwidth / viewheight are set by the defaults
|
|
||||||
fillshort (zeroarray, MAXWIDTH, 0);
|
|
||||||
|
|
||||||
R_InitShadeMaps();
|
|
||||||
R_InitColumnDrawers ();
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_ShutdownRenderer
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
static void R_ShutdownRenderer()
|
|
||||||
{
|
|
||||||
RenderTranslucentPass::Deinit();
|
|
||||||
VisiblePlaneList::Instance()->Deinit();
|
|
||||||
Clip3DFloors::Instance()->Cleanup();
|
|
||||||
R_DeinitOpenings();
|
|
||||||
R_FreeDrawSegs();
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_SetupColormap
|
|
||||||
//
|
|
||||||
// Sets up special fixed colormaps
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void R_SetupColormap(player_t *player)
|
|
||||||
{
|
|
||||||
realfixedcolormap = NULL;
|
|
||||||
fixedcolormap = NULL;
|
|
||||||
fixedlightlev = -1;
|
|
||||||
|
|
||||||
if (player != NULL && camera == player->mo)
|
|
||||||
{
|
|
||||||
if (player->fixedcolormap >= 0 && player->fixedcolormap < (int)SpecialColormaps.Size())
|
|
||||||
{
|
|
||||||
realfixedcolormap = &SpecialColormaps[player->fixedcolormap];
|
|
||||||
if (RenderTarget == screen && (r_swtruecolor || ((DFrameBuffer *)screen->Accel2D && r_shadercolormaps)))
|
|
||||||
{
|
|
||||||
// Render everything fullbright. The copy to video memory will
|
|
||||||
// apply the special colormap, so it won't be restricted to the
|
|
||||||
// palette.
|
|
||||||
fixedcolormap = &realcolormaps;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fixedcolormap = &SpecialColormaps[player->fixedcolormap];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (player->fixedlightlevel >= 0 && player->fixedlightlevel < NUMCOLORMAPS)
|
|
||||||
{
|
|
||||||
fixedlightlev = player->fixedlightlevel * 256;
|
|
||||||
// [SP] Emulate GZDoom's light-amp goggles.
|
|
||||||
if (r_fullbrightignoresectorcolor && fixedlightlev >= 0)
|
|
||||||
{
|
|
||||||
fixedcolormap = &FullNormalLight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// [RH] Inverse light for shooting the Sigil
|
|
||||||
if (fixedcolormap == NULL && extralight == INT_MIN)
|
|
||||||
{
|
|
||||||
fixedcolormap = &SpecialColormaps[INVERSECOLORMAP];
|
|
||||||
extralight = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_SetupFreelook
|
|
||||||
//
|
|
||||||
// [RH] freelook stuff
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void R_SetupFreelook()
|
|
||||||
{
|
|
||||||
double dy;
|
|
||||||
|
|
||||||
if (camera != NULL)
|
|
||||||
{
|
|
||||||
dy = FocalLengthY * (-ViewPitch).Tan();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dy = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CenterY = (viewheight / 2.0) + dy;
|
|
||||||
centery = xs_ToInt(CenterY);
|
|
||||||
globaluclip = -CenterY / InvZtoScale;
|
|
||||||
globaldclip = (viewheight - CenterY) / InvZtoScale;
|
|
||||||
|
|
||||||
RenderFlatPlane::SetupSlope();
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_SetupBuffer
|
|
||||||
//
|
|
||||||
// Precalculate all row offsets and fuzz table.
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void R_SetupBuffer ()
|
|
||||||
{
|
|
||||||
using namespace drawerargs;
|
|
||||||
|
|
||||||
static BYTE *lastbuff = NULL;
|
|
||||||
|
|
||||||
int pitch = RenderTarget->GetPitch();
|
|
||||||
int pixelsize = r_swtruecolor ? 4 : 1;
|
|
||||||
BYTE *lineptr = RenderTarget->GetBuffer() + (viewwindowy*pitch + viewwindowx) * pixelsize;
|
|
||||||
|
|
||||||
if (dc_pitch != pitch || lineptr != lastbuff)
|
|
||||||
{
|
|
||||||
if (dc_pitch != pitch)
|
|
||||||
{
|
|
||||||
dc_pitch = pitch;
|
|
||||||
R_InitFuzzTable (pitch);
|
|
||||||
}
|
|
||||||
dc_destorg = lineptr;
|
|
||||||
dc_destheight = RenderTarget->GetHeight() - viewwindowy;
|
|
||||||
for (int i = 0; i < RenderTarget->GetHeight(); i++)
|
|
||||||
{
|
|
||||||
ylookup[i] = i * pitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_RenderActorView
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void R_RenderActorView (AActor *actor, bool dontmaplines)
|
|
||||||
{
|
|
||||||
WallCycles.Reset();
|
|
||||||
PlaneCycles.Reset();
|
|
||||||
MaskedCycles.Reset();
|
|
||||||
WallScanCycles.Reset();
|
|
||||||
|
|
||||||
Clip3DFloors *clip3d = Clip3DFloors::Instance();
|
|
||||||
clip3d->fakeActive = false; // kg3D - reset fake floor indicator
|
|
||||||
clip3d->ResetClip(); // reset clips (floor/ceiling)
|
|
||||||
|
|
||||||
R_SetupBuffer ();
|
|
||||||
R_SetupFrame (actor);
|
|
||||||
|
|
||||||
// Clear buffers.
|
|
||||||
R_ClearClipSegs (0, viewwidth);
|
|
||||||
R_ClearDrawSegs ();
|
|
||||||
VisiblePlaneList::Instance()->Clear(true);
|
|
||||||
R_FreePlaneLights();
|
|
||||||
RenderTranslucentPass::Clear();
|
|
||||||
|
|
||||||
// opening / clipping determination
|
|
||||||
RenderOpaquePass::Instance()->ClearClip();
|
|
||||||
R_FreeOpenings();
|
|
||||||
|
|
||||||
NetUpdate ();
|
|
||||||
|
|
||||||
colfunc = basecolfunc;
|
|
||||||
spanfunc = &SWPixelFormatDrawers::DrawSpan;
|
|
||||||
|
|
||||||
RenderPortal::Instance()->SetMainPortal();
|
|
||||||
|
|
||||||
r_dontmaplines = dontmaplines;
|
|
||||||
|
|
||||||
// [RH] Hack to make windows into underwater areas possible
|
|
||||||
RenderOpaquePass::Instance()->ResetFakingUnderwater();
|
|
||||||
|
|
||||||
// [RH] Setup particles for this frame
|
|
||||||
P_FindParticleSubsectors ();
|
|
||||||
|
|
||||||
WallCycles.Clock();
|
|
||||||
ActorRenderFlags savedflags = camera->renderflags;
|
|
||||||
// Never draw the player unless in chasecam mode
|
|
||||||
if (!r_showviewer)
|
|
||||||
{
|
|
||||||
camera->renderflags |= RF_INVISIBLE;
|
|
||||||
}
|
|
||||||
// Link the polyobjects right before drawing the scene to reduce the amounts of calls to this function
|
|
||||||
PO_LinkToSubsectors();
|
|
||||||
RenderOpaquePass::Instance()->RenderScene();
|
|
||||||
Clip3DFloors::Instance()->ResetClip(); // reset clips (floor/ceiling)
|
|
||||||
camera->renderflags = savedflags;
|
|
||||||
WallCycles.Unclock();
|
|
||||||
|
|
||||||
NetUpdate ();
|
|
||||||
|
|
||||||
if (viewactive)
|
|
||||||
{
|
|
||||||
PlaneCycles.Clock();
|
|
||||||
VisiblePlaneList::Instance()->Render();
|
|
||||||
RenderPortal::Instance()->RenderPlanePortals();
|
|
||||||
PlaneCycles.Unclock();
|
|
||||||
|
|
||||||
RenderPortal::Instance()->RenderLinePortals();
|
|
||||||
|
|
||||||
NetUpdate ();
|
|
||||||
|
|
||||||
MaskedCycles.Clock();
|
|
||||||
RenderTranslucentPass::Render();
|
|
||||||
MaskedCycles.Unclock();
|
|
||||||
|
|
||||||
NetUpdate ();
|
|
||||||
}
|
|
||||||
WallPortals.Clear ();
|
|
||||||
interpolator.RestoreInterpolations ();
|
|
||||||
R_SetupBuffer ();
|
|
||||||
|
|
||||||
// If we don't want shadered colormaps, NULL it now so that the
|
|
||||||
// copy to the screen does not use a special colormap shader.
|
|
||||||
if (!r_shadercolormaps && !r_swtruecolor)
|
|
||||||
{
|
|
||||||
realfixedcolormap = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_RenderViewToCanvas
|
|
||||||
//
|
|
||||||
// Pre: Canvas is already locked.
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas,
|
|
||||||
int x, int y, int width, int height, bool dontmaplines)
|
|
||||||
{
|
|
||||||
const bool savedviewactive = viewactive;
|
|
||||||
const bool savedoutputformat = r_swtruecolor;
|
|
||||||
|
|
||||||
if (r_swtruecolor != canvas->IsBgra())
|
|
||||||
{
|
|
||||||
r_swtruecolor = canvas->IsBgra();
|
|
||||||
R_InitColumnDrawers();
|
|
||||||
}
|
|
||||||
|
|
||||||
R_BeginDrawerCommands();
|
|
||||||
|
|
||||||
viewwidth = width;
|
|
||||||
RenderTarget = canvas;
|
|
||||||
bRenderingToCanvas = true;
|
|
||||||
|
|
||||||
R_SetWindow (12, width, height, height, true);
|
|
||||||
viewwindowx = x;
|
|
||||||
viewwindowy = y;
|
|
||||||
viewactive = true;
|
|
||||||
|
|
||||||
R_RenderActorView (actor, dontmaplines);
|
|
||||||
|
|
||||||
R_EndDrawerCommands();
|
|
||||||
|
|
||||||
RenderTarget = screen;
|
|
||||||
bRenderingToCanvas = false;
|
|
||||||
R_ExecuteSetViewSize ();
|
|
||||||
screen->Lock (true);
|
|
||||||
R_SetupBuffer ();
|
|
||||||
screen->Unlock ();
|
|
||||||
|
|
||||||
viewactive = savedviewactive;
|
|
||||||
r_swtruecolor = savedoutputformat;
|
|
||||||
|
|
||||||
if (r_swtruecolor != canvas->IsBgra())
|
|
||||||
{
|
|
||||||
R_InitColumnDrawers();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// R_MultiresInit
|
|
||||||
//
|
|
||||||
// Called from V_SetResolution()
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void R_MultiresInit ()
|
|
||||||
{
|
|
||||||
VisiblePlaneList::Instance()->Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// STAT fps
|
|
||||||
//
|
|
||||||
// Displays statistics about rendering times
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
ADD_STAT (fps)
|
|
||||||
{
|
|
||||||
FString out;
|
|
||||||
out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms",
|
|
||||||
FrameCycles.TimeMS(), WallCycles.TimeMS(), PlaneCycles.TimeMS(), MaskedCycles.TimeMS());
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static double f_acc, w_acc,p_acc,m_acc;
|
|
||||||
static int acc_c;
|
|
||||||
|
|
||||||
ADD_STAT (fps_accumulated)
|
|
||||||
{
|
|
||||||
f_acc += FrameCycles.TimeMS();
|
|
||||||
w_acc += WallCycles.TimeMS();
|
|
||||||
p_acc += PlaneCycles.TimeMS();
|
|
||||||
m_acc += MaskedCycles.TimeMS();
|
|
||||||
acc_c++;
|
|
||||||
FString out;
|
|
||||||
out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms %d counts",
|
|
||||||
f_acc/acc_c, w_acc/acc_c, p_acc/acc_c, m_acc/acc_c, acc_c);
|
|
||||||
Printf(PRINT_LOG, "%s\n", out.GetChars());
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// STAT wallcycles
|
|
||||||
//
|
|
||||||
// Displays the minimum number of cycles spent drawing walls
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
static double bestwallcycles = HUGE_VAL;
|
|
||||||
|
|
||||||
ADD_STAT (wallcycles)
|
|
||||||
{
|
|
||||||
FString out;
|
|
||||||
double cycles = WallCycles.Time();
|
|
||||||
if (cycles && cycles < bestwallcycles)
|
|
||||||
bestwallcycles = cycles;
|
|
||||||
out.Format ("%g", bestwallcycles);
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// CCMD clearwallcycles
|
|
||||||
//
|
|
||||||
// Resets the count of minimum wall drawing cycles
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
CCMD (clearwallcycles)
|
|
||||||
{
|
|
||||||
bestwallcycles = HUGE_VAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// The replacement code for Build's wallscan doesn't have any timing calls so this does not work anymore.
|
|
||||||
static double bestscancycles = HUGE_VAL;
|
|
||||||
|
|
||||||
ADD_STAT (scancycles)
|
|
||||||
{
|
|
||||||
FString out;
|
|
||||||
double scancycles = WallScanCycles.Time();
|
|
||||||
if (scancycles && scancycles < bestscancycles)
|
|
||||||
bestscancycles = scancycles;
|
|
||||||
out.Format ("%g", bestscancycles);
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
CCMD (clearscancycles)
|
|
||||||
{
|
|
||||||
bestscancycles = HUGE_VAL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,141 +0,0 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// $Id:$
|
|
||||||
//
|
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
||||||
//
|
|
||||||
// This source is available for distribution and/or modification
|
|
||||||
// only under the terms of the DOOM Source Code License as
|
|
||||||
// published by id Software. All rights reserved.
|
|
||||||
//
|
|
||||||
// The source is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
// DESCRIPTION:
|
|
||||||
// System specific interface stuff.
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __R_MAIN_H__
|
|
||||||
#define __R_MAIN_H__
|
|
||||||
|
|
||||||
#include "r_utility.h"
|
|
||||||
#include "d_player.h"
|
|
||||||
#include "v_palette.h"
|
|
||||||
#include "r_data/colormaps.h"
|
|
||||||
|
|
||||||
extern double ViewCos;
|
|
||||||
extern double ViewSin;
|
|
||||||
extern int viewwindowx;
|
|
||||||
extern int viewwindowy;
|
|
||||||
|
|
||||||
typedef BYTE lighttable_t; // This could be wider for >8 bit display.
|
|
||||||
|
|
||||||
extern cycle_t FrameCycles;
|
|
||||||
|
|
||||||
namespace swrenderer
|
|
||||||
{
|
|
||||||
|
|
||||||
extern cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
|
||||||
|
|
||||||
//
|
|
||||||
// POV related.
|
|
||||||
//
|
|
||||||
extern bool bRenderingToCanvas;
|
|
||||||
extern fixed_t viewingrangerecip;
|
|
||||||
extern double FocalLengthX, FocalLengthY;
|
|
||||||
extern double InvZtoScale;
|
|
||||||
|
|
||||||
extern double WallTMapScale2;
|
|
||||||
|
|
||||||
|
|
||||||
extern double CenterX;
|
|
||||||
extern double CenterY;
|
|
||||||
extern double YaspectMul;
|
|
||||||
extern double IYaspectMul;
|
|
||||||
|
|
||||||
extern FDynamicColormap*basecolormap; // [RH] Colormap for sector currently being drawn
|
|
||||||
|
|
||||||
extern int linecount;
|
|
||||||
extern int loopcount;
|
|
||||||
|
|
||||||
extern bool r_dontmaplines;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lighting.
|
|
||||||
//
|
|
||||||
// [RH] This has changed significantly from Doom, which used lookup
|
|
||||||
// tables based on 1/z for walls and z for flats and only recognized
|
|
||||||
// 16 discrete light levels. The terminology I use is borrowed from Build.
|
|
||||||
//
|
|
||||||
|
|
||||||
// The size of a single colormap, in bits
|
|
||||||
#define COLORMAPSHIFT 8
|
|
||||||
|
|
||||||
// Convert a light level into an unbounded colormap index (shade). Result is
|
|
||||||
// fixed point. Why the +12? I wish I knew, but experimentation indicates it
|
|
||||||
// is necessary in order to best reproduce Doom's original lighting.
|
|
||||||
#define LIGHT2SHADE(l) ((NUMCOLORMAPS*2*FRACUNIT)-(((l)+12)*(FRACUNIT*NUMCOLORMAPS/128)))
|
|
||||||
|
|
||||||
// MAXLIGHTSCALE from original DOOM, divided by 2.
|
|
||||||
#define MAXLIGHTVIS (24.0)
|
|
||||||
|
|
||||||
// Convert a shade and visibility to a clamped colormap index.
|
|
||||||
// Result is not fixed point.
|
|
||||||
// Change R_CalcTiltedLighting() when this changes.
|
|
||||||
#define GETPALOOKUP(vis,shade) (clamp<int> (((shade)-FLOAT2FIXED(MIN(MAXLIGHTVIS,double(vis))))>>FRACBITS, 0, NUMCOLORMAPS-1))
|
|
||||||
|
|
||||||
// Calculate the light multiplier for dc_light/ds_light
|
|
||||||
// This is used instead of GETPALOOKUP when ds_colormap/dc_colormap is set to the base colormap
|
|
||||||
// Returns a value between 0 and 1 in fixed point
|
|
||||||
#define LIGHTSCALE(vis,shade) FLOAT2FIXED(clamp((FIXED2DBL(shade) - (MIN(MAXLIGHTVIS,double(vis)))) / NUMCOLORMAPS, 0.0, (NUMCOLORMAPS-1)/(double)NUMCOLORMAPS))
|
|
||||||
|
|
||||||
// Converts fixedlightlev into a shade value
|
|
||||||
#define FIXEDLIGHT2SHADE(lightlev) (((lightlev) >> COLORMAPSHIFT) << FRACBITS)
|
|
||||||
|
|
||||||
extern bool r_swtruecolor;
|
|
||||||
|
|
||||||
extern double GlobVis;
|
|
||||||
|
|
||||||
void R_SetVisibility(double visibility);
|
|
||||||
double R_GetVisibility();
|
|
||||||
|
|
||||||
extern double r_BaseVisibility;
|
|
||||||
extern double r_WallVisibility;
|
|
||||||
extern double r_FloorVisibility;
|
|
||||||
extern float r_TiltVisibility;
|
|
||||||
extern double r_SpriteVisibility;
|
|
||||||
|
|
||||||
extern int r_actualextralight;
|
|
||||||
extern bool foggy;
|
|
||||||
extern int fixedlightlev;
|
|
||||||
extern FSWColormap* fixedcolormap;
|
|
||||||
extern FSpecialColormap*realfixedcolormap;
|
|
||||||
|
|
||||||
void R_InitTextureMapping ();
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// REFRESH - the actual rendering functions.
|
|
||||||
//
|
|
||||||
|
|
||||||
// Called by G_Drawer.
|
|
||||||
void R_RenderActorView (AActor *actor, bool dontmaplines = false);
|
|
||||||
void R_SetupBuffer ();
|
|
||||||
|
|
||||||
void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines = false);
|
|
||||||
|
|
||||||
// [RH] Initialize multires stuff for renderer
|
|
||||||
void R_MultiresInit (void);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern double globaluclip, globaldclip;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // __R_MAIN_H__
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "p_lnspec.h"
|
#include "p_lnspec.h"
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/drawers/r_draw.h"
|
#include "swrenderer/drawers/r_draw.h"
|
||||||
#include "swrenderer/plane/r_visibleplane.h"
|
#include "swrenderer/plane/r_visibleplane.h"
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
|
|
|
@ -32,9 +32,12 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
#include "r_main.h"
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
#include "swrenderer/things/r_playersprite.h"
|
#include "swrenderer/things/r_playersprite.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "v_palette.h"
|
#include "v_palette.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "m_png.h"
|
#include "m_png.h"
|
||||||
|
@ -69,16 +72,6 @@ CUSTOM_CVAR(Bool, r_polyrenderer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace swrenderer
|
|
||||||
{
|
|
||||||
|
|
||||||
void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio);
|
|
||||||
void R_SetupColormap(player_t *);
|
|
||||||
void R_SetupFreelook();
|
|
||||||
void R_InitRenderer();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace swrenderer;
|
using namespace swrenderer;
|
||||||
|
|
||||||
FSoftwareRenderer::FSoftwareRenderer()
|
FSoftwareRenderer::FSoftwareRenderer()
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "r_opaque_pass.h"
|
#include "r_opaque_pass.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "r_3dfloors.h"
|
#include "r_3dfloors.h"
|
||||||
|
#include "r_utility.h"
|
||||||
|
|
||||||
CVAR(Int, r_3dfloors, true, 0);
|
CVAR(Int, r_3dfloors, true, 0);
|
||||||
|
|
||||||
|
|
178
src/swrenderer/scene/r_light.cpp
Normal file
178
src/swrenderer/scene/r_light.cpp
Normal file
|
@ -0,0 +1,178 @@
|
||||||
|
//
|
||||||
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
|
//
|
||||||
|
// This source is available for distribution and/or modification
|
||||||
|
// only under the terms of the DOOM Source Code License as
|
||||||
|
// published by id Software. All rights reserved.
|
||||||
|
//
|
||||||
|
// The source is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
|
#include "templates.h"
|
||||||
|
#include "i_system.h"
|
||||||
|
#include "w_wad.h"
|
||||||
|
#include "doomdef.h"
|
||||||
|
#include "doomstat.h"
|
||||||
|
#include "r_sky.h"
|
||||||
|
#include "stats.h"
|
||||||
|
#include "v_video.h"
|
||||||
|
#include "a_sharedglobal.h"
|
||||||
|
#include "c_console.h"
|
||||||
|
#include "c_dispatch.h"
|
||||||
|
#include "cmdlib.h"
|
||||||
|
#include "d_net.h"
|
||||||
|
#include "g_level.h"
|
||||||
|
#include "r_utility.h"
|
||||||
|
#include "d_player.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
|
||||||
|
CVAR(Bool, r_shadercolormaps, true, CVAR_ARCHIVE)
|
||||||
|
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
double r_BaseVisibility;
|
||||||
|
double r_WallVisibility;
|
||||||
|
double r_FloorVisibility;
|
||||||
|
float r_TiltVisibility;
|
||||||
|
double r_SpriteVisibility;
|
||||||
|
double r_ParticleVisibility;
|
||||||
|
|
||||||
|
double GlobVis;
|
||||||
|
|
||||||
|
FDynamicColormap *basecolormap; // [RH] colormap currently drawing with
|
||||||
|
int fixedlightlev;
|
||||||
|
FSWColormap *fixedcolormap;
|
||||||
|
FSpecialColormap *realfixedcolormap;
|
||||||
|
|
||||||
|
bool foggy; // [RH] ignore extralight and fullbright?
|
||||||
|
int r_actualextralight;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
double CurrentVisibility = 8.f;
|
||||||
|
double MaxVisForWall;
|
||||||
|
double MaxVisForFloor;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Changes how rapidly things get dark with distance
|
||||||
|
void R_SetVisibility(double vis)
|
||||||
|
{
|
||||||
|
// Allow negative visibilities, just for novelty's sake
|
||||||
|
vis = clamp(vis, -204.7, 204.7); // (205 and larger do not work in 5:4 aspect ratio)
|
||||||
|
|
||||||
|
CurrentVisibility = vis;
|
||||||
|
|
||||||
|
if (FocalTangent == 0 || FocalLengthY == 0)
|
||||||
|
{ // If r_visibility is called before the renderer is all set up, don't
|
||||||
|
// divide by zero. This will be called again later, and the proper
|
||||||
|
// values can be initialized then.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
r_BaseVisibility = vis;
|
||||||
|
|
||||||
|
MaxVisForWall = (InvZtoScale * (SCREENWIDTH*r_Yaspect) / (viewwidth*SCREENHEIGHT * FocalTangent));
|
||||||
|
MaxVisForWall = 32767.0 / MaxVisForWall;
|
||||||
|
MaxVisForFloor = 32767.0 / (viewheight >> 2) * FocalLengthY / 160;
|
||||||
|
|
||||||
|
// Prevent overflow on walls
|
||||||
|
if (r_BaseVisibility < 0 && r_BaseVisibility < -MaxVisForWall)
|
||||||
|
r_WallVisibility = -MaxVisForWall;
|
||||||
|
else if (r_BaseVisibility > 0 && r_BaseVisibility > MaxVisForWall)
|
||||||
|
r_WallVisibility = MaxVisForWall;
|
||||||
|
else
|
||||||
|
r_WallVisibility = r_BaseVisibility;
|
||||||
|
|
||||||
|
r_WallVisibility = (InvZtoScale * SCREENWIDTH*AspectBaseHeight(WidescreenRatio) /
|
||||||
|
(viewwidth*SCREENHEIGHT * 3)) * (r_WallVisibility * FocalTangent);
|
||||||
|
|
||||||
|
// Prevent overflow on floors/ceilings. Note that the calculation of
|
||||||
|
// MaxVisForFloor means that planes less than two units from the player's
|
||||||
|
// view could still overflow, but there is no way to totally eliminate
|
||||||
|
// that while still using fixed point math.
|
||||||
|
if (r_BaseVisibility < 0 && r_BaseVisibility < -MaxVisForFloor)
|
||||||
|
r_FloorVisibility = -MaxVisForFloor;
|
||||||
|
else if (r_BaseVisibility > 0 && r_BaseVisibility > MaxVisForFloor)
|
||||||
|
r_FloorVisibility = MaxVisForFloor;
|
||||||
|
else
|
||||||
|
r_FloorVisibility = r_BaseVisibility;
|
||||||
|
|
||||||
|
r_FloorVisibility = 160.0 * r_FloorVisibility / FocalLengthY;
|
||||||
|
|
||||||
|
r_TiltVisibility = float(vis * FocalTangent * (16.f * 320.f) / viewwidth);
|
||||||
|
r_SpriteVisibility = r_WallVisibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
double R_GetVisibility()
|
||||||
|
{
|
||||||
|
return CurrentVisibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_SetupColormap(player_t *player)
|
||||||
|
{
|
||||||
|
realfixedcolormap = NULL;
|
||||||
|
fixedcolormap = NULL;
|
||||||
|
fixedlightlev = -1;
|
||||||
|
|
||||||
|
if (player != NULL && camera == player->mo)
|
||||||
|
{
|
||||||
|
if (player->fixedcolormap >= 0 && player->fixedcolormap < (int)SpecialColormaps.Size())
|
||||||
|
{
|
||||||
|
realfixedcolormap = &SpecialColormaps[player->fixedcolormap];
|
||||||
|
if (RenderTarget == screen && (r_swtruecolor || ((DFrameBuffer *)screen->Accel2D && r_shadercolormaps)))
|
||||||
|
{
|
||||||
|
// Render everything fullbright. The copy to video memory will
|
||||||
|
// apply the special colormap, so it won't be restricted to the
|
||||||
|
// palette.
|
||||||
|
fixedcolormap = &realcolormaps;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fixedcolormap = &SpecialColormaps[player->fixedcolormap];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (player->fixedlightlevel >= 0 && player->fixedlightlevel < NUMCOLORMAPS)
|
||||||
|
{
|
||||||
|
fixedlightlev = player->fixedlightlevel * 256;
|
||||||
|
// [SP] Emulate GZDoom's light-amp goggles.
|
||||||
|
if (r_fullbrightignoresectorcolor && fixedlightlev >= 0)
|
||||||
|
{
|
||||||
|
fixedcolormap = &FullNormalLight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// [RH] Inverse light for shooting the Sigil
|
||||||
|
if (fixedcolormap == NULL && extralight == INT_MIN)
|
||||||
|
{
|
||||||
|
fixedcolormap = &SpecialColormaps[INVERSECOLORMAP];
|
||||||
|
extralight = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Controls how quickly light ramps across a 1/z range. Set this, and it
|
||||||
|
// sets all the r_*Visibility variables (except r_SkyVisibilily, which is
|
||||||
|
// currently unused).
|
||||||
|
CCMD(r_visibility)
|
||||||
|
{
|
||||||
|
if (argv.argc() < 2)
|
||||||
|
{
|
||||||
|
Printf("Visibility is %g\n", R_GetVisibility());
|
||||||
|
}
|
||||||
|
else if (!netgame)
|
||||||
|
{
|
||||||
|
R_SetVisibility(atof(argv[1]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Printf("Visibility cannot be changed in net games.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
73
src/swrenderer/scene/r_light.h
Normal file
73
src/swrenderer/scene/r_light.h
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
//
|
||||||
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
|
//
|
||||||
|
// This source is available for distribution and/or modification
|
||||||
|
// only under the terms of the DOOM Source Code License as
|
||||||
|
// published by id Software. All rights reserved.
|
||||||
|
//
|
||||||
|
// The source is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include "r_defs.h"
|
||||||
|
#include "v_palette.h"
|
||||||
|
#include "r_data/colormaps.h"
|
||||||
|
#include "r_utility.h"
|
||||||
|
|
||||||
|
// Lighting.
|
||||||
|
//
|
||||||
|
// [RH] This has changed significantly from Doom, which used lookup
|
||||||
|
// tables based on 1/z for walls and z for flats and only recognized
|
||||||
|
// 16 discrete light levels. The terminology I use is borrowed from Build.
|
||||||
|
|
||||||
|
// The size of a single colormap, in bits
|
||||||
|
#define COLORMAPSHIFT 8
|
||||||
|
|
||||||
|
// Convert a light level into an unbounded colormap index (shade). Result is
|
||||||
|
// fixed point. Why the +12? I wish I knew, but experimentation indicates it
|
||||||
|
// is necessary in order to best reproduce Doom's original lighting.
|
||||||
|
#define LIGHT2SHADE(l) ((NUMCOLORMAPS*2*FRACUNIT)-(((l)+12)*(FRACUNIT*NUMCOLORMAPS/128)))
|
||||||
|
|
||||||
|
// MAXLIGHTSCALE from original DOOM, divided by 2.
|
||||||
|
#define MAXLIGHTVIS (24.0)
|
||||||
|
|
||||||
|
// Convert a shade and visibility to a clamped colormap index.
|
||||||
|
// Result is not fixed point.
|
||||||
|
// Change R_CalcTiltedLighting() when this changes.
|
||||||
|
#define GETPALOOKUP(vis,shade) (clamp<int> (((shade)-FLOAT2FIXED(MIN(MAXLIGHTVIS,double(vis))))>>FRACBITS, 0, NUMCOLORMAPS-1))
|
||||||
|
|
||||||
|
// Calculate the light multiplier for dc_light/ds_light
|
||||||
|
// This is used instead of GETPALOOKUP when ds_colormap/dc_colormap is set to the base colormap
|
||||||
|
// Returns a value between 0 and 1 in fixed point
|
||||||
|
#define LIGHTSCALE(vis,shade) FLOAT2FIXED(clamp((FIXED2DBL(shade) - (MIN(MAXLIGHTVIS,double(vis)))) / NUMCOLORMAPS, 0.0, (NUMCOLORMAPS-1)/(double)NUMCOLORMAPS))
|
||||||
|
|
||||||
|
// Converts fixedlightlev into a shade value
|
||||||
|
#define FIXEDLIGHT2SHADE(lightlev) (((lightlev) >> COLORMAPSHIFT) << FRACBITS)
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
extern double r_BaseVisibility;
|
||||||
|
extern double r_WallVisibility;
|
||||||
|
extern double r_FloorVisibility;
|
||||||
|
extern float r_TiltVisibility;
|
||||||
|
extern double r_SpriteVisibility;
|
||||||
|
|
||||||
|
extern double GlobVis;
|
||||||
|
|
||||||
|
extern int r_actualextralight;
|
||||||
|
extern bool foggy;
|
||||||
|
extern int fixedlightlev;
|
||||||
|
extern FSWColormap *fixedcolormap;
|
||||||
|
extern FSpecialColormap *realfixedcolormap;
|
||||||
|
extern FDynamicColormap *basecolormap; // [RH] Colormap for sector currently being drawn
|
||||||
|
|
||||||
|
void R_SetVisibility(double visibility);
|
||||||
|
double R_GetVisibility();
|
||||||
|
|
||||||
|
void R_SetupColormap(player_t *);
|
||||||
|
}
|
|
@ -32,7 +32,6 @@
|
||||||
#include "p_lnspec.h"
|
#include "p_lnspec.h"
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
|
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/drawers/r_draw.h"
|
#include "swrenderer/drawers/r_draw.h"
|
||||||
#include "swrenderer/plane/r_visibleplane.h"
|
#include "swrenderer/plane/r_visibleplane.h"
|
||||||
#include "swrenderer/plane/r_visibleplanelist.h"
|
#include "swrenderer/plane/r_visibleplanelist.h"
|
||||||
|
@ -42,6 +41,9 @@
|
||||||
#include "swrenderer/things/r_particle.h"
|
#include "swrenderer/things/r_particle.h"
|
||||||
#include "swrenderer/segments/r_clipsegment.h"
|
#include "swrenderer/segments/r_clipsegment.h"
|
||||||
#include "swrenderer/line/r_wallsetup.h"
|
#include "swrenderer/line/r_wallsetup.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "r_3dfloors.h"
|
#include "r_3dfloors.h"
|
||||||
#include "r_portal.h"
|
#include "r_portal.h"
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
|
|
|
@ -52,7 +52,9 @@
|
||||||
#include "swrenderer/things/r_visiblesprite.h"
|
#include "swrenderer/things/r_visiblesprite.h"
|
||||||
#include "swrenderer/scene/r_opaque_pass.h"
|
#include "swrenderer/scene/r_opaque_pass.h"
|
||||||
#include "swrenderer/scene/r_translucent_pass.h"
|
#include "swrenderer/scene/r_translucent_pass.h"
|
||||||
#include "swrenderer/r_main.h"
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
|
|
||||||
CVAR(Int, r_portal_recursions, 4, CVAR_ARCHIVE)
|
CVAR(Int, r_portal_recursions, 4, CVAR_ARCHIVE)
|
||||||
|
|
270
src/swrenderer/scene/r_scene.cpp
Normal file
270
src/swrenderer/scene/r_scene.cpp
Normal file
|
@ -0,0 +1,270 @@
|
||||||
|
//
|
||||||
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
|
//
|
||||||
|
// This source is available for distribution and/or modification
|
||||||
|
// only under the terms of the DOOM Source Code License as
|
||||||
|
// published by id Software. All rights reserved.
|
||||||
|
//
|
||||||
|
// The source is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
|
#include "templates.h"
|
||||||
|
#include "i_system.h"
|
||||||
|
#include "w_wad.h"
|
||||||
|
#include "doomdef.h"
|
||||||
|
#include "doomstat.h"
|
||||||
|
#include "r_sky.h"
|
||||||
|
#include "stats.h"
|
||||||
|
#include "v_video.h"
|
||||||
|
#include "a_sharedglobal.h"
|
||||||
|
#include "c_console.h"
|
||||||
|
#include "c_dispatch.h"
|
||||||
|
#include "cmdlib.h"
|
||||||
|
#include "d_net.h"
|
||||||
|
#include "g_level.h"
|
||||||
|
#include "p_effect.h"
|
||||||
|
#include "po_man.h"
|
||||||
|
#include "r_data/r_interpolate.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
#include "swrenderer/scene/r_3dfloors.h"
|
||||||
|
#include "swrenderer/scene/r_opaque_pass.h"
|
||||||
|
#include "swrenderer/scene/r_translucent_pass.h"
|
||||||
|
#include "swrenderer/scene/r_portal.h"
|
||||||
|
#include "swrenderer/segments/r_clipsegment.h"
|
||||||
|
#include "swrenderer/segments/r_drawsegment.h"
|
||||||
|
#include "swrenderer/segments/r_portalsegment.h"
|
||||||
|
#include "swrenderer/plane/r_visibleplanelist.h"
|
||||||
|
#include "swrenderer/drawers/r_draw.h"
|
||||||
|
#include "swrenderer/drawers/r_thread.h"
|
||||||
|
#include "swrenderer/r_memory.h"
|
||||||
|
|
||||||
|
EXTERN_CVAR(Bool, r_shadercolormaps)
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
||||||
|
bool r_dontmaplines;
|
||||||
|
|
||||||
|
void R_RenderActorView(AActor *actor, bool dontmaplines)
|
||||||
|
{
|
||||||
|
WallCycles.Reset();
|
||||||
|
PlaneCycles.Reset();
|
||||||
|
MaskedCycles.Reset();
|
||||||
|
WallScanCycles.Reset();
|
||||||
|
|
||||||
|
Clip3DFloors *clip3d = Clip3DFloors::Instance();
|
||||||
|
clip3d->fakeActive = false; // kg3D - reset fake floor indicator
|
||||||
|
clip3d->ResetClip(); // reset clips (floor/ceiling)
|
||||||
|
|
||||||
|
R_SetupBuffer();
|
||||||
|
R_SetupFrame(actor);
|
||||||
|
|
||||||
|
// Clear buffers.
|
||||||
|
R_ClearClipSegs(0, viewwidth);
|
||||||
|
R_ClearDrawSegs();
|
||||||
|
VisiblePlaneList::Instance()->Clear(true);
|
||||||
|
R_FreePlaneLights();
|
||||||
|
RenderTranslucentPass::Clear();
|
||||||
|
|
||||||
|
// opening / clipping determination
|
||||||
|
RenderOpaquePass::Instance()->ClearClip();
|
||||||
|
R_FreeOpenings();
|
||||||
|
|
||||||
|
NetUpdate();
|
||||||
|
|
||||||
|
colfunc = basecolfunc;
|
||||||
|
spanfunc = &SWPixelFormatDrawers::DrawSpan;
|
||||||
|
|
||||||
|
RenderPortal::Instance()->SetMainPortal();
|
||||||
|
|
||||||
|
r_dontmaplines = dontmaplines;
|
||||||
|
|
||||||
|
// [RH] Hack to make windows into underwater areas possible
|
||||||
|
RenderOpaquePass::Instance()->ResetFakingUnderwater();
|
||||||
|
|
||||||
|
// [RH] Setup particles for this frame
|
||||||
|
P_FindParticleSubsectors();
|
||||||
|
|
||||||
|
WallCycles.Clock();
|
||||||
|
ActorRenderFlags savedflags = camera->renderflags;
|
||||||
|
// Never draw the player unless in chasecam mode
|
||||||
|
if (!r_showviewer)
|
||||||
|
{
|
||||||
|
camera->renderflags |= RF_INVISIBLE;
|
||||||
|
}
|
||||||
|
// Link the polyobjects right before drawing the scene to reduce the amounts of calls to this function
|
||||||
|
PO_LinkToSubsectors();
|
||||||
|
RenderOpaquePass::Instance()->RenderScene();
|
||||||
|
Clip3DFloors::Instance()->ResetClip(); // reset clips (floor/ceiling)
|
||||||
|
camera->renderflags = savedflags;
|
||||||
|
WallCycles.Unclock();
|
||||||
|
|
||||||
|
NetUpdate();
|
||||||
|
|
||||||
|
if (viewactive)
|
||||||
|
{
|
||||||
|
PlaneCycles.Clock();
|
||||||
|
VisiblePlaneList::Instance()->Render();
|
||||||
|
RenderPortal::Instance()->RenderPlanePortals();
|
||||||
|
PlaneCycles.Unclock();
|
||||||
|
|
||||||
|
RenderPortal::Instance()->RenderLinePortals();
|
||||||
|
|
||||||
|
NetUpdate();
|
||||||
|
|
||||||
|
MaskedCycles.Clock();
|
||||||
|
RenderTranslucentPass::Render();
|
||||||
|
MaskedCycles.Unclock();
|
||||||
|
|
||||||
|
NetUpdate();
|
||||||
|
}
|
||||||
|
WallPortals.Clear();
|
||||||
|
interpolator.RestoreInterpolations();
|
||||||
|
R_SetupBuffer();
|
||||||
|
|
||||||
|
// If we don't want shadered colormaps, NULL it now so that the
|
||||||
|
// copy to the screen does not use a special colormap shader.
|
||||||
|
if (!r_shadercolormaps && !r_swtruecolor)
|
||||||
|
{
|
||||||
|
realfixedcolormap = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines)
|
||||||
|
{
|
||||||
|
const bool savedviewactive = viewactive;
|
||||||
|
const bool savedoutputformat = r_swtruecolor;
|
||||||
|
|
||||||
|
if (r_swtruecolor != canvas->IsBgra())
|
||||||
|
{
|
||||||
|
r_swtruecolor = canvas->IsBgra();
|
||||||
|
R_InitColumnDrawers();
|
||||||
|
}
|
||||||
|
|
||||||
|
R_BeginDrawerCommands();
|
||||||
|
|
||||||
|
viewwidth = width;
|
||||||
|
RenderTarget = canvas;
|
||||||
|
bRenderingToCanvas = true;
|
||||||
|
|
||||||
|
R_SetWindow(12, width, height, height, true);
|
||||||
|
viewwindowx = x;
|
||||||
|
viewwindowy = y;
|
||||||
|
viewactive = true;
|
||||||
|
|
||||||
|
R_RenderActorView(actor, dontmaplines);
|
||||||
|
|
||||||
|
R_EndDrawerCommands();
|
||||||
|
|
||||||
|
RenderTarget = screen;
|
||||||
|
bRenderingToCanvas = false;
|
||||||
|
R_ExecuteSetViewSize();
|
||||||
|
screen->Lock(true);
|
||||||
|
R_SetupBuffer();
|
||||||
|
screen->Unlock();
|
||||||
|
|
||||||
|
viewactive = savedviewactive;
|
||||||
|
r_swtruecolor = savedoutputformat;
|
||||||
|
|
||||||
|
if (r_swtruecolor != canvas->IsBgra())
|
||||||
|
{
|
||||||
|
R_InitColumnDrawers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_MultiresInit()
|
||||||
|
{
|
||||||
|
VisiblePlaneList::Instance()->Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_InitRenderer()
|
||||||
|
{
|
||||||
|
atterm(R_ShutdownRenderer);
|
||||||
|
// viewwidth / viewheight are set by the defaults
|
||||||
|
fillshort(zeroarray, MAXWIDTH, 0);
|
||||||
|
|
||||||
|
R_InitShadeMaps();
|
||||||
|
R_InitColumnDrawers();
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_ShutdownRenderer()
|
||||||
|
{
|
||||||
|
RenderTranslucentPass::Deinit();
|
||||||
|
VisiblePlaneList::Instance()->Deinit();
|
||||||
|
Clip3DFloors::Instance()->Cleanup();
|
||||||
|
R_DeinitOpenings();
|
||||||
|
R_FreeDrawSegs();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
ADD_STAT(fps)
|
||||||
|
{
|
||||||
|
FString out;
|
||||||
|
out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms",
|
||||||
|
FrameCycles.TimeMS(), WallCycles.TimeMS(), PlaneCycles.TimeMS(), MaskedCycles.TimeMS());
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static double f_acc, w_acc, p_acc, m_acc;
|
||||||
|
static int acc_c;
|
||||||
|
|
||||||
|
ADD_STAT(fps_accumulated)
|
||||||
|
{
|
||||||
|
f_acc += FrameCycles.TimeMS();
|
||||||
|
w_acc += WallCycles.TimeMS();
|
||||||
|
p_acc += PlaneCycles.TimeMS();
|
||||||
|
m_acc += MaskedCycles.TimeMS();
|
||||||
|
acc_c++;
|
||||||
|
FString out;
|
||||||
|
out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms %d counts",
|
||||||
|
f_acc / acc_c, w_acc / acc_c, p_acc / acc_c, m_acc / acc_c, acc_c);
|
||||||
|
Printf(PRINT_LOG, "%s\n", out.GetChars());
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static double bestwallcycles = HUGE_VAL;
|
||||||
|
|
||||||
|
ADD_STAT(wallcycles)
|
||||||
|
{
|
||||||
|
FString out;
|
||||||
|
double cycles = WallCycles.Time();
|
||||||
|
if (cycles && cycles < bestwallcycles)
|
||||||
|
bestwallcycles = cycles;
|
||||||
|
out.Format("%g", bestwallcycles);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCMD(clearwallcycles)
|
||||||
|
{
|
||||||
|
bestwallcycles = HUGE_VAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// The replacement code for Build's wallscan doesn't have any timing calls so this does not work anymore.
|
||||||
|
static double bestscancycles = HUGE_VAL;
|
||||||
|
|
||||||
|
ADD_STAT(scancycles)
|
||||||
|
{
|
||||||
|
FString out;
|
||||||
|
double scancycles = WallScanCycles.Time();
|
||||||
|
if (scancycles && scancycles < bestscancycles)
|
||||||
|
bestscancycles = scancycles;
|
||||||
|
out.Format("%g", bestscancycles);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCMD(clearscancycles)
|
||||||
|
{
|
||||||
|
bestscancycles = HUGE_VAL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
34
src/swrenderer/scene/r_scene.h
Normal file
34
src/swrenderer/scene/r_scene.h
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
//
|
||||||
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
|
//
|
||||||
|
// This source is available for distribution and/or modification
|
||||||
|
// only under the terms of the DOOM Source Code License as
|
||||||
|
// published by id Software. All rights reserved.
|
||||||
|
//
|
||||||
|
// The source is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include "r_defs.h"
|
||||||
|
#include "d_player.h"
|
||||||
|
|
||||||
|
extern cycle_t FrameCycles;
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
extern cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
||||||
|
|
||||||
|
extern bool r_dontmaplines;
|
||||||
|
|
||||||
|
void R_RenderActorView(AActor *actor, bool dontmaplines = false);
|
||||||
|
void R_RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines = false);
|
||||||
|
|
||||||
|
void R_InitRenderer();
|
||||||
|
void R_MultiresInit();
|
||||||
|
void R_ShutdownRenderer();
|
||||||
|
}
|
|
@ -22,7 +22,6 @@
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
#include "p_maputl.h"
|
#include "p_maputl.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/things/r_visiblesprite.h"
|
#include "swrenderer/things/r_visiblesprite.h"
|
||||||
#include "swrenderer/things/r_visiblespritelist.h"
|
#include "swrenderer/things/r_visiblespritelist.h"
|
||||||
#include "swrenderer/things/r_voxel.h"
|
#include "swrenderer/things/r_voxel.h"
|
||||||
|
@ -33,6 +32,8 @@
|
||||||
#include "swrenderer/segments/r_drawsegment.h"
|
#include "swrenderer/segments/r_drawsegment.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
#include "swrenderer/scene/r_translucent_pass.h"
|
#include "swrenderer/scene/r_translucent_pass.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "swrenderer/plane/r_visibleplane.h"
|
#include "swrenderer/plane/r_visibleplane.h"
|
||||||
#include "swrenderer/plane/r_visibleplanelist.h"
|
#include "swrenderer/plane/r_visibleplanelist.h"
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
|
|
195
src/swrenderer/scene/r_viewport.cpp
Normal file
195
src/swrenderer/scene/r_viewport.cpp
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
//
|
||||||
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
|
//
|
||||||
|
// This source is available for distribution and/or modification
|
||||||
|
// only under the terms of the DOOM Source Code License as
|
||||||
|
// published by id Software. All rights reserved.
|
||||||
|
//
|
||||||
|
// The source is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
|
#include "templates.h"
|
||||||
|
#include "i_system.h"
|
||||||
|
#include "w_wad.h"
|
||||||
|
#include "doomdef.h"
|
||||||
|
#include "doomstat.h"
|
||||||
|
#include "r_sky.h"
|
||||||
|
#include "stats.h"
|
||||||
|
#include "v_video.h"
|
||||||
|
#include "a_sharedglobal.h"
|
||||||
|
#include "c_console.h"
|
||||||
|
#include "cmdlib.h"
|
||||||
|
#include "d_net.h"
|
||||||
|
#include "g_level.h"
|
||||||
|
#include "r_utility.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
#include "swrenderer/drawers/r_draw.h"
|
||||||
|
#include "swrenderer/things/r_playersprite.h"
|
||||||
|
#include "swrenderer/plane/r_flatplane.h"
|
||||||
|
|
||||||
|
CVAR(String, r_viewsize, "", CVAR_NOSET)
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
bool r_swtruecolor;
|
||||||
|
|
||||||
|
fixed_t viewingrangerecip;
|
||||||
|
double FocalLengthX;
|
||||||
|
double FocalLengthY;
|
||||||
|
|
||||||
|
bool bRenderingToCanvas;
|
||||||
|
double globaluclip, globaldclip;
|
||||||
|
double CenterX, CenterY;
|
||||||
|
double YaspectMul;
|
||||||
|
double BaseYaspectMul; // yaspectmul without a forced aspect ratio
|
||||||
|
double IYaspectMul;
|
||||||
|
double InvZtoScale;
|
||||||
|
|
||||||
|
double WallTMapScale2;
|
||||||
|
|
||||||
|
// The xtoviewangleangle[] table maps a screen pixel
|
||||||
|
// to the lowest viewangle that maps back to x ranges
|
||||||
|
// from clipangle to -clipangle.
|
||||||
|
angle_t xtoviewangle[MAXWIDTH + 1];
|
||||||
|
|
||||||
|
void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio)
|
||||||
|
{
|
||||||
|
int virtheight, virtwidth, virtwidth2, virtheight2;
|
||||||
|
|
||||||
|
if (!bRenderingToCanvas)
|
||||||
|
{ // Set r_viewsize cvar to reflect the current view size
|
||||||
|
UCVarValue value;
|
||||||
|
char temp[16];
|
||||||
|
|
||||||
|
mysnprintf(temp, countof(temp), "%d x %d", viewwidth, viewheight);
|
||||||
|
value.String = temp;
|
||||||
|
r_viewsize.ForceSet(value, CVAR_String);
|
||||||
|
}
|
||||||
|
|
||||||
|
fuzzviewheight = viewheight - 2; // Maximum row the fuzzer can draw to
|
||||||
|
|
||||||
|
CenterX = centerx;
|
||||||
|
CenterY = centery;
|
||||||
|
|
||||||
|
virtwidth = virtwidth2 = fullWidth;
|
||||||
|
virtheight = virtheight2 = fullHeight;
|
||||||
|
|
||||||
|
if (AspectTallerThanWide(trueratio))
|
||||||
|
{
|
||||||
|
virtheight2 = virtheight2 * AspectMultiplier(trueratio) / 48;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
virtwidth2 = virtwidth2 * AspectMultiplier(trueratio) / 48;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AspectTallerThanWide(WidescreenRatio))
|
||||||
|
{
|
||||||
|
virtheight = virtheight * AspectMultiplier(WidescreenRatio) / 48;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
virtwidth = virtwidth * AspectMultiplier(WidescreenRatio) / 48;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseYaspectMul = 320.0 * virtheight2 / (r_Yaspect * virtwidth2);
|
||||||
|
YaspectMul = 320.0 * virtheight / (r_Yaspect * virtwidth);
|
||||||
|
IYaspectMul = (double)virtwidth * r_Yaspect / 320.0 / virtheight;
|
||||||
|
InvZtoScale = YaspectMul * CenterX;
|
||||||
|
|
||||||
|
WallTMapScale2 = IYaspectMul / CenterX;
|
||||||
|
|
||||||
|
// psprite scales
|
||||||
|
RenderPlayerSprite::SetupSpriteScale();
|
||||||
|
|
||||||
|
// thing clipping
|
||||||
|
fillshort(screenheightarray, viewwidth, (short)viewheight);
|
||||||
|
|
||||||
|
R_InitTextureMapping();
|
||||||
|
|
||||||
|
// Reset r_*Visibility vars
|
||||||
|
R_SetVisibility(R_GetVisibility());
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_SetupFreelook()
|
||||||
|
{
|
||||||
|
double dy;
|
||||||
|
|
||||||
|
if (camera != NULL)
|
||||||
|
{
|
||||||
|
dy = FocalLengthY * (-ViewPitch).Tan();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dy = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CenterY = (viewheight / 2.0) + dy;
|
||||||
|
centery = xs_ToInt(CenterY);
|
||||||
|
globaluclip = -CenterY / InvZtoScale;
|
||||||
|
globaldclip = (viewheight - CenterY) / InvZtoScale;
|
||||||
|
|
||||||
|
RenderFlatPlane::SetupSlope();
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_SetupBuffer()
|
||||||
|
{
|
||||||
|
using namespace drawerargs;
|
||||||
|
|
||||||
|
static BYTE *lastbuff = NULL;
|
||||||
|
|
||||||
|
int pitch = RenderTarget->GetPitch();
|
||||||
|
int pixelsize = r_swtruecolor ? 4 : 1;
|
||||||
|
BYTE *lineptr = RenderTarget->GetBuffer() + (viewwindowy*pitch + viewwindowx) * pixelsize;
|
||||||
|
|
||||||
|
if (dc_pitch != pitch || lineptr != lastbuff)
|
||||||
|
{
|
||||||
|
if (dc_pitch != pitch)
|
||||||
|
{
|
||||||
|
dc_pitch = pitch;
|
||||||
|
R_InitFuzzTable(pitch);
|
||||||
|
}
|
||||||
|
dc_destorg = lineptr;
|
||||||
|
dc_destheight = RenderTarget->GetHeight() - viewwindowy;
|
||||||
|
for (int i = 0; i < RenderTarget->GetHeight(); i++)
|
||||||
|
{
|
||||||
|
ylookup[i] = i * pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_InitTextureMapping()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Calc focallength so FieldOfView angles cover viewwidth.
|
||||||
|
FocalLengthX = CenterX / FocalTangent;
|
||||||
|
FocalLengthY = FocalLengthX * YaspectMul;
|
||||||
|
|
||||||
|
// This is 1/FocalTangent before the widescreen extension of FOV.
|
||||||
|
viewingrangerecip = FLOAT2FIXED(1. / tan(FieldOfView.Radians() / 2));
|
||||||
|
|
||||||
|
|
||||||
|
// Now generate xtoviewangle for sky texture mapping.
|
||||||
|
// [RH] Do not generate viewangletox, because texture mapping is no
|
||||||
|
// longer done with trig, so it's not needed.
|
||||||
|
const double slopestep = FocalTangent / centerx;
|
||||||
|
double slope;
|
||||||
|
|
||||||
|
for (i = centerx, slope = 0; i <= viewwidth; i++, slope += slopestep)
|
||||||
|
{
|
||||||
|
xtoviewangle[i] = angle_t((2 * M_PI - atan(slope)) * (ANGLE_180 / M_PI));
|
||||||
|
}
|
||||||
|
for (i = 0; i < centerx; i++)
|
||||||
|
{
|
||||||
|
xtoviewangle[i] = 0 - xtoviewangle[viewwidth - i - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
41
src/swrenderer/scene/r_viewport.h
Normal file
41
src/swrenderer/scene/r_viewport.h
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
//
|
||||||
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
|
//
|
||||||
|
// This source is available for distribution and/or modification
|
||||||
|
// only under the terms of the DOOM Source Code License as
|
||||||
|
// published by id Software. All rights reserved.
|
||||||
|
//
|
||||||
|
// The source is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include "r_defs.h"
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
extern bool bRenderingToCanvas;
|
||||||
|
extern fixed_t viewingrangerecip;
|
||||||
|
extern double FocalLengthX;
|
||||||
|
extern double FocalLengthY;
|
||||||
|
extern double InvZtoScale;
|
||||||
|
extern double WallTMapScale2;
|
||||||
|
extern double CenterX;
|
||||||
|
extern double CenterY;
|
||||||
|
extern double YaspectMul;
|
||||||
|
extern double IYaspectMul;
|
||||||
|
extern bool r_swtruecolor;
|
||||||
|
extern double globaluclip;
|
||||||
|
extern double globaldclip;
|
||||||
|
extern angle_t xtoviewangle[MAXWIDTH + 1];
|
||||||
|
|
||||||
|
void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio);
|
||||||
|
void R_InitTextureMapping();
|
||||||
|
void R_SetupBuffer();
|
||||||
|
void R_SetupFreelook();
|
||||||
|
void R_InitRenderer();
|
||||||
|
}
|
|
@ -18,7 +18,6 @@
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "p_lnspec.h"
|
#include "p_lnspec.h"
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/drawers/r_draw.h"
|
#include "swrenderer/drawers/r_draw.h"
|
||||||
#include "swrenderer/scene/r_3dfloors.h"
|
#include "swrenderer/scene/r_3dfloors.h"
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include "po_man.h"
|
#include "po_man.h"
|
||||||
#include "r_data/colormaps.h"
|
#include "r_data/colormaps.h"
|
||||||
#include "d_net.h"
|
#include "d_net.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
#include "swrenderer/drawers/r_draw.h"
|
#include "swrenderer/drawers/r_draw.h"
|
||||||
#include "swrenderer/scene/r_3dfloors.h"
|
#include "swrenderer/scene/r_3dfloors.h"
|
||||||
|
@ -39,6 +38,8 @@
|
||||||
#include "swrenderer/line/r_fogboundary.h"
|
#include "swrenderer/line/r_fogboundary.h"
|
||||||
#include "swrenderer/segments/r_drawsegment.h"
|
#include "swrenderer/segments/r_drawsegment.h"
|
||||||
#include "swrenderer/things/r_visiblesprite.h"
|
#include "swrenderer/things/r_visiblesprite.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "p_lnspec.h"
|
#include "p_lnspec.h"
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/drawers/r_draw.h"
|
#include "swrenderer/drawers/r_draw.h"
|
||||||
#include "swrenderer/scene/r_3dfloors.h"
|
#include "swrenderer/scene/r_3dfloors.h"
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "doomdata.h"
|
#include "doomdata.h"
|
||||||
#include "p_lnspec.h"
|
#include "p_lnspec.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "r_sky.h"
|
#include "r_sky.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
|
@ -38,6 +37,9 @@
|
||||||
#include "swrenderer/line/r_walldraw.h"
|
#include "swrenderer/line/r_walldraw.h"
|
||||||
#include "swrenderer/segments/r_drawsegment.h"
|
#include "swrenderer/segments/r_drawsegment.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "swrenderer/things/r_wallsprite.h"
|
#include "swrenderer/things/r_wallsprite.h"
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/things/r_particle.h"
|
#include "swrenderer/things/r_particle.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
|
@ -53,6 +52,8 @@
|
||||||
#include "swrenderer/segments/r_drawsegment.h"
|
#include "swrenderer/segments/r_drawsegment.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/things/r_playersprite.h"
|
#include "swrenderer/things/r_playersprite.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
|
@ -51,6 +50,9 @@
|
||||||
#include "r_voxel.h"
|
#include "r_voxel.h"
|
||||||
#include "swrenderer/segments/r_drawsegment.h"
|
#include "swrenderer/segments/r_drawsegment.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "swrenderer/things/r_sprite.h"
|
#include "swrenderer/things/r_sprite.h"
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
#include "r_visiblesprite.h"
|
#include "r_visiblesprite.h"
|
||||||
|
|
||||||
|
class DPSprite;
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
class RenderPlayerSprite
|
class RenderPlayerSprite
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/things/r_wallsprite.h"
|
#include "swrenderer/things/r_wallsprite.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
|
@ -51,6 +50,9 @@
|
||||||
#include "r_voxel.h"
|
#include "r_voxel.h"
|
||||||
#include "swrenderer/segments/r_drawsegment.h"
|
#include "swrenderer/segments/r_drawsegment.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "swrenderer/things/r_sprite.h"
|
#include "swrenderer/things/r_sprite.h"
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
#include "p_maputl.h"
|
#include "p_maputl.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/things/r_visiblesprite.h"
|
#include "swrenderer/things/r_visiblesprite.h"
|
||||||
#include "swrenderer/things/r_voxel.h"
|
#include "swrenderer/things/r_voxel.h"
|
||||||
#include "swrenderer/things/r_particle.h"
|
#include "swrenderer/things/r_particle.h"
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
#include "p_maputl.h"
|
#include "p_maputl.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/things/r_visiblesprite.h"
|
#include "swrenderer/things/r_visiblesprite.h"
|
||||||
#include "swrenderer/things/r_visiblespritelist.h"
|
#include "swrenderer/things/r_visiblespritelist.h"
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
|
|
|
@ -38,7 +38,9 @@
|
||||||
#include "swrenderer/things/r_voxel.h"
|
#include "swrenderer/things/r_voxel.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
#include "swrenderer/scene/r_translucent_pass.h"
|
#include "swrenderer/scene/r_translucent_pass.h"
|
||||||
#include "swrenderer/r_main.h"
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
|
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "swrenderer/things/r_wallsprite.h"
|
#include "swrenderer/things/r_wallsprite.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
|
@ -52,6 +51,9 @@
|
||||||
#include "r_voxel.h"
|
#include "r_voxel.h"
|
||||||
#include "swrenderer/segments/r_drawsegment.h"
|
#include "swrenderer/segments/r_drawsegment.h"
|
||||||
#include "swrenderer/scene/r_portal.h"
|
#include "swrenderer/scene/r_portal.h"
|
||||||
|
#include "swrenderer/scene/r_scene.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
#include "swrenderer/line/r_wallsetup.h"
|
#include "swrenderer/line/r_wallsetup.h"
|
||||||
#include "swrenderer/line/r_walldraw.h"
|
#include "swrenderer/line/r_walldraw.h"
|
||||||
#include "swrenderer/r_memory.h"
|
#include "swrenderer/r_memory.h"
|
||||||
|
|
|
@ -45,7 +45,8 @@
|
||||||
#ifndef NO_SWRENDER
|
#ifndef NO_SWRENDER
|
||||||
#include "swrenderer/drawers/r_draw.h"
|
#include "swrenderer/drawers/r_draw.h"
|
||||||
#include "swrenderer/drawers/r_draw_rgba.h"
|
#include "swrenderer/drawers/r_draw_rgba.h"
|
||||||
#include "swrenderer/r_main.h"
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
#include "swrenderer/scene/r_viewport.h"
|
||||||
#endif
|
#endif
|
||||||
#include "r_data/r_translate.h"
|
#include "r_data/r_translate.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
|
|
|
@ -63,7 +63,6 @@
|
||||||
#include "v_pfx.h"
|
#include "v_pfx.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
#include "swrenderer/r_main.h"
|
|
||||||
#include "r_data/r_translate.h"
|
#include "r_data/r_translate.h"
|
||||||
#include "f_wipe.h"
|
#include "f_wipe.h"
|
||||||
#include "sbar.h"
|
#include "sbar.h"
|
||||||
|
@ -73,6 +72,7 @@
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "r_data/colormaps.h"
|
#include "r_data/colormaps.h"
|
||||||
#include "SkylineBinPack.h"
|
#include "SkylineBinPack.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue