2017-01-03 06:17:54 +00:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
2016-12-30 06:15:10 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2017-01-01 09:28:35 +00:00
|
|
|
#include "swrenderer/line/r_line.h"
|
2017-01-11 19:42:39 +00:00
|
|
|
#include "swrenderer/scene/r_opaque_pass.h"
|
2017-01-11 18:50:07 +00:00
|
|
|
#include "swrenderer/things/r_visiblespritelist.h"
|
2016-12-30 06:15:10 +00:00
|
|
|
|
2017-01-11 14:09:35 +00:00
|
|
|
#define MINZ double((2048*4) / double(1 << 20))
|
|
|
|
|
2017-01-16 15:23:02 +00:00
|
|
|
struct FSWColormap;
|
|
|
|
|
2016-12-30 06:15:10 +00:00
|
|
|
namespace swrenderer
|
|
|
|
{
|
2017-01-16 04:26:22 +00:00
|
|
|
class VisibleSprite
|
2016-12-30 06:15:10 +00:00
|
|
|
{
|
2017-01-16 04:26:22 +00:00
|
|
|
public:
|
2017-01-24 01:28:32 +00:00
|
|
|
VisibleSprite() { RenderStyle = STYLE_Normal; }
|
2017-01-16 15:23:02 +00:00
|
|
|
virtual ~VisibleSprite() { }
|
|
|
|
|
2017-01-16 04:43:56 +00:00
|
|
|
void Render();
|
|
|
|
|
|
|
|
bool IsCurrentPortalUniq(int portalUniq) const { return CurrentPortalUniq == portalUniq; }
|
|
|
|
const FVector3 &WorldPos() const { return gpos; }
|
|
|
|
|
|
|
|
double SortDist2D() const { return DVector2(deltax, deltay).LengthSquared(); }
|
|
|
|
float SortDist() const { return idepth; }
|
|
|
|
|
|
|
|
protected:
|
2017-01-17 00:30:12 +00:00
|
|
|
void SetColormap(double visibility, int shade, FDynamicColormap *basecolormap, bool fullbright, bool invertColormap, bool fadeToBlack);
|
|
|
|
|
2017-01-16 04:26:22 +00:00
|
|
|
virtual bool IsParticle() const { return false; }
|
|
|
|
virtual bool IsVoxel() const { return false; }
|
|
|
|
virtual bool IsWallSprite() const { return false; }
|
|
|
|
|
|
|
|
virtual void Render(short *cliptop, short *clipbottom, int minZ, int maxZ) = 0;
|
|
|
|
|
2017-01-24 01:28:32 +00:00
|
|
|
FTexture *pic = nullptr;
|
2016-12-30 06:15:10 +00:00
|
|
|
|
2017-01-24 01:28:32 +00:00
|
|
|
short x1 = 0, x2 = 0;
|
|
|
|
float gzb = 0.0f, gzt = 0.0f; // global bottom / top for silhouette clipping
|
2017-01-16 04:26:22 +00:00
|
|
|
|
2017-01-24 01:28:32 +00:00
|
|
|
double floorclip = 0.0;
|
2017-01-16 04:26:22 +00:00
|
|
|
|
2017-01-24 01:28:32 +00:00
|
|
|
double texturemid = 0.0; // floorclip
|
|
|
|
float yscale = 0.0f; // voxel and floorclip
|
2017-01-16 04:26:22 +00:00
|
|
|
|
2017-01-24 01:28:32 +00:00
|
|
|
sector_t *heightsec = nullptr; // height sector for underwater/fake ceiling
|
|
|
|
WaterFakeSide FakeFlatStat = WaterFakeSide::Center; // which side of fake/floor ceiling sprite is on
|
2017-01-16 04:26:22 +00:00
|
|
|
|
2017-01-24 01:28:32 +00:00
|
|
|
F3DFloor *fakefloor = nullptr; // 3d floor clipping
|
|
|
|
F3DFloor *fakeceiling = nullptr;
|
2016-12-30 06:15:10 +00:00
|
|
|
|
2017-01-24 01:28:32 +00:00
|
|
|
FVector3 gpos = { 0.0f, 0.0f, 0.0f }; // origin in world coordinates
|
|
|
|
sector_t *sector = nullptr; // sector this sprite is in
|
2017-01-16 04:26:22 +00:00
|
|
|
|
|
|
|
// Light shared calculation?
|
2017-01-24 01:28:32 +00:00
|
|
|
int ColormapNum = 0; // Which colormap is rendered
|
|
|
|
FSWColormap *BaseColormap = nullptr; // Base colormap used together with ColormapNum
|
|
|
|
float Alpha = 0.0f;
|
2017-01-16 15:23:02 +00:00
|
|
|
FRenderStyle RenderStyle;
|
2017-01-24 01:28:32 +00:00
|
|
|
bool foggy = false;
|
|
|
|
short renderflags = 0;
|
2017-01-16 04:26:22 +00:00
|
|
|
|
2017-01-24 01:28:32 +00:00
|
|
|
float depth = 0.0f; // Sort (draw segments), also light
|
2017-01-16 04:26:22 +00:00
|
|
|
|
2017-01-24 01:28:32 +00:00
|
|
|
float deltax = 0.0f, deltay = 0.0f; // Sort (2d/voxel version)
|
|
|
|
float idepth = 0.0f; // Sort (non-voxel version)
|
2017-01-12 19:13:21 +00:00
|
|
|
|
2017-01-24 01:28:32 +00:00
|
|
|
int CurrentPortalUniq = 0; // to identify the portal that this thing is in. used for clipping.
|
2016-12-30 06:15:10 +00:00
|
|
|
};
|
|
|
|
}
|