mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- pass the shade through the 2D drawer, so that palette emulation can still use it.
This commit is contained in:
parent
b6d204a88b
commit
4c6abe1bb9
7 changed files with 32 additions and 18 deletions
|
@ -3075,8 +3075,19 @@ void twod_rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t pic
|
|||
auto ptr = &twod->mVertices[dg.mVertIndex];
|
||||
float drawpoly_alpha = daalpha * (1.0f / 255.0f);
|
||||
float alpha = GetAlphaFromBlend(method, dablend) * (1.f - drawpoly_alpha); // Hmmm...
|
||||
int light = clamp(scale((numshades - dashade), 255, numshades), 0, 255);
|
||||
auto p = PalEntry((uint8_t)(alpha * 255), light, light, light);
|
||||
PalEntry p;
|
||||
|
||||
if (!hw_useindexedcolortextures)
|
||||
{
|
||||
int light = clamp(scale((numshades - dashade), 255, numshades), 0, 255);
|
||||
p = PalEntry((uint8_t)(alpha * 255), light, light, light);
|
||||
}
|
||||
else
|
||||
{
|
||||
p = PalEntry((uint8_t)(alpha * 255), 255, 255, 255);
|
||||
dg.mLightLevel = clamp(dashade, 0, numshades);
|
||||
}
|
||||
|
||||
|
||||
vec2_t const siz = { (int)dg.mTexture->GetDisplayWidth(), (int)dg.mTexture->GetDisplayHeight() };
|
||||
vec2_16_t ofs = { 0, 0 };
|
||||
|
|
|
@ -408,7 +408,7 @@ void F2DDrawer::AddTexture(FGameTexture* img, DrawParms& parms)
|
|||
double u1, v1, u2, v2;
|
||||
PalEntry vertexcolor;
|
||||
|
||||
RenderCommand dg;
|
||||
RenderCommand dg = {};
|
||||
|
||||
dg.mType = DrawTypeTriangles;
|
||||
dg.mVertCount = 4;
|
||||
|
@ -487,7 +487,7 @@ void F2DDrawer::AddShape(FGameTexture* img, DShape2D* shape, DrawParms& parms)
|
|||
|
||||
PalEntry vertexcolor;
|
||||
|
||||
RenderCommand dg;
|
||||
RenderCommand dg = {};
|
||||
|
||||
dg.mType = DrawTypeTriangles;
|
||||
dg.mVertCount = shape->mVertices.Size();
|
||||
|
@ -560,7 +560,7 @@ void F2DDrawer::AddPoly(FGameTexture *texture, FVector2 *points, int npoints,
|
|||
DAngle rotation, const FColormap &colormap, PalEntry flatcolor, double fadelevel,
|
||||
uint32_t *indices, size_t indexcount)
|
||||
{
|
||||
RenderCommand poly;
|
||||
RenderCommand poly = {};
|
||||
|
||||
poly.mType = DrawTypeTriangles;
|
||||
poly.mTexture = texture;
|
||||
|
@ -698,7 +698,7 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTextu
|
|||
{
|
||||
float fU1, fU2, fV1, fV2;
|
||||
|
||||
RenderCommand dg;
|
||||
RenderCommand dg = {};
|
||||
|
||||
dg.mType = DrawTypeTriangles;
|
||||
dg.mRenderStyle = DefaultRenderStyle();
|
||||
|
@ -817,7 +817,7 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTextu
|
|||
|
||||
void F2DDrawer::AddColorOnlyQuad(int x1, int y1, int w, int h, PalEntry color, FRenderStyle *style, bool prepend)
|
||||
{
|
||||
RenderCommand dg;
|
||||
RenderCommand dg = {};
|
||||
|
||||
dg.mType = DrawTypeTriangles;
|
||||
dg.mVertCount = 4;
|
||||
|
@ -856,7 +856,7 @@ void F2DDrawer::AddLine(double x1, double y1, double x2, double y2, int clipx1,
|
|||
PalEntry p = (PalEntry)color;
|
||||
p.a = alpha;
|
||||
|
||||
RenderCommand dg;
|
||||
RenderCommand dg = {};
|
||||
|
||||
if (clipx1 > 0 || clipy1 > 0 || clipx2 < GetWidth()- 1 || clipy2 < GetHeight() - 1)
|
||||
{
|
||||
|
@ -900,7 +900,7 @@ void F2DDrawer::AddThickLine(int x1, int y1, int x2, int y2, double thickness, u
|
|||
DVector2 corner2 = point1 + perp;
|
||||
DVector2 corner3 = point1 - perp;
|
||||
|
||||
RenderCommand dg;
|
||||
RenderCommand dg = {};
|
||||
|
||||
dg.mType = DrawTypeTriangles;
|
||||
dg.mVertCount = 4;
|
||||
|
@ -928,7 +928,7 @@ void F2DDrawer::AddPixel(int x1, int y1, uint32_t color)
|
|||
PalEntry p = (PalEntry)color;
|
||||
p.a = 255;
|
||||
|
||||
RenderCommand dg;
|
||||
RenderCommand dg = {};
|
||||
|
||||
dg.mType = DrawTypePoints;
|
||||
dg.mRenderStyle = LegacyRenderStyles[STYLE_Translucent];
|
||||
|
|
|
@ -129,9 +129,10 @@ public:
|
|||
PalEntry mSpecialColormap[2];
|
||||
int mScissor[4];
|
||||
int mDesaturate;
|
||||
FRenderStyle mRenderStyle;
|
||||
FRenderStyle mRenderStyle;
|
||||
PalEntry mColor1; // Overlay color
|
||||
ETexMode mDrawMode;
|
||||
uint8_t mLightLevel;
|
||||
uint8_t mFlags;
|
||||
|
||||
RenderCommand()
|
||||
|
@ -152,6 +153,7 @@ public:
|
|||
mRenderStyle == other.mRenderStyle &&
|
||||
mDrawMode == other.mDrawMode &&
|
||||
mFlags == other.mFlags &&
|
||||
mLightLevel == other.mLightLevel &&
|
||||
mColor1.d == other.mColor1.d;
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ int HWViewpointBuffer::Bind(FRenderState &di, unsigned int index)
|
|||
return index;
|
||||
}
|
||||
|
||||
void HWViewpointBuffer::Set2D(FRenderState &di, int width, int height)
|
||||
void HWViewpointBuffer::Set2D(FRenderState &di, int width, int height, int pll)
|
||||
{
|
||||
if (width != m2DWidth || height != m2DHeight)
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ void HWViewpointBuffer::Set2D(FRenderState &di, int width, int height)
|
|||
matrices.mNormalViewMatrix.loadIdentity();
|
||||
matrices.mViewHeight = 0;
|
||||
matrices.mGlobVis = 1.f;
|
||||
matrices.mPalLightLevels = 0;
|
||||
matrices.mPalLightLevels = pll;
|
||||
matrices.mClipLine.X = -10000000.0f;
|
||||
matrices.mShadowmapFilter = gl_shadowmap_filter;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
~HWViewpointBuffer();
|
||||
void Clear();
|
||||
int Bind(FRenderState &di, unsigned int index);
|
||||
void Set2D(FRenderState &di, int width, int height);
|
||||
void Set2D(FRenderState &di, int width, int height, int pll = 0);
|
||||
int SetViewpoint(FRenderState &di, HWViewpointUniforms *vp);
|
||||
unsigned int GetBlockSize() const { return mBlockSize; }
|
||||
};
|
||||
|
|
|
@ -105,7 +105,7 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
|
|||
void GLInstance::Draw2D(F2DDrawer *drawer)
|
||||
{
|
||||
VSMatrix mat(0);
|
||||
screen->mViewpoints->Set2D(OpenGLRenderer::gl_RenderState, xdim, ydim);
|
||||
screen->mViewpoints->Set2D(OpenGLRenderer::gl_RenderState, xdim, ydim, numshades);
|
||||
SetViewport(0, 0, xdim, ydim);
|
||||
EnableDepthTest(false);
|
||||
EnableMultisampling(false);
|
||||
|
@ -167,8 +167,8 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
|
|||
{
|
||||
auto tex = cmd.mTexture;
|
||||
|
||||
SetFadeDisable(true);
|
||||
SetShade(0, numshades);
|
||||
SetFadeDisable(cmd.mLightLevel == 0);
|
||||
SetShade(cmd.mLightLevel, numshades);
|
||||
|
||||
SetTexture(TileFiles.GetTileIndex(tex), tex, cmd.mTranslationId, cmd.mFlags & F2DDrawer::DTF_Wrap ? CLAMP_NONE : CLAMP_XY);
|
||||
EnableBlend(!(cmd.mRenderStyle.Flags & STYLEF_Alpha1));
|
||||
|
|
|
@ -197,7 +197,8 @@ void main()
|
|||
}
|
||||
|
||||
palettedColor.a = color.r == 0.0? 0.0 : 1.0;// 1.0-floor(color.r);
|
||||
color = palettedColor;
|
||||
color.rgb = palettedColor.rgb * v_color.rgb;
|
||||
color.a = palettedColor.a;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue