Hook up sprite php drawers (but disable them for now as they don't fully work yet)

This commit is contained in:
Magnus Norddahl 2017-02-19 01:23:16 +01:00
parent 2bedfca071
commit dfcfd0462f
4 changed files with 156 additions and 21 deletions

View file

@ -805,6 +805,7 @@ file( GLOB HEADER_FILES
xlat/*.h xlat/*.h
swrenderer/*.h swrenderer/*.h
swrenderer/drawers/*.h swrenderer/drawers/*.h
swrenderer/drawers/*.php
swrenderer/scene/*.h swrenderer/scene/*.h
swrenderer/segments/*.h swrenderer/segments/*.h
swrenderer/line/*.h swrenderer/line/*.h

View file

@ -60,7 +60,7 @@ CVAR(Bool, r_mipmap, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
// Level of detail texture bias // Level of detail texture bias
CVAR(Float, r_lod_bias, -1.5, 0); // To do: add CVAR_ARCHIVE | CVAR_GLOBALCONFIG when a good default has been decided CVAR(Float, r_lod_bias, -1.5, 0); // To do: add CVAR_ARCHIVE | CVAR_GLOBALCONFIG when a good default has been decided
CVAR(Bool, r_phpdrawers, true, 0); CVAR(Bool, r_phpdrawers, false, 0);
namespace swrenderer namespace swrenderer
{ {
@ -112,6 +112,140 @@ namespace swrenderer
Queue->Push<DrawWallRevSubClamp1LLVMCommand>(args); Queue->Push<DrawWallRevSubClamp1LLVMCommand>(args);
} }
void SWTruecolorDrawers::DrawColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<DrawSprite32Command>(args);
else
Queue->Push<DrawColumnLLVMCommand>(args);
}
void SWTruecolorDrawers::FillColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<FillSprite32Command>(args);
else
Queue->Push<FillColumnLLVMCommand>(args);
}
void SWTruecolorDrawers::FillAddColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<FillSpriteAddClamp32Command>(args);
else
Queue->Push<FillColumnAddLLVMCommand>(args);
}
void SWTruecolorDrawers::FillAddClampColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<FillSpriteAddClamp32Command>(args);
else
Queue->Push<FillColumnAddClampLLVMCommand>(args);
}
void SWTruecolorDrawers::FillSubClampColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<FillSpriteSubClamp32Command>(args);
else
Queue->Push<FillColumnSubClampLLVMCommand>(args);
}
void SWTruecolorDrawers::FillRevSubClampColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<FillSpriteRevSubClamp32Command>(args);
else
Queue->Push<FillColumnRevSubClampLLVMCommand>(args);
}
void SWTruecolorDrawers::DrawFuzzColumn(const SpriteDrawerArgs &args)
{
Queue->Push<DrawFuzzColumnRGBACommand>(args);
R_UpdateFuzzPos(args);
}
void SWTruecolorDrawers::DrawAddColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<DrawSpriteAddClamp32Command>(args);
else
Queue->Push<DrawColumnAddLLVMCommand>(args);
}
void SWTruecolorDrawers::DrawTranslatedColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<DrawSpriteTranslated32Command>(args);
else
Queue->Push<DrawColumnTranslatedLLVMCommand>(args);
}
void SWTruecolorDrawers::DrawTranslatedAddColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<DrawSpriteTranslatedAddClamp32Command>(args);
else
Queue->Push<DrawColumnTlatedAddLLVMCommand>(args);
}
void SWTruecolorDrawers::DrawShadedColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<DrawSpriteShaded32Command>(args);
else
Queue->Push<DrawColumnShadedLLVMCommand>(args);
}
void SWTruecolorDrawers::DrawAddClampColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<DrawSpriteAddClamp32Command>(args);
else
Queue->Push<DrawColumnAddClampLLVMCommand>(args);
}
void SWTruecolorDrawers::DrawAddClampTranslatedColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<DrawSpriteTranslatedAddClamp32Command>(args);
else
Queue->Push<DrawColumnAddClampTranslatedLLVMCommand>(args);
}
void SWTruecolorDrawers::DrawSubClampColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<DrawSpriteSubClamp32Command>(args);
else
Queue->Push<DrawColumnSubClampLLVMCommand>(args);
}
void SWTruecolorDrawers::DrawSubClampTranslatedColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<DrawSpriteTranslatedSubClamp32Command>(args);
else
Queue->Push<DrawColumnSubClampTranslatedLLVMCommand>(args);
}
void SWTruecolorDrawers::DrawRevSubClampColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<DrawSpriteRevSubClamp32Command>(args);
else
Queue->Push<DrawColumnRevSubClampLLVMCommand>(args);
}
void SWTruecolorDrawers::DrawRevSubClampTranslatedColumn(const SpriteDrawerArgs &args)
{
if (r_phpdrawers)
Queue->Push<DrawSpriteTranslatedRevSubClamp32Command>(args);
else
Queue->Push<DrawColumnRevSubClampTranslatedLLVMCommand>(args);
}
DrawSpanLLVMCommand::DrawSpanLLVMCommand(const SpanDrawerArgs &drawerargs) DrawSpanLLVMCommand::DrawSpanLLVMCommand(const SpanDrawerArgs &drawerargs)
{ {
auto shade_constants = drawerargs.ColormapConstants(); auto shade_constants = drawerargs.ColormapConstants();

View file

@ -367,23 +367,23 @@ namespace swrenderer
void DrawWallRevSubClampColumn(const WallDrawerArgs &args) override; void DrawWallRevSubClampColumn(const WallDrawerArgs &args) override;
void DrawSingleSkyColumn(const SkyDrawerArgs &args) override { Queue->Push<DrawSingleSky1LLVMCommand>(args); } void DrawSingleSkyColumn(const SkyDrawerArgs &args) override { Queue->Push<DrawSingleSky1LLVMCommand>(args); }
void DrawDoubleSkyColumn(const SkyDrawerArgs &args) override { Queue->Push<DrawDoubleSky1LLVMCommand>(args); } void DrawDoubleSkyColumn(const SkyDrawerArgs &args) override { Queue->Push<DrawDoubleSky1LLVMCommand>(args); }
void DrawColumn(const SpriteDrawerArgs &args) override { Queue->Push<DrawColumnLLVMCommand>(args); } void DrawColumn(const SpriteDrawerArgs &args) override;
void FillColumn(const SpriteDrawerArgs &args) override { Queue->Push<FillColumnLLVMCommand>(args); } void FillColumn(const SpriteDrawerArgs &args) override;
void FillAddColumn(const SpriteDrawerArgs &args) override { Queue->Push<FillColumnAddLLVMCommand>(args); } void FillAddColumn(const SpriteDrawerArgs &args) override;
void FillAddClampColumn(const SpriteDrawerArgs &args) override { Queue->Push<FillColumnAddClampLLVMCommand>(args); } void FillAddClampColumn(const SpriteDrawerArgs &args) override;
void FillSubClampColumn(const SpriteDrawerArgs &args) override { Queue->Push<FillColumnSubClampLLVMCommand>(args); } void FillSubClampColumn(const SpriteDrawerArgs &args) override;
void FillRevSubClampColumn(const SpriteDrawerArgs &args) override { Queue->Push<FillColumnRevSubClampLLVMCommand>(args); } void FillRevSubClampColumn(const SpriteDrawerArgs &args) override;
void DrawFuzzColumn(const SpriteDrawerArgs &args) override { Queue->Push<DrawFuzzColumnRGBACommand>(args); R_UpdateFuzzPos(args); } void DrawFuzzColumn(const SpriteDrawerArgs &args) override;
void DrawAddColumn(const SpriteDrawerArgs &args) override { Queue->Push<DrawColumnAddLLVMCommand>(args); } void DrawAddColumn(const SpriteDrawerArgs &args) override;
void DrawTranslatedColumn(const SpriteDrawerArgs &args) override { Queue->Push<DrawColumnTranslatedLLVMCommand>(args); } void DrawTranslatedColumn(const SpriteDrawerArgs &args) override;
void DrawTranslatedAddColumn(const SpriteDrawerArgs &args) override { Queue->Push<DrawColumnTlatedAddLLVMCommand>(args); } void DrawTranslatedAddColumn(const SpriteDrawerArgs &args) override;
void DrawShadedColumn(const SpriteDrawerArgs &args) override { Queue->Push<DrawColumnShadedLLVMCommand>(args); } void DrawShadedColumn(const SpriteDrawerArgs &args) override;
void DrawAddClampColumn(const SpriteDrawerArgs &args) override { Queue->Push<DrawColumnAddClampLLVMCommand>(args); } void DrawAddClampColumn(const SpriteDrawerArgs &args) override;
void DrawAddClampTranslatedColumn(const SpriteDrawerArgs &args) override { Queue->Push<DrawColumnAddClampTranslatedLLVMCommand>(args); } void DrawAddClampTranslatedColumn(const SpriteDrawerArgs &args) override;
void DrawSubClampColumn(const SpriteDrawerArgs &args) override { Queue->Push<DrawColumnSubClampLLVMCommand>(args); } void DrawSubClampColumn(const SpriteDrawerArgs &args) override;
void DrawSubClampTranslatedColumn(const SpriteDrawerArgs &args) override { Queue->Push<DrawColumnSubClampTranslatedLLVMCommand>(args); } void DrawSubClampTranslatedColumn(const SpriteDrawerArgs &args) override;
void DrawRevSubClampColumn(const SpriteDrawerArgs &args) override { Queue->Push<DrawColumnRevSubClampLLVMCommand>(args); } void DrawRevSubClampColumn(const SpriteDrawerArgs &args) override;
void DrawRevSubClampTranslatedColumn(const SpriteDrawerArgs &args) override { Queue->Push<DrawColumnRevSubClampTranslatedLLVMCommand>(args); } void DrawRevSubClampTranslatedColumn(const SpriteDrawerArgs &args) override;
void DrawSpan(const SpanDrawerArgs &args) override { Queue->Push<DrawSpanLLVMCommand>(args); } void DrawSpan(const SpanDrawerArgs &args) override { Queue->Push<DrawSpanLLVMCommand>(args); }
void DrawSpanMasked(const SpanDrawerArgs &args) override { Queue->Push<DrawSpanMaskedLLVMCommand>(args); } void DrawSpanMasked(const SpanDrawerArgs &args) override { Queue->Push<DrawSpanMaskedLLVMCommand>(args); }
void DrawSpanTranslucent(const SpanDrawerArgs &args) override { Queue->Push<DrawSpanTranslucentLLVMCommand>(args); } void DrawSpanTranslucent(const SpanDrawerArgs &args) override { Queue->Push<DrawSpanTranslucentLLVMCommand>(args); }

View file

@ -242,9 +242,9 @@ namespace swrenderer
double lightY = light->Y() - ViewPos.Y; double lightY = light->Y() - ViewPos.Y;
double lightZ = light->Z() - ViewPos.Z; double lightZ = light->Z() - ViewPos.Z;
float lx = (float)(lightX * ViewSin - lightY * ViewCos) - pos.X; float lx = (float)(lightX * ViewSin - lightY * ViewCos - pos.X);
float ly = (float)(lightX * ViewTanCos + lightY * ViewTanSin) - pos.Y; float ly = (float)(lightX * ViewTanCos + lightY * ViewTanSin - pos.Y);
float lz = (float)lightZ - pos.Z; float lz = (float)(lightZ - pos.Z);
bool is_point_light = (node->lightsource->flags4 & MF4_ATTENUATE) != 0; bool is_point_light = (node->lightsource->flags4 & MF4_ATTENUATE) != 0;
float LdotL = lx * lx + ly * ly + lz * lz; float LdotL = lx * lx + ly * ly + lz * lz;